@363045841yyt/klinechart 0.3.1 → 0.4.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
@@ -57,30 +57,30 @@ function te(e, t) {
57
57
  }
58
58
  //#endregion
59
59
  //#region node_modules/.pnpm/axios@1.15.2/node_modules/axios/lib/utils.js
60
- var { toString: ne } = Object.prototype, { getPrototypeOf: re } = Object, { iterator: ie, toStringTag: ae } = Symbol, oe = ((e) => (t) => {
60
+ var { toString: ne } = Object.prototype, { getPrototypeOf: re } = Object, { iterator: ie, toStringTag: ae } = Symbol, L = ((e) => (t) => {
61
61
  let n = ne.call(t);
62
62
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
63
- })(Object.create(null)), L = (e) => (e = e.toLowerCase(), (t) => oe(t) === e), se = (e) => (t) => typeof t === e, { isArray: ce } = Array, le = se("undefined");
64
- function ue(e) {
65
- return e !== null && !le(e) && e.constructor !== null && !le(e.constructor) && V(e.constructor.isBuffer) && e.constructor.isBuffer(e);
63
+ })(Object.create(null)), R = (e) => (e = e.toLowerCase(), (t) => L(t) === e), oe = (e) => (t) => typeof t === e, { isArray: se } = Array, ce = oe("undefined");
64
+ function le(e) {
65
+ return e !== null && !ce(e) && e.constructor !== null && !ce(e.constructor) && V(e.constructor.isBuffer) && e.constructor.isBuffer(e);
66
66
  }
67
- var R = L("ArrayBuffer");
67
+ var ue = R("ArrayBuffer");
68
68
  function z(e) {
69
69
  let t;
70
- return t = typeof ArrayBuffer < "u" && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && R(e.buffer), t;
70
+ return t = typeof ArrayBuffer < "u" && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && ue(e.buffer), t;
71
71
  }
72
- var B = se("string"), V = se("function"), de = se("number"), fe = (e) => typeof e == "object" && !!e, pe = (e) => e === !0 || e === !1, me = (e) => {
73
- if (oe(e) !== "object") return !1;
72
+ var B = oe("string"), V = oe("function"), de = oe("number"), fe = (e) => typeof e == "object" && !!e, pe = (e) => e === !0 || e === !1, me = (e) => {
73
+ if (L(e) !== "object") return !1;
74
74
  let t = re(e);
75
75
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(ae in e) && !(ie in e);
76
76
  }, he = (e) => {
77
- if (!fe(e) || ue(e)) return !1;
77
+ if (!fe(e) || le(e)) return !1;
78
78
  try {
79
79
  return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
80
80
  } catch {
81
81
  return !1;
82
82
  }
83
- }, ge = L("Date"), _e = L("File"), ve = (e) => !!(e && e.uri !== void 0), ye = (e) => e && e.getParts !== void 0, be = L("Blob"), xe = L("FileList"), Se = (e) => fe(e) && V(e.pipe);
83
+ }, ge = R("Date"), _e = R("File"), ve = (e) => !!(e && e.uri !== void 0), ye = (e) => e && e.getParts !== void 0, be = R("Blob"), xe = R("FileList"), Se = (e) => fe(e) && V(e.pipe);
84
84
  function Ce() {
85
85
  return typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
86
86
  }
@@ -89,37 +89,37 @@ var we = Ce(), Te = we.FormData === void 0 ? void 0 : we.FormData, Ee = (e) => {
89
89
  if (Te && e instanceof Te) return !0;
90
90
  let t = re(e);
91
91
  if (!t || t === Object.prototype || !V(e.append)) return !1;
92
- let n = oe(e);
92
+ let n = L(e);
93
93
  return n === "formdata" || n === "object" && V(e.toString) && e.toString() === "[object FormData]";
94
- }, De = L("URLSearchParams"), [Oe, ke, Ae, je] = [
94
+ }, De = R("URLSearchParams"), [Oe, ke, Ae, je] = [
95
95
  "ReadableStream",
96
96
  "Request",
97
97
  "Response",
98
98
  "Headers"
99
- ].map(L), Me = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
99
+ ].map(R), Me = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
100
100
  function Ne(e, t, { allOwnKeys: n = !1 } = {}) {
101
101
  if (e == null) return;
102
102
  let r, i;
103
- if (typeof e != "object" && (e = [e]), ce(e)) for (r = 0, i = e.length; r < i; r++) t.call(null, e[r], r, e);
103
+ if (typeof e != "object" && (e = [e]), se(e)) for (r = 0, i = e.length; r < i; r++) t.call(null, e[r], r, e);
104
104
  else {
105
- if (ue(e)) return;
105
+ if (le(e)) return;
106
106
  let i = n ? Object.getOwnPropertyNames(e) : Object.keys(e), a = i.length, o;
107
107
  for (r = 0; r < a; r++) o = i[r], t.call(null, e[o], o, e);
108
108
  }
109
109
  }
110
110
  function Pe(e, t) {
111
- if (ue(e)) return null;
111
+ if (le(e)) return null;
112
112
  t = t.toLowerCase();
113
113
  let n = Object.keys(e), r = n.length, i;
114
114
  for (; r-- > 0;) if (i = n[r], t === i.toLowerCase()) return i;
115
115
  return null;
116
116
  }
117
- var Fe = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Ie = (e) => !le(e) && e !== Fe;
117
+ var Fe = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Ie = (e) => !ce(e) && e !== Fe;
118
118
  function Le() {
119
119
  let { caseless: e, skipUndefined: t } = Ie(this) && this || {}, n = {}, r = (r, i) => {
120
120
  if (i === "__proto__" || i === "constructor" || i === "prototype") return;
121
121
  let a = e && Pe(n, i) || i;
122
- me(n[a]) && me(r) ? n[a] = Le(n[a], r) : me(r) ? n[a] = Le({}, r) : ce(r) ? n[a] = r.slice() : (!t || !le(r)) && (n[a] = r);
122
+ me(n[a]) && me(r) ? n[a] = Le(n[a], r) : me(r) ? n[a] = Le({}, r) : se(r) ? n[a] = r.slice() : (!t || !ce(r)) && (n[a] = r);
123
123
  };
124
124
  for (let e = 0, t = arguments.length; e < t; e++) arguments[e] && Ne(arguments[e], r);
125
125
  return n;
@@ -157,7 +157,7 @@ var Re = (e, t, n, { allOwnKeys: r } = {}) => (Ne(t, (t, r) => {
157
157
  return r !== -1 && r === n;
158
158
  }, Ue = (e) => {
159
159
  if (!e) return null;
160
- if (ce(e)) return e;
160
+ if (se(e)) return e;
161
161
  let t = e.length;
162
162
  if (!de(t)) return null;
163
163
  let n = Array(t);
@@ -173,9 +173,9 @@ var Re = (e, t, n, { allOwnKeys: r } = {}) => (Ne(t, (t, r) => {
173
173
  let n, r = [];
174
174
  for (; (n = e.exec(t)) !== null;) r.push(n);
175
175
  return r;
176
- }, qe = L("HTMLFormElement"), Je = (e) => e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(e, t, n) {
176
+ }, qe = R("HTMLFormElement"), Je = (e) => e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(e, t, n) {
177
177
  return t.toUpperCase() + n;
178
- }), Ye = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Xe = L("RegExp"), Ze = (e, t) => {
178
+ }), Ye = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Xe = R("RegExp"), Ze = (e, t) => {
179
179
  let n = Object.getOwnPropertyDescriptors(e), r = {};
180
180
  Ne(n, (n, i) => {
181
181
  let a;
@@ -205,7 +205,7 @@ var Re = (e, t, n, { allOwnKeys: r } = {}) => (Ne(t, (t, r) => {
205
205
  n[e] = !0;
206
206
  });
207
207
  };
208
- return ce(e) ? r(e) : r(String(e).split(t)), n;
208
+ return se(e) ? r(e) : r(String(e).split(t)), n;
209
209
  }, et = () => {}, tt = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
210
210
  function nt(e) {
211
211
  return !!(e && V(e.append) && e[ae] === "FormData" && e[ie]);
@@ -214,27 +214,27 @@ var rt = (e) => {
214
214
  let t = Array(10), n = (e, r) => {
215
215
  if (fe(e)) {
216
216
  if (t.indexOf(e) >= 0) return;
217
- if (ue(e)) return e;
217
+ if (le(e)) return e;
218
218
  if (!("toJSON" in e)) {
219
219
  t[r] = e;
220
- let i = ce(e) ? [] : {};
220
+ let i = se(e) ? [] : {};
221
221
  return Ne(e, (e, t) => {
222
222
  let a = n(e, r + 1);
223
- !le(a) && (i[t] = a);
223
+ !ce(a) && (i[t] = a);
224
224
  }), t[r] = void 0, i;
225
225
  }
226
226
  }
227
227
  return e;
228
228
  };
229
229
  return n(e, 0);
230
- }, it = L("AsyncFunction"), at = (e) => e && (fe(e) || V(e)) && V(e.then) && V(e.catch), ot = ((e, t) => e ? setImmediate : t ? ((e, t) => (Fe.addEventListener("message", ({ source: n, data: r }) => {
230
+ }, it = R("AsyncFunction"), at = (e) => e && (fe(e) || V(e)) && V(e.then) && V(e.catch), ot = ((e, t) => e ? setImmediate : t ? ((e, t) => (Fe.addEventListener("message", ({ source: n, data: r }) => {
231
231
  n === Fe && r === e && t.length && t.shift()();
232
232
  }, !1), (n) => {
233
233
  t.push(n), Fe.postMessage(e, "*");
234
234
  }))(`axios@${Math.random()}`, []) : (e) => setTimeout(e))(typeof setImmediate == "function", V(Fe.postMessage)), H = {
235
- isArray: ce,
236
- isArrayBuffer: R,
237
- isBuffer: ue,
235
+ isArray: se,
236
+ isArrayBuffer: ue,
237
+ isBuffer: le,
238
238
  isFormData: Ee,
239
239
  isArrayBufferView: z,
240
240
  isString: B,
@@ -247,7 +247,7 @@ var rt = (e) => {
247
247
  isRequest: ke,
248
248
  isResponse: Ae,
249
249
  isHeaders: je,
250
- isUndefined: le,
250
+ isUndefined: ce,
251
251
  isDate: ge,
252
252
  isFile: _e,
253
253
  isReactNativeBlob: ve,
@@ -266,8 +266,8 @@ var rt = (e) => {
266
266
  stripBOM: ze,
267
267
  inherits: Be,
268
268
  toFlatObject: Ve,
269
- kindOf: oe,
270
- kindOfTest: L,
269
+ kindOf: L,
270
+ kindOfTest: R,
271
271
  endsWith: He,
272
272
  toArray: Ue,
273
273
  forEachEntry: Ge,
@@ -3530,7 +3530,7 @@ var ur = /* @__PURE__ */ M(((e) => {
3530
3530
  function N(e, t, n, a) {
3531
3531
  let { gen: o, schema: s, data: u, allErrors: f, opts: p, self: m } = e, { RULES: h } = m;
3532
3532
  if (s.$ref && (p.ignoreKeywordsWithRef || !(0, d.schemaHasRulesButRef)(s, h))) {
3533
- o.block(() => L(e, "$ref", h.all.$ref.definition));
3533
+ o.block(() => R(e, "$ref", h.all.$ref.definition));
3534
3534
  return;
3535
3535
  }
3536
3536
  p.jtd || ee(e, t), o.block(() => {
@@ -3544,7 +3544,7 @@ var ur = /* @__PURE__ */ M(((e) => {
3544
3544
  function P(e, t) {
3545
3545
  let { gen: n, schema: i, opts: { useDefaults: o } } = e;
3546
3546
  o && (0, a.assignDefaults)(e, t.type), n.block(() => {
3547
- for (let n of t.rules) (0, r.shouldUseRule)(i, n) && L(e, n.keyword, n.definition, t.type);
3547
+ for (let n of t.rules) (0, r.shouldUseRule)(i, n) && R(e, n.keyword, n.definition, t.type);
3548
3548
  });
3549
3549
  }
3550
3550
  function ee(e, t) {
@@ -3589,9 +3589,9 @@ var ur = /* @__PURE__ */ M(((e) => {
3589
3589
  let n = e.schemaEnv.baseId + e.errSchemaPath;
3590
3590
  t += ` at "${n}" (strictTypes)`, (0, d.checkStrictMode)(e, t, e.opts.strictTypes);
3591
3591
  }
3592
- var oe = class {
3592
+ var L = class {
3593
3593
  constructor(e, t, n) {
3594
- if ((0, o.validateKeywordUsage)(e, t, n), this.gen = e.gen, this.allErrors = e.allErrors, this.keyword = n, this.data = e.data, this.schema = e.schema[n], this.$data = t.$data && e.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, d.schemaRefOrVal)(e, this.schema, n, this.$data), this.schemaType = t.schemaType, this.parentSchema = e.schema, this.params = {}, this.it = e, this.def = t, this.$data) this.schemaCode = e.gen.const("vSchema", le(this.$data, e));
3594
+ if ((0, o.validateKeywordUsage)(e, t, n), this.gen = e.gen, this.allErrors = e.allErrors, this.keyword = n, this.data = e.data, this.schema = e.schema[n], this.$data = t.$data && e.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, d.schemaRefOrVal)(e, this.schema, n, this.$data), this.schemaType = t.schemaType, this.parentSchema = e.schema, this.params = {}, this.it = e, this.def = t, this.$data) this.schemaCode = e.gen.const("vSchema", ce(this.$data, e));
3595
3595
  else if (this.schemaCode = this.schemaValue, !(0, o.validSchemaType)(this.schema, t.schemaType, t.allowUndefined)) throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);
3596
3596
  ("code" in t ? t.trackErrors : t.errors !== !1) && (this.errsCount = e.gen.const("_errs", l.default.errors));
3597
3597
  }
@@ -3689,20 +3689,20 @@ var ur = /* @__PURE__ */ M(((e) => {
3689
3689
  if (n.opts.unevaluated && (n.props !== !0 || n.items !== !0)) return r.if(t, () => this.mergeEvaluated(e, c.Name)), !0;
3690
3690
  }
3691
3691
  };
3692
- e.KeywordCxt = oe;
3693
- function L(e, t, n, r) {
3694
- let i = new oe(e, n, t);
3692
+ e.KeywordCxt = L;
3693
+ function R(e, t, n, r) {
3694
+ let i = new L(e, n, t);
3695
3695
  "code" in n ? n.code(i, r) : i.$data && n.validate ? (0, o.funcKeywordCode)(i, n) : "macro" in n ? (0, o.macroKeywordCode)(i, n) : (n.compile || n.validate) && (0, o.funcKeywordCode)(i, n);
3696
3696
  }
3697
- var se = /^\/(?:[^~]|~0|~1)*$/, ce = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
3698
- function le(e, { dataLevel: t, dataNames: n, dataPathArr: r }) {
3697
+ var oe = /^\/(?:[^~]|~0|~1)*$/, se = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
3698
+ function ce(e, { dataLevel: t, dataNames: n, dataPathArr: r }) {
3699
3699
  let i, a;
3700
3700
  if (e === "") return l.default.rootData;
3701
3701
  if (e[0] === "/") {
3702
- if (!se.test(e)) throw Error(`Invalid JSON-pointer: ${e}`);
3702
+ if (!oe.test(e)) throw Error(`Invalid JSON-pointer: ${e}`);
3703
3703
  i = e, a = l.default.rootData;
3704
3704
  } else {
3705
- let o = ce.exec(e);
3705
+ let o = se.exec(e);
3706
3706
  if (!o) throw Error(`Invalid JSON-pointer: ${e}`);
3707
3707
  let s = +o[1];
3708
3708
  if (i = o[2], i === "#") {
@@ -3719,7 +3719,7 @@ var ur = /* @__PURE__ */ M(((e) => {
3719
3719
  return `Cannot access ${e} ${n} levels up, current level is ${t}`;
3720
3720
  }
3721
3721
  }
3722
- e.getData = le;
3722
+ e.getData = ce;
3723
3723
  })), Er = /* @__PURE__ */ M(((e) => {
3724
3724
  Object.defineProperty(e, "__esModule", { value: !0 }), e.default = class extends Error {
3725
3725
  constructor(e) {
@@ -6850,6 +6850,7 @@ var sa = Symbol("global-pane"), Y = {
6850
6850
  BACKGROUND: 0,
6851
6851
  GRID: 10,
6852
6852
  INDICATOR: 30,
6853
+ INDICATOR_SCALE: 35,
6853
6854
  MAIN: 50,
6854
6855
  OVERLAY: 80,
6855
6856
  FOREGROUND: 100,
@@ -6974,13 +6975,38 @@ var sa = Symbol("global-pane"), Y = {
6974
6975
  e ? this.configs.delete(e) : this.configs.clear();
6975
6976
  }
6976
6977
  }, da = class {
6978
+ states = /* @__PURE__ */ new Map();
6979
+ ownerNamespaces = /* @__PURE__ */ new Map();
6980
+ setState(e, t, n) {
6981
+ this.states.set(e, t);
6982
+ }
6983
+ getState(e) {
6984
+ return this.states.get(e);
6985
+ }
6986
+ clearState(e) {
6987
+ this.states.delete(e);
6988
+ }
6989
+ registerStateOwner(e, t) {
6990
+ this.ownerNamespaces.set(e, new Set(t));
6991
+ }
6992
+ clearByOwner(e) {
6993
+ let t = this.ownerNamespaces.get(e);
6994
+ t && (t.forEach((e) => {
6995
+ this.states.delete(e);
6996
+ }), this.ownerNamespaces.delete(e));
6997
+ }
6998
+ clear() {
6999
+ this.states.clear(), this.ownerNamespaces.clear();
7000
+ }
7001
+ }, fa = class {
6977
7002
  registry;
6978
7003
  eventBus;
6979
7004
  hookSystem;
6980
7005
  configManager;
7006
+ stateStore;
6981
7007
  isDestroyed = !1;
6982
7008
  constructor() {
6983
- this.registry = new ca(), this.eventBus = new I(), this.hookSystem = new la(), this.configManager = new ua();
7009
+ this.registry = new ca(), this.eventBus = new I(), this.hookSystem = new la(), this.configManager = new ua(), this.stateStore = new da();
6984
7010
  }
6985
7011
  events = {
6986
7012
  on: (e, t) => {
@@ -7019,6 +7045,21 @@ var sa = Symbol("global-pane"), Y = {
7019
7045
  let r = `[${(/* @__PURE__ */ new Date()).toISOString()}] [${e.toUpperCase()}]`;
7020
7046
  console[e](`${r} ${t}`, ...n);
7021
7047
  }
7048
+ setSharedState(e, t, n) {
7049
+ this.stateStore.setState(e, t, n);
7050
+ }
7051
+ getSharedState(e) {
7052
+ return this.stateStore.getState(e);
7053
+ }
7054
+ clearSharedState(e) {
7055
+ this.stateStore.clearState(e);
7056
+ }
7057
+ registerStateOwner(e, t) {
7058
+ this.stateStore.registerStateOwner(e, t);
7059
+ }
7060
+ clearByOwner(e) {
7061
+ this.stateStore.clearByOwner(e);
7062
+ }
7022
7063
  async use(e, t) {
7023
7064
  if (this.ensureNotDestroyed(), this.registry.has(e.name)) throw Error(`Plugin "${e.name}" is already installed`);
7024
7065
  try {
@@ -7057,19 +7098,19 @@ var sa = Symbol("global-pane"), Y = {
7057
7098
  } catch (t) {
7058
7099
  this.log("error", `Error uninstalling "${e.plugin.name}":`, t);
7059
7100
  }
7060
- this.registry.clear(), this.eventBus.clear(), this.hookSystem.clear(), this.configManager.clear(), this.isDestroyed = !0, this.log("info", "PluginHost destroyed");
7101
+ this.registry.clear(), this.eventBus.clear(), this.hookSystem.clear(), this.configManager.clear(), this.stateStore.clear(), this.isDestroyed = !0, this.log("info", "PluginHost destroyed");
7061
7102
  }
7062
7103
  }
7063
7104
  ensureNotDestroyed() {
7064
7105
  if (this.isDestroyed) throw Error("PluginHost has been destroyed");
7065
7106
  }
7066
7107
  };
7067
- function fa() {
7068
- return new da();
7108
+ function pa() {
7109
+ return new fa();
7069
7110
  }
7070
7111
  //#endregion
7071
7112
  //#region src/plugin/rendererPluginManager.ts
7072
- var pa = Symbol("renderer:global-cache"), ma = class {
7113
+ var ma = Symbol("renderer:global-cache"), ha = class {
7073
7114
  plugins = /* @__PURE__ */ new Map();
7074
7115
  pluginHost = null;
7075
7116
  enabledState = /* @__PURE__ */ new Map();
@@ -7105,12 +7146,13 @@ var pa = Symbol("renderer:global-cache"), ma = class {
7105
7146
  } catch (t) {
7106
7147
  console.error(`[RendererPlugin] ${e.name} onInstall error:`, t);
7107
7148
  }
7108
- this.onInvalidate?.();
7149
+ let n = t.getDeclaredNamespaces?.();
7150
+ n && this.pluginHost && this.pluginHost.registerStateOwner(e.name, n), this.onInvalidate?.();
7109
7151
  }
7110
7152
  unregister(e) {
7111
7153
  let t = this.plugins.get(e);
7112
7154
  if (t) {
7113
- if (t.onUninstall) try {
7155
+ if (this.pluginHost?.clearByOwner(e), t.onUninstall) try {
7114
7156
  t.onUninstall();
7115
7157
  } catch (e) {
7116
7158
  console.error(`[RendererPlugin] ${t.name} onUninstall error:`, e);
@@ -7139,21 +7181,21 @@ var pa = Symbol("renderer:global-cache"), ma = class {
7139
7181
  if (!this.cacheInvalid) return;
7140
7182
  this.groupCache.clear(), this.mergedCache.clear();
7141
7183
  for (let e of this.plugins.values()) {
7142
- let t = typeof e.paneId == "symbol" ? pa : e.paneId;
7184
+ let t = typeof e.paneId == "symbol" ? ma : e.paneId;
7143
7185
  this.groupCache.has(t) || this.groupCache.set(t, []), this.groupCache.get(t).push(e);
7144
7186
  }
7145
7187
  for (let [, e] of this.groupCache) e.sort((e, t) => e.priority - t.priority);
7146
- let e = this.groupCache.get(pa) ?? [];
7188
+ let e = this.groupCache.get(ma) ?? [];
7147
7189
  for (let t of this.knownPaneIds) {
7148
7190
  let n = this.groupCache.get(t) ?? [], r = this.mergeSorted(n, e);
7149
7191
  this.mergedCache.set(t, r);
7150
7192
  }
7151
- this.mergedCache.set(pa, [...e]), this.cacheInvalid = !1;
7193
+ this.mergedCache.set(ma, [...e]), this.cacheInvalid = !1;
7152
7194
  }
7153
7195
  getRenderers(e) {
7154
7196
  this.rebuildCache();
7155
7197
  let t = this.mergedCache.get(e);
7156
- return t || (t = this.mergedCache.get(pa) ?? [], this.mergedCache.set(e, t)), t.filter((e) => {
7198
+ return t || (t = this.mergedCache.get(ma) ?? [], this.mergedCache.set(e, t)), t.filter((e) => {
7157
7199
  if (e.isSystem) return !1;
7158
7200
  let t = this.enabledState.get(e.name);
7159
7201
  return t === void 0 ? e.enabled !== !1 : t;
@@ -7231,15 +7273,15 @@ var pa = Symbol("renderer:global-cache"), ma = class {
7231
7273
  console.error(`[RendererPlugin] ${e.name} onResize error:`, t);
7232
7274
  }
7233
7275
  }
7234
- }, ha = 1.2, ga = 24, _a = 6;
7235
- function va(e) {
7276
+ }, ga = 1.2, _a = 24, va = 6;
7277
+ function ya(e) {
7236
7278
  switch (e) {
7237
7279
  case "arrow_up":
7238
7280
  case "flag": return !0;
7239
7281
  default: return !1;
7240
7282
  }
7241
7283
  }
7242
- function ya() {
7284
+ function ba() {
7243
7285
  return {
7244
7286
  name: "customMarkers",
7245
7287
  version: "1.0.0",
@@ -7256,11 +7298,11 @@ function ya() {
7256
7298
  if (u.length && n.id === "main") {
7257
7299
  t.save(), t.translate(-a, 0);
7258
7300
  for (let e of l) {
7259
- let r = xa(u, e.timestamp);
7301
+ let r = Sa(u, e.timestamp);
7260
7302
  if (r === -1 || r < i.start || r >= i.end) continue;
7261
7303
  let l = r - i.start;
7262
7304
  if (l < 0 || l >= s.length) continue;
7263
- let d = s[l] + o / 2, f = u[r], p = e.style?.size, m = ba(o, p), h = (e.offset?.y ?? 0) < 0 ? !0 : (e.offset?.y ?? 0) > 0 ? !1 : va(e.shape), g;
7305
+ let d = s[l] + o / 2, f = u[r], p = e.style?.size, m = xa(o, p), h = (e.offset?.y ?? 0) < 0 ? !0 : (e.offset?.y ?? 0) > 0 ? !1 : ya(e.shape), g;
7264
7306
  g = h ? n.yAxis.priceToY(f.high) - m / 2 - 4 + (e.offset?.y ?? 0) : n.yAxis.priceToY(f.low) + m / 2 + 4 + (e.offset?.y ?? 0);
7265
7307
  let _ = d + (e.offset?.x ?? 0), v = g;
7266
7308
  qi(t, e.shape, _, v, m, e.style || {}), e.label && Xi(t, e.label, _, v, m, e.style || {}, h), c.setCustomMarkerPosition(e.id, _ - a, v, m, e.shape);
@@ -7270,11 +7312,11 @@ function ya() {
7270
7312
  }
7271
7313
  };
7272
7314
  }
7273
- function ba(e, t) {
7274
- let n = e * ha;
7275
- return Math.max(_a, Math.min(n, t ?? ga));
7276
- }
7277
7315
  function xa(e, t) {
7316
+ let n = e * ga;
7317
+ return Math.max(va, Math.min(n, t ?? _a));
7318
+ }
7319
+ function Sa(e, t) {
7278
7320
  let n = 0, r = e.length - 1;
7279
7321
  for (; n <= r;) {
7280
7322
  let i = Math.floor((n + r) / 2), a = e[i]?.timestamp;
@@ -7286,7 +7328,7 @@ function xa(e, t) {
7286
7328
  }
7287
7329
  //#endregion
7288
7330
  //#region src/utils/dateFormat.ts
7289
- function Sa(e) {
7331
+ function Ca(e) {
7290
7332
  let t = new Intl.DateTimeFormat("zh-CN", {
7291
7333
  timeZone: "Asia/Shanghai",
7292
7334
  year: "numeric",
@@ -7295,7 +7337,7 @@ function Sa(e) {
7295
7337
  }).formatToParts(new Date(e)).reduce((e, t) => (t.type !== "literal" && (e[t.type] = t.value), e), {});
7296
7338
  return `${t.year}-${t.month}-${t.day}`;
7297
7339
  }
7298
- function Ca(e) {
7340
+ function wa(e) {
7299
7341
  let t = new Date(e), n = t.getFullYear(), r = t.getMonth() + 1;
7300
7342
  return r === 1 ? {
7301
7343
  text: String(n),
@@ -7305,25 +7347,25 @@ function Ca(e) {
7305
7347
  isYear: !1
7306
7348
  };
7307
7349
  }
7308
- function wa(e) {
7350
+ function Ta(e) {
7309
7351
  let t = new Date(e);
7310
7352
  return `${t.getFullYear()}-${t.getMonth()}`;
7311
7353
  }
7312
- var Ta = Sa, Ea = Sa;
7313
- function Da(e) {
7354
+ var Ea = Ca, Da = Ca;
7355
+ function Oa(e) {
7314
7356
  if (e.length === 0) return [];
7315
- let t = [0], n = wa(e[0].timestamp);
7357
+ let t = [0], n = Ta(e[0].timestamp);
7316
7358
  for (let r = 1; r < e.length; r++) {
7317
7359
  let i = e[r];
7318
7360
  if (!i) continue;
7319
- let a = wa(i.timestamp);
7361
+ let a = Ta(i.timestamp);
7320
7362
  a !== n && (t.push(r), n = a);
7321
7363
  }
7322
7364
  return t;
7323
7365
  }
7324
7366
  //#endregion
7325
7367
  //#region src/core/theme/colors.ts
7326
- var Oa = {
7368
+ var ka = {
7327
7369
  PRIMARY: "hsl(210, 9%, 31%)",
7328
7370
  SECONDARY: "hsl(210, 9%, 35%)",
7329
7371
  TERTIARY: "hsl(210, 8%, 50%)",
@@ -7338,7 +7380,7 @@ var Oa = {
7338
7380
  DOWN_TICK: "hsl(150, 30%, 60%)",
7339
7381
  NEUTRAL: "rgba(0, 0, 0, 0.78)",
7340
7382
  LAST_PRICE: "rgb(183, 22, 22)"
7341
- }, ka = {
7383
+ }, Aa = {
7342
7384
  WHITE: "rgb(255, 255, 255)",
7343
7385
  LIGHT_GRAY: "rgba(255, 255, 255, 0.92)",
7344
7386
  PURE_WHITE: "#ffffff",
@@ -7346,115 +7388,115 @@ var Oa = {
7346
7388
  ACTIVE: "#1890ff",
7347
7389
  ACTIVE_HOVER: "#40a9ff",
7348
7390
  HOVER: "#f0f0f0"
7349
- }, Aa = {
7391
+ }, ja = {
7350
7392
  DARK: "rgba(0, 0, 0, 0.12)",
7351
7393
  MEDIUM: "rgba(0, 0, 0, 0.10)",
7352
7394
  LIGHT: "rgba(0, 0, 0, 0.08)",
7353
7395
  SEPARATOR: "rgba(0, 0, 0, 0.10)",
7354
7396
  BUTTON: "#d0d0d0"
7355
- }, ja = {
7397
+ }, Ma = {
7356
7398
  HORIZONTAL: "rgba(0, 0, 0, 0.06)",
7357
7399
  VERTICAL: "rgba(0, 0, 0, 0.12)"
7358
- }, Ma = {
7400
+ }, Na = {
7359
7401
  MA5: "rgba(255, 193, 37, 1)",
7360
7402
  MA10: "rgba(190, 131, 12, 1)",
7361
7403
  MA20: "rgba(69, 112, 249, 1)",
7362
7404
  MA30: "rgba(76, 175, 80, 1)",
7363
7405
  MA60: "rgba(156, 39, 176, 1)"
7364
- }, Na = {
7406
+ }, Pa = {
7365
7407
  UPPER: "rgba(178, 34, 34, 1)",
7366
7408
  MIDDLE: "rgba(69, 112, 249, 1)",
7367
7409
  LOWER: "rgba(34, 139, 34, 1)",
7368
7410
  BAND_FILL: "rgba(100, 149, 237, 0.1)"
7369
- }, Pa = {
7411
+ }, Fa = {
7370
7412
  DIF: "rgba(69, 112, 249, 1)",
7371
7413
  DEA: "rgba(255, 152, 0, 1)",
7372
7414
  BAR_UP: "#ff5252",
7373
7415
  BAR_UP_LIGHT: "#fccbcd",
7374
7416
  BAR_DOWN: "#22ab94",
7375
7417
  BAR_DOWN_LIGHT: "#ace5dc"
7376
- }, Fa = {
7418
+ }, Ia = {
7377
7419
  RSI1: "rgba(69, 112, 249, 1)",
7378
7420
  RSI2: "rgba(255, 152, 0, 1)",
7379
7421
  RSI3: "rgba(156, 39, 176, 1)"
7380
- }, Ia = {
7422
+ }, La = {
7381
7423
  CCI: "rgba(69, 112, 249, 1)",
7382
7424
  OVERBOUGHT: "rgba(214, 10, 34, 0.5)",
7383
7425
  OVERSOLD: "rgba(3, 123, 102, 0.5)"
7384
- }, La = {
7426
+ }, Ra = {
7385
7427
  K: "rgba(69, 112, 249, 1)",
7386
7428
  D: "rgba(255, 152, 0, 1)",
7387
7429
  J: "rgba(156, 39, 176, 1)"
7388
- }, Ra = {
7430
+ }, za = {
7389
7431
  MOM: "rgba(69, 112, 249, 1)",
7390
7432
  ZERO: "rgba(0, 0, 0, 0.2)"
7391
- }, za = {
7433
+ }, Ba = {
7392
7434
  WMSR: "rgba(69, 112, 249, 1)",
7393
7435
  OVERBOUGHT: "rgba(214, 10, 34, 0.5)",
7394
7436
  OVERSOLD: "rgba(3, 123, 102, 0.5)"
7395
- }, Ba = {
7437
+ }, Va = {
7396
7438
  KST: "rgba(69, 112, 249, 1)",
7397
7439
  SIGNAL: "rgba(255, 152, 0, 1)"
7398
- }, Va = {
7440
+ }, Ha = {
7399
7441
  FAST: "rgba(255, 152, 0, 1)",
7400
7442
  SLOW: "rgba(69, 112, 249, 1)"
7401
- }, Ha = {
7443
+ }, Ua = {
7402
7444
  UPPER: "rgba(214, 10, 34, 1)",
7403
7445
  MIDDLE: "rgba(69, 112, 249, 1)",
7404
7446
  LOWER: "rgba(3, 123, 102, 1)",
7405
7447
  BAND_FILL: "rgba(69, 112, 249, 0.08)"
7406
- }, Ua = {
7448
+ }, Wa = {
7407
7449
  LINE: "rgba(0, 0, 0, 0.28)",
7408
7450
  LABEL_BG: "rgb(0, 0, 0)",
7409
7451
  LABEL_TEXT: "rgba(255, 255, 255, 0.92)"
7410
- }, Wa = X.UP, Ga = X.DOWN, Ka = X.NEUTRAL;
7411
- function qa(e) {
7412
- return e > 0 ? Wa : e < 0 ? Ga : Ka;
7452
+ }, Ga = X.UP, Ka = X.DOWN, qa = X.NEUTRAL;
7453
+ function Ja(e) {
7454
+ return e > 0 ? Ga : e < 0 ? Ka : qa;
7413
7455
  }
7414
- function Ja(e, t = 2) {
7456
+ function Ya(e, t = 2) {
7415
7457
  let n = Math.abs(e);
7416
7458
  return n >= 1e8 ? `${(e / 1e8).toFixed(t)}亿` : n >= 1e4 ? `${(e / 1e4).toFixed(t)}万` : `${Math.round(e)}`;
7417
7459
  }
7418
- function Ya(e, t = 2) {
7460
+ function Xa(e, t = 2) {
7419
7461
  return `${e > 0 ? "+" : ""}${e.toFixed(t)}`;
7420
7462
  }
7421
- function Xa(e, t = 2) {
7463
+ function Za(e, t = 2) {
7422
7464
  return `${e.toFixed(t)}%`;
7423
7465
  }
7424
- function Za(e, t = 2) {
7466
+ function Qa(e, t = 2) {
7425
7467
  return `${e > 0 ? "+" : ""}${e.toFixed(t)}%`;
7426
7468
  }
7427
- function Qa(e, t) {
7469
+ function $a(e, t) {
7428
7470
  let n = t?.close ?? e.open;
7429
- return qa(e.open - n);
7430
- }
7431
- function $a(e) {
7432
- return qa(e.close - e.open);
7471
+ return Ja(e.open - n);
7433
7472
  }
7434
7473
  function eo(e) {
7435
- return typeof e.changePercent == "number" ? qa(e.changePercent) : typeof e.changeAmount == "number" ? qa(e.changeAmount) : Ka;
7474
+ return Ja(e.close - e.open);
7475
+ }
7476
+ function to(e) {
7477
+ return typeof e.changePercent == "number" ? Ja(e.changePercent) : typeof e.changeAmount == "number" ? Ja(e.changeAmount) : qa;
7436
7478
  }
7437
7479
  //#endregion
7438
7480
  //#region src/components/KLineTooltip.vue?vue&type=script&setup=true&lang.ts
7439
- var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "kline-tooltip__grid" }, io = { class: "row" }, ao = { class: "row" }, oo = { class: "row" }, so = { class: "row" }, co = {
7481
+ var no = { class: "kline-tooltip__title" }, ro = { key: 0 }, io = { class: "kline-tooltip__grid" }, ao = { class: "row" }, oo = { class: "row" }, so = { class: "row" }, co = { class: "row" }, lo = {
7440
7482
  key: 0,
7441
7483
  class: "row"
7442
- }, lo = {
7484
+ }, uo = {
7443
7485
  key: 1,
7444
7486
  class: "row"
7445
- }, uo = {
7487
+ }, fo = {
7446
7488
  key: 2,
7447
7489
  class: "row"
7448
- }, fo = {
7490
+ }, po = {
7449
7491
  key: 3,
7450
7492
  class: "row"
7451
- }, po = {
7493
+ }, mo = {
7452
7494
  key: 4,
7453
7495
  class: "row"
7454
- }, mo = {
7496
+ }, ho = {
7455
7497
  key: 5,
7456
7498
  class: "row"
7457
- }, ho = /* @__PURE__ */ u({
7499
+ }, go = /* @__PURE__ */ u({
7458
7500
  __name: "KLineTooltip",
7459
7501
  props: {
7460
7502
  k: {},
@@ -7470,15 +7512,15 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7470
7512
  }
7471
7513
  let i = r(() => {
7472
7514
  let e = t.k;
7473
- if (!e) return Ka;
7515
+ if (!e) return qa;
7474
7516
  let n = t.index;
7475
- return Qa(e, typeof n == "number" && n > 0 ? t.data[n - 1] : void 0);
7517
+ return $a(e, typeof n == "number" && n > 0 ? t.data[n - 1] : void 0);
7476
7518
  }), c = r(() => {
7477
7519
  let e = t.k;
7478
- return e ? $a(e) : Ka;
7520
+ return e ? eo(e) : qa;
7479
7521
  }), l = r(() => {
7480
7522
  let e = t.k;
7481
- return e ? eo(e) : Ka;
7523
+ return e ? to(e) : qa;
7482
7524
  });
7483
7525
  return (t, r) => e.k ? (g(), o("div", {
7484
7526
  key: 0,
@@ -7488,29 +7530,29 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7488
7530
  left: `${e.pos.x}px`,
7489
7531
  top: `${e.pos.y}px`
7490
7532
  })
7491
- }, [s("div", to, [e.k.stockCode ? (g(), o("span", no, b(e.k.stockCode), 1)) : a("", !0), s("span", null, b(x(Ta)(e.k.timestamp)), 1)]), s("div", ro, [
7492
- s("div", io, [r[0] ||= s("span", null, "开", -1), s("span", { style: p({ color: i.value }) }, b(e.k.open.toFixed(2)), 5)]),
7493
- s("div", ao, [r[1] ||= s("span", null, "高", -1), s("span", null, b(e.k.high.toFixed(2)), 1)]),
7494
- s("div", oo, [r[2] ||= s("span", null, "低", -1), s("span", null, b(e.k.low.toFixed(2)), 1)]),
7495
- s("div", so, [r[3] ||= s("span", null, "收", -1), s("span", { style: p({ color: c.value }) }, b(e.k.close.toFixed(2)), 5)]),
7496
- typeof e.k.volume == "number" ? (g(), o("div", co, [r[4] ||= s("span", null, "成交量", -1), s("span", null, b(x(Ja)(e.k.volume)), 1)])) : a("", !0),
7497
- typeof e.k.turnover == "number" ? (g(), o("div", lo, [r[5] ||= s("span", null, "成交额", -1), s("span", null, b(x(Ja)(e.k.turnover)), 1)])) : a("", !0),
7498
- typeof e.k.amplitude == "number" ? (g(), o("div", uo, [r[6] ||= s("span", null, "振幅", -1), s("span", null, b(e.k.amplitude) + "%", 1)])) : a("", !0),
7499
- typeof e.k.changePercent == "number" ? (g(), o("div", fo, [r[7] ||= s("span", null, "涨跌幅", -1), s("span", { style: p({ color: l.value }) }, b(x(Za)(e.k.changePercent)), 5)])) : a("", !0),
7500
- typeof e.k.changeAmount == "number" ? (g(), o("div", po, [r[8] ||= s("span", null, "涨跌额", -1), s("span", { style: p({ color: l.value }) }, b(x(Ya)(e.k.changeAmount)), 5)])) : a("", !0),
7501
- typeof e.k.turnoverRate == "number" ? (g(), o("div", mo, [r[9] ||= s("span", null, "换手率", -1), s("span", null, b(x(Xa)(e.k.turnoverRate)), 1)])) : a("", !0)
7533
+ }, [s("div", no, [e.k.stockCode ? (g(), o("span", ro, b(e.k.stockCode), 1)) : a("", !0), s("span", null, b(x(Ea)(e.k.timestamp)), 1)]), s("div", io, [
7534
+ s("div", ao, [r[0] ||= s("span", null, "开", -1), s("span", { style: p({ color: i.value }) }, b(e.k.open.toFixed(2)), 5)]),
7535
+ s("div", oo, [r[1] ||= s("span", null, "高", -1), s("span", null, b(e.k.high.toFixed(2)), 1)]),
7536
+ s("div", so, [r[2] ||= s("span", null, "低", -1), s("span", null, b(e.k.low.toFixed(2)), 1)]),
7537
+ s("div", co, [r[3] ||= s("span", null, "收", -1), s("span", { style: p({ color: c.value }) }, b(e.k.close.toFixed(2)), 5)]),
7538
+ typeof e.k.volume == "number" ? (g(), o("div", lo, [r[4] ||= s("span", null, "成交量", -1), s("span", null, b(x(Ya)(e.k.volume)), 1)])) : a("", !0),
7539
+ typeof e.k.turnover == "number" ? (g(), o("div", uo, [r[5] ||= s("span", null, "成交额", -1), s("span", null, b(x(Ya)(e.k.turnover)), 1)])) : a("", !0),
7540
+ typeof e.k.amplitude == "number" ? (g(), o("div", fo, [r[6] ||= s("span", null, "振幅", -1), s("span", null, b(e.k.amplitude) + "%", 1)])) : a("", !0),
7541
+ typeof e.k.changePercent == "number" ? (g(), o("div", po, [r[7] ||= s("span", null, "涨跌幅", -1), s("span", { style: p({ color: l.value }) }, b(x(Qa)(e.k.changePercent)), 5)])) : a("", !0),
7542
+ typeof e.k.changeAmount == "number" ? (g(), o("div", mo, [r[8] ||= s("span", null, "涨跌额", -1), s("span", { style: p({ color: l.value }) }, b(x(Xa)(e.k.changeAmount)), 5)])) : a("", !0),
7543
+ typeof e.k.turnoverRate == "number" ? (g(), o("div", ho, [r[9] ||= s("span", null, "换手率", -1), s("span", null, b(x(Za)(e.k.turnoverRate)), 1)])) : a("", !0)
7502
7544
  ])], 4)) : a("", !0);
7503
7545
  }
7504
- }), go = (e, t) => {
7546
+ }), _o = (e, t) => {
7505
7547
  let n = e.__vccOpts || e;
7506
7548
  for (let [e, r] of t) n[e] = r;
7507
7549
  return n;
7508
- }, _o = /* @__PURE__ */ go(ho, [["__scopeId", "data-v-95daa55c"]]), vo = {
7550
+ }, vo = /* @__PURE__ */ _o(go, [["__scopeId", "data-v-95daa55c"]]), yo = {
7509
7551
  RISE_WITH_VOLUME: "量价齐升",
7510
7552
  RISE_WITHOUT_VOLUME: "量缩价升",
7511
7553
  FALL_WITH_VOLUME: "量价齐缩",
7512
7554
  FALL_WITHOUT_VOLUME: "量升价缩"
7513
- }, yo = class {
7555
+ }, bo = class {
7514
7556
  markers = /* @__PURE__ */ new Map();
7515
7557
  hoveredMarkerId = null;
7516
7558
  lastHoveredId = null;
@@ -7572,10 +7614,10 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7572
7614
  }
7573
7615
  return null;
7574
7616
  }
7575
- }, bo = { class: "marker-tooltip__title" }, xo = {
7617
+ }, xo = { class: "marker-tooltip__title" }, So = {
7576
7618
  key: 0,
7577
7619
  class: "marker-tooltip__content"
7578
- }, So = /* @__PURE__ */ go(/* @__PURE__ */ u({
7620
+ }, Co = /* @__PURE__ */ _o(/* @__PURE__ */ u({
7579
7621
  __name: "MarkerTooltip",
7580
7622
  props: {
7581
7623
  marker: {},
@@ -7589,7 +7631,7 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7589
7631
  return e.label?.text || e.shape;
7590
7632
  }
7591
7633
  let e = n.marker;
7592
- return vo[e.markerType] || e.markerType;
7634
+ return yo[e.markerType] || e.markerType;
7593
7635
  }), l = r(() => {
7594
7636
  if (!n.marker) return {};
7595
7637
  if (i.value) {
@@ -7611,27 +7653,27 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7611
7653
  left: `${t.pos.x + 12}px`,
7612
7654
  top: `${t.pos.y + 12}px`
7613
7655
  })
7614
- }, [s("div", bo, b(c.value), 1), u.value ? (g(), o("div", xo, [(g(!0), o(e, null, v(l.value, (e, t) => (g(), o("div", {
7656
+ }, [s("div", xo, b(c.value), 1), u.value ? (g(), o("div", So, [(g(!0), o(e, null, v(l.value, (e, t) => (g(), o("div", {
7615
7657
  key: t,
7616
7658
  class: "row"
7617
7659
  }, [s("span", null, b(t), 1), s("span", null, b(d(e)), 1)]))), 128))])) : a("", !0)], 4)) : a("", !0);
7618
7660
  }
7619
- }), [["__scopeId", "data-v-dd43da4f"]]), Co = { class: "params-header" }, wo = { class: "header-left" }, To = { class: "params-title" }, Eo = { class: "header-right" }, Do = {
7661
+ }), [["__scopeId", "data-v-dd43da4f"]]), wo = { class: "params-header" }, To = { class: "header-left" }, Eo = { class: "params-title" }, Do = { class: "header-right" }, Oo = {
7620
7662
  key: 0,
7621
7663
  class: "indicator-description"
7622
- }, Oo = { class: "params-body" }, ko = { class: "param-header" }, Ao = { class: "param-label" }, jo = { class: "param-label-text" }, Mo = {
7664
+ }, ko = { class: "params-body" }, Ao = { class: "param-header" }, jo = { class: "param-label" }, Mo = { class: "param-label-text" }, No = {
7623
7665
  key: 0,
7624
7666
  class: "param-range"
7625
- }, No = { class: "input-wrapper" }, Po = ["disabled", "onClick"], Fo = [
7667
+ }, Po = { class: "input-wrapper" }, Fo = ["disabled", "onClick"], Io = [
7626
7668
  "value",
7627
7669
  "min",
7628
7670
  "max",
7629
7671
  "step",
7630
7672
  "onInput"
7631
- ], Io = ["disabled", "onClick"], Lo = {
7673
+ ], Lo = ["disabled", "onClick"], Ro = {
7632
7674
  key: 0,
7633
7675
  class: "param-description"
7634
- }, Ro = { class: "params-footer" }, zo = { class: "footer-right" }, Bo = /* @__PURE__ */ go(/* @__PURE__ */ u({
7676
+ }, zo = { class: "params-footer" }, Bo = { class: "footer-right" }, Vo = /* @__PURE__ */ _o(/* @__PURE__ */ u({
7635
7677
  __name: "IndicatorParams",
7636
7678
  props: {
7637
7679
  visible: { type: Boolean },
@@ -7679,7 +7721,7 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7679
7721
  class: "indicator-params",
7680
7722
  onClick: d[3] ||= w(() => {}, ["stop"])
7681
7723
  }, [
7682
- s("div", Co, [s("div", wo, [s("span", To, b(r.indicatorName), 1), d[5] ||= s("span", { class: "params-subtitle" }, "参数设置", -1)]), s("div", Eo, [s("button", {
7724
+ s("div", wo, [s("div", To, [s("span", Eo, b(r.indicatorName), 1), d[5] ||= s("span", { class: "params-subtitle" }, "参数设置", -1)]), s("div", Do, [s("button", {
7683
7725
  class: f(["toggle-desc-btn", { active: h.value }]),
7684
7726
  onClick: d[0] ||= (e) => h.value = !h.value,
7685
7727
  title: "显示/隐藏说明"
@@ -7696,18 +7738,18 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7696
7738
  "stroke-width": "2"
7697
7739
  }, [s("path", { d: "M18 6L6 18M6 6l12 12" })], -1)]])])]),
7698
7740
  l(n, { name: "slide" }, {
7699
- default: C(() => [h.value && r.indicatorDescription ? (g(), o("div", Do, [s("p", null, b(r.indicatorDescription), 1)])) : a("", !0)]),
7741
+ default: C(() => [h.value && r.indicatorDescription ? (g(), o("div", Oo, [s("p", null, b(r.indicatorDescription), 1)])) : a("", !0)]),
7700
7742
  _: 1
7701
7743
  }),
7702
- s("div", Oo, [(g(!0), o(e, null, v(r.params, (e) => (g(), o("div", {
7744
+ s("div", ko, [(g(!0), o(e, null, v(r.params, (e) => (g(), o("div", {
7703
7745
  key: e.key,
7704
7746
  class: f(["param-item", { "has-desc": h.value && e.description }])
7705
- }, [s("div", ko, [s("label", Ao, [s("span", jo, b(e.label), 1), e.min !== void 0 || e.max !== void 0 ? (g(), o("span", Mo, b(e.min ?? "-∞") + " ~ " + b(e.max ?? "+∞"), 1)) : a("", !0)]), s("div", No, [
7747
+ }, [s("div", Ao, [s("label", jo, [s("span", Mo, b(e.label), 1), e.min !== void 0 || e.max !== void 0 ? (g(), o("span", No, b(e.min ?? "-∞") + " ~ " + b(e.max ?? "+∞"), 1)) : a("", !0)]), s("div", Po, [
7706
7748
  s("button", {
7707
7749
  class: "stepper-btn",
7708
7750
  disabled: e.min !== void 0 && (m.value[e.key] ?? 0) <= e.min,
7709
7751
  onClick: (t) => x(e, -1)
7710
- }, " − ", 8, Po),
7752
+ }, " − ", 8, Fo),
7711
7753
  e.type === "number" ? (g(), o("input", {
7712
7754
  key: 0,
7713
7755
  type: "number",
@@ -7717,17 +7759,17 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7717
7759
  max: e.max,
7718
7760
  step: e.step || 1,
7719
7761
  onInput: (t) => y(e.key, t)
7720
- }, null, 40, Fo)) : a("", !0),
7762
+ }, null, 40, Io)) : a("", !0),
7721
7763
  s("button", {
7722
7764
  class: "stepper-btn",
7723
7765
  disabled: e.max !== void 0 && (m.value[e.key] ?? 0) >= e.max,
7724
7766
  onClick: (t) => x(e, 1)
7725
- }, " + ", 8, Io)
7767
+ }, " + ", 8, Lo)
7726
7768
  ])]), l(n, { name: "slide" }, {
7727
- default: C(() => [h.value && e.description ? (g(), o("div", Lo, b(e.description), 1)) : a("", !0)]),
7769
+ default: C(() => [h.value && e.description ? (g(), o("div", Ro, b(e.description), 1)) : a("", !0)]),
7728
7770
  _: 2
7729
7771
  }, 1024)], 2))), 128))]),
7730
- s("div", Ro, [s("button", {
7772
+ s("div", zo, [s("button", {
7731
7773
  class: "params-btn reset",
7732
7774
  onClick: T
7733
7775
  }, [...d[8] ||= [s("svg", {
@@ -7735,7 +7777,7 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7735
7777
  fill: "none",
7736
7778
  stroke: "currentColor",
7737
7779
  "stroke-width": "2"
7738
- }, [s("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), s("path", { d: "M3 3v5h5" })], -1), c(" 重置 ", -1)]]), s("div", zo, [s("button", {
7780
+ }, [s("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), s("path", { d: "M3 3v5h5" })], -1), c(" 重置 ", -1)]]), s("div", Bo, [s("button", {
7739
7781
  class: "params-btn cancel",
7740
7782
  onClick: d[2] ||= (e) => u.$emit("close")
7741
7783
  }, "取消"), s("button", {
@@ -7753,28 +7795,28 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
7753
7795
  _: 1
7754
7796
  })]));
7755
7797
  }
7756
- }), [["__scopeId", "data-v-c14eedcc"]]), Vo = { class: "indicator-selector" }, Ho = { class: "indicator-scroll-container" }, Uo = { class: "indicator-list" }, Wo = ["onMouseenter"], Go = { class: "btn-content" }, Ko = {
7798
+ }), [["__scopeId", "data-v-c14eedcc"]]), Ho = { class: "indicator-selector" }, Uo = { class: "indicator-scroll-container" }, Wo = { class: "indicator-list" }, Go = ["onMouseenter"], Ko = { class: "btn-content" }, qo = {
7757
7799
  key: 0,
7758
7800
  class: "param-hint"
7759
- }, qo = {
7801
+ }, Jo = {
7760
7802
  key: 0,
7761
7803
  class: "hover-overlay"
7762
- }, Jo = ["onClick"], Yo = {
7804
+ }, Yo = ["onClick"], Xo = {
7763
7805
  key: 1,
7764
7806
  class: "divider"
7765
- }, Xo = ["onClick"], Zo = { class: "indicator-item" }, Qo = { class: "menu-section" }, $o = { class: "menu-items" }, es = ["disabled", "onClick"], ts = {
7807
+ }, Zo = ["onClick"], Qo = { class: "indicator-item" }, $o = { class: "menu-section" }, es = { class: "menu-items" }, ts = ["disabled", "onClick"], ns = {
7766
7808
  key: 0,
7767
7809
  class: "param-hint"
7768
- }, ns = {
7810
+ }, rs = {
7769
7811
  key: 1,
7770
7812
  class: "active-tag"
7771
- }, rs = { class: "menu-section" }, is = { class: "menu-items" }, as = ["disabled", "onClick"], os = {
7813
+ }, is = { class: "menu-section" }, as = { class: "menu-items" }, os = ["disabled", "onClick"], ss = {
7772
7814
  key: 0,
7773
7815
  class: "param-hint"
7774
- }, ss = {
7816
+ }, cs = {
7775
7817
  key: 1,
7776
7818
  class: "active-tag"
7777
- }, cs = /* @__PURE__ */ go(/* @__PURE__ */ u({
7819
+ }, ls = /* @__PURE__ */ _o(/* @__PURE__ */ u({
7778
7820
  __name: "IndicatorSelector",
7779
7821
  props: {
7780
7822
  activeIndicators: {},
@@ -8129,10 +8171,10 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8129
8171
  let t = ie(e.id);
8130
8172
  return e.params ? e.params.map((e) => t[e.key] ?? "").join(",") : "";
8131
8173
  }
8132
- function oe(e) {
8174
+ function L(e) {
8133
8175
  j.value && D("updateParams", j.value, e), A.value = !1;
8134
8176
  }
8135
- function L() {
8177
+ function R() {
8136
8178
  if (!N.value && O.value) {
8137
8179
  let e = O.value.getBoundingClientRect(), t = window.innerWidth, n = e.left + e.width / 2;
8138
8180
  n + 160 > t - 8 && (n = t - 160 - 8), n - 160 < 8 && (n = 168), P.value = {
@@ -8142,19 +8184,19 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8142
8184
  }
8143
8185
  N.value = !N.value;
8144
8186
  }
8145
- function se(e) {
8187
+ function oe(e) {
8146
8188
  let t = k.value && !k.value.contains(e.target), n = O.value && !O.value.contains(e.target);
8147
8189
  t && n && (N.value = !1);
8148
8190
  }
8149
- function ce() {
8191
+ function se() {
8150
8192
  N.value &&= !1;
8151
8193
  }
8152
8194
  return m(() => {
8153
- document.addEventListener("click", se), window.addEventListener("resize", ce);
8195
+ document.addEventListener("click", oe), window.addEventListener("resize", se);
8154
8196
  }), h(() => {
8155
- document.removeEventListener("click", se), window.removeEventListener("resize", ce);
8156
- }), (r, u) => (g(), o("div", Vo, [
8157
- s("div", Ho, [s("div", Uo, [(g(!0), o(e, null, v(ee.value, (e) => (g(), o("div", {
8197
+ document.removeEventListener("click", oe), window.removeEventListener("resize", se);
8198
+ }), (r, u) => (g(), o("div", Ho, [
8199
+ s("div", Uo, [s("div", Wo, [(g(!0), o(e, null, v(ee.value, (e) => (g(), o("div", {
8158
8200
  key: e.id,
8159
8201
  class: "indicator-item"
8160
8202
  }, [s("div", {
@@ -8164,8 +8206,8 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8164
8206
  }, [s("button", { class: f(["indicator-btn", {
8165
8207
  active: !0,
8166
8208
  hovering: M.value === e.id
8167
- }]) }, [s("span", Go, [c(b(e.label) + " ", 1), e.params ? (g(), o("span", Ko, " (" + b(ae(e)) + ") ", 1)) : a("", !0)]), l(n, { name: "fade" }, {
8168
- default: C(() => [M.value === e.id ? (g(), o("div", qo, [
8209
+ }]) }, [s("span", Ko, [c(b(e.label) + " ", 1), e.params ? (g(), o("span", qo, " (" + b(ae(e)) + ") ", 1)) : a("", !0)]), l(n, { name: "fade" }, {
8210
+ default: C(() => [M.value === e.id ? (g(), o("div", Jo, [
8169
8211
  e.params ? (g(), o("button", {
8170
8212
  key: 0,
8171
8213
  class: "action-btn settings-btn",
@@ -8176,8 +8218,8 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8176
8218
  width: "14",
8177
8219
  height: "14",
8178
8220
  fill: "currentColor"
8179
- }, [s("path", { d: "M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" })], -1)]], 8, Jo)) : a("", !0),
8180
- e.params ? (g(), o("span", Yo)) : a("", !0),
8221
+ }, [s("path", { d: "M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" })], -1)]], 8, Yo)) : a("", !0),
8222
+ e.params ? (g(), o("span", Xo)) : a("", !0),
8181
8223
  s("button", {
8182
8224
  class: "action-btn remove-btn",
8183
8225
  onClick: w((t) => ne(e.id), ["stop"]),
@@ -8187,14 +8229,14 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8187
8229
  width: "14",
8188
8230
  height: "14",
8189
8231
  fill: "currentColor"
8190
- }, [s("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })], -1)]], 8, Xo)
8232
+ }, [s("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })], -1)]], 8, Zo)
8191
8233
  ])) : a("", !0)]),
8192
8234
  _: 2
8193
- }, 1024)], 2)], 40, Wo)]))), 128)), s("div", Zo, [s("button", {
8235
+ }, 1024)], 2)], 40, Go)]))), 128)), s("div", Qo, [s("button", {
8194
8236
  ref_key: "addBtnRef",
8195
8237
  ref: O,
8196
8238
  class: "add-btn",
8197
- onClick: L,
8239
+ onClick: R,
8198
8240
  title: "添加指标"
8199
8241
  }, [...u[4] ||= [s("svg", {
8200
8242
  viewBox: "0 0 24 24",
@@ -8209,38 +8251,38 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8209
8251
  ref_key: "addMenuRef",
8210
8252
  ref: k,
8211
8253
  style: p(P.value)
8212
- }, [s("div", Qo, [u[6] ||= s("div", { class: "menu-title" }, "主图指标", -1), s("div", $o, [(g(!0), o(e, null, v(x(S), (e) => (g(), o("button", {
8254
+ }, [s("div", $o, [u[6] ||= s("div", { class: "menu-title" }, "主图指标", -1), s("div", es, [(g(!0), o(e, null, v(x(S), (e) => (g(), o("button", {
8213
8255
  key: e.id,
8214
8256
  class: f(["menu-item", { disabled: I(e.id) }]),
8215
8257
  disabled: I(e.id),
8216
8258
  onClick: (t) => te(e.id)
8217
8259
  }, [
8218
8260
  c(b(e.label) + " ", 1),
8219
- e.params ? (g(), o("span", ts, " (" + b(e.name) + ") ", 1)) : a("", !0),
8220
- I(e.id) ? (g(), o("span", ns, [...u[5] ||= [s("svg", {
8261
+ e.params ? (g(), o("span", ns, " (" + b(e.name) + ") ", 1)) : a("", !0),
8262
+ I(e.id) ? (g(), o("span", rs, [...u[5] ||= [s("svg", {
8221
8263
  viewBox: "0 0 24 24",
8222
8264
  width: "14",
8223
8265
  height: "14",
8224
8266
  fill: "currentColor"
8225
8267
  }, [s("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })], -1)]])) : a("", !0)
8226
- ], 10, es))), 128))])]), s("div", rs, [u[8] ||= s("div", { class: "menu-title" }, "副图指标", -1), s("div", is, [(g(!0), o(e, null, v(x(T), (e) => (g(), o("button", {
8268
+ ], 10, ts))), 128))])]), s("div", is, [u[8] ||= s("div", { class: "menu-title" }, "副图指标", -1), s("div", as, [(g(!0), o(e, null, v(x(T), (e) => (g(), o("button", {
8227
8269
  key: e.id,
8228
8270
  class: f(["menu-item", { disabled: I(e.id) }]),
8229
8271
  disabled: I(e.id),
8230
8272
  onClick: (t) => te(e.id)
8231
8273
  }, [
8232
8274
  c(b(e.label) + " ", 1),
8233
- e.params ? (g(), o("span", os, " (" + b(e.name) + ") ", 1)) : a("", !0),
8234
- I(e.id) ? (g(), o("span", ss, [...u[7] ||= [s("svg", {
8275
+ e.params ? (g(), o("span", ss, " (" + b(e.name) + ") ", 1)) : a("", !0),
8276
+ I(e.id) ? (g(), o("span", cs, [...u[7] ||= [s("svg", {
8235
8277
  viewBox: "0 0 24 24",
8236
8278
  width: "14",
8237
8279
  height: "14",
8238
8280
  fill: "currentColor"
8239
8281
  }, [s("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })], -1)]])) : a("", !0)
8240
- ], 10, as))), 128))])])], 4)) : a("", !0)]),
8282
+ ], 10, os))), 128))])])], 4)) : a("", !0)]),
8241
8283
  _: 1
8242
8284
  })])),
8243
- F.value ? (g(), i(Bo, {
8285
+ F.value ? (g(), i(Vo, {
8244
8286
  key: 0,
8245
8287
  visible: A.value,
8246
8288
  "indicator-id": F.value.id,
@@ -8249,7 +8291,7 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8249
8291
  params: F.value.params || [],
8250
8292
  values: ie(F.value.id),
8251
8293
  onClose: u[1] ||= (e) => A.value = !1,
8252
- onConfirm: oe
8294
+ onConfirm: L
8253
8295
  }, null, 8, [
8254
8296
  "visible",
8255
8297
  "indicator-id",
@@ -8263,12 +8305,12 @@ var to = { class: "kline-tooltip__title" }, no = { key: 0 }, ro = { class: "klin
8263
8305
  }), [["__scopeId", "data-v-aad3b750"]]);
8264
8306
  //#endregion
8265
8307
  //#region src/core/utils/klineConfig.ts
8266
- function ls(e, t) {
8308
+ function us(e, t) {
8267
8309
  let n = Math.round(e * t);
8268
8310
  return n % 2 == 0 && (n += 1), Math.max(1, n);
8269
8311
  }
8270
- function us(e, t, n) {
8271
- let r = ls(e, n), i = Math.round(t * n), a = r + i, o = i;
8312
+ function ds(e, t, n) {
8313
+ let r = us(e, n), i = Math.round(t * n), a = r + i, o = i;
8272
8314
  return {
8273
8315
  kWidthPx: r,
8274
8316
  kGapPx: i,
@@ -8282,14 +8324,14 @@ function us(e, t, n) {
8282
8324
  }
8283
8325
  //#endregion
8284
8326
  //#region src/core/viewport/viewport.ts
8285
- function ds(e, t, n, r, i, a = 1) {
8286
- let { unitPx: o, startXPx: s } = us(n, r, a), c = e * a, l = t * a;
8327
+ function fs(e, t, n, r, i, a = 1) {
8328
+ let { unitPx: o, startXPx: s } = ds(n, r, a), c = e * a, l = t * a;
8287
8329
  return {
8288
8330
  start: Math.max(0, Math.floor((c - s) / o) - 1),
8289
8331
  end: Math.min(i, Math.ceil((c + l - s) / o) + 1)
8290
8332
  };
8291
8333
  }
8292
- function fs(e, t, n) {
8334
+ function ps(e, t, n) {
8293
8335
  let r = -Infinity, i = Infinity;
8294
8336
  for (let a = t; a < n && a < e.length; a++) {
8295
8337
  let t = e[a];
@@ -8305,7 +8347,7 @@ function fs(e, t, n) {
8305
8347
  }
8306
8348
  //#endregion
8307
8349
  //#region src/core/scale/priceScale.ts
8308
- var ps = class {
8350
+ var ms = class {
8309
8351
  range = {
8310
8352
  maxPrice: 100,
8311
8353
  minPrice: 0
@@ -8352,7 +8394,7 @@ var ps = class {
8352
8394
  deltaYToPriceOffset(e) {
8353
8395
  return e * ((this.range.maxPrice - this.range.minPrice || 1) / Math.max(1, this.height - this.paddingTop - this.paddingBottom));
8354
8396
  }
8355
- }, ms = class {
8397
+ }, hs = class {
8356
8398
  id;
8357
8399
  top = 0;
8358
8400
  height = 0;
@@ -8360,7 +8402,7 @@ var ps = class {
8360
8402
  maxPrice: 100,
8361
8403
  minPrice: 0
8362
8404
  };
8363
- yAxis = new ps();
8405
+ yAxis = new ms();
8364
8406
  renderers = [];
8365
8407
  constructor(e) {
8366
8408
  this.id = e;
@@ -8375,9 +8417,9 @@ var ps = class {
8375
8417
  this.renderers.push(e);
8376
8418
  }
8377
8419
  updateRange(e, t) {
8378
- this.priceRange = fs(e, t.start, t.end), this.yAxis.setRange(this.priceRange);
8420
+ this.priceRange = ps(e, t.start, t.end), this.yAxis.setRange(this.priceRange);
8379
8421
  }
8380
- }, hs = class {
8422
+ }, gs = class {
8381
8423
  chart;
8382
8424
  isDragging = !1;
8383
8425
  dragStartX = 0;
@@ -8512,12 +8554,12 @@ var ps = class {
8512
8554
  this.updateHoverFromPoint(e.clientX, e.clientY);
8513
8555
  }
8514
8556
  updateHoverFromPoint(e, t) {
8515
- let n = this.chart.getDom().container, r = n.getBoundingClientRect(), i = e - r.left, a = t - r.top, o = this.chart.getOption(), s = Math.max(1, Math.round(r.width)), c = Math.max(1, Math.round(r.height)), l = s - o.rightAxisWidth - (o.priceLabelWidth || 60), u = c - o.bottomAxisHeight;
8557
+ let n = this.chart.getDom().container, r = n.getBoundingClientRect(), i = e - r.left, a = t - r.top, o = this.chart.getViewport(), s = o?.viewWidth ?? Math.max(1, Math.round(n.clientWidth)), c = o?.viewHeight ?? Math.max(1, Math.round(n.clientHeight)), l = o?.plotWidth ?? s, u = o?.plotHeight ?? c;
8516
8558
  if (i < 0 || a < 0 || i > l || a > u) {
8517
8559
  this.clearHover();
8518
8560
  return;
8519
8561
  }
8520
- let d = n.scrollLeft, f = window.devicePixelRatio || 1, p = this.chart.getMarkerManager(), m = d + i, h = p.hitTest(m, a, 3);
8562
+ let d = n.scrollLeft, f = this.chart.getCurrentDpr(), p = this.chart.getMarkerManager(), m = d + i, h = p.hitTest(m, a, 3);
8521
8563
  if (h) {
8522
8564
  this.hoveredMarkerId !== h.id && (this.hoveredMarkerId = h.id, this.hoveredMarkerData = h, p.setHover(h.id), this.onMarkerHoverCallback && this.onMarkerHoverCallback(h)), this.crosshairPos = null, this.crosshairIndex = null, this.hoveredIndex = null;
8523
8565
  return;
@@ -8567,16 +8609,16 @@ var ps = class {
8567
8609
  return;
8568
8610
  }
8569
8611
  this.hoveredIndex = this.crosshairIndex;
8570
- let ne = this.tooltipSize.width, re = this.tooltipSize.height, ie = i + 14, ae = i - 14 - ne, oe = ie + ne + 12 <= s ? ie : ae, L = a + 14, se = Math.max(12, s - ne - 12), ce = Math.max(12, c - re - 12);
8612
+ let ne = this.tooltipSize.width, re = this.tooltipSize.height, ie = i + 14, ae = i - 14 - ne, L = ie + ne + 12 <= s ? ie : ae, R = a + 14, oe = Math.max(12, s - ne - 12), se = Math.max(12, c - re - 12);
8571
8613
  this.tooltipPos = {
8572
- x: Math.min(Math.max(oe, 12), se),
8573
- y: Math.min(Math.max(L, 12), ce)
8614
+ x: Math.min(Math.max(L, 12), oe),
8615
+ y: Math.min(Math.max(R, 12), se)
8574
8616
  };
8575
8617
  }
8576
8618
  reset() {
8577
8619
  this.isDragging = !1, this.dragStartX = 0, this.dragStartY = 0, this.scrollStartX = 0, this.activePaneIdOnDrag = null, 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.kLinePositions = null, this.visibleRange = null, this.kWidthPx = null;
8578
8620
  }
8579
- }, gs = class {
8621
+ }, _s = class {
8580
8622
  dom;
8581
8623
  pane;
8582
8624
  opt;
@@ -8602,7 +8644,7 @@ var ps = class {
8602
8644
  };
8603
8645
  //#endregion
8604
8646
  //#region src/core/renderers/subVolume.ts
8605
- function _s(e = {}) {
8647
+ function vs(e = {}) {
8606
8648
  let { paneId: t = "sub" } = e;
8607
8649
  return {
8608
8650
  name: `volume_${t}`,
@@ -8621,21 +8663,21 @@ function _s(e = {}) {
8621
8663
  if (!r) continue;
8622
8664
  let i = r.volume;
8623
8665
  if (!i) continue;
8624
- let a = ys(r), d = c[e - u];
8625
- d && vs(t, d, a, i, f, o, s, n.height);
8666
+ let a = bs(r), d = c[e - u];
8667
+ d && ys(t, d, a, i, f, o, s, n.height);
8626
8668
  }
8627
8669
  t.restore();
8628
8670
  }
8629
8671
  };
8630
8672
  }
8631
- function vs(e, t, n, r, i, a, o, s) {
8632
- let c = bs(r, i, s), l = a;
8673
+ function ys(e, t, n, r, i, a, o, s) {
8674
+ let c = xs(r, i, s), l = a;
8633
8675
  e.fillStyle = n, e.fillRect(t, c, l, s - c);
8634
8676
  }
8635
- function ys(e) {
8677
+ function bs(e) {
8636
8678
  return e.close > e.open ? X.UP : e.close < e.open ? X.DOWN : X.NEUTRAL;
8637
8679
  }
8638
- function bs(e, t, n) {
8680
+ function xs(e, t, n) {
8639
8681
  return n - n / t * e;
8640
8682
  }
8641
8683
  //#endregion
@@ -8646,7 +8688,7 @@ function Z(e, t) {
8646
8688
  function Q(e, t) {
8647
8689
  return (Math.floor(e * t) + .5) / t;
8648
8690
  }
8649
- function xs(e, t, n, r) {
8691
+ function Ss(e, t, n, r) {
8650
8692
  if (t === n) return null;
8651
8693
  let i = Math.min(t, n), a = Math.max(t, n), o = Math.round(e * r), s = Math.round(i * r), c = Math.round(a * r);
8652
8694
  return {
@@ -8656,7 +8698,7 @@ function xs(e, t, n, r) {
8656
8698
  height: Math.max(1, c - s) / r
8657
8699
  };
8658
8700
  }
8659
- function Ss(e, t, n, r) {
8701
+ function Cs(e, t, n, r) {
8660
8702
  if (e === t) return null;
8661
8703
  let i = Math.min(e, t), a = Math.max(e, t), o = Math.round(i * r), s = Math.round(a * r), c = Math.round(n * r);
8662
8704
  return {
@@ -8666,7 +8708,7 @@ function Ss(e, t, n, r) {
8666
8708
  height: 1 / r
8667
8709
  };
8668
8710
  }
8669
- function Cs(e, t, n, r, i) {
8711
+ function ws(e, t, n, r, i) {
8670
8712
  let a = e + n, o = n, s = Math.round(t * i), c = Math.round((t + r) * i), l = Math.max(1, c - s), u = e + (n - 1) / 2, d = u, f = o % 2 == 1;
8671
8713
  return {
8672
8714
  bodyRect: {
@@ -8689,7 +8731,7 @@ function Cs(e, t, n, r, i) {
8689
8731
  }
8690
8732
  //#endregion
8691
8733
  //#region src/core/renderers/Indicator/ma.ts
8692
- function ws(e, t) {
8734
+ function Ts(e, t) {
8693
8735
  let n = Array(e.length);
8694
8736
  if (e.length < t) return n;
8695
8737
  let r = 0;
@@ -8705,7 +8747,7 @@ function ws(e, t) {
8705
8747
  }
8706
8748
  return n;
8707
8749
  }
8708
- function Ts(e = {}) {
8750
+ function Es(e = {}) {
8709
8751
  let t = {
8710
8752
  ma5: !0,
8711
8753
  ma10: !0,
@@ -8717,7 +8759,7 @@ function Ts(e = {}) {
8717
8759
  function i(e, t) {
8718
8760
  let i = n.get(t);
8719
8761
  if (i && r === e) return i.values;
8720
- let a = ws(e, t);
8762
+ let a = Ts(e, t);
8721
8763
  return n.set(t, {
8722
8764
  period: t,
8723
8765
  values: a
@@ -8744,7 +8786,7 @@ function Ts(e = {}) {
8744
8786
  priority: Y.INDICATOR,
8745
8787
  draw(e) {
8746
8788
  let { ctx: n, data: r, scrollLeft: o } = e, s = r;
8747
- s.length && (n.save(), n.translate(-o, 0), t.ma5 && a(n, i(s, 5), e, Ma.MA5), t.ma10 && a(n, i(s, 10), e, Ma.MA10), t.ma20 && a(n, i(s, 20), e, Ma.MA20), t.ma30 && a(n, i(s, 30), e, Ma.MA30), t.ma60 && a(n, i(s, 60), e, Ma.MA60), n.restore());
8789
+ s.length && (n.save(), n.translate(-o, 0), t.ma5 && a(n, i(s, 5), e, Na.MA5), t.ma10 && a(n, i(s, 10), e, Na.MA10), t.ma20 && a(n, i(s, 20), e, Na.MA20), t.ma30 && a(n, i(s, 30), e, Na.MA30), t.ma60 && a(n, i(s, 60), e, Na.MA60), n.restore());
8748
8790
  },
8749
8791
  onDataUpdate() {
8750
8792
  r = null, n.clear();
@@ -8759,7 +8801,7 @@ function Ts(e = {}) {
8759
8801
  }
8760
8802
  //#endregion
8761
8803
  //#region src/core/renderers/Indicator/boll.ts
8762
- function Es(e, t, n) {
8804
+ function Ds(e, t, n) {
8763
8805
  let r = Array(e.length);
8764
8806
  if (e.length < t) return r;
8765
8807
  let i = 0, a = [];
@@ -8792,7 +8834,7 @@ function Es(e, t, n) {
8792
8834
  }
8793
8835
  return r;
8794
8836
  }
8795
- function Ds(e = {}) {
8837
+ function Os(e = {}) {
8796
8838
  let t = {
8797
8839
  period: 20,
8798
8840
  multiplier: 2,
@@ -8803,7 +8845,7 @@ function Ds(e = {}) {
8803
8845
  ...e
8804
8846
  }, n = null, r = 0, i = 0, a = [];
8805
8847
  function o(e) {
8806
- return (n !== e || r !== t.period || i !== t.multiplier) && (a = Es(e, t.period, t.multiplier), n = e, r = t.period, i = t.multiplier), a;
8848
+ return (n !== e || r !== t.period || i !== t.multiplier) && (a = Ds(e, t.period, t.multiplier), n = e, r = t.period, i = t.multiplier), a;
8807
8849
  }
8808
8850
  return {
8809
8851
  name: "boll",
@@ -8819,7 +8861,7 @@ function Ds(e = {}) {
8819
8861
  n.save(), n.translate(-s, 0);
8820
8862
  let p = Math.max(a.start, t.period - 1), m = Math.min(a.end, d.length);
8821
8863
  if (t.showBand) {
8822
- n.fillStyle = Na.BAND_FILL, n.beginPath();
8864
+ n.fillStyle = Pa.BAND_FILL, n.beginPath();
8823
8865
  let e = !0;
8824
8866
  for (let t = p; t < m; t++) {
8825
8867
  let i = f[t];
@@ -8847,7 +8889,7 @@ function Ds(e = {}) {
8847
8889
  }
8848
8890
  n.stroke();
8849
8891
  };
8850
- t.showUpper && h("upper", Na.UPPER), t.showMiddle && h("middle", Na.MIDDLE), t.showLower && h("lower", Na.LOWER), n.restore();
8892
+ t.showUpper && h("upper", Pa.UPPER), t.showMiddle && h("middle", Pa.MIDDLE), t.showLower && h("lower", Pa.LOWER), n.restore();
8851
8893
  },
8852
8894
  onDataUpdate() {
8853
8895
  n = null;
@@ -8860,7 +8902,7 @@ function Ds(e = {}) {
8860
8902
  }
8861
8903
  };
8862
8904
  }
8863
- function Os(e, t, n = 20, r = 2) {
8905
+ function ks(e, t, n = 20, r = 2) {
8864
8906
  if (t < n - 1 || t >= e.length) return null;
8865
8907
  let i = 0;
8866
8908
  for (let r = 0; r < n; r++) {
@@ -8883,7 +8925,7 @@ function Os(e, t, n = 20, r = 2) {
8883
8925
  }
8884
8926
  //#endregion
8885
8927
  //#region src/core/renderers/Indicator/expma.ts
8886
- function ks(e, t, n) {
8928
+ function As(e, t, n) {
8887
8929
  let r = Array(e.length);
8888
8930
  if (e.length === 0) return r;
8889
8931
  let i = 2 / (t + 1), a = 2 / (n + 1), o = e[0].close, s = o, c = o;
@@ -8900,7 +8942,7 @@ function ks(e, t, n) {
8900
8942
  }
8901
8943
  return r;
8902
8944
  }
8903
- function As(e, t, n = 12, r = 50) {
8945
+ function js(e, t, n = 12, r = 50) {
8904
8946
  if (t < 0 || t >= e.length) return null;
8905
8947
  let i = 2 / (n + 1), a = 2 / (r + 1), o = e[0].close, s = o, c = o;
8906
8948
  for (let n = 1; n <= t; n++) {
@@ -8912,14 +8954,14 @@ function As(e, t, n = 12, r = 50) {
8912
8954
  slow: c
8913
8955
  };
8914
8956
  }
8915
- function js(e = {}) {
8957
+ function Ms(e = {}) {
8916
8958
  let t = {
8917
8959
  fastPeriod: 12,
8918
8960
  slowPeriod: 50,
8919
8961
  ...e
8920
8962
  }, n = null, r = 0, i = 0, a = [];
8921
8963
  function o(e) {
8922
- return (n !== e || r !== t.fastPeriod || i !== t.slowPeriod) && (a = ks(e, t.fastPeriod, t.slowPeriod), n = e, r = t.fastPeriod, i = t.slowPeriod), a;
8964
+ return (n !== e || r !== t.fastPeriod || i !== t.slowPeriod) && (a = As(e, t.fastPeriod, t.slowPeriod), n = e, r = t.fastPeriod, i = t.slowPeriod), a;
8923
8965
  }
8924
8966
  return {
8925
8967
  name: "expma",
@@ -8933,7 +8975,7 @@ function js(e = {}) {
8933
8975
  if (u.length < 2) return;
8934
8976
  let d = o(u);
8935
8977
  t.save(), t.translate(-a, 0);
8936
- let f = i.start, p = Math.min(i.end, u.length), m = Va.FAST, h = Va.SLOW, g = (e, r) => {
8978
+ let f = i.start, p = Math.min(i.end, u.length), m = Ha.FAST, h = Ha.SLOW, g = (e, r) => {
8937
8979
  t.strokeStyle = r, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
8938
8980
  let a = !0;
8939
8981
  for (let r = f; r < p; r++) {
@@ -8959,7 +9001,7 @@ function js(e = {}) {
8959
9001
  }
8960
9002
  //#endregion
8961
9003
  //#region src/core/renderers/Indicator/ene.ts
8962
- function Ms(e, t, n) {
9004
+ function Ns(e, t, n) {
8963
9005
  let r = Array(e.length);
8964
9006
  if (e.length < t) return r;
8965
9007
  let i = 0;
@@ -8987,7 +9029,7 @@ function Ms(e, t, n) {
8987
9029
  }
8988
9030
  return r;
8989
9031
  }
8990
- function Ns(e, t, n = 10, r = 11) {
9032
+ function Ps(e, t, n = 10, r = 11) {
8991
9033
  if (t < n - 1 || t >= e.length) return null;
8992
9034
  let i = 0;
8993
9035
  for (let r = 0; r < n; r++) {
@@ -9002,14 +9044,14 @@ function Ns(e, t, n = 10, r = 11) {
9002
9044
  lower: a * (1 - o)
9003
9045
  };
9004
9046
  }
9005
- function Ps(e = {}) {
9047
+ function Fs(e = {}) {
9006
9048
  let t = {
9007
9049
  period: 10,
9008
9050
  deviation: 11,
9009
9051
  ...e
9010
9052
  }, n = null, r = 0, i = 0, a = [];
9011
9053
  function o(e) {
9012
- return (n !== e || r !== t.period || i !== t.deviation) && (a = Ms(e, t.period, t.deviation), n = e, r = t.period, i = t.deviation), a;
9054
+ return (n !== e || r !== t.period || i !== t.deviation) && (a = Ns(e, t.period, t.deviation), n = e, r = t.period, i = t.deviation), a;
9013
9055
  }
9014
9056
  return {
9015
9057
  name: "ene",
@@ -9065,7 +9107,7 @@ function Ps(e = {}) {
9065
9107
  }
9066
9108
  //#endregion
9067
9109
  //#region src/utils/kline/ma.ts
9068
- function Fs(e, t, n) {
9110
+ function Is(e, t, n) {
9069
9111
  if (t < n - 1) return;
9070
9112
  let r = 0;
9071
9113
  for (let i = 0; i < n; i++) {
@@ -9077,7 +9119,7 @@ function Fs(e, t, n) {
9077
9119
  }
9078
9120
  //#endregion
9079
9121
  //#region src/core/renderers/Indicator/mainIndicatorLegend.ts
9080
- function Is(e) {
9122
+ function Ls(e) {
9081
9123
  let t = {
9082
9124
  yPaddingPx: e.yPaddingPx,
9083
9125
  indicators: {
@@ -9127,29 +9169,29 @@ function Is(e) {
9127
9169
  let t = `MA${e}`;
9128
9170
  r.push({
9129
9171
  label: `MA${e}`,
9130
- color: Ma[t] || Ma.MA5,
9131
- value: Fs(a, o, e)
9172
+ color: Na[t] || Na.MA5,
9173
+ value: Is(a, o, e)
9132
9174
  });
9133
9175
  }) : r.push({
9134
9176
  label: "MA5",
9135
- color: Ma.MA5,
9136
- value: Fs(a, o, 5)
9177
+ color: Na.MA5,
9178
+ value: Is(a, o, 5)
9137
9179
  }, {
9138
9180
  label: "MA10",
9139
- color: Ma.MA10,
9140
- value: Fs(a, o, 10)
9181
+ color: Na.MA10,
9182
+ value: Is(a, o, 10)
9141
9183
  }, {
9142
9184
  label: "MA20",
9143
- color: Ma.MA20,
9144
- value: Fs(a, o, 20)
9185
+ color: Na.MA20,
9186
+ value: Is(a, o, 20)
9145
9187
  }, {
9146
9188
  label: "MA30",
9147
- color: Ma.MA30,
9148
- value: Fs(a, o, 30)
9189
+ color: Na.MA30,
9190
+ value: Is(a, o, 30)
9149
9191
  }, {
9150
9192
  label: "MA60",
9151
- color: Ma.MA60,
9152
- value: Fs(a, o, 60)
9193
+ color: Na.MA60,
9194
+ value: Is(a, o, 60)
9153
9195
  }), r.length > 0) {
9154
9196
  let i = 12, a = t.yPaddingPx / 2 + 12 + e * 18;
9155
9197
  n.fillStyle = X.NEUTRAL, n.fillText("MA", i, a), i += n.measureText("MA").width + 10;
@@ -9161,18 +9203,18 @@ function Is(e) {
9161
9203
  } });
9162
9204
  let l = t.indicators.BOLL;
9163
9205
  l?.enabled && s.push({ draw: (e) => {
9164
- let r = l.params.period ?? 20, i = l.params.multiplier ?? 2, s = Os(a, o, r, i), c = 12, u = t.yPaddingPx / 2 + 12 + e * 18;
9165
- n.fillStyle = X.NEUTRAL, n.fillText(`BOLL(${r},${i})`, c, u), c += n.measureText(`BOLL(${r},${i})`).width + 10, s && (n.fillStyle = Na.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, u), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Na.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, u), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Na.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, u));
9206
+ let r = l.params.period ?? 20, i = l.params.multiplier ?? 2, s = ks(a, o, r, i), c = 12, u = t.yPaddingPx / 2 + 12 + e * 18;
9207
+ n.fillStyle = X.NEUTRAL, n.fillText(`BOLL(${r},${i})`, c, u), c += n.measureText(`BOLL(${r},${i})`).width + 10, s && (n.fillStyle = Pa.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, u), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Pa.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, u), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Pa.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, u));
9166
9208
  } });
9167
9209
  let u = t.indicators.EXPMA;
9168
9210
  u?.enabled && s.push({ draw: (e) => {
9169
- let r = u.params.fastPeriod ?? 12, i = u.params.slowPeriod ?? 50, s = As(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
9170
- n.fillStyle = X.NEUTRAL, n.fillText(`EXPMA(${r},${i})`, c, l), c += n.measureText(`EXPMA(${r},${i})`).width + 10, s && (n.fillStyle = Va.FAST, n.fillText(`快:${s.fast.toFixed(2)}`, c, l), c += n.measureText(`快:${s.fast.toFixed(2)}`).width + 10, n.fillStyle = Va.SLOW, n.fillText(`慢:${s.slow.toFixed(2)}`, c, l));
9211
+ let r = u.params.fastPeriod ?? 12, i = u.params.slowPeriod ?? 50, s = js(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
9212
+ n.fillStyle = X.NEUTRAL, n.fillText(`EXPMA(${r},${i})`, c, l), c += n.measureText(`EXPMA(${r},${i})`).width + 10, s && (n.fillStyle = Ha.FAST, n.fillText(`快:${s.fast.toFixed(2)}`, c, l), c += n.measureText(`快:${s.fast.toFixed(2)}`).width + 10, n.fillStyle = Ha.SLOW, n.fillText(`慢:${s.slow.toFixed(2)}`, c, l));
9171
9213
  } });
9172
9214
  let d = t.indicators.ENE;
9173
9215
  d?.enabled && s.push({ draw: (e) => {
9174
- let r = d.params.period ?? 10, i = d.params.deviation ?? 11, s = Ns(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
9175
- n.fillStyle = X.NEUTRAL, n.fillText(`ENE(${r},${i})`, c, l), c += n.measureText(`ENE(${r},${i})`).width + 10, s && (n.fillStyle = Ha.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, l), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Ha.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, l), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Ha.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, l));
9216
+ let r = d.params.period ?? 10, i = d.params.deviation ?? 11, s = Ps(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
9217
+ n.fillStyle = X.NEUTRAL, n.fillText(`ENE(${r},${i})`, c, l), c += n.measureText(`ENE(${r},${i})`).width + 10, s && (n.fillStyle = Ua.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, l), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Ua.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, l), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Ua.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, l));
9176
9218
  } }), s.forEach((e, t) => e.draw(t)), n.restore();
9177
9219
  },
9178
9220
  getConfig() {
@@ -9190,8 +9232,11 @@ function Is(e) {
9190
9232
  };
9191
9233
  }
9192
9234
  //#endregion
9235
+ //#region src/plugin/stateKeys.ts
9236
+ var Rs = (e, t) => `indicator:${e}:${t}`;
9237
+ //#endregion
9193
9238
  //#region src/core/renderers/Indicator/macd.ts
9194
- function Ls(e, t) {
9239
+ function zs(e, t) {
9195
9240
  let n = Array(e.length), r = 2 / (t + 1);
9196
9241
  if (e.length === 0) return n;
9197
9242
  n[0] = e[0].close;
@@ -9201,7 +9246,7 @@ function Ls(e, t) {
9201
9246
  }
9202
9247
  return n;
9203
9248
  }
9204
- function Rs(e, t) {
9249
+ function Bs(e, t) {
9205
9250
  let n = Array(e.length), r = 2 / (t + 1), i = e.findIndex((e) => e !== void 0);
9206
9251
  if (i === -1) return n;
9207
9252
  n[i] = e[i];
@@ -9211,15 +9256,15 @@ function Rs(e, t) {
9211
9256
  }
9212
9257
  return n;
9213
9258
  }
9214
- function zs(e, t, n, r) {
9259
+ function Vs(e, t, n, r) {
9215
9260
  let i = Array(e.length);
9216
9261
  if (e.length < n) return i;
9217
- let a = Ls(e, t), o = Ls(e, n), s = Array(e.length);
9262
+ let a = zs(e, t), o = zs(e, n), s = Array(e.length);
9218
9263
  for (let t = 0; t < e.length; t++) {
9219
9264
  let e = a[t], n = o[t];
9220
9265
  e !== void 0 && n !== void 0 && (s[t] = e - n);
9221
9266
  }
9222
- let c = Rs(s, r);
9267
+ let c = Bs(s, r);
9223
9268
  for (let t = 0; t < e.length; t++) {
9224
9269
  let e = s[t], n = c[t];
9225
9270
  e !== void 0 && n !== void 0 && (i[t] = {
@@ -9230,8 +9275,8 @@ function zs(e, t, n, r) {
9230
9275
  }
9231
9276
  return i;
9232
9277
  }
9233
- function Bs(e = {}) {
9234
- let { paneId: t = "sub", config: n = {} } = e, r = {
9278
+ function Hs(e = {}) {
9279
+ let { paneId: t = "sub", config: n = {} } = e, r = Rs("macd", t), i = null, a = {
9235
9280
  fastPeriod: 12,
9236
9281
  slowPeriod: 26,
9237
9282
  signalPeriod: 9,
@@ -9239,9 +9284,9 @@ function Bs(e = {}) {
9239
9284
  showDEA: !0,
9240
9285
  showBAR: !0,
9241
9286
  ...n
9242
- }, i = null, a = 0, o = 0, s = 0, c = [];
9243
- function l(e) {
9244
- return (i !== e || a !== r.fastPeriod || o !== r.slowPeriod || s !== r.signalPeriod) && (c = zs(e, r.fastPeriod, r.slowPeriod, r.signalPeriod), i = e, a = r.fastPeriod, o = r.slowPeriod, s = r.signalPeriod), c;
9287
+ }, o = null, s = 0, c = 0, l = 0, u = [];
9288
+ function d(e) {
9289
+ return (o !== e || s !== a.fastPeriod || c !== a.slowPeriod || l !== a.signalPeriod) && (u = Vs(e, a.fastPeriod, a.slowPeriod, a.signalPeriod), o = e, s = a.fastPeriod, c = a.slowPeriod, l = a.signalPeriod), u;
9245
9290
  }
9246
9291
  return {
9247
9292
  name: `macd_${t}`,
@@ -9249,82 +9294,99 @@ function Bs(e = {}) {
9249
9294
  description: "MACD 指标渲染器",
9250
9295
  debugName: "MACD",
9251
9296
  paneId: t,
9252
- priority: Y.MAIN,
9297
+ priority: Y.INDICATOR,
9298
+ onInstall(e) {
9299
+ i = e;
9300
+ },
9301
+ getDeclaredNamespaces() {
9302
+ return [r];
9303
+ },
9253
9304
  draw(e) {
9254
- let { ctx: t, pane: n, data: i, range: a, scrollLeft: o, kWidth: s, kGap: c, dpr: u, kLinePositions: d } = e, f = i;
9255
- if (f.length < r.slowPeriod) return;
9256
- let p = l(f), m = -Infinity, h = Infinity;
9257
- for (let e = a.start; e < a.end && e < p.length; e++) {
9258
- let t = p[e];
9259
- t && (m = Math.max(m, t.dif, t.dea, t.macd), h = Math.min(h, t.dif, t.dea, t.macd));
9260
- }
9261
- if (!Number.isFinite(m) || !Number.isFinite(h)) return;
9262
- let g = Math.max(.05, (m - h) * .1), _ = h - g, v = m + g - _ || 1, y = n.height - (0 - _) / v * n.height;
9263
- t.save(), t.translate(-o, 0);
9264
- let b = Math.max(a.start, r.slowPeriod - 1), x = Math.min(a.end, f.length);
9265
- if (r.showBAR) {
9266
- let e = (s + c) * u, r = Math.max(1, Math.round(e - 1)) / u, i = Math.round(y * u) / u, o = d[b - a.start] ?? 0, l = Math.round((o + (s - r) / 2) * u);
9267
- for (let a = b; a < x; a++) {
9268
- let o = p[a];
9269
- if (!o) continue;
9270
- let s = (l + (a - b) * Math.round(e)) / u, c = n.height - (o.macd - _) / v * n.height, d = o.macd >= 0, f = a > 0 ? p[a - 1] : null, m;
9271
- m = f ? o.macd >= f.macd : !0;
9272
- let h;
9273
- h = d ? m ? Pa.BAR_UP : Pa.BAR_UP_LIGHT : m ? Pa.BAR_DOWN_LIGHT : Pa.BAR_DOWN, t.fillStyle = h;
9274
- let g = Math.round(c * u) / u, y = 1 / u;
9275
- if (d) {
9276
- let e = i - g, n = e <= 0 ? y : Math.max(e, y), a = e <= 0 ? i - y : i - n;
9277
- t.fillRect(s, a, r, n);
9305
+ let { ctx: n, pane: o, data: s, range: c, scrollLeft: l, kWidth: u, kGap: f, dpr: p, kLinePositions: m } = e, h = s;
9306
+ if (h.length < a.slowPeriod) return;
9307
+ let g = d(h), _ = -Infinity, v = Infinity;
9308
+ for (let e = c.start; e < c.end && e < g.length; e++) {
9309
+ let t = g[e];
9310
+ t && (_ = Math.max(_, t.dif, t.dea, t.macd), v = Math.min(v, t.dif, t.dea, t.macd));
9311
+ }
9312
+ if (!Number.isFinite(_) || !Number.isFinite(v)) return;
9313
+ let y = Math.max(.05, (_ - v) * .1), b = v - y, x = _ + y, S = x - b || 1, C = c.end - 1, w = C >= 0 && C < g.length ? g[C] : null, T = {
9314
+ valueMin: b,
9315
+ valueMax: x,
9316
+ timestamp: Date.now(),
9317
+ latestValues: w ? {
9318
+ dif: w.dif,
9319
+ dea: w.dea,
9320
+ macd: w.macd
9321
+ } : void 0
9322
+ };
9323
+ i?.setSharedState(r, T, `macd_${t}`);
9324
+ let E = o.height - (0 - b) / S * o.height;
9325
+ n.save(), n.translate(-l, 0);
9326
+ let D = Math.max(c.start, a.slowPeriod - 1), O = Math.min(c.end, h.length);
9327
+ if (a.showBAR) {
9328
+ let e = (u + f) * p, t = Math.max(1, Math.round(e - 1)) / p, r = Math.round(E * p) / p, i = m[D - c.start] ?? 0, a = Math.round((i + (u - t) / 2) * p);
9329
+ for (let i = D; i < O; i++) {
9330
+ let s = g[i];
9331
+ if (!s) continue;
9332
+ let c = (a + (i - D) * Math.round(e)) / p, l = o.height - (s.macd - b) / S * o.height, u = s.macd >= 0, d = i > 0 ? g[i - 1] : null, f;
9333
+ f = d ? s.macd >= d.macd : !0;
9334
+ let m;
9335
+ m = u ? f ? Fa.BAR_UP : Fa.BAR_UP_LIGHT : f ? Fa.BAR_DOWN_LIGHT : Fa.BAR_DOWN, n.fillStyle = m;
9336
+ let h = Math.round(l * p) / p, _ = 1 / p;
9337
+ if (u) {
9338
+ let e = r - h, i = e <= 0 ? _ : Math.max(e, _), a = e <= 0 ? r - _ : r - i;
9339
+ n.fillRect(c, a, t, i);
9278
9340
  } else {
9279
- let e = g - i, n = e <= 0 ? y : Math.max(e, y);
9280
- t.fillRect(s, i, r, n);
9341
+ let e = h - r, i = e <= 0 ? _ : Math.max(e, _);
9342
+ n.fillRect(c, r, t, i);
9281
9343
  }
9282
9344
  }
9283
9345
  }
9284
- if (r.showDIF) {
9285
- t.strokeStyle = Pa.DIF, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9346
+ if (a.showDIF) {
9347
+ n.strokeStyle = Fa.DIF, n.lineWidth = 1, n.lineJoin = "round", n.lineCap = "round", n.beginPath();
9286
9348
  let e = !0;
9287
- for (let r = b; r < x; r++) {
9288
- let i = p[r];
9289
- if (!i) continue;
9290
- let o = d[r - a.start];
9291
- if (o === void 0) continue;
9292
- let c = o + s / 2, l = n.height - (i.dif - _) / v * n.height, f = Q(c, u), m = Q(l, u);
9293
- e ? (t.moveTo(f, m), e = !1) : t.lineTo(f, m);
9349
+ for (let t = D; t < O; t++) {
9350
+ let r = g[t];
9351
+ if (!r) continue;
9352
+ let i = m[t - c.start];
9353
+ if (i === void 0) continue;
9354
+ let a = i + u / 2, s = o.height - (r.dif - b) / S * o.height, l = Q(a, p), d = Q(s, p);
9355
+ e ? (n.moveTo(l, d), e = !1) : n.lineTo(l, d);
9294
9356
  }
9295
- t.stroke();
9357
+ n.stroke();
9296
9358
  }
9297
- if (r.showDEA) {
9298
- t.strokeStyle = Pa.DEA, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9359
+ if (a.showDEA) {
9360
+ n.strokeStyle = Fa.DEA, n.lineWidth = 1, n.lineJoin = "round", n.lineCap = "round", n.beginPath();
9299
9361
  let e = !0;
9300
- for (let r = b; r < x; r++) {
9301
- let i = p[r];
9302
- if (!i) continue;
9303
- let o = d[r - a.start];
9304
- if (o === void 0) continue;
9305
- let c = o + s / 2, l = n.height - (i.dea - _) / v * n.height, f = Q(c, u), m = Q(l, u);
9306
- e ? (t.moveTo(f, m), e = !1) : t.lineTo(f, m);
9362
+ for (let t = D; t < O; t++) {
9363
+ let r = g[t];
9364
+ if (!r) continue;
9365
+ let i = m[t - c.start];
9366
+ if (i === void 0) continue;
9367
+ let a = i + u / 2, s = o.height - (r.dea - b) / S * o.height, l = Q(a, p), d = Q(s, p);
9368
+ e ? (n.moveTo(l, d), e = !1) : n.lineTo(l, d);
9307
9369
  }
9308
- t.stroke();
9370
+ n.stroke();
9309
9371
  }
9310
- t.restore();
9372
+ n.restore();
9311
9373
  },
9312
9374
  onDataUpdate() {
9313
- i = null;
9375
+ o = null;
9314
9376
  },
9315
9377
  getConfig() {
9316
- return { ...r };
9378
+ return { ...a };
9317
9379
  },
9318
9380
  setConfig(e) {
9319
- "fastPeriod" in e && e.fastPeriod !== r.fastPeriod && (i = null), "slowPeriod" in e && e.slowPeriod !== r.slowPeriod && (i = null), "signalPeriod" in e && e.signalPeriod !== r.signalPeriod && (i = null), Object.assign(r, e);
9381
+ "fastPeriod" in e && e.fastPeriod !== a.fastPeriod && (o = null), "slowPeriod" in e && e.slowPeriod !== a.slowPeriod && (o = null), "signalPeriod" in e && e.signalPeriod !== a.signalPeriod && (o = null), Object.assign(a, e);
9320
9382
  }
9321
9383
  };
9322
9384
  }
9323
- function Vs(e, t, n = 12, r = 26, i = 9) {
9324
- return t < r || t >= e.length ? null : zs(e, n, r, i)[t] ?? null;
9385
+ function Us(e, t, n = 12, r = 26, i = 9) {
9386
+ return t < r || t >= e.length ? null : Vs(e, n, r, i)[t] ?? null;
9325
9387
  }
9326
- function Hs(e, t, n = 12, r = 26, i = 9) {
9327
- let a = Vs(e, t, n, r, i);
9388
+ function Ws(e, t, n = 12, r = 26, i = 9) {
9389
+ let a = Us(e, t, n, r, i);
9328
9390
  return a ? {
9329
9391
  name: "MACD",
9330
9392
  params: [
@@ -9336,24 +9398,24 @@ function Hs(e, t, n = 12, r = 26, i = 9) {
9336
9398
  {
9337
9399
  label: "DIF",
9338
9400
  value: a.dif,
9339
- color: Pa.DIF
9401
+ color: Fa.DIF
9340
9402
  },
9341
9403
  {
9342
9404
  label: "DEA",
9343
9405
  value: a.dea,
9344
- color: Pa.DEA
9406
+ color: Fa.DEA
9345
9407
  },
9346
9408
  {
9347
9409
  label: "MACD",
9348
9410
  value: a.macd,
9349
- color: a.macd >= 0 ? Pa.BAR_UP : Pa.BAR_DOWN
9411
+ color: a.macd >= 0 ? Fa.BAR_UP : Fa.BAR_DOWN
9350
9412
  }
9351
9413
  ]
9352
9414
  } : null;
9353
9415
  }
9354
9416
  //#endregion
9355
9417
  //#region src/core/renderers/Indicator/rsi.ts
9356
- function Us(e, t) {
9418
+ function Gs(e, t) {
9357
9419
  let n = Array(e.length);
9358
9420
  if (e.length < t + 1) return n;
9359
9421
  let r = [];
@@ -9375,7 +9437,7 @@ function Us(e, t) {
9375
9437
  }
9376
9438
  return n;
9377
9439
  }
9378
- function Ws(e = {}) {
9440
+ function Ks(e = {}) {
9379
9441
  let { paneId: t = "sub", config: n = {} } = e, r = {
9380
9442
  period1: 6,
9381
9443
  period2: 12,
@@ -9386,7 +9448,7 @@ function Ws(e = {}) {
9386
9448
  ...n
9387
9449
  }, i = null, a = 0, o = 0, s = 0, c = [], l = [], u = [];
9388
9450
  function d(e) {
9389
- return (i !== e || a !== r.period1 || o !== r.period2 || s !== r.period3) && (c = Us(e, r.period1), l = Us(e, r.period2), u = Us(e, r.period3), i = e, a = r.period1, o = r.period2, s = r.period3), {
9451
+ return (i !== e || a !== r.period1 || o !== r.period2 || s !== r.period3) && (c = Gs(e, r.period1), l = Gs(e, r.period2), u = Gs(e, r.period3), i = e, a = r.period1, o = r.period2, s = r.period3), {
9390
9452
  rsi1: c,
9391
9453
  rsi2: l,
9392
9454
  rsi3: u
@@ -9419,7 +9481,7 @@ function Ws(e = {}) {
9419
9481
  }
9420
9482
  t.stroke();
9421
9483
  };
9422
- r.showRSI1 && S(f, Fa.RSI1), r.showRSI2 && S(p, Fa.RSI2), r.showRSI3 && S(m, Fa.RSI3), t.restore();
9484
+ r.showRSI1 && S(f, Ia.RSI1), r.showRSI2 && S(p, Ia.RSI2), r.showRSI3 && S(m, Ia.RSI3), t.restore();
9423
9485
  },
9424
9486
  onDataUpdate() {
9425
9487
  i = null;
@@ -9432,21 +9494,21 @@ function Ws(e = {}) {
9432
9494
  }
9433
9495
  };
9434
9496
  }
9435
- function Gs(e, t, n = 6, r = 12, i = 24) {
9497
+ function qs(e, t, n = 6, r = 12, i = 24) {
9436
9498
  if (t < n + 1 || t >= e.length) return null;
9437
- let a = Us(e, n)[t], o = Us(e, r)[t], s = Us(e, i)[t], c = [];
9499
+ let a = Gs(e, n)[t], o = Gs(e, r)[t], s = Gs(e, i)[t], c = [];
9438
9500
  return a !== void 0 && c.push({
9439
9501
  label: `RSI${n}`,
9440
9502
  value: a,
9441
- color: Fa.RSI1
9503
+ color: Ia.RSI1
9442
9504
  }), o !== void 0 && c.push({
9443
9505
  label: `RSI${r}`,
9444
9506
  value: o,
9445
- color: Fa.RSI2
9507
+ color: Ia.RSI2
9446
9508
  }), s !== void 0 && c.push({
9447
9509
  label: `RSI${i}`,
9448
9510
  value: s,
9449
- color: Fa.RSI3
9511
+ color: Ia.RSI3
9450
9512
  }), c.length === 0 ? null : {
9451
9513
  name: "RSI",
9452
9514
  params: [
@@ -9459,7 +9521,7 @@ function Gs(e, t, n = 6, r = 12, i = 24) {
9459
9521
  }
9460
9522
  //#endregion
9461
9523
  //#region src/core/renderers/Indicator/cci.ts
9462
- function Ks(e, t) {
9524
+ function Js(e, t) {
9463
9525
  let n = Array(e.length);
9464
9526
  if (e.length < t) return n;
9465
9527
  let r = e.map((e) => (e.high + e.low + e.close) / 3);
@@ -9473,14 +9535,14 @@ function Ks(e, t) {
9473
9535
  }
9474
9536
  return n;
9475
9537
  }
9476
- function qs(e = {}) {
9538
+ function Ys(e = {}) {
9477
9539
  let { paneId: t = "sub", config: n = {} } = e, r = {
9478
9540
  period: 14,
9479
9541
  showCCI: !0,
9480
9542
  ...n
9481
9543
  }, i = null, a = 0, o = [];
9482
9544
  function s(e) {
9483
- return (i !== e || a !== r.period) && (o = Ks(e, r.period), i = e, a = r.period), o;
9545
+ return (i !== e || a !== r.period) && (o = Js(e, r.period), i = e, a = r.period), o;
9484
9546
  }
9485
9547
  return {
9486
9548
  name: `cci_${t}`,
@@ -9502,10 +9564,10 @@ function qs(e = {}) {
9502
9564
  let h = p - m || 1, g = n.height - (0 - m) / h * n.height;
9503
9565
  t.save(), t.translate(-o, 0);
9504
9566
  let _ = n.height - (100 - m) / h * n.height, v = n.height - (-100 - m) / h * n.height, y = o, b = o + e.paneWidth;
9505
- t.strokeStyle = Ia.OVERBOUGHT, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(y, _), t.lineTo(b, _), t.stroke(), t.strokeStyle = Ia.OVERSOLD, t.beginPath(), t.moveTo(y, v), t.lineTo(b, v), t.stroke(), t.strokeStyle = "rgba(0, 0, 0, 0.1)", t.beginPath(), t.moveTo(y, g), t.lineTo(b, g), t.stroke(), t.setLineDash([]);
9567
+ t.strokeStyle = La.OVERBOUGHT, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(y, _), t.lineTo(b, _), t.stroke(), t.strokeStyle = La.OVERSOLD, t.beginPath(), t.moveTo(y, v), t.lineTo(b, v), t.stroke(), t.strokeStyle = "rgba(0, 0, 0, 0.1)", t.beginPath(), t.moveTo(y, g), t.lineTo(b, g), t.stroke(), t.setLineDash([]);
9506
9568
  let x = Math.max(a.start, r.period - 1), S = Math.min(a.end, d.length);
9507
9569
  if (r.showCCI) {
9508
- t.strokeStyle = Ia.CCI, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9570
+ t.strokeStyle = La.CCI, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9509
9571
  let e = !0;
9510
9572
  for (let r = x; r < S; r++) {
9511
9573
  let i = f[r];
@@ -9530,25 +9592,25 @@ function qs(e = {}) {
9530
9592
  }
9531
9593
  };
9532
9594
  }
9533
- function Js(e, t, n) {
9534
- return Ks(e, n)[t];
9595
+ function Xs(e, t, n) {
9596
+ return Js(e, n)[t];
9535
9597
  }
9536
- function Ys(e, t, n = 14) {
9598
+ function Zs(e, t, n = 14) {
9537
9599
  if (t < n || t >= e.length) return null;
9538
- let r = Js(e, t, n);
9600
+ let r = Xs(e, t, n);
9539
9601
  return r === void 0 ? null : {
9540
9602
  name: "CCI",
9541
9603
  params: [n],
9542
9604
  values: [{
9543
9605
  label: "CCI",
9544
9606
  value: r,
9545
- color: Ia.CCI
9607
+ color: La.CCI
9546
9608
  }]
9547
9609
  };
9548
9610
  }
9549
9611
  //#endregion
9550
9612
  //#region src/core/renderers/Indicator/stoch.ts
9551
- function Xs(e, t, n) {
9613
+ function Qs(e, t, n) {
9552
9614
  let r = Array(e.length);
9553
9615
  if (e.length < t) return r;
9554
9616
  let i = Array(e.length);
@@ -9576,7 +9638,7 @@ function Xs(e, t, n) {
9576
9638
  }
9577
9639
  return r;
9578
9640
  }
9579
- function Zs(e = {}) {
9641
+ function $s(e = {}) {
9580
9642
  let { paneId: t = "sub", config: n = {} } = e, r = {
9581
9643
  n: 9,
9582
9644
  m: 3,
@@ -9585,7 +9647,7 @@ function Zs(e = {}) {
9585
9647
  ...n
9586
9648
  }, i = null, a = 0, o = 0, s = [];
9587
9649
  function c(e) {
9588
- return (i !== e || a !== r.n || o !== r.m) && (s = Xs(e, r.n, r.m), i = e, a = r.n, o = r.m), s;
9650
+ return (i !== e || a !== r.n || o !== r.m) && (s = Qs(e, r.n, r.m), i = e, a = r.n, o = r.m), s;
9589
9651
  }
9590
9652
  return {
9591
9653
  name: `stoch_${t}`,
@@ -9603,7 +9665,7 @@ function Zs(e = {}) {
9603
9665
  t.strokeStyle = "rgba(0, 0, 0, 0.1)", t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(h, p), t.lineTo(g, p), t.moveTo(h, m), t.lineTo(g, m), t.stroke(), t.setLineDash([]);
9604
9666
  let _ = Math.max(a.start, r.n + r.m - 2), v = Math.min(a.end, d.length);
9605
9667
  if (r.showK) {
9606
- t.strokeStyle = La.K, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9668
+ t.strokeStyle = Ra.K, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9607
9669
  let e = !0;
9608
9670
  for (let r = _; r < v; r++) {
9609
9671
  let i = f[r];
@@ -9616,7 +9678,7 @@ function Zs(e = {}) {
9616
9678
  t.stroke();
9617
9679
  }
9618
9680
  if (r.showD) {
9619
- t.strokeStyle = La.D, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9681
+ t.strokeStyle = Ra.D, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9620
9682
  let e = !0;
9621
9683
  for (let r = _; r < v; r++) {
9622
9684
  let i = f[r];
@@ -9641,29 +9703,29 @@ function Zs(e = {}) {
9641
9703
  }
9642
9704
  };
9643
9705
  }
9644
- function Qs(e, t, n, r) {
9645
- return Xs(e, n, r)[t];
9706
+ function ec(e, t, n, r) {
9707
+ return Qs(e, n, r)[t];
9646
9708
  }
9647
- function $s(e, t, n = 9, r = 3) {
9709
+ function tc(e, t, n = 9, r = 3) {
9648
9710
  if (t < n + r - 1 || t >= e.length) return null;
9649
- let i = Qs(e, t, n, r);
9711
+ let i = ec(e, t, n, r);
9650
9712
  return i ? {
9651
9713
  name: "STOCH",
9652
9714
  params: [n, r],
9653
9715
  values: [{
9654
9716
  label: "K",
9655
9717
  value: i.k,
9656
- color: La.K
9718
+ color: Ra.K
9657
9719
  }, {
9658
9720
  label: "D",
9659
9721
  value: i.d,
9660
- color: La.D
9722
+ color: Ra.D
9661
9723
  }]
9662
9724
  } : null;
9663
9725
  }
9664
9726
  //#endregion
9665
9727
  //#region src/core/renderers/Indicator/mom.ts
9666
- function ec(e, t) {
9728
+ function nc(e, t) {
9667
9729
  let n = Array(e.length);
9668
9730
  if (e.length < t + 1) return n;
9669
9731
  for (let r = t; r < e.length; r++) {
@@ -9672,14 +9734,14 @@ function ec(e, t) {
9672
9734
  }
9673
9735
  return n;
9674
9736
  }
9675
- function tc(e = {}) {
9737
+ function rc(e = {}) {
9676
9738
  let { paneId: t = "sub", config: n = {} } = e, r = {
9677
9739
  period: 10,
9678
9740
  showMOM: !0,
9679
9741
  ...n
9680
9742
  }, i = null, a = 0, o = [];
9681
9743
  function s(e) {
9682
- return (i !== e || a !== r.period) && (o = ec(e, r.period), i = e, a = r.period), o;
9744
+ return (i !== e || a !== r.period) && (o = nc(e, r.period), i = e, a = r.period), o;
9683
9745
  }
9684
9746
  return {
9685
9747
  name: `mom_${t}`,
@@ -9702,10 +9764,10 @@ function tc(e = {}) {
9702
9764
  let g = p - m || 1, _ = n.height - (0 - m) / g * n.height;
9703
9765
  t.save(), t.translate(-o, 0);
9704
9766
  let v = o, y = o + e.paneWidth;
9705
- t.strokeStyle = Ra.ZERO, t.lineWidth = 1, t.beginPath(), t.moveTo(v, _), t.lineTo(y, _), t.stroke();
9767
+ t.strokeStyle = za.ZERO, t.lineWidth = 1, t.beginPath(), t.moveTo(v, _), t.lineTo(y, _), t.stroke();
9706
9768
  let b = Math.max(a.start, r.period), x = Math.min(a.end, d.length);
9707
9769
  if (r.showMOM) {
9708
- t.strokeStyle = Ra.MOM, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9770
+ t.strokeStyle = za.MOM, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9709
9771
  let e = !0;
9710
9772
  for (let r = b; r < x; r++) {
9711
9773
  let i = f[r];
@@ -9730,25 +9792,25 @@ function tc(e = {}) {
9730
9792
  }
9731
9793
  };
9732
9794
  }
9733
- function nc(e, t, n) {
9734
- return ec(e, n)[t];
9795
+ function ic(e, t, n) {
9796
+ return nc(e, n)[t];
9735
9797
  }
9736
- function rc(e, t, n = 10) {
9798
+ function ac(e, t, n = 10) {
9737
9799
  if (t < n || t >= e.length) return null;
9738
- let r = nc(e, t, n);
9800
+ let r = ic(e, t, n);
9739
9801
  return r === void 0 ? null : {
9740
9802
  name: "MOM",
9741
9803
  params: [n],
9742
9804
  values: [{
9743
9805
  label: "MOM",
9744
9806
  value: r,
9745
- color: Ra.MOM
9807
+ color: za.MOM
9746
9808
  }]
9747
9809
  };
9748
9810
  }
9749
9811
  //#endregion
9750
9812
  //#region src/core/renderers/Indicator/wmsr.ts
9751
- function ic(e, t) {
9813
+ function oc(e, t) {
9752
9814
  let n = Array(e.length);
9753
9815
  if (e.length < t) return n;
9754
9816
  for (let r = t - 1; r < e.length; r++) {
@@ -9762,14 +9824,14 @@ function ic(e, t) {
9762
9824
  }
9763
9825
  return n;
9764
9826
  }
9765
- function ac(e = {}) {
9827
+ function sc(e = {}) {
9766
9828
  let { paneId: t = "sub", config: n = {} } = e, r = {
9767
9829
  period: 14,
9768
9830
  showWMSR: !0,
9769
9831
  ...n
9770
9832
  }, i = null, a = 0, o = [];
9771
9833
  function s(e) {
9772
- return (i !== e || a !== r.period) && (o = ic(e, r.period), i = e, a = r.period), o;
9834
+ return (i !== e || a !== r.period) && (o = oc(e, r.period), i = e, a = r.period), o;
9773
9835
  }
9774
9836
  return {
9775
9837
  name: `wmsr_${t}`,
@@ -9784,10 +9846,10 @@ function ac(e = {}) {
9784
9846
  let f = s(d), p = -100;
9785
9847
  0 - p, t.save(), t.translate(-o, 0);
9786
9848
  let m = n.height - (-20 - p) / 100 * n.height, h = n.height - (-80 - p) / 100 * n.height, g = n.height - (-50 - p) / 100 * n.height, _ = o, v = o + e.paneWidth;
9787
- t.strokeStyle = za.OVERBOUGHT, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(_, m), t.lineTo(v, m), t.stroke(), t.strokeStyle = za.OVERSOLD, t.beginPath(), t.moveTo(_, h), t.lineTo(v, h), t.stroke(), t.strokeStyle = "rgba(0, 0, 0, 0.1)", t.beginPath(), t.moveTo(_, g), t.lineTo(v, g), t.stroke(), t.setLineDash([]);
9849
+ t.strokeStyle = Ba.OVERBOUGHT, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(_, m), t.lineTo(v, m), t.stroke(), t.strokeStyle = Ba.OVERSOLD, t.beginPath(), t.moveTo(_, h), t.lineTo(v, h), t.stroke(), t.strokeStyle = "rgba(0, 0, 0, 0.1)", t.beginPath(), t.moveTo(_, g), t.lineTo(v, g), t.stroke(), t.setLineDash([]);
9788
9850
  let y = Math.max(a.start, r.period - 1), b = Math.min(a.end, d.length);
9789
9851
  if (r.showWMSR) {
9790
- t.strokeStyle = za.WMSR, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9852
+ t.strokeStyle = Ba.WMSR, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9791
9853
  let e = !0;
9792
9854
  for (let r = y; r < b; r++) {
9793
9855
  let i = f[r];
@@ -9812,25 +9874,25 @@ function ac(e = {}) {
9812
9874
  }
9813
9875
  };
9814
9876
  }
9815
- function oc(e, t, n) {
9816
- return ic(e, n)[t];
9877
+ function cc(e, t, n) {
9878
+ return oc(e, n)[t];
9817
9879
  }
9818
- function sc(e, t, n = 14) {
9880
+ function lc(e, t, n = 14) {
9819
9881
  if (t < n || t >= e.length) return null;
9820
- let r = oc(e, t, n);
9882
+ let r = cc(e, t, n);
9821
9883
  return r === void 0 ? null : {
9822
9884
  name: "WMSR",
9823
9885
  params: [n],
9824
9886
  values: [{
9825
9887
  label: "WMSR",
9826
9888
  value: r,
9827
- color: za.WMSR
9889
+ color: Ba.WMSR
9828
9890
  }]
9829
9891
  };
9830
9892
  }
9831
9893
  //#endregion
9832
9894
  //#region src/core/renderers/Indicator/kst.ts
9833
- function cc(e, t) {
9895
+ function uc(e, t) {
9834
9896
  let n = Array(e.length);
9835
9897
  if (e.length < t + 1) return n;
9836
9898
  for (let r = t; r < e.length; r++) {
@@ -9839,7 +9901,7 @@ function cc(e, t) {
9839
9901
  }
9840
9902
  return n;
9841
9903
  }
9842
- function lc(e, t) {
9904
+ function dc(e, t) {
9843
9905
  let n = Array(e.length), r = 0, i = 0;
9844
9906
  for (let a = 0; a < e.length; a++) {
9845
9907
  let o = e[a];
@@ -9853,13 +9915,13 @@ function lc(e, t) {
9853
9915
  }
9854
9916
  return n;
9855
9917
  }
9856
- function uc(e, t, n, r, i, a) {
9857
- let o = Array(e.length), s = cc(e, t), c = cc(e, n), l = cc(e, r), u = cc(e, i), d = lc(s, 10), f = lc(c, 10), p = lc(l, 10), m = lc(u, 15), h = Array(e.length);
9918
+ function fc(e, t, n, r, i, a) {
9919
+ let o = Array(e.length), s = uc(e, t), c = uc(e, n), l = uc(e, r), u = uc(e, i), d = dc(s, 10), f = dc(c, 10), p = dc(l, 10), m = dc(u, 15), h = Array(e.length);
9858
9920
  for (let t = 0; t < e.length; t++) {
9859
9921
  let e = d[t], n = f[t], r = p[t], i = m[t];
9860
9922
  e !== void 0 && n !== void 0 && r !== void 0 && i !== void 0 && (h[t] = e * 1 + n * 2 + r * 3 + i * 4);
9861
9923
  }
9862
- let g = lc(h, a);
9924
+ let g = dc(h, a);
9863
9925
  for (let t = 0; t < e.length; t++) {
9864
9926
  let e = h[t], n = g[t];
9865
9927
  e !== void 0 && n !== void 0 && (o[t] = {
@@ -9869,7 +9931,7 @@ function uc(e, t, n, r, i, a) {
9869
9931
  }
9870
9932
  return o;
9871
9933
  }
9872
- function dc(e = {}) {
9934
+ function pc(e = {}) {
9873
9935
  let { paneId: t = "sub", config: n = {} } = e, r = {
9874
9936
  roc1: 10,
9875
9937
  roc2: 15,
@@ -9882,7 +9944,7 @@ function dc(e = {}) {
9882
9944
  }, i = null, a = "", o = [];
9883
9945
  function s(e) {
9884
9946
  let t = `${r.roc1}-${r.roc2}-${r.roc3}-${r.roc4}-${r.signalPeriod}`;
9885
- return (i !== e || a !== t) && (o = uc(e, r.roc1, r.roc2, r.roc3, r.roc4, r.signalPeriod), i = e, a = t), o;
9947
+ return (i !== e || a !== t) && (o = fc(e, r.roc1, r.roc2, r.roc3, r.roc4, r.signalPeriod), i = e, a = t), o;
9886
9948
  }
9887
9949
  return {
9888
9950
  name: `kst_${t}`,
@@ -9908,7 +9970,7 @@ function dc(e = {}) {
9908
9970
  t.strokeStyle = "rgba(0, 0, 0, 0.1)", t.lineWidth = 1, t.beginPath(), t.moveTo(v, _), t.lineTo(y, _), t.stroke();
9909
9971
  let b = Math.max(a.start, r.roc4 + 15 + r.signalPeriod - 1), x = Math.min(a.end, d.length);
9910
9972
  if (r.showKST) {
9911
- t.strokeStyle = Ba.KST, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9973
+ t.strokeStyle = Va.KST, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9912
9974
  let e = !0;
9913
9975
  for (let r = b; r < x; r++) {
9914
9976
  let i = f[r];
@@ -9921,7 +9983,7 @@ function dc(e = {}) {
9921
9983
  t.stroke();
9922
9984
  }
9923
9985
  if (r.showSignal) {
9924
- t.strokeStyle = Ba.SIGNAL, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9986
+ t.strokeStyle = Va.SIGNAL, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
9925
9987
  let e = !0;
9926
9988
  for (let r = b; r < x; r++) {
9927
9989
  let i = f[r];
@@ -9946,12 +10008,12 @@ function dc(e = {}) {
9946
10008
  }
9947
10009
  };
9948
10010
  }
9949
- function fc(e, t, n, r, i, a, o) {
9950
- return uc(e, n, r, i, a, o)[t];
10011
+ function mc(e, t, n, r, i, a, o) {
10012
+ return fc(e, n, r, i, a, o)[t];
9951
10013
  }
9952
- function pc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
10014
+ function hc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
9953
10015
  if (t < a + 15 + o || t >= e.length) return null;
9954
- let s = fc(e, t, n, r, i, a, o);
10016
+ let s = mc(e, t, n, r, i, a, o);
9955
10017
  return s ? {
9956
10018
  name: "KST",
9957
10019
  params: [
@@ -9964,17 +10026,17 @@ function pc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
9964
10026
  values: [{
9965
10027
  label: "KST",
9966
10028
  value: s.kst,
9967
- color: Ba.KST
10029
+ color: Va.KST
9968
10030
  }, {
9969
10031
  label: "Signal",
9970
10032
  value: s.signal,
9971
- color: Ba.SIGNAL
10033
+ color: Va.SIGNAL
9972
10034
  }]
9973
10035
  } : null;
9974
10036
  }
9975
10037
  //#endregion
9976
10038
  //#region src/core/renderers/Indicator/fastk.ts
9977
- function mc(e, t) {
10039
+ function gc(e, t) {
9978
10040
  let n = Array(e.length);
9979
10041
  if (e.length < t) return n;
9980
10042
  for (let r = t - 1; r < e.length; r++) {
@@ -9988,14 +10050,14 @@ function mc(e, t) {
9988
10050
  }
9989
10051
  return n;
9990
10052
  }
9991
- function hc(e = {}) {
10053
+ function _c(e = {}) {
9992
10054
  let { paneId: t = "sub", config: n = {} } = e, r = {
9993
10055
  period: 9,
9994
10056
  showFASTK: !0,
9995
10057
  ...n
9996
10058
  }, i = null, a = 0, o = [];
9997
10059
  function s(e) {
9998
- return (i !== e || a !== r.period) && (o = mc(e, r.period), i = e, a = r.period), o;
10060
+ return (i !== e || a !== r.period) && (o = gc(e, r.period), i = e, a = r.period), o;
9999
10061
  }
10000
10062
  return {
10001
10063
  name: `fastk_${t}`,
@@ -10013,7 +10075,7 @@ function hc(e = {}) {
10013
10075
  t.strokeStyle = "rgba(0, 0, 0, 0.1)", t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(h, p), t.lineTo(g, p), t.moveTo(h, m), t.lineTo(g, m), t.stroke(), t.setLineDash([]);
10014
10076
  let _ = Math.max(a.start, r.period - 1), v = Math.min(a.end, d.length);
10015
10077
  if (r.showFASTK) {
10016
- t.strokeStyle = La.K, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
10078
+ t.strokeStyle = Ra.K, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
10017
10079
  let e = !0;
10018
10080
  for (let r = _; r < v; r++) {
10019
10081
  let i = f[r];
@@ -10038,42 +10100,42 @@ function hc(e = {}) {
10038
10100
  }
10039
10101
  };
10040
10102
  }
10041
- function gc(e, t, n) {
10042
- return mc(e, n)[t];
10103
+ function vc(e, t, n) {
10104
+ return gc(e, n)[t];
10043
10105
  }
10044
- function _c(e, t, n = 9) {
10106
+ function yc(e, t, n = 9) {
10045
10107
  if (t < n || t >= e.length) return null;
10046
- let r = gc(e, t, n);
10108
+ let r = vc(e, t, n);
10047
10109
  return r === void 0 ? null : {
10048
10110
  name: "FASTK",
10049
10111
  params: [n],
10050
10112
  values: [{
10051
10113
  label: "FASTK",
10052
10114
  value: r,
10053
- color: La.K
10115
+ color: Ra.K
10054
10116
  }]
10055
10117
  };
10056
10118
  }
10057
10119
  //#endregion
10058
10120
  //#region src/core/renderers/Indicator/index.ts
10059
- function vc(e) {
10121
+ function bc(e) {
10060
10122
  let { indicatorId: t, paneId: n } = e;
10061
10123
  switch (t) {
10062
- case "VOLUME": return _s({ paneId: n });
10063
- case "MACD": return Bs({ paneId: n });
10064
- case "RSI": return Ws({ paneId: n });
10065
- case "CCI": return qs({ paneId: n });
10066
- case "STOCH": return Zs({ paneId: n });
10067
- case "MOM": return tc({ paneId: n });
10068
- case "WMSR": return ac({ paneId: n });
10069
- case "KST": return dc({ paneId: n });
10070
- case "FASTK": return hc({ paneId: n });
10124
+ case "VOLUME": return vs({ paneId: n });
10125
+ case "MACD": return Hs({ paneId: n });
10126
+ case "RSI": return Ks({ paneId: n });
10127
+ case "CCI": return Ys({ paneId: n });
10128
+ case "STOCH": return $s({ paneId: n });
10129
+ case "MOM": return rc({ paneId: n });
10130
+ case "WMSR": return sc({ paneId: n });
10131
+ case "KST": return pc({ paneId: n });
10132
+ case "FASTK": return _c({ paneId: n });
10071
10133
  default: throw Error(`Unknown indicator: ${t}`);
10072
10134
  }
10073
10135
  }
10074
10136
  //#endregion
10075
10137
  //#region src/core/chart.ts
10076
- var yc = class e {
10138
+ var xc = class e {
10077
10139
  dom;
10078
10140
  opt;
10079
10141
  data = [];
@@ -10085,21 +10147,55 @@ var yc = class e {
10085
10147
  pluginHost;
10086
10148
  rendererPluginManager;
10087
10149
  preciseDpr = 0;
10088
- dprObserver;
10150
+ resizeObserver;
10151
+ observedSize = {
10152
+ width: 0,
10153
+ height: 0
10154
+ };
10155
+ onViewportChange;
10089
10156
  constructor(e, t) {
10090
- if (this.dom = e, this.opt = t, this.interaction = new hs(this), this.markerManager = new yo(), this.pluginHost = fa(), this.rendererPluginManager = new ma(), this.rendererPluginManager.setPluginHost(this.pluginHost), this.rendererPluginManager.setInvalidateCallback(() => this.scheduleDraw()), this.initPanes(), typeof ResizeObserver < "u" && "devicePixelContentBoxSize" in ResizeObserverEntry.prototype) {
10091
- let e = this.dom.canvasLayer;
10092
- e && (this.dprObserver = new ResizeObserver((e) => {
10157
+ this.dom = e, this.opt = t, this.interaction = new gs(this), this.markerManager = new bo(), this.pluginHost = pa(), this.rendererPluginManager = new ha(), this.rendererPluginManager.setPluginHost(this.pluginHost), this.rendererPluginManager.setInvalidateCallback(() => this.scheduleDraw()), this.initPanes(), this.initResizeObserver();
10158
+ }
10159
+ initResizeObserver() {
10160
+ if (typeof ResizeObserver > "u") return;
10161
+ let e = this.dom.container;
10162
+ if (e) {
10163
+ this.resizeObserver = new ResizeObserver((e) => {
10093
10164
  let t = e[0];
10094
10165
  if (!t) return;
10095
- let n = t.devicePixelContentBoxSize?.[0], r = t.contentBoxSize?.[0];
10096
- if (n && r) {
10097
- let e = n.inlineSize / r.inlineSize;
10098
- this.preciseDpr = Math.round(e * 64) / 64;
10099
- }
10100
- }), this.dprObserver.observe(e));
10166
+ let n = this.observedSize.width, r = this.observedSize.height, i = this.preciseDpr;
10167
+ this.updateObservedMetrics(t);
10168
+ let a = this.observedSize.width !== n, o = this.observedSize.height !== r, s = this.preciseDpr !== i;
10169
+ (a || o || s) && this.resize();
10170
+ });
10171
+ try {
10172
+ this.resizeObserver.observe(e, { box: "device-pixel-content-box" });
10173
+ } catch {
10174
+ this.resizeObserver.observe(e);
10175
+ }
10101
10176
  }
10102
10177
  }
10178
+ updateObservedMetrics(e) {
10179
+ let t = Math.max(1, Math.round(e.contentRect.width)), n = Math.max(1, Math.round(e.contentRect.height));
10180
+ this.observedSize.width = t, this.observedSize.height = n;
10181
+ let r = e.devicePixelContentBoxSize?.[0], i = e.contentBoxSize?.[0];
10182
+ if (!r || !i || i.inlineSize <= 0) {
10183
+ this.preciseDpr = 0;
10184
+ return;
10185
+ }
10186
+ let a = r.inlineSize / i.inlineSize;
10187
+ this.preciseDpr = Math.round(a * 64) / 64;
10188
+ }
10189
+ getEffectiveDpr() {
10190
+ let e = this.preciseDpr > 0 ? this.preciseDpr : Math.round((window.devicePixelRatio || 1) * 64) / 64;
10191
+ return e < 1 && (e = 1), e;
10192
+ }
10193
+ getViewport() {
10194
+ return this.viewport;
10195
+ }
10196
+ getCurrentDpr() {
10197
+ return this.getEffectiveDpr();
10198
+ }
10103
10199
  get plugin() {
10104
10200
  return this.pluginHost;
10105
10201
  }
@@ -10125,10 +10221,10 @@ var yc = class e {
10125
10221
  this.markerManager.clear();
10126
10222
  let e = this.computeViewport();
10127
10223
  if (!e || this.data.length === 0) return;
10128
- let { start: t, end: n } = ds(e.scrollLeft, e.plotWidth, this.opt.kWidth, this.opt.kGap, this.data.length, e.dpr), r = {
10224
+ let { start: t, end: n } = fs(e.scrollLeft, e.plotWidth, this.opt.kWidth, this.opt.kGap, this.data.length, e.dpr), r = {
10129
10225
  start: t,
10130
10226
  end: n
10131
- }, i = this.calcKLinePositions(r), { kWidthPx: a } = us(this.opt.kWidth, this.opt.kGap, e.dpr);
10227
+ }, i = this.calcKLinePositions(r), { kWidthPx: a } = ds(this.opt.kWidth, this.opt.kGap, e.dpr);
10132
10228
  this.interaction.setKLinePositions(i, r, a);
10133
10229
  for (let t of this.paneRenderers) {
10134
10230
  let n = t.getPane(), a = t.getDom().plotCanvas.getContext("2d"), o = t.getDom().yAxisCanvas.getContext("2d");
@@ -10195,7 +10291,7 @@ var yc = class e {
10195
10291
  }
10196
10292
  }
10197
10293
  zoomAt(e, t, n) {
10198
- let r = this.opt.kWidth + this.opt.kGap, i = (t + e) / r, a = this.viewport?.dpr || window.devicePixelRatio || 1, o = Math.round(this.opt.kWidth * a), s = n > 0 ? -2 : 2, c = o + s;
10294
+ let r = this.opt.kWidth + this.opt.kGap, i = (t + e) / r, a = this.getEffectiveDpr(), o = Math.round(this.opt.kWidth * a), s = n > 0 ? -2 : 2, c = o + s;
10199
10295
  c % 2 == 0 && (c += s > 0 ? 1 : -1);
10200
10296
  let l = c / a, u = 3 / a;
10201
10297
  if (l = Math.max(this.opt.minKWidth, Math.min(this.opt.maxKWidth, l)), Math.abs(l - this.opt.kWidth) < .01) return;
@@ -10223,6 +10319,9 @@ var yc = class e {
10223
10319
  setOnZoomChange(e) {
10224
10320
  this.onZoomChange = e;
10225
10321
  }
10322
+ setOnViewportChange(e) {
10323
+ this.onViewportChange = e;
10324
+ }
10226
10325
  getPaneRenderers() {
10227
10326
  return this.paneRenderers;
10228
10327
  }
@@ -10244,7 +10343,7 @@ var yc = class e {
10244
10343
  calcKLinePositions(e) {
10245
10344
  let { start: t, end: n } = e, r = n - t;
10246
10345
  if (r <= 0) return [];
10247
- let i = this.viewport?.dpr || window.devicePixelRatio || 1, { unitPx: a, startXPx: o } = us(this.opt.kWidth, this.opt.kGap, i), s = Array(r);
10346
+ let i = this.getEffectiveDpr(), { unitPx: a, startXPx: o } = ds(this.opt.kWidth, this.opt.kGap, i), s = Array(r);
10248
10347
  for (let e = 0; e < r; e++) s[e] = (o + (t + e) * a) / i;
10249
10348
  return s;
10250
10349
  }
@@ -10262,9 +10361,9 @@ var yc = class e {
10262
10361
  console.warn(`Pane "${e}" already exists`);
10263
10362
  return;
10264
10363
  }
10265
- let t = new ms(e), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e === "main";
10364
+ let t = new hs(e), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e === "main";
10266
10365
  n.id = `${e}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0";
10267
- let a = new gs({
10366
+ let a = new _s({
10268
10367
  plotCanvas: n,
10269
10368
  yAxisCanvas: r
10270
10369
  }, t, {
@@ -10295,7 +10394,7 @@ var yc = class e {
10295
10394
  return n && this.updateRendererConfig(e, n), !0;
10296
10395
  }
10297
10396
  this.addPane(r);
10298
- let i = vc({
10397
+ let i = bc({
10299
10398
  indicatorId: t,
10300
10399
  paneId: r
10301
10400
  });
@@ -10336,7 +10435,7 @@ var yc = class e {
10336
10435
  return this.data;
10337
10436
  }
10338
10437
  getContentWidth() {
10339
- let e = this.data?.length ?? 0, t = this.viewport?.dpr || window.devicePixelRatio || 1, { startXPx: n, unitPx: r } = us(this.opt.kWidth, this.opt.kGap, t);
10438
+ let e = this.data?.length ?? 0, t = this.getEffectiveDpr(), { startXPx: n, unitPx: r } = ds(this.opt.kWidth, this.opt.kGap, t);
10340
10439
  return (n + e * r) / t;
10341
10440
  }
10342
10441
  resize() {
@@ -10349,12 +10448,15 @@ var yc = class e {
10349
10448
  });
10350
10449
  }
10351
10450
  async destroy() {
10352
- this.raf != null && cancelAnimationFrame(this.raf), this.raf = null, this.dprObserver?.disconnect(), this.dprObserver = void 0, this.preciseDpr = 0, this.viewport = null, this.paneRenderers.forEach((e) => e.destroy()), this.paneRenderers = [], this.rendererPluginManager.clear(), this.onZoomChange = void 0, await this.pluginHost.destroy();
10451
+ this.raf != null && cancelAnimationFrame(this.raf), this.raf = null, this.resizeObserver?.disconnect(), this.resizeObserver = void 0, this.preciseDpr = 0, this.observedSize = {
10452
+ width: 0,
10453
+ height: 0
10454
+ }, this.viewport = null, this.paneRenderers.forEach((e) => e.destroy()), this.paneRenderers = [], this.rendererPluginManager.clear(), this.onZoomChange = void 0, this.onViewportChange = void 0, await this.pluginHost.destroy();
10353
10455
  }
10354
10456
  initPanes() {
10355
10457
  this.paneRenderers = this.opt.panes.map((e) => {
10356
- let t = new ms(e.id), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e.id === "main";
10357
- return n.id = `${e.id}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e.id}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0", new gs({
10458
+ let t = new hs(e.id), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e.id === "main";
10459
+ return n.id = `${e.id}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e.id}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0", new _s({
10358
10460
  plotCanvas: n,
10359
10461
  yAxisCanvas: r
10360
10462
  }, t, {
@@ -10380,7 +10482,7 @@ var yc = class e {
10380
10482
  let o = this.paneRenderers.find((e) => e.getPane().id === a.id);
10381
10483
  if (!o) continue;
10382
10484
  let s = o.getPane(), c = l[i];
10383
- s.setLayout(r, c), s.id === "main" ? s.setPadding(this.opt.yPaddingPx, this.opt.yPaddingPx) : s.setPadding(0, 0), o.resize(e.plotWidth, c, e.dpr);
10485
+ s.setLayout(r, c), s.id === "main" ? s.setPadding(this.opt.yPaddingPx, this.opt.yPaddingPx) : s.setPadding(0, 0), o.resize(e.plotWidth, c, e.dpr), this.rendererPluginManager.notifyResize(s.id, oa(s));
10384
10486
  let u = o.getDom();
10385
10487
  u.plotCanvas.style.top = `${r}px`, u.yAxisCanvas.style.top = `${r}px`, r += c + n;
10386
10488
  }
@@ -10388,37 +10490,35 @@ var yc = class e {
10388
10490
  computeViewport() {
10389
10491
  let e = this.dom.container;
10390
10492
  if (!e) return null;
10391
- let t = Math.max(1, Math.round(e.clientWidth)), n = Math.max(1, Math.round(e.clientHeight)), r = this.opt.rightAxisWidth + (this.opt.priceLabelWidth || 60), i = Math.round(t - r), a = Math.round(n - this.opt.bottomAxisHeight), o = this.preciseDpr > 0 ? this.preciseDpr : Math.round((window.devicePixelRatio || 1) * 64) / 64;
10392
- o < 1 && (o = 1);
10393
- let s = 16 * 1024 * 1024;
10394
- t * o * (n * o) > s && (o = Math.sqrt(s / (t * n)));
10395
- let c = Math.round(e.scrollLeft * o) / o;
10396
- this.dom.canvasLayer.style.width = `${t}px`, this.dom.canvasLayer.style.height = `${n}px`, this.dom.xAxisCanvas.style.width = `${i}px`, this.dom.xAxisCanvas.style.height = `${this.opt.bottomAxisHeight}px`, this.dom.xAxisCanvas.width = Math.round(i * o), this.dom.xAxisCanvas.height = Math.round(this.opt.bottomAxisHeight * o);
10397
- let l = {
10398
- viewWidth: t,
10399
- viewHeight: n,
10400
- plotWidth: i,
10401
- plotHeight: a,
10402
- scrollLeft: c,
10403
- dpr: o
10493
+ let t = this.observedSize.width, n = this.observedSize.height, r = t > 0 ? t : Math.max(1, Math.round(e.clientWidth)), i = n > 0 ? n : Math.max(1, Math.round(e.clientHeight)), a = this.opt.rightAxisWidth + (this.opt.priceLabelWidth || 60), o = Math.round(r - a), s = Math.round(i - this.opt.bottomAxisHeight), c = this.getEffectiveDpr(), l = 16 * 1024 * 1024;
10494
+ r * c * (i * c) > l && (c = Math.sqrt(l / (r * i)));
10495
+ let u = Math.round(e.scrollLeft * c) / c;
10496
+ this.dom.canvasLayer.style.width = `${r}px`, this.dom.canvasLayer.style.height = `${i}px`, this.dom.xAxisCanvas.style.width = `${o}px`, this.dom.xAxisCanvas.style.height = `${this.opt.bottomAxisHeight}px`, this.dom.xAxisCanvas.width = Math.round(o * c), this.dom.xAxisCanvas.height = Math.round(this.opt.bottomAxisHeight * c);
10497
+ let d = {
10498
+ viewWidth: r,
10499
+ viewHeight: i,
10500
+ plotWidth: o,
10501
+ plotHeight: s,
10502
+ scrollLeft: u,
10503
+ dpr: c
10404
10504
  };
10405
- return this.viewport = l, l;
10505
+ return this.viewport = d, this.onViewportChange?.(d), d;
10406
10506
  }
10407
10507
  };
10408
10508
  //#endregion
10409
10509
  //#region src/types/kLine.ts
10410
- function bc(e) {
10510
+ function Sc(e) {
10411
10511
  return e.open > e.close ? "down" : e.open < e.close ? "up" : "flat";
10412
10512
  }
10413
10513
  //#endregion
10414
10514
  //#region src/types/volumePrice.ts
10415
10515
  var $ = /* @__PURE__ */ function(e) {
10416
10516
  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;
10417
- }({}), xc = {
10517
+ }({}), Cc = {
10418
10518
  volumeAmplifyThreshold: 1.5,
10419
10519
  volumeShrinkThreshold: .8,
10420
10520
  avgPeriod: 20
10421
- }, Sc = class {
10521
+ }, wc = class {
10422
10522
  prefixSum = [];
10423
10523
  dataLength = 0;
10424
10524
  build(e) {
@@ -10443,8 +10543,8 @@ var $ = /* @__PURE__ */ function(e) {
10443
10543
  return this.dataLength;
10444
10544
  }
10445
10545
  };
10446
- function Cc(e, t, n, r = xc) {
10447
- let i = new Sc();
10546
+ function Tc(e, t, n, r = Cc) {
10547
+ let i = new wc();
10448
10548
  i.build(e);
10449
10549
  let a = [], { volumeAmplifyThreshold: o, volumeShrinkThreshold: s, avgPeriod: c } = r;
10450
10550
  for (let r = t; r < n && r < e.length; r++) {
@@ -10465,7 +10565,7 @@ function Cc(e, t, n, r = xc) {
10465
10565
  }
10466
10566
  //#endregion
10467
10567
  //#region src/core/renderers/candle.ts
10468
- function wc() {
10568
+ function Ec() {
10469
10569
  return {
10470
10570
  name: "candle",
10471
10571
  version: "1.0.0",
@@ -10476,36 +10576,36 @@ function wc() {
10476
10576
  draw(e) {
10477
10577
  let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: o, kGap: s, dpr: c, kLinePositions: l, markerManager: u } = e, d = r;
10478
10578
  if (!d.length) return;
10479
- let { kWidthPx: f } = us(o, s, c);
10579
+ let { kWidthPx: f } = ds(o, s, c);
10480
10580
  t.save(), t.translate(-a, 0);
10481
- let p = l || [], m = Cc(d, i.start, i.end, xc);
10581
+ let p = l || [], m = Tc(d, i.start, i.end, Cc);
10482
10582
  for (let e = i.start; e < i.end && e < d.length; e++) {
10483
10583
  let r = d[e];
10484
10584
  if (!r) continue;
10485
10585
  let a = n.yAxis.priceToY(r.open), s = n.yAxis.priceToY(r.close), l = n.yAxis.priceToY(r.high), h = n.yAxis.priceToY(r.low), g = p[e - i.start];
10486
10586
  if (!g) continue;
10487
- let _ = (e) => Math.round(e * c) / c, v = _(a), y = _(s), b = _(l), x = _(h), S = Math.min(v, y), C = Math.max(Math.abs(v - y), 1), w = Cs(Math.round(g * c), S, f, C, c);
10488
- t.fillStyle = bc(r) === "up" ? X.UP : X.DOWN, t.fillRect(w.bodyRect.x, w.bodyRect.y, w.bodyRect.width, w.bodyRect.height);
10587
+ let _ = (e) => Math.round(e * c) / c, v = _(a), y = _(s), b = _(l), x = _(h), S = Math.min(v, y), C = Math.max(Math.abs(v - y), 1), w = ws(Math.round(g * c), S, f, C, c);
10588
+ t.fillStyle = Sc(r) === "up" ? X.UP : X.DOWN, t.fillRect(w.bodyRect.x, w.bodyRect.y, w.bodyRect.width, w.bodyRect.height);
10489
10589
  let T = w.wickRect.width, E = w.wickRect.x, D = w.bodyRect.y, O = w.bodyRect.y + w.bodyRect.height, k = Math.max(r.open, r.close), A = Math.min(r.open, r.close);
10490
10590
  if (r.high > k) {
10491
- let e = xs(E, b, D, c);
10591
+ let e = Ss(E, b, D, c);
10492
10592
  e && t.fillRect(e.x, e.y, T, e.height);
10493
10593
  }
10494
10594
  if (r.low < A) {
10495
- let e = xs(E, O, x, c);
10595
+ let e = Ss(E, O, x, c);
10496
10596
  e && t.fillRect(e.x, e.y, T, e.height);
10497
10597
  }
10498
10598
  let j = m[e - i.start];
10499
10599
  if (j !== $.OTHERS && u) {
10500
10600
  let n = j === $.RISE_WITH_VOLUME || j === $.RISE_WITHOUT_VOLUME ? b - 15 : x + 15;
10501
- Tc(t, w.bodyRect.x + w.bodyRect.width / 2, n, j, e, o, 4, u, c);
10601
+ Dc(t, w.bodyRect.x + w.bodyRect.width / 2, n, j, e, o, 4, u, c);
10502
10602
  }
10503
10603
  }
10504
10604
  t.restore();
10505
10605
  }
10506
10606
  };
10507
10607
  }
10508
- function Tc(e, t, n, r, i, a, o = 4, s, c) {
10608
+ function Dc(e, t, n, r, i, a, o = 4, s, c) {
10509
10609
  let l = (e) => Math.round(e * c) / c;
10510
10610
  t = l(t), n = l(n);
10511
10611
  let u = Math.min(a, 20), d = u * Math.sqrt(3) / 2, f, p;
@@ -10571,12 +10671,12 @@ function Tc(e, t, n, r, i, a, o = 4, s, c) {
10571
10671
  }
10572
10672
  //#endregion
10573
10673
  //#region src/core/utils/tickCount.ts
10574
- function Ec(e, t) {
10575
- return t ? Math.max(4, Math.min(8, Math.round(e / 80))) : 2;
10674
+ function Oc(e, t) {
10675
+ return Math.max(3, Math.round(e / 60) + 1);
10576
10676
  }
10577
10677
  //#endregion
10578
10678
  //#region src/core/renderers/gridLines.ts
10579
- function Dc() {
10679
+ function kc() {
10580
10680
  return {
10581
10681
  name: "gridLines",
10582
10682
  version: "1.0.0",
@@ -10587,19 +10687,19 @@ function Dc() {
10587
10687
  draw(e) {
10588
10688
  let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: o, dpr: s, kLinePositions: c } = e, l = r;
10589
10689
  if (!l.length) return;
10590
- let u = Ec(n.height, n.id === "main");
10591
- t.save(), t.fillStyle = ja.HORIZONTAL, t.translate(-a, 0);
10690
+ let u = Oc(n.height, n.id === "main");
10691
+ t.save(), t.fillStyle = Ma.HORIZONTAL, t.translate(-a, 0);
10592
10692
  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);
10593
10693
  for (let e = 0; e < u; e++) {
10594
- let n = u <= 1 ? 0 : e / (u - 1), r = Ss(f, p, Math.round(g + n * v), s);
10694
+ let n = u <= 1 ? 0 : e / (u - 1), r = Cs(f, p, Math.round(g + n * v), s);
10595
10695
  r && t.fillRect(r.x, r.y, r.width, r.height);
10596
10696
  }
10597
- let y = Da(l);
10697
+ let y = Oa(l);
10598
10698
  for (let e of y) {
10599
10699
  if (e < i.start || e >= i.end || e >= l.length) continue;
10600
10700
  let r = e - i.start;
10601
10701
  if (r < 0 || r >= c.length) continue;
10602
- let a = xs(c[r] + o / 2, 0, n.height, s);
10702
+ let a = Ss(c[r] + o / 2, 0, n.height, s);
10603
10703
  a && t.fillRect(a.x, a.y, a.width, a.height);
10604
10704
  }
10605
10705
  t.restore();
@@ -10608,7 +10708,7 @@ function Dc() {
10608
10708
  }
10609
10709
  //#endregion
10610
10710
  //#region src/core/renderers/lastPrice.ts
10611
- function Oc() {
10711
+ function Ac() {
10612
10712
  return {
10613
10713
  name: "lastPriceLine",
10614
10714
  version: "1.0.0",
@@ -10629,7 +10729,7 @@ function Oc() {
10629
10729
  }
10630
10730
  //#endregion
10631
10731
  //#region src/core/renderers/extremaMarkers.ts
10632
- function kc() {
10732
+ function jc() {
10633
10733
  return {
10634
10734
  name: "extremaMarkers",
10635
10735
  version: "1.0.0",
@@ -10652,38 +10752,38 @@ function kc() {
10652
10752
  let t = e - i.start;
10653
10753
  return t < 0 || t >= l.length ? 0 : l[t] + o / 2;
10654
10754
  };
10655
- t.save(), t.translate(-a, 0), Ac(t, _(h), n.yAxis.priceToY(p), p, s, c, a), Ac(t, _(g), n.yAxis.priceToY(m), m, s, c, a), t.restore();
10755
+ t.save(), t.translate(-a, 0), Mc(t, _(h), n.yAxis.priceToY(p), p, s, c, a), Mc(t, _(g), n.yAxis.priceToY(m), m, s, c, a), t.restore();
10656
10756
  }
10657
10757
  };
10658
10758
  }
10659
- function Ac(e, t, n, r, i, a, o) {
10759
+ function Mc(e, t, n, r, i, a, o) {
10660
10760
  let s = r.toFixed(2);
10661
10761
  e.font = "12px Arial";
10662
10762
  let c = e.measureText(s).width, l = t - o + 30 + 4 + c > a, u = t, d = l ? t - 30 : t + 30;
10663
10763
  u > d && ([u, d] = [d, u]);
10664
- let f = Ss(u, d, n, i);
10665
- f && (e.fillStyle = Oa.WEAK, e.fillRect(f.x, f.y, f.width, f.height));
10764
+ let f = Cs(u, d, n, i);
10765
+ f && (e.fillStyle = ka.WEAK, e.fillRect(f.x, f.y, f.width, f.height));
10666
10766
  let p = Z(d, i), m = Z(n, i);
10667
- e.fillStyle = Oa.WEAK, e.beginPath(), e.arc(p, m, 2, 0, Math.PI * 2), e.fill(), e.font = "12px Arial", e.textBaseline = "middle", e.fillStyle = X.NEUTRAL, l ? (e.textAlign = "right", e.fillText(s, Z(t - 30 - 4, i), Z(n, i))) : (e.textAlign = "left", e.fillText(s, Z(t + 30 + 4, i), Z(n, i)));
10767
+ e.fillStyle = ka.WEAK, e.beginPath(), e.arc(p, m, 2, 0, Math.PI * 2), e.fill(), e.font = "12px Arial", e.textBaseline = "middle", e.fillStyle = X.NEUTRAL, l ? (e.textAlign = "right", e.fillText(s, Z(t - 30 - 4, i), Z(n, i))) : (e.textAlign = "left", e.fillText(s, Z(t + 30 + 4, i), Z(n, i)));
10668
10768
  }
10669
10769
  //#endregion
10670
10770
  //#region src/utils/priceToY.ts
10671
- function jc(e, t, n, r, i, a) {
10771
+ function Nc(e, t, n, r, i, a) {
10672
10772
  let o = t - n || 1, s = (e - n) / o;
10673
10773
  return i + Math.max(1, r - i - a) * (1 - s);
10674
10774
  }
10675
- function Mc(e, t, n, r, i, a) {
10775
+ function Pc(e, t, n, r, i, a) {
10676
10776
  let o = t - n || 1, s = Math.max(1, r - i - a);
10677
10777
  return n + (1 - (Math.min(Math.max(e, i), i + s) - i) / s) * o;
10678
10778
  }
10679
10779
  //#endregion
10680
10780
  //#region src/utils/kLineDraw/axis.ts
10681
- function Nc(e, t) {
10682
- let { x: n, y: r, width: i, height: a, priceRange: o, yPaddingPx: s = 0, dpr: c, ticks: l = 10, bgColor: u = ka.TRANSPARENT, textColor: d = Oa.SECONDARY, lineColor: f = Aa.DARK, fontSize: p = 16, drawLeftBorder: m = !0, drawTickLines: h = !0, priceOffset: g = 0 } = t, _ = Math.max(0, Math.min(s, Math.floor(a / 2) - 1)), { maxPrice: v, minPrice: y } = o, b = v - y, x = b === 0 ? 0 : b / (Math.max(2, l) - 1);
10781
+ function Fc(e, t) {
10782
+ let { x: n, y: r, width: i, height: a, priceRange: o, yPaddingPx: s = 0, dpr: c, ticks: l = 10, bgColor: u = Aa.TRANSPARENT, textColor: d = ka.SECONDARY, lineColor: f = ja.DARK, fontSize: p = 16, drawLeftBorder: m = !0, drawTickLines: h = !0, priceOffset: g = 0 } = t, _ = Math.max(0, Math.min(s, Math.floor(a / 2) - 1)), { maxPrice: v, minPrice: y } = o, b = v - y, x = b === 0 ? 0 : b / (Math.max(2, l) - 1);
10683
10783
  e.fillStyle = u, e.fillRect(n, r, i, a), m && (e.strokeStyle = f, e.lineWidth = 1, e.beginPath(), e.moveTo(Q(n, c), r), e.lineTo(Q(n, c), r + a), e.stroke()), e.font = `${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
10684
10784
  let S = n + i / 2;
10685
10785
  for (let t = 0; t < Math.max(2, l); t++) {
10686
- let i = b === 0 ? v : v - x * t, o = Math.round(jc(i, v, y, a, _, _) + r);
10786
+ let i = b === 0 ? v : v - x * t, o = Math.round(Nc(i, v, y, a, _, _) + r);
10687
10787
  if (h) {
10688
10788
  e.strokeStyle = f, e.beginPath();
10689
10789
  let t = Q(o, c);
@@ -10693,14 +10793,14 @@ function Nc(e, t) {
10693
10793
  e.fillStyle = d, e.fillText(s.toFixed(2), Z(S, c), Z(o, c));
10694
10794
  }
10695
10795
  }
10696
- function Pc(e, t) {
10697
- let { x: n, y: r, width: i, height: a, crosshairX: o, timestamp: s, dpr: c, fontSize: l = 16, paddingX: u = 8 } = t, d = Ea(s);
10796
+ function Ic(e, t) {
10797
+ let { x: n, y: r, width: i, height: a, crosshairX: o, timestamp: s, dpr: c, fontSize: l = 16, paddingX: u = 8 } = t, d = Da(s);
10698
10798
  e.save(), e.font = `${l}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
10699
10799
  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;
10700
10800
  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();
10701
10801
  }
10702
- function Fc(e, t) {
10703
- let { x: n, y: r, width: i, height: a, crosshairY: o, priceRange: s, yPaddingPx: c = 0, dpr: l, fontSize: u = 16 } = t, d = Math.max(0, Math.min(c, Math.floor(a / 2) - 1)), { maxPrice: f, minPrice: p } = s, m = Mc(o - r, f, p, a, d, d).toFixed(2);
10802
+ function Lc(e, t) {
10803
+ let { x: n, y: r, width: i, height: a, crosshairY: o, priceRange: s, yPaddingPx: c = 0, dpr: l, fontSize: u = 16 } = t, d = Math.max(0, Math.min(c, Math.floor(a / 2) - 1)), { maxPrice: f, minPrice: p } = s, m = Pc(o - r, f, p, a, d, d).toFixed(2);
10704
10804
  e.save(), e.font = `${u}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
10705
10805
  let h = u + 4, g = i, _ = Math.min(Math.max(o, r + h / 2), r + a - h / 2), v = _ - h / 2;
10706
10806
  e.fillStyle = "rgba(0, 0, 0, 0.8)";
@@ -10709,23 +10809,23 @@ function Fc(e, t) {
10709
10809
  let C = n + i / 2;
10710
10810
  e.fillStyle = "#ffffff", e.fillText(m, Z(C, l), Z(_, l)), e.restore();
10711
10811
  }
10712
- function Ic(e, t) {
10713
- 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 = ka.TRANSPARENT, textColor: m = Oa.SECONDARY, lineColor: h = Aa.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;
10812
+ function Rc(e, t) {
10813
+ 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 = Aa.TRANSPARENT, textColor: m = ka.SECONDARY, lineColor: h = ja.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;
10714
10814
  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";
10715
- let O = r + a / 2 + 1, k = Da(o).filter((e) => e >= u && e < d);
10815
+ let O = r + a / 2 + 1, k = Oa(o).filter((e) => e >= u && e < d);
10716
10816
  for (let t of k) {
10717
10817
  let n = o[t];
10718
10818
  if (!n) continue;
10719
10819
  let r = E + t * T + D / 2 - s, a = _, c = Math.max(_, i - _);
10720
10820
  if (r >= a && r <= c) {
10721
- let t = Math.min(Math.max(r, a), c), { text: i, isYear: o } = Ca(n.timestamp);
10821
+ let t = Math.min(Math.max(r, a), c), { text: i, isYear: o } = wa(n.timestamp);
10722
10822
  e.fillStyle = m, e.font = `${o ? "bold " : ""}${g}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.fillText(i, Z(t, f), Z(O, f));
10723
10823
  }
10724
10824
  }
10725
10825
  }
10726
10826
  //#endregion
10727
10827
  //#region src/core/renderers/yAxis.ts
10728
- function Lc(e) {
10828
+ function zc(e) {
10729
10829
  return {
10730
10830
  name: "yAxis",
10731
10831
  version: "1.0.0",
@@ -10734,8 +10834,8 @@ function Lc(e) {
10734
10834
  paneId: sa,
10735
10835
  priority: Y.SYSTEM_YAXIS,
10736
10836
  draw(t) {
10737
- let { ctx: n, pane: r, dpr: i, yAxisCtx: a } = t, o = a || n, s = Ec(r.height, r.id === "main");
10738
- Nc(o, {
10837
+ let { ctx: n, pane: r, dpr: i, yAxisCtx: a } = t, o = a || n, s = Oc(r.height, r.id === "main");
10838
+ Fc(o, {
10739
10839
  x: 0,
10740
10840
  y: r.top,
10741
10841
  width: e.axisWidth,
@@ -10750,7 +10850,7 @@ function Lc(e) {
10750
10850
  fontSize: 12
10751
10851
  });
10752
10852
  let c = e.getCrosshair?.();
10753
- c && c.price !== null && Fc(o, {
10853
+ c && c.price !== null && Lc(o, {
10754
10854
  x: 0,
10755
10855
  y: r.top,
10756
10856
  width: e.axisWidth,
@@ -10765,20 +10865,52 @@ function Lc(e) {
10765
10865
  };
10766
10866
  }
10767
10867
  //#endregion
10868
+ //#region src/core/renderers/Indicator/scale/macd_scale.ts
10869
+ function Bc(e) {
10870
+ let { axisWidth: t, paneId: n } = e, r = Rs("macd", n), i = null;
10871
+ return {
10872
+ name: `macdScale_${n}`,
10873
+ version: "1.0.0",
10874
+ description: "MACD 刻度渲染器",
10875
+ debugName: "MACD刻度",
10876
+ paneId: n,
10877
+ priority: Y.INDICATOR_SCALE,
10878
+ onInstall(e) {
10879
+ i = e;
10880
+ },
10881
+ draw(e) {
10882
+ let { yAxisCtx: n, pane: a, dpr: o } = e;
10883
+ if (!n || !i) return;
10884
+ let s = i.getSharedState(r);
10885
+ if (!s) return;
10886
+ let { valueMin: c, valueMax: l } = s, u = l - c || 1, { height: d } = a;
10887
+ n.save(), n.fillStyle = Aa.TRANSPARENT, n.fillRect(0, 0, t, d), n.strokeStyle = ja.DARK, n.lineWidth = 1, n.beginPath(), n.moveTo(Q(0, o), 0), n.lineTo(Q(0, o), d), n.stroke(), n.font = "12px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif", n.textBaseline = "middle", n.textAlign = "center";
10888
+ let f = t / 2, p = Oc(d, !1), m = d - 20, h = u / (p - 1);
10889
+ for (let e = 0; e < p; e++) {
10890
+ let t = c + h * e, r = 10 + m - (t - c) / u * m;
10891
+ n.strokeStyle = ja.DARK, n.lineWidth = 1, n.beginPath();
10892
+ let i = Q(r, o);
10893
+ n.moveTo(0, i), n.lineTo(4, i), n.stroke(), n.fillStyle = ka.SECONDARY, n.fillText(t.toFixed(2), Z(f, o), Z(r, o));
10894
+ }
10895
+ n.restore();
10896
+ }
10897
+ };
10898
+ }
10899
+ //#endregion
10768
10900
  //#region src/core/renderers/timeAxis.ts
10769
- var Rc = Symbol("time-axis");
10770
- function zc(e) {
10901
+ var Vc = Symbol("time-axis");
10902
+ function Hc(e) {
10771
10903
  return {
10772
10904
  name: "timeAxis",
10773
10905
  version: "1.0.0",
10774
10906
  description: "时间轴渲染器",
10775
10907
  debugName: "时间轴",
10776
- paneId: Rc,
10908
+ paneId: Vc,
10777
10909
  priority: Y.SYSTEM_XAXIS,
10778
10910
  isSystem: !0,
10779
10911
  draw(t) {
10780
10912
  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;
10781
- d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p), Ic(d, {
10913
+ d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p), Rc(d, {
10782
10914
  x: 0,
10783
10915
  y: 0,
10784
10916
  width: f,
@@ -10796,7 +10928,7 @@ function zc(e) {
10796
10928
  let m = e.getCrosshair?.();
10797
10929
  if (m && typeof m.index == "number") {
10798
10930
  let e = u[m.index];
10799
- e && Pc(d, {
10931
+ e && Ic(d, {
10800
10932
  x: 0,
10801
10933
  y: 0,
10802
10934
  width: f,
@@ -10812,7 +10944,7 @@ function zc(e) {
10812
10944
  }
10813
10945
  //#endregion
10814
10946
  //#region src/core/renderers/crosshair.ts
10815
- function Bc(e) {
10947
+ function Uc(e) {
10816
10948
  return {
10817
10949
  name: "crosshair",
10818
10950
  version: "1.0.0",
@@ -10824,10 +10956,10 @@ function Bc(e) {
10824
10956
  let { ctx: n, pane: r, dpr: i, paneWidth: a } = t, o = e.getCrosshairState();
10825
10957
  if (o.isDragging || !o.pos) return;
10826
10958
  let { x: s } = o.pos, c = r.id === o.activePaneId, l = -1;
10827
- c && o.price !== null && (l = r.yAxis.priceToY(o.price)), n.save(), n.beginPath(), n.rect(0, 0, a, r.height), n.clip(), n.fillStyle = Ua.LINE;
10828
- let u = xs(s, 0, r.height, i);
10959
+ c && o.price !== null && (l = r.yAxis.priceToY(o.price)), n.save(), n.beginPath(), n.rect(0, 0, a, r.height), n.clip(), n.fillStyle = Wa.LINE;
10960
+ let u = Ss(s, 0, r.height, i);
10829
10961
  if (u && n.fillRect(u.x, u.y, u.width, u.height), c && l >= 0) {
10830
- let e = Ss(0, a, Math.min(l, r.height - 1 / i), i);
10962
+ let e = Cs(0, a, Math.min(l, r.height - 1 / i), i);
10831
10963
  e && n.fillRect(e.x, e.y, e.width, e.height);
10832
10964
  }
10833
10965
  n.restore();
@@ -10836,7 +10968,7 @@ function Bc(e) {
10836
10968
  }
10837
10969
  //#endregion
10838
10970
  //#region src/core/renderers/paneTitle.ts
10839
- function Vc(e) {
10971
+ function Wc(e) {
10840
10972
  let t = { ...e };
10841
10973
  return {
10842
10974
  name: `paneTitle_${e.paneId}`,
@@ -10853,17 +10985,17 @@ function Vc(e) {
10853
10985
  let a = t.getTitleInfo?.();
10854
10986
  if (a) {
10855
10987
  let e = 12;
10856
- if (n.fillStyle = Oa.PRIMARY, n.fillText(a.name, e, i), e += n.measureText(a.name).width, a.params && a.params.length > 0) {
10988
+ if (n.fillStyle = ka.PRIMARY, n.fillText(a.name, e, i), e += n.measureText(a.name).width, a.params && a.params.length > 0) {
10857
10989
  let t = `(${a.params.join(",")})`;
10858
- n.fillStyle = Oa.TERTIARY, n.fillText(t, e, i), e += n.measureText(t).width + 8;
10990
+ n.fillStyle = ka.TERTIARY, n.fillText(t, e, i), e += n.measureText(t).width + 8;
10859
10991
  } else e += 8;
10860
10992
  if (a.values && a.values.length > 0) for (let t of a.values) {
10861
10993
  let r = `${t.label} ${t.value.toFixed(3)}`;
10862
10994
  n.fillStyle = t.color, n.fillText(r, e, i), e += n.measureText(r).width + 8;
10863
10995
  }
10864
- } else if (n.fillStyle = Oa.PRIMARY, n.fillText(t.title, 12, i), t.description) {
10996
+ } else if (n.fillStyle = ka.PRIMARY, n.fillText(t.title, 12, i), t.description) {
10865
10997
  let e = n.measureText(t.title).width;
10866
- n.fillStyle = Oa.WEAK, n.fillText(` - ${t.description}`, 12 + e, i);
10998
+ n.fillStyle = ka.WEAK, n.fillText(` - ${t.description}`, 12 + e, i);
10867
10999
  }
10868
11000
  n.restore();
10869
11001
  },
@@ -10877,7 +11009,7 @@ function Vc(e) {
10877
11009
  }
10878
11010
  //#endregion
10879
11011
  //#region src/components/KLineChart.vue?vue&type=script&setup=true&lang.ts
10880
- var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE__ */ u({
11012
+ var Gc = { class: "chart-wrapper" }, Kc = 4, qc = /* @__PURE__ */ _o(/* @__PURE__ */ u({
10881
11013
  __name: "KLineChart",
10882
11014
  props: {
10883
11015
  semanticConfig: {},
@@ -10891,11 +11023,11 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
10891
11023
  priceLabelWidth: { default: 60 }
10892
11024
  },
10893
11025
  setup(e, { expose: t }) {
10894
- let n = e, c = _(null), u = _(null), v = _(null), b = _(n.kWidth), x = _(n.kGap), C = y(null), w = y(null), T = _(0);
10895
- function E() {
11026
+ let n = e, c = _(null), u = _(null), v = _(null), b = _(n.kWidth), x = _(n.kGap), C = y(null), w = y(null), T = _(0), E = _(1);
11027
+ function D() {
10896
11028
  C.value?.scheduleDraw();
10897
11029
  }
10898
- function D(e) {
11030
+ function O(e) {
10899
11031
  if (!e) return;
10900
11032
  let t = e.getBoundingClientRect();
10901
11033
  C.value?.interaction.setTooltipSize({
@@ -10903,65 +11035,65 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
10903
11035
  height: Math.max(80, Math.round(t.height))
10904
11036
  });
10905
11037
  }
10906
- let O = _(null), k = _(null), A = _({
11038
+ let k = _(null), A = _(null), j = _({
10907
11039
  x: 0,
10908
11040
  y: 0
10909
- }), j = _(!1), M = _(null), N = _(null), P = _({
11041
+ }), M = _(!1), N = _(null), P = _(null), ee = _({
10910
11042
  x: 0,
10911
11043
  y: 0
10912
- }), ee = _(0), F = r(() => {
10913
- let e = M.value;
11044
+ }), F = _(0), I = r(() => {
11045
+ let e = N.value;
10914
11046
  if (typeof e != "number") return null;
10915
- ee.value;
11047
+ F.value;
10916
11048
  let t = C.value?.getData();
10917
11049
  return t && e >= 0 && e < t.length ? t[e] : null;
10918
- }), I = r(() => M.value), te = r(() => P.value), ne = r(() => (ee.value, C.value?.getData() ?? []));
10919
- function re() {
10920
- ee.value++;
11050
+ }), te = r(() => N.value), ne = r(() => ee.value), re = r(() => (F.value, C.value?.getData() ?? []));
11051
+ function ie() {
11052
+ F.value++;
10921
11053
  }
10922
- let ie = null;
10923
- function ae() {
11054
+ let ae = null;
11055
+ function L() {
10924
11056
  let e = C.value?.interaction;
10925
11057
  if (!e) {
10926
- M.value = null, N.value = null, O.value = null, k.value = null;
11058
+ N.value = null, P.value = null, k.value = null, A.value = null;
10927
11059
  return;
10928
11060
  }
10929
- M.value = e.hoveredIndex ?? null, N.value = e.crosshairIndex ?? null, O.value = e.hoveredMarkerData ?? null, k.value = e.hoveredCustomMarker ?? null;
11061
+ N.value = e.hoveredIndex ?? null, P.value = e.crosshairIndex ?? null, k.value = e.hoveredMarkerData ?? null, A.value = e.hoveredCustomMarker ?? null;
10930
11062
  let t = e.tooltipPos;
10931
- t && (P.value = {
11063
+ t && (ee.value = {
10932
11064
  x: t.x,
10933
11065
  y: t.y
10934
11066
  });
10935
11067
  }
10936
- function oe() {
10937
- ie ||= requestAnimationFrame(() => {
10938
- ae(), ie = null;
11068
+ function R() {
11069
+ ae ||= requestAnimationFrame(() => {
11070
+ L(), ae = null;
10939
11071
  });
10940
11072
  }
10941
- function L(e) {
10942
- j.value = !0, C.value?.interaction.onPointerDown(e), ae();
11073
+ function oe(e) {
11074
+ M.value = !0, C.value?.interaction.onPointerDown(e), L();
10943
11075
  }
10944
11076
  function se(e) {
10945
11077
  let t = v.value;
10946
11078
  if (t) {
10947
11079
  let n = t.getBoundingClientRect();
10948
- A.value = {
11080
+ j.value = {
10949
11081
  x: e.clientX - n.left,
10950
11082
  y: e.clientY - n.top
10951
11083
  };
10952
11084
  }
10953
- C.value?.interaction.onPointerMove(e), oe();
11085
+ C.value?.interaction.onPointerMove(e), R();
10954
11086
  }
10955
11087
  function ce(e) {
10956
- j.value = !1, C.value?.interaction.onPointerUp(e), ae();
11088
+ M.value = !1, C.value?.interaction.onPointerUp(e), L();
10957
11089
  }
10958
11090
  function le(e) {
10959
- j.value = !1, C.value?.interaction.onPointerLeave(e), M.value = null;
11091
+ M.value = !1, C.value?.interaction.onPointerLeave(e), N.value = null;
10960
11092
  }
10961
11093
  function ue() {
10962
- C.value?.interaction.onScroll(), ae();
11094
+ C.value?.interaction.onScroll(), L();
10963
11095
  }
10964
- let R = _([]), z = _({}), B = _([]), V = [
11096
+ let z = _([]), B = _({}), V = _([]), de = [
10965
11097
  "VOLUME",
10966
11098
  "MACD",
10967
11099
  "RSI",
@@ -10972,7 +11104,7 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
10972
11104
  "KST",
10973
11105
  "FASTK"
10974
11106
  ];
10975
- S(r(() => B.value.length === 0 ? [{
11107
+ S(r(() => V.value.length === 0 ? [{
10976
11108
  id: "main",
10977
11109
  ratio: 1,
10978
11110
  visible: !0
@@ -10980,14 +11112,14 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
10980
11112
  id: "main",
10981
11113
  ratio: 1,
10982
11114
  visible: !0
10983
- }, ...B.value.map((e) => ({
11115
+ }, ...V.value.map((e) => ({
10984
11116
  id: e.id,
10985
11117
  ratio: 1,
10986
11118
  visible: !0
10987
11119
  }))]), (e) => {
10988
11120
  C.value?.updatePaneLayout(e);
10989
11121
  }, { flush: "post" });
10990
- function de(e) {
11122
+ function fe(e) {
10991
11123
  switch (e) {
10992
11124
  case "MACD": return {
10993
11125
  fastPeriod: 12,
@@ -11017,99 +11149,99 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11017
11149
  default: return {};
11018
11150
  }
11019
11151
  }
11020
- function fe(e = "VOLUME", t) {
11021
- if (B.value.length >= Uc) return !1;
11152
+ function pe(e = "VOLUME", t) {
11153
+ if (V.value.length >= Kc) return !1;
11022
11154
  let n = `sub_${e}`;
11023
- if (B.value.some((e) => e.id === n)) return !0;
11024
- if (!C.value?.createSubPane(e, t ?? de(e))) return !1;
11025
- let r = Vc({
11155
+ if (V.value.some((e) => e.id === n)) return !0;
11156
+ if (!C.value?.createSubPane(e, t ?? fe(e))) return !1;
11157
+ let r = Wc({
11026
11158
  paneId: n,
11027
11159
  title: e,
11028
- getTitleInfo: () => ve(n)
11160
+ getTitleInfo: () => ye(n)
11029
11161
  });
11030
- return C.value?.useRenderer(r), B.value.push({
11162
+ return C.value?.useRenderer(r), V.value.push({
11031
11163
  id: n,
11032
11164
  indicatorId: e,
11033
11165
  rendererName: `${e.toLowerCase()}_${n}`,
11034
11166
  paneTitleRendererName: r.name,
11035
- params: t ?? de(e)
11036
- }), R.value.includes(e) || R.value.push(e), !0;
11167
+ params: t ?? fe(e)
11168
+ }), z.value.includes(e) || z.value.push(e), !0;
11037
11169
  }
11038
- function pe(e) {
11039
- let t = B.value.findIndex((t) => t.id === e);
11170
+ function me(e) {
11171
+ let t = V.value.findIndex((t) => t.id === e);
11040
11172
  if (t === -1) return;
11041
- let n = B.value[t];
11042
- n && (C.value?.removeRenderer(n.paneTitleRendererName), C.value?.removeSubPane(n.indicatorId), B.value.splice(t, 1), B.value.some((e) => e.indicatorId === n.indicatorId) || (R.value = R.value.filter((e) => e !== n.indicatorId)));
11043
- }
11044
- function me() {
11045
- for (let e of B.value) C.value?.removeRenderer(e.paneTitleRendererName);
11046
- C.value?.clearSubPanes(), B.value = [], R.value = R.value.filter((e) => !V.includes(e));
11173
+ let n = V.value[t];
11174
+ n && (C.value?.removeRenderer(n.paneTitleRendererName), C.value?.removeSubPane(n.indicatorId), V.value.splice(t, 1), V.value.some((e) => e.indicatorId === n.indicatorId) || (z.value = z.value.filter((e) => e !== n.indicatorId)));
11047
11175
  }
11048
11176
  function he() {
11177
+ for (let e of V.value) C.value?.removeRenderer(e.paneTitleRendererName);
11178
+ C.value?.clearSubPanes(), V.value = [], z.value = z.value.filter((e) => !de.includes(e));
11179
+ }
11180
+ function ge() {
11049
11181
  let e = n.semanticConfig.indicators?.main;
11050
- if (e) for (let t of e) t.enabled && (R.value.includes(t.type) || R.value.push(t.type), t.params && (z.value[t.type] = t.params));
11182
+ if (e) for (let t of e) t.enabled && (z.value.includes(t.type) || z.value.push(t.type), t.params && (B.value[t.type] = t.params));
11051
11183
  }
11052
- S([R, z], ([e]) => {
11184
+ S([z, B], ([e]) => {
11053
11185
  let t = C.value;
11054
11186
  t && (t.updateRendererConfig("mainIndicatorLegend", { indicators: {
11055
11187
  MA: {
11056
11188
  enabled: e.includes("MA"),
11057
- params: z.value.MA || {}
11189
+ params: B.value.MA || {}
11058
11190
  },
11059
11191
  BOLL: {
11060
11192
  enabled: e.includes("BOLL"),
11061
- params: z.value.BOLL || {}
11193
+ params: B.value.BOLL || {}
11062
11194
  },
11063
11195
  EXPMA: {
11064
11196
  enabled: e.includes("EXPMA"),
11065
- params: z.value.EXPMA || {}
11197
+ params: B.value.EXPMA || {}
11066
11198
  },
11067
11199
  ENE: {
11068
11200
  enabled: e.includes("ENE"),
11069
- params: z.value.ENE || {}
11201
+ params: B.value.ENE || {}
11070
11202
  }
11071
- } }), t.setRendererEnabled("ma", e.includes("MA")), t.setRendererEnabled("boll", e.includes("BOLL")), t.setRendererEnabled("expma", e.includes("EXPMA")), t.setRendererEnabled("ene", e.includes("ENE")), E());
11203
+ } }), t.setRendererEnabled("ma", e.includes("MA")), t.setRendererEnabled("boll", e.includes("BOLL")), t.setRendererEnabled("expma", e.includes("EXPMA")), t.setRendererEnabled("ene", e.includes("ENE")), D());
11072
11204
  }, { deep: !0 });
11073
- function ge() {
11205
+ function _e() {
11074
11206
  let e = C.value?.getSubPaneIndicators() ?? [];
11075
- B.value = [];
11207
+ V.value = [];
11076
11208
  for (let t of e) {
11077
- let e = `sub_${t}`, n = Vc({
11209
+ let e = `sub_${t}`, n = Wc({
11078
11210
  paneId: e,
11079
11211
  title: t,
11080
- getTitleInfo: () => ve(e)
11212
+ getTitleInfo: () => ye(e)
11081
11213
  });
11082
- C.value?.useRenderer(n), B.value.push({
11214
+ C.value?.useRenderer(n), V.value.push({
11083
11215
  id: e,
11084
11216
  indicatorId: t,
11085
11217
  rendererName: `${t.toLowerCase()}_${e}`,
11086
11218
  paneTitleRendererName: n.name,
11087
- params: de(t)
11088
- }), R.value.includes(t) || R.value.push(t);
11219
+ params: fe(t)
11220
+ }), z.value.includes(t) || z.value.push(t);
11089
11221
  }
11090
11222
  }
11091
- function _e(e, t) {
11092
- let n = B.value.find((t) => t.id === e);
11223
+ function ve(e, t) {
11224
+ let n = V.value.find((t) => t.id === e);
11093
11225
  if (!n) return;
11094
11226
  let r = n.indicatorId;
11095
- C.value?.removeRenderer(n.paneTitleRendererName), C.value?.removeSubPane(r), C.value?.createSubPane(t, de(t));
11096
- let i = `sub_${t}`, a = Vc({
11227
+ C.value?.removeRenderer(n.paneTitleRendererName), C.value?.removeSubPane(r), C.value?.createSubPane(t, fe(t));
11228
+ let i = `sub_${t}`, a = Wc({
11097
11229
  paneId: i,
11098
11230
  title: t,
11099
- getTitleInfo: () => ve(i)
11231
+ getTitleInfo: () => ye(i)
11100
11232
  });
11101
11233
  C.value?.useRenderer(a);
11102
- let o = B.value.findIndex((t) => t.id === e);
11103
- o !== -1 && (B.value[o] = {
11234
+ let o = V.value.findIndex((t) => t.id === e);
11235
+ o !== -1 && (V.value[o] = {
11104
11236
  id: i,
11105
11237
  indicatorId: t,
11106
11238
  rendererName: `${t.toLowerCase()}_${i}`,
11107
11239
  paneTitleRendererName: a.name,
11108
- params: de(t)
11109
- }), R.value = R.value.filter((e) => e !== r), R.value.includes(t) || R.value.push(t);
11240
+ params: fe(t)
11241
+ }), z.value = z.value.filter((e) => e !== r), z.value.includes(t) || z.value.push(t);
11110
11242
  }
11111
- function ve(e) {
11112
- let t = B.value.find((t) => t.id === e);
11243
+ function ye(e) {
11244
+ let t = V.value.find((t) => t.id === e);
11113
11245
  if (!t) return null;
11114
11246
  let n = C.value?.getData();
11115
11247
  if (!n || n.length === 0) return null;
@@ -11119,80 +11251,80 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11119
11251
  params: [],
11120
11252
  values: []
11121
11253
  };
11122
- let i = N.value;
11254
+ let i = P.value;
11123
11255
  if (i === null) return null;
11124
11256
  switch (t.indicatorId) {
11125
- case "MACD": return Hs(n, i, r.fastPeriod ?? 12, r.slowPeriod ?? 26, r.signalPeriod ?? 9);
11126
- case "RSI": return Gs(n, i, r.period1 ?? 6, r.period2 ?? 12, r.period3 ?? 24);
11127
- case "CCI": return Ys(n, i, r.period ?? 14);
11128
- case "STOCH": return $s(n, i, r.n ?? 9, r.m ?? 3);
11129
- case "MOM": return rc(n, i, r.period ?? 10);
11130
- case "WMSR": return sc(n, i, r.period ?? 14);
11131
- case "KST": return pc(n, i, r.roc1 ?? 10, r.roc2 ?? 15, r.roc3 ?? 20, r.roc4 ?? 30, r.signalPeriod ?? 9);
11132
- case "FASTK": return _c(n, i, r.period ?? 9);
11257
+ case "MACD": return Ws(n, i, r.fastPeriod ?? 12, r.slowPeriod ?? 26, r.signalPeriod ?? 9);
11258
+ case "RSI": return qs(n, i, r.period1 ?? 6, r.period2 ?? 12, r.period3 ?? 24);
11259
+ case "CCI": return Zs(n, i, r.period ?? 14);
11260
+ case "STOCH": return tc(n, i, r.n ?? 9, r.m ?? 3);
11261
+ case "MOM": return ac(n, i, r.period ?? 10);
11262
+ case "WMSR": return lc(n, i, r.period ?? 14);
11263
+ case "KST": return hc(n, i, r.roc1 ?? 10, r.roc2 ?? 15, r.roc3 ?? 20, r.roc4 ?? 30, r.signalPeriod ?? 9);
11264
+ case "FASTK": return yc(n, i, r.period ?? 9);
11133
11265
  default: return null;
11134
11266
  }
11135
11267
  }
11136
- function ye(e, t) {
11268
+ function be(e, t) {
11137
11269
  if (e === "MA" || e === "BOLL" || e === "EXPMA" || e === "ENE") {
11138
- t ? R.value.includes(e) || R.value.push(e) : R.value = R.value.filter((t) => t !== e);
11270
+ t ? z.value.includes(e) || z.value.push(e) : z.value = z.value.filter((t) => t !== e);
11139
11271
  return;
11140
11272
  }
11141
- if (V.includes(e)) {
11273
+ if (de.includes(e)) {
11142
11274
  if (t) {
11143
- if (R.value.includes(e) || R.value.push(e), B.value.find((t) => t.indicatorId === e)) return;
11144
- if (!fe(e)) {
11145
- let t = B.value[B.value.length - 1];
11146
- t && _e(t.id, e);
11275
+ if (z.value.includes(e) || z.value.push(e), V.value.find((t) => t.indicatorId === e)) return;
11276
+ if (!pe(e)) {
11277
+ let t = V.value[V.value.length - 1];
11278
+ t && ve(t.id, e);
11147
11279
  }
11148
- } else R.value = R.value.filter((t) => t !== e), B.value.filter((t) => t.indicatorId === e).forEach((e) => pe(e.id));
11149
- E();
11280
+ } else z.value = z.value.filter((t) => t !== e), V.value.filter((t) => t.indicatorId === e).forEach((e) => me(e.id));
11281
+ D();
11150
11282
  }
11151
11283
  }
11152
- function be() {
11284
+ function xe() {
11153
11285
  C.value?.updateRendererConfig("mainIndicatorLegend", { indicators: {
11154
11286
  MA: {
11155
- enabled: R.value.includes("MA"),
11156
- params: z.value.MA || {}
11287
+ enabled: z.value.includes("MA"),
11288
+ params: B.value.MA || {}
11157
11289
  },
11158
11290
  BOLL: {
11159
- enabled: R.value.includes("BOLL"),
11160
- params: z.value.BOLL || {}
11291
+ enabled: z.value.includes("BOLL"),
11292
+ params: B.value.BOLL || {}
11161
11293
  },
11162
11294
  EXPMA: {
11163
- enabled: R.value.includes("EXPMA"),
11164
- params: z.value.EXPMA || {}
11295
+ enabled: z.value.includes("EXPMA"),
11296
+ params: B.value.EXPMA || {}
11165
11297
  },
11166
11298
  ENE: {
11167
- enabled: R.value.includes("ENE"),
11168
- params: z.value.ENE || {}
11299
+ enabled: z.value.includes("ENE"),
11300
+ params: B.value.ENE || {}
11169
11301
  }
11170
11302
  } });
11171
11303
  }
11172
- function xe(e, t) {
11173
- if (z.value[e] = t, e === "MA" || e === "BOLL" || e === "EXPMA" || e === "ENE") {
11174
- e === "BOLL" && C.value?.updateRendererConfig("boll", t), e === "EXPMA" && C.value?.updateRendererConfig("expma", t), e === "ENE" && C.value?.updateRendererConfig("ene", t), be(), E();
11304
+ function Se(e, t) {
11305
+ if (B.value[e] = t, e === "MA" || e === "BOLL" || e === "EXPMA" || e === "ENE") {
11306
+ e === "BOLL" && C.value?.updateRendererConfig("boll", t), e === "EXPMA" && C.value?.updateRendererConfig("expma", t), e === "ENE" && C.value?.updateRendererConfig("ene", t), xe(), D();
11175
11307
  return;
11176
11308
  }
11177
- V.includes(e) && B.value.filter((t) => t.indicatorId === e).forEach((e) => {
11309
+ de.includes(e) && V.value.filter((t) => t.indicatorId === e).forEach((e) => {
11178
11310
  e.params = { ...t }, C.value?.updateRendererConfig(e.rendererName, t);
11179
- }), E();
11311
+ }), D();
11180
11312
  }
11181
- let Se = r(() => {
11182
- let e = T.value, t = window.devicePixelRatio || 1, { startXPx: r, unitPx: i } = us(b.value, x.value, t);
11313
+ let Ce = r(() => {
11314
+ let e = T.value, t = E.value, { startXPx: r, unitPx: i } = ds(b.value, x.value, t);
11183
11315
  return (r + e * i) / t + (n.rightAxisWidth + n.priceLabelWidth);
11184
11316
  });
11185
- function Ce() {
11317
+ function we() {
11186
11318
  let e = v.value;
11187
- e && (e.scrollLeft = e.scrollWidth, E());
11319
+ e && (e.scrollLeft = e.scrollWidth, D());
11188
11320
  }
11189
11321
  return t({
11190
- scheduleRender: E,
11191
- scrollToRight: Ce,
11192
- addSubPane: fe,
11193
- removeSubPane: pe,
11194
- switchSubIndicator: _e,
11195
- clearAllSubPanes: me,
11322
+ scheduleRender: D,
11323
+ scrollToRight: we,
11324
+ addSubPane: pe,
11325
+ removeSubPane: me,
11326
+ switchSubIndicator: ve,
11327
+ clearAllSubPanes: he,
11196
11328
  get plugin() {
11197
11329
  return C.value?.plugin;
11198
11330
  }
@@ -11200,10 +11332,10 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11200
11332
  let e = v.value, t = u.value, r = c.value;
11201
11333
  if (!e || !t || !r) return;
11202
11334
  let i = (e) => {
11203
- C.value?.interaction.onWheel(e), ae();
11335
+ C.value?.interaction.onWheel(e), L();
11204
11336
  };
11205
11337
  e.addEventListener("wheel", i, { passive: !1 });
11206
- let a = new yc({
11338
+ let a = new xc({
11207
11339
  container: e,
11208
11340
  canvasLayer: t,
11209
11341
  xAxisCanvas: r
@@ -11228,13 +11360,13 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11228
11360
  if (!r) return;
11229
11361
  let i = Math.max(0, r.scrollWidth - r.clientWidth);
11230
11362
  r.scrollLeft = Math.min(Math.max(0, n), i), a.applyZoom(e, t);
11231
- }), a.useRenderer(Dc()), a.useRenderer(kc()), a.useRenderer(Ts({
11363
+ }), a.useRenderer(kc()), a.useRenderer(jc()), a.useRenderer(Es({
11232
11364
  ma5: !0,
11233
11365
  ma10: !0,
11234
11366
  ma20: !0,
11235
11367
  ma30: !0,
11236
11368
  ma60: !0
11237
- })), a.useRenderer(Ds()), a.setRendererEnabled("boll", !1), a.useRenderer(js()), a.setRendererEnabled("expma", !1), a.useRenderer(Ps()), a.setRendererEnabled("ene", !1), a.useRenderer(wc()), a.useRenderer(Oc()), a.useRenderer(ya()), a.useRenderer(Lc({
11369
+ })), a.useRenderer(Os()), a.setRendererEnabled("boll", !1), a.useRenderer(Ms()), a.setRendererEnabled("expma", !1), a.useRenderer(Fs()), a.setRendererEnabled("ene", !1), a.useRenderer(Ec()), a.useRenderer(Ac()), a.useRenderer(ba()), a.useRenderer(zc({
11238
11370
  axisWidth: n.rightAxisWidth + n.priceLabelWidth,
11239
11371
  yPaddingPx: n.yPaddingPx,
11240
11372
  getCrosshair: () => {
@@ -11244,12 +11376,15 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11244
11376
  price: t
11245
11377
  } : null;
11246
11378
  }
11247
- })), a.useRenderer(Is({ yPaddingPx: n.yPaddingPx })), a.useRenderer(Bc({ getCrosshairState: () => ({
11379
+ })), a.useRenderer(Ls({ yPaddingPx: n.yPaddingPx })), a.useRenderer(Bc({
11380
+ axisWidth: n.rightAxisWidth + n.priceLabelWidth,
11381
+ paneId: "sub_MACD"
11382
+ })), a.useRenderer(Uc({ getCrosshairState: () => ({
11248
11383
  pos: a.interaction.crosshairPos,
11249
11384
  activePaneId: a.interaction.activePaneId,
11250
11385
  isDragging: a.interaction.isDraggingState(),
11251
11386
  price: a.interaction.crosshairPrice
11252
- }) })), a.useRenderer(zc({
11387
+ }) })), a.useRenderer(Hc({
11253
11388
  height: n.bottomAxisHeight,
11254
11389
  getCrosshair: () => {
11255
11390
  let e = a.interaction.crosshairPos, t = a.interaction.crosshairIndex;
@@ -11258,30 +11393,24 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11258
11393
  index: t
11259
11394
  } : null;
11260
11395
  }
11261
- })), C.value = a, a.resize(), w.value = new Wi(a), w.value.on("config:error", (e) => {
11396
+ })), a.setOnViewportChange((e) => {
11397
+ E.value = e.dpr;
11398
+ }), C.value = a, E.value = a.getCurrentDpr(), a.resize(), w.value = new Wi(a), w.value.on("config:error", (e) => {
11262
11399
  console.error("Semantic config error:", e);
11263
11400
  }), w.value.on("config:ready", () => {
11264
- T.value = a.getData()?.length ?? 0, re(), he(), ge(), d(() => Ce());
11401
+ T.value = a.getData()?.length ?? 0, ie(), ge(), _e(), d(() => we());
11265
11402
  }), w.value.applyConfig(n.semanticConfig).then((e) => {
11266
11403
  e && !e.success && console.error("Semantic config apply failed:", e.errors);
11267
11404
  }), a.interaction.setOnMarkerHover((e) => {
11268
- O.value = e, E();
11405
+ k.value = e, D();
11269
11406
  }), a.interaction.setOnCustomMarkerHover((e) => {
11270
- k.value = e, E();
11271
- });
11272
- let o = null, s = new ResizeObserver(() => {
11273
- o && clearTimeout(o), o = setTimeout(() => {
11274
- a.resize(), o = null;
11275
- }, 50);
11276
- });
11277
- s.observe(e), a.__resizeObserver = s, a.__resizeTimeout = o, a.__onWheel = i;
11407
+ A.value = e, D();
11408
+ }), a.__onWheel = i;
11278
11409
  }), h(() => {
11279
11410
  let e = C.value;
11280
11411
  if (e) {
11281
- let t = e.__resizeObserver, n = e.__resizeTimeout;
11282
- n && clearTimeout(n), t && t.disconnect();
11283
- let r = e.__onWheel, i = v.value;
11284
- r && i && i.removeEventListener("wheel", r), e.destroy();
11412
+ let t = e.__onWheel, n = v.value;
11413
+ t && n && n.removeEventListener("wheel", t), e.destroy();
11285
11414
  }
11286
11415
  C.value = null;
11287
11416
  }), S(() => [n.kWidth, n.kGap], ([e, t]) => {
@@ -11290,24 +11419,24 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11290
11419
  kGap: x.value
11291
11420
  });
11292
11421
  }), S(() => n.yPaddingPx, (e) => {
11293
- C.value?.updateOptions({ yPaddingPx: e }), E();
11422
+ C.value?.updateOptions({ yPaddingPx: e }), D();
11294
11423
  }), S(() => n.semanticConfig, async (e, t) => {
11295
11424
  if (e && e !== t) {
11296
11425
  let t = await w.value?.applyConfig(e);
11297
11426
  t && !t.success && console.error("Semantic config apply failed:", t.errors);
11298
11427
  }
11299
- }, { deep: !0 }), (e, t) => (g(), o("div", Hc, [s("div", {
11300
- class: f(["chart-container", { "is-dragging": j.value }]),
11428
+ }, { deep: !0 }), (e, t) => (g(), o("div", Gc, [s("div", {
11429
+ class: f(["chart-container", { "is-dragging": M.value }]),
11301
11430
  ref_key: "containerRef",
11302
11431
  ref: v,
11303
11432
  onScrollPassive: ue,
11304
- onPointerdown: L,
11433
+ onPointerdown: oe,
11305
11434
  onPointermove: se,
11306
11435
  onPointerup: ce,
11307
11436
  onPointerleave: le
11308
11437
  }, [s("div", {
11309
11438
  class: "scroll-content",
11310
- style: p({ width: Se.value + "px" })
11439
+ style: p({ width: Ce.value + "px" })
11311
11440
  }, [s("div", {
11312
11441
  class: "canvas-layer",
11313
11442
  ref_key: "canvasLayerRef",
@@ -11318,33 +11447,33 @@ var Hc = { class: "chart-wrapper" }, Uc = 4, Wc = /* @__PURE__ */ go(/* @__PURE_
11318
11447
  ref_key: "xAxisCanvasRef",
11319
11448
  ref: c
11320
11449
  }, null, 512),
11321
- F.value ? (g(), i(_o, {
11450
+ I.value ? (g(), i(vo, {
11322
11451
  key: 0,
11323
- k: F.value,
11324
- index: I.value,
11325
- data: ne.value,
11326
- pos: te.value,
11327
- "set-el": D
11452
+ k: I.value,
11453
+ index: te.value,
11454
+ data: re.value,
11455
+ pos: ne.value,
11456
+ "set-el": O
11328
11457
  }, null, 8, [
11329
11458
  "k",
11330
11459
  "index",
11331
11460
  "data",
11332
11461
  "pos"
11333
11462
  ])) : a("", !0),
11334
- O.value || k.value ? (g(), i(So, {
11463
+ k.value || A.value ? (g(), i(Co, {
11335
11464
  key: 1,
11336
- marker: O.value || k.value,
11337
- pos: A.value
11465
+ marker: k.value || A.value,
11466
+ pos: j.value
11338
11467
  }, null, 8, ["marker", "pos"])) : a("", !0)
11339
- ], 512)], 4)], 34), l(cs, {
11340
- "active-indicators": R.value,
11341
- "indicator-params": z.value,
11342
- onToggle: ye,
11343
- onUpdateParams: xe
11468
+ ], 512)], 4)], 34), l(ls, {
11469
+ "active-indicators": z.value,
11470
+ "indicator-params": B.value,
11471
+ onToggle: be,
11472
+ onUpdateParams: Se
11344
11473
  }, null, 8, ["active-indicators", "indicator-params"])]));
11345
11474
  }
11346
- }), [["__scopeId", "data-v-d60162bc"]]), Gc = { install(e) {
11347
- e.component("KLineChart", Wc);
11475
+ }), [["__scopeId", "data-v-d57ed432"]]), Jc = { install(e) {
11476
+ e.component("KLineChart", qc);
11348
11477
  } };
11349
11478
  //#endregion
11350
- export { ua as ConfigManager, I as EventBus, sa as GLOBAL_PANE_ID, la as HookSystem, Wc as KLineChart, Gc as KMapPlugin, da as PluginHostImpl, ca as PluginRegistry, aa as PluginState, Y as RENDERER_PRIORITY, ma as RendererPluginManager, fa as createPluginHost, oa as wrapPaneInfo };
11479
+ export { ua as ConfigManager, I as EventBus, sa as GLOBAL_PANE_ID, la as HookSystem, qc as KLineChart, Jc as KMapPlugin, fa as PluginHostImpl, ca as PluginRegistry, aa as PluginState, Y as RENDERER_PRIORITY, ha as RendererPluginManager, pa as createPluginHost, oa as wrapPaneInfo };