blockly 13.2.0 → 13.2.1

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.
@@ -12,8 +12,8 @@
12
12
  }(this, function() {
13
13
  var $={};
14
14
  var ca,aa,ea,fa,da,k,ja,ka,la,na,oa,pa,qa,ta,wa,xa,ya,l,za,Aa,Ea,Ja,r,n,La,Ma,Na,Oa,Pa,Qa,Ta,Ua,Wa,Va,Ya,$a,ab,bb,db,fb,gb,hb,ib,lb,mb,nb,ob,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,fc,ec,kc,lc,mc,nc,oc,pc,xc,vc,Cc,Dc,Fc,Gc,Ac,Bc,zc,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,Oe,
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,ji,ki,mi,ni,oi,pi,qi,ti,ui,vi,xi,yi,zi,Ai,Bi,Ci,Ei,Fi,Gi,Hi,Ii,Ji,Li,Ni,Oi,Pi,Qi,Ri,Si,Ti,Ui,Yi,Zi,$i,aj,bj,cj,dj,ej,fj,hj,gj,ij,nj,oj,qj,pj,rj,uj,vj,wj,xj,yj,zj,Aj,
16
- Bj,Dj,Ej,Ij,Fj,Hj,Lj,Mj,Nj,Oj,Pj,Qj,Rj,Sj,Tj,Uj,Vj,Xj,Zj,bk,ck,dk,ek,fk,gk,hk,ik,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};
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,ji,ki,mi,ni,oi,pi,qi,ti,ui,vi,xi,yi,zi,Ai,Bi,Ci,Ei,Fi,Gi,Hi,Ii,Ji,Li,Ni,Oi,Pi,Qi,Ri,Si,Ti,Ui,Xi,Zi,$i,aj,bj,cj,dj,ej,fj,hj,gj,ij,nj,oj,qj,pj,rj,uj,vj,wj,xj,yj,zj,Aj,
16
+ Bj,Dj,Ej,Ij,Fj,Hj,Lj,Mj,Nj,Oj,Pj,Qj,Rj,Sj,Tj,Uj,Vj,Xj,Zj,ak,ck,dk,ek,fk,gk,hk,ik,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
  ja=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};ka=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
  la=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};na=function(a){return a.ctrlKey&&ma?!0:a.button===2};
@@ -160,7 +160,7 @@ w(new (u(v.BLOCK_CREATE))(d))}return d};bh=function(a,b){for(let d=0;d<a.childre
160
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),E,J=parseInt((E=d.getAttribute("x"))!=null?E:"",10),T,ra=parseInt((T=d.getAttribute("y"))!=null?T:"",10);b.setCommentText(e);let jb=b.getIcon(Zg.COMMENT);isNaN(h)||isNaN(z)||jb.setBubbleSize(new hc(h,z));jb.setBubbleVisible(f);setTimeout(()=>{isNaN(J)||isNaN(ra)||(J=b.workspace.RTL?b.workspace.getWidth()-
161
161
  (J+h):J,jb.setBubbleLocation(new D(J,ra)));jb.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}};
162
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=[],E=[],J=[];g=[];for(var T=0;T<a.children.length;T++){var ra=a.children[T];if(ra.nodeType!==Xg.TEXT_NODE)switch(ra.nodeName.toLowerCase()){case "mutation":h.push(ra);break;case "comment":m.push(ra);break;case "data":z.push(ra);break;case "title":case "field":E.push(ra);break;case "value":case "statement":J.push(ra);
163
- break;case "next":g.push(ra);break;default:console.warn("Ignoring unknown tag: "+ra.nodeName)}}T=!1;for(ra=0;ra<h.length;ra++){let Xi=h[ra];e.domToMutation&&(e.domToMutation(Xi),e.initSvg&&(T=!0))}h=T;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.");
163
+ break;case "next":g.push(ra);break;default:console.warn("Ignoring unknown tag: "+ra.nodeName)}}T=!1;for(ra=0;ra<h.length;ra++){let Yi=h[ra];e.domToMutation&&(e.domToMutation(Yi),e.initSvg&&(T=!0))}h=T;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.");
164
164
  if(!c.connect(d))throw a=e.workspace.connectionChecker,TypeError(a.getErrorMessage(a.canConnectWithReason(d,c,!1),d,c));}c=E;for(E=0;E<c.length;E++)m=c[E],(z=m.getAttribute("name"))?(d=e,(T=d.getField(z))?T.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++){E=J[c];d=(m=E.getAttribute("name"))?e.getInput(m):null;if(!d){console.warn("Ignoring non-existent input "+m+" in block "+f);break}E=ih(E);
165
165
  if(E.childBlockElement){if(!d.connection)throw TypeError("Input connection does not exist.");gh(E.childBlockElement,b,d.connection,!1)}if(E.childShadowElement){var jb=void 0;(jb=d.connection)==null||jb.setShadowDom(E.childShadowElement)}}f=g;for(jb=0;jb<f.length;jb++){g=ih(f[jb]);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,
166
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 pb of b.split(","))e.setDisabledReason(!0,decodeURIComponent(pb));(pb=a.getAttribute("deletable"))&&e.setDeletable(pb==="true");(pb=a.getAttribute("movable"))&&e.setMovable(pb===
@@ -227,7 +227,7 @@ Oi=function(){x.registry.register({name:K.JUMP_TOP_STACK,preconditionFn:Ki,callb
227
227
  Pi=function(){x.registry.register({name:K.JUMP_BOTTOM_STACK,preconditionFn:Ki,callback(a,b,c,d){if(!d.focusedNode)return!1;a=a.getNavigator().getSourceBlockFromNode(d.focusedNode);if(!a)return!1;var e;a=(e=a.getRootBlock().lastConnectionInStack(!1))==null?void 0:e.getSourceBlock();if(!a)return!1;e=a.getDescendants(!0);e=e[e.length-1];$.t().focusNode(e);return!0},keyCodes:[L.PAGE_DOWN],displayText:()=>$.C.SHORTCUTS_JUMP_BOTTOM_STACK})};
228
228
  Qi=function(){var a=x.registry.createSerializedKey(L.HOME,[L.CTRL_CMD]);x.registry.register({name:K.JUMP_FIRST_BLOCK,preconditionFn:b=>!b.isDragging()&&!$.t().ephemeralFocusTaken(),callback(b){b=b.getTopBlocks(!0);if(!b.length)return!1;$.t().focusNode(b[0]);return!0},keyCodes:[a],displayText:()=>$.C.SHORTCUTS_JUMP_FIRST_BLOCK})};
229
229
  Ri=function(){var a=x.registry.createSerializedKey(L.END,[L.CTRL_CMD]);x.registry.register({name:K.JUMP_LAST_BLOCK,preconditionFn:b=>!b.isDragging()&&!$.t().ephemeralFocusTaken(),callback(b){b=b.getAllBlocks(!0);if(!b.length)return!1;$.t().focusNode(b[b.length-1]);return!0},keyCodes:[a],displayText:()=>$.C.SHORTCUTS_JUMP_LAST_BLOCK})};Si=function(){hi();ji();mi();ni();oi();pi();qi()};Ti=function(){ui();ti();xi();yi();vi();Bi();Ci();Ei();Fi();Gi();Hi();Ii()};Ui=function(){zi();Ai();Ji()};
230
- Yi=function(a,b=!1){var c=$.C.KEYBOARD_NAV_UNCONSTRAINED_MOVE_HINT.replace("%1",ma||Vi||Wi?$.C.COMMAND_KEY:$.C.CONTROL_KEY).replace("%2",$.C.ENTER_KEY);li.show(a,{message:c,id:"unconstrainedMoveHint",oncePerSession:!b})};Zi=function(a){var b=$.C.KEYBOARD_NAV_CONSTRAINED_MOVE_HINT.replace("%1",$.C.ENTER_KEY);li.show(a,{message:b,id:"constrainedMoveHint",oncePerSession:!0})};
230
+ Xi=function(a,b=!1){var c=$.C.KEYBOARD_NAV_UNCONSTRAINED_MOVE_HINT.replace("%1",ma||Vi||Wi?$.C.COMMAND_KEY:$.C.CONTROL_KEY).replace("%2",$.C.ENTER_KEY);li.show(a,{message:c,id:"unconstrainedMoveHint",oncePerSession:!b})};Zi=function(a){var b=$.C.KEYBOARD_NAV_CONSTRAINED_MOVE_HINT.replace("%1",$.C.ENTER_KEY);li.show(a,{message:b,id:"constrainedMoveHint",oncePerSession:!0})};
231
231
  $i=function(a){var b=[];for(var c of a.getIcons()){if(a.isCollapsed()&&!c.isShownWhenCollapsed())continue;b.push(c);let d;xd(c)&&c.bubbleIsVisible()&&(d=c.getBubble())&&b.push(d)}for(let d of a.inputList){if(!d.isVisible())continue;b.push(...d.fieldRow);c=d.connection;if(!c)continue;b.push(c);c=c.targetBlock();if(!c)continue;b.push(c);(c=c.lastConnectionInStack(!1))&&b.push(c)}a.nextConnection&&!a.isCollapsed()&&b.push(a.nextConnection);return b};
232
232
  aj=function(a,b,c){a=$i(a);b=a.indexOf(b);if(b===-1)return null;c=b+c;return c>=0&&c<a.length?a[c]:null};bj=function(a){return a&&typeof a.getChildToolboxItems==="function"&&typeof a.isExpanded==="function"&&typeof a.toggleExpanded==="function"&&ve(a)&&a.isCollapsible()};cj=function(a){var b=a.options.toolboxPosition;return a.options.RTL&&b!==F.TOP&&b!==F.BOTTOM?b===F.LEFT?F.RIGHT:F.LEFT:b};dj=function(a,b){A(y.ICON,a.toString(),b)};
233
233
  ej=function(a){return typeof a.getProcedureModel==="function"&&typeof a.doProcedureUpdate==="function"&&typeof a.isProcedureDef==="function"};fj=function(a){return a&&typeof a.startPublishing==="function"&&typeof a.stopPublishing==="function"};
@@ -261,14 +261,14 @@ weight:6})};Vj=function(){Kj.registry.register({displayText(){return $.C.DUPLICA
261
261
  Xj=function(){Kj.registry.register({displayText(a){return a.block.hasIcon(Wj.TYPE)?$.C.REMOVE_COMMENT:$.C.ADD_COMMENT},preconditionFn(a){a=a.block;var b;if((b=a&&!a.isInFlyout&&a.workspace.options.comments&&!a.isCollapsed()&&a.isEditable())&&!(b=a.hasIcon(Wj.TYPE))){if(a&&a.isSimpleReporter()){var c;a=(c=a.getFields().next().value)==null?void 0:c.isFullBlockField()}else a=!1;b=!a}return b?"enabled":"hidden"},callback(a){(a=a.block)&&a.hasIcon(Wj.TYPE)?a.setCommentText(null):a.setCommentText("")},
262
262
  scopeType:Kj.ScopeType.BLOCK,id:"blockComment",weight:2})};
263
263
  Zj=function(){Kj.registry.register({displayText(a){return a.block.getInputsInline()?$.C.EXTERNAL_INPUTS:$.C.INLINE_INPUTS},preconditionFn(a){a=a.block;if(!a.isInFlyout&&a.isMovable()&&!a.isCollapsed())for(let b=1;b<a.inputList.length;b++)if(!(a.inputList[b-1]instanceof Yj||a.inputList[b]instanceof Yj))return"enabled";return"hidden"},callback(a){a.block.setInputsInline(!a.block.getInputsInline())},scopeType:Kj.ScopeType.BLOCK,id:"blockInline",weight:3})};
264
- bk=function(){Kj.registry.register({displayText(a){return a.block.isCollapsed()?$.C.EXPAND_BLOCK:$.C.COLLAPSE_BLOCK},preconditionFn(a){a=a.block;return!a.isInFlyout&&a.isMovable()&&a.workspace.options.collapse?"enabled":"hidden"},callback(a){a.block.setCollapsed(!a.block.isCollapsed())},scopeType:Kj.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})};
264
+ ak=function(){Kj.registry.register({displayText(a){return a.block.isCollapsed()?$.C.EXPAND_BLOCK:$.C.COLLAPSE_BLOCK},preconditionFn(a){a=a.block;return!a.isInFlyout&&a.isMovable()&&a.workspace.options.collapse?"enabled":"hidden"},callback(a){a.block.setCollapsed(!a.block.isCollapsed())},scopeType:Kj.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})};
265
265
  ck=function(){Kj.registry.register({displayText(a){return a.block.hasDisabledReason("MANUALLY_DISABLED")?$.C.ENABLE_BLOCK:$.C.DISABLE_BLOCK},preconditionFn(a){a=a.block;if(!a.isInFlyout&&a.workspace.options.disable&&a.isEditable()){var b=a.getDisabledReasons();b=b.size>(b.has("MANUALLY_DISABLED")?1:0);return a.getInheritedDisabled()||b?"disabled":"enabled"}return"hidden"},callback(a){a=a.block;var b=$.gd;b||$.B(!0);a.setDisabledReason(!a.hasDisabledReason("MANUALLY_DISABLED"),"MANUALLY_DISABLED");
266
266
  $.B(b)},scopeType:Kj.ScopeType.BLOCK,id:"blockDisable",weight:5})};
267
267
  dk=function(){Kj.registry.register({displayText(a){var b=a.block;a=b.getDescendants(!1).length;(b=b.getNextBlock())&&(a-=b.getDescendants(!1).length);return a===1?$.C.DELETE_BLOCK:$.C.DELETE_X_BLOCKS.replace("%1",`${a}`)},preconditionFn(a){return!a.block.isInFlyout&&a.block.isDeletable()?"enabled":"hidden"},callback(a){a.block&&($.t().focusNode(a.block),a.block.checkAndDelete())},scopeType:Kj.ScopeType.BLOCK,id:"blockDelete",weight:6,associatedKeyboardShortcut:"delete"})};
268
268
  ek=function(){Kj.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:Kj.ScopeType.BLOCK,id:"blockHelp",weight:7})};
269
269
  fk=function(){Kj.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:Kj.ScopeType.COMMENT,id:"commentDelete",weight:6,associatedKeyboardShortcut:"delete"})};
270
270
  gk=function(){Kj.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:Kj.ScopeType.COMMENT,id:"commentDuplicate",weight:1,associatedKeyboardShortcut:"duplicate"})};
271
- hk=function(){Kj.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(oc(a,new D(d.x,d.y))),$.t().focusNode(b),$.B(!1)},scopeType:Kj.ScopeType.WORKSPACE,id:"commentCreate",weight:8})};ik=function(){Lj();Mj();Nj();Pj();Qj();Uj();Vj();Xj();Zj();bk();ck();dk();ek()};M=M||{};M.scope={};M.ASSUME_ES2020=!1;M.ASSUME_ES6=M.ASSUME_ES2020;M.ASSUME_ES5=M.ASSUME_ES6;
271
+ hk=function(){Kj.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(oc(a,new D(d.x,d.y))),$.t().focusNode(b),$.B(!1)},scopeType:Kj.ScopeType.WORKSPACE,id:"commentCreate",weight:8})};ik=function(){Lj();Mj();Nj();Pj();Qj();Uj();Vj();Xj();Zj();ak();ck();dk();ek()};M=M||{};M.scope={};M.ASSUME_ES2020=!1;M.ASSUME_ES6=M.ASSUME_ES2020;M.ASSUME_ES5=M.ASSUME_ES6;
272
272
  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};
273
273
  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={};
274
274
  M.propertyToPolyfillSymbol={};M.POLYFILL_PREFIX="$jscp$";var jk="Int8 Uint8 Uint8Clamped Int16 Uint16 Int32 Uint32 Float32 Float64".split(" ");M.global.BigInt64Array&&(jk.push("BigInt64"),jk.push("BigUint64"));M.TYPED_ARRAY_CLASSES=jk;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)}};
@@ -952,8 +952,8 @@ input[type=number] {
952
952
  }
953
953
  `,Gk={};Gk.inject=wa;Gk.register=ta;var v,Hk=v||(v={});Hk.BLOCK_CREATE="create";Hk.BLOCK_DELETE="delete";Hk.BLOCK_CHANGE="change";Hk.BLOCK_FIELD_INTERMEDIATE_CHANGE="block_field_intermediate_change";Hk.BLOCK_MOVE="move";Hk.VAR_CREATE="var_create";Hk.VAR_DELETE="var_delete";Hk.VAR_RENAME="var_rename";Hk.VAR_TYPE_CHANGE="var_type_change";Hk.UI="ui";Hk.BLOCK_DRAG="drag";Hk.SELECTED="selected";Hk.CLICK="click";Hk.MARKER_MOVE="marker_move";Hk.BUBBLE_OPEN="bubble_open";Hk.TRASHCAN_OPEN="trashcan_open";Hk.TOOLBOX_ITEM_SELECT="toolbox_item_select";
954
954
  Hk.THEME_CHANGE="theme_change";Hk.VIEWPORT_CHANGE="viewport_change";Hk.COMMENT_CREATE="comment_create";Hk.COMMENT_DELETE="comment_delete";Hk.COMMENT_CHANGE="comment_change";Hk.COMMENT_MOVE="comment_move";Hk.COMMENT_RESIZE="comment_resize";Hk.COMMENT_DRAG="comment_drag";Hk.COMMENT_COLLAPSE="comment_collapse";Hk.FINISHED_LOADING="finished_loading";var Vh=[v.BLOCK_CREATE,v.BLOCK_MOVE,v.COMMENT_CREATE,v.COMMENT_MOVE];var zb=Object.create(null);var Ca,Ik=Ca||(Ca={});Ik.ASSERTIVE="assertive";Ik.OFF="off";Ik.POLITE="polite";var Ga=Ca.OFF,Fa=[],Ka,Jk=Ka||(Ka={});Jk.APPLICATION="application";Jk.BUTTON="button";Jk.CHECKBOX="checkbox";Jk.DIALOG="dialog";Jk.FIGURE="figure";Jk.GENERIC="generic";Jk.GRID="grid";Jk.GRIDCELL="gridcell";Jk.GROUP="group";Jk.LIST="list";Jk.LISTBOX="listbox";Jk.LISTITEM="listitem";Jk.MENU="menu";Jk.MENUITEM="menuitem";Jk.NONE="none";Jk.OPTION="option";Jk.REGION="region";Jk.ROW="row";Jk.SEPARATOR="separator";Jk.STATUS="status";
955
- Jk.TEXTBOX="textbox";Jk.TREE="tree";Jk.TREEITEM="treeitem";var Da=Ka.STATUS,p,Kk=p||(p={});Kk.ACTIVEDESCENDANT="activedescendant";Kk.ATOMIC="atomic";Kk.CHECKED="checked";Kk.CONTROLS="controls";Kk.DISABLED="disabled";Kk.EXPANDED="expanded";Kk.HASPOPUP="haspopup";Kk.HIDDEN="hidden";Kk.INVALID="invalid";Kk.LABEL="label";Kk.LABELLEDBY="labelledby";Kk.LEVEL="level";Kk.LIVE="live";Kk.ROLEDESCRIPTION="roledescription";Kk.SELECTED="selected";Kk.VALUEMAX="valuemax";Kk.VALUEMIN="valuemin";Kk.OWNS="owns";
956
- var we,Lk=we||(we={});Lk[Lk.TERSE=0]="TERSE";Lk[Lk.STANDARD=1]="STANDARD";Lk[Lk.LOQUACIOUS=2]="LOQUACIOUS";var Ba=null,Ha,Ia=!1,Mk={};Mk.LiveRegionAssertiveness=Ca;Mk.Role=Ka;Mk.State=p;Mk.Verbosity=we;Mk.announceDynamicAriaState=Ja;Mk.clearState=za;Mk.getRole=function(a){return(a=a.getAttribute("role"))&&Object.values(Ka).includes(a)?a:null};Mk.getState=Aa;Mk.initializeGlobalAriaLiveRegion=Ea;Mk.removeRole=xa;Mk.setRole=ya;Mk.setState=l;var q=class{constructor(a){this.tagName=a}toString(){return this.tagName}};q.ANIMATE=new q("animate");q.CIRCLE=new q("circle");q.CLIPPATH=new q("clipPath");q.DEFS=new q("defs");q.FECOMPOSITE=new q("feComposite");q.FECOMPONENTTRANSFER=new q("feComponentTransfer");q.FEFLOOD=new q("feFlood");q.FEFUNCA=new q("feFuncA");q.FEGAUSSIANBLUR=new q("feGaussianBlur");q.FEPOINTLIGHT=new q("fePointLight");q.FESPECULARLIGHTING=new q("feSpecularLighting");q.FILTER=new q("filter");q.FOREIGNOBJECT=new q("foreignObject");
955
+ Jk.TEXTBOX="textbox";Jk.TREE="tree";Jk.TREEITEM="treeitem";var Da=Ka.STATUS,p,Kk=p||(p={});Kk.ACTIVEDESCENDANT="activedescendant";Kk.ATOMIC="atomic";Kk.CHECKED="checked";Kk.CONTROLS="controls";Kk.DISABLED="disabled";Kk.EXPANDED="expanded";Kk.HASPOPUP="haspopup";Kk.HIDDEN="hidden";Kk.INVALID="invalid";Kk.LABEL="label";Kk.LABELLEDBY="labelledby";Kk.LEVEL="level";Kk.LIVE="live";Kk.PRESSED="pressed";Kk.ROLEDESCRIPTION="roledescription";Kk.SELECTED="selected";Kk.VALUEMAX="valuemax";Kk.VALUEMIN="valuemin";
956
+ Kk.OWNS="owns";var we,Lk=we||(we={});Lk[Lk.TERSE=0]="TERSE";Lk[Lk.STANDARD=1]="STANDARD";Lk[Lk.LOQUACIOUS=2]="LOQUACIOUS";var Ba=null,Ha,Ia=!1,Mk={};Mk.LiveRegionAssertiveness=Ca;Mk.Role=Ka;Mk.State=p;Mk.Verbosity=we;Mk.announceDynamicAriaState=Ja;Mk.clearState=za;Mk.getRole=function(a){return(a=a.getAttribute("role"))&&Object.values(Ka).includes(a)?a:null};Mk.getState=Aa;Mk.initializeGlobalAriaLiveRegion=Ea;Mk.removeRole=xa;Mk.setRole=ya;Mk.setState=l;var q=class{constructor(a){this.tagName=a}toString(){return this.tagName}};q.ANIMATE=new q("animate");q.CIRCLE=new q("circle");q.CLIPPATH=new q("clipPath");q.DEFS=new q("defs");q.FECOMPOSITE=new q("feComposite");q.FECOMPONENTTRANSFER=new q("feComponentTransfer");q.FEFLOOD=new q("feFlood");q.FEFUNCA=new q("feFuncA");q.FEGAUSSIANBLUR=new q("feGaussianBlur");q.FEPOINTLIGHT=new q("fePointLight");q.FESPECULARLIGHTING=new q("feSpecularLighting");q.FILTER=new q("filter");q.FOREIGNOBJECT=new q("foreignObject");
957
957
  q.G=new q("g");q.IMAGE=new q("image");q.LINE=new q("line");q.PATH=new q("path");q.PATTERN=new q("pattern");q.POLYGON=new q("polygon");q.RECT=new q("rect");q.SVG=new q("svg");q.TEXT=new q("text");q.TSPAN=new q("tspan");var Xg,Nk=Xg||(Xg={});Nk[Nk.ELEMENT_NODE=1]="ELEMENT_NODE";Nk[Nk.TEXT_NODE=3]="TEXT_NODE";Nk[Nk.COMMENT_NODE=8]="COMMENT_NODE";var Sa=null,Ra=0,Xa=null,Ok={HTML_NS:"http://www.w3.org/1999/xhtml"};Ok.NodeType=Xg;Ok.SVG_NS="http://www.w3.org/2000/svg";Ok.XLINK_NS="http://www.w3.org/1999/xlink";Ok.addClass=n;Ok.createSvgElement=r;Ok.getFastTextWidth=function(a,b,c,d){return Va(a,b+"pt",c,d)};Ok.getFastTextWidthWithSizeString=Va;Ok.getTextWidth=Wa;Ok.hasClass=Na;Ok.insertAfter=Pa;
958
958
  Ok.measureFontMetrics=Ya;Ok.removeClass=Ma;Ok.removeClasses=La;Ok.removeNode=Oa;Ok.setCssTransform=Qa;Ok.startTextWidthCache=Ta;Ok.stopTextWidthCache=Ua;var Pk=class{static findFocusedNode(a){var b=a.getRootFocusableNode();if(!b.canBeFocused())return null;var c=b.getFocusableElement();if(Na(c,Pk.ACTIVE_CLASS_NAME)||Na(c,Pk.PASSIVE_CSS_CLASS_NAME))return b;b=c.querySelector(this.ACTIVE_FOCUS_NODE_CSS_SELECTOR);if(b instanceof HTMLElement||b instanceof SVGElement)if(b=Pk.findFocusableNodeFor(b,a))return b;c=c.querySelector(this.PASSIVE_FOCUS_NODE_CSS_SELECTOR);if(c instanceof HTMLElement||c instanceof SVGElement)if(a=Pk.findFocusableNodeFor(c,a))return a;
959
959
  return null}static findFocusableNodeFor(a,b){if(!a.id||a.id==="null"||b.getNestedTrees().map(e=>Pk.findFocusableNodeFor(a,e)).findIndex(e=>!!e)!==-1)return null;var c=b.getRootFocusableNode();if(c.canBeFocused()&&a===c.getFocusableElement())return c;var d;if(c=(d=b.lookUpFocusableNode(a.id))!=null?d:null)return c;d=a.parentElement;return!c&&d?Pk.findFocusableNodeFor(d,b):null}};Pk.ACTIVE_CLASS_NAME="blocklyActiveFocus";Pk.PASSIVE_CSS_CLASS_NAME="blocklyPassiveFocus";
@@ -1072,8 +1072,8 @@ if(b===null||b==="")b=$.C.FIELD_LABEL_EMPTY;return a?`${a}: ${b}`:b}init(){if(!t
1072
1072
  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_);
1073
1073
  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);
1074
1074
  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=$.rc("field"),a.setAttribute("name",this.name||""),xc(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($.uc(b)),!0):!1}dispose(){pf(this);vg(this);var a;((a=
1075
- this.getSourceBlock())==null?0:a.isDeadOrDying())||Oa(this.fieldGroup_);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_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&
1076
- 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_!==
1075
+ 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_&&
1076
+ !!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_!==
1077
1077
  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_}.`);
1078
1078
  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));
1079
1079
  this.size_=new hc(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)),
@@ -1114,7 +1114,7 @@ a}isMovable(){return this.isOwnMovable()&&!this.workspace.isReadOnly()&&!this.wo
1114
1114
  !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 cn(this);this.workspace=a;this.view=new hn(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,
1115
1115
  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=
1116
1116
  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=
1117
- !0;var a=$.t();a.getFocusedNode()===this&&setTimeout(()=>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(),
1117
+ !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(),
1118
1118
  "blocklySelected");ob(this)}unselect(){Ma(this.getSvgRoot(),"blocklySelected");ob(null)}toCopyData(){return{paster:vl.TYPE,commentState:Pc(this,{addCoordinates:!0,saveIds:!1})}}showContextMenu(a){var b=Kj.registry.getContextMenuOptions({comment:this,focusedNode:this},a);var c=a instanceof PointerEvent?new D(a.clientX,a.clientY):pc(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();
1119
1119
  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);
1120
1120
  $.t().focusNode(this.getEditorFocusableNode())}};var jn={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}};jn.blockToDom=Wg;jn.blockToDomWithXY=Yg;
@@ -1159,8 +1159,8 @@ new D(0,0)}totalPixelDelta(){var a,b,c=(b=(a=this.draggable)==null?void 0:a.work
1159
1159
  ri.mover=new ri;var nn=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,
1160
1160
  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 nn(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 nn&&(bb(c,d),c.name=a)}bb(c.blockStyles,b.blockStyles);bb(c.categoryStyles,b.categoryStyles);bb(c.componentStyles,b.componentStyles);bb(c.fontStyle,b.fontStyle);b.startHats!==null&&(c.startHats=b.startHats);return c}};var on=new nn("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"},
1161
1161
  math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}});var pn=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=Cc((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 E=!!a.rtl,J=a.horizontalLayout;J===void 0&&(J=!1);var T=a.toolboxPosition!=="end";T=J?T?F.TOP:F.BOTTOM:
1162
- T===E?F.RIGHT:F.LEFT;var ra=a.css;ra===void 0&&(ra=!0);var jb="https://static.blockly.com/media/";a.media&&(jb=a.media.endsWith("/")?a.media:a.media+"/");var pb=a.oneBasedIndex,Xi=a.renderer||"thrasos",ys=a.plugins||{},ak=a.modalInputs;ak===void 0&&(ak=!0);this.RTL=E;this.oneBasedIndex=pb===void 0?!0:pb;this.collapse=e;this.comments=f;this.disable=g;this.readOnly=m;this.maxBlocks=a.maxBlocks||Infinity;var Uo;this.maxInstances=(Uo=a.maxInstances)!=null?Uo:null;this.modalInputs=ak;this.pathToMedia=
1163
- jb;this.hasCategories=c;this.moveOptions=pn.parseMoveOptions(a,c);this.hasScrollbars=!!this.moveOptions.scrollbars;this.hasTrashcan=d;this.maxTrashcanContents=z;this.hasSounds=h;this.hasCss=ra;this.horizontalLayout=J;this.languageTree=b;this.gridOptions=pn.parseGridOptions(a);this.zoomOptions=pn.parseZoomOptions(a);this.toolboxPosition=T;this.theme=pn.parseThemeOptions(a);this.renderer=Xi;var Vo;this.rendererOverrides=(Vo=a.rendererOverrides)!=null?Vo:null;var Wo;this.parentWorkspace=(Wo=a.parentWorkspace)!=
1162
+ T===E?F.RIGHT:F.LEFT;var ra=a.css;ra===void 0&&(ra=!0);var jb="https://static.blockly.com/media/";a.media&&(jb=a.media.endsWith("/")?a.media:a.media+"/");var pb=a.oneBasedIndex,Yi=a.renderer||"thrasos",ys=a.plugins||{},bk=a.modalInputs;bk===void 0&&(bk=!0);this.RTL=E;this.oneBasedIndex=pb===void 0?!0:pb;this.collapse=e;this.comments=f;this.disable=g;this.readOnly=m;this.maxBlocks=a.maxBlocks||Infinity;var Uo;this.maxInstances=(Uo=a.maxInstances)!=null?Uo:null;this.modalInputs=bk;this.pathToMedia=
1163
+ jb;this.hasCategories=c;this.moveOptions=pn.parseMoveOptions(a,c);this.hasScrollbars=!!this.moveOptions.scrollbars;this.hasTrashcan=d;this.maxTrashcanContents=z;this.hasSounds=h;this.hasCss=ra;this.horizontalLayout=J;this.languageTree=b;this.gridOptions=pn.parseGridOptions(a);this.zoomOptions=pn.parseZoomOptions(a);this.toolboxPosition=T;this.theme=pn.parseThemeOptions(a);this.renderer=Yi;var Vo;this.rendererOverrides=(Vo=a.rendererOverrides)!=null?Vo:null;var Wo;this.parentWorkspace=(Wo=a.parentWorkspace)!=
1164
1164
  null?Wo:null;this.plugins=ys}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===
1165
1165
  "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=
1166
1166
  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||on;return typeof a==="string"?Fb(y.THEME,a,void 0):a instanceof nn?a:nn.defineTheme(a.name||"builtin"+Lb(),a)}};var qn=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,
@@ -1182,8 +1182,8 @@ if(a.hasTrashcan)throw Error("The miniworkspace bubble does not support trashcan
1182
1182
  this.updateBubbleSize()}bumpBlocksIntoBounds(){if(!this.miniWorkspace.isDragging()||ri.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()||ri.mover.isMoving()){this.autoLayout&&(this.autoLayout=!ri.mover.isMoving());var a=this.getSize(),b=
1183
1183
  this.calculateWorkspaceSize();Math.abs(a.width-b.width)<tn.MINIMUM_VIEW_CHANGE&&Math.abs(a.height-b.height)<tn.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 hc(b.width+sn.DOUBLE_BORDER,b.height+sn.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),
1184
1184
  this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var a=this.miniWorkspace.getCanvas().getBBox(),b=a.width+tn.MARGIN;a=a.height+tn.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 hc(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);
1185
- 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())}};tn.MINIMUM_VIEW_CHANGE=10;tn.MARGIN=sn.DOUBLE_BORDER*3;var un=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(){If(this.svgRoot);
1186
- Oa(this.svgRoot)}getWeight(){return-1}getSize(){return new hc(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=
1185
+ 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())}};tn.MINIMUM_VIEW_CHANGE=10;tn.MARGIN=sn.DOUBLE_BORDER*3;var un=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&&
1186
+ (If(this.svgRoot),delete this.svgRoot.tooltip,Oa(this.svgRoot));this.tooltip=""}getWeight(){return-1}getSize(){return new hc(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=
1187
1187
  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();
1188
1188
  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=
1189
1189
  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 un{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"},
@@ -1235,8 +1235,8 @@ typeof this.ariaLabelProvider==="string"?hg(this.ariaLabelProvider):this.ariaLab
1235
1235
  var b=a.indexOf(this),c,d=((c=a[b-1].connection)==null?void 0:c.type)===G.NEXT_STATEMENT,e;return((e=this.connection)==null?void 0:e.type)===G.NEXT_STATEMENT||d?`${this.getSourceBlock().id}-input${b}`:a[b-1].getRowId()}getLabel(a=we.STANDARD,b=!0){if(!this.isVisible())return"";var c=De(this,!1,a),d;b&&((d=this.connection)==null?void 0:d.type)===G.INPUT_VALUE&&(b=this.connection.targetBlock())&&!b.isInsertionMarker()&&c.push(ze(b,a).join(", "));return c.join(", ")}getIndex(){var a=[$.je.DUMMY,$.je.END_ROW];
1236
1236
  return this.getSourceBlock().inputList.filter(b=>!a.includes(b.type)).indexOf(this)}};var Kn=class extends Jn{constructor(a,b){super(a,b);this.name=a;this.type=$.je.DUMMY}};var Ln=class extends Jn{constructor(a,b){super(a,b);this.name=a;this.type=$.je.END_ROW}};var Mn=class extends Jn{constructor(a,b){if(!a)throw Error("Statement inputs must have a non-empty name");super(a,b);this.name=a;this.type=$.je.STATEMENT;this.connection=this.makeConnection(G.NEXT_STATEMENT)}};$.Nn=class extends Jn{constructor(a,b){if(!a)throw Error("Value inputs must have a non-empty name");super(a,b);this.name=a;this.type=$.je.VALUE;this.connection=this.makeConnection(G.INPUT_VALUE)}};var On=class{constructor(a,b,c){this.data=null;this.disposed=!1;this.hue=null;this.colour_="#000000";this.styleName_="";this.suppressPrefixSuffix=!1;this.previousConnection=this.nextConnection=this.outputConnection=null;this.inputList=[];this.icons=[];this.disabledReasons=new Set;this.tooltip="";this.contextMenu=!0;this.parentBlock_=null;this.childBlocks_=[];this.editable=this.movable=this.deletable=!0;this.collapsed_=this.shadow=!1;this.outputShape_=null;this.rendered=this.isInsertionMarker_=this.initialized=
1237
1237
  this.disposing=!1;this.onchangeWrapper=this.helpUrl=null;this.statementInputCount=0;this.workspace=a;this.id=c&&!a.getBlockById(c)?c:Nb();a.setBlockById(this.id,this);this.xy=new D(0,0);this.isInFlyout=a.isFlyout;this.isInMutator=a.isMutator;this.RTL=a.RTL;if(b){this.type=b;c=zb[b];if(!c||typeof c!=="object")throw TypeError("Invalid block definition for type: "+b);Object.assign(this,c)}a.addTopBlock(this);a.addTypedBlock(this);new.target===On&&this.doInit_()}doInit_(){var a=$.gd;a||$.B(!0);var b=
1238
- $.Qc;try{typeof this.init==="function"&&($.Qc=!1,this.init(),$.Qc=b),Vb()&&w(new (u(v.BLOCK_CREATE))(this))}finally{$.B(a),$.Qc=b}this.inputsInlineDefault=this.inputsInline;typeof this.onchange==="function"&&this.setOnChange(this.onchange)}dispose(a=!1){this.disposing=!0;this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper);this.unplug(a);Vb()&&w(new (u(v.BLOCK_DELETE))(this));this.workspace.removeTopBlock(this);this.disposeInternal()}disposeInternal(){this.disposing=!0;
1239
- this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper);this.workspace.removeTypedBlock(this);this.workspace.removeBlockById(this.id);typeof this.destroy==="function"&&this.destroy();this.childBlocks_.forEach(a=>a.disposeInternal());this.inputList.forEach(a=>a.dispose());this.inputList.length=0;this.getConnections_(!0).forEach(a=>a.dispose());this.disposed=!0}isDeadOrDying(){return this.disposing||this.disposed}initModel(){if(!this.initialized){for(let a of this.inputList)a.initModel();
1238
+ $.Qc;try{typeof this.init==="function"&&($.Qc=!1,this.init(),$.Qc=b),Vb()&&w(new (u(v.BLOCK_CREATE))(this))}finally{$.B(a),$.Qc=b}this.inputsInlineDefault=this.inputsInline;typeof this.onchange==="function"&&this.setOnChange(this.onchange)}dispose(a=!1){this.disposing=!0;this.tooltip="";this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper);this.unplug(a);Vb()&&w(new (u(v.BLOCK_DELETE))(this));this.workspace.removeTopBlock(this);this.disposeInternal()}disposeInternal(){this.disposing=
1239
+ !0;this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper);this.workspace.removeTypedBlock(this);this.workspace.removeBlockById(this.id);typeof this.destroy==="function"&&this.destroy();this.childBlocks_.forEach(a=>a.disposeInternal());this.inputList.forEach(a=>a.dispose());this.inputList.length=0;this.getConnections_(!0).forEach(a=>a.dispose());this.disposed=!0}isDeadOrDying(){return this.disposing||this.disposed}initModel(){if(!this.initialized){for(let a of this.inputList)a.initModel();
1240
1240
  this.initialized=!0}}unplug(a){this.outputConnection&&this.unplugFromRow(a);this.previousConnection&&this.unplugFromStack(a)}unplugFromRow(a){var b=null,c;if((c=this.outputConnection)==null?0:c.isConnected())b=this.outputConnection.targetConnection,this.outputConnection.disconnect();b&&a&&(a=this.getOnlyValueConnection())&&a.isConnected()&&!a.targetBlock().isShadow()&&(a=a.targetConnection,a==null||a.disconnect(),this.workspace.connectionChecker.canConnect(a,b,!1)?b.connect(a):a==null||a.onFailedConnect(b))}getOnlyValueConnection(){var a=
1241
1241
  null;for(let b=0;b<this.inputList.length;b++){let c=this.inputList[b].connection;if(c&&c.type===G.INPUT_VALUE&&c.targetConnection){if(a)return null;a=c}}return a}unplugFromStack(a){var b=null,c;if((c=this.previousConnection)==null?0:c.isConnected())b=this.previousConnection.targetConnection,this.previousConnection.disconnect();if(a){for(a=this.getNextBlock();a&&(a.isShadow()||!a.isMovable());)a=a.getNextBlock();if(a){var d,e,f,g;a=(g=(d=a.previousConnection)==null?void 0:(e=d.targetBlock())==null?
1242
1242
  void 0:(f=e.nextConnection)==null?void 0:f.targetConnection)!=null?g:null;a==null||a.disconnect();b&&this.workspace.connectionChecker.canConnect(b,a,!1)&&b.connect(a)}}}getConnections_(){var a=[];this.outputConnection&&a.push(this.outputConnection);this.previousConnection&&a.push(this.previousConnection);this.nextConnection&&a.push(this.nextConnection);for(let b=0,c;c=this.inputList[b];b++)c.connection&&a.push(c.connection);return a}lastConnectionInStack(a){for(var b=this.nextConnection;b;){let c=
@@ -1288,12 +1288,12 @@ c.getToolbox())==null?void 0:g.getWidth();g=c.getParentSvg().clientWidth-(h!=nul
1288
1288
  J=m(E)}}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),$.Qc=!0,a;return this.block}announceMove(a=!1){if(this.connectionCandidate)a=Me(this.connectionCandidate.local,this.connectionCandidate.neighbour,this.hasMultipleCompatibleConnections.bind(this),
1289
1289
  a);else{let b=a?this.block.getStackBlocksCountLabel():"";a=$.C.ANNOUNCE_MOVE_WORKSPACE;a=a.replace("%1",b)}Ja(a.replace(/\s+/g," "))}hasMultipleCompatibleConnections(a=!0){var b=this.connectionCandidate;if(!b)return!1;var c=a?"local":"neighbour",d=a?"neighbour":"local";return this.allConnectionPairs.filter(e=>e[d]===b[d]&&e[c]!==b[c].getSourceBlock().nextConnection&&e[c].getSourceBlock().id===b[c].getSourceBlock().id).length>1}startDrag(a){this.updateMoveMode(a);var b=this.getTargetBlock();if(b!==
1290
1290
  this.block)return b.startDrag(a);this.block.workspace.recordDragTargets();this.dragging=!0;this.fireDragStartEvent();this.startLoc=this.block.getRelativeToSurfaceXY();this.connectionCandidate=null;this.connectionPreviewer=new (Jb(y.CONNECTION_PREVIEWER,this.workspace.options))(this.block);Ta();this.workspace.setResizesEnabled(!1);Mh();b=this.shouldHealStack(a);this.storeInitialConnections(b);this.shouldDisconnect(b)&&this.disconnectBlock(b);this.block.setDragging(!0);this.enableAllDraggedBlocks(this.block);
1291
- this.cacheAllConnectionPairs();if(a instanceof KeyboardEvent){let d;a=(d=this.getInitialCandidate())!=null?d:void 0;this.updateConnectionPreview(this.block,new D(0,0),a)&&this.block.moveDuringDrag(this.determineConnectionOffset());this.allConnectionPairs.length?Zi(this.workspace):Yi(this.workspace)}else this.block.moveDuringDrag(this.startLoc);var c;(c=this.workspace.getLayerManager())==null||c.moveToDragLayer(this.block);this.getVisibleBubbles(this.block).forEach(d=>{var e;(e=this.workspace.getLayerManager())==
1291
+ this.cacheAllConnectionPairs();if(a instanceof KeyboardEvent){let d;a=(d=this.getInitialCandidate())!=null?d:void 0;this.updateConnectionPreview(this.block,new D(0,0),a)&&this.block.moveDuringDrag(this.determineConnectionOffset());this.allConnectionPairs.length?Zi(this.workspace):Xi(this.workspace)}else this.block.moveDuringDrag(this.startLoc);var c;(c=this.workspace.getLayerManager())==null||c.moveToDragLayer(this.block);this.getVisibleBubbles(this.block).forEach(d=>{var e;(e=this.workspace.getLayerManager())==
1292
1292
  null||e.moveToDragLayer(d,!1)});this.announceMove(!0);return this.block}cacheAllConnectionPairs(){var a=this.block.workspace.connectionChecker,b=[];this.allConnectionPairs=[];var c=this.getLocalConnections(this.block);for(let d of this.block.workspace.getTopBlocks(!0))b.push(...this.getAllConnections(d));for(let d of b)for(let e of c){let f;!a.canConnect(e,d,!0,Infinity)||((f=d.targetBlock())==null?0:f.isInsertionMarker())||this.allConnectionPairs.push({local:e,neighbour:d})}}getVisibleBubbles(a){return a.getDescendants(!1).flatMap(b=>
1293
1293
  b.getIcons()).filter(b=>xd(b)&&b.bubbleIsVisible()).map(b=>b.getBubble()).filter(b=>!!b).sort((b,c)=>{b=b.getSvgRoot().compareDocumentPosition(c.getSvgRoot());return b&Node.DOCUMENT_POSITION_PRECEDING?1:b&Node.DOCUMENT_POSITION_FOLLOWING?-1:0})}shouldHealStack(a){return a instanceof PointerEvent?a.ctrlKey||a.metaKey:a instanceof KeyboardEvent?!(a.shiftKey||!this.block.previousConnection):!1}shouldDisconnect(a){return!!(this.block.getParent()||a&&this.block.nextConnection&&this.block.nextConnection.targetBlock())}disconnectBlock(a){this.block.unplug(a);
1294
1294
  Ph(this.block)}storeInitialConnections(a){var b=this.startChildConn=this.startParentConn=null,c=null,d;if((d=this.block.outputConnection)==null?0:d.isConnected())b=this.block.outputConnection,c=this.block.outputConnection.targetConnection;else{let e;if((e=this.block.previousConnection)==null?0:e.isConnected())b=this.block.previousConnection,c=this.block.previousConnection.targetConnection}this.startParentConn=c;b&&c?this.connectionCandidate={local:b,neighbour:c,distance:0}:a&&(a=this.block.nextConnection,
1295
1295
  b=a==null?void 0:a.targetConnection,a&&b&&(this.connectionCandidate={local:a,neighbour:b,distance:0}),this.startChildConn=b!=null?b:null)}fireDragStartEvent(){var a=new (u(v.BLOCK_DRAG))(this.block,!0,this.block.getDescendants(!1));w(a)}fireDragEndEvent(){var a=new (u(v.BLOCK_DRAG))(this.block,!1,this.block.getDescendants(!1));w(a)}fireMoveEvent(){if(!this.block.isDeadOrDying()){var a=new (u(v.BLOCK_MOVE))(this.block);a.setReason(["drag"]);a.oldCoordinate=this.startLoc;a.recordNew();w(a)}}drag(a,
1296
- b){this.updateMoveMode(b);this.moveMode===Yn.UNCONSTRAINED&&this.block.moveDuringDrag(a);b=!!this.connectionCandidate;this.updateConnectionPreview(this.block,D.difference(a,this.startLoc));if(this.connectionCandidate)this.moveMode===Yn.CONSTRAINED&&this.block.moveDuringDrag(this.determineConnectionOffset());else if(this.moveMode===Yn.CONSTRAINED&&(this.allConnectionPairs.length||Yi(this.workspace,!0),!b)){this.workspace.getAudioManager().playErrorBeep();return}this.announceMove()}determineConnectionOffset(){var {local:a,
1296
+ b){this.updateMoveMode(b);this.moveMode===Yn.UNCONSTRAINED&&this.block.moveDuringDrag(a);b=!!this.connectionCandidate;this.updateConnectionPreview(this.block,D.difference(a,this.startLoc));if(this.connectionCandidate)this.moveMode===Yn.CONSTRAINED&&this.block.moveDuringDrag(this.determineConnectionOffset());else if(this.moveMode===Yn.CONSTRAINED&&(this.allConnectionPairs.length||Xi(this.workspace,!0),!b)){this.workspace.getAudioManager().playErrorBeep();return}this.announceMove()}determineConnectionOffset(){var {local:a,
1297
1297
  neighbour:b}=this.connectionCandidate,c=a.getOffsetInBlock(),d=b.x-c.x;c=b.y-c.y;var e=this.BLOCK_CONNECTION_OFFSET;a.type===G.PREVIOUS_STATEMENT||a.type===G.OUTPUT_VALUE?(d+=e,c+=e):(d-=e,c-=e);return new D(d,c)}updateConnectionPreview(a,b,c){var d=this.connectionCandidate;c=c!=null?c:this.getConnectionCandidate(b);this.connectionCandidate=null;if(c){var e=d&&this.currCandidateIsBetter(d,b,c)?d:c;this.connectionCandidate=e;var {local:f,neighbour:g}=e;e=f.type===G.OUTPUT_VALUE||f.type===G.PREVIOUS_STATEMENT;
1298
1298
  var h;b=g.isConnected()&&!((h=g.targetBlock())==null?0:h.isInsertionMarker());if(e&&b&&!this.orphanCanConnectAtEnd(a,g.targetBlock(),f.type)){var m;(m=this.connectionPreviewer)==null||m.previewReplacement(f,g,g.targetBlock())}else{let E;(E=this.connectionPreviewer)==null||E.previewConnection(f,g)}return g}if(this.moveMode===Yn.CONSTRAINED){let E;h=(E=d==null?void 0:d.neighbour.getSourceBlock())!=null?E:null;let J;m=(J=h==null?void 0:h.getRootBlock())!=null?J:h;m===a&&(m=h);if(!m){let T;(T=this.connectionPreviewer)==
1299
1299
  null||T.hidePreview();return}h=a.workspace.getTopBlocks().filter(T=>T!==a.getRootBlock()).map(T=>T.getBoundingRectangle());if(!h.length){let T;(T=this.connectionPreviewer)==null||T.hidePreview();return}var z;d=(z=d==null?void 0:d.neighbour.x)!=null?z:a.getRelativeToSurfaceXY().x;z=this.BLOCK_CONNECTION_OFFSET*2;switch(this.getDirectionToNewLocation(D.sum(this.startLoc,b))){case si.LEFT:case si.UP:b=Math.min(...h.map(T=>T.top))-z-a.getHeightWidth().height;break;default:b=Math.max(...h.map(T=>T.bottom))+
@@ -1331,11 +1331,11 @@ null?void 0:c.getBoundingClientRect();return new D(this.RTL?a.x-5:a.x+5,(d&&d.he
1331
1331
  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)?
1332
1332
  (this.translation="",Vk.push(...this.getConnections_(!0)),this.addClass("blocklyDragging")):(Vk.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();
1333
1333
  for(let b=0;b<a.length;b++)a[b].updateEditable()}setShadow(a){super.setShadow(a);this.applyColour();this.recomputeAriaContext()}setInsertionMarker(a){this.isInsertionMarker_!==a&&(this.isInsertionMarker_=a)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))}getSvgRoot(){return this.svgGroup}getNearestNeighbour(){if(!this.workspace.rendered)return null;var a=this.workspace.getAllBlocks(!1).filter(e=>!e.isDeadOrDying()),b=
1334
- null,c=Number.MAX_SAFE_INTEGER,d=this.getRelativeToSurfaceXY();for(let e of a)a=e.getRelativeToSurfaceXY(),a=Math.sqrt(Math.pow(a.x-d.x,2)+Math.pow(a.y-d.y,2)),a<c&&(b=e,c=a);return b}dispose(a,b){this.disposing=!0;Tf();Gg();b&&(this.unplug(a),Kh(this));var c=$.t(),d,e;b=(e=(d=c.getFocusedNode())==null?void 0:d.getFocusableElement())!=null?e:null;super.dispose(!!a);Oa(this.svgGroup);if(this.getSvgRoot().contains(b)){let f=this.getParent();if(!f){let g;if(a=(g=this.outputConnection)!=null?g:this.previousConnection){let h;
1335
- f=(h=a.closest(0,new D(0,0)).connection)==null?void 0:h.getSourceBlock()}}setTimeout(()=>{if(this.workspace.rendered)if(f)c.focusNode(f);else{let g=this.getNearestNeighbour();g?c.focusNode(g):c.focusTree(this.workspace)}},0)}}disposeInternal(){this.disposing=!0;super.disposeInternal();$.t().getFocusedNode()===this&&this.workspace.cancelCurrentGesture();[...this.warningTextDb.values()].forEach(a=>clearTimeout(a));this.warningTextDb.clear();this.getIcons().forEach(a=>a.dispose())}checkAndDelete(){this.workspace.isFlyout||
1336
- ($.B(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),$.B(!1))}toCopyData(a=!1){return this.isInsertionMarker_?null:{paster:Qn.TYPE,blockState:ce(this,{addCoordinates:!0,addNextBlocks:a,saveIds:!1}),typeCounts:ub(this,!0)}}applyColour(){var a,b;(b=(a=this.pathObject).applyColour)==null||b.call(a,this);a=this.getIcons();for(b=0;b<a.length;b++)a[b].applyColour();for(let c of this.getFields())c.applyColour()}updateDisabled(){var a=!this.isEnabled()||this.getInheritedDisabled();
1337
- if(this.visuallyDisabled===a){let b;(b=this.getNextBlock())==null||b.updateDisabled()}else{this.applyColour();this.visuallyDisabled=a;for(let b of this.getChildren(!1))b.updateDisabled();this.recomputeAriaContext()}}setWarningText(a,b=""){if(b)this.warningTextDb.has(b)&&(clearTimeout(this.warningTextDb.get(b)),this.warningTextDb.delete(b));else{for(var c of this.warningTextDb.values())clearTimeout(c);this.warningTextDb.clear()}if(this.workspace.isDragging())this.warningTextDb.set(b,setTimeout(()=>
1338
- {this.isDeadOrDying()||(this.warningTextDb.delete(b),this.setWarningText(a,b))},100));else if(this.isInFlyout&&(a=null),c=this.getIcon(co.TYPE),a){let d=this.getSurroundParent(),e=null;for(;d;)d.isCollapsed()&&(e=d),d=d.getSurroundParent();e&&e.setWarningText($.C.COLLAPSED_WARNINGS_WARNING,ii.COLLAPSED_WARNING_ID);c?c.addMessage(a,b):this.addIcon((new co(this)).addMessage(a,b))}else c&&(b?(c.addMessage("",b),c.getText()||this.removeIcon(co.TYPE)):this.removeIcon(co.TYPE))}setMutator(a){this.removeIcon($.sh.TYPE);
1334
+ null,c=Number.MAX_SAFE_INTEGER,d=this.getRelativeToSurfaceXY();for(let e of a)a=e.getRelativeToSurfaceXY(),a=Math.sqrt(Math.pow(a.x-d.x,2)+Math.pow(a.y-d.y,2)),a<c&&(b=e,c=a);return b}dispose(a,b){this.disposing=!0;If(this.pathObject.svgPath);delete this.pathObject.svgPath.tooltip;Tf();Gg();b&&(this.unplug(a),Kh(this));var c=$.t(),d,e;b=(e=(d=c.getFocusedNode())==null?void 0:d.getFocusableElement())!=null?e:null;super.dispose(!!a);Oa(this.svgGroup);if(this.getSvgRoot().contains(b)){let f=this.getParent();
1335
+ if(!f){let g;if(a=(g=this.outputConnection)!=null?g:this.previousConnection){let h;f=(h=a.closest(0,new D(0,0)).connection)==null?void 0:h.getSourceBlock()}}setTimeout(()=>{if(this.workspace.rendered)if(f)c.focusNode(f);else{let g=this.getNearestNeighbour();g?c.focusNode(g):c.focusTree(this.workspace)}},0)}}disposeInternal(){this.disposing=!0;super.disposeInternal();$.t().getFocusedNode()===this&&this.workspace.cancelCurrentGesture();[...this.warningTextDb.values()].forEach(a=>clearTimeout(a));this.warningTextDb.clear();
1336
+ this.getIcons().forEach(a=>a.dispose())}checkAndDelete(){this.workspace.isFlyout||($.B(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),$.B(!1))}toCopyData(a=!1){return this.isInsertionMarker_?null:{paster:Qn.TYPE,blockState:ce(this,{addCoordinates:!0,addNextBlocks:a,saveIds:!1}),typeCounts:ub(this,!0)}}applyColour(){var a,b;(b=(a=this.pathObject).applyColour)==null||b.call(a,this);a=this.getIcons();for(b=0;b<a.length;b++)a[b].applyColour();for(let c of this.getFields())c.applyColour()}updateDisabled(){var a=
1337
+ !this.isEnabled()||this.getInheritedDisabled();if(this.visuallyDisabled===a){let b;(b=this.getNextBlock())==null||b.updateDisabled()}else{this.applyColour();this.visuallyDisabled=a;for(let b of this.getChildren(!1))b.updateDisabled();this.recomputeAriaContext()}}setWarningText(a,b=""){if(b)this.warningTextDb.has(b)&&(clearTimeout(this.warningTextDb.get(b)),this.warningTextDb.delete(b));else{for(var c of this.warningTextDb.values())clearTimeout(c);this.warningTextDb.clear()}if(this.workspace.isDragging())this.warningTextDb.set(b,
1338
+ setTimeout(()=>{this.isDeadOrDying()||(this.warningTextDb.delete(b),this.setWarningText(a,b))},100));else if(this.isInFlyout&&(a=null),c=this.getIcon(co.TYPE),a){let d=this.getSurroundParent(),e=null;for(;d;)d.isCollapsed()&&(e=d),d=d.getSurroundParent();e&&e.setWarningText($.C.COLLAPSED_WARNINGS_WARNING,ii.COLLAPSED_WARNING_ID);c?c.addMessage(a,b):this.addIcon((new co(this)).addMessage(a,b))}else c&&(b?(c.addMessage("",b),c.getText()||this.removeIcon(co.TYPE)):this.removeIcon(co.TYPE))}setMutator(a){this.removeIcon($.sh.TYPE);
1339
1339
  a&&this.addIcon(a)}addIcon(a){super.addIcon(a);a instanceof $.sh&&(this.mutator=a);a.initView(this.createIconPointerDownListener(a));a.applyColour();a.updateEditable();this.queueRender();return a}createIconPointerDownListener(a){return b=>{!this.isDeadOrDying()&&(b=this.workspace.getGesture(b))&&(this.bringToFront(),b.setStartIcon(a),$.t().focusNode(a))}}removeIcon(a){var b=super.removeIcon(a);a.equals($.sh.TYPE)&&(this.mutator=null);this.queueRender();return b}setDisabledReason(a,b){var c=this.isEnabled();
1340
1340
  super.setDisabledReason(a,b);this.isEnabled()===c||this.getInheritedDisabled()||this.updateDisabled()}setDeletable(a){super.setDeletable(a);a?Ma(this.svgGroup,"blocklyNotDeletable"):n(this.svgGroup,"blocklyNotDeletable")}setHighlighted(a){this.pathObject.updateHighlighted(a)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(a){this.pathObject.updateDraggingDelete(a)}getColour(){return this.style.colourPrimary}setColour(a){super.setColour(a);
1341
1341
  a=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_);var b,c;(c=(b=this.pathObject).setStyle)==null||c.call(b,a.style);this.style=a.style;this.styleName_=a.name;this.applyColour()}setStyle(a){var b=this.workspace.getRenderer().getConstants().getBlockStyle(a);this.styleName_&&Ma(this.svgGroup,this.styleName_);if(b){this.hat=b.hat;let c,d;(d=(c=this.pathObject).setStyle)==null||d.call(c,b);this.colour_=b.colourPrimary;this.style=b;this.applyColour();n(this.svgGroup,a);
@@ -1406,10 +1406,10 @@ this.setStartWorkspace(b);this.mostRecentEvent=a;this.targetBlock||this.startBub
1406
1406
  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");
1407
1407
  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=pc(this.flyout.getWorkspace(),this.targetBlock.getRelativeToSurfaceXY());
1408
1408
  b=oc(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=
1409
- 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){this.startBlock||this.startBubble||this.startIcon||(this.startBlock=a,a.isInFlyout&&a!==a.getRootBlock()?this.setTargetBlock(a.getRootBlock()):this.setTargetBlock(a))}setTargetBlock(a){a.isShadow()?
1410
- 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&&!this.hasExceededDragRadius&&!this.isFieldClick()&&!this.isIconClick()}isFieldClick(){return this.startField?
1411
- 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&&!this.startField&&!this.hasExceededDragRadius}getCurrentDragger(){var a,b;return(b=(a=this.workspaceDragger)!=
1412
- null?a:this.dragger)!=null?b:null}isDragging(){return this.dragging}hasStarted(){return this.gestureHasStarted}static inProgress(){var a=gb();for(let b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1}};var Cj=class{constructor(a,b){this.pattern=a;this.scale=1;var c;this.spacing=(c=b.spacing)!=null?c:0;var d;this.length=(d=b.length)!=null?d:1;this.line2=(this.line1=a.firstChild)&&this.line1.nextSibling;var e;this.snapToGrid=(e=b.snap)!=null?e:!1}setSpacing(a){this.spacing=a;this.update(this.scale)}getSpacing(){return this.spacing}setLength(a){this.length=a;this.update(this.scale)}getLength(){return this.length}setSnapToGrid(a){this.snapToGrid=a}shouldSnap(){return this.snapToGrid}getPatternId(){return this.pattern.id}update(a){this.scale=
1409
+ 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=
1410
+ 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&&
1411
+ !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&&
1412
+ !this.startField&&!this.hasExceededDragRadius}getCurrentDragger(){var a,b;return(b=(a=this.workspaceDragger)!=null?a:this.dragger)!=null?b:null}isDragging(){return this.dragging}hasStarted(){return this.gestureHasStarted}static inProgress(){var a=gb();for(let b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1}};var Cj=class{constructor(a,b){this.pattern=a;this.scale=1;var c;this.spacing=(c=b.spacing)!=null?c:0;var d;this.length=(d=b.length)!=null?d:1;this.line2=(this.line1=a.firstChild)&&this.line1.nextSibling;var e;this.snapToGrid=(e=b.snap)!=null?e:!1}setSpacing(a){this.spacing=a;this.update(this.scale)}getSpacing(){return this.spacing}setLength(a){this.length=a;this.update(this.scale)}getLength(){return this.length}setSnapToGrid(a){this.snapToGrid=a}shouldSnap(){return this.snapToGrid}getPatternId(){return this.pattern.id}update(a){this.scale=
1413
1413
  a;var b=this.spacing*a;this.pattern.setAttribute("width",`${b}`);this.pattern.setAttribute("height",`${b}`);b=Math.floor(this.spacing/2)+.5;var c=b-this.length/2,d=b+this.length/2;b*=a;c*=a;d*=a;this.setLineAttributes(this.line1,a,c,d,b,b);this.setLineAttributes(this.line2,a,b,b,c,d)}setLineAttributes(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",`${b}`),a.setAttribute("x1",`${c}`),a.setAttribute("y1",`${e}`),a.setAttribute("x2",`${d}`),a.setAttribute("y2",`${f}`))}moveTo(a,b){this.pattern.setAttribute("x",
1414
1414
  `${a}`);this.pattern.setAttribute("y",`${b}`)}alignXY(a){var b=this.getSpacing(),c=b/2,d=Math.round(Math.round((a.x-c)/b)*b+c);b=Math.round(Math.round((a.y-c)/b)*b+c);return d===a.x&&b===a.y?a:new D(d,b)}static createDom(a,b,c,d){a=r(q.PATTERN,{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c);var e,f;if(((e=b.length)!=null?e:1)>0&&((f=b.spacing)!=null?f:0)>0){r(q.LINE,{stroke:b.colour},a);let g;(g=b.length)!=null&&g&&r(q.LINE,{stroke:b.colour},a)}else r(q.LINE,{},a);d&&d.style.setProperty("--blocklyGridPattern",
1415
1415
  `url(#${a.id})`);return a}};var Fo=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,
@@ -1574,10 +1574,11 @@ this.workspace.recordDragTargets()}}autoHide(a){!a&&this.flyout&&this.closeFlyou
1574
1574
  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()}fireUiEvent(a){a=new (u(v.TRASHCAN_OPEN))(a,this.workspace.id);w(a)}blockMouseDownWhenOpenable(a){!this.contentsIsOpen()&&this.hasContents()&&a.stopPropagation()}onDelete(a){if(!(this.workspace.options.maxTrashcanContents<=
1575
1575
  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,$.C.OPEN_TRASH);za(this.svgGroup,p.DISABLED)}}}cleanBlockJson(a){function b(c){if(c){delete c.id;delete c.x;
1576
1576
  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)}getFocusableElement(){if(!this.svgGroup)throw Error("Tried to focus uninitialized trashcan");return this.svgGroup}getFocusableTree(){return this.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!!this.svgGroup}performAction(){this.click()}};
1577
- ta("\n .blocklyTrash {\n opacity: 0.4;\n transition: opacity 0.08 ease-out;\n }\n\n .blocklyTrashLid {\n transition: rotate 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,\n .blocklyTrash.blocklyTrashFull:hover,\n .blocklyTrash.blocklyTrashFull:focus {\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.blocklyTrashFull.blocklyTrashOpen .blocklyTrashLid,\n .blocklyRTL .blocklyTrash.blocklyTrashFull:hover .blocklyTrashLid,\n .blocklyRTL .blocklyTrash.blocklyTrashFull:focus .blocklyTrashLid {\n rotate: -45deg;\n }\n");var zp=class{constructor(a,b){this.procedureModelClass=a;this.parameterModelClass=b;this.priority=75}save(a){a=a.getProcedureMap().getProcedures().map(b=>Aj(b));return a.length?a:null}load(a,b){var c=b.getProcedureMap();for(let d of a)c.add(Bj(this.procedureModelClass,this.parameterModelClass,d,b))}clear(a){a.getProcedureMap().clear()}},Ap={};Ap.ProcedureSerializer=zp;Ap.loadProcedure=Bj;Ap.saveProcedure=Aj;var Bp=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 Bp);var Cp={};Cp.VariableSerializer=Bp;var Dp={blocks:Qm,exceptions:Om,priorities:{BLOCKS:50,PROCEDURES:75,VARIABLES:100,WORKSPACE_COMMENTS:25},procedures:Ap,registry:rl,variables:Cp,workspaceComments:tl,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||
1577
+ ta("\n .blocklyTrash {\n opacity: 0.4;\n transition: opacity 0.08 ease-out;\n }\n\n .blocklyTrashLid {\n transition: rotate 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,\n .blocklyTrash.blocklyTrashFull:hover,\n .blocklyTrash.blocklyTrashFull:focus {\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 zp=class{constructor(a,b){this.procedureModelClass=a;this.parameterModelClass=b;this.priority=75}save(a){a=a.getProcedureMap().getProcedures().map(b=>Aj(b));return a.length?a:null}load(a,b){var c=b.getProcedureMap();for(let d of a)c.add(Bj(this.procedureModelClass,this.parameterModelClass,d,b))}clear(a){a.getProcedureMap().clear()}},Ap={};Ap.ProcedureSerializer=zp;Ap.loadProcedure=Bj;Ap.saveProcedure=Aj;var Bp=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 Bp);var Cp={};Cp.VariableSerializer=Bp;var Dp={blocks:Qm,exceptions:Om,priorities:{BLOCKS:50,PROCEDURES:75,VARIABLES:100,WORKSPACE_COMMENTS:25},procedures:Ap,registry:rl,variables:Cp,workspaceComments:tl,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||
1578
1578
  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:$k});var Ep=class{load(a,b){a=new Di(b.getWorkspace(),b.targetWorkspace,a,!0);a.show();return new go(a,"label")}gapForItem(a,b){return b}disposeItem(a){a=a.getElement();a instanceof Di&&a.dispose()}getType(){return"label"}};A(y.FLYOUT_INFLATER,"label",Ep);var Fp=class{constructor(){this.size=new hc(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 hc(e.getWidth(),e.getHeight());e=a.getSourceBlock().getRelativeToSurfaceXY();
1579
- 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})`);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||b.getSourceBlock().queueRender();dd();
1580
- 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!==b&&a.nextConnection.tightenEfficiently()}};var Gp=class extends lp{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 Hp=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_=
1579
+ 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||
1580
+ 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!==
1581
+ b&&a.nextConnection.tightenEfficiently()}};var Gp=class extends lp{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 Hp=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_=
1581
1582
  this.highlightConstants_.START_HAT;this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH}getPath(){return this.steps_+"\n"+this.inlineSteps_}drawTopCorner(a){this.steps_+=Dh(a.xPos,this.info_.startY);for(let b=0,c;c=a.elements[b];b++)Q.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:Q.isLeftRoundedCorner(c)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):Q.isPreviousConnection(c)?this.steps_+=this.notchPaths_.pathLeft:Q.isHat(c)?this.steps_+=this.startPaths_.path(this.RTL_):
1582
1583
  Q.isSpacer(c)&&c.width!==0&&(this.steps_+=I("H",c.xPos+c.width-this.highlightOffset));this.steps_+=I("H",a.xPos+a.width-this.highlightOffset)}drawJaggedEdge_(a){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+I("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(a){var b=a.getLastInput();if(this.RTL_){let c=a.height-b.connectionHeight;this.steps_+=Ch(b.xPos+b.width-this.highlightOffset,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+I("v",c)}else this.steps_+=
1583
1584
  Ch(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(a){var b=a.getLastInput();if(b)if(this.RTL_){let c=a.height-2*this.insideCornerPaths_.height;this.steps_+=Ch(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+I("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+Eh(a.width-b.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=Ch(b.xPos,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+Eh(a.width-b.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(a){var b=
@@ -1716,16 +1717,16 @@ void 0,a)}recomputeAriaContext(){if(!super.recomputeAriaContext())return!1;var a
1716
1717
  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,Dk.Capability.DELETE_AREA)?a.wouldDelete(b):!1}onDragEnd(a){var b=$.gd,c=
1717
1718
  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=fi(this.draggable)&&this.wouldDeleteDraggable(c,this.draggable))&&fi(this.draggable)?(this.draggable.endDrag(a,Un.DELETE),$.B(b),this.draggable.dispose()):this.draggable.endDrag(a,d?Un.REVERT:Un.COMMIT);$.B(!1);!c&&$a(this.draggable)&&$.t().focusNode(this.draggable)}else this.draggable.endDrag(a,
1718
1719
  Un.COMMIT),$a(this.draggable)&&$.t().focusNode(this.draggable)}onDragRevert(){this.draggable.revertDrag();$a(this.draggable)&&$.t().focusNode(this.draggable)}shouldReturnToStart(a,b){return(a=this.draggable.workspace.getDragTarget(a))?a.shouldPreventMove(b):!1}pixelsToWorkspaceUnits(a){a=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}};
1719
- A(y.BLOCK_DRAGGER,"default",kq);var lq={};lq.BlockDragStrategy=$n;lq.BubbleDragStrategy=qn;lq.CommentDragStrategy=cn;lq.Dragger=kq;var mq={};mq.BottomRow=Wp;mq.ConstantProvider=Rp;mq.Drawer=Sp;mq.PathObject=$p;mq.RenderInfo=Zp;mq.Renderer=aq;mq.RightConnectionShape=Xp;mq.StatementInput=Yj;mq.TopRow=Yp;ik();var nq={};nq.registerCleanup=Nj;nq.registerCollapse=Pj;nq.registerCollapseExpandBlock=bk;nq.registerComment=Xj;nq.registerCommentCreate=hk;nq.registerCommentDelete=fk;nq.registerCommentDuplicate=gk;nq.registerCommentOptions=function(){gk();fk();hk()};nq.registerDefaultOptions=ik;nq.registerDelete=dk;nq.registerDeleteAll=Uj;nq.registerDisable=ck;nq.registerDuplicate=Vj;nq.registerExpand=Qj;nq.registerHelp=ek;nq.registerInline=Zj;nq.registerRedo=Mj;nq.registerUndo=Lj;var oq=class{canConnect(a,b,c,d){return this.canConnectWithReason(a,b,c,d)===Bn.CAN_CONNECT}canConnectWithReason(a,b,c,d){var e=this.doSafetyChecks(a,b);return e!==Bn.CAN_CONNECT?e:this.doTypeChecks(a,b)?c&&!this.doDragChecks(a,b,d||0)?Bn.REASON_DRAG_CHECKS_FAILED:Bn.CAN_CONNECT:Bn.REASON_CHECKS_FAILED}getErrorMessage(a,b,c){switch(a){case Bn.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Bn.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Bn.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";
1720
+ A(y.BLOCK_DRAGGER,"default",kq);var lq={};lq.BlockDragStrategy=$n;lq.BubbleDragStrategy=qn;lq.CommentDragStrategy=cn;lq.Dragger=kq;var mq={};mq.BottomRow=Wp;mq.ConstantProvider=Rp;mq.Drawer=Sp;mq.PathObject=$p;mq.RenderInfo=Zp;mq.Renderer=aq;mq.RightConnectionShape=Xp;mq.StatementInput=Yj;mq.TopRow=Yp;ik();var nq={};nq.registerCleanup=Nj;nq.registerCollapse=Pj;nq.registerCollapseExpandBlock=ak;nq.registerComment=Xj;nq.registerCommentCreate=hk;nq.registerCommentDelete=fk;nq.registerCommentDuplicate=gk;nq.registerCommentOptions=function(){gk();fk();hk()};nq.registerDefaultOptions=ik;nq.registerDelete=dk;nq.registerDeleteAll=Uj;nq.registerDisable=ck;nq.registerDuplicate=Vj;nq.registerExpand=Qj;nq.registerHelp=ek;nq.registerInline=Zj;nq.registerRedo=Mj;nq.registerUndo=Lj;var oq=class{canConnect(a,b,c,d){return this.canConnectWithReason(a,b,c,d)===Bn.CAN_CONNECT}canConnectWithReason(a,b,c,d){var e=this.doSafetyChecks(a,b);return e!==Bn.CAN_CONNECT?e:this.doTypeChecks(a,b)?c&&!this.doDragChecks(a,b,d||0)?Bn.REASON_DRAG_CHECKS_FAILED:Bn.CAN_CONNECT:Bn.REASON_CHECKS_FAILED}getErrorMessage(a,b,c){switch(a){case Bn.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Bn.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Bn.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";
1720
1721
  case Bn.REASON_TARGET_NULL:return"Target connection is null.";case Bn.REASON_CHECKS_FAILED:return"Connection checks failed. "+(b+" expected "+b.getCheck()+", found "+c.getCheck());case Bn.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case Bn.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case Bn.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,
1721
1722
  b){if(!a||!b)return Bn.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?Bn.REASON_SELF_CONNECTION:e.type!==Gn[a.type]?Bn.REASON_WRONG_TYPE:c.workspace!==d.workspace?Bn.REASON_DIFFERENT_WORKSPACES:c.isShadow()&&!d.isShadow()?Bn.REASON_SHADOW_PARENT:e.type===G.OUTPUT_VALUE&&d.previousConnection&&d.previousConnection.isConnected()||e.type===G.PREVIOUS_STATEMENT&&d.outputConnection&&d.outputConnection.isConnected()?
1722
1723
  Bn.REASON_PREVIOUS_AND_OUTPUT:Bn.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()&&
1723
1724
  !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 Vk.includes(b)?!1:!0}canConnectToPrevious_(a,b){if(a.targetConnection||Vk.includes(b))return!1;if(!b.targetConnection)return!0;a=b.targetBlock();return a.isInsertionMarker()?!a.getPreviousBlock():!1}};
1724
1725
  A(y.CONNECTION_CHECKER,"default",oq);var pq=class{load(a,b){a=new Di(b.getWorkspace(),b.targetWorkspace,a,!1);a.show();return new go(a,"button")}gapForItem(a,b){return b}disposeItem(a){a=a.getElement();a instanceof Di&&a.dispose()}getType(){return"button"}};A(y.FLYOUT_INFLATER,"button",pq);var qq={};qq.Bubble=sn;qq.MiniWorkspaceBubble=tn;qq.TextBubble=bo;qq.TextInputBubble=zn;var rq=class{constructor(){this.permanentlyDisabledBlocks=new Set;this.listeners=new Map;this.capacityWrapper=this.filterFlyoutBasedOnCapacity.bind(this)}load(a,b){this.setFlyout(b);a=this.createBlock(a,b.getWorkspace());a.isEnabled()?this.updateStateBasedOnCapacity(a):this.permanentlyDisabledBlocks.add(a);a.getDescendants(!1).forEach(f=>{f.isInFlyout=!0;f=f.getFocusableElement();l(f,p.HIDDEN,!0);ya(f,Ka.NONE)});var c=a.getFocusableElement();za(c,p.HIDDEN);ya(c,Ka.OPTION);var d=a.getIcons().filter(f=>
1725
1726
  {var g;return(g=f.isClickableInFlyout)==null?void 0:g.call(f,b.autoClose)}).map(f=>f.getFocusableElement().id).filter(f=>!!f),e=a.getConnections_(!0).map(f=>f.id);d=[...d,...e];d.length&&l(c,p.OWNS,d);this.addBlockListeners(a);return new go(a,"block")}createBlock(a,b){a.blockxml?(a=typeof a.blockxml==="string"?$.uc(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===!1&&(a.disabledReasons=["MANUALLY_DISABLED"]),
1726
- "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"?$.uc(a.blockxml):a.blockxml,c=parseInt(a.getAttribute("gap")));return!c||isNaN(c)?b:c}disposeItem(a){a=a.getElement();a instanceof ii&&(this.removeListeners(a.id),a.dispose(!1,!1))}removeListeners(a){var b;((b=this.listeners.get(a))!=null?b:[]).forEach(c=>ka(c));this.listeners.delete(a)}setFlyout(a){if(this.flyout!==a){if(this.flyout){let c;
1727
- (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=[];b.push(k(a.getSvgRoot(),"pointerdown",a,c=>{var d,e,f=(d=this.flyout)==null?
1728
- void 0:(e=d.targetWorkspace)==null?void 0:e.getGesture(c);f&&this.flyout&&(f.setStartBlock(a),f.handleFlyoutStart(c,this.flyout))}));b.push(ja(a.getSvgRoot(),"pointermove",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.addSelect()}));b.push(ja(a.getSvgRoot(),"pointerleave",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.removeSelect()}));this.listeners.set(a.id,b)}filterFlyoutBasedOnCapacity(a){!this.flyout||
1727
+ "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"?$.uc(a.blockxml):a.blockxml,c=parseInt(a.getAttribute("gap")));return!c||isNaN(c)?b:c}disposeItem(a){a=a.getElement();a instanceof ii&&(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=>ka(c));this.listeners.delete(a)}setFlyout(a){if(this.flyout!==
1728
+ 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=[];b.push(k(a.getSvgRoot(),"pointerdown",a,c=>{var d,
1729
+ 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(ja(a.getSvgRoot(),"pointermove",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.addSelect()}));b.push(ja(a.getSvgRoot(),"pointerleave",null,()=>{var c,d;((c=this.flyout)==null?0:(d=c.targetWorkspace)==null?0:d.isDragging())||a.removeSelect()}));this.listeners.set(a.id,b)}filterFlyoutBasedOnCapacity(a){!this.flyout||
1729
1730
  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",rq);var sq={};sq.ConstantProvider=Gp;sq.Drawer=Ip;sq.HighlightConstantProvider=Jp;sq.Highlighter=Hp;sq.InlineInput=Kp;sq.PathObject=Np;sq.RenderInfo=Mp;sq.Renderer=Op;sq.StatementInput=Lp;var tq={};tq.RenderInfo=Pp;tq.Renderer=Qp;var uq=new nn("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",
1730
1731
  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"},
1731
1732
  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 vq={Classic:on,Zelos:uq};var wq=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.");
@@ -1757,19 +1758,19 @@ for(let d=0;d<a.length;d++)this.createToolboxItem(a[d],b);var c;(c=this.contents
1757
1758
  0;b<a.length;b++)this.addToolboxItem_(a[b])}}getToolboxItems(){return[...this.contents.values()]}addStyle(a){a&&this.HtmlDiv&&n(this.HtmlDiv,a)}removeStyle(a){a&&this.HtmlDiv&&Ma(this.HtmlDiv,a)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var a=this.HtmlDiv.getBoundingClientRect(),b=a.top,c=b+a.height,d=a.left;a=d+a.width;return this.toolboxPosition===F.TOP?new cc(-1E7,c,-1E7,1E7):this.toolboxPosition===F.BOTTOM?new cc(b,1E7,-1E7,1E7):this.toolboxPosition===F.LEFT?new cc(-1E7,1E7,
1758
1759
  -1E7,a):new cc(-1E7,1E7,d,1E7)}onDragEnter(){ri.mover.isMoving()||this.updateCursorDeleteStyle_(!0)}onDragExit(){ri.mover.isMoving()||this.updateCursorDeleteStyle_(!1)}onDrop(){ri.mover.isMoving()||this.updateCursorDeleteStyle_(!1)}updateWouldDelete_(a){a!==this.wouldDelete_&&(this.updateCursorDeleteStyle_(!1),this.wouldDelete_=a,this.updateCursorDeleteStyle_(!0))}updateCursorDeleteStyle_(a){var b=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";a?this.addStyle(b):this.removeStyle(b)}getToolboxItemById(a){return this.contents.get(a)||
1759
1760
  null}getWidth(){return this.width_}getHeight(){return this.height_}getFlyout(){return this.flyout}getWorkspace(){return this.workspace_}getSelectedItem(){return this.selectedItem_}getPreviouslySelectedItem(){return this.previouslySelectedItem_}isHorizontal(){return this.horizontalLayout}position(){var a=this.workspace_.getMetrics(),b=this.HtmlDiv;if(b){this.horizontalLayout?(b.style.left="0",b.style.height="auto",b.style.width="100%",this.height_=b.offsetHeight,this.width_=a.viewWidth,this.toolboxPosition===
1760
- F.TOP?b.style.top="0":b.style.bottom="0"):(this.toolboxPosition===F.RIGHT?b.style.right="0":b.style.left="0",b.style.height="100%",this.width_=b.offsetWidth,this.height_=a.viewHeight);var c;(c=this.flyout)==null||c.position()}}handleToolboxItemResize(){if(this.HtmlDiv){var a=this.workspace_,b=this.HtmlDiv.getBoundingClientRect(),c=this.getFlyout(),d=this.toolboxPosition===F.LEFT?a.scrollX+b.width+((c==null?0:c.isVisible())?c.getWidth():0):a.scrollX;b=this.toolboxPosition===F.TOP?a.scrollY+b.height+
1761
- ((c==null?0:c.isVisible())?c.getHeight():0):a.scrollY;a.translate(d,b);tb(a)}}clearSelection(){this.setSelectedItem(null)}refreshTheme(){this.contents.forEach(a=>{a.refreshTheme&&a.refreshTheme()})}refreshSelection(){if(this.selectedItem_&&this.selectedItem_.isSelectable()&&this.selectedItem_.getContents().length){let a;(a=this.flyout)==null||a.show(this.selectedItem_.getContents())}}setVisible(a){this.isVisible_!==a&&(this.HtmlDiv&&(this.HtmlDiv.style.display=a?"block":"none"),this.isVisible_=a,
1762
- this.workspace_.recordDragTargets())}autoHide(a){!a&&this.flyout&&this.flyout.autoClose&&this.clearSelection()}setSelectedItem(a){var b=this.selectedItem_;!a&&!b||a&&!ve(a)||(this.shouldDeselectItem_(b,a)&&b!==null&&this.deselectItem_(b),this.shouldSelectItem_(b,a)&&a!==null&&this.selectItem_(b,a),this.updateFlyout_(b,a),this.fireSelectEvent(b,a))}shouldDeselectItem_(a,b){return a!==null&&(!a.isCollapsible()||a!==b)}shouldSelectItem_(a,b){return b!==null&&b!==a}deselectItem_(a){this.selectedItem_=
1763
- null;this.previouslySelectedItem_=a;a.setSelected(!1);l(this.contentsDiv_,p.ACTIVEDESCENDANT,"")}selectItem_(a,b){this.selectedItem_=b;this.previouslySelectedItem_=a;b.setSelected(!0);l(this.contentsDiv_,p.ACTIVEDESCENDANT,b.getId())}selectItemByPosition(a){(a=this.getToolboxItems()[a])&&this.setSelectedItem(a)}updateFlyout_(a,b){if(b&&(a!==b||b.isCollapsible())&&b.getContents().length){let c;(c=this.flyout)==null||c.show(b.getContents());let d;(d=this.flyout)==null||d.scrollToStart()}else{let c;
1764
- (c=this.flyout)==null||c.hide()}}fireSelectEvent(a,b){var c=a&&a.getName(),d=b&&b.getName();a===b&&(d=null);a=new (u(v.TOOLBOX_ITEM_SELECT))(c,d,this.workspace_.id);w(a)}toggleSelectedItem(a){var b,c;return bj(this.selectedItem_)&&((b=this.selectedItem_)==null?0:b.isCollapsible())&&((c=this.selectedItem_)==null?void 0:c.isExpanded())!==a?(this.selectedItem_.toggleExpanded(),!0):!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox");var a;(a=this.flyout)==null||a.dispose();this.contents.forEach(b=>
1765
- b.dispose());for(a=0;a<this.boundEvents_.length;a++)ka(this.boundEvents_[a]);this.boundEvents_=[];this.contents.clear();this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),Oa(this.HtmlDiv));$.t().unregisterTree(this)}getFocusableElement(){if(!this.HtmlDiv)throw Error("Toolbox DOM has not yet been created.");return this.HtmlDiv}getFocusableTree(){return this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(a){if(!a||
1766
- a===this){let b;return(b=this.getToolboxItems().find(c=>c.isSelectable()))!=null?b:null}return null}getNestedTrees(){return[]}lookUpFocusableNode(a){return this.getToolboxItemById(a)}onTreeFocus(a){a!==this?this.getSelectedItem()===a||this.mouseDown||this.setSelectedItem(a):this.clearSelection()}onTreeBlur(a){var b;a&&a===((b=this.flyout)==null?void 0:b.getWorkspace())||this.autoHide(!1)}getNavigator(){return this.navigator}};ta('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolbox {\n box-sizing: border-box;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxCategoryGroup {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxCategoryGroup:focus {\n outline: none;\n}\n');
1761
+ F.TOP?b.style.top="0":b.style.bottom="0"):(this.toolboxPosition===F.RIGHT?b.style.right="0":b.style.left="0",b.style.height="100%",this.width_=b.offsetWidth,this.height_=a.viewHeight);var c;(c=this.flyout)==null||c.position()}}handleToolboxItemResize(){if(this.HtmlDiv){var a=this.workspace_,b=this.HtmlDiv.getBoundingClientRect(),c=this.getFlyout(),d=this.toolboxPosition===F.LEFT?a.scrollX+b.width+(c&&!c.autoClose?c.getWidth():0):a.scrollX;b=this.toolboxPosition===F.TOP?a.scrollY+b.height+(c&&!c.autoClose?
1762
+ c.getHeight():0):a.scrollY;a.translate(d,b);tb(a)}}clearSelection(){this.setSelectedItem(null)}refreshTheme(){this.contents.forEach(a=>{a.refreshTheme&&a.refreshTheme()})}refreshSelection(){if(this.selectedItem_&&this.selectedItem_.isSelectable()&&this.selectedItem_.getContents().length){let a;(a=this.flyout)==null||a.show(this.selectedItem_.getContents())}}setVisible(a){this.isVisible_!==a&&(this.HtmlDiv&&(this.HtmlDiv.style.display=a?"block":"none"),this.isVisible_=a,this.workspace_.recordDragTargets())}autoHide(a){!a&&
1763
+ this.flyout&&this.flyout.autoClose&&this.clearSelection()}setSelectedItem(a){var b=this.selectedItem_;!a&&!b||a&&!ve(a)||(this.shouldDeselectItem_(b,a)&&b!==null&&this.deselectItem_(b),this.shouldSelectItem_(b,a)&&a!==null&&this.selectItem_(b,a),this.updateFlyout_(b,a),this.fireSelectEvent(b,a))}shouldDeselectItem_(a,b){return a!==null&&(!a.isCollapsible()||a!==b)}shouldSelectItem_(a,b){return b!==null&&b!==a}deselectItem_(a){this.selectedItem_=null;this.previouslySelectedItem_=a;a.setSelected(!1);
1764
+ l(this.contentsDiv_,p.ACTIVEDESCENDANT,"")}selectItem_(a,b){this.selectedItem_=b;this.previouslySelectedItem_=a;b.setSelected(!0);l(this.contentsDiv_,p.ACTIVEDESCENDANT,b.getId())}selectItemByPosition(a){(a=this.getToolboxItems()[a])&&this.setSelectedItem(a)}updateFlyout_(a,b){if(b&&(a!==b||b.isCollapsible())&&b.getContents().length){let c;(c=this.flyout)==null||c.show(b.getContents());let d;(d=this.flyout)==null||d.scrollToStart()}else{let c;(c=this.flyout)==null||c.hide()}}fireSelectEvent(a,b){var c=
1765
+ a&&a.getName(),d=b&&b.getName();a===b&&(d=null);a=new (u(v.TOOLBOX_ITEM_SELECT))(c,d,this.workspace_.id);w(a)}toggleSelectedItem(a){var b,c;return bj(this.selectedItem_)&&((b=this.selectedItem_)==null?0:b.isCollapsible())&&((c=this.selectedItem_)==null?void 0:c.isExpanded())!==a?(this.selectedItem_.toggleExpanded(),!0):!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox");var a;(a=this.flyout)==null||a.dispose();this.contents.forEach(b=>b.dispose());for(a=0;a<this.boundEvents_.length;a++)ka(this.boundEvents_[a]);
1766
+ this.boundEvents_=[];this.contents.clear();this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),Oa(this.HtmlDiv));$.t().unregisterTree(this)}getFocusableElement(){if(!this.HtmlDiv)throw Error("Toolbox DOM has not yet been created.");return this.HtmlDiv}getFocusableTree(){return this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(a){if(!a||a===this){let b;return(b=this.getToolboxItems().find(c=>c.isSelectable()))!=
1767
+ null?b:null}return null}getNestedTrees(){return[]}lookUpFocusableNode(a){return this.getToolboxItemById(a)}onTreeFocus(a){a!==this?this.getSelectedItem()===a||this.mouseDown||this.setSelectedItem(a):this.clearSelection()}onTreeBlur(a){var b;a&&a===((b=this.flyout)==null?void 0:b.getWorkspace())||this.autoHide(!1)}getNavigator(){return this.navigator}};ta('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolbox {\n box-sizing: border-box;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxCategoryGroup {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxCategoryGroup:focus {\n outline: none;\n}\n');
1767
1768
  A(y.TOOLBOX,"default",Aq);var Bq=G.INPUT_VALUE,Cq=G.OUTPUT_VALUE,Dq=G.NEXT_STATEMENT,Eq=G.PREVIOUS_STATEMENT,Fq=F.TOP,Gq=F.BOTTOM,Hq=F.LEFT,Iq=F.RIGHT;tp.prototype.newBlock=function(a,b){return new On(this,a,b)};$h.prototype.newBlock=function(a,b){return new ii(this,a,b)};tp.prototype.newComment=function(a){return new eh(this,a)};$h.prototype.newComment=function(a){return new dh(this,a)};$h.newTrashcan=function(a){return new yp(a)};tn.prototype.newWorkspaceSvg=function(a){return new $h(a)};
1768
1769
  $.kj.prototype.populateProcedures=function(a){a=hj(a);a=a[0].concat(a[1]);for(let b=0;b<a.length;b++)this.getName(a[b][0],$.kj.NameType.PROCEDURE)};var R={};R.Block=On;R.BlockFlyoutInflater=rq;R.BlockNavigationPolicy=mo;R.BlockSvg=ii;R.Blocks=zb;R.BubbleNavigationPolicy=no;R.ButtonFlyoutInflater=pq;R.COLLAPSED_FIELD_NAME="_TEMP_COLLAPSED_FIELD";R.COLLAPSED_INPUT_NAME="_TEMP_COLLAPSED_INPUT";R.COLLAPSE_CHARS=30;R.CodeGenerator=$.dq;R.CollapsibleToolboxCategory=zq;
1769
1770
  R.CommentBarButtonNavigationPolicy=oo;R.CommentEditorNavigationPolicy=po;R.ComponentManager=Dk;R.Connection=Bn;R.ConnectionChecker=oq;R.ConnectionDB=An;R.ConnectionNavigationPolicy=qo;R.ConnectionType=G;R.ContextMenu=Zm;R.ContextMenuItems=nq;R.ContextMenuRegistry=Kj;R.Css=Gk;R.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";R.DeleteArea=fo;R.Direction=si;R.DragDisposition=Un;R.DragTarget=eo;R.DropDownDiv=Tm;R.Events=N;R.Extensions=wn;R.Field=rg;R.FieldCheckbox=jq;R.FieldDropdown=zh;R.FieldImage=Tp;
1770
1771
  R.FieldLabel=ao;R.FieldLabelSerializable=iq;R.FieldNavigationPolicy=ro;R.FieldNumber=hq;R.FieldTextInput=$.Vp;R.FieldVariable=gq;R.Flyout=Co;R.FlyoutButton=Di;R.FlyoutButtonNavigationPolicy=ko;R.FlyoutItem=go;R.FlyoutMetricsManager=io;R.FlyoutNavigator=Ao;R.FlyoutSeparator=jo;R.FlyoutSeparatorNavigationPolicy=lo;R.FocusManager=Za;R.FocusableTreeTraverser=Pk;R.Generator=$.dq;R.Gesture=Eo;R.Grid=Cj;R.HorizontalFlyout=fq;R.INPUT_VALUE=Bq;R.IconNavigationPolicy=so;R.Input=Jn;
1771
1772
  R.InsertionMarkerPreviewer=bq;R.KeyboardMover=ri;R.KeyboardNavigationController=Lm;R.LabelFlyoutInflater=Ep;R.Menu=Ig;R.MenuItem=Kg;R.MetricsManager=ho;R.MoveIndicator=ln;R.Msg=$.C;R.NEXT_STATEMENT=Dq;R.Names=$.kj;R.NavigationDirection=vo;R.Navigator=xo;R.OPPOSITE_TYPE=Gn;R.OUTPUT_VALUE=Cq;R.Options=pn;R.PREVIOUS_STATEMENT=Eq;R.PROCEDURE_CATEGORY_NAME="PROCEDURE";R.Procedures=Lo;R.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";R.RenderedConnection=Mi;R.Scrollbar=Ic;R.ScrollbarPair=Gj;
1772
- R.SeparatorFlyoutInflater=Bo;R.ShortcutItems=Xn;R.ShortcutRegistry=x;R.TOOLBOX_AT_BOTTOM=Gq;R.TOOLBOX_AT_LEFT=Hq;R.TOOLBOX_AT_RIGHT=Iq;R.TOOLBOX_AT_TOP=Fq;R.Theme=nn;R.ThemeManager=rp;R.Themes=vq;R.Toast=li;R.Toolbox=Aq;R.ToolboxCategory=xq;R.ToolboxItem=wq;R.ToolboxItemNavigationPolicy=yo;R.ToolboxNavigator=zo;R.ToolboxSeparator=yq;R.Tooltip=Vm;R.Touch=lk;R.Trashcan=yp;R.UnattachedFieldError=lj;R.VARIABLE_CATEGORY_NAME="VARIABLE";R.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";R.VERSION="13.2.0";
1773
+ R.SeparatorFlyoutInflater=Bo;R.ShortcutItems=Xn;R.ShortcutRegistry=x;R.TOOLBOX_AT_BOTTOM=Gq;R.TOOLBOX_AT_LEFT=Hq;R.TOOLBOX_AT_RIGHT=Iq;R.TOOLBOX_AT_TOP=Fq;R.Theme=nn;R.ThemeManager=rp;R.Themes=vq;R.Toast=li;R.Toolbox=Aq;R.ToolboxCategory=xq;R.ToolboxItem=wq;R.ToolboxItemNavigationPolicy=yo;R.ToolboxNavigator=zo;R.ToolboxSeparator=yq;R.Tooltip=Vm;R.Touch=lk;R.Trashcan=yp;R.UnattachedFieldError=lj;R.VARIABLE_CATEGORY_NAME="VARIABLE";R.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";R.VERSION="13.2.1";
1773
1774
  R.VariableMap=xp;R.VariableModel=wp;R.Variables=Mm;R.VariablesDynamic=sp;R.VerticalFlyout=eq;R.WidgetDiv=Ym;R.Workspace=tp;R.WorkspaceAudio=up;R.WorkspaceCommentNavigationPolicy=to;R.WorkspaceDragger=Do;R.WorkspaceNavigationPolicy=uo;R.WorkspaceSvg=$h;R.Xml=jn;R.ZoomControls=ql;R.blockAnimations=Pn;R.blockRendering=qp;R.browserEvents=Ak;R.bubbles=qq;R.bumpObjects=Rn;R.clipboard=Sn;R.comments=Tn;R.common=Wk;R.config=$.Og;
1774
1775
  R.constants={COLLAPSED_FIELD_NAME:"_TEMP_COLLAPSED_FIELD",COLLAPSED_INPUT_NAME:"_TEMP_COLLAPSED_INPUT",MANUALLY_DISABLED:"MANUALLY_DISABLED"};R.defineBlocksWithJsonArray=xb;R.dialog=Bl;R.dragging=lq;R.fieldRegistry=kn;R.geras=sq;R.getFocusManager=$.t;R.getMainWorkspace=lb;R.getSelected=nb;R.hasBubble=xd;R.hideChaff=function(a){kb.hideChaff(a)};R.icons=Ho;
1775
1776
  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 pn(b||{});d=document.createElement("div");n(d,"injectionDiv");(b==null?0:b.rtl)&&n(d,"blocklyRTL");ya(d,Ka.APPLICATION);c.appendChild(d);b=Dj(d,a);var e=Ej(d,b,a);Ij(e);mb(e);tb(e);d.addEventListener("focusin",function(){mb(e)});k(d,"keydown",null,