@tradecanvas/core 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -678,7 +678,7 @@ var Vn = 20, Hn = class {
678
678
  for (let e of f.plot) e(a);
679
679
  t.periodLevels?.render(a, i, n, r), t.pivotMarkers?.render(a, i, n, r), t.renderOverlayPlugins?.(a, "main"), a.restore(), this.renderPanels(a, t, u, f);
680
680
  let p = this.axisTagPlan(t);
681
- t.priceLimits && this.renderPriceLimits(a, n, r, t.priceLimits, t.formatPrice, p.limits), t.tradeZoneManager?.render(a, n, r), t.drawingRenderer?.render(a, n, r), t.priceLines?.render(a, n, r, i), t.currentPriceLine?.renderLine(a, n, r), t.tradingRenderer?.render(a, n, r), t.signalMarkerManager?.render(a, n, r), t.alertManager?.render(a, n, r), t.chartMarkManager?.render(a, n, r);
681
+ t.priceLimits && this.renderPriceLimits(a, n, r, t.priceLimits, t.formatPrice, p.limits), t.tradeZoneManager?.render(a, n, r), t.drawingRenderer?.render(a, n, r), t.priceLines?.render(a, n, r, i), t.currentPriceLine?.renderLine(a, n, r), t.depthOverlay?.render(a, n, r), t.tradingRenderer?.render(a, n, r), t.signalMarkerManager?.render(a, n, r), t.alertManager?.render(a, n, r), t.chartMarkManager?.render(a, n, r);
682
682
  let m = p.fixed, h = t.indicatorValueLabels === !1 ? [] : this.overlayValueTags(t, m);
683
683
  t.priceAxis?.render(a, n, r, "right", [...m.map((e) => e.y), ...h.map((e) => e.y)]), gn(a, h, n.chartRect.x + n.chartRect.width, n.priceAxisWidth ?? Te, r), t.leftViewport && (t.leftPriceAxis?.render(a, t.leftViewport, r, "left"), t.indicatorValueLabels !== !1 && this.renderLeftValueLabels(a, t, t.leftViewport)), t.tradingRenderer?.renderAxisBadges(a, n, r, p.trading), t.priceLines?.renderAxisTags(a, n, r, i, p.quote), t.currentPriceLine?.renderTag(a, n, r), t.timeAxis?.render(a, n, r, i, t.timeAxisY), this.renderPanelAxes(a, t), this.renderDrawingSpans(a, t);
684
684
  }
@@ -21843,38 +21843,7 @@ var rw = class {
21843
21843
  }
21844
21844
  return a;
21845
21845
  }
21846
- }, iw = class {
21847
- render(e, t, n, r) {
21848
- if (!r.depthOverlay?.enabled) return;
21849
- let { chartRect: i } = n, a = r.depthOverlay.bidColor ?? "rgba(31, 168, 116,0.15)", o = r.depthOverlay.askColor ?? "rgba(232, 80, 91,0.15)", s = r.depthOverlay.maxWidth ?? 100, c = 0, l = [], u = 0;
21850
- for (let e of t.bids) u += e.volume, l.push({
21851
- price: e.price,
21852
- cumVol: u
21853
- }), u > c && (c = u);
21854
- let d = [];
21855
- u = 0;
21856
- for (let e of t.asks) u += e.volume, d.push({
21857
- price: e.price,
21858
- cumVol: u
21859
- }), u > c && (c = u);
21860
- if (c === 0) return;
21861
- let f = Math.max(1, t.bids.length > 1 ? Math.abs(x(t.bids[0].price, n) - x(t.bids[1].price, n)) : 4), p = i.x + i.width;
21862
- e.fillStyle = a;
21863
- for (let { price: t, cumVol: r } of l) {
21864
- let a = x(t, n);
21865
- if (a < i.y || a > i.y + i.height) continue;
21866
- let o = r / c * s;
21867
- e.fillRect(p - o, a - f / 2, o, f);
21868
- }
21869
- e.fillStyle = o;
21870
- for (let { price: t, cumVol: r } of d) {
21871
- let a = x(t, n);
21872
- if (a < i.y || a > i.y + i.height) continue;
21873
- let o = r / c * s;
21874
- e.fillRect(p - o, a - f / 2, o, f);
21875
- }
21876
- }
21877
- }, aw = ["stopLoss", "takeProfit"], ow = class {
21846
+ }, iw = ["stopLoss", "takeProfit"], aw = class {
21878
21847
  dragState = null;
21879
21848
  startY = 0;
21880
21849
  dragging = !1;
@@ -21887,7 +21856,7 @@ var rw = class {
21887
21856
  return aC(n, r) && Math.abs(e.y - n) <= i;
21888
21857
  }, o = t.find((e) => e.draggable !== !1 && a(e.price));
21889
21858
  if (o) return this.beginOrder(o, e.y);
21890
- for (let t of n) for (let n of aw) {
21859
+ for (let t of n) for (let n of iw) {
21891
21860
  let r = t[n];
21892
21861
  if (r !== void 0 && a(r)) return this.beginStop(t, n, e.y);
21893
21862
  }
@@ -21940,7 +21909,7 @@ var rw = class {
21940
21909
  isActive() {
21941
21910
  return this.dragState !== null;
21942
21911
  }
21943
- }, sw = class {
21912
+ }, ow = class {
21944
21913
  menuElement = null;
21945
21914
  removeHandler = null;
21946
21915
  onItemSelect = null;
@@ -22027,7 +21996,7 @@ var rw = class {
22027
21996
  };
22028
21997
  //#endregion
22029
21998
  //#region src/trading/BracketTool.ts
22030
- function cw(e, t, n = {}) {
21999
+ function sw(e, t, n = {}) {
22031
22000
  let r = Math.max(Math.abs(t) * (n.riskFraction ?? .01), 1e-8), i = r * (n.riskReward ?? 2);
22032
22001
  return e === "buy" ? {
22033
22002
  side: e,
@@ -22041,11 +22010,11 @@ function cw(e, t, n = {}) {
22041
22010
  takeProfit: t - i
22042
22011
  };
22043
22012
  }
22044
- function lw(e) {
22013
+ function cw(e) {
22045
22014
  let t = Math.abs(e.entry - e.stopLoss);
22046
22015
  return t === 0 ? 0 : Math.abs(e.takeProfit - e.entry) / t;
22047
22016
  }
22048
- var uw = 6, dw = .12, fw = [6, 3], pw = class {
22017
+ var lw = 6, uw = .12, dw = [6, 3], fw = class {
22049
22018
  draft = null;
22050
22019
  dragStart = null;
22051
22020
  dragging = null;
@@ -22054,7 +22023,7 @@ var uw = 6, dw = .12, fw = [6, 3], pw = class {
22054
22023
  this.defaults = e;
22055
22024
  }
22056
22025
  start(e, t) {
22057
- this.draft = cw(e, t, this.defaults), this.dragging = null;
22026
+ this.draft = sw(e, t, this.defaults), this.dragging = null;
22058
22027
  }
22059
22028
  cancel() {
22060
22029
  this.draft = null, this.dragging = null;
@@ -22065,7 +22034,7 @@ var uw = 6, dw = .12, fw = [6, 3], pw = class {
22065
22034
  getDraft() {
22066
22035
  return this.draft ? { ...this.draft } : null;
22067
22036
  }
22068
- hitTest(e, t, n = uw) {
22037
+ hitTest(e, t, n = lw) {
22069
22038
  if (!this.draft) return null;
22070
22039
  let r = [
22071
22040
  "entry",
@@ -22091,7 +22060,7 @@ var uw = 6, dw = .12, fw = [6, 3], pw = class {
22091
22060
  drag(e, t) {
22092
22061
  if (!this.draft || !this.dragging) return !1;
22093
22062
  let n = a(e.y, t);
22094
- return this.draft = hw(this.draft, this.dragging, n), !0;
22063
+ return this.draft = mw(this.draft, this.dragging, n), !0;
22095
22064
  }
22096
22065
  endDrag() {
22097
22066
  this.dragging = null, this.dragStart = null;
@@ -22109,13 +22078,13 @@ var uw = 6, dw = .12, fw = [6, 3], pw = class {
22109
22078
  renderLines(e, t, n) {
22110
22079
  let r = this.draft;
22111
22080
  if (!r) return;
22112
- let { chartRect: i } = t, a = x(r.entry, t), o = x(r.stopLoss, t), s = x(r.takeProfit, t), { profit: c, loss: l } = mw(n);
22113
- e.save(), e.globalAlpha = dw, e.fillStyle = c, e.fillRect(i.x, Math.min(a, s), i.width, Math.abs(s - a)), e.fillStyle = l, e.fillRect(i.x, Math.min(a, o), i.width, Math.abs(o - a)), e.globalAlpha = 1, sC(e, t, a, n.text, fw), sC(e, t, s, c, []), sC(e, t, o, l, []), e.restore();
22081
+ let { chartRect: i } = t, a = x(r.entry, t), o = x(r.stopLoss, t), s = x(r.takeProfit, t), { profit: c, loss: l } = pw(n);
22082
+ e.save(), e.globalAlpha = uw, e.fillStyle = c, e.fillRect(i.x, Math.min(a, s), i.width, Math.abs(s - a)), e.fillStyle = l, e.fillRect(i.x, Math.min(a, o), i.width, Math.abs(o - a)), e.globalAlpha = 1, sC(e, t, a, n.text, dw), sC(e, t, s, c, []), sC(e, t, o, l, []), e.restore();
22114
22083
  }
22115
22084
  tags(e, t) {
22116
22085
  let n = this.draft;
22117
22086
  if (!n) return [];
22118
- let { profit: r, loss: i } = mw(t), a = n.side === "buy" ? 1 : -1, o = (e) => {
22087
+ let { profit: r, loss: i } = pw(t), a = n.side === "buy" ? 1 : -1, o = (e) => {
22119
22088
  let t = n.entry === 0 ? 0 : (e - n.entry) / n.entry * 100 * a;
22120
22089
  return `${t >= 0 ? "+" : ""}${t.toFixed(2)}%`;
22121
22090
  };
@@ -22132,7 +22101,7 @@ var uw = 6, dw = .12, fw = [6, 3], pw = class {
22132
22101
  text: n.side === "buy" ? "Long" : "Short"
22133
22102
  }, {
22134
22103
  kind: "text",
22135
- text: `${lw(n).toFixed(2)}R`
22104
+ text: `${cw(n).toFixed(2)}R`
22136
22105
  }]
22137
22106
  },
22138
22107
  {
@@ -22175,7 +22144,7 @@ var uw = 6, dw = .12, fw = [6, 3], pw = class {
22175
22144
  axisBadges(e, t, n) {
22176
22145
  let r = this.draft;
22177
22146
  if (!r) return [];
22178
- let { profit: i, loss: a } = mw(t), o = [];
22147
+ let { profit: i, loss: a } = pw(t), o = [];
22179
22148
  for (let [s, c] of [
22180
22149
  [r.takeProfit, i],
22181
22150
  [r.stopLoss, a],
@@ -22191,13 +22160,13 @@ var uw = 6, dw = .12, fw = [6, 3], pw = class {
22191
22160
  return o;
22192
22161
  }
22193
22162
  };
22194
- function mw(e) {
22163
+ function pw(e) {
22195
22164
  return {
22196
22165
  profit: e.style?.trading.profit ?? e.candleUp,
22197
22166
  loss: e.style?.trading.loss ?? e.candleDown
22198
22167
  };
22199
22168
  }
22200
- function hw(e, t, n) {
22169
+ function mw(e, t, n) {
22201
22170
  let r = e.side === "buy";
22202
22171
  if (t === "entry") {
22203
22172
  let t = n - e.entry;
@@ -22223,10 +22192,10 @@ function hw(e, t, n) {
22223
22192
  }
22224
22193
  //#endregion
22225
22194
  //#region src/trading/OrderDraftTool.ts
22226
- function gw(e, t, n) {
22195
+ function hw(e, t, n) {
22227
22196
  return n == null ? "limit" : e === "buy" ? t <= n ? "limit" : "stop" : t >= n ? "limit" : "stop";
22228
22197
  }
22229
- var _w = 6, vw = [6, 3], yw = class {
22198
+ var gw = 6, _w = [6, 3], vw = class {
22230
22199
  draft = null;
22231
22200
  dragStart = null;
22232
22201
  dragging = !1;
@@ -22258,12 +22227,12 @@ var _w = 6, vw = [6, 3], yw = class {
22258
22227
  toIntent(e) {
22259
22228
  return this.draft ? {
22260
22229
  side: this.draft.side,
22261
- type: gw(this.draft.side, this.draft.price, e),
22230
+ type: hw(this.draft.side, this.draft.price, e),
22262
22231
  price: this.draft.price,
22263
22232
  quantity: this.draft.quantity
22264
22233
  } : null;
22265
22234
  }
22266
- hitTest(e, t, n = _w) {
22235
+ hitTest(e, t, n = gw) {
22267
22236
  return this.draft ? Math.abs(x(this.draft.price, t) - e.y) <= n : !1;
22268
22237
  }
22269
22238
  beginDrag(e, t, n) {
@@ -22286,17 +22255,17 @@ var _w = 6, vw = [6, 3], yw = class {
22286
22255
  }
22287
22256
  renderLines(e, t, n) {
22288
22257
  let r = this.draft;
22289
- r && (e.save(), sC(e, t, x(r.price, t), bw(r.side, n), vw), e.restore());
22258
+ r && (e.save(), sC(e, t, x(r.price, t), yw(r.side, n), _w), e.restore());
22290
22259
  }
22291
22260
  tags(e, t, n) {
22292
22261
  let r = this.draft;
22293
22262
  if (!r) return [];
22294
22263
  let i = x(r.price, e);
22295
22264
  if (!aC(i, e)) return [];
22296
- let a = gw(r.side, r.price, n);
22265
+ let a = hw(r.side, r.price, n);
22297
22266
  return [{
22298
22267
  y: i,
22299
- color: bw(r.side, t),
22268
+ color: yw(r.side, t),
22300
22269
  grab: { kind: "draft" },
22301
22270
  cells: [{
22302
22271
  kind: "stamp",
@@ -22320,20 +22289,20 @@ var _w = 6, vw = [6, 3], yw = class {
22320
22289
  return aC(i, e) ? [{
22321
22290
  y: i,
22322
22291
  text: nt(r.price, e, n),
22323
- color: bw(r.side, t)
22292
+ color: yw(r.side, t)
22324
22293
  }] : [];
22325
22294
  }
22326
22295
  };
22327
- function bw(e, t) {
22296
+ function yw(e, t) {
22328
22297
  return e === "buy" ? t.style?.trading.buy ?? t.candleUp : t.style?.trading.sell ?? t.candleDown;
22329
22298
  }
22330
22299
  //#endregion
22331
22300
  //#region src/trading/lineButtons.ts
22332
- var xw = 2;
22333
- function Sw(e, t) {
22301
+ var bw = 2;
22302
+ function xw(e, t) {
22334
22303
  return e.type === t.type ? e.type === "cancelOrder" ? e.orderId === t.orderId : e.type === "removeStop" ? e.positionId === t.positionId && e.which === t.which : e.positionId === t.positionId : !1;
22335
22304
  }
22336
- function Cw(e, t, n = xw) {
22305
+ function Sw(e, t, n = bw) {
22337
22306
  let r = (e, n) => t.x >= e.x - n && t.x <= e.x + e.size + n && t.y >= e.y - n && t.y <= e.y + e.size + n;
22338
22307
  for (let t = e.length - 1; t >= 0; t--) if (r(e[t], 0)) return e[t];
22339
22308
  let i = null, a = Infinity;
@@ -22346,31 +22315,31 @@ function Cw(e, t, n = xw) {
22346
22315
  }
22347
22316
  //#endregion
22348
22317
  //#region src/trading/fillMarks.ts
22349
- var ww = 5, Tw = 7, Ew = 2;
22350
- function Dw(e, t) {
22318
+ var Cw = 5, ww = 7, Tw = 2;
22319
+ function Ew(e, t) {
22351
22320
  let n = t.data;
22352
22321
  return n && n.length > 0 ? e / A(n) : e;
22353
22322
  }
22354
- function Ow(e, t, n, r) {
22323
+ function Dw(e, t, n, r) {
22355
22324
  if (t.length === 0) return;
22356
22325
  let { chartRect: i } = n, a = r.orderColors?.buy ?? "#1fa874", s = r.orderColors?.sell ?? "#e8505b";
22357
22326
  e.lineWidth = 1.5;
22358
22327
  for (let r of t) {
22359
- let t = o(Dw(r.time, n), n), c = x(r.price, n);
22328
+ let t = o(Ew(r.time, n), n), c = x(r.price, n);
22360
22329
  if (t < i.x || t > i.x + i.width || c < i.y || c > i.y + i.height) continue;
22361
- let l = r.side === "buy", u = l ? c + Ew : c - Ew, d = l ? u + Tw : u - Tw;
22362
- e.beginPath(), e.moveTo(t, u), e.lineTo(t - ww, d), e.lineTo(t + ww, d), e.closePath();
22330
+ let l = r.side === "buy", u = l ? c + Tw : c - Tw, d = l ? u + ww : u - ww;
22331
+ e.beginPath(), e.moveTo(t, u), e.lineTo(t - Cw, d), e.lineTo(t + Cw, d), e.closePath();
22363
22332
  let f = l ? a : s;
22364
22333
  !r.reason || r.reason === "order" ? (e.fillStyle = f, e.fill()) : (e.strokeStyle = f, e.stroke());
22365
22334
  }
22366
22335
  }
22367
22336
  //#endregion
22368
22337
  //#region src/style/overlayColors.ts
22369
- function kw(e) {
22338
+ function Ow(e) {
22370
22339
  for (let t in e) if (e[t] !== null) return !0;
22371
22340
  return !1;
22372
22341
  }
22373
- function Aw(e, t) {
22342
+ function kw(e, t) {
22374
22343
  let n = {};
22375
22344
  for (let r of Object.keys(e)) {
22376
22345
  let i = e[r];
@@ -22378,13 +22347,13 @@ function Aw(e, t) {
22378
22347
  }
22379
22348
  return n;
22380
22349
  }
22381
- function jw(e, t) {
22350
+ function Aw(e, t) {
22382
22351
  let n = t.style?.trading;
22383
- return !n || !kw(n) ? e : {
22352
+ return !n || !Ow(n) ? e : {
22384
22353
  ...e,
22385
22354
  orderColors: {
22386
22355
  ...e.orderColors,
22387
- ...Aw({
22356
+ ...kw({
22388
22357
  buy: n.buy,
22389
22358
  sell: n.sell
22390
22359
  }, {
@@ -22394,7 +22363,7 @@ function jw(e, t) {
22394
22363
  },
22395
22364
  positionColors: {
22396
22365
  ...e.positionColors,
22397
- ...Aw({
22366
+ ...kw({
22398
22367
  profit: n.profit,
22399
22368
  loss: n.loss,
22400
22369
  entry: n.entry
@@ -22406,22 +22375,22 @@ function jw(e, t) {
22406
22375
  }
22407
22376
  };
22408
22377
  }
22409
- function Mw(e, t) {
22378
+ function jw(e, t) {
22410
22379
  let n = t.style?.markers;
22411
- return !n || !kw(n) ? e : {
22380
+ return !n || !Ow(n) ? e : {
22412
22381
  ...e,
22413
- ...Aw(n, {
22382
+ ...kw(n, {
22414
22383
  long: "longColor",
22415
22384
  short: "shortColor",
22416
22385
  neutral: "neutralColor"
22417
22386
  })
22418
22387
  };
22419
22388
  }
22420
- function Nw(e, t) {
22389
+ function Mw(e, t) {
22421
22390
  let n = t.style?.tradeZones;
22422
- return !n || !kw(n) ? e : {
22391
+ return !n || !Ow(n) ? e : {
22423
22392
  ...e,
22424
- ...Aw(n, {
22393
+ ...kw(n, {
22425
22394
  profit: "profitColor",
22426
22395
  loss: "lossColor",
22427
22396
  active: "activeColor"
@@ -22430,19 +22399,17 @@ function Nw(e, t) {
22430
22399
  }
22431
22400
  //#endregion
22432
22401
  //#region src/trading/TradingManager.ts
22433
- var Pw = 1e3, Fw = class {
22402
+ var Nw = 1e3, Pw = class {
22434
22403
  orders = [];
22435
22404
  positions = [];
22436
- depthData = null;
22437
22405
  currentPrice = null;
22438
22406
  config;
22439
22407
  orderRenderer = new GC();
22440
22408
  positionRenderer = new rw();
22441
- depthOverlay = new iw();
22442
22409
  dragHandler;
22443
- contextMenu = new sw();
22444
- bracket = new pw();
22445
- orderDraft = new yw();
22410
+ contextMenu = new ow();
22411
+ bracket = new fw();
22412
+ orderDraft = new vw();
22446
22413
  buttons = [];
22447
22414
  tagBoxes = [];
22448
22415
  tagInset = 0;
@@ -22457,7 +22424,7 @@ var Pw = 1e3, Fw = class {
22457
22424
  this.config = {
22458
22425
  ...me,
22459
22426
  ...e
22460
- }, this.dragHandler = new ow(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
22427
+ }, this.dragHandler = new aw(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
22461
22428
  this.eventCallback?.("orderPlace", e);
22462
22429
  };
22463
22430
  }
@@ -22485,9 +22452,6 @@ var Pw = 1e3, Fw = class {
22485
22452
  getCurrentPrice() {
22486
22453
  return this.currentPrice;
22487
22454
  }
22488
- setDepthData(e) {
22489
- this.depthData = e, this.requestRender?.();
22490
- }
22491
22455
  setCurrentPrice(e) {
22492
22456
  this.currentPrice = e, this.requestRender?.();
22493
22457
  }
@@ -22495,10 +22459,10 @@ var Pw = 1e3, Fw = class {
22495
22459
  Object.assign(this.config, e), this.requestRender?.();
22496
22460
  }
22497
22461
  addFill(e) {
22498
- this.fills = [...this.fills.slice(-(Pw - 1)), e], this.realisedPnl += e.pnl ?? 0, this.requestRender?.();
22462
+ this.fills = [...this.fills.slice(-(Nw - 1)), e], this.realisedPnl += e.pnl ?? 0, this.requestRender?.();
22499
22463
  }
22500
22464
  setFills(e) {
22501
- this.fills = e.slice(-Pw), this.realisedPnl = e.reduce((e, t) => e + (t.pnl ?? 0), 0), this.requestRender?.();
22465
+ this.fills = e.slice(-Nw), this.realisedPnl = e.reduce((e, t) => e + (t.pnl ?? 0), 0), this.requestRender?.();
22502
22466
  }
22503
22467
  getRealisedPnl() {
22504
22468
  return this.realisedPnl;
@@ -22508,7 +22472,7 @@ var Pw = 1e3, Fw = class {
22508
22472
  }
22509
22473
  armed = null;
22510
22474
  isOverButton(e) {
22511
- return this.config.enabled && Cw(this.buttons, e) !== null;
22475
+ return this.config.enabled && Sw(this.buttons, e) !== null;
22512
22476
  }
22513
22477
  runButton(e) {
22514
22478
  switch (e.type) {
@@ -22548,7 +22512,7 @@ var Pw = 1e3, Fw = class {
22548
22512
  entry: e.entry,
22549
22513
  stopLoss: e.stopLoss,
22550
22514
  takeProfit: e.takeProfit,
22551
- riskReward: lw(e)
22515
+ riskReward: cw(e)
22552
22516
  }), this.bracket.cancel(), this.requestRender?.(), !0) : !1;
22553
22517
  }
22554
22518
  isBracketActive() {
@@ -22569,7 +22533,7 @@ var Pw = 1e3, Fw = class {
22569
22533
  }
22570
22534
  isOverDraggableLine(e, t, n = 8) {
22571
22535
  if (!this.config.enabled) return !1;
22572
- if (OC(this.tagBoxes, e.x, e.y) && !Cw(this.buttons, e)) return !0;
22536
+ if (OC(this.tagBoxes, e.x, e.y) && !Sw(this.buttons, e)) return !0;
22573
22537
  let r = (r) => {
22574
22538
  if (r === void 0) return !1;
22575
22539
  let i = x(r, t);
@@ -22581,7 +22545,7 @@ var Pw = 1e3, Fw = class {
22581
22545
  }
22582
22546
  onPointerDown(e, t, n) {
22583
22547
  if (!this.config.enabled) return !1;
22584
- let r = Cw(this.buttons, e, n?.button), i = r ? null : OC(this.tagBoxes, e.x, e.y);
22548
+ let r = Sw(this.buttons, e, n?.button), i = r ? null : OC(this.tagBoxes, e.x, e.y);
22585
22549
  return i && this.grabTag(i, e) || (this.grabOffset = 0, this.bracket.isActive() && this.bracket.beginDrag(e, t, n?.handle)) || this.orderDraft.isActive() && this.orderDraft.beginDrag(e, t, n?.handle) ? (this.requestRender?.(), !0) : r ? (this.armed = r.action, !0) : this.dragHandler.onPointerDown(e, this.orders, this.positions, t, n?.order ?? 8);
22586
22550
  }
22587
22551
  grabTag(e, t) {
@@ -22622,8 +22586,8 @@ var Pw = 1e3, Fw = class {
22622
22586
  if (this.grabOffset = 0, this.armed) {
22623
22587
  let t = this.armed;
22624
22588
  this.armed = null;
22625
- let n = e ? Cw(this.buttons, e) : null;
22626
- return n && Sw(n.action, t) && this.runButton(t), !0;
22589
+ let n = e ? Sw(this.buttons, e) : null;
22590
+ return n && xw(n.action, t) && this.runButton(t), !0;
22627
22591
  }
22628
22592
  if (this.bracket.isDragging()) return this.bracket.endDrag(), this.requestRender?.(), !0;
22629
22593
  if (this.orderDraft.isDragging()) return this.orderDraft.endDrag(), this.requestRender?.(), !0;
@@ -22664,8 +22628,8 @@ var Pw = 1e3, Fw = class {
22664
22628
  }
22665
22629
  }
22666
22630
  renderInPlot(e, t, n) {
22667
- let r = jw(this.config, n);
22668
- this.depthData && this.depthOverlay.render(e, this.depthData, t, r), r.fillMarks !== !1 && Ow(e, this.fills, t, r);
22631
+ let r = Aw(this.config, n);
22632
+ r.fillMarks !== !1 && Dw(e, this.fills, t, r);
22669
22633
  let i = this.dragHandler.getDragState();
22670
22634
  this.positionRenderer.renderLines(e, this.positions, this.currentPrice, t, r, i), this.orderRenderer.renderLines(e, this.orders, t, r, i), this.bracket.renderLines(e, t, n), this.orderDraft.renderLines(e, t, n), NC(e, [
22671
22635
  ...this.bracket.tags(t, n),
@@ -22694,7 +22658,7 @@ var Pw = 1e3, Fw = class {
22694
22658
  return this.axisBadges(e, t).sort((e, t) => e.y - t.y);
22695
22659
  }
22696
22660
  axisBadges(e, t) {
22697
- let n = jw(this.config, t);
22661
+ let n = Aw(this.config, t);
22698
22662
  return [
22699
22663
  ...this.positionRenderer.axisBadges(this.positions, e, n, this.dragHandler.getDragState()),
22700
22664
  ...this.orderRenderer.axisBadges(this.orders, e, n, this.dragHandler.getDragState()),
@@ -22708,7 +22672,7 @@ var Pw = 1e3, Fw = class {
22708
22672
  destroy() {
22709
22673
  this.contextMenu.destroy();
22710
22674
  }
22711
- }, Iw = class {
22675
+ }, Fw = class {
22712
22676
  constructor(e) {
22713
22677
  this.manager = e;
22714
22678
  }
@@ -22727,10 +22691,96 @@ var Pw = 1e3, Fw = class {
22727
22691
  axisTagYs(e, t) {
22728
22692
  return this.manager.axisTagYs(e, t);
22729
22693
  }
22694
+ }, Iw = "rgba(31, 168, 116,0.15)", Lw = "rgba(232, 80, 91,0.15)", Rw = "#1fa874", zw = "#e8505b", Bw = 100;
22695
+ function Vw(e, t = "cumulative") {
22696
+ let n = (e, n) => {
22697
+ let r = e.filter((e) => Number.isFinite(e.price) && Number.isFinite(e.volume) && e.volume > 0);
22698
+ r.sort((e, t) => n(e.price, t.price));
22699
+ let i = 0;
22700
+ return r.map((e) => (i += e.volume, {
22701
+ price: e.price,
22702
+ value: t === "cumulative" ? i : e.volume
22703
+ }));
22704
+ }, r = n(e.bids, (e, t) => t - e), i = n(e.asks, (e, t) => e - t), a = 0;
22705
+ for (let e of r) a = Math.max(a, e.value);
22706
+ for (let e of i) a = Math.max(a, e.value);
22707
+ return {
22708
+ bids: r,
22709
+ asks: i,
22710
+ max: a
22711
+ };
22712
+ }
22713
+ function Hw(e, t) {
22714
+ if (e.length < 2) return Infinity;
22715
+ let n = Math.abs(x(e[0].price, t) - x(e[1].price, t));
22716
+ return n > 0 ? n : Infinity;
22717
+ }
22718
+ var Uw = class {
22719
+ cache = null;
22720
+ invalidate() {
22721
+ this.cache = null;
22722
+ }
22723
+ render(e, t, n, r) {
22724
+ if (!r.enabled) return;
22725
+ let i = r.mode === "level" ? "level" : "cumulative";
22726
+ (!this.cache || this.cache.depth !== t || this.cache.mode !== i) && (this.cache = {
22727
+ depth: t,
22728
+ mode: i,
22729
+ bars: Vw(t, i)
22730
+ });
22731
+ let { bids: a, asks: o, max: s } = this.cache.bars;
22732
+ if (s === 0) return;
22733
+ let { chartRect: c } = n, l = Math.min(Math.max(r.maxWidth ?? Bw, 0), c.width), u = c.x + c.width, d = Math.min(Hw(a, n), Hw(o, n)), f = Number.isFinite(d) ? d : 4, p = Math.max(1, i === "level" ? f - 1 : f), m = (t, r) => {
22734
+ e.fillStyle = r;
22735
+ for (let { price: r, value: i } of t) {
22736
+ let t = x(r, n);
22737
+ if (t < c.y || t > c.y + c.height) continue;
22738
+ let a = i / s * l;
22739
+ e.fillRect(u - a, t - p / 2, a, p);
22740
+ }
22741
+ };
22742
+ if (m(a, r.bidColor ?? Iw), m(o, r.askColor ?? Lw), r.markBest) {
22743
+ let t = (t, r) => {
22744
+ if (!t) return;
22745
+ let i = x(t.price, n);
22746
+ i < c.y || i > c.y + c.height || (e.fillStyle = r, e.fillRect(u - l, i - .5, l, 1));
22747
+ };
22748
+ t(a[0], r.bestBidColor ?? Rw), t(o[0], r.bestAskColor ?? zw);
22749
+ }
22750
+ }
22751
+ }, Ww = class {
22752
+ data = null;
22753
+ config = {};
22754
+ overlay = new Uw();
22755
+ setData(e) {
22756
+ this.data = e, this.overlay.invalidate();
22757
+ }
22758
+ setConfig(e) {
22759
+ this.config = {
22760
+ ...this.config,
22761
+ ...e
22762
+ };
22763
+ }
22764
+ getConfig() {
22765
+ return { ...this.config };
22766
+ }
22767
+ isActive() {
22768
+ return !!this.config.enabled && this.data !== null;
22769
+ }
22770
+ render(e, t, n) {
22771
+ if (!this.data || !this.config.enabled) return;
22772
+ let { chartRect: r } = t;
22773
+ e.save();
22774
+ try {
22775
+ e.beginPath(), e.rect(r.x, r.y, r.width, r.height), e.clip(), this.overlay.render(e, this.data, t, this.config);
22776
+ } finally {
22777
+ e.restore();
22778
+ }
22779
+ }
22730
22780
  };
22731
22781
  //#endregion
22732
22782
  //#region src/trading/PaperExecutionAdapter.ts
22733
- function Lw(e, t) {
22783
+ function Gw(e, t) {
22734
22784
  let n = e.trailingStop;
22735
22785
  if (n === void 0 || !(n > 0) || !Number.isFinite(t) || !(t > 0)) return e;
22736
22786
  let r = e.side === "buy", i = r ? t - n : t + n, a = e.stopLoss;
@@ -22739,7 +22789,7 @@ function Lw(e, t) {
22739
22789
  stopLoss: i
22740
22790
  };
22741
22791
  }
22742
- var Rw = class {
22792
+ var Kw = class {
22743
22793
  name = "paper";
22744
22794
  state = "disconnected";
22745
22795
  listeners = /* @__PURE__ */ new Map();
@@ -22780,7 +22830,7 @@ var Rw = class {
22780
22830
  price: e.price,
22781
22831
  stopPrice: e.stopPrice,
22782
22832
  quantity: e.quantity ?? 1,
22783
- label: e.type === "market" ? void 0 : Bw(e.type),
22833
+ label: e.type === "market" ? void 0 : Jw(e.type),
22784
22834
  draggable: !0,
22785
22835
  stopLoss: e.stopLoss,
22786
22836
  takeProfit: e.takeProfit,
@@ -22806,7 +22856,7 @@ var Rw = class {
22806
22856
  stopLoss: t(e.stopLoss, n.stopLoss),
22807
22857
  takeProfit: t(e.takeProfit, n.takeProfit)
22808
22858
  };
22809
- return e.trailingStop === null ? delete r.trailingStop : e.trailingStop !== void 0 && Number.isFinite(e.trailingStop) && e.trailingStop > 0 && (r.trailingStop = e.trailingStop), e.stopLoss === null && delete r.trailingStop, typeof e.stopLoss == "number" ? r : Lw(r, this.markPrice);
22859
+ return e.trailingStop === null ? delete r.trailingStop : e.trailingStop !== void 0 && Number.isFinite(e.trailingStop) && e.trailingStop > 0 && (r.trailingStop = e.trailingStop), e.stopLoss === null && delete r.trailingStop, typeof e.stopLoss == "number" ? r : Gw(r, this.markPrice);
22810
22860
  }), this.emit("positions", this.positions);
22811
22861
  }
22812
22862
  async closePosition(e) {
@@ -22820,7 +22870,7 @@ var Rw = class {
22820
22870
  this.close(t, n, "reverse");
22821
22871
  let r = t.quantity - (t.closedQuantity ?? 0), i = {
22822
22872
  id: this.nextId("ord"),
22823
- side: zw(t.side),
22873
+ side: qw(t.side),
22824
22874
  type: "market",
22825
22875
  price: n,
22826
22876
  quantity: r
@@ -22864,7 +22914,7 @@ var Rw = class {
22864
22914
  let r = e.quantity - (e.closedQuantity ?? 0), i = e.side === "buy" ? 1 : -1;
22865
22915
  this.emit("fill", {
22866
22916
  orderId: this.nextId("ord"),
22867
- side: zw(e.side),
22917
+ side: qw(e.side),
22868
22918
  price: t,
22869
22919
  quantity: r,
22870
22920
  time: this.fillTime(),
@@ -22888,7 +22938,7 @@ var Rw = class {
22888
22938
  trailStops() {
22889
22939
  let e = !1;
22890
22940
  return this.positions = this.positions.map((t) => {
22891
- let n = Lw(t, this.markPrice);
22941
+ let n = Gw(t, this.markPrice);
22892
22942
  return n !== t && (e = !0), n;
22893
22943
  }), e;
22894
22944
  }
@@ -22915,10 +22965,10 @@ var Rw = class {
22915
22965
  }
22916
22966
  }
22917
22967
  };
22918
- function zw(e) {
22968
+ function qw(e) {
22919
22969
  return e === "buy" ? "sell" : "buy";
22920
22970
  }
22921
- function Bw(e) {
22971
+ function Jw(e) {
22922
22972
  switch (e) {
22923
22973
  case "stop": return "STOP";
22924
22974
  case "stopLimit": return "STOP LIMIT";
@@ -22927,7 +22977,7 @@ function Bw(e) {
22927
22977
  }
22928
22978
  //#endregion
22929
22979
  //#region src/realtime/Emitter.ts
22930
- var Vw = class {
22980
+ var Yw = class {
22931
22981
  listeners = /* @__PURE__ */ new Map();
22932
22982
  on(e, t) {
22933
22983
  let n = this.listeners.get(e);
@@ -22949,12 +22999,12 @@ var Vw = class {
22949
22999
  removeAllListeners() {
22950
23000
  this.listeners.clear();
22951
23001
  }
22952
- }, Hw = 6e4, Uw = (e) => [
23002
+ }, Xw = 6e4, Zw = (e) => [
22953
23003
  e.open,
22954
23004
  e.high,
22955
23005
  e.low,
22956
23006
  e.close
22957
- ].every(Number.isFinite), Ww = class extends Vw {
23007
+ ].every(Number.isFinite), Qw = class extends Yw {
22958
23008
  currentBar = null;
22959
23009
  newest = -Infinity;
22960
23010
  builtFromTrades = !1;
@@ -22978,7 +23028,7 @@ var Vw = class {
22978
23028
  this.builtOffTheBuckets() && (this.currentBar = null, this.newest = -Infinity, this.lastTradeAt = null), Number.isFinite(e) && (this.newest = Math.max(this.newest, M(e)));
22979
23029
  }
22980
23030
  resume(e) {
22981
- if (!Uw(e)) return;
23031
+ if (!Zw(e)) return;
22982
23032
  let t = M(e.time);
22983
23033
  t < this.newest || (this.newest = t, this.currentBar = {
22984
23034
  time: t,
@@ -23053,7 +23103,7 @@ var Vw = class {
23053
23103
  return n !== null && M(n.time) === this.newest ? n.time : this.newest;
23054
23104
  }
23055
23105
  instantOf(e) {
23056
- return !this.dateStamps || !this.dateFrame ? e : e - Ze(this.bucket.timeZone ?? 0, e) * Hw;
23106
+ return !this.dateStamps || !this.dateFrame ? e : e - Ze(this.bucket.timeZone ?? 0, e) * Xw;
23057
23107
  }
23058
23108
  builtOffTheBuckets() {
23059
23109
  let e = this.currentBar;
@@ -23065,9 +23115,9 @@ var Vw = class {
23065
23115
  alignToTimeframe(e) {
23066
23116
  if (!(this.timeframeMs > 0)) return e;
23067
23117
  let t = Tt(e, this.timeframe, this.bucket);
23068
- return !this.dateStamps || !this.dateFrame ? t : t + Ze(this.bucket.timeZone ?? 0, t) * Hw;
23118
+ return !this.dateStamps || !this.dateFrame ? t : t + Ze(this.bucket.timeZone ?? 0, t) * Xw;
23069
23119
  }
23070
- }, Gw = class extends Vw {
23120
+ }, $w = class extends Yw {
23071
23121
  config;
23072
23122
  attempt = 0;
23073
23123
  timer = null;
@@ -23114,7 +23164,7 @@ var Vw = class {
23114
23164
  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);
23115
23165
  return Math.max(0, Math.round(n + r));
23116
23166
  }
23117
- }, Kw = 20, qw = class {
23167
+ }, eT = 20, tT = class {
23118
23168
  price = null;
23119
23169
  previousClose = null;
23120
23170
  visible = !0;
@@ -23168,46 +23218,46 @@ var Vw = class {
23168
23218
  let { y: i, color: a } = r, { chartRect: o } = t, s = o.x + o.width + 1, c = this.pricePrecision ?? je(t.priceRange.min, t.priceRange.max), l = t.formatPrice ? t.formatPrice(this.price) : j(this.price, c, this.locale);
23169
23219
  e.font = `bold 11px ${n.font.family}`;
23170
23220
  let u = (t.priceAxisWidth ?? Te) - 2;
23171
- e.fillStyle = a, ln(e, s, i - Kw / 2, u, Kw, n), this.tag = {
23221
+ e.fillStyle = a, ln(e, s, i - eT / 2, u, eT, n), this.tag = {
23172
23222
  x: s,
23173
- y: i - Kw / 2,
23223
+ y: i - eT / 2,
23174
23224
  width: u,
23175
- height: Kw,
23225
+ height: eT,
23176
23226
  color: a
23177
23227
  }, e.fillStyle = pn(a), e.textBaseline = "middle", e.textAlign = "left", e.fillText(l, s + 7, i);
23178
23228
  }
23179
- }, Jw = 1e3, Yw = 10, Xw = 1440, Zw = 5e3, Qw = 2, $w = 864e5, eT = 6e4, tT = [
23229
+ }, nT = 1e3, rT = 10, iT = 1440, aT = 5e3, oT = 2, sT = 864e5, cT = 6e4, lT = [
23180
23230
  "tick",
23181
23231
  "barClose",
23182
23232
  "snapshot",
23183
23233
  "connectionChange",
23184
23234
  "error",
23185
23235
  "symbolInfo"
23186
- ], nT = /* @__PURE__ */ new WeakMap();
23187
- function rT(e) {
23188
- if (e instanceof lT || !e.supportedTimeframes?.length) return e;
23189
- let t = nT.get(e);
23190
- return t || (t = new lT(e, e.supportedTimeframes), nT.set(e, t)), t;
23236
+ ], uT = /* @__PURE__ */ new WeakMap();
23237
+ function dT(e) {
23238
+ if (e instanceof _T || !e.supportedTimeframes?.length) return e;
23239
+ let t = uT.get(e);
23240
+ return t || (t = new _T(e, e.supportedTimeframes), uT.set(e, t)), t;
23191
23241
  }
23192
- function iT(e, t, n) {
23242
+ function fT(e, t, n) {
23193
23243
  if (t.includes(e)) return e;
23194
23244
  let r = tt(e, t, { timeZone: n });
23195
23245
  return r && Math.ceil(Ot(e) / Ot(r)) <= 1440 ? r : null;
23196
23246
  }
23197
- function aT(e, t) {
23247
+ function pT(e, t) {
23198
23248
  if (St(t) !== null) return typeof e.fetchTrades == "function" && typeof e.subscribeTrades == "function";
23199
23249
  let n = e.supportedTimeframes;
23200
- return !n?.length || iT(t, n) !== null;
23250
+ return !n?.length || fT(t, n) !== null;
23201
23251
  }
23202
- function oT(e, t, n) {
23203
- let r = et(t), i = n !== void 0 && Dt(t) && e % $w !== 0, a = i ? e + Ze(n, e) * eT : e, o;
23252
+ function mT(e, t, n) {
23253
+ let r = et(t), i = n !== void 0 && Dt(t) && e % sT !== 0, a = i ? e + Ze(n, e) * cT : e, o;
23204
23254
  if (r?.unit === "M") {
23205
23255
  let e = new Date(a);
23206
23256
  o = Date.UTC(e.getUTCFullYear(), e.getUTCMonth() + r.count, 1);
23207
23257
  } else o = a + Ot(t);
23208
23258
  return i ? jt(o, n) : o;
23209
23259
  }
23210
- function sT(e, t) {
23260
+ function hT(e, t) {
23211
23261
  let n = t[0], r = {
23212
23262
  time: e,
23213
23263
  open: n.open,
@@ -23222,10 +23272,10 @@ function sT(e, t) {
23222
23272
  }
23223
23273
  return r;
23224
23274
  }
23225
- function cT(e, t) {
23226
- return sT(e, [...t.values()].sort((e, t) => e.time - t.time));
23275
+ function gT(e, t) {
23276
+ return hT(e, [...t.values()].sort((e, t) => e.time - t.time));
23227
23277
  }
23228
- var lT = class {
23278
+ var _T = class {
23229
23279
  name;
23230
23280
  fetchHistoryBefore;
23231
23281
  searchSymbols;
@@ -23247,10 +23297,10 @@ var lT = class {
23247
23297
  unanswered = /* @__PURE__ */ new Map();
23248
23298
  constructor(e, t) {
23249
23299
  this.inner = e, this.baseTimeframes = t, this.name = e.name, e.fetchHistoryBefore && (this.fetchHistoryBefore = (e, t, n, r) => this.historyBefore(e, t, n, r)), e.searchSymbols && (this.searchSymbols = e.searchSymbols.bind(e)), e.resolveSymbol && (this.resolveSymbol = (e) => this.resolveShared(e)), e.subscribeQuotes && (this.subscribeQuotes = e.subscribeQuotes.bind(e)), e.fetchNews && (this.fetchNews = e.fetchNews.bind(e)), e.fetchTrades && (this.fetchTrades = e.fetchTrades.bind(e)), e.subscribeTrades && (this.subscribeTrades = e.subscribeTrades.bind(e)), this.listen("bar", (e) => this.onBar(e));
23250
- for (let e of tT) this.listen(e, (t) => this.emit(e, t.data));
23300
+ for (let e of lT) this.listen(e, (t) => this.emit(e, t.data));
23251
23301
  }
23252
23302
  baseFor(e) {
23253
- let t = iT(e, this.baseTimeframes);
23303
+ let t = fT(e, this.baseTimeframes);
23254
23304
  if (!t) throw RangeError(`${this.name} cannot serve the ${e} timeframe`);
23255
23305
  return t;
23256
23306
  }
@@ -23274,7 +23324,7 @@ var lT = class {
23274
23324
  async fetchHistory(e, t, n = 500) {
23275
23325
  if (this.baseFor(t) === t) return this.inner.fetchHistory(e, t, n);
23276
23326
  let r = this.generation, { plan: i, bars: a } = await this.baseBarsWithZone(e, t, async (i) => {
23277
- let a = this.baseBarsFor(t, i, n), o = await this.inner.fetchHistory(e, i, Math.min(a, Jw));
23327
+ let a = this.baseBarsFor(t, i, n), o = await this.inner.fetchHistory(e, i, Math.min(a, nT));
23278
23328
  return this.extendBack(e, i, o, a, r);
23279
23329
  });
23280
23330
  return this.rememberTail(e, t, a, i), this.toTarget(a, t, n, i);
@@ -23292,7 +23342,7 @@ var lT = class {
23292
23342
  this.unsubscribe.length = 0, this.listeners.clear(), this.inner.dispose();
23293
23343
  }
23294
23344
  bucketFor(e, t) {
23295
- let n = iT(t, this.baseTimeframes);
23345
+ let n = fT(t, this.baseTimeframes);
23296
23346
  return n === null || n === t ? null : { ...this.planFor(t, this.keptZone(e)).bucket };
23297
23347
  }
23298
23348
  waitsForZone(e) {
@@ -23310,7 +23360,7 @@ var lT = class {
23310
23360
  async zoneFor(e) {
23311
23361
  if (this.zones.has(e)) return this.keptZone(e);
23312
23362
  let t, n = new Promise((e) => {
23313
- t = setTimeout(() => e(), Zw);
23363
+ t = setTimeout(() => e(), aT);
23314
23364
  });
23315
23365
  try {
23316
23366
  await Promise.race([this.resolveShared(e), n]);
@@ -23339,7 +23389,7 @@ var lT = class {
23339
23389
  }) : this.zones.has(e) || this.zones.set(e, r);
23340
23390
  }
23341
23391
  planFor(e, t) {
23342
- let n = this.baseFor(e), r = t !== void 0 && n !== e && Et(e) ? iT(e, this.baseTimeframes, t) : null, i = r ?? n, a = r ? t : void 0;
23392
+ let n = this.baseFor(e), r = t !== void 0 && n !== e && Et(e) ? fT(e, this.baseTimeframes, t) : null, i = r ?? n, a = r ? t : void 0;
23343
23393
  return {
23344
23394
  base: i,
23345
23395
  zone: a,
@@ -23353,7 +23403,7 @@ var lT = class {
23353
23403
  let i = this.inner.fetchHistoryBefore.bind(this.inner);
23354
23404
  if (this.baseFor(t) === t) return i(e, t, n, r);
23355
23405
  let a = this.generation, { plan: o, bars: s } = await this.baseBarsWithZone(e, t, async (o) => {
23356
- let s = this.baseBarsFor(t, o, r), c = await i(e, o, n, Math.min(s, Jw));
23406
+ let s = this.baseBarsFor(t, o, r), c = await i(e, o, n, Math.min(s, nT));
23357
23407
  return this.extendBack(e, o, c.filter((e) => e.time < n), s, a, 1);
23358
23408
  });
23359
23409
  return this.toTarget(s, t, r, o);
@@ -23380,7 +23430,7 @@ var lT = class {
23380
23430
  async extendBack(e, t, n, r, i, a = 1) {
23381
23431
  let o = this.inner.fetchHistoryBefore?.bind(this.inner), s = n, c = a;
23382
23432
  for (; o && s.length > 0 && s.length < r && c < 10 && i === this.generation;) {
23383
- let n = s[0].time, i = await o(e, t, n, Math.min(r - s.length, Jw));
23433
+ let n = s[0].time, i = await o(e, t, n, Math.min(r - s.length, nT));
23384
23434
  c++;
23385
23435
  let a = i.filter((e) => e.time < n);
23386
23436
  if (a.length === 0) break;
@@ -23433,19 +23483,19 @@ var lT = class {
23433
23483
  this.bucket = i, this.parts.set(n.time, n);
23434
23484
  let a = this.composed();
23435
23485
  if (!a) return;
23436
- let o = Tt(oT(n.time, t.base, t.zone), t.target, t.bucket), s = r && o !== i;
23486
+ let o = Tt(mT(n.time, t.base, t.zone), t.target, t.bucket), s = r && o !== i;
23437
23487
  this.emit("bar", {
23438
23488
  bar: a,
23439
23489
  closed: s
23440
23490
  }), s && (this.keepClosed(), this.resetBucket(), this.bucket = o);
23441
23491
  }
23442
23492
  composed() {
23443
- return this.bucket === null || this.parts.size === 0 ? null : cT(this.bucket, this.parts);
23493
+ return this.bucket === null || this.parts.size === 0 ? null : gT(this.bucket, this.parts);
23444
23494
  }
23445
23495
  correctClosed(e, t) {
23446
23496
  let n = this.closedBuckets.get(e);
23447
23497
  n && (n.set(t.time, t), this.emit("bar", {
23448
- bar: cT(e, n),
23498
+ bar: gT(e, n),
23449
23499
  closed: !0
23450
23500
  }));
23451
23501
  }
@@ -23475,7 +23525,7 @@ var lT = class {
23475
23525
  };
23476
23526
  for (let e of n) e(r);
23477
23527
  }
23478
- }, uT = 1e3, dT = 15e3, fT = [
23528
+ }, vT = 1e3, yT = 15e3, bT = [
23479
23529
  "tick",
23480
23530
  "bar",
23481
23531
  "barClose",
@@ -23483,7 +23533,7 @@ var lT = class {
23483
23533
  "connectionChange",
23484
23534
  "error",
23485
23535
  "symbolInfo"
23486
- ], pT = class {
23536
+ ], xT = class {
23487
23537
  bar = null;
23488
23538
  count = 0;
23489
23539
  lastTime = -Infinity;
@@ -23524,7 +23574,7 @@ var lT = class {
23524
23574
  build(e) {
23525
23575
  return this.bar = null, this.count = 0, this.lastTime = -Infinity, this.push(e).map((e) => e.bar);
23526
23576
  }
23527
- }, mT = class {
23577
+ }, ST = class {
23528
23578
  name;
23529
23579
  supportedTimeframes;
23530
23580
  searchSymbols;
@@ -23541,14 +23591,14 @@ var lT = class {
23541
23591
  state = "disconnected";
23542
23592
  constructor(e) {
23543
23593
  this.inner = e, this.name = e.name, this.supportedTimeframes = e.supportedTimeframes, e.searchSymbols && (this.searchSymbols = e.searchSymbols.bind(e)), e.resolveSymbol && (this.resolveSymbol = e.resolveSymbol.bind(e)), e.subscribeQuotes && (this.subscribeQuotes = e.subscribeQuotes.bind(e)), e.fetchNews && (this.fetchNews = e.fetchNews.bind(e)), this.fetchTrades = e.fetchTrades.bind(e), this.subscribeTrades = e.subscribeTrades.bind(e);
23544
- for (let t of fT) e.on(t, (e) => {
23594
+ for (let t of bT) e.on(t, (e) => {
23545
23595
  this.tickMode || this.emit(t, e.data);
23546
23596
  });
23547
23597
  }
23548
23598
  async fetchHistory(e, t, n) {
23549
23599
  let r = St(t);
23550
23600
  if (r === null) return this.inner.fetchHistory(e, t, n);
23551
- let i = (await this.inner.fetchTrades(e, uT)).filter(vT).sort((e, t) => e.time - t.time), a = new pT(r), o = a.build(i);
23601
+ let i = (await this.inner.fetchTrades(e, vT)).filter(ET).sort((e, t) => e.time - t.time), a = new xT(r), o = a.build(i);
23552
23602
  return this.tick = {
23553
23603
  symbol: e,
23554
23604
  builder: a,
@@ -23568,11 +23618,11 @@ var lT = class {
23568
23618
  this.tickMode = !0;
23569
23619
  let n = this.tick?.symbol === e.symbol ? this.tick : {
23570
23620
  symbol: e.symbol,
23571
- builder: new pT(t),
23621
+ builder: new xT(t),
23572
23622
  after: -Infinity
23573
23623
  };
23574
23624
  this.tick = n, this.stopTrades = this.inner.subscribeTrades(e.symbol, (e) => {
23575
- let t = e.filter((e) => vT(e) && e.time >= n.after);
23625
+ let t = e.filter((e) => ET(e) && e.time >= n.after);
23576
23626
  for (let { bar: e, closed: r } of n.builder.push(t)) this.emit("bar", {
23577
23627
  bar: e,
23578
23628
  closed: r
@@ -23581,7 +23631,7 @@ var lT = class {
23581
23631
  price: e.close,
23582
23632
  volume: e.volume
23583
23633
  });
23584
- }), this.state = "connected", this.emit("connectionChange", "connected"), this.keepAlive = setInterval(() => this.emit("connectionChange", "connected"), dT);
23634
+ }), this.state = "connected", this.emit("connectionChange", "connected"), this.keepAlive = setInterval(() => this.emit("connectionChange", "connected"), yT);
23585
23635
  }
23586
23636
  disconnect() {
23587
23637
  this.tickMode ? (this.stopTrades?.(), this.stopTrades = null, this.keepAlive && clearInterval(this.keepAlive), this.keepAlive = null, this.state = "disconnected") : this.inner.disconnect();
@@ -23609,41 +23659,41 @@ var lT = class {
23609
23659
  };
23610
23660
  for (let e of n) e(r);
23611
23661
  }
23612
- }, hT = /* @__PURE__ */ new WeakMap();
23613
- function gT(e) {
23614
- if (e instanceof mT || !_T(e)) return e;
23615
- let t = hT.get(e);
23616
- return t || (t = new mT(e), hT.set(e, t)), t;
23662
+ }, CT = /* @__PURE__ */ new WeakMap();
23663
+ function wT(e) {
23664
+ if (e instanceof ST || !TT(e)) return e;
23665
+ let t = CT.get(e);
23666
+ return t || (t = new ST(e), CT.set(e, t)), t;
23617
23667
  }
23618
- function _T(e) {
23668
+ function TT(e) {
23619
23669
  return typeof e.fetchTrades == "function" && typeof e.subscribeTrades == "function";
23620
23670
  }
23621
- function vT(e) {
23671
+ function ET(e) {
23622
23672
  return Number.isFinite(e?.time) && Number.isFinite(e?.price) && Number.isFinite(e?.volume);
23623
23673
  }
23624
23674
  //#endregion
23625
23675
  //#region src/realtime/feeds/feedAdapter.ts
23626
- var yT = Symbol("tradecanvas.sourceAdapter"), bT = /* @__PURE__ */ new WeakSet();
23627
- function xT(e) {
23628
- return bT.has(e);
23676
+ var DT = Symbol("tradecanvas.sourceAdapter"), OT = /* @__PURE__ */ new WeakSet();
23677
+ function kT(e) {
23678
+ return OT.has(e);
23629
23679
  }
23630
- var ST = (e, t) => `${e}\u0000${t}`;
23631
- function CT(e) {
23680
+ var AT = (e, t) => `${e}\u0000${t}`;
23681
+ function jT(e) {
23632
23682
  return typeof e.getBars == "function" && typeof e.subscribeBars == "function";
23633
23683
  }
23634
- function wT(e) {
23684
+ function MT(e) {
23635
23685
  if (e.adapter && e.feed) throw TypeError("A stream takes an adapter or a feed, not both");
23636
23686
  if (e.adapter) return e.adapter;
23637
- if (e.feed) return DT(e.feed);
23687
+ if (e.feed) return FT(e.feed);
23638
23688
  throw TypeError("A stream needs an adapter or a feed");
23639
23689
  }
23640
- function TT(e, t, n) {
23690
+ function NT(e, t, n) {
23641
23691
  for (let r of n) {
23642
23692
  let n = t[r];
23643
23693
  typeof n == "function" && (e[r] = n.bind(t));
23644
23694
  }
23645
23695
  }
23646
- var ET = [
23696
+ var PT = [
23647
23697
  "resolveSymbol",
23648
23698
  "searchSymbols",
23649
23699
  "subscribeQuotes",
@@ -23651,13 +23701,13 @@ var ET = [
23651
23701
  "fetchTrades",
23652
23702
  "subscribeTrades"
23653
23703
  ];
23654
- function DT(e) {
23655
- let t = e[yT];
23704
+ function FT(e) {
23705
+ let t = e[DT];
23656
23706
  if (t) return t;
23657
- let n = new OT(e);
23658
- return bT.add(n), n;
23707
+ let n = new IT(e);
23708
+ return OT.add(n), n;
23659
23709
  }
23660
- var OT = class {
23710
+ var IT = class {
23661
23711
  name;
23662
23712
  supportedTimeframes;
23663
23713
  fetchHistoryBefore;
@@ -23673,7 +23723,7 @@ var OT = class {
23673
23723
  countBack: r,
23674
23724
  before: n,
23675
23725
  signal: this.signalFor(e, t)
23676
- })), TT(this, e, ET);
23726
+ })), NT(this, e, PT);
23677
23727
  }
23678
23728
  fetchHistory(e, t, n = 500) {
23679
23729
  return this.feed.getBars({
@@ -23684,7 +23734,7 @@ var OT = class {
23684
23734
  });
23685
23735
  }
23686
23736
  fetchStreamHistory(e, t) {
23687
- return this.streamed = ST(e.symbol, e.timeframe), this.fetchHistory(e.symbol, e.timeframe, t);
23737
+ return this.streamed = AT(e.symbol, e.timeframe), this.fetchHistory(e.symbol, e.timeframe, t);
23688
23738
  }
23689
23739
  connect(e) {
23690
23740
  this.subscribe({
@@ -23693,7 +23743,7 @@ var OT = class {
23693
23743
  });
23694
23744
  }
23695
23745
  subscribe(e, t) {
23696
- this.stopSubscription(), this.streamed = ST(e.symbol, e.timeframe);
23746
+ this.stopSubscription(), this.streamed = AT(e.symbol, e.timeframe);
23697
23747
  let n = !0, r = !1, i = null;
23698
23748
  this.unsubscribe = () => {
23699
23749
  n = !1, i?.();
@@ -23743,7 +23793,7 @@ var OT = class {
23743
23793
  this.disconnect(), this.listeners.clear();
23744
23794
  }
23745
23795
  signalFor(e, t) {
23746
- let n = ST(e, t), r = this.requests.get(n);
23796
+ let n = AT(e, t), r = this.requests.get(n);
23747
23797
  return r || (r = new AbortController(), this.requests.set(n, r)), r.signal;
23748
23798
  }
23749
23799
  stopSubscription() {
@@ -23762,18 +23812,18 @@ var OT = class {
23762
23812
  for (let t of [...this.listeners.get(e) ?? []]) t(n);
23763
23813
  }
23764
23814
  };
23765
- function kT(e) {
23815
+ function LT(e) {
23766
23816
  let t = {
23767
23817
  name: e.name,
23768
23818
  ...e.supportedTimeframes ? { supportedTimeframes: e.supportedTimeframes } : {},
23769
23819
  pagesBack: typeof e.fetchHistoryBefore == "function",
23770
23820
  getBars: async ({ symbol: t, timeframe: n, countBack: r, before: i }) => i === void 0 ? e.fetchHistory(t, n, r) : e.fetchHistoryBefore ? e.fetchHistoryBefore(t, n, i, r) : [],
23771
- subscribeBars: (t, n) => AT(e, t, n),
23772
- [yT]: e
23821
+ subscribeBars: (t, n) => RT(e, t, n),
23822
+ [DT]: e
23773
23823
  };
23774
- return TT(t, e, ET), t;
23824
+ return NT(t, e, PT), t;
23775
23825
  }
23776
- function AT(e, t, n) {
23826
+ function RT(e, t, n) {
23777
23827
  let r = [
23778
23828
  ["bar", (e) => {
23779
23829
  let { bar: t, closed: r } = e.data;
@@ -23793,11 +23843,11 @@ function AT(e, t, n) {
23793
23843
  e.disconnect();
23794
23844
  };
23795
23845
  }
23796
- function jT(e) {
23797
- let t = wT(e), n = !xT(t), r = rT(t), i = r instanceof lT ? r : null, a = gT(r);
23798
- return a instanceof OT ? new MT(a, i, n) : new NT(a, i, n);
23846
+ function zT(e) {
23847
+ let t = MT(e), n = !kT(t), r = dT(t), i = r instanceof _T ? r : null, a = wT(r);
23848
+ return a instanceof IT ? new BT(a, i, n) : new VT(a, i, n);
23799
23849
  }
23800
- var MT = class {
23850
+ var BT = class {
23801
23851
  subscriber = null;
23802
23852
  constructor(e, t, n) {
23803
23853
  this.adapter = e, this.resampler = t, this.watchSilence = n;
@@ -23817,7 +23867,7 @@ var MT = class {
23817
23867
  release() {
23818
23868
  this.subscriber = null;
23819
23869
  }
23820
- }, NT = class {
23870
+ }, VT = class {
23821
23871
  unlisten = [];
23822
23872
  constructor(e, t, n) {
23823
23873
  this.adapter = e, this.resampler = t, this.watchSilence = n;
@@ -23850,8 +23900,8 @@ var MT = class {
23850
23900
  hear(e, t) {
23851
23901
  this.adapter.on(e, t), this.unlisten.push(() => this.adapter.off(e, t));
23852
23902
  }
23853
- }, PT = 2e4, FT = 6e4, IT = 3e4, LT = 500, RT = 864e5;
23854
- function zT(e, t) {
23903
+ }, HT = 2e4, UT = 6e4, WT = 3e4, GT = 500, KT = 864e5;
23904
+ function qT(e, t) {
23855
23905
  if (!t) return e;
23856
23906
  let { time: n, open: r, high: i, low: a, close: o, volume: s } = t;
23857
23907
  return [...e, {
@@ -23863,15 +23913,15 @@ function zT(e, t) {
23863
23913
  volume: s
23864
23914
  }];
23865
23915
  }
23866
- function BT(e, t, n) {
23916
+ function JT(e, t, n) {
23867
23917
  return Tt(e, t, { timeZone: n }) === e && Tt(e, t) !== e;
23868
23918
  }
23869
- var VT = class extends Vw {
23919
+ var YT = class extends Yw {
23870
23920
  config = null;
23871
23921
  source = null;
23872
23922
  aggregator = null;
23873
23923
  reconnector;
23874
- priceLine = new qw();
23924
+ priceLine = new tT();
23875
23925
  state = "disconnected";
23876
23926
  lastPrice = null;
23877
23927
  previousClose = null;
@@ -23883,15 +23933,15 @@ var VT = class extends Vw {
23883
23933
  timeZone = null;
23884
23934
  historyEnd = null;
23885
23935
  constructor() {
23886
- super(), this.reconnector = new Gw(), this.wireReconnector();
23936
+ super(), this.reconnector = new $w(), this.wireReconnector();
23887
23937
  }
23888
23938
  async connect(e) {
23889
23939
  this.disconnect();
23890
- let t = jT(e);
23940
+ let t = zT(e);
23891
23941
  t.resampler?.renewZone(e.symbol), this.config = {
23892
23942
  ...fe,
23893
23943
  ...e
23894
- }, this.source = t, this.aggregator = new Ww(e.timeframe), this.historyEnd = null, this.applyTickZone(), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new Gw(e.reconnect ?? ue), this.wireReconnector(), this.aggregator.on("bar", (e) => {
23944
+ }, this.source = t, this.aggregator = new Qw(e.timeframe), this.historyEnd = null, this.applyTickZone(), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new $w(e.reconnect ?? ue), this.wireReconnector(), this.aggregator.on("bar", (e) => {
23895
23945
  this.emit("barUpdate", e), this.updatePrice(e.close);
23896
23946
  }), this.aggregator.on("barClose", (e) => {
23897
23947
  this.setPreviousClose(e), this.emit("barClose", e);
@@ -23925,7 +23975,7 @@ var VT = class extends Vw {
23925
23975
  applyTickZone() {
23926
23976
  let e = this.config;
23927
23977
  if (!this.aggregator || !e) return;
23928
- let t = this.historyEnd, n = t !== null && t % RT === 0, r = this.source?.resampler?.bucketFor(e.symbol, e.timeframe);
23978
+ let t = this.historyEnd, n = t !== null && t % KT === 0, r = this.source?.resampler?.bucketFor(e.symbol, e.timeframe);
23929
23979
  if (r) {
23930
23980
  let e = r.dates === !0 && n;
23931
23981
  this.aggregator.setTimeZone(r.timeZone ?? (e ? this.timeZone : null), e);
@@ -23935,7 +23985,7 @@ var VT = class extends Vw {
23935
23985
  }
23936
23986
  tickZone(e, t) {
23937
23987
  let n = this.timeZone;
23938
- return n === null || Dt(e) || t !== null && BT(t, e, n) ? n : null;
23988
+ return n === null || Dt(e) || t !== null && JT(t, e, n) ? n : null;
23939
23989
  }
23940
23990
  async doConnect() {
23941
23991
  if (!this.config || !this.source) return;
@@ -23945,12 +23995,12 @@ var VT = class extends Vw {
23945
23995
  };
23946
23996
  this.setState("connecting");
23947
23997
  try {
23948
- let n = await this.source.getBars(t, this.config.historyLimit ?? LT);
23998
+ let n = await this.source.getBars(t, this.config.historyLimit ?? GT);
23949
23999
  if (e !== this.connectSeq || !this.source) return;
23950
24000
  let r = n.length > 0 ? n[n.length - 1] : null;
23951
24001
  this.historyEnd = r ? M(r.time) : null, this.applyTickZone(), this.seedAggregator(r);
23952
24002
  let i = this.formingAfter(r);
23953
- r && !i && (this.setPreviousClose(r), this.updatePrice(r.close)), this.emit("snapshot", zT(n, i)), this.source.subscribeBars(t), this.startHeartbeat();
24003
+ r && !i && (this.setPreviousClose(r), this.updatePrice(r.close)), this.emit("snapshot", qT(n, i)), this.source.subscribeBars(t), this.startHeartbeat();
23954
24004
  } catch (t) {
23955
24005
  if (e !== this.connectSeq) return;
23956
24006
  let n = t instanceof Error ? t.message : String(t);
@@ -24021,15 +24071,15 @@ var VT = class extends Vw {
24021
24071
  }));
24022
24072
  }
24023
24073
  wake(e) {
24024
- !this.source || !this.config || this.state === "connecting" || this.state === "disconnected" || this.state === "connected" && e === "visible" && (!this.source.watchSilence || Date.now() - this.lastMessageTime <= PT) || (this.reconnector.stop(), this.source.unsubscribe(), this.reconnector.start(), this.doConnect());
24074
+ !this.source || !this.config || this.state === "connecting" || this.state === "disconnected" || this.state === "connected" && e === "visible" && (!this.source.watchSilence || Date.now() - this.lastMessageTime <= HT) || (this.reconnector.stop(), this.source.unsubscribe(), this.reconnector.start(), this.doConnect());
24025
24075
  }
24026
24076
  startHeartbeat() {
24027
24077
  this.stopHeartbeat(), this.heartbeatTimer = setInterval(() => {
24028
- this.source?.watchSilence === !0 && Date.now() - this.lastMessageTime > FT && this.state === "connected" && (this.emit("error", {
24078
+ this.source?.watchSilence === !0 && Date.now() - this.lastMessageTime > UT && this.state === "connected" && (this.emit("error", {
24029
24079
  message: "Heartbeat timeout",
24030
24080
  code: "HEARTBEAT_TIMEOUT"
24031
24081
  }), this.source?.unsubscribe(), this.reconnector.schedule(() => this.doConnect()));
24032
- }, IT);
24082
+ }, WT);
24033
24083
  }
24034
24084
  stopHeartbeat() {
24035
24085
  this.heartbeatTimer &&= (clearInterval(this.heartbeatTimer), null);
@@ -24037,7 +24087,7 @@ var VT = class extends Vw {
24037
24087
  dispose() {
24038
24088
  this.disconnect(), this.removeAllListeners();
24039
24089
  }
24040
- }, HT = class extends Vw {
24090
+ }, XT = class extends Yw {
24041
24091
  data;
24042
24092
  speed;
24043
24093
  index;
@@ -24124,11 +24174,11 @@ var VT = class extends Vw {
24124
24174
  };
24125
24175
  //#endregion
24126
24176
  //#region src/realtime/adapters/binanceTypes.ts
24127
- function UT(e) {
24177
+ function ZT(e) {
24128
24178
  if (!Array.isArray(e) || e.length < 6) return null;
24129
24179
  let t = e[0];
24130
24180
  if (typeof t != "number" || !Number.isFinite(t)) return null;
24131
- let n = GT(e[1]), r = GT(e[2]), i = GT(e[3]), a = GT(e[4]), o = GT(e[5]);
24181
+ let n = $T(e[1]), r = $T(e[2]), i = $T(e[3]), a = $T(e[4]), o = $T(e[5]);
24132
24182
  return n === null || r === null || i === null || a === null || o === null ? null : {
24133
24183
  time: t,
24134
24184
  open: n,
@@ -24138,11 +24188,11 @@ function UT(e) {
24138
24188
  volume: o
24139
24189
  };
24140
24190
  }
24141
- function WT(e) {
24142
- if (!KT(e)) return null;
24191
+ function QT(e) {
24192
+ if (!eE(e)) return null;
24143
24193
  let t = e.t;
24144
24194
  if (typeof t != "number" || !Number.isFinite(t)) return null;
24145
- let n = GT(e.o), r = GT(e.h), i = GT(e.l), a = GT(e.c), o = GT(e.v);
24195
+ let n = $T(e.o), r = $T(e.h), i = $T(e.l), a = $T(e.c), o = $T(e.v);
24146
24196
  if (n === null || r === null || i === null || a === null || o === null) return null;
24147
24197
  let s = typeof e.x == "boolean" ? e.x : !1;
24148
24198
  return {
@@ -24157,7 +24207,7 @@ function WT(e) {
24157
24207
  closed: s
24158
24208
  };
24159
24209
  }
24160
- function GT(e) {
24210
+ function $T(e) {
24161
24211
  if (typeof e == "number") return Number.isFinite(e) ? e : null;
24162
24212
  if (typeof e == "string") {
24163
24213
  let t = parseFloat(e);
@@ -24165,14 +24215,14 @@ function GT(e) {
24165
24215
  }
24166
24216
  return null;
24167
24217
  }
24168
- function KT(e) {
24218
+ function eE(e) {
24169
24219
  return typeof e == "object" && !!e;
24170
24220
  }
24171
24221
  function Q(e) {
24172
24222
  let t = typeof e == "string" ? Number(e) : e;
24173
24223
  return typeof t == "number" && Number.isFinite(t) ? t : void 0;
24174
24224
  }
24175
- function qT(e) {
24225
+ function tE(e) {
24176
24226
  let t = e && typeof e == "object" && "data" in e ? e.data : e;
24177
24227
  if (!t || typeof t != "object") return null;
24178
24228
  let n = t;
@@ -24186,7 +24236,7 @@ function qT(e) {
24186
24236
  time: Q(n.E)
24187
24237
  }) : null;
24188
24238
  }
24189
- function JT(e) {
24239
+ function nE(e) {
24190
24240
  if (!e || typeof e != "object") return null;
24191
24241
  let t = e;
24192
24242
  return lt({
@@ -24204,7 +24254,7 @@ function JT(e) {
24204
24254
  time: Q(t.closeTime)
24205
24255
  });
24206
24256
  }
24207
- function YT(e) {
24257
+ function rE(e) {
24208
24258
  if (!e || typeof e != "object") return null;
24209
24259
  let t = e, n = Q(t.T), r = Q(t.p), i = Q(t.q);
24210
24260
  return n !== void 0 && r !== void 0 && i !== void 0 ? {
@@ -24215,25 +24265,25 @@ function YT(e) {
24215
24265
  }
24216
24266
  //#endregion
24217
24267
  //#region src/realtime/adapters/servedHistory.ts
24218
- var XT = 64, ZT = (e, t) => `${e}|${t}`, QT = class {
24268
+ var iE = 64, aE = (e, t) => `${e}|${t}`, oE = class {
24219
24269
  last = /* @__PURE__ */ new Map();
24220
24270
  serve(e, t, n) {
24221
24271
  if (!Array.isArray(n) || n.length === 0) return;
24222
24272
  let r = n[n.length - 1], i = Number(r?.time);
24223
24273
  if (!Number.isFinite(i)) return;
24224
- let a = ZT(e, t);
24274
+ let a = aE(e, t);
24225
24275
  this.last.delete(a), this.last.set(a, {
24226
24276
  time: i,
24227
24277
  close: Number(r?.close ?? NaN)
24228
- }), this.last.size > XT && this.last.delete(this.last.keys().next().value);
24278
+ }), this.last.size > iE && this.last.delete(this.last.keys().next().value);
24229
24279
  }
24230
24280
  lastBar(e, t) {
24231
- return this.last.get(ZT(e, t));
24281
+ return this.last.get(aE(e, t));
24232
24282
  }
24233
- }, $T = class {
24283
+ }, sE = class {
24234
24284
  newest = -Infinity;
24235
24285
  servedClose = null;
24236
- served = new QT();
24286
+ served = new oE();
24237
24287
  serve(e, t, n) {
24238
24288
  this.served.serve(e, t, n);
24239
24289
  }
@@ -24245,7 +24295,7 @@ var XT = 64, ZT = (e, t) => `${e}|${t}`, QT = class {
24245
24295
  let n = M(e.time);
24246
24296
  return Number.isFinite(n) ? n < this.newest || n === this.newest && t && e.close === this.servedClose ? !1 : (this.servedClose = null, this.newest = n, !0) : !0;
24247
24297
  }
24248
- }, eE = {
24298
+ }, cE = {
24249
24299
  "1s": "1s",
24250
24300
  "1m": "1m",
24251
24301
  "3m": "3m",
@@ -24262,7 +24312,7 @@ var XT = 64, ZT = (e, t) => `${e}|${t}`, QT = class {
24262
24312
  "3d": "3d",
24263
24313
  "1w": "1w",
24264
24314
  "1M": "1M"
24265
- }, tE = 1e3, nE = 200, rE = [
24315
+ }, lE = 1e3, uE = 200, dE = [
24266
24316
  "USDT",
24267
24317
  "USDC",
24268
24318
  "FDUSD",
@@ -24274,11 +24324,11 @@ var XT = 64, ZT = (e, t) => `${e}|${t}`, QT = class {
24274
24324
  "BRL",
24275
24325
  "JPY"
24276
24326
  ];
24277
- function iE(e) {
24278
- let t = e.currency ? rE.indexOf(e.currency) : -1;
24327
+ function fE(e) {
24328
+ let t = e.currency ? dE.indexOf(e.currency) : -1;
24279
24329
  return t < 0 ? 0 : 40 - t * 3;
24280
24330
  }
24281
- function aE(e) {
24331
+ function pE(e) {
24282
24332
  if (typeof e.symbol != "string" || e.status !== "TRADING") return null;
24283
24333
  let t = typeof e.baseAsset == "string" ? e.baseAsset : "", n = typeof e.quoteAsset == "string" ? e.quoteAsset : "", r = Array.isArray(e.filters) ? e.filters.find((e) => typeof e == "object" && !!e && e.filterType === "PRICE_FILTER" && typeof e.tickSize == "string") : void 0, i = {
24284
24334
  symbol: e.symbol,
@@ -24288,19 +24338,19 @@ function aE(e) {
24288
24338
  };
24289
24339
  return r && (i.pricePrecision = bt(r.tickSize), i.minTick = Number(r.tickSize)), i.timeZone = "UTC", n && (i.currency = n), i;
24290
24340
  }
24291
- function oE(e) {
24341
+ function mE(e) {
24292
24342
  let t = e?.symbols;
24293
24343
  if (!Array.isArray(t)) return [];
24294
24344
  let n = [];
24295
24345
  for (let e of t) {
24296
- let t = aE(e);
24346
+ let t = pE(e);
24297
24347
  t && n.push(t);
24298
24348
  }
24299
24349
  return n;
24300
24350
  }
24301
- var sE = class {
24351
+ var hE = class {
24302
24352
  name = "binance";
24303
- supportedTimeframes = Object.keys(eE);
24353
+ supportedTimeframes = Object.keys(cE);
24304
24354
  ws = null;
24305
24355
  state = "disconnected";
24306
24356
  listeners = /* @__PURE__ */ new Map();
@@ -24308,7 +24358,7 @@ var sE = class {
24308
24358
  restBase;
24309
24359
  wsBase;
24310
24360
  symbolList = null;
24311
- newestBar = new $T();
24361
+ newestBar = new sE();
24312
24362
  constructor(e) {
24313
24363
  this.restBase = e?.restBase ?? "https://api.binance.com/api/v3", this.wsBase = e?.wsBase ?? "wss://stream.binance.com:9443/ws";
24314
24364
  }
@@ -24330,7 +24380,7 @@ var sE = class {
24330
24380
  return this.newestBar.serve(e, t, r), r;
24331
24381
  }
24332
24382
  async searchSymbols(e, t) {
24333
- return rt(await this.loadSymbols(), e, t?.limit ?? 50, iE);
24383
+ return rt(await this.loadSymbols(), e, t?.limit ?? 50, fE);
24334
24384
  }
24335
24385
  async resolveSymbol(e) {
24336
24386
  if (this.symbolList) {
@@ -24338,19 +24388,19 @@ var sE = class {
24338
24388
  if (t) return t;
24339
24389
  }
24340
24390
  let t = await fetch(`${this.restBase}/exchangeInfo?symbol=${encodeURIComponent(e)}`);
24341
- return t.ok ? oE(await t.json())[0] ?? null : null;
24391
+ return t.ok ? mE(await t.json())[0] ?? null : null;
24342
24392
  }
24343
24393
  loadSymbols() {
24344
24394
  return this.symbolList || (this.symbolList = (async () => {
24345
24395
  let e = await fetch(`${this.restBase}/exchangeInfo`);
24346
24396
  if (!e.ok) throw Error(`Binance REST error: ${e.status}`);
24347
- return oE(await e.json());
24397
+ return mE(await e.json());
24348
24398
  })(), this.symbolList.catch(() => {
24349
24399
  this.symbolList = null;
24350
24400
  })), this.symbolList;
24351
24401
  }
24352
24402
  subscribeQuotes(e, t) {
24353
- let n = [...new Set(e.map((e) => e.trim().toUpperCase()))].filter((e) => /^[A-Z0-9]{2,30}$/.test(e)).slice(0, nE);
24403
+ let n = [...new Set(e.map((e) => e.trim().toUpperCase()))].filter((e) => /^[A-Z0-9]{2,30}$/.test(e)).slice(0, uE);
24354
24404
  if (n.length === 0) return () => {};
24355
24405
  let r = !1, i = null, a = null, o = 0, s = /* @__PURE__ */ new Set(), c = new AbortController();
24356
24406
  (async () => {
@@ -24362,7 +24412,7 @@ var sE = class {
24362
24412
  return Array.isArray(r) ? r.filter((e) => i.has(e?.symbol)) : [];
24363
24413
  })().then((e) => {
24364
24414
  if (r || !Array.isArray(e)) return;
24365
- let n = e.map(JT).filter((e) => e !== null && !s.has(e.symbol));
24415
+ let n = e.map(nE).filter((e) => e !== null && !s.has(e.symbol));
24366
24416
  n.length > 0 && t(n);
24367
24417
  }).catch(() => {});
24368
24418
  let l = this.wsBase.replace(/\/ws\/?$/, ""), u = () => {
@@ -24382,7 +24432,7 @@ var sE = class {
24382
24432
  } catch {
24383
24433
  return;
24384
24434
  }
24385
- let i = qT(n);
24435
+ let i = tE(n);
24386
24436
  !i || r || (s.add(i.symbol), t([i]));
24387
24437
  }, i.onclose = () => {
24388
24438
  i = null, d();
@@ -24399,7 +24449,7 @@ var sE = class {
24399
24449
  let n = Math.max(1, Math.min(1e3, Math.floor(t))), r = await fetch(`${this.restBase}/aggTrades?symbol=${encodeURIComponent(e.toUpperCase())}&limit=${n}`);
24400
24450
  if (!r.ok) throw Error(`Binance aggTrades ${r.status}`);
24401
24451
  let i = await r.json();
24402
- return Array.isArray(i) ? i.map(YT).filter((e) => e !== null) : [];
24452
+ return Array.isArray(i) ? i.map(rE).filter((e) => e !== null) : [];
24403
24453
  }
24404
24454
  subscribeTrades(e, t) {
24405
24455
  let n = `${e.trim().toLowerCase()}@aggTrade`;
@@ -24421,7 +24471,7 @@ var sE = class {
24421
24471
  } catch {
24422
24472
  return;
24423
24473
  }
24424
- let i = YT(n);
24474
+ let i = rE(n);
24425
24475
  i && !r && t([i]);
24426
24476
  }, i.onclose = () => {
24427
24477
  i = null, c();
@@ -24435,16 +24485,16 @@ var sE = class {
24435
24485
  };
24436
24486
  }
24437
24487
  fetchHistoryBefore(e, t, n, r = 500) {
24438
- return this.fetchKlines(e, t, Math.min(r, tE), `&endTime=${Math.floor(n) - 1}`);
24488
+ return this.fetchKlines(e, t, Math.min(r, lE), `&endTime=${Math.floor(n) - 1}`);
24439
24489
  }
24440
24490
  async fetchKlines(e, t, n, r) {
24441
- let i = eE[t] ?? "15m", a = `${this.restBase}/klines?symbol=${e}&interval=${i}&limit=${n}${r}`, o = await fetch(a);
24491
+ let i = cE[t] ?? "15m", a = `${this.restBase}/klines?symbol=${e}&interval=${i}&limit=${n}${r}`, o = await fetch(a);
24442
24492
  if (!o.ok) throw Error(`Binance REST error: ${o.status}`);
24443
24493
  let s = await o.json();
24444
24494
  if (!Array.isArray(s)) return [];
24445
24495
  let c = [];
24446
24496
  for (let e of s) {
24447
- let t = UT(e);
24497
+ let t = ZT(e);
24448
24498
  t && c.push(t);
24449
24499
  }
24450
24500
  return c;
@@ -24461,7 +24511,7 @@ var sE = class {
24461
24511
  }
24462
24512
  connectWs() {
24463
24513
  if (!this.config) return;
24464
- let e = `${this.config.symbol.toLowerCase()}@kline_${eE[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
24514
+ let e = `${this.config.symbol.toLowerCase()}@kline_${cE[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
24465
24515
  this.setState("connecting");
24466
24516
  try {
24467
24517
  this.ws = new WebSocket(t);
@@ -24486,7 +24536,7 @@ var sE = class {
24486
24536
  };
24487
24537
  }
24488
24538
  handleKline(e) {
24489
- let t = WT(e);
24539
+ let t = QT(e);
24490
24540
  if (!t) return;
24491
24541
  let { bar: n, closed: r } = t, i = this.newestBar.admit(n, r);
24492
24542
  this.emitEvent("bar", {
@@ -24512,7 +24562,7 @@ var sE = class {
24512
24562
  for (let e of n) e(r);
24513
24563
  }
24514
24564
  }
24515
- }, cE = class {
24565
+ }, gE = class {
24516
24566
  name = "mock";
24517
24567
  state = "disconnected";
24518
24568
  listeners = /* @__PURE__ */ new Map();
@@ -24543,7 +24593,7 @@ var sE = class {
24543
24593
  }
24544
24594
  subscribeQuotes(e, t) {
24545
24595
  let n = [...new Set(e)].map((e) => {
24546
- let t = this.options.basePrice * (.5 + lE(e) % 1e3 / 1e3);
24596
+ let t = this.options.basePrice * (.5 + _E(e) % 1e3 / 1e3);
24547
24597
  return {
24548
24598
  symbol: e,
24549
24599
  open: t,
@@ -24573,7 +24623,7 @@ var sE = class {
24573
24623
  return () => clearInterval(a);
24574
24624
  }
24575
24625
  async fetchTrades(e, t = 1e3) {
24576
- let n = Math.max(1, Math.min(1e3, Math.floor(t))), r = Date.now(), i = this.options.volatility / 1e3, a = this.options.basePrice * (.5 + lE(e) % 1e3 / 1e3), o = [];
24626
+ let n = Math.max(1, Math.min(1e3, Math.floor(t))), r = Date.now(), i = this.options.volatility / 1e3, a = this.options.basePrice * (.5 + _E(e) % 1e3 / 1e3), o = [];
24577
24627
  for (let e = n - 1; e >= 0; e--) a = Math.max(a * .5, a * (1 + (Math.random() - .5) * i)), o.push({
24578
24628
  time: r - e * 1e3,
24579
24629
  price: a,
@@ -24582,7 +24632,7 @@ var sE = class {
24582
24632
  return o;
24583
24633
  }
24584
24634
  subscribeTrades(e, t) {
24585
- let n = this.options.volatility / 1e3, r = this.options.basePrice * (.5 + lE(e) % 1e3 / 1e3), i = setInterval(() => {
24635
+ let n = this.options.volatility / 1e3, r = this.options.basePrice * (.5 + _E(e) % 1e3 / 1e3), i = setInterval(() => {
24586
24636
  let e = [];
24587
24637
  for (let t = 0; t < 3; t++) r = Math.max(r * .5, r * (1 + (Math.random() - .5) * n)), e.push({
24588
24638
  time: Date.now(),
@@ -24701,14 +24751,14 @@ var sE = class {
24701
24751
  }
24702
24752
  }
24703
24753
  };
24704
- function lE(e) {
24754
+ function _E(e) {
24705
24755
  let t = 0;
24706
24756
  for (let n = 0; n < e.length; n++) t = t * 31 + e.charCodeAt(n) >>> 0;
24707
24757
  return t;
24708
24758
  }
24709
24759
  //#endregion
24710
24760
  //#region src/realtime/adapters/WebSocketAdapter.ts
24711
- var uE = class {
24761
+ var vE = class {
24712
24762
  name;
24713
24763
  supportedTimeframes;
24714
24764
  ws = null;
@@ -24716,7 +24766,7 @@ var uE = class {
24716
24766
  config = null;
24717
24767
  listeners = /* @__PURE__ */ new Map();
24718
24768
  opts;
24719
- newestBar = new $T();
24769
+ newestBar = new sE();
24720
24770
  fetchHistoryBefore;
24721
24771
  searchSymbols;
24722
24772
  resolveSymbol;
@@ -24833,7 +24883,7 @@ var uE = class {
24833
24883
  for (let e of n) e(r);
24834
24884
  }
24835
24885
  }
24836
- }, dE = class {
24886
+ }, yE = class {
24837
24887
  name;
24838
24888
  supportedTimeframes;
24839
24889
  state = "disconnected";
@@ -24841,7 +24891,7 @@ var uE = class {
24841
24891
  config = null;
24842
24892
  timer = null;
24843
24893
  lastBarTime = 0;
24844
- served = new QT();
24894
+ served = new oE();
24845
24895
  opts;
24846
24896
  fetchHistoryBefore;
24847
24897
  searchSymbols;
@@ -24939,12 +24989,12 @@ function $(e) {
24939
24989
  }
24940
24990
  return null;
24941
24991
  }
24942
- function fE(e) {
24992
+ function bE(e) {
24943
24993
  return typeof e == "object" && !!e;
24944
24994
  }
24945
24995
  //#endregion
24946
24996
  //#region src/realtime/adapters/CoinbaseAdapter.ts
24947
- var pE = {
24997
+ var xE = {
24948
24998
  "1m": 60,
24949
24999
  "5m": 300,
24950
25000
  "15m": 900,
@@ -24952,36 +25002,36 @@ var pE = {
24952
25002
  "6h": 21600,
24953
25003
  "1d": 86400
24954
25004
  };
24955
- function mE(e) {
24956
- return pE[e] ?? 3600;
25005
+ function SE(e) {
25006
+ return xE[e] ?? 3600;
24957
25007
  }
24958
- var hE = class extends dE {
25008
+ var CE = class extends yE {
24959
25009
  constructor(e = {}) {
24960
25010
  let t = e.restBase ?? "https://api.exchange.coinbase.com";
24961
25011
  super({
24962
25012
  name: "coinbase",
24963
- supportedTimeframes: Object.keys(pE),
25013
+ supportedTimeframes: Object.keys(xE),
24964
25014
  intervalMs: e.intervalMs ?? 5e3,
24965
25015
  pollLimit: 2,
24966
- fetchBars: (e, n) => gE(t, e, n)
25016
+ fetchBars: (e, n) => wE(t, e, n)
24967
25017
  });
24968
25018
  }
24969
25019
  };
24970
- async function gE(e, t, n) {
24971
- let r = `${e}/products/${t}/candles?granularity=${mE(n)}`, i = await fetch(r);
25020
+ async function wE(e, t, n) {
25021
+ let r = `${e}/products/${t}/candles?granularity=${SE(n)}`, i = await fetch(r);
24972
25022
  if (!i.ok) throw Error(`Coinbase REST error: ${i.status}`);
24973
- return _E(await i.json());
25023
+ return TE(await i.json());
24974
25024
  }
24975
- function _E(e) {
25025
+ function TE(e) {
24976
25026
  if (!Array.isArray(e)) return [];
24977
25027
  let t = [];
24978
25028
  for (let n of e) {
24979
- let e = vE(n);
25029
+ let e = EE(n);
24980
25030
  e && t.push(e);
24981
25031
  }
24982
25032
  return t.sort((e, t) => e.time - t.time), t;
24983
25033
  }
24984
- function vE(e) {
25034
+ function EE(e) {
24985
25035
  if (!Array.isArray(e) || e.length < 6) return null;
24986
25036
  let t = $(e[0]), n = $(e[1]), r = $(e[2]), i = $(e[3]), a = $(e[4]), o = $(e[5]);
24987
25037
  return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
@@ -24995,7 +25045,7 @@ function vE(e) {
24995
25045
  }
24996
25046
  //#endregion
24997
25047
  //#region src/realtime/adapters/BybitAdapter.ts
24998
- var yE = {
25048
+ var DE = {
24999
25049
  "1m": "1",
25000
25050
  "3m": "3",
25001
25051
  "5m": "5",
@@ -25010,10 +25060,10 @@ var yE = {
25010
25060
  "1w": "W",
25011
25061
  "1M": "M"
25012
25062
  };
25013
- function bE(e) {
25014
- return yE[e] ?? "1";
25063
+ function OE(e) {
25064
+ return DE[e] ?? "1";
25015
25065
  }
25016
- var xE = class extends uE {
25066
+ var kE = class extends vE {
25017
25067
  constructor(e = {}) {
25018
25068
  let t = e.restBase ?? "https://api.bybit.com", n = e.wsBase ?? "wss://stream.bybit.com/v5/public/spot", r = e.category ?? "spot";
25019
25069
  super({
@@ -25021,25 +25071,25 @@ var xE = class extends uE {
25021
25071
  wsUrl: () => n,
25022
25072
  subscribeMessage: (e) => ({
25023
25073
  op: "subscribe",
25024
- args: [`kline.${bE(e.timeframe)}.${e.symbol}`]
25074
+ args: [`kline.${OE(e.timeframe)}.${e.symbol}`]
25025
25075
  }),
25026
25076
  unsubscribeMessage: (e) => ({
25027
25077
  op: "unsubscribe",
25028
- args: [`kline.${bE(e.timeframe)}.${e.symbol}`]
25078
+ args: [`kline.${OE(e.timeframe)}.${e.symbol}`]
25029
25079
  }),
25030
- supportedTimeframes: Object.keys(yE),
25031
- parseMessage: SE,
25032
- fetchHistory: (e, n, i) => CE(t, r, e, n, i),
25033
- fetchHistoryBefore: (e, n, i, a) => CE(t, r, e, n, a, Math.floor(i) - 1)
25080
+ supportedTimeframes: Object.keys(DE),
25081
+ parseMessage: AE,
25082
+ fetchHistory: (e, n, i) => jE(t, r, e, n, i),
25083
+ fetchHistoryBefore: (e, n, i, a) => jE(t, r, e, n, a, Math.floor(i) - 1)
25034
25084
  });
25035
25085
  }
25036
25086
  };
25037
- function SE(e) {
25038
- if (!fE(e) || typeof e.topic != "string" || !e.topic.startsWith("kline.")) return null;
25087
+ function AE(e) {
25088
+ if (!bE(e) || typeof e.topic != "string" || !e.topic.startsWith("kline.")) return null;
25039
25089
  let t = e.data;
25040
25090
  if (!Array.isArray(t) || t.length === 0) return null;
25041
25091
  let n = t[t.length - 1];
25042
- if (!fE(n)) return null;
25092
+ if (!bE(n)) return null;
25043
25093
  let r = $(n.start), i = $(n.open), a = $(n.high), o = $(n.low), s = $(n.close), c = $(n.volume);
25044
25094
  if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
25045
25095
  let l = typeof n.confirm == "boolean" ? n.confirm : !1;
@@ -25055,23 +25105,23 @@ function SE(e) {
25055
25105
  closed: l
25056
25106
  };
25057
25107
  }
25058
- async function CE(e, t, n, r, i, a) {
25059
- let o = `${e}/v5/market/kline?category=${t}&symbol=${n}&interval=${bE(r)}&limit=${Math.min(Math.max(i, 1), 1e3)}${a === void 0 ? "" : `&end=${a}`}`, s = await fetch(o);
25108
+ async function jE(e, t, n, r, i, a) {
25109
+ let o = `${e}/v5/market/kline?category=${t}&symbol=${n}&interval=${OE(r)}&limit=${Math.min(Math.max(i, 1), 1e3)}${a === void 0 ? "" : `&end=${a}`}`, s = await fetch(o);
25060
25110
  if (!s.ok) throw Error(`Bybit REST error: ${s.status}`);
25061
- return wE(await s.json());
25111
+ return ME(await s.json());
25062
25112
  }
25063
- function wE(e) {
25064
- if (!fE(e) || !fE(e.result)) return [];
25113
+ function ME(e) {
25114
+ if (!bE(e) || !bE(e.result)) return [];
25065
25115
  let t = e.result.list;
25066
25116
  if (!Array.isArray(t)) return [];
25067
25117
  let n = [];
25068
25118
  for (let e of t) {
25069
- let t = TE(e);
25119
+ let t = NE(e);
25070
25120
  t && n.push(t);
25071
25121
  }
25072
25122
  return n.sort((e, t) => e.time - t.time), n;
25073
25123
  }
25074
- function TE(e) {
25124
+ function NE(e) {
25075
25125
  if (!Array.isArray(e) || e.length < 6) return null;
25076
25126
  let t = $(e[0]), n = $(e[1]), r = $(e[2]), i = $(e[3]), a = $(e[4]), o = $(e[5]);
25077
25127
  return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
@@ -25085,7 +25135,7 @@ function TE(e) {
25085
25135
  }
25086
25136
  //#endregion
25087
25137
  //#region src/realtime/adapters/KrakenAdapter.ts
25088
- var EE = {
25138
+ var PE = {
25089
25139
  "1m": 1,
25090
25140
  "5m": 5,
25091
25141
  "15m": 15,
@@ -25095,10 +25145,10 @@ var EE = {
25095
25145
  "1d": 1440,
25096
25146
  "1w": 10080
25097
25147
  };
25098
- function DE(e) {
25099
- return EE[e] ?? 1;
25148
+ function FE(e) {
25149
+ return PE[e] ?? 1;
25100
25150
  }
25101
- var OE = class extends uE {
25151
+ var IE = class extends vE {
25102
25152
  constructor(e = {}) {
25103
25153
  let t = e.restBase ?? "https://api.kraken.com", n = e.wsBase ?? "wss://ws.kraken.com/v2";
25104
25154
  super({
@@ -25109,7 +25159,7 @@ var OE = class extends uE {
25109
25159
  params: {
25110
25160
  channel: "ohlc",
25111
25161
  symbol: [e.symbol],
25112
- interval: DE(e.timeframe)
25162
+ interval: FE(e.timeframe)
25113
25163
  }
25114
25164
  }),
25115
25165
  unsubscribeMessage: (e) => ({
@@ -25117,21 +25167,21 @@ var OE = class extends uE {
25117
25167
  params: {
25118
25168
  channel: "ohlc",
25119
25169
  symbol: [e.symbol],
25120
- interval: DE(e.timeframe)
25170
+ interval: FE(e.timeframe)
25121
25171
  }
25122
25172
  }),
25123
- supportedTimeframes: Object.keys(EE),
25124
- parseMessage: kE,
25125
- fetchHistory: (e, n) => AE(t, e, n)
25173
+ supportedTimeframes: Object.keys(PE),
25174
+ parseMessage: LE,
25175
+ fetchHistory: (e, n) => RE(t, e, n)
25126
25176
  });
25127
25177
  }
25128
25178
  };
25129
- function kE(e) {
25130
- if (!fE(e) || e.channel !== "ohlc") return null;
25179
+ function LE(e) {
25180
+ if (!bE(e) || e.channel !== "ohlc") return null;
25131
25181
  let t = e.data;
25132
25182
  if (!Array.isArray(t) || t.length === 0) return null;
25133
25183
  let n = t[t.length - 1];
25134
- if (!fE(n)) return null;
25184
+ if (!bE(n)) return null;
25135
25185
  let r = $(n.open), i = $(n.high), a = $(n.low), o = $(n.close), s = $(n.volume), c = typeof n.interval_begin == "string" ? Date.parse(n.interval_begin) : NaN;
25136
25186
  return r === null || i === null || a === null || o === null || s === null || !Number.isFinite(c) ? null : {
25137
25187
  bar: {
@@ -25145,13 +25195,13 @@ function kE(e) {
25145
25195
  closed: !1
25146
25196
  };
25147
25197
  }
25148
- async function AE(e, t, n) {
25149
- let r = DE(n), i = t.replace("/", ""), a = `${e}/0/public/OHLC?pair=${encodeURIComponent(i)}&interval=${r}`, o = await fetch(a);
25198
+ async function RE(e, t, n) {
25199
+ let r = FE(n), i = t.replace("/", ""), a = `${e}/0/public/OHLC?pair=${encodeURIComponent(i)}&interval=${r}`, o = await fetch(a);
25150
25200
  if (!o.ok) throw Error(`Kraken REST error: ${o.status}`);
25151
- return jE(await o.json());
25201
+ return zE(await o.json());
25152
25202
  }
25153
- function jE(e) {
25154
- if (!fE(e) || !fE(e.result)) return [];
25203
+ function zE(e) {
25204
+ if (!bE(e) || !bE(e.result)) return [];
25155
25205
  let t = null;
25156
25206
  for (let [n, r] of Object.entries(e.result)) if (n !== "last" && Array.isArray(r)) {
25157
25207
  t = r;
@@ -25160,12 +25210,12 @@ function jE(e) {
25160
25210
  if (!Array.isArray(t)) return [];
25161
25211
  let n = [];
25162
25212
  for (let e of t) {
25163
- let t = ME(e);
25213
+ let t = BE(e);
25164
25214
  t && n.push(t);
25165
25215
  }
25166
25216
  return n.sort((e, t) => e.time - t.time), n;
25167
25217
  }
25168
- function ME(e) {
25218
+ function BE(e) {
25169
25219
  if (!Array.isArray(e) || e.length < 7) return null;
25170
25220
  let t = $(e[0]), n = $(e[1]), r = $(e[2]), i = $(e[3]), a = $(e[4]), o = $(e[6]);
25171
25221
  return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
@@ -25179,7 +25229,7 @@ function ME(e) {
25179
25229
  }
25180
25230
  //#endregion
25181
25231
  //#region src/realtime/adapters/UpbitAdapter.ts
25182
- var NE = 200, PE = {
25232
+ var VE = 200, HE = {
25183
25233
  "1m": "minutes/1",
25184
25234
  "3m": "minutes/3",
25185
25235
  "5m": "minutes/5",
@@ -25190,7 +25240,7 @@ var NE = 200, PE = {
25190
25240
  "1d": "days",
25191
25241
  "1w": "weeks",
25192
25242
  "1M": "months"
25193
- }, FE = {
25243
+ }, UE = {
25194
25244
  "1m": "candle.1m",
25195
25245
  "3m": "candle.3m",
25196
25246
  "5m": "candle.5m",
@@ -25200,57 +25250,57 @@ var NE = 200, PE = {
25200
25250
  "4h": "candle.240m",
25201
25251
  "1d": "ticker"
25202
25252
  };
25203
- function IE(e) {
25204
- return PE[e] ?? null;
25253
+ function WE(e) {
25254
+ return HE[e] ?? null;
25205
25255
  }
25206
- function LE(e) {
25207
- return FE[e] ?? null;
25256
+ function GE(e) {
25257
+ return UE[e] ?? null;
25208
25258
  }
25209
- var RE = class extends uE {
25259
+ var KE = class extends vE {
25210
25260
  constructor(e = {}) {
25211
25261
  let t = e.restBase ?? "https://api.upbit.com", n = e.wsUrl ?? "wss://api.upbit.com/websocket/v1";
25212
25262
  super({
25213
25263
  name: "upbit",
25214
25264
  wsUrl: () => n,
25215
- socketFactory: e.socketFactory ?? zE,
25216
- decode: VE,
25265
+ socketFactory: e.socketFactory ?? qE,
25266
+ decode: YE,
25217
25267
  subscribeMessage: (e) => [
25218
25268
  { ticket: "tradecanvas" },
25219
25269
  {
25220
- type: LE(e.timeframe) ?? "candle.1m",
25270
+ type: GE(e.timeframe) ?? "candle.1m",
25221
25271
  codes: [e.symbol]
25222
25272
  },
25223
25273
  { format: "DEFAULT" }
25224
25274
  ],
25225
- supportedTimeframes: Object.keys(FE),
25226
- parseMessage: HE,
25227
- fetchHistory: (e, n, r) => GE(t, e, n, r),
25228
- fetchHistoryBefore: (e, n, r, i) => GE(t, e, n, i, r)
25275
+ supportedTimeframes: Object.keys(UE),
25276
+ parseMessage: XE,
25277
+ fetchHistory: (e, n, r) => $E(t, e, n, r),
25278
+ fetchHistoryBefore: (e, n, r, i) => $E(t, e, n, i, r)
25229
25279
  });
25230
25280
  }
25231
25281
  };
25232
- function zE(e) {
25282
+ function qE(e) {
25233
25283
  let t = globalThis.WebSocket;
25234
25284
  if (!t) throw Error("No WebSocket implementation available");
25235
25285
  let n = new t(e);
25236
25286
  return n.binaryType = "arraybuffer", n;
25237
25287
  }
25238
- var BE = null;
25239
- function VE(e) {
25288
+ var JE = null;
25289
+ function YE(e) {
25240
25290
  if (typeof e == "string") return JSON.parse(e);
25241
- if (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) return JSON.parse((BE ??= new TextDecoder()).decode(e));
25291
+ if (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) return JSON.parse((JE ??= new TextDecoder()).decode(e));
25242
25292
  }
25243
- function HE(e) {
25244
- if (!fE(e) || typeof e.type != "string") return null;
25293
+ function XE(e) {
25294
+ if (!bE(e) || typeof e.type != "string") return null;
25245
25295
  if (e.type.startsWith("candle.")) {
25246
- let t = WE(e, e.candle_date_time_utc, e.candle_acc_trade_volume);
25296
+ let t = QE(e, e.candle_date_time_utc, e.candle_acc_trade_volume);
25247
25297
  return t ? {
25248
25298
  bar: t,
25249
25299
  closed: !1
25250
25300
  } : null;
25251
25301
  }
25252
25302
  if (e.type === "ticker" && typeof e.trade_date == "string" && /^\d{8}$/.test(e.trade_date)) {
25253
- let t = e.trade_date, n = WE(e, `${t.slice(0, 4)}-${t.slice(4, 6)}-${t.slice(6, 8)}T00:00:00`, e.acc_trade_volume);
25303
+ let t = e.trade_date, n = QE(e, `${t.slice(0, 4)}-${t.slice(4, 6)}-${t.slice(6, 8)}T00:00:00`, e.acc_trade_volume);
25254
25304
  return n ? {
25255
25305
  bar: n,
25256
25306
  closed: !1
@@ -25258,16 +25308,16 @@ function HE(e) {
25258
25308
  }
25259
25309
  return null;
25260
25310
  }
25261
- function UE(e) {
25311
+ function ZE(e) {
25262
25312
  if (!Array.isArray(e)) return [];
25263
25313
  let t = [];
25264
25314
  for (let n of e) {
25265
- let e = fE(n) ? WE(n, n.candle_date_time_utc, n.candle_acc_trade_volume) : null;
25315
+ let e = bE(n) ? QE(n, n.candle_date_time_utc, n.candle_acc_trade_volume) : null;
25266
25316
  e && t.push(e);
25267
25317
  }
25268
25318
  return t.sort((e, t) => e.time - t.time), t;
25269
25319
  }
25270
- function WE(e, t, n) {
25320
+ function QE(e, t, n) {
25271
25321
  let r = typeof t == "string" ? Date.parse(`${t}Z`) : NaN, i = $(e.opening_price), a = $(e.high_price), o = $(e.low_price), s = $(e.trade_price), c = $(n);
25272
25322
  return !Number.isFinite(r) || i === null || a === null || o === null || s === null || c === null ? null : {
25273
25323
  time: r,
@@ -25278,8 +25328,8 @@ function WE(e, t, n) {
25278
25328
  volume: c
25279
25329
  };
25280
25330
  }
25281
- async function GE(e, t, n, r, i) {
25282
- let a = IE(n);
25331
+ async function $E(e, t, n, r, i) {
25332
+ let a = WE(n);
25283
25333
  if (!a) throw Error(`Upbit has no ${n} candles`);
25284
25334
  let o = new URLSearchParams({
25285
25335
  market: t,
@@ -25288,11 +25338,11 @@ async function GE(e, t, n, r, i) {
25288
25338
  i !== void 0 && o.set("to", new Date(i).toISOString().replace(/\.\d{3}Z$/, "Z"));
25289
25339
  let s = await fetch(`${e}/v1/candles/${a}?${o}`);
25290
25340
  if (!s.ok) throw Error(`Upbit REST error: ${s.status}`);
25291
- return UE(await s.json());
25341
+ return ZE(await s.json());
25292
25342
  }
25293
25343
  //#endregion
25294
25344
  //#region src/realtime/feeds/ManualFeed.ts
25295
- var KE = (e, t) => `${e}\u0000${t}`, qE = class {
25345
+ var eD = (e, t) => `${e}\u0000${t}`, tD = class {
25296
25346
  name;
25297
25347
  series = /* @__PURE__ */ new Map();
25298
25348
  subscribers = /* @__PURE__ */ new Map();
@@ -25301,10 +25351,10 @@ var KE = (e, t) => `${e}\u0000${t}`, qE = class {
25301
25351
  }
25302
25352
  setBars(e, t, n) {
25303
25353
  let r = n.map((e) => ({ ...e })).sort((e, t) => e.time - t.time);
25304
- this.series.set(KE(e, t), r);
25354
+ this.series.set(eD(e, t), r);
25305
25355
  }
25306
25356
  pushBar(e, t, n, r = !1) {
25307
- let i = KE(e, t), a = this.series.get(i) ?? [], o = a[a.length - 1], s = { ...n }, c = r;
25357
+ let i = eD(e, t), a = this.series.get(i) ?? [], o = a[a.length - 1], s = { ...n }, c = r;
25308
25358
  if (!o || s.time > o.time) this.series.set(i, [...a, s]);
25309
25359
  else {
25310
25360
  let n = a.findIndex((e) => e.time === s.time);
@@ -25314,17 +25364,17 @@ var KE = (e, t) => `${e}\u0000${t}`, qE = class {
25314
25364
  for (let e of [...this.subscribers.get(i) ?? []]) e.bar({ ...s }, c);
25315
25365
  }
25316
25366
  async getBars(e) {
25317
- let t = this.series.get(KE(e.symbol, e.timeframe)) ?? [], { before: n } = e, r = n === void 0 ? t.length : JE(t, n);
25367
+ let t = this.series.get(eD(e.symbol, e.timeframe)) ?? [], { before: n } = e, r = n === void 0 ? t.length : nD(t, n);
25318
25368
  return t.slice(Math.max(0, r - e.countBack), r).map((e) => ({ ...e }));
25319
25369
  }
25320
25370
  subscribeBars(e, t) {
25321
- let n = KE(e.symbol, e.timeframe), r = this.subscribers.get(n);
25371
+ let n = eD(e.symbol, e.timeframe), r = this.subscribers.get(n);
25322
25372
  return r || (r = /* @__PURE__ */ new Set(), this.subscribers.set(n, r)), r.add(t), () => {
25323
25373
  r.delete(t), r.size === 0 && this.subscribers.delete(n);
25324
25374
  };
25325
25375
  }
25326
25376
  };
25327
- function JE(e, t) {
25377
+ function nD(e, t) {
25328
25378
  let n = 0, r = e.length;
25329
25379
  for (; n < r;) {
25330
25380
  let i = n + r >> 1;
@@ -25334,7 +25384,7 @@ function JE(e, t) {
25334
25384
  }
25335
25385
  //#endregion
25336
25386
  //#region src/ui/ChartLegend.ts
25337
- var YE = {
25387
+ var rD = {
25338
25388
  visible: !0,
25339
25389
  showSymbol: !0,
25340
25390
  showOHLC: !0,
@@ -25344,8 +25394,8 @@ var YE = {
25344
25394
  fontSize: 12,
25345
25395
  fontFamily: null,
25346
25396
  ground: !0
25347
- }, XE = class {
25348
- config = { ...YE };
25397
+ }, iD = class {
25398
+ config = { ...rD };
25349
25399
  symbol = "";
25350
25400
  timeframe = "";
25351
25401
  hoverBar = null;
@@ -25356,9 +25406,9 @@ var YE = {
25356
25406
  drawnHeight = null;
25357
25407
  drawnWidth = 0;
25358
25408
  locale = "en-US";
25359
- inset = QE;
25360
- top = ZE;
25361
- lineGap = $E;
25409
+ inset = oD;
25410
+ top = aD;
25411
+ lineGap = sD;
25362
25412
  pricePrecision = null;
25363
25413
  reportedHeight = null;
25364
25414
  resizeListener = null;
@@ -25472,7 +25522,7 @@ var YE = {
25472
25522
  return f.map((t) => ({
25473
25523
  ...t,
25474
25524
  labelWidth: t.label ? e.measureText(t.label + " ").width : 0,
25475
- width: iD(e, t.value),
25525
+ width: fD(e, t.value),
25476
25526
  font: c
25477
25527
  }));
25478
25528
  }
@@ -25500,7 +25550,7 @@ var YE = {
25500
25550
  if (this.config.showOHLC && h.push(...this.priceCells(e, t, n, i, a, s, c, l)), h.length > 0) {
25501
25551
  e.font = `${s}px ${c}`;
25502
25552
  let t = e.measureText(" ").width;
25503
- for (let r of rD(h, t, o.width - 2 * this.inset)) {
25553
+ for (let r of dD(h, t, o.width - 2 * this.inset)) {
25504
25554
  let i = r.reduce((e, n) => e + n.labelWidth + n.width + t, -t);
25505
25555
  m = Math.max(m, i);
25506
25556
  let a = d ? f : f - i;
@@ -25522,7 +25572,7 @@ var YE = {
25522
25572
  return {
25523
25573
  entry: n,
25524
25574
  color: t.color,
25525
- width: iD(e, n)
25575
+ width: fD(e, n)
25526
25576
  };
25527
25577
  }), i = r.reduce((e, n) => e + n.width + t, -t), a = d ? f : f - i;
25528
25578
  this.drawGround(e, n, a, p, i, s), e.textAlign = "left";
@@ -25530,10 +25580,10 @@ var YE = {
25530
25580
  }
25531
25581
  }
25532
25582
  drawGround(e, t, n, r, i, a) {
25533
- !this.config.ground || i <= 0 || (e.save(), e.globalAlpha = eD, e.fillStyle = t.background, e.fillRect(n - tD, r - nD, i + 2 * tD, a + this.lineGap), e.restore());
25583
+ !this.config.ground || i <= 0 || (e.save(), e.globalAlpha = cD, e.fillStyle = t.background, e.fillRect(n - lD, r - uD, i + 2 * lD, a + this.lineGap), e.restore());
25534
25584
  }
25535
- }, { legendTop: ZE, legendInset: QE, legendLineGap: $E } = re[ce], eD = .72, tD = 3, nD = 1;
25536
- function rD(e, t, n) {
25585
+ }, { legendTop: aD, legendInset: oD, legendLineGap: sD } = re[ce], cD = .72, lD = 3, uD = 1;
25586
+ function dD(e, t, n) {
25537
25587
  let r = [], i = [], a = 0;
25538
25588
  for (let o of e) {
25539
25589
  let e = o.labelWidth + o.width;
@@ -25541,13 +25591,13 @@ function rD(e, t, n) {
25541
25591
  }
25542
25592
  return i.length > 0 && r.push(i), r;
25543
25593
  }
25544
- function iD(e, t) {
25594
+ function fD(e, t) {
25545
25595
  let n = t.replace(/\d/g, "0");
25546
25596
  return Math.max(e.measureText(t).width, e.measureText(n.replace(/[-−]/g, "+")).width, e.measureText(n.replace(/\+/g, "-")).width);
25547
25597
  }
25548
25598
  //#endregion
25549
25599
  //#region src/ui/Screenshot.ts
25550
- var aD = class {
25600
+ var pD = class {
25551
25601
  static toDataURL(e, t) {
25552
25602
  return this.compose(e, t)?.toDataURL("image/png") ?? "";
25553
25603
  }
@@ -25572,7 +25622,7 @@ var aD = class {
25572
25622
  for (let e of c) s.drawImage(e, 0, 0);
25573
25623
  return o;
25574
25624
  }
25575
- }, oD = class {
25625
+ }, mD = class {
25576
25626
  config = null;
25577
25627
  setConfig(e) {
25578
25628
  this.config = e;
@@ -25585,12 +25635,12 @@ var aD = class {
25585
25635
  let { chartRect: r } = t, i = this.config.fontSize ?? 48, a = n.style?.watermark.color ?? this.config.color ?? n.textSecondary;
25586
25636
  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();
25587
25637
  }
25588
- }, sD = {
25638
+ }, hD = {
25589
25639
  solid: null,
25590
25640
  dashed: [6, 4],
25591
25641
  dotted: [2, 3]
25592
- }, cD = 6;
25593
- function lD(e, t) {
25642
+ }, gD = 6;
25643
+ function _D(e, t) {
25594
25644
  let n = [...e].sort((e, t) => t.rank - e.rank || e.px - t.px), r = [], i = [];
25595
25645
  for (let e of n) {
25596
25646
  let n = 0, a = r.length;
@@ -25602,7 +25652,7 @@ function lD(e, t) {
25602
25652
  }
25603
25653
  return i.sort((e, t) => e.px - t.px);
25604
25654
  }
25605
- var uD = class {
25655
+ var vD = class {
25606
25656
  config = { visible: !1 };
25607
25657
  cachedBreaksTyped = [];
25608
25658
  cachedMedianStep = 0;
@@ -25647,7 +25697,7 @@ var uD = class {
25647
25697
  }
25648
25698
  o = n;
25649
25699
  }
25650
- return this.lastDataLength = e.length, this.firstTime = e[0].time, this.lastTime = e[e.length - 1].time, this.cachedBreaksTyped = r, n || (this.cachedMedianStep = dD(e)), this.cacheValid = !0, r;
25700
+ return this.lastDataLength = e.length, this.firstTime = e[0].time, this.lastTime = e[e.length - 1].time, this.cachedBreaksTyped = r, n || (this.cachedMedianStep = yD(e)), this.cacheValid = !0, r;
25651
25701
  }
25652
25702
  render(e, t, n, r) {
25653
25703
  this.renderLines(e, t, n, r);
@@ -25655,7 +25705,7 @@ var uD = class {
25655
25705
  renderLines(e, t, n, r) {
25656
25706
  let i = this.lineMarks(t, r, n);
25657
25707
  if (i.length === 0) return;
25658
- let { chartRect: a } = t, o = this.look(n), s = sD[o.style];
25708
+ let { chartRect: a } = t, o = this.look(n), s = hD[o.style];
25659
25709
  e.save(), s && e.setLineDash(s), e.strokeStyle = o.color;
25660
25710
  for (let t of i) e.globalAlpha = t.alpha, e.lineWidth = t.width, e.beginPath(), e.moveTo(t.px, a.y), e.lineTo(t.px, a.y + a.height), e.stroke();
25661
25711
  e.restore();
@@ -25663,7 +25713,7 @@ var uD = class {
25663
25713
  lineRects(e, t, n) {
25664
25714
  let r = this.lineMarks(e, n, t);
25665
25715
  if (r.length === 0) return [];
25666
- let { color: i, style: a } = this.look(t), o = sD[a] ?? void 0, { y: s, height: c } = e.chartRect;
25716
+ let { color: i, style: a } = this.look(t), o = hD[a] ?? void 0, { y: s, height: c } = e.chartRect;
25667
25717
  return r.map((e) => ({
25668
25718
  x: e.px - e.width / 2,
25669
25719
  y: s,
@@ -25683,7 +25733,7 @@ var uD = class {
25683
25733
  };
25684
25734
  }
25685
25735
  lineMarks(e, t, n) {
25686
- return lD(this.marks(e, t, n), cD);
25736
+ return _D(this.marks(e, t, n), gD);
25687
25737
  }
25688
25738
  marks(e, t, n) {
25689
25739
  if (!this.config.visible || t.length < 2) return [];
@@ -25707,7 +25757,7 @@ var uD = class {
25707
25757
  this.lastDataLength = 0, this.cachedBreaksTyped = [], this.cachedMedianStep = 0, this.cacheValid = !1;
25708
25758
  }
25709
25759
  };
25710
- function dD(e) {
25760
+ function yD(e) {
25711
25761
  if (e.length < 2) return 0;
25712
25762
  let t = Math.min(50, e.length - 1), n = A(e), r = [];
25713
25763
  for (let i = 1; i <= t; i++) r.push((e[i].time - e[i - 1].time) * n);
@@ -25715,35 +25765,35 @@ function dD(e) {
25715
25765
  }
25716
25766
  //#endregion
25717
25767
  //#region src/ui/sessionHours.ts
25718
- var fD = 864e5;
25719
- function pD(e, t) {
25768
+ var bD = 864e5;
25769
+ function xD(e, t) {
25720
25770
  let n = {
25721
25771
  ...e,
25722
25772
  ...t
25723
25773
  };
25724
25774
  return t.tzOffsetMinutes !== void 0 && t.timeZone === void 0 && delete n.timeZone, n.windows ? n.windows = n.windows.map((e) => ({ ...e })) : delete n.windows, n;
25725
25775
  }
25726
- function mD(e, t) {
25727
- let n = ((e + t * 6e4) % fD + fD) % fD;
25776
+ function SD(e, t) {
25777
+ let n = ((e + t * 6e4) % bD + bD) % bD;
25728
25778
  return Math.floor(n / 6e4);
25729
25779
  }
25730
- function hD(e, t, n) {
25780
+ function CD(e, t, n) {
25731
25781
  return t === n ? !0 : t < n ? e >= t && e < n : e >= t || e < n;
25732
25782
  }
25733
- function gD(e, t) {
25734
- let n = mD(e, t.timeZone ? Mt(t.timeZone, e) : t.tzOffsetMinutes ?? 0);
25735
- return t.windows && t.windows.length > 0 ? t.windows.some((e) => hD(n, e.startMinute, e.endMinute)) : hD(n, t.startMinute, t.endMinute);
25783
+ function wD(e, t) {
25784
+ let n = SD(e, t.timeZone ? Mt(t.timeZone, e) : t.tzOffsetMinutes ?? 0);
25785
+ return t.windows && t.windows.length > 0 ? t.windows.some((e) => CD(n, e.startMinute, e.endMinute)) : CD(n, t.startMinute, t.endMinute);
25736
25786
  }
25737
25787
  //#endregion
25738
25788
  //#region src/ui/SessionShading.ts
25739
- var _D = {
25789
+ var TD = {
25740
25790
  startMinute: 570,
25741
25791
  endMinute: 960,
25742
25792
  tzOffsetMinutes: -300,
25743
25793
  timeZone: "America/New_York"
25744
- }, vD = class {
25794
+ }, ED = class {
25745
25795
  visible = !1;
25746
- config = { ..._D };
25796
+ config = { ...TD };
25747
25797
  setVisible(e) {
25748
25798
  this.visible = e;
25749
25799
  }
@@ -25751,10 +25801,10 @@ var _D = {
25751
25801
  return this.visible;
25752
25802
  }
25753
25803
  setConfig(e) {
25754
- this.config = pD(this.config, e);
25804
+ this.config = xD(this.config, e);
25755
25805
  }
25756
25806
  replaceConfig(e) {
25757
- this.config = pD(e, {});
25807
+ this.config = xD(e, {});
25758
25808
  }
25759
25809
  getConfig() {
25760
25810
  return {
@@ -25786,12 +25836,12 @@ var _D = {
25786
25836
  });
25787
25837
  };
25788
25838
  for (let t = o; t <= s; t++) {
25789
- let n = !gD(e[t].time, this.config);
25839
+ let n = !wD(e[t].time, this.config);
25790
25840
  n && d === -1 ? d = t : !n && d !== -1 && (f(d, t - 1), d = -1);
25791
25841
  }
25792
25842
  return d !== -1 && f(d, s), u;
25793
25843
  }
25794
- }, yD = [2, 3], bD = 16, xD = class {
25844
+ }, DD = [2, 3], OD = 16, kD = class {
25795
25845
  highLow = !1;
25796
25846
  quote = null;
25797
25847
  quoteShown = !0;
@@ -25838,10 +25888,10 @@ var _D = {
25838
25888
  }
25839
25889
  render(e, t, n, r) {
25840
25890
  let { chartRect: i } = t;
25841
- e.save(), e.setLineDash(yD), e.lineWidth = 1;
25891
+ e.save(), e.setLineDash(DD), e.lineWidth = 1;
25842
25892
  for (let a of this.levels(r, t)) {
25843
25893
  let r = Math.round(x(a.price, t)) + .5;
25844
- r < i.y || r > i.y + i.height || (e.strokeStyle = SD(a.kind, n), e.beginPath(), ne(e, i.x, i.x + i.width, r), e.stroke());
25894
+ r < i.y || r > i.y + i.height || (e.strokeStyle = AD(a.kind, n), e.beginPath(), ne(e, i.x, i.x + i.width, r), e.stroke());
25845
25895
  }
25846
25896
  e.restore();
25847
25897
  }
@@ -25853,14 +25903,14 @@ var _D = {
25853
25903
  if (r < a.y || r > a.y + a.height) continue;
25854
25904
  let u = i?.get(l.kind) ?? r;
25855
25905
  if (Number.isNaN(u)) continue;
25856
- e.fillStyle = SD(l.kind, n), ln(e, o, u - bD / 2, s, bD, n), e.fillStyle = n.background;
25906
+ e.fillStyle = AD(l.kind, n), ln(e, o, u - OD / 2, s, OD, n), e.fillStyle = n.background;
25857
25907
  let d = t.formatPrice?.(l.price) ?? this.priceText?.(l.price) ?? j(l.price, c);
25858
25908
  e.fillText(d, o + 7, u);
25859
25909
  }
25860
25910
  e.restore();
25861
25911
  }
25862
25912
  };
25863
- function SD(e, t) {
25913
+ function AD(e, t) {
25864
25914
  switch (e) {
25865
25915
  case "bid": return t.candleUp;
25866
25916
  case "ask": return t.candleDown;
@@ -25869,11 +25919,11 @@ function SD(e, t) {
25869
25919
  }
25870
25920
  //#endregion
25871
25921
  //#region src/features/AlertManager.ts
25872
- var CD = 12, wD = 3, TD = 500, ED = 2, DD = ["movesUp", "movesDown"];
25873
- function OD(e) {
25874
- return e.channel === "price" && !e.drawingId && !e.target && !DD.includes(e.condition);
25922
+ var jD = 12, MD = 3, ND = 500, PD = 2, FD = ["movesUp", "movesDown"];
25923
+ function ID(e) {
25924
+ return e.channel === "price" && !e.drawingId && !e.target && !FD.includes(e.condition);
25875
25925
  }
25876
- function kD(e, t, n, r) {
25926
+ function LD(e, t, n, r) {
25877
25927
  switch (r) {
25878
25928
  case "crossingUp": return e !== void 0 && e < n && t >= n;
25879
25929
  case "crossingDown": return e !== void 0 && e > n && t <= n;
@@ -25883,16 +25933,16 @@ function kD(e, t, n, r) {
25883
25933
  default: return !1;
25884
25934
  }
25885
25935
  }
25886
- var AD = [
25936
+ var RD = [
25887
25937
  "crossing",
25888
25938
  "crossingUp",
25889
25939
  "crossingDown"
25890
25940
  ];
25891
- function jD(e, t, n) {
25941
+ function zD(e, t, n) {
25892
25942
  let r = e < 0 && t >= 0, i = e > 0 && t <= 0;
25893
25943
  return n === "crossingUp" ? r : n === "crossingDown" ? i : r || i;
25894
25944
  }
25895
- var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
25945
+ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
25896
25946
  alerts = [];
25897
25947
  lastValues = /* @__PURE__ */ new Map();
25898
25948
  drawingSides = /* @__PURE__ */ new Map();
@@ -25913,7 +25963,7 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
25913
25963
  this.pricePrecision = e;
25914
25964
  }
25915
25965
  addAlert(e, t = "crossing", n, r = !1, i = "price", a, o = {}) {
25916
- let s = FD(t, i, o), c = `tc_alert_${MD++}`, l = {
25966
+ let s = UD(t, i, o), c = `tc_alert_${BD++}`, l = {
25917
25967
  id: c,
25918
25968
  price: e,
25919
25969
  condition: t,
@@ -25930,8 +25980,8 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
25930
25980
  this.drawingLevels = e;
25931
25981
  }
25932
25982
  addDrawingAlert(e, t = "crossing", n, r = !1, i) {
25933
- if (!AD.includes(t)) throw RangeError(`An alert on a drawing takes a crossing condition, not "${t}"`);
25934
- let a = `tc_alert_${MD++}`, o = {
25983
+ if (!RD.includes(t)) throw RangeError(`An alert on a drawing takes a crossing condition, not "${t}"`);
25984
+ let a = `tc_alert_${BD++}`, o = {
25935
25985
  id: a,
25936
25986
  price: this.drawingLevels?.(e)?.[0] ?? NaN,
25937
25987
  condition: t,
@@ -25978,7 +26028,7 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
25978
26028
  if (e.y < r.y || e.y > r.y + r.height) return null;
25979
26029
  let i = null, a = n;
25980
26030
  for (let n of this.alerts) {
25981
- if (!OD(n)) continue;
26031
+ if (!ID(n)) continue;
25982
26032
  let r = Math.abs(x(n.price, t) - e.y);
25983
26033
  r <= a && (a = r, i = n);
25984
26034
  }
@@ -26012,7 +26062,7 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26012
26062
  this.expiryTimer && clearTimeout(this.expiryTimer), this.expiryTimer = null;
26013
26063
  let e = Math.min(...this.alerts.filter((e) => !e.expired && e.expiresAt !== void 0 && !(e.triggered && !e.repeating)).map((e) => e.expiresAt));
26014
26064
  if (!Number.isFinite(e)) return;
26015
- let t = Math.min(Math.max(0, e - Date.now()), ND);
26065
+ let t = Math.min(Math.max(0, e - Date.now()), VD);
26016
26066
  this.expiryTimer = setTimeout(() => {
26017
26067
  this.expiryTimer = null, this.expire(), this.expiryTimer || this.scheduleExpiry();
26018
26068
  }, t);
@@ -26030,7 +26080,7 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26030
26080
  }
26031
26081
  t.price = n[0];
26032
26082
  let r = n.map((t) => Math.sign(e - t)), i = this.drawingSides.get(t.id);
26033
- this.drawingSides.set(t.id, r), !(!i || i.length !== r.length) && (r.some((e, n) => jD(i[n], e, t.condition)) ? t.triggered || (t.triggered = !0, this.emit("triggered", { ...t })) : t.repeating && (t.triggered = !1));
26083
+ this.drawingSides.set(t.id, r), !(!i || i.length !== r.length) && (r.some((e, n) => zD(i[n], e, t.condition)) ? t.triggered || (t.triggered = !0, this.emit("triggered", { ...t })) : t.repeating && (t.triggered = !1));
26034
26084
  }
26035
26085
  }
26036
26086
  checkChannel(e, t) {
@@ -26056,13 +26106,13 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26056
26106
  if (!t) continue;
26057
26107
  o = this.closedBarMet(e, t);
26058
26108
  } else if (e.target) o = this.targetMet(e);
26059
- else if (DD.includes(e.condition)) {
26109
+ else if (FD.includes(e.condition)) {
26060
26110
  if (!n) continue;
26061
26111
  o = this.moveMet(e, this.history.get(e.channel) ?? []);
26062
26112
  } else {
26063
26113
  let t = r.get(e.channel);
26064
26114
  if (!n || t === void 0) continue;
26065
- o = kD(t, this.lastValues.get(e.channel), e.price, e.condition);
26115
+ o = LD(t, this.lastValues.get(e.channel), e.price, e.condition);
26066
26116
  }
26067
26117
  this.settle(e, o);
26068
26118
  }
@@ -26074,7 +26124,7 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26074
26124
  let t = this.lastValues.get(e.channel), n = e.target ? this.lastValues.get(e.target) : void 0;
26075
26125
  if (t === void 0 || n === void 0) return !1;
26076
26126
  let r = t - n, i = this.lastDiffs.get(e.id);
26077
- return this.lastDiffs.set(e.id, r), e.price = n, kD(i, r, 0, e.condition);
26127
+ return this.lastDiffs.set(e.id, r), e.price = n, LD(i, r, 0, e.condition);
26078
26128
  }
26079
26129
  moveMet(e, t, n = t.length) {
26080
26130
  let r = e.bars ?? 1, i = t.slice(Math.max(0, n - r), n);
@@ -26090,7 +26140,7 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26090
26140
  closedBarMet(e, t) {
26091
26141
  let n = this.history.get(e.channel) ?? [], r = n.findIndex((e) => e.time === t.time);
26092
26142
  if (r < 0) return !1;
26093
- if (DD.includes(e.condition)) return this.moveMet(e, n, r + 1);
26143
+ if (FD.includes(e.condition)) return this.moveMet(e, n, r + 1);
26094
26144
  let i = (e, t) => {
26095
26145
  let r = this.history.get(e) ?? [], i = n[t]?.time;
26096
26146
  return i === void 0 ? void 0 : r.find((e) => e.time === i)?.value;
@@ -26100,7 +26150,7 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26100
26150
  if (t === void 0) return !1;
26101
26151
  a -= t, o = o !== void 0 && n !== void 0 ? o - n : void 0, s = 0, e.price = t;
26102
26152
  }
26103
- return kD(o, a, s, e.condition);
26153
+ return LD(o, a, s, e.condition);
26104
26154
  }
26105
26155
  recordBar(e, t) {
26106
26156
  let n = this.barTime;
@@ -26160,11 +26210,11 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26160
26210
  if (!Array.isArray(n)) return;
26161
26211
  for (let e of n) {
26162
26212
  if (typeof e.drawingId == "string" && e.condition && !e.triggered) {
26163
- AD.includes(e.condition) && this.addDrawingAlert(e.drawingId, e.condition, e.message, e.repeating ?? !1, e.label);
26213
+ RD.includes(e.condition) && this.addDrawingAlert(e.drawingId, e.condition, e.message, e.repeating ?? !1, e.label);
26164
26214
  continue;
26165
26215
  }
26166
26216
  if (!e.condition || e.triggered || e.expired) continue;
26167
- let t = ID(e), n = !t.target && !DD.includes(e.condition), r = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : NaN;
26217
+ let t = WD(e), n = !t.target && !FD.includes(e.condition), r = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : NaN;
26168
26218
  if (!(n && Number.isNaN(r))) try {
26169
26219
  this.addAlert(r, e.condition, e.message, e.repeating ?? !1, e.channel ?? "price", e.label, t);
26170
26220
  } catch {}
@@ -26174,20 +26224,20 @@ var MD = 1, ND = 2 ** 31 - 1, PD = class extends Vw {
26174
26224
  render(e, t, n) {
26175
26225
  let { chartRect: r } = t;
26176
26226
  for (let i of this.alerts) {
26177
- if (!OD(i)) continue;
26227
+ if (!ID(i)) continue;
26178
26228
  let a = x(i.price, t);
26179
26229
  if (a < r.y || a > r.y + r.height) continue;
26180
26230
  let o = i.expired ? "#8a93a3" : i.triggered ? "#f2a93b" : "#4c8dff";
26181
26231
  e.setLineDash([2, 6]), e.strokeStyle = o, e.lineWidth = 1, e.beginPath(), ne(e, r.x, r.x + r.width, Math.round(a) + .5), e.stroke(), e.setLineDash([]), e.font = `10px ${n.font.family}`, e.fillStyle = o, e.textBaseline = "bottom", e.textAlign = "right";
26182
26232
  let s = `${nt(i.price, t, this.pricePrecision ?? void 0)}${i.message ? ` - ${i.message}` : ""}`, c = r.x + r.width - 4;
26183
26233
  e.fillText(s, c, a - 2);
26184
- let l = c - e.measureText(s).width - wD - CD;
26185
- l >= r.x && wC(e, Ae.bell, l, a - 2 - CD, CD, o);
26234
+ let l = c - e.measureText(s).width - MD - jD;
26235
+ l >= r.x && wC(e, Ae.bell, l, a - 2 - jD, jD, o);
26186
26236
  }
26187
26237
  }
26188
26238
  };
26189
- function FD(e, t, n) {
26190
- let r = {}, i = DD.includes(e);
26239
+ function UD(e, t, n) {
26240
+ let r = {}, i = FD.includes(e);
26191
26241
  if (n.target !== void 0) {
26192
26242
  if (i) throw RangeError("An alert on a move takes no other line");
26193
26243
  if (n.target === t) throw RangeError("An alert can’t compare a line with itself");
@@ -26201,20 +26251,20 @@ function FD(e, t, n) {
26201
26251
  }
26202
26252
  return n.onBarClose && (r.onBarClose = !0), n.expiresAt !== void 0 && Number.isFinite(n.expiresAt) && (r.expiresAt = n.expiresAt), r;
26203
26253
  }
26204
- function ID(e) {
26254
+ function WD(e) {
26205
26255
  let t = {};
26206
26256
  return typeof e.target == "string" && e.target && (t.target = e.target), typeof e.percent == "number" && Number.isFinite(e.percent) && (t.percent = e.percent), typeof e.bars == "number" && Number.isInteger(e.bars) && (t.bars = e.bars), e.onBarClose === !0 && (t.onBarClose = !0), typeof e.expiresAt == "number" && Number.isFinite(e.expiresAt) && (t.expiresAt = e.expiresAt), t;
26207
26257
  }
26208
26258
  //#endregion
26209
26259
  //#region src/features/ReplayManager.ts
26210
- var LD = 16, RD = 3 * LD, zD = 1e3 / 30, BD = 1e-9, VD = () => typeof requestAnimationFrame == "function" && !(typeof document < "u" && document.hidden), HD = {
26260
+ var GD = 16, KD = 3 * GD, qD = 1e3 / 30, JD = 1e-9, YD = () => typeof requestAnimationFrame == "function" && !(typeof document < "u" && document.hidden), XD = {
26211
26261
  now: () => typeof performance < "u" ? performance.now() : Date.now(),
26212
- frame: (e) => VD() ? { raf: requestAnimationFrame(e) } : { timeout: setTimeout(e, LD) },
26262
+ frame: (e) => YD() ? { raf: requestAnimationFrame(e) } : { timeout: setTimeout(e, GD) },
26213
26263
  cancel: (e) => {
26214
26264
  let t = e;
26215
26265
  t.raf !== void 0 && cancelAnimationFrame(t.raf), t.timeout !== void 0 && clearTimeout(t.timeout);
26216
26266
  }
26217
- }, UD = class extends Vw {
26267
+ }, ZD = class extends Yw {
26218
26268
  data = [];
26219
26269
  cursor = -1;
26220
26270
  timer = null;
@@ -26227,7 +26277,7 @@ var LD = 16, RD = 3 * LD, zD = 1e3 / 30, BD = 1e-9, VD = () => typeof requestAni
26227
26277
  };
26228
26278
  paceMs = null;
26229
26279
  owedMs = 0;
26230
- constructor(e = HD) {
26280
+ constructor(e = XD) {
26231
26281
  super(), this.clock = e;
26232
26282
  }
26233
26283
  load(e) {
@@ -26258,7 +26308,7 @@ var LD = 16, RD = 3 * LD, zD = 1e3 / 30, BD = 1e-9, VD = () => typeof requestAni
26258
26308
  this.setState("paused");
26259
26309
  return;
26260
26310
  }
26261
- this.setState("playing"), this.config.animate ? this.runForming(t) : t < LD || this.paceMs !== null ? this.runFrames(t) : this.timer = setInterval(() => this.advance(1), t);
26311
+ this.setState("playing"), this.config.animate ? this.runForming(t) : t < GD || this.paceMs !== null ? this.runFrames(t) : this.timer = setInterval(() => this.advance(1), t);
26262
26312
  }
26263
26313
  pause() {
26264
26314
  this.clearTimer(), this.setState("paused");
@@ -26334,7 +26384,7 @@ var LD = 16, RD = 3 * LD, zD = 1e3 / 30, BD = 1e-9, VD = () => typeof requestAni
26334
26384
  return this.paceMs ?? this.config.interval / this.config.speed;
26335
26385
  }
26336
26386
  runForming(e) {
26337
- let t = this.run, n = e >= RD, r = this.clock.now(), i = -Infinity, a = (r) => {
26387
+ let t = this.run, n = e >= KD, r = this.clock.now(), i = -Infinity, a = (r) => {
26338
26388
  !n || this.isAtEnd() || t !== this.run || this.state !== "playing" || (i = r, this.emit("phase", {
26339
26389
  index: this.cursor + 1,
26340
26390
  fraction: Math.min(1, this.owedMs / e)
@@ -26344,9 +26394,9 @@ var LD = 16, RD = 3 * LD, zD = 1e3 / 30, BD = 1e-9, VD = () => typeof requestAni
26344
26394
  this.frameHandle = null;
26345
26395
  let n = this.clock.now();
26346
26396
  this.owedMs += Math.min(50, Math.max(0, n - r)), r = n;
26347
- let s = Math.floor((this.owedMs + BD) / e);
26397
+ let s = Math.floor((this.owedMs + JD) / e);
26348
26398
  try {
26349
- s > 0 ? (this.owedMs = Math.max(0, this.owedMs - s * e), this.advance(s), a(n)) : n - i + LD / 2 >= zD && a(n);
26399
+ s > 0 ? (this.owedMs = Math.max(0, this.owedMs - s * e), this.advance(s), a(n)) : n - i + GD / 2 >= qD && a(n);
26350
26400
  } finally {
26351
26401
  t === this.run && this.state === "playing" && this.frameHandle === null && (this.frameHandle = this.clock.frame(o));
26352
26402
  }
@@ -26376,24 +26426,24 @@ var LD = 16, RD = 3 * LD, zD = 1e3 / 30, BD = 1e-9, VD = () => typeof requestAni
26376
26426
  setState(e) {
26377
26427
  this.state !== e && (this.state = e, this.emit("stateChange", e));
26378
26428
  }
26379
- }, WD = 64, GD = 3, KD = 3;
26380
- function qD(e) {
26429
+ }, QD = 64, $D = 3, eO = 3;
26430
+ function tO(e) {
26381
26431
  return typeof e == "object" && !!e && !Array.isArray(e);
26382
26432
  }
26383
- function JD(e) {
26433
+ function nO(e) {
26384
26434
  return Array.isArray(e) ? e : [];
26385
26435
  }
26386
- function YD(e, t) {
26436
+ function rO(e, t) {
26387
26437
  return typeof e == "string" ? e : t;
26388
26438
  }
26389
- function XD(e, t) {
26439
+ function iO(e, t) {
26390
26440
  return typeof e == "number" && Number.isFinite(e) ? e : t;
26391
26441
  }
26392
- function ZD(e) {
26393
- if (!qD(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || e.anchors.length > QD || !qD(e.style)) return null;
26442
+ function aO(e) {
26443
+ if (!tO(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || e.anchors.length > oO || !tO(e.style)) return null;
26394
26444
  let t = [];
26395
26445
  for (let n of e.anchors) {
26396
- if (!qD(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
26446
+ if (!tO(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
26397
26447
  t.push({
26398
26448
  time: n.time,
26399
26449
  price: n.price
@@ -26412,34 +26462,34 @@ function ZD(e) {
26412
26462
  },
26413
26463
  visible: typeof e.visible == "boolean" ? e.visible : !0,
26414
26464
  locked: typeof e.locked == "boolean" ? e.locked : !1,
26415
- options: qD(e.options) ? e.options : void 0,
26465
+ options: tO(e.options) ? e.options : void 0,
26416
26466
  intervals: Hs(e.intervals) ?? void 0,
26417
- group: nO(e.group),
26467
+ group: uO(e.group),
26418
26468
  ...fg(e.name) === void 0 ? {} : { name: fg(e.name) },
26419
- ...typeof e.paneId == "string" && e.paneId.length > 0 && e.paneId.length <= $D ? { paneId: e.paneId } : {},
26420
- meta: qD(e.meta) ? e.meta : void 0
26469
+ ...typeof e.paneId == "string" && e.paneId.length > 0 && e.paneId.length <= sO ? { paneId: e.paneId } : {},
26470
+ meta: tO(e.meta) ? e.meta : void 0
26421
26471
  };
26422
26472
  }
26423
- var QD = 5e3, $D = 200, eO = 64, tO = 80;
26424
- function nO(e) {
26425
- if (!(!qD(e) || typeof e.id != "string" || typeof e.name != "string") && !(e.id === "" || e.id.length > eO)) return {
26473
+ var oO = 5e3, sO = 200, cO = 64, lO = 80;
26474
+ function uO(e) {
26475
+ if (!(!tO(e) || typeof e.id != "string" || typeof e.name != "string") && !(e.id === "" || e.id.length > cO)) return {
26426
26476
  id: e.id,
26427
- name: e.name.slice(0, tO)
26477
+ name: e.name.slice(0, lO)
26428
26478
  };
26429
26479
  }
26430
- function rO(e) {
26431
- return !qD(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
26480
+ function dO(e) {
26481
+ return !tO(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
26432
26482
  }
26433
- function iO(e) {
26434
- if (!qD(e)) return;
26435
- let t = {}, n = JD(e.colors).filter((e) => typeof e == "string");
26483
+ function fO(e) {
26484
+ if (!tO(e)) return;
26485
+ let t = {}, n = nO(e.colors).filter((e) => typeof e == "string");
26436
26486
  n.length > 0 && (t.colors = n);
26437
- let r = JD(e.lineWidths).filter((e) => typeof e == "number" && Number.isFinite(e) && e > 0);
26487
+ let r = nO(e.lineWidths).filter((e) => typeof e == "number" && Number.isFinite(e) && e > 0);
26438
26488
  r.length > 0 && (t.lineWidths = r), typeof e.opacity == "number" && Number.isFinite(e.opacity) && (t.opacity = Math.min(1, Math.max(0, e.opacity)));
26439
26489
  let i = st(e.plots);
26440
26490
  return i && (t.plots = i), Object.keys(t).length > 0 ? t : void 0;
26441
26491
  }
26442
- var aO = [
26492
+ var pO = [
26443
26493
  "crossingUp",
26444
26494
  "crossingDown",
26445
26495
  "crossing",
@@ -26448,9 +26498,9 @@ var aO = [
26448
26498
  "movesUp",
26449
26499
  "movesDown"
26450
26500
  ];
26451
- function oO(e) {
26452
- if (!qD(e) || typeof e.id != "string") return null;
26453
- let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r = aO.find((t) => t === e.condition) ?? "crossing", i = ID(e), a = i.target !== void 0 || r === "movesUp" || r === "movesDown";
26501
+ function mO(e) {
26502
+ if (!tO(e) || typeof e.id != "string") return null;
26503
+ let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r = pO.find((t) => t === e.condition) ?? "crossing", i = WD(e), a = i.target !== void 0 || r === "movesUp" || r === "movesDown";
26454
26504
  return n === null && !t && !a ? null : {
26455
26505
  id: e.id,
26456
26506
  price: n ?? NaN,
@@ -26459,44 +26509,44 @@ function oO(e) {
26459
26509
  message: typeof e.message == "string" ? e.message : void 0,
26460
26510
  triggered: e.triggered === !0,
26461
26511
  repeating: e.repeating === !0,
26462
- channel: YD(e.channel, "price"),
26512
+ channel: rO(e.channel, "price"),
26463
26513
  label: typeof e.label == "string" ? e.label : void 0,
26464
26514
  ...i,
26465
26515
  ...e.expired === !0 ? { expired: !0 } : {}
26466
26516
  };
26467
26517
  }
26468
- function sO(e) {
26469
- return !qD(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
26518
+ function hO(e) {
26519
+ return !tO(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
26470
26520
  }
26471
- var cO = 4e3;
26472
- function lO(e) {
26473
- if (!qD(e)) return;
26521
+ var gO = 4e3;
26522
+ function _O(e) {
26523
+ if (!tO(e)) return;
26474
26524
  let t = {}, n = [];
26475
26525
  for (let [r, i] of Object.entries(e)) {
26476
26526
  let e = at(i);
26477
26527
  n.push(...e.rejected);
26478
26528
  let a = Object.fromEntries(Object.entries(e.overrides).filter(([, e]) => e !== null));
26479
- Object.keys(a).length > 0 && (t[r.slice(0, WD)] = a);
26529
+ Object.keys(a).length > 0 && (t[r.slice(0, QD)] = a);
26480
26530
  }
26481
26531
  return n.length > 0 && console.warn(`Saved style overrides left out: ${[...new Set(n)].join(", ")}`), t;
26482
26532
  }
26483
- function uO(e) {
26484
- if (!qD(e)) return dO();
26485
- typeof e.version == "number" && e.version > KD && console.warn(`Chart state from a newer version (${e.version}); loading what this version understands.`);
26486
- let t = qD(e.viewport) ? e.viewport : {}, n = [];
26487
- for (let t of JD(e.indicators)) qD(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || qD(t.params) && n.push({
26533
+ function vO(e) {
26534
+ if (!tO(e)) return yO();
26535
+ typeof e.version == "number" && e.version > eO && console.warn(`Chart state from a newer version (${e.version}); loading what this version understands.`);
26536
+ let t = tO(e.viewport) ? e.viewport : {}, n = [];
26537
+ for (let t of nO(e.indicators)) tO(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || tO(t.params) && n.push({
26488
26538
  id: t.id,
26489
26539
  instanceId: t.instanceId,
26490
26540
  params: t.params,
26491
26541
  position: typeof t.position == "string" ? t.position : void 0,
26492
- style: iO(t.style),
26542
+ style: fO(t.style),
26493
26543
  visible: typeof t.visible == "boolean" ? t.visible : void 0,
26494
26544
  levels: Array.isArray(t.levels) ? t.levels.filter((e) => typeof e == "number" && Number.isFinite(e)) : void 0,
26495
26545
  pane: typeof t.pane == "string" ? t.pane : void 0,
26496
26546
  scale: t.scale === "left" ? "left" : void 0,
26497
26547
  intervals: Hs(t.intervals) ?? void 0,
26498
26548
  paneStyle: ct(t.paneStyle) ?? void 0,
26499
- paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize, cO) : void 0,
26549
+ paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize, gO) : void 0,
26500
26550
  paneOrder: typeof t.paneOrder == "number" && Number.isInteger(t.paneOrder) && t.paneOrder >= 0 ? t.paneOrder : void 0,
26501
26551
  paneCollapsed: t.paneCollapsed === !0 ? !0 : void 0,
26502
26552
  paneMaximized: t.paneMaximized === !0 ? !0 : void 0,
@@ -26505,37 +26555,37 @@ function uO(e) {
26505
26555
  panePercent: t.panePercent === !0 ? !0 : void 0
26506
26556
  }));
26507
26557
  let r = [];
26508
- for (let t of JD(e.drawings)) {
26509
- let e = ZD(t);
26558
+ for (let t of nO(e.drawings)) {
26559
+ let e = aO(t);
26510
26560
  e && r.push(e);
26511
26561
  }
26512
26562
  let i = [];
26513
- for (let t of JD(e.orders)) {
26514
- let e = rO(t);
26563
+ for (let t of nO(e.orders)) {
26564
+ let e = dO(t);
26515
26565
  e && i.push(e);
26516
26566
  }
26517
26567
  let a = [];
26518
- for (let t of JD(e.positions)) {
26519
- let e = sO(t);
26568
+ for (let t of nO(e.positions)) {
26569
+ let e = hO(t);
26520
26570
  e && a.push(e);
26521
26571
  }
26522
26572
  let o = [];
26523
- for (let t of JD(e.alerts)) {
26524
- let e = oO(t);
26573
+ for (let t of nO(e.alerts)) {
26574
+ let e = mO(t);
26525
26575
  e && o.push(e);
26526
26576
  }
26527
- let s = lO(e.overrides);
26577
+ let s = _O(e.overrides);
26528
26578
  return {
26529
26579
  version: typeof e.version == "number" && Array.isArray(e.indicators) ? e.version : 1,
26530
- timestamp: XD(e.timestamp, Date.now()),
26580
+ timestamp: iO(e.timestamp, Date.now()),
26531
26581
  symbol: typeof e.symbol == "string" ? e.symbol : void 0,
26532
26582
  timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
26533
- chartType: YD(e.chartType, "candlestick"),
26583
+ chartType: rO(e.chartType, "candlestick"),
26534
26584
  ...e.chartTypeOptions === void 0 ? {} : { chartTypeOptions: ot(e.chartTypeOptions) },
26535
26585
  viewport: {
26536
- barWidth: XD(t.barWidth, 8),
26537
- barSpacing: XD(t.barSpacing, 2),
26538
- offset: XD(t.offset, 0)
26586
+ barWidth: iO(t.barWidth, 8),
26587
+ barSpacing: iO(t.barSpacing, 2),
26588
+ offset: iO(t.offset, 0)
26539
26589
  },
26540
26590
  theme: typeof e.theme == "string" ? e.theme : void 0,
26541
26591
  ...s ? { overrides: s } : {},
@@ -26547,7 +26597,7 @@ function uO(e) {
26547
26597
  alerts: o
26548
26598
  };
26549
26599
  }
26550
- function dO() {
26600
+ function yO() {
26551
26601
  return {
26552
26602
  version: 1,
26553
26603
  timestamp: Date.now(),
@@ -26564,10 +26614,10 @@ function dO() {
26564
26614
  alerts: []
26565
26615
  };
26566
26616
  }
26567
- var fO = class {
26617
+ var bO = class {
26568
26618
  static capture(e, t) {
26569
26619
  return {
26570
- version: e.getIndicators ? KD : 1,
26620
+ version: e.getIndicators ? eO : 1,
26571
26621
  timestamp: Date.now(),
26572
26622
  chartType: t?.chartType ?? "candlestick",
26573
26623
  ...t?.chartTypeOptions && Object.keys(t.chartTypeOptions).length > 0 ? { chartTypeOptions: t.chartTypeOptions } : {},
@@ -26591,7 +26641,7 @@ var fO = class {
26591
26641
  return JSON.stringify(e);
26592
26642
  }
26593
26643
  static deserialize(e) {
26594
- return uO(JSON.parse(e));
26644
+ return vO(JSON.parse(e));
26595
26645
  }
26596
26646
  static saveToStorage(e, t) {
26597
26647
  localStorage.setItem(e, this.serialize(t));
@@ -26618,7 +26668,7 @@ var fO = class {
26618
26668
  }, n.click();
26619
26669
  });
26620
26670
  }
26621
- }, pO = class {
26671
+ }, xO = class {
26622
26672
  undoStack = [];
26623
26673
  redoStack = [];
26624
26674
  maxHistory = 50;
@@ -26695,7 +26745,7 @@ var fO = class {
26695
26745
  redoCount: this.redoStack.length
26696
26746
  };
26697
26747
  }
26698
- }, mO = [
26748
+ }, SO = [
26699
26749
  "Time",
26700
26750
  "Open",
26701
26751
  "High",
@@ -26703,47 +26753,47 @@ var fO = class {
26703
26753
  "Close",
26704
26754
  "Volume"
26705
26755
  ];
26706
- function hO(e, t) {
26756
+ function CO(e, t) {
26707
26757
  return new Date(M(e, t)).toISOString();
26708
26758
  }
26709
- function gO(e) {
26759
+ function wO(e) {
26710
26760
  let t = /^[=+\-@\t\r]/.test(e) && !/^-?\d/.test(e) ? `'${e}` : e;
26711
26761
  return /[",\r\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
26712
26762
  }
26713
- var _O = 15, vO = 0x38d7ea4c68000;
26714
- function yO(e) {
26715
- return e == null || !Number.isFinite(e) ? null : Number.isInteger(e) || Math.abs(e) >= vO ? e : Number(e.toPrecision(_O));
26763
+ var TO = 15, EO = 0x38d7ea4c68000;
26764
+ function DO(e) {
26765
+ return e == null || !Number.isFinite(e) ? null : Number.isInteger(e) || Math.abs(e) >= EO ? e : Number(e.toPrecision(TO));
26716
26766
  }
26717
- var bO = (e) => {
26718
- let t = yO(e);
26767
+ var OO = (e) => {
26768
+ let t = DO(e);
26719
26769
  return t === null ? "" : String(t);
26720
- }, xO = class {
26770
+ }, kO = class {
26721
26771
  static toCSV(e, t = []) {
26722
- let n = [...mO, ...t.map((e) => gO(e.name))].join(","), r = A(e);
26772
+ let n = [...SO, ...t.map((e) => wO(e.name))].join(","), r = A(e);
26723
26773
  return [n, ...e.map((e, n) => [
26724
- hO(e.time, r),
26774
+ CO(e.time, r),
26725
26775
  ...[
26726
26776
  e.open,
26727
26777
  e.high,
26728
26778
  e.low,
26729
26779
  e.close,
26730
26780
  e.volume
26731
- ].map(bO),
26732
- ...t.map((e) => bO(e.values[n]))
26781
+ ].map(OO),
26782
+ ...t.map((e) => OO(e.values[n]))
26733
26783
  ].join(","))].join("\n");
26734
26784
  }
26735
26785
  static toJSON(e, t = []) {
26736
26786
  let n = A(e);
26737
26787
  return JSON.stringify(e.map((e, r) => {
26738
26788
  let i = {
26739
- time: hO(e.time, n),
26740
- open: yO(e.open),
26741
- high: yO(e.high),
26742
- low: yO(e.low),
26743
- close: yO(e.close),
26744
- volume: yO(e.volume)
26789
+ time: CO(e.time, n),
26790
+ open: DO(e.open),
26791
+ high: DO(e.high),
26792
+ low: DO(e.low),
26793
+ close: DO(e.close),
26794
+ volume: DO(e.volume)
26745
26795
  };
26746
- for (let e of t) i[e.name] = yO(e.values[r]);
26796
+ for (let e of t) i[e.name] = DO(e.values[r]);
26747
26797
  return i;
26748
26798
  }), null, 2);
26749
26799
  }
@@ -26754,10 +26804,10 @@ var bO = (e) => {
26754
26804
  };
26755
26805
  //#endregion
26756
26806
  //#region src/features/replayReveal.ts
26757
- function SO(e, t, n = -Infinity) {
26807
+ function AO(e, t, n = -Infinity) {
26758
26808
  return t === null ? e : e.filter((e) => e.time >= n && e.time < t);
26759
26809
  }
26760
- function CO(e, t, n = -Infinity) {
26810
+ function jO(e, t, n = -Infinity) {
26761
26811
  return t === null ? e : e.filter((e) => e.entryTime >= n && e.entryTime < t).map((e) => {
26762
26812
  if (e.exitTime === void 0 || e.exitTime < t) return e;
26763
26813
  let { exitTime: n, exitPrice: r, pnl: i, pnlPercent: a, ...o } = e;
@@ -26766,7 +26816,7 @@ function CO(e, t, n = -Infinity) {
26766
26816
  }
26767
26817
  //#endregion
26768
26818
  //#region src/features/SignalMarkerManager.ts
26769
- var wO = 1, TO = 3, EO = class extends Vw {
26819
+ var MO = 1, NO = 3, PO = class extends Yw {
26770
26820
  markers = [];
26771
26821
  style = { ...de };
26772
26822
  requestRender = null;
@@ -26789,7 +26839,7 @@ var wO = 1, TO = 3, EO = class extends Vw {
26789
26839
  return { ...this.style };
26790
26840
  }
26791
26841
  addMarker(e) {
26792
- let t = e.id ?? `tc_signal_${wO++}`, n = {
26842
+ let t = e.id ?? `tc_signal_${MO++}`, n = {
26793
26843
  ...e,
26794
26844
  id: t
26795
26845
  };
@@ -26811,24 +26861,24 @@ var wO = 1, TO = 3, EO = class extends Vw {
26811
26861
  e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
26812
26862
  }
26813
26863
  shownMarkers() {
26814
- return [...SO(this.markers, this.revealUntil, this.revealFrom)];
26864
+ return [...AO(this.markers, this.revealUntil, this.revealFrom)];
26815
26865
  }
26816
26866
  markerAt(e, t) {
26817
26867
  let n = this.dataGetter?.();
26818
26868
  if (!n || n.length === 0) return null;
26819
26869
  let { chartRect: r } = t;
26820
26870
  if (e.x < r.x || e.x > r.x + r.width || e.y < r.y || e.y > r.y + r.height) return null;
26821
- let i = this.style.arrowSize ?? 12, a = SO(this.markers, this.revealUntil, this.revealFrom);
26871
+ let i = this.style.arrowSize ?? 12, a = AO(this.markers, this.revealUntil, this.revealFrom);
26822
26872
  for (let r = a.length - 1; r >= 0; r--) {
26823
26873
  let o = a[r], c = O(s(o.time, n), t), l = x(o.price, t), u = i * Math.max(.6, Math.min(1, o.confidence)), d = o.direction === "long" ? l - u : (o.direction, l - u * .4), f = o.direction === "long" ? l + u * .4 : o.direction === "short" ? l + u : l + u * .4;
26824
- if (Math.abs(e.x - c) <= u * .6 + TO && e.y >= d - TO && e.y <= f + TO) return o;
26874
+ if (Math.abs(e.x - c) <= u * .6 + NO && e.y >= d - NO && e.y <= f + NO) return o;
26825
26875
  }
26826
26876
  return null;
26827
26877
  }
26828
26878
  render(e, t, n) {
26829
- let r = this.dataGetter?.(), i = SO(this.markers, this.revealUntil, this.revealFrom);
26879
+ let r = this.dataGetter?.(), i = AO(this.markers, this.revealUntil, this.revealFrom);
26830
26880
  if (!r || r.length === 0 || i.length === 0) return;
26831
- let { chartRect: a } = t, o = Mw(this.style, n), c = o.arrowSize ?? 12;
26881
+ let { chartRect: a } = t, o = jw(this.style, n), c = o.arrowSize ?? 12;
26832
26882
  e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip();
26833
26883
  for (let l of i) {
26834
26884
  let i = O(s(l.time, r), t), u = x(l.price, t);
@@ -26859,18 +26909,18 @@ var wO = 1, TO = 3, EO = class extends Vw {
26859
26909
  renderArrow(e, t, n, r, i, a) {
26860
26910
  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();
26861
26911
  }
26862
- }, DO = 18, OO = 4, kO = 2, AO = 6, jO = 18 + 2 * OO, MO = 3, NO = 300, PO = 10, FO = 8, IO = 8, LO = 1.35, RO = 6, zO = {
26912
+ }, FO = 18, IO = 4, LO = 2, RO = 6, zO = 18 + 2 * IO, BO = 3, VO = 300, HO = 10, UO = 8, WO = 8, GO = 1.35, KO = 6, qO = {
26863
26913
  news: "N",
26864
26914
  earnings: "E",
26865
26915
  dividend: "D",
26866
26916
  split: "S",
26867
26917
  event: "i"
26868
- }, BO = {
26918
+ }, JO = {
26869
26919
  news: "#4c8dff",
26870
26920
  earnings: "#f2a93b",
26871
26921
  dividend: "#4fae8a",
26872
26922
  split: "#a78bfa"
26873
- }, VO = 1, HO = class {
26923
+ }, YO = 1, XO = class {
26874
26924
  marks = [];
26875
26925
  requestRender = null;
26876
26926
  dataGetter = null;
@@ -26890,7 +26940,7 @@ var wO = 1, TO = 3, EO = class extends Vw {
26890
26940
  addMark(e) {
26891
26941
  let [t] = it([{
26892
26942
  ...e,
26893
- id: e.id ?? `tc_mark_${VO++}`
26943
+ id: e.id ?? `tc_mark_${YO++}`
26894
26944
  }]);
26895
26945
  if (!t) return null;
26896
26946
  let n = this.marks.filter((e) => e.id !== t.id);
@@ -26924,7 +26974,7 @@ var wO = 1, TO = 3, EO = class extends Vw {
26924
26974
  badges(e) {
26925
26975
  let t = this.dataGetter?.();
26926
26976
  if (!t || t.length === 0 || this.marks.length === 0) return [];
26927
- let { chartRect: n } = e, r = n.y + n.height - 18 / 2 - OO, i = [];
26977
+ let { chartRect: n } = e, r = n.y + n.height - 18 / 2 - IO, i = [];
26928
26978
  for (let a of this.marks) {
26929
26979
  if (this.revealUntil !== null && (a.time < this.revealFrom || a.time >= this.revealUntil)) continue;
26930
26980
  let o = s(a.time, t);
@@ -26932,7 +26982,7 @@ var wO = 1, TO = 3, EO = class extends Vw {
26932
26982
  let c = O(Math.floor(o), e);
26933
26983
  if (c < n.x || c > n.x + n.width) continue;
26934
26984
  let l = i[i.length - 1];
26935
- l && c - l.x < 18 + kO ? l.marks.push(a) : i.push({
26985
+ l && c - l.x < 18 + LO ? l.marks.push(a) : i.push({
26936
26986
  x: c,
26937
26987
  y: r,
26938
26988
  marks: [a]
@@ -26943,7 +26993,7 @@ var wO = 1, TO = 3, EO = class extends Vw {
26943
26993
  badgeAt(e, t) {
26944
26994
  let { chartRect: n } = t;
26945
26995
  if (e.x < n.x || e.x > n.x + n.width || e.y < n.y || e.y > n.y + n.height) return null;
26946
- let r = 18 / 2 + AO, i = null, a = Infinity;
26996
+ let r = 18 / 2 + RO, i = null, a = Infinity;
26947
26997
  for (let n of this.badges(t)) {
26948
26998
  let t = Math.abs(e.x - n.x), o = Math.abs(e.y - n.y);
26949
26999
  t > r || o > r || t >= a || (a = t, i = n);
@@ -26966,51 +27016,51 @@ var wO = 1, TO = 3, EO = class extends Vw {
26966
27016
  colorOf(e, t) {
26967
27017
  if (e.color) return e.color;
26968
27018
  let n = e.kind ?? "event";
26969
- return n === "event" ? t.textSecondary : BO[n];
27019
+ return n === "event" ? t.textSecondary : JO[n];
26970
27020
  }
26971
27021
  renderBadge(e, t, n, r) {
26972
27022
  let i = t.marks[0], a = this.colorOf(i, n);
26973
27023
  e.fillStyle = n.background, e.beginPath(), e.arc(t.x, t.y, 9 + (r ? 3 : 1.5), 0, Math.PI * 2), e.fill(), r && (e.fillStyle = a, e.globalAlpha = .35, e.beginPath(), e.arc(t.x, t.y, 12, 0, Math.PI * 2), e.fill(), e.globalAlpha = 1), e.fillStyle = a, e.beginPath(), e.arc(t.x, t.y, 9, 0, Math.PI * 2), e.fill();
26974
- let o = t.marks.length > 1 ? String(t.marks.length) : i.label ?? zO[i.kind ?? "event"];
27024
+ let o = t.marks.length > 1 ? String(t.marks.length) : i.label ?? qO[i.kind ?? "event"];
26975
27025
  e.fillStyle = pn(a), e.font = `600 ${o.length > 1 ? 10 : 11}px ${n.font.family}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(o, t.x, t.y + .5);
26976
27026
  }
26977
27027
  renderTooltip(e, t, n, r) {
26978
- let { chartRect: i } = n, a = r.font.sizeMedium, o = r.font.sizeSmall, s = `600 ${a}px ${r.font.family}`, c = `${o}px ${r.font.family}`, l = Math.min(NO, i.width - 2 * OO), u = l - 2 * PO;
27028
+ let { chartRect: i } = n, a = r.font.sizeMedium, o = r.font.sizeSmall, s = `600 ${a}px ${r.font.family}`, c = `${o}px ${r.font.family}`, l = Math.min(VO, i.width - 2 * IO), u = l - 2 * HO;
26979
27029
  if (u <= 0) return;
26980
- let d = [...t.marks].reverse().slice(0, MO), f = t.marks.length - d.length, p = [];
27030
+ let d = [...t.marks].reverse().slice(0, BO), f = t.marks.length - d.length, p = [];
26981
27031
  d.forEach((t, n) => {
26982
27032
  p.push({
26983
- text: UO(e, t.title, s, u),
27033
+ text: ZO(e, t.title, s, u),
26984
27034
  font: s,
26985
27035
  color: r.text,
26986
- height: a * LO,
26987
- gap: n === 0 ? 0 : IO
27036
+ height: a * GO,
27037
+ gap: n === 0 ? 0 : WO
26988
27038
  }), t.text && p.push({
26989
- text: UO(e, t.text, c, u),
27039
+ text: ZO(e, t.text, c, u),
26990
27040
  font: c,
26991
27041
  color: r.textSecondary,
26992
- height: o * LO,
27042
+ height: o * GO,
26993
27043
  gap: 0
26994
27044
  });
26995
27045
  }), f > 0 && p.push({
26996
27046
  text: `+${f}`,
26997
27047
  font: c,
26998
27048
  color: r.textSecondary,
26999
- height: o * LO,
27000
- gap: IO
27049
+ height: o * GO,
27050
+ gap: WO
27001
27051
  });
27002
- let m = p.reduce((e, t) => e + t.gap + t.height, 0) + 2 * PO, h = Math.max(i.x + OO, Math.min(i.x + i.width - OO - l, t.x - l / 2)), g = Math.max(i.y + OO, t.y - 18 / 2 - FO - m);
27052
+ let m = p.reduce((e, t) => e + t.gap + t.height, 0) + 2 * HO, h = Math.max(i.x + IO, Math.min(i.x + i.width - IO - l, t.x - l / 2)), g = Math.max(i.y + IO, t.y - 18 / 2 - UO - m);
27003
27053
  this.tooltip = {
27004
27054
  x: h,
27005
27055
  y: g,
27006
27056
  width: l,
27007
27057
  height: m
27008
- }, e.fillStyle = r.axisLabelBackground, e.strokeStyle = r.axisLine, e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(Math.round(h) + .5, Math.round(g) + .5, l, m, RO) : e.rect(Math.round(h) + .5, Math.round(g) + .5, l, m), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "top";
27009
- let _ = g + PO;
27010
- for (let t of p) _ += t.gap, e.font = t.font, e.fillStyle = t.color, e.fillText(t.text, h + PO, _), _ += t.height;
27058
+ }, e.fillStyle = r.axisLabelBackground, e.strokeStyle = r.axisLine, e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(Math.round(h) + .5, Math.round(g) + .5, l, m, KO) : e.rect(Math.round(h) + .5, Math.round(g) + .5, l, m), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "top";
27059
+ let _ = g + HO;
27060
+ for (let t of p) _ += t.gap, e.font = t.font, e.fillStyle = t.color, e.fillText(t.text, h + HO, _), _ += t.height;
27011
27061
  }
27012
27062
  };
27013
- function UO(e, t, n, r) {
27063
+ function ZO(e, t, n, r) {
27014
27064
  if (e.font = n, e.measureText(t).width <= r) return t;
27015
27065
  let i = [...t], a = 0, o = i.length;
27016
27066
  for (; a < o;) {
@@ -27021,7 +27071,7 @@ function UO(e, t, n, r) {
27021
27071
  }
27022
27072
  //#endregion
27023
27073
  //#region src/features/TradeZoneManager.ts
27024
- var WO = 12, GO = 2, KO = 1, qO = class extends Vw {
27074
+ var QO = 12, $O = 2, ek = 1, tk = class extends Yw {
27025
27075
  zones = [];
27026
27076
  style = { ...pe };
27027
27077
  requestRender = null;
@@ -27048,7 +27098,7 @@ var WO = 12, GO = 2, KO = 1, qO = class extends Vw {
27048
27098
  return { ...this.style };
27049
27099
  }
27050
27100
  addZone(e) {
27051
- let t = e.id ?? `tc_zone_${KO++}`, n = {
27101
+ let t = e.id ?? `tc_zone_${ek++}`, n = {
27052
27102
  ...e,
27053
27103
  id: t
27054
27104
  };
@@ -27077,12 +27127,12 @@ var WO = 12, GO = 2, KO = 1, qO = class extends Vw {
27077
27127
  e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
27078
27128
  }
27079
27129
  shownZones() {
27080
- return [...CO(this.zones, this.revealUntil, this.revealFrom)];
27130
+ return [...jO(this.zones, this.revealUntil, this.revealFrom)];
27081
27131
  }
27082
27132
  render(e, t, n) {
27083
- let r = this.dataGetter?.(), i = CO(this.zones, this.revealUntil, this.revealFrom);
27133
+ let r = this.dataGetter?.(), i = jO(this.zones, this.revealUntil, this.revealFrom);
27084
27134
  if (!r || r.length === 0 || i.length === 0) return;
27085
- let { chartRect: a } = t, o = Nw(this.style, n);
27135
+ let { chartRect: a } = t, o = Mw(this.style, n);
27086
27136
  e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip();
27087
27137
  for (let a of i) this.renderZone(e, a, r, t, n, o);
27088
27138
  e.restore();
@@ -27093,15 +27143,15 @@ var WO = 12, GO = 2, KO = 1, qO = class extends Vw {
27093
27143
  let m = x(t.entryPrice, r), h = t.exitPrice == null ? x(t.entryPrice, r) : x(t.exitPrice, r), g = Math.min(m, h), _ = Math.max(Math.max(m, h) - g, 2), v = t.exitTime == null, y = t.pnl == null ? t.direction === "long" ? (t.exitPrice ?? t.entryPrice) >= t.entryPrice : (t.exitPrice ?? t.entryPrice) <= t.entryPrice : t.pnl >= 0, b = v ? a.activeColor ?? "#4c8dff" : y ? a.profitColor ?? "#1fa874" : a.lossColor ?? "#e8505b";
27094
27144
  e.fillStyle = b, e.globalAlpha = a.fillOpacity ?? .12, e.fillRect(f, g, p - f, _), e.globalAlpha = 1;
27095
27145
  let S = a.borderWidth ?? 1;
27096
- if (e.strokeStyle = b, e.lineWidth = S, e.setLineDash([]), e.beginPath(), e.moveTo(f, Math.round(m) + .5), e.lineTo(p, Math.round(m) + .5), e.stroke(), !v && t.exitPrice != null && (e.setLineDash([3, 3]), e.beginPath(), e.moveTo(f, Math.round(h) + .5), e.lineTo(p, Math.round(h) + .5), e.stroke(), e.setLineDash([])), wC(e, t.direction === "long" ? Ae.trendingUp : Ae.trendingDown, f + 4, m - 3 - WO, WO, b), e.font = `bold 10px ${i.font.family}`, e.fillStyle = b, e.textBaseline = "bottom", e.textAlign = "left", e.fillText(nt(t.entryPrice, r, this.pricePrecision ?? void 0), f + 4 + WO + 3, m - 3), a.showPnl && !v && t.pnl != null) {
27097
- let n = t.pnl >= 0 ? "+" : "", a = (e) => j(e, GO, r.numberLocale ?? "en-US"), o = t.pnlPercent == null ? `${n}${a(t.pnl)}` : `${n}${a(t.pnl)} (${n}${a(t.pnlPercent)}%)`;
27146
+ if (e.strokeStyle = b, e.lineWidth = S, e.setLineDash([]), e.beginPath(), e.moveTo(f, Math.round(m) + .5), e.lineTo(p, Math.round(m) + .5), e.stroke(), !v && t.exitPrice != null && (e.setLineDash([3, 3]), e.beginPath(), e.moveTo(f, Math.round(h) + .5), e.lineTo(p, Math.round(h) + .5), e.stroke(), e.setLineDash([])), wC(e, t.direction === "long" ? Ae.trendingUp : Ae.trendingDown, f + 4, m - 3 - QO, QO, b), e.font = `bold 10px ${i.font.family}`, e.fillStyle = b, e.textBaseline = "bottom", e.textAlign = "left", e.fillText(nt(t.entryPrice, r, this.pricePrecision ?? void 0), f + 4 + QO + 3, m - 3), a.showPnl && !v && t.pnl != null) {
27147
+ let n = t.pnl >= 0 ? "+" : "", a = (e) => j(e, $O, r.numberLocale ?? "en-US"), o = t.pnlPercent == null ? `${n}${a(t.pnl)}` : `${n}${a(t.pnl)} (${n}${a(t.pnlPercent)}%)`;
27098
27148
  e.font = `bold 10px ${i.font.family}`, e.fillStyle = b, e.textBaseline = "top", e.textAlign = "right";
27099
27149
  let s = e.measureText(o).width + 8, c = p - s - 2, l = g + 2;
27100
27150
  e.globalAlpha = .85, e.fillStyle = i.background, ln(e, c, l, s, 14, i), e.globalAlpha = 1, e.fillStyle = b, e.fillText(o, p - 4, l + 1);
27101
27151
  }
27102
27152
  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);
27103
27153
  }
27104
- }, JO = 2, YO = 4, XO = Ce, ZO = class {
27154
+ }, nk = 2, rk = 4, ik = Ce, ak = class {
27105
27155
  active = !1;
27106
27156
  startBar = 0;
27107
27157
  startPrice = 0;
@@ -27114,36 +27164,36 @@ var WO = 12, GO = 2, KO = 1, qO = class extends Vw {
27114
27164
  }
27115
27165
  begin(e, t, n) {
27116
27166
  let r = Math.round(l(e.x, t)), i = a(e.y, t);
27117
- this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = QO(r, n), this.endTime = this.startTime, this.active = !0;
27167
+ this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = ok(r, n), this.endTime = this.startTime, this.active = !0;
27118
27168
  }
27119
27169
  update(e, t, n) {
27120
27170
  if (!this.active) return;
27121
27171
  let r = Math.round(l(e.x, t));
27122
- this.endBar = r, this.endPrice = a(e.y, t), this.endTime = QO(r, n);
27172
+ this.endBar = r, this.endPrice = a(e.y, t), this.endTime = ok(r, n);
27123
27173
  }
27124
27174
  end() {
27125
27175
  this.active = !1;
27126
27176
  }
27127
27177
  render(e, t, n) {
27128
27178
  if (!this.active) return;
27129
- let r = O(this.startBar, t), i = O(this.endBar, t), a = x(this.startPrice, t), o = x(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), l = Math.min(a, o), u = Math.max(a, o), d = c - s, f = u - l, p = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, m = ak(p, .14);
27179
+ let r = O(this.startBar, t), i = O(this.endBar, t), a = x(this.startPrice, t), o = x(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), l = Math.min(a, o), u = Math.max(a, o), d = c - s, f = u - l, p = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, m = pk(p, .14);
27130
27180
  e.save();
27131
27181
  let { chartRect: h } = t;
27132
- e.beginPath(), e.rect(h.x, h.y, h.width, h.height), e.clip(), e.fillStyle = m, e.fillRect(s, l, d, f), e.strokeStyle = p, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, l + .5, d, f), e.setLineDash([]), e.strokeStyle = p, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), nk(e, r, a, p), nk(e, i, o, p), e.restore();
27133
- let g = Math.abs(this.endBar - this.startBar), _ = this.endPrice - this.startPrice, v = this.startPrice === 0 ? 0 : _ / this.startPrice * 100, y = this.startTime !== null && this.endTime !== null ? tk(Math.abs(this.endTime - this.startTime)) : null, b = [], S = _ > 0 ? "+" : _ < 0 ? "−" : "", C = Math.abs(_), w = j(Math.abs(v), JO, t.numberLocale ?? "en-US");
27134
- b.push(`${S}${$O(C, t)} (${S}${w}%)`), b.push(`${g} bars${y ? " · " + y : ""}`), e.save(), rk(e, i, o, b, p, n), e.restore();
27182
+ e.beginPath(), e.rect(h.x, h.y, h.width, h.height), e.clip(), e.fillStyle = m, e.fillRect(s, l, d, f), e.strokeStyle = p, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, l + .5, d, f), e.setLineDash([]), e.strokeStyle = p, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), uk(e, r, a, p), uk(e, i, o, p), e.restore();
27183
+ let g = Math.abs(this.endBar - this.startBar), _ = this.endPrice - this.startPrice, v = this.startPrice === 0 ? 0 : _ / this.startPrice * 100, y = this.startTime !== null && this.endTime !== null ? lk(Math.abs(this.endTime - this.startTime)) : null, b = [], S = _ > 0 ? "+" : _ < 0 ? "−" : "", C = Math.abs(_), w = j(Math.abs(v), nk, t.numberLocale ?? "en-US");
27184
+ b.push(`${S}${sk(C, t)} (${S}${w}%)`), b.push(`${g} bars${y ? " · " + y : ""}`), e.save(), dk(e, i, o, b, p, n), e.restore();
27135
27185
  }
27136
27186
  };
27137
- function QO(e, t) {
27187
+ function ok(e, t) {
27138
27188
  return e < 0 || e >= t.length ? null : t[e].time * A(t);
27139
27189
  }
27140
- function $O(e, t) {
27141
- return nt(e, t, t.pricePrecision ?? ek(e));
27190
+ function sk(e, t) {
27191
+ return nt(e, t, t.pricePrecision ?? ck(e));
27142
27192
  }
27143
- function ek(e) {
27144
- return e >= 1e3 ? 2 : e >= 1 ? 4 : e <= 0 ? YO - 1 : Math.min(XO, YO - 1 - Math.floor(Math.log10(e)));
27193
+ function ck(e) {
27194
+ return e >= 1e3 ? 2 : e >= 1 ? 4 : e <= 0 ? rk - 1 : Math.min(ik, rk - 1 - Math.floor(Math.log10(e)));
27145
27195
  }
27146
- function tk(e) {
27196
+ function lk(e) {
27147
27197
  let t = e / 1e3;
27148
27198
  if (t < 60) return `${t.toFixed(0)}s`;
27149
27199
  let n = t / 60;
@@ -27155,10 +27205,10 @@ function tk(e) {
27155
27205
  let a = i / 30;
27156
27206
  return a < 12 ? `${a.toFixed(1)}mo` : `${(i / 365).toFixed(1)}y`;
27157
27207
  }
27158
- function nk(e, t, n, r) {
27208
+ function uk(e, t, n, r) {
27159
27209
  e.fillStyle = r, e.beginPath(), e.arc(t, n, 3.5, 0, Math.PI * 2), e.fill(), e.fillStyle = "#fff", e.beginPath(), e.arc(t, n, 1.5, 0, Math.PI * 2), e.fill();
27160
27210
  }
27161
- function rk(e, t, n, r, i, a) {
27211
+ function dk(e, t, n, r, i, a) {
27162
27212
  e.font = `600 11px ${a.font.family}`;
27163
27213
  let o = 0;
27164
27214
  for (let t of r) {
@@ -27166,13 +27216,13 @@ function rk(e, t, n, r, i, a) {
27166
27216
  n > o && (o = n);
27167
27217
  }
27168
27218
  let s = Math.ceil(o) + 16, c = r.length * 14 + 12, l = t + 8, u = n + 8, d = e.canvas.clientWidth || e.canvas.width;
27169
- l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, ik(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, ik(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
27219
+ l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, fk(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, fk(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
27170
27220
  for (let t = 0; t < r.length; t++) e.fillStyle = t === 0 ? i : a.textSecondary, e.fillText(r[t], l + 8, u + 6 + t * 14);
27171
27221
  }
27172
- function ik(e, t, n, r, i, a) {
27222
+ function fk(e, t, n, r, i, a) {
27173
27223
  e.beginPath(), e.moveTo(t + a, n), e.arcTo(t + r, n, t + r, n + i, a), e.arcTo(t + r, n + i, t, n + i, a), e.arcTo(t, n + i, t, n, a), e.arcTo(t, n, t + r, n, a), e.closePath();
27174
27224
  }
27175
- function ak(e, t) {
27225
+ function pk(e, t) {
27176
27226
  if (e.startsWith("#")) {
27177
27227
  let n = 0, r = 0, i = 0;
27178
27228
  return e.length === 4 ? (n = parseInt(e[1] + e[1], 16), r = parseInt(e[2] + e[2], 16), i = parseInt(e[3] + e[3], 16)) : e.length >= 7 && (n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16)), `rgba(${n},${r},${i},${t})`;
@@ -27185,7 +27235,7 @@ function ak(e, t) {
27185
27235
  }
27186
27236
  //#endregion
27187
27237
  //#region src/features/SelectionBoxOverlay.ts
27188
- var ok = 6, sk = class {
27238
+ var mk = 6, hk = class {
27189
27239
  start = null;
27190
27240
  current = null;
27191
27241
  isActive() {
@@ -27217,7 +27267,7 @@ var ok = 6, sk = class {
27217
27267
  let { chartRect: r } = t, i = (e) => Math.max(r.x, Math.min(r.x + r.width, e)), a = (e) => Math.max(r.y, Math.min(r.y + r.height, e)), o = i(Math.min(this.start.x, this.current.x)), s = i(Math.max(this.start.x, this.current.x)), c = a(Math.min(this.start.y, this.current.y)), l = a(Math.max(this.start.y, this.current.y));
27218
27268
  e.save(), e.fillStyle = n.crosshair, e.globalAlpha = .1, e.fillRect(o, c, s - o, l - c), e.globalAlpha = .8, e.strokeStyle = n.crosshair, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(Math.round(o) + .5, Math.round(c) + .5, Math.round(s - o), Math.round(l - c)), e.restore();
27219
27269
  }
27220
- }, ck = {
27270
+ }, gk = {
27221
27271
  linear: (e) => e,
27222
27272
  easeOutCubic: (e) => 1 - (1 - e) ** 3,
27223
27273
  easeOutQuart: (e) => 1 - (1 - e) ** 4,
@@ -27225,7 +27275,7 @@ var ok = 6, sk = class {
27225
27275
  easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
27226
27276
  easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
27227
27277
  spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
27228
- }, lk = class {
27278
+ }, _k = class {
27229
27279
  animations = /* @__PURE__ */ new Map();
27230
27280
  frameId = 0;
27231
27281
  running = !1;
@@ -27233,7 +27283,7 @@ var ok = 6, sk = class {
27233
27283
  this.animations.set(e, {
27234
27284
  startTime: -1,
27235
27285
  duration: t.duration,
27236
- easing: t.easing ?? ck.easeOutCubic,
27286
+ easing: t.easing ?? gk.easeOutCubic,
27237
27287
  onUpdate: t.onUpdate,
27238
27288
  onComplete: t.onComplete
27239
27289
  }), this.running || (this.running = !0, this.tick());
@@ -27268,11 +27318,11 @@ var ok = 6, sk = class {
27268
27318
  };
27269
27319
  //#endregion
27270
27320
  //#region src/finance/BaseFinanceChart.ts
27271
- function uk(e) {
27321
+ function vk(e) {
27272
27322
  return !e || e === "dark" ? ae : e === "light" ? ye : e;
27273
27323
  }
27274
- function dk(e, t) {
27275
- let n = uk(e), r = Object.fromEntries(Object.entries(t ?? {}).filter(([, e]) => e !== void 0));
27324
+ function yk(e, t) {
27325
+ let n = vk(e), r = Object.fromEntries(Object.entries(t ?? {}).filter(([, e]) => e !== void 0));
27276
27326
  return {
27277
27327
  ...n,
27278
27328
  font: {
@@ -27281,7 +27331,7 @@ function dk(e, t) {
27281
27331
  }
27282
27332
  };
27283
27333
  }
27284
- var fk = class {
27334
+ var bk = class {
27285
27335
  canvas;
27286
27336
  ctx;
27287
27337
  container;
@@ -27294,7 +27344,7 @@ var fk = class {
27294
27344
  themeGiven;
27295
27345
  fontGiven;
27296
27346
  constructor(e, t, n) {
27297
- this.container = e, this.themeGiven = t, this.fontGiven = n, this.theme = dk(t, n), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", zt(this.canvas), this.canvas.setAttribute("role", "img"), e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.sizer = new Rt(e), this.updateSize(), this.sizer.onResize(() => {
27347
+ this.container = e, this.themeGiven = t, this.fontGiven = n, this.theme = yk(t, n), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", zt(this.canvas), this.canvas.setAttribute("role", "img"), e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.sizer = new Rt(e), this.updateSize(), this.sizer.onResize(() => {
27298
27348
  this.updateSize(), this.renderNow();
27299
27349
  });
27300
27350
  }
@@ -27314,18 +27364,18 @@ var fk = class {
27314
27364
  this.width === 0 || this.height === 0 || (this.ctx.save(), this.ctx.setTransform(this.canvas.width / this.width, 0, 0, this.canvas.height / this.height, 0, 0), this.ctx.clearRect(0, 0, this.width, this.height), this.renderChart(this.ctx, this.width, this.height, this.theme), this.ctx.restore());
27315
27365
  }
27316
27366
  applyBaseOptions(e) {
27317
- "theme" in e && (this.themeGiven = e.theme), "font" in e && (this.fontGiven = e.font), ("theme" in e || "font" in e) && (this.theme = dk(this.themeGiven, this.fontGiven)), e.ariaLabel !== void 0 && this.setLabel(e.ariaLabel);
27367
+ "theme" in e && (this.themeGiven = e.theme), "font" in e && (this.fontGiven = e.font), ("theme" in e || "font" in e) && (this.theme = yk(this.themeGiven, this.fontGiven)), e.ariaLabel !== void 0 && this.setLabel(e.ariaLabel);
27318
27368
  }
27319
27369
  setLabel(e) {
27320
27370
  this.canvas.setAttribute("aria-label", e);
27321
27371
  }
27322
27372
  setTheme(e) {
27323
- this.themeGiven = e, this.theme = dk(e, this.fontGiven), this.requestRender();
27373
+ this.themeGiven = e, this.theme = yk(e, this.fontGiven), this.requestRender();
27324
27374
  }
27325
27375
  destroy() {
27326
27376
  this.frameId !== null && cancelAnimationFrame(this.frameId), this.sizer.destroy(), this.canvas.width = 0, this.canvas.height = 0, this.canvas.remove();
27327
27377
  }
27328
- }, pk = class {
27378
+ }, xk = class {
27329
27379
  pos = null;
27330
27380
  canvas;
27331
27381
  onUpdate;
@@ -27364,7 +27414,7 @@ var fk = class {
27364
27414
  };
27365
27415
  //#endregion
27366
27416
  //#region src/finance/SparklineRenderer.ts
27367
- function mk(e, t, n, r, i) {
27417
+ function Sk(e, t, n, r, i) {
27368
27418
  let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
27369
27419
  if (a.length < 2 || t <= 0 || n <= 0) return;
27370
27420
  let u = r.color ?? i.lineColor, d = r.fillColor ?? u, f = t - 4, p = n - 4, m = Infinity, h = -Infinity, g = 0, _ = 0;
@@ -27389,16 +27439,16 @@ function mk(e, t, n, r, i) {
27389
27439
  }
27390
27440
  //#endregion
27391
27441
  //#region src/finance/DepthChartRenderer.ts
27392
- var hk = .2, gk = .01, _k = 24, vk = 16, yk = "Spread";
27393
- function bk(e, t) {
27442
+ var Ck = .2, wk = .01, Tk = 24, Ek = 16, Dk = "Spread";
27443
+ function Ok(e, t) {
27394
27444
  let n = e.filter((e) => Number.isFinite(e.price) && Number.isFinite(e.volume)).sort((e, n) => t === "bid" ? n.price - e.price : e.price - n.price), r = 0;
27395
27445
  return n.map((e) => ({
27396
27446
  price: e.price,
27397
27447
  cumulativeVolume: r += e.volume
27398
27448
  }));
27399
27449
  }
27400
- function xk(e, t, n, r) {
27401
- let i = bk(e.data.bids, "bid"), a = bk(e.data.asks, "ask"), o = i[0]?.price, s = a[0]?.price, c = o !== void 0 && s !== void 0, l = c ? (o + s) / 2 : o ?? s ?? 0, u = i.length > 0 ? i[i.length - 1].price : l, d = a.length > 0 ? a[a.length - 1].price : l, f = (Math.max(l - u, d - l) || Math.abs(l) * gk || 1) * (1 + hk), p = um(0, Math.max(0, ...i.map((e) => e.cumulativeVolume), ...a.map((e) => e.cumulativeVolume)) || 1, 5), m = e.volumeFormat ?? J(p, e.locale), h = 12 + Math.max(0, ...p.ticks.map((e) => r(m(e), 11))) + 8, g = 12 + (c && e.midPriceLine !== !1 && e.spreadLabel !== !1 ? vk : 0);
27450
+ function kk(e, t, n, r) {
27451
+ let i = Ok(e.data.bids, "bid"), a = Ok(e.data.asks, "ask"), o = i[0]?.price, s = a[0]?.price, c = o !== void 0 && s !== void 0, l = c ? (o + s) / 2 : o ?? s ?? 0, u = i.length > 0 ? i[i.length - 1].price : l, d = a.length > 0 ? a[a.length - 1].price : l, f = (Math.max(l - u, d - l) || Math.abs(l) * wk || 1) * (1 + Ck), p = um(0, Math.max(0, ...i.map((e) => e.cumulativeVolume), ...a.map((e) => e.cumulativeVolume)) || 1, 5), m = e.volumeFormat ?? J(p, e.locale), h = 12 + Math.max(0, ...p.ticks.map((e) => r(m(e), 11))) + 8, g = 12 + (c && e.midPriceLine !== !1 && e.spreadLabel !== !1 ? Ek : 0);
27402
27452
  return {
27403
27453
  plot: {
27404
27454
  x: h,
@@ -27415,13 +27465,13 @@ function xk(e, t, n, r) {
27415
27465
  spread: c ? s - o : 0
27416
27466
  };
27417
27467
  }
27418
- function Sk(e, t) {
27468
+ function Ak(e, t) {
27419
27469
  return e.length === 1 ? [e[0], {
27420
27470
  price: t,
27421
27471
  cumulativeVolume: e[0].cumulativeVolume
27422
27472
  }] : e;
27423
27473
  }
27424
- function Ck(e, t, n) {
27474
+ function jk(e, t, n) {
27425
27475
  let r = null;
27426
27476
  for (let i of e) {
27427
27477
  if (n === "bid" ? i.price < t : i.price > t) break;
@@ -27429,14 +27479,14 @@ function Ck(e, t, n) {
27429
27479
  }
27430
27480
  return r;
27431
27481
  }
27432
- function wk(e, t, n, r, i, a, o) {
27482
+ function Mk(e, t, n, r, i, a, o) {
27433
27483
  if (t <= 0 || n <= 0) return;
27434
27484
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
27435
27485
  let { data: s } = r;
27436
27486
  if (s.bids.length === 0 && s.asks.length === 0) return;
27437
- let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), { plot: l, volume: u, priceMin: d, priceMax: f, bids: p, asks: m, mid: h, spread: g } = xk(r, t, n, c), _ = l.y + l.height, v = (e) => l.x + (e - d) / (f - d) * l.width, y = (e) => q(u, e, l.y, l.height, !0), b = Fm([...p, ...m].map((e) => e.price)), x = r.priceFormat ?? vm(r.locale, b), S = r.volumeFormat ?? hm(r.locale);
27487
+ let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), { plot: l, volume: u, priceMin: d, priceMax: f, bids: p, asks: m, mid: h, spread: g } = kk(r, t, n, c), _ = l.y + l.height, v = (e) => l.x + (e - d) / (f - d) * l.width, y = (e) => q(u, e, l.y, l.height, !0), b = Fm([...p, ...m].map((e) => e.price)), x = r.priceFormat ?? vm(r.locale, b), S = r.volumeFormat ?? hm(r.locale);
27438
27488
  Im(e, l, u, "vertical", i, r.volumeFormat ?? J(u, r.locale)), e.save(), e.font = Y(i, 11), e.fillStyle = i.axisLabel, e.strokeStyle = i.grid, e.textAlign = "center", e.textBaseline = "top";
27439
- let C = c(x(f), 11) + _k, w = um(d, f, Math.max(2, Math.floor(l.width / C))), T = r.priceFormat ?? J(w, r.locale);
27489
+ let C = c(x(f), 11) + Tk, w = um(d, f, Math.max(2, Math.floor(l.width / C))), T = r.priceFormat ?? J(w, r.locale);
27440
27490
  e.font = Y(i, 11);
27441
27491
  for (let t of w.ticks) t < d || t > f || (Dm(e, v(t), l.y, v(t), _), e.fillText(T(t), Math.round(v(t)), _ + 6));
27442
27492
  e.restore();
@@ -27447,10 +27497,10 @@ function wk(e, t, n, r, i, a, o) {
27447
27497
  };
27448
27498
  e.fillStyle = r, e.beginPath(), e.moveTo(v(t[0].price), _), e.lineTo(v(t[0].price), y(t[0].cumulativeVolume)), i(), e.lineTo(v(t[t.length - 1].price), _), e.closePath(), e.fill(), e.strokeStyle = n, e.lineWidth = 1.5, e.lineJoin = "miter", e.beginPath(), e.moveTo(v(t[0].price), y(t[0].cumulativeVolume)), i(), e.stroke();
27449
27499
  }, ee = r.bidColor ?? i.candleUp, te = r.askColor ?? i.candleDown;
27450
- if (e.save(), e.beginPath(), e.rect(l.x, l.y, l.width, l.height), e.clip(), E(Sk(p, d), ee, r.bidFillColor ?? N(ee, .25)), E(Sk(m, f), te, r.askFillColor ?? N(te, .25)), e.restore(), h !== null && r.midPriceLine !== !1 && (e.save(), e.strokeStyle = i.textSecondary, e.setLineDash([4, 4]), Dm(e, v(h), l.y, v(h), _), e.setLineDash([]), r.spreadLabel !== !1 && (e.font = Y(i, 11), e.fillStyle = i.textSecondary, e.textAlign = "center", e.textBaseline = "middle", e.fillText(`${typeof r.spreadLabel == "string" ? r.spreadLabel : yk}: ${x(g)}`, Math.round(v(h)), 12 + vk / 2 - 2)), e.restore()), !a || a.x < l.x || a.x > l.x + l.width) return;
27500
+ if (e.save(), e.beginPath(), e.rect(l.x, l.y, l.width, l.height), e.clip(), E(Ak(p, d), ee, r.bidFillColor ?? N(ee, .25)), E(Ak(m, f), te, r.askFillColor ?? N(te, .25)), e.restore(), h !== null && r.midPriceLine !== !1 && (e.save(), e.strokeStyle = i.textSecondary, e.setLineDash([4, 4]), Dm(e, v(h), l.y, v(h), _), e.setLineDash([]), r.spreadLabel !== !1 && (e.font = Y(i, 11), e.fillStyle = i.textSecondary, e.textAlign = "center", e.textBaseline = "middle", e.fillText(`${typeof r.spreadLabel == "string" ? r.spreadLabel : Dk}: ${x(g)}`, Math.round(v(h)), 12 + Ek / 2 - 2)), e.restore()), !a || a.x < l.x || a.x > l.x + l.width) return;
27451
27501
  let D = d + (a.x - l.x) / l.width * (f - d);
27452
27502
  e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, a.x, l.y, a.x, _), e.restore();
27453
- let O = Ck(p, D, "bid"), k = Ck(m, D, "ask"), ne = [{
27503
+ let O = jk(p, D, "bid"), k = jk(m, D, "ask"), ne = [{
27454
27504
  text: x((O ?? k)?.price ?? D),
27455
27505
  bold: !0
27456
27506
  }];
@@ -27469,8 +27519,8 @@ function wk(e, t, n, r, i, a, o) {
27469
27519
  }
27470
27520
  //#endregion
27471
27521
  //#region src/finance/EquityCurveRenderer.ts
27472
- var Tk = .19, Ek = 864e5, Dk = 80, Ok = 3, kk = .05, Ak = "Benchmark";
27473
- function jk(e, t) {
27522
+ var Nk = .19, Pk = 864e5, Fk = 80, Ik = 3, Lk = .05, Rk = "Benchmark";
27523
+ function zk(e, t) {
27474
27524
  let n = -1, r = Infinity;
27475
27525
  for (let i = 0; i < e.length; i++) {
27476
27526
  let a = Math.abs(e[i].time - t);
@@ -27478,17 +27528,17 @@ function jk(e, t) {
27478
27528
  }
27479
27529
  return n;
27480
27530
  }
27481
- function Mk(e, t, n) {
27482
- return _m(n, e < Ek ? {
27483
- ...t > Ek ? {
27531
+ function Bk(e, t, n) {
27532
+ return _m(n, e < Pk ? {
27533
+ ...t > Pk ? {
27484
27534
  month: "short",
27485
27535
  day: "numeric"
27486
27536
  } : {},
27487
27537
  hour: "2-digit",
27488
27538
  minute: "2-digit"
27489
- } : e >= 28 * Ek ? {
27539
+ } : e >= 28 * Pk ? {
27490
27540
  month: "short",
27491
- ...t >= 365 * Ek ? { year: "numeric" } : {},
27541
+ ...t >= 365 * Pk ? { year: "numeric" } : {},
27492
27542
  timeZone: "UTC"
27493
27543
  } : {
27494
27544
  month: "short",
@@ -27496,28 +27546,28 @@ function Mk(e, t, n) {
27496
27546
  timeZone: "UTC"
27497
27547
  });
27498
27548
  }
27499
- function Nk(e, t) {
27500
- let n = e < 7 * Ek;
27549
+ function Vk(e, t) {
27550
+ let n = e < 7 * Pk;
27501
27551
  return _m(t, {
27502
27552
  month: "short",
27503
27553
  day: "numeric",
27504
- ...e >= 365 * Ek ? { year: "numeric" } : {},
27554
+ ...e >= 365 * Pk ? { year: "numeric" } : {},
27505
27555
  ...n ? {
27506
27556
  hour: "2-digit",
27507
27557
  minute: "2-digit"
27508
27558
  } : { timeZone: "UTC" }
27509
27559
  });
27510
27560
  }
27511
- function Pk(e) {
27561
+ function Hk(e) {
27512
27562
  for (let t = 1; t < e.length; t++) if (e[t].time < e[t - 1].time) return [...e].sort((e, t) => e.time - t.time);
27513
27563
  return e;
27514
27564
  }
27515
- function Fk(e, t, n, r, i = "") {
27565
+ function Uk(e, t, n, r, i = "") {
27516
27566
  let { data: a, benchmark: o } = e, s = Infinity, c = -Infinity, l = Infinity, u = -Infinity;
27517
27567
  for (let e of a) Number.isFinite(e.value) && (s = Math.min(s, e.value), c = Math.max(c, e.value)), Number.isFinite(e.time) && (l = Math.min(l, e.time), u = Math.max(u, e.time));
27518
27568
  for (let e of o ?? []) Number.isFinite(e.value) && (s = Math.min(s, e.value), c = Math.max(c, e.value));
27519
- let d = s === c ? Math.abs(s) * kk || 1 : 0, f = um(s - d, c + d, 5), p = e.valueFormat ?? J(f, e.locale), m = Math.max(0, ...f.ticks.map((e) => r(p(e), 11))), h = o && o.length >= 2 ? Cm([{
27520
- label: e.benchmarkLabel ?? Ak,
27569
+ let d = s === c ? Math.abs(s) * Lk || 1 : 0, f = um(s - d, c + d, 5), p = e.valueFormat ?? J(f, e.locale), m = Math.max(0, ...f.ticks.map((e) => r(p(e), 11))), h = o && o.length >= 2 ? Cm([{
27570
+ label: e.benchmarkLabel ?? Rk,
27521
27571
  color: i
27522
27572
  }], t - 24, r) : null, g = 12 + m + 8, _ = 12 + (h ? h.height + 6 : 0);
27523
27573
  return {
@@ -27533,8 +27583,8 @@ function Fk(e, t, n, r, i = "") {
27533
27583
  legend: h
27534
27584
  };
27535
27585
  }
27536
- function Ik(e, t, n, r, i, a) {
27537
- let { plot: o, timeMin: s, timeMax: c } = t, l = Pm(s, c, Math.max(1, Math.floor(o.width / Dk))), u = i ?? Mk(l.length > 1 ? l[1] - l[0] : c - s, c - s, a);
27586
+ function Wk(e, t, n, r, i, a) {
27587
+ let { plot: o, timeMin: s, timeMax: c } = t, l = Pm(s, c, Math.max(1, Math.floor(o.width / Fk))), u = i ?? Bk(l.length > 1 ? l[1] - l[0] : c - s, c - s, a);
27538
27588
  e.save(), e.font = Y(r, 11), e.fillStyle = r.axisLabel, e.strokeStyle = r.grid, e.textAlign = "center", e.textBaseline = "top";
27539
27589
  for (let t of l) {
27540
27590
  let r = o.x + (t - s) / (c - s) * o.width;
@@ -27544,12 +27594,12 @@ function Ik(e, t, n, r, i, a) {
27544
27594
  }
27545
27595
  e.restore();
27546
27596
  }
27547
- function Lk(e, t, n, r, i, a, o) {
27597
+ function Gk(e, t, n, r, i, a, o) {
27548
27598
  if (t <= 0 || n <= 0 || (e.fillStyle = i.background, e.fillRect(0, 0, t, n), r.data.length < 2)) return;
27549
- let s = Pk(r.data), c = r.benchmark && Pk(r.benchmark), l = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), u = r.lineColor ?? i.lineColor, d = r.benchmarkColor ?? i.textSecondary, f = Fk(r, t, n, l, d), { plot: p, scale: m, timeMin: h, timeMax: g, legend: _ } = f;
27599
+ let s = Hk(r.data), c = r.benchmark && Hk(r.benchmark), l = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), u = r.lineColor ?? i.lineColor, d = r.benchmarkColor ?? i.textSecondary, f = Uk(r, t, n, l, d), { plot: p, scale: m, timeMin: h, timeMax: g, legend: _ } = f;
27550
27600
  if (!(g >= h)) return;
27551
- let v = g - h || 1, y = (e) => p.x + (e - h) / v * p.width, b = (e) => q(m, e, p.y, p.height, !0), x = p.y + p.height, S = r.timeFormat ?? Nk(v, r.locale);
27552
- Im(e, p, m, "vertical", i, r.valueFormat ?? J(m, r.locale)), Ik(e, f, t, i, r.timeFormat, r.locale), _ && wm(e, _, p.x, 12, i);
27601
+ let v = g - h || 1, y = (e) => p.x + (e - h) / v * p.width, b = (e) => q(m, e, p.y, p.height, !0), x = p.y + p.height, S = r.timeFormat ?? Vk(v, r.locale);
27602
+ Im(e, p, m, "vertical", i, r.valueFormat ?? J(m, r.locale)), Wk(e, f, t, i, r.timeFormat, r.locale), _ && wm(e, _, p.x, 12, i);
27553
27603
  let C = (t, n = (e) => t[e].value) => {
27554
27604
  e.moveTo(y(t[0].time), b(n(0)));
27555
27605
  for (let r = 1; r < t.length; r++) e.lineTo(y(t[r].time), b(n(r)));
@@ -27557,7 +27607,7 @@ function Lk(e, t, n, r, i, a, o) {
27557
27607
  if (e.save(), e.beginPath(), e.rect(p.x, p.y, p.width, p.height), e.clip(), r.drawdown === !0) {
27558
27608
  let t = [], n = -Infinity;
27559
27609
  for (let e of s) t.push(n = Number.isFinite(e.value) ? Math.max(n, e.value) : n);
27560
- e.fillStyle = r.drawdownColor ?? N(i.candleDown, Tk), e.beginPath(), C(s, (e) => t[e]);
27610
+ e.fillStyle = r.drawdownColor ?? N(i.candleDown, Nk), e.beginPath(), C(s, (e) => t[e]);
27561
27611
  for (let t = s.length - 1; t >= 0; t--) e.lineTo(y(s[t].time), b(s[t].value));
27562
27612
  e.closePath(), e.fill();
27563
27613
  }
@@ -27566,18 +27616,18 @@ function Lk(e, t, n, r, i, a, o) {
27566
27616
  t.addColorStop(0, N(u, $p)), t.addColorStop(1, "transparent"), e.fillStyle = t, e.beginPath(), C(s), e.lineTo(y(s[s.length - 1].time), x), e.lineTo(y(s[0].time), x), e.closePath(), e.fill();
27567
27617
  }
27568
27618
  if (e.lineJoin = "round", c && c.length >= 2 && (e.strokeStyle = d, e.lineWidth = 1, e.beginPath(), C(c), e.stroke()), e.strokeStyle = u, e.lineWidth = r.lineWidth ?? 1.5, e.beginPath(), C(s), e.stroke(), e.restore(), !a || a.x < p.x || a.x > p.x + p.width) return;
27569
- let w = s[jk(s, h + (a.x - p.x) / p.width * v)];
27619
+ let w = s[zk(s, h + (a.x - p.x) / p.width * v)];
27570
27620
  if (!w) return;
27571
- e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, y(w.time), p.y, y(w.time), x), e.restore(), e.fillStyle = u, e.beginPath(), e.arc(y(w.time), b(w.value), Ok, 0, Math.PI * 2), e.fill();
27621
+ e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, y(w.time), p.y, y(w.time), x), e.restore(), e.fillStyle = u, e.beginPath(), e.arc(y(w.time), b(w.value), Ik, 0, Math.PI * 2), e.fill();
27572
27622
  let T = r.valueFormat ?? hm(r.locale), E = [{
27573
27623
  text: S(w.time),
27574
27624
  bold: !0
27575
27625
  }, {
27576
27626
  text: T(w.value),
27577
27627
  color: u
27578
- }], ee = c ? jk(c, w.time) : -1;
27628
+ }], ee = c ? zk(c, w.time) : -1;
27579
27629
  c && ee >= 0 && E.push({
27580
- text: `${r.benchmarkLabel ?? Ak}: ${T(c[ee].value)}`,
27630
+ text: `${r.benchmarkLabel ?? Rk}: ${T(c[ee].value)}`,
27581
27631
  color: d
27582
27632
  }), Tm(e, E, a, {
27583
27633
  x: 0,
@@ -27588,7 +27638,7 @@ function Lk(e, t, n, r, i, a, o) {
27588
27638
  }
27589
27639
  //#endregion
27590
27640
  //#region src/finance/HeatmapLayout.ts
27591
- function Rk(e, t, n) {
27641
+ function Kk(e, t, n) {
27592
27642
  if (e.length === 0) return [];
27593
27643
  let r = e.length, i = Math.ceil(Math.sqrt(r)), a = Math.ceil(r / i), o = t.width / i, s = t.height / a, c = [];
27594
27644
  for (let a = 0; a < r; a++) {
@@ -27605,7 +27655,7 @@ function Rk(e, t, n) {
27605
27655
  }
27606
27656
  return c;
27607
27657
  }
27608
- function zk(e, t) {
27658
+ function qk(e, t) {
27609
27659
  let n = e.reduce((e, t) => e + t, 0);
27610
27660
  if (n === 0 || t === 0) return Infinity;
27611
27661
  let r = 0;
@@ -27615,7 +27665,7 @@ function zk(e, t) {
27615
27665
  }
27616
27666
  return r;
27617
27667
  }
27618
- function Bk(e, t, n, r, i, a) {
27668
+ function Jk(e, t, n, r, i, a) {
27619
27669
  let o = r ? n.height : n.width, s = e.reduce((e, t) => e + t, 0), c = o > 0 ? s / o : 0, l = 0;
27620
27670
  for (let o = 0; o < e.length; o++) {
27621
27671
  let s = c > 0 ? e[o] / c : 0, u;
@@ -27635,19 +27685,19 @@ function Bk(e, t, n, r, i, a) {
27635
27685
  }), l += s;
27636
27686
  }
27637
27687
  }
27638
- function Vk(e, t, n, r, i) {
27688
+ function Yk(e, t, n, r, i) {
27639
27689
  if (e.length === 0) return;
27640
27690
  let a = n.width >= n.height, o = a ? n.height : n.width;
27641
27691
  if (e.length === 1) {
27642
- Bk(e, t, n, a, r, i);
27692
+ Jk(e, t, n, a, r, i);
27643
27693
  return;
27644
27694
  }
27645
27695
  let s = [], c = [], l = 0;
27646
27696
  for (; l < e.length;) {
27647
27697
  let u = [...s, e[l]];
27648
- if (s.length === 0 || zk(u, o) <= zk(s, o)) s.push(e[l]), c.push(t[l]), l++;
27698
+ if (s.length === 0 || qk(u, o) <= qk(s, o)) s.push(e[l]), c.push(t[l]), l++;
27649
27699
  else {
27650
- Bk(s, c, n, a, r, i);
27700
+ Jk(s, c, n, a, r, i);
27651
27701
  let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
27652
27702
  n = a ? {
27653
27703
  x: n.x + d,
@@ -27659,37 +27709,37 @@ function Vk(e, t, n, r, i) {
27659
27709
  y: n.y + d,
27660
27710
  width: n.width,
27661
27711
  height: n.height - d
27662
- }, Vk(e.slice(l), t.slice(l), n, r, i);
27712
+ }, Yk(e.slice(l), t.slice(l), n, r, i);
27663
27713
  return;
27664
27714
  }
27665
27715
  }
27666
- s.length > 0 && Bk(s, c, n, a, r, i);
27716
+ s.length > 0 && Jk(s, c, n, a, r, i);
27667
27717
  }
27668
- function Hk(e, t, n) {
27718
+ function Xk(e, t, n) {
27669
27719
  if (e.length === 0) return [];
27670
27720
  let r = (e) => e.weight > 0 && Number.isFinite(e.weight) ? e.weight : 0, i = [...e].sort((e, t) => r(t) - r(e)), a = i.reduce((e, t) => e + r(t), 0);
27671
27721
  if (a === 0) return [];
27672
27722
  let o = t.width * t.height, s = i.map((e) => r(e) / a * o), c = i.map((e) => e.id), l = [];
27673
- return Vk(s, c, { ...t }, n, l), l;
27723
+ return Yk(s, c, { ...t }, n, l), l;
27674
27724
  }
27675
- var Uk = 2, Wk = 18;
27676
- function Gk(e, t, n, r = 18) {
27725
+ var Zk = 2, Qk = 18;
27726
+ function $k(e, t, n, r = 18) {
27677
27727
  let i = /* @__PURE__ */ new Map();
27678
27728
  for (let t of e) {
27679
27729
  if (!(t.weight > 0)) continue;
27680
27730
  let e = t.group ?? "", n = i.get(e);
27681
27731
  n ? n.push(t) : i.set(e, [t]);
27682
27732
  }
27683
- let a = [...i.keys()], o = Hk(a.map((e, t) => ({
27733
+ let a = [...i.keys()], o = Xk(a.map((e, t) => ({
27684
27734
  id: String(t),
27685
27735
  weight: i.get(e).reduce((e, t) => e + t.weight, 0)
27686
27736
  })), t, 0), s = [], c = [];
27687
27737
  for (let e of o) {
27688
27738
  let t = a[Number(e.id)], o = i.get(t), l = o.reduce((e, t) => e + t.weight, 0), u = o.reduce((e, t) => e + (Number.isFinite(t.value) ? t.value * t.weight : 0), 0), d = e.rect, f = t !== "" && d.height >= r * 2.5 && d.width >= 40 ? r : 0, p = {
27689
- x: d.x + Uk / 2,
27690
- y: d.y + Uk / 2 + f,
27691
- width: Math.max(0, d.width - Uk),
27692
- height: Math.max(0, d.height - Uk - f)
27739
+ x: d.x + Zk / 2,
27740
+ y: d.y + Zk / 2 + f,
27741
+ width: Math.max(0, d.width - Zk),
27742
+ height: Math.max(0, d.height - Zk - f)
27693
27743
  };
27694
27744
  s.push({
27695
27745
  name: t,
@@ -27697,7 +27747,7 @@ function Gk(e, t, n, r = 18) {
27697
27747
  header: f,
27698
27748
  value: l > 0 ? u / l : 0,
27699
27749
  count: o.length
27700
- }), c.push(...Hk(o, p, n));
27750
+ }), c.push(...Xk(o, p, n));
27701
27751
  }
27702
27752
  return {
27703
27753
  groups: s,
@@ -27706,13 +27756,13 @@ function Gk(e, t, n, r = 18) {
27706
27756
  }
27707
27757
  //#endregion
27708
27758
  //#region src/finance/HeatmapRenderer.ts
27709
- function Kk(e) {
27759
+ function eA(e) {
27710
27760
  return Number.isFinite(e) ? (e >= 0 ? "+" : "") + e.toFixed(2) + "%" : "";
27711
27761
  }
27712
- function qk(e) {
27762
+ function tA(e) {
27713
27763
  return e.label;
27714
27764
  }
27715
- function Jk(e, t) {
27765
+ function nA(e, t) {
27716
27766
  let n = t.min ?? -5, r = t.max ?? 5;
27717
27767
  if (!Number.isFinite(e)) return t.zero;
27718
27768
  if (e <= n) return t.negative;
@@ -27724,20 +27774,20 @@ function Jk(e, t) {
27724
27774
  let i = e / r;
27725
27775
  return Je(t.zero, t.positive, i);
27726
27776
  }
27727
- var Yk = "#FFFFFF", Xk = "#11151b";
27728
- function Zk(e, t) {
27777
+ var rA = "#FFFFFF", iA = "#11151b";
27778
+ function aA(e, t) {
27729
27779
  let n = /^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i.exec(e.trim());
27730
- return Jm(n ? Je(t, `rgb(${n[1]},${n[2]},${n[3]})`, Number(n[4])) : Je(e, e, 0)) === Xk ? Xk : Yk;
27780
+ return Jm(n ? Je(t, `rgb(${n[1]},${n[2]},${n[3]})`, Number(n[4])) : Je(e, e, 0)) === iA ? iA : rA;
27731
27781
  }
27732
- function Qk(e, t, n, r, i, a) {
27782
+ function oA(e, t, n, r, i, a) {
27733
27783
  let o = Math.min(a, r / 2, i / 2);
27734
27784
  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();
27735
27785
  }
27736
- function $k(e, t, n, r, i, a, o, s, c, l, u, d) {
27786
+ function sA(e, t, n, r, i, a, o, s, c, l, u, d) {
27737
27787
  if (i < 40 || a < 30) return;
27738
27788
  let f = n + i / 2, p = r + a / 2;
27739
27789
  e.save();
27740
- let m = d === Yk;
27790
+ let m = d === rA;
27741
27791
  if (e.shadowColor = m ? "rgba(0,0,0,0.6)" : "transparent", e.shadowBlur = m ? 2 : 0, e.fillStyle = d, e.textAlign = "center", s) {
27742
27792
  let n = l(t), r = Math.min(o.font.sizeMedium, i / n.length * 1.5, a / 4);
27743
27793
  e.font = "bold " + Math.max(8, r) + "px " + o.font.family, e.textBaseline = c ? "bottom" : "middle", e.fillText(n, f, c ? p - 1 : p, i - 8);
@@ -27748,7 +27798,7 @@ function $k(e, t, n, r, i, a, o, s, c, l, u, d) {
27748
27798
  }
27749
27799
  e.restore();
27750
27800
  }
27751
- function eA(e, t, n, r) {
27801
+ function cA(e, t, n, r) {
27752
27802
  let i = [{
27753
27803
  text: n(e),
27754
27804
  bold: !0
@@ -27760,7 +27810,7 @@ function eA(e, t, n, r) {
27760
27810
  for (let [t, n] of Object.entries(e.meta ?? {})) i.push({ text: t + ": " + String(n) });
27761
27811
  return i;
27762
27812
  }
27763
- function tA(e, t, n, r, i, a, o, s, c = []) {
27813
+ function lA(e, t, n, r, i, a, o, s, c = []) {
27764
27814
  if (t <= 0 || n <= 0 || (e.fillStyle = o.background, e.fillRect(0, 0, t, n), r.length === 0 || i.length === 0)) return null;
27765
27815
  let l = a.colorScale, u = Wm([], o, l), d = {
27766
27816
  negative: u.negative,
@@ -27768,7 +27818,7 @@ function tA(e, t, n, r, i, a, o, s, c = []) {
27768
27818
  positive: u.positive,
27769
27819
  min: l?.min,
27770
27820
  max: l?.max
27771
- }, f = a.cellRadius ?? 4, p = a.showLabels !== !1, m = a.showValues !== !1, h = a.valueFormat ?? Kk, g = a.labelFormat ?? qk, _ = /* @__PURE__ */ new Map();
27821
+ }, f = a.cellRadius ?? 4, p = a.showLabels !== !1, m = a.showValues !== !1, h = a.valueFormat ?? eA, g = a.labelFormat ?? tA, _ = /* @__PURE__ */ new Map();
27772
27822
  for (let e of r) _.set(e.id, e);
27773
27823
  let v = null, y = null;
27774
27824
  if (s) for (let e of i) {
@@ -27788,16 +27838,16 @@ function tA(e, t, n, r, i, a, o, s, c = []) {
27788
27838
  if (!n) continue;
27789
27839
  let { x: r, y: i, width: a, height: s } = t.rect;
27790
27840
  if (a <= 0 || s <= 0) continue;
27791
- let c = Jk(n.value, d);
27792
- Qk(e, r, i, a, s, f), e.fillStyle = c, e.fill(), $k(e, n, r, i, a, s, o, p, m, g, h, Zk(c, o.background)), t.id === v && (Qk(e, r, i, a, s, f), e.strokeStyle = o.text, e.lineWidth = 1.5, e.stroke());
27841
+ let c = nA(n.value, d);
27842
+ oA(e, r, i, a, s, f), e.fillStyle = c, e.fill(), sA(e, n, r, i, a, s, o, p, m, g, h, aA(c, o.background)), t.id === v && (oA(e, r, i, a, s, f), e.strokeStyle = o.text, e.lineWidth = 1.5, e.stroke());
27793
27843
  }
27794
- let b = s && !y ? c.find((e) => e.header > 0 && nA(e, s)) : void 0;
27795
- return rA(e, c, o, h, b), y && s ? Tm(e, eA(y.cell, Jk(y.cell.value, d), g, h), s, {
27844
+ let b = s && !y ? c.find((e) => e.header > 0 && uA(e, s)) : void 0;
27845
+ return dA(e, c, o, h, b), y && s ? Tm(e, cA(y.cell, nA(y.cell.value, d), g, h), s, {
27796
27846
  x: 0,
27797
27847
  y: 0,
27798
27848
  width: t,
27799
27849
  height: n
27800
- }, o) : b && s && Tm(e, eA({
27850
+ }, o) : b && s && Tm(e, cA({
27801
27851
  id: "",
27802
27852
  label: b.name,
27803
27853
  value: b.value
@@ -27808,11 +27858,11 @@ function tA(e, t, n, r, i, a, o, s, c = []) {
27808
27858
  height: n
27809
27859
  }, o), y;
27810
27860
  }
27811
- function nA(e, t) {
27861
+ function uA(e, t) {
27812
27862
  let n = e.rect;
27813
27863
  return t.x >= n.x && t.x <= n.x + n.width && t.y >= n.y && t.y <= n.y + e.header;
27814
27864
  }
27815
- function rA(e, t, n, r, i) {
27865
+ function dA(e, t, n, r, i) {
27816
27866
  if (t.length === 0) return;
27817
27867
  e.save(), e.textBaseline = "middle";
27818
27868
  let a = n.font.sizeSmall, o = (t) => e.measureText(t).width;
@@ -27829,14 +27879,14 @@ function rA(e, t, n, r, i) {
27829
27879
  }
27830
27880
  //#endregion
27831
27881
  //#region src/finance/WaterfallRenderer.ts
27832
- var iA = .7, aA = 1, oA = .382, sA = Math.PI / 4, cA = 4;
27833
- function lA(e) {
27882
+ var fA = .7, pA = 1, mA = .382, hA = Math.PI / 4, gA = 4;
27883
+ function _A(e) {
27834
27884
  return e.type ? e.type : e.value < 0 ? "negative" : "positive";
27835
27885
  }
27836
- function uA(e) {
27886
+ function vA(e) {
27837
27887
  let t = 0;
27838
27888
  return e.map((e) => {
27839
- let n = lA(e), r = Number.isFinite(e.value) ? e.value : 0, i = n === "total" || n === "subtotal" ? 0 : t, a = i + r;
27889
+ let n = _A(e), r = Number.isFinite(e.value) ? e.value : 0, i = n === "total" || n === "subtotal" ? 0 : t, a = i + r;
27840
27890
  return t = a, {
27841
27891
  type: n,
27842
27892
  value: r,
@@ -27845,15 +27895,15 @@ function uA(e) {
27845
27895
  };
27846
27896
  });
27847
27897
  }
27848
- function dA(e, t, n, r) {
27849
- let i = e.data ?? [], a = uA(i), o = 0, s = 0;
27898
+ function yA(e, t, n, r) {
27899
+ let i = e.data ?? [], a = vA(i), o = 0, s = 0;
27850
27900
  for (let { start: e, end: t } of a) o = Math.min(o, e, t), s = Math.max(s, e, t);
27851
- let c = (s - o || 1) * .1, l = um(o < 0 ? o - c : 0, s > 0 ? s + c : 0, 5), u = e.valueFormat ?? J(l, e.locale), d = 12 + Math.max(0, ...l.ticks.map((e) => r(u(e), 11))) + 8, f = Math.max(1, t - d - 12), p = f / Math.max(1, i.length), m = e.labelFormat ?? ((e) => e), h = Math.max(0, ...i.map((e) => r(m(e.label), 11))), g = h > p - 4, _ = g ? Math.min(n * oA, Math.ceil((h + 11) * Math.sin(sA)) + 6) : 20, v = {
27901
+ let c = (s - o || 1) * .1, l = um(o < 0 ? o - c : 0, s > 0 ? s + c : 0, 5), u = e.valueFormat ?? J(l, e.locale), d = 12 + Math.max(0, ...l.ticks.map((e) => r(u(e), 11))) + 8, f = Math.max(1, t - d - 12), p = f / Math.max(1, i.length), m = e.labelFormat ?? ((e) => e), h = Math.max(0, ...i.map((e) => r(m(e.label), 11))), g = h > p - 4, _ = g ? Math.min(n * mA, Math.ceil((h + 11) * Math.sin(hA)) + 6) : 20, v = {
27852
27902
  x: d,
27853
27903
  y: 12,
27854
27904
  width: f,
27855
27905
  height: Math.max(1, n - 24 - _)
27856
- }, y = p * Math.min(1, Math.max(.05, e.barWidth ?? iA)), b = (e) => q(l, e, v.y, v.height, !0);
27906
+ }, y = p * Math.min(1, Math.max(.05, e.barWidth ?? fA)), b = (e) => q(l, e, v.y, v.height, !0);
27857
27907
  return {
27858
27908
  plot: v,
27859
27909
  scale: l,
@@ -27868,7 +27918,7 @@ function dA(e, t, n, r) {
27868
27918
  x: r + (p - y) / 2,
27869
27919
  y: n,
27870
27920
  width: y,
27871
- height: Math.max(aA, Math.abs(b(e.end) - b(e.start))),
27921
+ height: Math.max(pA, Math.abs(b(e.end) - b(e.start))),
27872
27922
  slotX: r,
27873
27923
  slotWidth: p
27874
27924
  };
@@ -27877,11 +27927,11 @@ function dA(e, t, n, r) {
27877
27927
  labelRoom: _
27878
27928
  };
27879
27929
  }
27880
- function fA(e, t) {
27930
+ function bA(e, t) {
27881
27931
  let { plot: n, bars: r } = e;
27882
27932
  return r.length === 0 || t < n.x || t > n.x + n.width ? -1 : Math.min(r.length - 1, Math.floor((t - n.x) / r[0].slotWidth));
27883
27933
  }
27884
- function pA(e, t, n, r) {
27934
+ function xA(e, t, n, r) {
27885
27935
  let { bars: i, scale: a, plot: o } = t;
27886
27936
  if (r !== "none") {
27887
27937
  e.save(), e.strokeStyle = n, e.setLineDash(r === "dashed" ? [4, 4] : []);
@@ -27892,21 +27942,21 @@ function pA(e, t, n, r) {
27892
27942
  e.restore();
27893
27943
  }
27894
27944
  }
27895
- function mA(e, t, n, r, i) {
27945
+ function SA(e, t, n, r, i) {
27896
27946
  e.save(), e.font = Y(n, 10), e.fillStyle = n.textSecondary, e.textAlign = "center";
27897
27947
  let a = [];
27898
27948
  for (let n of t.bars) {
27899
27949
  let t = n.type === "positive" || n.type === "negative" ? i ? `${n.value >= 0 ? "+" : ""}${r(n.value)}` : r(n.end) : r(n.value), o = e.measureText(t).width, s = n.end < n.start, c = n.x + n.width / 2, l = {
27900
27950
  x: c - o / 2,
27901
- y: s ? n.y + n.height + cA : n.y - cA - 11,
27951
+ y: s ? n.y + n.height + gA : n.y - gA - 11,
27902
27952
  width: o,
27903
27953
  height: 11
27904
27954
  };
27905
- a.some((e) => l.x < e.x + e.width + 2 && e.x < l.x + l.width + 2 && l.y < e.y + e.height && e.y < l.y + l.height) || (a.push(l), e.textBaseline = s ? "top" : "bottom", e.fillText(t, Math.round(c), Math.round(s ? l.y : n.y - cA)));
27955
+ a.some((e) => l.x < e.x + e.width + 2 && e.x < l.x + l.width + 2 && l.y < e.y + e.height && e.y < l.y + l.height) || (a.push(l), e.textBaseline = s ? "top" : "bottom", e.fillText(t, Math.round(c), Math.round(s ? l.y : n.y - gA)));
27906
27956
  }
27907
27957
  e.restore();
27908
27958
  }
27909
- function hA(e, t, n, r, i) {
27959
+ function CA(e, t, n, r, i) {
27910
27960
  let { plot: a, bars: o, turned: s, labelRoom: c } = t;
27911
27961
  e.save(), e.font = Y(n, 11), e.fillStyle = n.axisLabel;
27912
27962
  let l = a.y + a.height + 6;
@@ -27918,23 +27968,23 @@ function hA(e, t, n, r, i) {
27918
27968
  }
27919
27969
  e.textAlign = "right", e.textBaseline = "middle";
27920
27970
  for (let t of o) {
27921
- let n = t.slotX + t.slotWidth / 2, a = Math.min((c - 6) / Math.sin(sA) - 11, (n - 2) / Math.cos(sA)), o = Lm(r(t.label), a, i);
27922
- o && (e.save(), e.translate(n, l + 2), e.rotate(-sA), e.fillText(o, 0, 0), e.restore());
27971
+ let n = t.slotX + t.slotWidth / 2, a = Math.min((c - 6) / Math.sin(hA) - 11, (n - 2) / Math.cos(hA)), o = Lm(r(t.label), a, i);
27972
+ o && (e.save(), e.translate(n, l + 2), e.rotate(-hA), e.fillText(o, 0, 0), e.restore());
27923
27973
  }
27924
27974
  e.restore();
27925
27975
  }
27926
- function gA(e, t, n, r, i, a, o) {
27976
+ function wA(e, t, n, r, i, a, o) {
27927
27977
  if (t <= 0 || n <= 0) return { hitBar: null };
27928
27978
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
27929
27979
  let s = r.data;
27930
27980
  if (!s || s.length === 0) return { hitBar: null };
27931
- let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), l = dA(r, t, n, c), { plot: u, scale: d, bars: f } = l, p = r.valueFormat ?? J(d, r.locale), m = r.valueFormat ?? hm(r.locale), h = {
27981
+ let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), l = yA(r, t, n, c), { plot: u, scale: d, bars: f } = l, p = r.valueFormat ?? J(d, r.locale), m = r.valueFormat ?? hm(r.locale), h = {
27932
27982
  positive: r.positiveColor ?? i.candleUp,
27933
27983
  negative: r.negativeColor ?? i.candleDown,
27934
27984
  total: r.totalColor ?? i.lineColor,
27935
27985
  subtotal: r.subtotalColor ?? i.textSecondary
27936
27986
  };
27937
- Im(e, u, d, "vertical", i, p), pA(e, l, r.connectorColor ?? i.textSecondary, r.connectorStyle ?? "dashed");
27987
+ Im(e, u, d, "vertical", i, p), xA(e, l, r.connectorColor ?? i.textSecondary, r.connectorStyle ?? "dashed");
27938
27988
  let g = Em(e);
27939
27989
  for (let t of f) {
27940
27990
  let n = g.x(t.x) - g.width / 2, r = g.x(t.x + t.width) - g.width / 2;
@@ -27942,8 +27992,8 @@ function gA(e, t, n, r, i, a, o) {
27942
27992
  }
27943
27993
  e.strokeStyle = i.axisLine;
27944
27994
  let _ = q(d, 0, u.y, u.height, !0);
27945
- Dm(e, u.x, _, u.x + u.width, _), r.showValues !== !1 && mA(e, l, i, m, r.showDelta !== !1), hA(e, l, i, r.labelFormat ?? ((e) => e), c);
27946
- let v = a ? fA(l, a.x) : -1;
27995
+ Dm(e, u.x, _, u.x + u.width, _), r.showValues !== !1 && SA(e, l, i, m, r.showDelta !== !1), CA(e, l, i, r.labelFormat ?? ((e) => e), c);
27996
+ let v = a ? bA(l, a.x) : -1;
27947
27997
  if (a && v >= 0) {
27948
27998
  let r = f[v], o = r.slotX + r.slotWidth / 2;
27949
27999
  e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, o, u.y, o, u.y + u.height), e.restore();
@@ -27968,22 +28018,22 @@ function gA(e, t, n, r, i, a, o) {
27968
28018
  }
27969
28019
  //#endregion
27970
28020
  //#region src/finance/GaugeRenderer.ts
27971
- var _A = Math.PI / 180, vA = 150, yA = 240, bA = 90, xA = .14, SA = 1.6 * _A, CA = .22, wA = 8, TA = 18, EA = 16, DA = 6.5, OA = 20, kA = 5, AA = 28;
27972
- function jA(e, t, n) {
28021
+ var TA = Math.PI / 180, EA = 150, DA = 240, OA = 90, kA = .14, AA = 1.6 * TA, jA = .22, MA = 8, NA = 18, PA = 16, FA = 6.5, IA = 20, LA = 5, RA = 28;
28022
+ function zA(e, t, n) {
27973
28023
  return e < t ? t : e > n ? n : e;
27974
28024
  }
27975
- function MA(e) {
28025
+ function BA(e) {
27976
28026
  let t = Math.abs(e);
27977
28027
  return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Number.isInteger(e) ? e.toFixed(0) : e.toFixed(1);
27978
28028
  }
27979
- function NA(e) {
27980
- let t = Number.isFinite(e.startAngle) ? e.startAngle : vA, n = (Number.isFinite(e.endAngle) ? e.endAngle : t + yA) - t;
27981
- return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n = jA(n, bA, 360), {
27982
- start: (t % 360 + 360) % 360 * _A,
27983
- sweep: n * _A
28029
+ function VA(e) {
28030
+ let t = Number.isFinite(e.startAngle) ? e.startAngle : EA, n = (Number.isFinite(e.endAngle) ? e.endAngle : t + DA) - t;
28031
+ return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n = zA(n, OA, 360), {
28032
+ start: (t % 360 + 360) % 360 * TA,
28033
+ sweep: n * TA
27984
28034
  };
27985
28035
  }
27986
- function PA(e, t) {
28036
+ function HA(e, t) {
27987
28037
  let n = Math.min(Math.cos(e), Math.cos(t)), r = Math.max(Math.cos(e), Math.cos(t)), i = Math.min(Math.sin(e), Math.sin(t)), a = Math.max(Math.sin(e), Math.sin(t));
27988
28038
  for (let o = Math.ceil(e / (Math.PI / 2)); Math.PI / 2 * o <= t; o++) {
27989
28039
  let e = Math.PI / 2 * o;
@@ -27996,15 +28046,15 @@ function PA(e, t) {
27996
28046
  maxY: a
27997
28047
  };
27998
28048
  }
27999
- function FA(e) {
28049
+ function UA(e) {
28000
28050
  if (e.showZoneLabels !== !0 || !e.zones) return 0;
28001
28051
  let t = e.zones.reduce((e, t) => Math.max(e, t.label?.length ?? 0), 0);
28002
- return t > 0 ? t * DA + 12 : 0;
28052
+ return t > 0 ? t * FA + 12 : 0;
28003
28053
  }
28004
- function IA(e, t, n) {
28054
+ function WA(e, t, n) {
28005
28055
  let r = Number.isFinite(n.min) ? n.min : 0, i = Number.isFinite(n.max) ? n.max : 100;
28006
28056
  i - r > Math.abs(r) * 1e-9 || (i = r + Math.max(1, Math.abs(r) * 1e-6));
28007
- let { start: a, sweep: o } = NA(n), s = a, c = a + o, l = jA(n.thickness ?? xA, .04, .5), u = PA(s, c), d = Math.max(u.maxY, .18), f = FA(n), p = f > 0 ? EA : 0, m = Math.max(1, e - 2 * wA - 2 * f), h = Math.max(1, t - 2 * wA - TA - p), g = 1 + l / 2, _ = Math.max(8, Math.min(m / ((u.maxX - u.minX) * g), h / ((d - u.minY) * g))), v = _ * l, y = (d - u.minY) * _ * g + TA + p, b = e / 2 - (u.maxX + u.minX) / 2 * _, x = (t - y) / 2 + p - u.minY * _ * g, S = _ - v / 2, C = Math.max(11, Math.round(S * .46)), w = u.maxY > .3 ? x - C * .12 : x - C * .55, T = Math.max(Math.sin(s), Math.sin(c)), E = T > .2 ? x + T * _ + v / 2 + 2 : Infinity, ee = Math.min(t - wA, E);
28057
+ let { start: a, sweep: o } = VA(n), s = a, c = a + o, l = zA(n.thickness ?? kA, .04, .5), u = HA(s, c), d = Math.max(u.maxY, .18), f = UA(n), p = f > 0 ? PA : 0, m = Math.max(1, e - 2 * MA - 2 * f), h = Math.max(1, t - 2 * MA - NA - p), g = 1 + l / 2, _ = Math.max(8, Math.min(m / ((u.maxX - u.minX) * g), h / ((d - u.minY) * g))), v = _ * l, y = (d - u.minY) * _ * g + NA + p, b = e / 2 - (u.maxX + u.minX) / 2 * _, x = (t - y) / 2 + p - u.minY * _ * g, S = _ - v / 2, C = Math.max(11, Math.round(S * .46)), w = u.maxY > .3 ? x - C * .12 : x - C * .55, T = Math.max(Math.sin(s), Math.sin(c)), E = T > .2 ? x + T * _ + v / 2 + 2 : Infinity, ee = Math.min(t - MA, E);
28008
28058
  return {
28009
28059
  cx: b,
28010
28060
  cy: x,
@@ -28019,20 +28069,20 @@ function IA(e, t, n) {
28019
28069
  textBottom: ee
28020
28070
  };
28021
28071
  }
28022
- function LA(e, t) {
28023
- let n = Number.isFinite(e) ? jA((e - t.min) / (t.max - t.min), 0, 1) : 0;
28072
+ function GA(e, t) {
28073
+ let n = Number.isFinite(e) ? zA((e - t.min) / (t.max - t.min), 0, 1) : 0;
28024
28074
  return t.startAngle + (t.endAngle - t.startAngle) * n;
28025
28075
  }
28026
- function RA(e, t) {
28076
+ function KA(e, t) {
28027
28077
  if (!t || !Number.isFinite(e)) return;
28028
28078
  let n;
28029
28079
  for (let r of t) e >= r.from && e <= r.to && (n = r);
28030
28080
  return n;
28031
28081
  }
28032
- function zA(e, t, n) {
28082
+ function qA(e, t, n) {
28033
28083
  let r = (t ?? []).map((t) => ({
28034
- a0: LA(t.from, e),
28035
- a1: LA(t.to, e),
28084
+ a0: GA(t.from, e),
28085
+ a1: GA(t.to, e),
28036
28086
  color: t.color,
28037
28087
  track: !1
28038
28088
  })).filter((e) => e.a1 > e.a0).sort((e, t) => e.a0 - t.a0), i = [], a = e.startAngle;
@@ -28052,70 +28102,70 @@ function zA(e, t, n) {
28052
28102
  track: !0
28053
28103
  }), i;
28054
28104
  }
28055
- function BA(e, t, n, r, i) {
28105
+ function JA(e, t, n, r, i) {
28056
28106
  r <= n || (e.beginPath(), e.arc(t.cx, t.cy, t.radius, n, r, !1), e.lineWidth = t.thickness, e.lineCap = "butt", e.strokeStyle = i, e.stroke());
28057
28107
  }
28058
- function VA(e, t, n, r, i, a) {
28108
+ function YA(e, t, n, r, i, a) {
28059
28109
  let o = t.cx + Math.cos(n) * t.radius, s = t.cy + Math.sin(n) * t.radius, c = a === "start" ? n - Math.PI : n;
28060
28110
  e.globalAlpha = i, e.beginPath(), e.arc(o, s, t.thickness / 2, c, c + (i >= 1 ? Math.PI * 2 : Math.PI), !1), e.closePath(), e.fillStyle = r, e.fill(), e.globalAlpha = 1;
28061
28111
  }
28062
- function HA(e, t, n, r, i, a) {
28063
- let o = zA(t, n, i), s = o.some((e) => !e.track);
28112
+ function XA(e, t, n, r, i, a) {
28113
+ let o = qA(t, n, i), s = o.some((e) => !e.track);
28064
28114
  o.forEach((n, i) => {
28065
- let a = i > 0 && !n.track && !o[i - 1].track ? SA / 2 : 0, s = i < o.length - 1 && !n.track && !o[i + 1].track ? SA / 2 : 0, c = n.a0 + a, l = n.a1 - s;
28115
+ let a = i > 0 && !n.track && !o[i - 1].track ? AA / 2 : 0, s = i < o.length - 1 && !n.track && !o[i + 1].track ? AA / 2 : 0, c = n.a0 + a, l = n.a1 - s;
28066
28116
  if (n.track) {
28067
- BA(e, t, c, l, n.color);
28117
+ JA(e, t, c, l, n.color);
28068
28118
  return;
28069
28119
  }
28070
- e.globalAlpha = CA, BA(e, t, c, l, n.color), e.globalAlpha = 1, BA(e, t, c, Math.min(l, r), n.color);
28071
- }), s || BA(e, t, t.startAngle, r, a);
28072
- let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 : CA], [d, f] = u(o[0], c), [p, m] = u(o[o.length - 1], l);
28073
- VA(e, t, t.startAngle, d, f, "start"), VA(e, t, t.endAngle, p, m, "end");
28120
+ e.globalAlpha = jA, JA(e, t, c, l, n.color), e.globalAlpha = 1, JA(e, t, c, Math.min(l, r), n.color);
28121
+ }), s || JA(e, t, t.startAngle, r, a);
28122
+ let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 : jA], [d, f] = u(o[0], c), [p, m] = u(o[o.length - 1], l);
28123
+ YA(e, t, t.startAngle, d, f, "start"), YA(e, t, t.endAngle, p, m, "end");
28074
28124
  }
28075
- function UA(e, t, n) {
28125
+ function ZA(e, t, n) {
28076
28126
  let r = t.radius - t.thickness / 2;
28077
- if (r < AA) return;
28127
+ if (r < RA) return;
28078
28128
  let i = Math.max(4, t.thickness * .45);
28079
28129
  e.strokeStyle = n, e.lineCap = "butt";
28080
- for (let n = 0; n <= OA; n++) {
28081
- let a = n % kA === 0, o = t.startAngle + (t.endAngle - t.startAngle) * n / OA, s = r - i, c = s - (a ? Math.max(6, t.thickness * .55) : Math.max(3, t.thickness * .3));
28130
+ for (let n = 0; n <= IA; n++) {
28131
+ let a = n % LA === 0, o = t.startAngle + (t.endAngle - t.startAngle) * n / IA, s = r - i, c = s - (a ? Math.max(6, t.thickness * .55) : Math.max(3, t.thickness * .3));
28082
28132
  e.globalAlpha = a ? .55 : .3, e.lineWidth = a ? 1.5 : 1, e.beginPath(), e.moveTo(t.cx + Math.cos(o) * s, t.cy + Math.sin(o) * s), e.lineTo(t.cx + Math.cos(o) * c, t.cy + Math.sin(o) * c), e.stroke();
28083
28133
  }
28084
28134
  e.globalAlpha = 1;
28085
28135
  }
28086
- function WA(e, t, n, r, i) {
28136
+ function QA(e, t, n, r, i) {
28087
28137
  let a = t.cx + Math.cos(n) * t.radius, o = t.cy + Math.sin(n) * t.radius;
28088
28138
  e.beginPath(), e.arc(a, o, t.thickness * .78, 0, Math.PI * 2), e.fillStyle = r, e.fill(), e.lineWidth = Math.max(2, t.thickness * .32), e.strokeStyle = i, e.stroke();
28089
28139
  }
28090
- function GA(e, t, n, r, i) {
28140
+ function $A(e, t, n, r, i) {
28091
28141
  let a = Math.cos(n), o = Math.sin(n), s = t.radius - t.thickness * .9, c = Math.max(6, t.thickness * .6), l = Math.max(1.5, t.thickness * .14);
28092
28142
  e.beginPath(), e.moveTo(t.cx + a * s, t.cy + o * s), e.lineTo(t.cx - o * l - a * c, t.cy + a * l - o * c), e.lineTo(t.cx + o * l - a * c, t.cy - a * l - o * c), e.closePath(), e.fillStyle = r, e.fill(), e.beginPath(), e.arc(t.cx, t.cy, Math.max(4, t.thickness * .42), 0, Math.PI * 2), e.fill(), e.lineWidth = 2, e.strokeStyle = i, e.stroke();
28093
28143
  }
28094
- function KA(e, t, n, r, i, a, o) {
28144
+ function ej(e, t, n, r, i, a, o) {
28095
28145
  e.font = `${n} ${r}px ${i}`;
28096
28146
  let s = e.measureText(t).width;
28097
28147
  if (s <= a) return r;
28098
28148
  let c = Math.floor(r * a / s);
28099
28149
  return c < o ? 0 : (e.font = `${n} ${c}px ${i}`, c);
28100
28150
  }
28101
- function qA(e, t, n, r, i, a, o) {
28151
+ function tj(e, t, n, r, i, a, o) {
28102
28152
  let s = a.font.family, c = (t.radius - t.thickness / 2) * 1.3, l = a.font.sizeSmall;
28103
28153
  e.textAlign = "center", e.textBaseline = "middle";
28104
- let u = KA(e, n, "600", t.valueSize, s, c, l);
28154
+ let u = ej(e, n, "600", t.valueSize, s, c, l);
28105
28155
  if (u === 0) return;
28106
28156
  let d = o ? Math.min(t.cy + u * .8, t.textBottom - u / 2) : t.valueY;
28107
28157
  e.fillStyle = a.text, e.fillText(n, t.cx, d);
28108
28158
  let f = Math.max(l, Math.round(u * .26));
28109
28159
  if (i?.label && !o) {
28110
28160
  let n = i.label.toUpperCase();
28111
- KA(e, n, "600", f, s, c * .9, l) > 0 && (e.fillStyle = i.color, e.fillText(n, t.cx, d - u * .78));
28161
+ ej(e, n, "600", f, s, c * .9, l) > 0 && (e.fillStyle = i.color, e.fillText(n, t.cx, d - u * .78));
28112
28162
  }
28113
28163
  if (r) {
28114
28164
  let n = d + u * .72;
28115
- n + f / 2 <= t.textBottom && KA(e, r, "400", f, s, c, l) > 0 && (e.fillStyle = a.textSecondary, e.fillText(r, t.cx, n));
28165
+ n + f / 2 <= t.textBottom && ej(e, r, "400", f, s, c, l) > 0 && (e.fillStyle = a.textSecondary, e.fillText(r, t.cx, n));
28116
28166
  }
28117
28167
  }
28118
- function JA(e, t, n, r) {
28168
+ function nj(e, t, n, r) {
28119
28169
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall + 1}px ${r.font.family}`;
28120
28170
  let i = t.thickness / 2 + 6;
28121
28171
  for (let [r, a] of [[t.startAngle, t.min], [t.endAngle, t.max]]) {
@@ -28123,24 +28173,24 @@ function JA(e, t, n, r) {
28123
28173
  s > .2 ? (e.textAlign = "center", e.textBaseline = "top", e.fillText(n(a), c, l + i)) : (e.textAlign = o < -.2 ? "right" : o > .2 ? "left" : "center", e.textBaseline = s < -.2 ? "bottom" : "middle", e.fillText(n(a), c + o * i, l + s * i));
28124
28174
  }
28125
28175
  }
28126
- function YA(e, t, n, r) {
28176
+ function rj(e, t, n, r) {
28127
28177
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textBaseline = "middle";
28128
28178
  let i = t.radius + t.thickness / 2 + 8;
28129
28179
  for (let r of n) {
28130
28180
  if (!r.label) continue;
28131
- let n = LA((jA(r.from, t.min, t.max) + jA(r.to, t.min, t.max)) / 2, t), a = Math.cos(n);
28181
+ let n = GA((zA(r.from, t.min, t.max) + zA(r.to, t.min, t.max)) / 2, t), a = Math.cos(n);
28132
28182
  e.textAlign = a < -.2 ? "right" : a > .2 ? "left" : "center", e.fillText(r.label, t.cx + a * i, t.cy + Math.sin(n) * i);
28133
28183
  }
28134
28184
  }
28135
- function XA(e, t, n, r, i, a) {
28185
+ function ij(e, t, n, r, i, a) {
28136
28186
  if (t <= 0 || n <= 0) return;
28137
- let o = IA(t, n, r), s = Number.isFinite(a), c = s ? jA(a, o.min, o.max) : o.min, l = LA(c, o), u = s ? RA(c, r.zones) : void 0, d = r.pointer === "needle", f = r.valueFormat ?? MA, p = u?.color ?? r.needleColor ?? i.lineColor;
28138
- e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n), HA(e, o, r.zones, l, r.trackColor ?? i.grid, p), UA(e, o, i.textSecondary), s && (d ? GA(e, o, l, r.needleColor ?? i.text, i.background) : WA(e, o, l, p, i.background)), r.showValue !== !1 && qA(e, o, s ? f(c) : "—", r.label, u, i, d), JA(e, o, f, i), r.showZoneLabels === !0 && r.zones?.length && YA(e, o, r.zones, i), e.restore();
28187
+ let o = WA(t, n, r), s = Number.isFinite(a), c = s ? zA(a, o.min, o.max) : o.min, l = GA(c, o), u = s ? KA(c, r.zones) : void 0, d = r.pointer === "needle", f = r.valueFormat ?? BA, p = u?.color ?? r.needleColor ?? i.lineColor;
28188
+ e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n), XA(e, o, r.zones, l, r.trackColor ?? i.grid, p), ZA(e, o, i.textSecondary), s && (d ? $A(e, o, l, r.needleColor ?? i.text, i.background) : QA(e, o, l, p, i.background)), r.showValue !== !1 && tj(e, o, s ? f(c) : "—", r.label, u, i, d), nj(e, o, f, i), r.showZoneLabels === !0 && r.zones?.length && rj(e, o, r.zones, i), e.restore();
28139
28189
  }
28140
28190
  //#endregion
28141
28191
  //#region src/finance/BarChartRenderer.ts
28142
- var ZA = 12, QA = .72, $A = 20, ej = .35;
28143
- function tj(e) {
28192
+ var aj = 12, oj = .72, sj = 20, cj = .35;
28193
+ function lj(e) {
28144
28194
  let t = 0, n = 0, r = e.mode === "stacked";
28145
28195
  return e.categories.forEach((i, a) => {
28146
28196
  let o = 0, s = 0;
@@ -28151,36 +28201,36 @@ function tj(e) {
28151
28201
  n = Math.max(n, o), t = Math.min(t, s);
28152
28202
  }), [t, n];
28153
28203
  }
28154
- function nj(e, t) {
28204
+ function uj(e, t) {
28155
28205
  let n = e.colorBySign;
28156
28206
  return n ? n === !0 ? {
28157
28207
  positive: t.candleUp,
28158
28208
  negative: t.candleDown
28159
28209
  } : n : null;
28160
28210
  }
28161
- function rj(e, t, n, r, i) {
28211
+ function dj(e, t, n, r, i) {
28162
28212
  let a = e.orientation === "horizontal", o = e.legend ?? e.series.length > 1 ? Cm(e.series.map((e, t) => ({
28163
28213
  label: e.name,
28164
28214
  color: xm(t, e.color)
28165
- })), t - ZA * 2, i) : null, s = ZA + (o ? o.height + 6 : 0), [c, l] = tj(e), u = um(c, l, a ? Math.max(2, Math.floor(t / 110)) : 5), d = e.valueFormat ?? J(u, e.locale), f = Math.max(0, ...u.ticks.map((e) => i(d(e), 11))), p;
28215
+ })), t - aj * 2, i) : null, s = aj + (o ? o.height + 6 : 0), [c, l] = lj(e), u = um(c, l, a ? Math.max(2, Math.floor(t / 110)) : 5), d = e.valueFormat ?? J(u, e.locale), f = Math.max(0, ...u.ticks.map((e) => i(d(e), 11))), p;
28166
28216
  if (a) {
28167
- let r = ZA + Math.min(t * ej, Math.max(0, ...e.categories.map((e) => i(e, 11)))) + 8;
28217
+ let r = aj + Math.min(t * cj, Math.max(0, ...e.categories.map((e) => i(e, 11)))) + 8;
28168
28218
  p = {
28169
28219
  x: r,
28170
28220
  y: s,
28171
- width: Math.max(1, t - r - ZA - f / 2),
28172
- height: Math.max(1, n - s - ZA - $A)
28221
+ width: Math.max(1, t - r - aj - f / 2),
28222
+ height: Math.max(1, n - s - aj - sj)
28173
28223
  };
28174
28224
  } else {
28175
- let e = ZA + f + 8;
28225
+ let e = aj + f + 8;
28176
28226
  p = {
28177
28227
  x: e,
28178
28228
  y: s,
28179
- width: Math.max(1, t - e - ZA),
28180
- height: Math.max(1, n - s - ZA - $A)
28229
+ width: Math.max(1, t - e - aj),
28230
+ height: Math.max(1, n - s - aj - sj)
28181
28231
  };
28182
28232
  }
28183
- let m = Math.max(1, e.categories.length), h = a ? p.y : p.x, g = (a ? p.height : p.width) / m, _ = g * QA, v = e.mode === "stacked", y = v ? _ : _ / Math.max(1, e.series.length), b = (e) => a ? q(u, e, p.x, p.width) : q(u, e, p.y, p.height, !0), x = b(0), S = nj(e, r), C = Array(m).fill(0), w = Array(m).fill(0), T = [];
28233
+ let m = Math.max(1, e.categories.length), h = a ? p.y : p.x, g = (a ? p.height : p.width) / m, _ = g * oj, v = e.mode === "stacked", y = v ? _ : _ / Math.max(1, e.series.length), b = (e) => a ? q(u, e, p.x, p.width) : q(u, e, p.y, p.height, !0), x = b(0), S = uj(e, r), C = Array(m).fill(0), w = Array(m).fill(0), T = [];
28184
28234
  return e.series.forEach((t, n) => {
28185
28235
  e.categories.forEach((e, r) => {
28186
28236
  let i = t.values[r];
@@ -28219,23 +28269,23 @@ function rj(e, t, n, r, i) {
28219
28269
  bandStart: h,
28220
28270
  band: g,
28221
28271
  legend: o,
28222
- legendY: ZA
28272
+ legendY: aj
28223
28273
  };
28224
28274
  }
28225
- function ij(e, t, n) {
28275
+ function fj(e, t, n) {
28226
28276
  for (let r of e.bars) if (t >= r.x - 2 && t <= r.x + r.width + 2 && n >= r.y - 2 && n <= r.y + r.height + 2) return r;
28227
28277
  return null;
28228
28278
  }
28229
- function aj(e, t, n, r) {
28279
+ function pj(e, t, n, r) {
28230
28280
  let { plot: i } = e;
28231
28281
  if (t < i.x || t > i.x + i.width || n < i.y || n > i.y + i.height) return -1;
28232
28282
  let a = e.orientation === "horizontal" ? n : t, o = Math.floor((a - e.bandStart) / e.band);
28233
28283
  return o >= 0 && o < r ? o : -1;
28234
28284
  }
28235
- function oj(e, t, n, r, i, a, o = rj(r, t, n, i, Sm(e, i))) {
28285
+ function mj(e, t, n, r, i, a, o = dj(r, t, n, i, Sm(e, i))) {
28236
28286
  let s = Sm(e, i), c = r.valueFormat ?? hm(r.locale), { plot: l, orientation: u } = o, d = u === "horizontal";
28237
- e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend, ZA, o.legendY, i), Im(e, l, o.scale, d ? "horizontal" : "vertical", i, r.valueFormat ?? J(o.scale, r.locale));
28238
- let f = a && r.crosshair !== !1 ? aj(o, a.x, a.y, r.categories.length) : -1;
28287
+ e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend, aj, o.legendY, i), Im(e, l, o.scale, d ? "horizontal" : "vertical", i, r.valueFormat ?? J(o.scale, r.locale));
28288
+ let f = a && r.crosshair !== !1 ? pj(o, a.x, a.y, r.categories.length) : -1;
28239
28289
  if (f >= 0) {
28240
28290
  e.fillStyle = N(i.crosshair, .08);
28241
28291
  let t = o.bandStart + f * o.band;
@@ -28244,7 +28294,7 @@ function oj(e, t, n, r, i, a, o = rj(r, t, n, i, Sm(e, i))) {
28244
28294
  for (let t of o.bars) e.fillStyle = t.color, e.fillRect(t.x, t.y, Math.max(t.width, +!!d), Math.max(t.height, +!d));
28245
28295
  e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath();
28246
28296
  let p = Math.round(o.zero) + .5;
28247
- if (d ? (e.moveTo(p, l.y), e.lineTo(p, l.y + l.height)) : (e.moveTo(l.x, p), e.lineTo(l.x + l.width, p)), e.stroke(), sj(e, r.categories, o, i, s), r.showValues && cj(e, o, i, c, r.mode === "stacked"), f >= 0 && a) {
28297
+ if (d ? (e.moveTo(p, l.y), e.lineTo(p, l.y + l.height)) : (e.moveTo(l.x, p), e.lineTo(l.x + l.width, p)), e.stroke(), hj(e, r.categories, o, i, s), r.showValues && gj(e, o, i, c, r.mode === "stacked"), f >= 0 && a) {
28248
28298
  let s = [{
28249
28299
  text: r.categories[f],
28250
28300
  bold: !0
@@ -28262,17 +28312,17 @@ function oj(e, t, n, r, i, a, o = rj(r, t, n, i, Sm(e, i))) {
28262
28312
  }
28263
28313
  return o;
28264
28314
  }
28265
- function sj(e, t, n, r, i) {
28315
+ function hj(e, t, n, r, i) {
28266
28316
  let { plot: a } = n;
28267
28317
  e.save(), e.font = Y(r, 11), e.fillStyle = r.axisLabel;
28268
28318
  let o = Math.max(0, ...t.map((e) => i(e, 11))), s = n.orientation === "vertical" ? Math.max(1, Math.ceil((o + 8) / Math.max(1, n.band))) : 1;
28269
28319
  t.forEach((t, r) => {
28270
28320
  if (r % s !== 0) return;
28271
28321
  let o = n.bandStart + (r + .5) * n.band;
28272
- n.orientation === "horizontal" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(Lm(t, a.x - ZA - 8, i), a.x - 8, o)) : (e.textAlign = "center", e.textBaseline = "top", e.fillText(Lm(t, n.band * s - 4, i), o, a.y + a.height + 6));
28322
+ n.orientation === "horizontal" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(Lm(t, a.x - aj - 8, i), a.x - 8, o)) : (e.textAlign = "center", e.textBaseline = "top", e.fillText(Lm(t, n.band * s - 4, i), o, a.y + a.height + 6));
28273
28323
  }), e.restore();
28274
28324
  }
28275
- function cj(e, t, n, r, i) {
28325
+ function gj(e, t, n, r, i) {
28276
28326
  e.save(), e.font = Y(n, 10), e.fillStyle = n.textSecondary;
28277
28327
  for (let n of t.bars) {
28278
28328
  let a = r(n.value);
@@ -28290,14 +28340,14 @@ function cj(e, t, n, r, i) {
28290
28340
  }
28291
28341
  //#endregion
28292
28342
  //#region src/finance/DonutRenderer.ts
28293
- var lj = 12, uj = -Math.PI / 2, dj = Math.PI * 2, fj = 5, pj = 1.4, mj = 18;
28294
- function hj(e, t, n, r, i) {
28343
+ var _j = 12, vj = -Math.PI / 2, yj = Math.PI * 2, bj = 5, xj = 1.4, Sj = 18;
28344
+ function Cj(e, t, n, r, i) {
28295
28345
  let a = e.data.filter((e) => Number.isFinite(e.value) && e.value > 0), o = a.reduce((e, t) => e + t.value, 0), s = a.map((t, n) => ({
28296
28346
  label: `${t.label} ${gm(e.locale)(t.value / o)}`,
28297
28347
  color: xm(n, t.color)
28298
- })), c = e.legend !== !1 && a.length > 0, l = c && t >= n * pj && a.length * mj <= n - lj * 2, u = l ? Math.min(t * .4, Math.max(...s.map((e) => i(e.label, 11))) + 16) : t - lj * 2, d = c ? Cm(s, u, i, l) : null, f = l ? t - u - lj * 3 : t - lj * 2, p = l ? n - lj * 2 : n - lj * 3 - (d?.height ?? 0), m = Math.max(0, Math.min(f, p) / 2 - fj), h = lj + f / 2, g = lj + p / 2, _ = e.innerRadius, v = Math.min(.95, Math.max(0, _ !== void 0 && Number.isFinite(_) ? _ : .6)), y = uj, b = a.map((e, t) => {
28348
+ })), c = e.legend !== !1 && a.length > 0, l = c && t >= n * xj && a.length * Sj <= n - _j * 2, u = l ? Math.min(t * .4, Math.max(...s.map((e) => i(e.label, 11))) + 16) : t - _j * 2, d = c ? Cm(s, u, i, l) : null, f = l ? t - u - _j * 3 : t - _j * 2, p = l ? n - _j * 2 : n - _j * 3 - (d?.height ?? 0), m = Math.max(0, Math.min(f, p) / 2 - bj), h = _j + f / 2, g = _j + p / 2, _ = e.innerRadius, v = Math.min(.95, Math.max(0, _ !== void 0 && Number.isFinite(_) ? _ : .6)), y = vj, b = a.map((e, t) => {
28299
28349
  let n = e.value / o, r = y;
28300
- return y += n * dj, {
28350
+ return y += n * yj, {
28301
28351
  label: e.label,
28302
28352
  value: e.value,
28303
28353
  share: n,
@@ -28315,26 +28365,26 @@ function hj(e, t, n, r, i) {
28315
28365
  total: o,
28316
28366
  slices: b,
28317
28367
  legend: d,
28318
- legendX: l ? t - u - lj : lj,
28319
- legendY: l ? Math.max(lj, g - (d?.height ?? 0) / 2) : lj * 2 + p
28368
+ legendX: l ? t - u - _j : _j,
28369
+ legendY: l ? Math.max(_j, g - (d?.height ?? 0) / 2) : _j * 2 + p
28320
28370
  };
28321
28371
  }
28322
- function gj(e, t, n) {
28372
+ function wj(e, t, n) {
28323
28373
  let r = t - e.cx, i = n - e.cy, a = Math.hypot(r, i);
28324
- if (a < e.inner || a > e.radius + fj) return null;
28374
+ if (a < e.inner || a > e.radius + bj) return null;
28325
28375
  let o = Math.atan2(i, r);
28326
- for (; o < uj;) o += dj;
28376
+ for (; o < vj;) o += yj;
28327
28377
  return e.slices.find((e) => o >= e.start && o < e.end) ?? null;
28328
28378
  }
28329
- function _j(e, t, n, r, i, a, o = hj(r, t, n, i, Sm(e, i))) {
28379
+ function Tj(e, t, n, r, i, a, o = Cj(r, t, n, i, Sm(e, i))) {
28330
28380
  let s = Sm(e, i), c = r.valueFormat ?? hm(r.locale);
28331
28381
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
28332
- let l = a && r.crosshair !== !1 ? gj(o, a.x, a.y) : null, { cx: u, cy: d, radius: f, inner: p } = o;
28382
+ let l = a && r.crosshair !== !1 ? wj(o, a.x, a.y) : null, { cx: u, cy: d, radius: f, inner: p } = o;
28333
28383
  for (let t of o.slices) {
28334
- let n = (t.start + t.end) / 2, r = t === l ? fj : 0, a = u + Math.cos(n) * r, s = d + Math.sin(n) * r;
28384
+ let n = (t.start + t.end) / 2, r = t === l ? bj : 0, a = u + Math.cos(n) * r, s = d + Math.sin(n) * r;
28335
28385
  e.beginPath(), e.arc(a, s, f, t.start, t.end), p > 0 ? e.arc(a, s, p, t.end, t.start, !0) : e.lineTo(a, s), e.closePath(), e.fillStyle = t.color, e.fill(), o.slices.length > 1 && (e.strokeStyle = i.background, e.lineWidth = 1.5, e.stroke());
28336
28386
  }
28337
- return r.showLabels !== !1 && vj(e, o, i, r.locale), yj(e, o, r, i, s), o.legend && wm(e, o.legend, o.legendX, o.legendY, i), l && a && Tm(e, [{
28387
+ return r.showLabels !== !1 && Ej(e, o, i, r.locale), Dj(e, o, r, i, s), o.legend && wm(e, o.legend, o.legendX, o.legendY, i), l && a && Tm(e, [{
28338
28388
  text: l.label,
28339
28389
  bold: !0,
28340
28390
  color: l.color
@@ -28345,7 +28395,7 @@ function _j(e, t, n, r, i, a, o = hj(r, t, n, i, Sm(e, i))) {
28345
28395
  height: n
28346
28396
  }, i), o;
28347
28397
  }
28348
- function vj(e, t, n, r) {
28398
+ function Ej(e, t, n, r) {
28349
28399
  let { cx: i, cy: a, radius: o, inner: s } = t, c = s > 0 ? (o + s) / 2 : o * .62;
28350
28400
  e.save(), e.font = Y(n, 11, "600"), e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = "#fff";
28351
28401
  for (let n of t.slices) {
@@ -28356,7 +28406,7 @@ function vj(e, t, n, r) {
28356
28406
  }
28357
28407
  e.restore();
28358
28408
  }
28359
- function yj(e, t, n, r, i) {
28409
+ function Dj(e, t, n, r, i) {
28360
28410
  if (t.inner <= 0 || !n.centerLabel && !n.centerValue) return;
28361
28411
  let a = t.inner * 1.6;
28362
28412
  if (e.save(), e.textAlign = "center", e.textBaseline = "middle", n.centerValue) {
@@ -28367,28 +28417,28 @@ function yj(e, t, n, r, i) {
28367
28417
  }
28368
28418
  //#endregion
28369
28419
  //#region src/finance/ScatterRenderer.ts
28370
- var bj = 12, xj = 5, Sj = 3, Cj = 18, wj = 20, Tj = 6;
28371
- function Ej(e, t, n, r, i) {
28420
+ var Oj = 12, kj = 5, Aj = 3, jj = 18, Mj = 20, Nj = 6;
28421
+ function Pj(e, t, n, r, i) {
28372
28422
  let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
28373
28423
  for (let t of e.series) for (let e of t.points) !Number.isFinite(e.x) || !Number.isFinite(e.y) || (e.x < a && (a = e.x), e.x > o && (o = e.x), e.y < s && (s = e.y), e.y > c && (c = e.y), e.size !== void 0 && Number.isFinite(e.size) && e.size > l && (l = e.size));
28374
- let u = e.maxRadius ?? 24, d = u + Tj, f = (e, t, n) => {
28424
+ let u = e.maxRadius ?? 24, d = u + Nj, f = (e, t, n) => {
28375
28425
  if (e > t) return [0, 1];
28376
28426
  let r = (t - e) * d / Math.max(1, n - d * 2);
28377
28427
  return [e >= 0 ? Math.max(0, e - r) : e - r, t <= 0 ? Math.min(0, t + r) : t + r];
28378
28428
  }, p = um(...f(a, o, t * .8), Math.max(2, Math.floor(t / 110))), m = um(...f(s, c, n * .7), 5), h = e.xFormat ?? J(p, e.locale), g = e.yFormat ?? J(m, e.locale), _ = e.legend ?? e.series.length > 1 ? Cm(e.series.map((e, t) => ({
28379
28429
  label: e.name,
28380
28430
  color: xm(t, e.color)
28381
- })), t - bj * 2, i) : null, v = bj + (_ ? _.height + 6 : 0), y = Math.max(0, ...m.ticks.map((e) => i(g(e), 11))), b = bj + (e.yLabel ? Cj : 0) + y + 8, x = bj + wj + (e.xLabel ? Cj : 0), S = i(h(p.max), 11) / 2, C = {
28431
+ })), t - Oj * 2, i) : null, v = Oj + (_ ? _.height + 6 : 0), y = Math.max(0, ...m.ticks.map((e) => i(g(e), 11))), b = Oj + (e.yLabel ? jj : 0) + y + 8, x = Oj + Mj + (e.xLabel ? jj : 0), S = i(h(p.max), 11) / 2, C = {
28382
28432
  x: b,
28383
28433
  y: v,
28384
- width: Math.max(1, t - b - bj - S),
28434
+ width: Math.max(1, t - b - Oj - S),
28385
28435
  height: Math.max(1, n - v - x)
28386
28436
  }, w = [];
28387
28437
  return e.series.forEach((e, t) => {
28388
28438
  let n = xm(t, e.color), r = N(n, .55), i = N(n, .85);
28389
28439
  for (let t of e.points) {
28390
28440
  if (!Number.isFinite(t.x) || !Number.isFinite(t.y)) continue;
28391
- let a = t.size !== void 0 && Number.isFinite(t.size) && t.size > 0 && l > 0 ? Math.max(Sj, u * Math.sqrt(t.size / l)) : xj;
28441
+ let a = t.size !== void 0 && Number.isFinite(t.size) && t.size > 0 && l > 0 ? Math.max(Aj, u * Math.sqrt(t.size / l)) : kj;
28392
28442
  w.push({
28393
28443
  px: q(p, t.x, C.x, C.width),
28394
28444
  py: q(m, t.y, C.y, C.height, !0),
@@ -28410,18 +28460,18 @@ function Ej(e, t, n, r, i) {
28410
28460
  legend: _
28411
28461
  };
28412
28462
  }
28413
- function Dj(e, t, n) {
28463
+ function Fj(e, t, n) {
28414
28464
  let r = null, i = Infinity;
28415
28465
  for (let a of e.points) {
28416
28466
  let e = Math.hypot(a.px - t, a.py - n);
28417
- e <= a.r + Tj && e < i && (r = a, i = e);
28467
+ e <= a.r + Nj && e < i && (r = a, i = e);
28418
28468
  }
28419
28469
  return r;
28420
28470
  }
28421
- function Oj(e, t, n, r, i, a, o = Ej(r, t, n, i, Sm(e, i))) {
28471
+ function Ij(e, t, n, r, i, a, o = Pj(r, t, n, i, Sm(e, i))) {
28422
28472
  let { plot: s, xScale: c, yScale: l } = o, u = r.xFormat ?? J(c, r.locale), d = r.yFormat ?? J(l, r.locale);
28423
- e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend, bj, bj, i), Im(e, s, l, "vertical", i, d), Im(e, s, c, "horizontal", i, u), r.zeroLines !== !1 && kj(e, o, i), Aj(e, o, r, i);
28424
- let f = a && r.crosshair !== !1 ? Dj(o, a.x, a.y) : null;
28473
+ e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend, Oj, Oj, i), Im(e, s, l, "vertical", i, d), Im(e, s, c, "horizontal", i, u), r.zeroLines !== !1 && Lj(e, o, i), Rj(e, o, r, i);
28474
+ let f = a && r.crosshair !== !1 ? Fj(o, a.x, a.y) : null;
28425
28475
  e.save(), e.beginPath(), e.rect(s.x, s.y, s.width, s.height), e.clip();
28426
28476
  for (let t of o.drawOrder) {
28427
28477
  let n = o.points[t];
@@ -28447,7 +28497,7 @@ function Oj(e, t, n, r, i, a, o = Ej(r, t, n, i, Sm(e, i))) {
28447
28497
  }
28448
28498
  return o;
28449
28499
  }
28450
- function kj(e, t, n) {
28500
+ function Lj(e, t, n) {
28451
28501
  let { plot: r, xScale: i, yScale: a } = t;
28452
28502
  if (e.save(), e.strokeStyle = n.axisLine, e.lineWidth = 1, e.beginPath(), i.min < 0 && i.max > 0) {
28453
28503
  let t = Math.round(q(i, 0, r.x, r.width)) + .5;
@@ -28459,17 +28509,17 @@ function kj(e, t, n) {
28459
28509
  }
28460
28510
  e.stroke(), e.restore();
28461
28511
  }
28462
- function Aj(e, t, n, r) {
28512
+ function Rj(e, t, n, r) {
28463
28513
  let { plot: i } = t;
28464
- e.save(), e.font = Y(r, 11, "600"), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, i.x + i.width / 2, i.y + i.height + wj + Cj)), n.yLabel && (e.translate(bj + 11 / 2, i.y + i.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
28514
+ e.save(), e.font = Y(r, 11, "600"), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, i.x + i.width / 2, i.y + i.height + Mj + jj)), n.yLabel && (e.translate(Oj + 11 / 2, i.y + i.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
28465
28515
  }
28466
28516
  //#endregion
28467
28517
  //#region src/finance/HistogramRenderer.ts
28468
- var jj = 1e-9, Mj = 1e3, Nj = (e) => {
28518
+ var zj = 1e-9, Bj = 1e3, Vj = (e) => {
28469
28519
  let t = Number(e.toPrecision(12));
28470
28520
  return t === 0 ? 0 : t;
28471
28521
  };
28472
- function Pj(e, t = {}) {
28522
+ function Hj(e, t = {}) {
28473
28523
  let n = e.filter((e) => Number.isFinite(e));
28474
28524
  if (n.length === 0) return [];
28475
28525
  let r = Infinity, i = -Infinity;
@@ -28481,40 +28531,40 @@ function Pj(e, t = {}) {
28481
28531
  }];
28482
28532
  let a = t.binWidth;
28483
28533
  if (a !== void 0 && a > 0 && Number.isFinite(a)) {
28484
- let e = Math.floor(r / a + jj), t = Math.max(e, Math.ceil(i / a - jj) - 1) - e + 1;
28534
+ let e = Math.floor(r / a + zj), t = Math.max(e, Math.ceil(i / a - zj) - 1) - e + 1;
28485
28535
  if (t <= 1e3) {
28486
28536
  let r = Array.from({ length: t }, (t, n) => ({
28487
- from: Nj((e + n) * a),
28488
- to: Nj((e + n + 1) * a),
28537
+ from: Vj((e + n) * a),
28538
+ to: Vj((e + n + 1) * a),
28489
28539
  count: 0
28490
28540
  }));
28491
- for (let i of n) r[Math.min(t - 1, Math.floor(i / a + jj) - e)].count++;
28541
+ for (let i of n) r[Math.min(t - 1, Math.floor(i / a + zj) - e)].count++;
28492
28542
  return r;
28493
28543
  }
28494
28544
  }
28495
- let o = t.bins, s = typeof o == "number" && Number.isFinite(o) && o >= 1 ? Math.min(Mj, Math.floor(o)) : Math.min(Mj, Math.ceil(Math.log2(n.length)) + 1), c = (i - r) / s, l = Array.from({ length: s }, (e, t) => ({
28496
- from: Nj(r + t * c),
28497
- to: Nj(t === s - 1 ? i : r + (t + 1) * c),
28545
+ let o = t.bins, s = typeof o == "number" && Number.isFinite(o) && o >= 1 ? Math.min(Bj, Math.floor(o)) : Math.min(Bj, Math.ceil(Math.log2(n.length)) + 1), c = (i - r) / s, l = Array.from({ length: s }, (e, t) => ({
28546
+ from: Vj(r + t * c),
28547
+ to: Vj(t === s - 1 ? i : r + (t + 1) * c),
28498
28548
  count: 0
28499
28549
  }));
28500
- for (let e of n) l[Math.min(s - 1, Math.floor((e - r) / c + jj))].count++;
28550
+ for (let e of n) l[Math.min(s - 1, Math.floor((e - r) / c + zj))].count++;
28501
28551
  return l;
28502
28552
  }
28503
- var Fj = 12, Ij = 20, Lj = 16;
28504
- function Rj(e, t, n) {
28553
+ var Uj = 12, Wj = 20, Gj = 16;
28554
+ function Kj(e, t, n) {
28505
28555
  return t.colorBySign ? (e.from + e.to) / 2 < 0 ? n.candleDown : n.candleUp : t.color ?? Oe[0];
28506
28556
  }
28507
- function zj(e, t, n, r, i) {
28508
- let a = Pj(e.values, {
28557
+ function qj(e, t, n, r, i) {
28558
+ let a = Hj(e.values, {
28509
28559
  bins: e.bins,
28510
28560
  binWidth: e.binWidth
28511
28561
  }), o = a.length > 0 ? a[0].from : 0, s = a.length > 0 ? a[a.length - 1].to : 1, c = (e.markers ?? []).map((e) => e.value).filter((e) => Number.isFinite(e)), l = um(Math.min(o, ...c), Math.max(s, ...c), Math.max(2, Math.floor(t / 110))), u = 0;
28512
28562
  for (let e of a) e.count > u && (u = e.count);
28513
- let d = um(0, Math.max(4, u), 4), f = e.valueFormat ?? J(l, e.locale), p = Math.max(0, ...d.ticks.map((t) => i(J(d, e.locale)(t), 11))), m = Fj + (c.length > 0 ? Lj : 0), h = Fj + p + 8, g = Fj + i(f(l.max), 11) / 2, _ = {
28563
+ let d = um(0, Math.max(4, u), 4), f = e.valueFormat ?? J(l, e.locale), p = Math.max(0, ...d.ticks.map((t) => i(J(d, e.locale)(t), 11))), m = Uj + (c.length > 0 ? Gj : 0), h = Uj + p + 8, g = Uj + i(f(l.max), 11) / 2, _ = {
28514
28564
  x: h,
28515
28565
  y: m,
28516
28566
  width: Math.max(1, t - h - g),
28517
- height: Math.max(1, n - m - Fj - Ij)
28567
+ height: Math.max(1, n - m - Uj - Wj)
28518
28568
  };
28519
28569
  return {
28520
28570
  plot: _,
@@ -28528,22 +28578,22 @@ function zj(e, t, n, r, i) {
28528
28578
  width: Math.max(1, i - n),
28529
28579
  height: _.y + _.height - a,
28530
28580
  bin: t,
28531
- color: Rj(t, e, r)
28581
+ color: Kj(t, e, r)
28532
28582
  };
28533
28583
  }),
28534
28584
  total: a.reduce((e, t) => e + t.count, 0)
28535
28585
  };
28536
28586
  }
28537
- function Bj(e, t, n) {
28587
+ function Jj(e, t, n) {
28538
28588
  let { plot: r } = e;
28539
28589
  return n < r.y || n > r.y + r.height ? null : e.bars.find((e) => t >= e.x && t < e.x + e.width) ?? null;
28540
28590
  }
28541
- function Vj(e, t, n, r, i, a, o = zj(r, t, n, i, Sm(e, i))) {
28591
+ function Yj(e, t, n, r, i, a, o = qj(r, t, n, i, Sm(e, i))) {
28542
28592
  let s = r.valueFormat ?? hm(r.locale), { plot: c } = o;
28543
28593
  e.fillStyle = i.background, e.fillRect(0, 0, t, n), Im(e, c, o.yScale, "vertical", i, J(o.yScale, r.locale)), Im(e, c, o.xScale, "horizontal", i, r.valueFormat ?? J(o.xScale, r.locale));
28544
- let l = a && r.crosshair !== !1 ? Bj(o, a.x, a.y) : null;
28594
+ let l = a && r.crosshair !== !1 ? Jj(o, a.x, a.y) : null;
28545
28595
  for (let t of o.bars) e.fillStyle = t === l ? t.color : N(t.color, .75), e.fillRect(t.x + (t.width > 3 ? .5 : 0), t.y, Math.max(1, t.width - +(t.width > 3)), t.height);
28546
- if (Hj(e, o, r, i, s), l && a) {
28596
+ if (Xj(e, o, r, i, s), l && a) {
28547
28597
  let { bin: c } = l;
28548
28598
  Tm(e, [{
28549
28599
  text: c.to > c.from ? `${s(c.from)} – ${s(c.to)}` : s(c.from),
@@ -28558,7 +28608,7 @@ function Vj(e, t, n, r, i, a, o = zj(r, t, n, i, Sm(e, i))) {
28558
28608
  }
28559
28609
  return o;
28560
28610
  }
28561
- function Hj(e, t, n, r, i) {
28611
+ function Xj(e, t, n, r, i) {
28562
28612
  let { plot: a } = t;
28563
28613
  e.save(), e.font = Y(r, 10), e.textAlign = "center", e.textBaseline = "bottom";
28564
28614
  let o = [];
@@ -28578,8 +28628,8 @@ function Hj(e, t, n, r, i) {
28578
28628
  }
28579
28629
  //#endregion
28580
28630
  //#region src/finance/CalendarRenderer.ts
28581
- var Uj = 864e5, Wj = 3, Gj = 12, Kj = 16, qj = 10, Jj = 28, Yj = 6;
28582
- function Xj(e) {
28631
+ var Zj = 864e5, Qj = 3, $j = 12, eM = 16, tM = 10, nM = 28, rM = 6;
28632
+ function iM(e) {
28583
28633
  let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
28584
28634
  if (!t) return null;
28585
28635
  let [n, r, i] = [
@@ -28587,27 +28637,27 @@ function Xj(e) {
28587
28637
  Number(t[2]),
28588
28638
  Number(t[3])
28589
28639
  ], a = Date.UTC(n, r - 1, i), o = new Date(a);
28590
- return o.getUTCFullYear() !== n || o.getUTCMonth() !== r - 1 || o.getUTCDate() !== i ? null : Math.round(a / Uj);
28640
+ return o.getUTCFullYear() !== n || o.getUTCMonth() !== r - 1 || o.getUTCDate() !== i ? null : Math.round(a / Zj);
28591
28641
  }
28592
- function Zj(e) {
28593
- return new Date(e * Uj).toISOString().slice(0, 10);
28642
+ function aM(e) {
28643
+ return new Date(e * Zj).toISOString().slice(0, 10);
28594
28644
  }
28595
- var Qj = (e) => ((e + 4) % 7 + 7) % 7;
28596
- function $j(e, t) {
28597
- let n = e.from === void 0 ? null : Xj(e.from), r = e.to === void 0 ? null : Xj(e.to);
28645
+ var oM = (e) => ((e + 4) % 7 + 7) % 7;
28646
+ function sM(e, t) {
28647
+ let n = e.from === void 0 ? null : iM(e.from), r = e.to === void 0 ? null : iM(e.to);
28598
28648
  if (n === null || r === null) {
28599
28649
  let e = Infinity, i = -Infinity;
28600
28650
  for (let n of t.keys()) n < e && (e = n), n > i && (i = n);
28601
28651
  n ??= Number.isFinite(e) ? e : null, r ??= Number.isFinite(i) ? i : null;
28602
28652
  }
28603
28653
  if (n === null || r === null || n > r) return null;
28604
- let i = new Date(r * Uj).getUTCFullYear() - 10 + 1;
28605
- return [Math.max(n, Math.round(Date.UTC(i, 0, 1) / Uj)), r];
28654
+ let i = new Date(r * Zj).getUTCFullYear() - 10 + 1;
28655
+ return [Math.max(n, Math.round(Date.UTC(i, 0, 1) / Zj)), r];
28606
28656
  }
28607
- function eM(e, t, n) {
28657
+ function cM(e, t, n) {
28608
28658
  let r = [], i = e;
28609
28659
  for (; i <= t;) {
28610
- let e = new Date(i * Uj).getUTCFullYear(), a = Math.min(t, Math.round(Date.UTC(e, 11, 31) / Uj)), o = i - n(i);
28660
+ let e = new Date(i * Zj).getUTCFullYear(), a = Math.min(t, Math.round(Date.UTC(e, 11, 31) / Zj)), o = i - n(i);
28611
28661
  r.push({
28612
28662
  year: e,
28613
28663
  first: i,
@@ -28618,9 +28668,9 @@ function eM(e, t, n) {
28618
28668
  }
28619
28669
  return r;
28620
28670
  }
28621
- var tM = /* @__PURE__ */ new Map();
28622
- function nM(e) {
28623
- let t = e ?? "", n = tM.get(t);
28671
+ var lM = /* @__PURE__ */ new Map();
28672
+ function uM(e) {
28673
+ let t = e ?? "", n = lM.get(t);
28624
28674
  if (!n) {
28625
28675
  try {
28626
28676
  n = {
@@ -28638,20 +28688,20 @@ function nM(e) {
28638
28688
  })
28639
28689
  };
28640
28690
  } catch {
28641
- n = nM(void 0);
28691
+ n = uM(void 0);
28642
28692
  }
28643
- tM.set(t, n);
28693
+ lM.set(t, n);
28644
28694
  }
28645
28695
  return n;
28646
28696
  }
28647
- function rM(e, t, n, r, i) {
28697
+ function dM(e, t, n, r, i) {
28648
28698
  let a = /* @__PURE__ */ new Map();
28649
28699
  for (let t of e.data) {
28650
- let e = Xj(t.date);
28700
+ let e = iM(t.date);
28651
28701
  e !== null && Number.isFinite(t.value) && a.set(e, t);
28652
28702
  }
28653
- let o = nM(e.locale), s = e.dateFormat ?? ((e) => o.long.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`))), c = e.weekdays === 5, l = (e) => !c || Qj(e) >= 1 && Qj(e) <= 5, u = $j(e, a), d = t - Gj * 2, f = e.legend === !1 ? 0 : 28, p = c ? 5 : 7, m = c ? 1 : e.weekStart ?? 1, h = (e) => (Qj(e) - m + 7) % 7, g = u ? eM(u[0], u[1], h) : [], _ = (e) => n - Gj * 2 - f - e * Kj - (e - 1) * qj;
28654
- for (; g.length > 1 && _(g.length) / (g.length * p) < Wj;) g = g.slice(1);
28703
+ let o = uM(e.locale), s = e.dateFormat ?? ((e) => o.long.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`))), c = e.weekdays === 5, l = (e) => !c || oM(e) >= 1 && oM(e) <= 5, u = sM(e, a), d = t - $j * 2, f = e.legend === !1 ? 0 : 28, p = c ? 5 : 7, m = c ? 1 : e.weekStart ?? 1, h = (e) => (oM(e) - m + 7) % 7, g = u ? cM(u[0], u[1], h) : [], _ = (e) => n - $j * 2 - f - e * eM - (e - 1) * tM;
28704
+ for (; g.length > 1 && _(g.length) / (g.length * p) < Qj;) g = g.slice(1);
28655
28705
  let v = [];
28656
28706
  for (let [e, t] of a) g.length > 0 && e >= g[0].first && e <= g[g.length - 1].last && l(e) && v.push(t.value);
28657
28707
  let y = Wm(v, r, e.colorScale), b = {
@@ -28665,17 +28715,17 @@ function rM(e, t, n, r, i) {
28665
28715
  formatDate: s
28666
28716
  };
28667
28717
  if (g.length === 0 || d <= 0 || _(g.length) <= 0) return b;
28668
- let x = g.length > 1, S = g.map((e) => String(e.year)), C = Array.from({ length: p }, (e, t) => o.weekday.format(new Date((3 + m + t) * Uj))), w = Gj + Math.max(...C.map((e) => i(e, 10)), ...x ? S.map((e) => i(e, 11)) : [0]) + Yj, T = Math.max(...g.map((e) => e.weeks)), E = Math.min(Jj, (t - w - Gj) / T, _(g.length) / (g.length * p));
28718
+ let x = g.length > 1, S = g.map((e) => String(e.year)), C = Array.from({ length: p }, (e, t) => o.weekday.format(new Date((3 + m + t) * Zj))), w = $j + Math.max(...C.map((e) => i(e, 10)), ...x ? S.map((e) => i(e, 11)) : [0]) + rM, T = Math.max(...g.map((e) => e.weeks)), E = Math.min(nM, (t - w - $j) / T, _(g.length) / (g.length * p));
28669
28719
  if (!(E > 0)) return b;
28670
- let ee = E - (E >= 6 ? Math.max(1, Math.round(E * .12)) : 0), te = T * E, D = w + Math.max(0, (t - w - Gj - te) / 2), O = {
28720
+ let ee = E - (E >= 6 ? Math.max(1, Math.round(E * .12)) : 0), te = T * E, D = w + Math.max(0, (t - w - $j - te) / 2), O = {
28671
28721
  ...b,
28672
28722
  pitch: E
28673
- }, k = Gj;
28723
+ }, k = $j;
28674
28724
  for (let [e, n] of g.entries()) {
28675
- let r = k + Kj;
28725
+ let r = k + eM;
28676
28726
  x && O.years.push({
28677
28727
  label: S[e],
28678
- x: D - Yj,
28728
+ x: D - rM,
28679
28729
  y: k
28680
28730
  });
28681
28731
  let s = -1, c = -Infinity;
@@ -28686,14 +28736,14 @@ function rM(e, t, n, r, i) {
28686
28736
  x: u,
28687
28737
  y: d,
28688
28738
  size: ee,
28689
- date: Zj(e),
28739
+ date: aM(e),
28690
28740
  day: f,
28691
28741
  color: f && Number.isFinite(f.value) ? Gm(f.value, y) : null
28692
28742
  });
28693
- let p = new Date(e * Uj).getUTCMonth();
28743
+ let p = new Date(e * Zj).getUTCMonth();
28694
28744
  if (p !== s) {
28695
28745
  s = p;
28696
- let n = o.month.format(new Date(e * Uj)), r = u + i(n, 10);
28746
+ let n = o.month.format(new Date(e * Zj)), r = u + i(n, 10);
28697
28747
  u >= c && r <= t && (O.months.push({
28698
28748
  label: n,
28699
28749
  x: u,
@@ -28705,27 +28755,27 @@ function rM(e, t, n, r, i) {
28705
28755
  let e = E >= 13 ? 1 : 2;
28706
28756
  for (let t = 0; t < p; t += e) O.weekdays.push({
28707
28757
  label: C[t],
28708
- x: D - Yj,
28758
+ x: D - rM,
28709
28759
  y: r + t * E + ee / 2
28710
28760
  });
28711
28761
  }
28712
- k = r + p * E + qj;
28762
+ k = r + p * E + tM;
28713
28763
  }
28714
28764
  return f > 0 && (O.bar = {
28715
28765
  x: D,
28716
- y: k - qj + 8,
28717
- width: Math.min(te, t - D - Gj),
28766
+ y: k - tM + 8,
28767
+ width: Math.min(te, t - D - $j),
28718
28768
  height: f - 8
28719
28769
  }), O;
28720
28770
  }
28721
- function iM(e, t, n) {
28771
+ function fM(e, t, n) {
28722
28772
  for (let r of e.cells) if (t >= r.x && t < r.x + e.pitch && n >= r.y && n < r.y + e.pitch) return r;
28723
28773
  return null;
28724
28774
  }
28725
- function aM(e, t, n, r, i, a, o = rM(r, t, n, i, Sm(e, i))) {
28775
+ function pM(e, t, n, r, i, a, o = dM(r, t, n, i, Sm(e, i))) {
28726
28776
  let s = r.valueFormat ?? hm(r.locale);
28727
28777
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
28728
- let c = a && r.crosshair !== !1 ? iM(o, a.x, a.y) : null, l = N(i.textSecondary, .12), u = o.pitch >= 10 ? 2 : 0;
28778
+ let c = a && r.crosshair !== !1 ? fM(o, a.x, a.y) : null, l = N(i.textSecondary, .12), u = o.pitch >= 10 ? 2 : 0;
28729
28779
  e.save();
28730
28780
  for (let t of o.cells) e.fillStyle = t.color ?? l, e.beginPath(), u > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.size, t.size, u) : e.rect(t.x, t.y, t.size, t.size), e.fill();
28731
28781
  c && (e.strokeStyle = i.text, e.lineWidth = 1.5, e.strokeRect(c.x - .75, c.y - .75, c.size + 1.5, c.size + 1.5)), e.fillStyle = i.textSecondary, e.font = Y(i, 10), e.textAlign = "left", e.textBaseline = "top";
@@ -28753,16 +28803,16 @@ function aM(e, t, n, r, i, a, o = rM(r, t, n, i, Sm(e, i))) {
28753
28803
  }
28754
28804
  return o;
28755
28805
  }
28756
- var oM = 12, sM = 6, cM = 72, lM = Math.PI / 4, uM = Math.sin(lM);
28757
- function dM(e) {
28806
+ var mM = 12, hM = 6, gM = 72, _M = Math.PI / 4, vM = Math.sin(_M);
28807
+ function yM(e) {
28758
28808
  let t = e.length, n = Array.from({ length: t }, () => Array(t).fill(NaN));
28759
28809
  for (let r = 0; r < t; r++) for (let i = r; i < t; i++) {
28760
- let t = fM(e[r], e[i], r === i);
28810
+ let t = bM(e[r], e[i], r === i);
28761
28811
  n[r][i] = t, n[i][r] = t;
28762
28812
  }
28763
28813
  return n;
28764
28814
  }
28765
- function fM(e, t, n) {
28815
+ function bM(e, t, n) {
28766
28816
  let r = Math.min(e.length, t.length), i = 0, a = 0, o = 0;
28767
28817
  for (let n = 0; n < r; n++) Number.isFinite(e[n]) && Number.isFinite(t[n]) && (i++, a += e[n], o += t[n]);
28768
28818
  if (i < 3) return NaN;
@@ -28774,15 +28824,15 @@ function fM(e, t, n) {
28774
28824
  }
28775
28825
  return u === 0 || d === 0 ? NaN : n ? 1 : Math.max(-1, Math.min(1, l / Math.sqrt(u * d)));
28776
28826
  }
28777
- var pM = (e) => e.toFixed(2);
28778
- function mM(e, t, n, r) {
28827
+ var xM = (e) => e.toFixed(2);
28828
+ function SM(e, t, n, r) {
28779
28829
  return !t || !e ? !0 : e === "lower" ? r <= n : r >= n;
28780
28830
  }
28781
- function hM(e, t, n, r, i) {
28831
+ function CM(e, t, n, r, i) {
28782
28832
  let a = e.rows.slice(0, 200), o = (e.columns ?? e.rows).slice(0, 200), s = e.columns === void 0 || e.columns.length === e.rows.length && e.columns.every((t, n) => t === e.rows[n]), c = [];
28783
28833
  for (let t = 0; t < a.length; t++) for (let n = 0; n < o.length; n++) {
28784
28834
  let r = e.values[t]?.[n];
28785
- Number.isFinite(r) && mM(e.triangle, s, t, n) && c.push(r);
28835
+ Number.isFinite(r) && SM(e.triangle, s, t, n) && c.push(r);
28786
28836
  }
28787
28837
  let l = Wm(c, r, e.colorScale), u = {
28788
28838
  cells: [],
@@ -28800,21 +28850,21 @@ function hM(e, t, n, r, i) {
28800
28850
  at: []
28801
28851
  };
28802
28852
  if (a.length === 0 || o.length === 0 || t <= 0 || n <= 0) return u;
28803
- let d = Math.min(t * .3, Math.max(...a.map((e) => i(e, 11)))), f = Math.max(...o.map((e) => i(e, 11))), p = e.legend === !1 ? 0 : 28, m = oM + d + sM, h = t - m - oM, g = (e) => Math.min(cM, h / o.length, (n - e - oM - p) / a.length), _ = oM + 11 + sM, v = g(_), y = f > v - 4, b = f;
28804
- if (y && (b = Math.min(f, n * .33 / uM), _ = oM + b * uM + 11, v = g(_)), !(v > 0)) return u;
28853
+ let d = Math.min(t * .3, Math.max(...a.map((e) => i(e, 11)))), f = Math.max(...o.map((e) => i(e, 11))), p = e.legend === !1 ? 0 : 28, m = mM + d + hM, h = t - m - mM, g = (e) => Math.min(gM, h / o.length, (n - e - mM - p) / a.length), _ = mM + 11 + hM, v = g(_), y = f > v - 4, b = f;
28854
+ if (y && (b = Math.min(f, n * .33 / vM), _ = mM + b * vM + 11, v = g(_)), !(v > 0)) return u;
28805
28855
  let x = v - +(v >= 8), S = m + Math.max(0, (h - o.length * v) / 2);
28806
- y && (b = Math.max(0, Math.min(b, (S + x / 2 - 2 - 11 * uM / 2) / uM))), u.grid = {
28856
+ y && (b = Math.max(0, Math.min(b, (S + x / 2 - 2 - 11 * vM / 2) / vM))), u.grid = {
28807
28857
  x: S,
28808
28858
  y: _,
28809
28859
  width: o.length * v,
28810
28860
  height: a.length * v
28811
28861
  }, u.pitch = v;
28812
- let C = e.valueFormat ?? pM, w = e.showValues !== !1, T = Math.max(8, Math.min(11, v / 3));
28862
+ let C = e.valueFormat ?? xM, w = e.showValues !== !1, T = Math.max(8, Math.min(11, v / 3));
28813
28863
  for (let t = 0; t < a.length; t++) {
28814
28864
  u.at.push([]);
28815
28865
  for (let n = 0; n < o.length; n++) {
28816
28866
  let r = e.values[t]?.[n];
28817
- if (!Number.isFinite(r) || !mM(e.triangle, s, t, n)) continue;
28867
+ if (!Number.isFinite(r) || !SM(e.triangle, s, t, n)) continue;
28818
28868
  let c = Gm(r, l), d = w ? C(r) : "", f = w && v >= 18 && i(d, T) <= v - 4, p = {
28819
28869
  x: S + n * v,
28820
28870
  y: _ + t * v,
@@ -28833,42 +28883,42 @@ function hM(e, t, n, r, i) {
28833
28883
  u.cells.push(p), u.at[t][n] = p;
28834
28884
  }
28835
28885
  }
28836
- let E = Math.max(1, Math.ceil(11 / v)), ee = Math.max(1, Math.ceil(11 / (y ? v * uM : v)));
28886
+ let E = Math.max(1, Math.ceil(11 / v)), ee = Math.max(1, Math.ceil(11 / (y ? v * vM : v)));
28837
28887
  for (let e = 0; e < a.length; e += E) u.rowLabels.push({
28838
28888
  text: Lm(a[e], d, i),
28839
28889
  index: e,
28840
- x: S - sM,
28890
+ x: S - hM,
28841
28891
  y: _ + e * v + x / 2
28842
28892
  });
28843
28893
  for (let e = 0; e < o.length; e += ee) u.columnLabels.push({
28844
28894
  text: Lm(o[e], b, i),
28845
28895
  index: e,
28846
28896
  x: S + e * v + x / 2,
28847
- y: _ - sM,
28897
+ y: _ - hM,
28848
28898
  rotated: y
28849
28899
  });
28850
28900
  return p > 0 && (u.bar = {
28851
28901
  x: S,
28852
28902
  y: _ + a.length * v + 8,
28853
- width: Math.min(u.grid.width, t - S - oM),
28903
+ width: Math.min(u.grid.width, t - S - mM),
28854
28904
  height: p - 8
28855
28905
  }), u;
28856
28906
  }
28857
- function gM(e, t, n) {
28907
+ function wM(e, t, n) {
28858
28908
  let { grid: r, pitch: i } = e;
28859
28909
  return i <= 0 || t < r.x || n < r.y || t >= r.x + r.width || n >= r.y + r.height ? null : e.at[Math.floor((n - r.y) / i)]?.[Math.floor((t - r.x) / i)] ?? null;
28860
28910
  }
28861
- function _M(e, t, n, r, i, a, o = hM(r, t, n, i, Sm(e, i))) {
28862
- let s = r.valueFormat ?? pM;
28911
+ function TM(e, t, n, r, i, a, o = CM(r, t, n, i, Sm(e, i))) {
28912
+ let s = r.valueFormat ?? xM;
28863
28913
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
28864
- let c = a && r.crosshair !== !1 ? gM(o, a.x, a.y) : null;
28914
+ let c = a && r.crosshair !== !1 ? wM(o, a.x, a.y) : null;
28865
28915
  e.save();
28866
28916
  let l = Math.max(8, Math.min(11, o.pitch / 3));
28867
28917
  e.textAlign = "center", e.textBaseline = "middle", e.font = Y(i, l);
28868
28918
  for (let t of o.cells) e.fillStyle = t.color, e.fillRect(t.x, t.y, t.size, t.size), t.text && (e.fillStyle = t.textColor, e.fillText(t.text, t.x + t.size / 2, t.y + t.size / 2));
28869
28919
  c && (e.strokeStyle = i.text, e.lineWidth = 1.5, e.strokeRect(c.x + .75, c.y + .75, c.size - 1.5, c.size - 1.5)), e.font = Y(i, 11), e.fillStyle = i.textSecondary, e.textAlign = "right";
28870
28920
  for (let t of o.rowLabels) e.fillStyle = c && c.cell.rowIndex === t.index ? i.text : i.textSecondary, e.fillText(t.text, t.x, t.y);
28871
- for (let t of o.columnLabels) e.fillStyle = c && c.cell.columnIndex === t.index ? i.text : i.textSecondary, t.rotated ? (e.save(), e.translate(t.x, t.y), e.rotate(lM), e.textAlign = "right", e.fillText(t.text, 0, 0), e.restore()) : (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t.text, t.x, t.y), e.textBaseline = "middle");
28921
+ for (let t of o.columnLabels) e.fillStyle = c && c.cell.columnIndex === t.index ? i.text : i.textSecondary, t.rotated ? (e.save(), e.translate(t.x, t.y), e.rotate(_M), e.textAlign = "right", e.fillText(t.text, 0, 0), e.restore()) : (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t.text, t.x, t.y), e.textBaseline = "middle");
28872
28922
  if (e.restore(), o.bar && Ym(e, o.bar, o.scale, s, i), c && a) {
28873
28923
  let { cell: r } = c;
28874
28924
  Tm(e, [{
@@ -28886,8 +28936,8 @@ function _M(e, t, n, r, i, a, o = hM(r, t, n, i, Sm(e, i))) {
28886
28936
  }
28887
28937
  //#endregion
28888
28938
  //#region src/finance/CounterClockRenderer.ts
28889
- var vM = 12, yM = 18, bM = 20, xM = 10, SM = .2, CM = 2e3, wM = 1e-9;
28890
- function TM(e, t, n = Infinity) {
28939
+ var EM = 12, DM = 18, OM = 20, kM = 10, AM = .2, jM = 2e3, MM = 1e-9;
28940
+ function NM(e, t, n = Infinity) {
28891
28941
  let r = Number.isFinite(t) ? Math.max(1, Math.floor(t)) : 25, i = [], a = Math.max(r - 1, e.length - (Number.isFinite(n) ? Math.max(1, Math.floor(n)) : e.length));
28892
28942
  for (let t = a; t < e.length; t++) {
28893
28943
  let n = 0, a = 0;
@@ -28900,21 +28950,21 @@ function TM(e, t, n = Infinity) {
28900
28950
  }
28901
28951
  return i;
28902
28952
  }
28903
- var EM = (e, t) => t - e > wM * Math.max(Math.abs(e), Math.abs(t));
28904
- function DM(e) {
28953
+ var PM = (e, t) => t - e > MM * Math.max(Math.abs(e), Math.abs(t));
28954
+ function FM(e) {
28905
28955
  if (e.length < 2) return null;
28906
28956
  let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
28907
28957
  for (let a of e) t = Math.min(t, a.volume), n = Math.max(n, a.volume), r = Math.min(r, a.price), i = Math.max(i, a.price);
28908
- let a = e[e.length - 2], o = e[e.length - 1], s = EM(t, n) ? (o.volume - a.volume) / (n - t) : 0, c = EM(r, i) ? (o.price - a.price) / (i - r) : 0;
28958
+ let a = e[e.length - 2], o = e[e.length - 1], s = PM(t, n) ? (o.volume - a.volume) / (n - t) : 0, c = PM(r, i) ? (o.price - a.price) / (i - r) : 0;
28909
28959
  if (Math.abs(s) < 1e-6 && Math.abs(c) < 1e-6) return null;
28910
28960
  let l = (Math.atan2(c, s) + 2 * Math.PI) % (2 * Math.PI);
28911
28961
  return Math.round(l / (Math.PI / 4)) % 8 + 1;
28912
28962
  }
28913
- function OM(e, t, n, r, i) {
28914
- let a = TM(e.data, e.period ?? 25, kM(e)), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
28963
+ function IM(e, t, n, r, i) {
28964
+ let a = NM(e.data, e.period ?? 25, LM(e)), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
28915
28965
  for (let e of a) o = Math.min(o, e.volume), s = Math.max(s, e.volume), c = Math.min(c, e.price), l = Math.max(l, e.price);
28916
- a.length > 0 && !EM(o, s) && (s = o), a.length > 0 && !EM(c, l) && (l = c);
28917
- let u = um(a.length > 0 ? o : 0, a.length > 0 ? s : 1, Math.max(2, Math.floor(t / 110))), d = um(a.length > 0 ? c : 0, a.length > 0 ? l : 1, Math.max(2, Math.floor(n / 60))), f = e.priceFormat ?? J(d, e.locale), p = e.volumeFormat ?? J(u, e.locale), m = vM + Math.max(0, ...d.ticks.map((e) => i(f(e), 11))) + 8 + (e.yLabel ? yM : 0), h = vM + i(p(u.max), 11) / 2, g = vM, _ = vM + bM + (e.xLabel ? yM : 0), v = {
28966
+ a.length > 0 && !PM(o, s) && (s = o), a.length > 0 && !PM(c, l) && (l = c);
28967
+ let u = um(a.length > 0 ? o : 0, a.length > 0 ? s : 1, Math.max(2, Math.floor(t / 110))), d = um(a.length > 0 ? c : 0, a.length > 0 ? l : 1, Math.max(2, Math.floor(n / 60))), f = e.priceFormat ?? J(d, e.locale), p = e.volumeFormat ?? J(u, e.locale), m = EM + Math.max(0, ...d.ticks.map((e) => i(f(e), 11))) + 8 + (e.yLabel ? DM : 0), h = EM + i(p(u.max), 11) / 2, g = EM, _ = EM + OM + (e.xLabel ? DM : 0), v = {
28918
28968
  x: m,
28919
28969
  y: g,
28920
28970
  width: Math.max(1, t - m - h),
@@ -28927,37 +28977,37 @@ function OM(e, t, n, r, i) {
28927
28977
  points: a.map((e, t) => ({
28928
28978
  px: q(u, e.volume, v.x, v.width),
28929
28979
  py: q(d, e.price, v.y, v.height, !0),
28930
- alpha: SM + (1 - SM) * t / y,
28980
+ alpha: AM + (1 - AM) * t / y,
28931
28981
  point: e
28932
28982
  })),
28933
- phase: DM(a),
28983
+ phase: FM(a),
28934
28984
  color: e.color ?? Oe[0]
28935
28985
  };
28936
28986
  }
28937
- function kM(e) {
28987
+ function LM(e) {
28938
28988
  let t = e.points ?? 60;
28939
- return Number.isFinite(t) ? Math.min(CM, Math.max(2, Math.floor(t))) : 60;
28989
+ return Number.isFinite(t) ? Math.min(jM, Math.max(2, Math.floor(t))) : 60;
28940
28990
  }
28941
- function AM(e, t, n) {
28942
- let r = null, i = xM * xM;
28991
+ function RM(e, t, n) {
28992
+ let r = null, i = kM * kM;
28943
28993
  for (let a = e.points.length - 1; a >= 0; a--) {
28944
28994
  let o = e.points[a], s = (o.px - t) ** 2 + (o.py - n) ** 2;
28945
28995
  s < i && (r = o, i = s);
28946
28996
  }
28947
28997
  return r;
28948
28998
  }
28949
- function jM(e, t, n, r, i, a, o = OM(r, t, n, i, Sm(e, i))) {
28999
+ function zM(e, t, n, r, i, a, o = IM(r, t, n, i, Sm(e, i))) {
28950
29000
  let { plot: s, points: c, color: l } = o, u = r.timeFormat ?? _m(r.locale, {
28951
29001
  year: "numeric",
28952
29002
  month: "short",
28953
29003
  day: "numeric"
28954
29004
  }), d = r.priceFormat ?? hm(r.locale), f = r.volumeFormat ?? hm(r.locale);
28955
- e.fillStyle = i.background, e.fillRect(0, 0, t, n), Im(e, s, o.yScale, "vertical", i, r.priceFormat ?? J(o.yScale, r.locale)), Im(e, s, o.xScale, "horizontal", i, r.volumeFormat ?? J(o.xScale, r.locale)), MM(e, s, r, i), e.save(), e.lineWidth = 1.5, e.lineJoin = "round";
29005
+ e.fillStyle = i.background, e.fillRect(0, 0, t, n), Im(e, s, o.yScale, "vertical", i, r.priceFormat ?? J(o.yScale, r.locale)), Im(e, s, o.xScale, "horizontal", i, r.volumeFormat ?? J(o.xScale, r.locale)), BM(e, s, r, i), e.save(), e.lineWidth = 1.5, e.lineJoin = "round";
28956
29006
  for (let t = 1; t < c.length; t++) e.strokeStyle = N(l, c[t].alpha), e.beginPath(), e.moveTo(c[t - 1].px, c[t - 1].py), e.lineTo(c[t].px, c[t].py), e.stroke();
28957
29007
  for (let t of c) e.fillStyle = N(l, t.alpha), e.beginPath(), e.arc(t.px, t.py, 2, 0, Math.PI * 2), e.fill();
28958
29008
  let p = c[c.length - 1];
28959
29009
  p && (e.fillStyle = l, e.strokeStyle = i.background, e.lineWidth = 2, e.beginPath(), e.arc(p.px, p.py, 5, 0, Math.PI * 2), e.fill(), e.stroke()), e.restore();
28960
- let m = a && r.crosshair !== !1 ? AM(o, a.x, a.y) : null;
29010
+ let m = a && r.crosshair !== !1 ? RM(o, a.x, a.y) : null;
28961
29011
  return m && a && (e.save(), e.strokeStyle = i.text, e.lineWidth = 1.5, e.beginPath(), e.arc(m.px, m.py, 5, 0, Math.PI * 2), e.stroke(), e.restore(), Tm(e, [
28962
29012
  {
28963
29013
  text: u(m.point.time),
@@ -28973,10 +29023,10 @@ function jM(e, t, n, r, i, a, o = OM(r, t, n, i, Sm(e, i))) {
28973
29023
  height: n
28974
29024
  }, i)), o;
28975
29025
  }
28976
- function MM(e, t, n, r) {
28977
- e.save(), e.font = Y(r, 11), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, t.x + t.width / 2, t.y + t.height + bM + yM)), n.yLabel && (e.translate(vM + 4, t.y + t.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
29026
+ function BM(e, t, n, r) {
29027
+ e.save(), e.font = Y(r, 11), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, t.x + t.width / 2, t.y + t.height + OM + DM)), n.yLabel && (e.translate(EM + 4, t.y + t.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
28978
29028
  }
28979
29029
  //#endregion
28980
- export { sx as ABCDPatternTool, Il as ADXIndicator, Ru as ALMAIndicator, Fl as ATRIndicator, dn as AXIS_LABEL_HEIGHT, wu as AcceleratorOscillatorIndicator, Pu as AccumulationDistributionIndicator, Af as AccumulativeSwingIndexIndicator, Mf as AdvanceDeclineIndicator, Xp as AlertDragHandler, PD as AlertManager, xl as AlligatorIndicator, Qx as AnchoredNoteTool, Zx as AnchoredTextTool, fl as AnchoredVWAPIndicator, _b as AnchoredVWAPTool, lk as Animator, SS as ArcTool, ur as AreaRenderer, Vl as AroonIndicator, Ix as ArrowMarkTool, sb as ArrowTool, ud as AverageDayRangeIndicator, vd as AveragePriceIndicator, Al as AwesomeOscillatorIndicator, Yp as AxisDragHandler, lu as BalanceOfPowerIndicator, Xx as BalloonTool, Cn as BarCountdown, dr as BarRenderer, rC as BarsPatternTool, fk as BaseFinanceChart, mr as BaselineRenderer, sE as BinanceAdapter, Zu as BollingerBandWidthIndicator, Yc as BollingerBandsIndicator, Xu as BollingerPercentBIndicator, pw as BracketTool, hS as BrushTool, xE as BybitAdapter, of as CANDLE_PATTERNS, zl as CCIIndicator, Wl as CMFIndicator, Sn as COUNTDOWN_HEIGHT, lh as CROSSHAIR_CURSORS, Dx as CalloutTool, bn as CandlestickRenderer, Bt as CanvasLayer, jl as ChaikinOscillatorIndicator, _u as ChaikinVolatilityIndicator, qu as ChandeKrollStopIndicator, du as ChandeMomentumIndicator, bl as ChandelierExitIndicator, XE as ChartLegend, HO as ChartMarkManager, fO as ChartStateManager, If as ChopZoneIndicator, ql as ChoppinessIndexIndicator, dx as CircleTool, hE as CoinbaseAdapter, eo as CompareRenderer, pc as CompareSymbolIndicator, mc as CompareSymbolPaneIndicator, Zl as ConnorsRSIIndicator, $l as CoppockIndicator, yc as CorrelationCoefficientIndicator, bc as CorrelationLogIndicator, Ub as CrossLineTool, $m as CrosshairHandler, Dh as CrosshairTooltip, qw as CurrentPriceLine, xS as CurveTool, yx as CyclicLinesTool, ux as CypherPatternTool, YE as DEFAULT_LEGEND_CONFIG, Pt as DEFAULT_MAX_PIXEL_RATIO, ee as DEFAULT_MAX_WEBGL_CHARTS, _D as DEFAULT_SESSION_HOURS, Iu as DEMAIndicator, te as DENSE_BAR_WIDTH, Tp as DOUBLE_TAP_MS, Ep as DOUBLE_TAP_PX, Rt as DPRManager, xO as DataExporter, hx as DateAndPriceRangeTool, Xy as DateRangeTool, li as DepthHeatmapBuffer, ui as DepthHeatmapRenderer, iw as DepthOverlay, cu as DetrendedPriceOscillatorIndicator, zv as DisjointChannelTool, Du as DisparityIndexIndicator, cl as DonchianChannelIndicator, X as DrawingBase, s_ as DrawingManager, h_ as DrawingRenderer, Jc as EMAIndicator, mu as EaseOfMovementIndicator, ck as Easing, ru as ElderRayIndicator, Vy as ElliottCorrectionTool, Uy as ElliottDoubleComboTool, By as ElliottImpulseTool, Hy as ElliottTriangleTool, Wy as ElliottTripleComboTool, zy as ElliottWaveTool, oy as EllipseTool, Vw as Emitter, Tl as EnvelopeIndicator, xr as EquivolumeRenderer, zh as EventBus, kv as ExtendedLineTool, BS as FibArcsTool, Zb as FibChannelTool, zS as FibCirclesTool, ry as FibExtensionTool, ty as FibRetracementTool, ix as FibSpeedResistanceFanTool, US as FibSpiralTool, Ab as FibTimeZonesTool, VS as FibWedgeTool, pk as FinanceCrosshair, su as FisherTransformIndicator, Nx as FlagTool, Bv as FlatTopBottomTool, Xl as ForceIndexIndicator, tC as ForecastTool, Wk as GROUP_HEADER, hb as GannBoxTool, ub as GannFanTool, WS as GannSquareTool, C as GridRenderer, hd as GuppyMMAIndicator, Cr as HLCAreaRenderer, Cf as HammingMAIndicator, cx as HeadAndShouldersTool, Or as HiLoRenderer, gS as HighlighterTool, $u as HistoricalVolatilityIndicator, fr as HollowCandleRenderer, wv as HorizontalLineTool, Tv as HorizontalRayTool, hl as HullMAIndicator, Lx as ICON_GLYPHS, Kf as INDICATOR_CATEGORIES, Lc as INDICATOR_WORKER_MIN_BARS, Rs as INTERVAL_LIMITS, Ls as INTERVAL_UNITS, il as IchimokuIndicator, zx as IconTool, R as IndicatorBase, Kc as IndicatorEngine, z as IndicatorValueMap, ip as IndicatorWorkerClient, tp as IndicatorWorkerHost, op as IndicatorWorkerPool, Gb as InfoLineTool, Ip as InteractionManager, zu as KAMAIndicator, Qw as KEPT_BUCKETS, eu as KSTIndicator, gr as KagiRenderer, sl as KeltnerChannelIndicator, gh as KeyboardHandler, ou as KlingerIndicator, OE as KrakenAdapter, Bu as LSMAIndicator, Vt as LayerManager, lr as LineRenderer, Tr as LineWithMarkersRenderer, ml as LinearRegressionChannelIndicator, cd as LinearRegressionSlopeIndicator, Nl as MACDIndicator, yf as MAChannelIndicator, Wu as MACrossIndicator, Df as MADoubleIndicator, DO as MARK_BADGE_SIZE, jO as MARK_ROW_HEIGHT, gd as MARibbonIndicator, Of as MATripleIndicator, TD as MAX_ALERT_BARS, Xw as MAX_BASE_RATIO, Yw as MAX_BASE_REQUESTS, Bl as MFIIndicator, ED as MIN_ALERT_BARS, Kn as MIN_BAR_UNIT, qn as MIN_BAR_UNIT_LIMIT, vl as MTFMovingAverageIndicator, Nf as MajorityRuleIndicator, qE as ManualFeed, Jr as MarketProfileRenderer, uu as MassIndexIndicator, Vu as McGinleyDynamicIndicator, ZO as MeasureOverlay, Zy as MeasureTool, yd as MedianPriceIndicator, cE as MockAdapter, py as ModifiedSchiffPitchforkTool, Qu as MomentumIndicator, dd as NetVolumeIndicator, Ex as NoteTool, Ll as OBVIndicator, yw as OrderDraftTool, GC as OrderRenderer, zp as PRICE_AXIS_ADD_STRIP, Xn as PRICE_SCALE_MARGIN, qp as PanHandler, Zp as PaneResizeHandler, Rw as PaperExecutionAdapter, al as ParabolicSARIndicator, Mv as ParallelChannelTool, _S as PathTool, Su as PercentagePriceOscillatorIndicator, $r as PeriodLevelsRenderer, Fh as PinnedTooltip, HS as PitchfanTool, dy as PitchforkTool, ai as PivotMarkersRenderer, ul as PivotPointsIndicator, yr as PointAndFigureRenderer, dE as PollingAdapter, vS as PolylineTool, rw as PositionRenderer, ku as PrettyGoodOscillatorIndicator, on as PriceAxis, Bp as PriceAxisAddButton, sS as PriceLabelTool, xD as PriceLines, zf as PriceOscillatorIndicator, qy as PriceRangeTool, hu as PriceVolumeTrendIndicator, nC as ProjectionTool, Ou as QstickIndicator, er as RANGE_PRESETS, Hl as ROCIndicator, Ml as RSIIndicator, Ov as RayTool, Gw as ReconnectManager, ay as RectangleTool, Lv as RegressionChannelTool, Eu as RelativeMomentumIndexIndicator, vu as RelativeVigorIndicator, od as RelativeVolatilityIndexIndicator, Hn as RenderEngine, Ht as RenderLoop, hr as RenkoRenderer, HT as ReplayController, UD as ReplayManager, lT as ResamplingAdapter, so as ReshapeMemo, Hb as RiskRewardTool, Vv as RotatedRectangleTool, ok as SELECTION_BOX_MIN_SIZE, qc as SMAIndicator, Rf as SMIErgodicIndicator, Lu as SMMAIndicator, GD as SNAPSHOT_VERSION, dc as SYMBOL_INDICATOR_IDS, Zw as SYMBOL_ZONE_WAIT_MS, iu as SchaffTrendCycleIndicator, fy as SchiffPitchforkTool, aD as Screenshot, sk as SelectionBoxOverlay, uD as SessionBreaks, vD as SessionShading, yl as SessionVWAPIndicator, EO as SignalMarkerManager, Yx as SignpostTool, YS as SineLineTool, hc as SpreadIndicator, fd as StandardErrorBandsIndicator, ld as StandardErrorIndicator, Au as StdDevIndicator, wr as StepLineRenderer, Pl as StochasticIndicator, ad as StochasticMomentumIndexIndicator, yu as StochasticRSIIndicator, VT as StreamManager, ol as SupertrendIndicator, fi as SymbolSeriesStore, kl as TEMAIndicator, wp as TOUCH_REACH, fu as TRIXIndicator, Ul as TSIIndicator, Dp as TapTracker, ab as TextAnnotationTool, lx as ThreeDrivesTool, Ww as TickAggregator, mT as TickBarAdapter, pT as TickBarBuilder, bp as TimeAxis, JS as TimeCyclesTool, qO as TradeZoneManager, sw as TradingContextMenu, ow as TradingDragHandler, Fw as TradingManager, Iw as TradingRenderer, uv as TrendAngleTool, Cv as TrendLineTool, sd as TrendStrengthIndexIndicator, sy as TriangleTool, bd as TypicalPriceIndicator, NE as UPBIT_MAX_CANDLES, nd as UlcerIndexIndicator, Jl as UltimateOscillatorIndicator, pO as UndoRedoManager, RE as UpbitAdapter, kr as VOLUME_HEIGHT_RATIO, Fu as VROCIndicator, tl as VWAPIndicator, Cl as VWMAIndicator, Dv as VerticalLineTool, Qn as Viewport, kf as VolatilityIndexIndicator, Hf as VolatilityOHLCIndicator, Uf as VolatilityZeroTrendIndicator, br as VolumeCandleRenderer, Gl as VolumeDeltaIndicator, ed as VolumeOscillatorIndicator, Nu as VolumeProfileIndicator, Eb as VolumeProfileRangeTool, Nr as VolumeProfileRenderer, Ar as VolumeRenderer, Kl as VortexIndicator, wl as WMAIndicator, oD as Watermark, uE as WebSocketAdapter, gu as WilliamsADIndicator, Ku as WilliamsFractalsIndicator, Rl as WilliamsRIndicator, ox as XABCDPatternTool, pl as ZigZagIndicator, Jp as ZoomHandler, DT as adapterFromFeed, wn as alignAxisTags, Fs as alignOutput, bS as arcPoints, Kr as assignSessionLetters, J as axisFormat, vo as axisTimes, t as barIndexToTime, O as barIndexToX, d as barTimeStep, r as barTimeStepMs, xc as barsToColumns, lw as bracketRiskReward, Sm as canvasMeasure, Ft as cappedPixelRatio, S as claimGpuContext, ti as classifyPivots, Hs as cleanIntervals, Sc as columnsToBars, Mc as columnsToOutput, rj as computeBarLayout, cw as computeBracketDefaults, rM as computeCalendarLayout, OM as computeCounterClockLayout, xk as computeDepthLayout, hj as computeDonutLayout, Fk as computeEquityLayout, zj as computeHistogramLayout, Wr as computeMarketProfile, hM as computeMatrixLayout, Qr as computePeriodLevels, Ej as computeScatterLayout, qr as computeSessionProfiles, dA as computeWaterfallLayout, dM as correlationMatrix, DM as counterClockPhase, TM as counterClockPoints, np as createIndicatorWorker, yS as curvePoints, Zj as dayToIso, ym as defaultFormat, $f as describeInputs, uf as detectCandlePatterns, gn as drawAxisValueLabels, wC as drawIcon, Zg as drawingAxisSpan, ts as drawnKeys, kT as feedFromAdapter, ln as fillTag, dk as financeTheme, g_ as findDominantSwing, ni as findPivots, h as forEachPixelColumn, eC as forecastOutcome, wh as formatTooltipTime, W as getIntParam, U as getNumberParam, $n as getVisibleData, T as gpuContextsLeft, us as hasHistogram, _T as hasTrades, Pj as histogramBins, ij as hitBar, aj as hitCategory, iM as hitDay, Bj as hitHistogramBar, gM as hitMatrixCell, gj as hitSlice, fA as hitWaterfallBar, hh as idleCssCursor, Jf as indicatorCategory, un as indicatorValuePrecision, sp as indicatorWorkerPool, gw as inferOrderType, Ms as inputSource, uh as isCrosshairCursor, CT as isDataFeed, g as isDense, hD as isInWindow, OD as isPriceLevelAlert, gD as isRegularSession, Ws as isSeriesPalette, ns as isUpTone, ep as isWorkerResponse, pn as labelTextColor, hn as layoutAxisValueLabels, Gk as layoutGroupedTreemap, Cm as layoutLegend, Hk as layoutSquarifiedTreemap, Rk as layoutUniformGrid, Ps as lineSourceBars, sg as lineSpace, Wn as loadWebGL, Gn as loadWebGLRenderer, or as lttbDownsample, cr as lttbVisibleIndices, pD as mergeSessionHours, mD as minuteOfDay, AM as nearestCounterClockPoint, Dj as nearestPoint, um as niceScale, hm as numberFormat, Dc as outputToColumns, cs as paneLogRange, ss as paneValueRange, Xj as parseDay, n as pastTimeStep, gm as percentFormat, os as plotColor, as as plotLook, rs as plotShown, ko as pointAndFigureColumns, c as priceBucketRow, Ut as priceScaleText, Ns as priceSourceBars, x as priceToY, e as priceToYMapper, ar as rangePresetStart, ID as readAlertOptions, Jm as readableText, iC as registerBuiltInDrawingTools, Gf as registerBuiltInIndicators, _n as renderAxisValueLabels, oj as renderBarChart, aM as renderCalendar, jM as renderCounterClock, w as renderDenseBars, wk as renderDepthChart, _j as renderDonut, Lk as renderEquityCurve, XA as renderGauge, tA as renderHeatmap, Vj as renderHistogram, _M as renderMatrix, ds as renderPlots, Oj as renderScatter, mk as renderSparkline, gA as renderWaterfall, b as resolveBarIndex, Wm as resolveColorScale, Gm as scaleColor, aT as servesTimeframe, y as setMaxWebGLCharts, kM as shownCount, Vs as shownOnInterval, js as sourceParam, fn as spreadLabels, wT as streamAdapterOf, o as timeToX, s as timestampToBarIndex, to as toHeikinAshi, To as toKagi, wo as toLineBreak, Oo as toPointAndFigure, Jo as toRangeBars, yo as toRenko, Gr as tpoLetter, Fy as waveLabel, p as whenGpuContextFree, rT as withResampling, gT as withTickBars, l as xToBarIndex, i as xToTime, a as yToPrice };
29030
+ export { sx as ABCDPatternTool, Il as ADXIndicator, Ru as ALMAIndicator, Fl as ATRIndicator, dn as AXIS_LABEL_HEIGHT, wu as AcceleratorOscillatorIndicator, Pu as AccumulationDistributionIndicator, Af as AccumulativeSwingIndexIndicator, Mf as AdvanceDeclineIndicator, Xp as AlertDragHandler, HD as AlertManager, xl as AlligatorIndicator, Qx as AnchoredNoteTool, Zx as AnchoredTextTool, fl as AnchoredVWAPIndicator, _b as AnchoredVWAPTool, _k as Animator, SS as ArcTool, ur as AreaRenderer, Vl as AroonIndicator, Ix as ArrowMarkTool, sb as ArrowTool, ud as AverageDayRangeIndicator, vd as AveragePriceIndicator, Al as AwesomeOscillatorIndicator, Yp as AxisDragHandler, lu as BalanceOfPowerIndicator, Xx as BalloonTool, Cn as BarCountdown, dr as BarRenderer, rC as BarsPatternTool, bk as BaseFinanceChart, mr as BaselineRenderer, hE as BinanceAdapter, Zu as BollingerBandWidthIndicator, Yc as BollingerBandsIndicator, Xu as BollingerPercentBIndicator, fw as BracketTool, hS as BrushTool, kE as BybitAdapter, of as CANDLE_PATTERNS, zl as CCIIndicator, Wl as CMFIndicator, Sn as COUNTDOWN_HEIGHT, lh as CROSSHAIR_CURSORS, Dx as CalloutTool, bn as CandlestickRenderer, Bt as CanvasLayer, jl as ChaikinOscillatorIndicator, _u as ChaikinVolatilityIndicator, qu as ChandeKrollStopIndicator, du as ChandeMomentumIndicator, bl as ChandelierExitIndicator, iD as ChartLegend, XO as ChartMarkManager, bO as ChartStateManager, If as ChopZoneIndicator, ql as ChoppinessIndexIndicator, dx as CircleTool, CE as CoinbaseAdapter, eo as CompareRenderer, pc as CompareSymbolIndicator, mc as CompareSymbolPaneIndicator, Zl as ConnorsRSIIndicator, $l as CoppockIndicator, yc as CorrelationCoefficientIndicator, bc as CorrelationLogIndicator, Ub as CrossLineTool, $m as CrosshairHandler, Dh as CrosshairTooltip, tT as CurrentPriceLine, xS as CurveTool, yx as CyclicLinesTool, ux as CypherPatternTool, rD as DEFAULT_LEGEND_CONFIG, Pt as DEFAULT_MAX_PIXEL_RATIO, ee as DEFAULT_MAX_WEBGL_CHARTS, TD as DEFAULT_SESSION_HOURS, Iu as DEMAIndicator, te as DENSE_BAR_WIDTH, Tp as DOUBLE_TAP_MS, Ep as DOUBLE_TAP_PX, Rt as DPRManager, kO as DataExporter, hx as DateAndPriceRangeTool, Xy as DateRangeTool, li as DepthHeatmapBuffer, ui as DepthHeatmapRenderer, Uw as DepthOverlay, Ww as DepthOverlayLayer, cu as DetrendedPriceOscillatorIndicator, zv as DisjointChannelTool, Du as DisparityIndexIndicator, cl as DonchianChannelIndicator, X as DrawingBase, s_ as DrawingManager, h_ as DrawingRenderer, Jc as EMAIndicator, mu as EaseOfMovementIndicator, gk as Easing, ru as ElderRayIndicator, Vy as ElliottCorrectionTool, Uy as ElliottDoubleComboTool, By as ElliottImpulseTool, Hy as ElliottTriangleTool, Wy as ElliottTripleComboTool, zy as ElliottWaveTool, oy as EllipseTool, Yw as Emitter, Tl as EnvelopeIndicator, xr as EquivolumeRenderer, zh as EventBus, kv as ExtendedLineTool, BS as FibArcsTool, Zb as FibChannelTool, zS as FibCirclesTool, ry as FibExtensionTool, ty as FibRetracementTool, ix as FibSpeedResistanceFanTool, US as FibSpiralTool, Ab as FibTimeZonesTool, VS as FibWedgeTool, xk as FinanceCrosshair, su as FisherTransformIndicator, Nx as FlagTool, Bv as FlatTopBottomTool, Xl as ForceIndexIndicator, tC as ForecastTool, Qk as GROUP_HEADER, hb as GannBoxTool, ub as GannFanTool, WS as GannSquareTool, C as GridRenderer, hd as GuppyMMAIndicator, Cr as HLCAreaRenderer, Cf as HammingMAIndicator, cx as HeadAndShouldersTool, Or as HiLoRenderer, gS as HighlighterTool, $u as HistoricalVolatilityIndicator, fr as HollowCandleRenderer, wv as HorizontalLineTool, Tv as HorizontalRayTool, hl as HullMAIndicator, Lx as ICON_GLYPHS, Kf as INDICATOR_CATEGORIES, Lc as INDICATOR_WORKER_MIN_BARS, Rs as INTERVAL_LIMITS, Ls as INTERVAL_UNITS, il as IchimokuIndicator, zx as IconTool, R as IndicatorBase, Kc as IndicatorEngine, z as IndicatorValueMap, ip as IndicatorWorkerClient, tp as IndicatorWorkerHost, op as IndicatorWorkerPool, Gb as InfoLineTool, Ip as InteractionManager, zu as KAMAIndicator, oT as KEPT_BUCKETS, eu as KSTIndicator, gr as KagiRenderer, sl as KeltnerChannelIndicator, gh as KeyboardHandler, ou as KlingerIndicator, IE as KrakenAdapter, Bu as LSMAIndicator, Vt as LayerManager, lr as LineRenderer, Tr as LineWithMarkersRenderer, ml as LinearRegressionChannelIndicator, cd as LinearRegressionSlopeIndicator, Nl as MACDIndicator, yf as MAChannelIndicator, Wu as MACrossIndicator, Df as MADoubleIndicator, FO as MARK_BADGE_SIZE, zO as MARK_ROW_HEIGHT, gd as MARibbonIndicator, Of as MATripleIndicator, ND as MAX_ALERT_BARS, iT as MAX_BASE_RATIO, rT as MAX_BASE_REQUESTS, Bl as MFIIndicator, PD as MIN_ALERT_BARS, Kn as MIN_BAR_UNIT, qn as MIN_BAR_UNIT_LIMIT, vl as MTFMovingAverageIndicator, Nf as MajorityRuleIndicator, tD as ManualFeed, Jr as MarketProfileRenderer, uu as MassIndexIndicator, Vu as McGinleyDynamicIndicator, ak as MeasureOverlay, Zy as MeasureTool, yd as MedianPriceIndicator, gE as MockAdapter, py as ModifiedSchiffPitchforkTool, Qu as MomentumIndicator, dd as NetVolumeIndicator, Ex as NoteTool, Ll as OBVIndicator, vw as OrderDraftTool, GC as OrderRenderer, zp as PRICE_AXIS_ADD_STRIP, Xn as PRICE_SCALE_MARGIN, qp as PanHandler, Zp as PaneResizeHandler, Kw as PaperExecutionAdapter, al as ParabolicSARIndicator, Mv as ParallelChannelTool, _S as PathTool, Su as PercentagePriceOscillatorIndicator, $r as PeriodLevelsRenderer, Fh as PinnedTooltip, HS as PitchfanTool, dy as PitchforkTool, ai as PivotMarkersRenderer, ul as PivotPointsIndicator, yr as PointAndFigureRenderer, yE as PollingAdapter, vS as PolylineTool, rw as PositionRenderer, ku as PrettyGoodOscillatorIndicator, on as PriceAxis, Bp as PriceAxisAddButton, sS as PriceLabelTool, kD as PriceLines, zf as PriceOscillatorIndicator, qy as PriceRangeTool, hu as PriceVolumeTrendIndicator, nC as ProjectionTool, Ou as QstickIndicator, er as RANGE_PRESETS, Hl as ROCIndicator, Ml as RSIIndicator, Ov as RayTool, $w as ReconnectManager, ay as RectangleTool, Lv as RegressionChannelTool, Eu as RelativeMomentumIndexIndicator, vu as RelativeVigorIndicator, od as RelativeVolatilityIndexIndicator, Hn as RenderEngine, Ht as RenderLoop, hr as RenkoRenderer, XT as ReplayController, ZD as ReplayManager, _T as ResamplingAdapter, so as ReshapeMemo, Hb as RiskRewardTool, Vv as RotatedRectangleTool, mk as SELECTION_BOX_MIN_SIZE, qc as SMAIndicator, Rf as SMIErgodicIndicator, Lu as SMMAIndicator, $D as SNAPSHOT_VERSION, dc as SYMBOL_INDICATOR_IDS, aT as SYMBOL_ZONE_WAIT_MS, iu as SchaffTrendCycleIndicator, fy as SchiffPitchforkTool, pD as Screenshot, hk as SelectionBoxOverlay, vD as SessionBreaks, ED as SessionShading, yl as SessionVWAPIndicator, PO as SignalMarkerManager, Yx as SignpostTool, YS as SineLineTool, hc as SpreadIndicator, fd as StandardErrorBandsIndicator, ld as StandardErrorIndicator, Au as StdDevIndicator, wr as StepLineRenderer, Pl as StochasticIndicator, ad as StochasticMomentumIndexIndicator, yu as StochasticRSIIndicator, YT as StreamManager, ol as SupertrendIndicator, fi as SymbolSeriesStore, kl as TEMAIndicator, wp as TOUCH_REACH, fu as TRIXIndicator, Ul as TSIIndicator, Dp as TapTracker, ab as TextAnnotationTool, lx as ThreeDrivesTool, Qw as TickAggregator, ST as TickBarAdapter, xT as TickBarBuilder, bp as TimeAxis, JS as TimeCyclesTool, tk as TradeZoneManager, ow as TradingContextMenu, aw as TradingDragHandler, Pw as TradingManager, Fw as TradingRenderer, uv as TrendAngleTool, Cv as TrendLineTool, sd as TrendStrengthIndexIndicator, sy as TriangleTool, bd as TypicalPriceIndicator, VE as UPBIT_MAX_CANDLES, nd as UlcerIndexIndicator, Jl as UltimateOscillatorIndicator, xO as UndoRedoManager, KE as UpbitAdapter, kr as VOLUME_HEIGHT_RATIO, Fu as VROCIndicator, tl as VWAPIndicator, Cl as VWMAIndicator, Dv as VerticalLineTool, Qn as Viewport, kf as VolatilityIndexIndicator, Hf as VolatilityOHLCIndicator, Uf as VolatilityZeroTrendIndicator, br as VolumeCandleRenderer, Gl as VolumeDeltaIndicator, ed as VolumeOscillatorIndicator, Nu as VolumeProfileIndicator, Eb as VolumeProfileRangeTool, Nr as VolumeProfileRenderer, Ar as VolumeRenderer, Kl as VortexIndicator, wl as WMAIndicator, mD as Watermark, vE as WebSocketAdapter, gu as WilliamsADIndicator, Ku as WilliamsFractalsIndicator, Rl as WilliamsRIndicator, ox as XABCDPatternTool, pl as ZigZagIndicator, Jp as ZoomHandler, FT as adapterFromFeed, wn as alignAxisTags, Fs as alignOutput, bS as arcPoints, Kr as assignSessionLetters, J as axisFormat, vo as axisTimes, t as barIndexToTime, O as barIndexToX, d as barTimeStep, r as barTimeStepMs, xc as barsToColumns, cw as bracketRiskReward, Sm as canvasMeasure, Ft as cappedPixelRatio, S as claimGpuContext, ti as classifyPivots, Hs as cleanIntervals, Sc as columnsToBars, Mc as columnsToOutput, dj as computeBarLayout, sw as computeBracketDefaults, dM as computeCalendarLayout, IM as computeCounterClockLayout, kk as computeDepthLayout, Cj as computeDonutLayout, Uk as computeEquityLayout, qj as computeHistogramLayout, Wr as computeMarketProfile, CM as computeMatrixLayout, Qr as computePeriodLevels, Pj as computeScatterLayout, qr as computeSessionProfiles, yA as computeWaterfallLayout, yM as correlationMatrix, FM as counterClockPhase, NM as counterClockPoints, np as createIndicatorWorker, yS as curvePoints, aM as dayToIso, ym as defaultFormat, Vw as depthBars, $f as describeInputs, uf as detectCandlePatterns, gn as drawAxisValueLabels, wC as drawIcon, Zg as drawingAxisSpan, ts as drawnKeys, LT as feedFromAdapter, ln as fillTag, yk as financeTheme, g_ as findDominantSwing, ni as findPivots, h as forEachPixelColumn, eC as forecastOutcome, wh as formatTooltipTime, W as getIntParam, U as getNumberParam, $n as getVisibleData, T as gpuContextsLeft, us as hasHistogram, TT as hasTrades, Hj as histogramBins, fj as hitBar, pj as hitCategory, fM as hitDay, Jj as hitHistogramBar, wM as hitMatrixCell, wj as hitSlice, bA as hitWaterfallBar, hh as idleCssCursor, Jf as indicatorCategory, un as indicatorValuePrecision, sp as indicatorWorkerPool, hw as inferOrderType, Ms as inputSource, uh as isCrosshairCursor, jT as isDataFeed, g as isDense, CD as isInWindow, ID as isPriceLevelAlert, wD as isRegularSession, Ws as isSeriesPalette, ns as isUpTone, ep as isWorkerResponse, pn as labelTextColor, hn as layoutAxisValueLabels, $k as layoutGroupedTreemap, Cm as layoutLegend, Xk as layoutSquarifiedTreemap, Kk as layoutUniformGrid, Ps as lineSourceBars, sg as lineSpace, Wn as loadWebGL, Gn as loadWebGLRenderer, or as lttbDownsample, cr as lttbVisibleIndices, xD as mergeSessionHours, SD as minuteOfDay, RM as nearestCounterClockPoint, Fj as nearestPoint, um as niceScale, hm as numberFormat, Dc as outputToColumns, cs as paneLogRange, ss as paneValueRange, iM as parseDay, n as pastTimeStep, gm as percentFormat, os as plotColor, as as plotLook, rs as plotShown, ko as pointAndFigureColumns, c as priceBucketRow, Ut as priceScaleText, Ns as priceSourceBars, x as priceToY, e as priceToYMapper, ar as rangePresetStart, WD as readAlertOptions, Jm as readableText, iC as registerBuiltInDrawingTools, Gf as registerBuiltInIndicators, _n as renderAxisValueLabels, mj as renderBarChart, pM as renderCalendar, zM as renderCounterClock, w as renderDenseBars, Mk as renderDepthChart, Tj as renderDonut, Gk as renderEquityCurve, ij as renderGauge, lA as renderHeatmap, Yj as renderHistogram, TM as renderMatrix, ds as renderPlots, Ij as renderScatter, Sk as renderSparkline, wA as renderWaterfall, b as resolveBarIndex, Wm as resolveColorScale, Gm as scaleColor, pT as servesTimeframe, y as setMaxWebGLCharts, LM as shownCount, Vs as shownOnInterval, js as sourceParam, fn as spreadLabels, MT as streamAdapterOf, o as timeToX, s as timestampToBarIndex, to as toHeikinAshi, To as toKagi, wo as toLineBreak, Oo as toPointAndFigure, Jo as toRangeBars, yo as toRenko, Gr as tpoLetter, Fy as waveLabel, p as whenGpuContextFree, dT as withResampling, wT as withTickBars, l as xToBarIndex, i as xToTime, a as yToPrice };
28981
29031
 
28982
29032
  //# sourceMappingURL=index.js.map