blockly 13.3.0 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +147 -143
- package/blockly_compressed.js +121 -122
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +21 -21
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +2 -2
- package/core/block_aria_composer.d.ts +1 -1
- package/core/block_svg.d.ts +7 -7
- package/core/bubbles/bubble.d.ts +4 -4
- package/core/bubbles/mini_workspace_bubble.d.ts +2 -2
- package/core/bubbles/text_bubble.d.ts +3 -3
- package/core/bubbles/textinput_bubble.d.ts +1 -1
- package/core/clipboard/block_paster.d.ts +5 -5
- package/core/clipboard/registry.d.ts +1 -1
- package/core/clipboard/workspace_comment_paster.d.ts +4 -4
- package/core/clipboard.d.ts +1 -1
- package/core/comments/comment_editor.d.ts +6 -6
- package/core/comments/comment_view.d.ts +3 -3
- package/core/comments/rendered_workspace_comment.d.ts +11 -11
- package/core/comments/workspace_comment.d.ts +2 -2
- package/core/common.d.ts +2 -2
- package/core/config.d.ts +37 -11
- package/core/contextmenu_registry.d.ts +2 -2
- package/core/events/events_block_base.d.ts +2 -1
- package/core/events/events_block_change.d.ts +3 -2
- package/core/events/events_block_create.d.ts +3 -2
- package/core/events/events_block_delete.d.ts +3 -2
- package/core/events/events_block_drag.d.ts +2 -2
- package/core/events/events_block_field_intermediate_change.d.ts +3 -2
- package/core/events/events_block_move.d.ts +2 -1
- package/core/events/events_click.d.ts +2 -2
- package/core/events/events_comment_base.d.ts +2 -1
- package/core/events/events_comment_change.d.ts +2 -1
- package/core/events/events_comment_collapse.d.ts +3 -2
- package/core/events/events_comment_create.d.ts +2 -1
- package/core/events/events_comment_delete.d.ts +2 -1
- package/core/events/events_comment_drag.d.ts +2 -2
- package/core/events/events_comment_move.d.ts +2 -1
- package/core/events/events_comment_resize.d.ts +2 -1
- package/core/events/events_selected.d.ts +1 -1
- package/core/events/events_theme_change.d.ts +1 -1
- package/core/events/events_toolbox_item_select.d.ts +1 -1
- package/core/events/events_trashcan_open.d.ts +1 -1
- package/core/events/events_var_base.d.ts +2 -1
- package/core/events/events_var_create.d.ts +2 -1
- package/core/events/events_var_delete.d.ts +2 -1
- package/core/events/events_var_rename.d.ts +2 -1
- package/core/events/events_var_type_change.d.ts +2 -1
- package/core/events/events_viewport.d.ts +1 -1
- package/core/field.d.ts +1 -1
- package/core/field_checkbox.d.ts +2 -1
- package/core/field_dropdown.d.ts +2 -1
- package/core/field_image.d.ts +2 -1
- package/core/field_input.d.ts +3 -2
- package/core/field_label.d.ts +2 -1
- package/core/field_label_serializable.d.ts +2 -1
- package/core/field_number.d.ts +2 -1
- package/core/field_textinput.d.ts +3 -2
- package/core/field_variable.d.ts +5 -3
- package/core/flyout_base.d.ts +1 -1
- package/core/flyout_metrics_manager.d.ts +2 -1
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +2 -2
- package/core/grid.d.ts +1 -1
- package/core/icons/icon_types.d.ts +4 -4
- package/core/icons/registry.d.ts +1 -1
- package/core/insertion_marker.d.ts +1 -1
- package/core/insertion_marker_previewer.d.ts +3 -3
- package/core/interfaces/i_bubble.d.ts +2 -2
- package/core/interfaces/i_comment_icon.d.ts +6 -6
- package/core/interfaces/i_drag_target.d.ts +2 -2
- package/core/interfaces/i_icon.d.ts +1 -1
- package/core/interfaces/i_json_block_definition.d.ts +7 -7
- package/core/interfaces/i_keyboard_accessible.d.ts +1 -1
- package/core/interfaces/i_parameter_model.d.ts +2 -2
- package/core/interfaces/i_paster.d.ts +3 -3
- package/core/interfaces/i_procedure_block.d.ts +1 -1
- package/core/interfaces/i_procedure_map.d.ts +1 -1
- package/core/interfaces/i_procedure_model.d.ts +2 -2
- package/core/interfaces/i_selectable.d.ts +1 -1
- package/core/interfaces/i_variable_backed_parameter_model.d.ts +1 -1
- package/core/layer_manager.d.ts +3 -3
- package/core/observable_procedure_map.d.ts +1 -1
- package/core/procedures.d.ts +1 -1
- package/core/render_management.d.ts +1 -1
- package/core/rendered_connection.d.ts +1 -1
- package/core/renderers/common/info.d.ts +1 -1
- package/core/renderers/common/path_object.d.ts +2 -2
- package/core/renderers/zelos/drawer.d.ts +1 -1
- package/core/renderers/zelos/info.d.ts +1 -1
- package/core/serialization/procedures.d.ts +2 -2
- package/core/serialization/workspace_comments.d.ts +2 -2
- package/core/shortcut_registry.d.ts +2 -2
- package/core/utils/aria.d.ts +1 -1
- package/core/utils/style.d.ts +14 -0
- package/core/utils/toolbox.d.ts +0 -8
- package/core/variable_map.d.ts +1 -1
- package/core/variable_model.d.ts +1 -1
- package/core/variables.d.ts +1 -1
- package/core/workspace.d.ts +2 -2
- package/core/workspace_focus_target.d.ts +6 -1
- package/core/workspace_svg.d.ts +3 -3
- package/core/xml.d.ts +1 -1
- package/msg/ab.js +5 -0
- package/msg/ab.mjs +5 -0
- package/msg/ace.js +5 -0
- package/msg/ace.mjs +5 -0
- package/msg/af.js +5 -0
- package/msg/af.mjs +5 -0
- package/msg/am.js +5 -0
- package/msg/am.mjs +5 -0
- package/msg/ar.js +5 -0
- package/msg/ar.mjs +5 -0
- package/msg/ast.js +5 -0
- package/msg/ast.mjs +5 -0
- package/msg/az.js +5 -0
- package/msg/az.mjs +5 -0
- package/msg/ba.js +5 -0
- package/msg/ba.mjs +5 -0
- package/msg/bcc.js +5 -0
- package/msg/bcc.mjs +5 -0
- package/msg/be-tarask.js +5 -0
- package/msg/be-tarask.mjs +5 -0
- package/msg/be.js +5 -0
- package/msg/be.mjs +5 -0
- package/msg/bg.js +5 -0
- package/msg/bg.mjs +5 -0
- package/msg/bn.js +5 -0
- package/msg/bn.mjs +5 -0
- package/msg/br.js +5 -0
- package/msg/br.mjs +5 -0
- package/msg/bs.js +5 -0
- package/msg/bs.mjs +5 -0
- package/msg/ca.js +5 -0
- package/msg/ca.mjs +5 -0
- package/msg/ce.js +5 -0
- package/msg/ce.mjs +5 -0
- package/msg/cs.js +5 -0
- package/msg/cs.mjs +5 -0
- package/msg/csb.js +162 -157
- package/msg/csb.mjs +5 -0
- package/msg/da.js +5 -0
- package/msg/da.mjs +5 -0
- package/msg/de.js +5 -0
- package/msg/de.mjs +5 -0
- package/msg/diq.js +5 -0
- package/msg/diq.mjs +5 -0
- package/msg/dtp.js +5 -0
- package/msg/dtp.mjs +5 -0
- package/msg/dty.js +5 -0
- package/msg/dty.mjs +5 -0
- package/msg/ee.js +5 -0
- package/msg/ee.mjs +5 -0
- package/msg/el.js +5 -0
- package/msg/el.mjs +5 -0
- package/msg/en-gb.js +5 -0
- package/msg/en-gb.mjs +5 -0
- package/msg/en.js +5 -0
- package/msg/en.mjs +5 -0
- package/msg/eo.js +5 -0
- package/msg/eo.mjs +5 -0
- package/msg/es.js +5 -0
- package/msg/es.mjs +5 -0
- package/msg/et.js +5 -0
- package/msg/et.mjs +5 -0
- package/msg/eu.js +5 -0
- package/msg/eu.mjs +5 -0
- package/msg/fa.js +5 -0
- package/msg/fa.mjs +5 -0
- package/msg/fi.js +5 -0
- package/msg/fi.mjs +5 -0
- package/msg/fo.js +5 -0
- package/msg/fo.mjs +5 -0
- package/msg/fr.js +10 -5
- package/msg/fr.mjs +5 -0
- package/msg/frr.js +5 -0
- package/msg/frr.mjs +5 -0
- package/msg/ga.js +5 -0
- package/msg/ga.mjs +5 -0
- package/msg/gl.js +5 -0
- package/msg/gl.mjs +5 -0
- package/msg/gn.js +5 -0
- package/msg/gn.mjs +5 -0
- package/msg/gor.js +5 -0
- package/msg/gor.mjs +5 -0
- package/msg/ha.js +5 -0
- package/msg/ha.mjs +5 -0
- package/msg/he.js +25 -20
- package/msg/he.mjs +5 -0
- package/msg/hi.js +5 -0
- package/msg/hi.mjs +5 -0
- package/msg/hr.js +5 -0
- package/msg/hr.mjs +5 -0
- package/msg/hrx.js +5 -0
- package/msg/hrx.mjs +5 -0
- package/msg/hsb.js +5 -0
- package/msg/hsb.mjs +5 -0
- package/msg/hu.js +5 -0
- package/msg/hu.mjs +5 -0
- package/msg/hy.js +5 -0
- package/msg/hy.mjs +5 -0
- package/msg/ia.js +5 -0
- package/msg/ia.mjs +5 -0
- package/msg/id.js +5 -0
- package/msg/id.mjs +5 -0
- package/msg/ig.js +5 -0
- package/msg/ig.mjs +5 -0
- package/msg/inh.js +5 -0
- package/msg/inh.mjs +5 -0
- package/msg/is.js +5 -0
- package/msg/is.mjs +5 -0
- package/msg/it.js +5 -0
- package/msg/it.mjs +5 -0
- package/msg/ja.js +5 -0
- package/msg/ja.mjs +5 -0
- package/msg/ka.js +5 -0
- package/msg/ka.mjs +5 -0
- package/msg/kab.js +5 -0
- package/msg/kab.mjs +5 -0
- package/msg/kbd-cyrl.js +5 -0
- package/msg/kbd-cyrl.mjs +5 -0
- package/msg/km.js +5 -0
- package/msg/km.mjs +5 -0
- package/msg/kn.js +34 -29
- package/msg/kn.mjs +5 -0
- package/msg/ko.js +11 -6
- package/msg/ko.mjs +5 -0
- package/msg/krc.js +5 -0
- package/msg/krc.mjs +5 -0
- package/msg/ksh.js +5 -0
- package/msg/ksh.mjs +5 -0
- package/msg/ku-latn.js +5 -0
- package/msg/ku-latn.mjs +5 -0
- package/msg/ky.js +5 -0
- package/msg/ky.mjs +5 -0
- package/msg/la.js +5 -0
- package/msg/la.mjs +5 -0
- package/msg/lb.js +10 -5
- package/msg/lb.mjs +5 -0
- package/msg/lki.js +5 -0
- package/msg/lki.mjs +5 -0
- package/msg/lo.js +5 -0
- package/msg/lo.mjs +5 -0
- package/msg/lrc.js +5 -0
- package/msg/lrc.mjs +5 -0
- package/msg/lt.js +5 -0
- package/msg/lt.mjs +5 -0
- package/msg/lv.js +5 -0
- package/msg/lv.mjs +5 -0
- package/msg/mg.js +5 -0
- package/msg/mg.mjs +5 -0
- package/msg/mk.js +5 -0
- package/msg/mk.mjs +5 -0
- package/msg/ml.js +5 -0
- package/msg/ml.mjs +5 -0
- package/msg/mnw.js +5 -0
- package/msg/mnw.mjs +5 -0
- package/msg/ms.js +5 -0
- package/msg/ms.mjs +5 -0
- package/msg/mt.js +5 -0
- package/msg/mt.mjs +5 -0
- package/msg/my.js +5 -0
- package/msg/my.mjs +5 -0
- package/msg/mzn.js +5 -0
- package/msg/mzn.mjs +5 -0
- package/msg/nb.js +5 -0
- package/msg/nb.mjs +5 -0
- package/msg/ne.js +6 -1
- package/msg/ne.mjs +5 -0
- package/msg/nl.js +5 -0
- package/msg/nl.mjs +5 -0
- package/msg/oc.js +5 -0
- package/msg/oc.mjs +5 -0
- package/msg/olo.js +5 -0
- package/msg/olo.mjs +5 -0
- package/msg/pa.js +5 -0
- package/msg/pa.mjs +5 -0
- package/msg/pl.js +5 -0
- package/msg/pl.mjs +5 -0
- package/msg/pms.js +5 -0
- package/msg/pms.mjs +5 -0
- package/msg/ps.js +5 -0
- package/msg/ps.mjs +5 -0
- package/msg/pt-br.js +5 -0
- package/msg/pt-br.mjs +5 -0
- package/msg/pt.js +5 -0
- package/msg/pt.mjs +5 -0
- package/msg/ro.js +13 -8
- package/msg/ro.mjs +5 -0
- package/msg/ru.js +5 -0
- package/msg/ru.mjs +5 -0
- package/msg/sc.js +5 -0
- package/msg/sc.mjs +5 -0
- package/msg/sco.js +5 -0
- package/msg/sco.mjs +5 -0
- package/msg/sd.js +5 -0
- package/msg/sd.mjs +5 -0
- package/msg/shn.js +5 -0
- package/msg/shn.mjs +5 -0
- package/msg/si.js +5 -0
- package/msg/si.mjs +5 -0
- package/msg/sk.js +5 -0
- package/msg/sk.mjs +5 -0
- package/msg/skr-arab.js +5 -0
- package/msg/skr-arab.mjs +5 -0
- package/msg/sl.js +5 -0
- package/msg/sl.mjs +5 -0
- package/msg/smn.js +5 -0
- package/msg/smn.mjs +5 -0
- package/msg/sq.js +5 -0
- package/msg/sq.mjs +5 -0
- package/msg/sr-latn.js +5 -0
- package/msg/sr-latn.mjs +5 -0
- package/msg/sr.js +5 -0
- package/msg/sr.mjs +5 -0
- package/msg/sv.js +5 -0
- package/msg/sv.mjs +5 -0
- package/msg/sw.js +5 -0
- package/msg/sw.mjs +5 -0
- package/msg/ta.js +5 -0
- package/msg/ta.mjs +5 -0
- package/msg/tcy.js +6 -1
- package/msg/tcy.mjs +5 -0
- package/msg/tdd.js +5 -0
- package/msg/tdd.mjs +5 -0
- package/msg/te.js +5 -0
- package/msg/te.mjs +5 -0
- package/msg/th.js +5 -0
- package/msg/th.mjs +5 -0
- package/msg/ti.js +5 -0
- package/msg/ti.mjs +5 -0
- package/msg/tl.js +5 -0
- package/msg/tl.mjs +5 -0
- package/msg/tlh.js +5 -0
- package/msg/tlh.mjs +5 -0
- package/msg/tr.js +5 -0
- package/msg/tr.mjs +5 -0
- package/msg/ug-arab.js +5 -0
- package/msg/ug-arab.mjs +5 -0
- package/msg/uk.js +5 -0
- package/msg/uk.mjs +5 -0
- package/msg/ur.js +5 -0
- package/msg/ur.mjs +5 -0
- package/msg/uz.js +24 -19
- package/msg/uz.mjs +5 -0
- package/msg/vi.js +5 -0
- package/msg/vi.mjs +5 -0
- package/msg/xmf.js +5 -0
- package/msg/xmf.mjs +5 -0
- package/msg/yo.js +5 -0
- package/msg/yo.mjs +5 -0
- package/msg/zgh.js +5 -0
- package/msg/zgh.mjs +5 -0
- package/msg/zh-hans.js +5 -0
- package/msg/zh-hans.mjs +5 -0
- package/msg/zh-hant.js +41 -36
- package/msg/zh-hant.mjs +5 -0
- package/package.json +11 -14
package/blockly.min.js
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
}
|
|
12
12
|
}(this, function() {
|
|
13
13
|
var $={};
|
|
14
|
-
var ca,aa,ea,fa,da,k,ka,la,ma,oa,pa,qa,ra,ta,wa,xa,ya,l,za,Aa,Ea,Ja,r,n,La,Ma,Na,Oa,Pa,Qa,Ta,Ua,Wa,Va,Za,ab,bb,db,fb,hb,ib,jb,kb,mb,nb,ob,pb,rb,sb,tb,ub,vb,xb,Bb,A,Eb,Fb,Gb,Hb,Ib,Jb,Lb,Nb,w,Rb,Sb,Pb,Tb,Vb,Wb,u,Xb,Zb,$b,ac,bc,dc,
|
|
15
|
-
Te,We,Xe,Ye,bf,cf,af,$e,ef,mf,nf,lf,pf,Ve,of,kf,sf,tf,uf,vf,xf,wf,Bf,Af,Df,Hf,If,Ef,Ff,Gf,Tf,Lf,Uf,Vf,Sf,Zf,Yf,$f,ag,bg,eg,fg,gg,hg,ig,lg,ng,ug,kg,vg,wg,xg,yg,zg,Hg,Cg,Eg,Mg,Gg,Bg,Lg,Qg,Sg,Tg,Ug,Vg,Yg,Wg,$g,ae,ah,Ng,bh,hh,ih,gh,jh,mh,uh,wh,rh,qh,vh,xh,H,Bh,Ch,Dh,Eh,Fh,I,Gh,Hh,Ih,Kh,Jh,Lh,Ph,Oh,Mh,Th,Rh,Sh,Uh,Xh,Wh,bi,di,ci,ei,fi,gi,hi,ii,ki,li,ni,oi,pi,qi,ri,yi,zi,Ai,Ci,Di,Ei,Fi,Gi,Hi,Ji,Ki,Li,Mi,Ni,Oi,Qi,Si,Ti,Ui,Wi,Xi,Yi,Zi,$i,
|
|
16
|
-
Jj,Mj,Nj,Oj,Pj,Qj,Rj,Sj,Tj,Uj,Wj,Xj,bk,Yj,ak,ek,fk,hk,
|
|
14
|
+
var ca,aa,ea,fa,da,k,ka,la,ma,oa,pa,qa,ra,ta,wa,xa,ya,l,za,Aa,Ea,Ja,r,n,La,Ma,Na,Oa,Pa,Qa,Ta,Ua,Wa,Va,Za,ab,bb,db,fb,hb,ib,jb,kb,mb,nb,ob,pb,rb,sb,tb,ub,vb,xb,Bb,A,Eb,Fb,Gb,Hb,Ib,Jb,Lb,Nb,w,Rb,Sb,Pb,Tb,Vb,Wb,u,Xb,Zb,$b,ac,bc,dc,ec,hc,fc,lc,mc,nc,oc,pc,qc,yc,wc,Dc,Ec,Fc,Gc,Bc,Cc,Ac,Kc,Lc,Nc,Oc,Pc,Rc,Sc,Uc,Tc,Vc,bd,cd,dd,Wc,Yc,kd,id,jd,nd,od,pd,rd,td,vd,ld,xd,yd,zd,Ad,Fd,Gd,Ed,Jd,Kd,Dd,Ld,Pd,Md,Qd,Sd,Td,Ud,Xd,Hd,Zd,ce,be,ee,de,fe,ge,ne,re,oe,se,ue,ve,Ce,De,ye,xe,ze,Ge,Fe,Ee,He,Ae,Je,Ke,Me,Le,Be,Ne,
|
|
15
|
+
Oe,Te,We,Xe,Ye,bf,cf,af,$e,ef,mf,nf,lf,pf,Ve,of,kf,sf,tf,uf,vf,xf,wf,Bf,Af,Df,Hf,If,Ef,Ff,Gf,Tf,Lf,Uf,Vf,Sf,Zf,Yf,$f,ag,bg,eg,fg,gg,hg,ig,lg,ng,ug,kg,vg,wg,xg,yg,zg,Hg,Cg,Eg,Mg,Gg,Bg,Lg,Qg,Sg,Tg,Ug,Vg,Yg,Wg,$g,ae,ah,Ng,bh,hh,ih,gh,jh,mh,uh,wh,rh,qh,vh,xh,H,Bh,Ch,Dh,Eh,Fh,I,Gh,Hh,Ih,Kh,Jh,Lh,Ph,Oh,Mh,Th,Rh,Sh,Uh,Xh,Wh,bi,di,ci,ei,fi,gi,hi,ii,ki,li,ni,oi,pi,qi,ri,yi,zi,Ai,Ci,Di,Ei,Fi,Gi,Hi,Ji,Ki,Li,Mi,Ni,Oi,Qi,Si,Ti,Ui,Wi,Xi,Yi,Zi,$i,bj,ej,fj,jj,kj,lj,mj,pj,qj,rj,sj,tj,uj,vj,wj,xj,zj,yj,Aj,Fj,Gj,Ij,
|
|
16
|
+
Hj,Jj,Mj,Nj,Oj,Pj,Qj,Rj,Sj,Tj,Uj,Wj,Xj,bk,Yj,ak,ek,fk,gk,hk,jk,kk,lk,mk,nk,ok,pk,rk,tk,uk,vk,wk,xk,yk,zk,Ak,Bk,M;ca=function(a,b){aa();ba=setTimeout(function(){b&&b.handleRightClick(a)},750)};aa=function(){ba&&(clearTimeout(ba),ba=0)};ea=function(a){return!a.type.startsWith("pointer")||a instanceof PointerEvent&&da(a)};fa=function(a){return`${a.pointerId}`};da=function(a){var b=fa(a);return ha?ha===b:a.type==="pointerdown"?(ha=b,!0):!1};
|
|
17
17
|
k=function(a,b,c,d,e,f){function g(m){if(e||ea(m))c?d.call(c,m):d(m)}var h=[];if(b in ia)for(let m=0;m<ia[b].length;m++){let z=ia[b][m];a.addEventListener(z,g,Object.assign({},{capture:!1},f));h.push([a,z,g])}else a.addEventListener(b,g,Object.assign({},{capture:!1},f)),h.push([a,b,g]);return h};
|
|
18
18
|
ka=function(a,b,c,d,e){function f(h){c?d.call(c,h):d(h)}var g=[];if(b in ia)for(let h=0;h<ia[b].length;h++){let m=ia[b][h];a.addEventListener(m,f,Object.assign({},{capture:!1},e));g.push([a,m,f])}else a.addEventListener(b,f,Object.assign({},{capture:!1},e)),g.push([a,b,f]);return g};la=function(a){for(var b=a[a.length-1][2];a.length;){let [c,d,e]=a.pop();c.removeEventListener(d,e,!1)}return b};
|
|
19
19
|
ma=function(a){if(a.target instanceof HTMLElement){if(a.target.isContentEditable||a.target.getAttribute("data-is-text-input")==="true")return!0;if(a.target instanceof HTMLInputElement)return a=a.target,a.type==="text"||a.type==="number"||a.type==="email"||a.type==="password"||a.type==="search"||a.type==="tel"||a.type==="url";if(a.target instanceof HTMLTextAreaElement)return!0}return!1};oa=function(a){return a.ctrlKey&&na?!0:a.button===2};
|
|
@@ -41,19 +41,19 @@ Pb=function(a){var b=[];for(let c of a)if(a=b[b.length-1],!c.isNull())if(!a||a.w
|
|
|
41
41
|
c.element===a.element&&c.name===a.name)a.newValue=c.newValue;else if(c.type===v.VIEWPORT_CHANGE&&a.type===v.VIEWPORT_CHANGE)a.viewTop=c.viewTop,a.viewLeft=c.viewLeft,a.scale=c.scale,a.oldScale=c.oldScale;else if(c.type!==v.CLICK||a.type!==v.BUBBLE_OPEN)c.type===v.SELECTED&&a.type===v.SELECTED&&a.newElementId===void 0?(a.newElementId=c.newElementId,a.oldElementId===a.newElementId&&b.pop()):b.push(c);return a=b.filter(c=>!c.isNull())};Tb=function(){for(let a=0,b;b=Qb[a];a++)b.recordUndo=!1};
|
|
42
42
|
Vb=function(){return $.Ub===0};$.B=function(a){Ob.setGroupInternal(a)};Wb=function(a){var b=[];a=a.getDescendants(!1);for(let c=0,d;d=a[c];c++)b[c]=d.id;return b};u=function(a){var b=Fb(y.EVENT,a,void 0);if(!b)throw Error(`Event type ${a} not found in registry.`);return b};Xb=function(a){Object.keys(a).forEach(function(b){$.C[b]=a[b]})};Zb=function(a){return Yb.getSizeInternal(a)};$b=function(a,b){a=window.getComputedStyle(a);return a[b]||a.getPropertyValue(b)};
|
|
43
43
|
ac=function(a){var b=new D(0,0);a=a.getBoundingClientRect();var c=document.documentElement;c=new D(window.pageXOffset||c.scrollLeft,window.pageYOffset||c.scrollTop);b.x=a.left+c.x;b.y=a.top+c.y;return b};bc=function(){var a=document.body,b=document.documentElement;return new D(a.scrollLeft||b.scrollLeft,a.scrollTop||b.scrollTop)};
|
|
44
|
-
dc=function(a){var b=parseFloat($b(a,"borderLeftWidth")),c=parseFloat($b(a,"borderRightWidth")),d=parseFloat($b(a,"borderTopWidth"));a=parseFloat($b(a,"borderBottomWidth"));return new cc(d,a,b,c)};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
$.
|
|
50
|
-
|
|
51
|
-
Gc=function(a){return a&&a.contents?!!a.contents.filter(function(b){return b.kind.toUpperCase()==="CATEGORY"}).length:!1};
|
|
52
|
-
|
|
44
|
+
dc=function(a){var b=parseFloat($b(a,"borderLeftWidth")),c=parseFloat($b(a,"borderRightWidth")),d=parseFloat($b(a,"borderTopWidth"));a=parseFloat($b(a,"borderBottomWidth"));return new cc(d,a,b,c)};ec=function(a,b,c){var d=c.getBoundingClientRect();c=dc(c);return new D(a-(d.left+window.scrollX+c.left),b-(d.top+window.scrollY+c.top))};hc=function(a,b,c){a=fc(a,b,c);b.scrollLeft=a.x;b.scrollTop=a.y};
|
|
45
|
+
fc=function(a,b,c){var d=ac(a),e=ac(b),f=dc(b),g=d.x-e.x-f.left;d=d.y-e.y-f.top;e=new ic(a.offsetWidth,a.offsetHeight);a=b.clientWidth-e.width;e=b.clientHeight-e.height;f=b.scrollLeft;b=b.scrollTop;c?(f+=g-a/2,b+=d-e/2):(f+=Math.min(g,Math.max(g-a,0)),b+=Math.min(d,Math.max(d-e,0)));return new D(f,b)};
|
|
46
|
+
lc=function(a){var b=new D(0,0),c=a.x&&a.getAttribute("x"),d=a.y&&a.getAttribute("y");c&&(b.x=parseInt(c));d&&(b.y=parseInt(d));if(c=(c=a.getAttribute("transform"))&&c.match(jc))b.x+=Number(c[1]),c[3]&&(b.y+=Number(c[3]));(a=a.getAttribute("style"))&&a.includes("translate")&&(a=a.match(kc))&&(b.x+=Number(a[1]),a[3]&&(b.y+=Number(a[3])));return b};
|
|
47
|
+
mc=function(a){for(var b=0,c=0;a;){let d=lc(a);b+=d.x;c+=d.y;if((" "+(a.getAttribute("class")||"")+" ").includes(" injectionDiv "))break;a=a.parentNode}return new D(b,c)};nc=function(){var a=bc();return new cc(a.y,document.documentElement.clientHeight+a.y,a.x,document.documentElement.clientWidth+a.x)};oc=function(){var a=document.documentElement,b=window;return new D(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)};
|
|
48
|
+
pc=function(a,b){var c=b.x;b=b.y;var d=a.getInjectionDiv().getBoundingClientRect();c=new D(c-d.left,b-d.top);b=a.getOriginOffsetInPixels();return D.difference(c,b).scale(1/a.scale)};qc=function(a,b){var c=b.scale(a.scale);b=c.x;c=c.y;var d=a.getInjectionDiv().getBoundingClientRect();a=a.getOriginOffsetInPixels();return new D(b+d.left+a.x,c+d.top+a.y)};$.sc=function(a){return rc.createElementNS("https://developers.google.com/blockly/xml",a)};$.tc=function(a){return rc.createTextNode(a)};
|
|
49
|
+
$.vc=function(a){var b=uc.parseFromString(a,"text/xml");if(b&&b.documentElement&&!b.getElementsByTagName("parsererror").length)return b.documentElement;if((b=uc.parseFromString(a,"text/html"))&&b.body.firstChild&&b.body.firstChild.nodeName.toLowerCase()==="xml")return b.body.firstChild;throw Error(`DOMParser was unable to parse: ${a}`);};yc=function(a){return wc(xc.serializeToString(a))};wc=function(a){return a.replace(zc,b=>`&#${b.charCodeAt(0)};`)};
|
|
50
|
+
Dc=function(a){if(!a)return null;if(a instanceof Element||typeof a==="string"){a=Ac(a);var b={contents:Bc(a)};a instanceof Node&&Cc(a,b);a=b}b=a.kind;var c=a.contents;if(b&&b!=="flyoutToolbox"&&b!=="categoryToolbox")throw Error("Invalid toolbox kind "+b+". Please supply either flyoutToolbox or categoryToolbox");if(!c)throw Error("Toolbox must have a contents attribute.");return a};Ec=function(a){return a?a.contents?a.contents:Array.isArray(a)&&a.length>0&&!a[0].nodeType?a:Bc(a):[]};
|
|
51
|
+
Fc=function(a){if(!a)return!1;var b=a.kind;return b?b==="categoryToolbox":!!a.contents.filter(c=>c.kind.toUpperCase()==="CATEGORY").length};Gc=function(a){return a&&a.contents?!!a.contents.filter(function(b){return b.kind.toUpperCase()==="CATEGORY"}).length:!1};Bc=function(a){var b=[],c=a.childNodes;c||(c=a);for(let d=0,e;e=c[d];d++){if(!e.tagName)continue;a={};let f=e.tagName.toUpperCase();a.kind=f;f==="BLOCK"?a.blockxml=e:e.childNodes&&e.childNodes.length>0&&(a.contents=Bc(e));Cc(e,a);b.push(a)}return b};
|
|
52
|
+
Cc=function(a,b){for(let c=0;c<a.attributes.length;c++){let d=a.attributes[c];d.nodeName.includes("css-")?(b.cssconfig=b.cssconfig||{},b.cssconfig[d.nodeName.replace("css-","")]=d.value):b[d.nodeName]=d.value}};Ac=function(a){var b=null;if(a)if(typeof a==="string"){if(b=$.vc(a),b.nodeName.toLowerCase()!=="xml")throw TypeError("Toolbox should be an <xml> document.");}else a instanceof Element&&(b=a);return b};
|
|
53
53
|
Kc=function(a,b,c,d,e,f){var g=f.scrollbar&&f.scrollbar.canScrollVertically();a.horizontal===Hc.LEFT?(c=e.absoluteMetrics.left+c,g&&f.RTL&&(c+=Ic.scrollbarThickness)):(c=e.absoluteMetrics.left+e.viewMetrics.width-b.width-c,g&&!f.RTL&&(c-=Ic.scrollbarThickness));a.vertical===Jc.TOP?a=e.absoluteMetrics.top+d:(a=e.absoluteMetrics.top+e.viewMetrics.height-b.height-d,f.scrollbar&&f.scrollbar.canScrollHorizontally()&&(a-=Ic.scrollbarThickness));return new cc(a,a+b.height,c,c+b.width)};
|
|
54
54
|
Lc=function(a,b){return{horizontal:b.toolboxMetrics.position===E.LEFT||a.horizontalLayout&&!a.RTL?Hc.RIGHT:Hc.LEFT,vertical:b.toolboxMetrics.position===E.BOTTOM?Jc.TOP:Jc.BOTTOM}};Nc=function(a,b,c,d){var e=a.left,f=a.right-a.left,g=a.bottom-a.top;for(let h=0;h<d.length;h++){let m=d[h];a.intersects(m)&&(a=c===Mc.UP?m.top-g-b:m.bottom+b,a=new cc(a,a+g,e,e+f),h=-1)}return a};Oc=function(a,b){A(y.SERIALIZER,a,b)};
|
|
55
55
|
Pc=function(a,{addCoordinates:b=!1,saveIds:c=!0}={}){var d=a.workspace,e=Object.create(null);e.height=a.getSize().height;e.width=a.getSize().width;c&&(e.id=a.id);b&&(b=a.getRelativeToSurfaceXY(),e.x=d.RTL?d.getWidth()-b.x:b.x,e.y=b.y);a.getText()&&(e.text=a.getText());a.isCollapsed()&&(e.collapsed=!0);a.isOwnEditable()||(e.editable=!1);a.isOwnMovable()||(e.movable=!1);a.isOwnDeletable()||(e.deletable=!1);return e};
|
|
56
|
-
Rc=function(a,b,{recordUndo:c=!1}={}){var d=$.Qc;$.Qc=c;c=b.newComment(a.id);
|
|
56
|
+
Rc=function(a,b,{recordUndo:c=!1}={}){var d=$.Qc;$.Qc=c;c=b.newComment(a.id);if(a.x!==void 0||a.y!==void 0){let f=c.getRelativeToSurfaceXY(),g,h=(g=a.x)!=null?g:f.x;h=b.RTL?b.getWidth()-h:h;var e;b=(e=a.y)!=null?e:f.y;c.moveTo(new D(h,b))}if(a.width!==void 0||a.height){e=c.getSize();let f,g;c.setSize(new ic((f=a.width)!=null?f:e.width,(g=a.height)!=null?g:e.height))}a.text!==void 0&&c.setText(a.text);a.collapsed!==void 0&&c.setCollapsed(a.collapsed);a.editable!==void 0&&c.setEditable(a.editable);
|
|
57
57
|
a.movable!==void 0&&c.setMovable(a.movable);a.deletable!==void 0&&c.setDeletable(a.deletable);$.Qc=d;return c};Sc=function(a,b){A(y.PASTER,a,b)};Uc=function(a){for(var b=a.workspace,c=a.getRelativeToSurfaceXY(),d=new D(0,0),e=b.getTopComments(!1).filter(f=>f.id!==a.id).map(f=>f.getRelativeToSurfaceXY());Tc(D.sum(c,d),e);)d.translate(b.RTL?-30:30,30);a.moveTo(D.sum(c,d))};Tc=function(a,b){return b.some(c=>Math.abs(c.x-a.x)<=1&&Math.abs(c.y-a.y)<=1)};
|
|
58
58
|
Vc=function(a){return a&&typeof a.saveState==="function"&&typeof a.loadState==="function"};bd=function(a){Wc(a);if(Xc)return Yc(),Promise.resolve();Zc||(Zc=new Promise(b=>{$c=b;ad=window.requestAnimationFrame(()=>{Yc();b()})}));return Zc};cd=function(){return Zc?Zc:Promise.resolve()};dd=function(a){a||window.cancelAnimationFrame(ad);Yc(a);!a&&$c&&$c()};Wc=function(a){ed.add(a);fd.set(a,{group:$.gd,recordUndo:$.Qc});var b=a.getParent();b?Wc(b):hd.add(a)};
|
|
59
59
|
Yc=function(a){var b=a?new Set([a]):new Set([...hd].map(g=>g.workspace)),c=[...hd].filter(id).filter(g=>b.has(g.workspace));for(var d of c)jd(d);for(let g of b)g.resizeContents(),g.connectionDBList.forEach(h=>h==null?void 0:h.beginBulkUpdates());for(var e of c)d=e.getRelativeToSurfaceXY(),e.updateComponentLocations(d);for(var f of b)f.connectionDBList.forEach(g=>g==null?void 0:g.endBulkUpdates());for(let g of c){e=$.gd;f=$.Qc;if(d=fd.get(g))d.group&&$.B(d.group),$.Qc=d.recordUndo;g.bumpNeighbours();
|
|
@@ -71,7 +71,7 @@ V.type==="variables_set"&&V.getFieldValue("VAR")===F.getId()&&($.t().focusNode(V
|
|
|
71
71
|
$.Rd=function(a,b,c){function d(e){var f=$.C.RENAME_VARIABLE_TITLE.replace("%1",b.getName());Ld(f,e,function(g){if(g){var h=Pd(g,b.getType(),a),m=Qd(b.getName(),g,a);if(h||m){var z="";h?z=$.C.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",h.getName()).replace("%2",h.getType()):m&&(z=$.C.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER.replace("%1",g).replace("%2",m));rd(z,function(){d(g)})}else a.getVariableMap().renameVariable(b,g),c&&c(g)}else c&&c(null)})}d("")};
|
|
72
72
|
Ld=function(a,b,c){vd(a,b,function(d){d&&(d=d.replace(/[\s\xa0]+/g," ").trim(),d===$.C.RENAME_VARIABLE||d===$.C.NEW_VARIABLE)&&(d=null);c(d)})};Pd=function(a,b,c){c=c.getVariableMap().getAllVariables();a=a.toLowerCase();for(let d=0,e;e=c[d];d++)if(e.getName().toLowerCase()===a&&e.getType()!==b)return e;return null};Md=function(a,b){b=b.getVariableMap().getAllVariables();a=a.toLowerCase();for(let c=0,d;d=b[c];c++)if(d.getName().toLowerCase()===a)return d;return null};
|
|
73
73
|
Qd=function(a,b,c){return c.getProcedureMap().getProcedures().length?Sd(a,b,c):Td(a,b,c)};Sd=function(a,b,c){a=a.toLowerCase();b=b.toLowerCase();c=c.getProcedureMap().getProcedures();for(let e of c){var d=e.getParameters().filter(Ad).map(f=>f.getVariableModel().getName());if(!d)continue;c=d.some(f=>f.toLowerCase()===a);d=d.some(f=>f.toLowerCase()===b);if(c&&d)return e.getName()}return null};
|
|
74
|
-
Td=function(a,b,c){a=a.toLowerCase();b=b.toLowerCase();c=c.getAllBlocks(!1);for(let e of c){if(!zd(e))continue;c=e.getProcedureDef();var d=c[1];let f=d.some(g=>g.toLowerCase()===a);d=d.some(g=>g.toLowerCase()===b);if(f&&d)return c[0]}return null};Ud=function(a){var b=$.
|
|
74
|
+
Td=function(a,b,c){a=a.toLowerCase();b=b.toLowerCase();c=c.getAllBlocks(!1);for(let e of c){if(!zd(e))continue;c=e.getProcedureDef();var d=c[1];let f=d.some(g=>g.toLowerCase()===a);d=d.some(g=>g.toLowerCase()===b);if(f&&d)return c[0]}return null};Ud=function(a){var b=$.sc("field");b.setAttribute("name","VAR");b.setAttribute("id",a.getId());b.setAttribute("variabletype",a.getType());a=$.tc(a.getName());b.appendChild(a);return b};
|
|
75
75
|
$.Wd=function(a,b,c,d){var e=$.Vd(a,b,c,d);if(!e){e=a.getVariableMap();let f=a.getPotentialVariableMap();c||(c=Jd(a.isFlyout?a.targetWorkspace:a));e=f?f.createVariable(c,d,b!=null?b:void 0):e.createVariable(c,d,b)}return e};
|
|
76
76
|
$.Vd=function(a,b,c,d){var e=a.getPotentialVariableMap(),f=null;if(b&&(f=a.getVariableMap().getVariableById(b),!f&&e&&(f=e.getVariableById(b)),f))return f;if(c){if(d===void 0)throw Error("Tried to look up a variable by name without a type");f=a.getVariableMap().getVariable(c,d);!f&&e&&(f=e.getVariable(c,d))}return f};Xd=function(a,b){a=a.getVariableMap().getAllVariables();var c=[];if(b.length!==a.length)for(let d=0;d<a.length;d++){let e=a[d];b.includes(e)||c.push(e)}return c};
|
|
77
77
|
Hd=function(a,b){return Yd.compare(a.getName(),b.getName())};Zd=function(a,b){var c=[];a=a.getAllBlocks(!1);for(let d=0;d<a.length;d++){let e=a[d].getVarModels();if(e)for(let f=0;f<e.length;f++)e[f].getId()===b&&c.push(a[d])}return c};
|
|
@@ -83,7 +83,7 @@ ce=function(a,{addCoordinates:b=!1,addInputBlocks:c=!0,addNextBlocks:d=!0,doFull
|
|
|
83
83
|
be=function(a,b,c){var d=a.getShadowState(!0);a=a.targetBlock();if(!d&&!a)return null;var e=Object.create(null);d&&(e.shadow=d);a&&!a.isShadow()&&(e.block=ce(a,{doFullSerialization:b,saveIds:c}));return e};ee=function(a,b,{recordUndo:c=!1}={}){a=de(a,b,{recordUndo:c});b.rendered&&dd();return a};
|
|
84
84
|
de=function(a,b,{parentConnection:c,isShadow:d=!1,recordUndo:e=!1}={}){var f=$.Qc;$.Qc=e;(e=$.gd)||$.B(!0);$.Ub++;var g=b.getVariableMap().getAllVariables();try{var h=fe(a,b,{parentConnection:c,isShadow:d})}finally{$.Ub--}ge(b,g);Vb()&&w(new (u(v.BLOCK_CREATE))(h));$.B(e);$.Qc=f;if(b.rendered){let m=h;setTimeout(()=>{m.disposed||m.setConnectionTracking(!0)},1)}return h};
|
|
85
85
|
fe=function(a,b,{parentConnection:c,isShadow:d=!1}={}){if(!a.type)throw new he(a);var e=b.newBlock(a.type,a.id);e.setShadow(d);d=a.x===void 0?0:a.x;var f=a.y===void 0?0:a.y,g=e.workspace;d=g.RTL?g.getWidth()-d:d;e.moveBy(d,f);a.collapsed&&e.setCollapsed(!0);a.deletable===!1&&e.setDeletable(!1);a.movable===!1&&e.setMovable(!1);a.editable===!1&&e.setEditable(!1);a.enabled===!1&&e.setDisabledReason(!0,"MANUALLY_DISABLED");if(Array.isArray(a.disabledReasons))for(var h of a.disabledReasons)e.setDisabledReason(!0,
|
|
86
|
-
h);a.inline!==void 0&&e.setInputsInline(a.inline);a.data!==void 0&&(e.data=a.data);a.extraState&&(e.loadExtraState?e.loadExtraState(a.extraState):e.domToMutation&&e.domToMutation($.
|
|
86
|
+
h);a.inline!==void 0&&e.setInputsInline(a.inline);a.data!==void 0&&(e.data=a.data);a.extraState&&(e.loadExtraState?e.loadExtraState(a.extraState):e.domToMutation&&e.domToMutation($.vc(a.extraState)));if(c){if(c.getSourceBlock().isShadow()&&!e.isShadow())throw new ie(a);if(c.type===$.je.VALUE){if(h=e.outputConnection,!h)throw new ke("output",e,a);}else if(h=e.previousConnection,!h)throw new ke("previous",e,a);if(!c.connect(h))throw b=e.workspace.connectionChecker,new le(b.getErrorMessage(b.canConnectWithReason(h,
|
|
87
87
|
c,!1),h,c),c.type===$.je.VALUE?"output connection":"previous connection",e,a);}if(a.icons){c=Object.keys(a.icons);for(var m of c){c=a.icons[m];h=e.getIcon(m);if(!h){h=Fb(y.ICON,m,!1);if(!h)throw new me(m,e,a);h=new h(e);e.addIcon(h)}Vc(h)&&h.loadState(c)}}if(a.fields)for(m=Object.keys(a.fields),c=0;c<m.length;c++)h=m[c],d=a.fields[h],(f=e.getField(h))?f.loadState(d):console.warn(`Ignoring non-existant field ${h} in block ${e.type}`);if(a.inputs)for(m=Object.keys(a.inputs),c=0;c<m.length;c++){h=m[c];
|
|
88
88
|
d=e.getInput(h);if(!d||!d.connection)throw new ke(h,e,a);ne(d.connection,a.inputs[h])}if(a.next){if(!e.nextConnection)throw new ke("next",e,a);ne(e.nextConnection,a.next)}if(b.rendered){e.setConnectionTracking(!1);e.initSvg();e.queueRender();for(let z of e.getIcons())z.onLocationChange(e.getRelativeToSurfaceXY())}else e.initModel();return e};ge=function(a,b){if(Vb())for(a=Xd(a,b),b=0;b<a.length;b++){let c=a[b];w(new (u(v.VAR_CREATE))(c))}};
|
|
89
89
|
ne=function(a,b){b.shadow&&a.setShadowState(b.shadow);b.block&&fe(b.block,a.getSourceBlock().workspace,{parentConnection:a})};re=function(a){a=oe(a,pe);return a.length?a[0].join(qe?" ":" + "):""};
|
|
@@ -113,8 +113,8 @@ ef=function(a,b,c,d,e,f,g,h){$.t().registerPopoverFocusLossHandler(We);var m;(m=
|
|
|
113
113
|
mf=function(a,b,c,d){a=lf(a,c.left,c.right,d.width);return{initialX:a.divX,initialY:b,finalX:a.divX,finalY:b+16,arrowX:a.arrowX,arrowY:-9,arrowAtTop:!0,arrowVisible:!0}};nf=function(a,b,c,d){a=lf(a,c.left,c.right,d.width);return{initialX:a.divX,initialY:b-d.height,finalX:a.divX,finalY:b-d.height-16,arrowX:a.arrowX,arrowY:d.height-2-8,arrowAtTop:!1,arrowVisible:!0}};lf=function(a,b,c,d){b=Oe(b,a-d/2,c-d);a=a-8-b;a=Oe(12,a,d-12-16);return{arrowX:a,divX:b}};
|
|
114
114
|
pf=function(a,b){return ff===a?(b?of():Ve(),!0):!1};Ve=function(){ff&&($.t().unregisterPopoverFocusLossHandler(We),Pe.style.transform="translate(0, 0)",Pe.style.opacity="0",qf=setTimeout(function(){of()},250),gf&&(gf(),gf=null))};
|
|
115
115
|
of=function(){if(ff){qf&&clearTimeout(qf);gf&&(gf(),gf=null);ff=null;var a=lb,b,c=(b=Aa(a.getFocusableElement(),p.OWNS))!=null?b:"";l(a.getFocusableElement(),p.OWNS,c.replace(Pe.id,""));a.getFocusableElement().classList.remove("blocklyShowingDropDownDiv");a.markFocused();Ue&&(Ue(),Ue=null);Xe()}};
|
|
116
|
-
kf=function(a,b,c,d){a=rf.getPositionMetrics(a,b,c,d);a.arrowVisible?(b=a.arrowX,c=a.arrowY,d=a.arrowAtTop?45:225,Se.style.display="",Se.style.transform=`translate(${b}px, ${c}px) rotate(${d}deg)`,Se.setAttribute("class","blocklyDropDownArrow")):Se.style.display="none";b=Math.floor(a.initialX);c=Math.floor(a.initialY);d=Math.floor(a.finalX);var e=Math.floor(a.finalY),f=Pe.parentElement;f&&(
|
|
117
|
-
|
|
116
|
+
kf=function(a,b,c,d){a=rf.getPositionMetrics(a,b,c,d);a.arrowVisible?(b=a.arrowX,c=a.arrowY,d=a.arrowAtTop?45:225,Se.style.display="",Se.style.transform=`translate(${b}px, ${c}px) rotate(${d}deg)`,Se.setAttribute("class","blocklyDropDownArrow")):Se.style.display="none";b=Math.floor(a.initialX);c=Math.floor(a.initialY);d=Math.floor(a.finalX);var e=Math.floor(a.finalY),f=Pe.parentElement;f&&({x:b,y:c}=ec(b,c,f),{x:d,y:e}=ec(d,e,f));Pe.style.left=b+"px";Pe.style.top=c+"px";Pe.style.visibility="visible";
|
|
117
|
+
Pe.style.opacity="1";Pe.style.transform="translate("+(d-b)+"px,"+(e-c)+"px)";return!!a.arrowAtTop};sf=function(){if(ff){var a=ff.getSourceBlock();a=Ze?af(ff):cf(a);let b=a.left+(a.right-a.left)/2;kf(b,a.bottom,b,a.top)}else Ve()};tf=function(a){return a.length?a.reduce(function(b,c){return b.length<c.length?b:c}).length:0};
|
|
118
118
|
uf=function(a,b){if(!a.length)return 0;if(a.length===1)return a[0].length;var c=0;b=b||tf(a);var d;for(d=0;d<b;d++){var e=a[0][d];for(var f=1;f<a.length;f++)if(e!==a[f][d])return c;e===" "&&(c=d+1)}for(e=1;e<a.length;e++)if((f=a[e][d])&&f!==" ")return c;return b};
|
|
119
119
|
vf=function(a,b){if(!a.length)return 0;if(a.length===1)return a[0].length;var c=0;b=b||tf(a);var d;for(d=0;d<b;d++){var e=a[0].substr(-d-1,1);for(var f=1;f<a.length;f++)if(e!==a[f].substr(-d-1,1))return c;e===" "&&(c=d+1)}for(e=1;e<a.length;e++)if((f=a[e].charAt(a[e].length-d-1))&&f!==" ")return c;return b};
|
|
120
120
|
$.yf=function(a,b){a=a.split("\n");for(let z=0;z<a.length;z++){var c=z;a:{var d=void 0;let F;var e=a[z];var f=b;if(e.length<=f){f=e;break a}let J=e.trim().split(/\s+/);for(d=0;d<J.length;d++)J[d].length>f&&(f=J[d].length);var g=-Infinity;let V=1;do{F=g;d=e;var h=[];g=J.length/V;e=1;for(var m=0;m<J.length-1;m++)e<(m+1.5)/g?(e++,h[m]=!0):h[m]=!1;h=wf(J,h,f);g=xf(J,h,f);e=J;m=[];for(let ja=0;ja<e.length;ja++)m.push(e[ja]),h[ja]!==void 0&&m.push(h[ja]?"\n":" ");e=m.join("");V++}while(g>F);f=d}a[c]=f}return a.join("\n")};
|
|
@@ -136,32 +136,31 @@ m.push(b);a.length=0;return m};gg=function(a){return fg(a,!0,!0)};hg=function(a)
|
|
|
136
136
|
ng=function(){var a=rb()||document.body,b=document.querySelector("div.blocklyWidgetDiv");b?mg=b:(mg=document.createElement("div"),mg.id=Lb(),mg.className="blocklyWidgetDiv",mg.tabIndex=-1);k(mg,"keydown",null,c=>{Bb(c);c.stopPropagation()});a.appendChild(mg)};
|
|
137
137
|
ug=function(a,b,c,d,e=!0){kg();og=a;pg=c;if(c=mg){qg=d!=null?d:lb;var f=Aa(qg.getFocusableElement(),p.OWNS);l(qg.getFocusableElement(),p.OWNS,f?[f,c.id]:c.id);qg.getFocusableElement().classList.add("blocklyShowingWidgetDiv");var g;(g=rb())==null||g.appendChild(c);c.style.direction=b?"rtl":"ltr";c.style.display="block";!d&&a instanceof rg&&a.getSourceBlock();sg=qg.getRenderer().getClassName();tg=qg.getTheme().getClassName();sg&&n(c,sg);tg&&n(c,tg);e&&(jg=$.t().takeEphemeralFocus(c));$.t().registerPopoverFocusLossHandler(lg)}};
|
|
138
138
|
kg=function(){if(og){og=null;var a=mg;if(a){$.t().unregisterPopoverFocusLossHandler(lg);a.style.display="none";a.style.left="";a.style.top="";pg&&(pg(),pg=null);a.textContent="";sg&&(Ma(a,sg),sg="");tg&&(Ma(a,tg),tg="");var b;(b=qg)==null||b.markFocused();jg&&(jg(),jg=null);if(qg&&mg){var c;a=(c=Aa(qg.getFocusableElement(),p.OWNS))!=null?c:"";l(qg.getFocusableElement(),p.OWNS,a.replace(mg.id,""));qg.getFocusableElement().classList.remove("blocklyShowingWidgetDiv")}}}};vg=function(a){og===a&&kg()};
|
|
139
|
-
wg=function(a){for(var b=qg===null,c=a;!b&&c;){if(c===a){b=!0;break}c=a.options.parentWorkspace}b&&kg()};xg=function(a,b,c){if(mg){var d=mg.parentElement;d&&(
|
|
140
|
-
|
|
141
|
-
Hg=function(a,b,c,d,e){ug(Ag,c,Bg,d);if(b.length){e||(a instanceof PointerEvent?e=new D(a.clientX,a.clientY):(console.warn("Context menu opened with keyboard but no location given"),e=new D(0,0)));var f=Cg(b,c,a,e);Dg=f;Eg(f,c,e);setTimeout(function(){f.focus()},1);Fg=null}else Gg()};
|
|
139
|
+
wg=function(a){for(var b=qg===null,c=a;!b&&c;){if(c===a){b=!0;break}c=a.options.parentWorkspace}b&&kg()};xg=function(a,b,c){if(mg){var d=mg.parentElement;d&&({x:a,y:b}=ec(a,b,d));mg.style.left=a+"px";mg.style.top=b+"px";mg.style.height=c+"px"}};yg=function(a,b,c,d){var e=b.bottom+c.height>=a.bottom?b.top-c.height:b.bottom;a=d?Math.min(Math.max(b.right-c.width,a.left),a.right-c.width):Math.max(Math.min(b.left,a.right-c.width),a.left);e<0?xg(a,0,c.height+e):xg(a,e,c.height)};
|
|
140
|
+
zg=function(){var a;(a=og)!=null&&a.repositionForWindowResize&&og.repositionForWindowResize()||kg()};Hg=function(a,b,c,d,e){ug(Ag,c,Bg,d);if(b.length){e||(a instanceof PointerEvent?e=new D(a.clientX,a.clientY):(console.warn("Context menu opened with keyboard but no location given"),e=new D(0,0)));var f=Cg(b,c,a,e);Dg=f;Eg(f,c,e);setTimeout(function(){f.focus()},1);Fg=null}else Gg()};
|
|
142
141
|
Cg=function(a,b,c,d){var e=new Ig;e.setRole(Ka.MENU);for(let f=0;f<a.length;f++){let g=a[f];if(g.separator){e.addChild(new Jg);continue}let h=new Kg(Lg(g));h.setRightToLeft(b);h.setRole(Ka.MENUITEM);e.addChild(h);h.setEnabled(g.enabled);if(g.enabled)h.onAction(function(m,z){Gg();requestAnimationFrame(()=>{setTimeout(()=>{g.callback(g.scope,c,z,d)},0)})},{})}return e};
|
|
143
|
-
Eg=function(a,b,c){var d=
|
|
142
|
+
Eg=function(a,b,c){var d=nc();c=new cc(c.y+d.top,c.y+d.top,c.x+d.left,c.x+d.left);var e=mg;if(!e)throw Error("Attempting to create a context menu when widget div is null");e=a.render(e);n(e,"blocklyContextMenu");k(e,"contextmenu",null,Mg);a.focus();e=a.getSize();b&&(c.left+=e.width,c.right+=e.width,d.left+=e.width,d.right+=e.width);yg(d,c,e,b);a.focus()};Mg=function(a){a.preventDefault();a.stopPropagation()};Gg=function(){vg(Ag);Fg=null;var a;(a=Dg)==null||a.dispose();Dg=null};
|
|
144
143
|
Bg=function(){Dg&&(Dg.dispose(),Dg=null)};$.Pg=function(a,b){return()=>{$.Ub++;try{var c=b instanceof Element?Ng(b,a.workspace):de(b,a.workspace);let d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-$.Og.snapRadius:d.x+$.Og.snapRadius;d.y+=$.Og.snapRadius*2;c.moveBy(d.x,d.y)}finally{$.Ub--}Vb()&&!c.isShadow()&&w(new (u(v.BLOCK_CREATE))(c));$.t().focusNode(c);return c}};
|
|
145
144
|
Lg=function(a){var b=a.text;if(b&&!(b instanceof HTMLElement)){let c=document.createElement("div");c.className="blocklyShortcutContainer";let d=document.createElement("span");d.textContent=b;b=document.createElement("span");b.className="blocklyShortcut";a="id"in a&&a.associatedKeyboardShortcut?re(a.associatedKeyboardShortcut):"";b.textContent=` ${a}`;c.appendChild(d);c.appendChild(b);return c}return a.text};
|
|
146
145
|
Qg=function(a,b){b=pa(b,a.getParentSvg(),a.getInverseScreenCTM());b.x/=a.scale;b.y/=a.scale;return b};Sg=function(a,b,c){b=Qg(a,b);Rg.set(a,D.difference(c,b))};Tg=function(a,b){b=Qg(a,b);a=Rg.get(a);if(!a)throw Error("Drag not initialized");return D.sum(a,b)};
|
|
147
|
-
Ug=function(a,b=!1){var c=$.
|
|
148
|
-
a.isOwnDeletable()||c.setAttribute("deletable","false");return c};Vg=function(a){var b=$.
|
|
146
|
+
Ug=function(a,b=!1){var c=$.sc("comment");b||c.setAttribute("id",a.id);b=a.workspace;var d=a.getRelativeToSurfaceXY().clone();d.x=b.RTL?b.getWidth()-d.x:d.x;c.setAttribute("x",`${d.x}`);c.setAttribute("y",`${d.y}`);c.setAttribute("w",`${a.getSize().width}`);c.setAttribute("h",`${a.getSize().height}`);a.getText()&&(c.textContent=a.getText());a.isCollapsed()&&c.setAttribute("collapsed","true");a.isOwnEditable()||c.setAttribute("editable","false");a.isOwnMovable()||c.setAttribute("movable","false");
|
|
147
|
+
a.isOwnDeletable()||c.setAttribute("deletable","false");return c};Vg=function(a){var b=$.sc("variables");for(let c=0;c<a.length;c++){let d=a[c],e=$.sc("variable");e.appendChild($.tc(d.getName()));d.getType()&&e.setAttribute("type",d.getType());e.id=d.getId();b.appendChild(e)}return b};
|
|
149
148
|
Yg=function(a,b){if(a.isInsertionMarker()&&(a=a.getChildren(!1)[0],!a))return new DocumentFragment;var c=0;a.workspace.RTL&&(c=a.workspace.getWidth());b=Wg(a,b);if(b.nodeType===Xg.ELEMENT_NODE){let d=a.getRelativeToSurfaceXY();b.setAttribute("x",String(Math.round(a.workspace.RTL?c-d.x:d.x)));b.setAttribute("y",String(Math.round(d.y)))}return b};
|
|
150
|
-
Wg=function(a,b){if(a.isInsertionMarker())return(b=a.getChildren(!1)[0])?Wg(b):new DocumentFragment;var c=$.
|
|
151
|
-
var g=f.bubbleIsVisible();f=f.getBubbleLocation();var h=$.
|
|
152
|
-
(f=d.connection.targetBlock(),d.type===$.je.VALUE?m=$.
|
|
153
|
-
Array.from(a.getDisabledReasons()).map(encodeURIComponent).join(","));a.isOwnDeletable()||c.setAttribute("deletable","false");a.isOwnMovable()||c.setAttribute("movable","false");a.isOwnEditable()||c.setAttribute("editable","false");m=a.getNextBlock();if(m&&(e=Wg(m,b),e.nodeType===Xg.ELEMENT_NODE)){var z=$.
|
|
154
|
-
$g=function(a,b){for(var c=a=a.cloneNode(!0),d;c;)if(b&&c.nodeName==="shadow"&&c.removeAttribute("id"),c.firstChild)c=c.firstChild;else{for(;c&&!c.nextSibling;){d=c;c=c.parentNode;let e;d.nodeType===Xg.TEXT_NODE&&d.data.trim()===""&&((e=c)==null?void 0:e.firstChild)!==d&&Oa(d)}c&&(d=c,c=c.nextSibling,d.nodeType===Xg.TEXT_NODE&&d.data.trim()===""&&Oa(d))}return a};ae=function(a){return
|
|
149
|
+
Wg=function(a,b){if(a.isInsertionMarker())return(b=a.getChildren(!1)[0])?Wg(b):new DocumentFragment;var c=$.sc(a.isShadow()?"shadow":"block");c.setAttribute("type",a.type);b||(c.id=a.id);if(a.mutationToDom){var d=a.mutationToDom();d&&(d.hasChildNodes()||d.hasAttributes())&&c.appendChild(d)}for(var e of a.getFields())e.isSerializable()?(d=$.sc("field"),d.setAttribute("name",e.name||""),d=e.toXml(d)):d=null,d&&c.appendChild(d);if(e=a.getCommentText()){var f=a.getIcon(Zg.COMMENT);d=f.getBubbleSize();
|
|
150
|
+
var g=f.bubbleIsVisible();f=f.getBubbleLocation();var h=$.sc("comment");h.appendChild($.tc(e));h.setAttribute("pinned",`${g}`);h.setAttribute("h",`${d.height}`);h.setAttribute("w",`${d.width}`);f&&(h.setAttribute("x",`${a.workspace.RTL?a.workspace.getWidth()-(f.x+d.width):f.x}`),h.setAttribute("y",`${f.y}`));c.appendChild(h)}a.data&&(e=$.sc("data"),e.appendChild($.tc(a.data)),c.appendChild(e));for(e=0;e<a.inputList.length;e++){d=a.inputList[e];var m=void 0;g=!0;d.type!==$.je.DUMMY&&d.type!==$.je.END_ROW&&
|
|
151
|
+
(f=d.connection.targetBlock(),d.type===$.je.VALUE?m=$.sc("value"):d.type===$.je.STATEMENT&&(m=$.sc("statement")),h=d.connection.getShadowDom(),!h||f&&f.isShadow()||m.appendChild($g(h,b)),f&&(f=Wg(f,b),f.nodeType===Xg.ELEMENT_NODE&&(m.appendChild(f),g=!1)),m.setAttribute("name",d.name),g||c.appendChild(m))}a.inputsInline!==void 0&&a.inputsInline!==a.inputsInlineDefault&&c.setAttribute("inline",String(a.inputsInline));a.isCollapsed()&&c.setAttribute("collapsed","true");a.isEnabled()||c.setAttribute("disabled-reasons",
|
|
152
|
+
Array.from(a.getDisabledReasons()).map(encodeURIComponent).join(","));a.isOwnDeletable()||c.setAttribute("deletable","false");a.isOwnMovable()||c.setAttribute("movable","false");a.isOwnEditable()||c.setAttribute("editable","false");m=a.getNextBlock();if(m&&(e=Wg(m,b),e.nodeType===Xg.ELEMENT_NODE)){var z=$.sc("next");z.appendChild(e);c.appendChild(z)}a=a.nextConnection&&a.nextConnection.getShadowDom();!a||m&&m.isShadow()||z.appendChild($g(a,b));return c};
|
|
153
|
+
$g=function(a,b){for(var c=a=a.cloneNode(!0),d;c;)if(b&&c.nodeName==="shadow"&&c.removeAttribute("id"),c.firstChild)c=c.firstChild;else{for(;c&&!c.nextSibling;){d=c;c=c.parentNode;let e;d.nodeType===Xg.TEXT_NODE&&d.data.trim()===""&&((e=c)==null?void 0:e.firstChild)!==d&&Oa(d)}c&&(d=c,c=c.nextSibling,d.nodeType===Xg.TEXT_NODE&&d.data.trim()===""&&Oa(d))}return a};ae=function(a){return yc(a).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")};
|
|
155
154
|
$.ch=function(a,b){var c=0;b.RTL&&(c=b.getWidth());var d=[];Ta();var e=$.gd;e||$.B(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);var f=!0;try{for(let g=0,h;h=a.childNodes[g];g++){let m=h.nodeName.toLowerCase(),z=h;if(m==="block"||m==="shadow"&&!$.Qc){let F=Ng(z,b);d.push(F.id);let J,V=parseInt((J=z.getAttribute("x"))!=null?J:"10",10),ja,Xa=parseInt((ja=z.getAttribute("y"))!=null?ja:"10",10);isNaN(V)||isNaN(Xa)||F.moveBy(b.RTL?c-V:V,Xa,["create"]);f=!1}else{if(m==="shadow")throw TypeError("Shadow block cannot be a top-level block.");
|
|
156
155
|
if(m==="comment")ah(z,b);else if(m==="variables"){if(f)bh(z,b);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");f=!1}}}}finally{$.B(e),b.setResizesEnabled&&b.setResizesEnabled(!0),b.rendered&&dd(),Ua()}w(new (u(v.FINISHED_LOADING))(b));return d};
|
|
157
|
-
ah=function(a,b){var c,d=(c=a.getAttribute("id"))!=null?c:void 0;c=b.rendered?new dh(b,d):new eh(b,d);var e;c.setText((e=a.textContent)!=null?e:"");var f;e=parseInt((f=a.getAttribute("x"))!=null?f:"",10);var g;f=parseInt((g=a.getAttribute("y"))!=null?g:"",10);isNaN(e)||isNaN(f)||(e=b.RTL?b.getWidth()-e:e,c.moveTo(new D(e,f)));var h;b=parseInt((h=a.getAttribute("w"))!=null?h:"",10);var m;h=parseInt((m=a.getAttribute("h"))!=null?m:"",10);isNaN(b)||isNaN(h)||c.setSize(new
|
|
156
|
+
ah=function(a,b){var c,d=(c=a.getAttribute("id"))!=null?c:void 0;c=b.rendered?new dh(b,d):new eh(b,d);var e;c.setText((e=a.textContent)!=null?e:"");var f;e=parseInt((f=a.getAttribute("x"))!=null?f:"",10);var g;f=parseInt((g=a.getAttribute("y"))!=null?g:"",10);isNaN(e)||isNaN(f)||(e=b.RTL?b.getWidth()-e:e,c.moveTo(new D(e,f)));var h;b=parseInt((h=a.getAttribute("w"))!=null?h:"",10);var m;h=parseInt((m=a.getAttribute("h"))!=null?m:"",10);isNaN(b)||isNaN(h)||c.setSize(new ic(b,h));a.getAttribute("collapsed")===
|
|
158
157
|
"true"&&c.setCollapsed(!0);a.getAttribute("editable")==="false"&&c.setEditable(!1);a.getAttribute("movable")==="false"&&c.setMovable(!1);a.getAttribute("deletable")==="false"&&c.setDeletable(!1);return c};$.fh=function(a,b){a=Ng(a,b);b.rendered&&dd();return a};
|
|
159
158
|
Ng=function(a,b){$.Ub++;var c=b.getVariableMap().getAllVariables();try{var d=gh(a,b);if(b.rendered){let e=d,f=d.getDescendants(!1);e.setConnectionTracking(!1);for(let g=f.length-1;g>=0;g--)f[g].initSvg();for(let g=f.length-1;g>=0;g--)f[g].queueRender();setTimeout(function(){e.disposed||e.setConnectionTracking(!0)},1);b.resizeContents()}else{let e=d.getDescendants(!1);for(let f=e.length-1;f>=0;f--)e[f].initModel()}}finally{$.Ub--}if(Vb()){a=Xd(b,c);for(b=0;b<a.length;b++)c=a[b],w(new (u(v.VAR_CREATE))(c));
|
|
160
159
|
w(new (u(v.BLOCK_CREATE))(d))}return d};bh=function(a,b){for(let d=0;d<a.children.length;d++){var c=a.children[d];let e=c.getAttribute("type"),f=c.getAttribute("id");c=c.textContent;if(!c)break;b.getVariableMap().createVariable(c,e!=null?e:void 0,f)}};
|
|
161
|
-
hh=function(a,b){for(let c=0;c<a.length;c++){let d=a[c],e=d.textContent,f=d.getAttribute("pinned")==="true",g,h=parseInt((g=d.getAttribute("w"))!=null?g:"50",10),m,z=parseInt((m=d.getAttribute("h"))!=null?m:"50",10),F,J=parseInt((F=d.getAttribute("x"))!=null?F:"",10),V,ja=parseInt((V=d.getAttribute("y"))!=null?V:"",10);b.setCommentText(e);let Xa=b.getIcon(Zg.COMMENT);isNaN(h)||isNaN(z)||Xa.setBubbleSize(new
|
|
160
|
+
hh=function(a,b){for(let c=0;c<a.length;c++){let d=a[c],e=d.textContent,f=d.getAttribute("pinned")==="true",g,h=parseInt((g=d.getAttribute("w"))!=null?g:"50",10),m,z=parseInt((m=d.getAttribute("h"))!=null?m:"50",10),F,J=parseInt((F=d.getAttribute("x"))!=null?F:"",10),V,ja=parseInt((V=d.getAttribute("y"))!=null?V:"",10);b.setCommentText(e);let Xa=b.getIcon(Zg.COMMENT);isNaN(h)||isNaN(z)||Xa.setBubbleSize(new ic(h,z));Xa.setBubbleVisible(f);setTimeout(()=>{isNaN(J)||isNaN(ja)||(J=b.workspace.RTL?b.workspace.getWidth()-
|
|
162
161
|
(J+h):J,Xa.setBubbleLocation(new D(J,ja)));Xa.setBubbleVisible(f)},1)}};ih=function(a){var b=null,c=null;for(let d=0;d<a.childNodes.length;d++){let e=a.childNodes[d];e.nodeType===Xg.ELEMENT_NODE&&(e.nodeName.toLowerCase()==="block"?b=e:e.nodeName.toLowerCase()==="shadow"&&(c=e))}return{childBlockElement:b,childShadowElement:c}};
|
|
163
162
|
gh=function(a,b,c,d){var e,f=a.getAttribute("type");if(!f)throw TypeError("Block type unspecified: "+a.outerHTML);var g=(e=a.getAttribute("id"))!=null?e:void 0;e=b.newBlock(f,g);var h=[],m=[],z=[],F=[],J=[];g=[];for(var V=0;V<a.children.length;V++){var ja=a.children[V];if(ja.nodeType!==Xg.TEXT_NODE)switch(ja.nodeName.toLowerCase()){case "mutation":h.push(ja);break;case "comment":m.push(ja);break;case "data":z.push(ja);break;case "title":case "field":F.push(ja);break;case "value":case "statement":J.push(ja);
|
|
164
|
-
break;case "next":g.push(ja);break;default:console.warn("Ignoring unknown tag: "+ja.nodeName)}}V=!1;for(ja=0;ja<h.length;ja++){let
|
|
163
|
+
break;case "next":g.push(ja);break;default:console.warn("Ignoring unknown tag: "+ja.nodeName)}}V=!1;for(ja=0;ja<h.length;ja++){let dj=h[ja];e.domToMutation&&(e.domToMutation(dj),e.initSvg&&(V=!0))}h=V;hh(m,e);m=z;for(z=0;z<m.length;z++)e.data=m[z].textContent;if(c){if(d)if(e.previousConnection)d=e.previousConnection;else throw TypeError("Next block does not have previous statement.");else if(e.outputConnection)d=e.outputConnection;else if(e.previousConnection)d=e.previousConnection;else throw TypeError("Child block does not have output or previous statement.");
|
|
165
164
|
if(!c.connect(d))throw a=e.workspace.connectionChecker,TypeError(a.getErrorMessage(a.canConnectWithReason(d,c,!1),d,c));}c=F;for(F=0;F<c.length;F++)m=c[F],(z=m.getAttribute("name"))?(d=e,(V=d.getField(z))?V.fromXml(m):console.warn("Ignoring non-existent field "+z+" in block "+d.type)):console.warn(`Ignoring unnamed field in block ${e.type}`);for(c=0;c<J.length;c++){F=J[c];d=(m=F.getAttribute("name"))?e.getInput(m):null;if(!d){console.warn("Ignoring non-existent input "+m+" in block "+f);break}F=ih(F);
|
|
166
165
|
if(F.childBlockElement){if(!d.connection)throw TypeError("Input connection does not exist.");gh(F.childBlockElement,b,d.connection,!1)}if(F.childShadowElement){var Xa=void 0;(Xa=d.connection)==null||Xa.setShadowDom(F.childShadowElement)}}f=g;for(Xa=0;Xa<f.length;Xa++){g=ih(f[Xa]);if(g.childBlockElement){if(!e.nextConnection)throw TypeError("Next statement does not exist.");if(e.nextConnection.isConnected())throw TypeError("Next statement is already connected.");gh(g.childBlockElement,b,e.nextConnection,
|
|
167
166
|
!0)}g.childShadowElement&&e.nextConnection&&e.nextConnection.setShadowDom(g.childShadowElement)}h&&e.initSvg();(b=a.getAttribute("inline"))&&e.setInputsInline(b==="true");(b=a.getAttribute("disabled"))&&e.setDisabledReason(b==="true"||b==="disabled","MANUALLY_DISABLED");b=a.getAttribute("disabled-reasons");if(b!==null)for(var cb of b.split(","))e.setDisabledReason(!0,decodeURIComponent(cb));(cb=a.getAttribute("deletable"))&&e.setDeletable(cb==="true");(cb=a.getAttribute("movable"))&&e.setMovable(cb===
|
|
@@ -192,7 +191,7 @@ void 0;(d=!!bi(d,e))&&c instanceof KeyboardEvent&&mi.show(b,{message:$.C.KEYBOAR
|
|
|
192
191
|
oi=function(){var a=x.registry.createSerializedKey(L.X,[L.CTRL_CMD]);x.registry.register({name:K.CUT,preconditionFn(b,c){c=c.focusedNode;(c=!!c&&!b.isReadOnly()&&!b.isDragging()&&!$.t().ephemeralFocusTaken()&&li(c)&&gi(c)&&c.isDeletable())||b.getAudioManager().playErrorBeep();return c},callback(b,c,d,e){d=e.focusedNode;if(!(d&&li(d)&&gi(d)&&d.isDeletable()&&fi(d)))return!1;e=hi(d)?d.getRelativeToSurfaceXY():void 0;e=bi(d,e);d instanceof ji?(d.checkAndDelete(),c.preventDefault()):gi(d)&&($.B(!0),d.dispose(),
|
|
193
192
|
$.B(!1),b.getAudioManager().play("delete"),c.preventDefault());e&&c instanceof KeyboardEvent&&mi.show(b,{message:$.C.KEYBOARD_NAV_CUT_HINT.replace("%1",re(K.PASTE)),duration:7,id:"cutHint"});return!!e},keyCodes:[a],displayText:()=>$.C.CUT_SHORTCUT})};
|
|
194
193
|
pi=function(){var a=x.registry.createSerializedKey(L.V,[L.CTRL_CMD]);x.registry.register({name:K.PASTE,preconditionFn(){var b=Zh;if(!b||!b.rendered)return!1;var c=b.isFlyout?b.targetWorkspace:b;(c=!!Yh&&!!c&&!c.isReadOnly()&&!c.isDragging()&&!$.t().ephemeralFocusTaken())||b.getAudioManager().playErrorBeep();return c},callback(b,c){var d=Yh,e=$.t().getFocusedNode();if(!d)return!1;var f=Zh;if(!f)return!1;mi.hide(b,"cutHint");mi.hide(b,"copiedHint");b=f.isFlyout?f.targetWorkspace:f;if(!b||b.isReadOnly())return!1;
|
|
195
|
-
if(c instanceof PointerEvent){var g=
|
|
194
|
+
if(c instanceof PointerEvent){var g=pc(b,new D(c.clientX,c.clientY));return!!di(d,b,g)}if(c=(g=b.getNavigator().getSourceBlockFromNode(e))==null?void 0:g.getRelativeToSurfaceXY())return!!di(d,b,c);g=ai;if(!g)return!!di(d,b);var {left:h,top:m,width:z,height:F}=b.getMetricsManager().getViewMetrics(!0);if((new cc(m,m+F,h,h+z)).contains(g.x,g.y))return!!di(d,b);g=new D(h+z/2,m+F/2);return!!di(d,b,g)},keyCodes:[a],displayText:()=>$.C.PASTE_SHORTCUT})};
|
|
196
195
|
qi=function(){var a=x.registry.createSerializedKey(L.Z,[L.CTRL_CMD]);x.registry.register({name:K.UNDO,preconditionFn(b){return!b.isReadOnly()&&!b.isDragging()&&!$.t().ephemeralFocusTaken()},callback(b,c){b.hideChaff();b.undo();c.preventDefault();return!0},keyCodes:[a],displayText:()=>$.C.UNDO})};
|
|
197
196
|
ri=function(){var a=x.registry.createSerializedKey(L.Z,[L.CTRL_CMD,L.SHIFT]),b=x.registry.createSerializedKey(L.Y,[L.CTRL]);x.registry.register({name:K.REDO,preconditionFn(c){return!c.isDragging()&&!c.isReadOnly()&&!$.t().ephemeralFocusTaken()},callback(c,d){c.hideChaff();c.redo();d.preventDefault();return!0},keyCodes:[a,b],displayText:()=>$.C.REDO})};
|
|
198
197
|
yi=function(){var a=d=>{var e=$.t().getFocusedNode();if(hi(e))return e;var f;return(f=d.getNavigator().getSourceBlockFromNode($.t().getFocusedNode()))!=null?f:void 0},b=x.registry.createSerializedKey(L.M,[L.SHIFT]),c={name:K.START_MOVE,preconditionFn:d=>{d=a(d);return!!d&&si.mover.canMove(d)},callback:(d,e)=>{Nd.setIsActive(!0);(d=a(d))&&$.t().focusNode(d);return!!d&&si.mover.startMove(d,e)},keyCodes:[L.M],displayText:()=>$.C.SHORTCUTS_START_MOVE};b=[c,Object.assign({},c,{name:K.START_MOVE_STACK,
|
|
@@ -231,8 +230,8 @@ Xi=function(){var a=x.registry.createSerializedKey(L.END,[L.CTRL_CMD]);x.registr
|
|
|
231
230
|
Yi=function(a,b,c){var d=b[b.length-1].start>=b[0].start;return{items:a,leadingEdge:e=>d?b[e].start:-b[e].end,trailingEdge:e=>d?b[e].end:-b[e].start,viewLeadingEdge:d?c.start:-c.end,viewTrailingEdge:d?c.end:-c.start}};
|
|
232
231
|
Zi=function(a){var b=a.getNavigator().getNavigableItems(a.getRootFocusableNode());if(!b.length)return null;var c=a.isHorizontal(),d=f=>{f=f.getBoundingClientRect();return c?{start:f.left,end:f.right}:{start:f.top,end:f.bottom}};a=a.getRootFocusableNode().getFocusableElement();var e=b.map(f=>d(f.getFocusableElement()));return Yi(b,e,d(a))};
|
|
233
232
|
$i=function(a){var b=a.getNavigator().getNavigableItems(a.getRootFocusableNode()).filter(f=>ei(f));if(!b.length)return null;var c,d,e=!!((c=a.targetWorkspace)==null?0:(d=c.getFlyout())==null?0:d.horizontalLayout);a=a.getMetricsManager().getViewMetrics(!0);a=e?{start:a.left,end:a.left+a.width}:{start:a.top,end:a.top+a.height};c=b.map(f=>{f=f.getBoundingRectangle();return e?{start:f.left,end:f.right}:{start:f.top,end:f.bottom}});return Yi(b,c,a)};
|
|
234
|
-
|
|
235
|
-
return!0};ej=function(){x.registry.register({name:K.JUMP_PREVIOUS_PAGE,preconditionFn:
|
|
233
|
+
bj=function(a,b){var c=aj(a);a=c?Zi(c):$i(a);if(!a)return!1;c=a.items;var d=$.t().getFocusedNode();d=d?c.indexOf(d):-1;var e=a.viewTrailingEdge-a.viewLeadingEdge,f=-1;if(b){var g=d>=0?Math.max(a.viewLeadingEdge,a.leadingEdge(d)):a.viewLeadingEdge;for(var h=0;h<c.length&&!(a.leadingEdge(h)>=g+e);h++)f=h}else for(g=d>=0?Math.min(a.viewTrailingEdge,a.trailingEdge(d)):a.viewTrailingEdge,h=c.length-1;h>=0&&!(a.trailingEdge(h)<=g-e);h--)f=h;if(f<0||f===d&&(f+=b?1:-1,f<0||f>=c.length))return!1;$.t().focusNode(c[f]);
|
|
234
|
+
return!0};ej=function(){x.registry.register({name:K.JUMP_PREVIOUS_PAGE,preconditionFn:cj,callback(a,b){if(!bj(a,!1))return!1;b.preventDefault();return!0},keyCodes:[L.PAGE_UP],allowCollision:!0,displayText:()=>$.C.SHORTCUTS_JUMP_PREVIOUS_PAGE})};fj=function(){x.registry.register({name:K.JUMP_NEXT_PAGE,preconditionFn:cj,callback(a,b){if(!bj(a,!0))return!1;b.preventDefault();return!0},keyCodes:[L.PAGE_DOWN],allowCollision:!0,displayText:()=>$.C.SHORTCUTS_JUMP_NEXT_PAGE})};
|
|
236
235
|
jj=function(){var a=[{name:K.SCROLL_LEFT,preconditionFn:gj,callback:(b,c)=>hj(b,c,ij.LEFT),keyCodes:[ui],allowCollision:!0,displayText:()=>$.C.SHORTCUTS_SCROLL_LEFT},{name:K.SCROLL_RIGHT,preconditionFn:gj,callback:(b,c)=>hj(b,c,ij.RIGHT),keyCodes:[vi],allowCollision:!0,displayText:()=>$.C.SHORTCUTS_SCROLL_RIGHT},{name:K.SCROLL_UP,preconditionFn:gj,callback:(b,c)=>hj(b,c,ij.UP),keyCodes:[wi],allowCollision:!0,displayText:()=>$.C.SHORTCUTS_SCROLL_UP},{name:K.SCROLL_DOWN,preconditionFn:gj,callback:(b,
|
|
237
236
|
c)=>hj(b,c,ij.DOWN),keyCodes:[xi],allowCollision:!0,displayText:()=>$.C.SHORTCUTS_SCROLL_DOWN}];for(let b of a)x.registry.register(b)};kj=function(){ii();ki();ni();oi();pi();qi();ri()};lj=function(){zi();yi();Ci();Di();Ai();Gi();Hi();Ji();Ki();Li();Mi();Ni()};mj=function(){Ei();Fi();Oi()};pj=function(a,b=!1){var c=$.C.KEYBOARD_NAV_UNCONSTRAINED_MOVE_HINT.replace("%1",na||nj||oj?$.C.COMMAND_KEY:$.C.CONTROL_KEY).replace("%2",$.C.ENTER_KEY);mi.show(a,{message:c,id:"unconstrainedMoveHint",oncePerSession:!b})};
|
|
238
237
|
qj=function(a){var b=$.C.KEYBOARD_NAV_CONSTRAINED_MOVE_HINT.replace("%1",$.C.ENTER_KEY);mi.show(a,{message:b,id:"constrainedMoveHint",oncePerSession:!0})};
|
|
@@ -244,10 +243,10 @@ c.sort(yj);return[b,c]};yj=function(a,b){return a[0].localeCompare(b[0],void 0,{
|
|
|
244
243
|
Aj=function(a,b,c){for(let d of b.getAllBlocks(!1))if(d!==c&&zd(d)&&$.Cj.equals(d.getProcedureDef()[0],a))return!0;c=c&&wj(c)?c==null?void 0:c.getProcedureModel():void 0;for(let d of b.getProcedureMap().getProcedures())if(d!==c&&$.Cj.equals(d.getName(),a))return!0;return!1};
|
|
245
244
|
$.Ej=function(a){var b=this.getSourceBlock();if(!b)throw new Dj;a=a.trim();var c=$.Bj(a,b);wj(b)&&!b.isInsertionMarker()&&b.getProcedureModel().setName(c);var d=this.getValue();if(d!==a&&d!==c)for(a=b.workspace.getAllBlocks(!1),b=0;b<a.length;b++){let e=a[b];e.renameProcedure&&e.renameProcedure(d,c)}return c};
|
|
246
245
|
Fj=function(a){function b(d,e){for(let [f,g]of d)c.push({kind:"block",type:e,gap:16,extraState:{name:f,params:g}})}var c=[];zb.procedures_defnoreturn&&c.push({kind:"block",type:"procedures_defnoreturn",gap:16,fields:{NAME:$.C.PROCEDURES_DEFNORETURN_PROCEDURE}});zb.procedures_defreturn&&c.push({kind:"block",type:"procedures_defreturn",gap:16,fields:{NAME:$.C.PROCEDURES_DEFRETURN_PROCEDURE}});zb.procedures_ifreturn&&c.push({kind:"block",type:"procedures_ifreturn",gap:16});c.length&&(c[c.length-1].gap=
|
|
247
|
-
24);a=zj(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c};Gj=function(a){var b=[],c=a.getBlocksByType("procedures_mutatorarg",!1);for(let f=0,g;g=c[f];f++)b.push(g.getFieldValue("NAME"));c=$.
|
|
246
|
+
24);a=zj(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c};Gj=function(a){var b=[],c=a.getBlocksByType("procedures_mutatorarg",!1);for(let f=0,g;g=c[f];f++)b.push(g.getFieldValue("NAME"));c=$.sc("xml");var d=$.sc("block");d.setAttribute("type","procedures_mutatorarg");var e=$.sc("field");e.setAttribute("name","NAME");b=Kd("x",b);b=$.tc(b);e.appendChild(b);d.appendChild(e);c.appendChild(d);a.updateToolbox(c)};
|
|
248
247
|
Ij=function(a){if(a.type===v.BUBBLE_OPEN&&a.bubbleType==="mutator"&&a.isOpen&&a.blockId){a=hb(a.workspaceId).getBlockById(a.blockId);var b=a.type;if(b==="procedures_defnoreturn"||b==="procedures_defreturn")a=a.getIcon($.sh.TYPE).getWorkspace(),Gj(a),a.addChangeListener(Hj)}};Hj=function(a){if(a.type===v.BLOCK_CREATE||a.type===v.BLOCK_DELETE||a.type===v.BLOCK_CHANGE||a.type===v.BLOCK_FIELD_INTERMEDIATE_CHANGE)a=hb(a.workspaceId),Gj(a)};
|
|
249
248
|
Jj=function(a,b){return b.getAllBlocks(!1).filter(c=>wj(c)&&!c.isProcedureDef()&&c.getProcedureModel()&&$.Cj.equals(c.getProcedureModel().getName(),a)||c&&typeof c.getProcedureCall==="function"&&typeof c.renameProcedure==="function"&&$.Cj.equals(c.getProcedureCall(),a))};
|
|
250
|
-
$.Kj=function(a){var b=$.Qc,c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=Jj(c,a.workspace);for(let f=0,g;g=a[f];f++){c=(c=g.mutationToDom())&&
|
|
249
|
+
$.Kj=function(a){var b=$.Qc,c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=Jj(c,a.workspace);for(let f=0,g;g=a[f];f++){c=(c=g.mutationToDom())&&yc(c);g.domToMutation&&g.domToMutation(d);var e=g.mutationToDom();e=e&&yc(e);c!==e&&($.Qc=!1,w(new (u(v.BLOCK_CHANGE))(g,"mutation",null,c,e)),$.Qc=b)}};$.Lj=function(a,b){for(let c of b.getAllBlocks(!1))if(wj(c)&&c.isProcedureDef()&&$.Cj.equals(c.getProcedureModel().getName(),a)||zd(c)&&$.Cj.equals(c.getProcedureDef()[0],a))return c;return null};
|
|
251
250
|
Mj=function(a,b){A(y.RENDERER,a,b)};Nj=function(a,b,c){a=new (Fb(y.RENDERER,a,void 0))(a);a.init(b,c);return a};Oj=function(a){Dd(a.getTargetWorkspace(),void 0,"String")};Pj=function(a){Dd(a.getTargetWorkspace(),void 0,"Number")};Qj=function(a){Dd(a.getTargetWorkspace(),void 0,"Colour")};
|
|
252
251
|
Rj=function(a){zb.variables_set_dynamic||zb.variables_get_dynamic||console.warn("There are no dynamic variable blocks, but there is a dynamic variable category.");a.registerButtonCallback("CREATE_VARIABLE_STRING",Oj);a.registerButtonCallback("CREATE_VARIABLE_NUMBER",Pj);a.registerButtonCallback("CREATE_VARIABLE_COLOUR",Qj);return[{kind:"button",text:$.C.NEW_STRING_VARIABLE,callbackkey:"CREATE_VARIABLE_STRING"},{kind:"button",text:$.C.NEW_NUMBER_VARIABLE,callbackkey:"CREATE_VARIABLE_NUMBER"},{kind:"button",
|
|
253
252
|
text:$.C.NEW_COLOUR_VARIABLE,callbackkey:"CREATE_VARIABLE_COLOUR"},...Ed(a,a.getVariableMap().getAllVariables(),!1,"variables_get_dynamic","variables_set_dynamic")]};Sj=function(a){var b=a.saveState();if(!a.getParameters().length)return b;b.parameters=a.getParameters().map(c=>c.saveState());return b};Tj=function(a,b,c,d){a=a.loadState(c,d);if(!c.parameters)return a;for(let [e,f]of c.parameters.entries())a.insertParameter(b.loadState(f,d),e);return a};
|
|
@@ -259,10 +258,10 @@ b.moveOptions&&b.moveOptions.scrollbars?(a.scrollbar=new Zj(a,b.moveOptions.scro
|
|
|
259
258
|
Yj=function(){ck||(k(document,"scroll",null,function(){var a=ib();for(let b=0,c;c=a[b];b++)c instanceof $h&&c.updateInverseScreenCTM()}),ka(document,"touchend",null,aa),ka(document,"touchcancel",null,aa),ka(document,"keydown",null,function(a){a.key==="Tab"&&Nd.setIsActive(!0)}));ck=!0};ak=function(a,b){b=b.getAudioManager();b.load([`${a}click.mp3`],"click");b.load([`${a}disconnect.mp3`],"disconnect");b.load([`${a}delete.mp3`],"delete");b.load([`${a}drop.mp3`],"drop")};
|
|
260
259
|
ek=function(){dk.registry.register({displayText(){return $.C.UNDO},preconditionFn(a){return a.workspace.getUndoStack().length>0?"enabled":"disabled"},callback(a){a.workspace.undo()},scopeType:dk.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1,associatedKeyboardShortcut:"undo"})};
|
|
261
260
|
fk=function(){dk.registry.register({displayText(){return $.C.REDO},preconditionFn(a){return a.workspace.getRedoStack().length>0?"enabled":"disabled"},callback(a){a.workspace.redo()},scopeType:dk.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2,associatedKeyboardShortcut:"redo"})};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
jk=function(){dk.registry.register({displayText(){return $.C.COLLAPSE_ALL},preconditionFn(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(let b=0;b<a.length;b++){let c=a[b];for(;c;){if(!c.isCollapsed())return"enabled";c=c.getNextBlock()}}return"disabled"}return"hidden"},callback(a){
|
|
265
|
-
kk=function(){dk.registry.register({displayText(){return $.C.EXPAND_ALL},preconditionFn(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(let b=0;b<a.length;b++){let c=a[b];for(;c;){if(c.isCollapsed())return"enabled";c=c.getNextBlock()}}return"disabled"}return"hidden"},callback(a){
|
|
261
|
+
gk=function(){dk.registry.register({displayText(){return $.C.CLEAN_UP},preconditionFn(a){return a.workspace.isMovable()?a.workspace.getTopBlocks(!1).length>1?"enabled":"disabled":"hidden"},callback(a){a.workspace.cleanUp()},scopeType:dk.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3,associatedKeyboardShortcut:"cleanup"})};
|
|
262
|
+
hk=function(a,b){function c(f){e--;f.setCollapsed(a);e===0&&$.B(!1)}var d=0,e=0;$.B(!0);for(let f=0;f<b.length;f++){let g=b[f];for(;g;)e++,setTimeout(c.bind(null,g),d),g=g.getNextBlock(),d+=10}};
|
|
263
|
+
jk=function(){dk.registry.register({displayText(){return $.C.COLLAPSE_ALL},preconditionFn(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(let b=0;b<a.length;b++){let c=a[b];for(;c;){if(!c.isCollapsed())return"enabled";c=c.getNextBlock()}}return"disabled"}return"hidden"},callback(a){hk(!0,a.workspace.getTopBlocks(!0))},scopeType:dk.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})};
|
|
264
|
+
kk=function(){dk.registry.register({displayText(){return $.C.EXPAND_ALL},preconditionFn(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(let b=0;b<a.length;b++){let c=a[b];for(;c;){if(c.isCollapsed())return"enabled";c=c.getNextBlock()}}return"disabled"}return"hidden"},callback(a){hk(!1,a.workspace.getTopBlocks(!0))},scopeType:dk.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})};
|
|
266
265
|
lk=function(a,b){if(a.isDeletable())Array.prototype.push.apply(b,a.getDescendants(!1));else{a=a.getChildren(!1);for(let c=0;c<a.length;c++)lk(a[c],b)}};mk=function(a){var b=[];a=a.getTopBlocks(!0);for(let c=0;c<a.length;c++)lk(a[c],b);return b};nk=function(a,b){b?$.B(b):($.B(!0),b=$.gd);var c=a.shift();c&&(c.isDeadOrDying()?nk(a,b):(c.dispose(!1,!0),setTimeout(nk,10,a,b)));$.B(!1)};
|
|
267
266
|
ok=function(){dk.registry.register({displayText(a){if(!a.workspace)return"";a=mk(a.workspace).length;return a===1?$.C.DELETE_BLOCK:$.C.DELETE_X_BLOCKS.replace("%1",`${a}`)},preconditionFn(a){return a.workspace?mk(a.workspace).length>0?"enabled":"disabled":"disabled"},callback(a){if(a.workspace){a.workspace.cancelCurrentGesture();var b=mk(a.workspace);b.length<2?nk(b):td($.C.DELETE_ALL_BLOCKS.replace("%1",String(b.length)),function(c){c&&nk(b)})}},scopeType:dk.ScopeType.WORKSPACE,id:"workspaceDelete",
|
|
268
267
|
weight:6})};pk=function(){dk.registry.register({displayText(){return $.C.DUPLICATE_BLOCK},preconditionFn(a){a=a.block;return!a.isInFlyout&&a.isDeletable()&&a.isMovable()?a.isDuplicatable()?"enabled":"disabled":"hidden"},callback(a){if(a.block){var b=a.block.toCopyData();b&&di(b,a.block.workspace)}},scopeType:dk.ScopeType.BLOCK,id:"blockDuplicate",weight:1,associatedKeyboardShortcut:"duplicate"})};
|
|
@@ -276,7 +275,7 @@ wk=function(){dk.registry.register({displayText(a){var b=a.block;a=b.getDescenda
|
|
|
276
275
|
xk=function(){dk.registry.register({displayText(){return $.C.HELP},preconditionFn(a){a=a.block;return(typeof a.helpUrl==="function"?a.helpUrl():a.helpUrl)?"enabled":"hidden"},callback(a){a.block.showHelp()},scopeType:dk.ScopeType.BLOCK,id:"blockHelp",weight:7})};
|
|
277
276
|
yk=function(){dk.registry.register({displayText:()=>$.C.REMOVE_COMMENT,preconditionFn(a){var b;return((b=a.comment)==null?0:b.isDeletable())?"enabled":"hidden"},callback(a){$.B(!0);var b;(b=a.comment)==null||b.dispose();$.B(!1);var c;(c=a.comment)==null||c.workspace.getAudioManager().play("delete")},scopeType:dk.ScopeType.COMMENT,id:"commentDelete",weight:6,associatedKeyboardShortcut:"delete"})};
|
|
278
277
|
zk=function(){dk.registry.register({displayText:()=>$.C.DUPLICATE_COMMENT,preconditionFn(a){var b;return((b=a.comment)==null?0:b.isMovable())?"enabled":"hidden"},callback(a){if(a.comment){var b=a.comment.toCopyData();b&&di(b,a.comment.workspace)}},scopeType:dk.ScopeType.COMMENT,id:"commentDuplicate",weight:1,associatedKeyboardShortcut:"duplicate"})};
|
|
279
|
-
Ak=function(){dk.registry.register({displayText:()=>$.C.ADD_COMMENT,preconditionFn:a=>{var b;return((b=a.workspace)==null?0:b.isMutator)?"hidden":"enabled"},callback:(a,b,c,d)=>{if(a=a.workspace)$.B(!0),b=new dh(a),b.moveTo(
|
|
278
|
+
Ak=function(){dk.registry.register({displayText:()=>$.C.ADD_COMMENT,preconditionFn:a=>{var b;return((b=a.workspace)==null?0:b.isMutator)?"hidden":"enabled"},callback:(a,b,c,d)=>{if(a=a.workspace)$.B(!0),b=new dh(a),b.moveTo(pc(a,new D(d.x,d.y))),$.t().focusNode(b),$.B(!1)},scopeType:dk.ScopeType.WORKSPACE,id:"commentCreate",weight:8})};Bk=function(){ek();fk();gk();jk();kk();ok();pk();rk();tk();uk();vk();wk();xk()};M=M||{};M.scope={};M.ASSUME_ES2020=!1;M.ASSUME_ES6=M.ASSUME_ES2020;M.ASSUME_ES5=M.ASSUME_ES6;
|
|
280
279
|
M.ASSUME_NO_NATIVE_MAP=!1;M.ASSUME_NO_NATIVE_SET=!1;M.ISOLATE_POLYFILLS=!1;M.FORCE_POLYFILL_PROMISE=!1;M.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;M.INSTRUMENT_ASYNC_CONTEXT=!0;M.objectCreate=M.ASSUME_ES5||typeof Object.create=="function"?Object.create:function(a){function b(){}b.prototype=a;return new b};M.defineProperty=M.ASSUME_ES5||typeof Object.defineProperties=="function"?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
|
|
281
280
|
M.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};M.global=M.ASSUME_ES2020?globalThis:M.getGlobal(this);M.IS_SYMBOL_NATIVE=typeof Symbol==="function"&&typeof Symbol("x")==="symbol";M.TRUST_ES6_POLYFILLS=!M.ISOLATE_POLYFILLS||M.IS_SYMBOL_NATIVE;M.polyfills={};
|
|
282
281
|
M.propertyToPolyfillSymbol={};M.POLYFILL_PREFIX="$jscp$";var Ck="Int8 Uint8 Uint8Clamped Int16 Uint16 Int32 Uint32 Float32 Float64".split(" ");M.global.BigInt64Array&&(Ck.push("BigInt64"),Ck.push("BigUint64"));M.TYPED_ARRAY_CLASSES=Ck;M.polyfillTypedArrayMethod=function(a,b,c,d){if(b)for(var e=0;e<M.TYPED_ARRAY_CLASSES.length;e++){var f=M.TYPED_ARRAY_CLASSES[e]+"Array.prototype."+a;M.ISOLATE_POLYFILLS?M.polyfillIsolated(f,b,c,d):M.polyfillUnisolated(f,b,c,d)}};
|
|
@@ -989,8 +988,8 @@ ll[ll.Alt=18]="Alt";ll[ll.Meta=91]="Meta";var eb=new Set,ml={};ml.warn=fb;var gb
|
|
|
989
988
|
ol.setParentContainer=sb;ol.setSelected=function(a){$.t().focusNode(a)};ol.svgResize=tb;ol.unregisterWorkpace=function(a){fb("Blockly.common.unregisterWorkpace","v13","v14","Blockly.common.unregisterWorkspace");kb(a)};ol.unregisterWorkspace=kb;var Cb=Object.create(null),pl={typeMap:Cb},Db=Object.create(null),y=class{constructor(a){this.name=a}toString(){return this.name}};y.CONNECTION_CHECKER=new y("connectionChecker");y.CONNECTION_PREVIEWER=new y("connectionPreviewer");y.EVENT=new y("event");y.FIELD=new y("field");y.INPUT=new y("input");y.RENDERER=new y("renderer");y.TOOLBOX=new y("toolbox");y.THEME=new y("theme");y.TOOLBOX_ITEM=new y("toolboxItem");y.FLYOUTS_VERTICAL_TOOLBOX=new y("flyoutsVerticalToolbox");
|
|
990
989
|
y.FLYOUTS_HORIZONTAL_TOOLBOX=new y("flyoutsHorizontalToolbox");y.FLYOUT_INFLATER=new y("flyoutInflater");y.METRICS_MANAGER=new y("metricsManager");y.BLOCK_DRAGGER=new y("blockDragger");y.SERIALIZER=new y("serializer");y.ICON=new y("icon");y.PASTER=new y("paster");y.VARIABLE_MODEL=new y("variableModel");y.VARIABLE_MAP=new y("variableMap");var ql={DEFAULT:"default",TEST_ONLY:pl};ql.Type=y;ql.getAllItems=Ib;ql.getClass=Hb;ql.getClassFromOptions=Jb;ql.getObject=function(a,b,c){return Fb(a,b,c)};
|
|
991
990
|
ql.hasItem=Gb;ql.register=A;ql.unregister=Eb;var Mb={genUid:()=>{var a=[];for(let b=0;b<20;b++)a[b]="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.random()*88);return a.join("")}},Kb=0,rl={TEST_ONLY:Mb};rl.genUid=Nb;rl.getNextUniqueId=Lb;var Qb,Ob;$.gd="";$.Qc=!0;$.Ub=0;Qb=[];Ob={FIRE_QUEUE:Qb,enqueueEvent:Sb,fireNow:Rb,fireInternal:function(a){if(Vb()){if(!Qb.length)try{requestAnimationFrame(()=>{setTimeout(Rb,0)})}catch(b){setTimeout(Rb,0)}Sb(a)}},setGroupInternal:function(a){$.gd=typeof a==="boolean"?a?Nb():"":a}};var sl;$.C=Object.create(null);sl={Msg:$.C,setLocale:Xb};var D=class{constructor(a,b){this.x=a;this.y=b}clone(){return new D(this.x,this.y)}scale(a){this.x*=a;this.y*=a;return this}translate(a,b){this.x+=a;this.y+=b;return this}static equals(a,b){return a===b?!0:a&&b?a.x===b.x&&a.y===b.y:!1}static distance(a,b){var c=a.x-b.x;a=a.y-b.y;return Math.sqrt(c*c+a*a)}static magnitude(a){return Math.sqrt(a.x*a.x+a.y*a.y)}static difference(a,b){return new D(a.x-b.x,a.y-b.y)}static sum(a,b){return new D(a.x+b.x,a.y+b.y)}};var cc=class{constructor(a,b,c,d){this.top=a;this.bottom=b;this.left=c;this.right=d}static from(a){return new cc(a.y,a.y+a.height,a.x,a.x+a.width)}clone(){return new cc(this.top,this.bottom,this.left,this.right)}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}getOrigin(){return new D(this.left,this.top)}contains(a,b){return a>=this.left&&a<=this.right&&b>=this.top&&b<=this.bottom}intersects(a){return this.left<=a.right&&this.right>=a.left&&this.bottom>=a.top&&this.top<=
|
|
992
|
-
a.bottom}static equals(a,b){return a===b?!0:a&&b?a.top===b.top&&a.bottom===b.bottom&&a.left===b.left&&a.right===b.right:!1}static createFromPoint(a,b,c){var d=a.x;a=a.y;return new cc(a,a+c,d,d+b)}};var
|
|
993
|
-
tl.scrollIntoContainerView=
|
|
991
|
+
a.bottom}static equals(a,b){return a===b?!0:a&&b?a.top===b.top&&a.bottom===b.bottom&&a.left===b.left&&a.right===b.right:!1}static createFromPoint(a,b,c){var d=a.x;a=a.y;return new cc(a,a+c,d,d+b)}};var ic=class{constructor(a,b){this.width=a;this.height=b}static equals(a,b){return a===b?!0:a&&b?a.width===b.width&&a.height===b.height:!1}static max(a,b){return new ic(Math.max(a.width,b.width),Math.max(a.height,b.height))}static min(a,b){return new ic(Math.min(a.width,b.width),Math.min(a.height,b.height))}};var Yb={getSizeInternal:function(a){if($b(a,"display")!=="none")return new ic(a.offsetWidth,a.offsetHeight);var b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";var f=a.offsetWidth;a=a.offsetHeight;b.display=c;b.position=e;b.visibility=d;return new ic(f,a)}},tl={TEST_ONLY:Yb};tl.getBorderBox=dc;tl.getComputedStyle=$b;tl.getContainerOffsetToScrollInto=fc;tl.getPageOffset=ac;tl.getSize=Zb;tl.getViewportPageOffset=bc;
|
|
992
|
+
tl.pageToContainerOffset=ec;tl.scrollIntoContainerView=hc;var jc=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,kc=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,ul={TEST_ONLY:{XY_REGEX:jc,XY_STYLE_REGEX:kc}};ul.getDocumentScroll=oc;ul.getInjectionDivXY=mc;ul.getRelativeXY=lc;ul.getViewportBBox=nc;ul.screenToWsCoordinates=pc;ul.wsToScreenCoordinates=qc;var Ic=class{constructor(a,b,c,d,e){this.workspace=a;this.horizontal=b;this.oldHostMetrics=null;this.ratio=1;this.origin=new D(0,0);this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0;this.containerVisible=this.isHandleVisible=!0;this.position=new D(0,0);this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null;this.pair=c||!1;this.margin=e!==void 0?e:Ic.DEFAULT_SCROLLBAR_MARGIN;a="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical");d&&(a+=" "+
|
|
994
993
|
d);this.outerSvg=r(q.SVG,{"class":a});d=r(q.G,{},this.outerSvg);this.svgBackground=r(q.RECT,{"class":"blocklyScrollbarBackground"},d);a=Math.floor((Ic.scrollbarThickness-5)/2);this.svgHandle=r(q.RECT,{"class":"blocklyScrollbarHandle",rx:a,ry:a},d);this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarColour","fill");this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarOpacity","fill-opacity");Pa(this.outerSvg,this.workspace.getParentSvg());this.setInitialThickness();b?
|
|
995
994
|
(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y");this.onMouseDownBarWrapper_=k(this.svgBackground,"pointerdown",this,this.onMouseDownBar);this.onMouseDownHandleWrapper_=k(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){var a=Ic.scrollbarThickness;this.horizontal?(this.svgBackground.setAttribute("height",String(a)),this.outerSvg.setAttribute("height",String(a)),this.svgHandle.setAttribute("height",
|
|
996
995
|
String(a-5)),this.svgHandle.setAttribute("y","2.5")):(this.svgBackground.setAttribute("width",String(a)),this.outerSvg.setAttribute("width",String(a)),this.svgHandle.setAttribute("width",String(a-5)),this.svgHandle.setAttribute("x","2.5"))}dispose(){this.cleanUp();la(this.onMouseDownBarWrapper_);la(this.onMouseDownHandleWrapper_);Oa(this.outerSvg);this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(a){return a=a<=0||isNaN(a)?0:Math.min(a,this.scrollbarLength)}setHandleLength(a){this.handleLength=
|
|
@@ -1001,11 +1000,11 @@ this.margin);this.resizeContentHorizontal(a)}resizeContentHorizontal(a){if(a.vie
|
|
|
1001
1000
|
this.ratio=c/b}}resizeVertical(a){this.requiresViewResize(a)?this.resizeViewVertical(a):this.resizeContentVertical(a)}resizeViewVertical(a){var b=a.viewHeight-this.margin*2;this.pair&&(b-=Ic.scrollbarThickness);this.setScrollbarLength(Math.max(0,b));this.setPosition(this.workspace.RTL?a.absoluteLeft+this.margin:a.absoluteLeft+a.viewWidth-Ic.scrollbarThickness-this.margin,a.absoluteTop+this.margin);this.resizeContentVertical(a)}resizeContentVertical(a){if(a.viewHeight>=a.scrollHeight)this.setHandleLength(this.scrollbarLength),
|
|
1002
1001
|
this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var b=this.scrollbarLength*a.viewHeight/a.scrollHeight;b=this.constrainHandleLength(b);this.setHandleLength(b);b=a.scrollHeight-a.viewHeight;var c=this.scrollbarLength-this.handleLength;a=(a.viewTop-a.scrollTop)/b*c;a=this.constrainHandlePosition(a);this.setHandlePosition(a);this.ratio=c/b}}isVisible(){return this.isHandleVisible}setContainerVisible(a){var b=a!==this.containerVisible;this.containerVisible=
|
|
1003
1002
|
a;b&&this.updateDisplay_()}setVisible(a){if(this.pair)throw Error("Unable to toggle visibility of paired scrollbars.");this.setVisibleInternal(a)}setVisibleInternal(a){var b=a!==this.isVisible();this.isHandleVisible=a;b&&this.updateDisplay_()}updateDisplay_(){this.containerVisible&&this.isVisible()?this.outerSvg.setAttribute("display","block"):this.outerSvg.setAttribute("display","none")}onMouseDownBar(a){this.workspace.markFocused();ha=null;this.cleanUp();if(oa(a))a.stopPropagation();else{var b=
|
|
1004
|
-
pa(a,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());b=this.horizontal?b.x:b.y;var c=
|
|
1003
|
+
pa(a,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());b=this.horizontal?b.x:b.y;var c=mc(this.svgHandle);c=this.horizontal?c.x:c.y;var d=this.handlePosition,e=this.handleLength*.95;b<=c?d-=e:b>=c+this.handleLength&&(d+=e);this.setHandlePosition(this.constrainHandlePosition(d));this.updateMetrics();a.stopPropagation();a.preventDefault()}}onMouseDownHandle(a){this.workspace.markFocused();this.cleanUp();oa(a)?a.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=
|
|
1005
1004
|
this.horizontal?a.clientX:a.clientY,this.onMouseUpWrapper_=k(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=k(document,"pointermove",this,this.onMouseMoveHandle),a.stopPropagation(),a.preventDefault())}onMouseMoveHandle(a){this.setHandlePosition(this.constrainHandlePosition(this.startDragHandle+((this.horizontal?a.clientX:a.clientY)-this.startDragMouse)));this.updateMetrics()}onMouseUpHandle(){ha=null;this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0);this.onMouseUpWrapper_&&
|
|
1006
1005
|
(la(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null);this.onMouseMoveWrapper_&&(la(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){var a=this.handlePosition/(this.scrollbarLength-this.handleLength);isNaN(a)&&(a=0);return a}updateMetrics(){var a=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:a}):this.workspace.setMetrics({y:a})}set(a,b){this.setHandlePosition(this.constrainHandlePosition(a*this.ratio));(b||b===void 0)&&this.updateMetrics()}setOrigin(a,b){this.origin=
|
|
1007
|
-
new D(a,b)}static metricsAreEquivalent(a,b){return a.viewWidth===b.viewWidth&&a.viewHeight===b.viewHeight&&a.viewLeft===b.viewLeft&&a.viewTop===b.viewTop&&a.absoluteTop===b.absoluteTop&&a.absoluteLeft===b.absoluteLeft&&a.scrollWidth===b.scrollWidth&&a.scrollHeight===b.scrollHeight&&a.scrollLeft===b.scrollLeft&&a.scrollTop===b.scrollTop}};Ic.scrollbarThickness=Dk?25:15;Ic.DEFAULT_SCROLLBAR_MARGIN=.5;var
|
|
1008
|
-
xl.createElement=$.
|
|
1006
|
+
new D(a,b)}static metricsAreEquivalent(a,b){return a.viewWidth===b.viewWidth&&a.viewHeight===b.viewHeight&&a.viewLeft===b.viewLeft&&a.viewTop===b.viewTop&&a.absoluteTop===b.absoluteTop&&a.absoluteLeft===b.absoluteLeft&&a.scrollWidth===b.scrollWidth&&a.scrollHeight===b.scrollHeight&&a.scrollLeft===b.scrollLeft&&a.scrollTop===b.scrollTop}};Ic.scrollbarThickness=Dk?25:15;Ic.DEFAULT_SCROLLBAR_MARGIN=.5;var uc={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies");}},xc={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies");}},{document:rc,DOMParser:vl,XMLSerializer:wl}=globalThis;vl&&(uc=new vl);wl&&(xc=new wl);var zc=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,xl={NAME_SPACE:"https://developers.google.com/blockly/xml"};
|
|
1007
|
+
xl.createElement=$.sc;xl.createTextNode=$.tc;xl.domToText=yc;xl.injectDependencies=function(a){({document:rc=rc,DOMParser:vl=vl,XMLSerializer:wl=wl}=a);uc=new vl;xc=new wl};xl.textToDom=$.vc;var E,yl=E||(E={});yl[yl.TOP=0]="TOP";yl[yl.BOTTOM=1]="BOTTOM";yl[yl.LEFT=2]="LEFT";yl[yl.RIGHT=3]="RIGHT";var zl={};zl.Position=E;zl.convertFlyoutDefToJsonArray=Ec;zl.convertToolboxDefToJson=Dc;zl.hasCategories=Fc;zl.isCategoryCollapsible=Gc;zl.parseToolboxTree=Ac;var Jc,Al=Jc||(Jc={});Al[Al.TOP=0]="TOP";Al[Al.BOTTOM=1]="BOTTOM";var Hc,Bl=Hc||(Hc={});Bl[Bl.LEFT=0]="LEFT";Bl[Bl.RIGHT=1]="RIGHT";var Mc,Cl=Mc||(Mc={});Cl[Cl.UP=0]="UP";Cl[Cl.DOWN=1]="DOWN";var Dl={};Dl.bumpDirection=Mc;Dl.bumpPositionRect=Nc;Dl.getCornerOppositeToolbox=Lc;Dl.getStartPositionRect=Kc;Dl.horizontalPosition=Hc;Dl.verticalPosition=Jc;var El={width:96,height:124,url:"sprites.svg"};var Fl=class{constructor(a,b){this.workspace=a;this.group=b;this.pointerDownHandler=k(b,"pointerdown",null,this.performAction.bind(this));this.keyDownHandler=ka(b,"keydown",this,this.onKeyDown);ya(b,Ka.BUTTON);this.id=Lb();this.group.id=this.id}zoom(a,b){this.workspace.markFocused();this.workspace.zoomCenter(a);this.fireZoomEvent();ha=null;b.stopPropagation();b.preventDefault()}fireZoomEvent(){var a=new (u(v.CLICK))(null,this.workspace.id,"zoom_controls");w(a)}getGroup(){return this.group}onKeyDown(a){if(a.key===
|
|
1009
1008
|
"Enter"||a.key===" ")a.preventDefault(),this.performAction(a)}dispose(){la(this.pointerDownHandler);la(this.keyDownHandler)}},Gl=class extends Fl{constructor(a,b){var c=String(Math.random()).substring(2);b=r(q.G,{"class":"blocklyZoom blocklyZoomIn",tabindex:"0"},b);l(b,p.LABEL,$.C.ZOOM_IN);r(q.RECT,{width:40,height:40,x:-4,y:-4,rx:2,ry:2,fill:"none","class":"blocklyFocusRing"},b);var d=r(q.CLIPPATH,{id:"blocklyZoominClipPath"+c},b);r(q.RECT,{width:32,height:32},d);r(q.IMAGE,{width:El.width,height:El.height,
|
|
1010
1009
|
x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+c+")"},b).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a.options.pathToMedia+El.url);super(a,b)}performAction(a){this.zoom(1,a)}},Hl=class extends Fl{constructor(a,b){var c=String(Math.random()).substring(2);b=r(q.G,{"class":"blocklyZoom blocklyZoomOut",tabindex:"0"},b);l(b,p.LABEL,$.C.ZOOM_OUT);r(q.RECT,{width:40,height:40,x:-4,y:-4,rx:2,ry:2,fill:"none","class":"blocklyFocusRing"},b);var d=r(q.CLIPPATH,{id:"blocklyZoomoutClipPath"+
|
|
1011
1010
|
c},b);r(q.RECT,{width:32,height:32},d);r(q.IMAGE,{width:El.width,height:El.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+c+")"},b).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a.options.pathToMedia+El.url);super(a,b)}performAction(a){this.zoom(-1,a)}},Il=class extends Fl{constructor(a,b){var c=String(Math.random()).substring(2);b=r(q.G,{"class":"blocklyZoom blocklyZoomReset",tabindex:"0"},b);l(b,p.LABEL,$.C.RESET_ZOOM);r(q.RECT,{width:40,height:40,x:-4,y:-4,rx:2,ry:2,
|
|
@@ -1013,7 +1012,7 @@ fill:"none","class":"blocklyFocusRing"},b);var d=r(q.CLIPPATH,{id:"blocklyZoomre
|
|
|
1013
1012
|
this.workspace.beginCanvasTransition();this.workspace.zoomCenter(b);this.workspace.scrollCenter();setTimeout(this.workspace.endCanvasTransition.bind(this.workspace),500);this.fireZoomEvent();ha=null;a.stopPropagation();a.preventDefault()}},Jl=class{constructor(a){this.workspace=a;this.id="zoomControls";this.zoomResetControl=this.zoomOutControl=this.zoomInControl=null;this.HEIGHT=this.WIDTH=32;this.SMALL_SPACING=2;this.LARGE_SPACING=11;this.MARGIN_HORIZONTAL=this.MARGIN_VERTICAL=20;this.svgGroup=null;
|
|
1014
1013
|
this.top=this.left=0;this.initialized=!1}createDom(){this.svgGroup=r(q.G,{});this.zoomOutControl=new Hl(this.workspace,this.svgGroup);this.zoomInControl=new Gl(this.workspace,this.svgGroup);this.workspace.isMovable()&&(this.zoomResetControl=new Il(this.workspace,this.svgGroup));return this.svgGroup}init(){this.workspace.getComponentManager().addComponent({component:this,weight:Wk.ComponentWeight.ZOOM_CONTROLS_WEIGHT,capabilities:[Wk.Capability.POSITIONABLE]});this.initialized=!0}dispose(){this.workspace.getComponentManager().removeComponent("zoomControls");
|
|
1015
1014
|
this.svgGroup&&Oa(this.svgGroup);var a;(a=this.zoomInControl)==null||a.dispose();var b;(b=this.zoomOutControl)==null||b.dispose();var c;(c=this.zoomResetControl)==null||c.dispose()}getBoundingRectangle(){var a=this.SMALL_SPACING+2*this.HEIGHT;this.zoomResetControl&&(a+=this.LARGE_SPACING+this.HEIGHT);return new cc(this.top,this.top+a,this.left,this.left+this.WIDTH)}position(a,b){if(this.initialized){var c=Lc(this.workspace,a),d=this.SMALL_SPACING+2*this.HEIGHT;this.zoomResetControl&&(d+=this.LARGE_SPACING+
|
|
1016
|
-
this.HEIGHT);a=Kc(c,new
|
|
1015
|
+
this.HEIGHT);a=Kc(c,new ic(this.WIDTH,d),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,a,this.workspace);c=c.vertical;b=Nc(a,this.MARGIN_VERTICAL,c===Jc.TOP?Mc.DOWN:Mc.UP,b);if(c===Jc.TOP){var e=this.SMALL_SPACING+this.HEIGHT,f;(f=this.zoomInControl)==null||f.getGroup().setAttribute("transform","translate(0, "+e+")");this.zoomResetControl&&(e=e+this.LARGE_SPACING+this.HEIGHT,this.zoomResetControl.getGroup().setAttribute("transform","translate(0, "+e+")"))}else{f=this.zoomResetControl?this.LARGE_SPACING+
|
|
1017
1016
|
this.HEIGHT:0;let h;(h=this.zoomInControl)==null||h.getGroup().setAttribute("transform","translate(0, "+f+")");f=f+this.SMALL_SPACING+this.HEIGHT;(e=this.zoomOutControl)==null||e.getGroup().setAttribute("transform","translate(0, "+f+")")}this.top=b.top;this.left=b.left;var g;(g=this.svgGroup)==null||g.setAttribute("transform","translate("+this.left+","+this.top+")")}}};ta("\n.blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}\n\n.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover, .blocklyZoom:focus>image {\n opacity: .8;\n}\n\n.blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n opacity: 1;\n}\n");var Kl={};Kl.register=Oc;Kl.unregister=function(a){Eb(y.SERIALIZER,a)};var Ll=class{constructor(){this.priority=25}save(a){var b=[];for(let c of a.getTopComments())(a=Pc(c,{addCoordinates:!0,saveIds:!0}))&&b.push(a);return b.length?b:null}load(a,b){for(let c of a)Rc(c,b,{recordUndo:$.Qc})}clear(a){for(let b of a.getTopComments())b.dispose()}};Oc("workspaceComments",new Ll);var Ml={};Ml.WorkspaceCommentSerializer=Ll;Ml.append=Rc;Ml.save=Pc;var Nl={};Nl.register=Sc;Nl.unregister=function(a){Eb(y.PASTER,a)};var Ol=class{paste(a,b,c){a=a.commentState;c&&(a.x=c.x,a.y=c.y);$.Ub++;try{var d=Rc(a,b);Uc(d)}finally{$.Ub--}if(!d)return null;Vb()&&w(new (u(v.COMMENT_CREATE))(d));$.t().focusNode(d);return d}};Ol.TYPE="workspace-comment";Sc(Ol.TYPE,new Ol);$.Og={dragRadius:5,flyoutDragRadius:10,snapRadius:28,connectingSnapRadius:28,currentConnectionPreference:8,bumpDelay:250};var Kg=class{constructor(a,b,c){this.content=a;this.opt_value=b;this.ariaLabel=c;this.enabled=!0;this.element=null;this.rightToLeft=!1;this.roleName=null;this.highlight=this.checked=this.checkable=!1;this.actionHandler=null;this.id=Lb()}createDom(){var a=document.createElement("div");a.id=this.getId();this.element=a;a.className="blocklyMenuItem "+(this.enabled?"":"blocklyMenuItemDisabled ")+(this.checked?"blocklyMenuItemSelected ":"")+(this.highlight?"blocklyMenuItemHighlight ":"")+(this.rightToLeft?
|
|
1018
1017
|
"blocklyMenuItemRtl ":"");var b=document.createElement("div");l(a,p.LABEL,this.getAriaLabel());ya(b,Ka.NONE);b.className="blocklyMenuItemContent";var c=this.content;typeof this.content==="string"&&(c=document.createTextNode(this.content));b.appendChild(c);a.appendChild(b);this.checkable&&this.toggleHasCheckbox(!0);this.roleName&&ya(a,this.roleName);l(a,p.SELECTED,this.checkable&&this.checked||!1);l(a,p.DISABLED,!this.enabled);return a}getAriaLabel(){return this.ariaLabel||(typeof this.content==="string"?
|
|
1019
1018
|
this.content:this.content.textContent)}dispose(){this.element=null}getElement(){return this.element}getId(){return this.id}getValue(){var a;return(a=this.opt_value)!=null?a:null}setRightToLeft(a){this.rightToLeft=a;var b;(b=this.getElement())==null||b.classList.toggle("blocklyMenuItemRtl",this.rightToLeft)}setRole(a){this.roleName=a}setCheckable(a){(this.checkable=a)||this.setChecked(!1);this.toggleHasCheckbox(a)}setChecked(a){if(!a||this.checkable)if(this.checked=a,a=this.getElement())a.classList.toggle("blocklyMenuItemSelected",
|
|
@@ -1021,7 +1020,7 @@ this.checked),l(a,p.SELECTED,this.checked)}setHighlighted(a){this.highlight=a;if
|
|
|
1021
1020
|
if((d=this.getElement())==null||!d.querySelector(".blocklyMenuItemContent .blocklyMenuItemCheckbox")){a=document.createElement("div");l(a,p.HIDDEN,!0);a.className="blocklyMenuItemCheckbox ";var b,c;(b=this.getElement())==null||(c=b.querySelector(".blocklyMenuItemContent"))==null||c.prepend(a)}}else{let d,e;(d=this.getElement())==null||(e=d.querySelector(".blocklyMenuItemContent .blocklyMenuItemCheckbox"))==null||e.remove()}}};var Ig=class{constructor(){this.menuItems=[];this.roleName=this.element=this.onKeyDownHandler=this.pointerLeaveHandler=this.pointerEnterHandler=this.clickHandler=this.pointerMoveHandler=this.highlightedItem=this.openingCoords=null;this.id=Lb()}addChild(a){this.menuItems.push(a)}render(a){var b=document.createElement("div");b.className="blocklyMenu";b.tabIndex=0;b.id=this.getId();this.roleName&&ya(b,this.roleName);this.element=b;for(let c=0,d;d=this.menuItems[c];c++)b.appendChild(d.createDom());this.pointerMoveHandler=
|
|
1022
1021
|
k(b,"pointermove",this,this.handlePointerMove,!0);this.clickHandler=k(b,"pointerup",this,this.handleClick,!0);this.pointerEnterHandler=k(b,"pointerenter",this,this.handlePointerEnter,!0);this.pointerLeaveHandler=k(b,"pointerleave",this,this.handlePointerLeave,!0);this.onKeyDownHandler=k(b,"keydown",this,this.handleKeyEvent);a.appendChild(b);return b}getElement(){return this.element}focus(){var a=this.getElement();a&&a.focus({preventScroll:!0})}blur(){var a=this.getElement();a&&a.blur()}setRole(a){this.roleName=
|
|
1023
1022
|
a}dispose(){this.pointerMoveHandler&&(la(this.pointerMoveHandler),this.pointerMoveHandler=null);this.clickHandler&&(la(this.clickHandler),this.clickHandler=null);this.pointerEnterHandler&&(la(this.pointerEnterHandler),this.pointerEnterHandler=null);this.pointerLeaveHandler&&(la(this.pointerLeaveHandler),this.pointerLeaveHandler=null);this.onKeyDownHandler&&(la(this.onKeyDownHandler),this.onKeyDownHandler=null);for(let a=0,b;b=this.menuItems[a];a++)b.dispose();this.element=null}getMenuItem(a){for(var b=
|
|
1024
|
-
this.getElement();a&&a!==b;){if(a.classList.contains("blocklyMenuItem")){let c=this.getMenuItems();for(let d=0,e;e=c[d];d++)if(e.getElement()===a)return e}a=a.parentElement}return null}setHighlighted(a){var b=this.highlightedItem;b&&(b.setHighlighted(!1),this.highlightedItem=null);if(a){a.setHighlighted(!0);this.highlightedItem=a;b=this.getElement();let c=a.getElement();b&&c&&(
|
|
1023
|
+
this.getElement();a&&a!==b;){if(a.classList.contains("blocklyMenuItem")){let c=this.getMenuItems();for(let d=0,e;e=c[d];d++)if(e.getElement()===a)return e}a=a.parentElement}return null}setHighlighted(a){var b=this.highlightedItem;b&&(b.setHighlighted(!1),this.highlightedItem=null);if(a){a.setHighlighted(!0);this.highlightedItem=a;b=this.getElement();let c=a.getElement();b&&c&&(hc(c,b),l(b,p.ACTIVEDESCENDANT,a.getId()))}}highlightNext(){var a=this.highlightedItem?this.getMenuItems().indexOf(this.highlightedItem):
|
|
1025
1024
|
-1;this.highlightHelper(a,1)}highlightPrevious(){var a=this.highlightedItem?this.getMenuItems().indexOf(this.highlightedItem):-1;this.highlightHelper(a<0?this.menuItems.length:a,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(a,b){a+=b;for(var c,d=this.getMenuItems();c=d[a];){if(c.isEnabled()){this.setHighlighted(c);break}a+=b}}handlePointerMove(a){Math.max(Math.abs(a.movementX),Math.abs(a.movementY))!==0&&(a=this.getMenuItem(a.target))&&
|
|
1026
1025
|
(a.isEnabled()?this.highlightedItem!==a&&this.setHighlighted(a):this.setHighlighted(null))}handleClick(a){var b=this.openingCoords;this.openingCoords=null;if(b&&typeof a.clientX==="number"){let c=new D(a.clientX,a.clientY);if(D.distance(b,c)<1)return}(b=this.getMenuItem(a.target))&&b.performAction(a)}handlePointerEnter(){this.focus()}handlePointerLeave(){this.getElement()&&this.setHighlighted(null)}handleKeyEvent(a){if(this.menuItems.length&&!(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)){var b=this.highlightedItem;
|
|
1027
1026
|
switch(a.key){case "Enter":case " ":b&&b.performAction(a);break;case "ArrowUp":this.highlightPrevious();break;case "ArrowDown":this.highlightNext();break;case "PageUp":case "Home":this.highlightFirst();break;case "PageDown":case "End":this.highlightLast();break;default:return}a.preventDefault();a.stopPropagation()}}getSize(){var a=this.getElement(),b=Zb(a);b.height=a.scrollHeight;return b}getMenuItems(){return this.menuItems.filter(a=>a instanceof Kg)}getId(){return this.id}};var Jg=class{constructor(){this.element=null}createDom(){this.element=document.createElement("hr");this.element.className="blocklyMenuSeparator";ya(this.element,Ka.SEPARATOR);return this.element}dispose(){var a;(a=this.element)==null||a.remove();this.element=null}};var Pl;Pl=$.je||($.je={});Pl[Pl.VALUE=1]="VALUE";Pl[Pl.STATEMENT=3]="STATEMENT";Pl[Pl.DUMMY=5]="DUMMY";Pl[Pl.CUSTOM=6]="CUSTOM";Pl[Pl.END_ROW=7]="END_ROW";var hd=new Set,ed=new WeakSet,fd=new WeakMap,Zc=null,$c=null,ad=0,Ql={};Ql.finishQueuedRenders=cd;Ql.queueRender=bd;Ql.triggerQueuedRenders=dd;var mi=class{static show(a,b){if(b.oncePerSession&&b.id){if(this.shownIds.has(b.id))return;this.shownIds.add(b.id)}this.hide(a);var c=this.createDom(a,b);requestAnimationFrame(()=>{c.style.bottom="2rem"})}static createDom(a,b){var {message:c,duration:d=5,assertiveness:e=Ca.POLITE}=b,f=document.createElement("div");a.getInjectionDiv().appendChild(f);f.dataset.toastId=b.id;f.className="blocklyToast";b=f.appendChild(document.createElement("div"));b.className="blocklyToastMessage";b.innerText=c;b=f.appendChild(document.createElement("button"));
|
|
@@ -1029,7 +1028,7 @@ b.className="blocklyToastCloseButton";l(b,p.LABEL,$.C.CLOSE);var g=r(q.SVG,{widt
|
|
|
1029
1028
|
var h;b=()=>{h=setTimeout(()=>f.remove(),d*1E3)};g=()=>clearTimeout(h);f.addEventListener("focusin",g);f.addEventListener("focusout",b);f.addEventListener("mouseenter",g);f.addEventListener("mousemove",g);f.addEventListener("mouseleave",b);b();Ja(c,{assertiveness:e,role:Ka.STATUS});return f}static hide(a,b){a=a.getInjectionDiv().querySelector(".blocklyToast");a instanceof HTMLElement&&(!b||b===a.dataset.toastId)&&a.remove()}};mi.shownIds=new Set;ta("\n.blocklyToast {\n font-size: 1.2rem;\n position: absolute;\n bottom: -10rem;\n right: 2rem;\n padding: 1rem;\n color: black;\n background-color: white;\n border: 2px solid black;\n border-radius: 0.4rem;\n z-index: 999;\n display: flex;\n align-items: center;\n gap: 0.8rem;\n line-height: 1.5;\n transition: bottom 0.3s ease-out;\n}\n\n.blocklyToast .blocklyToastMessage {\n max-width: 18rem;\n}\n\n.blocklyToast .blocklyToastCloseButton {\n margin: 0;\n padding: 0.2rem;\n background-color: transparent;\n color: black;\n border: none;\n cursor: pointer;\n}\n");var md,Rl=md||(md={});Rl[Rl.ALERT=1]="ALERT";Rl[Rl.CONFIRM=2]="CONFIRM";Rl[Rl.PROMPT=3]="PROMPT";var wd=0,qd=nd,sd=od,ud=pd,Sl=mi.show.bind(mi),Tl=Sl,Ul={};Ul.alert=rd;Ul.confirm=td;Ul.prompt=vd;Ul.setAlert=function(a=nd){qd=a};Ul.setConfirm=function(a=od){sd=a};Ul.setPrompt=function(a=pd){ud=a};Ul.setToast=function(a=Sl){Tl=a};Ul.toast=function(a,b){Tl(a,b)};var Vl=class{constructor(){this.workspaceId=void 0;this.isUiEvent=!1;this.type="";this.group=$.gd;this.recordUndo=$.Qc}toJson(){return{type:this.type,group:this.group}}static fromJson(a,b,c){c.isBlank=!1;c.group=a.group||"";c.workspaceId=b.id;return c}isNull(){return!1}run(){}getEventWorkspace_(){var a;this.workspaceId&&(a=hb(this.workspaceId));if(!a)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return a}};var Wl=class extends Vl{constructor(a){super();this.isBlank=!0;this.isBlank=!a;a&&(this.blockId=a.id,this.workspaceId=a.workspace.id)}toJson(){var a=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");a.blockId=this.blockId;return a}static fromJson(a,b,c){b=Vl.fromJson(a,b,c!=null?c:new Wl);b.blockId=a.blockId;return b}};var Zg=class{constructor(a){this.name=a}toString(){return this.name}equals(a){return this.name===a.toString()}};Zg.MUTATOR=new Zg("mutator");Zg.WARNING=new Zg("warning");Zg.COMMENT=new Zg("comment");var Xl=class extends Wl{constructor(a,b,c,d,e){super(a);this.type=v.BLOCK_CHANGE;a&&(this.element=b,this.name=c||void 0,this.oldValue=d,this.newValue=e)}toJson(){var a=super.toJson();if(!this.element)throw Error("The changed element is undefined. Either pass an element to the constructor, or call fromJson");a.element=this.element;a.name=this.name;a.oldValue=this.oldValue;a.newValue=this.newValue;this.disabledReason&&(a.disabledReason=this.disabledReason);return a}static fromJson(a,b,c){b=Wl.fromJson(a,
|
|
1030
1029
|
b,c!=null?c:new Xl);b.element=a.element;b.name=a.name;b.oldValue=a.oldValue;b.newValue=a.newValue;a.disabledReason!==void 0&&(b.disabledReason=a.disabledReason);return b}setDisabledReason(a){if(this.element!=="disabled")throw Error('Cannot set the disabled reason for a BlockChange event if the element is not "disabled".');this.disabledReason=a}isNull(){return this.oldValue===this.newValue}run(a){var b=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");
|
|
1031
1030
|
b=b.getBlockById(this.blockId);if(!b)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");var c=b.getIcon(Zg.MUTATOR);c&&xd(c)&&c.bubbleIsVisible()&&c.setBubbleVisible(!1);a=a?this.newValue:this.oldValue;switch(this.element){case "field":(b=b.getField(this.name))?b.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":b.setCommentText(a!=null?a:null);break;case "collapsed":b.setCollapsed(!!a);break;case "disabled":var d;
|
|
1032
|
-
b.setDisabledReason(!!a,(d=this.disabledReason)!=null?d:"MANUALLY_DISABLED");break;case "inline":b.setInputsInline(!!a);break;case "mutation":d=Xl.getExtraBlockState_(b);b.loadExtraState?b.loadExtraState(JSON.parse(a||"{}")):b.domToMutation&&b.domToMutation($.
|
|
1031
|
+
b.setDisabledReason(!!a,(d=this.disabledReason)!=null?d:"MANUALLY_DISABLED");break;case "inline":b.setInputsInline(!!a);break;case "mutation":d=Xl.getExtraBlockState_(b);b.loadExtraState?b.loadExtraState(JSON.parse(a||"{}")):b.domToMutation&&b.domToMutation($.vc(a||"<mutation/>"));w(new Xl(b,"mutation",null,d,a));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(a){return a.saveExtraState?(a=a.saveExtraState(!0))?JSON.stringify(a):"":a.mutationToDom?(a=a.mutationToDom())?
|
|
1033
1032
|
ae(a):"":""}};A(y.EVENT,v.BLOCK_CHANGE,Xl);var Yl=class extends Wl{constructor(a){super(a);this.type=v.BLOCK_CREATE;a&&(a.isShadow()&&(this.recordUndo=!1),this.ids=Wb(a),this.json=ce(a,{addCoordinates:!0}))}toJson(){var a=super.toJson();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");a.ids=this.ids;a.json=this.json;this.recordUndo||(a.recordUndo=this.recordUndo);
|
|
1034
1033
|
return a}static fromJson(a,b,c){b=Wl.fromJson(a,b,c!=null?c:new Yl);b.ids=a.ids;b.json=a.json;a.recordUndo!==void 0&&(b.recordUndo=a.recordUndo);return b}run(a){var b=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!yd(b,this.ids))if(a)ee(this.json,b);else for(a=0;a<this.ids.length;a++){let c=
|
|
1035
1034
|
this.ids[a],d=b.getBlockById(c);d?d.dispose(!1):c===this.blockId&&console.warn("Can't uncreate non-existent block: "+c)}}};A(y.EVENT,v.BLOCK_CREATE,Yl);var Zl=class extends Wl{constructor(a){super(a);this.type=v.BLOCK_DELETE;if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");a.isShadow()&&(this.recordUndo=!1);this.ids=Wb(a);this.wasShadow=a.isShadow();this.oldJson=ce(a,{addCoordinates:!0})}}toJson(){var a=super.toJson();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(this.wasShadow===void 0)throw Error("Whether the block was a shadow is undefined. Either pass a block to the constructor, or call fromJson");
|
|
@@ -1054,7 +1053,7 @@ a}toJson(){var a=super.toJson();if(!this.oldCoordinate_)throw Error("The old com
|
|
|
1054
1053
|
km.fromJson(a,b,c!=null?c:new qm);c=a.oldCoordinate.split(",");b.oldCoordinate_=new D(Number(c[0]),Number(c[1]));c=a.newCoordinate.split(",");b.newCoordinate_=new D(Number(c[0]),Number(c[1]));return b}isNull(){return D.equals(this.oldCoordinate_,this.newCoordinate_)}run(a){var b=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(b=b.getCommentById(this.commentId)){a=a?this.newCoordinate_:this.oldCoordinate_;
|
|
1055
1054
|
if(!a)throw Error("Either oldCoordinate_ or newCoordinate_ is undefined. Either pass a comment to the constructor and call recordNew, or call fromJson");b.moveTo(a)}else console.warn("Can't move non-existent comment: "+this.commentId)}};A(y.EVENT,v.COMMENT_MOVE,qm);var rm=class extends km{constructor(a){super(a);this.type=v.COMMENT_RESIZE;a&&(this.oldSize=a.getSize())}recordCurrentSizeAsNewSize(){if(this.newSize)throw Error("Tried to record the new size of a comment on the same event twice.");var a=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");a=a.getCommentById(this.commentId);if(!a)throw Error("The comment associated with the comment resize event could not be found");
|
|
1056
1055
|
this.newSize=a.getSize()}toJson(){var a=super.toJson();if(!this.oldSize)throw Error("The old comment size is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newSize)throw Error("The new comment size is undefined. Either call recordCurrentSizeAsNewSize, or call fromJson");a.oldWidth=Math.round(this.oldSize.width);a.oldHeight=Math.round(this.oldSize.height);a.newWidth=Math.round(this.newSize.width);a.newHeight=Math.round(this.newSize.height);return a}static fromJson(a,
|
|
1057
|
-
b,c){b=km.fromJson(a,b,c!=null?c:new rm);b.oldSize=new
|
|
1056
|
+
b,c){b=km.fromJson(a,b,c!=null?c:new rm);b.oldSize=new ic(a.oldWidth,a.oldHeight);b.newSize=new ic(a.newWidth,a.newHeight);return b}isNull(){return ic.equals(this.oldSize,this.newSize)}run(a){var b=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(b=b.getCommentById(this.commentId)){a=a?this.newSize:this.oldSize;if(!a)throw Error("Either oldSize or newSize is undefined. Either pass a comment to the constructor and call recordCurrentSizeAsNewSize, or call fromJson");
|
|
1058
1057
|
b.setSize(a)}else console.warn("Can't resize non-existent comment: "+this.commentId)}};A(y.EVENT,v.COMMENT_RESIZE,rm);var sm=class extends $l{constructor(a,b,c){super(c);this.type=v.SELECTED;this.oldElementId=a!=null?a:void 0;this.newElementId=b!=null?b:void 0}toJson(){var a=super.toJson();a.oldElementId=this.oldElementId;a.newElementId=this.newElementId;return a}static fromJson(a,b,c){b=$l.fromJson(a,b,c!=null?c:new sm);b.oldElementId=a.oldElementId;b.newElementId=a.newElementId;return b}};A(y.EVENT,v.SELECTED,sm);var tm=class extends $l{constructor(a,b){super(b);this.type=v.THEME_CHANGE;this.themeName=a}toJson(){var a=super.toJson();if(!this.themeName)throw Error("The theme name is undefined. Either pass a theme name to the constructor, or call fromJson");a.themeName=this.themeName;return a}static fromJson(a,b,c){b=$l.fromJson(a,b,c!=null?c:new tm);b.themeName=a.themeName;return b}};A(y.EVENT,v.THEME_CHANGE,tm);var um=class extends $l{constructor(a,b,c){super(c);this.type=v.TOOLBOX_ITEM_SELECT;this.oldItem=a!=null?a:void 0;this.newItem=b!=null?b:void 0}toJson(){var a=super.toJson();a.oldItem=this.oldItem;a.newItem=this.newItem;return a}static fromJson(a,b,c){b=$l.fromJson(a,b,c!=null?c:new um);b.oldItem=a.oldItem;b.newItem=a.newItem;return b}};A(y.EVENT,v.TOOLBOX_ITEM_SELECT,um);var vm=class extends $l{constructor(a,b){super(b);this.type=v.TRASHCAN_OPEN;this.isOpen=a}toJson(){var a=super.toJson();if(this.isOpen===void 0)throw Error("Whether this is already open or not is undefined. Either pass a value to the constructor, or call fromJson");a.isOpen=this.isOpen;return a}static fromJson(a,b,c){b=$l.fromJson(a,b,c!=null?c:new vm);b.isOpen=a.isOpen;return b}};A(y.EVENT,v.TRASHCAN_OPEN,vm);var wm=class extends Vl{constructor(a){super();this.isBlank=!0;this.isBlank=typeof a==="undefined";a&&(this.varId=a.getId(),this.workspaceId=a.getWorkspace().id)}toJson(){var a=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");a.varId=this.varId;return a}static fromJson(a,b,c){b=Vl.fromJson(a,b,c!=null?c:new wm);b.varId=a.varId;return b}};var xm=class extends wm{constructor(a){super(a);this.type=v.VAR_CREATE;a&&(this.varType=a.getType(),this.varName=a.getName())}toJson(){var a=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");a.varType=this.varType;a.varName=this.varName;return a}static fromJson(a,b,c){b=wm.fromJson(a,b,c!=
|
|
1059
1058
|
null?c:new xm);b.varType=a.varType;b.varName=a.varName;return b}run(a){var b=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");b=b.getVariableMap();a?b.createVariable(this.varName,this.varType,this.varId):(a=b.getVariableById(this.varId))&&b.deleteVariable(a)}};A(y.EVENT,v.VAR_CREATE,xm);var ym=class extends wm{constructor(a){super(a);this.type=v.VAR_DELETE;a&&(this.varType=a.getType(),this.varName=a.getName())}toJson(){var a=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");a.varType=this.varType;a.varName=this.varName;return a}static fromJson(a,b,c){b=wm.fromJson(a,b,c!=
|
|
1060
1059
|
null?c:new ym);b.varType=a.varType;b.varName=a.varName;return b}run(a){var b=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");b=b.getVariableMap();a?(a=b.getVariableById(this.varId))&&b.deleteVariable(a):b.createVariable(this.varName,this.varType,this.varId)}};A(y.EVENT,v.VAR_DELETE,ym);var zm=class extends wm{constructor(a,b){super(a);this.type=v.VAR_RENAME;a&&(this.oldName=a.getName(),this.newName=typeof b==="undefined"?"":b)}toJson(){var a=super.toJson();if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");a.oldName=this.oldName;a.newName=this.newName;return a}static fromJson(a,b,c){b=wm.fromJson(a,
|
|
@@ -1068,27 +1067,27 @@ N.UI=Zm;N.UiBase=$l;N.VAR_CREATE=$m;N.VAR_DELETE=an;N.VAR_RENAME=bn;N.VIEWPORT_C
|
|
|
1068
1067
|
N.disableOrphans=function(a){if((a.type===v.BLOCK_MOVE||a.type===v.BLOCK_CREATE||a.type===v.BLOCK_DRAG&&!a.isStart)&&a.workspaceId){var b=hb(a.workspaceId);if(!a.blockId)throw Error("Encountered a blockEvent without a proper blockId");if(a=b.getBlockById(a.blockId)){let c=$.Qc;try{$.Qc=!1;let d=a.getParent();if(d&&!d.hasDisabledReason("ORPHANED_BLOCK")){let e=a.getDescendants(!1);for(let f=0,g;g=e[f];f++)g.setDisabledReason(!1,"ORPHANED_BLOCK")}else if((a.outputConnection||a.previousConnection)&&
|
|
1069
1068
|
!b.isDragging()){do a.setDisabledReason(!0,"ORPHANED_BLOCK"),a=a.getNextBlock();while(a)}}finally{$.Qc=c}}}};N.enable=function(){$.Ub--};N.filter=Pb;N.fire=w;N.fromJson=function(a,b){var c=u(a.type);if(!c)throw Error("Unknown event type.");return c.fromJson(a,b)};N.get=u;N.getDescendantIds=Wb;N.getGroup=function(){return $.gd};N.getRecordUndo=function(){return $.Qc};N.isEnabled=Vb;N.setGroup=$.B;N.setRecordUndo=function(a){$.Qc=a};var dn=class{constructor(){this.scopeChangeAudioCuesEnabled=this.isActive=!1;this.activeClassName="blocklyKeyboardNavigation"}setIsActive(a=!0){this.isActive=a;this.updateActiveVisualization()}getIsActive(){return this.isActive}setScopeChangeAudioCuesEnabled(a){this.scopeChangeAudioCuesEnabled=a}getScopeChangeAudioCuesEnabled(){return this.scopeChangeAudioCuesEnabled}updateActiveVisualization(){var a=lb.getInjectionDiv().parentElement;this.isActive?a==null||a.classList.add(this.activeClassName):a==
|
|
1070
1069
|
null||a.classList.remove(this.activeClassName)}},Nd=new dn;var Yd=new Intl.Collator(void 0,{sensitivity:"base"}),Id={generateUniqueNameInternal:function(a){return Kd("i",a.getVariableMap().getAllVariables().map(b=>b.getName()))}},en={CATEGORY_NAME:"VARIABLE",TEST_ONLY:Id,VAR_LETTER_OPTIONS:"ijkmnopqrstuvwxyzabcdefgh"};en.allDeveloperVariables=$.Cd;en.allUsedVarModels=$.Bd;en.compareByName=Hd;en.createVariableButtonHandler=Dd;en.deleteVariable=$.$d;en.flyoutCategory=Fd;
|
|
1071
|
-
en.flyoutCategoryBlocks=function(a){a=a.getVariableMap().getVariablesOfType("");var b=[];if(a.length>0){var c=a[a.length-1];if(zb.variables_set){var d=$.
|
|
1072
|
-
d.appendChild(c),b.push(d));if(zb.variables_get){a.sort(Hd);for(let e=0,f;f=a[e];e++)c=$.
|
|
1070
|
+
en.flyoutCategoryBlocks=function(a){a=a.getVariableMap().getVariablesOfType("");var b=[];if(a.length>0){var c=a[a.length-1];if(zb.variables_set){var d=$.sc("block");d.setAttribute("type","variables_set");d.setAttribute("gap",zb.math_change?"8":"24");d.appendChild(Ud(c));b.push(d)}zb.math_change&&(d=$.sc("block"),d.setAttribute("type","math_change"),d.setAttribute("gap",zb.variables_get?"20":"8"),d.appendChild(Ud(c)),c=$.vc('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),
|
|
1071
|
+
d.appendChild(c),b.push(d));if(zb.variables_get){a.sort(Hd);for(let e=0,f;f=a[e];e++)c=$.sc("block"),c.setAttribute("type","variables_get"),c.setAttribute("gap","8"),c.appendChild(Ud(f)),b.push(c)}}return b};en.generateUniqueName=Jd;en.generateUniqueNameFromOptions=Kd;en.generateVariableFieldDom=Ud;en.getAddedVariables=Xd;en.getOrCreateVariablePackage=$.Wd;en.getVariable=$.Vd;en.getVariableUsesById=Zd;en.jsonFlyoutCategoryBlocks=Ed;en.nameUsedWithAnyType=Md;en.nameUsedWithConflictingParam=Qd;
|
|
1073
1072
|
en.promptName=Ld;en.renameVariable=$.Rd;var fn=class extends Error{},he=class extends fn{constructor(a){super("Expected to find a 'type' property, defining the block type");this.state=a}},ke=class extends fn{constructor(a,b,c){super(`The block ${b.toDevString()} is missing a(n) ${a}
|
|
1074
1073
|
connection`);this.block=b;this.state=c}},le=class extends fn{constructor(a,b,c,d){super(`The block ${c.toDevString()} could not connect its
|
|
1075
1074
|
${b} to its parent, because: ${a}`);this.childBlock=c;this.childState=d}},ie=class extends fn{constructor(a){super("Encountered a real block which is defined as a child of a shadow\nblock. It is an invariant of Blockly that shadow blocks only have shadow\nchildren");this.state=a}},me=class extends fn{constructor(a,b,c){super(`Cannot add an icon of type '${a}' to the block ${b.toDevString()}, because there is no icon registered with type '${a}'. Make sure that all of your icons have been registered.`);
|
|
1076
1075
|
this.block=b;this.state=c}},gn={};gn.BadConnectionCheck=le;gn.DeserializationError=fn;gn.MissingBlockType=he;gn.MissingConnection=ke;gn.RealChildOfShadow=ie;gn.UnregisteredIcon=me;var hn=class{constructor(){this.priority=50}save(a){var b=[];for(let c of a.getTopBlocks(!1))(a=ce(c,{addCoordinates:!0,doFullSerialization:!1}))&&b.push(a);return b.length?{languageVersion:0,blocks:b}:null}load(a,b){a=a.blocks;for(let c of a)ee(c,b,{recordUndo:$.Qc})}clear(a){for(let b of a.getTopBlocks(!1))b.dispose(!1)}};Oc("blocks",new hn);var jn={};jn.BlockSerializer=hn;jn.append=ee;jn.appendInternal=de;jn.save=ce;var pe={Control:$.C.CONTROL_KEY,Meta:"\u2318",Alt:qe?"\u2325":$.C.ALT_KEY},te=["Meta","Control","Alt","Shift"];var Ie,kn=Ie||(Ie={});kn[kn.UNKNOWN=0]="UNKNOWN";kn[kn.BEFORE=1]="BEFORE";kn[kn.AFTER=2]="AFTER";kn[kn.AROUND=3]="AROUND";kn[kn.INSIDE=4]="INSIDE";kn[kn.TO=5]="TO";var ln={};ln.clamp=Oe;ln.toDegrees=function(a){return a*180/Math.PI};ln.toRadians=Ne;var qf=null,gf=null,hf="",jf="",Pe,Qe,Se,df=null,ff=null,Ze=null,Ue=null,Re=null,rf={getBoundsInfo:function(){var a=ac(df),b=Zb(df);return{left:a.x,right:a.x+b.width,top:a.y,bottom:a.y+b.height,width:b.width,height:b.height}},getPositionMetrics:function(a,b,c,d){var e=rf.getBoundsInfo(),f=Zb(Pe);if(b+f.height<e.bottom)return mf(a,b,e,f);if(d-f.height>e.top)return nf(c,d,e,f);if(b+f.height<document.documentElement.clientHeight)return mf(a,b,e,f);if(d-f.height>document.documentElement.clientTop)return nf(c,
|
|
1077
1076
|
d,e,f);a=lf(a,e.left,e.right,f.width);return{initialX:a.divX,initialY:0,finalX:a.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}}},mn={ANIMATION_TIME:.25,ARROW_HORIZONTAL_PADDING:12,ARROW_SIZE:16,BORDER_SIZE:1,PADDING_Y:16,TEST_ONLY:rf};mn.clearContent=Xe;mn.createDom=Te;mn.getContentDiv=function(){return Qe};mn.getOwner=function(){return ff};mn.getPositionX=lf;mn.hide=Ve;mn.hideIfOwner=pf;mn.hideWithoutAnimation=of;mn.isVisible=function(){return!!ff};
|
|
1078
1077
|
mn.repositionForWindowResize=sf;mn.setBoundsElement=function(a){df=a};mn.setColour=Ye;mn.show=ef;mn.showPositionedByBlock=function(a,b,c,d,e=!0){return $e(cf(b),a,e,c,d)};mn.showPositionedByField=bf;var nn={};nn.commonWordPrefix=uf;nn.commonWordSuffix=vf;nn.isNumber=$.zf;nn.shortestStringLength=tf;nn.wrap=$.yf;var Wf=void 0,Pf=!1,Jf=!1,Nf=0,Of=0,Qf=0,Rf=0,Kf=null,Mf=null,Cf=null,on={HOVER_MS:750,LIMIT:50,MARGINS:5,OFFSET_X:0,OFFSET_Y:10,RADIUS_OK:10};on.bindMouseEvents=Hf;on.block=Vf;on.createDom=Df;on.display=Uf;on.dispose=Tf;on.getCustomTooltip=function(){return Wf};on.getDiv=function(){return Cf};on.getTooltipOfObject=Bf;on.hide=Lf;on.isVisible=function(){return Pf};on.setCustomTooltip=function(a){Wf=a};on.unbindMouseEvents=If;on.unblock=function(){Jf=!1};var cg=.45,dg=.65,Xf={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},pn={};pn.blend=bg;pn.getHsvSaturation=function(){return cg};pn.getHsvValue=function(){return dg};pn.hexToRgb=$f;pn.hsvToHex=ag;pn.hueToHex=eg;pn.names=Xf;pn.parse=Zf;pn.rgbToHex=Yf;pn.setHsvSaturation=function(a){cg=a};
|
|
1079
|
-
pn.setHsvValue=function(a){dg=a};var qn={checkMessageReferences:function(a){var b=!0,c=a.match(/%{BKY_[A-Z]\w*}/gi);if(c)for(let d=0;d<c.length;d++){let e=c[d].toUpperCase();$.C[e.slice(6,-1)]===void 0&&(console.warn("No message string for "+c[d]+" in "+a),b=!1)}return b}};qn.parseBlockColour=ig;qn.replaceMessageReferences=hg;qn.tokenizeInterpolation=gg;var rg=class{get size_(){return this.size}set size_(a){this.size=a}constructor(a,b,c){this.DEFAULT_VALUE=null;this.name=void 0;this.tooltip=this.ariaTypeName=this.validator_=null;this.size=new
|
|
1080
|
-
!1;this.id_=null;this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE;this.size_=new
|
|
1078
|
+
pn.setHsvValue=function(a){dg=a};var qn={checkMessageReferences:function(a){var b=!0,c=a.match(/%{BKY_[A-Z]\w*}/gi);if(c)for(let d=0;d<c.length;d++){let e=c[d].toUpperCase();$.C[e.slice(6,-1)]===void 0&&(console.warn("No message string for "+c[d]+" in "+a),b=!1)}return b}};qn.parseBlockColour=ig;qn.replaceMessageReferences=hg;qn.tokenizeInterpolation=gg;var rg=class{get size_(){return this.size}set size_(a){this.size=a}constructor(a,b,c){this.DEFAULT_VALUE=null;this.name=void 0;this.tooltip=this.ariaTypeName=this.validator_=null;this.size=new ic(0,0);this.constants_=this.mouseDownWrapper=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=null;this.disposed=!1;this.maxDisplayLength=50;this.sourceBlock_=null;this.enabled_=this.visible_=this.isDirty_=!0;this.suffixField=this.prefixField=this.clickTarget_=null;this.EDITABLE=!0;this.SERIALIZABLE=
|
|
1079
|
+
!1;this.id_=null;this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE;this.size_=new ic(0,0);a!==rg.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){a.tooltip&&this.setTooltip(hg(a.tooltip));a.ariaTypeName&&this.setAriaTypeName(a.ariaTypeName)}setSourceBlock(a){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=a;if(a.id.includes("_field"))throw Error(`Field ID indicator is contained in block ID. This may cause problems with focus: ${a.id}.`);
|
|
1081
1080
|
}getConstants(){!this.constants_&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants());return this.constants_}getSourceBlock(){return this.sourceBlock_}getAriaTypeName(){return this.ariaTypeName||null}setAriaTypeName(a){this.ariaTypeName=hg(a)}getAriaValue(){return this.getValue()==null?null:this.getText()}computeAriaLabel(a=!0){a=a?this.getAriaTypeName():null;var b=this.getAriaValue();
|
|
1082
1081
|
if(b===null||b==="")b=$.C.FIELD_LABEL_EMPTY;return a?`${a}: ${b}`:b}init(){if(!this.fieldGroup_){this.fieldGroup_=r(q.G,{});this.isVisible()||(this.fieldGroup_.style.display="none");var a=this.sourceBlock_;a.getSvgRoot().appendChild(this.fieldGroup_);this.initView();this.updateEditable();this.setTooltip(this.tooltip);this.bindEvents_();this.initModel();this.applyColour();this.isFullBlockField()?this.id_=Lb():this.id_=`${a.id}_field_${Lb()}`;this.fieldGroup_.setAttribute("id",this.id_)}}initView(){this.createBorderRect_();
|
|
1083
1082
|
this.createTextElement_();this.fieldGroup_&&n(this.fieldGroup_,"blocklyField")}initModel(){}isFullBlockField(){return!1}isLabelField(){return!1}createBorderRect_(){this.borderRect_=r(q.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,"class":"blocklyFieldRect"},this.fieldGroup_)}createTextElement_(){this.textElement_=r(q.TEXT,{"class":"blocklyText blocklyFieldText","aria-hidden":"true"},this.fieldGroup_);
|
|
1084
1083
|
this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central");this.textContent_=document.createTextNode("");this.textElement_.appendChild(this.textContent_)}bindEvents_(){var a=this.getClickTarget_();if(!a)throw Error("A click target has not been set.");Hf(a);this.mouseDownWrapper=k(a,"pointerdown",this,this.onMouseDown_)}fromXml(a){this.setValue(a.textContent)}toXml(a){a.textContent=this.getValue();return a}saveState(){var a=this.saveLegacyState(rg);
|
|
1085
|
-
return a!==null?a:this.getValue()}loadState(a){this.loadLegacyState(rg,a)||this.setValue(a)}saveLegacyState(a){return a.prototype.saveState===this.saveState&&a.prototype.toXml!==this.toXml?(a=$.
|
|
1084
|
+
return a!==null?a:this.getValue()}loadState(a){this.loadLegacyState(rg,a)||this.setValue(a)}saveLegacyState(a){return a.prototype.saveState===this.saveState&&a.prototype.toXml!==this.toXml?(a=$.sc("field"),a.setAttribute("name",this.name||""),yc(this.toXml(a)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}loadLegacyState(a,b){return a.prototype.loadState===this.loadState&&a.prototype.fromXml!==this.fromXml?(this.fromXml($.vc(b)),!0):!1}dispose(){pf(this);vg(this);var a;((a=
|
|
1086
1085
|
this.getSourceBlock())==null?0:a.isDeadOrDying())||Oa(this.fieldGroup_);if(a=this.getClickTarget_())If(a),delete a.tooltip;this.tooltip=null;this.disposed=!0}updateEditable(){var a=this.fieldGroup_,b=this.getSourceBlock();this.EDITABLE&&a&&b&&(this.enabled_&&b.isEditable()?(n(a,"blocklyEditableField"),Ma(a,"blocklyNonEditableField")):(n(a,"blocklyNonEditableField"),Ma(a,"blocklyEditableField")))}setEnabled(a){this.enabled_=a;this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&
|
|
1087
1086
|
!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==rg.prototype.showEditor_}isClickableInFlyout(a){return!a}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){var a=!1;this.name&&(this.SERIALIZABLE?a=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),a=!0));return a}isVisible(){return this.visible_}setVisible(a){if(this.visible_!==
|
|
1088
1087
|
a){this.visible_=a;var b=this.fieldGroup_;b&&(b.style.display=a?"block":"none")}}setValidator(a){this.validator_=a}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}getBorderRect(){if(!this.borderRect_)throw Error(`The border rectangle is ${this.borderRect_}.`);return this.borderRect_}getTextElement(){if(!this.textElement_)throw Error(`The text element is ${this.textElement_}.`);return this.textElement_}getTextContent(){if(!this.textContent_)throw Error(`The text content is ${this.textContent_}.`);
|
|
1089
1088
|
return this.textContent_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_()}showEditor(a){this.isClickable()&&this.showEditor_(a)}showEditor_(){}repositionForWindowResize(){return!1}updateSize_(a){var b=this.getConstants();a=a!==void 0?a:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var c=a*2,d=b.FIELD_TEXT_HEIGHT,e=0;this.textElement_&&(e=Wa(this.textElement_),c+=e);this.borderRect_&&(d=Math.max(d,b.FIELD_BORDER_RECT_HEIGHT));
|
|
1090
|
-
this.size_=new
|
|
1091
|
-
this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){if(!this.isVisible())return new
|
|
1089
|
+
this.size_=new ic(c,d);this.positionTextElement_(a,e);this.positionBorderRect_()}positionTextElement_(a,b){if(this.textElement_){var c=this.getConstants(),d=this.size_.height/2,e;this.textElement_.setAttribute("x",String(((e=this.getSourceBlock())==null?0:e.RTL)?this.size_.width-b-a:a));this.textElement_.setAttribute("y",String(c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE))}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",String(this.size_.width)),
|
|
1090
|
+
this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){if(!this.isVisible())return new ic(0,0);this.isDirty_&&(this.render_(),this.isDirty_=!1);return this.size_}getScaledBBox(){var a=this.getSourceBlock();if(!a)throw new Dj;if(this.borderRect_){var b=this.borderRect_.getBoundingClientRect();var c=ac(this.borderRect_);
|
|
1092
1091
|
a=b.width;b=b.height}else{b=this.sourceBlock_.getHeightWidth();let d=a.workspace.scale;c=this.getAbsoluteXY_();a=(b.width+1)*d;b=(b.height+1)*d;Pk?(c.x+=1.5*d,c.y+=1.5*d):(c.x-=.5*d,c.y-=.5*d)}return new cc(c.y,c.y+b,c.x,c.x+a)}onLocationChange(){}getDisplayText_(){var a=this.getText();a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,rg.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");return a}getText(){var a=this.getText_();return a!==
|
|
1093
1092
|
null?String(a):String(this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0;this.constants_=null}forceRerender(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_.queueRender()}setValue(a,b=!0){if(a!==null){var c=$.gd;c||$.B(!0);try{let m=this.doClassValidation_(a),z=this.processValidation(a,m,b);if(!(z instanceof Error)){var d,e=(d=this.getValidator())==null?void 0:d.call(this,z),f=this.processValidation(z,e,b);if(!(f instanceof Error)){var g=this.sourceBlock_;
|
|
1094
1093
|
if(!g||!g.disposed){var h=this.getValue();h===f?this.doValueUpdate_(f):(this.doValueUpdate_(f),b&&g&&Vb()&&w(new (u(v.BLOCK_CHANGE))(g,"field",this.name||null,h,f)),this.isDirty_&&this.forceRerender())}}}}finally{$.B(c)}}}processValidation(a,b,c){return b===null?(this.doValueInvalid_(a,c),this.isDirty_&&this.forceRerender(),Error()):b===void 0?a:b}getValue(){return this.value_}doClassValidation_(a){return a===null||a===void 0?null:a}doValueUpdate_(a){this.value_=a;this.isDirty_=!0}doValueInvalid_(){}onMouseDown_(a){this.sourceBlock_&&
|
|
@@ -1105,36 +1104,36 @@ a&&a instanceof PointerEvent&&oa(a)?a.stopPropagation():(this.getCommentView().s
|
|
|
1105
1104
|
this.workspace.RTL?"RTL":"LTR");ya(this.textArea,Ka.TEXTBOX);this.textArea.setAttribute("placeholder",$.C.WORKSPACE_COMMENT_DEFAULT_TEXT);n(this.textArea,"blocklyCommentText");n(this.textArea,"blocklyTextarea");n(this.textArea,"blocklyText");a.appendChild(this.textArea);this.foreignObject.appendChild(a);this.id=b+"_comment_textarea_";this.textArea.setAttribute("id",this.id);k(this.textArea,"change",this,this.onTextChange);k(this.textArea,"pointerdown",this,d=>{d.stopPropagation();$.t().focusNode(this);
|
|
1106
1105
|
ha=null});k(this.textArea,"wheel",this,d=>{d.stopPropagation()},!1,{passive:!0});k(this.textArea,"keydown",this,this.handleKeyDown)}getDom(){return this.foreignObject}getText(){return this.text}setText(a){this.textArea.value=a;this.onTextChange()}setParent(a){this.parent=a}getParent(){return this.parent}onTextChange(){var a=this.text;this.text=this.textArea.value;for(let b=this.textChangeListeners.length-1;b>=0;b--)this.textChangeListeners[b](a,this.text)}handleKeyDown(a){if(a.key==="Escape"||a.key===
|
|
1107
1106
|
"Enter"&&(a.ctrlKey||a.metaKey)){if(this.onFinishEditing)this.onFinishEditing();a.stopPropagation()}}addTextChangeListener(a){this.textChangeListeners.push(a)}removeTextChangeListener(a){this.textChangeListeners.splice(this.textChangeListeners.indexOf(a),1)}setPlaceholderText(a){this.textArea.placeholder=a}setEditable(a){a?this.textArea.removeAttribute("readonly"):this.textArea.setAttribute("readonly","true")}updateSize(a,b){this.foreignObject.setAttribute("height",`${a.height-b.height}`);this.foreignObject.setAttribute("width",
|
|
1108
|
-
`${a.width}`);this.foreignObject.setAttribute("y",`${b.height}`);this.workspace.RTL&&this.foreignObject.setAttribute("x",`${-a.width}`)}getFocusableElement(){return this.textArea}getFocusableTree(){return this.workspace}onNodeFocus(){var a=cc.from(this.foreignObject.getBoundingClientRect());this.workspace.scrollBoundsIntoView(cc.createFromPoint(
|
|
1107
|
+
`${a.width}`);this.foreignObject.setAttribute("y",`${b.height}`);this.workspace.RTL&&this.foreignObject.setAttribute("x",`${-a.width}`)}getFocusableElement(){return this.textArea}getFocusableTree(){return this.workspace}onNodeFocus(){var a=cc.from(this.foreignObject.getBoundingClientRect());this.workspace.scrollBoundsIntoView(cc.createFromPoint(pc(this.workspace,a.getOrigin()),a.getWidth(),a.getHeight()))}onNodeBlur(){}canBeFocused(){return this.id?!0:!1}};var An=class extends xn{constructor(a,b,c,d){super(`${a}_delete_bar_button`,b,c,d);this.icon=r(q.IMAGE,{"class":"blocklyDeleteIcon",href:`${this.workspace.options.pathToMedia}delete-icon.svg`,id:this.id},c);this.recomputeAriaContext();this.bindId=k(this.icon,"pointerdown",this,this.performAction.bind(this))}dispose(){la(this.bindId)}reposition(){var a=this.getMargin();this.icon.setAttribute("x","0");var b=this.container.getBBox();this.icon.setAttribute("y",`${a}`);this.icon.setAttribute("x",`${b.width-
|
|
1109
1108
|
this.getSize(!0).getWidth()}`)}performAction(a){ha=null;a&&a instanceof PointerEvent&&oa(a)?a.stopPropagation():(this.getCommentView().dispose(),a==null||a.stopPropagation(),$.t().focusNode(this.workspace),this.workspace.getAudioManager().play("delete"))}getAriaLabel(){return $.C.REMOVE_COMMENT}};var Bn=class{constructor(a,b){this.workspace=a;this.commentId=b;this.collapsed=!1;this.editable=!0;this.location=new D(0,0);this.sizeChangeListeners=[];this.disposeListeners=[];this.collapseChangeListeners=[];this.resizePointerMoveListener=this.resizePointerUpListener=null;this.disposed=this.disposing=!1;this.svgRoot=r(q.G,{"class":"blocklyComment blocklyEditable blocklyDraggable"});ya(this.svgRoot,Ka.BUTTON);l(this.svgRoot,p.ROLEDESCRIPTION,$.C.ARIA_LABEL_COMMENT);this.highlightRect=this.createHighlightRect(this.svgRoot);
|
|
1110
1109
|
({topBarGroup:this.topBarGroup,topBarBackground:this.topBarBackground,deleteButton:this.deleteButton,foldoutButton:this.foldoutButton,textPreview:this.textPreview,textPreviewNode:this.textPreviewNode}=this.createTopBar(this.svgRoot));this.commentEditor=this.createTextArea();l(this.svgRoot,p.LABELLEDBY,this.commentEditor.getFocusableElement().id);this.resizeHandle=this.createResizeHandle(this.svgRoot,a);var c;(c=a.getLayerManager())==null||c.append(this,50);this.size=Bn.defaultCommentSize;this.setSizeWithoutFiringEvents(this.size);
|
|
1111
1110
|
this.moveTo(new D(0,0))}createHighlightRect(a){return r(q.RECT,{"class":"blocklyCommentHighlight"},a)}createTopBar(a){a=r(q.G,{"class":"blocklyCommentTopbar"},a);var b=r(q.RECT,{"class":"blocklyCommentTopbarBackground"},a),c=new An(this.commentId,this.workspace,a,this),d=new yn(this.commentId,this.workspace,a,this);this.addDisposeListener(()=>{c.dispose();d.dispose()});var e=r(q.TEXT,{"class":"blocklyCommentPreview blocklyCommentText blocklyText"},a),f=document.createTextNode("");e.appendChild(f);
|
|
1112
1111
|
return{topBarGroup:a,topBarBackground:b,deleteButton:c,foldoutButton:d,textPreview:e,textPreviewNode:f}}createTextArea(){var a=new zn(this.workspace,this.commentId,()=>this.svgRoot.focus());this.svgRoot.appendChild(a.getDom());a.addTextChangeListener((b,c)=>{this.updateTextPreview(c);this.setSize(this.size)});return a}getEditorFocusableNode(){return this.commentEditor}createResizeHandle(a,b){a=r(q.IMAGE,{"class":"blocklyResizeHandle",href:`${b.options.pathToMedia}resize-handle.svg`},a);k(a,"pointerdown",
|
|
1113
|
-
this,this.onResizePointerDown);return a}getSvgRoot(){return this.svgRoot}getSize(){return this.collapsed?this.topBarBackground.getBBox():this.size}setSizeWithoutFiringEvents(a){var b=this.topBarBackground.getBBox(),c=this.textPreview.getBBox(),d=this.resizeHandle.getBBox();this.size=a=
|
|
1112
|
+
this,this.onResizePointerDown);return a}getSvgRoot(){return this.svgRoot}getSize(){return this.collapsed?this.topBarBackground.getBBox():this.size}setSizeWithoutFiringEvents(a){var b=this.topBarBackground.getBBox(),c=this.textPreview.getBBox(),d=this.resizeHandle.getBBox();this.size=a=ic.max(a,this.calcMinSize(b));this.svgRoot.setAttribute("height",`${a.height}`);this.svgRoot.setAttribute("width",`${a.width}`);this.updateHighlightRect(a);this.updateTopBarSize(a);this.commentEditor.updateSize(a,b);
|
|
1114
1113
|
this.deleteButton.reposition();this.foldoutButton.reposition();this.updateTextPreviewSize(a,b,c);this.updateResizeHandlePosition(a,d)}setSize(a){var b=this.preResizeSize||this.size;this.setSizeWithoutFiringEvents(a);this.onSizeChange(b,this.size)}calcMinSize(a){var b;this.updateTextPreview((b=this.commentEditor.getText())!=null?b:"");var c=b=Wa(this.textPreview);this.foldoutButton.isVisible()?c+=this.foldoutButton.getSize(!0).getWidth():b&&(c+=4);this.deleteButton.isVisible()?c+=this.deleteButton.getSize(!0).getWidth():
|
|
1115
|
-
b&&(c+=4);return new
|
|
1114
|
+
b&&(c+=4);return new ic(c,a.height+20)}updateHighlightRect(a){this.highlightRect.setAttribute("height",`${a.height}`);this.highlightRect.setAttribute("width",`${a.width}`);this.workspace.RTL&&this.highlightRect.setAttribute("x",`${-a.width}`)}updateTopBarSize(a){this.topBarBackground.setAttribute("width",`${a.width}`)}updateTextPreviewSize(a,b,c){b=(b.height-c.height)/2;var d=this.foldoutButton.getSize(!0),e=this.deleteButton.getSize(!0);a=a.width-d.getWidth()-e.getWidth();this.textPreview.setAttribute("x",
|
|
1116
1115
|
`${(this.workspace.RTL?-1:1)*d.getWidth()}`);this.textPreview.setAttribute("y",`${b+c.height/2}`);this.textPreview.setAttribute("width",`${a}`)}updateResizeHandlePosition(a,b){this.resizeHandle.setAttribute("y",`${a.height-b.height}`);this.resizeHandle.setAttribute("x",`${a.width-b.width}`)}onSizeChange(a,b){for(let c=this.sizeChangeListeners.length-1;c>=0;c--)this.sizeChangeListeners[c](a,b)}addSizeChangeListener(a){this.sizeChangeListeners.push(a)}removeSizeChangeListener(a){this.sizeChangeListeners.splice(this.sizeChangeListeners.indexOf(a),
|
|
1117
1116
|
1)}onResizePointerDown(a){this.isEditable()&&(this.bringToFront(),oa(a)||(this.preResizeSize=this.getSize(),Sg(this.workspace,a,new D(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=k(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=k(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),a.stopPropagation())}onResizePointerUp(){ha=null;this.resizePointerUpListener&&(la(this.resizePointerUpListener),
|
|
1118
|
-
this.resizePointerUpListener=null);this.resizePointerMoveListener&&(la(this.resizePointerMoveListener),this.resizePointerMoveListener=null);this.setSize(this.size);this.preResizeSize=void 0}onResizePointerMove(a){a=Tg(this.workspace,a);this.setSizeWithoutFiringEvents(new
|
|
1117
|
+
this.resizePointerUpListener=null);this.resizePointerMoveListener&&(la(this.resizePointerMoveListener),this.resizePointerMoveListener=null);this.setSize(this.size);this.preResizeSize=void 0}onResizePointerMove(a){a=Tg(this.workspace,a);this.setSizeWithoutFiringEvents(new ic(this.workspace.RTL?-a.x:a.x,a.y))}isCollapsed(){return this.collapsed}setCollapsed(a){(this.collapsed=a)?n(this.svgRoot,"blocklyCollapsed"):Ma(this.svgRoot,"blocklyCollapsed");this.setSizeWithoutFiringEvents(this.size);this.onCollapse()}onCollapse(){for(let a=
|
|
1119
1118
|
this.collapseChangeListeners.length-1;a>=0;a--)this.collapseChangeListeners[a](this.collapsed)}addOnCollapseListener(a){this.collapseChangeListeners.push(a)}removeOnCollapseListener(a){this.collapseChangeListeners.splice(this.collapseChangeListeners.indexOf(a),1)}isEditable(){return this.editable}setEditable(a){(this.editable=a)?(n(this.svgRoot,"blocklyEditable"),Ma(this.svgRoot,"blocklyReadonly")):(Ma(this.svgRoot,"blocklyEditable"),n(this.svgRoot,"blocklyReadonly"));this.commentEditor.setEditable(a)}getRelativeToSurfaceXY(){return this.location}moveTo(a){this.location=
|
|
1120
1119
|
a;this.svgRoot.setAttribute("transform",`translate(${a.x}, ${a.y})`)}getText(){return this.commentEditor.getText()}setText(a){this.commentEditor.setText(a)}setPlaceholderText(a){this.commentEditor.setPlaceholderText(a)}addTextChangeListener(a){this.commentEditor.addTextChangeListener(a)}removeTextChangeListener(a){this.commentEditor.removeTextChangeListener(a)}updateTextPreview(a){this.textPreviewNode.textContent=this.truncateText(a)}truncateText(a){return a.length>=12?`${a.substring(0,9)}...`:a}bringToFront(){var a=
|
|
1121
1120
|
this.svgRoot.parentNode,b=a.childNodes;b[b.length-1]!==this.svgRoot&&a.appendChild(this.svgRoot)}onDeleteDown(a){ha=null;oa(a)||this.dispose();a.stopPropagation()}dispose(){this.disposing=!0;Oa(this.svgRoot);for(let a=this.disposeListeners.length-1;a>=0;a--)this.disposeListeners[a]();this.disposeListeners.length=0;this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}addDisposeListener(a){this.disposeListeners.push(a)}removeDisposeListener(a){this.disposeListeners.splice(this.disposeListeners.indexOf(a),
|
|
1122
|
-
1)}getCommentBarButtons(){return[this.foldoutButton,this.deleteButton]}};Bn.defaultCommentSize=new
|
|
1121
|
+
1)}getCommentBarButtons(){return[this.foldoutButton,this.deleteButton]}};Bn.defaultCommentSize=new ic(120,100);ta("\n.injectionDiv {\n --commentFillColour: #FFFCC7;\n --commentBorderColour: #F2E49B;\n}\n\n.blocklyComment .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 1px solid var(--commentBorderColour);\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n\n.blocklyReadonly.blocklyComment .blocklyTextarea {\n cursor: inherit;\n}\n\n.blocklyDeleteIcon {\n width: 20px;\n height: 20px;\n display: none;\n cursor: pointer;\n}\n\n.blocklyFoldoutIcon {\n width: 20px;\n height: 20px;\n transform-origin: 12px 12px;\n cursor: pointer;\n}\n.blocklyResizeHandle {\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n.blocklyReadonly.blocklyComment .blocklyResizeHandle {\n cursor: inherit;\n}\n\n.blocklyCommentTopbarBackground {\n fill: var(--commentBorderColour);\n height: 24px;\n}\n\n.blocklyComment .blocklyCommentPreview.blocklyText {\n fill: #000;\n dominant-baseline: middle;\n visibility: hidden;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentPreview {\n visibility: visible;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,\n.blocklyCollapsed.blocklyComment .blocklyResizeHandle {\n display: none;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {\n transform: rotate(-90deg);\n}\n\n.blocklyRTL .blocklyCommentTopbar {\n transform: scale(-1, 1);\n}\n\n.blocklyRTL .blocklyCommentForeignObject {\n direction: rtl;\n}\n\n.blocklyRTL .blocklyCommentPreview {\n /* Revert the scale and control RTL using direction instead. */\n transform: scale(-1, 1);\n direction: rtl;\n}\n\n.blocklyRTL .blocklyResizeHandle {\n transform: scale(-1, 1);\n cursor: sw-resize;\n}\n\n.blocklyCommentHighlight {\n fill: none;\n}\n\n.blocklyComment.blocklyActiveFocus .blocklyCommentHighlight {\n stroke: var(--blockly-active-node-color);\n stroke-width: calc(2 * var(--blockly-selection-width));\n}\n\n.blocklyCollapsed.blocklyComment.blocklyActiveFocus .blocklyCommentTopbarBackground {\n stroke: var(--blockly-active-node-color);\n stroke-width: var(--blockly-selection-width);\n}\n\n.blocklyCommentText.blocklyActiveFocus {\n border-color: var(--blockly-active-node-color);\n border-width: var(--blockly-selection-width);\n}\n\n.blocklyCommentTopbar image.blocklyActiveFocus {\n outline: var(--blockly-selection-width) solid var(--blockly-active-node-color);\n}\n\n.blocklyCollapsed.blocklyComment.blocklyActiveFocus .blocklyCommentHighlight {\n stroke: none;\n}\n");var eh=class{constructor(a,b){this.workspace=a;this.text="";this.collapsed=!1;this.deletable=this.movable=this.editable=!0;this.location=new D(0,0);this.disposing=this.disposed=!1;this.id=b&&!a.getCommentById(b)?b:Nb();this.size=Bn.defaultCommentSize;a.addTopComment(this);this.fireCreateEvent()}fireCreateEvent(){Vb()&&w(new (u(v.COMMENT_CREATE))(this))}fireDeleteEvent(){Vb()&&w(new (u(v.COMMENT_DELETE))(this))}fireChangeEvent(a,b){Vb()&&w(new (u(v.COMMENT_CHANGE))(this,a,b))}fireCollapseEvent(a){Vb()&&
|
|
1123
1122
|
w(new (u(v.COMMENT_COLLAPSE))(this,a))}setText(a){var b=this.text;this.text=a;this.fireChangeEvent(b,a)}getText(){return this.text}setSize(a){var b=new (u(v.COMMENT_RESIZE))(this);this.size=a;b.recordCurrentSizeAsNewSize();w(b)}getSize(){return this.size}setCollapsed(a){this.collapsed=a;this.fireCollapseEvent(a)}isCollapsed(){return this.collapsed}setEditable(a){this.editable=a}isEditable(){return this.isOwnEditable()&&!this.workspace.isReadOnly()}isOwnEditable(){return this.editable}setMovable(a){this.movable=
|
|
1124
1123
|
a}isMovable(){return this.isOwnMovable()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnMovable(){return this.movable}setDeletable(a){this.deletable=a}isDeletable(){return this.isOwnDeletable()&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnDeletable(){return this.deletable}moveTo(a,b){var c=new (u(v.COMMENT_MOVE))(this);b&&c.setReason(b);this.location=a;c.recordNew();w(c)}getRelativeToSurfaceXY(){return this.location.clone()}dispose(){this.disposing=
|
|
1125
1124
|
!0;this.fireDeleteEvent();this.workspace.removeTopComment(this);this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}};var dh=class extends eh{constructor(a,b){super(a,b);this.dragStrategy=new wn(this);this.workspace=a;this.view=new Bn(a,this.id);this.view.getEditorFocusableNode().setParent(this);this.view.setSize(this.getSize());this.view.setEditable(this.isEditable());this.view.getSvgRoot().setAttribute("data-id",this.id);this.view.getSvgRoot().setAttribute("id",this.id);this.addModelUpdateBindings();k(this.view.getSvgRoot(),"pointerdown",this,this.startGesture)}addModelUpdateBindings(){this.view.addTextChangeListener((a,
|
|
1126
1125
|
b)=>void super.setText(b));this.view.addSizeChangeListener((a,b)=>void super.setSize(b));this.view.addOnCollapseListener(()=>void super.setCollapsed(this.view.isCollapsed()));this.view.addDisposeListener(()=>{this.isDeadOrDying()||this.dispose()})}setText(a){this.view.setText(a)}setPlaceholderText(a){this.view.setPlaceholderText(a)}setSize(a){this.view.setSize(a)}setCollapsed(a){this.view.setCollapsed(a)}setEditable(a){super.setEditable(a);this.view.setEditable(this.isEditable())}getSvgRoot(){return this.view.getSvgRoot()}getSize(){return super.getSize()}getBoundingRectangle(){var a=
|
|
1127
1126
|
this.getRelativeToSurfaceXY(),b,c,d=(c=(b=this.view)==null?void 0:b.getSize())!=null?c:this.getSize();this.workspace.RTL?(b=a.x-d.width,c=a.x):(b=a.x,c=a.x+d.width);return new cc(a.y,a.y+d.height,b,c)}moveBy(a,b,c){var d=this.getRelativeToSurfaceXY();a=new D(d.x+a,d.y+b);this.moveTo(a,c)}moveTo(a,b){super.moveTo(a,b);this.view.moveTo(a)}moveDuringDrag(a){this.location=a;this.view.moveTo(a)}setDragging(a){a?n(this.getSvgRoot(),"blocklyDragging"):Ma(this.getSvgRoot(),"blocklyDragging")}dispose(){this.disposing=
|
|
1128
1127
|
!0;var a=$.t();a.getFocusedNode()===this&&setTimeout(()=>{a.isRegistered(this.workspace)&&a.focusTree(this.workspace)},0);this.view.isDeadOrDying()||this.view.dispose();super.dispose()}startGesture(a){var b=this.workspace.getGesture(a);b&&(b.handleCommentStart(a,this),$.t().focusNode(this))}setDeleteStyle(a){a?n(this.getSvgRoot(),"blocklyDraggingDelete"):Ma(this.getSvgRoot(),"blocklyDraggingDelete")}isCopyable(){return this.isOwnMovable()&&this.isOwnDeletable()}isMovable(){return this.dragStrategy.isMovable()}startDrag(){return this.dragStrategy.startDrag()}drag(a){this.dragStrategy.drag(a)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){n(this.getSvgRoot(),
|
|
1129
|
-
"blocklySelected");pb(this)}unselect(){Ma(this.getSvgRoot(),"blocklySelected");pb(null)}toCopyData(){return{paster:Ol.TYPE,commentState:Pc(this,{addCoordinates:!0,saveIds:!1})}}showContextMenu(a){var b=dk.registry.getContextMenuOptions({comment:this,focusedNode:this},a);var c=a instanceof PointerEvent?new D(a.clientX,a.clientY):
|
|
1128
|
+
"blocklySelected");pb(this)}unselect(){Ma(this.getSvgRoot(),"blocklySelected");pb(null)}toCopyData(){return{paster:Ol.TYPE,commentState:Pc(this,{addCoordinates:!0,saveIds:!1})}}showContextMenu(a){var b=dk.registry.getContextMenuOptions({comment:this,focusedNode:this},a);var c=a instanceof PointerEvent?new D(a.clientX,a.clientY):qc(this.workspace,this.getRelativeToSurfaceXY()).translate(10,10);Hg(a,b,this.workspace.RTL,this.workspace,c)}snapToGrid(){if(!this.isDeadOrDying()){var a=this.workspace.getGrid();
|
|
1130
1129
|
if(a!=null&&a.shouldSnap()){var b=this.getRelativeToSurfaceXY();a=a.alignXY(b);a!==b&&this.moveTo(a,["snap"])}}}getEditorFocusableNode(){return this.view.getEditorFocusableNode()}getFocusableElement(){return this.getSvgRoot()}getFocusableTree(){return this.workspace}onNodeFocus(){this.select();var a;(a=this.getSvgRoot().parentElement)==null||a.appendChild(this.getSvgRoot());this.workspace.scrollBoundsIntoView(this.getBoundingRectangle())}onNodeBlur(){this.unselect()}canBeFocused(){return!0}performAction(){this.setCollapsed(!1);
|
|
1131
1130
|
$.t().focusNode(this.getEditorFocusableNode())}};var Cn={appendDomToWorkspace:function(a,b){if(!b.getBlocksBoundingBox)return $.ch(a,b);var c=b.getBlocksBoundingBox();a=$.ch(a,b);if(c&&c.top!==c.bottom){var d=c.bottom;c=b.RTL?c.right:c.left;var e=Infinity;let f=-Infinity,g=Infinity;for(let h=0;h<a.length;h++){let m=b.getBlockById(a[h]).getRelativeToSurfaceXY();m.y<g&&(g=m.y);m.x<e&&(e=m.x);m.x>f&&(f=m.x)}d=d-g+10;c=b.RTL?c-f:c-e;for(e=0;e<a.length;e++)b.getBlockById(a[e]).moveBy(c,d,["create"])}return a}};Cn.blockToDom=Wg;Cn.blockToDomWithXY=Yg;
|
|
1132
1131
|
Cn.clearWorkspaceAndLoadFromXml=function(a,b){b.setResizesEnabled(!1);b.clear();a=$.ch(a,b);b.setResizesEnabled(!0);return a};Cn.deleteNext=function(a){for(let b=0;b<a.childNodes.length;b++){let c=a.childNodes[b];if(c.nodeName.toLowerCase()==="next"){a.removeChild(c);break}}};Cn.domToBlock=$.fh;Cn.domToBlockInternal=Ng;
|
|
1133
1132
|
Cn.domToPrettyText=function(a){a=ae(a).split("<");var b="";for(let c=1;c<a.length;c++){let d=a[c];d[0]==="/"&&(b=b.substring(2));a[c]=b+"<"+d;d[0]!=="/"&&d.slice(-2)!=="/>"&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");return a.replace(/^\n/,"")};Cn.domToText=ae;Cn.domToVariables=bh;Cn.domToWorkspace=$.ch;Cn.loadWorkspaceComment=ah;Cn.saveWorkspaceComment=Ug;Cn.variablesToDom=Vg;
|
|
1134
|
-
Cn.workspaceToDom=function(a,b=!1){var c=$.
|
|
1133
|
+
Cn.workspaceToDom=function(a,b=!1){var c=$.sc("xml"),d=Vg($.Bd(a));d.hasChildNodes()&&c.appendChild(d);for(let e of a.getTopComments())c.appendChild(Ug(e,b));a=a.getTopBlocks(!0);for(d=0;d<a.length;d++)c.appendChild(Yg(a[d],b));return c};var kh={fromJsonInternal:function(a){var b=Fb(y.FIELD,a.type,void 0);return b?b.fromJson(a):(console.warn("Blockly could not create a field of type "+a.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)}},Dn={TEST_ONLY:kh};Dn.fromJson=$.lh;Dn.register=jh;Dn.unregister=function(a){Eb(y.FIELD,a)};var zh=class extends rg{constructor(a,b,c){super(rg.SKIP_SETUP);this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null;this.SERIALIZABLE=!0;this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null;this.isInitialized=!1;a!==rg.SKIP_SETUP&&(this.setOptions(a),c&&this.configure_(c),b&&this.setValidator(b))}fromXml(a){this.isOptionListDynamic()&&this.getOptions(!1);this.setValue(a.textContent)}loadState(a){this.loadLegacyState(zh,a)||(this.isOptionListDynamic()&&
|
|
1135
1134
|
this.getOptions(!1),this.setValue(a))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot();this.createTextElement_();this.imageElement=r(q.IMAGE,{},this.fieldGroup_);this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&n(this.borderRect_,"blocklyDropdownRect");this.fieldGroup_&&(n(this.fieldGroup_,"blocklyField"),n(this.fieldGroup_,"blocklyDropdownField"));this.recomputeAriaContext();
|
|
1136
1135
|
this.isInitialized=!0}isFullBlockField(){var a;return!this.shouldAddBorderRect_()&&!((a=this.getSourceBlock())==null||!a.isSimpleReporter())}shouldAddBorderRect_(){var a;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!((a=this.getSourceBlock())==null?0:a.isShadow())}createTextArrow_(){this.arrow=r(q.TSPAN,{},this.textElement_);var a;this.arrow.appendChild(document.createTextNode(((a=this.getSourceBlock())==null?0:a.RTL)?zh.ARROW_CHAR+
|
|
1137
|
-
" ":" "+zh.ARROW_CHAR));this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.arrow.setAttribute("dominant-baseline","central");var b;((b=this.getSourceBlock())==null?0:b.RTL)?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=r(q.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow.setAttributeNS("http://www.w3.org/1999/xlink",
|
|
1136
|
+
" ":" "+zh.ARROW_CHAR));this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.arrow.setAttribute("dominant-baseline","central");var b;((b=this.getSourceBlock())==null?0:b.RTL)?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=r(q.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);l(this.svgArrow,p.HIDDEN,!0);this.svgArrow.setAttributeNS("http://www.w3.org/1999/xlink",
|
|
1138
1137
|
"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(a){var b=this.getSourceBlock();if(!b)throw new Dj;this.dropdownCreate();this.menu_&&(this.menu_.openingCoords=a&&typeof a.clientX==="number"?new D(a.clientX,a.clientY):null,Xe(),a=this.menu_.render(Qe),n(a,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(b=b.getColour(),a=this.sourceBlock_.getColourTertiary(),Ye(b,a)),bf(this,this.dropdownDispose_.bind(this)),Qe.style.height=`${this.menu_.getSize().height}px`,
|
|
1139
1138
|
this.menu_.focus(),this.selectedMenuItem&&this.menu_.setHighlighted(this.selectedMenuItem),this.applyColour(),l(this.getFocusableElement(),p.EXPANDED,!0))}dropdownCreate(){var a=this.getSourceBlock();if(!a)throw new Dj;var b=new Ig;b.setRole(Ka.LISTBOX);this.menu_=b;l(this.getFocusableElement(),p.CONTROLS,this.menu_.getId());var c=this.getOptions(!1);this.selectedMenuItem=null;for(let f=0;f<c.length;f++){var d=c[f];if(d===zh.SEPARATOR){b.addChild(new Jg);continue}let [g,h]=d;d=this.computeOptionAriaLabel(d,
|
|
1140
1139
|
f);if(mh(g)){var e=new Image(g.width,g.height);e.src=g.src;e.alt=g.alt}else e=g;d=new Kg(e,h,d);d.setRole(Ka.OPTION);d.setRightToLeft(a.RTL);d.setCheckable(!0);b.addChild(d);d.setChecked(h===this.value_);h===this.value_&&(this.selectedMenuItem=d);d.onAction(this.handleMenuActionEvent,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose();this.selectedMenuItem=this.menu_=null;this.applyColour();l(this.getFocusableElement(),p.EXPANDED,!1)}handleMenuActionEvent(a){pf(this,!0);this.onItemSelected_(this.menu_,
|
|
@@ -1142,9 +1141,9 @@ a)}onItemSelected_(a,b){this.setValue(b.getValue())}isOptionListDynamic(){return
|
|
|
1142
1141
|
a=this.trimOptions(a),this.menuGenerator_=a.options,this.prefixField=a.prefix||null,this.suffixField=a.suffix||null):this.menuGenerator_=a;this.selectedOption=this.getOptions(!1)[0];this.setValue(this.selectedOption[1])}doClassValidation_(a){return this.getOptions(!0).some(b=>b[1]===a)?a:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+a),null)}doValueUpdate_(a){super.doValueUpdate_(a);
|
|
1143
1142
|
a=this.getOptions(!0);for(let b=0,c;c=a[b];b++)c[1]===this.value_&&(this.selectedOption=c);this.isInitialized&&this.recomputeAriaContext()}applyColour(){var a=this.sourceBlock_;this.borderRect_&&(this.borderRect_.setAttribute("stroke",a.getColourTertiary()),this.menu_?this.borderRect_.setAttribute("fill",a.getColourTertiary()):this.borderRect_.setAttribute("fill","transparent"));a&&this.arrow&&(a.isShadow()?this.arrow.style.fill=a.getColourSecondary():this.arrow.style.fill=a.getColour())}render_(){this.getTextContent().nodeValue=
|
|
1144
1143
|
"";this.imageElement.style.display="none";var a=this.selectedOption&&this.selectedOption[0];mh(a)?this.renderSelectedImage(a):this.renderSelectedText();this.positionBorderRect_()}renderSelectedImage(a){var b=this.getSourceBlock();if(!b)throw new Dj;this.imageElement.style.display="";this.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a.src);this.imageElement.setAttribute("height",String(a.height));this.imageElement.setAttribute("width",String(a.width));var c=Number(a.height);
|
|
1145
|
-
a=Number(a.width);var d=!!this.borderRect_,e=Math.max(d?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,c+zh.IMAGE_Y_PADDING);d=d?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var f=this.svgArrow?this.positionSVGArrow(a+d,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):Wa(this.arrow);this.size_=new
|
|
1144
|
+
a=Number(a.width);var d=!!this.borderRect_,e=Math.max(d?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,c+zh.IMAGE_Y_PADDING);d=d?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var f=this.svgArrow?this.positionSVGArrow(a+d,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):Wa(this.arrow);this.size_=new ic(a+f+d*2,e);var g=0;b.RTL?this.imageElement.setAttribute("x",`${d+f}`):(g=a+f,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${d}`));
|
|
1146
1145
|
this.imageElement.setAttribute("y",String(e/2-c/2));this.positionTextElement_(g+d,a+f)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var a=this.getTextElement();n(a,"blocklyDropdownText");a.setAttribute("text-anchor","start");var b=!!this.borderRect_;a=Math.max(b?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);var c=Wa(this.getTextElement());b=b?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var d=0;this.svgArrow&&(d=
|
|
1147
|
-
this.positionSVGArrow(c+b,a/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2));this.size_=new
|
|
1146
|
+
this.positionSVGArrow(c+b,a/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2));this.size_=new ic(c+d+b*2,a);this.positionTextElement_(b,c)}positionSVGArrow(a,b){if(!this.svgArrow)return 0;var c=this.getSourceBlock();if(!c)throw new Dj;var d=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,e=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,f=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;this.svgArrow.setAttribute("transform","translate("+(c.RTL?d:a+e)+","+b+")");return f+
|
|
1148
1147
|
e}getText_(){if(!this.selectedOption)return null;var a=this.selectedOption[0];if(mh(a))return a.alt;if(typeof HTMLElement!=="undefined"&&a instanceof HTMLElement){let b;return a.title||((b=a.ariaLabel)!=null?b:a.innerText)}if(typeof a==="string")return a;console.warn("Can't get text for existing dropdown option. If you're using HTMLElement dropdown options in node, ensure you're using jsdom-global or similar.");return null}static fromJson(a){if(!a.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");
|
|
1149
1148
|
return new this(a.options,void 0,a)}trimOptions(a){var b=!1,c=a.map(g=>{if(g===zh.SEPARATOR)return b=!0,g;var [h,m,z]=g;if(typeof h==="string")return g=[hg(h),m],z&&g.push(hg(z)),g;b=!0;g=[mh(h)?Object.assign({},h,{alt:hg(h.alt)}):h,m];z&&g.push(hg(z));return g});if(b||a.length<2)return{options:c};var d=c.map(([g])=>g),e=tf(d);a=uf(d,e);var f=vf(d,e);if(!a&&!f||e<=a+f)return{options:c};e=a?d[0].substring(0,a-1):void 0;d=f?d[0].substr(1-f):void 0;return{options:this.applyTrim(c,a,f),prefix:e,suffix:d}}applyTrim(a,
|
|
1150
1149
|
b,c){return a.map(([d,e,f])=>{d=d.substring(b,d.length-c);return f!==void 0?[d,e,f]:[d,e]})}validateOptions(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");if(!a.length)throw TypeError("FieldDropdown options must not be an empty array.");var b=!1;for(let c=0;c<a.length;c++){let d=a[c];Array.isArray(d)||d===zh.SEPARATOR?typeof d[1]!=="string"?(b=!0,console.error(`Invalid option[${c}]: Each FieldDropdown option id must be a string.
|
|
@@ -1169,13 +1168,13 @@ e.getBoundingRectangleWithoutChildren().getOrigin().y)!==c;){let h,m;b=(m=(h=b)=
|
|
|
1169
1168
|
this.draggable=this.moveIndicator=void 0;this.totalDelta=new D(0,0);this.moving=!1}totalPixelDelta(){var a,b,c=(b=(a=this.draggable)==null?void 0:a.workspace.scale)!=null?b:1;return new D(this.totalDelta.x*c,this.totalDelta.y*c)}scrollCurrentElementIntoView(){if(this.draggable){var a=this.draggable.getBoundingRectangle();this.draggable.workspace.scrollBoundsIntoView(a)}}updateTotalDelta(){this.draggable&&this.startLocation&&(this.totalDelta=new D(this.draggable.getRelativeToSurfaceXY().x-this.startLocation.x,
|
|
1170
1169
|
this.draggable.getRelativeToSurfaceXY().y-this.startLocation.y))}};si.mover=new si;var Gn=class{constructor(a,b,c,d){this.name=a;this.startHats=!1;this.blockStyles=b||Object.create(null);this.categoryStyles=c||Object.create(null);this.componentStyles=d||Object.create(null);this.fontStyle=Object.create(null);A(y.THEME,a,this,!0)}getClassName(){return this.name+"-theme"}setBlockStyle(a,b){this.blockStyles[a]=b}setCategoryStyle(a,b){this.categoryStyles[a]=b}getComponentStyle(a){a=this.componentStyles[a];if(!a)return null;if(typeof a==="string"){let b=this.getComponentStyle(a);if(b)return b}return`${a}`}setComponentStyle(a,
|
|
1171
1170
|
b){this.componentStyles[a]=b}setFontStyle(a){this.fontStyle=a}setStartHats(a){this.startHats=a}static defineTheme(a,b){a=a.toLowerCase();var c=new Gn(a),d=b.base;if(d){if(typeof d==="string"){let e;d=(e=Fb(y.THEME,d,void 0))!=null?e:void 0}d instanceof Gn&&(db(c,d),c.name=a)}db(c.blockStyles,b.blockStyles);db(c.categoryStyles,b.categoryStyles);db(c.componentStyles,b.componentStyles);db(c.fontStyle,b.fontStyle);b.startHats!==null&&(c.startHats=b.startHats);return c}};var Hn=new Gn("classic",{colour_blocks:{colourPrimary:"20"},list_blocks:{colourPrimary:"260"},logic_blocks:{colourPrimary:"210"},loop_blocks:{colourPrimary:"120"},math_blocks:{colourPrimary:"230"},procedure_blocks:{colourPrimary:"290"},text_blocks:{colourPrimary:"160"},variable_blocks:{colourPrimary:"330"},variable_dynamic_blocks:{colourPrimary:"310"},hat_blocks:{colourPrimary:"330",hat:"cap"}},{colour_category:{colour:"20"},list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},
|
|
1172
|
-
math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}});var In=class{constructor(a){this.gridPattern=null;this.getMetrics=this.setMetrics=void 0;var b=null,c=!1,d=!1,e=!1,f=!1,g=!1,h=!1,m=!!a.readOnly;if(!m){var z;b=
|
|
1173
|
-
V===F?E.RIGHT:E.LEFT;var ja=a.css;ja===void 0&&(ja=!0);var Xa="https://static.blockly.com/media/";a.media&&(Xa=a.media.endsWith("/")?a.media:a.media+"/");var cb=a.oneBasedIndex;cb=cb===void 0?!0:cb;var
|
|
1174
|
-
Xa;this.hasCategories=c;this.moveOptions=In.parseMoveOptions(a,c);this.hasScrollbars=!!this.moveOptions.scrollbars;this.hasTrashcan=d;this.maxTrashcanContents=z;this.hasSounds=h;this.hasCss=ja;this.horizontalLayout=J;this.languageTree=b;this.gridOptions=In.parseGridOptions(a);this.zoomOptions=In.parseZoomOptions(a);this.toolboxPosition=V;this.theme=In.parseThemeOptions(a);this.renderer=
|
|
1171
|
+
math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}});var In=class{constructor(a){this.gridPattern=null;this.getMetrics=this.setMetrics=void 0;var b=null,c=!1,d=!1,e=!1,f=!1,g=!1,h=!1,m=!!a.readOnly;if(!m){var z;b=Dc((z=a.toolbox)!=null?z:null);c=Fc(b);d=a.trashcan;d=d===void 0?c:d;e=a.collapse;e=e===void 0?c:e;f=a.comments;f=f===void 0?c:f;g=a.disable;g=g===void 0?c:g;h=a.sounds;h=h===void 0?!0:h}z=a.maxTrashcanContents;d?z===void 0&&(z=32):z=0;var F=!!a.rtl,J=a.horizontalLayout;J===void 0&&(J=!1);var V=a.toolboxPosition!=="end";V=J?V?E.TOP:E.BOTTOM:
|
|
1172
|
+
V===F?E.RIGHT:E.LEFT;var ja=a.css;ja===void 0&&(ja=!0);var Xa="https://static.blockly.com/media/";a.media&&(Xa=a.media.endsWith("/")?a.media:a.media+"/");var cb=a.oneBasedIndex;cb=cb===void 0?!0:cb;var dj=a.renderer||"thrasos",Us=a.plugins||{},ik=a.modalInputs;ik===void 0&&(ik=!0);this.RTL=F;this.oneBasedIndex=cb;this.collapse=e;this.comments=f;this.disable=g;this.readOnly=m;this.maxBlocks=a.maxBlocks||Infinity;var lp;this.maxInstances=(lp=a.maxInstances)!=null?lp:null;this.modalInputs=ik;this.pathToMedia=
|
|
1173
|
+
Xa;this.hasCategories=c;this.moveOptions=In.parseMoveOptions(a,c);this.hasScrollbars=!!this.moveOptions.scrollbars;this.hasTrashcan=d;this.maxTrashcanContents=z;this.hasSounds=h;this.hasCss=ja;this.horizontalLayout=J;this.languageTree=b;this.gridOptions=In.parseGridOptions(a);this.zoomOptions=In.parseZoomOptions(a);this.toolboxPosition=V;this.theme=In.parseThemeOptions(a);this.renderer=dj;var mp;this.rendererOverrides=(mp=a.rendererOverrides)!=null?mp:null;var np;this.parentWorkspace=(np=a.parentWorkspace)!=
|
|
1175
1174
|
null?np:null;this.plugins=Us}static parseMoveOptions(a,b){var c=a.move||{},d={};c.scrollbars===void 0&&a.scrollbars===void 0?d.scrollbars=b:typeof c.scrollbars==="object"?(d.scrollbars={horizontal:!!c.scrollbars.horizontal,vertical:!!c.scrollbars.vertical},d.scrollbars.horizontal&&d.scrollbars.vertical?d.scrollbars=!0:d.scrollbars.horizontal||d.scrollbars.vertical||(d.scrollbars=!1)):d.scrollbars=!!c.scrollbars||!!a.scrollbars;d.wheel=d.scrollbars&&c.wheel!==void 0?!!c.wheel:typeof d.scrollbars===
|
|
1176
1175
|
"object";d.drag=d.scrollbars?c.drag===void 0?!0:!!c.drag:!1;return d}static parseZoomOptions(a){a=a.zoom||{};var b={};b.controls=a.controls===void 0?!1:!!a.controls;b.wheel=a.wheel===void 0?!1:!!a.wheel;b.startScale=a.startScale===void 0?1:Number(a.startScale);b.maxScale=a.maxScale===void 0?3:Number(a.maxScale);b.minScale=a.minScale===void 0?.3:Number(a.minScale);b.scaleSpeed=a.scaleSpeed===void 0?1.2:Number(a.scaleSpeed);b.pinch=a.pinch===void 0?b.wheel||b.controls:!!a.pinch;return b}static parseGridOptions(a){a=
|
|
1177
1176
|
a.grid||{};var b={};b.spacing=Number(a.spacing)||0;b.colour=a.colour||"#888";b.length=a.length===void 0?1:Number(a.length);b.snap=b.spacing>0&&!!a.snap;return b}static parseThemeOptions(a){a=a.theme||Hn;return typeof a==="string"?Fb(y.THEME,a,void 0):a instanceof Gn?a:Gn.defineTheme(a.name||"builtin"+Lb(),a)}};var Jn=class{constructor(a,b){this.bubble=a;this.workspace=b;this.startLoc=null}isMovable(){return!0}startDrag(){this.startLoc=this.bubble.getRelativeToSurfaceXY();this.workspace.setResizesEnabled(!1);var a;(a=this.workspace.getLayerManager())==null||a.moveToDragLayer(this.bubble);this.bubble.setDragging&&this.bubble.setDragging(!0);return this.bubble}drag(a){this.bubble.moveDuringDrag(a)}endDrag(){this.workspace.setResizesEnabled(!0);var a;(a=this.workspace.getLayerManager())==null||a.moveOffDragLayer(this.bubble,
|
|
1178
|
-
100);this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}};var Kn,Ln=class{constructor(a,b,c,d,e){this.workspace=a;this.anchor=b;this.ownerRect=c;this.owner=e;this.size=new
|
|
1177
|
+
100);this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}};var Kn,Ln=class{constructor(a,b,c,d,e){this.workspace=a;this.anchor=b;this.ownerRect=c;this.owner=e;this.size=new ic(0,0);this.colour="#ffffff";this.disposed=!1;this.relativeLeft=this.relativeTop=0;this.dragStrategy=new Jn(this,this.workspace);this.ariaLabelProvider=null;this.id=Lb();this.svgRoot=r(q.G,{"class":"blocklyBubble"},a.getBubbleCanvas());a=r(q.G,{"class":"blocklyEmboss"},this.svgRoot);this.tail=r(q.PATH,{"class":"blocklyBubbleTail"},a);this.background=r(q.RECT,{"class":"blocklyDraggable",
|
|
1179
1178
|
x:0,y:0,rx:Kn.BORDER_WIDTH,ry:Kn.BORDER_WIDTH},a);this.contentContainer=r(q.G,{},this.svgRoot);this.focusableElement=d!=null?d:this.svgRoot;this.focusableElement.setAttribute("id",this.id);k(this.background,"pointerdown",this,this.onMouseDown);k(this.focusableElement,"keydown",this,this.onKeyDown);this.recomputeAriaContext()}dispose(){Oa(this.svgRoot);this.disposed=!0}setAnchorLocation(a,b=!1){this.anchor=a;b?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor();this.renderTail()}setPositionRelativeToAnchor(a,
|
|
1180
1179
|
b){this.relativeLeft=a;this.relativeTop=b;this.positionRelativeToAnchor();this.renderTail()}getSize(){return this.size}setSize(a,b=!1){a.width=Math.max(a.width,Kn.MIN_SIZE);a.height=Math.max(a.height,Kn.MIN_SIZE);this.size=a;this.background.setAttribute("width",`${a.width}`);this.background.setAttribute("height",`${a.height}`);b?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor();this.renderTail()}getColour(){return this.colour}setColour(a){this.colour=a;this.tail.setAttribute("fill",
|
|
1181
1180
|
a);this.background.setAttribute("fill",a)}onMouseDown(a){var b;(b=this.workspace.getGesture(a))==null||b.handleBubbleStart(a,this);$.t().focusNode(this)}onKeyDown(a){a.key==="Escape"&&this.owner&&(this.owner.setBubbleVisible(!1),$.t().focusNode(this.owner))}positionRelativeToAnchor(){var a=this.anchor.x;a=this.workspace.RTL?a-(this.relativeLeft+this.size.width):a+this.relativeLeft;this.moveTo(a,this.relativeTop+this.anchor.y)}moveTo(a,b){this.svgRoot.setAttribute("transform",`translate(${a}, ${b})`)}moveBy(a,
|
|
@@ -1191,14 +1190,14 @@ this.bringToFront();var a=this.getRelativeToSurfaceXY(),b=this.getSize();a=new c
|
|
|
1191
1190
|
(a.insertBefore(this.miniWorkspace.addFlyout(q.G),this.miniWorkspace.getCanvas()),a=this.miniWorkspace.getFlyout(),a==null||a.init(this.miniWorkspace),a==null||a.show(b.languageTree));n(this.svgRoot,"blocklyMiniWorkspaceBubble");this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this));var f,g;(f=this.miniWorkspace.getFlyout())==null||(g=f.getWorkspace())==null||g.addChangeListener(this.onWorkspaceChange.bind(this));this.updateBubbleSize()}dispose(){this.miniWorkspace.dispose();super.dispose()}getWorkspace(){return this.miniWorkspace}addWorkspaceChangeListener(a){this.miniWorkspace.addChangeListener(a)}validateWorkspaceOptions(a){if(a.hasCategories)throw Error("The miniworkspace bubble does not support toolboxes with categories");
|
|
1192
1191
|
if(a.hasTrashcan)throw Error("The miniworkspace bubble does not support trashcans");if(a.zoomOptions.controls||a.zoomOptions.wheel||a.zoomOptions.pinch)throw Error("The miniworkspace bubble does not support zooming");if(a.moveOptions.scrollbars||a.moveOptions.wheel||a.moveOptions.drag)throw Error("The miniworkspace bubble does not allow scrolling/moving the workspace");if(a.horizontalLayout)throw Error("The miniworkspace bubble does not support horizontal layouts");}onWorkspaceChange(){this.bumpBlocksIntoBounds();
|
|
1193
1192
|
this.updateBubbleSize()}bumpBlocksIntoBounds(){if(!this.miniWorkspace.isDragging()||si.mover.isMoving())for(let a of this.miniWorkspace.getTopBlocks(!1)){let b=a.getRelativeToSurfaceXY();b.y<20&&a.moveBy(0,20-b.y);if(a.RTL){let c=-20,d=this.miniWorkspace.getFlyout();d&&(c-=d.getWidth());b.x>c&&a.moveBy(c-b.x,0)}else b.x<20&&a.moveBy(20-b.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()||si.mover.isMoving()){this.autoLayout&&(this.autoLayout=!si.mover.isMoving());var a=this.getSize(),b=
|
|
1194
|
-
this.calculateWorkspaceSize();Math.abs(a.width-b.width)<Mn.MINIMUM_VIEW_CHANGE&&Math.abs(a.height-b.height)<Mn.MINIMUM_VIEW_CHANGE||(this.svgDialog.setAttribute("width",`${b.width}px`),this.svgDialog.setAttribute("height",`${b.height}px`),this.miniWorkspace.setCachedParentSvgSize(b.width,b.height),this.miniWorkspace.RTL&&this.miniWorkspace.getCanvas().setAttribute("transform",`translate(${b.width}, 0)`),this.setSize(new
|
|
1195
|
-
this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var a=this.miniWorkspace.getCanvas().getBBox(),b=a.width+Mn.MARGIN;a=a.height+Mn.MARGIN;var c=this.miniWorkspace.getFlyout();if(c){let d=c.getWorkspace().getMetricsManager().getScrollMetrics();a=Math.max(a,d.height+20);b+=c.getWidth()}return new
|
|
1193
|
+
this.calculateWorkspaceSize();Math.abs(a.width-b.width)<Mn.MINIMUM_VIEW_CHANGE&&Math.abs(a.height-b.height)<Mn.MINIMUM_VIEW_CHANGE||(this.svgDialog.setAttribute("width",`${b.width}px`),this.svgDialog.setAttribute("height",`${b.height}px`),this.miniWorkspace.setCachedParentSvgSize(b.width,b.height),this.miniWorkspace.RTL&&this.miniWorkspace.getCanvas().setAttribute("transform",`translate(${b.width}, 0)`),this.setSize(new ic(b.width+Ln.DOUBLE_BORDER,b.height+Ln.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),
|
|
1194
|
+
this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var a=this.miniWorkspace.getCanvas().getBBox(),b=a.width+Mn.MARGIN;a=a.height+Mn.MARGIN;var c=this.miniWorkspace.getFlyout();if(c){let d=c.getWorkspace().getMetricsManager().getScrollMetrics();a=Math.max(a,d.height+20);b+=c.getWidth()}return new ic(b,a)}updateBlockStyles(){for(var a of this.miniWorkspace.getAllBlocks(!1))a.setStyle(a.getStyleName());var b;if(a=(b=this.miniWorkspace.getFlyout())==null?void 0:b.getWorkspace())for(let c of a.getAllBlocks(!1))c.setStyle(c.getStyleName())}moveDuringDrag(a){super.moveDuringDrag(a);
|
|
1196
1195
|
this.autoLayout=!1}moveTo(a,b){super.moveTo(a,b);this.miniWorkspace.recordDragTargets()}newWorkspaceSvg(){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}performAction(){$.t().focusTree(this.getWorkspace())}};Mn.MINIMUM_VIEW_CHANGE=10;Mn.MARGIN=Ln.DOUBLE_BORDER*3;var Nn=class{constructor(a){this.sourceBlock=a;this.offsetInBlock=new D(0,0);this.workspaceLocation=new D(0,0);this.svgRoot=null;this.tooltip=a;this.id=Lb()}getType(){throw Error("Icons must implement getType");}initView(a){if(!this.svgRoot){var b=this.sourceBlock;this.svgRoot=r(q.G,{"class":"blocklyIconGroup",id:this.id});b.getSvgRoot().appendChild(this.svgRoot);this.updateSvgRootOffset();k(this.svgRoot,"pointerdown",this,a);this.svgRoot.tooltip=this;Hf(this.svgRoot);this.recomputeAriaContext()}}dispose(){this.svgRoot&&
|
|
1197
|
-
(If(this.svgRoot),delete this.svgRoot.tooltip,Oa(this.svgRoot));this.tooltip=""}getWeight(){return-1}getSize(){return new
|
|
1196
|
+
(If(this.svgRoot),delete this.svgRoot.tooltip,Oa(this.svgRoot));this.tooltip=""}getWeight(){return-1}getSize(){return new ic(0,0)}setTooltip(a){this.tooltip=a!=null?a:this.sourceBlock}getTooltip(){return this.tooltip}applyColour(){}updateEditable(){}updateCollapsed(){this.svgRoot&&(this.sourceBlock.isCollapsed()?this.svgRoot.style.display="none":this.svgRoot.style.display="block",xd(this)&&this.setBubbleVisible(!1))}hideForInsertionMarker(){this.svgRoot&&(this.svgRoot.style.display="none")}isShownWhenCollapsed(){return!1}setOffsetInBlock(a){this.offsetInBlock=
|
|
1198
1197
|
a;this.updateSvgRootOffset()}updateSvgRootOffset(){var a;(a=this.svgRoot)==null||a.setAttribute("transform",`translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`)}onLocationChange(a){this.workspaceLocation=D.sum(a,this.offsetInBlock)}onClick(){}isClickableInFlyout(){return!0}getFocusableElement(){var a=this.svgRoot;if(!a)throw Error("Attempting to focus uninitialized icon.");return a}getFocusableTree(){return this.sourceBlock.workspace}onNodeFocus(){var a=this.sourceBlock.getBoundingRectangle();
|
|
1199
1198
|
a=new cc(a.top+this.offsetInBlock.y,a.top+this.offsetInBlock.y+this.getSize().height,a.left+this.offsetInBlock.x,a.left+this.offsetInBlock.x+this.getSize().width);this.sourceBlock.workspace.scrollBoundsIntoView(a)}onNodeBlur(){}canBeFocused(){return!0}performAction(){this.onClick();cd().then(()=>{if(xd(this)&&this.bubbleIsVisible()){let a=this.getBubble();a&&$.t().focusNode(a)}})}getSourceBlock(){return this.sourceBlock}showContextMenu(a){this.getSourceBlock().showContextMenu(a)}recomputeAriaContext(){var a=
|
|
1200
1199
|
this.getFocusableElement();if(a){var b,c=(b=this.sourceBlock.workspace.targetWorkspace)==null?void 0:b.getFlyout();if(c&&!this.isClickableInFlyout(c.autoClose))l(a,p.HIDDEN,!0);else{za(a,p.HIDDEN);ya(a,Ka.BUTTON);var d;b=(d=this.getAriaLabel())!=null?d:$.C.ICON_LABEL_DEFAULT;l(a,p.LABEL,b)}}}getAriaLabel(){return null}};$.sh=class extends Nn{constructor(a,b){super(b);this.flyoutBlockTypes=a;this.sourceBlock=b;this.saveConnectionsListener=this.updateWorkspacePid=this.rootBlock=this.miniWorkspaceBubble=null}getType(){return $.sh.TYPE}initView(a){this.svgRoot||(super.initView(a),r(q.RECT,{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},this.svgRoot),r(q.PATH,{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},
|
|
1201
|
-
this.svgRoot),r(q.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),n(this.svgRoot,"blocklyMutatorIcon"))}dispose(){super.dispose();var a;(a=this.miniWorkspaceBubble)==null||a.dispose()}getWeight(){return $.sh.WEIGHT}getSize(){return new
|
|
1200
|
+
this.svgRoot),r(q.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),n(this.svgRoot,"blocklyMutatorIcon"))}dispose(){super.dispose();var a;(a=this.miniWorkspaceBubble)==null||a.dispose()}getWeight(){return $.sh.WEIGHT}getSize(){return new ic(17,17)}applyColour(){super.applyColour();var a;(a=this.miniWorkspaceBubble)==null||a.setColour(this.sourceBlock.getColour());var b;(b=this.miniWorkspaceBubble)==null||b.updateBlockStyles()}updateCollapsed(){super.updateCollapsed();this.sourceBlock.isCollapsed()&&
|
|
1202
1201
|
this.setBubbleVisible(!1)}onLocationChange(a){super.onLocationChange(a);var b;(b=this.miniWorkspaceBubble)==null||b.setAnchorLocation(this.getAnchorLocation())}onClick(){super.onClick();this.sourceBlock.isEditable()&&this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.miniWorkspaceBubble}setBubbleVisible(a){var b=this;return(0,M.asyncExecutePromiseGeneratorFunction)(function*(){if(b.bubbleIsVisible()!==a){yield cd();if(a){b.miniWorkspaceBubble=
|
|
1203
1202
|
new Mn(b.getMiniWorkspaceConfig(),b.sourceBlock.workspace,b.getAnchorLocation(),b.getBubbleOwnerRect(),b);b.applyColour();b.createRootBlock();b.addSaveConnectionsListener();let c;(c=b.miniWorkspaceBubble)==null||c.addWorkspaceChangeListener(b.createMiniWorkspaceChangeListener());b.miniWorkspaceBubble.setAriaLabelProvider($.C.WORKSPACE_LABEL_MUTATOR_WORKSPACE)}else{let c;(c=b.miniWorkspaceBubble)==null||c.dispose();b.miniWorkspaceBubble=null;b.saveConnectionsListener&&b.sourceBlock.workspace.removeChangeListener(b.saveConnectionsListener);
|
|
1204
1203
|
b.saveConnectionsListener=null}w(new (u(v.BUBBLE_OPEN))(b.sourceBlock,a,"mutator"));b.recomputeAriaContext()}})}getBubble(){return this.miniWorkspaceBubble}getMiniWorkspaceConfig(){var a,b={disable:!1,media:this.sourceBlock.workspace.options.pathToMedia,rtl:this.sourceBlock.RTL,renderer:this.sourceBlock.workspace.options.renderer,rendererOverrides:(a=this.sourceBlock.workspace.options.rendererOverrides)!=null?a:void 0};this.flyoutBlockTypes.length&&(b.toolbox={kind:"flyoutToolbox",contents:this.flyoutBlockTypes.map(c=>
|
|
@@ -1206,12 +1205,12 @@ b.saveConnectionsListener=null}w(new (u(v.BUBBLE_OPEN))(b.sourceBlock,a,"mutator
|
|
|
1206
1205
|
this.rootBlock.setDeletable(!1);var b,c,d,e;a=(e=(b=this.miniWorkspaceBubble)==null?void 0:(c=b.getWorkspace())==null?void 0:(d=c.getFlyout())==null?void 0:d.getWidth())!=null?e:0;this.rootBlock.moveBy(this.rootBlock.RTL?-(a+16):16,16)}addSaveConnectionsListener(){this.sourceBlock.saveConnections&&this.rootBlock&&(this.saveConnectionsListener=()=>{this.sourceBlock.saveConnections&&this.rootBlock&&this.sourceBlock.saveConnections(this.rootBlock)},this.saveConnectionsListener(),this.sourceBlock.workspace.addChangeListener(this.saveConnectionsListener))}createMiniWorkspaceChangeListener(){return a=>
|
|
1207
1206
|
{$.sh.isIgnorableMutatorEvent(a)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null;this.recomposeSourceBlock()},0))}}static isIgnorableMutatorEvent(a){return a.isUiEvent||a.type===v.BLOCK_CREATE||a.type===v.BLOCK_CHANGE&&a.element==="disabled"}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var a=$.gd;a||$.B(!0);var b=Xl.getExtraBlockState_(this.sourceBlock);
|
|
1208
1207
|
this.sourceBlock.compose(this.rootBlock);var c=Xl.getExtraBlockState_(this.sourceBlock);b!==c&&w(new (u(v.BLOCK_CHANGE))(this.sourceBlock,"mutation",null,b,c));$.B(a)}}getWorkspace(){var a;return(a=this.miniWorkspaceBubble)==null?void 0:a.getWorkspace()}getAriaLabel(){return this.bubbleIsVisible()?$.C.ICON_LABEL_MUTATOR_OPEN:$.C.ICON_LABEL_MUTATOR_CLOSED}};$.sh.TYPE=Zg.MUTATOR;$.sh.WEIGHT=1;var nh=Object.create(null),On={allExtensions:nh};$.oh("parent_tooltip_when_inline",function(){var a=this.tooltip;this.setTooltip(function(){var b=this.getParent();return b&&b.getInputsInline()&&b.tooltip||a}.bind(this))});var Pn={TEST_ONLY:On};Pn.apply=wh;Pn.buildTooltipForDropdown=$.yh;Pn.buildTooltipWithFieldText=$.Ah;Pn.isRegistered=uh;Pn.register=$.oh;Pn.registerMixin=$.ph;Pn.registerMutator=$.th;
|
|
1209
|
-
Pn.runAfterPageLoad=function(a){if(typeof document!=="object")throw Error("runAfterPageLoad() requires browser document.");if(document.readyState==="complete")a();else{let b=setInterval(function(){document.readyState==="complete"&&(clearInterval(b),a())},10)}};Pn.unregister=function(a){uh(a)?delete nh[a]:console.warn('No extension mapping for name "'+a+'" found to unregister')};var Qn={};Qn.arc=Gh;Qn.curve=Bh;Qn.line=Fh;Qn.lineOnAxis=I;Qn.lineTo=Eh;Qn.moveBy=Dh;Qn.moveTo=Ch;Qn.point=H;var Rn={};Rn.Coordinate=D;Rn.KeyCodes=L;Rn.Rect=cc;Rn.Size=
|
|
1208
|
+
Pn.runAfterPageLoad=function(a){if(typeof document!=="object")throw Error("runAfterPageLoad() requires browser document.");if(document.readyState==="complete")a();else{let b=setInterval(function(){document.readyState==="complete"&&(clearInterval(b),a())},10)}};Pn.unregister=function(a){uh(a)?delete nh[a]:console.warn('No extension mapping for name "'+a+'" found to unregister')};var Qn={};Qn.arc=Gh;Qn.curve=Bh;Qn.line=Fh;Qn.lineOnAxis=I;Qn.lineTo=Eh;Qn.moveBy=Dh;Qn.moveTo=Ch;Qn.point=H;var Rn={};Rn.Coordinate=D;Rn.KeyCodes=L;Rn.Rect=cc;Rn.Size=ic;Rn.Svg=q;Rn.aria=el;Rn.array=Uk;Rn.browserEvents=Tk;Rn.colour=pn;Rn.deprecation=ml;Rn.dom=gl;Rn.extensions=Pn;Rn.idGenerator=rl;Rn.math=ln;Rn.object=jl;Rn.parsing=qn;Rn.string=nn;Rn.style=tl;Rn.svgMath=ul;Rn.svgPaths=Qn;Rn.toolbox=zl;Rn.userAgent=Sk;Rn.xml=xl;var Sn=class extends Ln{constructor(a,b,c,d){super(a,b,c,void 0,d);this.workspace=a;this.anchor=b;this.ownerRect=c;this.owner=d;this.resizePointerMoveListener=this.resizePointerUpListener=null;this.sizeChangeListeners=[];this.locationChangeListeners=[];this.DEFAULT_SIZE=new ic(160+Ln.DOUBLE_BORDER,80+Ln.DOUBLE_BORDER);this.MIN_SIZE=new ic(45+Ln.DOUBLE_BORDER,20+Ln.DOUBLE_BORDER);this.editable=!0;this.textChangeListener=()=>{this.recomputeAriaContext()};n(this.svgRoot,"blocklyTextInputBubble");this.editor=
|
|
1210
1209
|
new zn(a,this.id,()=>{$.t().focusNode(this)});this.contentContainer.appendChild(this.editor.getDom());this.resizeGroup=this.createResizeHandle(this.svgRoot,a);this.setSize(this.DEFAULT_SIZE,!0);this.addTextChangeListener(this.textChangeListener)}getText(){return this.editor.getText()}setText(a){this.editor.setText(a)}setEditable(a){this.editable=a;this.editor.setEditable(a)}isEditable(){return this.editable}addTextChangeListener(a){this.editor.addTextChangeListener(a)}addSizeChangeListener(a){this.sizeChangeListeners.push(a)}addLocationChangeListener(a){this.locationChangeListeners.push(a)}createResizeHandle(a,
|
|
1211
|
-
b){a=r(q.IMAGE,{"class":"blocklyResizeHandle",href:`${b.options.pathToMedia}resize-handle.svg`},a);k(a,"pointerdown",this,this.onResizePointerDown);return a}setSize(a,b=!1){a.width=Math.max(a.width,this.MIN_SIZE.width);a.height=Math.max(a.height,this.MIN_SIZE.height);var c=a.width-Ln.DOUBLE_BORDER,d=a.height-Ln.DOUBLE_BORDER;this.editor.updateSize(new
|
|
1210
|
+
b){a=r(q.IMAGE,{"class":"blocklyResizeHandle",href:`${b.options.pathToMedia}resize-handle.svg`},a);k(a,"pointerdown",this,this.onResizePointerDown);return a}setSize(a,b=!1){a.width=Math.max(a.width,this.MIN_SIZE.width);a.height=Math.max(a.height,this.MIN_SIZE.height);var c=a.width-Ln.DOUBLE_BORDER,d=a.height-Ln.DOUBLE_BORDER;this.editor.updateSize(new ic(c,d),new ic(0,0));this.editor.getDom().setAttribute("x",`${Ln.DOUBLE_BORDER/2}`);this.editor.getDom().setAttribute("y",`${Ln.DOUBLE_BORDER/2}`);
|
|
1212
1211
|
this.resizeGroup.setAttribute("y",`${d}`);this.workspace.RTL?this.resizeGroup.setAttribute("x",`${-Ln.DOUBLE_BORDER}`):this.resizeGroup.setAttribute("x",`${c}`);super.setSize(a,b);this.onSizeChange()}getSize(){return super.getSize()}moveDuringDrag(a){super.moveDuringDrag(a);this.onLocationChange()}setPositionRelativeToAnchor(a,b){super.setPositionRelativeToAnchor(a,b);this.onLocationChange()}positionByRect(a=new cc(0,0,0,0)){super.positionByRect(a);this.onLocationChange()}onResizePointerDown(a){this.bringToFront();
|
|
1213
1212
|
oa(a)||(Sg(this.workspace,a,new D(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=k(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=k(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff());a.stopPropagation()}onResizePointerUp(){ha=null;this.resizePointerUpListener&&(la(this.resizePointerUpListener),this.resizePointerUpListener=null);this.resizePointerMoveListener&&(la(this.resizePointerMoveListener),
|
|
1214
|
-
this.resizePointerMoveListener=null)}onResizePointerMove(a){a=Tg(this.workspace,a);this.setSize(new
|
|
1213
|
+
this.resizePointerMoveListener=null)}onResizePointerMove(a){a=Tg(this.workspace,a);this.setSize(new ic(this.workspace.RTL?-a.x:a.x,a.y),!1);this.onSizeChange()}onSizeChange(){for(let a of this.sizeChangeListeners)a()}onLocationChange(){for(let a of this.locationChangeListeners)a()}getEditor(){return this.editor}performAction(){$.t().focusNode(this.getEditor())}dispose(){super.dispose();this.editor.removeTextChangeListener(this.textChangeListener)}};ta("\n.blocklyTextInputBubble .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 0;\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n");var Tn=class{constructor(a){this.connectionChecker=a;this.connections=[];this.bulkCounter=0}addConnection(a,b){b=this.calculateIndexForYPos(b);this.connections.splice(b,0,a)}findIndexOfConnection(a,b){if(!this.connections.length)return-1;var c=this.calculateIndexForYPos(b);if(c>=this.connections.length)return-1;b=a.y;for(var d=c;d>=0&&this.connections[d].y===b;){if(this.connections[d]===a)return d;d--}for(d=c;d<this.connections.length&&this.connections[d].y===b;){if(this.connections[d]===a)return d;
|
|
1215
1214
|
d++}return-1}calculateIndexForYPos(a){if(!this.connections.length)return 0;for(var b=0,c=this.connections.length;b<c;){let d=Math.floor((b+c)/2);if(this.connections[d].y<a)b=d+1;else if(this.connections[d].y>a)c=d;else{b=d;break}}return b}removeConnection(a,b){a=this.findIndexOfConnection(a,b);if(a===-1)throw Error("Unable to find connection in connectionDB.");this.connections.splice(a,1)}reorderConnection(a,b){this.bulkCounter===0&&(this.removeConnection(a,a.y),this.addConnection(a,b))}getNeighbours(a,
|
|
1216
1215
|
b){function c(z){var F=e-d[z].x,J=f-d[z].y;Math.sqrt(F*F+J*J)<=b&&m.push(d[z]);return J<b}var d=this.connections,e=a.x,f=a.y;a=0;for(var g=d.length-2,h=g;a<h;)d[h].y<f?a=h:g=h,h=Math.floor((a+g)/2);var m=[];g=a=h;if(d.length){for(;a>=0&&c(a);)a--;do g++;while(g<d.length&&c(g))}return m}isInYRange(a,b,c){return Math.abs(this.connections[a].y-b)<=c}searchForClosest(a,b,c){if(!this.connections.length)return{connection:null,radius:b};var d=a.y,e=a.x;a.x=e+c.x;a.y=d+c.y;var f=this.calculateIndexForYPos(a.y);
|
|
1217
1216
|
c=null;for(var g=b,h,m=f-1;m>=0&&this.isInYRange(m,a.y,b);)h=this.connections[m],this.connectionChecker.canConnect(a,h,!0,g)&&(c=h,g=h.distanceFrom(a)),m--;for(;f<this.connections.length&&this.isInYRange(f,a.y,b);)h=this.connections[f],this.connectionChecker.canConnect(a,h,!0,g)&&(c=h,g=h.distanceFrom(a)),f++;a.x=e;a.y=d;return{connection:c,radius:g}}beginBulkUpdates(){this.bulkCounter++}endBulkUpdates(){if(this.bulkCounter===0)throw Error("Bulk updates are already ended.");this.bulkCounter--;this.bulkCounter===
|
|
@@ -1236,7 +1235,7 @@ requestAnimationFrame(()=>{var b=a.parentElement;if(b)for(;a.nextSibling;)b.inse
|
|
|
1236
1235
|
var b=this.targetBlock();if(b){let c;b.isCollapsed()?(c=[],b.outputConnection&&c.push(b.outputConnection),b.nextConnection&&c.push(b.nextConnection),b.previousConnection&&c.push(b.previousConnection)):c=b.getConnections_(!0);for(let d=0;d<c.length;d++)a.push(...c[d].startTrackingAll());a.length||(a=[b])}return a}onFailedConnect(a){var b=this.getSourceBlock();if($.Qc){let c=$.gd;setTimeout(function(){b.isDisposed()||b.getParent()||($.B(c),this.bumpAwayFrom(a),$.B(!1))}.bind(this),$.Og.bumpDelay)}}disconnectInternal(a=
|
|
1237
1236
|
!0){var {parentConnection:b,childConnection:c}=this.getParentAndChildConnections();if(b&&c){var d=$.gd;d||$.B(!0);var e=b.getSourceBlock(),f=c.getSourceBlock();super.disconnectInternal(a);e.queueRender();f.updateDisabled();f.queueRender();f.getSvgRoot().style.display="block";$.B(d)}}respawnShadow_(){super.respawnShadow_();var a=this.targetBlock();a&&(a.initSvg(),a.queueRender())}neighbours(a){return this.dbOpposite.getNeighbours(this,a)}connect_(a){super.connect_(a);var b=this.getSourceBlock();a=
|
|
1238
1237
|
a.getSourceBlock();b.updateDisabled();a.updateDisabled();a.queueRender();if(b=b.getInputWithBlock(a))b=b.isVisible(),a.getSvgRoot().style.display=b?"block":"none"}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()}setCheck(a){super.setCheck(a);this.sourceBlock_.queueRender();return this}showContextMenu(a){var b=dk.registry.getContextMenuOptions({focusedNode:this},
|
|
1239
|
-
a);if(b.length){var c=this.getSourceBlock(),d=c.workspace;if(a instanceof PointerEvent)var e=new D(a.clientX,a.clientY);else e=new D(this.x,this.y),e=
|
|
1238
|
+
a);if(b.length){var c=this.getSourceBlock(),d=c.workspace;if(a instanceof PointerEvent)var e=new D(a.clientX,a.clientY);else e=new D(this.x,this.y),e=qc(d,e).translate(c.RTL?-5:5,5);Hg(a,b,c.RTL,d,e)}}getFocusableElement(){var a=this.findHighlightSvg();if(a)return a;throw Error("No highlight SVG found corresponding to this connection.");}getFocusableTree(){return this.getSourceBlock().workspace}onNodeFocus(){this.highlight();var a=this.getSourceBlock();a.workspace.isFlyout||a.moveSvgRootToFront();
|
|
1240
1239
|
a.workspace.scrollBoundsIntoView(a.getBoundingRectangleWithoutChildren())}onNodeBlur(){this.unhighlight()}canBeFocused(){return this.findHighlightSvg()!==null}findHighlightSvg(){return this.getSourceBlock().getSvgRoot().querySelector(`#${CSS.escape(this.id)}`)}attachInsertionMarker(a){this.insertionMarker=a}detachInsertionMarker(){this.insertionMarker=void 0}getInsertionMarker(){return this.insertionMarker}},$n=Ri||(Ri={}),ao=$n.TrackedState||($n.TrackedState={});ao[ao.WILL_TRACK=-1]="WILL_TRACK";
|
|
1241
1240
|
ao[ao.UNTRACKED=0]="UNTRACKED";ao[ao.TRACKED=1]="TRACKED";var bo=class{constructor(a,b){this.name=a;this.sourceBlock=b;this.fieldRow=[];this.align=$.Xn.LEFT;this.visible=!0;this.ariaLabelProvider=null;this.type=$.je.CUSTOM;this.connection=null}getSourceBlock(){return this.sourceBlock}appendField(a,b){this.insertFieldAt(this.fieldRow.length,a,b);return this}insertFieldAt(a,b,c){if(a<0||a>this.fieldRow.length)throw Error("index "+a+" out of bounds.");if(!(b||b===""&&c))return a;typeof b==="string"&&(b=$.lh({type:"field_label",text:b}));b.setSourceBlock(this.sourceBlock);
|
|
1242
1241
|
this.sourceBlock.initialized&&this.initField(b);b.name=c;b.setVisible(this.isVisible());b.prefixField&&(a=this.insertFieldAt(a,b.prefixField));this.fieldRow.splice(a,0,b);a++;b.suffixField&&(a=this.insertFieldAt(a,b.suffixField));this.sourceBlock.rendered&&this.sourceBlock.queueRender();return a}removeField(a,b){for(let c=0,d;d=this.fieldRow[c];c++)if(d.name===a)return d.dispose(),this.fieldRow.splice(c,1),this.sourceBlock.rendered&&this.sourceBlock.queueRender(),!0;if(b)return!1;throw Error('Field "'+
|
|
@@ -1292,13 +1291,13 @@ this.targetWorkspace;let b=$.C.KEYBOARD_NAV_FLYOUT_LABEL_HINT.replace("%1",re(K.
|
|
|
1292
1291
|
po.NAVIGATE_UP="up";po.NAVIGATE_DOWN="down";po.DISCONNECT="disconnect";po.NEXT_STACK="next_stack";po.PREVIOUS_STACK="previous_stack";po.INFORMATION="information";po.EXTENDED_INFORMATION="extended_information";po.PERFORM_ACTION="perform_action";po.DUPLICATE="duplicate";po.CLEANUP="cleanup";po.SHOW_TOOLTIP="show_tooltip";po.NEXT_HEADING="next_heading";po.PREVIOUS_HEADING="previous_heading";po.TOGGLE_SCREENREADER="toggle_screenreader";po.JUMP_TOP_STACK="jump_to_top_of_stack";po.JUMP_BOTTOM_STACK="jump_to_bottom_of_stack";
|
|
1293
1292
|
po.JUMP_BLOCK_START="jump_to_block_start";po.JUMP_BLOCK_END="jump_to_block_end";po.JUMP_FIRST_BLOCK="jump_to_first_block";po.JUMP_LAST_BLOCK="jump_to_last_block";po.JUMP_PREVIOUS_PAGE="jump_to_previous_page";po.JUMP_NEXT_PAGE="jump_to_next_page";po.SCROLL_LEFT="scroll_left";po.SCROLL_RIGHT="scroll_right";po.SCROLL_UP="scroll_up";po.SCROLL_DOWN="scroll_down";
|
|
1294
1293
|
var ui=x.registry.createSerializedKey(L.LEFT,[L.CTRL_CMD]),vi=x.registry.createSerializedKey(L.RIGHT,[L.CTRL_CMD]),wi=x.registry.createSerializedKey(L.UP,[L.CTRL_CMD]),xi=x.registry.createSerializedKey(L.DOWN,[L.CTRL_CMD]),Bi=a=>{if(a.isFlyout){let c=a.targetWorkspace;if(c)return Bi(c)}var b;return(b=a.getRootWorkspace())!=null?b:a},Pi=(a,b)=>!a.isFlyout&&!!b.focusedNode&&!a.isDragging()&&!$.t().ephemeralFocusTaken()&&!!a.getNavigator().getSourceBlockFromNode(b.focusedNode),aj=a=>(a=a.getToolbox())&&
|
|
1295
|
-
$.t().getFocusedTree()===a?a:null,Vi=a=>{var b,c=(b=aj(a))!=null?b:a.isFlyout&&$.t().getFocusedTree()===a?a:null;return c?c.getNavigator().getNavigableItems(c.getRootFocusableNode()):null},
|
|
1294
|
+
$.t().getFocusedTree()===a?a:null,Vi=a=>{var b,c=(b=aj(a))!=null?b:a.isFlyout&&$.t().getFocusedTree()===a?a:null;return c?c.getNavigator().getNavigableItems(c.getRootFocusableNode()):null},cj=a=>{var b;if(b=!a.isDragging()&&!$.t().ephemeralFocusTaken())(b=!!aj(a))||(b=a.isFlyout&&$.t().getFocusedTree()===a);return b},ij,qo=ij||(ij={});qo[qo.LEFT=0]="LEFT";qo[qo.RIGHT=1]="RIGHT";qo[qo.UP=2]="UP";qo[qo.DOWN=3]="DOWN";
|
|
1296
1295
|
var ro={[ij.LEFT]:"ANNOUNCE_SCROLLED_LEFT",[ij.RIGHT]:"ANNOUNCE_SCROLLED_RIGHT",[ij.UP]:"ANNOUNCE_SCROLLED_UP",[ij.DOWN]:"ANNOUNCE_SCROLLED_DOWN"},gj=a=>{var b;return!a.isDragging()&&a.isMovable()&&!((b=a.targetWorkspace)==null?0:b.isMutator)&&!si.mover.isMoving()&&!ff&&!og},so=a=>{a.getAudioManager().playErrorBeep();Ja($.C.ANNOUNCE_CANT_SCROLL_FURTHER)},hj=(a,b,c)=>{b.preventDefault();if(c===ij.LEFT||c===ij.RIGHT?!a.isMovableHorizontally():!a.isMovableVertically())return so(a),!0;var d=b=0;switch(c){case ij.LEFT:b=
|
|
1297
1296
|
50;break;case ij.RIGHT:b=-50;break;case ij.UP:d=50;break;case ij.DOWN:d=-50}var e=a.scrollX,f=a.scrollY;a.scroll(e+b,f+d);if(a.scrollX===e&&a.scrollY===f)return so(a),!0;Ja($.C[ro[c]]);return!0};kj();lj();mj();var to={};to.names=K;to.registerArrowNavigation=Ai;to.registerCleanup=Mi;to.registerCopy=ni;to.registerCut=oi;to.registerDefaultShortcuts=kj;to.registerDelete=ki;to.registerDisconnectBlock=Gi;to.registerDuplicate=Li;to.registerEscape=ii;to.registerFocusToolbox=Di;to.registerFocusWorkspace=Ci;
|
|
1298
1297
|
to.registerHeadingNavigation=Ji;to.registerJumpBlockEnd=Si;to.registerJumpBlockStart=Qi;to.registerJumpBottomStack=Ui;to.registerJumpFirstBlock=Wi;to.registerJumpLastBlock=Xi;to.registerJumpNextPage=fj;to.registerJumpPreviousPage=ej;to.registerJumpTopStack=Ti;to.registerKeyboardNavigationShortcuts=lj;to.registerMovementShortcuts=yi;to.registerNavigationShortcuts=function(){Qi();Si();Ti();Ui();Wi();Xi();ej();fj();jj()};to.registerPaste=pi;to.registerPerformAction=Ki;
|
|
1299
1298
|
to.registerReadExtendedInformation=Fi;to.registerReadInformation=Ei;to.registerRedo=ri;to.registerScreenReaderShortcuts=mj;to.registerShowContextMenu=zi;to.registerShowTooltip=Ni;to.registerStackNavigation=Hi;to.registerToggleScreenreaderMode=Oi;to.registerUndo=qi;to.registerWorkspaceScrollShortcuts=jj;var uo,vo=uo||(uo={});vo[vo.CONSTRAINED=1]="CONSTRAINED";vo[vo.UNCONSTRAINED=2]="UNCONSTRAINED";
|
|
1300
1299
|
var wo=class{constructor(a){this.block=a;this.connectionPreviewer=this.connectionCandidate=this.startLoc=this.startChildConn=this.startParentConn=null;this.dragging=!1;this.allConnectionPairs=[];this.moveMode=uo.UNCONSTRAINED;this.originalEventGroup="";this.lastAnnouncedNeighbour=this.lastAnnouncedLocal=void 0;this.lastBlockDisabledReasons=new Map;this.WORKSPACE_MARGIN=this.BLOCK_CONNECTION_OFFSET=10;this.workspace=a.workspace}isMovable(){var a;return this.block.isOwnMovable()&&!this.block.isDeadOrDying()&&
|
|
1301
|
-
!this.workspace.isReadOnly()&&(!this.block.isInFlyout||this.block.isEnabled()&&!((a=this.block.workspace.targetWorkspace)==null?0:a.isReadOnly()))}positionNewBlock(a,b){a=
|
|
1300
|
+
!this.workspace.isReadOnly()&&(!this.block.isInFlyout||this.block.isEnabled()&&!((a=this.block.workspace.targetWorkspace)==null?0:a.isReadOnly()))}positionNewBlock(a,b){a=qc(a.workspace,a.getRelativeToSurfaceXY());a=pc(b.workspace,a);b.moveDuringDrag(a);if(this.moveMode===uo.CONSTRAINED){a=b.workspace;var c=a.getMetricsManager().getViewMetrics(!0),d=c.top+this.WORKSPACE_MARGIN,e=a.RTL?c.left+c.width-this.WORKSPACE_MARGIN:c.left+this.WORKSPACE_MARGIN,f=Math.max($.Og.connectingSnapRadius,$.Og.snapRadius)+
|
|
1302
1301
|
2,g=a.getTopBlocks(!0).filter(ja=>ja.id!==b.id).map(ja=>{ja=ja.getBoundingRectangle();return new cc(ja.top-f,ja.bottom+f,ja.left-f,ja.right+f)}),h=b.getHeightWidth().width,m=function(ja){for(let Xa of g)if(ja.intersects(Xa))return Xa;return null},z=e,F=a.getRenderer().getConstants().MIN_BLOCK_HEIGHT,J=b.getBoundingRectangle();b.moveBy(a.RTL?z-J.right:z-J.left,d-J.top,["cleanup"]);J=b.getBoundingRectangle();for(var V=m(J);V!=null;)z=a.RTL?V.left-80:V.right+80,V=V.top+V.getHeight()+F,(a.RTL?z-h>=c.left:
|
|
1303
1302
|
z+h<=c.left+c.width)||(d=V,z=e),b.moveBy(a.RTL?z-J.right:z-J.left,d-J.top,["cleanup"]),J=b.getBoundingRectangle(),V=m(J)}}getTargetBlock(){if(this.block.isShadow()){var a=this.block.getParent();if(a)return a}else if(this.block.isInFlyout&&this.block.workspace.targetWorkspace&&(a=this.block.getRootBlock(),a=ce(a)))return a=de(a,this.block.workspace.targetWorkspace,{recordUndo:!0}),$.Qc=!1,a.render(),this.positionNewBlock(this.block,a),a.setDragging(!0),$.Qc=!0,a;return this.block}announceMove(a=!1){if(this.connectionCandidate)a=
|
|
1304
1303
|
Me(this.connectionCandidate.local,this.connectionCandidate.neighbour,this.hasMultipleCompatibleConnections.bind(this),a);else{var b=a?this.block.getStackBlocksCountLabel():"";a=$.C.ANNOUNCE_MOVE_WORKSPACE;a=a.replace("%1",b)}var c,d;b=(d=(c=this.connectionCandidate)==null?void 0:c.local)!=null?d:null;var e,f;c=(f=(e=this.connectionCandidate)==null?void 0:e.neighbour)!=null?f:null;if(this.lastAnnouncedLocal===void 0||b!==this.lastAnnouncedLocal||c!==this.lastAnnouncedNeighbour)this.lastAnnouncedLocal=
|
|
@@ -1329,8 +1328,8 @@ this.allConnectionPairs.find(g=>g.neighbour.getSourceBlock()===f))return this.pa
|
|
|
1329
1328
|
$.Qc;$.Qc=!1;a.getDescendants(!1).forEach(c=>{var d;(d=this.lastBlockDisabledReasons.get(c.id))==null||d.forEach(e=>{c.setDisabledReason(!0,e)})});$.Qc=b}};var xo=class extends rg{isLabelField(){return!0}constructor(a,b,c){super(rg.SKIP_SETUP);this.class=null;this.EDITABLE=!1;this.maxDisplayLength=Infinity;a!==rg.SKIP_SETUP&&(c?this.configure_(c):this.class=b||null,this.setValue(a))}configure_(a){super.configure_(a);a.class&&(this.class=a.class)}initView(){this.createTextElement_();this.class&&n(this.getTextElement(),this.class);this.fieldGroup_&&(n(this.fieldGroup_,"blocklyLabelField"),l(this.fieldGroup_,p.HIDDEN,!0))}computeAriaLabel(a=!0){a=a?this.getAriaTypeName():
|
|
1330
1329
|
null;var b,c=(b=this.getAriaValue())!=null?b:"";return a?`${a}: ${c}`:c}doClassValidation_(a){return a===null||a===void 0?null:`${a}`}setClass(a){this.textElement_&&(this.class&&Ma(this.textElement_,this.class),a&&n(this.textElement_,a));this.class=a}static fromJson(a){return new this(hg(a.text),void 0,a)}};jh("field_label",xo);xo.prototype.DEFAULT_VALUE="";var yo=class extends Ln{constructor(a,b,c,d,e){super(b,c,d,void 0,e);this.text=a;this.workspace=b;this.anchor=c;this.ownerRect=d;this.owner=e;this.paragraph=this.stringToSvg(a,this.contentContainer);this.updateBubbleSize();n(this.svgRoot,"blocklyTextBubble")}getText(){return this.text}setText(a){this.text=a;Oa(this.paragraph);this.paragraph=this.stringToSvg(a,this.contentContainer);this.updateBubbleSize()}stringToSvg(a,b){b=this.createParagraph(b);a=this.createTextFragments(b,a);this.workspace.RTL&&
|
|
1331
1330
|
this.rightAlignTextFragments(b.getBBox().width,a);return b}createParagraph(a){return r(q.G,{"class":"blocklyText blocklyBubbleText blocklyNoPointerEvents",transform:`translate(0,${Ln.BORDER_WIDTH})`,style:`direction: ${this.workspace.RTL?"rtl":"ltr"}`},a)}createTextFragments(a,b){var c=1;return b.split("\n").map(d=>{var e=r(q.TEXT,{y:`${c}em`,x:Ln.BORDER_WIDTH},a);d=document.createTextNode(d);e.appendChild(d);c+=1;return e})}rightAlignTextFragments(a,b){for(let c of b)c.setAttribute("text-anchor",
|
|
1332
|
-
"start"),c.setAttribute("x",`${a+Ln.BORDER_WIDTH}`)}updateBubbleSize(){var a=this.paragraph.getBBox();this.setSize(new
|
|
1333
|
-
var a;(a=this.textBubble)==null||a.dispose()}getWeight(){return zo.WEIGHT}getSize(){return new
|
|
1331
|
+
"start"),c.setAttribute("x",`${a+Ln.BORDER_WIDTH}`)}updateBubbleSize(){var a=this.paragraph.getBBox();this.setSize(new ic(a.width+Ln.BORDER_WIDTH*2,a.height+Ln.BORDER_WIDTH*2),!0)}};var zo=class extends Nn{constructor(a){super(a);this.sourceBlock=a;this.textMap=new Map;this.textBubble=null}getType(){return zo.TYPE}initView(a){this.svgRoot||(super.initView(a),r(q.PATH,{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},this.svgRoot),r(q.PATH,{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),r(q.RECT,{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),n(this.svgRoot,"blocklyWarningIcon"))}dispose(){super.dispose();
|
|
1332
|
+
var a;(a=this.textBubble)==null||a.dispose()}getWeight(){return zo.WEIGHT}getSize(){return new ic(17,17)}applyColour(){super.applyColour();var a;(a=this.textBubble)==null||a.setColour(this.sourceBlock.getColour())}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(a){super.onLocationChange(a);var b;(b=this.textBubble)==null||b.setAnchorLocation(this.getAnchorLocation())}addMessage(a,b){if(this.textMap.get(b)===a)return this;a?this.textMap.set(b,a):this.textMap.delete(b);var c;(c=
|
|
1334
1333
|
this.textBubble)==null||c.setText(this.getText());return this}getText(){return[...this.textMap.values()].join("\n")}onClick(){super.onClick();this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(a){var b=this;return(0,M.asyncExecutePromiseGeneratorFunction)(function*(){if(b.bubbleIsVisible()!==a){yield cd();if(a)b.textBubble=new yo(b.getText(),b.sourceBlock.workspace,b.getAnchorLocation(),b.getBubbleOwnerRect(),b),
|
|
1335
1334
|
b.applyColour(),b.textBubble.setAriaLabelProvider(()=>$.C.BUBBLE_LABEL_WARNING.replace("%1",b.getText()));else{let c;(c=b.textBubble)==null||c.dispose();b.textBubble=null}w(new (u(v.BUBBLE_OPEN))(b.sourceBlock,a,"warning"));b.recomputeAriaContext()}})}getBubble(){return this.textBubble}getAnchorLocation(){return D.sum(this.workspaceLocation,new D(8.5,8.5))}getBubbleOwnerRect(){var a=this.sourceBlock.getSvgRoot().getBBox();return new cc(a.y,a.y+a.height,a.x,a.x+a.width)}getAriaLabel(){return this.bubbleIsVisible()?
|
|
1336
1335
|
$.C.ICON_LABEL_WARNING_OPEN:$.C.ICON_LABEL_WARNING_CLOSED}};zo.TYPE=Zg.WARNING;zo.WEIGHT=2;var ji=class extends ho{constructor(a,b,c){super(a,b,c);this.childlessWidth=this.width=this.height=0;this.warningTextDb=new Map;this.mutator=null;this.rendered=!0;this.visuallyDisabled=!1;this.previousConnection=this.nextConnection=this.outputConnection=null;this.translation="";this.dragging=!1;this.relativeCoords=new D(0,0);this.dragStrategy=new wo(this);if(!a.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=a;this.svgGroup=r(q.G,{});b&&n(this.svgGroup,
|
|
@@ -1342,7 +1341,7 @@ this.moveBy(a.x-c.x,a.y-c.y,b)}moveDuringDrag(a){this.translate(a.x,a.y);this.up
|
|
|
1342
1341
|
width:this.childlessWidth})}getBoundingRectangleWithDimensions(a){var b=this.getRelativeToSurfaceXY();if(this.RTL){var c=b.x-a.width;var d=b.x}else c=b.x,d=b.x+a.width;return new cc(b.y,b.y+a.height,c,d)}markDirty(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(let a=0,b;b=this.inputList[a];a++)b.markDirty()}setCollapsed(a){this.collapsed_!==a&&(super.setCollapsed(a),this.updateCollapsed())}childHasWarning(){var a=this.getNextBlock();a=a?new Set(a.getDescendants(!1)):null;
|
|
1343
1342
|
var b=this.getDescendants(!1);for(let c of b)if(c!==this&&(a==null||!a.has(c))&&c.getIcon(zo.TYPE))return!0;return!1}updateCollapsed(){var a=this.isCollapsed();for(let c=0,d;d=this.inputList[c];c++)d.name!=="_TEMP_COLLAPSED_INPUT"&&d.setVisible(!a);for(var b of this.getIcons())b.updateCollapsed();a?(n(this.svgGroup,"blocklyCollapsed"),this.childHasWarning()&&this.setWarningText($.C.COLLAPSED_WARNINGS_WARNING,ji.COLLAPSED_WARNING_ID),a=this.toString(30),(b=this.getField("_TEMP_COLLAPSED_FIELD"))?b.setValue(a):
|
|
1344
1343
|
((this.getInput("_TEMP_COLLAPSED_INPUT")||this.appendDummyInput("_TEMP_COLLAPSED_INPUT")).appendField(new xo(a),"_TEMP_COLLAPSED_FIELD"),this.recomputeAriaContext())):(this.updateDisabled(),this.removeInput("_TEMP_COLLAPSED_INPUT"),Ma(this.svgGroup,"blocklyCollapsed"),this.setWarningText(null,ji.COLLAPSED_WARNING_ID))}onMouseDown(a){if(!this.workspace.isReadOnly()){var b=this.workspace.getGesture(a);b&&b.handleBlockStart(a,this)}}showHelp(){var a=typeof this.helpUrl==="function"?this.helpUrl():this.helpUrl;
|
|
1345
|
-
a&&window.open(a)}generateContextMenu(a){if(this.workspace.isReadOnly()||!this.contextMenu)return null;a=dk.registry.getContextMenuOptions({block:this,focusedNode:this},a);this.customContextMenu&&this.customContextMenu(a);return a}calculateContextMenuLocation(a){if(a instanceof PointerEvent)return new D(a.clientX,a.clientY);a=
|
|
1344
|
+
a&&window.open(a)}generateContextMenu(a){if(this.workspace.isReadOnly()||!this.contextMenu)return null;a=dk.registry.getContextMenuOptions({block:this,focusedNode:this},a);this.customContextMenu&&this.customContextMenu(a);return a}calculateContextMenuLocation(a){if(a instanceof PointerEvent)return new D(a.clientX,a.clientY);a=qc(this.workspace,this.getRelativeToSurfaceXY());var b,c,d=(b=this.inputList.filter(e=>e.isVisible()).flatMap(e=>e.fieldRow).find(e=>e.isVisible()))==null?void 0:(c=b.getSvgRoot())==
|
|
1346
1345
|
null?void 0:c.getBoundingClientRect();return new D(this.RTL?a.x-5:a.x+5,(d&&d.height?d.y+d.height:a.y+this.height)+5)}showContextMenu(a){if(this.isShadow()){for(var b=this.getParent();b&&b.isShadow();)b=b.getParent();b&&($.t().focusNode(b),b.showContextMenu(a))}else{b=this.generateContextMenu(a);var c=this.calculateContextMenuLocation(a);b&&b.length&&(Hg(a,b,this.RTL,this.workspace,c),Fg=this)}}updateComponentLocations(a){this.xy.x=a.x;this.xy.y=a.y;this.dragging||this.updateConnectionLocations(a);
|
|
1347
1346
|
this.updateIconLocations(a);this.updateFieldLocations(a);for(let b of this.getChildren(!1))b.updateComponentLocations(D.sum(a,b.relativeCoords))}updateConnectionLocations(a){for(let b of this.getConnections_(!1))b.moveToOffset(a)}updateIconLocations(a){for(let b of this.getIcons())b.onLocationChange(a)}updateFieldLocations(a){for(let b of this.inputList)for(let c of b.fieldRow)c.onLocationChange(a)}addClass(a){n(this.svgGroup,a)}removeClass(a){Ma(this.svgGroup,a)}setDragging(a){(this.dragging=a)?
|
|
1348
1347
|
(this.translation="",nl.push(...this.getConnections_(!0)),this.addClass("blocklyDragging")):(nl.length=0,this.removeClass("blocklyDragging"),this.getFullBlockField()&&this.recomputeAriaContext());for(let b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging(a)}isDragging(){return this.dragging}setMovable(a){super.setMovable(a);this.pathObject.updateMovable(a)}setEditable(a){super.setEditable(a);a?Ma(this.svgGroup,"blocklyNotEditable"):n(this.svgGroup,"blocklyNotEditable");a=this.getIcons();
|
|
@@ -1366,7 +1365,7 @@ b){this.dragStrategy.drag(a,b)}endDrag(a,b){this.dragStrategy.endDrag(a,b)}rever
|
|
|
1366
1365
|
a.getNestingLevel()+1:0}getFocusableElement(){var a=this.getFullBlockField();return a?a.getFocusableElement():this.pathObject.svgPath}getFocusableTree(){return this.workspace}onNodeFocus(){this.recomputeAriaContext();this.select();this.workspace.isFlyout||this.moveSvgRootToFront();var a=$.t().getFocusedNode();a&&a!==this&&cd().then(()=>{this.workspace.scrollBoundsIntoView(this.getBoundingRectangleWithoutChildren())})}onNodeBlur(){this.unselect()}canBeFocused(){return!0}performAction(a){if(this.workspace.isFlyout)si.mover.startMove(this,
|
|
1367
1366
|
a);else{if(this.isSimpleReporter())for(var b of this.inputList)for(let c of b.fieldRow)if(c.isClickable()&&c.isFullBlockField()){c.showEditor();return}if(this.workspace.getNavigator().getInNode(this))a=this.workspace,b=re(a.RTL?K.NAVIGATE_LEFT:K.NAVIGATE_RIGHT),b=$.C.KEYBOARD_NAV_BLOCK_NAVIGATION_HINT.replace("%1",b),mi.show(a,{message:b,id:"blockNavigationHint"});else if(a=this.workspace,b=re("list_shortcuts"))b=$.C.HELP_PROMPT.replace("%1",b),mi.show(a,{message:b,id:"helpHint"})}}getParents(){for(var a=
|
|
1368
1367
|
new Set,b=this.getParent();b;)a.add(b),b=b.getParent();return a}getOutputParents(){var a=new Set;a.add(this);for(var b,c=(b=this.outputConnection)==null?void 0:b.targetBlock();c;){a.add(c);let d;c=(d=c.outputConnection)==null?void 0:d.targetBlock()}return a}getRowId(){var a,b,c=(a=this.outputConnection)==null?void 0:(b=a.targetConnection)==null?void 0:b.getParentInput();return c?c.getRowId():this.id}recomputeAriaContext(){var a=this.getFullBlockField();a?a.recomputeAriaContext():(a=this.getAriaLabel(we.STANDARD),
|
|
1369
|
-
!a||qe||a.endsWith(",")||(a+=","),l(this.getFocusableElement(),p.LABEL,a),ya(this.getSvgRoot(),Ka.NONE),a=this.getFocusableElement(),this.isInFlyout||ya(a,Ka.FIGURE),l(a,p.ROLEDESCRIPTION,this.getAriaRoleDescription()))}getAriaLabel(a){return Ce(this,a)}getStackBlocksCountLabel(){for(var a=1,b=this.getNextBlock();b;)a++,b=b.getNextBlock();return a<=1?Ce(this,we.TERSE):$.C.BLOCK_LABEL_STACK_BLOCKS.replace("%1",a.toString())}};ji.INLINE=-1;ji.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var Ao=class{constructor(){}onDragEnter(){}onDragOver(){}onDragExit(){}onDrop(){}getClientRect(){return null}shouldPreventMove(){return!1}};var Bo=class extends Ao{constructor(){super();this.wouldDelete_=!1}wouldDelete(a){si.mover.isMoving()?this.updateWouldDelete_(!1):a instanceof ji?(a=!a.getParent()&&a.isDeletable(),this.updateWouldDelete_(a)):this.updateWouldDelete_(gi(a)&&a.isDeletable());return this.wouldDelete_}updateWouldDelete_(a){this.wouldDelete_=a}};var Co=class{constructor(a,b){this.element=a;this.type=b}getElement(){return this.element}getType(){return this.type}};var Do=class{constructor(a){this.workspace_=a}getDimensionsPx_(a){var b=0,c=0;a&&(b=a.getWidth(),c=a.getHeight());return new
|
|
1368
|
+
!a||qe||a.endsWith(",")||(a+=","),l(this.getFocusableElement(),p.LABEL,a),ya(this.getSvgRoot(),Ka.NONE),a=this.getFocusableElement(),this.isInFlyout||ya(a,Ka.FIGURE),l(a,p.ROLEDESCRIPTION,this.getAriaRoleDescription()))}getAriaLabel(a){return Ce(this,a)}getStackBlocksCountLabel(){for(var a=1,b=this.getNextBlock();b;)a++,b=b.getNextBlock();return a<=1?Ce(this,we.TERSE):$.C.BLOCK_LABEL_STACK_BLOCKS.replace("%1",a.toString())}};ji.INLINE=-1;ji.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var Ao=class{constructor(){}onDragEnter(){}onDragOver(){}onDragExit(){}onDrop(){}getClientRect(){return null}shouldPreventMove(){return!1}};var Bo=class extends Ao{constructor(){super();this.wouldDelete_=!1}wouldDelete(a){si.mover.isMoving()?this.updateWouldDelete_(!1):a instanceof ji?(a=!a.getParent()&&a.isDeletable(),this.updateWouldDelete_(a)):this.updateWouldDelete_(gi(a)&&a.isDeletable());return this.wouldDelete_}updateWouldDelete_(a){this.wouldDelete_=a}};var Co=class{constructor(a,b){this.element=a;this.type=b}getElement(){return this.element}getType(){return this.type}};var Do=class{constructor(a){this.workspace_=a}getDimensionsPx_(a){var b=0,c=0;a&&(b=a.getWidth(),c=a.getHeight());return new ic(b,c)}getFlyoutMetrics(a){a=this.getDimensionsPx_(this.workspace_.getFlyout(a));return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){var a=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){var a=
|
|
1370
1369
|
0,b=0,c=this.getToolboxMetrics(),d=this.getFlyoutMetrics(),e=!!this.workspace_.getToolbox(),f,g=!((f=this.workspace_.getFlyout())==null?0:f.autoClose);f=e?c.position:d.position;var h=f===E.TOP;f===E.LEFT&&(e&&(a+=c.width),g&&(a+=d.width));h&&(e&&(b+=c.height),g&&(b+=d.height));return{top:b,left:a}}getViewMetrics(a){a=a?this.workspace_.scale:1;var b=this.getSvgMetrics(),c=this.getToolboxMetrics(),d=this.getFlyoutMetrics(),e=!!this.workspace_.getToolbox(),f,g=!((f=this.workspace_.getFlyout())==null?
|
|
1371
1370
|
0:f.autoClose);f=e?c.position:d.position;var h=f===E.LEFT||f===E.RIGHT;if(f===E.TOP||f===E.BOTTOM)e&&(b.height-=c.height),g&&(b.height-=d.height);h&&(e&&(b.width-=c.width),g&&(b.width-=d.width));return{height:b.height/a,width:b.width/a,top:-this.workspace_.scrollY/a,left:-this.workspace_.scrollX/a}}getContentMetrics(a){a=a?1:this.workspace_.scale;var b=this.workspace_.getBlocksBoundingBox();return{height:(b.bottom-b.top)*a,width:(b.right-b.left)*a,top:b.top*a,left:b.left*a}}hasFixedEdges(){return!this.workspace_.isMovableHorizontally()||
|
|
1372
1371
|
!this.workspace_.isMovableVertically()}getComputedFixedEdges_(a){if(!this.hasFixedEdges())return{};var b=this.workspace_.isMovableHorizontally(),c=this.workspace_.isMovableVertically();a=a||this.getViewMetrics(!1);var d={};c||(d.top=a.top,d.bottom=a.top+a.height);b||(d.left=a.left,d.right=a.left+a.width);return d}getPaddedContent_(a,b){var c=b.top+b.height,d=b.left+b.width,e=a.width;a=a.height;var f=e/2,g=a/2;return{top:Math.min(b.top-g,c-a),bottom:Math.max(c+g,b.top+a),left:Math.min(b.left-f,d-e),
|
|
@@ -1401,9 +1400,9 @@ a.getComponentManager().addComponent({component:this,weight:Wk.ComponentWeight.F
|
|
|
1401
1400
|
a;this.targetWorkspace.recordDragTargets();this.targetWorkspace.resizeContents()}autoHide(a){!a&&this.targetWorkspace.getFlyout(!0)===this&&this.autoClose&&this.hide()}getTargetWorkspace(){return this.targetWorkspace}isVisible(){return this.visible}setVisible(a){var b=a!==this.isVisible();this.visible=a;b&&(this.autoClose||this.targetWorkspace.recordDragTargets(),this.updateDisplay())}setContainerVisible(a){var b=a!==this.containerVisible;this.containerVisible=a;b&&this.updateDisplay()}getContents(){return this.contents}setContents(a){this.contents=
|
|
1402
1401
|
a}updateDisplay(){var a=this.containerVisible?this.isVisible():!1;this.svgGroup_&&(this.svgGroup_.style.display=a?"block":"none");var b;(b=this.workspace_.scrollbar)==null||b.setContainerVisible(a)}positionAt_(a,b,c,d){var e;(e=this.svgGroup_)==null||e.setAttribute("width",`${a}`);var f;(f=this.svgGroup_)==null||f.setAttribute("height",`${b}`);this.workspace_.setCachedParentSvgSize(a,b);this.svgGroup_&&Qa(this.svgGroup_,"translate("+c+"px,"+d+"px)");if(a=this.workspace_.scrollbar)a.setOrigin(c,d),
|
|
1403
1402
|
a.resize(),a.hScroll&&a.hScroll.setPosition(a.hScroll.position.x,a.hScroll.position.y),a.vScroll&&a.vScroll.setPosition(a.vScroll.position.x,a.vScroll.position.y)}hide(){this.isVisible()&&(this.setVisible(!1),this.reflowWrapper&&(this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowWrapper=null))}show(a){$.t().getFocusedTree()===this.workspace_&&$.t().getFocusedNode()!==this.workspace_&&$.t().focusNode(this.workspace_);this.workspace_.setResizesEnabled(!1);$.Qc=!1;this.hide();this.clearOldBlocks();
|
|
1404
|
-
typeof a==="string"&&(a=this.getDynamicCategoryContents(a));this.setVisible(!0);a=
|
|
1403
|
+
typeof a==="string"&&(a=this.getDynamicCategoryContents(a));this.setVisible(!0);a=Ec(a);a=this.createFlyoutInfo(a);dd(this.workspace_);this.setContents(a);this.layout_(a);this.horizontalLayout?this.height_=0:this.width_=0;this.reflow();this.updateAriaContext();$.Qc=!0;this.workspace_.setResizesEnabled(!0);this.reflowWrapper=b=>{this.inhibitReflowWrapper||b.type!==v.BLOCK_CHANGE&&b.type!==v.BLOCK_FIELD_INTERMEDIATE_CHANGE||this.reflow()};this.workspace_.addChangeListener(this.reflowWrapper)}updateAriaContext(){var a=
|
|
1405
1404
|
this.getContents().map(c=>c.getElement()).filter(c=>c.canBeFocused()).map(c=>c.getFocusableElement().id);l(this.getWorkspace().getCanvas(),p.OWNS,a.join(" "));this.targetWorkspace.isMutator||this.autoClose?ya(this.getWorkspace().svgGroup_,Ka.NONE):ya(this.getWorkspace().svgGroup_,Ka.REGION);var b=(a=(b=this.targetWorkspace.getToolbox())==null?void 0:b.getSelectedItem())&&ve(a)?a.getName():"";b=$.C.WORKSPACE_LABEL_FLYOUT_WORKSPACE.replace("%1",b).trim();l(this.getWorkspace().getCanvas(),p.LABEL,b);
|
|
1406
|
-
ya(this.getWorkspace().getCanvas(),Ka.LISTBOX)}createFlyoutInfo(a){var b=[],c=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(let d of a)if("custom"in d&&(a=this.getDynamicCategoryContents(d.custom),a=
|
|
1405
|
+
ya(this.getWorkspace().getCanvas(),Ka.LISTBOX)}createFlyoutInfo(a){var b=[],c=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(let d of a)if("custom"in d&&(a=this.getDynamicCategoryContents(d.custom),a=Ec(a),b.push(...this.createFlyoutInfo(a))),a=d.kind.toLowerCase(),a=this.getInflaterForType(a))b.push(a.load(d,this)),(a=a.gapForItem(d,c))&&b.push(new Co(new Fo(a,this.horizontalLayout?"x":"y"),"sep"));return this.normalizeSeparators(b)}normalizeSeparators(a){for(let b=a.length-1;b>0;b--){let c=a[b].getType().toLowerCase(),
|
|
1407
1406
|
d=a[b-1].getType().toLowerCase();c==="sep"&&d==="sep"&&a.splice(b-1,1)}return a}getDynamicCategoryContents(a){a=this.workspace_.targetWorkspace.getToolboxCategoryCallback(a);if(typeof a!=="function")throw TypeError("Couldn't find a callback function when opening a toolbox category.");return a(this.workspace_.targetWorkspace)}clearOldBlocks(){this.getContents().forEach(b=>{var c;(c=this.getInflaterForType(b.getType()))==null||c.disposeItem(b)});var a;(a=this.workspace_.getPotentialVariableMap())==
|
|
1408
1407
|
null||a.clear()}onMouseDown(a){var b=this.targetWorkspace.getGesture(a);b&&b.handleFlyoutStart(a,this)}reflow(){this.inhibitReflowWrapper=!0;this.reflowInternal_();this.inhibitReflowWrapper=!1}isScrollable(){return this.workspace_.scrollbar?this.workspace_.scrollbar.isVisible():!1}getInflaterForType(a){if(this.inflaters.has(a)){var b;return(b=this.inflaters.get(a))!=null?b:null}return(b=Fb(y.FLYOUT_INFLATER,a,void 0))?(b=new b,this.inflaters.set(a,b),b):null}};var $o=class{constructor(a){this.workspace=a;this.horizontalScrollEnabled=this.workspace.isMovableHorizontally();this.verticalScrollEnabled=this.workspace.isMovableVertically();this.startScrollXY_=new D(a.scrollX,a.scrollY)}startDrag(){}endDrag(a){this.drag(a)}drag(a){a=D.sum(this.startScrollXY_,a);if(this.horizontalScrollEnabled&&this.verticalScrollEnabled)this.workspace.scroll(a.x,a.y);else if(this.horizontalScrollEnabled)this.workspace.scroll(a.x,this.workspace.scrollY);else if(this.verticalScrollEnabled)this.workspace.scroll(this.workspace.scrollX,
|
|
1409
1408
|
a.y);else throw new TypeError("Invalid state.");}};var ap=class{constructor(a,b){this.creatorWorkspace=b;this.mouseDownXY=new D(0,0);this.startWorkspace_=this.targetBlock=this.startComment=this.startBlock=this.startIcon=this.startField=this.startBubble=null;this.hasExceededDragRadius=!1;this.boundEvents=[];this.workspaceDragger=this.dragger=null;this.dragging=!1;this.flyout=null;this.multiTouch=this.isEnding_=this.gestureHasStarted=this.calledUpdateIsDragging=!1;this.cachedPoints=new Map;this.startDistance=this.previousScale=0;this.currentDropdownOwner=
|
|
@@ -1420,8 +1419,8 @@ b=b>0?b*5:b*6;if(!this.startWorkspace_)throw Error("Cannot handle a pinch becaus
|
|
|
1420
1419
|
if(this.dragger)this.dragger.onDragEnd(this.mostRecentEvent,this.currentDragDeltaXY);else this.workspaceDragger&&this.workspaceDragger.endDrag(this.currentDragDeltaXY);this.dispose()}}handleRightClick(a){var b=$.t().getFocusedNode();if(b&&typeof b.showContextMenu==="function"){let c;(c=this.startWorkspace_)==null||c.hideChaff(!!this.flyout);b.showContextMenu(a)}a.preventDefault();a.stopPropagation();Nd.setIsActive(!1);this.dispose()}handleWsStart(a,b){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");
|
|
1421
1420
|
this.setStartWorkspace(b);this.mostRecentEvent=a;this.targetBlock||this.startBubble||this.startComment||this.startIcon||$.t().focusNode(b);this.doStart(a)}fireWorkspaceClick(a){w(new (u(v.CLICK))(null,a.id,"workspace"))}handleFlyoutStart(a,b){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout(b);this.handleWsStart(a,b.getWorkspace())}handleBlockStart(a,b){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");
|
|
1422
1421
|
this.setStartBlock(b);this.mostRecentEvent=a}handleBubbleStart(a,b){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(b);this.mostRecentEvent=a}handleCommentStart(a,b){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleCommentStart, but the gesture had already been started.");this.setStartComment(b);this.mostRecentEvent=a}doFieldClick(){if(!this.startField)throw Error("Cannot do a field click because the start field is undefined");
|
|
1423
|
-
this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent)}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.startIcon.onClick()}doBlockClick(){if(this.flyout&&this.flyout.autoClose){if(!this.targetBlock)throw Error("Cannot do a block click because the target block is undefined");var a=ce(this.targetBlock);let c=this.flyout.targetWorkspace;if(a&&c){var b=
|
|
1424
|
-
b=
|
|
1422
|
+
this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent)}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.startIcon.onClick()}doBlockClick(){if(this.flyout&&this.flyout.autoClose){if(!this.targetBlock)throw Error("Cannot do a block click because the target block is undefined");var a=ce(this.targetBlock);let c=this.flyout.targetWorkspace;if(a&&c){var b=qc(this.flyout.getWorkspace(),this.targetBlock.getRelativeToSurfaceXY());
|
|
1423
|
+
b=pc(c,b);a.x=b.x;a.y=b.y;de(a,c,{recordUndo:!0});c.hideChaff(!1)}}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");a=new (u(v.CLICK))(this.startBlock,this.startWorkspace_.id,"block");w(a)}$.B(!1)}doWorkspaceClick(){this.fireWorkspaceClick(this.startWorkspace_||this.creatorWorkspace)}setStartField(a){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField||(this.startField=
|
|
1425
1424
|
a)}setStartIcon(a){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartIcon, but the gesture had already been started.");this.startIcon||(this.startIcon=a)}setStartBubble(a){this.startBubble||(this.startBubble=a)}setStartComment(a){this.startComment||(this.startComment=a)}setStartBlock(a){var b,c,d;this.startBlock||this.startBubble||this.startIcon&&(!a.isInFlyout||((d=(c=this.startIcon).isClickableInFlyout)==null?0:d.call(c,!((b=a.workspace.getFlyout())==null||!b.autoClose))))||(this.startBlock=
|
|
1426
1425
|
a,a.isInFlyout&&a!==a.getRootBlock()?this.setTargetBlock(a.getRootBlock()):this.setTargetBlock(a))}setTargetBlock(a){a.isShadow()?this.setTargetBlock(a.getParent()):(this.targetBlock=a,this.targetBlock.bringToFront(),$.t().focusNode(this.targetBlock))}setStartWorkspace(a){this.startWorkspace_||(this.startWorkspace_=a)}setStartFlyout(a){this.flyout||(this.flyout=a)}isBubbleClick(){return!!this.startBubble&&!this.hasExceededDragRadius}isCommentClick(){return!!this.startComment&&!this.hasExceededDragRadius}isBlockClick(){return!!this.startBlock&&
|
|
1427
1426
|
!this.hasExceededDragRadius&&!this.isFieldClick()&&!this.isIconClick()}isFieldClick(){return this.startField?this.startField.isClickable()&&!this.hasExceededDragRadius&&(!this.flyout||this.startField.isClickableInFlyout(this.flyout.autoClose)):!1}isIconClick(){if(!this.startIcon)return!1;var a=!this.flyout||!this.startIcon.isClickableInFlyout||this.startIcon.isClickableInFlyout(this.flyout.autoClose);return!this.hasExceededDragRadius&&a}isWorkspaceClick(){return!this.startBlock&&!this.startBubble&&
|
|
@@ -1431,11 +1430,11 @@ a;var b=this.spacing*a;this.pattern.setAttribute("width",`${b}`);this.pattern.se
|
|
|
1431
1430
|
`url(#${a.id})`);return a}};var bp=class{constructor(a){this.workspace=a;this.layers=new Map;if(a=a.getInjectionDiv())this.dragLayer=this.createDragLayer(a),this.animationLayer=this.createAnimationLayer(a);a=this.createLayer(50);n(a,"blocklyBlockCanvas");a=this.createLayer(100);n(a,"blocklyBubbleCanvas")}createDragLayer(a){var b=r(q.SVG,{"class":"blocklyBlockDragSurface",xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});a.append(b);return r(q.G,
|
|
1432
1431
|
{},b)}createAnimationLayer(a){var b=r(q.SVG,{"class":"blocklyAnimationLayer",xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});a.append(b);return r(q.G,{},b)}appendToAnimationLayer(a){var b,c=(b=this.dragLayer)==null?void 0:b.getAttribute("transform");if(c){let e;(e=this.animationLayer)==null||e.setAttribute("transform",c)}var d;(d=this.animationLayer)==null||d.appendChild(a.getSvgRoot())}translateLayers(a,b){a=
|
|
1433
1432
|
`translate(${a.x}, ${a.y}) scale(${b})`;var c;(c=this.dragLayer)==null||c.setAttribute("transform",a);for(let [,d]of this.layers)d.setAttribute("transform",a)}moveToDragLayer(a,b=!0){var c;(c=this.dragLayer)==null||c.appendChild(a.getSvgRoot());b&&a.canBeFocused()&&$.t().focusNode(a)}moveOffDragLayer(a,b,c=!0){this.append(a,b);c&&a.canBeFocused()&&$.t().focusNode(a)}append(a,b){this.layers.has(b)||this.createLayer(b);a=a.getSvgRoot();var c;if(((c=this.layers.get(b))==null?void 0:c.lastChild)!==a){let d;
|
|
1434
|
-
(d=this.layers.get(b))==null||d.appendChild(a)}}createLayer(a){var b=this.workspace.getSvgGroup(),c=r(q.G,{}),d=!1,e=[...this.layers].sort((f,g)=>f[0]-g[0]);for(let [f,g]of e)if(a<f){b.insertBefore(c,g);d=!0;break}d||b.appendChild(c);this.layers.set(a,c);return c}hasLayer(a){return a===this.dragLayer||(new Set(this.layers.values())).has(a)}getBlockLayer(){return this.layers.get(50)}getBubbleLayer(){return this.layers.get(100)}getDragLayer(){return this.dragLayer}};var cp={};cp.register=vj;cp.unregister=function(a){Eb(y.ICON,a)};var qk=class extends Nn{constructor(a){super(a);this.sourceBlock=a;this.textInputBubble=null;this.text="";this.bubbleSize=new
|
|
1435
|
-
this.svgRoot),r(q.RECT,{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),n(this.svgRoot,"blocklyCommentIcon"))}dispose(){super.dispose();var a;(a=this.textInputBubble)==null||a.dispose()}getWeight(){return qk.WEIGHT}getSize(){return new
|
|
1433
|
+
(d=this.layers.get(b))==null||d.appendChild(a)}}createLayer(a){var b=this.workspace.getSvgGroup(),c=r(q.G,{}),d=!1,e=[...this.layers].sort((f,g)=>f[0]-g[0]);for(let [f,g]of e)if(a<f){b.insertBefore(c,g);d=!0;break}d||b.appendChild(c);this.layers.set(a,c);return c}hasLayer(a){return a===this.dragLayer||(new Set(this.layers.values())).has(a)}getBlockLayer(){return this.layers.get(50)}getBubbleLayer(){return this.layers.get(100)}getDragLayer(){return this.dragLayer}};var cp={};cp.register=vj;cp.unregister=function(a){Eb(y.ICON,a)};var qk=class extends Nn{constructor(a){super(a);this.sourceBlock=a;this.textInputBubble=null;this.text="";this.bubbleSize=new ic(160,80);this.bubbleVisiblity=!1}getType(){return qk.TYPE}initView(a){this.svgRoot||(super.initView(a),r(q.CIRCLE,{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),r(q.PATH,{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},
|
|
1434
|
+
this.svgRoot),r(q.RECT,{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),n(this.svgRoot,"blocklyCommentIcon"))}dispose(){super.dispose();var a;(a=this.textInputBubble)==null||a.dispose()}getWeight(){return qk.WEIGHT}getSize(){return new ic(17,17)}applyColour(){super.applyColour();var a=this.sourceBlock.getColour(),b;(b=this.textInputBubble)==null||b.setColour(a)}updateEditable(){var a=this,b=()=>super.updateEditable;return(0,M.asyncExecutePromiseGeneratorFunction)(function*(){b().call(a);
|
|
1436
1435
|
a.bubbleIsVisible()&&(yield a.setBubbleVisible(!1),yield a.setBubbleVisible(!0))})}onLocationChange(a){var b=this.workspaceLocation;super.onLocationChange(a);this.bubbleLocation&&(a=D.difference(this.workspaceLocation,b),this.bubbleLocation=D.sum(this.bubbleLocation,a));a=this.getAnchorLocation();var c;(c=this.textInputBubble)==null||c.setAnchorLocation(a)}setText(a){var b=this.text;w(new (u(v.BLOCK_CHANGE))(this.sourceBlock,"comment",null,b,a));this.text=a;var c;(c=this.textInputBubble)==null||c.setText(this.text)}getText(){return this.text}setBubbleSize(a){this.bubbleSize=
|
|
1437
1436
|
a;var b;(b=this.textInputBubble)==null||b.setSize(this.bubbleSize,!0)}getBubbleSize(){return this.bubbleSize}setBubbleLocation(a){this.bubbleLocation=a;var b;(b=this.textInputBubble)==null||b.moveDuringDrag(a)}getBubbleLocation(){return this.bubbleLocation}saveState(){if(this.text){let a={text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width},b=this.getBubbleLocation();b&&(a.x=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(b.x+
|
|
1438
|
-
this.bubbleSize.width):b.x,a.y=b.y);return a}return null}loadState(a){var b;this.text=(b=a.text)!=null?b:"";var c,d;this.bubbleSize=new
|
|
1437
|
+
this.bubbleSize.width):b.x,a.y=b.y);return a}return null}loadState(a){var b;this.text=(b=a.text)!=null?b:"";var c,d;this.bubbleSize=new ic((c=a.width)!=null?c:160,(d=a.height)!=null?d:80);var e;this.bubbleVisiblity=(e=a.pinned)!=null?e:!1;this.setBubbleVisible(this.bubbleVisiblity);var f=a.x,g=a.y;cd().then(()=>{f&&g&&(f=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(f+this.bubbleSize.width):f,this.setBubbleLocation(new D(f,g)))})}onClick(){super.onClick();this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}onTextChange(){if(this.textInputBubble){var a=
|
|
1439
1438
|
this.textInputBubble.getText();this.text!==a&&(w(new (u(v.BLOCK_CHANGE))(this.sourceBlock,"comment",null,this.text,a)),this.text=a)}}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}onBubbleLocationChange(){this.textInputBubble&&(this.bubbleLocation=this.textInputBubble.getRelativeToSurfaceXY())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(a){var b=this;return(0,M.asyncExecutePromiseGeneratorFunction)(function*(){b.bubbleVisiblity!==a&&(b.bubbleVisiblity=
|
|
1440
1439
|
a,yield cd(),!b.sourceBlock.rendered||b.sourceBlock.isInFlyout||b.sourceBlock.isInsertionMarker()||(a?(b.sourceBlock.isEditable()?b.showEditableBubble():b.showNonEditableBubble(),b.applyColour()):b.hideBubble(),w(new (u(v.BUBBLE_OPEN))(b.sourceBlock,a,"comment")),b.svgRoot&&b.recomputeAriaContext()))})}getBubble(){return this.textInputBubble}showEditableBubble(){this.createBubble();var a;(a=this.textInputBubble)==null||a.addTextChangeListener(()=>this.onTextChange());var b;(b=this.textInputBubble)==
|
|
1441
1440
|
null||b.addSizeChangeListener(()=>this.onSizeChange())}showNonEditableBubble(){this.createBubble();var a;(a=this.textInputBubble)==null||a.setEditable(!1)}createBubble(){this.textInputBubble=new Sn(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect(),this);this.textInputBubble.getEditor().setParent(this.sourceBlock);this.textInputBubble.setText(this.getText());this.textInputBubble.setSize(this.bubbleSize,!0);this.bubbleLocation&&this.textInputBubble.moveDuringDrag(this.bubbleLocation);
|
|
@@ -1509,7 +1508,7 @@ c===G.OUTPUT_VALUE?b.outputConnection:b.previousConnection)}render(a){var b=this
|
|
|
1509
1508
|
Np.unregister=function(a){Eb(y.RENDERER,a)};var Op=class{constructor(a,b){this.workspace=a;this.theme=b;this.subscribedWorkspaces=[];this.componentDB=new Map}getTheme(){return this.theme}setTheme(a){var b=this.theme;this.theme=a;if(a=this.workspace.getInjectionDiv())b&&(b=b.getClassName())&&Ma(a,b),(b=this.theme.getClassName())&&n(a,b);for(let c=0,d;d=this.subscribedWorkspaces[c];c++)d.refreshTheme();for(let [c,d]of this.componentDB)for(let e of d){a=e.element;b=e.propertyName;let f=this.theme&&this.theme.getComponentStyle(c);a.style.setProperty(b,
|
|
1510
1509
|
f||"")}for(let c of this.subscribedWorkspaces)c.hideChaff()}subscribeWorkspace(a){this.subscribedWorkspaces.push(a)}unsubscribeWorkspace(a){if(!ra(this.subscribedWorkspaces,a))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");}subscribe(a,b,c){this.componentDB.has(b)||this.componentDB.set(b,[]);this.componentDB.get(b).push({element:a,propertyName:c});b=this.theme&&this.theme.getComponentStyle(b);a.style.setProperty(c,b||"")}unsubscribe(a){if(a)for(let [b,c]of this.componentDB){for(let d=
|
|
1511
1510
|
c.length-1;d>=0;d--)c[d].element===a&&c.splice(d,1);c.length||this.componentDB.delete(b)}}dispose(){this.subscribedWorkspaces.length=0;this.componentDB.clear()}};var Pp={CATEGORY_NAME:"VARIABLE_DYNAMIC"};Pp.flyoutCategory=Rj;
|
|
1512
|
-
Pp.flyoutCategoryBlocks=function(a){a=a.getVariableMap().getAllVariables();var b=[];if(a.length>0){if(zb.variables_set_dynamic){var c=a[a.length-1];let d=$.
|
|
1511
|
+
Pp.flyoutCategoryBlocks=function(a){a=a.getVariableMap().getAllVariables();var b=[];if(a.length>0){if(zb.variables_set_dynamic){var c=a[a.length-1];let d=$.sc("block");d.setAttribute("type","variables_set_dynamic");d.setAttribute("gap","24");d.appendChild(Ud(c));b.push(d)}if(zb.variables_get_dynamic){a.sort(Hd);for(let d=0,e;e=a[d];d++)c=$.sc("block"),c.setAttribute("type","variables_get_dynamic"),c.setAttribute("gap","8"),c.appendChild(Ud(e)),b.push(c)}}return b};
|
|
1513
1512
|
Pp.onCreateVariableButtonClick_Colour=Qj;Pp.onCreateVariableButtonClick_Number=Pj;Pp.onCreateVariableButtonClick_String=Oj;var Qp=class{get isFlyout(){return this.internalIsFlyout}get isMutator(){return this.internalIsMutator}constructor(a){this.isClearing=this.internalIsMutator=this.internalIsFlyout=this.rendered=!1;this.MAX_UNDO=1024;this.connectionDBList=[];this.topBlocks=[];this.topComments=[];this.commentDB=new Map;this.listeners=[];this.undoStack_=[];this.redoStack_=[];this.blockDB=new Map;this.typedBlocksDB=new Map;this.procedureMap=new gp;this.readOnly=!1;this.potentialVariableMap=null;this.id=Nb();jb(this);this.options=
|
|
1514
1513
|
a||new In({});this.RTL=!!this.options.RTL;this.horizontalLayout=!!this.options.horizontalLayout;this.toolboxPosition=this.options.toolboxPosition;this.connectionChecker=new (Jb(y.CONNECTION_CHECKER,this.options,!0))(this);this.variableMap=new (this.getVariableMapClass())(this);this.setIsReadOnly(this.options.readOnly)}dispose(){this.listeners.length=0;this.clear();kb(this)}sortObjects(a,b){var c=d=>({getBoundingRectangle:()=>{var e=d.getRelativeToSurfaceXY();return new cc(e.y,e.y,e.x,e.x)},moveBy:()=>
|
|
1515
1514
|
{}});return this.sortByOrigin(c(a),c(b))}sortByOrigin(a,b){var c=Math.sin(Ne(Qp.SCAN_ANGLE))*(this.RTL?-1:1);a=a.getBoundingRectangle().getOrigin();b=b.getBoundingRectangle().getOrigin();return a.y+c*a.x-(b.y+c*b.x)}addTopBlock(a){this.topBlocks.push(a)}removeTopBlock(a){if(!ra(this.topBlocks,a))throw Error("Block not present in workspace's list of top-most blocks.");}getTopBlocks(a=!1){var b=[].concat(this.topBlocks);a&&b.length>1&&b.sort(this.sortObjects.bind(this));return b}addTypedBlock(a){this.typedBlocksDB.has(a.type)||
|
|
@@ -1524,13 +1523,13 @@ Jb(y.VARIABLE_MAP,this.options,!0);if(!a)throw Error("No variable map is registe
|
|
|
1524
1523
|
b!==0){var d=c.sounds.get(a);if(d){if(yield c.prepareToPlay(),c.context.state==="running"){var e=c.context.createBufferSource(),f=c.context.createGain();f.gain.value=b!=null?b:1;f.connect(c.context.destination);e.buffer=d;e.connect(f);e.addEventListener("ended",()=>{e.disconnect();f.disconnect()});e.start()}}else c.parentWorkspace&&(d=c.parentWorkspace.getAudioManager(),d!==c&&d.play(a,b))}})}beep(a,b=.2){var c=this;return(0,M.asyncExecutePromiseGeneratorFunction)(function*(){if(c.isPlayingAllowed()&&
|
|
1525
1524
|
(yield c.prepareToPlay(),c.context.state==="running")){var d=c.context.createOscillator();d.type="sine";d.frequency.setValueAtTime(a,c.context.currentTime);var e=c.context.createGain();e.gain.setValueAtTime(0,c.context.currentTime);e.gain.linearRampToValueAtTime(.5,c.context.currentTime+.01);e.gain.linearRampToValueAtTime(0,c.context.currentTime+b);d.connect(e);e.connect(c.context.destination);d.start(c.context.currentTime);d.stop(c.context.currentTime+b)}})}playErrorBeep(){var a=this;return(0,M.asyncExecutePromiseGeneratorFunction)(function*(){return a.beep(260)})}maybePlayScopeChangeAudioCue(a){if(Nd.getScopeChangeAudioCuesEnabled()){var b=
|
|
1526
1525
|
this.parentWorkspace.getNavigator(),c=b.getSourceBlockFromNode($.t().getFocusedNode());a=b.getSourceBlockFromNode(a);b=0;c&&a&&c.getNestingLevel()!==(b=a.getNestingLevel())&&this.beep(400+b*60)}}isPlayingAllowed(){var a=new Date;return this.getMuted()||!this.context||this.lastSound!==null&&a.getTime()-this.lastSound.getTime()<100?!1:!0}prepareToPlay(){var a=this;return(0,M.asyncExecutePromiseGeneratorFunction)(function*(){a.lastSound=new Date;a.context.state==="suspended"&&navigator.userActivation.hasBeenActive&&
|
|
1527
|
-
(yield a.context.resume())})}setMuted(a){this.muted=a}getMuted(){return this.muted}};var Sp=class{constructor(a,b){this.workspace=a;this.element=b}getFocusableElement(){return this.element}getFocusableTree(){return this.workspace}onNodeFocus(){this.workspace.handleWorkspaceFocusTargetFocus()}onNodeBlur(){}canBeFocused(){return!0}getWorkspace(){return this.workspace}};var $h=class extends Qp{constructor(a){super(a);this.resizeHandlerWrapper=null;this.resizesEnabled=this.visible=this.rendered=!0;this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0;this.oldScale=this.scale=1;this.oldLeft=this.oldTop=0;this.inverseScreenCTM=this.targetWorkspace=this.dummyWheelListener=this.configureContextMenu=this.lastRecordedPageScroll=this.injectionDiv=this.currentGesture_=this.toolbox=this.flyout=this.scrollbar=this.trashcan=null;this.inverseScreenCTMDirty=!0;this.highlightedBlocks=
|
|
1526
|
+
(yield a.context.resume())})}setMuted(a){this.muted=a}getMuted(){return this.muted}};var Sp=class{constructor(a,b){this.workspace=a;this.element=b}getFocusableElement(){return this.element}getFocusableTree(){return this.workspace}onNodeFocus(){this.workspace.handleWorkspaceFocusTargetFocus()}onNodeBlur(){}canBeFocused(){return!0}getWorkspace(){return this.workspace}showContextMenu(a){this.workspace.showContextMenu(a)}};var $h=class extends Qp{constructor(a){super(a);this.resizeHandlerWrapper=null;this.resizesEnabled=this.visible=this.rendered=!0;this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0;this.oldScale=this.scale=1;this.oldLeft=this.oldTop=0;this.inverseScreenCTM=this.targetWorkspace=this.dummyWheelListener=this.configureContextMenu=this.lastRecordedPageScroll=this.injectionDiv=this.currentGesture_=this.toolbox=this.flyout=this.scrollbar=this.trashcan=null;this.inverseScreenCTMDirty=!0;this.highlightedBlocks=
|
|
1528
1527
|
[];this.toolboxCategoryCallbacks=new Map;this.flyoutButtonCallbacks=new Map;this.cachedParentSvg=null;this.topBoundedElements=[];this.dragTargetAreas=[];this.workspaceFocusTarget=this.workspaceFocusTargetElement=this.workspaceSelectionRing=this.workspaceFocusRing=this.zoomControls_=this.layerManager=null;this.navigator=new Uo;this.metricsManager=new (Jb(y.METRICS_MANAGER,a,!0))(this);this.getMetrics=a.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager);this.setMetrics=a.setMetrics||
|
|
1529
1528
|
$h.setTopLevelWorkspaceMetrics;this.componentManager=new Wk;this.connectionDBList=Tn.init(this.connectionChecker);var b;this.audioManager=new Rp((b=a.parentWorkspace)!=null?b:this);this.grid=this.options.gridPattern?new Vj(this.options.gridPattern,a.gridOptions):null;en&&Fd&&this.registerToolboxCategoryCallback("VARIABLE",Fd);Pp&&Rj&&this.registerToolboxCategoryCallback("VARIABLE_DYNAMIC",Rj);hp&&Fj&&(this.registerToolboxCategoryCallback("PROCEDURE",Fj),this.addChangeListener(Ij));this.addChangeListener(this.variableChangeCallback.bind(this));
|
|
1530
|
-
this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new Op(this,this.options.theme||Hn);this.themeManager_.subscribeWorkspace(this);var c;this.renderer=Nj(this.options.renderer||"geras",this.getTheme(),(c=this.options.rendererOverrides)!=null?c:void 0);this.cachedParentSvgSize=new
|
|
1529
|
+
this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new Op(this,this.options.theme||Hn);this.themeManager_.subscribeWorkspace(this);var c;this.renderer=Nj(this.options.renderer||"geras",this.getTheme(),(c=this.options.rendererOverrides)!=null?c:void 0);this.cachedParentSvgSize=new ic(0,0)}getMetricsManager(){return this.metricsManager}setMetricsManager(a){this.metricsManager=a;this.getMetrics=this.metricsManager.getMetrics.bind(this.metricsManager)}getComponentManager(){return this.componentManager}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(a){a||
|
|
1531
1530
|
(a=Hn);this.themeManager_.setTheme(a)}refreshTheme(){if(this.svgGroup_){var a=this.options.parentWorkspace===null;this.renderer.refreshDom(this.svgGroup_,this.getTheme(),a?this.getInjectionDiv():void 0)}this.updateBlockStyles(this.getAllBlocks(!1).filter(b=>!!b.getStyleName()));this.refreshToolboxSelection();this.toolbox&&this.toolbox.refreshTheme();this.isVisible()&&this.setVisible(!0);a=new (u(v.THEME_CHANGE))(this.getTheme().name,this.id);w(a)}updateBlockStyles(a){for(let b=0,c;c=a[b];b++){let d=
|
|
1532
|
-
c.getStyleName();d&&c.setStyle(d)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){let a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM=a.inverse(),this.inverseScreenCTMDirty=!1)}return this.inverseScreenCTM}updateInverseScreenCTM(){this.inverseScreenCTMDirty=!0}isVisible(){return this.visible}getSvgXY(a){var b=0,c=0,d=1;if(this.getCanvas().contains(a)||this.getBubbleCanvas().contains(a))d=this.scale;do{let e=
|
|
1533
|
-
d;c+=e.y*d;a=a.parentNode}while(a&&a!==this.getParentSvg()&&a!==this.getInjectionDiv());return new D(b,c)}getCachedParentSvgSize(){var a=this.cachedParentSvgSize;return new
|
|
1531
|
+
c.getStyleName();d&&c.setStyle(d)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){let a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM=a.inverse(),this.inverseScreenCTMDirty=!1)}return this.inverseScreenCTM}updateInverseScreenCTM(){this.inverseScreenCTMDirty=!0}isVisible(){return this.visible}getSvgXY(a){var b=0,c=0,d=1;if(this.getCanvas().contains(a)||this.getBubbleCanvas().contains(a))d=this.scale;do{let e=lc(a);if(a===this.getCanvas()||a===this.getBubbleCanvas())d=1;b+=e.x*
|
|
1532
|
+
d;c+=e.y*d;a=a.parentNode}while(a&&a!==this.getParentSvg()&&a!==this.getInjectionDiv());return new D(b,c)}getCachedParentSvgSize(){var a=this.cachedParentSvgSize;return new ic(a.width,a.height)}getOriginOffsetInPixels(){return mc(this.getCanvas())}getInjectionDiv(){if(!this.injectionDiv){let a=this.svgGroup_;for(;a;){if((" "+(a.getAttribute("class")||"")+" ").includes(" injectionDiv ")){this.injectionDiv=a;break}a=a.parentNode}}return this.injectionDiv}getSvgGroup(){return this.svgGroup_}getBlockCanvas(){return this.getCanvas()}setResizeHandlerWrapper(a){this.resizeHandlerWrapper=
|
|
1534
1533
|
a}setInitialAriaContext(){if(!this.svgGroup_)throw Error("Must initialize svgGroup_ by calling `createDom` before calling setAriaContext");this.isFlyout||(ya(this.svgGroup_,Ka.REGION),this.isMutator?l(this.svgGroup_,p.LABEL,$.C.WORKSPACE_LABEL_MUTATOR_WORKSPACE):(l(this.svgGroup_,p.LABEL,$.C.WORKSPACE_LABEL_PLAIN),this.workspaceFocusTargetElement&&(ya(this.workspaceFocusTargetElement,Ka.FIGURE),l(this.workspaceFocusTargetElement,p.ROLEDESCRIPTION,$.C.WORKSPACE_ROLEDESCRIPTION),this.updateAriaLabel())))}updateAriaLabel(){if(this.workspaceFocusTargetElement){var a=
|
|
1535
1534
|
this.getTopBlocks(!1).length;a==1?l(this.workspaceFocusTargetElement,p.LABEL,$.C.WORKSPACE_LABEL_1_STACK):l(this.workspaceFocusTargetElement,p.LABEL,$.C.WORKSPACE_LABEL_MANY_STACKS.replace("%1",String(a)))}}createDom(a,b){this.injectionDiv||(this.injectionDiv=b!=null?b:null);this.svgGroup_=r(q.G,{"class":"blocklyWorkspace",id:this.id});a&&(this.svgBackground_=r(q.RECT,{height:"100%",width:"100%","class":a},this.svgGroup_),a==="blocklyMainBackground"&&this.grid?this.svgBackground_.style.fill="var(--blocklyGridPattern)":
|
|
1536
1535
|
this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill"));this.workspaceSelectionRing=a=r(q.RECT,{fill:"none",class:"blocklyWorkspaceSelectionRing"},this.svgGroup_);this.workspaceFocusRing=r(q.RECT,{fill:"none",class:"blocklyWorkspaceFocusRing"},this.svgGroup_);this.isFlyout||this.isMutator||(a.id=`${this.id}_focusTarget`,this.workspaceFocusTargetElement=a,this.workspaceFocusTarget=new Sp(this,a));this.layerManager=new bp(this);this.svgBlockCanvas_=this.layerManager.getBlockLayer();
|
|
@@ -1541,7 +1540,7 @@ this.getParentSvg();c&&c.parentNode&&Oa(c.parentNode)}this.resizeHandlerWrapper&
|
|
|
1541
1540
|
this.svgGroup_.appendChild(a)}static newTrashcan(){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts");}addZoomControls(){this.zoomControls_=new Jl(this);var a=this.zoomControls_.createDom();this.svgGroup_.appendChild(a)}copyOptionsForFlyout(){return new In({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,plugins:this.options.plugins,
|
|
1542
1541
|
modalInputs:this.options.modalInputs,move:{scrollbars:!0}})}addFlyout(a){var b=this.copyOptionsForFlyout();b.toolboxPosition=this.options.toolboxPosition;this.flyout=this.horizontalLayout?new (Jb(y.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(b):new (Jb(y.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(b);this.flyout.autoClose=!1;this.flyout.getWorkspace().setVisible(!0);return this.flyout.createDom(a)}getFlyout(a){return this.flyout||a?this.flyout:this.toolbox?this.toolbox.getFlyout():null}getToolbox(){return this.toolbox}updateScreenCalculations(){this.updateInverseScreenCTM();
|
|
1543
1542
|
this.recordDragTargets()}resizeContents(){this.resizesEnabled&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox?this.toolbox.position():this.flyout&&this.flyout.position();var a=this.componentManager.getComponents(Wk.Capability.POSITIONABLE,!0),b=this.getMetricsManager().getUiMetrics(),c=[];for(let d=0,e;e=a[d];d++){e.position(b,c);let f=e.getBoundingRectangle();f&&c.push(f)}this.scrollbar&&this.scrollbar.resize();this.updateScreenCalculations();
|
|
1544
|
-
this.workspaceFocusRing&&this.workspaceSelectionRing&&(this.resizeWorkspaceRing(this.workspaceSelectionRing,5),this.resizeWorkspaceRing(this.workspaceFocusRing,0))}resizeWorkspaceRing(a,b){var c=this.getMetrics();a.setAttribute("x",`${c.absoluteLeft+b}`);a.setAttribute("y",`${c.absoluteTop+b}`);a.setAttribute("width",`${Math.max(0,c.viewWidth-b*2)}`);a.setAttribute("height",`${Math.max(0,c.svgHeight-b*2)}`)}updateScreenCalculationsIfScrolled(){var a=
|
|
1543
|
+
this.workspaceFocusRing&&this.workspaceSelectionRing&&(this.resizeWorkspaceRing(this.workspaceSelectionRing,5),this.resizeWorkspaceRing(this.workspaceFocusRing,0))}resizeWorkspaceRing(a,b){var c=this.getMetrics();a.setAttribute("x",`${c.absoluteLeft+b}`);a.setAttribute("y",`${c.absoluteTop+b}`);a.setAttribute("width",`${Math.max(0,c.viewWidth-b*2)}`);a.setAttribute("height",`${Math.max(0,c.svgHeight-b*2)}`)}updateScreenCalculationsIfScrolled(){var a=oc();D.equals(this.lastRecordedPageScroll,a)||(this.lastRecordedPageScroll=
|
|
1545
1544
|
a,this.updateScreenCalculations())}getLayerManager(){return this.layerManager}getCanvas(){return this.layerManager.getBlockLayer()}setCachedParentSvgSize(a,b){var c=this.getParentSvg();a!=null&&(this.cachedParentSvgSize.width=a,c.setAttribute("data-cached-width",`${a}`));b!=null&&(this.cachedParentSvgSize.height=b,c.setAttribute("data-cached-height",`${b}`))}getBubbleCanvas(){return this.layerManager.getBubbleLayer()}getParentSvg(){if(!this.cachedParentSvg){let a=this.svgGroup_;for(;a;){if(a.tagName===
|
|
1546
1545
|
"svg"){this.cachedParentSvg=a;break}a=a.parentNode}}return this.cachedParentSvg}maybeFireViewportChangeEvent(){if(Vb()){var a=this.scale,b=-this.scrollY,c=-this.scrollX;if(!(a===this.oldScale&&Math.abs(b-this.oldTop)<1&&Math.abs(c-this.oldLeft)<1)){var d=new (u(v.VIEWPORT_CHANGE))(b,c,a,this.id,this.oldScale);this.oldScale=a;this.oldTop=b;this.oldLeft=c;w(d)}}}translate(a,b){var c;(c=this.layerManager)==null||c.translateLayers(new D(a,b),this.scale);var d;(d=this.grid)==null||d.moveTo(a,b);this.maybeFireViewportChangeEvent()}getWidth(){var a=
|
|
1547
1546
|
this.getMetrics();return a?a.viewWidth/this.scale:0}setVisible(a){this.visible=a;this.svgGroup_&&(this.scrollbar&&this.scrollbar.setContainerVisible(a),this.getFlyout()&&this.getFlyout().setContainerVisible(a),this.getParentSvg().style.display=a?"block":"none",this.toolbox&&this.toolbox.setVisible(a),a||this.hideChaff(!0))}render(){var a=this.getAllBlocks(!1);for(let b=a.length-1;b>=0;b--)a[b].queueRender();this.getTopBlocks().flatMap(b=>b.getDescendants(!1)).filter(b=>b.isInsertionMarker()).forEach(b=>
|
|
@@ -1552,10 +1551,10 @@ this.targetWorkspace:this;a&&!a.currentGesture_&&a.toolbox&&a.toolbox.getFlyout(
|
|
|
1552
1551
|
a.stopPropagation();else{var b=this.options.zoomOptions&&this.options.zoomOptions.wheel,c=this.options.moveOptions&&this.options.moveOptions.wheel;if(b||c){var d=qa(a);if(na)var e=a.metaKey;b&&(a.ctrlKey||e||!c)?(d=-d.y/50,b=pa(a,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(b.x,b.y,d)):(b=this.scrollX-d.x,c=this.scrollY-d.y,a.shiftKey&&!d.x&&(b=this.scrollX-d.y,c=this.scrollY),this.scroll(b,c));a.preventDefault()}}}getBlocksBoundingBox(){var a=this.getTopBoundedElements();if(!a.length)return new cc(0,
|
|
1553
1552
|
0,0,0);var b=a[0].getBoundingRectangle();for(let d=1;d<a.length;d++){var c=a[d];if(c.isInsertionMarker&&c.isInsertionMarker())continue;c=c.getBoundingRectangle();c.top<b.top&&(b.top=c.top);c.bottom>b.bottom&&(b.bottom=c.bottom);c.left<b.left&&(b.left=c.left);c.right>b.right&&(b.right=c.right)}return b}cleanUp(){function a(g){for(let h of e)if(g.intersects(h))return h;return null}this.setResizesEnabled(!1);var b=$.gd;b||$.B(!0);var c=this.getTopBlocks(!0),d=c.filter(g=>g.isMovable()),e=c.filter(g=>
|
|
1554
1553
|
!g.isMovable()).map(g=>g.getBoundingRectangle()),f=0;c=this.renderer.getConstants().MIN_BLOCK_HEIGHT;for(let g of d){d=g.getBoundingRectangle();g.moveBy(-d.left,f-d.top,["cleanup"]);g.snapToGrid();d=g.getBoundingRectangle();for(f=a(d);f!=null;)f=f.top+f.getHeight()+c,g.moveBy(0,f-d.top,["cleanup"]),g.snapToGrid(),d=g.getBoundingRectangle(),f=a(d);f=g.getRelativeToSurfaceXY().y+g.getHeightWidth().height+c}$.B(b);this.setResizesEnabled(!0)}showContextMenu(a){if(!this.isReadOnly()&&!this.isFlyout){var b=
|
|
1555
|
-
dk.registry.getContextMenuOptions({workspace:this,focusedNode:this},a);this.configureContextMenu&&this.configureContextMenu(b,a);if(a instanceof PointerEvent)var c=new D(a.clientX,a.clientY);else c=this.
|
|
1556
|
-
a;this.toolbox.render(a)}else{if(!this.flyout)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=a;this.flyout.show(a)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.");}markFocused(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(nb(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(a,b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);var d=this.scale*c;if(this.scale!==
|
|
1557
|
-
c=this.options.zoomOptions.maxScale/this.scale:d<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale/this.scale);var e=this.getCanvas().getCTM(),f=this.getParentSvg().createSVGPoint();f.x=a;f.y=b;f=f.matrixTransform(e.inverse());a=f.x;b=f.y;e=e.translate(a*(1-c),b*(1-c)).scale(c);this.scrollX=Math.round(e.e);this.scrollY=Math.round(e.f);this.setScale(d)}}zoomCenter(a){var b=this.getMetrics();if(this.flyout){var c=b.svgWidth?b.svgWidth/2:0;
|
|
1558
|
-
2+b.absoluteLeft,b=b.viewHeight/2+b.absoluteTop;this.zoom(c,b,a)}zoomToFit(){if(this.isMovable()){var a=this.getMetrics(),b=a.viewWidth;a=a.viewHeight;var c=this.getBlocksBoundingBox(),d=c.right-c.left+40;c=c.bottom-c.top+40;if(d){this.flyout&&(this.horizontalLayout?(a+=this.flyout.getHeight(),c+=this.flyout.getHeight()/this.scale):(b+=this.flyout.getWidth(),d+=this.flyout.getWidth()/this.scale));$.Ub++;try{this.setScale(Math.min(b/d,a/c)),this.scrollCenter()}finally{$.Ub--}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}beginCanvasTransition(){n(this.getCanvas(),
|
|
1554
|
+
dk.registry.getContextMenuOptions({workspace:this,focusedNode:this},a);this.configureContextMenu&&this.configureContextMenu(b,a);if(a instanceof PointerEvent)var c=new D(a.clientX,a.clientY);else c=this.getMetricsManager().getViewMetrics(!0),c=qc(this,new D(this.RTL?c.left+c.width-5:c.left+5,c.top+5));Hg(a,b,this.RTL,this,c)}}updateToolbox(a){if(a=Dc(a)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Fc(a)){if(!this.toolbox)throw Error("Existing toolbox has no categories. Can't change mode.");
|
|
1555
|
+
this.options.languageTree=a;this.toolbox.render(a)}else{if(!this.flyout)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=a;this.flyout.show(a)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.");}markFocused(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(nb(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(a,b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);var d=this.scale*c;if(this.scale!==
|
|
1556
|
+
d){d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:d<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale/this.scale);var e=this.getCanvas().getCTM(),f=this.getParentSvg().createSVGPoint();f.x=a;f.y=b;f=f.matrixTransform(e.inverse());a=f.x;b=f.y;e=e.translate(a*(1-c),b*(1-c)).scale(c);this.scrollX=Math.round(e.e);this.scrollY=Math.round(e.f);this.setScale(d)}}zoomCenter(a){var b=this.getMetrics();if(this.flyout){var c=b.svgWidth?b.svgWidth/2:0;
|
|
1557
|
+
b=b.svgHeight?b.svgHeight/2:0}else c=b.viewWidth/2+b.absoluteLeft,b=b.viewHeight/2+b.absoluteTop;this.zoom(c,b,a)}zoomToFit(){if(this.isMovable()){var a=this.getMetrics(),b=a.viewWidth;a=a.viewHeight;var c=this.getBlocksBoundingBox(),d=c.right-c.left+40;c=c.bottom-c.top+40;if(d){this.flyout&&(this.horizontalLayout?(a+=this.flyout.getHeight(),c+=this.flyout.getHeight()/this.scale):(b+=this.flyout.getWidth(),d+=this.flyout.getWidth()/this.scale));$.Ub++;try{this.setScale(Math.min(b/d,a/c)),this.scrollCenter()}finally{$.Ub--}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}beginCanvasTransition(){n(this.getCanvas(),
|
|
1559
1558
|
"blocklyCanvasTransitioning");n(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}endCanvasTransition(){Ma(this.getCanvas(),"blocklyCanvasTransitioning");Ma(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}scrollCenter(){if(this.isMovable()){var a=this.getMetrics(),b=(a.scrollWidth-a.viewWidth)/2,c=(a.scrollHeight-a.viewHeight)/2;b=-b-a.scrollLeft;c=-c-a.scrollTop;this.scroll(b,c)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}centerOnBlock(a,
|
|
1560
1559
|
b){if(this.isMovable()){var c=a?this.getBlockById(a):null;if(c){a=c.getRelativeToSurfaceXY();c=b?{height:c.height,width:c.width}:c.getHeightWidth();var d=this.scale;b=(a.x+(this.RTL?-1:1)*c.width/2)*d;a=(a.y+c.height/2)*d;c=this.getMetrics();this.scroll(-(b-c.viewWidth/2),-(a-c.viewHeight/2))}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}setScale(a){a=Math.round(a*1E3)/1E3;this.options.zoomOptions.maxScale&&a>this.options.zoomOptions.maxScale?
|
|
1561
1560
|
a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&a<this.options.zoomOptions.minScale&&(a=this.options.zoomOptions.minScale);this.scale=a;this.hideChaff(!1);(a=this.getFlyout(!1))&&a.isVisible()&&(a.reflow(),this.recordDragTargets());this.grid&&this.grid.update(this.scale);a=this.getMetrics();this.scrollX-=a.absoluteLeft;this.scrollY-=a.absoluteTop;a.viewLeft+=a.absoluteLeft;a.viewTop+=a.absoluteTop;this.scroll(this.scrollX,this.scrollY);this.scrollbar&&(this.flyout?this.scrollbar.resizeView(a):
|
|
@@ -1573,7 +1572,7 @@ null?c:null}return this.workspaceFocusTarget}getWorkspaceFocusTarget(){return th
|
|
|
1573
1572
|
var b,c=(b=this.targetWorkspace)==null?void 0:b.getFlyout();if(this.isFlyout&&c)for(var d of c.getContents())if(b=d.getElement(),ab(b)&&b.canBeFocused()&&b.getFocusableElement().id===a)return b;d=a.indexOf("_field_");b=a.indexOf("_connection_");if(d!==-1){var e=a.substring(0,d);if(e=this.getBlockById(e))for(var f of e.getFields())if(f.canBeFocused()&&f.getFocusableElement().id===a)return f;return null}if(b!==-1){e=a.substring(0,b);if(e=this.getBlockById(e))for(let m of e.getConnections_(!0))if(m.id===
|
|
1574
1573
|
a)return m;return null}f=Math.max(a.indexOf("_comment_textarea_"),a.indexOf("_collapse_bar_button"),a.indexOf("_delete_bar_button"));if(f!==-1&&(f=a.substring(0,f),f=this.searchForWorkspaceComment(f))){if(a.indexOf("_comment_textarea_")>-1)return f.getEditorFocusableNode();var g;return(g=f.view.getCommentBarButtons().find(m=>m.id.includes(a)))!=null?g:null}if((g=this.getAllBlocks(!1).find(m=>m.getFocusableElement().id===a))||(g=this.searchForWorkspaceComment(a)))return g;g=this.getAllBlocks().map(m=>
|
|
1575
1574
|
m.getIcons()).flat();for(var h of g){if(h.canBeFocused()&&h.getFocusableElement().id===a)return h;if(xd(h)){if((g=h.getBubble())&&g.canBeFocused()&&g.getFocusableElement().id===a)return g;if(g instanceof Sn&&g.getEditor().getFocusableElement().id===a)return g.getEditor()}}h=this.getComponentManager().getComponents(Wk.Capability.FOCUSABLE,!1);for(e of h)if(e.getFocusableElement().getAttribute("id")===a)return e;return null}onTreeFocus(){this.updateAriaLabel()}onTreeBlur(a){if(this.isFlyout&&this.targetWorkspace){var b=
|
|
1576
|
-
this.targetWorkspace.getToolbox();b&&a===b||$.t().ephemeralFocusTaken()&&a!==this.targetWorkspace||b&&typeof b.autoHide==="function"
|
|
1575
|
+
this.targetWorkspace.getToolbox();b&&a===b||$.t().ephemeralFocusTaken()&&a!==this.targetWorkspace||(b&&typeof b.autoHide==="function"?b.autoHide(!1):(a=this.targetWorkspace.getFlyout())&&typeof a.autoHide==="function"&&a.autoHide(!1))}}performAction(){mi.show(this,{message:$.C.KEYBOARD_NAV_WORKSPACE_NAVIGATION_HINT,id:"workspaceNavigationHint"})}getNavigator(){return this.navigator}setNavigator(a){this.navigator=a}};$h.everFocused=!1;var Tp=class{constructor(a,b,c,d){this.workspace=a;this.name=b;this.type=c||"";this.id=d||Nb()}getId(){return this.id}getName(){return this.name}setName(a){this.name=a;return this}getType(){return this.type}setType(a){this.type=a;return this}getWorkspace(){return this.workspace}save(){var a={name:this.getName(),id:this.getId()},b=this.getType();b&&(a.type=b);return a}static load(a,b){a=new this(b,a.name,a.type,a.id);b.getVariableMap().addVariable(a);w(new (u(v.VAR_CREATE))(a))}};
|
|
1577
1576
|
A(y.VARIABLE_MODEL,"default",Tp);var Up=class{constructor(a,b=!1){this.workspace=a;this.potentialMap=b;this.variableMap=new Map}clear(){for(let a of this.variableMap.values())for(let b of a.values())this.deleteVariable(b);if(this.variableMap.size!==0)throw Error("Non-empty variable map");}renameVariable(a,b){if(a.getName()===b)return a;var c=a.getType();c=this.getVariable(b,c);var d=this.workspace.getAllBlocks(!1),e="";this.potentialMap||(e=$.gd)||$.B(!0);try{c&&c.getId()!==a.getId()?this.renameVariableWithConflict(a,b,c,d):this.renameVariableAndUses(a,
|
|
1578
1577
|
b,d)}finally{this.potentialMap||$.B(e)}return a}changeVariableType(a,b){var c=a.getType();if(c===b)return a;var d=this.variableMap.get(c);d==null||d.delete(a.getId());(d==null?void 0:d.size)===0&&this.variableMap.delete(c);a.setType(b);var e;d=(e=this.variableMap.get(b))!=null?e:new Map;d.set(a.getId(),a);this.variableMap.has(b)||this.variableMap.set(b,d);w(new (u(v.VAR_TYPE_CHANGE))(a,c,b));return a}renameVariableAndUses(a,b,c){this.potentialMap||w(new (u(v.VAR_RENAME))(a,b));a.setName(b);for(b=
|
|
1579
1578
|
0;b<c.length;b++)c[b].updateVarName(a)}renameVariableWithConflict(a,b,c,d){var e=a.getType(),f=c.getName();b!==f&&this.renameVariableAndUses(c,b,d);for(b=0;b<d.length;b++)d[b].renameVarById(a.getId(),c.getId());this.potentialMap||w(new (u(v.VAR_DELETE))(a));var g;(g=this.variableMap.get(e))==null||g.delete(a.getId())}createVariable(a,b,c){var d=this.getVariable(a,b);if(d){if(c&&d.getId()!==c)throw Error('Variable "'+a+'" is already in use and its id is "'+d.getId()+'" which conflicts with the passed in id, "'+
|
|
@@ -1585,12 +1584,12 @@ String(Math.random()).substring(2);var b=r(q.CLIPPATH,{id:"blocklyTrashBodyClipP
|
|
|
1585
1584
|
b=r(q.SVG,{viewBox:"0 32 47 16",width:47,height:16},b);r(q.IMAGE,{width:El.width,height:El.height,href:this.workspace.options.pathToMedia+El.url},b);ka(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable);ka(this.svgGroup,"pointerup",this,this.click);ka(this.svgGroup,"keydown",this,this.onKeyDown);return this.svgGroup}init(){if(this.workspace.options.maxTrashcanContents>0){let a=this.flyout.createDom(q.SVG);n(a,"blocklyTrashcanFlyout");Pa(a,this.workspace.getParentSvg());this.flyout.init(this.workspace)}this.workspace.getComponentManager().addComponent({component:this,
|
|
1586
1585
|
weight:Wk.ComponentWeight.TRASHCAN_WEIGHT,capabilities:[Wk.Capability.AUTOHIDEABLE,Wk.Capability.DELETE_AREA,Wk.Capability.DRAG_TARGET,Wk.Capability.POSITIONABLE]});this.initialized=!0;this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan");var a;(a=this.flyout)==null||a.dispose();this.flyout=null;this.svgGroup&&Oa(this.svgGroup)}hasContents(){return!!this.contents.length}contentsIsOpen(){return!!this.flyout&&this.flyout.isVisible()}openFlyout(){if(!this.contentsIsOpen()){var a=
|
|
1587
1586
|
this.contents.map(function(c){return JSON.parse(c)}),b=this.workspace.getParentSvg().style;b.cursor="wait";setTimeout(()=>{var c;(c=this.flyout)==null||c.show(a);b.cursor="";var d;(d=this.workspace.scrollbar)==null||d.setVisible(!1);if(Nd.getIsActive()){let e,f;(c=(f=(e=this.flyout)==null?void 0:e.getWorkspace())==null?void 0:f.getNavigator().getFirstNode())&&$.t().focusNode(c)}},10);this.fireUiEvent(!0)}}closeFlyout(){if(this.contentsIsOpen()){var a;(a=this.flyout)==null||a.hide();var b;(b=this.workspace.scrollbar)==
|
|
1588
|
-
null||b.setVisible(!0);this.fireUiEvent(!1);this.workspace.recordDragTargets()}}autoHide(a){!a&&this.flyout&&this.closeFlyout()}emptyContents(){this.hasContents()&&this.svgGroup&&(this.contents.length=0,this.svgGroup.classList.remove("blocklyTrashFull"),l(this.svgGroup,p.LABEL,$.C.ARIA_LABEL_TRASH_EMPTY),l(this.svgGroup,p.DISABLED,!0),this.closeFlyout())}position(a,b){if(this.initialized){var c=Lc(this.workspace,a);a=Kc(c,new
|
|
1587
|
+
null||b.setVisible(!0);this.fireUiEvent(!1);this.workspace.recordDragTargets()}}autoHide(a){!a&&this.flyout&&this.closeFlyout()}emptyContents(){this.hasContents()&&this.svgGroup&&(this.contents.length=0,this.svgGroup.classList.remove("blocklyTrashFull"),l(this.svgGroup,p.LABEL,$.C.ARIA_LABEL_TRASH_EMPTY),l(this.svgGroup,p.DISABLED,!0),this.closeFlyout())}position(a,b){if(this.initialized){var c=Lc(this.workspace,a);a=Kc(c,new ic(47,60),20,20,a,this.workspace);b=Nc(a,20,c.vertical===Jc.TOP?Mc.DOWN:
|
|
1589
1588
|
Mc.UP,b);this.top=b.top;this.left=b.left;var d;(d=this.svgGroup)==null||d.setAttribute("transform","translate("+this.left+","+this.top+")");var e;(e=this.flyout)==null||e.position()}}getBoundingRectangle(){return new cc(this.top,this.top+44+16,this.left,this.left+47)}getClientRect(){if(!this.svgGroup)return null;var a=this.svgGroup.getBoundingClientRect(),b=a.top+32-10;a=a.left+0-10;return new cc(b,b+16+44+20,a,a+47+20)}onDragOver(){si.mover.isMoving()||this.setLidOpen(this.wouldDelete_)}onDragExit(){si.mover.isMoving()||
|
|
1590
1589
|
this.setLidOpen(!1)}onDrop(){si.mover.isMoving()||setTimeout(this.setLidOpen.bind(this,!1),100)}setLidOpen(a){if(this.isLidOpen!==a){this.isLidOpen=a;var b;(b=this.svgGroup)==null||b.classList.toggle("blocklyTrashOpen",a)}}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}onKeyDown(a){if(a.key==="Enter"||a.key===" ")a.preventDefault(),this.click()}fireUiEvent(a){a=new (u(v.TRASHCAN_OPEN))(a,this.workspace.id);w(a)}blockMouseDownWhenOpenable(a){!this.contentsIsOpen()&&
|
|
1591
1590
|
this.hasContents()&&a.stopPropagation()}onDelete(a){if(!(this.workspace.options.maxTrashcanContents<=0||a.type!==v.BLOCK_DELETE||a.wasShadow)&&this.svgGroup){if(!a.oldJson)throw Error("Encountered a delete event without proper oldJson");a=JSON.stringify(this.cleanBlockJson(a.oldJson));if(!this.contents.includes(a)){for(this.contents.unshift(a);this.contents.length>this.workspace.options.maxTrashcanContents;)this.contents.pop();this.svgGroup.classList.add("blocklyTrashFull");l(this.svgGroup,p.LABEL,
|
|
1592
1591
|
$.C.OPEN_TRASH);za(this.svgGroup,p.DISABLED)}}}cleanBlockJson(a){function b(c){if(c){delete c.id;delete c.x;delete c.y;delete c.enabled;delete c.disabledReasons;if(c.icons&&c.icons.comment){var d=c.icons.comment;delete d.height;delete d.width;delete d.pinned}d=c.inputs;for(var e in d){var f=d[e];let g=f.block;f=f.shadow;g&&b(g);f&&b(f)}c.next&&(e=c.next,c=e.block,e=e.shadow,c&&b(c),e&&b(e))}}a=JSON.parse(JSON.stringify(a));b(a);return Object.assign({},{kind:"BLOCK"},a)}};ta("\n .blocklyTrash > image {\n opacity: 0.4;\n transition: opacity 0.08s ease-out;\n }\n\n .blocklyTrashLid {\n opacity: 0.4;\n transition: rotate 0.08s ease-out, opacity 0.08s ease-out;\n transform-origin: 46px 12px;\n rotate: 0deg;\n pointer-events: none;\n }\n\n .blocklyRTL .blocklyTrashLid {\n transform-origin: 0px 12px;\n }\n\n .blocklyTrash.blocklyTrashFull .blocklyTrashLid {\n rotate: 5deg;\n }\n\n .blocklyRTL .blocklyTrash.blocklyTrashFull .blocklyTrashLid {\n rotate: -5deg;\n }\n\n .blocklyTrash.blocklyTrashOpen > image,\n .blocklyTrash.blocklyTrashOpen > .blocklyTrashLid,\n .blocklyTrash.blocklyTrashFull:hover > image,\n .blocklyTrash.blocklyTrashFull:hover > .blocklyTrashLid,\n .blocklyTrash.blocklyTrashFull:focus > image,\n .blocklyTrash.blocklyTrashFull:focus > .blocklyTrashLid {\n opacity: 0.8;\n }\n\n .blocklyTrash.blocklyTrashOpen .blocklyTrashLid,\n .blocklyTrash.blocklyTrashFull:hover .blocklyTrashLid,\n .blocklyTrash.blocklyTrashFull:focus .blocklyTrashLid {\n rotate: 45deg;\n }\n\n .blocklyRTL .blocklyTrash.blocklyTrashOpen .blocklyTrashLid,\n .blocklyRTL .blocklyTrash.blocklyTrashFull:hover .blocklyTrashLid,\n .blocklyRTL .blocklyTrash.blocklyTrashFull:focus .blocklyTrashLid {\n rotate: -45deg;\n }\n");var Wp=class{constructor(a,b){this.procedureModelClass=a;this.parameterModelClass=b;this.priority=75}save(a){a=a.getProcedureMap().getProcedures().map(b=>Sj(b));return a.length?a:null}load(a,b){var c=b.getProcedureMap();for(let d of a)c.add(Tj(this.procedureModelClass,this.parameterModelClass,d,b))}clear(a){a.getProcedureMap().clear()}},Xp={};Xp.ProcedureSerializer=Wp;Xp.loadProcedure=Tj;Xp.saveProcedure=Sj;var Yp=class{constructor(){this.priority=100}save(a){a=a.getVariableMap().getAllVariables().map(b=>b.save());return a.length?a:null}load(a,b){var c=Fb(y.VARIABLE_MODEL,"default",void 0);a.forEach(d=>{c==null||c.load(d,b)})}clear(a){a.getVariableMap().clear()}};Oc("variables",new Yp);var Zp={};Zp.VariableSerializer=Yp;var $p={blocks:jn,exceptions:gn,priorities:{BLOCKS:50,PROCEDURES:75,VARIABLES:100,WORKSPACE_COMMENTS:25},procedures:Xp,registry:Kl,variables:Zp,workspaceComments:Ml,workspaces:{load:function(a,b,{recordUndo:c=!1}={}){var d=Ib(y.SERIALIZER,!0);if(d){d=Object.entries(d).sort((f,g)=>g[1].priority-f[1].priority);var e=$.Qc;$.Qc=c;(c=$.gd)||$.B(!0);Ta();b instanceof $h&&b.setResizesEnabled(!1);for(let [,f]of d.reverse()){let g;(g=f)==null||g.clear(b)}for(let [f,g]of d.reverse())if(a[f]){let h;(h=g)==null||
|
|
1593
|
-
h.load(a[f],b)}b instanceof $h&&b.setResizesEnabled(!0);Ua();w(new (u(v.FINISHED_LOADING))(b));$.B(c);$.Qc=e}},save:function(a){var b=Object.create(null),c=Ib(y.SERIALIZER,!0);for(let d in c){let e,f=(e=c[d])==null?void 0:e.save(a);f&&(b[d]=f)}return b}}};"Blockly"in globalThis||(globalThis.Blockly={Msg:sl});var aq=class{load(a,b){a=new Ii(b.getWorkspace(),b.targetWorkspace,a,!0);a.show();return new Co(a,"label")}gapForItem(a,b){return b}disposeItem(a){a=a.getElement();a instanceof Ii&&a.dispose()}getType(){return"label"}};A(y.FLYOUT_INFLATER,"label",aq);var bq=class{constructor(){this.size=new
|
|
1592
|
+
h.load(a[f],b)}b instanceof $h&&b.setResizesEnabled(!0);Ua();w(new (u(v.FINISHED_LOADING))(b));$.B(c);$.Qc=e}},save:function(a){var b=Object.create(null),c=Ib(y.SERIALIZER,!0);for(let d in c){let e,f=(e=c[d])==null?void 0:e.save(a);f&&(b[d]=f)}return b}}};"Blockly"in globalThis||(globalThis.Blockly={Msg:sl});var aq=class{load(a,b){a=new Ii(b.getWorkspace(),b.targetWorkspace,a,!0);a.show();return new Co(a,"label")}gapForItem(a,b){return b}disposeItem(a){a=a.getElement();a instanceof Ii&&a.dispose()}getType(){return"label"}};A(y.FLYOUT_INFLATER,"label",aq);var bq=class{constructor(){this.size=new ic(0,0)}getHeightWidth(){return this.size}show(a,b){this.parentConnection=a;this.parentConnection.attachInsertionMarker(this);var c=b.getSourceBlock(),d=new Map;for(var e of c.getConnections_(!1))d.set(e,e.targetConnection),e.targetConnection=null;b.targetConnection=a;c.workspace.getRenderer().render(c);this.partiallyTighten(c,b);this.marker=this.makeMarker(c);e=c.getBoundingRectangleWithoutChildren();this.size=new ic(e.getWidth(),e.getHeight());e=a.getSourceBlock().getRelativeToSurfaceXY();
|
|
1594
1593
|
var f=D.difference(a.getOffsetInBlock(),b.getOffsetInBlock());for(let [g,h]of d.entries())g.targetConnection=h;c.workspace.getRenderer().render(c);this.partiallyTighten(c,b);this.marker.setAttribute("transform",`${`translate(${e.x+f.x}, ${e.y+f.y})`} ${c.workspace.RTL?"scale(-1, 1)":""}`);a.getSourceBlock().queueRender();dd()}hide(){if(this.parentConnection){var a;(a=this.marker)==null||a.remove();this.marker=void 0;this.parentConnection.detachInsertionMarker();var b;(b=this.parentConnection)==null||
|
|
1595
1594
|
b.getSourceBlock().queueRender();dd();this.parentConnection=void 0}}makeMarker(a){var b=r(q.G,{transform:`translate(${a.relativeCoords.x}, ${a.relativeCoords.y})`,"class":"blocklyInsertionMarker"}),c;r(q.PATH,{d:(c=a.pathObject.svgPath.getAttribute("d"))!=null?c:"","class":"blocklyPath"},b);a.workspace.getCanvas().appendChild(b);return b}partiallyTighten(a,b){for(let c of a.inputList){if(c===b.getParentInput())continue;let d=c.connection;d&&d.tightenEfficiently()}a.nextConnection&&a.nextConnection!==
|
|
1596
1595
|
b&&a.nextConnection.tightenEfficiently()}};var cq=class extends Ip{constructor(){super();this.FIELD_TEXT_BASELINE_CENTER=!1;this.DARK_PATH_OFFSET=1;this.MAX_BOTTOM_WIDTH=30;this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2}getCSS_(a){return super.getCSS_(a).concat([`${a} .blocklyInsertionMarker>.blocklyPathLight,`,`${a} .blocklyInsertionMarker>.blocklyPathDark {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"])}};var dq=class{constructor(a){this.inlineSteps_=this.steps_="";this.info_=a;this.RTL_=this.info_.RTL;a=a.getRenderer();this.constants_=a.getConstants();this.highlightConstants_=a.getHighlightConstants();this.highlightOffset=this.highlightConstants_.OFFSET;this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER;this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER;this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB;this.notchPaths_=this.highlightConstants_.NOTCH;this.startPaths_=
|
|
@@ -1649,11 +1648,11 @@ a));return{width:a,height:a,pathTop:b,pathBottom:d,rightWidth:a,rightHeight:a,pa
|
|
|
1649
1648
|
this.positionOutputConnection_();this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height);this.outlinePath_+="z"}drawFlatTop_(){var a=this.info_.topRow;this.positionPreviousConnection_();this.outlinePath_+=Dh(a.xPos,this.info_.startY);this.outlinePath_+=I("h",a.width)}drawFlatBottom_(){var a=this.info_.bottomRow;this.positionNextConnection_();this.outlinePath_+=I("V",a.baseline);this.outlinePath_+=I("h",-a.width)}drawInlineInput_(a){this.positionInlineInputConnection_(a);
|
|
1650
1649
|
var b=a.input.name;a.connectedBlock||this.info_.isInsertionMarker||(a=Ch(a.xPos+a.connectionWidth,a.centerline-a.height/2)+this.getInlineInputPath(a),this.block_.pathObject.setOutlinePath(b,a))}getInlineInputPath(a){var b=a.width-a.connectionWidth*2,c=a.height;return I("h",b)+a.shape.pathRightDown(c)+I("h",-b)+a.shape.pathUp(c)+"z"}drawStatementInput_(a){var b=a.getLastInput(),c=b.xPos+b.notchOffset+b.shape.width,d=this.constants_.INSIDE_CORNERS,e=b.shape.pathRight+I("h",-(b.notchOffset-d.width))+
|
|
1651
1650
|
d.pathTop,f=a.height-2*d.height;b=d.pathBottom+I("h",b.notchOffset-d.width)+(b.connectedBottomNextConnection?"":b.shape.pathLeft);this.outlinePath_+=I("H",c)+e+I("v",f)+b+I("H",a.xPos+a.width);this.positionStatementInputConnection_(a)}drawConnectionHighlightPath(a){var b=a.connectionModel;if(b.type===G.NEXT_STATEMENT||b.type===G.PREVIOUS_STATEMENT||b.type===G.OUTPUT_VALUE&&!a.isDynamicShape)return super.drawConnectionHighlightPath(a);a=b.type===G.INPUT_VALUE?Ch(a.connectionWidth,-a.height/2)+this.getInlineInputPath(a):
|
|
1652
|
-
Ch(a.width,-a.height/2)+a.shape.pathDown(a.height);var c=b.getSourceBlock(),d,e;return(e=(d=c.pathObject).addConnectionHighlight)==null?void 0:e.call(d,b,a,b.getOffsetInBlock(),c.RTL)}};var pq=class extends rg{constructor(a,b,c,d,e,f,g){super(rg.SKIP_SETUP);this.imageElement=this.clickHandler=null;this.flipRtl=this.isDirty_=this.EDITABLE=!1;this.altText="";c=Number(hg(c));b=Number(hg(b));if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");if(c<=0||b<=0)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new
|
|
1651
|
+
Ch(a.width,-a.height/2)+a.shape.pathDown(a.height);var c=b.getSourceBlock(),d,e;return(e=(d=c.pathObject).addConnectionHighlight)==null?void 0:e.call(d,b,a,b.getOffsetInBlock(),c.RTL)}};var pq=class extends rg{constructor(a,b,c,d,e,f,g){super(rg.SKIP_SETUP);this.imageElement=this.clickHandler=null;this.flipRtl=this.isDirty_=this.EDITABLE=!1;this.altText="";c=Number(hg(c));b=Number(hg(b));if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");if(c<=0||b<=0)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new ic(b,c+pq.Y_PADDING);this.imageHeight=c;typeof e==="function"&&(this.clickHandler=e);
|
|
1653
1652
|
a!==rg.SKIP_SETUP&&(g?this.configure_(g):typeof d==="object"&&d!==null&&!Array.isArray(d)&&("alt"in d||"flipRtl"in d)?this.configure_(d):(this.flipRtl=!!f,this.altText=typeof d==="string"?hg(d)||"":""),this.setValue(hg(a)))}configure_(a){super.configure_(a);a.flipRtl&&(this.flipRtl=a.flipRtl);a.alt&&(this.altText=hg(a.alt))}initView(){this.imageElement=r(q.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_);this.imageElement.setAttributeNS("http://www.w3.org/1999/xlink",
|
|
1654
1653
|
"xlink:href",this.value_);this.fieldGroup_&&n(this.fieldGroup_,"blocklyImageField");this.clickHandler&&(this.imageElement.style.cursor="pointer");this.recomputeAriaContext()}updateSize_(){}doClassValidation_(a){return typeof a!=="string"?null:a}doValueUpdate_(a){this.value_=a;this.imageElement&&this.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.value_);this.recomputeAriaContext()}getFlipRtl(){return this.flipRtl}setAlt(a){a!==this.altText&&(this.altText=a||"",this.imageElement&&
|
|
1655
1654
|
this.imageElement.setAttribute("alt",this.altText))}isClickable(){return super.isClickable()&&!!this.clickHandler}showEditor_(){this.clickHandler&&this.clickHandler(this)}setOnClickHandler(a){this.clickHandler=a}getText_(){return this.altText}static fromJson(a){if(!a.src||!a.width||!a.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(a.src,a.width,a.height,void 0,void 0,void 0,a)}getAriaTypeName(){return this.ariaTypeName||
|
|
1656
|
-
$.C.ARIA_TYPE_FIELD_IMAGE}getAriaValue(){return this.altText||null}computeAriaLabel(a){return this.isClickable()?"":
|
|
1655
|
+
$.C.ARIA_TYPE_FIELD_IMAGE}getAriaValue(){return this.altText||null}computeAriaLabel(a){var b=this.getAriaValue();return this.isClickable()||!b?"":(a=a?this.getAriaTypeName():null)?`${a}: ${b}`:b}recomputeAriaContext(){if(!super.recomputeAriaContext())return!1;var a=this.getFocusableElement();if(!this.isClickable())return ya(a,Ka.NONE),za(a,p.LABEL),!1;var b=this.getAriaValue()||"";l(a,p.LABEL,b);return!0}};pq.Y_PADDING=1;jh("field_image",pq);pq.prototype.DEFAULT_VALUE="";var qq=class extends rg{set size_(a){super.size_=a}get size_(){var a=super.size_;a.width<14&&(a.width=14);return a}constructor(a,b,c){super(rg.SKIP_SETUP);this.spellcheck_=!0;this.htmlInput_=null;this.isTextValid_=this.isBeingEdited_=!1;this.onInputWrapper=this.onKeyDownWrapper=this.valueWhenEditorWasOpened_=this.warningIcon=null;this.fullBlockClickTarget_=!1;this.workspace_=null;this.SERIALIZABLE=!0;a!==rg.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){super.configure_(a);
|
|
1657
1656
|
a.spellcheck!==void 0&&(this.spellcheck_=a.spellcheck)}initView(){if(!this.getSourceBlock())throw new Dj;this.isFullBlockField()||this.createBorderRect_();this.createTextElement_();this.fieldGroup_&&n(this.fieldGroup_,"blocklyField");this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot());this.fieldGroup_&&n(this.fieldGroup_,"blocklyInputField");this.recomputeAriaContext()}isFullBlockField(){var a=this.getSourceBlock();if(!a)throw new Dj;var b;return this.fullBlockClickTarget_=
|
|
1658
1657
|
!((b=this.getConstants())==null||!b.FULL_BLOCK_FIELDS)&&a.isSimpleReporter()}createWarningIcon(){if(!this.sourceBlock_)return null;var a=this.getScaledBBox();a=a.bottom-a.top;a=r(q.SVG,{"class":"blocklyInputWarning",viewBox:"-4 0 24 16",x:"0",y:"0",height:`${a}px`,width:`${a}px`});r(q.PATH,{"class":"blocklyInputWarningIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},a);r(q.PATH,{"class":"blocklyInputWarningIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);
|
|
1659
1658
|
r(q.RECT,{"class":"blocklyInputWarningIconSymbol",x:"7",y:"11",height:"2",width:"2"},a);return a}doValueInvalid_(a,b=!0){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,a=this.value_,this.value_=this.valueWhenEditorWasOpened_,this.sourceBlock_&&Vb()&&this.value_!==a&&b&&w(new (u(v.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,a,this.value_)));this.recomputeAriaContext()}doValueUpdate_(a){this.isTextValid_=this.isDirty_=!0;this.value_=a;this.recomputeAriaContext()}applyColour(){var a=
|
|
@@ -1668,9 +1667,9 @@ this.onFinishEditing_(this.value_);this.sourceBlock_&&Vb()&&this.valueWhenEditor
|
|
|
1668
1667
|
Ma(a,"blocklyEditing");this.recomputeAriaContext()}onFinishEditing_(){}bindInputEvents_(a){this.onKeyDownWrapper=k(a,"keydown",this,this.onHtmlInputKeyDown_);this.onInputWrapper=k(a,"input",this,this.onHtmlInputChange)}unbindInputEvents_(){this.onKeyDownWrapper&&(la(this.onKeyDownWrapper),this.onKeyDownWrapper=null);this.onInputWrapper&&(la(this.onInputWrapper),this.onInputWrapper=null)}onHtmlInputKeyDown_(a){if(a.key==="Enter")vg(this),of(),a.stopPropagation();else if(a.key==="Escape")this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),
|
|
1669
1668
|
!1),vg(this),of();else if(a.key==="Tab"){a.preventDefault();var b;let c=(b=this.workspace_)==null?void 0:b.getNavigator(),d=e=>(e instanceof qq||e instanceof ji&&e.isSimpleReporter())&&e!==this.getSourceBlock();b=this;do b=a.shiftKey?c==null?void 0:c.getOutNode(b):c==null?void 0:c.getInNode(b);while(b&&!d(b));b=b instanceof ji&&b.isSimpleReporter()?b.getFields().next().value:b;b instanceof qq&&(vg(this),of(),a=b.getSourceBlock(),b.isFullBlockField()&&a&&a instanceof ji?$.t().focusNode(a):$.t().focusNode(b),
|
|
1670
1669
|
b.showEditor())}}onHtmlInputChange(){var a=this.value_;this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1);this.sourceBlock_&&Vb()&&this.value_!==a&&w(new (u(v.BLOCK_FIELD_INTERMEDIATE_CHANGE))(this.sourceBlock_,this.name||null,a,this.value_))}setEditorValue_(a,b=!0){this.isDirty_=!0;this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(a));this.setValue(a,b)}resizeEditor_(){cd().then(()=>{var a=this.getSourceBlock();if(!a)throw new Dj;var b=mg;if(b){var c=this.getScaledBBox();
|
|
1671
|
-
b.style.width=c.right-c.left+"px";b.style.height=c.bottom-c.top+"px";a=a.RTL?c.right-b.offsetWidth:c.left;c=c.top;var d=b==null?void 0:b.parentElement;d&&(
|
|
1672
|
-
|
|
1673
|
-
|
|
1670
|
+
b.style.width=c.right-c.left+"px";b.style.height=c.bottom-c.top+"px";a=a.RTL?c.right-b.offsetWidth:c.left;c=c.top;var d=b==null?void 0:b.parentElement;d&&({x:a,y:c}=ec(a,c,d));b.style.left=`${a}px`;b.style.top=`${c}px`}})}repositionForWindowResize(){var a=this.getSourceBlock(),b=this.workspace_;if(!(a instanceof ji))return!1;this.resizeEditor_();a=this.getClickTarget_();if(!a||!b)return!0;a=cc.from(a.getBoundingClientRect());var c=pc(b,a.getOrigin()),d=b.scale;b.scrollBoundsIntoView(cc.createFromPoint(c,
|
|
1671
|
+
a.getWidth()/d,a.getHeight()/d));return!0}positionTextElement_(a,b){var c=a*2+b;super.positionTextElement_(a+(c<14?(14-c)/2:0),b)}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(a){return`${a}`}getValueFromEditorText_(a){return a}getAriaTypeName(){return this.ariaTypeName||$.C.ARIA_TYPE_FIELD_INPUT}getAriaValue(){return this.getText()||$.C.FIELD_LABEL_EMPTY}recomputeAriaContext(){if(!super.recomputeAriaContext())return!1;var a=this.getFocusableElement(),
|
|
1672
|
+
b=this.computeAriaLabel(!0),c,d=this.isCurrentlyEditable()&&!((c=this.getSourceBlock())==null?0:c.isInFlyout);if(this.isFullBlockField()){if(c=Ce(this.getSourceBlock(),we.STANDARD,b),d){b=c.split(", ");d=xe(this.getSourceBlock());d=d===void 0?-1:b.indexOf(d);d=d===-1?0:d+1;let e;b[d]=$.C.FIELD_LABEL_EDIT_PREFIX.replace("%1",(e=b[d])!=null?e:"");b=b.join(", ")}}else d&&(b=$.C.FIELD_LABEL_EDIT_PREFIX.replace("%1",b));l(a,p.LABEL,b);return!0}};qq.BORDERRADIUS=4;ta("\n .blocklyInputWarningIconShape {\n stroke: #1f1f1f;\n stroke-width: 1px;\n fill: none;\n }\n .blocklyInputWarningIconSymbol {\n fill: #1f1f1f;\n }\n .blocklyInputWarning {\n display: none;\n position: absolute;\n }\n .blocklyInputWarning.blocklyInputWarningInvalid {\n display: inline;\n }\n");var rq=class extends op{constructor(a){super(a)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(a){return!!a.outputConnection}hasRightSquareCorner(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection}};var sk=class extends Fp{constructor(a,b){super(a,b);this.connectedBottomNextConnection=!1;if(this.connectedBlock){for(a=this.connectedBlock;b=a.getNextBlock();)a=b;a.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}};var sq=class extends jp{constructor(a){super(a);this.width=this.height=0;this.type|=Q.getType("RIGHT_CONNECTION")}};var tq=class extends Gp{constructor(a){super(a)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(a){var b=(a.hat?a.hat==="cap":this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b}hasRightSquareCorner(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection}};var uq=class extends Kp{constructor(a,b){super(a,b);this.isInline=!0;this.renderer_=a;this.constants_=this.renderer_.getConstants();this.topRow=new tq(this.constants_);this.bottomRow=new rq(this.constants_);this.isMultiRow=!b.getInputsInline()||b.isCollapsed();this.hasStatementInput=b.statementInputCount>0;this.rightSide=this.outputConnection?new sq(this.constants_):null;this.rightAlignedDummyInputs=new WeakMap}getRenderer(){return this.renderer_}measure(){this.createRows_();this.addElemSpacing_();
|
|
1674
1673
|
this.addRowSpacing_();this.adjustXPosition_();this.computeBounds_();this.alignRowElements_();this.finalize_()}shouldStartNewRow_(a,b){return b?b instanceof eo||a instanceof fo||b instanceof fo?!0:a instanceof $.go||a instanceof co||a instanceof eo?!this.isInline||this.isMultiRow:!1:!1}getDesiredRowWidth_(a){return a.hasStatement?this.width-this.startX-(this.constants_.INSIDE_CORNERS.rightWidth||0):super.getDesiredRowWidth_(a)}getInRowSpacing_(a,b){return a&&b||!this.outputConnection||!this.outputConnection.isDynamicShape||
|
|
1675
1674
|
this.hasStatementInput||this.bottomRow.hasNextConnection?!a&&b&&Q.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:a&&Q.isLeftRoundedCorner(a)&&b&&(Q.isPreviousConnection(b)||Q.isNextConnection(b))?b.notchOffset-this.constants_.CORNER_RADIUS:a&&Q.isLeftSquareCorner(a)&&b&&Q.isHat(b)||a&&Q.isField(a)&&a.width===0?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING}getSpacerRowHeight_(a,b){if(Q.isTopRow(a)&&Q.isBottomRow(b))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;
|
|
1676
1675
|
var c=Q.isInputRow(a)&&a.hasStatement,d=Q.isInputRow(b)&&b.hasStatement;return d||c?(a=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||0),d&&c?Math.max(a,this.constants_.DUMMY_INPUT_MIN_HEIGHT):a):Q.isTopRow(a)?a.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):Q.isBottomRow(b)?this.outputConnection?!b.hasNextConnection&&this.hasStatementInput?Math.abs(this.constants_.NOTCH_HEIGHT-
|
|
@@ -1686,8 +1685,8 @@ null||e&&e.outputConnection&&(e.statementInputCount||e.nextConnection)||c===d.SH
|
|
|
1686
1685
|
2;d<this.rows.length-1;d+=2){let e=this.rows[d-1],f=this.rows[d],g=this.rows[d+1];var a=d===2,b=d+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!g.precedesStatement;if(a?this.topRow.hasPreviousConnection:e.followsStatement){var c=f.elements[1];c=f.elements.length===3&&c instanceof sp&&(c.field instanceof xo||c.field instanceof pq);if(!a&&c)e.height-=this.constants_.SMALL_PADDING,g.height-=this.constants_.SMALL_PADDING,f.height-=this.constants_.MEDIUM_PADDING;else if(!a&&!b)e.height+=this.constants_.SMALL_PADDING;
|
|
1687
1686
|
else if(b){a=!1;for(b=0;b<f.elements.length;b++)if(c=f.elements[b],Q.isInlineInput(c)&&c.connectedBlock&&!c.connectedBlock.isShadow()&&c.connectedBlock.getHeightWidth().height>=40){a=!0;break}a&&(e.height-=this.constants_.SMALL_PADDING,g.height-=this.constants_.SMALL_PADDING)}}}}finalize_(){this.finalizeOutputConnection_();this.finalizeHorizontalAlignment_();this.finalizeVerticalAlignment_();super.finalize_();this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}};var vq=class extends Lp{constructor(a,b,c){super(a,b,c);this.svgPathSelected=null;this.outlines=new Map;this.remainingOutlines=new Set;this.outputShapeType=null;this.constants=c}setPath(a){super.setPath(a);this.svgPathSelected&&this.svgPathSelected.setAttribute("d",a)}applyColour(a){super.applyColour(a);var b=a.getParent();a.isShadow()&&b&&this.svgPath.setAttribute("stroke",b.getColourTertiary());for(let c of this.outlines.values())c.setAttribute("fill",this.style.colourTertiary)}flipRTL(){super.flipRTL();
|
|
1688
1687
|
for(let b of this.outlines.values())b.setAttribute("transform","scale(-1 1)");var a;(a=this.svgPathSelected)==null||a.setAttribute("transform","scale(-1 1)")}updateSelected(a){this.setClass_("blocklySelected",a);a?this.svgPathSelected||(this.svgPathSelected=r(q.PATH,{"class":"blocklyPath blocklyPathSelected",stroke:this.svgPath.getAttribute("stroke")||"",fill:this.svgPath.getAttribute("fill")||"",d:this.svgPath.getAttribute("d")||"",transform:this.svgPath.getAttribute("transform")||"",role:Ka.NONE},
|
|
1689
|
-
this.svgRoot),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&(this.svgRoot.removeChild(this.svgPathSelected),this.svgPathSelected=null)}beginDrawing(){this.remainingOutlines.clear();for(let a of this.outlines.keys())this.remainingOutlines.add(a)}endDrawing(){if(this.remainingOutlines.size)for(let a of this.remainingOutlines)this.removeOutlinePath(a);this.remainingOutlines.clear()}setOutlinePath(a,b){a=this.getOutlinePath(a);a.setAttribute("d",b);a.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(a){this.outlines.has(a)
|
|
1690
|
-
|
|
1688
|
+
this.svgRoot),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&(this.svgRoot.removeChild(this.svgPathSelected),this.svgPathSelected=null)}beginDrawing(){this.remainingOutlines.clear();for(let a of this.outlines.keys())this.remainingOutlines.add(a)}endDrawing(){if(this.remainingOutlines.size)for(let a of this.remainingOutlines)this.removeOutlinePath(a);this.remainingOutlines.clear()}setOutlinePath(a,b){a=this.getOutlinePath(a);a.setAttribute("d",b);a.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(a){if(!this.outlines.has(a)){let b=
|
|
1689
|
+
r(q.PATH,{"class":"blocklyOutlinePath",d:""},this.svgRoot);l(b,p.HIDDEN,!0);this.outlines.set(a,b)}this.remainingOutlines.delete(a);return this.outlines.get(a)}removeOutlinePath(a){var b,c;(b=this.outlines.get(a))==null||(c=b.parentNode)==null||c.removeChild(this.outlines.get(a));this.outlines.delete(a)}};var wq=class extends Mp{constructor(a){super(a)}makeConstants_(){return new nq}makeRenderInfo_(a){return new uq(this,a)}makeDrawer_(a,b){return new oq(a,b)}makePathObject(a,b){return new vq(a,b,this.getConstants())}getConstants(){return this.constants_}shouldHighlightConnection(a){return super.shouldHighlightConnection(a)||a.type===G.INPUT_VALUE}};Mj("zelos",wq);var xq=class{constructor(a){this.staticConn=this.draggedConn=this.markerConn=this.fadedBlock=null;this.workspace=a.workspace;this.insertionMarker=new bq}previewReplacement(a,b,c){$.Ub++;try{this.hidePreview(),this.fadedBlock=c,c.fadeForReplacement(!0),this.workspace.getRenderer().shouldHighlightConnection(b)&&(b.highlight(),this.staticConn=b)}finally{$.Ub--}}previewConnection(a,b){if(a!==this.draggedConn||b!==this.staticConn){$.Ub++;try{this.hidePreview(),this.shouldUseMarkerPreview(a,b)&&(this.shouldUseFastInsertionMarkers()?
|
|
1691
1690
|
this.insertionMarker.show(b,a):this.markerConn=this.previewMarker(a,b)),this.workspace.getRenderer().shouldHighlightConnection(b)&&b.highlight(),this.workspace.getRenderer().shouldHighlightConnection(a)&&a.highlight(),this.draggedConn=a,this.staticConn=b}finally{$.Ub--}}}shouldUseMarkerPreview(a,b){return b.type===G.PREVIOUS_STATEMENT||b.type===G.NEXT_STATEMENT||!(this.workspace.getRenderer()instanceof wq)}previewMarker(a,b){var c=a.getSourceBlock(),d=this.createInsertionMarker(c),e=this.getMatchingConnection(c,
|
|
1692
1691
|
d,a);if(!e)return null;d.queueRender();dd();e.connect(b);var f={x:b.x-e.x,y:b.y-e.y},g=e.getOffsetInBlock().clone();cd().then(()=>{if(!d.isDeadOrDying()){$.Ub++;try{d==null||d.positionNearConnection(e,f,g),d==null||d.getSvgRoot().setAttribute("visibility","visible")}finally{$.Ub--}}});return e}serializeBlockToInsertionMarker(a){var b=ce(a,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!b)throw Error(`Failed to serialize source block. ${a.toDevString()}`);return b}createInsertionMarker(a){a=
|
|
1693
1692
|
this.serializeBlockToInsertionMarker(a);a=ee(a,this.workspace);for(let b of a.getDescendants(!1))b.setInsertionMarker(!0);a.initSvg();a.getSvgRoot().setAttribute("visibility","hidden");return a}getMatchingConnection(a,b,c){a=a.getConnections_(!0);b=b.getConnections_(!0);if(a.length!==b.length)return null;for(let d=0;d<a.length;d++)if(a[d]===c)return b[d];return null}hidePreview(){$.Ub++;try{this.staticConn&&(this.staticConn.unhighlight(),this.staticConn=null),this.draggedConn&&(this.draggedConn.unhighlight(),
|
|
@@ -1712,7 +1711,7 @@ b);a=this.getX();b=this.getY();this.positionAt_(this.getWidth(),this.getHeight()
|
|
|
1712
1711
|
-this.CORNER_RADIUS),d.push("h",a),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("v",b),d.push("h",-a-2*this.CORNER_RADIUS));d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))}scrollToStart(){var a;(a=this.workspace_.scrollbar)==null||a.setX(this.RTL?Infinity:0)}wheel_(a){var b=qa(a);if(b=b.x||b.y){let c=this.workspace_.getMetricsManager(),d=c.getScrollMetrics();b=c.getViewMetrics().left-d.left+b;let e;(e=this.workspace_.scrollbar)==
|
|
1713
1712
|
null||e.setX(b);wg(this.workspace_);of()}a.preventDefault();a.stopPropagation()}layout_(a){this.workspace_.scale=this.targetWorkspace.scale;var b=this.MARGIN,c=b+this.tabWidth_;this.RTL&&(a=a.reverse());for(let d of a)a=d.getElement().getBoundingRectangle(),a=this.RTL?c+a.getWidth():c,d.getElement().moveBy(a,b),c+=d.getElement().getBoundingRectangle().getWidth()}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.top;return this.toolboxPosition_===
|
|
1714
1713
|
E.TOP?new cc(-1E9,b+a.height,-1E9,1E9):new cc(b,1E9,-1E9,1E9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();var a=this.getContents().reduce((b,c)=>Math.max(b,c.getElement().getBoundingRectangle().getHeight()),0);a+=this.MARGIN*1.5;a*=this.workspace_.scale;a+=Ic.scrollbarThickness;this.getHeight()!==a&&(this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==E.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+
|
|
1715
|
-
a),this.height_=a,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets())}};A(y.FLYOUTS_HORIZONTAL_TOOLBOX,"default",Bq);var Cq=class extends zh{constructor(a,b,c,d,e){super(rg.SKIP_SETUP);this.defaultType="";this.variableTypes=[];this.variable=null;this.SERIALIZABLE=!0;this.menuGenerator_=Cq.dropdownCreate;this.defaultVariableName=typeof a==="string"?a:"";this.size_=new
|
|
1714
|
+
a),this.height_=a,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets())}};A(y.FLYOUTS_HORIZONTAL_TOOLBOX,"default",Bq);var Cq=class extends zh{constructor(a,b,c,d,e){super(rg.SKIP_SETUP);this.defaultType="";this.variableTypes=[];this.variable=null;this.SERIALIZABLE=!0;this.menuGenerator_=Cq.dropdownCreate;this.defaultVariableName=typeof a==="string"?a:"";this.size_=new ic(0,0);a!==rg.SKIP_SETUP&&(e?this.configure_(e):this.setTypes(c,d),b&&this.setValidator(b))}configure_(a){super.configure_(a);this.setTypes(a.variableTypes,a.defaultType)}initModel(){var a=this.getSourceBlock();if(!a)throw new Dj;this.variable||(a=
|
|
1716
1715
|
$.Wd(a.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(a.getId()))}initView(){super.initView();n(this.fieldGroup_,"blocklyVariableField")}shouldAddBorderRect_(){var a=this.getSourceBlock();if(!a)throw new Dj;return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||a.type!=="variables_get")}fromXml(a){var b=this.getSourceBlock();if(!b)throw new Dj;var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||
|
|
1717
1716
|
"";b=$.Wd(b.workspace,c,d,e);if(e!==null&&e!==b.getType())throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.getType()+", and does not match variable field that references it: "+ae(a)+".");this.setValue(b.getId())}toXml(a){this.initModel();a.id=this.variable.getId();a.textContent=this.variable.getName();this.variable.getType()&&a.setAttribute("variabletype",this.variable.getType());return a}saveState(a){var b=this.saveLegacyState(Cq);if(b!==null)return b;this.initModel();b=
|
|
1718
1717
|
{id:this.variable.getId()};a&&(b.name=this.variable.getName(),b.type=this.variable.getType());return b}loadState(a){var b=this.getSourceBlock();if(!b)throw new Dj;this.loadLegacyState(Cq,a)||(a=$.Wd(b.workspace,a.id||null,a.name,a.type||""),this.setValue(a.getId()))}setSourceBlock(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(a)}getValue(){return this.variable?this.variable.getId():null}getText(){return this.variable?this.variable.getName():
|
|
@@ -1732,17 +1731,17 @@ void 0,a)}recomputeAriaContext(){if(!super.recomputeAriaContext())return!1;var a
|
|
|
1732
1731
|
this.draggable)),this.updateDragTarget(a)}updateDragTarget(a){a=this.draggable.workspace.getDragTarget(a);if(this.dragTarget!==a){let b;(b=this.dragTarget)==null||b.onDragExit(this.draggable);a==null||a.onDragEnter(this.draggable)}a==null||a.onDragOver(this.draggable);this.dragTarget=a}moveDraggable(a,b){b=this.pixelsToWorkspaceUnits(b);b=D.sum(this.startLoc,b);this.draggable.drag(b,a)}wouldDeleteDraggable(a,b){return(a=this.draggable.workspace.getDragTarget(a))&&this.draggable.workspace.getComponentManager().hasCapability(a.id,
|
|
1733
1732
|
Wk.Capability.DELETE_AREA)?a.wouldDelete(b):!1}onDragEnd(a){var b=$.gd,c=a instanceof PointerEvent?a:null;if(c){c=new D(c.clientX,c.clientY);if(this.draggable.workspace.getDragTarget(c)){var d;(d=this.dragTarget)==null||d.onDrop(this.draggable)}d=!1;this.shouldReturnToStart(c,this.draggable)&&(d=!0,this.draggable.revertDrag());(c=gi(this.draggable)&&this.wouldDeleteDraggable(c,this.draggable))&&gi(this.draggable)?(this.draggable.endDrag(a,no.DELETE),$.B(b),this.draggable.dispose()):this.draggable.endDrag(a,
|
|
1734
1733
|
d?no.REVERT:no.COMMIT);$.B(!1);!c&&ab(this.draggable)&&$.t().focusNode(this.draggable)}else this.draggable.endDrag(a,no.COMMIT),ab(this.draggable)&&$.t().focusNode(this.draggable)}onDragRevert(a){this.revertShouldDelete&&gi(this.draggable)?(this.draggable.endDrag(a,no.DELETE),this.draggable.dispose()):(this.draggable.revertDrag(),ab(this.draggable)&&$.t().focusNode(this.draggable))}shouldReturnToStart(a,b){return(a=this.draggable.workspace.getDragTarget(a))?a.shouldPreventMove(b):!1}pixelsToWorkspaceUnits(a){a=
|
|
1735
|
-
new D(a.x/this.draggable.workspace.scale,a.y/this.draggable.workspace.scale);this.draggable.workspace.isMutator&&a.scale(1/this.draggable.workspace.options.parentWorkspace.scale);return a}};A(y.BLOCK_DRAGGER,"default",Hq);var Iq={};Iq.BlockDragStrategy=wo;Iq.BubbleDragStrategy=Jn;Iq.CommentDragStrategy=wn;Iq.Dragger=Hq;var Jq={};Jq.BottomRow=rq;Jq.ConstantProvider=nq;Jq.Drawer=oq;Jq.PathObject=vq;Jq.RenderInfo=uq;Jq.Renderer=wq;Jq.RightConnectionShape=sq;Jq.StatementInput=sk;Jq.TopRow=tq;Bk();var Kq={};Kq.registerCleanup=
|
|
1734
|
+
new D(a.x/this.draggable.workspace.scale,a.y/this.draggable.workspace.scale);this.draggable.workspace.isMutator&&a.scale(1/this.draggable.workspace.options.parentWorkspace.scale);return a}};A(y.BLOCK_DRAGGER,"default",Hq);var Iq={};Iq.BlockDragStrategy=wo;Iq.BubbleDragStrategy=Jn;Iq.CommentDragStrategy=wn;Iq.Dragger=Hq;var Jq={};Jq.BottomRow=rq;Jq.ConstantProvider=nq;Jq.Drawer=oq;Jq.PathObject=vq;Jq.RenderInfo=uq;Jq.Renderer=wq;Jq.RightConnectionShape=sq;Jq.StatementInput=sk;Jq.TopRow=tq;Bk();var Kq={};Kq.registerCleanup=gk;Kq.registerCollapse=jk;Kq.registerCollapseExpandBlock=uk;Kq.registerComment=rk;Kq.registerCommentCreate=Ak;Kq.registerCommentDelete=yk;Kq.registerCommentDuplicate=zk;Kq.registerCommentOptions=function(){zk();yk();Ak()};Kq.registerDefaultOptions=Bk;Kq.registerDelete=wk;Kq.registerDeleteAll=ok;Kq.registerDisable=vk;Kq.registerDuplicate=pk;Kq.registerExpand=kk;Kq.registerHelp=xk;Kq.registerInline=tk;Kq.registerRedo=fk;Kq.registerUndo=ek;var Lq=class{canConnect(a,b,c,d){return this.canConnectWithReason(a,b,c,d)===Un.CAN_CONNECT}canConnectWithReason(a,b,c,d){var e=this.doSafetyChecks(a,b);return e!==Un.CAN_CONNECT?e:this.doTypeChecks(a,b)?c&&!this.doDragChecks(a,b,d||0)?Un.REASON_DRAG_CHECKS_FAILED:Un.CAN_CONNECT:Un.REASON_CHECKS_FAILED}getErrorMessage(a,b,c){switch(a){case Un.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Un.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Un.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";
|
|
1736
1735
|
case Un.REASON_TARGET_NULL:return"Target connection is null.";case Un.REASON_CHECKS_FAILED:return"Connection checks failed. "+(b+" expected "+b.getCheck()+", found "+c.getCheck());case Un.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case Un.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case Un.REASON_PREVIOUS_AND_OUTPUT:return"Block would have an output and a previous connection.";default:return"Unknown connection failure: this should never happen!"}}doSafetyChecks(a,
|
|
1737
1736
|
b){if(!a||!b)return Un.REASON_TARGET_NULL;if(a.isSuperior()){var c=a.getSourceBlock();var d=b.getSourceBlock();var e=b}else d=a.getSourceBlock(),c=b.getSourceBlock(),e=a,a=b;return c===d?Un.REASON_SELF_CONNECTION:e.type!==Zn[a.type]?Un.REASON_WRONG_TYPE:c.workspace!==d.workspace?Un.REASON_DIFFERENT_WORKSPACES:c.isShadow()&&!d.isShadow()?Un.REASON_SHADOW_PARENT:e.type===G.OUTPUT_VALUE&&d.previousConnection&&d.previousConnection.isConnected()||e.type===G.PREVIOUS_STATEMENT&&d.outputConnection&&d.outputConnection.isConnected()?
|
|
1738
1737
|
Un.REASON_PREVIOUS_AND_OUTPUT:Un.CAN_CONNECT}doTypeChecks(a,b){a=a.getCheck();b=b.getCheck();if(!a||!b)return!0;for(let c=0;c<a.length;c++)if(b.includes(a[c]))return!0;return!1}doDragChecks(a,b,c){if(a.distanceFrom(b)>c||b.getSourceBlock().isInsertionMarker())return!1;switch(b.type){case G.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(a,b);case G.OUTPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isInsertionMarker()||a.isConnected())return!1;break;case G.INPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isMovable()&&
|
|
1739
1738
|
!b.targetBlock().isShadow())return!1;break;case G.NEXT_STATEMENT:if(b.isConnected()&&!a.getSourceBlock().nextConnection&&!b.targetBlock().isShadow()&&b.targetBlock().nextConnection||b.targetBlock()&&!b.targetBlock().isMovable()&&!b.targetBlock().isShadow())return!1;break;default:return!1}return nl.includes(b)?!1:!0}canConnectToPrevious_(a,b){if(a.targetConnection||nl.includes(b))return!1;if(!b.targetConnection)return!0;a=b.targetBlock();return a.isInsertionMarker()?!a.getPreviousBlock():!1}};
|
|
1740
|
-
A(y.CONNECTION_CHECKER,"default",Lq);var Mq=class{load(a,b){a=new Ii(b.getWorkspace(),b.targetWorkspace,a,!1);a.show();return new Co(a,"button")}gapForItem(a,b){return b}disposeItem(a){a=a.getElement();a instanceof Ii&&a.dispose()}getType(){return"button"}};A(y.FLYOUT_INFLATER,"button",Mq);var Nq={};Nq.Bubble=Ln;Nq.MiniWorkspaceBubble=Mn;Nq.TextBubble=yo;Nq.TextInputBubble=Sn;var Oq=class{constructor(){this.permanentlyDisabledBlocks=new Set;this.listeners=new Map;this.capacityWrapper=this.filterFlyoutBasedOnCapacity.bind(this)}load(a,b){this.setFlyout(b);
|
|
1741
|
-
{var
|
|
1742
|
-
"x"in a&&delete a.x,"y"in a&&delete a.y,b=de(a,b));return b}gapForItem(a,b){if(a.gap)var c=parseInt(String(a.gap));else a.blockxml&&(a=typeof a.blockxml==="string"?$.
|
|
1743
|
-
a){if(this.flyout){let c;(c=this.flyout.targetWorkspace)==null||c.removeChangeListener(this.capacityWrapper)}this.flyout=a;var b;(b=this.flyout.targetWorkspace)==null||b.addChangeListener(this.capacityWrapper)}}updateStateBasedOnCapacity(a){for(var b,c,d=(b=this.flyout)==null?void 0:(c=b.targetWorkspace)==null?void 0:c.isCapacityAvailable(ub(a));a;)a.setDisabledReason(!d,"WORKSPACE_AT_BLOCK_CAPACITY"),a=a.getNextBlock()}addBlockListeners(a){var b=
|
|
1744
|
-
e,f=(d=this.flyout)==null?void 0:(e=d.targetWorkspace)==null?void 0:e.getGesture(c);f&&this.flyout&&(f.setStartBlock(a),f.handleFlyoutStart(c,this.flyout))}));b.push(ka(a.getSvgRoot(),"pointermove",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.addSelect()}));b.push(ka(a.getSvgRoot(),"pointerleave",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.removeSelect()}));
|
|
1745
|
-
a&&a.type!==v.BLOCK_CREATE&&a.type!==v.BLOCK_DELETE||this.flyout.getWorkspace().getTopBlocks(!1).forEach(b=>{this.permanentlyDisabledBlocks.has(b)||this.updateStateBasedOnCapacity(b)})}getType(){return"block"}};A(y.FLYOUT_INFLATER,"block",Oq);var Pq={};Pq.ConstantProvider=cq;Pq.Drawer=eq;Pq.HighlightConstantProvider=fq;Pq.Highlighter=dq;Pq.InlineInput=gq;Pq.PathObject=jq;Pq.RenderInfo=iq;Pq.Renderer=kq;Pq.StatementInput=hq;var Qq={};Qq.RenderInfo=lq;Qq.Renderer=mq;var Rq=new Gn("zelos",{colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",colourTertiary:"#389438"},procedure_blocks:{colourPrimary:"#FF6680",
|
|
1739
|
+
A(y.CONNECTION_CHECKER,"default",Lq);var Mq=class{load(a,b){a=new Ii(b.getWorkspace(),b.targetWorkspace,a,!1);a.show();return new Co(a,"button")}gapForItem(a,b){return b}disposeItem(a){a=a.getElement();a instanceof Ii&&a.dispose()}getType(){return"button"}};A(y.FLYOUT_INFLATER,"button",Mq);var Nq={};Nq.Bubble=Ln;Nq.MiniWorkspaceBubble=Mn;Nq.TextBubble=yo;Nq.TextInputBubble=Sn;var Oq=class{constructor(){this.permanentlyDisabledBlocks=new Set;this.listeners=new Map;this.capacityWrapper=this.filterFlyoutBasedOnCapacity.bind(this)}load(a,b){this.setFlyout(b);var c=this.createBlock(a,b.getWorkspace());c.isEnabled()?this.updateStateBasedOnCapacity(c):this.permanentlyDisabledBlocks.add(c);c.getDescendants(!1).forEach(e=>{e.isInFlyout=!0;var f=e.getFocusableElement(),g=e.pathObject.svgPath;g!==f&&(l(g,p.HIDDEN,!0),ya(g,Ka.NONE));e===c?ya(f,Ka.OPTION):(l(f,p.HIDDEN,!0),ya(f,Ka.NONE))});
|
|
1740
|
+
a=c.getIcons().filter(e=>{var f;return(f=e.isClickableInFlyout)==null?void 0:f.call(e,b.autoClose)}).map(e=>e.getFocusableElement().id).filter(e=>!!e);var d=c.getConnections_(!0).map(e=>e.id);a=[...a,...d];a.length&&l(c.getFocusableElement(),p.OWNS,a);this.addBlockListeners(c);return new Co(c,"block")}createBlock(a,b){a.blockxml?(a=typeof a.blockxml==="string"?$.vc(a.blockxml):a.blockxml,b=Ng(a,b)):(a.enabled===void 0&&(a.enabled=a.disabled!=="true"&&a.disabled!==!0),a.disabledReasons===void 0&&a.enabled===
|
|
1741
|
+
!1&&(a.disabledReasons=["MANUALLY_DISABLED"]),"x"in a&&delete a.x,"y"in a&&delete a.y,b=de(a,b));return b}gapForItem(a,b){if(a.gap)var c=parseInt(String(a.gap));else a.blockxml&&(a=typeof a.blockxml==="string"?$.vc(a.blockxml):a.blockxml,c=parseInt(a.getAttribute("gap")));return!c||isNaN(c)?b:c}disposeItem(a){a=a.getElement();a instanceof ji&&(this.removeListeners(a.id),this.permanentlyDisabledBlocks.delete(a),a.dispose(!1,!1))}removeListeners(a){var b;((b=this.listeners.get(a))!=null?b:[]).forEach(c=>
|
|
1742
|
+
la(c));this.listeners.delete(a)}setFlyout(a){if(this.flyout!==a){if(this.flyout){let c;(c=this.flyout.targetWorkspace)==null||c.removeChangeListener(this.capacityWrapper)}this.flyout=a;var b;(b=this.flyout.targetWorkspace)==null||b.addChangeListener(this.capacityWrapper)}}updateStateBasedOnCapacity(a){for(var b,c,d=(b=this.flyout)==null?void 0:(c=b.targetWorkspace)==null?void 0:c.isCapacityAvailable(ub(a));a;)a.setDisabledReason(!d,"WORKSPACE_AT_BLOCK_CAPACITY"),a=a.getNextBlock()}addBlockListeners(a){var b=
|
|
1743
|
+
[];b.push(k(a.getSvgRoot(),"pointerdown",a,c=>{var d,e,f=(d=this.flyout)==null?void 0:(e=d.targetWorkspace)==null?void 0:e.getGesture(c);f&&this.flyout&&(f.setStartBlock(a),f.handleFlyoutStart(c,this.flyout))}));b.push(ka(a.getSvgRoot(),"pointermove",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.addSelect()}));b.push(ka(a.getSvgRoot(),"pointerleave",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.removeSelect()}));
|
|
1744
|
+
this.listeners.set(a.id,b)}filterFlyoutBasedOnCapacity(a){!this.flyout||a&&a.type!==v.BLOCK_CREATE&&a.type!==v.BLOCK_DELETE||this.flyout.getWorkspace().getTopBlocks(!1).forEach(b=>{this.permanentlyDisabledBlocks.has(b)||this.updateStateBasedOnCapacity(b)})}getType(){return"block"}};A(y.FLYOUT_INFLATER,"block",Oq);var Pq={};Pq.ConstantProvider=cq;Pq.Drawer=eq;Pq.HighlightConstantProvider=fq;Pq.Highlighter=dq;Pq.InlineInput=gq;Pq.PathObject=jq;Pq.RenderInfo=iq;Pq.Renderer=kq;Pq.StatementInput=hq;var Qq={};Qq.RenderInfo=lq;Qq.Renderer=mq;var Rq=new Gn("zelos",{colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",colourTertiary:"#389438"},procedure_blocks:{colourPrimary:"#FF6680",
|
|
1746
1745
|
colourSecondary:"#FF4D6A",colourTertiary:"#FF3355"},text_blocks:{colourPrimary:"#FFBF00",colourSecondary:"#E6AC00",colourTertiary:"#CC9900"},variable_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},variable_dynamic_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},hat_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC",hat:"cap"}},{colour_category:{colour:"#CF63CF"},list_category:{colour:"#9966FF"},
|
|
1747
1746
|
logic_category:{colour:"#4C97FF"},loop_category:{colour:"#0fBD8C"},math_category:{colour:"#59C059"},procedure_category:{colour:"#FF6680"},text_category:{colour:"#FFBF00"},variable_category:{colour:"#FF8C1A"},variable_dynamic_category:{colour:"#FF8C1A"}});var Sq={Classic:Hn,Zelos:Rq};var Tq=class{constructor(a,b,c){this.id_=a.toolboxitemid||Lb();this.level_=(this.parent_=c||null)?this.parent_.getLevel()+1:0;this.toolboxItemDef_=a;this.parentToolbox_=b;this.workspace_=this.parentToolbox_.getWorkspace()}init(){}getDiv(){return null}getClickTarget(){return null}getId(){return this.id_}getParent(){return null}getLevel(){return this.level_}isSelectable(){return!1}isCollapsible(){return!1}dispose(){}setVisible_(){}getFocusableElement(){var a=this.getDiv();if(!a)throw Error("Trying to access toolbox item before DOM is initialized.");
|
|
1748
1747
|
if(!(a instanceof HTMLElement))throw Error("Toolbox item div is unexpectedly not an HTML element.");return a}getFocusableTree(){return this.parentToolbox_}onNodeFocus(){this.getFocusableElement().scrollIntoView({block:"nearest",inline:"nearest"})}onNodeBlur(){}canBeFocused(){return!0}getParentToolbox(){return this.parentToolbox_}};var Uq=class extends Tq{constructor(a,b,c){super(a,b,c);this.colour_=this.name_="";this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null;this.isDisabled_=this.isHidden_=!1;this.flyoutItems_=[];this.cssConfig_=this.makeDefaultCssConfig_()}init(){this.parseCategoryDef_(this.toolboxItemDef_);this.parseContents_(this.toolboxItemDef_);this.createDom_();this.toolboxItemDef_.hidden==="true"&&this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategoryContainer",row:"blocklyToolboxCategory",
|
|
@@ -1755,7 +1754,7 @@ if(a)return this.parseColour(a)}return""}getColour(){return this.colour_}getColo
|
|
|
1755
1754
|
a);return""}return eg(b)}openIcon_(a){if(a){var b=this.cssConfig_.closedicon;b&&La(a,b);(b=this.cssConfig_.openicon)&&n(a,b)}}closeIcon_(a){if(a){var b=this.cssConfig_.openicon;b&&La(a,b);(b=this.cssConfig_.closedicon)&&n(a,b)}}setVisible_(a){this.htmlDiv_.style.display=a?"block":"none";this.isHidden_=!a;this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}hide(){this.setVisible_(!1)}show(){this.setVisible_(!0)}isVisible(){return!this.isHidden_&&this.allAncestorsExpanded_()}allAncestorsExpanded_(){for(var a=
|
|
1756
1755
|
this;a.getParent();)if(a=a.getParent(),!a.isExpanded())return!1;return!0}isSelectable(){return this.isVisible()&&!this.isDisabled_}onClick(){}setSelected(a){if(this.rowDiv_){var b=this.cssConfig_.selected;if(a){let c=this.parseColour(Uq.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||c;b&&n(this.rowDiv_,b)}else this.rowDiv_.style.backgroundColor="",b&&Ma(this.rowDiv_,b);l(this.htmlDiv_,p.SELECTED,a)}}setDisabled(a){this.isDisabled_=a;this.getDiv().setAttribute("disabled",
|
|
1757
1756
|
`${a}`);a?this.getDiv().setAttribute("disabled","true"):this.getDiv().removeAttribute("disabled")}getName(){return this.name_}getParent(){return this.parent_}getDiv(){return this.htmlDiv_}onNodeFocus(){super.onNodeFocus();this.getParentToolbox().getSelectedItem()!==this&&this.getParentToolbox().setSelectedItem(this)}getContents(){return this.flyoutItems_}updateFlyoutContents(a){this.flyoutItems_=[];this.toolboxItemDef_=typeof a==="string"?{kind:this.toolboxItemDef_.kind,custom:a,id:this.toolboxItemDef_.id,
|
|
1758
|
-
categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden}:{kind:this.toolboxItemDef_.kind,name:"name"in this.toolboxItemDef_?this.toolboxItemDef_.name:"",contents:
|
|
1757
|
+
categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden}:{kind:this.toolboxItemDef_.kind,name:"name"in this.toolboxItemDef_?this.toolboxItemDef_.name:"",contents:Ec(a),id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden};this.parseContents_(this.toolboxItemDef_)}dispose(){Oa(this.htmlDiv_)}};
|
|
1759
1758
|
Uq.registrationName="category";Uq.nestedPadding=19;Uq.borderWidth=8;Uq.defaultBackgroundColour="#57e";ta('\n.blocklyToolboxCategory:not(.blocklyToolboxSelected):hover {\n background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolbox[layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 5px 1px 0;\n}\n\n.blocklyToolbox[dir="RTL"][layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 0 1px 5px;\n}\n\n.blocklyToolboxCategory {\n height: 22px;\n line-height: 22px;\n margin-bottom: 3px;\n padding-right: 8px;\n white-space: nowrap;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategory {\n margin-left: 8px;\n padding-right: 0;\n}\n\n.blocklyToolboxCategoryIcon {\n background-image: url(<<<PATH>>>/sprites.svg);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyToolboxCategoryIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategoryIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyToolboxCategoryIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyToolboxCategoryLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyToolboxCategoryLabel {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxSelected .blocklyToolboxCategoryLabel {\n color: #fff;\n}\n');
|
|
1760
1759
|
A(y.TOOLBOX_ITEM,Uq.registrationName,Uq);var Vq=class extends Tq{constructor(a,b){super(a,b);this.cssConfig_={container:"blocklyTreeSeparator"};this.htmlDiv=null;Object.assign(this.cssConfig_,a.cssconfig||a.cssConfig)}init(){this.createDom_()}createDom_(){var a=document.createElement("div");a.id=this.getId();var b=this.cssConfig_.container;b&&n(a,b);ya(a,Ka.NONE);return this.htmlDiv=a}getDiv(){return this.htmlDiv}dispose(){Oa(this.htmlDiv)}canBeFocused(){return!1}};Vq.registrationName="sep";ta('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolbox[layout="h"] .blocklyTreeSeparator {\n border-right: solid #e5e5e5 1px;\n border-bottom: none;\n height: auto;\n margin: 0 5px 0 5px;\n padding: 5px 0;\n width: 0;\n}\n');
|
|
1761
1760
|
A(y.TOOLBOX_ITEM,Vq.registrationName,Vq);var Wq=class extends Uq{constructor(a,b,c){super(a,b,c);this.subcategoriesDiv_=null;this.expanded_=!1;this.toolboxItems_=[]}makeDefaultCssConfig_(){var a=super.makeDefaultCssConfig_();a.contents="blocklyToolboxCategoryGroup";return a}parseContents_(a){if("custom"in a)this.flyoutItems_=a.custom;else{let b=a.contents;if(b){this.flyoutItems_=[];a=!0;for(let c=0;c<b.length;c++){let d=b[c];!Gb(y.TOOLBOX_ITEM,d.kind)||d.kind.toLowerCase()===Vq.registrationName&&a?(this.flyoutItems_.push(d),a=!0):(this.createToolboxItem(d),
|
|
@@ -1785,7 +1784,7 @@ $.Cj.prototype.populateProcedures=function(a){a=zj(a);a=a[0].concat(a[1]);for(le
|
|
|
1785
1784
|
R.CommentBarButtonNavigationPolicy=Ko;R.CommentEditorNavigationPolicy=Lo;R.ComponentManager=Wk;R.Connection=Un;R.ConnectionChecker=Lq;R.ConnectionDB=Tn;R.ConnectionNavigationPolicy=Mo;R.ConnectionType=G;R.ContextMenu=sn;R.ContextMenuItems=Kq;R.ContextMenuRegistry=dk;R.Css=Zk;R.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";R.DeleteArea=Bo;R.Direction=ti;R.DragDisposition=no;R.DragTarget=Ao;R.DropDownDiv=mn;R.Events=N;R.Extensions=Pn;R.Field=rg;R.FieldCheckbox=Gq;R.FieldDropdown=zh;R.FieldImage=pq;
|
|
1786
1785
|
R.FieldLabel=xo;R.FieldLabelSerializable=Fq;R.FieldNavigationPolicy=No;R.FieldNumber=Eq;R.FieldTextInput=$.Dq;R.FieldVariable=Cq;R.Flyout=Zo;R.FlyoutButton=Ii;R.FlyoutButtonNavigationPolicy=Go;R.FlyoutItem=Co;R.FlyoutMetricsManager=Eo;R.FlyoutNavigator=Xo;R.FlyoutSeparator=Fo;R.FlyoutSeparatorNavigationPolicy=Ho;R.FocusManager=$a;R.FocusableTreeTraverser=hl;R.Generator=$.zq;R.Gesture=ap;R.Grid=Vj;R.HorizontalFlyout=Bq;R.INPUT_VALUE=Yq;R.IconNavigationPolicy=Oo;R.Input=bo;
|
|
1787
1786
|
R.InsertionMarkerPreviewer=xq;R.KeyboardMover=si;R.KeyboardNavigationController=dn;R.LabelFlyoutInflater=aq;R.Menu=Ig;R.MenuItem=Kg;R.MetricsManager=Do;R.MoveIndicator=En;R.Msg=$.C;R.NEXT_STATEMENT=$q;R.Names=$.Cj;R.NavigationDirection=Ro;R.Navigator=Uo;R.OPPOSITE_TYPE=Zn;R.OUTPUT_VALUE=Zq;R.Options=In;R.PREVIOUS_STATEMENT=ar;R.PROCEDURE_CATEGORY_NAME="PROCEDURE";R.Procedures=hp;R.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";R.RenderedConnection=Ri;R.Scrollbar=Ic;R.ScrollbarPair=Zj;
|
|
1788
|
-
R.SeparatorFlyoutInflater=Yo;R.ShortcutItems=to;R.ShortcutRegistry=x;R.TOOLBOX_AT_BOTTOM=cr;R.TOOLBOX_AT_LEFT=dr;R.TOOLBOX_AT_RIGHT=er;R.TOOLBOX_AT_TOP=br;R.Theme=Gn;R.ThemeManager=Op;R.Themes=Sq;R.Toast=mi;R.Toolbox=Xq;R.ToolboxCategory=Uq;R.ToolboxItem=Tq;R.ToolboxItemNavigationPolicy=Vo;R.ToolboxNavigator=Wo;R.ToolboxSeparator=Vq;R.Tooltip=on;R.Touch=Ek;R.Trashcan=Vp;R.UnattachedFieldError=Dj;R.VARIABLE_CATEGORY_NAME="VARIABLE";R.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";R.VERSION="13.
|
|
1787
|
+
R.SeparatorFlyoutInflater=Yo;R.ShortcutItems=to;R.ShortcutRegistry=x;R.TOOLBOX_AT_BOTTOM=cr;R.TOOLBOX_AT_LEFT=dr;R.TOOLBOX_AT_RIGHT=er;R.TOOLBOX_AT_TOP=br;R.Theme=Gn;R.ThemeManager=Op;R.Themes=Sq;R.Toast=mi;R.Toolbox=Xq;R.ToolboxCategory=Uq;R.ToolboxItem=Tq;R.ToolboxItemNavigationPolicy=Vo;R.ToolboxNavigator=Wo;R.ToolboxSeparator=Vq;R.Tooltip=on;R.Touch=Ek;R.Trashcan=Vp;R.UnattachedFieldError=Dj;R.VARIABLE_CATEGORY_NAME="VARIABLE";R.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";R.VERSION="13.4.0";
|
|
1789
1788
|
R.VariableMap=Up;R.VariableModel=Tp;R.Variables=en;R.VariablesDynamic=Pp;R.VerticalFlyout=Aq;R.WidgetDiv=rn;R.Workspace=Qp;R.WorkspaceAudio=Rp;R.WorkspaceCommentNavigationPolicy=Po;R.WorkspaceDragger=$o;R.WorkspaceNavigationPolicy=Qo;R.WorkspaceSvg=$h;R.Xml=Cn;R.ZoomControls=Jl;R.blockAnimations=io;R.blockRendering=Np;R.browserEvents=Tk;R.bubbles=Nq;R.bumpObjects=ko;R.clipboard=lo;R.comments=mo;R.common=ol;R.config=$.Og;
|
|
1790
1789
|
R.constants={COLLAPSED_FIELD_NAME:"_TEMP_COLLAPSED_FIELD",COLLAPSED_INPUT_NAME:"_TEMP_COLLAPSED_INPUT",MANUALLY_DISABLED:"MANUALLY_DISABLED"};R.defineBlocksWithJsonArray=xb;R.dialog=Ul;R.dragging=Iq;R.fieldRegistry=Dn;R.geras=Pq;R.getFocusManager=$.t;R.getMainWorkspace=mb;R.getSelected=ob;R.hasBubble=xd;R.hideChaff=function(a){lb.hideChaff(a)};R.icons=dp;
|
|
1791
1790
|
R.inject=function(a,b){var c=null;c=typeof a==="string"?document.getElementById(a)||document.querySelector(a):a;var d;if(!document.contains(c)&&document!==((d=c)==null?void 0:d.ownerDocument))throw Error("Error: container is not in current document");a=new In(b||{});d=document.createElement("div");n(d,"injectionDiv");(b==null?0:b.rtl)&&n(d,"blocklyRTL");ya(d,Ka.APPLICATION);c.appendChild(d);b=Wj(d,a);var e=Xj(d,b,a);bk(e);nb(e);tb(e);d.addEventListener("focusin",function(){nb(e)});k(d,"keydown",null,
|
|
@@ -2448,6 +2447,11 @@ Blockly.Msg["TEXT_TRIM_OPERATOR_LEFT"] = "trim spaces from left side of";
|
|
|
2448
2447
|
Blockly.Msg["TEXT_TRIM_OPERATOR_RIGHT"] = "trim spaces from right side of";
|
|
2449
2448
|
Blockly.Msg["TEXT_TRIM_TOOLTIP"] = "Return a copy of the text with spaces removed from one or both ends.";
|
|
2450
2449
|
Blockly.Msg["TODAY"] = "Today";
|
|
2450
|
+
Blockly.Msg["TOOLBOX_SEARCH_NO_RESULTS"] = "No matching blocks found";
|
|
2451
|
+
Blockly.Msg["TOOLBOX_SEARCH_PLACEHOLDER"] = "Search for blocks";
|
|
2452
|
+
Blockly.Msg["TOOLBOX_SEARCH_PROMPT"] = "Type to search for blocks";
|
|
2453
|
+
Blockly.Msg["TOOLBOX_SEARCH_RESULT_COUNT"] = "%1 matching blocks";
|
|
2454
|
+
Blockly.Msg["TOOLBOX_SEARCH_RESULT_COUNT_ONE"] = "1 matching block";
|
|
2451
2455
|
Blockly.Msg["UNDO"] = "Undo";
|
|
2452
2456
|
Blockly.Msg["UNKNOWN"] = "Unknown";
|
|
2453
2457
|
Blockly.Msg["UNNAMED_KEY"] = "unnamed";
|
|
@@ -2545,12 +2549,12 @@ name:"VALUE",check:["String","Array"],ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_C
|
|
|
2545
2549
|
["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END","%{BKY_TEXT_FROM_END_ARIA}"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);
|
|
2546
2550
|
nr.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[$.C.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START",$.C.TEXT_FROM_START_ARIA],[$.C.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END",$.C.TEXT_FROM_END_ARIA],[$.C.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.C.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START",$.C.TEXT_FROM_START_ARIA],[$.C.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END",$.C.TEXT_FROM_END_ARIA],[$.C.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl($.C.TEXT_GET_SUBSTRING_HELPURL);
|
|
2547
2551
|
this.setStyle("text_blocks");this.appendValueInput("STRING").setCheck("String").appendField($.C.TEXT_GET_SUBSTRING_INPUT_IN_TEXT).setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHECK);var a=b=>{var c=$.lh({type:"field_dropdown",options:this["WHERE_OPTIONS_"+b]});c.setValidator(function(d){var e=this.getValue();d=d==="FROM_START"||d==="FROM_END";d!==(e==="FROM_START"||e==="FROM_END")&&this.getSourceBlock().updateAt_(b,d)});return c};this.appendDummyInput("WHERE1_INPUT").appendField(a(1),"WHERE1");this.appendDummyInput("AT1");
|
|
2548
|
-
this.appendDummyInput("WHERE2_INPUT").appendField(a(2),"WHERE2");this.appendDummyInput("AT2");$.C.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField($.C.TEXT_GET_SUBSTRING_TAIL);this.setInputsInline(!0);this.setOutput(!0,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=$.
|
|
2552
|
+
this.appendDummyInput("WHERE2_INPUT").appendField(a(2),"WHERE2");this.appendDummyInput("AT2");$.C.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField($.C.TEXT_GET_SUBSTRING_TAIL);this.setInputsInline(!0);this.setOutput(!0,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=$.sc("mutation"),b=this.getInput("AT1")instanceof $.go;a.setAttribute("at1",`${b}`);b=this.getInput("AT2")instanceof $.go;a.setAttribute("at2",
|
|
2549
2553
|
`${b}`);return a},domToMutation:function(a){var b=a.getAttribute("at1")==="true";a=a.getAttribute("at2")==="true";this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number").setAriaLabelProvider(a===1?$.C.INPUT_LABEL_TEXT_START_POSITION:$.C.INPUT_LABEL_TEXT_END_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.C.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+
|
|
2550
2554
|
a);a===2&&$.C.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.C.TEXT_GET_SUBSTRING_TAIL));a===1&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT"))}};
|
|
2551
2555
|
nr.text_changeCase={init:function(){var a=[[$.C.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[$.C.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[$.C.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl($.C.TEXT_CHANGECASE_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField($.lh({type:"field_dropdown",options:a}),"CASE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHANGE);this.setOutput(!0,"String");this.setTooltip($.C.TEXT_CHANGECASE_TOOLTIP)}};
|
|
2552
2556
|
nr.text_trim={init:function(){var a=[[$.C.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[$.C.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[$.C.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl($.C.TEXT_TRIM_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField($.lh({type:"field_dropdown",options:a}),"MODE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHANGE);this.setOutput(!0,"String");this.setTooltip($.C.TEXT_TRIM_TOOLTIP)}};
|
|
2553
|
-
nr.text_print={init:function(){this.jsonInit({message0:$.C.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:$.C.TEXT_PRINT_TOOLTIP,helpUrl:$.C.TEXT_PRINT_HELPURL})}};var or={updateType_:function(a){this.outputConnection.setCheck(a==="NUMBER"?"Number":"String")},mutationToDom:function(){var a=$.
|
|
2557
|
+
nr.text_print={init:function(){this.jsonInit({message0:$.C.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:$.C.TEXT_PRINT_TOOLTIP,helpUrl:$.C.TEXT_PRINT_HELPURL})}};var or={updateType_:function(a){this.outputConnection.setCheck(a==="NUMBER"?"Number":"String")},mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
|
|
2554
2558
|
nr.text_prompt_ext=Object.assign({},or,{init:function(){var a=[[$.C.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.C.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.C.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(b=>{this.updateType_(b)});this.appendValueInput("TEXT").appendField(a,"TYPE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_PROMPT_MESSAGE);this.setOutput(!0,"String");this.setTooltip(()=>this.getFieldValue("TYPE")==="TEXT"?$.C.TEXT_PROMPT_TOOLTIP_TEXT:
|
|
2555
2559
|
$.C.TEXT_PROMPT_TOOLTIP_NUMBER)}});
|
|
2556
2560
|
nr.text_prompt=Object.assign({},or,{init:function(){this.mixin(pr);var a=[[$.C.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.C.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.C.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(b=>{this.updateType_(b)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField($.lh({type:"field_input",text:""}),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(()=>
|
|
@@ -2560,17 +2564,17 @@ nr.text_reverse={init:function(){this.jsonInit({message0:$.C.TEXT_REVERSE_MESSAG
|
|
|
2560
2564
|
var pr={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
|
|
2561
2565
|
QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(a){for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)if(a===e.name){c.insertFieldAt(d,this.newQuote_(!0));c.insertFieldAt(d+2,this.newQuote_(!1));return}console.warn('field named "'+a+'" not found in '+this.toDevString())},newQuote_:function(a){a=this.RTL?!a:a;return $.lh({type:"field_image",src:a?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,width:this.QUOTE_IMAGE_WIDTH,height:this.QUOTE_IMAGE_HEIGHT,
|
|
2562
2566
|
alt:a?"\u201c":"\u201d"})}};$.oh("text_append_tooltip",$.Ah("%{BKY_TEXT_APPEND_TOOLTIP}","VAR"));$.oh("text_indexOf_tooltip",function(){this.setTooltip(()=>$.C.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))});$.oh("text_quotes",function(){this.mixin(pr);this.quoteField_("TEXT")});$.ph("quote_image_mixin",pr);
|
|
2563
|
-
$.th("text_join_mutator",{itemCount_:0,mutationToDom:function(){var a=$.
|
|
2567
|
+
$.th("text_join_mutator",{itemCount_:0,mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("items",`${this.itemCount_}`);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("text_create_join_container");b.initSvg();var c,d=(c=b.getInput("STACK"))==null?void 0:
|
|
2564
2568
|
c.connection;for(c=0;c<this.itemCount_;c++){let e=a.newBlock("text_create_join_item");e.initSvg();if(e.previousConnection){let f;(f=d)==null||f.connect(e.previousConnection)}d=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)b.isInsertionMarker()||a.push(b.valueConnection_),b=b.getNextBlock();for(b=0;b<this.itemCount_;b++){let c=this.getInput("ADD"+b).connection.targetConnection;c&&!a.includes(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();
|
|
2565
2569
|
for(b=0;b<this.itemCount_;b++){let c;(c=a[b])==null||c.reconnect(this,"ADD"+b)}},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){if(a.isInsertionMarker()){a=a.getNextBlock();continue}let c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;a=a.getNextBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));
|
|
2566
2570
|
for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){let b=this.appendValueInput("ADD"+a).setAlign($.Xn.RIGHT).setAriaLabelProvider($.C.INPUT_LABEL_TEXT_JOIN_ITEM.replace("%1",(a+1).toString()));a===0&&b.appendField($.C.TEXT_JOIN_TITLE_CREATEWITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}},function(){this.mixin(pr);this.itemCount_=2;this.updateShape_();this.setMutator(new $.sh(["text_create_join_item"],this))});
|
|
2567
|
-
$.th("text_charAt_mutator",{isAt_:!1,mutationToDom:function(){var a=$.
|
|
2571
|
+
$.th("text_charAt_mutator",{isAt_:!1,mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("at",`${this.isAt_}`);return a},domToMutation:function(a){a=a.getAttribute("at")!=="false";this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT",!0);this.removeInput("ORDINAL",!0);a&&(this.appendValueInput("AT").setCheck("Number").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.C.ORDINAL_NUMBER_SUFFIX));$.C.TEXT_CHARAT_TAIL&&
|
|
2568
2572
|
(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.C.TEXT_CHARAT_TAIL));this.isAt_=a}},function(){this.getField("WHERE").setValidator(function(a){a=a==="FROM_START"||a==="FROM_END";var b=this.getSourceBlock();a!==b.isAt_&&b.updateAt_(a)});this.updateAt_(!0);this.setTooltip(()=>{var a=this.getFieldValue("WHERE"),b=$.C.TEXT_CHARAT_TOOLTIP;(a==="FROM_START"||a==="FROM_END")&&(a=a==="FROM_START"?$.C.LISTS_INDEX_FROM_START_TOOLTIP:$.C.LISTS_INDEX_FROM_END_TOOLTIP)&&(b+=" "+a.replace("%1",
|
|
2569
|
-
this.workspace.options.oneBasedIndex?"#1":"#0"));return b})});$.Ab(nr);var qr={blocks:nr};var rr={},sr={setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField($.C.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=$.C.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));$.Ub++;try{this.setFieldValue(a,"PARAMS")}finally{$.Ub--}},mutationToDom:function(a){var b=$.
|
|
2570
|
-
this.getFieldValue("NAME"));for(let c=0;c<this.argumentVarModels_.length;c++){let d=$.
|
|
2573
|
+
this.workspace.options.oneBasedIndex?"#1":"#0"));return b})});$.Ab(nr);var qr={blocks:nr};var rr={},sr={setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField($.C.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=$.C.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));$.Ub++;try{this.setFieldValue(a,"PARAMS")}finally{$.Ub--}},mutationToDom:function(a){var b=$.sc("mutation");a&&b.setAttribute("name",
|
|
2574
|
+
this.getFieldValue("NAME"));for(let c=0;c<this.argumentVarModels_.length;c++){let d=$.sc("arg"),e=this.argumentVarModels_[c];d.setAttribute("name",e.getName());d.setAttribute("varid",e.getId());a&&this.paramIds_&&d.setAttribute("paramId",this.paramIds_[c]);b.appendChild(d)}this.hasStatements_||b.setAttribute("statements","false");return b},domToMutation:function(a){this.arguments_=[];this.argumentVarModels_=[];for(let c=0,d;d=a.childNodes[c];c++)if(d.nodeName.toLowerCase()==="arg"){var b=d;let e=
|
|
2571
2575
|
b.getAttribute("name");b=b.getAttribute("varid")||b.getAttribute("varId");this.arguments_.push(e);b=$.Wd(this.workspace,b,e,"");b!==null?this.argumentVarModels_.push(b):console.log(`Failed to create a variable named "${e}", ignoring.`)}this.updateParams_();$.Kj(this);this.setStatements_(a.getAttribute("statements")!=="false")},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;var a=Object.create(null);if(this.argumentVarModels_.length){a.params=[];for(let b=
|
|
2572
2576
|
0;b<this.argumentVarModels_.length;b++)a.params.push({name:this.argumentVarModels_[b].getName(),id:this.argumentVarModels_[b].getId()})}this.hasStatements_||(a.hasStatements=!1);return a},loadExtraState:function(a){this.arguments_=[];this.argumentVarModels_=[];if(a.params)for(let c=0;c<a.params.length;c++){var b=a.params[c];b=$.Wd(this.workspace,b.id,b.name,"");this.arguments_.push(b.getName());this.argumentVarModels_.push(b)}this.updateParams_();$.Kj(this);this.setStatements_(a.hasStatements===!1?
|
|
2573
|
-
!1:!0)},decompose:function(a){var b=$.
|
|
2577
|
+
!1:!0)},decompose:function(a){var b=$.sc("block");b.setAttribute("type","procedures_mutatorcontainer");var c=$.sc("statement");c.setAttribute("name","STACK");b.appendChild(c);for(let e=0;e<this.arguments_.length;e++){let f=$.sc("block");f.setAttribute("type","procedures_mutatorarg");var d=$.sc("field");d.setAttribute("name","NAME");let g=$.tc(this.arguments_[e]);d.appendChild(g);f.appendChild(d);d=$.sc("next");f.appendChild(d);c.appendChild(f);c=d}a=$.fh(b,a);this.type==="procedures_defreturn"?a.setFieldValue(this.hasStatements_,
|
|
2574
2578
|
"STATEMENTS"):a.removeInput("STATEMENT_INPUT");$.Kj(this);return a},compose:function(a){this.arguments_=[];this.paramIds_=[];this.argumentVarModels_=[];for(var b=a.getInputTargetBlock("STACK");b&&!b.isInsertionMarker();){var c=b.getFieldValue("NAME");this.arguments_.push(c);c=this.workspace.getVariableMap().getVariable(c,"");this.argumentVarModels_.push(c);this.paramIds_.push(b.id);b=b.nextConnection&&b.nextConnection.targetBlock()}this.updateParams_();$.Kj(this);a=a.getFieldValue("STATEMENTS");if(a!==
|
|
2575
2579
|
null&&(a=a==="TRUE",this.hasStatements_!==a))if(a){this.setStatements_(!0);var d;(d=this.statementConnection_)==null||d.reconnect(this,"STACK");this.statementConnection_=null}else{d=this.getInput("STACK").connection;if(this.statementConnection_=d.targetConnection)d=d.targetBlock(),d.unplug(),d.bumpNeighbours();this.setStatements_(!1)}},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(a,b){var c=this.workspace.getVariableMap().getVariableById(a);if(c.getType()===""){c=
|
|
2576
2580
|
c.getName();b=this.workspace.getVariableMap().getVariableById(b);var d=!1;for(let e=0;e<this.argumentVarModels_.length;e++)this.argumentVarModels_[e].getId()===a&&(this.arguments_[e]=b.getName(),this.argumentVarModels_[e]=b,d=!0);d&&(this.displayRenamedVar_(c,b.getName()),$.Kj(this))}},updateVarName:function(a){var b=a.getName(),c=!1;for(let e=0;e<this.argumentVarModels_.length;e++)if(this.argumentVarModels_[e].getId()===a.getId()){var d=this.arguments_[e];this.arguments_[e]=b;c=!0}c&&(this.displayRenamedVar_(d,
|
|
@@ -2588,15 +2592,15 @@ rr.procedures_mutatorarg={init:function(){var a=new tr("x",this.validator_,{aria
|
|
|
2588
2592
|
var ur={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){$.Cj.equals(a,this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?$.C.PROCEDURES_CALLRETURN_TOOLTIP:$.C.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=$.Lj(this.getProcedureCall(),this.workspace);(c=(c=c&&c.getIcon($.sh.TYPE))&&c.bubbleIsVisible())?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=
|
|
2589
2593
|
null);if(a.join("\n")===this.arguments_.join("\n"))this.quarkIds_=b;else{if(b.length!==a.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let e=0;e<this.arguments_.length;e++){var d=this.getInput("ARG"+e);d&&(d=d.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=d,c&&d&&!b.includes(this.quarkIds_[e])&&(d.disconnect(),d.getSourceBlock().bumpNeighbours()))}this.arguments_=[].concat(a);this.argumentVarModels_=
|
|
2590
2594
|
[];for(a=0;a<this.arguments_.length;a++)c=$.Wd(this.workspace,null,this.arguments_[a],""),this.argumentVarModels_.push(c);this.updateShape_();if(this.quarkIds_=b)for(b=0;b<this.arguments_.length;b++)if(a=this.quarkIds_[b],a in this.quarkConnections_){let e;((e=this.quarkConnections_[a])==null?0:e.reconnect(this,"ARG"+b))||delete this.quarkConnections_[a]}}},updateShape_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);if(b){$.Ub++;try{b.setValue(this.arguments_[a])}finally{$.Ub--}}else b=
|
|
2591
|
-
$.lh({type:"field_label",text:this.arguments_[a]}),this.appendValueInput("ARG"+a).setAlign($.Xn.RIGHT).appendField(b,"ARGNAME"+a)}for(a=this.arguments_.length;this.getInput("ARG"+a);a++)this.removeInput("ARG"+a);(a=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||a.appendField($.C.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&a.removeField("WITH"))},mutationToDom:function(){var a=$.
|
|
2592
|
-
$.
|
|
2595
|
+
$.lh({type:"field_label",text:this.arguments_[a]}),this.appendValueInput("ARG"+a).setAlign($.Xn.RIGHT).appendField(b,"ARGNAME"+a)}for(a=this.arguments_.length;this.getInput("ARG"+a);a++)this.removeInput("ARG"+a);(a=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||a.appendField($.C.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&a.removeField("WITH"))},mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("name",this.getProcedureCall());for(let b=0;b<this.arguments_.length;b++){let c=
|
|
2596
|
+
$.sc("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=a.getAttribute("name");this.renameProcedure(this.getProcedureCall(),b);b=[];var c=[];for(let d=0,e;e=a.childNodes[d];d++)e.nodeName.toLowerCase()==="arg"&&(b.push(e.getAttribute("name")),c.push(e.getAttribute("paramId")));this.setProcedureParameters_(b,c)},saveExtraState:function(){var a=Object.create(null);a.name=this.getProcedureCall();this.arguments_.length&&(a.params=this.arguments_);
|
|
2593
2597
|
return a},loadExtraState:function(a){this.renameProcedure(this.getProcedureCall(),a.name);if(a=a.params){let b=[];b.length=a.length;b.fill(null);this.setProcedureParameters_(a,b)}},getVarModels:function(){return this.argumentVarModels_},onchange:function(a){if(this.workspace&&!this.workspace.isFlyout&&a.recordUndo)if(a.type===$.Od&&a.ids.includes(this.id)){var b=this.getProcedureCall(),c=$.Lj(b,this.workspace);!c||c.type===this.defType_&&JSON.stringify(c.getVarModels().map(e=>e.getName()))===JSON.stringify(this.arguments_)||
|
|
2594
|
-
(c=null);if(c)c.isEnabled()||(this.setDisabledReason(!0,"DISABLED_PROCEDURE_DEFINITION"),this.setWarningText($.C.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",b)));else{$.B(a.group);a=$.
|
|
2595
|
-
let e=$.Bj(d,this);d!==e&&this.renameProcedure(d,e);c.appendChild($.
|
|
2598
|
+
(c=null);if(c)c.isEnabled()||(this.setDisabledReason(!0,"DISABLED_PROCEDURE_DEFINITION"),this.setWarningText($.C.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",b)));else{$.B(a.group);a=$.sc("xml");b=$.sc("block");b.setAttribute("type",this.defType_);c=this.getRelativeToSurfaceXY();var d=c.y+$.Og.snapRadius*2;b.setAttribute("x",`${c.x+$.Og.snapRadius*(this.RTL?-1:1)}`);b.setAttribute("y",`${d}`);c=this.mutationToDom();b.appendChild(c);c=$.sc("field");c.setAttribute("name","NAME");d=this.getProcedureCall();
|
|
2599
|
+
let e=$.Bj(d,this);d!==e&&this.renameProcedure(d,e);c.appendChild($.tc(d));b.appendChild(c);a.appendChild(b);$.ch(a,this.workspace);$.B(!1)}}else a.type===$.Em?(b=this.getProcedureCall(),$.Lj(b,this.workspace)||($.B(a.group),this.dispose(!0),$.B(!1))):a.type===$.Dm&&a.element==="disabled"&&(b=this.getProcedureCall(),(d=$.Lj(b,this.workspace))&&d.id===a.blockId&&((c=$.gd)&&console.log("Saw an existing group while responding to a definition change"),$.B(a.group),a=d.isEnabled(),this.setDisabledReason(!a,
|
|
2596
2600
|
"DISABLED_PROCEDURE_DEFINITION"),this.setWarningText(a?null:$.C.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",b)),$.B(c)))},customContextMenu:function(a){if(this.workspace.isMovable()){var b=this.getProcedureCall(),c=this.workspace;a.push({enabled:!0,text:$.C.PROCEDURES_HIGHLIGHT_DEF,callback:function(){var d=$.Lj(b,c);d&&(c.centerOnBlock(d.id),$.t().focusNode(d))}})}}};
|
|
2597
2601
|
rr.procedures_callnoreturn=Object.assign({},ur,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.C.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null},defType_:"procedures_defnoreturn"});
|
|
2598
2602
|
rr.procedures_callreturn=Object.assign({},ur,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.C.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null},defType_:"procedures_defreturn"});
|
|
2599
|
-
rr.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField($.C.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl($.C.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},mutationToDom:function(){var a=$.
|
|
2603
|
+
rr.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField($.C.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl($.C.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("value",
|
|
2600
2604
|
String(Number(this.hasReturnValue_)));return a},domToMutation:function(a){this.hasReturnValue_=a.getAttribute("value")==="1";this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN))},onchange:function(a){if(!(this.workspace.isDragging&&this.workspace.isDragging()||a.type!==$.Gm&&a.type!==$.Od)){a=!1;var b=this;do{if(this.FUNCTION_TYPES.includes(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?(b.type==="procedures_defnoreturn"&&
|
|
2601
2605
|
this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):b.type!=="procedures_defreturn"||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText($.C.PROCEDURES_IFRETURN_WARNING);if(!this.isInFlyout)try{$.Qc=!1,this.setDisabledReason(!a,"UNPARENTED_IFRETURN")}finally{$.Qc=
|
|
2602
2606
|
!0}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};$.Ab(rr);var vr={blocks:rr};var wr=$.yb([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_NUMBER_A}"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD","%{BKY_MATH_ADDITION_SYMBOL_ARIA}"],
|
|
@@ -2615,9 +2619,9 @@ output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",help
|
|
|
2615
2619
|
tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);
|
|
2616
2620
|
$.oh("math_op_tooltip",$.yh("OP",{ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",
|
|
2617
2621
|
SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"}));
|
|
2618
|
-
$.th("math_is_divisibleby_mutator",{mutationToDom:function(){var a=$.
|
|
2622
|
+
$.th("math_is_divisibleby_mutator",{mutationToDom:function(){var a=$.sc("mutation"),b=this.getFieldValue("PROPERTY")==="DIVISIBLE_BY";a.setAttribute("divisor_input",String(b));return a},domToMutation:function(a){a=a.getAttribute("divisor_input")==="true";this.updateShape_(a)},updateShape_:function(a){var b=this.getInput("DIVISOR");a?b||this.appendValueInput("DIVISOR").setCheck("Number"):b&&this.removeInput("DIVISOR")}},function(){this.getField("PROPERTY").setValidator(function(a){a=a==="DIVISIBLE_BY";
|
|
2619
2623
|
this.getSourceBlock().updateShape_(a)})});$.oh("math_change_tooltip",$.Ah("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));
|
|
2620
|
-
$.th("math_modes_of_list_mutator",{updateType_:function(a){a==="MODE"?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=$.
|
|
2624
|
+
$.th("math_modes_of_list_mutator",{updateType_:function(a){a==="MODE"?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){a=a.getAttribute("op");if(a===null)throw new TypeError("xmlElement had no op attribute");this.updateType_(a)}},function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))});$.Ab(wr);var xr={blocks:wr};var yr=$.yb([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_TIMES}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",
|
|
2621
2625
|
name:"TIMES",value:10,min:0,precision:1,ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_TIMES}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}",
|
|
2622
2626
|
"UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean",ariaLabelText:"%{BKY_INPUT_LABEL_CONDITION}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",
|
|
2623
2627
|
align:"RIGHT",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_FROM}"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_TO}"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_BY}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock",
|
|
@@ -2634,7 +2638,7 @@ style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTR
|
|
|
2634
2638
|
output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",
|
|
2635
2639
|
extensions:["logic_ternary"]},{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,
|
|
2636
2640
|
style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);$.oh("logic_op_tooltip",$.yh("OP",{EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"}));
|
|
2637
|
-
$.th("controls_if_mutator",{elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=$.
|
|
2641
|
+
$.th("controls_if_mutator",{elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=$.sc("mutation");this.elseifCount_&&a.setAttribute("elseif",String(this.elseifCount_));this.elseCount_&&a.setAttribute("else","1");return a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0;this.elseCount_=parseInt(a.getAttribute("else"),10)||0;this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;
|
|
2638
2642
|
var a=Object.create(null);this.elseifCount_&&(a.elseIfCount=this.elseifCount_);this.elseCount_&&(a.hasElse=!0);return a},loadExtraState:function(a){this.elseifCount_=a.elseIfCount||0;this.elseCount_=a.hasElse?1:0;this.updateShape_()},decompose:function(a){var b=a.newBlock("controls_if_if");b.initSvg();var c=b.nextConnection;for(let d=1;d<=this.elseifCount_;d++){let e=a.newBlock("controls_if_elseif");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}this.elseCount_&&(a=a.newBlock("controls_if_else"),
|
|
2639
2643
|
a.initSvg(),c.connect(a.previousConnection));return b},compose:function(a){a=a.nextConnection.targetBlock();this.elseCount_=this.elseifCount_=0;for(var b=[null],c=[null],d=null;a;){if(!a.isInsertionMarker())switch(a.type){case "controls_if_elseif":this.elseifCount_++;b.push(a.valueConnection_);c.push(a.statementConnection_);break;case "controls_if_else":this.elseCount_++;d=a.statementConnection_;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.getNextBlock()}this.updateShape_();this.reconnectChildBlocks_(b,
|
|
2640
2644
|
c,d)},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){if(!a.isInsertionMarker())switch(a.type){case "controls_if_elseif":var c=this.getInput("IF"+b);let d=this.getInput("DO"+b);a.valueConnection_=c&&c.connection.targetConnection;a.statementConnection_=d&&d.connection.targetConnection;b++;break;case "controls_if_else":c=this.getInput("ELSE");a.statementConnection_=c&&c.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.getNextBlock()}},
|
|
@@ -2646,7 +2650,7 @@ this.bumpNeighbours(),$.B(!1));this.prevBlocks_[0]=this.getInputTargetBlock("A")
|
|
|
2646
2650
|
$.ph("logic_ternary",{prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(let e=0;e<2;e++){let f=e===1?b:c;f&&!f.workspace.connectionChecker.doTypeChecks(f.outputConnection,d)&&($.B(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),f.bumpNeighbours()),$.B(!1))}this.prevParentConnection_=d}});$.Ab(Br);var Dr={blocks:Br};var Er=$.yb([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_REPEAT_ITEM}"},{type:"input_value",name:"NUM",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_REPEAT_NUM}"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",
|
|
2647
2651
|
helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_TO_CHANGE}"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"],ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_TO_CHECK}"}],
|
|
2648
2652
|
output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"],ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_TO_CHECK}"}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
|
|
2649
|
-
Er.lists_create_with={init:function(){this.setHelpUrl($.C.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.sh(["lists_create_with_item"],this));this.setTooltip($.C.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=$.
|
|
2653
|
+
Er.lists_create_with={init:function(){this.setHelpUrl($.C.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.sh(["lists_create_with_item"],this));this.setTooltip($.C.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("items",String(this.itemCount_));return a},domToMutation:function(a){a=a.getAttribute("items");if(!a)throw new TypeError("element did not have items");this.itemCount_=
|
|
2650
2654
|
parseInt(a,10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("lists_create_with_container");b.initSvg();var c=b.getInput("STACK").connection;for(let d=0;d<this.itemCount_;d++){let e=a.newBlock("lists_create_with_item");e.initSvg();if(!e.previousConnection)throw Error("itemBlock has no previousConnection");c.connect(e.previousConnection);c=e.nextConnection}return b},
|
|
2651
2655
|
compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)b.isInsertionMarker()||a.push(b.valueConnection_),b=b.getNextBlock();for(b=0;b<this.itemCount_;b++){let c=this.getInput("ADD"+b).connection.targetConnection;c&&!a.includes(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++){let c;(c=a[b])==null||c.reconnect(this,"ADD"+b)}},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){if(a.isInsertionMarker()){a=a.getNextBlock();
|
|
2652
2656
|
continue}let c=this.getInput("ADD"+b);a.valueConnection_=c==null?void 0:c.connection.targetConnection;a=a.getNextBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField($.C.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){let b=this.appendValueInput("ADD"+a).setAlign($.Xn.RIGHT).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_CREATE_WITH_ITEM.replace("%1",
|
|
@@ -2658,26 +2662,26 @@ Er.lists_getIndex={init:function(){var a=[[$.C.LISTS_GET_INDEX_GET,"GET"],[$.C.L
|
|
|
2658
2662
|
b==="REMOVE";this.getSourceBlock().updateStatement_(b)});this.appendValueInput("VALUE").setCheck("Array").appendField($.C.LISTS_GET_INDEX_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);this.appendDummyInput().appendField(a,"MODE").appendField("","SPACE");a=$.lh({type:"field_dropdown",options:this.WHERE_OPTIONS});a.setValidator(function(b){var c=this.getValue();b=b==="FROM_START"||b==="FROM_END";b!==(c==="FROM_START"||c==="FROM_END")&&this.getSourceBlock().updateAt_(b)});this.appendDummyInput().appendField(a,
|
|
2659
2663
|
"WHERE");this.appendDummyInput("AT");$.C.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField($.C.LISTS_GET_INDEX_TAIL);this.setInputsInline(!0);this.setOutput(!0);this.updateAt_(!0);this.setTooltip(()=>{var b=this.getFieldValue("MODE"),c=this.getFieldValue("WHERE"),d="";switch(b+" "+c){case "GET FROM_START":case "GET FROM_END":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case "GET FIRST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_LAST;
|
|
2660
2664
|
break;case "GET RANDOM":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case "GET_REMOVE LAST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case "GET_REMOVE RANDOM":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case "REMOVE FROM_START":case "REMOVE FROM_END":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;
|
|
2661
|
-
case "REMOVE FIRST":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if(c==="FROM_START"||c==="FROM_END")d+=" "+(c==="FROM_START"?$.C.LISTS_INDEX_FROM_START_TOOLTIP:$.C.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0");return d})},mutationToDom:function(){var a=$.
|
|
2662
|
-
var b=this.getInput("AT")instanceof $.go;a.setAttribute("at",String(b));return a},domToMutation:function(a){var b=a.getAttribute("statement")==="true";this.updateStatement_(b);a=a.getAttribute("at")!=="false";this.updateAt_(a)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(a){a.isStatement?this.updateStatement_(!0):typeof a==="string"&&this.domToMutation($.
|
|
2665
|
+
case "REMOVE FIRST":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if(c==="FROM_START"||c==="FROM_END")d+=" "+(c==="FROM_START"?$.C.LISTS_INDEX_FROM_START_TOOLTIP:$.C.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0");return d})},mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("statement",String(!this.outputConnection));
|
|
2666
|
+
var b=this.getInput("AT")instanceof $.go;a.setAttribute("at",String(b));return a},domToMutation:function(a){var b=a.getAttribute("statement")==="true";this.updateStatement_(b);a=a.getAttribute("at")!=="false";this.updateAt_(a)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(a){a.isStatement?this.updateStatement_(!0):typeof a==="string"&&this.domToMutation($.vc(a))},updateStatement_:function(a){a!==!this.outputConnection&&(this.unplug(!0,!0),a?
|
|
2663
2667
|
(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number").setAriaLabelProvider($.C.INPUT_LABEL_LISTS_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.C.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");$.C.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",
|
|
2664
2668
|
null)}};
|
|
2665
2669
|
Er.lists_setIndex={init:function(){var a=[[$.C.LISTS_SET_INDEX_SET,"SET"],[$.C.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[$.C.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.C.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.C.LISTS_GET_INDEX_FIRST,"FIRST"],[$.C.LISTS_GET_INDEX_LAST,"LAST"],[$.C.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.C.LISTS_SET_INDEX_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.C.LISTS_SET_INDEX_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);a=
|
|
2666
2670
|
$.lh({type:"field_dropdown",options:a});this.appendDummyInput().appendField(a,"MODE").appendField("","SPACE");a=$.lh({type:"field_dropdown",options:this.WHERE_OPTIONS});a.setValidator(function(b){var c=this.getValue();b=b==="FROM_START"||b==="FROM_END";b!==(c==="FROM_START"||c==="FROM_END")&&this.getSourceBlock().updateAt_(b)});this.appendDummyInput().appendField(a,"WHERE");this.appendDummyInput("AT");this.appendValueInput("TO").appendField($.C.LISTS_SET_INDEX_INPUT_TO).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_VALUE_TO_SET);
|
|
2667
2671
|
this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.C.LISTS_SET_INDEX_TOOLTIP);this.updateAt_(!0);this.setTooltip(()=>{var b=this.getFieldValue("MODE"),c=this.getFieldValue("WHERE"),d="";switch(b+" "+c){case "SET FROM_START":case "SET FROM_END":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;
|
|
2668
|
-
break;case "INSERT FROM_START":case "INSERT FROM_END":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if(c==="FROM_START"||c==="FROM_END")d+=" "+$.C.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0");return d})},mutationToDom:function(){var a=$.
|
|
2672
|
+
break;case "INSERT FROM_START":case "INSERT FROM_END":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if(c==="FROM_START"||c==="FROM_END")d+=" "+$.C.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0");return d})},mutationToDom:function(){var a=$.sc("mutation"),
|
|
2669
2673
|
b=this.getInput("AT")instanceof $.go;a.setAttribute("at",String(b));return a},domToMutation:function(a){a=a.getAttribute("at")!=="false";this.updateAt_(a)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number").setAriaLabelProvider($.C.INPUT_LABEL_LISTS_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.C.ORDINAL_NUMBER_SUFFIX)):
|
|
2670
2674
|
this.appendDummyInput("AT");this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO")}};
|
|
2671
2675
|
Er.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[$.C.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[$.C.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[$.C.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.C.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[$.C.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[$.C.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl($.C.LISTS_GET_SUBLIST_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.C.LISTS_GET_SUBLIST_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);
|
|
2672
2676
|
var a=b=>{var c=$.lh({type:"field_dropdown",options:this["WHERE_OPTIONS_"+b]});c.setValidator(function(d){var e=this.getValue();d=d==="FROM_START"||d==="FROM_END";d!==(e==="FROM_START"||e==="FROM_END")&&this.getSourceBlock().updateAt_(b,d)});return c};this.appendDummyInput("WHERE1_INPUT").appendField(a(1),"WHERE1");this.appendDummyInput("AT1");this.appendDummyInput("WHERE2_INPUT").appendField(a(2),"WHERE2");this.appendDummyInput("AT2");$.C.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField($.C.LISTS_GET_SUBLIST_TAIL);
|
|
2673
|
-
this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=$.
|
|
2677
|
+
this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=$.sc("mutation"),b=this.getInput("AT1")instanceof $.go;a.setAttribute("at1",String(b));b=this.getInput("AT2")instanceof $.go;a.setAttribute("at2",String(b));return a},domToMutation:function(a){var b=a.getAttribute("at1")==="true";a=a.getAttribute("at2")==="true";this.updateAt_(1,b);this.updateAt_(2,a)},saveExtraState:function(){return null},
|
|
2674
2678
|
loadExtraState:function(){},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number").setAriaLabelProvider(a===1?$.C.INPUT_LABEL_LISTS_START_POSITION:$.C.INPUT_LABEL_LISTS_END_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.C.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);a===1&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1",
|
|
2675
2679
|
"WHERE2_INPUT"));$.C.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};
|
|
2676
2680
|
Er.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array",ariaLabelText:$.C.INPUT_LABEL_LISTS_TO_CHANGE}],
|
|
2677
2681
|
output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}};
|
|
2678
2682
|
Er.lists_split={init:function(){var a=$.lh({type:"field_dropdown",options:[[$.C.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[$.C.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!a)throw Error("field_dropdown not found");a.setValidator(b=>{this.updateType_(b)});this.setHelpUrl($.C.LISTS_SPLIT_HELPURL);this.setStyle("list_blocks");this.appendValueInput("INPUT").setCheck("String").appendField(a,"MODE").setAriaLabelProvider(()=>{var b=this.getFieldValue("MODE");if(b==="SPLIT")return $.C.INPUT_LABEL_LISTS_LIST_FROM_TEXT;
|
|
2679
2683
|
if(b==="JOIN")return $.C.INPUT_LABEL_LISTS_TEXT_FROM_LIST});this.appendValueInput("DELIM").setCheck("String").appendField($.C.INPUT_LABEL_LISTS_DELIMITER).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_SPLIT_WITH_DELIMITER);this.setInputsInline(!0);this.setOutput(!0,"Array");this.setTooltip(()=>{var b=this.getFieldValue("MODE");if(b==="SPLIT")return $.C.LISTS_SPLIT_TOOLTIP_SPLIT;if(b==="JOIN")return $.C.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+b);})},updateType_:function(a){if(this.getFieldValue("MODE")!==
|
|
2680
|
-
a){let b=this.getInput("INPUT").connection;b.setShadowDom(null);let c=b.targetBlock();c&&(b.disconnect(),c.isShadow()?c.dispose(!1):this.bumpNeighbours())}a==="SPLIT"?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=$.
|
|
2684
|
+
a){let b=this.getInput("INPUT").connection;b.setShadowDom(null);let c=b.targetBlock();c&&(b.disconnect(),c.isShadow()?c.dispose(!1):this.bumpNeighbours())}a==="SPLIT"?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=$.sc("mutation");a.setAttribute("mode",this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))},
|
|
2681
2685
|
saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(a){this.updateType_(a.mode)}};$.Ab(Er);var Fr={blocks:Er};var Gr={blocks:Object.assign({},Er,Br,yr,wr,rr,nr,lr,jr),lists:Fr,logic:Dr,loops:Ar,math:xr,procedures:vr,texts:qr,variables:mr,variablesDynamic:kr};$.__chunk_blocks=Gr;
|
|
2682
2686
|
$.__chunk_blocks.__namespace__=$;
|
|
2683
2687
|
return $.__chunk_blocks;
|