Files
mixly3/boards/default/micropython_nrf51822_microbit/main.bundle.js
2024-07-19 10:16:00 +08:00

21 lines
299 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{controls_type:()=>it,controls_typeLists:()=>nt,variables_change:()=>tt,variables_get:()=>Z,variables_global:()=>et,variables_set:()=>$});var i={};t.r(i),t.d(i,{base_setup:()=>_t,controls_delay:()=>ut,controls_end_program:()=>at,controls_except:()=>Rt,controls_finally:()=>gt,controls_flow_statements:()=>dt,controls_for:()=>ht,controls_forEach:()=>lt,controls_for_range:()=>Mt,controls_if:()=>rt,controls_if_else:()=>Ot,controls_if_elseif:()=>ct,controls_if_if:()=>mt,controls_lambda:()=>At,controls_main:()=>ot,controls_pass:()=>Lt,controls_range:()=>pt,controls_repeat_ext:()=>Ct,controls_thread:()=>St,controls_try:()=>Et,controls_try_finally:()=>Tt,controls_whileUntil:()=>It,do_while:()=>Nt});var n={};t.r(n),t.d(n,{base_map:()=>jt,math_arithmetic:()=>vt,math_bit:()=>bt,math_constant:()=>Pt,math_constant_mp:()=>Ft,math_constrain:()=>wt,math_dec:()=>Xt,math_indexer_number:()=>Ht,math_map:()=>kt,math_max_min:()=>Ut,math_number:()=>ft,math_number_base_conversion:()=>Bt,math_random:()=>Gt,math_random_seed:()=>xt,math_round:()=>Wt,math_selfcalcu:()=>Yt,math_to_int:()=>yt,math_trig:()=>Vt,text_to_number:()=>Kt,text_to_number_skulpt:()=>Jt});var s={};t.r(s),t.d(s,{ascii_to_char:()=>te,char_to_ascii:()=>ee,number_to_text:()=>ie,os_system:()=>Ne,text:()=>qt,text_capital:()=>le,text_center:()=>Ie,text_char:()=>Zt,text_char_at:()=>oe,text_char_at2:()=>se,text_char_at3:()=>Ce,text_compareTo:()=>ge,text_compare_to:()=>pe,text_create_with_container:()=>Oe,text_create_with_item:()=>Ee,text_encode:()=>Le,text_equals_starts_ends:()=>re,text_eval:()=>Se,text_find:()=>Te,text_format:()=>ce,text_format_noreturn:()=>Ae,text_join:()=>$t,text_join_seq:()=>de,text_length:()=>ne,text_random_char:()=>_e,text_replace:()=>he,text_split:()=>Me,text_strip:()=>me,text_substring:()=>ae,text_substring2:()=>ue,text_substring3:()=>Re,text_textarea:()=>zt});var o={};t.r(o),t.d(o,{list_many_input:()=>qe,list_tolist:()=>ni,list_tolist2:()=>li,list_trig:()=>Je,lists_2d_get_col_row_data:()=>ve,lists_2d_get_data_with_col_row:()=>Fe,lists_append_extend:()=>Ue,lists_change_to:()=>Qe,lists_change_to_general:()=>Ze,lists_clear:()=>He,lists_create_with:()=>Ye,lists_create_with2:()=>si,lists_create_with_container:()=>Ve,lists_create_with_item:()=>Xe,lists_create_with_noreturn:()=>ze,lists_create_with_text:()=>be,lists_create_with_text2:()=>oi,lists_del_general:()=>$e,lists_find:()=>Ke,lists_getIndex3:()=>_i,lists_getSublist3:()=>ui,lists_get_index:()=>fe,lists_get_random_item:()=>Be,lists_get_random_sublist:()=>Ge,lists_get_sublist:()=>Pe,lists_insert_value:()=>we,lists_insert_value2:()=>ri,lists_pop:()=>We,lists_remove_at:()=>xe,lists_remove_at2:()=>pi,lists_reverse:()=>ke,lists_setIndex3:()=>ai,lists_set_index:()=>ye,lists_sort:()=>je,lists_zip:()=>ti,lists_zip_container:()=>ei,lists_zip_item:()=>ii});var _={};t.r(_),t.d(_,{dicts_add_change_del:()=>Ni,dicts_add_or_change:()=>Oi,dicts_clear:()=>gi,dicts_create_with:()=>Ti,dicts_create_with_container:()=>di,dicts_create_with_item:()=>hi,dicts_create_with_noreturn:()=>Pi,dicts_deldict:()=>Si,dicts_delete:()=>Ei,dicts_get:()=>mi,dicts_get_default:()=>ci,dicts_items:()=>Ci,dicts_keys:()=>Mi,dicts_length:()=>Li,dicts_pop:()=>Di,dicts_setdefault:()=>fi,dicts_to_json:()=>vi,dicts_todict:()=>Fi,dicts_update:()=>Ri,dicts_values:()=>Ai,json_to_dicts:()=>Yi});var u={};t.r(u),t.d(u,{logic_boolean:()=>Bi,logic_compare:()=>Vi,logic_compare_continous:()=>Xi,logic_is:()=>Hi,logic_is_in:()=>ki,logic_negate:()=>Ui,logic_null:()=>Gi,logic_operation:()=>yi,logic_tobool:()=>xi,logic_true_or_false:()=>wi});var a={};t.r(a),t.d(a,{sdcard_mount:()=>dn,sdcard_use_spi_init:()=>Tn,storage_can_write_ornot:()=>$i,storage_change_dir:()=>ln,storage_close_file:()=>en,storage_delete_file:()=>sn,storage_file_seek:()=>un,storage_file_tell:()=>_n,storage_file_write:()=>Qi,storage_fileopen:()=>Ki,storage_fileopen_new:()=>Ji,storage_fileopen_new_encoding:()=>ji,storage_get_a_line:()=>Zi,storage_get_contents:()=>zi,storage_get_contents_without_para:()=>qi,storage_get_current_dir:()=>an,storage_get_file_size:()=>on,storage_get_filename:()=>tn,storage_is_file:()=>In,storage_list_all_files:()=>nn,storage_make_dir:()=>rn,storage_open_file_with_os:()=>Wi,storage_rename:()=>pn});var r={};t.r(r),t.d(r,{procedures_callnoreturn:()=>Rn,procedures_callreturn:()=>gn,procedures_defnoreturn:()=>mn,procedures_defreturn:()=>cn,procedures_ifreturn:()=>Cn,procedures_mutatorarg:()=>En,procedures_mutatorcontainer:()=>On,procedures_return:()=>An});var p={};t.r(p),t.d(p,{tuple_change_to:()=>Xn,tuple_create_with:()=>Sn,tuple_create_with_container:()=>Nn,tuple_create_with_item:()=>Dn,tuple_create_with_noreturn:()=>Gn,tuple_create_with_text2:()=>fn,tuple_create_with_text_return:()=>Pn,tuple_del:()=>Yn,tuple_find:()=>yn,tuple_getIndex:()=>Fn,tuple_getSublist:()=>Bn,tuple_get_random_item:()=>kn,tuple_get_sublist:()=>wn,tuple_join:()=>bn,tuple_length:()=>vn,tuple_max:()=>Vn,tuple_totuple:()=>Hn,tuple_trig:()=>Un});var l={};t.r(l),t.d(l,{set_add_discard:()=>$n,set_clear:()=>qn,set_create_with:()=>Wn,set_create_with_container:()=>Kn,set_create_with_item:()=>Jn,set_create_with_text_return:()=>is,set_length:()=>jn,set_operate:()=>zn,set_operate_update:()=>Zn,set_pop:()=>Qn,set_sub:()=>ts,set_toset:()=>ns,set_update:()=>es});var I={};t.r(I),t.d(I,{html_content:()=>as,html_content_more:()=>rs,html_document:()=>os,html_form:()=>ls,html_head_body:()=>us,html_style:()=>ps,html_style_color:()=>Ts,html_style_content:()=>Is,html_text:()=>ds,html_title:()=>_s});var T={};t.r(T),t.d(T,{attribute_access:()=>Ds,function_call:()=>Ls,function_call_container:()=>Ss,function_call_item:()=>Ns,raw_block:()=>ms,raw_empty:()=>Os,raw_expression:()=>cs,raw_table:()=>Ms,text_comment:()=>Es,text_print_multiple:()=>gs,text_print_multiple_container:()=>Cs,text_print_multiple_item:()=>As,type_check:()=>Rs});var d={};t.r(d),t.d(d,{controls_type:()=>Ys,controls_typeLists:()=>bs,variables_change:()=>Fs,variables_get:()=>fs,variables_global:()=>vs,variables_set:()=>Ps});var h={};t.r(h),t.d(h,{Panic_with_status_code:()=>xs,base_setup:()=>Xs,controls_delay:()=>Hs,controls_flow_statements:()=>ks,controls_for:()=>Bs,controls_forEach:()=>Qs,controls_for_range:()=>Gs,controls_if:()=>ys,controls_interrupts:()=>Js,controls_lambda:()=>zs,controls_main:()=>Vs,controls_millis:()=>Ws,controls_nointerrupts:()=>js,controls_pass:()=>$s,controls_range:()=>qs,controls_repeat:()=>no,controls_repeat_ext:()=>io,controls_thread:()=>to,controls_try_finally:()=>Us,controls_whileUntil:()=>ws,do_while:()=>eo,reset:()=>Ks,time_sleep:()=>Zs});var M={};t.r(M),t.d(M,{base_map:()=>Lo,math_arithmetic:()=>ao,math_bit:()=>uo,math_constant:()=>oo,math_constant_mp:()=>_o,math_constrain:()=>co,math_dec:()=>Io,math_indexer_number:()=>Ro,math_map:()=>mo,math_max_min:()=>ho,math_number:()=>so,math_number_base_conversion:()=>Oo,math_random:()=>Mo,math_random_seed:()=>Eo,math_round:()=>go,math_selfcalcu:()=>ro,math_single:()=>po,math_to_int:()=>To,math_trig:()=>lo,text_to_number:()=>Co,text_to_number_skulpt:()=>Ao});var m={};t.r(m),t.d(m,{ascii_to_char:()=>Po,char_to_ascii:()=>Fo,number_to_text:()=>vo,os_system:()=>e_,text:()=>So,text_capital:()=>wo,text_center:()=>ko,text_char:()=>Do,text_char_at:()=>Vo,text_char_at2:()=>bo,text_char_at3:()=>Zo,text_compareTo:()=>zo,text_compare_to:()=>Uo,text_encode:()=>$o,text_equals_starts_ends:()=>yo,text_eval:()=>t_,text_find:()=>Ho,text_format:()=>jo,text_format_noreturn:()=>Qo,text_join:()=>fo,text_join_seq:()=>xo,text_length:()=>Yo,text_random_char:()=>Xo,text_replace:()=>Wo,text_split:()=>Ko,text_strip:()=>Jo,text_substring:()=>Go,text_substring2:()=>Bo,text_substring3:()=>qo,text_textarea:()=>No});var c={};t.r(c),t.d(c,{list_many_input:()=>R_,list_tolist:()=>Y_,list_tolist2:()=>b_,list_trig:()=>c_,lists_2d_get_col_row_data:()=>s_,lists_2d_get_data_with_col_row:()=>n_,lists_append_extend:()=>r_,lists_change_to:()=>E_,lists_change_to_general:()=>C_,lists_clear:()=>d_,lists_create_with:()=>o_,lists_create_with2:()=>L_,lists_create_with_noreturn:()=>g_,lists_create_with_text:()=>__,lists_create_with_text2:()=>S_,lists_del_general:()=>A_,lists_find:()=>h_,lists_getIndex3:()=>N_,lists_getSublist3:()=>D_,lists_get_index:()=>u_,lists_get_random_item:()=>p_,lists_get_random_sublist:()=>l_,lists_get_sublist:()=>i_,lists_insert_value:()=>I_,lists_insert_value2:()=>P_,lists_pop:()=>m_,lists_remove_at:()=>M_,lists_remove_at2:()=>F_,lists_reverse:()=>T_,lists_setIndex3:()=>f_,lists_set_index:()=>a_,lists_sort:()=>O_,lists_zip:()=>v_});var O={};t.r(O),t.d(O,{dicts_add_change_del:()=>J_,dicts_add_or_change:()=>B_,dicts_clear:()=>k_,dicts_create_with:()=>V_,dicts_create_with_noreturn:()=>q_,dicts_deldict:()=>K_,dicts_delete:()=>G_,dicts_get:()=>y_,dicts_get_default:()=>U_,dicts_items:()=>H_,dicts_keys:()=>X_,dicts_length:()=>W_,dicts_pop:()=>j_,dicts_setdefault:()=>Q_,dicts_to_json:()=>Z_,dicts_todict:()=>z_,dicts_update:()=>w_,dicts_values:()=>x_,json_to_dicts:()=>$_});var E={};t.r(E),t.d(E,{logic_boolean:()=>su,logic_compare:()=>tu,logic_compare_continous:()=>eu,logic_is:()=>au,logic_is_in:()=>uu,logic_negate:()=>nu,logic_null:()=>ou,logic_operation:()=>iu,logic_tobool:()=>ru,logic_true_or_false:()=>_u});var R={};t.r(R),t.d(R,{sdcard_mount:()=>vu,sdcard_use_spi_init:()=>Fu,storage_can_write_ornot:()=>cu,storage_change_dir:()=>Su,storage_close_file:()=>Eu,storage_delete_file:()=>gu,storage_file_seek:()=>Lu,storage_file_tell:()=>Au,storage_file_write:()=>du,storage_fileopen:()=>lu,storage_fileopen_new:()=>Iu,storage_fileopen_new_encoding:()=>Tu,storage_get_a_line:()=>mu,storage_get_contents:()=>Mu,storage_get_contents_without_para:()=>hu,storage_get_current_dir:()=>Nu,storage_get_file_size:()=>Cu,storage_get_filename:()=>Ou,storage_is_file:()=>Pu,storage_list_all_files:()=>Ru,storage_make_dir:()=>Du,storage_open_file_with_os:()=>pu,storage_rename:()=>fu});var g={};t.r(g),t.d(g,{procedures_callnoreturn:()=>Xu,procedures_callreturn:()=>Vu,procedures_defnoreturn:()=>bu,procedures_defreturn:()=>Yu,procedures_ifreturn:()=>yu,procedures_return:()=>Uu});var C={};t.r(C),t.d(C,{tuple_change_to:()=>Ju,tuple_create_with:()=>Bu,tuple_create_with_noreturn:()=>zu,tuple_create_with_text2:()=>Gu,tuple_create_with_text_return:()=>wu,tuple_del:()=>xu,tuple_find:()=>ju,tuple_getIndex:()=>ku,tuple_getSublist:()=>qu,tuple_get_random_item:()=>$u,tuple_get_sublist:()=>Zu,tuple_join:()=>Wu,tuple_length:()=>Hu,tuple_max:()=>Ku,tuple_totuple:()=>ta,tuple_trig:()=>Qu});var A={};t.r(A),t.d(A,{set_add_discard:()=>ua,set_clear:()=>sa,set_create_with:()=>ea,set_create_with_text_return:()=>pa,set_length:()=>ia,set_operate:()=>oa,set_operate_update:()=>_a,set_pop:()=>na,set_sub:()=>aa,set_toset:()=>la,set_update:()=>ra});var L={};t.r(L),t.d(L,{html_content:()=>ha,html_content_more:()=>Ma,html_document:()=>Ia,html_form:()=>ca,html_head_body:()=>da,html_style:()=>ma,html_style_content:()=>Oa,html_text:()=>Ea,html_title:()=>Ta});var S={};t.r(S),t.d(S,{attribute_access:()=>Na,function_call:()=>Sa,raw_block:()=>Ra,raw_empty:()=>Ca,raw_expression:()=>ga,raw_table:()=>Aa,type_check:()=>La});var N={};t.r(N),t.d(N,{MP3_CONTROL:()=>er,MP3_EQ_MODE:()=>or,MP3_INIT:()=>$a,MP3_LOOP_MODE:()=>nr,MP3_PLAY_FOLDER:()=>ar,MP3_PLAY_NUM:()=>ur,MP3_VOL:()=>_r,bit_motor_control:()=>ja,display_rgb:()=>qa,display_rgb2:()=>za,display_rgb_init:()=>Qa,display_rgb_show:()=>Za,microbit_music_get_tempo:()=>Ga,microbit_music_pitch:()=>Va,microbit_music_pitch_delay:()=>ba,microbit_music_play_built_in:()=>va,microbit_music_play_built_in_easy:()=>Ya,microbit_music_play_list_of_notes:()=>Xa,microbit_music_play_list_of_notes_easy:()=>ya,microbit_music_reset:()=>Ua,microbit_music_stop:()=>Ba,servo_move:()=>Ja,speech_pronounce_easy:()=>Wa,speech_say:()=>ka,speech_say_easy:()=>Ha,speech_sing_easy:()=>xa,speech_translate:()=>Ka,tone_set_tempo:()=>wa});var D={};t.r(D),t.d(D,{i2c_init:()=>Or,i2c_read:()=>Er,i2c_write:()=>Rr,microbit_radio_config:()=>Tr,microbit_radio_off:()=>Ir,microbit_radio_on:()=>lr,microbit_radio_receive:()=>mr,microbit_radio_reset:()=>dr,microbit_radio_send_string:()=>hr,radio_ons:()=>pr,radio_receive_string:()=>cr,radio_send_string:()=>Mr,spi_init:()=>gr,spi_write:()=>Cr});var f={};t.r(f),t.d(f,{display_fill:()=>zr,display_image_size:()=>qr,group_lcd_init:()=>Kr,group_lcd_power:()=>jr,group_lcd_print:()=>Wr,group_lcd_print2:()=>Jr,image_arithmetic:()=>xr,image_shift:()=>Hr,lp2i_u8g_draw_4strings:()=>Qr,microbit_display_clear:()=>Lr,microbit_display_is_on:()=>Ur,microbit_display_off:()=>yr,microbit_display_on:()=>Xr,microbit_display_scroll:()=>Vr,microbit_display_scroll_string_animation:()=>br,microbit_display_show_animation:()=>Yr,microbit_display_show_default_image:()=>vr,microbit_display_show_image:()=>Fr,microbit_image_builtins:()=>Br,microbit_image_copy:()=>Gr,microbit_image_create:()=>kr,microbit_image_invert:()=>wr,monitor_bright_point:()=>Nr,monitor_get_pixel:()=>Sr,monitor_scroll_string:()=>fr,monitor_scroll_string_with_delay:()=>Pr,monitor_show_image_or_string:()=>Dr});var P={};t.r(P),t.d(P,{factory_block:()=>ap,factory_block_return:()=>rp,factory_block_return_with_textarea:()=>lp,factory_block_with_textarea:()=>pp,factory_callMethod_noreturn:()=>_p,factory_callMethod_return:()=>up,factory_create_with_container:()=>ip,factory_create_with_item:()=>np,factory_declare:()=>op,factory_from_import:()=>$r,factory_function_noreturn:()=>ep,factory_function_return:()=>sp,factory_import:()=>tp});var F={};t.r(F),t.d(F,{inout_analog_read:()=>mp,inout_analog_write:()=>hp,inout_analog_write_set:()=>Mp,inout_digital_read:()=>dp,inout_digital_write:()=>Op,inout_highlow:()=>Tp,sensor_pin_pressed:()=>cp});var v={};t.r(v),t.d(v,{pins_analog:()=>gp,pins_axis:()=>fp,pins_brightness:()=>Pp,pins_builtinimg:()=>Np,pins_button:()=>Cp,pins_digital:()=>Rp,pins_imglist:()=>Dp,pins_interrupt:()=>Lp,pins_pwm:()=>Ap,pins_radio_datarate:()=>Yp,pins_radio_power:()=>vp,pins_serial:()=>Sp,pins_tone_notes:()=>Fp});var Y={};t.r(Y),t.d(Y,{DS1307_init:()=>nl,NTC_TEMP:()=>Tl,RTC_get_time:()=>ol,RTC_set_date:()=>ul,RTC_set_time:()=>_l,TCS34725_Get_RGB:()=>Il,controls_GestureLists:()=>wp,controls_attachGestureInterrupt:()=>Gp,controls_attachGestureInterrupt2:()=>kp,sensor_button_get_presses:()=>yp,sensor_button_is_pressed:()=>Vp,sensor_button_was_pressed:()=>Xp,sensor_calibrate_compass:()=>jp,sensor_compass_heading:()=>qp,sensor_compass_reset:()=>al,sensor_current_gesture:()=>Kp,sensor_current_gesture1:()=>Up,sensor_current_gesture2:()=>Bp,sensor_distance_hrsc04:()=>el,sensor_distance_hrsc04_:()=>il,sensor_field_strength:()=>Zp,sensor_get_acceleration:()=>Hp,sensor_get_gestures:()=>Wp,sensor_hrsc04_init:()=>pl,sensor_is_compass_calibrated:()=>Qp,sensor_light:()=>rl,sensor_light_level:()=>Jp,sensor_magnetic:()=>tl,sensor_rotation:()=>$p,sensor_set_acceleration:()=>xp,sensor_temperature:()=>zp});var b={};t.r(b),t.d(b,{IO_input:()=>Ll,IO_print:()=>Sl,IO_print_inline:()=>Nl,serial_any:()=>El,serial_begin:()=>Al,serial_print:()=>hl,serial_print_hex:()=>ml,serial_println:()=>Ml,serial_readline:()=>Rl,serial_readstr:()=>Ol,serial_readstr_until:()=>gl,serial_receive_data_event:()=>cl,serial_softserial:()=>Cl});var V={};t.r(V),t.d(V,{Panic_with_status_code:()=>Fl,base_delay:()=>fl,controls_millis:()=>Pl,controls_uname:()=>Yl,reset:()=>vl});var X={};t.r(X),t.d(X,{MP3_CONTROL:()=>eI,MP3_EQ_MODE:()=>nI,MP3_INIT:()=>tI,MP3_LOOP_MODE:()=>iI,MP3_PLAY_FOLDER:()=>_I,MP3_PLAY_NUM:()=>oI,MP3_VOL:()=>sI,bit_motor_control:()=>Ql,display_rgb:()=>zl,display_rgb2:()=>Zl,display_rgb_init:()=>ql,display_rgb_show:()=>$l,microbit_music_get_tempo:()=>wl,microbit_music_pitch:()=>yl,microbit_music_pitch_delay:()=>Xl,microbit_music_play_built_in:()=>bl,microbit_music_play_built_in_easy:()=>Vl,microbit_music_play_list_of_notes:()=>Ul,microbit_music_reset:()=>Bl,microbit_music_stop:()=>Gl,servo_move:()=>jl,speech_pronounce_easy:()=>Jl,speech_say:()=>xl,speech_say_easy:()=>Wl,speech_sing_easy:()=>Kl,speech_translate:()=>Hl,tone_set_tempo:()=>kl});var y={};t.r(y),t.d(y,{i2c_init:()=>hI,i2c_read:()=>MI,i2c_write:()=>mI,microbit_radio_config:()=>pI,microbit_radio_off:()=>rI,microbit_radio_on:()=>aI,microbit_radio_receive:()=>dI,microbit_radio_reset:()=>lI,radio_ons:()=>uI,radio_receive_string:()=>TI,radio_send_string:()=>II,spi_init:()=>cI,spi_write:()=>OI});var U={};t.r(U),t.d(U,{display_fill:()=>KI,display_image_size:()=>WI,group_lcd_init:()=>wI,group_lcd_power:()=>HI,group_lcd_print:()=>GI,group_lcd_print2:()=>kI,image_arithmetic:()=>UI,image_shift:()=>yI,lp2i_u8g_draw_4strings:()=>xI,microbit_display_clear:()=>EI,microbit_display_is_on:()=>vI,microbit_display_on:()=>FI,microbit_display_scroll:()=>PI,microbit_display_scroll_string_animation:()=>BI,microbit_display_set_pixel:()=>gI,microbit_display_show_animation:()=>fI,microbit_display_show_default_image:()=>DI,microbit_display_show_image:()=>NI,microbit_image_builtins:()=>YI,microbit_image_copy:()=>bI,microbit_image_create:()=>XI,microbit_image_invert:()=>VI,monitor_bright_point:()=>CI,monitor_get_pixel:()=>RI,monitor_scroll_string:()=>LI,monitor_scroll_string_with_delay:()=>SI,monitor_show_image_or_string:()=>AI});var B={};t.r(B),t.d(B,{factory_block:()=>tT,factory_block_return:()=>eT,factory_block_return_with_textarea:()=>nT,factory_block_with_textarea:()=>iT,factory_callMethod_noreturn:()=>ZI,factory_callMethod_return:()=>$I,factory_declare:()=>zI,factory_from_import:()=>JI,factory_function_noreturn:()=>QI,factory_function_return:()=>qI,factory_import:()=>jI});var G={};t.r(G),t.d(G,{inout_analog_read:()=>rT,inout_analog_write:()=>uT,inout_analog_write_set:()=>aT,inout_digital_read:()=>_T,inout_digital_write:()=>oT,inout_highlow:()=>sT,sensor_pin_pressed:()=>pT});var w={};t.r(w),t.d(w,{pins_analog:()=>IT,pins_axis:()=>OT,pins_brightness:()=>ET,pins_builtinimg:()=>mT,pins_button:()=>TT,pins_digital:()=>lT,pins_imglist:()=>cT,pins_interrupt:()=>hT,pins_pwm:()=>dT,pins_radio_datarate:()=>CT,pins_radio_power:()=>gT,pins_serial:()=>MT,pins_tone_notes:()=>RT});var k={};t.r(k),t.d(k,{DS1307_init:()=>KT,NTC_TEMP:()=>td,RTC_get_time:()=>JT,RTC_set_date:()=>QT,RTC_set_time:()=>jT,TCS34725_Get_RGB:()=>$T,controls_GestureLists:()=>NT,controls_attachGestureInterrupt:()=>DT,controls_attachGestureInterrupt2:()=>FT,sensor_button_get_presses:()=>ST,sensor_button_is_pressed:()=>AT,sensor_button_was_pressed:()=>LT,sensor_calibrate_compass:()=>yT,sensor_compass_heading:()=>BT,sensor_compass_reset:()=>qT,sensor_current_gesture:()=>YT,sensor_current_gesture1:()=>fT,sensor_current_gesture2:()=>PT,sensor_distance_hrsc04:()=>xT,sensor_distance_hrsc04_:()=>WT,sensor_field_strength:()=>wT,sensor_get_acceleration:()=>bT,sensor_get_gestures:()=>vT,sensor_hrsc04_init:()=>ZT,sensor_is_compass_calibrated:()=>UT,sensor_light:()=>zT,sensor_light_level:()=>XT,sensor_magnetic:()=>HT,sensor_rotation:()=>kT,sensor_set_acceleration:()=>VT,sensor_temperature:()=>GT});var H={};t.r(H),t.d(H,{IO_input:()=>ld,IO_print:()=>Id,IO_print_inline:()=>Td,serial_any:()=>od,serial_begin:()=>pd,serial_print:()=>ed,serial_print_hex:()=>nd,serial_println:()=>id,serial_readline:()=>ud,serial_readstr:()=>_d,serial_readstr_until:()=>ad,serial_receive_data_event:()=>sd,serial_softserial:()=>rd});var x={};t.r(x),t.d(x,{Panic_with_status_code:()=>Sd,base_delay:()=>Ld,controls_end_program:()=>Dd,controls_millis:()=>Nd,controls_uname:()=>Pd,reset:()=>fd,system_device_name:()=>Cd,system_device_serial_number:()=>Ad,system_event_bus_source:()=>Rd,system_event_bus_value:()=>gd,system_on_event:()=>cd,system_raise_event:()=>md,system_reset:()=>hd,system_run_in_background:()=>dd,system_timestamp:()=>Od,system_value:()=>Ed,system_wait:()=>Md});const W=Blockly,K=Mixly,J={NAME_TYPE:"VARIABLE",allVariables:function(t){var e;if(t.getDescendants)e=t.getDescendants();else{if(!t.getAllBlocks)throw"Not Block or Workspace: "+t;e=t.getAllBlocks()}for(var i=Object.create(null),n=0;n<e.length;n++)for(var s=e[n].getVars(),o=0;o<s.length;o++){var _=s[o];_&&(i[_.toLowerCase()]=_)}var u=[];for(var a in i)u.push(i[a]);return u},renameVariable:function(t,e,i){W.Events.setGroup(!0);for(var n=i.getAllBlocks(),s=0;s<n.length;s++)n[s].renameVar(t,e);W.Events.setGroup(!1)},flyoutCategory:function(t){var e=J.allVariables(t),i=[];((o=W.utils.xml.createElement("block")).setAttribute("type","variables_global"),i.push(o),W.Blocks.variables_set)&&((o=W.utils.xml.createElement("block")).setAttribute("type","variables_set"),i.push(o));W.Blocks.variables_change&&((o=W.utils.xml.createElement("block")).setAttribute("type","variables_change"),i.push(o));W.Blocks.controls_type&&((o=W.utils.xml.createElement("block")).setAttribute("type","controls_type"),i.push(o));W.Blocks.controls_typeLists&&((o=W.utils.xml.createElement("block")).setAttribute("type","controls_typeLists"),i.push(o));for(var n=0;n<e.length;n++){if(W.Blocks.variables_set){(o=W.utils.xml.createElement("block")).setAttribute("type","variables_set"),W.Blocks.variables_get&&o.setAttribute("gap",8),(_=W.utils.xml.createElement("field",null,e[n])).setAttribute("name","VAR");var s=W.utils.xml.createTextNode(e[n]);_.appendChild(s),o.appendChild(_),i.push(o)}if(W.Blocks.variables_get){var o,_;(o=W.utils.xml.createElement("block")).setAttribute("type","variables_get"),W.Blocks.variables_set&&o.setAttribute("gap",24),(_=W.utils.xml.createElement("field",null,e[n])).setAttribute("name","VAR");s=W.utils.xml.createTextNode(e[n]);_.appendChild(s),o.appendChild(_),i.push(o)}}return i},generateUniqueName:function(t){var e=J.allVariables(t),i="";if(e.length)for(var n=1,s="ijkmnopqrstuvwxyzabcdefgh",o=0,_=s.charAt(o);!i;){for(var u=!1,a=0;a<e.length;a++)if(e[a].toLowerCase()==_){u=!0;break}u?(25==++o&&(o=0,n++),_=s.charAt(o),n>1&&(_+=n)):i=_}else i="i";return i}},j=J;
/**
* @license
* Visual Blocks Editor
*
* Copyright 2012 Google Inc.
* https://developers.google.com/blockly/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Q{constructor(t,e){if(this.variablePrefix_=e||"",this.reservedDict_=Object.create(null),t)for(var i=t.split(","),n=0;n<i.length;n++)this.reservedDict_[i[n]]=!0;this.reset()}static equals(t,e){return t.toLowerCase()==e.toLowerCase()}reset(){this.db_=Object.create(null),this.dbReverse_=Object.create(null),this.variableMap_=null}setVariableMap(t){this.variableMap_=t}getNameForUserVariable_(t){if(!this.variableMap_)return null;var e=this.variableMap_.getVariableById(t);return e?e.name:null}getName(t,e){if(e==j.NAME_TYPE){var i=this.getNameForUserVariable_(t);i&&(t=i)}var n=t.toLowerCase()+"_"+e,s=e==j.NAME_TYPE||e==Q.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"";if(n in this.db_)return s+this.db_[n];var o=this.getDistinctName(t,e);return this.db_[n]=o.substr(s.length),o}getDistinctName(t,e){for(var i=this.safeName_(t),n="";this.dbReverse_[i+n]||i+n in this.reservedDict_;)n=n?n+1:2;return i+=n,this.dbReverse_[i]=!0,(e==j.NAME_TYPE||e==Q.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"")+i}safeName_(t){return t?(t=encodeURI(t.replace(/ /g,"_")).replace(/[^,\w]/g,"_"),-1!="0123456789".indexOf(t[0])&&(t="my_"+t)):t="unnamed",t}}Q.DEVELOPER_VARIABLE_TYPE="DEVELOPER_VARIABLE";const q=Q,z=330,Z={init:function(){this.setColour(z),this.appendDummyInput().appendField(new W.FieldTextInput(""),"VAR"),this.setOutput(!0),this.setTooltip(W.Msg.VARIABLES_GET_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){q.equals(t,this.getFieldValue("VAR"))&&this.setFieldValue(e,"VAR")}},$={init:function(){this.setColour(z),this.appendValueInput("VALUE").appendField(new W.FieldTextInput(""),"VAR").appendField(W.Msg.MIXLY_VALUE2),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.VARIABLES_SET_TOOLTIP)},getVars:function(){var t=this.getFieldValue("VAR");return null==t?[]:t.split(",")},renameVar:function(t,e){q.equals(t,this.getFieldValue("VAR"))&&this.setFieldValue(e,"VAR")}},tt={init:function(){this.setColour(z);var t=[[W.Msg.LANG_MATH_INT,"int"],[W.Msg.LANG_MATH_FLOAT,"float"],[W.Msg.LANG_MATH_BOOLEAN,"bool"],[W.Msg.LANG_MATH_STRING,"str"],[W.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[W.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[W.Msg.MIXLY_MICROBIT_TYPE_DICT,"dict"],[W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[W.Msg.LANG_MATH_BYTE,"bytes"]];this.appendValueInput("MYVALUE").appendField(new W.FieldDropdown(t),"OP"),this.setOutput(!0)}},et={init:function(){this.setColour(z),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_PYTHON_GLOBAL).setCheck("var"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.TEXT_PRINT_TOOLTIP)}},it={init:function(){this.setColour(z),this.appendValueInput("DATA").appendField(W.Msg.MICROBIT_PYTHON_TYPE),this.setOutput(!0),this.setTooltip(W.Msg.MICROBIT_PYTHON_TYPE)}},nt={init:function(){this.setColour(z),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_CONTORL_GET_TYPE).appendField(new W.FieldDropdown([[W.Msg.LANG_MATH_INT,"int"],[W.Msg.MIXLY_MICROBIT_TYPE_FLOAT,"float"],[W.Msg.MIXLY_MICROBIT_TYPE_STRING,"str"],[W.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[W.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[W.Msg.MIXLY_MICROBIT_TYPE_DICT,"dict"],[W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[W.Msg.LANG_MATH_BYTE,"bytes"],[W.Msg.LOGIC_NULL,"type(None)"]]),"type"),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("type");return W.Msg.MICROBIT_controls_TypeLists+{int:W.Msg.LANG_MATH_INT,float:W.Msg.MIXLY_MICROBIT_TYPE_FLOAT,str:W.Msg.MIXLY_MICROBIT_TYPE_STRING,list:W.Msg.MIXLY_MICROBIT_TYPE_LIST,tuple:W.Msg.MIXLY_MICROBIT_TYPE_TUPLE,dict:W.Msg.MIXLY_MICROBIT_TYPE_DICT,set:W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,image:W.Msg.MIXLY_MICROBIT_IMAGE,bytes:W.Msg.LANG_MATH_BYTE,NoneType:W.Msg.LOGIC_NULL}[e]}))}},st=120,ot={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_NAME_MAIN),this.appendStatementInput("DO").appendField(""),this.setTooltip(W.Msg.MIXLY_TOOLTIP_CONTROL_SETUP)}},_t={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_SETUP),this.appendStatementInput("DO").appendField(""),this.setTooltip(W.Msg.MIXLY_TOOLTIP_CONTROL_SETUP)}},ut={init:function(){var t=[[W.Msg.MIXLY_mSecond,"delay"],[W.Msg.MIXLY_uSecond,"delayMicroseconds"]];this.setColour(st),this.appendValueInput("DELAY_TIME",Number).appendField(W.Msg.MIXLY_DELAY).appendField(new W.FieldDropdown(t),"UNIT").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_CONTROL_DELAY),this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id9"),this.wiki={"zh-hans":{page:["Arduino AVR","控制","延时"]}}}},at={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_CONTROL_END_PROGRAM),this.setPreviousStatement(!0),this.setTooltip(W.Msg.MIXLY_MIXPY_CONTROL_END_TOOLTIP)}},rt={init:function(){this.setColour(st),this.appendValueInput("IF0").setCheck([Boolean,Number]).appendField(W.Msg.CONTROLS_IF_MSG_IF),this.appendStatementInput("DO0").appendField(W.Msg.CONTROLS_IF_MSG_THEN),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#if"),this.setMutator(new W.icons.MutatorIcon(["controls_if_elseif","controls_if_else"],this));var t=this;this.setTooltip((function(){return t.elseifCount_||t.elseCount_?!t.elseifCount_&&t.elseCount_?W.Msg.CONTROLS_IF_TOOLTIP_2:t.elseifCount_&&!t.elseCount_?W.Msg.CONTROLS_IF_TOOLTIP_3:t.elseifCount_&&t.elseCount_?W.Msg.CONTROLS_IF_TOOLTIP_4:"":W.Msg.CONTROLS_IF_TOOLTIP_1})),this.elseifCount_=0,this.elseCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var t=document.createElement("mutation");return this.elseifCount_&&t.setAttribute("elseif",this.elseifCount_),this.elseCount_&&t.setAttribute("else",1),t},domToMutation:function(t){var e=this,i=[],n=[];this.elseCount_&&this.removeInput("ELSE");for(var s=this.elseifCount_;s>0;s--)e.getInputTargetBlock("IF"+s)&&e.getInputTargetBlock("IF"+s).previousConnection?i[s]=e.getInputTargetBlock("IF"+s).previousConnection:i[s]=null,this.removeInput("IF"+s),e.getInputTargetBlock("DO"+s)&&e.getInputTargetBlock("DO"+s).previousConnection?n[s]=e.getInputTargetBlock("DO"+s).previousConnection:n[s]=null,this.removeInput("DO"+s);this.elseifCount_=parseInt(t.getAttribute("elseif"),10),this.elseCount_=parseInt(t.getAttribute("else"),10);for(s=1;s<=this.elseifCount_;s++)this.appendValueInput("IF"+s).setCheck([Boolean,Number]).appendField(W.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+s).appendField(W.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(W.Msg.CONTROLS_IF_MSG_ELSE);for(s=i.length-2;s>0;s--)i[s]&&i[s].reconnect(this,"IF"+s);for(s=n.length-2;s>0;s--)n[s]&&n[s].reconnect(this,"DO"+s)},decompose:function(t){var e=t.newBlock("controls_if_if");e.initSvg();for(var i=e.getInput("STACK").connection,n=1;n<=this.elseifCount_;n++){var s=t.newBlock("controls_if_elseif");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}if(this.elseCount_){var o=t.newBlock("controls_if_else");o.initSvg(),i.connect(o.previousConnection)}return e},compose:function(t){this.elseCount_&&this.removeInput("ELSE"),this.elseCount_=0;for(var e=this.elseifCount_;e>0;e--)this.removeInput("IF"+e),this.removeInput("DO"+e);this.elseifCount_=0;for(var i=t.getInputTargetBlock("STACK"),n=[null],s=[null],o=null;i;){switch(i.type){case"controls_if_elseif":this.elseifCount_++,n.push(i.valueConnection_),s.push(i.statementConnection_);break;case"controls_if_else":this.elseCount_++,o=i.statementConnection_;break;default:throw Error("Unknown block type: "+i.type)}i=i.nextConnection&&i.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(n,s,o)},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=1;e;){switch(e.type){case"controls_if_elseif":var n=this.getInput("IF"+i),s=this.getInput("DO"+i);e.valueConnection_=n&&n.connection.targetConnection,e.statementConnection_=s&&s.connection.targetConnection,i++;break;case"controls_if_else":s=this.getInput("ELSE");e.statementConnection_=s&&s.connection.targetConnection;break;default:throw"Unknown block type."}e=e.nextConnection&&e.nextConnection.targetBlock()}},rebuildShape_:function(){var t=[null],e=[null],i=null;this.getInput("ELSE")&&(i=this.getInput("ELSE").connection.targetConnection);for(var n=1;this.getInput("IF"+n);){var s=this.getInput("IF"+n),o=this.getInput("DO"+n);console.log(s.connection.targetConnection),t.push(s.connection.targetConnection),e.push(o.connection.targetConnection),n++}this.updateShape_(),this.reconnectChildBlocks_(t,e,i)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var t=1;this.getInput("IF"+t);)this.removeInput("IF"+t),this.removeInput("DO"+t),t++;for(t=1;t<=this.elseifCount_;t++)this.appendValueInput("IF"+t).setCheck([Number,Boolean]).appendField(W.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+t).appendField(W.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(W.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(t,e,i){for(var n=1;n<=this.elseifCount_;n++)t[n]&&t[n].reconnect(this,"IF"+n),e[n]&&e[n].reconnect(this,"DO"+n);i&&i.reconnect(this,"ELSE")}},pt={init:function(){this.setColour(st),this.appendValueInput("FROM").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.PYTHON_RANGE).appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.PYTHON_RANGE_STEP),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},lt={init:function(){this.setColour(st),this.appendValueInput("LIST").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.CONTROLS_FOREACH_INPUT),this.appendValueInput("VAR").appendField(W.Msg.CONTROLS_FOREACH_INPUT_ITEM),this.appendStatementInput("DO").appendField(W.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip((function(){return W.Msg.CONTROLS_FOR_TOOLTIP.replace("“%1”","")}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},It={init:function(){this.setColour(st),this.appendValueInput("BOOL").setCheck([Boolean,Number]).appendField(W.Msg.MIXLY_MICROBIT_JS_CURRENT).appendField(new W.FieldDropdown(this.OPERATORS),"MODE"),this.appendStatementInput("DO").appendField(W.Msg.LANG_CONTROLS_WHILEUNTIL_TITLE_REPEAT+W.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE");return{WHILE:W.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,UNTIL:W.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}[e]}))}},Tt={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_TRY),this.appendStatementInput("try"),this.appendValueInput("IF1").appendField(W.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO1").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["controls_except","controls_finally"],this)),this.setTooltip(W.Msg.MIXLY_MIXPY_CONTROL_TRY_TOOLTIP),this.elseifCount_=1,this.elseCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var t=document.createElement("mutation");return this.elseifCount_&&t.setAttribute("elseif",this.elseifCount_),this.elseCount_&&t.setAttribute("else",1),t},domToMutation:function(t){var e=this,i=[],n=[];this.elseCount_&&this.removeInput("ELSE");for(var s=this.elseifCount_;s>0;s--)e.getInputTargetBlock("IF"+s)&&e.getInputTargetBlock("IF"+s).previousConnection?i[s]=e.getInputTargetBlock("IF"+s).previousConnection:i[s]=null,this.removeInput("IF"+s),e.getInputTargetBlock("DO"+s)&&e.getInputTargetBlock("DO"+s).previousConnection?n[s]=e.getInputTargetBlock("DO"+s).previousConnection:n[s]=null,this.removeInput("DO"+s);this.elseifCount_=parseInt(t.getAttribute("elseif"),10),this.elseCount_=parseInt(t.getAttribute("else"),10);for(s=1;s<=this.elseifCount_;s++)this.appendValueInput("IF"+s).setCheck([Boolean,Number]).appendField(W.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO"+s).appendField("");this.elseCount_&&this.appendStatementInput("ELSE").appendField(W.Msg.MIXLY_PYTHON_FINALLY);for(s=i.length-2;s>0;s--)i[s]&&i[s].reconnect(this,"IF"+s);for(s=n.length-2;s>0;s--)n[s]&&n[s].reconnect(this,"DO"+s)},decompose:function(t){var e=t.newBlock("controls_try");e.initSvg();for(var i=e.getInput("STACK").connection,n=1;n<=this.elseifCount_;n++){var s=t.newBlock("controls_except");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}if(this.elseCount_){var o=t.newBlock("controls_finally");o.initSvg(),i.connect(o.previousConnection)}return e},compose:function(t){this.elseCount_&&this.removeInput("ELSE"),this.elseCount_=0;for(var e=this.elseifCount_;e>0;e--)this.removeInput("IF"+e),this.removeInput("DO"+e);this.elseifCount_=0;for(var i=t.getInputTargetBlock("STACK"),n=[null],s=[null],o=null;i;){switch(i.type){case"controls_except":this.elseifCount_++,n.push(i.valueConnection_),s.push(i.statementConnection_);break;case"controls_finally":this.elseCount_++,o=i.statementConnection_;break;default:throw Error("Unknown block type: "+i.type)}i=i.nextConnection&&i.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(n,s,o)},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=1;e;){switch(e.type){case"controls_except":var n=this.getInput("IF"+i),s=this.getInput("DO"+i);e.valueConnection_=n&&n.connection.targetConnection,e.statementConnection_=s&&s.connection.targetConnection,i++;break;case"controls_finally":s=this.getInput("ELSE");e.statementConnection_=s&&s.connection.targetConnection;break;default:throw"Unknown block type."}e=e.nextConnection&&e.nextConnection.targetBlock()}},rebuildShape_:function(){var t=[null],e=[null],i=null;this.getInput("ELSE")&&(i=this.getInput("ELSE").connection.targetConnection);for(var n=1;this.getInput("IF"+n);){var s=this.getInput("IF"+n),o=this.getInput("DO"+n);console.log(s.connection.targetConnection),t.push(s.connection.targetConnection),e.push(o.connection.targetConnection),n++}this.updateShape_(),this.reconnectChildBlocks_(t,e,i)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var t=1;this.getInput("IF"+t);)this.removeInput("IF"+t),this.removeInput("DO"+t),t++;for(t=1;t<=this.elseifCount_;t++)this.appendValueInput("IF"+t).setCheck([Number,Boolean]).appendField(W.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO"+t).appendField("");this.elseCount_&&this.appendStatementInput("ELSE").appendField(W.Msg.MIXLY_PYTHON_FINALLY)},reconnectChildBlocks_:function(t,e,i){for(var n=1;n<=this.elseifCount_;n++)t[n]&&t[n].reconnect(this,"IF"+n),e[n]&&e[n].reconnect(this,"DO"+n);i&&i.reconnect(this,"ELSE")}},dt={init:function(){this.setColour(st);var t=new W.FieldDropdown(this.OPERATORS);this.appendDummyInput().appendField(t,"FLOW").appendField(W.Msg.LANG_CONTROLS_FLOW_STATEMENTS_INPUT_OFLOOP),this.setPreviousStatement(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_CONTROLS_FLOW_STATEMENTS_TOOLTIP);var e=this;this.setTooltip((function(){var t=e.getFieldValue("FLOW");return{BREAK:W.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK,CONTINUE:W.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}[t]}))},onchange:function(){if(this.workspace){var t=!1,e=this;do{if("controls_repeat"==e.type||"controls_for"==e.type||"controls_forEach"==e.type||"controls_repeat_ext"==e.type||"controls_whileUntil"==e.type||"do_while"==e.type){t=!0;break}e=e.getSurroundParent()}while(e);t?this.setWarningText(null):this.setWarningText(W.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING)}}},ht={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_WITH).appendField(new W.FieldTextInput("i"),"VAR"),this.appendValueInput("FROM").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_STEP),this.appendStatementInput("DO").appendField(W.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var t=this;this.setTooltip((function(){return W.Msg.CONTROLS_FOR_TOOLTIP.replace("%1",t.getFieldValue("VAR"))}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Mt={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_WITH).appendField(new W.FieldTextInput("i"),"VAR"),this.appendValueInput("FROM").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_STEP),this.appendStatementInput("DO").appendField(W.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var t=this;this.setTooltip((function(){return W.Msg.MIXLY_PYTHON_CONTROLS_FOR_RANGE_TOOLTIP.replace("%1",t.getFieldValue("VAR"))}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}};It.OPERATORS=[[W.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"WHILE"],[W.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"UNTIL"]],dt.OPERATORS=[[W.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK,"BREAK"],[W.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE,"CONTINUE"]];const mt={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.CONTROLS_IF_IF_TITLE_IF),this.appendStatementInput("STACK"),this.setTooltip(W.Msg.CONTROLS_IF_IF_TOOLTIP),this.contextMenu=!1}},ct={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.CONTROLS_IF_ELSEIF_TOOLTIP),this.contextMenu=!1}},Ot={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.CONTROLS_IF_ELSE_TITLE_ELSE),this.setPreviousStatement(!0),this.setTooltip(W.Msg.CONTROLS_IF_ELSE_TOOLTIP),this.contextMenu=!1}},Et={init:function(){this.setColour(st),this.appendDummyInput().appendField("try"),this.appendStatementInput("STACK"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.contextMenu=!1}},Rt={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_EXCEPT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.contextMenu=!1,this.setTooltip(W.Msg.MIXLY_MIXPY_CONTROL_EXCEPT_TOOLTIP)}},gt={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_FINALLY),this.setPreviousStatement(!0),this.contextMenu=!1,this.setTooltip(W.Msg.MIXLY_MIXPY_CONTROL_FINALLY_TOOLTIP)}},Ct={init:function(){this.jsonInit({message0:W.Msg.CONTROLS_REPEAT_TITLE,args0:[{type:"input_value",name:"TIMES"}],previousStatement:null,nextStatement:null,colour:st,tooltip:W.Msg.CONTROLS_REPEAT_TOOLTIP,helpUrl:W.Msg.CONTROLS_REPEAT_HELPURL}),this.appendStatementInput("DO")}},At={init:function(){this.setColour(st),this.appendValueInput("BOOL").appendField("lambda"),this.appendStatementInput("DO").appendField(W.Msg.MIXLY_STAT),this.setOutput(!0)}},Lt={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_PASS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_CONTROLS_PASS_TOOLTIP)}},St={init:function(){this.setColour(st),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_CONTROLS_THREAD_START),this.appendValueInput("callback").appendField(W.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_PARAMS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_CONTROLS_THREAD_TOOLTIP)}},Nt={init:function(){this.appendDummyInput().appendField(W.Msg.CONTROLS_REPEAT_TITLE_REPEAT+W.Msg.MIXLY_DO),this.appendStatementInput("input_data").setCheck(null),this.appendValueInput("select_data").setCheck(null).appendField(W.Msg.CONTROLS_OPERATOR_UNTIL).appendField(new W.FieldDropdown([[W.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"true"],[W.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"false"]]),"type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(st),this.setTooltip("do-while loop"),this.setHelpUrl("")}},Dt=230;W.FieldTextInput.math_number_validator=function(t){return String(t)},W.FieldTextInput.math_number_validator_include_blank=function(t){if(""===t)return"";return/^-?(0X|0x|0O|0o|0B|0b)?[a-fA-F0-9]{1,}(\.[a-fA-F0-9]+)?$/.test(t)?String(t):null};const ft={init:function(){this.setColour(Dt),this.appendDummyInput().appendField(new W.FieldTextInput("0",W.FieldTextInput.math_number_validator),"NUM"),this.setOutput(!0,Number),this.setTooltip(W.Msg.MATH_NUMBER_TOOLTIP)}},Pt={init:function(){this.setColour(Dt);this.appendDummyInput("").appendField(W.Msg.MIXLY_PYTHON_MATH_CONSTANT).appendField(new W.FieldDropdown([["π","pi"],["e","e"]]),"CONSTANT"),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("CONSTANT");return{pi:W.Msg.MIXLY_PYTHON_MATH_CONSTANT_PI_TOOLTIP,e:W.Msg.MIXLY_PYTHON_MATH_CONSTANT_E_TOOLTIP}[e]}))}},Ft={init:function(){this.setColour(Dt);this.appendDummyInput("").appendField(W.Msg.MIXLY_PYTHON_MATH_CONSTANT).appendField(new W.FieldDropdown([["π","pi"],["e","e"]]),"CONSTANT"),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("CONSTANT");return{pi:W.Msg.MIXLY_PYTHON_MATH_CONSTANT_PI_MP_TOOLTIP,e:W.Msg.MIXLY_PYTHON_MATH_CONSTANT_E_MP_TOOLTIP}[e]}))}},vt={init:function(){this.setColour(Dt),this.setOutput(!0),this.appendValueInput("A"),this.appendValueInput("B").appendField(new W.FieldDropdown([["+","ADD"],["-","MINUS"],["×","MULTIPLY"],["÷","DIVIDE"],["%","QUYU"],["//","ZHENGCHU"],["**","POWER"]]),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{ADD:W.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:W.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:W.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:W.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,QUYU:W.Msg.MATH_MODULO_TOOLTIP,ZHENGCHU:W.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:W.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[e]}))}},Yt={init:function(){this.setColour(Dt),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendValueInput("A"),this.appendValueInput("B").appendField(new W.FieldDropdown([["+=","ADD"],["-=","MINUS"],["×=","MULTIPLY"],["÷=","DIVIDE"],["%=","QUYU"],["//=","ZHENGCHU"],["**=","POWER"]]),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{ADD:W.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:W.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:W.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:W.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,QUYU:W.Msg.MATH_MODULO_TOOLTIP,ZHENGCHU:W.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:W.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[e]}))}},bt={init:function(){this.setColour(Dt),this.setOutput(!0,Number),this.appendValueInput("A").setCheck(Number),this.appendValueInput("B").setCheck(Number).appendField(new W.FieldDropdown([["&","&"],["|","|"],[">>",">>"],["<<","<<"]]),"OP"),this.setInputsInline(!0),this.setTooltip("位运算")}},Vt={init:function(){this.setColour(Dt),this.setOutput(!0,Number),this.appendValueInput("NUM").setCheck(Number).appendField(new W.FieldDropdown([["sin","SIN"],["cos","COS"],["tan","TAN"],["asin","ASIN"],["acos","ACOS"],["atan","ATAN"],["-","-"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]),"OP");var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{SIN:W.Msg.MATH_TRIG_TOOLTIP_SIN,COS:W.Msg.MATH_TRIG_TOOLTIP_COS,TAN:W.Msg.MATH_TRIG_TOOLTIP_TAN,ASIN:W.Msg.MATH_TRIG_TOOLTIP_ASIN,ACOS:W.Msg.MATH_TRIG_TOOLTIP_ACOS,ATAN:W.Msg.MATH_TRIG_TOOLTIP_ATAN,LN:W.Msg.MATH_SINGLE_TOOLTIP_LN}[e]}))}},Xt={init:function(){var t=[[W.Msg.MATH_BIN,"bin"],[W.Msg.MATH_OCT,"oct"],[W.Msg.MATH_HEX,"hex"]];this.setColour(Dt),this.setOutput(!0,String),this.appendValueInput("NUM").setCheck(Number).appendField(new W.FieldDropdown(t),"OP");var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{bin:W.Msg.MATH_DEC_TOOLTIP_BIN,oct:W.Msg.MATH_DEC_TOOLTIP_OCT,hex:W.Msg.MATH_DEC_TOOLTIP_HEX}[t]}))}},yt={init:function(){var t=[[W.Msg.LANG_MATH_TO_ROUND,"round"],[W.Msg.LANG_MATH_TO_CEIL,"ceil"],[W.Msg.LANG_MATH_TO_FLOOR,"floor"],[W.Msg.MATH_ABS,"fabs"],[W.Msg.MATH_SQRT,"sqrt"]];this.setColour(Dt),this.appendValueInput("A").setCheck(Number).appendField(new W.FieldDropdown(t),"OP"),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{sqrt:W.Msg.MATH_SINGLE_TOOLTIP_ROOT,fabs:W.Msg.MATH_SINGLE_TOOLTIP_ABS,sq:W.Msg.MATH_SINGLE_TOOLTIP_SQ,round:W.Msg.MATH_SINGLE_TOOLTIP_ROUND,ceil:W.Msg.MATH_SINGLE_TOOLTIP_CEIL,floor:W.Msg.MATH_SINGLE_TOOLTIP_FLOOR}[t]}))}},Ut={init:function(){var t=[[W.Msg.MIXLY_MAX,"max"],[W.Msg.MIXLY_MIN,"min"]];this.setColour(Dt),this.appendValueInput("A").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(new W.FieldDropdown(t),"OP").appendField("("),this.appendValueInput("B").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(","),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField(")"),this.setInputsInline(!0),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{max:W.Msg.MIXLY_TOOLTIP_MATH_MAX,min:W.Msg.MIXLY_TOOLTIP_MATH_MIN}[t]}))}},Bt={init:function(){var t=[[W.Msg.MATH_TWO,"two"],[W.Msg.MATH_EIGHT,"eight"],[W.Msg.MATH_TEN,"ten"],[W.Msg.MATH_SIXTEEN,"sixteen"]];this.setColour(Dt),this.appendDummyInput("").appendField(W.Msg.MATH_BA),this.appendValueInput("NUM").appendField(new W.FieldDropdown(t),"OP").appendField(W.Msg.MATH_JinZhi).setCheck(Number),this.appendDummyInput("").appendField(W.Msg.MATH_ZHW).appendField(new W.FieldDropdown(t),"OP2").appendField(W.Msg.MATH_JinZhi),this.setFieldValue("ten","OP2"),this.setOutput(!0),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP"),i={two:W.Msg.MATH_Before_two,eight:W.Msg.MATH_Before_eight,ten:W.Msg.MATH_Before_ten,sixteen:W.Msg.MATH_Before_sixteen},n=e.getFieldValue("OP2"),s={two:W.Msg.MATH_Behind_two,eight:W.Msg.MATH_Behind_eight,ten:W.Msg.MATH_Behind_ten,sixteen:W.Msg.MATH_Behind_sixteen};return i[t]+s[n]}))}},Gt={init:function(){var t=[[W.Msg.LANG_MATH_INT,"int"],[W.Msg.LANG_MATH_FLOAT,"float"]];this.setColour(Dt),this.setOutput(!0,Number),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_RANDOM).appendField(new W.FieldDropdown(t),"TYPE"),this.appendValueInput("FROM").setCheck(Number).appendField(W.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.LANG_MATH_RANDOM_INT_INPUT_TO),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("TYPE"),i={int:W.Msg.LANG_MATH_INT,float:W.Msg.LANG_MATH_FLOAT_RANDOM};return W.Msg.MATH_RANDOM_INT_TOOLTIP+i[t]}))}},wt={init:function(){this.setColour(Dt),this.setOutput(!0,Number),this.appendValueInput("VALUE").setCheck(Number).appendField(W.Msg.LANG_MATH_CONSTRAIN_INPUT_CONSTRAIN),this.appendValueInput("LOW").setCheck(Number).appendField(W.Msg.LANG_MATH_CONSTRAIN_INPUT_LOW),this.appendValueInput("HIGH").setCheck(Number).appendField(W.Msg.LANG_MATH_CONSTRAIN_INPUT_HIGH),this.setInputsInline(!0),this.setTooltip(W.Msg.MATH_CONSTRAIN_TOOLTIP)}},kt={init:function(){this.setColour(Dt),this.appendValueInput("NUM",Number).appendField(W.Msg.MIXLY_MAP).setCheck(Number),this.appendValueInput("fromLow",Number).appendField(W.Msg.MIXLY_MAP_FROM).setCheck(Number),this.appendValueInput("fromHigh",Number).appendField(",").setCheck(Number),this.appendValueInput("toLow",Number).appendField(W.Msg.MIXLY_MAP_TO).setCheck(Number),this.appendValueInput("toHigh",Number).appendField(",").setCheck(Number),this.appendDummyInput("").appendField("]"),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_MATH_MAP)}},Ht={init:function(){this.setColour(Dt),this.appendDummyInput().appendField(new W.FieldTextInput("0",W.FieldTextInput.math_number_validator_include_blank),"NUM"),this.setOutput(!0),this.setTooltip(W.Msg.MATH_NUMBER_TOOLTIP)}},xt={init:function(){this.setColour(Dt),this.appendValueInput("NUM").setCheck(Number).appendField(W.Msg.LANG_MATH_RANDOM_SEED),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_MATH_RANDOM_SEED)}},Wt={init:function(){this.setColour(Dt),this.setOutput(!0,Number),this.appendValueInput("VALUE").setCheck(Number),this.appendValueInput("VAR").setCheck(Number).appendField(W.Msg.MATH_ROUND).appendField(W.Msg.TEXT_KEEP),this.appendDummyInput().appendField(W.Msg.TEXT_DECIMAL),this.setInputsInline(!0),this.setTooltip(W.Msg.MATH_ROUND_NEW_TOOLTIP)}},Kt={init:function(){var t=[[W.Msg.MIXLY_TO_INT,"int"],[W.Msg.MIXLY_TO_FLOAT,"float"],[W.Msg.MIXLY_TO_BITES,"b"]];this.setColour(Dt),this.appendValueInput("VAR").appendField(new W.FieldDropdown(t),"TOWHAT"),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("TOWHAT");return{int:W.Msg.MIXLY_PYTHON_TOOLTIP_TOINT,float:W.Msg.MIXLY_PYTHON_TOOLTIP_TOFLOAT,b:W.Msg.MIXLY_TOOLTIP_TEXT_TOBYTE}[t]}))}},Jt={init:function(){var t=[[W.Msg.MIXLY_TO_INT,"int"],[W.Msg.MIXLY_TO_FLOAT,"float"]];this.setColour(Dt),this.appendValueInput("VAR").appendField(new W.FieldDropdown(t),"TOWHAT"),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("TOWHAT");return{int:W.Msg.MIXLY_TOOLTIP_TEXT_TOINT,float:W.Msg.MIXLY_TOOLTIP_TEXT_TOFLOAT}[t]}))}},jt=kt,Qt=160,qt={init:function(){this.setColour(Qt),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new W.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(W.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(t){if(t==this.RTL)var e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new W.FieldImage(e,12,12,'"')}},zt={init:function(){this.setColour(Qt),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new W.FieldMultilineInput("Hello\nMixly"),"VALUE").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(W.Msg.TEXT_LINES_TOOLTIP)},newQuote_:function(t){if(t==this.RTL)var e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new W.FieldImage(e,12,12,'"')}};W.FieldTextInput.char_validator=function(t){if(t.length>1&&"\\"===t.charAt(0)){var e=t.charAt(1);if("0"===e||"b"===e||"f"===e||"n"===e||"r"===e||"t"===e||"\\"===e||"'"===e)return String(t).substring(0,2);if("x"===e&&"0"===t.charAt(2)&&"B"===t.charAt(3))return String(t).substring(0,4)}return String(t).substring(0,1)};const Zt={init:function(){this.setColour(Qt),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new W.FieldTextInput("",W.FieldTextInput.char_validator),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,Number),this.setTooltip(W.Msg.TEXT_CHAR_TOOLTIP)},newQuote_:function(t){if(1==t)var e="../../media/quote2.png";else e="../../media/quote3.png";return new W.FieldImage(e,7,12,'"')}},$t={init:function(){this.setColour(Qt),this.appendValueInput("A").setCheck([String,Number]),this.appendValueInput("B").setCheck([String,Number]).appendField(W.Msg.MIXLY_TEXT_JOIN),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_TOOLTIP_TEXT_JOIN)}},te={init:function(){this.setColour(Qt),this.appendValueInput("VAR").setCheck(Number).appendField(W.Msg.MIXLY_TOCHAR),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_TOOLTIP_TEXT_TOCHAR)}},ee={init:function(){this.setColour(Qt),this.appendValueInput("VAR").setCheck(String).appendField(W.Msg.MIXLY_TOASCII),this.setOutput(!0,Number),this.setTooltip(W.Msg.MIXLY_TOOLTIP_TEXT_TOASCII)}},ie={init:function(){this.setColour(Qt),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_TOSTRING),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_PYTHON_TOOLTIP_TOTEXT)}},ne={init:function(){this.setColour(Qt),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_LENGTH),this.setOutput(!0,Number),this.setTooltip(W.Msg.MIXLY_TOOLTIP_TEXT_LENGTH)}},se={init:function(){this.WHERE_OPTIONS=[[W.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[W.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[W.Msg.TEXT_GET_INDEX_RANDOM+1+W.Msg.TEXT_CHARAT2,"RANDOM"]],this.setHelpUrl(W.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(Qt),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT").setCheck(Number),this.appendDummyInput().appendField(W.Msg.LISTS_GET_INDEX_GET,"MODE"),W.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(W.Msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE"),i=t.getFieldValue("WHERE"),n="";switch(e+" "+i){case"GET FROM_START":case"GET FROM_END":n=W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET RANDOM":n=W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":n=W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE RANDOM":n=W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM}return"FROM_START"!=i&&"FROM_END"!=i||(n+=" "+W.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",W.Msg.ONE_BASED_INDEXING?"#1":"#0")),n}));var e=this;this.setTooltip((function(){var t=e.getFieldValue("WHERE"),i={FROM_START:W.Msg.LISTS_GET_INDEX_FROM_START,FROM_END:W.Msg.LISTS_GET_INDEX_FROM_END,RANDOM:W.Msg.TEXT_GET_INDEX_RANDOM};return W.Msg.PROCEDURES_DEFRETURN_RETURN+W.Msg.MIXLY_MICROBIT_TYPE_STRING+i[t]+"n"+W.Msg.TEXT_CHARAT2}))},mutationToDom:function(){var t=document.createElement("mutation");t.setAttribute("statement",!this.outputConnection);var e=this.getInput("AT").type==W.INPUT_VALUE;return t.setAttribute("at",e),t},domToMutation:function(t){var e="true"==t.getAttribute("statement");this.updateStatement_(e),t="false"!=t.getAttribute("at"),this.updateAt_(t)},updateStatement_:function(t){t!=!this.outputConnection&&(this.unplug(!0,!0),t?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(t){this.removeInput("AT"),this.removeInput("ORDINAL",!0),t?(this.appendValueInput("AT").setCheck(Number),W.Msg.TEXT_CHARAT2&&this.appendDummyInput("ORDINAL").appendField(W.Msg.TEXT_CHARAT2)):this.appendDummyInput("AT");var e=new W.FieldDropdown(this.WHERE_OPTIONS,(function(e){var i="FROM_START"==e||"FROM_END"==e;if(i!=t){var n=this.sourceBlock_;return n.updateAt_(i),n.setFieldValue(e,"WHERE"),null}}));this.getInput("AT").appendField(e,"WHERE"),W.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},oe={init:function(){this.setHelpUrl(W.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(Qt),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT").setCheck(Number).appendField(W.Msg.LISTS_GET_INDEX_GET+" "+W.Msg.LISTS_GET_INDEX_FROM_START),this.appendDummyInput().appendField(W.Msg.TEXT_CHARAT2),this.setOutput(!0),this.setTooltip(W.Msg.PROCEDURES_DEFRETURN_RETURN+W.Msg.MIXLY_MICROBIT_TYPE_STRING+W.Msg.LISTS_GET_INDEX_FROM_START+"n"+W.Msg.TEXT_CHARAT2)}},_e={init:function(){this.setHelpUrl(W.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(Qt),this.appendValueInput("VAR").setCheck(String),this.appendDummyInput().appendField(W.Msg.TEXT_RANDOM_CHAR),this.setOutput(!0),this.setTooltip(W.Msg.TEXT_RANDOM_CHAR_TOOLTIP)}},ue={init:function(){this.WHERE_OPTIONS_1=[[W.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[W.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[W.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[W.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[W.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[W.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(W.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Qt),this.appendValueInput("VAR").setCheck(String),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),this.setInputsInline(!0),this.setOutput(!0,"List"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(W.Msg._GET_TEXT_SUBLIST_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation"),e=this.getInput("AT1").type==W.INPUT_VALUE;t.setAttribute("at1",e);var i=this.getInput("AT2").type==W.INPUT_VALUE;return t.setAttribute("at2",i),t},domToMutation:function(t){var e="true"==t.getAttribute("at1"),i="true"==t.getAttribute("at2");this.updateAt_(1,e),this.updateAt_(2,i)},updateAt_:function(t,e){this.removeInput("AT"+t),this.removeInput("ORDINAL"+t,!0),e?(this.appendValueInput("AT"+t).setCheck(Number),W.Msg.TEXT_CHARAT2&&this.appendDummyInput("ORDINAL"+t).appendField(W.Msg.TEXT_CHARAT2)):this.appendDummyInput("AT"+t);var i=new W.FieldDropdown(this["WHERE_OPTIONS_"+t],(function(i){var n="FROM_START"==i||"FROM_END"==i;if(n!=e){var s=this.sourceBlock_;return s.updateAt_(t,n),s.setFieldValue(i,"WHERE"+t),null}}));this.getInput("AT"+t).appendField(i,"WHERE"+t),1==t&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}},ae={init:function(){this.setHelpUrl(W.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Qt),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT1").appendField(W.Msg.LISTS_GET_INDEX_GET+" "+W.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(W.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(W.Msg.TEXT_CHARAT2),this.setInputsInline(!0),this.setOutput(!0,["List",String]),this.setTooltip(W.Msg._GET_TEXT_SUBLIST_TOOLTIP)}},re={init:function(){var t=[[W.Msg.MIXLY_EQUALS,"==="],[W.Msg.MIXLY_STARTSWITH,"startswith"],[W.Msg.MIXLY_ENDSWITH,"endswith"]];this.setColour(Qt),this.appendValueInput("STR1").setCheck(String),this.appendValueInput("STR2").appendField(new W.FieldDropdown(t),"DOWHAT").setCheck(String),this.setOutput(!0,[Boolean,Number]),this.setInputsInline(!0)}},pe={init:function(){this.setColour(Qt),this.appendValueInput("STR1").setCheck(String),this.appendValueInput("STR2").appendField(W.Msg.MIXLY_COMPARETO).setCheck(String),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_COMPARETO_HELP)}},le={init:function(){var t=[[W.Msg.TEXT_UPPER,"upper"],[W.Msg.TEXT_TITLE,"title"],[W.Msg.TEXT_CAPITALIZE,"capitalize"],[W.Msg.TEXT_SWAPCASE,"swapcase"],[W.Msg.TEXT_LOWER,"lower"]];this.setColour(Qt),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new W.FieldDropdown(t),"CAPITAL").setCheck(String),this.setOutput(!0,String);var e=this;this.setTooltip((function(){var t=e.getFieldValue("CAPITAL");return{upper:W.Msg.MIXLY_MIXPY_TEXT_UPPER_TOOLTIP,title:W.Msg.MIXLY_MIXPY_TEXT_TITLE_TOOLTIP,swapcase:W.Msg.MIXLY_MIXPY_TEXT_SWAPCASE_TOOLTIP,capitalize:W.Msg.MIXLY_MIXPY_TEXT_CAPITALIZE_TOOLTIP,lower:W.Msg.MIXLY_MIXPY_TEXT_LOWER_TOOLTIP}[t]}))}},Ie={init:function(){var t=[[W.Msg.TEXT_LJUST,"ljust"],[W.Msg.TEXT_CENTER,"center"],[W.Msg.TEXT_RJUST,"rjust"]];this.setColour(Qt),this.appendValueInput("VAR").appendField(new W.FieldDropdown(t),"CENTER").setCheck(String),this.appendValueInput("WID").appendField(W.Msg.MIXLY_WIDTH).setCheck(Number),this.appendValueInput("Symbol").appendField(W.Msg.MIXLY_RECT_Fill).setCheck(String),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_MIXPY_TEXT_CENTER_TOOLTIP)}},Te={init:function(){this.setColour(Qt),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).setCheck(String),this.appendValueInput("STR").appendField(W.Msg.MIXLY_MID+W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER).setCheck(String),this.appendDummyInput().appendField(W.Msg.MIXLY_LIST_INDEX),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_MIXPY_TEXT_FIND_TOOLTIP)}},de={init:function(){this.setColour(Qt),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_USE_STR).setCheck(String),this.appendValueInput("LIST").appendField(W.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_SEQ).setCheck("List","Tuple","Set","Dict"),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_GET_STR),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_TOOLTIP)}},he={init:function(){this.setColour(Qt),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("STR1").appendField(W.Msg.MIXLY_MIXPY_REPLACE).setCheck(String),this.appendValueInput("STR2").appendField(W.Msg.LISTS_SET_INDEX_INPUT_TO).setCheck(String),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_MIXPY_TEXT_REPLACE_TOOLTIP)}},Me={init:function(){this.setColour(Qt),this.appendValueInput("VAR"),this.appendValueInput("VAL").appendField(W.Msg.LIST_SPLIT_AS),this.appendDummyInput("").appendField(W.Msg.LIST_SPLIT),this.setOutput(!0,"List"),this.setTooltip(W.Msg.MIXLY_MIXPY_TEXT_SPLIT_TOOLTIP),this.setInputsInline(!0)}},me={init:function(){var t=[[W.Msg.TEXT_TRIM_BOTH,"strip"],[W.Msg.TEXT_TRIM_LEFT,"lstrip"],[W.Msg.TEXT_TRIM_RIGHT,"rstrip"]];this.setColour(Qt),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(W.Msg.TEXT_STRIM),this.appendDummyInput("").appendField(new W.FieldDropdown(t),"TOWHAT"),this.appendDummyInput("").appendField(W.Msg.TEXT_BLANK),this.setOutput(!0,String),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("TOWHAT");return{strip:W.Msg.TEXT_TRIM_BOTH_TOOLTIP,lstrip:W.Msg.TEXT_TRIM_LEFT_TOOLTIP,rstrip:W.Msg.TEXT_TRIM_RIGHT_TOOLTIP}[t]}))}},ce={init:function(){this.setColour(Qt),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROPYTHON_FORMAT),this.appendDummyInput("").appendField(new W.FieldTextInput("str"),"VAR"),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new W.icons.MutatorIcon(["text_create_with_item"],this)),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_MIXPY_TEXT_FORMAT_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("text_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("text_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField();else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.PROCEDURES_BEFORE_PARAMS)}},getVars:function(){if(null!=this.getFieldValue("VAR"))return-1==this.getFieldValue("VAR").indexOf("'")&&-1==this.getFieldValue("VAR").indexOf('"')?[this.getFieldValue("VAR")]:[]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Oe={init:function(){this.setColour(Qt),this.appendDummyInput().appendField(W.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.setTooltip(W.Msg.TUPLE_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Ee={init:function(){this.setColour(Qt),this.appendDummyInput().appendField(W.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.TUPLE_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Re=ae,ge=pe,Ce=oe,Ae={init:function(){this.setColour(Qt),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROPYTHON_FORMAT),this.appendValueInput("VAR").setCheck(String),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new W.icons.MutatorIcon(["text_create_with_item"],this)),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_MIXPY_TEXT_FORMAT_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("text_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("text_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField();else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.PROCEDURES_BEFORE_PARAMS)}}},Le={init:function(){this.setColour(Qt);var t=[[W.Msg.MIXPY_TEXT_ENCODE,"encode"],[W.Msg.MIXPY_TEXT_DECODE,"decode"]];this.appendDummyInput().appendField(new W.FieldDropdown([["ASCII","ASCII"],["gb2312","gb2312"],["gbk","gbk"],["utf-8","utf-8"],["utf-16","utf-16"],["utf-32","utf-32"]]),"CODE").appendField(" "),this.appendValueInput("VAR").appendField(new W.FieldDropdown(t),"DIR").appendField(W.Msg.LANG_MATH_STRING),this.setOutput(!0,String),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXPY_TEXT_ENCODE_DECODE_TOOLTIP)}},Se={init:function(){this.setColour(Qt),this.appendValueInput("VAR").setCheck(String).appendField(W.Msg.MIXLY_PYTHON_TEXT_EVAL),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_TEXT_EVAL_RESULT),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_TEXT_EVAL_TOOLTIP)}},Ne={init:function(){this.setColour(Qt),this.appendValueInput("VAR").setCheck(String).appendField(W.Msg.MIXLY_PYTHON_OS_SYSTEM),this.setInputsInline(!0),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_OS_SYSTEM_TOOLTIP)}},De=260,fe={init:function(){this.setHelpUrl(W.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(De),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+W.Msg.LISTS_GET_INDEX_FROM_START),this.appendDummyInput().appendField(W.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM)}},Pe={init:function(){this.setHelpUrl(W.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(De),this.appendValueInput("LIST"),this.appendDummyInput(""),this.appendValueInput("AT1").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+W.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(W.Msg.TEXT_CHARAT_TAIL+" "+W.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(W.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0,"List"),this.setTooltip(W.Msg.PYTHON_LISTS_GET_SUBLIST_TOOLTIP)}},Fe={init:function(){this.appendValueInput("LIST").setCheck(null),this.appendValueInput("row").setCheck(null).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+W.Msg.DATAFRAME_RAW),this.appendValueInput("col").setCheck(null).appendField(W.Msg.DATAFRAME_COLUMN),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(De),this.setTooltip(""),this.setHelpUrl("")}},ve={init:function(){this.appendValueInput("LIST").setCheck(null),this.appendValueInput("row_start").setCheck(null).appendField(W.Msg.MIXLY_GET+" "+W.Msg.DATAFRAME_RAW+" ["),this.appendValueInput("row_end").setCheck(null).appendField(","),this.appendValueInput("col_start").setCheck(null).appendField(") "+W.Msg.DATAFRAME_COLUMN+" ["),this.appendValueInput("col_end").setCheck(null).appendField(","),this.appendDummyInput().appendField(") "+W.Msg.DICTS_ADD_VALUE),this.setInputsInline(!0),this.setOutput(!0,"List"),this.setColour(De),this.setTooltip(""),this.setHelpUrl("")}},Ye={init:function(){this.setColour(De),this.appendDummyInput("").appendField(new W.FieldTextInput("mylist"),"VAR").appendField("[").appendField("]"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["lists_create_with_item"],this)),this.setTooltip(W.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("lists_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("lists_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(W.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},be={init:function(){this.setColour(De),this.appendDummyInput("").appendField(new W.FieldTextInput("mylist"),"VAR").appendField(" = [").appendField(new W.FieldTextInput("0,0,0"),"TEXT").appendField("]"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_LISTS_CREATE_WITH_TEXT2)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Ve={init:function(){this.setColour(De),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_TYPE_LIST),this.appendStatementInput("STACK"),this.setTooltip(W.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Xe={init:function(){this.setColour(De),this.appendDummyInput().appendField(W.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},ye={init:function(){this.setColour(De),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_LIST_ASSIGN_AT),this.appendValueInput("TO").appendField(W.Msg.MIXLY_MICROBIT_JS_LIST_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.LANG_LISTS_SET_INDEX_TOOLTIP)}},Ue={init:function(){this.setColour(De),this.TYPE=[[W.Msg.MIXLY_blockpy_set_add,"append"],[W.Msg.MIXLY_MICROBIT_LIST_EXTEND,"extend"]],this.appendValueInput("LIST").setCheck("List"),this.appendValueInput("DATA").appendField(new W.FieldDropdown(this.TYPE),"OP").appendField(W.Msg.MIXLY_MICROBIT_LIST_A_ITEM),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_JS_LIST_TO_END),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{append:W.Msg.MIXLY_TOOLTIP_LIST_APPEND,extend:W.Msg.LISTS_EXTEND_TOOLTIP}[e]}))}},Be={init:function(){this.setColour(De),this.appendValueInput("LIST"),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+W.Msg.LISTS_GET_INDEX_RANDOM),this.setTooltip(W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM),this.setOutput(!0)}},Ge={init:function(){this.setColour(De),this.appendValueInput("LIST"),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+W.Msg.MIXLY_MICROBIT_RANDOM),this.appendDummyInput().appendField(W.Msg.LANG_LISTS_GET_INDEX2+W.Msg.LISTS_GET_RANDOM_SUBLIST),this.setTooltip(W.Msg.LISTS_GET_RANDOM_SUBLIST_TOOLTIP),this.setOutput(!0,"List")}},we={init:function(){this.setColour(De),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_LIST_INSERT_AT),this.appendValueInput("VALUE").appendField(W.Msg.MIXLY_MICROBIT_JS_LIST_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.LANG_LISTS_SET_INDEX_TOOLTIP),this.setTooltip(W.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT)}},ke={init:function(){this.setColour(De),this.appendValueInput("VAR").setCheck("List"),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_LIST_REVERSE),this.setTooltip(W.Msg.LANG_LISTS_CLEAR_TOOLTIP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},He={init:function(){this.setColour(De),this.appendValueInput("VAR"),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROPYTHON_CLEAR),this.setTooltip(W.Msg.LANG_LISTS_REVERSE_TOOLTIP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},xe={init:function(){this.setColour(De),this.TYPE=[[W.Msg.SERIES_INDEX,"del"],[W.Msg.MIXLY_MICROBIT_JS_I2C_VALUE,"remove"]],this.appendValueInput("LIST").setCheck("List"),this.appendValueInput("DATA").appendField(W.Msg.MIXLY_MIXPY_LISTS_REMOVE).appendField(new W.FieldDropdown(this.TYPE),"OP"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{del:W.Msg.LISTS_SET_INDEX_TOOLTIP_DELETE,remove:W.Msg.MIXLY_TOOLTIP_LIST_REMOVE}[e]}))}},We={init:function(){this.setColour(De),this.appendValueInput("LIST"),this.appendValueInput("VALUE").appendField(W.Msg.MIXLY_MICROBIT_LIST_POP),this.appendDummyInput().appendField(W.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM)}},Ke={init:function(){var t=[[W.Msg.MIXLY_LIST_INDEX,"INDEX"],[W.Msg.MIXLY_LIST_COUNT,"COUNT"]];this.setColour(De),this.appendValueInput("VAR").setCheck("List"),this.appendValueInput("data").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(W.Msg.HTML_VALUE),this.appendDummyInput().appendField(W.Msg.MIXLY_DE).appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{INDEX:W.Msg.MIXLY_TOOLTIP_LIST_FIND_INDEX,COUNT:W.Msg.MIXLY_TOOLTIP_LIST_FIND_COUNT}[t]}))}},Je={init:function(){var t=[[W.Msg.MIXLY_LIST_LEN,"LEN"],[W.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[W.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[W.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[W.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[W.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[W.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[W.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"]];this.setColour(De),this.setOutput(!0,Number),this.appendValueInput("data"),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{LEN:W.Msg.LISTS_LENGTH_TOOLTIP,SUM:W.Msg.MATH_ONLIST_TOOLTIP_SUM,MAX:W.Msg.MATH_ONLIST_TOOLTIP_MAX,MIN:W.Msg.MATH_ONLIST_TOOLTIP_MIN,AVERAGE:W.Msg.MATH_ONLIST_TOOLTIP_AVERAGE,MEDIAN:W.Msg.MATH_ONLIST_TOOLTIP_MEDIAN,MODE:W.Msg.MATH_ONLIST_TOOLTIP_MODE,STD_DEV:W.Msg.MATH_ONLIST_TOOLTIP_STD_DEV}[t]}))}},je={init:function(){this.jsonInit({args0:[{type:"input_value",name:"LIST",check:"List"},{type:"field_dropdown",name:"TYPE",options:[[W.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[W.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[W.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[W.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[W.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]}],message0:W.Msg.LISTS_SORT_TITLE,inputsInline:!0,output:"List",colour:De,tooltip:W.Msg.LISTS_SORT_TOOLTIP,helpUrl:W.Msg.LISTS_SORT_HELPURL})}},Qe={init:function(){var t=[[W.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[W.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD,"array"]];this.setColour(De),this.appendValueInput("VAR").setCheck("List"),this.appendDummyInput("").appendField(W.Msg.A_TO_B).appendField(new W.FieldDropdown(t),"OP");var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{tuple:W.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_TUPLE,set:W.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_SET,array:W.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_ARRAY}[t]})),this.setInputsInline(!0),this.setOutput(!0)}},qe={init:function(){this.setColour(De),this.appendDummyInput("").appendField("[").appendField(new W.FieldTextInput("0,0,0"),"CONTENT").appendField("]"),this.setInputsInline(!0),this.setOutput(!0)}},ze={init:function(){this.setColour(De),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setMutator(new W.icons.MutatorIcon(["lists_create_with_item"],this)),this.setTooltip(W.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("lists_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("lists_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(W.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Ze={init:function(){var t=[[W.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[W.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"]];this.setColour(De),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(W.Msg.A_TO_B).appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0),this.setOutput(!0)}},$e={init:function(){this.setColour(De),this.appendValueInput("TUP"),this.appendDummyInput("").appendField(W.Msg.OBJECT_DELETE),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ti={init:function(){this.setColour(De),this.itemCount_=2,this.updateShape_(),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setMutator(new W.icons.MutatorIcon(["lists_zip_item"],this)),this.setTooltip(W.Msg.MIXLY_PYTHON_LISTS_ZIP_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("lists_zip_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("lists_zip_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(W.Msg.MIXLY_PYTHON_LISTS_ZIP);else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.MIXLY_PYTHON_LISTS_ZIP)}}},ei={init:function(){this.setColour(De),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_LISTS_ZIP).appendField("[]"),this.appendStatementInput("STACK"),this.setTooltip(W.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_CONTAINER_TOOLTIP),this.contextMenu=!1}},ii={init:function(){this.setColour(De),this.appendDummyInput().appendField(W.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM_TOOLTIP),this.contextMenu=!1}},ni={init:function(){this.setColour(De),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_TOLIST),this.setOutput(!0,"List"),this.setTooltip(W.Msg.MIXLY_PYTHON_TOOLTIP_TOLIST)}},si=Ye,oi=be,_i=fe,ui=Pe,ai=ye,ri=we,pi=xe,li=ni,Ii=345,Ti={init:function(){this.setColour(Ii),this.appendDummyInput("").appendField(new W.FieldTextInput("mydict"),"VAR").appendField(new W.FieldLabel(W.Msg.DICTS_CREATE_WITH_INPUT_WITH),"TIP"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["dicts_create_with_item"],this)),this.setTooltip(W.Msg.DICTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("dicts_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("dicts_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var t=[],e=0;this.getInput("ADD"+e);e++)t.push(this.getFieldValue("KEY"+e)),this.removeInput("ADD"+e);if(0==this.itemCount_)this.getField("TIP").setValue(W.Msg.DICTS_CREATE_EMPTY_TITLE);else{this.getField("TIP").setValue(W.Msg.DICTS_CREATE_WITH_INPUT_WITH);for(e=0;e<this.itemCount_;e++)this.appendValueInput("ADD"+e).setCheck(null).setAlign(W.inputs.Align.RIGHT).appendField(new W.FieldTextInput(t.length>e?t[e]:0==e?'"key"':'"key'+(e+1)+'"'),"KEY"+e).appendField(":")}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},di={init:function(){this.setColour(Ii),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_TYPE_DICT),this.appendStatementInput("STACK"),this.setTooltip(W.Msg.DICTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},hi={init:function(){this.setColour(Ii),this.appendDummyInput().appendField(W.Msg.DICTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.DICTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Mi={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.DICT_KEYS),this.setTooltip(W.Msg.DICTS_KEYS_TOOLTIP),this.setOutput(!0,"List")}},mi={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(W.Msg.DICTS_GET_IN),this.appendDummyInput("").appendField(W.Msg.DICTS_ADD_VALUE),this.setOutput(!0),this.setTooltip(W.Msg.DICTS_GET_TOOLTIP)}},ci={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(W.Msg.DICTS_GET_IN),this.appendDummyInput("").appendField(W.Msg.DICTS_ADD_VALUE),this.appendValueInput("VAR").appendField(W.Msg.DICTS_DEFAULT_VALUE),this.setOutput(!0),this.setTooltip(W.Msg.DICTS_GET_DEFAULT_TOOLTIP)}},Oi={init:function(){this.setColour(Ii),this.appendValueInput("DICT"),this.appendValueInput("KEY").appendField(W.Msg.DICTS_ADD),this.appendDummyInput(),this.appendValueInput("VAR").appendField(W.Msg.DICTS_ADD_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.DICTS_ADD_OR_CHANGE_TOOLTIP)}},Ei={init:function(){this.setColour(Ii),this.appendValueInput("DICT"),this.appendValueInput("KEY").appendField(W.Msg.DICTS_DELETE_IN),this.appendDummyInput("").appendField(W.Msg.DICTS_DELETE_VALUE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.DICTS_DELETE_TOOLTIP)}},Ri={init:function(){this.setColour(Ii),this.appendValueInput("DICT2").setCheck("Dict").appendField(W.Msg.MAKE_DICT),this.appendValueInput("DICT").setCheck("Dict").appendField(W.Msg.DICT_UPDATE),this.appendDummyInput("").appendField(W.Msg.MIXLY_MID),this.setTooltip(W.Msg.DICTS_UPDATE_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},gi={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.DICT_CLEAR),this.setTooltip(W.Msg.DICTS_CLEAR_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ci={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.DICT_ITEMS),this.setTooltip(W.Msg.DICTS_ITEMS_TOOLTIP),this.setOutput(!0,"List")}},Ai={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.DICT_VALUES),this.setTooltip(W.Msg.DICTS_VALUES_TOOLTIP),this.setOutput(!0,"List")}},Li={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.MIXLY_LENGTH),this.setTooltip(W.Msg.DICT_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},Si={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.DICT_DELDICT),this.setTooltip(W.Msg.DICTS_DEL_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ni={init:function(){this.MODE=[[W.Msg.DICTS_ADD_OR_CHANGE,"INSERT"],[W.Msg.MIXLY_MICROBIT_JS_DELETE_VAR,"DELETE"]],this.setHelpUrl(W.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("AT2"),this.appendValueInput("KEY"),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE).appendField(W.Msg.DICTS_ADD_VALUE),this.updateAt_(!0),this.setInputsInline(!0),this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e="";switch(t.getFieldValue("WHERE")){case"INSERT":e=W.Msg.DICTS_ADD_TOOLTIP;break;case"DELETE":e=W.Msg.DICTS_DELETE_TOOLTIP}return e}))},mutationToDom:function(){var t=document.createElement("mutation"),e=this.getInput("AT2").type==W.INPUT_VALUE;return t.setAttribute("at2",e),t},domToMutation:function(t){var e="true"==t.getAttribute("at2");this.updateAt_(e)},updateAt_:function(t){this.removeInput("AT2"),this.removeInput("ORDINAL",!0),t?this.appendValueInput("AT2").setCheck(Number):this.appendDummyInput("AT2");var e=new W.FieldDropdown(this.MODE,(function(e){var i="INSERT"==e;if(i!=t){var n=this.sourceBlock_;return n.updateAt_(i),n.setFieldValue(e,"WHERE"),null}}));this.getInput("AT2").appendField(e,"WHERE")}},Di={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.blockpy_DICT_POP),this.appendValueInput("KEY"),this.appendDummyInput("").appendField(W.Msg.DICTS_ADD_VALUE),this.setTooltip(W.Msg.DICT_POP_TOOLTIP),this.setInputsInline(!0),this.setOutput(!0)}},fi={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(W.Msg.DICTS_SET_DEFAULT),this.appendDummyInput("").appendField(W.Msg.DICTS_DEFAULT_VALUE),this.appendValueInput("VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.DICTS_SETDEFAULT_TOOLTIP)}},Pi={init:function(){this.setColour(Ii),this.appendDummyInput("").appendField(new W.FieldLabel(W.Msg.MIXLY_MICROBIT_TYPE_DICT),"TIP").appendField(" "),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Dict"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setMutator(new W.icons.MutatorIcon(["dicts_create_with_item"],this)),this.setTooltip(W.Msg.DICTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("dicts_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("dicts_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var t=[],e=0;this.getInput("ADD"+e);e++)t.push(this.getFieldValue("KEY"+e)),this.removeInput("ADD"+e);if(0==this.itemCount_)this.getField("TIP").setValue(W.Msg.LOGIC_NULL+W.Msg.MIXLY_MICROBIT_TYPE_DICT);else{this.getField("TIP").setValue(W.Msg.MIXLY_MICROBIT_TYPE_DICT);for(e=0;e<this.itemCount_;e++)this.appendValueInput("ADD"+e).setCheck(null).setAlign(W.inputs.Align.RIGHT).appendField(new W.FieldTextInput(t.length>e?t[e]:0==e?'"key"':'"key'+(e+1)+'"'),"KEY"+e).appendField(":")}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Fi={init:function(){this.setColour(Ii),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_TODICT),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_TOOLTIP_TODICT)}},vi={init:function(){this.setColour(Ii),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(W.Msg.MIXLY_TO_JSON),this.setTooltip(W.Msg.MIXLY_TO_JSON_TOOLTIP),this.setOutput(!0,Number)}},Yi={init:function(){this.setColour(Ii),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(W.Msg.MIXLY_CONVERT_TO_JSON),this.setTooltip(W.Msg.MIXLY_CONVERT_TO_JSON_TOOLTIP),this.setOutput(!0,Number)}},bi=210,Vi={init:function(){var t=W.RTL?[["=","EQ"],["≠","NEQ"],[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]];this.setColour(bi),this.setOutput(!0,Boolean),this.appendValueInput("A"),this.appendValueInput("B").appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{EQ:W.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:W.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:W.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:W.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:W.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:W.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[t]})),this.prevBlocks_=[null,null]}},Xi={init:function(){var t=W.RTL?[[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]],e=W.RTL?[[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]];this.setColour(bi),this.setOutput(!0,Boolean),this.appendValueInput("A"),this.appendValueInput("B").appendField(new W.FieldDropdown(t),"OP1"),this.appendValueInput("C").appendField(new W.FieldDropdown(e),"OP2"),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_LOGIC_COMPARE_CONTINOUS_TOOLTIP)}},yi={init:function(){var t=[[W.Msg.LOGIC_OPERATION_AND,"AND"],[W.Msg.LOGIC_OPERATION_OR,"OR"],[W.Msg.LOGIC_OPERATION_NOR,"NOR"],[W.Msg.LOGIC_OPERATION_XOR,"XOR"]];this.setColour(bi),this.setOutput(!0,Boolean),this.appendValueInput("A").setCheck([Boolean,Number]),this.appendValueInput("B").setCheck([Boolean,Number]).appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{AND:W.Msg.LOGIC_OPERATION_TOOLTIP_AND,OR:W.Msg.LOGIC_OPERATION_TOOLTIP_OR,NOR:W.Msg.LOGIC_OPERATION_TOOLTIP_NOR,XOR:W.Msg.LOGIC_OPERATION_TOOLTIP_XOR}[t]}))}},Ui={init:function(){this.setColour(bi),this.setOutput(!0,Boolean),this.appendValueInput("BOOL").setCheck([Number,Boolean]).appendField(W.Msg.LOGIC_NEGATE_TITLE),this.setTooltip(W.Msg.LOGIC_NEGATE_TOOLTIP)}},Bi={init:function(){var t=[[W.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[W.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setColour(bi),this.setOutput(!0,Boolean),this.appendDummyInput().appendField(new W.FieldDropdown(t),"BOOL"),this.setTooltip(W.Msg.LOGIC_BOOLEAN_TOOLTIP)}},Gi={init:function(){this.setColour(bi),this.setOutput(!0),this.appendDummyInput().appendField(W.Msg.LOGIC_NULL),this.setTooltip(W.Msg.LOGIC_NULL_TOOLTIP)}},wi={init:function(){this.setColour(bi),this.appendValueInput("A"),this.appendValueInput("B").appendField(W.Msg.LOGIC_TERNARY_IF_TRUE),this.appendValueInput("C").appendField(W.Msg.LOGIC_TERNARY_IF_FALSE),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_LOGIT_TRUEORFALSE)}},ki={init:function(){var t=[[W.Msg.TEXT_APPEND_TO,"in"],[W.Msg.MIXLY_PYTHON_LOGIC_IS_NOT_IN,"not in"]];this.setColour(bi),this.appendValueInput("A"),this.appendValueInput("B").setCheck([String,"List"]).appendField(new W.FieldDropdown(t),"BOOL"),this.appendDummyInput("").appendField(W.Msg.MICROBIT_LOGIC_IS_IN),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(W.Msg.IN)}},Hi={init:function(){var t=[[W.Msg.MIXLY_PYTHON_LOGIC_IS,"is"],[W.Msg.MIXLY_PYTHON_LOGIC_IS_NOT,"is not"]];this.setColour(bi),this.appendValueInput("A"),this.appendValueInput("B").appendField(new W.FieldDropdown(t),"BOOL"),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_LOGIC_IS_TOOLTIP)}},xi={init:function(){this.setColour(bi),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_TOBOOL),this.setOutput(!0,Boolean),this.setTooltip(W.Msg.MIXLY_PYTHON_TOOLTIP_TOBOOL)}},Wi={init:function(){this.setColour(0),this.appendValueInput("fn").setCheck(String).appendField(W.Msg.MIXLY_PYTHON_STORAGE_OPEN_FILE_WITH_OS+"(For Windows)"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},Ki={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"]]),"MODE"),this.appendValueInput("FILE").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_AS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE"),i=W.Msg.MIXLY_USE,n=W.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,s=W.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,o=W.Msg.MIXLY_BELONG;return i+{r:W.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:W.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[e]+o+n+s}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Ji={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"]]),"MODE"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE"),i=W.Msg.MIXLY_USE,n=W.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,s=W.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,o=W.Msg.MIXLY_BELONG,_=W.Msg.PY_STORAGE_FILE_OBJECT;return i+{r:W.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:W.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[e]+o+n+s+_}))}},ji={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE);this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"]]),"MODE"),this.appendDummyInput().appendField(W.Msg.MIXPY_TEXT_ENCODE).appendField(new W.FieldDropdown([["ANSI","ANSI"],["gbk","gbk"],["utf-8","utf-8"]]),"CODE"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE"),i=W.Msg.MIXLY_USE,n=W.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,s=W.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,o=W.Msg.MIXLY_BELONG,_=W.Msg.PY_STORAGE_FILE_OBJECT;return i+{r:W.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:W.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:W.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[e]+o+n+s+_}))}},Qi={init:function(){this.setColour(0),this.appendValueInput("data").setCheck(String).appendField(W.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendValueInput("FILE").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_WRITE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE+W.Msg.MIXLY_MICROBIT_TYPE_STRING+W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_WRITE)}},qi={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL,"read"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE,"readline"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES,"readlines"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String)}},zi={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_NO_MORE_THAN_SIZE,"read"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE,"readline"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES_NO_MORE_THAN_SIZE,"readlines"]]),"MODE"),this.appendValueInput("SIZE").setCheck(Number),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE"),i=W.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE,n=W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER;return i+{read:W.Msg.MIXLY_MICROBIT_PY_STORAGE_NO_MORE_THAN_SIZE,readline:W.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE,readlines:W.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES_NO_MORE_THAN_SIZE}[e]+"x"+n}))}},Zi={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.setNextStatement(!0),this.appendValueInput("SIZE").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String),this.setTooltip(W.Msg.MICROBIT_PYTHON_TYPE)}},$i={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(W.Msg.HTML_FILE),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CAN_WRITE_ORNOT),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Boolean),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CAN_WRITE_ORNOT1)}},tn={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILENAME),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILENAME)}},en={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CLOSE_FILE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CLOSE_FILE)}},nn={init:function(){this.setColour(0),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_LIST_ALL_FILES),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_LIST_ALL_FILES)}};W.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE;const sn={init:function(){this.setColour(0),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE,"remove"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_DIRS,"removedirs"]]),"MODE"),this.appendValueInput("FILE").setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE)}},on={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILE_SIZE),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_SIZE),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Number),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILE_SIZE+W.Msg.MIXLY_MICROBIT_PY_STORAGE_SIZE)}},_n={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_RETURN_FILE),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_PRESENT_LOCATION),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Number),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_TELL)}},un={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_SET_FILE_POSITION),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CURRENT_POSITION),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_START,"start"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_CURRENT,"current"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_END,"end"]]),"MODE"),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET),this.appendValueInput("SIZE").setCheck(Number),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE"),i=W.Msg.MIXLY_MICROBIT_PY_STORAGE_SET_FILE_POSITION+W.Msg.MIXLY_MICROBIT_PY_STORAGE_CURRENT_POSITION,n=W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER,s=W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET;return i+" "+{start:W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_START,current:W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_CURRENT,end:W.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_END}[e]+s+"x"+n}))}},an={init:function(){this.setColour(0),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_CURRENT_DIR),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_CURRENT_DIR)}},rn={init:function(){this.setColour(0),this.appendValueInput("PATH").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_PATH),this.appendDummyInput().appendField(W.Msg.MIXLY_ESP32_SET),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,"mkdir"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_MAKEDIRS,"makedirs"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE");return W.Msg.MIXLY_MICROBIT_PY_STORAGE_PATH+"x"+W.Msg.MIXLY_ESP32_SET+{mkdir:W.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,makedirs:W.Msg.MIXLY_MICROPYTHON_SOCKET_MAKEDIRS}[e]}))}},pn={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_RENAME),this.appendValueInput("NEWFILE").setCheck(String).appendField(W.Msg.MIXLY_AS),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_RENAME)}},ln={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHANGE_DIR),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(W.Msg.MIXLY_MICROBIT_PY_STORAGE_CHANGE_DIR)}},In={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_OR_NOT),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.HTML_FILE,"isfile"],[W.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_DIR,"isdir"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Boolean);let t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE");return W.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH+"x"+W.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_OR_NOT+{isfile:W.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,isdir:W.Msg.MIXLY_MICROPYTHON_SOCKET_MAKEDIRS}[e]}))}},Tn={init:function(){this.setColour(0),this.appendValueInput("SPISUB").appendField(W.Msg.CONTROLS_FOR_INPUT_WITH+"SPI").setCheck("var"),this.appendValueInput("PINSUB").appendField("CS"),this.appendValueInput("SUB").appendField(W.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE).setCheck("var"),this.appendDummyInput("").appendField(W.Msg.MIXLY_SETUP+W.Msg.LISTS_SET_INDEX_INPUT_TO).appendField(W.Msg.MIXLY_SD_CARD),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},dn={init:function(){this.setColour(0),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_SD_CARD),this.appendValueInput("DIR").setCheck(String).appendField(W.Msg.MIXLY_SDCARD_MOUNT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip()}},hn={};hn.NAME_TYPE=W.PROCEDURE_CATEGORY_NAME,hn.allProcedures=function(t){for(var e=t.getAllBlocks(!1),i=[],n=[],s=0;s<e.length;s++)if(e[s].getProcedureDef){var o=e[s].getProcedureDef();o&&(o[2]?i.push(o):n.push(o))}return n.sort(hn.procTupleComparator_),i.sort(hn.procTupleComparator_),[n,i]},hn.procTupleComparator_=function(t,e){return t[0].toLowerCase().localeCompare(e[0].toLowerCase())},hn.findLegalName=function(t,e){if(e.isInFlyout)return t;for(t=t||W.Msg.UNNAMED_KEY||"unnamed";!hn.isLegalName_(t,e.workspace,e);){var i=t.match(/^(.*?)(\d+)$/);i?t=i[1]+(parseInt(i[2],10)+1):t+="2"}return t},hn.isLegalName_=function(t,e,i){return!hn.isNameUsed(t,e,i)},hn.isNameUsed=function(t,e,i){for(var n=e.getAllBlocks(!1),s=0;s<n.length;s++)if(n[s]!=i&&n[s].getProcedureDef){var o=n[s].getProcedureDef();if(W.Names.equals(o[0],t))return!0}return!1},hn.rename=function(t){t=t.trim();var e=hn.findLegalName(t,this.getSourceBlock()),i=this.getValue();if(i!=t&&i!=e)for(var n=this.getSourceBlock().workspace.getAllBlocks(!1),s=0;s<n.length;s++)n[s].renameProcedure&&n[s].renameProcedure(i,e);return e},hn.flyoutCategory=function(t){var e,i,n=[];W.Blocks.procedures_defnoreturn&&((i=W.utils.xml.createElement("block")).setAttribute("type","procedures_defnoreturn"),i.setAttribute("gap",16),(e=W.utils.xml.createElement("field")).setAttribute("name","NAME"),e.appendChild(W.utils.xml.createTextNode(W.Msg.PROCEDURES_DEFNORETURN_PROCEDURE)),i.appendChild(e),n.push(i));W.Blocks.procedures_defreturn&&((i=W.utils.xml.createElement("block")).setAttribute("type","procedures_defreturn"),i.setAttribute("gap",16),(e=W.utils.xml.createElement("field")).setAttribute("name","NAME"),e.appendChild(W.utils.xml.createTextNode(W.Msg.PROCEDURES_DEFRETURN_PROCEDURE)),i.appendChild(e),n.push(i));W.Blocks.procedures_return&&((i=W.utils.xml.createElement("block")).setAttribute("type","procedures_return"),i.setAttribute("gap",16),n.push(i));W.Blocks.procedures_ifreturn&&((i=W.utils.xml.createElement("block")).setAttribute("type","procedures_ifreturn"),i.setAttribute("gap",16),n.push(i));function s(t,e){for(var i=0;i<t.length;i++){var s=t[i][0],o=t[i][1],_=W.utils.xml.createElement("block");_.setAttribute("type",e),_.setAttribute("gap",16);var u=W.utils.xml.createElement("mutation");u.setAttribute("name",s),_.appendChild(u);for(var a=0;a<o.length;a++){var r=W.utils.xml.createElement("arg");r.setAttribute("name",o[a]),u.appendChild(r)}n.push(_)}}n.length&&n[n.length-1].setAttribute("gap",24);var o=hn.allProcedures(t);return s(o[0],"procedures_callnoreturn"),s(o[1],"procedures_callreturn"),n},hn.getCallers=function(t,e){for(var i=[],n=e.getAllBlocks(!1),s=0;s<n.length;s++)if(n[s].getProcedureCall){var o=n[s].getProcedureCall();o&&W.Names.equals(o,t)&&i.push(n[s])}return i},hn.mutateCallers=function(t){const e=W.Events.getRecordUndo(),i=t.getProcedureDef()[0],n=t.mutationToDom(!0),s=W.Procedures.getCallers(i,t.workspace);for(let t,i=0;t=s[i];i++){const i=t.mutationToDom(),s=i&&W.utils.xml.domToText(i);t.domToMutation&&t.domToMutation(n);const o=t.mutationToDom(),_=o&&W.utils.xml.domToText(o);s!==_&&(W.Events.setRecordUndo(!1),W.Events.fire(new(W.Events.get(W.Events.BLOCK_CHANGE))(t,"mutation",null,s,_)),W.Events.setRecordUndo(e))}},hn.getDefinition=function(t,e){for(var i=e.getTopBlocks(!1),n=0;n<i.length;n++)if(i[n].getProcedureDef){var s=i[n].getProcedureDef();if(s&&W.Names.equals(s[0],t))return i[n]}return null};const Mn=hn,mn={init:function(){var t=Mn.findLegalName("",this),e=new W.FieldTextInput(t,Mn.rename);e.setSpellcheck(!1),this.appendDummyInput().appendField(e,"NAME").appendField("","PARAMS"),this.setMutator(new W.icons.MutatorIcon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&W.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(W.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(W.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(W.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(t){this.hasStatements_!==t&&(t?(this.appendStatementInput("STACK").appendField(W.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=t)},updateParams_:function(){var t="";this.arguments_.length&&(t=W.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),W.Events.disable();try{this.setFieldValue(t,"PARAMS")}finally{W.Events.enable()}},mutationToDom:function(t){var e=W.utils.xml.createElement("mutation");t&&e.setAttribute("name",this.getFieldValue("NAME"));for(var i=0;i<this.argumentVarModels_.length;i++){var n=W.utils.xml.createElement("arg"),s=this.argumentVarModels_[i];n.setAttribute("name",s.name),n.setAttribute("varid",s.getId()),t&&this.paramIds_&&n.setAttribute("paramId",this.paramIds_[i]),e.appendChild(n)}return this.hasStatements_||e.setAttribute("statements","false"),e},domToMutation:function(t){this.arguments_=[],this.argumentVarModels_=[];for(var e,i=0;e=t.childNodes[i];i++)if("arg"==e.nodeName.toLowerCase()){var n=e.getAttribute("name"),s=e.getAttribute("varid")||e.getAttribute("varId");this.arguments_.push(n);var o=W.Variables.getOrCreateVariablePackage(this.workspace,s,n,"");null!=o?this.argumentVarModels_.push(o):console.log("Failed to create a variable with name "+n+", ignoring.")}this.updateParams_(),Mn.mutateCallers(this),this.setStatements_("false"!==t.getAttribute("statements"))},decompose:function(t){var e=W.utils.xml.createElement("block");e.setAttribute("type","procedures_mutatorcontainer");var i=W.utils.xml.createElement("statement");i.setAttribute("name","STACK"),e.appendChild(i);for(var n=i,s=0;s<this.arguments_.length;s++){var o=W.utils.xml.createElement("block");o.setAttribute("type","procedures_mutatorarg");var _=W.utils.xml.createElement("field");_.setAttribute("name","NAME");var u=W.utils.xml.createTextNode(this.arguments_[s]);_.appendChild(u),o.appendChild(_);var a=W.utils.xml.createElement("next");o.appendChild(a),n.appendChild(o),n=a}var r=W.Xml.domToBlock(e,t);return"procedures_defreturn"==this.type?r.setFieldValue(this.hasStatements_,"STATEMENTS"):r.removeInput("STATEMENT_INPUT"),Mn.mutateCallers(this),r},compose:function(t){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];for(var e=t.getInputTargetBlock("STACK");e&&!e.isInsertionMarker();){var i=e.getFieldValue("NAME");this.arguments_.push(i);var n=this.workspace.getVariable(i,"");this.argumentVarModels_.push(n),this.paramIds_.push(e.id),e=e.nextConnection&&e.nextConnection.targetBlock()}this.updateParams_(),Mn.mutateCallers(this);var s=t.getFieldValue("STATEMENTS");if(null!==s&&(s="TRUE"==s,this.hasStatements_!=s))if(s)this.setStatements_(!0),this.statementConnection_&&this.statementConnection_.reconnect(this,"STACK"),this.statementConnection_=null;else{var o=this.getInput("STACK").connection;if(this.statementConnection_=o.targetConnection,this.statementConnection_){var _=o.targetBlock();_.unplug(),_.bumpNeighbours()}this.setStatements_(!1)}},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(t,e){var i=this.workspace.getVariableById(t);if(""==i.type){for(var n=i.name,s=this.workspace.getVariableById(e),o=!1,_=0;_<this.argumentVarModels_.length;_++)this.argumentVarModels_[_].getId()==t&&(this.arguments_[_]=s.name,this.argumentVarModels_[_]=s,o=!0);o&&(this.displayRenamedVar_(n,s.name),Mn.mutateCallers(this))}},updateVarName:function(t){for(var e=t.name,i=!1,n=0;n<this.argumentVarModels_.length;n++)if(this.argumentVarModels_[n].getId()==t.getId()){var s=this.arguments_[n];this.arguments_[n]=e,i=!0}i&&(this.displayRenamedVar_(s,e),Mn.mutateCallers(this))},displayRenamedVar_:function(t,e){this.updateParams_();const i=this.getIcon(W.icons.MutatorIcon.TYPE);if(i&&i.bubbleIsVisible())for(var n,s=i.getWorkspace().getAllBlocks(!1),o=0;n=s[o];o++)"procedures_mutatorarg"==n.type&&W.Names.equals(t,n.getFieldValue("NAME"))&&n.setFieldValue(e,"NAME")},customContextMenu:function(t){if(!this.isInFlyout){var e={enabled:!0},i=this.getFieldValue("NAME");e.text=W.Msg.PROCEDURES_CREATE_DO.replace("%1",i);var n=W.utils.xml.createElement("mutation");n.setAttribute("name",i);for(var s=0;s<this.arguments_.length;s++){var o=W.utils.xml.createElement("arg");o.setAttribute("name",this.arguments_[s]),n.appendChild(o)}var _=W.utils.xml.createElement("block");if(_.setAttribute("type",this.callType_),_.appendChild(n),e.callback=W.ContextMenu.callbackFactory(this,_),t.push(e),!this.isCollapsed())for(s=0;s<this.argumentVarModels_.length;s++){var u={enabled:!0},a=this.argumentVarModels_[s];u.text=W.Msg.VARIABLES_SET_CREATE_GET.replace("%1",a.name);var r=W.Variables.generateVariableFieldDom(a),p=W.utils.xml.createElement("block");p.setAttribute("type","variables_get"),p.appendChild(r),u.callback=W.ContextMenu.callbackFactory(this,p),t.push(u)}}},callType_:"procedures_callnoreturn"},cn={init:function(){var t=Mn.findLegalName("",this),e=new W.FieldTextInput(t,Mn.rename);e.setSpellcheck(!1),this.appendDummyInput().appendField(e,"NAME").appendField("","PARAMS"),this.appendValueInput("RETURN").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new W.icons.MutatorIcon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&W.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(W.Msg.PROCEDURES_DEFRETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(W.Msg.PROCEDURES_DEFRETURN_TOOLTIP),this.setHelpUrl(W.Msg.PROCEDURES_DEFRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:mn.setStatements_,updateParams_:mn.updateParams_,mutationToDom:mn.mutationToDom,domToMutation:mn.domToMutation,decompose:mn.decompose,compose:mn.compose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:mn.getVars,getVarModels:mn.getVarModels,renameVarById:mn.renameVarById,updateVarName:mn.updateVarName,displayRenamedVar_:mn.displayRenamedVar_,customContextMenu:mn.customContextMenu,callType_:"procedures_callreturn"},On={init:function(){this.appendDummyInput().appendField(W.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.appendDummyInput("STATEMENT_INPUT").appendField(W.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new W.FieldCheckbox("TRUE"),"STATEMENTS"),this.setStyle("procedure_blocks"),this.setTooltip(W.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP),this.contextMenu=!1}},En={init:function(){var t=new W.FieldTextInput(Mn.DEFAULT_ARG,this.validator_);t.oldShowEditorFn_=t.showEditor_;t.showEditor_=function(){this.createdVariables_=[],this.oldShowEditorFn_()},this.appendDummyInput().appendField(W.Msg.PROCEDURES_BEFORE_PARAMS).appendField(t,"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(W.Msg.PROCEDURES_MUTATORARG_TOOLTIP),this.contextMenu=!1,t.onFinishEditing_=this.deleteIntermediateVars_,t.createdVariables_=[],t.onFinishEditing_("x")},validator_:function(t){var e=this.getSourceBlock(),i=e.workspace.getRootWorkspace();if(!(t=t.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")))return null;for(var n=(e.workspace.targetWorkspace||e.workspace).getAllBlocks(!1),s=t.toLowerCase(),o=0;o<n.length;o++)if(n[o].id!=this.getSourceBlock().id){var _=n[o].getFieldValue("NAME");if(_&&_.toLowerCase()==s)return null}if(e.isInFlyout)return t;var u=i.getVariable(t,"");return u&&u.name!=t&&i.renameVariableById(u.getId(),t),u||(u=i.createVariable(t,""))&&this.createdVariables_&&this.createdVariables_.push(u),t},deleteIntermediateVars_:function(t){var e=this.getSourceBlock().workspace.getRootWorkspace();if(e)for(var i=0;i<this.createdVariables_.length;i++){var n=this.createdVariables_[i];n.name!=t&&e.deleteVariableById(n.getId())}}},Rn={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(W.Msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(t,e){if(W.Names.equals(t,this.getProcedureCall())){this.setFieldValue(e,"NAME");var i=this.outputConnection?W.Msg.PROCEDURES_CALLRETURN_TOOLTIP:W.Msg.PROCEDURES_CALLNORETURN_TOOLTIP;this.setTooltip(i.replace("%1",e))}},setProcedureParameters_:function(t,e){var i=Mn.getDefinition(this.getProcedureCall(),this.workspace);const n=i&&i.getIcon(W.icons.MutatorIcon.TYPE),s=n&&n.bubbleIsVisible();if(s||(this.quarkConnections_={},this.quarkIds_=null),e)if(t.join("\n")!=this.arguments_.join("\n")){if(e.length!=t.length)throw Error("paramNames and paramIds must be the same length.");this.setCollapsed(!1),this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);var o=this.rendered;this.rendered=!1;for(var _=0;_<this.arguments_.length;_++){var u=this.getInput("ARG"+_);if(u){var a=u.connection.targetConnection;this.quarkConnections_[this.quarkIds_[_]]=a,s&&a&&-1==e.indexOf(this.quarkIds_[_])&&(a.disconnect(),a.getSourceBlock().bumpNeighbours())}}this.arguments_=[].concat(t),this.argumentVarModels_=[];for(_=0;_<this.arguments_.length;_++){var r=W.Variables.getOrCreateVariablePackage(this.workspace,null,this.arguments_[_],"");this.argumentVarModels_.push(r)}if(this.updateShape_(),this.quarkIds_=e,this.quarkIds_)for(_=0;_<this.arguments_.length;_++){var p=this.quarkIds_[_];if(p in this.quarkConnections_)(a=this.quarkConnections_[p])&&!a.reconnect(this,"ARG"+_)&&delete this.quarkConnections_[p]}this.rendered=o,this.rendered&&this.render()}else this.quarkIds_=e},updateShape_:function(){for(var t=0;t<this.arguments_.length;t++){var e=this.getField("ARGNAME"+t);if(e){W.Events.disable();try{e.setValue(this.arguments_[t])}finally{W.Events.enable()}}else{e=new W.FieldLabel(this.arguments_[t]),this.appendValueInput("ARG"+t).setAlign(W.inputs.Align.RIGHT).appendField(e,"ARGNAME"+t).init()}}for(;this.getInput("ARG"+t);)this.removeInput("ARG"+t),t++;var i=this.getInput("TOPROW");i&&(this.arguments_.length?this.getField("WITH")||(i.appendField(W.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),i.init()):this.getField("WITH")&&i.removeField("WITH"))},mutationToDom:function(){var t=W.utils.xml.createElement("mutation");t.setAttribute("name",this.getProcedureCall());for(var e=0;e<this.arguments_.length;e++){var i=W.utils.xml.createElement("arg");i.setAttribute("name",this.arguments_[e]),t.appendChild(i)}return t},domToMutation:function(t){var e=t.getAttribute("name");this.renameProcedure(this.getProcedureCall(),e);for(var i,n=[],s=[],o=0;i=t.childNodes[o];o++)"arg"==i.nodeName.toLowerCase()&&(n.push(i.getAttribute("name")),s.push(i.getAttribute("paramId")));this.setProcedureParameters_(n,s)},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(t){if(this.workspace&&!this.workspace.isFlyout&&t.recordUndo)if(t.type==W.Events.BLOCK_CREATE&&-1!=t.ids.indexOf(this.id)){var e=this.getProcedureCall();if((T=Mn.getDefinition(e,this.workspace))&&T.type!=this.defType_&&(T=null),T){if(JSON.stringify(T.getVars())!=JSON.stringify(this.arguments_)){let t=T.arguments_,e=[];for(var i=0;i<this.arguments_.length;i++){var n=this.getInput("ARG"+i);if(n){var s=n.connection.targetConnection;s?e.push(s.sourceBlock_.id):e.push(null)}}this.setProcedureParameters_(t,e)}}else{W.Events.setGroup(t.group);var o=W.utils.xml.createElement("xml"),_=W.utils.xml.createElement("block");_.setAttribute("type",this.defType_);var u=this.getRelativeToSurfaceXY(),a=u.x+W.SNAP_RADIUS*(this.RTL?-1:1),r=u.y+2*W.SNAP_RADIUS;_.setAttribute("x",a),_.setAttribute("y",r);var p=this.mutationToDom();_.appendChild(p);var l=W.utils.xml.createElement("field");l.setAttribute("name","NAME");var I=this.getProcedureCall();I||(I=Mn.findLegalName("",this),this.renameProcedure("",I)),l.appendChild(W.utils.xml.createTextNode(I)),_.appendChild(l),o.appendChild(_),W.Xml.domToWorkspace(o,this.workspace),W.Events.setGroup(!1)}}else if(t.type==W.Events.BLOCK_DELETE){e=this.getProcedureCall();(T=Mn.getDefinition(e,this.workspace))||(W.Events.setGroup(t.group),this.dispose(!0),W.Events.setGroup(!1))}else if(t.type==W.Events.CHANGE&&"disabled"==t.element){var T;e=this.getProcedureCall();if((T=Mn.getDefinition(e,this.workspace))&&T.id==t.blockId){var d=W.Events.getGroup();d&&console.log("Saw an existing group while responding to a definition change"),W.Events.setGroup(t.group),t.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),W.Events.setGroup(d)}}},customContextMenu:function(t){if(this.workspace.isMovable()){var e={enabled:!0};e.text=W.Msg.PROCEDURES_HIGHLIGHT_DEF;var i=this.getProcedureCall(),n=this.workspace;e.callback=function(){var t=Mn.getDefinition(i,n);t&&(n.centerOnBlock(t.id),t.select())},t.push(e)}},defType_:"procedures_defnoreturn"},gn={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(W.Msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:Rn.getProcedureCall,renameProcedure:Rn.renameProcedure,setProcedureParameters_:Rn.setProcedureParameters_,updateShape_:Rn.updateShape_,mutationToDom:Rn.mutationToDom,domToMutation:Rn.domToMutation,getVars:Rn.getVars,getVarModels:Rn.getVarModels,onchange:Rn.onchange,customContextMenu:Rn.customContextMenu,defType_:"procedures_defreturn"},Cn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(W.Msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(W.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(W.Msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){var t=W.utils.xml.createElement("mutation");return t.setAttribute("value",Number(this.hasReturnValue_)),t},domToMutation:function(t){var e=t.getAttribute("value");this.hasReturnValue_=1==e,this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.workspace.isDragging&&!this.workspace.isDragging()){var t=!1,e=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(e.type)){t=!0;break}e=e.getSurroundParent()}while(e);t?("procedures_defnoreturn"==e.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=e.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText(W.Msg.PROCEDURES_IFRETURN_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]},An={init:function(){this.setStyle("procedure_blocks"),this.appendValueInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.hasReturnValue_=!0},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("value",Number(this.hasReturnValue_)),t},domToMutation:function(t){var e=t.getAttribute("value");this.hasReturnValue_=1==e,this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){var t=!1,e=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(e.type)){t=!0;break}e=e.getSurroundParent()}while(e);t?("procedures_defnoreturn"==e.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=e.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(W.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(W.Msg.PROCEDURES_IFRETURN_WARNING)},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn","method_procedures_defnoreturn","method_procedures_defreturn"]},Ln=195,Sn={init:function(){this.setColour(Ln),this.appendDummyInput("").appendField(new W.FieldTextInput("mytup"),"VAR"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["tuple_create_with_item"],this)),this.setTooltip(W.Msg.TUPLE_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("tuple_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("tuple_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(W.Msg.TUPLE_CREATE_EMPTY_TITLE);else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.TUPLE_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Nn={init:function(){this.setColour(Ln),this.appendDummyInput().appendField(W.Msg.TUPLE_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(W.Msg.TUPLE_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Dn={init:function(){this.setColour(Ln),this.appendDummyInput().appendField(W.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.TUPLE_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},fn={init:function(){this.setColour(Ln),this.appendDummyInput("").appendField(new W.FieldTextInput("mytup"),"VAR").appendField(" = (").appendField(new W.FieldTextInput("0,0,0"),"TEXT").appendField(")"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Pn={init:function(){this.setColour(Ln),this.appendDummyInput("").appendField("(").appendField(new W.FieldTextInput("0,0,0"),"TEXT").appendField(")"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)}},Fn={init:function(){this.setColour(Ln),this.setOutput(!0),this.appendValueInput("TUP").setCheck("Tuple"),this.appendValueInput("AT").setCheck(Number).appendField(W.Msg.LANG_LISTS_GET_INDEX1),this.appendDummyInput("").appendField(W.Msg.LANG_LISTS_GET_INDEX2),this.setInputsInline(!0),this.setTooltip(W.Msg.TUPLE_GET_INDEX_TOOLTIP)}},vn={init:function(){this.setColour(Ln),this.appendValueInput("TUP"),this.appendDummyInput("").appendField(W.Msg.MIXLY_LENGTH),this.setTooltip(W.Msg.TUPLE_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},Yn={init:function(){this.setColour(Ln),this.appendValueInput("TUP").setCheck("Tuple"),this.appendDummyInput("").appendField(W.Msg.TUPLE_DEL),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.TUPLE_DEL_TOOLTIP)}},bn={init:function(){this.setColour(Ln),this.appendValueInput("TUP1").setCheck("Tuple"),this.appendDummyInput("").appendField(W.Msg.TUPLE_JOIN),this.appendValueInput("TUP2").setCheck("Tuple"),this.setInputsInline(!0),this.setTooltip(W.Msg.TUPLE_JOIN_TOOLTIP),this.setOutput(!0,"Tuple")}},Vn={init:function(){this.appendValueInput("TUP").setCheck("Tuple");var t=[[W.Msg.blockpy_TUPLE_MAX,"max"],[W.Msg.blockpy_TUPLE_MIN,"min"],[W.Msg.MATH_ONLIST_OPERATOR_SUM,"sum"]];this.setColour(Ln),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_JS_GET).appendField(new W.FieldDropdown(t),"DIR"),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("DIR");return{max:W.Msg.MIXLY_TOOLTIP_TUPLE_MAX,min:W.Msg.MIXLY_TOOLTIP_TUPLE_MIN,sum:W.Msg.MIXLY_TOOLTIP_TUPLE_SUM}[t]}))}},Xn={init:function(){var t=[[W.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"]];this.setColour(Ln),this.appendValueInput("VAR").setCheck("Tuple"),this.appendDummyInput("").appendField(W.Msg.A_TO_B).appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{list:W.Msg.TUPLE_TO_LISTS,set:W.Msg.TUPLE_TO_SET}[t]}))}},yn={init:function(){var t=[[W.Msg.MIXLY_LIST_INDEX,"INDEX"],[W.Msg.MIXLY_LIST_COUNT,"COUNT"]];this.setColour(Ln),this.appendValueInput("VAR").setCheck("List"),this.appendValueInput("data").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(W.Msg.HTML_VALUE),this.appendDummyInput().appendField(W.Msg.MIXLY_DE).appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{INDEX:W.Msg.MIXLY_TOOLTIP_TUPLE_FIND_INDEX,COUNT:W.Msg.MIXLY_TOOLTIP_TUPLE_FIND_COUNT}[t]}))}},Un={init:function(){var t=[[W.Msg.MIXLY_LIST_LEN,"LEN"],[W.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[W.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[W.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[W.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[W.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[W.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[W.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"]];this.setColour(Ln),this.setOutput(!0,Number),this.appendValueInput("data").setCheck("List"),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{LEN:W.Msg.TUPLE_LENGTH_TOOLTIP,SUM:W.Msg.MATH_ONLIST_TOOLTIP_TUPLE_SUM,MAX:W.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MAX,MIN:W.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MIN,AVERAGE:W.Msg.MATH_ONLIST_TOOLTIP_TUPLE_AVERAGE,MEDIAN:W.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MEDIAN,MODE:W.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MODE,STD_DEV:W.Msg.MATH_ONLIST_TOOLTIP_TUPLE_STD_DEV}[t]}))}},Bn={init:function(){this.WHERE_OPTIONS_1=[[W.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[W.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[W.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[W.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[W.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[W.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(W.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Ln),this.appendValueInput("LIST").setCheck("List"),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),this.setInputsInline(!0),this.setOutput(!0,"List"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(W.Msg.PYTHON_TUPLE_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation"),e=this.getInput("AT1").type==W.INPUT_VALUE;t.setAttribute("at1",e);var i=this.getInput("AT2").type==W.INPUT_VALUE;return t.setAttribute("at2",i),t},domToMutation:function(t){var e="true"==t.getAttribute("at1"),i="true"==t.getAttribute("at2");this.updateAt_(1,e),this.updateAt_(2,i)},updateAt_:function(t,e){this.removeInput("AT"+t),this.removeInput("ORDINAL"+t,!0),e?(this.appendValueInput("AT"+t).setCheck(Number),W.Msg.TEXT_CHARAT_TAIL&&this.appendDummyInput("ORDINAL"+t).appendField(W.Msg.TEXT_CHARAT_TAIL)):this.appendDummyInput("AT"+t);var i=new W.FieldDropdown(this["WHERE_OPTIONS_"+t],(function(i){var n="FROM_START"==i||"FROM_END"==i;if(n!=e){var s=this.sourceBlock_;return s.updateAt_(t,n),s.setFieldValue(i,"WHERE"+t),null}}));this.getInput("AT"+t).appendField(i,"WHERE"+t),1==t&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}},Gn={init:function(){this.setColour(Ln),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"Tuple"),this.setMutator(new W.icons.MutatorIcon(["tuple_create_with_item"],this)),this.setTooltip(W.Msg.TUPLE_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("tuple_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("tuple_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(W.Msg.TUPLE_CREATE_EMPTY_TITLE);else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.TUPLE_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},wn={init:function(){this.setHelpUrl(W.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Ln),this.appendValueInput("LIST"),this.appendDummyInput(""),this.appendValueInput("AT1").appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+W.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(W.Msg.TEXT_CHARAT_TAIL+" "+W.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(W.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Tuple"),this.setTooltip(W.Msg.PYTHON_TUPLE_GET_SUBLIST_TOOLTIP)}},kn={init:function(){this.setColour(Ln),this.appendValueInput("TUP"),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+W.Msg.LISTS_GET_INDEX_RANDOM),this.setTooltip(W.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM),this.setOutput(!0)}},Hn={init:function(){this.setColour(Ln),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_TOTUPLE),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_TOOLTIP_TOTUPLE)}},xn=100,Wn={init:function(){this.setColour(xn),this.appendDummyInput("").appendField(new W.FieldTextInput("s1"),"VAR"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["set_create_with_item"],this)),this.setTooltip(W.Msg.blockpy_SET_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("set_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("set_create_with_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(W.Msg.blockpy_SET_CREATE_EMPTY_TITLE);else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("ADD"+t);0==t&&e.appendField(W.Msg.blockpy_SET_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(t,e){W.Names.equals(t,this.getFieldValue("VAR"))&&this.setTitleValue(e,"VAR")}},Kn={init:function(){this.setColour(xn),this.appendDummyInput().appendField(W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(W.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Jn={init:function(){this.setColour(xn),this.appendDummyInput().appendField(W.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.blockpy_SET_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},jn={init:function(){this.setColour(xn),this.appendValueInput("SET"),this.appendDummyInput("").appendField(W.Msg.MIXLY_LENGTH),this.setInputsInline(!0),this.setTooltip(W.Msg.SET_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},Qn={init:function(){this.setColour(xn),this.appendValueInput("SET").setCheck("Set"),this.appendDummyInput("").appendField(W.Msg.blockpy_SET_GET_AND_REMOVE_LAST),this.setTooltip(W.Msg.SET_POP_TOOLTIP),this.setInputsInline(!0),this.setOutput(!0)}},qn={init:function(){this.setColour(xn),this.appendValueInput("SET").setCheck("Set"),this.appendDummyInput("").appendField(W.Msg.SET_CLEAR),this.setPreviousStatement(!0),this.setNextStatement(!0)}},zn={init:function(){this.appendValueInput("SET1").setCheck("Set");var t=[[W.Msg.blockpy_set_union,"union"],[W.Msg.blockpy_set_intersection,"intersection"],[W.Msg.blockpy_set_difference,"difference"]];this.setColour(xn),this.appendDummyInput("").appendField(W.Msg.blockpy_and_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(W.Msg.blockpy_set_get_operate).appendField(new W.FieldDropdown(t),"OPERATE"),this.setInputsInline(!0),this.setOutput(!0,"set");var e=this;this.setTooltip((function(){var t=e.getFieldValue("OPERATE");return{union:W.Msg.MIXLY_TOOLTIP_SET_UNION,intersection:W.Msg.MIXLY_TOOLTIP_SET_INTERSECTION,difference:W.Msg.MIXLY_TOOLTIP_SET_DIFFERENCE}[t]}))}},Zn={init:function(){this.appendValueInput("SET1").setCheck("Set");var t=[[W.Msg.blockpy_set_union,"update"],[W.Msg.blockpy_set_intersection,"intersection_update"],[W.Msg.blockpy_set_difference,"difference_update"]];this.setColour(xn),this.appendDummyInput("").appendField(W.Msg.blockpy_and_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(W.Msg.blockpy_set_get_operate).appendField(new W.FieldDropdown(t),"OPERATE"),this.appendDummyInput("").appendField(W.Msg.blockpy_set_update),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OPERATE");return{update:W.Msg.MIXLY_TOOLTIP_SET_UPDATE,intersection_update:W.Msg.MIXLY_TOOLTIP_SET_INTERSECTION_UPDATE,difference_update:W.Msg.MIXLY_TOOLTIP_SET_DIFFERENCE_UPDATE}[t]}))}},$n={init:function(){this.appendValueInput("SET").setCheck("Set");var t=[[W.Msg.MIXLY_blockpy_set_add,"add"],[W.Msg.MIXLY_blockpy_set_discard,"discard"]];this.setColour(xn),this.appendDummyInput("").appendField(new W.FieldDropdown(t),"OPERATE"),this.appendValueInput("data").appendField(W.Msg.blockpy_SET_VARIABLES_NAME),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OPERATE");return{add:W.Msg.SET_ADD_TOOLTIP,discard:W.Msg.SET_DISCARD_TOOLTIP}[t]}))}},ts={init:function(){this.appendValueInput("SET1").setCheck("Set");var t=[[W.Msg.blockpy_set_sub,"issubset"],[W.Msg.blockpy_set_super,"issuperset"]];this.setColour(xn),this.appendDummyInput("").appendField(W.Msg.blockpy_is_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(W.Msg.blockpy_set_of).appendField(new W.FieldDropdown(t),"OPERATE"),this.setInputsInline(!0),this.setOutput(!0,Boolean);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OPERATE");return{issubset:W.Msg.MIXLY_TOOLTIP_SET_SUB,issuperset:W.Msg.MIXLY_TOOLTIP_SET_SUPER}[t]}))}},es={init:function(){this.appendValueInput("SET").setCheck("Set"),this.setColour(xn),this.appendValueInput("VAR").setCheck([String,"List"]).appendField(W.Msg.blockpy_set_add_update),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.SET_UPDATE_TOOLTIP)}},is={init:function(){this.setColour(xn),this.appendDummyInput("").appendField("{").appendField(new W.FieldTextInput("0,0,0"),"TEXT").appendField("}"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXPY_TOOLTIP_SET_CREATE_WITH_TEXT)}},ns={init:function(){this.setColour(xn),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_TOSET),this.setOutput(!0),this.setTooltip(W.Msg.MIXLY_PYTHON_TOOLTIP_TOSET)}},ss="#1ec1e4",os={init:function(){this.setColour(ss),this.appendDummyInput().appendField(W.Msg.HTML_DOCUMENT),this.appendStatementInput("HEAD").appendField(W.Msg.HTML_HEAD),this.appendStatementInput("BODY").appendField(W.Msg.HTML_BODY),this.setOutput(!0)}},_s={init:function(){this.setColour(ss),this.appendDummyInput().appendField(W.Msg.HTML_LEVEL).appendField(new W.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0)}},us={init:function(){this.setColour(ss),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.HTML_HEAD,"head"],[W.Msg.HTML_BODY,"body"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0)}},as={init:function(){this.setColour(ss),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.HTML_P,"p"],[W.Msg.HTML_SPAN,"span"],[W.Msg.HTML_FORM,"form"],[W.Msg.HTML_TABLE,"table"],[W.Msg.HTML_LINE,"tr"],[W.Msg.HTML_CELL,"td"],[W.Msg.HTML_OL,"ol"],[W.Msg.HTML_UL,"ul"],[W.Msg.HTML_LI,"li"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setInputsInline(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)}},rs={init:function(){this.setColour(ss),this.appendDummyInput().appendField("<").appendField(new W.FieldTextInput("tag"),"LEVEL").appendField(">"),this.appendValueInput("style").appendField(W.Msg.MIXLY_AIP_ATTR).setAlign(W.inputs.Align.RIGHT),this.appendStatementInput("DO").appendField(""),this.setInputsInline(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ps={init:function(){this.setColour(ss),this.appendDummyInput().appendField(W.Msg.HTML_STYLE),this.appendStatementInput("STYLE"),this.setOutput(!0)}},ls={init:function(){this.setColour(ss),this.appendDummyInput().appendField(W.Msg.HTML_FORM_CONTENT).appendField(new W.FieldDropdown([[W.Msg.HTML_TEXT,"text"],[W.Msg.HTML_EMAIL,"email"],[W.Msg.HTML_NUMBER,"number"],[W.Msg.HTML_PASSWORD,"password"],[W.Msg.HTML_CHECKBOX,"checkbox"],[W.Msg.HTML_RADIOBUTTON,"radiobutton"],[W.Msg.HTML_BUTTON,"button"],[W.Msg.HTML_COLOUR,"colour"],[W.Msg.HTML_DATE,"date"],[W.Msg.HTML_LOCALTIME,"local time"],[W.Msg.HTML_FILE,"file"],[W.Msg.HTML_HIDDEN,"hidden"],[W.Msg.HTML_IMAGE,"image"],[W.Msg.HTML_MONTH,"month"],[W.Msg.HTML_RANGE,"range"],[W.Msg.HTML_RESET,"reset"],[W.Msg.HTML_SEARCH,"search"],[W.Msg.HTML_SUBMIT,"submit"],[W.Msg.HTML_TELEPHONENUMBER,"telephone number"],[W.Msg.HTML_TIME,"time"],[W.Msg.HTML_URL,"url"],[W.Msg.HTML_WEEK,"week"]]),"LEVEL"),this.appendDummyInput().appendField(W.Msg.HTML_NAME).appendField(new W.FieldTextInput("car"),"NAME"),this.appendDummyInput().appendField(W.Msg.HTML_VALUE).appendField(new W.FieldTextInput("go"),"VALUE"),this.appendValueInput("style").appendField(W.Msg.MIXLY_AIP_ATTR).setAlign(W.inputs.Align.RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Is={init:function(){this.setColour(ss),this.appendDummyInput().appendField(new W.FieldTextInput("property"),"KEY").appendField(":").appendField(new W.FieldTextInput("value"),"VALUE"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ts={init:function(){this.setColour(ss),this.appendDummyInput().appendField(new W.FieldTextInput("property"),"KEY").appendField(":").appendField(new W.FieldColour("#ff0000"),"RGB_LED_COLOR"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ds={init:function(){this.setColour(ss),this.appendDummyInput().appendField(W.Msg.HTML_TEXT).appendField(new W.FieldTextInput("text"),"TEXT"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},hs=160,Ms={init:function(){this.setColour(hs),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendDummyInput().appendField("Tabular Abstraction:"),this.appendDummyInput().appendField(new W.FieldTable(""),"TEXT")}},ms={init:function(){this.setColour(hs),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendDummyInput().appendField("Code Block:"),this.appendDummyInput().appendField(new W.FieldMultilineInput(""),"TEXT")}},cs={init:function(){this.setColour(hs),this.appendDummyInput().appendField("Code Expression:"),this.appendDummyInput().appendField(new W.FieldMultilineInput(""),"TEXT"),this.setOutput(!0)}},Os={init:function(){this.setColour(hs),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendValueInput("VALUE").appendField(""),this.setInputsInline(!1)}},Es={init:function(){this.setColour(hs),this.appendDummyInput().appendTitle("Comment:").appendTitle(new W.FieldTextInput(""),"TEXT"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("This comment will be ignored by Python")}},Rs={init:function(){this.setColour(hs),this.appendValueInput("VALUE").appendField(W.Msg.TYPE_CHECK),this.setInputsInline(!1),this.setOutput(!0,"Type")}},gs={init:function(){this.setColour(hs),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["text_print_multiple_item"],this)),this.setTooltip(W.Msg.TEXT_PRINT_TOOLTIP)},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=W.Block.obtain(t,"text_print_multiple_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("text_print_multiple_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("PRINT"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("PRINT"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("PRINT"+t);)this.removeInput("PRINT"+t),t++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField("print");else for(t=0;t<this.itemCount_;t++){var e=this.appendValueInput("PRINT"+t);0==t&&e.appendField("print")}}},Cs={init:function(){this.setColour(hs),this.appendDummyInput().appendField("print"),this.appendStatementInput("STACK"),this.setTooltip(""),this.contextMenu=!1}},As={init:function(){this.setColour(hs),this.appendDummyInput().appendField("item"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.contextMenu=!1}},Ls={init:function(){this.setColour(hs),this.itemCount_=1,this.hasReturn_=!1,this.appendDummyInput().appendField(new W.FieldTextInput("str"),"NAME"),this.updateShape_(),this.setMutator(new W.icons.MutatorIcon(["function_call_item"],this)),this.setTooltip("Can be used to call any function")},mutationToDom:function(){var t=document.createElement("mutation");return t.setAttribute("items",this.itemCount_),t.setAttribute("hasReturn",this.hasReturn_?"TRUE":"FALSE"),t},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.hasReturn_="TRUE"===t.getAttribute("hasReturn"),this.updateShape_()},decompose:function(t){var e=W.Block.obtain(t,"function_call_container");e.initSvg(),e.setFieldValue(this.hasStatements_?"TRUE":"FALSE","RETURN");for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("function_call_item");s.initSvg(),i.connect(s.previousConnection),i=s.nextConnection}return e},setReturn:function(t){this.unplug(!0,!0),this.setOutput(t),this.setPreviousStatement(!t),this.setNextStatement(!t),this.rendered&&this.render()},compose:function(t){for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.hasReturn_="TRUE"===t.getFieldValue("RETURN"),this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ARGUMENT"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ARGUMENT"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ARGUMENT"+t);)this.removeInput("ARGUMENT"+t),t++;for(t=0;t<this.itemCount_;t++)this.appendValueInput("ARGUMENT"+t);this.setReturn(this.hasReturn_)}},Ss={init:function(){this.setColour(hs),this.appendDummyInput().appendField("Arguments"),this.appendStatementInput("STACK"),this.appendDummyInput().setAlign(W.inputs.Align.RIGHT).appendField("has return").appendField(new W.FieldCheckbox("TRUE"),"RETURN"),this.setTooltip(""),this.contextMenu=!1}},Ns={init:function(){this.setColour(hs),this.appendDummyInput().appendField("argument"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.contextMenu=!1}},Ds={init:function(){this.appendValueInput("MODULE").setCheck(null),this.appendValueInput("NAME").setCheck(null).appendField("."),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(230),this.setTooltip(""),this.setHelpUrl("")}},fs=function(t,e){return[e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE),e.ORDER_ATOMIC]},Ps=function(t,e){if(""==this.getFieldValue("VAR"))return" = None\n";var i=e.valueToCode(this,"VALUE",e.ORDER_ASSIGNMENT)||"None";return e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE)+" = "+i+"\n"},Fs=function(t,e){var i=this.getFieldValue("OP"),n=e.valueToCode(this,"MYVALUE",e.ORDER_ATOMIC)||"None";if("bytes"==i)var s=i+"("+n+',"UTF-8")';else s=i+"("+n+")";return[s,e.ORDER_ATOMIC]},vs=function(t,e){return"global "+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"None")+"\n"},Ys=function(t,e){return["type("+(e.valueToCode(this,"DATA",e.ORDER_ATOMIC)||"None")+")",e.ORDER_ATOMIC]},bs=function(t,e){return[this.getFieldValue("type"),e.ORDER_ATOMIC]},Vs=function(t,e){var i=e.statementToCode(t,"DO");return"if __name__ == '__main__':\n"+(i=e.addLoopTrap(i,t.id)||e.PASS)},Xs=function(t,e){var i=e.statementToCode(this,"DO");return(i=i.replace(/(^\s*)|(\s*$)/g,"").replace(/\n {4}/g,"\n")).endsWith("\n")?e.setups_.setup_setup=i:e.setups_.setup_setup=i+"\n",""},ys=function(t,e){var i=0,n="";do{n+=(0==i?"if ":"elif ")+(e.valueToCode(t,"IF"+i,e.ORDER_NONE)||"False")+":\n"+(e.statementToCode(t,"DO"+i)||e.PASS),++i}while(t.getInput("IF"+i));return t.getInput("ELSE")&&(n+="else:\n"+(e.statementToCode(t,"ELSE")||e.PASS)),n},Us=function(t,e){var i=0,n=e.valueToCode(this,"IF"+i,e.ORDER_NONE)||"null",s="try:\n"+(e.statementToCode(this,"try")||" pass\n");for(i=1;i<=this.elseifCount_;i++)""!==(n=e.valueToCode(this,"IF"+i,e.ORDER_NONE)||"")&&(n=" "+n),s+="except"+n+": \n"+(e.statementToCode(this,"DO"+i)||" pass\n");return this.elseCount_&&(s+="finally:\n"+(e.statementToCode(this,"ELSE")||" pass\n")),s},Bs=function(t,e){var i=e.variableDB_.getName(t.getFieldValue("VAR"),W.Variables.NAME_TYPE),n=e.valueToCode(t,"FROM",e.ORDER_NONE)||"0",s=e.valueToCode(t,"TO",e.ORDER_NONE)||"0",o=e.valueToCode(t,"STEP",e.ORDER_NONE)||"1",_=e.statementToCode(t,"DO"),u=(_=e.addLoopTrap(_,t.id)||e.PASS,""),a=function(t,e){return e.provideFunction_("upRange",["def "+e.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start <= stop:"," yield start"," start += abs(step)"])},r=function(t,e){return e.provideFunction_("downRange",["def "+e.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start >= stop:"," yield start"," start -= abs(step)"])};if(t=function(t,e,i){return"("+t+" <= "+e+") and "+a()+"("+t+", "+e+", "+i+") or "+r()+"("+t+", "+e+", "+i+")"},W.isNumber(n)&&W.isNumber(s)&&W.isNumber(o))n=parseFloat(n),s=parseFloat(s),o=Math.abs(parseFloat(o)),0==n%1&&0==s%1&&0==o%1?(n<=s?(s++,t=0==n&&1==o?s:n+", "+s,1!=o&&(t+=", "+o)):t=n+", "+--s+", -"+o,t="range("+t+")"):(t=n<s?a():r(),t+="("+n+", "+s+", "+o+")");else{var p=function(t,n){if(W.isNumber(t))t=parseFloat(t);else{var s=e.variableDB_.getDistinctName(i+n,W.Variables.NAME_TYPE);u+=s+" = "+t+"\n",t=s}return t};n=p(n,"_start"),s=p(s,"_end");p(o,"_inc"),t="number"==typeof n&&"number"==typeof s?n<s?a(0,s):r(0,s):t(n,s,o)}return u+="for "+i+" in "+t+":\n"+_},Gs=function(t,e){var i=e.variableDB_.getName(t.getFieldValue("VAR"),W.Variables.NAME_TYPE),n=e.valueToCode(t,"FROM",e.ORDER_NONE)||"0",s=e.valueToCode(t,"TO",e.ORDER_NONE)||"0",o=e.valueToCode(t,"STEP",e.ORDER_NONE)||"1",_=e.statementToCode(t,"DO"),u=e.addLoopTrap(_,t.id)||e.PASS;return e.setups_.mixly_range="def mixly_range(start, stop, step):\n for i in range(start, stop + 1, step):\n yield i\n\n","for "+i+" in mixly_range("+n+", "+s+", "+o+"):\n"+u},ws=function(t,e){var i="UNTIL"==t.getFieldValue("MODE"),n=e.valueToCode(t,"BOOL",e.ORDER_NONE)||"False",s=e.statementToCode(t,"DO");return i&&(n="not "+n),"while "+n+":\n"+(s=e.addLoopTrap(s,t.id)||e.PASS)},ks=function(t){switch(t.getFieldValue("FLOW")){case"BREAK":return"break\n";case"CONTINUE":return"continue\n"}throw"Unknown flow statement."},Hs=function(t,e){return"sleep("+(e.valueToCode(this,"DELAY_TIME",e.ORDER_ATOMIC)||"1000")+")\n"},xs=function(t,e){return"panic("+(e.valueToCode(this,"STATUS_CODE",e.ORDER_ATOMIC)||"1000")+")\n"},Ws=function(t,e){e.definitions_.import_time="import time";return["time.time()",e.ORDER_ATOMIC]},Ks=function(t,e){return e.definitions_.import_microbit="from microbit import *","reset()\n"},Js=function(){return"interrupts();\n"},js=function(){return"noInterrupts();\n"},Qs=function(t,e){var i=e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"''",n=e.valueToCode(t,"LIST",e.ORDER_RELATIONAL)||"[]",s=e.statementToCode(t,"DO");return"for "+i+" in "+n+":\n"+(s=e.addLoopTrap(s,t.id)||e.PASS)},qs=function(t,e){return["range("+(e.valueToCode(this,"FROM",e.ORDER_NONE)||"0")+", "+(e.valueToCode(this,"TO",e.ORDER_NONE)||"0")+", "+(e.valueToCode(this,"STEP",e.ORDER_NONE)||"1")+")",e.ORDER_ATOMIC]},zs=function(t,e){var i="lambda "+(e.valueToCode(t,"BOOL",e.ORDER_NONE)||"None")+": "+(e.statementToCode(t,"DO")||"pass");return[i=i.replace("\n","").replace(" ",""),e.ORDER_ATOMIC]},Zs=function(t,e){return e.definitions_.import_time="import time","time.sleep("+(e.valueToCode(this,"DELAY_TIME",e.ORDER_ATOMIC)||"1000")+")\n"},$s=function(){return"pass\n"},to=function(t,e){e.definitions_.import__thread="import _thread";var i=e.valueToCode(this,"VAR",e.ORDER_NONE)||"None";return"_thread.start_new_thread("+e.variableDB_.getName(e.valueToCode(this,"callback",e.ORDER_NONE)||"None",W.Procedures.NAME_TYPE)+", "+i+")\n"},eo=function(t,e){var i=e.valueToCode(this,"select_data",e.ORDER_NONE)||"False",n=e.statementToCode(this,"input_data");return n="true"==this.getFieldValue("type")?n+" if ("+i+"):\n break\n":n+" if not ("+i+"):\n break\n","while True:\n"+(n=e.addLoopTrap(n,this.id)||e.PASS)},io=function(t,e){var i=e.valueToCode(this,"TIMES",e.ORDER_ATOMIC),n=e.statementToCode(t,"DO");return"for _my_variable in range("+i+"):\n"+(n=e.addLoopTrap(n,t.id)||e.PASS)},no=io,so=function(t,e){var i=this.getFieldValue("NUM");return[i,i<0?e.ORDER_UNARY_PREFIX:e.ORDER_ATOMIC]},oo=function(t,e){return e.definitions_.import_math="import math",["math."+this.getFieldValue("CONSTANT"),e.ORDER_ATOMIC]},_o=function(t,e){return e.definitions_.import_math="import math",["math."+this.getFieldValue("CONSTANT"),e.ORDER_ATOMIC]},uo=function(t,e){var i=this.getFieldValue("OP"),n=e.ORDER_ATOMIC;return["("+(e.valueToCode(this,"A",n)||"0")+i+(e.valueToCode(this,"B",n)||"0")+")",n]},ao=function(t,e){var i=(n={ADD:[" + ",e.ORDER_ADDITIVE],MINUS:[" - ",e.ORDER_ADDITIVE],MULTIPLY:[" * ",e.ORDER_MULTIPLICATIVE],DIVIDE:[" / ",e.ORDER_MULTIPLICATIVE],QUYU:[" % ",e.ORDER_MULTIPLICATIVE],ZHENGCHU:[" // ",e.ORDER_MULTIPLICATIVE],POWER:[" ** ",e.ORDER_EXPONENTIATION]}[t.getFieldValue("OP")])[0],n=n[1];return[(e.valueToCode(t,"A",n)||"0")+i+(t=e.valueToCode(t,"B",n)||"0"),n]},ro=function(t,e){var i=e.valueToCode(this,"A",e.ORDER_RELATIONAL)||"0",n=e.valueToCode(this,"B",e.ORDER_RELATIONAL)||"0";switch(this.getFieldValue("OP")){case"ADD":var s="+=";break;case"MINUS":s="-=";break;case"MULTIPLY":s="*=";break;case"DIVIDE":s="/=";break;case"QUYU":s="%=";break;case"ZHENGCHU":s="//=";break;case"POWER":s="**="}return i+" "+s+" "+n+"\n"},po=function(t,e){var i,n=t.getFieldValue("OP");if("NEG"==n)return["-"+(i=e.valueToCode(t,"NUM",e.ORDER_UNARY_SIGN)||"0"),e.ORDER_UNARY_SIGN];switch(e.definitions_.import_math="import math",t="SIN"==n||"COS"==n||"TAN"==n?e.valueToCode(t,"NUM",e.ORDER_MULTIPLICATIVE)||"0":e.valueToCode(t,"NUM",e.ORDER_NONE)||"0",n){case"ABS":i="math.fabs("+t+")";break;case"ROOT":i="math.sqrt("+t+")";break;case"LN":i="math.log("+t+")";break;case"LOG10":i="math.log10("+t+")";break;case"EXP":i="math.exp("+t+")";break;case"POW10":i="math.pow(10,"+t+")";break;case"ROUND":i="round("+t+")";break;case"ROUNDUP":i="math.ceil("+t+")";break;case"ROUNDDOWN":i="math.floor("+t+")";break;case"SIN":i="math.sin("+t+")";break;case"COS":i="math.cos("+t+")";break;case"TAN":i="math.tan("+t+")";break;case"++":i="++("+t+")";break;case"--":i="--("+t+")";break;case"-":i="-("+t+")"}if(i)return[i,e.ORDER_EXPONENTIATION];switch(n){case"ASIN":i="math.degrees(math.asin("+t+"))";break;case"ACOS":i="math.degrees(math.acos("+t+"))";break;case"ATAN":i="math.degrees(math.atan("+t+"))"}return[i,e.ORDER_MULTIPLICATIVE]},lo=po,Io=function(t,e){var i=e.valueToCode(this,"NUM",e.ORDER_NONE)||"0";return[this.getFieldValue("OP")+"("+i+")",e.ORDER_ATOMIC]},To=function(t,e){var i=e.valueToCode(this,"A",e.ORDER_NONE)||"0",n=this.getFieldValue("OP"),s="";return"round"===n?s=n+"("+i+")":(s="math."+n+"("+i+")",e.definitions_.import_math="import math"),[s,e.ORDER_ATOMIC]},ho=function(t,e){var i=e.valueToCode(this,"A",e.ORDER_NONE)||"0",n=e.valueToCode(this,"B",e.ORDER_NONE)||"0";return[this.getFieldValue("OP")+"("+i+", "+n+")",e.ORDER_ATOMIC]},Mo=function(t,e){e.definitions_.import_random="import random";var i=this.getFieldValue("TYPE"),n=e.valueToCode(this,"FROM",e.ORDER_NONE)||"0",s=e.valueToCode(this,"TO",e.ORDER_NONE)||"0";if("int"==i)var o="random.randint("+n+", "+s+")";else if("float"==i)o="random.uniform("+n+", "+s+")";return[o,e.ORDER_UNARY_POSTFIX]},mo=function(t,e){var i=e.valueToCode(this,"NUM",e.ORDER_NONE),n=e.valueToCode(this,"fromLow",e.ORDER_ATOMIC),s=e.valueToCode(this,"fromHigh",e.ORDER_ATOMIC),o=e.valueToCode(this,"toLow",e.ORDER_ATOMIC),_=e.valueToCode(this,"toHigh",e.ORDER_ATOMIC);return e.definitions_.import_mixpy_math_map="from mixpy import math_map",["math_map("+i+", "+n+", "+s+", "+o+", "+_+")",e.ORDER_NONE]},co=function(t,e){return["min(max("+(e.valueToCode(this,"VALUE",e.ORDER_NONE)||"0")+", "+(e.valueToCode(this,"LOW",e.ORDER_NONE)||"0")+"), "+(e.valueToCode(this,"HIGH",e.ORDER_NONE)||"0")+")",e.ORDER_UNARY_POSTFIX]},Oo=function(t,e){var i=t.getFieldValue("OP"),n=e.valueToCode(this,"NUM",e.ORDER_NONE)||"0",s=t.getFieldValue("OP2");e.definitions_.import_math="import math";var o="",_="10";if("two"==i?_="2":"eight"==i?_="8":"ten"==i?_="10":"sixteen"==i&&(_="16"),"two"==s?o="bin":"eight"==s?o="oct":"ten"==s?o="":"sixteen"==s&&(o="hex"),""==o)var u="int(str("+n+"), "+_+")";else u=o+"(int(str("+n+"), "+_+"))";return[u,e.ORDER_ATOMIC]},Eo=function(t,e){return e.definitions_.import_random="import random","random.seed("+(e.valueToCode(this,"NUM",e.ORDER_NONE)||"0")+");\n"},Ro=function(t,e){var i=this.getFieldValue("NUM");return[i,i<0?e.ORDER_UNARY_PREFIX:e.ORDER_ATOMIC]},go=function(t,e){return["round("+(e.valueToCode(this,"VALUE",e.ORDER_NONE)||"0")+", "+(e.valueToCode(this,"VAR",e.ORDER_NONE)||"0")+")",e.ORDER_ATOMIC]},Co=function(t,e){var i=this.getFieldValue("TOWHAT"),n=e.valueToCode(this,"VAR",e.ORDER_ATOMIC);return"b"==i?[n+'.encode("utf-8")',e.ORDER_ATOMIC]:[i+"("+n+")",e.ORDER_ATOMIC]},Ao=function(t,e){var i=this.getFieldValue("TOWHAT"),n=e.valueToCode(this,"VAR",e.ORDER_ATOMIC);return"b"==i?[n+'.encode("utf-8")',e.ORDER_ATOMIC]:[i+"("+n+")",e.ORDER_ATOMIC]},Lo=mo,So=function(t,e){return[e.quote_(this.getFieldValue("TEXT")),e.ORDER_ATOMIC]},No=function(t,e){return['"""'+this.getFieldValue("VALUE")+'"""',e.ORDER_ATOMIC]},Do=function(t,e){return["'"+this.getFieldValue("TEXT")+"'",e.ORDER_ATOMIC]},fo=function(t,e){return[e.valueToCode(this,"A",e.ORDER_ATOMIC)+" + "+e.valueToCode(this,"B",e.ORDER_ATOMIC),e.ORDER_ADDITIVE]},Po=function(t,e){return["chr("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+")",e.ORDER_ATOMIC]},Fo=function(t,e){return["ord("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"a")+")",e.ORDER_ATOMIC]},vo=function(t,e){return["str("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+")",e.ORDER_ATOMIC]},Yo=function(t,e){return["len("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+")",e.ORDER_ATOMIC]},bo=function(t,e){var i=t.getFieldValue("WHERE")||"FROM_START",n=e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""';switch(i){case"FROM_START":return[n+"["+(t=e.getAdjustedInt(t,"AT"))+"]",e.ORDER_ATOMIC];case"FROM_END":return[n+"["+(t=e.getAdjustedInt(t,"AT",1,!0))+"]",e.ORDER_ATOMIC];case"RANDOM":return e.definitions_.import_random="import random",["random.choice("+n+")",e.ORDER_FUNCTION_CALL]}throw"Unhandled combination (lists_getIndex)."},Vo=function(t,e){return[(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+"["+(e.valueToCode(this,"AT",e.ORDER_ATOMIC)||0)+"]",e.ORDER_ATOMIC]},Xo=function(t,e){var i=e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""';return e.definitions_.import_random="import random",["random.choice("+i+")",e.ORDER_FUNCTION_CALL]},yo=function(t,e){var i=e.valueToCode(this,"STR1",e.ORDER_ATOMIC)||'""',n=e.valueToCode(this,"STR2",e.ORDER_ATOMIC)||'""',s=this.getFieldValue("DOWHAT");return"==="===s?[i+" == "+n,e.ORDER_ATOMIC]:[i+"."+s+"("+n+")",e.ORDER_ATOMIC]},Uo=function(t,e){return["cmp("+(e.valueToCode(this,"STR1",e.ORDER_ATOMIC)||'""')+","+(e.valueToCode(this,"STR2",e.ORDER_ATOMIC)||'""')+")",e.ORDER_ATOMIC]},Bo=function(t,e){var i=e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""',n=t.getFieldValue("WHERE1"),s=t.getFieldValue("WHERE2");switch(n){case"FROM_START":"0"==(o=e.getAdjustedInt(t,"AT1"))&&(o="");break;case"FROM_END":var o=e.getAdjustedInt(t,"AT1",0,!0);break;case"FIRST":o="0";break;default:throw"Unhandled option (lists_getSublist)"}switch(s){case"FROM_START":var _=e.getAdjustedInt(t,"AT2");break;case"FROM_END":_=e.getAdjustedInt(t,"AT2",0,!0);W.isNumber(String(_))?"0"==_&&(_=""):(e.definitions_.import_sys="import sys",_+=" or sys.maxsize");break;case"LAST":_="-1";break;default:throw"Unhandled option (lists_getSublist)"}return[i+"["+o+" : "+_+"]",e.ORDER_ATOMIC]},Go=function(t,e){return[(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+"["+e.valueToCode(this,"AT1",e.ORDER_ATOMIC)+" : "+e.valueToCode(this,"AT2",e.ORDER_ATOMIC)+"]",e.ORDER_ATOMIC]},wo=function(t,e){var i=this.getFieldValue("CAPITAL");return[e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+"."+i+"()",e.ORDER_ATOMIC]},ko=function(t,e){var i=this.getFieldValue("CENTER");return[e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+"."+i+"("+e.valueToCode(this,"WID",e.ORDER_ATOMIC)+","+e.valueToCode(this,"Symbol",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},Ho=function(t,e){return[e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+".find("+e.valueToCode(this,"STR",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},xo=function(t,e){return[e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+".join("+(e.valueToCode(this,"LIST",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},Wo=function(t,e){return[e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+".replace("+e.valueToCode(this,"STR1",e.ORDER_ATOMIC)+","+e.valueToCode(this,"STR2",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},Ko=function(t,e){return[(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+".split("+(e.valueToCode(this,"VAL",e.ORDER_ATOMIC)||'""')+")",e.ORDER_ATOMIC]},Jo=function(t,e){var i=this.getFieldValue("TOWHAT");return[e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+"."+i+"()",e.ORDER_ATOMIC]},jo=function(t,e){for(var i=this.getFieldValue("VAR"),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)n[s]=e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"0";return[n=i+".format("+n.join(", ")+")",e.ORDER_ATOMIC]},Qo=function(t,e){for(var i=e.valueToCode(this,"VAR",e.ORDER_ATOMIC),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)n[s]=e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"0";return[n=i+".format("+n.join(", ")+")",e.ORDER_ATOMIC]},qo=Go,zo=Uo,Zo=Vo,$o=function(t,e){var i=this.getFieldValue("DIR"),n=this.getFieldValue("CODE");return[(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+"."+i+'("'+n+'")',e.ORDER_ATOMIC]},t_=function(t,e){return["eval("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},e_=function(t,e){return e.definitions_.import_os="import os","os.system("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+")\n"},i_=function(t,e){return[(e.valueToCode(this,"LIST",e.ORDER_ADDITIVE)||"mylist")+"["+e.valueToCode(this,"AT1",e.ORDER_ADDITIVE)+" : "+e.valueToCode(this,"AT2",e.ORDER_ADDITIVE)+"]",e.ORDER_ATOMIC]},n_=function(t,e){return[(e.valueToCode(this,"LIST",e.ORDER_ATOMIC)||"mylist")+"["+(e.valueToCode(this,"row",e.ORDER_ATOMIC)||0)+","+(e.valueToCode(this,"col",e.ORDER_ATOMIC)||0)+"]",e.ORDER_ATOMIC]},s_=function(t,e){return[(e.valueToCode(this,"LIST",e.ORDER_ATOMIC)||"mylist")+"["+(e.valueToCode(this,"row_start",e.ORDER_ATOMIC)||0)+" : "+(e.valueToCode(this,"row_end",e.ORDER_ATOMIC)||1)+","+(e.valueToCode(this,"col_start",e.ORDER_ATOMIC)||0)+" : "+(e.valueToCode(this,"col_end",e.ORDER_ATOMIC)||1)+"]",e.ORDER_ATOMIC]},o_=function(t,e){for(var i=e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)n[s]=e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"0";return n=i+" = ["+n.join(", ")+"]\n"},__=function(t,e){return e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE)+" = ["+this.getFieldValue("TEXT")+"]\n"},u_=function(t,e){return[(e.valueToCode(this,"LIST",e.ORDER_ADDITIVE)||"mylist")+"["+(e.valueToCode(this,"AT",e.ORDER_ADDITIVE)||0)+"]",e.ORDER_ATOMIC]},a_=function(t,e){return(e.valueToCode(this,"LIST",e.ORDER_ADDITIVE)||"mylist")+"["+(e.valueToCode(this,"AT",e.ORDER_ADDITIVE)||"0")+"] = "+(e.valueToCode(this,"TO",e.ORDER_ASSIGNMENT)||"0")+"\n"},r_=function(t,e){var i=e.valueToCode(this,"LIST",e.ORDER_ASSIGNMENT)||"0",n=e.valueToCode(this,"DATA",e.ORDER_ASSIGNMENT)||"0";return i+"."+this.getFieldValue("OP")+"("+n+")\n"},p_=function(t,e){return e.definitions_.import_random="import random",["random.choice("+(e.valueToCode(this,"LIST",e.ORDER_ADDITIVE)||"mylist")+")",e.ORDER_ATOMIC]},l_=function(t,e){return e.definitions_.import_random="import random",["random.sample("+(e.valueToCode(this,"LIST",e.ORDER_ADDITIVE)||"mylist")+","+(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},I_=function(t,e){return(e.valueToCode(this,"LIST",e.ORDER_ASSIGNMENT)||"0")+".insert("+(e.valueToCode(this,"AT",e.ORDER_ADDITIVE)||"0")+", "+(e.valueToCode(this,"VALUE",e.ORDER_ASSIGNMENT)||"0")+")\n"},T_=function(t,e){return(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0")+".reverse()\n"},d_=function(t,e){return(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0")+".clear()\n"},h_=function(t,e){var i=this.getFieldValue("OP"),n=e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0",s=e.valueToCode(this,"data",e.ORDER_ASSIGNMENT)||"0";if("INDEX"==i)var o=n+".index("+s+")";else if("COUNT"==i)o=n+".count("+s+")";return[o,e.ORDER_ATOMIC]},M_=function(t,e){var i=e.valueToCode(this,"LIST",e.ORDER_ASSIGNMENT)||"0",n=e.valueToCode(this,"DATA",e.ORDER_ASSIGNMENT)||"0";return"del"==this.getFieldValue("OP")?"del "+i+"["+n+"]\n":i+".remove("+n+")\n"},m_=function(t,e){return[(e.valueToCode(this,"LIST",e.ORDER_ADDITIVE)||"mylist")+".pop("+(e.valueToCode(this,"VALUE",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},c_=function(t,e){var i,n=t.getFieldValue("OP");switch(e.definitions_.import_math="import math",t=e.valueToCode(t,"data",e.ORDER_NONE),n){case"LEN":i="len("+t+")";break;case"SUM":i="sum("+t+")";break;case"MIN":i="min("+t+")";break;case"MAX":i="max("+t+")";break;case"AVERAGE":e.definitions_.import_mixpy_math_mean="from mixpy import math_mean",i="math_mean("+t+")";break;case"MEDIAN":e.definitions_.import_mixpy_math_median="from mixpy import math_median",i="math_median("+t+")";break;case"MODE":e.definitions_.import_mixpy_math_modes="from mixpy import math_modes",i="math_modes("+t+")";break;case"STD_DEV":e.definitions_.import_mixpy_math_standard_deviation="from mixpy import math_standard_deviation",i="math_standard_deviation("+t+")";break;default:throw"Unknown operator: "+n}if(i)return[i,e.ORDER_ATOMIC]},O_=function(t,e){return e.definitions_.import_mixpy_lists_sort="from mixpy import lists_sort",["lists_sort("+(e.valueToCode(t,"LIST",e.ORDER_NONE)||"[]")+', "'+t.getFieldValue("TYPE")+'", '+("1"===t.getFieldValue("DIRECTION")?"False":"True")+")",e.ORDER_ATOMIC]},E_=function(t,e){var i=this.getFieldValue("OP"),n=e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0",s="";return"array"==i?(e.definitions_.import_numpy="import numpy",s="numpy.array("+n+")"):s=i+"("+n+")",[s,e.ORDER_ATOMIC]},R_=function(t,e){return["["+this.getFieldValue("CONTENT")+"]",e.ORDER_ATOMIC]},g_=function(t,e){for(var i=new Array(this.itemCount_),n=0;n<this.itemCount_;n++)i[n]=e.valueToCode(this,"ADD"+n,e.ORDER_NONE)||"0";return[i="["+i.join(", ")+"]",e.ORDER_ATOMIC]},C_=E_,A_=function(t,e){return"del "+(e.valueToCode(this,"TUP",e.ORDER_ASSIGNMENT)||"0")+"\n"},L_=o_,S_=__,N_=u_,D_=i_,f_=a_,P_=I_,F_=M_,v_=function(t,e){for(var i=new Array(this.itemCount_),n=0;n<this.itemCount_;n++)i[n]=e.valueToCode(this,"ADD"+n,e.ORDER_NONE)||"[]";return[i="zip("+i.join(", ")+")",e.ORDER_ATOMIC]},Y_=function(t,e){return["list("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+")",e.ORDER_ATOMIC]},b_=function(t,e){return[(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+".tolist()",e.ORDER_ATOMIC]},V_=function(t,e){for(var i=e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++){var o=this.getFieldValue("KEY"+s);n[s]=o+":"+(e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"0")}return n=i+"= {"+n.join(", ")+"}\n"},X_=function(t,e){return[(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+".keys()",e.ORDER_ATOMIC]},y_=function(t,e){return[(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+"["+e.valueToCode(this,"KEY",e.ORDER_ASSIGNMENT)+"]",e.ORDER_ATOMIC]},U_=function(t,e){return[(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+".get("+e.valueToCode(this,"KEY",e.ORDER_ASSIGNMENT)+","+(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},B_=function(t,e){return(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"mydict")+"["+e.valueToCode(this,"KEY",e.ORDER_ASSIGNMENT)+"] = "+(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0")+"\n"},G_=function(t,e){return"del "+(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"mydict")+"["+e.valueToCode(this,"KEY",e.ORDER_ASSIGNMENT)+"]\n"},w_=function(t,e){var i=e.valueToCode(this,"DICT2",e.ORDER_ASSIGNMENT)||"0";return(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+".update("+i+")\n"},k_=function(t,e){return(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+".clear()\n"},H_=function(t,e){return[(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+".items()",e.ORDER_ATOMIC]},x_=function(t,e){return[(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+".values()",e.ORDER_ATOMIC]},W_=function(t,e){return["len("+(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},K_=function(t,e){return"del "+(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+"\n"},J_=function(t,e){var i=e.valueToCode(t,"DICT",e.ORDER_MEMBER)||"[]",n=t.getFieldValue("WHERE"),s=e.valueToCode(this,"KEY",e.ORDER_ASSIGNMENT);switch(n){case"INSERT":var o=i+"["+s+"] = "+(e.valueToCode(this,"AT2",e.ORDER_ASSIGNMENT)||"0")+"\n";break;case"DELETE":o="del "+i+"["+s+"]\n";break;default:throw"Unhandled option (lists_setIndex2)"}return o},j_=function(t,e){return[(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+".pop("+e.valueToCode(this,"KEY",e.ORDER_ASSIGNMENT)+")",e.ORDER_ATOMIC]},Q_=function(t,e){return(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"mydict")+".setdefault("+e.valueToCode(this,"KEY",e.ORDER_ASSIGNMENT)+","+(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0")+")\n"},q_=function(t,e){for(var i=new Array(this.itemCount_),n=0;n<this.itemCount_;n++){var s=this.getFieldValue("KEY"+n);i[n]=s+":"+(e.valueToCode(this,"ADD"+n,e.ORDER_NONE)||"0")}if(1!=this.itemCount_)i="{"+i.join(", ")+"}";else i="{"+i.join(", ")+",}";return[i,e.ORDER_ATOMIC]},z_=function(t,e){return["dict("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+")",e.ORDER_ATOMIC]},Z_=function(t,e){return e.definitions_.import_json="import json",["json.dumps("+(e.valueToCode(this,"DICT",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},$_=function(t,e){return e.definitions_.import_json="import json",["json.loads("+(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"null")+")",e.ORDER_ATOMIC]},tu=function(t,e){var i=this.getFieldValue("OP"),n=tu.OPERATORS[i],s="=="==n||"!="==n?e.ORDER_EQUALITY:e.ORDER_RELATIONAL;return[(e.valueToCode(this,"A",s)||"0")+" "+n+" "+(e.valueToCode(this,"B",s)||"0"),s]},eu=function(t,e){var i=this.getFieldValue("OP1"),n=tu.OPERATORS[i],s=this.getFieldValue("OP2"),o=tu.OPERATORS[s];return[(e.valueToCode(this,"A",e.ORDER_RELATIONAL)||"0")+" "+n+" "+(e.valueToCode(this,"B",e.ORDER_RELATIONAL)||"0")+" "+o+" "+(e.valueToCode(this,"C",e.ORDER_RELATIONAL)||"0"),e.ORDER_RELATIONAL]};tu.OPERATORS={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="};const iu=function(t,e){var i=this.getFieldValue("OP"),n="&&"==i?e.ORDER_LOGICAL_AND:e.ORDER_LOGICAL_OR,s=e.valueToCode(this,"A",n)||"False",o=e.valueToCode(this,"B",n)||"False";if("AND"==i)var _=s+" and "+o;else if("OR"==i)_=s+" or "+o;else if("NOR"==i)_="not("+s+"^"+o+")";else _=s+"^"+o;return[_,n]},nu=function(t,e){var i=e.ORDER_UNARY_PREFIX;return["not "+(e.valueToCode(this,"BOOL",i)||"False"),i]},su=function(t,e){return["TRUE"==this.getFieldValue("BOOL")?"True":"False",e.ORDER_ATOMIC]},ou=function(t,e){return["None",e.ORDER_ATOMIC]},_u=function(t,e){var i=e.valueToCode(this,"A",e.ORDER_ATOMIC)||"False";return["("+(e.valueToCode(this,"B",e.ORDER_ATOMIC)||"False")+" if "+i+" else "+(e.valueToCode(this,"C",e.ORDER_ATOMIC)||"False")+")",e.ORDER_ATOMIC]},uu=function(t,e){var i=e.valueToCode(this,"A",e.ORDER_ATOMIC)||"''",n=e.valueToCode(this,"B",e.ORDER_ATOMIC)||"''";return[i+" "+this.getFieldValue("BOOL")+" "+n,e.ORDER_ATOMIC]},au=function(t,e){var i=e.valueToCode(this,"A",e.ORDER_ATOMIC)||"''",n=e.valueToCode(this,"B",e.ORDER_ATOMIC)||"''";return[i+" "+this.getFieldValue("BOOL")+" "+n,e.ORDER_ATOMIC]},ru=function(t,e){return["bool("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+")",e.ORDER_ATOMIC]},pu=function(t,e){return e.definitions_.import_os="import os","os.startfile("+e.valueToCode(this,"fn",e.ORDER_ATOMIC)+")\n"},lu=function(t,e){return e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+" = open("+e.valueToCode(this,"FILENAME",e.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"')\n"},Iu=function(t,e){return["open("+e.valueToCode(this,"FILENAME",e.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"')",e.ORDER_ATOMIC]},Tu=function(t,e){return["open("+e.valueToCode(this,"FILENAME",e.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"', encoding=\""+this.getFieldValue("CODE")+'")',e.ORDER_ATOMIC]},du=function(t,e){var i=e.valueToCode(this,"data",e.ORDER_ATOMIC);return e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+".write("+i+")\n"},hu=function(t,e){var i=this.getFieldValue("MODE");return[e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+"."+i+"()",e.ORDER_ATOMIC]},Mu=function(t,e){var i=this.getFieldValue("MODE");return[e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+"."+i+"("+e.valueToCode(this,"SIZE",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},mu=function(t,e){return[e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+".readline("+e.valueToCode(this,"SIZE",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},cu=function(t,e){return[e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+".writable()",e.ORDER_ATOMIC]},Ou=function(t,e){return[e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+".name()",e.ORDER_ATOMIC]},Eu=function(t,e){return e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+".close()\n"},Ru=function(t,e){e.definitions_.import_os="import os";return["os.listdir()",e.ORDER_ATOMIC]},gu=function(t,e){return e.definitions_.import_os="import os","os."+this.getFieldValue("MODE")+"("+e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+")\n"},Cu=function(t,e){return e.definitions_.import_os="import os",["os.path.getsize("+e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},Au=function(t,e){return[e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+".tell()",e.ORDER_ATOMIC]},Lu=function(t,e){var i=this.getFieldValue("MODE"),n=0;return n="start"==i?0:"current"==i?1:2,e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+".seek("+e.valueToCode(this,"SIZE",e.ORDER_ATOMIC)+","+n+")\n"},Su=function(t,e){return e.definitions_.import_os="import os","os.chdir("+e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+")\n"},Nu=function(t,e){e.definitions_.import_os="import os";return["os.getcwd()",e.ORDER_ATOMIC]},Du=function(t,e){return e.definitions_.import_os="import os","os."+this.getFieldValue("MODE")+"("+e.valueToCode(this,"PATH",e.ORDER_ATOMIC)+")\n"},fu=function(t,e){return e.definitions_.import_os="import os","os.rename("+e.valueToCode(this,"FILE",e.ORDER_ATOMIC)+","+e.valueToCode(this,"NEWFILE",e.ORDER_ATOMIC)+")\n"},Pu=function(t,e){e.definitions_.import_os="import os";var i=e.valueToCode(this,"FILE",e.ORDER_ATOMIC);return["os."+this.getFieldValue("MODE")+"("+i+")",e.ORDER_ATOMIC]},Fu=function(t,e){return e.definitions_.import_os="import os",e.definitions_.import_sdcard="import sdcard",e.valueToCode(this,"SUB",e.ORDER_ATOMIC)+" = sdcard.SDCard("+e.valueToCode(this,"SPISUB",e.ORDER_ATOMIC)+","+e.valueToCode(this,"PINSUB",e.ORDER_ATOMIC)+")\n"},vu=function(t,e){return e.definitions_.import_os="import os",e.definitions_.import_sdcard="import sdcard","os.mount("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+","+e.valueToCode(this,"DIR",e.ORDER_ATOMIC)+")\n"},Yu=function(t,e){var i=e.variableDB_.getName(this.getFieldValue("NAME"),W.Procedures.NAME_TYPE),n=e.statementToCode(this,"STACK")||" pass\n";e.INFINITE_LOOP_TRAP&&(n=e.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+this.id+"'")+n);var s=e.valueToCode(this,"RETURN",e.ORDER_NONE)||"";s&&(s=" return "+s+"\n");for(var o=[],_=0;_<this.arguments_.length;_++){var u=e.variableDB_.getName(this.arguments_[_],W.Variables.NAME_TYPE);o[_]=u}var a="def "+i+"("+o.join(", ")+"):\n"+n+s+"\n";return a=e.scrub_(this,a),e.setups_[i]=a,null},bu=function(t,e){var i=e.variableDB_.getName(this.getFieldValue("NAME"),W.Procedures.NAME_TYPE),n=e.statementToCode(this,"STACK")||" pass\n";e.INFINITE_LOOP_TRAP&&(n=e.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+this.id+"'")+n);for(var s=[],o=0;o<this.arguments_.length;o++){var _=e.variableDB_.getName(this.arguments_[o],W.Variables.NAME_TYPE);s[o]=_}var u="def "+i+"("+s.join(", ")+"):\n"+n+"\n";return u=e.scrub_(this,u),e.setups_[i]=u,null},Vu=function(t,e){for(var i=e.variableDB_.getName(this.getFieldValue("NAME"),W.Procedures.NAME_TYPE),n=[],s=0;s<this.arguments_.length;s++)n[s]=e.valueToCode(this,"ARG"+s,e.ORDER_NONE)||"null";return[i+"("+n.join(", ")+")",e.ORDER_UNARY_POSTFIX]},Xu=function(t,e){for(var i=e.variableDB_.getName(this.getFieldValue("NAME"),W.Procedures.NAME_TYPE),n=[],s=0;s<this.arguments_.length;s++)n[s]=e.valueToCode(this,"ARG"+s,e.ORDER_NONE)||"null";return i+"("+n.join(", ")+")\n"},yu=function(t,e){var i="if ("+(e.valueToCode(this,"CONDITION",e.ORDER_NONE)||"False")+") :\n";this.hasReturnValue_?i+=" return "+(e.valueToCode(this,"VALUE",e.ORDER_NONE)||"None"):i+=" return None";return i+="\n"},Uu=function(t,e){var i="";this.hasReturnValue_?i+="return "+(e.valueToCode(this,"VALUE",e.ORDER_NONE)||"None"):i+="return None";return i+="\n"},Bu=function(t,e){for(var i=e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)n[s]=e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"0";if(1!=this.itemCount_)n=i+"= ("+n.join(", ")+")\n";else n=i+"= ("+n.join(", ")+",)\n";return n},Gu=function(t,e){return e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE)+"= ("+this.getFieldValue("TEXT")+")\n"},wu=function(t,e){return["("+this.getFieldValue("TEXT")+")",e.ORDER_ATOMIC]},ku=function(t,e){var i=e.valueToCode(this,"TUP",e.ORDER_ASSIGNMENT)||"0",n=e.valueToCode(this,"AT",e.ORDER_ADDITIVE)||"1";return n.match(/^\d+$/)&&(n=parseInt(n,10)),[i+"["+n+"]",e.ORDER_ATOMIC]},Hu=function(t,e){return["len("+(e.valueToCode(this,"TUP",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},xu=function(t,e){return"del "+(e.valueToCode(this,"TUP",e.ORDER_ASSIGNMENT)||"0")+"\n"},Wu=function(t,e){return[(e.valueToCode(this,"TUP1",e.ORDER_ASSIGNMENT)||"0")+" + "+(e.valueToCode(this,"TUP2",e.ORDER_ASSIGNMENT)||"0"),e.ORDER_ATOMIC]},Ku=function(t,e){var i=e.valueToCode(this,"TUP",e.ORDER_ASSIGNMENT)||"0";return[this.getFieldValue("DIR")+"("+i+")",e.ORDER_ATOMIC]},Ju=function(t,e){return[this.getFieldValue("OP")+"("+(e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0")+")\n",e.ORDER_ATOMIC]},ju=function(t,e){var i=this.getFieldValue("OP"),n=e.valueToCode(this,"VAR",e.ORDER_ASSIGNMENT)||"0",s=e.valueToCode(this,"data",e.ORDER_ASSIGNMENT)||"0";if("INDEX"==i)var o=n+".index("+s+")";else if("COUNT"==i)o=n+".count("+s+")";return[o,e.ORDER_ATOMIC]},Qu=function(t,e){var i,n=t.getFieldValue("OP");switch(e.definitions_.import_math="import math",t=e.valueToCode(t,"data",e.ORDER_NONE),n){case"LEN":i="len("+t+")";break;case"SUM":i="sum("+t+")";break;case"MIN":i="min("+t+")";break;case"MAX":i="max("+t+")";break;case"AVERAGE":i=e.provideFunction_("math_mean",["def "+e.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = [e for e in myList if type(e) == int or type(e) == float]"," if not localList: return"," return float(sum(localList)) / len(localList)"])+"("+t+")";break;case"MEDIAN":i=e.provideFunction_("math_median",["def "+e.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = sorted([e for e in myList if type(e) == int or type(e) == float])"," if not localList: return"," if len(localList) % 2 == 0:"," return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0"," else:"," return localList[(len(localList) - 1) // 2]"])+"("+t+")";break;case"MODE":i=e.provideFunction_("math_modes",["def "+e.FUNCTION_NAME_PLACEHOLDER_+"(some_list):"," modes = []"," # Using a lists of [item, count] to keep count rather than dict",' # to avoid "unhashable" errors when the counted item is itself a list or dict.'," counts = []"," maxCount = 1"," for item in some_list:"," found = False"," for count in counts:"," if count[0] == item:"," count[1] += 1"," maxCount = max(maxCount, count[1])"," found = True"," if not found:"," counts.append([item, 1])"," for counted_item, item_count in counts:"," if item_count == maxCount:"," modes.append(counted_item)"," return modes"])+"("+t+")";break;case"STD_DEV":e.definitions_.import_math="import math",i=e.provideFunction_("math_standard_deviation",["def "+e.FUNCTION_NAME_PLACEHOLDER_+"(numbers):"," n = len(numbers)"," if n == 0: return"," mean = float(sum(numbers)) / n"," variance = sum((x - mean) ** 2 for x in numbers) / n"," return math.sqrt(variance)"])+"("+t+")";break;default:throw"Unknown operator: "+n}if(i)return[i,e.ORDER_FUNCTION_CALL]},qu=function(t,e){var i=e.valueToCode(t,"LIST",e.ORDER_MEMBER)||"[]",n=t.getFieldValue("WHERE1"),s=t.getFieldValue("WHERE2");switch(n){case"FROM_START":"0"==(o=e.getAdjustedInt(t,"AT1"))&&(o="");break;case"FROM_END":var o=e.getAdjustedInt(t,"AT1",1,!0);break;case"FIRST":o="0";break;default:throw"Unhandled option (lists_getSublist)"}switch(s){case"FROM_START":var _=e.getAdjustedInt(t,"AT2",1);_-=1;break;case"FROM_END":_=e.getAdjustedInt(t,"AT2",1,!0);W.isNumber(String(_))?"0"==_&&(_=""):(e.definitions_.import_sys="import sys",_+=" or sys.maxsize");break;case"LAST":_="-1";break;default:throw"Unhandled option (lists_getSublist)"}return[i+"["+o+" : "+_+"]",e.ORDER_MEMBER]},zu=function(t,e){for(var i=new Array(this.itemCount_),n=0;n<this.itemCount_;n++)i[n]=e.valueToCode(this,"ADD"+n,e.ORDER_NONE)||"0";if(1!=this.itemCount_)i="("+i.join(", ")+")";else i="("+i.join(", ")+",)";return[i,e.ORDER_ATOMIC]},Zu=function(t,e){return[(e.valueToCode(this,"LIST",e.ORDER_ADDITIVE)||"0")+"["+(e.valueToCode(this,"AT1",e.ORDER_ADDITIVE)||"0")+" : "+(e.valueToCode(this,"AT2",e.ORDER_ADDITIVE)||"0")+"]",e.ORDER_ATOMIC]},$u=function(t,e){return e.definitions_.import_random="import random",["random.choice("+(e.valueToCode(this,"TUP",e.ORDER_ADDITIVE)||"mytup")+")",e.ORDER_ATOMIC]},ta=function(t,e){return["tuple("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+")",e.ORDER_ATOMIC]},ea=function(t,e){for(var i=e.variableDB_.getName(this.getFieldValue("VAR"),W.Variables.NAME_TYPE),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)n[s]=e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"0";return n=i+"= {"+n.join(", ")+"}\n",0==this.itemCount_&&(n=i+" = set()\n"),n},ia=function(t,e){return["len("+(e.valueToCode(this,"SET",e.ORDER_ASSIGNMENT)||"0")+")",e.ORDER_ATOMIC]},na=function(t,e){return[(e.valueToCode(this,"SET",e.ORDER_ASSIGNMENT)||"0")+".pop()",e.ORDER_ATOMIC]},sa=function(t,e){return(e.valueToCode(this,"SET",e.ORDER_ASSIGNMENT)||"0")+".clear()\n"},oa=function(t,e){var i=e.valueToCode(this,"SET1",e.ORDER_ASSIGNMENT)||"0",n=e.valueToCode(this,"SET2",e.ORDER_ASSIGNMENT)||"0";return[i+"."+this.getFieldValue("OPERATE")+"("+n+")",e.ORDER_ATOMIC]},_a=function(t,e){var i=e.valueToCode(this,"SET1",e.ORDER_ASSIGNMENT)||"0",n=e.valueToCode(this,"SET2",e.ORDER_ASSIGNMENT)||"0";return i+"."+this.getFieldValue("OPERATE")+"("+n+")\n"},ua=function(t,e){return(e.valueToCode(this,"SET",e.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("OPERATE")+"("+(e.valueToCode(this,"data",e.ORDER_ASSIGNMENT)||"0")+")\n"},aa=function(t,e){var i=e.valueToCode(this,"SET1",e.ORDER_ASSIGNMENT)||"0",n=e.valueToCode(this,"SET2",e.ORDER_ASSIGNMENT)||"0";return[i+"."+this.getFieldValue("OPERATE")+"("+n+")",e.ORDER_ATOMIC]},ra=function(t,e){return(e.valueToCode(this,"SET",e.ORDER_ASSIGNMENT)||"0")+".update("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+")\n"},pa=function(t,e){return["{"+this.getFieldValue("TEXT")+"}",e.ORDER_ATOMIC]},la=function(t,e){return["set("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||"0")+")",e.ORDER_ATOMIC]},Ia=function(t,e){return["'''<!DOCTYPE HTML>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n"+e.statementToCode(this,"HEAD")+"</head>\n<body>\n"+e.statementToCode(this,"BODY")+"</body>\n</html>\n'''",e.ORDER_ATOMIC]},Ta=function(t,e){var i=e.statementToCode(this,"DO"),n=this.getFieldValue("LEVEL");return"<h"+n+">\n"+i+"</h"+n+">\n"},da=function(t,e){var i=e.statementToCode(this,"DO"),n=this.getFieldValue("LEVEL");if("head"==n)var s="<"+n+'>\n\t<meta charset="utf-8">\n'+i+"</"+n+">\n";else s="<"+n+">\n"+i+"</"+n+">\n";return s},ha=function(t,e){var i=e.statementToCode(this,"DO"),n=this.getFieldValue("LEVEL");return"<"+n+">\n"+i+"</"+n+">\n"},Ma=function(t,e){var i=e.statementToCode(this,"DO"),n=e.valueToCode(this,"style"),s=this.getFieldValue("LEVEL");return"<"+s+" "+n+" >\n"+i+"</"+s+">\n"},ma=function(t,e){return['style="'+e.statementToCode(this,"STYLE")+'"',e.ORDER_ATOMIC]},ca=function(t,e){return'<input type="'+this.getFieldValue("LEVEL")+'" name="'+this.getFieldValue("NAME")+'" value="'+this.getFieldValue("VALUE")+'" '+(e.valueToCode(this,"style")||"")+" />"},Oa=function(){return this.getFieldValue("KEY")+":"+this.getFieldValue("VALUE")+";"},Ea=function(){return this.getFieldValue("TEXT")+"\n"},Ra=function(t){return t.getFieldValue("TEXT")+"\n"},ga=function(t,e){return[t.getFieldValue("TEXT"),e.ORDER_ATOMIC]},Ca=function(t,e){return(e.valueToCode(t,"VALUE",e.ORDER_ATOMIC)||"")+"\n"},Aa=function(){return""},La=function(t,e){return["type("+(e.valueToCode(t,"VALUE",e.ORDER_MEMBER)||"___")+")",e.ORDER_ATOMIC]},Sa=function(t,e){for(var i=t.getFieldValue("NAME"),n=t.hasReturn_,s=new Array(t.itemCount_),o=0;o<t.itemCount_;o++)s[o]=e.valueToCode(t,"ARGUMENT"+o,e.ORDER_NONE)||"___";var _=i+"("+s.join(", ")+")";return n?[_,e.ORDER_ATOMIC]:_+"\n"},Na=function(t,e){var i=e.valueToCode(t,"MODULE",e.ORDER_ATOMIC),n=e.valueToCode(t,"NAME",e.ORDER_ATOMIC);return[i+"."+(n=n.substring(1,n.length-1)),e.ORDER_NONE]},Da=new W.Generator("Python");Da.INDENT=" ",Da.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip"),Da.ORDER_ATOMIC=0,Da.ORDER_COLLECTION=1,Da.ORDER_STRING_CONVERSION=1,Da.ORDER_UNARY_POSTFIX=1,Da.ORDER_UNARY_PREFIX=2,Da.ORDER_MEMBER=2.1,Da.ORDER_FUNCTION_CALL=2.2,Da.ORDER_EXPONENTIATION=3,Da.ORDER_UNARY_SIGN=4,Da.ORDER_BITWISE_NOT=4,Da.ORDER_MULTIPLICATIVE=5,Da.ORDER_ADDITIVE=6,Da.ORDER_BITWISE_SHIFT=7,Da.ORDER_BITWISE_AND=8,Da.ORDER_BITWISE_XOR=9,Da.ORDER_BITWISE_OR=10,Da.ORDER_RELATIONAL=11,Da.ORDER_EQUALITY=11,Da.ORDER_LOGICAL_NOT=12,Da.ORDER_LOGICAL_AND=13,Da.ORDER_LOGICAL_OR=14,Da.ORDER_ASSIGNMENT=14,Da.ORDER_CONDITIONAL=15,Da.ORDER_LAMBDA=16,Da.ORDER_NONE=99,Da.ORDER_OVERRIDES=[[Da.ORDER_FUNCTION_CALL,Da.ORDER_MEMBER],[Da.ORDER_FUNCTION_CALL,Da.ORDER_FUNCTION_CALL],[Da.ORDER_MEMBER,Da.ORDER_MEMBER],[Da.ORDER_MEMBER,Da.ORDER_FUNCTION_CALL]],Da.init=function(){Da.PASS=this.INDENT+"pass\n",Da.definitions_=Object.create(null),Da.functionNames_=Object.create(null),Da.setups_=Object.create(null),Da.loops_=Object.create(null),Da.codeEnd_=Object.create(null),Da.variableDB_?Da.variableDB_.reset():Da.variableDB_=new q(Da.RESERVED_WORDS_)},Da.finish=function(t){""!==t&&(t=(t=t.replace(/\n/g,"\n")).replace(/\n\s+$/,"\n"));var e=[];for(var i in Da.definitions_)e.push(Da.definitions_[i]);var n=[];for(var i in Da.functions_)n.push(Da.functions_[i]);var s=[];for(var i in Da.setups_)s.push(Da.setups_[i]);0!==s.length&&s.push("\n");var o=[];for(var i in Da.loops_)o.push(Da.loops_[i]);var _=[];for(var i in Da.codeEnd_)_.push(Da.codeEnd_[i]);return 0!==_.length&&_.push("\n"),o.length>0?e.join("\n")+"\n"+n.join("\n")+"\n"+s.join("")+"\n"+t+"while True:\n"+o.join("")+_.join("\n"):e.join("\n")+"\n"+n.join("\n")+"\n"+s.join("")+"\n"+t+_.join("\n")},Da.scrubNakedValue=function(t){return t+"\n"},Da.quote_=function(t){var e="'";return-1!==(t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n")).indexOf("'")&&(-1===t.indexOf('"')?e='"':t=t.replace(/'/g,"\\'")),e+t+e},Da.multiline_quote_=function(t){return"'''"+(t=t.replace(/'''/g,"\\'\\'\\'"))+"'''"},Da.scrub_=function(t,e,i){var n="";if(!t.outputConnection||!t.outputConnection.targetConnection){(o=t.getCommentText())&&(o=W.utils.string.wrap(o,Da.COMMENT_WRAP-3),n+=Da.prefixLines(o+"\n","# "));for(var s=0;s<t.inputList.length;s++)if(t.inputList[s].type==W.INPUT_VALUE){var o,_=t.inputList[s].connection.targetBlock();if(_)(o=Da.allNestedComments(_))&&(n+=Da.prefixLines(o,"# "))}}var u=t.nextConnection&&t.nextConnection.targetBlock();return n+e+(i?"":Da.blockToCode(u))},Da.getAdjustedInt=function(t,e,i,n){var s=i||0;t.workspace.options.oneBasedIndex&&s--;var o=t.workspace.options.oneBasedIndex?"1":"0",_=s?Da.ORDER_ADDITIVE:Da.ORDER_NONE,u=Da.valueToCode(t,e,_)||o;return W.isNumber(u)?(u=parseInt(u,10)+s,n&&(u=-u)):(u=s>0?"int("+u+" + "+s+")":s<0?"int("+u+" - "+-s+")":"int("+u+")",n&&(u="-"+u)),u};const fa={microbit:{description:"microbit_python",digital:[["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]],pwm:[["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]],analog:[["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P10","10"]],interrupt:[["P0","0"],["P1","1"],["P2","2"]],button:[["A","button_a"],["B","button_b"]],axis:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"]],brightness:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"]],builtinimg:[["HEART","Image.HEART"],["HEART_SMALL","Image.HEART_SMALL"],["HAPPY","Image.HAPPY"],["SMILE","Image.SMILE"],["SAD","Image.SAD"],["CONFUSED","Image.CONFUSED"],["ANGRY","Image.ANGRY"],["ASLEEP","Image.ASLEEP"],["SURPRISED","Image.SURPRISED"],["SILLY","Image.SILLY"],["FABULOUS","Image.FABULOUS"],["MEH","Image.MEH"],["YES","Image.YES"],["NO","Image.NO"],["CLOCK12","Image.CLOCK12"],["CLOCK11","Image.CLOCK11"],["CLOCK10","Image.CLOCK10"],["CLOCK9","Image.CLOCK9"],["CLOCK8","Image.CLOCK8"],["CLOCK7","Image.CLOCK7"],["CLOCK6","Image.CLOCK6"],["CLOCK5","Image.CLOCK5"],["CLOCK4","Image.CLOCK4"],["CLOCK3","Image.CLOCK3"],["CLOCK2","Image.CLOCK2"],["CLOCK1","Image.CLOCK1"],["ARROW_N","Image.ARROW_N"],["ARROW_NE","Image.ARROW_NE"],["ARROW_E","Image.ARROW_E"],["ARROW_SE","Image.ARROW_SE"],["ARROW_S","Image.ARROW_S"],["ARROW_SW","Image.ARROW_SW"],["ARROW_W","Image.ARROW_W"],["ARROW_NW","Image.ARROW_NW"],["TRIANGLE","Image.TRIANGLE"],["TRIANGLE_LEFT","Image.TRIANGLE_LEFT"],["CHESSBOARD","Image.CHESSBOARD"],["DIAMOND","Image.DIAMOND"],["DIAMOND_SMALL","Image.DIAMOND_SMALL"],["SQUARE","Image.SQUARE"],["SQUARE_SMALL","Image.SQUARE_SMALL"],["RABBIT","Image.RABBIT"],["COW","Image.COW"],["MUSIC_CROTCHET","Image.MUSIC_CROTCHET"],["MUSIC_QUAVER","Image.MUSIC_QUAVER"],["MUSIC_QUAVERS","Image.MUSIC_QUAVERS"],["PITCHFORK","Image.PITCHFORK"],["XMAS","Image.XMAS"],["PACMAN","Image.PACMAN"],["TARGET","Image.TARGET"],["TSHIRT","Image.TSHIRT"],["ROLLERSKATE","Image.ROLLERSKATE"],["DUCK","Image.DUCK"],["HOUSE","Image.HOUSE"],["TORTOISE","Image.TORTOISE"],["BUTTERFLY","Image.BUTTERFLY"],["STICKFIGURE","Image.STICKFIGURE"],["GHOST","Image.GHOST"],["SWORD","Image.SWORD"],["GIRAFFE","Image.GIRAFFE"],["SKULL","Image.SKULL"],["UMBRELLA","Image.UMBRELLA"],["SNAKE","Image.SNAKE"],["ALL_CLOCKS","Image.ALL_CLOCKS"],["ALL_ARROWS","Image.ALL_ARROWS"]],imglist:[["ALL_CLOCKS","Image.ALL_CLOCKS"],["ALL_ARROWS","Image.ALL_ARROWS"]],tone_notes:[["NOTE_C3","131"],["NOTE_D3","147"],["NOTE_E3","165"],["NOTE_F3","175"],["NOTE_G3","196"],["NOTE_A3","220"],["NOTE_B3","247"],["NOTE_C4","262"],["NOTE_D4","294"],["NOTE_E4","330"],["NOTE_F4","349"],["NOTE_G4","392"],["NOTE_A4","440"],["NOTE_B4","494"],["NOTE_C5","523"],["NOTE_D5","587"],["NOTE_E5","659"],["NOTE_F5","698"],["NOTE_G5","784"],["NOTE_A5","880"],["NOTE_B5","988"]],serial_pin:[["P0","0"],["P1","1"],["P2","2"],["P8","8"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"]],radio_power:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"]],radio_datarate:[["1Mbit","RATE_1MBIT"],["250Kbit","RATE_250KBIT"],["2Mbit","RATE_2MBIT"]]}};fa["BBC micro:bit"]=fa.microbit;const Pa=fa,Fa=100,va={init:function(){this.jsonInit({colour:Fa,nextStatement:null,previousStatement:null,inputsInline:!0,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/music.html#built-in-melodies",message0:W.Msg.MIXLY_MICROBIT_Play_built_in_melody,args0:[{name:"melody",options:[["DADADADUM","DADADADUM"],["ENTERTAINER","ENTERTAINER"],["PRELUDE","PRELUDE"],["ODE","ODE"],["NYAN","NYAN"],["RINGTONE","RINGTONE"],["FUNK","FUNK"],["BLUES","BLUES"],["BIRTHDAY","BIRTHDAY"],["WEDDING","WEDDING"],["FUNERAL","FUNERAL"],["PUNCHLINE","PUNCHLINE"],["PYTHON","PYTHON"],["BADDY","BADDY"],["CHASE","CHASE"],["BA_DING","BA_DING"],["WAWAWAWAA","WAWAWAWAA"],["JUMP_UP","JUMP_UP"],["JUMP_DOWN","JUMP_DOWN"],["POWER_UP","POWER_UP"],["POWER_DOWN","POWER_DOWN"]],type:"field_dropdown"},{type:"input_value",name:"PIN"},{type:"input_dummy"},{checked:!0,type:"field_checkbox",name:"wait"},{type:"input_dummy"},{checked:!1,type:"field_checkbox",name:"loop"}]}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Play_built_in_melody1)}},Ya={init:function(){this.jsonInit({colour:Fa,nextStatement:null,previousStatement:null,inputsInline:!0,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/music.html#built-in-melodies",tooltip:"Play one of the built-in melodies. Indicate if you need to wait before continuing or continuously loop the melody.",message0:W.Msg.MIXLY_MICROBIT_Play_built_in_melody_easy,args0:[{name:"melody",options:[["DADADADUM","DADADADUM"],["ENTERTAINER","ENTERTAINER"],["PRELUDE","PRELUDE"],["ODE","ODE"],["NYAN","NYAN"],["RINGTONE","RINGTONE"],["FUNK","FUNK"],["BLUES","BLUES"],["BIRTHDAY","BIRTHDAY"],["WEDDING","WEDDING"],["FUNERAL","FUNERAL"],["PUNCHLINE","PUNCHLINE"],["PYTHON","PYTHON"],["BADDY","BADDY"],["CHASE","CHASE"],["BA_DING","BA_DING"],["WAWAWAWAA","WAWAWAWAA"],["JUMP_UP","JUMP_UP"],["JUMP_DOWN","JUMP_DOWN"],["POWER_UP","POWER_UP"],["POWER_DOWN","POWER_DOWN"]],type:"field_dropdown"},{type:"input_value",name:"PIN"},{type:"input_dummy"}]})}},ba={init:function(){this.setColour(Fa),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_TONE).appendField(W.Msg.MIXLY_PIN).setCheck(Number),this.appendValueInput("pitch").setCheck(Number).appendField(W.Msg.MIXLY_FREQUENCY),this.appendValueInput("duration").setCheck(Number).appendField(W.Msg.MIXLY_DURATION),this.appendDummyInput("").appendField(W.Msg.MIXLY_MILLIS).appendField(W.Msg.MIXLY_MICROBIT_WAIT),this.appendDummyInput("").appendField(new W.FieldCheckbox(!0),"wait"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_BLOCKGROUP_TONE2)}},Va={init:function(){this.setColour(Fa),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_TONE).appendField(W.Msg.MIXLY_PIN).setCheck(Number),this.appendValueInput("pitch").setCheck(Number).appendField(W.Msg.MIXLY_FREQUENCY),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_BLOCKGROUP_TONE)}},Xa={init:function(){this.jsonInit({colour:Fa,nextStatement:null,previousStatement:null,inputsInline:!0,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/music.html#musical-notation",message0:W.Msg.MIXLY_MICROBIT_Play_notes,args0:[{check:"List",type:"input_value",name:"notes"},{type:"input_value",name:"PIN"},{checked:!0,type:"field_checkbox",name:"wait"},{type:"input_dummy"},{checked:!1,type:"field_checkbox",name:"loop"}]}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Play_notes1)}},ya={init:function(){this.jsonInit({colour:Fa,nextStatement:null,previousStatement:null,inputsInline:!0,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/music.html#musical-notation",tooltip:"Play a list of notes expressed in the special music language. Indicate if you need to wait before continuing or continuously loop the melody.",message0:W.Msg.MIXLY_MICROBIT_Play_notes,args0:[{check:"List",type:"input_value",name:"notes"},{type:"input_value",name:"PIN"},{type:"input_dummy"},{type:"input_dummy"},{type:"input_dummy"}]})}},Ua={init:function(){this.jsonInit({colour:Fa,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/music.html#music.reset",message0:W.Msg.MIXLY_MICROBIT_Reset_music}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Reset_music)}},Ba={init:function(){this.setColour(Fa),this.appendValueInput("PIN").appendField(W.Msg.MIXLY_NOTONE).appendField(W.Msg.MIXLY_PIN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_NOTONE)}},Ga={init:function(){this.jsonInit({colour:Fa,output:"Array",helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/music.html#music.get_tempo",message0:W.Msg.MIXLY_MICROBIT_Get_current_tempo}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Get_current_tempo)}},wa={init:function(){this.setColour(Fa),this.appendValueInput("TICKS").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_SET_TEMPO).appendField(W.Msg.MICROBIT_ACTUATOR_ticks),this.appendValueInput("BPM").setCheck(Number).appendField(W.Msg.MIXLY_SPEED),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_SET_TEMPO1)}},ka={init:function(){this.setColour(Fa),this.appendValueInput("VAR").setCheck(String).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_SAY,"say"],[W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_SING,"sing"],[W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_PRENOUNCE,"pronounce"]]),"MODE"),this.appendValueInput("pitch").setCheck(Number).appendField(W.Msg.MICROBIT_SPEECH_pitch),this.appendValueInput("speed").setCheck(Number).appendField(W.Msg.MIXLY_SPEED),this.appendValueInput("mouth").setCheck(Number).appendField(W.Msg.MICROBIT_SPEECH_mouth),this.appendValueInput("throat").setCheck(Number).appendField(W.Msg.MICROBIT_SPEECH_throat),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("MODE"),i=W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH,n=W.Msg.MIXLY_MICROBIT_TYPE_STRING;return i+{say:W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_SAY,sing:W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_SING,pronounce:W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_PRENOUNCE}[e]+n}))}},Ha={init:function(){this.setColour(Fa),this.appendValueInput("VAR").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_SAY),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},xa={init:function(){this.setColour(Fa),this.appendValueInput("VAR").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_SING),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},Wa={init:function(){this.setColour(Fa),this.appendValueInput("VAR").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_PY_ACTUATOR_SPEECH_PRENOUNCE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},Ka={init:function(){this.setColour(Fa),this.appendValueInput("VAR").setCheck(String).appendField(W.Msg.MICROBIT_SPEECH_translation),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE+W.Msg.MIXLY_MICROBIT_TYPE_STRING+W.Msg.MICROBIT_SPEECH_translation)}},Ja={init:function(){this.setColour(Fa),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_SERVO).appendField(W.Msg.MIXLY_PIN).setCheck(Number),this.appendValueInput("DEGREE",Number).setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_DEGREE_0_180),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERVO_MOVE)}},ja={init:function(){this.appendValueInput("speed").setCheck(null).appendField(W.Msg.MIXLY_MOTOR).appendField(new W.FieldDropdown([["M1","1"],["M2","2"],["M3","3"],["M4","4"]]),"Motor").appendField(W.Msg.MIXLY_SPEED),this.appendDummyInput().appendField(new W.FieldDropdown([["Forward","1*"],["Reverse","-1*"]]),"mode"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Fa),this.setTooltip(""),this.setHelpUrl("")}},Qa={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.MIXLY_RGB),this.appendValueInput("PIN",Number).setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_PIN),this.appendValueInput("LEDCOUNT").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RGB_COUNT),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.MIXLY_RGB_PIN_COUNT)}},qa={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.MIXLY_RGB),this.appendValueInput("_LED_").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RGB_NUM),this.appendValueInput("RVALUE").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RGB_R),this.appendValueInput("GVALUE").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RGB_G),this.appendValueInput("BVALUE").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RGB_B),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(""),this.setTooltip(W.Msg.MIXLY_RGB_NUM_R_G_B)}},za={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.MIXLY_RGB),this.appendValueInput("_LED_").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RGB_NUM),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField(new W.FieldColour("#ff0000"),"RGB_LED_COLOR"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},Za={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.MIXLY_RGB),this.appendDummyInput().appendField(W.Msg.MIXLY_ESP32_RGB_WRITE),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(""),this.setTooltip(W.Msg.MIXLY_ESP32_MUSIC_WRI)}},$a={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.MIXLY_SETUP+" "+W.Msg.QJ00X_MP3),this.appendValueInput("RX").setAlign(W.inputs.Align.RIGHT).appendField("TX#"),this.appendValueInput("TX").setAlign(W.inputs.Align.RIGHT).appendField("RX#"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(),this.setHelpUrl()}};var tr=[[W.Msg.MIXLY_MP3_PLAY,"play"],[W.Msg.MIXLY_MP3_PAUSE,"pause"],[W.Msg.MIXLY_MP3_NEXT,"next_track"],[W.Msg.MIXLY_MP3_PREV,"prev_track"],[W.Msg.MIXLY_MP3_VOL_UP,"inc_vol"],[W.Msg.MIXLY_MP3_VOL_DOWN,"dec_vol"]];const er={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.QJ00X_MP3),this.appendDummyInput("").appendField(W.Msg.MIXLY_STAT).appendField(new W.FieldDropdown(tr),"CONTROL_TYPE"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(),this.setHelpUrl()}};var ir=[[W.Msg.MIXLY_MP3_LOOP_ALL,"0"],[W.Msg.MIXLY_MP3_LOOP_FOLDER,"1"],[W.Msg.MIXLY_MP3_LOOP_ONE,"2"],[W.Msg.MIXLY_MP3_LOOP_RAM,"3"]];const nr={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.QJ00X_MP3),this.appendDummyInput("").appendField(W.Msg.MIXLY_MP3_LOOP_MODE).appendField(W.Msg.MIXLY_STAT).appendField(new W.FieldDropdown(ir),"LOOP_MODE"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(),this.setHelpUrl()}};var sr=[[W.Msg.MIXLY_MP3_EQ_NORMAL,"0"],[W.Msg.MIXLY_MP3_EQ_POP,"1"],[W.Msg.MIXLY_MP3_EQ_ROCK,"2"],[W.Msg.MIXLY_MP3_EQ_JAZZ,"3"],[W.Msg.MIXLY_MP3_EQ_CLASSIC,"4"],[W.Msg.MIXLY_MP3_EQ_BASS,"5"]];const or={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.QJ00X_MP3),this.appendDummyInput("").appendField(W.Msg.MIXLY_MP3_EQ_MODE).appendField(W.Msg.MIXLY_STAT).appendField(new W.FieldDropdown(sr),"EQ_MODE"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(),this.setHelpUrl()}},_r={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.QJ00X_MP3),this.appendDummyInput("").appendField(W.Msg.MIXLY_MP3_VOL),this.appendValueInput("vol",Number).appendField(W.Msg.MIXLY_STAT).setCheck(Number),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(),this.setHelpUrl()}},ur={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.QJ00X_MP3),this.appendValueInput("NUM",Number).appendField(W.Msg.MIXLY_MP3_PLAY_NUM).setCheck(Number),this.appendDummyInput("").appendField("首"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(),this.setHelpUrl()}},ar={init:function(){this.setColour(Fa),this.appendDummyInput("").appendField(W.Msg.QJ00X_MP3),this.appendValueInput("FOLDER",Number).appendField(W.Msg.DFPLAYER_MINI_FOLDER).setCheck(Number),this.appendValueInput("NUM",Number).appendField(W.Msg.MIXLY_MP3_PLAY_NUM).setCheck(Number),this.appendDummyInput("").appendField("首"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(),this.setHelpUrl()}},rr=140,pr={init:function(){this.setColour(225),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_PY_COMMUNICATE_ON,"on"],[W.Msg.MIXLY_MICROBIT_PY_COMMUNICATE_OFF,"off"],[W.Msg.HTML_RESET,"reset"]]),"type").appendField(W.Msg.MIXLY_MICROBIT_PY_COMMUNICATE_WIFI),this.setInputsInline(!0),this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("type"),i=W.Msg.MIXLY_MICROBIT_PY_COMMUNICATE_WIFI;return{on:W.Msg.MIXLY_MICROBIT_PY_COMMUNICATE_ON,off:W.Msg.MIXLY_MICROBIT_PY_COMMUNICATE_OFF,reset:W.Blockly.Msg.HTML_RESET}[e]+i}))}},lr={init:function(){this.jsonInit({colour:225,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/radio.html#radio.on",tooltip:"Turn on the radio. This needs to be explicitly called since the radio draws power and takes up memory that you may otherwise need.",message0:W.Msg.MIXLY_MICROBIT_Switch_on_radio})}},Ir={init:function(){this.jsonInit({colour:225,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/radio.html#radio.off",tooltip:"Turn off the radio, thus saving power and memory.",message0:W.Msg.MIXLY_MICROBIT_Switch_off_radio})}},Tr={init:function(){this.jsonInit({colour:225,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/radio.html#radio.config",tooltip:W.Msg.MIXLY_MICROBIT_Configure_radio1,message0:W.Msg.MIXLY_MICROBIT_Configure_radio,args0:[{min:4,value:32,type:"input_value",max:251,name:"length"},{type:"input_dummy"},{min:1,value:3,type:"input_value",max:32,name:"queue"},{type:"input_dummy"},{min:0,value:7,type:"input_value",max:100,name:"channel"},{type:"input_dummy"},{name:"power",type:"input_value"},{type:"input_dummy"},{name:"address",type:"input_value"},{type:"input_dummy"},{name:"group",type:"input_value"},{type:"input_dummy"},{name:"data_rate",type:"input_value"}]})}},dr={init:function(){this.jsonInit({colour:225,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/radio.html#radio.reset",tooltip:"Reset the radio to default settings.",message0:W.Msg.MIXLY_MICROBIT_Reset_radio})}},hr={init:function(){this.jsonInit({colour:225,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/radio.html#radio.send",tooltip:"Broadcast a text message.",message0:W.Msg.MIXLY_MICROBIT_Send_message,args0:[{check:"String",type:"input_value",name:"message"}]})}},Mr={init:function(){this.setColour(225),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_RADIO_SEND),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_MSG,"send"],[W.Msg.MIXLY_MICROBIT_MSG_BYTE,"send_bytes"]]),"type"),this.appendValueInput("data"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_Send_message1)}},mr={init:function(){this.jsonInit({colour:225,output:"String",helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/radio.html#radio.receive",tooltip:W.Msg.MIXLY_MICROBIT_Receive_message,message0:W.Msg.MIXLY_MICROBIT_Receive_message})}},cr={init:function(){this.setColour(225),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_Receive_message),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_MSG,"receive"],[W.Msg.MIXLY_MICROBIT_MSG_BYTE,"receive_bytes"],[W.Msg.MIXLY_MICROBIT_MSG_FULL,"receive_full"]]),"type"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_Receive_message)}},Or={init:function(){this.setColour(rr),this.appendValueInput("RX",Number).appendField(W.Msg.MIXLY_MICROBIT_JS_I2C_SETUP).appendField("sda").setCheck(Number).setAlign(W.inputs.Align.RIGHT),this.appendValueInput("TX",Number).appendField("scl").setCheck(Number).setAlign(W.inputs.Align.RIGHT),this.appendValueInput("freq").setCheck(Number).appendField("频率").setAlign(W.inputs.Align.RIGHT),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0)}},Er={init:function(){this.setColour(rr),this.appendValueInput("address").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_I2C_READ_ADDRESS),this.appendValueInput("data").setCheck(Number).appendField(W.Msg.LANG_MATH_BYTE),this.appendDummyInput().appendField(W.Msg.CONTROLS_REPEAT_TITLE_REPEAT).appendField(new W.FieldCheckbox(!1),"is_repeated"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_I2C_READ)}},Rr={init:function(){this.setColour(rr),this.appendValueInput("address").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_I2C_WRITE_ADDRESS),this.appendValueInput("data").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_I2C_VALUE),this.appendDummyInput().appendField(W.Msg.CONTROLS_REPEAT_TITLE_REPEAT).appendField(new W.FieldCheckbox(!1),"is_repeated"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_I2C_WRITE)}},gr={init:function(){this.jsonInit({colour:rr,nextStatement:null,previousStatement:null,message0:W.Msg.MIXLY_MICROBIT_SPI_INIT,args0:[{value:1e6,type:"field_number",name:"freq"},{type:"input_dummy"},{value:8,type:"field_number",name:"bits"},{type:"input_dummy"},{value:0,type:"field_number",name:"mode"},{type:"input_dummy"},{name:"mosi",options:K.Profile.default.digital,type:"field_dropdown"},{name:"miso",options:K.Profile.default.digital,type:"field_dropdown"},{name:"sck",options:K.Profile.default.digital,type:"field_dropdown"}]}),this.setFieldValue("15","mosi"),this.setFieldValue("14","miso"),this.setFieldValue("13","sck")}},Cr={init:function(){this.setColour(rr),this.appendValueInput("data").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_SPI_WRITE),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_SPI_WRITE)}},Ar=180,Lr={init:function(){this.jsonInit({colour:Ar,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.clear",message0:W.Msg.MIXLY_MICROBIT_Clear_display}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Clear_display)}},Sr={init:function(){this.setColour(Ar),this.appendValueInput("x").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_GET).appendField(W.Msg.MIXLY_BRIGHTNESS).appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_GET_POINT_X),this.appendValueInput("y").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_PLOT_POINT_Y),this.setInputsInline(!0),this.setOutput(!0,Number),this.setTooltip(W.Msg.MIXLY_BRIGHTNESS1)}},Nr={init:function(){this.setColour(Ar),this.appendValueInput("x").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_SET_BRIGHTNESS).appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_GET_POINT_X),this.appendValueInput("y").setCheck(Number).appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_PLOT_POINT_Y),this.appendValueInput("brightness").setCheck(Number).appendField(W.Msg.MIXLY_BRIGHTNESS),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_BRIGHTNESS2)}},Dr={init:function(){this.setColour(Ar),this.appendValueInput("data").setCheck([String,"microbit_image"]).appendField(W.Msg.MIXLY_MICROBIT_SHOW_IMAGE_OR_STRING),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_SHOW_IMAGE_OR_STRING)}},fr={init:function(){this.setColour(Ar),this.appendValueInput("data").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_STRING),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0)}},Pr={init:function(){this.setColour(Ar),this.appendValueInput("data").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_STRING),this.appendValueInput("delay").setCheck(null).appendField(W.Msg.MIXLY_DELAY),this.appendDummyInput().appendField(W.Msg.MIXLY_MILLIS),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0)}},Fr={init:function(){this.setColour(Ar),this.appendValueInput("PIN",String).setCheck("microbit_image").appendField(W.Msg.OLED_BITMAP),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.OLED_BITMAP)}},vr={init:function(){this.jsonInit({colour:Ar,InputsInline:!0,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.show",tooltip:"Show the referenced image on the display.",message0:W.Msg.OLED_BITMAP,args0:[{name:"image",options:[["HEART","HEART"],["HEART_SMALL","HEART_SMALL"],["HAPPY","HAPPY"],["SMILE","SMILE"],["SAD","SAD"],["CONFUSED","CONFUSED"],["ANGRY","ANGRY"],["ASLEEP","ASLEEP"],["SURPRISED","SURPRISED"],["SILLY","SILLY"],["FABULOUS","FABULOUS"],["MEH","MEH"],["YES","YES"],["NO","NO"],["CLOCK12","CLOCK12"],["CLOCK11","CLOCK11"],["CLOCK10","CLOCK10"],["CLOCK9","CLOCK9"],["CLOCK8","CLOCK8"],["CLOCK7","CLOCK7"],["CLOCK6","CLOCK6"],["CLOCK5","CLOCK5"],["CLOCK4","CLOCK4"],["CLOCK3","CLOCK3"],["CLOCK2","CLOCK2"],["CLOCK1","CLOCK1"],["ARROW_N","ARROW_N"],["ARROW_NE","ARROW_NE"],["ARROW_E","ARROW_E"],["ARROW_SE","ARROW_SE"],["ARROW_S","ARROW_S"],["ARROW_SW","ARROW_SW"],["ARROW_W","ARROW_W"],["ARROW_NW","ARROW_NW"],["TRIANGLE","TRIANGLE"],["TRIANGLE_LEFT","TRIANGLE_LEFT"],["CHESSBOARD","CHESSBOARD"],["DIAMOND","DIAMOND"],["DIAMOND_SMALL","DIAMOND_SMALL"],["SQUARE","SQUARE"],["SQUARE_SMALL","SQUARE_SMALL"],["RABBIT","RABBIT"],["COW","COW"],["MUSIC_CROTCHET","MUSIC_CROTCHET"],["MUSIC_QUAVER","MUSIC_QUAVER"],["MUSIC_QUAVERS","MUSIC_QUAVERS"],["PITCHFORK","PITCHFORK"],["XMAS","XMAS"],["PACMAN","PACMAN"],["TARGET","TARGET"],["TSHIRT","TSHIRT"],["ROLLERSKATE","ROLLERSKATE"],["DUCK","DUCK"],["HOUSE","HOUSE"],["TORTOISE","TORTOISE"],["BUTTERFLY","BUTTERFLY"],["STICKFIGURE","STICKFIGURE"],["GHOST","GHOST"],["SWORD","SWORD"],["GIRAFFE","GIRAFFE"],["SKULL","SKULL"],["UMBRELLA","UMBRELLA"],["SNAKE","SNAKE"],["ALL_CLOCKS","ALL_CLOCKS"],["ALL_ARROWS","ALL_ARROWS"]],type:"field_dropdown"}]})}},Yr={init:function(){this.jsonInit({colour:Ar,inputsInline:!0,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.show",message0:W.Msg.MIXLY_MICROBIT_Animate_images_or_string,args0:[{check:[String,"List"],type:"input_value",name:"images"},{type:"input_value",name:"delay"},{type:"input_dummy"},{checked:!0,type:"field_checkbox",name:"wait"},{type:"input_dummy"},{checked:!1,type:"field_checkbox",name:"loop"},{type:"input_dummy"},{checked:!1,type:"field_checkbox",name:"clear"}]}),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_MONITOR_SHOW_delay+W.Msg.MIXLY_MICROBIT_Animate_images1)}},br={init:function(){this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_STRING),this.jsonInit({colour:Ar,inputsInline:!0,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.show",tooltip:"Display the list of images as an animation with a certain delay between each frame. Indicate if you need to wait before continuing, continuously loop the animation and clear the display when finished.",message0:W.Msg.MIXLY_MICROBIT_SHOW_STRING,args0:[{check:String,type:"input_value",name:"images"},{type:"input_value",name:"delay"},{type:"input_dummy"},{checked:!0,type:"field_checkbox",name:"wait"},{type:"input_dummy"},{checked:!1,type:"field_checkbox",name:"loop"},{type:"input_dummy"},{checked:!1,type:"field_checkbox",name:"clear"}]}),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_STRING)}},Vr={init:function(){this.jsonInit({colour:Ar,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.scroll",tooltip:"Scroll the referenced text across the display.",message0:W.Msg.MIXLY_MICROBIT_Scroll_message,args0:[{check:"String",type:"input_value",name:"message"}]})}},Xr={init:function(){this.setColour(Ar),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_Turn_on_display,"on"],[W.Msg.MIXLY_MICROBIT_Turn_off_display,"off"]]),"on_off").appendField(W.Msg.MIXLY_MICROBIT_monitor),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("on_off"),i=W.Msg.MIXLY_MICROBIT_monitor;return{on:W.Msg.MIXLY_MICROBIT_Turn_on_display,off:W.Msg.MIXLY_MICROBIT_Turn_off_display}[e]+i}))}},yr={init:function(){this.jsonInit({colour:Ar,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.off",tooltip:"Turn off the display.",message0:W.Msg.MIXLY_MICROBIT_Turn_off_display})}},Ur={init:function(){this.jsonInit({colour:Ar,output:"Boolean",helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.is_on",message0:W.Msg.MIXLY_MICROBIT_Display_is_on}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Display_is_on1)}},Br={init:function(){this.jsonInit({colour:Ar,args0:[{name:"image",options:[["HEART","HEART"],["HEART_SMALL","HEART_SMALL"],["HAPPY","HAPPY"],["SMILE","SMILE"],["SAD","SAD"],["CONFUSED","CONFUSED"],["ANGRY","ANGRY"],["ASLEEP","ASLEEP"],["SURPRISED","SURPRISED"],["SILLY","SILLY"],["FABULOUS","FABULOUS"],["MEH","MEH"],["YES","YES"],["NO","NO"],["CLOCK12","CLOCK12"],["CLOCK11","CLOCK11"],["CLOCK10","CLOCK10"],["CLOCK9","CLOCK9"],["CLOCK8","CLOCK8"],["CLOCK7","CLOCK7"],["CLOCK6","CLOCK6"],["CLOCK5","CLOCK5"],["CLOCK4","CLOCK4"],["CLOCK3","CLOCK3"],["CLOCK2","CLOCK2"],["CLOCK1","CLOCK1"],["ARROW_N","ARROW_N"],["ARROW_NE","ARROW_NE"],["ARROW_E","ARROW_E"],["ARROW_SE","ARROW_SE"],["ARROW_S","ARROW_S"],["ARROW_SW","ARROW_SW"],["ARROW_W","ARROW_W"],["ARROW_NW","ARROW_NW"],["TRIANGLE","TRIANGLE"],["TRIANGLE_LEFT","TRIANGLE_LEFT"],["CHESSBOARD","CHESSBOARD"],["DIAMOND","DIAMOND"],["DIAMOND_SMALL","DIAMOND_SMALL"],["SQUARE","SQUARE"],["SQUARE_SMALL","SQUARE_SMALL"],["RABBIT","RABBIT"],["COW","COW"],["MUSIC_CROTCHET","MUSIC_CROTCHET"],["MUSIC_QUAVER","MUSIC_QUAVER"],["MUSIC_QUAVERS","MUSIC_QUAVERS"],["PITCHFORK","PITCHFORK"],["XMAS","XMAS"],["PACMAN","PACMAN"],["TARGET","TARGET"],["TSHIRT","TSHIRT"],["ROLLERSKATE","ROLLERSKATE"],["DUCK","DUCK"],["HOUSE","HOUSE"],["TORTOISE","TORTOISE"],["BUTTERFLY","BUTTERFLY"],["STICKFIGURE","STICKFIGURE"],["GHOST","GHOST"],["SWORD","SWORD"],["GIRAFFE","GIRAFFE"],["SKULL","SKULL"],["UMBRELLA","UMBRELLA"],["SNAKE","SNAKE"],["ALL_CLOCKS","ALL_CLOCKS"],["ALL_ARROWS","ALL_ARROWS"]],type:"field_dropdown"}],output:["microbit_image","List"],helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/image.html#attributes",tooltip:W.Msg.MIXLY_MICROBIT_Built_in_image1,message0:W.Msg.MIXLY_MICROBIT_Built_in_image})}},Gr={init:function(){this.jsonInit({colour:Ar,args0:[{check:["microbit_image","List",String],type:"input_value",name:"image"}],output:"microbit_image",helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/image.html#microbit.Image.copy",message0:W.Msg.MIXLY_MICROBIT_Copy_image}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Copy_image1)}},wr={init:function(){this.jsonInit({colour:Ar,args0:[{check:["microbit_image","List",String],type:"input_value",name:"image"}],output:"microbit_image",helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/image.html#microbit.Image.invert",message0:W.Msg.MIXLY_MICROBIT_Invert_image}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Invert_image1)}},kr={init:function(){this.jsonInit({colour:Ar,args0:[{type:"input_dummy"},{colour:"#000000",type:"field_colour",name:"00"},{colour:"#000000",type:"field_colour",name:"01"},{colour:"#000000",type:"field_colour",name:"02"},{colour:"#000000",type:"field_colour",name:"03"},{colour:"#000000",type:"field_colour",name:"04"},{type:"input_dummy"},{colour:"#000000",type:"field_colour",name:"10"},{colour:"#000000",type:"field_colour",name:"11"},{colour:"#000000",type:"field_colour",name:"12"},{colour:"#000000",type:"field_colour",name:"13"},{colour:"#000000",type:"field_colour",name:"14"},{type:"input_dummy"},{colour:"#000000",type:"field_colour",name:"20"},{colour:"#000000",type:"field_colour",name:"21"},{colour:"#000000",type:"field_colour",name:"22"},{colour:"#000000",type:"field_colour",name:"23"},{colour:"#000000",type:"field_colour",name:"24"},{type:"input_dummy"},{colour:"#000000",type:"field_colour",name:"30"},{colour:"#000000",type:"field_colour",name:"31"},{colour:"#000000",type:"field_colour",name:"32"},{colour:"#000000",type:"field_colour",name:"33"},{colour:"#000000",type:"field_colour",name:"34"},{type:"input_dummy"},{colour:"#000000",type:"field_colour",name:"40"},{colour:"#000000",type:"field_colour",name:"41"},{colour:"#000000",type:"field_colour",name:"42"},{colour:"#000000",type:"field_colour",name:"43"},{colour:"#000000",type:"field_colour",name:"44"}],output:"microbit_image",helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/image.html#microbit.Image",message0:W.Msg.MIXLY_MICROBIT_Create_image}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Create_image1)}},Hr={init:function(){var t=[[W.Msg.MIXLY_UP,"up"],[W.Msg.MIXLY_DOWN,"down"],[W.Msg.MIXLY_LEFT,"left"],[W.Msg.MIXLY_RIGHT,"right"]];this.setColour(Ar),this.setOutput(!0,"microbit_image"),this.setInputsInline(!0),this.appendValueInput("img").appendField(W.Msg.DISPLAY_IMAGE_LET).setCheck(["microbit_image","List",String]),this.appendDummyInput("").appendField(W.Msg.DISPLAY_IMAGE_LET2).appendField(new W.FieldDropdown(t),"OP"),this.appendValueInput("val").appendField(W.Msg.DISPLAY_IMAGE_SHIFT).setCheck(Number),this.appendDummyInput("").appendField(W.Msg.DISPLAY_IMAGE_UNIT);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP"),i=W.Msg.DISPLAY_IMAGE_LET,n=W.Msg.DISPLAY_IMAGE_LET2,s=W.Msg.DISPLAY_IMAGE_LET3;return i+n+{up:W.Msg.MIXLY_UP,down:W.Msg.MIXLY_DOWN,left:W.Msg.MIXLY_LEFT,right:W.Msg.MIXLY_RIGHT}[t]+s}))}},xr={init:function(){var t=[[W.Msg.MICROBIT_DISPLAY_UNION,"+"],[W.Msg.MICROBIT_DISPLAY_MINUS,"-"]];this.setColour(Ar),this.setOutput(!0,"microbit_image"),this.appendValueInput("A").appendField(W.Msg.MICROBIT_DISPLAY_MERGE_SHAPE),this.appendValueInput("B").appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{"+":W.Msg.MIXLY_MICROBIT_image_add,"-":W.Msg.MIXLY_MICROBIT_image_reduce}[t]}))}},Wr={init:function(){this.setColour(Ar),this.appendValueInput("TEXT",String).setCheck([String,Number]).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_DF_LCD).appendField("mylcd").appendField(W.Msg.MIXLY_LCD_PRINT1),this.appendValueInput("TEXT2",String).setCheck([String,Number]).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_LCD_PRINT2),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.MIXLY_LCD_PRINT4_TOOLTIP)}},Kr={init:function(){this.setColour(Ar),this.appendValueInput("device").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_SETUP).appendField(W.Msg.MIXLY_DF_LCD).appendField("1602").appendField("mylcd").appendField(W.Msg.MIXLY_LCD_ADDRESS),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_SETUP+W.Msg.MIXLY_DF_LCD+W.Msg.MIXLY_LCD_ADDRESS)}},Jr={init:function(){this.setColour(Ar),this.appendValueInput("row",Number).setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_DF_LCD).appendField("mylcd").appendField(W.Msg.MIXLY_LCD_ROW),this.appendValueInput("column",Number).setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_LCD_COLUMN),this.appendValueInput("TEXT",String).setCheck([String,Number]).setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_LCD_PRINT),this.setPreviousStatement(!0,null),this.setInputsInline(!0),this.setNextStatement(!0,null),this.setTooltip(W.Msg.MIXLY_LCD_PRINT3_TOOLTIP)}},jr={init:function(){this.setColour(Ar),this.appendDummyInput().appendField(W.Msg.MIXLY_DF_LCD).appendField("mylcd").appendField(new W.FieldDropdown([[W.Msg.MIXLY_ON,"on()"],[W.Msg.MIXLY_OFF,"off()"],[W.Msg.MIXLY_LCD_STAT_CLEAR,"clear()"],[W.Msg.MIXLY_LCD_NOBACKLIGHT,"backlight(False)"],[W.Msg.MIXLY_LCD_BACKLIGHT,"backlight(True)"]]),"STAT"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null);var t=this;this.setTooltip((function(){var e=t.getFieldValue("STAT");return W.Msg.LISTS_SET_INDEX_SET+W.Msg.MIXLY_DF_LCD+{"on()":W.Msg.MIXLY_ON,"off()":W.Msg.MIXLY_OFF,"clear()":W.Msg.MIXLY_LCD_STAT_CLEAR,"backlight(off)":W.Msg.MIXLY_LCD_NOBACKLIGHT,"backlight(on)":W.Msg.MIXLY_LCD_BACKLIGHT}[e]}))}},Qr={init:function(){this.appendDummyInput().appendField(W.Msg.MIXLY_DF_LCD+" OLED "+W.Msg.OLEDDISPLAY),this.appendValueInput("Text_line1","String").setAlign(W.inputs.Align.RIGHT).appendField("(128*64) "+W.Msg.line1),this.appendValueInput("Text_line2","String").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.line2),this.appendValueInput("Text_line3","String").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.line3),this.appendValueInput("Text_line4","String").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.line4),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(Ar),this.setTooltip(W.Msg.MIXLY_DF_LCD+W.Msg.OLEDDISPLAY+W.Msg.MIXLY_MICROBIT_TYPE_STRING)}},qr={init:function(){var t=[[W.Msg.MIXLY_HEIGHT,"height"],[W.Msg.MIXLY_WIDTH,"width"]];this.setColour(Ar),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+W.Msg.MIXLY_MICROBIT_IMAGE),this.appendValueInput("VAR").setCheck("microbit_image"),this.appendDummyInput("").appendField(new W.FieldDropdown(t),"OP"),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+W.Msg.MIXLY_MICROBIT_IMAGE+{height:W.Msg.MIXLY_HEIGHT,width:W.Msg.MIXLY_WIDTH}[t]}))}},zr={init:function(){this.setColour(Ar),this.appendValueInput("SUB"),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_LCD_STAT_CLEAR,"0"],[W.Msg.MIXLY_HANDBIT_DISLPAY_OLED_FILL,"1"]]),"key"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("key"),i={0:W.Msg.MIXLY_LCD_STAT_CLEAR,1:W.Msg.MIXLY_HANDBIT_DISLPAY_OLED_FILL};return W.Msg.MIXLY_DF_LCD+i[e]}))}},Zr="#777777",$r={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField("from ").appendField(new W.FieldTextInput("microbit"),"path").appendField(" import ").appendField(new W.FieldTextInput("*"),"module"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},tp={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField("import ").appendField(new W.FieldTextInput("module"),"module"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ep={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldTextInput("my_function"),"NAME"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:function(){var t=document.createElement("mutation");t.setAttribute("items",this.itemCount_);for(var e=0;e<this.arguments_.length;e++){var i=document.createElement("arg");i.setAttribute("name",this.arguments_[e]),t.appendChild(i)}return t},domToMutation:function(t){this.arguments_=[];for(var e=0;t.childNodes[e];e++){let i=t.childNodes[e];"arg"==i.nodeName.toLowerCase()&&this.arguments_.push(i.getAttribute("name"))}this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("factory_create_with_container");e.initSvg();for(var i=e.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var s=t.newBlock("factory_create_with_item");s.initSvg(),s.setFieldValue(this.arguments_[n],"NAME"),i.connect(s.previousConnection),i=s.nextConnection}return e},compose:function(t){this.arguments_=[];for(var e=t.getInputTargetBlock("STACK"),i=[],n=0;e;)this.arguments_.push(e.getFieldValue("NAME")),i[n]=e.valueConnection_,e=e.nextConnection&&e.nextConnection.targetBlock(),n++;this.itemCount_=n,this.updateShape_();for(n=0;n<this.itemCount_;n++)i[n]&&this.getInput("ADD"+n).connection.connect(i[n])},saveConnections:function(t){for(var e=t.getInputTargetBlock("STACK"),i=0;e;){var n=this.getInput("ADD"+i);e.valueConnection_=n&&n.connection.targetConnection,i++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var t=0;this.getInput("ADD"+t);)this.removeInput("ADD"+t),t++;for(t=0;t<this.itemCount_;t++)this.appendValueInput("ADD"+t).setAlign(W.inputs.Align.RIGHT).appendField(this.arguments_[t])}},ip={init:function(){this.setColour(Zr),this.appendDummyInput().appendField(W.Msg.MIXLY_PARAMS),this.appendStatementInput("STACK"),this.contextMenu=!1}},np={init:function(){this.setColour(Zr),this.appendDummyInput().appendField(W.Msg.LISTS_CREATE_WITH_ITEM_TITLE+":").appendField(new W.FieldTextInput("x"),"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.contextMenu=!1}},sp={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldTextInput("my_function"),"NAME"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setOutput(!0),this.setMutator(new W.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:ep.mutationToDom,domToMutation:ep.domToMutation,decompose:ep.decompose,compose:ep.compose,saveConnections:ep.saveConnections,updateShape_:ep.updateShape_},op={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldTextInput("test"),"NAME").appendField("=").appendField(new W.FieldTextInput("Test"),"TYPE").appendField("()"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},_p={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldTextInput("test"),"NAME").appendField(".").appendField(new W.FieldTextInput("callMethod"),"METHOD"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new W.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:ep.mutationToDom,domToMutation:ep.domToMutation,decompose:ep.decompose,compose:ep.compose,saveConnections:ep.saveConnections,updateShape_:ep.updateShape_},up={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldTextInput("test"),"NAME").appendField(".").appendField(new W.FieldTextInput("callMethod"),"METHOD"),this.itemCount_=1,this.arguments_=["x"],this.updateShape_(),this.setOutput(!0),this.setMutator(new W.icons.MutatorIcon(["factory_create_with_item"],this))},mutationToDom:ep.mutationToDom,domToMutation:ep.domToMutation,decompose:ep.decompose,compose:ep.compose,saveConnections:ep.saveConnections,updateShape_:ep.updateShape_},ap={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldTextInput('display.scroll("Hello World!")'),"VALUE"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},rp={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldTextInput("test"),"VALUE"),this.setOutput(!0)}},pp={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldMultilineInput('display.scroll("Hello World!")\ndisplay.scroll("Hello Mixly!")'),"VALUE"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},lp={init:function(){this.setColour(Zr),this.appendDummyInput("").appendField(new W.FieldMultilineInput("Hello\nMixly"),"VALUE"),this.setOutput(!0)}},Ip=20,Tp={init:function(){this.setColour(Ip),this.appendDummyInput("").appendField(new W.FieldDropdown([[W.Msg.MIXLY_HIGH,"HIGH"],[W.Msg.MIXLY_LOW,"LOW"]]),"BOOL"),this.setOutput(!0,Boolean),this.setTooltip(W.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW)}},dp={init:function(){this.setColour(Ip),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_DIGITALREAD_PIN).setCheck(Number),this.setInputsInline(!0),this.setOutput(!0,[Boolean,Number]),this.setTooltip(W.Msg.MIXLY_TOOLTIP_INOUT_DIGITAL_READ)}},hp={init:function(){this.setColour(Ip),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_ANALOGWRITE_PIN).setCheck(Number),this.appendValueInput("NUM",Number).appendField(W.Msg.MIXLY_VALUE2).setCheck(Number),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_WRITE_PY)}},Mp={init:function(){this.setColour(Ip),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_ANALOGWRITE_PIN).setCheck(Number),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_PERIOD_MIL).appendField(new W.FieldDropdown([[W.Msg.MIXLY_mSecond,"period"],[W.Msg.MIXLY_uSecond,"period_microseconds"]]),"key"),this.appendValueInput("NUM",Number).appendField(W.Msg.MIXLY_STAT).setCheck(Number),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_WRITE_SET)}},mp={init:function(){this.setColour(Ip),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_ANALOGREAD_PIN).setCheck(Number),this.setInputsInline(!0),this.setOutput(!0,Number),this.setTooltip(W.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_READ)}},cp={init:function(){this.setColour(Ip),this.appendValueInput("pin").appendField(W.Msg.MIXLY_PIN),this.appendDummyInput().appendField(W.Msg.MIXLY_IS_TOUCHED),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_sensor_pin_pressed)}},Op={init:function(){this.setColour(Ip),this.appendValueInput("PIN",Number).appendField(W.Msg.MIXLY_DIGITALWRITE_PIN).setCheck(Number),this.appendValueInput("STAT").appendField(W.Msg.MIXLY_STAT).setCheck([Number,Boolean]),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.LANG_INOUT_DIGITAL_WRITE_TOOLTIP)}},Ep=230,Rp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.digital),"PIN"),this.setOutput(!0,Number)}},gp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.analog),"PIN"),this.setOutput(!0,Number)}},Cp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.button),"PIN"),this.setOutput(!0,Number)}},Ap={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.pwm),"PIN"),this.setOutput(!0,Number)}},Lp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.interrupt),"PIN"),this.setOutput(!0,Number)}},Sp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.serial_pin),"PIN"),this.setOutput(!0,Number)}},Np={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.builtinimg),"PIN"),this.setOutput(!0,"microbit_image")}},Dp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.imglist),"PIN"),this.setOutput(!0)}},fp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.axis),"PIN"),this.setOutput(!0,Number)}},Pp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.brightness),"PIN"),this.setOutput(!0,Number)}},Fp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.tone_notes),"PIN"),this.setOutput(!0,Number)}},vp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.radio_power),"PIN"),this.setOutput(!0,Number)}},Yp={init:function(){this.setColour(Ep),this.appendDummyInput("").appendField(new W.FieldDropdown(K.Profile.default.radio_datarate),"PIN"),this.setOutput(!0,Number)}},bp=40,Vp={init:function(){this.setColour(bp),this.appendValueInput("btn").appendField(W.Msg.MIXLY_BUTTON).setCheck(Number),this.appendDummyInput().appendField(W.Msg.MIXLY_IS_PRESSED),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_SENOR_IS_PRESSED)}},Xp={init:function(){this.setColour(bp),this.appendValueInput("btn").appendField(W.Msg.MIXLY_BUTTON).setCheck(Number),this.appendDummyInput().appendField(W.Msg.MIXLY_WAS_PRESSED),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_SENOR_WAS_PRESSED)}},yp={init:function(){this.setColour(bp),this.appendValueInput("btn").appendField(W.Msg.MIXLY_BUTTON).setCheck(Number),this.appendDummyInput().appendField(W.Msg.MIXLY_GET_PRESSES),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(W.Msg.PROCEDURES_DEFRETURN_RETURN+W.Msg.MIXLY_BUTTON+W.Msg.MIXLY_GET_PRESSES)}},Up={init:function(){this.setColour(bp),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_Current_gesture).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_shake,"shake"],[W.Msg.MIXLY_UP,"up"],[W.Msg.MIXLY_DOWN,"down"],[W.Msg.MIXLY_LEFT,"left"],[W.Msg.MIXLY_RIGHT,"right"],[W.Msg.MIXLY_MICROBIT_face_up,"face up"],[W.Msg.MIXLY_MICROBIT_face_down,"face down"],[W.Msg.MIXLY_MICROBIT_freefall,"freefall"],["3g","3g"],["6g","6g"],["8g","8g"]]),"gesture"),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("gesture"),i=W.Msg.MIXLY_MICROBIT_JS_CURRENT,n=W.Msg.MSG.catSensor,s=W.Msg.MIXLY_MICROBIT_JS_STATE,o=W.Msg.MIXLY_MICROBIT_PERFORMANCE;return i+n+s+{shake:W.Msg.MIXLY_MICROBIT_shake,up:W.Msg.MIXLY_UP,down:W.Msg.MIXLY_DOWN,left:W.Msg.MIXLY_LEFT,right:W.Msg.MIXLY_RIGHT,"face up":W.Msg.MIXLY_MICROBIT_face_up,"face down":W.Msg.MIXLY_MICROBIT_face_down,freefall:W.Msg.MIXLY_MICROBIT_freefall,"3g":"3g","6g":"6g","8g":"8g"}[e]+o}))}},Bp={init:function(){this.setColour(bp),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_JS_WAS_GESTURE).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_shake,"shake"],[W.Msg.MIXLY_UP,"up"],[W.Msg.MIXLY_DOWN,"down"],[W.Msg.MIXLY_LEFT,"left"],[W.Msg.MIXLY_RIGHT,"right"],[W.Msg.MIXLY_MICROBIT_face_up,"face up"],[W.Msg.MIXLY_MICROBIT_face_down,"face down"],[W.Msg.MIXLY_MICROBIT_freefall,"freefall"],["3g","3g"],["6g","6g"],["8g","8g"]]),"gesture"),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("gesture"),i=W.Msg.MIXLY_MICROBIT_JS_CURRENT,n=W.Msg.MSG.catSensor,s=W.Msg.MIXLY_MICROBIT_JS_STATE,o=W.Msg.MIXLY_MICROBIT_PERFORMANCE;return i+n+s+{shake:W.Msg.MIXLY_MICROBIT_shake,up:W.Msg.MIXLY_UP,down:W.Msg.MIXLY_DOWN,left:W.Msg.MIXLY_LEFT,right:W.Msg.MIXLY_RIGHT,"face up":W.Msg.MIXLY_MICROBIT_face_up,"face down":W.Msg.MIXLY_MICROBIT_face_down,freefall:W.Msg.MIXLY_MICROBIT_freefall,"3g":"3g","6g":"6g","8g":"8g"}[e]+o}))}},Gp={init:function(){this.setColour(bp),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_shake,"shake"],[W.Msg.MIXLY_UP,"up"],[W.Msg.MIXLY_DOWN,"down"],[W.Msg.MIXLY_LEFT,"left"],[W.Msg.MIXLY_RIGHT,"right"],[W.Msg.MIXLY_MICROBIT_face_up,"face up"],[W.Msg.MIXLY_MICROBIT_face_down,"face down"],[W.Msg.MIXLY_MICROBIT_freefall,"freefall"],["3g","3g"],["6g","6g"],["8g","8g"]]),"gesture"),this.appendStatementInput("DO").appendField(W.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("gesture"),i=W.Msg.MIXLY_MICROBIT_JS_CURRENT,n=W.Msg.MSG.catSensor,s=W.Msg.MIXLY_MICROBIT_JS_STATE,o=W.Msg.MIXLY_MICROBIT_PERFORMANCE;return i+n+s+{shake:W.Msg.MIXLY_MICROBIT_shake,up:W.Msg.MIXLY_UP,down:W.Msg.MIXLY_DOWN,left:W.Msg.MIXLY_LEFT,right:W.Msg.MIXLY_RIGHT,"face up":W.Msg.MIXLY_MICROBIT_face_up,"face down":W.Msg.MIXLY_MICROBIT_face_down,freefall:W.Msg.MIXLY_MICROBIT_freefall,"3g":"3g","6g":"6g","8g":"8g"}[e]+o}))}},wp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_shake,"shake"],[W.Msg.MIXLY_UP,"up"],[W.Msg.MIXLY_DOWN,"down"],[W.Msg.MIXLY_LEFT,"left"],[W.Msg.MIXLY_RIGHT,"right"],[W.Msg.MIXLY_MICROBIT_face_up,"face up"],[W.Msg.MIXLY_MICROBIT_face_down,"face down"],[W.Msg.MIXLY_MICROBIT_freefall,"freefall"],["3g","3g"],["6g","6g"],["8g","8g"]]),"gesture"),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("gesture");return{shake:W.Msg.MIXLY_MICROBIT_shake,up:W.Msg.MIXLY_UP,down:W.Msg.MIXLY_DOWN,left:W.Msg.MIXLY_LEFT,right:W.Msg.MIXLY_RIGHT,"face up":W.Msg.MIXLY_MICROBIT_face_up,"face down":W.Msg.MIXLY_MICROBIT_face_down,freefall:W.Msg.MIXLY_MICROBIT_freefall,"3g":"3g","6g":"6g","8g":"8g"}[e]}))}},kp={init:function(){this.setColour(bp),this.appendDummyInput("").appendField(W.Msg.MIXLY_MICROBIT_JS_WAS_GESTURE).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_shake,"shake"],[W.Msg.MIXLY_UP,"up"],[W.Msg.MIXLY_DOWN,"down"],[W.Msg.MIXLY_LEFT,"left"],[W.Msg.MIXLY_RIGHT,"right"],[W.Msg.MIXLY_MICROBIT_face_up,"face up"],[W.Msg.MIXLY_MICROBIT_face_down,"face down"],[W.Msg.MIXLY_MICROBIT_freefall,"freefall"],["3g","3g"],["6g","6g"],["8g","8g"]]),"gesture"),this.appendStatementInput("DO").appendField(W.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("gesture"),i=W.Msg.CONTROLS_IF_MSG_IF,n=W.Msg.MSG.catSensor,s=W.Msg.MIXLY_MICROBIT_JS_WAS_GESTURE,o=W.Msg.MIXLY_MICROBIT_PERFORMANCE;return i+n+s+{shake:W.Msg.MIXLY_MICROBIT_shake,up:W.Msg.MIXLY_UP,down:W.Msg.MIXLY_DOWN,left:W.Msg.MIXLY_LEFT,right:W.Msg.MIXLY_RIGHT,"face up":W.Msg.MIXLY_MICROBIT_face_up,"face down":W.Msg.MIXLY_MICROBIT_face_down,freefall:W.Msg.MIXLY_MICROBIT_freefall,"3g":"3g","6g":"6g","8g":"8g"}[e]+o}))}},Hp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_ACCELERATION).appendField(new W.FieldDropdown([["x","x"],["y","y"],["z","z"],["(x,y,z)","values"]]),"key"),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_ACCELERATION);var t=this;this.setTooltip((function(){var e=t.getFieldValue("key"),i=W.Msg.MIXLY_MICROBIT_PY_STORAGE_GET,n=W.Msg.MIXLY_MICROBIT_Direction,s=W.Msg.MIXLY_MICROBIT_JS_ACCELERATION1;return i+{x:"x",y:"y",z:"z","(x,y,z)":W.Msg.MIXLY_MICROBIT_Shiliang_Direction}[e]+n+s}))}},xp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_SET_ACCELERATION).appendField(new W.FieldDropdown([["1g","AcceleratorRange.OneG"],["2g","AcceleratorRange.TwoG"],["4g","AcceleratorRange.FourG"],["8g","AcceleratorRange.EightG"]]),"key"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_SET_ACCELERATION)}},Wp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_GET).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_JS_GET_GESTURE,"all"],[W.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE,"current"]]),"GES").appendField(W.Msg.MIXLY_MICROBIT_JS_GESTURE),this.setOutput(!0,Number),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("GES"),i=W.Msg.MIXLY_MICROBIT_JS_GET,n=W.Msg.MIXLY_MICROBIT_JS_GESTURE;return i+{all:W.Msg.MIXLY_MICROBIT_JS_GET_GESTURE,current:W.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE}[e]+n}))}},Kp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE),this.setOutput(!0,Number),this.setInputsInline(!0)}},Jp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_LIGHT_LEVEL),this.setOutput(!0,Number),this.setInputsInline(!0)}},jp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_CALIBRATE_COMPASS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_CALIBRATE_COMPASS)}},Qp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_IS_COMPASS_CALIBRATED),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_IS_COMPASS_CALIBRATED1)}},qp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_BY_ANGLE),this.setOutput(!0,Number),this.setInputsInline(!0)}},zp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_Board_temperature),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_Board_temperature)}},Zp={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_GET_COMPASS).appendField(new W.FieldDropdown([[W.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH,"get_field_strength"],[W.Msg.MIXLY_MICROBIT_JS_BY_ANGLE,"heading"],["x","get_x"],["y","get_y"],["z","get_z"]]),"compass"),this.setOutput(!0,Number),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("compass");return W.Msg.MIXLY_MICROBIT_JS_GET_COMPASS+{strength:W.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH,heading:W.Msg.MIXLY_MICROBIT_JS_BY_ANGLE}[e]}))}},$p={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_ROTATION).appendField(new W.FieldDropdown([["pitch","Rotation.Pitch"],["roll","Rotation.Roll"]]),"key"),this.setOutput(!0,Number),this.setInputsInline(!0)}},tl={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_MAGETIC_FORCE).appendField(new W.FieldDropdown([["x","Dimension.X"],["y","Dimension.Y"],["z","Dimension.Z"],["strength","Dimension.Strength"]]),"key"),this.setOutput(!0,Number),this.setInputsInline(!0)}},el={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_CHAOSHENGBO).appendField("Trig").appendField(new W.FieldDropdown([["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]]),"Trig").appendField("Echo").appendField(new W.FieldDropdown([["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]]),"Echo"),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip("")}},il={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_CHAOSHENGBO).appendField("Trig").appendField(new W.FieldDropdown([["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]]),"Trig").appendField("Echo").appendField(new W.FieldDropdown([["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]]),"Echo"),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip()}},nl={init:function(){this.setColour(bp),this.appendDummyInput("").appendField(W.Msg.MIXLY_RTCINIT),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField("myRTC"),this.appendValueInput("SDA").appendField("SDA#").setCheck(Number),this.appendValueInput("SCL").appendField("SCL#").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_RTCINIT)}};var sl=[[W.Msg.MIXLY_YEAR,"Year"],[W.Msg.MIXLY_MONTH,"Month"],[W.Msg.MIXLY_DAY,"Day"],[W.Msg.MIXLY_HOUR,"Hour"],[W.Msg.MIXLY_MINUTE,"Minute"],[W.Msg.MIXLY_SECOND,"Second"],[W.Msg.MIXLY_WEEK,"Week"],[W.Msg.MIXLY_MIX1,"Mix1"],[W.Msg.MIXLY_MIX2,"Mix2"]];const ol={init:function(){this.setColour(bp),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RTCGETTIME),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField("myRTC"),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField(new W.FieldDropdown(sl),"TIME_TYPE"),this.setInputsInline(!0),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("TIME_TYPE");return W.Msg.MIXLY_RTCGETTIME+{Year:W.Msg.MIXLY_YEAR,Month:W.Msg.MIXLY_MONTH,Day:W.Msg.MIXLY_DAY,Hour:W.Msg.MIXLY_HOUR,Minute:W.Msg.MIXLY_MINUTE,Second:W.Msg.MIXLY_SECOND,Week:W.Msg.MIXLY_WEEK,Mix1:W.Msg.MIXLY_MIX1,Mix2:W.Msg.MIXLY_MIX2}[e]}))}},_l={init:function(){this.setColour(bp),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RTCSETTIME).appendField("myRTC"),this.appendValueInput("hour").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(" "+W.Msg.MIXLY_HOUR),this.appendValueInput("minute").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(" "+W.Msg.MIXLY_MINUTE),this.appendValueInput("second").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(" "+W.Msg.MIXLY_SECOND),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!1),this.setTooltip(W.Msg.MIXLY_RTCSETTIME+W.Msg.MIXLY_MIX2)}},ul={init:function(){this.setColour(bp),this.appendDummyInput("").setAlign(W.inputs.Align.RIGHT).appendField(W.Msg.MIXLY_RTCSETDATE).appendField("myRTC"),this.appendValueInput("year").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(" "+W.Msg.MIXLY_YEAR),this.appendValueInput("month").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(" "+W.Msg.MIXLY_MONTH),this.appendValueInput("day").setCheck(Number).setAlign(W.inputs.Align.RIGHT).appendField(" "+W.Msg.MIXLY_DAY),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.MIXLY_RTCSETDATE+W.Msg.MIXLY_MIX1)}},al={init:function(){this.jsonInit({colour:bp,nextStatement:null,previousStatement:null,helpUrl:"https://microbit-micropython.readthedocs.io/en/latest/music.html#music.reset",message0:W.Msg.MIXLY_MICROBIT_Reset_COMPASS}),this.setTooltip(W.Msg.MIXLY_MICROBIT_Reset_COMPASS)}},rl={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_ESP32_LIGHT),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(W.Msg.MICROBIT_SENSOR_LIGHT_TOOLTIP)}},pl={init:function(){this.setColour(bp),this.appendDummyInput().appendField(W.Msg.MIXLY_HCSR04_INIT).appendField("Trig").appendField(new W.FieldDropdown([["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]]),"Trig").appendField("Echo").appendField(new W.FieldDropdown([["P0","0"],["P1","1"],["P2","2"],["P3","3"],["P4","4"],["P5","5"],["P6","6"],["P7","7"],["P8","8"],["P9","9"],["P10","10"],["P11","11"],["P12","12"],["P13","13"],["P14","14"],["P15","15"],["P16","16"],["P19","19"],["P20","20"]]),"Echo"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip()}};var ll=[[W.Msg.COLOUR_RGB_RED,"0"],[W.Msg.COLOUR_RGB_GREEN,"1"],[W.Msg.COLOUR_RGB_BLUE,"2"]];const Il={init:function(){this.setColour(bp),this.appendDummyInput("").appendField(W.Msg.TCS34725_Get_RGB).appendField(new W.FieldDropdown(ll),"TCS34725_COLOR"),this.setInputsInline(!0),this.setOutput(!0)}},Tl={init:function(){this.setColour(bp),this.appendDummyInput("").appendField("NTC").appendField(W.Msg.MIXLY_TEMP),this.appendDummyInput("").appendField(W.Msg.MIXLY_PIN).appendField(new W.FieldDropdown(K.Profile.default.analog),"PIN"),this.appendValueInput("NominalResistance").setCheck(Number).appendField(W.Msg.MIXLY_NominalResistance),this.appendValueInput("betaCoefficient").setCheck(Number).appendField(W.Msg.MIXLY_betaCoefficient),this.appendValueInput("seriesResistor").setCheck(Number).appendField(W.Msg.MIXLY_seriesResistor),this.setInputsInline(!1),this.setOutput(!0,Number),this.setTooltip()}},dl=65,hl={init:function(){this.setColour(dl),this.appendValueInput("CONTENT",String).appendField("Serial "+W.Msg.MIXLY_SERIAL_PRINT),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.TEXT_PRINT_TOOLTIP)}},Ml={init:function(){this.setColour(dl),this.appendValueInput("CONTENT",String).appendField("Serial "+W.Msg.MIXLY_SERIAL_PRINTLN),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.TEXT_PRINT_Huanhang_TOOLTIP+W.Msg.TEXT_PRINT_TOOLTIP)}},ml={init:function(){this.setColour(dl),this.appendValueInput("CONTENT",Number).appendField("Serial "+W.Msg.MIXLY_SERIAL_PRINT+" ("+W.Msg.MATH_HEX+")").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.TEXT_PRINT_HEX_TOOLTIP)}},cl={init:function(){this.setColour(dl),this.appendValueInput("char_marker").setCheck(String).appendField(W.Msg.MIXLY_MICROBIT_JS_SERIAL_WHEN_CONTAIN_DATA),this.appendStatementInput("DO").appendField(W.Msg.MIXLY_DO)}},Ol={init:function(){this.setColour(dl),this.appendDummyInput().appendField("Serial "+W.Msg.MIXLY_SERIAL_READSTR),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_READ_STR)}},El={init:function(){this.setColour(dl),this.appendDummyInput().appendField("Serial "+W.Msg.MIXLY_SERIAL_AVAILABLE),this.setOutput(!0,Boolean),this.setTooltip(W.Msg.MIXLY_SERIAL_AVAILABLE1)}},Rl={init:function(){this.setColour(dl),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_JS_SERIAL_READ_LINE),this.setOutput(!0,String),this.setTooltip(W.Msg.MIXLY_MICROBIT_JS_SERIAL_READ_LINE1)}},gl={init:function(){this.setColour(dl),this.appendDummyInput().appendField("Serial "+W.Msg.MIXLY_SERIAL_READSTR_UNTIL).appendField(new W.FieldDropdown([["new line","serial.delimiters(Delimiters.NewLine)"],[",","serial.delimiters(Delimiters.Comma)"],["$","serial.delimiters(Delimiters.Dollar)"],[":","serial.delimiters(Delimiters.Colon)"],[".","serial.delimiters(Delimiters.Fullstop)"],["#","serial.delimiters(Delimiters.Hash)"]]),"char_marker"),this.setInputsInline(!0),this.setOutput(!0,String)}},Cl={init:function(){this.setColour(dl),this.appendValueInput("RX",Number).appendField(W.Msg.MIXLY_SETUP).appendField("RX#").setCheck(Number).setAlign(W.inputs.Align.RIGHT),this.appendValueInput("TX",Number).appendField("TX#").setCheck(Number).setAlign(W.inputs.Align.RIGHT),this.appendDummyInput().appendField(W.Msg.MIXLY_SERIAL_BEGIN).appendField(new W.FieldDropdown([["115200","115200"],["57600","57600"],["38400","38400"],["28800","28800"],["19200","19200"],["14400","14400"],["9600","9600"]]),"baudrate"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_SERIAL_softserial)}},Al={init:function(){this.setColour(dl),this.appendDummyInput().appendField("Serial "+W.Msg.MIXLY_SERIAL_BEGIN).appendField(new W.FieldDropdown([["115200","115200"],["57600","57600"],["38400","38400"],["28800","28800"],["19200","19200"],["14400","14400"],["9600","9600"]]),"baudrate"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.LISTS_SET_INDEX_SET+W.Msg.MIXLY_SERIAL_BEGIN)}},Ll={init:function(){this.setColour(dl),this.appendValueInput("VAR").appendField(W.Msg.blockpy_inout_raw_input).setCheck(String),this.setOutput(!0),this.setTooltip(W.Msg.INOUT_input_TOOLTIP)}},Sl={init:function(){this.setColour(dl),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_SERIAL_PRINTLN),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.BLOCKPY_PRINT_TOOLTIP)}},Nl={init:function(){this.setColour(dl),this.appendValueInput("VAR").appendField(W.Msg.MIXLY_SERIAL_PRINT),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(W.Msg.TEXT_PRINT_TOOLTIP)}},Dl=120,fl={init:function(){this.setColour(Dl),this.appendValueInput("DELAY_TIME",Number).appendField(W.Msg.MIXLY_DELAY+"("+W.Msg.MIXLY_MILLIS+")").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_TOOLTIP_CONTROL_DELAY)}},Pl={init:function(){this.setColour(Dl),this.appendDummyInput().appendField(W.Msg.MIXLY_RUNTIME+"("+W.Msg.MIXLY_MILLIS+")"),this.setOutput(!0,Number),this.setTooltip(W.Msg.MIXLY_TOOLTIP_CONTROL_MILLIS)}},Fl={init:function(){this.setColour(Dl),this.appendValueInput("STATUS_CODE",Number).appendField(W.Msg.MIXLY_MICROBIT_Panic_with_status_code).setCheck(Number),this.setPreviousStatement(!0,null),this.setInputsInline(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_Panic_with_status_code)}},vl={init:function(){this.setColour(Dl),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_Reset_micro),this.setPreviousStatement(!0),this.setTooltip(W.Msg.MIXLY_MICROBIT_Reset_micro)}},Yl={init:function(){this.setColour(Dl),this.appendDummyInput().appendField(W.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(W.Msg.PROCEDURES_DEFRETURN_RETURN+W.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME)}},bl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music","music.play(music."+t.getFieldValue("melody")+", pin=pin"+e.valueToCode(t,"PIN",e.ORDER_ATOMIC)+", wait="+("TRUE"==t.getFieldValue("wait")?"True":"False")+", loop="+("TRUE"==t.getFieldValue("loop")?"True":"False")+")\n"},Vl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music","music.play(music."+t.getFieldValue("melody")+", pin=pin"+e.valueToCode(t,"PIN",e.ORDER_ATOMIC)+")\n"},Xl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music",e.definitions_.import_math="import math","music.pitch(round("+e.valueToCode(t,"pitch",e.ORDER_ATOMIC)+"), round("+e.valueToCode(t,"duration",e.ORDER_ATOMIC)+"), pin"+e.valueToCode(t,"PIN",e.ORDER_ATOMIC)+", wait = "+("TRUE"==t.getFieldValue("wait")?"True":"False")+")\n"},yl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music",e.definitions_.import_math="import math","music.pitch(round("+e.valueToCode(t,"pitch",e.ORDER_ATOMIC)+"), pin=pin"+e.valueToCode(t,"PIN",e.ORDER_ATOMIC)+")\n"},Ul=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music";var i=e.valueToCode(t,"PIN",e.ORDER_ATOMIC);return"music.play("+(e.valueToCode(t,"notes",e.ORDER_ATOMIC)||"[]")+", pin=pin"+i+", wait="+("TRUE"==t.getFieldValue("wait")?"True":"False")+", loop="+("TRUE"==t.getFieldValue("loop")?"True":"False")+")\n"},Bl=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music";return"music.reset()\n"},Gl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music","music.stop(pin"+e.valueToCode(this,"PIN",e.ORDER_ATOMIC)+")\n"},wl=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_music="import music";return["music.get_tempo()",e.ORDER_ATOMIC]},kl=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i=e.valueToCode(this,"BPM",e.ORDER_ASSIGNMENT);return"music.set_tempo(ticks="+e.valueToCode(this,"TICKS",e.ORDER_ASSIGNMENT)+", bpm="+i+")\n"},Hl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_speech="import speech",["speech.translate("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},xl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_speech="import speech","speech."+this.getFieldValue("MODE")+"("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+", pitch="+e.valueToCode(this,"pitch",e.ORDER_ATOMIC)+", speed="+e.valueToCode(this,"speed",e.ORDER_ATOMIC)+", mouth="+e.valueToCode(this,"mouth",e.ORDER_ATOMIC)+", throat="+e.valueToCode(this,"throat",e.ORDER_ATOMIC)+")\n"},Wl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_speech="import speech","speech.say("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+")\n"},Kl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_speech="import speech","speech.sing("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+")\n"},Jl=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_speech="import speech","speech.pronounce("+e.valueToCode(this,"VAR",e.ORDER_ATOMIC)+")\n"},jl=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_Servolib="import Servo";var i=e.valueToCode(this,"PIN",e.ORDER_ATOMIC),n=e.valueToCode(this,"DEGREE",e.ORDER_ATOMIC);if(isNaN(parseInt(i)))s="Servo.angle("+i+", "+n+")\n";else var s="Servo.angle(pin"+i+", "+n+")\n";return s},Ql=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_motor_control="import motor_control","motor_control.MotorRun("+this.getFieldValue("Motor")+", "+this.getFieldValue("mode")+e.valueToCode(this,"speed",e.ORDER_ATOMIC)+")\n"},ql=function(t,e){var i=e.valueToCode(this,"PIN",e.ORDER_ATOMIC),n=e.valueToCode(this,"LEDCOUNT",e.ORDER_ATOMIC);return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_neopixel="import neopixel",e.setups_["var_rgb_display"+i]="np = neopixel.NeoPixel(pin"+i+", "+n+")\n",""},zl=function(t,e){var i=e.valueToCode(this,"_LED_",e.ORDER_ATOMIC),n=e.valueToCode(this,"RVALUE",e.ORDER_ATOMIC),s=e.valueToCode(this,"GVALUE",e.ORDER_ATOMIC),o=e.valueToCode(this,"BVALUE",e.ORDER_ATOMIC);return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_neopixel="import neopixel","np["+i+"] = ("+n+", "+s+", "+o+")\n"},Zl=function(t,e){var i=e.valueToCode(this,"_LED_",e.ORDER_ATOMIC),n=this.getFieldValue("RGB_LED_COLOR");e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_neopixel="import neopixel";var s="np["+i+"] = ("+n+")\n";return s+="np.show()\n"},$l=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_neopixel="import neopixel";return"np.show()\n"},tI=function(t,e){var i=e.valueToCode(this,"RX",e.ORDER_ATOMIC),n=e.valueToCode(this,"TX",e.ORDER_ATOMIC);return isNaN(parseInt(i))||(i="pin"+i),isNaN(parseInt(n))||(n="pin"+n),e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_QJ00X_MP3="from MP3 import QJ00X_MP3","mp3 = QJ00X_MP3(mp3_rx="+i+", mp3_tx="+n+")\n"},eI=function(t,e){var i=this.getFieldValue("CONTROL_TYPE");return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_QJ00X_MP3="from MP3 import QJ00X_MP3","mp3."+i+"()\n"},iI=function(t,e){var i=this.getFieldValue("LOOP_MODE");return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_QJ00X_MP3="from MP3 import QJ00X_MP3","mp3.set_loop("+i+")\n"},nI=function(t,e){var i=this.getFieldValue("EQ_MODE");return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_QJ00X_MP3="from MP3 import QJ00X_MP3","mp3.set_eq("+i+")\n"},sI=function(t,e){var i=e.valueToCode(this,"vol",e.ORDER_ATOMIC);return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_QJ00X_MP3="from MP3 import QJ00X_MP3","mp3.set_vol("+i+")\n"},oI=function(t,e){var i=e.valueToCode(this,"NUM",e.ORDER_ATOMIC);return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_QJ00X_MP3="from MP3 import QJ00X_MP3","mp3.playFileByIndexNumber("+i+")\n"},_I=function(t,e){var i=e.valueToCode(this,"FOLDER",e.ORDER_ATOMIC),n=e.valueToCode(this,"NUM",e.ORDER_ATOMIC);return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_QJ00X_MP3="from MP3 import QJ00X_MP3","mp3.set_folder("+i+", "+n+")\n"},uI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio","radio."+this.getFieldValue("type")+"()\n"},aI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio";return"radio.on()\n"},rI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio";return"radio.off()\n"},pI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio","radio.config(length="+e.valueToCode(this,"length",e.ORDER_ATOMIC)+", queue="+e.valueToCode(this,"queue",e.ORDER_ATOMIC)+", channel="+e.valueToCode(this,"channel",e.ORDER_ATOMIC)+", power="+e.valueToCode(this,"power",e.ORDER_ATOMIC)+", address="+e.valueToCode(this,"address",e.ORDER_ATOMIC)+", group="+e.valueToCode(this,"group",e.ORDER_ATOMIC)+", data_rate=radio."+e.valueToCode(this,"data_rate",e.ORDER_ATOMIC)+")\n"},lI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio";return"radio.reset()\n"},II=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio","radio."+this.getFieldValue("type")+"("+e.valueToCode(this,"data",e.ORDER_ATOMIC)+")\n"},TI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio",["radio."+this.getFieldValue("type")+"()",e.ORDER_ATOMIC]},dI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_radio="import radio";return["radio.receive()",e.ORDER_ATOMIC]},hI=function(t,e){var i=e.valueToCode(this,"RX",e.ORDER_ATOMIC),n=e.valueToCode(this,"TX",e.ORDER_ATOMIC),s=e.valueToCode(this,"freq",e.ORDER_ATOMIC);return isNaN(parseInt(i))||(i="pin"+i),isNaN(parseInt(n))||(n="pin"+n),"i2c.init(sda="+i+", scl="+n+", freq="+s+")\n"},MI=function(t,e){var i=e.valueToCode(this,"address",e.ORDER_ATOMIC),n=e.valueToCode(this,"data",e.ORDER_ATOMIC),s=this.getFieldValue("is_repeated");return["i2c.read("+i+", "+n+", "+(s=s.substring(0,1).toUpperCase()+s.substring(1).toLowerCase())+")",e.ORDER_ATOMIC]},mI=function(t,e){var i=e.valueToCode(this,"address",e.ORDER_ATOMIC),n=e.valueToCode(this,"data",e.ORDER_ATOMIC),s=this.getFieldValue("is_repeated");return"i2c.write("+i+", "+n+", "+(s=s.substring(0,1).toUpperCase()+s.substring(1).toLowerCase())+")\n"},cI=function(t){return"spi.init(baudrate="+t.getFieldValue("freq")+", bits="+t.getFieldValue("bits")+", mode="+t.getFieldValue("mode")+", mosi="+t.getFieldValue("mosi")+", miso= "+t.getFieldValue("miso")+", sclk="+t.getFieldValue("sck")+");\n"},OI=function(t,e){return["spi.write("+e.valueToCode(this,"data",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},EI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";return"display.clear()\n"},RI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["display.get_pixel(int("+e.valueToCode(t,"x",e.ORDER_ATOMIC)+"), int("+e.valueToCode(t,"y",e.ORDER_ATOMIC)+"))",e.ORDER_ATOMIC]},gI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.set_pixel(int("+e.valueToCode(t,"x",e.ORDER_ATOMIC)+"), int("+e.valueToCode(t,"y",e.ORDER_ATOMIC)+"), "+e.valueToCode(t,"value",e.ORDER_ATOMIC)+")\n"},CI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.set_pixel(int("+e.valueToCode(this,"x",e.ORDER_ASSIGNMENT)+"), int("+e.valueToCode(this,"y",e.ORDER_ASSIGNMENT)+"), "+e.valueToCode(this,"brightness",e.ORDER_ASSIGNMENT)+")\n"},AI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.show("+e.valueToCode(this,"data",e.ORDER_ASSIGNMENT)+")\n"},LI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.scroll("+e.valueToCode(this,"data",e.ORDER_ASSIGNMENT)+")\n"},SI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.scroll("+e.valueToCode(this,"data",e.ORDER_ASSIGNMENT)+", delay="+e.valueToCode(this,"delay",e.ORDER_ASSIGNMENT)+")\n"},NI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.show("+e.valueToCode(this,"PIN",e.ORDER_ATOMIC)+")\n"},DI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.show("+("Image."+t.getFieldValue("image"))+")\n"},fI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.show("+e.valueToCode(t,"images",e.ORDER_ATOMIC)+", delay="+e.valueToCode(t,"delay",e.ORDER_ATOMIC)+", wait="+("TRUE"==t.getFieldValue("wait")?"True":"False")+", loop="+("TRUE"==t.getFieldValue("loop")?"True":"False")+", clear="+("TRUE"==t.getFieldValue("clear")?"True":"False")+")\n"},PI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.scroll("+e.valueToCode(t,"message",e.ORDER_ATOMIC)+")\n"},FI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display."+t.getFieldValue("on_off")+"()\n"},vI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";return["display.is_on()",e.ORDER_ATOMIC]},YI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["Image."+t.getFieldValue("image"),e.ORDER_ATOMIC]},bI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",[e.valueToCode(t,"image",e.ORDER_ATOMIC)+".copy()",e.ORDER_ATOMIC]},VI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",[e.valueToCode(t,"image",e.ORDER_ATOMIC)+".invert()",e.ORDER_ATOMIC]},XI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i={"#000000":"0","#440000":"1","#660000":"2","#880000":"3","#aa0000":"4","#bb0000":"5","#cc0000":"6","#dd0000":"7","#ee0000":"8","#ff0000":"9"};return['Image("'+i[t.getFieldValue("00")]+i[t.getFieldValue("01")]+i[t.getFieldValue("02")]+i[t.getFieldValue("03")]+i[t.getFieldValue("04")]+":"+i[t.getFieldValue("10")]+i[t.getFieldValue("11")]+i[t.getFieldValue("12")]+i[t.getFieldValue("13")]+i[t.getFieldValue("14")]+":"+i[t.getFieldValue("20")]+i[t.getFieldValue("21")]+i[t.getFieldValue("22")]+i[t.getFieldValue("23")]+i[t.getFieldValue("24")]+":"+i[t.getFieldValue("30")]+i[t.getFieldValue("31")]+i[t.getFieldValue("32")]+i[t.getFieldValue("33")]+i[t.getFieldValue("34")]+":"+i[t.getFieldValue("40")]+i[t.getFieldValue("41")]+i[t.getFieldValue("42")]+i[t.getFieldValue("43")]+i[t.getFieldValue("44")]+'")',e.ORDER_ATOMIC]},yI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i=t.getFieldValue("OP");return[e.valueToCode(t,"img",e.ORDER_ATOMIC)+".shift_"+i+"("+e.valueToCode(t,"val",e.ORDER_ATOMIC)+")",e.ORDER_ATOMIC]},UI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i=t.getFieldValue("OP"),n=e.valueToCode(t,"A",e.ORDER_ATOMIC),s=e.valueToCode(t,"B",e.ORDER_ATOMIC);if("INTERSECTION"==i)var o=n+"-("+n+"-"+s+")";else o=n+i+s;return[o,e.ORDER_ATOMIC]},BI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","display.scroll("+(e.valueToCode(t,"images",e.ORDER_ATOMIC)||"hello")+", delay="+e.valueToCode(t,"delay",e.ORDER_ATOMIC)+", wait="+("TRUE"==t.getFieldValue("wait")?"True":"False")+", loop="+("TRUE"==t.getFieldValue("loop")?"True":"False")+", clear="+("TRUE"==t.getFieldValue("clear")?"True":"False")+")\n"},GI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_lcd1602="import lcd1602","mylcd.mixly_puts_two_lines("+e.valueToCode(this,"TEXT",e.ORDER_ASSIGNMENT)+", "+e.valueToCode(this,"TEXT2",e.ORDER_ASSIGNMENT)+")\n"},wI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_lcd1602="import lcd1602","mylcd = lcd1602.LCD1602("+(e.valueToCode(this,"device",e.ORDER_ASSIGNMENT)||"0x27")+")\n"},kI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_lcd1602="import lcd1602";var i=e.valueToCode(this,"TEXT",e.ORDER_ASSIGNMENT)||'String("")',n=e.valueToCode(this,"row",e.ORDER_ASSIGNMENT)||"1";return"mylcd.mixly_puts("+i+", "+(e.valueToCode(this,"column",e.ORDER_ASSIGNMENT)||"1")+", "+n+")\n"},HI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_lcd1602="import lcd1602","mylcd."+this.getFieldValue("STAT")+"\n"},xI=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_oled="import oled","mixly_oled_text("+(e.valueToCode(this,"Text_line1",e.ORDER_ASSIGNMENT)||"''")+", "+(e.valueToCode(this,"Text_line2",e.ORDER_ASSIGNMENT)||"''")+", "+(e.valueToCode(this,"Text_line3",e.ORDER_ASSIGNMENT)||"''")+", "+(e.valueToCode(this,"Text_line4",e.ORDER_ASSIGNMENT)||"''")+")\n"},WI=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i=e.valueToCode(this,"VAR",e.ORDER_ATOMIC);return["Image."+this.getFieldValue("OP")+"("+i+")",e.ORDER_ATOMIC]},KI=function(t,e){var i=e.valueToCode(this,"SUB",e.ORDER_ATOMIC);return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_oled="import oled",i+".show_fill("+this.getFieldValue("key")+")\n"},JI=function(t,e){var i=this.getFieldValue("path"),n=this.getFieldValue("module");return e.definitions_["import_"+i+"_"+n]="from "+i+" import "+n,""},jI=function(t,e){var i=this.getFieldValue("module");return e.definitions_["import_"+i]="import "+i,""},QI=function(t,e){for(var i=this.getFieldValue("NAME"),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)n[s]=e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"";return i+"("+n.join(", ")+")\n"},qI=function(t,e){for(var i=this.getFieldValue("NAME"),n=new Array(this.itemCount_),s=0;s<this.itemCount_;s++)n[s]=e.valueToCode(this,"ADD"+s,e.ORDER_NONE)||"";return[i+"("+n.join(", ")+")",e.ORDER_ATOMIC]},zI=function(t,e){var i=this.getFieldValue("TYPE"),n=this.getFieldValue("NAME");return e.setups_["var_"+i+"_"+n]=n+" = "+i+"()\n",""},ZI=function(t,e){for(var i=this.getFieldValue("NAME"),n=this.getFieldValue("METHOD"),s=new Array(this.itemCount_),o=0;o<this.itemCount_;o++)s[o]=e.valueToCode(this,"ADD"+o,e.ORDER_NONE)||"";return i+"."+n+"("+s.join(", ")+")\n"},$I=function(t,e){for(var i=this.getFieldValue("NAME"),n=this.getFieldValue("METHOD"),s=new Array(this.itemCount_),o=0;o<this.itemCount_;o++)s[o]=e.valueToCode(this,"ADD"+o,e.ORDER_NONE)||"";return[i+"."+n+"("+s.join(", ")+")",e.ORDER_ATOMIC]},tT=function(){return this.getFieldValue("VALUE")+"\n"},eT=function(t,e){return[this.getFieldValue("VALUE"),e.ORDER_ATOMIC]},iT=function(){return this.getFieldValue("VALUE")+"\n"},nT=function(t,e){return[this.getFieldValue("VALUE"),e.ORDER_ATOMIC]},sT=function(t,e){return["HIGH"==this.getFieldValue("BOOL")?"1":"0",e.ORDER_ATOMIC]},oT=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i="";return i+="pin"+e.valueToCode(this,"PIN",e.ORDER_ATOMIC)+".write_digital("+e.valueToCode(this,"STAT",e.ORDER_ATOMIC)+")\n"},_T=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";return["pin"+e.valueToCode(this,"PIN",e.ORDER_ATOMIC)+".read_digital()",e.ORDER_ATOMIC]},uT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","pin"+e.valueToCode(this,"PIN",e.ORDER_ATOMIC)+".write_analog("+e.valueToCode(this,"NUM",e.ORDER_ATOMIC)+")\n"},aT=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i=e.valueToCode(this,"PIN",e.ORDER_ATOMIC),n=e.valueToCode(this,"NUM",e.ORDER_ATOMIC);return"pin"+i+".set_analog_"+this.getFieldValue("key")+"("+n+")\n"},rT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["pin"+e.valueToCode(this,"PIN",e.ORDER_ATOMIC)+".read_analog()",e.ORDER_ATOMIC]},pT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["pin"+e.valueToCode(this,"pin",e.ORDER_ATOMIC)+".is_touched()",e.ORDER_ATOMIC]},lT=function(t,e){return[this.getFieldValue("PIN"),e.ORDER_ATOMIC]},IT=lT,TT=lT,dT=lT,hT=lT,MT=lT,mT=lT,cT=lT,OT=lT,ET=lT,RT=lT,gT=lT,CT=lT,AT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",[e.valueToCode(this,"btn",e.ORDER_ATOMIC)+".is_pressed()",e.ORDER_ATOMIC]},LT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",[e.valueToCode(this,"btn",e.ORDER_ATOMIC)+".was_pressed()",e.ORDER_ATOMIC]},ST=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",[e.valueToCode(this,"btn",e.ORDER_ATOMIC)+".get_presses()",e.ORDER_ATOMIC]},NT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",['"'+this.getFieldValue("gesture")+'"',e.ORDER_ATOMIC]},DT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",'if accelerometer.is_gesture("'+this.getFieldValue("gesture")+'"):\n'+(e.statementToCode(this,"DO")||e.PASS)},fT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",['accelerometer.is_gesture("'+this.getFieldValue("gesture")+'")',e.ORDER_ATOMIC]},PT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",['accelerometer.was_gesture("'+this.getFieldValue("gesture")+'")',e.ORDER_ATOMIC]},FT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",'if accelerometer.was_gesture("'+this.getFieldValue("gesture")+'"):\n'+(e.statementToCode(this,"DO")||e.PASS)},vT=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i,n=this.getFieldValue("GES");return"all"==n?i="accelerometer.get_gestures()":"current"==n&&(i="accelerometer.current_gesture()"),[i,e.ORDER_ATOMIC]},YT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["accelerometer.current_gesture()",e.ORDER_ATOMIC]},bT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["accelerometer.get_"+this.getFieldValue("key")+"()",e.ORDER_ATOMIC]},VT=function(){return"input.setAccelerometerRange("+this.getFieldValue("key")+")\n"},XT=function(t,e){return["input.lightLevel()",e.ORDER_ATOMIC]},yT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","compass.calibrate()\n"},UT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["compass.is_calibrated()",e.ORDER_ATOMIC]},BT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["compass.heading()",e.ORDER_ATOMIC]},GT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["temperature()",e.ORDER_ATOMIC]},wT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["compass."+this.getFieldValue("compass")+"()",e.ORDER_ATOMIC]},kT=function(t,e){return["input.rotation("+this.getFieldValue("key")+")",e.ORDER_ATOMIC]},HT=function(t,e){return["input.magneticForce("+this.getFieldValue("key")+")",e.ORDER_ATOMIC]},xT=function(t,e){var i=this.getFieldValue("Trig"),n=this.getFieldValue("Echo");return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_ultrasonic="import ultrasonic",["ultrasonic.distance_cm(t_pin=pin"+i+", e_pin=pin"+n+")",e.ORDER_ATOMIC]},WT=function(t,e){var i=this.getFieldValue("Trig"),n=this.getFieldValue("Echo");return e.definitions_["import_microbit_*"]="from microbit import *",e.setups_.class_hrsc04_="class HCSR04:\n def __init__(self, tpin=pin"+i+", epin=pin"+n+', spin=pin13):\n self.trigger_pin = tpin\n self.echo_pin = epin\n self.sclk_pin = spin\n\n def distance_mm(self):\n spi.init(baudrate=125000, sclk=self.sclk_pin,\n mosi=self.trigger_pin, miso=self.echo_pin)\n pre = 0\n post = 0\n k = -1\n length = 500\n resp = bytearray(length)\n resp[0] = 0xFF\n spi.write_readinto(resp, resp)\n # find first non zero value\n try:\n i, value = next((ind, v) for ind, v in enumerate(resp) if v)\n except StopIteration:\n i = -1\n if i > 0:\n pre = bin(value).count("1")\n # find first non full high value afterwards\n try:\n k, value = next((ind, v)\n for ind, v in enumerate(resp[i:length - 2]) if resp[i + ind + 1] == 0)\n post = bin(value).count("1") if k else 0\n k = k + i\n except StopIteration:\n i = -1\n dist= -1 if i < 0 else round((pre + (k - i) * 8. + post) * 8 * 0.172)\n return dist\n\n def distance_cm(self):\n return self.distance_mm() / 10.0\n\nsonar=HCSR04()\n\n',["sonar.distance_cm()",e.ORDER_ATOMIC]},KT=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_RTC="from RTC import *"},JT=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_RTC="from RTC import *";var i=this.getFieldValue("TIME_TYPE");switch(i){case"Year":case"Month":case"Day":case"Hour":case"Minute":case"Second":case"Week":return["ds."+i+"()",e.ORDER_ASSIGNMENT];case"Mix1":return["ds.get_date()",e.ORDER_ASSIGNMENT];case"Mix2":return["ds.get_time()",e.ORDER_ASSIGNMENT]}},jT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_RTC="from RTC import *","ds.set_time("+e.valueToCode(this,"hour",e.ORDER_ASSIGNMENT)+", "+e.valueToCode(this,"minute",e.ORDER_ASSIGNMENT)+", "+e.valueToCode(this,"second",e.ORDER_ASSIGNMENT)+")\n"},QT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_RTC="from RTC import *","ds.set_date("+e.valueToCode(this,"year",e.ORDER_ASSIGNMENT)+", "+e.valueToCode(this,"month",e.ORDER_ASSIGNMENT)+", "+e.valueToCode(this,"day",e.ORDER_ASSIGNMENT)+")\n"},qT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","compass.clear_calibration()\n"},zT=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["display.read_light_level()",e.ORDER_ATOMIC]},ZT=function(t,e){var i=this.getFieldValue("Trig"),n=this.getFieldValue("Echo");return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_ultrasonic="from ultrasonic import *","sonar = HCSR04(tpin=pin"+i+", epin=pin"+n+")\n"},$T=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_TCS="from TCS import *",["tcs.getRawRGBData("+this.getFieldValue("TCS34725_COLOR")+")",e.ORDER_ATOMIC]},td=function(t,e){var i=this.getFieldValue("PIN"),n=e.valueToCode(this,"NominalResistance",e.ORDER_ATOMIC),s=e.valueToCode(this,"betaCoefficient",e.ORDER_ATOMIC),o=e.valueToCode(this,"seriesResistor",e.ORDER_ATOMIC);return e.definitions_["import_microbit_*"]="from microbit import *",e.definitions_.import_ntc="import ntc",["ntc.read(pin"+i+", "+n+", "+s+", "+o+")",e.ORDER_ATOMIC]},ed=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","uart.write(str("+(e.valueToCode(this,"CONTENT",e.ORDER_ATOMIC)||'""')+"))\n"},id=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","uart.write(str("+(e.valueToCode(this,"CONTENT",e.ORDER_ATOMIC)||'""')+")+'\\r\\n')\n"},nd=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","uart.write(str(hex("+(e.valueToCode(this,"CONTENT",e.ORDER_ATOMIC)||"0")+")) + '\\r\\n')\n"},sd=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i=e.valueToCode(this,"char_marker",e.ORDER_ATOMIC)||";",n=e.statementToCode(this,"DO");e.definitions_["func_serial_receive_data_event_"+i.charCodeAt(1)]="serial.onDataReceived("+i+", () => {\n"+n+"}\n"},od=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";return["uart.any()",e.ORDER_ATOMIC]},_d=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";return["uart.read()",e.ORDER_ATOMIC]},ud=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";return["uart.readline()",e.ORDER_ATOMIC]},ad=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["serial.readUntil("+this.getFieldValue("char_marker")+")",e.ORDER_ATOMIC]},rd=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";var i=e.valueToCode(this,"RX",e.ORDER_ATOMIC),n=e.valueToCode(this,"TX",e.ORDER_ATOMIC);return isNaN(parseInt(i))||(i="pin"+i),isNaN(parseInt(n))||(n="pin"+n),"uart.init(rx="+i+", tx="+n+", baudrate="+this.getFieldValue("baudrate")+")\n"},pd=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","uart.init(baudrate="+this.getFieldValue("baudrate")+")\n"},ld=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *",["input("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+")",e.ORDER_ATOMIC]},Id=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","print("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+")\n"},Td=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","print("+(e.valueToCode(this,"VAR",e.ORDER_ATOMIC)||'""')+',end ="")\n'},dd=function(t,e){return"control.inBackground(() => {\n"+e.statementToCode(this,"do")+"})\n"},hd=function(){return"control.reset()\n"},Md=function(t,e){return"control.waitMicros("+(e.valueToCode(this,"data",e.ORDER_ATOMIC)||K.Profile.default.serial)+")\n"},md=function(t,e){return"control.raiseEvent("+(e.valueToCode(this,"system_event_bus_source",e.ORDER_ATOMIC)||K.Profile.default.serial)+", "+(e.valueToCode(this,"system_event_bus_value",e.ORDER_ATOMIC)||K.Profile.default.serial)+")\n"},cd=function(t,e){return"control.onEvent("+(e.valueToCode(this,"system_event_bus_source",e.ORDER_ATOMIC)||K.Profile.default.serial)+", "+(e.valueToCode(this,"system_event_bus_value",e.ORDER_ATOMIC)||K.Profile.default.serial)+", () => {\n"+e.statementToCode(this,"do")+")\n"},Od=function(t,e){return["control.eventTimestamp()",e.ORDER_ATOMIC]},Ed=function(t,e){return["control.eventValue()",e.ORDER_ATOMIC]},Rd=function(t,e){return[this.getFieldValue("key"),e.ORDER_ATOMIC]},gd=function(t,e){return[this.getFieldValue("key"),e.ORDER_ATOMIC]},Cd=function(t,e){return["control.deviceName()",e.ORDER_ATOMIC]},Ad=function(t,e){return["control.deviceSerialNumber()",e.ORDER_ATOMIC]},Ld=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","sleep("+(e.valueToCode(this,"DELAY_TIME",e.ORDER_ATOMIC)||"1000")+")\n"},Sd=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","panic("+(e.valueToCode(this,"STATUS_CODE",e.ORDER_ATOMIC)||"1000")+")\n"},Nd=function(t,e){e.definitions_["import_microbit_*"]="from microbit import *";return["running_time()",e.ORDER_ATOMIC]},Dd=function(){return"while True:\n pass\n"},fd=function(t,e){return e.definitions_["import_microbit_*"]="from microbit import *","reset()\n"},Pd=function(t,e){return e.definitions_.import_os="import os",["os.uname()",e.ORDER_ATOMIC]};Object.assign(W.Variables,j),Object.assign(W.Procedures,Mn),W.Python=Da,W.generator=Da,K.Profile.default={},Object.assign(K.Profile,Pa),Object.assign(K.Profile.default,Pa.microbit),Object.assign(W.Blocks,e,i,n,s,o,_,u,a,r,p,l,I,T,N,D,f,P,F,v,Y,b,V),Object.assign(W.Python.forBlock,d,h,M,m,c,O,E,R,g,C,A,L,S,X,y,U,B,G,w,k,H,x)})();