Fix enable accessibility (#2968)

* Enables accessibility mode should make the cursor visible
This commit is contained in:
alschmiedt
2019-09-05 14:05:52 -07:00
committed by GitHub
parent 43944f7151
commit e8f328aa28
8 changed files with 316 additions and 271 deletions

View File

@@ -114,7 +114,7 @@ Blockly.utils.dom.createSvgElement=function(a,b,c){a=document.createElementNS(Bl
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.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.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.hide=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_=[];
@@ -280,7 +280,173 @@ Blockly.Connection.prototype.targetBlock=function(){return this.isConnected()?th
Blockly.Connection.prototype.setCheck=function(a){a?(Array.isArray(a)||(a=[a]),this.check_=a,this.onCheckChanged_()):this.check_=null;return this};Blockly.Connection.prototype.getCheck=function(){return this.check_};Blockly.Connection.prototype.setShadowDom=function(a){this.shadowDom_=a};Blockly.Connection.prototype.getShadowDom=function(){return this.shadowDom_};Blockly.Connection.prototype.neighbours_=function(a){return[]};
Blockly.Connection.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;d<b.inputList.length;d++)if(c[d].connection===this){a=c[d];break}return a};
Blockly.Connection.prototype.toString=function(){var a=this.sourceBlock_;if(a)if(a.outputConnection==this)var b="Output Connection of ";else if(a.previousConnection==this)b="Previous Connection of ";else if(a.nextConnection==this)b="Next Connection of ";else{b=null;for(var c=0,d;d=a.inputList[c];c++)if(d.connection==this){b=d;break}if(b)b='Input "'+b.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}else return"Orphan Connection";
return b+a.toDevString()};Blockly.ConnectionDB=function(){this.connections_=[]};Blockly.ConnectionDB.prototype.addConnection=function(a){if(a.inDB_)throw Error("Connection already in database.");if(!a.getSourceBlock().isInFlyout){var b=this.findPositionForConnection_(a);this.connections_.splice(b,0,a);a.inDB_=!0}};
return b+a.toDevString()};Blockly.blockRendering={};Blockly.blockRendering.Types={NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608};
Blockly.blockRendering.Types.LEFT_CORNER=Blockly.blockRendering.Types.LEFT_SQUARE_CORNER|Blockly.blockRendering.Types.LEFT_ROUND_CORNER;Blockly.blockRendering.Types.RIGHT_CORNER=Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER|Blockly.blockRendering.Types.RIGHT_ROUND_CORNER;Blockly.blockRendering.Types.nextTypeValue_=16777216;
Blockly.blockRendering.Types.getType=function(a){Blockly.blockRendering.Types.hasOwnProperty(a)||(Blockly.blockRendering.Types[a]=Blockly.blockRendering.Types.nextTypeValue_,Blockly.blockRendering.Types.nextTypeValue_<<=1);return Blockly.blockRendering.Types[a]};Blockly.blockRendering.Types.isField=function(a){return a.type&Blockly.blockRendering.Types.FIELD};Blockly.blockRendering.Types.isHat=function(a){return a.type&Blockly.blockRendering.Types.HAT};
Blockly.blockRendering.Types.isIcon=function(a){return a.type&Blockly.blockRendering.Types.ICON};Blockly.blockRendering.Types.isSpacer=function(a){return a.type&Blockly.blockRendering.Types.SPACER};Blockly.blockRendering.Types.isInRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.IN_ROW_SPACER};Blockly.blockRendering.Types.isInput=function(a){return a.type&Blockly.blockRendering.Types.INPUT};Blockly.blockRendering.Types.isExternalInput=function(a){return a.type&Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT};
Blockly.blockRendering.Types.isInlineInput=function(a){return a.type&Blockly.blockRendering.Types.INLINE_INPUT};Blockly.blockRendering.Types.isStatementInput=function(a){return a.type&Blockly.blockRendering.Types.STATEMENT_INPUT};Blockly.blockRendering.Types.isPreviousConnection=function(a){return a.type&Blockly.blockRendering.Types.PREVIOUS_CONNECTION};Blockly.blockRendering.Types.isNextConnection=function(a){return a.type&Blockly.blockRendering.Types.NEXT_CONNECTION};
Blockly.blockRendering.Types.isPreviousOrNextConnection=function(a){return a.type&(Blockly.blockRendering.Types.PREVIOUS_CONNECTION|Blockly.blockRendering.Types.NEXT_CONNECTION)};Blockly.blockRendering.Types.isLeftRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_ROUND_CORNER};Blockly.blockRendering.Types.isRightRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_ROUND_CORNER};
Blockly.blockRendering.Types.isLeftSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_SQUARE_CORNER};Blockly.blockRendering.Types.isRightSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER};Blockly.blockRendering.Types.isCorner=function(a){return a.type&Blockly.blockRendering.Types.CORNER};Blockly.blockRendering.Types.isJaggedEdge=function(a){return a.type&Blockly.blockRendering.Types.JAGGED_EDGE};
Blockly.blockRendering.Types.isRow=function(a){return a.type&Blockly.blockRendering.Types.ROW};Blockly.blockRendering.Types.isBetweenRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.BETWEEN_ROW_SPACER};Blockly.blockRendering.Types.isTopRow=function(a){return a.type&Blockly.blockRendering.Types.TOP_ROW};Blockly.blockRendering.Types.isBottomRow=function(a){return a.type&Blockly.blockRendering.Types.BOTTOM_ROW};
Blockly.blockRendering.Types.isTopOrBottomRow=function(a){return a.type&(Blockly.blockRendering.Types.TOP_ROW|Blockly.blockRendering.Types.BOTTOM_ROW)};Blockly.blockRendering.Types.isInputRow=function(a){return a.type&Blockly.blockRendering.Types.INPUT_ROW};Blockly.blockRendering.Measurable=function(){this.height=this.width=0;this.type=Blockly.blockRendering.Types.NONE;this.centerline=this.xPos=0;this.constants_=Blockly.blockRendering.getConstants();this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT};Blockly.RenderedConnection=function(a,b){Blockly.RenderedConnection.superClass_.constructor.call(this,a,b);this.offsetInBlock_=new Blockly.utils.Coordinate(0,0)};goog.inherits(Blockly.RenderedConnection,Blockly.Connection);Blockly.RenderedConnection.prototype.distanceFrom=function(a){var b=this.x_-a.x_;a=this.y_-a.y_;return Math.sqrt(b*b+a*a)};
Blockly.RenderedConnection.prototype.bumpAwayFrom_=function(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();if(!b.isInFlyout){var c=!1;if(!b.isMovable()){b=a.getSourceBlock().getRootBlock();if(!b.isMovable())return;a=this;c=!0}var d=Blockly.selected==b;d||b.addSelect();var e=a.x_+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x_,f=a.y_+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.y_;c&&(f=-f);b.RTL&&
(e=a.x_-Blockly.SNAP_RADIUS-Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x_);b.moveBy(e,f);d||b.removeSelect()}}};Blockly.RenderedConnection.prototype.moveTo=function(a,b){this.inDB_&&this.db_.removeConnection_(this);this.x_=a;this.y_=b;this.hidden_||this.db_.addConnection(this)};Blockly.RenderedConnection.prototype.moveBy=function(a,b){this.moveTo(this.x_+a,this.y_+b)};Blockly.RenderedConnection.prototype.moveToOffset=function(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)};
Blockly.RenderedConnection.prototype.setOffsetInBlock=function(a,b){this.offsetInBlock_.x=a;this.offsetInBlock_.y=b};Blockly.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_};
Blockly.RenderedConnection.prototype.tighten_=function(){var a=this.targetConnection.x_-this.x_,b=this.targetConnection.y_-this.y_;if(0!=a||0!=b){var c=this.targetBlock(),d=c.getSvgRoot();if(!d)throw Error("block is not rendered.");d=Blockly.utils.getRelativeXY(d);c.getSvgRoot().setAttribute("transform","translate("+(d.x-a)+","+(d.y-b)+")");c.moveConnections_(-a,-b)}};Blockly.RenderedConnection.prototype.closest=function(a,b){return this.dbOpposite_.searchForClosest(this,a,b)};
Blockly.RenderedConnection.prototype.highlight=function(){var a=this.type==Blockly.INPUT_VALUE||this.type==Blockly.OUTPUT_VALUE?Blockly.utils.svgPaths.moveBy(0,-5)+Blockly.utils.svgPaths.lineOnAxis("v",5)+Blockly.blockRendering.constants.PUZZLE_TAB.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",5):Blockly.utils.svgPaths.moveBy(-5,0)+Blockly.utils.svgPaths.lineOnAxis("h",5)+Blockly.blockRendering.constants.NOTCH.pathLeft+Blockly.utils.svgPaths.lineOnAxis("h",5);var b=this.sourceBlock_.getRelativeToSurfaceXY();
Blockly.Connection.highlightedPath_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyHighlightedConnectionPath",d:a,transform:"translate("+(this.x_-b.x)+","+(this.y_-b.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())};
Blockly.RenderedConnection.prototype.unhideAll=function(){this.setHidden(!1);var a=[];if(this.type!=Blockly.INPUT_VALUE&&this.type!=Blockly.NEXT_STATEMENT)return a;var b=this.targetBlock();if(b){if(b.isCollapsed()){var c=[];b.outputConnection&&c.push(b.outputConnection);b.nextConnection&&c.push(b.nextConnection);b.previousConnection&&c.push(b.previousConnection)}else c=b.getConnections_(!0);for(var d=0;d<c.length;d++)a.push.apply(a,c[d].unhideAll());a.length||(a[0]=b)}return a};
Blockly.RenderedConnection.prototype.unhighlight=function(){Blockly.utils.dom.removeNode(Blockly.Connection.highlightedPath_);delete Blockly.Connection.highlightedPath_};Blockly.RenderedConnection.prototype.setHidden=function(a){(this.hidden_=a)&&this.inDB_?this.db_.removeConnection_(this):a||this.inDB_||this.db_.addConnection(this)};
Blockly.RenderedConnection.prototype.hideAll=function(){this.setHidden(!0);if(this.targetConnection)for(var a=this.targetBlock().getDescendants(!1),b=0;b<a.length;b++){for(var c=a[b],d=c.getConnections_(!0),e=0;e<d.length;e++)d[e].setHidden(!0);c=c.getIcons();for(e=0;e<c.length;e++)c[e].setVisible(!1)}};Blockly.RenderedConnection.prototype.isConnectionAllowed=function(a,b){return this.distanceFrom(a)>b?!1:Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,a)};
Blockly.RenderedConnection.prototype.disconnectInternal_=function(a,b){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render())};
Blockly.RenderedConnection.prototype.respawnShadow_=function(){var a=this.getSourceBlock(),b=this.getShadowDom();if(a.workspace&&b&&Blockly.Events.recordUndo){Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);b=this.targetBlock();if(!b)throw Error("Couldn't respawn the shadow block that should exist here.");b.initSvg();b.render(!1);a.rendered&&a.render()}};Blockly.RenderedConnection.prototype.neighbours_=function(a){return this.dbOpposite_.getNeighbours(this,a)};
Blockly.RenderedConnection.prototype.connect_=function(a){Blockly.RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();b.rendered&&b.updateDisabled();a.rendered&&a.updateDisabled();b.rendered&&a.rendered&&(this.type==Blockly.NEXT_STATEMENT||this.type==Blockly.PREVIOUS_STATEMENT?a.render():b.render())};
Blockly.RenderedConnection.prototype.onCheckChanged_=function(){this.isConnected()&&!this.checkType_(this.targetConnection)&&((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours_())};Blockly.blockRendering.Connection=function(a){Blockly.blockRendering.Connection.superClass_.constructor.call(this);this.connectionModel=a;this.shape=this.constants_.shapeFor(a);this.type|=Blockly.blockRendering.Types.CONNECTION};goog.inherits(Blockly.blockRendering.Connection,Blockly.blockRendering.Measurable);
Blockly.blockRendering.OutputConnection=function(a){Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.OUTPUT_CONNECTION;this.height=this.shape.height;this.width=this.shape.width;this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.startX=this.width};goog.inherits(Blockly.blockRendering.OutputConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.PreviousConnection=function(a){Blockly.blockRendering.PreviousConnection.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.PREVIOUS_CONNECTION;this.height=this.shape.height;this.width=this.shape.width};goog.inherits(Blockly.blockRendering.PreviousConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.NextConnection=function(a){Blockly.blockRendering.NextConnection.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.NEXT_CONNECTION;this.height=this.shape.height;this.width=this.shape.width};goog.inherits(Blockly.blockRendering.NextConnection,Blockly.blockRendering.Connection);Blockly.blockRendering.InputConnection=function(a){Blockly.blockRendering.InputConnection.superClass_.constructor.call(this,a.connection);this.type|=Blockly.blockRendering.Types.INPUT;this.input=a;this.align=a.align;if(this.connectedBlock=a.connection&&a.connection.targetBlock()?a.connection.targetBlock():null){var b=this.connectedBlock.getHeightWidth();this.connectedBlockWidth=b.width;this.connectedBlockHeight=b.height}else this.connectedBlockHeight=this.connectedBlockWidth=0;this.connection=a.connection;
this.connectionOffsetY=this.connectionOffsetX=0};goog.inherits(Blockly.blockRendering.InputConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.InlineInput=function(a){Blockly.blockRendering.InlineInput.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.INLINE_INPUT;this.connectedBlock?(this.width=this.connectedBlockWidth+this.constants_.DARK_PATH_OFFSET,this.height=this.connectedBlockHeight+this.constants_.DARK_PATH_OFFSET):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.shape.width+this.constants_.EMPTY_INLINE_INPUT_PADDING);this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;
this.connectionHeight=this.shape.height;this.connectionWidth=this.shape.width};goog.inherits(Blockly.blockRendering.InlineInput,Blockly.blockRendering.InputConnection);
Blockly.blockRendering.StatementInput=function(a){Blockly.blockRendering.StatementInput.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.STATEMENT_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.DARK_PATH_OFFSET+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;this.width=this.constants_.NOTCH_OFFSET_LEFT+this.shape.width};goog.inherits(Blockly.blockRendering.StatementInput,Blockly.blockRendering.InputConnection);
Blockly.blockRendering.ExternalValueInput=function(a){Blockly.blockRendering.ExternalValueInput.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight-2*this.constants_.TAB_OFFSET_FROM_TOP:this.shape.height;this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING;this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.connectionHeight=this.shape.height;this.connectionWidth=
this.shape.width};goog.inherits(Blockly.blockRendering.ExternalValueInput,Blockly.blockRendering.InputConnection);Blockly.blockRendering.Icon=function(a){Blockly.blockRendering.Icon.superClass_.constructor.call(this);this.icon=a;this.isVisible=a.isVisible();this.type|=Blockly.blockRendering.Types.ICON;a=a.getCorrectedSize();this.height=a.height;this.width=a.width};goog.inherits(Blockly.blockRendering.Icon,Blockly.blockRendering.Measurable);
Blockly.blockRendering.JaggedEdge=function(){Blockly.blockRendering.JaggedEdge.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.JAGGED_EDGE;this.height=this.constants_.JAGGED_TEETH.height;this.width=this.constants_.JAGGED_TEETH.width};goog.inherits(Blockly.blockRendering.JaggedEdge,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Field=function(a,b){Blockly.blockRendering.Field.superClass_.constructor.call(this);this.field=a;this.isEditable=a.isCurrentlyEditable();this.flipRtl=a instanceof Blockly.FieldImage&&a.getFlipRtl();this.type|=Blockly.blockRendering.Types.FIELD;var c=this.field.getSize();this.height=c.height;this.width=c.width;this.parentInput=b};goog.inherits(Blockly.blockRendering.Field,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Hat=function(){Blockly.blockRendering.Hat.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.HAT;this.height=this.constants_.START_HAT.height;this.width=this.constants_.START_HAT.width;this.startY=this.height};goog.inherits(Blockly.blockRendering.Hat,Blockly.blockRendering.Measurable);
Blockly.blockRendering.SquareCorner=function(a){Blockly.blockRendering.SquareCorner.superClass_.constructor.call(this);this.type=(a&&"left"!=a?Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER:Blockly.blockRendering.Types.LEFT_SQUARE_CORNER)|Blockly.blockRendering.Types.CORNER;this.height=this.constants_.NOTCH.height;this.width=this.constants_.NO_PADDING};goog.inherits(Blockly.blockRendering.SquareCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.RoundCorner=function(a){Blockly.blockRendering.RoundCorner.superClass_.constructor.call(this);this.type=(a&&"left"!=a?Blockly.blockRendering.Types.RIGHT_ROUND_CORNER:Blockly.blockRendering.Types.LEFT_ROUND_CORNER)|Blockly.blockRendering.Types.CORNER;this.width=this.constants_.CORNER_RADIUS;this.height=this.constants_.NOTCH.height};goog.inherits(Blockly.blockRendering.RoundCorner,Blockly.blockRendering.Measurable);
Blockly.blockRendering.InRowSpacer=function(a){Blockly.blockRendering.InRowSpacer.superClass_.constructor.call(this);this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.IN_ROW_SPACER;this.width=a;this.height=this.constants_.SPACER_DEFAULT_HEIGHT};goog.inherits(Blockly.blockRendering.InRowSpacer,Blockly.blockRendering.Measurable);Blockly.blockRendering.Row=function(){this.type=Blockly.blockRendering.Types.ROW;this.elements=[];this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0;this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1;this.constants_=Blockly.blockRendering.getConstants();this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT};
Blockly.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};Blockly.blockRendering.Row.prototype.getLastInput=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isInput(b))return b;return null};Blockly.blockRendering.Row.prototype.getFirstSpacer=function(){for(var a=0,b;b=this.elements[a];a++)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null};
Blockly.blockRendering.Row.prototype.getLastSpacer=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null};Blockly.blockRendering.TopRow=function(){Blockly.blockRendering.TopRow.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.TOP_ROW;this.startY=0;this.hasPreviousConnection=!1;this.connection=null};goog.inherits(Blockly.blockRendering.TopRow,Blockly.blockRendering.Row);
Blockly.blockRendering.TopRow.prototype.populate=function(a){var b=a.hat?"cap"===a.hat:Blockly.BlockSvg.START_HAT,c=!!a.previousConnection;this.hasLeftSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner):this.elements.push(new Blockly.blockRendering.RoundCorner);b?(b=new Blockly.blockRendering.Hat,this.elements.push(b),this.startY=b.startY):c&&(this.hasPreviousConnection=!0,this.connection=new Blockly.blockRendering.PreviousConnection(a.previousConnection),this.elements.push(this.connection));
a.inputList.length&&a.inputList[0].type==Blockly.NEXT_STATEMENT&&!a.isCollapsed()?this.minHeight=this.constants_.LARGE_PADDING:this.minHeight=this.constants_.MEDIUM_PADDING};Blockly.blockRendering.TopRow.prototype.hasLeftSquareCorner=function(a){var b=a.hat?"cap"===a.hat:Blockly.BlockSvg.START_HAT,c=a.getPreviousBlock();return!!a.outputConnection||b||c&&c.getNextBlock()==a};
Blockly.blockRendering.TopRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b;b=this.elements[a];a++)this.width+=b.width,Blockly.blockRendering.Types.isSpacer(b)||(Blockly.blockRendering.Types.isHat(b)&&(this.startY=b.startY,this.height+=b.height),this.height=Math.max(this.height,b.height));this.widthWithConnectedBlocks=this.width};
Blockly.blockRendering.BottomRow=function(){Blockly.blockRendering.BottomRow.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.BOTTOM_ROW;this.hasNextConnection=!1;this.connection=null;this.overhangY=0};goog.inherits(Blockly.blockRendering.BottomRow,Blockly.blockRendering.Row);
Blockly.blockRendering.BottomRow.prototype.populate=function(a){this.hasNextConnection=!!a.nextConnection;this.minHeight=a.inputList.length&&a.inputList[a.inputList.length-1].type==Blockly.NEXT_STATEMENT?this.constants_.LARGE_PADDING:this.constants_.NOTCH.height;this.hasLeftSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner):this.elements.push(new Blockly.blockRendering.RoundCorner);this.hasNextConnection&&(this.connection=new Blockly.blockRendering.NextConnection(a.nextConnection),
this.elements.push(this.connection))};Blockly.blockRendering.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection||!!a.getNextBlock()};
Blockly.blockRendering.BottomRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b;b=this.elements[a];a++)this.width+=b.width,Blockly.blockRendering.Types.isSpacer(b)||(Blockly.blockRendering.Types.isNextConnection(b)&&(this.height+=b.height,this.overhangY=b.height),this.height=Math.max(this.height,b.height));this.widthWithConnectedBlocks=this.width};
Blockly.blockRendering.SpacerRow=function(a,b){this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.BETWEEN_ROW_SPACER;this.width=b;this.height=a;this.followsStatement=!1;this.widthWithConnectedBlocks=0;this.elements=[new Blockly.blockRendering.InRowSpacer(b)]};goog.inherits(Blockly.blockRendering.SpacerRow,Blockly.blockRendering.Row);Blockly.blockRendering.SpacerRow.prototype.measure=function(){};
Blockly.blockRendering.InputRow=function(){Blockly.blockRendering.InputRow.superClass_.constructor.call(this);this.type|=Blockly.blockRendering.Types.INPUT_ROW;this.connectedBlockWidths=0};goog.inherits(Blockly.blockRendering.InputRow,Blockly.blockRendering.Row);
Blockly.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b=0,c;c=this.elements[b];b++)this.width+=c.width,Blockly.blockRendering.Types.isInput(c)&&(Blockly.blockRendering.Types.isStatementInput(c)?a+=c.connectedBlockWidth:Blockly.blockRendering.Types.isExternalInput(c)&&0!=c.connectedBlockWidth&&(a+=c.connectedBlockWidth-c.connectionWidth)),Blockly.blockRendering.Types.isSpacer(c)||(this.height=Math.max(this.height,c.height));this.connectedBlockWidths=
a;this.widthWithConnectedBlocks=this.width+a};Blockly.blockRendering.InputRow.prototype.getLastSpacer=function(){if(this.hasExternalInput||this.hasStatement)for(var a=this.elements,b=a.length-1,c;c=a[b];b--)if(!Blockly.blockRendering.Types.isSpacer(c)&&Blockly.blockRendering.Types.isInput(c))return a[b-1];return Blockly.blockRendering.InputRow.superClass_.getLastSpacer.call(this)};Blockly.blockRendering.RenderInfo=function(a){this.block_=a;this.outputConnection=a.outputConnection?new Blockly.blockRendering.OutputConnection(a.outputConnection):null;this.isInline=a.getInputsInline()&&!a.isCollapsed();this.isCollapsed=a.isCollapsed();this.isInsertionMarker=a.isInsertionMarker();this.RTL=a.RTL;this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.hiddenIcons=[];this.topRow=new Blockly.blockRendering.TopRow;this.bottomRow=new Blockly.blockRendering.BottomRow;
this.startY=this.startX=0;this.constants_=Blockly.blockRendering.getConstants()};Blockly.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_();this.addElemSpacing_();this.computeBounds_();this.alignRowElements_();this.addRowSpacing_();this.finalize_()};
Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.topRow.populate(this.block_);this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow,b=this.block_.getIcons();if(b.length)for(var c=0,d;d=b[c];c++){var e=new Blockly.blockRendering.Icon(d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}d=void 0;for(c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){this.shouldStartNewRow_(b,d)&&(this.rows.push(a),a=new Blockly.blockRendering.InputRow);
for(d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(e,b));this.addInput_(b,a);d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge));a.elements.length&&this.rows.push(a);this.bottomRow.populate(this.block_);this.rows.push(this.bottomRow)};
Blockly.blockRendering.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.InlineInput(a)),b.hasInlineInput=!0):a.type==Blockly.NEXT_STATEMENT?(b.elements.push(new Blockly.blockRendering.StatementInput(a)),b.hasStatement=!0):a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(a)),b.hasExternalInput=!0):a.type==Blockly.DUMMY_INPUT&&(b.hasDummyInput=!0)};
Blockly.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var a=0,b;b=this.rows[a];a++){var c=b.elements;b.elements=[];Blockly.blockRendering.Types.isTopRow(b)||Blockly.blockRendering.Types.isBottomRow(b)||b.elements.push(new Blockly.blockRendering.InRowSpacer(this.getInRowSpacing_(null,c[0])));for(var d=0;d<c.length;d++){b.elements.push(c[d]);var e=this.getInRowSpacing_(c[d],c[d+1]);b.elements.push(new Blockly.blockRendering.InRowSpacer(e))}}};
Blockly.blockRendering.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(a&&Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}return this.constants_.MEDIUM_PADDING};
Blockly.blockRendering.RenderInfo.prototype.computeBounds_=function(){for(var a=0,b=0,c=0,d=0,e;e=this.rows[d];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;e=this.rows[d];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,b;b=this.rows[a];a++)if(!b.hasInlineInput)if(b.hasStatement)this.alignStatementRow_(b);else{var c=this.width-this.startX-b.width;c&&this.addAlignmentPadding_(b,c)}};Blockly.blockRendering.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.getLastSpacer();c&&(c.width+=b,a.width+=b)};
Blockly.blockRendering.RenderInfo.prototype.alignStatementRow_=function(a){var b=a.getLastInput(),c=a.width-b.width,d=this.statementEdge-this.startX;(c=d-c)&&this.addAlignmentPadding_(a,c);c=a.width;d=this.width-this.startX;b.width+=d-c;a.width+=d-c;a.widthWithConnectedBlocks=Math.max(a.width,this.statementEdge+a.connectedBlockWidths)};
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.SpacerRow(c,d);a.hasStatement&&(c.followsStatement=!0);return c};
Blockly.blockRendering.RenderInfo.prototype.getSpacerRowWidth_=function(a,b){return this.width-this.startX};Blockly.blockRendering.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return this.constants_.MEDIUM_PADDING};Blockly.blockRendering.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;return c=Blockly.blockRendering.Types.isNextConnection(b)?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,d;d=this.rows[c];c++){d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);for(var e=d.xPos,f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.startY};Blockly.blockRendering.Debug=function(){this.debugElements_=[];this.svgRoot_=null;this.config_=Blockly.blockRendering.Debug.getDebugConfig()};Blockly.blockRendering.Debug.getDebugConfig=function(){return{elems:!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,stroke:"blue",fill:"blue","fill-opacity":"0.5","stroke-width":"1px"},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,stroke:"pink",fill:"pink","fill-opacity":"0.5","stroke-width":"1px"},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,stroke:"black",fill:"none","stroke-width":"1px"},this.svgRoot_))}Blockly.blockRendering.Types.isInput(a)&&this.config_.connections&&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,stroke:"red",fill:"none","stroke-width":"1px"},this.svgRoot_)),Blockly.blockRendering.Types.isTopOrBottomRow(a)||this.config_.connectedBlockBounds&&this.debugElements_.push(Blockly.utils.dom.createSvgElement("rect",{"class":"connectedBlockWidth 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,e;e=a.elements[d];d++)Blockly.blockRendering.Types.isSpacer(e)?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,stroke:"black",fill:"none","stroke-width":"1px","stroke-dasharray":"5,5"},this.svgRoot_));this.config_.connectedBlockBounds&&(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.clearElems();this.svgRoot_=a.getSvgRoot();this.randomColour_="#"+Math.floor(16777215*Math.random()).toString(16);for(var c=0,d=0,e;e=b.rows[d];d++)Blockly.blockRendering.Types.isBetweenRowSpacer(e)?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.constants_=Blockly.blockRendering.getConstants()};
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_);Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()};
Blockly.blockRendering.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height+this.constants_.DARK_PATH_OFFSET;this.block_.width=this.info_.widthWithChildren+this.constants_.DARK_PATH_OFFSET};Blockly.blockRendering.Drawer.prototype.hideHiddenIcons_=function(){for(var a=0,b;b=this.info_.hiddenIcons[a];a++)b.icon.iconGroup_.setAttribute("display","none")};
Blockly.blockRendering.Drawer.prototype.drawOutline_=function(){this.drawTop_();for(var a=1;a<this.info_.rows.length-2;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_()};
Blockly.blockRendering.Drawer.prototype.drawTop_=function(){var a=this.info_.topRow,b=a.elements;this.positionPreviousConnection_();this.outlinePath_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var c=0,d;d=b[c];c++)Blockly.blockRendering.Types.isLeftRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:Blockly.blockRendering.Types.isPreviousConnection(d)?this.outlinePath_+=d.shape.pathLeft:Blockly.blockRendering.Types.isHat(d)?this.outlinePath_+=this.constants_.START_HAT.path:
Blockly.blockRendering.Types.isSpacer(d)&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",d.width));this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height)};Blockly.blockRendering.Drawer.prototype.drawJaggedEdge_=function(a){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.constants_.JAGGED_TEETH.height)};
Blockly.blockRendering.Drawer.prototype.drawValueInput_=function(a){var b=a.getLastInput();this.positionExternalValueConnection_(a);this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",b.xPos+b.width)+b.shape.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",a.height-b.connectionHeight)};
Blockly.blockRendering.Drawer.prototype.drawStatementInput_=function(a){var b=a.getLastInput(),c=b.xPos+b.notchOffset+b.shape.width;b=b.shape.pathRight+Blockly.utils.svgPaths.lineOnAxis("h",-(b.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var d=a.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",c)+b+Blockly.utils.svgPaths.lineOnAxis("v",d)+this.constants_.INSIDE_CORNERS.pathBottom+Blockly.utils.svgPaths.lineOnAxis("H",
a.xPos+a.width);this.positionStatementInputConnection_(a)};Blockly.blockRendering.Drawer.prototype.drawRightSideRow_=function(a){this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height)};
Blockly.blockRendering.Drawer.prototype.drawBottom_=function(){var a=this.info_.bottomRow,b=a.elements;this.positionNextConnection_();this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height-a.overhangY);for(var c=b.length-1,d;d=b[c];c--)Blockly.blockRendering.Types.isNextConnection(d)?this.outlinePath_+=d.shape.pathRight:Blockly.blockRendering.Types.isLeftSquareCorner(d)?this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos):Blockly.blockRendering.Types.isLeftRoundedCorner(d)?
this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.bottomLeft:Blockly.blockRendering.Types.isSpacer(d)&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",-1*d.width))};Blockly.blockRendering.Drawer.prototype.drawLeft_=function(){var a=this.info_.outputConnection;this.positionOutputConnection_();a&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("V",a.connectionOffsetY+a.height)+a.shape.pathUp);this.outlinePath_+="z"};
Blockly.blockRendering.Drawer.prototype.drawInternals_=function(){for(var a=0,b;b=this.info_.rows[a];a++)for(var c=0,d;d=b.elements[c];c++)Blockly.blockRendering.Types.isInlineInput(d)?this.drawInlineInput_(d):(Blockly.blockRendering.Types.isIcon(d)||Blockly.blockRendering.Types.isField(d))&&this.layoutField_(d)};
Blockly.blockRendering.Drawer.prototype.layoutField_=function(a){if(Blockly.blockRendering.Types.isField(a))var b=a.field.getSvgRoot();else Blockly.blockRendering.Types.isIcon(a)&&(b=a.icon.iconGroup_);var c=a.centerline-a.height/2,d=a.xPos,e="";this.info_.RTL&&(d=-(d+a.width),a.flipRtl&&(d+=a.width,e="scale(-1 1)"));Blockly.blockRendering.Types.isIcon(a)?(b.setAttribute("display","block"),b.setAttribute("transform","translate("+d+","+c+")"),a.icon.computeIconLocation()):b.setAttribute("transform",
"translate("+d+","+c+")"+e);this.info_.isInsertionMarker&&b.setAttribute("display","none")};
Blockly.blockRendering.Drawer.prototype.drawInlineInput_=function(a){var b=a.width,c=a.height,d=a.connectionOffsetY,e=a.connectionHeight+d;this.inlinePath_+=Blockly.utils.svgPaths.moveTo(a.xPos+a.connectionWidth,a.centerline-c/2)+Blockly.utils.svgPaths.lineOnAxis("v",d)+a.shape.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",c-e)+Blockly.utils.svgPaths.lineOnAxis("h",b-a.connectionWidth)+Blockly.utils.svgPaths.lineOnAxis("v",-c)+"z";this.positionInlineInputConnection_(a)};
Blockly.blockRendering.Drawer.prototype.positionInlineInputConnection_=function(a){var b=a.centerline-a.height/2;if(a.connection){var c=a.xPos+a.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);a.connection.setOffsetInBlock(c,b+a.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}};
Blockly.blockRendering.Drawer.prototype.positionStatementInputConnection_=function(a){var b=a.getLastInput();if(b.connection){var c=a.xPos+a.statementEdge+b.notchOffset;c=this.info_.RTL?-1*c:c+this.constants_.DARK_PATH_OFFSET;b.connection.setOffsetInBlock(c,a.yPos+this.constants_.DARK_PATH_OFFSET)}};
Blockly.blockRendering.Drawer.prototype.positionExternalValueConnection_=function(a){var b=a.getLastInput();if(b.connection){var c=a.xPos+a.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);b.connection.setOffsetInBlock(c,a.yPos)}};Blockly.blockRendering.Drawer.prototype.positionPreviousConnection_=function(){var a=this.info_.topRow;if(a.connection){var b=a.xPos+a.notchOffset;a.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-b:b,0)}};
Blockly.blockRendering.Drawer.prototype.positionNextConnection_=function(){var a=this.info_.bottomRow;if(a.connection){a=a.connection;var b=a.xPos;a.connectionModel.setOffsetInBlock((this.info_.RTL?-b:b)+this.constants_.DARK_PATH_OFFSET/2,a.centerline-a.height/2+this.constants_.DARK_PATH_OFFSET)}};Blockly.blockRendering.Drawer.prototype.positionOutputConnection_=function(){if(this.info_.outputConnection){var a=this.info_.startX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-a:a,this.info_.outputConnection.connectionOffsetY)}};Blockly.utils.svgPaths={};Blockly.utils.svgPaths.point=function(a,b){return" "+a+","+b+" "};Blockly.utils.svgPaths.curve=function(a,b){return" "+a+b.join("")};Blockly.utils.svgPaths.moveTo=function(a,b){return" M "+a+","+b+" "};Blockly.utils.svgPaths.moveBy=function(a,b){return" m "+a+","+b+" "};Blockly.utils.svgPaths.lineTo=function(a,b){return" l "+a+","+b+" "};Blockly.utils.svgPaths.line=function(a){return" l"+a.join("")};Blockly.utils.svgPaths.lineOnAxis=function(a,b){return" "+a+" "+b+" "};
Blockly.utils.svgPaths.arc=function(a,b,c,d){return a+" "+c+" "+c+" "+b+d};Blockly.blockRendering.ConstantProvider=function(){this.NO_PADDING=0;this.SMALL_PADDING=3;this.MEDIUM_PADDING=5;this.MEDIUM_LARGE_PADDING=8;this.LARGE_PADDING=10;this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING;this.DARK_PATH_OFFSET=1;this.TAB_HEIGHT=15;this.TAB_OFFSET_FROM_TOP=5;this.TAB_VERTICAL_OVERLAP=2.5;this.TAB_WIDTH=8;this.NOTCH_WIDTH=15;this.NOTCH_HEIGHT=4;this.MIN_BLOCK_WIDTH=12;this.EMPTY_BLOCK_SPACER_HEIGHT=16;this.CORNER_RADIUS=8;this.NOTCH_OFFSET_LEFT=15;this.STATEMENT_BOTTOM_SPACER=
0;this.STATEMENT_INPUT_PADDING_LEFT=20;this.BETWEEN_STATEMENT_PADDING_Y=4;this.MAX_BOTTOM_WIDTH=66.5;this.START_HAT_HEIGHT=15;this.START_HAT_WIDTH=100;this.SPACER_DEFAULT_HEIGHT=15;this.MIN_BLOCK_HEIGHT=24;this.EMPTY_INLINE_INPUT_PADDING=14.5;this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11;this.EXTERNAL_VALUE_INPUT_PADDING=2;this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT;this.START_POINT=Blockly.utils.svgPaths.moveBy(0,0);this.JAGGED_TEETH_HEIGHT=12;this.JAGGED_TEETH_WIDTH=6};
Blockly.blockRendering.ConstantProvider.prototype.init=function(){this.JAGGED_TEETH=this.makeJaggedTeeth();this.NOTCH=this.makeNotch();this.START_HAT=this.makeStartHat();this.PUZZLE_TAB=this.makePuzzleTab();this.INSIDE_CORNERS=this.makeInsideCorners();this.OUTSIDE_CORNERS=this.makeOutsideCorners()};
Blockly.blockRendering.ConstantProvider.prototype.makeJaggedTeeth=function(){var a=this.JAGGED_TEETH_HEIGHT,b=this.JAGGED_TEETH_WIDTH,c=Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(6,3),Blockly.utils.svgPaths.point(-12,6),Blockly.utils.svgPaths.point(6,3)]);return{height:a,width:b,path:c}};
Blockly.blockRendering.ConstantProvider.prototype.makeStartHat=function(){var a=this.START_HAT_HEIGHT,b=this.START_HAT_WIDTH,c=Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(30,-a),Blockly.utils.svgPaths.point(70,-a),Blockly.utils.svgPaths.point(b,0)]);return{height:a,width:b,path:c}};
Blockly.blockRendering.ConstantProvider.prototype.makePuzzleTab=function(){function a(a){a=a?-1:1;var d=-a,e=c/2,f=e+2.5,l=e+.5,m=Blockly.utils.svgPaths.point(-b,a*e);e=Blockly.utils.svgPaths.point(b,a*e);return Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(0,a*f),Blockly.utils.svgPaths.point(-b,d*l),m])+Blockly.utils.svgPaths.curve("s",[Blockly.utils.svgPaths.point(b,2.5*d),e])}var b=this.TAB_WIDTH,c=this.TAB_HEIGHT,d=a(!0),e=a(!1);return{width:b,height:c,pathDown:e,pathUp:d}};
Blockly.blockRendering.ConstantProvider.prototype.makeNotch=function(){function a(a){return Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*d,c),Blockly.utils.svgPaths.point(3*a,0),Blockly.utils.svgPaths.point(a*d,-c)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=(b-3)/2,e=a(1),f=a(-1);return{width:b,height:c,pathLeft:e,pathRight:f}};
Blockly.blockRendering.ConstantProvider.prototype.makeInsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-a,a)),c=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(a,a));return{width:a,height:a,pathTop:b,pathBottom:c}};
Blockly.blockRendering.ConstantProvider.prototype.makeOutsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.moveBy(0,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,-a));a=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,-a));return{topLeft:b,bottomLeft:a}};
Blockly.blockRendering.ConstantProvider.prototype.shapeFor=function(a){switch(a.type){case Blockly.INPUT_VALUE:case Blockly.OUTPUT_VALUE:return this.PUZZLE_TAB;case Blockly.PREVIOUS_STATEMENT:case Blockly.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type");}};Blockly.geras={};Blockly.geras.HighlightConstantProvider=function(){this.constantProvider=Blockly.blockRendering.getConstants();this.OFFSET=.5;this.START_POINT=Blockly.utils.svgPaths.moveBy(this.OFFSET,this.OFFSET);this.INSIDE_CORNER=this.makeInsideCorner();this.OUTSIDE_CORNER=this.makeOutsideCorner();this.PUZZLE_TAB=this.makePuzzleTab();this.NOTCH=this.makeNotch();this.JAGGED_TEETH=this.makeJaggedTeeth();this.START_HAT=this.makeStartHat()};
Blockly.geras.HighlightConstantProvider.prototype.makeInsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.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{width:a+b,height:a,
pathTop:function(a){return a?d:""},pathBottom:function(a){return a?e:f}}};
Blockly.geras.HighlightConstantProvider.prototype.makeOutsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.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","0 0,1",a-b,Blockly.utils.svgPaths.point(-c+
b,-f-a));return{height:a,topLeft:function(a){return a?d:e},bottomLeft:function(){return g}}};
Blockly.geras.HighlightConstantProvider.prototype.makePuzzleTab=function(){var a=this.constantProvider.TAB_WIDTH,b=this.constantProvider.TAB_HEIGHT,c=Blockly.utils.svgPaths.moveBy(-2,-b+3.4)+Blockly.utils.svgPaths.lineTo(-.45*a,-2.1),d=Blockly.utils.svgPaths.lineOnAxis("v",2.5)+Blockly.utils.svgPaths.moveBy(.97*-a,2.5)+Blockly.utils.svgPaths.curve("q",[Blockly.utils.svgPaths.point(.05*-a,10),Blockly.utils.svgPaths.point(.3*a,9.5)])+Blockly.utils.svgPaths.moveBy(.67*a,-1.9)+Blockly.utils.svgPaths.lineOnAxis("v",
2.5),e=Blockly.utils.svgPaths.lineOnAxis("v",-1.5)+Blockly.utils.svgPaths.moveBy(-.92*a,-.5)+Blockly.utils.svgPaths.curve("q",[Blockly.utils.svgPaths.point(-.19*a,-5.5),Blockly.utils.svgPaths.point(0,-11)])+Blockly.utils.svgPaths.moveBy(.92*a,1),f=Blockly.utils.svgPaths.moveBy(-5,b-.7)+Blockly.utils.svgPaths.lineTo(.46*a,-2.1);return{width:a,height:b,pathUp:function(a){return a?c:e},pathDown:function(a){return a?d:f}}};
Blockly.geras.HighlightConstantProvider.prototype.makeNotch=function(){return{pathLeft:Blockly.utils.svgPaths.lineOnAxis("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}};Blockly.geras.HighlightConstantProvider.prototype.makeJaggedTeeth=function(){return{pathLeft:Blockly.utils.svgPaths.lineTo(5.1,2.6)+Blockly.utils.svgPaths.moveBy(-10.2,6.8)+Blockly.utils.svgPaths.lineTo(5.1,2.6)}};
Blockly.geras.HighlightConstantProvider.prototype.makeStartHat=function(){var a=this.constantProvider.START_HAT.height,b=Blockly.utils.svgPaths.moveBy(25,-8.7)+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(29.7,-6.2),Blockly.utils.svgPaths.point(57.2,-.5),Blockly.utils.svgPaths.point(75,8.7)]),c=Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(17.8,-9.2),Blockly.utils.svgPaths.point(45.3,-14.9),Blockly.utils.svgPaths.point(75,-8.7)])+Blockly.utils.svgPaths.moveTo(100.5,
a+.5);return{path:function(a){return a?b:c}}};Blockly.geras.Highlighter=function(a,b){this.info_=a;this.pathObject_=b;this.steps_=this.pathObject_.highlightSteps;this.inlineSteps_=this.pathObject_.highlightInlineSteps;this.RTL_=this.info_.RTL;this.constants_=Blockly.blockRendering.getConstants();this.highlightConstants_=Blockly.blockRendering.getHighlightConstants();this.highlightOffset_=this.highlightConstants_.OFFSET;this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER;this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER;
this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB;this.notchPaths_=this.highlightConstants_.NOTCH;this.startPaths_=this.highlightConstants_.START_HAT;this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH};
Blockly.geras.Highlighter.prototype.drawTopCorner=function(a){this.steps_.push(Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY));for(var b=0,c;c=a.elements[b];b++)Blockly.blockRendering.Types.isLeftSquareCorner(c)?this.steps_.push(this.highlightConstants_.START_POINT):Blockly.blockRendering.Types.isLeftRoundedCorner(c)?this.steps_.push(this.outsideCornerPaths_.topLeft(this.RTL_)):Blockly.blockRendering.Types.isPreviousConnection(c)?this.steps_.push(this.notchPaths_.pathLeft):Blockly.blockRendering.Types.isHat(c)?
this.steps_.push(this.startPaths_.path(this.RTL_)):Blockly.blockRendering.Types.isSpacer(c)&&0!=c.width&&this.steps_.push("H",c.xPos+c.width-this.highlightOffset_);this.steps_.push("H",a.xPos+a.width-this.highlightOffset_)};
Blockly.geras.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.geras.Highlighter.prototype.drawValueInput=function(a){var b=a.getLastInput();if(this.RTL_){var c=a.height-b.connectionHeight;a=Blockly.utils.svgPaths.moveTo(b.xPos+b.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)}else a=Blockly.utils.svgPaths.moveTo(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_);this.steps_.push(a)};
Blockly.geras.Highlighter.prototype.drawStatementInput=function(a){var b=a.getLastInput();if(this.RTL_){var c=a.height-2*this.insideCornerPaths_.height;a=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0)}else a=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+
Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0);this.steps_.push(a)};Blockly.geras.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.geras.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];Blockly.blockRendering.Types.isLeftSquareCorner(c)?this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos+this.highlightOffset_,b-this.highlightOffset_)):Blockly.blockRendering.Types.isLeftRoundedCorner(c)&&(this.steps_.push(Blockly.utils.svgPaths.moveTo(a.xPos,b)),this.steps_.push(this.outsideCornerPaths_.bottomLeft()))}};
Blockly.geras.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,Blockly.blockRendering.Types.isLeftRoundedCorner(a.elements[0])?
this.steps_.push("V",this.outsideCornerPaths_.height):this.steps_.push("V",a.startY+this.highlightOffset_))};
Blockly.geras.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.geras.RenderInfo=function(a){Blockly.geras.RenderInfo.superClass_.constructor.call(this,a)};goog.inherits(Blockly.geras.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.geras.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.geras.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b&&Blockly.blockRendering.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&Blockly.blockRendering.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&Blockly.blockRendering.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Blockly.blockRendering.Types.isInput(a)&&!b)return Blockly.blockRendering.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:
Blockly.blockRendering.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:Blockly.blockRendering.Types.isHat(a)?this.constants_.NO_PADDING:Blockly.blockRendering.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:Blockly.blockRendering.Types.isLeftRoundedCorner(a)?this.constants_.MIN_BLOCK_WIDTH:Blockly.blockRendering.Types.isJaggedEdge(a)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!Blockly.blockRendering.Types.isInput(a)&&b&&Blockly.blockRendering.Types.isInput(b)){if(a.isEditable){if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;
if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset;if(Blockly.blockRendering.Types.isNextConnection(b)){var c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2;return b.notchOffset+c}}if(Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b){if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset-this.constants_.CORNER_RADIUS;if(Blockly.blockRendering.Types.isNextConnection(b))return c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2,b.notchOffset-
this.constants_.CORNER_RADIUS+c}return!Blockly.blockRendering.Types.isInput(a)&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.geras.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.elements,d=a.getFirstSpacer(),e=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)e=c[c.length-3],a.widthWithConnectedBlocks+=b;(c=a.getLastInput())?c.align==Blockly.ALIGN_LEFT?e.width+=b:c.align==Blockly.ALIGN_CENTRE?(d.width+=b/2,e.width+=b/2):c.align==Blockly.ALIGN_RIGHT&&(d.width+=b):e.width+=b;a.width+=b};
Blockly.geras.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return Blockly.blockRendering.Types.isTopRow(a)&&Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Blockly.blockRendering.Types.isTopRow(a)||Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?this.constants_.LARGE_PADDING:!a.hasStatement&&b.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||b.hasDummyInput?
this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};Blockly.geras.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;if(Blockly.blockRendering.Types.isField(b)||Blockly.blockRendering.Types.isIcon(b)){if(c+=b.height/2,a.hasInlineInput||a.hasStatement)c+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y}else c=Blockly.blockRendering.Types.isInlineInput(b)?c+b.height/2:Blockly.blockRendering.Types.isNextConnection(b)?c+(a.height-a.overhangY+b.height/2):c+a.height/2;return c};
Blockly.geras.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];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<this.constants_.MIN_BLOCK_HEIGHT&&(e=this.constants_.MIN_BLOCK_HEIGHT-e,this.bottomRow.height+=e,b+=e);e=d.xPos;for(var f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.startY};Blockly.geras.Drawer=function(a,b){Blockly.geras.Drawer.superClass_.constructor.call(this,a,b);this.highlighter_=new Blockly.geras.Highlighter(b,this.pathObject_)};goog.inherits(Blockly.geras.Drawer,Blockly.blockRendering.Drawer);Blockly.geras.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height+this.constants_.DARK_PATH_OFFSET;this.block_.width=this.info_.widthWithChildren+this.constants_.DARK_PATH_OFFSET};
Blockly.geras.Drawer.prototype.drawTop_=function(){this.highlighter_.drawTopCorner(this.info_.topRow);this.highlighter_.drawRightSideRow(this.info_.topRow);Blockly.geras.Drawer.superClass_.drawTop_.call(this)};Blockly.geras.Drawer.prototype.drawJaggedEdge_=function(a){this.highlighter_.drawJaggedEdge_(a);Blockly.geras.Drawer.superClass_.drawJaggedEdge_.call(this,a)};
Blockly.geras.Drawer.prototype.drawValueInput_=function(a){this.highlighter_.drawValueInput(a);Blockly.geras.Drawer.superClass_.drawValueInput_.call(this,a)};Blockly.geras.Drawer.prototype.drawStatementInput_=function(a){this.highlighter_.drawStatementInput(a);Blockly.geras.Drawer.superClass_.drawStatementInput_.call(this,a)};Blockly.geras.Drawer.prototype.drawRightSideRow_=function(a){this.highlighter_.drawRightSideRow(a);Blockly.geras.Drawer.superClass_.drawRightSideRow_.call(this,a)};
Blockly.geras.Drawer.prototype.drawBottom_=function(){this.highlighter_.drawBottomRow(this.info_.bottomRow);Blockly.geras.Drawer.superClass_.drawBottom_.call(this)};Blockly.geras.Drawer.prototype.drawLeft_=function(){this.highlighter_.drawLeft();Blockly.geras.Drawer.superClass_.drawLeft_.call(this)};Blockly.geras.Drawer.prototype.drawInlineInput_=function(a){this.highlighter_.drawInlineInput(a);Blockly.geras.Drawer.superClass_.drawInlineInput_.call(this,a)};Blockly.thrasos={};Blockly.thrasos.RenderInfo=function(a){Blockly.thrasos.RenderInfo.superClass_.constructor.call(this,a)};goog.inherits(Blockly.thrasos.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.thrasos.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.thrasos.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b&&Blockly.blockRendering.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&Blockly.blockRendering.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&Blockly.blockRendering.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Blockly.blockRendering.Types.isInput(a)&&!b)return Blockly.blockRendering.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:
Blockly.blockRendering.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:Blockly.blockRendering.Types.isHat(a)?this.constants_.NO_PADDING:Blockly.blockRendering.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:Blockly.blockRendering.Types.isLeftRoundedCorner(a)?this.constants_.MIN_BLOCK_WIDTH:Blockly.blockRendering.Types.isJaggedEdge(a)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!Blockly.blockRendering.Types.isInput(a)&&b&&Blockly.blockRendering.Types.isInput(b)){if(a.isEditable){if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;
if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;
if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset;if(Blockly.blockRendering.Types.isNextConnection(b)){var c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2;return b.notchOffset+c}}if(Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b){if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset-this.constants_.CORNER_RADIUS;if(Blockly.blockRendering.Types.isNextConnection(b))return c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2,b.notchOffset-
this.constants_.CORNER_RADIUS+c}return!Blockly.blockRendering.Types.isInput(a)&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.thrasos.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.elements,d=a.getFirstSpacer(),e=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)e=c[c.length-3],a.widthWithConnectedBlocks+=b;(c=a.getLastInput())?c.align==Blockly.ALIGN_LEFT?e.width+=b:c.align==Blockly.ALIGN_CENTRE?(d.width+=b/2,e.width+=b/2):c.align==Blockly.ALIGN_RIGHT&&(d.width+=b):e.width+=b;a.width+=b};
Blockly.thrasos.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return Blockly.blockRendering.Types.isTopRow(a)&&Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Blockly.blockRendering.Types.isTopRow(a)||Blockly.blockRendering.Types.isBottomRow(b)?this.constants_.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?this.constants_.LARGE_PADDING:!a.hasStatement&&b.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||b.hasDummyInput?
this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};Blockly.thrasos.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;return c=Blockly.blockRendering.Types.isField(b)&&a.hasStatement?c+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+b.height/2):Blockly.blockRendering.Types.isNextConnection(b)?c+(a.height-a.overhangY+b.height/2):c+a.height/2};
Blockly.thrasos.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];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<this.constants_.MIN_BLOCK_HEIGHT&&(e=this.constants_.MIN_BLOCK_HEIGHT-e,this.bottomRow.height+=e,b+=e);e=d.xPos;for(var f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.startY};Blockly.zelos={};Blockly.zelos.TopRow=function(){Blockly.zelos.TopRow.superClass_.constructor.call(this)};goog.inherits(Blockly.zelos.TopRow,Blockly.blockRendering.TopRow);Blockly.zelos.TopRow.prototype.populate=function(a){Blockly.zelos.TopRow.superClass_.populate.call(this,a);this.hasRightSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner("right")):this.elements.push(new Blockly.blockRendering.RoundCorner("right"))};Blockly.zelos.TopRow.prototype.hasLeftSquareCorner=function(a){return!1};
Blockly.zelos.TopRow.prototype.hasRightSquareCorner=function(a){return!1};Blockly.zelos.BottomRow=function(){Blockly.zelos.BottomRow.superClass_.constructor.call(this)};goog.inherits(Blockly.zelos.BottomRow,Blockly.blockRendering.BottomRow);Blockly.zelos.BottomRow.prototype.populate=function(a){Blockly.zelos.BottomRow.superClass_.populate.call(this,a);this.hasRightSquareCorner(a)?this.elements.push(new Blockly.blockRendering.SquareCorner("right")):this.elements.push(new Blockly.blockRendering.RoundCorner("right"))};
Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner=function(a){return!1};Blockly.zelos.BottomRow.prototype.hasRightSquareCorner=function(a){return!1};Blockly.zelos.RenderInfo=function(a){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a);this.topRow=new Blockly.zelos.TopRow;this.bottomRow=new Blockly.zelos.BottomRow};goog.inherits(Blockly.zelos.RenderInfo,Blockly.blockRendering.RenderInfo);
Blockly.zelos.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b&&Blockly.blockRendering.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&Blockly.blockRendering.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&Blockly.blockRendering.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Blockly.blockRendering.Types.isInput(a)&&!b)return Blockly.blockRendering.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:
Blockly.blockRendering.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:Blockly.blockRendering.Types.isHat(a)?this.constants_.NO_PADDING:Blockly.blockRendering.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:Blockly.blockRendering.Types.isLeftRoundedCorner(a)?this.constants_.MIN_BLOCK_WIDTH:Blockly.blockRendering.Types.isRightRoundedCorner(a)||Blockly.blockRendering.Types.isJaggedEdge(a)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInput(a)&&
!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!Blockly.blockRendering.Types.isInput(a)&&b&&Blockly.blockRendering.Types.isInput(b)){if(a.isEditable){if(Blockly.blockRendering.Types.isInlineInput(b)||Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(Blockly.blockRendering.Types.isInlineInput(b)||
Blockly.blockRendering.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Blockly.blockRendering.Types.isIcon(a)&&!Blockly.blockRendering.Types.isInput(b))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a)&&!Blockly.blockRendering.Types.isInput(b))return b.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;
if(Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b){if(Blockly.blockRendering.Types.isHat(b))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset;if(Blockly.blockRendering.Types.isNextConnection(b)){var c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2;return b.notchOffset+c}}if(Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b){if(Blockly.blockRendering.Types.isPreviousConnection(b))return b.notchOffset-this.constants_.CORNER_RADIUS;
if(Blockly.blockRendering.Types.isNextConnection(b))return c=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2,b.notchOffset-this.constants_.CORNER_RADIUS+c}return!Blockly.blockRendering.Types.isInput(a)&&!Blockly.blockRendering.Types.isInput(b)&&a.isEditable==b.isEditable||b&&Blockly.blockRendering.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
Blockly.zelos.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.getLastSpacer();Blockly.blockRendering.Types.isTopOrBottomRow(a)&&(c=a.elements[a.elements.length-3]);c&&(c.width+=b,a.width+=b)};Blockly.zelos.Drawer=function(a,b){Blockly.zelos.Drawer.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.zelos.Drawer,Blockly.blockRendering.Drawer);
Blockly.zelos.Drawer.prototype.drawTop_=function(){var a=this.info_.topRow,b=a.elements;this.positionPreviousConnection_();this.outlinePath_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var c=0,d;d=b[c];c++)Blockly.blockRendering.Types.isLeftRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:Blockly.blockRendering.Types.isRightRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:Blockly.blockRendering.Types.isPreviousConnection(d)?this.outlinePath_+=
d.shape.pathLeft:Blockly.blockRendering.Types.isHat(d)?this.outlinePath_+=this.constants_.START_HAT.path:Blockly.blockRendering.Types.isSpacer(d)&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",d.width));this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height)};
Blockly.zelos.Drawer.prototype.drawBottom_=function(){var a=this.info_.bottomRow,b=a.elements;this.positionNextConnection_();this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height-a.overhangY);for(var c=b.length-1,d;d=b[c];c--)Blockly.blockRendering.Types.isNextConnection(d)?this.outlinePath_+=d.shape.pathRight:Blockly.blockRendering.Types.isLeftSquareCorner(d)?this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos):Blockly.blockRendering.Types.isLeftRoundedCorner(d)?this.outlinePath_+=
this.constants_.OUTSIDE_CORNERS.bottomLeft:Blockly.blockRendering.Types.isRightRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.bottomRight:Blockly.blockRendering.Types.isSpacer(d)&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",-1*d.width))};Blockly.zelos.ConstantProvider=function(){Blockly.zelos.ConstantProvider.superClass_.constructor.call(this);this.CORNER_RADIUS=4;this.NOTCH_WIDTH=36;this.NOTCH_HEIGHT=8;this.NOTCH_OFFSET_LEFT=12;this.MIN_BLOCK_HEIGHT=48;this.DARK_PATH_OFFSET=0};goog.inherits(Blockly.zelos.ConstantProvider,Blockly.blockRendering.ConstantProvider);Blockly.zelos.ConstantProvider.prototype.init=function(){Blockly.zelos.ConstantProvider.superClass_.init.call(this);this.TRIANGLE=this.makeTriangle()};
Blockly.zelos.ConstantProvider.prototype.makeTriangle=function(){function a(a){a=a?-1:1;return Blockly.utils.svgPaths.lineTo(-20,20*a/2)+Blockly.utils.svgPaths.lineTo(20,20*a/2)}var b=a(!0);return{width:20,height:20,pathDown:a(!1),pathUp:b}};
Blockly.zelos.ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck();switch(a.type){case Blockly.INPUT_VALUE:case Blockly.OUTPUT_VALUE:return b&&-1!=b.indexOf("Boolean")?Blockly.blockRendering.constants.TRIANGLE:Blockly.blockRendering.constants.PUZZLE_TAB;case Blockly.PREVIOUS_STATEMENT:case Blockly.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type");}};
Blockly.zelos.ConstantProvider.prototype.makeNotch=function(){function a(a){return Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,g/2),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,g/2),Blockly.utils.svgPaths.point(a*e/2,g),Blockly.utils.svgPaths.point(a*e,g)])+Blockly.utils.svgPaths.lineOnAxis("h",a*d)+Blockly.utils.svgPaths.curve("c",
[Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,-(g/2)),Blockly.utils.svgPaths.point(a*e,-g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,-f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,-(g/2)),Blockly.utils.svgPaths.point(a*e/2,-g),Blockly.utils.svgPaths.point(a*e,-g)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=b/3,e=d/3,f=c/2,g=f/2,h=a(1),k=a(-1);return{width:b,height:c,pathLeft:h,pathRight:k}};
Blockly.zelos.ConstantProvider.prototype.makeOutsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.moveBy(0,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,-a)),c=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,a)),d=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,-a));a=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,a));return{topLeft:b,topRight:c,bottomRight:a,bottomLeft:d}};Blockly.blockRendering.rendererName="geras";Blockly.blockRendering.useDebugger=!1;
Blockly.blockRendering.init=function(){"geras"==Blockly.blockRendering.rendererName?(Blockly.blockRendering.constants=new Blockly.blockRendering.ConstantProvider,Blockly.blockRendering.constants.init(),Blockly.blockRendering.highlightConstants=new Blockly.geras.HighlightConstantProvider):"thrasos"==Blockly.blockRendering.rendererName?(Blockly.blockRendering.constants=new Blockly.blockRendering.ConstantProvider,Blockly.blockRendering.constants.init()):"zelos"==Blockly.blockRendering.rendererName&&
(Blockly.blockRendering.constants=new Blockly.zelos.ConstantProvider,Blockly.blockRendering.constants.init())};
Blockly.blockRendering.render=function(a){a.renderingDebugger||(a.renderingDebugger=new Blockly.blockRendering.Debug);if("geras"==Blockly.blockRendering.rendererName){var b=new Blockly.geras.RenderInfo(a);b.measure();(new Blockly.geras.Drawer(a,b)).draw()}else"thrasos"==Blockly.blockRendering.rendererName?(b=new Blockly.thrasos.RenderInfo(a),b.measure(),(new Blockly.blockRendering.Drawer(a,b)).draw()):"zelos"==Blockly.blockRendering.rendererName&&(b=new Blockly.zelos.RenderInfo(a),b.measure(),(new Blockly.zelos.Drawer(a,
b)).draw())};Blockly.blockRendering.getConstants=function(){return Blockly.blockRendering.constants};Blockly.blockRendering.getHighlightConstants=function(){return Blockly.blockRendering.highlightConstants};Blockly.ConnectionDB=function(){this.connections_=[]};Blockly.ConnectionDB.prototype.addConnection=function(a){if(a.inDB_)throw Error("Connection already in database.");if(!a.getSourceBlock().isInFlyout){var b=this.findPositionForConnection_(a);this.connections_.splice(b,0,a);a.inDB_=!0}};
Blockly.ConnectionDB.prototype.findConnection=function(a){if(!this.connections_.length)return-1;var b=this.findPositionForConnection_(a);if(b>=this.connections_.length)return-1;for(var c=a.y_,d=b;0<=d&&this.connections_[d].y_==c;){if(this.connections_[d]==a)return d;d--}for(;b<this.connections_.length&&this.connections_[b].y_==c;){if(this.connections_[b]==a)return b;b++}return-1};
Blockly.ConnectionDB.prototype.findPositionForConnection_=function(a){if(!this.connections_.length)return 0;for(var b=0,c=this.connections_.length;b<c;){var d=Math.floor((b+c)/2);if(this.connections_[d].y_<a.y_)b=d+1;else if(this.connections_[d].y_>a.y_)c=d;else{b=d;break}}return b};
Blockly.ConnectionDB.prototype.removeConnection_=function(a){if(!a.inDB_)throw Error("Connection not in database.");var b=this.findConnection(a);if(-1==b)throw Error("Unable to find connection in connectionDB.");a.inDB_=!1;this.connections_.splice(b,1)};
@@ -289,10 +455,11 @@ Blockly.ConnectionDB.prototype.searchForClosest=function(a,b,c){if(!this.connect
d;return{connection:c,radius:g}};Blockly.ConnectionDB.init=function(){var a=[];a[Blockly.INPUT_VALUE]=new Blockly.ConnectionDB;a[Blockly.OUTPUT_VALUE]=new Blockly.ConnectionDB;a[Blockly.NEXT_STATEMENT]=new Blockly.ConnectionDB;a[Blockly.PREVIOUS_STATEMENT]=new Blockly.ConnectionDB;return a};Blockly.constants={};Blockly.LINE_MODE_MULTIPLIER=40;Blockly.PAGE_MODE_MULTIPLIER=125;Blockly.DRAG_RADIUS=5;Blockly.FLYOUT_DRAG_RADIUS=10;Blockly.SNAP_RADIUS=28;Blockly.CONNECTING_SNAP_RADIUS=Blockly.SNAP_RADIUS;Blockly.CURRENT_CONNECTION_PREFERENCE=8;Blockly.INSERTION_MARKER_COLOUR="#000000";Blockly.BUMP_DELAY=250;Blockly.BUMP_RANDOMNESS=10;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.SOUND_LIMIT=100;Blockly.DRAG_STACK=!0;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;
Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;
Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.DELETE_AREA_NONE=null;Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";
Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.CursorSvg=function(a,b){Blockly.CursorSvg.superClass_.constructor.call(this,b);this.workspace_=a};goog.inherits(Blockly.CursorSvg,Blockly.Cursor);Blockly.CursorSvg.CURSOR_HEIGHT=5;Blockly.CursorSvg.CURSOR_WIDTH=100;Blockly.CursorSvg.NOTCH_START_LENGTH=24;Blockly.CursorSvg.VERTICAL_PADDING=5;Blockly.CursorSvg.STACK_PADDING=10;Blockly.CursorSvg.CURSOR_COLOR="#cc0a0a";Blockly.CursorSvg.MARKER_COLOR="#4286f4";Blockly.CursorSvg.prototype.parent_=null;
Blockly.CursorSvg.prototype.currentCursorSvg=null;Blockly.CursorSvg.prototype.getSvgRoot=function(){return this.svgGroup_};Blockly.CursorSvg.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyCursor"},null);this.createCursorSvg_();return this.svgGroup_};Blockly.CursorSvg.prototype.setParent_=function(a){if(a!=this.parent_){var b=this.getSvgRoot();a&&(a.appendChild(b),this.parent_=a)}};
Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.CursorSvg=function(a,b){Blockly.CursorSvg.superClass_.constructor.call(this,b);this.workspace_=a;this.constants=new Blockly.blockRendering.ConstantProvider;this.constants.init()};goog.inherits(Blockly.CursorSvg,Blockly.Cursor);Blockly.CursorSvg.CURSOR_HEIGHT=5;Blockly.CursorSvg.CURSOR_WIDTH=100;Blockly.CursorSvg.NOTCH_START_LENGTH=24;Blockly.CursorSvg.VERTICAL_PADDING=5;Blockly.CursorSvg.STACK_PADDING=10;Blockly.CursorSvg.CURSOR_COLOR="#cc0a0a";Blockly.CursorSvg.MARKER_COLOR="#4286f4";
Blockly.CursorSvg.CURSOR_CLASS="blocklyCursor";Blockly.CursorSvg.MARKER_CLASS="blocklyMarker";Blockly.CursorSvg.prototype.parent_=null;Blockly.CursorSvg.prototype.currentCursorSvg=null;Blockly.CursorSvg.prototype.getSvgRoot=function(){return this.svgGroup_};Blockly.CursorSvg.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":this.isMarker_?Blockly.CursorSvg.MARKER_CLASS:Blockly.CursorSvg.CURSOR_CLASS},null);this.createCursorSvg_();return this.svgGroup_};
Blockly.CursorSvg.prototype.setParent_=function(a){if(a!=this.parent_){var b=this.getSvgRoot(),c=null;if(a){if(this.isMarker_){for(var d=0,e;e=a.childNodes[d];d++)Blockly.utils.dom.hasClass(e,Blockly.CursorSvg.CURSOR_CLASS)&&(c=e);a.insertBefore(b,c)}else a.appendChild(b);this.parent_=a}}};
Blockly.CursorSvg.prototype.showWithCoordinates_=function(){var a=this.getCurNode().getWsCoordinate();this.currentCursorSvg=this.cursorSvgLine_;this.setParent_(this.workspace_.svgBlockCanvas_);this.positionLine_(a.x,a.y,Blockly.CursorSvg.CURSOR_WIDTH);this.showCurrent_()};Blockly.CursorSvg.prototype.showWithBlock_=function(){var a=this.getCurNode().getLocation();this.currentCursorSvg=this.cursorSvgRect_;this.setParent_(a.getSvgRoot());this.positionRect_(0,0,a.width,a.height);this.showCurrent_()};
Blockly.CursorSvg.prototype.showWithInputOutput_=function(){var a=this.getCurNode().getLocation();this.currentCursorSvg=this.cursorInputOutput_;var b=Blockly.utils.svgPaths.moveTo(0,0)+Blockly.blockRendering.constants.PUZZLE_TAB.pathDown;this.cursorInputOutput_.setAttribute("d",b);this.setParent_(a.getSourceBlock().getSvgRoot());this.positionInputOutput_(a);this.showCurrent_()};
Blockly.CursorSvg.prototype.showWithInputOutput_=function(){var a=this.getCurNode().getLocation();this.currentCursorSvg=this.cursorInputOutput_;var b=Blockly.utils.svgPaths.moveTo(0,0)+this.constants.shapeFor(a).pathDown;this.cursorInputOutput_.setAttribute("d",b);this.setParent_(a.getSourceBlock().getSvgRoot());this.positionInputOutput_(a);this.showCurrent_()};
Blockly.CursorSvg.prototype.showWithNext_=function(){var a=this.getCurNode().getLocation(),b=a.getSourceBlock(),c=a.getOffsetInBlock().y;b=b.getHeightWidth().width;this.currentCursorSvg=this.cursorSvgLine_;this.setParent_(a.getSourceBlock().getSvgRoot());this.positionLine_(0,c,b);this.showCurrent_()};
Blockly.CursorSvg.prototype.showWithPrev_=function(){var a=this.getCurNode().getLocation(),b=a.getSourceBlock().getHeightWidth().width;this.currentCursorSvg=this.cursorSvgLine_;this.setParent_(a.getSourceBlock().getSvgRoot());this.positionLine_(0,0,b);this.showCurrent_()};
Blockly.CursorSvg.prototype.showWithField_=function(){var a=this.getCurNode().getLocation(),b=a.borderRect_.width.baseVal.value,c=a.borderRect_.height.baseVal.value;this.currentCursorSvg=this.cursorSvgRect_;this.setParent_(a.getSvgRoot());this.positionRect_(0,0,b,c);this.showCurrent_()};
@@ -311,20 +478,7 @@ Blockly.blockAnimations.connectionUiEffect=function(a){var b=a.workspace,c=b.sca
Blockly.blockAnimations.connectionUiStep_=function(a,b,c){var d=(new Date-b)/150;1<d?Blockly.utils.dom.removeNode(a):(a.setAttribute("r",25*d*c),a.style.opacity=1-d,Blockly.blockAnimations.disconnectPid_=setTimeout(Blockly.blockAnimations.connectionUiStep_,10,a,b,c))};
Blockly.blockAnimations.disconnectUiEffect=function(a){a.workspace.getAudioManager().play("disconnect");if(!(1>a.workspace.scale)){var b=a.getHeightWidth().height;b=Math.atan(10/b)/Math.PI*180;a.RTL||(b*=-1);Blockly.blockAnimations.disconnectUiStep_(a.getSvgRoot(),b,new Date)}};
Blockly.blockAnimations.disconnectUiStep_=function(a,b,c){var d=(new Date-c)/200;1<d?a.skew_="":(a.skew_="skewX("+Math.round(Math.sin(d*Math.PI*3)*(1-d)*b)+")",Blockly.blockAnimations.disconnectGroup_=a,Blockly.blockAnimations.disconnectPid_=setTimeout(Blockly.blockAnimations.disconnectUiStep_,10,a,b,c));a.setAttribute("transform",a.translate_+a.skew_)};
Blockly.blockAnimations.disconnectUiStop=function(){if(Blockly.blockAnimations.disconnectGroup_){clearTimeout(Blockly.blockAnimations.disconnectPid_);var a=Blockly.blockAnimations.disconnectGroup_;a.skew_="";a.setAttribute("transform",a.translate_);Blockly.blockAnimations.disconnectGroup_=null}};Blockly.RenderedConnection=function(a,b){Blockly.RenderedConnection.superClass_.constructor.call(this,a,b);this.offsetInBlock_=new Blockly.utils.Coordinate(0,0)};goog.inherits(Blockly.RenderedConnection,Blockly.Connection);Blockly.RenderedConnection.prototype.distanceFrom=function(a){var b=this.x_-a.x_;a=this.y_-a.y_;return Math.sqrt(b*b+a*a)};
Blockly.RenderedConnection.prototype.bumpAwayFrom_=function(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();if(!b.isInFlyout){var c=!1;if(!b.isMovable()){b=a.getSourceBlock().getRootBlock();if(!b.isMovable())return;a=this;c=!0}var d=Blockly.selected==b;d||b.addSelect();var e=a.x_+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x_,f=a.y_+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.y_;c&&(f=-f);b.RTL&&
(e=a.x_-Blockly.SNAP_RADIUS-Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x_);b.moveBy(e,f);d||b.removeSelect()}}};Blockly.RenderedConnection.prototype.moveTo=function(a,b){this.inDB_&&this.db_.removeConnection_(this);this.x_=a;this.y_=b;this.hidden_||this.db_.addConnection(this)};Blockly.RenderedConnection.prototype.moveBy=function(a,b){this.moveTo(this.x_+a,this.y_+b)};Blockly.RenderedConnection.prototype.moveToOffset=function(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)};
Blockly.RenderedConnection.prototype.setOffsetInBlock=function(a,b){this.offsetInBlock_.x=a;this.offsetInBlock_.y=b};Blockly.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_};
Blockly.RenderedConnection.prototype.tighten_=function(){var a=this.targetConnection.x_-this.x_,b=this.targetConnection.y_-this.y_;if(0!=a||0!=b){var c=this.targetBlock(),d=c.getSvgRoot();if(!d)throw Error("block is not rendered.");d=Blockly.utils.getRelativeXY(d);c.getSvgRoot().setAttribute("transform","translate("+(d.x-a)+","+(d.y-b)+")");c.moveConnections_(-a,-b)}};Blockly.RenderedConnection.prototype.closest=function(a,b){return this.dbOpposite_.searchForClosest(this,a,b)};
Blockly.RenderedConnection.prototype.highlight=function(){var a=this.type==Blockly.INPUT_VALUE||this.type==Blockly.OUTPUT_VALUE?Blockly.utils.svgPaths.moveBy(0,-5)+Blockly.utils.svgPaths.lineOnAxis("v",5)+Blockly.blockRendering.constants.PUZZLE_TAB.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",5):Blockly.utils.svgPaths.moveBy(-5,0)+Blockly.utils.svgPaths.lineOnAxis("h",5)+Blockly.blockRendering.constants.NOTCH.pathLeft+Blockly.utils.svgPaths.lineOnAxis("h",5);var b=this.sourceBlock_.getRelativeToSurfaceXY();
Blockly.Connection.highlightedPath_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyHighlightedConnectionPath",d:a,transform:"translate("+(this.x_-b.x)+","+(this.y_-b.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())};
Blockly.RenderedConnection.prototype.unhideAll=function(){this.setHidden(!1);var a=[];if(this.type!=Blockly.INPUT_VALUE&&this.type!=Blockly.NEXT_STATEMENT)return a;var b=this.targetBlock();if(b){if(b.isCollapsed()){var c=[];b.outputConnection&&c.push(b.outputConnection);b.nextConnection&&c.push(b.nextConnection);b.previousConnection&&c.push(b.previousConnection)}else c=b.getConnections_(!0);for(var d=0;d<c.length;d++)a.push.apply(a,c[d].unhideAll());a.length||(a[0]=b)}return a};
Blockly.RenderedConnection.prototype.unhighlight=function(){Blockly.utils.dom.removeNode(Blockly.Connection.highlightedPath_);delete Blockly.Connection.highlightedPath_};Blockly.RenderedConnection.prototype.setHidden=function(a){(this.hidden_=a)&&this.inDB_?this.db_.removeConnection_(this):a||this.inDB_||this.db_.addConnection(this)};
Blockly.RenderedConnection.prototype.hideAll=function(){this.setHidden(!0);if(this.targetConnection)for(var a=this.targetBlock().getDescendants(!1),b=0;b<a.length;b++){for(var c=a[b],d=c.getConnections_(!0),e=0;e<d.length;e++)d[e].setHidden(!0);c=c.getIcons();for(e=0;e<c.length;e++)c[e].setVisible(!1)}};Blockly.RenderedConnection.prototype.isConnectionAllowed=function(a,b){return this.distanceFrom(a)>b?!1:Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,a)};
Blockly.RenderedConnection.prototype.disconnectInternal_=function(a,b){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render())};
Blockly.RenderedConnection.prototype.respawnShadow_=function(){var a=this.getSourceBlock(),b=this.getShadowDom();if(a.workspace&&b&&Blockly.Events.recordUndo){Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);b=this.targetBlock();if(!b)throw Error("Couldn't respawn the shadow block that should exist here.");b.initSvg();b.render(!1);a.rendered&&a.render()}};Blockly.RenderedConnection.prototype.neighbours_=function(a){return this.dbOpposite_.getNeighbours(this,a)};
Blockly.RenderedConnection.prototype.connect_=function(a){Blockly.RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();b.rendered&&b.updateDisabled();a.rendered&&a.updateDisabled();b.rendered&&a.rendered&&(this.type==Blockly.NEXT_STATEMENT||this.type==Blockly.PREVIOUS_STATEMENT?a.render():b.render())};
Blockly.RenderedConnection.prototype.onCheckChanged_=function(){this.isConnected()&&!this.checkType_(this.targetConnection)&&((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours_())};Blockly.InsertionMarkerManager=function(a){this.topBlock_=Blockly.selected=a;this.workspace_=a.workspace;this.lastMarker_=this.lastOnStack_=null;this.firstMarker_=this.createMarkerBlock_(this.topBlock_);this.localConnection_=this.closestConnection_=null;this.wouldDeleteBlock_=!1;this.markerConnection_=null;this.highlightingBlock_=!1;this.highlightedBlock_=null;this.availableConnections_=this.initAvailableConnections_()};
Blockly.blockAnimations.disconnectUiStop=function(){if(Blockly.blockAnimations.disconnectGroup_){clearTimeout(Blockly.blockAnimations.disconnectPid_);var a=Blockly.blockAnimations.disconnectGroup_;a.skew_="";a.setAttribute("transform",a.translate_);Blockly.blockAnimations.disconnectGroup_=null}};Blockly.InsertionMarkerManager=function(a){this.topBlock_=Blockly.selected=a;this.workspace_=a.workspace;this.lastMarker_=this.lastOnStack_=null;this.firstMarker_=this.createMarkerBlock_(this.topBlock_);this.localConnection_=this.closestConnection_=null;this.wouldDeleteBlock_=!1;this.markerConnection_=null;this.highlightingBlock_=!1;this.highlightedBlock_=null;this.availableConnections_=this.initAvailableConnections_()};
Blockly.InsertionMarkerManager.prototype.dispose=function(){this.workspace_=this.topBlock_=null;this.availableConnections_.length=0;this.localConnection_=this.closestConnection_=null;Blockly.Events.disable();try{this.firstMarker_&&(this.firstMarker_.dispose(),this.firstMarker_=null),this.lastMarker_&&(this.lastMarker_.dispose(),this.lastMarker_=null)}finally{Blockly.Events.enable()}this.highlightedBlock_=null};Blockly.InsertionMarkerManager.prototype.wouldDeleteBlock=function(){return this.wouldDeleteBlock_};
Blockly.InsertionMarkerManager.prototype.wouldConnectBlock=function(){return!!this.closestConnection_};
Blockly.InsertionMarkerManager.prototype.applyConnections=function(){if(this.closestConnection_&&(Blockly.Events.disable(),this.hidePreview_(),Blockly.Events.enable(),this.localConnection_.connect(this.closestConnection_),this.topBlock_.rendered)){var a=this.localConnection_.isSuperior()?this.closestConnection_:this.localConnection_;Blockly.blockAnimations.connectionUiEffect(a.getSourceBlock());this.topBlock_.getRootBlock().bringToFront()}};
@@ -397,7 +551,7 @@ Blockly.Gesture.prototype.updateIsDraggingWorkspace_=function(){if(this.flyout_?
Blockly.Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0;this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()};
Blockly.Gesture.prototype.startDraggingBlock_=function(){this.blockDragger_=new Blockly.BlockDragger(this.targetBlock_,this.startWorkspace_);this.blockDragger_.startBlockDrag(this.currentDragDeltaXY_,this.healStack_);this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_)};
Blockly.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new Blockly.BubbleDragger(this.startBubble_,this.startWorkspace_);this.bubbleDragger_.startBubbleDrag();this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)};
Blockly.Gesture.prototype.doStart=function(a){Blockly.utils.isTargetInput(a)?this.cancel():(this.hasStarted_=!0,Blockly.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,Blockly.hideChaff(!!this.flyout_),Blockly.Tooltip.block(),this.targetBlock_&&(this.targetBlock_.select(),!this.targetBlock_.isInFlyout&&a.shiftKey&&Blockly.navigation.focusWorkspace()),
Blockly.Gesture.prototype.doStart=function(a){Blockly.utils.isTargetInput(a)?this.cancel():(this.hasStarted_=!0,Blockly.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,Blockly.hideChaff(!!this.flyout_),Blockly.Tooltip.block(),this.targetBlock_&&(this.targetBlock_.select(),!this.targetBlock_.isInFlyout&&a.shiftKey&&Blockly.navigation.enableKeyboardAccessibility()),
Blockly.utils.isRightButton(a)?this.handleRightClick(a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||Blockly.longStart_(a,this),this.mouseDownXY_=new Blockly.utils.Coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a)))};
Blockly.Gesture.prototype.bindMouseEvents=function(a){this.onMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",null,this.handleMove.bind(this));this.onUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",null,this.handleUp.bind(this));a.preventDefault();a.stopPropagation()};
Blockly.Gesture.prototype.handleMove=function(a){this.updateFromEvent_(a);this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_);a.preventDefault();a.stopPropagation()};
@@ -409,11 +563,12 @@ Blockly.Gesture.prototype.handleWsStart=function(a,b){if(this.hasStarted_)throw
Blockly.Gesture.prototype.handleBlockStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(b);this.mostRecentEvent_=a};Blockly.Gesture.prototype.handleBubbleStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(b);this.mostRecentEvent_=a};
Blockly.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus();this.startBubble_.select&&this.startBubble_.select()};Blockly.Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor_();this.bringBlockToFront_()};
Blockly.Gesture.prototype.doBlockClick_=function(){this.flyout_&&this.flyout_.autoClose?this.targetBlock_.isEnabled()&&(Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump()):Blockly.Events.fire(new Blockly.Events.Ui(this.startBlock_,"click",void 0,void 0));this.bringBlockToFront_();Blockly.Events.setGroup(!1)};
Blockly.Gesture.prototype.doWorkspaceClick_=function(a){Blockly.keyboardAccessibilityMode=!1;var b=this.creatorWorkspace_;b.cursor.hide();a.shiftKey?(a=new Blockly.utils.Coordinate(a.clientX,a.clientY),a=Blockly.utils.screenToWsCoordinates(b,a),a=Blockly.ASTNode.createWorkspaceNode(b,a),b.cursor.setLocation(a),Blockly.keyboardAccessibilityMode=!0):Blockly.selected&&Blockly.selected.unselect()};Blockly.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()};
Blockly.Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)};Blockly.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)};Blockly.Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||(this.startBlock_=a,a.isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))};
Blockly.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a};Blockly.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)};Blockly.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)};Blockly.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_};
Blockly.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()};Blockly.Gesture.prototype.isFieldClick_=function(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)};Blockly.Gesture.prototype.isWorkspaceClick_=function(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_};
Blockly.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_};Blockly.Gesture.prototype.hasStarted=function(){return this.hasStarted_};Blockly.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]};Blockly.Gesture.inProgress=function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1};Blockly.Grid=function(a,b){this.gridPattern_=a;this.spacing_=b.spacing;this.length_=b.length;this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling;this.snapToGrid_=b.snap};Blockly.Grid.prototype.scale_=1;Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null};Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_};Blockly.Grid.prototype.getSpacing=function(){return this.spacing_};Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id};
Blockly.Gesture.prototype.doWorkspaceClick_=function(a){Blockly.navigation.disableKeyboardAccessibility();var b=this.creatorWorkspace_;b.cursor.hide();a.shiftKey?(a=new Blockly.utils.Coordinate(a.clientX,a.clientY),a=Blockly.utils.screenToWsCoordinates(b,a),a=Blockly.ASTNode.createWorkspaceNode(b,a),b.cursor.setLocation(a),Blockly.navigation.enableKeyboardAccessibility()):Blockly.selected&&Blockly.selected.unselect()};
Blockly.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()};Blockly.Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)};Blockly.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)};
Blockly.Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||(this.startBlock_=a,a.isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))};Blockly.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a};Blockly.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)};
Blockly.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)};Blockly.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_};Blockly.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()};Blockly.Gesture.prototype.isFieldClick_=function(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)};
Blockly.Gesture.prototype.isWorkspaceClick_=function(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_};Blockly.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_};Blockly.Gesture.prototype.hasStarted=function(){return this.hasStarted_};Blockly.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]};
Blockly.Gesture.inProgress=function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1};Blockly.Grid=function(a,b){this.gridPattern_=a;this.spacing_=b.spacing;this.length_=b.length;this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling;this.snapToGrid_=b.snap};Blockly.Grid.prototype.scale_=1;Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null};Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_};Blockly.Grid.prototype.getSpacing=function(){return this.spacing_};Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id};
Blockly.Grid.prototype.update=function(a){this.scale_=a;var b=this.spacing_*a||100;this.gridPattern_.setAttribute("width",b);this.gridPattern_.setAttribute("height",b);b=Math.floor(this.spacing_/2)+.5;var c=b-this.length_/2,d=b+this.length_/2;b*=a;c*=a;d*=a;this.setLineAttributes_(this.line1_,a,c,d,b,b);this.setLineAttributes_(this.line2_,a,b,b,c,d)};
Blockly.Grid.prototype.setLineAttributes_=function(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b),a.setAttribute("x1",c),a.setAttribute("y1",e),a.setAttribute("x2",d),a.setAttribute("y2",f))};Blockly.Grid.prototype.moveTo=function(a,b){this.gridPattern_.setAttribute("x",a);this.gridPattern_.setAttribute("y",b);(Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE)&&this.update(this.scale_)};
Blockly.Grid.createDom=function(a,b,c){a=Blockly.utils.dom.createSvgElement("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c);0<b.length&&0<b.spacing?(Blockly.utils.dom.createSvgElement("line",{stroke:b.colour},a),1<b.length&&Blockly.utils.dom.createSvgElement("line",{stroke:b.colour},a)):Blockly.utils.dom.createSvgElement("line",{},a);return a};Blockly.Options=function(a){var b=!!a.readOnly;if(b)var c=null,d=!1,e=!1,f=!1,g=!1,h=!1,k=!1;else{c=Blockly.Options.parseToolboxTree(a.toolbox||null);d=!(!c||!c.getElementsByTagName("category").length);e=a.trashcan;void 0===e&&(e=d);var l=a.maxTrashcanContents;e?void 0===l&&(l=32):l=0;f=a.collapse;void 0===f&&(f=d);g=a.comments;void 0===g&&(g=d);h=a.disable;void 0===h&&(h=d);k=a.sounds;void 0===k&&(k=!0)}var m=!!a.rtl,n=a.horizontalLayout;void 0===n&&(n=!1);var p=a.toolboxPosition;p="end"===p?!1:
@@ -525,8 +680,8 @@ Blockly.ZoomControls.prototype.createZoomResetSvg_=function(a){var b=this.worksp
a+")"},this.zoomResetGroup_);a.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",b.options.pathToMedia+Blockly.SPRITE.url);Blockly.bindEventWithChecks_(a,"mousedown",null,function(a){b.markFocused();b.setScale(b.options.zoomOptions.startScale);b.beginCanvasTransition();b.scrollCenter();setTimeout(b.endCanvasTransition.bind(b),500);Blockly.Touch.clearTouchIdentifier();a.stopPropagation();a.preventDefault()})};
Blockly.WorkspaceSvg=function(a,b,c){Blockly.WorkspaceSvg.superClass_.constructor.call(this,a);this.getMetrics=a.getMetrics||Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_;this.setMetrics=a.setMetrics||Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_;this.connectionDBList=Blockly.ConnectionDB.init();b&&(this.blockDragSurface_=b);c&&(this.workspaceDragSurface_=c);this.useWorkspaceDragSurface_=this.workspaceDragSurface_&&Blockly.utils.is3dSupported();this.highlightedBlocks_=[];this.audioManager_=
new Blockly.WorkspaceAudio(a.parentWorkspace);this.grid_=this.options.gridPattern?new Blockly.Grid(a.gridPattern,a.gridOptions):null;Blockly.Variables&&Blockly.Variables.flyoutCategory&&this.registerToolboxCategoryCallback(Blockly.VARIABLE_CATEGORY_NAME,Blockly.Variables.flyoutCategory);Blockly.VariablesDynamic&&Blockly.VariablesDynamic.flyoutCategory&&this.registerToolboxCategoryCallback(Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME,Blockly.VariablesDynamic.flyoutCategory);Blockly.Procedures&&Blockly.Procedures.flyoutCategory&&
this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,Blockly.Procedures.flyoutCategory)};goog.inherits(Blockly.WorkspaceSvg,Blockly.Workspace);Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_=null;Blockly.WorkspaceSvg.prototype.rendered=!0;Blockly.WorkspaceSvg.prototype.isVisible_=!0;Blockly.WorkspaceSvg.prototype.isFlyout=!1;Blockly.WorkspaceSvg.prototype.isMutator=!1;Blockly.WorkspaceSvg.prototype.resizesEnabled_=!0;Blockly.WorkspaceSvg.prototype.scrollX=0;
Blockly.WorkspaceSvg.prototype.scrollY=0;Blockly.WorkspaceSvg.prototype.startScrollX=0;Blockly.WorkspaceSvg.prototype.startScrollY=0;Blockly.WorkspaceSvg.prototype.dragDeltaXY_=null;Blockly.WorkspaceSvg.prototype.scale=1;Blockly.WorkspaceSvg.prototype.trashcan=null;Blockly.WorkspaceSvg.prototype.scrollbar=null;Blockly.WorkspaceSvg.prototype.flyout_=null;Blockly.WorkspaceSvg.prototype.toolbox_=null;Blockly.WorkspaceSvg.prototype.currentGesture_=null;
this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,Blockly.Procedures.flyoutCategory);Blockly.blockRendering.init()};goog.inherits(Blockly.WorkspaceSvg,Blockly.Workspace);Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_=null;Blockly.WorkspaceSvg.prototype.rendered=!0;Blockly.WorkspaceSvg.prototype.isVisible_=!0;Blockly.WorkspaceSvg.prototype.isFlyout=!1;Blockly.WorkspaceSvg.prototype.isMutator=!1;Blockly.WorkspaceSvg.prototype.resizesEnabled_=!0;
Blockly.WorkspaceSvg.prototype.scrollX=0;Blockly.WorkspaceSvg.prototype.scrollY=0;Blockly.WorkspaceSvg.prototype.startScrollX=0;Blockly.WorkspaceSvg.prototype.startScrollY=0;Blockly.WorkspaceSvg.prototype.dragDeltaXY_=null;Blockly.WorkspaceSvg.prototype.scale=1;Blockly.WorkspaceSvg.prototype.trashcan=null;Blockly.WorkspaceSvg.prototype.scrollbar=null;Blockly.WorkspaceSvg.prototype.flyout_=null;Blockly.WorkspaceSvg.prototype.toolbox_=null;Blockly.WorkspaceSvg.prototype.currentGesture_=null;
Blockly.WorkspaceSvg.prototype.blockDragSurface_=null;Blockly.WorkspaceSvg.prototype.workspaceDragSurface_=null;Blockly.WorkspaceSvg.prototype.useWorkspaceDragSurface_=!1;Blockly.WorkspaceSvg.prototype.isDragSurfaceActive_=!1;Blockly.WorkspaceSvg.prototype.injectionDiv_=null;Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_=null;Blockly.WorkspaceSvg.prototype.flyoutButtonCallbacks_={};Blockly.WorkspaceSvg.prototype.toolboxCategoryCallbacks_={};
Blockly.WorkspaceSvg.prototype.configureContextMenu=null;Blockly.WorkspaceSvg.prototype.targetWorkspace=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTM_=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTMDirty_=!0;Blockly.WorkspaceSvg.prototype.createCursor=function(){return new Blockly.CursorSvg(this)};Blockly.WorkspaceSvg.prototype.createMarker=function(){return new Blockly.CursorSvg(this,!0)};
Blockly.WorkspaceSvg.prototype.getInverseScreenCTM=function(){if(this.inverseScreenCTMDirty_){var a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM_=a.inverse(),this.inverseScreenCTMDirty_=!1)}return this.inverseScreenCTM_};Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM=function(){this.inverseScreenCTMDirty_=!0};Blockly.WorkspaceSvg.prototype.isVisible=function(){return this.isVisible_};
@@ -618,8 +773,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,c){this.size_=new Blockly.utils.Size(0,0);if(c){var d=c.tooltip;"string"==typeof d&&(d=Blockly.utils.replaceMessageReferences(c.tooltip));d&&this.setTooltip(d)}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.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,c){this.size_=new Blockly.utils.Size(0,0);this.setValue(a);this.setValidator(b);this.configure_(c)};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.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.configure_=function(a){if(a){var b=a.tooltip;"string"==typeof b&&(b=Blockly.utils.replaceMessageReferences(a.tooltip));b&&this.setTooltip(b)}};
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_)};
@@ -634,10 +789,10 @@ Blockly.Field.prototype.callValidator=function(a){var b=this.classValidator(a);i
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()))};
Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_())};
Blockly.Field.prototype.getDisplayText_=function(){var a=this.getText();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_&&this.sourceBlock_.RTL&&(a+="\u200f");return a};Blockly.Field.prototype.getText=function(){if(this.getText_){var a=this.getText_.call(this);if(null!==a)return String(a)}return String(this.getValue())};
Blockly.Field.prototype.setText=function(a){throw Error("setText method is deprecated");};Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_())};
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.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};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.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');a=a.toLowerCase();Blockly.fieldRegistry.typeMap_[a]=b};
Blockly.fieldRegistry.fromJson=function(a){var b=a.type.toLowerCase();b=Blockly.fieldRegistry.typeMap_[b];return b?b.fromJson(a):(console.warn("Blockly could not create a field of type "+a.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)};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;
@@ -705,132 +860,7 @@ Blockly.BlockDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_
Blockly.BlockDragSurfaceSvg.prototype.setBlocksAndShow=function(a){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(a);this.SVG_.style.display="block";this.surfaceXY_=new Blockly.utils.Coordinate(0,0)};Blockly.BlockDragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){this.scale_=c;a=a.toFixed(0);b=b.toFixed(0);this.dragGroup_.setAttribute("transform","translate("+a+","+b+") scale("+c+")")};
Blockly.BlockDragSurfaceSvg.prototype.translateSurfaceInternal_=function(){var a=this.surfaceXY_.x,b=this.surfaceXY_.y;a=a.toFixed(0);b=b.toFixed(0);this.SVG_.style.display="block";Blockly.utils.dom.setCssTransform(this.SVG_,"translate3d("+a+"px, "+b+"px, 0px)")};Blockly.BlockDragSurfaceSvg.prototype.translateSurface=function(a,b){this.surfaceXY_=new Blockly.utils.Coordinate(a*this.scale_,b*this.scale_);this.translateSurfaceInternal_()};
Blockly.BlockDragSurfaceSvg.prototype.getSurfaceTranslation=function(){var a=Blockly.utils.getRelativeXY(this.SVG_);return new Blockly.utils.Coordinate(a.x/this.scale_,a.y/this.scale_)};Blockly.BlockDragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_};Blockly.BlockDragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.firstChild};
Blockly.BlockDragSurfaceSvg.prototype.clearAndHide=function(a){a?a.appendChild(this.getCurrentBlock()):this.dragGroup_.removeChild(this.getCurrentBlock());this.SVG_.style.display="none";if(this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null};Blockly.utils.svgPaths={};Blockly.utils.svgPaths.point=function(a,b){return" "+a+","+b+" "};Blockly.utils.svgPaths.curve=function(a,b){return" "+a+b.join("")};Blockly.utils.svgPaths.moveTo=function(a,b){return" M "+a+","+b+" "};Blockly.utils.svgPaths.moveBy=function(a,b){return" m "+a+","+b+" "};Blockly.utils.svgPaths.lineTo=function(a,b){return" l "+a+","+b+" "};Blockly.utils.svgPaths.line=function(a){return" l"+a.join("")};Blockly.utils.svgPaths.lineOnAxis=function(a,b){return" "+a+" "+b+" "};
Blockly.utils.svgPaths.arc=function(a,b,c,d){return a+" "+c+" "+c+" "+b+d};Blockly.blockRendering={};Blockly.blockRendering.constants={};Blockly.blockRendering.constants.NO_PADDING=0;Blockly.blockRendering.constants.SMALL_PADDING=3;Blockly.blockRendering.constants.MEDIUM_PADDING=5;Blockly.blockRendering.constants.MEDIUM_LARGE_PADDING=8;Blockly.blockRendering.constants.LARGE_PADDING=10;Blockly.blockRendering.constants.TALL_INPUT_FIELD_OFFSET_Y=Blockly.blockRendering.constants.MEDIUM_PADDING;Blockly.blockRendering.constants.DARK_PATH_OFFSET=1;
Blockly.blockRendering.constants.TAB_HEIGHT=15;Blockly.blockRendering.constants.TAB_OFFSET_FROM_TOP=5;Blockly.blockRendering.constants.TAB_VERTICAL_OVERLAP=2.5;Blockly.blockRendering.constants.TAB_WIDTH=8;Blockly.blockRendering.constants.NOTCH_WIDTH=15;Blockly.blockRendering.constants.NOTCH_HEIGHT=4;Blockly.blockRendering.constants.MIN_BLOCK_WIDTH=12;Blockly.blockRendering.constants.EMPTY_BLOCK_SPACER_HEIGHT=16;Blockly.blockRendering.constants.CORNER_RADIUS=8;
Blockly.blockRendering.constants.NOTCH_OFFSET_LEFT=Blockly.blockRendering.constants.NOTCH_WIDTH;Blockly.blockRendering.constants.STATEMENT_BOTTOM_SPACER=5;Blockly.blockRendering.constants.STATEMENT_INPUT_PADDING_LEFT=20;Blockly.blockRendering.constants.BETWEEN_STATEMENT_PADDING_Y=4;Blockly.blockRendering.constants.MAX_BOTTOM_WIDTH=66.5;Blockly.blockRendering.constants.START_HAT_HEIGHT=15;Blockly.blockRendering.constants.START_HAT_WIDTH=100;Blockly.blockRendering.constants.SPACER_DEFAULT_HEIGHT=15;
Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT=24;Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_PADDING=14.5;Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_HEIGHT=Blockly.blockRendering.constants.TAB_HEIGHT+11;Blockly.blockRendering.constants.EXTERNAL_VALUE_INPUT_PADDING=2;Blockly.blockRendering.constants.EMPTY_STATEMENT_INPUT_HEIGHT=Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT;Blockly.blockRendering.constants.START_POINT=Blockly.utils.svgPaths.moveBy(0,0);
Blockly.blockRendering.constants.JAGGED_TEETH_HEIGHT=12;Blockly.blockRendering.constants.JAGGED_TEETH_WIDTH=6;Blockly.blockRendering.constants.JAGGED_TEETH=function(){var a=Blockly.blockRendering.constants.JAGGED_TEETH_HEIGHT,b=Blockly.blockRendering.constants.JAGGED_TEETH_WIDTH,c=Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(6,3),Blockly.utils.svgPaths.point(-12,6),Blockly.utils.svgPaths.point(6,3)]);return{height:a,width:b,path:c}}();
Blockly.blockRendering.constants.START_HAT=function(){var a=Blockly.blockRendering.constants.START_HAT_HEIGHT,b=Blockly.blockRendering.constants.START_HAT_WIDTH,c=Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(30,-a),Blockly.utils.svgPaths.point(70,-a),Blockly.utils.svgPaths.point(b,0)]);return{height:a,width:b,path:c}}();
Blockly.blockRendering.constants.PUZZLE_TAB=function(){function a(a){a=a?-1:1;var d=-a,e=c/2,f=e+2.5,l=e+.5,m=Blockly.utils.svgPaths.point(-b,a*e);e=Blockly.utils.svgPaths.point(b,a*e);return Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(0,a*f),Blockly.utils.svgPaths.point(-b,d*l),m])+Blockly.utils.svgPaths.curve("s",[Blockly.utils.svgPaths.point(b,2.5*d),e])}var b=Blockly.blockRendering.constants.TAB_WIDTH,c=Blockly.blockRendering.constants.TAB_HEIGHT,d=a(!0),e=a(!1);return{width:b,
height:c,pathDown:e,pathUp:d}}();Blockly.blockRendering.constants.TRIANGLE=function(){function a(a){a=a?-1:1;return Blockly.utils.svgPaths.lineTo(-20,20*a/2)+Blockly.utils.svgPaths.lineTo(20,20*a/2)}var b=a(!0);return{width:20,height:20,pathDown:a(!1),pathUp:b}}();
Blockly.blockRendering.constants.NOTCH=function(){function a(a){return Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*d,c),Blockly.utils.svgPaths.point(3*a,0),Blockly.utils.svgPaths.point(a*d,-c)])}var b=Blockly.blockRendering.constants.NOTCH_WIDTH,c=Blockly.blockRendering.constants.NOTCH_HEIGHT,d=(b-3)/2,e=a(1),f=a(-1);return{width:b,height:c,pathLeft:e,pathRight:f}}();
Blockly.blockRendering.constants.INSIDE_CORNERS=function(){var a=Blockly.blockRendering.constants.CORNER_RADIUS,b=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-a,a)),c=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(a,a));return{width:a,height:a,pathTop:b,pathBottom:c}}();
Blockly.blockRendering.constants.OUTSIDE_CORNERS=function(){var a=Blockly.blockRendering.constants.CORNER_RADIUS,b=Blockly.utils.svgPaths.moveBy(0,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,-a));a=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,-a));return{topLeft:b,bottomLeft:a}}();Blockly.blockRendering.Measurable=function(){this.isInput=!1;this.height=this.width=0;this.type=null;this.centerline=this.xPos=0};Blockly.blockRendering.Measurable.prototype.connectionShape=Blockly.blockRendering.constants.PUZZLE_TAB;Blockly.blockRendering.Measurable.prototype.notchShape=Blockly.blockRendering.constants.NOTCH;Blockly.blockRendering.Measurable.prototype.notchOffset=Blockly.blockRendering.constants.NOTCH_OFFSET_LEFT;
Blockly.blockRendering.Measurable.prototype.isField=function(){return"field"==this.type};Blockly.blockRendering.Measurable.prototype.isHat=function(){return"hat"==this.type};Blockly.blockRendering.Measurable.prototype.isIcon=function(){return"icon"==this.type};Blockly.blockRendering.Measurable.prototype.isSpacer=function(){return"between-row spacer"==this.type||"in-row spacer"==this.type};Blockly.blockRendering.Measurable.prototype.isExternalInput=function(){return"external value input"==this.type};
Blockly.blockRendering.Measurable.prototype.isInlineInput=function(){return"inline input"==this.type};Blockly.blockRendering.Measurable.prototype.isStatementInput=function(){return"statement input"==this.type};Blockly.blockRendering.Measurable.prototype.isPreviousConnection=function(){return"previous connection"==this.type};Blockly.blockRendering.Measurable.prototype.isNextConnection=function(){return"next connection"==this.type};
Blockly.blockRendering.Measurable.prototype.isRoundedCorner=function(){return"round corner"==this.type};Blockly.blockRendering.Measurable.prototype.isSquareCorner=function(){return"square corner"==this.type};Blockly.blockRendering.Measurable.prototype.isJaggedEdge=function(){return"jagged edge"==this.type};Blockly.blockRendering.Connection=function(a){Blockly.blockRendering.Connection.superClass_.constructor.call(this);this.connectionModel=a};goog.inherits(Blockly.blockRendering.Connection,Blockly.blockRendering.Measurable);
Blockly.blockRendering.OutputConnection=function(a){Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,a);this.type="output connection";this.height=this.connectionShape.height;this.width=this.connectionShape.width;this.connectionOffsetY=Blockly.blockRendering.constants.TAB_OFFSET_FROM_TOP;this.startX=this.width};goog.inherits(Blockly.blockRendering.OutputConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.PreviousConnection=function(a){Blockly.blockRendering.PreviousConnection.superClass_.constructor.call(this,a);this.type="previous connection";this.height=this.notchShape.height;this.width=this.notchShape.width};goog.inherits(Blockly.blockRendering.PreviousConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.NextConnection=function(a){Blockly.blockRendering.NextConnection.superClass_.constructor.call(this,a);this.type="next connection";this.height=this.notchShape.height;this.width=this.notchShape.width};goog.inherits(Blockly.blockRendering.NextConnection,Blockly.blockRendering.Connection);Blockly.blockRendering.InputConnection=function(a){Blockly.blockRendering.InputConnection.superClass_.constructor.call(this,a.connection);this.isInput=!0;this.input=a;this.align=a.align;if(this.connectedBlock=a.connection&&a.connection.targetBlock()?a.connection.targetBlock():null){var b=this.connectedBlock.getHeightWidth();this.connectedBlockWidth=b.width;this.connectedBlockHeight=b.height}else this.connectedBlockHeight=this.connectedBlockWidth=0;this.connection=a.connection;this.connectionOffsetY=
this.connectionOffsetX=0};goog.inherits(Blockly.blockRendering.InputConnection,Blockly.blockRendering.Connection);
Blockly.blockRendering.InlineInput=function(a){Blockly.blockRendering.InlineInput.superClass_.constructor.call(this,a);this.type="inline input";this.connectedBlock?(this.width=this.connectedBlockWidth+Blockly.blockRendering.constants.DARK_PATH_OFFSET,this.height=this.connectedBlockHeight+Blockly.blockRendering.constants.DARK_PATH_OFFSET):(this.height=Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.connectionShape.width+Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_PADDING);
this.connectionOffsetY=Blockly.blockRendering.constants.TAB_OFFSET_FROM_TOP;this.connectionHeight=this.connectionShape.height;this.connectionWidth=this.connectionShape.width};goog.inherits(Blockly.blockRendering.InlineInput,Blockly.blockRendering.InputConnection);
Blockly.blockRendering.StatementInput=function(a){Blockly.blockRendering.StatementInput.superClass_.constructor.call(this,a);this.type="statement input";this.connectedBlock?(this.height=this.connectedBlockHeight+Blockly.blockRendering.constants.STATEMENT_BOTTOM_SPACER,this.connectedBlock.nextConnection&&(this.height-=this.notchShape.height)):this.height=Blockly.blockRendering.constants.EMPTY_STATEMENT_INPUT_HEIGHT;this.width=Blockly.blockRendering.constants.NOTCH_OFFSET_LEFT+this.notchShape.width};
goog.inherits(Blockly.blockRendering.StatementInput,Blockly.blockRendering.InputConnection);
Blockly.blockRendering.ExternalValueInput=function(a){Blockly.blockRendering.ExternalValueInput.superClass_.constructor.call(this,a);this.type="external value input";this.height=this.connectedBlock?this.connectedBlockHeight-2*Blockly.blockRendering.constants.TAB_OFFSET_FROM_TOP:this.connectionShape.height;this.width=this.connectionShape.width+Blockly.blockRendering.constants.EXTERNAL_VALUE_INPUT_PADDING;this.connectionOffsetY=Blockly.blockRendering.constants.TAB_OFFSET_FROM_TOP;this.connectionHeight=
this.connectionShape.height;this.connectionWidth=this.connectionShape.width};goog.inherits(Blockly.blockRendering.ExternalValueInput,Blockly.blockRendering.InputConnection);Blockly.blockRendering.Icon=function(a){Blockly.blockRendering.Icon.superClass_.constructor.call(this);this.icon=a;this.isVisible=a.isVisible();this.type="icon";a=a.getCorrectedSize();this.height=a.height;this.width=a.width};goog.inherits(Blockly.blockRendering.Icon,Blockly.blockRendering.Measurable);
Blockly.blockRendering.JaggedEdge=function(){Blockly.blockRendering.JaggedEdge.superClass_.constructor.call(this);this.type="jagged edge";this.height=Blockly.blockRendering.constants.JAGGED_TEETH.height;this.width=Blockly.blockRendering.constants.JAGGED_TEETH.width};goog.inherits(Blockly.blockRendering.JaggedEdge,Blockly.blockRendering.Measurable);
Blockly.blockRendering.Field=function(a,b){Blockly.blockRendering.Field.superClass_.constructor.call(this);this.field=a;this.isEditable=a.isCurrentlyEditable();this.flipRtl=a instanceof Blockly.FieldImage&&a.getFlipRtl();this.type="field";var c=this.field.getSize();this.height=c.height;this.width=c.width;this.parentInput=b};goog.inherits(Blockly.blockRendering.Field,Blockly.blockRendering.Measurable);
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.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.Row=function(){this.type="row";this.elements=[];this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=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.notchOffset=Blockly.blockRendering.constants.NOTCH_OFFSET_LEFT;
Blockly.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};Blockly.blockRendering.Row.prototype.getLastInput=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(!b.isSpacer()){if(b.isInput)return b;if(b.isField())return b.parentInput}return null};Blockly.blockRendering.Row.prototype.getFirstSpacer=function(){for(var a=0,b;b=this.elements[a];a++)if(b.isSpacer)return b;return null};
Blockly.blockRendering.Row.prototype.getLastSpacer=function(){for(var a=this.elements.length-1,b;b=this.elements[a];a--)if(b.isSpacer)return b;return null};Blockly.blockRendering.TopRow=function(){Blockly.blockRendering.TopRow.superClass_.constructor.call(this);this.type="top row";this.startY=0;this.hasPreviousConnection=!1;this.connection=null};goog.inherits(Blockly.blockRendering.TopRow,Blockly.blockRendering.Row);
Blockly.blockRendering.TopRow.prototype.populate=function(a){var b=a.hat?"cap"===a.hat:Blockly.BlockSvg.START_HAT,c=!!a.previousConnection,d=a.getPreviousBlock();a.outputConnection||b||d&&d.getNextBlock()==a?this.elements.push(new Blockly.blockRendering.SquareCorner):this.elements.push(new Blockly.blockRendering.RoundCorner);b?(b=new Blockly.blockRendering.Hat,this.elements.push(b),this.startY=b.startY):c&&(this.hasPreviousConnection=!0,this.connection=new Blockly.blockRendering.PreviousConnection(a.previousConnection),
this.elements.push(this.connection));a.inputList.length&&a.inputList[0].type==Blockly.NEXT_STATEMENT&&!a.isCollapsed()?this.minHeight=Blockly.blockRendering.constants.LARGE_PADDING:this.minHeight=Blockly.blockRendering.constants.MEDIUM_PADDING};
Blockly.blockRendering.TopRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b;b=this.elements[a];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(){Blockly.blockRendering.BottomRow.superClass_.constructor.call(this);this.type="bottom row";this.hasNextConnection=!1;this.connection=null;this.overhangY=0;this.hasFixedWidth=!1};goog.inherits(Blockly.blockRendering.BottomRow,Blockly.blockRendering.Row);
Blockly.blockRendering.BottomRow.prototype.populate=function(a){this.hasNextConnection=!!a.nextConnection;var b=a.inputList.length&&a.inputList[a.inputList.length-1].type==Blockly.NEXT_STATEMENT;this.hasFixedWidth=b&&a.getInputsInline();this.minHeight=b?Blockly.blockRendering.constants.LARGE_PADDING:this.notchShape.height;a.outputConnection||a.getNextBlock()?this.elements.push(new Blockly.blockRendering.SquareCorner):this.elements.push(new Blockly.blockRendering.RoundCorner);this.hasNextConnection&&
(this.connection=new Blockly.blockRendering.NextConnection(a.nextConnection),this.elements.push(this.connection))};Blockly.blockRendering.BottomRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b;b=this.elements[a];a++)this.width+=b.width,b.isSpacer()||("next connection"==b.type&&(this.height+=b.height,this.overhangY=b.height),this.height=Math.max(this.height,b.height));this.widthWithConnectedBlocks=this.width};
Blockly.blockRendering.SpacerRow=function(a,b){this.type="between-row spacer";this.width=b;this.height=a;this.followsStatement=!1;this.widthWithConnectedBlocks=0;this.elements=[new Blockly.blockRendering.InRowSpacer(b)]};goog.inherits(Blockly.blockRendering.SpacerRow,Blockly.blockRendering.Row);Blockly.blockRendering.SpacerRow.prototype.measure=function(){};Blockly.blockRendering.InputRow=function(){Blockly.blockRendering.InputRow.superClass_.constructor.call(this);this.type="input row"};
goog.inherits(Blockly.blockRendering.InputRow,Blockly.blockRendering.Row);
Blockly.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b=0,c;c=this.elements[b];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.InputRow.prototype.getLastSpacer=function(){if(this.hasExternalInput||this.hasStatement)for(var a=this.elements,b=a.length-1,c;c=a[b];b--)if(!c.isSpacer()&&c.isInput)return a[b-1];return Blockly.blockRendering.InputRow.superClass_.getLastSpacer.call(this)};Blockly.blockRendering.RenderInfo=function(a){this.block_=a;this.outputConnection=a.outputConnection?new Blockly.blockRendering.OutputConnection(a.outputConnection):null;this.isInline=a.getInputsInline()&&!a.isCollapsed();this.isCollapsed=a.isCollapsed();this.isInsertionMarker=a.isInsertionMarker();this.RTL=a.RTL;this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.hiddenIcons=[];this.topRow=new Blockly.blockRendering.TopRow;this.bottomRow=new Blockly.blockRendering.BottomRow;
this.startY=this.startX=0;this.measure_()};Blockly.blockRendering.RenderInfo.prototype.measure_=function(){this.createRows_();this.addElemSpacing_();this.computeBounds_();this.alignRowElements_();this.addRowSpacing_();this.finalize_()};
Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.topRow.populate(this.block_);this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow,b=this.block_.getIcons();if(b.length)for(var c=0,d;d=b[c];c++){var e=new Blockly.blockRendering.Icon(d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}d=void 0;for(c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){this.shouldStartNewRow_(b,d)&&(this.rows.push(a),a=new Blockly.blockRendering.InputRow);
for(d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(e,b));this.addInput_(b,a);d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge));a.elements.length&&this.rows.push(a);this.bottomRow.populate(this.block_);this.rows.push(this.bottomRow)};
Blockly.blockRendering.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.InlineInput(a)),b.hasInlineInput=!0):a.type==Blockly.NEXT_STATEMENT?(b.elements.push(new Blockly.blockRendering.StatementInput(a)),b.hasStatement=!0):a.type==Blockly.INPUT_VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(a)),b.hasExternalInput=!0):a.type==Blockly.DUMMY_INPUT&&(b.hasDummyInput=!0)};
Blockly.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var a=0,b;b=this.rows[a];a++){var c=b.elements;b.elements=[];"top row"!=b.type&&"bottom row"!=b.type&&b.elements.push(new Blockly.blockRendering.InRowSpacer(this.getInRowSpacing_(null,c[0])));for(var d=0;d<c.length;d++){b.elements.push(c[d]);var e=this.getInRowSpacing_(c[d],c[d+1]);b.elements.push(new Blockly.blockRendering.InRowSpacer(e))}}};
Blockly.blockRendering.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(a&&a.isInput&&!b){if(a.isExternalInput())return Blockly.blockRendering.constants.NO_PADDING;if(a.isInlineInput())return Blockly.blockRendering.constants.LARGE_PADDING;if(a.isStatementInput())return Blockly.blockRendering.constants.NO_PADDING}return Blockly.blockRendering.constants.MEDIUM_PADDING};
Blockly.blockRendering.RenderInfo.prototype.computeBounds_=function(){for(var a=0,b=0,c=0,d=0,e;e=this.rows[d];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;e=this.rows[d];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,b;b=this.rows[a];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;(c=d-c)&&this.addAlignmentPadding_(b,c)}};Blockly.blockRendering.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.getLastSpacer();c&&(c.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.SpacerRow(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 Blockly.blockRendering.constants.MEDIUM_PADDING};Blockly.blockRendering.RenderInfo.prototype.getElemCenterline_=function(a,b){return a.yPos+a.height/2};
Blockly.blockRendering.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];c++){d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);for(var e=d.xPos,f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.startY};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",
"0 0,1",a-b,Blockly.utils.svgPaths.point(-c+b,-f-a));return{height:a,topLeft:function(a){return a?d:e},bottomLeft:function(){return g}}}();
Blockly.blockRendering.highlightConstants.PUZZLE_TAB=function(){var a=Blockly.blockRendering.constants.TAB_WIDTH,b=Blockly.blockRendering.constants.TAB_HEIGHT,c=Blockly.utils.svgPaths.moveBy(-2,-b+3.4)+Blockly.utils.svgPaths.lineTo(-.45*a,-2.1),d=Blockly.utils.svgPaths.lineOnAxis("v",2.5)+Blockly.utils.svgPaths.moveBy(.97*-a,2.5)+Blockly.utils.svgPaths.curve("q",[Blockly.utils.svgPaths.point(.05*-a,10),Blockly.utils.svgPaths.point(.3*a,9.5)])+Blockly.utils.svgPaths.moveBy(.67*a,-1.9)+Blockly.utils.svgPaths.lineOnAxis("v",
2.5),e=Blockly.utils.svgPaths.lineOnAxis("v",-1.5)+Blockly.utils.svgPaths.moveBy(-.92*a,-.5)+Blockly.utils.svgPaths.curve("q",[Blockly.utils.svgPaths.point(-.19*a,-5.5),Blockly.utils.svgPaths.point(0,-11)])+Blockly.utils.svgPaths.moveBy(.92*a,1),f=Blockly.utils.svgPaths.moveBy(-5,b-.7)+Blockly.utils.svgPaths.lineTo(.46*a,-2.1);return{width:a,height:b,pathUp:function(a){return a?c:e},pathDown:function(a){return a?d:f}}}();
Blockly.blockRendering.highlightConstants.NOTCH=function(){return{pathLeft:Blockly.utils.svgPaths.lineOnAxis("h",Blockly.blockRendering.highlightConstants.OFFSET)+Blockly.blockRendering.constants.NOTCH.pathLeft}}();Blockly.blockRendering.highlightConstants.JAGGED_TEETH=function(){return{pathLeft:Blockly.utils.svgPaths.lineTo(5.1,2.6)+Blockly.utils.svgPaths.moveBy(-10.2,6.8)+Blockly.utils.svgPaths.lineTo(5.1,2.6)}}();
Blockly.blockRendering.highlightConstants.START_HAT=function(){var a=Blockly.blockRendering.constants.START_HAT.height,b=Blockly.utils.svgPaths.moveBy(25,-8.7)+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(29.7,-6.2),Blockly.utils.svgPaths.point(57.2,-.5),Blockly.utils.svgPaths.point(75,8.7)]),c=Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(17.8,-9.2),Blockly.utils.svgPaths.point(45.3,-14.9),Blockly.utils.svgPaths.point(75,-8.7)])+Blockly.utils.svgPaths.moveTo(100.5,
a+.5);return{path:function(a){return a?b:c}}}();Blockly.blockRendering.Highlighter=function(a,b){this.info_=a;this.pathObject_=b;this.steps_=this.pathObject_.highlightSteps;this.inlineSteps_=this.pathObject_.highlightInlineSteps;this.RTL_=this.info_.RTL;this.highlightOffset_=Blockly.blockRendering.highlightConstants.OFFSET;this.outsideCornerPaths_=Blockly.blockRendering.highlightConstants.OUTSIDE_CORNER;this.insideCornerPaths_=Blockly.blockRendering.highlightConstants.INSIDE_CORNER;this.puzzleTabPaths_=Blockly.blockRendering.highlightConstants.PUZZLE_TAB;
this.notchPaths_=Blockly.blockRendering.highlightConstants.NOTCH;this.startPaths_=Blockly.blockRendering.highlightConstants.START_HAT;this.jaggedTeethPaths_=Blockly.blockRendering.highlightConstants.JAGGED_TEETH};
Blockly.blockRendering.Highlighter.prototype.drawTopCorner=function(a){this.steps_.push(Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY));for(var b=0,c;c=a.elements[b];b++)"square corner"==c.type?this.steps_.push(Blockly.blockRendering.highlightConstants.START_POINT):"round corner"==c.type?this.steps_.push(this.outsideCornerPaths_.topLeft(this.RTL_)):"previous connection"==c.type?this.steps_.push(this.notchPaths_.pathLeft):"hat"==c.type?this.steps_.push(this.startPaths_.path(this.RTL_)):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();if(this.RTL_){var c=a.height-b.connectionHeight;a=Blockly.utils.svgPaths.moveTo(b.xPos+b.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)}else a=Blockly.utils.svgPaths.moveTo(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_);this.steps_.push(a)};
Blockly.blockRendering.Highlighter.prototype.drawStatementInput=function(a){var b=a.getLastInput();if(this.RTL_){var c=a.height-2*this.insideCornerPaths_.height;a=Blockly.utils.svgPaths.moveTo(b.xPos,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.xPos,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),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;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,e;e=a.elements[d];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,e;e=b.rows[d];d++)"between-row spacer"==e.type?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.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};
Blockly.blockRendering.Drawer.prototype.hideHiddenIcons_=function(){for(var a=0,b;b=this.info_.hiddenIcons[a];a++)b.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_()};
Blockly.blockRendering.Drawer.prototype.drawTop_=function(){var a=this.info_.topRow,b=a.elements;this.highlighter_&&(this.highlighter_.drawTopCorner(a),this.highlighter_.drawRightSideRow(a));this.positionPreviousConnection_();this.outlinePath_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var c=0,d;d=b[c];c++)"round corner"==d.type?this.outlinePath_+=Blockly.blockRendering.constants.OUTSIDE_CORNERS.topLeft:"previous connection"==d.type?this.outlinePath_+=a.notchShape.pathLeft:"hat"==
d.type?this.outlinePath_+=Blockly.blockRendering.constants.START_HAT.path:d.isSpacer()&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",d.width));this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height)};Blockly.blockRendering.Drawer.prototype.drawJaggedEdge_=function(a){this.highlighter_&&this.highlighter_.drawJaggedEdge_(a);this.outlinePath_+=Blockly.blockRendering.constants.JAGGED_TEETH.path+Blockly.utils.svgPaths.lineOnAxis("v",a.height-Blockly.blockRendering.constants.JAGGED_TEETH.height)};
Blockly.blockRendering.Drawer.prototype.drawValueInput_=function(a){var b=a.getLastInput();this.highlighter_&&this.highlighter_.drawValueInput(a);this.positionExternalValueConnection_(a);this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",b.xPos+b.width)+b.connectionShape.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",a.height-b.connectionHeight)};
Blockly.blockRendering.Drawer.prototype.drawStatementInput_=function(a){this.highlighter_&&this.highlighter_.drawStatementInput(a);var b=a.getLastInput(),c=b.xPos+b.width;b=b.notchShape.pathRight+Blockly.utils.svgPaths.lineOnAxis("h",-(b.notchOffset-Blockly.blockRendering.constants.INSIDE_CORNERS.width))+Blockly.blockRendering.constants.INSIDE_CORNERS.pathTop;var d=a.height-2*Blockly.blockRendering.constants.INSIDE_CORNERS.height;this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",c)+b+Blockly.utils.svgPaths.lineOnAxis("v",
d)+Blockly.blockRendering.constants.INSIDE_CORNERS.pathBottom;this.positionStatementInputConnection_(a)};Blockly.blockRendering.Drawer.prototype.drawRightSideRow_=function(a){this.highlighter_&&this.highlighter_.drawRightSideRow(a);this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos+a.width)+Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height)};
Blockly.blockRendering.Drawer.prototype.drawBottom_=function(){var a=this.info_.bottomRow,b=a.elements;this.highlighter_&&this.highlighter_.drawBottomRow(a);this.positionNextConnection_();this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height-a.overhangY);for(var c=b.length-1,d;d=b[c];c--)d.isNextConnection()?this.outlinePath_+=a.notchShape.pathRight:d.isSquareCorner()?this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos):d.isRoundedCorner()?this.outlinePath_+=Blockly.blockRendering.constants.OUTSIDE_CORNERS.bottomLeft:
d.isSpacer()&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("h",-1*d.width))};Blockly.blockRendering.Drawer.prototype.drawLeft_=function(){this.highlighter_&&this.highlighter_.drawLeft();var a=this.info_.outputConnection;this.positionOutputConnection_();a&&(this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("V",a.connectionOffsetY+a.height)+a.connectionShape.pathUp);this.outlinePath_+="z"};
Blockly.blockRendering.Drawer.prototype.drawInternals_=function(){for(var a=0,b;b=this.info_.rows[a];a++)for(var c=0,d;d=b.elements[c];c++)d.isInlineInput()?this.drawInlineInput_(d):(d.isIcon()||d.isField())&&this.layoutField_(d)};
Blockly.blockRendering.Drawer.prototype.layoutField_=function(a){if(a.isField())var b=a.field.getSvgRoot();else a.isIcon()&&(b=a.icon.iconGroup_);var c=a.centerline-a.height/2,d=a.xPos,e="";this.info_.RTL&&(d=-(d+a.width),a.flipRtl&&(d+=a.width,e="scale(-1 1)"));a.isIcon()?(b.setAttribute("display","block"),b.setAttribute("transform","translate("+d+","+c+")"),a.icon.computeIconLocation()):b.setAttribute("transform","translate("+d+","+c+")"+e);this.info_.isInsertionMarker&&b.setAttribute("display",
"none")};
Blockly.blockRendering.Drawer.prototype.drawInlineInput_=function(a){this.highlighter_&&this.highlighter_.drawInlineInput(a);var b=a.width,c=a.height,d=a.connectionOffsetY,e=a.connectionHeight+d;this.inlinePath_+=Blockly.utils.svgPaths.moveTo(a.xPos+a.connectionWidth,a.centerline-c/2)+Blockly.utils.svgPaths.lineOnAxis("v",d)+a.connectionShape.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",c-e)+Blockly.utils.svgPaths.lineOnAxis("h",b-a.connectionWidth)+Blockly.utils.svgPaths.lineOnAxis("v",-c)+"z";
this.positionInlineInputConnection_(a)};Blockly.blockRendering.Drawer.prototype.positionInlineInputConnection_=function(a){var b=a.centerline-a.height/2;if(a.connection){var c=a.xPos+a.connectionWidth+Blockly.blockRendering.constants.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);a.connection.setOffsetInBlock(c,b+a.connectionOffsetY+Blockly.blockRendering.constants.DARK_PATH_OFFSET)}};
Blockly.blockRendering.Drawer.prototype.positionStatementInputConnection_=function(a){var b=a.getLastInput();if(b.connection){var c=a.xPos+a.statementEdge+b.notchOffset;this.info_.RTL&&(c*=-1);b.connection.setOffsetInBlock(c+.5,a.yPos+Blockly.blockRendering.constants.DARK_PATH_OFFSET)}};
Blockly.blockRendering.Drawer.prototype.positionExternalValueConnection_=function(a){var b=a.getLastInput();if(b.connection){var c=a.xPos+a.width+Blockly.blockRendering.constants.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);b.connection.setOffsetInBlock(c,a.yPos)}};Blockly.blockRendering.Drawer.prototype.positionPreviousConnection_=function(){var a=this.info_.topRow;if(a.connection){var b=a.xPos+a.notchOffset;a.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-b:b,0)}};
Blockly.blockRendering.Drawer.prototype.positionNextConnection_=function(){var a=this.info_.bottomRow;if(a.connection){a=a.connection;var b=a.xPos;a.connectionModel.setOffsetInBlock((this.info_.RTL?-b:b)+.5,a.centerline-a.height/2+Blockly.blockRendering.constants.DARK_PATH_OFFSET)}};Blockly.blockRendering.Drawer.prototype.positionOutputConnection_=function(){if(this.info_.outputConnection){var a=this.info_.startX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-a:a,this.info_.outputConnection.connectionOffsetY)}};Blockly.geras={};Blockly.geras.RenderInfo=function(a){Blockly.geras.RenderInfo.superClass_.constructor.call(this,a)};goog.inherits(Blockly.geras.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.geras.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.geras.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b.isField()&&b.isEditable?Blockly.blockRendering.constants.MEDIUM_PADDING:b.isInput&&b.isInlineInput()?Blockly.blockRendering.constants.MEDIUM_LARGE_PADDING:b.isStatementInput()?Blockly.blockRendering.constants.STATEMENT_INPUT_PADDING_LEFT:Blockly.blockRendering.constants.LARGE_PADDING;if(!a.isInput&&!b)return a.isField()&&a.isEditable?Blockly.blockRendering.constants.MEDIUM_PADDING:a.isIcon()?2*Blockly.blockRendering.constants.LARGE_PADDING+
1:a.isHat()?Blockly.blockRendering.constants.NO_PADDING:a.isPreviousConnection()||a.isNextConnection()?Blockly.blockRendering.constants.LARGE_PADDING:a.isRoundedCorner()?Blockly.blockRendering.constants.MIN_BLOCK_WIDTH:a.isJaggedEdge()?Blockly.blockRendering.constants.NO_PADDING:Blockly.blockRendering.constants.LARGE_PADDING;if(a.isInput&&!b){if(a.isExternalInput())return Blockly.blockRendering.constants.NO_PADDING;if(a.isInlineInput())return Blockly.blockRendering.constants.LARGE_PADDING;if(a.isStatementInput())return Blockly.blockRendering.constants.NO_PADDING}if(!a.isInput&&
b.isInput){if(a.isEditable){if(b.isInlineInput()||b.isExternalInput())return Blockly.blockRendering.constants.SMALL_PADDING}else{if(b.isInlineInput()||b.isExternalInput())return Blockly.blockRendering.constants.MEDIUM_LARGE_PADDING;if(b.isStatementInput())return Blockly.blockRendering.constants.LARGE_PADDING}return Blockly.blockRendering.constants.LARGE_PADDING-1}if(a.isIcon()&&!b.isInput)return Blockly.blockRendering.constants.LARGE_PADDING;if(a.isInlineInput()&&!b.isInput)return b.isEditable?Blockly.blockRendering.constants.MEDIUM_PADDING:
Blockly.blockRendering.constants.LARGE_PADDING;if(a.isSquareCorner()){if(b.isHat())return Blockly.blockRendering.constants.NO_PADDING;if(b.isPreviousConnection())return b.notchOffset;if(b.isNextConnection()){var c=(this.RTL?1:-1)*Blockly.blockRendering.constants.DARK_PATH_OFFSET/2;return b.notchOffset+c}}if(a.isRoundedCorner()){if(b.isPreviousConnection())return b.notchOffset-Blockly.blockRendering.constants.CORNER_RADIUS;if(b.isNextConnection())return c=(this.RTL?1:-1)*Blockly.blockRendering.constants.DARK_PATH_OFFSET/
2,b.notchOffset-Blockly.blockRendering.constants.CORNER_RADIUS+c}return!a.isInput&&!b.isInput&&a.isEditable==b.isEditable||b.isJaggedEdge()?Blockly.blockRendering.constants.LARGE_PADDING:Blockly.blockRendering.constants.MEDIUM_PADDING};
Blockly.geras.RenderInfo.prototype.alignRowElements_=function(){for(var a=0,b;b=this.rows[a];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.geras.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.geras.RenderInfo.prototype.getSpacerRowWidth_=function(a,b){return"bottom row"==b.type&&b.hasFixedWidth?b.width:this.width-this.startX};
Blockly.geras.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.geras.RenderInfo.prototype.getElemCenterline_=function(a,b){var c=a.yPos;if(b.isField()||b.isIcon()){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.geras.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];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);e=d.xPos;for(var f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.widthWithChildren=a+this.startX;
this.height=b;this.startY=this.topRow.startY};Blockly.thrasos={};Blockly.thrasos.RenderInfo=function(a){Blockly.thrasos.RenderInfo.superClass_.constructor.call(this,a)};goog.inherits(Blockly.thrasos.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.thrasos.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type==Blockly.NEXT_STATEMENT?!0:a.type==Blockly.INPUT_VALUE||a.type==Blockly.DUMMY_INPUT?!this.isInline:!1:!1};
Blockly.thrasos.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b.isField()&&b.isEditable?Blockly.blockRendering.constants.MEDIUM_PADDING:b.isInput&&b.isInlineInput()?Blockly.blockRendering.constants.MEDIUM_LARGE_PADDING:b.isStatementInput()?Blockly.blockRendering.constants.STATEMENT_INPUT_PADDING_LEFT:Blockly.blockRendering.constants.LARGE_PADDING;if(!a.isInput&&!b)return a.isField()&&a.isEditable?Blockly.blockRendering.constants.MEDIUM_PADDING:a.isIcon()?2*Blockly.blockRendering.constants.LARGE_PADDING+
1:a.isHat()?Blockly.blockRendering.constants.NO_PADDING:a.isPreviousConnection()||a.isNextConnection()?Blockly.blockRendering.constants.LARGE_PADDING:a.isRoundedCorner()?Blockly.blockRendering.constants.MIN_BLOCK_WIDTH:a.isJaggedEdge()?Blockly.blockRendering.constants.NO_PADDING:Blockly.blockRendering.constants.LARGE_PADDING;if(a.isInput&&!b){if(a.isExternalInput())return Blockly.blockRendering.constants.NO_PADDING;if(a.isInlineInput())return Blockly.blockRendering.constants.LARGE_PADDING;if(a.isStatementInput())return Blockly.blockRendering.constants.NO_PADDING}if(!a.isInput&&
b.isInput){if(a.isEditable){if(b.isInlineInput()||b.isExternalInput())return Blockly.blockRendering.constants.SMALL_PADDING}else{if(b.isInlineInput()||b.isExternalInput())return Blockly.blockRendering.constants.MEDIUM_LARGE_PADDING;if(b.isStatementInput())return Blockly.blockRendering.constants.LARGE_PADDING}return Blockly.blockRendering.constants.LARGE_PADDING-1}if(a.isIcon()&&!b.isInput)return Blockly.blockRendering.constants.LARGE_PADDING;if(a.isInlineInput()&&!b.isInput)return b.isEditable?Blockly.blockRendering.constants.MEDIUM_PADDING:
Blockly.blockRendering.constants.LARGE_PADDING;if(a.isSquareCorner()){if(b.isHat())return Blockly.blockRendering.constants.NO_PADDING;if(b.isPreviousConnection())return b.notchOffset;if(b.isNextConnection()){var c=(this.RTL?1:-1)*Blockly.blockRendering.constants.DARK_PATH_OFFSET/2;return b.notchOffset+c}}if(a.isRoundedCorner()){if(b.isPreviousConnection())return b.notchOffset-Blockly.blockRendering.constants.CORNER_RADIUS;if(b.isNextConnection())return c=(this.RTL?1:-1)*Blockly.blockRendering.constants.DARK_PATH_OFFSET/
2,b.notchOffset-Blockly.blockRendering.constants.CORNER_RADIUS+c}return!a.isInput&&!b.isInput&&a.isEditable==b.isEditable||b.isJaggedEdge()?Blockly.blockRendering.constants.LARGE_PADDING:Blockly.blockRendering.constants.MEDIUM_PADDING};
Blockly.thrasos.RenderInfo.prototype.alignRowElements_=function(){for(var a=0,b;b=this.rows[a];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.thrasos.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.getLastInput();if(c){var d=a.getFirstSpacer(),e=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)a.widthWithConnectedBlocks+=b;c.align==Blockly.ALIGN_LEFT?e.width+=b:c.align==Blockly.ALIGN_CENTRE?(d.width+=b/2,e.width+=b/2):c.align==Blockly.ALIGN_RIGHT&&(d.width+=b);a.width+=b}else if("top row"==a.type||"bottom row"==a.type)a.getLastSpacer().width+=b,a.width+=b};
Blockly.thrasos.RenderInfo.prototype.getSpacerRowWidth_=function(a,b){return"bottom row"==b.type&&b.hasFixedWidth?b.width:this.width-this.startX};
Blockly.thrasos.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.thrasos.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.thrasos.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];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);e=d.xPos;for(var f=0,g;g=d.elements[f];f++)g.xPos=e,g.centerline=this.getElemCenterline_(d,g),e+=g.width}this.widthWithChildren=a+this.startX;
this.height=b;this.startY=this.topRow.startY};Blockly.zelos={};Blockly.zelos.RenderInfo=function(a){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a)};goog.inherits(Blockly.zelos.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.blockRendering.render=function(a){a.renderingDebugger||(a.renderingDebugger=new Blockly.blockRendering.Debug);var b=new Blockly.geras.RenderInfo(a);(new Blockly.blockRendering.Drawer(a,b)).draw_()};Blockly.utils.IdGenerator=function(){};Blockly.utils.IdGenerator.getInstance=function(){Blockly.utils.IdGenerator.instance_||(Blockly.utils.IdGenerator.instance_=new Blockly.utils.IdGenerator);return Blockly.utils.IdGenerator.instance_};Blockly.utils.IdGenerator.prototype.nextId_=0;Blockly.utils.IdGenerator.prototype.getNextUniqueId=function(){return"blockly:"+(this.nextId_++).toString(36)};Blockly.Component=function(){this.rightToLeft_=Blockly.Component.defaultRightToLeft_;this.id_=null;this.inDocument_=!1;this.childIndex_=this.children_=this.parent_=this.element_=null};Blockly.Component.prototype.idGenerator_=Blockly.utils.IdGenerator.getInstance();Blockly.Component.defaultRightToLeft_=!1;
Blockly.BlockDragSurfaceSvg.prototype.clearAndHide=function(a){a?a.appendChild(this.getCurrentBlock()):this.dragGroup_.removeChild(this.getCurrentBlock());this.SVG_.style.display="none";if(this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null};Blockly.utils.IdGenerator=function(){};Blockly.utils.IdGenerator.getInstance=function(){Blockly.utils.IdGenerator.instance_||(Blockly.utils.IdGenerator.instance_=new Blockly.utils.IdGenerator);return Blockly.utils.IdGenerator.instance_};Blockly.utils.IdGenerator.prototype.nextId_=0;Blockly.utils.IdGenerator.prototype.getNextUniqueId=function(){return"blockly:"+(this.nextId_++).toString(36)};Blockly.Component=function(){this.rightToLeft_=Blockly.Component.defaultRightToLeft_;this.id_=null;this.inDocument_=!1;this.childIndex_=this.children_=this.parent_=this.element_=null};Blockly.Component.prototype.idGenerator_=Blockly.utils.IdGenerator.getInstance();Blockly.Component.defaultRightToLeft_=!1;
Blockly.Component.Error={NOT_SUPPORTED:"Method not supported",ALREADY_RENDERED:"Component already rendered",PARENT_UNABLE_TO_BE_SET:"Unable to set parent component",CHILD_INDEX_OUT_OF_BOUNDS:"Child component index out of bounds",NOT_OUR_CHILD:"Child is not in parent component",NOT_IN_DOCUMENT:"Operation not supported while component is not in document"};Blockly.Component.setDefaultRightToLeft=function(a){Blockly.Component.defaultRightToLeft_=a};
Blockly.Component.prototype.getId=function(){return this.id_||(this.id_=this.idGenerator_.getNextUniqueId())};Blockly.Component.prototype.setId=function(a){this.parent_&&this.parent_.childIndex_&&(delete this.parent_.childIndex_[this.id_],this.parent_.childIndex_[a]=this);this.id_=a};Blockly.Component.prototype.getElement=function(){return this.element_};Blockly.Component.prototype.setElementInternal=function(a){this.element_=a};
Blockly.Component.prototype.setParent=function(a){if(this==a)throw Error(Blockly.Component.Error.PARENT_UNABLE_TO_BE_SET);if(a&&this.parent_&&this.id_&&this.parent_.getChild(this.id_)&&this.parent_!=a)throw Error(Blockly.Component.Error.PARENT_UNABLE_TO_BE_SET);this.parent_=a};Blockly.Component.prototype.getParent=function(){return this.parent_};Blockly.Component.prototype.isInDocument=function(){return this.inDocument_};Blockly.Component.prototype.createDom=function(){this.element_=document.createElement("div")};
@@ -853,13 +883,13 @@ POSINSET:"posinset",PRESSED:"pressed",READONLY:"readonly",RELEVANT:"relevant",RE
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.Menu=function(){Blockly.Component.call(this);this.highlightedIndex_=-1};goog.inherits(Blockly.Menu,Blockly.Component);Blockly.Menu.prototype.createDom=function(){var a=document.createElement("div");a.setAttribute("id",this.getId());this.setElementInternal(a);a.setAttribute("class","goog-menu goog-menu-vertical");a.setAttribute("style","user-select: none;");a.tabIndex=0;Blockly.utils.aria.setRole(a,this.roleName_||Blockly.utils.aria.Role.MENU)};
Blockly.Menu.prototype.focus=function(){var a=this.getElement();a&&(a.focus(),Blockly.utils.dom.addClass(a,"focused"))};Blockly.Menu.prototype.blur=function(){var a=this.getElement();a&&(a.blur(),Blockly.utils.dom.removeClass(a,"focused"))};Blockly.Menu.prototype.setRole=function(a){this.roleName_=a};Blockly.Menu.prototype.enterDocument=function(){Blockly.Menu.superClass_.enterDocument.call(this);this.forEachChild(function(a){a.isInDocument()&&this.registerChildId_(a)},this);this.attachEvents_()};
Blockly.Menu.prototype.exitDocument=function(){this.setHighlightedIndex(-1);Blockly.Menu.superClass_.exitDocument.call(this)};Blockly.Menu.prototype.disposeInternal=function(){Blockly.Menu.superClass_.disposeInternal.call(this);this.detachEvents_()};
Blockly.Menu.prototype.attachEvents_=function(){var a=this.getElement();this.mouseOverHandler_=Blockly.bindEventWithChecks_(a,"mouseover",this,this.handleMouseOver_,!0);this.mouseUpHandler_=Blockly.bindEventWithChecks_(a,"mouseup",this,this.handleMouseUp_,!0);this.mouseEnterHandler_=Blockly.bindEventWithChecks_(a,"mouseenter",this,this.handleMouseEnter_,!0);this.mouseLeaveHandler_=Blockly.bindEventWithChecks_(a,"mouseleave",this,this.handleMouseLeave_,!0);this.onKeyDownWrapper_=Blockly.bindEventWithChecks_(a,
"keydown",this,this.handleKeyEvent)};Blockly.Menu.prototype.detachEvents_=function(){Blockly.unbindEvent_(this.mouseOverHandler_);Blockly.unbindEvent_(this.mouseUpHandler_);Blockly.unbindEvent_(this.mouseEnterHandler_);Blockly.unbindEvent_(this.mouseLeaveHandler_);Blockly.unbindEvent_(this.onKeyDownWrapper_)};Blockly.Menu.prototype.childElementIdMap_=null;
Blockly.Menu.prototype.attachEvents_=function(){var a=this.getElement();this.mouseOverHandler_=Blockly.bindEventWithChecks_(a,"mouseover",this,this.handleMouseOver_,!0);this.clickHandler_=Blockly.bindEventWithChecks_(a,"click",this,this.handleClick_,!0);this.mouseEnterHandler_=Blockly.bindEventWithChecks_(a,"mouseenter",this,this.handleMouseEnter_,!0);this.mouseLeaveHandler_=Blockly.bindEventWithChecks_(a,"mouseleave",this,this.handleMouseLeave_,!0);this.onKeyDownWrapper_=Blockly.bindEventWithChecks_(a,
"keydown",this,this.handleKeyEvent)};Blockly.Menu.prototype.detachEvents_=function(){Blockly.unbindEvent_(this.mouseOverHandler_);Blockly.unbindEvent_(this.clickHandler_);Blockly.unbindEvent_(this.mouseEnterHandler_);Blockly.unbindEvent_(this.mouseLeaveHandler_);Blockly.unbindEvent_(this.onKeyDownWrapper_)};Blockly.Menu.prototype.childElementIdMap_=null;
Blockly.Menu.prototype.registerChildId_=function(a){var b=a.getElement();b=b.id||(b.id=a.getId());this.childElementIdMap_||(this.childElementIdMap_={});this.childElementIdMap_[b]=a};Blockly.Menu.prototype.getMenuItem=function(a){if(this.childElementIdMap_)for(var b=this.getElement();a&&a!==b;){var c=a.id;if(c in this.childElementIdMap_)return this.childElementIdMap_[c];a=a.parentNode}return null};Blockly.Menu.prototype.unhighlightCurrent=function(){var a=this.getHighlighted();a&&a.setHighlighted(!1)};
Blockly.Menu.prototype.clearHighlighted=function(){this.unhighlightCurrent();this.setHighlightedIndex(-1)};Blockly.Menu.prototype.getHighlighted=function(){return this.getChildAt(this.highlightedIndex_)};
Blockly.Menu.prototype.setHighlightedIndex=function(a){var b=this.getChildAt(a);b?(b.setHighlighted(!0),this.highlightedIndex_=a,this.highlightHandler_&&this.highlightHandler_(b)):-1<this.highlightedIndex_&&(this.getHighlighted().setHighlighted(!1),this.highlightHandler_&&this.highlightHandler_(),this.highlightedIndex_=-1);b&&Blockly.utils.style.scrollIntoContainerView(b.getElement(),this.getElement())};Blockly.Menu.prototype.setHighlighted=function(a){this.setHighlightedIndex(this.indexOfChild(a))};
Blockly.Menu.prototype.highlightNext=function(){this.highlightHelper(function(a,b){return(a+1)%b},this.highlightedIndex_)};Blockly.Menu.prototype.highlightPrevious=function(){this.highlightHelper(function(a,b){a--;return 0>a?b-1:a},this.highlightedIndex_)};Blockly.Menu.prototype.highlightHelper=function(a,b){var c=0>b?-1:b,d=this.getChildCount();c=a.call(this,c,d);for(var e=0;e<=d;){var f=this.getChildAt(c);if(f&&this.canHighlightItem(f))return this.setHighlightedIndex(c),!0;e++;c=a.call(this,c,d)}return!1};
Blockly.Menu.prototype.canHighlightItem=function(a){return a.isEnabled()};Blockly.Menu.prototype.onHighlighted=function(a){this.highlightHandler_=a};Blockly.Menu.prototype.handleMouseOver_=function(a){(a=this.getMenuItem(a.target))&&a.isEnabled()&&this.getHighlighted()!==a&&(this.unhighlightCurrent(),this.setHighlighted(a))};Blockly.Menu.prototype.handleMouseUp_=function(a){var b=this.getMenuItem(a.target);b&&b.handleMouseUp(a)&&a.preventDefault()};Blockly.Menu.prototype.handleMouseEnter_=function(a){this.focus()};
Blockly.Menu.prototype.canHighlightItem=function(a){return a.isEnabled()};Blockly.Menu.prototype.onHighlighted=function(a){this.highlightHandler_=a};Blockly.Menu.prototype.handleMouseOver_=function(a){(a=this.getMenuItem(a.target))&&a.isEnabled()&&this.getHighlighted()!==a&&(this.unhighlightCurrent(),this.setHighlighted(a))};Blockly.Menu.prototype.handleClick_=function(a){var b=this.getMenuItem(a.target);b&&b.handleClick(a)&&a.preventDefault()};Blockly.Menu.prototype.handleMouseEnter_=function(a){this.focus()};
Blockly.Menu.prototype.handleMouseLeave_=function(a){this.getElement()&&(this.blur(),this.clearHighlighted())};Blockly.Menu.prototype.handleKeyEvent=function(a){return 0!=this.getChildCount()&&this.handleKeyEventInternal(a)?(a.preventDefault(),a.stopPropagation(),!0):!1};
Blockly.Menu.prototype.handleKeyEventInternal=function(a){var b=this.getHighlighted();if(b&&"function"==typeof b.handleKeyEvent&&b.handleKeyEvent(a))return!0;if(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)return!1;switch(a.keyCode){case Blockly.utils.KeyCodes.ENTER:b&&b.performActionInternal(a);break;case Blockly.utils.KeyCodes.UP:this.unhighlightCurrent();this.highlightPrevious();break;case Blockly.utils.KeyCodes.DOWN:this.unhighlightCurrent();this.highlightNext();break;default:return!1}return!0};Blockly.MenuItem=function(a,b){Blockly.Component.call(this);this.setContentInternal(a);this.setValue(b);this.enabled_=!0};goog.inherits(Blockly.MenuItem,Blockly.Component);
Blockly.MenuItem.prototype.createDom=function(){var a=document.createElement("div");a.setAttribute("id",this.getId());this.setElementInternal(a);a.setAttribute("class","goog-menuitem goog-option "+(this.enabled_?"":"goog-menuitem-disabled ")+(this.checked_?"goog-option-selected ":"")+(this.isRightToLeft()?"goog-menuitem-rtl ":""));a.setAttribute("style","user-select: none");var b=this.getContentWrapperDom();a.appendChild(b);var c=this.getCheckboxDom();c&&b.appendChild(c);b.appendChild(this.getContentDom());
@@ -868,7 +898,7 @@ Blockly.MenuItem.prototype.getContentDom=function(){var a=this.content_;"string"
Blockly.MenuItem.prototype.getValue=function(){return this.value_};Blockly.MenuItem.prototype.setRole=function(a){this.roleName_=a};Blockly.MenuItem.prototype.setCheckable=function(a){this.checkable_=a};
Blockly.MenuItem.prototype.setChecked=function(a){if(this.checkable_){this.checked_=a;var b=this.getElement();b&&this.isEnabled()&&(a?(Blockly.utils.dom.addClass(b,"goog-option-selected"),Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,!0)):(Blockly.utils.dom.removeClass(b,"goog-option-selected"),Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,!1)))}};Blockly.MenuItem.prototype.isHighlighted=function(){return this.highlight_};
Blockly.MenuItem.prototype.setHighlighted=function(a){this.highlight_=a;var b=this.getElement();b&&this.isEnabled()&&(a?Blockly.utils.dom.addClass(b,"goog-menuitem-highlight"):Blockly.utils.dom.removeClass(b,"goog-menuitem-highlight"))};Blockly.MenuItem.prototype.isEnabled=function(){return this.enabled_};Blockly.MenuItem.prototype.setEnabled=function(a){this.enabled_=a;(a=this.getElement())&&(this.enabled_?Blockly.utils.dom.removeClass(a,"goog-menuitem-disabled"):Blockly.utils.dom.addClass(a,"goog-menuitem-disabled"))};
Blockly.MenuItem.prototype.handleMouseUp=function(a){this.isEnabled()&&(this.setHighlighted(!0),this.performActionInternal())};Blockly.MenuItem.prototype.performActionInternal=function(){this.checkable_&&this.setChecked(!this.checked_);this.actionHandler_&&this.actionHandler_.call(this.actionHandlerObj_,this)};Blockly.MenuItem.prototype.onAction=function(a,b){this.actionHandler_=a;this.actionHandlerObj_=b};Blockly.utils.uiMenu={};Blockly.utils.uiMenu.getSize=function(a){a=a.getElement();var b=Blockly.utils.style.getSize(a);b.height=a.scrollHeight;return b};Blockly.utils.uiMenu.adjustBBoxesForRTL=function(a,b,c){b.left+=c.width;b.right+=c.width;a.left+=c.width;a.right+=c.width};Blockly.ContextMenu={};Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_=null;Blockly.ContextMenu.show=function(a,b,c){Blockly.WidgetDiv.show(Blockly.ContextMenu,c,null);if(b.length){var d=Blockly.ContextMenu.populate_(b,c);Blockly.ContextMenu.position_(d,a,c);setTimeout(function(){d.getElement().focus()},1);Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()};
Blockly.MenuItem.prototype.handleClick=function(a){this.isEnabled()&&(this.setHighlighted(!0),this.performActionInternal())};Blockly.MenuItem.prototype.performActionInternal=function(){this.checkable_&&this.setChecked(!this.checked_);this.actionHandler_&&this.actionHandler_.call(this.actionHandlerObj_,this)};Blockly.MenuItem.prototype.onAction=function(a,b){this.actionHandler_=a;this.actionHandlerObj_=b};Blockly.utils.uiMenu={};Blockly.utils.uiMenu.getSize=function(a){a=a.getElement();var b=Blockly.utils.style.getSize(a);b.height=a.scrollHeight;return b};Blockly.utils.uiMenu.adjustBBoxesForRTL=function(a,b,c){b.left+=c.width;b.right+=c.width;a.left+=c.width;a.right+=c.width};Blockly.ContextMenu={};Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_=null;Blockly.ContextMenu.show=function(a,b,c){Blockly.WidgetDiv.show(Blockly.ContextMenu,c,null);if(b.length){var d=Blockly.ContextMenu.populate_(b,c);Blockly.ContextMenu.position_(d,a,c);setTimeout(function(){d.getElement().focus()},1);Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()};
Blockly.ContextMenu.populate_=function(a,b){var c=new Blockly.Menu;c.setRightToLeft(b);for(var d=0,e;e=a[d];d++){var f=new Blockly.MenuItem(e.text);f.setRightToLeft(b);c.addChild(f,!0);f.setEnabled(e.enabled);if(e.enabled)f.onAction(function(){Blockly.ContextMenu.hide();this.callback()},e)}return c};
Blockly.ContextMenu.position_=function(a,b,c){var d=Blockly.utils.getViewportBBox();b={top:b.clientY+d.top,bottom:b.clientY+d.top,left:b.clientX+d.left,right:b.clientX+d.left};Blockly.ContextMenu.createWidget_(a);var e=Blockly.utils.uiMenu.getSize(a);c&&Blockly.utils.uiMenu.adjustBBoxesForRTL(d,b,e);Blockly.WidgetDiv.positionWithAnchor(d,b,e,c);a.getElement().focus()};
Blockly.ContextMenu.createWidget_=function(a){a.render(Blockly.WidgetDiv.DIV);var b=a.getElement();Blockly.utils.dom.addClass(b,"blocklyContextMenu");Blockly.bindEventWithChecks_(b,"contextmenu",null,Blockly.utils.noEvent);a.focus()};Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu);Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_&&Blockly.unbindEvent_(Blockly.ContextMenu.eventWrapper_)};
@@ -922,8 +952,7 @@ Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.Render
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.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.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.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.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));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")};
Blockly.DropDownDiv=function(){};Blockly.DropDownDiv.DIV_=null;Blockly.DropDownDiv.boundsElement_=null;Blockly.DropDownDiv.owner_=null;Blockly.DropDownDiv.positionToField_=null;Blockly.DropDownDiv.ARROW_SIZE=16;Blockly.DropDownDiv.BORDER_SIZE=1;Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING=12;Blockly.DropDownDiv.PADDING_Y=16;Blockly.DropDownDiv.ANIMATION_TIME=.25;Blockly.DropDownDiv.animateOutTimer_=null;Blockly.DropDownDiv.onHide_=0;
@@ -945,17 +974,18 @@ Blockly.DropDownDiv.positionInternal_=function(a,b,c,d){a=Math.floor(a);b=Math.f
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.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.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.isDirty_=!0)};
Blockly.FieldTextInput.prototype.render_=function(){Blockly.FieldTextInput.superClass_.render_.call(this);this.isBeingEdited_&&(this.sourceBlock_.RTL?setTimeout(this.resizeEditor_.bind(this),0):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;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;setTimeout(this.resizeEditor_.bind(this),
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.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.getText(),function(b){a.setValue(b)})};
Blockly.FieldTextInput.prototype.showInlineEditor_=function(a){Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();this.isBeingEdited_=!0;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;b.style.borderRadius=Blockly.FieldTextInput.BORDERRADIUS*this.workspace_.scale+"px";a.appendChild(b);b.value=b.defaultValue=this.getEditorText_(this.value_);b.untypedDefaultValue_=this.value_;b.oldValue_=
null;Blockly.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();this.bindInputEvents_(b);return b};Blockly.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1;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.onHtmlInputKeyDown_=function(a){13==a.keyCode?(Blockly.WidgetDiv.hide(),Blockly.DropDownDiv.hideWithoutAnimation()):27==a.keyCode?(this.htmlInput_.value=this.htmlInput_.defaultValue,Blockly.WidgetDiv.hide(),Blockly.DropDownDiv.hideWithoutAnimation()):9==a.keyCode&&(Blockly.WidgetDiv.hide(),Blockly.DropDownDiv.hideWithoutAnimation(),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),a=this.getValueFromEditorText_(a),this.setValue(a),this.forceRerender(),Blockly.Events.setGroup(!1))};Blockly.FieldTextInput.prototype.setEditorValue_=function(a){this.isDirty_=!0;this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(a));this.setValue(a)};
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.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.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.FieldTextInput.prototype.getText_=function(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null};Blockly.FieldTextInput.prototype.getEditorText_=function(a){return String(a)};Blockly.FieldTextInput.prototype.getValueFromEditorText_=function(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",
@@ -963,20 +993,21 @@ Blockly.FieldAngle.prototype.dropdownCreate_=function(){var a=Blockly.utils.dom.
")"},a);this.clickWrapper_=Blockly.bindEvent_(a,"click",this,this.hide_);this.moveWrapper1_=Blockly.bindEvent_(b,"mousemove",this,this.onMouseMove);this.moveWrapper2_=Blockly.bindEvent_(this.gauge_,"mousemove",this,this.onMouseMove);return a};Blockly.FieldAngle.prototype.dropdownDispose_=function(){Blockly.unbindEvent_(this.clickWrapper_);Blockly.unbindEvent_(this.moveWrapper1_);Blockly.unbindEvent_(this.moveWrapper2_)};
Blockly.FieldAngle.prototype.hide_=function(){Blockly.DropDownDiv.hideIfOwner(this);Blockly.WidgetDiv.hide()};
Blockly.FieldAngle.prototype.onMouseMove=function(a){var b=this.gauge_.ownerSVGElement.getBoundingClientRect(),c=a.clientX-b.left-Blockly.FieldAngle.HALF;a=a.clientY-b.top-Blockly.FieldAngle.HALF;b=Math.atan(-a/c);isNaN(b)||(b=Blockly.utils.math.toDegrees(b),0>c?b+=180:0<a&&(b+=360),b=Blockly.FieldAngle.CLOCKWISE?Blockly.FieldAngle.OFFSET+360-b:360-(Blockly.FieldAngle.OFFSET-b),360<b&&(b-=360),this.setAngle(b))};
Blockly.FieldAngle.prototype.setAngle=function(a){Blockly.FieldAngle.ROUND&&(a=Math.round(a/Blockly.FieldAngle.ROUND)*Blockly.FieldAngle.ROUND);a>Blockly.FieldAngle.WRAP?a-=360:0>a&&(a+=360);var b=String(a);b!=this.text_&&(this.htmlInput_.value=a,this.setValue(a),this.text_=b,this.forceRerender())};
Blockly.FieldAngle.prototype.setAngle=function(a){Blockly.FieldAngle.ROUND&&(a=Math.round(a/Blockly.FieldAngle.ROUND)*Blockly.FieldAngle.ROUND);a>Blockly.FieldAngle.WRAP?a-=360:0>a&&(a+=360);a!=this.value_&&this.setEditorValue_(a)};
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.onHtmlInputKeyDown_=function(a){Blockly.FieldAngle.superClass_.onHtmlInputKeyDown_.call(this,a);var b;a.keyCode===Blockly.utils.KeyCodes.LEFT?b=this.sourceBlock_.RTL?1:-1:a.keyCode===Blockly.utils.KeyCodes.RIGHT?b=this.sourceBlock_.RTL?-1:1:a.keyCode===Blockly.utils.KeyCodes.DOWN?b=-1:a.keyCode===Blockly.utils.KeyCodes.UP&&(b=1);b&&(this.setAngle(Number(this.getValue())+b*Blockly.FieldAngle.ROUND),a.preventDefault(),a.stopPropagation())};
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.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.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,c){a=this.doClassValidation_(a);null===a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b,c);this.size_.width=Blockly.FieldCheckbox.WIDTH;this.checkChar_=null;this.configure_(c)};goog.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked,null,a)};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.configure_=function(a){a&&a.checkCharacter&&(this.checkChar_=a.checkCharacter)};
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");this.textContent_.nodeValue=this.checkChar_||Blockly.FieldCheckbox.CHECK_CHAR;this.textElement_.style.display=this.value_?"block":"none"};
Blockly.FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a;this.textContent_&&(this.textContent_.nodeValue=a||Blockly.FieldCheckbox.CHECK_CHAR)};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.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])))};
Blockly.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};Blockly.FieldColour=function(a,b,c){c&&(c.colourOptions&&this.setColours(c.colourOptions,c.colourTitles),c.columns&&this.setColumns(c.columns));a=this.doClassValidation_(a);null===a&&(a=Blockly.FieldColour.COLOURS[0]);Blockly.FieldColour.superClass_.constructor.call(this,a,b,c)};goog.inherits(Blockly.FieldColour,Blockly.Field);Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,null,a)};Blockly.FieldColour.DEFAULT_WIDTH=26;Blockly.FieldColour.DEFAULT_HEIGHT=Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT;
Blockly.FieldColour.prototype.SERIALIZABLE=!0;Blockly.FieldColour.prototype.CURSOR="default";Blockly.FieldColour.prototype.isDirty_=!1;Blockly.FieldColour.prototype.colours_=null;Blockly.FieldColour.prototype.titles_=null;Blockly.FieldColour.prototype.columns_=0;Blockly.FieldColour.prototype.DROPDOWN_BORDER_COLOUR="#dadce0";Blockly.FieldColour.prototype.DROPDOWN_BACKGROUND_COLOUR="white";
Blockly.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};Blockly.FieldColour=function(a,b,c){a=this.doClassValidation_(a);null===a&&(a=Blockly.FieldColour.COLOURS[0]);Blockly.FieldColour.superClass_.constructor.call(this,a,b,c);this.configure_(c)};goog.inherits(Blockly.FieldColour,Blockly.Field);Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,null,a)};Blockly.FieldColour.DEFAULT_WIDTH=26;Blockly.FieldColour.DEFAULT_HEIGHT=Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT;Blockly.FieldColour.prototype.SERIALIZABLE=!0;
Blockly.FieldColour.prototype.CURSOR="default";Blockly.FieldColour.prototype.isDirty_=!1;Blockly.FieldColour.prototype.colours_=null;Blockly.FieldColour.prototype.titles_=null;Blockly.FieldColour.prototype.columns_=0;Blockly.FieldColour.prototype.DROPDOWN_BORDER_COLOUR="#dadce0";Blockly.FieldColour.prototype.DROPDOWN_BACKGROUND_COLOUR="white";Blockly.FieldColour.prototype.configure_=function(a){a&&(a.colourOptions&&this.setColours(a.colourOptions,a.colourTitles),a.columns&&this.setColumns(a.columns))};
Blockly.FieldColour.prototype.initView=function(){this.size_=new Blockly.utils.Size(Blockly.FieldColour.DEFAULT_WIDTH,Blockly.FieldColour.DEFAULT_HEIGHT);this.createBorderRect_();this.borderRect_.style.fillOpacity=1;this.borderRect_.style.fill=this.value_};Blockly.FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:Blockly.utils.colour.parse(a)};Blockly.FieldColour.prototype.doValueUpdate_=function(a){this.value_=a;this.borderRect_&&(this.borderRect_.style.fill=a)};
Blockly.FieldColour.prototype.getText=function(){var a=this.value_;/^#(.)\1(.)\2(.)\3$/.test(a)&&(a="#"+a[1]+a[3]+a[5]);return a};Blockly.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" ");
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};
@@ -989,31 +1020,33 @@ Blockly.FieldColour.prototype.getHighlighted_=function(){var a=this.columns_||Bl
Blockly.FieldColour.prototype.setHighlightedCell_=function(a,b){var c=this.getHighlighted_();c&&Blockly.utils.dom.removeClass(c,"blocklyColourHighlighted");Blockly.utils.dom.addClass(a,"blocklyColourHighlighted");this.highlightedIndex_=b;Blockly.utils.aria.setState(this.picker_,Blockly.utils.aria.State.ACTIVEDESCENDANT,a.getAttribute("id"))};
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";e.tabIndex=0;Blockly.utils.aria.setRole(e,Blockly.utils.aria.Role.GRID);Blockly.utils.aria.setState(e,Blockly.utils.aria.State.EXPANDED,!0);Blockly.utils.aria.setState(e,"rowcount",Math.floor(b.length/a));Blockly.utils.aria.setState(e,
"colcount",a);for(var f,g=Blockly.utils.IdGenerator.getInstance(),h=0;h<b.length;h++){0==h%a&&(f=document.createElement("tr"),Blockly.utils.aria.setRole(f,Blockly.utils.aria.Role.ROW),e.appendChild(f));var k=document.createElement("td");f.appendChild(k);k.label=b[h];k.title=c[h]||b[h];k.id=g.getNextUniqueId();k.setAttribute("data-index",h);Blockly.utils.aria.setRole(k,Blockly.utils.aria.Role.GRIDCELL);Blockly.utils.aria.setState(k,Blockly.utils.aria.State.LABEL,b[h]);Blockly.utils.aria.setState(k,
Blockly.utils.aria.State.SELECTED,b[h]==d);k.style.backgroundColor=b[h];b[h]==d&&(k.className="blocklyColourSelected",this.highlightedIndex_=h)}this.onMouseUpWrapper_=Blockly.bindEventWithChecks_(e,"mouseup",this,this.onClick_,!0);this.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(e,"mousemove",this,this.onMouseMove_,!0);this.onMouseEnterWrapper_=Blockly.bindEventWithChecks_(e,"mouseenter",this,this.onMouseEnter_,!0);this.onMouseLeaveWrapper_=Blockly.bindEventWithChecks_(e,"mouseleave",this,this.onMouseLeave_,
!0);this.onKeyDownWrapper_=Blockly.bindEventWithChecks_(e,"keydown",this,this.onKeyDown_);return e};Blockly.FieldColour.prototype.dropdownDispose_=function(){Blockly.unbindEvent_(this.onMouseUpWrapper_);Blockly.unbindEvent_(this.onMouseMoveWrapper_);Blockly.unbindEvent_(this.onMouseEnterWrapper_);Blockly.unbindEvent_(this.onMouseLeaveWrapper_);Blockly.unbindEvent_(this.onKeyDownWrapper_)};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.utils.aria.State.SELECTED,b[h]==d);k.style.backgroundColor=b[h];b[h]==d&&(k.className="blocklyColourSelected",this.highlightedIndex_=h)}this.onClickWrapper_=Blockly.bindEventWithChecks_(e,"click",this,this.onClick_,!0);this.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(e,"mousemove",this,this.onMouseMove_,!0);this.onMouseEnterWrapper_=Blockly.bindEventWithChecks_(e,"mouseenter",this,this.onMouseEnter_,!0);this.onMouseLeaveWrapper_=Blockly.bindEventWithChecks_(e,"mouseleave",this,this.onMouseLeave_,
!0);this.onKeyDownWrapper_=Blockly.bindEventWithChecks_(e,"keydown",this,this.onKeyDown_);return e};Blockly.FieldColour.prototype.dropdownDispose_=function(){Blockly.unbindEvent_(this.onClickWrapper_);Blockly.unbindEvent_(this.onMouseMoveWrapper_);Blockly.unbindEvent_(this.onMouseEnterWrapper_);Blockly.unbindEvent_(this.onMouseLeaveWrapper_);Blockly.unbindEvent_(this.onKeyDownWrapper_)};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];this.selectedIndex_=-1;Blockly.FieldDropdown.superClass_.constructor.call(this,c[1],b);this.selectedMenuItem_=null};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.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_.focus()};
Blockly.FieldDropdown.prototype.widgetCreate_=function(){var a=new Blockly.Menu;a.setRightToLeft(this.sourceBlock_.RTL);a.setRole("listbox");for(var b=this.getOptions(),c,d=0;d<b.length;d++){var e=b[d][0],f=b[d][1];if("object"==typeof e){var g=new Image(e.width,e.height);g.src=e.src;g.alt=e.alt||"";e=g}e=new Blockly.MenuItem(e);e.setRole("option");e.setRightToLeft(this.sourceBlock_.RTL);e.setValue(f);e.setCheckable(!0);a.addChild(e,!0);e.setChecked(f==this.value_);f==this.value_&&(c=e);e.onAction(this.handleMenuActionEvent_,
this)}Blockly.utils.aria.setState(a.getElement(),Blockly.utils.aria.State.ACTIVEDESCENDANT,c?c.getId():"");return a};Blockly.FieldDropdown.prototype.widgetDispose_=function(){this.menu_.dispose()};Blockly.FieldDropdown.prototype.handleMenuActionEvent_=function(a){Blockly.WidgetDiv.hideIfOwner(this);this.onItemSelected(this.menu_,a)};
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_.focus();this.selectedMenuItem_&&Blockly.utils.style.scrollIntoContainerView(this.selectedMenuItem_.getElement(),this.menu_.getElement())};
Blockly.FieldDropdown.prototype.widgetCreate_=function(){var a=new Blockly.Menu;a.setRightToLeft(this.sourceBlock_.RTL);a.setRole("listbox");for(var b=this.getOptions(),c=0;c<b.length;c++){var d=b[c][0],e=b[c][1];if("object"==typeof d){var f=new Image(d.width,d.height);f.src=d.src;f.alt=d.alt||"";d=f}d=new Blockly.MenuItem(d);d.setRole("option");d.setRightToLeft(this.sourceBlock_.RTL);d.setValue(e);d.setCheckable(!0);a.addChild(d,!0);d.setChecked(e==this.value_);e==this.value_&&(this.selectedMenuItem_=
d);d.onAction(this.handleMenuActionEvent_,this)}Blockly.utils.aria.setState(a.getElement(),Blockly.utils.aria.State.ACTIVEDESCENDANT,this.selectedMenuItem_?this.selectedMenuItem_.getId():"");return a};Blockly.FieldDropdown.prototype.widgetDispose_=function(){this.menu_.dispose()};Blockly.FieldDropdown.prototype.handleMenuActionEvent_=function(a){Blockly.WidgetDiv.hideIfOwner(this);this.onItemSelected(this.menu_,a)};
Blockly.FieldDropdown.prototype.positionMenu_=function(a){var b=Blockly.utils.getViewportBBox(),c=this.getAnchorDimensions_();a=Blockly.utils.uiMenu.getSize(a);var d=Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH*document.documentElement.clientHeight;a.height>d&&(a.height=d);this.sourceBlock_.RTL&&Blockly.utils.uiMenu.adjustBBoxesForRTL(b,c,a);Blockly.WidgetDiv.positionWithAnchor(b,c,a,this.sourceBlock_.RTL)};
Blockly.FieldDropdown.prototype.getAnchorDimensions_=function(){var a=this.getScaledBBox_();this.sourceBlock_.RTL?a.right+=Blockly.FieldDropdown.CHECKMARK_OVERHANG:a.left-=Blockly.FieldDropdown.CHECKMARK_OVERHANG;return a};Blockly.FieldDropdown.prototype.onItemSelected=function(a,b){this.setValue(b.getValue())};
Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.prefixField=null;var a=this.menuGenerator_;if(Array.isArray(a)){for(var b=!1,c=0;c<a.length;c++){var d=a[c][0];"string"==typeof d?a[c][0]=Blockly.utils.replaceMessageReferences(d):(null!=d.alt&&(a[c][0].alt=Blockly.utils.replaceMessageReferences(d.alt)),b=!0)}if(!(b||2>a.length)){b=[];for(c=0;c<a.length;c++)b.push(a[c][0]);c=Blockly.utils.string.shortestStringLength(b);d=Blockly.utils.string.commonWordPrefix(b,c);var e=
Blockly.utils.string.commonWordSuffix(b,c);!d&&!e||c<=d+e||(d&&(this.prefixField=b[0].substring(0,d-1)),e&&(this.suffixField=b[0].substr(1-e)),this.menuGenerator_=Blockly.FieldDropdown.applyTrim_(a,d,e))}}};Blockly.FieldDropdown.applyTrim_=function(a,b,c){for(var d=[],e=0;e<a.length;e++){var f=a[e][0],g=a[e][1];f=f.substring(b,f.length-c);d[e]=[f,g]}return d};Blockly.FieldDropdown.prototype.isOptionListDynamic=function(){return"function"==typeof this.menuGenerator_};
Blockly.FieldDropdown.prototype.getOptions=function(){if(this.isOptionListDynamic()){var a=this.menuGenerator_.call(this);Blockly.FieldDropdown.validateOptions_(a);return a}return this.menuGenerator_};
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.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.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_&&(this.selectedIndex_=b)};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";var a=this.getOptions();(a=0<=this.selectedIndex_&&a[this.selectedIndex_][0])&&"object"==typeof a?this.renderSelectedImage_(a):this.renderSelectedText_();this.borderRect_.setAttribute("height",this.size_.height);this.borderRect_.setAttribute("width",this.size_.width)};
Blockly.FieldDropdown.prototype.renderSelectedImage_=function(a){this.imageElement_.style.display="";this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",a.src);this.imageElement_.setAttribute("height",a.height);this.imageElement_.setAttribute("width",a.width);var b=Blockly.utils.dom.getTextWidth(this.arrow_),c=Number(a.width);this.size_.height=Number(a.height)+Blockly.FieldDropdown.IMAGE_Y_PADDING;this.size_.width=c+b+Blockly.Field.X_PADDING;this.sourceBlock_.RTL?(a=Blockly.Field.DEFAULT_TEXT_OFFSET-
1,this.imageElement_.setAttribute("x",Blockly.Field.DEFAULT_TEXT_OFFSET+b),this.textElement_.setAttribute("x",a)):(a=c+b+Blockly.Field.DEFAULT_TEXT_OFFSET+1,this.textElement_.setAttribute("text-anchor","end"),this.textElement_.setAttribute("x",a),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.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"+
Blockly.FieldDropdown.prototype.getText_=function(){if(0>this.selectedIndex_)return null;var a=this.getOptions()[this.selectedIndex_][0];return"object"==typeof a?a.alt:a};
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)):d[0]&&"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.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.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.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||!1;this.altText_=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.altText_},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.setAlt=function(a){a!==this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))};Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};
Blockly.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};Blockly.FieldImage.prototype.getText_=function(){return this.altText_};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.FieldNumber.prototype.widgetCreate_=function(){var a=Blockly.FieldNumber.superClass_.widgetCreate_.call(this);-Infinity<this.min_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMIN,this.min_);Infinity>this.max_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMAX,this.max_);return a};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)};
@@ -1022,9 +1055,9 @@ Blockly.FieldVariable.prototype.fromXml=function(a){var b=a.getAttribute("id"),c
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};
Blockly.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null};Blockly.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""};Blockly.FieldVariable.prototype.getVariable=function(){return this.variable_};Blockly.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null};
Blockly.FieldVariable.prototype.doClassValidation_=function(a){var b=Blockly.Variables.getVariable(this.workspace_,a);if(!b)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;b=b.type;return this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)};
Blockly.FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=Blockly.Variables.getVariable(this.workspace_,a);this.value_=a;this.text_=this.variable_.name;this.isDirty_=!0};Blockly.FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;c<b.length;c++)if(a==b[c])return!0;return!1};
Blockly.FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=Blockly.Variables.getVariable(this.workspace_,a);Blockly.FieldVariable.superClass_.doValueUpdate_.call(this,a)};Blockly.FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;c<b.length;c++)if(a==b[c])return!0;return!1};
Blockly.FieldVariable.prototype.getVariableTypes_=function(){var a=this.variableTypes;if(null===a&&this.workspace_)return this.workspace_.getVariableTypes();a=a||[""];if(0==a.length)throw a=this.getText(),Error("'variableTypes' of field variable "+a+" was an empty list");return a};
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.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.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.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=[];
@@ -1042,13 +1075,13 @@ Blockly.ASTNode.createFieldNode=function(a){return new Blockly.ASTNode(Blockly.A
Blockly.ASTNode.createConnectionNode=function(a){return a?a.type===Blockly.INPUT_VALUE||a.type===Blockly.NEXT_STATEMENT&&a.getParentInput()?Blockly.ASTNode.createInputNode(a.getParentInput()):a.type===Blockly.NEXT_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.NEXT,a):a.type===Blockly.OUTPUT_VALUE?new Blockly.ASTNode(Blockly.ASTNode.types.OUTPUT,a):a.type===Blockly.PREVIOUS_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.PREVIOUS,a):null:null};
Blockly.ASTNode.createInputNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.INPUT,a.connection,{input:a}):null};Blockly.ASTNode.createBlockNode=function(a){return new Blockly.ASTNode(Blockly.ASTNode.types.BLOCK,a)};Blockly.ASTNode.createStackNode=function(a){return new Blockly.ASTNode(Blockly.ASTNode.types.STACK,a)};Blockly.ASTNode.createWorkspaceNode=function(a,b){return new Blockly.ASTNode(Blockly.ASTNode.types.WORKSPACE,a,{wsCoordinate:b})};
Blockly.ASTNode.prototype.processParams_=function(a){a&&(a.wsCoordinate?this.wsCoordinate_=a.wsCoordinate:a.input&&(this.parentInput_=a.input))};Blockly.ASTNode.prototype.getLocation=function(){return this.location_};Blockly.ASTNode.prototype.getType=function(){return this.type_};Blockly.ASTNode.prototype.getWsCoordinate=function(){return this.wsCoordinate_};Blockly.ASTNode.prototype.getParentInput=function(){return this.parentInput_};Blockly.ASTNode.prototype.isConnection=function(){return this.isConnection_};
Blockly.ASTNode.prototype.findPreviousEditableField_=function(a,b,c){b=b.fieldRow;a=b.indexOf(a);for(c=c?b.length-1:a-1;a=b[c];c--)if(a.isCurrentlyEditable())return b=a,Blockly.ASTNode.createFieldNode(b);return null};Blockly.ASTNode.prototype.findNextForInput_=function(){var a=this.location_.getParentInput(),b=a.getSourceBlock();a=b.inputList.indexOf(a)+1;for(var c;c=b.inputList[a];a++){for(var d=c.fieldRow,e=0,f;f=d[e];e++)if(f.isCurrentlyEditable())return Blockly.ASTNode.createFieldNode(f);if(c.connection)return Blockly.ASTNode.createInputNode(c)}return null};
Blockly.ASTNode.prototype.findNextForField_=function(){var a=this.location_,b=a.getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)+1;b=c.inputList[d];d++){for(var e=b.fieldRow;a<e.length;){if(e[a].isCurrentlyEditable())return Blockly.ASTNode.createFieldNode(e[a]);a++}a=0;if(b.connection)return Blockly.ASTNode.createInputNode(b)}return null};
Blockly.ASTNode.prototype.findPrevForInput_=function(){for(var a=this.location_.getParentInput(),b=a.getSourceBlock(),c=b.inputList.indexOf(a),d;d=b.inputList[c];c--){if(d.connection&&d!==a)return Blockly.ASTNode.createInputNode(d);d=d.fieldRow;for(var e=d.length-1,f;f=d[e];e--)if(f.isCurrentlyEditable())return Blockly.ASTNode.createFieldNode(f)}return null};
Blockly.ASTNode.prototype.findPrevForField_=function(){var a=this.location_,b=a.getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b);a=b.fieldRow.indexOf(a)-1;for(var e;e=c.inputList[d];d--){if(e.connection&&e!==b)return Blockly.ASTNode.createInputNode(e);for(e=e.fieldRow;-1<a;){if(e[a].isCurrentlyEditable())return Blockly.ASTNode.createFieldNode(e[a]);a--}0<=d-1&&(a=c.inputList[d-1].fieldRow.length-1)}return null};
Blockly.ASTNode.prototype.findPreviousEditableField_=function(a,b,c){b=b.fieldRow;a=b.indexOf(a);for(c=c?b.length-1:a-1;a=b[c];c--)if(a.EDITABLE)return b=a,Blockly.ASTNode.createFieldNode(b);return null};Blockly.ASTNode.prototype.findNextForInput_=function(){var a=this.location_.getParentInput(),b=a.getSourceBlock();a=b.inputList.indexOf(a)+1;for(var c;c=b.inputList[a];a++){for(var d=c.fieldRow,e=0,f;f=d[e];e++)if(f.EDITABLE)return Blockly.ASTNode.createFieldNode(f);if(c.connection)return Blockly.ASTNode.createInputNode(c)}return null};
Blockly.ASTNode.prototype.findNextForField_=function(){var a=this.location_,b=a.getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)+1;b=c.inputList[d];d++){for(var e=b.fieldRow;a<e.length;){if(e[a].EDITABLE)return Blockly.ASTNode.createFieldNode(e[a]);a++}a=0;if(b.connection)return Blockly.ASTNode.createInputNode(b)}return null};
Blockly.ASTNode.prototype.findPrevForInput_=function(){for(var a=this.location_.getParentInput(),b=a.getSourceBlock(),c=b.inputList.indexOf(a),d;d=b.inputList[c];c--){if(d.connection&&d!==a)return Blockly.ASTNode.createInputNode(d);d=d.fieldRow;for(var e=d.length-1,f;f=d[e];e--)if(f.EDITABLE)return Blockly.ASTNode.createFieldNode(f)}return null};
Blockly.ASTNode.prototype.findPrevForField_=function(){var a=this.location_,b=a.getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b);a=b.fieldRow.indexOf(a)-1;for(var e;e=c.inputList[d];d--){if(e.connection&&e!==b)return Blockly.ASTNode.createInputNode(e);for(e=e.fieldRow;-1<a;){if(e[a].EDITABLE)return Blockly.ASTNode.createFieldNode(e[a]);a--}0<=d-1&&(a=c.inputList[d-1].fieldRow.length-1)}return null};
Blockly.ASTNode.prototype.navigateBetweenStacks_=function(a){var b=this.getLocation();b instanceof Blockly.Block||(b=b.getSourceBlock());if(!b)return null;var c=b.getRootBlock();b=c.workspace.getTopBlocks(!0);for(var d=0,e;e=b[d];d++)if(c.id==e.id)return a=d+(a?1:-1),-1==a||a==b.length?null:Blockly.ASTNode.createStackNode(b[a]);throw Error("Couldn't find "+(a?"next":"previous")+" stack?!?!?!");};
Blockly.ASTNode.prototype.findTopASTNodeForBlock_=function(a){var b=a.previousConnection||a.outputConnection;return b?Blockly.ASTNode.createConnectionNode(b):Blockly.ASTNode.createBlockNode(a)};Blockly.ASTNode.prototype.getOutAstNodeForBlock_=function(a){a=a.previousConnection?this.findTopOfSubStack_(a):a;var b=a.previousConnection||a.outputConnection;return b&&b.targetConnection&&b.targetConnection.getParentInput()?Blockly.ASTNode.createInputNode(b.targetConnection.getParentInput()):Blockly.ASTNode.createStackNode(a)};
Blockly.ASTNode.prototype.findFirstFieldOrInput_=function(a){a=a.inputList;for(var b=0,c;c=a[b];b++){for(var d=c.fieldRow,e=0,f;f=d[e];e++)if(f.isCurrentlyEditable())return Blockly.ASTNode.createFieldNode(f);if(c.connection)return Blockly.ASTNode.createInputNode(c)}return null};
Blockly.ASTNode.prototype.findFirstFieldOrInput_=function(a){a=a.inputList;for(var b=0,c;c=a[b];b++){for(var d=c.fieldRow,e=0,f;f=d[e];e++)if(f.EDITABLE)return Blockly.ASTNode.createFieldNode(f);if(c.connection)return Blockly.ASTNode.createInputNode(c)}return null};
Blockly.ASTNode.prototype.findTopOfSubStack_=function(a){for(;a&&a.previousConnection&&a.previousConnection.targetConnection&&a.previousConnection.targetBlock().nextConnection==a.previousConnection.targetConnection;)a=a.previousConnection.targetBlock();return a};
Blockly.ASTNode.prototype.next=function(){switch(this.type_){case Blockly.ASTNode.types.WORKSPACE:var a=new Blockly.utils.Coordinate(this.wsCoordinate_.x+Blockly.ASTNode.wsMove_,this.wsCoordinate_.y);return Blockly.ASTNode.createWorkspaceNode(this.location_,a);case Blockly.ASTNode.types.STACK:return this.navigateBetweenStacks_(!0);case Blockly.ASTNode.types.OUTPUT:return Blockly.ASTNode.createBlockNode(this.location_.getSourceBlock());case Blockly.ASTNode.types.FIELD:return this.findNextForField_();
case Blockly.ASTNode.types.INPUT:return this.findNextForInput_();case Blockly.ASTNode.types.BLOCK:if(a=this.location_.nextConnection)return Blockly.ASTNode.createConnectionNode(a);break;case Blockly.ASTNode.types.PREVIOUS:return Blockly.ASTNode.createBlockNode(this.location_.getSourceBlock());case Blockly.ASTNode.types.NEXT:if(a=this.location_.targetConnection)return Blockly.ASTNode.createConnectionNode(a)}return null};
@@ -1063,7 +1096,8 @@ Blockly.user.keyMap.getKeyByAction=function(a){for(var b=Object.keys(Blockly.use
Blockly.user.keyMap.createDefaultKeyMap=function(){var a={};a[Blockly.utils.KeyCodes.W]=Blockly.navigation.ACTION_PREVIOUS;a[Blockly.utils.KeyCodes.A]=Blockly.navigation.ACTION_OUT;a[Blockly.utils.KeyCodes.S]=Blockly.navigation.ACTION_NEXT;a[Blockly.utils.KeyCodes.D]=Blockly.navigation.ACTION_IN;a[Blockly.utils.KeyCodes.I]=Blockly.navigation.ACTION_INSERT;a[Blockly.utils.KeyCodes.ENTER]=Blockly.navigation.ACTION_MARK;a[Blockly.utils.KeyCodes.X]=Blockly.navigation.ACTION_DISCONNECT;a[Blockly.utils.KeyCodes.T]=
Blockly.navigation.ACTION_TOOLBOX;a[Blockly.utils.KeyCodes.E]=Blockly.navigation.ACTION_EXIT;a[Blockly.utils.KeyCodes.ESC]=Blockly.navigation.ACTION_EXIT;return a};Blockly.navigation={};Blockly.navigation.cursor_=null;Blockly.navigation.marker_=null;Blockly.navigation.currentCategory_=null;Blockly.navigation.flyoutBlock_=null;Blockly.navigation.loggingCallback=null;Blockly.navigation.STATE_FLYOUT=1;Blockly.navigation.STATE_WS=2;Blockly.navigation.STATE_TOOLBOX=3;Blockly.navigation.currentState_=Blockly.navigation.STATE_WS;
Blockly.navigation.actionNames={PREVIOUS:"previous",NEXT:"next",IN:"in",OUT:"out",INSERT:"insert",MARK:"mark",DISCONNECT:"disconnect",TOOLBOX:"toolbox",EXIT:"exit"};Blockly.navigation.setCursor=function(a){Blockly.navigation.cursor_=a};Blockly.navigation.setMarker=function(a){Blockly.navigation.marker_=a};Blockly.navigation.markAtCursor=function(){Blockly.navigation.marker_.setLocation(Blockly.navigation.cursor_.getCurNode())};
Blockly.navigation.removeMark=function(){Blockly.navigation.marker_.setLocation(null);Blockly.navigation.marker_.hide()};Blockly.navigation.focusToolbox=function(){Blockly.navigation.resetFlyout(!1);Blockly.navigation.currentState_=Blockly.navigation.STATE_TOOLBOX;var a=Blockly.getMainWorkspace(),b=a.getToolbox();Blockly.navigation.marker_.getCurNode()||Blockly.navigation.markAtCursor();a&&!Blockly.navigation.currentCategory_&&(Blockly.navigation.currentCategory_=b.tree_.firstChild_);b.tree_.setSelectedItem(Blockly.navigation.currentCategory_)};
Blockly.navigation.removeMark=function(){Blockly.navigation.marker_.setLocation(null);Blockly.navigation.marker_.hide()};Blockly.navigation.getTopNode_=function(a){var b=a.previousConnection,c=a.outputConnection;return(b=b?b:c)?Blockly.ASTNode.createConnectionNode(b):Blockly.ASTNode.createBlockNode(a)};
Blockly.navigation.focusToolbox=function(){Blockly.navigation.resetFlyout(!1);Blockly.navigation.currentState_=Blockly.navigation.STATE_TOOLBOX;var a=Blockly.getMainWorkspace(),b=a.getToolbox();Blockly.navigation.marker_.getCurNode()||Blockly.navigation.markAtCursor();a&&!Blockly.navigation.currentCategory_&&(Blockly.navigation.currentCategory_=b.tree_.firstChild_);b.tree_.setSelectedItem(Blockly.navigation.currentCategory_)};
Blockly.navigation.nextCategory=function(){if(Blockly.navigation.currentCategory_){var a=Blockly.navigation.currentCategory_.getNextShownNode();a&&(a.select(),Blockly.navigation.currentCategory_=a)}};Blockly.navigation.previousCategory=function(){if(Blockly.navigation.currentCategory_){var a=Blockly.navigation.currentCategory_.getPreviousShownNode();a&&(a.select(),Blockly.navigation.currentCategory_=a)}};
Blockly.navigation.inCategory=function(){if(Blockly.navigation.currentCategory_){var a=Blockly.navigation.currentCategory_;a.hasChildren()?a.getExpanded()?(a.getFirstChild().select(),Blockly.navigation.currentCategory_=a.getFirstChild()):a.setExpanded(!0):Blockly.navigation.focusFlyout()}};
Blockly.navigation.outCategory=function(){if(Blockly.navigation.currentCategory_){var a=Blockly.navigation.currentCategory_;if(a.hasChildren()&&a.getExpanded()&&a.isUserCollapsible())a.setExpanded(!1);else{var b=a.getParent();a=a.getTree();b&&b!=a&&(b.select(),Blockly.navigation.currentCategory_=b)}}};
@@ -1071,31 +1105,35 @@ Blockly.navigation.focusFlyout=function(){Blockly.navigation.currentState_=Block
Blockly.navigation.selectNextBlockInFlyout=function(){if(Blockly.navigation.flyoutBlock_){var a=Blockly.navigation.getFlyoutBlocks_(),b=a.indexOf(Blockly.navigation.flyoutBlock_),c=Blockly.navigation.cursor_,d;-1<b&&a[++b]&&(d=a[b]);d&&(Blockly.navigation.flyoutBlock_=d,a=Blockly.ASTNode.createBlockNode(d),c.setLocation(a))}};
Blockly.navigation.selectPreviousBlockInFlyout=function(){if(Blockly.navigation.flyoutBlock_){var a=Blockly.navigation.getFlyoutBlocks_(),b=a.indexOf(Blockly.navigation.flyoutBlock_),c=Blockly.navigation.cursor_,d;-1<b&&a[--b]&&(d=a[b]);d&&(Blockly.navigation.flyoutBlock_=d,a=Blockly.ASTNode.createBlockNode(d),c.setLocation(a))}};
Blockly.navigation.getFlyoutBlocks_=function(){var a=Blockly.getMainWorkspace(),b=a.getToolbox(),c=[];(a=b?b.flyout_:a.getFlyout())&&a.getWorkspace()&&(c=a.getWorkspace().getTopBlocks());return c};
Blockly.navigation.insertFromFlyout=function(){var a=Blockly.getMainWorkspace().getFlyout();if(a&&a.isVisible()){var b=a.createBlock(Blockly.navigation.flyoutBlock_);b.render();b.setConnectionsHidden(!1);Blockly.navigation.cursor_.setLocation(Blockly.ASTNode.createBlockNode(b));Blockly.navigation.modify()||Blockly.navigation.warn("Something went wrong while inserting a block from the flyout.");Blockly.navigation.focusWorkspace();a=b.previousConnection;b=b.outputConnection;a=Blockly.ASTNode.createConnectionNode(a?
a:b);Blockly.navigation.cursor_.setLocation(a);Blockly.navigation.removeMark()}else Blockly.navigation.warn("Trying to insert from the flyout when the flyout does not exist or is not visible")};Blockly.navigation.resetFlyout=function(a){var b=Blockly.navigation.cursor_;Blockly.navigation.flyoutBlock_=null;b.hide();a&&b.workspace_.getFlyout().hide()};
Blockly.navigation.insertFromFlyout=function(){var a=Blockly.getMainWorkspace().getFlyout();a&&a.isVisible()?(a=a.createBlock(Blockly.navigation.flyoutBlock_),a.render(),a.setConnectionsHidden(!1),Blockly.navigation.cursor_.setLocation(Blockly.ASTNode.createBlockNode(a)),Blockly.navigation.modify()||Blockly.navigation.warn("Something went wrong while inserting a block from the flyout."),Blockly.navigation.focusWorkspace(),Blockly.navigation.cursor_.setLocation(Blockly.navigation.getTopNode_(a)),Blockly.navigation.removeMark()):
Blockly.navigation.warn("Trying to insert from the flyout when the flyout does not exist or is not visible")};Blockly.navigation.resetFlyout=function(a){var b=Blockly.navigation.cursor_;Blockly.navigation.flyoutBlock_=null;b.hide();a&&b.workspace_.getFlyout().hide()};
Blockly.navigation.modify=function(){var a=Blockly.navigation.marker_.getCurNode(),b=Blockly.navigation.cursor_.getCurNode();if(!a)return Blockly.navigation.warn("Cannot insert with no marked node."),!1;if(!b)return Blockly.navigation.warn("Cannot insert with no cursor node."),!1;var c=a.getType(),d=b.getType();if(c==Blockly.ASTNode.types.FIELD)return Blockly.navigation.warn("Should not have been able to mark a field."),!1;if(c==Blockly.ASTNode.types.BLOCK)return Blockly.navigation.warn("Should not have been able to mark a block."),
!1;if(c==Blockly.ASTNode.types.STACK)return Blockly.navigation.warn("Should not have been able to mark a stack."),!1;if(d==Blockly.ASTNode.types.FIELD)return Blockly.navigation.warn("Cannot attach a field to anything else."),!1;if(d==Blockly.ASTNode.types.WORKSPACE)return Blockly.navigation.warn("Cannot attach a workspace to anything else."),!1;var e=b.getLocation(),f=a.getLocation();if(a.isConnection()){if(b.isConnection())return Blockly.navigation.connect(e,f);if(d==Blockly.ASTNode.types.BLOCK||
d==Blockly.ASTNode.types.STACK)return Blockly.navigation.insertBlock(e,f)}else if(c==Blockly.ASTNode.types.WORKSPACE){if(b.isConnection()){if(d==Blockly.ASTNode.types.INPUT||d==Blockly.ASTNode.types.NEXT)return Blockly.navigation.warn("Cannot move a next or input connection to the workspace."),!1;b=e.getSourceBlock()}else if(d==Blockly.ASTNode.types.BLOCK||d==Blockly.ASTNode.types.STACK)b=e;else return!1;if(b.isShadow())return Blockly.navigation.warn("Cannot move a shadow block to the workspace."),
!1;b.getParent()&&b.unplug(!1);b.moveTo(a.getWsCoordinate());return!0}Blockly.navigation.warn("Unexpected state in Blockly.navigation.modify.");return!1};Blockly.navigation.connect=function(a,b){if(a){var c=a.getSourceBlock();b.type!=Blockly.PREVIOUS_STATEMENT&&b.type!=Blockly.OUTPUT_VALUE||c.positionNearConnection(a,b);try{return b.connect(a),!0}catch(d){Blockly.navigation.warn("Connection failed with error: "+d)}}return!1};
Blockly.navigation.findBestConnection=function(a,b){if(!a||!b)return null;if(b.type===Blockly.PREVIOUS_STATEMENT)return a.nextConnection;if(b.type===Blockly.NEXT_STATEMENT)return a.previousConnection;if(b.type===Blockly.INPUT_VALUE)return a.outputConnection;if(b.type===Blockly.OUTPUT_VALUE)for(var c=0;c<a.inputList.length;c++){var d=a.inputList[c].connection;if(d.type===Blockly.INPUT_VALUE)return d}return null};
Blockly.navigation.insertBlock=function(a,b){var c=Blockly.navigation.findBestConnection(a,b);c&&c.isConnected()&&!c.targetBlock().isShadow()?c.disconnect():c||Blockly.navigation.warn("This block can not be inserted at the marked location.");return Blockly.navigation.connect(c,b)};
!1;b.getParent()&&b.unplug(!1);b.moveTo(a.getWsCoordinate());return!0}Blockly.navigation.warn("Unexpected state in Blockly.navigation.modify.");return!1};Blockly.navigation.disconnectChild_=function(a,b){var c=a.getSourceBlock(),d=b.getSourceBlock();c.getRootBlock()==d.getRootBlock()&&(-1<c.getDescendants().indexOf(d)?Blockly.navigation.getInferiorConnection_(b).disconnect():Blockly.navigation.getInferiorConnection_(a).disconnect())};
Blockly.navigation.moveAndConnect_=function(a,b){if(!a||!b)return!1;var c=a.getSourceBlock();return b.canConnectWithReason_(a)==Blockly.Connection.CAN_CONNECT?(Blockly.navigation.disconnectChild_(a,b),b.isSuperior()||c.getRootBlock().positionNearConnection(a,b),b.connect(a),!0):!1};Blockly.navigation.getInferiorConnection_=function(a){var b=a.getSourceBlock();return a.isSuperior()?b.previousConnection?b.previousConnection:b.outputConnection?b.outputConnection:null:a};
Blockly.navigation.getSuperiorConnection_=function(a){return a.isSuperior()?a:a.targetConnection?a.targetConnection:null};
Blockly.navigation.connect=function(a,b){if(!a||!b)return!1;var c=Blockly.navigation.getInferiorConnection_(a),d=Blockly.navigation.getSuperiorConnection_(b),e=Blockly.navigation.getSuperiorConnection_(a),f=Blockly.navigation.getInferiorConnection_(b);if(c&&d&&Blockly.navigation.moveAndConnect_(c,d)||e&&f&&Blockly.navigation.moveAndConnect_(e,f)||Blockly.navigation.moveAndConnect_(a,b))return!0;try{b.checkConnection_(a)}catch(g){Blockly.navigation.warn("Connection failed with error: "+g)}return!1};
Blockly.navigation.insertBlock=function(a,b){switch(b.type){case Blockly.PREVIOUS_STATEMENT:if(Blockly.navigation.moveAndConnect_(a.nextConnection,b))return!0;break;case Blockly.NEXT_STATEMENT:if(Blockly.navigation.moveAndConnect_(a.previousConnection,b))return!0;break;case Blockly.INPUT_VALUE:if(Blockly.navigation.moveAndConnect_(a.outputConnection,b))return!0;break;case Blockly.OUTPUT_VALUE:for(var c=0;c<a.inputList.length;c++){var d=a.inputList[c].connection;if(d.type===Blockly.INPUT_VALUE&&Blockly.navigation.moveAndConnect_(d,
b))return!0}}Blockly.navigation.warn("This block can not be inserted at the marked location.");return!1};
Blockly.navigation.disconnectBlocks=function(){var a=Blockly.navigation.cursor_.getCurNode();if(a.isConnection()){var b=a.getLocation();b.isConnected()?(a=b.isSuperior()?b:b.targetConnection,b=b.isSuperior()?b.targetConnection:b,b.getSourceBlock().isShadow()?Blockly.navigation.log("Cannot disconnect a shadow block"):(a.disconnect(),b.bumpAwayFrom_(a),a.getSourceBlock().getRootBlock().bringToFront(),a=Blockly.ASTNode.createConnectionNode(a),Blockly.navigation.cursor_.setLocation(a))):Blockly.navigation.log("Cannot disconnect unconnected connection")}else Blockly.navigation.log("Cannot disconnect blocks when the cursor is not on a connection")};
Blockly.navigation.focusWorkspace=function(){var a=Blockly.navigation.cursor_,b=Blockly.getMainWorkspace().getToolbox()?!0:!1;Blockly.navigation.resetFlyout(b);Blockly.navigation.currentState_=Blockly.navigation.STATE_WS;Blockly.navigation.enableKeyboardAccessibility();if(Blockly.selected){b=Blockly.selected.previousConnection;var c=Blockly.selected.outputConnection;b=Blockly.ASTNode.createConnectionNode(b?b:c);a.setLocation(b);Blockly.selected.unselect()}else b=a.workspace_,c=new Blockly.utils.Coordinate(100,
100),b=Blockly.ASTNode.createWorkspaceNode(b,c),a.setLocation(b)};Blockly.navigation.handleEnterForWS=function(){var a=Blockly.navigation.cursor_.getCurNode(),b=a.getType();b===Blockly.ASTNode.types.FIELD?a.getLocation().showEditor_():a.isConnection()||b==Blockly.ASTNode.types.WORKSPACE?Blockly.navigation.markAtCursor():b==Blockly.ASTNode.types.BLOCK?Blockly.navigation.warn("Cannot mark a block."):b==Blockly.ASTNode.types.STACK&&Blockly.navigation.warn("Cannot mark a stack.")};
Blockly.navigation.focusWorkspace=function(){var a=Blockly.navigation.cursor_,b=Blockly.getMainWorkspace().getToolbox()?!0:!1,c=Blockly.getMainWorkspace().getTopBlocks();Blockly.navigation.resetFlyout(b);Blockly.navigation.currentState_=Blockly.navigation.STATE_WS;Blockly.selected?(a.setLocation(Blockly.navigation.getTopNode_(Blockly.selected)),Blockly.selected.unselect()):0<c.length?a.setLocation(Blockly.navigation.getTopNode_(c[0])):(b=a.workspace_,c=new Blockly.utils.Coordinate(100,100),b=Blockly.ASTNode.createWorkspaceNode(b,
c),a.setLocation(b))};Blockly.navigation.handleEnterForWS=function(){var a=Blockly.navigation.cursor_.getCurNode(),b=a.getType();b===Blockly.ASTNode.types.FIELD?a.getLocation().showEditor_():a.isConnection()||b==Blockly.ASTNode.types.WORKSPACE?Blockly.navigation.markAtCursor():b==Blockly.ASTNode.types.BLOCK?Blockly.navigation.warn("Cannot mark a block."):b==Blockly.ASTNode.types.STACK&&Blockly.navigation.warn("Cannot mark a stack.")};
Blockly.navigation.getSourceBlock_=function(a){return a?a.getType()===Blockly.ASTNode.types.BLOCK?a.getLocation():a.getType()===Blockly.ASTNode.types.WORKSPACE||a.getType()===Blockly.ASTNode.types.STACK?null:a.getLocation().getSourceBlock():null};
Blockly.navigation.moveCursorOnBlockDelete=function(a){var b=Blockly.navigation.cursor_;if(b){var c=b.getCurNode();c=Blockly.navigation.getSourceBlock_(c);c===a?c.getParent()?(a=c.previousConnection?c.previousConnection:c.outputConnection)&&b.setLocation(Blockly.ASTNode.createConnectionNode(a.targetConnection)):b.setLocation(Blockly.ASTNode.createWorkspaceNode(c.workspace,c.getRelativeToSurfaceXY())):-1<a.getChildren().indexOf(c)&&b.setLocation(Blockly.ASTNode.createWorkspaceNode(c.workspace,c.getRelativeToSurfaceXY()))}};
Blockly.navigation.moveCursorOnBlockMutation=function(a){var b=Blockly.navigation.cursor_;if(b){var c=b.getCurNode();c=Blockly.navigation.getSourceBlock_(c);c===a&&b.setLocation(Blockly.ASTNode.createBlockNode(c))}};
Blockly.navigation.onKeyPress=function(a){a=Blockly.user.keyMap.serializeKeyEvent(a);a=Blockly.user.keyMap.getActionByKeyCode(a);var b=Blockly.navigation.cursor_.getCurNode(),c=!1;a&&(b&&b.getType()===Blockly.ASTNode.types.FIELD&&(c=b.getLocation().onBlocklyAction(a)),c||(c=Blockly.navigation.onBlocklyAction(a)));return c};
Blockly.navigation.onKeyPress=function(a){a=Blockly.user.keyMap.serializeKeyEvent(a);a=Blockly.user.keyMap.getActionByKeyCode(a);var b=Blockly.navigation.cursor_.getCurNode(),c=Blockly.getMainWorkspace().options.readOnly,d=!1;a&&(c?-1<Blockly.navigation.READONLY_ACTION_LIST.indexOf(a)&&(d=Blockly.navigation.onBlocklyAction(a)):(b&&b.getType()===Blockly.ASTNode.types.FIELD&&(d=b.getLocation().onBlocklyAction(a)),d||(d=Blockly.navigation.onBlocklyAction(a))));return d};
Blockly.navigation.onBlocklyAction=function(a){return Blockly.navigation.currentState_===Blockly.navigation.STATE_WS?Blockly.navigation.workspaceOnAction_(a):Blockly.navigation.currentState_===Blockly.navigation.STATE_FLYOUT?Blockly.navigation.flyoutOnAction_(a):Blockly.navigation.currentState_===Blockly.navigation.STATE_TOOLBOX?Blockly.navigation.toolboxOnAction_(a):!1};
Blockly.navigation.workspaceOnAction_=function(a){switch(a.name){case Blockly.navigation.actionNames.PREVIOUS:return Blockly.navigation.cursor_.prev(),!0;case Blockly.navigation.actionNames.OUT:return Blockly.navigation.cursor_.out(),!0;case Blockly.navigation.actionNames.NEXT:return Blockly.navigation.cursor_.next(),!0;case Blockly.navigation.actionNames.IN:return Blockly.navigation.cursor_["in"](),!0;case Blockly.navigation.actionNames.INSERT:return Blockly.navigation.modify(),!0;case Blockly.navigation.actionNames.MARK:return Blockly.navigation.handleEnterForWS(),
!0;case Blockly.navigation.actionNames.DISCONNECT:return Blockly.navigation.disconnectBlocks(),!0;case Blockly.navigation.actionNames.TOOLBOX:return Blockly.getMainWorkspace().getToolbox()?Blockly.navigation.focusToolbox():Blockly.navigation.focusFlyout(),!0;default:return!1}};
Blockly.navigation.flyoutOnAction_=function(a){switch(a.name){case Blockly.navigation.actionNames.PREVIOUS:return Blockly.navigation.selectPreviousBlockInFlyout(),!0;case Blockly.navigation.actionNames.OUT:return Blockly.navigation.focusToolbox(),!0;case Blockly.navigation.actionNames.NEXT:return Blockly.navigation.selectNextBlockInFlyout(),!0;case Blockly.navigation.actionNames.MARK:return Blockly.navigation.insertFromFlyout(),!0;case Blockly.navigation.actionNames.EXIT:return Blockly.navigation.focusWorkspace(),
!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,"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.navigation.enableKeyboardAccessibility=function(){Blockly.keyboardAccessibilityMode=!0;Blockly.navigation.focusWorkspace()};Blockly.navigation.disableKeyboardAccessibility=function(){Blockly.keyboardAccessibilityMode=!1;Blockly.navigation.cursor_.hide()};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,"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.navigation.READONLY_ACTION_LIST=[Blockly.navigation.ACTION_PREVIOUS,Blockly.navigation.ACTION_OUT,Blockly.navigation.ACTION_IN,Blockly.navigation.ACTION_NEXT];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};
@@ -1187,10 +1225,10 @@ Blockly.tree.TreeControl.prototype.setSelectedItem=function(a){if(a!=this.select
Blockly.tree.TreeControl.prototype.onAfterSelected=function(a){this.onAfterSelected_=a};Blockly.tree.TreeControl.prototype.getSelectedItem=function(){return this.selectedItem_};Blockly.tree.TreeControl.prototype.updateLinesAndExpandIcons_=function(){function a(b){var c=b.getChildrenElement();if(c){var d=b.getConfig().cssChildrenNoLines;c.className=d;if(c=b.getExpandIconElement())c.className=b.getExpandIconClass()}b.forEachChild(a)}a(this)};
Blockly.tree.TreeControl.prototype.initAccessibility=function(){Blockly.tree.TreeControl.superClass_.initAccessibility.call(this);var a=this.getElement();Blockly.utils.aria.setRole(a,Blockly.utils.aria.Role.TREE);Blockly.utils.aria.setState(a,Blockly.utils.aria.State.LABELLEDBY,this.getLabelElement().id)};
Blockly.tree.TreeControl.prototype.enterDocument=function(){Blockly.tree.TreeControl.superClass_.enterDocument.call(this);var a=this.getElement();a.className=this.getConfig().cssRoot;a.setAttribute("hideFocus","true");this.attachEvents_();this.initAccessibility()};Blockly.tree.TreeControl.prototype.exitDocument=function(){Blockly.tree.TreeControl.superClass_.exitDocument.call(this);this.detachEvents_()};
Blockly.tree.TreeControl.prototype.attachEvents_=function(){var a=this.getElement();a.tabIndex=0;this.onFocusWrapper_=Blockly.bindEvent_(a,"focus",this,this.handleFocus_);this.onBlurWrapper_=Blockly.bindEvent_(a,"blur",this,this.handleBlur_);this.onMousedownWrapper_=Blockly.bindEventWithChecks_(a,"mousedown",this,this.handleMouseEvent_);this.onClickWrapper_=Blockly.bindEventWithChecks_(a,"click",this,this.handleMouseEvent_);this.onKeydownWrapper_=Blockly.bindEvent_(a,"keydown",this,this.handleKeyEvent_);
Blockly.Touch.TOUCH_ENABLED&&(this.onTouchEndWrapper_=Blockly.bindEventWithChecks_(a,"touchend",this,this.handleTouchEvent_))};Blockly.tree.TreeControl.prototype.detachEvents_=function(){Blockly.unbindEvent_(this.onFocusWrapper_);Blockly.unbindEvent_(this.onBlurWrapper_);Blockly.unbindEvent_(this.onMousedownWrapper_);Blockly.unbindEvent_(this.onClickWrapper_);Blockly.unbindEvent_(this.onKeydownWrapper_);this.onTouchEndWrapper_&&Blockly.unbindEvent_(this.onTouchEndWrapper_)};
Blockly.tree.TreeControl.prototype.handleMouseEvent_=function(a){var b=this.getNodeFromEvent_(a);if(b)switch(a.type){case "mousedown":b.onMouseDown(a);break;case "click":b.onClick_(a)}};Blockly.tree.TreeControl.prototype.handleTouchEvent_=function(a){var b=this.getNodeFromEvent_(a);b&&"touchend"===a.type&&setTimeout(b.onClick_.bind(b,a),1)};Blockly.tree.TreeControl.prototype.handleKeyEvent_=function(a){var b=!1;(b=this.selectedItem_&&this.selectedItem_.onKeyDown(a)||b)&&a.preventDefault();return b};
Blockly.tree.TreeControl.prototype.getNodeFromEvent_=function(a){for(var b=a.target;null!=b;){if(a=Blockly.tree.BaseNode.allNodes[b.id])return a;if(b==this.getElement())break;b=b.parentNode}return null};Blockly.tree.TreeControl.prototype.createNode=function(a){return new Blockly.tree.TreeNode(this.toolbox_,a||"",this.getConfig())};Blockly.VerticalFlyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);Blockly.VerticalFlyout.superClass_.constructor.call(this,a);this.horizontalLayout_=!1};goog.inherits(Blockly.VerticalFlyout,Blockly.Flyout);
Blockly.tree.TreeControl.prototype.attachEvents_=function(){var a=this.getElement();a.tabIndex=0;this.onFocusWrapper_=Blockly.bindEvent_(a,"focus",this,this.handleFocus_);this.onBlurWrapper_=Blockly.bindEvent_(a,"blur",this,this.handleBlur_);this.onClickWrapper_=Blockly.bindEventWithChecks_(a,"click",this,this.handleMouseEvent_);this.onKeydownWrapper_=Blockly.bindEvent_(a,"keydown",this,this.handleKeyEvent_)};
Blockly.tree.TreeControl.prototype.detachEvents_=function(){Blockly.unbindEvent_(this.onFocusWrapper_);Blockly.unbindEvent_(this.onBlurWrapper_);Blockly.unbindEvent_(this.onClickWrapper_);Blockly.unbindEvent_(this.onKeydownWrapper_)};Blockly.tree.TreeControl.prototype.handleMouseEvent_=function(a){var b=this.getNodeFromEvent_(a);if(b)switch(a.type){case "mousedown":b.onMouseDown(a);break;case "click":b.onClick_(a)}};
Blockly.tree.TreeControl.prototype.handleKeyEvent_=function(a){var b=!1;if(b=this.selectedItem_&&this.selectedItem_.onKeyDown(a)||b)Blockly.utils.style.scrollIntoContainerView(this.selectedItem_.getElement(),this.getElement().parentNode),a.preventDefault();return b};Blockly.tree.TreeControl.prototype.getNodeFromEvent_=function(a){for(var b=a.target;null!=b;){if(a=Blockly.tree.BaseNode.allNodes[b.id])return a;if(b==this.getElement())break;b=b.parentNode}return null};
Blockly.tree.TreeControl.prototype.createNode=function(a){return new Blockly.tree.TreeNode(this.toolbox_,a||"",this.getConfig())};Blockly.VerticalFlyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);Blockly.VerticalFlyout.superClass_.constructor.call(this,a);this.horizontalLayout_=!1};goog.inherits(Blockly.VerticalFlyout,Blockly.Flyout);
Blockly.VerticalFlyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;try{var a=this.workspace_.getCanvas().getBBox()}catch(e){a={height:0,y:0,width:0,x:0}}var b=this.SCROLLBAR_PADDING,c=this.height_-2*this.SCROLLBAR_PADDING,d=this.width_;this.RTL||(d-=this.SCROLLBAR_PADDING);return{viewHeight:c,viewWidth:d,contentHeight:a.height*this.workspace_.scale+2*this.MARGIN,contentWidth:a.width*this.workspace_.scale+2*this.MARGIN,viewTop:-this.workspace_.scrollY+a.y,viewLeft:-this.workspace_.scrollX,
contentTop:a.y,contentLeft:a.x,absoluteTop:b,absoluteLeft:0}};Blockly.VerticalFlyout.prototype.setMetrics_=function(a){var b=this.getMetrics_();b&&("number"==typeof a.y&&(this.workspace_.scrollY=-b.contentHeight*a.y),this.workspace_.translate(this.workspace_.scrollX+b.absoluteLeft,this.workspace_.scrollY+b.absoluteTop))};
Blockly.VerticalFlyout.prototype.position=function(){if(this.isVisible()){var a=this.targetWorkspace_.getMetrics();a&&(this.height_=a.viewHeight,this.setBackgroundPath_(this.width_-this.CORNER_RADIUS,a.viewHeight-2*this.CORNER_RADIUS),this.positionAt_(this.width_,this.height_,this.targetWorkspace_.toolboxPosition==this.toolboxPosition_?a.toolboxWidth?this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?a.toolboxWidth:a.viewWidth-this.width_:this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?0:a.viewWidth:this.toolboxPosition_==
@@ -1235,25 +1273,25 @@ Blockly.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;",
"-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","}",".blocklyCommentForeignObject {",
"position: relative;","z-index: 0;","}",".blocklyCommentRect {","fill: #E7DE8E;","stroke: #bcA903;","stroke-width: 1px","}",".blocklyCommentTarget {","fill: transparent;","stroke: #bcA903;","}",".blocklyCommentTargetFocused {","fill: none;","}",".blocklyCommentHandleTarget {","fill: none;","}",".blocklyCommentHandleTargetFocused {","fill: transparent;","}",".blocklyFocused>.blocklyCommentRect {","fill: #B9B272;","stroke: #B9B272;","}",".blocklySelected>.blocklyCommentTarget {","stroke: #fc3;","stroke-width: 3px;",
"}",".blocklyCommentTextarea {","background-color: #fef49c;","border: 0;","outline: 0;","margin: 0;","padding: 3px;","resize: none;","display: block;","overflow: hidden;","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklySelected > .blocklyCommentDeleteIcon {","display: block","}",".blocklyDeleteIconShape {","fill: #000;","stroke: #000;","stroke-width: 1px;","}",".blocklyDeleteIconShape.blocklyDeleteIconHighlighted {","stroke: #fc3;","}",".blocklyHtmlInput {",
"border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyTransparentBackground {","opacity: 0;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {",
"z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {",
"opacity: .8;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyAngleCircle {","stroke: #444;","stroke-width: 1;","fill: #ddd;","fill-opacity: .8;","}",".blocklyAngleMarks {","stroke: #444;","stroke-width: 1;","}",".blocklyAngleGauge {","fill: #f88;","fill-opacity: .8;","}",".blocklyAngleLine {",
"stroke: #f00;","stroke-width: 2;","stroke-linecap: round;","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem, ",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl, ",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {",
"padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;","}",".blocklyToolboxDiv {","background-color: #ddd;",
"overflow-x: visible;","overflow-y: auto;","position: absolute;","user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {","height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;",
"}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<<PATH>>>/sprites.png);",
"height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;",
"}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyColourTable {","border-collapse: collapse;","outline: none;","padding: 1px;","display: block;",
"}",".blocklyColourTable>tr>td {","padding: 0;","cursor: pointer;","border: .5px solid transparent;","height: 25px;","width: 25px;","box-sizing: border-box;","display: inline-block;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","position: relative;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}",".blocklyWidgetDiv .goog-menu {",
"background: #fff;","border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',
"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem, ",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem { ",
"padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",".blocklyWidgetDiv .goog-menuitem-disabled, ",".blocklyDropDownDiv .goog-menuitem-disabled {",
"cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);",
"}",".blocklyWidgetDiv .goog-menuitem-highlight, ",".blocklyWidgetDiv .goog-menuitem-hover {","background-color: #f1f3f4;","}",".blocklyDropDownDiv .goog-menuitem-highlight, ",".blocklyDropDownDiv .goog-menuitem-hover {","background-color: rgba(0,0,0,.2);","}",".blocklyWidgetDiv .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-icon {","background-repeat: no-repeat;","height: 16px;","left: 6px;",
"position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon, ",
".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}",".blocklyWidgetDiv .goog-menuitem-accel, ",
".blocklyDropDownDiv .goog-menuitem-accel {","color: #999;","direction: ltr;","left: auto;","padding: 0 6px;","position: absolute;","right: 0;","text-align: right;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-accel {","left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator, ",
".blocklyDropDownDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .goog-menuseparator, ",".blocklyDropDownDiv .goog-menuseparator {","border-top: 1px solid #ccc;","margin: 4px 0;","padding: 0;","}",""];Blockly.WidgetDiv={};Blockly.WidgetDiv.DIV=null;Blockly.WidgetDiv.owner_=null;Blockly.WidgetDiv.dispose_=null;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=document.createElement("div"),Blockly.WidgetDiv.DIV.className="blocklyWidgetDiv",document.body.appendChild(Blockly.WidgetDiv.DIV))};
"border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyTransparentBackground {","opacity: 0;","}",".blocklyMainWorkspaceScrollbar {",
"z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {",
"opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyAngleCircle {","stroke: #444;","stroke-width: 1;","fill: #ddd;","fill-opacity: .8;","}",".blocklyAngleMarks {","stroke: #444;","stroke-width: 1;",
"}",".blocklyAngleGauge {","fill: #f88;","fill-opacity: .8;","}",".blocklyAngleLine {","stroke: #f00;","stroke-width: 2;","stroke-linecap: round;","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem, ",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl, ",
".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {","padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;",
"}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {","height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",
".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;",
"margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<<PATH>>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;",
"}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyColourTable {",
"border-collapse: collapse;","outline: none;","padding: 1px;","display: block;","}",".blocklyColourTable>tr>td {","padding: 0;","cursor: pointer;","border: .5px solid transparent;","height: 25px;","width: 25px;","box-sizing: border-box;","display: inline-block;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","position: relative;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;",
"outline: 1px solid #333;","position: relative;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);",
"}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem, ",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem, ",
".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem { ","padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {",
"color: #fff;","}",".blocklyWidgetDiv .goog-menuitem-disabled, ",".blocklyDropDownDiv .goog-menuitem-disabled {","cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon, ",
".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight, ",".blocklyWidgetDiv .goog-menuitem-hover {","background-color: #f1f3f4;","}",".blocklyDropDownDiv .goog-menuitem-highlight, ",".blocklyDropDownDiv .goog-menuitem-hover {","background-color: rgba(0,0,0,.2);","}",".blocklyWidgetDiv .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-checkbox, ",
".blocklyDropDownDiv .goog-menuitem-icon {","background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox, ",
".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {",
"float: right;","margin-right: -24px;","}",".blocklyWidgetDiv .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-accel {","color: #999;","direction: ltr;","left: auto;","padding: 0 6px;","position: absolute;","right: 0;","text-align: right;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-accel {","left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-hint {",
"text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .goog-menuseparator, ",".blocklyDropDownDiv .goog-menuseparator {","border-top: 1px solid #ccc;","margin: 4px 0;","padding: 0;","}",""];Blockly.WidgetDiv={};Blockly.WidgetDiv.DIV=null;Blockly.WidgetDiv.owner_=null;Blockly.WidgetDiv.dispose_=null;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=document.createElement("div"),Blockly.WidgetDiv.DIV.className="blocklyWidgetDiv",document.body.appendChild(Blockly.WidgetDiv.DIV))};
Blockly.WidgetDiv.show=function(a,b,c){Blockly.WidgetDiv.hide();Blockly.WidgetDiv.owner_=a;Blockly.WidgetDiv.dispose_=c;a=Blockly.utils.style.getViewportPageOffset();Blockly.WidgetDiv.DIV.style.top=a.y+"px";Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block"};
Blockly.WidgetDiv.hide=function(){Blockly.WidgetDiv.owner_&&(Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.DIV.style.display="none",Blockly.WidgetDiv.DIV.style.left="",Blockly.WidgetDiv.DIV.style.top="",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=null,Blockly.WidgetDiv.DIV.innerHTML="")};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};
Blockly.WidgetDiv.positionInternal_=function(a,b,c){Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c+"px"};Blockly.WidgetDiv.positionWithAnchor=function(a,b,c,d){var e=Blockly.WidgetDiv.calculateY_(a,b,c);a=Blockly.WidgetDiv.calculateX_(a,b,c,d);0>e?Blockly.WidgetDiv.positionInternal_(a,0,c.height+e):Blockly.WidgetDiv.positionInternal_(a,e,c.height)};
@@ -1274,10 +1312,10 @@ Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blo
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.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(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.onKeyDown_=function(a){var b=Blockly.mainWorkspace;if(!(Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible()))if(b.options.readOnly){if(Blockly.keyboardAccessibilityMode)Blockly.navigation.onKeyPress(a)}else{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)};
Blockly.getMainWorkspace=function(){return Blockly.mainWorkspace};Blockly.alert=function(a,b){alert(a);b&&b()};Blockly.confirm=function(a,b){b(confirm(a))};Blockly.prompt=function(a,b,c){c(prompt(a,b))};Blockly.jsonInitFactory_=function(a){return function(){this.jsonInit(a)}};

View File

@@ -500,7 +500,7 @@ Blockly.Gesture.prototype.doStart = function(e) {
if (this.targetBlock_) {
this.targetBlock_.select();
if (!this.targetBlock_.isInFlyout && e.shiftKey) {
Blockly.navigation.focusWorkspace();
Blockly.navigation.enableKeyboardAccessibility();
}
}
@@ -760,15 +760,14 @@ Blockly.Gesture.prototype.doBlockClick_ = function() {
* @private
*/
Blockly.Gesture.prototype.doWorkspaceClick_ = function(e) {
Blockly.keyboardAccessibilityMode = false;
Blockly.navigation.disableKeyboardAccessibility();
var ws = this.creatorWorkspace_;
ws.cursor.hide();
if (e.shiftKey) {
Blockly.navigation.enableKeyboardAccessibility();
var screenCoord = new Blockly.utils.Coordinate(e.clientX, e.clientY);
var wsCoord = Blockly.utils.screenToWsCoordinates(ws, screenCoord);
var wsNode = Blockly.ASTNode.createWorkspaceNode(ws, wsCoord);
ws.cursor.setLocation(wsNode);
Blockly.keyboardAccessibilityMode = true;
} else if (Blockly.selected) {
Blockly.selected.unselect();
}

View File

@@ -90,6 +90,12 @@ Blockly.Cursor.prototype.setLocation = function(newNode) {
*/
Blockly.Cursor.prototype.update_ = function() {};
/**
* Hide method to be overwritten in cursor_svg.
* @protected
*/
Blockly.Cursor.prototype.hide = function() {};
/**
* Find the next connection, field, or block.
* @return {Blockly.ASTNode} The next element, or null if the current node is

View File

@@ -34,7 +34,7 @@ Blockly.navigation.cursor_ = null;
/**
* The marker that shows where a user has marked while navigating blocks.
* @type {!Blockly.CursorSvg}
* @type {!Blockly.Cursor}
*/
Blockly.navigation.marker_ = null;
@@ -731,13 +731,15 @@ Blockly.navigation.disconnectBlocks = function() {
Blockly.navigation.focusWorkspace = function() {
var cursor = Blockly.navigation.cursor_;
var reset = Blockly.getMainWorkspace().getToolbox() ? true : false;
var topBlocks = Blockly.getMainWorkspace().getTopBlocks();
Blockly.navigation.resetFlyout(reset);
Blockly.navigation.currentState_ = Blockly.navigation.STATE_WS;
Blockly.navigation.enableKeyboardAccessibility();
if (Blockly.selected) {
cursor.setLocation(Blockly.navigation.getTopNode_(Blockly.selected));
Blockly.selected.unselect();
} else if (topBlocks.length > 0) {
cursor.setLocation(Blockly.navigation.getTopNode_(topBlocks[0]));
} else {
var ws = cursor.workspace_;
// TODO: Find the center of the visible workspace.
@@ -991,14 +993,20 @@ Blockly.navigation.toolboxOnAction_ = function(action) {
* Enable accessibility mode.
*/
Blockly.navigation.enableKeyboardAccessibility = function() {
Blockly.keyboardAccessibilityMode = true;
if (!Blockly.keyboardAccessibilityMode) {
Blockly.keyboardAccessibilityMode = true;
Blockly.navigation.focusWorkspace();
}
};
/**
* Disable accessibility mode.
*/
Blockly.navigation.disableKeyboardAccessibility = function() {
Blockly.keyboardAccessibilityMode = false;
if (Blockly.keyboardAccessibilityMode) {
Blockly.keyboardAccessibilityMode = false;
Blockly.navigation.cursor_.hide();
}
};
/**

View File

@@ -268,9 +268,6 @@
*/
function preOrderDemo() {
Blockly.navigation.enableKeyboardAccessibility();
if (!Blockly.navigation.cursor_.getCurNode()) {
Blockly.navigation.focusWorkspace();
}
demo();
}
@@ -282,18 +279,6 @@
*/
function turnOnAccessibility() {
Blockly.navigation.enableKeyboardAccessibility();
var blocks = Blockly.getMainWorkspace().getTopBlocks();
if (blocks.length > 0) {
var newNode;
if (blocks[0].previousConnection) {
newNode = Blockly.ASTNode.createConnectionNode(blocks[0].previousConnection);
} else {
newNode = Blockly.ASTNode.createBlockNode(blocks[0]);
}
Blockly.navigation.cursor_.setLocation(newNode);
} else {
Blockly.navigation.focusWorkspace();
}
}
</script>

View File

@@ -83,5 +83,16 @@ suite('Gesture', function() {
flyout.autoClose = false;
gestureIsFieldClick_InFlyoutHelper.call(this, flyout, true);
});
test('Workspace click - Shift click enters accessibility mode', function() {
var event = {
shiftKey : true,
};
var ws = Blockly.inject('blocklyDiv', {});
var gesture = new Blockly.Gesture(this.e, ws);
assertFalse(Blockly.keyboardAccessibilityMode);
gesture.doWorkspaceClick_(event);
assertTrue(Blockly.keyboardAccessibilityMode);
});
});

View File

@@ -24,7 +24,6 @@ suite('Insert/Modify', function() {
this.statement_block_2 = this.workspace.getBlockById('statement_block_2');
Blockly.navigation.enableKeyboardAccessibility();
Blockly.navigation.focusWorkspace();
});
teardown(function() {

View File

@@ -221,7 +221,7 @@ suite('Navigation', function() {
}]);
var toolbox = document.getElementById('toolbox-categories');
this.workspace = Blockly.inject('blocklyDiv', {toolbox: toolbox});
Blockly.navigation.focusWorkspace();
Blockly.navigation.enableKeyboardAccessibility();
this.basicBlock = this.workspace.newBlock('basic_block');
this.firstCategory_ = this.workspace.getToolbox().tree_.firstChild_;
this.mockEvent = {
@@ -633,10 +633,9 @@ suite('Navigation', function() {
}]);
var toolbox = document.getElementById('toolbox-categories');
this.workspace = Blockly.inject('blocklyDiv', {toolbox: toolbox});
Blockly.navigation.focusWorkspace();
Blockly.navigation.enableKeyboardAccessibility();
this.basicBlockA = this.workspace.newBlock('basic_block');
this.basicBlockB = this.workspace.newBlock('basic_block');
Blockly.keyboardAccessibilityMode = true;
});
teardown(function() {