velo-plot 2.0.0 → 3.0.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.
Files changed (265) hide show
  1. package/README.md +15 -8
  2. package/dist/{ChartCore-BhQ4j7f5.js → ChartCore-BpzRvN4Y.js} +998 -855
  3. package/dist/ChartCore-BpzRvN4Y.js.map +1 -0
  4. package/dist/a11y-Bw6urYpr.js +105 -0
  5. package/dist/a11y-Bw6urYpr.js.map +1 -0
  6. package/dist/angular/hooks-entry.d.ts +1 -0
  7. package/dist/angular/hooks.d.ts +26 -0
  8. package/dist/angular/index.d.ts +8 -0
  9. package/dist/angular/velo-plot.component.d.ts +46 -0
  10. package/dist/angular-hooks.d.ts +1 -0
  11. package/dist/angular-hooks.js +9 -0
  12. package/dist/angular-hooks.js.map +1 -0
  13. package/dist/angular.d.ts +1 -0
  14. package/dist/angular.js +166 -0
  15. package/dist/angular.js.map +1 -0
  16. package/dist/assets/indicator.worker-bv0zC4EX.js.map +1 -1
  17. package/dist/astro/StackedPlot.astro +19 -0
  18. package/dist/astro/VeloPlot.astro +23 -0
  19. package/dist/{axisFormat-SPX-CD5s.js → axisFormat-CzumxpCL.js} +3 -3
  20. package/dist/axisFormat-CzumxpCL.js.map +1 -0
  21. package/dist/bindings/shared/a11y.d.ts +26 -0
  22. package/dist/bindings/shared/chartLifecycle.d.ts +16 -0
  23. package/dist/bindings/shared/chartSyncBridge.d.ts +8 -0
  24. package/dist/bindings/shared/dimensions.d.ts +1 -0
  25. package/dist/bindings/shared/index.d.ts +9 -0
  26. package/dist/bindings/shared/indicatorBridge.d.ts +11 -0
  27. package/dist/bindings/shared/optionsSync.d.ts +7 -0
  28. package/dist/bindings/shared/seriesDiff.d.ts +8 -0
  29. package/dist/bindings/shared/stackedSync.d.ts +9 -0
  30. package/dist/bindings/shared/types.d.ts +46 -0
  31. package/dist/bindings/test-utils/index.d.ts +35 -0
  32. package/dist/bindings/test-utils/mockLifecycle.d.ts +120 -0
  33. package/dist/bindings/test-utils/vitestSveltePlugin.d.ts +3 -0
  34. package/dist/chartSyncBridge-DbWrwtyP.js +57 -0
  35. package/dist/chartSyncBridge-DbWrwtyP.js.map +1 -0
  36. package/dist/core/Chart.d.ts +1 -1
  37. package/dist/core/InteractionManager.d.ts +7 -1
  38. package/dist/core/OverlayRenderer.d.ts +5 -0
  39. package/dist/core/annotations/types.d.ts +1 -1
  40. package/dist/core/chart/ChartAxisManager.d.ts +2 -0
  41. package/dist/core/chart/ChartCore.d.ts +17 -2
  42. package/dist/core/chart/ChartPluginBridge.d.ts +1 -0
  43. package/dist/core/chart/ChartRenderLoop.d.ts +2 -0
  44. package/dist/core/chart/ChartStateManager.d.ts +2 -0
  45. package/dist/core/chart/types.d.ts +6 -1
  46. package/dist/core/clipboard/index.d.ts +1 -1
  47. package/dist/core/debug/index.d.ts +1 -1
  48. package/dist/core/keybindings/index.d.ts +1 -1
  49. package/dist/core/loading/index.d.ts +1 -1
  50. package/dist/core/locale/index.d.ts +1 -1
  51. package/dist/core/stacked/paneResize.d.ts +3 -0
  52. package/dist/core/stacked/types.d.ts +10 -0
  53. package/dist/core/sync/index.d.ts +0 -1
  54. package/dist/core/theme-editor/index.d.ts +1 -1
  55. package/dist/createStackedChart-Dm-YqUT7.js +756 -0
  56. package/dist/createStackedChart-Dm-YqUT7.js.map +1 -0
  57. package/dist/examples/PluginDemonstration.d.ts +1 -1
  58. package/dist/gpuRenderer-BpaMYz-k.js.map +1 -1
  59. package/dist/hooks-CYPCxoZx.js +69 -0
  60. package/dist/hooks-CYPCxoZx.js.map +1 -0
  61. package/dist/{index-D7dTq6VB.js → index-0InEyj0q.js} +130 -134
  62. package/dist/index-0InEyj0q.js.map +1 -0
  63. package/dist/index-BMiZoKmm.js.map +1 -1
  64. package/dist/{index-DoYxf1cV.js → index-CWxIHdwX.js} +38 -98
  65. package/dist/index-CWxIHdwX.js.map +1 -0
  66. package/dist/{index-CUGS98p4.js → index-CaXWSOTk.js} +3 -6
  67. package/dist/index-CaXWSOTk.js.map +1 -0
  68. package/dist/index-Dag88bW4.js.map +1 -1
  69. package/dist/index-qhscKTDy.js.map +1 -1
  70. package/dist/{index-CWipqOLP.js → index-qunX30Xu.js} +2 -2
  71. package/dist/index-qunX30Xu.js.map +1 -0
  72. package/dist/index-x4stH3jD.js.map +1 -1
  73. package/dist/{index.core-fpZ1dYN0.js → index.core-BmZe2jRQ.js} +30 -29
  74. package/dist/index.core-BmZe2jRQ.js.map +1 -0
  75. package/dist/index.core.d.ts +1 -1
  76. package/dist/index.d.ts +3 -3
  77. package/dist/indicators--eJGmVox.js.map +1 -1
  78. package/dist/{mockDatafeed-Cdg5hKEo.js → mockDatafeed-DHIDPcpX.js} +150 -146
  79. package/dist/mockDatafeed-DHIDPcpX.js.map +1 -0
  80. package/dist/optionsSync-QUiN4Inw.js +119 -0
  81. package/dist/optionsSync-QUiN4Inw.js.map +1 -0
  82. package/dist/plugins/3d/index.d.ts +2 -2
  83. package/dist/plugins/3d.d.ts +2 -2
  84. package/dist/plugins/3d.js.map +1 -1
  85. package/dist/plugins/analysis/contours.d.ts +31 -0
  86. package/dist/plugins/analysis/index.d.ts +1 -1
  87. package/dist/plugins/analysis/indicators.d.ts +1 -1
  88. package/dist/plugins/analysis.d.ts +2 -2
  89. package/dist/plugins/analysis.js +495 -408
  90. package/dist/plugins/analysis.js.map +1 -1
  91. package/dist/plugins/annotations/index.d.ts +1 -1
  92. package/dist/plugins/annotations.d.ts +2 -2
  93. package/dist/plugins/annotations.js.map +1 -1
  94. package/dist/plugins/anomaly-detection.js +1 -1
  95. package/dist/plugins/anomaly-detection.js.map +1 -1
  96. package/dist/plugins/broken-axis.d.ts +2 -2
  97. package/dist/plugins/broken-axis.js +170 -181
  98. package/dist/plugins/broken-axis.js.map +1 -1
  99. package/dist/plugins/builtins/crosshair/CrosshairPlugin.d.ts +1 -1
  100. package/dist/plugins/builtins/index.d.ts +1 -1
  101. package/dist/plugins/caching.d.ts +2 -2
  102. package/dist/plugins/clipboard/index.d.ts +2 -2
  103. package/dist/plugins/clipboard.d.ts +2 -2
  104. package/dist/plugins/clipboard.js.map +1 -1
  105. package/dist/plugins/context-menu/index.d.ts +1 -1
  106. package/dist/plugins/context-menu.d.ts +2 -2
  107. package/dist/plugins/context-menu.js +1 -1
  108. package/dist/plugins/context-menu.js.map +1 -1
  109. package/dist/plugins/data-export/index.d.ts +1 -1
  110. package/dist/plugins/data-export.d.ts +2 -2
  111. package/dist/plugins/data-export.js +2 -2
  112. package/dist/plugins/data-export.js.map +1 -1
  113. package/dist/plugins/data-transform.d.ts +2 -2
  114. package/dist/plugins/data-transform.js +19 -19
  115. package/dist/plugins/data-transform.js.map +1 -1
  116. package/dist/plugins/debug/index.d.ts +2 -2
  117. package/dist/plugins/debug.d.ts +2 -2
  118. package/dist/plugins/debug.js +2 -2
  119. package/dist/plugins/debug.js.map +1 -1
  120. package/dist/plugins/forecasting/algorithms.d.ts +7 -2
  121. package/dist/plugins/forecasting/index.d.ts +1 -1
  122. package/dist/plugins/forecasting/types.d.ts +13 -3
  123. package/dist/plugins/forecasting.js +355 -175
  124. package/dist/plugins/forecasting.js.map +1 -1
  125. package/dist/plugins/gpu/index.d.ts +2 -2
  126. package/dist/plugins/gpu.d.ts +2 -2
  127. package/dist/plugins/gpu.js.map +1 -1
  128. package/dist/plugins/i18n/index.d.ts +2 -2
  129. package/dist/plugins/i18n.d.ts +2 -2
  130. package/dist/plugins/i18n.js.map +1 -1
  131. package/dist/plugins/index.d.ts +1 -1
  132. package/dist/plugins/keyboard.d.ts +2 -2
  133. package/dist/plugins/keyboard.js +65 -5
  134. package/dist/plugins/keyboard.js.map +1 -1
  135. package/dist/plugins/latex/symbols.d.ts +50 -0
  136. package/dist/plugins/latex/types.d.ts +13 -1
  137. package/dist/plugins/latex.js +351 -331
  138. package/dist/plugins/latex.js.map +1 -1
  139. package/dist/plugins/lazy-load.d.ts +2 -2
  140. package/dist/plugins/loading/index.d.ts +1 -1
  141. package/dist/plugins/loading.d.ts +2 -2
  142. package/dist/plugins/ml-integration/native-algorithms.d.ts +24 -4
  143. package/dist/plugins/ml-integration/types.d.ts +19 -0
  144. package/dist/plugins/ml-integration.d.ts +2 -2
  145. package/dist/plugins/ml-integration.js +190 -139
  146. package/dist/plugins/ml-integration.js.map +1 -1
  147. package/dist/plugins/offscreen.d.ts +2 -2
  148. package/dist/plugins/pattern-recognition/types.d.ts +28 -1
  149. package/dist/plugins/pattern-recognition.d.ts +2 -2
  150. package/dist/plugins/pattern-recognition.js +417 -344
  151. package/dist/plugins/pattern-recognition.js.map +1 -1
  152. package/dist/plugins/radar.d.ts +2 -2
  153. package/dist/plugins/regression.d.ts +2 -2
  154. package/dist/plugins/regression.js +1 -1
  155. package/dist/plugins/regression.js.map +1 -1
  156. package/dist/plugins/roi.js +9 -9
  157. package/dist/plugins/roi.js.map +1 -1
  158. package/dist/plugins/snapshot/index.d.ts +1 -1
  159. package/dist/plugins/snapshot/types.d.ts +1 -1
  160. package/dist/plugins/snapshot.d.ts +2 -2
  161. package/dist/plugins/snapshot.js +36 -36
  162. package/dist/plugins/snapshot.js.map +1 -1
  163. package/dist/plugins/streaming/index.d.ts +2 -2
  164. package/dist/plugins/streaming.d.ts +2 -2
  165. package/dist/plugins/sync/index.d.ts +3 -2
  166. package/dist/plugins/sync.d.ts +2 -2
  167. package/dist/plugins/sync.js +1 -1
  168. package/dist/plugins/sync.js.map +1 -1
  169. package/dist/plugins/theme-editor/index.d.ts +1 -1
  170. package/dist/plugins/theme-editor.d.ts +2 -2
  171. package/dist/plugins/tools/index.d.ts +1 -1
  172. package/dist/plugins/tools/tooltip/index.d.ts +1 -1
  173. package/dist/plugins/tools.d.ts +2 -2
  174. package/dist/plugins/tools.js +1 -1
  175. package/dist/plugins/types.d.ts +1 -1
  176. package/dist/plugins/video-recorder.d.ts +2 -2
  177. package/dist/plugins/virtualization.d.ts +2 -2
  178. package/dist/plugins/virtualization.js +1 -1
  179. package/dist/pool-DZ8shSqv.js +109 -0
  180. package/dist/pool-DZ8shSqv.js.map +1 -0
  181. package/dist/react/StackedPlot.d.ts +31 -0
  182. package/dist/react/VeloPlot.d.ts +29 -0
  183. package/dist/react/index.d.ts +25 -3
  184. package/dist/react/useChartSync.d.ts +8 -0
  185. package/dist/react/useIndicator.d.ts +12 -0
  186. package/dist/react/useVeloPlot.d.ts +19 -0
  187. package/dist/react.js +328 -24
  188. package/dist/react.js.map +1 -1
  189. package/dist/scientific/index.d.ts +48 -0
  190. package/dist/scientific.d.ts +1 -0
  191. package/dist/scientific.js +91 -0
  192. package/dist/scientific.js.map +1 -0
  193. package/dist/solid/VeloPlot.d.ts +16 -0
  194. package/dist/solid/index.d.ts +13 -0
  195. package/dist/solid/useChartSync.d.ts +6 -0
  196. package/dist/solid/useIndicator.d.ts +11 -0
  197. package/dist/solid/useStackedPlot.d.ts +14 -0
  198. package/dist/solid/useVeloPlot.d.ts +18 -0
  199. package/dist/solid.d.ts +1 -0
  200. package/dist/solid.js +172 -0
  201. package/dist/solid.js.map +1 -0
  202. package/dist/stackedSync-tnrunZMt.js +100 -0
  203. package/dist/stackedSync-tnrunZMt.js.map +1 -0
  204. package/dist/svelte/StackedPlot.svelte +29 -0
  205. package/dist/svelte/StackedPlot.test.ts +114 -0
  206. package/dist/svelte/VeloPlot.svelte +44 -0
  207. package/dist/svelte/VeloPlot.test.ts +105 -0
  208. package/dist/svelte/index.d.ts +11 -0
  209. package/dist/svelte/index.test.ts +20 -0
  210. package/dist/svelte/index.ts +15 -0
  211. package/dist/svelte/useChartSync.d.ts +8 -0
  212. package/dist/svelte/useChartSync.test.ts +49 -0
  213. package/dist/svelte/useChartSync.ts +29 -0
  214. package/dist/svelte/useIndicator.d.ts +13 -0
  215. package/dist/svelte/useIndicator.test.ts +67 -0
  216. package/dist/svelte/useIndicator.ts +43 -0
  217. package/dist/svelte/useStackedPlot.d.ts +16 -0
  218. package/dist/svelte/useStackedPlot.test.ts +76 -0
  219. package/dist/svelte/useStackedPlot.ts +54 -0
  220. package/dist/svelte/useVeloPlot.d.ts +21 -0
  221. package/dist/svelte/useVeloPlot.test.ts +100 -0
  222. package/dist/svelte/useVeloPlot.ts +81 -0
  223. package/dist/svelte.d.ts +1 -0
  224. package/dist/svelte.js +143 -0
  225. package/dist/svelte.js.map +1 -0
  226. package/dist/symbols-DT0eLlpW.js +568 -0
  227. package/dist/symbols-DT0eLlpW.js.map +1 -0
  228. package/dist/testing/index.d.ts +1 -1
  229. package/dist/theme/index.d.ts +2 -1
  230. package/dist/trading.js +7 -7
  231. package/dist/types.d.ts +1 -1
  232. package/dist/{utils-BK5UUXxj.js → utils-Dx0h0bgQ.js} +9 -9
  233. package/dist/{utils-BK5UUXxj.js.map → utils-Dx0h0bgQ.js.map} +1 -1
  234. package/dist/velo-plot.full.js +444 -433
  235. package/dist/velo-plot.full.js.map +1 -1
  236. package/dist/velo-plot.js +15 -15
  237. package/dist/vue/StackedPlot.vue.d.ts +48 -0
  238. package/dist/vue/VeloPlot.vue.d.ts +64 -0
  239. package/dist/vue/index.d.ts +250 -0
  240. package/dist/vue/useChartSync.d.ts +52 -0
  241. package/dist/vue/useIndicator.d.ts +23 -0
  242. package/dist/vue/useStackedPlot.d.ts +15 -0
  243. package/dist/vue/useVeloPlot.d.ts +20 -0
  244. package/dist/vue.d.ts +1 -0
  245. package/dist/vue.js +312 -0
  246. package/dist/vue.js.map +1 -0
  247. package/dist/workers/indicatorsAsync.d.ts +26 -0
  248. package/dist/workers/pool.d.ts +9 -0
  249. package/package.json +88 -10
  250. package/dist/ChartCore-BhQ4j7f5.js.map +0 -1
  251. package/dist/SciPlot-GJvw7GJo.js +0 -463
  252. package/dist/SciPlot-GJvw7GJo.js.map +0 -1
  253. package/dist/axisFormat-SPX-CD5s.js.map +0 -1
  254. package/dist/createStackedChart-DJSmqerD.js +0 -706
  255. package/dist/createStackedChart-DJSmqerD.js.map +0 -1
  256. package/dist/index-CUGS98p4.js.map +0 -1
  257. package/dist/index-CWipqOLP.js.map +0 -1
  258. package/dist/index-D7dTq6VB.js.map +0 -1
  259. package/dist/index-DoYxf1cV.js.map +0 -1
  260. package/dist/index.core-fpZ1dYN0.js.map +0 -1
  261. package/dist/mockDatafeed-Cdg5hKEo.js.map +0 -1
  262. package/dist/pool-15HMCNv8.js +0 -88
  263. package/dist/pool-15HMCNv8.js.map +0 -1
  264. package/dist/react/SciPlot.d.ts +0 -60
  265. package/dist/react/useSciPlot.d.ts +0 -56
@@ -1,14 +1,15 @@
1
- var ct = Object.defineProperty;
2
- var ut = (i, e, t) => e in i ? ct(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var m = (i, e, t) => ut(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { g as qe, h as Ge, a as je, c as Ze, E as dt } from "./axisFormat-SPX-CD5s.js";
5
- import { G as ft } from "./gpuRenderer-BpaMYz-k.js";
1
+ var gt = Object.defineProperty;
2
+ var yt = (i, e, t) => e in i ? gt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var m = (i, e, t) => yt(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { g as je, h as Ze, a as Qe, c as Je, E as mt } from "./axisFormat-CzumxpCL.js";
5
+ import { G as pt } from "./gpuRenderer-BpaMYz-k.js";
6
6
  import "./index-x4stH3jD.js";
7
- import { P as gt } from "./index-qhscKTDy.js";
8
- import { f as yt, m as mt, e as pt, s as xt, r as bt, a as vt } from "./indicators--eJGmVox.js";
9
- import { n as wt, W as St } from "./pool-15HMCNv8.js";
7
+ import { P as xt } from "./index-qhscKTDy.js";
8
+ import "./symbols-DT0eLlpW.js";
9
+ import { f as bt, m as vt, e as wt, s as Mt, r as St, a as Ct } from "./indicators--eJGmVox.js";
10
+ import { n as At, W as kt } from "./pool-DZ8shSqv.js";
10
11
  const ae = { top: 20, right: 30, bottom: 55, left: 75 };
11
- class Mt {
12
+ class Pt {
12
13
  constructor(e) {
13
14
  m(this, "buffers", /* @__PURE__ */ new Map());
14
15
  m(this, "bufferSizes", /* @__PURE__ */ new Map());
@@ -40,7 +41,7 @@ class Mt {
40
41
  this.buffers.forEach((e) => this.gl.deleteBuffer(e)), this.buffers.clear(), this.bufferSizes.clear();
41
42
  }
42
43
  }
43
- const Ct = `
44
+ const Tt = `
44
45
  precision highp float;
45
46
  attribute vec2 position;
46
47
  uniform vec2 uScale;
@@ -50,14 +51,14 @@ void main() {
50
51
  vec2 pos = position * uScale + uTranslate;
51
52
  gl_Position = vec4(pos, 0.0, 1.0);
52
53
  }
53
- `, At = `
54
+ `, Bt = `
54
55
  precision highp float;
55
56
  uniform vec4 uColor;
56
57
 
57
58
  void main() {
58
59
  gl_FragColor = uColor;
59
60
  }
60
- `, Pt = `
61
+ `, It = `
61
62
  precision highp float;
62
63
  attribute vec2 position;
63
64
  uniform vec2 uScale;
@@ -69,7 +70,7 @@ void main() {
69
70
  gl_Position = vec4(pos, 0.0, 1.0);
70
71
  gl_PointSize = uPointSize;
71
72
  }
72
- `, kt = `
73
+ `, Et = `
73
74
  precision highp float;
74
75
  uniform vec4 uColor;
75
76
  uniform int uSymbol;
@@ -150,7 +151,7 @@ void main() {
150
151
  float alpha = 1.0 - smoothstep(0.0, 0.02, d);
151
152
  gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);
152
153
  }
153
- `, Bt = `
154
+ `, Rt = `
154
155
  precision highp float;
155
156
  attribute vec2 aPosition;
156
157
  attribute float aValue;
@@ -162,7 +163,7 @@ void main() {
162
163
  gl_Position = vec4(aPosition * uScale + uTranslate, 0.0, 1.0);
163
164
  vValue = aValue;
164
165
  }
165
- `, Tt = `
166
+ `, Dt = `
166
167
  precision highp float;
167
168
  varying float vValue;
168
169
  uniform float uMinValue;
@@ -176,7 +177,7 @@ void main() {
176
177
  gl_FragColor = texture2D(uColormap, vec2(t, 0.5));
177
178
  }
178
179
  `;
179
- function Le(i, e, t) {
180
+ function ze(i, e, t) {
180
181
  const n = i.createShader(t);
181
182
  if (!n) throw new Error("Failed to create shader");
182
183
  if (i.shaderSource(n, e), i.compileShader(n), !i.getShaderParameter(n, i.COMPILE_STATUS)) {
@@ -185,8 +186,8 @@ function Le(i, e, t) {
185
186
  }
186
187
  return n;
187
188
  }
188
- function Ce(i, e, t, n) {
189
- const s = Le(i, e, i.VERTEX_SHADER), o = Le(i, t, i.FRAGMENT_SHADER), r = i.createProgram();
189
+ function Ae(i, e, t, n) {
190
+ const s = ze(i, e, i.VERTEX_SHADER), o = ze(i, t, i.FRAGMENT_SHADER), r = i.createProgram();
190
191
  if (!r) throw new Error("Failed to create program");
191
192
  if (i.attachShader(r, s), i.attachShader(r, o), i.linkProgram(r), !i.getProgramParameter(r, i.LINK_STATUS)) {
192
193
  const a = i.getProgramInfoLog(r);
@@ -213,11 +214,11 @@ function Ce(i, e, t, n) {
213
214
  }
214
215
  };
215
216
  }
216
- function It(i) {
217
+ function Ft(i) {
217
218
  return {
218
- lineProgram: Ce(i, Ct, At, "line"),
219
- pointProgram: Ce(i, Pt, kt, "point"),
220
- heatmapProgram: Ce(i, Bt, Tt, "heatmap")
219
+ lineProgram: Ae(i, Tt, Bt, "line"),
220
+ pointProgram: Ae(i, It, Et, "point"),
221
+ heatmapProgram: Ae(i, Rt, Dt, "heatmap")
221
222
  };
222
223
  }
223
224
  function _(i) {
@@ -244,14 +245,14 @@ function _(i) {
244
245
  }
245
246
  return [1, 0, 1, 1];
246
247
  }
247
- function Et(i, e = !0) {
248
- const [t, n, s, o] = _(i), [r, a, l] = Rt(t, n, s), h = (r + 0.12) % 1, d = Math.min(1, a + 0.4);
248
+ function Lt(i, e = !0) {
249
+ const [t, n, s, o] = _(i), [r, a, l] = zt(t, n, s), h = (r + 0.12) % 1, d = Math.min(1, a + 0.4);
249
250
  let c;
250
251
  e ? c = l < 0.4 ? 0.8 : Math.min(0.95, l + 0.2) : c = l > 0.6 ? 0.25 : Math.max(0.1, l - 0.2), c = Math.max(0.15, Math.min(0.9, c));
251
- const [f, u, g] = Ft(h, d, c), y = Math.round(f * 255), x = Math.round(u * 255), b = Math.round(g * 255);
252
+ const [f, u, g] = Ot(h, d, c), y = Math.round(f * 255), x = Math.round(u * 255), b = Math.round(g * 255);
252
253
  return o < 1 ? `rgba(${y}, ${x}, ${b}, ${o})` : `rgb(${y}, ${x}, ${b})`;
253
254
  }
254
- function Rt(i, e, t) {
255
+ function zt(i, e, t) {
255
256
  const n = Math.max(i, e, t), s = Math.min(i, e, t);
256
257
  let o = 0, r = 0, a = (n + s) / 2;
257
258
  if (n !== s) {
@@ -271,7 +272,7 @@ function Rt(i, e, t) {
271
272
  }
272
273
  return [o, r, a];
273
274
  }
274
- function Ft(i, e, t) {
275
+ function Ot(i, e, t) {
275
276
  let n, s, o;
276
277
  if (e === 0)
277
278
  n = s = o = t;
@@ -281,16 +282,16 @@ function Ft(i, e, t) {
281
282
  }
282
283
  return [n, s, o];
283
284
  }
284
- function Qe(i, e) {
285
+ function Ke(i, e) {
285
286
  const t = Math.min(i.length, e.length), n = new Float32Array(t * 2);
286
287
  for (let s = 0; s < t; s++)
287
288
  n[s * 2] = i[s], n[s * 2 + 1] = e[s];
288
289
  return n;
289
290
  }
290
- function Dt(i, e, t = "after") {
291
+ function Yt(i, e, t = "after") {
291
292
  const n = Math.min(i.length, e.length);
292
293
  if (n < 2)
293
- return Qe(i, e);
294
+ return Ke(i, e);
294
295
  const s = t === "center" ? 1 + (n - 1) * 3 : n * 2 - 1, o = new Float32Array(s * 2);
295
296
  let r = 0;
296
297
  for (let a = 0; a < n; a++)
@@ -309,7 +310,7 @@ function Dt(i, e, t = "after") {
309
310
  }
310
311
  return o.subarray(0, r);
311
312
  }
312
- function Je(i, e, t) {
313
+ function et(i, e, t) {
313
314
  const n = Math.min(i.length, e.length, t.length), s = new Float32Array(n * 2 * 2);
314
315
  for (let o = 0; o < n; o++) {
315
316
  const r = o * 4, a = i[o];
@@ -317,7 +318,7 @@ function Je(i, e, t) {
317
318
  }
318
319
  return s;
319
320
  }
320
- function Lt(i, e, t, n) {
321
+ function $t(i, e, t, n) {
321
322
  const s = i.length;
322
323
  let o = 0;
323
324
  t && o++, n && o++;
@@ -336,7 +337,7 @@ function Lt(i, e, t, n) {
336
337
  }
337
338
  return r.subarray(0, a);
338
339
  }
339
- function zt(i, e, t, n, s, o, r) {
340
+ function _t(i, e, t, n, s, o, r) {
340
341
  const a = i.length, l = r / 2, h = new Float32Array(a * 20), d = new Float32Array(a * 12);
341
342
  let c = 0, f = 0;
342
343
  for (let u = 0; u < a; u++) {
@@ -345,15 +346,15 @@ function zt(i, e, t, n, s, o, r) {
345
346
  }
346
347
  return { lines: h, boxes: d };
347
348
  }
348
- function Ot(i, e, t, n) {
349
+ function Vt(i, e, t, n) {
349
350
  const s = i.length, o = t / 2, r = new Float32Array(s * 12), a = new Float32Array(s * 12), l = new Float32Array(s * 12), h = new Float32Array((s - 1) * 4);
350
351
  let d = 0, c = 0, f = 0, u = 0, g = 0;
351
352
  for (let y = 0; y < s; y++) {
352
353
  const x = i[y], b = e[y], w = (n == null ? void 0 : n[y]) ?? !1;
353
354
  let p, v;
354
355
  if (w ? (p = 0, v = g, l[f++] = x - o, l[f++] = p, l[f++] = x + o, l[f++] = p, l[f++] = x + o, l[f++] = v, l[f++] = x - o, l[f++] = p, l[f++] = x + o, l[f++] = v, l[f++] = x - o, l[f++] = v) : (p = g, v = g + b, g = v, b >= 0 ? (r[d++] = x - o, r[d++] = p, r[d++] = x + o, r[d++] = p, r[d++] = x + o, r[d++] = v, r[d++] = x - o, r[d++] = p, r[d++] = x + o, r[d++] = v, r[d++] = x - o, r[d++] = v) : (a[c++] = x - o, a[c++] = v, a[c++] = x + o, a[c++] = v, a[c++] = x + o, a[c++] = p, a[c++] = x - o, a[c++] = v, a[c++] = x + o, a[c++] = p, a[c++] = x - o, a[c++] = p)), y < s - 1) {
355
- const S = i[y + 1];
356
- h[u++] = x + o, h[u++] = v, h[u++] = S - o, h[u++] = v;
356
+ const M = i[y + 1];
357
+ h[u++] = x + o, h[u++] = v, h[u++] = M - o, h[u++] = v;
357
358
  }
358
359
  }
359
360
  return {
@@ -366,21 +367,21 @@ function Ot(i, e, t, n) {
366
367
  subtotalCount: f / 2
367
368
  };
368
369
  }
369
- function $t(i, e = !1) {
370
+ function Xt(i, e = !1) {
370
371
  const t = i.xMax - i.xMin, n = i.yMax - i.yMin, s = t > 0 ? (e ? -2 : 2) / t : 1, o = n > 0 ? 2 / n : 1, r = e ? 1 - i.xMin * s : -1 - i.xMin * s, a = -1 - i.yMin * o;
371
372
  return {
372
373
  scale: [s, o],
373
374
  translate: [r, a]
374
375
  };
375
376
  }
376
- function ye(i, e, t, n, s, o, r = 1) {
377
+ function xe(i, e, t, n, s, o, r = 1) {
377
378
  i.useProgram(e.program), i.lineWidth(r), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
378
379
  e.uniforms.uTranslate,
379
380
  s.translate[0],
380
381
  s.translate[1]
381
382
  ), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.LINE_STRIP, 0, n), i.disableVertexAttribArray(e.attributes.position);
382
383
  }
383
- function Yt(i, e, t, n, s, o) {
384
+ function Wt(i, e, t, n, s, o) {
384
385
  i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
385
386
  e.uniforms.uTranslate,
386
387
  s.translate[0],
@@ -389,7 +390,7 @@ function Yt(i, e, t, n, s, o) {
389
390
  const r = o[3] * 0.4;
390
391
  i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], r), i.drawArrays(i.TRIANGLE_STRIP, 0, n), i.disableVertexAttribArray(e.attributes.position);
391
392
  }
392
- function Ae(i, e, t, n, s, o, r, a = "circle") {
393
+ function ke(i, e, t, n, s, o, r, a = "circle") {
393
394
  if (i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
394
395
  e.uniforms.uTranslate,
395
396
  s.translate[0],
@@ -409,28 +410,28 @@ function Ae(i, e, t, n, s, o, r, a = "circle") {
409
410
  }
410
411
  i.drawArrays(i.POINTS, 0, n), i.disableVertexAttribArray(e.attributes.position);
411
412
  }
412
- function _t(i, e, t, n, s, o = { min: 0, max: 1 }, r) {
413
+ function Nt(i, e, t, n, s, o = { min: 0, max: 1 }, r) {
413
414
  i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 12, 0), e.attributes.value !== void 0 && e.attributes.value !== -1 && (i.enableVertexAttribArray(e.attributes.value), i.vertexAttribPointer(e.attributes.value, 1, i.FLOAT, !1, 12, 8)), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
414
415
  e.uniforms.uTranslate,
415
416
  s.translate[0],
416
417
  s.translate[1]
417
418
  ), e.uniforms.uMinValue && i.uniform1f(e.uniforms.uMinValue, o.min), e.uniforms.uMaxValue && i.uniform1f(e.uniforms.uMaxValue, o.max), r && e.uniforms.uColormap ? (i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, r), i.uniform1i(e.uniforms.uColormap, 0)) : e.uniforms.uColormap && (i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, null)), i.drawArrays(i.TRIANGLES, 0, n), i.disableVertexAttribArray(e.attributes.position), e.attributes.value !== void 0 && e.attributes.value !== -1 && i.disableVertexAttribArray(e.attributes.value);
418
419
  }
419
- function Vt(i, e, t, n, s, o) {
420
+ function Ht(i, e, t, n, s, o) {
420
421
  i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
421
422
  e.uniforms.uTranslate,
422
423
  s.translate[0],
423
424
  s.translate[1]
424
425
  ), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.TRIANGLES, 0, n), i.disableVertexAttribArray(e.attributes.position);
425
426
  }
426
- function Wt(i, e, t, n, s, o, r = 1) {
427
+ function Ut(i, e, t, n, s, o, r = 1) {
427
428
  i.useProgram(e.program), i.lineWidth(r), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
428
429
  e.uniforms.uTranslate,
429
430
  s.translate[0],
430
431
  s.translate[1]
431
432
  ), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.LINES, 0, n), i.disableVertexAttribArray(e.attributes.position);
432
433
  }
433
- function Xt(i, e, t, n, s) {
434
+ function qt(i, e, t, n, s) {
434
435
  const o = Be(s);
435
436
  i.useProgram(e.line.program), i.bindBuffer(i.ARRAY_BUFFER, t.boxBuffer), i.enableVertexAttribArray(e.line.attributes.position), i.vertexAttribPointer(e.line.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.line.uniforms.uScale, n.scale[0], n.scale[1]), i.uniform2f(
436
437
  e.line.uniforms.uTranslate,
@@ -444,7 +445,7 @@ function Be(i) {
444
445
  const e = _(i.color ?? "#ff0055");
445
446
  return e[3] = i.opacity ?? 1, e;
446
447
  }
447
- function Nt(i, e, t, n, s, o) {
448
+ function Gt(i, e, t, n, s, o) {
448
449
  const { bounds: r, backgroundColor: a = [0.1, 0.1, 0.18, 1], plotArea: l } = o, h = e.height, d = e.width, c = l ? {
449
450
  x: l.x * t,
450
451
  y: h - (l.y + l.height) * t,
@@ -467,7 +468,7 @@ function Nt(i, e, t, n, s, o) {
467
468
  o.plotAreaBackground[2],
468
469
  o.plotAreaBackground[3]
469
470
  ), i.clear(i.COLOR_BUFFER_BIT));
470
- const f = $t(r, o.invertX);
471
+ const f = Xt(r, o.invertX);
471
472
  for (const u of s) {
472
473
  if (!u.visible || u.count === 0 && u.type !== "boxplot" && u.type !== "waterfall") continue;
473
474
  const g = u.yBounds ? u.yBounds.min : r.yMin, x = (u.yBounds ? u.yBounds.max : r.yMax) - g, b = x > 0 ? 2 / x : 1, w = -1 - g * b, p = {
@@ -475,7 +476,7 @@ function Nt(i, e, t, n, s, o) {
475
476
  translate: [f.translate[0], w]
476
477
  }, v = Be(u.style);
477
478
  if (u.type === "scatter")
478
- Ae(
479
+ ke(
479
480
  i,
480
481
  n.pointProgram,
481
482
  u.buffer,
@@ -486,7 +487,7 @@ function Nt(i, e, t, n, s, o) {
486
487
  u.style.symbol
487
488
  );
488
489
  else if (u.type === "line")
489
- ye(
490
+ xe(
490
491
  i,
491
492
  n.lineProgram,
492
493
  u.buffer,
@@ -496,7 +497,7 @@ function Nt(i, e, t, n, s, o) {
496
497
  (u.style.width ?? 1) * t
497
498
  );
498
499
  else if (u.type === "line+scatter")
499
- ye(
500
+ xe(
500
501
  i,
501
502
  n.lineProgram,
502
503
  u.buffer,
@@ -504,7 +505,7 @@ function Nt(i, e, t, n, s, o) {
504
505
  p,
505
506
  v,
506
507
  (u.style.width ?? 1) * t
507
- ), Ae(
508
+ ), ke(
508
509
  i,
509
510
  n.pointProgram,
510
511
  u.buffer,
@@ -515,7 +516,7 @@ function Nt(i, e, t, n, s, o) {
515
516
  u.style.symbol
516
517
  );
517
518
  else if (u.type === "step" || u.type === "step+scatter")
518
- u.stepBuffer && u.stepCount ? ye(
519
+ u.stepBuffer && u.stepCount ? xe(
519
520
  i,
520
521
  n.lineProgram,
521
522
  u.stepBuffer,
@@ -523,7 +524,7 @@ function Nt(i, e, t, n, s, o) {
523
524
  p,
524
525
  v,
525
526
  (u.style.width ?? 1) * t
526
- ) : ye(
527
+ ) : xe(
527
528
  i,
528
529
  n.lineProgram,
529
530
  u.buffer,
@@ -531,7 +532,7 @@ function Nt(i, e, t, n, s, o) {
531
532
  p,
532
533
  v,
533
534
  (u.style.width ?? 1) * t
534
- ), u.type === "step+scatter" && Ae(
535
+ ), u.type === "step+scatter" && ke(
535
536
  i,
536
537
  n.pointProgram,
537
538
  u.buffer,
@@ -542,7 +543,7 @@ function Nt(i, e, t, n, s, o) {
542
543
  u.style.symbol
543
544
  );
544
545
  else if (u.type === "band")
545
- Yt(
546
+ Wt(
546
547
  i,
547
548
  n.lineProgram,
548
549
  u.buffer,
@@ -551,7 +552,7 @@ function Nt(i, e, t, n, s, o) {
551
552
  v
552
553
  );
553
554
  else if (u.type === "heatmap")
554
- _t(
555
+ Nt(
555
556
  i,
556
557
  n.heatmapProgram,
557
558
  u.buffer,
@@ -561,7 +562,7 @@ function Nt(i, e, t, n, s, o) {
561
562
  u.colormapTexture
562
563
  );
563
564
  else if (u.type === "bar")
564
- Vt(
565
+ Ht(
565
566
  i,
566
567
  n.lineProgram,
567
568
  u.buffer,
@@ -570,7 +571,7 @@ function Nt(i, e, t, n, s, o) {
570
571
  v
571
572
  );
572
573
  else if (u.type === "boxplot")
573
- u.boxBuffer && u.boxLinesBuffer && Xt(
574
+ u.boxBuffer && u.boxLinesBuffer && qt(
574
575
  i,
575
576
  { line: n.lineProgram, point: n.pointProgram },
576
577
  {
@@ -583,24 +584,24 @@ function Nt(i, e, t, n, s, o) {
583
584
  u.style
584
585
  );
585
586
  else if (u.type === "waterfall") {
586
- const S = _(u.style.positiveColor || "#22c55e"), M = _(u.style.negativeColor || "#ef4444"), A = _(u.style.subtotalColor || "#3b82f6"), k = _(u.style.connectorColor || "#64748b");
587
- u.wfPositiveBuffer && u.wfPositiveCount && u.wfPositiveCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfPositiveBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, S[0], S[1], S[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfPositiveCount)), u.wfNegativeBuffer && u.wfNegativeCount && u.wfNegativeCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfNegativeBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, M[0], M[1], M[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfNegativeCount)), u.wfSubtotalBuffer && u.wfSubtotalCount && u.wfSubtotalCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfSubtotalBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, A[0], A[1], A[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfSubtotalCount)), u.style.showConnectors !== !1 && u.wfConnectorBuffer && u.wfConnectorCount && u.wfConnectorCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfConnectorBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, k[0], k[1], k[2], 0.6), i.lineWidth(1), i.drawArrays(i.LINES, 0, u.wfConnectorCount)), i.disableVertexAttribArray(n.lineProgram.attributes.position);
587
+ const M = _(u.style.positiveColor || "#22c55e"), S = _(u.style.negativeColor || "#ef4444"), A = _(u.style.subtotalColor || "#3b82f6"), P = _(u.style.connectorColor || "#64748b");
588
+ u.wfPositiveBuffer && u.wfPositiveCount && u.wfPositiveCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfPositiveBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, M[0], M[1], M[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfPositiveCount)), u.wfNegativeBuffer && u.wfNegativeCount && u.wfNegativeCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfNegativeBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, S[0], S[1], S[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfNegativeCount)), u.wfSubtotalBuffer && u.wfSubtotalCount && u.wfSubtotalCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfSubtotalBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, A[0], A[1], A[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfSubtotalCount)), u.style.showConnectors !== !1 && u.wfConnectorBuffer && u.wfConnectorCount && u.wfConnectorCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfConnectorBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, P[0], P[1], P[2], 0.6), i.lineWidth(1), i.drawArrays(i.LINES, 0, u.wfConnectorCount)), i.disableVertexAttribArray(n.lineProgram.attributes.position);
588
589
  }
589
590
  if (u.errorBuffer && u.errorCount) {
590
- const S = u.style.errorBars || {}, M = S.color ? Be({ color: S.color, opacity: S.opacity ?? 0.7 }) : v;
591
- Wt(
591
+ const M = u.style.errorBars || {}, S = M.color ? Be({ color: M.color, opacity: M.opacity ?? 0.7 }) : v;
592
+ Ut(
592
593
  i,
593
594
  n.lineProgram,
594
595
  u.errorBuffer,
595
596
  u.errorCount,
596
597
  p,
597
- M,
598
- S.width ?? 1
598
+ S,
599
+ M.width ?? 1
599
600
  );
600
601
  }
601
602
  }
602
603
  }
603
- class Ht {
604
+ class jt {
604
605
  constructor(e) {
605
606
  m(this, "textures", /* @__PURE__ */ new Map());
606
607
  this.gl = e;
@@ -644,10 +645,10 @@ class Pe {
644
645
  powerPreference: "high-performance"
645
646
  });
646
647
  if (!t) throw new Error("WebGL not supported");
647
- this.gl = t, this.programs = It(t), this.buffers = new Mt(t), this.textures = new Ht(t), t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), this.isInitialized = !0;
648
+ this.gl = t, this.programs = Ft(t), this.buffers = new Pt(t), this.textures = new jt(t), t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), this.isInitialized = !0;
648
649
  }
649
650
  setDPR(e) {
650
- this.dpr = e, this.resize();
651
+ this.dpr = e;
651
652
  }
652
653
  get available() {
653
654
  return this.isInitialized;
@@ -674,7 +675,7 @@ class Pe {
674
675
  return this.textures.getTexture(e);
675
676
  }
676
677
  render(e, t) {
677
- this.isInitialized && Nt(this.gl, this.canvas, this.dpr, this.programs, e, t);
678
+ this.isInitialized && Gt(this.gl, this.canvas, this.dpr, this.programs, e, t);
678
679
  }
679
680
  resize() {
680
681
  const e = this.canvas.getBoundingClientRect(), t = Math.round(e.width * this.dpr), n = Math.round(e.height * this.dpr);
@@ -694,8 +695,8 @@ class Pe {
694
695
  this.buffers.destroy(), this.textures.destroy(), e.deleteProgram(this.programs.lineProgram.program), e.deleteProgram(this.programs.pointProgram.program), e.deleteProgram(this.programs.heatmapProgram.program), this.isInitialized = !1;
695
696
  }
696
697
  }
697
- const ze = {};
698
- class Ut {
698
+ const Oe = {};
699
+ class Zt {
699
700
  constructor(e, t) {
700
701
  m(this, "gpu");
701
702
  m(this, "dpr");
@@ -722,7 +723,7 @@ class Ut {
722
723
  return this.gpu.updateBuffer(e, t, n);
723
724
  }
724
725
  getBuffer(e) {
725
- return this.gpu.hasBuffer(e) ? ze : void 0;
726
+ return this.gpu.hasBuffer(e) ? Oe : void 0;
726
727
  }
727
728
  deleteBuffer(e) {
728
729
  this.gpu.deleteBuffer(e);
@@ -733,7 +734,7 @@ class Ut {
733
734
  }
734
735
  getTexture(e) {
735
736
  const t = e.replace(/_colormap$/, "");
736
- return this.gpu.hasColormap(t) ? ze : void 0;
737
+ return this.gpu.hasColormap(t) ? Oe : void 0;
737
738
  }
738
739
  render(e, t) {
739
740
  this.gpu.renderNativeSeries(e, {
@@ -756,11 +757,11 @@ class Ut {
756
757
  this.gpu.destroy();
757
758
  }
758
759
  }
759
- async function qt(i, e = {}) {
760
- const t = new ft(i, e);
761
- return await t.init() ? new Ut(t, i) : null;
760
+ async function Qt(i, e = {}) {
761
+ const t = new pt(i, e);
762
+ return await t.init() ? new Zt(t, i) : null;
762
763
  }
763
- const Ee = {
764
+ const De = {
764
765
  name: "vibrant",
765
766
  isDark: !0,
766
767
  colors: [
@@ -807,7 +808,7 @@ const Ee = {
807
808
  ],
808
809
  highlightColor: "#FFFFFF"
809
810
  // Pure White
810
- }, Ke = {
811
+ }, tt = {
811
812
  name: "pastel",
812
813
  isDark: !1,
813
814
  colors: [
@@ -854,7 +855,7 @@ const Ee = {
854
855
  ],
855
856
  highlightColor: "#1A1A1A"
856
857
  // Near Black
857
- }, Gt = {
858
+ }, Jt = {
858
859
  name: "neon",
859
860
  isDark: !0,
860
861
  colors: [
@@ -901,7 +902,7 @@ const Ee = {
901
902
  ],
902
903
  highlightColor: "#FFFFFF"
903
904
  // Pure White
904
- }, jt = {
905
+ }, Kt = {
905
906
  name: "earth",
906
907
  isDark: !1,
907
908
  colors: [
@@ -948,7 +949,7 @@ const Ee = {
948
949
  ],
949
950
  highlightColor: "#000000"
950
951
  // Pure Black
951
- }, Zt = {
952
+ }, ei = {
952
953
  name: "ocean",
953
954
  isDark: !0,
954
955
  colors: [
@@ -995,21 +996,21 @@ const Ee = {
995
996
  ],
996
997
  highlightColor: "#FFD700"
997
998
  // Gold
998
- }, Qt = [
999
- Ee,
1000
- Ke,
1001
- Gt,
1002
- jt,
1003
- Zt
999
+ }, ti = [
1000
+ De,
1001
+ tt,
1002
+ Jt,
1003
+ Kt,
1004
+ ei
1004
1005
  ];
1005
- function Oe(i) {
1006
- const e = Qt.find((t) => t.name === i);
1007
- return e || (console.warn(`[ColorScheme] Unknown scheme "${i}", using vibrant`), Ee);
1006
+ function Ye(i) {
1007
+ const e = ti.find((t) => t.name === i);
1008
+ return e || (console.warn(`[ColorScheme] Unknown scheme "${i}", using vibrant`), De);
1008
1009
  }
1009
1010
  function $e(i) {
1010
- return i ? Ee : Ke;
1011
+ return i ? De : tt;
1011
1012
  }
1012
- const H = {
1013
+ const V = {
1013
1014
  lineColor: "#666666",
1014
1015
  // Brighter
1015
1016
  lineWidth: 1,
@@ -1025,19 +1026,19 @@ const H = {
1025
1026
  titleSize: 14,
1026
1027
  // Larger
1027
1028
  fontFamily: "Inter, system-ui, sans-serif"
1028
- }, xe = {
1029
+ }, ue = {
1029
1030
  visible: !0,
1030
1031
  majorColor: "rgba(255, 255, 255, 0.12)",
1031
1032
  // Higher opacity
1032
1033
  minorColor: "rgba(255, 255, 255, 0.05)",
1033
1034
  majorWidth: 1,
1034
1035
  minorWidth: 0.5,
1035
- majorDash: [4, 4],
1036
+ // Solid majors — dashed + minor divisions read as a “grid inside the grid”.
1037
+ majorDash: [],
1036
1038
  minorDash: [2, 4],
1037
- showMinor: !0,
1038
- // Default to show minor
1039
+ showMinor: !1,
1039
1040
  minorDivisions: 5
1040
- }, be = {
1041
+ }, de = {
1041
1042
  visible: !0,
1042
1043
  position: "top-right",
1043
1044
  backgroundColor: "rgba(15, 23, 42, 0.2)",
@@ -1049,11 +1050,11 @@ const H = {
1049
1050
  padding: 5,
1050
1051
  itemGap: 3,
1051
1052
  swatchSize: 12
1052
- }, Re = {
1053
+ }, we = {
1053
1054
  backgroundColor: "rgba(15, 23, 42, 0.2)",
1054
1055
  borderColor: "rgba(255, 255, 255, 0.08)",
1055
1056
  borderRadius: 8
1056
- }, ve = {
1057
+ }, fe = {
1057
1058
  lineColor: "rgba(255, 255, 255, 0.5)",
1058
1059
  lineWidth: 1,
1059
1060
  lineDash: [5, 5],
@@ -1061,100 +1062,106 @@ const H = {
1061
1062
  tooltipBorder: "rgba(255, 255, 255, 0.2)",
1062
1063
  tooltipColor: "#ffffff",
1063
1064
  tooltipSize: 11
1064
- }, Te = {
1065
+ }, Ie = {
1065
1066
  name: "dark",
1066
1067
  isDark: !0,
1067
1068
  backgroundColor: "#0b0e14",
1068
1069
  plotAreaBackground: "#0b0e14",
1069
1070
  plotBorderColor: "#444c56",
1070
1071
  grid: {
1071
- ...xe,
1072
+ ...ue,
1072
1073
  majorColor: "rgba(255, 255, 255, 0.12)",
1073
- minorColor: "rgba(255, 255, 255, 0.04)"
1074
+ minorColor: "rgba(255, 255, 255, 0.04)",
1075
+ showMinor: !1,
1076
+ majorDash: []
1074
1077
  },
1075
1078
  xAxis: {
1076
- ...H,
1079
+ ...V,
1077
1080
  labelColor: "#adbac7",
1078
1081
  titleColor: "#cdd9e5",
1079
1082
  lineColor: "#444c56",
1080
1083
  tickColor: "#444c56"
1081
1084
  },
1082
1085
  yAxis: {
1083
- ...H,
1086
+ ...V,
1084
1087
  labelColor: "#adbac7",
1085
1088
  titleColor: "#cdd9e5",
1086
1089
  lineColor: "#444c56",
1087
1090
  tickColor: "#444c56"
1088
1091
  },
1089
- legend: be,
1090
- cursor: ve,
1091
- toolbar: Re
1092
- }, Jt = {
1092
+ legend: de,
1093
+ cursor: fe,
1094
+ toolbar: we
1095
+ }, ii = {
1093
1096
  name: "midnight",
1094
1097
  isDark: !0,
1095
1098
  backgroundColor: "#05050a",
1096
1099
  plotAreaBackground: "#070715",
1097
1100
  plotBorderColor: "#3a3a5a",
1098
1101
  grid: {
1099
- ...xe,
1102
+ ...ue,
1100
1103
  majorColor: "rgba(150, 150, 255, 0.2)",
1101
- minorColor: "rgba(150, 150, 255, 0.08)"
1104
+ minorColor: "rgba(150, 150, 255, 0.08)",
1105
+ showMinor: !1,
1106
+ majorDash: []
1102
1107
  },
1103
1108
  xAxis: {
1104
- ...H,
1109
+ ...V,
1105
1110
  lineColor: "#5a5a8a",
1106
1111
  labelColor: "#b0b0e0",
1107
1112
  titleColor: "#d0d0f0",
1108
1113
  tickColor: "#5a5a8a"
1109
1114
  },
1110
1115
  yAxis: {
1111
- ...H,
1116
+ ...V,
1112
1117
  lineColor: "#5a5a8a",
1113
1118
  labelColor: "#b0b0e0",
1114
1119
  titleColor: "#d0d0f0",
1115
1120
  tickColor: "#5a5a8a"
1116
1121
  },
1117
1122
  legend: {
1118
- ...be,
1123
+ ...de,
1119
1124
  backgroundColor: "rgba(5, 5, 15, 0.2)",
1120
1125
  borderColor: "rgba(100, 100, 255, 0.4)"
1121
1126
  },
1122
1127
  toolbar: {
1123
- ...Re,
1128
+ ...we,
1124
1129
  backgroundColor: "rgba(5, 5, 15, 0.2)",
1125
1130
  borderColor: "rgba(100, 100, 255, 0.2)"
1126
1131
  },
1127
1132
  cursor: {
1128
- ...ve,
1133
+ ...fe,
1129
1134
  lineColor: "rgba(150, 150, 255, 0.7)"
1130
1135
  }
1131
- }, Kt = {
1136
+ }, ni = {
1132
1137
  name: "light",
1133
1138
  isDark: !1,
1134
1139
  backgroundColor: "#ffffff",
1135
1140
  plotAreaBackground: "#ffffff",
1136
1141
  plotBorderColor: "#cccccc",
1137
1142
  grid: {
1138
- ...xe,
1143
+ ...ue,
1139
1144
  majorColor: "rgba(0, 0, 0, 0.1)",
1140
- minorColor: "rgba(0, 0, 0, 0.04)"
1145
+ minorColor: "rgba(0, 0, 0, 0.04)",
1146
+ showMinor: !1,
1147
+ majorDash: []
1141
1148
  },
1142
1149
  xAxis: {
1143
- ...H,
1150
+ ...V,
1144
1151
  lineColor: "#888888",
1145
1152
  tickColor: "#888888",
1146
1153
  labelColor: "#444444",
1147
1154
  titleColor: "#222222"
1148
1155
  },
1149
1156
  yAxis: {
1150
- ...H,
1157
+ ...V,
1151
1158
  lineColor: "#888888",
1152
1159
  tickColor: "#888888",
1153
1160
  labelColor: "#444444",
1154
1161
  titleColor: "#222222"
1155
1162
  },
1156
1163
  legend: {
1157
- ...be,
1164
+ ...de,
1158
1165
  backgroundColor: "rgba(255, 255, 255, 0.2)",
1159
1166
  borderColor: "rgba(0, 0, 0, 0.15)",
1160
1167
  textColor: "#222222"
@@ -1165,53 +1172,97 @@ const H = {
1165
1172
  borderRadius: 8
1166
1173
  },
1167
1174
  cursor: {
1168
- ...ve,
1175
+ ...fe,
1169
1176
  lineColor: "rgba(0, 0, 0, 0.4)",
1170
1177
  tooltipBackground: "rgba(50, 50, 60, 0.95)"
1171
1178
  }
1172
- }, ei = {
1179
+ }, si = {
1180
+ name: "high-contrast",
1181
+ isDark: !0,
1182
+ backgroundColor: "#000000",
1183
+ plotAreaBackground: "#0a0a0a",
1184
+ plotBorderColor: "#ffffff",
1185
+ grid: {
1186
+ ...ue,
1187
+ majorColor: "rgba(255, 255, 255, 0.35)",
1188
+ minorColor: "rgba(255, 255, 255, 0.15)",
1189
+ showMinor: !1,
1190
+ majorDash: []
1191
+ },
1192
+ xAxis: {
1193
+ ...V,
1194
+ lineColor: "#ffffff",
1195
+ tickColor: "#ffffff",
1196
+ labelColor: "#ffffff",
1197
+ titleColor: "#ffffff"
1198
+ },
1199
+ yAxis: {
1200
+ ...V,
1201
+ lineColor: "#ffffff",
1202
+ tickColor: "#ffffff",
1203
+ labelColor: "#ffffff",
1204
+ titleColor: "#ffffff"
1205
+ },
1206
+ legend: {
1207
+ ...de,
1208
+ backgroundColor: "#000000",
1209
+ borderColor: "#ffffff",
1210
+ textColor: "#ffffff"
1211
+ },
1212
+ toolbar: {
1213
+ ...we,
1214
+ backgroundColor: "#000000",
1215
+ borderColor: "#ffffff"
1216
+ },
1217
+ cursor: {
1218
+ ...fe,
1219
+ lineColor: "#ffff00",
1220
+ tooltipBackground: "#ffff00",
1221
+ tooltipColor: "#000000"
1222
+ }
1223
+ }, oi = {
1173
1224
  name: "electrochemistry",
1174
1225
  isDark: !0,
1175
1226
  backgroundColor: "#0a1628",
1176
1227
  plotAreaBackground: "#0d1b2e",
1177
1228
  plotBorderColor: "#1e3a5f",
1178
1229
  grid: {
1179
- ...xe,
1230
+ ...ue,
1180
1231
  majorColor: "rgba(30, 136, 229, 0.15)",
1181
1232
  minorColor: "rgba(30, 136, 229, 0.06)",
1182
1233
  showMinor: !0,
1183
1234
  minorDivisions: 2
1184
1235
  },
1185
1236
  xAxis: {
1186
- ...H,
1237
+ ...V,
1187
1238
  lineColor: "#1e88e5",
1188
1239
  tickColor: "#42a5f5",
1189
1240
  labelColor: "#90caf9",
1190
1241
  titleColor: "#bbdefb"
1191
1242
  },
1192
1243
  yAxis: {
1193
- ...H,
1244
+ ...V,
1194
1245
  lineColor: "#1e88e5",
1195
1246
  tickColor: "#42a5f5",
1196
1247
  labelColor: "#90caf9",
1197
1248
  titleColor: "#bbdefb"
1198
1249
  },
1199
1250
  legend: {
1200
- ...be,
1251
+ ...de,
1201
1252
  backgroundColor: "rgba(10, 22, 40, 0.2)",
1202
1253
  borderColor: "rgba(30, 136, 229, 0.3)"
1203
1254
  },
1204
1255
  toolbar: {
1205
- ...Re,
1256
+ ...we,
1206
1257
  backgroundColor: "rgba(10, 22, 40, 0.2)",
1207
1258
  borderColor: "rgba(30, 136, 229, 0.15)"
1208
1259
  },
1209
1260
  cursor: {
1210
- ...ve,
1261
+ ...fe,
1211
1262
  lineColor: "rgba(100, 180, 255, 0.6)"
1212
1263
  }
1213
1264
  };
1214
- function ns(i, e) {
1265
+ function cs(i, e) {
1215
1266
  return {
1216
1267
  ...i,
1217
1268
  ...e,
@@ -1223,29 +1274,32 @@ function ns(i, e) {
1223
1274
  toolbar: { ...i.toolbar, ...e.toolbar }
1224
1275
  };
1225
1276
  }
1226
- function et(i) {
1277
+ function it(i) {
1227
1278
  switch (i) {
1228
1279
  case "dark":
1229
- return Te;
1280
+ return Ie;
1230
1281
  case "midnight":
1231
- return Jt;
1282
+ return ii;
1232
1283
  case "light":
1233
- return Kt;
1284
+ return ni;
1234
1285
  case "electrochemistry":
1235
1286
  case "electrochem":
1236
- return ei;
1287
+ return oi;
1288
+ case "high-contrast":
1289
+ case "highContrast":
1290
+ return si;
1237
1291
  default:
1238
- return console.warn(`[Theme] Unknown theme "${i}", using dark`), Te;
1292
+ return console.warn(`[Theme] Unknown theme "${i}", using dark`), Ie;
1239
1293
  }
1240
1294
  }
1241
- const ti = Te;
1242
- function Y(i) {
1295
+ const ri = Ie;
1296
+ function $(i) {
1243
1297
  return Math.floor(i) + 0.5;
1244
1298
  }
1245
1299
  function he(i) {
1246
1300
  return Math.round(i);
1247
1301
  }
1248
- class ii {
1302
+ class ai {
1249
1303
  constructor(e, t) {
1250
1304
  m(this, "ctx");
1251
1305
  m(this, "theme");
@@ -1273,6 +1327,13 @@ class ii {
1273
1327
  const n = e.ticks(t);
1274
1328
  return this.filterBusinessDayXTicks(n);
1275
1329
  }
1330
+ /**
1331
+ * Grid X lines use the full viewport domain (nice even spacing), including
1332
+ * regions past the loaded series. Axis labels stay filtered to real data.
1333
+ */
1334
+ resolveGridXTicks(e, t) {
1335
+ return e.ticks(t);
1336
+ }
1276
1337
  /**
1277
1338
  * Set LaTeX API for rendering mathematical expressions
1278
1339
  */
@@ -1321,21 +1382,21 @@ class ii {
1321
1382
  */
1322
1383
  drawGrid(e, t, n, s, o) {
1323
1384
  if (!this.theme.grid.visible) return;
1324
- const { ctx: r } = this, a = this.theme.grid, l = (s == null ? void 0 : s.tickCount) ?? 8, h = (o == null ? void 0 : o.tickCount) ?? 6, d = this.resolveXTicks(t, l), c = n.ticks(h);
1385
+ const { ctx: r } = this, a = this.theme.grid, l = (s == null ? void 0 : s.tickCount) ?? 8, h = (o == null ? void 0 : o.tickCount) ?? 6, d = this.resolveGridXTicks(t, l), c = n.ticks(h);
1325
1386
  if (r.strokeStyle = a.majorColor, r.lineWidth = a.majorWidth, r.setLineDash(a.majorDash), r.beginPath(), d.forEach((f) => {
1326
- const u = Y(t.transform(f));
1387
+ const u = $(t.transform(f));
1327
1388
  u >= e.x && u <= e.x + e.width && (r.moveTo(u, e.y), r.lineTo(u, e.y + e.height));
1328
1389
  }), r.stroke(), r.beginPath(), c.forEach((f) => {
1329
- const u = Y(n.transform(f));
1390
+ const u = $(n.transform(f));
1330
1391
  u >= e.y && u <= e.y + e.height && (r.moveTo(e.x, u), r.lineTo(e.x + e.width, u));
1331
1392
  }), r.stroke(), a.showMinor) {
1332
1393
  r.strokeStyle = a.minorColor, r.lineWidth = a.minorWidth, r.setLineDash(a.minorDash);
1333
1394
  const f = this.generateMinorTicks(d, a.minorDivisions), u = this.generateMinorTicks(c, a.minorDivisions);
1334
1395
  r.beginPath(), f.forEach((g) => {
1335
- const y = Y(t.transform(g));
1396
+ const y = $(t.transform(g));
1336
1397
  y >= e.x && y <= e.x + e.width && (r.moveTo(y, e.y), r.lineTo(y, e.y + e.height));
1337
1398
  }), r.stroke(), r.beginPath(), u.forEach((g) => {
1338
- const y = Y(n.transform(g));
1399
+ const y = $(n.transform(g));
1339
1400
  y >= e.y && y <= e.y + e.height && (r.moveTo(e.x, y), r.lineTo(e.x + e.width, y));
1340
1401
  }), r.stroke();
1341
1402
  }
@@ -1377,25 +1438,25 @@ class ii {
1377
1438
  * Draw X axis with ticks and labels
1378
1439
  */
1379
1440
  drawXAxis(e, t, n, s) {
1380
- const { ctx: o } = this, r = this.theme.xAxis, a = (n == null ? void 0 : n.tickCount) ?? 8, l = this.resolveXTicks(t, a), h = Y(e.y + e.height), d = n == null ? void 0 : n.label, c = (n == null ? void 0 : n.showLine) !== !1, f = (n == null ? void 0 : n.showTicks) !== !1, u = (n == null ? void 0 : n.showLabels) !== !1, g = t.domain[1] - t.domain[0];
1441
+ const { ctx: o } = this, r = this.theme.xAxis, a = (n == null ? void 0 : n.tickCount) ?? 8, l = this.resolveXTicks(t, a), h = $(e.y + e.height), d = n == null ? void 0 : n.label, c = (n == null ? void 0 : n.showLine) !== !1, f = (n == null ? void 0 : n.showTicks) !== !1, u = (n == null ? void 0 : n.showLabels) !== !1, g = t.domain[1] - t.domain[0];
1381
1442
  if (c && (o.strokeStyle = r.lineColor, o.lineWidth = r.lineWidth, o.beginPath(), o.moveTo(e.x, h), o.lineTo(e.x + e.width, h), o.stroke()), f || u) {
1382
1443
  o.fillStyle = r.labelColor, o.font = `${r.labelSize}px ${r.fontFamily}`;
1383
1444
  const y = [];
1384
1445
  for (const p of l) {
1385
1446
  const v = he(t.transform(p));
1386
1447
  if (v >= e.x && v <= e.x + e.width) {
1387
- const S = u ? this.formatXTick(p, n, g) : "";
1388
- (!u || S) && y.push({ tick: p, x: v, label: S });
1448
+ const M = u ? this.formatXTick(p, n, g) : "";
1449
+ (!u || M) && y.push({ tick: p, x: v, label: M });
1389
1450
  }
1390
1451
  }
1391
1452
  let x = !1;
1392
1453
  if (u && y.length > 1) {
1393
1454
  let p = 0;
1394
- for (const S of y)
1395
- p = Math.max(p, o.measureText(S.label).width);
1455
+ for (const M of y)
1456
+ p = Math.max(p, o.measureText(M.label).width);
1396
1457
  let v = 1 / 0;
1397
- for (let S = 1; S < y.length; S++)
1398
- v = Math.min(v, y[S].x - y[S - 1].x);
1458
+ for (let M = 1; M < y.length; M++)
1459
+ v = Math.min(v, y[M].x - y[M - 1].x);
1399
1460
  x = p + 8 > v;
1400
1461
  }
1401
1462
  const b = h + r.tickLength + (x ? 6 : 3), w = x ? -Math.PI / 4 : void 0;
@@ -1429,7 +1490,7 @@ class ii {
1429
1490
  * Draw Y axis with ticks and labels
1430
1491
  */
1431
1492
  drawYAxis(e, t, n, s = "left", o = 0, r) {
1432
- const { ctx: a } = this, l = this.theme.yAxis, h = (n == null ? void 0 : n.tickCount) ?? 6, d = t.ticks(h), c = n == null ? void 0 : n.label, f = (n == null ? void 0 : n.showLine) !== !1, u = (n == null ? void 0 : n.showTicks) !== !1, g = (n == null ? void 0 : n.showLabels) !== !1, y = Y(s === "left" ? e.x - o : e.x + e.width + o), x = s === "left" ? -1 : 1;
1493
+ const { ctx: a } = this, l = this.theme.yAxis, h = (n == null ? void 0 : n.tickCount) ?? 6, d = t.ticks(h), c = n == null ? void 0 : n.label, f = (n == null ? void 0 : n.showLine) !== !1, u = (n == null ? void 0 : n.showTicks) !== !1, g = (n == null ? void 0 : n.showLabels) !== !1, y = $(s === "left" ? e.x - o : e.x + e.width + o), x = s === "left" ? -1 : 1;
1433
1494
  if (f && (a.strokeStyle = l.lineColor, a.lineWidth = l.lineWidth, a.beginPath(), a.moveTo(y, e.y), a.lineTo(y, e.y + e.height), a.stroke()), (u || g) && (a.fillStyle = l.labelColor, a.font = `${l.labelSize}px ${l.fontFamily}`, a.textAlign = s === "left" ? "right" : "left", a.textBaseline = "middle", d.forEach((b) => {
1434
1495
  const w = he(t.transform(b));
1435
1496
  if (w >= e.y && w <= e.y + e.height && (u && (a.strokeStyle = l.tickColor, a.beginPath(), a.moveTo(y, w), a.lineTo(y + l.tickLength * x, w), a.stroke()), g)) {
@@ -1522,8 +1583,8 @@ class ii {
1522
1583
  n.moveTo(h + c, d), n.lineTo(h + a - c, d), n.arcTo(h + a, d, h + a, d + c, c), n.lineTo(h + a, d + l - c), n.arcTo(h + a, d + l, h + a - c, d + l, c), n.lineTo(h + c, d + l), n.arcTo(h, d + l, h, d + l - c, c), n.lineTo(h, d + c), n.arcTo(h, d, h + c, d, c), n.closePath(), n.fill(), n.stroke(), n.textAlign = "left", n.textBaseline = "middle", r.forEach((f, u) => {
1523
1584
  const g = d + s.padding + u * (s.swatchSize + s.itemGap), y = h + s.padding, x = g + s.swatchSize / 2, b = y + s.swatchSize / 2;
1524
1585
  n.save(), n.globalAlpha = f.opacity, n.fillStyle = f.color, n.strokeStyle = f.color, n.lineWidth = 2;
1525
- const w = s.swatchSize, p = String(f.type).toLowerCase(), v = !!f.symbol && f.symbol !== "circle", S = p === "scatter" || p === "1" || p === "line" && v, M = p.includes("scatter") || p === "2";
1526
- S ? this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, w * 0.9) : M ? (n.beginPath(), n.moveTo(y, x), n.lineTo(y + w, x), n.stroke(), this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, w * 0.6)) : (n.beginPath(), n.moveTo(y, x), n.lineTo(y + w, x), n.stroke()), n.restore(), this.drawLatexOrText(f.label, h + s.padding + s.swatchSize + 8, x, {
1586
+ const w = s.swatchSize, p = String(f.type).toLowerCase(), v = !!f.symbol && f.symbol !== "circle", M = p === "scatter" || p === "1" || p === "line" && v, S = p.includes("scatter") || p === "2";
1587
+ M ? this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, w * 0.9) : S ? (n.beginPath(), n.moveTo(y, x), n.lineTo(y + w, x), n.stroke(), this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, w * 0.6)) : (n.beginPath(), n.moveTo(y, x), n.lineTo(y + w, x), n.stroke()), n.restore(), this.drawLatexOrText(f.label, h + s.padding + s.swatchSize + 8, x, {
1527
1588
  fontSize: s.fontSize,
1528
1589
  fontFamily: s.fontFamily,
1529
1590
  color: s.textColor,
@@ -1599,10 +1660,10 @@ class ii {
1599
1660
  let f = 0;
1600
1661
  a.forEach((p) => {
1601
1662
  if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
1602
- const S = this.latexAPI.measure(p, { fontSize: r.tooltipSize });
1603
- d = Math.max(d, S.width);
1604
- const M = Math.max(l, S.height);
1605
- c.push(M), f += M;
1663
+ const M = this.latexAPI.measure(p, { fontSize: r.tooltipSize });
1664
+ d = Math.max(d, M.width);
1665
+ const S = Math.max(l, M.height);
1666
+ c.push(S), f += S;
1606
1667
  } else
1607
1668
  d = Math.max(d, o.measureText(p).width), c.push(l), f += l;
1608
1669
  });
@@ -1633,10 +1694,10 @@ class ii {
1633
1694
  let f = 0;
1634
1695
  r.forEach((p) => {
1635
1696
  if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
1636
- const S = this.latexAPI.measure(p, { fontSize: o.tooltipSize });
1637
- d = Math.max(d, S.width);
1638
- const M = Math.max(a, S.height);
1639
- c.push(M), f += M;
1697
+ const M = this.latexAPI.measure(p, { fontSize: o.tooltipSize });
1698
+ d = Math.max(d, M.width);
1699
+ const S = Math.max(a, M.height);
1700
+ c.push(S), f += S;
1640
1701
  } else
1641
1702
  d = Math.max(d, s.measureText(p).width), c.push(a), f += a;
1642
1703
  });
@@ -1691,13 +1752,13 @@ class ii {
1691
1752
  if (x < e.x || x > e.x + e.width || b < e.y || b > e.y + e.height) continue;
1692
1753
  const w = t.getYError(y);
1693
1754
  if (w) {
1694
- const [v, S] = w, M = r.y[y], A = s.transform(M + S), k = s.transform(M - v);
1695
- o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(x, A), f && (o.moveTo(x - c / 2, A), o.lineTo(x + c / 2, A))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(x, k), f && (o.moveTo(x - c / 2, k), o.lineTo(x + c / 2, k))), o.stroke();
1755
+ const [v, M] = w, S = r.y[y], A = s.transform(S + M), P = s.transform(S - v);
1756
+ o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(x, A), f && (o.moveTo(x - c / 2, A), o.lineTo(x + c / 2, A))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(x, P), f && (o.moveTo(x - c / 2, P), o.lineTo(x + c / 2, P))), o.stroke();
1696
1757
  }
1697
1758
  const p = t.getXError(y);
1698
1759
  if (p) {
1699
- const [v, S] = p, M = r.x[y], A = n.transform(M + S), k = n.transform(M - v);
1700
- o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(A, b), f && (o.moveTo(A, b - c / 2), o.lineTo(A, b + c / 2))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(k, b), f && (o.moveTo(k, b - c / 2), o.lineTo(k, b + c / 2))), o.stroke();
1760
+ const [v, M] = p, S = r.x[y], A = n.transform(S + M), P = n.transform(S - v);
1761
+ o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(A, b), f && (o.moveTo(A, b - c / 2), o.lineTo(A, b + c / 2))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(P, b), f && (o.moveTo(P, b - c / 2), o.lineTo(P, b + c / 2))), o.stroke();
1701
1762
  }
1702
1763
  }
1703
1764
  o.restore();
@@ -1716,10 +1777,10 @@ class ii {
1716
1777
  return n;
1717
1778
  }
1718
1779
  formatXTick(e, t, n) {
1719
- return qe(e, t, n, this.businessDayMapping);
1780
+ return je(e, t, n, this.businessDayMapping);
1720
1781
  }
1721
1782
  formatYTick(e, t) {
1722
- return Ge(e, t);
1783
+ return Ze(e, t);
1723
1784
  }
1724
1785
  /** Draw buy/sell markers on candlestick series (Stage 2.14). */
1725
1786
  drawCandlestickMarkers(e, t, n, s) {
@@ -1729,12 +1790,12 @@ class ii {
1729
1790
  const r = t.getData(), a = this.ctx, l = r.x, h = r.high ?? r.y, d = r.low ?? r.y, c = r.close ?? r.y;
1730
1791
  for (const u of o) {
1731
1792
  const g = (() => {
1732
- let S = 0, M = Math.abs(l[0] - u.time);
1793
+ let M = 0, S = Math.abs(l[0] - u.time);
1733
1794
  for (let A = 1; A < l.length; A++) {
1734
- const k = Math.abs(l[A] - u.time);
1735
- k < M && (M = k, S = A);
1795
+ const P = Math.abs(l[A] - u.time);
1796
+ P < S && (S = P, M = A);
1736
1797
  }
1737
- return S;
1798
+ return M;
1738
1799
  })(), y = u.position ?? "aboveBar", x = y === "belowBar" ? d[g] : y === "inBar" ? c[g] : h[g], b = e.x + n.transform(l[g]), w = e.y + s.transform(x), p = u.color ?? "#22c55e", v = y === "belowBar" ? 10 : -10;
1739
1800
  a.save(), a.fillStyle = p, a.strokeStyle = p, a.lineWidth = 1.5, u.shape === "arrowDown" ? (a.beginPath(), a.moveTo(b, w - v), a.lineTo(b - 5, w - v - 8), a.lineTo(b + 5, w - v - 8), a.closePath(), a.fill()) : u.shape === "circle" ? (a.beginPath(), a.arc(b, w + v, 4, 0, Math.PI * 2), a.fill()) : (a.beginPath(), a.moveTo(b, w + v), a.lineTo(b - 5, w + v + 8), a.lineTo(b + 5, w + v + 8), a.closePath(), a.fill()), u.text && (a.font = "10px sans-serif", a.textAlign = "center", a.fillText(u.text, b, w + v + (y === "belowBar" ? 20 : -14))), a.restore();
1740
1801
  }
@@ -1751,7 +1812,7 @@ class ii {
1751
1812
  s.setLineDash([]), s.restore();
1752
1813
  }
1753
1814
  }
1754
- class ni {
1815
+ class li {
1755
1816
  constructor(e, t, n, s, o) {
1756
1817
  m(this, "container");
1757
1818
  m(this, "callbacks");
@@ -1766,6 +1827,10 @@ class ni {
1766
1827
  m(this, "lastMousePos", { x: 0, y: 0 });
1767
1828
  m(this, "mouseDownPos", { x: 0, y: 0 });
1768
1829
  m(this, "mode", "pan");
1830
+ m(this, "pinchStartDistance", 0);
1831
+ m(this, "pinchStartBounds", null);
1832
+ m(this, "lastTapTime", 0);
1833
+ m(this, "doubleTapMs", 300);
1769
1834
  // Bound handlers for cleanup
1770
1835
  m(this, "boundWheel");
1771
1836
  m(this, "boundMouseDown");
@@ -1787,7 +1852,7 @@ class ni {
1787
1852
  }
1788
1853
  /**
1789
1854
  * Set the interaction mode
1790
- * @deprecated Use setMode instead
1855
+ * @deprecated Use setMode instead. **Removed in v4.0.**
1791
1856
  */
1792
1857
  setPanMode(e) {
1793
1858
  this.mode = e ? "pan" : "select";
@@ -1813,10 +1878,10 @@ class ni {
1813
1878
  e.preventDefault();
1814
1879
  const n = this.container.getBoundingClientRect(), s = e.clientX - n.left, o = e.clientY - n.top, r = this.getAxesLayout();
1815
1880
  let a = !1, l = !1, h;
1816
- for (const B of r) {
1881
+ for (const T of r) {
1817
1882
  let I;
1818
- if (B.position === "left" ? I = t.x - 65 - B.offset : I = t.x + t.width + B.offset, s >= I && s <= I + 65 && o >= t.y && o <= t.y + t.height) {
1819
- h = B.id, l = !0, a = !1;
1883
+ if (T.position === "left" ? I = t.x - 65 - T.offset : I = t.x + t.width + T.offset, s >= I && s <= I + 65 && o >= t.y && o <= t.y + t.height) {
1884
+ h = T.id, l = !0, a = !1;
1820
1885
  break;
1821
1886
  }
1822
1887
  }
@@ -1828,16 +1893,16 @@ class ni {
1828
1893
  else
1829
1894
  return;
1830
1895
  const d = this.getBounds(h), c = e.deltaY > 0 ? 1.1 : 0.9, f = (s - t.x) / t.width, u = 1 - (o - t.y) / t.height, g = d.xMin + f * (d.xMax - d.xMin), y = d.yMin + u * (d.yMax - d.yMin), x = 1e-12, b = 1e15;
1831
- let w = a ? g - (g - d.xMin) * c : d.xMin, p = a ? g + (d.xMax - g) * c : d.xMax, v = l ? y - (y - d.yMin) * c : d.yMin, S = l ? y + (d.yMax - y) * c : d.yMax;
1832
- const M = p - w, A = S - v;
1833
- (M < x || M > b) && (w = d.xMin, p = d.xMax), (A < x || A > b) && (v = d.yMin, S = d.yMax);
1834
- const k = {
1896
+ let w = a ? g - (g - d.xMin) * c : d.xMin, p = a ? g + (d.xMax - g) * c : d.xMax, v = l ? y - (y - d.yMin) * c : d.yMin, M = l ? y + (d.yMax - y) * c : d.yMax;
1897
+ const S = p - w, A = M - v;
1898
+ (S < x || S > b) && (w = d.xMin, p = d.xMax), (A < x || A > b) && (v = d.yMin, M = d.yMax);
1899
+ const P = {
1835
1900
  xMin: w,
1836
1901
  xMax: p,
1837
1902
  yMin: v,
1838
- yMax: S
1903
+ yMax: M
1839
1904
  };
1840
- this.callbacks.onZoom(k, h);
1905
+ this.callbacks.onZoom(P, h);
1841
1906
  }
1842
1907
  handleMouseDown(e) {
1843
1908
  var l, h, d, c, f, u, g, y, x, b;
@@ -1937,19 +2002,49 @@ class ni {
1937
2002
  // Touch Handlers
1938
2003
  // ----------------------------------------
1939
2004
  handleTouchStart(e) {
2005
+ if (e.touches.length === 2) {
2006
+ this.isDragging = !1;
2007
+ const [t, n] = [e.touches[0], e.touches[1]];
2008
+ this.pinchStartDistance = Math.hypot(
2009
+ n.clientX - t.clientX,
2010
+ n.clientY - t.clientY
2011
+ ), this.pinchStartBounds = this.getBounds();
2012
+ return;
2013
+ }
1940
2014
  if (e.touches.length === 1) {
1941
2015
  const t = e.touches[0];
1942
2016
  this.isDragging = !0, this.panningAxisId = void 0, this.lastMousePos = { x: t.clientX, y: t.clientY };
1943
2017
  }
1944
2018
  }
1945
2019
  handleTouchMove(e) {
2020
+ if (e.touches.length === 2 && this.pinchStartBounds && this.pinchStartDistance > 0) {
2021
+ e.preventDefault();
2022
+ const [o, r] = [e.touches[0], e.touches[1]], a = Math.hypot(
2023
+ r.clientX - o.clientX,
2024
+ r.clientY - o.clientY
2025
+ ), l = this.pinchStartDistance / a, h = this.pinchStartBounds, d = (h.xMin + h.xMax) / 2, c = (h.yMin + h.yMax) / 2, f = (h.xMax - h.xMin) / 2 * l, u = (h.yMax - h.yMin) / 2 * l;
2026
+ this.callbacks.onZoom(
2027
+ {
2028
+ xMin: d - f,
2029
+ xMax: d + f,
2030
+ yMin: c - u,
2031
+ yMax: c + u
2032
+ },
2033
+ this.panningAxisId
2034
+ );
2035
+ return;
2036
+ }
1946
2037
  if (!this.isDragging || e.touches.length !== 1) return;
1947
2038
  e.preventDefault();
1948
2039
  const t = e.touches[0], n = t.clientX - this.lastMousePos.x, s = t.clientY - this.lastMousePos.y;
1949
2040
  this.callbacks.onPan(n, s, this.panningAxisId), this.lastMousePos = { x: t.clientX, y: t.clientY };
1950
2041
  }
1951
- handleTouchEnd() {
1952
- this.isDragging = !1, this.panningAxisId = void 0;
2042
+ handleTouchEnd(e) {
2043
+ var t, n;
2044
+ if (e.touches.length < 2 && (this.pinchStartDistance = 0, this.pinchStartBounds = null), e.touches.length === 0) {
2045
+ const s = Date.now();
2046
+ s - this.lastTapTime < this.doubleTapMs ? ((n = (t = this.callbacks).onDoubleTap) == null || n.call(t), this.lastTapTime = 0) : this.lastTapTime = s, this.isDragging = !1, this.panningAxisId = void 0;
2047
+ }
1953
2048
  }
1954
2049
  // ----------------------------------------
1955
2050
  // Cleanup
@@ -1958,7 +2053,7 @@ class ni {
1958
2053
  this.detachListeners();
1959
2054
  }
1960
2055
  }
1961
- const si = {
2056
+ const hi = {
1962
2057
  enabled: !0,
1963
2058
  hitRadius: 20,
1964
2059
  multiSelect: !0,
@@ -1969,7 +2064,7 @@ const si = {
1969
2064
  ringWidth: 3
1970
2065
  }
1971
2066
  };
1972
- class oi {
2067
+ class ci {
1973
2068
  constructor(e, t) {
1974
2069
  m(this, "ctx");
1975
2070
  m(this, "config");
@@ -1978,7 +2073,7 @@ class oi {
1978
2073
  m(this, "isBoxSelecting", !1);
1979
2074
  m(this, "boxStart", null);
1980
2075
  m(this, "boxEnd", null);
1981
- this.ctx = e, this.config = { ...si, ...t };
2076
+ this.ctx = e, this.config = { ...hi, ...t };
1982
2077
  }
1983
2078
  // ============================================
1984
2079
  // Configuration
@@ -2014,17 +2109,17 @@ class oi {
2014
2109
  if (g.x.length === 0) return;
2015
2110
  const y = f.getYAxisId() || this.ctx.getPrimaryYAxisId(), x = r.get(y);
2016
2111
  if (!x) return;
2017
- const b = o.invert(e), w = this.findNearestIndex(g.x, b), p = 50, v = Math.max(0, w - p), S = Math.min(g.x.length, w + p);
2018
- for (let M = v; M < S; M++) {
2019
- const A = o.transform(g.x[M]), k = x.transform(g.y[M]), B = A - e, F = k - t, I = B * B + F * F;
2112
+ const b = o.invert(e), w = this.findNearestIndex(g.x, b), p = 50, v = Math.max(0, w - p), M = Math.min(g.x.length, w + p);
2113
+ for (let S = v; S < M; S++) {
2114
+ const A = o.transform(g.x[S]), P = x.transform(g.y[S]), T = A - e, D = P - t, I = T * T + D * D;
2020
2115
  I < c && I <= h && (c = I, d = {
2021
2116
  seriesId: u,
2022
- index: M,
2023
- x: g.x[M],
2024
- y: g.y[M],
2117
+ index: S,
2118
+ x: g.x[S],
2119
+ y: g.y[S],
2025
2120
  distance: Math.sqrt(I),
2026
2121
  pixelX: A,
2027
- pixelY: k
2122
+ pixelY: P
2028
2123
  });
2029
2124
  }
2030
2125
  }), d;
@@ -2345,7 +2440,7 @@ const ee = {
2345
2440
  reducedMotion: "auto",
2346
2441
  resizeDebounce: 100
2347
2442
  };
2348
- class ri {
2443
+ class ui {
2349
2444
  constructor(e, t) {
2350
2445
  m(this, "ctx");
2351
2446
  m(this, "config");
@@ -2526,7 +2621,7 @@ class ri {
2526
2621
  this.destroyed = !0, this.debounceTimer !== null && window.clearTimeout(this.debounceTimer), this.resizeObserver ? (this.resizeObserver.disconnect(), this.resizeObserver = null) : window.removeEventListener("resize", this.handleResize);
2527
2622
  }
2528
2623
  }
2529
- function ai(i, e) {
2624
+ function di(i, e) {
2530
2625
  const {
2531
2626
  seriesIds: t,
2532
2627
  includeHeaders: n = !0,
@@ -2552,7 +2647,7 @@ function ai(i, e) {
2552
2647
  return a.join(`
2553
2648
  `);
2554
2649
  }
2555
- function li(i, e, t) {
2650
+ function fi(i, e, t) {
2556
2651
  const { seriesIds: n, precision: s = 6 } = t ?? {}, o = n ? i.filter((a) => n.includes(a.getId())) : i, r = {};
2557
2652
  return o.forEach((a) => {
2558
2653
  const l = a.getData();
@@ -2572,7 +2667,7 @@ function li(i, e, t) {
2572
2667
  series: r
2573
2668
  }, null, 2);
2574
2669
  }
2575
- function hi(i, e, t, n, s, o, r = "png") {
2670
+ function gi(i, e, t, n, s, o, r = "png") {
2576
2671
  const a = document.createElement("canvas");
2577
2672
  a.width = e.width, a.height = e.height;
2578
2673
  const l = a.getContext("2d");
@@ -2582,14 +2677,14 @@ function hi(i, e, t, n, s, o, r = "png") {
2582
2677
  h[1] * 255
2583
2678
  )}, ${Math.round(h[2] * 255)}, ${h[3]})`, l.fillRect(0, 0, a.width, a.height), l.drawImage(i, 0, 0), l.drawImage(e, 0, 0), n && s && n.draw(l, o), a.toDataURL(`image/${r}`);
2584
2679
  }
2585
- function Ye(i) {
2680
+ function _e(i) {
2586
2681
  return i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2587
2682
  }
2588
- function tt(i, e) {
2683
+ function nt(i, e) {
2589
2684
  return e && i.has(e) ? i.get(e) : i.get("default") ?? i.values().next().value;
2590
2685
  }
2591
- function ci(i, e, t, n, s, o, r, a, l = {}) {
2592
- const h = tt(s, l.primaryYAxisId);
2686
+ function yi(i, e, t, n, s, o, r, a, l = {}) {
2687
+ const h = nt(s, l.primaryYAxisId);
2593
2688
  if (!h)
2594
2689
  throw new Error("SVG export requires at least one Y scale");
2595
2690
  const d = [
@@ -2597,13 +2692,13 @@ function ci(i, e, t, n, s, o, r, a, l = {}) {
2597
2692
  `<rect width="100%" height="100%" fill="${o.backgroundColor}" />`,
2598
2693
  '<g transform="translate(0,0)">'
2599
2694
  ];
2600
- return gi(d, t, n, h, o), ui(d, i, t, n, s, l.primaryYAxisId), di(d, t, n, h, o), fi(d, t, n, h, o, l), d.push("</g>"), d.push("</svg>"), d.join(`
2695
+ return bi(d, t, n, h, o), mi(d, i, t, n, s, l.primaryYAxisId), pi(d, t, n, h, o), xi(d, t, n, h, o, l), d.push("</g>"), d.push("</svg>"), d.join(`
2601
2696
  `);
2602
2697
  }
2603
- function ui(i, e, t, n, s, o) {
2698
+ function mi(i, e, t, n, s, o) {
2604
2699
  for (const r of e) {
2605
2700
  if (!r.isVisible()) continue;
2606
- const a = s.get(r.getYAxisId() || o || "default") ?? tt(s, o);
2701
+ const a = s.get(r.getYAxisId() || o || "default") ?? nt(s, o);
2607
2702
  if (!a) continue;
2608
2703
  const l = r.getData();
2609
2704
  if (!l || l.x.length === 0) continue;
@@ -2658,58 +2753,58 @@ function ui(i, e, t, n, s, o) {
2658
2753
  const c = (h.barWidth || 5) * (t.width / (n.domain[1] - n.domain[0])), f = h.bullishColor || "#26a69a", u = h.bearishColor || "#ef5350";
2659
2754
  if (l.open && l.high && l.low && l.close)
2660
2755
  for (let g = 0; g < l.x.length; g++) {
2661
- const y = l.close[g] >= l.open[g], x = n.transform(l.x[g]), b = a.transform(l.open[g]), w = a.transform(l.close[g]), p = a.transform(l.high[g]), v = a.transform(l.low[g]), S = y ? f : u;
2756
+ const y = l.close[g] >= l.open[g], x = n.transform(l.x[g]), b = a.transform(l.open[g]), w = a.transform(l.close[g]), p = a.transform(l.high[g]), v = a.transform(l.low[g]), M = y ? f : u;
2662
2757
  i.push(
2663
- `<line x1="${x.toFixed(1)}" y1="${p.toFixed(1)}" x2="${x.toFixed(1)}" y2="${v.toFixed(1)}" stroke="${S}" stroke-width="1" />`
2758
+ `<line x1="${x.toFixed(1)}" y1="${p.toFixed(1)}" x2="${x.toFixed(1)}" y2="${v.toFixed(1)}" stroke="${M}" stroke-width="1" />`
2664
2759
  );
2665
- const M = Math.min(b, w), A = Math.max(1, Math.abs(b - w));
2760
+ const S = Math.min(b, w), A = Math.max(1, Math.abs(b - w));
2666
2761
  i.push(
2667
- `<rect x="${(x - c / 2).toFixed(1)}" y="${M.toFixed(1)}" width="${c.toFixed(1)}" height="${A.toFixed(1)}" fill="${S}" />`
2762
+ `<rect x="${(x - c / 2).toFixed(1)}" y="${S.toFixed(1)}" width="${c.toFixed(1)}" height="${A.toFixed(1)}" fill="${M}" />`
2668
2763
  );
2669
2764
  }
2670
2765
  }
2671
2766
  }
2672
2767
  }
2673
- function di(i, e, t, n, s) {
2674
- const o = Y(e.y + e.height), r = Y(e.x);
2768
+ function pi(i, e, t, n, s) {
2769
+ const o = $(e.y + e.height), r = $(e.x);
2675
2770
  i.push(
2676
2771
  `<line x1="${e.x}" y1="${o}" x2="${e.x + e.width}" y2="${o}" stroke="${s.xAxis.lineColor}" stroke-width="${s.xAxis.lineWidth || 2}" />`
2677
2772
  ), i.push(
2678
2773
  `<line x1="${r}" y1="${e.y}" x2="${r}" y2="${e.y + e.height}" stroke="${s.yAxis.lineColor}" stroke-width="${s.yAxis.lineWidth || 2}" />`
2679
2774
  );
2680
2775
  }
2681
- function fi(i, e, t, n, s, o) {
2776
+ function xi(i, e, t, n, s, o) {
2682
2777
  const r = o.xAxis, a = o.yAxis, l = (r == null ? void 0 : r.tickCount) ?? 8, h = (a == null ? void 0 : a.tickCount) ?? 6, d = t.domain[1] - t.domain[0], c = e.y + e.height, f = e.x, u = s.xAxis, g = s.yAxis;
2683
2778
  (r == null ? void 0 : r.showLabels) !== !1 && t.ticks(l).forEach((y) => {
2684
2779
  const x = he(t.transform(y));
2685
2780
  if (x < e.x || x > e.x + e.width) return;
2686
- const b = qe(y, r, d), w = c + (u.tickLength ?? 4) + u.labelSize * 0.75;
2781
+ const b = je(y, r, d), w = c + (u.tickLength ?? 4) + u.labelSize * 0.75;
2687
2782
  i.push(
2688
- `<text x="${x.toFixed(1)}" y="${w.toFixed(1)}" fill="${u.labelColor}" font-size="${u.labelSize}" text-anchor="middle">${Ye(b)}</text>`
2783
+ `<text x="${x.toFixed(1)}" y="${w.toFixed(1)}" fill="${u.labelColor}" font-size="${u.labelSize}" text-anchor="middle">${_e(b)}</text>`
2689
2784
  );
2690
2785
  }), (a == null ? void 0 : a.showLabels) !== !1 && n.ticks(h).forEach((y) => {
2691
2786
  const x = he(n.transform(y));
2692
2787
  if (x < e.y || x > e.y + e.height) return;
2693
- const b = Ge(y, a), w = f - (g.tickLength ?? 4) - 4;
2788
+ const b = Ze(y, a), w = f - (g.tickLength ?? 4) - 4;
2694
2789
  i.push(
2695
- `<text x="${w.toFixed(1)}" y="${(x + g.labelSize * 0.35).toFixed(1)}" fill="${g.labelColor}" font-size="${g.labelSize}" text-anchor="end">${Ye(b)}</text>`
2790
+ `<text x="${w.toFixed(1)}" y="${(x + g.labelSize * 0.35).toFixed(1)}" fill="${g.labelColor}" font-size="${g.labelSize}" text-anchor="end">${_e(b)}</text>`
2696
2791
  );
2697
2792
  });
2698
2793
  }
2699
- function gi(i, e, t, n, s) {
2794
+ function bi(i, e, t, n, s) {
2700
2795
  s.grid.visible && (t.ticks(10).forEach((o) => {
2701
- const r = Y(t.transform(o));
2796
+ const r = $(t.transform(o));
2702
2797
  r >= e.x && r <= e.x + e.width && i.push(
2703
2798
  `<line x1="${r.toFixed(1)}" y1="${e.y}" x2="${r.toFixed(1)}" y2="${e.y + e.height}" stroke="${s.grid.majorColor}" stroke-opacity="0.1" stroke-dasharray="2,2" />`
2704
2799
  );
2705
2800
  }), n.ticks(10).forEach((o) => {
2706
- const r = Y(n.transform(o));
2801
+ const r = $(n.transform(o));
2707
2802
  r >= e.y && r <= e.y + e.height && i.push(
2708
2803
  `<line x1="${e.x}" y1="${r.toFixed(1)}" x2="${e.x + e.width}" y2="${r.toFixed(1)}" stroke="${s.grid.majorColor}" stroke-opacity="0.1" stroke-dasharray="2,2" />`
2709
2804
  );
2710
2805
  }));
2711
2806
  }
2712
- const yi = /* @__PURE__ */ new Set([
2807
+ const vi = /* @__PURE__ */ new Set([
2713
2808
  "line",
2714
2809
  "band",
2715
2810
  "scatter",
@@ -2718,13 +2813,13 @@ const yi = /* @__PURE__ */ new Set([
2718
2813
  "candlestick",
2719
2814
  "ohlc"
2720
2815
  ]);
2721
- function pe(i) {
2816
+ function ve(i) {
2722
2817
  const e = Array.from(i).filter((n) => n.isVisible());
2723
- return e.some((n) => n.getType() === "bar") ? !e.some((n) => yi.has(n.getType())) : !1;
2818
+ return e.some((n) => n.getType() === "bar") ? !e.some((n) => vi.has(n.getType())) : !1;
2724
2819
  }
2725
- function mi(i, e) {
2820
+ function wi(i, e) {
2726
2821
  e.x && (i.viewBounds.xMin = e.x[0], i.viewBounds.xMax = e.x[1]);
2727
- const t = pe(i.series.values()), n = e.y ? [...e.y] : null;
2822
+ const t = ve(i.series.values()), n = e.y ? [...e.y] : null;
2728
2823
  if (n && t && (n[0] = 0), n)
2729
2824
  if (e.axisId) {
2730
2825
  const s = i.yScales.get(e.axisId);
@@ -2742,17 +2837,17 @@ function mi(i, e) {
2742
2837
  y: [i.viewBounds.yMin, i.viewBounds.yMax]
2743
2838
  }), i.requestRender();
2744
2839
  }
2745
- function pi(i, e, t, n) {
2840
+ function Mi(i, e, t, n) {
2746
2841
  const s = i.getPlotArea(), o = e / s.width * (i.viewBounds.xMax - i.viewBounds.xMin);
2747
2842
  if (i.viewBounds.xMin -= o, i.viewBounds.xMax -= o, n) {
2748
2843
  const a = i.yScales.get(n);
2749
2844
  if (a) {
2750
- const l = pe(i.series.values()), h = a.domain[1] - a.domain[0], d = t / s.height * h;
2845
+ const l = ve(i.series.values()), h = a.domain[1] - a.domain[0], d = t / s.height * h;
2751
2846
  let c = a.domain[0] + d, f = a.domain[1] + d;
2752
2847
  l && (c = 0, f = a.domain[1] + d), a.setDomain(c, f), n === i.primaryYAxisId && (i.viewBounds.yMin = c, i.viewBounds.yMax = f);
2753
2848
  }
2754
2849
  } else {
2755
- const a = pe(i.series.values());
2850
+ const a = ve(i.series.values());
2756
2851
  i.yScales.forEach((l, h) => {
2757
2852
  const d = l.domain[1] - l.domain[0], c = t / s.height * d;
2758
2853
  let f = l.domain[0] + c, u = l.domain[1] + c;
@@ -2762,7 +2857,7 @@ function pi(i, e, t, n) {
2762
2857
  const r = t / s.height * (i.viewBounds.yMax - i.viewBounds.yMin);
2763
2858
  i.events.emit("pan", { deltaX: o, deltaY: r }), i.requestRender();
2764
2859
  }
2765
- function xi(i) {
2860
+ function Si(i) {
2766
2861
  if (i.series.size === 0) return;
2767
2862
  let e = 1 / 0, t = -1 / 0;
2768
2863
  const n = /* @__PURE__ */ new Map();
@@ -2799,7 +2894,7 @@ function xi(i) {
2799
2894
  }
2800
2895
  }), i.requestRender();
2801
2896
  }
2802
- function bi(i, e = {}) {
2897
+ function Ci(i, e = {}) {
2803
2898
  var l, h;
2804
2899
  const t = typeof e.padding == "object" ? e.padding.x ?? 0.02 : e.padding ?? 0.02, n = typeof e.padding == "object" ? e.padding.y ?? 0.05 : e.padding ?? 0.05;
2805
2900
  let s = (l = e.x) == null ? void 0 : l[0], o = (h = e.x) == null ? void 0 : h[1], r = s !== void 0 && o !== void 0;
@@ -2822,19 +2917,16 @@ function bi(i, e = {}) {
2822
2917
  if (e.y) {
2823
2918
  const d = i.yScales.get(i.primaryYAxisId);
2824
2919
  d && d.setDomain(e.y[0], e.y[1]), i.viewBounds.yMin = e.y[0], i.viewBounds.yMax = e.y[1];
2825
- } else {
2826
- let f = !1;
2827
- if (a.forEach((u, g) => {
2828
- if (u.min === 1 / 0) return;
2829
- f = !0;
2830
- const y = i.yAxisOptionsMap.get(g), x = i.yScales.get(g);
2831
- if (!y || !x) return;
2832
- let b = u.max - u.min;
2833
- (b <= 0 || !isFinite(b)) && (b = Math.abs(u.min) * 0.1 || 1);
2834
- const w = b * n, p = Math.max(-1e15, u.min - w), v = Math.min(1e15, u.max + w);
2835
- x.setDomain(p, v), g === i.primaryYAxisId && (i.viewBounds.yMin = p, i.viewBounds.yMax = v);
2836
- }), !e.y && !f && !r) return !1;
2837
- }
2920
+ } else
2921
+ a.forEach((f, u) => {
2922
+ if (f.min === 1 / 0) return;
2923
+ const g = i.yAxisOptionsMap.get(u), y = i.yScales.get(u);
2924
+ if (!g || !y) return;
2925
+ let x = f.max - f.min;
2926
+ (x <= 0 || !isFinite(x)) && (x = Math.abs(f.min) * 0.1 || 1);
2927
+ const b = x * n, w = Math.max(-1e15, f.min - b), p = Math.min(1e15, f.max + b);
2928
+ y.setDomain(w, p), u === i.primaryYAxisId && (i.viewBounds.yMin = w, i.viewBounds.yMax = p);
2929
+ });
2838
2930
  if (r && s !== void 0 && o !== void 0) {
2839
2931
  let f = o - s;
2840
2932
  (f <= 0 || !isFinite(f)) && (f = Math.abs(s) * 0.1 || 1);
@@ -2843,7 +2935,7 @@ function bi(i, e = {}) {
2843
2935
  }
2844
2936
  return i.requestRender(), !0;
2845
2937
  }
2846
- function vi(i) {
2938
+ function Ai(i) {
2847
2939
  if (i.series.size === 0) return;
2848
2940
  const e = /* @__PURE__ */ new Map();
2849
2941
  i.yScales.forEach((o, r) => {
@@ -2872,7 +2964,7 @@ function vi(i) {
2872
2964
  }
2873
2965
  }), i.requestRender();
2874
2966
  }
2875
- function wi(i, e, t, n) {
2967
+ function ki(i, e, t, n) {
2876
2968
  if (e === null) {
2877
2969
  if (t && t.width > 5 && t.height > 5) {
2878
2970
  const s = i.getPlotArea(), o = i.viewBounds, r = (t.x - s.x) / s.width, a = (t.x + t.width - s.x) / s.width, l = 1 - (t.y - s.y) / s.height, h = 1 - (t.y + t.height - s.y) / s.height, d = o.xMin + r * (o.xMax - o.xMin), c = o.xMin + a * (o.xMax - o.xMin), f = o.yMin + h * (o.yMax - o.yMin), u = o.yMin + l * (o.yMax - o.yMin);
@@ -2882,7 +2974,7 @@ function wi(i, e, t, n) {
2882
2974
  }
2883
2975
  return e;
2884
2976
  }
2885
- const Si = {
2977
+ const Pi = {
2886
2978
  /** Linear easing - constant speed */
2887
2979
  linear: (i) => i,
2888
2980
  /** Ease in - starts slow, accelerates */
@@ -2908,7 +3000,7 @@ const Si = {
2908
3000
  /** Bounce effect */
2909
3001
  bounce: (i) => i < 1 / 2.75 ? 7.5625 * i * i : i < 2 / 2.75 ? 7.5625 * (i -= 1.5 / 2.75) * i + 0.75 : i < 2.5 / 2.75 ? 7.5625 * (i -= 2.25 / 2.75) * i + 0.9375 : 7.5625 * (i -= 2.625 / 2.75) * i + 0.984375
2910
3002
  };
2911
- class it {
3003
+ class st {
2912
3004
  constructor() {
2913
3005
  m(this, "animations", /* @__PURE__ */ new Map());
2914
3006
  m(this, "frameId", null);
@@ -2919,7 +3011,7 @@ class it {
2919
3011
  * Start a new animation
2920
3012
  */
2921
3013
  animate(e) {
2922
- const t = `anim_${++this.idCounter}`, n = typeof e.easing == "function" ? e.easing : Si[e.easing || "easeOutCubic"];
3014
+ const t = `anim_${++this.idCounter}`, n = typeof e.easing == "function" ? e.easing : Pi[e.easing || "easeOutCubic"];
2923
3015
  let s, o;
2924
3016
  const r = new Promise((a, l) => {
2925
3017
  s = a, o = l;
@@ -3050,7 +3142,7 @@ class it {
3050
3142
  }), this.animations.size > 0 ? this.frameId = requestAnimationFrame(() => this.tick()) : this.frameId = null;
3051
3143
  }
3052
3144
  }
3053
- const X = {
3145
+ const N = {
3054
3146
  enabled: !0,
3055
3147
  zoom: {
3056
3148
  enabled: !1,
@@ -3084,25 +3176,25 @@ const X = {
3084
3176
  easing: "easeOutCubic"
3085
3177
  }
3086
3178
  };
3087
- function _e(i) {
3179
+ function Ve(i) {
3088
3180
  return i ? {
3089
- enabled: i.enabled ?? X.enabled,
3090
- zoom: { ...X.zoom, ...i.zoom },
3091
- pan: { ...X.pan, ...i.pan },
3092
- dataUpdate: { ...X.dataUpdate, ...i.dataUpdate },
3093
- seriesEntry: { ...X.seriesEntry, ...i.seriesEntry },
3094
- autoScale: { ...X.autoScale, ...i.autoScale }
3095
- } : { ...X };
3096
- }
3097
- let ke = null;
3098
- function ss() {
3099
- return ke || (ke = new it()), ke;
3181
+ enabled: i.enabled ?? N.enabled,
3182
+ zoom: { ...N.zoom, ...i.zoom },
3183
+ pan: { ...N.pan, ...i.pan },
3184
+ dataUpdate: { ...N.dataUpdate, ...i.dataUpdate },
3185
+ seriesEntry: { ...N.seriesEntry, ...i.seriesEntry },
3186
+ autoScale: { ...N.autoScale, ...i.autoScale }
3187
+ } : { ...N };
3188
+ }
3189
+ let Te = null;
3190
+ function us() {
3191
+ return Te || (Te = new st()), Te;
3100
3192
  }
3101
3193
  let G = null, j = null;
3102
- function Mi(i, e) {
3194
+ function Ti(i, e) {
3103
3195
  const t = e.animate !== !1 && i.animationConfig.enabled && i.animationConfig.zoom.enabled;
3104
3196
  G != null && G.isRunning() && G.cancel();
3105
- const n = pe(i.series.values()), s = e.x ? e.x[0] : i.viewBounds.xMin, o = e.x ? e.x[1] : i.viewBounds.xMax;
3197
+ const n = ve(i.series.values()), s = e.x ? e.x[0] : i.viewBounds.xMin, o = e.x ? e.x[1] : i.viewBounds.xMax;
3106
3198
  let r = e.y ? e.y[0] : i.viewBounds.yMin, a = e.y ? e.y[1] : i.viewBounds.yMax;
3107
3199
  n && e.y && (r = 0);
3108
3200
  const l = e.axisId;
@@ -3145,8 +3237,8 @@ function Mi(i, e) {
3145
3237
  if (u === i.primaryYAxisId)
3146
3238
  f.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
3147
3239
  else {
3148
- const g = d.get(u), y = h.yMax - h.yMin, x = i.viewBounds.yMax - i.viewBounds.yMin, b = y > 0 ? x / y : 1, w = y > 0 ? (i.viewBounds.yMin - h.yMin) / y : 0, p = g[1] - g[0], v = g[0] + w * p, S = v + b * p;
3149
- f.setDomain(v, S);
3240
+ const g = d.get(u), y = h.yMax - h.yMin, x = i.viewBounds.yMax - i.viewBounds.yMin, b = y > 0 ? x / y : 1, w = y > 0 ? (i.viewBounds.yMin - h.yMin) / y : 0, p = g[1] - g[0], v = g[0] + w * p, M = v + b * p;
3241
+ f.setDomain(v, M);
3150
3242
  }
3151
3243
  });
3152
3244
  i.requestRender();
@@ -3159,7 +3251,7 @@ function Mi(i, e) {
3159
3251
  }
3160
3252
  }), G;
3161
3253
  }
3162
- function Ci(i, e = !0) {
3254
+ function Bi(i, e = !0) {
3163
3255
  if (i.series.size === 0) return null;
3164
3256
  let t = 1 / 0, n = -1 / 0;
3165
3257
  const s = /* @__PURE__ */ new Map();
@@ -3172,8 +3264,8 @@ function Ci(i, e = !0) {
3172
3264
  const p = w.getBounds();
3173
3265
  if (p && isFinite(p.xMin) && isFinite(p.xMax) && isFinite(p.yMin) && isFinite(p.yMax)) {
3174
3266
  t = Math.min(t, p.xMin), n = Math.max(n, p.xMax);
3175
- const v = w.getYAxisId() || i.primaryYAxisId, S = s.get(v);
3176
- S && (S.min = Math.min(S.min, p.yMin), S.max = Math.max(S.max, p.yMax)), o = !0;
3267
+ const v = w.getYAxisId() || i.primaryYAxisId, M = s.get(v);
3268
+ M && (M.min = Math.min(M.min, p.yMin), M.max = Math.max(M.max, p.yMax)), o = !0;
3177
3269
  }
3178
3270
  }), !o) return null;
3179
3271
  const r = 1e15, a = -1e15;
@@ -3194,11 +3286,11 @@ function Ci(i, e = !0) {
3194
3286
  const g = e && i.animationConfig.enabled && i.animationConfig.autoScale.enabled;
3195
3287
  if (j != null && j.isRunning() && j.cancel(), !g)
3196
3288
  return i.viewBounds.xMin = l, i.viewBounds.xMax = h, i.viewBounds.yMin = d, i.viewBounds.yMax = c, i.yScales.forEach((w, p) => {
3197
- const v = s.get(p), S = i.yAxisOptionsMap.get(p);
3198
- if (v && (S != null && S.auto) && v.min !== 1 / 0) {
3199
- let M = v.max - v.min;
3200
- (M <= 0 || !isFinite(M)) && (M = Math.abs(v.min) * 0.1 || 1);
3201
- const A = Math.min(M * 5e-3, 1e10);
3289
+ const v = s.get(p), M = i.yAxisOptionsMap.get(p);
3290
+ if (v && (M != null && M.auto) && v.min !== 1 / 0) {
3291
+ let S = v.max - v.min;
3292
+ (S <= 0 || !isFinite(S)) && (S = Math.abs(v.min) * 0.1 || 1);
3293
+ const A = Math.min(S * 5e-3, 1e10);
3202
3294
  w.setDomain(
3203
3295
  Math.max(a, v.min - A),
3204
3296
  Math.min(r, v.max + A)
@@ -3211,11 +3303,11 @@ function Ci(i, e = !0) {
3211
3303
  });
3212
3304
  const b = /* @__PURE__ */ new Map();
3213
3305
  return i.yScales.forEach((w, p) => {
3214
- const v = s.get(p), S = i.yAxisOptionsMap.get(p);
3215
- if (v && (S != null && S.auto) && v.min !== 1 / 0) {
3216
- let M = v.max - v.min;
3217
- (M <= 0 || !isFinite(M)) && (M = Math.abs(v.min) * 0.1 || 1);
3218
- const A = Math.min(M * 5e-3, 1e10);
3306
+ const v = s.get(p), M = i.yAxisOptionsMap.get(p);
3307
+ if (v && (M != null && M.auto) && v.min !== 1 / 0) {
3308
+ let S = v.max - v.min;
3309
+ (S <= 0 || !isFinite(S)) && (S = Math.abs(v.min) * 0.1 || 1);
3310
+ const A = Math.min(S * 5e-3, 1e10);
3219
3311
  b.set(p, [
3220
3312
  Math.max(a, v.min - A),
3221
3313
  Math.min(r, v.max + A)
@@ -3227,10 +3319,10 @@ function Ci(i, e = !0) {
3227
3319
  easing: i.animationConfig.autoScale.easing,
3228
3320
  onUpdate: (w) => {
3229
3321
  i.viewBounds.xMin = y.xMin + (l - y.xMin) * w, i.viewBounds.xMax = y.xMax + (h - y.xMax) * w, i.viewBounds.yMin = y.yMin + (d - y.yMin) * w, i.viewBounds.yMax = y.yMax + (c - y.yMax) * w, i.yScales.forEach((p, v) => {
3230
- const S = x.get(v), M = b.get(v);
3322
+ const M = x.get(v), S = b.get(v);
3231
3323
  p.setDomain(
3232
- S[0] + (M[0] - S[0]) * w,
3233
- S[1] + (M[1] - S[1]) * w
3324
+ M[0] + (S[0] - M[0]) * w,
3325
+ M[1] + (S[1] - M[1]) * w
3234
3326
  );
3235
3327
  }), i.requestRender();
3236
3328
  },
@@ -3239,7 +3331,7 @@ function Ci(i, e = !0) {
3239
3331
  }
3240
3332
  }), j;
3241
3333
  }
3242
- function Ai(i, e, t) {
3334
+ function Ii(i, e, t) {
3243
3335
  const n = { ...i.viewBounds }, s = {
3244
3336
  xMin: e.xMin ?? i.viewBounds.xMin,
3245
3337
  xMax: e.xMax ?? i.viewBounds.xMax,
@@ -3262,7 +3354,7 @@ function Ai(i, e, t) {
3262
3354
  }
3263
3355
  });
3264
3356
  }
3265
- function nt(i, e, t = "degrees") {
3357
+ function ot(i, e, t = "degrees") {
3266
3358
  const n = Math.min(i.length, e.length), s = new Float32Array(n * 2), o = t === "degrees" ? Math.PI / 180 : 1;
3267
3359
  for (let r = 0; r < n; r++) {
3268
3360
  const a = i[r], l = e[r] * o;
@@ -3270,22 +3362,22 @@ function nt(i, e, t = "degrees") {
3270
3362
  }
3271
3363
  return s;
3272
3364
  }
3273
- function Pi(i, e = "degrees", t = !1) {
3274
- const n = nt(i.r, i.theta, e);
3365
+ function Ei(i, e = "degrees", t = !1) {
3366
+ const n = ot(i.r, i.theta, e);
3275
3367
  if (!t)
3276
3368
  return n;
3277
3369
  const s = n.length / 2, o = new Float32Array((s + 1) * 2);
3278
3370
  return o.set(n), o[s * 2] = n[0], o[s * 2 + 1] = n[1], o;
3279
3371
  }
3280
- function ki(i, e = "degrees", t = !0) {
3281
- const n = nt(i.r, i.theta, e), s = n.length / 2, o = t ? s : s - 1, r = new Float32Array(o * 3 * 2);
3372
+ function Ri(i, e = "degrees", t = !0) {
3373
+ const n = ot(i.r, i.theta, e), s = n.length / 2, o = t ? s : s - 1, r = new Float32Array(o * 3 * 2);
3282
3374
  for (let a = 0; a < o; a++) {
3283
3375
  const l = a * 6, h = a, d = (a + 1) % s;
3284
3376
  r[l + 0] = 0, r[l + 1] = 0, r[l + 2] = n[h * 2], r[l + 3] = n[h * 2 + 1], r[l + 4] = n[d * 2], r[l + 5] = n[d * 2 + 1];
3285
3377
  }
3286
3378
  return r;
3287
3379
  }
3288
- function Bi(i) {
3380
+ function Di(i) {
3289
3381
  const e = Math.min(i.r.length, i.theta.length);
3290
3382
  let t = 0;
3291
3383
  for (let n = 0; n < e; n++)
@@ -3298,22 +3390,22 @@ function Bi(i) {
3298
3390
  maxRadius: t
3299
3391
  };
3300
3392
  }
3301
- function Ti(i, e, t, n) {
3393
+ function Fi(i, e, t, n) {
3302
3394
  if (i === "heatmap" && t) {
3303
3395
  const { xValues: y, yValues: x } = t;
3304
3396
  let b = 1 / 0, w = -1 / 0, p = 1 / 0, v = -1 / 0;
3305
- for (let S = 0; S < y.length; S++) {
3306
- const M = y[S];
3307
- M < b && (b = M), M > w && (w = M);
3397
+ for (let M = 0; M < y.length; M++) {
3398
+ const S = y[M];
3399
+ S < b && (b = S), S > w && (w = S);
3308
3400
  }
3309
- for (let S = 0; S < x.length; S++) {
3310
- const M = x[S];
3311
- M < p && (p = M), M > v && (v = M);
3401
+ for (let M = 0; M < x.length; M++) {
3402
+ const S = x[M];
3403
+ S < p && (p = S), S > v && (v = S);
3312
3404
  }
3313
3405
  return b === 1 / 0 || p === 1 / 0 ? null : { xMin: b, xMax: w, yMin: p, yMax: v };
3314
3406
  }
3315
3407
  if (i === "polar" && n)
3316
- return Bi(n);
3408
+ return Di(n);
3317
3409
  const { x: s, y: o, y2: r, open: a, high: l, low: h, close: d } = e;
3318
3410
  if (s.length === 0) return null;
3319
3411
  let c = 1 / 0, f = -1 / 0, u = 1 / 0, g = -1 / 0;
@@ -3328,14 +3420,14 @@ function Ti(i, e, t, n) {
3328
3420
  }
3329
3421
  return c === 1 / 0 || u === 1 / 0 ? null : { xMin: c, xMax: f, yMin: u, yMax: g };
3330
3422
  }
3331
- function P(i) {
3423
+ function k(i) {
3332
3424
  return i ? i instanceof Float32Array || i instanceof Float64Array ? i : new Float32Array(i) : new Float32Array(0);
3333
3425
  }
3334
3426
  function W(i, e) {
3335
3427
  const t = new i.constructor(i.length + e.length);
3336
3428
  return t.set(i, 0), t.set(e, i.length), t;
3337
3429
  }
3338
- function Ii(i, e) {
3430
+ function Li(i, e) {
3339
3431
  const { x: t, y: n } = i, s = t.length;
3340
3432
  if (s < e) return { ...i };
3341
3433
  const o = new Float32Array(s), r = Math.floor(e / 2);
@@ -3347,7 +3439,7 @@ function Ii(i, e) {
3347
3439
  }
3348
3440
  return { x: t, y: o };
3349
3441
  }
3350
- function Ei(i, e) {
3442
+ function zi(i, e) {
3351
3443
  var s, o;
3352
3444
  if (e < 0 || e >= i.x.length) return null;
3353
3445
  if (i.yError && e < i.yError.length) {
@@ -3357,7 +3449,7 @@ function Ei(i, e) {
3357
3449
  const t = ((s = i.yErrorMinus) == null ? void 0 : s[e]) ?? 0, n = ((o = i.yErrorPlus) == null ? void 0 : o[e]) ?? 0;
3358
3450
  return t > 0 || n > 0 ? [t, n] : null;
3359
3451
  }
3360
- function Ri(i, e) {
3452
+ function Oi(i, e) {
3361
3453
  var s, o;
3362
3454
  if (e < 0 || e >= i.x.length) return null;
3363
3455
  if (i.xError && e < i.xError.length) {
@@ -3367,13 +3459,13 @@ function Ri(i, e) {
3367
3459
  const t = ((s = i.xErrorMinus) == null ? void 0 : s[e]) ?? 0, n = ((o = i.xErrorPlus) == null ? void 0 : o[e]) ?? 0;
3368
3460
  return t > 0 || n > 0 ? [t, n] : null;
3369
3461
  }
3370
- const Fi = {
3462
+ const Yi = {
3371
3463
  color: "#ff0055",
3372
3464
  width: 1.5,
3373
3465
  opacity: 1,
3374
3466
  pointSize: 4
3375
3467
  };
3376
- class Di {
3468
+ class $i {
3377
3469
  constructor(e) {
3378
3470
  m(this, "id");
3379
3471
  m(this, "type");
@@ -3431,20 +3523,20 @@ class Di {
3431
3523
  this.lastAppendCount = 0;
3432
3524
  });
3433
3525
  m(this, "hasErrorData", () => !!(this.data.yError || this.data.yErrorPlus || this.data.yErrorMinus || this.data.xError || this.data.xErrorPlus || this.data.xErrorMinus));
3434
- m(this, "getYError", (e) => Ei(this.data, e));
3435
- m(this, "getXError", (e) => Ri(this.data, e));
3526
+ m(this, "getYError", (e) => zi(this.data, e));
3527
+ m(this, "getXError", (e) => Oi(this.data, e));
3436
3528
  if (this.id = e.id, this.name = e.name, this.type = e.type, this.yAxisId = e.yAxisId, this.visible = e.visible ?? !0, this.stackId = e.stackId, this.cycle = e.cycle, this.maxPoints = e.maxPoints, this.markers = e.markers ?? [], this.type === "heatmap") {
3437
3529
  const t = e;
3438
3530
  this.data = { x: new Float32Array(0), y: new Float32Array(0) }, this.heatmapData = {
3439
- xValues: P(t.data.xValues),
3440
- yValues: P(t.data.yValues),
3441
- zValues: P(t.data.zValues)
3531
+ xValues: k(t.data.xValues),
3532
+ yValues: k(t.data.yValues),
3533
+ zValues: k(t.data.zValues)
3442
3534
  }, this.heatmapStyle = t.style;
3443
3535
  } else if (this.type === "polar") {
3444
3536
  const t = e;
3445
3537
  this.polarData = {
3446
- r: P(t.data.r),
3447
- theta: P(t.data.theta)
3538
+ r: k(t.data.r),
3539
+ theta: k(t.data.theta)
3448
3540
  }, this.data = { x: new Float32Array(0), y: new Float32Array(0) };
3449
3541
  } else if (this.type === "gauge") {
3450
3542
  const t = e;
@@ -3455,40 +3547,40 @@ class Di {
3455
3547
  } else {
3456
3548
  const t = e.data;
3457
3549
  this.data = {
3458
- x: P(t == null ? void 0 : t.x),
3459
- y: P(t == null ? void 0 : t.y),
3460
- yError: t != null && t.yError ? P(t.yError) : void 0,
3461
- yErrorPlus: t != null && t.yErrorPlus ? P(t.yErrorPlus) : void 0,
3462
- yErrorMinus: t != null && t.yErrorMinus ? P(t.yErrorMinus) : void 0,
3463
- xError: t != null && t.xError ? P(t.xError) : void 0,
3464
- xErrorPlus: t != null && t.xErrorPlus ? P(t.xErrorPlus) : void 0,
3465
- xErrorMinus: t != null && t.xErrorMinus ? P(t.xErrorMinus) : void 0,
3466
- y2: t != null && t.y2 ? P(t.y2) : void 0,
3467
- open: t != null && t.open ? P(t.open) : void 0,
3468
- high: t != null && t.high ? P(t.high) : void 0,
3469
- low: t != null && t.low ? P(t.low) : void 0,
3470
- close: t != null && t.close ? P(t.close) : void 0,
3471
- median: t != null && t.median ? P(t.median) : void 0
3550
+ x: k(t == null ? void 0 : t.x),
3551
+ y: k(t == null ? void 0 : t.y),
3552
+ yError: t != null && t.yError ? k(t.yError) : void 0,
3553
+ yErrorPlus: t != null && t.yErrorPlus ? k(t.yErrorPlus) : void 0,
3554
+ yErrorMinus: t != null && t.yErrorMinus ? k(t.yErrorMinus) : void 0,
3555
+ xError: t != null && t.xError ? k(t.xError) : void 0,
3556
+ xErrorPlus: t != null && t.xErrorPlus ? k(t.xErrorPlus) : void 0,
3557
+ xErrorMinus: t != null && t.xErrorMinus ? k(t.xErrorMinus) : void 0,
3558
+ y2: t != null && t.y2 ? k(t.y2) : void 0,
3559
+ open: t != null && t.open ? k(t.open) : void 0,
3560
+ high: t != null && t.high ? k(t.high) : void 0,
3561
+ low: t != null && t.low ? k(t.low) : void 0,
3562
+ close: t != null && t.close ? k(t.close) : void 0,
3563
+ median: t != null && t.median ? k(t.median) : void 0
3472
3564
  }, this.type === "candlestick" && this.data.close && this.data.y.length !== this.data.x.length && (this.data.y = this.data.close);
3473
3565
  }
3474
- this.style = { ...Fi, ...e.style }, e.color && (this.style.color = e.color), e.width && (this.style.width = e.width), e.pointSize && (this.style.pointSize = e.pointSize);
3566
+ this.style = { ...Yi, ...e.style }, e.color && (this.style.color = e.color), e.width && (this.style.width = e.width), e.pointSize && (this.style.pointSize = e.pointSize);
3475
3567
  }
3476
3568
  getData() {
3477
- return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData = Ii(this.data, 5), this.smoothingNeedsUpdate = !1), this.smoothedData) : this.data;
3569
+ return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData = Li(this.data, 5), this.smoothingNeedsUpdate = !1), this.smoothedData) : this.data;
3478
3570
  }
3479
3571
  getBounds() {
3480
- return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds = Ti(this.type, this.data, this.heatmapData, this.polarData), this.boundsNeedsUpdate = !1), this.cachedBounds);
3572
+ return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds = Fi(this.type, this.data, this.heatmapData, this.polarData), this.boundsNeedsUpdate = !1), this.cachedBounds);
3481
3573
  }
3482
3574
  updateData(e) {
3483
3575
  if (e) {
3484
3576
  if (e.append) {
3485
- const t = P(e.x), n = P(e.y);
3486
- if (t.length > 0 && (this.data.x = W(this.data.x, t), this.data.y = W(this.data.y, n), e.y2 && (this.data.y2 = this.data.y2 ? W(this.data.y2, P(e.y2)) : P(e.y2)), e.open && (this.data.open = this.data.open ? W(this.data.open, P(e.open)) : P(e.open)), e.high && (this.data.high = this.data.high ? W(this.data.high, P(e.high)) : P(e.high)), e.low && (this.data.low = this.data.low ? W(this.data.low, P(e.low)) : P(e.low)), e.close && (this.data.close = this.data.close ? W(this.data.close, P(e.close)) : P(e.close)), e.median && (this.data.median = this.data.median ? W(this.data.median, P(e.median)) : P(e.median)), this.lastAppendCount += t.length, this.maxPoints && this.data.x.length > this.maxPoints)) {
3577
+ const t = k(e.x), n = k(e.y);
3578
+ if (t.length > 0 && (this.data.x = W(this.data.x, t), this.data.y = W(this.data.y, n), e.y2 && (this.data.y2 = this.data.y2 ? W(this.data.y2, k(e.y2)) : k(e.y2)), e.open && (this.data.open = this.data.open ? W(this.data.open, k(e.open)) : k(e.open)), e.high && (this.data.high = this.data.high ? W(this.data.high, k(e.high)) : k(e.high)), e.low && (this.data.low = this.data.low ? W(this.data.low, k(e.low)) : k(e.low)), e.close && (this.data.close = this.data.close ? W(this.data.close, k(e.close)) : k(e.close)), e.median && (this.data.median = this.data.median ? W(this.data.median, k(e.median)) : k(e.median)), this.lastAppendCount += t.length, this.maxPoints && this.data.x.length > this.maxPoints)) {
3487
3579
  const s = this.data.x.length - this.maxPoints;
3488
3580
  this.data.x = this.data.x.slice(s), this.data.y = this.data.y.slice(s), this.data.y2 && (this.data.y2 = this.data.y2.slice(s)), this.data.open && (this.data.open = this.data.open.slice(s)), this.data.high && (this.data.high = this.data.high.slice(s)), this.data.low && (this.data.low = this.data.low.slice(s)), this.data.close && (this.data.close = this.data.close.slice(s)), this.lastAppendCount = 0;
3489
3581
  }
3490
3582
  } else
3491
- e.x && (this.data.x = P(e.x)), e.y && (this.data.y = P(e.y)), e.y2 && (this.data.y2 = P(e.y2)), e.open && (this.data.open = P(e.open)), e.high && (this.data.high = P(e.high)), e.low && (this.data.low = P(e.low)), e.close && (this.data.close = P(e.close)), e.median && (this.data.median = P(e.median)), this.type === "gauge" && e.value !== void 0 && (this.gaugeData = { ...this.gaugeData, ...e }), this.type === "sankey" && (e.nodes || e.links) && (this.sankeyData = { ...this.sankeyData, ...e }), this.lastAppendCount = 0;
3583
+ e.x && (this.data.x = k(e.x)), e.y && (this.data.y = k(e.y)), e.y2 && (this.data.y2 = k(e.y2)), e.open && (this.data.open = k(e.open)), e.high && (this.data.high = k(e.high)), e.low && (this.data.low = k(e.low)), e.close && (this.data.close = k(e.close)), e.median && (this.data.median = k(e.median)), this.type === "gauge" && e.value !== void 0 && (this.gaugeData = { ...this.gaugeData, ...e }), this.type === "sankey" && (e.nodes || e.links) && (this.sankeyData = { ...this.sankeyData, ...e }), this.lastAppendCount = 0;
3492
3584
  this.boundsNeedsUpdate = !0, this.smoothingNeedsUpdate = !0, this._needsBufferUpdate = !0;
3493
3585
  }
3494
3586
  }
@@ -3524,7 +3616,7 @@ class Di {
3524
3616
  this.data = { x: new Float32Array(0), y: new Float32Array(0) }, this.cachedBounds = null;
3525
3617
  }
3526
3618
  }
3527
- function Li(i, e, t) {
3619
+ function _i(i, e, t) {
3528
3620
  const n = Math.min(i.length, e.length), s = new Float32Array(n * 6 * 2), o = t * 0.5;
3529
3621
  for (let r = 0; r < n; r++) {
3530
3622
  const a = i[r], l = e[r], h = r * 12, d = a - o, c = a + o, f = 0, u = l;
@@ -3532,7 +3624,7 @@ function Li(i, e, t) {
3532
3624
  }
3533
3625
  return s;
3534
3626
  }
3535
- function me(i) {
3627
+ function be(i) {
3536
3628
  if (i.length < 2) return 1;
3537
3629
  let e = 1 / 0;
3538
3630
  for (let t = 1; t < i.length; t++) {
@@ -3541,7 +3633,7 @@ function me(i) {
3541
3633
  }
3542
3634
  return e === 1 / 0 ? 1 : e * 0.8;
3543
3635
  }
3544
- function zi(i, e, t) {
3636
+ function Vi(i, e, t) {
3545
3637
  const n = i.length, s = e.length;
3546
3638
  n * s > t.length && console.warn("[Heatmap] Z array is too small for the specified grid dimensions");
3547
3639
  const o = (n - 1) * (s - 1), r = new Float32Array(o * 6 * 3);
@@ -3553,7 +3645,7 @@ function zi(i, e, t) {
3553
3645
  }
3554
3646
  return r;
3555
3647
  }
3556
- function Oi(i = "viridis") {
3648
+ function Xi(i = "viridis") {
3557
3649
  const t = new Uint8Array(1024);
3558
3650
  for (let n = 0; n < 256; n++) {
3559
3651
  const s = n / 255;
@@ -3562,26 +3654,26 @@ function Oi(i = "viridis") {
3562
3654
  }
3563
3655
  return t;
3564
3656
  }
3565
- function $i(i, e, t, n, s, o, r = !1) {
3657
+ function Wi(i, e, t, n, s, o, r = !1) {
3566
3658
  const a = i.length, l = [], h = [], d = o / 2, f = o / 10 / 2;
3567
3659
  for (let u = 0; u < a; u++) {
3568
3660
  if (!Number.isFinite(i[u])) continue;
3569
3661
  const g = s[u] >= e[u], y = g ? l : h, x = Math.max(e[u], s[u]), b = Math.min(e[u], s[u]);
3570
- r && g || Ve(y, i[u] - d, b, i[u] + d, x), Ve(y, i[u] - f, n[u], i[u] + f, t[u]);
3662
+ r && g || Xe(y, i[u] - d, b, i[u] + d, x), Xe(y, i[u] - f, n[u], i[u] + f, t[u]);
3571
3663
  }
3572
3664
  return {
3573
3665
  bullish: new Float32Array(l),
3574
3666
  bearish: new Float32Array(h)
3575
3667
  };
3576
3668
  }
3577
- function Ve(i, e, t, n, s) {
3669
+ function Xe(i, e, t, n, s) {
3578
3670
  i.push(e, t, n, t, e, s), i.push(n, t, n, s, e, s);
3579
3671
  }
3580
3672
  function ce(i, e) {
3581
3673
  if (!i.renderer) return;
3582
3674
  const t = e.getStackId();
3583
3675
  if (t) {
3584
- Vi(i, t);
3676
+ Ui(i, t);
3585
3677
  return;
3586
3678
  }
3587
3679
  const n = e.getData(), s = e.getType();
@@ -3589,16 +3681,16 @@ function ce(i, e) {
3589
3681
  const o = e.getId();
3590
3682
  if (s === "band" || s === "area") {
3591
3683
  const r = s === "area" ? new Float32Array(n.x.length).fill(0) : n.y2 || new Float32Array(n.x.length).fill(0);
3592
- i.renderer.createBuffer(o, Je(n.x, n.y, r));
3684
+ i.renderer.createBuffer(o, et(n.x, n.y, r));
3593
3685
  } else if (s === "bar") {
3594
- const r = e.getStyle().barWidth ?? me(n.x);
3595
- i.renderer.createBuffer(o, Li(n.x, n.y, r));
3686
+ const r = e.getStyle().barWidth ?? be(n.x);
3687
+ i.renderer.createBuffer(o, _i(n.x, n.y, r));
3596
3688
  } else if (s === "heatmap")
3597
- _i(i, e);
3689
+ Hi(i, e);
3598
3690
  else if (s === "candlestick") {
3599
3691
  const r = e.getData();
3600
3692
  if (r.open && r.high && r.low && r.close) {
3601
- const a = e.getStyle().barWidth ?? me(r.x), l = !!e.getStyle().hollow, { bullish: h, bearish: d } = $i(
3693
+ const a = e.getStyle().barWidth ?? be(r.x), l = !!e.getStyle().hollow, { bullish: h, bearish: d } = Wi(
3602
3694
  r.x,
3603
3695
  r.open,
3604
3696
  r.high,
@@ -3612,20 +3704,20 @@ function ce(i, e) {
3612
3704
  } else if (s === "boxplot") {
3613
3705
  const r = e.getData();
3614
3706
  if (r.low && r.open && r.median && r.close && r.high) {
3615
- const a = e.getStyle().barWidth ?? me(r.x), { lines: l, boxes: h } = zt(r.x, r.low, r.open, r.median, r.close, r.high, a);
3707
+ const a = e.getStyle().barWidth ?? be(r.x), { lines: l, boxes: h } = _t(r.x, r.low, r.open, r.median, r.close, r.high, a);
3616
3708
  i.renderer.createBuffer(`${o}_box_lines`, l), i.renderer.createBuffer(`${o}_box_faces`, h);
3617
3709
  }
3618
3710
  } else if (s === "waterfall") {
3619
- const r = e.getData(), a = e.getStyle().barWidth ?? me(r.x), l = e.getStyle().isSubtotal, h = Ot(r.x, r.y, a, l);
3711
+ const r = e.getData(), a = e.getStyle().barWidth ?? be(r.x), l = e.getStyle().isSubtotal, h = Vt(r.x, r.y, a, l);
3620
3712
  i.renderer.createBuffer(`${o}_wf_positive`, h.positiveData), i.renderer.createBuffer(`${o}_wf_negative`, h.negativeData), i.renderer.createBuffer(`${o}_wf_subtotal`, h.subtotalData), i.renderer.createBuffer(`${o}_wf_connectors`, h.connectorData), e.waterfallCounts = {
3621
3713
  positive: h.positiveCount,
3622
3714
  negative: h.negativeCount,
3623
3715
  subtotal: h.subtotalCount,
3624
3716
  connectors: h.connectorData.length / 2
3625
3717
  };
3626
- } else s === "polar" ? Yi(i, e) : i.renderer.createBuffer(o, Qe(n.x, n.y));
3718
+ } else s === "polar" ? Ni(i, e) : i.renderer.createBuffer(o, Ke(n.x, n.y));
3627
3719
  if (e.hasErrorData()) {
3628
- const r = e.getData(), a = Lt(
3720
+ const r = e.getData(), a = $t(
3629
3721
  r.x,
3630
3722
  r.y,
3631
3723
  { yError: r.yError, yErrorMinus: r.yErrorMinus, yErrorPlus: r.yErrorPlus },
@@ -3635,31 +3727,31 @@ function ce(i, e) {
3635
3727
  }
3636
3728
  if (s === "step" || s === "step+scatter") {
3637
3729
  const r = e.getStyle().stepMode ?? "after";
3638
- i.renderer.createBuffer(`${o}_step`, Dt(n.x, n.y, r));
3730
+ i.renderer.createBuffer(`${o}_step`, Yt(n.x, n.y, r));
3639
3731
  }
3640
3732
  e.resetLastAppendCount();
3641
3733
  }
3642
- function Yi(i, e) {
3734
+ function Ni(i, e) {
3643
3735
  const t = e.getPolarData();
3644
3736
  if (!t || t.r.length === 0) return;
3645
3737
  const n = e.getStyle(), s = n.angleMode || "degrees", o = n.closePath !== !1;
3646
3738
  if (n.fill || !1) {
3647
- const a = ki(t, s, o);
3739
+ const a = Ri(t, s, o);
3648
3740
  i.renderer.createBuffer(e.getId(), a);
3649
3741
  } else {
3650
- const a = Pi(t, s, o);
3742
+ const a = Ei(t, s, o);
3651
3743
  i.renderer.createBuffer(e.getId(), a);
3652
3744
  }
3653
3745
  }
3654
- function _i(i, e) {
3746
+ function Hi(i, e) {
3655
3747
  var o;
3656
3748
  const t = e.getHeatmapData(), n = e.getHeatmapStyle();
3657
3749
  if (!t || t.xValues.length < 2) return;
3658
- i.renderer.createBuffer(e.getId(), zi(t.xValues, t.yValues, t.zValues));
3750
+ i.renderer.createBuffer(e.getId(), Vi(t.xValues, t.yValues, t.zValues));
3659
3751
  const s = ((o = n == null ? void 0 : n.colorScale) == null ? void 0 : o.name) || "viridis";
3660
- i.renderer.createColormapTexture(`${e.getId()}_colormap`, Oi(s));
3752
+ i.renderer.createColormapTexture(`${e.getId()}_colormap`, Xi(s));
3661
3753
  }
3662
- function Vi(i, e) {
3754
+ function Ui(i, e) {
3663
3755
  const t = Array.from(i.series.values()).filter((s) => s.getStackId() === e);
3664
3756
  let n = null;
3665
3757
  for (const s of t) {
@@ -3668,13 +3760,13 @@ function Vi(i, e) {
3668
3760
  n || (n = new Float32Array(o.y.length).fill(0));
3669
3761
  const r = new Float32Array(n);
3670
3762
  for (let a = 0; a < o.y.length; a++) n[a] += o.y[a];
3671
- i.renderer.createBuffer(s.getId(), Je(o.x, n, r)), s.resetLastAppendCount();
3763
+ i.renderer.createBuffer(s.getId(), et(o.x, n, r)), s.resetLastAppendCount();
3672
3764
  }
3673
3765
  }
3674
- function N(i) {
3766
+ function H(i) {
3675
3767
  return i instanceof Float32Array || i instanceof Float64Array ? i : Float32Array.from(i);
3676
3768
  }
3677
- function Wi(i) {
3769
+ function qi(i) {
3678
3770
  const e = new Float32Array(i.length), t = new Float32Array(i.length);
3679
3771
  for (let n = 0; n < i.length; n++) {
3680
3772
  const s = i[n];
@@ -3682,13 +3774,13 @@ function Wi(i) {
3682
3774
  }
3683
3775
  return { positive: e, negative: t };
3684
3776
  }
3685
- function Xi(i, e, t) {
3777
+ function Gi(i, e, t) {
3686
3778
  if (i === void 0 || i === "zero") return 0;
3687
3779
  if (typeof i == "number") return i;
3688
3780
  const n = t.find((o) => o.id === i);
3689
- return n ? N(n.y)[e] ?? 0 : 0;
3781
+ return n ? H(n.y)[e] ?? 0 : 0;
3690
3782
  }
3691
- function Ni(i, e, t, n, s) {
3783
+ function ji(i, e, t, n, s) {
3692
3784
  const o = i.length;
3693
3785
  if (o === 0) return [];
3694
3786
  if (o === 1) {
@@ -3709,21 +3801,16 @@ function Ni(i, e, t, n, s) {
3709
3801
  h(i[c], e[c], l(c));
3710
3802
  continue;
3711
3803
  }
3712
- const w = u - f - (y - g);
3713
- let p = w !== 0 ? (g - f) / w : 0.5;
3714
- p = Math.max(0, Math.min(1, p));
3715
- const v = i[c - 1] + p * (i[c] - i[c - 1]), S = f + p * (u - f), M = x ? n : s, A = b ? n : s;
3716
- h(v, S, M), d(), h(v, S, A), h(i[c], e[c], l(c));
3804
+ const w = u - f - (y - g), p = Math.max(0, Math.min(1, (g - f) / w)), v = i[c - 1] + p * (i[c] - i[c - 1]), M = f + p * (u - f), S = x ? n : s, A = b ? n : s;
3805
+ h(v, M, S), d(), h(v, M, A), h(i[c], e[c], l(c));
3717
3806
  }
3718
3807
  return d(), r;
3719
3808
  }
3720
- function Hi(i, e, t, n, s, o, r, a) {
3721
- const l = s.colorZones;
3722
- if (!l) return;
3723
- const d = Ni(
3809
+ function Zi(i, e, t, n, s, o, r, a) {
3810
+ const l = s.colorZones, d = ji(
3724
3811
  t,
3725
3812
  n,
3726
- (c) => Xi(l.ref, c, o),
3813
+ (c) => Gi(l.ref, c, o),
3727
3814
  l.aboveColor,
3728
3815
  l.belowColor
3729
3816
  );
@@ -3745,7 +3832,7 @@ function Hi(i, e, t, n, s, o, r, a) {
3745
3832
  });
3746
3833
  }
3747
3834
  }
3748
- const Ui = {
3835
+ const Qi = {
3749
3836
  baselineColor: "rgba(255,255,255,0.35)",
3750
3837
  baselineWidth: 1,
3751
3838
  baselineDash: [4, 4],
@@ -3754,9 +3841,9 @@ const Ui = {
3754
3841
  peakSize: 6,
3755
3842
  troughSize: 6
3756
3843
  };
3757
- function we(i) {
3844
+ function Me(i) {
3758
3845
  var h, d, c, f;
3759
- const { id: e, data: t, style: n = {}, visible: s = !0 } = i, o = { ...Ui, ...n }, r = N(t.x), a = r.length, l = [];
3846
+ const { id: e, data: t, style: n = {}, visible: s = !0 } = i, o = { ...Qi, ...n }, r = H(t.x), a = r.length, l = [];
3760
3847
  if ((h = t.fills) != null && h.length)
3761
3848
  for (let u = 0; u < t.fills.length; u++) {
3762
3849
  const g = t.fills[u], y = g.id ?? `${e}-fill-${u}`;
@@ -3766,8 +3853,8 @@ function we(i) {
3766
3853
  visible: s,
3767
3854
  data: {
3768
3855
  x: r,
3769
- y: N(g.upper),
3770
- y2: N(g.lower)
3856
+ y: H(g.upper),
3857
+ y2: H(g.lower)
3771
3858
  },
3772
3859
  style: {
3773
3860
  color: g.color ?? "rgba(100, 80, 180, 0.25)",
@@ -3776,7 +3863,7 @@ function we(i) {
3776
3863
  });
3777
3864
  }
3778
3865
  if (t.histogram) {
3779
- const u = N(t.histogram.y), { positive: g, negative: y } = Wi(u), x = t.histogram.barWidth, b = x !== void 0 ? { barWidth: x } : {};
3866
+ const u = H(t.histogram.y), { positive: g, negative: y } = qi(u), x = t.histogram.barWidth, b = x !== void 0 ? { barWidth: x } : {};
3780
3867
  l.push({
3781
3868
  id: `${e}-hist-pos`,
3782
3869
  type: "bar",
@@ -3801,9 +3888,9 @@ function we(i) {
3801
3888
  }
3802
3889
  if ((d = t.lines) != null && d.length)
3803
3890
  for (let u = 0; u < t.lines.length; u++) {
3804
- const g = t.lines[u], y = g.id ?? `${e}-line-${u}`, x = N(g.y);
3891
+ const g = t.lines[u], y = g.id ?? `${e}-line-${u}`, x = H(g.y);
3805
3892
  if (g.colorZones) {
3806
- Hi(l, y, r, x, g, t.lines, s, "zone");
3893
+ Zi(l, y, r, x, g, t.lines, s, "zone");
3807
3894
  continue;
3808
3895
  }
3809
3896
  l.push({
@@ -3887,11 +3974,11 @@ function we(i) {
3887
3974
  }
3888
3975
  return l;
3889
3976
  }
3890
- function os(i) {
3891
- return we(i);
3977
+ function ds(i) {
3978
+ return Me(i);
3892
3979
  }
3893
- function rs(i, e, t = 3) {
3894
- const n = N(i), s = N(e), o = [], r = Math.max(1, t);
3980
+ function fs(i, e, t = 3) {
3981
+ const n = H(i), s = H(e), o = [], r = Math.max(1, t);
3895
3982
  for (let a = r; a < s.length - r; a++) {
3896
3983
  let l = !0, h = !0;
3897
3984
  for (let d = a - r; d <= a + r; d++)
@@ -3900,7 +3987,7 @@ function rs(i, e, t = 3) {
3900
3987
  }
3901
3988
  return o;
3902
3989
  }
3903
- function qi(i) {
3990
+ function Ji(i) {
3904
3991
  const e = i.close.length, t = new Float32Array(e), n = new Float32Array(e), s = new Float32Array(e), o = new Float32Array(e);
3905
3992
  for (let r = 0; r < e; r++) {
3906
3993
  const a = i.open[r], l = i.high[r], h = i.low[r], d = i.close[r];
@@ -3908,7 +3995,7 @@ function qi(i) {
3908
3995
  }
3909
3996
  return { open: t, high: n, low: s, close: o };
3910
3997
  }
3911
- function Gi(i, e) {
3998
+ function Ki(i, e) {
3912
3999
  var n, s;
3913
4000
  if (e.type === "heatmap" || e.type === "indicator")
3914
4001
  return e;
@@ -3916,7 +4003,7 @@ function Gi(i, e) {
3916
4003
  if (t.type === "heikin-ashi") {
3917
4004
  const o = t.data;
3918
4005
  if (o != null && o.open && o.high && o.low && o.close) {
3919
- const r = qi({
4006
+ const r = Ji({
3920
4007
  open: o.open,
3921
4008
  high: o.high,
3922
4009
  low: o.low,
@@ -3929,8 +4016,8 @@ function Gi(i, e) {
3929
4016
  };
3930
4017
  }
3931
4018
  }
3932
- if (je(i.xAxisOptions) && ((s = (n = t.data) == null ? void 0 : n.x) != null && s.length)) {
3933
- const { displayX: o, mapping: r } = Ze(t.data.x, i.xAxisOptions);
4019
+ if (Qe(i.xAxisOptions) && ((s = (n = t.data) == null ? void 0 : n.x) != null && s.length)) {
4020
+ const { displayX: o, mapping: r } = Je(t.data.x, i.xAxisOptions);
3934
4021
  i.timeScaleMapping = r, t = {
3935
4022
  ...t,
3936
4023
  data: { ...t.data, x: o }
@@ -3938,64 +4025,72 @@ function Gi(i, e) {
3938
4025
  }
3939
4026
  return t;
3940
4027
  }
3941
- function ji(i) {
3942
- return i.type === "indicator" ? we(i) : [i];
4028
+ function en(i) {
4029
+ return i.type === "indicator" ? Me(i) : [i];
3943
4030
  }
3944
- function Zi(i, e) {
3945
- for (const t of ji(e))
3946
- Qi(i, t);
4031
+ function tn(i, e) {
4032
+ for (const t of en(e))
4033
+ nn(i, t);
3947
4034
  }
3948
- function Qi(i, e) {
4035
+ function nn(i, e) {
3949
4036
  var s, o;
3950
- const t = Gi(i, e);
4037
+ const t = Ki(i, e);
3951
4038
  if (t.type !== "heatmap" && !((s = t.style) != null && s.color) && !t.color && i.colorScheme) {
3952
4039
  const r = i.series.size, a = i.colorScheme.colors[r % i.colorScheme.colors.length];
3953
4040
  t.style || (t.style = {}), t.style.color = a;
3954
4041
  }
3955
- const n = new Di(t);
4042
+ const n = new $i(t);
3956
4043
  i.series.set(n.getId(), n), ce(i, n), (i.xAxisOptions.auto || Array.from(i.yAxisOptionsMap.values()).some((r) => r.auto)) && i.autoScale(!1), (o = i.updateLegend) == null || o.call(i), i.requestRender();
3957
4044
  }
3958
- function Ji(i, e) {
4045
+ function sn(i, e) {
3959
4046
  var n;
3960
4047
  const t = i.series.get(e);
3961
4048
  t && (i.renderer.deleteBuffer(e), i.renderer.deleteBuffer(`${e}_step`), t.destroy(), i.series.delete(e), (n = i.updateLegend) == null || n.call(i), i.requestRender());
3962
4049
  }
3963
- function Ki(i, e, t) {
4050
+ function on(i, e, t) {
4051
+ var a;
3964
4052
  const n = i.series.get(e);
3965
- if (n) {
3966
- let s = t;
3967
- if (t.x && je(i.xAxisOptions)) {
3968
- const { displayX: o, mapping: r } = Ze(t.x, i.xAxisOptions);
3969
- i.timeScaleMapping = r, s = { ...t, x: o };
4053
+ if (!n) return;
4054
+ const s = !!t.append, o = s ? ((a = n.getBounds()) == null ? void 0 : a.xMax) ?? -1 / 0 : -1 / 0;
4055
+ let r = t;
4056
+ if (t.x && Qe(i.xAxisOptions)) {
4057
+ const { displayX: l, mapping: h } = Je(t.x, i.xAxisOptions);
4058
+ i.timeScaleMapping = h, r = { ...t, x: l };
4059
+ }
4060
+ n.updateData(r), ce(i, n), s && rt(i, n, o), i.requestRender();
4061
+ }
4062
+ function rt(i, e, t) {
4063
+ if (i.autoScrollEnabled) {
4064
+ const n = e.getBounds();
4065
+ if (n) {
4066
+ const s = i.viewBounds.xMax - i.viewBounds.xMin;
4067
+ if (t >= i.viewBounds.xMax - Math.max(s * 0.05, 1e-9)) {
4068
+ const o = s > 0 ? s : Math.max(n.xMax - n.xMin, 1);
4069
+ i.viewBounds.xMax = n.xMax, i.viewBounds.xMin = i.viewBounds.xMax - o;
4070
+ }
4071
+ }
4072
+ Array.from(i.yAxisOptionsMap.values()).some((s) => s.auto) && i.autoScaleYOnly();
4073
+ return;
4074
+ }
4075
+ if (Array.from(i.yAxisOptionsMap.values()).some((n) => n.auto) && i.autoScaleYOnly(), i.xAxisOptions.auto) {
4076
+ const n = e.getBounds();
4077
+ if (n) {
4078
+ const s = i.viewBounds.xMax - i.viewBounds.xMin, o = n.xMax - n.xMin;
4079
+ if (n.xMax > i.viewBounds.xMax || n.xMin < i.viewBounds.xMin || s > 0 && Math.abs(o - s) / s > 0.1) {
4080
+ const r = Math.min(o * 5e-3, 1e10);
4081
+ i.viewBounds.xMin = Math.max(-1e15, n.xMin - r), i.viewBounds.xMax = Math.min(1e15, n.xMax + r);
4082
+ }
3970
4083
  }
3971
- n.updateData(s), ce(i, n), i.requestRender();
3972
4084
  }
3973
4085
  }
3974
- function en(i, e, t, n) {
4086
+ function rn(i, e, t, n) {
3975
4087
  var r;
3976
4088
  const s = i.series.get(e);
3977
4089
  if (!s) return;
3978
4090
  const o = ((r = s.getBounds()) == null ? void 0 : r.xMax) ?? -1 / 0;
3979
- if (s.updateData({ x: t, y: n, append: !0 }), ce(i, s), i.autoScrollEnabled) {
3980
- const a = s.getBounds();
3981
- if (a) {
3982
- const l = i.viewBounds.xMax - i.viewBounds.xMin;
3983
- o >= i.viewBounds.xMax - l * 0.05 && (i.viewBounds.xMax = a.xMax, i.viewBounds.xMin = i.viewBounds.xMax - l);
3984
- }
3985
- Array.from(i.yAxisOptionsMap.values()).some((l) => l.auto) && i.autoScaleYOnly();
3986
- } else if (Array.from(i.yAxisOptionsMap.values()).some((a) => a.auto) && i.autoScaleYOnly(), i.xAxisOptions.auto) {
3987
- const a = s.getBounds();
3988
- if (a) {
3989
- const l = i.viewBounds.xMax - i.viewBounds.xMin, h = a.xMax - a.xMin;
3990
- if (a.xMax > i.viewBounds.xMax || a.xMin < i.viewBounds.xMin || Math.abs(h - l) / l > 0.1) {
3991
- const d = Math.min(h * 5e-3, 1e10);
3992
- i.viewBounds.xMin = Math.max(-1e15, a.xMin - d), i.viewBounds.xMax = Math.min(1e15, a.xMax + d);
3993
- }
3994
- }
3995
- }
3996
- i.requestRender();
4091
+ s.updateData({ x: t, y: n, append: !0 }), ce(i, s), rt(i, s, o), i.requestRender();
3997
4092
  }
3998
- function tn(i, e, t) {
4093
+ function an(i, e, t) {
3999
4094
  const n = i.series.get(e);
4000
4095
  n && (n.setMaxPoints(t), i.requestRender());
4001
4096
  }
@@ -4030,7 +4125,7 @@ class te {
4030
4125
  ticks(e = 10) {
4031
4126
  const [t, n] = this.domain;
4032
4127
  if (!isFinite(t) || !isFinite(n) || t === n) return [];
4033
- const s = nn(t, n, e), o = Math.ceil(t / s) * s, r = [], a = 100;
4128
+ const s = ln(t, n, e), o = Math.ceil(t / s) * s, r = [], a = 100;
4034
4129
  let l = o;
4035
4130
  for (; l <= n + s * 0.5 && r.length < a; )
4036
4131
  r.push(Math.round(l * 1e12) / 1e12), l += s;
@@ -4074,14 +4169,14 @@ class ie {
4074
4169
  return r;
4075
4170
  }
4076
4171
  }
4077
- function nn(i, e, t) {
4172
+ function ln(i, e, t) {
4078
4173
  const n = e - i;
4079
4174
  if (n <= 0 || !isFinite(n)) return 1;
4080
4175
  const s = n / t, o = Math.pow(10, Math.floor(Math.log10(s))), r = s / o;
4081
4176
  let a;
4082
4177
  return r < 1.5 ? a = 1 : r < 3 ? a = 2 : r < 7 ? a = 5 : a = 10, a * o;
4083
4178
  }
4084
- function as(i) {
4179
+ function gs(i) {
4085
4180
  return i === "log" ? new ie() : new te();
4086
4181
  }
4087
4182
  const O = {
@@ -4150,7 +4245,7 @@ const O = {
4150
4245
  },
4151
4246
  autoMargins: !0
4152
4247
  };
4153
- function st(i) {
4248
+ function at(i) {
4154
4249
  var e;
4155
4250
  return i ? {
4156
4251
  title: { ...O.title, ...i.title },
@@ -4171,23 +4266,23 @@ function st(i) {
4171
4266
  autoMargins: i.autoMargins ?? O.autoMargins
4172
4267
  } : { ...O };
4173
4268
  }
4174
- function sn(i, e) {
4175
- var M;
4176
- if (!i) throw new Error("[SciPlot] Container element is required");
4177
- const t = e.devicePixelRatio ?? window.devicePixelRatio, n = st(e.layout), s = typeof e.theme == "string" ? et(e.theme) : e.theme ?? ti, o = _(e.background ?? s.backgroundColor), r = [o[0], o[1], o[2], o[3]], a = _(s.plotAreaBackground), l = [a[0], a[1], a[2], a[3]], h = e.showLegend ?? s.legend.visible, d = ((M = e.toolbar) == null ? void 0 : M.show) ?? e.showControls ?? !1, c = e.autoScroll ?? !1, f = e.showStatistics ?? !1, u = { scale: "linear", auto: !0, ...e.xAxis }, g = u.scale === "log" ? new ie() : new te(), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
4269
+ function hn(i, e) {
4270
+ var S;
4271
+ if (!i) throw new Error("[VeloPlot] Container element is required");
4272
+ const t = e.devicePixelRatio ?? window.devicePixelRatio, n = at(e.layout), s = typeof e.theme == "string" ? it(e.theme) : e.theme ?? ri, o = _(e.background ?? s.backgroundColor), r = [o[0], o[1], o[2], o[3]], a = _(s.plotAreaBackground), l = [a[0], a[1], a[2], a[3]], h = e.showLegend ?? s.legend.visible, d = ((S = e.toolbar) == null ? void 0 : S.show) ?? e.showControls ?? !1, c = e.autoScroll ?? !1, f = e.showStatistics ?? !1, u = { scale: "linear", auto: !0, ...e.xAxis }, g = u.scale === "log" ? new ie() : new te(), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
4178
4273
  let b = "default";
4179
- (e.yAxis ? Array.isArray(e.yAxis) ? e.yAxis : [e.yAxis] : [{}]).forEach((A, k) => {
4180
- const B = k === 0, F = B ? "default" : `y${k}`, I = A.id || F;
4181
- B && (b = I);
4182
- const U = { scale: "linear", auto: !0, position: A.position || (B ? "left" : "right"), ...A, id: I };
4274
+ (e.yAxis ? Array.isArray(e.yAxis) ? e.yAxis : [e.yAxis] : [{}]).forEach((A, P) => {
4275
+ const T = P === 0, D = T ? "default" : `y${P}`, I = A.id || D;
4276
+ T && (b = I);
4277
+ const U = { scale: "linear", auto: !0, position: A.position || (T ? "left" : "right"), ...A, id: I };
4183
4278
  y.set(I, U), x.set(I, U.scale === "log" ? new ie() : new te());
4184
- }), i.style.position = "relative", i.style.overflow = "hidden", i.style.backgroundColor = e.background ?? s.backgroundColor;
4279
+ }), i.style.position !== "absolute" && (i.style.position = "relative"), i.style.overflow = "hidden", i.style.backgroundColor = e.background ?? s.backgroundColor;
4185
4280
  const p = We("webgl"), v = We("overlay");
4186
4281
  for (; i.firstChild; )
4187
4282
  i.removeChild(i.firstChild);
4188
4283
  i.appendChild(p), i.appendChild(v);
4189
- const S = v.getContext("2d");
4190
- if (!S) throw new Error("Failed to get 2D context");
4284
+ const M = v.getContext("2d");
4285
+ if (!M) throw new Error("Failed to get 2D context");
4191
4286
  return {
4192
4287
  theme: s,
4193
4288
  backgroundColor: r,
@@ -4204,7 +4299,7 @@ function sn(i, e) {
4204
4299
  primaryYAxisId: b,
4205
4300
  webglCanvas: p,
4206
4301
  overlayCanvas: v,
4207
- overlayCtx: S,
4302
+ overlayCtx: M,
4208
4303
  layout: n
4209
4304
  };
4210
4305
  }
@@ -4212,7 +4307,7 @@ function We(i) {
4212
4307
  const e = document.createElement("canvas");
4213
4308
  return e.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;", i === "overlay" && (e.style.pointerEvents = "none"), e;
4214
4309
  }
4215
- function on(i, e, t) {
4310
+ function cn(i, e, t) {
4216
4311
  const n = i.getBoundingClientRect(), s = Array.from(e.values()).filter((c) => c.position !== "right").length, o = Array.from(e.values()).filter((c) => c.position === "right").length, r = (t == null ? void 0 : t.margins) || ae, a = (r.left ?? ae.left) + Math.max(0, s - 1) * 65, l = (r.right ?? ae.right) + o * 65, h = r.top ?? ae.top, d = r.bottom ?? ae.bottom;
4217
4312
  return {
4218
4313
  x: a,
@@ -4221,7 +4316,7 @@ function on(i, e, t) {
4221
4316
  height: Math.max(1, n.height - h - d)
4222
4317
  };
4223
4318
  }
4224
- function rn(i) {
4319
+ function un(i) {
4225
4320
  const e = [];
4226
4321
  let t = 0, n = 0;
4227
4322
  return i.forEach((s, o) => {
@@ -4229,15 +4324,13 @@ function rn(i) {
4229
4324
  r === "left" ? t++ : n++, e.push({ id: o, position: r, offset: a });
4230
4325
  }), e;
4231
4326
  }
4232
- function an(i, e, t, n, s) {
4327
+ function dn(i, e, t, n, s) {
4233
4328
  const o = i.getBoundingClientRect();
4234
4329
  if (o.width === 0 || o.height === 0) return !1;
4235
- const r = Math.max(1, Math.round(o.width * s)), a = Math.max(1, Math.round(o.height * s)), l = `${Math.round(o.width)}px`, h = `${Math.round(o.height)}px`;
4236
- return e.width === r && e.height === a && e.style.width === l && e.style.height === h ? !1 : ([e, t].forEach((c) => {
4237
- c.width = r, c.height = a, c.style.width = l, c.style.height = h;
4238
- }), n.setTransform(s, 0, 0, s, 0, 0), n.imageSmoothingEnabled = !0, "imageSmoothingQuality" in n && (n.imageSmoothingQuality = "high"), !0);
4330
+ const r = Math.max(1, Math.round(o.width * s)), a = Math.max(1, Math.round(o.height * s)), l = `${Math.round(o.width)}px`, h = `${Math.round(o.height)}px`, d = e.width !== r || e.height !== a || e.style.width !== l || e.style.height !== h, c = t.width !== r || t.height !== a;
4331
+ return !d && !c ? (n.setTransform(s, 0, 0, s, 0, 0), n.imageSmoothingEnabled = !0, "imageSmoothingQuality" in n && (n.imageSmoothingQuality = "high"), !1) : (d && (e.width = r, e.height = a, e.style.width = l, e.style.height = h), c && (t.width = r, t.height = a), t.style.width = l, t.style.height = h, n.setTransform(s, 0, 0, s, 0, 0), n.imageSmoothingEnabled = !0, "imageSmoothingQuality" in n && (n.imageSmoothingQuality = "high"), !0);
4239
4332
  }
4240
- class ln {
4333
+ class fn {
4241
4334
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4242
4335
  constructor(e) {
4243
4336
  m(this, "data", /* @__PURE__ */ new Map());
@@ -4271,11 +4364,11 @@ class ln {
4271
4364
  });
4272
4365
  }
4273
4366
  }
4274
- class hn {
4367
+ class gn {
4275
4368
  constructor(e, t = !0) {
4276
4369
  m(this, "prefix");
4277
4370
  m(this, "enabled");
4278
- this.prefix = `[SciPlot:${e}]`, this.enabled = t;
4371
+ this.prefix = `[VeloPlot:${e}]`, this.enabled = t;
4279
4372
  }
4280
4373
  debug(e, ...t) {
4281
4374
  this.enabled && console.debug(this.prefix, e, ...t);
@@ -4290,7 +4383,7 @@ class hn {
4290
4383
  console.error(this.prefix, e, ...t);
4291
4384
  }
4292
4385
  }
4293
- class cn {
4386
+ class yn {
4294
4387
  constructor(e) {
4295
4388
  m(this, "chart");
4296
4389
  m(this, "subscriptions", []);
@@ -4314,7 +4407,7 @@ class cn {
4314
4407
  try {
4315
4408
  s(t);
4316
4409
  } catch (o) {
4317
- console.error(`[SciPlot] Error in plugin event handler for "${e}":`, o);
4410
+ console.error(`[VeloPlot] Error in plugin event handler for "${e}":`, o);
4318
4411
  }
4319
4412
  });
4320
4413
  }
@@ -4329,7 +4422,7 @@ class cn {
4329
4422
  this.subscriptions.forEach((e) => e()), this.subscriptions = [], this.customListeners.clear();
4330
4423
  }
4331
4424
  }
4332
- class un {
4425
+ class mn {
4333
4426
  constructor(e, t) {
4334
4427
  m(this, "_container");
4335
4428
  m(this, "_theme");
@@ -4416,8 +4509,8 @@ class un {
4416
4509
  this.overlays.forEach((t) => t.remove()), this.overlays.clear(), (e = this.notifications) == null || e.remove(), this.notifications = null;
4417
4510
  }
4418
4511
  }
4419
- function dn(i, e) {
4420
- const t = new ln(i), n = new hn(i), s = new cn(e.chart), o = new un(e.container, e.theme), r = {
4512
+ function pn(i, e) {
4513
+ const t = new fn(i), n = new gn(i), s = new yn(e.chart), o = new mn(e.container, e.theme), r = {
4421
4514
  get gl() {
4422
4515
  var c;
4423
4516
  return (c = e.getGL) == null ? void 0 : c.call(e);
@@ -4488,7 +4581,7 @@ function dn(i, e) {
4488
4581
  }
4489
4582
  };
4490
4583
  }
4491
- class fn {
4584
+ class xn {
4492
4585
  constructor(e) {
4493
4586
  m(this, "plugins", /* @__PURE__ */ new Map());
4494
4587
  m(this, "deps");
@@ -4516,22 +4609,22 @@ class fn {
4516
4609
  async use(e, t) {
4517
4610
  var l;
4518
4611
  if (this.destroyed) {
4519
- console.warn("[SciPlot] Cannot add plugin to destroyed manager");
4612
+ console.warn("[VeloPlot] Cannot add plugin to destroyed manager");
4520
4613
  return;
4521
4614
  }
4522
4615
  const n = typeof e == "function" ? e(t) : e, s = n.manifest.name;
4523
4616
  if (this.plugins.has(s)) {
4524
- console.warn(`[SciPlot] Plugin "${s}" is already registered`);
4617
+ console.warn(`[VeloPlot] Plugin "${s}" is already registered`);
4525
4618
  return;
4526
4619
  }
4527
4620
  const o = await this.checkDependencies(n.manifest);
4528
4621
  if (o.length > 0) {
4529
4622
  console.error(
4530
- `[SciPlot] Plugin "${s}" requires plugins: ${o.join(", ")}`
4623
+ `[VeloPlot] Plugin "${s}" requires plugins: ${o.join(", ")}`
4531
4624
  );
4532
4625
  return;
4533
4626
  }
4534
- const r = dn(s, {
4627
+ const r = pn(s, {
4535
4628
  ...this.deps,
4536
4629
  getPlugin: (h) => this.get(h)
4537
4630
  }), a = {
@@ -4545,7 +4638,7 @@ class fn {
4545
4638
  const h = (l = n.onInit) == null ? void 0 : l.call(n, r, t);
4546
4639
  h instanceof Promise && await h, a.initialized = !0;
4547
4640
  } catch (h) {
4548
- console.error(`[SciPlot] Failed to initialize plugin "${s}":`, h), this.plugins.delete(s), r._cleanup();
4641
+ console.error(`[VeloPlot] Failed to initialize plugin "${s}":`, h), this.plugins.delete(s), r._cleanup();
4549
4642
  return;
4550
4643
  }
4551
4644
  this.rebuildHookCaches();
@@ -4561,12 +4654,12 @@ class fn {
4561
4654
  const n = this.findDependents(e);
4562
4655
  if (n.length > 0)
4563
4656
  return console.warn(
4564
- `[SciPlot] Cannot remove plugin "${e}", required by: ${n.join(", ")}`
4657
+ `[VeloPlot] Cannot remove plugin "${e}", required by: ${n.join(", ")}`
4565
4658
  ), !1;
4566
4659
  try {
4567
4660
  (o = (s = t.plugin).onDestroy) == null || o.call(s, t.context);
4568
4661
  } catch (r) {
4569
- console.error(`[SciPlot] Error destroying plugin "${e}":`, r);
4662
+ console.error(`[VeloPlot] Error destroying plugin "${e}":`, r);
4570
4663
  }
4571
4664
  return t.context._cleanup(), this.plugins.delete(e), this.rebuildHookCaches(), !0;
4572
4665
  }
@@ -4602,7 +4695,7 @@ class fn {
4602
4695
  var o, r;
4603
4696
  const n = this.plugins.get(e);
4604
4697
  if (!n) {
4605
- console.warn(`[SciPlot] Plugin "${e}" not found`);
4698
+ console.warn(`[VeloPlot] Plugin "${e}" not found`);
4606
4699
  return;
4607
4700
  }
4608
4701
  const s = n.config;
@@ -4615,7 +4708,7 @@ class fn {
4615
4708
  s
4616
4709
  );
4617
4710
  } catch (a) {
4618
- console.error(`[SciPlot] Error in plugin "${e}" config change:`, a);
4711
+ console.error(`[VeloPlot] Error in plugin "${e}" config change:`, a);
4619
4712
  }
4620
4713
  }
4621
4714
  /**
@@ -4629,7 +4722,7 @@ class fn {
4629
4722
  s.call(n.plugin, n.context, ...t);
4630
4723
  } catch (o) {
4631
4724
  console.error(
4632
- `[SciPlot] Error in plugin "${n.plugin.manifest.name}" hook "${e}":`,
4725
+ `[VeloPlot] Error in plugin "${n.plugin.manifest.name}" hook "${e}":`,
4633
4726
  o
4634
4727
  );
4635
4728
  }
@@ -4649,7 +4742,7 @@ class fn {
4649
4742
  return !1;
4650
4743
  } catch (n) {
4651
4744
  console.error(
4652
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" beforeRender:`,
4745
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" beforeRender:`,
4653
4746
  n
4654
4747
  );
4655
4748
  }
@@ -4664,7 +4757,7 @@ class fn {
4664
4757
  t.plugin.onAfterRender(t.context, e);
4665
4758
  } catch (n) {
4666
4759
  console.error(
4667
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" afterRender:`,
4760
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" afterRender:`,
4668
4761
  n
4669
4762
  );
4670
4763
  }
@@ -4678,7 +4771,7 @@ class fn {
4678
4771
  t.plugin.onRenderWebGL(t.context, e);
4679
4772
  } catch (n) {
4680
4773
  console.error(
4681
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" renderWebGL:`,
4774
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" renderWebGL:`,
4682
4775
  n
4683
4776
  );
4684
4777
  }
@@ -4692,7 +4785,7 @@ class fn {
4692
4785
  t.plugin.onRenderOverlay(t.context, e);
4693
4786
  } catch (n) {
4694
4787
  console.error(
4695
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" renderOverlay:`,
4788
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" renderOverlay:`,
4696
4789
  n
4697
4790
  );
4698
4791
  }
@@ -4708,7 +4801,7 @@ class fn {
4708
4801
  return !1;
4709
4802
  } catch (n) {
4710
4803
  console.error(
4711
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" interaction:`,
4804
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" interaction:`,
4712
4805
  n
4713
4806
  );
4714
4807
  }
@@ -4723,7 +4816,7 @@ class fn {
4723
4816
  t.plugin.onViewChange(t.context, e);
4724
4817
  } catch (n) {
4725
4818
  console.error(
4726
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" viewChange:`,
4819
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" viewChange:`,
4727
4820
  n
4728
4821
  );
4729
4822
  }
@@ -4737,7 +4830,7 @@ class fn {
4737
4830
  t.plugin.onDataUpdate(t.context, e);
4738
4831
  } catch (n) {
4739
4832
  console.error(
4740
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" dataUpdate:`,
4833
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" dataUpdate:`,
4741
4834
  n
4742
4835
  );
4743
4836
  }
@@ -4751,7 +4844,7 @@ class fn {
4751
4844
  t.plugin.onSeriesAdd(t.context, e);
4752
4845
  } catch (n) {
4753
4846
  console.error(
4754
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" seriesAdd:`,
4847
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" seriesAdd:`,
4755
4848
  n
4756
4849
  );
4757
4850
  }
@@ -4765,7 +4858,7 @@ class fn {
4765
4858
  t.plugin.onSeriesRemove(t.context, e);
4766
4859
  } catch (n) {
4767
4860
  console.error(
4768
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" seriesRemove:`,
4861
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" seriesRemove:`,
4769
4862
  n
4770
4863
  );
4771
4864
  }
@@ -4779,7 +4872,7 @@ class fn {
4779
4872
  t.plugin.onSeriesChange(t.context, e);
4780
4873
  } catch (n) {
4781
4874
  console.error(
4782
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" seriesChange:`,
4875
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" seriesChange:`,
4783
4876
  n
4784
4877
  );
4785
4878
  }
@@ -4793,7 +4886,7 @@ class fn {
4793
4886
  t.plugin.onResize(t.context, e);
4794
4887
  } catch (n) {
4795
4888
  console.error(
4796
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" resize:`,
4889
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" resize:`,
4797
4890
  n
4798
4891
  );
4799
4892
  }
@@ -4810,7 +4903,7 @@ class fn {
4810
4903
  s.plugin.onThemeChange(s.context, e);
4811
4904
  } catch (o) {
4812
4905
  console.error(
4813
- `[SciPlot] Error in plugin "${s.plugin.manifest.name}" themeChange:`,
4906
+ `[VeloPlot] Error in plugin "${s.plugin.manifest.name}" themeChange:`,
4814
4907
  o
4815
4908
  );
4816
4909
  }
@@ -4824,7 +4917,7 @@ class fn {
4824
4917
  t.plugin.onSelectionChange(t.context, e);
4825
4918
  } catch (n) {
4826
4919
  console.error(
4827
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" selectionChange:`,
4920
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" selectionChange:`,
4828
4921
  n
4829
4922
  );
4830
4923
  }
@@ -4843,7 +4936,7 @@ class fn {
4843
4936
  });
4844
4937
  } catch (n) {
4845
4938
  console.error(
4846
- `[SciPlot] Error in plugin "${t.plugin.manifest.name}" serialize:`,
4939
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" serialize:`,
4847
4940
  n
4848
4941
  );
4849
4942
  }
@@ -4862,7 +4955,7 @@ class fn {
4862
4955
  s.plugin.onDeserialize(s.context, o);
4863
4956
  } catch (a) {
4864
4957
  console.error(
4865
- `[SciPlot] Error in plugin "${t}" deserialize:`,
4958
+ `[VeloPlot] Error in plugin "${t}" deserialize:`,
4866
4959
  a
4867
4960
  );
4868
4961
  }
@@ -4880,7 +4973,7 @@ class fn {
4880
4973
  try {
4881
4974
  (n = (t = o.plugin).onDestroy) == null || n.call(t, o.context);
4882
4975
  } catch (r) {
4883
- console.error(`[SciPlot] Error destroying plugin "${s}":`, r);
4976
+ console.error(`[VeloPlot] Error destroying plugin "${s}":`, r);
4884
4977
  }
4885
4978
  o.context._cleanup();
4886
4979
  }
@@ -4927,7 +5020,7 @@ const E = {
4927
5020
  PIN: '<svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="17" x2="12" y2="22"></line><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6a3 3 0 0 0-6 0v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17z"></path></svg>',
4928
5021
  PIN_OFF: '<svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="2" y1="2" x2="22" y2="22"></line><line x1="12" y1="17" x2="12" y2="22"></line><path d="M9 10.76V6a3 3 0 0 1 1.43-2.54m2.68.74A3 3 0 0 1 15 6v4.76a2 2 0 0 0 1.11 1.79l1.78.9A2 2 0 0 1 19 15.24V17h-2"></path><path d="M5 17h8"></path></svg>'
4929
5022
  };
4930
- class gn {
5023
+ class bn {
4931
5024
  constructor(e, t, n, s) {
4932
5025
  m(this, "container");
4933
5026
  m(this, "toolbar");
@@ -5142,7 +5235,7 @@ class gn {
5142
5235
  this.container.remove();
5143
5236
  }
5144
5237
  }
5145
- class yn {
5238
+ class vn {
5146
5239
  constructor(e, t, n, s) {
5147
5240
  m(this, "container");
5148
5241
  m(this, "visualContainer");
@@ -5375,10 +5468,10 @@ class yn {
5375
5468
  e.fillStyle = f ? n.backgroundColor : "rgba(255, 255, 255, 0.85)", e.strokeStyle = n.borderColor, e.lineWidth = 1 * t;
5376
5469
  const u = n.borderRadius * t;
5377
5470
  e.beginPath(), e.moveTo(l + u, h), e.lineTo(l + d - u, h), e.arcTo(l + d, h, l + d, h + u, u), e.lineTo(l + d, h + c - u), e.arcTo(l + d, h + c, l + d - u, h + c, u), e.lineTo(l + u, h + c), e.arcTo(l, h + c, l, h + c - u, u), e.lineTo(l, h + u), e.arcTo(l, h, l + u, h, u), e.closePath(), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "middle", e.font = `${n.fontSize * t}px ${n.fontFamily}`, this.series.forEach((g, y) => {
5378
- const x = h + a + s + y * (r + o) + r / 2, b = l + s + r / 2, w = x, p = g.getStyle(), v = g.getType(), S = p.symbol || "circle";
5471
+ const x = h + a + s + y * (r + o) + r / 2, b = l + s + r / 2, w = x, p = g.getStyle(), v = g.getType(), M = p.symbol || "circle";
5379
5472
  e.fillStyle = p.color || "#ff0055", e.strokeStyle = p.color || "#ff0055", e.lineWidth = 2 * t;
5380
- const M = String(v).toLowerCase(), A = M === "scatter" || M === "1" || M === "line" && !!p.symbol, k = M.includes("scatter") || M === "2";
5381
- A ? this.drawSymbol(e, S, b, w, r * 0.9) : k ? (e.beginPath(), e.moveTo(l + s, w), e.lineTo(l + s + r, w), e.stroke(), this.drawSymbol(e, S, b, w, r * 0.6)) : (e.beginPath(), e.moveTo(l + s, w), e.lineTo(l + s + r, w), e.stroke()), e.fillStyle = n.textColor, e.fillText(g.getName(), l + s + r + 8 * t, x);
5473
+ const S = String(v).toLowerCase(), A = S === "scatter" || S === "1" || S === "line" && !!p.symbol, P = S.includes("scatter") || S === "2";
5474
+ A ? this.drawSymbol(e, M, b, w, r * 0.9) : P ? (e.beginPath(), e.moveTo(l + s, w), e.lineTo(l + s + r, w), e.stroke(), this.drawSymbol(e, M, b, w, r * 0.6)) : (e.beginPath(), e.moveTo(l + s, w), e.lineTo(l + s + r, w), e.stroke()), e.fillStyle = n.textColor, e.fillText(g.getName(), l + s + r + 8 * t, x);
5382
5475
  }), e.restore();
5383
5476
  }
5384
5477
  updateTheme(e) {
@@ -5394,8 +5487,8 @@ class yn {
5394
5487
  this.container.remove();
5395
5488
  }
5396
5489
  }
5397
- function mn(i) {
5398
- return i.showControls ? new gn(i.container, i.theme, {
5490
+ function wn(i) {
5491
+ return i.showControls ? new bn(i.container, i.theme, {
5399
5492
  onResetZoom: () => i.resetZoom(),
5400
5493
  onSetType: (e) => {
5401
5494
  i.series.forEach((t) => {
@@ -5434,14 +5527,14 @@ function mn(i) {
5434
5527
  }
5435
5528
  }, i.toolbar) : null;
5436
5529
  }
5437
- function pn(i, e) {
5530
+ function Mn(i, e) {
5438
5531
  var s, o, r, a, l, h;
5439
5532
  if (!i.showLegend) return null;
5440
5533
  const t = {
5441
5534
  ...e.legendPosition,
5442
5535
  highlightOnHover: ((s = i.legendOptions) == null ? void 0 : s.highlightOnHover) ?? ((r = (o = e.layout) == null ? void 0 : o.legend) == null ? void 0 : r.highlightOnHover) ?? !1,
5443
5536
  bringToFrontOnHover: ((a = i.legendOptions) == null ? void 0 : a.bringToFrontOnHover) ?? ((h = (l = e.layout) == null ? void 0 : l.legend) == null ? void 0 : h.bringToFrontOnHover) ?? !0
5444
- }, n = new yn(
5537
+ }, n = new vn(
5445
5538
  i.container,
5446
5539
  i.theme,
5447
5540
  t,
@@ -5479,7 +5572,7 @@ function pn(i, e) {
5479
5572
  );
5480
5573
  return n.update(Array.from(i.series.values())), n;
5481
5574
  }
5482
- class xn {
5575
+ class Sn {
5483
5576
  constructor() {
5484
5577
  m(this, "queue", []);
5485
5578
  m(this, "isProcessing", !1);
@@ -5551,17 +5644,17 @@ class xn {
5551
5644
  this.clear(), this.completedCount = 0, this.idCounter = 0;
5552
5645
  }
5553
5646
  }
5554
- const Q = new xn();
5555
- function bn() {
5647
+ const Q = new Sn();
5648
+ function Cn() {
5556
5649
  return Q.enqueue();
5557
5650
  }
5558
- function Ie(i) {
5651
+ function Ee(i) {
5559
5652
  Q.markComplete(i);
5560
5653
  }
5561
- function ls() {
5654
+ function ys() {
5562
5655
  return Q.getStatus();
5563
5656
  }
5564
- class vn {
5657
+ class An {
5565
5658
  static getStatus() {
5566
5659
  return this.instance.getStatus();
5567
5660
  }
@@ -5569,23 +5662,23 @@ class vn {
5569
5662
  this.instance.reset();
5570
5663
  }
5571
5664
  }
5572
- m(vn, "instance", Q);
5573
- function hs() {
5665
+ m(An, "instance", Q);
5666
+ function ms() {
5574
5667
  return {
5575
5668
  getStatus: () => Q.getStatus(),
5576
5669
  reset: () => Q.reset()
5577
5670
  };
5578
5671
  }
5579
- async function cs(i, e) {
5672
+ async function ps(i, e) {
5580
5673
  await e();
5581
5674
  }
5582
- function us(i = 200) {
5675
+ function xs(i = 200) {
5583
5676
  return new Promise((e) => setTimeout(e, i));
5584
5677
  }
5585
- function ds() {
5678
+ function bs() {
5586
5679
  Q.reset();
5587
5680
  }
5588
- class wn {
5681
+ class kn {
5589
5682
  constructor(e) {
5590
5683
  this.pluginManager = e;
5591
5684
  }
@@ -5700,6 +5793,9 @@ class wn {
5700
5793
  get forecasting() {
5701
5794
  return this.getAPI("velo-plot-forecasting");
5702
5795
  }
5796
+ get patterns() {
5797
+ return this.getAPI("pattern-recognition");
5798
+ }
5703
5799
  get latex() {
5704
5800
  return this.getAPI("velo-plot-latex");
5705
5801
  }
@@ -5716,17 +5812,21 @@ class wn {
5716
5812
  return this.pluginManager.getNames();
5717
5813
  }
5718
5814
  }
5719
- class Sn {
5815
+ class Pn {
5720
5816
  constructor(e) {
5721
5817
  this.ctx = e;
5722
5818
  }
5819
+ /** Swap the X scale (e.g. broken-axis plugin) so tick generation uses it. */
5820
+ setXScale(e) {
5821
+ this.ctx.xScale = e;
5822
+ }
5723
5823
  /**
5724
5824
  * Add a new Y axis dynamically
5725
5825
  */
5726
5826
  addYAxis(e) {
5727
5827
  const t = Array.from(this.ctx.yAxisOptionsMap.keys()), n = e.id || `y${t.length}`;
5728
5828
  if (this.ctx.yAxisOptionsMap.has(n))
5729
- return console.warn(`[SciPlot] Y axis with id '${n}' already exists`), n;
5829
+ return console.warn(`[VeloPlot] Y axis with id '${n}' already exists`), n;
5730
5830
  const o = {
5731
5831
  scale: "linear",
5732
5832
  auto: !0,
@@ -5742,7 +5842,7 @@ class Sn {
5742
5842
  * Remove a Y axis by ID
5743
5843
  */
5744
5844
  removeYAxis(e) {
5745
- return e === this.ctx.primaryYAxisId ? (console.warn(`[SciPlot] Cannot remove primary Y axis '${e}'`), !1) : this.ctx.yAxisOptionsMap.has(e) ? (this.ctx.yAxisOptionsMap.delete(e), this.ctx.yScales.delete(e), this.ctx.series.forEach((t) => {
5845
+ return e === this.ctx.primaryYAxisId ? (console.warn(`[VeloPlot] Cannot remove primary Y axis '${e}'`), !1) : this.ctx.yAxisOptionsMap.has(e) ? (this.ctx.yAxisOptionsMap.delete(e), this.ctx.yScales.delete(e), this.ctx.series.forEach((t) => {
5746
5846
  t.getYAxisId() === e && t.setYAxisId(this.ctx.primaryYAxisId);
5747
5847
  }), this.ctx.requestRender(), !0) : !1;
5748
5848
  }
@@ -5752,7 +5852,7 @@ class Sn {
5752
5852
  updateYAxis(e, t) {
5753
5853
  const n = this.ctx.yAxisOptionsMap.get(e);
5754
5854
  if (!n) {
5755
- console.warn(`[SciPlot] Y axis '${e}' not found`);
5855
+ console.warn(`[VeloPlot] Y axis '${e}' not found`);
5756
5856
  return;
5757
5857
  }
5758
5858
  const s = { ...n, ...t, id: e };
@@ -5817,21 +5917,21 @@ class Sn {
5817
5917
  return this.ctx.yScales;
5818
5918
  }
5819
5919
  }
5820
- const ot = 1;
5821
- function Xe(i) {
5920
+ const lt = 1;
5921
+ function Ne(i) {
5822
5922
  const e = i instanceof Float32Array ? i : new Float32Array(i), t = new Uint8Array(e.buffer);
5823
5923
  let n = "";
5824
5924
  for (let s = 0; s < t.length; s++)
5825
5925
  n += String.fromCharCode(t[s]);
5826
5926
  return btoa(n);
5827
5927
  }
5828
- function Ne(i) {
5928
+ function He(i) {
5829
5929
  const e = atob(i), t = new Uint8Array(e.length);
5830
5930
  for (let n = 0; n < e.length; n++)
5831
5931
  t[n] = e.charCodeAt(n);
5832
5932
  return new Float32Array(t.buffer);
5833
5933
  }
5834
- function Mn(i) {
5934
+ function Tn(i) {
5835
5935
  try {
5836
5936
  new TextEncoder().encode(i);
5837
5937
  let t = "";
@@ -5846,7 +5946,7 @@ function Mn(i) {
5846
5946
  return btoa(i);
5847
5947
  }
5848
5948
  }
5849
- function Cn(i) {
5949
+ function Bn(i) {
5850
5950
  try {
5851
5951
  const e = atob(i);
5852
5952
  let t = "";
@@ -5861,24 +5961,24 @@ function Cn(i) {
5861
5961
  return atob(i);
5862
5962
  }
5863
5963
  }
5864
- function An(i, e = !0) {
5964
+ function In(i, e = !0) {
5865
5965
  const t = JSON.stringify(i);
5866
- return e ? Mn(t) : btoa(t);
5966
+ return e ? Tn(t) : btoa(t);
5867
5967
  }
5868
- function Pn(i, e = !0) {
5968
+ function En(i, e = !0) {
5869
5969
  try {
5870
- const t = e ? Cn(i) : atob(i), n = JSON.parse(t);
5871
- return typeof n.version != "number" ? (console.warn("[SciPlot] Invalid state: missing version"), null) : (n.version > ot && console.warn("[SciPlot] State version is newer than supported"), n);
5970
+ const t = e ? Bn(i) : atob(i), n = JSON.parse(t);
5971
+ return typeof n.version != "number" ? (console.warn("[VeloPlot] Invalid state: missing version"), null) : (n.version > lt && console.warn("[VeloPlot] State version is newer than supported"), n);
5872
5972
  } catch (t) {
5873
- return console.error("[SciPlot] Failed to parse URL hash:", t), null;
5973
+ return console.error("[VeloPlot] Failed to parse URL hash:", t), null;
5874
5974
  }
5875
5975
  }
5876
- function fs(i) {
5976
+ function vs(i) {
5877
5977
  if (!i || typeof i != "object") return !1;
5878
5978
  const e = i;
5879
5979
  return !(typeof e.version != "number" || !e.viewBounds || typeof e.viewBounds != "object" || !Array.isArray(e.series));
5880
5980
  }
5881
- class gs {
5981
+ class ws {
5882
5982
  constructor(e = 50) {
5883
5983
  m(this, "history", []);
5884
5984
  m(this, "currentIndex", -1);
@@ -5934,17 +6034,21 @@ class gs {
5934
6034
  return this.history.length;
5935
6035
  }
5936
6036
  }
5937
- class kn {
6037
+ class Rn {
5938
6038
  constructor(e) {
5939
6039
  this.ctx = e;
5940
6040
  }
6041
+ /** Swap the X scale (e.g. broken-axis plugin) — the context holds a snapshot. */
6042
+ setXScale(e) {
6043
+ this.ctx.xScale = e;
6044
+ }
5941
6045
  /**
5942
6046
  * Export complete chart state
5943
6047
  */
5944
6048
  serialize(e = {}) {
5945
6049
  const { includeData: t = !0, includeAnnotations: n = !0 } = e;
5946
6050
  return {
5947
- version: ot,
6051
+ version: lt,
5948
6052
  timestamp: Date.now(),
5949
6053
  viewBounds: { ...this.ctx.viewBounds },
5950
6054
  xAxis: {
@@ -5979,8 +6083,8 @@ class kn {
5979
6083
  style: o.getStyle(),
5980
6084
  visible: o.isVisible(),
5981
6085
  data: t ? {
5982
- x: Xe(o.getData().x),
5983
- y: Xe(o.getData().y)
6086
+ x: Ne(o.getData().x),
6087
+ y: Ne(o.getData().y)
5984
6088
  } : { x: "", y: "" }
5985
6089
  })),
5986
6090
  annotations: n ? this.ctx.getAnnotations() : [],
@@ -6023,8 +6127,8 @@ class kn {
6023
6127
  type: r.type,
6024
6128
  yAxisId: r.yAxisId,
6025
6129
  data: {
6026
- x: Ne(r.data.x),
6027
- y: Ne(r.data.y)
6130
+ x: He(r.data.x),
6131
+ y: He(r.data.y)
6028
6132
  },
6029
6133
  style: r.style
6030
6134
  });
@@ -6034,17 +6138,17 @@ class kn {
6034
6138
  * Convert current state to URL-safe hash
6035
6139
  */
6036
6140
  toUrlHash(e = !0) {
6037
- return An(this.serialize({ includeData: !0 }), e);
6141
+ return In(this.serialize({ includeData: !0 }), e);
6038
6142
  }
6039
6143
  /**
6040
6144
  * Load state from URL hash
6041
6145
  */
6042
6146
  fromUrlHash(e, t = !0) {
6043
- const n = Pn(e, t);
6147
+ const n = En(e, t);
6044
6148
  n && this.deserialize(n);
6045
6149
  }
6046
6150
  }
6047
- function Bn(i, e, t, n) {
6151
+ function Dn(i, e, t, n) {
6048
6152
  const { value: s, min: o, max: r } = e, {
6049
6153
  needleColor: a = "#333",
6050
6154
  needleWidth: l = 3,
@@ -6056,26 +6160,26 @@ function Bn(i, e, t, n) {
6056
6160
  valueColor: g = "#fff",
6057
6161
  valueSize: y = 24,
6058
6162
  label: x
6059
- } = t, b = n.x + n.width / 2, w = n.y + n.height / 2, p = Math.min(n.width, n.height) / 2 * d, v = f - c, S = Math.max(0, Math.min(1, (s - o) / (r - o))), M = (c + S * v) * (Math.PI / 180);
6163
+ } = t, b = n.x + n.width / 2, w = n.y + n.height / 2, p = Math.min(n.width, n.height) / 2 * d, v = f - c, M = Math.max(0, Math.min(1, (s - o) / (r - o))), S = (c + M * v) * (Math.PI / 180);
6060
6164
  i.save(), i.beginPath(), i.arc(b, w, p, c * (Math.PI / 180), f * (Math.PI / 180)), i.strokeStyle = "rgba(255, 255, 255, 0.1)", i.lineWidth = p * 0.2, i.lineCap = "round", i.stroke();
6061
- for (const k of h) {
6062
- const B = Math.max(0, Math.min(1, (k.from - o) / (r - o))), F = Math.max(0, Math.min(1, (k.to - o) / (r - o)));
6165
+ for (const P of h) {
6166
+ const T = Math.max(0, Math.min(1, (P.from - o) / (r - o))), D = Math.max(0, Math.min(1, (P.to - o) / (r - o)));
6063
6167
  i.beginPath(), i.arc(
6064
6168
  b,
6065
6169
  w,
6066
6170
  p,
6067
- (c + B * v) * (Math.PI / 180),
6068
- (c + F * v) * (Math.PI / 180)
6069
- ), i.strokeStyle = k.color, i.lineWidth = p * 0.2, i.stroke();
6171
+ (c + T * v) * (Math.PI / 180),
6172
+ (c + D * v) * (Math.PI / 180)
6173
+ ), i.strokeStyle = P.color, i.lineWidth = p * 0.2, i.stroke();
6070
6174
  }
6071
6175
  const A = 11;
6072
- for (let k = 0; k < A; k++) {
6073
- const B = (c + k / (A - 1) * v) * (Math.PI / 180), F = p * 0.85, I = p * 0.95;
6074
- i.beginPath(), i.moveTo(b + F * Math.cos(B), w + F * Math.sin(B)), i.lineTo(b + I * Math.cos(B), w + I * Math.sin(B)), i.strokeStyle = "rgba(255, 255, 255, 0.5)", i.lineWidth = 2, i.stroke();
6176
+ for (let P = 0; P < A; P++) {
6177
+ const T = (c + P / (A - 1) * v) * (Math.PI / 180), D = p * 0.85, I = p * 0.95;
6178
+ i.beginPath(), i.moveTo(b + D * Math.cos(T), w + D * Math.sin(T)), i.lineTo(b + I * Math.cos(T), w + I * Math.sin(T)), i.strokeStyle = "rgba(255, 255, 255, 0.5)", i.lineWidth = 2, i.stroke();
6075
6179
  }
6076
- i.beginPath(), i.moveTo(b, w), i.lineTo(b + p * 0.9 * Math.cos(M), w + p * 0.9 * Math.sin(M)), i.strokeStyle = a, i.lineWidth = l, i.lineCap = "round", i.shadowColor = a, i.shadowBlur = 10, i.stroke(), i.shadowBlur = 0, i.beginPath(), i.arc(b, w, 8, 0, Math.PI * 2), i.fillStyle = a, i.fill(), i.strokeStyle = "#fff", i.lineWidth = 2, i.stroke(), u && (i.textAlign = "center", i.textBaseline = "middle", i.font = `bold ${y}px Inter, sans-serif`, i.fillStyle = g, i.fillText(s.toFixed(1), b, w + p * 0.4), x && (i.font = `${y * 0.5}px Inter, sans-serif`, i.fillStyle = "rgba(255, 255, 255, 0.6)", i.fillText(x, b, w + p * 0.6))), i.restore();
6180
+ i.beginPath(), i.moveTo(b, w), i.lineTo(b + p * 0.9 * Math.cos(S), w + p * 0.9 * Math.sin(S)), i.strokeStyle = a, i.lineWidth = l, i.lineCap = "round", i.shadowColor = a, i.shadowBlur = 10, i.stroke(), i.shadowBlur = 0, i.beginPath(), i.arc(b, w, 8, 0, Math.PI * 2), i.fillStyle = a, i.fill(), i.strokeStyle = "#fff", i.lineWidth = 2, i.stroke(), u && (i.textAlign = "center", i.textBaseline = "middle", i.font = `bold ${y}px Inter, sans-serif`, i.fillStyle = g, i.fillText(s.toFixed(1), b, w + p * 0.4), x && (i.font = `${y * 0.5}px Inter, sans-serif`, i.fillStyle = "rgba(255, 255, 255, 0.6)", i.fillText(x, b, w + p * 0.6))), i.restore();
6077
6181
  }
6078
- function Tn(i, e, t, n) {
6182
+ function Fn(i, e, t, n) {
6079
6183
  const { nodes: s, links: o } = e, {
6080
6184
  nodeWidth: r = 18,
6081
6185
  nodePadding: a = 12,
@@ -6093,71 +6197,71 @@ function Tn(i, e, t, n) {
6093
6197
  o.forEach((C) => {
6094
6198
  w.add(C.source), w.add(C.target);
6095
6199
  });
6096
- const p = Array.from(w), v = /* @__PURE__ */ new Map(), S = new Set(o.map((C) => C.target));
6097
- p.filter((C) => !S.has(C)).forEach((C) => v.set(C, 0));
6200
+ const p = Array.from(w), v = /* @__PURE__ */ new Map(), M = new Set(o.map((C) => C.target));
6201
+ p.filter((C) => !M.has(C)).forEach((C) => v.set(C, 0));
6098
6202
  let A = !0;
6099
6203
  for (; A; )
6100
6204
  A = !1, o.forEach((C) => {
6101
- const T = v.get(C.source);
6102
- if (T !== void 0) {
6103
- const R = v.get(C.target), D = T + 1;
6104
- (R === void 0 || D > R) && (v.set(C.target, D), A = !0);
6205
+ const B = v.get(C.source);
6206
+ if (B !== void 0) {
6207
+ const R = v.get(C.target), F = B + 1;
6208
+ (R === void 0 || F > R) && (v.set(C.target, F), A = !0);
6105
6209
  }
6106
6210
  });
6107
6211
  p.forEach((C) => {
6108
6212
  v.get(C) === void 0 && v.set(C, 0);
6109
6213
  });
6110
- const k = Math.max(...Array.from(v.values())), B = Array.from({ length: k + 1 }, () => []);
6111
- p.forEach((C) => B[v.get(C)].push(C));
6112
- const F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
6214
+ const P = Math.max(...Array.from(v.values())), T = Array.from({ length: P + 1 }, () => []);
6215
+ p.forEach((C) => T[v.get(C)].push(C));
6216
+ const D = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
6113
6217
  o.forEach((C) => {
6114
- I.set(C.source, (I.get(C.source) || 0) + C.value), F.set(C.target, (F.get(C.target) || 0) + C.value);
6218
+ I.set(C.source, (I.get(C.source) || 0) + C.value), D.set(C.target, (D.get(C.target) || 0) + C.value);
6115
6219
  });
6116
- const fe = (C) => Math.max(F.get(C) || 0, I.get(C) || 0);
6220
+ const me = (C) => Math.max(D.get(C) || 0, I.get(C) || 0);
6117
6221
  let U = 0;
6118
- B.forEach((C) => {
6119
- let T = 0;
6120
- C.forEach((R) => T += fe(R)), T > U && (U = T);
6222
+ T.forEach((C) => {
6223
+ let B = 0;
6224
+ C.forEach((R) => B += me(R)), B > U && (U = B);
6121
6225
  });
6122
- const ne = /* @__PURE__ */ new Map(), lt = B.length, ht = (b.width - r) / Math.max(1, lt - 1);
6123
- B.forEach((C, T) => {
6124
- const R = b.x + T * ht, D = [];
6226
+ const ne = /* @__PURE__ */ new Map(), dt = T.length, ft = (b.width - r) / Math.max(1, dt - 1);
6227
+ T.forEach((C, B) => {
6228
+ const R = b.x + B * ft, F = [];
6125
6229
  let q = 0;
6126
- C.forEach((V) => {
6127
- const L = fe(V), $ = U > 0 ? L / U * (b.height * 0.9) : 20;
6128
- D.push($), q += $;
6230
+ C.forEach((X) => {
6231
+ const L = me(X), Y = U > 0 ? L / U * (b.height * 0.9) : 20;
6232
+ F.push(Y), q += Y;
6129
6233
  });
6130
6234
  const se = (C.length - 1) * a, oe = q + se;
6131
6235
  let re = b.y + (b.height - oe) / 2;
6132
- C.forEach((V, L) => {
6133
- const $ = D[L];
6236
+ C.forEach((X, L) => {
6237
+ const Y = F[L];
6134
6238
  let J = l[L % l.length];
6135
6239
  if (s.length > 0) {
6136
- const z = s.find((K) => K.id === V);
6240
+ const z = s.find((K) => K.id === X);
6137
6241
  z != null && z.color && (J = z.color);
6138
6242
  }
6139
- ne.set(V, { x: R, y: re, width: r, height: $, color: J, value: fe(V) }), re += $ + a;
6243
+ ne.set(X, { x: R, y: re, width: r, height: Y, color: J, value: me(X) }), re += Y + a;
6140
6244
  });
6141
6245
  }), i.save();
6142
- const Fe = /* @__PURE__ */ new Map(), De = /* @__PURE__ */ new Map();
6246
+ const Fe = /* @__PURE__ */ new Map(), Le = /* @__PURE__ */ new Map();
6143
6247
  o.forEach((C) => {
6144
- const T = ne.get(C.source), R = ne.get(C.target);
6145
- if (!T || !R) return;
6146
- const D = Fe.get(C.source) || 0, q = De.get(C.target) || 0, se = I.get(C.source) || 1, oe = F.get(C.target) || 1, re = C.value / se * T.height, V = C.value / oe * R.height, L = T.x + T.width, $ = T.y + D, J = $ + re, z = R.x, K = R.y + q, Se = K + V, ge = (z - L) * 0.5, Me = i.createLinearGradient(L, ($ + J) / 2, z, (K + Se) / 2);
6147
- Me.addColorStop(0, T.color), Me.addColorStop(1, R.color), i.beginPath(), i.moveTo(L, $), i.bezierCurveTo(L + ge, $, z - ge, K, z, K), i.lineTo(z, Se), i.bezierCurveTo(z - ge, Se, L + ge, J, L, J), i.closePath(), i.fillStyle = Me, i.globalAlpha = h, i.fill(), i.strokeStyle = T.color, i.globalAlpha = h * 0.3, i.lineWidth = 0.5, i.stroke(), Fe.set(C.source, D + re), De.set(C.target, q + V);
6248
+ const B = ne.get(C.source), R = ne.get(C.target);
6249
+ if (!B || !R) return;
6250
+ const F = Fe.get(C.source) || 0, q = Le.get(C.target) || 0, se = I.get(C.source) || 1, oe = D.get(C.target) || 1, re = C.value / se * B.height, X = C.value / oe * R.height, L = B.x + B.width, Y = B.y + F, J = Y + re, z = R.x, K = R.y + q, Se = K + X, pe = (z - L) * 0.5, Ce = i.createLinearGradient(L, (Y + J) / 2, z, (K + Se) / 2);
6251
+ Ce.addColorStop(0, B.color), Ce.addColorStop(1, R.color), i.beginPath(), i.moveTo(L, Y), i.bezierCurveTo(L + pe, Y, z - pe, K, z, K), i.lineTo(z, Se), i.bezierCurveTo(z - pe, Se, L + pe, J, L, J), i.closePath(), i.fillStyle = Ce, i.globalAlpha = h, i.fill(), i.strokeStyle = B.color, i.globalAlpha = h * 0.3, i.lineWidth = 0.5, i.stroke(), Fe.set(C.source, F + re), Le.set(C.target, q + X);
6148
6252
  }), i.restore(), i.save(), i.globalAlpha = 1, ne.forEach((C) => {
6149
6253
  i.fillStyle = C.color, i.fillRect(C.x, C.y, C.width, C.height);
6150
- const T = i.createLinearGradient(C.x, C.y, C.x + C.width, C.y);
6151
- T.addColorStop(0, "rgba(255, 255, 255, 0.15)"), T.addColorStop(1, "rgba(0, 0, 0, 0.15)"), i.fillStyle = T, i.fillRect(C.x, C.y, C.width, C.height);
6152
- }), i.restore(), d && (i.save(), i.font = "bold 11px Inter, -apple-system, sans-serif", i.textBaseline = "middle", ne.forEach((C, T) => {
6153
- let R = String(T);
6154
- const D = s.find((oe) => oe.id === T);
6155
- D != null && D.name && (R = D.name);
6254
+ const B = i.createLinearGradient(C.x, C.y, C.x + C.width, C.y);
6255
+ B.addColorStop(0, "rgba(255, 255, 255, 0.15)"), B.addColorStop(1, "rgba(0, 0, 0, 0.15)"), i.fillStyle = B, i.fillRect(C.x, C.y, C.width, C.height);
6256
+ }), i.restore(), d && (i.save(), i.font = "bold 11px Inter, -apple-system, sans-serif", i.textBaseline = "middle", ne.forEach((C, B) => {
6257
+ let R = String(B);
6258
+ const F = s.find((oe) => oe.id === B);
6259
+ F != null && F.name && (R = F.name);
6156
6260
  const q = C.x <= b.x + 5, se = C.x >= b.x + b.width - r - 5;
6157
6261
  i.shadowBlur = 3, i.shadowColor = "rgba(0, 0, 0, 0.7)", i.fillStyle = "#ffffff", q ? (i.textAlign = "right", i.fillText(R, C.x - 10, C.y + C.height / 2)) : se ? (i.textAlign = "left", i.fillText(R, C.x + C.width + 10, C.y + C.height / 2)) : (i.textAlign = "center", i.fillText(R, C.x + C.width / 2, C.y - 10));
6158
6262
  }), i.restore());
6159
6263
  }
6160
- function He(i, e, t, n, s) {
6264
+ function Ue(i, e, t, n, s) {
6161
6265
  const o = (s == null ? void 0 : s.left) ?? 0, r = (s == null ? void 0 : s.right) ?? 0, a = (s == null ? void 0 : s.top) ?? 0, l = (s == null ? void 0 : s.bottom) ?? 0;
6162
6266
  if (n === "x") {
6163
6267
  const f = e.x + o, u = e.x + e.width - r, g = (t == null ? void 0 : t.invertAxis) ?? !1;
@@ -6167,9 +6271,9 @@ function He(i, e, t, n, s) {
6167
6271
  const h = e.y + a, d = e.y + e.height - l, c = (t == null ? void 0 : t.invertAxis) ?? !1;
6168
6272
  i.setRange(c ? h : d, c ? d : h);
6169
6273
  }
6170
- function In(i, e) {
6274
+ function Ln(i, e) {
6171
6275
  const t = [], n = i.layout.plotPadding;
6172
- if (He(
6276
+ if (Ue(
6173
6277
  i.xScale,
6174
6278
  e,
6175
6279
  i.xAxisOptions,
@@ -6177,7 +6281,7 @@ function In(i, e) {
6177
6281
  n
6178
6282
  ), i.xScale.setDomain(i.viewBounds.xMin, i.viewBounds.xMax), i.yScales.forEach((s, o) => {
6179
6283
  const r = i.yAxisOptionsMap.get(o);
6180
- He(s, e, r, "y", n), o === i.primaryYAxisId && s.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
6284
+ Ue(s, e, r, "y", n), o === i.primaryYAxisId && s.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
6181
6285
  }), i.series.forEach((s) => {
6182
6286
  var a, l;
6183
6287
  s.needsBufferUpdate && (i.updateSeriesBuffer(s), s.needsBufferUpdate = !1);
@@ -6255,7 +6359,7 @@ function In(i, e) {
6255
6359
  const w = s.getYAxisId() || i.primaryYAxisId, p = i.yScales.get(w);
6256
6360
  let v;
6257
6361
  p && (v = { min: p.domain[0], max: p.domain[1] });
6258
- const S = s.waterfallCounts || { positive: 0, negative: 0, subtotal: 0, connectors: 0 };
6362
+ const M = s.waterfallCounts || { positive: 0, negative: 0, subtotal: 0, connectors: 0 };
6259
6363
  u = {
6260
6364
  id: s.getId(),
6261
6365
  buffer: g || y || x,
@@ -6267,13 +6371,13 @@ function In(i, e) {
6267
6371
  type: "waterfall",
6268
6372
  yBounds: v,
6269
6373
  wfPositiveBuffer: g,
6270
- wfPositiveCount: S.positive,
6374
+ wfPositiveCount: M.positive,
6271
6375
  wfNegativeBuffer: y,
6272
- wfNegativeCount: S.negative,
6376
+ wfNegativeCount: M.negative,
6273
6377
  wfSubtotalBuffer: x,
6274
- wfSubtotalCount: S.subtotal,
6378
+ wfSubtotalCount: M.subtotal,
6275
6379
  wfConnectorBuffer: b,
6276
- wfConnectorCount: S.connectors
6380
+ wfConnectorCount: M.connectors
6277
6381
  };
6278
6382
  }
6279
6383
  }
@@ -6291,16 +6395,16 @@ function In(i, e) {
6291
6395
  const b = y.xValues.length, w = y.yValues.length;
6292
6396
  u.count = (b - 1) * (w - 1) * 6;
6293
6397
  let p = 1 / 0, v = -1 / 0;
6294
- for (let M = 0; M < y.zValues.length; M++) {
6295
- const A = y.zValues[M];
6398
+ for (let S = 0; S < y.zValues.length; S++) {
6399
+ const A = y.zValues[S];
6296
6400
  A < p && (p = A), A > v && (v = A);
6297
6401
  }
6298
6402
  p === v && (p -= 1, v += 1), u.zBounds = {
6299
6403
  min: ((a = x == null ? void 0 : x.colorScale) == null ? void 0 : a.min) ?? (p === 1 / 0 ? 0 : p),
6300
6404
  max: ((l = x == null ? void 0 : x.colorScale) == null ? void 0 : l.max) ?? (v === -1 / 0 ? 1 : v)
6301
6405
  }, u.zBounds.min === u.zBounds.max && (u.zBounds.max = u.zBounds.min + 1);
6302
- const S = `${s.getId()}_colormap`;
6303
- u.colormapTexture = i.renderer.getTexture(S);
6406
+ const M = `${s.getId()}_colormap`;
6407
+ u.colormapTexture = i.renderer.getTexture(M);
6304
6408
  }
6305
6409
  }
6306
6410
  }
@@ -6345,12 +6449,12 @@ function In(i, e) {
6345
6449
  }
6346
6450
  return t;
6347
6451
  }
6348
- function Ue(i, e, t) {
6452
+ function qe(i, e, t) {
6349
6453
  var y, x, b, w;
6350
6454
  const n = i.container.getBoundingClientRect();
6351
6455
  if (n.width === 0 || n.height === 0) {
6352
6456
  console.warn(
6353
- "[SciPlot] Container has zero size in render, skipping overlay"
6457
+ "[VeloPlot] Container has zero size in render, skipping overlay"
6354
6458
  );
6355
6459
  return;
6356
6460
  }
@@ -6361,12 +6465,12 @@ function Ue(i, e, t) {
6361
6465
  if (p.isVisible())
6362
6466
  if (v === "polar") {
6363
6467
  s = !0;
6364
- const S = p.getPolarData();
6365
- if (S) {
6366
- for (let A = 0; A < S.r.length; A++)
6367
- a = Math.max(a, Math.abs(S.r[A]));
6368
- const M = p.getStyle();
6369
- M.angleMode && (l = M.angleMode), M.radialDivisions && (h = M.radialDivisions), M.angularDivisions && (d = M.angularDivisions);
6468
+ const M = p.getPolarData();
6469
+ if (M) {
6470
+ for (let A = 0; A < M.r.length; A++)
6471
+ a = Math.max(a, Math.abs(M.r[A]));
6472
+ const S = p.getStyle();
6473
+ S.angleMode && (l = S.angleMode), S.radialDivisions && (h = S.radialDivisions), S.angularDivisions && (d = S.angularDivisions);
6370
6474
  }
6371
6475
  } else v === "gauge" ? o = !0 : v === "sankey" && (r = !0);
6372
6476
  });
@@ -6394,37 +6498,37 @@ function Ue(i, e, t) {
6394
6498
  if (!p.isVisible()) return;
6395
6499
  const v = p.getType();
6396
6500
  if (v === "gauge") {
6397
- const S = p.getGaugeData(), M = p.getGaugeStyle();
6398
- S && M && Bn(i.overlayCtx, S, M, e);
6501
+ const M = p.getGaugeData(), S = p.getGaugeStyle();
6502
+ M && S && Dn(i.overlayCtx, M, S, e);
6399
6503
  } else if (v === "sankey") {
6400
- const S = p.getSankeyData(), M = p.getSankeyStyle();
6401
- S && M && Tn(i.overlayCtx, S, M, e);
6504
+ const M = p.getSankeyData(), S = p.getSankeyStyle();
6505
+ M && S && Fn(i.overlayCtx, M, S, e);
6402
6506
  }
6403
6507
  }), c || i.overlay.drawXAxis(e, i.xScale, i.xAxisOptions, i.layout.xAxisLayout);
6404
6508
  const f = [], u = [];
6405
6509
  i.yAxisOptionsMap.forEach((p, v) => {
6406
6510
  p.position === "right" ? u.push(v) : f.push(v);
6407
6511
  }), c || (f.forEach((p, v) => {
6408
- const S = i.yScales.get(p), M = i.yAxisOptionsMap.get(p);
6409
- if (S && M) {
6512
+ const M = i.yScales.get(p), S = i.yAxisOptionsMap.get(p);
6513
+ if (M && S) {
6410
6514
  const A = v * 65;
6411
- i.overlay.drawYAxis(e, S, M, "left", A, i.layout.yAxisLayout);
6515
+ i.overlay.drawYAxis(e, M, S, "left", A, i.layout.yAxisLayout);
6412
6516
  }
6413
6517
  }), u.forEach((p, v) => {
6414
- const S = i.yScales.get(p), M = i.yAxisOptionsMap.get(p);
6415
- if (S && M) {
6518
+ const M = i.yScales.get(p), S = i.yAxisOptionsMap.get(p);
6519
+ if (M && S) {
6416
6520
  const A = v * 65;
6417
- i.overlay.drawYAxis(e, S, M, "right", A, i.layout.yAxisLayout);
6521
+ i.overlay.drawYAxis(e, M, S, "right", A, i.layout.yAxisLayout);
6418
6522
  }
6419
6523
  })), i.overlay.drawPlotBorder(e), i.series.forEach((p) => {
6420
6524
  if (p.isVisible() && p.hasErrorData()) {
6421
- const v = p.getYAxisId() || i.primaryYAxisId, M = i.yScales.get(v) || t;
6422
- i.overlay.drawErrorBars(e, p, i.xScale, M);
6525
+ const v = p.getYAxisId() || i.primaryYAxisId, S = i.yScales.get(v) || t;
6526
+ i.overlay.drawErrorBars(e, p, i.xScale, S);
6423
6527
  }
6424
6528
  }), i.series.forEach((p) => {
6425
6529
  if (!p.isVisible() || p.getType() !== "candlestick") return;
6426
- const v = p.getYAxisId() || i.primaryYAxisId, S = i.yScales.get(v) || t;
6427
- i.overlay.drawCandlestickMarkers(e, p, i.xScale, S);
6530
+ const v = p.getYAxisId() || i.primaryYAxisId, M = i.yScales.get(v) || t;
6531
+ i.overlay.drawCandlestickMarkers(e, p, i.xScale, M);
6428
6532
  });
6429
6533
  const g = ((b = i.getAlerts) == null ? void 0 : b.call(i)) ?? [];
6430
6534
  if (g.length && i.overlay.drawPriceAlertLines(e, g, t), i.selectionRect && i.overlay.drawSelectionRect(i.selectionRect), i.selectionManager.render(i.overlayCtx, e), (w = i.cursorOptions) != null && w.enabled && i.cursorPosition) {
@@ -6436,7 +6540,7 @@ function Ue(i, e, t) {
6436
6540
  ""
6437
6541
  ) : `X: ${i.pixelToDataX(i.cursorPosition.x).toFixed(3)}
6438
6542
  Y: ${i.pixelToDataY(i.cursorPosition.y).toExponential(2)}`);
6439
- const S = {
6543
+ const M = {
6440
6544
  enabled: !0,
6441
6545
  x: i.cursorPosition.x,
6442
6546
  y: i.cursorPosition.y,
@@ -6445,10 +6549,10 @@ Y: ${i.pixelToDataY(i.cursorPosition.y).toExponential(2)}`);
6445
6549
  valueDisplayMode: p,
6446
6550
  cornerPosition: i.cursorOptions.cornerPosition ?? "top-left"
6447
6551
  };
6448
- i.overlay.drawCursor(e, S, i.cursorOptions.lineStyle);
6552
+ i.overlay.drawCursor(e, M, i.cursorOptions.lineStyle);
6449
6553
  }
6450
6554
  }
6451
- class En {
6555
+ class zn {
6452
6556
  constructor(e) {
6453
6557
  m(this, "animationFrameId", null);
6454
6558
  m(this, "needsFullRender", !1);
@@ -6468,6 +6572,10 @@ class En {
6468
6572
  setRenderer(e) {
6469
6573
  this.ctx.renderer = e;
6470
6574
  }
6575
+ /** Swap the X scale (e.g. broken-axis plugin) — the context holds a snapshot. */
6576
+ setXScale(e) {
6577
+ this.ctx.xScale = e;
6578
+ }
6471
6579
  /**
6472
6580
  * Check if init has started
6473
6581
  */
@@ -6553,7 +6661,7 @@ class En {
6553
6661
  if (this.lastRenderTime = o, !this.ctx.pluginManager.notifyBeforeRender(r))
6554
6662
  return;
6555
6663
  if (e) {
6556
- const h = In(s, n);
6664
+ const h = Ln(s, n);
6557
6665
  this.ctx.renderer.render(h, {
6558
6666
  bounds: this.ctx.viewBounds,
6559
6667
  invertX: !!this.ctx.xAxisOptions.invertAxis,
@@ -6565,9 +6673,9 @@ class En {
6565
6673
  ...r,
6566
6674
  renderTime: performance.now() - t
6567
6675
  };
6568
- this.ctx.pluginManager.notifyRenderWebGL(d), Ue(s, n, this.ctx.yScale);
6676
+ this.ctx.pluginManager.notifyRenderWebGL(d), qe(s, n, this.ctx.yScale);
6569
6677
  } else
6570
- Ue(s, n, this.ctx.yScale);
6678
+ qe(s, n, this.ctx.yScale);
6571
6679
  const a = performance.now() - t, l = { ...r, renderTime: a };
6572
6680
  this.ctx.pluginManager.notifyRenderOverlay(l), this.ctx.pluginManager.notifyAfterRender(l), this.ctx.events.emit("render", {
6573
6681
  fps: 1e3 / a,
@@ -6593,13 +6701,13 @@ class En {
6593
6701
  this.frameCount = 0;
6594
6702
  }
6595
6703
  }
6596
- function Rn(i) {
6704
+ function On(i) {
6597
6705
  const t = {
6598
6706
  id: i.seriesId ?? `${i.id}-indicator`,
6599
6707
  data: i.data,
6600
6708
  style: i.style,
6601
6709
  name: i.label
6602
- }, n = we(t);
6710
+ }, n = Me(t);
6603
6711
  return {
6604
6712
  id: i.id,
6605
6713
  height: i.height ?? 0.25,
@@ -6612,7 +6720,8 @@ function Rn(i) {
6612
6720
  tickCount: i.tickCount ?? 5,
6613
6721
  scientific: !1
6614
6722
  },
6615
- xAxis: { showLabels: !1, showTicks: !1, showLine: !1 },
6723
+ // X-axis visibility is owned by createStackedChart (sharedXAxis / showXAxis).
6724
+ // Do not force labels off here — the new bottom pane must show dates.
6616
6725
  animations: !1,
6617
6726
  loading: !1,
6618
6727
  showLegend: !1
@@ -6620,9 +6729,66 @@ function Rn(i) {
6620
6729
  series: n
6621
6730
  };
6622
6731
  }
6623
- let Z = null;
6624
- function Fn() {
6625
- return Z || (Z = new St(
6732
+ const Yn = 5e3;
6733
+ let Z = null, Re = !1;
6734
+ function ht(i) {
6735
+ const e = performance.now();
6736
+ switch (i.indicator) {
6737
+ case "rsi":
6738
+ return {
6739
+ id: i.id,
6740
+ type: "indicator-result",
6741
+ indicator: "rsi",
6742
+ values: St(i.data, i.period ?? 14),
6743
+ duration: performance.now() - e
6744
+ };
6745
+ case "sma":
6746
+ return {
6747
+ id: i.id,
6748
+ type: "indicator-result",
6749
+ indicator: "sma",
6750
+ values: Mt(i.data, i.period ?? 14),
6751
+ duration: performance.now() - e
6752
+ };
6753
+ case "ema":
6754
+ return {
6755
+ id: i.id,
6756
+ type: "indicator-result",
6757
+ indicator: "ema",
6758
+ values: wt(i.data, i.period ?? 14),
6759
+ duration: performance.now() - e
6760
+ };
6761
+ case "macd": {
6762
+ const t = vt(
6763
+ i.data,
6764
+ i.fastPeriod ?? 12,
6765
+ i.slowPeriod ?? 26,
6766
+ i.signalPeriod ?? 9
6767
+ );
6768
+ return {
6769
+ id: i.id,
6770
+ type: "indicator-result",
6771
+ indicator: "macd",
6772
+ ...t,
6773
+ duration: performance.now() - e
6774
+ };
6775
+ }
6776
+ case "bollingerBands": {
6777
+ const t = bt(i.data, i.period ?? 20, i.stdDev ?? 2);
6778
+ return {
6779
+ id: i.id,
6780
+ type: "indicator-result",
6781
+ indicator: "bollingerBands",
6782
+ ...t,
6783
+ duration: performance.now() - e
6784
+ };
6785
+ }
6786
+ default:
6787
+ throw new Error(`Unknown indicator: ${i.indicator}`);
6788
+ }
6789
+ }
6790
+ function $n() {
6791
+ return Z || (Z = new kt(
6626
6792
  () => new Worker(new URL(
6627
6793
  /* @vite-ignore */
6628
6794
  "/assets/indicator.worker-bv0zC4EX.js",
@@ -6631,107 +6797,60 @@ function Fn() {
6631
6797
  {
6632
6798
  poolSize: 2,
6633
6799
  syncFallback: !0,
6634
- syncHandler(i) {
6635
- const e = performance.now();
6636
- switch (i.indicator) {
6637
- case "rsi":
6638
- return {
6639
- id: i.id,
6640
- type: "indicator-result",
6641
- indicator: "rsi",
6642
- values: bt(i.data, i.period ?? 14),
6643
- duration: performance.now() - e
6644
- };
6645
- case "sma":
6646
- return {
6647
- id: i.id,
6648
- type: "indicator-result",
6649
- indicator: "sma",
6650
- values: xt(i.data, i.period ?? 14),
6651
- duration: performance.now() - e
6652
- };
6653
- case "ema":
6654
- return {
6655
- id: i.id,
6656
- type: "indicator-result",
6657
- indicator: "ema",
6658
- values: pt(i.data, i.period ?? 14),
6659
- duration: performance.now() - e
6660
- };
6661
- case "macd": {
6662
- const t = mt(
6663
- i.data,
6664
- i.fastPeriod ?? 12,
6665
- i.slowPeriod ?? 26,
6666
- i.signalPeriod ?? 9
6667
- );
6668
- return {
6669
- id: i.id,
6670
- type: "indicator-result",
6671
- indicator: "macd",
6672
- ...t,
6673
- duration: performance.now() - e
6674
- };
6675
- }
6676
- case "bollingerBands": {
6677
- const t = yt(i.data, i.period ?? 20, i.stdDev ?? 2);
6678
- return {
6679
- id: i.id,
6680
- type: "indicator-result",
6681
- indicator: "bollingerBands",
6682
- ...t,
6683
- duration: performance.now() - e
6684
- };
6685
- }
6686
- default:
6687
- throw new Error(`Unknown indicator: ${i.indicator}`);
6688
- }
6689
- }
6800
+ // Short timeout — if the worker is silent (broken Vite URL), don't stall UI.
6801
+ timeoutMs: 250,
6802
+ syncHandler: ht
6690
6803
  }
6691
6804
  )), Z;
6692
6805
  }
6693
- function ue(i) {
6806
+ function ge(i) {
6694
6807
  return i instanceof Float32Array || i instanceof Float64Array ? i : Float32Array.from(i);
6695
6808
  }
6696
- async function de(i) {
6697
- const e = wt(i.indicator), t = await Fn().run({ id: e, type: "indicator", ...i });
6809
+ function Ge(i) {
6698
6810
  return {
6699
- values: t.values,
6700
- signal: t.signal,
6701
- upper: t.upper,
6702
- lower: t.lower,
6703
- histogram: t.histogram,
6704
- duration: t.duration
6811
+ values: i.values,
6812
+ signal: i.signal,
6813
+ upper: i.upper,
6814
+ lower: i.lower,
6815
+ histogram: i.histogram,
6816
+ duration: i.duration
6705
6817
  };
6706
6818
  }
6707
- async function Dn(i, e = 14) {
6708
- return de({ indicator: "rsi", data: ue(i), period: e });
6819
+ async function ye(i) {
6820
+ const t = { id: At(i.indicator), type: "indicator", ...i };
6821
+ if (Re || i.data.length < Yn)
6822
+ return Ge(ht(t));
6823
+ const n = performance.now(), s = await $n().run(t);
6824
+ return performance.now() - n >= 200 && (Re = !0), Ge(s);
6709
6825
  }
6710
- async function Ln(i, e = 14) {
6711
- return de({ indicator: "sma", data: ue(i), period: e });
6826
+ async function _n(i, e = 14) {
6827
+ return ye({ indicator: "rsi", data: ge(i), period: e });
6712
6828
  }
6713
- async function zn(i, e = 14) {
6714
- return de({ indicator: "ema", data: ue(i), period: e });
6829
+ async function Vn(i, e = 14) {
6830
+ return ye({ indicator: "sma", data: ge(i), period: e });
6715
6831
  }
6716
- async function On(i, e = 12, t = 26, n = 9) {
6717
- return de({
6832
+ async function Xn(i, e = 14) {
6833
+ return ye({ indicator: "ema", data: ge(i), period: e });
6834
+ }
6835
+ async function Wn(i, e = 12, t = 26, n = 9) {
6836
+ return ye({
6718
6837
  indicator: "macd",
6719
- data: ue(i),
6838
+ data: ge(i),
6720
6839
  fastPeriod: e,
6721
6840
  slowPeriod: t,
6722
6841
  signalPeriod: n
6723
6842
  });
6724
6843
  }
6725
- async function $n(i, e = 20, t = 2) {
6726
- return de({ indicator: "bollingerBands", data: ue(i), period: e, stdDev: t });
6844
+ async function Nn(i, e = 20, t = 2) {
6845
+ return ye({ indicator: "bollingerBands", data: ge(i), period: e, stdDev: t });
6727
6846
  }
6728
- function ys() {
6729
- Z == null || Z.destroy(), Z = null;
6847
+ function Ms() {
6848
+ Z == null || Z.destroy(), Z = null, Re = !1;
6730
6849
  }
6731
- function Yn(i) {
6850
+ function Hn(i) {
6732
6851
  return i === "bollingerBands" ? "bollinger" : i;
6733
6852
  }
6734
- function _n(i) {
6853
+ function Un(i) {
6735
6854
  const e = i.getData(), t = e.x;
6736
6855
  if (!(t != null && t.length))
6737
6856
  throw new Error("[addIndicator] Source series has no X data");
@@ -6741,7 +6860,7 @@ function _n(i) {
6741
6860
  throw new Error("[addIndicator] Source series has no price/Y data");
6742
6861
  return { x: t, prices: s };
6743
6862
  }
6744
- function Vn(i) {
6863
+ function qn(i) {
6745
6864
  const e = i.getData(), t = e.x;
6746
6865
  if (!(t != null && t.length))
6747
6866
  throw new Error("[addIndicator] Source series has no X data");
@@ -6750,7 +6869,7 @@ function Vn(i) {
6750
6869
  throw new Error("[addIndicator] Source series has no OHLC data — use candlestick");
6751
6870
  return { x: t, open: n, high: s, low: o, close: r };
6752
6871
  }
6753
- function rt(i, e) {
6872
+ function ct(i, e) {
6754
6873
  if (e) {
6755
6874
  const s = i.getSeries(e);
6756
6875
  if (!s) throw new Error(`[addIndicator] Source series "${e}" not found`);
@@ -6764,11 +6883,11 @@ function rt(i, e) {
6764
6883
  throw new Error("[addIndicator] No line/candlestick/bar series found — pass sourceSeriesId");
6765
6884
  return n;
6766
6885
  }
6767
- async function at(i, e, t, n = {}, s) {
6768
- const o = Yn(i), r = n.id ?? o, a = e instanceof Float32Array || e instanceof Float64Array ? e : Float32Array.from(e);
6886
+ async function ut(i, e, t, n = {}, s) {
6887
+ const o = Hn(i), r = n.id ?? o, a = e instanceof Float32Array || e instanceof Float64Array ? e : Float32Array.from(e);
6769
6888
  switch (o) {
6770
6889
  case "rsi": {
6771
- const l = n.period ?? 14, { values: h } = await Dn(t, l);
6890
+ const l = n.period ?? 14, { values: h } = await _n(t, l);
6772
6891
  return {
6773
6892
  id: r,
6774
6893
  preset: "rsi",
@@ -6785,7 +6904,7 @@ async function at(i, e, t, n = {}, s) {
6785
6904
  };
6786
6905
  }
6787
6906
  case "macd": {
6788
- const l = n.fastPeriod ?? 12, h = n.slowPeriod ?? 26, d = n.signalPeriod ?? 9, c = await On(t, l, h, d);
6907
+ const l = n.fastPeriod ?? 12, h = n.slowPeriod ?? 26, d = n.signalPeriod ?? 9, c = await Wn(t, l, h, d);
6789
6908
  return {
6790
6909
  id: r,
6791
6910
  preset: "macd",
@@ -6806,7 +6925,7 @@ async function at(i, e, t, n = {}, s) {
6806
6925
  };
6807
6926
  }
6808
6927
  case "bollinger": {
6809
- const l = n.period ?? 20, h = n.stdDev ?? 2, d = await $n(t, l, h), c = d.upper ?? d.values, f = d.lower ?? d.values;
6928
+ const l = n.period ?? 20, h = n.stdDev ?? 2, d = await Nn(t, l, h), c = d.upper ?? d.values, f = d.lower ?? d.values;
6810
6929
  return {
6811
6930
  id: r,
6812
6931
  preset: "bollinger",
@@ -6826,7 +6945,7 @@ async function at(i, e, t, n = {}, s) {
6826
6945
  };
6827
6946
  }
6828
6947
  case "ema": {
6829
- const l = n.period ?? 14, { values: h } = await zn(t, l);
6948
+ const l = n.period ?? 14, { values: h } = await Xn(t, l);
6830
6949
  return {
6831
6950
  id: r,
6832
6951
  preset: "ema",
@@ -6838,7 +6957,7 @@ async function at(i, e, t, n = {}, s) {
6838
6957
  };
6839
6958
  }
6840
6959
  case "sma": {
6841
- const l = n.period ?? 14, { values: h } = await Ln(t, l);
6960
+ const l = n.period ?? 14, { values: h } = await Vn(t, l);
6842
6961
  return {
6843
6962
  id: r,
6844
6963
  preset: "sma",
@@ -6852,7 +6971,7 @@ async function at(i, e, t, n = {}, s) {
6852
6971
  case "stochastic": {
6853
6972
  if (!s)
6854
6973
  throw new Error("[addIndicator] stochastic requires a candlestick source series");
6855
- const l = Vn(s), h = n.period ?? 14, d = n.signalPeriod ?? 3, c = vt(l, h, d);
6974
+ const l = qn(s), h = n.period ?? 14, d = n.signalPeriod ?? 3, c = Ct(l, h, d);
6856
6975
  return {
6857
6976
  id: r,
6858
6977
  preset: "stochastic",
@@ -6875,25 +6994,25 @@ async function at(i, e, t, n = {}, s) {
6875
6994
  throw new Error(`[addIndicator] Unknown preset: ${i}`);
6876
6995
  }
6877
6996
  }
6878
- function Wn(i, e) {
6997
+ function Gn(i, e) {
6879
6998
  for (const t of [...i.getAllSeries()]) {
6880
6999
  const n = t.getId();
6881
7000
  (n === e || n.startsWith(`${e}-`)) && i.removeSeries(n);
6882
7001
  }
6883
7002
  }
6884
- async function Xn(i, e, t = {}) {
6885
- const n = rt(i, t.sourceSeriesId), { x: s, prices: o } = _n(n);
6886
- return at(e, s, o, t, n);
7003
+ async function jn(i, e, t = {}) {
7004
+ const n = ct(i, t.sourceSeriesId), { x: s, prices: o } = Un(n);
7005
+ return ut(e, s, o, t, n);
6887
7006
  }
6888
- async function Nn(i, e, t = {}) {
7007
+ async function Zn(i, e, t = {}) {
6889
7008
  var l;
6890
7009
  if (t.pane === "new")
6891
7010
  throw new Error(
6892
7011
  "[addIndicator] pane: 'new' requires createStackedChart — use buildIndicatorPaneFromPreset() instead"
6893
7012
  );
6894
- const n = rt(i, t.sourceSeriesId), s = t.yAxisId ?? ((l = n.getYAxisId) == null ? void 0 : l.call(n)), o = await Xn(i, e, t);
6895
- Wn(i, o.id);
6896
- const r = we({
7013
+ const n = ct(i, t.sourceSeriesId), s = t.yAxisId ?? ((l = n.getYAxisId) == null ? void 0 : l.call(n)), o = await jn(i, e, t);
7014
+ Gn(i, o.id);
7015
+ const r = Me({
6897
7016
  id: o.id,
6898
7017
  data: o.data,
6899
7018
  name: t.label ?? o.id.toUpperCase()
@@ -6910,9 +7029,9 @@ async function Nn(i, e, t = {}) {
6910
7029
  seriesIds: a
6911
7030
  };
6912
7031
  }
6913
- async function ms(i, e, t, n, s) {
6914
- const o = await at(i, e, t, n, s);
6915
- return Rn({
7032
+ async function Ss(i, e, t, n, s) {
7033
+ const o = await ut(i, e, t, n, s);
7034
+ return On({
6916
7035
  id: n.id ?? o.id,
6917
7036
  height: n.height ?? 0.25,
6918
7037
  label: n.label ?? o.id.toUpperCase(),
@@ -6924,7 +7043,7 @@ async function ms(i, e, t, n, s) {
6924
7043
  data: o.data
6925
7044
  });
6926
7045
  }
6927
- class Hn {
7046
+ class Qn {
6928
7047
  constructor(e, t) {
6929
7048
  m(this, "alerts", /* @__PURE__ */ new Map());
6930
7049
  m(this, "idCounter", 0);
@@ -6932,7 +7051,7 @@ class Hn {
6932
7051
  }
6933
7052
  addAlert(e) {
6934
7053
  const t = e.id ?? `alert_${++this.idCounter}`;
6935
- return this.alerts.set(t, { ...e, id: t, latched: !1 }), t;
7054
+ return this.alerts.set(t, { ...e, id: t }), t;
6936
7055
  }
6937
7056
  removeAlert(e) {
6938
7057
  return this.alerts.delete(e);
@@ -6941,12 +7060,11 @@ class Hn {
6941
7060
  this.alerts.clear();
6942
7061
  }
6943
7062
  getAlerts() {
6944
- return Array.from(this.alerts.values()).map(({ latched: e, ...t }) => t);
7063
+ return Array.from(this.alerts.values());
6945
7064
  }
6946
7065
  /** Call after data updates / render tick. */
6947
7066
  evaluate() {
6948
7067
  for (const [e, t] of [...this.alerts.entries()]) {
6949
- if (t.latched && t.once !== !1) continue;
6950
7068
  const n = this.getSeries(t.seriesId);
6951
7069
  if (!n) continue;
6952
7070
  const s = n.getData(), o = s.close ?? s.y;
@@ -6975,43 +7093,43 @@ class Hn {
6975
7093
  triggeredAt: Date.now(),
6976
7094
  triggerPrice: r
6977
7095
  };
6978
- this.events.emit("alert", h), t.once !== !1 && (t.latched = !0, this.alerts.delete(e));
7096
+ this.events.emit("alert", h), t.once !== !1 && this.alerts.delete(e);
6979
7097
  }
6980
7098
  }
6981
7099
  destroy() {
6982
7100
  this.alerts.clear();
6983
7101
  }
6984
7102
  }
6985
- const Un = {
7103
+ const Jn = {
6986
7104
  entry: "#38bdf8",
6987
7105
  sl: "#ef4444",
6988
7106
  tp: "#22c55e"
6989
- }, qn = {
7107
+ }, Kn = {
6990
7108
  entry: "Entry",
6991
7109
  sl: "SL",
6992
7110
  tp: "TP"
6993
7111
  };
6994
- function Gn(i, e) {
7112
+ function es(i, e) {
6995
7113
  const t = i.style ?? "entry";
6996
7114
  return {
6997
7115
  id: e,
6998
7116
  type: "horizontal-line",
6999
7117
  y: i.price,
7000
- color: i.color ?? Un[t],
7001
- label: i.label ?? qn[t],
7118
+ color: i.color ?? Jn[t],
7119
+ label: i.label ?? Kn[t],
7002
7120
  labelPosition: "right",
7003
7121
  lineDash: t === "sl" ? [6, 4] : t === "tp" ? [4, 4] : void 0,
7004
7122
  interactive: i.interactive ?? !1
7005
7123
  };
7006
7124
  }
7007
- class jn {
7125
+ class ts {
7008
7126
  constructor(e) {
7009
7127
  m(this, "container");
7010
7128
  m(this, "webglCanvas");
7011
7129
  m(this, "overlayCanvas");
7012
7130
  m(this, "overlayCtx");
7013
7131
  m(this, "series", /* @__PURE__ */ new Map());
7014
- m(this, "events", new dt());
7132
+ m(this, "events", new mt());
7015
7133
  m(this, "viewBounds", {
7016
7134
  xMin: -0.5,
7017
7135
  xMax: 0.5,
@@ -7022,6 +7140,12 @@ class jn {
7022
7140
  m(this, "yAxisOptionsMap");
7023
7141
  m(this, "primaryYAxisId");
7024
7142
  m(this, "dpr");
7143
+ /**
7144
+ * When set, overrides the device pixel ratio used by `resize()` instead of
7145
+ * recomputing it from `window.devicePixelRatio`. Used by high-resolution
7146
+ * export (snapshot) so the boosted DPR is not clobbered on the next resize.
7147
+ */
7148
+ m(this, "dprOverride", null);
7025
7149
  m(this, "backgroundColor");
7026
7150
  m(this, "plotAreaBackground");
7027
7151
  m(this, "renderer");
@@ -7073,14 +7197,14 @@ class jn {
7073
7197
  m(this, "timeScaleMapping", null);
7074
7198
  m(this, "positionLineCounter", 0);
7075
7199
  this.initialOptions = e, this.container = e.container, this.chartId = e.id ?? `chart_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
7076
- const t = sn(this.container, e);
7077
- if (this.baseTheme = t.theme, this.theme = t.theme, this.colorScheme = e.colorScheme ? Oe(e.colorScheme) : $e(t.theme.isDark), this.backgroundColor = t.backgroundColor, this.plotAreaBackground = t.plotAreaColor, this.showLegend = t.showLegend, this.showControls = t.showControls, this.toolbarOptions = e.toolbar, this.autoScroll = t.autoScroll, this.showStatistics = t.showStatistics, this.dpr = t.dpr, this.xAxisOptions = t.xAxisOptions, this.xScale = t.xScale, this.yAxisOptionsMap = t.yAxisOptionsMap, this.yScales = t.yScales, this.primaryYAxisId = t.primaryYAxisId, this.webglCanvas = t.webglCanvas, this.overlayCanvas = t.overlayCanvas, this.overlayCtx = t.overlayCtx, this.layout = t.layout, this.layout.crosshair && this.enableCursor({
7200
+ const t = hn(this.container, e);
7201
+ if (this.baseTheme = t.theme, this.theme = t.theme, this.colorScheme = e.colorScheme ? Ye(e.colorScheme) : $e(t.theme.isDark), this.backgroundColor = t.backgroundColor, this.plotAreaBackground = t.plotAreaColor, this.showLegend = t.showLegend, this.showControls = t.showControls, this.toolbarOptions = e.toolbar, this.autoScroll = t.autoScroll, this.showStatistics = t.showStatistics, this.dpr = t.dpr, this.xAxisOptions = t.xAxisOptions, this.xScale = t.xScale, this.yAxisOptionsMap = t.yAxisOptionsMap, this.yScales = t.yScales, this.primaryYAxisId = t.primaryYAxisId, this.webglCanvas = t.webglCanvas, this.overlayCanvas = t.overlayCanvas, this.overlayCtx = t.overlayCtx, this.layout = t.layout, this.layout.crosshair && this.enableCursor({
7078
7202
  enabled: this.layout.crosshair.enabled !== !1,
7079
7203
  crosshair: !0,
7080
7204
  snap: this.layout.crosshair.snapToData,
7081
7205
  valueDisplayMode: this.layout.crosshair.valueDisplayMode,
7082
7206
  cornerPosition: this.layout.crosshair.cornerPosition
7083
- }), this.pluginManager = new fn({
7207
+ }), this.pluginManager = new xn({
7084
7208
  chart: this,
7085
7209
  container: this.container,
7086
7210
  theme: this.theme,
@@ -7119,18 +7243,18 @@ class jn {
7119
7243
  var r;
7120
7244
  return (r = this.pluginManager) == null ? void 0 : r.get(o);
7121
7245
  }
7122
- }), this.pluginBridge = new wn(this.pluginManager), e.loading !== !1) {
7246
+ }), this.pluginBridge = new kn(this.pluginManager), e.loading !== !1) {
7123
7247
  const o = typeof e.loading == "object" ? e.loading : {
7124
- message: "Loading SciPlot...",
7248
+ message: "Loading VeloPlot...",
7125
7249
  overlayOpacity: 0.1
7126
7250
  };
7127
- this.use(gt({
7251
+ this.use(xt({
7128
7252
  ...o,
7129
7253
  autoShow: !0
7130
7254
  // Ensure it shows immediately
7131
7255
  }));
7132
7256
  }
7133
- e.plugins && e.plugins.forEach((o) => this.use(o)), (e.renderer ?? "webgl") === "webgpu" ? this.rendererInitPromise = this.initGpuRenderer() : (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.overlay = new ii(this.overlayCtx, this.theme), this.selectionManager = new oi({
7257
+ e.plugins && e.plugins.forEach((o) => this.use(o)), (e.renderer ?? "webgl") === "webgpu" ? this.rendererInitPromise = this.initGpuRenderer() : (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.overlay = new ai(this.overlayCtx, this.theme), this.selectionManager = new ci({
7134
7258
  getSeries: () => this.series,
7135
7259
  getPlotArea: () => this.getPlotArea(),
7136
7260
  getXScale: () => this.xScale,
@@ -7141,18 +7265,18 @@ class jn {
7141
7265
  requestRender: () => this.requestRender()
7142
7266
  }), this.events.on("selectionChange", (o) => {
7143
7267
  this.pluginManager.notifySelectionChange(o.selected);
7144
- }), this.animationEngine = new it(), this.animationConfig = typeof e.animations == "boolean" ? { ...X, enabled: e.animations } : _e(e.animations);
7268
+ }), this.animationEngine = new st(), this.animationConfig = typeof e.animations == "boolean" ? { ...N, enabled: e.animations } : Ve(e.animations);
7145
7269
  const s = typeof e.responsive == "boolean" ? { enabled: e.responsive } : e.responsive;
7146
- this.responsiveManager = new ri(
7270
+ this.responsiveManager = new ui(
7147
7271
  {
7148
7272
  container: this.container,
7149
7273
  onStateChange: (o) => this.handleResponsiveChange(o)
7150
7274
  },
7151
7275
  s
7152
- ), this.alertManager = new Hn(this.events, (o) => {
7276
+ ), this.alertManager = new Qn(this.events, (o) => {
7153
7277
  const r = o ? this.series.get(o) : void 0;
7154
7278
  return r || this.series.values().next().value;
7155
- }), this.axisManager = new Sn({
7279
+ }), this.axisManager = new Pn({
7156
7280
  xAxisOptions: this.xAxisOptions,
7157
7281
  xScale: this.xScale,
7158
7282
  yAxisOptionsMap: this.yAxisOptionsMap,
@@ -7160,7 +7284,7 @@ class jn {
7160
7284
  primaryYAxisId: this.primaryYAxisId,
7161
7285
  series: this.series,
7162
7286
  requestRender: () => this.requestRender()
7163
- }), this.stateManager = new kn({
7287
+ }), this.stateManager = new Rn({
7164
7288
  viewBounds: this.viewBounds,
7165
7289
  xAxisOptions: this.xAxisOptions,
7166
7290
  xScale: this.xScale,
@@ -7181,7 +7305,7 @@ class jn {
7181
7305
  removeSeries: (o) => this.removeSeries(o),
7182
7306
  addSeries: (o) => this.addSeries(o),
7183
7307
  requestRender: () => this.requestRender()
7184
- }), this.renderLoop = new En({
7308
+ }), this.renderLoop = new zn({
7185
7309
  webglCanvas: this.webglCanvas,
7186
7310
  overlayCanvas: this.overlayCanvas,
7187
7311
  overlayCtx: this.overlayCtx,
@@ -7215,7 +7339,7 @@ class jn {
7215
7339
  get yScale() {
7216
7340
  return this.yScales.get(this.primaryYAxisId) || this.yScales.values().next().value;
7217
7341
  }
7218
- }), this.interaction = new ni(
7342
+ }), this.interaction = new li(
7219
7343
  this.container,
7220
7344
  {
7221
7345
  onZoom: (o, r) => {
@@ -7252,6 +7376,7 @@ class jn {
7252
7376
  var o;
7253
7377
  this.cursorPosition = null, (o = this.cursorOptions) != null && o.enabled && (this.container.style.cursor = "default"), this.hoveredSeriesId && (this.hoveredSeriesId = null, this.requestRender()), this.tooltip && this.tooltip.handleCursorLeave(), this.requestOverlayRender();
7254
7378
  },
7379
+ onDoubleTap: () => this.resetZoom(),
7255
7380
  onBoxSelect: (o, r) => {
7256
7381
  if (o) {
7257
7382
  const a = this.xScale, h = this.yScales.get(this.primaryYAxisId);
@@ -7311,7 +7436,7 @@ class jn {
7311
7436
  },
7312
7437
  () => this.getPlotArea(),
7313
7438
  (o) => this.getInteractedBounds(o),
7314
- () => rn(this.yAxisOptionsMap)
7439
+ () => un(this.yAxisOptionsMap)
7315
7440
  ), this.resizeObserver = new ResizeObserver(() => {
7316
7441
  !this.isDestroyed && !this.resizeSuspended && this.resize();
7317
7442
  }), this.resizeObserver.observe(this.container), this.initControls(), this.initLegend(e);
@@ -7324,7 +7449,8 @@ class jn {
7324
7449
  return this._isDestroyed;
7325
7450
  }
7326
7451
  setXScale(e) {
7327
- this.xScale = e, this.requestRender();
7452
+ var t, n, s;
7453
+ this.xScale = e, (t = this.axisManager) == null || t.setXScale(e), (n = this.renderLoop) == null || n.setXScale(e), (s = this.stateManager) == null || s.setXScale(e), this.requestRender();
7328
7454
  }
7329
7455
  setYScale(e, t) {
7330
7456
  this.yScales.set(e, t), this.requestRender();
@@ -7384,6 +7510,9 @@ class jn {
7384
7510
  get forecasting() {
7385
7511
  return this.pluginBridge.forecasting;
7386
7512
  }
7513
+ get patterns() {
7514
+ return this.pluginBridge.patterns;
7515
+ }
7387
7516
  get latex() {
7388
7517
  var e;
7389
7518
  return ((e = this.pluginBridge) == null ? void 0 : e.latex) ?? this.getPluginAPI("velo-plot-latex");
@@ -7405,7 +7534,7 @@ class jn {
7405
7534
  e.fn();
7406
7535
  } catch (t) {
7407
7536
  console.error(
7408
- `[SciPlot] Error executing queued command '${e.name}':`,
7537
+ `[VeloPlot] Error executing queued command '${e.name}':`,
7409
7538
  t
7410
7539
  );
7411
7540
  }
@@ -7416,7 +7545,7 @@ class jn {
7416
7545
  * Mark this chart's initialization as complete in the queue
7417
7546
  */
7418
7547
  async completeInit() {
7419
- this.initQueueId && (this._isDestroyed || (await this.animationEngine.waitForIdle(), await new Promise((e) => setTimeout(e, 60))), this.initQueueId && (Ie(this.initQueueId), this.initQueueId = null));
7548
+ this.initQueueId && (this._isDestroyed || (await this.animationEngine.waitForIdle(), await new Promise((e) => setTimeout(e, 60))), this.initQueueId && (Ee(this.initQueueId), this.initQueueId = null));
7420
7549
  }
7421
7550
  executeOrQueue(e, t) {
7422
7551
  this.renderLoop.isInitStarted() ? t() : this.commandQueue.push({ fn: t, name: e });
@@ -7428,7 +7557,7 @@ class jn {
7428
7557
  this.initQueueId = e;
7429
7558
  }
7430
7559
  initControls() {
7431
- this.controls = mn({
7560
+ this.controls = wn({
7432
7561
  container: this.container,
7433
7562
  theme: this.theme,
7434
7563
  showControls: this.showControls,
@@ -7464,7 +7593,7 @@ class jn {
7464
7593
  initLegend(e) {
7465
7594
  var n;
7466
7595
  const t = (n = e.layout) == null ? void 0 : n.legend;
7467
- this.legend = pn(
7596
+ this.legend = Mn(
7468
7597
  {
7469
7598
  container: this.container,
7470
7599
  theme: this.theme,
@@ -7501,7 +7630,7 @@ class jn {
7501
7630
  if (this.hoveredSeriesId = s.getId(), o) {
7502
7631
  const l = s.getStyle();
7503
7632
  this.originalSeriesStyles.set(s.getId(), { ...l });
7504
- const h = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) || Et(l.color || "#ff0055", this.theme.isDark);
7633
+ const h = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) || Lt(l.color || "#ff0055", this.theme.isDark);
7505
7634
  s.setStyle({
7506
7635
  color: h
7507
7636
  }), (a = this.legend) == null || a.updateSeriesStyle(s);
@@ -7525,14 +7654,14 @@ class jn {
7525
7654
  );
7526
7655
  }
7527
7656
  setTheme(e) {
7528
- this.baseTheme = typeof e == "string" ? et(e) : e, this.theme = this.responsiveManager.scaleTheme(this.baseTheme), this.backgroundColor = _(this.theme.backgroundColor), this.plotAreaBackground = _(this.theme.plotAreaBackground || this.theme.backgroundColor), this.container.style.backgroundColor = this.theme.backgroundColor, this.overlay.setTheme(this.theme), this.tooltip.updateChartTheme(this.theme), this.controls && this.controls.updateTheme(this.theme), this.legend && this.legend.updateTheme(this.theme), this.initialOptions.colorScheme || (this.colorScheme = $e(this.theme.isDark)), this.requestRender();
7657
+ this.baseTheme = typeof e == "string" ? it(e) : e, this.theme = this.responsiveManager.scaleTheme(this.baseTheme), this.backgroundColor = _(this.theme.backgroundColor), this.plotAreaBackground = _(this.theme.plotAreaBackground || this.theme.backgroundColor), this.container.style.backgroundColor = this.theme.backgroundColor, this.overlay.setTheme(this.theme), this.tooltip.updateChartTheme(this.theme), this.controls && this.controls.updateTheme(this.theme), this.legend && this.legend.updateTheme(this.theme), this.initialOptions.colorScheme || (this.colorScheme = $e(this.theme.isDark)), this.requestRender();
7529
7658
  }
7530
7659
  /**
7531
7660
  * Set the color scheme for multi-series charts
7532
7661
  * @param scheme - Color scheme name ('vibrant', 'pastel', 'neon', 'earth', 'ocean') or ColorScheme object
7533
7662
  */
7534
7663
  setColorScheme(e) {
7535
- this.colorScheme = typeof e == "string" ? Oe(e) : e, this.requestRender();
7664
+ this.colorScheme = typeof e == "string" ? Ye(e) : e, this.requestRender();
7536
7665
  }
7537
7666
  /**
7538
7667
  * Get the current color scheme
@@ -7541,7 +7670,7 @@ class jn {
7541
7670
  return this.colorScheme;
7542
7671
  }
7543
7672
  getPlotArea() {
7544
- return on(this.container, this.yAxisOptionsMap, this.layout);
7673
+ return cn(this.container, this.yAxisOptionsMap, this.layout);
7545
7674
  }
7546
7675
  getInteractedBounds(e) {
7547
7676
  if (e) {
@@ -7556,7 +7685,7 @@ class jn {
7556
7685
  return this.viewBounds;
7557
7686
  }
7558
7687
  exportImage(e = "png") {
7559
- return hi(
7688
+ return gi(
7560
7689
  this.webglCanvas,
7561
7690
  this.overlayCanvas,
7562
7691
  this.backgroundColor,
@@ -7568,7 +7697,7 @@ class jn {
7568
7697
  }
7569
7698
  exportSVG() {
7570
7699
  const e = this.container.getBoundingClientRect();
7571
- return ci(
7700
+ return yi(
7572
7701
  this.getAllSeries(),
7573
7702
  this.viewBounds,
7574
7703
  this.getPlotArea(),
@@ -7611,7 +7740,7 @@ class jn {
7611
7740
  };
7612
7741
  }
7613
7742
  addSeries(e) {
7614
- Zi(this.getSeriesContext(), e);
7743
+ tn(this.getSeriesContext(), e);
7615
7744
  const t = this.series.get(e.id);
7616
7745
  t && this.pluginManager.notifySeriesAdd({ series: t, changeType: "add" });
7617
7746
  }
@@ -7623,11 +7752,11 @@ class jn {
7623
7752
  }
7624
7753
  removeSeries(e) {
7625
7754
  const t = this.series.get(e);
7626
- Ji(this.getSeriesContext(), e), t && this.pluginManager.notifySeriesRemove({ series: t, changeType: "remove" });
7755
+ sn(this.getSeriesContext(), e), t && this.pluginManager.notifySeriesRemove({ series: t, changeType: "remove" });
7627
7756
  }
7628
7757
  updateSeries(e, t) {
7629
7758
  var s, o;
7630
- Ki(this.getSeriesContext(), e, t), this.recalculateTools();
7759
+ on(this.getSeriesContext(), e, t), this.recalculateTools();
7631
7760
  const n = this.series.get(e);
7632
7761
  n && this.pluginManager.notifyDataUpdate({
7633
7762
  seriesId: e,
@@ -7637,7 +7766,7 @@ class jn {
7637
7766
  }), this.alertManager.evaluate();
7638
7767
  }
7639
7768
  appendData(e, t, n) {
7640
- en(this.getSeriesContext(), e, t, n), this.recalculateTools();
7769
+ rn(this.getSeriesContext(), e, t, n), this.recalculateTools();
7641
7770
  const s = this.series.get(e);
7642
7771
  s && this.pluginManager.notifyDataUpdate({
7643
7772
  seriesId: e,
@@ -7650,7 +7779,7 @@ class jn {
7650
7779
  this.autoScroll = e;
7651
7780
  }
7652
7781
  setMaxPoints(e, t) {
7653
- tn(this.getSeriesContext(), e, t);
7782
+ an(this.getSeriesContext(), e, t);
7654
7783
  }
7655
7784
  /**
7656
7785
  * Add a line of best fit to a series
@@ -7667,7 +7796,7 @@ class jn {
7667
7796
  * For stacked layouts use buildIndicatorPaneFromPreset() when creating panes.
7668
7797
  */
7669
7798
  async addIndicator(e, t) {
7670
- return Nn(this, e, t);
7799
+ return Zn(this, e, t);
7671
7800
  }
7672
7801
  addAlert(e) {
7673
7802
  return this.alertManager.addAlert(e);
@@ -7683,7 +7812,7 @@ class jn {
7683
7812
  }
7684
7813
  addPositionLine(e) {
7685
7814
  const t = e.id ?? `position-${++this.positionLineCounter}`;
7686
- return this.addAnnotation(Gn(e, t)), t;
7815
+ return this.addAnnotation(es(e, t)), t;
7687
7816
  }
7688
7817
  setDrawingMode(e) {
7689
7818
  var n;
@@ -7720,15 +7849,15 @@ class jn {
7720
7849
  zoom(e) {
7721
7850
  const t = { ...this.viewBounds };
7722
7851
  if (this.animationConfig.enabled && e.animate !== !1) {
7723
- const n = Mi(
7852
+ const n = Ti(
7724
7853
  this.getAnimatedNavContext(),
7725
7854
  e
7726
7855
  );
7727
7856
  n && n.promise.catch((s) => {
7728
- s.message !== "Animation cancelled" && console.error("[SciPlot] Animation error:", s);
7857
+ s.message !== "Animation cancelled" && console.error("[VeloPlot] Animation error:", s);
7729
7858
  });
7730
7859
  } else
7731
- mi(this.getNavContext(), e);
7860
+ wi(this.getNavContext(), e);
7732
7861
  this.pluginManager.notifyViewChange({
7733
7862
  previous: t,
7734
7863
  current: { ...this.viewBounds },
@@ -7738,7 +7867,7 @@ class jn {
7738
7867
  }
7739
7868
  pan(e, t, n) {
7740
7869
  const s = { ...this.viewBounds };
7741
- pi(this.getNavContext(), e, t, n), this.pluginManager.notifyViewChange({
7870
+ Mi(this.getNavContext(), e, t, n), this.pluginManager.notifyViewChange({
7742
7871
  previous: s,
7743
7872
  current: { ...this.viewBounds },
7744
7873
  trigger: "pan",
@@ -7751,7 +7880,7 @@ class jn {
7751
7880
  fit(e) {
7752
7881
  this.executeOrQueue("fit", () => {
7753
7882
  const t = { ...this.viewBounds }, n = e == null ? void 0 : e.padding;
7754
- bi(this.getNavContext(), {
7883
+ Ci(this.getNavContext(), {
7755
7884
  x: e == null ? void 0 : e.x,
7756
7885
  y: e == null ? void 0 : e.y,
7757
7886
  padding: n
@@ -7773,15 +7902,15 @@ class jn {
7773
7902
  this.executeOrQueue("autoScale", () => {
7774
7903
  const t = { ...this.viewBounds };
7775
7904
  if (this.animationConfig.enabled && e) {
7776
- const n = Ci(
7905
+ const n = Bi(
7777
7906
  this.getAnimatedNavContext(),
7778
7907
  !0
7779
7908
  );
7780
7909
  n && n.promise.catch((s) => {
7781
- s.message !== "Animation cancelled" && console.error("[SciPlot] Animation error:", s);
7910
+ s.message !== "Animation cancelled" && console.error("[VeloPlot] Animation error:", s);
7782
7911
  });
7783
7912
  } else
7784
- xi(this.getNavContext());
7913
+ Si(this.getNavContext());
7785
7914
  this.pluginManager.notifyViewChange({
7786
7915
  previous: t,
7787
7916
  current: { ...this.viewBounds },
@@ -7795,14 +7924,14 @@ class jn {
7795
7924
  * Used during streaming to prevent X-axis shifting
7796
7925
  */
7797
7926
  autoScaleYOnly() {
7798
- vi(this.getNavContext()), this.requestRender();
7927
+ Ai(this.getNavContext()), this.requestRender();
7799
7928
  }
7800
7929
  /**
7801
7930
  * Animate view bounds to specific target
7802
7931
  */
7803
7932
  animateTo(e) {
7804
7933
  var n, s, o, r;
7805
- const t = Ai(
7934
+ const t = Ii(
7806
7935
  this.getAnimatedNavContext(),
7807
7936
  {
7808
7937
  xMin: (n = e.xRange) == null ? void 0 : n[0],
@@ -7816,7 +7945,7 @@ class jn {
7816
7945
  }
7817
7946
  );
7818
7947
  t && t.promise.catch((a) => {
7819
- a.message !== "Animation cancelled" && console.error("[SciPlot] Animation error:", a);
7948
+ a.message !== "Animation cancelled" && console.error("[VeloPlot] Animation error:", a);
7820
7949
  });
7821
7950
  }
7822
7951
  /**
@@ -7829,7 +7958,7 @@ class jn {
7829
7958
  * Set animation configuration
7830
7959
  */
7831
7960
  setAnimationConfig(e) {
7832
- this.animationConfig = _e({
7961
+ this.animationConfig = Ve({
7833
7962
  ...this.animationConfig,
7834
7963
  ...e
7835
7964
  });
@@ -7842,7 +7971,7 @@ class jn {
7842
7971
  }
7843
7972
  handleBoxZoom(e) {
7844
7973
  const t = e === null;
7845
- this.selectionRect = wi(
7974
+ this.selectionRect = ki(
7846
7975
  this.getNavContext(),
7847
7976
  e,
7848
7977
  this.selectionRect,
@@ -7901,10 +8030,10 @@ class jn {
7901
8030
  }
7902
8031
  // Export
7903
8032
  exportCSV(e) {
7904
- return ai(this.getAllSeries(), e);
8033
+ return di(this.getAllSeries(), e);
7905
8034
  }
7906
8035
  exportJSON(e) {
7907
- return li(this.getAllSeries(), this.viewBounds, e);
8036
+ return fi(this.getAllSeries(), this.viewBounds, e);
7908
8037
  }
7909
8038
  // ============================================
7910
8039
  // Axis Management
@@ -7939,7 +8068,7 @@ class jn {
7939
8068
  }
7940
8069
  async initGpuRenderer() {
7941
8070
  var t, n;
7942
- const e = await qt(this.webglCanvas, {
8071
+ const e = await Qt(this.webglCanvas, {
7943
8072
  backend: "webgpu",
7944
8073
  powerPreference: "high-performance"
7945
8074
  });
@@ -7948,7 +8077,7 @@ class jn {
7948
8077
  return;
7949
8078
  }
7950
8079
  console.warn(
7951
- "[SciPlot] WebGPU unavailable — falling back to WebGL2. See docs/adr/001-webgpu-renderer-strategy.md."
8080
+ "[VeloPlot] WebGPU unavailable — falling back to WebGL2. See docs/adr/001-webgpu-renderer-strategy.md."
7952
8081
  ), this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr), (n = this.renderLoop) == null || n.setRenderer(this.renderer);
7953
8082
  }
7954
8083
  /**
@@ -7957,6 +8086,16 @@ class jn {
7957
8086
  setDPR(e) {
7958
8087
  this.dpr = e, this.renderer.setDPR(e), this.overlay.setTheme(this.theme), this.resize(), this.requestRender();
7959
8088
  }
8089
+ /**
8090
+ * Locks the device pixel ratio to an explicit value (or clears the lock with
8091
+ * `null`). Unlike {@link setDPR}, this survives subsequent `resize()` calls,
8092
+ * which is required for high-resolution export: the backing stores must stay
8093
+ * enlarged while the snapshot is captured. Pass `null` to restore automatic
8094
+ * DPR handling based on `window.devicePixelRatio`.
8095
+ */
8096
+ setDevicePixelRatioOverride(e) {
8097
+ this.dprOverride = e, e !== null && (this.dpr = e, this.renderer.setDPR(e), this.overlay.setTheme(this.theme)), this.resize(), this.requestRender();
8098
+ }
7960
8099
  /**
7961
8100
  * Update X axis configuration
7962
8101
  */
@@ -7964,9 +8103,13 @@ class jn {
7964
8103
  this.axisManager.updateXAxis(e), this.requestRender();
7965
8104
  }
7966
8105
  updateLayout(e) {
7967
- this.layout = st({
8106
+ this.layout = at({
7968
8107
  ...this.layout,
7969
- ...e
8108
+ ...e,
8109
+ margins: {
8110
+ ...this.layout.margins,
8111
+ ...e.margins
8112
+ }
7970
8113
  }), this.requestRender();
7971
8114
  }
7972
8115
  /**
@@ -8040,7 +8183,7 @@ class jn {
8040
8183
  }
8041
8184
  /**
8042
8185
  * Set pan mode (true = pan, false = selection)
8043
- * @deprecated Use setMode('pan') or setMode('select') instead
8186
+ * @deprecated Use setMode('pan') or setMode('select') instead. **Removed in v4.0.**
8044
8187
  */
8045
8188
  setPanMode(e) {
8046
8189
  this.interaction.setPanMode(e);
@@ -8053,9 +8196,9 @@ class jn {
8053
8196
  if (this.getMode() === e) return;
8054
8197
  this.selectionManager.clearSelection();
8055
8198
  const n = this.getPluginAPI("velo-plot-tools");
8056
- e === "delta" || e === "peak" ? n ? n.setMode(e) : (console.info(`[SciPlot] Tools plugin not ready, retrying setMode('${e}')...`), setTimeout(() => {
8199
+ e === "delta" || e === "peak" ? n ? n.setMode(e) : (console.info(`[VeloPlot] Tools plugin not ready, retrying setMode('${e}')...`), setTimeout(() => {
8057
8200
  const s = this.getPluginAPI("velo-plot-tools");
8058
- s ? s.setMode(e) : console.warn(`[SciPlot] Tools plugin still not available for mode '${e}'`);
8201
+ s ? s.setMode(e) : console.warn(`[VeloPlot] Tools plugin still not available for mode '${e}'`);
8059
8202
  }, 100)) : n && n.setMode("none"), this.interaction.setMode(e);
8060
8203
  }
8061
8204
  /**
@@ -8167,7 +8310,7 @@ class jn {
8167
8310
  this.resizeSuspended && (this.resizeSuspended = !1);
8168
8311
  }
8169
8312
  }
8170
- /** @deprecated Use CSS transform on pane wrapper during drag; canvas stays untouched. */
8313
+ /** @deprecated Use CSS transform on pane wrapper during drag; canvas stays untouched. **Removed in v4.0.** */
8171
8314
  syncDragLayout(e, t) {
8172
8315
  if (!this.resizeSuspended) return;
8173
8316
  const n = this.container.parentElement, s = Math.max(
@@ -8186,8 +8329,8 @@ class jn {
8186
8329
  // Rendering
8187
8330
  resize() {
8188
8331
  if (this.isDestroyed || this.resizeSuspended || !this.renderer) return;
8189
- const e = this.initialOptions.devicePixelRatio ?? window.devicePixelRatio;
8190
- Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)), an(
8332
+ const e = this.dprOverride ?? this.initialOptions.devicePixelRatio ?? window.devicePixelRatio;
8333
+ Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)), dn(
8191
8334
  this.container,
8192
8335
  this.webglCanvas,
8193
8336
  this.overlayCanvas,
@@ -8231,7 +8374,7 @@ class jn {
8231
8374
  }
8232
8375
  destroy() {
8233
8376
  var e, t;
8234
- for (this._isDestroyed = !0, this.renderLoop.cancelPendingRender(), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = null, this.initQueueId && (Ie(this.initQueueId), this.initQueueId = null), this.animationEngine.destroy(), this.selectionManager.destroy(), this.alertManager.destroy(), this.responsiveManager.destroy(), this.interaction.destroy(), this.series.forEach((n) => {
8377
+ for (this._isDestroyed = !0, this.renderLoop.cancelPendingRender(), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = null, this.initQueueId && (Ee(this.initQueueId), this.initQueueId = null), this.animationEngine.destroy(), this.selectionManager.destroy(), this.alertManager.destroy(), this.responsiveManager.destroy(), this.interaction.destroy(), this.series.forEach((n) => {
8235
8378
  var s;
8236
8379
  (s = this.renderer) == null || s.deleteBuffer(n.getId()), n.destroy();
8237
8380
  }), this.series.clear(), (t = this.renderer) == null || t.destroy(), this.controls && this.controls.destroy(), this.legend && this.legend.destroy(), this.pluginManager.destroy(); this.container.firstChild; )
@@ -8247,11 +8390,11 @@ class jn {
8247
8390
  this.selectionManager.clearSelection(), await new Promise((e) => requestAnimationFrame(() => requestAnimationFrame(e))), this.animationEngine.isAnimating() && await this.animationEngine.waitForIdle(), this.deltaTool && this.deltaTool.recalculate(), this.peakTool && this.peakTool.recalculate(), this.requestOverlayRender();
8248
8391
  }
8249
8392
  }
8250
- function ps(i) {
8251
- const e = new jn(i);
8252
- return bn().then((t) => {
8393
+ function Cs(i) {
8394
+ const e = new ts(i);
8395
+ return Cn().then((t) => {
8253
8396
  if (e.setInitQueueId(t), e.isDestroyed) {
8254
- Ie(t);
8397
+ Ee(t);
8255
8398
  return;
8256
8399
  }
8257
8400
  e.startInit().then(() => {
@@ -8260,65 +8403,65 @@ function ps(i) {
8260
8403
  }), e;
8261
8404
  }
8262
8405
  export {
8263
- os as $,
8264
- it as A,
8265
- ns as B,
8266
- vn as C,
8267
- Te as D,
8268
- ei as E,
8269
- et as F,
8270
- O as G,
8271
- ot as H,
8272
- Xe as I,
8273
- Ne as J,
8274
- Mn as K,
8275
- Kt as L,
8276
- ae as M,
8406
+ ds as $,
8407
+ st as A,
8408
+ Ve as B,
8409
+ us as C,
8410
+ Ie as D,
8411
+ oi as E,
8412
+ An as F,
8413
+ ms as G,
8414
+ ps as H,
8415
+ xs as I,
8416
+ bs as J,
8417
+ Ke as K,
8418
+ te as L,
8419
+ ii as M,
8277
8420
  Pe as N,
8278
- ii as O,
8279
- Cn as P,
8280
- An as Q,
8281
- Pn as R,
8282
- Di as S,
8283
- fs as T,
8284
- gs as U,
8285
- Dn as V,
8286
- Ln as W,
8287
- zn as X,
8288
- On as Y,
8289
- $n as Z,
8290
- ys as _,
8291
- Nn as a,
8292
- Rn as a0,
8293
- at as a1,
8294
- rs as a2,
8295
- Gn as a3,
8296
- dn as a4,
8297
- fn as a5,
8298
- ms as b,
8299
- ps as c,
8300
- Xn as d,
8301
- qi as e,
8302
- ti as f,
8303
- we as g,
8304
- _n as h,
8305
- ls as i,
8306
- te as j,
8307
- Si as k,
8308
- X as l,
8309
- st as m,
8310
- _e as n,
8311
- ss as o,
8312
- hs as p,
8313
- cs as q,
8314
- rt as r,
8315
- Y as s,
8316
- ds as t,
8317
- ie as u,
8318
- as as v,
8319
- us as w,
8320
- Qe as x,
8321
- _ as y,
8322
- Jt as z
8421
+ ai as O,
8422
+ _ as P,
8423
+ O as Q,
8424
+ lt as R,
8425
+ $i as S,
8426
+ Ne as T,
8427
+ He as U,
8428
+ Tn as V,
8429
+ Bn as W,
8430
+ In as X,
8431
+ En as Y,
8432
+ vs as Z,
8433
+ ws as _,
8434
+ ie as a,
8435
+ On as a0,
8436
+ ut as a1,
8437
+ fs as a2,
8438
+ es as a3,
8439
+ pn as a4,
8440
+ xn as a5,
8441
+ gs as b,
8442
+ Cs as c,
8443
+ ni as d,
8444
+ ri as e,
8445
+ cs as f,
8446
+ it as g,
8447
+ Xn as h,
8448
+ Nn as i,
8449
+ Ms as j,
8450
+ Zn as k,
8451
+ Ss as l,
8452
+ Wn as m,
8453
+ jn as n,
8454
+ Ji as o,
8455
+ at as p,
8456
+ ae as q,
8457
+ _n as r,
8458
+ Vn as s,
8459
+ Me as t,
8460
+ ct as u,
8461
+ Un as v,
8462
+ ys as w,
8463
+ $ as x,
8464
+ Pi as y,
8465
+ N as z
8323
8466
  };
8324
- //# sourceMappingURL=ChartCore-BhQ4j7f5.js.map
8467
+ //# sourceMappingURL=ChartCore-BpzRvN4Y.js.map