Rebuild for rebase.

This commit is contained in:
Beka Westberg
2019-08-16 10:04:05 -07:00
parent ae3e8895b7
commit 1d99c0ffef
2 changed files with 630 additions and 650 deletions

View File

@@ -772,10 +772,12 @@ Blockly.longStart_=function(a,b){Blockly.longStop_();a.changedTouches&&1!=a.chan
Blockly.Touch.shouldHandleEvent=function(a){return!Blockly.Touch.isMouseOrTouchEvent(a)||Blockly.Touch.checkTouchIdentifier(a)};Blockly.Touch.getTouchIdentifierFromEvent=function(a){return void 0!=a.pointerId?a.pointerId:a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?a.changedTouches[0].identifier:"mouse"};
Blockly.Touch.checkTouchIdentifier=function(a){var b=Blockly.Touch.getTouchIdentifierFromEvent(a);return void 0!==Blockly.Touch.touchIdentifier_&&null!==Blockly.Touch.touchIdentifier_?Blockly.Touch.touchIdentifier_==b:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(Blockly.Touch.touchIdentifier_=b,!0):!1};Blockly.Touch.setClientFromTouch=function(a){if(Blockly.utils.string.startsWith(a.type,"touch")){var b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}};
Blockly.Touch.isMouseOrTouchEvent=function(a){return Blockly.utils.string.startsWith(a.type,"touch")||Blockly.utils.string.startsWith(a.type,"mouse")||Blockly.utils.string.startsWith(a.type,"pointer")};Blockly.Touch.isTouchEvent=function(a){return Blockly.utils.string.startsWith(a.type,"touch")||Blockly.utils.string.startsWith(a.type,"pointer")};
Blockly.Touch.splitEventByTouches=function(a){var b=[];if(a.changedTouches)for(var c=0;c<a.changedTouches.length;c++)b[c]={type:a.type,changedTouches:[a.changedTouches[c]],target:a.target,stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()}};else b.push(a);return b};Blockly.utils.dom={};Blockly.utils.dom.SVG_NS="http://www.w3.org/2000/svg";Blockly.utils.dom.HTML_NS="http://www.w3.org/1999/xhtml";Blockly.utils.dom.XLINK_NS="http://www.w3.org/1999/xlink";Blockly.utils.dom.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};
Blockly.Touch.splitEventByTouches=function(a){var b=[];if(a.changedTouches)for(var c=0;c<a.changedTouches.length;c++)b[c]={type:a.type,changedTouches:[a.changedTouches[c]],target:a.target,stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()}};else b.push(a);return b};Blockly.utils.dom={};Blockly.utils.dom.SVG_NS="http://www.w3.org/2000/svg";Blockly.utils.dom.HTML_NS="http://www.w3.org/1999/xhtml";Blockly.utils.dom.XLINK_NS="http://www.w3.org/1999/xlink";Blockly.utils.dom.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};Blockly.utils.dom.cacheWidths_=null;Blockly.utils.dom.cacheReference_=0;
Blockly.utils.dom.createSvgElement=function(a,b,c){a=document.createElementNS(Blockly.utils.dom.SVG_NS,a);for(var d in b)a.setAttribute(d,b[d]);document.body.runtimeStyle&&(a.runtimeStyle=a.currentStyle=a.style);c&&c.appendChild(a);return a};Blockly.utils.dom.addClass=function(a,b){var c=a.getAttribute("class")||"";if(-1!=(" "+c+" ").indexOf(" "+b+" "))return!1;c&&(c+=" ");a.setAttribute("class",c+b);return!0};
Blockly.utils.dom.removeClass=function(a,b){var c=a.getAttribute("class");if(-1==(" "+c+" ").indexOf(" "+b+" "))return!1;c=c.split(/\s+/);for(var d=0;d<c.length;d++)c[d]&&c[d]!=b||(c.splice(d,1),d--);c.length?a.setAttribute("class",c.join(" ")):a.removeAttribute("class");return!0};Blockly.utils.dom.hasClass=function(a,b){return-1!=(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")};Blockly.utils.dom.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};
Blockly.utils.dom.insertAfter=function(a,b){var c=b.nextSibling,d=b.parentNode;if(!d)throw Error("Reference node has no parent.");c?d.insertBefore(a,c):d.appendChild(a)};Blockly.utils.dom.containsNode=function(a,b){return!!(a.compareDocumentPosition(b)&Blockly.utils.dom.Node.DOCUMENT_POSITION_CONTAINED_BY)};Blockly.utils.dom.setCssTransform=function(a,b){a.style.transform=b;a.style["-webkit-transform"]=b};Blockly.utils.math={};Blockly.utils.math.toRadians=function(a){return a*Math.PI/180};Blockly.utils.math.toDegrees=function(a){return 180*a/Math.PI};Blockly.utils.math.clamp=function(a,b,c){if(c<a){var d=c;c=a;a=d}return Math.max(a,Math.min(b,c))};Blockly.Cursor=function(a){this.curNode_=null;this.isMarker_=!!a};Blockly.Cursor.prototype.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"};Blockly.Cursor.prototype.getCurNode=function(){return this.curNode_};Blockly.Cursor.prototype.setLocation=function(a){this.curNode_=a;this.update_()};Blockly.Cursor.prototype.update_=function(){};
Blockly.utils.dom.insertAfter=function(a,b){var c=b.nextSibling,d=b.parentNode;if(!d)throw Error("Reference node has no parent.");c?d.insertBefore(a,c):d.appendChild(a)};Blockly.utils.dom.containsNode=function(a,b){return!!(a.compareDocumentPosition(b)&Blockly.utils.dom.Node.DOCUMENT_POSITION_CONTAINED_BY)};Blockly.utils.dom.setCssTransform=function(a,b){a.style.transform=b;a.style["-webkit-transform"]=b};
Blockly.utils.dom.startTextWidthCache=function(){Blockly.utils.dom.cacheReference_++;Blockly.utils.dom.cacheWidths_||(Blockly.utils.dom.cacheWidths_={})};Blockly.utils.dom.stopTextWidthCache=function(){Blockly.utils.dom.cacheReference_--;Blockly.utils.dom.cacheReference_||(Blockly.utils.dom.cacheWidths_=null)};
Blockly.utils.dom.getTextWidth=function(a){var b=a.textContent+"\n"+a.className.baseVal,c;if(Blockly.utils.dom.cacheWidths_&&(c=Blockly.utils.dom.cacheWidths_[b]))return c;try{c=Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE?a.getBBox().width:a.getComputedTextLength()}catch(d){return 8*a.textContent.length}Blockly.utils.dom.cacheWidths_&&(Blockly.utils.dom.cacheWidths_[b]=c);return c};Blockly.utils.math={};Blockly.utils.math.toRadians=function(a){return a*Math.PI/180};Blockly.utils.math.toDegrees=function(a){return 180*a/Math.PI};Blockly.utils.math.clamp=function(a,b,c){if(c<a){var d=c;c=a;a=d}return Math.max(a,Math.min(b,c))};Blockly.Cursor=function(a){this.curNode_=null;this.isMarker_=!!a};Blockly.Cursor.prototype.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"};Blockly.Cursor.prototype.getCurNode=function(){return this.curNode_};Blockly.Cursor.prototype.setLocation=function(a){this.curNode_=a;this.update_()};Blockly.Cursor.prototype.update_=function(){};
Blockly.Cursor.prototype.next=function(){var a=this.getCurNode();if(!a)return null;(a=a.next())&&a.getType()===Blockly.ASTNode.types.NEXT&&(a=a.next()||a);a&&this.setLocation(a);return a};Blockly.Cursor.prototype["in"]=function(){var a=this.getCurNode();if(!a)return null;(a=a["in"]())&&a.getType()===Blockly.ASTNode.types.OUTPUT&&(a=a.next()||a);a&&this.setLocation(a);return a};
Blockly.Cursor.prototype.prev=function(){var a=this.getCurNode();if(!a)return null;(a=a.prev())&&a.getType()===Blockly.ASTNode.types.NEXT&&(a=a.prev()||a);a&&this.setLocation(a);return a};Blockly.Cursor.prototype.out=function(){var a=this.getCurNode();if(!a)return null;(a=a.out())&&this.setLocation(a);return a};Blockly.Events={};Blockly.Events.group_="";Blockly.Events.recordUndo=!0;Blockly.Events.disabled_=0;Blockly.Events.CREATE="create";Blockly.Events.BLOCK_CREATE=Blockly.Events.CREATE;Blockly.Events.DELETE="delete";Blockly.Events.BLOCK_DELETE=Blockly.Events.DELETE;Blockly.Events.CHANGE="change";Blockly.Events.BLOCK_CHANGE=Blockly.Events.CHANGE;Blockly.Events.MOVE="move";Blockly.Events.BLOCK_MOVE=Blockly.Events.MOVE;Blockly.Events.VAR_CREATE="var_create";Blockly.Events.VAR_DELETE="var_delete";
Blockly.Events.VAR_RENAME="var_rename";Blockly.Events.UI="ui";Blockly.Events.COMMENT_CREATE="comment_create";Blockly.Events.COMMENT_DELETE="comment_delete";Blockly.Events.COMMENT_CHANGE="comment_change";Blockly.Events.COMMENT_MOVE="comment_move";Blockly.Events.FINISHED_LOADING="finished_loading";Blockly.Events.BUMP_EVENTS=[Blockly.Events.BLOCK_CREATE,Blockly.Events.BLOCK_MOVE,Blockly.Events.COMMENT_CREATE,Blockly.Events.COMMENT_MOVE];Blockly.Events.FIRE_QUEUE_=[];
@@ -832,9 +834,9 @@ k.isShadow()||g.appendChild(Blockly.Xml.cloneShadow_(d,b));k&&(g.appendChild(Blo
Blockly.Xml.cloneShadow_=function(a,b){for(var c=a=a.cloneNode(!0),d;c;)if(b&&"shadow"==c.nodeName&&c.removeAttribute("id"),c.firstChild)c=c.firstChild;else{for(;c&&!c.nextSibling;)d=c,c=c.parentNode,d.nodeType==Blockly.utils.dom.Node.TEXT_NODE&&""==d.data.trim()&&c.firstChild!=d&&Blockly.utils.dom.removeNode(d);c&&(d=c,c=c.nextSibling,d.nodeType==Blockly.utils.dom.Node.TEXT_NODE&&""==d.data.trim()&&Blockly.utils.dom.removeNode(d))}return a};Blockly.Xml.domToText=function(a){return Blockly.utils.xml.domToText(a)};
Blockly.Xml.domToPrettyText=function(a){a=Blockly.Xml.domToText(a).split("<");for(var b="",c=1;c<a.length;c++){var d=a[c];"/"==d[0]&&(b=b.substring(2));a[c]=b+"<"+d;"/"!=d[0]&&"/>"!=d.slice(-2)&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");return a.replace(/^\n/,"")};
Blockly.Xml.textToDom=function(a){var b=Blockly.utils.xml.textToDomDocument(a);if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return b.documentElement};Blockly.Xml.clearWorkspaceAndLoadFromXml=function(a,b){b.setResizesEnabled(!1);b.clear();var c=Blockly.Xml.domToWorkspace(a,b);b.setResizesEnabled(!0);return c};
Blockly.Xml.domToWorkspace=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var d;b.RTL&&(d=b.getWidth());c=[];Blockly.Field.startCache();var e=a.childNodes.length,f=Blockly.Events.getGroup();f||Blockly.Events.setGroup(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);var g=!0;try{for(var h=0;h<e;h++){var k=a.childNodes[h],l=k.nodeName.toLowerCase();if("block"==l||"shadow"==l&&!Blockly.Events.recordUndo){var m=
Blockly.Xml.domToWorkspace=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var d;b.RTL&&(d=b.getWidth());c=[];Blockly.utils.dom.startTextWidthCache();var e=a.childNodes.length,f=Blockly.Events.getGroup();f||Blockly.Events.setGroup(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);var g=!0;try{for(var h=0;h<e;h++){var k=a.childNodes[h],l=k.nodeName.toLowerCase();if("block"==l||"shadow"==l&&!Blockly.Events.recordUndo){var m=
Blockly.Xml.domToBlock(k,b);c.push(m.id);var n=k.hasAttribute("x")?parseInt(k.getAttribute("x"),10):10,p=k.hasAttribute("y")?parseInt(k.getAttribute("y"),10):10;isNaN(n)||isNaN(p)||m.moveBy(b.RTL?d-n:n,p);g=!1}else{if("shadow"==l)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==l)b.rendered?Blockly.WorkspaceCommentSvg.fromXml(k,b,d):Blockly.WorkspaceComment.fromXml(k,b);else if("variables"==l){if(g)Blockly.Xml.domToVariables(k,b);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");
g=!1}}}}finally{f||Blockly.Events.setGroup(!1),Blockly.Field.stopCache()}b.setResizesEnabled&&b.setResizesEnabled(!0);Blockly.Events.fire(new Blockly.Events.FinishedLoading(b));return c};
g=!1}}}}finally{f||Blockly.Events.setGroup(!1),Blockly.utils.dom.stopTextWidthCache()}b.setResizesEnabled&&b.setResizesEnabled(!0);Blockly.Events.fire(new Blockly.Events.FinishedLoading(b));return c};
Blockly.Xml.appendDomToWorkspace=function(a,b){if(b.hasOwnProperty("scale")){var c=Blockly.BlockSvg.TAB_WIDTH;try{Blockly.BlockSvg.TAB_WIDTH=0;var d=b.getBlocksBoundingBox()}finally{Blockly.BlockSvg.TAB_WIDTH=c}}c=Blockly.Xml.domToWorkspace(a,b);if(d&&d.top!=d.bottom){var e=d.bottom;var f=d.left;var g=Infinity,h=Infinity;for(d=0;d<c.length;d++){var k=b.getBlockById(c[d]).getRelativeToSurfaceXY();k.y<h&&(h=k.y);k.x<g&&(g=k.x)}e=e-h+Blockly.BlockSvg.SEP_SPACE_Y;f-=g;var l;b.RTL&&(l=b.getWidth());for(d=
0;d<c.length;d++)b.getBlockById(c[d]).moveBy(b.RTL?l-f:f,e)}return c};
Blockly.Xml.domToBlock=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}Blockly.Events.disable();c=b.getAllVariables();try{var d=Blockly.Xml.domToBlockHeadless_(a,b),e=d.getDescendants(!1);if(b.rendered){d.setConnectionsHidden(!0);for(var f=e.length-1;0<=f;f--)e[f].initSvg();for(f=e.length-1;0<=f;f--)e[f].render(!1);setTimeout(function(){d.workspace&&d.setConnectionsHidden(!1)},1);d.updateDisabled();b.resizeContents()}else for(f=
@@ -908,9 +910,8 @@ Blockly.Bubble.prototype.getRelativeToSurfaceXY=function(){return new Blockly.ut
Blockly.Events.Ui.prototype.toJson=function(){var a=Blockly.Events.Ui.superClass_.toJson.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.blockId&&(a.blockId=this.blockId);return a};Blockly.Events.Ui.prototype.fromJson=function(a){Blockly.Events.Ui.superClass_.fromJson.call(this,a);this.element=a.element;this.newValue=a.newValue;this.blockId=a.blockId};Blockly.Icon=function(a){this.block_=a};Blockly.Icon.prototype.collapseHidden=!0;Blockly.Icon.prototype.SIZE=17;Blockly.Icon.prototype.bubble_=null;Blockly.Icon.prototype.iconXY_=null;
Blockly.Icon.prototype.createIcon=function(){this.iconGroup_||(this.iconGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyIconGroup"},null),this.block_.isInFlyout&&Blockly.utils.dom.addClass(this.iconGroup_,"blocklyIconGroupReadonly"),this.drawIcon_(this.iconGroup_),this.block_.getSvgRoot().appendChild(this.iconGroup_),Blockly.bindEventWithChecks_(this.iconGroup_,"mouseup",this,this.iconClick_),this.updateEditable())};
Blockly.Icon.prototype.dispose=function(){Blockly.utils.dom.removeNode(this.iconGroup_);this.iconGroup_=null;this.setVisible(!1);this.block_=null};Blockly.Icon.prototype.updateEditable=function(){};Blockly.Icon.prototype.isVisible=function(){return!!this.bubble_};Blockly.Icon.prototype.iconClick_=function(a){this.block_.workspace.isDragging()||this.block_.isInFlyout||Blockly.utils.isRightButton(a)||this.setVisible(!this.isVisible())};
Blockly.Icon.prototype.updateColour=function(){this.isVisible()&&this.bubble_.setColour(this.block_.getColour())};
Blockly.Icon.prototype.renderIcon=function(a){if(this.collapseHidden&&this.block_.isCollapsed()||this.block_.isInsertionMarker())return this.iconGroup_.setAttribute("display","none"),a;this.iconGroup_.setAttribute("display","block");var b=this.SIZE;this.block_.RTL&&(a-=b);this.iconGroup_.setAttribute("transform","translate("+a+",5)");this.computeIconLocation();return a=this.block_.RTL?a-Blockly.BlockSvg.SEP_SPACE_X:a+(b+Blockly.BlockSvg.SEP_SPACE_X)};
Blockly.Icon.prototype.setIconLocation=function(a){this.iconXY_=a;this.isVisible()&&this.bubble_.setAnchorLocation(a)};Blockly.Icon.prototype.computeIconLocation=function(){var a=this.block_.getRelativeToSurfaceXY(),b=Blockly.utils.getRelativeXY(this.iconGroup_);a=new Blockly.utils.Coordinate(a.x+b.x+this.SIZE/2,a.y+b.y+this.SIZE/2);Blockly.utils.Coordinate.equals(this.getIconLocation(),a)||this.setIconLocation(a)};Blockly.Icon.prototype.getIconLocation=function(){return this.iconXY_};
Blockly.Icon.prototype.updateColour=function(){this.isVisible()&&this.bubble_.setColour(this.block_.getColour())};Blockly.Icon.prototype.setIconLocation=function(a){this.iconXY_=a;this.isVisible()&&this.bubble_.setAnchorLocation(a)};
Blockly.Icon.prototype.computeIconLocation=function(){var a=this.block_.getRelativeToSurfaceXY(),b=Blockly.utils.getRelativeXY(this.iconGroup_);a=new Blockly.utils.Coordinate(a.x+b.x+this.SIZE/2,a.y+b.y+this.SIZE/2);Blockly.utils.Coordinate.equals(this.getIconLocation(),a)||this.setIconLocation(a)};Blockly.Icon.prototype.getIconLocation=function(){return this.iconXY_};
Blockly.Icon.prototype.getCorrectedSize=function(){return new Blockly.utils.Size(Blockly.Icon.prototype.SIZE,Blockly.Icon.prototype.SIZE-2)};
Blockly.Comment=function(a){Blockly.Comment.superClass_.constructor.call(this,a);this.createIcon()};goog.inherits(Blockly.Comment,Blockly.Icon);Blockly.Comment.prototype.text_="";Blockly.Comment.prototype.width_=160;Blockly.Comment.prototype.height_=80;
Blockly.Comment.prototype.drawIcon_=function(a){Blockly.utils.dom.createSvgElement("circle",{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},a);Blockly.utils.dom.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},a);Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)};
@@ -1008,10 +1009,10 @@ this.markerConnection_=null;b.getSvgRoot().setAttribute("visibility","hidden")}e
Blockly.InsertionMarkerManager.prototype.connectMarker_=function(){var a=this.localConnection_,b=this.closestConnection_,c=this.lastOnStack_&&a==this.lastOnStack_?this.lastMarker_:this.firstMarker_;a=c.getMatchingConnection(a.sourceBlock_,a);if(a==this.markerConnection_)throw Error("Made it to connectMarker_ even though the marker isn't changing");c.render();c.rendered=!0;c.getSvgRoot().setAttribute("visibility","visible");c.positionNewBlock(c,a,b);a.connect(b);this.markerConnection_=a};
Blockly.InsertionMarkerManager.prototype.getInsertionMarkers=function(){var a=[];this.firstMarker_&&a.push(this.firstMarker_);this.lastMarker_&&a.push(this.lastMarker_);return a};Blockly.BlockDragger=function(a,b){this.draggingBlock_=a;this.workspace_=b;this.draggedConnectionManager_=new Blockly.InsertionMarkerManager(this.draggingBlock_);this.deleteArea_=null;this.wouldDeleteBlock_=!1;this.startXY_=this.draggingBlock_.getRelativeToSurfaceXY();this.dragIconData_=Blockly.BlockDragger.initIconData_(a)};
Blockly.BlockDragger.prototype.dispose=function(){this.startWorkspace_=this.workspace_=this.draggingBlock_=null;this.dragIconData_.length=0;this.draggedConnectionManager_&&(this.draggedConnectionManager_.dispose(),this.draggedConnectionManager_=null)};Blockly.BlockDragger.initIconData_=function(a){var b=[];a=a.getDescendants(!1);for(var c=0,d;d=a[c];c++){d=d.getIcons();for(var e=0;e<d.length;e++){var f={location:d[e].getIconLocation(),icon:d[e]};b.push(f)}}return b};
Blockly.BlockDragger.prototype.startBlockDrag=function(a,b){Blockly.Events.getGroup()||Blockly.Events.setGroup(!0);this.workspace_.isMutator&&this.draggingBlock_.bringToFront();Blockly.Field.startCache();this.workspace_.setResizesEnabled(!1);Blockly.blockAnimations.disconnectUiStop();if(this.draggingBlock_.getParent()||b&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock()){this.draggingBlock_.unplug(b);var c=this.pixelsToWorkspaceUnits_(a);c=Blockly.utils.Coordinate.sum(this.startXY_,
Blockly.BlockDragger.prototype.startBlockDrag=function(a,b){Blockly.Events.getGroup()||Blockly.Events.setGroup(!0);this.workspace_.isMutator&&this.draggingBlock_.bringToFront();Blockly.utils.dom.startTextWidthCache();this.workspace_.setResizesEnabled(!1);Blockly.blockAnimations.disconnectUiStop();if(this.draggingBlock_.getParent()||b&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock()){this.draggingBlock_.unplug(b);var c=this.pixelsToWorkspaceUnits_(a);c=Blockly.utils.Coordinate.sum(this.startXY_,
c);this.draggingBlock_.translate(c.x,c.y);Blockly.blockAnimations.disconnectUiEffect(this.draggingBlock_)}this.draggingBlock_.setDragging(!0);this.draggingBlock_.moveToDragSurface_();if(c=this.workspace_.getToolbox()){var d=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";c.addStyle(d)}};
Blockly.BlockDragger.prototype.dragBlock=function(a,b){var c=this.pixelsToWorkspaceUnits_(b),d=Blockly.utils.Coordinate.sum(this.startXY_,c);this.draggingBlock_.moveDuringDrag(d);this.dragIcons_(c);this.deleteArea_=this.workspace_.isDeleteArea(a);this.draggedConnectionManager_.update(c,this.deleteArea_);this.updateCursorDuringBlockDrag_()};
Blockly.BlockDragger.prototype.endBlockDrag=function(a,b){this.dragBlock(a,b);this.dragIconData_=[];Blockly.Field.stopCache();Blockly.blockAnimations.disconnectUiStop();var c=this.pixelsToWorkspaceUnits_(b),d=Blockly.utils.Coordinate.sum(this.startXY_,c);this.draggingBlock_.moveOffDragSurface_(d);this.maybeDeleteBlock_()||(this.draggingBlock_.moveConnections_(c.x,c.y),this.draggingBlock_.setDragging(!1),this.fireMoveEvent_(),this.draggedConnectionManager_.wouldConnectBlock()?this.draggedConnectionManager_.applyConnections():
Blockly.BlockDragger.prototype.endBlockDrag=function(a,b){this.dragBlock(a,b);this.dragIconData_=[];Blockly.utils.dom.stopTextWidthCache();Blockly.blockAnimations.disconnectUiStop();var c=this.pixelsToWorkspaceUnits_(b),d=Blockly.utils.Coordinate.sum(this.startXY_,c);this.draggingBlock_.moveOffDragSurface_(d);this.maybeDeleteBlock_()||(this.draggingBlock_.moveConnections_(c.x,c.y),this.draggingBlock_.setDragging(!1),this.fireMoveEvent_(),this.draggedConnectionManager_.wouldConnectBlock()?this.draggedConnectionManager_.applyConnections():
this.draggingBlock_.render(),this.draggingBlock_.scheduleSnapAndBump());this.workspace_.setResizesEnabled(!0);if(c=this.workspace_.getToolbox())d=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab",c.removeStyle(d);Blockly.Events.setGroup(!1)};Blockly.BlockDragger.prototype.fireMoveEvent_=function(){var a=new Blockly.Events.BlockMove(this.draggingBlock_);a.oldCoordinate=this.startXY_;a.recordNew();Blockly.Events.fire(a)};
Blockly.BlockDragger.prototype.maybeDeleteBlock_=function(){var a=this.workspace_.trashcan;this.wouldDeleteBlock_?(a&&setTimeout(a.close.bind(a),100),this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0)):a&&a.close();return this.wouldDeleteBlock_};
Blockly.BlockDragger.prototype.updateCursorDuringBlockDrag_=function(){this.wouldDeleteBlock_=this.draggedConnectionManager_.wouldDeleteBlock();var a=this.workspace_.trashcan;this.wouldDeleteBlock_?(this.draggingBlock_.setDeleteStyle(!0),this.deleteArea_==Blockly.DELETE_AREA_TRASH&&a&&a.setOpen_(!0)):(this.draggingBlock_.setDeleteStyle(!1),a&&a.setOpen_(!1))};
@@ -1280,10 +1281,8 @@ Blockly.Extensions.getMutatorProperties_=function(a){var b=[];void 0!==a.domToMu
Blockly.Extensions.buildTooltipForDropdown=function(a,b){var c=[];"object"==typeof document&&Blockly.utils.runAfterPageLoad(function(){for(var a in b)Blockly.utils.checkMessageReferences(b[a])});return function(){this.type&&-1===c.indexOf(this.type)&&(Blockly.Extensions.checkDropdownOptionsInTable_(this,a,b),c.push(this.type));this.setTooltip(function(){var d=this.getFieldValue(a),e=b[d];null==e?-1===c.indexOf(this.type)&&(d="No tooltip mapping for value "+d+" of field "+a,null!=this.type&&(d+=" of block type "+
this.type),console.warn(d+".")):e=Blockly.utils.replaceMessageReferences(e);return e}.bind(this))}};Blockly.Extensions.checkDropdownOptionsInTable_=function(a,b,c){var d=a.getField(b);if(!d.isOptionListDynamic()){d=d.getOptions();for(var e=0;e<d.length;++e){var f=d[e][1];null==c[f]&&console.warn("No tooltip mapping for value "+f+" of field "+b+" of block type "+a.type)}}};
Blockly.Extensions.buildTooltipWithFieldText=function(a,b){"object"==typeof document&&Blockly.utils.runAfterPageLoad(function(){Blockly.utils.checkMessageReferences(a)});return function(){this.setTooltip(function(){var c=this.getField(b);return Blockly.utils.replaceMessageReferences(a).replace("%1",c?c.getText():"")}.bind(this))}};
Blockly.Extensions.extensionParentTooltip_=function(){this.tooltipWhenNotConnected_=this.tooltip;this.setTooltip(function(){var a=this.getParent();return a&&a.getInputsInline()&&a.tooltip||this.tooltipWhenNotConnected_}.bind(this))};Blockly.Extensions.register("parent_tooltip_when_inline",Blockly.Extensions.extensionParentTooltip_);Blockly.Field=function(a,b){this.size_=new Blockly.utils.Size(0,0);this.setValue(a);b&&this.setValidator(b)};Blockly.Field.TYPE_MAP_={};Blockly.Field.register=function(a,b){if("string"!=typeof a||""==a.trim())throw Error('Invalid field type "'+a+'"');if(!b||"function"!=typeof b.fromJson)throw Error('Field "'+b+'" must have a fromJson function');Blockly.Field.TYPE_MAP_[a]=b};
Blockly.Field.fromJson=function(a){var b=Blockly.Field.TYPE_MAP_[a.type];return b?(b=b.fromJson(a),void 0!==a.tooltip&&(a=Blockly.utils.replaceMessageReferences(a.tooltip),b.setTooltip(a)),b):null};Blockly.Field.cacheWidths_=null;Blockly.Field.cacheReference_=0;Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT=16;Blockly.Field.TEXT_DEFAULT_HEIGHT=12.5;Blockly.Field.X_PADDING=10;Blockly.Field.DEFAULT_TEXT_OFFSET=Blockly.Field.X_PADDING/2;Blockly.Field.prototype.name=void 0;
Blockly.Field.prototype.disposed=!1;Blockly.Field.prototype.maxDisplayLength=50;Blockly.Field.prototype.value_=null;Blockly.Field.prototype.text_="";Blockly.Field.prototype.tooltip_=null;Blockly.Field.prototype.sourceBlock_=null;Blockly.Field.prototype.isDirty_=!0;Blockly.Field.prototype.visible_=!0;Blockly.Field.prototype.validator_=null;Blockly.Field.prototype.clickTarget_=null;Blockly.Field.NBSP="\u00a0";Blockly.Field.prototype.EDITABLE=!0;Blockly.Field.prototype.SERIALIZABLE=!1;
Blockly.Field.prototype.setSourceBlock=function(a){if(this.sourceBlock_)throw Error("Field already bound to a block.");this.sourceBlock_=a};Blockly.Field.prototype.getSourceBlock=function(){return this.sourceBlock_};
Blockly.Extensions.extensionParentTooltip_=function(){this.tooltipWhenNotConnected_=this.tooltip;this.setTooltip(function(){var a=this.getParent();return a&&a.getInputsInline()&&a.tooltip||this.tooltipWhenNotConnected_}.bind(this))};Blockly.Extensions.register("parent_tooltip_when_inline",Blockly.Extensions.extensionParentTooltip_);Blockly.Field=function(a,b){this.size_=new Blockly.utils.Size(0,0);this.setValue(a);b&&this.setValidator(b)};Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT=16;Blockly.Field.TEXT_DEFAULT_HEIGHT=12.5;Blockly.Field.X_PADDING=10;Blockly.Field.DEFAULT_TEXT_OFFSET=Blockly.Field.X_PADDING/2;Blockly.Field.prototype.name=void 0;Blockly.Field.prototype.disposed=!1;Blockly.Field.prototype.maxDisplayLength=50;Blockly.Field.prototype.value_=null;Blockly.Field.prototype.text_="";Blockly.Field.prototype.tooltip_=null;
Blockly.Field.prototype.sourceBlock_=null;Blockly.Field.prototype.isDirty_=!0;Blockly.Field.prototype.visible_=!0;Blockly.Field.prototype.validator_=null;Blockly.Field.prototype.clickTarget_=null;Blockly.Field.NBSP="\u00a0";Blockly.Field.prototype.EDITABLE=!0;Blockly.Field.prototype.SERIALIZABLE=!1;Blockly.Field.prototype.setSourceBlock=function(a){if(this.sourceBlock_)throw Error("Field already bound to a block.");this.sourceBlock_=a};Blockly.Field.prototype.getSourceBlock=function(){return this.sourceBlock_};
Blockly.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.utils.dom.createSvgElement("g",{},null),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())};Blockly.Field.prototype.initView=function(){this.createBorderRect_();this.createTextElement_()};
Blockly.Field.prototype.createBorderRect_=function(){this.size_.height=Math.max(this.size_.height,Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT);this.size_.width=Math.max(this.size_.width,Blockly.Field.X_PADDING);this.borderRect_=Blockly.utils.dom.createSvgElement("rect",{rx:4,ry:4,x:0,y:0,height:this.size_.height,width:this.size_.width},this.fieldGroup_)};
Blockly.Field.prototype.createTextElement_=function(){this.textElement_=Blockly.utils.dom.createSvgElement("text",{"class":"blocklyText",y:Blockly.Field.TEXT_DEFAULT_HEIGHT,x:this.borderRect_?Blockly.Field.DEFAULT_TEXT_OFFSET:0},this.fieldGroup_);this.textContent_=document.createTextNode("");this.textElement_.appendChild(this.textContent_)};
@@ -1294,9 +1293,7 @@ Blockly.Field.prototype.isClickable=function(){return!!this.sourceBlock_&&this.s
Blockly.Field.prototype.isSerializable=function(){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};Blockly.Field.prototype.isVisible=function(){return this.visible_};
Blockly.Field.prototype.setVisible=function(a){if(this.visible_!=a){this.visible_=a;var b=this.getSvgRoot();b&&(b.style.display=a?"block":"none")}};Blockly.Field.prototype.setValidator=function(a){this.validator_=a};Blockly.Field.prototype.getValidator=function(){return this.validator_};Blockly.Field.prototype.classValidator=function(a){return a};
Blockly.Field.prototype.callValidator=function(a){var b=this.classValidator(a);if(null===b)return null;void 0!==b&&(a=b);if(b=this.getValidator()){b=b.call(this,a);if(null===b)return null;void 0!==b&&(a=b)}return a};Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_};Blockly.Field.prototype.updateColour=function(){};Blockly.Field.prototype.render_=function(){this.textContent_.nodeValue=this.getDisplayText_();this.updateSize_()};
Blockly.Field.prototype.updateWidth=function(){console.warn("Deprecated call to updateWidth, call Blockly.Field.updateSize_ to force an update to the size of the field, or Blockly.Field.getCachedWidth() to check the size of the field.");this.updateSize_()};Blockly.Field.prototype.updateSize_=function(){var a=Blockly.Field.getCachedWidth(this.textElement_);this.borderRect_&&(a+=Blockly.Field.X_PADDING,this.borderRect_.setAttribute("width",a));this.size_.width=a};
Blockly.Field.getCachedWidth=function(a){var b=a.textContent+"\n"+a.className.baseVal,c;if(Blockly.Field.cacheWidths_&&(c=Blockly.Field.cacheWidths_[b]))return c;try{c=Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE?a.getBBox().width:a.getComputedTextLength()}catch(d){return 8*a.textContent.length}Blockly.Field.cacheWidths_&&(Blockly.Field.cacheWidths_[b]=c);return c};
Blockly.Field.startCache=function(){Blockly.Field.cacheReference_++;Blockly.Field.cacheWidths_||(Blockly.Field.cacheWidths_={})};Blockly.Field.stopCache=function(){Blockly.Field.cacheReference_--;Blockly.Field.cacheReference_||(Blockly.Field.cacheWidths_=null)};
Blockly.Field.prototype.updateWidth=function(){console.warn("Deprecated call to updateWidth, call Blockly.Field.updateSize_ to force an update to the size of the field, or Blockly.utils.dom.getTextWidth() to check the size of the field.");this.updateSize_()};Blockly.Field.prototype.updateSize_=function(){var a=Blockly.utils.dom.getTextWidth(this.textElement_);this.borderRect_&&(a+=Blockly.Field.X_PADDING,this.borderRect_.setAttribute("width",a));this.size_.width=a};
Blockly.Field.prototype.getSize=function(){if(!this.isVisible())return new Blockly.utils.Size(0,0);this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0==this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_());return this.size_};
Blockly.Field.prototype.getScaledBBox_=function(){var a=this.borderRect_.getBBox(),b=a.height*this.sourceBlock_.workspace.scale;a=a.width*this.sourceBlock_.workspace.scale;var c=this.getAbsoluteXY_();return{top:c.y,bottom:c.y+b,left:c.x,right:c.x+a}};
Blockly.Field.prototype.getDisplayText_=function(){var a=this.text_;if(!a)return Blockly.Field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,Blockly.Field.NBSP);this.sourceBlock_.RTL&&(a+="\u200f");return a};Blockly.Field.prototype.getText=function(){return this.text_};Blockly.Field.prototype.setText=function(a){null!==a&&(a=String(a),a!==this.text_&&(this.text_=a,this.forceRerender()))};
@@ -1304,8 +1301,9 @@ Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlo
Blockly.Field.prototype.setValue=function(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.getValue();b!==a&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name,b,a)),this.doValueUpdate_(a),this.isDirty_&&this.forceRerender())}}};
Blockly.Field.prototype.processValidation_=function(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a};Blockly.Field.prototype.getValue=function(){return this.value_};Blockly.Field.prototype.doClassValidation_=function(a){return a=this.classValidator(a)};Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0;this.text_=String(a)};Blockly.Field.prototype.doValueInvalid_=function(a){};
Blockly.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)};Blockly.Field.prototype.setTooltip=function(a){var b=this.getClickTarget_();b?b.tooltip=a||""===a?a:this.sourceBlock_:this.tooltip_=a};Blockly.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()};Blockly.Field.prototype.getAbsoluteXY_=function(){return Blockly.utils.style.getPageOffset(this.borderRect_)};
Blockly.Field.prototype.referencesVariables=function(){return!1};Blockly.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;d<b.inputList.length;d++)for(var e=c[d],f=e.fieldRow,g=0;g<f.length;g++)if(f[g]===this){a=e;break}return a};Blockly.Field.prototype.onBlocklyAction=function(a){return!1};Blockly.FieldLabel=function(a,b){this.size_=new Blockly.utils.Size(0,Blockly.Field.TEXT_DEFAULT_HEIGHT);this.class_=b;a=this.doClassValidation_(a);null===a&&(a="");this.setValue(a)};goog.inherits(Blockly.FieldLabel,Blockly.Field);Blockly.FieldLabel.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabel(b,a["class"])};Blockly.FieldLabel.prototype.EDITABLE=!1;
Blockly.FieldLabel.prototype.initView=function(){this.createTextElement_();this.textElement_.setAttribute("y",this.size_.height);this.class_&&Blockly.utils.dom.addClass(this.textElement_,this.class_)};Blockly.FieldLabel.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};Blockly.Field.register("field_label",Blockly.FieldLabel);Blockly.Input=function(a,b,c,d){if(a!=Blockly.DUMMY_INPUT&&!b)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=a;this.name=b;this.sourceBlock_=c;this.connection=d;this.fieldRow=[]};Blockly.Input.prototype.align=Blockly.ALIGN_LEFT;Blockly.Input.prototype.visible_=!0;Blockly.Input.prototype.getSourceBlock=function(){return this.sourceBlock_};Blockly.Input.prototype.appendField=function(a,b){this.insertFieldAt(this.fieldRow.length,a,b);return this};
Blockly.Field.prototype.referencesVariables=function(){return!1};Blockly.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;d<b.inputList.length;d++)for(var e=c[d],f=e.fieldRow,g=0;g<f.length;g++)if(f[g]===this){a=e;break}return a};Blockly.Field.prototype.onBlocklyAction=function(a){return!1};Blockly.fieldRegistry={};Blockly.fieldRegistry.typeMap_={};Blockly.fieldRegistry.register=function(a,b){if("string"!=typeof a||""==a.trim())throw Error('Invalid field type "'+a+'". The type must be a non-empty string.');if(!b||"function"!=typeof b.fromJson)throw Error('Field "'+b+'" must have a fromJson function');Blockly.fieldRegistry.typeMap_[a]=b};
Blockly.fieldRegistry.fromJson=function(a){var b=Blockly.fieldRegistry.typeMap_[a.type];if(!b)return console.warn("Blockly could not create a field of type "+a.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (See: github.com/google/blockly/issues/1584), or the registration is not being reached."),null;b=b.fromJson(a);void 0!==a.tooltip&&(a=Blockly.utils.replaceMessageReferences(a.tooltip),b.setTooltip(a));return b};Blockly.FieldLabel=function(a,b){this.size_=new Blockly.utils.Size(0,Blockly.Field.TEXT_DEFAULT_HEIGHT);this.class_=b;a=this.doClassValidation_(a);null===a&&(a="");this.setValue(a)};goog.inherits(Blockly.FieldLabel,Blockly.Field);Blockly.FieldLabel.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabel(b,a["class"])};Blockly.FieldLabel.prototype.EDITABLE=!1;
Blockly.FieldLabel.prototype.initView=function(){this.createTextElement_();this.textElement_.setAttribute("y",this.size_.height);this.class_&&Blockly.utils.dom.addClass(this.textElement_,this.class_)};Blockly.FieldLabel.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};Blockly.fieldRegistry.register("field_label",Blockly.FieldLabel);Blockly.Input=function(a,b,c,d){if(a!=Blockly.DUMMY_INPUT&&!b)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=a;this.name=b;this.sourceBlock_=c;this.connection=d;this.fieldRow=[]};Blockly.Input.prototype.align=Blockly.ALIGN_LEFT;Blockly.Input.prototype.visible_=!0;Blockly.Input.prototype.getSourceBlock=function(){return this.sourceBlock_};Blockly.Input.prototype.appendField=function(a,b){this.insertFieldAt(this.fieldRow.length,a,b);return this};
Blockly.Input.prototype.insertFieldAt=function(a,b,c){if(0>a||a>this.fieldRow.length)throw Error("index "+a+" out of bounds.");if(!b&&!c)return a;"string"==typeof b&&(b=new Blockly.FieldLabel(b));b.setSourceBlock(this.sourceBlock_);this.sourceBlock_.rendered&&b.init();b.name=c;b.prefixField&&(a=this.insertFieldAt(a,b.prefixField));this.fieldRow.splice(a,0,b);++a;b.suffixField&&(a=this.insertFieldAt(a,b.suffixField));this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_());
return a};Blockly.Input.prototype.removeField=function(a){for(var b=0,c;c=this.fieldRow[b];b++)if(c.name===a){c.dispose();this.fieldRow.splice(b,1);this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_());return}throw Error('Field "%s" not found.',a);};Blockly.Input.prototype.isVisible=function(){return this.visible_};
Blockly.Input.prototype.setVisible=function(a){var b=[];if(this.visible_==a)return b;for(var c=(this.visible_=a)?"block":"none",d=0,e;e=this.fieldRow[d];d++)e.setVisible(a);this.connection&&(a?b=this.connection.unhideAll():this.connection.hideAll(),d=this.connection.targetBlock())&&(d.getSvgRoot().style.display=c,a||(d.rendered=!1));return b};Blockly.Input.prototype.setCheck=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.setCheck(a);return this};
@@ -1357,7 +1355,7 @@ Blockly.Block.prototype.jsonInitColour_=function(a,b){if("colour"in a)if(void 0=
Blockly.Block.prototype.mixin=function(a,b){if(void 0!==b&&"boolean"!=typeof b)throw Error("opt_disableCheck must be a boolean if provided");if(!b){var c=[],d;for(d in a)void 0!==this[d]&&c.push(d);if(c.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(c));}goog.mixin(this,a)};
Blockly.Block.prototype.interpolate_=function(a,b,c){var d=Blockly.utils.tokenizeInterpolation(a),e=[],f=0;a=[];for(var g=0;g<d.length;g++){var h=d[g];if("number"==typeof h){if(0>=h||h>b.length)throw Error('Block "'+this.type+'": Message index %'+h+" out of range.");if(e[h])throw Error('Block "'+this.type+'": Message index %'+h+" duplicated.");e[h]=!0;f++;a.push(b[h-1])}else(h=h.trim())&&a.push(h)}if(f!=b.length)throw Error('Block "'+this.type+'": Message does not reference all '+b.length+" arg(s).");
a.length&&("string"==typeof a[a.length-1]||Blockly.utils.string.startsWith(a[a.length-1].type,"field_"))&&(g={type:"input_dummy"},c&&(g.align=c),a.push(g));c={LEFT:Blockly.ALIGN_LEFT,RIGHT:Blockly.ALIGN_RIGHT,CENTRE:Blockly.ALIGN_CENTRE};b=[];for(g=0;g<a.length;g++)if(e=a[g],"string"==typeof e)b.push([e,void 0]);else{d=f=null;do if(h=!1,"string"==typeof e)f=new Blockly.FieldLabel(e);else switch(e.type){case "input_value":d=this.appendValueInput(e.name);break;case "input_statement":d=this.appendStatementInput(e.name);
break;case "input_dummy":d=this.appendDummyInput(e.name);break;default:f=Blockly.Field.fromJson(e),f||(e.alt?(e=e.alt,h=!0):console.warn("Blockly could not create a field of type "+e.type+". You may need to register your custom field. See github.com/google/blockly/issues/1584"))}while(h);if(f)b.push([f,e.name]);else if(d){e.check&&d.setCheck(e.check);e.align&&d.setAlign(c[e.align]);for(e=0;e<b.length;e++)d.appendField(b[e][0],b[e][1]);b.length=0}}};
break;case "input_dummy":d=this.appendDummyInput(e.name);break;default:f=Blockly.fieldRegistry.fromJson(e),!f&&e.alt&&(e=e.alt,h=!0)}while(h);if(f)b.push([f,e.name]);else if(d){e.check&&d.setCheck(e.check);e.align&&d.setAlign(c[e.align]);for(e=0;e<b.length;e++)d.appendField(b[e][0],b[e][1]);b.length=0}}};
Blockly.Block.prototype.appendInput_=function(a,b){var c=null;if(a==Blockly.INPUT_VALUE||a==Blockly.NEXT_STATEMENT)c=this.makeConnection_(a);c=new Blockly.Input(a,b,this,c);this.inputList.push(c);return c};
Blockly.Block.prototype.moveInputBefore=function(a,b){if(a!=b){for(var c=-1,d=b?-1:this.inputList.length,e=0,f;f=this.inputList[e];e++)if(f.name==a){if(c=e,-1!=d)break}else if(b&&f.name==b&&(d=e,-1!=c))break;if(-1==c)throw Error('Named input "'+a+'" not found.');if(-1==d)throw Error('Reference input "'+b+'" not found.');this.moveNumberedInputBefore(c,d)}};
Blockly.Block.prototype.moveNumberedInputBefore=function(a,b){if(a==b)throw Error("Can't move input to itself.");if(a>=this.inputList.length)throw RangeError("Input index "+a+" out of bounds.");if(b>this.inputList.length)throw RangeError("Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);a<b&&b--;this.inputList.splice(b,0,c)};
@@ -1400,10 +1398,10 @@ Blockly.blockRendering.NextConnection=function(){Blockly.blockRendering.NextConn
Blockly.blockRendering.Hat=function(){Blockly.blockRendering.Hat.superClass_.constructor.call(this);this.type="hat";this.height=Blockly.blockRendering.constants.START_HAT.height;this.width=Blockly.blockRendering.constants.START_HAT.width;this.startY=this.height};goog.inherits(Blockly.blockRendering.Hat,Blockly.blockRendering.Measurable);
Blockly.blockRendering.SquareCorner=function(){Blockly.blockRendering.SquareCorner.superClass_.constructor.call(this);this.type="square corner";this.height=this.notchShape.height;this.width=Blockly.blockRendering.constants.NO_PADDING};goog.inherits(Blockly.blockRendering.SquareCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.RoundCorner=function(){Blockly.blockRendering.RoundCorner.superClass_.constructor.call(this);this.type="round corner";this.width=Blockly.blockRendering.constants.CORNER_RADIUS;this.height=this.notchShape.height};goog.inherits(Blockly.blockRendering.RoundCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Row=function(){this.type="row";this.yPos=0;this.elements=[];this.height=this.width=0;this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1};Blockly.blockRendering.Row.prototype.notchShape=Blockly.blockRendering.constants.NOTCH;Blockly.blockRendering.Row.prototype.isSpacer=function(){return!1};
Blockly.blockRendering.Row.prototype.measure=function(){for(var a=0,b=0;b<this.elements.length;b++){var c=this.elements[b];this.width+=c.width;c.isInput&&("statement input"==c.type?a+=c.connectedBlockWidth:"external value input"==c.type&&(a+=c.connectedBlockWidth-c.connectionWidth));c.isSpacer()||(this.height=Math.max(this.height,c.height))}this.widthWithConnectedBlocks=this.width+a};
Blockly.blockRendering.Row=function(){this.type="row";this.yPos=0;this.elements=[];this.widthWithConnectedBlocks=this.height=this.width=0;this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1};Blockly.blockRendering.Row.prototype.notchShape=Blockly.blockRendering.constants.NOTCH;Blockly.blockRendering.Row.prototype.isSpacer=function(){return!1};
Blockly.blockRendering.Row.prototype.measure=function(){for(var a=0,b=0;b<this.elements.length;b++){var c=this.elements[b];this.width+=c.width;c.isInput&&("statement input"==c.type?a+=c.connectedBlockWidth:"external value input"==c.type&&0!=c.connectedBlockWidth&&(a+=c.connectedBlockWidth-c.connectionWidth));c.isSpacer()||(this.height=Math.max(this.height,c.height))}this.widthWithConnectedBlocks=this.width+a};
Blockly.blockRendering.Row.prototype.getLastInput=function(){for(var a=this.elements.length-1;0<=a;a--){var b=this.elements[a];if(!b.isSpacer()){if(b.isInput)return b;if(b.isField())return b.parentInput}}return null};Blockly.blockRendering.Row.prototype.getFirstSpacer=function(){return this.elements[0]};Blockly.blockRendering.Row.prototype.getLastSpacer=function(){return this.elements[this.elements.length-1]};
Blockly.blockRendering.BetweenRowSpacer=function(a,b){this.type="between-row spacer";this.width=b;this.height=a;this.followsStatement=!1};goog.inherits(Blockly.blockRendering.BetweenRowSpacer,Blockly.blockRendering.Measurable);Blockly.blockRendering.InRowSpacer=function(a){this.type="in-row spacer";this.width=a;this.height=Blockly.blockRendering.constants.SPACER_DEFAULT_HEIGHT};goog.inherits(Blockly.blockRendering.InRowSpacer,Blockly.blockRendering.Measurable);
Blockly.blockRendering.BetweenRowSpacer=function(a,b){this.type="between-row spacer";this.width=b;this.height=a;this.followsStatement=!1;this.widthWithConnectedBlocks=0};goog.inherits(Blockly.blockRendering.BetweenRowSpacer,Blockly.blockRendering.Measurable);Blockly.blockRendering.InRowSpacer=function(a){this.type="in-row spacer";this.width=a;this.height=Blockly.blockRendering.constants.SPACER_DEFAULT_HEIGHT};goog.inherits(Blockly.blockRendering.InRowSpacer,Blockly.blockRendering.Measurable);
Blockly.blockRendering.TopRow=function(a){Blockly.blockRendering.TopRow.superClass_.constructor.call(this);this.elements=[];this.type="top row";this.startY=0;this.hasPreviousConnection=!!a.previousConnection;this.connection=a.previousConnection;a.inputList.length&&a.inputList[0].type==Blockly.NEXT_STATEMENT&&!a.isCollapsed()?this.height=Blockly.blockRendering.constants.LARGE_PADDING:this.height=Blockly.blockRendering.constants.MEDIUM_PADDING};goog.inherits(Blockly.blockRendering.TopRow,Blockly.blockRendering.Row);
Blockly.blockRendering.TopRow.prototype.getPreviousConnection=function(){return this.hasPreviousConnection?this.elements[2]:null};Blockly.blockRendering.TopRow.prototype.measure=function(){for(var a=0;a<this.elements.length;a++){var b=this.elements[a];this.width+=b.width;b.isSpacer()||("hat"==b.type&&(this.startY=b.startY,this.height+=b.height),this.height=Math.max(this.height,b.height))}this.widthWithConnectedBlocks=this.width};
Blockly.blockRendering.BottomRow=function(a){Blockly.blockRendering.BottomRow.superClass_.constructor.call(this);this.type="bottom row";this.hasNextConnection=!!a.nextConnection;this.connection=a.nextConnection;this.overhangY=0;var b=a.inputList.length&&a.inputList[a.inputList.length-1].type==Blockly.NEXT_STATEMENT;this.hasFixedWidth=b&&a.getInputsInline();this.height=b?Blockly.blockRendering.constants.LARGE_PADDING:this.notchShape.height};goog.inherits(Blockly.blockRendering.BottomRow,Blockly.blockRendering.Row);
@@ -1425,13 +1423,13 @@ if(b.isNextConnection())return c=(this.RTL?1:-1)*Blockly.blockRendering.constant
Blockly.blockRendering.RenderInfo.prototype.computeBounds_=function(){for(var a=0,b=0,c=0,d=0;d<this.rows.length;d++){var e=this.rows[d];e.measure();b=Math.max(b,e.width);if(e.hasStatement){var f=e.getLastInput();a=Math.max(a,e.width-f.width)}c=Math.max(c,e.widthWithConnectedBlocks)}this.statementEdge=a;this.width=b;for(d=0;d<this.rows.length;d++)e=this.rows[d],e.hasStatement&&(e.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(b,c);this.outputConnection&&(this.startX=this.outputConnection.width,
this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)};
Blockly.blockRendering.RenderInfo.prototype.alignRowElements_=function(){for(var a=0;a<this.rows.length;a++){var b=this.rows[a];if(!b.hasInlineInput){if(b.hasStatement){var c=b.getLastInput();c=b.width-c.width;var d=this.statementEdge-this.startX}else c=b.width,d=this.width-this.startX;"bottom row"===b.type&&b.hasFixedWidth&&(d=Blockly.blockRendering.constants.MAX_BOTTOM_WIDTH);(c=d-c)&&this.addAlignmentPadding_(b,c)}}};
Blockly.blockRendering.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.elements,d=a.getLastInput();if(d){var e=a.getFirstSpacer(),f=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)f=c[c.length-3];d.align==Blockly.ALIGN_LEFT?f.width+=b:d.align==Blockly.ALIGN_CENTRE?(e.width+=b/2,f.width+=b/2):d.align==Blockly.ALIGN_RIGHT&&(e.width+=b);a.width+=b}else if("top row"===a.type||"bottom row"===a.type)a.getLastSpacer().width+=b,a.width+=b};
Blockly.blockRendering.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.elements,d=a.getLastInput();if(d){var e=a.getFirstSpacer(),f=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)f=c[c.length-3],a.widthWithConnectedBlocks+=b;d.align==Blockly.ALIGN_LEFT?f.width+=b:d.align==Blockly.ALIGN_CENTRE?(e.width+=b/2,f.width+=b/2):d.align==Blockly.ALIGN_RIGHT&&(e.width+=b);a.width+=b}else if("top row"===a.type||"bottom row"===a.type)a.getLastSpacer().width+=b,a.width+=b};
Blockly.blockRendering.RenderInfo.prototype.addRowSpacing_=function(){var a=this.rows;this.rows=[];for(var b=0;b<a.length;b++)this.rows.push(a[b]),b!==a.length-1&&this.rows.push(this.makeSpacerRow_(a[b],a[b+1]))};Blockly.blockRendering.RenderInfo.prototype.makeSpacerRow_=function(a,b){var c=this.getSpacerRowHeight_(a,b),d=this.getSpacerRowWidth_(a,b);c=new Blockly.blockRendering.BetweenRowSpacer(c,d);a.hasStatement&&(c.followsStatement=!0);return c};
Blockly.blockRendering.RenderInfo.prototype.getSpacerRowWidth_=function(a,b){return"bottom row"===b.type&&b.hasFixedWidth?b.width:this.width-this.startX};
Blockly.blockRendering.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return"top row"===a.type&&"bottom row"===b.type?Blockly.blockRendering.constants.EMPTY_BLOCK_SPACER_HEIGHT:"top row"===a.type||"bottom row"===b.type?Blockly.blockRendering.constants.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?Blockly.blockRendering.constants.LARGE_PADDING:!a.hasStatement&&b.hasStatement?Blockly.blockRendering.constants.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||b.hasDummyInput?Blockly.blockRendering.constants.LARGE_PADDING:
Blockly.blockRendering.constants.MEDIUM_PADDING};Blockly.blockRendering.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;if(b.isField()){if(c+=b.height/2,a.hasInlineInput||a.hasStatement)c+=Blockly.blockRendering.constants.TALL_INPUT_FIELD_OFFSET_Y}else c=b.isInlineInput()?c+b.height/2:b.isNextConnection()?c+(a.height-a.overhangY+b.height/2):c+a.height/2;return c};
Blockly.blockRendering.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0;b<this.rows.length;b++){var c=this.rows[b];c.yPos=a;c.xPos=this.startX;a+=c.height;var d=a-this.topRow.startY;c==this.bottomRow&&d<Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT&&(d=Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT-d,this.bottomRow.height+=d,a+=d);if(!c.isSpacer()){d=c.xPos;for(var e=0;e<c.elements.length;e++){var f=c.elements[e];f.xPos=d;f.centerline=this.getElemCenterline_(c,f);d+=f.width}}}this.height=
a};Blockly.blockRendering.highlightConstants={};Blockly.blockRendering.highlightConstants.OFFSET=.5;Blockly.blockRendering.highlightConstants.START_POINT=Blockly.utils.svgPaths.moveBy(Blockly.blockRendering.highlightConstants.OFFSET,Blockly.blockRendering.highlightConstants.OFFSET);
Blockly.blockRendering.constants.MEDIUM_PADDING};Blockly.blockRendering.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;return c=b.isField()&&a.hasStatement?c+(Blockly.blockRendering.constants.TALL_INPUT_FIELD_OFFSET_Y+b.height/2):b.isNextConnection()?c+(a.height-a.overhangY+b.height/2):c+a.height/2};
Blockly.blockRendering.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0;c<this.rows.length;c++){var d=this.rows[c];d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);var e=b-this.topRow.startY;d==this.bottomRow&&e<Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT&&(e=Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT-e,this.bottomRow.height+=e,b+=e);if(!d.isSpacer()){e=d.xPos;for(var f=0;f<d.elements.length;f++){var g=d.elements[f];g.xPos=e;g.centerline=this.getElemCenterline_(d,
g);e+=g.width}}}this.widthWithChildren=a+this.startX;this.height=b};Blockly.blockRendering.highlightConstants={};Blockly.blockRendering.highlightConstants.OFFSET=.5;Blockly.blockRendering.highlightConstants.START_POINT=Blockly.utils.svgPaths.moveBy(Blockly.blockRendering.highlightConstants.OFFSET,Blockly.blockRendering.highlightConstants.OFFSET);
Blockly.blockRendering.highlightConstants.INSIDE_CORNER=function(){var a=Blockly.blockRendering.constants.CORNER_RADIUS,b=Blockly.blockRendering.highlightConstants.OFFSET,c=(1-Math.SQRT1_2)*(a+b)-b,d=Blockly.utils.svgPaths.moveBy(c,c)+Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-c-b,a-c)),e=Blockly.utils.svgPaths.arc("a","0 0,0",a+b,Blockly.utils.svgPaths.point(a+b,a+b)),f=Blockly.utils.svgPaths.moveBy(c,-c)+Blockly.utils.svgPaths.arc("a","0 0,0",a+b,Blockly.utils.svgPaths.point(a-
c,c+b));return{height:a,pathTop:function(a){return a?d:""},pathBottom:function(a){return a?e:f}}}();
Blockly.blockRendering.highlightConstants.OUTSIDE_CORNER=function(){var a=Blockly.blockRendering.constants.CORNER_RADIUS,b=Blockly.blockRendering.highlightConstants.OFFSET,c=(1-Math.SQRT1_2)*(a-b)+b,d=Blockly.utils.svgPaths.moveBy(c,c)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(a-c,-c+b)),e=Blockly.utils.svgPaths.moveBy(b,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(a,-a+b)),f=-c,g=Blockly.utils.svgPaths.moveBy(c,f)+Blockly.utils.svgPaths.arc("a",
@@ -1446,18 +1444,22 @@ Blockly.blockRendering.Highlighter.prototype.drawTopCorner=function(a){this.step
c.isSpacer()&&0!=c.width&&this.steps_.push("H",c.xPos+c.width-this.highlightOffset_);this.steps_.push("H",a.xPos+a.width-this.highlightOffset_)};Blockly.blockRendering.Highlighter.prototype.drawJaggedEdge_=function(a){this.info_.RTL&&(this.steps_.push("H",a.width-this.highlightOffset_),this.steps_.push(this.jaggedTeethPaths_.pathLeft),this.steps_.push(Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_)))};
Blockly.blockRendering.Highlighter.prototype.drawValueInput=function(a){var b=a.getLastInput();this.RTL_?(b=a.height-b.connectionHeight,a=Blockly.utils.svgPaths.moveTo(a.xPos+a.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",b)):a=Blockly.utils.svgPaths.moveTo(a.xPos+a.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_);this.steps_.push(a)};
Blockly.blockRendering.Highlighter.prototype.drawStatementInput=function(a){var b=a.xPos+a.statementEdge;if(this.RTL_){var c=a.height-2*this.insideCornerPaths_.height;a=Blockly.utils.svgPaths.moveTo(b,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)}else a=Blockly.utils.svgPaths.moveTo(b,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_);this.steps_.push(a)};
Blockly.blockRendering.Highlighter.prototype.drawRightSideRow=function(a){var b=a.xPos+a.width-this.highlightOffset_;a.followsStatement&&this.steps_.push("H",b);this.RTL_&&(this.steps_.push("H",b),this.steps_.push("V",a.yPos+a.height-this.highlightOffset_))};
Blockly.blockRendering.Highlighter.prototype.drawRightSideRow=function(a){var b=a.xPos+a.width-this.highlightOffset_;a.followsStatement&&this.steps_.push("H",b);this.RTL_&&(this.steps_.push("H",b),a.height>this.highlightOffset_&&this.steps_.push("V",a.yPos+a.height-this.highlightOffset_))};
Blockly.blockRendering.Highlighter.prototype.drawBottomRow=function(a){var b=a.yPos+a.height-a.overhangY;if(this.RTL_)this.steps_.push("V",b-this.highlightOffset_);else{var c=this.info_.bottomRow.elements[0];"square corner"===c.type?this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos+this.highlightOffset_,b-this.highlightOffset_)):"round corner"===c.type&&(this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos,b)),this.steps_.push(this.outsideCornerPaths_.bottomLeft()))}};
Blockly.blockRendering.Highlighter.prototype.drawLeft=function(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_.push(Blockly.utils.svgPaths.moveTo(this.info_.startX,a)):(this.steps_.push(Blockly.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.height-this.highlightOffset_)),this.steps_.push("V",a)),this.steps_.push(this.puzzleTabPaths_.pathUp(this.RTL_)));this.RTL_||(a=this.info_.topRow,a.elements[0].isRoundedCorner()?this.steps_.push("V",
this.outsideCornerPaths_.height):this.steps_.push("V",a.startY+this.highlightOffset_))};
Blockly.blockRendering.Highlighter.prototype.drawInlineInput=function(a){var b=this.highlightOffset_,c=a.xPos+a.connectionWidth,d=a.centerline-a.height/2,e=a.width-a.connectionWidth,f=d+b;this.RTL_?(d=a.connectionOffsetY-b,a=a.height-(a.connectionOffsetY+a.connectionHeight)+b,b=Blockly.utils.svgPaths.moveTo(c-b,f)+Blockly.utils.svgPaths.lineOnAxis("v",d)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",a)+Blockly.utils.svgPaths.lineOnAxis("h",e)):b=Blockly.utils.svgPaths.moveTo(a.xPos+
a.width+b,f)+Blockly.utils.svgPaths.lineOnAxis("v",a.height)+Blockly.utils.svgPaths.lineOnAxis("h",-e)+Blockly.utils.svgPaths.moveTo(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_);this.inlineSteps_.push(b)};Blockly.blockRendering.Debug=function(){this.debugElements_=[];this.svgRoot_=null};Blockly.blockRendering.Debug.prototype.clearElems=function(){for(var a=0,b;b=this.debugElements_[a];a++)Blockly.utils.dom.removeNode(b);this.debugElements_=[]};Blockly.blockRendering.Debug.prototype.drawSpacerRow=function(a,b,c){this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"rowSpacerRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:a.height},this.svgRoot_))};
Blockly.blockRendering.Debug.prototype.drawSpacerElem=function(a,b,c){var d=a.xPos;c&&(d=-(d+a.width));b=Math.min(a.height,b);this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"elemSpacerRect blockRenderDebug",x:d,y:a.centerline-b/2,width:a.width,height:b},this.svgRoot_))};
Blockly.blockRendering.Debug.prototype.drawRenderedElem=function(a,b){var c=a.xPos;b&&(c=-(c+a.width));this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"rowRenderingRect blockRenderDebug",x:c,y:a.centerline-a.height/2,width:a.width,height:a.height},this.svgRoot_));a.isInput&&this.drawConnection(a.connection)};
Blockly.blockRendering.Debug.prototype.drawConnection=function(a){if(a.type==Blockly.INPUT_VALUE){var b=4;var c="magenta";var d="none"}else a.type==Blockly.OUTPUT_VALUE?(b=2,d=c="magenta"):a.type==Blockly.NEXT_STATEMENT?(b=4,c="goldenrod",d="none"):a.type==Blockly.PREVIOUS_STATEMENT&&(b=2,d=c="goldenrod");this.debugElements_.push(Blockly.utils.dom.createSvgElement("circle",{"class":"blockRenderDebug",cx:a.offsetInBlock_.x,cy:a.offsetInBlock_.y,r:b,fill:d,stroke:c},this.svgRoot_))};
Blockly.blockRendering.Debug.prototype.drawRenderedRow=function(a,b,c){this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"elemRenderingRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:a.height},this.svgRoot_))};Blockly.blockRendering.Debug.prototype.drawRowWithElements=function(a,b,c){for(var d=0;d<a.elements.length;d++){var e=a.elements[d];e.isSpacer()?this.drawSpacerElem(e,a.height,c):this.drawRenderedElem(e,c)}this.drawRenderedRow(a,b,c)};
Blockly.blockRendering.Debug.prototype.drawBoundingBox=function(a,b,c){this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"blockBoundingBox blockRenderDebug",x:c?-a:0,y:0,width:a,height:b},this.svgRoot_))};
Blockly.blockRendering.Debug.prototype.drawDebug=function(a,b){this.clearElems();this.svgRoot_=a.getSvgRoot();for(var c=0,d=0;d<b.rows.length;d++){var e=b.rows[d];e.isSpacer()?this.drawSpacerRow(e,c,b.RTL):this.drawRowWithElements(e,c,b.RTL);c+=e.height}a.previousConnection&&this.drawConnection(a.previousConnection);a.nextConnection&&this.drawConnection(a.nextConnection);a.outputConnection&&this.drawConnection(a.outputConnection);this.drawBoundingBox(b.width,b.height,b.isRtl)};Blockly.blockRendering.Drawer=function(a,b){this.block_=a;this.info_=b;this.topLeft_=a.getRelativeToSurfaceXY();this.inlinePath_=this.outlinePath_="";this.pathObject_=new Blockly.BlockSvg.PathObject;this.highlighter_=new Blockly.blockRendering.Highlighter(this.info_,this.pathObject_)};
a.width+b,f)+Blockly.utils.svgPaths.lineOnAxis("v",a.height)+Blockly.utils.svgPaths.lineOnAxis("h",-e)+Blockly.utils.svgPaths.moveTo(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_);this.inlineSteps_.push(b)};Blockly.blockRendering.Debug=function(){this.debugElements_=[];this.svgRoot_=null;this.config_={rowSpacers:!0,elemSpacers:!0,rows:!0,elems:!0,connections:!0,blockBounds:!0}};Blockly.blockRendering.Debug.prototype.clearElems=function(){for(var a=0,b;b=this.debugElements_[a];a++)Blockly.utils.dom.removeNode(b);this.debugElements_=[]};
Blockly.blockRendering.Debug.prototype.drawSpacerRow=function(a,b,c){this.config_.rowSpacers&&this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"rowSpacerRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:a.height},this.svgRoot_))};
Blockly.blockRendering.Debug.prototype.drawSpacerElem=function(a,b,c){if(this.config_.elemSpacers){var d=a.xPos;c&&(d=-(d+a.width));b=Math.min(a.height,b);this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"elemSpacerRect blockRenderDebug",x:d,y:a.centerline-b/2,width:a.width,height:b},this.svgRoot_))}};
Blockly.blockRendering.Debug.prototype.drawRenderedElem=function(a,b){if(this.config_.elems){var c=a.xPos;b&&(c=-(c+a.width));this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"rowRenderingRect blockRenderDebug",x:c,y:a.centerline-a.height/2,width:a.width,height:a.height},this.svgRoot_));a.isInput&&this.drawConnection(a.connection)}};
Blockly.blockRendering.Debug.prototype.drawConnection=function(a){if(this.config_.connections){if(a.type==Blockly.INPUT_VALUE){var b=4;var c="magenta";var d="none"}else a.type==Blockly.OUTPUT_VALUE?(b=2,d=c="magenta"):a.type==Blockly.NEXT_STATEMENT?(b=4,c="goldenrod",d="none"):a.type==Blockly.PREVIOUS_STATEMENT&&(b=2,d=c="goldenrod");this.debugElements_.push(Blockly.utils.dom.createSvgElement("circle",{"class":"blockRenderDebug",cx:a.offsetInBlock_.x,cy:a.offsetInBlock_.y,r:b,fill:d,stroke:c},this.svgRoot_))}};
Blockly.blockRendering.Debug.prototype.drawRenderedRow=function(a,b,c){this.config_.rows&&(this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"elemRenderingRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:a.height},this.svgRoot_)),"top row"!=a.type&&"bottom row"!=a.type&&this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"blockRenderDebug",x:c?-(a.xPos+a.widthWithConnectedBlocks):a.xPos,y:b,width:a.widthWithConnectedBlocks,
height:a.height,stroke:this.randomColour_,fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))};Blockly.blockRendering.Debug.prototype.drawRowWithElements=function(a,b,c){for(var d=0;d<a.elements.length;d++){var e=a.elements[d];e.isSpacer()?this.drawSpacerElem(e,a.height,c):this.drawRenderedElem(e,c)}this.drawRenderedRow(a,b,c)};
Blockly.blockRendering.Debug.prototype.drawBoundingBox=function(a){if(this.config_.blockBounds){var b=a.RTL?-a.width:0;this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"blockBoundingBox blockRenderDebug",x:b,y:0,width:a.width,height:a.height},this.svgRoot_));b=a.RTL?-a.widthWithChildren:0;this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"blockRenderDebug",x:b,y:0,width:a.widthWithChildren,height:a.height,stroke:"#DF57BC",fill:"none","stroke-width":"1px",
"stroke-dasharray":"3,3"},this.svgRoot_))}};
Blockly.blockRendering.Debug.prototype.drawDebug=function(a,b){this.config_.rowSpacers=!1;this.clearElems();this.svgRoot_=a.getSvgRoot();this.randomColour_="#"+Math.floor(16777215*Math.random()).toString(16);for(var c=0,d=0;d<b.rows.length;d++){var e=b.rows[d];e.isSpacer()?this.drawSpacerRow(e,c,b.RTL):this.drawRowWithElements(e,c,b.RTL);c+=e.height}a.previousConnection&&this.drawConnection(a.previousConnection);a.nextConnection&&this.drawConnection(a.nextConnection);a.outputConnection&&this.drawConnection(a.outputConnection);
this.drawBoundingBox(b)};Blockly.blockRendering.Drawer=function(a,b){this.block_=a;this.info_=b;this.topLeft_=a.getRelativeToSurfaceXY();this.inlinePath_=this.outlinePath_="";this.pathObject_=new Blockly.BlockSvg.PathObject;this.highlighter_=new Blockly.blockRendering.Highlighter(this.info_,this.pathObject_)};
Blockly.blockRendering.Drawer.prototype.draw_=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();this.pathObject_.steps=[this.outlinePath_];this.pathObject_.inlineSteps=[this.inlinePath_];this.block_.setPaths_(this.pathObject_);this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()};
Blockly.blockRendering.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height+Blockly.blockRendering.constants.DARK_PATH_OFFSET;this.block_.width=this.info_.widthWithChildren+Blockly.blockRendering.constants.DARK_PATH_OFFSET;this.block_.startHat_=this.info_.topRow.startHat};Blockly.blockRendering.Drawer.prototype.hideHiddenIcons_=function(){for(var a=0;a<this.info_.hiddenIcons.length;a++)this.info_.hiddenIcons[a].icon.iconGroup_.setAttribute("display","none")};
Blockly.blockRendering.Drawer.prototype.drawOutline_=function(){this.drawTop_();for(var a=1;a<this.info_.rows.length-1;a++){var b=this.info_.rows[a];b.hasJaggedEdge?this.drawJaggedEdge_(b):b.hasStatement?this.drawStatementInput_(b):b.hasExternalInput?this.drawValueInput_(b):this.drawRightSideRow_(b)}this.drawBottom_();this.drawLeft_()};
@@ -1492,7 +1494,7 @@ Blockly.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw
Blockly.BlockSvg.prototype.select=function(){if(this.isShadow()&&this.getParent())this.getParent().select();else if(Blockly.selected!=this){var a=null;if(Blockly.selected){a=Blockly.selected.id;Blockly.Events.disable();try{Blockly.selected.unselect()}finally{Blockly.Events.enable()}}a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect()}};
Blockly.BlockSvg.prototype.unselect=function(){if(Blockly.selected==this){var a=new Blockly.Events.Ui(null,"selected",this.id,null);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=null;this.removeSelect()}};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;Blockly.BlockSvg.prototype.warning=null;
Blockly.BlockSvg.prototype.getIcons=function(){var a=[];this.mutator&&a.push(this.mutator);this.comment&&a.push(this.comment);this.warning&&a.push(this.warning);return a};
Blockly.BlockSvg.prototype.setParent=function(a){var b=this.parentBlock_;if(a!=b){Blockly.Field.startCache();Blockly.BlockSvg.superClass_.setParent.call(this,a);Blockly.Field.stopCache();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?(a.getSvgRoot().appendChild(c),a=this.getRelativeToSurfaceXY(),this.moveConnections_(a.x-d.x,a.y-d.y)):b&&(this.workspace.getCanvas().appendChild(c),this.translate(d.x,d.y))}}};
Blockly.BlockSvg.prototype.setParent=function(a){var b=this.parentBlock_;if(a!=b){Blockly.utils.dom.startTextWidthCache();Blockly.BlockSvg.superClass_.setParent.call(this,a);Blockly.utils.dom.stopTextWidthCache();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?(a.getSvgRoot().appendChild(c),a=this.getRelativeToSurfaceXY(),this.moveConnections_(a.x-d.x,a.y-d.y)):b&&(this.workspace.getCanvas().appendChild(c),this.translate(d.x,d.y))}}};
Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.useDragSurface_?this.workspace.blockDragSurface_.getGroup():null,d=this.getSvgRoot();if(d){do{var e=Blockly.utils.getRelativeXY(d);a+=e.x;b+=e.y;this.useDragSurface_&&this.workspace.blockDragSurface_.getCurrentBlock()==d&&(e=this.workspace.blockDragSurface_.getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new Blockly.utils.Coordinate(a,b)};
Blockly.BlockSvg.prototype.moveBy=function(a,b){if(this.parentBlock_)throw Error("Block has parent.");var c=Blockly.Events.isEnabled();if(c)var d=new Blockly.Events.BlockMove(this);var e=this.getRelativeToSurfaceXY();this.translate(e.x+a,e.y+b);this.moveConnections_(a,b);c&&(d.recordNew(),Blockly.Events.fire(d));this.workspace.resizeContents()};Blockly.BlockSvg.prototype.translate=function(a,b){this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};
Blockly.BlockSvg.prototype.moveToDragSurface_=function(){if(this.useDragSurface_){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.blockDragSurface_.translateSurface(a.x,a.y);this.workspace.blockDragSurface_.setBlocksAndShow(this.getSvgRoot())}};Blockly.BlockSvg.prototype.moveTo=function(a){var b=this.getRelativeToSurfaceXY();this.moveBy(a.x-b.x,a.y-b.y)};Blockly.BlockSvg.prototype.moveOffDragSurface_=function(a){this.useDragSurface_&&(this.translate(a.x,a.y),this.workspace.blockDragSurface_.clearAndHide(this.workspace.getCanvas()))};
@@ -1510,8 +1512,8 @@ Blockly.BlockSvg.prototype.showContextMenu_=function(a){var b=this.generateConte
Blockly.BlockSvg.prototype.setDragging=function(a){if(a){var b=this.getSvgRoot();b.translate_="";b.skew_="";Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0));Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDragging")}else Blockly.draggingConnections_=[],Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDragging");for(b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging(a)};
Blockly.BlockSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDraggable"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDraggable")};Blockly.BlockSvg.prototype.setMovable=function(a){Blockly.BlockSvg.superClass_.setMovable.call(this,a);this.updateMovable()};Blockly.BlockSvg.prototype.setEditable=function(a){Blockly.BlockSvg.superClass_.setEditable.call(this,a);a=this.getIcons();for(var b=0;b<a.length;b++)a[b].updateEditable()};
Blockly.BlockSvg.prototype.setShadow=function(a){Blockly.BlockSvg.superClass_.setShadow.call(this,a);this.updateColour()};Blockly.BlockSvg.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&(this.setColour(Blockly.INSERTION_MARKER_COLOUR),Blockly.utils.dom.addClass(this.svgGroup_,"blocklyInsertionMarker"))};Blockly.BlockSvg.prototype.getSvgRoot=function(){return this.svgGroup_};
Blockly.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){Blockly.Tooltip.hide();Blockly.Field.startCache();var c=this.workspace;Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture());Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide();b&&this.rendered&&(this.unplug(a),Blockly.blockAnimations.disposeUiEffect(this));this.rendered=!1;if(this.warningTextDb_){for(var d in this.warningTextDb_)clearTimeout(this.warningTextDb_[d]);this.warningTextDb_=null}this.unplug(a);
var e;Blockly.Events.isEnabled()&&(e=new Blockly.Events.BlockDelete(this));Blockly.Events.disable();try{var f=this.getIcons();for(d=0;d<f.length;d++)f[d].dispose();Blockly.BlockSvg.superClass_.dispose.call(this,a)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&e&&Blockly.Events.fire(e);Blockly.utils.dom.removeNode(this.svgGroup_);c.resizeContents();this.svgPathDark_=this.svgPathLight_=this.svgPath_=this.svgGroup_=null;Blockly.Field.stopCache()}};
Blockly.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){Blockly.Tooltip.hide();Blockly.utils.dom.startTextWidthCache();var c=this.workspace;Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture());Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide();b&&this.rendered&&(this.unplug(a),Blockly.blockAnimations.disposeUiEffect(this));this.rendered=!1;if(this.warningTextDb_){for(var d in this.warningTextDb_)clearTimeout(this.warningTextDb_[d]);this.warningTextDb_=
null}this.unplug(a);var e;Blockly.Events.isEnabled()&&(e=new Blockly.Events.BlockDelete(this));Blockly.Events.disable();try{var f=this.getIcons();for(d=0;d<f.length;d++)f[d].dispose();Blockly.BlockSvg.superClass_.dispose.call(this,a)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&e&&Blockly.Events.fire(e);Blockly.utils.dom.removeNode(this.svgGroup_);c.resizeContents();this.svgPathDark_=this.svgPathLight_=this.svgPath_=this.svgGroup_=null;Blockly.utils.dom.stopTextWidthCache()}};
Blockly.BlockSvg.prototype.updateColour=function(){if(this.isEnabled()){this.isShadow()?this.setShadowColour_():(this.setBorderColour_(),this.svgPath_.setAttribute("fill",this.getColour()));for(var a=this.getIcons(),b=0;b<a.length;b++)a[b].updateColour();for(a=0;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateColour()}};
Blockly.BlockSvg.prototype.setBorderColour_=function(){var a=this.getColourBorder();a.colourBorder?(this.svgPathLight_.style.display="none",this.svgPathDark_.style.display="none",this.svgPath_.setAttribute("stroke",a.colourBorder)):(this.svgPathLight_.style.display="",this.svgPathDark_.style.display="",this.svgPath_.setAttribute("stroke","none"),this.svgPathLight_.setAttribute("stroke",a.colourLight),this.svgPathDark_.setAttribute("fill",a.colourDark))};
Blockly.BlockSvg.prototype.setShadowColour_=function(){var a=this.getColourShadow();this.svgPathLight_.style.display="none";this.svgPathDark_.setAttribute("fill",a);this.svgPath_.setAttribute("stroke","none");this.svgPath_.setAttribute("fill",a);return a};
@@ -1529,8 +1531,8 @@ Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.sup
Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.RenderedConnection(this,a)};
Blockly.BlockSvg.prototype.bumpNeighbours_=function(){if(this.workspace&&!this.workspace.isDragging()){var a=this.getRootBlock();if(!a.isInFlyout)for(var b=this.getConnections_(!1),c=0,d;d=b[c];c++){d.isConnected()&&d.isSuperior()&&d.targetBlock().bumpNeighbours_();for(var e=d.neighbours_(Blockly.SNAP_RADIUS),f=0,g;g=e[f];f++)d.isConnected()&&g.isConnected()||g.getSourceBlock().getRootBlock()!=a&&(d.isSuperior()?g.bumpAwayFrom_(d):d.bumpAwayFrom_(g))}}};
Blockly.BlockSvg.prototype.scheduleSnapAndBump=function(){var a=this,b=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(b);a.snapToGrid();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY/2);setTimeout(function(){Blockly.Events.setGroup(b);a.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)};Blockly.BlockSvg.prototype.positionNearConnection=function(a,b){a.type!=Blockly.NEXT_STATEMENT&&a.type!=Blockly.INPUT_VALUE||this.moveBy(b.x_-a.x_,b.y_-a.y_)};
Blockly.BlockSvg.prototype.render=function(a){Blockly.Field.startCache();this.rendered=!0;Blockly.blockRendering.render(this);this.updateConnectionLocations_();!1!==a&&((a=this.getParent())?a.render(!0):this.workspace.resizeContents());Blockly.Field.stopCache()};
Blockly.BlockSvg.prototype.updateConnectionLocations_=function(){var a=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(a);this.outputConnection&&this.outputConnection.moveToOffset(a);for(var b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.moveToOffset(a),c.isConnected()&&c.tighten_())}this.nextConnection&&(this.nextConnection.moveToOffset(a),this.nextConnection.isConnected()&&this.nextConnection.tighten_())};Blockly.BlockSvg.render={};Blockly.BlockSvg.PathObject=function(){this.steps=[];this.highlightSteps=[];this.inlineSteps=[];this.highlightInlineSteps=[]};Blockly.BlockSvg.SEP_SPACE_X=10;Blockly.BlockSvg.SEP_SPACE_Y=10;Blockly.BlockSvg.MIN_BLOCK_Y=25;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.START_HAT=!1;Blockly.BlockSvg.TAB_PATH_DOWN="v 5 c 0,10 -"+Blockly.BlockSvg.TAB_WIDTH+",-8 -"+Blockly.BlockSvg.TAB_WIDTH+",7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",-2.5 "+Blockly.BlockSvg.TAB_WIDTH+",7.5";
Blockly.BlockSvg.prototype.render=function(a){Blockly.utils.dom.startTextWidthCache();this.rendered=!0;Blockly.blockRendering.render(this);this.updateConnectionLocations_();!1!==a&&((a=this.getParent())?a.render(!0):this.workspace.resizeContents());Blockly.utils.dom.stopTextWidthCache()};
Blockly.BlockSvg.prototype.updateConnectionLocations_=function(){var a=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(a);this.outputConnection&&this.outputConnection.moveToOffset(a);for(var b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.moveToOffset(a),c.isConnected()&&c.tighten_())}this.nextConnection&&(this.nextConnection.moveToOffset(a),this.nextConnection.isConnected()&&this.nextConnection.tighten_())};Blockly.BlockSvg.render={};Blockly.BlockSvg.PathObject=function(){this.steps=[];this.highlightSteps=[];this.inlineSteps=[];this.highlightInlineSteps=[]};Blockly.BlockSvg.SEP_SPACE_Y=10;Blockly.BlockSvg.MIN_BLOCK_Y=25;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.START_HAT=!1;Blockly.BlockSvg.TAB_PATH_DOWN="v 5 c 0,10 -"+Blockly.BlockSvg.TAB_WIDTH+",-8 -"+Blockly.BlockSvg.TAB_WIDTH+",7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",-2.5 "+Blockly.BlockSvg.TAB_WIDTH+",7.5";
Blockly.BlockSvg.prototype.getHeightWidth=function(){var a=this.height,b=this.width,c=this.getNextBlock();c?(c=c.getHeightWidth(),a+=c.height-4,b=Math.max(b,c.width)):this.nextConnection||this.outputConnection||(a+=2);return{height:a,width:b}};
Blockly.BlockSvg.prototype.setPaths_=function(a){var b=a.steps.join(" ")+"\n"+a.inlineSteps.join(" ");this.svgPath_.setAttribute("d",b);this.svgPathDark_.setAttribute("d",b);b=a.highlightSteps.join(" ")+"\n"+a.highlightInlineSteps.join(" ");this.svgPathLight_.setAttribute("d",b);this.RTL&&(this.svgPath_.setAttribute("transform","scale(-1 1)"),this.svgPathLight_.setAttribute("transform","scale(-1 1)"),this.svgPathDark_.setAttribute("transform","translate(1,1) scale(-1 1)"))};
Blockly.BlockSvg.prototype.positionNewBlock=function(a,b,c){b.type!=Blockly.NEXT_STATEMENT&&b.type!=Blockly.INPUT_VALUE||a.moveBy(c.x_-b.x_,c.y_-b.y_)};Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyReplaceable"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyReplaceable")};
@@ -1551,19 +1553,25 @@ Blockly.DropDownDiv.hide=function(){var a=Blockly.DropDownDiv.DIV_;a.style.trans
Blockly.DropDownDiv.hideWithoutAnimation=function(){if(Blockly.DropDownDiv.isVisible()){Blockly.DropDownDiv.animateOutTimer_&&clearTimeout(Blockly.DropDownDiv.animateOutTimer_);var a=Blockly.DropDownDiv.DIV_;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";Blockly.DropDownDiv.clearContent();Blockly.DropDownDiv.owner_=null;Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null)}};
Blockly.DropDownDiv.positionInternal_=function(a,b,c,d){a=Math.floor(a);b=Math.floor(b);c=Math.floor(c);d=Math.floor(d);var e=Blockly.DropDownDiv.DIV_;e.style.left=a+"px";e.style.top=b+"px";e.style.display="block";e.style.opacity=1;e.style.transform="translate("+(c-a)+"px,"+(d-b)+"px)"};
Blockly.DropDownDiv.repositionForWindowResize=function(){if(Blockly.DropDownDiv.owner_){var a=Blockly.DropDownDiv.owner_.getSourceBlock(),b=a.workspace.scale,c=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.owner_.size_.width:a.width,d=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.owner_.size_.height:a.height;c*=b;d*=b;a=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.owner_.fieldGroup_.getBoundingClientRect():a.getSvgRoot().getBoundingClientRect();c=a.left+c/2;d=Blockly.DropDownDiv.getPositionMetrics(c,
a.top+d,c,a.top);Blockly.DropDownDiv.positionInternal_(d.initialX,d.initialY,d.finalX,d.finalY)}else Blockly.DropDownDiv.hide()};Blockly.FieldTextInput=function(a,b){a=this.doClassValidation_(a);null===a&&(a="");Blockly.FieldTextInput.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.FieldTextInput,Blockly.Field);Blockly.FieldTextInput.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);b=new Blockly.FieldTextInput(b);"boolean"===typeof a.spellcheck&&b.setSpellcheck(a.spellcheck);return b};Blockly.FieldTextInput.prototype.SERIALIZABLE=!0;Blockly.FieldTextInput.FONTSIZE=11;
Blockly.FieldTextInput.prototype.CURSOR="text";Blockly.FieldTextInput.prototype.spellcheck_=!0;Blockly.FieldTextInput.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};
a.top+d,c,a.top);Blockly.DropDownDiv.positionInternal_(d.initialX,d.initialY,d.finalX,d.finalY)}else Blockly.DropDownDiv.hide()};Blockly.utils.aria={};Blockly.utils.aria.ARIA_PREFIX_="aria-";Blockly.utils.aria.ROLE_ATTRIBUTE_="role";
Blockly.utils.aria.Role={ALERT:"alert",ALERTDIALOG:"alertdialog",APPLICATION:"application",ARTICLE:"article",BANNER:"banner",BUTTON:"button",CHECKBOX:"checkbox",COLUMNHEADER:"columnheader",COMBOBOX:"combobox",COMPLEMENTARY:"complementary",CONTENTINFO:"contentinfo",DEFINITION:"definition",DIALOG:"dialog",DIRECTORY:"directory",DOCUMENT:"document",FORM:"form",GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",HEADING:"heading",IMG:"img",LINK:"link",LIST:"list",LISTBOX:"listbox",LISTITEM:"listitem",LOG:"log",
MAIN:"main",MARQUEE:"marquee",MATH:"math",MENU:"menu",MENUBAR:"menubar",MENUITEM:"menuitem",MENUITEMCHECKBOX:"menuitemcheckbox",MENUITEMRADIO:"menuitemradio",NAVIGATION:"navigation",NOTE:"note",OPTION:"option",PRESENTATION:"presentation",PROGRESSBAR:"progressbar",RADIO:"radio",RADIOGROUP:"radiogroup",REGION:"region",ROW:"row",ROWGROUP:"rowgroup",ROWHEADER:"rowheader",SCROLLBAR:"scrollbar",SEARCH:"search",SEPARATOR:"separator",SLIDER:"slider",SPINBUTTON:"spinbutton",STATUS:"status",TAB:"tab",TABLIST:"tablist",
TABPANEL:"tabpanel",TEXTBOX:"textbox",TEXTINFO:"textinfo",TIMER:"timer",TOOLBAR:"toolbar",TOOLTIP:"tooltip",TREE:"tree",TREEGRID:"treegrid",TREEITEM:"treeitem"};
Blockly.utils.aria.State={ACTIVEDESCENDANT:"activedescendant",ATOMIC:"atomic",AUTOCOMPLETE:"autocomplete",BUSY:"busy",CHECKED:"checked",COLINDEX:"colindex",CONTROLS:"controls",DESCRIBEDBY:"describedby",DISABLED:"disabled",DROPEFFECT:"dropeffect",EXPANDED:"expanded",FLOWTO:"flowto",GRABBED:"grabbed",HASPOPUP:"haspopup",HIDDEN:"hidden",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",LIVE:"live",MULTILINE:"multiline",MULTISELECTABLE:"multiselectable",ORIENTATION:"orientation",OWNS:"owns",
POSINSET:"posinset",PRESSED:"pressed",READONLY:"readonly",RELEVANT:"relevant",REQUIRED:"required",ROWINDEX:"rowindex",SELECTED:"selected",SETSIZE:"setsize",SORT:"sort",VALUEMAX:"valuemax",VALUEMIN:"valuemin",VALUENOW:"valuenow",VALUETEXT:"valuetext"};Blockly.utils.aria.setRole=function(a,b){b?a.setAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_,b):Blockly.utils.aria.removeRole(a)};Blockly.utils.aria.getRole=function(a){return a.getAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_)||null};
Blockly.utils.aria.removeRole=function(a){a.removeAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_)};Blockly.utils.aria.setState=function(a,b,c){Array.isArray(c)&&(c=c.join(" "));b=Blockly.utils.aria.getAriaAttributeName_(b);a.setAttribute(b,c)};Blockly.utils.aria.getAriaAttributeName_=function(a){return Blockly.utils.aria.ARIA_PREFIX_+a};Blockly.FieldTextInput=function(a,b){a=this.doClassValidation_(a);null===a&&(a="");Blockly.FieldTextInput.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.FieldTextInput,Blockly.Field);Blockly.FieldTextInput.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);b=new Blockly.FieldTextInput(b);"boolean"===typeof a.spellcheck&&b.setSpellcheck(a.spellcheck);return b};Blockly.FieldTextInput.prototype.SERIALIZABLE=!0;Blockly.FieldTextInput.FONTSIZE=11;
Blockly.FieldTextInput.BORDERRADIUS=4;Blockly.FieldTextInput.prototype.CURSOR="text";Blockly.FieldTextInput.prototype.spellcheck_=!0;Blockly.FieldTextInput.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};
Blockly.FieldTextInput.prototype.doValueInvalid_=function(a){this.isBeingEdited_&&(this.isTextValid_=!1,a=this.value_,this.value_=this.htmlInput_.untypedDefaultValue_,this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name,a,this.value_)))};Blockly.FieldTextInput.prototype.doValueUpdate_=function(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||(this.text_=String(a),this.isDirty_=!0)};
Blockly.FieldTextInput.prototype.render_=function(){Blockly.FieldTextInput.superClass_.render_.call(this);if(this.isBeingEdited_){if(this.sourceBlock_.RTL){var a=this;setTimeout(function(){a.resizeEditor_()},0)}else this.resizeEditor_();this.isTextValid_?Blockly.utils.dom.removeClass(this.htmlInput_,"blocklyInvalidInput"):Blockly.utils.dom.addClass(this.htmlInput_,"blocklyInvalidInput")}};Blockly.FieldTextInput.prototype.setSpellcheck=function(a){this.spellcheck_=a};
Blockly.FieldTextInput.prototype.showEditor_=function(a){this.workspace_=this.sourceBlock_.workspace;a=a||!1;!a&&(Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(a)};Blockly.FieldTextInput.prototype.showPromptEditor_=function(){var a=this;Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE,this.text_,function(b){a.setValue(b)})};
Blockly.FieldTextInput.prototype.render_=function(){Blockly.FieldTextInput.superClass_.render_.call(this);if(this.isBeingEdited_){if(this.sourceBlock_.RTL){var a=this;setTimeout(function(){a.resizeEditor_()},0)}else this.resizeEditor_();this.isTextValid_?(Blockly.utils.dom.removeClass(this.htmlInput_,"blocklyInvalidInput"),Blockly.utils.aria.setState(this.htmlInput_,"invalid",!1)):(Blockly.utils.dom.addClass(this.htmlInput_,"blocklyInvalidInput"),Blockly.utils.aria.setState(this.htmlInput_,"invalid",
!0))}};Blockly.FieldTextInput.prototype.setSpellcheck=function(a){this.spellcheck_=a};Blockly.FieldTextInput.prototype.showEditor_=function(a){this.workspace_=this.sourceBlock_.workspace;a=a||!1;!a&&(Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(a)};Blockly.FieldTextInput.prototype.showPromptEditor_=function(){var a=this;Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE,this.text_,function(b){a.setValue(b)})};
Blockly.FieldTextInput.prototype.showInlineEditor_=function(a){this.isBeingEdited_=!0;Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();a||(this.htmlInput_.focus(),this.htmlInput_.select())};
Blockly.FieldTextInput.prototype.widgetCreate_=function(){var a=Blockly.WidgetDiv.DIV,b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",this.spellcheck_);var c=Blockly.FieldTextInput.FONTSIZE*this.workspace_.scale+"pt";a.style.fontSize=c;b.style.fontSize=c;a.appendChild(b);b.value=b.defaultValue=this.value_;b.untypedDefaultValue_=this.value_;b.oldValue_=null;var d=this;setTimeout(function(){d.resizeEditor_()},0);this.bindInputEvents_(b);return b};
Blockly.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1;this.value_!==this.text_&&(this.text_=String(this.value_),this.isTextValid_=!0,this.forceRerender());if(this.onFinishEditing_)this.onFinishEditing_(this.value_);this.unbindInputEvents_();var a=Blockly.WidgetDiv.DIV.style;a.width="auto";a.height="auto";a.fontSize=""};
Blockly.FieldTextInput.prototype.widgetCreate_=function(){var a=Blockly.WidgetDiv.DIV,b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",this.spellcheck_);var c=Blockly.FieldTextInput.FONTSIZE*this.workspace_.scale+"pt";a.style.fontSize=c;b.style.fontSize=c;b.style.borderRadius=Blockly.FieldTextInput.BORDERRADIUS*this.workspace_.scale+"px";a.appendChild(b);b.value=b.defaultValue=this.value_;b.untypedDefaultValue_=this.value_;b.oldValue_=null;var d=this;setTimeout(function(){d.resizeEditor_()},
0);this.bindInputEvents_(b);return b};Blockly.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1;this.value_!==this.text_&&(this.text_=String(this.value_),this.isTextValid_=!0,this.forceRerender());if(this.onFinishEditing_)this.onFinishEditing_(this.value_);this.unbindInputEvents_();var a=Blockly.WidgetDiv.DIV.style;a.width="auto";a.height="auto";a.fontSize=""};
Blockly.FieldTextInput.prototype.bindInputEvents_=function(a){this.onKeyDownWrapper_=Blockly.bindEventWithChecks_(a,"keydown",this,this.onHtmlInputKeyDown_);this.onKeyInputWrapper_=Blockly.bindEventWithChecks_(a,"input",this,this.onHtmlInputChange_)};Blockly.FieldTextInput.prototype.unbindInputEvents_=function(){Blockly.unbindEvent_(this.onKeyDownWrapper_);Blockly.unbindEvent_(this.onKeyInputWrapper_)};
Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_=function(a){13==a.keyCode?Blockly.WidgetDiv.hide():27==a.keyCode?(this.htmlInput_.value=this.htmlInput_.defaultValue,Blockly.WidgetDiv.hide()):9==a.keyCode&&(Blockly.WidgetDiv.hide(),this.sourceBlock_.tab(this,!a.shiftKey),a.preventDefault())};
Blockly.FieldTextInput.prototype.onHtmlInputChange_=function(a){a=this.htmlInput_.value;a!==this.htmlInput_.oldValue_&&(this.htmlInput_.oldValue_=a,Blockly.Events.setGroup(!0),this.setValue(a),this.text_=this.htmlInput_.value,this.forceRerender(),Blockly.Events.setGroup(!1))};
Blockly.FieldTextInput.prototype.resizeEditor_=function(){var a=Blockly.WidgetDiv.DIV,b=this.getScaledBBox_();a.style.width=b.right-b.left+"px";a.style.height=b.bottom-b.top+"px";b=new Blockly.utils.Coordinate(this.sourceBlock_.RTL?b.right-a.offsetWidth:b.left,b.top);b.y+=1;Blockly.utils.userAgent.GECKO&&Blockly.WidgetDiv.DIV.style.top&&(--b.x,--b.y);Blockly.utils.userAgent.WEBKIT&&(b.y-=3);a.style.left=b.x+"px";a.style.top=b.y+"px"};
Blockly.FieldTextInput.numberValidator=function(a){console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);return isNaN(a)?null:String(a)};Blockly.FieldTextInput.nonnegativeIntegerValidator=function(a){(a=Blockly.FieldTextInput.numberValidator(a))&&(a=String(Math.max(0,Math.floor(a))));return a};Blockly.Field.register("field_input",Blockly.FieldTextInput);Blockly.FieldAngle=function(a,b){a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldAngle.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.FieldAngle,Blockly.FieldTextInput);Blockly.FieldAngle.fromJson=function(a){return new Blockly.FieldAngle(a.angle)};Blockly.FieldAngle.prototype.SERIALIZABLE=!0;Blockly.FieldAngle.ROUND=15;Blockly.FieldAngle.HALF=50;Blockly.FieldAngle.CLOCKWISE=!1;Blockly.FieldAngle.OFFSET=0;Blockly.FieldAngle.WRAP=360;
Blockly.FieldTextInput.numberValidator=function(a){console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);return isNaN(a)?null:String(a)};Blockly.FieldTextInput.nonnegativeIntegerValidator=function(a){(a=Blockly.FieldTextInput.numberValidator(a))&&(a=String(Math.max(0,Math.floor(a))));return a};Blockly.fieldRegistry.register("field_input",Blockly.FieldTextInput);Blockly.FieldAngle=function(a,b){a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldAngle.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.FieldAngle,Blockly.FieldTextInput);Blockly.FieldAngle.fromJson=function(a){return new Blockly.FieldAngle(a.angle)};Blockly.FieldAngle.prototype.SERIALIZABLE=!0;Blockly.FieldAngle.ROUND=15;Blockly.FieldAngle.HALF=50;Blockly.FieldAngle.CLOCKWISE=!1;Blockly.FieldAngle.OFFSET=0;Blockly.FieldAngle.WRAP=360;
Blockly.FieldAngle.RADIUS=Blockly.FieldAngle.HALF-1;Blockly.FieldAngle.prototype.initView=function(){Blockly.FieldAngle.superClass_.initView.call(this);this.symbol_=Blockly.utils.dom.createSvgElement("tspan",{},null);this.symbol_.appendChild(document.createTextNode("\u00b0"));this.textElement_.appendChild(this.symbol_)};Blockly.FieldAngle.prototype.render_=function(){Blockly.FieldAngle.superClass_.render_.call(this);this.updateGraph_()};
Blockly.FieldAngle.prototype.showEditor_=function(){Blockly.FieldAngle.superClass_.showEditor_.call(this,Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD);var a=this.dropdownCreate_();Blockly.DropDownDiv.getContentDiv().appendChild(a);a=this.sourceBlock_.getColourBorder();a=a.colourBorder||a.colourLight;Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(),a);Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));this.updateGraph_()};
Blockly.FieldAngle.prototype.dropdownCreate_=function(){var a=Blockly.utils.dom.createSvgElement("svg",{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1",height:2*Blockly.FieldAngle.HALF+"px",width:2*Blockly.FieldAngle.HALF+"px"},null),b=Blockly.utils.dom.createSvgElement("circle",{cx:Blockly.FieldAngle.HALF,cy:Blockly.FieldAngle.HALF,r:Blockly.FieldAngle.RADIUS,"class":"blocklyAngleCircle"},a);this.gauge_=Blockly.utils.dom.createSvgElement("path",
@@ -1574,11 +1582,11 @@ Blockly.FieldAngle.prototype.onMouseMove=function(a){var b=this.gauge_.ownerSVGE
(a-=360),c=String(a),c!=this.text_&&(this.htmlInput_.value=a,this.setValue(a),this.text_=c,this.forceRerender()))};
Blockly.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var a=Number(this.getText())+Blockly.FieldAngle.OFFSET,b=Blockly.utils.math.toRadians(a%360);a=["M ",Blockly.FieldAngle.HALF,",",Blockly.FieldAngle.HALF];var c=Blockly.FieldAngle.HALF,d=Blockly.FieldAngle.HALF;if(!isNaN(b)){var e=Blockly.utils.math.toRadians(Blockly.FieldAngle.OFFSET),f=Math.cos(e)*Blockly.FieldAngle.RADIUS,g=Math.sin(e)*-Blockly.FieldAngle.RADIUS;Blockly.FieldAngle.CLOCKWISE&&(b=2*e-b);c+=Math.cos(b)*Blockly.FieldAngle.RADIUS;
d-=Math.sin(b)*Blockly.FieldAngle.RADIUS;b=Math.abs(Math.floor((b-e)/Math.PI)%2);Blockly.FieldAngle.CLOCKWISE&&(b=1-b);a.push(" l ",f,",",g," A ",Blockly.FieldAngle.RADIUS,",",Blockly.FieldAngle.RADIUS," 0 ",b," ",Number(Blockly.FieldAngle.CLOCKWISE)," ",c,",",d," z")}this.gauge_.setAttribute("d",a.join(""));this.line_.setAttribute("x2",c);this.line_.setAttribute("y2",d)}};
Blockly.FieldAngle.prototype.doClassValidation_=function(a){a=Number(a)%360;if(isNaN(a))return null;0>a&&(a+=360);a>Blockly.FieldAngle.WRAP&&(a-=360);return a};Blockly.Field.register("field_angle",Blockly.FieldAngle);Blockly.FieldCheckbox=function(a,b){a=this.doClassValidation_(a);null===a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b);this.size_.width=Blockly.FieldCheckbox.WIDTH};goog.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked)};Blockly.FieldCheckbox.WIDTH=15;Blockly.FieldCheckbox.CHECK_CHAR="\u2713";Blockly.FieldCheckbox.CHECK_X_OFFSET=Blockly.Field.DEFAULT_TEXT_OFFSET-3;
Blockly.FieldAngle.prototype.doClassValidation_=function(a){a=Number(a)%360;if(isNaN(a))return null;0>a&&(a+=360);a>Blockly.FieldAngle.WRAP&&(a-=360);return a};Blockly.fieldRegistry.register("field_angle",Blockly.FieldAngle);Blockly.FieldCheckbox=function(a,b){a=this.doClassValidation_(a);null===a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b);this.size_.width=Blockly.FieldCheckbox.WIDTH};goog.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked)};Blockly.FieldCheckbox.WIDTH=15;Blockly.FieldCheckbox.CHECK_CHAR="\u2713";Blockly.FieldCheckbox.CHECK_X_OFFSET=Blockly.Field.DEFAULT_TEXT_OFFSET-3;
Blockly.FieldCheckbox.CHECK_Y_OFFSET=14;Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0;Blockly.FieldCheckbox.prototype.CURSOR="default";Blockly.FieldCheckbox.prototype.isDirty_=!1;
Blockly.FieldCheckbox.prototype.initView=function(){Blockly.FieldCheckbox.superClass_.initView.call(this);this.textElement_.setAttribute("x",Blockly.FieldCheckbox.CHECK_X_OFFSET);this.textElement_.setAttribute("y",Blockly.FieldCheckbox.CHECK_Y_OFFSET);Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox");var a=document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);this.textElement_.appendChild(a);this.textElement_.style.display=this.value_?"block":"none"};
Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)};Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"};
Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))};Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};Blockly.Field.register("field_checkbox",Blockly.FieldCheckbox);Blockly.utils.colour={};Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;b="#"==a[0]?a:"#"+a;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?Blockly.utils.colour.rgbToHex(a,b,c):null};
Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))};Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};Blockly.fieldRegistry.register("field_checkbox",Blockly.FieldCheckbox);Blockly.utils.colour={};Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;b="#"==a[0]?a:"#"+a;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?Blockly.utils.colour.rgbToHex(a,b,c):null};
Blockly.utils.colour.rgbToHex=function(a,b,c){b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)};Blockly.utils.colour.hexToRgb=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]};
Blockly.utils.colour.hsvToHex=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);b=c*(1-b*(1-h));switch(g){case 1:d=k;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=k;break;case 6:case 0:d=c,e=b,f=a}}return Blockly.utils.colour.rgbToHex(Math.floor(d),Math.floor(e),Math.floor(f))};
Blockly.utils.colour.blend=function(a,b,c){a=Blockly.utils.colour.hexToRgb(Blockly.utils.colour.parse(a));b=Blockly.utils.colour.hexToRgb(Blockly.utils.colour.parse(b));return Blockly.utils.colour.rgbToHex(Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2])))};
@@ -1589,7 +1597,7 @@ Blockly.FieldColour.prototype.getText=function(){var a=this.value_;/^#(.)\1(.)\2
Blockly.FieldColour.TITLES=[];Blockly.FieldColour.COLUMNS=7;Blockly.FieldColour.prototype.setColours=function(a,b){this.colours_=a;b&&(this.titles_=b);return this};Blockly.FieldColour.prototype.setColumns=function(a){this.columns_=a;return this};
Blockly.FieldColour.prototype.showEditor_=function(){var a=this.dropdownCreate_();Blockly.DropDownDiv.getContentDiv().appendChild(a);Blockly.DropDownDiv.setColour(this.DROPDOWN_BACKGROUND_COLOUR,this.DROPDOWN_BORDER_COLOUR);Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this))};Blockly.FieldColour.prototype.onClick_=function(a){(a=a.target)&&!a.label&&(a=a.parentNode);a=a&&a.label;null!==a&&(this.setValue(a),Blockly.DropDownDiv.hideIfOwner(this))};
Blockly.FieldColour.prototype.dropdownCreate_=function(){var a=this.columns_||Blockly.FieldColour.COLUMNS,b=this.colours_||Blockly.FieldColour.COLOURS,c=this.titles_||Blockly.FieldColour.TITLES,d=this.getValue(),e=document.createElement("table");e.className="blocklyColourTable";for(var f,g=0;g<b.length;g++){0==g%a&&(f=document.createElement("tr"),e.appendChild(f));var h=document.createElement("td");f.appendChild(h);var k=document.createElement("div");h.appendChild(k);h.label=b[g];h.title=c[g]||b[g];
k.style.backgroundColor=b[g];b[g]==d&&(k.className="blocklyColourSelected")}this.onUpWrapper_=Blockly.bindEvent_(e,"mouseup",this,this.onClick_);return e};Blockly.FieldColour.prototype.dropdownDispose_=function(){Blockly.unbindEvent_(this.onUpWrapper_)};Blockly.Field.register("field_colour",Blockly.FieldColour);Blockly.FieldDropdown=function(a,b){"function"!=typeof a&&Blockly.FieldDropdown.validateOptions_(a);this.menuGenerator_=a;this.trimOptions_();var c=this.getOptions()[0];Blockly.FieldDropdown.superClass_.constructor.call(this,c[1],b)};goog.inherits(Blockly.FieldDropdown,Blockly.Field);Blockly.FieldDropdown.fromJson=function(a){return new Blockly.FieldDropdown(a.options)};Blockly.FieldDropdown.prototype.SERIALIZABLE=!0;Blockly.FieldDropdown.CHECKMARK_OVERHANG=25;
k.style.backgroundColor=b[g];b[g]==d&&(k.className="blocklyColourSelected")}this.onUpWrapper_=Blockly.bindEvent_(e,"mouseup",this,this.onClick_);return e};Blockly.FieldColour.prototype.dropdownDispose_=function(){Blockly.unbindEvent_(this.onUpWrapper_)};Blockly.fieldRegistry.register("field_colour",Blockly.FieldColour);Blockly.FieldDropdown=function(a,b){"function"!=typeof a&&Blockly.FieldDropdown.validateOptions_(a);this.menuGenerator_=a;this.trimOptions_();var c=this.getOptions()[0];Blockly.FieldDropdown.superClass_.constructor.call(this,c[1],b)};goog.inherits(Blockly.FieldDropdown,Blockly.Field);Blockly.FieldDropdown.fromJson=function(a){return new Blockly.FieldDropdown(a.options)};Blockly.FieldDropdown.prototype.SERIALIZABLE=!0;Blockly.FieldDropdown.CHECKMARK_OVERHANG=25;
Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH=.45;Blockly.FieldDropdown.IMAGE_Y_OFFSET=5;Blockly.FieldDropdown.IMAGE_Y_PADDING=2*Blockly.FieldDropdown.IMAGE_Y_OFFSET;Blockly.FieldDropdown.ARROW_CHAR=Blockly.utils.userAgent.ANDROID?"\u25bc":"\u25be";Blockly.FieldDropdown.prototype.CURSOR="default";Blockly.FieldDropdown.prototype.imageElement_=null;Blockly.FieldDropdown.prototype.imageJson_=null;
Blockly.FieldDropdown.prototype.initView=function(){Blockly.FieldDropdown.superClass_.initView.call(this);this.imageElement_=Blockly.utils.dom.createSvgElement("image",{y:Blockly.FieldDropdown.IMAGE_Y_OFFSET},this.fieldGroup_);this.arrow_=Blockly.utils.dom.createSvgElement("tspan",{},this.textElement_);this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?Blockly.FieldDropdown.ARROW_CHAR+" ":" "+Blockly.FieldDropdown.ARROW_CHAR));this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,
this.textContent_):this.textElement_.appendChild(this.arrow_)};Blockly.FieldDropdown.prototype.showEditor_=function(){Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.menu_=this.widgetCreate_();this.menu_.render(Blockly.WidgetDiv.DIV);Blockly.utils.dom.addClass(this.menu_.getElement(),"blocklyDropdownMenu");this.positionMenu_(this.menu_);this.menu_.setAllowAutoFocus(!0);this.menu_.getElement().focus()};
@@ -1603,18 +1611,18 @@ Blockly.FieldDropdown.prototype.getOptions=function(){if(this.isOptionListDynami
Blockly.FieldDropdown.prototype.doClassValidation_=function(a){for(var b=!1,c=this.getOptions(),d=0,e;e=c[d];d++)if(e[1]==a){b=!0;break}return b?a:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+a),null)};
Blockly.FieldDropdown.prototype.doValueUpdate_=function(a){Blockly.FieldDropdown.superClass_.doValueUpdate_.call(this,a);a=this.getOptions();for(var b=0,c;c=a[b];b++)c[1]==this.value_&&(c=c[0],"object"==typeof c?(this.imageJson_=c,this.text_=c.alt):(this.imageJson_=null,this.text_=c))};Blockly.FieldDropdown.prototype.updateColour=function(){this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?this.arrow_.style.fill=this.sourceBlock_.getColourShadow():this.arrow_.style.fill=this.sourceBlock_.getColour())};
Blockly.FieldDropdown.prototype.render_=function(){this.textContent_.nodeValue="";this.imageElement_.style.display="none";this.imageJson_?this.renderSelectedImage_():this.renderSelectedText_();this.borderRect_.setAttribute("height",this.size_.height);this.borderRect_.setAttribute("width",this.size_.width)};
Blockly.FieldDropdown.prototype.renderSelectedImage_=function(){this.imageElement_.style.display="";this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.imageJson_.src);this.imageElement_.setAttribute("height",this.imageJson_.height);this.imageElement_.setAttribute("width",this.imageJson_.width);var a=Blockly.Field.getCachedWidth(this.arrow_),b=Number(this.imageJson_.width);this.size_.height=Number(this.imageJson_.height)+Blockly.FieldDropdown.IMAGE_Y_PADDING;this.size_.width=
Blockly.FieldDropdown.prototype.renderSelectedImage_=function(){this.imageElement_.style.display="";this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.imageJson_.src);this.imageElement_.setAttribute("height",this.imageJson_.height);this.imageElement_.setAttribute("width",this.imageJson_.width);var a=Blockly.utils.dom.getTextWidth(this.arrow_),b=Number(this.imageJson_.width);this.size_.height=Number(this.imageJson_.height)+Blockly.FieldDropdown.IMAGE_Y_PADDING;this.size_.width=
b+a+Blockly.Field.X_PADDING;this.sourceBlock_.RTL?(b=Blockly.Field.DEFAULT_TEXT_OFFSET-1,this.imageElement_.setAttribute("x",Blockly.Field.DEFAULT_TEXT_OFFSET+a),this.textElement_.setAttribute("x",b)):(b=b+a+Blockly.Field.DEFAULT_TEXT_OFFSET+1,this.textElement_.setAttribute("text-anchor","end"),this.textElement_.setAttribute("x",b),this.imageElement_.setAttribute("x",Blockly.Field.DEFAULT_TEXT_OFFSET))};
Blockly.FieldDropdown.prototype.renderSelectedText_=function(){this.textContent_.nodeValue=this.getDisplayText_();this.textElement_.setAttribute("text-anchor","start");this.textElement_.setAttribute("x",Blockly.Field.DEFAULT_TEXT_OFFSET);this.size_.height=Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT;this.size_.width=Blockly.Field.getCachedWidth(this.textElement_)+Blockly.Field.X_PADDING};
Blockly.FieldDropdown.prototype.renderSelectedText_=function(){this.textContent_.nodeValue=this.getDisplayText_();this.textElement_.setAttribute("text-anchor","start");this.textElement_.setAttribute("x",Blockly.Field.DEFAULT_TEXT_OFFSET);this.size_.height=Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT;this.size_.width=Blockly.utils.dom.getTextWidth(this.textElement_)+Blockly.Field.X_PADDING};
Blockly.FieldDropdown.validateOptions_=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");for(var b=!1,c=0;c<a.length;++c){var d=a[c];Array.isArray(d)?"string"!=typeof d[1]?(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option id must be a string. Found "+d[1]+" in: ",d)):"string"!=typeof d[0]&&"string"!=typeof d[0].src&&(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must have a string label or image description. Found"+
d[0]+" in: ",d)):(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must be an array. Found: ",d))}if(b)throw TypeError("Found invalid FieldDropdown options.");};Blockly.Field.register("field_dropdown",Blockly.FieldDropdown);Blockly.FieldLabelSerializable=function(a,b){Blockly.FieldLabelSerializable.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.FieldLabelSerializable,Blockly.FieldLabel);Blockly.FieldLabelSerializable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabelSerializable(b,a["class"])};Blockly.FieldLabelSerializable.prototype.EDITABLE=!1;Blockly.FieldLabelSerializable.prototype.SERIALIZABLE=!0;
Blockly.Field.register("field_label_serializable",Blockly.FieldLabelSerializable);Blockly.FieldImage=function(a,b,c,d,e,f){this.sourceBlock_=null;if(!a)throw Error("Src value of an image field is required");if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");c=Number(c);b=Number(b);if(0>=c||0>=b)throw Error("Height and width values of an image field must be greater than 0.");this.imageHeight_=c;this.size_=new Blockly.utils.Size(b,c+Blockly.FieldImage.Y_PADDING);this.flipRtl_=f;this.text_=d||"";this.setValue(a||"");"function"==typeof e&&
d[0]+" in: ",d)):(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must be an array. Found: ",d))}if(b)throw TypeError("Found invalid FieldDropdown options.");};Blockly.fieldRegistry.register("field_dropdown",Blockly.FieldDropdown);Blockly.FieldLabelSerializable=function(a,b){Blockly.FieldLabelSerializable.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.FieldLabelSerializable,Blockly.FieldLabel);Blockly.FieldLabelSerializable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabelSerializable(b,a["class"])};Blockly.FieldLabelSerializable.prototype.EDITABLE=!1;Blockly.FieldLabelSerializable.prototype.SERIALIZABLE=!0;
Blockly.fieldRegistry.register("field_label_serializable",Blockly.FieldLabelSerializable);Blockly.FieldImage=function(a,b,c,d,e,f){this.sourceBlock_=null;if(!a)throw Error("Src value of an image field is required");if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");c=Number(c);b=Number(b);if(0>=c||0>=b)throw Error("Height and width values of an image field must be greater than 0.");this.imageHeight_=c;this.size_=new Blockly.utils.Size(b,c+Blockly.FieldImage.Y_PADDING);this.flipRtl_=f;this.text_=d||"";this.setValue(a||"");"function"==typeof e&&
(this.clickHandler_=e)};goog.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.src),c=Number(Blockly.utils.replaceMessageReferences(a.width)),d=Number(Blockly.utils.replaceMessageReferences(a.height)),e=Blockly.utils.replaceMessageReferences(a.alt);return new Blockly.FieldImage(b,c,d,e,null,!!a.flipRtl)};Blockly.FieldImage.Y_PADDING=1;Blockly.FieldImage.prototype.EDITABLE=!1;Blockly.FieldImage.prototype.isDirty_=!1;
Blockly.FieldImage.prototype.initView=function(){this.imageElement_=Blockly.utils.dom.createSvgElement("image",{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.text_},this.fieldGroup_);this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_)};Blockly.FieldImage.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:a};
Blockly.FieldImage.prototype.doValueUpdate_=function(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_||"")};Blockly.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_};Blockly.FieldImage.prototype.setText=function(a){this.setAlt(a)};Blockly.FieldImage.prototype.setAlt=function(a){null!==a&&(this.text_=a,this.imageElement_&&this.imageElement_.setAttribute("alt",a||""))};
Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};Blockly.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};Blockly.Field.register("field_image",Blockly.FieldImage);Blockly.FieldNumber=function(a,b,c,d,e){this.setConstraints(b,c,d);a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldNumber.superClass_.constructor.call(this,a,e)};goog.inherits(Blockly.FieldNumber,Blockly.FieldTextInput);Blockly.FieldNumber.fromJson=function(a){return new Blockly.FieldNumber(a.value,a.min,a.max,a.precision)};Blockly.FieldNumber.prototype.SERIALIZABLE=!0;
Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};Blockly.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};Blockly.fieldRegistry.register("field_image",Blockly.FieldImage);Blockly.FieldNumber=function(a,b,c,d,e){this.setConstraints(b,c,d);a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldNumber.superClass_.constructor.call(this,a,e)};goog.inherits(Blockly.FieldNumber,Blockly.FieldTextInput);Blockly.FieldNumber.fromJson=function(a){return new Blockly.FieldNumber(a.value,a.min,a.max,a.precision)};Blockly.FieldNumber.prototype.SERIALIZABLE=!0;
Blockly.FieldNumber.prototype.setConstraints=function(a,b,c){c=Number(c);this.precision_=isNaN(c)?0:c;c=this.precision_.toString();var d=c.indexOf(".");this.fractionalDigits_=-1==d?-1:c.length-(d+1);a=Number(a);this.min_=isNaN(a)?-Infinity:a;b=Number(b);this.max_=isNaN(b)?Infinity:b;this.setValue(this.getValue())};
Blockly.FieldNumber.prototype.doClassValidation_=function(a){if(null===a||void 0===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.min_),this.max_);this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);return a=-1==this.fractionalDigits_?a:Number(a.toFixed(this.fractionalDigits_))};Blockly.Field.register("field_number",Blockly.FieldNumber);Blockly.FieldVariable=function(a,b,c,d){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate;this.size_=new Blockly.utils.Size(0,Blockly.BlockSvg.MIN_BLOCK_Y);b&&this.setValidator(b);this.defaultVariableName=a||"";this.setTypes_(c,d);this.value_=null};goog.inherits(Blockly.FieldVariable,Blockly.FieldDropdown);Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,null,a.variableTypes,a.defaultType)};
Blockly.FieldNumber.prototype.doClassValidation_=function(a){if(null===a||void 0===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.min_),this.max_);this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);return a=-1==this.fractionalDigits_?a:Number(a.toFixed(this.fractionalDigits_))};Blockly.fieldRegistry.register("field_number",Blockly.FieldNumber);Blockly.FieldVariable=function(a,b,c,d){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate;this.size_=new Blockly.utils.Size(0,Blockly.BlockSvg.MIN_BLOCK_Y);b&&this.setValidator(b);this.defaultVariableName=a||"";this.setTypes_(c,d);this.value_=null};goog.inherits(Blockly.FieldVariable,Blockly.FieldDropdown);Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,null,a.variableTypes,a.defaultType)};
Blockly.FieldVariable.prototype.workspace_=null;Blockly.FieldVariable.prototype.SERIALIZABLE=!0;Blockly.FieldVariable.prototype.initModel=function(){if(!this.variable_){var a=Blockly.Variables.getOrCreateVariablePackage(this.workspace_,null,this.defaultVariableName,this.defaultType_);Blockly.Events.disable();this.setValue(a.getId());Blockly.Events.enable()}};
Blockly.FieldVariable.prototype.fromXml=function(a){var b=a.getAttribute("id"),c=a.textContent,d=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=Blockly.Variables.getOrCreateVariablePackage(this.workspace_,b,c,d);if(null!=d&&d!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())};
Blockly.FieldVariable.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a);this.workspace_=a.workspace};
@@ -1625,7 +1633,7 @@ Blockly.FieldVariable.prototype.getVariableTypes_=function(){var a=this.variable
Blockly.FieldVariable.prototype.setTypes_=function(a,b){var c=b||"";if(null==a||void 0==a)var d=null;else if(Array.isArray(a)){d=a;for(var e=!1,f=0;f<d.length;f++)d[f]==c&&(e=!0);if(!e)throw Error("Invalid default type '"+c+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");this.defaultType_=c;this.variableTypes=d};Blockly.FieldVariable.prototype.refreshVariableName=function(){this.text_=this.variable_.name;this.forceRerender()};
Blockly.FieldVariable.dropdownCreate=function(){if(!this.variable_)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");var a=this.getText(),b=[];if(this.workspace_)for(var c=this.getVariableTypes_(),d=0;d<c.length;d++){var e=this.workspace_.getVariablesOfType(c[d]);b=b.concat(e)}b.sort(Blockly.VariableModel.compareByName);c=[];for(d=0;d<b.length;d++)c[d]=[b[d].name,b[d].getId()];c.push([Blockly.Msg.RENAME_VARIABLE,Blockly.RENAME_VARIABLE_ID]);Blockly.Msg.DELETE_VARIABLE&&
c.push([Blockly.Msg.DELETE_VARIABLE.replace("%1",a),Blockly.DELETE_VARIABLE_ID]);return c};Blockly.FieldVariable.prototype.onItemSelected=function(a,b){var c=b.getValue();if(this.workspace_){if(c==Blockly.RENAME_VARIABLE_ID){Blockly.Variables.renameVariable(this.workspace_,this.variable_);return}if(c==Blockly.DELETE_VARIABLE_ID){this.workspace_.deleteVariableById(this.variable_.getId());return}}this.setValue(c)};Blockly.FieldVariable.prototype.referencesVariables=function(){return!0};
Blockly.Field.register("field_variable",Blockly.FieldVariable);Blockly.Generator=function(a){this.name_=a;this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")};Blockly.Generator.NAME_TYPE="generated_function";Blockly.Generator.prototype.INFINITE_LOOP_TRAP=null;Blockly.Generator.prototype.STATEMENT_PREFIX=null;Blockly.Generator.prototype.STATEMENT_SUFFIX=null;Blockly.Generator.prototype.INDENT=" ";Blockly.Generator.prototype.COMMENT_WRAP=60;Blockly.Generator.prototype.ORDER_OVERRIDES=[];
Blockly.fieldRegistry.register("field_variable",Blockly.FieldVariable);Blockly.Generator=function(a){this.name_=a;this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")};Blockly.Generator.NAME_TYPE="generated_function";Blockly.Generator.prototype.INFINITE_LOOP_TRAP=null;Blockly.Generator.prototype.STATEMENT_PREFIX=null;Blockly.Generator.prototype.STATEMENT_SUFFIX=null;Blockly.Generator.prototype.INDENT=" ";Blockly.Generator.prototype.COMMENT_WRAP=60;Blockly.Generator.prototype.ORDER_OVERRIDES=[];
Blockly.Generator.prototype.workspaceToCode=function(a){a||(console.warn("No workspace specified in workspaceToCode call. Guessing."),a=Blockly.getMainWorkspace());var b=[];this.init(a);a=a.getTopBlocks(!0);for(var c=0,d;d=a[c];c++){var e=this.blockToCode(d);Array.isArray(e)&&(e=e[0]);e&&(d.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!d.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,d)+e),this.STATEMENT_SUFFIX&&!d.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,
d))),b.push(e))}b=b.join("\n");b=this.finish(b);b=b.replace(/^\s+\n/,"");b=b.replace(/\n\s+$/,"\n");return b=b.replace(/[ \t]+\n/g,"\n")};Blockly.Generator.prototype.prefixLines=function(a,b){return b+a.replace(/(?!\n$)\n/g,"\n"+b)};Blockly.Generator.prototype.allNestedComments=function(a){var b=[];a=a.getDescendants(!0);for(var c=0;c<a.length;c++){var d=a[c].getCommentText();d&&b.push(d)}b.length&&b.push("");return b.join("\n")};
Blockly.Generator.prototype.blockToCode=function(a,b){if(!a)return"";if(!a.isEnabled())return b?"":this.blockToCode(a.getNextBlock());var c=this[a.type];if("function"!=typeof c)throw Error('Language "'+this.name_+'" does not know how to generate code for block type "'+a.type+'".');c=c.call(a,a);if(Array.isArray(c)){if(!a.outputConnection)throw TypeError("Expecting string from statement block: "+a.type);return[this.scrub_(a,c[0],b),c[1]]}if("string"==typeof c)return this.STATEMENT_PREFIX&&!a.suppressPrefixSuffix&&
@@ -1688,9 +1696,9 @@ Blockly.navigation.flyoutOnAction_=function(a){switch(a.name){case Blockly.navig
!0;default:return!1}};
Blockly.navigation.toolboxOnAction_=function(a){switch(a.name){case Blockly.navigation.actionNames.PREVIOUS:return Blockly.navigation.previousCategory(),!0;case Blockly.navigation.actionNames.OUT:return Blockly.navigation.outCategory(),!0;case Blockly.navigation.actionNames.NEXT:return Blockly.navigation.nextCategory(),!0;case Blockly.navigation.actionNames.IN:return Blockly.navigation.inCategory(),!0;case Blockly.navigation.actionNames.EXIT:return Blockly.navigation.focusWorkspace(),!0;default:return!1}};
Blockly.navigation.enableKeyboardAccessibility=function(){Blockly.keyboardAccessibilityMode=!0};Blockly.navigation.disableKeyboardAccessibility=function(){Blockly.keyboardAccessibilityMode=!1};Blockly.navigation.log=function(a){Blockly.navigation.loggingCallback?Blockly.navigation.loggingCallback("log",a):console.log(a)};Blockly.navigation.warn=function(a){Blockly.navigation.loggingCallback?Blockly.navigation.loggingCallback("warn",a):console.warn(a)};
Blockly.navigation.error=function(a){Blockly.navigation.loggingCallback?Blockly.navigation.loggingCallback("error",a):console.error(a)};Blockly.navigation.ACTION_PREVIOUS=new Blockly.Action(Blockly.navigation.actionNames.PREVIOUS,"Goes to the previous location");Blockly.navigation.ACTION_OUT=new Blockly.Action(Blockly.navigation.actionNames.OUT,"Goes out");Blockly.navigation.ACTION_NEXT=new Blockly.Action(Blockly.navigation.actionNames.NEXT,"Goes to the next location");
Blockly.navigation.ACTION_IN=new Blockly.Action(Blockly.navigation.actionNames.IN,"Goes in");Blockly.navigation.ACTION_INSERT=new Blockly.Action(Blockly.navigation.actionNames.INSERT,"Tries to connect the current location to the marked location");Blockly.navigation.ACTION_MARK=new Blockly.Action(Blockly.navigation.actionNames.MARK,"Marks the current location");Blockly.navigation.ACTION_DISCONNECT=new Blockly.Action(Blockly.navigation.actionNames.DISCONNECT,"Disconnect the blocks");
Blockly.navigation.ACTION_TOOLBOX=new Blockly.Action(Blockly.navigation.actionNames.TOOLBOX,"Open the toolbox");Blockly.navigation.ACTION_EXIT=new Blockly.Action(Blockly.navigation.actionNames.EXIT,"Exit the toolbox");Blockly.Names=function(a,b){this.variablePrefix_=b||"";this.reservedDict_=Object.create(null);if(a)for(var c=a.split(","),d=0;d<c.length;d++)this.reservedDict_[c[d]]=!0;this.reset()};Blockly.Names.DEVELOPER_VARIABLE_TYPE="DEVELOPER_VARIABLE";Blockly.Names.prototype.reset=function(){this.db_=Object.create(null);this.dbReverse_=Object.create(null);this.variableMap_=null};Blockly.Names.prototype.setVariableMap=function(a){this.variableMap_=a};
Blockly.navigation.error=function(a){Blockly.navigation.loggingCallback?Blockly.navigation.loggingCallback("error",a):console.error(a)};Blockly.navigation.ACTION_PREVIOUS=new Blockly.Action(Blockly.navigation.actionNames.PREVIOUS,"Go to the previous location.");Blockly.navigation.ACTION_OUT=new Blockly.Action(Blockly.navigation.actionNames.OUT,"Go to the parent of the current location.");Blockly.navigation.ACTION_NEXT=new Blockly.Action(Blockly.navigation.actionNames.NEXT,"Go to the next location.");
Blockly.navigation.ACTION_IN=new Blockly.Action(Blockly.navigation.actionNames.IN,"Go to the first child of the current location.");Blockly.navigation.ACTION_INSERT=new Blockly.Action(Blockly.navigation.actionNames.INSERT,"Connect the current location to the marked location.");Blockly.navigation.ACTION_MARK=new Blockly.Action(Blockly.navigation.actionNames.MARK,"Mark the current location.");Blockly.navigation.ACTION_DISCONNECT=new Blockly.Action(Blockly.navigation.actionNames.DISCONNECT,"Dicsonnect the block at thecurrent location from its parent.");
Blockly.navigation.ACTION_TOOLBOX=new Blockly.Action(Blockly.navigation.actionNames.TOOLBOX,"Open the toolbox.");Blockly.navigation.ACTION_EXIT=new Blockly.Action(Blockly.navigation.actionNames.EXIT,"Close the current modal, such as a toolbox or field editor.");Blockly.Names=function(a,b){this.variablePrefix_=b||"";this.reservedDict_=Object.create(null);if(a)for(var c=a.split(","),d=0;d<c.length;d++)this.reservedDict_[c[d]]=!0;this.reset()};Blockly.Names.DEVELOPER_VARIABLE_TYPE="DEVELOPER_VARIABLE";Blockly.Names.prototype.reset=function(){this.db_=Object.create(null);this.dbReverse_=Object.create(null);this.variableMap_=null};Blockly.Names.prototype.setVariableMap=function(a){this.variableMap_=a};
Blockly.Names.prototype.getNameForUserVariable_=function(a){return this.variableMap_?(a=this.variableMap_.getVariableById(a))?a.name:null:(console.log("Deprecated call to Blockly.Names.prototype.getName without defining a variable map. To fix, add the folowing code in your generator's init() function:\nBlockly.YourGeneratorName.variableDB_.setVariableMap(workspace.getVariableMap());"),null)};
Blockly.Names.prototype.getName=function(a,b){if(b==Blockly.Variables.NAME_TYPE){var c=this.getNameForUserVariable_(a);c&&(a=c)}c=a.toLowerCase()+"_"+b;var d=b==Blockly.Variables.NAME_TYPE||b==Blockly.Names.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"";if(c in this.db_)return d+this.db_[c];var e=this.getDistinctName(a,b);this.db_[c]=e.substr(d.length);return e};
Blockly.Names.prototype.getDistinctName=function(a,b){for(var c=this.safeName_(a),d="";this.dbReverse_[c+d]||c+d in this.reservedDict_;)d=d?d+1:2;c+=d;this.dbReverse_[c]=!0;return(b==Blockly.Variables.NAME_TYPE||b==Blockly.Names.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"")+c};Blockly.Names.prototype.safeName_=function(a){a?(a=encodeURI(a.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!="0123456789".indexOf(a[0])&&(a="my_"+a)):a=Blockly.Msg.UNNAMED_KEY||"unnamed";return a};
@@ -1704,7 +1712,7 @@ Blockly.Procedures.getCallers=function(a,b){for(var c=[],d=b.getAllBlocks(!1),e=
Blockly.Procedures.mutateCallers=function(a){var b=Blockly.Events.recordUndo,c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=Blockly.Procedures.getCallers(c,a.workspace);c=0;for(var e;e=a[c];c++){var f=e.mutationToDom();f=f&&Blockly.Xml.domToText(f);e.domToMutation(d);var g=e.mutationToDom();g=g&&Blockly.Xml.domToText(g);f!=g&&(Blockly.Events.recordUndo=!1,Blockly.Events.fire(new Blockly.Events.BlockChange(e,"mutation",null,f,g)),Blockly.Events.recordUndo=b)}};
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getTopBlocks(!1),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.FlyoutButton=function(a,b,c,d){this.workspace_=a;this.targetWorkspace_=b;this.text_=c.getAttribute("text");this.position_=new Blockly.utils.Coordinate(0,0);this.isLabel_=d;this.callbackKey_=c.getAttribute("callbackKey")||c.getAttribute("callbackkey");this.cssClass_=c.getAttribute("web-class")||null};Blockly.FlyoutButton.MARGIN=5;Blockly.FlyoutButton.prototype.width=0;Blockly.FlyoutButton.prototype.height=0;Blockly.FlyoutButton.prototype.onMouseUpWrapper_=null;
Blockly.FlyoutButton.prototype.createDom=function(){var a=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass_&&(a+=" "+this.cssClass_);this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":a},this.workspace_.getCanvas());if(!this.isLabel_)var b=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);a=Blockly.utils.dom.createSvgElement("rect",{"class":this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",
rx:4,ry:4},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_);c.textContent=Blockly.utils.replaceMessageReferences(this.text_);this.width=Blockly.Field.getCachedWidth(c);this.height=20;this.isLabel_||(this.width+=2*Blockly.FlyoutButton.MARGIN,b.setAttribute("width",this.width),b.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);
rx:4,ry:4},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_);c.textContent=Blockly.utils.replaceMessageReferences(this.text_);this.width=Blockly.utils.dom.getTextWidth(c);this.height=20;this.isLabel_||(this.width+=2*Blockly.FlyoutButton.MARGIN,b.setAttribute("width",this.width),b.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);
c.setAttribute("x",this.width/2);c.setAttribute("y",this.height-Blockly.FlyoutButton.MARGIN);this.updateTransform_();this.onMouseUpWrapper_=Blockly.bindEventWithChecks_(this.svgGroup_,"mouseup",this,this.onMouseUp_);return this.svgGroup_};Blockly.FlyoutButton.prototype.show=function(){this.updateTransform_();this.svgGroup_.setAttribute("display","block")};
Blockly.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")};Blockly.FlyoutButton.prototype.moveTo=function(a,b){this.position_.x=a;this.position_.y=b;this.updateTransform_()};Blockly.FlyoutButton.prototype.getPosition=function(){return this.position_};Blockly.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_};
Blockly.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&Blockly.unbindEvent_(this.onMouseUpWrapper_);this.svgGroup_&&(Blockly.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.targetWorkspace_=this.workspace_=null};
@@ -1756,13 +1764,7 @@ Blockly.Component.prototype.isRightToLeft=function(){null==this.rightToLeft_&&(t
Blockly.Component.prototype.getChildCount=function(){return this.children_?this.children_.length:0};Blockly.Component.prototype.getChildIds=function(){var a=[];this.forEachChild(function(b){a.push(b.getId())});return a};Blockly.Component.prototype.getChild=function(a){return this.childIndex_&&a?this.childIndex_[a]||null:null};Blockly.Component.prototype.getChildAt=function(a){return this.children_?this.children_[a]||null:null};
Blockly.Component.prototype.forEachChild=function(a,b){if(this.children_)for(var c=0;c<this.children_.length;c++)a.call(b,this.children_[c],c)};Blockly.Component.prototype.indexOfChild=function(a){return this.children_&&a?this.children_.indexOf(a):-1};
Blockly.Component.prototype.removeChild=function(a,b){if(a){var c="string"===typeof a||a instanceof String?String(a):a.getId();a=this.getChild(c);c&&a&&(delete this.childIndex_[c],c=this.children_.indexOf(a),-1<c&&this.children_.splice(c,1),b&&(a.exitDocument(),a.element_&&Blockly.utils.dom.removeNode(a.element_)),a.setParent(null))}if(!a)throw Error(Blockly.Component.Error.NOT_OUR_CHILD);return a};
Blockly.Component.prototype.removeChildAt=function(a,b){return this.removeChild(this.getChildAt(a),b)};Blockly.Component.prototype.removeChildren=function(a){for(var b=[];this.hasChildren();)b.push(this.removeChildAt(0,a));return b};Blockly.utils.aria={};Blockly.utils.aria.ARIA_PREFIX_="aria-";Blockly.utils.aria.ROLE_ATTRIBUTE_="role";
Blockly.utils.aria.Role={ALERT:"alert",ALERTDIALOG:"alertdialog",APPLICATION:"application",ARTICLE:"article",BANNER:"banner",BUTTON:"button",CHECKBOX:"checkbox",COLUMNHEADER:"columnheader",COMBOBOX:"combobox",COMPLEMENTARY:"complementary",CONTENTINFO:"contentinfo",DEFINITION:"definition",DIALOG:"dialog",DIRECTORY:"directory",DOCUMENT:"document",FORM:"form",GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",HEADING:"heading",IMG:"img",LINK:"link",LIST:"list",LISTBOX:"listbox",LISTITEM:"listitem",LOG:"log",
MAIN:"main",MARQUEE:"marquee",MATH:"math",MENU:"menu",MENUBAR:"menubar",MENUITEM:"menuitem",MENUITEMCHECKBOX:"menuitemcheckbox",MENUITEMRADIO:"menuitemradio",NAVIGATION:"navigation",NOTE:"note",OPTION:"option",PRESENTATION:"presentation",PROGRESSBAR:"progressbar",RADIO:"radio",RADIOGROUP:"radiogroup",REGION:"region",ROW:"row",ROWGROUP:"rowgroup",ROWHEADER:"rowheader",SCROLLBAR:"scrollbar",SEARCH:"search",SEPARATOR:"separator",SLIDER:"slider",SPINBUTTON:"spinbutton",STATUS:"status",TAB:"tab",TABLIST:"tablist",
TABPANEL:"tabpanel",TEXTBOX:"textbox",TEXTINFO:"textinfo",TIMER:"timer",TOOLBAR:"toolbar",TOOLTIP:"tooltip",TREE:"tree",TREEGRID:"treegrid",TREEITEM:"treeitem"};
Blockly.utils.aria.State={ACTIVEDESCENDANT:"activedescendant",ATOMIC:"atomic",AUTOCOMPLETE:"autocomplete",BUSY:"busy",CHECKED:"checked",COLINDEX:"colindex",CONTROLS:"controls",DESCRIBEDBY:"describedby",DISABLED:"disabled",DROPEFFECT:"dropeffect",EXPANDED:"expanded",FLOWTO:"flowto",GRABBED:"grabbed",HASPOPUP:"haspopup",HIDDEN:"hidden",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",LIVE:"live",MULTILINE:"multiline",MULTISELECTABLE:"multiselectable",ORIENTATION:"orientation",OWNS:"owns",
POSINSET:"posinset",PRESSED:"pressed",READONLY:"readonly",RELEVANT:"relevant",REQUIRED:"required",ROWINDEX:"rowindex",SELECTED:"selected",SETSIZE:"setsize",SORT:"sort",VALUEMAX:"valuemax",VALUEMIN:"valuemin",VALUENOW:"valuenow",VALUETEXT:"valuetext"};Blockly.utils.aria.setRole=function(a,b){b?a.setAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_,b):Blockly.utils.aria.removeRole(a)};Blockly.utils.aria.getRole=function(a){return a.getAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_)||null};
Blockly.utils.aria.removeRole=function(a){a.removeAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_)};Blockly.utils.aria.setState=function(a,b,c){Array.isArray(c)&&(c=c.join(" "));b=Blockly.utils.aria.getAriaAttributeName_(b);a.setAttribute(b,c)};Blockly.utils.aria.getAriaAttributeName_=function(a){return Blockly.utils.aria.ARIA_PREFIX_+a};Blockly.tree={};Blockly.tree.BaseNode=function(a,b){Blockly.Component.call(this);this.config_=b;this.content_=a;this.expanded_=this.selected_=!1;this.toolTip_=null;this.isUserCollapsible_=!0;this.depth_=-1};goog.inherits(Blockly.tree.BaseNode,Blockly.Component);Blockly.tree.BaseNode.allNodes={};Blockly.tree.BaseNode.prototype.disposeInternal=function(){Blockly.tree.BaseNode.superClass_.disposeInternal.call(this);this.tree&&(this.tree=null);this.setElementInternal(null)};
Blockly.Component.prototype.removeChildAt=function(a,b){return this.removeChild(this.getChildAt(a),b)};Blockly.Component.prototype.removeChildren=function(a){for(var b=[];this.hasChildren();)b.push(this.removeChildAt(0,a));return b};Blockly.tree={};Blockly.tree.BaseNode=function(a,b){Blockly.Component.call(this);this.config_=b;this.content_=a;this.expanded_=this.selected_=!1;this.toolTip_=null;this.isUserCollapsible_=!0;this.depth_=-1};goog.inherits(Blockly.tree.BaseNode,Blockly.Component);Blockly.tree.BaseNode.allNodes={};Blockly.tree.BaseNode.prototype.disposeInternal=function(){Blockly.tree.BaseNode.superClass_.disposeInternal.call(this);this.tree&&(this.tree=null);this.setElementInternal(null)};
Blockly.tree.BaseNode.prototype.initAccessibility=function(){var a=this.getElement();if(a){var b=this.getLabelElement();b&&!b.id&&(b.id=this.getId()+".label");Blockly.utils.aria.setRole(a,Blockly.utils.aria.Role.TREEITEM);Blockly.utils.aria.setState(a,Blockly.utils.aria.State.SELECTED,!1);Blockly.utils.aria.setState(a,Blockly.utils.aria.State.LEVEL,this.getDepth());b&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.LABELLEDBY,b.id);(b=this.getIconElement())&&Blockly.utils.aria.setRole(b,Blockly.utils.aria.Role.PRESENTATION);
(b=this.getExpandIconElement())&&Blockly.utils.aria.setRole(b,Blockly.utils.aria.Role.PRESENTATION);if(b=this.getChildrenElement())if(Blockly.utils.aria.setRole(b,Blockly.utils.aria.Role.GROUP),b.hasChildNodes())for(Blockly.utils.aria.setState(a,Blockly.utils.aria.State.EXPANDED,!1),a=this.getChildCount(),b=1;b<=a;b++){var c=this.getChildAt(b-1).getElement();Blockly.utils.aria.setState(c,Blockly.utils.aria.State.SETSIZE,a);Blockly.utils.aria.setState(c,Blockly.utils.aria.State.POSINSET,b)}}};
Blockly.tree.BaseNode.prototype.createDom=function(){var a=document.createElement("div");a.appendChild(this.toDom());this.setElementInternal(a)};Blockly.tree.BaseNode.prototype.enterDocument=function(){Blockly.tree.BaseNode.superClass_.enterDocument.call(this);Blockly.tree.BaseNode.allNodes[this.getId()]=this;this.initAccessibility()};Blockly.tree.BaseNode.prototype.exitDocument=function(){Blockly.tree.BaseNode.superClass_.exitDocument.call(this);delete Blockly.tree.BaseNode.allNodes[this.getId()]};
@@ -1886,11 +1888,11 @@ c=Blockly.Scrollbar.scrollbarThickness;b.hasTrashcan&&(c=a.trashcan.init(c));b.z
Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.bindEventWithChecks_(document,"scroll",null,function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)c.updateInverseScreenCTM&&c.updateInverseScreenCTM()}),Blockly.bindEventWithChecks_(document,"keydown",null,Blockly.onKeyDown_),Blockly.bindEvent_(document,"touchend",null,Blockly.longStop_),Blockly.bindEvent_(document,"touchcancel",null,Blockly.longStop_),Blockly.utils.userAgent.IPAD&&Blockly.bindEventWithChecks_(window,
"orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())}));Blockly.documentEventsBound_=!0};
Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");c.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[],e=function(){for(;d.length;)Blockly.unbindEvent_(d.pop());c.preload()};d.push(Blockly.bindEventWithChecks_(document,"mousemove",null,e,!0));d.push(Blockly.bindEventWithChecks_(document,"touchstart",null,e,!0))};
Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.VERSION="2.20190722.0-develop";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.cursor=null;Blockly.keyboardAccessibilityMode=!1;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.theme_=null;Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.VERSION="uncompiled";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.cursor=null;Blockly.keyboardAccessibilityMode=!1;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.theme_=null;Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=b.parentNode;if(c){var d=c.offsetWidth;c=c.offsetHeight;b.cachedWidth_!=d&&(b.setAttribute("width",d+"px"),b.cachedWidth_=d);b.cachedHeight_!=c&&(b.setAttribute("height",c+"px"),b.cachedHeight_=c);a.resize()}};
Blockly.onKeyDown_=function(a){var b=Blockly.mainWorkspace;if(!(b.options.readOnly||Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible())){var c=!1;if(27==a.keyCode)Blockly.hideChaff(),Blockly.navigation.onBlocklyAction(Blockly.navigation.ACTION_EXIT);else{if(Blockly.keyboardAccessibilityMode&&Blockly.navigation.onKeyPress(a))return;if(8==a.keyCode||46==a.keyCode){a.preventDefault();if(Blockly.Gesture.inProgress())return;Blockly.selected&&Blockly.selected.isDeletable()&&(c=!0)}else if(a.altKey||
a.ctrlKey||a.metaKey){if(Blockly.Gesture.inProgress())return;Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&(67==a.keyCode?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):88!=a.keyCode||Blockly.selected.workspace.isFlyout||(Blockly.copy_(Blockly.selected),c=!0));86==a.keyCode?Blockly.clipboardXml_&&(a=Blockly.clipboardSource_,a.isFlyout&&(a=a.targetWorkspace),Blockly.clipboardTypeCounts_&&a.isCapacityAvailable(Blockly.clipboardTypeCounts_)&&(Blockly.Events.setGroup(!0),
a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1))):90==a.keyCode&&(Blockly.hideChaff(),b.undo(a.shiftKey))}}c&&!Blockly.selected.workspace.isFlyout&&(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(!0,!0),Blockly.Events.setGroup(!1))}};
Blockly.onKeyDown_=function(a){var b=Blockly.mainWorkspace;if(!(b.options.readOnly||Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible())){var c=!1;if(a.keyCode==Blockly.utils.KeyCodes.ESC)Blockly.hideChaff(),Blockly.navigation.onBlocklyAction(Blockly.navigation.ACTION_EXIT);else{if(Blockly.keyboardAccessibilityMode&&Blockly.navigation.onKeyPress(a))return;if(a.keyCode==Blockly.utils.KeyCodes.BACKSPACE||a.keyCode==Blockly.utils.KeyCodes.DELETE){a.preventDefault();if(Blockly.Gesture.inProgress())return;
Blockly.selected&&Blockly.selected.isDeletable()&&(c=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(Blockly.Gesture.inProgress())return;Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&(a.keyCode==Blockly.utils.KeyCodes.C?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):a.keyCode!=Blockly.utils.KeyCodes.X||Blockly.selected.workspace.isFlyout||(Blockly.copy_(Blockly.selected),c=!0));a.keyCode==Blockly.utils.KeyCodes.V?Blockly.clipboardXml_&&(a=Blockly.clipboardSource_,
a.isFlyout&&(a=a.targetWorkspace),Blockly.clipboardTypeCounts_&&a.isCapacityAvailable(Blockly.clipboardTypeCounts_)&&(Blockly.Events.setGroup(!0),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1))):a.keyCode==Blockly.utils.KeyCodes.Z&&(Blockly.hideChaff(),b.undo(a.shiftKey))}}c&&!Blockly.selected.workspace.isFlyout&&(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(!0,!0),Blockly.Events.setGroup(!1))}};
Blockly.copy_=function(a){if(a.isComment)var b=a.toXmlWithXY();else{b=Blockly.Xml.blockToDom(a,!0);Blockly.Xml.deleteNext(b);var c=a.getRelativeToSurfaceXY();b.setAttribute("x",a.RTL?-c.x:c.x);b.setAttribute("y",c.y)}Blockly.clipboardXml_=b;Blockly.clipboardSource_=a.workspace;Blockly.clipboardTypeCounts_=a.isComment?null:Blockly.utils.getBlockTypeCounts(a,!0)};
Blockly.duplicate_=function(a){var b=Blockly.clipboardXml_,c=Blockly.clipboardSource_;Blockly.copy_(a);a.workspace.paste(Blockly.clipboardXml_);Blockly.clipboardXml_=b;Blockly.clipboardSource_=c};Blockly.onContextMenu_=function(a){Blockly.utils.isTargetInput(a)||a.preventDefault()};
Blockly.hideChaff=function(a){Blockly.Tooltip.hide();Blockly.WidgetDiv.hide();Blockly.DropDownDiv.hideWithoutAnimation();var b=Blockly.getMainWorkspace();b.trashcan&&b.trashcan.flyout_&&b.trashcan.flyout_.hide();a||b.toolbox_&&b.toolbox_.flyout_&&b.toolbox_.flyout_.autoClose&&b.toolbox_.clearSelection()};Blockly.addChangeListener=function(a){console.warn("Deprecated call to Blockly.addChangeListener, use workspace.addChangeListener instead.");return Blockly.getMainWorkspace().addChangeListener(a)};

File diff suppressed because one or more lines are too long