@363045841yyt/klinechart 0.5.0 → 0.5.2

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
@@ -8891,6 +8891,14 @@ var Ls = class {
8891
8891
  hoveredSeparatorUpperPaneId = null;
8892
8892
  hoveredRightAxisPaneId = null;
8893
8893
  isTouchSession = !1;
8894
+ activePointers = /* @__PURE__ */ new Map();
8895
+ lastPinchDistance = 0;
8896
+ pinchCenter = {
8897
+ x: 0,
8898
+ y: 0
8899
+ };
8900
+ isPinching = !1;
8901
+ onPinchZoomCallback;
8894
8902
  crosshairPos = null;
8895
8903
  crosshairIndex = null;
8896
8904
  crosshairPrice = null;
@@ -8922,6 +8930,9 @@ var Ls = class {
8922
8930
  constructor(e) {
8923
8931
  this.chart = e;
8924
8932
  }
8933
+ setOnPinchZoom(e) {
8934
+ this.onPinchZoomCallback = e;
8935
+ }
8925
8936
  getInteractionSnapshot() {
8926
8937
  return {
8927
8938
  crosshairPos: this.crosshairPos ? { ...this.crosshairPos } : null,
@@ -8947,8 +8958,19 @@ var Ls = class {
8947
8958
  this.onInteractionChangeCallback?.(this.getInteractionSnapshot());
8948
8959
  }
8949
8960
  onPointerDown(e) {
8950
- if (e.isPrimary === !1) return;
8951
- this.isTouchSession = e.pointerType === "touch";
8961
+ if (this.isTouchSession = e.pointerType === "touch", this.activePointers.set(e.pointerId, {
8962
+ x: e.clientX,
8963
+ y: e.clientY
8964
+ }), this.activePointers.size === 2 && this.isTouchSession) {
8965
+ this.isPinching = !0, this.isDragging = !1, this.dragMode = "none";
8966
+ let e = Array.from(this.activePointers.values()), t = e[0], n = e[1];
8967
+ this.lastPinchDistance = Math.hypot(n.x - t.x, n.y - t.y), this.pinchCenter = {
8968
+ x: (t.x + n.x) / 2,
8969
+ y: (t.y + n.y) / 2
8970
+ };
8971
+ return;
8972
+ }
8973
+ if (e.isPrimary === !1 || this.isPinching || this.activePointers.size > 1) return;
8952
8974
  let t = this.getPlotPointerLocation(e.clientX, e.clientY);
8953
8975
  if (!t) return;
8954
8976
  let n = this.chart.getDom().container, { mouseX: r, mouseY: i } = t, a = n.scrollLeft, o = this.chart.getMarkerManager(), s = a + r, c = o.hitTest(s, i, 3);
@@ -8971,15 +8993,26 @@ var Ls = class {
8971
8993
  this.useTooltipAnchorPositioning = e;
8972
8994
  }
8973
8995
  onPointerUp(e) {
8974
- e.isPrimary !== !1 && (this.isDragging = !1, this.dragMode = "none", this.activePaneIdOnDrag = null, this.activeSeparatorUpperPaneId = null, this.notifyInteractionChange());
8996
+ this.activePointers.delete(e.pointerId), this.isPinching && this.activePointers.size < 2 && (this.isPinching = !1, this.lastPinchDistance = 0), e.isPrimary !== !1 && (this.isDragging = !1, this.dragMode = "none", this.activePaneIdOnDrag = null, this.activeSeparatorUpperPaneId = null, this.notifyInteractionChange());
8975
8997
  }
8976
8998
  onPointerLeave(e) {
8977
- e.isPrimary !== !1 && (this.isDragging = !1, this.dragMode = "none", this.activePaneIdOnDrag = null, this.clearSeparatorState(), this.isTouchSession = !1, this.clearHover(), this.chart.scheduleDraw(), this.notifyInteractionChange());
8999
+ this.activePointers.delete(e.pointerId), this.activePointers.size < 2 && (this.isPinching = !1, this.lastPinchDistance = 0), e.isPrimary !== !1 && (this.isDragging = !1, this.dragMode = "none", this.activePaneIdOnDrag = null, this.clearSeparatorState(), this.isTouchSession = !1, this.clearHover(), this.chart.scheduleDraw(), this.notifyInteractionChange());
8978
9000
  }
8979
9001
  onScroll() {
8980
9002
  this.kLinePositions = null, this.visibleRange = null, this.clearHover(), this.chart.scheduleDraw(), this.notifyInteractionChange();
8981
9003
  }
8982
9004
  onPointerMove(e) {
9005
+ if (this.activePointers.has(e.pointerId) && this.activePointers.set(e.pointerId, {
9006
+ x: e.clientX,
9007
+ y: e.clientY
9008
+ }), this.isPinching && this.activePointers.size === 2) {
9009
+ let e = Array.from(this.activePointers.values()), t = e[0], n = e[1], r = Math.hypot(n.x - t.x, n.y - t.y), i = r - this.lastPinchDistance;
9010
+ if (Math.abs(i) > 10) {
9011
+ let e = i > 0 ? 1 : -1, a = (t.x + n.x) / 2;
9012
+ this.onPinchZoomCallback?.(e, a), this.lastPinchDistance = r;
9013
+ }
9014
+ return;
9015
+ }
8983
9016
  if (!e.isPrimary) return;
8984
9017
  e.pointerType === "touch" && (this.isTouchSession = !0);
8985
9018
  let t = this.chart.getDom().container;
@@ -9172,7 +9205,7 @@ var Ls = class {
9172
9205
  };
9173
9206
  }
9174
9207
  reset() {
9175
- this.isDragging = !1, this.dragMode = "none", this.dragStartX = 0, this.dragStartY = 0, this.scrollStartX = 0, this.activePaneIdOnDrag = null, this.clearSeparatorState(), this.isTouchSession = !1, this.crosshairPos = null, this.crosshairIndex = null, this.crosshairPrice = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId = null, this.clickedMarkerId = null, this.hoveredMarkerData = null, this.clickedMarkerData = null, this.hoveredCustomMarker = null, this.kLinePositions = null, this.visibleRange = null, this.kWidthPx = null;
9208
+ this.isDragging = !1, this.dragMode = "none", this.dragStartX = 0, this.dragStartY = 0, this.scrollStartX = 0, this.activePaneIdOnDrag = null, this.clearSeparatorState(), this.isTouchSession = !1, this.activePointers.clear(), this.isPinching = !1, this.lastPinchDistance = 0, this.crosshairPos = null, this.crosshairIndex = null, this.crosshairPrice = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId = null, this.clickedMarkerId = null, this.hoveredMarkerData = null, this.clickedMarkerData = null, this.hoveredCustomMarker = null, this.kLinePositions = null, this.visibleRange = null, this.kWidthPx = null;
9176
9209
  }
9177
9210
  getCrosshairIndex() {
9178
9211
  return this.crosshairIndex;
@@ -10907,7 +10940,7 @@ function Uc(e) {
10907
10940
  var Wc = 8, Gc = 6, Kc = class e {
10908
10941
  chart;
10909
10942
  activeTool = "cursor";
10910
- pendingAnchor = null;
10943
+ pendingAnchors = [];
10911
10944
  drawings = [];
10912
10945
  callbacks = {};
10913
10946
  previewDrawingId = "__preview__";
@@ -10922,7 +10955,13 @@ var Wc = 8, Gc = 6, Kc = class e {
10922
10955
  static DOUBLE_ANCHOR_TOOLS = [
10923
10956
  "trend-line",
10924
10957
  "ray",
10925
- "info-line"
10958
+ "info-line",
10959
+ "regression-channel"
10960
+ ];
10961
+ static TRIPLE_ANCHOR_TOOLS = [
10962
+ "parallel-channel",
10963
+ "flat-line",
10964
+ "disjoint-channel"
10926
10965
  ];
10927
10966
  constructor(e) {
10928
10967
  this.chart = e;
@@ -10934,7 +10973,7 @@ var Wc = 8, Gc = 6, Kc = class e {
10934
10973
  return this.activeTool;
10935
10974
  }
10936
10975
  setTool(e) {
10937
- this.activeTool = e, this.pendingAnchor = null, this.removePreview(), this.dragState = null, this.setSelected(null), this.callbacks.onToolChange?.(e);
10976
+ this.activeTool = e, this.pendingAnchors = [], this.removePreview(), this.dragState = null, this.setSelected(null), this.callbacks.onToolChange?.(e);
10938
10977
  }
10939
10978
  getDrawings() {
10940
10979
  return this.drawings;
@@ -10943,7 +10982,7 @@ var Wc = 8, Gc = 6, Kc = class e {
10943
10982
  this.drawings = e, this.chart.setDrawings(e);
10944
10983
  }
10945
10984
  clear() {
10946
- this.pendingAnchor = null, this.removePreview(), this.dragState = null, this.setSelected(null);
10985
+ this.pendingAnchors = [], this.removePreview(), this.dragState = null, this.setSelected(null);
10947
10986
  }
10948
10987
  getSelectedDrawing() {
10949
10988
  return this.selectedDrawingId ? this.drawings.find((e) => e.id === this.selectedDrawingId) ?? null : null;
@@ -10966,7 +11005,13 @@ var Wc = 8, Gc = 6, Kc = class e {
10966
11005
  onPointerDown(t, n) {
10967
11006
  if (this.activeTool === "cursor") return this.handleCursorDown(t, n);
10968
11007
  let r = this.resolveAnchorFromPointer(t, n);
10969
- return r ? e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool) ? (this.createSingleAnchorDrawing(r), !0) : e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool) ? this.pendingAnchor ? (this.createDoubleAnchorDrawing(this.pendingAnchor, r), this.pendingAnchor = null, !0) : (this.pendingAnchor = r, !0) : !1 : !1;
11008
+ if (!r) return !1;
11009
+ if (e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool)) return this.createSingleAnchorDrawing(r), !0;
11010
+ let i = e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool), a = e.TRIPLE_ANCHOR_TOOLS.includes(this.activeTool);
11011
+ if (!i && !a) return !1;
11012
+ this.pendingAnchors.push(r);
11013
+ let o = i ? 2 : 3;
11014
+ return this.pendingAnchors.length >= o && (this.createMultiAnchorDrawing(this.pendingAnchors), this.pendingAnchors = []), !0;
10970
11015
  }
10971
11016
  onPointerUp(e, t) {
10972
11017
  return this.dragState ? (this.dragState = null, !0) : !1;
@@ -10996,19 +11041,23 @@ var Wc = 8, Gc = 6, Kc = class e {
10996
11041
  index: r.index,
10997
11042
  time: r.time,
10998
11043
  price: r.price
10999
- };
11044
+ }, n.kind === "flat-line" && e === 1 && n.anchors.length >= 3 && (n.anchors[2] = {
11045
+ ...n.anchors[2],
11046
+ index: r.index,
11047
+ time: r.time
11048
+ });
11000
11049
  }
11001
11050
  } else {
11002
11051
  let r = t.getBoundingClientRect(), i = e.clientX - r.left, a = e.clientY - r.top, o = i - this.dragState.startMouse.x, s = a - this.dragState.startMouse.y;
11003
11052
  for (let e = 0; e < n.anchors.length; e++) {
11004
- let r = this.dragState.snapshot[e], i = this.anchorToScreen(r);
11005
- if (!i) continue;
11006
- let a = i.x + o, c = i.y + s, l = this.screenToAnchor(a, c, t);
11007
- l && (n.anchors[e] = {
11053
+ let t = this.dragState.snapshot[e], r = this.anchorToScreen(t);
11054
+ if (!r) continue;
11055
+ let i = r.x + o, a = r.y + s, c = this.screenToAnchor(i, a);
11056
+ c && (n.anchors[e] = {
11008
11057
  ...n.anchors[e],
11009
- index: l.index,
11010
- time: l.time,
11011
- price: l.price
11058
+ index: c.index,
11059
+ time: c.time,
11060
+ price: c.price
11012
11061
  });
11013
11062
  }
11014
11063
  }
@@ -11017,10 +11066,10 @@ var Wc = 8, Gc = 6, Kc = class e {
11017
11066
  handlePreviewMove(t, n) {
11018
11067
  let r = this.resolveAnchorFromPointer(t, n);
11019
11068
  if (!r) return this.removePreview(), !1;
11020
- let i = e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool), a = e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool);
11021
- if (!i && !a) return !1;
11022
- let o;
11023
- if (i) o = {
11069
+ let i = e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool), a = e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool), o = e.TRIPLE_ANCHOR_TOOLS.includes(this.activeTool);
11070
+ if (!i && !a && !o) return !1;
11071
+ let s;
11072
+ if (i) s = {
11024
11073
  id: this.previewDrawingId,
11025
11074
  kind: this.getDrawingKind(this.activeTool),
11026
11075
  paneId: "main",
@@ -11038,40 +11087,113 @@ var Wc = 8, Gc = 6, Kc = class e {
11038
11087
  strokeStyle: "dashed"
11039
11088
  }
11040
11089
  };
11041
- else if (this.pendingAnchor) o = {
11090
+ else if (a && this.pendingAnchors.length >= 1) s = {
11042
11091
  id: this.previewDrawingId,
11043
- kind: this.activeTool,
11092
+ kind: this.getDrawingKind(this.activeTool),
11044
11093
  paneId: "main",
11045
11094
  visible: !0,
11046
11095
  anchors: [{
11047
11096
  id: `${this.previewDrawingId}-a`,
11048
- index: this.pendingAnchor.index,
11049
- time: this.pendingAnchor.time,
11050
- price: this.pendingAnchor.price
11097
+ index: this.pendingAnchors[0].index,
11098
+ time: this.pendingAnchors[0].time,
11099
+ price: this.pendingAnchors[0].price
11051
11100
  }, {
11052
11101
  id: `${this.previewDrawingId}-b`,
11053
11102
  index: r.index,
11054
11103
  time: r.time,
11055
11104
  price: r.price
11056
11105
  }],
11057
- params: {},
11106
+ params: this.activeTool === "regression-channel" ? { sigma: 2 } : {},
11058
11107
  style: {
11059
11108
  stroke: "#2962ff",
11060
11109
  strokeWidth: 1,
11061
- strokeStyle: "dashed"
11110
+ strokeStyle: "dashed",
11111
+ ...this.activeTool === "regression-channel" ? { fillOpacity: .1 } : {}
11062
11112
  }
11063
11113
  };
11064
- else return !1;
11065
- return this.drawings = this.drawings.filter((e) => e.id !== this.previewDrawingId), this.drawings = [...this.drawings, o], this.chart.setDrawings(this.drawings), !0;
11114
+ else if (o) {
11115
+ if (this.pendingAnchors.length === 0) return !1;
11116
+ if (this.pendingAnchors.length === 1) s = {
11117
+ id: this.previewDrawingId,
11118
+ kind: "trend-line",
11119
+ paneId: "main",
11120
+ visible: !0,
11121
+ anchors: [{
11122
+ id: `${this.previewDrawingId}-a`,
11123
+ index: this.pendingAnchors[0].index,
11124
+ time: this.pendingAnchors[0].time,
11125
+ price: this.pendingAnchors[0].price
11126
+ }, {
11127
+ id: `${this.previewDrawingId}-b`,
11128
+ index: r.index,
11129
+ time: r.time,
11130
+ price: r.price
11131
+ }],
11132
+ params: {},
11133
+ style: {
11134
+ stroke: "#2962ff",
11135
+ strokeWidth: 1,
11136
+ strokeStyle: "dashed"
11137
+ }
11138
+ };
11139
+ else {
11140
+ let e = this.activeTool === "flat-line" ? {
11141
+ id: `${this.previewDrawingId}-c`,
11142
+ index: this.pendingAnchors[1].index,
11143
+ time: this.pendingAnchors[1].time,
11144
+ price: r.price
11145
+ } : {
11146
+ id: `${this.previewDrawingId}-c`,
11147
+ index: r.index,
11148
+ time: r.time,
11149
+ price: r.price
11150
+ };
11151
+ s = {
11152
+ id: this.previewDrawingId,
11153
+ kind: this.getDrawingKind(this.activeTool),
11154
+ paneId: "main",
11155
+ visible: !0,
11156
+ anchors: [
11157
+ {
11158
+ id: `${this.previewDrawingId}-a`,
11159
+ index: this.pendingAnchors[0].index,
11160
+ time: this.pendingAnchors[0].time,
11161
+ price: this.pendingAnchors[0].price
11162
+ },
11163
+ {
11164
+ id: `${this.previewDrawingId}-b`,
11165
+ index: this.pendingAnchors[1].index,
11166
+ time: this.pendingAnchors[1].time,
11167
+ price: this.pendingAnchors[1].price
11168
+ },
11169
+ e
11170
+ ],
11171
+ params: {},
11172
+ style: {
11173
+ stroke: "#2962ff",
11174
+ strokeWidth: 1,
11175
+ strokeStyle: "dashed",
11176
+ fillOpacity: .1
11177
+ }
11178
+ };
11179
+ }
11180
+ } else return !1;
11181
+ return this.drawings = this.drawings.filter((e) => e.id !== this.previewDrawingId), this.drawings = [...this.drawings, s], this.chart.setDrawings(this.drawings), !0;
11066
11182
  }
11067
11183
  hitTest(e, t) {
11068
11184
  let n = this.drawings.filter((e) => e.id !== this.previewDrawingId && e.visible);
11069
- for (let r of n) for (let n = 0; n < r.anchors.length; n++) {
11070
- let i = this.anchorToScreen(r.anchors[n]);
11071
- if (i && Math.hypot(e - i.x, t - i.y) <= Wc) return {
11072
- drawing: r,
11073
- anchorIndex: n
11074
- };
11185
+ for (let r of n) {
11186
+ if (r.kind === "regression-channel" && r.anchors.length >= 2) {
11187
+ let n = this.hitTestRegressionEndpoints(r, e, t);
11188
+ if (n) return n;
11189
+ }
11190
+ for (let n = 0; n < r.anchors.length; n++) {
11191
+ let i = this.anchorToScreen(r.anchors[n]);
11192
+ if (i && Math.hypot(e - i.x, t - i.y) <= Wc) return {
11193
+ drawing: r,
11194
+ anchorIndex: n
11195
+ };
11196
+ }
11075
11197
  }
11076
11198
  for (let r of n) {
11077
11199
  let n = this.getDrawingLineSegments(r);
@@ -11142,7 +11264,48 @@ var Wc = 8, Gc = 6, Kc = class e {
11142
11264
  if (n.length < 2) return [];
11143
11265
  let r = [];
11144
11266
  if (n.length === 2) {
11145
- let i = n[0], a = n[1], o = a.x - i.x, s = a.y - i.y, c = i, l = a, u = this.getExtendMode(e), d = Math.max(t.plotWidth, t.plotHeight) * 4;
11267
+ let i = n[0], a = n[1];
11268
+ if (e.kind === "regression-channel") {
11269
+ let t = this.chart.getData(), n = Math.round(e.anchors[0].index), i = Math.round(e.anchors[1].index), a = Math.min(Math.max(n, 0), Math.max(i, 0)), o = Math.max(Math.max(n, 0), Math.max(i, 0)), s = Math.min(Math.max(a, 0), t.length - 1), c = Math.min(Math.max(o, 0), t.length - 1), l = t.slice(s, c + 1), u = nl(l.map((e) => e.close));
11270
+ if (u) {
11271
+ let t = e.params?.sigma ?? 2, a = u.stdDev * t, o = u.intercept, s = u.intercept + u.slope * (l.length - 1), c = this.anchorToScreen({
11272
+ id: "",
11273
+ index: n,
11274
+ price: o
11275
+ }), d = this.anchorToScreen({
11276
+ id: "",
11277
+ index: i,
11278
+ price: s
11279
+ }), f = this.anchorToScreen({
11280
+ id: "",
11281
+ index: n,
11282
+ price: o + a
11283
+ }), p = this.anchorToScreen({
11284
+ id: "",
11285
+ index: i,
11286
+ price: s + a
11287
+ }), m = this.anchorToScreen({
11288
+ id: "",
11289
+ index: n,
11290
+ price: o - a
11291
+ }), h = this.anchorToScreen({
11292
+ id: "",
11293
+ index: i,
11294
+ price: s - a
11295
+ });
11296
+ return c && d && r.push({
11297
+ a: c,
11298
+ b: d
11299
+ }), f && p && r.push({
11300
+ a: f,
11301
+ b: p
11302
+ }), m && h && r.push({
11303
+ a: m,
11304
+ b: h
11305
+ }), r;
11306
+ }
11307
+ }
11308
+ let o = a.x - i.x, s = a.y - i.y, c = i, l = a, u = this.getExtendMode(e), d = Math.max(t.plotWidth, t.plotHeight) * 4;
11146
11309
  (u === "right" || u === "both") && (l = {
11147
11310
  x: a.x + o * d,
11148
11311
  y: a.y + s * d
@@ -11153,12 +11316,103 @@ var Wc = 8, Gc = 6, Kc = class e {
11153
11316
  a: c,
11154
11317
  b: l
11155
11318
  });
11156
- } else for (let e = 0; e < n.length - 1; e++) r.push({
11157
- a: n[e],
11158
- b: n[e + 1]
11159
- });
11319
+ } else if (n.length >= 3) switch (e.kind) {
11320
+ case "parallel-channel": {
11321
+ let [e, t, i] = n, a = t.x - e.x, o = t.y - e.y, s = {
11322
+ x: i.x + a,
11323
+ y: i.y + o
11324
+ };
11325
+ r.push({
11326
+ a: e,
11327
+ b: t
11328
+ }, {
11329
+ a: i,
11330
+ b: s
11331
+ });
11332
+ break;
11333
+ }
11334
+ case "flat-line": {
11335
+ let [e, t, i] = n, a = {
11336
+ x: e.x,
11337
+ y: i.y
11338
+ }, o = {
11339
+ x: t.x,
11340
+ y: i.y
11341
+ };
11342
+ r.push({
11343
+ a: e,
11344
+ b: t
11345
+ }), r.push({
11346
+ a,
11347
+ b: o
11348
+ });
11349
+ break;
11350
+ }
11351
+ case "disjoint-channel": {
11352
+ let [e, t, i] = n, a = t.x - e.x, o = t.y - e.y, s = {
11353
+ x: i.x + a,
11354
+ y: i.y - o
11355
+ };
11356
+ r.push({
11357
+ a: e,
11358
+ b: t
11359
+ }), r.push({
11360
+ a: i,
11361
+ b: s
11362
+ });
11363
+ break;
11364
+ }
11365
+ default: for (let e = 0; e < n.length - 1; e++) r.push({
11366
+ a: n[e],
11367
+ b: n[e + 1]
11368
+ });
11369
+ }
11160
11370
  return r;
11161
11371
  }
11372
+ hitTestRegressionEndpoints(e, t, n) {
11373
+ let r = this.chart.getData();
11374
+ if (r.length === 0) return null;
11375
+ let i = Math.round(e.anchors[0].index), a = Math.round(e.anchors[1].index), o = Math.min(Math.max(i, 0), r.length - 1), s = Math.min(Math.max(a, 0), r.length - 1), c = Math.min(o, s), l = Math.max(o, s), u = r.slice(c, l + 1), d = nl(u.map((e) => e.close));
11376
+ if (!d) return null;
11377
+ let f = e.params?.sigma ?? 2, p = d.stdDev * f, m = d.intercept, h = d.intercept + d.slope * (u.length - 1), g = [
11378
+ {
11379
+ index: i,
11380
+ price: m
11381
+ },
11382
+ {
11383
+ index: a,
11384
+ price: h
11385
+ },
11386
+ {
11387
+ index: i,
11388
+ price: m + p
11389
+ },
11390
+ {
11391
+ index: a,
11392
+ price: h + p
11393
+ },
11394
+ {
11395
+ index: i,
11396
+ price: m - p
11397
+ },
11398
+ {
11399
+ index: a,
11400
+ price: h - p
11401
+ }
11402
+ ];
11403
+ for (let r of g) {
11404
+ let o = this.anchorToScreen({
11405
+ id: "",
11406
+ index: r.index,
11407
+ price: r.price
11408
+ });
11409
+ if (o && Math.hypot(t - o.x, n - o.y) <= Wc) return {
11410
+ drawing: e,
11411
+ anchorIndex: r.index <= Math.min(i, a) ? 0 : 1
11412
+ };
11413
+ }
11414
+ return null;
11415
+ }
11162
11416
  getExtendMode(e) {
11163
11417
  switch (e.kind) {
11164
11418
  case "ray": return "right";
@@ -11170,7 +11424,7 @@ var Wc = 8, Gc = 6, Kc = class e {
11170
11424
  let t = this.chart.getViewport();
11171
11425
  if (!t) return null;
11172
11426
  let n = this.chart.getOption(), r = this.chart.getCurrentDpr(), { startXPx: i, unitPx: a } = Ms(n.kWidth, n.kGap, r);
11173
- if (!Number.isFinite(e.index) || e.index < 0) return null;
11427
+ if (!Number.isFinite(e.index)) return null;
11174
11428
  let o = (i + e.index * a + (a - 1) / 2) / r - t.scrollLeft, s = this.chart.getPaneRenderers().find((e) => e.getPane().id === "main")?.getPane();
11175
11429
  return s ? {
11176
11430
  x: o,
@@ -11235,32 +11489,41 @@ var Wc = 8, Gc = 6, Kc = class e {
11235
11489
  };
11236
11490
  this.drawings = [...this.drawings, t], this.chart.setDrawings(this.drawings), this.callbacks.onDrawingCreated?.(t), this.activeTool = "cursor", this.callbacks.onToolChange?.("cursor");
11237
11491
  }
11238
- createDoubleAnchorDrawing(e, t) {
11492
+ createMultiAnchorDrawing(e) {
11239
11493
  this.drawings = this.drawings.filter((e) => e.id !== this.previewDrawingId);
11240
- let n = {
11494
+ let t = this.getDrawingKind(this.activeTool), n = t === "regression-channel" ? { sigma: 2 } : {}, r = t === "flat-line" && e.length >= 3 ? [
11495
+ e[0],
11496
+ e[1],
11497
+ {
11498
+ index: e[1].index,
11499
+ time: e[1].time,
11500
+ price: e[2].price
11501
+ }
11502
+ ] : e, i = [
11503
+ "parallel-channel",
11504
+ "regression-channel",
11505
+ "flat-line",
11506
+ "disjoint-channel"
11507
+ ].includes(t), a = {
11241
11508
  id: `drawing-${Date.now()}`,
11242
- kind: this.activeTool,
11509
+ kind: t,
11243
11510
  paneId: "main",
11244
11511
  visible: !0,
11245
- anchors: [{
11246
- id: `${Date.now()}-a`,
11512
+ anchors: r.map((e, t) => ({
11513
+ id: `${Date.now()}-${String.fromCharCode(97 + t)}`,
11247
11514
  index: e.index,
11248
11515
  time: e.time,
11249
11516
  price: e.price
11250
- }, {
11251
- id: `${Date.now()}-b`,
11252
- index: t.index,
11253
- time: t.time,
11254
- price: t.price
11255
- }],
11256
- params: {},
11517
+ })),
11518
+ params: n,
11257
11519
  style: {
11258
11520
  stroke: "#2962ff",
11259
11521
  strokeWidth: 1,
11260
- strokeStyle: "solid"
11522
+ strokeStyle: "solid",
11523
+ ...i ? { fillOpacity: .1 } : {}
11261
11524
  }
11262
11525
  };
11263
- this.drawings = [...this.drawings, n], this.chart.setDrawings(this.drawings), this.callbacks.onDrawingCreated?.(n), this.activeTool = "cursor", this.callbacks.onToolChange?.("cursor");
11526
+ this.drawings = [...this.drawings, a], this.chart.setDrawings(this.drawings), this.callbacks.onDrawingCreated?.(a), this.activeTool = "cursor", this.callbacks.onToolChange?.("cursor");
11264
11527
  }
11265
11528
  getDrawingKind(e) {
11266
11529
  switch (e) {
@@ -11619,16 +11882,97 @@ function sl() {
11619
11882
  b: u,
11620
11883
  extend: d,
11621
11884
  style: e.style
11885
+ }
11886
+ ] };
11887
+ }
11888
+ };
11889
+ }
11890
+ function cl() {
11891
+ return {
11892
+ kind: "flat-line",
11893
+ minAnchors: 3,
11894
+ maxAnchors: 3,
11895
+ compute(e, t) {
11896
+ let [n, r, i] = e.anchors;
11897
+ if (!n || !r || !i) return { primitives: [] };
11898
+ let a = t.toScreen(n), o = t.toScreen(r), s = t.toScreen(i), c = {
11899
+ x: a.x,
11900
+ y: s.y
11901
+ }, l = {
11902
+ x: o.x,
11903
+ y: s.y
11904
+ };
11905
+ return { primitives: [
11906
+ {
11907
+ kind: "area",
11908
+ points: [
11909
+ a,
11910
+ o,
11911
+ l,
11912
+ c
11913
+ ],
11914
+ closed: !0,
11915
+ style: e.style
11916
+ },
11917
+ {
11918
+ kind: "line",
11919
+ a,
11920
+ b: o,
11921
+ style: e.style
11922
+ },
11923
+ {
11924
+ kind: "line",
11925
+ a: c,
11926
+ b: l,
11927
+ style: e.style
11928
+ },
11929
+ {
11930
+ kind: "point",
11931
+ point: c,
11932
+ style: e.style
11933
+ },
11934
+ {
11935
+ kind: "point",
11936
+ point: l,
11937
+ style: e.style
11938
+ }
11939
+ ] };
11940
+ }
11941
+ };
11942
+ }
11943
+ function ll() {
11944
+ return {
11945
+ kind: "disjoint-channel",
11946
+ minAnchors: 3,
11947
+ maxAnchors: 3,
11948
+ compute(e, t) {
11949
+ let [n, r, i] = e.anchors;
11950
+ if (!n || !r || !i) return { primitives: [] };
11951
+ let a = t.toScreen(n), o = t.toScreen(r), s = t.toScreen(i), c = o.x - a.x, l = o.y - a.y, u = {
11952
+ x: s.x + c,
11953
+ y: s.y - l
11954
+ };
11955
+ return { primitives: [
11956
+ {
11957
+ kind: "area",
11958
+ points: [
11959
+ a,
11960
+ o,
11961
+ u,
11962
+ s
11963
+ ],
11964
+ closed: !0,
11965
+ style: e.style
11622
11966
  },
11623
11967
  {
11624
11968
  kind: "line",
11625
11969
  a,
11626
- b: s,
11970
+ b: o,
11627
11971
  style: e.style
11628
11972
  },
11629
11973
  {
11630
11974
  kind: "line",
11631
- a: o,
11975
+ a: s,
11632
11976
  b: u,
11633
11977
  style: e.style
11634
11978
  }
@@ -11636,7 +11980,7 @@ function sl() {
11636
11980
  }
11637
11981
  };
11638
11982
  }
11639
- function cl() {
11983
+ function ul() {
11640
11984
  return {
11641
11985
  kind: "regression-channel",
11642
11986
  minAnchors: 2,
@@ -11716,14 +12060,14 @@ function cl() {
11716
12060
  }
11717
12061
  };
11718
12062
  }
11719
- function ll(e) {
11720
- e.register(il("trend-line", "none")), e.register(il("ray", "right")), e.register(il("extended-line", "both")), e.register(al("horizontal-line")), e.register(al("horizontal-ray")), e.register(al("vertical-line")), e.register(al("cross-line")), e.register(ol()), e.register(sl()), e.register(cl());
12063
+ function dl(e) {
12064
+ e.register(il("trend-line", "none")), e.register(il("ray", "right")), e.register(il("extended-line", "both")), e.register(al("horizontal-line")), e.register(al("horizontal-ray")), e.register(al("vertical-line")), e.register(al("cross-line")), e.register(ol()), e.register(sl()), e.register(ul()), e.register(cl()), e.register(ll());
11721
12065
  }
11722
12066
  //#endregion
11723
12067
  //#region src/core/drawing/plugin.ts
11724
- function ul(e) {
12068
+ function fl(e) {
11725
12069
  let t = e.store, n = e.definitions ?? new Yc(), r = e.renderers ?? rl();
11726
- return ll(n), {
12070
+ return dl(n), {
11727
12071
  name: "drawingRenderer",
11728
12072
  version: "0.1.0",
11729
12073
  description: "绘图渲染器",
@@ -11767,7 +12111,7 @@ function ul(e) {
11767
12111
  }
11768
12112
  });
11769
12113
  if (!o) continue;
11770
- let v = t.getSelectedId() === e.id ? o.primitives.map((t) => dl(t, e.style)) : o.primitives;
12114
+ let v = t.getSelectedId() === e.id ? o.primitives.map((t) => pl(t, e.style)) : o.primitives;
11771
12115
  for (let e of v) {
11772
12116
  if (e.kind === "point") {
11773
12117
  r.point(i, e, c);
@@ -11788,7 +12132,7 @@ function ul(e) {
11788
12132
  }
11789
12133
  };
11790
12134
  }
11791
- function dl(e, t) {
12135
+ function pl(e, t) {
11792
12136
  let n = t.stroke ?? "#2962ff", r = (t.strokeWidth ?? 1) + 1, i = (t.pointRadius ?? 4) + 2;
11793
12137
  return e.kind === "point" ? {
11794
12138
  ...e,
@@ -11821,7 +12165,7 @@ function dl(e, t) {
11821
12165
  }
11822
12166
  //#endregion
11823
12167
  //#region src/core/chart.ts
11824
- var fl = class e {
12168
+ var ml = class e {
11825
12169
  dom;
11826
12170
  opt;
11827
12171
  data = [];
@@ -11852,7 +12196,7 @@ var fl = class e {
11852
12196
  ...i,
11853
12197
  kWidth: n ?? 0,
11854
12198
  kGap: r ?? 0
11855
- }, this.interaction = new Rs(this), this.markerManager = new jo(), this.pluginHost = Sa(), this.rendererPluginManager = new wa(), this.rendererPluginManager.setPluginHost(this.pluginHost), this.rendererPluginManager.setInvalidateCallback(() => this.scheduleDraw()), this.syncPaneRatiosFromSpecs(this.opt.panes), this.zoomLevelCount = Math.max(2, Math.round(this.opt.zoomLevels ?? 20)), this.currentZoomLevel = this.opt.initialZoomLevel ?? 1, this.currentZoomLevel = Math.max(1, Math.min(this.zoomLevelCount, this.currentZoomLevel)), this.initPanes(), this.useRenderer(ul({ store: this.drawingStore })), this.initResizeObserver();
12199
+ }, this.interaction = new Rs(this), this.markerManager = new jo(), this.pluginHost = Sa(), this.rendererPluginManager = new wa(), this.rendererPluginManager.setPluginHost(this.pluginHost), this.rendererPluginManager.setInvalidateCallback(() => this.scheduleDraw()), this.syncPaneRatiosFromSpecs(this.opt.panes), this.zoomLevelCount = Math.max(2, Math.round(this.opt.zoomLevels ?? 20)), this.currentZoomLevel = this.opt.initialZoomLevel ?? 1, this.currentZoomLevel = Math.max(1, Math.min(this.zoomLevelCount, this.currentZoomLevel)), this.initPanes(), this.useRenderer(fl({ store: this.drawingStore })), this.initResizeObserver();
11856
12200
  }
11857
12201
  initResizeObserver() {
11858
12202
  if (typeof ResizeObserver > "u") return;
@@ -12427,18 +12771,18 @@ var fl = class e {
12427
12771
  };
12428
12772
  return this.viewport = u, this.onViewportChange?.(u), u;
12429
12773
  }
12430
- }, pl = 3;
12431
- function ml(e, t) {
12774
+ }, hl = 3;
12775
+ function gl(e, t) {
12432
12776
  let n = (e - 1) / (t.zoomLevelCount - 1);
12433
12777
  return t.minKWidth + n * (t.maxKWidth - t.minKWidth);
12434
12778
  }
12435
- function hl(e) {
12436
- return pl / e;
12779
+ function _l(e) {
12780
+ return hl / e;
12437
12781
  }
12438
- function gl(e, t, n, r, i, a, o) {
12782
+ function vl(e, t, n, r, i, a, o) {
12439
12783
  let s = Math.max(1, Math.min(o.zoomLevelCount, r + e));
12440
12784
  if (s === r) return null;
12441
- let c = ml(s, o), l = hl(o.dpr), u = Ms(i, a, o.dpr), d = Ms(c, l, o.dpr), f = (Math.round((n + t) * o.dpr) - u.startXPx) / u.unitPx;
12785
+ let c = gl(s, o), l = _l(o.dpr), u = Ms(i, a, o.dpr), d = Ms(c, l, o.dpr), f = (Math.round((n + t) * o.dpr) - u.startXPx) / u.unitPx;
12442
12786
  return {
12443
12787
  targetLevel: s,
12444
12788
  newKWidth: c,
@@ -12446,24 +12790,24 @@ function gl(e, t, n, r, i, a, o) {
12446
12790
  newScrollLeft: (d.startXPx + f * d.unitPx) / o.dpr - t
12447
12791
  };
12448
12792
  }
12449
- function _l(e, t, n, r, i, a, o) {
12793
+ function yl(e, t, n, r, i, a, o) {
12450
12794
  let s = Math.max(1, Math.min(o.zoomLevelCount, Math.round(e))) - r;
12451
- return s === 0 ? null : gl(s, t, n, r, i, a, o);
12795
+ return s === 0 ? null : vl(s, t, n, r, i, a, o);
12452
12796
  }
12453
12797
  //#endregion
12454
12798
  //#region src/types/kLine.ts
12455
- function vl(e) {
12799
+ function bl(e) {
12456
12800
  return e.open > e.close ? "down" : e.open < e.close ? "up" : "flat";
12457
12801
  }
12458
12802
  //#endregion
12459
12803
  //#region src/types/volumePrice.ts
12460
12804
  var $ = /* @__PURE__ */ function(e) {
12461
12805
  return e.RISE_WITH_VOLUME = "rise_with_volume", e.RISE_WITHOUT_VOLUME = "rise_without_volume", e.FALL_WITH_VOLUME = "fall_with_volume", e.FALL_WITHOUT_VOLUME = "fall_without_volume", e.OTHERS = "others", e;
12462
- }({}), yl = {
12806
+ }({}), xl = {
12463
12807
  volumeAmplifyThreshold: 1.5,
12464
12808
  volumeShrinkThreshold: .8,
12465
12809
  avgPeriod: 20
12466
- }, bl = class {
12810
+ }, Sl = class {
12467
12811
  prefixSum = [];
12468
12812
  dataLength = 0;
12469
12813
  build(e) {
@@ -12488,8 +12832,8 @@ var $ = /* @__PURE__ */ function(e) {
12488
12832
  return this.dataLength;
12489
12833
  }
12490
12834
  };
12491
- function xl(e, t, n, r = yl) {
12492
- let i = new bl();
12835
+ function Cl(e, t, n, r = xl) {
12836
+ let i = new Sl();
12493
12837
  i.build(e);
12494
12838
  let a = [], { volumeAmplifyThreshold: o, volumeShrinkThreshold: s, avgPeriod: c } = r;
12495
12839
  for (let r = t; r < n && r < e.length; r++) {
@@ -12510,7 +12854,7 @@ function xl(e, t, n, r = yl) {
12510
12854
  }
12511
12855
  //#endregion
12512
12856
  //#region src/core/renderers/candle.ts
12513
- function Sl() {
12857
+ function wl() {
12514
12858
  return {
12515
12859
  name: "candle",
12516
12860
  version: "1.0.0",
@@ -12523,14 +12867,14 @@ function Sl() {
12523
12867
  if (!d.length) return;
12524
12868
  let { kWidthPx: f } = Ms(o, s, c);
12525
12869
  t.save(), t.translate(-a, 0);
12526
- let p = l || [], m = xl(d, i.start, i.end, yl);
12870
+ let p = l || [], m = Cl(d, i.start, i.end, xl);
12527
12871
  for (let r = i.start; r < i.end && r < d.length; r++) {
12528
12872
  let a = d[r];
12529
12873
  if (!a) continue;
12530
12874
  let s = n.yAxis.priceToY(a.open), l = n.yAxis.priceToY(a.close), h = n.yAxis.priceToY(a.high), g = n.yAxis.priceToY(a.low), _ = p[r - i.start];
12531
12875
  if (!_) continue;
12532
12876
  let v = (e) => Math.round(e * c) / c, y = v(s), b = v(l), x = v(h), S = v(g), C = Math.min(y, b), w = Math.max(Math.abs(y - b), 1), T = Js(Math.round(_ * c), C, f, w, c);
12533
- t.fillStyle = vl(a) === "up" ? za.UP : za.DOWN, t.fillRect(T.bodyRect.x, T.bodyRect.y, T.bodyRect.width, T.bodyRect.height);
12877
+ t.fillStyle = bl(a) === "up" ? za.UP : za.DOWN, t.fillRect(T.bodyRect.x, T.bodyRect.y, T.bodyRect.width, T.bodyRect.height);
12534
12878
  let E = T.wickRect.width, D = T.wickRect.x, O = T.bodyRect.y, k = T.bodyRect.y + T.bodyRect.height, A = Math.max(a.open, a.close), j = Math.min(a.open, a.close);
12535
12879
  if (a.high > A) {
12536
12880
  let e = Ks(D, x, O, c);
@@ -12543,14 +12887,14 @@ function Sl() {
12543
12887
  let M = m[r - i.start];
12544
12888
  if (M !== $.OTHERS && u && (e.zoomLevel ?? 1) >= 2) {
12545
12889
  let e = M === $.RISE_WITH_VOLUME || M === $.RISE_WITHOUT_VOLUME ? x - 15 : S + 15;
12546
- Cl(t, T.bodyRect.x + T.bodyRect.width / 2, e, M, r, o, 4, u, c);
12890
+ Tl(t, T.bodyRect.x + T.bodyRect.width / 2, e, M, r, o, 4, u, c);
12547
12891
  }
12548
12892
  }
12549
12893
  t.restore();
12550
12894
  }
12551
12895
  };
12552
12896
  }
12553
- function Cl(e, t, n, r, i, a, o = 4, s, c) {
12897
+ function Tl(e, t, n, r, i, a, o = 4, s, c) {
12554
12898
  let l = (e) => Math.round(e * c) / c;
12555
12899
  t = l(t), n = l(n);
12556
12900
  let u = Math.min(a, 20), d = u * Math.sqrt(3) / 2, f, p;
@@ -12616,12 +12960,12 @@ function Cl(e, t, n, r, i, a, o = 4, s, c) {
12616
12960
  }
12617
12961
  //#endregion
12618
12962
  //#region src/core/utils/tickCount.ts
12619
- function wl(e, t) {
12963
+ function El(e, t) {
12620
12964
  return Math.max(3, Math.round(e / 60) + 1);
12621
12965
  }
12622
12966
  //#endregion
12623
12967
  //#region src/core/renderers/gridLines.ts
12624
- function Tl() {
12968
+ function Dl() {
12625
12969
  return {
12626
12970
  name: "gridLines",
12627
12971
  version: "1.0.0",
@@ -12632,7 +12976,7 @@ function Tl() {
12632
12976
  draw(e) {
12633
12977
  let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: o, dpr: s, kLinePositions: c } = e, l = r;
12634
12978
  if (!l.length) return;
12635
- let u = wl(n.height);
12979
+ let u = El(n.height);
12636
12980
  t.save(), t.fillStyle = Ha.HORIZONTAL, t.translate(-a, 0);
12637
12981
  let d = t.canvas.width / s, f = a, p = a + d, m = n.yAxis.getPaddingTop(), h = n.yAxis.getPaddingBottom(), g = m, _ = Math.max(m, n.height - h), v = Math.max(0, _ - g);
12638
12982
  for (let e = 0; e < u; e++) {
@@ -12653,7 +12997,7 @@ function Tl() {
12653
12997
  }
12654
12998
  //#endregion
12655
12999
  //#region src/core/renderers/lastPrice.ts
12656
- function El() {
13000
+ function Ol() {
12657
13001
  return {
12658
13002
  name: "lastPriceLine",
12659
13003
  version: "1.0.0",
@@ -12674,7 +13018,7 @@ function El() {
12674
13018
  }
12675
13019
  //#endregion
12676
13020
  //#region src/core/renderers/extremaMarkers.ts
12677
- function Dl() {
13021
+ function kl() {
12678
13022
  return {
12679
13023
  name: "extremaMarkers",
12680
13024
  version: "1.0.0",
@@ -12697,11 +13041,11 @@ function Dl() {
12697
13041
  let t = e - i.start;
12698
13042
  return t < 0 || t >= l.length ? 0 : l[t] + o / 2;
12699
13043
  };
12700
- t.save(), t.translate(-a, 0), Ol(t, _(h), n.yAxis.priceToY(p), p, s, c, a), Ol(t, _(g), n.yAxis.priceToY(m), m, s, c, a), t.restore();
13044
+ t.save(), t.translate(-a, 0), Al(t, _(h), n.yAxis.priceToY(p), p, s, c, a), Al(t, _(g), n.yAxis.priceToY(m), m, s, c, a), t.restore();
12701
13045
  }
12702
13046
  };
12703
13047
  }
12704
- function Ol(e, t, n, r, i, a, o) {
13048
+ function Al(e, t, n, r, i, a, o) {
12705
13049
  let s = r.toFixed(2);
12706
13050
  e.font = "12px Arial";
12707
13051
  let c = e.measureText(s).width, l = t - o + 30 + 4 + c > a, u = t, d = l ? t - 30 : t + 30;
@@ -12713,27 +13057,27 @@ function Ol(e, t, n, r, i, a, o) {
12713
13057
  }
12714
13058
  //#endregion
12715
13059
  //#region src/utils/priceToY.ts
12716
- function kl(e, t, n, r, i, a) {
13060
+ function jl(e, t, n, r, i, a) {
12717
13061
  let o = t - n || 1, s = Math.max(1, r - i - a);
12718
13062
  return n + (1 - (Math.min(Math.max(e, i), i + s) - i) / s) * o;
12719
13063
  }
12720
13064
  //#endregion
12721
13065
  //#region src/utils/kLineDraw/axis.ts
12722
- function Al(e, t) {
13066
+ function Ml(e, t) {
12723
13067
  let { x: n, y: r, width: i, height: a, crosshairX: o, timestamp: s, dpr: c, fontSize: l = 16, paddingX: u = 8 } = t, d = Ia(s);
12724
13068
  e.save(), e.font = `${l}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
12725
13069
  let f = Math.round(e.measureText(d).width), p = Math.min(i, f + u * 2), m = a, h = Math.min(Math.max(o, n + p / 2), n + i - p / 2), g = r + a / 2, _ = h - p / 2, v = r;
12726
13070
  e.fillStyle = "rgba(0, 0, 0, 0.8)", e.fillRect(Z(_, c), Z(v, c), Z(p, c), Z(m, c)), e.fillStyle = "#ffffff", e.fillText(d, Z(h, c), Z(g, c)), e.restore();
12727
13071
  }
12728
- function jl(e, t) {
12729
- let { x: n, y: r, width: i, height: a, crosshairY: o, priceRange: s, yPaddingPx: c = 0, dpr: l, bgColor: u = "rgba(0, 0, 0, 0.8)", borderColor: d, textColor: f = "#ffffff", fontSize: p = 16, priceOffset: m = 0, price: h, formatPrice: g } = t, _ = Math.max(0, Math.min(c, Math.floor(a / 2) - 1)), { maxPrice: v, minPrice: y } = s, b = h ?? kl(o - r, v, y, a, _, _) + m, x = g ? g(b) : b.toFixed(2);
13072
+ function Nl(e, t) {
13073
+ let { x: n, y: r, width: i, height: a, crosshairY: o, priceRange: s, yPaddingPx: c = 0, dpr: l, bgColor: u = "rgba(0, 0, 0, 0.8)", borderColor: d, textColor: f = "#ffffff", fontSize: p = 16, priceOffset: m = 0, price: h, formatPrice: g } = t, _ = Math.max(0, Math.min(c, Math.floor(a / 2) - 1)), { maxPrice: v, minPrice: y } = s, b = h ?? jl(o - r, v, y, a, _, _) + m, x = g ? g(b) : b.toFixed(2);
12730
13074
  e.save(), e.font = `${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
12731
13075
  let S = p + 4, C = Math.min(Math.max(o, r + S / 2), r + a - S / 2), w = C - S / 2, T = n, E = Z(w, l), D = i, O = Z(S, l);
12732
13076
  e.fillStyle = u, e.fillRect(T, E, D, O), d && (e.strokeStyle = d, e.lineWidth = 1, e.strokeRect(Q(T, l), Q(E, l), Math.max(0, D - 1 / l), Math.max(0, O - 1 / l)));
12733
13077
  let k = n + i / 2;
12734
13078
  e.fillStyle = f, e.fillText(x, Z(k, l), Z(C, l)), e.restore();
12735
13079
  }
12736
- function Ml(e, t) {
13080
+ function Pl(e, t) {
12737
13081
  let { x: n, y: r, width: i, height: a, data: o, scrollLeft: s, kWidth: c, kGap: l, startIndex: u, endIndex: d, dpr: f, bgColor: p = Ba.TRANSPARENT, textColor: m = Ra.SECONDARY, lineColor: h = Va.DARK, fontSize: g = 12, paddingX: _ = 8, drawTopBorder: v = !0, drawBottomBorder: y = !0 } = t, b = Math.round(c * f), x = b % 2 == 0 ? b + 1 : b, S = Math.round(l * f), C = x + S, w = S, T = C / f, E = w / f, D = x / f;
12738
13082
  e.fillStyle = p, e.fillRect(n, r, i, a), v && (e.strokeStyle = h, e.lineWidth = 1, e.beginPath(), e.moveTo(n, Q(r, f)), e.lineTo(n + i, Q(r, f)), e.stroke()), y && (e.strokeStyle = h, e.lineWidth = 1, e.beginPath(), e.moveTo(n, Q(r + a, f)), e.lineTo(n + i, Q(r + a, f)), e.stroke()), e.textAlign = "center", e.textBaseline = "middle";
12739
13083
  let O = r + a / 2 + 1, k = La(o).filter((e) => e >= u && e < d);
@@ -12749,10 +13093,10 @@ function Ml(e, t) {
12749
13093
  }
12750
13094
  //#endregion
12751
13095
  //#region src/core/renderers/Indicator/scale/indicator_scale.ts
12752
- function Nl(e) {
13096
+ function Fl(e) {
12753
13097
  let { ctx: t, dpr: n, axisWidth: r, height: i, paddingTop: a, paddingBottom: o, valueMin: s, valueMax: c, isMain: l, decimals: u = 2, hideEdgeTicks: d = !0, formatLabel: f } = e, p = c - s || 1;
12754
13098
  t.save(), t.clearRect(0, 0, r, i), t.font = "12px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif", t.textBaseline = "middle", t.textAlign = "center";
12755
- let m = r / 2, h = a, g = Math.max(a, i - o), _ = Math.max(0, g - h), v = wl(i, l), y = p / Math.max(1, v - 1);
13099
+ let m = r / 2, h = a, g = Math.max(a, i - o), _ = Math.max(0, g - h), v = El(i, l), y = p / Math.max(1, v - 1);
12756
13100
  for (let e = 0; e < v; e++) {
12757
13101
  if (d && (e === 0 || e === v - 1)) continue;
12758
13102
  let r = c - y * e, i = h + (v <= 1 ? 0 : e / (v - 1)) * _;
@@ -12760,7 +13104,7 @@ function Nl(e) {
12760
13104
  }
12761
13105
  t.restore();
12762
13106
  }
12763
- function Pl(e) {
13107
+ function Il(e) {
12764
13108
  let { axisWidth: t, paneId: n, indicatorKey: r, label: i, decimals: a = 2, yPaddingPx: o = 0, getCrosshair: s, formatTickLabel: c, formatCrosshairLabel: l } = e, u = Hs(r, n), d = null;
12765
13109
  return {
12766
13110
  name: `${r}Scale_${n}`,
@@ -12781,7 +13125,7 @@ function Pl(e) {
12781
13125
  minPrice: f.valueMin,
12782
13126
  maxPrice: f.valueMax
12783
13127
  });
12784
- Nl({
13128
+ Fl({
12785
13129
  ctx: n,
12786
13130
  dpr: i,
12787
13131
  axisWidth: t,
@@ -12798,7 +13142,7 @@ function Pl(e) {
12798
13142
  let m = s?.();
12799
13143
  if (!m || m.activePaneId !== r.id) return;
12800
13144
  let h = m.y - r.top, g = r.yAxis.getPaddingTop(), _ = r.yAxis.getPaddingBottom(), v = g, y = Math.max(g, r.height - _), b = Math.max(1, y - v), x = (Math.min(Math.max(h, v), y) - v) / b, S = p.maxPrice - x * (p.maxPrice - p.minPrice);
12801
- jl(n, {
13145
+ Nl(n, {
12802
13146
  x: 0,
12803
13147
  y: 0,
12804
13148
  width: t,
@@ -12817,7 +13161,7 @@ function Pl(e) {
12817
13161
  }
12818
13162
  //#endregion
12819
13163
  //#region src/core/renderers/yAxis.ts
12820
- function Fl(e) {
13164
+ function Ll(e) {
12821
13165
  return {
12822
13166
  name: "yAxis",
12823
13167
  version: "1.0.0",
@@ -12827,7 +13171,7 @@ function Fl(e) {
12827
13171
  priority: X.SYSTEM_YAXIS,
12828
13172
  draw(t) {
12829
13173
  let { ctx: n, pane: r, dpr: i, yAxisCtx: a, data: o } = t, s = a || n, c = a?.canvas ? a.canvas.width / i : e.axisWidth, l = r.yAxis.getDisplayRange(r.priceRange);
12830
- r.capabilities.showPriceAxisTicks && Nl({
13174
+ r.capabilities.showPriceAxisTicks && Fl({
12831
13175
  ctx: s,
12832
13176
  dpr: i,
12833
13177
  axisWidth: c,
@@ -12843,7 +13187,7 @@ function Fl(e) {
12843
13187
  let u = o, d = r.id === "main" ? u[u.length - 1] : null;
12844
13188
  if (d) {
12845
13189
  let t = r.yAxis.priceToY(d.close);
12846
- jl(s, {
13190
+ Nl(s, {
12847
13191
  x: 0,
12848
13192
  y: r.top,
12849
13193
  width: c,
@@ -12861,7 +13205,7 @@ function Fl(e) {
12861
13205
  });
12862
13206
  }
12863
13207
  let f = e.getCrosshair?.();
12864
- f && f.activePaneId === r.id && f.price !== null && jl(s, {
13208
+ f && f.activePaneId === r.id && f.price !== null && Nl(s, {
12865
13209
  x: 0,
12866
13210
  y: r.top,
12867
13211
  width: c,
@@ -12879,8 +13223,8 @@ function Fl(e) {
12879
13223
  }
12880
13224
  //#endregion
12881
13225
  //#region src/core/renderers/Indicator/scale/macd_scale.ts
12882
- function Il(e) {
12883
- return Pl({
13226
+ function Rl(e) {
13227
+ return Il({
12884
13228
  axisWidth: e.axisWidth,
12885
13229
  paneId: e.paneId,
12886
13230
  indicatorKey: "macd",
@@ -12892,9 +13236,9 @@ function Il(e) {
12892
13236
  }
12893
13237
  //#endregion
12894
13238
  //#region src/core/renderers/Indicator/scale/volume_scale.ts
12895
- var Ll = 1e8;
12896
- function Rl(e) {
12897
- return Pl({
13239
+ var zl = 1e8;
13240
+ function Bl(e) {
13241
+ return Il({
12898
13242
  axisWidth: e.axisWidth,
12899
13243
  paneId: e.paneId,
12900
13244
  indicatorKey: "volume",
@@ -12902,14 +13246,14 @@ function Rl(e) {
12902
13246
  decimals: 2,
12903
13247
  yPaddingPx: e.yPaddingPx,
12904
13248
  getCrosshair: e.getCrosshair,
12905
- formatTickLabel: (e) => (e / Ll).toFixed(2),
12906
- formatCrosshairLabel: (e) => `${(e / Ll).toFixed(2)}亿`
13249
+ formatTickLabel: (e) => (e / zl).toFixed(2),
13250
+ formatCrosshairLabel: (e) => `${(e / zl).toFixed(2)}亿`
12907
13251
  });
12908
13252
  }
12909
13253
  //#endregion
12910
13254
  //#region src/core/renderers/Indicator/scale/rsi_scale.ts
12911
- function zl(e) {
12912
- return Pl({
13255
+ function Vl(e) {
13256
+ return Il({
12913
13257
  axisWidth: e.axisWidth,
12914
13258
  paneId: e.paneId,
12915
13259
  indicatorKey: "rsi",
@@ -12921,8 +13265,8 @@ function zl(e) {
12921
13265
  }
12922
13266
  //#endregion
12923
13267
  //#region src/core/renderers/Indicator/scale/cci_scale.ts
12924
- function Bl(e) {
12925
- return Pl({
13268
+ function Hl(e) {
13269
+ return Il({
12926
13270
  axisWidth: e.axisWidth,
12927
13271
  paneId: e.paneId,
12928
13272
  indicatorKey: "cci",
@@ -12934,8 +13278,8 @@ function Bl(e) {
12934
13278
  }
12935
13279
  //#endregion
12936
13280
  //#region src/core/renderers/Indicator/scale/stoch_scale.ts
12937
- function Vl(e) {
12938
- return Pl({
13281
+ function Ul(e) {
13282
+ return Il({
12939
13283
  axisWidth: e.axisWidth,
12940
13284
  paneId: e.paneId,
12941
13285
  indicatorKey: "stoch",
@@ -12947,8 +13291,8 @@ function Vl(e) {
12947
13291
  }
12948
13292
  //#endregion
12949
13293
  //#region src/core/renderers/Indicator/scale/mom_scale.ts
12950
- function Hl(e) {
12951
- return Pl({
13294
+ function Wl(e) {
13295
+ return Il({
12952
13296
  axisWidth: e.axisWidth,
12953
13297
  paneId: e.paneId,
12954
13298
  indicatorKey: "mom",
@@ -12960,8 +13304,8 @@ function Hl(e) {
12960
13304
  }
12961
13305
  //#endregion
12962
13306
  //#region src/core/renderers/Indicator/scale/wmsr_scale.ts
12963
- function Ul(e) {
12964
- return Pl({
13307
+ function Gl(e) {
13308
+ return Il({
12965
13309
  axisWidth: e.axisWidth,
12966
13310
  paneId: e.paneId,
12967
13311
  indicatorKey: "wmsr",
@@ -12973,8 +13317,8 @@ function Ul(e) {
12973
13317
  }
12974
13318
  //#endregion
12975
13319
  //#region src/core/renderers/Indicator/scale/kst_scale.ts
12976
- function Wl(e) {
12977
- return Pl({
13320
+ function Kl(e) {
13321
+ return Il({
12978
13322
  axisWidth: e.axisWidth,
12979
13323
  paneId: e.paneId,
12980
13324
  indicatorKey: "kst",
@@ -12986,8 +13330,8 @@ function Wl(e) {
12986
13330
  }
12987
13331
  //#endregion
12988
13332
  //#region src/core/renderers/Indicator/scale/fastk_scale.ts
12989
- function Gl(e) {
12990
- return Pl({
13333
+ function ql(e) {
13334
+ return Il({
12991
13335
  axisWidth: e.axisWidth,
12992
13336
  paneId: e.paneId,
12993
13337
  indicatorKey: "fastk",
@@ -12999,19 +13343,19 @@ function Gl(e) {
12999
13343
  }
13000
13344
  //#endregion
13001
13345
  //#region src/core/renderers/timeAxis.ts
13002
- var Kl = Symbol("time-axis");
13003
- function ql(e) {
13346
+ var Jl = Symbol("time-axis");
13347
+ function Yl(e) {
13004
13348
  return {
13005
13349
  name: "timeAxis",
13006
13350
  version: "1.0.0",
13007
13351
  description: "时间轴渲染器",
13008
13352
  debugName: "时间轴",
13009
- paneId: Kl,
13353
+ paneId: Jl,
13010
13354
  priority: X.SYSTEM_XAXIS,
13011
13355
  isSystem: !0,
13012
13356
  draw(t) {
13013
13357
  let { ctx: n, data: r, range: i, scrollLeft: a, kWidth: o, kGap: s, dpr: c, paneWidth: l } = t, u = r, d = n, f = l, p = e.height;
13014
- d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p), Ml(d, {
13358
+ d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p), Pl(d, {
13015
13359
  x: 0,
13016
13360
  y: 0,
13017
13361
  width: f,
@@ -13029,7 +13373,7 @@ function ql(e) {
13029
13373
  let m = e.getCrosshair?.();
13030
13374
  if (m && typeof m.index == "number") {
13031
13375
  let e = u[m.index];
13032
- e && Al(d, {
13376
+ e && Ml(d, {
13033
13377
  x: 0,
13034
13378
  y: 0,
13035
13379
  width: f,
@@ -13045,7 +13389,7 @@ function ql(e) {
13045
13389
  }
13046
13390
  //#endregion
13047
13391
  //#region src/core/renderers/crosshair.ts
13048
- function Jl(e) {
13392
+ function Xl(e) {
13049
13393
  return {
13050
13394
  name: "crosshair",
13051
13395
  version: "1.0.0",
@@ -13069,7 +13413,7 @@ function Jl(e) {
13069
13413
  }
13070
13414
  //#endregion
13071
13415
  //#region src/core/renderers/paneTitle.ts
13072
- function Yl(e) {
13416
+ function Zl(e) {
13073
13417
  let t = { ...e };
13074
13418
  return {
13075
13419
  name: `paneTitle_${e.paneId}`,
@@ -13110,13 +13454,13 @@ function Yl(e) {
13110
13454
  }
13111
13455
  //#endregion
13112
13456
  //#region ~icons/tabler/pointer
13113
- var Xl = {
13457
+ var Ql = {
13114
13458
  viewBox: "0 0 24 24",
13115
13459
  width: "1.2em",
13116
13460
  height: "1.2em"
13117
13461
  };
13118
- function Zl(e, t) {
13119
- return _(), o("svg", Xl, [...t[0] ||= [s("path", {
13462
+ function $l(e, t) {
13463
+ return _(), o("svg", Ql, [...t[0] ||= [s("path", {
13120
13464
  fill: "none",
13121
13465
  stroke: "currentColor",
13122
13466
  "stroke-linecap": "round",
@@ -13125,16 +13469,16 @@ function Zl(e, t) {
13125
13469
  d: "M7.904 17.563a1.2 1.2 0 0 0 2.228.308l2.09-3.093l4.907 4.907a1.067 1.067 0 0 0 1.509 0l1.047-1.047a1.067 1.067 0 0 0 0-1.509l-4.907-4.907l3.113-2.09a1.2 1.2 0 0 0-.309-2.228L4 4z"
13126
13470
  }, null, -1)]]);
13127
13471
  }
13128
- var Ql = d({
13472
+ var eu = d({
13129
13473
  name: "tabler-pointer",
13130
- render: Zl
13131
- }), $l = {
13474
+ render: $l
13475
+ }), tu = {
13132
13476
  viewBox: "0 0 24 24",
13133
13477
  width: "1.2em",
13134
13478
  height: "1.2em"
13135
13479
  };
13136
- function eu(e, t) {
13137
- return _(), o("svg", $l, [...t[0] ||= [s("path", {
13480
+ function nu(e, t) {
13481
+ return _(), o("svg", tu, [...t[0] ||= [s("path", {
13138
13482
  fill: "none",
13139
13483
  stroke: "currentColor",
13140
13484
  "stroke-linecap": "round",
@@ -13143,16 +13487,16 @@ function eu(e, t) {
13143
13487
  d: "M4 19h16M4 15l4-6l4 2l4-5l4 4"
13144
13488
  }, null, -1)]]);
13145
13489
  }
13146
- var tu = d({
13490
+ var ru = d({
13147
13491
  name: "tabler-chart-line",
13148
- render: eu
13149
- }), nu = {
13492
+ render: nu
13493
+ }), iu = {
13150
13494
  viewBox: "0 0 24 24",
13151
13495
  width: "1.2em",
13152
13496
  height: "1.2em"
13153
13497
  };
13154
- function ru(e, t) {
13155
- return _(), o("svg", nu, [...t[0] ||= [s("path", {
13498
+ function au(e, t) {
13499
+ return _(), o("svg", iu, [...t[0] ||= [s("path", {
13156
13500
  fill: "none",
13157
13501
  stroke: "currentColor",
13158
13502
  "stroke-linecap": "round",
@@ -13161,16 +13505,16 @@ function ru(e, t) {
13161
13505
  d: "M17 7L7 17M8 7h9v9"
13162
13506
  }, null, -1)]]);
13163
13507
  }
13164
- var iu = d({
13508
+ var ou = d({
13165
13509
  name: "tabler-arrow-up-right",
13166
- render: ru
13167
- }), au = {
13510
+ render: au
13511
+ }), su = {
13168
13512
  viewBox: "0 0 24 24",
13169
13513
  width: "1.2em",
13170
13514
  height: "1.2em"
13171
13515
  };
13172
- function ou(e, t) {
13173
- return _(), o("svg", au, [...t[0] ||= [s("path", {
13516
+ function cu(e, t) {
13517
+ return _(), o("svg", su, [...t[0] ||= [s("path", {
13174
13518
  fill: "none",
13175
13519
  stroke: "currentColor",
13176
13520
  "stroke-linecap": "round",
@@ -13179,16 +13523,16 @@ function ou(e, t) {
13179
13523
  d: "M5 12h14m-6 6l6-6m-6-6l6 6"
13180
13524
  }, null, -1)]]);
13181
13525
  }
13182
- var su = d({
13526
+ var lu = d({
13183
13527
  name: "tabler-arrow-right",
13184
- render: ou
13185
- }), cu = {
13528
+ render: cu
13529
+ }), uu = {
13186
13530
  viewBox: "0 0 24 24",
13187
13531
  width: "1.2em",
13188
13532
  height: "1.2em"
13189
13533
  };
13190
- function lu(e, t) {
13191
- return _(), o("svg", cu, [...t[0] ||= [s("path", {
13534
+ function du(e, t) {
13535
+ return _(), o("svg", uu, [...t[0] ||= [s("path", {
13192
13536
  fill: "none",
13193
13537
  stroke: "currentColor",
13194
13538
  "stroke-linecap": "round",
@@ -13197,16 +13541,16 @@ function lu(e, t) {
13197
13541
  d: "M5 12h14"
13198
13542
  }, null, -1)]]);
13199
13543
  }
13200
- var uu = d({
13544
+ var fu = d({
13201
13545
  name: "tabler-minus",
13202
- render: lu
13203
- }), du = {
13546
+ render: du
13547
+ }), pu = {
13204
13548
  viewBox: "0 0 24 24",
13205
13549
  width: "1.2em",
13206
13550
  height: "1.2em"
13207
13551
  };
13208
- function fu(e, t) {
13209
- return _(), o("svg", du, [...t[0] ||= [s("path", {
13552
+ function mu(e, t) {
13553
+ return _(), o("svg", pu, [...t[0] ||= [s("path", {
13210
13554
  fill: "none",
13211
13555
  stroke: "currentColor",
13212
13556
  "stroke-linecap": "round",
@@ -13215,16 +13559,16 @@ function fu(e, t) {
13215
13559
  d: "M3 12v.01M7 12h10m4 0v.01"
13216
13560
  }, null, -1)]]);
13217
13561
  }
13218
- var pu = d({
13562
+ var hu = d({
13219
13563
  name: "tabler-separator",
13220
- render: fu
13221
- }), mu = {
13564
+ render: mu
13565
+ }), gu = {
13222
13566
  viewBox: "0 0 24 24",
13223
13567
  width: "1.2em",
13224
13568
  height: "1.2em"
13225
13569
  };
13226
- function hu(e, t) {
13227
- return _(), o("svg", mu, [...t[0] ||= [s("path", {
13570
+ function _u(e, t) {
13571
+ return _(), o("svg", gu, [...t[0] ||= [s("path", {
13228
13572
  fill: "none",
13229
13573
  stroke: "currentColor",
13230
13574
  "stroke-linecap": "round",
@@ -13233,16 +13577,16 @@ function hu(e, t) {
13233
13577
  d: "M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2M9 12h6m-3-3v6"
13234
13578
  }, null, -1)]]);
13235
13579
  }
13236
- var gu = d({
13580
+ var vu = d({
13237
13581
  name: "tabler-crosshair",
13238
- render: hu
13239
- }), _u = {
13582
+ render: _u
13583
+ }), yu = {
13240
13584
  viewBox: "0 0 24 24",
13241
13585
  width: "1.2em",
13242
13586
  height: "1.2em"
13243
13587
  };
13244
- function vu(e, t) {
13245
- return _(), o("svg", _u, [...t[0] ||= [s("g", {
13588
+ function bu(e, t) {
13589
+ return _(), o("svg", yu, [...t[0] ||= [s("g", {
13246
13590
  fill: "none",
13247
13591
  stroke: "currentColor",
13248
13592
  "stroke-linecap": "round",
@@ -13250,16 +13594,16 @@ function vu(e, t) {
13250
13594
  "stroke-width": "2"
13251
13595
  }, [s("path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0m9-3h.01" }), s("path", { d: "M11 12h1v4h1" })], -1)]]);
13252
13596
  }
13253
- var yu = d({
13597
+ var xu = d({
13254
13598
  name: "tabler-info-circle",
13255
- render: vu
13256
- }), bu = {
13599
+ render: bu
13600
+ }), Su = {
13257
13601
  viewBox: "0 0 24 24",
13258
13602
  width: "1.2em",
13259
13603
  height: "1.2em"
13260
13604
  };
13261
- function xu(e, t) {
13262
- return _(), o("svg", bu, [...t[0] ||= [s("path", {
13605
+ function Cu(e, t) {
13606
+ return _(), o("svg", Su, [...t[0] ||= [s("path", {
13263
13607
  fill: "none",
13264
13608
  stroke: "currentColor",
13265
13609
  "stroke-linecap": "round",
@@ -13268,16 +13612,16 @@ function xu(e, t) {
13268
13612
  d: "M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2"
13269
13613
  }, null, -1)]]);
13270
13614
  }
13271
- var Su = d({
13615
+ var wu = d({
13272
13616
  name: "tabler-maximize",
13273
- render: xu
13274
- }), Cu = {
13617
+ render: Cu
13618
+ }), Tu = {
13275
13619
  viewBox: "0 0 24 24",
13276
13620
  width: "1.2em",
13277
13621
  height: "1.2em"
13278
13622
  };
13279
- function wu(e, t) {
13280
- return _(), o("svg", Cu, [...t[0] ||= [s("path", {
13623
+ function Eu(e, t) {
13624
+ return _(), o("svg", Tu, [...t[0] ||= [s("path", {
13281
13625
  fill: "none",
13282
13626
  stroke: "currentColor",
13283
13627
  "stroke-linecap": "round",
@@ -13286,71 +13630,214 @@ function wu(e, t) {
13286
13630
  d: "M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"
13287
13631
  }, null, -1)]]);
13288
13632
  }
13289
- var Tu = d({
13633
+ var Du = d({
13290
13634
  name: "tabler-minimize",
13291
- render: wu
13292
- }), Eu = {
13635
+ render: Eu
13636
+ }), Ou = {
13637
+ viewBox: "0 0 24 24",
13638
+ width: "1.2em",
13639
+ height: "1.2em"
13640
+ };
13641
+ function ku(e, t) {
13642
+ return _(), o("svg", Ou, [...t[0] ||= [s("path", {
13643
+ fill: "none",
13644
+ stroke: "currentColor",
13645
+ "stroke-linecap": "round",
13646
+ "stroke-linejoin": "round",
13647
+ "stroke-width": "2",
13648
+ d: "M3 10a7 7 0 1 0 14 0a7 7 0 1 0-14 0m4 0h6m-3-3v6m11 8l-6-6"
13649
+ }, null, -1)]]);
13650
+ }
13651
+ var Au = d({
13652
+ name: "tabler-zoom-in",
13653
+ render: ku
13654
+ }), ju = {
13655
+ viewBox: "0 0 24 24",
13656
+ width: "1.2em",
13657
+ height: "1.2em"
13658
+ };
13659
+ function Mu(e, t) {
13660
+ return _(), o("svg", ju, [...t[0] ||= [s("path", {
13661
+ fill: "none",
13662
+ stroke: "currentColor",
13663
+ "stroke-linecap": "round",
13664
+ "stroke-linejoin": "round",
13665
+ "stroke-width": "2",
13666
+ d: "M3 10a7 7 0 1 0 14 0a7 7 0 1 0-14 0m4 0h6m8 11l-6-6"
13667
+ }, null, -1)]]);
13668
+ }
13669
+ var Nu = d({
13670
+ name: "tabler-zoom-out",
13671
+ render: Mu
13672
+ }), Pu = {
13673
+ viewBox: "0 0 24 24",
13674
+ width: "1.2em",
13675
+ height: "1.2em"
13676
+ };
13677
+ function Fu(e, t) {
13678
+ return _(), o("svg", Pu, [...t[0] ||= [s("path", {
13679
+ fill: "none",
13680
+ stroke: "currentColor",
13681
+ "stroke-linecap": "round",
13682
+ "stroke-linejoin": "round",
13683
+ "stroke-width": "2",
13684
+ d: "M3 5a2 2 0 1 0 4 0a2 2 0 1 0-4 0m14 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0M3 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0m14 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0M5 7v10M7 5h10M7 19h10m2-12v10"
13685
+ }, null, -1)]]);
13686
+ }
13687
+ var Iu = d({
13688
+ name: "tabler-shape",
13689
+ render: Fu
13690
+ }), Lu = {
13691
+ viewBox: "0 0 24 24",
13692
+ width: "1.2em",
13693
+ height: "1.2em"
13694
+ };
13695
+ function Ru(e, t) {
13696
+ return _(), o("svg", Lu, [...t[0] ||= [s("path", {
13697
+ fill: "none",
13698
+ stroke: "currentColor",
13699
+ "stroke-linecap": "round",
13700
+ "stroke-linejoin": "round",
13701
+ "stroke-width": "2",
13702
+ d: "M3 7a2 2 0 1 0 4 0a2 2 0 1 0-4 0m11 8a2 2 0 1 0 4 0a2 2 0 1 0-4 0m1-9a3 3 0 1 0 6 0a3 3 0 1 0-6 0M3 18a3 3 0 1 0 6 0a3 3 0 1 0-6 0m6-1l5-1.5m-7.5-7l7.81 5.37M7 7l8-1"
13703
+ }, null, -1)]]);
13704
+ }
13705
+ var zu = d({
13706
+ name: "tabler-chart-dots-3",
13707
+ render: Ru
13708
+ }), Bu = {
13709
+ viewBox: "0 0 24 24",
13710
+ width: "1.2em",
13711
+ height: "1.2em"
13712
+ };
13713
+ function Vu(e, t) {
13714
+ return _(), o("svg", Bu, [...t[0] ||= [s("path", {
13715
+ fill: "none",
13716
+ stroke: "currentColor",
13717
+ "stroke-linecap": "round",
13718
+ "stroke-linejoin": "round",
13719
+ "stroke-width": "2",
13720
+ d: "m18 10l-6-6l-6 6zm0 4l-6 6l-6-6z"
13721
+ }, null, -1)]]);
13722
+ }
13723
+ var Hu = d({
13724
+ name: "tabler-caret-up-down",
13725
+ render: Vu
13726
+ }), Uu = {
13727
+ viewBox: "0 0 24 24",
13728
+ width: "1.2em",
13729
+ height: "1.2em"
13730
+ };
13731
+ function Wu(e, t) {
13732
+ return _(), o("svg", Uu, [...t[0] ||= [s("path", {
13733
+ fill: "none",
13734
+ stroke: "currentColor",
13735
+ "stroke-linecap": "round",
13736
+ "stroke-linejoin": "round",
13737
+ "stroke-width": "2",
13738
+ d: "M8 4H5v16h3m8-16h3v16h-3"
13739
+ }, null, -1)]]);
13740
+ }
13741
+ var Gu = d({
13742
+ name: "tabler-brackets",
13743
+ render: Wu
13744
+ }), Ku = {
13293
13745
  class: "left-toolbar",
13294
13746
  "aria-label": "图表工具栏"
13295
- }, Du = { class: "left-toolbar__group" }, Ou = [
13747
+ }, qu = { class: "left-toolbar__group" }, Ju = [
13296
13748
  "title",
13297
13749
  "aria-label",
13298
13750
  "onClick"
13299
- ], ku = ["onClick"], Au = [
13751
+ ], Yu = ["onClick"], Xu = [
13300
13752
  "title",
13301
13753
  "aria-label",
13302
13754
  "onClick"
13303
- ], ju = { class: "left-toolbar__group" }, Mu = ["title", "aria-label"], Nu = /* @__PURE__ */ Oo(/* @__PURE__ */ u({
13755
+ ], Zu = { class: "left-toolbar__group" }, Qu = { class: "left-toolbar__group" }, $u = ["title", "aria-label"], ed = /* @__PURE__ */ Oo(/* @__PURE__ */ u({
13304
13756
  __name: "LeftToolbar",
13305
13757
  props: { isFullscreen: { type: Boolean } },
13306
- emits: ["selectTool", "toggleFullscreen"],
13758
+ emits: [
13759
+ "selectTool",
13760
+ "toggleFullscreen",
13761
+ "zoomIn",
13762
+ "zoomOut"
13763
+ ],
13307
13764
  setup(t, { emit: r }) {
13308
- let c = r, u = [{
13309
- id: "cursor",
13310
- title: "光标",
13311
- icon: Ql
13312
- }, {
13313
- id: "lines",
13314
- title: "线条",
13315
- icon: tu,
13316
- children: [
13317
- {
13318
- id: "trend-line",
13319
- title: "线段",
13320
- icon: tu
13321
- },
13322
- {
13323
- id: "ray",
13324
- title: "射线",
13325
- icon: iu
13326
- },
13327
- {
13328
- id: "h-line",
13329
- title: "水平线",
13330
- icon: uu
13331
- },
13332
- {
13333
- id: "h-ray",
13334
- title: "水平射线",
13335
- icon: su
13336
- },
13337
- {
13338
- id: "v-line",
13339
- title: "垂直线",
13340
- icon: pu
13341
- },
13342
- {
13343
- id: "crosshair-line",
13344
- title: "十字线",
13345
- icon: gu
13346
- },
13347
- {
13348
- id: "info-line",
13349
- title: "信息线",
13350
- icon: yu
13351
- }
13352
- ]
13353
- }], d = y("cursor"), f = y(null);
13765
+ let c = r, u = [
13766
+ {
13767
+ id: "cursor",
13768
+ title: "光标",
13769
+ icon: eu
13770
+ },
13771
+ {
13772
+ id: "lines",
13773
+ title: "线条",
13774
+ icon: ru,
13775
+ children: [
13776
+ {
13777
+ id: "trend-line",
13778
+ title: "线段",
13779
+ icon: ru
13780
+ },
13781
+ {
13782
+ id: "ray",
13783
+ title: "射线",
13784
+ icon: ou
13785
+ },
13786
+ {
13787
+ id: "h-line",
13788
+ title: "水平线",
13789
+ icon: fu
13790
+ },
13791
+ {
13792
+ id: "h-ray",
13793
+ title: "水平射线",
13794
+ icon: lu
13795
+ },
13796
+ {
13797
+ id: "v-line",
13798
+ title: "垂直线",
13799
+ icon: hu
13800
+ },
13801
+ {
13802
+ id: "crosshair-line",
13803
+ title: "十字线",
13804
+ icon: vu
13805
+ },
13806
+ {
13807
+ id: "info-line",
13808
+ title: "信息线",
13809
+ icon: xu
13810
+ }
13811
+ ]
13812
+ },
13813
+ {
13814
+ id: "channels",
13815
+ title: "通道",
13816
+ icon: Iu,
13817
+ children: [
13818
+ {
13819
+ id: "parallel-channel",
13820
+ title: "平行通道",
13821
+ icon: Iu
13822
+ },
13823
+ {
13824
+ id: "regression-channel",
13825
+ title: "回归趋势",
13826
+ icon: zu
13827
+ },
13828
+ {
13829
+ id: "flat-line",
13830
+ title: "平滑顶底",
13831
+ icon: Hu
13832
+ },
13833
+ {
13834
+ id: "disjoint-channel",
13835
+ title: "不相交通道",
13836
+ icon: Gu
13837
+ }
13838
+ ]
13839
+ }
13840
+ ], d = y("cursor"), f = y(null);
13354
13841
  function m(e) {
13355
13842
  return d.value === e.id ? !0 : e.children ? e.children.some((e) => e.id === d.value) : !1;
13356
13843
  }
@@ -13378,8 +13865,8 @@ var Tu = d({
13378
13865
  document.addEventListener("click", T, !0);
13379
13866
  }), g(() => {
13380
13867
  document.removeEventListener("click", T, !0);
13381
- }), (r, c) => (_(), o("nav", Eu, [
13382
- s("div", Du, [(_(), o(e, null, b(u, (t) => s("div", {
13868
+ }), (r, c) => (_(), o("nav", Ku, [
13869
+ s("div", qu, [(_(), o(e, null, b(u, (t) => s("div", {
13383
13870
  key: t.id,
13384
13871
  class: "tool-item"
13385
13872
  }, [s("button", {
@@ -13399,7 +13886,7 @@ var Tu = d({
13399
13886
  class: p(["corner-indicator", { open: f.value === t.id }]),
13400
13887
  onClick: D((e) => C(t.id), ["stop"]),
13401
13888
  "aria-label": "展开子菜单"
13402
- }, null, 10, ku)) : a("", !0)], 42, Ou), l(n, { name: "dropdown" }, {
13889
+ }, null, 10, Yu)) : a("", !0)], 42, Ju), l(n, { name: "dropdown" }, {
13403
13890
  default: E(() => [f.value === t.id && t.children && t.children.length ? (_(), o("div", {
13404
13891
  key: 0,
13405
13892
  class: "tool-dropdown",
@@ -13416,34 +13903,60 @@ var Tu = d({
13416
13903
  }, [(_(), i(x(e.icon), {
13417
13904
  class: "tool-icon",
13418
13905
  "aria-hidden": "true"
13419
- }))], 10, Au))), 128))], 32)) : a("", !0)]),
13906
+ }))], 10, Xu))), 128))], 32)) : a("", !0)]),
13420
13907
  _: 2
13421
13908
  }, 1024)])), 64))]),
13422
- c[10] ||= s("span", { class: "left-toolbar__divider" }, null, -1),
13423
- s("div", ju, [s("button", {
13909
+ c[18] ||= s("span", { class: "left-toolbar__divider" }, null, -1),
13910
+ s("div", Zu, [s("button", {
13424
13911
  type: "button",
13425
13912
  class: "left-toolbar__button",
13426
- title: t.isFullscreen ? "退出全屏" : "全屏显示",
13427
- "aria-label": t.isFullscreen ? "退出全屏" : "全屏显示",
13428
- onClick: c[6] ||= (e) => r.$emit("toggleFullscreen"),
13913
+ title: "放大",
13914
+ "aria-label": "放大",
13915
+ onClick: c[6] ||= (e) => r.$emit("zoomIn"),
13429
13916
  onPointerdown: c[7] ||= D(() => {}, ["stop"]),
13430
13917
  onPointermove: c[8] ||= D(() => {}, ["stop"]),
13431
13918
  onPointerup: c[9] ||= D(() => {}, ["stop"])
13432
- }, [t.isFullscreen ? (_(), i(w(Tu), {
13919
+ }, [l(w(Au), {
13920
+ class: "tool-icon",
13921
+ "aria-hidden": "true"
13922
+ })], 32), s("button", {
13923
+ type: "button",
13924
+ class: "left-toolbar__button",
13925
+ title: "缩小",
13926
+ "aria-label": "缩小",
13927
+ onClick: c[10] ||= (e) => r.$emit("zoomOut"),
13928
+ onPointerdown: c[11] ||= D(() => {}, ["stop"]),
13929
+ onPointermove: c[12] ||= D(() => {}, ["stop"]),
13930
+ onPointerup: c[13] ||= D(() => {}, ["stop"])
13931
+ }, [l(w(Nu), {
13932
+ class: "tool-icon",
13933
+ "aria-hidden": "true"
13934
+ })], 32)]),
13935
+ c[19] ||= s("span", { class: "left-toolbar__divider" }, null, -1),
13936
+ s("div", Qu, [s("button", {
13937
+ type: "button",
13938
+ class: "left-toolbar__button",
13939
+ title: t.isFullscreen ? "退出全屏" : "全屏显示",
13940
+ "aria-label": t.isFullscreen ? "退出全屏" : "全屏显示",
13941
+ onClick: c[14] ||= (e) => r.$emit("toggleFullscreen"),
13942
+ onPointerdown: c[15] ||= D(() => {}, ["stop"]),
13943
+ onPointermove: c[16] ||= D(() => {}, ["stop"]),
13944
+ onPointerup: c[17] ||= D(() => {}, ["stop"])
13945
+ }, [t.isFullscreen ? (_(), i(w(Du), {
13433
13946
  key: 0,
13434
13947
  class: "tool-icon",
13435
13948
  "aria-hidden": "true"
13436
- })) : (_(), i(w(Su), {
13949
+ })) : (_(), i(w(wu), {
13437
13950
  key: 1,
13438
13951
  class: "tool-icon",
13439
13952
  "aria-hidden": "true"
13440
- }))], 40, Mu)])
13953
+ }))], 40, $u)])
13441
13954
  ]));
13442
13955
  }
13443
- }), [["__scopeId", "data-v-42a7d005"]]), Pu = { class: "chart-wrapper" }, Fu = { class: "chart-main" }, Iu = {
13956
+ }), [["__scopeId", "data-v-f1125609"]]), td = { class: "chart-wrapper" }, nd = { class: "chart-main" }, rd = {
13444
13957
  class: "pane-separator-layer",
13445
13958
  "aria-hidden": "true"
13446
- }, Lu = 4, Ru = /* @__PURE__ */ Oo(/* @__PURE__ */ u({
13959
+ }, id = 4, ad = /* @__PURE__ */ Oo(/* @__PURE__ */ u({
13447
13960
  __name: "KLineChart",
13448
13961
  props: {
13449
13962
  semanticConfig: {},
@@ -13470,12 +13983,12 @@ var Tu = d({
13470
13983
  rightAxisWidth: u.rightAxisWidth,
13471
13984
  priceLabelWidth: u.priceLabelWidth
13472
13985
  });
13473
- k.actions.setZoomState(k.state.zoomLevel, ml(k.state.zoomLevel, {
13986
+ k.actions.setZoomState(k.state.zoomLevel, gl(k.state.zoomLevel, {
13474
13987
  minKWidth: u.minKWidth,
13475
13988
  maxKWidth: u.maxKWidth,
13476
13989
  zoomLevelCount: u.zoomLevels,
13477
13990
  dpr: k.state.viewportDpr
13478
- }), hl(k.state.viewportDpr)), r(() => k.state.dataLength), r(() => k.state.viewportDpr);
13991
+ }), _l(k.state.viewportDpr)), r(() => k.state.dataLength), r(() => k.state.viewportDpr);
13479
13992
  let A = r(() => k.state.zoomLevel), j = r(() => k.state.kWidth), M = r(() => k.state.kGap), N = r(() => k.state.paneRatios), ee = r(() => k.state.selectedDrawingId), P = r(() => k.state.dataVersion);
13480
13993
  function F() {
13481
13994
  D.value?.scheduleDraw();
@@ -13675,11 +14188,11 @@ var Tu = d({
13675
14188
  return { ...Ne[e].defaultParams };
13676
14189
  }
13677
14190
  function Le(e = "VOLUME", t) {
13678
- if (U.value.length >= Lu) return !1;
14191
+ if (U.value.length >= id) return !1;
13679
14192
  let n = `sub_${e}`;
13680
14193
  if (U.value.some((e) => e.id === n)) return !0;
13681
14194
  if (!D.value?.createSubPane(e, t ?? Ie(e))) return !1;
13682
- let r = Yl({
14195
+ let r = Zl({
13683
14196
  paneId: n,
13684
14197
  title: e,
13685
14198
  getTitleInfo: () => Ue(n)
@@ -13731,7 +14244,7 @@ var Tu = d({
13731
14244
  let e = D.value?.getSubPaneIndicators() ?? [];
13732
14245
  U.value = [];
13733
14246
  for (let t of e) {
13734
- let e = `sub_${t}`, n = Yl({
14247
+ let e = `sub_${t}`, n = Zl({
13735
14248
  paneId: e,
13736
14249
  title: t,
13737
14250
  getTitleInfo: () => Ue(e)
@@ -13751,7 +14264,7 @@ var Tu = d({
13751
14264
  if (!n) return;
13752
14265
  let r = n.indicatorId;
13753
14266
  D.value?.removeRenderer(n.paneTitleRendererName), D.value?.removeSubPane(r), D.value?.createSubPane(t, Ie(t));
13754
- let i = `sub_${t}`, a = Yl({
14267
+ let i = `sub_${t}`, a = Zl({
13755
14268
  paneId: i,
13756
14269
  title: t,
13757
14270
  getTitleInfo: () => Ue(i)
@@ -13840,13 +14353,17 @@ var Tu = d({
13840
14353
  }
13841
14354
  let Je = r(() => u.rightAxisWidth + u.priceLabelWidth), Ye = k.computed.totalWidth;
13842
14355
  function Xe() {
13843
- let e = E.value;
13844
- e && (e.scrollLeft = e.scrollWidth, F());
14356
+ let e = E.value, t = D.value;
14357
+ if (!e || !t) return;
14358
+ let n = t.getData()?.length ?? 0;
14359
+ if (n === 0) return;
14360
+ let r = t.getCurrentDpr(), { unitPx: i, startXPx: a } = Ms(j.value, M.value, r), o = (a + n * i) / r, s = Math.max(0, e.scrollWidth - e.clientWidth), c = Math.min(s, Math.max(0, o - e.clientWidth));
14361
+ e.scrollLeft = Math.round(c * r) / r, F();
13845
14362
  }
13846
14363
  function Ze(e, t) {
13847
14364
  let n = D.value, r = E.value;
13848
14365
  if (!n || !r) return;
13849
- let i = n.getCurrentDpr(), a = _l(e, t ?? (n.getViewport()?.plotWidth ?? r.clientWidth) / 2, r.scrollLeft, A.value, j.value, M.value, {
14366
+ let i = n.getCurrentDpr(), a = yl(e, t ?? (n.getViewport()?.plotWidth ?? r.clientWidth) / 2, r.scrollLeft, A.value, j.value, M.value, {
13850
14367
  minKWidth: u.minKWidth,
13851
14368
  maxKWidth: u.maxKWidth,
13852
14369
  zoomLevelCount: u.zoomLevels,
@@ -13882,7 +14399,7 @@ var Tu = d({
13882
14399
  t.preventDefault();
13883
14400
  let n = D.value;
13884
14401
  if (!n) return;
13885
- let r = e.getBoundingClientRect(), i = t.clientX - r.left, a = e.scrollLeft, o = n.getCurrentDpr(), s = gl(t.deltaY > 0 ? -1 : 1, i, a, A.value, j.value, M.value, {
14402
+ let r = e.getBoundingClientRect(), i = t.clientX - r.left, a = e.scrollLeft, o = n.getCurrentDpr(), s = vl(t.deltaY > 0 ? -1 : 1, i, a, A.value, j.value, M.value, {
13886
14403
  minKWidth: u.minKWidth,
13887
14404
  maxKWidth: u.maxKWidth,
13888
14405
  zoomLevelCount: u.zoomLevels,
@@ -13896,7 +14413,7 @@ var Tu = d({
13896
14413
  }));
13897
14414
  };
13898
14415
  e.addEventListener("wheel", i, { passive: !1 });
13899
- let a = new fl({
14416
+ let a = new ml({
13900
14417
  container: e,
13901
14418
  canvasLayer: t,
13902
14419
  rightAxisLayer: n,
@@ -13916,13 +14433,13 @@ var Tu = d({
13916
14433
  zoomLevels: u.zoomLevels,
13917
14434
  initialZoomLevel: u.initialZoomLevel
13918
14435
  });
13919
- a.useRenderer(Tl()), a.useRenderer(Dl()), a.useRenderer(Xs({
14436
+ a.useRenderer(Dl()), a.useRenderer(kl()), a.useRenderer(Xs({
13920
14437
  ma5: !0,
13921
14438
  ma10: !0,
13922
14439
  ma20: !0,
13923
14440
  ma30: !0,
13924
14441
  ma60: !0
13925
- })), a.useRenderer(Qs()), a.setRendererEnabled("boll", !1), a.useRenderer(nc()), a.setRendererEnabled("expma", !1), a.useRenderer(ac()), a.setRendererEnabled("ene", !1), a.useRenderer(Sl()), a.useRenderer(El()), a.useRenderer(ka());
14442
+ })), a.useRenderer(Qs()), a.setRendererEnabled("boll", !1), a.useRenderer(nc()), a.setRendererEnabled("expma", !1), a.useRenderer(ac()), a.setRendererEnabled("ene", !1), a.useRenderer(wl()), a.useRenderer(Ol()), a.useRenderer(ka());
13926
14443
  let o = u.rightAxisWidth + u.priceLabelWidth, s = () => {
13927
14444
  let e = a.interaction.crosshairPos, t = a.interaction.crosshairPrice, n = a.interaction.activePaneId;
13928
14445
  return e && t !== null ? {
@@ -13931,46 +14448,46 @@ var Tu = d({
13931
14448
  activePaneId: n
13932
14449
  } : null;
13933
14450
  };
13934
- a.useRenderer(Fl({
14451
+ a.useRenderer(Ll({
13935
14452
  axisWidth: o,
13936
14453
  yPaddingPx: u.yPaddingPx,
13937
14454
  getCrosshair: s
13938
14455
  })), a.useRenderer(sc({ yPaddingPx: u.yPaddingPx }));
13939
14456
  let c = [
13940
14457
  {
13941
- create: Rl,
14458
+ create: Bl,
13942
14459
  paneId: "sub_VOLUME"
13943
14460
  },
13944
14461
  {
13945
- create: Il,
14462
+ create: Rl,
13946
14463
  paneId: "sub_MACD"
13947
14464
  },
13948
14465
  {
13949
- create: zl,
14466
+ create: Vl,
13950
14467
  paneId: "sub_RSI"
13951
14468
  },
13952
14469
  {
13953
- create: Bl,
14470
+ create: Hl,
13954
14471
  paneId: "sub_CCI"
13955
14472
  },
13956
14473
  {
13957
- create: Vl,
14474
+ create: Ul,
13958
14475
  paneId: "sub_STOCH"
13959
14476
  },
13960
14477
  {
13961
- create: Hl,
14478
+ create: Wl,
13962
14479
  paneId: "sub_MOM"
13963
14480
  },
13964
14481
  {
13965
- create: Ul,
14482
+ create: Gl,
13966
14483
  paneId: "sub_WMSR"
13967
14484
  },
13968
14485
  {
13969
- create: Wl,
14486
+ create: Kl,
13970
14487
  paneId: "sub_KST"
13971
14488
  },
13972
14489
  {
13973
- create: Gl,
14490
+ create: ql,
13974
14491
  paneId: "sub_FASTK"
13975
14492
  }
13976
14493
  ];
@@ -13980,12 +14497,12 @@ var Tu = d({
13980
14497
  yPaddingPx: u.yPaddingPx,
13981
14498
  getCrosshair: s
13982
14499
  }));
13983
- a.useRenderer(Jl({ getCrosshairState: () => ({
14500
+ a.useRenderer(Xl({ getCrosshairState: () => ({
13984
14501
  pos: a.interaction.crosshairPos,
13985
14502
  activePaneId: a.interaction.activePaneId,
13986
14503
  isDragging: a.interaction.isDraggingState(),
13987
14504
  price: a.interaction.crosshairPrice
13988
- }) })), a.useRenderer(ql({
14505
+ }) })), a.useRenderer(Yl({
13989
14506
  height: u.bottomAxisHeight,
13990
14507
  getCrosshair: () => {
13991
14508
  let e = a.interaction.crosshairPos, t = a.interaction.crosshairIndex;
@@ -13996,16 +14513,18 @@ var Tu = d({
13996
14513
  }
13997
14514
  })), a.setOnViewportChange((e) => {
13998
14515
  k.actions.setViewportDpr(e.dpr), k.actions.setViewWidth(e.plotWidth);
13999
- let t = hl(e.dpr);
14516
+ let t = _l(e.dpr);
14000
14517
  k.actions.setZoomState(k.state.zoomLevel, k.state.kWidth, t), a.applyRenderState(k.state.kWidth, t, k.state.zoomLevel);
14001
14518
  }), a.setOnPaneLayoutChange((e) => {
14002
14519
  let t = {};
14003
14520
  for (let n of e) t[n.id] = n.ratio;
14004
- k.actions.setPaneRatios(t), ae.value = a.getPaneRenderers().slice(0, -1).map((e) => {
14521
+ k.actions.setPaneRatios(t);
14522
+ let n = a.getPaneRenderers(), r = E.value && parseInt(getComputedStyle(E.value).borderTopWidth) || 0;
14523
+ ae.value = n.slice(0, -1).map((e) => {
14005
14524
  let t = e.getPane();
14006
14525
  return {
14007
14526
  id: t.id,
14008
- top: t.top + t.height
14527
+ top: t.top + t.height + r
14009
14528
  };
14010
14529
  });
14011
14530
  }), a.setOnDataChange((e) => {
@@ -14020,6 +14539,21 @@ var Tu = d({
14020
14539
  }
14021
14540
  }), a.interaction.setTooltipAnchorPositioning(L.value), a.interaction.setOnInteractionChange((e) => {
14022
14541
  R.value = e;
14542
+ }), a.interaction.setOnPinchZoom((e, t) => {
14543
+ let n = E.value;
14544
+ if (!n || !a) return;
14545
+ let r = t - n.getBoundingClientRect().left, i = n.scrollLeft, o = a.getCurrentDpr(), s = vl(e, r, i, A.value, j.value, M.value, {
14546
+ minKWidth: u.minKWidth,
14547
+ maxKWidth: u.maxKWidth,
14548
+ zoomLevelCount: u.zoomLevels,
14549
+ dpr: o
14550
+ });
14551
+ s && (k.actions.setZoomState(s.targetLevel, s.newKWidth, s.newKGap), a.interaction.clearHover(), f(() => {
14552
+ let e = E.value;
14553
+ if (!e) return;
14554
+ let t = Math.max(0, e.scrollWidth - e.clientWidth), n = Math.min(Math.max(0, s.newScrollLeft), t);
14555
+ e.scrollLeft = Math.round(n * o) / o, a.applyRenderState(s.newKWidth, s.newKGap, s.targetLevel), d("zoomLevelChange", s.targetLevel, s.newKWidth);
14556
+ }));
14023
14557
  }), R.value = a.interaction.getInteractionSnapshot(), k.actions.setViewportDpr(a.getCurrentDpr()), a.resize(), O.value = new $i(a), O.value.on("config:error", (e) => {
14024
14558
  console.error("Semantic config error:", e);
14025
14559
  }), O.value.on("config:ready", () => {
@@ -14041,18 +14575,20 @@ var Tu = d({
14041
14575
  let t = await O.value?.applyConfig(e);
14042
14576
  t && !t.success && console.error("Semantic config apply failed:", t.errors);
14043
14577
  }
14044
- }, { deep: !0 }), (n, r) => (_(), o("div", Pu, [s("div", { class: p(["chart-stage", {
14578
+ }, { deep: !0 }), (n, r) => (_(), o("div", td, [s("div", { class: p(["chart-stage", {
14045
14579
  "is-dragging": ce.value,
14046
14580
  "is-resizing-pane": le.value,
14047
14581
  "is-hovering-pane-separator": ue.value,
14048
14582
  "is-hovering-right-axis": fe.value,
14049
14583
  "is-hovering-kline": pe.value !== null
14050
- }]) }, [l(Nu, {
14584
+ }]) }, [l(ed, {
14051
14585
  "is-fullscreen": t.isFullscreen,
14052
14586
  onSelectTool: be,
14053
- onToggleFullscreen: r[0] ||= (e) => n.$emit("toggleFullscreen")
14054
- }, null, 8, ["is-fullscreen"]), s("div", Fu, [
14055
- s("div", Iu, [(_(!0), o(e, null, b(ae.value, (e) => (_(), o("div", {
14587
+ onToggleFullscreen: r[0] ||= (e) => n.$emit("toggleFullscreen"),
14588
+ onZoomIn: r[1] ||= (e) => Ze(A.value + 1),
14589
+ onZoomOut: r[2] ||= (e) => Ze(A.value - 1)
14590
+ }, null, 8, ["is-fullscreen"]), s("div", nd, [
14591
+ s("div", rd, [(_(!0), o(e, null, b(ae.value, (e) => (_(), o("div", {
14056
14592
  key: e.id,
14057
14593
  class: p(["pane-separator-line", { "is-active": de.value === e.id }]),
14058
14594
  style: m({ top: `${e.top}px` })
@@ -14150,8 +14686,8 @@ var Tu = d({
14150
14686
  onReorderSubIndicators: qe
14151
14687
  }, null, 8, ["active-indicators", "indicator-params"])]));
14152
14688
  }
14153
- }), [["__scopeId", "data-v-eede0b8f"]]), zu = { install(e) {
14154
- e.component("KLineChart", Ru);
14689
+ }), [["__scopeId", "data-v-3ad2d352"]]), od = { install(e) {
14690
+ e.component("KLineChart", ad);
14155
14691
  } };
14156
14692
  //#endregion
14157
- export { ya as ConfigManager, I as EventBus, ga as GLOBAL_PANE_ID, va as HookSystem, Ru as KLineChart, zu as KMapPlugin, xa as PluginHostImpl, _a as PluginRegistry, ma as PluginState, X as RENDERER_PRIORITY, wa as RendererPluginManager, Sa as createPluginHost, ha as wrapPaneInfo };
14693
+ export { ya as ConfigManager, I as EventBus, ga as GLOBAL_PANE_ID, va as HookSystem, ad as KLineChart, od as KMapPlugin, xa as PluginHostImpl, _a as PluginRegistry, ma as PluginState, X as RENDERER_PRIORITY, wa as RendererPluginManager, Sa as createPluginHost, ha as wrapPaneInfo };