kline-orderbook-chart 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +145 -37
- package/dist/chart_engine.js +1 -1
- package/dist/chart_engine_bg.wasm +0 -0
- package/dist/mrd-chart-engine.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,181 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<h1 align="center">@mrd/chart-engine</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Candlestick chart with built-in orderbook heatmap, footprint chart, and liquidation heatmap.<br/>Native high-performance engine. 60 fps. Zero dependencies.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://app.mrd-indicators.com/trading/chart-terminal">Live Demo</a>
|
|
9
|
+
·
|
|
10
|
+
<a href="https://github.com/mrd-chart/chart-engine/tree/main/docs">Documentation</a>
|
|
11
|
+
·
|
|
12
|
+
<a href="https://app.mrd-indicators.com/charting-library/pricing">Pricing</a>
|
|
13
|
+
·
|
|
14
|
+
<a href="https://discord.gg/buX2h5ZZm">Discord</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img alt="bundle" src="https://img.shields.io/badge/bundle-380KB_gzip-0a7cff" />
|
|
19
|
+
<img alt="zero dependencies" src="https://img.shields.io/badge/dependencies-0-brightgreen" />
|
|
20
|
+
<img alt="framework agnostic" src="https://img.shields.io/badge/framework-agnostic-blueviolet" />
|
|
21
|
+
<img alt="license" src="https://img.shields.io/badge/license-commercial-orange" />
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
4
25
|
|
|
5
26
|
## Install
|
|
6
27
|
|
|
7
28
|
```bash
|
|
8
|
-
npm install
|
|
29
|
+
npm install @mrd/chart-engine
|
|
9
30
|
```
|
|
10
31
|
|
|
32
|
+
---
|
|
33
|
+
|
|
11
34
|
## Quick Start
|
|
12
35
|
|
|
13
36
|
```javascript
|
|
14
|
-
import { createChartBridge,
|
|
37
|
+
import { createChartBridge, prefetchWasm } from '@mrd/chart-engine'
|
|
15
38
|
|
|
16
|
-
//
|
|
17
|
-
|
|
39
|
+
// Preload the engine binary in the background
|
|
40
|
+
prefetchWasm()
|
|
18
41
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
42
|
+
const chart = await createChartBridge(document.getElementById('chart'), {
|
|
43
|
+
licenseKey: 'MRD-XXXX-XXXX-XXXX-20270101',
|
|
44
|
+
theme: 'dark',
|
|
45
|
+
precision: 2,
|
|
46
|
+
intervalSec: 3600,
|
|
23
47
|
})
|
|
24
48
|
|
|
25
49
|
// Load candlestick data
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
])
|
|
30
|
-
|
|
31
|
-
|
|
50
|
+
// Timestamps are in seconds — divide Binance ms timestamps by 1000
|
|
51
|
+
const len = rawKlines.length
|
|
52
|
+
const timestamps = new Float64Array(rawKlines.map(k => k[0] / 1000))
|
|
53
|
+
const open = new Float64Array(rawKlines.map(k => +k[1]))
|
|
54
|
+
const high = new Float64Array(rawKlines.map(k => +k[2]))
|
|
55
|
+
const low = new Float64Array(rawKlines.map(k => +k[3]))
|
|
56
|
+
const close = new Float64Array(rawKlines.map(k => +k[4]))
|
|
57
|
+
const volume = new Float64Array(rawKlines.map(k => +k[5]))
|
|
58
|
+
|
|
59
|
+
chart.setKlines(timestamps, open, high, low, close, volume)
|
|
32
60
|
|
|
33
61
|
// Enable indicators
|
|
34
62
|
chart.enableVolume(true)
|
|
35
63
|
chart.enableRsi(true, 14)
|
|
36
|
-
chart.
|
|
64
|
+
chart.enableCvd(true)
|
|
37
65
|
|
|
38
66
|
// Start rendering
|
|
39
67
|
chart.start()
|
|
40
68
|
|
|
41
|
-
// Real-time update
|
|
42
|
-
|
|
69
|
+
// Real-time update from WebSocket
|
|
70
|
+
ws.onmessage = (e) => {
|
|
71
|
+
const { k } = JSON.parse(e.data)
|
|
72
|
+
if (k.x) chart.appendKline(k.t / 1000, +k.o, +k.h, +k.l, +k.c, +k.v)
|
|
73
|
+
else chart.updateLastKline(k.t / 1000, +k.o, +k.h, +k.l, +k.c, +k.v)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Resize on container resize
|
|
77
|
+
new ResizeObserver(() => chart.resize()).observe(canvas.parentElement)
|
|
78
|
+
|
|
79
|
+
// Pause when tab is hidden
|
|
80
|
+
document.addEventListener('visibilitychange', () =>
|
|
81
|
+
document.hidden ? chart.pause() : chart.resume()
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
// Free engine memory on component unmount
|
|
85
|
+
chart.destroy()
|
|
43
86
|
```
|
|
44
87
|
|
|
45
|
-
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Orderbook Heatmap
|
|
46
91
|
|
|
47
92
|
```javascript
|
|
48
|
-
|
|
93
|
+
// matrix: Float64Array of length rows * cols, row-major
|
|
94
|
+
// yStart: lowest price level, yStep: price per row
|
|
95
|
+
// xStart: Unix timestamp (seconds) of first column, xStep: seconds per column
|
|
96
|
+
chart.setHeatmap(matrix, rows, cols, xStart, xStep, yStart, yStep)
|
|
49
97
|
chart.enableHeatmap(true)
|
|
98
|
+
|
|
99
|
+
// Append a new column in real-time
|
|
100
|
+
chart.appendHeatmapColumn(colData, colTimestamp, yStart, yStep)
|
|
101
|
+
|
|
102
|
+
// Update the current column as the order book ticks
|
|
103
|
+
chart.updateLastHeatmapColumn(colData, yStart, yStep)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Footprint Chart
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
chart.setChartType(2)
|
|
112
|
+
chart.setFootprintTickSize(10)
|
|
113
|
+
chart.footprintEnsureLen(timestamps.length)
|
|
114
|
+
|
|
115
|
+
// Batch-add trades from aggTrade stream (flat Float64Array: barIdx, price, qty, isBuyerMaker)
|
|
116
|
+
chart.footprintAddTradeBatch(flat) // flat.length must be a multiple of 4
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Drawing Tools
|
|
122
|
+
|
|
123
|
+
```javascript
|
|
124
|
+
chart.setDrawingTool('fibonacci') // trendline | horizontal | arrow | fibonacci |
|
|
125
|
+
// extension | long | short | vwap | elliott | label
|
|
126
|
+
|
|
127
|
+
chart.getDrawingsJson() // export → JSON string
|
|
128
|
+
chart.setDrawingsJson(json) // restore saved drawings
|
|
129
|
+
|
|
130
|
+
chart.onDrawingComplete = (id, type, points) => { /* persist to backend */ }
|
|
50
131
|
```
|
|
51
132
|
|
|
133
|
+
---
|
|
134
|
+
|
|
52
135
|
## Features
|
|
53
136
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
137
|
+
| | Standard | Professional | Enterprise |
|
|
138
|
+
|---|:---:|:---:|:---:|
|
|
139
|
+
| Candlestick + Volume | ✓ | ✓ | ✓ |
|
|
140
|
+
| RSI + EMA | ✓ | ✓ | ✓ |
|
|
141
|
+
| 5 drawing tools | ✓ | ✓ | ✓ |
|
|
142
|
+
| All 10+ drawing tools | — | ✓ | ✓ |
|
|
143
|
+
| Orderbook Heatmap | — | ✓ | ✓ |
|
|
144
|
+
| Footprint Chart | — | ✓ | ✓ |
|
|
145
|
+
| Liquidation Heatmap | — | ✓ | ✓ |
|
|
146
|
+
| OI / CVD / Funding Rate | — | ✓ | ✓ |
|
|
147
|
+
| Large Trade Bubbles | — | ✓ | ✓ |
|
|
148
|
+
| VRVP / TPO | — | — | ✓ |
|
|
149
|
+
| Smart Money Concepts | — | — | ✓ |
|
|
150
|
+
| VPIN / Stops & Icebergs | — | — | ✓ |
|
|
151
|
+
| Custom Indicator Plugin | — | — | ✓ |
|
|
152
|
+
| White-label | — | — | ✓ |
|
|
153
|
+
|
|
154
|
+
[View full pricing →](https://app.mrd-indicators.com/charting-library/pricing)
|
|
63
155
|
|
|
64
|
-
|
|
156
|
+
---
|
|
65
157
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
158
|
+
## Browser Support
|
|
159
|
+
|
|
160
|
+
Chrome 80+ · Firefox 79+ · Safari 15.2+ · Edge 80+ · Mobile Chrome · Mobile Safari
|
|
161
|
+
|
|
162
|
+
Requires a modern browser (ES2020+).
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Documentation
|
|
167
|
+
|
|
168
|
+
[Getting Started](https://github.com/mrd-chart/chart-engine/blob/main/docs/guides/getting-started.md) · [API Reference](https://github.com/mrd-chart/chart-engine/blob/main/docs/api/README.md) · [Data Guide](https://github.com/mrd-chart/chart-engine/blob/main/docs/guides/data.md) · [Indicators](https://github.com/mrd-chart/chart-engine/blob/main/docs/guides/indicators.md) · [React](https://github.com/mrd-chart/chart-engine/blob/main/docs/examples/react.md) · [Vue](https://github.com/mrd-chart/chart-engine/blob/main/docs/examples/vue.md) · [Svelte](https://github.com/mrd-chart/chart-engine/blob/main/docs/examples/svelte.md)
|
|
169
|
+
|
|
170
|
+
---
|
|
70
171
|
|
|
71
172
|
## License
|
|
72
173
|
|
|
73
|
-
Commercial software.
|
|
174
|
+
Commercial software. A valid license key is required for production use.
|
|
175
|
+
**14-day free trial available** — [get a trial key](https://app.mrd-indicators.com/charting-library/pricing).
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
<p align="center">
|
|
180
|
+
<sub>© 2026 MRD Technologies · <a href="https://app.mrd-indicators.com">app.mrd-indicators.com</a> · <a href="https://discord.gg/buX2h5ZZm">Discord</a></sub>
|
|
181
|
+
</p>
|
package/dist/chart_engine.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class E{__destroy_into_raw(){const _=this.__mrd_ptr;return this.__mrd_ptr=0,L.unregister(this),_}free(){const _=this.__destroy_into_raw();t.__mrd_chartengine_free(_,0)}add_anchored_vwap(_,e,r,n,i,s,a){return t.chartengine_add_anchored_vwap(this.__mrd_ptr,_,e,r,n,i,s,a)>>>0}add_arrow(_,e,r,n,i,s,a,d,h,p){return t.chartengine_add_arrow(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p)>>>0}add_arrow_marker_down(_,e,r,n,i,s,a){return t.chartengine_add_arrow_marker_down(this.__mrd_ptr,_,e,r,n,i,s,a)>>>0}add_arrow_marker_up(_,e,r,n,i,s,a){return t.chartengine_add_arrow_marker_up(this.__mrd_ptr,_,e,r,n,i,s,a)>>>0}add_brush_point(_,e){t.chartengine_add_brush_point(this.__mrd_ptr,_,e)}add_circle(_,e,r,n,i,s,a,d,h,p){return t.chartengine_add_circle(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p)>>>0}add_elliott_impulse(_,e,r,n,i,s,a){return t.chartengine_add_elliott_impulse(this.__mrd_ptr,_,e,r,n,i,s,a)>>>0}add_elliott_manual_point(_,e){return t.chartengine_add_elliott_manual_point(this.__mrd_ptr,_,e)!==0}add_fib_extension(_,e,r,n,i,s,a,d,h,p,m,u){return t.chartengine_add_fib_extension(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p,m,u)>>>0}add_fib_retracement(_,e,r,n,i,s,a,d,h,p){return t.chartengine_add_fib_retracement(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p)>>>0}add_horizontal_line(_,e,r,n,i,s,a,d){return t.chartengine_add_horizontal_line(this.__mrd_ptr,_,e,r,n,i,s,a,d)>>>0}add_long_position(_,e,r,n,i,s,a,d,h,p){return t.chartengine_add_long_position(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p)>>>0}add_marker(_,e,r){t.chartengine_add_marker(this.__mrd_ptr,_,e,r)}add_parallel_channel(_,e,r,n,i,s,a,d,h,p,m,u){return t.chartengine_add_parallel_channel(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p,m,u)>>>0}add_path_point(_,e){t.chartengine_add_path_point(this.__mrd_ptr,_,e)}add_price_label(_,e,r,n,i,s,a){return t.chartengine_add_price_label(this.__mrd_ptr,_,e,r,n,i,s,a)>>>0}add_price_range(_,e,r,n,i,s,a,d,h,p){return t.chartengine_add_price_range(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p)>>>0}add_short_position(_,e,r,n,i,s,a,d,h,p){return t.chartengine_add_short_position(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p)>>>0}add_text_note(_,e,r,n,i,s,a){return t.chartengine_add_text_note(this.__mrd_ptr,_,e,r,n,i,s,a)>>>0}add_trendline(_,e,r,n,i,s,a,d,h,p){return t.chartengine_add_trendline(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p)>>>0}append_heatmap_column(_,e,r,n){const i=g(_,t.__wbindgen_export),s=c;t.chartengine_append_heatmap_column(this.__mrd_ptr,i,s,e,r,n)}append_kline(_,e,r,n,i,s){t.chartengine_append_kline(this.__mrd_ptr,_,e,r,n,i,s)}append_real_timestamp(_){t.chartengine_append_real_timestamp(this.__mrd_ptr,_)}cancel_brush(){t.chartengine_cancel_brush(this.__mrd_ptr)}cancel_elliott_manual(){t.chartengine_cancel_elliott_manual(this.__mrd_ptr)}cancel_path(){t.chartengine_cancel_path(this.__mrd_ptr)}chart_area_h(){return t.chartengine_chart_area_h(this.__mrd_ptr)}chart_area_w(){return t.chartengine_chart_area_w(this.__mrd_ptr)}chart_area_x(){return t.chartengine_chart_area_x(this.__mrd_ptr)}chart_area_y(){return t.chartengine_chart_area_y(this.__mrd_ptr)}clear_channel_preview(){t.chartengine_clear_channel_preview(this.__mrd_ptr)}clear_drawing_preview(){t.chartengine_clear_drawing_preview(this.__mrd_ptr)}clear_drawings(){t.chartengine_clear_drawings(this.__mrd_ptr)}clear_elliott_preview(){t.chartengine_clear_elliott_preview(this.__mrd_ptr)}clear_fib_ext_preview(){t.chartengine_clear_fib_ext_preview(this.__mrd_ptr)}clear_heatmap_prefetch_range(){t.chartengine_clear_heatmap_prefetch_range(this.__mrd_ptr)}clear_hover_price(){t.chartengine_clear_hover_price(this.__mrd_ptr)}clear_large_trades(){t.chartengine_clear_large_trades(this.__mrd_ptr)}clear_live_signals(){t.chartengine_clear_live_signals(this.__mrd_ptr)}clear_markers(){t.chartengine_clear_markers(this.__mrd_ptr)}custom_band(_,e,r,n,i,s){const a=g(_,t.__wbindgen_export),d=c,h=g(e,t.__wbindgen_export),p=c;t.chartengine_custom_band(this.__mrd_ptr,a,d,h,p,r,n,i,s)}custom_begin(){t.chartengine_custom_begin(this.__mrd_ptr)}custom_circle_px(_,e,r,n,i,s,a,d,h,p,m,u){t.chartengine_custom_circle_px(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p,m,u)}custom_clip_rect(_,e,r,n){t.chartengine_custom_clip_rect(this.__mrd_ptr,_,e,r,n)}custom_command_count(){return t.chartengine_custom_command_count(this.__mrd_ptr)>>>0}custom_dashed_hline(_,e,r,n,i,s,a,d){t.chartengine_custom_dashed_hline(this.__mrd_ptr,_,e,r,n,i,s,a,d)}custom_end(){t.chartengine_custom_end(this.__mrd_ptr)}custom_fill_rect_px(_,e,r,n,i,s,a,d){t.chartengine_custom_fill_rect_px(this.__mrd_ptr,_,e,r,n,i,s,a,d)}custom_hline(_,e,r,n,i,s){t.chartengine_custom_hline(this.__mrd_ptr,_,e,r,n,i,s)}custom_line_px(_,e,r,n,i,s,a,d,h){t.chartengine_custom_line_px(this.__mrd_ptr,_,e,r,n,i,s,a,d,h)}custom_marker(_,e,r,n,i,s,a){t.chartengine_custom_marker(this.__mrd_ptr,_,e,r,n,i,s,a)}custom_marker_down(_,e,r,n,i,s,a){t.chartengine_custom_marker_down(this.__mrd_ptr,_,e,r,n,i,s,a)}custom_marker_up(_,e,r,n,i,s,a){t.chartengine_custom_marker_up(this.__mrd_ptr,_,e,r,n,i,s,a)}custom_price_label(_,e,r,n,i,s,a){const d=z(e,t.__wbindgen_export,t.__wbindgen_export2),h=c;t.chartengine_custom_price_label(this.__mrd_ptr,_,d,h,r,n,i,s,a)}custom_restore(){t.chartengine_custom_restore(this.__mrd_ptr)}custom_save(){t.chartengine_custom_save(this.__mrd_ptr)}custom_series_dashed_line(_,e,r,n,i,s,a,d){const h=g(_,t.__wbindgen_export),p=c;t.chartengine_custom_series_dashed_line(this.__mrd_ptr,h,p,e,r,n,i,s,a,d)}custom_series_line(_,e,r,n,i,s){const a=g(_,t.__wbindgen_export),d=c;t.chartengine_custom_series_line(this.__mrd_ptr,a,d,e,r,n,i,s)}custom_stroke_rect_px(_,e,r,n,i,s,a,d,h){t.chartengine_custom_stroke_rect_px(this.__mrd_ptr,_,e,r,n,i,s,a,d,h)}custom_text(_,e,r,n,i,s,a,d,h){const p=z(r,t.__wbindgen_export,t.__wbindgen_export2),m=c;t.chartengine_custom_text(this.__mrd_ptr,_,e,p,m,n,i,s,a,d,h)}custom_text_px(_,e,r,n,i,s,a,d,h){const p=z(r,t.__wbindgen_export,t.__wbindgen_export2),m=c;t.chartengine_custom_text_px(this.__mrd_ptr,_,e,p,m,n,i,s,a,d,h)}delta_histogram_enabled(){return t.chartengine_delta_histogram_enabled(this.__mrd_ptr)!==0}deselect_drawing(){t.chartengine_deselect_drawing(this.__mrd_ptr)}deselect_marker(){t.chartengine_deselect_marker(this.__mrd_ptr)}disable_cvd(){t.chartengine_disable_cvd(this.__mrd_ptr)}disable_delta_histogram(){t.chartengine_disable_delta_histogram(this.__mrd_ptr)}disable_ema_structure(){t.chartengine_disable_ema_structure(this.__mrd_ptr)}disable_forex_signals(){t.chartengine_disable_forex_signals(this.__mrd_ptr)}disable_funding_rate(){t.chartengine_disable_funding_rate(this.__mrd_ptr)}disable_large_trades(){t.chartengine_disable_large_trades(this.__mrd_ptr)}disable_liq_heatmap(){t.chartengine_disable_liq_heatmap(this.__mrd_ptr)}disable_live_signals(){t.chartengine_disable_live_signals(this.__mrd_ptr)}disable_oi(){t.chartengine_disable_oi(this.__mrd_ptr)}disable_rsi(){t.chartengine_disable_rsi(this.__mrd_ptr)}disable_smart_ranges(){t.chartengine_disable_smart_ranges(this.__mrd_ptr)}disable_tpo(){t.chartengine_disable_tpo(this.__mrd_ptr)}disable_volume(){t.chartengine_disable_volume(this.__mrd_ptr)}disable_vrvp(){t.chartengine_disable_vrvp(this.__mrd_ptr)}drawing_count(){return t.chartengine_drawing_count(this.__mrd_ptr)>>>0}enable_cvd(){t.chartengine_enable_cvd(this.__mrd_ptr)}enable_delta_histogram(){t.chartengine_enable_delta_histogram(this.__mrd_ptr)}enable_ema_structure(){t.chartengine_enable_ema_structure(this.__mrd_ptr)}enable_forex_signals(){t.chartengine_enable_forex_signals(this.__mrd_ptr)}enable_funding_rate(){t.chartengine_enable_funding_rate(this.__mrd_ptr)}enable_large_trades(){t.chartengine_enable_large_trades(this.__mrd_ptr)}enable_liq_heatmap(){t.chartengine_enable_liq_heatmap(this.__mrd_ptr)}enable_live_signals(){t.chartengine_enable_live_signals(this.__mrd_ptr)}enable_oi(){t.chartengine_enable_oi(this.__mrd_ptr)}enable_rsi(){t.chartengine_enable_rsi(this.__mrd_ptr)}enable_smart_ranges(){t.chartengine_enable_smart_ranges(this.__mrd_ptr)}enable_tpo(){t.chartengine_enable_tpo(this.__mrd_ptr)}enable_volume(){t.chartengine_enable_volume(this.__mrd_ptr)}enable_vrvp(){t.chartengine_enable_vrvp(this.__mrd_ptr)}export_drawings_json(){let _,e;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_export_drawings_json(i,this.__mrd_ptr);var r=l().getInt32(i+4*0,!0),n=l().getInt32(i+4*1,!0);return _=r,e=n,w(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}finish_brush(){return t.chartengine_finish_brush(this.__mrd_ptr)>>>0}finish_elliott_manual(){return t.chartengine_finish_elliott_manual(this.__mrd_ptr)>>>0}finish_path(){return t.chartengine_finish_path(this.__mrd_ptr)>>>0}fit_content(){t.chartengine_fit_content(this.__mrd_ptr)}footprint_add_trade(_,e,r,n){t.chartengine_footprint_add_trade(this.__mrd_ptr,_,e,r,n)}footprint_add_trade_batch(_){const e=g(_,t.__wbindgen_export),r=c;t.chartengine_footprint_add_trade_batch(this.__mrd_ptr,e,r)}footprint_clear(){t.chartengine_footprint_clear(this.__mrd_ptr)}footprint_clear_bar(_){t.chartengine_footprint_clear_bar(this.__mrd_ptr,_)}footprint_ensure_len(_){t.chartengine_footprint_ensure_len(this.__mrd_ptr,_)}footprint_get_display_mode(){return t.chartengine_footprint_get_display_mode(this.__mrd_ptr)}footprint_get_show_profile(){return t.chartengine_footprint_get_show_profile(this.__mrd_ptr)!==0}footprint_get_show_signals(){return t.chartengine_footprint_get_show_signals(this.__mrd_ptr)!==0}footprint_prepend_empty(_){t.chartengine_footprint_prepend_empty(this.__mrd_ptr,_)}footprint_profile_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_footprint_profile_hit_test(a,this.__mrd_ptr,_,e);var i=l().getInt32(a+4*0,!0),s=l().getInt32(a+4*1,!0);return r=i,n=s,w(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}footprint_set_bar(_,e,r,n,i){const s=g(r,t.__wbindgen_export),a=c,d=g(n,t.__wbindgen_export),h=c,p=g(i,t.__wbindgen_export),m=c;t.chartengine_footprint_set_bar(this.__mrd_ptr,_,e,s,a,d,h,p,m)}footprint_set_display_mode(_){t.chartengine_footprint_set_display_mode(this.__mrd_ptr,_)}footprint_set_show_profile(_){t.chartengine_footprint_set_show_profile(this.__mrd_ptr,_)}footprint_set_show_signals(_){t.chartengine_footprint_set_show_signals(this.__mrd_ptr,_)}footprint_signal_count(){return t.chartengine_footprint_signal_count(this.__mrd_ptr)>>>0}get_chart_type(){return t.chartengine_get_chart_type(this.__mrd_ptr)}get_command_buffer_len(){return t.chartengine_get_command_buffer_len(this.__mrd_ptr)>>>0}get_command_buffer_ptr(){return t.chartengine_get_command_buffer_ptr(this.__mrd_ptr)>>>0}get_custom_buffer_len(){return t.chartengine_get_custom_buffer_len(this.__mrd_ptr)>>>0}get_custom_buffer_ptr(){return t.chartengine_get_custom_buffer_ptr(this.__mrd_ptr)>>>0}get_cvd_mode(){return t.chartengine_get_cvd_mode(this.__mrd_ptr)}get_cvd_ratio(){return t.chartengine_get_cvd_ratio(this.__mrd_ptr)}get_cvd_show_delta(){return t.chartengine_get_cvd_show_delta(this.__mrd_ptr)!==0}get_drawing_color(_){return t.chartengine_get_drawing_color(this.__mrd_ptr,_)>>>0}get_drawing_dashed(_){return t.chartengine_get_drawing_dashed(this.__mrd_ptr,_)!==0}get_drawing_font_size(_){return t.chartengine_get_drawing_font_size(this.__mrd_ptr,_)}get_drawing_hide_label(_){return t.chartengine_get_drawing_hide_label(this.__mrd_ptr,_)!==0}get_drawing_kind_id(_){return t.chartengine_get_drawing_kind_id(this.__mrd_ptr,_)}get_drawing_text(_){let e,r;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_drawing_text(s,this.__mrd_ptr,_);var n=l().getInt32(s+4*0,!0),i=l().getInt32(s+4*1,!0);return e=n,r=i,w(n,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,r,1)}}get_forex_signals_count(){return t.chartengine_get_forex_signals_count(this.__mrd_ptr)>>>0}get_fr_ratio(){return t.chartengine_get_fr_ratio(this.__mrd_ptr)}get_heatmap_data_max(){return t.chartengine_get_heatmap_data_max(this.__mrd_ptr)}get_heatmap_data_min(){return t.chartengine_get_heatmap_data_min(this.__mrd_ptr)}get_heatmap_last_timestamp(){return t.chartengine_get_heatmap_last_timestamp(this.__mrd_ptr)}get_heatmap_prefetch_max(){return t.chartengine_get_heatmap_prefetch_max(this.__mrd_ptr)}get_heatmap_x_step(){return t.chartengine_get_heatmap_x_step(this.__mrd_ptr)}get_last_candle_json(){let _,e;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_last_candle_json(i,this.__mrd_ptr);var r=l().getInt32(i+4*0,!0),n=l().getInt32(i+4*1,!0);return _=r,e=n,w(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_last_close(){return t.chartengine_get_last_close(this.__mrd_ptr)}get_liq_heatmap_cell_height(){return t.chartengine_get_liq_heatmap_cell_height(this.__mrd_ptr)}get_liq_heatmap_filled_pct(){return t.chartengine_get_liq_heatmap_filled_pct(this.__mrd_ptr)}get_liq_heatmap_max(){return t.chartengine_get_liq_heatmap_max(this.__mrd_ptr)}get_liq_heatmap_min(){return t.chartengine_get_liq_heatmap_min(this.__mrd_ptr)}get_liq_heatmap_seg_max(){return t.chartengine_get_liq_heatmap_seg_max(this.__mrd_ptr)}get_live_signals_count(){return t.chartengine_get_live_signals_count(this.__mrd_ptr)>>>0}get_live_signals_leverage(){return t.chartengine_get_live_signals_leverage(this.__mrd_ptr)}get_lt_data_max_vol(){return t.chartengine_get_lt_data_max_vol(this.__mrd_ptr)}get_lt_data_min_vol(){return t.chartengine_get_lt_data_min_vol(this.__mrd_ptr)}get_oi_ratio(){return t.chartengine_get_oi_ratio(this.__mrd_ptr)}get_rsi_ratio(){return t.chartengine_get_rsi_ratio(this.__mrd_ptr)}get_selected_drawing(){return t.chartengine_get_selected_drawing(this.__mrd_ptr)>>>0}get_selected_marker(){return t.chartengine_get_selected_marker(this.__mrd_ptr)>>>0}get_sr_signals_count(){return t.chartengine_get_sr_signals_count(this.__mrd_ptr)>>>0}get_theme(){return t.chartengine_get_theme(this.__mrd_ptr)}get_tooltip_data(){let _,e;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_tooltip_data(i,this.__mrd_ptr);var r=l().getInt32(i+4*0,!0),n=l().getInt32(i+4*1,!0);return _=r,e=n,w(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_tpo_period(){return t.chartengine_get_tpo_period(this.__mrd_ptr)>>>0}get_volume_color_mode(){return t.chartengine_get_volume_color_mode(this.__mrd_ptr)}get_volume_ma_period(){return t.chartengine_get_volume_ma_period(this.__mrd_ptr)>>>0}get_volume_show_ma(){return t.chartengine_get_volume_show_ma(this.__mrd_ptr)!==0}get_volume_show_signals(){return t.chartengine_get_volume_show_signals(this.__mrd_ptr)!==0}hide_crosshair(){t.chartengine_hide_crosshair(this.__mrd_ptr)}hit_test_drawing(_,e){return t.chartengine_hit_test_drawing(this.__mrd_ptr,_,e)>>>0}hit_test_drawing_anchor(_,e){return t.chartengine_hit_test_drawing_anchor(this.__mrd_ptr,_,e)}hit_test_marker(_,e){return t.chartengine_hit_test_marker(this.__mrd_ptr,_,e)>>>0}hit_zone(_,e){return t.chartengine_hit_zone(this.__mrd_ptr,_,e)}hover_hit_test(_,e){try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_hover_hit_test(s,this.__mrd_ptr,_,e);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0),i=P(r,n).slice();return t.__wbindgen_export3(r,n*4,4),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}import_drawings_json(_){const e=z(_,t.__wbindgen_export,t.__wbindgen_export2),r=c;t.chartengine_import_drawings_json(this.__mrd_ptr,e,r)}is_cvd_enabled(){return t.chartengine_is_cvd_enabled(this.__mrd_ptr)!==0}is_dirty(){return t.chartengine_is_dirty(this.__mrd_ptr)!==0}is_ema_structure_enabled(){return t.chartengine_is_ema_structure_enabled(this.__mrd_ptr)!==0}is_forex_signals_enabled(){return t.chartengine_is_forex_signals_enabled(this.__mrd_ptr)!==0}is_funding_rate_enabled(){return t.chartengine_is_funding_rate_enabled(this.__mrd_ptr)!==0}is_large_trades_enabled(){return t.chartengine_is_large_trades_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_enabled(){return t.chartengine_is_liq_heatmap_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_filled_zones(){return t.chartengine_is_liq_heatmap_filled_zones(this.__mrd_ptr)!==0}is_liq_heatmap_predictions(){return t.chartengine_is_liq_heatmap_predictions(this.__mrd_ptr)!==0}is_liq_heatmap_profile(){return t.chartengine_is_liq_heatmap_profile(this.__mrd_ptr)!==0}is_live_signals_enabled(){return t.chartengine_is_live_signals_enabled(this.__mrd_ptr)!==0}is_oi_enabled(){return t.chartengine_is_oi_enabled(this.__mrd_ptr)!==0}is_rsi_enabled(){return t.chartengine_is_rsi_enabled(this.__mrd_ptr)!==0}is_rsi_show_traps(){return t.chartengine_is_rsi_show_traps(this.__mrd_ptr)!==0}is_smart_ranges_enabled(){return t.chartengine_is_smart_ranges_enabled(this.__mrd_ptr)!==0}is_tpo_enabled(){return t.chartengine_is_tpo_enabled(this.__mrd_ptr)!==0}is_tpo_signals(){return t.chartengine_is_tpo_signals(this.__mrd_ptr)!==0}is_volume_enabled(){return t.chartengine_is_volume_enabled(this.__mrd_ptr)!==0}is_vrvp_enabled(){return t.chartengine_is_vrvp_enabled(this.__mrd_ptr)!==0}kline_closes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_closes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=v(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_count(){return t.chartengine_kline_count(this.__mrd_ptr)>>>0}kline_highs(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_highs(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=v(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_lows(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_lows(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=v(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_opens(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_opens(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=v(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_timestamps(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_timestamps(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=v(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_volumes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_volumes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=v(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}liq_filled_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_filled_zone_hit_test(a,this.__mrd_ptr,_,e);var i=l().getInt32(a+4*0,!0),s=l().getInt32(a+4*1,!0);return r=i,n=s,w(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_heatmap_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_heatmap_hit_test(a,this.__mrd_ptr,_,e);var i=l().getInt32(a+4*0,!0),s=l().getInt32(a+4*1,!0);return r=i,n=s,w(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_predict_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_predict_hit_test(a,this.__mrd_ptr,_,e);var i=l().getInt32(a+4*0,!0),s=l().getInt32(a+4*1,!0);return r=i,n=s,w(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_zone_hit_test(a,this.__mrd_ptr,_,e);var i=l().getInt32(a+4*0,!0),s=l().getInt32(a+4*1,!0);return r=i,n=s,w(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}lt_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_lt_hit_test(a,this.__mrd_ptr,_,e);var i=l().getInt32(a+4*0,!0),s=l().getInt32(a+4*1,!0);return r=i,n=s,w(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}move_drawing(_,e){t.chartengine_move_drawing(this.__mrd_ptr,_,e)}constructor(_,e){const r=t.chartengine_new(_,e);return this.__mrd_ptr=r>>>0,L.register(this,this.__mrd_ptr,this),this}oi_to_screen_y(_){return t.chartengine_oi_to_screen_y(this.__mrd_ptr,_)}pan(_,e){t.chartengine_pan(this.__mrd_ptr,_,e)}pan_x(_){t.chartengine_pan_x(this.__mrd_ptr,_)}pan_y(_){t.chartengine_pan_y(this.__mrd_ptr,_)}pop_last_kline(){return t.chartengine_pop_last_kline(this.__mrd_ptr)!==0}prepend_klines(_,e,r,n,i,s){const a=g(_,t.__wbindgen_export),d=c,h=g(e,t.__wbindgen_export),p=c,m=g(r,t.__wbindgen_export),u=c,y=g(n,t.__wbindgen_export),W=c,O=g(i,t.__wbindgen_export),F=c,R=g(s,t.__wbindgen_export),S=c;t.chartengine_prepend_klines(this.__mrd_ptr,a,d,h,p,m,u,y,W,O,F,R,S)}push_large_trade(_,e,r,n){t.chartengine_push_large_trade(this.__mrd_ptr,_,e,r,n)}remove_drawing(_){t.chartengine_remove_drawing(this.__mrd_ptr,_)}remove_marker(_){t.chartengine_remove_marker(this.__mrd_ptr,_)}render(){return t.chartengine_render(this.__mrd_ptr)>>>0}resize(_,e){t.chartengine_resize(this.__mrd_ptr,_,e)}rsi_to_screen_y(_){return t.chartengine_rsi_to_screen_y(this.__mrd_ptr,_)}screen_to_cvd_y(_){return t.chartengine_screen_to_cvd_y(this.__mrd_ptr,_)}screen_to_fr_y(_){return t.chartengine_screen_to_fr_y(this.__mrd_ptr,_)}screen_to_oi_y(_){return t.chartengine_screen_to_oi_y(this.__mrd_ptr,_)}screen_to_rsi_y(_){return t.chartengine_screen_to_rsi_y(this.__mrd_ptr,_)}screen_to_world_x(_){return t.chartengine_screen_to_world_x(this.__mrd_ptr,_)}screen_to_world_y(_){return t.chartengine_screen_to_world_y(this.__mrd_ptr,_)}select_drawing(_){t.chartengine_select_drawing(this.__mrd_ptr,_)}select_marker(_){t.chartengine_select_marker(this.__mrd_ptr,_)}set_candle_interval(_){t.chartengine_set_candle_interval(this.__mrd_ptr,_)}set_channel_preview(_,e,r,n,i,s,a,d,h,p,m,u){t.chartengine_set_channel_preview(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p,m,u)}set_chart_type(_){t.chartengine_set_chart_type(this.__mrd_ptr,_)}set_crosshair(_,e){t.chartengine_set_crosshair(this.__mrd_ptr,_,e)}set_cvd_data(_,e){const r=g(_,t.__wbindgen_export),n=c,i=g(e,t.__wbindgen_export),s=c;t.chartengine_set_cvd_data(this.__mrd_ptr,r,n,i,s)}set_cvd_mode(_){t.chartengine_set_cvd_mode(this.__mrd_ptr,_)}set_cvd_ratio(_){t.chartengine_set_cvd_ratio(this.__mrd_ptr,_)}set_cvd_show_delta(_){t.chartengine_set_cvd_show_delta(this.__mrd_ptr,_)}set_drawing_dashed(_,e){t.chartengine_set_drawing_dashed(this.__mrd_ptr,_,e)}set_drawing_font_size(_,e){t.chartengine_set_drawing_font_size(this.__mrd_ptr,_,e)}set_drawing_hide_label(_,e){t.chartengine_set_drawing_hide_label(this.__mrd_ptr,_,e)}set_drawing_preview(_,e,r,n,i,s,a,d,h,p,m){t.chartengine_set_drawing_preview(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p,m)}set_drawing_style(_,e,r,n,i){t.chartengine_set_drawing_style(this.__mrd_ptr,_,e,r,n,i)}set_drawing_text(_,e){const r=z(e,t.__wbindgen_export,t.__wbindgen_export2),n=c;t.chartengine_set_drawing_text(this.__mrd_ptr,_,r,n)}set_elliott_manual_cursor(_,e){t.chartengine_set_elliott_manual_cursor(this.__mrd_ptr,_,e)}set_elliott_preview(_,e,r,n,i,s,a){t.chartengine_set_elliott_preview(this.__mrd_ptr,_,e,r,n,i,s,a)}set_es_ema1_len(_){t.chartengine_set_es_ema1_len(this.__mrd_ptr,_)}set_es_ema2_len(_){t.chartengine_set_es_ema2_len(this.__mrd_ptr,_)}set_es_show_bos(_){t.chartengine_set_es_show_bos(this.__mrd_ptr,_)}set_es_show_ema1(_){t.chartengine_set_es_show_ema1(this.__mrd_ptr,_)}set_es_show_ema2(_){t.chartengine_set_es_show_ema2(this.__mrd_ptr,_)}set_es_show_wma(_){t.chartengine_set_es_show_wma(this.__mrd_ptr,_)}set_es_swing_len(_){t.chartengine_set_es_swing_len(this.__mrd_ptr,_)}set_es_wma_len(_){t.chartengine_set_es_wma_len(this.__mrd_ptr,_)}set_fib_ext_preview(_,e,r,n,i,s,a,d,h,p,m,u){t.chartengine_set_fib_ext_preview(this.__mrd_ptr,_,e,r,n,i,s,a,d,h,p,m,u)}set_footprint_tick_size(_){t.chartengine_set_footprint_tick_size(this.__mrd_ptr,_)}set_forex_signals_mode(_){t.chartengine_set_forex_signals_mode(this.__mrd_ptr,_)}set_forex_signals_setup(_){t.chartengine_set_forex_signals_setup(this.__mrd_ptr,_)}set_forex_signals_show_stats(_){t.chartengine_set_forex_signals_show_stats(this.__mrd_ptr,_)}set_fr_agg_data(_,e){const r=g(_,t.__wbindgen_export),n=c,i=g(e,t.__wbindgen_export),s=c;t.chartengine_set_fr_agg_data(this.__mrd_ptr,r,n,i,s)}set_fr_binance_data(_,e){const r=g(_,t.__wbindgen_export),n=c,i=g(e,t.__wbindgen_export),s=c;t.chartengine_set_fr_binance_data(this.__mrd_ptr,r,n,i,s)}set_fr_ratio(_){t.chartengine_set_fr_ratio(this.__mrd_ptr,_)}set_fr_show_agg(_){t.chartengine_set_fr_show_agg(this.__mrd_ptr,_)}set_fr_show_sma(_){t.chartengine_set_fr_show_sma(this.__mrd_ptr,_)}set_heatmap(_,e,r,n,i,s,a){const d=g(_,t.__wbindgen_export),h=c;t.chartengine_set_heatmap(this.__mrd_ptr,d,h,e,r,n,i,s,a)}set_heatmap_prefetch_range(_){t.chartengine_set_heatmap_prefetch_range(this.__mrd_ptr,_)}set_heatmap_range(_,e){t.chartengine_set_heatmap_range(this.__mrd_ptr,_,e)}set_hover_price(_){t.chartengine_set_hover_price(this.__mrd_ptr,_)}set_klines(_,e,r,n,i,s){const a=g(_,t.__wbindgen_export),d=c,h=g(e,t.__wbindgen_export),p=c,m=g(r,t.__wbindgen_export),u=c,y=g(n,t.__wbindgen_export),W=c,O=g(i,t.__wbindgen_export),F=c,R=g(s,t.__wbindgen_export),S=c;t.chartengine_set_klines(this.__mrd_ptr,a,d,h,p,m,u,y,W,O,F,R,S)}set_large_trades_data(_){const e=g(_,t.__wbindgen_export),r=c;t.chartengine_set_large_trades_data(this.__mrd_ptr,e,r)}set_license_state(_,e,r){t.chartengine_set_license_state(this.__mrd_ptr,_,e,r)}set_liq_heatmap_cell_height(_){t.chartengine_set_liq_heatmap_cell_height(this.__mrd_ptr,_)}set_liq_heatmap_filled_pct(_){t.chartengine_set_liq_heatmap_filled_pct(this.__mrd_ptr,_)}set_liq_heatmap_filled_zones(_){t.chartengine_set_liq_heatmap_filled_zones(this.__mrd_ptr,_)}set_liq_heatmap_predictions(_){t.chartengine_set_liq_heatmap_predictions(this.__mrd_ptr,_)}set_liq_heatmap_profile(_){t.chartengine_set_liq_heatmap_profile(this.__mrd_ptr,_)}set_liq_heatmap_range(_,e){t.chartengine_set_liq_heatmap_range(this.__mrd_ptr,_,e)}set_live_signals_data(_){const e=g(_,t.__wbindgen_export),r=c;t.chartengine_set_live_signals_data(this.__mrd_ptr,e,r)}set_live_signals_leverage(_){t.chartengine_set_live_signals_leverage(this.__mrd_ptr,_)}set_live_signals_loading(_){t.chartengine_set_live_signals_loading(this.__mrd_ptr,_)}set_live_signals_pip_value(_){t.chartengine_set_live_signals_pip_value(this.__mrd_ptr,_)}set_live_signals_show_entry(_){t.chartengine_set_live_signals_show_entry(this.__mrd_ptr,_)}set_live_signals_show_labels(_){t.chartengine_set_live_signals_show_labels(this.__mrd_ptr,_)}set_live_signals_show_max_profit(_){t.chartengine_set_live_signals_show_max_profit(this.__mrd_ptr,_)}set_live_signals_show_tp_sl(_){t.chartengine_set_live_signals_show_tp_sl(this.__mrd_ptr,_)}set_live_signals_show_zones(_){t.chartengine_set_live_signals_show_zones(this.__mrd_ptr,_)}set_live_signals_text_size(_){t.chartengine_set_live_signals_text_size(this.__mrd_ptr,_)}set_live_signals_trial(_){t.chartengine_set_live_signals_trial(this.__mrd_ptr,_)}set_lt_bubble_scale(_){t.chartengine_set_lt_bubble_scale(this.__mrd_ptr,_)}set_lt_volume_filter(_,e){t.chartengine_set_lt_volume_filter(this.__mrd_ptr,_,e)}set_oi_data(_){const e=g(_,t.__wbindgen_export),r=c;t.chartengine_set_oi_data(this.__mrd_ptr,e,r)}set_oi_data_ts(_,e){const r=g(_,t.__wbindgen_export),n=c,i=g(e,t.__wbindgen_export),s=c;t.chartengine_set_oi_data_ts(this.__mrd_ptr,r,n,i,s)}set_oi_display_mode(_){t.chartengine_set_oi_display_mode(this.__mrd_ptr,_)}set_oi_ratio(_){t.chartengine_set_oi_ratio(this.__mrd_ptr,_)}set_oi_show_on_chart(_){t.chartengine_set_oi_show_on_chart(this.__mrd_ptr,_)}set_path_cursor(_,e){t.chartengine_set_path_cursor(this.__mrd_ptr,_,e)}set_price_precision(_){t.chartengine_set_price_precision(this.__mrd_ptr,_)}set_real_timestamps(_){const e=g(_,t.__wbindgen_export),r=c;t.chartengine_set_real_timestamps(this.__mrd_ptr,e,r)}set_replay_hovered(_){t.chartengine_set_replay_hovered(this.__mrd_ptr,_)}set_replay_preview(_){t.chartengine_set_replay_preview(this.__mrd_ptr,_)}set_replay_state(_,e,r){t.chartengine_set_replay_state(this.__mrd_ptr,_,e,r)}set_rsi_period(_){t.chartengine_set_rsi_period(this.__mrd_ptr,_)}set_rsi_ratio(_){t.chartengine_set_rsi_ratio(this.__mrd_ptr,_)}set_rsi_show_divergence(_){t.chartengine_set_rsi_show_divergence(this.__mrd_ptr,_)}set_rsi_show_ema(_){t.chartengine_set_rsi_show_ema(this.__mrd_ptr,_)}set_rsi_show_signals(_){t.chartengine_set_rsi_show_signals(this.__mrd_ptr,_)}set_rsi_show_traps(_){t.chartengine_set_rsi_show_traps(this.__mrd_ptr,_)}set_rsi_show_wma(_){t.chartengine_set_rsi_show_wma(this.__mrd_ptr,_)}set_rsi_smoothing(_){t.chartengine_set_rsi_smoothing(this.__mrd_ptr,_)}set_sr_fvg_extend(_){t.chartengine_set_sr_fvg_extend(this.__mrd_ptr,_)}set_sr_fvg_htf(_){t.chartengine_set_sr_fvg_htf(this.__mrd_ptr,_)}set_sr_fvg_mitigation(_){t.chartengine_set_sr_fvg_mitigation(this.__mrd_ptr,_)}set_sr_fvg_theme(_){t.chartengine_set_sr_fvg_theme(this.__mrd_ptr,_)}set_sr_htf_minutes(_){t.chartengine_set_sr_htf_minutes(this.__mrd_ptr,_)}set_sr_mitigation(_){t.chartengine_set_sr_mitigation(this.__mrd_ptr,_)}set_sr_ob_last(_){t.chartengine_set_sr_ob_last(this.__mrd_ptr,_)}set_sr_show_breakers(_){t.chartengine_set_sr_show_breakers(this.__mrd_ptr,_)}set_sr_show_fvg(_){t.chartengine_set_sr_show_fvg(this.__mrd_ptr,_)}set_sr_show_fvg_signals(_){t.chartengine_set_sr_show_fvg_signals(this.__mrd_ptr,_)}set_sr_show_htf_ob(_){t.chartengine_set_sr_show_htf_ob(this.__mrd_ptr,_)}set_sr_show_metrics(_){t.chartengine_set_sr_show_metrics(this.__mrd_ptr,_)}set_sr_show_ob(_){t.chartengine_set_sr_show_ob(this.__mrd_ptr,_)}set_sr_show_ob_activity(_){t.chartengine_set_sr_show_ob_activity(this.__mrd_ptr,_)}set_sr_show_ob_signals(_){t.chartengine_set_sr_show_ob_signals(this.__mrd_ptr,_)}set_sr_show_predict(_){t.chartengine_set_sr_show_predict(this.__mrd_ptr,_)}set_sr_show_smart_rev(_){t.chartengine_set_sr_show_smart_rev(this.__mrd_ptr,_)}set_sr_smart_rev_htf(_){t.chartengine_set_sr_smart_rev_htf(this.__mrd_ptr,_)}set_sr_stats_position(_){t.chartengine_set_sr_stats_position(this.__mrd_ptr,_)}set_sr_stats_type(_){t.chartengine_set_sr_stats_type(this.__mrd_ptr,_)}set_sr_text_size(_){t.chartengine_set_sr_text_size(this.__mrd_ptr,_)}set_theme(_){t.chartengine_set_theme(this.__mrd_ptr,_)}set_tpo_ib(_){t.chartengine_set_tpo_ib(this.__mrd_ptr,_)}set_tpo_ib_minutes(_){t.chartengine_set_tpo_ib_minutes(this.__mrd_ptr,_)}set_tpo_letter_minutes(_){t.chartengine_set_tpo_letter_minutes(this.__mrd_ptr,_)}set_tpo_naked_poc(_){t.chartengine_set_tpo_naked_poc(this.__mrd_ptr,_)}set_tpo_period(_){t.chartengine_set_tpo_period(this.__mrd_ptr,_)}set_tpo_poc_line(_){t.chartengine_set_tpo_poc_line(this.__mrd_ptr,_)}set_tpo_profile_shape(_){t.chartengine_set_tpo_profile_shape(this.__mrd_ptr,_)}set_tpo_signals(_){t.chartengine_set_tpo_signals(this.__mrd_ptr,_)}set_tpo_single_prints(_){t.chartengine_set_tpo_single_prints(this.__mrd_ptr,_)}set_tpo_va_lines(_){t.chartengine_set_tpo_va_lines(this.__mrd_ptr,_)}set_volume_color_mode(_){t.chartengine_set_volume_color_mode(this.__mrd_ptr,_)}set_volume_ma_period(_){t.chartengine_set_volume_ma_period(this.__mrd_ptr,_)}set_volume_show_ma(_){t.chartengine_set_volume_show_ma(this.__mrd_ptr,_)}set_volume_show_signals(_){t.chartengine_set_volume_show_signals(this.__mrd_ptr,_)}set_vrvp_poc_line(_){t.chartengine_set_vrvp_poc_line(this.__mrd_ptr,_)}show_latest(_){t.chartengine_show_latest(this.__mrd_ptr,_)}start_brush(_,e,r,n,i){t.chartengine_start_brush(this.__mrd_ptr,_,e,r,n,i)}start_elliott_manual(_,e,r,n,i){t.chartengine_start_elliott_manual(this.__mrd_ptr,_,e,r,n,i)}start_path(_,e,r,n,i,s){t.chartengine_start_path(this.__mrd_ptr,_,e,r,n,i,s)}update_drawing_anchor(_,e,r){t.chartengine_update_drawing_anchor(this.__mrd_ptr,_,e,r)}update_heatmap_column(_,e){const r=g(e,t.__wbindgen_export),n=c;t.chartengine_update_heatmap_column(this.__mrd_ptr,_,r,n)}update_heatmap_column_at(_,e,r,n){const i=g(_,t.__wbindgen_export),s=c;t.chartengine_update_heatmap_column_at(this.__mrd_ptr,i,s,e,r,n)}update_last_heatmap_column(_,e,r){const n=g(_,t.__wbindgen_export),i=c;t.chartengine_update_last_heatmap_column(this.__mrd_ptr,n,i,e,r)}update_last_kline(_,e,r,n,i,s){t.chartengine_update_last_kline(this.__mrd_ptr,_,e,r,n,i,s)}vrvp_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_vrvp_hit_test(a,this.__mrd_ptr,_,e);var i=l().getInt32(a+4*0,!0),s=l().getInt32(a+4*1,!0);return r=i,n=s,w(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}world_to_screen_x(_){return t.chartengine_world_to_screen_x(this.__mrd_ptr,_)}world_to_screen_y(_){return t.chartengine_world_to_screen_y(this.__mrd_ptr,_)}zoom(_,e,r){t.chartengine_zoom(this.__mrd_ptr,_,e,r)}zoom_x(_,e){t.chartengine_zoom_x(this.__mrd_ptr,_,e)}zoom_y(_,e){t.chartengine_zoom_y(this.__mrd_ptr,_,e)}}Symbol.dispose&&(E.prototype[Symbol.dispose]=E.prototype.free);function $(){const o=t.wasm_memory();return X(o)}function D(){return{__proto__:null,"./chart_engine_bg.js":{__proto__:null,__mrd___wbindgen_memory_edb3f01e3930bbf6:function(){const _=t.memory;return B(_)},__mrd___wbindgen_throw_6ddd609b62940d55:function(_,e){throw new Error(w(_,e))}}}}const L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__mrd_chartengine_free(o>>>0,1));function B(o){q===b.length&&b.push(b.length+1);const _=q;return q=b[_],b[_]=o,_}function V(o){o<1028||(b[o]=q,q=o)}function v(o,_){return o=o>>>0,C().subarray(o/8,o/8+_)}function P(o,_){return o=o>>>0,H().subarray(o/4,o/4+_)}let f=null;function l(){return(f===null||f.buffer.detached===!0||f.buffer.detached===void 0&&f.buffer!==t.memory.buffer)&&(f=new DataView(t.memory.buffer)),f}let x=null;function C(){return(x===null||x.byteLength===0)&&(x=new Float64Array(t.memory.buffer)),x}let k=null;function H(){return(k===null||k.byteLength===0)&&(k=new Int32Array(t.memory.buffer)),k}function w(o,_){return o=o>>>0,G(o,_)}let I=null;function j(){return(I===null||I.byteLength===0)&&(I=new Uint8Array(t.memory.buffer)),I}function N(o){return b[o]}let b=new Array(1024).fill(void 0);b.push(void 0,null,!0,!1);let q=b.length;function g(o,_){const e=_(o.length*8,8)>>>0;return C().set(o,e/8),c=o.length,e}function z(o,_,e){if(e===void 0){const a=A.encode(o),d=_(a.length,1)>>>0;return j().subarray(d,d+a.length).set(a),c=a.length,d}let r=o.length,n=_(r,1)>>>0;const i=j();let s=0;for(;s<r;s++){const a=o.charCodeAt(s);if(a>127)break;i[n+s]=a}if(s!==r){s!==0&&(o=o.slice(s)),n=e(n,r,r=s+o.length*3,1)>>>0;const a=j().subarray(n+s,n+r),d=A.encodeInto(o,a);s+=d.written,n=e(n,r,s,1)>>>0}return c=s,n}function X(o){const _=N(o);return V(o),_}let M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});M.decode();const Y=2146435072;let T=0;function G(o,_){return T+=_,T>=Y&&(M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),M.decode(),T=_),M.decode(j().subarray(o,o+_))}const A=new TextEncoder;"encodeInto"in A||(A.encodeInto=function(o,_){const e=A.encode(o);return _.set(e),{read:o.length,written:e.length}});let c=0,J,t;function U(o,_){return t=o.exports,J=_,f=null,x=null,k=null,I=null,t}async function K(o,_){if(typeof Response=="function"&&o instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(o,_)}catch(n){if(o.ok&&e(o.type)&&o.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const r=await o.arrayBuffer();return await WebAssembly.instantiate(r,_)}else{const r=await WebAssembly.instantiate(o,_);return r instanceof WebAssembly.Instance?{instance:r,module:o}:r}function e(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function Q(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module:o}=o:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const _=D();o instanceof WebAssembly.Module||(o=new WebAssembly.Module(o));const e=new WebAssembly.Instance(o,_);return U(e,o)}async function Z(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module_or_path:o}=o:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),o===void 0&&(o=new URL("chart_engine_bg.wasm",import.meta.url));const _=D();(typeof o=="string"||typeof Request=="function"&&o instanceof Request||typeof URL=="function"&&o instanceof URL)&&(o=fetch(o));const{instance:e,module:r}=await K(await o,_);return U(e,r)}export{E as ChartEngine,Z as default,Q as initSync,$ as wasm_memory};
|
|
1
|
+
class D{__destroy_into_raw(){const _=this.__mrd_ptr;return this.__mrd_ptr=0,L.unregister(this),_}free(){const _=this.__destroy_into_raw();t.__mrd_chartengine_free(_,0)}add_anchored_vwap(_,e,r,n,s,i,a){return t.chartengine_add_anchored_vwap(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_arrow(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_arrow(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_arrow_marker_down(_,e,r,n,s,i,a){return t.chartengine_add_arrow_marker_down(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_arrow_marker_up(_,e,r,n,s,i,a){return t.chartengine_add_arrow_marker_up(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_brush_point(_,e){t.chartengine_add_brush_point(this.__mrd_ptr,_,e)}add_circle(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_circle(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_elliott_impulse(_,e,r,n,s,i,a){return t.chartengine_add_elliott_impulse(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_elliott_manual_point(_,e){return t.chartengine_add_elliott_manual_point(this.__mrd_ptr,_,e)!==0}add_fib_extension(_,e,r,n,s,i,a,c,d,g,m,u){return t.chartengine_add_fib_extension(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)>>>0}add_fib_retracement(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_fib_retracement(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_horizontal_line(_,e,r,n,s,i,a,c){return t.chartengine_add_horizontal_line(this.__mrd_ptr,_,e,r,n,s,i,a,c)>>>0}add_long_position(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_long_position(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_marker(_,e,r){t.chartengine_add_marker(this.__mrd_ptr,_,e,r)}add_parallel_channel(_,e,r,n,s,i,a,c,d,g,m,u){return t.chartengine_add_parallel_channel(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)>>>0}add_path_point(_,e){t.chartengine_add_path_point(this.__mrd_ptr,_,e)}add_price_label(_,e,r,n,s,i,a){return t.chartengine_add_price_label(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_price_range(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_price_range(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_short_position(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_short_position(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}add_text_note(_,e,r,n,s,i,a){return t.chartengine_add_text_note(this.__mrd_ptr,_,e,r,n,s,i,a)>>>0}add_trendline(_,e,r,n,s,i,a,c,d,g){return t.chartengine_add_trendline(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g)>>>0}append_heatmap_column(_,e,r,n){const s=p(_,t.__wbindgen_export),i=h;t.chartengine_append_heatmap_column(this.__mrd_ptr,s,i,e,r,n)}append_kline(_,e,r,n,s,i){t.chartengine_append_kline(this.__mrd_ptr,_,e,r,n,s,i)}append_real_timestamp(_){t.chartengine_append_real_timestamp(this.__mrd_ptr,_)}cancel_brush(){t.chartengine_cancel_brush(this.__mrd_ptr)}cancel_elliott_manual(){t.chartengine_cancel_elliott_manual(this.__mrd_ptr)}cancel_path(){t.chartengine_cancel_path(this.__mrd_ptr)}chart_area_h(){return t.chartengine_chart_area_h(this.__mrd_ptr)}chart_area_w(){return t.chartengine_chart_area_w(this.__mrd_ptr)}chart_area_x(){return t.chartengine_chart_area_x(this.__mrd_ptr)}chart_area_y(){return t.chartengine_chart_area_y(this.__mrd_ptr)}clear_channel_preview(){t.chartengine_clear_channel_preview(this.__mrd_ptr)}clear_drawing_preview(){t.chartengine_clear_drawing_preview(this.__mrd_ptr)}clear_drawings(){t.chartengine_clear_drawings(this.__mrd_ptr)}clear_elliott_preview(){t.chartengine_clear_elliott_preview(this.__mrd_ptr)}clear_fib_ext_preview(){t.chartengine_clear_fib_ext_preview(this.__mrd_ptr)}clear_heatmap_prefetch_range(){t.chartengine_clear_heatmap_prefetch_range(this.__mrd_ptr)}clear_hover_price(){t.chartengine_clear_hover_price(this.__mrd_ptr)}clear_large_trades(){t.chartengine_clear_large_trades(this.__mrd_ptr)}clear_live_signals(){t.chartengine_clear_live_signals(this.__mrd_ptr)}clear_markers(){t.chartengine_clear_markers(this.__mrd_ptr)}custom_band(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h;t.chartengine_custom_band(this.__mrd_ptr,a,c,d,g,r,n,s,i)}custom_begin(){t.chartengine_custom_begin(this.__mrd_ptr)}custom_circle_px(_,e,r,n,s,i,a,c,d,g,m,u){t.chartengine_custom_circle_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)}custom_clip_rect(_,e,r,n){t.chartengine_custom_clip_rect(this.__mrd_ptr,_,e,r,n)}custom_command_count(){return t.chartengine_custom_command_count(this.__mrd_ptr)>>>0}custom_dashed_hline(_,e,r,n,s,i,a,c){t.chartengine_custom_dashed_hline(this.__mrd_ptr,_,e,r,n,s,i,a,c)}custom_end(){t.chartengine_custom_end(this.__mrd_ptr)}custom_fill_rect_px(_,e,r,n,s,i,a,c){t.chartengine_custom_fill_rect_px(this.__mrd_ptr,_,e,r,n,s,i,a,c)}custom_hline(_,e,r,n,s,i){t.chartengine_custom_hline(this.__mrd_ptr,_,e,r,n,s,i)}custom_line_px(_,e,r,n,s,i,a,c,d){t.chartengine_custom_line_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,d)}custom_marker(_,e,r,n,s,i,a){t.chartengine_custom_marker(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_marker_down(_,e,r,n,s,i,a){t.chartengine_custom_marker_down(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_marker_up(_,e,r,n,s,i,a){t.chartengine_custom_marker_up(this.__mrd_ptr,_,e,r,n,s,i,a)}custom_price_label(_,e,r,n,s,i,a){const c=R(e,t.__wbindgen_export,t.__wbindgen_export2),d=h;t.chartengine_custom_price_label(this.__mrd_ptr,_,c,d,r,n,s,i,a)}custom_restore(){t.chartengine_custom_restore(this.__mrd_ptr)}custom_save(){t.chartengine_custom_save(this.__mrd_ptr)}custom_series_dashed_line(_,e,r,n,s,i,a,c){const d=p(_,t.__wbindgen_export),g=h;t.chartengine_custom_series_dashed_line(this.__mrd_ptr,d,g,e,r,n,s,i,a,c)}custom_series_line(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h;t.chartengine_custom_series_line(this.__mrd_ptr,a,c,e,r,n,s,i)}custom_stroke_rect_px(_,e,r,n,s,i,a,c,d){t.chartengine_custom_stroke_rect_px(this.__mrd_ptr,_,e,r,n,s,i,a,c,d)}custom_text(_,e,r,n,s,i,a,c,d){const g=R(r,t.__wbindgen_export,t.__wbindgen_export2),m=h;t.chartengine_custom_text(this.__mrd_ptr,_,e,g,m,n,s,i,a,c,d)}custom_text_px(_,e,r,n,s,i,a,c,d){const g=R(r,t.__wbindgen_export,t.__wbindgen_export2),m=h;t.chartengine_custom_text_px(this.__mrd_ptr,_,e,g,m,n,s,i,a,c,d)}delta_histogram_enabled(){return t.chartengine_delta_histogram_enabled(this.__mrd_ptr)!==0}deselect_drawing(){t.chartengine_deselect_drawing(this.__mrd_ptr)}deselect_marker(){t.chartengine_deselect_marker(this.__mrd_ptr)}disable_cvd(){t.chartengine_disable_cvd(this.__mrd_ptr)}disable_delta_histogram(){t.chartengine_disable_delta_histogram(this.__mrd_ptr)}disable_ema_structure(){t.chartengine_disable_ema_structure(this.__mrd_ptr)}disable_forex_signals(){t.chartengine_disable_forex_signals(this.__mrd_ptr)}disable_funding_rate(){t.chartengine_disable_funding_rate(this.__mrd_ptr)}disable_large_trades(){t.chartengine_disable_large_trades(this.__mrd_ptr)}disable_liq_heatmap(){t.chartengine_disable_liq_heatmap(this.__mrd_ptr)}disable_live_signals(){t.chartengine_disable_live_signals(this.__mrd_ptr)}disable_oi(){t.chartengine_disable_oi(this.__mrd_ptr)}disable_rsi(){t.chartengine_disable_rsi(this.__mrd_ptr)}disable_smart_ranges(){t.chartengine_disable_smart_ranges(this.__mrd_ptr)}disable_stop_iceberg(){t.chartengine_disable_stop_iceberg(this.__mrd_ptr)}disable_tpo(){t.chartengine_disable_tpo(this.__mrd_ptr)}disable_volume(){t.chartengine_disable_volume(this.__mrd_ptr)}disable_vpin(){t.chartengine_disable_vpin(this.__mrd_ptr)}disable_vrvp(){t.chartengine_disable_vrvp(this.__mrd_ptr)}drawing_count(){return t.chartengine_drawing_count(this.__mrd_ptr)>>>0}enable_cvd(){t.chartengine_enable_cvd(this.__mrd_ptr)}enable_delta_histogram(){t.chartengine_enable_delta_histogram(this.__mrd_ptr)}enable_ema_structure(){t.chartengine_enable_ema_structure(this.__mrd_ptr)}enable_forex_signals(){t.chartengine_enable_forex_signals(this.__mrd_ptr)}enable_funding_rate(){t.chartengine_enable_funding_rate(this.__mrd_ptr)}enable_large_trades(){t.chartengine_enable_large_trades(this.__mrd_ptr)}enable_liq_heatmap(){t.chartengine_enable_liq_heatmap(this.__mrd_ptr)}enable_live_signals(){t.chartengine_enable_live_signals(this.__mrd_ptr)}enable_oi(){t.chartengine_enable_oi(this.__mrd_ptr)}enable_rsi(){t.chartengine_enable_rsi(this.__mrd_ptr)}enable_smart_ranges(){t.chartengine_enable_smart_ranges(this.__mrd_ptr)}enable_stop_iceberg(){t.chartengine_enable_stop_iceberg(this.__mrd_ptr)}enable_tpo(){t.chartengine_enable_tpo(this.__mrd_ptr)}enable_volume(){t.chartengine_enable_volume(this.__mrd_ptr)}enable_vpin(){t.chartengine_enable_vpin(this.__mrd_ptr)}enable_vrvp(){t.chartengine_enable_vrvp(this.__mrd_ptr)}export_drawings_json(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_export_drawings_json(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}finish_brush(){return t.chartengine_finish_brush(this.__mrd_ptr)>>>0}finish_elliott_manual(){return t.chartengine_finish_elliott_manual(this.__mrd_ptr)>>>0}finish_path(){return t.chartengine_finish_path(this.__mrd_ptr)>>>0}fit_content(){t.chartengine_fit_content(this.__mrd_ptr)}footprint_add_trade(_,e,r,n){t.chartengine_footprint_add_trade(this.__mrd_ptr,_,e,r,n)}footprint_add_trade_batch(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_footprint_add_trade_batch(this.__mrd_ptr,e,r)}footprint_clear(){t.chartengine_footprint_clear(this.__mrd_ptr)}footprint_clear_bar(_){t.chartengine_footprint_clear_bar(this.__mrd_ptr,_)}footprint_ensure_len(_){t.chartengine_footprint_ensure_len(this.__mrd_ptr,_)}footprint_get_display_mode(){return t.chartengine_footprint_get_display_mode(this.__mrd_ptr)}footprint_get_show_profile(){return t.chartengine_footprint_get_show_profile(this.__mrd_ptr)!==0}footprint_get_show_signals(){return t.chartengine_footprint_get_show_signals(this.__mrd_ptr)!==0}footprint_prepend_empty(_){t.chartengine_footprint_prepend_empty(this.__mrd_ptr,_)}footprint_profile_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_footprint_profile_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}footprint_set_bar(_,e,r,n,s){const i=p(r,t.__wbindgen_export),a=h,c=p(n,t.__wbindgen_export),d=h,g=p(s,t.__wbindgen_export),m=h;t.chartengine_footprint_set_bar(this.__mrd_ptr,_,e,i,a,c,d,g,m)}footprint_set_display_mode(_){t.chartengine_footprint_set_display_mode(this.__mrd_ptr,_)}footprint_set_show_profile(_){t.chartengine_footprint_set_show_profile(this.__mrd_ptr,_)}footprint_set_show_signals(_){t.chartengine_footprint_set_show_signals(this.__mrd_ptr,_)}footprint_signal_count(){return t.chartengine_footprint_signal_count(this.__mrd_ptr)>>>0}get_chart_type(){return t.chartengine_get_chart_type(this.__mrd_ptr)}get_command_buffer_len(){return t.chartengine_get_command_buffer_len(this.__mrd_ptr)>>>0}get_command_buffer_ptr(){return t.chartengine_get_command_buffer_ptr(this.__mrd_ptr)>>>0}get_custom_buffer_len(){return t.chartengine_get_custom_buffer_len(this.__mrd_ptr)>>>0}get_custom_buffer_ptr(){return t.chartengine_get_custom_buffer_ptr(this.__mrd_ptr)>>>0}get_cvd_mode(){return t.chartengine_get_cvd_mode(this.__mrd_ptr)}get_cvd_ratio(){return t.chartengine_get_cvd_ratio(this.__mrd_ptr)}get_cvd_show_delta(){return t.chartengine_get_cvd_show_delta(this.__mrd_ptr)!==0}get_drawing_color(_){return t.chartengine_get_drawing_color(this.__mrd_ptr,_)>>>0}get_drawing_dashed(_){return t.chartengine_get_drawing_dashed(this.__mrd_ptr,_)!==0}get_drawing_font_size(_){return t.chartengine_get_drawing_font_size(this.__mrd_ptr,_)}get_drawing_hide_label(_){return t.chartengine_get_drawing_hide_label(this.__mrd_ptr,_)!==0}get_drawing_kind_id(_){return t.chartengine_get_drawing_kind_id(this.__mrd_ptr,_)}get_drawing_text(_){let e,r;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_drawing_text(i,this.__mrd_ptr,_);var n=l().getInt32(i+4*0,!0),s=l().getInt32(i+4*1,!0);return e=n,r=s,b(n,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,r,1)}}get_forex_signals_count(){return t.chartengine_get_forex_signals_count(this.__mrd_ptr)>>>0}get_fr_ratio(){return t.chartengine_get_fr_ratio(this.__mrd_ptr)}get_heatmap_data_max(){return t.chartengine_get_heatmap_data_max(this.__mrd_ptr)}get_heatmap_data_min(){return t.chartengine_get_heatmap_data_min(this.__mrd_ptr)}get_heatmap_last_timestamp(){return t.chartengine_get_heatmap_last_timestamp(this.__mrd_ptr)}get_heatmap_prefetch_max(){return t.chartengine_get_heatmap_prefetch_max(this.__mrd_ptr)}get_heatmap_x_step(){return t.chartengine_get_heatmap_x_step(this.__mrd_ptr)}get_iceberg_count(){return t.chartengine_get_iceberg_count(this.__mrd_ptr)>>>0}get_last_candle_json(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_last_candle_json(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_last_close(){return t.chartengine_get_last_close(this.__mrd_ptr)}get_liq_heatmap_cell_height(){return t.chartengine_get_liq_heatmap_cell_height(this.__mrd_ptr)}get_liq_heatmap_filled_pct(){return t.chartengine_get_liq_heatmap_filled_pct(this.__mrd_ptr)}get_liq_heatmap_max(){return t.chartengine_get_liq_heatmap_max(this.__mrd_ptr)}get_liq_heatmap_min(){return t.chartengine_get_liq_heatmap_min(this.__mrd_ptr)}get_liq_heatmap_seg_max(){return t.chartengine_get_liq_heatmap_seg_max(this.__mrd_ptr)}get_live_signals_count(){return t.chartengine_get_live_signals_count(this.__mrd_ptr)>>>0}get_live_signals_leverage(){return t.chartengine_get_live_signals_leverage(this.__mrd_ptr)}get_lt_data_max_vol(){return t.chartengine_get_lt_data_max_vol(this.__mrd_ptr)}get_lt_data_min_vol(){return t.chartengine_get_lt_data_min_vol(this.__mrd_ptr)}get_oi_ratio(){return t.chartengine_get_oi_ratio(this.__mrd_ptr)}get_rsi_ratio(){return t.chartengine_get_rsi_ratio(this.__mrd_ptr)}get_selected_drawing(){return t.chartengine_get_selected_drawing(this.__mrd_ptr)>>>0}get_selected_marker(){return t.chartengine_get_selected_marker(this.__mrd_ptr)>>>0}get_sr_signals_count(){return t.chartengine_get_sr_signals_count(this.__mrd_ptr)>>>0}get_stop_run_count(){return t.chartengine_get_stop_run_count(this.__mrd_ptr)>>>0}get_theme(){return t.chartengine_get_theme(this.__mrd_ptr)}get_tooltip_data(){let _,e;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_tooltip_data(s,this.__mrd_ptr);var r=l().getInt32(s+4*0,!0),n=l().getInt32(s+4*1,!0);return _=r,e=n,b(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}get_tpo_period(){return t.chartengine_get_tpo_period(this.__mrd_ptr)>>>0}get_volume_color_mode(){return t.chartengine_get_volume_color_mode(this.__mrd_ptr)}get_volume_ma_period(){return t.chartengine_get_volume_ma_period(this.__mrd_ptr)>>>0}get_volume_show_ma(){return t.chartengine_get_volume_show_ma(this.__mrd_ptr)!==0}get_volume_show_signals(){return t.chartengine_get_volume_show_signals(this.__mrd_ptr)!==0}get_vpin_bucket_size(){return t.chartengine_get_vpin_bucket_size(this.__mrd_ptr)>>>0}get_vpin_num_buckets(){return t.chartengine_get_vpin_num_buckets(this.__mrd_ptr)>>>0}get_vpin_ratio(){return t.chartengine_get_vpin_ratio(this.__mrd_ptr)}get_vpin_threshold(){return t.chartengine_get_vpin_threshold(this.__mrd_ptr)}hide_crosshair(){t.chartengine_hide_crosshair(this.__mrd_ptr)}hit_test_drawing(_,e){return t.chartengine_hit_test_drawing(this.__mrd_ptr,_,e)>>>0}hit_test_drawing_anchor(_,e){return t.chartengine_hit_test_drawing_anchor(this.__mrd_ptr,_,e)}hit_test_marker(_,e){return t.chartengine_hit_test_marker(this.__mrd_ptr,_,e)>>>0}hit_zone(_,e){return t.chartengine_hit_zone(this.__mrd_ptr,_,e)}hover_hit_test(_,e){try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_hover_hit_test(i,this.__mrd_ptr,_,e);var r=l().getInt32(i+4*0,!0),n=l().getInt32(i+4*1,!0),s=H(r,n).slice();return t.__wbindgen_export3(r,n*4,4),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}import_drawings_json(_){const e=R(_,t.__wbindgen_export,t.__wbindgen_export2),r=h;t.chartengine_import_drawings_json(this.__mrd_ptr,e,r)}is_cvd_enabled(){return t.chartengine_is_cvd_enabled(this.__mrd_ptr)!==0}is_dirty(){return t.chartengine_is_dirty(this.__mrd_ptr)!==0}is_ema_structure_enabled(){return t.chartengine_is_ema_structure_enabled(this.__mrd_ptr)!==0}is_forex_signals_enabled(){return t.chartengine_is_forex_signals_enabled(this.__mrd_ptr)!==0}is_funding_rate_enabled(){return t.chartengine_is_funding_rate_enabled(this.__mrd_ptr)!==0}is_large_trades_enabled(){return t.chartengine_is_large_trades_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_enabled(){return t.chartengine_is_liq_heatmap_enabled(this.__mrd_ptr)!==0}is_liq_heatmap_filled_zones(){return t.chartengine_is_liq_heatmap_filled_zones(this.__mrd_ptr)!==0}is_liq_heatmap_predictions(){return t.chartengine_is_liq_heatmap_predictions(this.__mrd_ptr)!==0}is_liq_heatmap_profile(){return t.chartengine_is_liq_heatmap_profile(this.__mrd_ptr)!==0}is_live_signals_enabled(){return t.chartengine_is_live_signals_enabled(this.__mrd_ptr)!==0}is_oi_enabled(){return t.chartengine_is_oi_enabled(this.__mrd_ptr)!==0}is_rsi_enabled(){return t.chartengine_is_rsi_enabled(this.__mrd_ptr)!==0}is_rsi_show_traps(){return t.chartengine_is_rsi_show_traps(this.__mrd_ptr)!==0}is_smart_ranges_enabled(){return t.chartengine_is_smart_ranges_enabled(this.__mrd_ptr)!==0}is_stop_iceberg_enabled(){return t.chartengine_is_stop_iceberg_enabled(this.__mrd_ptr)!==0}is_tpo_enabled(){return t.chartengine_is_tpo_enabled(this.__mrd_ptr)!==0}is_tpo_signals(){return t.chartengine_is_tpo_signals(this.__mrd_ptr)!==0}is_volume_enabled(){return t.chartengine_is_volume_enabled(this.__mrd_ptr)!==0}is_vpin_enabled(){return t.chartengine_is_vpin_enabled(this.__mrd_ptr)!==0}is_vrvp_enabled(){return t.chartengine_is_vrvp_enabled(this.__mrd_ptr)!==0}kline_closes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_closes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_count(){return t.chartengine_kline_count(this.__mrd_ptr)>>>0}kline_highs(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_highs(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_lows(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_lows(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_opens(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_opens(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_timestamps(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_timestamps(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}kline_volumes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_volumes(n,this.__mrd_ptr);var _=l().getInt32(n+4*0,!0),e=l().getInt32(n+4*1,!0),r=y(_,e).slice();return t.__wbindgen_export3(_,e*8,8),r}finally{t.__wbindgen_add_to_stack_pointer(16)}}liq_filled_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_filled_zone_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_heatmap_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_heatmap_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_predict_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_predict_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}liq_zone_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_liq_zone_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}lt_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_lt_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}move_drawing(_,e){t.chartengine_move_drawing(this.__mrd_ptr,_,e)}constructor(_,e){const r=t.chartengine_new(_,e);return this.__mrd_ptr=r>>>0,L.register(this,this.__mrd_ptr,this),this}oi_to_screen_y(_){return t.chartengine_oi_to_screen_y(this.__mrd_ptr,_)}pan(_,e){t.chartengine_pan(this.__mrd_ptr,_,e)}pan_x(_){t.chartengine_pan_x(this.__mrd_ptr,_)}pan_y(_){t.chartengine_pan_y(this.__mrd_ptr,_)}pop_last_kline(){return t.chartengine_pop_last_kline(this.__mrd_ptr)!==0}prepend_klines(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h,m=p(r,t.__wbindgen_export),u=h,f=p(n,t.__wbindgen_export),x=h,k=p(s,t.__wbindgen_export),I=h,z=p(i,t.__wbindgen_export),q=h;t.chartengine_prepend_klines(this.__mrd_ptr,a,c,d,g,m,u,f,x,k,I,z,q)}push_large_trade(_,e,r,n){t.chartengine_push_large_trade(this.__mrd_ptr,_,e,r,n)}remove_drawing(_){t.chartengine_remove_drawing(this.__mrd_ptr,_)}remove_marker(_){t.chartengine_remove_marker(this.__mrd_ptr,_)}render(){return t.chartengine_render(this.__mrd_ptr)>>>0}resize(_,e){t.chartengine_resize(this.__mrd_ptr,_,e)}rsi_to_screen_y(_){return t.chartengine_rsi_to_screen_y(this.__mrd_ptr,_)}screen_to_cvd_y(_){return t.chartengine_screen_to_cvd_y(this.__mrd_ptr,_)}screen_to_fr_y(_){return t.chartengine_screen_to_fr_y(this.__mrd_ptr,_)}screen_to_oi_y(_){return t.chartengine_screen_to_oi_y(this.__mrd_ptr,_)}screen_to_rsi_y(_){return t.chartengine_screen_to_rsi_y(this.__mrd_ptr,_)}screen_to_vpin_y(_){return t.chartengine_screen_to_vpin_y(this.__mrd_ptr,_)}screen_to_world_x(_){return t.chartengine_screen_to_world_x(this.__mrd_ptr,_)}screen_to_world_y(_){return t.chartengine_screen_to_world_y(this.__mrd_ptr,_)}select_drawing(_){t.chartengine_select_drawing(this.__mrd_ptr,_)}select_marker(_){t.chartengine_select_marker(this.__mrd_ptr,_)}set_candle_interval(_){t.chartengine_set_candle_interval(this.__mrd_ptr,_)}set_channel_preview(_,e,r,n,s,i,a,c,d,g,m,u){t.chartengine_set_channel_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)}set_chart_type(_){t.chartengine_set_chart_type(this.__mrd_ptr,_)}set_crosshair(_,e){t.chartengine_set_crosshair(this.__mrd_ptr,_,e)}set_cvd_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_cvd_data(this.__mrd_ptr,r,n,s,i)}set_cvd_mode(_){t.chartengine_set_cvd_mode(this.__mrd_ptr,_)}set_cvd_ratio(_){t.chartengine_set_cvd_ratio(this.__mrd_ptr,_)}set_cvd_show_delta(_){t.chartengine_set_cvd_show_delta(this.__mrd_ptr,_)}set_drawing_dashed(_,e){t.chartengine_set_drawing_dashed(this.__mrd_ptr,_,e)}set_drawing_font_size(_,e){t.chartengine_set_drawing_font_size(this.__mrd_ptr,_,e)}set_drawing_hide_label(_,e){t.chartengine_set_drawing_hide_label(this.__mrd_ptr,_,e)}set_drawing_preview(_,e,r,n,s,i,a,c,d,g,m){t.chartengine_set_drawing_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m)}set_drawing_style(_,e,r,n,s){t.chartengine_set_drawing_style(this.__mrd_ptr,_,e,r,n,s)}set_drawing_text(_,e){const r=R(e,t.__wbindgen_export,t.__wbindgen_export2),n=h;t.chartengine_set_drawing_text(this.__mrd_ptr,_,r,n)}set_elliott_manual_cursor(_,e){t.chartengine_set_elliott_manual_cursor(this.__mrd_ptr,_,e)}set_elliott_preview(_,e,r,n,s,i,a){t.chartengine_set_elliott_preview(this.__mrd_ptr,_,e,r,n,s,i,a)}set_es_ema1_len(_){t.chartengine_set_es_ema1_len(this.__mrd_ptr,_)}set_es_ema2_len(_){t.chartengine_set_es_ema2_len(this.__mrd_ptr,_)}set_es_show_bos(_){t.chartengine_set_es_show_bos(this.__mrd_ptr,_)}set_es_show_ema1(_){t.chartengine_set_es_show_ema1(this.__mrd_ptr,_)}set_es_show_ema2(_){t.chartengine_set_es_show_ema2(this.__mrd_ptr,_)}set_es_show_wma(_){t.chartengine_set_es_show_wma(this.__mrd_ptr,_)}set_es_swing_len(_){t.chartengine_set_es_swing_len(this.__mrd_ptr,_)}set_es_wma_len(_){t.chartengine_set_es_wma_len(this.__mrd_ptr,_)}set_fib_ext_preview(_,e,r,n,s,i,a,c,d,g,m,u){t.chartengine_set_fib_ext_preview(this.__mrd_ptr,_,e,r,n,s,i,a,c,d,g,m,u)}set_footprint_tick_size(_){t.chartengine_set_footprint_tick_size(this.__mrd_ptr,_)}set_forex_signals_mode(_){t.chartengine_set_forex_signals_mode(this.__mrd_ptr,_)}set_forex_signals_setup(_){t.chartengine_set_forex_signals_setup(this.__mrd_ptr,_)}set_forex_signals_show_stats(_){t.chartengine_set_forex_signals_show_stats(this.__mrd_ptr,_)}set_fr_agg_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_fr_agg_data(this.__mrd_ptr,r,n,s,i)}set_fr_binance_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_fr_binance_data(this.__mrd_ptr,r,n,s,i)}set_fr_ratio(_){t.chartengine_set_fr_ratio(this.__mrd_ptr,_)}set_fr_show_agg(_){t.chartengine_set_fr_show_agg(this.__mrd_ptr,_)}set_fr_show_sma(_){t.chartengine_set_fr_show_sma(this.__mrd_ptr,_)}set_heatmap(_,e,r,n,s,i,a){const c=p(_,t.__wbindgen_export),d=h;t.chartengine_set_heatmap(this.__mrd_ptr,c,d,e,r,n,s,i,a)}set_heatmap_prefetch_range(_){t.chartengine_set_heatmap_prefetch_range(this.__mrd_ptr,_)}set_heatmap_range(_,e){t.chartengine_set_heatmap_range(this.__mrd_ptr,_,e)}set_hover_price(_){t.chartengine_set_hover_price(this.__mrd_ptr,_)}set_iceberg_events(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h,m=p(r,t.__wbindgen_export),u=h,f=p(n,t.__wbindgen_export),x=h,k=J(s,t.__wbindgen_export),I=h,z=G(i,t.__wbindgen_export),q=h;t.chartengine_set_iceberg_events(this.__mrd_ptr,a,c,d,g,m,u,f,x,k,I,z,q)}set_klines(_,e,r,n,s,i){const a=p(_,t.__wbindgen_export),c=h,d=p(e,t.__wbindgen_export),g=h,m=p(r,t.__wbindgen_export),u=h,f=p(n,t.__wbindgen_export),x=h,k=p(s,t.__wbindgen_export),I=h,z=p(i,t.__wbindgen_export),q=h;t.chartengine_set_klines(this.__mrd_ptr,a,c,d,g,m,u,f,x,k,I,z,q)}set_large_trades_data(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_large_trades_data(this.__mrd_ptr,e,r)}set_license_state(_,e,r){t.chartengine_set_license_state(this.__mrd_ptr,_,e,r)}set_liq_heatmap_cell_height(_){t.chartengine_set_liq_heatmap_cell_height(this.__mrd_ptr,_)}set_liq_heatmap_filled_pct(_){t.chartengine_set_liq_heatmap_filled_pct(this.__mrd_ptr,_)}set_liq_heatmap_filled_zones(_){t.chartengine_set_liq_heatmap_filled_zones(this.__mrd_ptr,_)}set_liq_heatmap_predictions(_){t.chartengine_set_liq_heatmap_predictions(this.__mrd_ptr,_)}set_liq_heatmap_profile(_){t.chartengine_set_liq_heatmap_profile(this.__mrd_ptr,_)}set_liq_heatmap_range(_,e){t.chartengine_set_liq_heatmap_range(this.__mrd_ptr,_,e)}set_live_signals_data(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_live_signals_data(this.__mrd_ptr,e,r)}set_live_signals_leverage(_){t.chartengine_set_live_signals_leverage(this.__mrd_ptr,_)}set_live_signals_loading(_){t.chartengine_set_live_signals_loading(this.__mrd_ptr,_)}set_live_signals_pip_value(_){t.chartengine_set_live_signals_pip_value(this.__mrd_ptr,_)}set_live_signals_show_entry(_){t.chartengine_set_live_signals_show_entry(this.__mrd_ptr,_)}set_live_signals_show_labels(_){t.chartengine_set_live_signals_show_labels(this.__mrd_ptr,_)}set_live_signals_show_max_profit(_){t.chartengine_set_live_signals_show_max_profit(this.__mrd_ptr,_)}set_live_signals_show_tp_sl(_){t.chartengine_set_live_signals_show_tp_sl(this.__mrd_ptr,_)}set_live_signals_show_zones(_){t.chartengine_set_live_signals_show_zones(this.__mrd_ptr,_)}set_live_signals_text_size(_){t.chartengine_set_live_signals_text_size(this.__mrd_ptr,_)}set_live_signals_trial(_){t.chartengine_set_live_signals_trial(this.__mrd_ptr,_)}set_lt_bubble_scale(_){t.chartengine_set_lt_bubble_scale(this.__mrd_ptr,_)}set_lt_volume_filter(_,e){t.chartengine_set_lt_volume_filter(this.__mrd_ptr,_,e)}set_oi_data(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_oi_data(this.__mrd_ptr,e,r)}set_oi_data_ts(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_oi_data_ts(this.__mrd_ptr,r,n,s,i)}set_oi_display_mode(_){t.chartengine_set_oi_display_mode(this.__mrd_ptr,_)}set_oi_ratio(_){t.chartengine_set_oi_ratio(this.__mrd_ptr,_)}set_oi_show_on_chart(_){t.chartengine_set_oi_show_on_chart(this.__mrd_ptr,_)}set_path_cursor(_,e){t.chartengine_set_path_cursor(this.__mrd_ptr,_,e)}set_price_precision(_){t.chartengine_set_price_precision(this.__mrd_ptr,_)}set_real_timestamps(_){const e=p(_,t.__wbindgen_export),r=h;t.chartengine_set_real_timestamps(this.__mrd_ptr,e,r)}set_replay_hovered(_){t.chartengine_set_replay_hovered(this.__mrd_ptr,_)}set_replay_preview(_){t.chartengine_set_replay_preview(this.__mrd_ptr,_)}set_replay_state(_,e,r){t.chartengine_set_replay_state(this.__mrd_ptr,_,e,r)}set_rsi_period(_){t.chartengine_set_rsi_period(this.__mrd_ptr,_)}set_rsi_ratio(_){t.chartengine_set_rsi_ratio(this.__mrd_ptr,_)}set_rsi_show_divergence(_){t.chartengine_set_rsi_show_divergence(this.__mrd_ptr,_)}set_rsi_show_ema(_){t.chartengine_set_rsi_show_ema(this.__mrd_ptr,_)}set_rsi_show_signals(_){t.chartengine_set_rsi_show_signals(this.__mrd_ptr,_)}set_rsi_show_traps(_){t.chartengine_set_rsi_show_traps(this.__mrd_ptr,_)}set_rsi_show_wma(_){t.chartengine_set_rsi_show_wma(this.__mrd_ptr,_)}set_rsi_smoothing(_){t.chartengine_set_rsi_smoothing(this.__mrd_ptr,_)}set_si_show_icebergs(_){t.chartengine_set_si_show_icebergs(this.__mrd_ptr,_)}set_si_show_stops(_){t.chartengine_set_si_show_stops(this.__mrd_ptr,_)}set_si_show_zones(_){t.chartengine_set_si_show_zones(this.__mrd_ptr,_)}set_sr_fvg_extend(_){t.chartengine_set_sr_fvg_extend(this.__mrd_ptr,_)}set_sr_fvg_htf(_){t.chartengine_set_sr_fvg_htf(this.__mrd_ptr,_)}set_sr_fvg_mitigation(_){t.chartengine_set_sr_fvg_mitigation(this.__mrd_ptr,_)}set_sr_fvg_theme(_){t.chartengine_set_sr_fvg_theme(this.__mrd_ptr,_)}set_sr_htf_minutes(_){t.chartengine_set_sr_htf_minutes(this.__mrd_ptr,_)}set_sr_mitigation(_){t.chartengine_set_sr_mitigation(this.__mrd_ptr,_)}set_sr_ob_last(_){t.chartengine_set_sr_ob_last(this.__mrd_ptr,_)}set_sr_show_breakers(_){t.chartengine_set_sr_show_breakers(this.__mrd_ptr,_)}set_sr_show_fvg(_){t.chartengine_set_sr_show_fvg(this.__mrd_ptr,_)}set_sr_show_fvg_signals(_){t.chartengine_set_sr_show_fvg_signals(this.__mrd_ptr,_)}set_sr_show_htf_ob(_){t.chartengine_set_sr_show_htf_ob(this.__mrd_ptr,_)}set_sr_show_metrics(_){t.chartengine_set_sr_show_metrics(this.__mrd_ptr,_)}set_sr_show_ob(_){t.chartengine_set_sr_show_ob(this.__mrd_ptr,_)}set_sr_show_ob_activity(_){t.chartengine_set_sr_show_ob_activity(this.__mrd_ptr,_)}set_sr_show_ob_signals(_){t.chartengine_set_sr_show_ob_signals(this.__mrd_ptr,_)}set_sr_show_predict(_){t.chartengine_set_sr_show_predict(this.__mrd_ptr,_)}set_sr_show_smart_rev(_){t.chartengine_set_sr_show_smart_rev(this.__mrd_ptr,_)}set_sr_smart_rev_htf(_){t.chartengine_set_sr_smart_rev_htf(this.__mrd_ptr,_)}set_sr_stats_position(_){t.chartengine_set_sr_stats_position(this.__mrd_ptr,_)}set_sr_stats_type(_){t.chartengine_set_sr_stats_type(this.__mrd_ptr,_)}set_sr_text_size(_){t.chartengine_set_sr_text_size(this.__mrd_ptr,_)}set_theme(_){t.chartengine_set_theme(this.__mrd_ptr,_)}set_tpo_ib(_){t.chartengine_set_tpo_ib(this.__mrd_ptr,_)}set_tpo_ib_minutes(_){t.chartengine_set_tpo_ib_minutes(this.__mrd_ptr,_)}set_tpo_letter_minutes(_){t.chartengine_set_tpo_letter_minutes(this.__mrd_ptr,_)}set_tpo_naked_poc(_){t.chartengine_set_tpo_naked_poc(this.__mrd_ptr,_)}set_tpo_period(_){t.chartengine_set_tpo_period(this.__mrd_ptr,_)}set_tpo_poc_line(_){t.chartengine_set_tpo_poc_line(this.__mrd_ptr,_)}set_tpo_profile_shape(_){t.chartengine_set_tpo_profile_shape(this.__mrd_ptr,_)}set_tpo_signals(_){t.chartengine_set_tpo_signals(this.__mrd_ptr,_)}set_tpo_single_prints(_){t.chartengine_set_tpo_single_prints(this.__mrd_ptr,_)}set_tpo_va_lines(_){t.chartengine_set_tpo_va_lines(this.__mrd_ptr,_)}set_volume_color_mode(_){t.chartengine_set_volume_color_mode(this.__mrd_ptr,_)}set_volume_ma_period(_){t.chartengine_set_volume_ma_period(this.__mrd_ptr,_)}set_volume_show_ma(_){t.chartengine_set_volume_show_ma(this.__mrd_ptr,_)}set_volume_show_signals(_){t.chartengine_set_volume_show_signals(this.__mrd_ptr,_)}set_vpin_bucket_size(_){t.chartengine_set_vpin_bucket_size(this.__mrd_ptr,_)}set_vpin_data(_,e){const r=p(_,t.__wbindgen_export),n=h,s=p(e,t.__wbindgen_export),i=h;t.chartengine_set_vpin_data(this.__mrd_ptr,r,n,s,i)}set_vpin_num_buckets(_){t.chartengine_set_vpin_num_buckets(this.__mrd_ptr,_)}set_vpin_ratio(_){t.chartengine_set_vpin_ratio(this.__mrd_ptr,_)}set_vpin_show_sma(_){t.chartengine_set_vpin_show_sma(this.__mrd_ptr,_)}set_vpin_show_zones(_){t.chartengine_set_vpin_show_zones(this.__mrd_ptr,_)}set_vpin_threshold(_){t.chartengine_set_vpin_threshold(this.__mrd_ptr,_)}set_vrvp_poc_line(_){t.chartengine_set_vrvp_poc_line(this.__mrd_ptr,_)}show_latest(_){t.chartengine_show_latest(this.__mrd_ptr,_)}start_brush(_,e,r,n,s){t.chartengine_start_brush(this.__mrd_ptr,_,e,r,n,s)}start_elliott_manual(_,e,r,n,s){t.chartengine_start_elliott_manual(this.__mrd_ptr,_,e,r,n,s)}start_path(_,e,r,n,s,i){t.chartengine_start_path(this.__mrd_ptr,_,e,r,n,s,i)}update_drawing_anchor(_,e,r){t.chartengine_update_drawing_anchor(this.__mrd_ptr,_,e,r)}update_heatmap_column(_,e){const r=p(e,t.__wbindgen_export),n=h;t.chartengine_update_heatmap_column(this.__mrd_ptr,_,r,n)}update_heatmap_column_at(_,e,r,n){const s=p(_,t.__wbindgen_export),i=h;t.chartengine_update_heatmap_column_at(this.__mrd_ptr,s,i,e,r,n)}update_last_heatmap_column(_,e,r){const n=p(_,t.__wbindgen_export),s=h;t.chartengine_update_last_heatmap_column(this.__mrd_ptr,n,s,e,r)}update_last_kline(_,e,r,n,s,i){t.chartengine_update_last_kline(this.__mrd_ptr,_,e,r,n,s,i)}vpin_to_screen_y(_){return t.chartengine_vpin_to_screen_y(this.__mrd_ptr,_)}vrvp_hit_test(_,e){let r,n;try{const a=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_vrvp_hit_test(a,this.__mrd_ptr,_,e);var s=l().getInt32(a+4*0,!0),i=l().getInt32(a+4*1,!0);return r=s,n=i,b(s,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}world_to_screen_x(_){return t.chartengine_world_to_screen_x(this.__mrd_ptr,_)}world_to_screen_y(_){return t.chartengine_world_to_screen_y(this.__mrd_ptr,_)}zoom(_,e,r){t.chartengine_zoom(this.__mrd_ptr,_,e,r)}zoom_x(_,e){t.chartengine_zoom_x(this.__mrd_ptr,_,e)}zoom_y(_,e){t.chartengine_zoom_y(this.__mrd_ptr,_,e)}}Symbol.dispose&&(D.prototype[Symbol.dispose]=D.prototype.free);function r_(){const o=t.wasm_memory();return K(o)}function U(){return{__proto__:null,"./chart_engine_bg.js":{__proto__:null,__mrd___wbindgen_memory_edb3f01e3930bbf6:function(){const _=t.memory;return V(_)},__mrd___wbindgen_throw_6ddd609b62940d55:function(_,e){throw new Error(b(_,e))}}}}const L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__mrd_chartengine_free(o>>>0,1));function V(o){F===w.length&&w.push(w.length+1);const _=F;return F=w[_],w[_]=o,_}function P(o){o<1028||(w[o]=F,F=o)}function y(o,_){return o=o>>>0,C().subarray(o/8,o/8+_)}function H(o,_){return o=o>>>0,N().subarray(o/4,o/4+_)}let v=null;function l(){return(v===null||v.buffer.detached===!0||v.buffer.detached===void 0&&v.buffer!==t.memory.buffer)&&(v=new DataView(t.memory.buffer)),v}let A=null;function C(){return(A===null||A.byteLength===0)&&(A=new Float64Array(t.memory.buffer)),A}let M=null;function N(){return(M===null||M.byteLength===0)&&(M=new Int32Array(t.memory.buffer)),M}function b(o,_){return o=o>>>0,Z(o,_)}let W=null;function X(){return(W===null||W.byteLength===0)&&(W=new Uint32Array(t.memory.buffer)),W}let j=null;function O(){return(j===null||j.byteLength===0)&&(j=new Uint8Array(t.memory.buffer)),j}function Y(o){return w[o]}let w=new Array(1024).fill(void 0);w.push(void 0,null,!0,!1);let F=w.length;function G(o,_){const e=_(o.length*4,4)>>>0;return X().set(o,e/4),h=o.length,e}function J(o,_){const e=_(o.length*1,1)>>>0;return O().set(o,e/1),h=o.length,e}function p(o,_){const e=_(o.length*8,8)>>>0;return C().set(o,e/8),h=o.length,e}function R(o,_,e){if(e===void 0){const a=T.encode(o),c=_(a.length,1)>>>0;return O().subarray(c,c+a.length).set(a),h=a.length,c}let r=o.length,n=_(r,1)>>>0;const s=O();let i=0;for(;i<r;i++){const a=o.charCodeAt(i);if(a>127)break;s[n+i]=a}if(i!==r){i!==0&&(o=o.slice(i)),n=e(n,r,r=i+o.length*3,1)>>>0;const a=O().subarray(n+i,n+r),c=T.encodeInto(o,a);i+=c.written,n=e(n,r,i,1)>>>0}return h=i,n}function K(o){const _=Y(o);return P(o),_}let S=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});S.decode();const Q=2146435072;let E=0;function Z(o,_){return E+=_,E>=Q&&(S=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),S.decode(),E=_),S.decode(O().subarray(o,o+_))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(o,_){const e=T.encode(o);return _.set(e),{read:o.length,written:e.length}});let h=0,$,t;function B(o,_){return t=o.exports,$=_,v=null,A=null,M=null,W=null,j=null,t}async function __(o,_){if(typeof Response=="function"&&o instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(o,_)}catch(n){if(o.ok&&e(o.type)&&o.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const r=await o.arrayBuffer();return await WebAssembly.instantiate(r,_)}else{const r=await WebAssembly.instantiate(o,_);return r instanceof WebAssembly.Instance?{instance:r,module:o}:r}function e(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function t_(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module:o}=o:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const _=U();o instanceof WebAssembly.Module||(o=new WebAssembly.Module(o));const e=new WebAssembly.Instance(o,_);return B(e,o)}async function e_(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module_or_path:o}=o:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),o===void 0&&(o=new URL("chart_engine_bg.wasm",import.meta.url));const _=U();(typeof o=="string"||typeof Request=="function"&&o instanceof Request||typeof URL=="function"&&o instanceof URL)&&(o=fetch(o));const{instance:e,module:r}=await __(await o,_);return B(e,r)}export{D as ChartEngine,e_ as default,t_ as initSync,r_ as wasm_memory};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var y={FILL_RECT:1,STROKE_RECT:2,LINE:3,DASHED_LINE:4,POLYLINE:5,TEXT:6,CIRCLE:7,TRIANGLE:8,SAVE:9,RESTORE:10,CLIP_RECT:11,ROTATED_TEXT:12,BUBBLE_3D:13,FILL_POLYGON:14,DASHED_POLYLINE:15,END_FRAME:255},ve=["left","center","right"],ht=new Map,Te=4096;function be(t,s,a,o){return t<<24|s<<16|a<<8|o}function F(t,s,a,o){let c=be(t,s,a,o),e=ht.get(c);return e||(e=`rgba(${t},${s},${a},${(o/255).toFixed(3)})`,ht.size>=Te&&ht.clear(),ht.set(c,e),e)}var Wt=new TextDecoder;function pt(t,s,a,o){let c=s.buffer;if(a+o>c.byteLength)return;let e=new DataView(c,a,o),i=new Uint8Array(c,a,o),r=0,n="",u="",l=-1,g="";for(;r<o;){let f=i[r];if(r+=1,f===y.END_FRAME)break;switch(f){case y.FILL_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4,w!==n&&(t.fillStyle=w,n=w),t.fillRect(d,_,h,p);break}case y.STROKE_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let M=e.getFloat32(r,!0);r+=4,w!==u&&(t.strokeStyle=w,u=w),M!==l&&(t.lineWidth=M,l=M),t.strokeRect(d,_,h,p);break}case y.LINE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let M=e.getFloat32(r,!0);r+=4,t.beginPath(),w!==u&&(t.strokeStyle=w,u=w),M!==l&&(t.lineWidth=M,l=M),t.setLineDash([]),t.moveTo(d,_),t.lineTo(h,p),t.stroke();break}case y.DASHED_LINE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let M=e.getFloat32(r,!0);r+=4;let S=e.getFloat32(r,!0);r+=4;let C=e.getFloat32(r,!0);r+=4,t.beginPath(),w!==u&&(t.strokeStyle=w,u=w),M!==l&&(t.lineWidth=M,l=M),t.setLineDash([S,C]),t.moveTo(d,_),t.lineTo(h,p),t.stroke(),t.setLineDash([]);break}case y.POLYLINE:{let d=e.getUint16(r,!0);r+=2;let _=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let h=e.getFloat32(r,!0);if(r+=4,d>0){let p=new Float32Array(d*2);for(let w=0;w<d;w++)p[w*2]=e.getFloat32(r,!0),r+=4,p[w*2+1]=e.getFloat32(r,!0),r+=4;if(t.beginPath(),_!==u&&(t.strokeStyle=_,u=_),h!==l&&(t.lineWidth=h,l=h),t.setLineDash([]),t.lineJoin="round",t.lineCap="round",d<=3){t.moveTo(p[0],p[1]);for(let w=1;w<d;w++)t.lineTo(p[w*2],p[w*2+1])}else{t.moveTo(p[0],p[1]),t.lineTo((p[0]+p[2])*.5,(p[1]+p[3])*.5);for(let w=1;w<d-1;w++){let M=p[w*2],S=p[w*2+1],C=p[(w+1)*2],q=p[(w+1)*2+1];t.quadraticCurveTo(M,S,(M+C)*.5,(S+q)*.5)}t.lineTo(p[(d-1)*2],p[(d-1)*2+1])}t.stroke()}break}case y.TEXT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=i[r];r+=1;let M=e.getUint16(r,!0);r+=2;let S=Wt.decode(new Uint8Array(s.buffer,a+r,M));r+=M,h!==n&&(t.fillStyle=h,n=h);let C=`${p}px "IBM Plex Mono",monospace`;C!==g&&(t.font=C,g=C),t.textAlign=ve[w]||"left",t.textBaseline="middle",t.fillText(S,d,_);break}case y.CIRCLE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let w=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let M=e.getFloat32(r,!0);r+=4,t.beginPath(),t.arc(d,_,h,0,Math.PI*2),p!==n&&(t.fillStyle=p,n=p),t.fill(),M>0&&(w!==u&&(t.strokeStyle=w,u=w),M!==l&&(t.lineWidth=M,l=M),t.stroke());break}case y.TRIANGLE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);r+=4;let M=e.getFloat32(r,!0);r+=4;let S=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4,t.beginPath(),t.moveTo(d,_),t.lineTo(h,p),t.lineTo(w,M),t.closePath(),S!==n&&(t.fillStyle=S,n=S),t.fill();break}case y.SAVE:{t.save();break}case y.RESTORE:{t.restore(),n="",u="",l=-1,g="";break}case y.CLIP_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4,t.beginPath(),t.rect(d,_,h,p),t.clip();break}case y.ROTATED_TEXT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);r+=4;let M=e.getUint16(r,!0);r+=2;let S=Wt.decode(i.subarray(r,r+M));r+=M;let C=`${p}px sans-serif`;C!==g&&(t.font=C,g=C),h!==n&&(t.fillStyle=h,n=h),t.textAlign="center",t.textBaseline="middle",t.save(),t.translate(d,_),t.rotate(w),t.fillText(S,0,0),t.restore();break}case y.BUBBLE_3D:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=i[r],w=i[r+1],M=i[r+2],S=i[r+3];r+=4;let C=i[r],q=i[r+1],Q=i[r+2],G=i[r+3];r+=4;let T=i[r],U=i[r+1],$=i[r+2],dt=i[r+3];r+=4;let Lt=e.getFloat32(r,!0);r+=4;let b=h;if(b<10){let D=`rgba(${p},${w},${M},${(S/255).toFixed(3)})`;t.beginPath(),t.arc(d,_,b,0,Math.PI*2),t.fillStyle=D,t.fill(),n=""}else if(b<18){let D=d-b*.25,X=_-b*.25,z=t.createRadialGradient(D,X,b*.08,d,_,b);z.addColorStop(0,`rgba(${C},${q},${Q},${(G/255).toFixed(3)})`),z.addColorStop(1,`rgba(${p},${w},${M},${(S/255).toFixed(3)})`),t.beginPath(),t.arc(d,_,b,0,Math.PI*2),t.fillStyle=z,t.fill(),n=""}else{let D=d-b*.25,X=_-b*.25,z=t.createRadialGradient(d,_,b*.85,d,_,b*1.2);z.addColorStop(0,`rgba(${T},${U},${$},${(dt/255*.5).toFixed(3)})`),z.addColorStop(1,`rgba(${T},${U},${$},0)`),t.beginPath(),t.arc(d,_,b*1.2,0,Math.PI*2),t.fillStyle=z,t.fill();let Z=t.createRadialGradient(D,X,b*.08,d,_,b);Z.addColorStop(0,`rgba(${C},${q},${Q},${(G/255).toFixed(3)})`),Z.addColorStop(1,`rgba(${p},${w},${M},${(S/255).toFixed(3)})`),t.beginPath(),t.arc(d,_,b,0,Math.PI*2),t.fillStyle=Z,t.fill();let ot=b*.2,J=t.createRadialGradient(D,X,0,D,X,ot);J.addColorStop(0,"rgba(255,255,255,0.22)"),J.addColorStop(1,"rgba(255,255,255,0)"),t.beginPath(),t.arc(D,X,ot,0,Math.PI*2),t.fillStyle=J,t.fill(),n=""}break}case y.FILL_POLYGON:{let d=e.getUint16(r,!0);r+=2;let _=F(i[r],i[r+1],i[r+2],i[r+3]);if(r+=4,d>2){t.beginPath();let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4,t.moveTo(h,p);for(let w=1;w<d;w++)t.lineTo(e.getFloat32(r,!0),e.getFloat32(r+4,!0)),r+=8;t.closePath(),_!==n&&(t.fillStyle=_,n=_),t.fill()}else r+=d*8;break}case y.DASHED_POLYLINE:{let d=e.getUint16(r,!0);r+=2;let _=F(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let h=e.getFloat32(r,!0);r+=4;let p=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);if(r+=4,d>1){t.beginPath(),_!==u&&(t.strokeStyle=_,u=_),h!==l&&(t.lineWidth=h,l=h),t.setLineDash([p,w]),t.lineJoin="round";let M=e.getFloat32(r,!0);r+=4;let S=e.getFloat32(r,!0);r+=4,t.moveTo(M,S);for(let C=1;C<d;C++)t.lineTo(e.getFloat32(r,!0),e.getFloat32(r+4,!0)),r+=8;t.stroke(),t.setLineDash([])}else r+=d*8;break}default:return}}}var j={trendline:{type:"2point",previewKind:0,addFn:"add_trendline"},arrow:{type:"2point",previewKind:4,addFn:"add_arrow"},measure:{type:"2point",previewKind:2,addFn:"add_price_range"},fib:{type:"2point",previewKind:3,addFn:"add_fib_retracement"},long:{type:"2point",previewKind:5,addFn:"add_long_position"},short:{type:"2point",previewKind:5,addFn:"add_short_position"},hline:{type:"1point_xp",previewKind:1,addFn:"add_horizontal_line"},vwap:{type:"1point_x",previewKind:6,addFn:"add_anchored_vwap"},pricelabel:{type:"1point_xy",previewKind:7,addFn:"add_price_label"},circle:{type:"2point",previewKind:8,addFn:"add_circle"},arrowup:{type:"1point_xy",previewKind:9,addFn:"add_arrow_marker_up"},arrowdown:{type:"1point_xy",previewKind:10,addFn:"add_arrow_marker_down"},textnote:{type:"1point_xy",previewKind:11,addFn:"add_text_note"},channel:{type:"3point",previewKind:0,addFn:"add_parallel_channel"},fibext:{type:"3point",previewKind:0,addFn:"add_fib_extension",previewFn:"fib_ext"},brush:{type:"freehand"},path:{type:"npoint"},elliott:{type:"elliott_manual"},elliottauto:{type:"1point_xy",previewKind:12,addFn:"add_elliott_impulse",previewFn:"elliott"}};function at(t){return j[t]?.type==="2point"}function it(t){return j[t]?.type==="3point"}function k(t){let s=j[t]?.type;return s==="1point"||s==="1point_x"||s==="1point_xy"||s==="1point_xp"}function wt(t){return j[t]?.type==="freehand"}function H(t){return j[t]?.type==="npoint"}function O(t){return j[t]?.type==="elliott_manual"}var Bt={r:.04,g:.49,b:1,lineWidth:2,dashed:!1,fontSize:12};function W(t,s,a,o,c,e){e=e||Bt;let i=j[s];if(!i)return 0;let r=0;return i.type==="3point"?r=t[i.addFn](a.x1,a.y1,a.x2,a.y2,o,c,e.r,e.g,e.b,e.lineWidth,e.dashed,a.pane):i.type==="2point"?r=t[i.addFn](a.x1,a.y1,o,c,e.r,e.g,e.b,e.lineWidth,e.dashed,a.pane):i.type==="1point_x"?r=t[i.addFn](o,e.r,e.g,e.b,e.lineWidth,e.dashed,a.pane):i.type==="1point_xp"?r=t[i.addFn](o,c,e.r,e.g,e.b,e.lineWidth,e.dashed,a.pane):i.type==="1point_xy"?r=t[i.addFn](o,c,e.r,e.g,e.b,e.fontSize||12,a.pane):r=t[i.addFn](c,e.r,e.g,e.b,e.lineWidth,e.dashed,a.pane),r||0}function R(t,s,a,o,c,e,i){e=e||Bt;let r=j[s];if(r){if(r.previewFn==="elliott"){t.set_elliott_preview(o,c,e.r,e.g,e.b,e.lineWidth,i);return}r.type==="3point"?a.step===1?t.set_drawing_preview(r.previewKind,a.x1,a.y1,o,c,e.r,e.g,e.b,e.lineWidth,e.dashed,i):a.step===2&&(r.previewFn==="fib_ext"?t.set_fib_ext_preview(a.x1,a.y1,a.x2,a.y2,o,c,e.r,e.g,e.b,e.lineWidth,e.dashed,i):t.set_channel_preview(a.x1,a.y1,a.x2,a.y2,o,c,e.r,e.g,e.b,e.lineWidth,e.dashed,i)):r.type==="2point"?t.set_drawing_preview(r.previewKind,a.x1,a.y1,o,c,e.r,e.g,e.b,e.lineWidth,e.dashed,i):r.type==="1point_x"?t.set_drawing_preview(r.previewKind,o,0,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,i):r.type==="1point_xp"||r.type==="1point_xy"?t.set_drawing_preview(r.previewKind,o,c,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,i):t.set_drawing_preview(r.previewKind,0,c,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,i)}}function A(t,s,a,o){let c=t.screen_to_world_x(s),e;switch(o){case 1:e=t.screen_to_rsi_y(a);break;case 2:e=t.screen_to_oi_y(a);break;case 3:e=t.screen_to_fr_y(a);break;case 4:e=t.screen_to_cvd_y(a);break;default:e=t.screen_to_world_y(a);break}return{wx:c,wy:e}}function Y(t){return t===4?1:t===6?2:t===8?3:t===10?4:0}function P(t){return t===0||t===4||t===6||t===8||t===10}function Ut(t,s,a,o){t.addEventListener("wheel",r=>{if(o.disposed)return;r.preventDefault(),o.cancelMomentum();let n=r.deltaY>0?1.1:.9,u=s.hit_zone(r.offsetX,r.offsetY);r.ctrlKey?s.zoom_y(r.offsetY,n):r.shiftKey||u===2?s.zoom_x(r.offsetX,n):u===3?s.zoom_y(r.offsetY,n):s.zoom(r.offsetX,r.offsetY,n),a.onDirty()},{passive:!1}),t.addEventListener("mousedown",r=>{if(o.disposed||r.button!==0)return;o.cancelMomentum(),e();let n=performance.now();if(n-o.lastClickTime<300){o.lastClickTime=n;return}o.lastClickTime=n;let u=o.drawingMode;if(u){let g=s.hit_zone(r.offsetX,r.offsetY);if(!P(g))return;let f=Y(g),{wx:d,wy:_}=A(s,r.offsetX,r.offsetY,f),h=u.style,p=u.tool;if(O(p)){if(!u.pathStarted)u.pane=f,s.start_elliott_manual(h.r,h.g,h.b,h.lineWidth,f),s.add_elliott_manual_point(d,_),u.pathStarted=!0,u.step=1;else if(s.add_elliott_manual_point(d,_)){o.finishDrawing(),a.onDirty();return}}else if(H(p))u.pathStarted?s.add_path_point(d,_):(u.pane=f,s.start_path(h.r,h.g,h.b,h.lineWidth,h.dashed,f),s.add_path_point(d,_),u.pathStarted=!0,u.step=1);else if(wt(p))u.pane=f,s.start_brush(h.r,h.g,h.b,h.lineWidth,f),s.add_brush_point(d,_),o.isBrushing=!0;else if(it(p))if(u.step===0)u.x1=d,u.y1=_,u.pane=f,u.step=1;else if(u.step===1)u.x2=d,u.y2=_,u.step=2,s.clear_drawing_preview();else{let w=j[p];w&&w.previewFn==="fib_ext"?s.clear_fib_ext_preview():s.clear_channel_preview(),W(s,p,u,d,_,h),o.finishDrawing()}else if(at(p))u.step===0?(u.x1=d,u.y1=_,u.pane=f,u.step=1):(W(s,p,u,d,_,h),o.finishDrawing());else{u.pane=f;let w=W(s,p,u,d,_,h);o.finishDrawing(),p==="textnote"&&w>0&&(s.select_drawing(w),a.onDrawingSelected?.(w),a.onDrawingDblClick?.(w,r.offsetX,r.offsetY,r.clientX,r.clientY))}a.onDirty();return}let l=s.hit_zone(r.offsetX,r.offsetY);if(l===5){o.isResizingRsi=!0,o.resizeStartY=r.offsetY,o.resizeStartRatio=s.get_rsi_ratio(),t.style.cursor="ns-resize";return}if(l===7){o.isResizingOi=!0,o.resizeStartY=r.offsetY,o.resizeStartRatio=s.get_oi_ratio(),t.style.cursor="ns-resize";return}if(l===9){o.isResizingFr=!0,o.resizeStartY=r.offsetY,o.resizeStartRatio=s.get_fr_ratio(),t.style.cursor="ns-resize";return}if(l===11){o.isResizingCvd=!0,o.resizeStartY=r.offsetY,o.resizeStartRatio=s.get_cvd_ratio(),t.style.cursor="ns-resize";return}if(P(l)){let g=s.get_selected_drawing();if(g>0){let p=s.hit_test_drawing_anchor(r.offsetX,r.offsetY);if(p>=0){o.isDraggingAnchor=!0,o.dragAnchorIdx=p,o.dragAnchorPane=Y(l),t.style.cursor="grabbing";return}if(s.hit_test_drawing(r.offsetX,r.offsetY)===g){o.isDraggingDrawing=!0,o.dragDrawingPane=Y(l);let{wx:M,wy:S}=A(s,r.offsetX,r.offsetY,o.dragDrawingPane);o.dragDrawingLastWx=M,o.dragDrawingLastWy=S,t.style.cursor="move";return}}let f=s.hit_test_drawing(r.offsetX,r.offsetY);if(f>0){s.deselect_marker(),a.onMarkerSelected?.(0),s.select_drawing(f),a.onDrawingSelected?.(f),a.onDirty();return}let d=s.hit_test_marker(r.offsetX,r.offsetY);if(d>0){s.deselect_drawing(),a.onDrawingSelected?.(0),s.select_marker(d),a.onMarkerSelected?.(d),a.onDirty();return}let _=s.get_selected_drawing(),h=s.get_selected_marker();_>0&&(s.deselect_drawing(),a.onDrawingSelected?.(0),a.onDirty()),h>0&&(s.deselect_marker(),a.onMarkerSelected?.(0),a.onDirty())}P(l)&&(o.liqPinSx=r.offsetX,o.liqPinSy=r.offsetY,o.liqPinTimer&&clearTimeout(o.liqPinTimer),o.liqPinTimer=setTimeout(()=>{o.liqPinTimer=null,a.onLiqAnnotationPin?.(o.liqPinSx,o.liqPinSy)},700)),o.isDragging=!0,o.dragZone=l,o.lastX=r.offsetX,o.lastY=r.offsetY,l===2?t.style.cursor="ew-resize":l===3?t.style.cursor="ns-resize":t.style.cursor="grabbing"});let c=null;function e(){c&&(cancelAnimationFrame(c),c=null)}function i(r,n){let u=s.hover_hit_test(r,n),l=u[0],g=u[1],f=u[2],d=u[3],_=u[4],h=o.drawingMode;l===2?(t.style.cursor="ew-resize",s.hide_crosshair()):l===3?(t.style.cursor="ns-resize",s.hide_crosshair()):(s.set_crosshair(r,n),l===5||l===7||l===9||l===11?t.style.cursor="ns-resize":!h&&P(l)&&g>0&&f>=0?t.style.cursor="grab":!h&&P(l)&&g>0&&d===g?t.style.cursor="move":!h&&P(l)&&(d>0||_>0)?t.style.cursor="pointer":t.style.cursor="crosshair"),a.onDirty(),a.onCrosshairMove?.(r,n,l),a.onVrvpHover?.(r,n)}t.addEventListener("mousemove",r=>{if(o.disposed)return;if(o.liqPinTimer){let u=Math.abs(r.offsetX-o.liqPinSx),l=Math.abs(r.offsetY-o.liqPinSy);(u>6||l>6)&&(clearTimeout(o.liqPinTimer),o.liqPinTimer=null)}if(o.isResizingRsi){let l=t.getBoundingClientRect().height-28,f=(o.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,o.resizeStartRatio+f));s.set_rsi_ratio(d),a.onDirty();return}if(o.isResizingOi){let l=t.getBoundingClientRect().height-28,f=(o.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,o.resizeStartRatio+f));s.set_oi_ratio(d),a.onDirty();return}if(o.isResizingFr){let l=t.getBoundingClientRect().height-28,f=(o.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,o.resizeStartRatio+f));s.set_fr_ratio(d),a.onDirty();return}if(o.isResizingCvd){let l=t.getBoundingClientRect().height-28,f=(o.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,o.resizeStartRatio+f));s.set_cvd_ratio(d),a.onDirty();return}if(o.isDraggingAnchor){let{wx:u,wy:l}=A(s,r.offsetX,r.offsetY,o.dragAnchorPane);s.update_drawing_anchor(o.dragAnchorIdx,u,l),s.set_crosshair(r.offsetX,r.offsetY),a.onDirty(),a.onCrosshairMove?.(r.offsetX,r.offsetY,s.hit_zone(r.offsetX,r.offsetY));return}if(o.isDraggingDrawing){let{wx:u,wy:l}=A(s,r.offsetX,r.offsetY,o.dragDrawingPane),g=u-o.dragDrawingLastWx,f=l-o.dragDrawingLastWy;s.move_drawing(g,f),o.dragDrawingLastWx=u,o.dragDrawingLastWy=l,s.set_crosshair(r.offsetX,r.offsetY),a.onDirty(),a.onCrosshairMove?.(r.offsetX,r.offsetY,s.hit_zone(r.offsetX,r.offsetY));return}let n=o.drawingMode;if(o.isBrushing&&n){let u=n.pane||0,{wx:l,wy:g}=A(s,r.offsetX,r.offsetY,u);s.add_brush_point(l,g),s.set_crosshair(r.offsetX,r.offsetY),a.onDirty();return}if(n&&O(n.tool)&&n.pathStarted){let u=n.pane||0,{wx:l,wy:g}=A(s,r.offsetX,r.offsetY,u);s.set_elliott_manual_cursor(l,g),s.set_crosshair(r.offsetX,r.offsetY);let f=s.hit_zone(r.offsetX,r.offsetY);a.onDirty(),a.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(n&&H(n.tool)&&n.pathStarted){let u=n.pane||0,{wx:l,wy:g}=A(s,r.offsetX,r.offsetY,u);s.set_path_cursor(l,g),s.set_crosshair(r.offsetX,r.offsetY);let f=s.hit_zone(r.offsetX,r.offsetY);a.onDirty(),a.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(n&&n.step>0){let u=n.pane||0,{wx:l,wy:g}=A(s,r.offsetX,r.offsetY,u);R(s,n.tool,n,l,g,n.style,u),s.set_crosshair(r.offsetX,r.offsetY);let f=s.hit_zone(r.offsetX,r.offsetY);a.onDirty(),a.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(n&&k(n.tool)){let u=s.hit_zone(r.offsetX,r.offsetY),l=Y(u),{wx:g,wy:f}=A(s,r.offsetX,r.offsetY,l);R(s,n.tool,n,g,f,n.style,l),s.set_crosshair(r.offsetX,r.offsetY),a.onDirty(),a.onCrosshairMove?.(r.offsetX,r.offsetY,u);return}if(o.isDragging){let u=r.offsetX-o.lastX,l=r.offsetY-o.lastY;o.lastX=r.offsetX,o.lastY=r.offsetY,o.dragZone===2?s.pan_x(u):o.dragZone===3?s.pan_y(l):s.pan(u,l),a.onDirty(),a.onCrosshairMove?.(r.offsetX,r.offsetY,o.dragZone),a.onVrvpHover?.(r.offsetX,r.offsetY);return}o._pendingHoverX=r.offsetX,o._pendingHoverY=r.offsetY,c||(c=requestAnimationFrame(()=>{c=null,o.disposed||i(o._pendingHoverX,o._pendingHoverY)}))}),t.addEventListener("mouseup",()=>{o.disposed||(o.liqPinTimer&&(clearTimeout(o.liqPinTimer),o.liqPinTimer=null),o.isBrushing&&(o.isBrushing=!1,s.finish_brush(),o.finishDrawing(),a.onDirty()),o.isDragging=!1,o.isResizingRsi=!1,o.isResizingOi=!1,o.isResizingFr=!1,o.isResizingCvd=!1,o.isDraggingAnchor=!1,o.isDraggingDrawing=!1,o.dragAnchorIdx=-1,t.style.cursor="crosshair")}),t.addEventListener("mouseleave",()=>{o.disposed||(e(),o.liqPinTimer&&(clearTimeout(o.liqPinTimer),o.liqPinTimer=null),o.isBrushing&&(o.isBrushing=!1,s.finish_brush(),o.finishDrawing()),o.isDragging=!1,o.isResizingRsi=!1,o.isResizingOi=!1,o.isResizingFr=!1,o.isResizingCvd=!1,o.isDraggingAnchor=!1,o.isDraggingDrawing=!1,o.dragAnchorIdx=-1,s.hide_crosshair(),t.style.cursor="crosshair",a.onDirty(),a.onCrosshairHide?.(),a.onVrvpHover?.(null,null))}),t.addEventListener("dblclick",r=>{if(o.disposed)return;r.preventDefault(),r.stopPropagation();let n=o.drawingMode;if(n&&O(n.tool)&&n.pathStarted){s.finish_elliott_manual(),o.finishDrawing(),a.onDirty();return}if(n&&H(n.tool)&&n.pathStarted){s.finish_path(),o.finishDrawing(),a.onDirty();return}if(n)return;let u=s.hit_test_drawing(r.offsetX,r.offsetY);u>0&&(s.select_drawing(u),a.onDirty(),a.onDrawingDblClick?.(u,r.offsetX,r.offsetY,r.clientX,r.clientY))}),t.addEventListener("contextmenu",r=>{if(o.disposed)return;let n=o.drawingMode;if(n&&O(n.tool)&&n.pathStarted){r.preventDefault(),r.stopPropagation(),s.finish_elliott_manual(),o.finishDrawing(),a.onDirty();return}if(n&&H(n.tool)&&n.pathStarted){r.preventDefault(),r.stopPropagation(),s.finish_path(),o.finishDrawing(),a.onDirty();return}})}function $t(t,s,a,o){t.addEventListener("touchstart",c=>{if(!o.disposed){if(c.preventDefault(),o.cancelMomentum(),c.touches.length===2){clearTimeout(o.longPressTimer),o.isCrosshairMode=!1;let e=t.getBoundingClientRect(),i=c.touches[1].clientX-c.touches[0].clientX,r=c.touches[1].clientY-c.touches[0].clientY;o.lastTouchDist=Math.sqrt(i*i+r*r),o.lastX=(c.touches[0].clientX+c.touches[1].clientX)/2-e.left,o.lastY=(c.touches[0].clientY+c.touches[1].clientY)/2-e.top,o.dragZone=s.hit_zone(o.lastX,o.lastY)}else if(c.touches.length===1){let e=t.getBoundingClientRect(),i=c.touches[0].clientX-e.left,r=c.touches[0].clientY-e.top;o.touchStartX=i,o.touchStartY=r,o.touchMoved=!1;let n=o.drawingMode;if(n){let d=s.hit_zone(i,r);if(P(d)){let _=Y(d),{wx:h,wy:p}=A(s,i,r,_),w=n.tool;if(O(w)){if(!n.pathStarted)n.pane=_,s.start_elliott_manual(n.style.r,n.style.g,n.style.b,n.style.lineWidth,_),s.add_elliott_manual_point(h,p),n.pathStarted=!0,n.step=1;else if(s.add_elliott_manual_point(h,p)){o.finishDrawing(),a.onDirty();return}}else H(w)?n.pathStarted?s.add_path_point(h,p):(n.pane=_,s.start_path(n.style.r,n.style.g,n.style.b,n.style.lineWidth,n.style.dashed,_),s.add_path_point(h,p),n.pathStarted=!0,n.step=1):wt(w)?(n.pane=_,s.start_brush(n.style.r,n.style.g,n.style.b,n.style.lineWidth,_),s.add_brush_point(h,p),o.isBrushing=!0):it(w)?n.step===0?(n.x1=h,n.y1=p,n.pane=_,n.step=1,n._stepAtTouchStart=0,R(s,w,n,h,p,n.style,_)):n.step===1?(n._stepAtTouchStart=1,R(s,w,n,h,p,n.style,n.pane)):(n._stepAtTouchStart=2,R(s,w,n,h,p,n.style,n.pane)):at(w)?n.step===0?(n.x1=h,n.y1=p,n.pane=_,n.step=1,n._stepAtTouchStart=0,R(s,w,n,h,p,n.style,_)):(n._stepAtTouchStart=1,R(s,w,n,h,p,n.style,n.pane)):k(w)?(n.pane=_,R(s,w,n,h,p,n.style,_)):(n.pane=_,W(s,w,n,h,p,n.style),o.finishDrawing());s.set_crosshair(i,r),a.onDirty(),a.onCrosshairMove?.(i,r,d)}return}let u=s.hover_hit_test(i,r),l=u[0],g=u[1],f=u[2];if(P(l)&&!o.drawingMode&&g>0){if(f>=0){o.isDraggingAnchor=!0,o.dragAnchorIdx=f,o.dragAnchorPane=Y(l);return}if(u[3]===g){o.isDraggingDrawing=!0,o.dragDrawingPane=Y(l);let{wx:_,wy:h}=A(s,i,r,o.dragDrawingPane);o.dragDrawingLastWx=_,o.dragDrawingLastWy=h;return}}o.isDragging=!0,o.isCrosshairMode=!1,o.lastX=i,o.lastY=r,o.dragZone=l,clearTimeout(o.longPressTimer),o.longPressTimer=setTimeout(()=>{o.isDragging&&!o.touchMoved&&(o.isCrosshairMode=!0,s.set_crosshair(i,r),a.onDirty(),a.onCrosshairMove?.(i,r,o.dragZone),a.onVrvpHover?.(i,r))},300),P(o.dragZone)&&(o.liqPinSx=i,o.liqPinSy=r,o.liqPinTimer&&clearTimeout(o.liqPinTimer),o.liqPinTimer=setTimeout(()=>{o.liqPinTimer=null,o.touchMoved||a.onLiqAnnotationPin?.(o.liqPinSx,o.liqPinSy)},700))}}},{passive:!1}),t.addEventListener("touchmove",c=>{if(o.disposed)return;c.preventDefault();let e=t.getBoundingClientRect();if(o.isDraggingAnchor&&c.touches.length===1){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top,{wx:u,wy:l}=A(s,r,n,o.dragAnchorPane);s.update_drawing_anchor(o.dragAnchorIdx,u,l),s.set_crosshair(r,n),a.onDirty();return}if(o.isDraggingDrawing&&c.touches.length===1){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top;o.touchMoved=!0;let{wx:u,wy:l}=A(s,r,n,o.dragDrawingPane),g=u-o.dragDrawingLastWx,f=l-o.dragDrawingLastWy;s.move_drawing(g,f),o.dragDrawingLastWx=u,o.dragDrawingLastWy=l,s.set_crosshair(r,n),a.onDirty();return}let i=o.drawingMode;if(o.isBrushing&&i&&c.touches.length===1){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top,u=i.pane||0,{wx:l,wy:g}=A(s,r,n,u);s.add_brush_point(l,g),s.set_crosshair(r,n),a.onDirty(),o.touchMoved=!0;return}if(i&&O(i.tool)&&i.pathStarted&&c.touches.length===1){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top,u=i.pane||0,{wx:l,wy:g}=A(s,r,n,u);s.set_elliott_manual_cursor(l,g),s.set_crosshair(r,n),a.onDirty(),o.touchMoved=!0;return}if(i&&H(i.tool)&&i.pathStarted&&c.touches.length===1){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top,u=i.pane||0,{wx:l,wy:g}=A(s,r,n,u);s.set_path_cursor(l,g),s.set_crosshair(r,n),a.onDirty(),o.touchMoved=!0;return}if(i&&i.step>0&&c.touches.length===1){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top;!o.touchMoved&&(Math.abs(r-o.touchStartX)>10||Math.abs(n-o.touchStartY)>10)&&(o.touchMoved=!0);let u=i.pane||0,{wx:l,wy:g}=A(s,r,n,u);R(s,i.tool,i,l,g,i.style,u),s.set_crosshair(r,n);let f=s.hit_zone(r,n);a.onDirty(),a.onCrosshairMove?.(r,n,f);return}if(i&&k(i.tool)&&c.touches.length===1){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top,u=s.hit_zone(r,n),l=Y(u),{wx:g,wy:f}=A(s,r,n,l);R(s,i.tool,i,g,f,i.style,l),s.set_crosshair(r,n),a.onDirty(),a.onCrosshairMove?.(r,n,u);return}if(c.touches.length===2){o.velSamples=[];let r=c.touches[1].clientX-c.touches[0].clientX,n=c.touches[1].clientY-c.touches[0].clientY,u=Math.sqrt(r*r+n*n),l=o.lastTouchDist/u,g=(c.touches[0].clientX+c.touches[1].clientX)/2-e.left,f=(c.touches[0].clientY+c.touches[1].clientY)/2-e.top;o.dragZone===3?s.zoom_y(f,l):o.dragZone===2?s.zoom_x(g,l):(s.zoom(g,f,l),s.pan(g-o.lastX,f-o.lastY)),o.lastTouchDist=u,o.lastX=g,o.lastY=f,a.onDirty()}else if(c.touches.length===1&&o.isDragging){let r=c.touches[0].clientX-e.left,n=c.touches[0].clientY-e.top,u=r-o.lastX,l=n-o.lastY;!o.touchMoved&&(Math.abs(r-o.touchStartX)>10||Math.abs(n-o.touchStartY)>10)&&(o.touchMoved=!0,o.isCrosshairMode||clearTimeout(o.longPressTimer),o.liqPinTimer&&(clearTimeout(o.liqPinTimer),o.liqPinTimer=null)),o.isCrosshairMode?(s.set_crosshair(r,n),a.onDirty(),a.onCrosshairMove?.(r,n,o.dragZone),a.onVrvpHover?.(r,n)):(o.lastX=r,o.lastY=n,o.recordVelocity(u,l),o.dragZone===2?s.pan_x(u):o.dragZone===3?s.pan_y(l):s.pan(u,l),a.onDirty())}},{passive:!1}),t.addEventListener("touchend",c=>{if(o.disposed)return;if(clearTimeout(o.longPressTimer),o.liqPinTimer&&(clearTimeout(o.liqPinTimer),o.liqPinTimer=null),o.isDraggingAnchor){o.isDraggingAnchor=!1,o.dragAnchorIdx=-1,s.hide_crosshair(),a.onDirty(),a.onCrosshairHide?.();return}if(o.isDraggingDrawing){if(o.isDraggingDrawing=!1,s.hide_crosshair(),a.onDirty(),a.onCrosshairHide?.(),!o.touchMoved){let i=s.get_selected_drawing();if(i>0){let r=t.getBoundingClientRect();a.onDrawingDblClick?.(i,o.touchStartX,o.touchStartY,o.touchStartX+r.left,o.touchStartY+r.top)}}return}if(o.isBrushing){o.isBrushing=!1,s.finish_brush(),o.finishDrawing(),a.onDirty(),a.onCrosshairHide?.();return}let e=o.drawingMode;if(e&&O(e.tool)&&e.pathStarted){let i=Date.now(),r=o.touchStartX-(o._pathLastTapX||0),n=o.touchStartY-(o._pathLastTapY||0),u=Math.sqrt(r*r+n*n);i-(o._pathLastTapTime||0)<350&&u<30?(s.finish_elliott_manual(),o.finishDrawing(),o._pathLastTapTime=0):(o._pathLastTapTime=i,o._pathLastTapX=o.touchStartX,o._pathLastTapY=o.touchStartY),o.isDragging=!1,o.lastTouchDist=0,a.onDirty();return}if(e&&H(e.tool)&&e.pathStarted){let i=Date.now(),r=o.touchStartX-(o._pathLastTapX||0),n=o.touchStartY-(o._pathLastTapY||0),u=Math.sqrt(r*r+n*n);i-(o._pathLastTapTime||0)<350&&u<30?(s.finish_path(),o.finishDrawing(),o._pathLastTapTime=0):(o._pathLastTapTime=i,o._pathLastTapX=o.touchStartX,o._pathLastTapY=o.touchStartY),o.isDragging=!1,o.lastTouchDist=0,a.onDirty();return}if(e&&it(e.tool)){let i=e._stepAtTouchStart;if(e.step===1&&(i===1||o.touchMoved)){let r=t.getBoundingClientRect(),n=c.changedTouches?.[0];if(n){let u=n.clientX-r.left,l=n.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=A(s,u,l,g);e.x2=f,e.y2=d,e.step=2,s.clear_drawing_preview()}}else if(e.step===2&&(i===2||o.touchMoved)){let r=t.getBoundingClientRect(),n=c.changedTouches?.[0];if(n){let u=n.clientX-r.left,l=n.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=A(s,u,l,g),_=j[e.tool];_&&_.previewFn==="fib_ext"?s.clear_fib_ext_preview():s.clear_channel_preview(),W(s,e.tool,e,f,d,e.style),o.finishDrawing()}}o.isDragging=!1,o.lastTouchDist=0,o.drawingMode||(s.hide_crosshair(),a.onCrosshairHide?.()),a.onDirty();return}if(e&&e.step===1&&at(e.tool)){if(e._stepAtTouchStart===1||o.touchMoved){let r=t.getBoundingClientRect(),n=c.changedTouches?.[0];if(n){let u=n.clientX-r.left,l=n.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=A(s,u,l,g);W(s,e.tool,e,f,d,e.style),o.finishDrawing()}}o.isDragging=!1,o.lastTouchDist=0,o.drawingMode||(s.hide_crosshair(),a.onCrosshairHide?.()),a.onDirty();return}if(e&&k(e.tool)){let i=t.getBoundingClientRect(),r=c.changedTouches?.[0];if(r){let n=r.clientX-i.left,u=r.clientY-i.top,l=s.hit_zone(n,u),g=P(l)?Y(l):e.pane||0,{wx:f,wy:d}=A(s,n,u,g),_=e.tool;s.clear_drawing_preview();let h=W(s,_,e,f,d,e.style);o.finishDrawing(),_==="textnote"&&h>0&&(s.select_drawing(h),a.onDrawingSelected?.(h),a.onDrawingDblClick?.(h,n,u,n+i.left,u+i.top))}o.isDragging=!1,o.lastTouchDist=0,s.hide_crosshair(),a.onCrosshairHide?.(),a.onDirty();return}if(!o.touchMoved&&!o.drawingMode&&o.isDragging){let i=Date.now(),r=o.touchStartX-o.lastTapX,n=o.touchStartY-o.lastTapY,u=Math.sqrt(r*r+n*n),l=i-o.lastTapTime<350&&u<30,g=s.hover_hit_test(o.touchStartX,o.touchStartY),f=g[0],d=g[1],_=g[3],h=g[4];if(P(f))if(_>0){s.deselect_marker(),a.onMarkerSelected?.(0),s.select_drawing(_);let p=t.getBoundingClientRect(),w=o.touchStartX+p.left,M=o.touchStartY+p.top;a.onDrawingSelected?.(_,w,M),(d<=0||d===_)&&a.onDrawingDblClick?.(_,o.touchStartX,o.touchStartY,w,M),a.onDirty()}else h>0?(s.deselect_drawing(),a.onDrawingSelected?.(0),s.select_marker(h),a.onMarkerSelected?.(h),a.onDirty()):(d>0&&(s.deselect_drawing(),a.onDrawingSelected?.(0),a.onDirty()),s.get_selected_marker()>0&&(s.deselect_marker(),a.onMarkerSelected?.(0),a.onDirty()));o.lastTapTime=i,o.lastTapX=o.touchStartX,o.lastTapY=o.touchStartY}o.touchMoved&&!o.isCrosshairMode&&!o.drawingMode&&o.startMomentum(o.dragZone),o.isDragging=!1,o.isCrosshairMode=!1,o.lastTouchDist=0,(!o.drawingMode||o.drawingMode.step===0)&&(s.hide_crosshair(),a.onCrosshairHide?.()),a.onDirty(),a.onVrvpHover?.(null,null)})}function bt(t,s,a){let o={disposed:!1,isDragging:!1,dragZone:0,lastX:0,lastY:0,lastTouchDist:0,isResizingRsi:!1,isResizingOi:!1,isResizingFr:!1,isResizingCvd:!1,resizeStartY:0,resizeStartRatio:0,lastClickTime:0,isDraggingAnchor:!1,dragAnchorIdx:-1,dragAnchorPane:0,isBrushing:!1,isDraggingDrawing:!1,dragDrawingPane:0,dragDrawingLastWx:0,dragDrawingLastWy:0,touchStartX:0,touchStartY:0,touchMoved:!1,longPressTimer:null,isCrosshairMode:!1,liqPinTimer:null,liqPinSx:0,liqPinSy:0,velSamples:[],momentumRaf:null,momentumVx:0,momentumVy:0,momentumZone:0,lastTapTime:0,lastTapX:0,lastTapY:0,drawingMode:null},c=.92,e=.5,i=80;o.recordVelocity=function(l,g){let f=performance.now();for(o.velSamples.push({dx:l,dy:g,t:f});o.velSamples.length>0&&f-o.velSamples[0].t>i;)o.velSamples.shift()};function r(){if(o.velSamples.length<2)return{vx:0,vy:0};let l=o.velSamples[0],f=o.velSamples[o.velSamples.length-1].t-l.t;if(f<5)return{vx:0,vy:0};let d=0,_=0;for(let p of o.velSamples)d+=p.dx,_+=p.dy;let h=16.67;return{vx:d/f*h,vy:_/f*h}}o.cancelMomentum=function(){o.momentumRaf&&(cancelAnimationFrame(o.momentumRaf),o.momentumRaf=null),o.velSamples=[]},o.startMomentum=function(l){let{vx:g,vy:f}=r();if(o.velSamples=[],Math.abs(g)<e&&Math.abs(f)<e)return;o.momentumVx=g,o.momentumVy=f,o.momentumZone=l;function d(){if(o.momentumVx*=c,o.momentumVy*=c,Math.abs(o.momentumVx)<e&&Math.abs(o.momentumVy)<e){o.momentumRaf=null;return}o.momentumZone===2?s.pan_x(o.momentumVx):o.momentumZone===3?s.pan_y(o.momentumVy):s.pan(o.momentumVx,o.momentumVy),a.onDirty(),o.momentumRaf=requestAnimationFrame(d)}o.momentumRaf=requestAnimationFrame(d)};let n={setMode(l,g){l?(o.drawingMode={tool:l,style:g,step:0,x1:0,y1:0},t.style.cursor="crosshair"):(o.drawingMode?.pathStarted&&s.finish_path(),o.drawingMode=null,s.clear_drawing_preview(),t.style.cursor="crosshair"),a.onDirty()},getMode(){return o.drawingMode}};a.drawingApi?.(n),o.finishDrawing=function(){s.clear_drawing_preview(),a.onDrawingComplete?.(),o.drawingMode=null,t.style.cursor="crosshair"},Ut(t,s,a,o),$t(t,s,a,o);let u=l=>{let g=document.activeElement?.tagName,f=g==="INPUT"||g==="TEXTAREA"||document.activeElement?.isContentEditable;if((l.key==="Delete"||l.key==="Backspace")&&!o.drawingMode&&!f){let _=s.get_selected_drawing();if(_>0){s.remove_drawing(_),a.onDrawingSelected?.(0),a.onDirty();return}let h=s.get_selected_marker();if(h>0){s.remove_marker(h),a.onMarkerSelected?.(0),a.onDirty();return}}if(l.key==="Escape"&&!o.drawingMode){if(s.get_selected_drawing()>0){s.deselect_drawing(),a.onDrawingSelected?.(0),a.onDirty();return}if(s.get_selected_marker()>0){s.deselect_marker(),a.onMarkerSelected?.(0),a.onDirty();return}}if(l.key==="Escape"&&o.drawingMode){if(o.drawingMode.pathStarted){o.drawingMode.tool==="elliott"?s.finish_elliott_manual():s.finish_path(),o.finishDrawing(),a.onDirty();return}s.clear_drawing_preview(),o.drawingMode=null,t.style.cursor="crosshair",a.onDrawingCancel?.(),a.onDirty();return}let d=20;switch(l.key){case"+":case"=":s.zoom(t.width/2,t.height/2,.9);break;case"-":s.zoom(t.width/2,t.height/2,1.1);break;case"ArrowLeft":s.pan_x(d);break;case"ArrowRight":s.pan_x(-d);break;case"ArrowUp":s.pan_y(-d);break;case"ArrowDown":s.pan_y(d);break;case"r":case"R":s.auto_scale_y();break;default:return}a.onDirty()};return window.addEventListener("keydown",u),()=>{o.disposed=!0,o.cancelMomentum(),window.removeEventListener("keydown",u)}}function xt(t,s,a,o){let c=e=>o()(e);return{enableRsi(){t.enable_rsi(),s()},disableRsi(){t.disable_rsi(),s()},setRsiPeriod(e){t.set_rsi_period(e),s()},isRsiEnabled(){return t.is_rsi_enabled()},setRsiShowEma(e){t.set_rsi_show_ema(e),s()},setRsiShowWma(e){t.set_rsi_show_wma(e),s()},setRsiShowSignals(e){t.set_rsi_show_signals(e),s()},setRsiShowDivergence(e){t.set_rsi_show_divergence(e),s()},setRsiShowTraps(e){t.set_rsi_show_traps(e),s()},setRsiSmoothing(e){t.set_rsi_smoothing(e),s()},setRsiRatio(e){t.set_rsi_ratio(e),s()},getRsiRatio(){return t.get_rsi_ratio()},enableForexSignals(){c("forexSignals")&&(t.enable_forex_signals(),s())},disableForexSignals(){t.disable_forex_signals(),s()},isForexSignalsEnabled(){return t.is_forex_signals_enabled()},setForexSignalsSetup(e){t.set_forex_signals_setup(e),s()},setForexSignalsMode(e){t.set_forex_signals_mode(e),s()},setForexSignalsShowStats(e){t.set_forex_signals_show_stats(e),s()},getForexSignalsCount(){return t.get_forex_signals_count()},enableOi(){a()||c("oi")&&(t.enable_oi(),s())},disableOi(){a()||(t.disable_oi(),s())},isOiEnabled(){if(a())return!1;try{return t.is_oi_enabled()}catch{return!1}},setOiData(e){a()||(t.set_oi_data(e),s())},setOiDataTs(e,i){a()||(t.set_oi_data_ts(e,i),s())},setOiShowOnChart(e){a()||(t.set_oi_show_on_chart(e),s())},setOiDisplayMode(e){a()||(t.set_oi_display_mode(e),s())},setOiRatio(e){a()||(t.set_oi_ratio(e),s())},getOiRatio(){if(a())return .2;try{return t.get_oi_ratio()}catch{return .2}},enableFundingRate(){a()||c("fundingRate")&&(t.enable_funding_rate(),s())},disableFundingRate(){a()||(t.disable_funding_rate(),s())},isFundingRateEnabled(){if(a())return!1;try{return t.is_funding_rate_enabled()}catch{return!1}},setFrBinanceData(e,i){a()||(t.set_fr_binance_data(e,i),s())},setFrAggData(e,i){a()||(t.set_fr_agg_data(e,i),s())},setFrShowAgg(e){a()||(t.set_fr_show_agg(e),s())},setFrShowSma(e){a()||(t.set_fr_show_sma(e),s())},enableCvd(){a()||c("cvd")&&(t.enable_cvd(),s())},disableCvd(){a()||(t.disable_cvd(),s())},isCvdEnabled(){if(a())return!1;try{return t.is_cvd_enabled()}catch{return!1}},setCvdData(e,i){a()||(t.set_cvd_data(e,i),s())},setCvdMode(e){a()||(t.set_cvd_mode(e),s())},getCvdMode(){if(a())return 0;try{return t.get_cvd_mode()}catch{return 0}},setCvdShowDelta(e){a()||(t.set_cvd_show_delta(e),s())},getCvdShowDelta(){if(a())return!0;try{return t.get_cvd_show_delta()}catch{return!0}},enableLargeTrades(){a()||c("largeTrades")&&(t.enable_large_trades(),s())},disableLargeTrades(){a()||(t.disable_large_trades(),s())},isLargeTradesEnabled(){if(a())return!1;try{return t.is_large_trades_enabled()}catch{return!1}},setLargeTradesData(e){a()||(t.set_large_trades_data(e),s())},pushLargeTrade(e,i,r,n){a()||(t.push_large_trade(e,i,r,n),s())},clearLargeTrades(){a()||(t.clear_large_trades(),s())},setLtVolumeFilter(e,i){a()||(t.set_lt_volume_filter(e,i),s())},setLtBubbleScale(e){a()||(t.set_lt_bubble_scale(e),s())},getLtDataMinVol(){return a()?0:t.get_lt_data_min_vol()},getLtDataMaxVol(){return a()?0:t.get_lt_data_max_vol()},ltHitTest(e,i){if(a())return"";try{return t.lt_hit_test(e,i)}catch{return""}},enableVrvp(){a()||c("vrvp")&&(t.enable_vrvp(),s())},disableVrvp(){a()||(t.disable_vrvp(),s())},isVrvpEnabled(){if(a())return!1;try{return t.is_vrvp_enabled()}catch{return!1}},setVrvpPocLine(e){a()||(t.set_vrvp_poc_line(e),s())},vrvpHitTest(e,i){if(a())return"";try{return t.vrvp_hit_test(e,i)}catch{return""}},enableTpo(){a()||c("tpo")&&(t.enable_tpo(),s())},disableTpo(){a()||(t.disable_tpo(),s())},isTpoEnabled(){if(a())return!1;try{return t.is_tpo_enabled()}catch{return!1}},setTpoPocLine(e){a()||(t.set_tpo_poc_line(e),s())},setTpoVaLines(e){a()||(t.set_tpo_va_lines(e),s())},setTpoIb(e){a()||(t.set_tpo_ib(e),s())},setTpoSinglePrints(e){a()||(t.set_tpo_single_prints(e),s())},setTpoPeriod(e){a()||(t.set_tpo_period(e),s())},getTpoPeriod(){if(a())return 1440;try{return t.get_tpo_period()}catch{return 1440}},setTpoNakedPoc(e){a()||(t.set_tpo_naked_poc(e),s())},setTpoProfileShape(e){a()||(t.set_tpo_profile_shape(e),s())},setTpoIbMinutes(e){a()||(t.set_tpo_ib_minutes(e),s())},setTpoLetterMinutes(e){a()||(t.set_tpo_letter_minutes(e),s())},setTpoSignals(e){a()||(t.set_tpo_signals(e),s())},isTpoSignals(){if(a())return!1;try{return t.is_tpo_signals()}catch{return!1}},enableLiqHeatmap(){a()||c("liqHeatmap")&&(t.enable_liq_heatmap(),s())},disableLiqHeatmap(){a()||(t.disable_liq_heatmap(),s())},isLiqHeatmapEnabled(){if(a())return!1;try{return t.is_liq_heatmap_enabled()}catch{return!1}},setLiqHeatmapRange(e,i){a()||(t.set_liq_heatmap_range(e,i),s())},getLiqHeatmapMin(){if(a())return 0;try{return t.get_liq_heatmap_min()}catch{return 0}},getLiqHeatmapMax(){if(a())return 1;try{return t.get_liq_heatmap_max()}catch{return 1}},getLiqHeatmapSegMax(){if(a())return 0;try{return t.get_liq_heatmap_seg_max()}catch{return 0}},setLiqHeatmapProfile(e){a()||(t.set_liq_heatmap_profile(e),s())},isLiqHeatmapProfile(){if(a())return!0;try{return t.is_liq_heatmap_profile()}catch{return!0}},setLiqHeatmapCellHeight(e){a()||(t.set_liq_heatmap_cell_height(e),s())},getLiqHeatmapCellHeight(){if(a())return 1;try{return t.get_liq_heatmap_cell_height()}catch{return 1}},setLiqHeatmapPredictions(e){a()||(t.set_liq_heatmap_predictions(e),s())},setLiqHeatmapFilledPct(e){a()||(t.set_liq_heatmap_filled_pct(e),s())},getLiqHeatmapFilledPct(){if(a())return .85;try{return t.get_liq_heatmap_filled_pct()}catch{return .85}},liqHeatmapHitTest(e,i){if(a())return"";try{return t.liq_heatmap_hit_test(e,i)}catch{return""}},liqZoneHitTest(e,i){if(a())return"";try{return t.liq_zone_hit_test(e,i)}catch{return""}},enableSmartRanges(){a()||c("smartRanges")&&(t.enable_smart_ranges(),s())},disableSmartRanges(){a()||(t.disable_smart_ranges(),s())},isSmartRangesEnabled(){if(a())return!1;try{return t.is_smart_ranges_enabled()}catch{return!1}},setSrTextSize(e){a()||(t.set_sr_text_size(e),s())},setSrShowOb(e){a()||(t.set_sr_show_ob(e),s())},setSrObLast(e){a()||(t.set_sr_ob_last(e),s())},setSrShowObActivity(e){a()||(t.set_sr_show_ob_activity(e),s())},setSrShowBreakers(e){a()||(t.set_sr_show_breakers(e),s())},setSrMitigation(e){a()||(t.set_sr_mitigation(e),s())},setSrShowMetrics(e){a()||(t.set_sr_show_metrics(e),s())},setSrShowHtfOb(e){a()||(t.set_sr_show_htf_ob(e),s())},setSrHtfMinutes(e){a()||(t.set_sr_htf_minutes(e),s())},setSrShowFvg(e){a()||(t.set_sr_show_fvg(e),s())},setSrFvgTheme(e){a()||(t.set_sr_fvg_theme(e),s())},setSrFvgMitigation(e){a()||(t.set_sr_fvg_mitigation(e),s())},setSrFvgHtf(e){a()||(t.set_sr_fvg_htf(e),s())},setSrFvgExtend(e){a()||(t.set_sr_fvg_extend(e),s())},setSrShowObSignals(e){a()||(t.set_sr_show_ob_signals(e),s())},setSrShowPredict(e){a()||(t.set_sr_show_predict(e),s())},setSrShowFvgSignals(e){a()||(t.set_sr_show_fvg_signals(e),s())},setSrShowSmartRev(e){a()||(t.set_sr_show_smart_rev(e),s())},setSrSmartRevHtf(e){a()||(t.set_sr_smart_rev_htf(e),s())},setSrStatsType(e){a()||(t.set_sr_stats_type(e),s())},setSrStatsPosition(e){a()||(t.set_sr_stats_position(e),s())},getSrSignalsCount(){if(a())return 0;try{return t.get_sr_signals_count()}catch{return 0}},enableEmaStructure(){a()||c("emaStructure")&&(t.enable_ema_structure(),s())},disableEmaStructure(){a()||(t.disable_ema_structure(),s())},isEmaStructureEnabled(){if(a())return!1;try{return t.is_ema_structure_enabled()}catch{return!1}},setEsEma1Len(e){a()||(t.set_es_ema1_len(e),s())},setEsEma2Len(e){a()||(t.set_es_ema2_len(e),s())},setEsWmaLen(e){a()||(t.set_es_wma_len(e),s())},setEsShowEma1(e){a()||(t.set_es_show_ema1(e),s())},setEsShowEma2(e){a()||(t.set_es_show_ema2(e),s())},setEsShowWma(e){a()||(t.set_es_show_wma(e),s())},setEsSwingLen(e){a()||(t.set_es_swing_len(e),s())},setEsShowBos(e){a()||(t.set_es_show_bos(e),s())},enableLiveSignals(){a()||(t.enable_live_signals(),s())},disableLiveSignals(){a()||(t.disable_live_signals(),s())},isLiveSignalsEnabled(){if(a())return!1;try{return t.is_live_signals_enabled()}catch{return!1}},setLiveSignalsData(e){a()||(t.set_live_signals_data(new Float64Array(e)),s())},clearLiveSignals(){a()||(t.clear_live_signals(),s())},setLiveSignalsLeverage(e){a()||(t.set_live_signals_leverage(e),s())},getLiveSignalsLeverage(){if(a())return 10;try{return t.get_live_signals_leverage()}catch{return 10}},setLiveSignalsTrial(e){a()||(t.set_live_signals_trial(e),s())},setLiveSignalsShowEntry(e){a()||(t.set_live_signals_show_entry(e),s())},setLiveSignalsShowTpSl(e){a()||(t.set_live_signals_show_tp_sl(e),s())},setLiveSignalsShowMaxProfit(e){a()||(t.set_live_signals_show_max_profit(e),s())},setLiveSignalsShowLabels(e){a()||(t.set_live_signals_show_labels(e),s())},setLiveSignalsShowZones(e){a()||(t.set_live_signals_show_zones(e),s())},setLiveSignalsTextSize(e){a()||(t.set_live_signals_text_size(e),s())},setLiveSignalsPipValue(e){a()||(t.set_live_signals_pip_value(e),s())},setLiveSignalsLoading(e){a()||(t.set_live_signals_loading(e),s())},getLiveSignalsCount(){if(a())return 0;try{return t.get_live_signals_count()}catch{return 0}},enableVolume(){t.enable_volume(),s()},disableVolume(){t.disable_volume(),s()},isVolumeEnabled(){return t.is_volume_enabled()},setVolumeMaPeriod(e){t.set_volume_ma_period(e),s()},setVolumeShowMa(e){t.set_volume_show_ma(e),s()},setVolumeShowSignals(e){t.set_volume_show_signals(e),s()},setVolumeColorMode(e){t.set_volume_color_mode(e),s()},getVolumeMaPeriod(){return t.get_volume_ma_period()},getVolumeShowMa(){return t.get_volume_show_ma()},getVolumeShowSignals(){return t.get_volume_show_signals()},getVolumeColorMode(){return t.get_volume_color_mode()}}}function kt(t,s,a,o){let c=e=>o()(e);return{addMarker(e,i,r){t.add_marker(e,i,r),s()},clearMarkers(){t.clear_markers(),s()},hitTestMarker(e,i){return t.hit_test_marker(e,i)},selectMarker(e){t.select_marker(e),s()},deselectMarker(){t.deselect_marker(),s()},getSelectedMarker(){return t.get_selected_marker()},removeMarker(e){t.remove_marker(e),s()},deleteSelectedMarker(){let e=t.get_selected_marker();return e>0&&(t.remove_marker(e),s()),e},addTrendline(e,i,r,n,u,l,g,f,d,_=0){let h=t.add_trendline(e,i,r,n,u,l,g,f,d,_);return s(),h},addHorizontalLine(e,i,r,n,u,l,g,f=0){let d=t.add_horizontal_line(e,i,r,n,u,l,g,f);return s(),d},addArrow(e,i,r,n,u,l,g,f,d,_=0){let h=t.add_arrow(e,i,r,n,u,l,g,f,d,_);return s(),h},addFibRetracement(e,i,r,n,u,l,g,f,d,_=0){if(!c("drawingFull"))return 0;let h=t.add_fib_retracement(e,i,r,n,u,l,g,f,d,_);return s(),h},addFibExtension(e,i,r,n,u,l,g,f,d,_,h,p=0){if(!c("drawingFull"))return 0;let w=t.add_fib_extension(e,i,r,n,u,l,g,f,d,_,h,p);return s(),w},addLongPosition(e,i,r,n,u,l,g,f,d,_=0){if(!c("drawingFull"))return 0;let h=t.add_long_position(e,i,r,n,u,l,g,f,d,_);return s(),h},addShortPosition(e,i,r,n,u,l,g,f,d,_=0){if(!c("drawingFull"))return 0;let h=t.add_short_position(e,i,r,n,u,l,g,f,d,_);return s(),h},addAnchoredVwap(e,i,r,n,u,l,g=0){if(!c("drawingFull"))return 0;let f=t.add_anchored_vwap(e,i,r,n,u,l,g);return s(),f},addPriceLabel(e,i,r,n,u,l,g=0){let f=t.add_price_label(e,i,r,n,u,l,g);return s(),f},addElliottImpulse(e,i,r,n,u,l,g=0){if(!c("drawingFull"))return 0;let f=t.add_elliott_impulse(e,i,r,n,u,l,g);return s(),f},setDrawingFontSize(e,i){t.set_drawing_font_size(e,i),s()},getDrawingFontSize(e){return t.get_drawing_font_size(e)},setDrawingText(e,i){t.set_drawing_text(e,i),s()},getDrawingText(e){return t.get_drawing_text(e)},setDrawingStyle(e,i,r,n,u){t.set_drawing_style(e,i,r,n,u),s()},getDrawingColor(e){let i=t.get_drawing_color(e);return i?{r:i>>>24&255,g:i>>>16&255,b:i>>>8&255,lineWidth:(i&255)/10}:null},getDrawingDashed(e){try{return t.get_drawing_dashed(e)}catch{return!1}},setDrawingDashed(e,i){t.set_drawing_dashed(e,i),s()},getDrawingHideLabel(e){try{return t.get_drawing_hide_label(e)}catch{return!1}},setDrawingHideLabel(e,i){t.set_drawing_hide_label(e,i),s()},getDrawingKindId(e){try{return t.get_drawing_kind_id(e)}catch{return 255}},removeDrawing(e){t.remove_drawing(e),s()},clearDrawings(){t.clear_drawings(),s()},drawingCount(){return t.drawing_count()},setDrawingPreview(e,i,r,n,u,l,g,f,d,_,h=0){t.set_drawing_preview(e,i,r,n,u,l,g,f,d,_,h),s()},clearDrawingPreview(){t.clear_drawing_preview(),s()},cancelBrush(){t.cancel_brush(),s()},selectDrawing(e){t.select_drawing(e),s()},deselectDrawing(){t.deselect_drawing(),s()},getSelectedDrawing(){return t.get_selected_drawing()},deleteSelectedDrawing(){let e=t.get_selected_drawing();return e>0&&(t.remove_drawing(e),s()),e},exportDrawingsJson(){try{return t.export_drawings_json()}catch{return"[]"}},importDrawingsJson(e){try{t.import_drawings_json(e),s()}catch(i){console.warn("[bridge] importDrawingsJson failed",i)}},screenToWorld(e,i){return{x:t.screen_to_world_x(e),y:t.screen_to_world_y(i)}},worldToScreen(e,i){try{return{x:t.world_to_screen_x(e),y:t.world_to_screen_y(i)}}catch{return null}}}}function te(t,s,a,o){let c=e=>o()(e);return{setKlines(e,i,r,n,u,l){t.set_klines(new Float64Array(e),new Float64Array(i),new Float64Array(r),new Float64Array(n),new Float64Array(u),new Float64Array(l)),s()},setRealTimestamps(e){t.set_real_timestamps(new Float64Array(e)),s()},appendRealTimestamp(e){t.append_real_timestamp(e)},prependKlines(e,i,r,n,u,l){t.prepend_klines(new Float64Array(e),new Float64Array(i),new Float64Array(r),new Float64Array(n),new Float64Array(u),new Float64Array(l)),s()},appendKline(e,i,r,n,u,l){t.append_kline(e,i,r,n,u,l),s()},updateLastKline(e,i,r,n,u,l){t.update_last_kline(e,i,r,n,u,l),s()},popLastKline(){let e=t.pop_last_kline();return e&&s(),e},getLastClose(){try{return t.get_last_close()}catch{return 0}},getKlineCount(){if(a())return 0;try{return t.kline_count()}catch{return 0}},getKlineTimestamps(){if(a())return null;try{return t.kline_timestamps()}catch{return null}},getKlineOpens(){if(a())return null;try{return t.kline_opens()}catch{return null}},getKlineHighs(){if(a())return null;try{return t.kline_highs()}catch{return null}},getKlineLows(){if(a())return null;try{return t.kline_lows()}catch{return null}},getKlineCloses(){if(a())return null;try{return t.kline_closes()}catch{return null}},getKlineVolumes(){if(a())return null;try{return t.kline_volumes()}catch{return null}},setHeatmap(e,i,r,n,u,l,g){c("heatmap")&&(t.set_heatmap(new Float64Array(e),i,r,n,u,l,g),s())},appendHeatmapColumn(e,i,r,n){c("heatmap")&&(t.append_heatmap_column(new Float64Array(e),i,r,n),s())},updateLastHeatmapColumn(e,i,r){t.update_last_heatmap_column(new Float64Array(e),i,r),s()},getHeatmapLastTimestamp(){try{return t.get_heatmap_last_timestamp()}catch{return 0}},getHeatmapXStep(){try{return t.get_heatmap_x_step()}catch{return 0}},updateHeatmapColumnAt(e,i,r,n){t.update_heatmap_column_at(new Float64Array(e),i,r,n),s()},setHeatmapRange(e,i){t.set_heatmap_range(e,i),s()},getHeatmapDataRange(){try{return{min:t.get_heatmap_data_min(),max:t.get_heatmap_data_max()}}catch{return{min:0,max:0}}},setHeatmapPrefetchRange(e){try{t.set_heatmap_prefetch_range(e)}catch{}},clearHeatmapPrefetchRange(){try{t.clear_heatmap_prefetch_range()}catch{}},getHeatmapPrefetchMax(){try{return t.get_heatmap_prefetch_max()}catch{return 0}},setChartType(e){a()||e===2&&!c("footprint")||(t.set_chart_type(e),s())},getChartType(){if(a())return 0;try{return t.get_chart_type()}catch{return 0}},setFootprintTickSize(e){a()||c("footprint")&&(t.set_footprint_tick_size(e),s())},footprintEnsureLen(e){a()||t.footprint_ensure_len(e)},footprintAddTrade(e,i,r,n){a()||t.footprint_add_trade(e,i,r,n)},footprintAddTradeBatch(e){a()||!e||e.length===0||t.footprint_add_trade_batch(e instanceof Float64Array?e:new Float64Array(e))},footprintSetBar(e,i,r,n,u){a()||(t.footprint_set_bar(e,i,r,n,u),s())},footprintClear(){a()||(t.footprint_clear(),s())},footprintClearBar(e){a()||t.footprint_clear_bar(e)},footprintPrependEmpty(e){a()||t.footprint_prepend_empty(e)},footprintSetShowSignals(e){a()||(t.footprint_set_show_signals(e),s())},footprintGetShowSignals(){if(a())return!0;try{return t.footprint_get_show_signals()}catch{return!0}},footprintSignalCount(){if(a())return 0;try{return t.footprint_signal_count()}catch{return 0}},footprintSetShowProfile(e){a()||(t.footprint_set_show_profile(e),s())},footprintGetShowProfile(){if(a())return!1;try{return t.footprint_get_show_profile()}catch{return!1}},footprintProfileHitTest(e,i){if(a())return"";try{return t.footprint_profile_hit_test(e,i)}catch{return""}},footprintSetDisplayMode(e){a()||(t.footprint_set_display_mode(e),s())},footprintGetDisplayMode(){if(a())return 0;try{return t.footprint_get_display_mode()}catch{return 0}},enableDeltaHistogram(){a()||t.enable_delta_histogram()},disableDeltaHistogram(){a()||t.disable_delta_histogram()},deltaHistogramEnabled(){if(a())return!1;try{return t.delta_histogram_enabled()}catch{return!1}}}}var Ee=1;function N(t){if(typeof t!="string")return{r:255,g:255,b:255,a:153};if(t.startsWith("#")){let a=t.slice(1);if(a.length===8)return{r:parseInt(a.slice(0,2),16),g:parseInt(a.slice(2,4),16),b:parseInt(a.slice(4,6),16),a:parseInt(a.slice(6,8),16)};let o=parseInt(a.slice(0,2),16),c=parseInt(a.slice(2,4),16),e=parseInt(a.slice(4,6),16);return{r:o,g:c,b:e,a:255}}let s=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\)/);return s?{r:+s[1],g:+s[2],b:+s[3],a:s[4]!==void 0?Math.round(+s[4]*255):255}:{r:255,g:255,b:255,a:153}}function yt(t,s,a){let o=new Map,c=null,e=0,i=NaN;function r(){let f;try{f=t.kline_count()}catch{return c}if(f===0)return null;let d=t.kline_closes(),_=d?.[f-1]??NaN;if(c&&!(f!==e||_!==i))return c;try{let p=t.kline_timestamps(),w=t.kline_opens(),M=t.kline_highs(),S=t.kline_lows(),C=t.kline_volumes();if(!p||!d)return c;c={timestamps:Array.from(p),open:Array.from(w),high:Array.from(M),low:Array.from(S),close:Array.from(d),volume:Array.from(C),length:f},e=f,i=_;for(let q of o.values())q._needsCompute=!0}catch{}return c}function n(){return{seriesLine(f,d="#ffffff99",_=1.5){let h=N(d);t.custom_series_line(new Float64Array(f),h.r,h.g,h.b,h.a,_)},seriesDashedLine(f,d="#ffffff66",_=1,h=4,p=4){let w=N(d);t.custom_series_dashed_line(new Float64Array(f),w.r,w.g,w.b,w.a,_,h,p)},band(f,d,_="rgba(100,149,237,0.08)"){let h=N(_);t.custom_band(new Float64Array(f),new Float64Array(d),h.r,h.g,h.b,h.a)},hline(f,d="#ffffff66",_=1){let h=N(d);t.custom_hline(f,h.r,h.g,h.b,h.a,_)},dashedHline(f,d="#ffffff66",_=1,h=6,p=4){let w=N(d);t.custom_dashed_hline(f,w.r,w.g,w.b,w.a,_,h,p)},marker(f,d,_="#e8a04a",h=3){let p=N(_);t.custom_marker(f,d,p.r,p.g,p.b,p.a,h)},markerUp(f,d,_="#26a69a",h=5){let p=N(_);t.custom_marker_up(f,d,p.r,p.g,p.b,p.a,h)},markerDown(f,d,_="#ef5350",h=5){let p=N(_);t.custom_marker_down(f,d,p.r,p.g,p.b,p.a,h)},text(f,d,_,h="#ffffffaa",p=10,w="center"){let M=N(h),S=w==="center"?1:w==="right"?2:0;t.custom_text(f,d,_,M.r,M.g,M.b,M.a,p,S)},priceLabel(f,d,_="#ffffffaa",h=10){let p=N(_);t.custom_price_label(f,d,p.r,p.g,p.b,p.a,h)},linePx(f,d,_,h,p,w=1){let M=N(p);t.custom_line_px(f,d,_,h,M.r,M.g,M.b,M.a,w)},fillRectPx(f,d,_,h,p){let w=N(p);t.custom_fill_rect_px(f,d,_,h,w.r,w.g,w.b,w.a)},strokeRectPx(f,d,_,h,p,w=1){let M=N(p);t.custom_stroke_rect_px(f,d,_,h,M.r,M.g,M.b,M.a,w)},textPx(f,d,_,h,p=10,w="left"){let M=N(h),S=w==="center"?1:w==="right"?2:0;t.custom_text_px(f,d,_,M.r,M.g,M.b,M.a,p,S)},worldToScreenX:f=>t.world_to_screen_x(f),worldToScreenY:f=>t.world_to_screen_y(f),screenToWorldX:f=>t.screen_to_world_x(f),screenToWorldY:f=>t.screen_to_world_y(f),chartArea:()=>({x:t.chart_area_x(),y:t.chart_area_y(),w:t.chart_area_w(),h:t.chart_area_h()})}}function u(f){if(!f.compute)return;let d=r();if(d)try{f._computed=f.compute(d,f.params)||{}}catch(_){console.warn(`[CustomIndicator "${f.name}"] compute error:`,_),f._computed={}}}function l(f){if(o.size===0)return;let d=r();if(!d)return;t.custom_begin();let _=n();for(let p of o.values())if(p.enabled){p._needsCompute&&(u(p),p._needsCompute=!1);try{p.render.call(p,_,p._computed||{},d)}catch(w){console.warn(`[CustomIndicator "${p.name}"] render error:`,w)}}if(t.custom_end(),t.custom_command_count()>0){let p=t.get_custom_buffer_ptr(),w=t.get_custom_buffer_len();a(f,s,p,w)}}function g(){c=null,e=0,i=NaN;for(let f of o.values())f._needsCompute=!0}return{add(f){let d=Ee++,_={id:d,name:f.name||`Custom ${d}`,params:{...f.params},compute:f.compute||null,render:f.render,enabled:!0,_computed:{},_needsCompute:!0};return o.set(d,_),d},remove(f){o.delete(f)},updateParams(f,d){let _=o.get(f);_&&(Object.assign(_.params,d),_._needsCompute=!0)},setEnabled(f,d){let _=o.get(f);_&&(_.enabled=d)},list(){return[...o.values()].map(f=>({id:f.id,name:f.name,params:{...f.params},enabled:f.enabled}))},invalidateCompute:g,renderAll:l}}var ee={free:{candlestick:!0,volume:!0,rsi:!1,drawingBasic:!1,drawingFull:!1,heatmap:!1,footprint:!1,liqHeatmap:!1,oi:!1,fundingRate:!1,cvd:!1,largeTrades:!1,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1},trial:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!1,heatmap:!1,footprint:!1,liqHeatmap:!1,oi:!1,fundingRate:!1,cvd:!1,largeTrades:!1,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1},standard:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!1,heatmap:!1,footprint:!1,liqHeatmap:!1,oi:!1,fundingRate:!1,cvd:!1,largeTrades:!1,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1},professional:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1},enterprise:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!0,tpo:!0,smartRanges:!0,emaStructure:!0,customIndicators:!0,forexSignals:!0}},Ne={rsi:"RSI",drawingBasic:"Basic Drawing Tools",heatmap:"Orderbook Heatmap",footprint:"Footprint Chart",liqHeatmap:"Liquidation Heatmap",oi:"Open Interest",fundingRate:"Funding Rate",cvd:"CVD",largeTrades:"Large Trades",vrvp:"VRVP",tpo:"TPO / Market Profile",smartRanges:"Smart Ranges",emaStructure:"EMA Structure",drawingFull:"All Drawing Tools",customIndicators:"Custom Indicators",forexSignals:"Forex Signals"},Pe={rsi:"Standard",drawingBasic:"Standard",heatmap:"Professional",footprint:"Professional",liqHeatmap:"Professional",oi:"Professional",fundingRate:"Professional",cvd:"Professional",largeTrades:"Professional",drawingFull:"Professional",vrvp:"Enterprise",tpo:"Enterprise",smartRanges:"Enterprise",emaStructure:"Enterprise",customIndicators:"Enterprise",forexSignals:"Enterprise"};function tt(t){return ee[t]||ee.trial}function Et(t){let s=tt(t),a=new Set;return function(c){if(s[c])return!0;if(!a.has(c)){a.add(c);let e=Ne[c]||c,i=Pe[c]||"a higher";console.warn(`[MRD Chart Engine] "${e}" requires ${i} plan. Current plan: ${t}. Upgrade at https://mrd-chart.dev/pricing`)}return!1}}var Fe=14,re="trial",nt="free";var Pt=[95,95,109,114].map(t=>String.fromCharCode(t)).join(""),je=1297237059;function ie(t){let s=`${t}:${je}:${(t^2043453)>>>0}`,a=2166136261;for(let o=0;o<s.length;o++)a^=s.charCodeAt(o),a=Math.imul(a,16777619);return(a>>>0).toString(36)}function lt(t){return`${t}.${ie(t)}`}function ut(t){if(!t||typeof t!="string")return null;let s=t.lastIndexOf(".");if(s<1)return null;let a=parseInt(t.slice(0,s),10);return!a||a<1e9||a>2e9||t.slice(s+1)!==ie(a)?null:a}var ne=Pt+"e7x",le=Pt+"p3q",ue="mrd_engine_session_id",fe="mrd_ce_db",et="meta",de="trial_ts",_e=Pt+"ck";function Ft(){try{return ut(localStorage.getItem(ne))}catch{return null}}function jt(t){try{localStorage.setItem(ne,lt(t))}catch{}}function Rt(){try{return ut(localStorage.getItem(le))}catch{return null}}function Dt(t){try{localStorage.setItem(le,lt(t))}catch{}}function Yt(){try{return ut(sessionStorage.getItem(ue))}catch{return null}}function zt(t){try{sessionStorage.setItem(ue,lt(t))}catch{}}function Zt(){try{let t=document.cookie.match(new RegExp(`(?:^|;\\s*)${_e}=([^;]+)`));return t?ut(decodeURIComponent(t[1])):null}catch{return null}}function Xt(t){try{let s=encodeURIComponent(lt(t));document.cookie=`${_e}=${s};path=/;max-age=${86400*400};SameSite=Lax`}catch{}}var rt=null,oe=!1;function Re(){if(!(oe||typeof indexedDB>"u")){oe=!0;try{let t=indexedDB.open(fe,1);t.onupgradeneeded=()=>{let s=t.result;s.objectStoreNames.contains(et)||s.createObjectStore(et)},t.onsuccess=()=>{let o=t.result.transaction(et,"readonly").objectStore(et).get(de);o.onsuccess=()=>{let c=ut(o.result);c&&(!rt||c<rt)&&(rt=c,De(c))}}}catch{}}}function ce(t){rt=t;try{let s=indexedDB.open(fe,1);s.onsuccess=()=>{s.result.transaction(et,"readwrite").objectStore(et).put(lt(t),de)}}catch{}}function De(t){let s=Math.floor(Date.now()/1e3),a=he([Ft(),Rt(),Yt(),Zt(),t],s);a&&a!==t||a&&(jt(a),Dt(a),zt(a),Xt(a))}function he(t,s){let a=null;for(let o of t)o&&(o>s+60||o<17e8||(!a||o<a)&&(a=o));return a}function Ye(){let t=Math.floor(Date.now()/1e3),s=[Ft(),Rt(),Yt(),Zt(),rt];return he(s,t)}function ze(t){jt(t),Dt(t),zt(t),Xt(t),ce(t)}function Ze(t){Ft()||jt(t),Rt()||Dt(t),Yt()||zt(t),Zt()||Xt(t),rt||ce(t)}Re();function mt(t){if(!t||t==="trial")return Xe();try{let s=JSON.parse(atob(t)),{p:a,d:o,e:c,s:e}=s;if(!a||!e)return{valid:!1,error:"Invalid license key format"};let i={...s};if(delete i.s,e!==pe(i))return{valid:!1,error:"Invalid license key signature"};if(c>0&&Date.now()/1e3>c)return{valid:!0,plan:nt,watermark:!0,trialExpired:!0,originalPlan:a,error:`License expired on ${new Date(c*1e3).toLocaleDateString()}`,features:tt(nt)};let r=s.pl||"web";if((r==="web"||r==="any")&&o&&o!=="*"&&typeof window<"u"){let n=window.location.hostname;if(n&&n!=="localhost"&&n!=="127.0.0.1"&&n!=="0.0.0.0"&&n!==""&&!o.split(",").map(g=>g.trim()).some(g=>He(g,n)))return{valid:!1,error:`License not valid for domain: ${n}`}}if(r==="mobile"&&s.a&&typeof window<"u"){let n=window.__mrd_app_id;if(n&&n!==s.a)return{valid:!1,error:`License not valid for app: ${n}`}}return{valid:!0,plan:a,domain:o,platform:r,appId:s.a||null,expiry:c,watermark:!1,features:tt(a)}}catch{return{valid:!1,error:"Invalid license key"}}}function pe(t){let s="mrd-ce-hmac-2024-x9k2m",a=JSON.stringify(t),o=s+":"+a,c=2166136261,e=1818371886,i=3735928559;for(let r=0;r<o.length;r++){let n=o.charCodeAt(r);c=Math.imul(c^n,16777619)>>>0,e=Math.imul(e^n,1540483477)>>>0,i=Math.imul(i^n,461845907)>>>0}return(c.toString(36)+e.toString(36)+i.toString(36)).slice(0,24)}function Xe(){let t=Ye();t?Ze(t):(t=Math.floor(Date.now()/1e3),ze(t));let s=t+Fe*86400,a=Date.now()/1e3,o=Math.max(0,Math.ceil((s-a)/86400));return a>s?{valid:!0,plan:nt,watermark:!0,trialExpired:!0,daysLeft:0,features:tt(nt)}:{valid:!0,plan:re,watermark:!0,daysLeft:o,trialEnd:s,features:tt(re)}}function He(t,s){if(t==="*"||t===s)return!0;if(t.startsWith("*.")){let a=t.slice(1);return s.endsWith(a)||s===t.slice(2)}return!1}var Oe="MRD-Indicators",se="mrd-indicators.com",We="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAzMCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNCk7CiAgICAgIH0KCiAgICAgIC5jbHMtMiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMik7CiAgICAgIH0KCiAgICAgIC5jbHMtMiwgLmNscy0zLCAuY2xzLTQsIC5jbHMtNSwgLmNscy02IHsKICAgICAgICBtaXgtYmxlbmQtbW9kZTogbXVsdGlwbHk7CiAgICAgIH0KCiAgICAgIC5jbHMtMyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNik7CiAgICAgIH0KCiAgICAgIC5jbHMtNSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNSk7CiAgICAgIH0KCiAgICAgIC5jbHMtNiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQpOwogICAgICB9CgogICAgICAuY2xzLTggewogICAgICAgIGlzb2xhdGlvbjogaXNvbGF0ZTsKICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB4MT0iOS4xMiIgeTE9IjE1Ljg4IiB4Mj0iMTkuNjMiIHkyPSI1LjM3IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2IzNTA5ZSIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmNWE0YzciLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC0yIiB4MT0iOS4wOCIgeTE9IjYuODEiIHgyPSI5LjA4IiB5Mj0iMTQuNzMiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjMjM0ZmIzIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZmZiIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTMiIHgxPSIxNy42NyIgeTE9IjYuMTEiIHgyPSI4LjQxIiB5Mj0iNi4xMSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM1YTJhOGIiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNCIgeDE9IjIwLjAzIiB5MT0iMTUuODkiIHgyPSIxMC45OCIgeTI9IjE1Ljg5IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2Y2YWFjYiIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM3NzJhOGQiLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC01IiB4MT0iMTkuMDMiIHkxPSIxNi44MiIgeDI9IjE0Ljc5IiB5Mj0iMTIuNTgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2VkMzQ4ZCIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTYiIHgxPSIxNS4yNyIgeTE9IjE1LjA2IiB4Mj0iMTUuMjciIHkyPSIxOS4zNyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmYiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWU0YzliIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNyIgeDE9IjUuNTEiIHkxPSItMTI4LjAyIiB4Mj0iLTMuNyIgeTI9Ii0xMjguMDIiIGdyYWRpZW50VHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwOS4xMiAxMC4wMSkgcm90YXRlKDg5LjYpIiB4bGluazpocmVmPSIjbGluZWFyLWdyYWRpZW50LTMiLz4KICA8L2RlZnM+CiAgPGcgY2xhc3M9ImNscy04IiBpZD0iTG9nbyI+CiAgICA8ZyBpZD0iT0JKRUNUUyIgPgogICAgICA8ZyBpZCA9IkxvZ28iPiAKICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTciIGQ9Ik00LjIzLDExYzAsNS4zNiw0LjM3LDkuNzEsOS43Niw5LjcxczkuNzYtNC4zNSw5Ljc2LTkuNzFTMTkuMzksMS4yOSwxNCwxLjI5LDQuMjMsNS42NCw0LjIzLDExWk0xMC4yNiwxMC4wN2MwLTEuNTQsMS4yNS0yLjc4LDIuOC0yLjc4aDEuODdjMS41NSwwLDIuOCwxLjI1LDIuOCwyLjc4djEuODZjMCwxLjU0LTEuMjUsMi43OC0yLjgsMi43OGgtMS4yMmMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NHYtNi45MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik0xMC4yNiwxNi45OXYtNi45MnMwLS4wMiwwLS4wM2MuMDItMS41MiwxLjI2LTIuNzUsMi44LTIuNzVoLTUuMDljLTIuMDUsMC0zLjczLDEuNjQtMy43NCwzLjY4LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA4LDAsLjE2LDAsLjI0LDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA2LDAsLjExLjAxLjE3LDAsLjAyLDAsLjA1LDAsLjA3LDAsLjA2LjAxLjEzLjAyLjE5LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA3LjAxLjE0LjAyLjIxLDAsMCwwLC4wMSwwLC4wMiwwLC4wNy4wMi4xNS4wMy4yMiwwLDAsMCwwLDAsMCwuNjgsNC42OCw0LjcxLDguMjcsOS42LDguMy0yLjA0LS4wMi0zLjY3LTEuNjktMy42Ny0zLjcyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTE0LjA0LDEuMjlzLS4wMywwLS4wNCwwYy0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTMuMDEtLjE5LjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNywwLS4xNC4wMS0uMjEuMDIsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNS4wMi0uMjIuMDMsMCwwLDAsMCwwLDAtNC43LjY4LTguMzIsNC42OS04LjM1LDkuNTQuMDItMi4wMiwxLjctMy42NSwzLjc0LTMuNjVoNi45NnMuMDIsMCwuMDMsMGMxLjUzLjAyLDIuNzcsMS4yNiwyLjc3LDIuNzh2LTUuMDZjMC0yLjA0LTEuNjUtMy43MS0zLjctMy43MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNC45MywxNC43MWg1LjA5YzIuMDQsMCwzLjcyLTEuNjMsMy43NC0zLjY1LS4wMyw0Ljg2LTMuNjUsOC44Ny04LjM1LDkuNTQsMCwwLDAsMCwwLDAtLjA3LjAxLS4xNS4wMi0uMjIuMDMsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNC4wMi0uMjEuMDItLjAxLDAtLjAzLDAtLjA0LDAtLjA2LDAtLjEzLjAxLS4xOS4wMi0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDEsMC0uMDMsMC0uMDQsMC0yLjA1LDAtMy43LTEuNjgtMy43LTMuNzJsMi4yMy0xLjg0Yy4zNC0uMjguNzgtLjQ0LDEuMjItLjQ0aDEuMjJaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy01IiBkPSJNMTQuOTMsMTQuNzFoNS4wOWMyLjA0LDAsMy43Mi0xLjYzLDMuNzQtMy42NS0uMDMsNC44Ni0zLjY1LDguODctOC4zNSw5LjU0LDAsMCwwLDAsMCwwLS4wNy4wMS0uMTUuMDItLjIyLjAzLDAsMC0uMDEsMC0uMDIsMC0uMDcsMC0uMTQuMDItLjIxLjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNiwwLS4xMy4wMS0uMTkuMDItLjAyLDAtLjA1LDAtLjA3LDAtLjA2LDAtLjExLDAtLjE3LDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA4LDAtLjE2LDAtLjI0LDAtLjAxLDAtLjAzLDAtLjA0LDAtMi4wNSwwLTMuNy0xLjY4LTMuNy0zLjcybDIuMjMtMS44NGMuMzQtLjI4Ljc4LS40NCwxLjIyLS40NGgxLjIyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtNCIgZD0iTTIwLjI4LDE0LjcxYy0uMDgsMC0uMTcsMC0uMjUsMGgtNi4zMWMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NGMwLC4wOCwwLC4xNywwLC4yNSwxLjA5LjY1LDIuMzcsMS4wMiwzLjczLDEuMDIsMi42NywwLDUuMDEtMS40Myw2LjI4LTMuNTVaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy02IiBkPSJNMjMuNzcsMTAuOTdzMC0uMDMsMC0uMDRjMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEtLjAxLS4xNywwLS4wMiwwLS4wNSwwLS4wNywwLS4wNi0uMDEtLjEzLS4wMi0uMTksMC0uMDEsMC0uMDMsMC0uMDQsMC0uMDctLjAyLS4xNC0uMDItLjIxLDAsMCwwLS4wMSwwLS4wMiwwLS4wNy0uMDItLjE1LS4wMy0uMjIsMCwwLDAsMCwwLDAtLjcxLTQuNjctNC43Ny04LjI0LTkuNjYtOC4yNCwyLjA0LDAsMy42OCwxLjY2LDMuNywzLjY5bC4wNCw1LjA2djEuODZzLjAxLjAyLjAxLjAzYzAsMS41Mi0xLjI1LDIuNzYtMi43OCwyLjc3bDUuMDktLjA0YzIuMDUtLjAxLDMuNzItMS42NiwzLjcxLTMuN1oiLz4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+",Nt=null,ae=!1;function we(){if(Nt||ae)return Nt;ae=!0;let t=new Image;return t.onload=()=>{Nt=t},t.src=We,null}function Be(){return Math.floor(Date.now()/864e5)}function Ve(t){let s=(t^2654435769)>>>0;return function(){s=s+1831565813>>>0;let a=Math.imul(s^s>>>15,1|s);return a=a+Math.imul(a^a>>>7,61|a)^a,((a^a>>>14)>>>0)/4294967296}}function Ge(t,s,a,o,c,e){let i=we();t.save(),t.setTransform(1,0,0,1,0,0),t.font="bold 10px Inter, system-ui, sans-serif";let r=t.measureText(o);t.font="8px Inter, system-ui, sans-serif";let n=t.measureText(c),u=i?18:0,l=i?14:0,g=7,f=5,d=i?5:0,h=u+d+Math.max(r.width,n.width)+g*2,p=Math.max(l,20)+f*2,w=Math.round(s-h/2),M=Math.round(a-p/2);t.globalAlpha=.45,t.fillStyle=e?"rgba(255,255,255,0.8)":"rgba(18,18,28,0.8)",t.shadowColor=e?"rgba(0,0,0,0.06)":"rgba(0,0,0,0.25)",t.shadowBlur=8,t.shadowOffsetY=1,t.beginPath(),t.roundRect(w,M,h,p,6),t.fill(),t.shadowColor="transparent",t.strokeStyle=e?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)",t.lineWidth=.5,t.stroke();let S=w+g,C=M+p/2;i&&(t.globalAlpha=.5,t.drawImage(i,S,C-l/2,u,l),S+=u+d),t.globalAlpha=.5,t.font="bold 10px Inter, system-ui, sans-serif",t.fillStyle=e?"#1a1a2e":"#ededf5",t.textAlign="left",t.textBaseline="alphabetic",t.fillText(o,S,C-1),t.font="8px Inter, system-ui, sans-serif",t.fillStyle=e?"#777790":"#8080a0",t.textBaseline="top",t.fillText(c,S,C+2),t.restore()}function ge(t,s,a,o){we();let c=s.width,e=s.height;if(c<100||e<80)return;t.save(),t.setTransform(1,0,0,1,0,0);let i=Ve(Be()),r=100,n=Math.max(c-r*2,60),u=Math.max(e-r*2,40),l=r+i()*n,g=r+i()*u,f=a.trialExpired||a.plan===nt,d=Oe,_=f?`Free \u2014 ${se}/pricing`:`Trial: ${a.daysLeft||0}d left \u2014 ${se}`;Ge(t,l,g,d,_,o),t.restore()}function qe({plan:t,domain:s="*",expiryDays:a=365,name:o,email:c}){let e=a>0?Math.floor(Date.now()/1e3)+a*86400:0,i={p:t,d:s,e,...o?{n:o}:{},...c?{m:c}:{},i:Date.now()};return i.s=pe(i),btoa(JSON.stringify(i))}var Mt=null,Ht=null,ft=null;async function me(){return Mt||ft||(ft=(async()=>{let t=await import("./chart_engine.js");return await t.default(),Ht=t.wasm_memory(),Mt=t,t})(),ft)}function Ke(){!Mt&&!ft&&me().catch(()=>{})}async function Qe(t,s={}){s.appId&&typeof window<"u"&&(window.__mrd_app_id=s.appId);let a=s.licenseKey||s.key||null,o=mt(a);if(!o.valid)if(o.expired)console.warn(`[MRD Chart Engine] ${o.error}. Get a license at https://mrd-chart.dev/pricing`);else throw new Error(`[MRD Chart Engine] ${o.error}`);o.plan==="trial"&&console.info(`[MRD Chart Engine] Trial mode \u2014 ${o.daysLeft} days remaining. Purchase: https://mrd-chart.dev/pricing`);let c=await me(),e=window.devicePixelRatio||1,i=t.getBoundingClientRect();(i.width<1||i.height<1)&&(await new Promise(m=>{let L=new ResizeObserver(I=>{for(let v of I)if(v.contentRect.width>0&&v.contentRect.height>0){L.disconnect(),m();return}});L.observe(t.parentElement||t),setTimeout(()=>{L.disconnect(),m()},2e3)}),i=t.getBoundingClientRect());let r=Math.max(i.width,100),n=Math.max(i.height,100);t.width=r*e,t.height=n*e;let u=t.getContext("2d");u.scale(e,e);let l=new c.ChartEngine(r,n);try{let m=o.expired?2:o.watermark?1:0,L=o.daysLeft||0,I=1297237059;I=Math.imul(I,31)+m>>>0,I=Math.imul(I,31)+L>>>0,I=(I^I>>>16)>>>0,I=Math.imul(I,73244475)>>>0,I=(I^I>>>16)>>>0,l.set_license_state(m,L,I)}catch(m){console.warn("[MRD] set_license_state failed:",m.message)}let g=!0,f=null,d=!1,_=!1,h=!1,p=null,w=null,M=0,S=!1,C=!1,Q=("ontouchstart"in window||navigator.maxTouchPoints>0)&&window.innerWidth<=1399?33:0;function G(){if(!(!d||_||f)){if(Q>0){let m=performance.now()-M;if(m<Q){w||(w=setTimeout(()=>{w=null,G()},Q-m));return}}f=requestAnimationFrame(Se)}}let T=()=>{g=!0,G()},U=()=>h,$=null,dt=null,Lt=null,b=null,D=null,X=null,z=null,Z=null,ot=0,J=null,Ot=null,St=0,It=0,x=-1,_t=!1,ct=!1,Me=bt(t,l,{onDirty:T,onCrosshairMove:(m,L,I)=>{St=m,It=L,x=I,_t=!0,ct=!0},onCrosshairHide:()=>{ct&&(ct=!1,_t=!0,x=-1)},drawingApi:m=>{$=m},onDrawingComplete:()=>{dt?.()},onDrawingCancel:()=>{Lt?.()},onDrawingSelected:(m,L,I)=>{b?.(m,L,I)},onMarkerSelected:m=>{D?.(m)},onDrawingDblClick:(m,L,I,v,Ct)=>{X?.(m,L,I,v,Ct)},onVrvpHover:(m,L)=>{z?.(m,L)},onLiqAnnotationPin:(m,L)=>{Ot?.(m,L)}});function Le(){if(!(!_t||C)){if(_t=!1,!ct){p&&p(null,0,0),Z&&Z("");return}if(p)if(x===0||x===1)try{let m=l.get_tooltip_data();p(m,St,It)}catch{}else p(null,0,0);if(Z){let m=performance.now();if(x===0||x===1){if(m-ot>=80){ot=m;try{Z(l.lt_hit_test(St,It))}catch{}}}else Z("")}}}function Se(){if(f=null,!(!d||_||C)){S=!0;try{let m=!1;try{m=g||l.is_dirty()}catch{C=!0;return}if(m){g=!1,M=performance.now();let L=!1;try{if(l.render()>0){let v=l.get_command_buffer_ptr(),Ct=l.get_command_buffer_len();u.save(),u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,t.width,t.height),u.restore(),pt(u,Ht,v,Ct),L=!0}try{K.renderAll(u)}catch{}}catch(I){if(L||(g=!0),I instanceof WebAssembly.RuntimeError){C=!0,console.error("[MRD] Engine crashed:",I.message);return}}Le();try{J?.()}catch{}if(o.watermark)try{let I=l.get_theme()===1;ge(u,t,o,I)}catch{}try{(g||l.is_dirty())&&G()}catch{}}}finally{S=!1}}}let st=Et(o.plan),Ie=xt(l,T,U,()=>st),Ce=kt(l,T,U,()=>st),Ae=te(l,T,U,()=>st),K=yt(l,Ht,pt);return{engine:l,start(){d=!0,_=!1,g=!0,G()},stop(){d=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null)},resize(m){if(C||S)return;if(i=t.getBoundingClientRect(),i.width<1||i.height<1){(m||0)<8&&setTimeout(()=>this.resize((m||0)+1),250);return}e=window.devicePixelRatio||1;let L=i.width*e,I=i.height*e;t.width=L,t.height=I,u.setTransform(1,0,0,1,0,0),u.scale(e,e);try{l.resize(i.width,i.height)}catch(v){if(v instanceof WebAssembly.RuntimeError){C=!0;return}throw v}T()},setHoverPrice(m){l.set_hover_price(m),T()},clearHoverPrice(){l.clear_hover_price(),T()},hitZone(m,L){return l.hit_zone(m,L)},startDrawing(m,L){$?.setMode(m,L)},cancelDrawing(){$?.setMode(null)},onDrawingComplete(m){dt=m},onDrawingCancel(m){Lt=m},onDrawingSelected(m){b=m},onMarkerSelected(m){D=m},onDrawingDblClick(m){X=m},setReplayState(m,L,I){l.set_replay_state(m,L,I),T()},setReplayHovered(m){l.set_replay_hovered(m)},setReplayPreview(m){l.set_replay_preview(m),T()},setPrecision(m){l.set_price_precision(m),T()},setCandleInterval(m){l.set_candle_interval(m)},setTheme(m){let L=m==="light"?1:0;typeof l.set_theme=="function"?(l.set_theme(L),T()):console.warn("[ChartEngine] set_theme not available \u2014 reload page to load updated WASM")},getTheme(){return l.get_theme()===1?"light":"dark"},onTooltip(m){p=m},onVrvpHover(m){z=m},onLtHover(m){Z=m},onPostRender(m){J=m},onLiqAnnotationPin(m){Ot=m},pause(){_||(_=!0,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null))},resume(){_&&(_=!1,d&&(g=!0,G()))},get isPaused(){return _},destroy(){h=!0,d=!1,_=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null),Me();try{l.free()}catch{}},addIndicator(m){if(!st("customIndicators"))return null;let L=K.add(m);return T(),L},removeIndicator(m){K.remove(m),T()},updateIndicatorParams(m,L){K.updateParams(m,L),T()},setIndicatorEnabled(m,L){K.setEnabled(m,L),T()},listIndicators(){return K.list()},invalidateCustomIndicators(){K.invalidateCompute(),T()},get license(){return{plan:o.plan,valid:o.valid,expired:!!o.expired,watermark:!!o.watermark,daysLeft:o.daysLeft,features:o.features||{}}},setLicenseKey(m){o=mt(m),!o.valid&&!o.expired&&console.error(`[MRD Chart Engine] ${o.error}`),st=Et(o.plan);try{let L=o.expired?2:o.watermark?1:0,I=o.daysLeft||0,v=1297237059;v=Math.imul(v,31)+L>>>0,v=Math.imul(v,31)+I>>>0,v=(v^v>>>16)>>>0,v=Math.imul(v,73244475)>>>0,v=(v^v>>>16)>>>0,l.set_license_state(L,I,v)}catch{}return T(),o.valid},...Ae,...Ie,...Ce}}export{Qe as createChartBridge,yt as createCustomIndicatorManager,pt as dispatchCommands,qe as generateLicenseKey,Ke as prefetchWasm,bt as setupEvents,mt as validateLicense};
|
|
1
|
+
var P={FILL_RECT:1,STROKE_RECT:2,LINE:3,DASHED_LINE:4,POLYLINE:5,TEXT:6,CIRCLE:7,TRIANGLE:8,SAVE:9,RESTORE:10,CLIP_RECT:11,ROTATED_TEXT:12,BUBBLE_3D:13,FILL_POLYGON:14,DASHED_POLYLINE:15,END_FRAME:255},Te=["left","center","right"],wt=new Map,Ee=4096;function ye(t,o,i,s){return t<<24|o<<16|i<<8|s}function Y(t,o,i,s){let p=ye(t,o,i,s),e=wt.get(p);return e||(e=`rgba(${t},${o},${i},${(s/255).toFixed(3)})`,wt.size>=Ee&&wt.clear(),wt.set(p,e),e)}var Vt=new TextDecoder;function nt(t,o,i,s){let p=o.buffer;if(i+s>p.byteLength)return;let e=new DataView(p,i,s),n=new Uint8Array(p,i,s),r=0,a="",u="",l=-1,g="";for(;r<s;){let f=n[r];if(r+=1,f===P.END_FRAME)break;switch(f){case P.FILL_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4,w!==a&&(t.fillStyle=w,a=w),t.fillRect(d,_,c,h);break}case P.STROKE_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4,w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.strokeRect(d,_,c,h);break}case P.LINE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4,t.beginPath(),w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.setLineDash([]),t.moveTo(d,_),t.lineTo(c,h),t.stroke();break}case P.DASHED_LINE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4;let L=e.getFloat32(r,!0);r+=4;let S=e.getFloat32(r,!0);r+=4,t.beginPath(),w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.setLineDash([L,S]),t.moveTo(d,_),t.lineTo(c,h),t.stroke(),t.setLineDash([]);break}case P.POLYLINE:{let d=e.getUint16(r,!0);r+=2;let _=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let c=e.getFloat32(r,!0);if(r+=4,d>0){let h=new Float32Array(d*2);for(let w=0;w<d;w++)h[w*2]=e.getFloat32(r,!0),r+=4,h[w*2+1]=e.getFloat32(r,!0),r+=4;if(t.beginPath(),_!==u&&(t.strokeStyle=_,u=_),c!==l&&(t.lineWidth=c,l=c),t.setLineDash([]),t.lineJoin="round",t.lineCap="round",d<=3){t.moveTo(h[0],h[1]);for(let w=1;w<d;w++)t.lineTo(h[w*2],h[w*2+1])}else{t.moveTo(h[0],h[1]),t.lineTo((h[0]+h[2])*.5,(h[1]+h[3])*.5);for(let w=1;w<d-1;w++){let m=h[w*2],L=h[w*2+1],S=h[(w+1)*2],C=h[(w+1)*2+1];t.quadraticCurveTo(m,L,(m+S)*.5,(L+C)*.5)}t.lineTo(h[(d-1)*2],h[(d-1)*2+1])}t.stroke()}break}case P.TEXT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=n[r];r+=1;let m=e.getUint16(r,!0);r+=2;let L=Vt.decode(new Uint8Array(o.buffer,i+r,m));r+=m,c!==a&&(t.fillStyle=c,a=c);let S=`${h}px "IBM Plex Mono",monospace`;S!==g&&(t.font=S,g=S),t.textAlign=Te[w]||"left",t.textBaseline="middle",t.fillText(L,d,_);break}case P.CIRCLE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let w=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let m=e.getFloat32(r,!0);r+=4,t.beginPath(),t.arc(d,_,c,0,Math.PI*2),h!==a&&(t.fillStyle=h,a=h),t.fill(),m>0&&(w!==u&&(t.strokeStyle=w,u=w),m!==l&&(t.lineWidth=m,l=m),t.stroke());break}case P.TRIANGLE:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);r+=4;let m=e.getFloat32(r,!0);r+=4;let L=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4,t.beginPath(),t.moveTo(d,_),t.lineTo(c,h),t.lineTo(w,m),t.closePath(),L!==a&&(t.fillStyle=L,a=L),t.fill();break}case P.SAVE:{t.save();break}case P.RESTORE:{t.restore(),a="",u="",l=-1,g="";break}case P.CLIP_RECT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4,t.beginPath(),t.rect(d,_,c,h),t.clip();break}case P.ROTATED_TEXT:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);r+=4;let m=e.getUint16(r,!0);r+=2;let L=Vt.decode(n.subarray(r,r+m));r+=m;let S=`${h}px sans-serif`;S!==g&&(t.font=S,g=S),c!==a&&(t.fillStyle=c,a=c),t.textAlign="center",t.textBaseline="middle",t.save(),t.translate(d,_),t.rotate(w),t.fillText(L,0,0),t.restore();break}case P.BUBBLE_3D:{let d=e.getFloat32(r,!0);r+=4;let _=e.getFloat32(r,!0);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=n[r],w=n[r+1],m=n[r+2],L=n[r+3];r+=4;let S=n[r],C=n[r+1],N=n[r+2],U=n[r+3];r+=4;let T=n[r],x=n[r+1],$=n[r+2],ct=n[r+3];r+=4;let It=e.getFloat32(r,!0);r+=4;let E=c;if(E<10){let Z=`rgba(${h},${w},${m},${(L/255).toFixed(3)})`;t.beginPath(),t.arc(d,_,E,0,Math.PI*2),t.fillStyle=Z,t.fill(),a=""}else if(E<18){let Z=d-E*.25,W=_-E*.25,H=t.createRadialGradient(Z,W,E*.08,d,_,E);H.addColorStop(0,`rgba(${S},${C},${N},${(U/255).toFixed(3)})`),H.addColorStop(1,`rgba(${h},${w},${m},${(L/255).toFixed(3)})`),t.beginPath(),t.arc(d,_,E,0,Math.PI*2),t.fillStyle=H,t.fill(),a=""}else{let Z=d-E*.25,W=_-E*.25,H=t.createRadialGradient(d,_,E*.85,d,_,E*1.2);H.addColorStop(0,`rgba(${T},${x},${$},${(ct/255*.5).toFixed(3)})`),H.addColorStop(1,`rgba(${T},${x},${$},0)`),t.beginPath(),t.arc(d,_,E*1.2,0,Math.PI*2),t.fillStyle=H,t.fill();let O=t.createRadialGradient(Z,W,E*.08,d,_,E);O.addColorStop(0,`rgba(${S},${C},${N},${(U/255).toFixed(3)})`),O.addColorStop(1,`rgba(${h},${w},${m},${(L/255).toFixed(3)})`),t.beginPath(),t.arc(d,_,E,0,Math.PI*2),t.fillStyle=O,t.fill();let st=E*.2,J=t.createRadialGradient(Z,W,0,Z,W,st);J.addColorStop(0,"rgba(255,255,255,0.22)"),J.addColorStop(1,"rgba(255,255,255,0)"),t.beginPath(),t.arc(Z,W,st,0,Math.PI*2),t.fillStyle=J,t.fill(),a=""}break}case P.FILL_POLYGON:{let d=e.getUint16(r,!0);r+=2;let _=Y(n[r],n[r+1],n[r+2],n[r+3]);if(r+=4,d>2){t.beginPath();let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4,t.moveTo(c,h);for(let w=1;w<d;w++)t.lineTo(e.getFloat32(r,!0),e.getFloat32(r+4,!0)),r+=8;t.closePath(),_!==a&&(t.fillStyle=_,a=_),t.fill()}else r+=d*8;break}case P.DASHED_POLYLINE:{let d=e.getUint16(r,!0);r+=2;let _=Y(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let c=e.getFloat32(r,!0);r+=4;let h=e.getFloat32(r,!0);r+=4;let w=e.getFloat32(r,!0);if(r+=4,d>1){t.beginPath(),_!==u&&(t.strokeStyle=_,u=_),c!==l&&(t.lineWidth=c,l=c),t.setLineDash([h,w]),t.lineJoin="round";let m=e.getFloat32(r,!0);r+=4;let L=e.getFloat32(r,!0);r+=4,t.moveTo(m,L);for(let S=1;S<d;S++)t.lineTo(e.getFloat32(r,!0),e.getFloat32(r+4,!0)),r+=8;t.stroke(),t.setLineDash([])}else r+=d*8;break}default:return}}}var z={trendline:{type:"2point",previewKind:0,addFn:"add_trendline"},arrow:{type:"2point",previewKind:4,addFn:"add_arrow"},measure:{type:"2point",previewKind:2,addFn:"add_price_range"},fib:{type:"2point",previewKind:3,addFn:"add_fib_retracement"},long:{type:"2point",previewKind:5,addFn:"add_long_position"},short:{type:"2point",previewKind:5,addFn:"add_short_position"},hline:{type:"1point_xp",previewKind:1,addFn:"add_horizontal_line"},vwap:{type:"1point_x",previewKind:6,addFn:"add_anchored_vwap"},pricelabel:{type:"1point_xy",previewKind:7,addFn:"add_price_label"},circle:{type:"2point",previewKind:8,addFn:"add_circle"},arrowup:{type:"1point_xy",previewKind:9,addFn:"add_arrow_marker_up"},arrowdown:{type:"1point_xy",previewKind:10,addFn:"add_arrow_marker_down"},textnote:{type:"1point_xy",previewKind:11,addFn:"add_text_note"},channel:{type:"3point",previewKind:0,addFn:"add_parallel_channel"},fibext:{type:"3point",previewKind:0,addFn:"add_fib_extension",previewFn:"fib_ext"},brush:{type:"freehand"},path:{type:"npoint"},elliott:{type:"elliott_manual"},elliottauto:{type:"1point_xy",previewKind:12,addFn:"add_elliott_impulse",previewFn:"elliott"}};function at(t){return z[t]?.type==="2point"}function lt(t){return z[t]?.type==="3point"}function tt(t){let o=z[t]?.type;return o==="1point"||o==="1point_x"||o==="1point_xy"||o==="1point_xp"}function gt(t){return z[t]?.type==="freehand"}function V(t){return z[t]?.type==="npoint"}function B(t){return z[t]?.type==="elliott_manual"}var Bt={r:.04,g:.49,b:1,lineWidth:2,dashed:!1,fontSize:12};function G(t,o,i,s,p,e){e=e||Bt;let n=z[o];if(!n)return 0;let r=0;return n.type==="3point"?r=t[n.addFn](i.x1,i.y1,i.x2,i.y2,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="2point"?r=t[n.addFn](i.x1,i.y1,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="1point_x"?r=t[n.addFn](s,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="1point_xp"?r=t[n.addFn](s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane):n.type==="1point_xy"?r=t[n.addFn](s,p,e.r,e.g,e.b,e.fontSize||12,i.pane):r=t[n.addFn](p,e.r,e.g,e.b,e.lineWidth,e.dashed,i.pane),r||0}function D(t,o,i,s,p,e,n){e=e||Bt;let r=z[o];if(r){if(r.previewFn==="elliott"){t.set_elliott_preview(s,p,e.r,e.g,e.b,e.lineWidth,n);return}r.type==="3point"?i.step===1?t.set_drawing_preview(r.previewKind,i.x1,i.y1,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n):i.step===2&&(r.previewFn==="fib_ext"?t.set_fib_ext_preview(i.x1,i.y1,i.x2,i.y2,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n):t.set_channel_preview(i.x1,i.y1,i.x2,i.y2,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n)):r.type==="2point"?t.set_drawing_preview(r.previewKind,i.x1,i.y1,s,p,e.r,e.g,e.b,e.lineWidth,e.dashed,n):r.type==="1point_x"?t.set_drawing_preview(r.previewKind,s,0,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,n):r.type==="1point_xp"||r.type==="1point_xy"?t.set_drawing_preview(r.previewKind,s,p,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,n):t.set_drawing_preview(r.previewKind,0,p,0,0,e.r,e.g,e.b,e.lineWidth,e.dashed,n)}}function v(t,o,i,s){let p=t.screen_to_world_x(o),e;switch(s){case 1:e=t.screen_to_rsi_y(i);break;case 2:e=t.screen_to_oi_y(i);break;case 3:e=t.screen_to_fr_y(i);break;case 4:e=t.screen_to_cvd_y(i);break;case 5:e=t.screen_to_vpin_y(i);break;default:e=t.screen_to_world_y(i);break}return{wx:p,wy:e}}function X(t){return t===4?1:t===6?2:t===8?3:t===10?4:t===12?5:0}function F(t){return t===0||t===4||t===6||t===8||t===10||t===12}function $t(t,o,i,s){t.addEventListener("wheel",r=>{if(s.disposed)return;r.preventDefault(),s.cancelMomentum();let a=r.deltaY>0?1.1:.9,u=o.hit_zone(r.offsetX,r.offsetY);r.ctrlKey?o.zoom_y(r.offsetY,a):r.shiftKey||u===2?o.zoom_x(r.offsetX,a):u===3?o.zoom_y(r.offsetY,a):o.zoom(r.offsetX,r.offsetY,a),i.onDirty()},{passive:!1}),t.addEventListener("mousedown",r=>{if(s.disposed||r.button!==0)return;s.cancelMomentum(),e();let a=performance.now();if(a-s.lastClickTime<300){s.lastClickTime=a;return}s.lastClickTime=a;let u=s.drawingMode;if(u){let g=o.hit_zone(r.offsetX,r.offsetY);if(!F(g))return;let f=X(g),{wx:d,wy:_}=v(o,r.offsetX,r.offsetY,f),c=u.style,h=u.tool;if(B(h)){if(!u.pathStarted)u.pane=f,o.start_elliott_manual(c.r,c.g,c.b,c.lineWidth,f),o.add_elliott_manual_point(d,_),u.pathStarted=!0,u.step=1;else if(o.add_elliott_manual_point(d,_)){s.finishDrawing(),i.onDirty();return}}else if(V(h))u.pathStarted?o.add_path_point(d,_):(u.pane=f,o.start_path(c.r,c.g,c.b,c.lineWidth,c.dashed,f),o.add_path_point(d,_),u.pathStarted=!0,u.step=1);else if(gt(h))u.pane=f,o.start_brush(c.r,c.g,c.b,c.lineWidth,f),o.add_brush_point(d,_),s.isBrushing=!0;else if(lt(h))if(u.step===0)u.x1=d,u.y1=_,u.pane=f,u.step=1;else if(u.step===1)u.x2=d,u.y2=_,u.step=2,o.clear_drawing_preview();else{let w=z[h];w&&w.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),G(o,h,u,d,_,c),s.finishDrawing()}else if(at(h))u.step===0?(u.x1=d,u.y1=_,u.pane=f,u.step=1):(G(o,h,u,d,_,c),s.finishDrawing());else{u.pane=f;let w=G(o,h,u,d,_,c);s.finishDrawing(),h==="textnote"&&w>0&&(o.select_drawing(w),i.onDrawingSelected?.(w),i.onDrawingDblClick?.(w,r.offsetX,r.offsetY,r.clientX,r.clientY))}i.onDirty();return}let l=o.hit_zone(r.offsetX,r.offsetY);if(l===5){s.isResizingRsi=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_rsi_ratio(),t.style.cursor="ns-resize";return}if(l===7){s.isResizingOi=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_oi_ratio(),t.style.cursor="ns-resize";return}if(l===9){s.isResizingFr=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_fr_ratio(),t.style.cursor="ns-resize";return}if(l===11){s.isResizingCvd=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_cvd_ratio(),t.style.cursor="ns-resize";return}if(l===13){s.isResizingVpin=!0,s.resizeStartY=r.offsetY,s.resizeStartRatio=o.get_vpin_ratio(),t.style.cursor="ns-resize";return}if(F(l)){let g=o.get_selected_drawing();if(g>0){let h=o.hit_test_drawing_anchor(r.offsetX,r.offsetY);if(h>=0){s.isDraggingAnchor=!0,s.dragAnchorIdx=h,s.dragAnchorPane=X(l),t.style.cursor="grabbing";return}if(o.hit_test_drawing(r.offsetX,r.offsetY)===g){s.isDraggingDrawing=!0,s.dragDrawingPane=X(l);let{wx:m,wy:L}=v(o,r.offsetX,r.offsetY,s.dragDrawingPane);s.dragDrawingLastWx=m,s.dragDrawingLastWy=L,t.style.cursor="move";return}}let f=o.hit_test_drawing(r.offsetX,r.offsetY);if(f>0){o.deselect_marker(),i.onMarkerSelected?.(0),o.select_drawing(f),i.onDrawingSelected?.(f),i.onDirty();return}let d=o.hit_test_marker(r.offsetX,r.offsetY);if(d>0){o.deselect_drawing(),i.onDrawingSelected?.(0),o.select_marker(d),i.onMarkerSelected?.(d),i.onDirty();return}let _=o.get_selected_drawing(),c=o.get_selected_marker();_>0&&(o.deselect_drawing(),i.onDrawingSelected?.(0),i.onDirty()),c>0&&(o.deselect_marker(),i.onMarkerSelected?.(0),i.onDirty())}F(l)&&(s.liqPinSx=r.offsetX,s.liqPinSy=r.offsetY,s.liqPinTimer&&clearTimeout(s.liqPinTimer),s.liqPinTimer=setTimeout(()=>{s.liqPinTimer=null,i.onLiqAnnotationPin?.(s.liqPinSx,s.liqPinSy)},700)),s.isDragging=!0,s.dragZone=l,s.lastX=r.offsetX,s.lastY=r.offsetY,l===2?t.style.cursor="ew-resize":l===3?t.style.cursor="ns-resize":t.style.cursor="grabbing"});let p=null;function e(){p&&(cancelAnimationFrame(p),p=null)}function n(r,a){let u=o.hover_hit_test(r,a),l=u[0],g=u[1],f=u[2],d=u[3],_=u[4],c=s.drawingMode;l===2?(t.style.cursor="ew-resize",o.hide_crosshair()):l===3?(t.style.cursor="ns-resize",o.hide_crosshair()):(o.set_crosshair(r,a),l===5||l===7||l===9||l===11||l===13?t.style.cursor="ns-resize":!c&&F(l)&&g>0&&f>=0?t.style.cursor="grab":!c&&F(l)&&g>0&&d===g?t.style.cursor="move":!c&&F(l)&&(d>0||_>0)?t.style.cursor="pointer":t.style.cursor="crosshair"),i.onDirty(),i.onCrosshairMove?.(r,a,l),i.onVrvpHover?.(r,a)}t.addEventListener("mousemove",r=>{if(s.disposed)return;if(s.liqPinTimer){let u=Math.abs(r.offsetX-s.liqPinSx),l=Math.abs(r.offsetY-s.liqPinSy);(u>6||l>6)&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null)}if(s.isResizingRsi){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_rsi_ratio(d),i.onDirty();return}if(s.isResizingOi){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_oi_ratio(d),i.onDirty();return}if(s.isResizingFr){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_fr_ratio(d),i.onDirty();return}if(s.isResizingCvd){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_cvd_ratio(d),i.onDirty();return}if(s.isResizingVpin){let l=t.getBoundingClientRect().height-28,f=(s.resizeStartY-r.offsetY)/l,d=Math.max(.05,Math.min(.5,s.resizeStartRatio+f));o.set_vpin_ratio(d),i.onDirty();return}if(s.isDraggingAnchor){let{wx:u,wy:l}=v(o,r.offsetX,r.offsetY,s.dragAnchorPane);o.update_drawing_anchor(s.dragAnchorIdx,u,l),o.set_crosshair(r.offsetX,r.offsetY),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}if(s.isDraggingDrawing){let{wx:u,wy:l}=v(o,r.offsetX,r.offsetY,s.dragDrawingPane),g=u-s.dragDrawingLastWx,f=l-s.dragDrawingLastWy;o.move_drawing(g,f),s.dragDrawingLastWx=u,s.dragDrawingLastWy=l,o.set_crosshair(r.offsetX,r.offsetY),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}let a=s.drawingMode;if(s.isBrushing&&a){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);o.add_brush_point(l,g),o.set_crosshair(r.offsetX,r.offsetY),i.onDirty();return}if(a&&B(a.tool)&&a.pathStarted){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);o.set_elliott_manual_cursor(l,g),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(a&&V(a.tool)&&a.pathStarted){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);o.set_path_cursor(l,g),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(a&&a.step>0){let u=a.pane||0,{wx:l,wy:g}=v(o,r.offsetX,r.offsetY,u);D(o,a.tool,a,l,g,a.style,u),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(a&&tt(a.tool)){let u=o.hit_zone(r.offsetX,r.offsetY),l=X(u),{wx:g,wy:f}=v(o,r.offsetX,r.offsetY,l);D(o,a.tool,a,g,f,a.style,l),o.set_crosshair(r.offsetX,r.offsetY),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,u);return}if(s.isDragging){let u=r.offsetX-s.lastX,l=r.offsetY-s.lastY;s.lastX=r.offsetX,s.lastY=r.offsetY,s.dragZone===2?o.pan_x(u):s.dragZone===3?o.pan_y(l):o.pan(u,l),i.onDirty(),i.onCrosshairMove?.(r.offsetX,r.offsetY,s.dragZone),i.onVrvpHover?.(r.offsetX,r.offsetY);return}s._pendingHoverX=r.offsetX,s._pendingHoverY=r.offsetY,p||(p=requestAnimationFrame(()=>{p=null,s.disposed||n(s._pendingHoverX,s._pendingHoverY)}))}),t.addEventListener("mouseup",()=>{s.disposed||(s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isBrushing&&(s.isBrushing=!1,o.finish_brush(),s.finishDrawing(),i.onDirty()),s.isDragging=!1,s.isResizingRsi=!1,s.isResizingOi=!1,s.isResizingFr=!1,s.isResizingCvd=!1,s.isResizingVpin=!1,s.isDraggingAnchor=!1,s.isDraggingDrawing=!1,s.dragAnchorIdx=-1,t.style.cursor="crosshair")}),t.addEventListener("mouseleave",()=>{s.disposed||(e(),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isBrushing&&(s.isBrushing=!1,o.finish_brush(),s.finishDrawing()),s.isDragging=!1,s.isResizingRsi=!1,s.isResizingOi=!1,s.isResizingFr=!1,s.isResizingCvd=!1,s.isResizingVpin=!1,s.isDraggingAnchor=!1,s.isDraggingDrawing=!1,s.dragAnchorIdx=-1,o.hide_crosshair(),t.style.cursor="crosshair",i.onDirty(),i.onCrosshairHide?.(),i.onVrvpHover?.(null,null))}),t.addEventListener("dblclick",r=>{if(s.disposed)return;r.preventDefault(),r.stopPropagation();let a=s.drawingMode;if(a&&B(a.tool)&&a.pathStarted){o.finish_elliott_manual(),s.finishDrawing(),i.onDirty();return}if(a&&V(a.tool)&&a.pathStarted){o.finish_path(),s.finishDrawing(),i.onDirty();return}if(a)return;let u=o.hit_test_drawing(r.offsetX,r.offsetY);u>0&&(o.select_drawing(u),i.onDirty(),i.onDrawingDblClick?.(u,r.offsetX,r.offsetY,r.clientX,r.clientY))}),t.addEventListener("contextmenu",r=>{if(s.disposed)return;let a=s.drawingMode;if(a&&B(a.tool)&&a.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_elliott_manual(),s.finishDrawing(),i.onDirty();return}if(a&&V(a.tool)&&a.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_path(),s.finishDrawing(),i.onDirty();return}})}function Jt(t,o,i,s){t.addEventListener("touchstart",p=>{if(!s.disposed){if(p.preventDefault(),s.cancelMomentum(),p.touches.length===2){clearTimeout(s.longPressTimer),s.isCrosshairMode=!1;let e=t.getBoundingClientRect(),n=p.touches[1].clientX-p.touches[0].clientX,r=p.touches[1].clientY-p.touches[0].clientY;s.lastTouchDist=Math.sqrt(n*n+r*r),s.lastX=(p.touches[0].clientX+p.touches[1].clientX)/2-e.left,s.lastY=(p.touches[0].clientY+p.touches[1].clientY)/2-e.top,s.dragZone=o.hit_zone(s.lastX,s.lastY)}else if(p.touches.length===1){let e=t.getBoundingClientRect(),n=p.touches[0].clientX-e.left,r=p.touches[0].clientY-e.top;s.touchStartX=n,s.touchStartY=r,s.touchMoved=!1;let a=s.drawingMode;if(a){let d=o.hit_zone(n,r);if(F(d)){let _=X(d),{wx:c,wy:h}=v(o,n,r,_),w=a.tool;if(B(w)){if(!a.pathStarted)a.pane=_,o.start_elliott_manual(a.style.r,a.style.g,a.style.b,a.style.lineWidth,_),o.add_elliott_manual_point(c,h),a.pathStarted=!0,a.step=1;else if(o.add_elliott_manual_point(c,h)){s.finishDrawing(),i.onDirty();return}}else V(w)?a.pathStarted?o.add_path_point(c,h):(a.pane=_,o.start_path(a.style.r,a.style.g,a.style.b,a.style.lineWidth,a.style.dashed,_),o.add_path_point(c,h),a.pathStarted=!0,a.step=1):gt(w)?(a.pane=_,o.start_brush(a.style.r,a.style.g,a.style.b,a.style.lineWidth,_),o.add_brush_point(c,h),s.isBrushing=!0):lt(w)?a.step===0?(a.x1=c,a.y1=h,a.pane=_,a.step=1,a._stepAtTouchStart=0,D(o,w,a,c,h,a.style,_)):a.step===1?(a._stepAtTouchStart=1,D(o,w,a,c,h,a.style,a.pane)):(a._stepAtTouchStart=2,D(o,w,a,c,h,a.style,a.pane)):at(w)?a.step===0?(a.x1=c,a.y1=h,a.pane=_,a.step=1,a._stepAtTouchStart=0,D(o,w,a,c,h,a.style,_)):(a._stepAtTouchStart=1,D(o,w,a,c,h,a.style,a.pane)):tt(w)?(a.pane=_,D(o,w,a,c,h,a.style,_)):(a.pane=_,G(o,w,a,c,h,a.style),s.finishDrawing());o.set_crosshair(n,r),i.onDirty(),i.onCrosshairMove?.(n,r,d)}return}let u=o.hover_hit_test(n,r),l=u[0],g=u[1],f=u[2];if(F(l)&&!s.drawingMode&&g>0){if(f>=0){s.isDraggingAnchor=!0,s.dragAnchorIdx=f,s.dragAnchorPane=X(l);return}if(u[3]===g){s.isDraggingDrawing=!0,s.dragDrawingPane=X(l);let{wx:_,wy:c}=v(o,n,r,s.dragDrawingPane);s.dragDrawingLastWx=_,s.dragDrawingLastWy=c;return}}s.isDragging=!0,s.isCrosshairMode=!1,s.lastX=n,s.lastY=r,s.dragZone=l,clearTimeout(s.longPressTimer),s.longPressTimer=setTimeout(()=>{s.isDragging&&!s.touchMoved&&(s.isCrosshairMode=!0,o.set_crosshair(n,r),i.onDirty(),i.onCrosshairMove?.(n,r,s.dragZone),i.onVrvpHover?.(n,r))},300),F(s.dragZone)&&(s.liqPinSx=n,s.liqPinSy=r,s.liqPinTimer&&clearTimeout(s.liqPinTimer),s.liqPinTimer=setTimeout(()=>{s.liqPinTimer=null,s.touchMoved||i.onLiqAnnotationPin?.(s.liqPinSx,s.liqPinSy)},700))}}},{passive:!1}),t.addEventListener("touchmove",p=>{if(s.disposed)return;p.preventDefault();let e=t.getBoundingClientRect();if(s.isDraggingAnchor&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,{wx:u,wy:l}=v(o,r,a,s.dragAnchorPane);o.update_drawing_anchor(s.dragAnchorIdx,u,l),o.set_crosshair(r,a),i.onDirty();return}if(s.isDraggingDrawing&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top;s.touchMoved=!0;let{wx:u,wy:l}=v(o,r,a,s.dragDrawingPane),g=u-s.dragDrawingLastWx,f=l-s.dragDrawingLastWy;o.move_drawing(g,f),s.dragDrawingLastWx=u,s.dragDrawingLastWy=l,o.set_crosshair(r,a),i.onDirty();return}let n=s.drawingMode;if(s.isBrushing&&n&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);o.add_brush_point(l,g),o.set_crosshair(r,a),i.onDirty(),s.touchMoved=!0;return}if(n&&B(n.tool)&&n.pathStarted&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);o.set_elliott_manual_cursor(l,g),o.set_crosshair(r,a),i.onDirty(),s.touchMoved=!0;return}if(n&&V(n.tool)&&n.pathStarted&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);o.set_path_cursor(l,g),o.set_crosshair(r,a),i.onDirty(),s.touchMoved=!0;return}if(n&&n.step>0&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top;!s.touchMoved&&(Math.abs(r-s.touchStartX)>10||Math.abs(a-s.touchStartY)>10)&&(s.touchMoved=!0);let u=n.pane||0,{wx:l,wy:g}=v(o,r,a,u);D(o,n.tool,n,l,g,n.style,u),o.set_crosshair(r,a);let f=o.hit_zone(r,a);i.onDirty(),i.onCrosshairMove?.(r,a,f);return}if(n&&tt(n.tool)&&p.touches.length===1){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=o.hit_zone(r,a),l=X(u),{wx:g,wy:f}=v(o,r,a,l);D(o,n.tool,n,g,f,n.style,l),o.set_crosshair(r,a),i.onDirty(),i.onCrosshairMove?.(r,a,u);return}if(p.touches.length===2){s.velSamples=[];let r=p.touches[1].clientX-p.touches[0].clientX,a=p.touches[1].clientY-p.touches[0].clientY,u=Math.sqrt(r*r+a*a),l=s.lastTouchDist/u,g=(p.touches[0].clientX+p.touches[1].clientX)/2-e.left,f=(p.touches[0].clientY+p.touches[1].clientY)/2-e.top;s.dragZone===3?o.zoom_y(f,l):s.dragZone===2?o.zoom_x(g,l):(o.zoom(g,f,l),o.pan(g-s.lastX,f-s.lastY)),s.lastTouchDist=u,s.lastX=g,s.lastY=f,i.onDirty()}else if(p.touches.length===1&&s.isDragging){let r=p.touches[0].clientX-e.left,a=p.touches[0].clientY-e.top,u=r-s.lastX,l=a-s.lastY;!s.touchMoved&&(Math.abs(r-s.touchStartX)>10||Math.abs(a-s.touchStartY)>10)&&(s.touchMoved=!0,s.isCrosshairMode||clearTimeout(s.longPressTimer),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null)),s.isCrosshairMode?(o.set_crosshair(r,a),i.onDirty(),i.onCrosshairMove?.(r,a,s.dragZone),i.onVrvpHover?.(r,a)):(s.lastX=r,s.lastY=a,s.recordVelocity(u,l),s.dragZone===2?o.pan_x(u):s.dragZone===3?o.pan_y(l):o.pan(u,l),i.onDirty())}},{passive:!1}),t.addEventListener("touchend",p=>{if(s.disposed)return;if(clearTimeout(s.longPressTimer),s.liqPinTimer&&(clearTimeout(s.liqPinTimer),s.liqPinTimer=null),s.isDraggingAnchor){s.isDraggingAnchor=!1,s.dragAnchorIdx=-1,o.hide_crosshair(),i.onDirty(),i.onCrosshairHide?.();return}if(s.isDraggingDrawing){if(s.isDraggingDrawing=!1,o.hide_crosshair(),i.onDirty(),i.onCrosshairHide?.(),!s.touchMoved){let n=o.get_selected_drawing();if(n>0){let r=t.getBoundingClientRect();i.onDrawingDblClick?.(n,s.touchStartX,s.touchStartY,s.touchStartX+r.left,s.touchStartY+r.top)}}return}if(s.isBrushing){s.isBrushing=!1,o.finish_brush(),s.finishDrawing(),i.onDirty(),i.onCrosshairHide?.();return}let e=s.drawingMode;if(e&&B(e.tool)&&e.pathStarted){let n=Date.now(),r=s.touchStartX-(s._pathLastTapX||0),a=s.touchStartY-(s._pathLastTapY||0),u=Math.sqrt(r*r+a*a);n-(s._pathLastTapTime||0)<350&&u<30?(o.finish_elliott_manual(),s.finishDrawing(),s._pathLastTapTime=0):(s._pathLastTapTime=n,s._pathLastTapX=s.touchStartX,s._pathLastTapY=s.touchStartY),s.isDragging=!1,s.lastTouchDist=0,i.onDirty();return}if(e&&V(e.tool)&&e.pathStarted){let n=Date.now(),r=s.touchStartX-(s._pathLastTapX||0),a=s.touchStartY-(s._pathLastTapY||0),u=Math.sqrt(r*r+a*a);n-(s._pathLastTapTime||0)<350&&u<30?(o.finish_path(),s.finishDrawing(),s._pathLastTapTime=0):(s._pathLastTapTime=n,s._pathLastTapX=s.touchStartX,s._pathLastTapY=s.touchStartY),s.isDragging=!1,s.lastTouchDist=0,i.onDirty();return}if(e&<(e.tool)){let n=e._stepAtTouchStart;if(e.step===1&&(n===1||s.touchMoved)){let r=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let u=a.clientX-r.left,l=a.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=v(o,u,l,g);e.x2=f,e.y2=d,e.step=2,o.clear_drawing_preview()}}else if(e.step===2&&(n===2||s.touchMoved)){let r=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let u=a.clientX-r.left,l=a.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=v(o,u,l,g),_=z[e.tool];_&&_.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),G(o,e.tool,e,f,d,e.style),s.finishDrawing()}}s.isDragging=!1,s.lastTouchDist=0,s.drawingMode||(o.hide_crosshair(),i.onCrosshairHide?.()),i.onDirty();return}if(e&&e.step===1&&at(e.tool)){if(e._stepAtTouchStart===1||s.touchMoved){let r=t.getBoundingClientRect(),a=p.changedTouches?.[0];if(a){let u=a.clientX-r.left,l=a.clientY-r.top,g=e.pane||0,{wx:f,wy:d}=v(o,u,l,g);G(o,e.tool,e,f,d,e.style),s.finishDrawing()}}s.isDragging=!1,s.lastTouchDist=0,s.drawingMode||(o.hide_crosshair(),i.onCrosshairHide?.()),i.onDirty();return}if(e&&tt(e.tool)){let n=t.getBoundingClientRect(),r=p.changedTouches?.[0];if(r){let a=r.clientX-n.left,u=r.clientY-n.top,l=o.hit_zone(a,u),g=F(l)?X(l):e.pane||0,{wx:f,wy:d}=v(o,a,u,g),_=e.tool;o.clear_drawing_preview();let c=G(o,_,e,f,d,e.style);s.finishDrawing(),_==="textnote"&&c>0&&(o.select_drawing(c),i.onDrawingSelected?.(c),i.onDrawingDblClick?.(c,a,u,a+n.left,u+n.top))}s.isDragging=!1,s.lastTouchDist=0,o.hide_crosshair(),i.onCrosshairHide?.(),i.onDirty();return}if(!s.touchMoved&&!s.drawingMode&&s.isDragging){let n=Date.now(),r=s.touchStartX-s.lastTapX,a=s.touchStartY-s.lastTapY,u=Math.sqrt(r*r+a*a),l=n-s.lastTapTime<350&&u<30,g=o.hover_hit_test(s.touchStartX,s.touchStartY),f=g[0],d=g[1],_=g[3],c=g[4];if(F(f))if(_>0){o.deselect_marker(),i.onMarkerSelected?.(0),o.select_drawing(_);let h=t.getBoundingClientRect(),w=s.touchStartX+h.left,m=s.touchStartY+h.top;i.onDrawingSelected?.(_,w,m),(d<=0||d===_)&&i.onDrawingDblClick?.(_,s.touchStartX,s.touchStartY,w,m),i.onDirty()}else c>0?(o.deselect_drawing(),i.onDrawingSelected?.(0),o.select_marker(c),i.onMarkerSelected?.(c),i.onDirty()):(d>0&&(o.deselect_drawing(),i.onDrawingSelected?.(0),i.onDirty()),o.get_selected_marker()>0&&(o.deselect_marker(),i.onMarkerSelected?.(0),i.onDirty()));s.lastTapTime=n,s.lastTapX=s.touchStartX,s.lastTapY=s.touchStartY}s.touchMoved&&!s.isCrosshairMode&&!s.drawingMode&&s.startMomentum(s.dragZone),s.isDragging=!1,s.isCrosshairMode=!1,s.lastTouchDist=0,(!s.drawingMode||s.drawingMode.step===0)&&(o.hide_crosshair(),i.onCrosshairHide?.()),i.onDirty(),i.onVrvpHover?.(null,null)})}function yt(t,o,i){let s={disposed:!1,isDragging:!1,dragZone:0,lastX:0,lastY:0,lastTouchDist:0,isResizingRsi:!1,isResizingOi:!1,isResizingFr:!1,isResizingCvd:!1,resizeStartY:0,resizeStartRatio:0,lastClickTime:0,isDraggingAnchor:!1,dragAnchorIdx:-1,dragAnchorPane:0,isBrushing:!1,isDraggingDrawing:!1,dragDrawingPane:0,dragDrawingLastWx:0,dragDrawingLastWy:0,touchStartX:0,touchStartY:0,touchMoved:!1,longPressTimer:null,isCrosshairMode:!1,liqPinTimer:null,liqPinSx:0,liqPinSy:0,velSamples:[],momentumRaf:null,momentumVx:0,momentumVy:0,momentumZone:0,lastTapTime:0,lastTapX:0,lastTapY:0,drawingMode:null},p=.92,e=.5,n=80;s.recordVelocity=function(l,g){let f=performance.now();for(s.velSamples.push({dx:l,dy:g,t:f});s.velSamples.length>0&&f-s.velSamples[0].t>n;)s.velSamples.shift()};function r(){if(s.velSamples.length<2)return{vx:0,vy:0};let l=s.velSamples[0],f=s.velSamples[s.velSamples.length-1].t-l.t;if(f<5)return{vx:0,vy:0};let d=0,_=0;for(let h of s.velSamples)d+=h.dx,_+=h.dy;let c=16.67;return{vx:d/f*c,vy:_/f*c}}s.cancelMomentum=function(){s.momentumRaf&&(cancelAnimationFrame(s.momentumRaf),s.momentumRaf=null),s.velSamples=[]},s.startMomentum=function(l){let{vx:g,vy:f}=r();if(s.velSamples=[],Math.abs(g)<e&&Math.abs(f)<e)return;s.momentumVx=g,s.momentumVy=f,s.momentumZone=l;function d(){if(s.momentumVx*=p,s.momentumVy*=p,Math.abs(s.momentumVx)<e&&Math.abs(s.momentumVy)<e){s.momentumRaf=null;return}s.momentumZone===2?o.pan_x(s.momentumVx):s.momentumZone===3?o.pan_y(s.momentumVy):o.pan(s.momentumVx,s.momentumVy),i.onDirty(),s.momentumRaf=requestAnimationFrame(d)}s.momentumRaf=requestAnimationFrame(d)};let a={setMode(l,g){l?(s.drawingMode={tool:l,style:g,step:0,x1:0,y1:0},t.style.cursor="crosshair"):(s.drawingMode?.pathStarted&&o.finish_path(),s.drawingMode=null,o.clear_drawing_preview(),t.style.cursor="crosshair"),i.onDirty()},getMode(){return s.drawingMode}};i.drawingApi?.(a),s.finishDrawing=function(){o.clear_drawing_preview(),i.onDrawingComplete?.(),s.drawingMode=null,t.style.cursor="crosshair"},$t(t,o,i,s),Jt(t,o,i,s);let u=l=>{let g=document.activeElement?.tagName,f=g==="INPUT"||g==="TEXTAREA"||document.activeElement?.isContentEditable;if((l.key==="Delete"||l.key==="Backspace")&&!s.drawingMode&&!f){let _=o.get_selected_drawing();if(_>0){o.remove_drawing(_),i.onDrawingSelected?.(0),i.onDirty();return}let c=o.get_selected_marker();if(c>0){o.remove_marker(c),i.onMarkerSelected?.(0),i.onDirty();return}}if(l.key==="Escape"&&!s.drawingMode){if(o.get_selected_drawing()>0){o.deselect_drawing(),i.onDrawingSelected?.(0),i.onDirty();return}if(o.get_selected_marker()>0){o.deselect_marker(),i.onMarkerSelected?.(0),i.onDirty();return}}if(l.key==="Escape"&&s.drawingMode){if(s.drawingMode.pathStarted){s.drawingMode.tool==="elliott"?o.finish_elliott_manual():o.finish_path(),s.finishDrawing(),i.onDirty();return}o.clear_drawing_preview(),s.drawingMode=null,t.style.cursor="crosshair",i.onDrawingCancel?.(),i.onDirty();return}let d=20;switch(l.key){case"+":case"=":o.zoom(t.width/2,t.height/2,.9);break;case"-":o.zoom(t.width/2,t.height/2,1.1);break;case"ArrowLeft":o.pan_x(d);break;case"ArrowRight":o.pan_x(-d);break;case"ArrowUp":o.pan_y(-d);break;case"ArrowDown":o.pan_y(d);break;case"r":case"R":o.auto_scale_y();break;default:return}i.onDirty()};return window.addEventListener("keydown",u),()=>{s.disposed=!0,s.cancelMomentum(),window.removeEventListener("keydown",u)}}function te(t,o,i,s){let p=e=>s()(e);return{enableRsi(){t.enable_rsi(),o()},disableRsi(){t.disable_rsi(),o()},setRsiPeriod(e){t.set_rsi_period(e),o()},isRsiEnabled(){return t.is_rsi_enabled()},setRsiShowEma(e){t.set_rsi_show_ema(e),o()},setRsiShowWma(e){t.set_rsi_show_wma(e),o()},setRsiShowSignals(e){t.set_rsi_show_signals(e),o()},setRsiShowDivergence(e){t.set_rsi_show_divergence(e),o()},setRsiShowTraps(e){t.set_rsi_show_traps(e),o()},setRsiSmoothing(e){t.set_rsi_smoothing(e),o()},setRsiRatio(e){t.set_rsi_ratio(e),o()},getRsiRatio(){return t.get_rsi_ratio()},enableForexSignals(){p("forexSignals")&&(t.enable_forex_signals(),o())},disableForexSignals(){t.disable_forex_signals(),o()},isForexSignalsEnabled(){return t.is_forex_signals_enabled()},setForexSignalsSetup(e){t.set_forex_signals_setup(e),o()},setForexSignalsMode(e){t.set_forex_signals_mode(e),o()},setForexSignalsShowStats(e){t.set_forex_signals_show_stats(e),o()},getForexSignalsCount(){return t.get_forex_signals_count()},enableOi(){i()||p("oi")&&(t.enable_oi(),o())},disableOi(){i()||(t.disable_oi(),o())},isOiEnabled(){if(i())return!1;try{return t.is_oi_enabled()}catch{return!1}},setOiData(e){i()||(t.set_oi_data(e),o())},setOiDataTs(e,n){i()||(t.set_oi_data_ts(e,n),o())},setOiShowOnChart(e){i()||(t.set_oi_show_on_chart(e),o())},setOiDisplayMode(e){i()||(t.set_oi_display_mode(e),o())},setOiRatio(e){i()||(t.set_oi_ratio(e),o())},getOiRatio(){if(i())return .2;try{return t.get_oi_ratio()}catch{return .2}},enableFundingRate(){i()||p("fundingRate")&&(t.enable_funding_rate(),o())},disableFundingRate(){i()||(t.disable_funding_rate(),o())},isFundingRateEnabled(){if(i())return!1;try{return t.is_funding_rate_enabled()}catch{return!1}},setFrBinanceData(e,n){i()||(t.set_fr_binance_data(e,n),o())},setFrAggData(e,n){i()||(t.set_fr_agg_data(e,n),o())},setFrShowAgg(e){i()||(t.set_fr_show_agg(e),o())},setFrShowSma(e){i()||(t.set_fr_show_sma(e),o())},enableCvd(){i()||p("cvd")&&(t.enable_cvd(),o())},disableCvd(){i()||(t.disable_cvd(),o())},isCvdEnabled(){if(i())return!1;try{return t.is_cvd_enabled()}catch{return!1}},setCvdData(e,n){i()||(t.set_cvd_data(e,n),o())},setCvdMode(e){i()||(t.set_cvd_mode(e),o())},getCvdMode(){if(i())return 0;try{return t.get_cvd_mode()}catch{return 0}},setCvdShowDelta(e){i()||(t.set_cvd_show_delta(e),o())},getCvdShowDelta(){if(i())return!0;try{return t.get_cvd_show_delta()}catch{return!0}},enableLargeTrades(){i()||p("largeTrades")&&(t.enable_large_trades(),o())},disableLargeTrades(){i()||(t.disable_large_trades(),o())},isLargeTradesEnabled(){if(i())return!1;try{return t.is_large_trades_enabled()}catch{return!1}},setLargeTradesData(e){i()||(t.set_large_trades_data(e),o())},pushLargeTrade(e,n,r,a){i()||(t.push_large_trade(e,n,r,a),o())},clearLargeTrades(){i()||(t.clear_large_trades(),o())},setLtVolumeFilter(e,n){i()||(t.set_lt_volume_filter(e,n),o())},setLtBubbleScale(e){i()||(t.set_lt_bubble_scale(e),o())},getLtDataMinVol(){return i()?0:t.get_lt_data_min_vol()},getLtDataMaxVol(){return i()?0:t.get_lt_data_max_vol()},ltHitTest(e,n){if(i())return"";try{return t.lt_hit_test(e,n)}catch{return""}},enableVrvp(){i()||p("vrvp")&&(t.enable_vrvp(),o())},disableVrvp(){i()||(t.disable_vrvp(),o())},isVrvpEnabled(){if(i())return!1;try{return t.is_vrvp_enabled()}catch{return!1}},setVrvpPocLine(e){i()||(t.set_vrvp_poc_line(e),o())},vrvpHitTest(e,n){if(i())return"";try{return t.vrvp_hit_test(e,n)}catch{return""}},enableTpo(){i()||p("tpo")&&(t.enable_tpo(),o())},disableTpo(){i()||(t.disable_tpo(),o())},isTpoEnabled(){if(i())return!1;try{return t.is_tpo_enabled()}catch{return!1}},setTpoPocLine(e){i()||(t.set_tpo_poc_line(e),o())},setTpoVaLines(e){i()||(t.set_tpo_va_lines(e),o())},setTpoIb(e){i()||(t.set_tpo_ib(e),o())},setTpoSinglePrints(e){i()||(t.set_tpo_single_prints(e),o())},setTpoPeriod(e){i()||(t.set_tpo_period(e),o())},getTpoPeriod(){if(i())return 1440;try{return t.get_tpo_period()}catch{return 1440}},setTpoNakedPoc(e){i()||(t.set_tpo_naked_poc(e),o())},setTpoProfileShape(e){i()||(t.set_tpo_profile_shape(e),o())},setTpoIbMinutes(e){i()||(t.set_tpo_ib_minutes(e),o())},setTpoLetterMinutes(e){i()||(t.set_tpo_letter_minutes(e),o())},setTpoSignals(e){i()||(t.set_tpo_signals(e),o())},isTpoSignals(){if(i())return!1;try{return t.is_tpo_signals()}catch{return!1}},enableLiqHeatmap(){i()||p("liqHeatmap")&&(t.enable_liq_heatmap(),o())},disableLiqHeatmap(){i()||(t.disable_liq_heatmap(),o())},isLiqHeatmapEnabled(){if(i())return!1;try{return t.is_liq_heatmap_enabled()}catch{return!1}},setLiqHeatmapRange(e,n){i()||(t.set_liq_heatmap_range(e,n),o())},getLiqHeatmapMin(){if(i())return 0;try{return t.get_liq_heatmap_min()}catch{return 0}},getLiqHeatmapMax(){if(i())return 1;try{return t.get_liq_heatmap_max()}catch{return 1}},getLiqHeatmapSegMax(){if(i())return 0;try{return t.get_liq_heatmap_seg_max()}catch{return 0}},setLiqHeatmapProfile(e){i()||(t.set_liq_heatmap_profile(e),o())},isLiqHeatmapProfile(){if(i())return!0;try{return t.is_liq_heatmap_profile()}catch{return!0}},setLiqHeatmapCellHeight(e){i()||(t.set_liq_heatmap_cell_height(e),o())},getLiqHeatmapCellHeight(){if(i())return 1;try{return t.get_liq_heatmap_cell_height()}catch{return 1}},setLiqHeatmapPredictions(e){i()||(t.set_liq_heatmap_predictions(e),o())},setLiqHeatmapFilledPct(e){i()||(t.set_liq_heatmap_filled_pct(e),o())},getLiqHeatmapFilledPct(){if(i())return .85;try{return t.get_liq_heatmap_filled_pct()}catch{return .85}},liqHeatmapHitTest(e,n){if(i())return"";try{return t.liq_heatmap_hit_test(e,n)}catch{return""}},liqZoneHitTest(e,n){if(i())return"";try{return t.liq_zone_hit_test(e,n)}catch{return""}},enableSmartRanges(){i()||p("smartRanges")&&(t.enable_smart_ranges(),o())},disableSmartRanges(){i()||(t.disable_smart_ranges(),o())},isSmartRangesEnabled(){if(i())return!1;try{return t.is_smart_ranges_enabled()}catch{return!1}},setSrTextSize(e){i()||(t.set_sr_text_size(e),o())},setSrShowOb(e){i()||(t.set_sr_show_ob(e),o())},setSrObLast(e){i()||(t.set_sr_ob_last(e),o())},setSrShowObActivity(e){i()||(t.set_sr_show_ob_activity(e),o())},setSrShowBreakers(e){i()||(t.set_sr_show_breakers(e),o())},setSrMitigation(e){i()||(t.set_sr_mitigation(e),o())},setSrShowMetrics(e){i()||(t.set_sr_show_metrics(e),o())},setSrShowHtfOb(e){i()||(t.set_sr_show_htf_ob(e),o())},setSrHtfMinutes(e){i()||(t.set_sr_htf_minutes(e),o())},setSrShowFvg(e){i()||(t.set_sr_show_fvg(e),o())},setSrFvgTheme(e){i()||(t.set_sr_fvg_theme(e),o())},setSrFvgMitigation(e){i()||(t.set_sr_fvg_mitigation(e),o())},setSrFvgHtf(e){i()||(t.set_sr_fvg_htf(e),o())},setSrFvgExtend(e){i()||(t.set_sr_fvg_extend(e),o())},setSrShowObSignals(e){i()||(t.set_sr_show_ob_signals(e),o())},setSrShowPredict(e){i()||(t.set_sr_show_predict(e),o())},setSrShowFvgSignals(e){i()||(t.set_sr_show_fvg_signals(e),o())},setSrShowSmartRev(e){i()||(t.set_sr_show_smart_rev(e),o())},setSrSmartRevHtf(e){i()||(t.set_sr_smart_rev_htf(e),o())},setSrStatsType(e){i()||(t.set_sr_stats_type(e),o())},setSrStatsPosition(e){i()||(t.set_sr_stats_position(e),o())},getSrSignalsCount(){if(i())return 0;try{return t.get_sr_signals_count()}catch{return 0}},enableEmaStructure(){i()||p("emaStructure")&&(t.enable_ema_structure(),o())},disableEmaStructure(){i()||(t.disable_ema_structure(),o())},isEmaStructureEnabled(){if(i())return!1;try{return t.is_ema_structure_enabled()}catch{return!1}},setEsEma1Len(e){i()||(t.set_es_ema1_len(e),o())},setEsEma2Len(e){i()||(t.set_es_ema2_len(e),o())},setEsWmaLen(e){i()||(t.set_es_wma_len(e),o())},setEsShowEma1(e){i()||(t.set_es_show_ema1(e),o())},setEsShowEma2(e){i()||(t.set_es_show_ema2(e),o())},setEsShowWma(e){i()||(t.set_es_show_wma(e),o())},setEsSwingLen(e){i()||(t.set_es_swing_len(e),o())},setEsShowBos(e){i()||(t.set_es_show_bos(e),o())},enableLiveSignals(){i()||(t.enable_live_signals(),o())},disableLiveSignals(){i()||(t.disable_live_signals(),o())},isLiveSignalsEnabled(){if(i())return!1;try{return t.is_live_signals_enabled()}catch{return!1}},setLiveSignalsData(e){i()||(t.set_live_signals_data(new Float64Array(e)),o())},clearLiveSignals(){i()||(t.clear_live_signals(),o())},setLiveSignalsLeverage(e){i()||(t.set_live_signals_leverage(e),o())},getLiveSignalsLeverage(){if(i())return 10;try{return t.get_live_signals_leverage()}catch{return 10}},setLiveSignalsTrial(e){i()||(t.set_live_signals_trial(e),o())},setLiveSignalsShowEntry(e){i()||(t.set_live_signals_show_entry(e),o())},setLiveSignalsShowTpSl(e){i()||(t.set_live_signals_show_tp_sl(e),o())},setLiveSignalsShowMaxProfit(e){i()||(t.set_live_signals_show_max_profit(e),o())},setLiveSignalsShowLabels(e){i()||(t.set_live_signals_show_labels(e),o())},setLiveSignalsShowZones(e){i()||(t.set_live_signals_show_zones(e),o())},setLiveSignalsTextSize(e){i()||(t.set_live_signals_text_size(e),o())},setLiveSignalsPipValue(e){i()||(t.set_live_signals_pip_value(e),o())},setLiveSignalsLoading(e){i()||(t.set_live_signals_loading(e),o())},getLiveSignalsCount(){if(i())return 0;try{return t.get_live_signals_count()}catch{return 0}},enableVpin(){i()||p("vpin")&&(t.enable_vpin(),o())},disableVpin(){i()||(t.disable_vpin(),o())},isVpinEnabled(){if(i())return!1;try{return t.is_vpin_enabled()}catch{return!1}},setVpinData(e,n){i()||(t.set_vpin_data(e,n),o())},setVpinBucketSize(e){i()||(t.set_vpin_bucket_size(e),o())},getVpinBucketSize(){if(i())return 50;try{return t.get_vpin_bucket_size()}catch{return 50}},setVpinNumBuckets(e){i()||(t.set_vpin_num_buckets(e),o())},getVpinNumBuckets(){if(i())return 50;try{return t.get_vpin_num_buckets()}catch{return 50}},setVpinThreshold(e){i()||(t.set_vpin_threshold(e),o())},getVpinThreshold(){if(i())return .7;try{return t.get_vpin_threshold()}catch{return .7}},setVpinShowSma(e){i()||(t.set_vpin_show_sma(e),o())},setVpinShowZones(e){i()||(t.set_vpin_show_zones(e),o())},enableStopIceberg(){i()||p("stopIceberg")&&(t.enable_stop_iceberg(),o())},disableStopIceberg(){i()||(t.disable_stop_iceberg(),o())},isStopIcebergEnabled(){if(i())return!1;try{return t.is_stop_iceberg_enabled()}catch{return!1}},setSiShowStops(e){i()||(t.set_si_show_stops(e),o())},setSiShowIcebergs(e){i()||(t.set_si_show_icebergs(e),o())},setSiShowZones(e){i()||(t.set_si_show_zones(e),o())},setIcebergEvents(e,n,r,a,u,l){i()||(t.set_iceberg_events(e,n,r,a,u,l),o())},getStopRunCount(){if(i())return 0;try{return t.get_stop_run_count()}catch{return 0}},getIcebergCount(){if(i())return 0;try{return t.get_iceberg_count()}catch{return 0}},enableVolume(){t.enable_volume(),o()},disableVolume(){t.disable_volume(),o()},isVolumeEnabled(){return t.is_volume_enabled()},setVolumeMaPeriod(e){t.set_volume_ma_period(e),o()},setVolumeShowMa(e){t.set_volume_show_ma(e),o()},setVolumeShowSignals(e){t.set_volume_show_signals(e),o()},setVolumeColorMode(e){t.set_volume_color_mode(e),o()},getVolumeMaPeriod(){return t.get_volume_ma_period()},getVolumeShowMa(){return t.get_volume_show_ma()},getVolumeShowSignals(){return t.get_volume_show_signals()},getVolumeColorMode(){return t.get_volume_color_mode()}}}function ee(t,o,i,s){let p=e=>s()(e);return{addMarker(e,n,r){t.add_marker(e,n,r),o()},clearMarkers(){t.clear_markers(),o()},hitTestMarker(e,n){return t.hit_test_marker(e,n)},selectMarker(e){t.select_marker(e),o()},deselectMarker(){t.deselect_marker(),o()},getSelectedMarker(){return t.get_selected_marker()},removeMarker(e){t.remove_marker(e),o()},deleteSelectedMarker(){let e=t.get_selected_marker();return e>0&&(t.remove_marker(e),o()),e},addTrendline(e,n,r,a,u,l,g,f,d,_=0){let c=t.add_trendline(e,n,r,a,u,l,g,f,d,_);return o(),c},addHorizontalLine(e,n,r,a,u,l,g,f=0){let d=t.add_horizontal_line(e,n,r,a,u,l,g,f);return o(),d},addArrow(e,n,r,a,u,l,g,f,d,_=0){let c=t.add_arrow(e,n,r,a,u,l,g,f,d,_);return o(),c},addFibRetracement(e,n,r,a,u,l,g,f,d,_=0){if(!p("drawingFull"))return 0;let c=t.add_fib_retracement(e,n,r,a,u,l,g,f,d,_);return o(),c},addFibExtension(e,n,r,a,u,l,g,f,d,_,c,h=0){if(!p("drawingFull"))return 0;let w=t.add_fib_extension(e,n,r,a,u,l,g,f,d,_,c,h);return o(),w},addLongPosition(e,n,r,a,u,l,g,f,d,_=0){if(!p("drawingFull"))return 0;let c=t.add_long_position(e,n,r,a,u,l,g,f,d,_);return o(),c},addShortPosition(e,n,r,a,u,l,g,f,d,_=0){if(!p("drawingFull"))return 0;let c=t.add_short_position(e,n,r,a,u,l,g,f,d,_);return o(),c},addAnchoredVwap(e,n,r,a,u,l,g=0){if(!p("drawingFull"))return 0;let f=t.add_anchored_vwap(e,n,r,a,u,l,g);return o(),f},addPriceLabel(e,n,r,a,u,l,g=0){let f=t.add_price_label(e,n,r,a,u,l,g);return o(),f},addElliottImpulse(e,n,r,a,u,l,g=0){if(!p("drawingFull"))return 0;let f=t.add_elliott_impulse(e,n,r,a,u,l,g);return o(),f},setDrawingFontSize(e,n){t.set_drawing_font_size(e,n),o()},getDrawingFontSize(e){return t.get_drawing_font_size(e)},setDrawingText(e,n){t.set_drawing_text(e,n),o()},getDrawingText(e){return t.get_drawing_text(e)},setDrawingStyle(e,n,r,a,u){t.set_drawing_style(e,n,r,a,u),o()},getDrawingColor(e){let n=t.get_drawing_color(e);return n?{r:n>>>24&255,g:n>>>16&255,b:n>>>8&255,lineWidth:(n&255)/10}:null},getDrawingDashed(e){try{return t.get_drawing_dashed(e)}catch{return!1}},setDrawingDashed(e,n){t.set_drawing_dashed(e,n),o()},getDrawingHideLabel(e){try{return t.get_drawing_hide_label(e)}catch{return!1}},setDrawingHideLabel(e,n){t.set_drawing_hide_label(e,n),o()},getDrawingKindId(e){try{return t.get_drawing_kind_id(e)}catch{return 255}},removeDrawing(e){t.remove_drawing(e),o()},clearDrawings(){t.clear_drawings(),o()},drawingCount(){return t.drawing_count()},setDrawingPreview(e,n,r,a,u,l,g,f,d,_,c=0){t.set_drawing_preview(e,n,r,a,u,l,g,f,d,_,c),o()},clearDrawingPreview(){t.clear_drawing_preview(),o()},cancelBrush(){t.cancel_brush(),o()},selectDrawing(e){t.select_drawing(e),o()},deselectDrawing(){t.deselect_drawing(),o()},getSelectedDrawing(){return t.get_selected_drawing()},deleteSelectedDrawing(){let e=t.get_selected_drawing();return e>0&&(t.remove_drawing(e),o()),e},exportDrawingsJson(){try{return t.export_drawings_json()}catch{return"[]"}},importDrawingsJson(e){try{t.import_drawings_json(e),o()}catch(n){console.warn("[bridge] importDrawingsJson failed",n)}},screenToWorld(e,n){return{x:t.screen_to_world_x(e),y:t.screen_to_world_y(n)}},worldToScreen(e,n){try{return{x:t.world_to_screen_x(e),y:t.world_to_screen_y(n)}}catch{return null}}}}var y=t=>t instanceof Float64Array?t:new Float64Array(t);function re(t,o,i,s){let p=e=>s()(e);return{setKlines(e,n,r,a,u,l){t.set_klines(y(e),y(n),y(r),y(a),y(u),y(l)),o()},setRealTimestamps(e){t.set_real_timestamps(y(e)),o()},appendRealTimestamp(e){t.append_real_timestamp(e)},prependKlines(e,n,r,a,u,l){t.prepend_klines(y(e),y(n),y(r),y(a),y(u),y(l)),o()},appendKline(e,n,r,a,u,l){t.append_kline(e,n,r,a,u,l),o()},updateLastKline(e,n,r,a,u,l){t.update_last_kline(e,n,r,a,u,l),o()},popLastKline(){let e=t.pop_last_kline();return e&&o(),e},getLastClose(){try{return t.get_last_close()}catch{return 0}},getKlineCount(){if(i())return 0;try{return t.kline_count()}catch{return 0}},getKlineTimestamps(){if(i())return null;try{return t.kline_timestamps()}catch{return null}},getKlineOpens(){if(i())return null;try{return t.kline_opens()}catch{return null}},getKlineHighs(){if(i())return null;try{return t.kline_highs()}catch{return null}},getKlineLows(){if(i())return null;try{return t.kline_lows()}catch{return null}},getKlineCloses(){if(i())return null;try{return t.kline_closes()}catch{return null}},getKlineVolumes(){if(i())return null;try{return t.kline_volumes()}catch{return null}},setHeatmap(e,n,r,a,u,l,g){p("heatmap")&&(t.set_heatmap(y(e),n,r,a,u,l,g),o())},appendHeatmapColumn(e,n,r,a){p("heatmap")&&(t.append_heatmap_column(y(e),n,r,a),o())},updateLastHeatmapColumn(e,n,r){t.update_last_heatmap_column(y(e),n,r),o()},getHeatmapLastTimestamp(){try{return t.get_heatmap_last_timestamp()}catch{return 0}},getHeatmapXStep(){try{return t.get_heatmap_x_step()}catch{return 0}},updateHeatmapColumnAt(e,n,r,a){t.update_heatmap_column_at(y(e),n,r,a),o()},setHeatmapRange(e,n){t.set_heatmap_range(e,n),o()},getHeatmapDataRange(){try{return{min:t.get_heatmap_data_min(),max:t.get_heatmap_data_max()}}catch{return{min:0,max:0}}},setHeatmapPrefetchRange(e){try{t.set_heatmap_prefetch_range(e)}catch{}},clearHeatmapPrefetchRange(){try{t.clear_heatmap_prefetch_range()}catch{}},getHeatmapPrefetchMax(){try{return t.get_heatmap_prefetch_max()}catch{return 0}},setChartType(e){i()||e===2&&!p("footprint")||(t.set_chart_type(e),o())},getChartType(){if(i())return 0;try{return t.get_chart_type()}catch{return 0}},setFootprintTickSize(e){i()||p("footprint")&&(t.set_footprint_tick_size(e),o())},footprintEnsureLen(e){i()||t.footprint_ensure_len(e)},footprintAddTrade(e,n,r,a){i()||t.footprint_add_trade(e,n,r,a)},footprintAddTradeBatch(e){i()||!e||e.length===0||t.footprint_add_trade_batch(y(e))},footprintSetBar(e,n,r,a,u){i()||(t.footprint_set_bar(e,n,r,a,u),o())},footprintClear(){i()||(t.footprint_clear(),o())},footprintClearBar(e){i()||t.footprint_clear_bar(e)},footprintPrependEmpty(e){i()||t.footprint_prepend_empty(e)},footprintSetShowSignals(e){i()||(t.footprint_set_show_signals(e),o())},footprintGetShowSignals(){if(i())return!0;try{return t.footprint_get_show_signals()}catch{return!0}},footprintSignalCount(){if(i())return 0;try{return t.footprint_signal_count()}catch{return 0}},footprintSetShowProfile(e){i()||(t.footprint_set_show_profile(e),o())},footprintGetShowProfile(){if(i())return!1;try{return t.footprint_get_show_profile()}catch{return!1}},footprintProfileHitTest(e,n){if(i())return"";try{return t.footprint_profile_hit_test(e,n)}catch{return""}},footprintSetDisplayMode(e){i()||(t.footprint_set_display_mode(e),o())},footprintGetDisplayMode(){if(i())return 0;try{return t.footprint_get_display_mode()}catch{return 0}},enableDeltaHistogram(){i()||t.enable_delta_histogram()},disableDeltaHistogram(){i()||t.disable_delta_histogram()},deltaHistogramEnabled(){if(i())return!1;try{return t.delta_histogram_enabled()}catch{return!1}}}}var Pe=1;function j(t){if(typeof t!="string")return{r:255,g:255,b:255,a:153};if(t.startsWith("#")){let i=t.slice(1);if(i.length===8)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:parseInt(i.slice(6,8),16)};let s=parseInt(i.slice(0,2),16),p=parseInt(i.slice(2,4),16),e=parseInt(i.slice(4,6),16);return{r:s,g:p,b:e,a:255}}let o=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\)/);return o?{r:+o[1],g:+o[2],b:+o[3],a:o[4]!==void 0?Math.round(+o[4]*255):255}:{r:255,g:255,b:255,a:153}}function Nt(t,o,i){let s=new Map,p=null,e=0,n=NaN;function r(){let f;try{f=t.kline_count()}catch{return p}if(f===0)return null;let d=t.kline_closes(),_=d?.[f-1]??NaN;if(p&&!(f!==e||_!==n))return p;try{let h=t.kline_timestamps(),w=t.kline_opens(),m=t.kline_highs(),L=t.kline_lows(),S=t.kline_volumes();if(!h||!d)return p;p={timestamps:Array.from(h),open:Array.from(w),high:Array.from(m),low:Array.from(L),close:Array.from(d),volume:Array.from(S),length:f},e=f,n=_;for(let C of s.values())C._needsCompute=!0}catch{}return p}function a(){return{seriesLine(f,d="#ffffff99",_=1.5){let c=j(d);t.custom_series_line(new Float64Array(f),c.r,c.g,c.b,c.a,_)},seriesDashedLine(f,d="#ffffff66",_=1,c=4,h=4){let w=j(d);t.custom_series_dashed_line(new Float64Array(f),w.r,w.g,w.b,w.a,_,c,h)},band(f,d,_="rgba(100,149,237,0.08)"){let c=j(_);t.custom_band(new Float64Array(f),new Float64Array(d),c.r,c.g,c.b,c.a)},hline(f,d="#ffffff66",_=1){let c=j(d);t.custom_hline(f,c.r,c.g,c.b,c.a,_)},dashedHline(f,d="#ffffff66",_=1,c=6,h=4){let w=j(d);t.custom_dashed_hline(f,w.r,w.g,w.b,w.a,_,c,h)},marker(f,d,_="#e8a04a",c=3){let h=j(_);t.custom_marker(f,d,h.r,h.g,h.b,h.a,c)},markerUp(f,d,_="#26a69a",c=5){let h=j(_);t.custom_marker_up(f,d,h.r,h.g,h.b,h.a,c)},markerDown(f,d,_="#ef5350",c=5){let h=j(_);t.custom_marker_down(f,d,h.r,h.g,h.b,h.a,c)},text(f,d,_,c="#ffffffaa",h=10,w="center"){let m=j(c),L=w==="center"?1:w==="right"?2:0;t.custom_text(f,d,_,m.r,m.g,m.b,m.a,h,L)},priceLabel(f,d,_="#ffffffaa",c=10){let h=j(_);t.custom_price_label(f,d,h.r,h.g,h.b,h.a,c)},linePx(f,d,_,c,h,w=1){let m=j(h);t.custom_line_px(f,d,_,c,m.r,m.g,m.b,m.a,w)},fillRectPx(f,d,_,c,h){let w=j(h);t.custom_fill_rect_px(f,d,_,c,w.r,w.g,w.b,w.a)},strokeRectPx(f,d,_,c,h,w=1){let m=j(h);t.custom_stroke_rect_px(f,d,_,c,m.r,m.g,m.b,m.a,w)},textPx(f,d,_,c,h=10,w="left"){let m=j(c),L=w==="center"?1:w==="right"?2:0;t.custom_text_px(f,d,_,m.r,m.g,m.b,m.a,h,L)},worldToScreenX:f=>t.world_to_screen_x(f),worldToScreenY:f=>t.world_to_screen_y(f),screenToWorldX:f=>t.screen_to_world_x(f),screenToWorldY:f=>t.screen_to_world_y(f),chartArea:()=>({x:t.chart_area_x(),y:t.chart_area_y(),w:t.chart_area_w(),h:t.chart_area_h()})}}function u(f){if(!f.compute)return;let d=r();if(d)try{f._computed=f.compute(d,f.params)||{}}catch(_){console.warn(`[CustomIndicator "${f.name}"] compute error:`,_),f._computed={}}}function l(f){if(s.size===0)return;let d=r();if(!d)return;t.custom_begin();let _=a();for(let h of s.values())if(h.enabled){h._needsCompute&&(u(h),h._needsCompute=!1);try{h.render.call(h,_,h._computed||{},d)}catch(w){console.warn(`[CustomIndicator "${h.name}"] render error:`,w)}}if(t.custom_end(),t.custom_command_count()>0){let h=t.get_custom_buffer_ptr(),w=t.get_custom_buffer_len();i(f,o,h,w)}}function g(){p=null,e=0,n=NaN;for(let f of s.values())f._needsCompute=!0}return{add(f){let d=Pe++,_={id:d,name:f.name||`Custom ${d}`,params:{...f.params},compute:f.compute||null,render:f.render,enabled:!0,_computed:{},_needsCompute:!0};return s.set(d,_),d},remove(f){s.delete(f)},updateParams(f,d){let _=s.get(f);_&&(Object.assign(_.params,d),_._needsCompute=!0)},setEnabled(f,d){let _=s.get(f);_&&(_.enabled=d)},list(){return[...s.values()].map(f=>({id:f.id,name:f.name,params:{...f.params},enabled:f.enabled}))},invalidateCompute:g,renderAll:l}}var oe={trial:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!0,tpo:!0,smartRanges:!0,emaStructure:!0,customIndicators:!0,forexSignals:!0,vpin:!0,stopIceberg:!0},standard:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!1,heatmap:!1,footprint:!1,liqHeatmap:!1,oi:!1,fundingRate:!1,cvd:!1,largeTrades:!1,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1,vpin:!1,stopIceberg:!1},professional:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!1,tpo:!1,smartRanges:!1,emaStructure:!1,customIndicators:!1,forexSignals:!1,vpin:!1,stopIceberg:!1},enterprise:{candlestick:!0,volume:!0,rsi:!0,drawingBasic:!0,drawingFull:!0,heatmap:!0,footprint:!0,liqHeatmap:!0,oi:!0,fundingRate:!0,cvd:!0,largeTrades:!0,vrvp:!0,tpo:!0,smartRanges:!0,emaStructure:!0,customIndicators:!0,forexSignals:!0,vpin:!0,stopIceberg:!0}},Re={rsi:"RSI",drawingBasic:"Basic Drawing Tools",heatmap:"Orderbook Heatmap",footprint:"Footprint Chart",liqHeatmap:"Liquidation Heatmap",oi:"Open Interest",fundingRate:"Funding Rate",cvd:"CVD",largeTrades:"Large Trades",vrvp:"VRVP",tpo:"TPO / Market Profile",smartRanges:"Smart Ranges",emaStructure:"EMA Structure",drawingFull:"All Drawing Tools",customIndicators:"Custom Indicators",forexSignals:"Forex Signals",vpin:"VPIN",stopIceberg:"Stops & Icebergs"},je={rsi:"Standard",drawingBasic:"Standard",heatmap:"Professional",footprint:"Professional",liqHeatmap:"Professional",oi:"Professional",fundingRate:"Professional",cvd:"Professional",largeTrades:"Professional",drawingFull:"Professional",vrvp:"Enterprise",tpo:"Enterprise",smartRanges:"Enterprise",emaStructure:"Enterprise",customIndicators:"Enterprise",forexSignals:"Enterprise",vpin:"Enterprise",stopIceberg:"Enterprise"};function et(t){return oe[t]||oe.trial}function Pt(t){let o=et(t),i=new Set;return function(p){if(o[p])return!0;if(!i.has(p)){i.add(p);let e=Re[p]||p,n=je[p]||"a higher";console.warn(`[MRD Chart Engine] "${e}" requires ${n} plan. Current plan: ${t}. Upgrade at https://mrd-chart.dev/pricing`)}return!1}}var Fe=14,se="trial",ut="free";var jt=[95,95,109,114].map(t=>String.fromCharCode(t)).join(""),Ye=1297237059;function le(t){let o=`${t}:${Ye}:${(t^2043453)>>>0}`,i=2166136261;for(let s=0;s<o.length;s++)i^=o.charCodeAt(s),i=Math.imul(i,16777619);return(i>>>0).toString(36)}function ft(t){return`${t}.${le(t)}`}function dt(t){if(!t||typeof t!="string")return null;let o=t.lastIndexOf(".");if(o<1)return null;let i=parseInt(t.slice(0,o),10);return!i||i<1e9||i>2e9||t.slice(o+1)!==le(i)?null:i}var ue=jt+"e7x",fe=jt+"p3q",de="mrd_engine_session_id",_e="mrd_ce_db",rt="meta",ce="trial_ts",he=jt+"ck";function Ft(){try{return dt(localStorage.getItem(ue))}catch{return null}}function Yt(t){try{localStorage.setItem(ue,ft(t))}catch{}}function zt(){try{return dt(localStorage.getItem(fe))}catch{return null}}function Dt(t){try{localStorage.setItem(fe,ft(t))}catch{}}function Zt(){try{return dt(sessionStorage.getItem(de))}catch{return null}}function Xt(t){try{sessionStorage.setItem(de,ft(t))}catch{}}function Ht(){try{let t=document.cookie.match(new RegExp(`(?:^|;\\s*)${he}=([^;]+)`));return t?dt(decodeURIComponent(t[1])):null}catch{return null}}function Ot(t){try{let o=encodeURIComponent(ft(t));document.cookie=`${he}=${o};path=/;max-age=${86400*400};SameSite=Lax`}catch{}}var ot=null,ie=!1;function ze(){if(!(ie||typeof indexedDB>"u")){ie=!0;try{let t=indexedDB.open(_e,1);t.onupgradeneeded=()=>{let o=t.result;o.objectStoreNames.contains(rt)||o.createObjectStore(rt)},t.onsuccess=()=>{let s=t.result.transaction(rt,"readonly").objectStore(rt).get(ce);s.onsuccess=()=>{let p=dt(s.result);p&&(!ot||p<ot)&&(ot=p,De(p))}}}catch{}}}function pe(t){ot=t;try{let o=indexedDB.open(_e,1);o.onsuccess=()=>{o.result.transaction(rt,"readwrite").objectStore(rt).put(ft(t),ce)}}catch{}}function De(t){let o=Math.floor(Date.now()/1e3),i=we([Ft(),zt(),Zt(),Ht(),t],o);i&&i!==t||i&&(Yt(i),Dt(i),Xt(i),Ot(i))}function we(t,o){let i=null;for(let s of t)s&&(s>o+60||s<17e8||(!i||s<i)&&(i=s));return i}function Ze(){let t=Math.floor(Date.now()/1e3),o=[Ft(),zt(),Zt(),Ht(),ot];return we(o,t)}function Xe(t){Yt(t),Dt(t),Xt(t),Ot(t),pe(t)}function He(t){Ft()||Yt(t),zt()||Dt(t),Zt()||Xt(t),Ht()||Ot(t),ot||pe(t)}ze();function Mt(t){if(!t||t==="trial")return Oe();try{let o=JSON.parse(atob(t)),{p:i,d:s,e:p,s:e}=o;if(!i||!e)return{valid:!1,error:"Invalid license key format"};let n={...o};if(delete n.s,e!==ge(n))return{valid:!1,error:"Invalid license key signature"};if(p>0&&Date.now()/1e3>p)return{valid:!0,plan:ut,watermark:!0,trialExpired:!0,originalPlan:i,error:`License expired on ${new Date(p*1e3).toLocaleDateString()}`,features:et(ut)};let r=o.pl||"web";if((r==="web"||r==="any")&&s&&s!=="*"&&typeof window<"u"){let a=window.location.hostname;if(a&&a!=="localhost"&&a!=="127.0.0.1"&&a!=="0.0.0.0"&&a!==""&&!s.split(",").map(g=>g.trim()).some(g=>We(g,a)))return{valid:!1,error:`License not valid for domain: ${a}`}}if(r==="mobile"&&o.a&&typeof window<"u"){let a=window.__mrd_app_id;if(a&&a!==o.a)return{valid:!1,error:`License not valid for app: ${a}`}}return{valid:!0,plan:i,domain:s,platform:r,appId:o.a||null,expiry:p,watermark:!1,features:et(i)}}catch{return{valid:!1,error:"Invalid license key"}}}function ge(t){let o="mrd-ce-hmac-2024-x9k2m",i=JSON.stringify(t),s=o+":"+i,p=2166136261,e=1818371886,n=3735928559;for(let r=0;r<s.length;r++){let a=s.charCodeAt(r);p=Math.imul(p^a,16777619)>>>0,e=Math.imul(e^a,1540483477)>>>0,n=Math.imul(n^a,461845907)>>>0}return(p.toString(36)+e.toString(36)+n.toString(36)).slice(0,24)}function Oe(){let t=Ze();t?He(t):(t=Math.floor(Date.now()/1e3),Xe(t));let o=t+Fe*86400,i=Date.now()/1e3,s=Math.max(0,Math.ceil((o-i)/86400));return i>o?{valid:!0,plan:ut,watermark:!0,trialExpired:!0,daysLeft:0,features:et(ut)}:{valid:!0,plan:se,watermark:!1,daysLeft:s,trialEnd:o,features:et(se)}}function We(t,o){if(t==="*"||t===o)return!0;if(t.startsWith("*.")){let i=t.slice(1);return o.endsWith(i)||o===t.slice(2)}return!1}var Ve="MRD-Indicators",ne="mrd-indicators.com",Be="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAzMCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNCk7CiAgICAgIH0KCiAgICAgIC5jbHMtMiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMik7CiAgICAgIH0KCiAgICAgIC5jbHMtMiwgLmNscy0zLCAuY2xzLTQsIC5jbHMtNSwgLmNscy02IHsKICAgICAgICBtaXgtYmxlbmQtbW9kZTogbXVsdGlwbHk7CiAgICAgIH0KCiAgICAgIC5jbHMtMyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtMyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNik7CiAgICAgIH0KCiAgICAgIC5jbHMtNSB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNSk7CiAgICAgIH0KCiAgICAgIC5jbHMtNiB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQtNyk7CiAgICAgIH0KCiAgICAgIC5jbHMtNyB7CiAgICAgICAgZmlsbDogdXJsKCNsaW5lYXItZ3JhZGllbnQpOwogICAgICB9CgogICAgICAuY2xzLTggewogICAgICAgIGlzb2xhdGlvbjogaXNvbGF0ZTsKICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB4MT0iOS4xMiIgeTE9IjE1Ljg4IiB4Mj0iMTkuNjMiIHkyPSI1LjM3IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2IzNTA5ZSIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmNWE0YzciLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC0yIiB4MT0iOS4wOCIgeTE9IjYuODEiIHgyPSI5LjA4IiB5Mj0iMTQuNzMiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjMjM0ZmIzIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZmZiIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTMiIHgxPSIxNy42NyIgeTE9IjYuMTEiIHgyPSI4LjQxIiB5Mj0iNi4xMSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM1YTJhOGIiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNCIgeDE9IjIwLjAzIiB5MT0iMTUuODkiIHgyPSIxMC45OCIgeTI9IjE1Ljg5IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2Y2YWFjYiIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM3NzJhOGQiLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC01IiB4MT0iMTkuMDMiIHkxPSIxNi44MiIgeDI9IjE0Ljc5IiB5Mj0iMTIuNTgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2VkMzQ4ZCIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTYiIHgxPSIxNS4yNyIgeTE9IjE1LjA2IiB4Mj0iMTUuMjciIHkyPSIxOS4zNyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmYiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWU0YzliIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNyIgeDE9IjUuNTEiIHkxPSItMTI4LjAyIiB4Mj0iLTMuNyIgeTI9Ii0xMjguMDIiIGdyYWRpZW50VHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwOS4xMiAxMC4wMSkgcm90YXRlKDg5LjYpIiB4bGluazpocmVmPSIjbGluZWFyLWdyYWRpZW50LTMiLz4KICA8L2RlZnM+CiAgPGcgY2xhc3M9ImNscy04IiBpZD0iTG9nbyI+CiAgICA8ZyBpZD0iT0JKRUNUUyIgPgogICAgICA8ZyBpZCA9IkxvZ28iPiAKICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTciIGQ9Ik00LjIzLDExYzAsNS4zNiw0LjM3LDkuNzEsOS43Niw5LjcxczkuNzYtNC4zNSw5Ljc2LTkuNzFTMTkuMzksMS4yOSwxNCwxLjI5LDQuMjMsNS42NCw0LjIzLDExWk0xMC4yNiwxMC4wN2MwLTEuNTQsMS4yNS0yLjc4LDIuOC0yLjc4aDEuODdjMS41NSwwLDIuOCwxLjI1LDIuOCwyLjc4djEuODZjMCwxLjU0LTEuMjUsMi43OC0yLjgsMi43OGgtMS4yMmMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NHYtNi45MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik0xMC4yNiwxNi45OXYtNi45MnMwLS4wMiwwLS4wM2MuMDItMS41MiwxLjI2LTIuNzUsMi44LTIuNzVoLTUuMDljLTIuMDUsMC0zLjczLDEuNjQtMy43NCwzLjY4LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA4LDAsLjE2LDAsLjI0LDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA0LDAsLjA4LDAsLjEyLDAsLjA2LDAsLjExLjAxLjE3LDAsLjAyLDAsLjA1LDAsLjA3LDAsLjA2LjAxLjEzLjAyLjE5LDAsLjAxLDAsLjAzLDAsLjA0LDAsLjA3LjAxLjE0LjAyLjIxLDAsMCwwLC4wMSwwLC4wMiwwLC4wNy4wMi4xNS4wMy4yMiwwLDAsMCwwLDAsMCwuNjgsNC42OCw0LjcxLDguMjcsOS42LDguMy0yLjA0LS4wMi0zLjY3LTEuNjktMy42Ny0zLjcyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTE0LjA0LDEuMjlzLS4wMywwLS4wNCwwYy0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTMuMDEtLjE5LjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNywwLS4xNC4wMS0uMjEuMDIsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNS4wMi0uMjIuMDMsMCwwLDAsMCwwLDAtNC43LjY4LTguMzIsNC42OS04LjM1LDkuNTQuMDItMi4wMiwxLjctMy42NSwzLjc0LTMuNjVoNi45NnMuMDIsMCwuMDMsMGMxLjUzLjAyLDIuNzcsMS4yNiwyLjc3LDIuNzh2LTUuMDZjMC0yLjA0LTEuNjUtMy43MS0zLjctMy43MloiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNC45MywxNC43MWg1LjA5YzIuMDQsMCwzLjcyLTEuNjMsMy43NC0zLjY1LS4wMyw0Ljg2LTMuNjUsOC44Ny04LjM1LDkuNTQsMCwwLDAsMCwwLDAtLjA3LjAxLS4xNS4wMi0uMjIuMDMsMCwwLS4wMSwwLS4wMiwwLS4wNywwLS4xNC4wMi0uMjEuMDItLjAxLDAtLjAzLDAtLjA0LDAtLjA2LDAtLjEzLjAxLS4xOS4wMi0uMDIsMC0uMDUsMC0uMDcsMC0uMDYsMC0uMTEsMC0uMTcsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDEsMC0uMDMsMC0uMDQsMC0yLjA1LDAtMy43LTEuNjgtMy43LTMuNzJsMi4yMy0xLjg0Yy4zNC0uMjguNzgtLjQ0LDEuMjItLjQ0aDEuMjJaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy01IiBkPSJNMTQuOTMsMTQuNzFoNS4wOWMyLjA0LDAsMy43Mi0xLjYzLDMuNzQtMy42NS0uMDMsNC44Ni0zLjY1LDguODctOC4zNSw5LjU0LDAsMCwwLDAsMCwwLS4wNy4wMS0uMTUuMDItLjIyLjAzLDAsMC0uMDEsMC0uMDIsMC0uMDcsMC0uMTQuMDItLjIxLjAyLS4wMSwwLS4wMywwLS4wNCwwLS4wNiwwLS4xMy4wMS0uMTkuMDItLjAyLDAtLjA1LDAtLjA3LDAtLjA2LDAtLjExLDAtLjE3LDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA0LDAtLjA4LDAtLjEyLDAtLjA4LDAtLjE2LDAtLjI0LDAtLjAxLDAtLjAzLDAtLjA0LDAtMi4wNSwwLTMuNy0xLjY4LTMuNy0zLjcybDIuMjMtMS44NGMuMzQtLjI4Ljc4LS40NCwxLjIyLS40NGgxLjIyWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtNCIgZD0iTTIwLjI4LDE0LjcxYy0uMDgsMC0uMTcsMC0uMjUsMGgtNi4zMWMtLjQ1LDAtLjg4LjE1LTEuMjIuNDRsLTIuMjMsMS44NGMwLC4wOCwwLC4xNywwLC4yNSwxLjA5LjY1LDIuMzcsMS4wMiwzLjczLDEuMDIsMi42NywwLDUuMDEtMS40Myw2LjI4LTMuNTVaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy02IiBkPSJNMjMuNzcsMTAuOTdzMC0uMDMsMC0uMDRjMC0uMDgsMC0uMTYsMC0uMjQsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDQsMC0uMDgsMC0uMTIsMC0uMDYsMC0uMTEtLjAxLS4xNywwLS4wMiwwLS4wNSwwLS4wNywwLS4wNi0uMDEtLjEzLS4wMi0uMTksMC0uMDEsMC0uMDMsMC0uMDQsMC0uMDctLjAyLS4xNC0uMDItLjIxLDAsMCwwLS4wMSwwLS4wMiwwLS4wNy0uMDItLjE1LS4wMy0uMjIsMCwwLDAsMCwwLDAtLjcxLTQuNjctNC43Ny04LjI0LTkuNjYtOC4yNCwyLjA0LDAsMy42OCwxLjY2LDMuNywzLjY5bC4wNCw1LjA2djEuODZzLjAxLjAyLjAxLjAzYzAsMS41Mi0xLjI1LDIuNzYtMi43OCwyLjc3bDUuMDktLjA0YzIuMDUtLjAxLDMuNzItMS42NiwzLjcxLTMuN1oiLz4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+",Rt=null,ae=!1;function me(){if(Rt||ae)return Rt;ae=!0;let t=new Image;return t.onload=()=>{Rt=t},t.src=Be,null}function Ge(){return Math.floor(Date.now()/864e5)}function qe(t){let o=(t^2654435769)>>>0;return function(){o=o+1831565813>>>0;let i=Math.imul(o^o>>>15,1|o);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}function Ke(t,o,i,s,p,e){let n=me();t.save(),t.setTransform(1,0,0,1,0,0),t.font="bold 10px Inter, system-ui, sans-serif";let r=t.measureText(s);t.font="8px Inter, system-ui, sans-serif";let a=t.measureText(p),u=n?18:0,l=n?14:0,g=7,f=5,d=n?5:0,c=u+d+Math.max(r.width,a.width)+g*2,h=Math.max(l,20)+f*2,w=Math.round(o-c/2),m=Math.round(i-h/2);t.globalAlpha=.45,t.fillStyle=e?"rgba(255,255,255,0.8)":"rgba(18,18,28,0.8)",t.shadowColor=e?"rgba(0,0,0,0.06)":"rgba(0,0,0,0.25)",t.shadowBlur=8,t.shadowOffsetY=1,t.beginPath(),t.roundRect(w,m,c,h,6),t.fill(),t.shadowColor="transparent",t.strokeStyle=e?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)",t.lineWidth=.5,t.stroke();let L=w+g,S=m+h/2;n&&(t.globalAlpha=.5,t.drawImage(n,L,S-l/2,u,l),L+=u+d),t.globalAlpha=.5,t.font="bold 10px Inter, system-ui, sans-serif",t.fillStyle=e?"#1a1a2e":"#ededf5",t.textAlign="left",t.textBaseline="alphabetic",t.fillText(s,L,S-1),t.font="8px Inter, system-ui, sans-serif",t.fillStyle=e?"#777790":"#8080a0",t.textBaseline="top",t.fillText(p,L,S+2),t.restore()}function Me(t,o,i,s){me();let p=o.width,e=o.height;if(p<100||e<80)return;t.save(),t.setTransform(1,0,0,1,0,0);let n=qe(Ge()),r=100,a=Math.max(p-r*2,60),u=Math.max(e-r*2,40),l=r+n()*a,g=r+n()*u,f=i.trialExpired||i.plan===ut,d=Ve,_=f?`Free \u2014 ${ne}/pricing`:`Trial: ${i.daysLeft||0}d left \u2014 ${ne}`;Ke(t,l,g,d,_,s),t.restore()}function Ue({plan:t,domain:o="*",expiryDays:i=365,name:s,email:p}){let e=i>0?Math.floor(Date.now()/1e3)+i*86400:0,n={p:t,d:o,e,...s?{n:s}:{},...p?{m:p}:{},i:Date.now()};return n.s=ge(n),btoa(JSON.stringify(n))}var Lt=null,St=null,_t=null;async function Le(){return Lt||_t||(_t=(async()=>{let t=await import("./chart_engine.js");return await t.default(),St=t.wasm_memory(),Lt=t,t})(),_t)}function Qe(){!Lt&&!_t&&Le().catch(()=>{})}async function xe(t,o={}){o.appId&&typeof window<"u"&&(window.__mrd_app_id=o.appId);let i=o.licenseKey||o.key||null,s=Mt(i);if(!s.valid)if(s.expired)console.warn(`[MRD Chart Engine] ${s.error}. Get a license at https://mrd-chart.dev/pricing`);else throw new Error(`[MRD Chart Engine] ${s.error}`);s.plan==="trial"&&console.info(`[MRD Chart Engine] Trial mode \u2014 ${s.daysLeft} days remaining. Purchase: https://mrd-chart.dev/pricing`);let p=await Le(),e=window.devicePixelRatio||1,n=t.getBoundingClientRect();(n.width<1||n.height<1)&&(await new Promise(M=>{let I=new ResizeObserver(A=>{for(let b of A)if(b.contentRect.width>0&&b.contentRect.height>0){I.disconnect(),M();return}});I.observe(t.parentElement||t),setTimeout(()=>{I.disconnect(),M()},2e3)}),n=t.getBoundingClientRect());let r=Math.max(n.width,100),a=Math.max(n.height,100);t.width=r*e,t.height=a*e;let u=t.getContext("2d");u.scale(e,e);let l=new p.ChartEngine(r,a);try{let M=s.expired?2:s.watermark?1:0,I=s.daysLeft||0,A=1297237059;A=Math.imul(A,31)+M>>>0,A=Math.imul(A,31)+I>>>0,A=(A^A>>>16)>>>0,A=Math.imul(A,73244475)>>>0,A=(A^A>>>16)>>>0,l.set_license_state(M,I,A)}catch(M){console.warn("[MRD] set_license_state failed:",M.message)}let g=!0,f=null,d=!1,_=!1,c=!1,h=null,w=null,m=0,L=!1,S=!1,N=("ontouchstart"in window||navigator.maxTouchPoints>0)&&window.innerWidth<=1399?33:0;function U(){if(!(!d||_||f)){if(N>0){let M=performance.now()-m;if(M<N){w||(w=setTimeout(()=>{w=null,U()},N-M));return}}f=requestAnimationFrame(Ce)}}let T=()=>{g=!0,U()},x=()=>c,$=null,ct=null,It=null,E=null,Z=null,W=null,H=null,O=null,st=0,J=null,Wt=null,Ct=0,At=0,k=-1,ht=!1,pt=!1,Se=yt(t,l,{onDirty:T,onCrosshairMove:(M,I,A)=>{Ct=M,At=I,k=A,ht=!0,pt=!0},onCrosshairHide:()=>{pt&&(pt=!1,ht=!0,k=-1)},drawingApi:M=>{$=M},onDrawingComplete:()=>{ct?.()},onDrawingCancel:()=>{It?.()},onDrawingSelected:(M,I,A)=>{E?.(M,I,A)},onMarkerSelected:M=>{Z?.(M)},onDrawingDblClick:(M,I,A,b,vt)=>{W?.(M,I,A,b,vt)},onVrvpHover:(M,I)=>{H?.(M,I)},onLiqAnnotationPin:(M,I)=>{Wt?.(M,I)}});function Ie(){if(!(!ht||S)){if(ht=!1,!pt){h&&h(null,0,0),O&&O("");return}if(h)if(k===0||k===1)try{let M=l.get_tooltip_data();h(M,Ct,At)}catch{}else h(null,0,0);if(O){let M=performance.now();if(k===0||k===1){if(M-st>=80){st=M;try{O(l.lt_hit_test(Ct,At))}catch{}}}else O("")}}}function Ce(){if(f=null,!(!d||_||S)){L=!0;try{let M=!1;try{M=g||l.is_dirty()}catch{S=!0;return}if(M){g=!1,m=performance.now();let I=!1;try{if(l.render()>0){let b=l.get_command_buffer_ptr(),vt=l.get_command_buffer_len();u.save(),u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,t.width,t.height),u.restore(),nt(u,St,b,vt),I=!0}try{Q.renderAll(u)}catch{}}catch(A){if(I||(g=!0),A instanceof WebAssembly.RuntimeError){S=!0,console.error("[MRD] Engine crashed:",A.message);return}}Ie();try{J?.()}catch{}if(s.watermark)try{let A=l.get_theme()===1;Me(u,t,s,A)}catch{}try{(g||l.is_dirty())&&U()}catch{}}}finally{L=!1}}}let it=Pt(s.plan),Ae=te(l,T,x,()=>it),ve=ee(l,T,x,()=>it),be=re(l,T,x,()=>it),Q=Nt(l,St,nt);return{engine:l,start(){d=!0,_=!1,g=!0,U()},stop(){d=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null)},resize(M){if(S||L)return;if(n=t.getBoundingClientRect(),n.width<1||n.height<1){(M||0)<8&&setTimeout(()=>this.resize((M||0)+1),250);return}e=window.devicePixelRatio||1;let I=n.width*e,A=n.height*e;t.width=I,t.height=A,u.setTransform(1,0,0,1,0,0),u.scale(e,e);try{l.resize(n.width,n.height)}catch(b){if(b instanceof WebAssembly.RuntimeError){S=!0;return}throw b}T()},renderSync(){if(S)return 0;try{let M=l.render();if(M>0){let I=l.get_command_buffer_ptr(),A=l.get_command_buffer_len();u.save(),u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,t.width,t.height),u.restore(),nt(u,St,I,A)}return M}catch(M){return M instanceof WebAssembly.RuntimeError&&(S=!0),0}},setHoverPrice(M){l.set_hover_price(M),T()},clearHoverPrice(){l.clear_hover_price(),T()},hitZone(M,I){return l.hit_zone(M,I)},startDrawing(M,I){$?.setMode(M,I)},cancelDrawing(){$?.setMode(null)},onDrawingComplete(M){ct=M},onDrawingCancel(M){It=M},onDrawingSelected(M){E=M},onMarkerSelected(M){Z=M},onDrawingDblClick(M){W=M},setReplayState(M,I,A){l.set_replay_state(M,I,A),T()},setReplayHovered(M){l.set_replay_hovered(M)},setReplayPreview(M){l.set_replay_preview(M),T()},setPrecision(M){l.set_price_precision(M),T()},setCandleInterval(M){l.set_candle_interval(M)},setTheme(M){let I=M==="light"?1:0;typeof l.set_theme=="function"?(l.set_theme(I),T()):console.warn("[ChartEngine] set_theme not available \u2014 reload page to load updated WASM")},getTheme(){return l.get_theme()===1?"light":"dark"},onTooltip(M){h=M},onVrvpHover(M){H=M},onLtHover(M){O=M},onPostRender(M){J=M},onLiqAnnotationPin(M){Wt=M},pause(){_||(_=!0,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null))},resume(){_&&(_=!1,d&&(g=!0,U()))},get isPaused(){return _},destroy(){c=!0,d=!1,_=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null),Se();try{l.free()}catch{}},addIndicator(M){if(!it("customIndicators"))return null;let I=Q.add(M);return T(),I},removeIndicator(M){Q.remove(M),T()},updateIndicatorParams(M,I){Q.updateParams(M,I),T()},setIndicatorEnabled(M,I){Q.setEnabled(M,I),T()},listIndicators(){return Q.list()},invalidateCustomIndicators(){Q.invalidateCompute(),T()},get license(){return{plan:s.plan,valid:s.valid,expired:!!s.expired,watermark:!!s.watermark,daysLeft:s.daysLeft,features:s.features||{}}},setLicenseKey(M){s=Mt(M),!s.valid&&!s.expired&&console.error(`[MRD Chart Engine] ${s.error}`),it=Pt(s.plan);try{let I=s.expired?2:s.watermark?1:0,A=s.daysLeft||0,b=1297237059;b=Math.imul(b,31)+I>>>0,b=Math.imul(b,31)+A>>>0,b=(b^b>>>16)>>>0,b=Math.imul(b,73244475)>>>0,b=(b^b>>>16)>>>0,l.set_license_state(I,A,b)}catch{}return T(),s.valid},...be,...Ae,...ve}}function $e(t,o){let{t:i,o:s,h:p,l:e,c:n,v:r}=t,a=n.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let u=[],l=[],g=[],f=[],d=[],_=[],c=Math.round(n[0]/o)*o,h=0;for(let w=0;w<a;w++){h+=r[w];let L=n[w]-c;for(;L>=o;){let S=c,C=c+o;u.push(i[w]),l.push(S),g.push(C),f.push(S),d.push(C),_.push(h),h=0,c=C}for(;-L>=o;){let S=c,C=c-o;u.push(i[w]),l.push(S),g.push(S),f.push(C),d.push(C),_.push(h),h=0,c=C}}return{t:u,o:l,h:g,l:f,c:d,v:_}}function Je(t,o){let{t:i,o:s,h:p,l:e,c:n,v:r}=t,a=n.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let u=[],l=[],g=[],f=[],d=[],_=[],c=s[0],h=p[0],w=e[0],m=0,L=i[0];for(let S=0;S<a;S++)for(h=Math.max(h,p[S]),w=Math.min(w,e[S]),m+=r[S];h-w>=o;){let C=n[S]>=c,N=C?w+o:h-o;if(u.push(L),l.push(c),g.push(h),f.push(w),d.push(N),_.push(m),c=N,h=C?Math.max(p[S],N):N,w=C?N:Math.min(e[S],N),m=0,L=i[S],h-w<o)break}return(m>0||u.length===0)&&(u.push(L),l.push(c),g.push(h),f.push(w),d.push(n[a-1]),_.push(m)),{t:u,o:l,h:g,l:f,c:d,v:_}}function ke(t,o){let{t:i,o:s,h:p,l:e,c:n,v:r}=t,a=n.length;if(a===0||o<=0)return{t:[],o:[],h:[],l:[],c:[],v:[]};let u=[],l=[],g=[],f=[],d=[],_=[],c=Math.max(1,Math.round(o));for(let h=0;h<a;h+=c){let w=Math.min(h+c,a),m=-1/0,L=1/0,S=0;for(let C=h;C<w;C++)p[C]>m&&(m=p[C]),e[C]<L&&(L=e[C]),S+=r[C];u.push(i[h]),l.push(s[h]),g.push(m),f.push(L),d.push(n[w-1]),_.push(S)}return{t:u,o:l,h:g,l:f,c:d,v:_}}function tr(t,o){let i=t>1e4?50:t>1e3?10:t>100?1:t>1?.1:.001,s=i*2,p=o<=60?10:o<=300?5:3;return{brickSize:i,rangeSize:s,tickCount:p}}var er={minRefills:3,hiddenRatio:2,refillWindowMs:1e4,maxTrackedLevels:200,maxEvents:500,decayMs:3e5};function rr(t={}){let o={...er,...t},i=new Map,s=new Map,p=[],e=0;function n(f){return Math.round(f*1e8)/1e8}function r(f,d,_,c){for(let[h,w]of f){let m=n(h),L=d.get(m);if(!L){d.set(m,{lastVol:w,refills:0,totalConsumed:0,lastRefillTs:c,peakVisible:w});continue}if(w<L.lastVol*.3&&L.lastVol>0){let S=L.lastVol-w;L.totalConsumed+=S,L.lastVol=w;continue}if(w>L.lastVol*1.5&&L.totalConsumed>0)if(c-L.lastRefillTs<o.refillWindowMs){if(L.refills++,L.lastRefillTs=c,L.peakVisible=Math.max(L.peakVisible,w),L.refills>=o.minRefills){let C=L.totalConsumed,N=L.peakVisible;C>=N*o.hiddenRatio&&(p.push({timestamp:c,price:h,visibleSize:N,hiddenSize:C,isBid:_,refillCount:L.refills}),p.length>o.maxEvents&&p.shift(),L.refills=0,L.totalConsumed=0)}}else L.refills=1,L.totalConsumed=0,L.lastRefillTs=c;L.lastVol=w}if(d.size>o.maxTrackedLevels){let h=[...d.entries()];h.sort((m,L)=>m[1].lastRefillTs-L[1].lastRefillTs);let w=h.length-o.maxTrackedLevels;for(let m=0;m<w;m++)d.delete(h[m][0])}}function a(f,d,_){let c=_||Date.now();e=c;let h=f instanceof Map?f:new Map(f.map(([L,S])=>[L,S])),w=d instanceof Map?d:new Map(d.map(([L,S])=>[L,S]));r(h,i,!0,c),r(w,s,!1,c);let m=c-o.decayMs;for(;p.length>0&&p[0].timestamp<m;)p.shift()}function u(){return p}function l(f){if(!f||p.length===0)return;let d=p.length,_=new Float64Array(d),c=new Float64Array(d),h=new Float64Array(d),w=new Float64Array(d),m=new Uint8Array(d),L=new Uint32Array(d);for(let S=0;S<d;S++){let C=p[S];_[S]=C.timestamp,c[S]=C.price,h[S]=C.visibleSize,w[S]=C.hiddenSize,m[S]=C.isBid?1:0,L[S]=C.refillCount}f.setIcebergEvents(_,c,h,w,m,L)}function g(){i.clear(),s.clear(),p.length=0}return{onOrderbookUpdate:a,getEvents:u,pushToEngine:l,reset:g}}export{Je as buildRange,$e as buildRenko,ke as buildTick,xe as createChartBridge,Nt as createCustomIndicatorManager,rr as createIcebergDetector,nt as dispatchCommands,Ue as generateLicenseKey,Qe as prefetchWasm,yt as setupEvents,tr as suggestDefaults,Mt as validateLicense};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kline-orderbook-chart",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Candlestick chart with built-in orderbook heatmap, footprint chart, and liquidation heatmap. Native high-performance engine. 60 fps, zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/mrd-chart-engine.mjs",
|