kline-orderbook-chart 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- class E{__destroy_into_raw(){const _=this.__wbg_ptr;return this.__wbg_ptr=0,L.unregister(this),_}free(){const _=this.__destroy_into_raw();t.__wbg_chartengine_free(_,0)}add_anchored_vwap(_,e,r,n,i,s,a){return t.chartengine_add_anchored_vwap(this.__wbg_ptr,_,e,r,n,i,s,a)>>>0}add_arrow(_,e,r,n,i,s,a,o,c,p){return t.chartengine_add_arrow(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p)>>>0}add_arrow_marker_down(_,e,r,n,i,s,a){return t.chartengine_add_arrow_marker_down(this.__wbg_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.__wbg_ptr,_,e,r,n,i,s,a)>>>0}add_brush_point(_,e){t.chartengine_add_brush_point(this.__wbg_ptr,_,e)}add_circle(_,e,r,n,i,s,a,o,c,p){return t.chartengine_add_circle(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p)>>>0}add_elliott_impulse(_,e,r,n,i,s,a){return t.chartengine_add_elliott_impulse(this.__wbg_ptr,_,e,r,n,i,s,a)>>>0}add_elliott_manual_point(_,e){return t.chartengine_add_elliott_manual_point(this.__wbg_ptr,_,e)!==0}add_fib_extension(_,e,r,n,i,s,a,o,c,p,d,b){return t.chartengine_add_fib_extension(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p,d,b)>>>0}add_fib_retracement(_,e,r,n,i,s,a,o,c,p){return t.chartengine_add_fib_retracement(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p)>>>0}add_horizontal_line(_,e,r,n,i,s,a,o){return t.chartengine_add_horizontal_line(this.__wbg_ptr,_,e,r,n,i,s,a,o)>>>0}add_long_position(_,e,r,n,i,s,a,o,c,p){return t.chartengine_add_long_position(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p)>>>0}add_marker(_,e,r){t.chartengine_add_marker(this.__wbg_ptr,_,e,r)}add_parallel_channel(_,e,r,n,i,s,a,o,c,p,d,b){return t.chartengine_add_parallel_channel(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p,d,b)>>>0}add_path_point(_,e){t.chartengine_add_path_point(this.__wbg_ptr,_,e)}add_price_label(_,e,r,n,i,s,a){return t.chartengine_add_price_label(this.__wbg_ptr,_,e,r,n,i,s,a)>>>0}add_price_range(_,e,r,n,i,s,a,o,c,p){return t.chartengine_add_price_range(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p)>>>0}add_short_position(_,e,r,n,i,s,a,o,c,p){return t.chartengine_add_short_position(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p)>>>0}add_text_note(_,e,r,n,i,s,a){return t.chartengine_add_text_note(this.__wbg_ptr,_,e,r,n,i,s,a)>>>0}add_trendline(_,e,r,n,i,s,a,o,c,p){return t.chartengine_add_trendline(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p)>>>0}append_heatmap_column(_,e,r,n){const i=l(_,t.__wbindgen_export),s=h;t.chartengine_append_heatmap_column(this.__wbg_ptr,i,s,e,r,n)}append_kline(_,e,r,n,i,s){t.chartengine_append_kline(this.__wbg_ptr,_,e,r,n,i,s)}append_real_timestamp(_){t.chartengine_append_real_timestamp(this.__wbg_ptr,_)}cancel_brush(){t.chartengine_cancel_brush(this.__wbg_ptr)}cancel_elliott_manual(){t.chartengine_cancel_elliott_manual(this.__wbg_ptr)}cancel_path(){t.chartengine_cancel_path(this.__wbg_ptr)}chart_area_h(){return t.chartengine_chart_area_h(this.__wbg_ptr)}chart_area_w(){return t.chartengine_chart_area_w(this.__wbg_ptr)}chart_area_x(){return t.chartengine_chart_area_x(this.__wbg_ptr)}chart_area_y(){return t.chartengine_chart_area_y(this.__wbg_ptr)}clear_channel_preview(){t.chartengine_clear_channel_preview(this.__wbg_ptr)}clear_drawing_preview(){t.chartengine_clear_drawing_preview(this.__wbg_ptr)}clear_drawings(){t.chartengine_clear_drawings(this.__wbg_ptr)}clear_elliott_preview(){t.chartengine_clear_elliott_preview(this.__wbg_ptr)}clear_fib_ext_preview(){t.chartengine_clear_fib_ext_preview(this.__wbg_ptr)}clear_heatmap_prefetch_range(){t.chartengine_clear_heatmap_prefetch_range(this.__wbg_ptr)}clear_hover_price(){t.chartengine_clear_hover_price(this.__wbg_ptr)}clear_large_trades(){t.chartengine_clear_large_trades(this.__wbg_ptr)}clear_live_signals(){t.chartengine_clear_live_signals(this.__wbg_ptr)}clear_markers(){t.chartengine_clear_markers(this.__wbg_ptr)}custom_band(_,e,r,n,i,s){const a=l(_,t.__wbindgen_export),o=h,c=l(e,t.__wbindgen_export),p=h;t.chartengine_custom_band(this.__wbg_ptr,a,o,c,p,r,n,i,s)}custom_begin(){t.chartengine_custom_begin(this.__wbg_ptr)}custom_circle_px(_,e,r,n,i,s,a,o,c,p,d,b){t.chartengine_custom_circle_px(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p,d,b)}custom_clip_rect(_,e,r,n){t.chartengine_custom_clip_rect(this.__wbg_ptr,_,e,r,n)}custom_command_count(){return t.chartengine_custom_command_count(this.__wbg_ptr)>>>0}custom_dashed_hline(_,e,r,n,i,s,a,o){t.chartengine_custom_dashed_hline(this.__wbg_ptr,_,e,r,n,i,s,a,o)}custom_end(){t.chartengine_custom_end(this.__wbg_ptr)}custom_fill_rect_px(_,e,r,n,i,s,a,o){t.chartengine_custom_fill_rect_px(this.__wbg_ptr,_,e,r,n,i,s,a,o)}custom_hline(_,e,r,n,i,s){t.chartengine_custom_hline(this.__wbg_ptr,_,e,r,n,i,s)}custom_line_px(_,e,r,n,i,s,a,o,c){t.chartengine_custom_line_px(this.__wbg_ptr,_,e,r,n,i,s,a,o,c)}custom_marker(_,e,r,n,i,s,a){t.chartengine_custom_marker(this.__wbg_ptr,_,e,r,n,i,s,a)}custom_marker_down(_,e,r,n,i,s,a){t.chartengine_custom_marker_down(this.__wbg_ptr,_,e,r,n,i,s,a)}custom_marker_up(_,e,r,n,i,s,a){t.chartengine_custom_marker_up(this.__wbg_ptr,_,e,r,n,i,s,a)}custom_price_label(_,e,r,n,i,s,a){const o=z(e,t.__wbindgen_export,t.__wbindgen_export2),c=h;t.chartengine_custom_price_label(this.__wbg_ptr,_,o,c,r,n,i,s,a)}custom_restore(){t.chartengine_custom_restore(this.__wbg_ptr)}custom_save(){t.chartengine_custom_save(this.__wbg_ptr)}custom_series_dashed_line(_,e,r,n,i,s,a,o){const c=l(_,t.__wbindgen_export),p=h;t.chartengine_custom_series_dashed_line(this.__wbg_ptr,c,p,e,r,n,i,s,a,o)}custom_series_line(_,e,r,n,i,s){const a=l(_,t.__wbindgen_export),o=h;t.chartengine_custom_series_line(this.__wbg_ptr,a,o,e,r,n,i,s)}custom_stroke_rect_px(_,e,r,n,i,s,a,o,c){t.chartengine_custom_stroke_rect_px(this.__wbg_ptr,_,e,r,n,i,s,a,o,c)}custom_text(_,e,r,n,i,s,a,o,c){const p=z(r,t.__wbindgen_export,t.__wbindgen_export2),d=h;t.chartengine_custom_text(this.__wbg_ptr,_,e,p,d,n,i,s,a,o,c)}custom_text_px(_,e,r,n,i,s,a,o,c){const p=z(r,t.__wbindgen_export,t.__wbindgen_export2),d=h;t.chartengine_custom_text_px(this.__wbg_ptr,_,e,p,d,n,i,s,a,o,c)}deselect_drawing(){t.chartengine_deselect_drawing(this.__wbg_ptr)}deselect_marker(){t.chartengine_deselect_marker(this.__wbg_ptr)}disable_cvd(){t.chartengine_disable_cvd(this.__wbg_ptr)}disable_ema_structure(){t.chartengine_disable_ema_structure(this.__wbg_ptr)}disable_forex_signals(){t.chartengine_disable_forex_signals(this.__wbg_ptr)}disable_funding_rate(){t.chartengine_disable_funding_rate(this.__wbg_ptr)}disable_large_trades(){t.chartengine_disable_large_trades(this.__wbg_ptr)}disable_liq_heatmap(){t.chartengine_disable_liq_heatmap(this.__wbg_ptr)}disable_live_signals(){t.chartengine_disable_live_signals(this.__wbg_ptr)}disable_oi(){t.chartengine_disable_oi(this.__wbg_ptr)}disable_rsi(){t.chartengine_disable_rsi(this.__wbg_ptr)}disable_smart_ranges(){t.chartengine_disable_smart_ranges(this.__wbg_ptr)}disable_tpo(){t.chartengine_disable_tpo(this.__wbg_ptr)}disable_volume(){t.chartengine_disable_volume(this.__wbg_ptr)}disable_vrvp(){t.chartengine_disable_vrvp(this.__wbg_ptr)}drawing_count(){return t.chartengine_drawing_count(this.__wbg_ptr)>>>0}enable_cvd(){t.chartengine_enable_cvd(this.__wbg_ptr)}enable_ema_structure(){t.chartengine_enable_ema_structure(this.__wbg_ptr)}enable_forex_signals(){t.chartengine_enable_forex_signals(this.__wbg_ptr)}enable_funding_rate(){t.chartengine_enable_funding_rate(this.__wbg_ptr)}enable_large_trades(){t.chartengine_enable_large_trades(this.__wbg_ptr)}enable_liq_heatmap(){t.chartengine_enable_liq_heatmap(this.__wbg_ptr)}enable_live_signals(){t.chartengine_enable_live_signals(this.__wbg_ptr)}enable_oi(){t.chartengine_enable_oi(this.__wbg_ptr)}enable_rsi(){t.chartengine_enable_rsi(this.__wbg_ptr)}enable_smart_ranges(){t.chartengine_enable_smart_ranges(this.__wbg_ptr)}enable_tpo(){t.chartengine_enable_tpo(this.__wbg_ptr)}enable_volume(){t.chartengine_enable_volume(this.__wbg_ptr)}enable_vrvp(){t.chartengine_enable_vrvp(this.__wbg_ptr)}export_drawings_json(){let _,e;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_export_drawings_json(i,this.__wbg_ptr);var r=w().getInt32(i+4*0,!0),n=w().getInt32(i+4*1,!0);return _=r,e=n,u(r,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}}finish_brush(){return t.chartengine_finish_brush(this.__wbg_ptr)>>>0}finish_elliott_manual(){return t.chartengine_finish_elliott_manual(this.__wbg_ptr)>>>0}finish_path(){return t.chartengine_finish_path(this.__wbg_ptr)>>>0}fit_content(){t.chartengine_fit_content(this.__wbg_ptr)}footprint_add_trade(_,e,r,n){t.chartengine_footprint_add_trade(this.__wbg_ptr,_,e,r,n)}footprint_add_trade_batch(_){const e=l(_,t.__wbindgen_export),r=h;t.chartengine_footprint_add_trade_batch(this.__wbg_ptr,e,r)}footprint_clear(){t.chartengine_footprint_clear(this.__wbg_ptr)}footprint_clear_bar(_){t.chartengine_footprint_clear_bar(this.__wbg_ptr,_)}footprint_ensure_len(_){t.chartengine_footprint_ensure_len(this.__wbg_ptr,_)}footprint_get_show_profile(){return t.chartengine_footprint_get_show_profile(this.__wbg_ptr)!==0}footprint_get_show_signals(){return t.chartengine_footprint_get_show_signals(this.__wbg_ptr)!==0}footprint_prepend_empty(_){t.chartengine_footprint_prepend_empty(this.__wbg_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.__wbg_ptr,_,e);var i=w().getInt32(a+4*0,!0),s=w().getInt32(a+4*1,!0);return r=i,n=s,u(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=l(r,t.__wbindgen_export),a=h,o=l(n,t.__wbindgen_export),c=h,p=l(i,t.__wbindgen_export),d=h;t.chartengine_footprint_set_bar(this.__wbg_ptr,_,e,s,a,o,c,p,d)}footprint_set_show_profile(_){t.chartengine_footprint_set_show_profile(this.__wbg_ptr,_)}footprint_set_show_signals(_){t.chartengine_footprint_set_show_signals(this.__wbg_ptr,_)}footprint_signal_count(){return t.chartengine_footprint_signal_count(this.__wbg_ptr)>>>0}get_chart_type(){return t.chartengine_get_chart_type(this.__wbg_ptr)}get_command_buffer_len(){return t.chartengine_get_command_buffer_len(this.__wbg_ptr)>>>0}get_command_buffer_ptr(){return t.chartengine_get_command_buffer_ptr(this.__wbg_ptr)>>>0}get_custom_buffer_len(){return t.chartengine_get_custom_buffer_len(this.__wbg_ptr)>>>0}get_custom_buffer_ptr(){return t.chartengine_get_custom_buffer_ptr(this.__wbg_ptr)>>>0}get_cvd_mode(){return t.chartengine_get_cvd_mode(this.__wbg_ptr)}get_cvd_ratio(){return t.chartengine_get_cvd_ratio(this.__wbg_ptr)}get_cvd_show_delta(){return t.chartengine_get_cvd_show_delta(this.__wbg_ptr)!==0}get_drawing_color(_){return t.chartengine_get_drawing_color(this.__wbg_ptr,_)>>>0}get_drawing_dashed(_){return t.chartengine_get_drawing_dashed(this.__wbg_ptr,_)!==0}get_drawing_font_size(_){return t.chartengine_get_drawing_font_size(this.__wbg_ptr,_)}get_drawing_hide_label(_){return t.chartengine_get_drawing_hide_label(this.__wbg_ptr,_)!==0}get_drawing_kind_id(_){return t.chartengine_get_drawing_kind_id(this.__wbg_ptr,_)}get_drawing_text(_){let e,r;try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_drawing_text(s,this.__wbg_ptr,_);var n=w().getInt32(s+4*0,!0),i=w().getInt32(s+4*1,!0);return e=n,r=i,u(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.__wbg_ptr)>>>0}get_fr_ratio(){return t.chartengine_get_fr_ratio(this.__wbg_ptr)}get_heatmap_data_max(){return t.chartengine_get_heatmap_data_max(this.__wbg_ptr)}get_heatmap_data_min(){return t.chartengine_get_heatmap_data_min(this.__wbg_ptr)}get_heatmap_last_timestamp(){return t.chartengine_get_heatmap_last_timestamp(this.__wbg_ptr)}get_heatmap_prefetch_max(){return t.chartengine_get_heatmap_prefetch_max(this.__wbg_ptr)}get_heatmap_x_step(){return t.chartengine_get_heatmap_x_step(this.__wbg_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.__wbg_ptr);var r=w().getInt32(i+4*0,!0),n=w().getInt32(i+4*1,!0);return _=r,e=n,u(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.__wbg_ptr)}get_liq_heatmap_cell_height(){return t.chartengine_get_liq_heatmap_cell_height(this.__wbg_ptr)}get_liq_heatmap_filled_pct(){return t.chartengine_get_liq_heatmap_filled_pct(this.__wbg_ptr)}get_liq_heatmap_max(){return t.chartengine_get_liq_heatmap_max(this.__wbg_ptr)}get_liq_heatmap_min(){return t.chartengine_get_liq_heatmap_min(this.__wbg_ptr)}get_liq_heatmap_seg_max(){return t.chartengine_get_liq_heatmap_seg_max(this.__wbg_ptr)}get_live_signals_count(){return t.chartengine_get_live_signals_count(this.__wbg_ptr)>>>0}get_live_signals_leverage(){return t.chartengine_get_live_signals_leverage(this.__wbg_ptr)}get_lt_data_max_vol(){return t.chartengine_get_lt_data_max_vol(this.__wbg_ptr)}get_lt_data_min_vol(){return t.chartengine_get_lt_data_min_vol(this.__wbg_ptr)}get_oi_ratio(){return t.chartengine_get_oi_ratio(this.__wbg_ptr)}get_rsi_ratio(){return t.chartengine_get_rsi_ratio(this.__wbg_ptr)}get_selected_drawing(){return t.chartengine_get_selected_drawing(this.__wbg_ptr)>>>0}get_selected_marker(){return t.chartengine_get_selected_marker(this.__wbg_ptr)>>>0}get_sr_signals_count(){return t.chartengine_get_sr_signals_count(this.__wbg_ptr)>>>0}get_theme(){return t.chartengine_get_theme(this.__wbg_ptr)}get_tooltip_data(){let _,e;try{const i=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_get_tooltip_data(i,this.__wbg_ptr);var r=w().getInt32(i+4*0,!0),n=w().getInt32(i+4*1,!0);return _=r,e=n,u(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.__wbg_ptr)>>>0}get_volume_color_mode(){return t.chartengine_get_volume_color_mode(this.__wbg_ptr)}get_volume_ma_period(){return t.chartengine_get_volume_ma_period(this.__wbg_ptr)>>>0}get_volume_show_ma(){return t.chartengine_get_volume_show_ma(this.__wbg_ptr)!==0}get_volume_show_signals(){return t.chartengine_get_volume_show_signals(this.__wbg_ptr)!==0}hide_crosshair(){t.chartengine_hide_crosshair(this.__wbg_ptr)}hit_test_drawing(_,e){return t.chartengine_hit_test_drawing(this.__wbg_ptr,_,e)>>>0}hit_test_drawing_anchor(_,e){return t.chartengine_hit_test_drawing_anchor(this.__wbg_ptr,_,e)}hit_test_marker(_,e){return t.chartengine_hit_test_marker(this.__wbg_ptr,_,e)>>>0}hit_zone(_,e){return t.chartengine_hit_zone(this.__wbg_ptr,_,e)}hover_hit_test(_,e){try{const s=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_hover_hit_test(s,this.__wbg_ptr,_,e);var r=w().getInt32(s+4*0,!0),n=w().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=h;t.chartengine_import_drawings_json(this.__wbg_ptr,e,r)}is_cvd_enabled(){return t.chartengine_is_cvd_enabled(this.__wbg_ptr)!==0}is_dirty(){return t.chartengine_is_dirty(this.__wbg_ptr)!==0}is_ema_structure_enabled(){return t.chartengine_is_ema_structure_enabled(this.__wbg_ptr)!==0}is_forex_signals_enabled(){return t.chartengine_is_forex_signals_enabled(this.__wbg_ptr)!==0}is_funding_rate_enabled(){return t.chartengine_is_funding_rate_enabled(this.__wbg_ptr)!==0}is_large_trades_enabled(){return t.chartengine_is_large_trades_enabled(this.__wbg_ptr)!==0}is_liq_heatmap_enabled(){return t.chartengine_is_liq_heatmap_enabled(this.__wbg_ptr)!==0}is_liq_heatmap_filled_zones(){return t.chartengine_is_liq_heatmap_filled_zones(this.__wbg_ptr)!==0}is_liq_heatmap_predictions(){return t.chartengine_is_liq_heatmap_predictions(this.__wbg_ptr)!==0}is_liq_heatmap_profile(){return t.chartengine_is_liq_heatmap_profile(this.__wbg_ptr)!==0}is_live_signals_enabled(){return t.chartengine_is_live_signals_enabled(this.__wbg_ptr)!==0}is_oi_enabled(){return t.chartengine_is_oi_enabled(this.__wbg_ptr)!==0}is_rsi_enabled(){return t.chartengine_is_rsi_enabled(this.__wbg_ptr)!==0}is_rsi_show_traps(){return t.chartengine_is_rsi_show_traps(this.__wbg_ptr)!==0}is_smart_ranges_enabled(){return t.chartengine_is_smart_ranges_enabled(this.__wbg_ptr)!==0}is_tpo_enabled(){return t.chartengine_is_tpo_enabled(this.__wbg_ptr)!==0}is_tpo_signals(){return t.chartengine_is_tpo_signals(this.__wbg_ptr)!==0}is_volume_enabled(){return t.chartengine_is_volume_enabled(this.__wbg_ptr)!==0}is_vrvp_enabled(){return t.chartengine_is_vrvp_enabled(this.__wbg_ptr)!==0}kline_closes(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_closes(n,this.__wbg_ptr);var _=w().getInt32(n+4*0,!0),e=w().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.__wbg_ptr)>>>0}kline_highs(){try{const n=t.__wbindgen_add_to_stack_pointer(-16);t.chartengine_kline_highs(n,this.__wbg_ptr);var _=w().getInt32(n+4*0,!0),e=w().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.__wbg_ptr);var _=w().getInt32(n+4*0,!0),e=w().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.__wbg_ptr);var _=w().getInt32(n+4*0,!0),e=w().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.__wbg_ptr);var _=w().getInt32(n+4*0,!0),e=w().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.__wbg_ptr);var _=w().getInt32(n+4*0,!0),e=w().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.__wbg_ptr,_,e);var i=w().getInt32(a+4*0,!0),s=w().getInt32(a+4*1,!0);return r=i,n=s,u(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.__wbg_ptr,_,e);var i=w().getInt32(a+4*0,!0),s=w().getInt32(a+4*1,!0);return r=i,n=s,u(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.__wbg_ptr,_,e);var i=w().getInt32(a+4*0,!0),s=w().getInt32(a+4*1,!0);return r=i,n=s,u(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.__wbg_ptr,_,e);var i=w().getInt32(a+4*0,!0),s=w().getInt32(a+4*1,!0);return r=i,n=s,u(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.__wbg_ptr,_,e);var i=w().getInt32(a+4*0,!0),s=w().getInt32(a+4*1,!0);return r=i,n=s,u(i,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(r,n,1)}}move_drawing(_,e){t.chartengine_move_drawing(this.__wbg_ptr,_,e)}constructor(_,e){const r=t.chartengine_new(_,e);return this.__wbg_ptr=r>>>0,L.register(this,this.__wbg_ptr,this),this}oi_to_screen_y(_){return t.chartengine_oi_to_screen_y(this.__wbg_ptr,_)}pan(_,e){t.chartengine_pan(this.__wbg_ptr,_,e)}pan_x(_){t.chartengine_pan_x(this.__wbg_ptr,_)}pan_y(_){t.chartengine_pan_y(this.__wbg_ptr,_)}pop_last_kline(){return t.chartengine_pop_last_kline(this.__wbg_ptr)!==0}prepend_klines(_,e,r,n,i,s){const a=l(_,t.__wbindgen_export),o=h,c=l(e,t.__wbindgen_export),p=h,d=l(r,t.__wbindgen_export),b=h,y=l(n,t.__wbindgen_export),W=h,O=l(i,t.__wbindgen_export),F=h,R=l(s,t.__wbindgen_export),S=h;t.chartengine_prepend_klines(this.__wbg_ptr,a,o,c,p,d,b,y,W,O,F,R,S)}push_large_trade(_,e,r,n){t.chartengine_push_large_trade(this.__wbg_ptr,_,e,r,n)}remove_drawing(_){t.chartengine_remove_drawing(this.__wbg_ptr,_)}remove_marker(_){t.chartengine_remove_marker(this.__wbg_ptr,_)}render(){return t.chartengine_render(this.__wbg_ptr)>>>0}resize(_,e){t.chartengine_resize(this.__wbg_ptr,_,e)}rsi_to_screen_y(_){return t.chartengine_rsi_to_screen_y(this.__wbg_ptr,_)}screen_to_cvd_y(_){return t.chartengine_screen_to_cvd_y(this.__wbg_ptr,_)}screen_to_fr_y(_){return t.chartengine_screen_to_fr_y(this.__wbg_ptr,_)}screen_to_oi_y(_){return t.chartengine_screen_to_oi_y(this.__wbg_ptr,_)}screen_to_rsi_y(_){return t.chartengine_screen_to_rsi_y(this.__wbg_ptr,_)}screen_to_world_x(_){return t.chartengine_screen_to_world_x(this.__wbg_ptr,_)}screen_to_world_y(_){return t.chartengine_screen_to_world_y(this.__wbg_ptr,_)}select_drawing(_){t.chartengine_select_drawing(this.__wbg_ptr,_)}select_marker(_){t.chartengine_select_marker(this.__wbg_ptr,_)}set_candle_interval(_){t.chartengine_set_candle_interval(this.__wbg_ptr,_)}set_channel_preview(_,e,r,n,i,s,a,o,c,p,d,b){t.chartengine_set_channel_preview(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p,d,b)}set_chart_type(_){t.chartengine_set_chart_type(this.__wbg_ptr,_)}set_crosshair(_,e){t.chartengine_set_crosshair(this.__wbg_ptr,_,e)}set_cvd_data(_,e){const r=l(_,t.__wbindgen_export),n=h,i=l(e,t.__wbindgen_export),s=h;t.chartengine_set_cvd_data(this.__wbg_ptr,r,n,i,s)}set_cvd_mode(_){t.chartengine_set_cvd_mode(this.__wbg_ptr,_)}set_cvd_ratio(_){t.chartengine_set_cvd_ratio(this.__wbg_ptr,_)}set_cvd_show_delta(_){t.chartengine_set_cvd_show_delta(this.__wbg_ptr,_)}set_drawing_dashed(_,e){t.chartengine_set_drawing_dashed(this.__wbg_ptr,_,e)}set_drawing_font_size(_,e){t.chartengine_set_drawing_font_size(this.__wbg_ptr,_,e)}set_drawing_hide_label(_,e){t.chartengine_set_drawing_hide_label(this.__wbg_ptr,_,e)}set_drawing_preview(_,e,r,n,i,s,a,o,c,p,d){t.chartengine_set_drawing_preview(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p,d)}set_drawing_style(_,e,r,n,i){t.chartengine_set_drawing_style(this.__wbg_ptr,_,e,r,n,i)}set_drawing_text(_,e){const r=z(e,t.__wbindgen_export,t.__wbindgen_export2),n=h;t.chartengine_set_drawing_text(this.__wbg_ptr,_,r,n)}set_elliott_manual_cursor(_,e){t.chartengine_set_elliott_manual_cursor(this.__wbg_ptr,_,e)}set_elliott_preview(_,e,r,n,i,s,a){t.chartengine_set_elliott_preview(this.__wbg_ptr,_,e,r,n,i,s,a)}set_es_ema1_len(_){t.chartengine_set_es_ema1_len(this.__wbg_ptr,_)}set_es_ema2_len(_){t.chartengine_set_es_ema2_len(this.__wbg_ptr,_)}set_es_show_bos(_){t.chartengine_set_es_show_bos(this.__wbg_ptr,_)}set_es_show_ema1(_){t.chartengine_set_es_show_ema1(this.__wbg_ptr,_)}set_es_show_ema2(_){t.chartengine_set_es_show_ema2(this.__wbg_ptr,_)}set_es_show_wma(_){t.chartengine_set_es_show_wma(this.__wbg_ptr,_)}set_es_swing_len(_){t.chartengine_set_es_swing_len(this.__wbg_ptr,_)}set_es_wma_len(_){t.chartengine_set_es_wma_len(this.__wbg_ptr,_)}set_fib_ext_preview(_,e,r,n,i,s,a,o,c,p,d,b){t.chartengine_set_fib_ext_preview(this.__wbg_ptr,_,e,r,n,i,s,a,o,c,p,d,b)}set_footprint_tick_size(_){t.chartengine_set_footprint_tick_size(this.__wbg_ptr,_)}set_forex_signals_mode(_){t.chartengine_set_forex_signals_mode(this.__wbg_ptr,_)}set_forex_signals_setup(_){t.chartengine_set_forex_signals_setup(this.__wbg_ptr,_)}set_forex_signals_show_stats(_){t.chartengine_set_forex_signals_show_stats(this.__wbg_ptr,_)}set_fr_agg_data(_,e){const r=l(_,t.__wbindgen_export),n=h,i=l(e,t.__wbindgen_export),s=h;t.chartengine_set_fr_agg_data(this.__wbg_ptr,r,n,i,s)}set_fr_binance_data(_,e){const r=l(_,t.__wbindgen_export),n=h,i=l(e,t.__wbindgen_export),s=h;t.chartengine_set_fr_binance_data(this.__wbg_ptr,r,n,i,s)}set_fr_ratio(_){t.chartengine_set_fr_ratio(this.__wbg_ptr,_)}set_fr_show_agg(_){t.chartengine_set_fr_show_agg(this.__wbg_ptr,_)}set_fr_show_sma(_){t.chartengine_set_fr_show_sma(this.__wbg_ptr,_)}set_heatmap(_,e,r,n,i,s,a){const o=l(_,t.__wbindgen_export),c=h;t.chartengine_set_heatmap(this.__wbg_ptr,o,c,e,r,n,i,s,a)}set_heatmap_prefetch_range(_){t.chartengine_set_heatmap_prefetch_range(this.__wbg_ptr,_)}set_heatmap_range(_,e){t.chartengine_set_heatmap_range(this.__wbg_ptr,_,e)}set_hover_price(_){t.chartengine_set_hover_price(this.__wbg_ptr,_)}set_klines(_,e,r,n,i,s){const a=l(_,t.__wbindgen_export),o=h,c=l(e,t.__wbindgen_export),p=h,d=l(r,t.__wbindgen_export),b=h,y=l(n,t.__wbindgen_export),W=h,O=l(i,t.__wbindgen_export),F=h,R=l(s,t.__wbindgen_export),S=h;t.chartengine_set_klines(this.__wbg_ptr,a,o,c,p,d,b,y,W,O,F,R,S)}set_large_trades_data(_){const e=l(_,t.__wbindgen_export),r=h;t.chartengine_set_large_trades_data(this.__wbg_ptr,e,r)}set_liq_heatmap_cell_height(_){t.chartengine_set_liq_heatmap_cell_height(this.__wbg_ptr,_)}set_liq_heatmap_filled_pct(_){t.chartengine_set_liq_heatmap_filled_pct(this.__wbg_ptr,_)}set_liq_heatmap_filled_zones(_){t.chartengine_set_liq_heatmap_filled_zones(this.__wbg_ptr,_)}set_liq_heatmap_predictions(_){t.chartengine_set_liq_heatmap_predictions(this.__wbg_ptr,_)}set_liq_heatmap_profile(_){t.chartengine_set_liq_heatmap_profile(this.__wbg_ptr,_)}set_liq_heatmap_range(_,e){t.chartengine_set_liq_heatmap_range(this.__wbg_ptr,_,e)}set_live_signals_data(_){const e=l(_,t.__wbindgen_export),r=h;t.chartengine_set_live_signals_data(this.__wbg_ptr,e,r)}set_live_signals_leverage(_){t.chartengine_set_live_signals_leverage(this.__wbg_ptr,_)}set_live_signals_loading(_){t.chartengine_set_live_signals_loading(this.__wbg_ptr,_)}set_live_signals_pip_value(_){t.chartengine_set_live_signals_pip_value(this.__wbg_ptr,_)}set_live_signals_show_entry(_){t.chartengine_set_live_signals_show_entry(this.__wbg_ptr,_)}set_live_signals_show_labels(_){t.chartengine_set_live_signals_show_labels(this.__wbg_ptr,_)}set_live_signals_show_max_profit(_){t.chartengine_set_live_signals_show_max_profit(this.__wbg_ptr,_)}set_live_signals_show_tp_sl(_){t.chartengine_set_live_signals_show_tp_sl(this.__wbg_ptr,_)}set_live_signals_show_zones(_){t.chartengine_set_live_signals_show_zones(this.__wbg_ptr,_)}set_live_signals_text_size(_){t.chartengine_set_live_signals_text_size(this.__wbg_ptr,_)}set_live_signals_trial(_){t.chartengine_set_live_signals_trial(this.__wbg_ptr,_)}set_lt_bubble_scale(_){t.chartengine_set_lt_bubble_scale(this.__wbg_ptr,_)}set_lt_volume_filter(_,e){t.chartengine_set_lt_volume_filter(this.__wbg_ptr,_,e)}set_oi_data(_){const e=l(_,t.__wbindgen_export),r=h;t.chartengine_set_oi_data(this.__wbg_ptr,e,r)}set_oi_data_ts(_,e){const r=l(_,t.__wbindgen_export),n=h,i=l(e,t.__wbindgen_export),s=h;t.chartengine_set_oi_data_ts(this.__wbg_ptr,r,n,i,s)}set_oi_display_mode(_){t.chartengine_set_oi_display_mode(this.__wbg_ptr,_)}set_oi_ratio(_){t.chartengine_set_oi_ratio(this.__wbg_ptr,_)}set_oi_show_on_chart(_){t.chartengine_set_oi_show_on_chart(this.__wbg_ptr,_)}set_path_cursor(_,e){t.chartengine_set_path_cursor(this.__wbg_ptr,_,e)}set_price_precision(_){t.chartengine_set_price_precision(this.__wbg_ptr,_)}set_real_timestamps(_){const e=l(_,t.__wbindgen_export),r=h;t.chartengine_set_real_timestamps(this.__wbg_ptr,e,r)}set_replay_hovered(_){t.chartengine_set_replay_hovered(this.__wbg_ptr,_)}set_replay_preview(_){t.chartengine_set_replay_preview(this.__wbg_ptr,_)}set_replay_state(_,e,r){t.chartengine_set_replay_state(this.__wbg_ptr,_,e,r)}set_rsi_period(_){t.chartengine_set_rsi_period(this.__wbg_ptr,_)}set_rsi_ratio(_){t.chartengine_set_rsi_ratio(this.__wbg_ptr,_)}set_rsi_show_divergence(_){t.chartengine_set_rsi_show_divergence(this.__wbg_ptr,_)}set_rsi_show_ema(_){t.chartengine_set_rsi_show_ema(this.__wbg_ptr,_)}set_rsi_show_signals(_){t.chartengine_set_rsi_show_signals(this.__wbg_ptr,_)}set_rsi_show_traps(_){t.chartengine_set_rsi_show_traps(this.__wbg_ptr,_)}set_rsi_show_wma(_){t.chartengine_set_rsi_show_wma(this.__wbg_ptr,_)}set_rsi_smoothing(_){t.chartengine_set_rsi_smoothing(this.__wbg_ptr,_)}set_sr_fvg_extend(_){t.chartengine_set_sr_fvg_extend(this.__wbg_ptr,_)}set_sr_fvg_htf(_){t.chartengine_set_sr_fvg_htf(this.__wbg_ptr,_)}set_sr_fvg_mitigation(_){t.chartengine_set_sr_fvg_mitigation(this.__wbg_ptr,_)}set_sr_fvg_theme(_){t.chartengine_set_sr_fvg_theme(this.__wbg_ptr,_)}set_sr_htf_minutes(_){t.chartengine_set_sr_htf_minutes(this.__wbg_ptr,_)}set_sr_mitigation(_){t.chartengine_set_sr_mitigation(this.__wbg_ptr,_)}set_sr_ob_last(_){t.chartengine_set_sr_ob_last(this.__wbg_ptr,_)}set_sr_show_breakers(_){t.chartengine_set_sr_show_breakers(this.__wbg_ptr,_)}set_sr_show_fvg(_){t.chartengine_set_sr_show_fvg(this.__wbg_ptr,_)}set_sr_show_fvg_signals(_){t.chartengine_set_sr_show_fvg_signals(this.__wbg_ptr,_)}set_sr_show_htf_ob(_){t.chartengine_set_sr_show_htf_ob(this.__wbg_ptr,_)}set_sr_show_metrics(_){t.chartengine_set_sr_show_metrics(this.__wbg_ptr,_)}set_sr_show_ob(_){t.chartengine_set_sr_show_ob(this.__wbg_ptr,_)}set_sr_show_ob_activity(_){t.chartengine_set_sr_show_ob_activity(this.__wbg_ptr,_)}set_sr_show_ob_signals(_){t.chartengine_set_sr_show_ob_signals(this.__wbg_ptr,_)}set_sr_show_predict(_){t.chartengine_set_sr_show_predict(this.__wbg_ptr,_)}set_sr_show_smart_rev(_){t.chartengine_set_sr_show_smart_rev(this.__wbg_ptr,_)}set_sr_smart_rev_htf(_){t.chartengine_set_sr_smart_rev_htf(this.__wbg_ptr,_)}set_sr_stats_position(_){t.chartengine_set_sr_stats_position(this.__wbg_ptr,_)}set_sr_stats_type(_){t.chartengine_set_sr_stats_type(this.__wbg_ptr,_)}set_sr_text_size(_){t.chartengine_set_sr_text_size(this.__wbg_ptr,_)}set_theme(_){t.chartengine_set_theme(this.__wbg_ptr,_)}set_tpo_ib(_){t.chartengine_set_tpo_ib(this.__wbg_ptr,_)}set_tpo_ib_minutes(_){t.chartengine_set_tpo_ib_minutes(this.__wbg_ptr,_)}set_tpo_letter_minutes(_){t.chartengine_set_tpo_letter_minutes(this.__wbg_ptr,_)}set_tpo_naked_poc(_){t.chartengine_set_tpo_naked_poc(this.__wbg_ptr,_)}set_tpo_period(_){t.chartengine_set_tpo_period(this.__wbg_ptr,_)}set_tpo_poc_line(_){t.chartengine_set_tpo_poc_line(this.__wbg_ptr,_)}set_tpo_profile_shape(_){t.chartengine_set_tpo_profile_shape(this.__wbg_ptr,_)}set_tpo_signals(_){t.chartengine_set_tpo_signals(this.__wbg_ptr,_)}set_tpo_single_prints(_){t.chartengine_set_tpo_single_prints(this.__wbg_ptr,_)}set_tpo_va_lines(_){t.chartengine_set_tpo_va_lines(this.__wbg_ptr,_)}set_volume_color_mode(_){t.chartengine_set_volume_color_mode(this.__wbg_ptr,_)}set_volume_ma_period(_){t.chartengine_set_volume_ma_period(this.__wbg_ptr,_)}set_volume_show_ma(_){t.chartengine_set_volume_show_ma(this.__wbg_ptr,_)}set_volume_show_signals(_){t.chartengine_set_volume_show_signals(this.__wbg_ptr,_)}set_vrvp_poc_line(_){t.chartengine_set_vrvp_poc_line(this.__wbg_ptr,_)}show_latest(_){t.chartengine_show_latest(this.__wbg_ptr,_)}start_brush(_,e,r,n,i){t.chartengine_start_brush(this.__wbg_ptr,_,e,r,n,i)}start_elliott_manual(_,e,r,n,i){t.chartengine_start_elliott_manual(this.__wbg_ptr,_,e,r,n,i)}start_path(_,e,r,n,i,s){t.chartengine_start_path(this.__wbg_ptr,_,e,r,n,i,s)}update_drawing_anchor(_,e,r){t.chartengine_update_drawing_anchor(this.__wbg_ptr,_,e,r)}update_heatmap_column(_,e){const r=l(e,t.__wbindgen_export),n=h;t.chartengine_update_heatmap_column(this.__wbg_ptr,_,r,n)}update_heatmap_column_at(_,e,r,n){const i=l(_,t.__wbindgen_export),s=h;t.chartengine_update_heatmap_column_at(this.__wbg_ptr,i,s,e,r,n)}update_last_heatmap_column(_,e,r){const n=l(_,t.__wbindgen_export),i=h;t.chartengine_update_last_heatmap_column(this.__wbg_ptr,n,i,e,r)}update_last_kline(_,e,r,n,i,s){t.chartengine_update_last_kline(this.__wbg_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.__wbg_ptr,_,e);var i=w().getInt32(a+4*0,!0),s=w().getInt32(a+4*1,!0);return r=i,n=s,u(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.__wbg_ptr,_)}world_to_screen_y(_){return t.chartengine_world_to_screen_y(this.__wbg_ptr,_)}zoom(_,e,r){t.chartengine_zoom(this.__wbg_ptr,_,e,r)}zoom_x(_,e){t.chartengine_zoom_x(this.__wbg_ptr,_,e)}zoom_y(_,e){t.chartengine_zoom_y(this.__wbg_ptr,_,e)}}Symbol.dispose&&(E.prototype[Symbol.dispose]=E.prototype.free);function $(){const g=t.wasm_memory();return X(g)}function D(){return{__proto__:null,"./chart_engine_bg.js":{__proto__:null,__wbg___wbindgen_memory_edb3f01e3930bbf6:function(){const _=t.memory;return B(_)},__wbg___wbindgen_throw_6ddd609b62940d55:function(_,e){throw new Error(u(_,e))}}}}const L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(g=>t.__wbg_chartengine_free(g>>>0,1));function B(g){q===m.length&&m.push(m.length+1);const _=q;return q=m[_],m[_]=g,_}function V(g){g<1028||(m[g]=q,q=g)}function v(g,_){return g=g>>>0,C().subarray(g/8,g/8+_)}function P(g,_){return g=g>>>0,H().subarray(g/4,g/4+_)}let f=null;function w(){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 u(g,_){return g=g>>>0,G(g,_)}let I=null;function j(){return(I===null||I.byteLength===0)&&(I=new Uint8Array(t.memory.buffer)),I}function N(g){return m[g]}let m=new Array(1024).fill(void 0);m.push(void 0,null,!0,!1);let q=m.length;function l(g,_){const e=_(g.length*8,8)>>>0;return C().set(g,e/8),h=g.length,e}function z(g,_,e){if(e===void 0){const a=A.encode(g),o=_(a.length,1)>>>0;return j().subarray(o,o+a.length).set(a),h=a.length,o}let r=g.length,n=_(r,1)>>>0;const i=j();let s=0;for(;s<r;s++){const a=g.charCodeAt(s);if(a>127)break;i[n+s]=a}if(s!==r){s!==0&&(g=g.slice(s)),n=e(n,r,r=s+g.length*3,1)>>>0;const a=j().subarray(n+s,n+r),o=A.encodeInto(g,a);s+=o.written,n=e(n,r,s,1)>>>0}return h=s,n}function X(g){const _=N(g);return V(g),_}let M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});M.decode();const Y=2146435072;let T=0;function G(g,_){return T+=_,T>=Y&&(M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),M.decode(),T=_),M.decode(j().subarray(g,g+_))}const A=new TextEncoder;"encodeInto"in A||(A.encodeInto=function(g,_){const e=A.encode(g);return _.set(e),{read:g.length,written:e.length}});let h=0,J,t;function U(g,_){return t=g.exports,J=_,f=null,x=null,k=null,I=null,t}async function K(g,_){if(typeof Response=="function"&&g instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(g,_)}catch(n){if(g.ok&&e(g.type)&&g.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 g.arrayBuffer();return await WebAssembly.instantiate(r,_)}else{const r=await WebAssembly.instantiate(g,_);return r instanceof WebAssembly.Instance?{instance:r,module:g}:r}function e(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function Q(g){if(t!==void 0)return t;g!==void 0&&(Object.getPrototypeOf(g)===Object.prototype?{module:g}=g:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const _=D();g instanceof WebAssembly.Module||(g=new WebAssembly.Module(g));const e=new WebAssembly.Instance(g,_);return U(e,g)}async function Z(g){if(t!==void 0)return t;g!==void 0&&(Object.getPrototypeOf(g)===Object.prototype?{module_or_path:g}=g:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),g===void 0&&(g=new URL("chart_engine_bg.wasm",import.meta.url));const _=D();(typeof g=="string"||typeof Request=="function"&&g instanceof Request||typeof URL=="function"&&g instanceof URL)&&(g=fetch(g));const{instance:e,module:r}=await K(await g,_);return U(e,r)}export{E as ChartEngine,Z as default,Q as initSync,$ as wasm_memory};
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,c,p){return t.chartengine_add_arrow(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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,c,p){return t.chartengine_add_circle(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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,c,p,m,u){return t.chartengine_add_fib_extension(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,p,m,u)>>>0}add_fib_retracement(_,e,r,n,i,s,a,d,c,p){return t.chartengine_add_fib_retracement(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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,c,p){return t.chartengine_add_long_position(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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,c,p,m,u){return t.chartengine_add_parallel_channel(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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,c,p){return t.chartengine_add_price_range(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,p)>>>0}add_short_position(_,e,r,n,i,s,a,d,c,p){return t.chartengine_add_short_position(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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,c,p){return t.chartengine_add_trendline(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,p)>>>0}append_heatmap_column(_,e,r,n){const i=g(_,t.__wbindgen_export),s=h;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=h,c=g(e,t.__wbindgen_export),p=h;t.chartengine_custom_band(this.__mrd_ptr,a,d,c,p,r,n,i,s)}custom_begin(){t.chartengine_custom_begin(this.__mrd_ptr)}custom_circle_px(_,e,r,n,i,s,a,d,c,p,m,u){t.chartengine_custom_circle_px(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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,c){t.chartengine_custom_line_px(this.__mrd_ptr,_,e,r,n,i,s,a,d,c)}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),c=h;t.chartengine_custom_price_label(this.__mrd_ptr,_,d,c,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 c=g(_,t.__wbindgen_export),p=h;t.chartengine_custom_series_dashed_line(this.__mrd_ptr,c,p,e,r,n,i,s,a,d)}custom_series_line(_,e,r,n,i,s){const a=g(_,t.__wbindgen_export),d=h;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,c){t.chartengine_custom_stroke_rect_px(this.__mrd_ptr,_,e,r,n,i,s,a,d,c)}custom_text(_,e,r,n,i,s,a,d,c){const p=z(r,t.__wbindgen_export,t.__wbindgen_export2),m=h;t.chartengine_custom_text(this.__mrd_ptr,_,e,p,m,n,i,s,a,d,c)}custom_text_px(_,e,r,n,i,s,a,d,c){const p=z(r,t.__wbindgen_export,t.__wbindgen_export2),m=h;t.chartengine_custom_text_px(this.__mrd_ptr,_,e,p,m,n,i,s,a,d,c)}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_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_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=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_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=h,d=g(n,t.__wbindgen_export),c=h,p=g(i,t.__wbindgen_export),m=h;t.chartengine_footprint_set_bar(this.__mrd_ptr,_,e,s,a,d,c,p,m)}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=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_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=h,c=g(e,t.__wbindgen_export),p=h,m=g(r,t.__wbindgen_export),u=h,y=g(n,t.__wbindgen_export),W=h,O=g(i,t.__wbindgen_export),F=h,R=g(s,t.__wbindgen_export),S=h;t.chartengine_prepend_klines(this.__mrd_ptr,a,d,c,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,c,p,m,u){t.chartengine_set_channel_preview(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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=h,i=g(e,t.__wbindgen_export),s=h;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,c,p,m){t.chartengine_set_drawing_preview(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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=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,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,c,p,m,u){t.chartengine_set_fib_ext_preview(this.__mrd_ptr,_,e,r,n,i,s,a,d,c,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=h,i=g(e,t.__wbindgen_export),s=h;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=h,i=g(e,t.__wbindgen_export),s=h;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),c=h;t.chartengine_set_heatmap(this.__mrd_ptr,d,c,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=h,c=g(e,t.__wbindgen_export),p=h,m=g(r,t.__wbindgen_export),u=h,y=g(n,t.__wbindgen_export),W=h,O=g(i,t.__wbindgen_export),F=h,R=g(s,t.__wbindgen_export),S=h;t.chartengine_set_klines(this.__mrd_ptr,a,d,c,p,m,u,y,W,O,F,R,S)}set_large_trades_data(_){const e=g(_,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=g(_,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=g(_,t.__wbindgen_export),r=h;t.chartengine_set_oi_data(this.__mrd_ptr,e,r)}set_oi_data_ts(_,e){const r=g(_,t.__wbindgen_export),n=h,i=g(e,t.__wbindgen_export),s=h;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=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_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=h;t.chartengine_update_heatmap_column(this.__mrd_ptr,_,r,n)}update_heatmap_column_at(_,e,r,n){const i=g(_,t.__wbindgen_export),s=h;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=h;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===f.length&&f.push(f.length+1);const _=q;return q=f[_],f[_]=o,_}function V(o){o<1028||(f[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 b=null;function l(){return(b===null||b.buffer.detached===!0||b.buffer.detached===void 0&&b.buffer!==t.memory.buffer)&&(b=new DataView(t.memory.buffer)),b}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 f[o]}let f=new Array(1024).fill(void 0);f.push(void 0,null,!0,!1);let q=f.length;function g(o,_){const e=_(o.length*8,8)>>>0;return C().set(o,e/8),h=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),h=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 h=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 h=0,J,t;function U(o,_){return t=o.exports,J=_,b=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};
Binary file
@@ -1 +1 @@
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},$t=["left","center","right"],nt=new Map,Kt=4096;function Dt(e,o,s,t){return e<<24|o<<16|s<<8|t}function I(e,o,s,t){let l=Dt(e,o,s,t),a=nt.get(l);return a||(a=`rgba(${e},${o},${s},${(t/255).toFixed(3)})`,nt.size>=Kt&&nt.clear(),nt.set(l,a),a)}var Tt=new TextDecoder;function lt(e,o,s,t){let l=o.buffer;if(s+t>l.byteLength)return;let a=new DataView(l,s,t),n=new Uint8Array(l,s,t),r=0,i="",f="",_=-1,m="";for(;r<t;){let u=n[r];if(r+=1,u===P.END_FRAME)break;switch(u){case P.FILL_RECT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4,w!==i&&(e.fillStyle=w,i=w),e.fillRect(d,h,c,p);break}case P.STROKE_RECT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4,w!==f&&(e.strokeStyle=w,f=w),S!==_&&(e.lineWidth=S,_=S),e.strokeRect(d,h,c,p);break}case P.LINE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4,e.beginPath(),w!==f&&(e.strokeStyle=w,f=w),S!==_&&(e.lineWidth=S,_=S),e.setLineDash([]),e.moveTo(d,h),e.lineTo(c,p),e.stroke();break}case P.DASHED_LINE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4;let T=a.getFloat32(r,!0);r+=4;let E=a.getFloat32(r,!0);r+=4,e.beginPath(),w!==f&&(e.strokeStyle=w,f=w),S!==_&&(e.lineWidth=S,_=S),e.setLineDash([T,E]),e.moveTo(d,h),e.lineTo(c,p),e.stroke(),e.setLineDash([]);break}case P.POLYLINE:{let d=a.getUint16(r,!0);r+=2;let h=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let c=a.getFloat32(r,!0);if(r+=4,d>0){let p=new Float32Array(d*2);for(let w=0;w<d;w++)p[w*2]=a.getFloat32(r,!0),r+=4,p[w*2+1]=a.getFloat32(r,!0),r+=4;if(e.beginPath(),h!==f&&(e.strokeStyle=h,f=h),c!==_&&(e.lineWidth=c,_=c),e.setLineDash([]),e.lineJoin="round",e.lineCap="round",d<=3){e.moveTo(p[0],p[1]);for(let w=1;w<d;w++)e.lineTo(p[w*2],p[w*2+1])}else{e.moveTo(p[0],p[1]),e.lineTo((p[0]+p[2])*.5,(p[1]+p[3])*.5);for(let w=1;w<d-1;w++){let S=p[w*2],T=p[w*2+1],E=p[(w+1)*2],Y=p[(w+1)*2+1];e.quadraticCurveTo(S,T,(S+E)*.5,(T+Y)*.5)}e.lineTo(p[(d-1)*2],p[(d-1)*2+1])}e.stroke()}break}case P.TEXT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=n[r];r+=1;let S=a.getUint16(r,!0);r+=2;let T=Tt.decode(new Uint8Array(o.buffer,s+r,S));r+=S,c!==i&&(e.fillStyle=c,i=c);let E=`${p}px "IBM Plex Mono",monospace`;E!==m&&(e.font=E,m=E),e.textAlign=$t[w]||"left",e.textBaseline="middle",e.fillText(T,d,h);break}case P.CIRCLE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let w=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4,e.beginPath(),e.arc(d,h,c,0,Math.PI*2),p!==i&&(e.fillStyle=p,i=p),e.fill(),S>0&&(w!==f&&(e.strokeStyle=w,f=w),S!==_&&(e.lineWidth=S,_=S),e.stroke());break}case P.TRIANGLE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=a.getFloat32(r,!0);r+=4;let S=a.getFloat32(r,!0);r+=4;let T=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4,e.beginPath(),e.moveTo(d,h),e.lineTo(c,p),e.lineTo(w,S),e.closePath(),T!==i&&(e.fillStyle=T,i=T),e.fill();break}case P.SAVE:{e.save();break}case P.RESTORE:{e.restore(),i="",f="",_=-1,m="";break}case P.CLIP_RECT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4,e.beginPath(),e.rect(d,h,c,p),e.clip();break}case P.ROTATED_TEXT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=a.getFloat32(r,!0);r+=4;let S=a.getUint16(r,!0);r+=2;let T=Tt.decode(n.subarray(r,r+S));r+=S;let E=`${p}px sans-serif`;E!==m&&(e.font=E,m=E),c!==i&&(e.fillStyle=c,i=c),e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(d,h),e.rotate(w),e.fillText(T,0,0),e.restore();break}case P.BUBBLE_3D:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=n[r],w=n[r+1],S=n[r+2],T=n[r+3];r+=4;let E=n[r],Y=n[r+1],b=n[r+2],D=n[r+3];r+=4;let U=n[r],x=n[r+1],k=n[r+2],st=n[r+3];r+=4;let ht=a.getFloat32(r,!0);r+=4;let L=c;if(L<10){let z=`rgba(${p},${w},${S},${(T/255).toFixed(3)})`;e.beginPath(),e.arc(d,h,L,0,Math.PI*2),e.fillStyle=z,e.fill(),i=""}else if(L<18){let z=d-L*.25,C=h-L*.25,N=e.createRadialGradient(z,C,L*.08,d,h,L);N.addColorStop(0,`rgba(${E},${Y},${b},${(D/255).toFixed(3)})`),N.addColorStop(1,`rgba(${p},${w},${S},${(T/255).toFixed(3)})`),e.beginPath(),e.arc(d,h,L,0,Math.PI*2),e.fillStyle=N,e.fill(),i=""}else{let z=d-L*.25,C=h-L*.25,N=e.createRadialGradient(d,h,L*.85,d,h,L*1.2);N.addColorStop(0,`rgba(${U},${x},${k},${(st/255*.5).toFixed(3)})`),N.addColorStop(1,`rgba(${U},${x},${k},0)`),e.beginPath(),e.arc(d,h,L*1.2,0,Math.PI*2),e.fillStyle=N,e.fill();let G=e.createRadialGradient(z,C,L*.08,d,h,L);G.addColorStop(0,`rgba(${E},${Y},${b},${(D/255).toFixed(3)})`),G.addColorStop(1,`rgba(${p},${w},${S},${(T/255).toFixed(3)})`),e.beginPath(),e.arc(d,h,L,0,Math.PI*2),e.fillStyle=G,e.fill();let tt=L*.2,$=e.createRadialGradient(z,C,0,z,C,tt);$.addColorStop(0,"rgba(255,255,255,0.22)"),$.addColorStop(1,"rgba(255,255,255,0)"),e.beginPath(),e.arc(z,C,tt,0,Math.PI*2),e.fillStyle=$,e.fill(),i=""}break}case P.FILL_POLYGON:{let d=a.getUint16(r,!0);r+=2;let h=I(n[r],n[r+1],n[r+2],n[r+3]);if(r+=4,d>2){e.beginPath();let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4,e.moveTo(c,p);for(let w=1;w<d;w++)e.lineTo(a.getFloat32(r,!0),a.getFloat32(r+4,!0)),r+=8;e.closePath(),h!==i&&(e.fillStyle=h,i=h),e.fill()}else r+=d*8;break}case P.DASHED_POLYLINE:{let d=a.getUint16(r,!0);r+=2;let h=I(n[r],n[r+1],n[r+2],n[r+3]);r+=4;let c=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let w=a.getFloat32(r,!0);if(r+=4,d>1){e.beginPath(),h!==f&&(e.strokeStyle=h,f=h),c!==_&&(e.lineWidth=c,_=c),e.setLineDash([p,w]),e.lineJoin="round";let S=a.getFloat32(r,!0);r+=4;let T=a.getFloat32(r,!0);r+=4,e.moveTo(S,T);for(let E=1;E<d;E++)e.lineTo(a.getFloat32(r,!0),a.getFloat32(r+4,!0)),r+=8;e.stroke(),e.setLineDash([])}else r+=d*8;break}default:return}}}var X={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 et(e){return X[e]?.type==="2point"}function rt(e){return X[e]?.type==="3point"}function j(e){let o=X[e]?.type;return o==="1point"||o==="1point_x"||o==="1point_xy"||o==="1point_xp"}function _t(e){return X[e]?.type==="freehand"}function q(e){return X[e]?.type==="npoint"}function W(e){return X[e]?.type==="elliott_manual"}function V(e,o,s,t,l,a){let n=X[o];if(!n)return 0;let r=0;return n.type==="3point"?r=e[n.addFn](s.x1,s.y1,s.x2,s.y2,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):n.type==="2point"?r=e[n.addFn](s.x1,s.y1,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):n.type==="1point_x"?r=e[n.addFn](t,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):n.type==="1point_xp"?r=e[n.addFn](t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):n.type==="1point_xy"?r=e[n.addFn](t,l,a.r,a.g,a.b,a.fontSize||12,s.pane):r=e[n.addFn](l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane),r||0}function O(e,o,s,t,l,a,n){let r=X[o];if(r){if(r.previewFn==="elliott"){e.set_elliott_preview(t,l,a.r,a.g,a.b,a.lineWidth,n);return}r.type==="3point"?s.step===1?e.set_drawing_preview(r.previewKind,s.x1,s.y1,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,n):s.step===2&&(r.previewFn==="fib_ext"?e.set_fib_ext_preview(s.x1,s.y1,s.x2,s.y2,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,n):e.set_channel_preview(s.x1,s.y1,s.x2,s.y2,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,n)):r.type==="2point"?e.set_drawing_preview(r.previewKind,s.x1,s.y1,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,n):r.type==="1point_x"?e.set_drawing_preview(r.previewKind,t,0,0,0,a.r,a.g,a.b,a.lineWidth,a.dashed,n):r.type==="1point_xp"||r.type==="1point_xy"?e.set_drawing_preview(r.previewKind,t,l,0,0,a.r,a.g,a.b,a.lineWidth,a.dashed,n):e.set_drawing_preview(r.previewKind,0,l,0,0,a.r,a.g,a.b,a.lineWidth,a.dashed,n)}}function M(e,o,s,t){let l=e.screen_to_world_x(o),a;switch(t){case 1:a=e.screen_to_rsi_y(s);break;case 2:a=e.screen_to_oi_y(s);break;case 3:a=e.screen_to_fr_y(s);break;case 4:a=e.screen_to_cvd_y(s);break;default:a=e.screen_to_world_y(s);break}return{wx:l,wy:a}}function H(e){return e===4?1:e===6?2:e===8?3:e===10?4:0}function A(e){return e===0||e===4||e===6||e===8||e===10}function Ft(e,o,s,t){e.addEventListener("wheel",r=>{if(t.disposed)return;r.preventDefault(),t.cancelMomentum();let i=r.deltaY>0?1.1:.9,f=o.hit_zone(r.offsetX,r.offsetY);r.ctrlKey?o.zoom_y(r.offsetY,i):r.shiftKey||f===2?o.zoom_x(r.offsetX,i):f===3?o.zoom_y(r.offsetY,i):o.zoom(r.offsetX,r.offsetY,i),s.onDirty()},{passive:!1}),e.addEventListener("mousedown",r=>{if(t.disposed||r.button!==0)return;t.cancelMomentum(),a();let i=performance.now();if(i-t.lastClickTime<300){t.lastClickTime=i;return}t.lastClickTime=i;let f=t.drawingMode;if(f){let m=o.hit_zone(r.offsetX,r.offsetY);if(!A(m))return;let u=H(m),{wx:d,wy:h}=M(o,r.offsetX,r.offsetY,u),c=f.style,p=f.tool;if(W(p)){if(!f.pathStarted)f.pane=u,o.start_elliott_manual(c.r,c.g,c.b,c.lineWidth,u),o.add_elliott_manual_point(d,h),f.pathStarted=!0,f.step=1;else if(o.add_elliott_manual_point(d,h)){t.finishDrawing(),s.onDirty();return}}else if(q(p))f.pathStarted?o.add_path_point(d,h):(f.pane=u,o.start_path(c.r,c.g,c.b,c.lineWidth,c.dashed,u),o.add_path_point(d,h),f.pathStarted=!0,f.step=1);else if(_t(p))f.pane=u,o.start_brush(c.r,c.g,c.b,c.lineWidth,u),o.add_brush_point(d,h),t.isBrushing=!0;else if(rt(p))if(f.step===0)f.x1=d,f.y1=h,f.pane=u,f.step=1;else if(f.step===1)f.x2=d,f.y2=h,f.step=2,o.clear_drawing_preview();else{let w=X[p];w&&w.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),V(o,p,f,d,h,c),t.finishDrawing()}else if(et(p))f.step===0?(f.x1=d,f.y1=h,f.pane=u,f.step=1):(V(o,p,f,d,h,c),t.finishDrawing());else{f.pane=u;let w=V(o,p,f,d,h,c);t.finishDrawing(),p==="textnote"&&w>0&&(o.select_drawing(w),s.onDrawingSelected?.(w),s.onDrawingDblClick?.(w,r.offsetX,r.offsetY,r.clientX,r.clientY))}s.onDirty();return}let _=o.hit_zone(r.offsetX,r.offsetY);if(_===5){t.isResizingRsi=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_rsi_ratio(),e.style.cursor="ns-resize";return}if(_===7){t.isResizingOi=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_oi_ratio(),e.style.cursor="ns-resize";return}if(_===9){t.isResizingFr=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_fr_ratio(),e.style.cursor="ns-resize";return}if(_===11){t.isResizingCvd=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_cvd_ratio(),e.style.cursor="ns-resize";return}if(A(_)){let m=o.get_selected_drawing();if(m>0){let p=o.hit_test_drawing_anchor(r.offsetX,r.offsetY);if(p>=0){t.isDraggingAnchor=!0,t.dragAnchorIdx=p,t.dragAnchorPane=H(_),e.style.cursor="grabbing";return}if(o.hit_test_drawing(r.offsetX,r.offsetY)===m){t.isDraggingDrawing=!0,t.dragDrawingPane=H(_);let{wx:S,wy:T}=M(o,r.offsetX,r.offsetY,t.dragDrawingPane);t.dragDrawingLastWx=S,t.dragDrawingLastWy=T,e.style.cursor="move";return}}let u=o.hit_test_drawing(r.offsetX,r.offsetY);if(u>0){o.deselect_marker(),s.onMarkerSelected?.(0),o.select_drawing(u),s.onDrawingSelected?.(u),s.onDirty();return}let d=o.hit_test_marker(r.offsetX,r.offsetY);if(d>0){o.deselect_drawing(),s.onDrawingSelected?.(0),o.select_marker(d),s.onMarkerSelected?.(d),s.onDirty();return}let h=o.get_selected_drawing(),c=o.get_selected_marker();h>0&&(o.deselect_drawing(),s.onDrawingSelected?.(0),s.onDirty()),c>0&&(o.deselect_marker(),s.onMarkerSelected?.(0),s.onDirty())}A(_)&&(t.liqPinSx=r.offsetX,t.liqPinSy=r.offsetY,t.liqPinTimer&&clearTimeout(t.liqPinTimer),t.liqPinTimer=setTimeout(()=>{t.liqPinTimer=null,s.onLiqAnnotationPin?.(t.liqPinSx,t.liqPinSy)},700)),t.isDragging=!0,t.dragZone=_,t.lastX=r.offsetX,t.lastY=r.offsetY,_===2?e.style.cursor="ew-resize":_===3?e.style.cursor="ns-resize":e.style.cursor="grabbing"});let l=null;function a(){l&&(cancelAnimationFrame(l),l=null)}function n(r,i){let f=o.hover_hit_test(r,i),_=f[0],m=f[1],u=f[2],d=f[3],h=f[4],c=t.drawingMode;_===2?(e.style.cursor="ew-resize",o.hide_crosshair()):_===3?(e.style.cursor="ns-resize",o.hide_crosshair()):(o.set_crosshair(r,i),_===5||_===7||_===9||_===11?e.style.cursor="ns-resize":!c&&A(_)&&m>0&&u>=0?e.style.cursor="grab":!c&&A(_)&&m>0&&d===m?e.style.cursor="move":!c&&A(_)&&(d>0||h>0)?e.style.cursor="pointer":e.style.cursor="crosshair"),s.onDirty(),s.onCrosshairMove?.(r,i,_),s.onVrvpHover?.(r,i)}e.addEventListener("mousemove",r=>{if(t.disposed)return;if(t.liqPinTimer){let f=Math.abs(r.offsetX-t.liqPinSx),_=Math.abs(r.offsetY-t.liqPinSy);(f>6||_>6)&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null)}if(t.isResizingRsi){let _=e.getBoundingClientRect().height-28,u=(t.resizeStartY-r.offsetY)/_,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+u));o.set_rsi_ratio(d),s.onDirty();return}if(t.isResizingOi){let _=e.getBoundingClientRect().height-28,u=(t.resizeStartY-r.offsetY)/_,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+u));o.set_oi_ratio(d),s.onDirty();return}if(t.isResizingFr){let _=e.getBoundingClientRect().height-28,u=(t.resizeStartY-r.offsetY)/_,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+u));o.set_fr_ratio(d),s.onDirty();return}if(t.isResizingCvd){let _=e.getBoundingClientRect().height-28,u=(t.resizeStartY-r.offsetY)/_,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+u));o.set_cvd_ratio(d),s.onDirty();return}if(t.isDraggingAnchor){let{wx:f,wy:_}=M(o,r.offsetX,r.offsetY,t.dragAnchorPane);o.update_drawing_anchor(t.dragAnchorIdx,f,_),o.set_crosshair(r.offsetX,r.offsetY),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}if(t.isDraggingDrawing){let{wx:f,wy:_}=M(o,r.offsetX,r.offsetY,t.dragDrawingPane),m=f-t.dragDrawingLastWx,u=_-t.dragDrawingLastWy;o.move_drawing(m,u),t.dragDrawingLastWx=f,t.dragDrawingLastWy=_,o.set_crosshair(r.offsetX,r.offsetY),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}let i=t.drawingMode;if(t.isBrushing&&i){let f=i.pane||0,{wx:_,wy:m}=M(o,r.offsetX,r.offsetY,f);o.add_brush_point(_,m),o.set_crosshair(r.offsetX,r.offsetY),s.onDirty();return}if(i&&W(i.tool)&&i.pathStarted){let f=i.pane||0,{wx:_,wy:m}=M(o,r.offsetX,r.offsetY,f);o.set_elliott_manual_cursor(_,m),o.set_crosshair(r.offsetX,r.offsetY);let u=o.hit_zone(r.offsetX,r.offsetY);s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,u);return}if(i&&q(i.tool)&&i.pathStarted){let f=i.pane||0,{wx:_,wy:m}=M(o,r.offsetX,r.offsetY,f);o.set_path_cursor(_,m),o.set_crosshair(r.offsetX,r.offsetY);let u=o.hit_zone(r.offsetX,r.offsetY);s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,u);return}if(i&&i.step>0){let f=i.pane||0,{wx:_,wy:m}=M(o,r.offsetX,r.offsetY,f);O(o,i.tool,i,_,m,i.style,f),o.set_crosshair(r.offsetX,r.offsetY);let u=o.hit_zone(r.offsetX,r.offsetY);s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,u);return}if(i&&j(i.tool)){let f=o.hit_zone(r.offsetX,r.offsetY),_=H(f),{wx:m,wy:u}=M(o,r.offsetX,r.offsetY,_);O(o,i.tool,i,m,u,i.style,_),o.set_crosshair(r.offsetX,r.offsetY),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(t.isDragging){let f=r.offsetX-t.lastX,_=r.offsetY-t.lastY;t.lastX=r.offsetX,t.lastY=r.offsetY,t.dragZone===2?o.pan_x(f):t.dragZone===3?o.pan_y(_):o.pan(f,_),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,t.dragZone),s.onVrvpHover?.(r.offsetX,r.offsetY);return}t._pendingHoverX=r.offsetX,t._pendingHoverY=r.offsetY,l||(l=requestAnimationFrame(()=>{l=null,t.disposed||n(t._pendingHoverX,t._pendingHoverY)}))}),e.addEventListener("mouseup",()=>{t.disposed||(t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null),t.isBrushing&&(t.isBrushing=!1,o.finish_brush(),t.finishDrawing(),s.onDirty()),t.isDragging=!1,t.isResizingRsi=!1,t.isResizingOi=!1,t.isResizingFr=!1,t.isResizingCvd=!1,t.isDraggingAnchor=!1,t.isDraggingDrawing=!1,t.dragAnchorIdx=-1,e.style.cursor="crosshair")}),e.addEventListener("mouseleave",()=>{t.disposed||(a(),t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null),t.isBrushing&&(t.isBrushing=!1,o.finish_brush(),t.finishDrawing()),t.isDragging=!1,t.isResizingRsi=!1,t.isResizingOi=!1,t.isResizingFr=!1,t.isResizingCvd=!1,t.isDraggingAnchor=!1,t.isDraggingDrawing=!1,t.dragAnchorIdx=-1,o.hide_crosshair(),e.style.cursor="crosshair",s.onDirty(),s.onCrosshairHide?.(),s.onVrvpHover?.(null,null))}),e.addEventListener("dblclick",r=>{if(t.disposed)return;r.preventDefault(),r.stopPropagation();let i=t.drawingMode;if(i&&W(i.tool)&&i.pathStarted){o.finish_elliott_manual(),t.finishDrawing(),s.onDirty();return}if(i&&q(i.tool)&&i.pathStarted){o.finish_path(),t.finishDrawing(),s.onDirty();return}if(i)return;let f=o.hit_test_drawing(r.offsetX,r.offsetY);f>0&&(o.select_drawing(f),s.onDirty(),s.onDrawingDblClick?.(f,r.offsetX,r.offsetY,r.clientX,r.clientY))}),e.addEventListener("contextmenu",r=>{if(t.disposed)return;let i=t.drawingMode;if(i&&W(i.tool)&&i.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_elliott_manual(),t.finishDrawing(),s.onDirty();return}if(i&&q(i.tool)&&i.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_path(),t.finishDrawing(),s.onDirty();return}})}function Rt(e,o,s,t){e.addEventListener("touchstart",l=>{if(!t.disposed){if(l.preventDefault(),t.cancelMomentum(),l.touches.length===2){clearTimeout(t.longPressTimer),t.isCrosshairMode=!1;let a=e.getBoundingClientRect(),n=l.touches[1].clientX-l.touches[0].clientX,r=l.touches[1].clientY-l.touches[0].clientY;t.lastTouchDist=Math.sqrt(n*n+r*r),t.lastX=(l.touches[0].clientX+l.touches[1].clientX)/2-a.left,t.lastY=(l.touches[0].clientY+l.touches[1].clientY)/2-a.top,t.dragZone=o.hit_zone(t.lastX,t.lastY)}else if(l.touches.length===1){let a=e.getBoundingClientRect(),n=l.touches[0].clientX-a.left,r=l.touches[0].clientY-a.top;t.touchStartX=n,t.touchStartY=r,t.touchMoved=!1;let i=t.drawingMode;if(i){let d=o.hit_zone(n,r);if(A(d)){let h=H(d),{wx:c,wy:p}=M(o,n,r,h),w=i.tool;if(W(w)){if(!i.pathStarted)i.pane=h,o.start_elliott_manual(i.style.r,i.style.g,i.style.b,i.style.lineWidth,h),o.add_elliott_manual_point(c,p),i.pathStarted=!0,i.step=1;else if(o.add_elliott_manual_point(c,p)){t.finishDrawing(),s.onDirty();return}}else q(w)?i.pathStarted?o.add_path_point(c,p):(i.pane=h,o.start_path(i.style.r,i.style.g,i.style.b,i.style.lineWidth,i.style.dashed,h),o.add_path_point(c,p),i.pathStarted=!0,i.step=1):_t(w)?(i.pane=h,o.start_brush(i.style.r,i.style.g,i.style.b,i.style.lineWidth,h),o.add_brush_point(c,p),t.isBrushing=!0):rt(w)?i.step===0?(i.x1=c,i.y1=p,i.pane=h,i.step=1,i._stepAtTouchStart=0,O(o,w,i,c,p,i.style,h)):i.step===1?(i._stepAtTouchStart=1,O(o,w,i,c,p,i.style,i.pane)):(i._stepAtTouchStart=2,O(o,w,i,c,p,i.style,i.pane)):et(w)?i.step===0?(i.x1=c,i.y1=p,i.pane=h,i.step=1,i._stepAtTouchStart=0,O(o,w,i,c,p,i.style,h)):(i._stepAtTouchStart=1,O(o,w,i,c,p,i.style,i.pane)):j(w)?(i.pane=h,O(o,w,i,c,p,i.style,h)):(i.pane=h,V(o,w,i,c,p,i.style),t.finishDrawing());o.set_crosshair(n,r),s.onDirty(),s.onCrosshairMove?.(n,r,d)}return}let f=o.hover_hit_test(n,r),_=f[0],m=f[1],u=f[2];if(A(_)&&!t.drawingMode&&m>0){if(u>=0){t.isDraggingAnchor=!0,t.dragAnchorIdx=u,t.dragAnchorPane=H(_);return}if(f[3]===m){t.isDraggingDrawing=!0,t.dragDrawingPane=H(_);let{wx:h,wy:c}=M(o,n,r,t.dragDrawingPane);t.dragDrawingLastWx=h,t.dragDrawingLastWy=c;return}}t.isDragging=!0,t.isCrosshairMode=!1,t.lastX=n,t.lastY=r,t.dragZone=_,clearTimeout(t.longPressTimer),t.longPressTimer=setTimeout(()=>{t.isDragging&&!t.touchMoved&&(t.isCrosshairMode=!0,o.set_crosshair(n,r),s.onDirty(),s.onCrosshairMove?.(n,r,t.dragZone),s.onVrvpHover?.(n,r))},300),A(t.dragZone)&&(t.liqPinSx=n,t.liqPinSy=r,t.liqPinTimer&&clearTimeout(t.liqPinTimer),t.liqPinTimer=setTimeout(()=>{t.liqPinTimer=null,t.touchMoved||s.onLiqAnnotationPin?.(t.liqPinSx,t.liqPinSy)},700))}}},{passive:!1}),e.addEventListener("touchmove",l=>{if(t.disposed)return;l.preventDefault();let a=e.getBoundingClientRect();if(t.isDraggingAnchor&&l.touches.length===1){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top,{wx:f,wy:_}=M(o,r,i,t.dragAnchorPane);o.update_drawing_anchor(t.dragAnchorIdx,f,_),o.set_crosshair(r,i),s.onDirty();return}if(t.isDraggingDrawing&&l.touches.length===1){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top;t.touchMoved=!0;let{wx:f,wy:_}=M(o,r,i,t.dragDrawingPane),m=f-t.dragDrawingLastWx,u=_-t.dragDrawingLastWy;o.move_drawing(m,u),t.dragDrawingLastWx=f,t.dragDrawingLastWy=_,o.set_crosshair(r,i),s.onDirty();return}let n=t.drawingMode;if(t.isBrushing&&n&&l.touches.length===1){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top,f=n.pane||0,{wx:_,wy:m}=M(o,r,i,f);o.add_brush_point(_,m),o.set_crosshair(r,i),s.onDirty(),t.touchMoved=!0;return}if(n&&W(n.tool)&&n.pathStarted&&l.touches.length===1){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top,f=n.pane||0,{wx:_,wy:m}=M(o,r,i,f);o.set_elliott_manual_cursor(_,m),o.set_crosshair(r,i),s.onDirty(),t.touchMoved=!0;return}if(n&&q(n.tool)&&n.pathStarted&&l.touches.length===1){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top,f=n.pane||0,{wx:_,wy:m}=M(o,r,i,f);o.set_path_cursor(_,m),o.set_crosshair(r,i),s.onDirty(),t.touchMoved=!0;return}if(n&&n.step>0&&l.touches.length===1){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top;!t.touchMoved&&(Math.abs(r-t.touchStartX)>10||Math.abs(i-t.touchStartY)>10)&&(t.touchMoved=!0);let f=n.pane||0,{wx:_,wy:m}=M(o,r,i,f);O(o,n.tool,n,_,m,n.style,f),o.set_crosshair(r,i);let u=o.hit_zone(r,i);s.onDirty(),s.onCrosshairMove?.(r,i,u);return}if(n&&j(n.tool)&&l.touches.length===1){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top,f=o.hit_zone(r,i),_=H(f),{wx:m,wy:u}=M(o,r,i,_);O(o,n.tool,n,m,u,n.style,_),o.set_crosshair(r,i),s.onDirty(),s.onCrosshairMove?.(r,i,f);return}if(l.touches.length===2){t.velSamples=[];let r=l.touches[1].clientX-l.touches[0].clientX,i=l.touches[1].clientY-l.touches[0].clientY,f=Math.sqrt(r*r+i*i),_=t.lastTouchDist/f,m=(l.touches[0].clientX+l.touches[1].clientX)/2-a.left,u=(l.touches[0].clientY+l.touches[1].clientY)/2-a.top;t.dragZone===3?o.zoom_y(u,_):t.dragZone===2?o.zoom_x(m,_):(o.zoom(m,u,_),o.pan(m-t.lastX,u-t.lastY)),t.lastTouchDist=f,t.lastX=m,t.lastY=u,s.onDirty()}else if(l.touches.length===1&&t.isDragging){let r=l.touches[0].clientX-a.left,i=l.touches[0].clientY-a.top,f=r-t.lastX,_=i-t.lastY;!t.touchMoved&&(Math.abs(r-t.touchStartX)>10||Math.abs(i-t.touchStartY)>10)&&(t.touchMoved=!0,t.isCrosshairMode||clearTimeout(t.longPressTimer),t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null)),t.isCrosshairMode?(o.set_crosshair(r,i),s.onDirty(),s.onCrosshairMove?.(r,i,t.dragZone),s.onVrvpHover?.(r,i)):(t.lastX=r,t.lastY=i,t.recordVelocity(f,_),t.dragZone===2?o.pan_x(f):t.dragZone===3?o.pan_y(_):o.pan(f,_),s.onDirty())}},{passive:!1}),e.addEventListener("touchend",l=>{if(t.disposed)return;if(clearTimeout(t.longPressTimer),t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null),t.isDraggingAnchor){t.isDraggingAnchor=!1,t.dragAnchorIdx=-1,o.hide_crosshair(),s.onDirty(),s.onCrosshairHide?.();return}if(t.isDraggingDrawing){if(t.isDraggingDrawing=!1,o.hide_crosshair(),s.onDirty(),s.onCrosshairHide?.(),!t.touchMoved){let n=o.get_selected_drawing();if(n>0){let r=e.getBoundingClientRect();s.onDrawingDblClick?.(n,t.touchStartX,t.touchStartY,t.touchStartX+r.left,t.touchStartY+r.top)}}return}if(t.isBrushing){t.isBrushing=!1,o.finish_brush(),t.finishDrawing(),s.onDirty(),s.onCrosshairHide?.();return}let a=t.drawingMode;if(a&&W(a.tool)&&a.pathStarted){let n=Date.now(),r=t.touchStartX-(t._pathLastTapX||0),i=t.touchStartY-(t._pathLastTapY||0),f=Math.sqrt(r*r+i*i);n-(t._pathLastTapTime||0)<350&&f<30?(o.finish_elliott_manual(),t.finishDrawing(),t._pathLastTapTime=0):(t._pathLastTapTime=n,t._pathLastTapX=t.touchStartX,t._pathLastTapY=t.touchStartY),t.isDragging=!1,t.lastTouchDist=0,s.onDirty();return}if(a&&q(a.tool)&&a.pathStarted){let n=Date.now(),r=t.touchStartX-(t._pathLastTapX||0),i=t.touchStartY-(t._pathLastTapY||0),f=Math.sqrt(r*r+i*i);n-(t._pathLastTapTime||0)<350&&f<30?(o.finish_path(),t.finishDrawing(),t._pathLastTapTime=0):(t._pathLastTapTime=n,t._pathLastTapX=t.touchStartX,t._pathLastTapY=t.touchStartY),t.isDragging=!1,t.lastTouchDist=0,s.onDirty();return}if(a&&rt(a.tool)){let n=a._stepAtTouchStart;if(a.step===1&&(n===1||t.touchMoved)){let r=e.getBoundingClientRect(),i=l.changedTouches?.[0];if(i){let f=i.clientX-r.left,_=i.clientY-r.top,m=a.pane||0,{wx:u,wy:d}=M(o,f,_,m);a.x2=u,a.y2=d,a.step=2,o.clear_drawing_preview()}}else if(a.step===2&&(n===2||t.touchMoved)){let r=e.getBoundingClientRect(),i=l.changedTouches?.[0];if(i){let f=i.clientX-r.left,_=i.clientY-r.top,m=a.pane||0,{wx:u,wy:d}=M(o,f,_,m),h=X[a.tool];h&&h.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),V(o,a.tool,a,u,d,a.style),t.finishDrawing()}}t.isDragging=!1,t.lastTouchDist=0,t.drawingMode||(o.hide_crosshair(),s.onCrosshairHide?.()),s.onDirty();return}if(a&&a.step===1&&et(a.tool)){if(a._stepAtTouchStart===1||t.touchMoved){let r=e.getBoundingClientRect(),i=l.changedTouches?.[0];if(i){let f=i.clientX-r.left,_=i.clientY-r.top,m=a.pane||0,{wx:u,wy:d}=M(o,f,_,m);V(o,a.tool,a,u,d,a.style),t.finishDrawing()}}t.isDragging=!1,t.lastTouchDist=0,t.drawingMode||(o.hide_crosshair(),s.onCrosshairHide?.()),s.onDirty();return}if(a&&j(a.tool)){let n=e.getBoundingClientRect(),r=l.changedTouches?.[0];if(r){let i=r.clientX-n.left,f=r.clientY-n.top,_=o.hit_zone(i,f),m=A(_)?H(_):a.pane||0,{wx:u,wy:d}=M(o,i,f,m),h=a.tool;o.clear_drawing_preview();let c=V(o,h,a,u,d,a.style);t.finishDrawing(),h==="textnote"&&c>0&&(o.select_drawing(c),s.onDrawingSelected?.(c),s.onDrawingDblClick?.(c,i,f,i+n.left,f+n.top))}t.isDragging=!1,t.lastTouchDist=0,o.hide_crosshair(),s.onCrosshairHide?.(),s.onDirty();return}if(!t.touchMoved&&!t.drawingMode&&t.isDragging){let n=Date.now(),r=t.touchStartX-t.lastTapX,i=t.touchStartY-t.lastTapY,f=Math.sqrt(r*r+i*i),_=n-t.lastTapTime<350&&f<30,m=o.hover_hit_test(t.touchStartX,t.touchStartY),u=m[0],d=m[1],h=m[3],c=m[4];if(A(u))if(h>0){o.deselect_marker(),s.onMarkerSelected?.(0),o.select_drawing(h);let p=e.getBoundingClientRect(),w=t.touchStartX+p.left,S=t.touchStartY+p.top;s.onDrawingSelected?.(h,w,S),(d<=0||d===h)&&s.onDrawingDblClick?.(h,t.touchStartX,t.touchStartY,w,S),s.onDirty()}else c>0?(o.deselect_drawing(),s.onDrawingSelected?.(0),o.select_marker(c),s.onMarkerSelected?.(c),s.onDirty()):(d>0&&(o.deselect_drawing(),s.onDrawingSelected?.(0),s.onDirty()),o.get_selected_marker()>0&&(o.deselect_marker(),s.onMarkerSelected?.(0),s.onDirty()));t.lastTapTime=n,t.lastTapX=t.touchStartX,t.lastTapY=t.touchStartY}t.touchMoved&&!t.isCrosshairMode&&!t.drawingMode&&t.startMomentum(t.dragZone),t.isDragging=!1,t.isCrosshairMode=!1,t.lastTouchDist=0,(!t.drawingMode||t.drawingMode.step===0)&&(o.hide_crosshair(),s.onCrosshairHide?.()),s.onDirty(),s.onVrvpHover?.(null,null)})}function gt(e,o,s){let t={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},l=.92,a=.5,n=80;t.recordVelocity=function(_,m){let u=performance.now();for(t.velSamples.push({dx:_,dy:m,t:u});t.velSamples.length>0&&u-t.velSamples[0].t>n;)t.velSamples.shift()};function r(){if(t.velSamples.length<2)return{vx:0,vy:0};let _=t.velSamples[0],u=t.velSamples[t.velSamples.length-1].t-_.t;if(u<5)return{vx:0,vy:0};let d=0,h=0;for(let p of t.velSamples)d+=p.dx,h+=p.dy;let c=16.67;return{vx:d/u*c,vy:h/u*c}}t.cancelMomentum=function(){t.momentumRaf&&(cancelAnimationFrame(t.momentumRaf),t.momentumRaf=null),t.velSamples=[]},t.startMomentum=function(_){let{vx:m,vy:u}=r();if(t.velSamples=[],Math.abs(m)<a&&Math.abs(u)<a)return;t.momentumVx=m,t.momentumVy=u,t.momentumZone=_;function d(){if(t.momentumVx*=l,t.momentumVy*=l,Math.abs(t.momentumVx)<a&&Math.abs(t.momentumVy)<a){t.momentumRaf=null;return}t.momentumZone===2?o.pan_x(t.momentumVx):t.momentumZone===3?o.pan_y(t.momentumVy):o.pan(t.momentumVx,t.momentumVy),s.onDirty(),t.momentumRaf=requestAnimationFrame(d)}t.momentumRaf=requestAnimationFrame(d)};let i={setMode(_,m){_?(t.drawingMode={tool:_,style:m,step:0,x1:0,y1:0},e.style.cursor="crosshair"):(t.drawingMode?.pathStarted&&o.finish_path(),t.drawingMode=null,o.clear_drawing_preview(),e.style.cursor="crosshair"),s.onDirty()},getMode(){return t.drawingMode}};s.drawingApi?.(i),t.finishDrawing=function(){o.clear_drawing_preview(),s.onDrawingComplete?.(),t.drawingMode=null,e.style.cursor="crosshair"},Ft(e,o,s,t),Rt(e,o,s,t);let f=_=>{let m=document.activeElement?.tagName,u=m==="INPUT"||m==="TEXTAREA"||document.activeElement?.isContentEditable;if((_.key==="Delete"||_.key==="Backspace")&&!t.drawingMode&&!u){let h=o.get_selected_drawing();if(h>0){o.remove_drawing(h),s.onDrawingSelected?.(0),s.onDirty();return}let c=o.get_selected_marker();if(c>0){o.remove_marker(c),s.onMarkerSelected?.(0),s.onDirty();return}}if(_.key==="Escape"&&!t.drawingMode){if(o.get_selected_drawing()>0){o.deselect_drawing(),s.onDrawingSelected?.(0),s.onDirty();return}if(o.get_selected_marker()>0){o.deselect_marker(),s.onMarkerSelected?.(0),s.onDirty();return}}if(_.key==="Escape"&&t.drawingMode){if(t.drawingMode.pathStarted){t.drawingMode.tool==="elliott"?o.finish_elliott_manual():o.finish_path(),t.finishDrawing(),s.onDirty();return}o.clear_drawing_preview(),t.drawingMode=null,e.style.cursor="crosshair",s.onDrawingCancel?.(),s.onDirty();return}let d=20;switch(_.key){case"+":case"=":o.zoom(e.width/2,e.height/2,.9);break;case"-":o.zoom(e.width/2,e.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}s.onDirty()};return window.addEventListener("keydown",f),()=>{t.disposed=!0,t.cancelMomentum(),window.removeEventListener("keydown",f)}}function yt(e,o,s){return{enableRsi(){e.enable_rsi(),o()},disableRsi(){e.disable_rsi(),o()},setRsiPeriod(t){e.set_rsi_period(t),o()},isRsiEnabled(){return e.is_rsi_enabled()},setRsiShowEma(t){e.set_rsi_show_ema(t),o()},setRsiShowWma(t){e.set_rsi_show_wma(t),o()},setRsiShowSignals(t){e.set_rsi_show_signals(t),o()},setRsiShowDivergence(t){e.set_rsi_show_divergence(t),o()},setRsiShowTraps(t){e.set_rsi_show_traps(t),o()},setRsiSmoothing(t){e.set_rsi_smoothing(t),o()},setRsiRatio(t){e.set_rsi_ratio(t),o()},getRsiRatio(){return e.get_rsi_ratio()},enableForexSignals(){e.enable_forex_signals(),o()},disableForexSignals(){e.disable_forex_signals(),o()},isForexSignalsEnabled(){return e.is_forex_signals_enabled()},setForexSignalsSetup(t){e.set_forex_signals_setup(t),o()},setForexSignalsMode(t){e.set_forex_signals_mode(t),o()},setForexSignalsShowStats(t){e.set_forex_signals_show_stats(t),o()},getForexSignalsCount(){return e.get_forex_signals_count()},enableOi(){s()||(e.enable_oi(),o())},disableOi(){s()||(e.disable_oi(),o())},isOiEnabled(){if(s())return!1;try{return e.is_oi_enabled()}catch{return!1}},setOiData(t){s()||(e.set_oi_data(t),o())},setOiDataTs(t,l){s()||(e.set_oi_data_ts(t,l),o())},setOiShowOnChart(t){s()||(e.set_oi_show_on_chart(t),o())},setOiDisplayMode(t){s()||(e.set_oi_display_mode(t),o())},setOiRatio(t){s()||(e.set_oi_ratio(t),o())},getOiRatio(){if(s())return .2;try{return e.get_oi_ratio()}catch{return .2}},enableFundingRate(){s()||(e.enable_funding_rate(),o())},disableFundingRate(){s()||(e.disable_funding_rate(),o())},isFundingRateEnabled(){if(s())return!1;try{return e.is_funding_rate_enabled()}catch{return!1}},setFrBinanceData(t,l){s()||(e.set_fr_binance_data(t,l),o())},setFrAggData(t,l){s()||(e.set_fr_agg_data(t,l),o())},setFrShowAgg(t){s()||(e.set_fr_show_agg(t),o())},setFrShowSma(t){s()||(e.set_fr_show_sma(t),o())},enableCvd(){s()||(e.enable_cvd(),o())},disableCvd(){s()||(e.disable_cvd(),o())},isCvdEnabled(){if(s())return!1;try{return e.is_cvd_enabled()}catch{return!1}},setCvdData(t,l){s()||(e.set_cvd_data(t,l),o())},setCvdMode(t){s()||(e.set_cvd_mode(t),o())},getCvdMode(){if(s())return 0;try{return e.get_cvd_mode()}catch{return 0}},setCvdShowDelta(t){s()||(e.set_cvd_show_delta(t),o())},getCvdShowDelta(){if(s())return!0;try{return e.get_cvd_show_delta()}catch{return!0}},enableLargeTrades(){s()||(e.enable_large_trades(),o())},disableLargeTrades(){s()||(e.disable_large_trades(),o())},isLargeTradesEnabled(){if(s())return!1;try{return e.is_large_trades_enabled()}catch{return!1}},setLargeTradesData(t){s()||(e.set_large_trades_data(t),o())},pushLargeTrade(t,l,a,n){s()||(e.push_large_trade(t,l,a,n),o())},clearLargeTrades(){s()||(e.clear_large_trades(),o())},setLtVolumeFilter(t,l){s()||(e.set_lt_volume_filter(t,l),o())},setLtBubbleScale(t){s()||(e.set_lt_bubble_scale(t),o())},getLtDataMinVol(){return s()?0:e.get_lt_data_min_vol()},getLtDataMaxVol(){return s()?0:e.get_lt_data_max_vol()},ltHitTest(t,l){if(s())return"";try{return e.lt_hit_test(t,l)}catch{return""}},enableVrvp(){s()||(e.enable_vrvp(),o())},disableVrvp(){s()||(e.disable_vrvp(),o())},isVrvpEnabled(){if(s())return!1;try{return e.is_vrvp_enabled()}catch{return!1}},setVrvpPocLine(t){s()||(e.set_vrvp_poc_line(t),o())},vrvpHitTest(t,l){if(s())return"";try{return e.vrvp_hit_test(t,l)}catch{return""}},enableTpo(){s()||(e.enable_tpo(),o())},disableTpo(){s()||(e.disable_tpo(),o())},isTpoEnabled(){if(s())return!1;try{return e.is_tpo_enabled()}catch{return!1}},setTpoPocLine(t){s()||(e.set_tpo_poc_line(t),o())},setTpoVaLines(t){s()||(e.set_tpo_va_lines(t),o())},setTpoIb(t){s()||(e.set_tpo_ib(t),o())},setTpoSinglePrints(t){s()||(e.set_tpo_single_prints(t),o())},setTpoPeriod(t){s()||(e.set_tpo_period(t),o())},getTpoPeriod(){if(s())return 1440;try{return e.get_tpo_period()}catch{return 1440}},setTpoNakedPoc(t){s()||(e.set_tpo_naked_poc(t),o())},setTpoProfileShape(t){s()||(e.set_tpo_profile_shape(t),o())},setTpoIbMinutes(t){s()||(e.set_tpo_ib_minutes(t),o())},setTpoLetterMinutes(t){s()||(e.set_tpo_letter_minutes(t),o())},setTpoSignals(t){s()||(e.set_tpo_signals(t),o())},isTpoSignals(){if(s())return!1;try{return e.is_tpo_signals()}catch{return!1}},enableLiqHeatmap(){s()||(e.enable_liq_heatmap(),o())},disableLiqHeatmap(){s()||(e.disable_liq_heatmap(),o())},isLiqHeatmapEnabled(){if(s())return!1;try{return e.is_liq_heatmap_enabled()}catch{return!1}},setLiqHeatmapRange(t,l){s()||(e.set_liq_heatmap_range(t,l),o())},getLiqHeatmapMin(){if(s())return 0;try{return e.get_liq_heatmap_min()}catch{return 0}},getLiqHeatmapMax(){if(s())return 1;try{return e.get_liq_heatmap_max()}catch{return 1}},getLiqHeatmapSegMax(){if(s())return 0;try{return e.get_liq_heatmap_seg_max()}catch{return 0}},setLiqHeatmapProfile(t){s()||(e.set_liq_heatmap_profile(t),o())},isLiqHeatmapProfile(){if(s())return!0;try{return e.is_liq_heatmap_profile()}catch{return!0}},setLiqHeatmapCellHeight(t){s()||(e.set_liq_heatmap_cell_height(t),o())},getLiqHeatmapCellHeight(){if(s())return 1;try{return e.get_liq_heatmap_cell_height()}catch{return 1}},setLiqHeatmapPredictions(t){s()||(e.set_liq_heatmap_predictions(t),o())},setLiqHeatmapFilledPct(t){s()||(e.set_liq_heatmap_filled_pct(t),o())},getLiqHeatmapFilledPct(){if(s())return .85;try{return e.get_liq_heatmap_filled_pct()}catch{return .85}},liqHeatmapHitTest(t,l){if(s())return"";try{return e.liq_heatmap_hit_test(t,l)}catch{return""}},liqZoneHitTest(t,l){if(s())return"";try{return e.liq_zone_hit_test(t,l)}catch{return""}},enableSmartRanges(){s()||(e.enable_smart_ranges(),o())},disableSmartRanges(){s()||(e.disable_smart_ranges(),o())},isSmartRangesEnabled(){if(s())return!1;try{return e.is_smart_ranges_enabled()}catch{return!1}},setSrTextSize(t){s()||(e.set_sr_text_size(t),o())},setSrShowOb(t){s()||(e.set_sr_show_ob(t),o())},setSrObLast(t){s()||(e.set_sr_ob_last(t),o())},setSrShowObActivity(t){s()||(e.set_sr_show_ob_activity(t),o())},setSrShowBreakers(t){s()||(e.set_sr_show_breakers(t),o())},setSrMitigation(t){s()||(e.set_sr_mitigation(t),o())},setSrShowMetrics(t){s()||(e.set_sr_show_metrics(t),o())},setSrShowHtfOb(t){s()||(e.set_sr_show_htf_ob(t),o())},setSrHtfMinutes(t){s()||(e.set_sr_htf_minutes(t),o())},setSrShowFvg(t){s()||(e.set_sr_show_fvg(t),o())},setSrFvgTheme(t){s()||(e.set_sr_fvg_theme(t),o())},setSrFvgMitigation(t){s()||(e.set_sr_fvg_mitigation(t),o())},setSrFvgHtf(t){s()||(e.set_sr_fvg_htf(t),o())},setSrFvgExtend(t){s()||(e.set_sr_fvg_extend(t),o())},setSrShowObSignals(t){s()||(e.set_sr_show_ob_signals(t),o())},setSrShowPredict(t){s()||(e.set_sr_show_predict(t),o())},setSrShowFvgSignals(t){s()||(e.set_sr_show_fvg_signals(t),o())},setSrShowSmartRev(t){s()||(e.set_sr_show_smart_rev(t),o())},setSrSmartRevHtf(t){s()||(e.set_sr_smart_rev_htf(t),o())},setSrStatsType(t){s()||(e.set_sr_stats_type(t),o())},setSrStatsPosition(t){s()||(e.set_sr_stats_position(t),o())},getSrSignalsCount(){if(s())return 0;try{return e.get_sr_signals_count()}catch{return 0}},enableEmaStructure(){s()||(e.enable_ema_structure(),o())},disableEmaStructure(){s()||(e.disable_ema_structure(),o())},isEmaStructureEnabled(){if(s())return!1;try{return e.is_ema_structure_enabled()}catch{return!1}},setEsEma1Len(t){s()||(e.set_es_ema1_len(t),o())},setEsEma2Len(t){s()||(e.set_es_ema2_len(t),o())},setEsWmaLen(t){s()||(e.set_es_wma_len(t),o())},setEsShowEma1(t){s()||(e.set_es_show_ema1(t),o())},setEsShowEma2(t){s()||(e.set_es_show_ema2(t),o())},setEsShowWma(t){s()||(e.set_es_show_wma(t),o())},setEsSwingLen(t){s()||(e.set_es_swing_len(t),o())},setEsShowBos(t){s()||(e.set_es_show_bos(t),o())},enableLiveSignals(){s()||(e.enable_live_signals(),o())},disableLiveSignals(){s()||(e.disable_live_signals(),o())},isLiveSignalsEnabled(){if(s())return!1;try{return e.is_live_signals_enabled()}catch{return!1}},setLiveSignalsData(t){s()||(e.set_live_signals_data(new Float64Array(t)),o())},clearLiveSignals(){s()||(e.clear_live_signals(),o())},setLiveSignalsLeverage(t){s()||(e.set_live_signals_leverage(t),o())},getLiveSignalsLeverage(){if(s())return 10;try{return e.get_live_signals_leverage()}catch{return 10}},setLiveSignalsTrial(t){s()||(e.set_live_signals_trial(t),o())},setLiveSignalsShowEntry(t){s()||(e.set_live_signals_show_entry(t),o())},setLiveSignalsShowTpSl(t){s()||(e.set_live_signals_show_tp_sl(t),o())},setLiveSignalsShowMaxProfit(t){s()||(e.set_live_signals_show_max_profit(t),o())},setLiveSignalsShowLabels(t){s()||(e.set_live_signals_show_labels(t),o())},setLiveSignalsShowZones(t){s()||(e.set_live_signals_show_zones(t),o())},setLiveSignalsTextSize(t){s()||(e.set_live_signals_text_size(t),o())},setLiveSignalsPipValue(t){s()||(e.set_live_signals_pip_value(t),o())},setLiveSignalsLoading(t){s()||(e.set_live_signals_loading(t),o())},getLiveSignalsCount(){if(s())return 0;try{return e.get_live_signals_count()}catch{return 0}},enableVolume(){e.enable_volume(),o()},disableVolume(){e.disable_volume(),o()},isVolumeEnabled(){return e.is_volume_enabled()},setVolumeMaPeriod(t){e.set_volume_ma_period(t),o()},setVolumeShowMa(t){e.set_volume_show_ma(t),o()},setVolumeShowSignals(t){e.set_volume_show_signals(t),o()},setVolumeColorMode(t){e.set_volume_color_mode(t),o()},getVolumeMaPeriod(){return e.get_volume_ma_period()},getVolumeShowMa(){return e.get_volume_show_ma()},getVolumeShowSignals(){return e.get_volume_show_signals()},getVolumeColorMode(){return e.get_volume_color_mode()}}}function At(e,o,s){return{addMarker(t,l,a){e.add_marker(t,l,a),o()},clearMarkers(){e.clear_markers(),o()},hitTestMarker(t,l){return e.hit_test_marker(t,l)},selectMarker(t){e.select_marker(t),o()},deselectMarker(){e.deselect_marker(),o()},getSelectedMarker(){return e.get_selected_marker()},removeMarker(t){e.remove_marker(t),o()},deleteSelectedMarker(){let t=e.get_selected_marker();return t>0&&(e.remove_marker(t),o()),t},addTrendline(t,l,a,n,r,i,f,_,m,u=0){let d=e.add_trendline(t,l,a,n,r,i,f,_,m,u);return o(),d},addHorizontalLine(t,l,a,n,r,i,f,_=0){let m=e.add_horizontal_line(t,l,a,n,r,i,f,_);return o(),m},addArrow(t,l,a,n,r,i,f,_,m,u=0){let d=e.add_arrow(t,l,a,n,r,i,f,_,m,u);return o(),d},addFibRetracement(t,l,a,n,r,i,f,_,m,u=0){let d=e.add_fib_retracement(t,l,a,n,r,i,f,_,m,u);return o(),d},addFibExtension(t,l,a,n,r,i,f,_,m,u,d,h=0){let c=e.add_fib_extension(t,l,a,n,r,i,f,_,m,u,d,h);return o(),c},addLongPosition(t,l,a,n,r,i,f,_,m,u=0){let d=e.add_long_position(t,l,a,n,r,i,f,_,m,u);return o(),d},addShortPosition(t,l,a,n,r,i,f,_,m,u=0){let d=e.add_short_position(t,l,a,n,r,i,f,_,m,u);return o(),d},addAnchoredVwap(t,l,a,n,r,i,f=0){let _=e.add_anchored_vwap(t,l,a,n,r,i,f);return o(),_},addPriceLabel(t,l,a,n,r,i,f=0){let _=e.add_price_label(t,l,a,n,r,i,f);return o(),_},addElliottImpulse(t,l,a,n,r,i,f=0){let _=e.add_elliott_impulse(t,l,a,n,r,i,f);return o(),_},setDrawingFontSize(t,l){e.set_drawing_font_size(t,l),o()},getDrawingFontSize(t){return e.get_drawing_font_size(t)},setDrawingText(t,l){e.set_drawing_text(t,l),o()},getDrawingText(t){return e.get_drawing_text(t)},setDrawingStyle(t,l,a,n,r){e.set_drawing_style(t,l,a,n,r),o()},getDrawingColor(t){let l=e.get_drawing_color(t);return l?{r:l>>>24&255,g:l>>>16&255,b:l>>>8&255,lineWidth:(l&255)/10}:null},getDrawingDashed(t){try{return e.get_drawing_dashed(t)}catch{return!1}},setDrawingDashed(t,l){e.set_drawing_dashed(t,l),o()},getDrawingHideLabel(t){try{return e.get_drawing_hide_label(t)}catch{return!1}},setDrawingHideLabel(t,l){e.set_drawing_hide_label(t,l),o()},getDrawingKindId(t){try{return e.get_drawing_kind_id(t)}catch{return 255}},removeDrawing(t){e.remove_drawing(t),o()},clearDrawings(){e.clear_drawings(),o()},drawingCount(){return e.drawing_count()},setDrawingPreview(t,l,a,n,r,i,f,_,m,u,d=0){e.set_drawing_preview(t,l,a,n,r,i,f,_,m,u,d),o()},clearDrawingPreview(){e.clear_drawing_preview(),o()},cancelBrush(){e.cancel_brush(),o()},selectDrawing(t){e.select_drawing(t),o()},deselectDrawing(){e.deselect_drawing(),o()},getSelectedDrawing(){return e.get_selected_drawing()},deleteSelectedDrawing(){let t=e.get_selected_drawing();return t>0&&(e.remove_drawing(t),o()),t},exportDrawingsJson(){try{return e.export_drawings_json()}catch{return"[]"}},importDrawingsJson(t){try{e.import_drawings_json(t),o()}catch(l){console.warn("[bridge] importDrawingsJson failed",l)}},screenToWorld(t,l){return{x:e.screen_to_world_x(t),y:e.screen_to_world_y(l)}},worldToScreen(t,l){try{return{x:e.world_to_screen_x(t),y:e.world_to_screen_y(l)}}catch{return null}}}}function Yt(e,o,s){return{setKlines(t,l,a,n,r,i){e.set_klines(new Float64Array(t),new Float64Array(l),new Float64Array(a),new Float64Array(n),new Float64Array(r),new Float64Array(i)),o()},setRealTimestamps(t){e.set_real_timestamps(new Float64Array(t)),o()},appendRealTimestamp(t){e.append_real_timestamp(t)},prependKlines(t,l,a,n,r,i){e.prepend_klines(new Float64Array(t),new Float64Array(l),new Float64Array(a),new Float64Array(n),new Float64Array(r),new Float64Array(i)),o()},appendKline(t,l,a,n,r,i){e.append_kline(t,l,a,n,r,i),o()},updateLastKline(t,l,a,n,r,i){e.update_last_kline(t,l,a,n,r,i),o()},popLastKline(){let t=e.pop_last_kline();return t&&o(),t},getLastClose(){try{return e.get_last_close()}catch{return 0}},getKlineCount(){if(s())return 0;try{return e.kline_count()}catch{return 0}},getKlineTimestamps(){if(s())return null;try{return e.kline_timestamps()}catch{return null}},getKlineOpens(){if(s())return null;try{return e.kline_opens()}catch{return null}},getKlineHighs(){if(s())return null;try{return e.kline_highs()}catch{return null}},getKlineLows(){if(s())return null;try{return e.kline_lows()}catch{return null}},getKlineCloses(){if(s())return null;try{return e.kline_closes()}catch{return null}},getKlineVolumes(){if(s())return null;try{return e.kline_volumes()}catch{return null}},setHeatmap(t,l,a,n,r,i,f){e.set_heatmap(new Float64Array(t),l,a,n,r,i,f),o()},appendHeatmapColumn(t,l,a,n){e.append_heatmap_column(new Float64Array(t),l,a,n),o()},updateLastHeatmapColumn(t,l,a){e.update_last_heatmap_column(new Float64Array(t),l,a),o()},getHeatmapLastTimestamp(){try{return e.get_heatmap_last_timestamp()}catch{return 0}},getHeatmapXStep(){try{return e.get_heatmap_x_step()}catch{return 0}},updateHeatmapColumnAt(t,l,a,n){e.update_heatmap_column_at(new Float64Array(t),l,a,n),o()},setHeatmapRange(t,l){e.set_heatmap_range(t,l),o()},getHeatmapDataRange(){try{return{min:e.get_heatmap_data_min(),max:e.get_heatmap_data_max()}}catch{return{min:0,max:0}}},setHeatmapPrefetchRange(t){try{e.set_heatmap_prefetch_range(t)}catch{}},clearHeatmapPrefetchRange(){try{e.clear_heatmap_prefetch_range()}catch{}},getHeatmapPrefetchMax(){try{return e.get_heatmap_prefetch_max()}catch{return 0}},setChartType(t){s()||(e.set_chart_type(t),o())},getChartType(){if(s())return 0;try{return e.get_chart_type()}catch{return 0}},setFootprintTickSize(t){s()||(e.set_footprint_tick_size(t),o())},footprintEnsureLen(t){s()||e.footprint_ensure_len(t)},footprintAddTrade(t,l,a,n){s()||e.footprint_add_trade(t,l,a,n)},footprintAddTradeBatch(t){s()||!t||t.length===0||e.footprint_add_trade_batch(t instanceof Float64Array?t:new Float64Array(t))},footprintSetBar(t,l,a,n,r){s()||(e.footprint_set_bar(t,l,a,n,r),o())},footprintClear(){s()||(e.footprint_clear(),o())},footprintClearBar(t){s()||e.footprint_clear_bar(t)},footprintPrependEmpty(t){s()||e.footprint_prepend_empty(t)},footprintSetShowSignals(t){s()||(e.footprint_set_show_signals(t),o())},footprintGetShowSignals(){if(s())return!0;try{return e.footprint_get_show_signals()}catch{return!0}},footprintSignalCount(){if(s())return 0;try{return e.footprint_signal_count()}catch{return 0}},footprintSetShowProfile(t){s()||(e.footprint_set_show_profile(t),o())},footprintGetShowProfile(){if(s())return!1;try{return e.footprint_get_show_profile()}catch{return!1}},footprintProfileHitTest(t,l){if(s())return"";try{return e.footprint_profile_hit_test(t,l)}catch{return""}}}}var Gt=1;function R(e){if(typeof e!="string")return{r:255,g:255,b:255,a:153};if(e.startsWith("#")){let s=e.slice(1);if(s.length===8)return{r:parseInt(s.slice(0,2),16),g:parseInt(s.slice(2,4),16),b:parseInt(s.slice(4,6),16),a:parseInt(s.slice(6,8),16)};let t=parseInt(s.slice(0,2),16),l=parseInt(s.slice(2,4),16),a=parseInt(s.slice(4,6),16);return{r:t,g:l,b:a,a:255}}let o=e.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 St(e,o,s){let t=new Map,l=null,a=0,n=NaN;function r(){let u;try{u=e.kline_count()}catch{return l}if(u===0)return null;let d=e.kline_closes(),h=d?.[u-1]??NaN;if(l&&!(u!==a||h!==n))return l;try{let p=e.kline_timestamps(),w=e.kline_opens(),S=e.kline_highs(),T=e.kline_lows(),E=e.kline_volumes();if(!p||!d)return l;l={timestamps:Array.from(p),open:Array.from(w),high:Array.from(S),low:Array.from(T),close:Array.from(d),volume:Array.from(E),length:u},a=u,n=h;for(let Y of t.values())Y._needsCompute=!0}catch{}return l}function i(){return{seriesLine(u,d="#ffffff99",h=1.5){let c=R(d);e.custom_series_line(new Float64Array(u),c.r,c.g,c.b,c.a,h)},seriesDashedLine(u,d="#ffffff66",h=1,c=4,p=4){let w=R(d);e.custom_series_dashed_line(new Float64Array(u),w.r,w.g,w.b,w.a,h,c,p)},band(u,d,h="rgba(100,149,237,0.08)"){let c=R(h);e.custom_band(new Float64Array(u),new Float64Array(d),c.r,c.g,c.b,c.a)},hline(u,d="#ffffff66",h=1){let c=R(d);e.custom_hline(u,c.r,c.g,c.b,c.a,h)},dashedHline(u,d="#ffffff66",h=1,c=6,p=4){let w=R(d);e.custom_dashed_hline(u,w.r,w.g,w.b,w.a,h,c,p)},marker(u,d,h="#e8a04a",c=3){let p=R(h);e.custom_marker(u,d,p.r,p.g,p.b,p.a,c)},markerUp(u,d,h="#26a69a",c=5){let p=R(h);e.custom_marker_up(u,d,p.r,p.g,p.b,p.a,c)},markerDown(u,d,h="#ef5350",c=5){let p=R(h);e.custom_marker_down(u,d,p.r,p.g,p.b,p.a,c)},text(u,d,h,c="#ffffffaa",p=10,w="center"){let S=R(c),T=w==="center"?1:w==="right"?2:0;e.custom_text(u,d,h,S.r,S.g,S.b,S.a,p,T)},priceLabel(u,d,h="#ffffffaa",c=10){let p=R(h);e.custom_price_label(u,d,p.r,p.g,p.b,p.a,c)},linePx(u,d,h,c,p,w=1){let S=R(p);e.custom_line_px(u,d,h,c,S.r,S.g,S.b,S.a,w)},fillRectPx(u,d,h,c,p){let w=R(p);e.custom_fill_rect_px(u,d,h,c,w.r,w.g,w.b,w.a)},strokeRectPx(u,d,h,c,p,w=1){let S=R(p);e.custom_stroke_rect_px(u,d,h,c,S.r,S.g,S.b,S.a,w)},textPx(u,d,h,c,p=10,w="left"){let S=R(c),T=w==="center"?1:w==="right"?2:0;e.custom_text_px(u,d,h,S.r,S.g,S.b,S.a,p,T)},worldToScreenX:u=>e.world_to_screen_x(u),worldToScreenY:u=>e.world_to_screen_y(u),screenToWorldX:u=>e.screen_to_world_x(u),screenToWorldY:u=>e.screen_to_world_y(u),chartArea:()=>({x:e.chart_area_x(),y:e.chart_area_y(),w:e.chart_area_w(),h:e.chart_area_h()})}}function f(u){if(!u.compute)return;let d=r();if(d)try{u._computed=u.compute(d,u.params)||{}}catch(h){console.warn(`[CustomIndicator "${u.name}"] compute error:`,h),u._computed={}}}function _(u){if(t.size===0)return;let d=r();if(!d)return;e.custom_begin();let h=i();for(let p of t.values())if(p.enabled){p._needsCompute&&(f(p),p._needsCompute=!1);try{p.render.call(p,h,p._computed||{},d)}catch(w){console.warn(`[CustomIndicator "${p.name}"] render error:`,w)}}if(e.custom_end(),e.custom_command_count()>0){let p=e.get_custom_buffer_ptr(),w=e.get_custom_buffer_len();s(u,o,p,w)}}function m(){l=null,a=0,n=NaN;for(let u of t.values())u._needsCompute=!0}return{add(u){let d=Gt++,h={id:d,name:u.name||`Custom ${d}`,params:{...u.params},compute:u.compute||null,render:u.render,enabled:!0,_computed:{},_needsCompute:!0};return t.set(d,h),d},remove(u){t.delete(u)},updateParams(u,d){let h=t.get(u);h&&(Object.assign(h.params,d),h._needsCompute=!0)},setEnabled(u,d){let h=t.get(u);h&&(h.enabled=d)},list(){return[...t.values()].map(u=>({id:u.id,name:u.name,params:{...u.params},enabled:u.enabled}))},invalidateCompute:m,renderAll:_}}var It="trial",Jt="MRD Chart Engine \u2014 Trial",Qt="License Expired \u2014 mrd-chart.dev/pricing",Xt="__mrd_ce_t";function ut(e){if(!e||e==="trial")return jt();try{let o=JSON.parse(atob(e)),{p:s,d:t,e:l,s:a}=o;if(!s||!a)return{valid:!1,error:"Invalid license key format"};if(l>0&&Date.now()/1e3>l)return{valid:!1,expired:!0,plan:s,error:`License expired on ${new Date(l*1e3).toLocaleDateString()}`};if(t&&t!=="*"&&typeof window<"u"){let n=window.location.hostname;if(!xt(t,n))return{valid:!1,error:`License not valid for domain: ${n}`}}return{valid:!0,plan:s,domain:t,expiry:l,watermark:!1}}catch{return{valid:!1,error:"Invalid license key"}}}function jt(){let e=kt();e||(e=Math.floor(Date.now()/1e3),te(e));let o=e+14*86400,s=Date.now()/1e3,t=Math.max(0,Math.ceil((o-s)/86400));return s>o?{valid:!1,expired:!0,plan:It,error:"14-day trial has expired",daysLeft:0}:{valid:!0,plan:It,watermark:!0,daysLeft:t,trialEnd:o}}function xt(e,o){if(e==="*"||e===o)return!0;if(e.startsWith("*.")){let s=e.slice(1);return o.endsWith(s)||o===e.slice(2)}return!1}function kt(){try{let e=localStorage.getItem(Xt);return e?parseInt(e,10):null}catch{return null}}function te(e){try{localStorage.setItem(Xt,String(e))}catch{}}function Ot(e,o,s){let t=o.width,l=o.height;if(e.save(),e.setTransform(1,0,0,1,0,0),s.expired)e.fillStyle="rgba(0, 0, 0, 0.65)",e.fillRect(0,0,t,l),e.font="bold 20px Inter, system-ui, sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillStyle="#ff4757",e.fillText(Qt,t/2,l/2-14),e.font="14px Inter, system-ui, sans-serif",e.fillStyle="#8b92a5",e.fillText("Purchase a license to continue using MRD Chart Engine",t/2,l/2+16);else{e.globalAlpha=.08,e.font="bold 16px Inter, system-ui, sans-serif",e.fillStyle="#ffffff",e.textAlign="center";let a=Jt,n=220;e.rotate(-.35);for(let d=-l;d<l*2;d+=n)for(let h=-t;h<t*2;h+=n)e.fillText(a,h,d);e.setTransform(1,0,0,1,0,0),e.globalAlpha=.75;let r=`TRIAL \u2014 ${s.daysLeft} day${s.daysLeft!==1?"s":""} left`;e.font="11px Inter, system-ui, sans-serif";let f=e.measureText(r).width+16,_=22,m=t-f-10,u=l-_-10;e.fillStyle="rgba(10, 124, 255, 0.85)",e.beginPath(),e.roundRect(m,u,f,_,4),e.fill(),e.fillStyle="#ffffff",e.textAlign="center",e.textBaseline="middle",e.fillText(r,m+f/2,u+_/2)}e.restore()}function ee({plan:e,domain:o="*",expiryDays:s=365}){let t=s>0?Math.floor(Date.now()/1e3)+s*86400:0,l={p:e,d:o,e:t,s:re(e,o,t)};return btoa(JSON.stringify(l))}function re(e,o,s){let t=`${e}:${o}:${s}:mrd-secret-2024`,l=0;for(let a=0;a<t.length;a++)l=(l<<5)-l+t.charCodeAt(a)|0;return l.toString(36)}var dt=null,vt=null,ot=null;async function zt(){return dt||ot||(ot=(async()=>{let e=await import("./chart_engine.js");return await e.default(),vt=e.wasm_memory(),dt=e,e})(),ot)}function oe(){!dt&&!ot&&zt().catch(()=>{})}async function se(e,o={}){let s=o.licenseKey||o.key||null,t=ut(s);if(!t.valid)if(t.expired)console.warn(`[MRD Chart Engine] ${t.error}. Get a license at https://mrd-chart.dev/pricing`);else throw new Error(`[MRD Chart Engine] ${t.error}`);t.plan==="trial"&&console.info(`[MRD Chart Engine] Trial mode \u2014 ${t.daysLeft} days remaining. Purchase: https://mrd-chart.dev/pricing`);let l=await zt(),a=window.devicePixelRatio||1,n=e.getBoundingClientRect();(n.width<1||n.height<1)&&(await new Promise(g=>{let v=new ResizeObserver(y=>{for(let Q of y)if(Q.contentRect.width>0&&Q.contentRect.height>0){v.disconnect(),g();return}});v.observe(e.parentElement||e),setTimeout(()=>{v.disconnect(),g()},2e3)}),n=e.getBoundingClientRect());let r=Math.max(n.width,100),i=Math.max(n.height,100);e.width=r*a,e.height=i*a;let f=e.getContext("2d");f.scale(a,a);let _=new l.ChartEngine(r,i),m=!0,u=null,d=!1,h=!1,c=!1,p=null,w=null,S=0,E=("ontouchstart"in window||navigator.maxTouchPoints>0)&&window.innerWidth<=1399?33:0;function Y(){if(!(!d||h||u)){if(E>0){let g=performance.now()-S;if(g<E){w||(w=setTimeout(()=>{w=null,Y()},E-g));return}}u=requestAnimationFrame(qt)}}let b=()=>{m=!0,Y()},D=()=>c,U=null,x=null,k=null,st=null,ht=null,L=null,z=null,C=null,N=0,G=null,tt=null,$=0,pt=0,J=-1,at=!1,it=!1,Ht=gt(e,_,{onDirty:b,onCrosshairMove:(g,v,y)=>{$=g,pt=v,J=y,at=!0,it=!0},onCrosshairHide:()=>{it&&(it=!1,at=!0,J=-1)},drawingApi:g=>{U=g},onDrawingComplete:()=>{x?.()},onDrawingCancel:()=>{k?.()},onDrawingSelected:(g,v,y)=>{st?.(g,v,y)},onMarkerSelected:g=>{ht?.(g)},onDrawingDblClick:(g,v,y,Q,Bt)=>{L?.(g,v,y,Q,Bt)},onVrvpHover:(g,v)=>{z?.(g,v)},onLiqAnnotationPin:(g,v)=>{tt?.(g,v)}});function Nt(){if(at){if(at=!1,!it){p&&p(null,0,0),C&&C("");return}if(p)if(J===0||J===1){let g=_.get_tooltip_data();p(g,$,pt)}else p(null,0,0);if(C){let g=performance.now();if(J===0||J===1){if(g-N>=80){N=g;try{C(_.lt_hit_test($,pt))}catch{}}}else C("")}}}function qt(){if(u=null,!(!d||h)&&(m||_.is_dirty())){m=!1,S=performance.now();let g=!1;try{if(_.render()>0){let y=_.get_command_buffer_ptr(),Q=_.get_command_buffer_len();f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,e.width,e.height),f.restore(),lt(f,vt,y,Q),g=!0}try{K.renderAll(f)}catch{}(t.watermark||t.expired)&&Ot(f,e,t)}catch{g||(m=!0)}Nt();try{G?.()}catch{}(m||_.is_dirty())&&Y()}}let Wt=yt(_,b,D),Vt=At(_,b,D),Zt=Yt(_,b,D),K=St(_,vt,lt);return{engine:_,start(){d=!0,h=!1,m=!0,Y()},stop(){d=!1,u&&(cancelAnimationFrame(u),u=null),w&&(clearTimeout(w),w=null)},resize(g){if(n=e.getBoundingClientRect(),n.width<1||n.height<1){(g||0)<8&&setTimeout(()=>this.resize((g||0)+1),250);return}a=window.devicePixelRatio||1;let v=n.width*a,y=n.height*a;e.width=v,e.height=y,f.setTransform(1,0,0,1,0,0),f.scale(a,a),_.resize(n.width,n.height),b()},setHoverPrice(g){_.set_hover_price(g),b()},clearHoverPrice(){_.clear_hover_price(),b()},hitZone(g,v){return _.hit_zone(g,v)},startDrawing(g,v){U?.setMode(g,v)},cancelDrawing(){U?.setMode(null)},onDrawingComplete(g){x=g},onDrawingCancel(g){k=g},onDrawingSelected(g){st=g},onMarkerSelected(g){ht=g},onDrawingDblClick(g){L=g},setReplayState(g,v,y){_.set_replay_state(g,v,y),b()},setReplayHovered(g){_.set_replay_hovered(g)},setReplayPreview(g){_.set_replay_preview(g),b()},setPrecision(g){_.set_price_precision(g),b()},setCandleInterval(g){_.set_candle_interval(g)},setTheme(g){let v=g==="light"?1:0;typeof _.set_theme=="function"?(_.set_theme(v),b()):console.warn("[ChartEngine] set_theme not available \u2014 reload page to load updated WASM")},getTheme(){return _.get_theme()===1?"light":"dark"},onTooltip(g){p=g},onVrvpHover(g){z=g},onLtHover(g){C=g},onPostRender(g){G=g},onLiqAnnotationPin(g){tt=g},pause(){h||(h=!0,u&&(cancelAnimationFrame(u),u=null),w&&(clearTimeout(w),w=null))},resume(){h&&(h=!1,d&&(m=!0,Y()))},get isPaused(){return h},destroy(){c=!0,d=!1,h=!1,u&&(cancelAnimationFrame(u),u=null),w&&(clearTimeout(w),w=null),Ht();try{_.free()}catch{}},addIndicator(g){let v=K.add(g);return b(),v},removeIndicator(g){K.remove(g),b()},updateIndicatorParams(g,v){K.updateParams(g,v),b()},setIndicatorEnabled(g,v){K.setEnabled(g,v),b()},listIndicators(){return K.list()},invalidateCustomIndicators(){K.invalidateCompute(),b()},get license(){return{plan:t.plan,valid:t.valid,expired:!!t.expired,watermark:!!t.watermark,daysLeft:t.daysLeft}},setLicenseKey(g){return t=ut(g),!t.valid&&!t.expired&&console.error(`[MRD Chart Engine] ${t.error}`),b(),t.valid},...Zt,...Wt,...Vt}}export{se as createChartBridge,St as createCustomIndicatorManager,lt as dispatchCommands,ee as generateLicenseKey,oe as prefetchWasm,gt as setupEvents,ut as validateLicense};
1
+ var C={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},he=["left","center","right"],_t=new Map,ce=4096;function pe(e,o,s,t){return e<<24|o<<16|s<<8|t}function X(e,o,s,t){let l=pe(e,o,s,t),a=_t.get(l);return a||(a=`rgba(${e},${o},${s},${(t/255).toFixed(3)})`,_t.size>=ce&&_t.clear(),_t.set(l,a),a)}var Xt=new TextDecoder;function dt(e,o,s,t){let l=o.buffer;if(s+t>l.byteLength)return;let a=new DataView(l,s,t),i=new Uint8Array(l,s,t),r=0,n="",_="",u=-1,m="";for(;r<t;){let f=i[r];if(r+=1,f===C.END_FRAME)break;switch(f){case C.FILL_RECT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4,w!==n&&(e.fillStyle=w,n=w),e.fillRect(d,h,p,c);break}case C.STROKE_RECT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4,w!==_&&(e.strokeStyle=w,_=w),S!==u&&(e.lineWidth=S,u=S),e.strokeRect(d,h,p,c);break}case C.LINE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4,e.beginPath(),w!==_&&(e.strokeStyle=w,_=w),S!==u&&(e.lineWidth=S,u=S),e.setLineDash([]),e.moveTo(d,h),e.lineTo(p,c),e.stroke();break}case C.DASHED_LINE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4;let M=a.getFloat32(r,!0);r+=4;let E=a.getFloat32(r,!0);r+=4,e.beginPath(),w!==_&&(e.strokeStyle=w,_=w),S!==u&&(e.lineWidth=S,u=S),e.setLineDash([M,E]),e.moveTo(d,h),e.lineTo(p,c),e.stroke(),e.setLineDash([]);break}case C.POLYLINE:{let d=a.getUint16(r,!0);r+=2;let h=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let p=a.getFloat32(r,!0);if(r+=4,d>0){let c=new Float32Array(d*2);for(let w=0;w<d;w++)c[w*2]=a.getFloat32(r,!0),r+=4,c[w*2+1]=a.getFloat32(r,!0),r+=4;if(e.beginPath(),h!==_&&(e.strokeStyle=h,_=h),p!==u&&(e.lineWidth=p,u=p),e.setLineDash([]),e.lineJoin="round",e.lineCap="round",d<=3){e.moveTo(c[0],c[1]);for(let w=1;w<d;w++)e.lineTo(c[w*2],c[w*2+1])}else{e.moveTo(c[0],c[1]),e.lineTo((c[0]+c[2])*.5,(c[1]+c[3])*.5);for(let w=1;w<d-1;w++){let S=c[w*2],M=c[w*2+1],E=c[(w+1)*2],I=c[(w+1)*2+1];e.quadraticCurveTo(S,M,(S+E)*.5,(M+I)*.5)}e.lineTo(c[(d-1)*2],c[(d-1)*2+1])}e.stroke()}break}case C.TEXT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=i[r];r+=1;let S=a.getUint16(r,!0);r+=2;let M=Xt.decode(new Uint8Array(o.buffer,s+r,S));r+=S,p!==n&&(e.fillStyle=p,n=p);let E=`${c}px "IBM Plex Mono",monospace`;E!==m&&(e.font=E,m=E),e.textAlign=he[w]||"left",e.textBaseline="middle",e.fillText(M,d,h);break}case C.CIRCLE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let w=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let S=a.getFloat32(r,!0);r+=4,e.beginPath(),e.arc(d,h,p,0,Math.PI*2),c!==n&&(e.fillStyle=c,n=c),e.fill(),S>0&&(w!==_&&(e.strokeStyle=w,_=w),S!==u&&(e.lineWidth=S,u=S),e.stroke());break}case C.TRIANGLE:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=a.getFloat32(r,!0);r+=4;let S=a.getFloat32(r,!0);r+=4;let M=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4,e.beginPath(),e.moveTo(d,h),e.lineTo(p,c),e.lineTo(w,S),e.closePath(),M!==n&&(e.fillStyle=M,n=M),e.fill();break}case C.SAVE:{e.save();break}case C.RESTORE:{e.restore(),n="",_="",u=-1,m="";break}case C.CLIP_RECT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4,e.beginPath(),e.rect(d,h,p,c),e.clip();break}case C.ROTATED_TEXT:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=a.getFloat32(r,!0);r+=4;let S=a.getUint16(r,!0);r+=2;let M=Xt.decode(i.subarray(r,r+S));r+=S;let E=`${c}px sans-serif`;E!==m&&(e.font=E,m=E),p!==n&&(e.fillStyle=p,n=p),e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(d,h),e.rotate(w),e.fillText(M,0,0),e.restore();break}case C.BUBBLE_3D:{let d=a.getFloat32(r,!0);r+=4;let h=a.getFloat32(r,!0);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=i[r],w=i[r+1],S=i[r+2],M=i[r+3];r+=4;let E=i[r],I=i[r+1],P=i[r+2],U=i[r+3];r+=4;let G=i[r],tt=i[r+1],et=i[r+2],lt=i[r+3];r+=4;let mt=a.getFloat32(r,!0);r+=4;let L=p;if(L<10){let N=`rgba(${c},${w},${S},${(M/255).toFixed(3)})`;e.beginPath(),e.arc(d,h,L,0,Math.PI*2),e.fillStyle=N,e.fill(),n=""}else if(L<18){let N=d-L*.25,A=h-L*.25,q=e.createRadialGradient(N,A,L*.08,d,h,L);q.addColorStop(0,`rgba(${E},${I},${P},${(U/255).toFixed(3)})`),q.addColorStop(1,`rgba(${c},${w},${S},${(M/255).toFixed(3)})`),e.beginPath(),e.arc(d,h,L,0,Math.PI*2),e.fillStyle=q,e.fill(),n=""}else{let N=d-L*.25,A=h-L*.25,q=e.createRadialGradient(d,h,L*.85,d,h,L*1.2);q.addColorStop(0,`rgba(${G},${tt},${et},${(lt/255*.5).toFixed(3)})`),q.addColorStop(1,`rgba(${G},${tt},${et},0)`),e.beginPath(),e.arc(d,h,L*1.2,0,Math.PI*2),e.fillStyle=q,e.fill();let j=e.createRadialGradient(N,A,L*.08,d,h,L);j.addColorStop(0,`rgba(${E},${I},${P},${(U/255).toFixed(3)})`),j.addColorStop(1,`rgba(${c},${w},${S},${(M/255).toFixed(3)})`),e.beginPath(),e.arc(d,h,L,0,Math.PI*2),e.fillStyle=j,e.fill();let rt=L*.2,K=e.createRadialGradient(N,A,0,N,A,rt);K.addColorStop(0,"rgba(255,255,255,0.22)"),K.addColorStop(1,"rgba(255,255,255,0)"),e.beginPath(),e.arc(N,A,rt,0,Math.PI*2),e.fillStyle=K,e.fill(),n=""}break}case C.FILL_POLYGON:{let d=a.getUint16(r,!0);r+=2;let h=X(i[r],i[r+1],i[r+2],i[r+3]);if(r+=4,d>2){e.beginPath();let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4,e.moveTo(p,c);for(let w=1;w<d;w++)e.lineTo(a.getFloat32(r,!0),a.getFloat32(r+4,!0)),r+=8;e.closePath(),h!==n&&(e.fillStyle=h,n=h),e.fill()}else r+=d*8;break}case C.DASHED_POLYLINE:{let d=a.getUint16(r,!0);r+=2;let h=X(i[r],i[r+1],i[r+2],i[r+3]);r+=4;let p=a.getFloat32(r,!0);r+=4;let c=a.getFloat32(r,!0);r+=4;let w=a.getFloat32(r,!0);if(r+=4,d>1){e.beginPath(),h!==_&&(e.strokeStyle=h,_=h),p!==u&&(e.lineWidth=p,u=p),e.setLineDash([c,w]),e.lineJoin="round";let S=a.getFloat32(r,!0);r+=4;let M=a.getFloat32(r,!0);r+=4,e.moveTo(S,M);for(let E=1;E<d;E++)e.lineTo(a.getFloat32(r,!0),a.getFloat32(r+4,!0)),r+=8;e.stroke(),e.setLineDash([])}else r+=d*8;break}default:return}}}var O={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 ot(e){return O[e]?.type==="2point"}function st(e){return O[e]?.type==="3point"}function Q(e){let o=O[e]?.type;return o==="1point"||o==="1point_x"||o==="1point_xy"||o==="1point_xp"}function ht(e){return O[e]?.type==="freehand"}function V(e){return O[e]?.type==="npoint"}function W(e){return O[e]?.type==="elliott_manual"}var Ot={r:.04,g:.49,b:1,lineWidth:2,dashed:!1,fontSize:12};function Z(e,o,s,t,l,a){a=a||Ot;let i=O[o];if(!i)return 0;let r=0;return i.type==="3point"?r=e[i.addFn](s.x1,s.y1,s.x2,s.y2,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):i.type==="2point"?r=e[i.addFn](s.x1,s.y1,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):i.type==="1point_x"?r=e[i.addFn](t,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):i.type==="1point_xp"?r=e[i.addFn](t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane):i.type==="1point_xy"?r=e[i.addFn](t,l,a.r,a.g,a.b,a.fontSize||12,s.pane):r=e[i.addFn](l,a.r,a.g,a.b,a.lineWidth,a.dashed,s.pane),r||0}function z(e,o,s,t,l,a,i){a=a||Ot;let r=O[o];if(r){if(r.previewFn==="elliott"){e.set_elliott_preview(t,l,a.r,a.g,a.b,a.lineWidth,i);return}r.type==="3point"?s.step===1?e.set_drawing_preview(r.previewKind,s.x1,s.y1,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,i):s.step===2&&(r.previewFn==="fib_ext"?e.set_fib_ext_preview(s.x1,s.y1,s.x2,s.y2,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,i):e.set_channel_preview(s.x1,s.y1,s.x2,s.y2,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,i)):r.type==="2point"?e.set_drawing_preview(r.previewKind,s.x1,s.y1,t,l,a.r,a.g,a.b,a.lineWidth,a.dashed,i):r.type==="1point_x"?e.set_drawing_preview(r.previewKind,t,0,0,0,a.r,a.g,a.b,a.lineWidth,a.dashed,i):r.type==="1point_xp"||r.type==="1point_xy"?e.set_drawing_preview(r.previewKind,t,l,0,0,a.r,a.g,a.b,a.lineWidth,a.dashed,i):e.set_drawing_preview(r.previewKind,0,l,0,0,a.r,a.g,a.b,a.lineWidth,a.dashed,i)}}function b(e,o,s,t){let l=e.screen_to_world_x(o),a;switch(t){case 1:a=e.screen_to_rsi_y(s);break;case 2:a=e.screen_to_oi_y(s);break;case 3:a=e.screen_to_fr_y(s);break;case 4:a=e.screen_to_cvd_y(s);break;default:a=e.screen_to_world_y(s);break}return{wx:l,wy:a}}function H(e){return e===4?1:e===6?2:e===8?3:e===10?4:0}function Y(e){return e===0||e===4||e===6||e===8||e===10}function Wt(e,o,s,t){e.addEventListener("wheel",r=>{if(t.disposed)return;r.preventDefault(),t.cancelMomentum();let n=r.deltaY>0?1.1:.9,_=o.hit_zone(r.offsetX,r.offsetY);r.ctrlKey?o.zoom_y(r.offsetY,n):r.shiftKey||_===2?o.zoom_x(r.offsetX,n):_===3?o.zoom_y(r.offsetY,n):o.zoom(r.offsetX,r.offsetY,n),s.onDirty()},{passive:!1}),e.addEventListener("mousedown",r=>{if(t.disposed||r.button!==0)return;t.cancelMomentum(),a();let n=performance.now();if(n-t.lastClickTime<300){t.lastClickTime=n;return}t.lastClickTime=n;let _=t.drawingMode;if(_){let m=o.hit_zone(r.offsetX,r.offsetY);if(!Y(m))return;let f=H(m),{wx:d,wy:h}=b(o,r.offsetX,r.offsetY,f),p=_.style,c=_.tool;if(W(c)){if(!_.pathStarted)_.pane=f,o.start_elliott_manual(p.r,p.g,p.b,p.lineWidth,f),o.add_elliott_manual_point(d,h),_.pathStarted=!0,_.step=1;else if(o.add_elliott_manual_point(d,h)){t.finishDrawing(),s.onDirty();return}}else if(V(c))_.pathStarted?o.add_path_point(d,h):(_.pane=f,o.start_path(p.r,p.g,p.b,p.lineWidth,p.dashed,f),o.add_path_point(d,h),_.pathStarted=!0,_.step=1);else if(ht(c))_.pane=f,o.start_brush(p.r,p.g,p.b,p.lineWidth,f),o.add_brush_point(d,h),t.isBrushing=!0;else if(st(c))if(_.step===0)_.x1=d,_.y1=h,_.pane=f,_.step=1;else if(_.step===1)_.x2=d,_.y2=h,_.step=2,o.clear_drawing_preview();else{let w=O[c];w&&w.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),Z(o,c,_,d,h,p),t.finishDrawing()}else if(ot(c))_.step===0?(_.x1=d,_.y1=h,_.pane=f,_.step=1):(Z(o,c,_,d,h,p),t.finishDrawing());else{_.pane=f;let w=Z(o,c,_,d,h,p);t.finishDrawing(),c==="textnote"&&w>0&&(o.select_drawing(w),s.onDrawingSelected?.(w),s.onDrawingDblClick?.(w,r.offsetX,r.offsetY,r.clientX,r.clientY))}s.onDirty();return}let u=o.hit_zone(r.offsetX,r.offsetY);if(u===5){t.isResizingRsi=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_rsi_ratio(),e.style.cursor="ns-resize";return}if(u===7){t.isResizingOi=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_oi_ratio(),e.style.cursor="ns-resize";return}if(u===9){t.isResizingFr=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_fr_ratio(),e.style.cursor="ns-resize";return}if(u===11){t.isResizingCvd=!0,t.resizeStartY=r.offsetY,t.resizeStartRatio=o.get_cvd_ratio(),e.style.cursor="ns-resize";return}if(Y(u)){let m=o.get_selected_drawing();if(m>0){let c=o.hit_test_drawing_anchor(r.offsetX,r.offsetY);if(c>=0){t.isDraggingAnchor=!0,t.dragAnchorIdx=c,t.dragAnchorPane=H(u),e.style.cursor="grabbing";return}if(o.hit_test_drawing(r.offsetX,r.offsetY)===m){t.isDraggingDrawing=!0,t.dragDrawingPane=H(u);let{wx:S,wy:M}=b(o,r.offsetX,r.offsetY,t.dragDrawingPane);t.dragDrawingLastWx=S,t.dragDrawingLastWy=M,e.style.cursor="move";return}}let f=o.hit_test_drawing(r.offsetX,r.offsetY);if(f>0){o.deselect_marker(),s.onMarkerSelected?.(0),o.select_drawing(f),s.onDrawingSelected?.(f),s.onDirty();return}let d=o.hit_test_marker(r.offsetX,r.offsetY);if(d>0){o.deselect_drawing(),s.onDrawingSelected?.(0),o.select_marker(d),s.onMarkerSelected?.(d),s.onDirty();return}let h=o.get_selected_drawing(),p=o.get_selected_marker();h>0&&(o.deselect_drawing(),s.onDrawingSelected?.(0),s.onDirty()),p>0&&(o.deselect_marker(),s.onMarkerSelected?.(0),s.onDirty())}Y(u)&&(t.liqPinSx=r.offsetX,t.liqPinSy=r.offsetY,t.liqPinTimer&&clearTimeout(t.liqPinTimer),t.liqPinTimer=setTimeout(()=>{t.liqPinTimer=null,s.onLiqAnnotationPin?.(t.liqPinSx,t.liqPinSy)},700)),t.isDragging=!0,t.dragZone=u,t.lastX=r.offsetX,t.lastY=r.offsetY,u===2?e.style.cursor="ew-resize":u===3?e.style.cursor="ns-resize":e.style.cursor="grabbing"});let l=null;function a(){l&&(cancelAnimationFrame(l),l=null)}function i(r,n){let _=o.hover_hit_test(r,n),u=_[0],m=_[1],f=_[2],d=_[3],h=_[4],p=t.drawingMode;u===2?(e.style.cursor="ew-resize",o.hide_crosshair()):u===3?(e.style.cursor="ns-resize",o.hide_crosshair()):(o.set_crosshair(r,n),u===5||u===7||u===9||u===11?e.style.cursor="ns-resize":!p&&Y(u)&&m>0&&f>=0?e.style.cursor="grab":!p&&Y(u)&&m>0&&d===m?e.style.cursor="move":!p&&Y(u)&&(d>0||h>0)?e.style.cursor="pointer":e.style.cursor="crosshair"),s.onDirty(),s.onCrosshairMove?.(r,n,u),s.onVrvpHover?.(r,n)}e.addEventListener("mousemove",r=>{if(t.disposed)return;if(t.liqPinTimer){let _=Math.abs(r.offsetX-t.liqPinSx),u=Math.abs(r.offsetY-t.liqPinSy);(_>6||u>6)&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null)}if(t.isResizingRsi){let u=e.getBoundingClientRect().height-28,f=(t.resizeStartY-r.offsetY)/u,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+f));o.set_rsi_ratio(d),s.onDirty();return}if(t.isResizingOi){let u=e.getBoundingClientRect().height-28,f=(t.resizeStartY-r.offsetY)/u,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+f));o.set_oi_ratio(d),s.onDirty();return}if(t.isResizingFr){let u=e.getBoundingClientRect().height-28,f=(t.resizeStartY-r.offsetY)/u,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+f));o.set_fr_ratio(d),s.onDirty();return}if(t.isResizingCvd){let u=e.getBoundingClientRect().height-28,f=(t.resizeStartY-r.offsetY)/u,d=Math.max(.05,Math.min(.5,t.resizeStartRatio+f));o.set_cvd_ratio(d),s.onDirty();return}if(t.isDraggingAnchor){let{wx:_,wy:u}=b(o,r.offsetX,r.offsetY,t.dragAnchorPane);o.update_drawing_anchor(t.dragAnchorIdx,_,u),o.set_crosshair(r.offsetX,r.offsetY),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}if(t.isDraggingDrawing){let{wx:_,wy:u}=b(o,r.offsetX,r.offsetY,t.dragDrawingPane),m=_-t.dragDrawingLastWx,f=u-t.dragDrawingLastWy;o.move_drawing(m,f),t.dragDrawingLastWx=_,t.dragDrawingLastWy=u,o.set_crosshair(r.offsetX,r.offsetY),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,o.hit_zone(r.offsetX,r.offsetY));return}let n=t.drawingMode;if(t.isBrushing&&n){let _=n.pane||0,{wx:u,wy:m}=b(o,r.offsetX,r.offsetY,_);o.add_brush_point(u,m),o.set_crosshair(r.offsetX,r.offsetY),s.onDirty();return}if(n&&W(n.tool)&&n.pathStarted){let _=n.pane||0,{wx:u,wy:m}=b(o,r.offsetX,r.offsetY,_);o.set_elliott_manual_cursor(u,m),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(n&&V(n.tool)&&n.pathStarted){let _=n.pane||0,{wx:u,wy:m}=b(o,r.offsetX,r.offsetY,_);o.set_path_cursor(u,m),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(n&&n.step>0){let _=n.pane||0,{wx:u,wy:m}=b(o,r.offsetX,r.offsetY,_);z(o,n.tool,n,u,m,n.style,_),o.set_crosshair(r.offsetX,r.offsetY);let f=o.hit_zone(r.offsetX,r.offsetY);s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,f);return}if(n&&Q(n.tool)){let _=o.hit_zone(r.offsetX,r.offsetY),u=H(_),{wx:m,wy:f}=b(o,r.offsetX,r.offsetY,u);z(o,n.tool,n,m,f,n.style,u),o.set_crosshair(r.offsetX,r.offsetY),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,_);return}if(t.isDragging){let _=r.offsetX-t.lastX,u=r.offsetY-t.lastY;t.lastX=r.offsetX,t.lastY=r.offsetY,t.dragZone===2?o.pan_x(_):t.dragZone===3?o.pan_y(u):o.pan(_,u),s.onDirty(),s.onCrosshairMove?.(r.offsetX,r.offsetY,t.dragZone),s.onVrvpHover?.(r.offsetX,r.offsetY);return}t._pendingHoverX=r.offsetX,t._pendingHoverY=r.offsetY,l||(l=requestAnimationFrame(()=>{l=null,t.disposed||i(t._pendingHoverX,t._pendingHoverY)}))}),e.addEventListener("mouseup",()=>{t.disposed||(t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null),t.isBrushing&&(t.isBrushing=!1,o.finish_brush(),t.finishDrawing(),s.onDirty()),t.isDragging=!1,t.isResizingRsi=!1,t.isResizingOi=!1,t.isResizingFr=!1,t.isResizingCvd=!1,t.isDraggingAnchor=!1,t.isDraggingDrawing=!1,t.dragAnchorIdx=-1,e.style.cursor="crosshair")}),e.addEventListener("mouseleave",()=>{t.disposed||(a(),t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null),t.isBrushing&&(t.isBrushing=!1,o.finish_brush(),t.finishDrawing()),t.isDragging=!1,t.isResizingRsi=!1,t.isResizingOi=!1,t.isResizingFr=!1,t.isResizingCvd=!1,t.isDraggingAnchor=!1,t.isDraggingDrawing=!1,t.dragAnchorIdx=-1,o.hide_crosshair(),e.style.cursor="crosshair",s.onDirty(),s.onCrosshairHide?.(),s.onVrvpHover?.(null,null))}),e.addEventListener("dblclick",r=>{if(t.disposed)return;r.preventDefault(),r.stopPropagation();let n=t.drawingMode;if(n&&W(n.tool)&&n.pathStarted){o.finish_elliott_manual(),t.finishDrawing(),s.onDirty();return}if(n&&V(n.tool)&&n.pathStarted){o.finish_path(),t.finishDrawing(),s.onDirty();return}if(n)return;let _=o.hit_test_drawing(r.offsetX,r.offsetY);_>0&&(o.select_drawing(_),s.onDirty(),s.onDrawingDblClick?.(_,r.offsetX,r.offsetY,r.clientX,r.clientY))}),e.addEventListener("contextmenu",r=>{if(t.disposed)return;let n=t.drawingMode;if(n&&W(n.tool)&&n.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_elliott_manual(),t.finishDrawing(),s.onDirty();return}if(n&&V(n.tool)&&n.pathStarted){r.preventDefault(),r.stopPropagation(),o.finish_path(),t.finishDrawing(),s.onDirty();return}})}function Zt(e,o,s,t){e.addEventListener("touchstart",l=>{if(!t.disposed){if(l.preventDefault(),t.cancelMomentum(),l.touches.length===2){clearTimeout(t.longPressTimer),t.isCrosshairMode=!1;let a=e.getBoundingClientRect(),i=l.touches[1].clientX-l.touches[0].clientX,r=l.touches[1].clientY-l.touches[0].clientY;t.lastTouchDist=Math.sqrt(i*i+r*r),t.lastX=(l.touches[0].clientX+l.touches[1].clientX)/2-a.left,t.lastY=(l.touches[0].clientY+l.touches[1].clientY)/2-a.top,t.dragZone=o.hit_zone(t.lastX,t.lastY)}else if(l.touches.length===1){let a=e.getBoundingClientRect(),i=l.touches[0].clientX-a.left,r=l.touches[0].clientY-a.top;t.touchStartX=i,t.touchStartY=r,t.touchMoved=!1;let n=t.drawingMode;if(n){let d=o.hit_zone(i,r);if(Y(d)){let h=H(d),{wx:p,wy:c}=b(o,i,r,h),w=n.tool;if(W(w)){if(!n.pathStarted)n.pane=h,o.start_elliott_manual(n.style.r,n.style.g,n.style.b,n.style.lineWidth,h),o.add_elliott_manual_point(p,c),n.pathStarted=!0,n.step=1;else if(o.add_elliott_manual_point(p,c)){t.finishDrawing(),s.onDirty();return}}else V(w)?n.pathStarted?o.add_path_point(p,c):(n.pane=h,o.start_path(n.style.r,n.style.g,n.style.b,n.style.lineWidth,n.style.dashed,h),o.add_path_point(p,c),n.pathStarted=!0,n.step=1):ht(w)?(n.pane=h,o.start_brush(n.style.r,n.style.g,n.style.b,n.style.lineWidth,h),o.add_brush_point(p,c),t.isBrushing=!0):st(w)?n.step===0?(n.x1=p,n.y1=c,n.pane=h,n.step=1,n._stepAtTouchStart=0,z(o,w,n,p,c,n.style,h)):n.step===1?(n._stepAtTouchStart=1,z(o,w,n,p,c,n.style,n.pane)):(n._stepAtTouchStart=2,z(o,w,n,p,c,n.style,n.pane)):ot(w)?n.step===0?(n.x1=p,n.y1=c,n.pane=h,n.step=1,n._stepAtTouchStart=0,z(o,w,n,p,c,n.style,h)):(n._stepAtTouchStart=1,z(o,w,n,p,c,n.style,n.pane)):Q(w)?(n.pane=h,z(o,w,n,p,c,n.style,h)):(n.pane=h,Z(o,w,n,p,c,n.style),t.finishDrawing());o.set_crosshair(i,r),s.onDirty(),s.onCrosshairMove?.(i,r,d)}return}let _=o.hover_hit_test(i,r),u=_[0],m=_[1],f=_[2];if(Y(u)&&!t.drawingMode&&m>0){if(f>=0){t.isDraggingAnchor=!0,t.dragAnchorIdx=f,t.dragAnchorPane=H(u);return}if(_[3]===m){t.isDraggingDrawing=!0,t.dragDrawingPane=H(u);let{wx:h,wy:p}=b(o,i,r,t.dragDrawingPane);t.dragDrawingLastWx=h,t.dragDrawingLastWy=p;return}}t.isDragging=!0,t.isCrosshairMode=!1,t.lastX=i,t.lastY=r,t.dragZone=u,clearTimeout(t.longPressTimer),t.longPressTimer=setTimeout(()=>{t.isDragging&&!t.touchMoved&&(t.isCrosshairMode=!0,o.set_crosshair(i,r),s.onDirty(),s.onCrosshairMove?.(i,r,t.dragZone),s.onVrvpHover?.(i,r))},300),Y(t.dragZone)&&(t.liqPinSx=i,t.liqPinSy=r,t.liqPinTimer&&clearTimeout(t.liqPinTimer),t.liqPinTimer=setTimeout(()=>{t.liqPinTimer=null,t.touchMoved||s.onLiqAnnotationPin?.(t.liqPinSx,t.liqPinSy)},700))}}},{passive:!1}),e.addEventListener("touchmove",l=>{if(t.disposed)return;l.preventDefault();let a=e.getBoundingClientRect();if(t.isDraggingAnchor&&l.touches.length===1){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top,{wx:_,wy:u}=b(o,r,n,t.dragAnchorPane);o.update_drawing_anchor(t.dragAnchorIdx,_,u),o.set_crosshair(r,n),s.onDirty();return}if(t.isDraggingDrawing&&l.touches.length===1){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top;t.touchMoved=!0;let{wx:_,wy:u}=b(o,r,n,t.dragDrawingPane),m=_-t.dragDrawingLastWx,f=u-t.dragDrawingLastWy;o.move_drawing(m,f),t.dragDrawingLastWx=_,t.dragDrawingLastWy=u,o.set_crosshair(r,n),s.onDirty();return}let i=t.drawingMode;if(t.isBrushing&&i&&l.touches.length===1){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top,_=i.pane||0,{wx:u,wy:m}=b(o,r,n,_);o.add_brush_point(u,m),o.set_crosshair(r,n),s.onDirty(),t.touchMoved=!0;return}if(i&&W(i.tool)&&i.pathStarted&&l.touches.length===1){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top,_=i.pane||0,{wx:u,wy:m}=b(o,r,n,_);o.set_elliott_manual_cursor(u,m),o.set_crosshair(r,n),s.onDirty(),t.touchMoved=!0;return}if(i&&V(i.tool)&&i.pathStarted&&l.touches.length===1){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top,_=i.pane||0,{wx:u,wy:m}=b(o,r,n,_);o.set_path_cursor(u,m),o.set_crosshair(r,n),s.onDirty(),t.touchMoved=!0;return}if(i&&i.step>0&&l.touches.length===1){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top;!t.touchMoved&&(Math.abs(r-t.touchStartX)>10||Math.abs(n-t.touchStartY)>10)&&(t.touchMoved=!0);let _=i.pane||0,{wx:u,wy:m}=b(o,r,n,_);z(o,i.tool,i,u,m,i.style,_),o.set_crosshair(r,n);let f=o.hit_zone(r,n);s.onDirty(),s.onCrosshairMove?.(r,n,f);return}if(i&&Q(i.tool)&&l.touches.length===1){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top,_=o.hit_zone(r,n),u=H(_),{wx:m,wy:f}=b(o,r,n,u);z(o,i.tool,i,m,f,i.style,u),o.set_crosshair(r,n),s.onDirty(),s.onCrosshairMove?.(r,n,_);return}if(l.touches.length===2){t.velSamples=[];let r=l.touches[1].clientX-l.touches[0].clientX,n=l.touches[1].clientY-l.touches[0].clientY,_=Math.sqrt(r*r+n*n),u=t.lastTouchDist/_,m=(l.touches[0].clientX+l.touches[1].clientX)/2-a.left,f=(l.touches[0].clientY+l.touches[1].clientY)/2-a.top;t.dragZone===3?o.zoom_y(f,u):t.dragZone===2?o.zoom_x(m,u):(o.zoom(m,f,u),o.pan(m-t.lastX,f-t.lastY)),t.lastTouchDist=_,t.lastX=m,t.lastY=f,s.onDirty()}else if(l.touches.length===1&&t.isDragging){let r=l.touches[0].clientX-a.left,n=l.touches[0].clientY-a.top,_=r-t.lastX,u=n-t.lastY;!t.touchMoved&&(Math.abs(r-t.touchStartX)>10||Math.abs(n-t.touchStartY)>10)&&(t.touchMoved=!0,t.isCrosshairMode||clearTimeout(t.longPressTimer),t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null)),t.isCrosshairMode?(o.set_crosshair(r,n),s.onDirty(),s.onCrosshairMove?.(r,n,t.dragZone),s.onVrvpHover?.(r,n)):(t.lastX=r,t.lastY=n,t.recordVelocity(_,u),t.dragZone===2?o.pan_x(_):t.dragZone===3?o.pan_y(u):o.pan(_,u),s.onDirty())}},{passive:!1}),e.addEventListener("touchend",l=>{if(t.disposed)return;if(clearTimeout(t.longPressTimer),t.liqPinTimer&&(clearTimeout(t.liqPinTimer),t.liqPinTimer=null),t.isDraggingAnchor){t.isDraggingAnchor=!1,t.dragAnchorIdx=-1,o.hide_crosshair(),s.onDirty(),s.onCrosshairHide?.();return}if(t.isDraggingDrawing){if(t.isDraggingDrawing=!1,o.hide_crosshair(),s.onDirty(),s.onCrosshairHide?.(),!t.touchMoved){let i=o.get_selected_drawing();if(i>0){let r=e.getBoundingClientRect();s.onDrawingDblClick?.(i,t.touchStartX,t.touchStartY,t.touchStartX+r.left,t.touchStartY+r.top)}}return}if(t.isBrushing){t.isBrushing=!1,o.finish_brush(),t.finishDrawing(),s.onDirty(),s.onCrosshairHide?.();return}let a=t.drawingMode;if(a&&W(a.tool)&&a.pathStarted){let i=Date.now(),r=t.touchStartX-(t._pathLastTapX||0),n=t.touchStartY-(t._pathLastTapY||0),_=Math.sqrt(r*r+n*n);i-(t._pathLastTapTime||0)<350&&_<30?(o.finish_elliott_manual(),t.finishDrawing(),t._pathLastTapTime=0):(t._pathLastTapTime=i,t._pathLastTapX=t.touchStartX,t._pathLastTapY=t.touchStartY),t.isDragging=!1,t.lastTouchDist=0,s.onDirty();return}if(a&&V(a.tool)&&a.pathStarted){let i=Date.now(),r=t.touchStartX-(t._pathLastTapX||0),n=t.touchStartY-(t._pathLastTapY||0),_=Math.sqrt(r*r+n*n);i-(t._pathLastTapTime||0)<350&&_<30?(o.finish_path(),t.finishDrawing(),t._pathLastTapTime=0):(t._pathLastTapTime=i,t._pathLastTapX=t.touchStartX,t._pathLastTapY=t.touchStartY),t.isDragging=!1,t.lastTouchDist=0,s.onDirty();return}if(a&&st(a.tool)){let i=a._stepAtTouchStart;if(a.step===1&&(i===1||t.touchMoved)){let r=e.getBoundingClientRect(),n=l.changedTouches?.[0];if(n){let _=n.clientX-r.left,u=n.clientY-r.top,m=a.pane||0,{wx:f,wy:d}=b(o,_,u,m);a.x2=f,a.y2=d,a.step=2,o.clear_drawing_preview()}}else if(a.step===2&&(i===2||t.touchMoved)){let r=e.getBoundingClientRect(),n=l.changedTouches?.[0];if(n){let _=n.clientX-r.left,u=n.clientY-r.top,m=a.pane||0,{wx:f,wy:d}=b(o,_,u,m),h=O[a.tool];h&&h.previewFn==="fib_ext"?o.clear_fib_ext_preview():o.clear_channel_preview(),Z(o,a.tool,a,f,d,a.style),t.finishDrawing()}}t.isDragging=!1,t.lastTouchDist=0,t.drawingMode||(o.hide_crosshair(),s.onCrosshairHide?.()),s.onDirty();return}if(a&&a.step===1&&ot(a.tool)){if(a._stepAtTouchStart===1||t.touchMoved){let r=e.getBoundingClientRect(),n=l.changedTouches?.[0];if(n){let _=n.clientX-r.left,u=n.clientY-r.top,m=a.pane||0,{wx:f,wy:d}=b(o,_,u,m);Z(o,a.tool,a,f,d,a.style),t.finishDrawing()}}t.isDragging=!1,t.lastTouchDist=0,t.drawingMode||(o.hide_crosshair(),s.onCrosshairHide?.()),s.onDirty();return}if(a&&Q(a.tool)){let i=e.getBoundingClientRect(),r=l.changedTouches?.[0];if(r){let n=r.clientX-i.left,_=r.clientY-i.top,u=o.hit_zone(n,_),m=Y(u)?H(u):a.pane||0,{wx:f,wy:d}=b(o,n,_,m),h=a.tool;o.clear_drawing_preview();let p=Z(o,h,a,f,d,a.style);t.finishDrawing(),h==="textnote"&&p>0&&(o.select_drawing(p),s.onDrawingSelected?.(p),s.onDrawingDblClick?.(p,n,_,n+i.left,_+i.top))}t.isDragging=!1,t.lastTouchDist=0,o.hide_crosshair(),s.onCrosshairHide?.(),s.onDirty();return}if(!t.touchMoved&&!t.drawingMode&&t.isDragging){let i=Date.now(),r=t.touchStartX-t.lastTapX,n=t.touchStartY-t.lastTapY,_=Math.sqrt(r*r+n*n),u=i-t.lastTapTime<350&&_<30,m=o.hover_hit_test(t.touchStartX,t.touchStartY),f=m[0],d=m[1],h=m[3],p=m[4];if(Y(f))if(h>0){o.deselect_marker(),s.onMarkerSelected?.(0),o.select_drawing(h);let c=e.getBoundingClientRect(),w=t.touchStartX+c.left,S=t.touchStartY+c.top;s.onDrawingSelected?.(h,w,S),(d<=0||d===h)&&s.onDrawingDblClick?.(h,t.touchStartX,t.touchStartY,w,S),s.onDirty()}else p>0?(o.deselect_drawing(),s.onDrawingSelected?.(0),o.select_marker(p),s.onMarkerSelected?.(p),s.onDirty()):(d>0&&(o.deselect_drawing(),s.onDrawingSelected?.(0),s.onDirty()),o.get_selected_marker()>0&&(o.deselect_marker(),s.onMarkerSelected?.(0),s.onDirty()));t.lastTapTime=i,t.lastTapX=t.touchStartX,t.lastTapY=t.touchStartY}t.touchMoved&&!t.isCrosshairMode&&!t.drawingMode&&t.startMomentum(t.dragZone),t.isDragging=!1,t.isCrosshairMode=!1,t.lastTouchDist=0,(!t.drawingMode||t.drawingMode.step===0)&&(o.hide_crosshair(),s.onCrosshairHide?.()),s.onDirty(),s.onVrvpHover?.(null,null)})}function Mt(e,o,s){let t={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},l=.92,a=.5,i=80;t.recordVelocity=function(u,m){let f=performance.now();for(t.velSamples.push({dx:u,dy:m,t:f});t.velSamples.length>0&&f-t.velSamples[0].t>i;)t.velSamples.shift()};function r(){if(t.velSamples.length<2)return{vx:0,vy:0};let u=t.velSamples[0],f=t.velSamples[t.velSamples.length-1].t-u.t;if(f<5)return{vx:0,vy:0};let d=0,h=0;for(let c of t.velSamples)d+=c.dx,h+=c.dy;let p=16.67;return{vx:d/f*p,vy:h/f*p}}t.cancelMomentum=function(){t.momentumRaf&&(cancelAnimationFrame(t.momentumRaf),t.momentumRaf=null),t.velSamples=[]},t.startMomentum=function(u){let{vx:m,vy:f}=r();if(t.velSamples=[],Math.abs(m)<a&&Math.abs(f)<a)return;t.momentumVx=m,t.momentumVy=f,t.momentumZone=u;function d(){if(t.momentumVx*=l,t.momentumVy*=l,Math.abs(t.momentumVx)<a&&Math.abs(t.momentumVy)<a){t.momentumRaf=null;return}t.momentumZone===2?o.pan_x(t.momentumVx):t.momentumZone===3?o.pan_y(t.momentumVy):o.pan(t.momentumVx,t.momentumVy),s.onDirty(),t.momentumRaf=requestAnimationFrame(d)}t.momentumRaf=requestAnimationFrame(d)};let n={setMode(u,m){u?(t.drawingMode={tool:u,style:m,step:0,x1:0,y1:0},e.style.cursor="crosshair"):(t.drawingMode?.pathStarted&&o.finish_path(),t.drawingMode=null,o.clear_drawing_preview(),e.style.cursor="crosshair"),s.onDirty()},getMode(){return t.drawingMode}};s.drawingApi?.(n),t.finishDrawing=function(){o.clear_drawing_preview(),s.onDrawingComplete?.(),t.drawingMode=null,e.style.cursor="crosshair"},Wt(e,o,s,t),Zt(e,o,s,t);let _=u=>{let m=document.activeElement?.tagName,f=m==="INPUT"||m==="TEXTAREA"||document.activeElement?.isContentEditable;if((u.key==="Delete"||u.key==="Backspace")&&!t.drawingMode&&!f){let h=o.get_selected_drawing();if(h>0){o.remove_drawing(h),s.onDrawingSelected?.(0),s.onDirty();return}let p=o.get_selected_marker();if(p>0){o.remove_marker(p),s.onMarkerSelected?.(0),s.onDirty();return}}if(u.key==="Escape"&&!t.drawingMode){if(o.get_selected_drawing()>0){o.deselect_drawing(),s.onDrawingSelected?.(0),s.onDirty();return}if(o.get_selected_marker()>0){o.deselect_marker(),s.onMarkerSelected?.(0),s.onDirty();return}}if(u.key==="Escape"&&t.drawingMode){if(t.drawingMode.pathStarted){t.drawingMode.tool==="elliott"?o.finish_elliott_manual():o.finish_path(),t.finishDrawing(),s.onDirty();return}o.clear_drawing_preview(),t.drawingMode=null,e.style.cursor="crosshair",s.onDrawingCancel?.(),s.onDirty();return}let d=20;switch(u.key){case"+":case"=":o.zoom(e.width/2,e.height/2,.9);break;case"-":o.zoom(e.width/2,e.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}s.onDirty()};return window.addEventListener("keydown",_),()=>{t.disposed=!0,t.cancelMomentum(),window.removeEventListener("keydown",_)}}function $t(e,o,s){return{enableRsi(){e.enable_rsi(),o()},disableRsi(){e.disable_rsi(),o()},setRsiPeriod(t){e.set_rsi_period(t),o()},isRsiEnabled(){return e.is_rsi_enabled()},setRsiShowEma(t){e.set_rsi_show_ema(t),o()},setRsiShowWma(t){e.set_rsi_show_wma(t),o()},setRsiShowSignals(t){e.set_rsi_show_signals(t),o()},setRsiShowDivergence(t){e.set_rsi_show_divergence(t),o()},setRsiShowTraps(t){e.set_rsi_show_traps(t),o()},setRsiSmoothing(t){e.set_rsi_smoothing(t),o()},setRsiRatio(t){e.set_rsi_ratio(t),o()},getRsiRatio(){return e.get_rsi_ratio()},enableForexSignals(){e.enable_forex_signals(),o()},disableForexSignals(){e.disable_forex_signals(),o()},isForexSignalsEnabled(){return e.is_forex_signals_enabled()},setForexSignalsSetup(t){e.set_forex_signals_setup(t),o()},setForexSignalsMode(t){e.set_forex_signals_mode(t),o()},setForexSignalsShowStats(t){e.set_forex_signals_show_stats(t),o()},getForexSignalsCount(){return e.get_forex_signals_count()},enableOi(){s()||(e.enable_oi(),o())},disableOi(){s()||(e.disable_oi(),o())},isOiEnabled(){if(s())return!1;try{return e.is_oi_enabled()}catch{return!1}},setOiData(t){s()||(e.set_oi_data(t),o())},setOiDataTs(t,l){s()||(e.set_oi_data_ts(t,l),o())},setOiShowOnChart(t){s()||(e.set_oi_show_on_chart(t),o())},setOiDisplayMode(t){s()||(e.set_oi_display_mode(t),o())},setOiRatio(t){s()||(e.set_oi_ratio(t),o())},getOiRatio(){if(s())return .2;try{return e.get_oi_ratio()}catch{return .2}},enableFundingRate(){s()||(e.enable_funding_rate(),o())},disableFundingRate(){s()||(e.disable_funding_rate(),o())},isFundingRateEnabled(){if(s())return!1;try{return e.is_funding_rate_enabled()}catch{return!1}},setFrBinanceData(t,l){s()||(e.set_fr_binance_data(t,l),o())},setFrAggData(t,l){s()||(e.set_fr_agg_data(t,l),o())},setFrShowAgg(t){s()||(e.set_fr_show_agg(t),o())},setFrShowSma(t){s()||(e.set_fr_show_sma(t),o())},enableCvd(){s()||(e.enable_cvd(),o())},disableCvd(){s()||(e.disable_cvd(),o())},isCvdEnabled(){if(s())return!1;try{return e.is_cvd_enabled()}catch{return!1}},setCvdData(t,l){s()||(e.set_cvd_data(t,l),o())},setCvdMode(t){s()||(e.set_cvd_mode(t),o())},getCvdMode(){if(s())return 0;try{return e.get_cvd_mode()}catch{return 0}},setCvdShowDelta(t){s()||(e.set_cvd_show_delta(t),o())},getCvdShowDelta(){if(s())return!0;try{return e.get_cvd_show_delta()}catch{return!0}},enableLargeTrades(){s()||(e.enable_large_trades(),o())},disableLargeTrades(){s()||(e.disable_large_trades(),o())},isLargeTradesEnabled(){if(s())return!1;try{return e.is_large_trades_enabled()}catch{return!1}},setLargeTradesData(t){s()||(e.set_large_trades_data(t),o())},pushLargeTrade(t,l,a,i){s()||(e.push_large_trade(t,l,a,i),o())},clearLargeTrades(){s()||(e.clear_large_trades(),o())},setLtVolumeFilter(t,l){s()||(e.set_lt_volume_filter(t,l),o())},setLtBubbleScale(t){s()||(e.set_lt_bubble_scale(t),o())},getLtDataMinVol(){return s()?0:e.get_lt_data_min_vol()},getLtDataMaxVol(){return s()?0:e.get_lt_data_max_vol()},ltHitTest(t,l){if(s())return"";try{return e.lt_hit_test(t,l)}catch{return""}},enableVrvp(){s()||(e.enable_vrvp(),o())},disableVrvp(){s()||(e.disable_vrvp(),o())},isVrvpEnabled(){if(s())return!1;try{return e.is_vrvp_enabled()}catch{return!1}},setVrvpPocLine(t){s()||(e.set_vrvp_poc_line(t),o())},vrvpHitTest(t,l){if(s())return"";try{return e.vrvp_hit_test(t,l)}catch{return""}},enableTpo(){s()||(e.enable_tpo(),o())},disableTpo(){s()||(e.disable_tpo(),o())},isTpoEnabled(){if(s())return!1;try{return e.is_tpo_enabled()}catch{return!1}},setTpoPocLine(t){s()||(e.set_tpo_poc_line(t),o())},setTpoVaLines(t){s()||(e.set_tpo_va_lines(t),o())},setTpoIb(t){s()||(e.set_tpo_ib(t),o())},setTpoSinglePrints(t){s()||(e.set_tpo_single_prints(t),o())},setTpoPeriod(t){s()||(e.set_tpo_period(t),o())},getTpoPeriod(){if(s())return 1440;try{return e.get_tpo_period()}catch{return 1440}},setTpoNakedPoc(t){s()||(e.set_tpo_naked_poc(t),o())},setTpoProfileShape(t){s()||(e.set_tpo_profile_shape(t),o())},setTpoIbMinutes(t){s()||(e.set_tpo_ib_minutes(t),o())},setTpoLetterMinutes(t){s()||(e.set_tpo_letter_minutes(t),o())},setTpoSignals(t){s()||(e.set_tpo_signals(t),o())},isTpoSignals(){if(s())return!1;try{return e.is_tpo_signals()}catch{return!1}},enableLiqHeatmap(){s()||(e.enable_liq_heatmap(),o())},disableLiqHeatmap(){s()||(e.disable_liq_heatmap(),o())},isLiqHeatmapEnabled(){if(s())return!1;try{return e.is_liq_heatmap_enabled()}catch{return!1}},setLiqHeatmapRange(t,l){s()||(e.set_liq_heatmap_range(t,l),o())},getLiqHeatmapMin(){if(s())return 0;try{return e.get_liq_heatmap_min()}catch{return 0}},getLiqHeatmapMax(){if(s())return 1;try{return e.get_liq_heatmap_max()}catch{return 1}},getLiqHeatmapSegMax(){if(s())return 0;try{return e.get_liq_heatmap_seg_max()}catch{return 0}},setLiqHeatmapProfile(t){s()||(e.set_liq_heatmap_profile(t),o())},isLiqHeatmapProfile(){if(s())return!0;try{return e.is_liq_heatmap_profile()}catch{return!0}},setLiqHeatmapCellHeight(t){s()||(e.set_liq_heatmap_cell_height(t),o())},getLiqHeatmapCellHeight(){if(s())return 1;try{return e.get_liq_heatmap_cell_height()}catch{return 1}},setLiqHeatmapPredictions(t){s()||(e.set_liq_heatmap_predictions(t),o())},setLiqHeatmapFilledPct(t){s()||(e.set_liq_heatmap_filled_pct(t),o())},getLiqHeatmapFilledPct(){if(s())return .85;try{return e.get_liq_heatmap_filled_pct()}catch{return .85}},liqHeatmapHitTest(t,l){if(s())return"";try{return e.liq_heatmap_hit_test(t,l)}catch{return""}},liqZoneHitTest(t,l){if(s())return"";try{return e.liq_zone_hit_test(t,l)}catch{return""}},enableSmartRanges(){s()||(e.enable_smart_ranges(),o())},disableSmartRanges(){s()||(e.disable_smart_ranges(),o())},isSmartRangesEnabled(){if(s())return!1;try{return e.is_smart_ranges_enabled()}catch{return!1}},setSrTextSize(t){s()||(e.set_sr_text_size(t),o())},setSrShowOb(t){s()||(e.set_sr_show_ob(t),o())},setSrObLast(t){s()||(e.set_sr_ob_last(t),o())},setSrShowObActivity(t){s()||(e.set_sr_show_ob_activity(t),o())},setSrShowBreakers(t){s()||(e.set_sr_show_breakers(t),o())},setSrMitigation(t){s()||(e.set_sr_mitigation(t),o())},setSrShowMetrics(t){s()||(e.set_sr_show_metrics(t),o())},setSrShowHtfOb(t){s()||(e.set_sr_show_htf_ob(t),o())},setSrHtfMinutes(t){s()||(e.set_sr_htf_minutes(t),o())},setSrShowFvg(t){s()||(e.set_sr_show_fvg(t),o())},setSrFvgTheme(t){s()||(e.set_sr_fvg_theme(t),o())},setSrFvgMitigation(t){s()||(e.set_sr_fvg_mitigation(t),o())},setSrFvgHtf(t){s()||(e.set_sr_fvg_htf(t),o())},setSrFvgExtend(t){s()||(e.set_sr_fvg_extend(t),o())},setSrShowObSignals(t){s()||(e.set_sr_show_ob_signals(t),o())},setSrShowPredict(t){s()||(e.set_sr_show_predict(t),o())},setSrShowFvgSignals(t){s()||(e.set_sr_show_fvg_signals(t),o())},setSrShowSmartRev(t){s()||(e.set_sr_show_smart_rev(t),o())},setSrSmartRevHtf(t){s()||(e.set_sr_smart_rev_htf(t),o())},setSrStatsType(t){s()||(e.set_sr_stats_type(t),o())},setSrStatsPosition(t){s()||(e.set_sr_stats_position(t),o())},getSrSignalsCount(){if(s())return 0;try{return e.get_sr_signals_count()}catch{return 0}},enableEmaStructure(){s()||(e.enable_ema_structure(),o())},disableEmaStructure(){s()||(e.disable_ema_structure(),o())},isEmaStructureEnabled(){if(s())return!1;try{return e.is_ema_structure_enabled()}catch{return!1}},setEsEma1Len(t){s()||(e.set_es_ema1_len(t),o())},setEsEma2Len(t){s()||(e.set_es_ema2_len(t),o())},setEsWmaLen(t){s()||(e.set_es_wma_len(t),o())},setEsShowEma1(t){s()||(e.set_es_show_ema1(t),o())},setEsShowEma2(t){s()||(e.set_es_show_ema2(t),o())},setEsShowWma(t){s()||(e.set_es_show_wma(t),o())},setEsSwingLen(t){s()||(e.set_es_swing_len(t),o())},setEsShowBos(t){s()||(e.set_es_show_bos(t),o())},enableLiveSignals(){s()||(e.enable_live_signals(),o())},disableLiveSignals(){s()||(e.disable_live_signals(),o())},isLiveSignalsEnabled(){if(s())return!1;try{return e.is_live_signals_enabled()}catch{return!1}},setLiveSignalsData(t){s()||(e.set_live_signals_data(new Float64Array(t)),o())},clearLiveSignals(){s()||(e.clear_live_signals(),o())},setLiveSignalsLeverage(t){s()||(e.set_live_signals_leverage(t),o())},getLiveSignalsLeverage(){if(s())return 10;try{return e.get_live_signals_leverage()}catch{return 10}},setLiveSignalsTrial(t){s()||(e.set_live_signals_trial(t),o())},setLiveSignalsShowEntry(t){s()||(e.set_live_signals_show_entry(t),o())},setLiveSignalsShowTpSl(t){s()||(e.set_live_signals_show_tp_sl(t),o())},setLiveSignalsShowMaxProfit(t){s()||(e.set_live_signals_show_max_profit(t),o())},setLiveSignalsShowLabels(t){s()||(e.set_live_signals_show_labels(t),o())},setLiveSignalsShowZones(t){s()||(e.set_live_signals_show_zones(t),o())},setLiveSignalsTextSize(t){s()||(e.set_live_signals_text_size(t),o())},setLiveSignalsPipValue(t){s()||(e.set_live_signals_pip_value(t),o())},setLiveSignalsLoading(t){s()||(e.set_live_signals_loading(t),o())},getLiveSignalsCount(){if(s())return 0;try{return e.get_live_signals_count()}catch{return 0}},enableVolume(){e.enable_volume(),o()},disableVolume(){e.disable_volume(),o()},isVolumeEnabled(){return e.is_volume_enabled()},setVolumeMaPeriod(t){e.set_volume_ma_period(t),o()},setVolumeShowMa(t){e.set_volume_show_ma(t),o()},setVolumeShowSignals(t){e.set_volume_show_signals(t),o()},setVolumeColorMode(t){e.set_volume_color_mode(t),o()},getVolumeMaPeriod(){return e.get_volume_ma_period()},getVolumeShowMa(){return e.get_volume_show_ma()},getVolumeShowSignals(){return e.get_volume_show_signals()},getVolumeColorMode(){return e.get_volume_color_mode()}}}function Kt(e,o,s){return{addMarker(t,l,a){e.add_marker(t,l,a),o()},clearMarkers(){e.clear_markers(),o()},hitTestMarker(t,l){return e.hit_test_marker(t,l)},selectMarker(t){e.select_marker(t),o()},deselectMarker(){e.deselect_marker(),o()},getSelectedMarker(){return e.get_selected_marker()},removeMarker(t){e.remove_marker(t),o()},deleteSelectedMarker(){let t=e.get_selected_marker();return t>0&&(e.remove_marker(t),o()),t},addTrendline(t,l,a,i,r,n,_,u,m,f=0){let d=e.add_trendline(t,l,a,i,r,n,_,u,m,f);return o(),d},addHorizontalLine(t,l,a,i,r,n,_,u=0){let m=e.add_horizontal_line(t,l,a,i,r,n,_,u);return o(),m},addArrow(t,l,a,i,r,n,_,u,m,f=0){let d=e.add_arrow(t,l,a,i,r,n,_,u,m,f);return o(),d},addFibRetracement(t,l,a,i,r,n,_,u,m,f=0){let d=e.add_fib_retracement(t,l,a,i,r,n,_,u,m,f);return o(),d},addFibExtension(t,l,a,i,r,n,_,u,m,f,d,h=0){let p=e.add_fib_extension(t,l,a,i,r,n,_,u,m,f,d,h);return o(),p},addLongPosition(t,l,a,i,r,n,_,u,m,f=0){let d=e.add_long_position(t,l,a,i,r,n,_,u,m,f);return o(),d},addShortPosition(t,l,a,i,r,n,_,u,m,f=0){let d=e.add_short_position(t,l,a,i,r,n,_,u,m,f);return o(),d},addAnchoredVwap(t,l,a,i,r,n,_=0){let u=e.add_anchored_vwap(t,l,a,i,r,n,_);return o(),u},addPriceLabel(t,l,a,i,r,n,_=0){let u=e.add_price_label(t,l,a,i,r,n,_);return o(),u},addElliottImpulse(t,l,a,i,r,n,_=0){let u=e.add_elliott_impulse(t,l,a,i,r,n,_);return o(),u},setDrawingFontSize(t,l){e.set_drawing_font_size(t,l),o()},getDrawingFontSize(t){return e.get_drawing_font_size(t)},setDrawingText(t,l){e.set_drawing_text(t,l),o()},getDrawingText(t){return e.get_drawing_text(t)},setDrawingStyle(t,l,a,i,r){e.set_drawing_style(t,l,a,i,r),o()},getDrawingColor(t){let l=e.get_drawing_color(t);return l?{r:l>>>24&255,g:l>>>16&255,b:l>>>8&255,lineWidth:(l&255)/10}:null},getDrawingDashed(t){try{return e.get_drawing_dashed(t)}catch{return!1}},setDrawingDashed(t,l){e.set_drawing_dashed(t,l),o()},getDrawingHideLabel(t){try{return e.get_drawing_hide_label(t)}catch{return!1}},setDrawingHideLabel(t,l){e.set_drawing_hide_label(t,l),o()},getDrawingKindId(t){try{return e.get_drawing_kind_id(t)}catch{return 255}},removeDrawing(t){e.remove_drawing(t),o()},clearDrawings(){e.clear_drawings(),o()},drawingCount(){return e.drawing_count()},setDrawingPreview(t,l,a,i,r,n,_,u,m,f,d=0){e.set_drawing_preview(t,l,a,i,r,n,_,u,m,f,d),o()},clearDrawingPreview(){e.clear_drawing_preview(),o()},cancelBrush(){e.cancel_brush(),o()},selectDrawing(t){e.select_drawing(t),o()},deselectDrawing(){e.deselect_drawing(),o()},getSelectedDrawing(){return e.get_selected_drawing()},deleteSelectedDrawing(){let t=e.get_selected_drawing();return t>0&&(e.remove_drawing(t),o()),t},exportDrawingsJson(){try{return e.export_drawings_json()}catch{return"[]"}},importDrawingsJson(t){try{e.import_drawings_json(t),o()}catch(l){console.warn("[bridge] importDrawingsJson failed",l)}},screenToWorld(t,l){return{x:e.screen_to_world_x(t),y:e.screen_to_world_y(l)}},worldToScreen(t,l){try{return{x:e.world_to_screen_x(t),y:e.world_to_screen_y(l)}}catch{return null}}}}function Dt(e,o,s){return{setKlines(t,l,a,i,r,n){e.set_klines(new Float64Array(t),new Float64Array(l),new Float64Array(a),new Float64Array(i),new Float64Array(r),new Float64Array(n)),o()},setRealTimestamps(t){e.set_real_timestamps(new Float64Array(t)),o()},appendRealTimestamp(t){e.append_real_timestamp(t)},prependKlines(t,l,a,i,r,n){e.prepend_klines(new Float64Array(t),new Float64Array(l),new Float64Array(a),new Float64Array(i),new Float64Array(r),new Float64Array(n)),o()},appendKline(t,l,a,i,r,n){e.append_kline(t,l,a,i,r,n),o()},updateLastKline(t,l,a,i,r,n){e.update_last_kline(t,l,a,i,r,n),o()},popLastKline(){let t=e.pop_last_kline();return t&&o(),t},getLastClose(){try{return e.get_last_close()}catch{return 0}},getKlineCount(){if(s())return 0;try{return e.kline_count()}catch{return 0}},getKlineTimestamps(){if(s())return null;try{return e.kline_timestamps()}catch{return null}},getKlineOpens(){if(s())return null;try{return e.kline_opens()}catch{return null}},getKlineHighs(){if(s())return null;try{return e.kline_highs()}catch{return null}},getKlineLows(){if(s())return null;try{return e.kline_lows()}catch{return null}},getKlineCloses(){if(s())return null;try{return e.kline_closes()}catch{return null}},getKlineVolumes(){if(s())return null;try{return e.kline_volumes()}catch{return null}},setHeatmap(t,l,a,i,r,n,_){e.set_heatmap(new Float64Array(t),l,a,i,r,n,_),o()},appendHeatmapColumn(t,l,a,i){e.append_heatmap_column(new Float64Array(t),l,a,i),o()},updateLastHeatmapColumn(t,l,a){e.update_last_heatmap_column(new Float64Array(t),l,a),o()},getHeatmapLastTimestamp(){try{return e.get_heatmap_last_timestamp()}catch{return 0}},getHeatmapXStep(){try{return e.get_heatmap_x_step()}catch{return 0}},updateHeatmapColumnAt(t,l,a,i){e.update_heatmap_column_at(new Float64Array(t),l,a,i),o()},setHeatmapRange(t,l){e.set_heatmap_range(t,l),o()},getHeatmapDataRange(){try{return{min:e.get_heatmap_data_min(),max:e.get_heatmap_data_max()}}catch{return{min:0,max:0}}},setHeatmapPrefetchRange(t){try{e.set_heatmap_prefetch_range(t)}catch{}},clearHeatmapPrefetchRange(){try{e.clear_heatmap_prefetch_range()}catch{}},getHeatmapPrefetchMax(){try{return e.get_heatmap_prefetch_max()}catch{return 0}},setChartType(t){s()||(e.set_chart_type(t),o())},getChartType(){if(s())return 0;try{return e.get_chart_type()}catch{return 0}},setFootprintTickSize(t){s()||(e.set_footprint_tick_size(t),o())},footprintEnsureLen(t){s()||e.footprint_ensure_len(t)},footprintAddTrade(t,l,a,i){s()||e.footprint_add_trade(t,l,a,i)},footprintAddTradeBatch(t){s()||!t||t.length===0||e.footprint_add_trade_batch(t instanceof Float64Array?t:new Float64Array(t))},footprintSetBar(t,l,a,i,r){s()||(e.footprint_set_bar(t,l,a,i,r),o())},footprintClear(){s()||(e.footprint_clear(),o())},footprintClearBar(t){s()||e.footprint_clear_bar(t)},footprintPrependEmpty(t){s()||e.footprint_prepend_empty(t)},footprintSetShowSignals(t){s()||(e.footprint_set_show_signals(t),o())},footprintGetShowSignals(){if(s())return!0;try{return e.footprint_get_show_signals()}catch{return!0}},footprintSignalCount(){if(s())return 0;try{return e.footprint_signal_count()}catch{return 0}},footprintSetShowProfile(t){s()||(e.footprint_set_show_profile(t),o())},footprintGetShowProfile(){if(s())return!1;try{return e.footprint_get_show_profile()}catch{return!1}},footprintProfileHitTest(t,l){if(s())return"";try{return e.footprint_profile_hit_test(t,l)}catch{return""}}}}var me=1;function R(e){if(typeof e!="string")return{r:255,g:255,b:255,a:153};if(e.startsWith("#")){let s=e.slice(1);if(s.length===8)return{r:parseInt(s.slice(0,2),16),g:parseInt(s.slice(2,4),16),b:parseInt(s.slice(4,6),16),a:parseInt(s.slice(6,8),16)};let t=parseInt(s.slice(0,2),16),l=parseInt(s.slice(2,4),16),a=parseInt(s.slice(4,6),16);return{r:t,g:l,b:a,a:255}}let o=e.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 bt(e,o,s){let t=new Map,l=null,a=0,i=NaN;function r(){let f;try{f=e.kline_count()}catch{return l}if(f===0)return null;let d=e.kline_closes(),h=d?.[f-1]??NaN;if(l&&!(f!==a||h!==i))return l;try{let c=e.kline_timestamps(),w=e.kline_opens(),S=e.kline_highs(),M=e.kline_lows(),E=e.kline_volumes();if(!c||!d)return l;l={timestamps:Array.from(c),open:Array.from(w),high:Array.from(S),low:Array.from(M),close:Array.from(d),volume:Array.from(E),length:f},a=f,i=h;for(let I of t.values())I._needsCompute=!0}catch{}return l}function n(){return{seriesLine(f,d="#ffffff99",h=1.5){let p=R(d);e.custom_series_line(new Float64Array(f),p.r,p.g,p.b,p.a,h)},seriesDashedLine(f,d="#ffffff66",h=1,p=4,c=4){let w=R(d);e.custom_series_dashed_line(new Float64Array(f),w.r,w.g,w.b,w.a,h,p,c)},band(f,d,h="rgba(100,149,237,0.08)"){let p=R(h);e.custom_band(new Float64Array(f),new Float64Array(d),p.r,p.g,p.b,p.a)},hline(f,d="#ffffff66",h=1){let p=R(d);e.custom_hline(f,p.r,p.g,p.b,p.a,h)},dashedHline(f,d="#ffffff66",h=1,p=6,c=4){let w=R(d);e.custom_dashed_hline(f,w.r,w.g,w.b,w.a,h,p,c)},marker(f,d,h="#e8a04a",p=3){let c=R(h);e.custom_marker(f,d,c.r,c.g,c.b,c.a,p)},markerUp(f,d,h="#26a69a",p=5){let c=R(h);e.custom_marker_up(f,d,c.r,c.g,c.b,c.a,p)},markerDown(f,d,h="#ef5350",p=5){let c=R(h);e.custom_marker_down(f,d,c.r,c.g,c.b,c.a,p)},text(f,d,h,p="#ffffffaa",c=10,w="center"){let S=R(p),M=w==="center"?1:w==="right"?2:0;e.custom_text(f,d,h,S.r,S.g,S.b,S.a,c,M)},priceLabel(f,d,h="#ffffffaa",p=10){let c=R(h);e.custom_price_label(f,d,c.r,c.g,c.b,c.a,p)},linePx(f,d,h,p,c,w=1){let S=R(c);e.custom_line_px(f,d,h,p,S.r,S.g,S.b,S.a,w)},fillRectPx(f,d,h,p,c){let w=R(c);e.custom_fill_rect_px(f,d,h,p,w.r,w.g,w.b,w.a)},strokeRectPx(f,d,h,p,c,w=1){let S=R(c);e.custom_stroke_rect_px(f,d,h,p,S.r,S.g,S.b,S.a,w)},textPx(f,d,h,p,c=10,w="left"){let S=R(p),M=w==="center"?1:w==="right"?2:0;e.custom_text_px(f,d,h,S.r,S.g,S.b,S.a,c,M)},worldToScreenX:f=>e.world_to_screen_x(f),worldToScreenY:f=>e.world_to_screen_y(f),screenToWorldX:f=>e.screen_to_world_x(f),screenToWorldY:f=>e.screen_to_world_y(f),chartArea:()=>({x:e.chart_area_x(),y:e.chart_area_y(),w:e.chart_area_w(),h:e.chart_area_h()})}}function _(f){if(!f.compute)return;let d=r();if(d)try{f._computed=f.compute(d,f.params)||{}}catch(h){console.warn(`[CustomIndicator "${f.name}"] compute error:`,h),f._computed={}}}function u(f){if(t.size===0)return;let d=r();if(!d)return;e.custom_begin();let h=n();for(let c of t.values())if(c.enabled){c._needsCompute&&(_(c),c._needsCompute=!1);try{c.render.call(c,h,c._computed||{},d)}catch(w){console.warn(`[CustomIndicator "${c.name}"] render error:`,w)}}if(e.custom_end(),e.custom_command_count()>0){let c=e.get_custom_buffer_ptr(),w=e.get_custom_buffer_len();s(f,o,c,w)}}function m(){l=null,a=0,i=NaN;for(let f of t.values())f._needsCompute=!0}return{add(f){let d=me++,h={id:d,name:f.name||`Custom ${d}`,params:{...f.params},compute:f.compute||null,render:f.render,enabled:!0,_computed:{},_needsCompute:!0};return t.set(d,h),d},remove(f){t.delete(f)},updateParams(f,d){let h=t.get(f);h&&(Object.assign(h.params,d),h._needsCompute=!0)},setEnabled(f,d){let h=t.get(f);h&&(h.enabled=d)},list(){return[...t.values()].map(f=>({id:f.id,name:f.name,params:{...f.params},enabled:f.enabled}))},invalidateCompute:m,renderAll:u}}var Ut="trial";var Et=[95,95,109,114].map(e=>String.fromCharCode(e)).join(""),ge=1297237059;function jt(e){let o=`${e}:${ge}:${(e^2043453)>>>0}`,s=2166136261;for(let t=0;t<o.length;t++)s^=o.charCodeAt(t),s=Math.imul(s,16777619);return(s>>>0).toString(36)}function at(e){return`${e}.${jt(e)}`}function nt(e){if(!e||typeof e!="string")return null;let o=e.lastIndexOf(".");if(o<1)return null;let s=parseInt(e.slice(0,o),10);return!s||s<1e9||s>2e9||e.slice(o+1)!==jt(s)?null:s}var Jt=Et+"e7x",Qt=Et+"p3q",xt="mrd_engine_session_id",kt="mrd_ce_db",x="meta",te="trial_ts",ee=Et+"ck";function Pt(){try{return nt(localStorage.getItem(Jt))}catch{return null}}function Lt(e){try{localStorage.setItem(Jt,at(e))}catch{}}function Ft(){try{return nt(localStorage.getItem(Qt))}catch{return null}}function Ct(e){try{localStorage.setItem(Qt,at(e))}catch{}}function yt(){try{return nt(sessionStorage.getItem(xt))}catch{return null}}function Rt(e){try{sessionStorage.setItem(xt,at(e))}catch{}}function At(){try{let e=document.cookie.match(new RegExp(`(?:^|;\\s*)${ee}=([^;]+)`));return e?nt(decodeURIComponent(e[1])):null}catch{return null}}function Yt(e){try{let o=encodeURIComponent(at(e));document.cookie=`${ee}=${o};path=/;max-age=${86400*400};SameSite=Lax`}catch{}}var k=null,Gt=!1;function Se(){if(!(Gt||typeof indexedDB>"u")){Gt=!0;try{let e=indexedDB.open(kt,1);e.onupgradeneeded=()=>{let o=e.result;o.objectStoreNames.contains(x)||o.createObjectStore(x)},e.onsuccess=()=>{let t=e.result.transaction(x,"readonly").objectStore(x).get(te);t.onsuccess=()=>{let l=nt(t.result);l&&(!k||l<k)&&(k=l,ve(l))}}}catch{}}}function re(e){k=e;try{let o=indexedDB.open(kt,1);o.onsuccess=()=>{o.result.transaction(x,"readwrite").objectStore(x).put(at(e),te)}}catch{}}function ve(e){let o=Math.floor(Date.now()/1e3),s=oe([Pt(),Ft(),yt(),At(),e],o);s&&s!==e||s&&(Lt(s),Ct(s),Rt(s),Yt(s))}function oe(e,o){let s=null;for(let t of e)t&&(t>o+60||t<17e8||(!s||t<s)&&(s=t));return s}function Te(){let e=Math.floor(Date.now()/1e3),o=[Pt(),Ft(),yt(),At(),k];return oe(o,e)}function Me(e){Lt(e),Ct(e),Rt(e),Yt(e),re(e)}function be(e){Pt()||Lt(e),Ft()||Ct(e),yt()||Rt(e),At()||Yt(e),k||re(e)}Se();function pt(e){if(!e||e==="trial")return Ee();try{let o=JSON.parse(atob(e)),{p:s,d:t,e:l,s:a}=o;if(!s||!a)return{valid:!1,error:"Invalid license key format"};let i={...o};if(delete i.s,a!==se(i))return{valid:!1,error:"Invalid license key signature"};if(l>0&&Date.now()/1e3>l)return{valid:!1,expired:!0,plan:s,error:`License expired on ${new Date(l*1e3).toLocaleDateString()}`};if(t&&t!=="*"&&typeof window<"u"){let r=window.location.hostname;if(!t.split(",").map(u=>u.trim()).some(u=>Pe(u,r)))return{valid:!1,error:`License not valid for domain: ${r}`}}return{valid:!0,plan:s,domain:t,expiry:l,watermark:!1}}catch{return{valid:!1,error:"Invalid license key"}}}function se(e){let o="mrd-ce-hmac-2024-x9k2m",s=JSON.stringify(e),t=o+":"+s,l=2166136261,a=1818371886,i=3735928559;for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);l=Math.imul(l^n,16777619)>>>0,a=Math.imul(a^n,1540483477)>>>0,i=Math.imul(i^n,461845907)>>>0}return(l.toString(36)+a.toString(36)+i.toString(36)).slice(0,24)}function Ee(){let e=Te();e?be(e):(e=Math.floor(Date.now()/1e3),Me(e));let o=e+14*86400,s=Date.now()/1e3,t=Math.max(0,Math.ceil((o-s)/86400));return s>o?{valid:!1,expired:!0,plan:Ut,error:"14-day trial has expired",daysLeft:0}:{valid:!0,plan:Ut,watermark:!0,daysLeft:t,trialEnd:o}}function Pe(e,o){if(e==="*"||e===o)return!0;if(e.startsWith("*.")){let s=e.slice(1);return o.endsWith(s)||o===e.slice(2)}return!1}function Le({plan:e,domain:o="*",expiryDays:s=365,name:t,email:l}){let a=s>0?Math.floor(Date.now()/1e3)+s*86400:0,i={p:e,d:o,e:a,...t?{n:t}:{},...l?{m:l}:{},i:Date.now()};return i.s=se(i),btoa(JSON.stringify(i))}var wt=null,It=null,it=null;async function ae(){return wt||it||(it=(async()=>{let e=await import("./chart_engine.js");return await e.default(),It=e.wasm_memory(),wt=e,e})(),it)}function Fe(){!wt&&!it&&ae().catch(()=>{})}async function Ce(e,o={}){let s=o.licenseKey||o.key||null,t=pt(s);if(!t.valid)if(t.expired)console.warn(`[MRD Chart Engine] ${t.error}. Get a license at https://mrd-chart.dev/pricing`);else throw new Error(`[MRD Chart Engine] ${t.error}`);t.plan==="trial"&&console.info(`[MRD Chart Engine] Trial mode \u2014 ${t.daysLeft} days remaining. Purchase: https://mrd-chart.dev/pricing`);let l=await ae(),a=window.devicePixelRatio||1,i=e.getBoundingClientRect();(i.width<1||i.height<1)&&(await new Promise(g=>{let v=new ResizeObserver(T=>{for(let F of T)if(F.contentRect.width>0&&F.contentRect.height>0){v.disconnect(),g();return}});v.observe(e.parentElement||e),setTimeout(()=>{v.disconnect(),g()},2e3)}),i=e.getBoundingClientRect());let r=Math.max(i.width,100),n=Math.max(i.height,100);e.width=r*a,e.height=n*a;let _=e.getContext("2d");_.scale(a,a);let u=new l.ChartEngine(r,n);{let g=t.expired?2:t.watermark?1:0,v=t.daysLeft||0,T=1297237059;T=Math.imul(T,31)+g>>>0,T=Math.imul(T,31)+v>>>0,T=(T^T>>>16)>>>0,T=Math.imul(T,73244475)>>>0,T=(T^T>>>16)>>>0,u.set_license_state(g,v,T)}let m=!0,f=null,d=!1,h=!1,p=!1,c=null,w=null,S=0,E=("ontouchstart"in window||navigator.maxTouchPoints>0)&&window.innerWidth<=1399?33:0;function I(){if(!(!d||h||f)){if(E>0){let g=performance.now()-S;if(g<E){w||(w=setTimeout(()=>{w=null,I()},E-g));return}}f=requestAnimationFrame(le)}}let P=()=>{m=!0,I()},U=()=>p,G=null,tt=null,et=null,lt=null,mt=null,L=null,N=null,A=null,q=0,j=null,rt=null,K=0,gt=0,J=-1,ut=!1,ft=!1,ne=Mt(e,u,{onDirty:P,onCrosshairMove:(g,v,T)=>{K=g,gt=v,J=T,ut=!0,ft=!0},onCrosshairHide:()=>{ft&&(ft=!1,ut=!0,J=-1)},drawingApi:g=>{G=g},onDrawingComplete:()=>{tt?.()},onDrawingCancel:()=>{et?.()},onDrawingSelected:(g,v,T)=>{lt?.(g,v,T)},onMarkerSelected:g=>{mt?.(g)},onDrawingDblClick:(g,v,T,F,de)=>{L?.(g,v,T,F,de)},onVrvpHover:(g,v)=>{N?.(g,v)},onLiqAnnotationPin:(g,v)=>{rt?.(g,v)}});function ie(){if(ut){if(ut=!1,!ft){c&&c(null,0,0),A&&A("");return}if(c)if(J===0||J===1){let g=u.get_tooltip_data();c(g,K,gt)}else c(null,0,0);if(A){let g=performance.now();if(J===0||J===1){if(g-q>=80){q=g;try{A(u.lt_hit_test(K,gt))}catch{}}}else A("")}}}function le(){if(f=null,!(!d||h)&&(m||u.is_dirty())){m=!1,S=performance.now();let g=!1;try{if(u.render()>0){let T=u.get_command_buffer_ptr(),F=u.get_command_buffer_len();_.save(),_.setTransform(1,0,0,1,0,0),_.clearRect(0,0,e.width,e.height),_.restore(),dt(_,It,T,F),g=!0}try{D.renderAll(_)}catch{}}catch{g||(m=!0)}ie();try{j?.()}catch{}(m||u.is_dirty())&&I()}}let ue=$t(u,P,U),fe=Kt(u,P,U),_e=Dt(u,P,U),D=bt(u,It,dt);return{engine:u,start(){d=!0,h=!1,m=!0,I()},stop(){d=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null)},resize(g){if(i=e.getBoundingClientRect(),i.width<1||i.height<1){(g||0)<8&&setTimeout(()=>this.resize((g||0)+1),250);return}a=window.devicePixelRatio||1;let v=i.width*a,T=i.height*a;e.width=v,e.height=T,_.setTransform(1,0,0,1,0,0),_.scale(a,a),u.resize(i.width,i.height),P()},setHoverPrice(g){u.set_hover_price(g),P()},clearHoverPrice(){u.clear_hover_price(),P()},hitZone(g,v){return u.hit_zone(g,v)},startDrawing(g,v){G?.setMode(g,v)},cancelDrawing(){G?.setMode(null)},onDrawingComplete(g){tt=g},onDrawingCancel(g){et=g},onDrawingSelected(g){lt=g},onMarkerSelected(g){mt=g},onDrawingDblClick(g){L=g},setReplayState(g,v,T){u.set_replay_state(g,v,T),P()},setReplayHovered(g){u.set_replay_hovered(g)},setReplayPreview(g){u.set_replay_preview(g),P()},setPrecision(g){u.set_price_precision(g),P()},setCandleInterval(g){u.set_candle_interval(g)},setTheme(g){let v=g==="light"?1:0;typeof u.set_theme=="function"?(u.set_theme(v),P()):console.warn("[ChartEngine] set_theme not available \u2014 reload page to load updated WASM")},getTheme(){return u.get_theme()===1?"light":"dark"},onTooltip(g){c=g},onVrvpHover(g){N=g},onLtHover(g){A=g},onPostRender(g){j=g},onLiqAnnotationPin(g){rt=g},pause(){h||(h=!0,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null))},resume(){h&&(h=!1,d&&(m=!0,I()))},get isPaused(){return h},destroy(){p=!0,d=!1,h=!1,f&&(cancelAnimationFrame(f),f=null),w&&(clearTimeout(w),w=null),ne();try{u.free()}catch{}},addIndicator(g){let v=D.add(g);return P(),v},removeIndicator(g){D.remove(g),P()},updateIndicatorParams(g,v){D.updateParams(g,v),P()},setIndicatorEnabled(g,v){D.setEnabled(g,v),P()},listIndicators(){return D.list()},invalidateCustomIndicators(){D.invalidateCompute(),P()},get license(){return{plan:t.plan,valid:t.valid,expired:!!t.expired,watermark:!!t.watermark,daysLeft:t.daysLeft}},setLicenseKey(g){t=pt(g),!t.valid&&!t.expired&&console.error(`[MRD Chart Engine] ${t.error}`);let v=t.expired?2:t.watermark?1:0,T=t.daysLeft||0,F=1297237059;return F=Math.imul(F,31)+v>>>0,F=Math.imul(F,31)+T>>>0,F=(F^F>>>16)>>>0,F=Math.imul(F,73244475)>>>0,F=(F^F>>>16)>>>0,u.set_license_state(v,T,F),P(),t.valid},..._e,...ue,...fe}}export{Ce as createChartBridge,bt as createCustomIndicatorManager,dt as dispatchCommands,Le as generateLicenseKey,Fe as prefetchWasm,Mt as setupEvents,pt as validateLicense};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kline-orderbook-chart",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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",