Implement drop-down menus and icon picker field (#233)

* Icon menu and drop-down stubs

* Recompile 4/15

* Fix stubs to draw shadow block for drop-down

* Fix rendering of shadow for icon menu

* Add arrow to dropdown button

* Add drop-down buttons to rest of examples

* Implementation of drop-down div including positioning

* Drop-downs take colours from the blocks

* Fix scaled secondary position of drop-downs

* Fix arrow positioning for RTL

* Use SVG parentNode for sizing dropdown

* Use transform for drop-down positioning

* Add basic DropDownDiv hide

* Add animation-in to dropdown

* More subtle drop-down animation and shadow

* Add icon menu example

* Use options style of Blockly FieldImage for drop-down

* Add default value for iconmenu

* Add example hover, active states for iconmenu buttons

* Update dropdown_icon example

* Implement icon-menu value handling and default value

* Add updating the parent block image field to dropdown

* Drop-down animates out; add hooks to hide for various Blockly happenings

* Add pointer cursor for drop-down icons

* Improve documentation for drop-downs and minor refactor

* Factor out getSrcForValue in iconmenu

* Blocks take on the icon of their icon-menu

* Add basic accessibility properties, similar to closure

* Remove extra drop-down example; update playgrounds

* Remove unnecessary colour overrides

* Add onHide, colour changing, fix references in dropdowndiv

* Flip arrow when the drop-down is rendered above

* Hide the icon menu drop-down on second tap of button

* Add preventDefault to button ontouchstart

* Updates to drop-down from Carl

* Add icon-menu placeholders and a crazy demo

* Fix naming to normalize (drop-down, DropDown)

* Add license header
This commit is contained in:
Tim Mickel 2016-04-21 15:33:28 -04:00
parent 96e9bff481
commit cf6725ba4c
29 changed files with 1197 additions and 207 deletions

View file

@ -854,7 +854,8 @@ goog.ui.tree.TreeControl.prototype.handleMouseEvent_=function(a){goog.log.fine(t
goog.ui.tree.TreeControl.prototype.handleKeyEvent=function(a){var b=!1;(b=this.typeAhead_.handleNavigation(a)||this.selectedItem_&&this.selectedItem_.onKeyDown(a)||this.typeAhead_.handleTypeAheadChar(a))&&a.preventDefault();return b};goog.ui.tree.TreeControl.prototype.getNodeFromEvent_=function(a){var b=null;for(a=a.target;null!=a;){if(b=goog.ui.tree.BaseNode.allNodes[a.id])return b;if(a==this.getElement())break;a=a.parentNode}return null};
goog.ui.tree.TreeControl.prototype.createNode=function(a){return new goog.ui.tree.TreeNode(a||goog.html.SafeHtml.EMPTY,this.getConfig(),this.getDomHelper())};goog.ui.tree.TreeControl.prototype.setNode=function(a){this.typeAhead_.setNodeInMap(a)};goog.ui.tree.TreeControl.prototype.removeNode=function(a){this.typeAhead_.removeNodeFromMap(a)};goog.ui.tree.TreeControl.prototype.clearTypeAhead=function(){this.typeAhead_.clear()};goog.ui.tree.TreeControl.defaultConfig=goog.ui.tree.BaseNode.defaultConfig;
// Copyright 2013 Google Inc. Apache License 2.0
var Blockly={Blocks:{}};
var Blockly={Blocks:{}};Blockly.Colours={motion:{primary:"#4C97FF",secondary:"#4280D7",tertiary:"#3373CC"},looks:{primary:"#9966FF",secondary:"#855CD6",tertiary:"#774DCB"},sounds:{primary:"#D65CD6",secondary:"#BF40BF",tertiary:"#A63FA6"},control:{primary:"#FFAB19",secondary:"#EC9C13",tertiary:"#CF8B17"},event:{primary:"#FFD500",secondary:"#DBC200",tertiary:"#CCAA00"},text:"#575E75",workspace:"#F5F8FF",toolbox:"#DDDDDD",toolboxText:"#000000",flyout:"#DDDDDD",scrollbar:"#CCCCCC",scrollbarHover:"#BBBBBB",textField:"#FFFFFF",
insertionMarker:"#949494",insertionMarkerOpacity:.6};
// Copyright 2012 Google Inc. Apache License 2.0
Blockly.Workspace=function(a){this.id=Blockly.genUid();Blockly.Workspace.WorkspaceDB_[this.id]=this;this.options=a||{};this.RTL=!!this.options.RTL;this.horizontalLayout=!!this.options.horizontalLayout;this.topBlocks_=[];this.listeners_=[];this.tapListeners_=[];this.undoStack_=[];this.redoStack_=[]};Blockly.Workspace.prototype.rendered=!1;Blockly.Workspace.prototype.MAX_UNDO=1024;Blockly.Workspace.prototype.dispose=function(){this.listeners_.length=0;this.clear();delete Blockly.Workspace.WorkspaceDB_[this.id]};
Blockly.Workspace.SCAN_ANGLE=3;Blockly.Workspace.prototype.addTopBlock=function(a){this.topBlocks_.push(a)};Blockly.Workspace.prototype.removeTopBlock=function(a){for(var b=!1,c,d=0;c=this.topBlocks_[d];d++)if(c==a){this.topBlocks_.splice(d,1);b=!0;break}if(!b)throw"Block not present in workspace's list of top-most blocks.";};
@ -975,9 +976,9 @@ Math.max(0,b));this.svgKnob_.setAttribute("y",this.constrainKnob_(d))}this.onScr
Blockly.Scrollbar.prototype.createDom_=function(){this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical")},null);this.svgBackground_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarBackground"},this.svgGroup_);var a=Math.floor((Blockly.Scrollbar.scrollbarThickness-5)/2);this.svgKnob_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarKnob",rx:a,ry:a},this.svgGroup_);Blockly.Scrollbar.insertAfter_(this.svgGroup_,this.workspace_.getBubbleCanvas())};
Blockly.Scrollbar.prototype.isVisible=function(){return"none"!=this.svgGroup_.getAttribute("display")};Blockly.Scrollbar.prototype.setVisible=function(a){if(a!=this.isVisible()){if(this.pair_)throw"Unable to toggle visibility of paired scrollbars.";a?this.svgGroup_.setAttribute("display","block"):(this.workspace_.setMetrics({x:0,y:0}),this.svgGroup_.setAttribute("display","none"))}};
Blockly.Scrollbar.prototype.onMouseDownBar_=function(a){this.onMouseUpKnob_();if(!Blockly.isRightButton(a)){var b=Blockly.mouseToSvg(a,this.workspace_.getParentSvg()),b=this.horizontal_?b.x:b.y,c=Blockly.getSvgXY_(this.svgKnob_,this.workspace_),c=this.horizontal_?c.x:c.y,d=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"width":"height")),e=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),f=.95*d;b<=c?e-=f:b>=c+d&&(e+=f);this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(e));
this.onScroll_()}a.stopPropagation()};
Blockly.Scrollbar.prototype.onMouseDownKnob_=function(a){this.onMouseUpKnob_();Blockly.isRightButton(a)||(Blockly.setPageSelectable(!1),this.startDragKnob=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),this.startDragMouse=this.horizontal_?a.clientX:a.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,this.onMouseUpKnob_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.onMouseMoveKnob_));a.stopPropagation()};
Blockly.Scrollbar.prototype.onMouseMoveKnob_=function(a){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(this.startDragKnob+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse)));this.onScroll_()};
Blockly.WidgetDiv.hide(!0);this.onScroll_()}a.stopPropagation()};
Blockly.Scrollbar.prototype.onMouseDownKnob_=function(a){this.onMouseUpKnob_();Blockly.isRightButton(a)||(Blockly.setPageSelectable(!1),this.startDragKnob=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),this.startDragMouse=this.horizontal_?a.clientX:a.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,this.onMouseUpKnob_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.onMouseMoveKnob_),Blockly.WidgetDiv.hide(!0));
a.stopPropagation()};Blockly.Scrollbar.prototype.onMouseMoveKnob_=function(a){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(this.startDragKnob+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse)));this.onScroll_()};
Blockly.Scrollbar.prototype.onMouseUpKnob_=function(){Blockly.setPageSelectable(!0);Blockly.hideChaff(!0);Blockly.Scrollbar.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_),Blockly.Scrollbar.onMouseUpWrapper_=null);Blockly.Scrollbar.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseMoveWrapper_),Blockly.Scrollbar.onMouseMoveWrapper_=null)};
Blockly.Scrollbar.prototype.constrainKnob_=function(a){if(0>=a||isNaN(a))a=0;else{var b=this.horizontal_?"width":"height",c=parseFloat(this.svgBackground_.getAttribute(b)),b=parseFloat(this.svgKnob_.getAttribute(b));a=Math.min(a,c-b)}return a};
Blockly.Scrollbar.prototype.onScroll_=function(){var a=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),b=parseFloat(this.svgBackground_.getAttribute(this.horizontal_?"width":"height")),a=a/b;isNaN(a)&&(a=0);b={};this.horizontal_?b.x=a:b.y=a;this.workspace_.setMetrics(b)};Blockly.Scrollbar.prototype.set=function(a){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",a*(this.ratio_||0));this.onScroll_()};
@ -1034,7 +1035,7 @@ Blockly.WorkspaceSvg.prototype.isDeleteArea=function(a){a=new goog.math.Coordina
Blockly.WorkspaceSvg.prototype.onMouseDown_=function(a){this.markFocused();Blockly.setPageSelectable(!1);Blockly.isTargetInput_(a)||(Blockly.svgResize(this),Blockly.terminateDrag_(),Blockly.hideChaff(),a.target&&a.target.nodeName&&("svg"==a.target.nodeName.toLowerCase()||a.target==this.svgBackground_)&&Blockly.selected&&!this.options.readOnly&&Blockly.selected.unselect(),Blockly.isRightButton(a)?this.showContextMenu_(a):this.scrollbar&&(this.isScrolling=!0,this.startDragMouseX=a.clientX,this.startDragMouseY=
a.clientY,this.startDragMetrics=this.getMetrics(),this.startScrollX=this.scrollX,this.startScrollY=this.scrollY,"mouseup"in Blockly.bindEvent_.TOUCH_MAP&&(Blockly.onTouchUpWrapper_=Blockly.onTouchUpWrapper_||[],Blockly.onTouchUpWrapper_=Blockly.onTouchUpWrapper_.concat(Blockly.bindEvent_(document,"mouseup",null,Blockly.onMouseUp_))),Blockly.onMouseMoveWrapper_=Blockly.onMouseMoveWrapper_||[],Blockly.onMouseMoveWrapper_=Blockly.onMouseMoveWrapper_.concat(Blockly.bindEvent_(document,"mousemove",null,
Blockly.onMouseMove_))),a.stopPropagation())};Blockly.WorkspaceSvg.prototype.startDrag=function(a,b,c){a=Blockly.mouseToSvg(a,this.getParentSvg());a.x/=this.scale;a.y/=this.scale;this.dragDeltaX_=b-a.x;this.dragDeltaY_=c-a.y};Blockly.WorkspaceSvg.prototype.moveDrag=function(a){a=Blockly.mouseToSvg(a,this.getParentSvg());a.x/=this.scale;a.y/=this.scale;return new goog.math.Coordinate(this.dragDeltaX_+a.x,this.dragDeltaY_+a.y)};
Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(a){if(a.ctrlKey){Blockly.terminateDrag_();var b=0<a.deltaY?-1:1,c=Blockly.mouseToSvg(a,this.getParentSvg());this.zoom(c.x,c.y,b)}else b=this.scrollX-a.deltaX,c=this.scrollY-a.deltaY,this.startDragMetrics=this.getMetrics(),this.scroll(b,c);a.preventDefault()};
Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(a){if(a.ctrlKey){Blockly.terminateDrag_();var b=0<a.deltaY?-1:1,c=Blockly.mouseToSvg(a,this.getParentSvg());this.zoom(c.x,c.y,b)}else Blockly.WidgetDiv.hide(!0),b=this.scrollX-a.deltaX,c=this.scrollY-a.deltaY,this.startDragMetrics=this.getMetrics(),this.scroll(b,c);a.preventDefault()};
Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var a=this.getTopBlocks();if(!a.length)return{x:0,y:0,width:0,height:0};for(var b=a[0].getBoundingRectangle(),c=1;c<a.length;c++){var d=a[c].getBoundingRectangle();d.topLeft.x<b.topLeft.x&&(b.topLeft.x=d.topLeft.x);d.bottomRight.x>b.bottomRight.x&&(b.bottomRight.x=d.bottomRight.x);d.topLeft.y<b.topLeft.y&&(b.topLeft.y=d.topLeft.y);d.bottomRight.y>b.bottomRight.y&&(b.bottomRight.y=d.bottomRight.y)}return{x:b.topLeft.x,y:b.topLeft.y,width:b.bottomRight.x-
b.topLeft.x,height:b.bottomRight.y-b.topLeft.y}};Blockly.WorkspaceSvg.prototype.cleanUp_=function(){Blockly.Events.setGroup(!0);for(var a=this.getTopBlocks(!0),b=0,c=0,d;d=a[c];c++){var e=d.getRelativeToSurfaceXY();d.moveBy(-e.x,b-e.y);d.snapToGrid();b=d.getRelativeToSurfaceXY().y+d.getHeightWidth().height+Blockly.BlockSvg.MIN_BLOCK_Y}Blockly.Events.setGroup(!1);Blockly.fireUiEvent(window,"resize")};
Blockly.WorkspaceSvg.prototype.showContextMenu_=function(a){function b(a){if(a.isDeletable())m=m.concat(a.getDescendants());else{a=a.getChildren();for(var c=0;c<a.length;c++)b(a[c])}}function c(){Blockly.Events.setGroup(f);var a=m.shift();a&&(a.workspace?(a.dispose(!1,!0),setTimeout(c,10)):c());Blockly.Events.setGroup(!1)}if(!this.options.readOnly&&!this.isFlyout){var d=[],e=this.getTopBlocks(!0),f=Blockly.genUid(),g={};g.text=Blockly.Msg.UNDO;g.enabled=0<this.undoStack_.length;g.callback=this.undo.bind(this,
@ -1044,11 +1045,11 @@ Blockly.Workspace.prototype.setAudioCallback=function(a){this.audioCallback_=a};
Blockly.WorkspaceSvg.prototype.updateToolbox=function(a){if(a=Blockly.parseToolboxTree_(a)){if(!this.options.languageTree)throw"Existing toolbox is null. Can't create new toolbox.";if(a.getElementsByTagName("category").length){if(!this.toolbox_)throw"Existing toolbox has no categories. Can't change mode.";this.options.languageTree=a;this.toolbox_.populate_(a);this.toolbox_.addColour_()}else{if(!this.flyout_)throw"Existing toolbox has categories. Can't change mode.";this.options.languageTree=a;
this.flyout_.show(a.childNodes)}}else if(this.options.languageTree)throw"Can't nullify an existing toolbox.";};Blockly.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():Blockly.mainWorkspace=this};
Blockly.WorkspaceSvg.prototype.zoom=function(a,b,c){var d=this.options.zoomOptions.scaleSpeed,e=this.getMetrics(),f=this.getParentSvg().createSVGPoint();f.x=a;f.y=b;f=f.matrixTransform(this.getCanvas().getCTM().inverse());a=f.x;b=f.y;f=this.getCanvas();c=1==c?d:1/d;d=this.scale*c;d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:d<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale/this.scale);a=f.getCTM().translate(a*(1-c),b*(1-c)).scale(c);this.scale!=
a.a&&(this.scale=a.a,this.scrollX=a.e-e.absoluteLeft,this.scrollY=a.f-e.absoluteTop,this.updateGridPattern_(),this.scrollbar?this.scrollbar.resize():this.translate(0,0),Blockly.hideChaff(!1),this.flyout_&&this.flyout_.reflow())};Blockly.WorkspaceSvg.prototype.zoomCenter=function(a){var b=this.getMetrics();this.zoom(b.viewWidth/2,b.viewHeight/2,a)};
a.a&&(this.scale=a.a,this.scrollX=a.e-e.absoluteLeft,this.scrollY=a.f-e.absoluteTop,this.updateGridPattern_(),this.scrollbar?this.scrollbar.resize():this.translate(0,0),Blockly.WidgetDiv.hide(!0),Blockly.hideChaff(!1),this.flyout_&&this.flyout_.reflow())};Blockly.WorkspaceSvg.prototype.zoomCenter=function(a){var b=this.getMetrics();this.zoom(b.viewWidth/2,b.viewHeight/2,a)};
Blockly.WorkspaceSvg.prototype.zoomToFit=function(){var a=this.svgBackground_.getBBox(),b=this.svgBlockCanvas_.getBBox(),c=a.width-this.toolbox_.width-Blockly.Scrollbar.scrollbarThickness,a=a.height-Blockly.Scrollbar.scrollbarThickness,d=b.width,b=b.height;if(0!=d){var e=this.options.zoomOptions.scaleSpeed,c=Math.pow(e,Math.floor(Math.log(Math.min(c/d,a/b))/Math.log(e)));c>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale:c<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale);
this.scale=c;this.updateGridPattern_();this.scrollbar.resize();Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();c=this.getMetrics();this.scrollbar.set((c.contentWidth-c.viewWidth)/2,(c.contentHeight-c.viewHeight)/2)}};
Blockly.WorkspaceSvg.prototype.zoomReset=function(a){this.scale=1;this.updateGridPattern_();Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();this.scrollbar&&this.scrollbar.resize();var b=this.getMetrics();this.scrollbar?this.scrollbar.set((b.contentWidth-b.viewWidth)/2,(b.contentHeight-b.viewHeight)/2):this.translate(0,0);a.stopPropagation()};
Blockly.WorkspaceSvg.prototype.scroll=function(a,b){var c=this.startDragMetrics;a=Math.min(a,-c.contentLeft);b=Math.min(b,-c.contentTop);a=Math.max(a,c.viewWidth-c.contentLeft-c.contentWidth);b=Math.max(b,c.viewHeight-c.contentTop-c.contentHeight);this.scrollbar.set(-a-c.contentLeft,-b-c.contentTop)};
this.scale=c;this.updateGridPattern_();this.scrollbar.resize();Blockly.WidgetDiv.hide(!0);Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();c=this.getMetrics();this.scrollbar.set((c.contentWidth-c.viewWidth)/2,(c.contentHeight-c.viewHeight)/2)}};
Blockly.WorkspaceSvg.prototype.zoomReset=function(a){this.scale=1;this.updateGridPattern_();Blockly.WidgetDiv.hide(!0);Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();this.scrollbar&&this.scrollbar.resize();var b=this.getMetrics();this.scrollbar?this.scrollbar.set((b.contentWidth-b.viewWidth)/2,(b.contentHeight-b.viewHeight)/2):this.translate(0,0);a.stopPropagation()};
Blockly.WorkspaceSvg.prototype.scroll=function(a,b){var c=this.startDragMetrics;a=Math.min(a,-c.contentLeft);b=Math.min(b,-c.contentTop);a=Math.max(a,c.viewWidth-c.contentLeft-c.contentWidth);b=Math.max(b,c.viewHeight-c.contentTop-c.contentHeight);Blockly.WidgetDiv.hide(!0);this.scrollbar.set(-a-c.contentLeft,-b-c.contentTop)};
Blockly.WorkspaceSvg.prototype.updateGridPattern_=function(){if(this.options.gridPattern){var a=this.options.gridOptions.spacing*this.scale||100;this.options.gridPattern.setAttribute("width",a);this.options.gridPattern.setAttribute("height",a);var a=Math.floor(this.options.gridOptions.spacing/2)+.5,b=a-this.options.gridOptions.length/2,c=a+this.options.gridOptions.length/2,d=this.options.gridPattern.firstChild,e=d&&d.nextSibling,a=a*this.scale,b=b*this.scale,c=c*this.scale;d&&(d.setAttribute("stroke-width",
this.scale),d.setAttribute("x1",b),d.setAttribute("y1",a),d.setAttribute("x2",c),d.setAttribute("y2",a));e&&(e.setAttribute("stroke-width",this.scale),e.setAttribute("x1",a),e.setAttribute("y1",b),e.setAttribute("x2",a),e.setAttribute("y2",c))}};Blockly.WorkspaceSvg.prototype.setVisible=Blockly.WorkspaceSvg.prototype.setVisible;Blockly.Mutator=function(a){Blockly.Mutator.superClass_.constructor.call(this,null);this.quarkNames_=a};goog.inherits(Blockly.Mutator,Blockly.Icon);Blockly.Mutator.prototype.workspaceWidth_=0;Blockly.Mutator.prototype.workspaceHeight_=0;
Blockly.Mutator.prototype.drawIcon_=function(a){Blockly.createSvgElement("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);Blockly.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},a);
@ -1079,7 +1080,7 @@ Blockly.Block.prototype.getInputWithBlock=function(a){for(var b=0,c;c=this.input
Blockly.Block.prototype.getFirstStatementConnection=function(){for(var a=0,b;b=this.inputList[a];a++)if(b.connection&&b.connection.type==Blockly.NEXT_STATEMENT)return b.connection;return null};Blockly.Block.prototype.getRootBlock=function(){var a,b=this;do a=b,b=a.parentBlock_;while(b);return a};Blockly.Block.prototype.getChildren=function(){return this.childBlocks_};
Blockly.Block.prototype.setParent=function(a){if(a!=this.parentBlock_){if(this.parentBlock_){for(var b=this.parentBlock_.childBlocks_,c,d=0;c=b[d];d++)if(c==this){b.splice(d,1);break}if(this.previousConnection&&this.previousConnection.isConnected())throw"Still connected to previous block.";if(this.outputConnection&&this.outputConnection.isConnected())throw"Still connected to parent block.";this.parentBlock_=null}else this.workspace.removeTopBlock(this);(this.parentBlock_=a)?a.childBlocks_.push(this):
this.workspace.addTopBlock(this)}};Blockly.Block.prototype.getDescendants=function(){for(var a=[this],b,c=0;b=this.childBlocks_[c];c++)a.push.apply(a,b.getDescendants());return a};Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setDeletable=function(a){this.deletable_=a};Blockly.Block.prototype.isMovable=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};
Blockly.Block.prototype.setMovable=function(a){this.movable_=a};Blockly.Block.prototype.isShadow=function(){return this.isShadow_};Blockly.Block.prototype.setShadow=function(a){this.isShadow_=a};Blockly.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};Blockly.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&this.setColour("#949494")};
Blockly.Block.prototype.setMovable=function(a){this.movable_=a};Blockly.Block.prototype.isShadow=function(){return this.isShadow_};Blockly.Block.prototype.setShadow=function(a){this.isShadow_=a};Blockly.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};Blockly.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&(this.setColour(Blockly.Colours.insertionMarker),this.setOpacity(Blockly.Colours.insertionMarkerOpacity))};
Blockly.Block.prototype.isEditable=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setEditable=function(a){this.editable_=a;a=0;for(var b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateEditable()};
Blockly.Block.prototype.setConnectionsHidden=function(a){if(!a&&this.isCollapsed()){if(this.outputConnection&&this.outputConnection.setHidden(a),this.previousConnection&&this.previousConnection.setHidden(a),this.nextConnection){this.nextConnection.setHidden(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionsHidden(a)}}else for(var c=this.getConnections_(!0),d=0;b=c[d];d++)b.setHidden(a),b.isSuperior()&&(b=b.targetBlock())&&b.setConnectionsHidden(a)};
Blockly.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0),d=a.getConnections_(!0);if(c.length!=d.length)throw"Connection lists did not match in length.";for(var e=0;e<d.length;e++)if(d[e]==b)return c[e];return null};Blockly.Block.prototype.setHelpUrl=function(a){this.helpUrl=a};Blockly.Block.prototype.setTooltip=function(a){this.tooltip=a};Blockly.Block.prototype.getColour=function(){return this.colour_};Blockly.Block.prototype.getColourSecondary=function(){return this.colourSecondary_};
@ -1100,8 +1101,8 @@ Blockly.Block.prototype.jsonInit=function(a){goog.asserts.assert(void 0==a.outpu
a.previousStatement);void 0!==a.nextStatement&&this.setNextStatement(!0,a.nextStatement);void 0!==a.tooltip&&this.setTooltip(a.tooltip);void 0!==a.helpUrl&&this.setHelpUrl(a.helpUrl)};
Blockly.Block.prototype.interpolate_=function(a,b,c){var d=Blockly.tokenizeInterpolation(a),e=[],f=0;a=[];for(var g=0;g<d.length;g++){var h=d[g];"number"==typeof h?(goog.asserts.assert(0<h&&h<=b.length,'Message index "%s" out of range.',h),goog.asserts.assert(!e[h],'Message index "%s" duplicated.',h),e[h]=!0,f++,a.push(b[h-1])):(h=h.trim())&&a.push(h)}goog.asserts.assert(f==b.length,"Message does not reference all %s arg(s).",b.length);!a.length||"string"!=typeof a[a.length-1]&&0!=a[a.length-1].type.indexOf("field_")||
(b={type:"input_dummy"},c&&(b.align=c),a.push(b));c={LEFT:Blockly.ALIGN_LEFT,RIGHT:Blockly.ALIGN_RIGHT,CENTRE:Blockly.ALIGN_CENTRE};d=[];for(g=0;g<a.length;g++)if(e=a[g],"string"==typeof e)d.push([e,void 0]);else{b=f=null;do switch(h=!1,e.type){case "input_value":b=this.appendValueInput(e.name);break;case "input_statement":b=this.appendStatementInput(e.name);break;case "input_dummy":b=this.appendDummyInput(e.name);break;case "field_label":f=new Blockly.FieldLabel(e.text,e["class"]);break;case "field_input":f=
new Blockly.FieldTextInput(e.text);"boolean"==typeof e.spellcheck&&f.setSpellcheck(e.spellcheck);break;case "field_angle":f=new Blockly.FieldAngle(e.angle);break;case "field_checkbox":f=new Blockly.FieldCheckbox(e.checked?"TRUE":"FALSE");break;case "field_colour":f=new Blockly.FieldColour(e.colour);break;case "field_variable":f=new Blockly.FieldVariable(e.variable);break;case "field_dropdown":f=new Blockly.FieldDropdown(e.options);break;case "field_image":f=new Blockly.FieldImage(e.src,e.width,e.height,
e.alt,e.flip_rtl);break;case "field_date":if(Blockly.FieldDate){f=new Blockly.FieldDate(e.date);break}default:e.alt&&(e=e.alt,h=!0)}while(h);if(f)d.push([f,e.name]);else if(b){e.check&&b.setCheck(e.check);e.align&&b.setAlign(c[e.align]);for(e=0;e<d.length;e++)b.appendField(d[e][0],d[e][1]);d.length=0}}};
new Blockly.FieldTextInput(e.text);"boolean"==typeof e.spellcheck&&f.setSpellcheck(e.spellcheck);break;case "field_angle":f=new Blockly.FieldAngle(e.angle);break;case "field_checkbox":f=new Blockly.FieldCheckbox(e.checked?"TRUE":"FALSE");break;case "field_colour":f=new Blockly.FieldColour(e.colour);break;case "field_variable":f=new Blockly.FieldVariable(e.variable);break;case "field_dropdown":f=new Blockly.FieldDropdown(e.options);break;case "field_iconmenu":f=new Blockly.FieldIconMenu(e.options);
break;case "field_image":f=new Blockly.FieldImage(e.src,e.width,e.height,e.alt,e.flip_rtl);break;case "field_date":if(Blockly.FieldDate){f=new Blockly.FieldDate(e.date);break}default:e.alt&&(e=e.alt,h=!0)}while(h);if(f)d.push([f,e.name]);else if(b){e.check&&b.setCheck(e.check);e.align&&b.setAlign(c[e.align]);for(e=0;e<d.length;e++)b.appendField(d[e][0],d[e][1]);d.length=0}}};
Blockly.Block.prototype.appendInput_=function(a,b){var c=null;if(a==Blockly.INPUT_VALUE||a==Blockly.NEXT_STATEMENT)c=new Blockly.Connection(this,a);c=new Blockly.Input(a,b,this,c);this.inputList.push(c);return c};
Blockly.Block.prototype.moveInputBefore=function(a,b){if(a!=b){for(var c=-1,d=b?-1:this.inputList.length,e=0,f;f=this.inputList[e];e++)if(f.name==a){if(c=e,-1!=d)break}else if(b&&f.name==b&&(d=e,-1!=c))break;goog.asserts.assert(-1!=c,'Named input "%s" not found.',a);goog.asserts.assert(-1!=d,'Reference input "%s" not found.',b);this.moveNumberedInputBefore(c,d)}};
Blockly.Block.prototype.moveNumberedInputBefore=function(a,b){goog.asserts.assert(a!=b,"Can't move input to itself.");goog.asserts.assert(a<this.inputList.length,"Input index "+a+" out of bounds.");goog.asserts.assert(b<=this.inputList.length,"Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);a<b&&b--;this.inputList.splice(b,0,c)};
@ -1111,21 +1112,25 @@ Blockly.Block.prototype.getRelativeToSurfaceXY=function(){return this.xy_};Block
Blockly.ContextMenu.show=function(a,b,c){Blockly.WidgetDiv.show(Blockly.ContextMenu,c,null);if(b.length){var d=new goog.ui.Menu;d.setRightToLeft(c);for(var e=0,f;f=b[e];e++){var g=new goog.ui.MenuItem(f.text);g.setRightToLeft(c);d.addChild(g,!0);g.setEnabled(f.enabled);f.enabled&&goog.events.listen(g,goog.ui.Component.EventType.ACTION,f.callback)}goog.events.listen(d,goog.ui.Component.EventType.ACTION,Blockly.ContextMenu.hide);b=goog.dom.getViewportSize();f=goog.style.getViewportPageOffset(document);
d.render(Blockly.WidgetDiv.DIV);var h=d.getElement();Blockly.addClass_(h,"blocklyContextMenu");var g=goog.style.getSize(h),e=a.clientX+f.x,k=a.clientY+f.y;a.clientY+g.height>=b.height&&(k-=g.height);c?g.width>=a.clientX&&(e+=g.width):a.clientX+g.width>=b.width&&(e-=g.width);Blockly.WidgetDiv.position(e,k,b,f,c);d.setAllowAutoFocus(!0);setTimeout(function(){h.focus()},1);Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()};
Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu);Blockly.ContextMenu.currentBlock=null};
Blockly.ContextMenu.callbackFactory=function(a,b){return function(){Blockly.Events.disable();var c=Blockly.Xml.domToBlock(a.workspace,b),d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-Blockly.SNAP_RADIUS:d.x+Blockly.SNAP_RADIUS;d.y+=2*Blockly.SNAP_RADIUS;c.moveBy(d.x,d.y);Blockly.Events.enable();Blockly.Events.isEnabled()&&!c.isShadow()&&Blockly.Events.fire(new Blockly.Events.Create(c));c.select()}};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.createSvgElement("g",{},null);this.svgPath_=Blockly.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_);this.svgPath_.tooltip=this;this.rendered=!1;Blockly.Tooltip.bindMouseEvents(this.svgPath_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c)};goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.dragStartXY_=null;
Blockly.BlockSvg.prototype.isGlowing_=!1;Blockly.BlockSvg.INLINE=-1;
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");for(var a=0,b;b=this.inputList[a];a++)b.init();b=this.getIcons();for(a=0;a<b.length;a++)b[a].createIcon();this.updateColour();this.updateMovable();if(!this.workspace.options.readOnly&&!this.eventsInit_){Blockly.bindEvent_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);var c=this;Blockly.bindEvent_(this.getSvgRoot(),"touchstart",null,function(a){Blockly.longStart_(a,c)})}this.eventsInit_=
!0;this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())};Blockly.BlockSvg.prototype.select=function(){if(Blockly.selected!=this){var a=null;Blockly.selected&&(a=Blockly.selected.id,Blockly.Events.disable(),Blockly.selected.unselect(),Blockly.Events.enable());a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")}};
Blockly.ContextMenu.callbackFactory=function(a,b){return function(){Blockly.Events.disable();var c=Blockly.Xml.domToBlock(a.workspace,b),d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-Blockly.SNAP_RADIUS:d.x+Blockly.SNAP_RADIUS;d.y+=2*Blockly.SNAP_RADIUS;c.moveBy(d.x,d.y);Blockly.Events.enable();Blockly.Events.isEnabled()&&!c.isShadow()&&Blockly.Events.fire(new Blockly.Events.Create(c));c.select()}};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.createSvgElement("g",{},null);this.svgPath_=Blockly.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_);this.svgPath_.tooltip=this;this.rendered=!1;Blockly.Tooltip.bindMouseEvents(this.svgPath_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c)};goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.opacity_=1;
Blockly.BlockSvg.prototype.dragStartXY_=null;Blockly.BlockSvg.prototype.isGlowing_=!1;Blockly.BlockSvg.INLINE=-1;
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");if(!this.isInsertionMarker()){for(var a=0,b;b=this.inputList[a];a++)b.init();b=this.getIcons();for(a=0;a<b.length;a++)b[a].createIcon()}this.updateColour();this.updateMovable();if(!this.workspace.options.readOnly&&!this.eventsInit_){Blockly.bindEvent_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);var c=this;Blockly.bindEvent_(this.getSvgRoot(),"touchstart",null,function(a){Blockly.longStart_(a,
c)})}this.eventsInit_=!0;this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())};
Blockly.BlockSvg.prototype.select=function(){if(Blockly.selected!=this){var a=null;Blockly.selected&&(a=Blockly.selected.id,Blockly.Events.disable(),Blockly.selected.unselect(),Blockly.Events.enable());a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")}};
Blockly.BlockSvg.prototype.unselect=function(){if(Blockly.selected==this){var a=new Blockly.Events.Ui(null,"selected",this.id,null);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=null;this.removeSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")}};Blockly.BlockSvg.prototype.setGlow=function(a){this.isGlowing_=a;this.updateColour()};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;
Blockly.BlockSvg.prototype.warning=null;Blockly.BlockSvg.prototype.getIcons=function(){var a=[];this.mutator&&a.push(this.mutator);this.comment&&a.push(this.comment);this.warning&&a.push(this.warning);return a};Blockly.BlockSvg.onMouseUpWrapper_=null;Blockly.BlockSvg.onMouseMoveWrapper_=null;
Blockly.BlockSvg.terminateDrag_=function(){Blockly.BlockSvg.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseUpWrapper_),Blockly.BlockSvg.onMouseUpWrapper_=null);Blockly.BlockSvg.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseMoveWrapper_),Blockly.BlockSvg.onMouseMoveWrapper_=null);var a=Blockly.selected;if(Blockly.dragMode_==Blockly.DRAG_FREE&&a){Blockly.insertionMarker_&&(Blockly.Events.disable(),Blockly.insertionMarkerConnection_&&Blockly.BlockSvg.disconnectInsertionMarker(),
Blockly.insertionMarker_.dispose(),Blockly.insertionMarker_=null,Blockly.Events.enable());var b=a.getRelativeToSurfaceXY(),b=goog.math.Coordinate.difference(b,a.dragStartXY_),c=new Blockly.Events.Move(a);c.oldCoordinate=a.dragStartXY_;c.recordNew();Blockly.Events.fire(c);a.moveConnections_(b.x,b.y);delete a.draggedBubbles_;a.setDragging_(!1);a.moveOffDragSurface_();a.render();var d=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(d);a.snapToGrid();Blockly.Events.setGroup(!1)},
Blockly.BUMP_DELAY/2);setTimeout(function(){Blockly.Events.setGroup(d);a.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY);Blockly.fireUiEvent(window,"resize")}Blockly.dragMode_=Blockly.DRAG_NONE;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)};
Blockly.BlockSvg.prototype.setParent=function(a){if(a!=this.parentBlock_){var b=this.getSvgRoot();if(this.parentBlock_&&b){var c=this.getRelativeToSurfaceXY();Blockly.selected!=this&&(this.workspace.getCanvas().appendChild(b),this.translate(c.x,c.y))}Blockly.Field.startCache();Blockly.BlockSvg.superClass_.setParent.call(this,a);Blockly.Field.stopCache();a&&(c=this.getRelativeToSurfaceXY(),a.getSvgRoot().appendChild(b),b=this.getRelativeToSurfaceXY(),this.moveConnections_(b.x-c.x,b.y-c.y),this.isShadow()&&
this.setColour(this.getColour(),this.getColourSecondary(),a.getColourTertiary()))}};Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.workspace.dragSurface?this.workspace.dragSurface.getGroup():null,d=this.getSvgRoot();if(d){do var e=Blockly.getRelativeXY_(d),a=a+e.x,b=b+e.y,d=d.parentNode;while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new goog.math.Coordinate(a,b)};
Blockly.BlockSvg.prototype.moveBy=function(a,b){goog.asserts.assert(!this.parentBlock_,"Block has parent.");var c=new Blockly.Events.Move(this),d=this.getRelativeToSurfaceXY();this.translate(d.x+a,d.y+b);this.moveConnections_(a,b);c.recordNew();Blockly.Events.fire(c)};Blockly.BlockSvg.prototype.translate=function(a,b,c){c?this.getSvgRoot().setAttribute("style","transform: translate3d("+a+"px,"+b+"px, 0px)"):this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};
this.setColour(this.getColour(),this.getColourSecondary(),a.getColourTertiary()))}};
Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.workspace.dragSurface?this.workspace.dragSurface.getGroup():null,d=this.getSvgRoot();if(d){do{var e=Blockly.getRelativeXY_(d),a=a+e.x,b=b+e.y;this.workspace.dragSurface&&this.workspace.dragSurface.getCurrentBlock()==d&&(e=this.workspace.dragSurface.getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new goog.math.Coordinate(a,b)};
Blockly.BlockSvg.prototype.moveBy=function(a,b){goog.asserts.assert(!this.parentBlock_,"Block has parent.");var c=new Blockly.Events.Move(this),d=this.getRelativeToSurfaceXY();this.translate(d.x+a,d.y+b);this.moveConnections_(a,b);c.recordNew();Blockly.Events.fire(c);Blockly.WidgetDiv.hide(!0)};
Blockly.BlockSvg.prototype.translate=function(a,b,c){c?this.getSvgRoot().setAttribute("style","transform: translate3d("+a+"px,"+b+"px, 0px)"):this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};
Blockly.BlockSvg.prototype.snapToGrid=function(){if(this.workspace&&Blockly.dragMode_==Blockly.DRAG_NONE&&!this.getParent()&&!this.isInFlyout&&this.workspace.options.gridOptions&&this.workspace.options.gridOptions.snap){var a=this.workspace.options.gridOptions.spacing,b=a/2,c=this.getRelativeToSurfaceXY(),d=Math.round((c.x-b)/a)*a+b-c.x,a=Math.round((c.y-b)/a)*a+b-c.y,d=Math.round(d),a=Math.round(a);0==d&&0==a||this.moveBy(d,a)}};
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.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(this),b=this.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,c=this.getHeightWidth(),d;this.RTL?(d=new goog.math.Coordinate(a.x-(c.width-b),a.y),a=new goog.math.Coordinate(a.x+b,a.y+c.height)):(d=new goog.math.Coordinate(a.x-b,a.y),a=new goog.math.Coordinate(a.x+c.width-b,a.y+c.height));return{topLeft:d,bottomRight:a}};
Blockly.BlockSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(this),b=this.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,c=this.getHeightWidth(),d;this.RTL?(d=new goog.math.Coordinate(a.x-(c.width-b),a.y),a=new goog.math.Coordinate(a.x+b,a.y+c.height)):(d=new goog.math.Coordinate(a.x-b,a.y),a=new goog.math.Coordinate(a.x+c.width-b,a.y+c.height));return{topLeft:d,bottomRight:a}};Blockly.BlockSvg.prototype.setOpacity=function(a){this.opacity_=a;this.rendered&&this.updateColour()};
Blockly.BlockSvg.prototype.getOpacity=function(){return this.opacity_};
Blockly.BlockSvg.prototype.setCollapsed=function(a){if(this.collapsed_!=a){for(var b=[],c=0,d;d=this.inputList[c];c++)b.push.apply(b,d.setVisible(!a));if(a){d=this.getIcons();for(c=0;c<d.length;c++)d[c].setVisible(!1);c=this.toString(Blockly.COLLAPSE_CHARS);this.appendDummyInput("_TEMP_COLLAPSED_INPUT").appendField(c).init()}else this.removeInput("_TEMP_COLLAPSED_INPUT"),this.setWarningText(null);Blockly.BlockSvg.superClass_.setCollapsed.call(this,a);b.length||(b[0]=this);if(this.rendered)for(c=0;a=
b[c];c++)a.render()}};Blockly.BlockSvg.prototype.tab=function(a,b){for(var c=[],d=0,e;e=this.inputList[d];d++){for(var f=0,g;g=e.fieldRow[f];f++)g instanceof Blockly.FieldTextInput&&c.push(g);e.connection&&(e=e.connection.targetBlock())&&c.push(e)}d=c.indexOf(a);-1==d&&(d=b?-1:c.length);(c=c[b?d+1:d-1])?c instanceof Blockly.Field?c.showEditor_():c.tab(null,b):(c=this.getParent())&&c.tab(this,b)};
Blockly.BlockSvg.prototype.onMouseDown_=function(a){if(!this.workspace.options.readOnly){if(!this.isInFlyout)if(Blockly.setPageSelectable(!1),this.workspace.markFocused(),Blockly.svgResize(this.workspace),Blockly.terminateDrag_(),this.select(),Blockly.hideChaff(),this.workspace.recordDeleteAreas(),Blockly.isRightButton(a))this.showContextMenu_(a);else if(this.isMovable()){Blockly.Events.getGroup()||Blockly.Events.setGroup(!0);Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);this.dragStartXY_=this.getRelativeToSurfaceXY();
@ -1138,14 +1143,14 @@ Blockly.BlockSvg.prototype.showHelp_=function(){var a=goog.isFunction(this.helpU
Blockly.BlockSvg.prototype.showContextMenu_=function(a){if(!this.workspace.options.readOnly&&this.contextMenu){var b=this,c=[];if(this.isDeletable()&&this.isMovable()&&!b.isInFlyout){var d={text:Blockly.Msg.DUPLICATE_BLOCK,enabled:!0,callback:function(){Blockly.duplicate_(b)}};this.getDescendants().length>this.workspace.remainingCapacity()&&(d.enabled=!1);c.push(d);this.isEditable()&&this.workspace.options.comments&&(d={enabled:!goog.userAgent.IE},this.comment?(d.text=Blockly.Msg.REMOVE_COMMENT,d.callback=
function(){b.setCommentText(null)}):(d.text=Blockly.Msg.ADD_COMMENT,d.callback=function(){b.setCommentText("")}),c.push(d));var d=this.getDescendants().length,e=this.getNextBlock();e&&(d-=e.getDescendants().length);d={text:1==d?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",String(d)),enabled:!0,callback:function(){b.dispose(!0,!0)}};c.push(d)}d={enabled:!(goog.isFunction(this.helpUrl)?!this.helpUrl():!this.helpUrl)};d.text=Blockly.Msg.HELP;d.callback=function(){b.showHelp_()};
c.push(d);this.customContextMenu&&!b.isInFlyout&&this.customContextMenu(c);Blockly.ContextMenu.show(a,c,this.RTL);Blockly.ContextMenu.currentBlock=this}};Blockly.BlockSvg.prototype.moveConnections_=function(a,b){if(this.rendered){for(var c=this.getConnections_(!1),d=0;d<c.length;d++)c[d].moveBy(a,b);c=this.getIcons();for(d=0;d<c.length;d++)c[d].computeIconLocation();for(d=0;d<this.childBlocks_.length;d++)this.childBlocks_[d].moveConnections_(a,b)}};
Blockly.BlockSvg.prototype.setDragging_=function(a){a?(this.addDragging(),Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0))):(this.removeDragging(),Blockly.draggingConnections_=[]);for(var b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging_(a)};Blockly.BlockSvg.prototype.moveToDragSurface_=function(){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.translate(a.x,a.y,Blockly.is3dSupported());this.workspace.dragSurface.setBlocksAndShow(this.getSvgRoot())};
Blockly.BlockSvg.prototype.moveOffDragSurface_=function(){this.workspace.dragSurface.clearAndHide(this.workspace.getCanvas());var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.translate(a.x,a.y,!1)};Blockly.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().hasAttribute("transform")&&this.getSvgRoot().removeAttribute("transform");this.getSvgRoot().hasAttribute("style")&&this.getSvgRoot().removeAttribute("style")};
Blockly.BlockSvg.prototype.onMouseMove_=function(a){if(!("mousemove"==a.type&&1>=a.clientX&&0==a.clientY&&0==a.button)){var b=this.getRelativeToSurfaceXY(),c=this.workspace.moveDrag(a);Blockly.dragMode_==Blockly.DRAG_STICKY&&goog.math.Coordinate.distance(b,c)*this.workspace.scale>Blockly.DRAG_RADIUS&&(Blockly.dragMode_=Blockly.DRAG_FREE,Blockly.longStop_(),this.moveToDragSurface_(),this.parentBlock_&&(this.unplug(),this.disconnectUiEffect()),this.setDragging_(!0));if(Blockly.dragMode_==Blockly.DRAG_FREE){var d=
b.x-this.dragStartXY_.x,b=b.y-this.dragStartXY_.y;this.translate(c.x,c.y,Blockly.is3dSupported());for(var e=0;e<this.draggedBubbles_.length;e++){var f=this.draggedBubbles_[e];f.bubble.setIconLocation(f.x+d,f.y+b)}var f=this.getConnections_(!1),g=this.lastConnectionInStack_();g&&g!=this.nextConnection&&f.push(g);for(var h=null,k=null,l=Blockly.SNAP_RADIUS,e=0;e<f.length;e++){var n=f[e],m=n.closest(l,d,b);m.connection&&(h=m.connection,k=n,l=m.radius)}this.updatePreviews(h,k,l,a,c.x-this.dragStartXY_.x,
c.y-this.dragStartXY_.y,k==g)}}a.stopPropagation()};
Blockly.BlockSvg.prototype.setDragging_=function(a){a?(this.addDragging(),Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0))):(this.removeDragging(),Blockly.draggingConnections_=[]);for(var b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging_(a)};Blockly.BlockSvg.prototype.moveToDragSurface_=function(){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.dragSurface.translateSurface(a.x,a.y);this.workspace.dragSurface.setBlocksAndShow(this.getSvgRoot())};
Blockly.BlockSvg.prototype.moveOffDragSurface_=function(){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.translate(a.x,a.y,!1);this.workspace.dragSurface.clearAndHide(this.workspace.getCanvas())};Blockly.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().hasAttribute("transform")&&this.getSvgRoot().removeAttribute("transform");this.getSvgRoot().hasAttribute("style")&&this.getSvgRoot().removeAttribute("style")};
Blockly.BlockSvg.prototype.onMouseMove_=function(a){if(!("mousemove"==a.type&&1>=a.clientX&&0==a.clientY&&0==a.button)){var b=this.getRelativeToSurfaceXY(),c=this.workspace.moveDrag(a);Blockly.dragMode_==Blockly.DRAG_STICKY&&goog.math.Coordinate.distance(b,c)*this.workspace.scale>Blockly.DRAG_RADIUS&&(Blockly.dragMode_=Blockly.DRAG_FREE,Blockly.longStop_(),this.moveToDragSurface_(),Blockly.WidgetDiv.hide(!0),this.parentBlock_&&(this.unplug(),this.disconnectUiEffect()),this.setDragging_(!0));if(Blockly.dragMode_==
Blockly.DRAG_FREE){var d=b.x-this.dragStartXY_.x,b=b.y-this.dragStartXY_.y;this.workspace.dragSurface.translateSurface(c.x,c.y);for(var e=0;e<this.draggedBubbles_.length;e++){var f=this.draggedBubbles_[e];f.bubble.setIconLocation(f.x+d,f.y+b)}var f=this.getConnections_(!1),g=this.lastConnectionInStack_();g&&g!=this.nextConnection&&f.push(g);for(var h=null,k=null,l=Blockly.SNAP_RADIUS,e=0;e<f.length;e++){var n=f[e],m=n.closest(l,d,b);m.connection&&(h=m.connection,k=n,l=m.radius)}this.updatePreviews(h,
k,l,a,c.x-this.dragStartXY_.x,c.y-this.dragStartXY_.y,k==g)}}a.stopPropagation()};
Blockly.BlockSvg.prototype.updatePreviews=function(a,b,c,d,e,f,g){Blockly.Events.disable();if(Blockly.highlightedConnection_&&Blockly.highlightedConnection_!=a){Blockly.insertionMarker_&&Blockly.insertionMarkerConnection_&&Blockly.BlockSvg.disconnectInsertionMarker();if(Blockly.insertionMarker_&&g&&Blockly.localConnection_.sourceBlock_==this||!g&&Blockly.localConnection_.sourceBlock_!=this)Blockly.insertionMarker_.dispose(),Blockly.insertionMarker_=null;Blockly.highlightedConnection_=null;Blockly.localConnection_=
null}if(a&&a!=Blockly.highlightedConnection_&&!a.sourceBlock_.isInsertionMarker()&&(Blockly.highlightedConnection_=a,Blockly.localConnection_=b,Blockly.insertionMarker_||(Blockly.insertionMarker_=this.workspace.newBlock(Blockly.localConnection_.sourceBlock_.type),Blockly.insertionMarker_.setInsertionMarker(!0),Blockly.insertionMarker_.initSvg()),c=Blockly.insertionMarker_,g=c.getMatchingConnection(b.sourceBlock_,b),g!=Blockly.insertionMarkerConnection_)){c.getSvgRoot().setAttribute("visibility","visible");
c.rendered=!0;if(g.type==Blockly.NEXT_STATEMENT){var h=b.sourceBlock_.getRelativeToSurfaceXY();e=a.x_-(b.x_-(h.x-e));b=a.y_-(b.y_-(h.y-f));f=c.getRelativeToSurfaceXY();g!=c.nextConnection&&(b-=a.sourceBlock_.getHeightWidth().height-Blockly.BlockSvg.MIN_BLOCK_Y);c.moveBy(e-f.x,b-f.y)}g.type!=Blockly.PREVIOUS_STATEMENT||c.nextConnection||(Blockly.bumpedConnection_=a.targetConnection);g.connect(a);Blockly.insertionMarkerConnection_=g}Blockly.Events.enable();this.isDeletable()&&this.workspace.isDeleteArea(d)};
null}a&&a!=Blockly.highlightedConnection_&&!a.sourceBlock_.isInsertionMarker()&&(Blockly.highlightedConnection_=a,Blockly.localConnection_=b,Blockly.insertionMarker_||(Blockly.insertionMarker_=this.workspace.newBlock(Blockly.localConnection_.sourceBlock_.type),Blockly.insertionMarker_.setInsertionMarker(!0),Blockly.insertionMarker_.initSvg()),c=Blockly.insertionMarker_,b=c.getMatchingConnection(b.sourceBlock_,b),b!=Blockly.insertionMarkerConnection_&&(c.rendered=!0,c.render(),c.getSvgRoot().setAttribute("visibility",
"visible"),b.type==Blockly.NEXT_STATEMENT&&(e=a.x_-b.x_,f=a.y_-b.y_,b!=c.nextConnection&&(f-=a.sourceBlock_.getHeightWidth().height-Blockly.BlockSvg.MIN_BLOCK_Y),c.moveBy(e,f)),b.type!=Blockly.PREVIOUS_STATEMENT||c.nextConnection||(Blockly.bumpedConnection_=a.targetConnection),b.connect(a),Blockly.insertionMarkerConnection_=b));Blockly.Events.enable();this.isDeletable()&&this.workspace.isDeleteArea(d)};
Blockly.BlockSvg.disconnectInsertionMarker=function(){if(Blockly.insertionMarkerConnection_!=Blockly.insertionMarker_.nextConnection||Blockly.insertionMarker_.previousConnection&&Blockly.insertionMarker_.previousConnection.targetConnection)if(Blockly.insertionMarkerConnection_.type==Blockly.NEXT_STATEMENT&&Blockly.insertionMarkerConnection_!=Blockly.insertionMarker_.nextConnection){var a=Blockly.insertionMarkerConnection_.targetConnection;a.sourceBlock_.unplug(!1);var b=Blockly.insertionMarker_.previousConnection.targetConnection;
Blockly.insertionMarker_.unplug(!0);b&&b.connect(a)}else Blockly.insertionMarker_.unplug(!0);else Blockly.insertionMarkerConnection_.targetBlock().unplug(!1);if(Blockly.insertionMarkerConnection_.targetConnection)throw"insertionMarkerConnection still connected at the end of disconnectInsertionMarker";Blockly.insertionMarkerConnection_=null;Blockly.insertionMarker_.getSvgRoot().setAttribute("visibility","hidden")};
Blockly.BlockSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.addClass_(this.svgGroup_,"blocklyDraggable"):Blockly.removeClass_(this.svgGroup_,"blocklyDraggable")};Blockly.BlockSvg.prototype.setMovable=function(a){Blockly.BlockSvg.superClass_.setMovable.call(this,a);this.updateMovable()};Blockly.BlockSvg.prototype.setEditable=function(a){Blockly.BlockSvg.superClass_.setEditable.call(this,a);if(this.rendered)for(a=0;a<this.icons_.length;a++)this.icons_[a].updateEditable()};
@ -1162,24 +1167,27 @@ Blockly.BlockSvg.prototype.setNextStatement=function(a,b){Blockly.BlockSvg.super
Blockly.BlockSvg.prototype.removeInput=function(a,b){Blockly.BlockSvg.superClass_.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_());return c};Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};Blockly.BlockSvg.render={};Blockly.BlockSvg.GRID_UNIT=4;Blockly.BlockSvg.SEP_SPACE_X=3*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.SEP_SPACE_Y=3*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.STATEMENT_BLOCK_SPACE=3*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_WIDTH=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_TOP_PADDING=1.5*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.NUMBER_FIELD_CORNER_RADIUS=4*Blockly.BlockSvg.GRID_UNIT;
Blockly.BlockSvg.TEXT_FIELD_CORNER_RADIUS=1*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_Y=16*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.TAB_WIDTH=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.CORNER_RADIUS=1*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.HAT_CORNER_RADIUS=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.NOTCH_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT+2;Blockly.BlockSvg.NOTCH_WIDTH=2*Blockly.BlockSvg.GRID_UNIT;
Blockly.BlockSvg.NOTCH_PATH_DOWN="c 0,2 1,3 2,4 l 4,4 c 1,1 2,2 2,4 v 12 c 0,2 -1,3 -2,4 l -4,4 c -1,1 -2,2 -2,4";Blockly.BlockSvg.NOTCH_PATH_UP="c 0,-2 1,-3 2,-4 l 4,-4 c 1,-1 2,-2 2,-4 v -12 c 0,-2 -1,-3 -2,-4 l -4,-4 c -1,-1 -2,-2 -2,-4";Blockly.BlockSvg.ICON_WIDTH=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.ICON_HEIGHT=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.TOP_LEFT_CORNER_START="m "+Blockly.BlockSvg.CORNER_RADIUS+",0";
Blockly.BlockSvg.TOP_LEFT_CORNER="A "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 0,"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.HAT_TOP_LEFT_CORNER_START="m "+Blockly.BlockSvg.HAT_CORNER_RADIUS+",0";Blockly.BlockSvg.HAT_TOP_LEFT_CORNER="A "+Blockly.BlockSvg.HAT_CORNER_RADIUS+","+Blockly.BlockSvg.HAT_CORNER_RADIUS+" 0 0,0 0,"+Blockly.BlockSvg.HAT_CORNER_RADIUS;Blockly.BlockSvg.prototype.connectionUiEffect=function(){this.workspace.playAudio("click")};
Blockly.BlockSvg.prototype.updateColour=function(){var a=this.getColourTertiary();this.isShadow()&&this.parentBlock_&&(a=this.parentBlock_.getColourTertiary());this.svgPath_.setAttribute("stroke",a);a=this.isGlowing_?this.getColourSecondary():this.getColour();this.svgPath_.setAttribute("fill",a);for(var a=0,b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.setText(null)};
Blockly.BlockSvg.prototype.getHeightWidth=function(){var a=this.height,b=this.width,c=this.getNextBlock();c&&(c=c.getHeightWidth(),b+=c.width,a=Math.max(a,c.height));return{height:a,width:b}};Blockly.BlockSvg.prototype.render=function(a){Blockly.Field.startCache();this.rendered=!0;var b=this.renderCompute_();this.height=b.height;this.width=b.width;this.renderDraw_(b);!1!==a&&((a=this.getParent())?a.render(!0):Blockly.fireUiEvent(window,"resize"));Blockly.Field.stopCache()};
Blockly.BlockSvg.prototype.renderCompute_=function(){var a={statement:null,valueInput:null,icon:null,width:0,height:0,bayHeight:0,bayWidth:0,fieldRadius:0,startHat:!1};this.nextConnection&&!this.previousConnection&&(a.startHat=!0);for(var b=0,c;c=this.inputList[b];b++){if(c.type==Blockly.NEXT_STATEMENT&&(a.statement=c,a.bayHeight=Blockly.BlockSvg.MIN_BLOCK_Y,a.bayWidth=Blockly.BlockSvg.MIN_BLOCK_X,c.connection&&c.connection.targetConnection)){var d=c.connection.targetBlock().getHeightWidth();a.bayHeight=
Math.max(a.bayHeight,d.height);a.bayWidth=Math.max(a.bayWidth,d.width)}for(var d=0,e;e=c.fieldRow[d];d++)e instanceof Blockly.FieldImage&&(a.icon=e),e instanceof Blockly.FieldTextInput&&(a.fieldRadius=e.getBorderRadius())}for(b=0;c=this.childBlocks_[b];b++)c.isShadow()&&(a.valueInput=c);a.width=2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.ICON_WIDTH;a.height=2*Blockly.BlockSvg.SEP_SPACE_Y+Blockly.BlockSvg.ICON_HEIGHT;this.outputConnection&&(a.height=Blockly.BlockSvg.FIELD_HEIGHT,a.width=Blockly.BlockSvg.FIELD_WIDTH);
a.statement&&(a.width+=a.bayWidth+4*Blockly.BlockSvg.CORNER_RADIUS+2*Blockly.BlockSvg.GRID_UNIT,a.height=a.bayHeight+Blockly.BlockSvg.STATEMENT_BLOCK_SPACE);a.startHat&&(a.width+=1*Blockly.BlockSvg.GRID_UNIT);return a};
Blockly.BlockSvg.prototype.renderDraw_=function(a){var b=this.getRelativeToSurfaceXY(),c=[];this.renderDrawLeft_(c,b,a);this.renderDrawBottom_(c,b,a);this.renderDrawRight_(c,b,a);this.renderDrawTop_(c,b,a);b=c.join(" ");this.svgPath_.setAttribute("d",b);this.RTL&&this.svgPath_.setAttribute("transform","scale(-1 1)");if(a.icon){var b=a.icon.getSvgRoot(),c=a.icon.getSize(),d=a.width-c.width-Blockly.BlockSvg.SEP_SPACE_X/1.5,e=a.height-c.height-Blockly.BlockSvg.SEP_SPACE_Y,f="scale(1 1)";this.RTL&&(a.icon.getFlipRTL()?
(f="scale(-1 1)",d=-a.width+c.width+Blockly.BlockSvg.SEP_SPACE_X/1.5):d=-a.width+Blockly.BlockSvg.SEP_SPACE_X/1.5);this.isInsertionMarker()&&b.setAttribute("display","none");b.setAttribute("transform","translate("+d+","+e+") "+f)}a.valueInput&&(b=a.valueInput.getSvgRoot(),c=Blockly.BlockSvg.NOTCH_WIDTH+(a.bayWidth?2*Blockly.BlockSvg.GRID_UNIT+2*Blockly.BlockSvg.NOTCH_WIDTH:0)+a.bayWidth,this.RTL&&(c=-c),b.setAttribute("transform","translate("+c+","+(a.height-2*Blockly.BlockSvg.GRID_UNIT)+")"))};
Blockly.BlockSvg.prototype.renderDrawLeft_=function(a,b,c){c.startHat?(a.push(Blockly.BlockSvg.HAT_TOP_LEFT_CORNER_START),a.push(Blockly.BlockSvg.HAT_TOP_LEFT_CORNER)):this.previousConnection?(a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),a.push(Blockly.BlockSvg.TOP_LEFT_CORNER),a.push("V",c.height-Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.SEP_SPACE_Y-Blockly.BlockSvg.NOTCH_HEIGHT),a.push(Blockly.BlockSvg.NOTCH_PATH_DOWN),this.previousConnection.moveTo(b.x,b.y+c.height-2*Blockly.BlockSvg.CORNER_RADIUS),
a.push("V",c.height-Blockly.BlockSvg.CORNER_RADIUS)):(a.push("m",c.fieldRadius+",0"),a.push("A",c.fieldRadius+","+c.fieldRadius,"0","0,0","0,"+c.fieldRadius),a.push("V",c.height-c.fieldRadius))};
Blockly.BlockSvg.NOTCH_PATH_DOWN="c 0,2 1,3 2,4 l 4,4 c 1,1 2,2 2,4 v 12 c 0,2 -1,3 -2,4 l -4,4 c -1,1 -2,2 -2,4";Blockly.BlockSvg.NOTCH_PATH_UP="c 0,-2 1,-3 2,-4 l 4,-4 c 1,-1 2,-2 2,-4 v -12 c 0,-2 -1,-3 -2,-4 l -4,-4 c -1,-1 -2,-2 -2,-4";Blockly.BlockSvg.IMAGE_FIELD_WIDTH=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.IMAGE_FIELD_HEIGHT=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_Y_OFFSET=-2*Blockly.BlockSvg.GRID_UNIT;
Blockly.BlockSvg.TOP_LEFT_CORNER_START="m "+Blockly.BlockSvg.CORNER_RADIUS+",0";Blockly.BlockSvg.TOP_LEFT_CORNER="A "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 0,"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.HAT_TOP_LEFT_CORNER_START="m "+Blockly.BlockSvg.HAT_CORNER_RADIUS+",0";Blockly.BlockSvg.HAT_TOP_LEFT_CORNER="A "+Blockly.BlockSvg.HAT_CORNER_RADIUS+","+Blockly.BlockSvg.HAT_CORNER_RADIUS+" 0 0,0 0,"+Blockly.BlockSvg.HAT_CORNER_RADIUS;
Blockly.BlockSvg.prototype.connectionUiEffect=function(){this.workspace.playAudio("click")};
Blockly.BlockSvg.prototype.updateColour=function(){var a=this.getColourTertiary();this.isShadow()&&this.parentBlock_&&(a=this.parentBlock_.getColourTertiary());this.svgPath_.setAttribute("stroke",a);a=this.isGlowing_?this.getColourSecondary():this.getColour();this.svgPath_.setAttribute("fill",a);this.svgPath_.setAttribute("fill-opacity",this.getOpacity());for(var a=0,b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.setText(null)};
Blockly.BlockSvg.prototype.getHeightWidth=function(a){var b=this.height,c=this.width;!a&&this.getFieldShadowBlock_()&&(b+=Blockly.BlockSvg.FIELD_Y_OFFSET,b+=Blockly.BlockSvg.FIELD_HEIGHT);var d=this.getNextBlock();d&&(a=d.getHeightWidth(a),c+=a.width,b=Math.max(b,a.height));return{height:b,width:c}};
Blockly.BlockSvg.prototype.render=function(a){Blockly.Field.startCache();this.rendered=!0;var b=this.renderCompute_();this.height=b.height;this.width=b.width;this.renderDraw_(b);!1!==a&&((a=this.getParent())?a.render(!0):Blockly.fireUiEvent(window,"resize"));Blockly.Field.stopCache()};
Blockly.BlockSvg.prototype.renderCompute_=function(){var a={statement:null,imageField:null,width:0,height:0,bayHeight:0,bayWidth:0,fieldRadius:0,startHat:!1};this.nextConnection&&!this.previousConnection&&(a.startHat=!0);for(var b=0,c;c=this.inputList[b];b++){if(c.type==Blockly.NEXT_STATEMENT&&(a.statement=c,a.bayHeight=Blockly.BlockSvg.MIN_BLOCK_Y,a.bayWidth=Blockly.BlockSvg.MIN_BLOCK_X,c.connection&&c.connection.targetConnection)){var d=c.connection.targetBlock().getHeightWidth(!0);a.bayHeight=
Math.max(a.bayHeight,d.height);a.bayWidth=Math.max(a.bayWidth,d.width)}for(var d=0,e;e=c.fieldRow[d];d++)e instanceof Blockly.FieldImage&&(a.imageField=e),e instanceof Blockly.FieldTextInput&&(a.fieldRadius=e.getBorderRadius())}a.width=2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.IMAGE_FIELD_WIDTH;a.height=2*Blockly.BlockSvg.SEP_SPACE_Y+Blockly.BlockSvg.IMAGE_FIELD_HEIGHT;this.outputConnection&&(a.height=Blockly.BlockSvg.FIELD_HEIGHT,a.width=Blockly.BlockSvg.FIELD_WIDTH);a.statement&&(a.width+=
a.bayWidth+4*Blockly.BlockSvg.CORNER_RADIUS+2*Blockly.BlockSvg.GRID_UNIT,a.height=a.bayHeight+Blockly.BlockSvg.STATEMENT_BLOCK_SPACE);a.startHat&&(a.width+=1*Blockly.BlockSvg.GRID_UNIT);return a};
Blockly.BlockSvg.prototype.renderDraw_=function(a){var b=this.getRelativeToSurfaceXY(),c=[];this.renderDrawLeft_(c,b,a);this.renderDrawBottom_(c,b,a);this.renderDrawRight_(c,b,a);this.renderDrawTop_(c,b,a);b=c.join(" ");this.svgPath_.setAttribute("d",b);this.RTL&&this.svgPath_.setAttribute("transform","scale(-1 1)");if(a.imageField){var b=a.imageField.getSvgRoot(),c=a.imageField.getSize(),d=a.width-c.width-Blockly.BlockSvg.SEP_SPACE_X/1.5,e=a.height-c.height-Blockly.BlockSvg.SEP_SPACE_Y,f="scale(1 1)";
this.RTL&&(a.imageField.getFlipRTL()?(f="scale(-1 1)",d=-a.width+c.width+Blockly.BlockSvg.SEP_SPACE_X/1.5):d=-a.width+Blockly.BlockSvg.SEP_SPACE_X/1.5);b&&b.setAttribute("transform","translate("+d+","+e+") "+f)}this.getFieldShadowBlock_()&&(b=this.getFieldShadowBlock_().getSvgRoot(),c=Blockly.BlockSvg.NOTCH_WIDTH+(a.bayWidth?2*Blockly.BlockSvg.GRID_UNIT+2*Blockly.BlockSvg.NOTCH_WIDTH:0)+a.bayWidth,this.RTL&&(c=-c),b.setAttribute("transform","translate("+c+","+(a.height+Blockly.BlockSvg.FIELD_Y_OFFSET)+
")"))};
Blockly.BlockSvg.prototype.renderDrawLeft_=function(a,b,c){c.startHat?(a.push(Blockly.BlockSvg.HAT_TOP_LEFT_CORNER_START),a.push(Blockly.BlockSvg.HAT_TOP_LEFT_CORNER)):this.previousConnection?(a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),a.push(Blockly.BlockSvg.TOP_LEFT_CORNER),a.push("V",c.height-Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.SEP_SPACE_Y-Blockly.BlockSvg.NOTCH_HEIGHT),a.push(Blockly.BlockSvg.NOTCH_PATH_DOWN),this.previousConnection.moveTo(b.x,b.y+c.height-2*Blockly.BlockSvg.CORNER_RADIUS),a.push("V",
c.height-Blockly.BlockSvg.CORNER_RADIUS)):(a.push("m",c.fieldRadius+",0"),a.push("A",c.fieldRadius+","+c.fieldRadius,"0","0,0","0,"+c.fieldRadius),a.push("V",c.height-c.fieldRadius))};
Blockly.BlockSvg.prototype.renderDrawBottom_=function(a,b,c){c.startHat?a.push("a",Blockly.BlockSvg.HAT_CORNER_RADIUS+","+Blockly.BlockSvg.HAT_CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.HAT_CORNER_RADIUS+","+Blockly.BlockSvg.HAT_CORNER_RADIUS):this.previousConnection?a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS):a.push("a",c.fieldRadius+","+c.fieldRadius,"0","0,0",c.fieldRadius+","+c.fieldRadius);
if(c.statement){a.push("h",4*Blockly.BlockSvg.GRID_UNIT);a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS);a.push("v",-2.5*Blockly.BlockSvg.GRID_UNIT);a.push(Blockly.BlockSvg.NOTCH_PATH_UP);a.push("v",-c.bayHeight+3*Blockly.BlockSvg.CORNER_RADIUS+Blockly.BlockSvg.NOTCH_HEIGHT+2*Blockly.BlockSvg.GRID_UNIT);a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+
",-"+Blockly.BlockSvg.CORNER_RADIUS);a.push("h",c.bayWidth-2*Blockly.BlockSvg.CORNER_RADIUS);a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS);a.push("v",c.bayHeight-3*Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.NOTCH_HEIGHT-2*Blockly.BlockSvg.GRID_UNIT);a.push(Blockly.BlockSvg.NOTCH_PATH_DOWN);a.push("v",2.5*Blockly.BlockSvg.GRID_UNIT);a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+
" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS);var d=b.x+2*Blockly.BlockSvg.CORNER_RADIUS+4*Blockly.BlockSvg.GRID_UNIT;this.RTL&&(d=b.x-2*Blockly.BlockSvg.CORNER_RADIUS-4*Blockly.BlockSvg.GRID_UNIT);c.statement.connection.moveTo(d,b.y+c.height-2*Blockly.BlockSvg.CORNER_RADIUS);c.statement.connection.targetConnection&&c.statement.connection.tighten_()}this.isShadow()?a.push("H",c.width-c.fieldRadius):a.push("H",c.width-Blockly.BlockSvg.CORNER_RADIUS)};
Blockly.BlockSvg.prototype.renderDrawRight_=function(a,b,c){this.isShadow()?(a.push("a",c.fieldRadius+","+c.fieldRadius,"0","0,0",c.fieldRadius+","+-1*c.fieldRadius),a.push("v",-1*(c.height-2*c.fieldRadius))):(a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS),a.push("v",-2.5*Blockly.BlockSvg.GRID_UNIT));this.nextConnection?(a.push(Blockly.BlockSvg.NOTCH_PATH_UP),this.nextConnection.moveTo(this.RTL?
b.x-c.width:b.x+c.width,b.y+c.height-2*Blockly.BlockSvg.CORNER_RADIUS),this.nextConnection.targetConnection&&this.nextConnection.tighten_(),a.push("V",Blockly.BlockSvg.CORNER_RADIUS)):this.isShadow()||a.push("V",Blockly.BlockSvg.CORNER_RADIUS)};
Blockly.BlockSvg.prototype.renderDrawTop_=function(a,b,c){this.isShadow()?a.push("a",c.fieldRadius+","+c.fieldRadius,"0","0,0","-"+c.fieldRadius+",-"+c.fieldRadius):a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 -"+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS);a.push("z")};
Blockly.BlockSvg.prototype.renderDrawTop_=function(a,b,c){this.isShadow()?a.push("a",c.fieldRadius+","+c.fieldRadius,"0","0,0","-"+c.fieldRadius+",-"+c.fieldRadius):a.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 -"+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS);a.push("z")};Blockly.BlockSvg.prototype.getFieldShadowBlock_=function(){for(var a=0,b;b=this.childBlocks_[a];a++)if(b.isShadow())return b;return null};
// Copyright 2016 Google Inc. Apache License 2.0
Blockly.Events={};Blockly.Events.group_="";Blockly.Events.recordUndo=!0;Blockly.Events.disabled_=0;Blockly.Events.CREATE="create";Blockly.Events.DELETE="delete";Blockly.Events.CHANGE="change";Blockly.Events.MOVE="move";Blockly.Events.UI="ui";Blockly.Events.FIRE_QUEUE_=[];Blockly.Events.fire=function(a){Blockly.Events.isEnabled()&&(Blockly.Events.FIRE_QUEUE_.length||setTimeout(Blockly.Events.fireNow_,0),Blockly.Events.FIRE_QUEUE_.push(a))};
Blockly.Events.fireNow_=function(){for(var a=Blockly.Events.filter(Blockly.Events.FIRE_QUEUE_,!0),b=Blockly.Events.FIRE_QUEUE_.length=0,c;c=a[b];b++){var d=Blockly.Workspace.getById(c.workspaceId);d&&d.fireChangeListener(c)}};
@ -1238,7 +1246,8 @@ Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.pr
Blockly.FieldDropdown.prototype.getOptions_=function(){return goog.isFunction(this.menuGenerator_)?this.menuGenerator_.call(this):this.menuGenerator_};Blockly.FieldDropdown.prototype.getValue=function(){return this.value_};
Blockly.FieldDropdown.prototype.setValue=function(a){if(null!==a&&a!==this.value_){this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.value_,a));this.value_=a;for(var b=this.getOptions_(),c=0;c<b.length;c++)if(b[c][1]==a){this.setText(b[c][0]);return}this.setText(a)}};
Blockly.FieldDropdown.prototype.setText=function(a){this.sourceBlock_&&this.arrow_&&(this.arrow_.style.fill=this.sourceBlock_.getColour());null!==a&&a!==this.text_&&(this.text_=a,this.updateTextNode_(),this.textElement_&&(this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textElement_.firstChild):this.textElement_.appendChild(this.arrow_)),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()))};
Blockly.FieldDropdown.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this);Blockly.FieldDropdown.superClass_.dispose.call(this)};Blockly.FieldImage=function(a,b,c,d,e){this.sourceBlock_=null;this.height_=Number(c);this.width_=Number(b);this.size_=new goog.math.Size(this.width_,this.height_);this.text_=d||"";this.flipRTL_=e;this.setValue(a)};goog.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.prototype.rectElement_=null;Blockly.FieldImage.prototype.EDITABLE=!1;
Blockly.FieldDropdown.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this);Blockly.FieldDropdown.superClass_.dispose.call(this)};Blockly.DropDownDiv=function(){};Blockly.DropDownDiv.prototype.container_=null;Blockly.DropDownDiv.prototype.DIV_=null;Blockly.DropDownDiv.prototype.boundsElement_=null;Blockly.DropDownDiv.prototype.createDom=function(a){this.DIV_||(this.DIV_=goog.dom.createDom("div","blocklyDropDownDiv"),a.appendChild(this.DIV_),this.content_=goog.dom.createDom("div","blocklyDropDownContent"),this.DIV_.appendChild(this.content))};Blockly.DropDownDiv.prototype.setBoundsElement=function(a){this.boundsElement_=a};
Blockly.DropDownDiv.prototype.getContentDiv=function(){return this.content_};Blockly.DropDownDiv.prototype.place=function(a,b){this.DIV_.top=a+"px";this.DIV_.left=b+"px"};Blockly.DropDownDiv.prototype.destroy=function(){this.container_.removeChild(this.DIV_);this.DIV_=null};Blockly.FieldIconMenu=function(a){Blockly.FieldTextInput.superClass_.constructor.call(this)};goog.inherits(Blockly.FieldTextInput,Blockly.Field);Blockly.FieldIconMenu.prototype.dispose=function(){Blockly.FieldIconMenu.superClass_.dispose.call(this)};Blockly.FieldIconMenu.prototype.setValue=function(a){null!==a&&Blockly.Field.prototype.setValue.call(this,a)};Blockly.FieldIconMenu.prototype.showEditor_=function(){};Blockly.FieldImage=function(a,b,c,d,e){this.sourceBlock_=null;this.height_=Number(c);this.width_=Number(b);this.size_=new goog.math.Size(this.width_,this.height_);this.text_=d||"";this.flipRTL_=e;this.setValue(a)};goog.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.prototype.rectElement_=null;Blockly.FieldImage.prototype.EDITABLE=!1;
Blockly.FieldImage.prototype.init=function(a){this.sourceBlock_||(this.sourceBlock_=a,this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.imageElement_=Blockly.createSvgElement("image",{height:this.height_+"px",width:this.width_+"px"},this.fieldGroup_),this.setValue(this.src_),goog.userAgent.GECKO&&(this.rectElement_=Blockly.createSvgElement("rect",{height:this.height_+"px",width:this.width_+"px","fill-opacity":0},this.fieldGroup_)),a.getSvgRoot().appendChild(this.fieldGroup_),
a=this.rectElement_||this.imageElement_,a.tooltip=this.sourceBlock_,Blockly.Tooltip.bindMouseEvents(a))};Blockly.FieldImage.prototype.dispose=function(){goog.dom.removeNode(this.fieldGroup_);this.rectElement_=this.imageElement_=this.fieldGroup_=null};Blockly.FieldImage.prototype.setTooltip=function(a){(this.rectElement_||this.imageElement_).tooltip=a};Blockly.FieldImage.prototype.getValue=function(){return this.src_};
Blockly.FieldImage.prototype.setValue=function(a){null!==a&&(this.src_=a,this.imageElement_&&this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",goog.isString(a)?a:""))};Blockly.FieldImage.prototype.getFlipRTL=function(){return this.flipRTL_};Blockly.FieldImage.prototype.setText=function(a){null!==a&&(this.text_=a)};Blockly.FieldImage.prototype.render_=function(){};Blockly.Variables={};Blockly.Variables.NAME_TYPE="VARIABLE";Blockly.Variables.allVariables=function(a){var b;if(a.getDescendants)b=a.getDescendants();else if(a.getAllBlocks)b=a.getAllBlocks();else throw"Not Block or Workspace: "+a;a=Object.create(null);for(var c=0;c<b.length;c++)for(var d=b[c].getVars(),e=0;e<d.length;e++){var f=d[e];f&&(a[f.toLowerCase()]=f)}b=[];for(var g in a)b.push(a[g]);return b};
@ -1266,12 +1275,13 @@ Blockly.Procedures.flyoutCategory=function(a){function b(a,b){for(var d=0;d<a.le
d.setAttribute("gap",16);c.push(d)}Blockly.Blocks.procedures_defreturn&&(d=goog.dom.createDom("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap",16),c.push(d));Blockly.Blocks.procedures_ifreturn&&(d=goog.dom.createDom("block"),d.setAttribute("type","procedures_ifreturn"),d.setAttribute("gap",16),c.push(d));c.length&&c[c.length-1].setAttribute("gap",24);a=Blockly.Procedures.allProcedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c};
Blockly.Procedures.getCallers=function(a,b){for(var c=[],d=b.getAllBlocks(),e=0;e<d.length;e++)if(d[e].getProcedureCall){var f=d[e].getProcedureCall();f&&Blockly.Names.equals(f,a)&&c.push(d[e])}return c};Blockly.Procedures.disposeCallers=function(a,b){for(var c=Blockly.Procedures.getCallers(a,b),d=0;d<c.length;d++)c[d].dispose(!0,!1)};
Blockly.Procedures.mutateCallers=function(a){var b=Blockly.Events.recordUndo,c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=Blockly.Procedures.getCallers(c,a.workspace);for(var c=0,e;e=a[c];c++){var f=e.mutationToDom(),f=f&&Blockly.Xml.domToText(f);e.domToMutation(d);var g=e.mutationToDom(),g=g&&Blockly.Xml.domToText(g);f!=g&&(Blockly.Events.recordUndo=!1,Blockly.Events.fire(new Blockly.Events.Change(e,"mutation",null,f,g)),Blockly.Events.recordUndo=b)}};
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getAllBlocks(),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.Flyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);this.RTL=!!a.RTL;this.horizontalLayout_=a.horizontalLayout;this.toolboxPosition_=a.toolboxPosition;this.workspace_=new Blockly.WorkspaceSvg(a);this.workspace_.isFlyout=!0;this.eventWrappers_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[]};Blockly.Flyout.prototype.autoClose=!0;Blockly.Flyout.prototype.CORNER_RADIUS=8;Blockly.Flyout.prototype.SCROLLBAR_PADDING=2;
Blockly.Flyout.prototype.width_=0;Blockly.Flyout.prototype.height_=0;Blockly.Flyout.prototype.verticalOffset_=0;Blockly.Flyout.prototype.dragAngleRange_=70;Blockly.Flyout.prototype.createDom=function(){this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyFlyout"},null);this.svgBackground_=Blockly.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_);this.svgGroup_.appendChild(this.workspace_.createDom());return this.svgGroup_};
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getAllBlocks(),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.Flyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);this.RTL=!!a.RTL;this.horizontalLayout_=a.horizontalLayout;this.toolboxPosition_=a.toolboxPosition;this.workspace_=new Blockly.WorkspaceSvg(a);this.workspace_.isFlyout=!0;this.eventWrappers_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[]};Blockly.Flyout.prototype.autoClose=!0;Blockly.Flyout.prototype.CORNER_RADIUS=0;Blockly.Flyout.prototype.BLOCK_MARGIN=8;
Blockly.Flyout.prototype.SCROLLBAR_PADDING=2;Blockly.Flyout.prototype.width_=0;Blockly.Flyout.prototype.height_=0;Blockly.Flyout.prototype.contentWidth_=0;Blockly.Flyout.prototype.contentHeight_=0;Blockly.Flyout.prototype.verticalOffset_=0;Blockly.Flyout.prototype.dragAngleRange_=70;
Blockly.Flyout.prototype.createDom=function(){this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyFlyout"},null);this.svgBackground_=Blockly.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_);this.svgGroup_.appendChild(this.workspace_.createDom());return this.svgGroup_};
Blockly.Flyout.prototype.init=function(a){this.targetWorkspace_=a;this.workspace_.targetWorkspace=a;this.scrollbar_=new Blockly.Scrollbar(this.workspace_,this.horizontalLayout_,!1);this.hide();Array.prototype.push.apply(this.eventWrappers_,Blockly.bindEvent_(this.svgGroup_,"wheel",this,this.wheel_));this.autoClose||(this.filterWrapper_=this.filterForCapacity_.bind(this),this.targetWorkspace_.addChangeListener(this.filterWrapper_));Array.prototype.push.apply(this.eventWrappers_,Blockly.bindEvent_(this.svgGroup_,
"mousedown",this,this.onMouseDown_))};
Blockly.Flyout.prototype.dispose=function(){this.hide();Blockly.unbindEvent_(this.eventWrappers_);this.filterWrapper_&&(this.targetWorkspace_.removeChangeListener(this.filterWrapper_),this.filterWrapper_=null);this.scrollbar_&&(this.scrollbar_.dispose(),this.scrollbar_=null);this.workspace_&&(this.workspace_.targetWorkspace=null,this.workspace_.dispose(),this.workspace_=null);this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.targetWorkspace_=this.svgBackground_=null};
Blockly.Flyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;try{var a=this.workspace_.getCanvas().getBBox()}catch(e){a={height:0,y:0}}var b=this.verticalOffset_+this.SCROLLBAR_PADDING;if(this.horizontalLayout_){this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(b=0);var c=this.height_,d=this.width_-2*this.SCROLLBAR_PADDING}else c=this.height_-2*this.SCROLLBAR_PADDING,d=this.width_;return{viewHeight:c,viewWidth:d,contentHeight:a.height*this.workspace_.scale,contentWidth:a.width*
Blockly.Flyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;try{var a=this.workspace_.getCanvas().getBBox()}catch(e){a={height:0,y:0}}var b=this.verticalOffset_+this.SCROLLBAR_PADDING;if(this.horizontalLayout_){this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(b=0);var c=this.height_,d=this.width_-2*this.SCROLLBAR_PADDING}else c=this.height_-2*this.SCROLLBAR_PADDING,d=this.width_;return{viewHeight:c,viewWidth:d,contentHeight:this.contentHeight_*this.workspace_.scale,contentWidth:this.contentWidth_*
this.workspace_.scale,viewTop:-this.workspace_.scrollY,viewLeft:-this.workspace_.scrollX,contentTop:a.y,contentLeft:0,absoluteTop:b,absoluteLeft:this.SCROLLBAR_PADDING}};
Blockly.Flyout.prototype.setMetrics_=function(a){var b=this.getMetrics_();b&&(!this.horizontalLayout_&&goog.isNumber(a.y)?this.workspace_.scrollY=-b.contentHeight*a.y-b.contentTop:this.horizontalLayout_&&goog.isNumber(a.x)&&(this.workspace_.scrollX=this.RTL?-b.contentWidth*a.x+b.contentLeft:-b.contentWidth*a.x-b.contentLeft),this.workspace_.translate(this.horizontalLayout_&&this.RTL?b.absoluteLeft+b.viewWidth-this.workspace_.scrollX:this.workspace_.scrollX+b.absoluteLeft,this.workspace_.scrollY+b.absoluteTop))};
Blockly.Flyout.prototype.setVerticalOffset=function(a){this.verticalOffset_=a};
@ -1283,10 +1293,10 @@ Blockly.Flyout.prototype.setBackgroundPathHorizontal_=function(a,b){var c=this.t
-this.CORNER_RADIUS),d.push("h",a-this.CORNER_RADIUS),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("v",b-this.CORNER_RADIUS),d.push("h",-a-this.CORNER_RADIUS));d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))};Blockly.Flyout.prototype.scrollToStart=function(){this.scrollbar_.set(this.horizontalLayout_&&this.RTL?1E9:0)};
Blockly.Flyout.prototype.wheel_=function(a){if(!this.horizontalLayout_){var b=a.deltaY;if(b){goog.userAgent.GECKO&&(b*=10);var c=this.getMetrics_(),b=c.viewTop+b,b=Math.min(b,c.contentHeight-c.viewHeight),b=Math.max(b,0);this.scrollbar_.set(b);a.preventDefault();a.stopPropagation()}}};Blockly.Flyout.prototype.isVisible=function(){return this.svgGroup_&&"block"==this.svgGroup_.style.display};
Blockly.Flyout.prototype.hide=function(){if(this.isVisible()){this.svgGroup_.style.display="none";for(var a=0,b;b=this.listeners_[a];a++)Blockly.unbindEvent_(b);this.listeners_.length=0;this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)}};
Blockly.Flyout.prototype.show=function(a){this.hide();for(var b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)d.workspace==this.workspace_&&d.dispose(!1,!1);for(var c=0,e;e=this.buttons_[c];c++)goog.dom.removeNode(e);this.buttons_.length=0;a==Blockly.Variables.NAME_TYPE?a=Blockly.Variables.flyoutCategory(this.workspace_.targetWorkspace):a==Blockly.Procedures.NAME_TYPE&&(a=Blockly.Procedures.flyoutCategory(this.workspace_.targetWorkspace));for(var f=this.CORNER_RADIUS,b=[],g=[],c=this.permanentlyDisabled_.length=
0;e=a[c];c++)e.tagName&&"BLOCK"==e.tagName.toUpperCase()&&(d=Blockly.Xml.domToBlock(this.workspace_,e),d.disabled&&this.permanentlyDisabled_.push(d),b.push(d),d=parseInt(e.getAttribute("gap"),10),g.push(isNaN(d)?3*f:d));this.svgGroup_.style.opacity=0;this.svgGroup_.style.display="block";a=f/this.workspace_.scale+Blockly.BlockSvg.TAB_WIDTH;for(c=0;d=b[c];c++){e=d.getDescendants();for(var h=0,k;k=e[h];h++)k.isInFlyout=!0;d.render();h=d.getSvgRoot();e=d.getHeightWidth();d.moveBy(this.horizontalLayout_&&
this.RTL?-a:a,f);this.horizontalLayout_?a+=e.width+g[c]:f+=e.height+g[c];e=Blockly.createSvgElement("rect",{"fill-opacity":0},null);this.workspace_.getCanvas().insertBefore(e,d.getSvgRoot());d.flyoutRect_=e;this.buttons_[c]=e;this.addBlockListeners_(h,d,e)}this.listeners_.push(Blockly.bindEvent_(this.svgBackground_,"mouseover",this,function(a){a=this.workspace_.getTopBlocks(!1);for(var b=0,c;c=a[b];b++)c.removeSelect()}));this.horizontalLayout_?this.height_=0:this.width_=0;this.reflow();this.filterForCapacity_();
Blockly.fireUiEventNow(window,"resize");this.reflowWrapper_=this.reflow.bind(this);this.workspace_.addChangeListener(this.reflowWrapper_)};
Blockly.Flyout.prototype.show=function(a){this.hide();for(var b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)d.workspace==this.workspace_&&d.dispose(!1,!1);for(var c=0,e;e=this.buttons_[c];c++)goog.dom.removeNode(e);this.buttons_.length=0;a==Blockly.Variables.NAME_TYPE?a=Blockly.Variables.flyoutCategory(this.workspace_.targetWorkspace):a==Blockly.Procedures.NAME_TYPE&&(a=Blockly.Procedures.flyoutCategory(this.workspace_.targetWorkspace));for(var f=this.BLOCK_MARGIN,b=[],g=[],c=this.permanentlyDisabled_.length=
0,h;h=a[c];c++)h.tagName&&"BLOCK"==h.tagName.toUpperCase()&&(d=Blockly.Xml.domToBlock(this.workspace_,h),d.disabled&&this.permanentlyDisabled_.push(d),b.push(d),d=parseInt(h.getAttribute("gap"),10),g.push(isNaN(d)?3*f:d));this.svgGroup_.style.opacity=0;this.svgGroup_.style.display="block";a=f/this.workspace_.scale+Blockly.BlockSvg.TAB_WIDTH;var k=0,l=0;h=a;for(var n=f,c=0;d=b[c];c++){e=d.getDescendants();for(k=0;l=e[k];k++)l.isInFlyout=!0;d.render();var m=d.getSvgRoot();e=d.getHeightWidth();d.moveBy(this.horizontalLayout_&&
this.RTL?-h:h,n);k=h+e.width+a;l=n+e.height+f;this.horizontalLayout_?h+=e.width+g[c]:n+=e.height+g[c];e=Blockly.createSvgElement("rect",{"fill-opacity":0},null);this.workspace_.getCanvas().insertBefore(e,d.getSvgRoot());d.flyoutRect_=e;this.buttons_[c]=e;this.addBlockListeners_(m,d,e)}this.contentWidth_=k;this.contentHeight_=l;this.listeners_.push(Blockly.bindEvent_(this.svgBackground_,"mouseover",this,function(a){a=this.workspace_.getTopBlocks(!1);for(var b=0,c;c=a[b];b++)c.removeSelect()}));this.horizontalLayout_?
this.height_=0:this.width_=0;this.reflow();this.filterForCapacity_();Blockly.fireUiEventNow(window,"resize");this.reflowWrapper_=this.reflow.bind(this);this.workspace_.addChangeListener(this.reflowWrapper_)};
Blockly.Flyout.prototype.addBlockListeners_=function(a,b,c){this.autoClose?this.listeners_.push(Blockly.bindEvent_(a,"mousedown",null,this.createBlockFunc_(b))):this.listeners_.push(Blockly.bindEvent_(a,"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push(Blockly.bindEvent_(a,"mouseover",b,b.addSelect));this.listeners_.push(Blockly.bindEvent_(a,"mouseout",b,b.removeSelect));this.listeners_.push(Blockly.bindEvent_(c,"mousedown",null,this.createBlockFunc_(b)));this.listeners_.push(Blockly.bindEvent_(c,
"mouseover",b,b.addSelect));this.listeners_.push(Blockly.bindEvent_(c,"mouseout",b,b.removeSelect))};
Blockly.Flyout.prototype.blockMouseDown_=function(a){var b=this;return function(c){Blockly.terminateDrag_();Blockly.hideChaff();Blockly.isRightButton(c)?a.showContextMenu_(c):(Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),b.startDragMouseY_=c.clientY,b.startDragMouseX_=c.clientX,Blockly.Flyout.startDownEvent_=c,Blockly.Flyout.startBlock_=a,Blockly.Flyout.startFlyout_=b,Blockly.Flyout.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,Blockly.terminateDrag_),Blockly.Flyout.onMouseMoveBlockWrapper_=
@ -1295,16 +1305,17 @@ Blockly.Flyout.prototype.onMouseDown_=function(a){Blockly.isRightButton(a)||(Blo
Blockly.Flyout.prototype.onMouseMove_=function(a){if(this.horizontalLayout_){var b=a.clientX-this.startDragMouseX_;this.startDragMouseX_=a.clientX;a=this.getMetrics_();b=a.viewLeft-b;b=Math.min(b,a.contentWidth-a.viewWidth)}else b=a.clientY-this.startDragMouseY_,this.startDragMouseY_=a.clientY,a=this.getMetrics_(),b=a.viewTop-b,b=Math.min(b,a.contentHeight-a.viewHeight);b=Math.max(b,0);this.scrollbar_.set(b)};
Blockly.Flyout.prototype.onMouseMoveBlock_=function(a){if(!("mousemove"==a.type&&1>=a.clientX&&0==a.clientY&&0==a.button)){var b=a.clientX-Blockly.Flyout.startDownEvent_.clientX,c=a.clientY-Blockly.Flyout.startDownEvent_.clientY;if(Blockly.Flyout.startFlyout_.isDragTowardWorkspace_(b,c)&&Math.sqrt(b*b+c*c)>Blockly.DRAG_RADIUS)Blockly.Flyout.startFlyout_.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_);else Blockly.Flyout.startFlyout_.onMouseMove_(a)}a.stopPropagation()};
Blockly.Flyout.prototype.isDragTowardWorkspace_=function(a,b){var c=Math.atan2(b,a)/Math.PI*180,d=!1,e=Blockly.Flyout.startFlyout_.dragAngleRange_;if(Blockly.Flyout.startFlyout_.horizontalLayout_)Blockly.Flyout.startFlyout_.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?c<90+e&&c>90-e&&(d=!0):c>-90-e&&c<-90+e&&(d=!0);else if(Blockly.Flyout.startFlyout_.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT)c<e&&c>-e&&(d=!0);else if(c<-180+e||c>180-e)d=!0;return d};
Blockly.Flyout.prototype.createBlockFunc_=function(a){var b=this,c=this.targetWorkspace_;return function(d){if(!Blockly.isRightButton(d)&&!a.disabled){Blockly.Events.disable();var e=Blockly.Xml.blockToDom(a),e=Blockly.Xml.domToBlock(c,e),f=a.getSvgRoot();if(!f)throw"originBlock is not rendered.";f=Blockly.getSvgXY_(f,c);if(b.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT){var g=c.getMetrics().viewWidth-b.width_;f.x+=g/c.scale-g}else f.x+=b.workspace_.scrollX/b.workspace_.scale-b.workspace_.scrollX;f.y+=
b.workspace_.scrollY/b.workspace_.scale-b.workspace_.scrollY;g=e.getSvgRoot();if(!g)throw"block is not rendered.";g=Blockly.getSvgXY_(g,c);g.x+=c.scrollX/c.scale-c.scrollX;g.y+=c.scrollY/c.scale-c.scrollY;c.toolbox_&&!c.scrollbar&&(g.x+=c.toolbox_.width/c.scale);e.moveBy(f.x-g.x,f.y-g.y);Blockly.Events.enable();Blockly.Events.isEnabled()&&(Blockly.Events.setGroup(!0),Blockly.Events.fire(new Blockly.Events.Create(e)));b.autoClose?b.hide():b.filterForCapacity_();e.onMouseDown_(d);Blockly.dragMode_=
Blockly.DRAG_FREE;e.setDragging_(!0);e.moveToDragSurface_()}}};Blockly.Flyout.prototype.filterForCapacity_=function(){for(var a=this.targetWorkspace_.remainingCapacity(),b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)if(-1==this.permanentlyDisabled_.indexOf(d)){var e=d.getDescendants();d.setDisabled(e.length>a)}};
Blockly.Flyout.prototype.createBlockFunc_=function(a){var b=this,c=this.targetWorkspace_;return function(d){if(!Blockly.isRightButton(d)&&!a.disabled){Blockly.Events.disable();var e=Blockly.Flyout.placeNewBlock_(a,c,b);Blockly.Events.enable();Blockly.Events.isEnabled()&&(Blockly.Events.setGroup(!0),Blockly.Events.fire(new Blockly.Events.Create(e)));b.autoClose?b.hide():b.filterForCapacity_();e.onMouseDown_(d);Blockly.dragMode_=Blockly.DRAG_FREE;e.setDragging_(!0);e.moveToDragSurface_()}}};
Blockly.Flyout.placeNewBlock_=function(a,b,c){var d=a.getSvgRoot();if(!d)throw"originBlock is not rendered.";var d=Blockly.getSvgXY_(d,b),e=c.workspace_.scrollX,f=c.workspace_.scale;d.x+=e/f-e;c.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT&&(e=b.getMetrics().viewWidth-c.width_,f=b.scale,d.x+=e/f-e);e=c.workspace_.scrollY;f=c.workspace_.scale;d.y+=e/f-e;c.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(e=b.getMetrics().viewHeight-c.height_,f=b.scale,d.y+=e/f-e);a=Blockly.Xml.blockToDom(a);a=Blockly.Xml.domToBlock(b,
a);c=a.getSvgRoot();if(!c)throw"block is not rendered.";c=Blockly.getSvgXY_(c,b);c.x+=b.scrollX/b.scale-b.scrollX;c.y+=b.scrollY/b.scale-b.scrollY;b.toolbox_&&!b.scrollbar&&(c.x+=b.toolbox_.width/b.scale,c.y+=b.toolbox_.height/b.scale);a.moveBy(d.x-c.x,d.y-c.y);return a};
Blockly.Flyout.prototype.filterForCapacity_=function(){for(var a=this.targetWorkspace_.remainingCapacity(),b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)if(-1==this.permanentlyDisabled_.indexOf(d)){var e=d.getDescendants();d.setDisabled(e.length>a)}};
Blockly.Flyout.prototype.getClientRect=function(){var a=this.svgGroup_.getBoundingClientRect(),b=a.left,c=a.top,d=a.width,a=a.height;return this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?new goog.math.Rect(-1E9,c-1E9,2E9,1E9+a):this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM?new goog.math.Rect(-1E9,c+this.verticalOffset_,2E9,1E9+a):this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?new goog.math.Rect(b-1E9,-1E9,1E9+d,2E9):new goog.math.Rect(b,-1E9,1E9+d,2E9)};
Blockly.Flyout.terminateDrag_=function(){Blockly.Flyout.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),Blockly.Flyout.onMouseUpWrapper_=null);Blockly.Flyout.onMouseMoveBlockWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveBlockWrapper_),Blockly.Flyout.onMouseMoveBlockWrapper_=null);Blockly.Flyout.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveWrapper_),Blockly.Flyout.onMouseMoveWrapper_=null);Blockly.Flyout.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),
Blockly.Flyout.onMouseUpWrapper_=null);Blockly.Flyout.startDownEvent_=null;Blockly.Flyout.startBlock_=null;Blockly.Flyout.startFlyout_=null};
Blockly.Flyout.prototype.reflowHorizontal=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.CORNER_RADIUS,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++)e=e.getHeightWidth().height,a=Math.max(a,e);a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.height_!=a){for(d=0;e=c[d];d++)if(b=e.getHeightWidth(),e.flyoutRect_){e.flyoutRect_.setAttribute("width",b.width);e.flyoutRect_.setAttribute("height",b.height);var f=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:
Blockly.Flyout.prototype.reflowHorizontal=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.BLOCK_MARGIN,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++)e=e.getHeightWidth().height,a=Math.max(a,e);a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.height_!=a){for(d=0;e=c[d];d++)if(b=e.getHeightWidth(),e.flyoutRect_){e.flyoutRect_.setAttribute("width",b.width);e.flyoutRect_.setAttribute("height",b.height);var f=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:
0,g=e.getRelativeToSurfaceXY();e.flyoutRect_.setAttribute("y",g.y);e.flyoutRect_.setAttribute("x",this.RTL?g.x-b.width+f:g.x-f)}this.height_=a}};
Blockly.Flyout.prototype.reflowVertical=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.CORNER_RADIUS,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++){var f=e.getHeightWidth().width;e.outputConnection&&(f-=Blockly.BlockSvg.TAB_WIDTH);a=Math.max(a,f)}a+=Blockly.BlockSvg.TAB_WIDTH;a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.width_!=a){for(d=0;e=c[d];d++){f=e.getHeightWidth();if(this.RTL){var g=e.getRelativeToSurfaceXY().x,h=a-b,
h=h/this.workspace_.scale,h=h-Blockly.BlockSvg.TAB_WIDTH;e.moveBy(h-g,0)}e.flyoutRect_&&(e.flyoutRect_.setAttribute("width",f.width),e.flyoutRect_.setAttribute("height",f.height),g=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,h=e.getRelativeToSurfaceXY(),e.flyoutRect_.setAttribute("x",this.RTL?h.x-f.width+g:h.x-g),e.flyoutRect_.setAttribute("y",h.y))}this.width_=a}};
Blockly.Flyout.prototype.reflowVertical=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.BLOCK_MARGIN,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++){var f=e.getHeightWidth().width;e.outputConnection&&(f-=Blockly.BlockSvg.TAB_WIDTH);a=Math.max(a,f)}a+=Blockly.BlockSvg.TAB_WIDTH;a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.width_!=a){for(d=0;e=c[d];d++){f=e.getHeightWidth();if(this.RTL){var g=e.getRelativeToSurfaceXY().x,h=a-b,h=
h/this.workspace_.scale,h=h-Blockly.BlockSvg.TAB_WIDTH;e.moveBy(h-g,0)}e.flyoutRect_&&(e.flyoutRect_.setAttribute("width",f.width),e.flyoutRect_.setAttribute("height",f.height),g=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,h=e.getRelativeToSurfaceXY(),e.flyoutRect_.setAttribute("x",this.RTL?h.x-f.width+g:h.x-g),e.flyoutRect_.setAttribute("y",h.y))}this.width_=a}};
Blockly.Flyout.prototype.reflow=function(){this.horizontalLayout_?this.reflowHorizontal():this.reflowVertical();Blockly.fireUiEvent(window,"resize")};Blockly.Toolbox=function(a){this.workspace_=a;this.iconic_=!1;this.RTL=a.options.RTL;this.horizontalLayout_=a.options.horizontalLayout;this.toolboxPosition=a.options.toolboxPosition;this.config_={indentWidth:19,cssRoot:"blocklyTreeRoot",cssHideRoot:"blocklyHidden",cssItem:"",cssTreeRow:"blocklyTreeRow",cssItemLabel:"blocklyTreeLabel",cssTreeIcon:"blocklyTreeIcon",cssExpandedFolderIcon:"blocklyTreeIconOpen",cssFileIcon:"blocklyTreeIconNone",cssSelectedRow:"blocklyTreeSelected"};this.treeSeparatorConfig_=
{cssTreeRow:"blocklyTreeSeparator"};this.horizontalLayout_&&(this.config_.cssTreeRow+=a.RTL?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.treeSeparatorConfig_.cssTreeRow="blocklyTreeSeparatorHorizontal"+(a.RTL?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree"),this.config_.cssTreeIcon="")};Blockly.Toolbox.prototype.width=0;Blockly.Toolbox.prototype.height=0;Blockly.Toolbox.prototype.selectedOption_=null;Blockly.Toolbox.prototype.lastCategory_=null;
Blockly.Toolbox.prototype.init=function(){var a=this.workspace_;this.HtmlDiv=goog.dom.createDom("div","blocklyToolboxDiv");this.HtmlDiv.setAttribute("dir",a.RTL?"RTL":"LTR");document.body.appendChild(this.HtmlDiv);Blockly.bindEvent_(this.HtmlDiv,"mousedown",this,function(a){Blockly.isRightButton(a)||a.target==this.HtmlDiv?Blockly.hideChaff(!1):Blockly.hideChaff(!0)});this.flyout_=new Blockly.Flyout({disabledPatternId:a.options.disabledPatternId,parentWorkspace:a,RTL:a.RTL,horizontalLayout:a.horizontalLayout,
@ -1322,34 +1333,38 @@ Blockly.Toolbox.TreeControl.prototype.handleTouchEvent_=function(a){a.preventDef
Blockly.Toolbox.TreeControl.prototype.setSelectedItem=function(a){var b=this.toolbox_;if(a!=this.selectedItem_&&a!=b.tree_){b.lastCategory_&&(b.lastCategory_.getRowElement().style.backgroundColor="");if(a){var c=a.hexColour||"#57e";a.getRowElement().style.backgroundColor=c;b.addColour_(a)}c=this.getSelectedItem();goog.ui.tree.TreeControl.prototype.setSelectedItem.call(this,a);a&&a.blocks&&a.blocks.length?(b.flyout_.show(a.blocks),b.lastCategory_!=a&&b.flyout_.scrollToStart()):b.flyout_.hide();c!=
a&&c!=this&&(c=new Blockly.Events.Ui(null,"category",c&&c.getHtml(),a&&a.getHtml()),c.workspaceId=b.workspace_.id,Blockly.Events.fire(c));a&&(b.lastCategory_=a)}};Blockly.Toolbox.TreeNode=function(a,b,c,d){goog.ui.tree.TreeNode.call(this,b,c,d);a&&(b=function(){Blockly.fireUiEvent(window,"resize")},goog.events.listen(a.tree_,goog.ui.tree.BaseNode.EventType.EXPAND,b),goog.events.listen(a.tree_,goog.ui.tree.BaseNode.EventType.COLLAPSE,b),this.toolbox_=a)};goog.inherits(Blockly.Toolbox.TreeNode,goog.ui.tree.TreeNode);
Blockly.Toolbox.TreeNode.prototype.getExpandIconSafeHtml=function(){return goog.html.SafeHtml.create("span")};Blockly.Toolbox.TreeNode.prototype.onMouseDown=function(a){this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select();this.updateRow()};Blockly.Toolbox.TreeNode.prototype.onDoubleClick_=function(a){};Blockly.Toolbox.TreeSeparator=function(a){Blockly.Toolbox.TreeNode.call(this,null,"",a)};
goog.inherits(Blockly.Toolbox.TreeSeparator,Blockly.Toolbox.TreeNode);Blockly.Colours={motion:{primary:"#4C97FF",secondary:"#4280D7",tertiary:"#3373CC"},looks:{primary:"#9966FF",secondary:"#855CD6",tertiary:"#774DCB"},sounds:{primary:"#D65CD6",secondary:"#BF40BF",tertiary:"#A63FA6"},control:{primary:"#FFAB19",secondary:"#EC9C13",tertiary:"#CF8B17"},event:{primary:"#FFD500",secondary:"#DBC200",tertiary:"#CCAA00"},text:"#575E75",workspace:"#F5F8FF",textField:"#FFFFFF"};Blockly.Css={};Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"};Blockly.Css.currentCursor_="";Blockly.Css.styleSheet_=null;Blockly.Css.mediaPath_="";
Blockly.Css.inject=function(a,b){if(!Blockly.Css.styleSheet_){var c=".blocklyDraggable {}\n";a&&(c+=Blockly.Css.CONTENT.join("\n"),Blockly.FieldDate&&(c+=Blockly.FieldDate.CSS.join("\n")));Blockly.Css.mediaPath_=b.replace(/[\\\/]$/,"");var c=c.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_),d=document.createElement("style");document.head.appendChild(d);c=document.createTextNode(c);d.appendChild(c);Blockly.Css.styleSheet_=d.sheet;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)}};
Blockly.Css.setCursor=function(a){if(Blockly.Css.currentCursor_!=a){Blockly.Css.currentCursor_=a;var b="url("+Blockly.Css.mediaPath_+"/"+a+".cur), auto",c=".blocklyDraggable {\n cursor: "+b+";\n}\n";Blockly.Css.styleSheet_.deleteRule(0);Blockly.Css.styleSheet_.insertRule(c,0);for(var c=document.getElementsByClassName("blocklyToolboxDiv"),d=0,e;e=c[d];d++)e.style.cursor=a==Blockly.Css.Cursor.DELETE?b:"";document.body.parentNode.style.cursor=a==Blockly.Css.Cursor.OPEN?"":b}};
Blockly.Css.CONTENT=[".blocklySvg {","background-color: "+Blockly.Colours.workspace+";","outline: none;","overflow: hidden;","}",".blocklyRelativeWrapper {","position: relative;","width: 100%;","height: 100%;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 999;","}",".blocklyWidgetDiv.fieldTextInput {","overflow: hidden;","border: 1px solid;","box-sizing: border-box;","transform-origin: 0 0;","-ms-transform-origin: 0 0;","-moz-transform-origin: 0 0;","-webkit-transform-origin: 0 0;",
goog.inherits(Blockly.Toolbox.TreeSeparator,Blockly.Toolbox.TreeNode);Blockly.Css={};Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"};Blockly.Css.currentCursor_="";Blockly.Css.styleSheet_=null;Blockly.Css.mediaPath_="";
Blockly.Css.inject=function(a,b){if(!Blockly.Css.styleSheet_){var c=".blocklyDraggable {}\n";a&&(c+=Blockly.Css.CONTENT.join("\n"),Blockly.FieldDate&&(c+=Blockly.FieldDate.CSS.join("\n")));Blockly.Css.mediaPath_=b.replace(/[\\\/]$/,"");var c=c.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_),d;for(d in Blockly.Colours)Blockly.Colours.hasOwnProperty(d)&&(c=c.replace("$colour_"+d,Blockly.Colours[d]));d=document.createElement("style");document.head.appendChild(d);c=document.createTextNode(c);d.appendChild(c);
Blockly.Css.styleSheet_=d.sheet;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)}};
Blockly.Css.setCursor=function(a){if(!(goog.userAgent.MOBILE||goog.userAgent.ANDROID||goog.userAgent.IPAD)&&Blockly.Css.currentCursor_!=a){Blockly.Css.currentCursor_=a;var b="url("+Blockly.Css.mediaPath_+"/"+a+".cur), auto",c=".blocklyDraggable {\n cursor: "+b+";\n}\n";Blockly.Css.styleSheet_.deleteRule(0);Blockly.Css.styleSheet_.insertRule(c,0);for(var c=document.getElementsByClassName("blocklyToolboxDiv"),d=0,e;e=c[d];d++)e.style.cursor=a==Blockly.Css.Cursor.DELETE?b:"";document.body.parentNode.style.cursor=
a==Blockly.Css.Cursor.OPEN?"":b}};
Blockly.Css.CONTENT=[".blocklySvg {","background-color: $colour_workspace;","outline: none;","overflow: hidden;","}",".blocklyRelativeWrapper {","position: relative;","width: 100%;","height: 100%;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 999;","}",".blocklyWidgetDiv.fieldTextInput {","overflow: hidden;","border: 1px solid;","box-sizing: border-box;","transform-origin: 0 0;","-ms-transform-origin: 0 0;","-moz-transform-origin: 0 0;","-webkit-transform-origin: 0 0;",
"}",".blocklyNonSelectable {","user-select: none;","-moz-user-select: none;","-webkit-user-select: none;","-ms-user-select: none;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);","color: #000;","display: none;","font-family: sans-serif;","font-size: 9pt;","opacity: 0.9;","padding: 2px;","position: absolute;","z-index: 1000;","}",".blocklyDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;",
"bottom: 0;","overflow: visible !important;","z-index: 5000;","-webkit-backface-visibility: hidden;","backface-visibility: hidden;","-webkit-perspective: 1000;","perspective: 1000;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #888;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPath {","stroke-width: 1px;","}",
".blocklySelected>.blocklyPath {","}",".blocklyDragging>.blocklyPath {","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;","font-size: 11pt;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {","fill: "+Blockly.Colours.text+
";","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill:"+Blockly.Colours.text+";","}",".blocklySvg text {","user-select: none;","-moz-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;","}",".blocklyCommentTextarea {","background-color: #ffc;","border: 0;","margin: 0;","padding: 2px;","resize: none;","}",".blocklyHtmlInput {","border: none;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 2px 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;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarKnob {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyScrollbarKnob:hover {","fill: #bbb;","}",".blocklyZoom>image {","opacity: .4;","}",".blocklyZoom>image:hover {","opacity: .6;","}",".blocklyZoom>image:active {","opacity: .8;","}",".blocklyFlyout .blocklyScrollbarKnob {",
"fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyFlyout .blocklyScrollbarKnob: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;",
"}",".blocklyContextMenu {","border-radius: 4px;","}",".blocklyDropdownMenu {","padding: 0 !important;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","}",".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 0px;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0px 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;",
"height: 0px;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0px;","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: 0px -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {",
"background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0px -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;","}",".blocklyTreeSelected .blocklyTreeLabel {",
"color: #fff;","}",".blocklyWidgetDiv .goog-palette {","outline: none;","cursor: default;","}",".blocklyWidgetDiv .goog-palette-table {","border: 1px solid #666;","border-collapse: collapse;","}",".blocklyWidgetDiv .goog-palette-cell {","height: 13px;","width: 15px;","margin: 0;","border: 0;","text-align: center;","vertical-align: middle;","border-right: 1px solid #666;","font-size: 1px;","}",".blocklyWidgetDiv .goog-palette-colorswatch {","position: relative;","height: 13px;","width: 15px;","border: 1px solid #666;",
"}",".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {","border: 1px solid #FFF;","}",".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {","border: 1px solid #000;","color: #fff;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","border-color: #ccc #666 #666 #ccc;","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;","}",".blocklyWidgetDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","padding: 4px 7em 4px 28px;","white-space: nowrap;","}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {","padding-left: 7em;","padding-right: 28px;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {","padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {",
"padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: 0.3;","-moz-opacity: 0.3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight,",".blocklyWidgetDiv .goog-menuitem-hover {",
"background-color: #d6e9f8;","border-color: #d6e9f8;","border-style: dotted;","border-width: 1px 0;","padding-bottom: 3px;","padding-top: 3px;","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .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 {",
"left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;","}",".blocklyWidgetDiv .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 {","left: 0;","right: auto;",
"text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .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=goog.dom.createDom("div","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=goog.style.getViewportPageOffset(document);Blockly.WidgetDiv.DIV.style.top=a.y+"px";Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block";Blockly.Events.setGroup(!0)};
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.DIV.style.height="",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=null,goog.dom.removeChildren(Blockly.WidgetDiv.DIV),Blockly.Events.setGroup(!1))};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};
Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};Blockly.WidgetDiv.position=function(a,b,c,d,e){b<d.y&&(b=d.y);e?a>c.width+d.x&&(a=c.width+d.x):a<d.x&&(a=d.x);Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c.height-b+d.y+"px"};Blockly.constants={};Blockly.DRAG_RADIUS=5;Blockly.SNAP_RADIUS=72;Blockly.BUMP_DELAY=250;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";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;
"bottom: 0;","overflow: visible !important;","z-index: 5000;","-webkit-backface-visibility: hidden;","backface-visibility: hidden;","-webkit-perspective: 1000;","perspective: 1000;","}",".blocklyDropDownDiv {","width: 100px;","height: 100px;","background: #f00;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #888;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;",
"stroke: #fc3;","stroke-width: 4px;","}",".blocklyPath {","stroke-width: 1px;","}",".blocklySelected>.blocklyPath {","}",".blocklyDragging>.blocklyPath {","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;","font-size: 11pt;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",
".blocklyEditableText>text {","fill: $colour_text;","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill: $colour_text;","}",".blocklySvg text {","user-select: none;","-moz-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;","}",".blocklyCommentTextarea {","background-color: #ffc;","border: 0;","margin: 0;","padding: 2px;","resize: none;","}",".blocklyHtmlInput {","border: none;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 2px 0;","width: 100%;","text-align: center;","color: $colour_text;","}",
".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: $colour_flyout;","fill-opacity: .8;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarKnob {","fill: $colour_scrollbar;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyScrollbarKnob:hover {","fill: $colour_scrollbarHover;","}",".blocklyZoom>image {","opacity: .4;",
"}",".blocklyZoom>image:hover {","opacity: .6;","}",".blocklyZoom>image:active {","opacity: .8;","}",".blocklyFlyout .blocklyScrollbarKnob {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyFlyout .blocklyScrollbarKnob: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;","}",".blocklyContextMenu {","border-radius: 4px;","}",".blocklyDropdownMenu {","padding: 0 !important;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;","}",".blocklyToolboxDiv {","background-color: $colour_toolbox;",
"color: $colour_toolboxText;","overflow-x: visible;","overflow-y: auto;","position: absolute;","}",".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 0px;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0px 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',
"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0px;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0px;","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: 0px -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0px -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;","}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyWidgetDiv .goog-palette {","outline: none;","cursor: default;","}",".blocklyWidgetDiv .goog-palette-table {","border: 1px solid #666;","border-collapse: collapse;","}",".blocklyWidgetDiv .goog-palette-cell {","height: 13px;","width: 15px;","margin: 0;","border: 0;","text-align: center;","vertical-align: middle;",
"border-right: 1px solid #666;","font-size: 1px;","}",".blocklyWidgetDiv .goog-palette-colorswatch {","position: relative;","height: 13px;","width: 15px;","border: 1px solid #666;","}",".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {","border: 1px solid #FFF;","}",".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {","border: 1px solid #000;","color: #fff;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","border-color: #ccc #666 #666 #ccc;","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;","}",".blocklyWidgetDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","padding: 4px 7em 4px 28px;","white-space: nowrap;","}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {","padding-left: 7em;","padding-right: 28px;",
"}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {","padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {",
"opacity: 0.3;","-moz-opacity: 0.3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight,",".blocklyWidgetDiv .goog-menuitem-hover {","background-color: #d6e9f8;","border-color: #d6e9f8;","border-style: dotted;","border-width: 1px 0;","padding-bottom: 3px;","padding-top: 3px;","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .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 {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;","}",".blocklyWidgetDiv .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 {","left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .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.disposeAnimationFinished_=null;Blockly.WidgetDiv.disposeAnimationTimer_=null;Blockly.WidgetDiv.disposeAnimationTimerLength_=0;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=goog.dom.createDom("div","blocklyWidgetDiv"),document.body.appendChild(Blockly.WidgetDiv.DIV))};
Blockly.WidgetDiv.show=function(a,b,c,d,e){Blockly.WidgetDiv.hide();Blockly.WidgetDiv.owner_=a;Blockly.WidgetDiv.dispose_=c;Blockly.WidgetDiv.disposeAnimationFinished_=d;Blockly.WidgetDiv.disposeAnimationTimerLength_=e;a=goog.style.getViewportPageOffset(document);Blockly.WidgetDiv.DIV.style.top=a.y+"px";Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block";Blockly.Events.setGroup(!0)};
Blockly.WidgetDiv.hide=function(a){Blockly.WidgetDiv.disposeAnimationTimer_?(window.clearTimeout(Blockly.WidgetDiv.disposeAnimationTimer_),Blockly.WidgetDiv.disposeAnimationFinished_&&Blockly.WidgetDiv.disposeAnimationFinished_(),Blockly.WidgetDiv.disposeAnimationFinished_=null,Blockly.WidgetDiv.disposeAnimationTimer_=null,Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.hideAndClearDom_()):Blockly.WidgetDiv.isVisible()&&(Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=
null,Blockly.WidgetDiv.disposeAnimationFinished_&&!a?Blockly.WidgetDiv.disposeAnimationTimer_=window.setTimeout(Blockly.WidgetDiv.hide,1E3*Blockly.WidgetDiv.disposeAnimationTimerLength_):(Blockly.WidgetDiv.disposeAnimationFinished_&&Blockly.WidgetDiv.disposeAnimationFinished_(),Blockly.WidgetDiv.disposeAnimationFinished_=null,Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.hideAndClearDom_()),Blockly.Events.setGroup(!1))};
Blockly.WidgetDiv.hideAndClearDom_=function(){Blockly.WidgetDiv.DIV.style.display="none";Blockly.WidgetDiv.DIV.style.left="";Blockly.WidgetDiv.DIV.style.top="";Blockly.WidgetDiv.DIV.style.height="";goog.dom.removeChildren(Blockly.WidgetDiv.DIV)};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};
Blockly.WidgetDiv.position=function(a,b,c,d,e){b<d.y&&(b=d.y);e?a>c.width+d.x&&(a=c.width+d.x):a<d.x&&(a=d.x);Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c.height-b+d.y+"px"};Blockly.constants={};Blockly.DRAG_RADIUS=5;Blockly.SNAP_RADIUS=72;Blockly.BUMP_DELAY=250;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";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_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.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),d=!(!c||!c.getElementsByTagName("category").length),e=a.trashcan,void 0===e&&(e=d),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 l=a.scrollbars;void 0===l&&(l=d);var n=a.css;void 0===n&&(n=!0);var m="https://blockly-demo.appspot.com/static/media/";a.media?m=a.media:a.path&&(m=
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,t=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==a.rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,r=!!a.realtime,u=r?a.realtimeOptions:void 0;this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=m;this.hasCategories=d;this.hasScrollbars=l;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=
c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.enableRealtime=r;this.realtimeOptions=u;this.horizontalLayout=p;this.toolboxAtStart=q;this.toolboxPosition=t};Blockly.Options.prototype.parentWorkspace=null;Blockly.Options.prototype.setMetrics=function(a){};Blockly.Options.prototype.getMetrics=function(){return null};
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,v=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==a.rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,u=!!a.realtime,w=u?a.realtimeOptions:void 0,r=a.colours;if(r)for(var t in r)r.hasOwnProperty(t)&&Blockly.Colours.hasOwnProperty(t)&&(Blockly.Colours[t]=r[t]);this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=
m;this.hasCategories=d;this.hasScrollbars=l;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.enableRealtime=u;this.realtimeOptions=w;this.horizontalLayout=p;this.toolboxAtStart=q;this.toolboxPosition=v};Blockly.Options.prototype.parentWorkspace=null;Blockly.Options.prototype.setMetrics=function(a){};Blockly.Options.prototype.getMetrics=function(){return null};
Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:parseFloat(a.startScale);b.maxScale=void 0===a.maxScale?3:parseFloat(a.maxScale);b.minScale=void 0===a.minScale?.3:parseFloat(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:parseFloat(a.scaleSpeed);return b};
Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};b.spacing=parseFloat(a.spacing)||0;b.colour=a.colour||"#888";b.length=parseFloat(a.length)||1;b.snap=0<b.spacing&&!!a.snap;return b};Blockly.Options.parseToolboxTree_=function(a){a?("string"!=typeof a&&("undefined"==typeof XSLTProcessor&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=Blockly.Xml.textToDom(a))):a=null;return a};Blockly.utils={};Blockly.cache3dSupported_=null;Blockly.addClass_=function(a,b){var c=a.getAttribute("class")||"";-1==(" "+c+" ").indexOf(" "+b+" ")&&(c&&(c+=" "),a.setAttribute("class",c+b))};Blockly.removeClass_=function(a,b){var c=a.getAttribute("class");if(-1!=(" "+c+" ").indexOf(" "+b+" ")){for(var c=c.split(/\s+/),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")}};
Blockly.hasClass_=function(a,b){return-1!=(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")};Blockly.bindEvent_=function(a,b,c,d){var e=c?function(a){d.call(c,a)}:d;a.addEventListener(b,e,!1);var f=[[a,b,e]];if(b in Blockly.bindEvent_.TOUCH_MAP)for(var e=function(a){if(1==a.changedTouches.length){var b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}d.call(c,a);a.preventDefault()},g=0,h;h=Blockly.bindEvent_.TOUCH_MAP[b][g];g++)a.addEventListener(h,e,!1),f.push([a,h,e]);return f};
@ -1365,10 +1380,12 @@ Blockly.isRightButton=function(a){return a.ctrlKey&&goog.userAgent.MAC?!0:2==a.b
Blockly.commonWordPrefix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0][e],g=1;g<a.length;g++)if(f!=a[g][e])return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g][e])&&" "!=f)return c;return d};
Blockly.commonWordSuffix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0].substr(-e-1,1),g=1;g<a.length;g++)if(f!=a[g].substr(-e-1,1))return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g].charAt(a[g].length-e-1))&&" "!=f)return c;return d};Blockly.isNumber=function(a){return!!a.match(/^\s*-?\d+(\.\d+)?\s*$/)};
Blockly.tokenizeInterpolation=function(a){var b=[];a=a.split("");a.push("");for(var c=0,d=[],e=null,f=0;f<a.length;f++){var g=a[f];0==c?"%"==g?c=1:d.push(g):1==c?"%"==g?(d.push(g),c=0):"0"<=g&&"9">=g?(c=2,e=g,(g=d.join(""))&&b.push(g),d.length=0):(d.push("%",g),c=0):2==c&&("0"<=g&&"9">=g?e+=g:(b.push(parseInt(e,10)),f--,c=0))}(g=d.join(""))&&b.push(g);return b};Blockly.genUid=function(){for(var a=Blockly.genUid.soup_.length,b=[],c=0;20>c;c++)b[c]=Blockly.genUid.soup_.charAt(Math.random()*a);return b.join("")};
Blockly.genUid.soup_="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";Blockly.DragSurfaceSvg=function(a){this.container_=a};Blockly.DragSurfaceSvg.prototype.SVG_=null;Blockly.DragSurfaceSvg.prototype.dragGroup_=null;Blockly.DragSurfaceSvg.prototype.container_=null;
Blockly.genUid.soup_="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";Blockly.DragSurfaceSvg=function(a){this.container_=a};Blockly.DragSurfaceSvg.prototype.SVG_=null;Blockly.DragSurfaceSvg.prototype.dragGroup_=null;Blockly.DragSurfaceSvg.prototype.container_=null;Blockly.DragSurfaceSvg.prototype.scale_=1;
Blockly.DragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.createSvgElement("svg",{xmlns:Blockly.SVG_NS,"xmlns:html":Blockly.HTML_NS,"xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklyDragSurface"},this.container_),Blockly.createSvgElement("defs",{},this.SVG_),this.dragGroup_=Blockly.createSvgElement("g",{},this.SVG_))};
Blockly.DragSurfaceSvg.prototype.setBlocksAndShow=function(a){goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Already dragging a block.");this.dragGroup_.appendChild(a);this.SVG_.style.display="block"};Blockly.DragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){Blockly.is3dSupported()?this.dragGroup_.setAttribute("style","transform: translate3d("+a+"px, "+b+"px, 0px)scale3d("+c+","+c+","+c+")"):this.dragGroup_.setAttribute("transform","translate("+a+", "+b+") scale("+c+")")};
Blockly.DragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_};Blockly.DragSurfaceSvg.prototype.clearAndHide=function(a){a.appendChild(this.dragGroup_.childNodes[0]);this.SVG_.style.display="none";goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Drag group was not cleared.")};Blockly.inject=function(a,b){goog.isString(a)&&(a=document.getElementById(a)||document.querySelector(a));if(!goog.dom.contains(document,a))throw"Error: container is not in current document.";var c=new Blockly.Options(b||{}),d=goog.dom.createDom("div","blocklyRelativeWrapper");a.appendChild(d);var e=Blockly.createDom_(d,c),d=new Blockly.DragSurfaceSvg(d);d.createDom();c=Blockly.createMainWorkspace_(e,c,d);Blockly.init_(c);c.markFocused();Blockly.bindEvent_(e,"focus",c,c.markFocused);return c};
Blockly.DragSurfaceSvg.prototype.setBlocksAndShow=function(a){goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Already dragging a block.");this.dragGroup_.appendChild(a);this.SVG_.style.display="block"};
Blockly.DragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){this.scale_=c;Blockly.is3dSupported()?this.dragGroup_.setAttribute("style","transform: translate3d("+a+"px, "+b+"px, 0px)scale3d("+c+","+c+","+c+")"):this.dragGroup_.setAttribute("transform","translate("+a+", "+b+") scale("+c+")")};
Blockly.DragSurfaceSvg.prototype.translateSurface=function(a,b){a*=this.scale_;b*=this.scale_;Blockly.is3dSupported()?this.SVG_.setAttribute("style","transform: translate3d("+a+"px, "+b+"px, 0px); display: block;"):this.SVG_.setAttribute("transform","translate("+a+", "+b+")")};Blockly.DragSurfaceSvg.prototype.getSurfaceTranslation=function(){var a=Blockly.getRelativeXY_(this.SVG_);return new goog.math.Coordinate(a.x/this.scale_,a.y/this.scale_)};Blockly.DragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_};
Blockly.DragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.childNodes[0]};Blockly.DragSurfaceSvg.prototype.clearAndHide=function(a){a.appendChild(this.getCurrentBlock());this.SVG_.style.display="none";goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Drag group was not cleared.")};Blockly.inject=function(a,b){goog.isString(a)&&(a=document.getElementById(a)||document.querySelector(a));if(!goog.dom.contains(document,a))throw"Error: container is not in current document.";var c=new Blockly.Options(b||{}),d=goog.dom.createDom("div","blocklyRelativeWrapper");a.appendChild(d);var e=Blockly.createDom_(d,c),d=new Blockly.DragSurfaceSvg(d);d.createDom();c=Blockly.createMainWorkspace_(e,c,d);Blockly.init_(c);c.markFocused();Blockly.bindEvent_(e,"focus",c,c.markFocused);return c};
Blockly.createDom_=function(a,b){a.setAttribute("dir","LTR");goog.ui.Component.setDefaultRightToLeft(b.RTL);Blockly.Css.inject(b.hasCss,b.pathToMedia);var c=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklySvg"},a),d=Blockly.createSvgElement("defs",{},c),e=String(Math.random()).substring(2),f=Blockly.createSvgElement("filter",{id:"blocklyEmbossFilter"+e},d);Blockly.createSvgElement("feGaussianBlur",
{"in":"SourceAlpha",stdDeviation:1,result:"blur"},f);var g=Blockly.createSvgElement("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},f);Blockly.createSvgElement("fePointLight",{x:-5E3,y:-1E4,z:2E4},g);Blockly.createSvgElement("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},f);Blockly.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,
k4:0},f);b.embossFilterId=f.id;f=Blockly.createSvgElement("filter",{id:"blocklyStackGlowFilter"+e},d);Blockly.createSvgElement("feMorphology",{"in":"SourceAlpha",operator:"dilate",radius:4,result:"outBlur"},f);Blockly.createSvgElement("feFlood",{"flood-color":"#05f","flood-opacity":"0.9",result:"outColor"},f);Blockly.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},f);Blockly.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"outGlow",operator:"over"},

View file

@ -854,7 +854,8 @@ goog.ui.tree.TreeControl.prototype.handleMouseEvent_=function(a){goog.log.fine(t
goog.ui.tree.TreeControl.prototype.handleKeyEvent=function(a){var b=!1;(b=this.typeAhead_.handleNavigation(a)||this.selectedItem_&&this.selectedItem_.onKeyDown(a)||this.typeAhead_.handleTypeAheadChar(a))&&a.preventDefault();return b};goog.ui.tree.TreeControl.prototype.getNodeFromEvent_=function(a){var b=null;for(a=a.target;null!=a;){if(b=goog.ui.tree.BaseNode.allNodes[a.id])return b;if(a==this.getElement())break;a=a.parentNode}return null};
goog.ui.tree.TreeControl.prototype.createNode=function(a){return new goog.ui.tree.TreeNode(a||goog.html.SafeHtml.EMPTY,this.getConfig(),this.getDomHelper())};goog.ui.tree.TreeControl.prototype.setNode=function(a){this.typeAhead_.setNodeInMap(a)};goog.ui.tree.TreeControl.prototype.removeNode=function(a){this.typeAhead_.removeNodeFromMap(a)};goog.ui.tree.TreeControl.prototype.clearTypeAhead=function(){this.typeAhead_.clear()};goog.ui.tree.TreeControl.defaultConfig=goog.ui.tree.BaseNode.defaultConfig;
// Copyright 2013 Google Inc. Apache License 2.0
var Blockly={Blocks:{}};
var Blockly={Blocks:{}};Blockly.Colours={motion:{primary:"#4C97FF",secondary:"#4280D7",tertiary:"#3373CC"},looks:{primary:"#9966FF",secondary:"#855CD6",tertiary:"#774DCB"},sounds:{primary:"#D65CD6",secondary:"#BF40BF",tertiary:"#A63FA6"},control:{primary:"#FFAB19",secondary:"#EC9C13",tertiary:"#CF8B17"},event:{primary:"#FFD500",secondary:"#DBC200",tertiary:"#CCAA00"},text:"#575E75",workspace:"#F5F8FF",toolbox:"#DDDDDD",toolboxText:"#000000",flyout:"#DDDDDD",scrollbar:"#CCCCCC",scrollbarHover:"#BBBBBB",textField:"#FFFFFF",
insertionMarker:"#949494",insertionMarkerOpacity:.6};
// Copyright 2012 Google Inc. Apache License 2.0
Blockly.Workspace=function(a){this.id=Blockly.genUid();Blockly.Workspace.WorkspaceDB_[this.id]=this;this.options=a||{};this.RTL=!!this.options.RTL;this.horizontalLayout=!!this.options.horizontalLayout;this.topBlocks_=[];this.listeners_=[];this.tapListeners_=[];this.undoStack_=[];this.redoStack_=[]};Blockly.Workspace.prototype.rendered=!1;Blockly.Workspace.prototype.MAX_UNDO=1024;Blockly.Workspace.prototype.dispose=function(){this.listeners_.length=0;this.clear();delete Blockly.Workspace.WorkspaceDB_[this.id]};
Blockly.Workspace.SCAN_ANGLE=3;Blockly.Workspace.prototype.addTopBlock=function(a){this.topBlocks_.push(a)};Blockly.Workspace.prototype.removeTopBlock=function(a){for(var b=!1,c,d=0;c=this.topBlocks_[d];d++)if(c==a){this.topBlocks_.splice(d,1);b=!0;break}if(!b)throw"Block not present in workspace's list of top-most blocks.";};
@ -975,9 +976,9 @@ Math.max(0,b));this.svgKnob_.setAttribute("y",this.constrainKnob_(d))}this.onScr
Blockly.Scrollbar.prototype.createDom_=function(){this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical")},null);this.svgBackground_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarBackground"},this.svgGroup_);var a=Math.floor((Blockly.Scrollbar.scrollbarThickness-5)/2);this.svgKnob_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarKnob",rx:a,ry:a},this.svgGroup_);Blockly.Scrollbar.insertAfter_(this.svgGroup_,this.workspace_.getBubbleCanvas())};
Blockly.Scrollbar.prototype.isVisible=function(){return"none"!=this.svgGroup_.getAttribute("display")};Blockly.Scrollbar.prototype.setVisible=function(a){if(a!=this.isVisible()){if(this.pair_)throw"Unable to toggle visibility of paired scrollbars.";a?this.svgGroup_.setAttribute("display","block"):(this.workspace_.setMetrics({x:0,y:0}),this.svgGroup_.setAttribute("display","none"))}};
Blockly.Scrollbar.prototype.onMouseDownBar_=function(a){this.onMouseUpKnob_();if(!Blockly.isRightButton(a)){var b=Blockly.mouseToSvg(a,this.workspace_.getParentSvg()),b=this.horizontal_?b.x:b.y,c=Blockly.getSvgXY_(this.svgKnob_,this.workspace_),c=this.horizontal_?c.x:c.y,d=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"width":"height")),e=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),f=.95*d;b<=c?e-=f:b>=c+d&&(e+=f);this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(e));
this.onScroll_()}a.stopPropagation()};
Blockly.Scrollbar.prototype.onMouseDownKnob_=function(a){this.onMouseUpKnob_();Blockly.isRightButton(a)||(Blockly.setPageSelectable(!1),this.startDragKnob=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),this.startDragMouse=this.horizontal_?a.clientX:a.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,this.onMouseUpKnob_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.onMouseMoveKnob_));a.stopPropagation()};
Blockly.Scrollbar.prototype.onMouseMoveKnob_=function(a){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(this.startDragKnob+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse)));this.onScroll_()};
Blockly.WidgetDiv.hide(!0);this.onScroll_()}a.stopPropagation()};
Blockly.Scrollbar.prototype.onMouseDownKnob_=function(a){this.onMouseUpKnob_();Blockly.isRightButton(a)||(Blockly.setPageSelectable(!1),this.startDragKnob=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),this.startDragMouse=this.horizontal_?a.clientX:a.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,this.onMouseUpKnob_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.onMouseMoveKnob_),Blockly.WidgetDiv.hide(!0));
a.stopPropagation()};Blockly.Scrollbar.prototype.onMouseMoveKnob_=function(a){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(this.startDragKnob+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse)));this.onScroll_()};
Blockly.Scrollbar.prototype.onMouseUpKnob_=function(){Blockly.setPageSelectable(!0);Blockly.hideChaff(!0);Blockly.Scrollbar.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_),Blockly.Scrollbar.onMouseUpWrapper_=null);Blockly.Scrollbar.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseMoveWrapper_),Blockly.Scrollbar.onMouseMoveWrapper_=null)};
Blockly.Scrollbar.prototype.constrainKnob_=function(a){if(0>=a||isNaN(a))a=0;else{var b=this.horizontal_?"width":"height",c=parseFloat(this.svgBackground_.getAttribute(b)),b=parseFloat(this.svgKnob_.getAttribute(b));a=Math.min(a,c-b)}return a};
Blockly.Scrollbar.prototype.onScroll_=function(){var a=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),b=parseFloat(this.svgBackground_.getAttribute(this.horizontal_?"width":"height")),a=a/b;isNaN(a)&&(a=0);b={};this.horizontal_?b.x=a:b.y=a;this.workspace_.setMetrics(b)};Blockly.Scrollbar.prototype.set=function(a){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",a*(this.ratio_||0));this.onScroll_()};
@ -1034,7 +1035,7 @@ Blockly.WorkspaceSvg.prototype.isDeleteArea=function(a){a=new goog.math.Coordina
Blockly.WorkspaceSvg.prototype.onMouseDown_=function(a){this.markFocused();Blockly.setPageSelectable(!1);Blockly.isTargetInput_(a)||(Blockly.svgResize(this),Blockly.terminateDrag_(),Blockly.hideChaff(),a.target&&a.target.nodeName&&("svg"==a.target.nodeName.toLowerCase()||a.target==this.svgBackground_)&&Blockly.selected&&!this.options.readOnly&&Blockly.selected.unselect(),Blockly.isRightButton(a)?this.showContextMenu_(a):this.scrollbar&&(this.isScrolling=!0,this.startDragMouseX=a.clientX,this.startDragMouseY=
a.clientY,this.startDragMetrics=this.getMetrics(),this.startScrollX=this.scrollX,this.startScrollY=this.scrollY,"mouseup"in Blockly.bindEvent_.TOUCH_MAP&&(Blockly.onTouchUpWrapper_=Blockly.onTouchUpWrapper_||[],Blockly.onTouchUpWrapper_=Blockly.onTouchUpWrapper_.concat(Blockly.bindEvent_(document,"mouseup",null,Blockly.onMouseUp_))),Blockly.onMouseMoveWrapper_=Blockly.onMouseMoveWrapper_||[],Blockly.onMouseMoveWrapper_=Blockly.onMouseMoveWrapper_.concat(Blockly.bindEvent_(document,"mousemove",null,
Blockly.onMouseMove_))),a.stopPropagation())};Blockly.WorkspaceSvg.prototype.startDrag=function(a,b,c){a=Blockly.mouseToSvg(a,this.getParentSvg());a.x/=this.scale;a.y/=this.scale;this.dragDeltaX_=b-a.x;this.dragDeltaY_=c-a.y};Blockly.WorkspaceSvg.prototype.moveDrag=function(a){a=Blockly.mouseToSvg(a,this.getParentSvg());a.x/=this.scale;a.y/=this.scale;return new goog.math.Coordinate(this.dragDeltaX_+a.x,this.dragDeltaY_+a.y)};
Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(a){if(a.ctrlKey){Blockly.terminateDrag_();var b=0<a.deltaY?-1:1,c=Blockly.mouseToSvg(a,this.getParentSvg());this.zoom(c.x,c.y,b)}else b=this.scrollX-a.deltaX,c=this.scrollY-a.deltaY,this.startDragMetrics=this.getMetrics(),this.scroll(b,c);a.preventDefault()};
Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(a){if(a.ctrlKey){Blockly.terminateDrag_();var b=0<a.deltaY?-1:1,c=Blockly.mouseToSvg(a,this.getParentSvg());this.zoom(c.x,c.y,b)}else Blockly.WidgetDiv.hide(!0),b=this.scrollX-a.deltaX,c=this.scrollY-a.deltaY,this.startDragMetrics=this.getMetrics(),this.scroll(b,c);a.preventDefault()};
Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var a=this.getTopBlocks();if(!a.length)return{x:0,y:0,width:0,height:0};for(var b=a[0].getBoundingRectangle(),c=1;c<a.length;c++){var d=a[c].getBoundingRectangle();d.topLeft.x<b.topLeft.x&&(b.topLeft.x=d.topLeft.x);d.bottomRight.x>b.bottomRight.x&&(b.bottomRight.x=d.bottomRight.x);d.topLeft.y<b.topLeft.y&&(b.topLeft.y=d.topLeft.y);d.bottomRight.y>b.bottomRight.y&&(b.bottomRight.y=d.bottomRight.y)}return{x:b.topLeft.x,y:b.topLeft.y,width:b.bottomRight.x-
b.topLeft.x,height:b.bottomRight.y-b.topLeft.y}};Blockly.WorkspaceSvg.prototype.cleanUp_=function(){Blockly.Events.setGroup(!0);for(var a=this.getTopBlocks(!0),b=0,c=0,d;d=a[c];c++){var e=d.getRelativeToSurfaceXY();d.moveBy(-e.x,b-e.y);d.snapToGrid();b=d.getRelativeToSurfaceXY().y+d.getHeightWidth().height+Blockly.BlockSvg.MIN_BLOCK_Y}Blockly.Events.setGroup(!1);Blockly.fireUiEvent(window,"resize")};
Blockly.WorkspaceSvg.prototype.showContextMenu_=function(a){function b(a){if(a.isDeletable())m=m.concat(a.getDescendants());else{a=a.getChildren();for(var c=0;c<a.length;c++)b(a[c])}}function c(){Blockly.Events.setGroup(f);var a=m.shift();a&&(a.workspace?(a.dispose(!1,!0),setTimeout(c,10)):c());Blockly.Events.setGroup(!1)}if(!this.options.readOnly&&!this.isFlyout){var d=[],e=this.getTopBlocks(!0),f=Blockly.genUid(),g={};g.text=Blockly.Msg.UNDO;g.enabled=0<this.undoStack_.length;g.callback=this.undo.bind(this,
@ -1044,11 +1045,11 @@ Blockly.Workspace.prototype.setAudioCallback=function(a){this.audioCallback_=a};
Blockly.WorkspaceSvg.prototype.updateToolbox=function(a){if(a=Blockly.parseToolboxTree_(a)){if(!this.options.languageTree)throw"Existing toolbox is null. Can't create new toolbox.";if(a.getElementsByTagName("category").length){if(!this.toolbox_)throw"Existing toolbox has no categories. Can't change mode.";this.options.languageTree=a;this.toolbox_.populate_(a);this.toolbox_.addColour_()}else{if(!this.flyout_)throw"Existing toolbox has categories. Can't change mode.";this.options.languageTree=a;
this.flyout_.show(a.childNodes)}}else if(this.options.languageTree)throw"Can't nullify an existing toolbox.";};Blockly.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():Blockly.mainWorkspace=this};
Blockly.WorkspaceSvg.prototype.zoom=function(a,b,c){var d=this.options.zoomOptions.scaleSpeed,e=this.getMetrics(),f=this.getParentSvg().createSVGPoint();f.x=a;f.y=b;f=f.matrixTransform(this.getCanvas().getCTM().inverse());a=f.x;b=f.y;f=this.getCanvas();c=1==c?d:1/d;d=this.scale*c;d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:d<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale/this.scale);a=f.getCTM().translate(a*(1-c),b*(1-c)).scale(c);this.scale!=
a.a&&(this.scale=a.a,this.scrollX=a.e-e.absoluteLeft,this.scrollY=a.f-e.absoluteTop,this.updateGridPattern_(),this.scrollbar?this.scrollbar.resize():this.translate(0,0),Blockly.hideChaff(!1),this.flyout_&&this.flyout_.reflow())};Blockly.WorkspaceSvg.prototype.zoomCenter=function(a){var b=this.getMetrics();this.zoom(b.viewWidth/2,b.viewHeight/2,a)};
a.a&&(this.scale=a.a,this.scrollX=a.e-e.absoluteLeft,this.scrollY=a.f-e.absoluteTop,this.updateGridPattern_(),this.scrollbar?this.scrollbar.resize():this.translate(0,0),Blockly.WidgetDiv.hide(!0),Blockly.hideChaff(!1),this.flyout_&&this.flyout_.reflow())};Blockly.WorkspaceSvg.prototype.zoomCenter=function(a){var b=this.getMetrics();this.zoom(b.viewWidth/2,b.viewHeight/2,a)};
Blockly.WorkspaceSvg.prototype.zoomToFit=function(){var a=this.svgBackground_.getBBox(),b=this.svgBlockCanvas_.getBBox(),c=a.width-this.toolbox_.width-Blockly.Scrollbar.scrollbarThickness,a=a.height-Blockly.Scrollbar.scrollbarThickness,d=b.width,b=b.height;if(0!=d){var e=this.options.zoomOptions.scaleSpeed,c=Math.pow(e,Math.floor(Math.log(Math.min(c/d,a/b))/Math.log(e)));c>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale:c<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale);
this.scale=c;this.updateGridPattern_();this.scrollbar.resize();Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();c=this.getMetrics();this.scrollbar.set((c.contentWidth-c.viewWidth)/2,(c.contentHeight-c.viewHeight)/2)}};
Blockly.WorkspaceSvg.prototype.zoomReset=function(a){this.scale=1;this.updateGridPattern_();Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();this.scrollbar&&this.scrollbar.resize();var b=this.getMetrics();this.scrollbar?this.scrollbar.set((b.contentWidth-b.viewWidth)/2,(b.contentHeight-b.viewHeight)/2):this.translate(0,0);a.stopPropagation()};
Blockly.WorkspaceSvg.prototype.scroll=function(a,b){var c=this.startDragMetrics;a=Math.min(a,-c.contentLeft);b=Math.min(b,-c.contentTop);a=Math.max(a,c.viewWidth-c.contentLeft-c.contentWidth);b=Math.max(b,c.viewHeight-c.contentTop-c.contentHeight);this.scrollbar.set(-a-c.contentLeft,-b-c.contentTop)};
this.scale=c;this.updateGridPattern_();this.scrollbar.resize();Blockly.WidgetDiv.hide(!0);Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();c=this.getMetrics();this.scrollbar.set((c.contentWidth-c.viewWidth)/2,(c.contentHeight-c.viewHeight)/2)}};
Blockly.WorkspaceSvg.prototype.zoomReset=function(a){this.scale=1;this.updateGridPattern_();Blockly.WidgetDiv.hide(!0);Blockly.hideChaff(!1);this.flyout_&&this.flyout_.reflow();this.scrollbar&&this.scrollbar.resize();var b=this.getMetrics();this.scrollbar?this.scrollbar.set((b.contentWidth-b.viewWidth)/2,(b.contentHeight-b.viewHeight)/2):this.translate(0,0);a.stopPropagation()};
Blockly.WorkspaceSvg.prototype.scroll=function(a,b){var c=this.startDragMetrics;a=Math.min(a,-c.contentLeft);b=Math.min(b,-c.contentTop);a=Math.max(a,c.viewWidth-c.contentLeft-c.contentWidth);b=Math.max(b,c.viewHeight-c.contentTop-c.contentHeight);Blockly.WidgetDiv.hide(!0);this.scrollbar.set(-a-c.contentLeft,-b-c.contentTop)};
Blockly.WorkspaceSvg.prototype.updateGridPattern_=function(){if(this.options.gridPattern){var a=this.options.gridOptions.spacing*this.scale||100;this.options.gridPattern.setAttribute("width",a);this.options.gridPattern.setAttribute("height",a);var a=Math.floor(this.options.gridOptions.spacing/2)+.5,b=a-this.options.gridOptions.length/2,c=a+this.options.gridOptions.length/2,d=this.options.gridPattern.firstChild,e=d&&d.nextSibling,a=a*this.scale,b=b*this.scale,c=c*this.scale;d&&(d.setAttribute("stroke-width",
this.scale),d.setAttribute("x1",b),d.setAttribute("y1",a),d.setAttribute("x2",c),d.setAttribute("y2",a));e&&(e.setAttribute("stroke-width",this.scale),e.setAttribute("x1",a),e.setAttribute("y1",b),e.setAttribute("x2",a),e.setAttribute("y2",c))}};Blockly.WorkspaceSvg.prototype.setVisible=Blockly.WorkspaceSvg.prototype.setVisible;Blockly.Mutator=function(a){Blockly.Mutator.superClass_.constructor.call(this,null);this.quarkNames_=a};goog.inherits(Blockly.Mutator,Blockly.Icon);Blockly.Mutator.prototype.workspaceWidth_=0;Blockly.Mutator.prototype.workspaceHeight_=0;
Blockly.Mutator.prototype.drawIcon_=function(a){Blockly.createSvgElement("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);Blockly.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},a);
@ -1079,7 +1080,7 @@ Blockly.Block.prototype.getInputWithBlock=function(a){for(var b=0,c;c=this.input
Blockly.Block.prototype.getFirstStatementConnection=function(){for(var a=0,b;b=this.inputList[a];a++)if(b.connection&&b.connection.type==Blockly.NEXT_STATEMENT)return b.connection;return null};Blockly.Block.prototype.getRootBlock=function(){var a,b=this;do a=b,b=a.parentBlock_;while(b);return a};Blockly.Block.prototype.getChildren=function(){return this.childBlocks_};
Blockly.Block.prototype.setParent=function(a){if(a!=this.parentBlock_){if(this.parentBlock_){for(var b=this.parentBlock_.childBlocks_,c,d=0;c=b[d];d++)if(c==this){b.splice(d,1);break}if(this.previousConnection&&this.previousConnection.isConnected())throw"Still connected to previous block.";if(this.outputConnection&&this.outputConnection.isConnected())throw"Still connected to parent block.";this.parentBlock_=null}else this.workspace.removeTopBlock(this);(this.parentBlock_=a)?a.childBlocks_.push(this):
this.workspace.addTopBlock(this)}};Blockly.Block.prototype.getDescendants=function(){for(var a=[this],b,c=0;b=this.childBlocks_[c];c++)a.push.apply(a,b.getDescendants());return a};Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setDeletable=function(a){this.deletable_=a};Blockly.Block.prototype.isMovable=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};
Blockly.Block.prototype.setMovable=function(a){this.movable_=a};Blockly.Block.prototype.isShadow=function(){return this.isShadow_};Blockly.Block.prototype.setShadow=function(a){this.isShadow_=a};Blockly.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};Blockly.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&this.setColour("#949494")};
Blockly.Block.prototype.setMovable=function(a){this.movable_=a};Blockly.Block.prototype.isShadow=function(){return this.isShadow_};Blockly.Block.prototype.setShadow=function(a){this.isShadow_=a};Blockly.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};Blockly.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&(this.setColour(Blockly.Colours.insertionMarker),this.setOpacity(Blockly.Colours.insertionMarkerOpacity))};
Blockly.Block.prototype.isEditable=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setEditable=function(a){this.editable_=a;a=0;for(var b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateEditable()};
Blockly.Block.prototype.setConnectionsHidden=function(a){if(!a&&this.isCollapsed()){if(this.outputConnection&&this.outputConnection.setHidden(a),this.previousConnection&&this.previousConnection.setHidden(a),this.nextConnection){this.nextConnection.setHidden(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionsHidden(a)}}else for(var c=this.getConnections_(!0),d=0;b=c[d];d++)b.setHidden(a),b.isSuperior()&&(b=b.targetBlock())&&b.setConnectionsHidden(a)};
Blockly.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0),d=a.getConnections_(!0);if(c.length!=d.length)throw"Connection lists did not match in length.";for(var e=0;e<d.length;e++)if(d[e]==b)return c[e];return null};Blockly.Block.prototype.setHelpUrl=function(a){this.helpUrl=a};Blockly.Block.prototype.setTooltip=function(a){this.tooltip=a};Blockly.Block.prototype.getColour=function(){return this.colour_};Blockly.Block.prototype.getColourSecondary=function(){return this.colourSecondary_};
@ -1100,8 +1101,8 @@ Blockly.Block.prototype.jsonInit=function(a){goog.asserts.assert(void 0==a.outpu
a.previousStatement);void 0!==a.nextStatement&&this.setNextStatement(!0,a.nextStatement);void 0!==a.tooltip&&this.setTooltip(a.tooltip);void 0!==a.helpUrl&&this.setHelpUrl(a.helpUrl)};
Blockly.Block.prototype.interpolate_=function(a,b,c){var d=Blockly.tokenizeInterpolation(a),e=[],f=0;a=[];for(var g=0;g<d.length;g++){var h=d[g];"number"==typeof h?(goog.asserts.assert(0<h&&h<=b.length,'Message index "%s" out of range.',h),goog.asserts.assert(!e[h],'Message index "%s" duplicated.',h),e[h]=!0,f++,a.push(b[h-1])):(h=h.trim())&&a.push(h)}goog.asserts.assert(f==b.length,"Message does not reference all %s arg(s).",b.length);!a.length||"string"!=typeof a[a.length-1]&&0!=a[a.length-1].type.indexOf("field_")||
(b={type:"input_dummy"},c&&(b.align=c),a.push(b));c={LEFT:Blockly.ALIGN_LEFT,RIGHT:Blockly.ALIGN_RIGHT,CENTRE:Blockly.ALIGN_CENTRE};d=[];for(g=0;g<a.length;g++)if(e=a[g],"string"==typeof e)d.push([e,void 0]);else{b=f=null;do switch(h=!1,e.type){case "input_value":b=this.appendValueInput(e.name);break;case "input_statement":b=this.appendStatementInput(e.name);break;case "input_dummy":b=this.appendDummyInput(e.name);break;case "field_label":f=new Blockly.FieldLabel(e.text,e["class"]);break;case "field_input":f=
new Blockly.FieldTextInput(e.text);"boolean"==typeof e.spellcheck&&f.setSpellcheck(e.spellcheck);break;case "field_angle":f=new Blockly.FieldAngle(e.angle);break;case "field_checkbox":f=new Blockly.FieldCheckbox(e.checked?"TRUE":"FALSE");break;case "field_colour":f=new Blockly.FieldColour(e.colour);break;case "field_variable":f=new Blockly.FieldVariable(e.variable);break;case "field_dropdown":f=new Blockly.FieldDropdown(e.options);break;case "field_image":f=new Blockly.FieldImage(e.src,e.width,e.height,
e.alt,e.flip_rtl);break;case "field_date":if(Blockly.FieldDate){f=new Blockly.FieldDate(e.date);break}default:e.alt&&(e=e.alt,h=!0)}while(h);if(f)d.push([f,e.name]);else if(b){e.check&&b.setCheck(e.check);e.align&&b.setAlign(c[e.align]);for(e=0;e<d.length;e++)b.appendField(d[e][0],d[e][1]);d.length=0}}};
new Blockly.FieldTextInput(e.text);"boolean"==typeof e.spellcheck&&f.setSpellcheck(e.spellcheck);break;case "field_angle":f=new Blockly.FieldAngle(e.angle);break;case "field_checkbox":f=new Blockly.FieldCheckbox(e.checked?"TRUE":"FALSE");break;case "field_colour":f=new Blockly.FieldColour(e.colour);break;case "field_variable":f=new Blockly.FieldVariable(e.variable);break;case "field_dropdown":f=new Blockly.FieldDropdown(e.options);break;case "field_iconmenu":f=new Blockly.FieldIconMenu(e.options);
break;case "field_image":f=new Blockly.FieldImage(e.src,e.width,e.height,e.alt,e.flip_rtl);break;case "field_date":if(Blockly.FieldDate){f=new Blockly.FieldDate(e.date);break}default:e.alt&&(e=e.alt,h=!0)}while(h);if(f)d.push([f,e.name]);else if(b){e.check&&b.setCheck(e.check);e.align&&b.setAlign(c[e.align]);for(e=0;e<d.length;e++)b.appendField(d[e][0],d[e][1]);d.length=0}}};
Blockly.Block.prototype.appendInput_=function(a,b){var c=null;if(a==Blockly.INPUT_VALUE||a==Blockly.NEXT_STATEMENT)c=new Blockly.Connection(this,a);c=new Blockly.Input(a,b,this,c);this.inputList.push(c);return c};
Blockly.Block.prototype.moveInputBefore=function(a,b){if(a!=b){for(var c=-1,d=b?-1:this.inputList.length,e=0,f;f=this.inputList[e];e++)if(f.name==a){if(c=e,-1!=d)break}else if(b&&f.name==b&&(d=e,-1!=c))break;goog.asserts.assert(-1!=c,'Named input "%s" not found.',a);goog.asserts.assert(-1!=d,'Reference input "%s" not found.',b);this.moveNumberedInputBefore(c,d)}};
Blockly.Block.prototype.moveNumberedInputBefore=function(a,b){goog.asserts.assert(a!=b,"Can't move input to itself.");goog.asserts.assert(a<this.inputList.length,"Input index "+a+" out of bounds.");goog.asserts.assert(b<=this.inputList.length,"Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);a<b&&b--;this.inputList.splice(b,0,c)};
@ -1111,21 +1112,25 @@ Blockly.Block.prototype.getRelativeToSurfaceXY=function(){return this.xy_};Block
Blockly.ContextMenu.show=function(a,b,c){Blockly.WidgetDiv.show(Blockly.ContextMenu,c,null);if(b.length){var d=new goog.ui.Menu;d.setRightToLeft(c);for(var e=0,f;f=b[e];e++){var g=new goog.ui.MenuItem(f.text);g.setRightToLeft(c);d.addChild(g,!0);g.setEnabled(f.enabled);f.enabled&&goog.events.listen(g,goog.ui.Component.EventType.ACTION,f.callback)}goog.events.listen(d,goog.ui.Component.EventType.ACTION,Blockly.ContextMenu.hide);b=goog.dom.getViewportSize();f=goog.style.getViewportPageOffset(document);
d.render(Blockly.WidgetDiv.DIV);var h=d.getElement();Blockly.addClass_(h,"blocklyContextMenu");var g=goog.style.getSize(h),e=a.clientX+f.x,k=a.clientY+f.y;a.clientY+g.height>=b.height&&(k-=g.height);c?g.width>=a.clientX&&(e+=g.width):a.clientX+g.width>=b.width&&(e-=g.width);Blockly.WidgetDiv.position(e,k,b,f,c);d.setAllowAutoFocus(!0);setTimeout(function(){h.focus()},1);Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()};
Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu);Blockly.ContextMenu.currentBlock=null};
Blockly.ContextMenu.callbackFactory=function(a,b){return function(){Blockly.Events.disable();var c=Blockly.Xml.domToBlock(a.workspace,b),d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-Blockly.SNAP_RADIUS:d.x+Blockly.SNAP_RADIUS;d.y+=2*Blockly.SNAP_RADIUS;c.moveBy(d.x,d.y);Blockly.Events.enable();Blockly.Events.isEnabled()&&!c.isShadow()&&Blockly.Events.fire(new Blockly.Events.Create(c));c.select()}};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.createSvgElement("g",{},null);this.svgPath_=Blockly.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_);this.svgPath_.tooltip=this;this.rendered=!1;Blockly.Tooltip.bindMouseEvents(this.svgPath_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c)};goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.dragStartXY_=null;
Blockly.BlockSvg.prototype.isGlowing_=!1;Blockly.BlockSvg.INLINE=-1;
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");for(var a=0,b;b=this.inputList[a];a++)b.init();b=this.getIcons();for(a=0;a<b.length;a++)b[a].createIcon();this.updateColour();this.updateMovable();if(!this.workspace.options.readOnly&&!this.eventsInit_){Blockly.bindEvent_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);var c=this;Blockly.bindEvent_(this.getSvgRoot(),"touchstart",null,function(a){Blockly.longStart_(a,c)})}this.eventsInit_=
!0;this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())};Blockly.BlockSvg.prototype.select=function(){if(Blockly.selected!=this){var a=null;Blockly.selected&&(a=Blockly.selected.id,Blockly.Events.disable(),Blockly.selected.unselect(),Blockly.Events.enable());a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")}};
Blockly.ContextMenu.callbackFactory=function(a,b){return function(){Blockly.Events.disable();var c=Blockly.Xml.domToBlock(a.workspace,b),d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-Blockly.SNAP_RADIUS:d.x+Blockly.SNAP_RADIUS;d.y+=2*Blockly.SNAP_RADIUS;c.moveBy(d.x,d.y);Blockly.Events.enable();Blockly.Events.isEnabled()&&!c.isShadow()&&Blockly.Events.fire(new Blockly.Events.Create(c));c.select()}};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.createSvgElement("g",{},null);this.svgPath_=Blockly.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_);this.svgPath_.tooltip=this;this.rendered=!1;Blockly.Tooltip.bindMouseEvents(this.svgPath_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c)};goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.opacity_=1;
Blockly.BlockSvg.prototype.dragStartXY_=null;Blockly.BlockSvg.prototype.isGlowing_=!1;Blockly.BlockSvg.INLINE=-1;
Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");if(!this.isInsertionMarker()){for(var a=0,b;b=this.inputList[a];a++)b.init();b=this.getIcons();for(a=0;a<b.length;a++)b[a].createIcon()}this.updateColour();this.updateMovable();if(!this.workspace.options.readOnly&&!this.eventsInit_){Blockly.bindEvent_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);var c=this;Blockly.bindEvent_(this.getSvgRoot(),"touchstart",null,function(a){Blockly.longStart_(a,
c)})}this.eventsInit_=!0;this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())};
Blockly.BlockSvg.prototype.select=function(){if(Blockly.selected!=this){var a=null;Blockly.selected&&(a=Blockly.selected.id,Blockly.Events.disable(),Blockly.selected.unselect(),Blockly.Events.enable());a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")}};
Blockly.BlockSvg.prototype.unselect=function(){if(Blockly.selected==this){var a=new Blockly.Events.Ui(null,"selected",this.id,null);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=null;this.removeSelect();Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")}};Blockly.BlockSvg.prototype.setGlow=function(a){this.isGlowing_=a;this.updateColour()};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;
Blockly.BlockSvg.prototype.warning=null;Blockly.BlockSvg.prototype.getIcons=function(){var a=[];this.mutator&&a.push(this.mutator);this.comment&&a.push(this.comment);this.warning&&a.push(this.warning);return a};Blockly.BlockSvg.onMouseUpWrapper_=null;Blockly.BlockSvg.onMouseMoveWrapper_=null;
Blockly.BlockSvg.terminateDrag_=function(){Blockly.BlockSvg.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseUpWrapper_),Blockly.BlockSvg.onMouseUpWrapper_=null);Blockly.BlockSvg.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseMoveWrapper_),Blockly.BlockSvg.onMouseMoveWrapper_=null);var a=Blockly.selected;if(Blockly.dragMode_==Blockly.DRAG_FREE&&a){Blockly.insertionMarker_&&(Blockly.Events.disable(),Blockly.insertionMarkerConnection_&&Blockly.BlockSvg.disconnectInsertionMarker(),
Blockly.insertionMarker_.dispose(),Blockly.insertionMarker_=null,Blockly.Events.enable());var b=a.getRelativeToSurfaceXY(),b=goog.math.Coordinate.difference(b,a.dragStartXY_),c=new Blockly.Events.Move(a);c.oldCoordinate=a.dragStartXY_;c.recordNew();Blockly.Events.fire(c);a.moveConnections_(b.x,b.y);delete a.draggedBubbles_;a.setDragging_(!1);a.moveOffDragSurface_();a.render();var d=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(d);a.snapToGrid();Blockly.Events.setGroup(!1)},
Blockly.BUMP_DELAY/2);setTimeout(function(){Blockly.Events.setGroup(d);a.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY);Blockly.fireUiEvent(window,"resize")}Blockly.dragMode_=Blockly.DRAG_NONE;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)};
Blockly.BlockSvg.prototype.setParent=function(a){if(a!=this.parentBlock_){var b=this.getSvgRoot();if(this.parentBlock_&&b){var c=this.getRelativeToSurfaceXY();Blockly.selected!=this&&(this.workspace.getCanvas().appendChild(b),this.translate(c.x,c.y))}Blockly.Field.startCache();Blockly.BlockSvg.superClass_.setParent.call(this,a);Blockly.Field.stopCache();a&&(c=this.getRelativeToSurfaceXY(),a.getSvgRoot().appendChild(b),b=this.getRelativeToSurfaceXY(),this.moveConnections_(b.x-c.x,b.y-c.y),this.isShadow()&&
this.setColour(this.getColour(),this.getColourSecondary(),a.getColourTertiary()))}};Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.workspace.dragSurface?this.workspace.dragSurface.getGroup():null,d=this.getSvgRoot();if(d){do var e=Blockly.getRelativeXY_(d),a=a+e.x,b=b+e.y,d=d.parentNode;while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new goog.math.Coordinate(a,b)};
Blockly.BlockSvg.prototype.moveBy=function(a,b){goog.asserts.assert(!this.parentBlock_,"Block has parent.");var c=new Blockly.Events.Move(this),d=this.getRelativeToSurfaceXY();this.translate(d.x+a,d.y+b);this.moveConnections_(a,b);c.recordNew();Blockly.Events.fire(c)};Blockly.BlockSvg.prototype.translate=function(a,b,c){c?this.getSvgRoot().setAttribute("style","transform: translate3d("+a+"px,"+b+"px, 0px)"):this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};
this.setColour(this.getColour(),this.getColourSecondary(),a.getColourTertiary()))}};
Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.workspace.dragSurface?this.workspace.dragSurface.getGroup():null,d=this.getSvgRoot();if(d){do{var e=Blockly.getRelativeXY_(d),a=a+e.x,b=b+e.y;this.workspace.dragSurface&&this.workspace.dragSurface.getCurrentBlock()==d&&(e=this.workspace.dragSurface.getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new goog.math.Coordinate(a,b)};
Blockly.BlockSvg.prototype.moveBy=function(a,b){goog.asserts.assert(!this.parentBlock_,"Block has parent.");var c=new Blockly.Events.Move(this),d=this.getRelativeToSurfaceXY();this.translate(d.x+a,d.y+b);this.moveConnections_(a,b);c.recordNew();Blockly.Events.fire(c);Blockly.WidgetDiv.hide(!0)};
Blockly.BlockSvg.prototype.translate=function(a,b,c){c?this.getSvgRoot().setAttribute("style","transform: translate3d("+a+"px,"+b+"px, 0px)"):this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};
Blockly.BlockSvg.prototype.snapToGrid=function(){if(this.workspace&&Blockly.dragMode_==Blockly.DRAG_NONE&&!this.getParent()&&!this.isInFlyout&&this.workspace.options.gridOptions&&this.workspace.options.gridOptions.snap){var a=this.workspace.options.gridOptions.spacing,b=a/2,c=this.getRelativeToSurfaceXY(),d=Math.round((c.x-b)/a)*a+b-c.x,a=Math.round((c.y-b)/a)*a+b-c.y,d=Math.round(d),a=Math.round(a);0==d&&0==a||this.moveBy(d,a)}};
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.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(this),b=this.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,c=this.getHeightWidth(),d;this.RTL?(d=new goog.math.Coordinate(a.x-(c.width-b),a.y),a=new goog.math.Coordinate(a.x+b,a.y+c.height)):(d=new goog.math.Coordinate(a.x-b,a.y),a=new goog.math.Coordinate(a.x+c.width-b,a.y+c.height));return{topLeft:d,bottomRight:a}};
Blockly.BlockSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(this),b=this.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,c=this.getHeightWidth(),d;this.RTL?(d=new goog.math.Coordinate(a.x-(c.width-b),a.y),a=new goog.math.Coordinate(a.x+b,a.y+c.height)):(d=new goog.math.Coordinate(a.x-b,a.y),a=new goog.math.Coordinate(a.x+c.width-b,a.y+c.height));return{topLeft:d,bottomRight:a}};Blockly.BlockSvg.prototype.setOpacity=function(a){this.opacity_=a;this.rendered&&this.updateColour()};
Blockly.BlockSvg.prototype.getOpacity=function(){return this.opacity_};
Blockly.BlockSvg.prototype.setCollapsed=function(a){if(this.collapsed_!=a){for(var b=[],c=0,d;d=this.inputList[c];c++)b.push.apply(b,d.setVisible(!a));if(a){d=this.getIcons();for(c=0;c<d.length;c++)d[c].setVisible(!1);c=this.toString(Blockly.COLLAPSE_CHARS);this.appendDummyInput("_TEMP_COLLAPSED_INPUT").appendField(c).init()}else this.removeInput("_TEMP_COLLAPSED_INPUT"),this.setWarningText(null);Blockly.BlockSvg.superClass_.setCollapsed.call(this,a);b.length||(b[0]=this);if(this.rendered)for(c=0;a=
b[c];c++)a.render()}};Blockly.BlockSvg.prototype.tab=function(a,b){for(var c=[],d=0,e;e=this.inputList[d];d++){for(var f=0,g;g=e.fieldRow[f];f++)g instanceof Blockly.FieldTextInput&&c.push(g);e.connection&&(e=e.connection.targetBlock())&&c.push(e)}d=c.indexOf(a);-1==d&&(d=b?-1:c.length);(c=c[b?d+1:d-1])?c instanceof Blockly.Field?c.showEditor_():c.tab(null,b):(c=this.getParent())&&c.tab(this,b)};
Blockly.BlockSvg.prototype.onMouseDown_=function(a){if(!this.workspace.options.readOnly){if(!this.isInFlyout)if(Blockly.setPageSelectable(!1),this.workspace.markFocused(),Blockly.svgResize(this.workspace),Blockly.terminateDrag_(),this.select(),Blockly.hideChaff(),this.workspace.recordDeleteAreas(),Blockly.isRightButton(a))this.showContextMenu_(a);else if(this.isMovable()){Blockly.Events.getGroup()||Blockly.Events.setGroup(!0);Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);this.dragStartXY_=this.getRelativeToSurfaceXY();
@ -1138,14 +1143,14 @@ Blockly.BlockSvg.prototype.showHelp_=function(){var a=goog.isFunction(this.helpU
Blockly.BlockSvg.prototype.showContextMenu_=function(a){if(!this.workspace.options.readOnly&&this.contextMenu){var b=this,c=[];if(this.isDeletable()&&this.isMovable()&&!b.isInFlyout){var d={text:Blockly.Msg.DUPLICATE_BLOCK,enabled:!0,callback:function(){Blockly.duplicate_(b)}};this.getDescendants().length>this.workspace.remainingCapacity()&&(d.enabled=!1);c.push(d);this.isEditable()&&this.workspace.options.comments&&(d={enabled:!goog.userAgent.IE},this.comment?(d.text=Blockly.Msg.REMOVE_COMMENT,d.callback=
function(){b.setCommentText(null)}):(d.text=Blockly.Msg.ADD_COMMENT,d.callback=function(){b.setCommentText("")}),c.push(d));var d=this.getDescendants().length,e=this.getNextBlock();e&&(d-=e.getDescendants().length);d={text:1==d?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",String(d)),enabled:!0,callback:function(){b.dispose(!0,!0)}};c.push(d)}d={enabled:!(goog.isFunction(this.helpUrl)?!this.helpUrl():!this.helpUrl)};d.text=Blockly.Msg.HELP;d.callback=function(){b.showHelp_()};
c.push(d);this.customContextMenu&&!b.isInFlyout&&this.customContextMenu(c);Blockly.ContextMenu.show(a,c,this.RTL);Blockly.ContextMenu.currentBlock=this}};Blockly.BlockSvg.prototype.moveConnections_=function(a,b){if(this.rendered){for(var c=this.getConnections_(!1),d=0;d<c.length;d++)c[d].moveBy(a,b);c=this.getIcons();for(d=0;d<c.length;d++)c[d].computeIconLocation();for(d=0;d<this.childBlocks_.length;d++)this.childBlocks_[d].moveConnections_(a,b)}};
Blockly.BlockSvg.prototype.setDragging_=function(a){a?(this.addDragging(),Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0))):(this.removeDragging(),Blockly.draggingConnections_=[]);for(var b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging_(a)};Blockly.BlockSvg.prototype.moveToDragSurface_=function(){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.translate(a.x,a.y,Blockly.is3dSupported());this.workspace.dragSurface.setBlocksAndShow(this.getSvgRoot())};
Blockly.BlockSvg.prototype.moveOffDragSurface_=function(){this.workspace.dragSurface.clearAndHide(this.workspace.getCanvas());var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.translate(a.x,a.y,!1)};Blockly.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().hasAttribute("transform")&&this.getSvgRoot().removeAttribute("transform");this.getSvgRoot().hasAttribute("style")&&this.getSvgRoot().removeAttribute("style")};
Blockly.BlockSvg.prototype.onMouseMove_=function(a){if(!("mousemove"==a.type&&1>=a.clientX&&0==a.clientY&&0==a.button)){var b=this.getRelativeToSurfaceXY(),c=this.workspace.moveDrag(a);Blockly.dragMode_==Blockly.DRAG_STICKY&&goog.math.Coordinate.distance(b,c)*this.workspace.scale>Blockly.DRAG_RADIUS&&(Blockly.dragMode_=Blockly.DRAG_FREE,Blockly.longStop_(),this.moveToDragSurface_(),this.parentBlock_&&(this.unplug(),this.disconnectUiEffect()),this.setDragging_(!0));if(Blockly.dragMode_==Blockly.DRAG_FREE){var d=
b.x-this.dragStartXY_.x,b=b.y-this.dragStartXY_.y;this.translate(c.x,c.y,Blockly.is3dSupported());for(var e=0;e<this.draggedBubbles_.length;e++){var f=this.draggedBubbles_[e];f.bubble.setIconLocation(f.x+d,f.y+b)}var f=this.getConnections_(!1),g=this.lastConnectionInStack_();g&&g!=this.nextConnection&&f.push(g);for(var h=null,k=null,l=Blockly.SNAP_RADIUS,e=0;e<f.length;e++){var n=f[e],m=n.closest(l,d,b);m.connection&&(h=m.connection,k=n,l=m.radius)}this.updatePreviews(h,k,l,a,c.x-this.dragStartXY_.x,
c.y-this.dragStartXY_.y,k==g)}}a.stopPropagation()};
Blockly.BlockSvg.prototype.setDragging_=function(a){a?(this.addDragging(),Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0))):(this.removeDragging(),Blockly.draggingConnections_=[]);for(var b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging_(a)};Blockly.BlockSvg.prototype.moveToDragSurface_=function(){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.dragSurface.translateSurface(a.x,a.y);this.workspace.dragSurface.setBlocksAndShow(this.getSvgRoot())};
Blockly.BlockSvg.prototype.moveOffDragSurface_=function(){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.translate(a.x,a.y,!1);this.workspace.dragSurface.clearAndHide(this.workspace.getCanvas())};Blockly.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().hasAttribute("transform")&&this.getSvgRoot().removeAttribute("transform");this.getSvgRoot().hasAttribute("style")&&this.getSvgRoot().removeAttribute("style")};
Blockly.BlockSvg.prototype.onMouseMove_=function(a){if(!("mousemove"==a.type&&1>=a.clientX&&0==a.clientY&&0==a.button)){var b=this.getRelativeToSurfaceXY(),c=this.workspace.moveDrag(a);Blockly.dragMode_==Blockly.DRAG_STICKY&&goog.math.Coordinate.distance(b,c)*this.workspace.scale>Blockly.DRAG_RADIUS&&(Blockly.dragMode_=Blockly.DRAG_FREE,Blockly.longStop_(),this.moveToDragSurface_(),Blockly.WidgetDiv.hide(!0),this.parentBlock_&&(this.unplug(),this.disconnectUiEffect()),this.setDragging_(!0));if(Blockly.dragMode_==
Blockly.DRAG_FREE){var d=b.x-this.dragStartXY_.x,b=b.y-this.dragStartXY_.y;this.workspace.dragSurface.translateSurface(c.x,c.y);for(var e=0;e<this.draggedBubbles_.length;e++){var f=this.draggedBubbles_[e];f.bubble.setIconLocation(f.x+d,f.y+b)}var f=this.getConnections_(!1),g=this.lastConnectionInStack_();g&&g!=this.nextConnection&&f.push(g);for(var h=null,k=null,l=Blockly.SNAP_RADIUS,e=0;e<f.length;e++){var n=f[e],m=n.closest(l,d,b);m.connection&&(h=m.connection,k=n,l=m.radius)}this.updatePreviews(h,
k,l,a,c.x-this.dragStartXY_.x,c.y-this.dragStartXY_.y,k==g)}}a.stopPropagation()};
Blockly.BlockSvg.prototype.updatePreviews=function(a,b,c,d,e,f,g){Blockly.Events.disable();if(Blockly.highlightedConnection_&&Blockly.highlightedConnection_!=a){Blockly.insertionMarker_&&Blockly.insertionMarkerConnection_&&Blockly.BlockSvg.disconnectInsertionMarker();if(Blockly.insertionMarker_&&g&&Blockly.localConnection_.sourceBlock_==this||!g&&Blockly.localConnection_.sourceBlock_!=this)Blockly.insertionMarker_.dispose(),Blockly.insertionMarker_=null;Blockly.highlightedConnection_=null;Blockly.localConnection_=
null}if(a&&a!=Blockly.highlightedConnection_&&!a.sourceBlock_.isInsertionMarker()&&(Blockly.highlightedConnection_=a,Blockly.localConnection_=b,Blockly.insertionMarker_||(Blockly.insertionMarker_=this.workspace.newBlock(Blockly.localConnection_.sourceBlock_.type),Blockly.insertionMarker_.setInsertionMarker(!0),Blockly.insertionMarker_.initSvg()),c=Blockly.insertionMarker_,g=c.getMatchingConnection(b.sourceBlock_,b),g!=Blockly.insertionMarkerConnection_)){c.getSvgRoot().setAttribute("visibility","visible");
c.rendered=!0;if(g.type==Blockly.NEXT_STATEMENT){var h=b.sourceBlock_.getRelativeToSurfaceXY();e=a.x_-(b.x_-(h.x-e));b=a.y_-(b.y_-(h.y-f));f=c.getRelativeToSurfaceXY();g!=c.nextConnection&&(b-=a.sourceBlock_.getHeightWidth().height-Blockly.BlockSvg.MIN_BLOCK_Y);c.moveBy(e-f.x,b-f.y)}g.type!=Blockly.PREVIOUS_STATEMENT||c.nextConnection||(Blockly.bumpedConnection_=a.targetConnection);g.connect(a);Blockly.insertionMarkerConnection_=g}Blockly.Events.enable();this.isDeletable()&&this.workspace.isDeleteArea(d)};
null}a&&a!=Blockly.highlightedConnection_&&!a.sourceBlock_.isInsertionMarker()&&(Blockly.highlightedConnection_=a,Blockly.localConnection_=b,Blockly.insertionMarker_||(Blockly.insertionMarker_=this.workspace.newBlock(Blockly.localConnection_.sourceBlock_.type),Blockly.insertionMarker_.setInsertionMarker(!0),Blockly.insertionMarker_.initSvg()),c=Blockly.insertionMarker_,b=c.getMatchingConnection(b.sourceBlock_,b),b!=Blockly.insertionMarkerConnection_&&(c.rendered=!0,c.render(),c.getSvgRoot().setAttribute("visibility",
"visible"),b.type==Blockly.NEXT_STATEMENT&&(e=a.x_-b.x_,f=a.y_-b.y_,b!=c.nextConnection&&(f-=a.sourceBlock_.getHeightWidth().height-Blockly.BlockSvg.MIN_BLOCK_Y),c.moveBy(e,f)),b.type!=Blockly.PREVIOUS_STATEMENT||c.nextConnection||(Blockly.bumpedConnection_=a.targetConnection),b.connect(a),Blockly.insertionMarkerConnection_=b));Blockly.Events.enable();this.isDeletable()&&this.workspace.isDeleteArea(d)};
Blockly.BlockSvg.disconnectInsertionMarker=function(){if(Blockly.insertionMarkerConnection_!=Blockly.insertionMarker_.nextConnection||Blockly.insertionMarker_.previousConnection&&Blockly.insertionMarker_.previousConnection.targetConnection)if(Blockly.insertionMarkerConnection_.type==Blockly.NEXT_STATEMENT&&Blockly.insertionMarkerConnection_!=Blockly.insertionMarker_.nextConnection){var a=Blockly.insertionMarkerConnection_.targetConnection;a.sourceBlock_.unplug(!1);var b=Blockly.insertionMarker_.previousConnection.targetConnection;
Blockly.insertionMarker_.unplug(!0);b&&b.connect(a)}else Blockly.insertionMarker_.unplug(!0);else Blockly.insertionMarkerConnection_.targetBlock().unplug(!1);if(Blockly.insertionMarkerConnection_.targetConnection)throw"insertionMarkerConnection still connected at the end of disconnectInsertionMarker";Blockly.insertionMarkerConnection_=null;Blockly.insertionMarker_.getSvgRoot().setAttribute("visibility","hidden")};
Blockly.BlockSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.addClass_(this.svgGroup_,"blocklyDraggable"):Blockly.removeClass_(this.svgGroup_,"blocklyDraggable")};Blockly.BlockSvg.prototype.setMovable=function(a){Blockly.BlockSvg.superClass_.setMovable.call(this,a);this.updateMovable()};Blockly.BlockSvg.prototype.setEditable=function(a){Blockly.BlockSvg.superClass_.setEditable.call(this,a);if(this.rendered)for(a=0;a<this.icons_.length;a++)this.icons_[a].updateEditable()};
@ -1160,12 +1165,11 @@ Blockly.BlockSvg.prototype.setMutator=function(a){this.mutator&&this.mutator!==a
Blockly.BlockSvg.prototype.removeDragging=function(){Blockly.removeClass_(this.svgGroup_,"blocklyDragging")};Blockly.BlockSvg.prototype.setColour=function(a,b,c){Blockly.BlockSvg.superClass_.setColour.call(this,a,b,c);this.rendered&&this.updateColour()};Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
Blockly.BlockSvg.prototype.setNextStatement=function(a,b){Blockly.BlockSvg.superClass_.setNextStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setOutput=function(a,b){Blockly.BlockSvg.superClass_.setOutput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setInputsInline=function(a){Blockly.BlockSvg.superClass_.setInputsInline.call(this,a);this.rendered&&(this.render(),this.bumpNeighbours_())};
Blockly.BlockSvg.prototype.removeInput=function(a,b){Blockly.BlockSvg.superClass_.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_());return c};Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};Blockly.BlockSvg.render={};Blockly.BlockSvg.SEP_SPACE_X=10;Blockly.BlockSvg.SEP_SPACE_Y=10;Blockly.BlockSvg.INLINE_PADDING_Y=5;Blockly.BlockSvg.MIN_BLOCK_Y=25;Blockly.BlockSvg.TAB_HEIGHT=20;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.NOTCH_WIDTH=30;Blockly.BlockSvg.CORNER_RADIUS=4;Blockly.BlockSvg.START_HAT=!0;Blockly.BlockSvg.START_HAT_PATH="c 30,-15 70,-15 100,0";Blockly.BlockSvg.NOTCH_PATH_LEFT="l 6,4 3,0 6,-4";Blockly.BlockSvg.NOTCH_PATH_RIGHT="l -6,4 -3,0 -6,-4";
Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_());return c};Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};Blockly.BlockSvg.render={};Blockly.BlockSvg.GRID_UNIT=4;Blockly.BlockSvg.SEP_SPACE_X=10;Blockly.BlockSvg.SEP_SPACE_Y=10;Blockly.BlockSvg.INLINE_PADDING_Y=5;Blockly.BlockSvg.MIN_BLOCK_Y=25;Blockly.BlockSvg.TAB_HEIGHT=20;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.NOTCH_WIDTH=30;Blockly.BlockSvg.CORNER_RADIUS=4;Blockly.BlockSvg.START_HAT=!0;Blockly.BlockSvg.START_HAT_PATH="c 30,-15 70,-15 100,0";Blockly.BlockSvg.NOTCH_PATH_LEFT="l 6,4 3,0 6,-4";Blockly.BlockSvg.NOTCH_PATH_RIGHT="l -6,4 -3,0 -6,-4";
Blockly.BlockSvg.TAB_PATH_DOWN="v 5 c 0,10 -"+Blockly.BlockSvg.TAB_WIDTH+",-8 -"+Blockly.BlockSvg.TAB_WIDTH+",7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",-2.5 "+Blockly.BlockSvg.TAB_WIDTH+",7.5";Blockly.BlockSvg.TOP_LEFT_CORNER_START="m 0,"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.TOP_LEFT_CORNER="A "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+",0";
Blockly.BlockSvg.INNER_TOP_LEFT_CORNER=Blockly.BlockSvg.NOTCH_PATH_RIGHT+" h -"+(Blockly.BlockSvg.NOTCH_WIDTH-15-Blockly.BlockSvg.CORNER_RADIUS)+" a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 -"+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;
Blockly.BlockSvg.prototype.connectionUiEffect=function(){this.workspace.playAudio("click");if(!(1>this.workspace.scale)){var a=Blockly.getSvgXY_(this.svgGroup_,this.workspace);this.outputConnection?(a.x+=(this.RTL?3:-3)*this.workspace.scale,a.y+=13*this.workspace.scale):this.previousConnection&&(a.x+=(this.RTL?-23:23)*this.workspace.scale,a.y+=3*this.workspace.scale);a=Blockly.createSvgElement("circle",{cx:a.x,cy:a.y,r:0,fill:"none",stroke:"#888","stroke-width":10},this.workspace.getParentSvg());
Blockly.BlockSvg.connectionUiStep_(a,new Date,this.workspace.scale)}};Blockly.BlockSvg.connectionUiStep_=function(a,b,c){var d=(new Date-b)/150;1<d?goog.dom.removeNode(a):(a.setAttribute("r",25*d*c),a.style.opacity=1-d,Blockly.BlockSvg.disconnectUiStop_.pid_=setTimeout(function(){Blockly.BlockSvg.connectionUiStep_(a,b,c)},10))};
Blockly.BlockSvg.prototype.updateColour=function(){var a=this.getColour(),b=goog.color.hexToRgb(a);this.isShadow()&&(b=goog.color.lighten(b,.6),a=goog.color.rgbArrayToHex(b));this.svgPath_.setAttribute("fill",a);a=goog.color.darken(b,.1);a=goog.color.rgbArrayToHex(a);this.svgPath_.setAttribute("stroke",a);a=this.getIcons();for(b=0;b<a.length;b++)a[b].updateColour();for(a=0;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.setText(null)};
Blockly.BlockSvg.FIELD_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_WIDTH=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.prototype.connectionUiEffect=function(){this.workspace.playAudio("click")};
Blockly.BlockSvg.prototype.updateColour=function(){var a=this.getColour(),b=goog.color.hexToRgb(a);this.isShadow()&&(b=goog.color.lighten(b,.6),a=goog.color.rgbArrayToHex(b));this.svgPath_.setAttribute("fill",a);this.svgPath_.setAttribute("fill-opacity",this.getOpacity());a=goog.color.darken(b,.1);a=goog.color.rgbArrayToHex(a);this.svgPath_.setAttribute("stroke",a);a=this.getIcons();for(b=0;b<a.length;b++)a[b].updateColour();for(a=0;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.setText(null)};
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.render=function(a){Blockly.Field.startCache();this.rendered=!0;var b=Blockly.BlockSvg.SEP_SPACE_X;this.RTL&&(b=-b);for(var c=this.getIcons(),d=0;d<c.length;d++)b=c[d].renderIcon(b);b+=this.RTL?Blockly.BlockSvg.SEP_SPACE_X:-Blockly.BlockSvg.SEP_SPACE_X;c=this.renderCompute_(b);this.renderDraw_(b,c);!1!==a&&((a=this.getParent())?a.render(!0):Blockly.fireUiEvent(window,"resize"));Blockly.Field.stopCache()};
Blockly.BlockSvg.prototype.renderFields_=function(a,b,c){c+=Blockly.BlockSvg.INLINE_PADDING_Y;this.RTL&&(b=-b);for(var d=0,e;e=a[d];d++){var f=e.getSvgRoot();f&&(this.RTL?(b-=e.renderSep+e.renderWidth,f.setAttribute("transform","translate("+b+","+c+")"),e.renderWidth&&(b-=Blockly.BlockSvg.SEP_SPACE_X)):(f.setAttribute("transform","translate("+(b+e.renderSep)+","+c+")"),e.renderWidth&&(b+=e.renderSep+e.renderWidth+Blockly.BlockSvg.SEP_SPACE_X)))}return this.RTL?-b:b};
@ -1243,7 +1247,8 @@ Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.pr
Blockly.FieldDropdown.prototype.getOptions_=function(){return goog.isFunction(this.menuGenerator_)?this.menuGenerator_.call(this):this.menuGenerator_};Blockly.FieldDropdown.prototype.getValue=function(){return this.value_};
Blockly.FieldDropdown.prototype.setValue=function(a){if(null!==a&&a!==this.value_){this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.value_,a));this.value_=a;for(var b=this.getOptions_(),c=0;c<b.length;c++)if(b[c][1]==a){this.setText(b[c][0]);return}this.setText(a)}};
Blockly.FieldDropdown.prototype.setText=function(a){this.sourceBlock_&&this.arrow_&&(this.arrow_.style.fill=this.sourceBlock_.getColour());null!==a&&a!==this.text_&&(this.text_=a,this.updateTextNode_(),this.textElement_&&(this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textElement_.firstChild):this.textElement_.appendChild(this.arrow_)),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()))};
Blockly.FieldDropdown.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this);Blockly.FieldDropdown.superClass_.dispose.call(this)};Blockly.FieldImage=function(a,b,c,d,e){this.sourceBlock_=null;this.height_=Number(c);this.width_=Number(b);this.size_=new goog.math.Size(this.width_,this.height_);this.text_=d||"";this.flipRTL_=e;this.setValue(a)};goog.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.prototype.rectElement_=null;Blockly.FieldImage.prototype.EDITABLE=!1;
Blockly.FieldDropdown.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this);Blockly.FieldDropdown.superClass_.dispose.call(this)};Blockly.DropDownDiv=function(){};Blockly.DropDownDiv.prototype.container_=null;Blockly.DropDownDiv.prototype.DIV_=null;Blockly.DropDownDiv.prototype.boundsElement_=null;Blockly.DropDownDiv.prototype.createDom=function(a){this.DIV_||(this.DIV_=goog.dom.createDom("div","blocklyDropDownDiv"),a.appendChild(this.DIV_),this.content_=goog.dom.createDom("div","blocklyDropDownContent"),this.DIV_.appendChild(this.content))};Blockly.DropDownDiv.prototype.setBoundsElement=function(a){this.boundsElement_=a};
Blockly.DropDownDiv.prototype.getContentDiv=function(){return this.content_};Blockly.DropDownDiv.prototype.place=function(a,b){this.DIV_.top=a+"px";this.DIV_.left=b+"px"};Blockly.DropDownDiv.prototype.destroy=function(){this.container_.removeChild(this.DIV_);this.DIV_=null};Blockly.FieldIconMenu=function(a){Blockly.FieldTextInput.superClass_.constructor.call(this)};goog.inherits(Blockly.FieldTextInput,Blockly.Field);Blockly.FieldIconMenu.prototype.dispose=function(){Blockly.FieldIconMenu.superClass_.dispose.call(this)};Blockly.FieldIconMenu.prototype.setValue=function(a){null!==a&&Blockly.Field.prototype.setValue.call(this,a)};Blockly.FieldIconMenu.prototype.showEditor_=function(){};Blockly.FieldImage=function(a,b,c,d,e){this.sourceBlock_=null;this.height_=Number(c);this.width_=Number(b);this.size_=new goog.math.Size(this.width_,this.height_);this.text_=d||"";this.flipRTL_=e;this.setValue(a)};goog.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.prototype.rectElement_=null;Blockly.FieldImage.prototype.EDITABLE=!1;
Blockly.FieldImage.prototype.init=function(a){this.sourceBlock_||(this.sourceBlock_=a,this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.imageElement_=Blockly.createSvgElement("image",{height:this.height_+"px",width:this.width_+"px"},this.fieldGroup_),this.setValue(this.src_),goog.userAgent.GECKO&&(this.rectElement_=Blockly.createSvgElement("rect",{height:this.height_+"px",width:this.width_+"px","fill-opacity":0},this.fieldGroup_)),a.getSvgRoot().appendChild(this.fieldGroup_),
a=this.rectElement_||this.imageElement_,a.tooltip=this.sourceBlock_,Blockly.Tooltip.bindMouseEvents(a))};Blockly.FieldImage.prototype.dispose=function(){goog.dom.removeNode(this.fieldGroup_);this.rectElement_=this.imageElement_=this.fieldGroup_=null};Blockly.FieldImage.prototype.setTooltip=function(a){(this.rectElement_||this.imageElement_).tooltip=a};Blockly.FieldImage.prototype.getValue=function(){return this.src_};
Blockly.FieldImage.prototype.setValue=function(a){null!==a&&(this.src_=a,this.imageElement_&&this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",goog.isString(a)?a:""))};Blockly.FieldImage.prototype.getFlipRTL=function(){return this.flipRTL_};Blockly.FieldImage.prototype.setText=function(a){null!==a&&(this.text_=a)};Blockly.FieldImage.prototype.render_=function(){};Blockly.Variables={};Blockly.Variables.NAME_TYPE="VARIABLE";Blockly.Variables.allVariables=function(a){var b;if(a.getDescendants)b=a.getDescendants();else if(a.getAllBlocks)b=a.getAllBlocks();else throw"Not Block or Workspace: "+a;a=Object.create(null);for(var c=0;c<b.length;c++)for(var d=b[c].getVars(),e=0;e<d.length;e++){var f=d[e];f&&(a[f.toLowerCase()]=f)}b=[];for(var g in a)b.push(a[g]);return b};
@ -1271,12 +1276,13 @@ Blockly.Procedures.flyoutCategory=function(a){function b(a,b){for(var d=0;d<a.le
d.setAttribute("gap",16);c.push(d)}Blockly.Blocks.procedures_defreturn&&(d=goog.dom.createDom("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap",16),c.push(d));Blockly.Blocks.procedures_ifreturn&&(d=goog.dom.createDom("block"),d.setAttribute("type","procedures_ifreturn"),d.setAttribute("gap",16),c.push(d));c.length&&c[c.length-1].setAttribute("gap",24);a=Blockly.Procedures.allProcedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c};
Blockly.Procedures.getCallers=function(a,b){for(var c=[],d=b.getAllBlocks(),e=0;e<d.length;e++)if(d[e].getProcedureCall){var f=d[e].getProcedureCall();f&&Blockly.Names.equals(f,a)&&c.push(d[e])}return c};Blockly.Procedures.disposeCallers=function(a,b){for(var c=Blockly.Procedures.getCallers(a,b),d=0;d<c.length;d++)c[d].dispose(!0,!1)};
Blockly.Procedures.mutateCallers=function(a){var b=Blockly.Events.recordUndo,c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=Blockly.Procedures.getCallers(c,a.workspace);for(var c=0,e;e=a[c];c++){var f=e.mutationToDom(),f=f&&Blockly.Xml.domToText(f);e.domToMutation(d);var g=e.mutationToDom(),g=g&&Blockly.Xml.domToText(g);f!=g&&(Blockly.Events.recordUndo=!1,Blockly.Events.fire(new Blockly.Events.Change(e,"mutation",null,f,g)),Blockly.Events.recordUndo=b)}};
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getAllBlocks(),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.Flyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);this.RTL=!!a.RTL;this.horizontalLayout_=a.horizontalLayout;this.toolboxPosition_=a.toolboxPosition;this.workspace_=new Blockly.WorkspaceSvg(a);this.workspace_.isFlyout=!0;this.eventWrappers_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[]};Blockly.Flyout.prototype.autoClose=!0;Blockly.Flyout.prototype.CORNER_RADIUS=8;Blockly.Flyout.prototype.SCROLLBAR_PADDING=2;
Blockly.Flyout.prototype.width_=0;Blockly.Flyout.prototype.height_=0;Blockly.Flyout.prototype.verticalOffset_=0;Blockly.Flyout.prototype.dragAngleRange_=70;Blockly.Flyout.prototype.createDom=function(){this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyFlyout"},null);this.svgBackground_=Blockly.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_);this.svgGroup_.appendChild(this.workspace_.createDom());return this.svgGroup_};
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getAllBlocks(),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.Flyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);this.RTL=!!a.RTL;this.horizontalLayout_=a.horizontalLayout;this.toolboxPosition_=a.toolboxPosition;this.workspace_=new Blockly.WorkspaceSvg(a);this.workspace_.isFlyout=!0;this.eventWrappers_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[]};Blockly.Flyout.prototype.autoClose=!0;Blockly.Flyout.prototype.CORNER_RADIUS=0;Blockly.Flyout.prototype.BLOCK_MARGIN=8;
Blockly.Flyout.prototype.SCROLLBAR_PADDING=2;Blockly.Flyout.prototype.width_=0;Blockly.Flyout.prototype.height_=0;Blockly.Flyout.prototype.contentWidth_=0;Blockly.Flyout.prototype.contentHeight_=0;Blockly.Flyout.prototype.verticalOffset_=0;Blockly.Flyout.prototype.dragAngleRange_=70;
Blockly.Flyout.prototype.createDom=function(){this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyFlyout"},null);this.svgBackground_=Blockly.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_);this.svgGroup_.appendChild(this.workspace_.createDom());return this.svgGroup_};
Blockly.Flyout.prototype.init=function(a){this.targetWorkspace_=a;this.workspace_.targetWorkspace=a;this.scrollbar_=new Blockly.Scrollbar(this.workspace_,this.horizontalLayout_,!1);this.hide();Array.prototype.push.apply(this.eventWrappers_,Blockly.bindEvent_(this.svgGroup_,"wheel",this,this.wheel_));this.autoClose||(this.filterWrapper_=this.filterForCapacity_.bind(this),this.targetWorkspace_.addChangeListener(this.filterWrapper_));Array.prototype.push.apply(this.eventWrappers_,Blockly.bindEvent_(this.svgGroup_,
"mousedown",this,this.onMouseDown_))};
Blockly.Flyout.prototype.dispose=function(){this.hide();Blockly.unbindEvent_(this.eventWrappers_);this.filterWrapper_&&(this.targetWorkspace_.removeChangeListener(this.filterWrapper_),this.filterWrapper_=null);this.scrollbar_&&(this.scrollbar_.dispose(),this.scrollbar_=null);this.workspace_&&(this.workspace_.targetWorkspace=null,this.workspace_.dispose(),this.workspace_=null);this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.targetWorkspace_=this.svgBackground_=null};
Blockly.Flyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;try{var a=this.workspace_.getCanvas().getBBox()}catch(e){a={height:0,y:0}}var b=this.verticalOffset_+this.SCROLLBAR_PADDING;if(this.horizontalLayout_){this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(b=0);var c=this.height_,d=this.width_-2*this.SCROLLBAR_PADDING}else c=this.height_-2*this.SCROLLBAR_PADDING,d=this.width_;return{viewHeight:c,viewWidth:d,contentHeight:a.height*this.workspace_.scale,contentWidth:a.width*
Blockly.Flyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;try{var a=this.workspace_.getCanvas().getBBox()}catch(e){a={height:0,y:0}}var b=this.verticalOffset_+this.SCROLLBAR_PADDING;if(this.horizontalLayout_){this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(b=0);var c=this.height_,d=this.width_-2*this.SCROLLBAR_PADDING}else c=this.height_-2*this.SCROLLBAR_PADDING,d=this.width_;return{viewHeight:c,viewWidth:d,contentHeight:this.contentHeight_*this.workspace_.scale,contentWidth:this.contentWidth_*
this.workspace_.scale,viewTop:-this.workspace_.scrollY,viewLeft:-this.workspace_.scrollX,contentTop:a.y,contentLeft:0,absoluteTop:b,absoluteLeft:this.SCROLLBAR_PADDING}};
Blockly.Flyout.prototype.setMetrics_=function(a){var b=this.getMetrics_();b&&(!this.horizontalLayout_&&goog.isNumber(a.y)?this.workspace_.scrollY=-b.contentHeight*a.y-b.contentTop:this.horizontalLayout_&&goog.isNumber(a.x)&&(this.workspace_.scrollX=this.RTL?-b.contentWidth*a.x+b.contentLeft:-b.contentWidth*a.x-b.contentLeft),this.workspace_.translate(this.horizontalLayout_&&this.RTL?b.absoluteLeft+b.viewWidth-this.workspace_.scrollX:this.workspace_.scrollX+b.absoluteLeft,this.workspace_.scrollY+b.absoluteTop))};
Blockly.Flyout.prototype.setVerticalOffset=function(a){this.verticalOffset_=a};
@ -1288,10 +1294,10 @@ Blockly.Flyout.prototype.setBackgroundPathHorizontal_=function(a,b){var c=this.t
-this.CORNER_RADIUS),d.push("h",a-this.CORNER_RADIUS),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("v",b-this.CORNER_RADIUS),d.push("h",-a-this.CORNER_RADIUS));d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))};Blockly.Flyout.prototype.scrollToStart=function(){this.scrollbar_.set(this.horizontalLayout_&&this.RTL?1E9:0)};
Blockly.Flyout.prototype.wheel_=function(a){if(!this.horizontalLayout_){var b=a.deltaY;if(b){goog.userAgent.GECKO&&(b*=10);var c=this.getMetrics_(),b=c.viewTop+b,b=Math.min(b,c.contentHeight-c.viewHeight),b=Math.max(b,0);this.scrollbar_.set(b);a.preventDefault();a.stopPropagation()}}};Blockly.Flyout.prototype.isVisible=function(){return this.svgGroup_&&"block"==this.svgGroup_.style.display};
Blockly.Flyout.prototype.hide=function(){if(this.isVisible()){this.svgGroup_.style.display="none";for(var a=0,b;b=this.listeners_[a];a++)Blockly.unbindEvent_(b);this.listeners_.length=0;this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)}};
Blockly.Flyout.prototype.show=function(a){this.hide();for(var b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)d.workspace==this.workspace_&&d.dispose(!1,!1);for(var c=0,e;e=this.buttons_[c];c++)goog.dom.removeNode(e);this.buttons_.length=0;a==Blockly.Variables.NAME_TYPE?a=Blockly.Variables.flyoutCategory(this.workspace_.targetWorkspace):a==Blockly.Procedures.NAME_TYPE&&(a=Blockly.Procedures.flyoutCategory(this.workspace_.targetWorkspace));for(var f=this.CORNER_RADIUS,b=[],g=[],c=this.permanentlyDisabled_.length=
0;e=a[c];c++)e.tagName&&"BLOCK"==e.tagName.toUpperCase()&&(d=Blockly.Xml.domToBlock(this.workspace_,e),d.disabled&&this.permanentlyDisabled_.push(d),b.push(d),d=parseInt(e.getAttribute("gap"),10),g.push(isNaN(d)?3*f:d));this.svgGroup_.style.opacity=0;this.svgGroup_.style.display="block";a=f/this.workspace_.scale+Blockly.BlockSvg.TAB_WIDTH;for(c=0;d=b[c];c++){e=d.getDescendants();for(var h=0,k;k=e[h];h++)k.isInFlyout=!0;d.render();h=d.getSvgRoot();e=d.getHeightWidth();d.moveBy(this.horizontalLayout_&&
this.RTL?-a:a,f);this.horizontalLayout_?a+=e.width+g[c]:f+=e.height+g[c];e=Blockly.createSvgElement("rect",{"fill-opacity":0},null);this.workspace_.getCanvas().insertBefore(e,d.getSvgRoot());d.flyoutRect_=e;this.buttons_[c]=e;this.addBlockListeners_(h,d,e)}this.listeners_.push(Blockly.bindEvent_(this.svgBackground_,"mouseover",this,function(a){a=this.workspace_.getTopBlocks(!1);for(var b=0,c;c=a[b];b++)c.removeSelect()}));this.horizontalLayout_?this.height_=0:this.width_=0;this.reflow();this.filterForCapacity_();
Blockly.fireUiEventNow(window,"resize");this.reflowWrapper_=this.reflow.bind(this);this.workspace_.addChangeListener(this.reflowWrapper_)};
Blockly.Flyout.prototype.show=function(a){this.hide();for(var b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)d.workspace==this.workspace_&&d.dispose(!1,!1);for(var c=0,e;e=this.buttons_[c];c++)goog.dom.removeNode(e);this.buttons_.length=0;a==Blockly.Variables.NAME_TYPE?a=Blockly.Variables.flyoutCategory(this.workspace_.targetWorkspace):a==Blockly.Procedures.NAME_TYPE&&(a=Blockly.Procedures.flyoutCategory(this.workspace_.targetWorkspace));for(var f=this.BLOCK_MARGIN,b=[],g=[],c=this.permanentlyDisabled_.length=
0,h;h=a[c];c++)h.tagName&&"BLOCK"==h.tagName.toUpperCase()&&(d=Blockly.Xml.domToBlock(this.workspace_,h),d.disabled&&this.permanentlyDisabled_.push(d),b.push(d),d=parseInt(h.getAttribute("gap"),10),g.push(isNaN(d)?3*f:d));this.svgGroup_.style.opacity=0;this.svgGroup_.style.display="block";a=f/this.workspace_.scale+Blockly.BlockSvg.TAB_WIDTH;var k=0,l=0;h=a;for(var n=f,c=0;d=b[c];c++){e=d.getDescendants();for(k=0;l=e[k];k++)l.isInFlyout=!0;d.render();var m=d.getSvgRoot();e=d.getHeightWidth();d.moveBy(this.horizontalLayout_&&
this.RTL?-h:h,n);k=h+e.width+a;l=n+e.height+f;this.horizontalLayout_?h+=e.width+g[c]:n+=e.height+g[c];e=Blockly.createSvgElement("rect",{"fill-opacity":0},null);this.workspace_.getCanvas().insertBefore(e,d.getSvgRoot());d.flyoutRect_=e;this.buttons_[c]=e;this.addBlockListeners_(m,d,e)}this.contentWidth_=k;this.contentHeight_=l;this.listeners_.push(Blockly.bindEvent_(this.svgBackground_,"mouseover",this,function(a){a=this.workspace_.getTopBlocks(!1);for(var b=0,c;c=a[b];b++)c.removeSelect()}));this.horizontalLayout_?
this.height_=0:this.width_=0;this.reflow();this.filterForCapacity_();Blockly.fireUiEventNow(window,"resize");this.reflowWrapper_=this.reflow.bind(this);this.workspace_.addChangeListener(this.reflowWrapper_)};
Blockly.Flyout.prototype.addBlockListeners_=function(a,b,c){this.autoClose?this.listeners_.push(Blockly.bindEvent_(a,"mousedown",null,this.createBlockFunc_(b))):this.listeners_.push(Blockly.bindEvent_(a,"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push(Blockly.bindEvent_(a,"mouseover",b,b.addSelect));this.listeners_.push(Blockly.bindEvent_(a,"mouseout",b,b.removeSelect));this.listeners_.push(Blockly.bindEvent_(c,"mousedown",null,this.createBlockFunc_(b)));this.listeners_.push(Blockly.bindEvent_(c,
"mouseover",b,b.addSelect));this.listeners_.push(Blockly.bindEvent_(c,"mouseout",b,b.removeSelect))};
Blockly.Flyout.prototype.blockMouseDown_=function(a){var b=this;return function(c){Blockly.terminateDrag_();Blockly.hideChaff();Blockly.isRightButton(c)?a.showContextMenu_(c):(Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),b.startDragMouseY_=c.clientY,b.startDragMouseX_=c.clientX,Blockly.Flyout.startDownEvent_=c,Blockly.Flyout.startBlock_=a,Blockly.Flyout.startFlyout_=b,Blockly.Flyout.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,Blockly.terminateDrag_),Blockly.Flyout.onMouseMoveBlockWrapper_=
@ -1300,16 +1306,17 @@ Blockly.Flyout.prototype.onMouseDown_=function(a){Blockly.isRightButton(a)||(Blo
Blockly.Flyout.prototype.onMouseMove_=function(a){if(this.horizontalLayout_){var b=a.clientX-this.startDragMouseX_;this.startDragMouseX_=a.clientX;a=this.getMetrics_();b=a.viewLeft-b;b=Math.min(b,a.contentWidth-a.viewWidth)}else b=a.clientY-this.startDragMouseY_,this.startDragMouseY_=a.clientY,a=this.getMetrics_(),b=a.viewTop-b,b=Math.min(b,a.contentHeight-a.viewHeight);b=Math.max(b,0);this.scrollbar_.set(b)};
Blockly.Flyout.prototype.onMouseMoveBlock_=function(a){if(!("mousemove"==a.type&&1>=a.clientX&&0==a.clientY&&0==a.button)){var b=a.clientX-Blockly.Flyout.startDownEvent_.clientX,c=a.clientY-Blockly.Flyout.startDownEvent_.clientY;if(Blockly.Flyout.startFlyout_.isDragTowardWorkspace_(b,c)&&Math.sqrt(b*b+c*c)>Blockly.DRAG_RADIUS)Blockly.Flyout.startFlyout_.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_);else Blockly.Flyout.startFlyout_.onMouseMove_(a)}a.stopPropagation()};
Blockly.Flyout.prototype.isDragTowardWorkspace_=function(a,b){var c=Math.atan2(b,a)/Math.PI*180,d=!1,e=Blockly.Flyout.startFlyout_.dragAngleRange_;if(Blockly.Flyout.startFlyout_.horizontalLayout_)Blockly.Flyout.startFlyout_.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?c<90+e&&c>90-e&&(d=!0):c>-90-e&&c<-90+e&&(d=!0);else if(Blockly.Flyout.startFlyout_.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT)c<e&&c>-e&&(d=!0);else if(c<-180+e||c>180-e)d=!0;return d};
Blockly.Flyout.prototype.createBlockFunc_=function(a){var b=this,c=this.targetWorkspace_;return function(d){if(!Blockly.isRightButton(d)&&!a.disabled){Blockly.Events.disable();var e=Blockly.Xml.blockToDom(a),e=Blockly.Xml.domToBlock(c,e),f=a.getSvgRoot();if(!f)throw"originBlock is not rendered.";f=Blockly.getSvgXY_(f,c);if(b.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT){var g=c.getMetrics().viewWidth-b.width_;f.x+=g/c.scale-g}else f.x+=b.workspace_.scrollX/b.workspace_.scale-b.workspace_.scrollX;f.y+=
b.workspace_.scrollY/b.workspace_.scale-b.workspace_.scrollY;g=e.getSvgRoot();if(!g)throw"block is not rendered.";g=Blockly.getSvgXY_(g,c);g.x+=c.scrollX/c.scale-c.scrollX;g.y+=c.scrollY/c.scale-c.scrollY;c.toolbox_&&!c.scrollbar&&(g.x+=c.toolbox_.width/c.scale);e.moveBy(f.x-g.x,f.y-g.y);Blockly.Events.enable();Blockly.Events.isEnabled()&&(Blockly.Events.setGroup(!0),Blockly.Events.fire(new Blockly.Events.Create(e)));b.autoClose?b.hide():b.filterForCapacity_();e.onMouseDown_(d);Blockly.dragMode_=
Blockly.DRAG_FREE;e.setDragging_(!0);e.moveToDragSurface_()}}};Blockly.Flyout.prototype.filterForCapacity_=function(){for(var a=this.targetWorkspace_.remainingCapacity(),b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)if(-1==this.permanentlyDisabled_.indexOf(d)){var e=d.getDescendants();d.setDisabled(e.length>a)}};
Blockly.Flyout.prototype.createBlockFunc_=function(a){var b=this,c=this.targetWorkspace_;return function(d){if(!Blockly.isRightButton(d)&&!a.disabled){Blockly.Events.disable();var e=Blockly.Flyout.placeNewBlock_(a,c,b);Blockly.Events.enable();Blockly.Events.isEnabled()&&(Blockly.Events.setGroup(!0),Blockly.Events.fire(new Blockly.Events.Create(e)));b.autoClose?b.hide():b.filterForCapacity_();e.onMouseDown_(d);Blockly.dragMode_=Blockly.DRAG_FREE;e.setDragging_(!0);e.moveToDragSurface_()}}};
Blockly.Flyout.placeNewBlock_=function(a,b,c){var d=a.getSvgRoot();if(!d)throw"originBlock is not rendered.";var d=Blockly.getSvgXY_(d,b),e=c.workspace_.scrollX,f=c.workspace_.scale;d.x+=e/f-e;c.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT&&(e=b.getMetrics().viewWidth-c.width_,f=b.scale,d.x+=e/f-e);e=c.workspace_.scrollY;f=c.workspace_.scale;d.y+=e/f-e;c.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(e=b.getMetrics().viewHeight-c.height_,f=b.scale,d.y+=e/f-e);a=Blockly.Xml.blockToDom(a);a=Blockly.Xml.domToBlock(b,
a);c=a.getSvgRoot();if(!c)throw"block is not rendered.";c=Blockly.getSvgXY_(c,b);c.x+=b.scrollX/b.scale-b.scrollX;c.y+=b.scrollY/b.scale-b.scrollY;b.toolbox_&&!b.scrollbar&&(c.x+=b.toolbox_.width/b.scale,c.y+=b.toolbox_.height/b.scale);a.moveBy(d.x-c.x,d.y-c.y);return a};
Blockly.Flyout.prototype.filterForCapacity_=function(){for(var a=this.targetWorkspace_.remainingCapacity(),b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)if(-1==this.permanentlyDisabled_.indexOf(d)){var e=d.getDescendants();d.setDisabled(e.length>a)}};
Blockly.Flyout.prototype.getClientRect=function(){var a=this.svgGroup_.getBoundingClientRect(),b=a.left,c=a.top,d=a.width,a=a.height;return this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?new goog.math.Rect(-1E9,c-1E9,2E9,1E9+a):this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM?new goog.math.Rect(-1E9,c+this.verticalOffset_,2E9,1E9+a):this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?new goog.math.Rect(b-1E9,-1E9,1E9+d,2E9):new goog.math.Rect(b,-1E9,1E9+d,2E9)};
Blockly.Flyout.terminateDrag_=function(){Blockly.Flyout.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),Blockly.Flyout.onMouseUpWrapper_=null);Blockly.Flyout.onMouseMoveBlockWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveBlockWrapper_),Blockly.Flyout.onMouseMoveBlockWrapper_=null);Blockly.Flyout.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveWrapper_),Blockly.Flyout.onMouseMoveWrapper_=null);Blockly.Flyout.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),
Blockly.Flyout.onMouseUpWrapper_=null);Blockly.Flyout.startDownEvent_=null;Blockly.Flyout.startBlock_=null;Blockly.Flyout.startFlyout_=null};
Blockly.Flyout.prototype.reflowHorizontal=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.CORNER_RADIUS,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++)e=e.getHeightWidth().height,a=Math.max(a,e);a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.height_!=a){for(d=0;e=c[d];d++)if(b=e.getHeightWidth(),e.flyoutRect_){e.flyoutRect_.setAttribute("width",b.width);e.flyoutRect_.setAttribute("height",b.height);var f=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:
Blockly.Flyout.prototype.reflowHorizontal=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.BLOCK_MARGIN,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++)e=e.getHeightWidth().height,a=Math.max(a,e);a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.height_!=a){for(d=0;e=c[d];d++)if(b=e.getHeightWidth(),e.flyoutRect_){e.flyoutRect_.setAttribute("width",b.width);e.flyoutRect_.setAttribute("height",b.height);var f=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:
0,g=e.getRelativeToSurfaceXY();e.flyoutRect_.setAttribute("y",g.y);e.flyoutRect_.setAttribute("x",this.RTL?g.x-b.width+f:g.x-f)}this.height_=a}};
Blockly.Flyout.prototype.reflowVertical=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.CORNER_RADIUS,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++){var f=e.getHeightWidth().width;e.outputConnection&&(f-=Blockly.BlockSvg.TAB_WIDTH);a=Math.max(a,f)}a+=Blockly.BlockSvg.TAB_WIDTH;a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.width_!=a){for(d=0;e=c[d];d++){f=e.getHeightWidth();if(this.RTL){var g=e.getRelativeToSurfaceXY().x,h=a-b,
h=h/this.workspace_.scale,h=h-Blockly.BlockSvg.TAB_WIDTH;e.moveBy(h-g,0)}e.flyoutRect_&&(e.flyoutRect_.setAttribute("width",f.width),e.flyoutRect_.setAttribute("height",f.height),g=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,h=e.getRelativeToSurfaceXY(),e.flyoutRect_.setAttribute("x",this.RTL?h.x-f.width+g:h.x-g),e.flyoutRect_.setAttribute("y",h.y))}this.width_=a}};
Blockly.Flyout.prototype.reflowVertical=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.BLOCK_MARGIN,c=this.workspace_.getTopBlocks(!1),d=0,e;e=c[d];d++){var f=e.getHeightWidth().width;e.outputConnection&&(f-=Blockly.BlockSvg.TAB_WIDTH);a=Math.max(a,f)}a+=Blockly.BlockSvg.TAB_WIDTH;a*=this.workspace_.scale;a+=1.5*b+Blockly.Scrollbar.scrollbarThickness;if(this.width_!=a){for(d=0;e=c[d];d++){f=e.getHeightWidth();if(this.RTL){var g=e.getRelativeToSurfaceXY().x,h=a-b,h=
h/this.workspace_.scale,h=h-Blockly.BlockSvg.TAB_WIDTH;e.moveBy(h-g,0)}e.flyoutRect_&&(e.flyoutRect_.setAttribute("width",f.width),e.flyoutRect_.setAttribute("height",f.height),g=e.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,h=e.getRelativeToSurfaceXY(),e.flyoutRect_.setAttribute("x",this.RTL?h.x-f.width+g:h.x-g),e.flyoutRect_.setAttribute("y",h.y))}this.width_=a}};
Blockly.Flyout.prototype.reflow=function(){this.horizontalLayout_?this.reflowHorizontal():this.reflowVertical();Blockly.fireUiEvent(window,"resize")};Blockly.Toolbox=function(a){this.workspace_=a;this.iconic_=!1;this.RTL=a.options.RTL;this.horizontalLayout_=a.options.horizontalLayout;this.toolboxPosition=a.options.toolboxPosition;this.config_={indentWidth:19,cssRoot:"blocklyTreeRoot",cssHideRoot:"blocklyHidden",cssItem:"",cssTreeRow:"blocklyTreeRow",cssItemLabel:"blocklyTreeLabel",cssTreeIcon:"blocklyTreeIcon",cssExpandedFolderIcon:"blocklyTreeIconOpen",cssFileIcon:"blocklyTreeIconNone",cssSelectedRow:"blocklyTreeSelected"};this.treeSeparatorConfig_=
{cssTreeRow:"blocklyTreeSeparator"};this.horizontalLayout_&&(this.config_.cssTreeRow+=a.RTL?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.treeSeparatorConfig_.cssTreeRow="blocklyTreeSeparatorHorizontal"+(a.RTL?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree"),this.config_.cssTreeIcon="")};Blockly.Toolbox.prototype.width=0;Blockly.Toolbox.prototype.height=0;Blockly.Toolbox.prototype.selectedOption_=null;Blockly.Toolbox.prototype.lastCategory_=null;
Blockly.Toolbox.prototype.init=function(){var a=this.workspace_;this.HtmlDiv=goog.dom.createDom("div","blocklyToolboxDiv");this.HtmlDiv.setAttribute("dir",a.RTL?"RTL":"LTR");document.body.appendChild(this.HtmlDiv);Blockly.bindEvent_(this.HtmlDiv,"mousedown",this,function(a){Blockly.isRightButton(a)||a.target==this.HtmlDiv?Blockly.hideChaff(!1):Blockly.hideChaff(!0)});this.flyout_=new Blockly.Flyout({disabledPatternId:a.options.disabledPatternId,parentWorkspace:a,RTL:a.RTL,horizontalLayout:a.horizontalLayout,
@ -1327,34 +1334,38 @@ Blockly.Toolbox.TreeControl.prototype.handleTouchEvent_=function(a){a.preventDef
Blockly.Toolbox.TreeControl.prototype.setSelectedItem=function(a){var b=this.toolbox_;if(a!=this.selectedItem_&&a!=b.tree_){b.lastCategory_&&(b.lastCategory_.getRowElement().style.backgroundColor="");if(a){var c=a.hexColour||"#57e";a.getRowElement().style.backgroundColor=c;b.addColour_(a)}c=this.getSelectedItem();goog.ui.tree.TreeControl.prototype.setSelectedItem.call(this,a);a&&a.blocks&&a.blocks.length?(b.flyout_.show(a.blocks),b.lastCategory_!=a&&b.flyout_.scrollToStart()):b.flyout_.hide();c!=
a&&c!=this&&(c=new Blockly.Events.Ui(null,"category",c&&c.getHtml(),a&&a.getHtml()),c.workspaceId=b.workspace_.id,Blockly.Events.fire(c));a&&(b.lastCategory_=a)}};Blockly.Toolbox.TreeNode=function(a,b,c,d){goog.ui.tree.TreeNode.call(this,b,c,d);a&&(b=function(){Blockly.fireUiEvent(window,"resize")},goog.events.listen(a.tree_,goog.ui.tree.BaseNode.EventType.EXPAND,b),goog.events.listen(a.tree_,goog.ui.tree.BaseNode.EventType.COLLAPSE,b),this.toolbox_=a)};goog.inherits(Blockly.Toolbox.TreeNode,goog.ui.tree.TreeNode);
Blockly.Toolbox.TreeNode.prototype.getExpandIconSafeHtml=function(){return goog.html.SafeHtml.create("span")};Blockly.Toolbox.TreeNode.prototype.onMouseDown=function(a){this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select();this.updateRow()};Blockly.Toolbox.TreeNode.prototype.onDoubleClick_=function(a){};Blockly.Toolbox.TreeSeparator=function(a){Blockly.Toolbox.TreeNode.call(this,null,"",a)};
goog.inherits(Blockly.Toolbox.TreeSeparator,Blockly.Toolbox.TreeNode);Blockly.Colours={motion:{primary:"#4C97FF",secondary:"#4280D7",tertiary:"#3373CC"},looks:{primary:"#9966FF",secondary:"#855CD6",tertiary:"#774DCB"},sounds:{primary:"#D65CD6",secondary:"#BF40BF",tertiary:"#A63FA6"},control:{primary:"#FFAB19",secondary:"#EC9C13",tertiary:"#CF8B17"},event:{primary:"#FFD500",secondary:"#DBC200",tertiary:"#CCAA00"},text:"#575E75",workspace:"#F5F8FF",textField:"#FFFFFF"};Blockly.Css={};Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"};Blockly.Css.currentCursor_="";Blockly.Css.styleSheet_=null;Blockly.Css.mediaPath_="";
Blockly.Css.inject=function(a,b){if(!Blockly.Css.styleSheet_){var c=".blocklyDraggable {}\n";a&&(c+=Blockly.Css.CONTENT.join("\n"),Blockly.FieldDate&&(c+=Blockly.FieldDate.CSS.join("\n")));Blockly.Css.mediaPath_=b.replace(/[\\\/]$/,"");var c=c.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_),d=document.createElement("style");document.head.appendChild(d);c=document.createTextNode(c);d.appendChild(c);Blockly.Css.styleSheet_=d.sheet;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)}};
Blockly.Css.setCursor=function(a){if(Blockly.Css.currentCursor_!=a){Blockly.Css.currentCursor_=a;var b="url("+Blockly.Css.mediaPath_+"/"+a+".cur), auto",c=".blocklyDraggable {\n cursor: "+b+";\n}\n";Blockly.Css.styleSheet_.deleteRule(0);Blockly.Css.styleSheet_.insertRule(c,0);for(var c=document.getElementsByClassName("blocklyToolboxDiv"),d=0,e;e=c[d];d++)e.style.cursor=a==Blockly.Css.Cursor.DELETE?b:"";document.body.parentNode.style.cursor=a==Blockly.Css.Cursor.OPEN?"":b}};
Blockly.Css.CONTENT=[".blocklySvg {","background-color: "+Blockly.Colours.workspace+";","outline: none;","overflow: hidden;","}",".blocklyRelativeWrapper {","position: relative;","width: 100%;","height: 100%;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 999;","}",".blocklyWidgetDiv.fieldTextInput {","overflow: hidden;","border: 1px solid;","box-sizing: border-box;","transform-origin: 0 0;","-ms-transform-origin: 0 0;","-moz-transform-origin: 0 0;","-webkit-transform-origin: 0 0;",
goog.inherits(Blockly.Toolbox.TreeSeparator,Blockly.Toolbox.TreeNode);Blockly.Css={};Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"};Blockly.Css.currentCursor_="";Blockly.Css.styleSheet_=null;Blockly.Css.mediaPath_="";
Blockly.Css.inject=function(a,b){if(!Blockly.Css.styleSheet_){var c=".blocklyDraggable {}\n";a&&(c+=Blockly.Css.CONTENT.join("\n"),Blockly.FieldDate&&(c+=Blockly.FieldDate.CSS.join("\n")));Blockly.Css.mediaPath_=b.replace(/[\\\/]$/,"");var c=c.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_),d;for(d in Blockly.Colours)Blockly.Colours.hasOwnProperty(d)&&(c=c.replace("$colour_"+d,Blockly.Colours[d]));d=document.createElement("style");document.head.appendChild(d);c=document.createTextNode(c);d.appendChild(c);
Blockly.Css.styleSheet_=d.sheet;Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)}};
Blockly.Css.setCursor=function(a){if(!(goog.userAgent.MOBILE||goog.userAgent.ANDROID||goog.userAgent.IPAD)&&Blockly.Css.currentCursor_!=a){Blockly.Css.currentCursor_=a;var b="url("+Blockly.Css.mediaPath_+"/"+a+".cur), auto",c=".blocklyDraggable {\n cursor: "+b+";\n}\n";Blockly.Css.styleSheet_.deleteRule(0);Blockly.Css.styleSheet_.insertRule(c,0);for(var c=document.getElementsByClassName("blocklyToolboxDiv"),d=0,e;e=c[d];d++)e.style.cursor=a==Blockly.Css.Cursor.DELETE?b:"";document.body.parentNode.style.cursor=
a==Blockly.Css.Cursor.OPEN?"":b}};
Blockly.Css.CONTENT=[".blocklySvg {","background-color: $colour_workspace;","outline: none;","overflow: hidden;","}",".blocklyRelativeWrapper {","position: relative;","width: 100%;","height: 100%;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 999;","}",".blocklyWidgetDiv.fieldTextInput {","overflow: hidden;","border: 1px solid;","box-sizing: border-box;","transform-origin: 0 0;","-ms-transform-origin: 0 0;","-moz-transform-origin: 0 0;","-webkit-transform-origin: 0 0;",
"}",".blocklyNonSelectable {","user-select: none;","-moz-user-select: none;","-webkit-user-select: none;","-ms-user-select: none;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);","color: #000;","display: none;","font-family: sans-serif;","font-size: 9pt;","opacity: 0.9;","padding: 2px;","position: absolute;","z-index: 1000;","}",".blocklyDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;",
"bottom: 0;","overflow: visible !important;","z-index: 5000;","-webkit-backface-visibility: hidden;","backface-visibility: hidden;","-webkit-perspective: 1000;","perspective: 1000;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #888;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPath {","stroke-width: 1px;","}",
".blocklySelected>.blocklyPath {","}",".blocklyDragging>.blocklyPath {","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;","font-size: 11pt;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {","fill: "+Blockly.Colours.text+
";","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill:"+Blockly.Colours.text+";","}",".blocklySvg text {","user-select: none;","-moz-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;","}",".blocklyCommentTextarea {","background-color: #ffc;","border: 0;","margin: 0;","padding: 2px;","resize: none;","}",".blocklyHtmlInput {","border: none;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 2px 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;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarKnob {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyScrollbarKnob:hover {","fill: #bbb;","}",".blocklyZoom>image {","opacity: .4;","}",".blocklyZoom>image:hover {","opacity: .6;","}",".blocklyZoom>image:active {","opacity: .8;","}",".blocklyFlyout .blocklyScrollbarKnob {",
"fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyFlyout .blocklyScrollbarKnob: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;",
"}",".blocklyContextMenu {","border-radius: 4px;","}",".blocklyDropdownMenu {","padding: 0 !important;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","}",".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 0px;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0px 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;",
"height: 0px;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0px;","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: 0px -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {",
"background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0px -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;","}",".blocklyTreeSelected .blocklyTreeLabel {",
"color: #fff;","}",".blocklyWidgetDiv .goog-palette {","outline: none;","cursor: default;","}",".blocklyWidgetDiv .goog-palette-table {","border: 1px solid #666;","border-collapse: collapse;","}",".blocklyWidgetDiv .goog-palette-cell {","height: 13px;","width: 15px;","margin: 0;","border: 0;","text-align: center;","vertical-align: middle;","border-right: 1px solid #666;","font-size: 1px;","}",".blocklyWidgetDiv .goog-palette-colorswatch {","position: relative;","height: 13px;","width: 15px;","border: 1px solid #666;",
"}",".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {","border: 1px solid #FFF;","}",".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {","border: 1px solid #000;","color: #fff;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","border-color: #ccc #666 #666 #ccc;","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;","}",".blocklyWidgetDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","padding: 4px 7em 4px 28px;","white-space: nowrap;","}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {","padding-left: 7em;","padding-right: 28px;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {","padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {",
"padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: 0.3;","-moz-opacity: 0.3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight,",".blocklyWidgetDiv .goog-menuitem-hover {",
"background-color: #d6e9f8;","border-color: #d6e9f8;","border-style: dotted;","border-width: 1px 0;","padding-bottom: 3px;","padding-top: 3px;","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .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 {",
"left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;","}",".blocklyWidgetDiv .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 {","left: 0;","right: auto;",
"text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .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=goog.dom.createDom("div","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=goog.style.getViewportPageOffset(document);Blockly.WidgetDiv.DIV.style.top=a.y+"px";Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block";Blockly.Events.setGroup(!0)};
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.DIV.style.height="",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=null,goog.dom.removeChildren(Blockly.WidgetDiv.DIV),Blockly.Events.setGroup(!1))};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};
Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};Blockly.WidgetDiv.position=function(a,b,c,d,e){b<d.y&&(b=d.y);e?a>c.width+d.x&&(a=c.width+d.x):a<d.x&&(a=d.x);Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c.height-b+d.y+"px"};Blockly.constants={};Blockly.DRAG_RADIUS=5;Blockly.SNAP_RADIUS=72;Blockly.BUMP_DELAY=250;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";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;
"bottom: 0;","overflow: visible !important;","z-index: 5000;","-webkit-backface-visibility: hidden;","backface-visibility: hidden;","-webkit-perspective: 1000;","perspective: 1000;","}",".blocklyDropDownDiv {","width: 100px;","height: 100px;","background: #f00;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #888;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;",
"stroke: #fc3;","stroke-width: 4px;","}",".blocklyPath {","stroke-width: 1px;","}",".blocklySelected>.blocklyPath {","}",".blocklyDragging>.blocklyPath {","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;","font-size: 11pt;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",
".blocklyEditableText>text {","fill: $colour_text;","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill: $colour_text;","}",".blocklySvg text {","user-select: none;","-moz-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;","}",".blocklyCommentTextarea {","background-color: #ffc;","border: 0;","margin: 0;","padding: 2px;","resize: none;","}",".blocklyHtmlInput {","border: none;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 2px 0;","width: 100%;","text-align: center;","color: $colour_text;","}",
".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: $colour_flyout;","fill-opacity: .8;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarKnob {","fill: $colour_scrollbar;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyScrollbarKnob:hover {","fill: $colour_scrollbarHover;","}",".blocklyZoom>image {","opacity: .4;",
"}",".blocklyZoom>image:hover {","opacity: .6;","}",".blocklyZoom>image:active {","opacity: .8;","}",".blocklyFlyout .blocklyScrollbarKnob {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyFlyout .blocklyScrollbarKnob: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;","}",".blocklyContextMenu {","border-radius: 4px;","}",".blocklyDropdownMenu {","padding: 0 !important;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;","}",".blocklyToolboxDiv {","background-color: $colour_toolbox;",
"color: $colour_toolboxText;","overflow-x: visible;","overflow-y: auto;","position: absolute;","}",".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 0px;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0px 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',
"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0px;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0px;","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: 0px -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0px -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;","}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyWidgetDiv .goog-palette {","outline: none;","cursor: default;","}",".blocklyWidgetDiv .goog-palette-table {","border: 1px solid #666;","border-collapse: collapse;","}",".blocklyWidgetDiv .goog-palette-cell {","height: 13px;","width: 15px;","margin: 0;","border: 0;","text-align: center;","vertical-align: middle;",
"border-right: 1px solid #666;","font-size: 1px;","}",".blocklyWidgetDiv .goog-palette-colorswatch {","position: relative;","height: 13px;","width: 15px;","border: 1px solid #666;","}",".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {","border: 1px solid #FFF;","}",".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {","border: 1px solid #000;","color: #fff;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","border-color: #ccc #666 #666 #ccc;","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;","}",".blocklyWidgetDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","padding: 4px 7em 4px 28px;","white-space: nowrap;","}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {","padding-left: 7em;","padding-right: 28px;",
"}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {","padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {",
"opacity: 0.3;","-moz-opacity: 0.3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight,",".blocklyWidgetDiv .goog-menuitem-hover {","background-color: #d6e9f8;","border-color: #d6e9f8;","border-style: dotted;","border-width: 1px 0;","padding-bottom: 3px;","padding-top: 3px;","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .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 {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;","}",".blocklyWidgetDiv .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 {","left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .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.disposeAnimationFinished_=null;Blockly.WidgetDiv.disposeAnimationTimer_=null;Blockly.WidgetDiv.disposeAnimationTimerLength_=0;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=goog.dom.createDom("div","blocklyWidgetDiv"),document.body.appendChild(Blockly.WidgetDiv.DIV))};
Blockly.WidgetDiv.show=function(a,b,c,d,e){Blockly.WidgetDiv.hide();Blockly.WidgetDiv.owner_=a;Blockly.WidgetDiv.dispose_=c;Blockly.WidgetDiv.disposeAnimationFinished_=d;Blockly.WidgetDiv.disposeAnimationTimerLength_=e;a=goog.style.getViewportPageOffset(document);Blockly.WidgetDiv.DIV.style.top=a.y+"px";Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block";Blockly.Events.setGroup(!0)};
Blockly.WidgetDiv.hide=function(a){Blockly.WidgetDiv.disposeAnimationTimer_?(window.clearTimeout(Blockly.WidgetDiv.disposeAnimationTimer_),Blockly.WidgetDiv.disposeAnimationFinished_&&Blockly.WidgetDiv.disposeAnimationFinished_(),Blockly.WidgetDiv.disposeAnimationFinished_=null,Blockly.WidgetDiv.disposeAnimationTimer_=null,Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.hideAndClearDom_()):Blockly.WidgetDiv.isVisible()&&(Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=
null,Blockly.WidgetDiv.disposeAnimationFinished_&&!a?Blockly.WidgetDiv.disposeAnimationTimer_=window.setTimeout(Blockly.WidgetDiv.hide,1E3*Blockly.WidgetDiv.disposeAnimationTimerLength_):(Blockly.WidgetDiv.disposeAnimationFinished_&&Blockly.WidgetDiv.disposeAnimationFinished_(),Blockly.WidgetDiv.disposeAnimationFinished_=null,Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.hideAndClearDom_()),Blockly.Events.setGroup(!1))};
Blockly.WidgetDiv.hideAndClearDom_=function(){Blockly.WidgetDiv.DIV.style.display="none";Blockly.WidgetDiv.DIV.style.left="";Blockly.WidgetDiv.DIV.style.top="";Blockly.WidgetDiv.DIV.style.height="";goog.dom.removeChildren(Blockly.WidgetDiv.DIV)};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};
Blockly.WidgetDiv.position=function(a,b,c,d,e){b<d.y&&(b=d.y);e?a>c.width+d.x&&(a=c.width+d.x):a<d.x&&(a=d.x);Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c.height-b+d.y+"px"};Blockly.constants={};Blockly.DRAG_RADIUS=5;Blockly.SNAP_RADIUS=72;Blockly.BUMP_DELAY=250;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.SVG_NS="http://www.w3.org/2000/svg";Blockly.HTML_NS="http://www.w3.org/1999/xhtml";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_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.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),d=!(!c||!c.getElementsByTagName("category").length),e=a.trashcan,void 0===e&&(e=d),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 l=a.scrollbars;void 0===l&&(l=d);var n=a.css;void 0===n&&(n=!0);var m="https://blockly-demo.appspot.com/static/media/";a.media?m=a.media:a.path&&(m=
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,r=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==a.rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,t=!!a.realtime,u=t?a.realtimeOptions:void 0;this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=m;this.hasCategories=d;this.hasScrollbars=l;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=
c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.enableRealtime=t;this.realtimeOptions=u;this.horizontalLayout=p;this.toolboxAtStart=q;this.toolboxPosition=r};Blockly.Options.prototype.parentWorkspace=null;Blockly.Options.prototype.setMetrics=function(a){};Blockly.Options.prototype.getMetrics=function(){return null};
a.path+"media/");var p=a.horizontalLayout;void 0===p&&(p=!1);var q=a.toolboxPosition,q="end"===q?!1:!0,r=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==a.rtl?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,t=!!a.realtime,w=t?a.realtimeOptions:void 0,u=a.colours;if(u)for(var v in u)u.hasOwnProperty(v)&&Blockly.Colours.hasOwnProperty(v)&&(Blockly.Colours[v]=u[v]);this.RTL=!!a.rtl;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.pathToMedia=
m;this.hasCategories=d;this.hasScrollbars=l;this.hasTrashcan=e;this.hasSounds=k;this.hasCss=n;this.languageTree=c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.enableRealtime=t;this.realtimeOptions=w;this.horizontalLayout=p;this.toolboxAtStart=q;this.toolboxPosition=r};Blockly.Options.prototype.parentWorkspace=null;Blockly.Options.prototype.setMetrics=function(a){};Blockly.Options.prototype.getMetrics=function(){return null};
Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:parseFloat(a.startScale);b.maxScale=void 0===a.maxScale?3:parseFloat(a.maxScale);b.minScale=void 0===a.minScale?.3:parseFloat(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:parseFloat(a.scaleSpeed);return b};
Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};b.spacing=parseFloat(a.spacing)||0;b.colour=a.colour||"#888";b.length=parseFloat(a.length)||1;b.snap=0<b.spacing&&!!a.snap;return b};Blockly.Options.parseToolboxTree_=function(a){a?("string"!=typeof a&&("undefined"==typeof XSLTProcessor&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=Blockly.Xml.textToDom(a))):a=null;return a};Blockly.utils={};Blockly.cache3dSupported_=null;Blockly.addClass_=function(a,b){var c=a.getAttribute("class")||"";-1==(" "+c+" ").indexOf(" "+b+" ")&&(c&&(c+=" "),a.setAttribute("class",c+b))};Blockly.removeClass_=function(a,b){var c=a.getAttribute("class");if(-1!=(" "+c+" ").indexOf(" "+b+" ")){for(var c=c.split(/\s+/),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")}};
Blockly.hasClass_=function(a,b){return-1!=(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")};Blockly.bindEvent_=function(a,b,c,d){var e=c?function(a){d.call(c,a)}:d;a.addEventListener(b,e,!1);var f=[[a,b,e]];if(b in Blockly.bindEvent_.TOUCH_MAP)for(var e=function(a){if(1==a.changedTouches.length){var b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}d.call(c,a);a.preventDefault()},g=0,h;h=Blockly.bindEvent_.TOUCH_MAP[b][g];g++)a.addEventListener(h,e,!1),f.push([a,h,e]);return f};
@ -1370,10 +1381,12 @@ Blockly.isRightButton=function(a){return a.ctrlKey&&goog.userAgent.MAC?!0:2==a.b
Blockly.commonWordPrefix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0][e],g=1;g<a.length;g++)if(f!=a[g][e])return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g][e])&&" "!=f)return c;return d};
Blockly.commonWordSuffix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0].substr(-e-1,1),g=1;g<a.length;g++)if(f!=a[g].substr(-e-1,1))return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g].charAt(a[g].length-e-1))&&" "!=f)return c;return d};Blockly.isNumber=function(a){return!!a.match(/^\s*-?\d+(\.\d+)?\s*$/)};
Blockly.tokenizeInterpolation=function(a){var b=[];a=a.split("");a.push("");for(var c=0,d=[],e=null,f=0;f<a.length;f++){var g=a[f];0==c?"%"==g?c=1:d.push(g):1==c?"%"==g?(d.push(g),c=0):"0"<=g&&"9">=g?(c=2,e=g,(g=d.join(""))&&b.push(g),d.length=0):(d.push("%",g),c=0):2==c&&("0"<=g&&"9">=g?e+=g:(b.push(parseInt(e,10)),f--,c=0))}(g=d.join(""))&&b.push(g);return b};Blockly.genUid=function(){for(var a=Blockly.genUid.soup_.length,b=[],c=0;20>c;c++)b[c]=Blockly.genUid.soup_.charAt(Math.random()*a);return b.join("")};
Blockly.genUid.soup_="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";Blockly.DragSurfaceSvg=function(a){this.container_=a};Blockly.DragSurfaceSvg.prototype.SVG_=null;Blockly.DragSurfaceSvg.prototype.dragGroup_=null;Blockly.DragSurfaceSvg.prototype.container_=null;
Blockly.genUid.soup_="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";Blockly.DragSurfaceSvg=function(a){this.container_=a};Blockly.DragSurfaceSvg.prototype.SVG_=null;Blockly.DragSurfaceSvg.prototype.dragGroup_=null;Blockly.DragSurfaceSvg.prototype.container_=null;Blockly.DragSurfaceSvg.prototype.scale_=1;
Blockly.DragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.createSvgElement("svg",{xmlns:Blockly.SVG_NS,"xmlns:html":Blockly.HTML_NS,"xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklyDragSurface"},this.container_),Blockly.createSvgElement("defs",{},this.SVG_),this.dragGroup_=Blockly.createSvgElement("g",{},this.SVG_))};
Blockly.DragSurfaceSvg.prototype.setBlocksAndShow=function(a){goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Already dragging a block.");this.dragGroup_.appendChild(a);this.SVG_.style.display="block"};Blockly.DragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){Blockly.is3dSupported()?this.dragGroup_.setAttribute("style","transform: translate3d("+a+"px, "+b+"px, 0px)scale3d("+c+","+c+","+c+")"):this.dragGroup_.setAttribute("transform","translate("+a+", "+b+") scale("+c+")")};
Blockly.DragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_};Blockly.DragSurfaceSvg.prototype.clearAndHide=function(a){a.appendChild(this.dragGroup_.childNodes[0]);this.SVG_.style.display="none";goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Drag group was not cleared.")};Blockly.inject=function(a,b){goog.isString(a)&&(a=document.getElementById(a)||document.querySelector(a));if(!goog.dom.contains(document,a))throw"Error: container is not in current document.";var c=new Blockly.Options(b||{}),d=goog.dom.createDom("div","blocklyRelativeWrapper");a.appendChild(d);var e=Blockly.createDom_(d,c),d=new Blockly.DragSurfaceSvg(d);d.createDom();c=Blockly.createMainWorkspace_(e,c,d);Blockly.init_(c);c.markFocused();Blockly.bindEvent_(e,"focus",c,c.markFocused);return c};
Blockly.DragSurfaceSvg.prototype.setBlocksAndShow=function(a){goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Already dragging a block.");this.dragGroup_.appendChild(a);this.SVG_.style.display="block"};
Blockly.DragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){this.scale_=c;Blockly.is3dSupported()?this.dragGroup_.setAttribute("style","transform: translate3d("+a+"px, "+b+"px, 0px)scale3d("+c+","+c+","+c+")"):this.dragGroup_.setAttribute("transform","translate("+a+", "+b+") scale("+c+")")};
Blockly.DragSurfaceSvg.prototype.translateSurface=function(a,b){a*=this.scale_;b*=this.scale_;Blockly.is3dSupported()?this.SVG_.setAttribute("style","transform: translate3d("+a+"px, "+b+"px, 0px); display: block;"):this.SVG_.setAttribute("transform","translate("+a+", "+b+")")};Blockly.DragSurfaceSvg.prototype.getSurfaceTranslation=function(){var a=Blockly.getRelativeXY_(this.SVG_);return new goog.math.Coordinate(a.x/this.scale_,a.y/this.scale_)};Blockly.DragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_};
Blockly.DragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.childNodes[0]};Blockly.DragSurfaceSvg.prototype.clearAndHide=function(a){a.appendChild(this.getCurrentBlock());this.SVG_.style.display="none";goog.asserts.assert(0==this.dragGroup_.childNodes.length,"Drag group was not cleared.")};Blockly.inject=function(a,b){goog.isString(a)&&(a=document.getElementById(a)||document.querySelector(a));if(!goog.dom.contains(document,a))throw"Error: container is not in current document.";var c=new Blockly.Options(b||{}),d=goog.dom.createDom("div","blocklyRelativeWrapper");a.appendChild(d);var e=Blockly.createDom_(d,c),d=new Blockly.DragSurfaceSvg(d);d.createDom();c=Blockly.createMainWorkspace_(e,c,d);Blockly.init_(c);c.markFocused();Blockly.bindEvent_(e,"focus",c,c.markFocused);return c};
Blockly.createDom_=function(a,b){a.setAttribute("dir","LTR");goog.ui.Component.setDefaultRightToLeft(b.RTL);Blockly.Css.inject(b.hasCss,b.pathToMedia);var c=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklySvg"},a),d=Blockly.createSvgElement("defs",{},c),e=String(Math.random()).substring(2),f=Blockly.createSvgElement("filter",{id:"blocklyEmbossFilter"+e},d);Blockly.createSvgElement("feGaussianBlur",
{"in":"SourceAlpha",stdDeviation:1,result:"blur"},f);var g=Blockly.createSvgElement("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},f);Blockly.createSvgElement("fePointLight",{x:-5E3,y:-1E4,z:2E4},g);Blockly.createSvgElement("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},f);Blockly.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,
k4:0},f);b.embossFilterId=f.id;f=Blockly.createSvgElement("filter",{id:"blocklyStackGlowFilter"+e},d);Blockly.createSvgElement("feMorphology",{"in":"SourceAlpha",operator:"dilate",radius:4,result:"outBlur"},f);Blockly.createSvgElement("feFlood",{"flood-color":"#05f","flood-opacity":"0.9",result:"outColor"},f);Blockly.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},f);Blockly.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"outGlow",operator:"over"},

View file

@ -38,10 +38,10 @@ window.BLOCKLY_BOOT = function() {
}
dir = window.BLOCKLY_DIR.match(/[^\/]+$/)[0];
}
goog.addDependency("../../../" + dir + "/core/block.js", ['Blockly.Block'], ['Blockly.Blocks', 'Blockly.Comment', 'Blockly.Connection', 'Blockly.Input', 'Blockly.Mutator', 'Blockly.Warning', 'Blockly.Workspace', 'Blockly.Xml', 'goog.array', 'goog.asserts', 'goog.math.Coordinate', 'goog.string']);
goog.addDependency("../../../" + dir + "/core/block.js", ['Blockly.Block'], ['Blockly.Blocks', 'Blockly.Colours', 'Blockly.Comment', 'Blockly.Connection', 'Blockly.Input', 'Blockly.Mutator', 'Blockly.Warning', 'Blockly.Workspace', 'Blockly.Xml', 'goog.array', 'goog.asserts', 'goog.math.Coordinate', 'goog.string']);
goog.addDependency("../../../" + dir + "/core/block_render_svg_horizontal.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg']);
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.ContextMenu', 'goog.Timer', 'goog.asserts', 'goog.dom', 'goog.math.Coordinate', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.Events', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.Generator', 'Blockly.Msg', 'Blockly.Procedures', 'Blockly.Toolbox', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'goog.color', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.Events', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldIconMenu', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.Generator', 'Blockly.Msg', 'Blockly.Procedures', 'Blockly.Toolbox', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'goog.color', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/blocks.js", ['Blockly.Blocks'], []);
goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['Blockly.Workspace', 'goog.dom', 'goog.math', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/colours.js", ['Blockly.Colours'], []);
@ -50,8 +50,9 @@ goog.addDependency("../../../" + dir + "/core/connection.js", ['Blockly.Connecti
goog.addDependency("../../../" + dir + "/core/connection_db.js", ['Blockly.ConnectionDB'], ['Blockly.Connection']);
goog.addDependency("../../../" + dir + "/core/constants.js", ['Blockly.constants'], []);
goog.addDependency("../../../" + dir + "/core/contextmenu.js", ['Blockly.ContextMenu'], ['goog.dom', 'goog.events', 'goog.style', 'goog.ui.Menu', 'goog.ui.MenuItem']);
goog.addDependency("../../../" + dir + "/core/css.js", ['Blockly.Css'], ['Blockly.Colours']);
goog.addDependency("../../../" + dir + "/core/dragsurface_svg.js", ['Blockly.DragSurfaceSvg'], ['Blockly.utils', 'Blockly.constants', 'goog.asserts']);
goog.addDependency("../../../" + dir + "/core/css.js", ['Blockly.Css'], ['Blockly.Colours', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/dragsurface_svg.js", ['Blockly.DragSurfaceSvg'], ['Blockly.utils', 'Blockly.constants', 'goog.asserts', 'goog.math.Coordinate']);
goog.addDependency("../../../" + dir + "/core/dropdowndiv.js", ['Blockly.DropDownDiv'], ['goog.dom']);
goog.addDependency("../../../" + dir + "/core/events.js", ['Blockly.Events'], []);
goog.addDependency("../../../" + dir + "/core/field.js", ['Blockly.Field'], ['goog.asserts', 'goog.dom', 'goog.math.Size', 'goog.style', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_angle.js", ['Blockly.FieldAngle'], ['Blockly.FieldTextInput', 'goog.math', 'goog.userAgent']);
@ -59,6 +60,7 @@ goog.addDependency("../../../" + dir + "/core/field_checkbox.js", ['Blockly.Fiel
goog.addDependency("../../../" + dir + "/core/field_colour.js", ['Blockly.FieldColour'], ['Blockly.Field', 'goog.dom', 'goog.events', 'goog.style', 'goog.ui.ColorPicker']);
goog.addDependency("../../../" + dir + "/core/field_date.js", ['Blockly.FieldDate'], ['Blockly.Field', 'goog.date', 'goog.dom', 'goog.events', 'goog.i18n.DateTimeSymbols', 'goog.i18n.DateTimeSymbols_he', 'goog.style', 'goog.ui.DatePicker']);
goog.addDependency("../../../" + dir + "/core/field_dropdown.js", ['Blockly.FieldDropdown'], ['Blockly.Field', 'goog.dom', 'goog.events', 'goog.style', 'goog.ui.Menu', 'goog.ui.MenuItem', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_iconmenu.js", ['Blockly.FieldIconMenu'], ['Blockly.DropDownDiv']);
goog.addDependency("../../../" + dir + "/core/field_image.js", ['Blockly.FieldImage'], ['Blockly.Field', 'goog.dom', 'goog.math.Size', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_label.js", ['Blockly.FieldLabel'], ['Blockly.Field', 'Blockly.Tooltip', 'goog.dom', 'goog.math.Size']);
goog.addDependency("../../../" + dir + "/core/field_textinput.js", ['Blockly.FieldTextInput'], ['Blockly.BlockSvg.render', 'Blockly.Field', 'Blockly.Msg', 'goog.asserts', 'goog.dom', 'goog.userAgent']);
@ -71,7 +73,7 @@ goog.addDependency("../../../" + dir + "/core/input.js", ['Blockly.Input'], ['Bl
goog.addDependency("../../../" + dir + "/core/msg.js", ['Blockly.Msg'], []);
goog.addDependency("../../../" + dir + "/core/mutator.js", ['Blockly.Mutator'], ['Blockly.Bubble', 'Blockly.Icon', 'Blockly.WorkspaceSvg', 'goog.Timer', 'goog.dom']);
goog.addDependency("../../../" + dir + "/core/names.js", ['Blockly.Names'], []);
goog.addDependency("../../../" + dir + "/core/options.js", ['Blockly.Options'], []);
goog.addDependency("../../../" + dir + "/core/options.js", ['Blockly.Options'], ['Blockly.Colours']);
goog.addDependency("../../../" + dir + "/core/procedures.js", ['Blockly.Procedures'], ['Blockly.Field', 'Blockly.Names', 'Blockly.Workspace']);
goog.addDependency("../../../" + dir + "/core/scrollbar.js", ['Blockly.Scrollbar', 'Blockly.ScrollbarPair'], ['goog.dom', 'goog.events']);
goog.addDependency("../../../" + dir + "/core/toolbox.js", ['Blockly.Toolbox'], ['Blockly.Flyout', 'goog.dom', 'goog.events', 'goog.events.BrowserFeature', 'goog.html.SafeHtml', 'goog.html.SafeStyle', 'goog.math.Rect', 'goog.style', 'goog.ui.tree.TreeControl', 'goog.ui.tree.TreeNode']);
@ -1598,6 +1600,7 @@ goog.require('Blockly.ConnectionDB');
goog.require('Blockly.ContextMenu');
goog.require('Blockly.Css');
goog.require('Blockly.DragSurfaceSvg');
goog.require('Blockly.DropDownDiv');
goog.require('Blockly.Events');
goog.require('Blockly.Field');
goog.require('Blockly.FieldAngle');
@ -1605,6 +1608,7 @@ goog.require('Blockly.FieldCheckbox');
goog.require('Blockly.FieldColour');
goog.require('Blockly.FieldDate');
goog.require('Blockly.FieldDropdown');
goog.require('Blockly.FieldIconMenu');
goog.require('Blockly.FieldImage');
goog.require('Blockly.FieldLabel');
goog.require('Blockly.FieldTextInput');

View file

@ -38,10 +38,10 @@ window.BLOCKLY_BOOT = function() {
}
dir = window.BLOCKLY_DIR.match(/[^\/]+$/)[0];
}
goog.addDependency("../../../" + dir + "/core/block.js", ['Blockly.Block'], ['Blockly.Blocks', 'Blockly.Comment', 'Blockly.Connection', 'Blockly.Input', 'Blockly.Mutator', 'Blockly.Warning', 'Blockly.Workspace', 'Blockly.Xml', 'goog.array', 'goog.asserts', 'goog.math.Coordinate', 'goog.string']);
goog.addDependency("../../../" + dir + "/core/block.js", ['Blockly.Block'], ['Blockly.Blocks', 'Blockly.Colours', 'Blockly.Comment', 'Blockly.Connection', 'Blockly.Input', 'Blockly.Mutator', 'Blockly.Warning', 'Blockly.Workspace', 'Blockly.Xml', 'goog.array', 'goog.asserts', 'goog.math.Coordinate', 'goog.string']);
goog.addDependency("../../../" + dir + "/core/block_render_svg_vertical.js", ['Blockly.BlockSvg.render'], ['Blockly.BlockSvg']);
goog.addDependency("../../../" + dir + "/core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.ContextMenu', 'goog.Timer', 'goog.asserts', 'goog.dom', 'goog.math.Coordinate', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.Events', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.Generator', 'Blockly.Msg', 'Blockly.Procedures', 'Blockly.Toolbox', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'goog.color', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/blockly.js", ['Blockly'], ['Blockly.BlockSvg.render', 'Blockly.Events', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldIconMenu', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.Generator', 'Blockly.Msg', 'Blockly.Procedures', 'Blockly.Toolbox', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.constants', 'Blockly.inject', 'Blockly.utils', 'goog.color', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/blocks.js", ['Blockly.Blocks'], []);
goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['Blockly.Workspace', 'goog.dom', 'goog.math', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/colours.js", ['Blockly.Colours'], []);
@ -50,8 +50,9 @@ goog.addDependency("../../../" + dir + "/core/connection.js", ['Blockly.Connecti
goog.addDependency("../../../" + dir + "/core/connection_db.js", ['Blockly.ConnectionDB'], ['Blockly.Connection']);
goog.addDependency("../../../" + dir + "/core/constants.js", ['Blockly.constants'], []);
goog.addDependency("../../../" + dir + "/core/contextmenu.js", ['Blockly.ContextMenu'], ['goog.dom', 'goog.events', 'goog.style', 'goog.ui.Menu', 'goog.ui.MenuItem']);
goog.addDependency("../../../" + dir + "/core/css.js", ['Blockly.Css'], ['Blockly.Colours']);
goog.addDependency("../../../" + dir + "/core/dragsurface_svg.js", ['Blockly.DragSurfaceSvg'], ['Blockly.utils', 'Blockly.constants', 'goog.asserts']);
goog.addDependency("../../../" + dir + "/core/css.js", ['Blockly.Css'], ['Blockly.Colours', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/dragsurface_svg.js", ['Blockly.DragSurfaceSvg'], ['Blockly.utils', 'Blockly.constants', 'goog.asserts', 'goog.math.Coordinate']);
goog.addDependency("../../../" + dir + "/core/dropdowndiv.js", ['Blockly.DropDownDiv'], ['goog.dom']);
goog.addDependency("../../../" + dir + "/core/events.js", ['Blockly.Events'], []);
goog.addDependency("../../../" + dir + "/core/field.js", ['Blockly.Field'], ['goog.asserts', 'goog.dom', 'goog.math.Size', 'goog.style', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_angle.js", ['Blockly.FieldAngle'], ['Blockly.FieldTextInput', 'goog.math', 'goog.userAgent']);
@ -59,6 +60,7 @@ goog.addDependency("../../../" + dir + "/core/field_checkbox.js", ['Blockly.Fiel
goog.addDependency("../../../" + dir + "/core/field_colour.js", ['Blockly.FieldColour'], ['Blockly.Field', 'goog.dom', 'goog.events', 'goog.style', 'goog.ui.ColorPicker']);
goog.addDependency("../../../" + dir + "/core/field_date.js", ['Blockly.FieldDate'], ['Blockly.Field', 'goog.date', 'goog.dom', 'goog.events', 'goog.i18n.DateTimeSymbols', 'goog.i18n.DateTimeSymbols_he', 'goog.style', 'goog.ui.DatePicker']);
goog.addDependency("../../../" + dir + "/core/field_dropdown.js", ['Blockly.FieldDropdown'], ['Blockly.Field', 'goog.dom', 'goog.events', 'goog.style', 'goog.ui.Menu', 'goog.ui.MenuItem', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_iconmenu.js", ['Blockly.FieldIconMenu'], ['Blockly.DropDownDiv']);
goog.addDependency("../../../" + dir + "/core/field_image.js", ['Blockly.FieldImage'], ['Blockly.Field', 'goog.dom', 'goog.math.Size', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_label.js", ['Blockly.FieldLabel'], ['Blockly.Field', 'Blockly.Tooltip', 'goog.dom', 'goog.math.Size']);
goog.addDependency("../../../" + dir + "/core/field_textinput.js", ['Blockly.FieldTextInput'], ['Blockly.BlockSvg.render', 'Blockly.Field', 'Blockly.Msg', 'goog.asserts', 'goog.dom', 'goog.userAgent']);
@ -71,7 +73,7 @@ goog.addDependency("../../../" + dir + "/core/input.js", ['Blockly.Input'], ['Bl
goog.addDependency("../../../" + dir + "/core/msg.js", ['Blockly.Msg'], []);
goog.addDependency("../../../" + dir + "/core/mutator.js", ['Blockly.Mutator'], ['Blockly.Bubble', 'Blockly.Icon', 'Blockly.WorkspaceSvg', 'goog.Timer', 'goog.dom']);
goog.addDependency("../../../" + dir + "/core/names.js", ['Blockly.Names'], []);
goog.addDependency("../../../" + dir + "/core/options.js", ['Blockly.Options'], []);
goog.addDependency("../../../" + dir + "/core/options.js", ['Blockly.Options'], ['Blockly.Colours']);
goog.addDependency("../../../" + dir + "/core/procedures.js", ['Blockly.Procedures'], ['Blockly.Field', 'Blockly.Names', 'Blockly.Workspace']);
goog.addDependency("../../../" + dir + "/core/scrollbar.js", ['Blockly.Scrollbar', 'Blockly.ScrollbarPair'], ['goog.dom', 'goog.events']);
goog.addDependency("../../../" + dir + "/core/toolbox.js", ['Blockly.Toolbox'], ['Blockly.Flyout', 'goog.dom', 'goog.events', 'goog.events.BrowserFeature', 'goog.html.SafeHtml', 'goog.html.SafeStyle', 'goog.math.Rect', 'goog.style', 'goog.ui.tree.TreeControl', 'goog.ui.tree.TreeNode']);
@ -1598,6 +1600,7 @@ goog.require('Blockly.ConnectionDB');
goog.require('Blockly.ContextMenu');
goog.require('Blockly.Css');
goog.require('Blockly.DragSurfaceSvg');
goog.require('Blockly.DropDownDiv');
goog.require('Blockly.Events');
goog.require('Blockly.Field');
goog.require('Blockly.FieldAngle');
@ -1605,6 +1608,7 @@ goog.require('Blockly.FieldCheckbox');
goog.require('Blockly.FieldColour');
goog.require('Blockly.FieldDate');
goog.require('Blockly.FieldDropdown');
goog.require('Blockly.FieldIconMenu');
goog.require('Blockly.FieldImage');
goog.require('Blockly.FieldLabel');
goog.require('Blockly.FieldTextInput');

View file

@ -61,7 +61,8 @@ var a=this;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOR_TOOLTIP.re
Blockly.Blocks.controls_forEach={init:function(){this.jsonInit({message0:Blockly.Msg.CONTROLS_FOREACH_TITLE,args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],previousStatement:null,nextStatement:null,colour:Blockly.Blocks.loops.HUE,helpUrl:Blockly.Msg.CONTROLS_FOREACH_HELPURL});this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_DO);var a=this;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOREACH_TOOLTIP.replace("%1",
a.getFieldValue("VAR"))})},customContextMenu:Blockly.Blocks.controls_for.customContextMenu};
Blockly.Blocks.controls_flow_statements={init:function(){var a=[[Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK,"BREAK"],[Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE,"CONTINUE"]];this.setHelpUrl(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL);this.setColour(Blockly.Blocks.loops.HUE);this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"FLOW");this.setPreviousStatement(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("FLOW");return{BREAK:Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK,
CONTINUE:Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}[a]})},onchange:function(a){a=!1;var b=this;do{if(-1!=this.LOOP_TYPES.indexOf(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?this.setWarningText(null):this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING)},LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]};Blockly.Colours={motion:{primary:"#4C97FF",secondary:"#4280D7",tertiary:"#3373CC"},looks:{primary:"#9966FF",secondary:"#855CD6",tertiary:"#774DCB"},sounds:{primary:"#D65CD6",secondary:"#BF40BF",tertiary:"#A63FA6"},control:{primary:"#FFAB19",secondary:"#EC9C13",tertiary:"#CF8B17"},event:{primary:"#FFD500",secondary:"#DBC200",tertiary:"#CCAA00"},text:"#575E75",workspace:"#F5F8FF",textField:"#FFFFFF"};Blockly.Blocks.math={};Blockly.Blocks.math.HUE=Blockly.Colours.textField;Blockly.Blocks.math_number={init:function(){this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);this.setColour(Blockly.Blocks.math.HUE);this.appendDummyInput().appendField(new Blockly.FieldTextInput("0",Blockly.FieldTextInput.numberValidator),"NUM");this.setOutput(!0,"Number");var a=this;this.setTooltip(function(){var b=a.getParent();return b&&b.tooltip||Blockly.Msg.MATH_NUMBER_TOOLTIP})}};
CONTINUE:Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}[a]})},onchange:function(a){a=!1;var b=this;do{if(-1!=this.LOOP_TYPES.indexOf(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?this.setWarningText(null):this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING)},LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]};Blockly.Colours={motion:{primary:"#4C97FF",secondary:"#4280D7",tertiary:"#3373CC"},looks:{primary:"#9966FF",secondary:"#855CD6",tertiary:"#774DCB"},sounds:{primary:"#D65CD6",secondary:"#BF40BF",tertiary:"#A63FA6"},control:{primary:"#FFAB19",secondary:"#EC9C13",tertiary:"#CF8B17"},event:{primary:"#FFD500",secondary:"#DBC200",tertiary:"#CCAA00"},text:"#575E75",workspace:"#F5F8FF",toolbox:"#DDDDDD",toolboxText:"#000000",flyout:"#DDDDDD",scrollbar:"#CCCCCC",scrollbarHover:"#BBBBBB",textField:"#FFFFFF",
insertionMarker:"#949494",insertionMarkerOpacity:.6};Blockly.Blocks.math={};Blockly.Blocks.math.HUE=Blockly.Colours.textField;Blockly.Blocks.math_number={init:function(){this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);this.setColour(Blockly.Blocks.math.HUE);this.appendDummyInput().appendField(new Blockly.FieldTextInput("0",Blockly.FieldTextInput.numberValidator),"NUM");this.setOutput(!0,"Number");var a=this;this.setTooltip(function(){var b=a.getParent();return b&&b.tooltip||Blockly.Msg.MATH_NUMBER_TOOLTIP})}};
Blockly.Blocks.math_arithmetic={init:function(){var a=[[Blockly.Msg.MATH_ADDITION_SYMBOL,"ADD"],[Blockly.Msg.MATH_SUBTRACTION_SYMBOL,"MINUS"],[Blockly.Msg.MATH_MULTIPLICATION_SYMBOL,"MULTIPLY"],[Blockly.Msg.MATH_DIVISION_SYMBOL,"DIVIDE"],[Blockly.Msg.MATH_POWER_SYMBOL,"POWER"]];this.setHelpUrl(Blockly.Msg.MATH_ARITHMETIC_HELPURL);this.setColour(Blockly.Blocks.math.HUE);this.setOutput(!0,"Number");this.appendValueInput("A").setCheck("Number");this.appendValueInput("B").setCheck("Number").appendField(new Blockly.FieldDropdown(a),
"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("OP");return{ADD:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[a]})}};
Blockly.Blocks.math_single={init:function(){var a=[[Blockly.Msg.MATH_SINGLE_OP_ROOT,"ROOT"],[Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE,"ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]];this.setHelpUrl(Blockly.Msg.MATH_SINGLE_HELPURL);this.setColour(Blockly.Blocks.math.HUE);this.setOutput(!0,"Number");this.appendValueInput("NUM").setCheck("Number").appendField(new Blockly.FieldDropdown(a),"OP");var b=this;this.setTooltip(function(){var a=b.getFieldValue("OP");return{ROOT:Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT,

View file

@ -38,6 +38,38 @@ Blockly.Blocks['event_whenflagclicked'] = {
}
};
Blockly.Blocks['dropdown_whenbroadcast'] = {
/**
* Block for broadcast dropdown (used for shadow).
* @this Blockly.Block
*/
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldIconMenu([
{type: 'placeholder', width: 50, height: 50},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/LetterGet_Blue.svg',
value: 'blue', width: 50, height: 50, alt: 'Blue'},
{type: 'placeholder', width: 50, height: 50},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/LetterGet_Green.svg',
value: 'green', width: 50, height: 50, alt: 'Green'},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/LetterGet_Orange.svg',
value: 'orange', width: 50, height: 50, alt: 'Orange'},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/LetterGet_Purple.svg',
value: 'purple', width: 50, height: 50, alt: 'Purple'},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/LetterGet_Red.svg',
value: 'red', width: 50, height: 50, alt: 'Red'},
{type: 'placeholder', width: 50, height: 50},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/LetterGet_Yellow.svg',
value: 'yellow', width: 50, height: 50, alt: 'Yellow'}
]), 'CHOICE');
this.setOutput(true);
this.setColour(Blockly.Colours.event.primary,
Blockly.Colours.event.secondary,
Blockly.Colours.event.tertiary
);
}
};
Blockly.Blocks['event_whenbroadcastreceived'] = {
/**
* Block for when broadcast received.
@ -46,7 +78,7 @@ Blockly.Blocks['event_whenbroadcastreceived'] = {
init: function() {
this.jsonInit({
"id": "event_whenbroadcastreceived",
"message0": "%1",
"message0": "%1 %2",
"args0": [
{
"type": "field_image",
@ -55,6 +87,10 @@ Blockly.Blocks['event_whenbroadcastreceived'] = {
"height": 40,
"alt": "flag",
"flip_rtl": true
},
{
"type": "input_value",
"name": "CHOICE"
}
],
"inputsInline": true,

View file

@ -1197,6 +1197,9 @@ Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) {
case 'field_dropdown':
field = new Blockly.FieldDropdown(element['options']);
break;
case 'field_iconmenu':
field = new Blockly.FieldIconMenu(element['options']);
break;
case 'field_image':
field = new Blockly.FieldImage(element['src'],
element['width'], element['height'], element['alt'],

View file

@ -94,11 +94,19 @@ Blockly.BlockSvg.FIELD_TOP_PADDING = 1.5 * Blockly.BlockSvg.GRID_UNIT;
* @const
*/
Blockly.BlockSvg.NUMBER_FIELD_CORNER_RADIUS = 4 * Blockly.BlockSvg.GRID_UNIT;
/**
* Corner radius of text inputs
* @const
*/
Blockly.BlockSvg.TEXT_FIELD_CORNER_RADIUS = 1 * Blockly.BlockSvg.GRID_UNIT;
/**
* Default radius for a field, in px.
* @const
*/
Blockly.BlockSvg.FIELD_DEFAULT_CORNER_RADIUS = 4 * Blockly.BlockSvg.GRID_UNIT;
/**
* Minimum width of a block.
* @const
@ -223,17 +231,13 @@ Blockly.BlockSvg.prototype.connectionUiEffect = function() {
* Change the colour of a block.
*/
Blockly.BlockSvg.prototype.updateColour = function() {
var fillColour = (this.isGlowing_) ? this.getColourSecondary() : this.getColour();
var strokeColour = this.getColourTertiary();
if (this.isShadow() && this.parentBlock_) {
// Pull shadow block stroke colour from parent block's tertiary if possible.
strokeColour = this.parentBlock_.getColourTertiary();
}
// Render block stroke
this.svgPath_.setAttribute('stroke', strokeColour);
// Render block fill
var fillColour = (this.isGlowing_) ? this.getColourSecondary() : this.getColour();
this.svgPath_.setAttribute('fill', fillColour);
// Render opacity
@ -310,6 +314,7 @@ Blockly.BlockSvg.prototype.renderCompute_ = function() {
var metrics = {
statement: null,
imageField: null,
iconMenu: null,
width: 0,
height: 0,
bayHeight: 0,
@ -343,11 +348,24 @@ Blockly.BlockSvg.prototype.renderCompute_ = function() {
if (field instanceof Blockly.FieldImage) {
metrics.imageField = field;
}
if (field instanceof Blockly.FieldIconMenu) {
metrics.iconMenu = field;
}
if (field instanceof Blockly.FieldTextInput) {
metrics.fieldRadius = field.getBorderRadius();
} else {
metrics.fieldRadius = Blockly.BlockSvg.FIELD_DEFAULT_CORNER_RADIUS;
}
}
}
// If this block is an icon menu shadow, attempt to set the parent's
// ImageField src to the one that represents the current value of the field.
if (metrics.iconMenu) {
var currentSrc = metrics.iconMenu.getSrcForValue(metrics.iconMenu.getValue());
if (currentSrc) {
metrics.iconMenu.setParentFieldImage(currentSrc);
}
}
// Always render image field at 40x40 px
// Normal block sizing
@ -431,6 +449,10 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(metrics) {
var valueX = (Blockly.BlockSvg.NOTCH_WIDTH +
(metrics.bayWidth ? 2 * Blockly.BlockSvg.GRID_UNIT +
Blockly.BlockSvg.NOTCH_WIDTH*2 : 0) + metrics.bayWidth);
if (metrics.startHat) {
// Start hats add some left margin to field for visual balance
valueX += Blockly.BlockSvg.GRID_UNIT * 2;
}
if (this.RTL) {
valueX = -valueX;
}

View file

@ -375,7 +375,6 @@ Blockly.BlockSvg.prototype.moveBy = function(dx, dy) {
this.moveConnections_(dx, dy);
event.recordNew();
Blockly.Events.fire(event);
Blockly.WidgetDiv.hide(true);
};
/**
@ -910,8 +909,9 @@ Blockly.BlockSvg.prototype.onMouseMove_ = function(e) {
// drag surface. By moving to the drag surface before unplug, connection
// positions will be calculated correctly.
this.moveToDragSurface_();
// Clear all WidgetDivs without animating, in case blocks are moved around
// Clear WidgetDiv/DropDownDiv without animating, in case blocks are moved around
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
if (this.parentBlock_) {
// Push this block to the very top of the stack.
this.unplug();

View file

@ -28,6 +28,7 @@
goog.provide('Blockly');
goog.require('Blockly.BlockSvg.render');
goog.require('Blockly.DropDownDiv');
goog.require('Blockly.Events');
goog.require('Blockly.FieldAngle');
goog.require('Blockly.FieldCheckbox');
@ -36,6 +37,7 @@ goog.require('Blockly.FieldColour');
// Add it only if you need it.
//goog.require('Blockly.FieldDate');
goog.require('Blockly.FieldDropdown');
goog.require('Blockly.FieldIconMenu');
goog.require('Blockly.FieldImage');
goog.require('Blockly.FieldTextInput');
goog.require('Blockly.FieldVariable');
@ -248,8 +250,9 @@ Blockly.onKeyDown_ = function(e) {
}
var deleteBlock = false;
if (e.keyCode == 27) {
// Pressing esc closes the context menu.
// Pressing esc closes the context menu and any drop-down
Blockly.hideChaff();
Blockly.DropDownDiv.hide();
} else if (e.keyCode == 8 || e.keyCode == 46) {
// Delete or backspace.
try {

View file

@ -42,5 +42,6 @@ Blockly.Colours = {
"insertionMarkerOpacity": 0.6,
"dragShadowOpacity": 0.3,
// CSS colours: support RGBA
"fieldShadow": "rgba(0,0,0,0.1)"
"fieldShadow": "rgba(0,0,0,0.1)",
"dropDownShadow": "rgba(0, 0, 0, .3)"
};

View file

@ -215,6 +215,72 @@ Blockly.Css.CONTENT = [
'perspective: 1000;',
'}',
'.blocklyDropDownDiv {',
'position: absolute;',
'left: 0;',
'top: 0;',
'z-index: 1000;',
'display: none;',
'border: 1px solid;',
'border-radius: 8px;',
'box-shadow: 0px 0px 8px 1px ' + Blockly.Colours.dropDownShadow + ';',
'padding: 5px;',
'-webkit-user-select: none;',
'}',
'.blocklyDropDownArrow {',
'position: absolute;',
'left: 0;',
'top: 0;',
'width: 16px;',
'height: 16px;',
'z-index: -1;',
'}',
'.blocklyDropDownButton {',
'display: inline-block;',
'float: left;',
'padding: 0;',
'margin: 5px;',
'border-radius: 8px;',
'outline: none;',
'border: 1px solid;',
'transition: box-shadow .1s;',
'cursor: pointer;',
'}',
'.blocklyDropDownButtonHover {',
'box-shadow: 0px 0px 0px 4px ' + Blockly.Colours.fieldShadow + ';',
'}',
'.blocklyDropDownButton:active {',
'box-shadow: 0px 0px 0px 8px ' + Blockly.Colours.fieldShadow + ';',
'}',
'.blocklyDropDownButton > img {',
'width: 100%;',
'height: 100%;',
'}',
'.blocklyDropDownPlaceholder {',
'display: inline-block;',
'float: left;',
'padding: 0;',
'margin: 5px;',
'}',
'.arrowTop {',
'border-top: 1px solid;',
'border-left: 1px solid;',
'border-top-left-radius: 4px;',
'}',
'.arrowBottom {',
'border-bottom: 1px solid;',
'border-right: 1px solid;',
'border-bottom-right-radius: 4px;',
'}',
'.blocklyResizeSE {',
'cursor: se-resize;',
'fill: #aaa;',

347
core/dropdowndiv.js Normal file
View file

@ -0,0 +1,347 @@
/**
* @license
* Scratch Blocks
*
* Copyright (c) 2016, Massachusetts Institute of Technology
* All rights reserved.
*
* Licensed under BSD-3-clause (see LICENSE).
*/
/**
* @fileoverview A div that floats on top of the workspace, for drop-down menus.
* The drop-down can be kept inside the workspace, animate in/out, etc.
* @author tmickel@mit.edu (Tim Mickel)
*/
'use strict';
goog.provide('Blockly.DropDownDiv');
goog.require('goog.dom');
goog.require('goog.style');
/**
* Class for drop-down div.
* @constructor
*/
Blockly.DropDownDiv = function() {
};
/**
* The div element. Set once by Blockly.DropDownDiv.createDom.
* @type {Element}
* @private
*/
Blockly.DropDownDiv.DIV_ = null;
/**
* Drop-downs will appear within the bounds of this element if possible.
* Set in Blockly.DropDownDiv.setBoundsElement.
* @type {Element}
* @private
*/
Blockly.DropDownDiv.boundsElement_ = null;
/**
* The object currently using the drop-down.
* @type {Object}
* @private
*/
Blockly.DropDownDiv.owner_ = null;
/**
* Arrow size in px. Should match the value in CSS (need to position pre-render).
* @type {number}
* @const
*/
Blockly.DropDownDiv.ARROW_SIZE = 16;
/**
* Drop-down border size in px. Should match the value in CSS (need to position the arrow).
* @type {number}
* @const
*/
Blockly.DropDownDiv.BORDER_SIZE = 1;
/**
* Amount the arrow must be kept away from the edges of the main drop-down div, in px.
* @type {number}
* @const
*/
Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING = 12;
/**
* Amount drop-downs should be padded away from the source, in px.
* @type {number}
* @const
*/
Blockly.DropDownDiv.PADDING_Y = 20;
/**
* Length of animations in seconds.
* @type {number}
* @const
*/
Blockly.DropDownDiv.ANIMATION_TIME = 0.25;
/**
* Timer for animation out, to be cleared if we need to immediately hide
* without disrupting new shows.
* @type {number}
*/
Blockly.DropDownDiv.animateOutTimer_ = null;
/**
* When the drop-down is opened, we save the position it animated from
* so that it can animate back to that position on close.
* Absolute X position of that position, in px.
* @type {number}
*/
Blockly.DropDownDiv.hideAnimationX_ = 0;
/**
* When the drop-down is opened, we save the position it animated from
* so that it can animate back to that position on close.
* Absolute Y position of that position, in px.
* @type {number}
*/
Blockly.DropDownDiv.hideAnimationY_ = 0;
/**
* Callback for when the drop-down is hidden.
* @type {Function}
*/
Blockly.DropDownDiv.onHide_ = 0;
/**
* Create and insert the DOM element for this div.
* @param {Element} container Element that the div should be contained in.
*/
Blockly.DropDownDiv.createDom = function() {
if (Blockly.DropDownDiv.DIV_) {
return; // Already created.
}
Blockly.DropDownDiv.DIV_ = goog.dom.createDom('div', 'blocklyDropDownDiv');
document.body.appendChild(Blockly.DropDownDiv.DIV_);
Blockly.DropDownDiv.content_ = goog.dom.createDom('div', 'blocklyDropDownContent');
Blockly.DropDownDiv.DIV_.appendChild(Blockly.DropDownDiv.content_);
Blockly.DropDownDiv.arrow_ = goog.dom.createDom('div', 'blocklyDropDownArrow');
Blockly.DropDownDiv.DIV_.appendChild(Blockly.DropDownDiv.arrow_);
};
/**
* Set an element to maintain bounds within. Drop-downs will appear
* within the box of this element if possible.
* @param {Element} boundsElement Element to bound drop-down to.
*/
Blockly.DropDownDiv.setBoundsElement = function(boundsElement) {
Blockly.DropDownDiv.boundsElement_ = boundsElement;
};
/**
* Provide the div for inserting content into the drop-down.
* @return {Element} Div to populate with content
*/
Blockly.DropDownDiv.getContentDiv = function() {
return Blockly.DropDownDiv.content_;
};
/**
* Clear the content of the drop-down.
*/
Blockly.DropDownDiv.clearContent = function() {
Blockly.DropDownDiv.content_.innerHTML = '';
};
/**
* Set the colour for the drop-down.
* @param {string} backgroundColour Any CSS color for the background
* @param {string} borderColour Any CSS color for the border
*/
Blockly.DropDownDiv.setColour = function(backgroundColour, borderColour) {
Blockly.DropDownDiv.DIV_.style.backgroundColor = backgroundColour;
Blockly.DropDownDiv.arrow_.style.backgroundColor = backgroundColour;
Blockly.DropDownDiv.DIV_.style.borderColor = borderColour;
Blockly.DropDownDiv.arrow_.style.borderColor = borderColour;
};
/**
* Show and place the drop-down.
* The drop-down is placed with an absolute "origin point" (x, y) - i.e.,
* the arrow will point at this origin and box will positioned below or above it.
* If we can maintain the container bounds at the primary point, the arrow will
* point there, and the container will be positioned below it.
* If we can't maintain the container bounds at the primary point, fall-back to the
* secondary point and position above.
* @param {Object} owner The object showing the drop-down
* @param {number} primaryX Desired origin point x, in absolute px
* @param {number} primaryY Desired origin point y, in absolute px
* @param {number} secondaryX Secondary/alternative origin point x, in absolute px
* @param {number} secondaryY Secondary/alternative origin point y, in absolute px
* @param {Function=} opt_onHide Optional callback for when the drop-down is hidden
* @return {boolean} True if the menu rendered at the primary origin point.
*/
Blockly.DropDownDiv.show = function(owner, primaryX, primaryY, secondaryX, secondaryY, opt_onHide) {
Blockly.DropDownDiv.owner_ = owner;
Blockly.DropDownDiv.onHide_ = opt_onHide;
var div = Blockly.DropDownDiv.DIV_;
var metrics = Blockly.DropDownDiv.getPositionMetrics(primaryX, primaryY, secondaryX, secondaryY);
// Update arrow CSS
Blockly.DropDownDiv.arrow_.style.transform = 'translate(' +
metrics.arrowX + 'px,' + metrics.arrowY + 'px) rotate(45deg)';
Blockly.DropDownDiv.arrow_.setAttribute('class',
metrics.arrowAtTop ? 'blocklyDropDownArrow arrowTop' : 'blocklyDropDownArrow arrowBottom');
// First apply initial translation
div.style.transform = 'translate(' + metrics.initialX + 'px,' + metrics.initialY + 'px)';
// Save for animate out
Blockly.DropDownDiv.hideAnimationX_ = metrics.initialX;
Blockly.DropDownDiv.hideAnimationY_ = metrics.initialY;
// Show the div
div.style.display = 'block';
div.style.opacity = 1;
// Add transition and apply final translate after a cycle.
setTimeout(function() {
div.style.transition = 'transform ' + Blockly.DropDownDiv.ANIMATION_TIME + 's, ' +
'opacity ' + Blockly.DropDownDiv.ANIMATION_TIME + 's';
div.style.transform = 'translate(' + metrics.finalX + 'px,' + metrics.finalY + 'px)';
}, 1);
return metrics.arrowAtTop;
};
/**
* Helper to position the drop-down and the arrow, maintaining bounds.
* See explanation of origin points in Blockly.DropDownDiv.show.
* @param {number} primaryX Desired origin point x, in absolute px
* @param {number} primaryY Desired origin point y, in absolute px
* @param {number} secondaryX Secondary/alternative origin point x, in absolute px
* @param {number} secondaryY Secondary/alternative origin point y, in absolute px
* @returns {Object} Various final metrics, including rendered positions for drop-down and arrow.
*/
Blockly.DropDownDiv.getPositionMetrics = function(primaryX, primaryY, secondaryX, secondaryY) {
var div = Blockly.DropDownDiv.DIV_;
var boundPosition = goog.style.getClientPosition(Blockly.DropDownDiv.boundsElement_);
var boundSize = goog.style.getSize(Blockly.DropDownDiv.boundsElement_);
var divSize = goog.style.getSize(div);
// First decide if we will render at primary or secondary position
// i.e., above or below
// renderX, renderY will eventually be the final rendered position of the box.
var renderX, renderY, renderedSecondary;
// Can the div fit inside the bounds if we render below the primary point?
if (primaryY + divSize.height > boundPosition.y + boundSize.height) {
// We can't fit below in terms of y. Can we fit above?
if (secondaryY - divSize.height < boundPosition.y) {
// We also can't fit above, so just render below anyway.
renderX = primaryX;
renderY = primaryY + Blockly.DropDownDiv.PADDING_Y;
renderedSecondary = false;
} else {
// We can fit above, render secondary
renderX = secondaryX;
renderY = secondaryY - divSize.height - Blockly.DropDownDiv.PADDING_Y;
renderedSecondary = true;
}
} else {
// We can fit below, render primary
renderX = primaryX;
renderY = primaryY + Blockly.DropDownDiv.PADDING_Y;
renderedSecondary = false;
}
// First calculate the absolute arrow X
// This needs to be done before positioning the div, since the arrow
// wants to be as close to the origin point as possible.
var arrowX = renderX - Blockly.DropDownDiv.ARROW_SIZE / 2;
// Keep in overall bounds
arrowX = Math.max(boundPosition.x, Math.min(arrowX, boundPosition.x + boundSize.width));
// Adjust the x-position of the drop-down so that the div is centered and within bounds.
var centerX = divSize.width / 2;
renderX -= centerX;
// Fit horizontally in the bounds.
renderX = Math.max(
boundPosition.x,
Math.min(renderX, boundPosition.x + boundSize.width - divSize.width)
);
// After we've finished caclulating renderX, adjust the arrow to be relative to it.
arrowX -= renderX;
// Pad the arrow by some pixels, primarily so that it doesn't render on top of a rounded border.
arrowX = Math.max(
Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING,
Math.min(arrowX, divSize.width - Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING - Blockly.DropDownDiv.ARROW_SIZE)
);
// Calculate arrow Y. If we rendered secondary, add on bottom.
// Extra pixels are added so that it covers the border of the div.
var arrowY = (renderedSecondary) ? divSize.height - Blockly.DropDownDiv.BORDER_SIZE : 0;
arrowY -= (Blockly.DropDownDiv.ARROW_SIZE / 2) + Blockly.DropDownDiv.BORDER_SIZE;
// Initial position calculated without any padding to provide an animation point.
var initialX = renderX; // X position remains constant during animation.
var initialY;
if (renderedSecondary) {
initialY = secondaryY - divSize.height; // No padding on Y
} else {
initialY = primaryY; // No padding on Y
}
return {
initialX: initialX,
initialY : initialY,
finalX: renderX,
finalY: renderY,
arrowX: arrowX,
arrowY: arrowY,
arrowAtTop: !renderedSecondary
};
};
/**
* Hide the menu only if it is owned by the provided object.
* @param {Object} owner Object which must be owning the drop-down to hide
* @return {Boolean} True if hidden
*/
Blockly.DropDownDiv.hideIfOwner = function(owner) {
if (Blockly.DropDownDiv.owner_ === owner) {
Blockly.DropDownDiv.hide();
return true;
}
return false;
};
/**
* Hide the menu, triggering animation.
*/
Blockly.DropDownDiv.hide = function() {
// Start the animation by setting the translation and fading out.
var div = Blockly.DropDownDiv.DIV_;
div.style.transform = 'translate(' + Blockly.DropDownDiv.hideAnimationX_ +
'px,' + Blockly.DropDownDiv.hideAnimationY_ + 'px)';
div.style.opacity = 0;
Blockly.DropDownDiv.animateOutTimer_ = setTimeout(function() {
// Finish animation - reset all values to default.
Blockly.DropDownDiv.hideWithoutAnimation();
}, Blockly.DropDownDiv.ANIMATION_TIME * 1000);
if (Blockly.DropDownDiv.onHide_) {
Blockly.DropDownDiv.onHide_();
Blockly.DropDownDiv.onHide_ = null;
}
};
/**
* Hide the menu, without animation.
*/
Blockly.DropDownDiv.hideWithoutAnimation = function() {
var div = Blockly.DropDownDiv.DIV_;
Blockly.DropDownDiv.animateOutTimer_ && window.clearTimeout(Blockly.DropDownDiv.animateOutTimer_);
div.style.transition = '';
div.style.transform = '';
div.style.display = 'none';
Blockly.DropDownDiv.clearContent();
Blockly.DropDownDiv.owner_ = null;
if (Blockly.DropDownDiv.onHide_) {
Blockly.DropDownDiv.onHide_();
Blockly.DropDownDiv.onHide_ = null;
}
};

266
core/field_iconmenu.js Normal file
View file

@ -0,0 +1,266 @@
/**
* @fileoverview Icon picker input field.
* This is primarily for use in Scratch Horizontal blocks.
* Pops open a drop-down with icons; when an icon is selected, it replaces
* the icon (image field) in the original block.
* @author tmickel@mit.edu (Tim Mickel)
*/
'use strict';
goog.provide('Blockly.FieldIconMenu');
goog.require('Blockly.DropDownDiv');
/**
* Class for an icon menu field.
* @param {Object} icons List of icons. These take the same options as an Image Field.
* @extends {Blockly.Field}
* @constructor
*/
Blockly.FieldIconMenu = function(icons) {
/** @type {object} */
this.icons_ = icons;
// Example:
// [{src: '...', width: 20, height: 20, alt: '...', value: 'machine_value'}, ...]
// First icon provides the default values.
var defaultValue = icons[0].value;
Blockly.FieldIconMenu.superClass_.constructor.call(this, defaultValue);
};
goog.inherits(Blockly.FieldIconMenu, Blockly.Field);
/**
* Fixed width of the drop-down, in px. Icon buttons will flow inside this width.
* @type {number}
* @const
*/
Blockly.FieldIconMenu.DROPDOWN_WIDTH = 180;
/**
* Save the primary colour of the source block while the menu is open, for reset.
* @type {number|string}
* @private
*/
Blockly.FieldIconMenu.savedPrimary_ = null;
/**
* Called when the field is placed on a block.
* @param {Block} block The owning block.
*/
Blockly.FieldIconMenu.prototype.init = function(block) {
// Render the arrow icon
// Fixed sizes in px. Saved for creating the flip transform of the menu renders above the button.
var arrowSize = 12;
/** @type {Number} */
this.arrowX_ = 18;
/** @type {Number} */
this.arrowY_ = 10;
if (block.RTL) {
// In RTL, the icon position is flipped and rendered from the right (offset by width)
this.arrowX_ = -this.arrowX_ - arrowSize;
}
/** @type {Element} */
this.arrowIcon_ = Blockly.createSvgElement('image', {
'height': arrowSize + 'px',
'width': arrowSize + 'px',
'transform': 'translate(' + this.arrowX_ + ',' + this.arrowY_ + ')'
});
this.arrowIcon_.setAttributeNS('http://www.w3.org/1999/xlink',
'xlink:href', Blockly.mainWorkspace.options.pathToMedia + 'dropdown-arrow.svg');
block.getSvgRoot().appendChild(this.arrowIcon_);
Blockly.FieldIconMenu.superClass_.init.call(this, block);
};
/**
* Mouse cursor style when over the hotspot that initiates the editor.
* @const
*/
Blockly.FieldIconMenu.prototype.CURSOR = 'default';
/**
* Set the language-neutral value for this icon drop-down menu.
* @param {?string} newValue New value.
* @override
*/
Blockly.FieldIconMenu.prototype.setValue = function(newValue) {
if (newValue === null || newValue === this.value_) {
return; // No change
}
if (this.sourceBlock_ && Blockly.Events.isEnabled()) {
Blockly.Events.fire(new Blockly.Events.Change(
this.sourceBlock_, 'field', this.name, this.value_, newValue));
}
this.value_ = newValue;
// Find the relevant icon in this.icons_ to get the image src.
this.setParentFieldImage(this.getSrcForValue(this.value_));
};
/**
* Find the parent block's FieldImage and set its src.
* @param {?string} src New src for the parent block FieldImage.
* @private
*/
Blockly.FieldIconMenu.prototype.setParentFieldImage = function(src) {
if (this.sourceBlock_) {
var parentBlock = this.sourceBlock_.parentBlock_;
// Loop through all inputs' fields to find the first FieldImage
for (var i = 0, input; input = parentBlock.inputList[i]; i++) {
for (var j = 0, field; field = input.fieldRow[j]; j++) {
if (field instanceof Blockly.FieldImage) {
// Src for a FieldImage is stored in its value.
field.setValue(src);
return;
}
}
}
}
};
/**
* Get the language-neutral value from this drop-down menu.
* @return {string} Current language-neutral value.
*/
Blockly.FieldIconMenu.prototype.getValue = function() {
return this.value_;
};
/**
* For a language-neutral value, get the src for the image that represents it.
* @param {string} value Language-neutral value to look up.
* @return {string} Src to image representing value
*/
Blockly.FieldIconMenu.prototype.getSrcForValue = function(value) {
for (var i = 0, icon; icon = this.icons_[i]; i++) {
if (icon.value === value) {
return icon.src;
}
}
};
/**
* Show the drop-down menu for editing this field.
* @private
*/
Blockly.FieldIconMenu.prototype.showEditor_ = function() {
// If there is an existing drop-down we own, this is a request to hide the drop-down.
if (Blockly.DropDownDiv.hideIfOwner(this)) {
return;
}
// If there is an existing drop-down someone else owns, hide it immediately and clear it.
Blockly.DropDownDiv.hideWithoutAnimation();
Blockly.DropDownDiv.clearContent();
// Populate the drop-down with the icons for this field.
var contentDiv = Blockly.DropDownDiv.getContentDiv();
// Accessibility properties
contentDiv.setAttribute('role', 'menu');
contentDiv.setAttribute('aria-haspopup', 'true');
for (var i = 0, icon; icon = this.icons_[i]; i++) {
// Icons with the type property placeholder take up space but don't have any functionality
// Use for special-case layouts
if (icon.type == 'placeholder') {
var placeholder = document.createElement('span');
placeholder.setAttribute('class', 'blocklyDropDownPlaceholder');
placeholder.style.width = icon.width + 'px';
placeholder.style.height = icon.height + 'px';
contentDiv.appendChild(placeholder);
continue;
}
var button = document.createElement('button');
button.setAttribute('id', ':' + i); // For aria-activedescendant
button.setAttribute('role', 'menuitem');
button.setAttribute('class', 'blocklyDropDownButton');
button.title = icon.alt;
button.style.width = icon.width + 'px';
button.style.height = icon.height + 'px';
var backgroundColor = this.sourceBlock_.getColour();
if (icon.value == this.getValue()) {
// This icon is selected, show it in a different colour
backgroundColor = this.sourceBlock_.getColourTertiary();
button.setAttribute('aria-selected', 'true');
}
button.style.backgroundColor = backgroundColor;
button.style.borderColor = this.sourceBlock_.getColourTertiary();
button.onclick = this.buttonClick_.bind(this);
button.ontouchend = this.buttonClick_.bind(this);
// These are applied manually instead of using the :hover pseudoclass
// because Android has a bad long press "helper" menu and green highlight
// that we must prevent with ontouchstart preventDefault
button.ontouchstart = function(e) {
this.setAttribute('class', 'blocklyDropDownButton blocklyDropDownButtonHover');
e.preventDefault();
};
button.onmouseover = function() {
this.setAttribute('class', 'blocklyDropDownButton blocklyDropDownButtonHover');
contentDiv.setAttribute('aria-activedescendant', this.id);
};
button.onmouseout = function() {
this.setAttribute('class', 'blocklyDropDownButton');
contentDiv.removeAttribute('aria-activedescendant');
};
var buttonImg = document.createElement('img');
buttonImg.src = icon.src;
//buttonImg.alt = icon.alt;
// Upon click/touch, we will be able to get the clicked element as e.target
// Store a data attribute on all possible click targets so we can match it to the icon.
button.setAttribute('data-value', icon.value);
buttonImg.setAttribute('data-value', icon.value);
button.appendChild(buttonImg);
contentDiv.appendChild(button);
}
contentDiv.style.width = Blockly.FieldIconMenu.DROPDOWN_WIDTH + 'px';
// Calculate positioning for the drop-down
// sourceBlock_ is the rendered shadow field button
var scale = this.sourceBlock_.workspace.scale;
var bBox = this.sourceBlock_.getHeightWidth();
bBox.width *= scale;
bBox.height *= scale;
var position = this.getAbsoluteXY_();
// If we can fit it, render below the shadow block
var primaryX = position.x + bBox.width / 2;
var primaryY = position.y + bBox.height;
// If we can't fit it, render above the entire parent block
var secondaryX = primaryX;
var secondaryY = position.y - (Blockly.BlockSvg.MIN_BLOCK_Y * scale) - (Blockly.BlockSvg.FIELD_Y_OFFSET * scale);
Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(), this.sourceBlock_.getColourTertiary());
// Update source block colour to look selected
this.savedPrimary_ = this.sourceBlock_.getColour();
this.sourceBlock_.setColour(this.sourceBlock_.getColourSecondary(),
this.sourceBlock_.getColourSecondary(), this.sourceBlock_.getColourTertiary());
Blockly.DropDownDiv.setBoundsElement(this.sourceBlock_.workspace.getParentSvg().parentNode);
var renderedPrimary = Blockly.DropDownDiv.show(this, primaryX, primaryY,
secondaryX, secondaryY, this.onHide_.bind(this));
if (!renderedPrimary) {
// Adjust for rotation
var arrowX = this.arrowX_ + Blockly.DropDownDiv.ARROW_SIZE / 1.5 + 1;
var arrowY = this.arrowY_ + Blockly.DropDownDiv.ARROW_SIZE / 1.5;
// Flip the arrow on the button
this.arrowIcon_.setAttribute('transform',
'translate(' + arrowX + ',' + arrowY + ') rotate(180)');
}
};
/**
* Callback for when a button is clicked inside the drop-down.
* Should be bound to the FieldIconMenu.
* @param {Event} e DOM event for the click/touch
* @private
*/
Blockly.FieldIconMenu.prototype.buttonClick_ = function(e) {
var value = e.target.getAttribute('data-value');
this.setValue(value);
Blockly.DropDownDiv.hide();
};
Blockly.FieldIconMenu.prototype.onHide_ = function() {
// Reset the button colour and clear accessibility properties
this.sourceBlock_.setColour(this.savedPrimary_,
this.sourceBlock_.getColourSecondary(), this.sourceBlock_.getColourTertiary());
Blockly.DropDownDiv.content_.removeAttribute('role');
Blockly.DropDownDiv.content_.removeAttribute('aria-haspopup');
Blockly.DropDownDiv.content_.removeAttribute('aria-activedescendant');
// Unflip the arrow if appropriate
this.arrowIcon_.setAttribute('transform', 'translate(' + this.arrowX_ + ',' + this.arrowY_ + ')');
};

View file

@ -30,6 +30,7 @@ goog.require('Blockly.Css');
goog.require('Blockly.Options');
goog.require('Blockly.WorkspaceSvg');
goog.require('Blockly.DragSurfaceSvg');
goog.require('Blockly.DropDownDiv');
goog.require('goog.dom');
goog.require('goog.ui.Component');
goog.require('goog.userAgent');
@ -226,6 +227,7 @@ Blockly.createMainWorkspace_ = function(svg, options, dragSurface) {
// The SVG is now fully assembled.
Blockly.svgResize(mainWorkspace);
Blockly.WidgetDiv.createDom();
Blockly.DropDownDiv.createDom();
Blockly.Tooltip.createDom();
return mainWorkspace;
};

View file

@ -424,9 +424,10 @@ Blockly.Scrollbar.prototype.onMouseDownBar_ = function(e) {
}
this.svgKnob_.setAttribute(this.horizontal_ ? 'x' : 'y',
this.constrainKnob_(knobValue));
// When the scrollbars are clicked, hide the WidgetDiv without animation
// When the scrollbars are clicked, hide the WidgetDiv/DropDownDiv without animation
// in anticipation of a workspace move.
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
this.onScroll_();
e.stopPropagation();
};
@ -455,9 +456,10 @@ Blockly.Scrollbar.prototype.onMouseDownKnob_ = function(e) {
'mouseup', this, this.onMouseUpKnob_);
Blockly.Scrollbar.onMouseMoveWrapper_ = Blockly.bindEvent_(document,
'mousemove', this, this.onMouseMoveKnob_);
// When the scrollbars are clicked, hide the WidgetDiv without animation
// When the scrollbars are clicked, hide the WidgetDiv/DropDownDiv without animation
// in anticipation of a workspace move.
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
e.stopPropagation();
};

View file

@ -158,6 +158,7 @@ Blockly.Toolbox.prototype.init = function() {
// Clicking on toolbar closes popups.
Blockly.bindEvent_(this.HtmlDiv, 'mousedown', this,
function(e) {
Blockly.DropDownDiv.hide();
if (Blockly.isRightButton(e) || e.target == this.HtmlDiv) {
// Close flyout.
Blockly.hideChaff(false);

View file

@ -404,6 +404,7 @@ Blockly.WorkspaceSvg.prototype.setVisible = function(isVisible) {
}
} else {
Blockly.hideChaff(true);
Blockly.DropDownDiv.hideWithoutAnimation();
}
};
@ -606,6 +607,7 @@ Blockly.WorkspaceSvg.prototype.onMouseDown_ = function(e) {
Blockly.svgResize(this);
Blockly.terminateDrag_(); // In case mouse-up event was lost.
Blockly.hideChaff();
Blockly.DropDownDiv.hide();
var isTargetWorkspace = e.target && e.target.nodeName &&
(e.target.nodeName.toLowerCase() == 'svg' ||
e.target == this.svgBackground_);
@ -693,6 +695,7 @@ Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) {
// First hide the WidgetDiv without animation
// (mouse scroll makes field out of place with div)
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
var x = this.scrollX - e.deltaX;
var y = this.scrollY - e.deltaY;
this.startDragMetrics = this.getMetrics();
@ -996,6 +999,7 @@ Blockly.WorkspaceSvg.prototype.zoom = function(x, y, type) {
}
// Hide the WidgetDiv without animation (zoom makes field out of place with div)
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
Blockly.hideChaff(false);
if (this.flyout_) {
// No toolbox, resize flyout.
@ -1045,6 +1049,7 @@ Blockly.WorkspaceSvg.prototype.zoomToFit = function() {
this.scrollbar.resize();
// Hide the WidgetDiv without animation (zoom makes field out of place with div)
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
Blockly.hideChaff(false);
if (this.flyout_) {
// No toolbox, resize flyout.
@ -1065,6 +1070,7 @@ Blockly.WorkspaceSvg.prototype.zoomReset = function(e) {
this.updateGridPattern_();
// Hide the WidgetDiv without animation (zoom makes field out of place with div)
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
Blockly.hideChaff(false);
if (this.flyout_) {
// No toolbox, resize flyout.
@ -1103,6 +1109,7 @@ Blockly.WorkspaceSvg.prototype.scroll = function(x, y) {
// When the workspace starts scrolling, hide the WidgetDiv without animation.
// This is to prevent a dispoal animation from happening in the wrong location.
Blockly.WidgetDiv.hide(true);
Blockly.DropDownDiv.hideWithoutAnimation();
// Move the scrollbars and the page will scroll automatically.
this.scrollbar.set(-x - metrics.contentLeft,
-y - metrics.contentTop);

1
media/dropdown-arrow.svg Normal file
View file

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="12.71" height="8.79" viewBox="0 0 12.71 8.79"><title>dropdown-arrow</title><g opacity="0.1"><path d="M12.71,2.44A2.41,2.41,0,0,1,12,4.16L8.08,8.08a2.45,2.45,0,0,1-3.45,0L0.72,4.16A2.42,2.42,0,0,1,0,2.44,2.48,2.48,0,0,1,.71.71C1,0.47,1.43,0,6.36,0S11.75,0.46,12,.71A2.44,2.44,0,0,1,12.71,2.44Z" fill="#231f20"/></g><path d="M6.36,7.79a1.43,1.43,0,0,1-1-.42L1.42,3.45a1.44,1.44,0,0,1,0-2c0.56-.56,9.31-0.56,9.87,0a1.44,1.44,0,0,1,0,2L7.37,7.37A1.43,1.43,0,0,1,6.36,7.79Z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 569 B

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="85px" height="66px" viewBox="0 0 85 66" enable-background="new 0 0 85 66" xml:space="preserve">
<path fill="#005899" d="M64,49c0,1.65-1.35,3-3,3H22c-1.65,0-3-1.35-3-3V28c0-1.65,1.35-3,3-3h39c1.65,0,3,1.35,3,3V49z"/>
<path fill="#0087FF" d="M22,51c-1.1,0-2-0.9-2-2V28c0-1.1,0.9-2,2-2h39c1.1,0,2,0.9,2,2v21c0,1.1-0.9,2-2,2H22z"/>
<path fill="#005899" d="M60,52c2,0,2-1.094,2.425-1.094l-19.85-15.467c-0.866-0.68-2.284-0.645-3.15,0.035l-19.85,15.414
C20,51,20.9,52,22,52H60z"/>
<path fill="#0087FF" d="M41,36c0.369,0,0.719-0.029,0.959,0.158L61.1,51H20.9l19.141-14.842C40.281,35.971,40.631,36,41,36z"/>
<path fill="#005899" d="M23,25c0,0-2.425,0-2.425,1.232l19.85,17.536c0.866,0.678,2.284,0.678,3.15,0l19.85-17.536
C63.096,25.904,62.1,25,61,25H23z"/>
<path fill="#005899" d="M23,27c0,0-3,0.138-3-1.095l20.425-15.466c0.866-0.678,2.284-0.644,3.15,0.034L63,25.888
C62.671,26.216,62.1,27,61,27H23z"/>
<path fill="#005899" d="M42,44.275c-0.559,0-1.092-0.16-1.502-0.452l-0.064-0.046L25,30.587V18h34v12.587l-15.434,13.19
l-0.064,0.046C43.092,44.115,42.559,44.275,42,44.275z"/>
<path fill="#FFFFFF" d="M26,19v11.168L26.846,31l14.233,12.009c0.238,0.171,0.571,0.269,0.921,0.269s0.683-0.098,0.921-0.269
L57.154,31L58,30.168V19H26z"/>
<path fill="#005899" d="M29,25h26v1H29V25z M29,28h21v1H29V28z M29,31h21v1H29V31z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="85px" height="66px" viewBox="0 0 85 66" enable-background="new 0 0 85 66" xml:space="preserve">
<path fill="#00561D" d="M64,49c0,1.65-1.35,3-3,3H22c-1.65,0-3-1.35-3-3V28c0-1.65,1.35-3,3-3h39c1.65,0,3,1.35,3,3V49z"/>
<path fill="#007F2F" d="M22,51c-1.1,0-2-0.9-2-2V28c0-1.1,0.9-2,2-2h39c1.1,0,2,0.9,2,2v21c0,1.1-0.9,2-2,2H22z"/>
<path fill="#00561D" d="M60,52c2,0,2-1.094,2.425-1.094l-19.85-15.467c-0.866-0.679-2.284-0.644-3.15,0.035l-19.85,15.414
C20,51,20.9,52,22,52H60z"/>
<path fill="#007F2F" d="M41,36c0.369,0,0.719-0.029,0.959,0.158L61.1,51H20.9l19.141-14.842C40.281,35.971,40.631,36,41,36z"/>
<path fill="#00561D" d="M23,25c0,0-2.425,0-2.425,1.232l19.85,17.536c0.866,0.678,2.284,0.678,3.15,0l19.85-17.536
C63.096,25.904,62.1,25,61,25H23z"/>
<path fill="#00561D" d="M23,27c0,0-3,0.138-3-1.095l20.425-15.466c0.866-0.678,2.284-0.644,3.15,0.034L63,25.888
C62.671,26.216,62.1,27,61,27H23z"/>
<path fill="#00561D" d="M42,44.275c-0.559,0-1.092-0.16-1.502-0.452l-0.064-0.046L25,30.587V18h34v12.587l-15.434,13.19
l-0.064,0.046C43.092,44.115,42.559,44.275,42,44.275z"/>
<path fill="#FFFFFF" d="M26,19v11.168L26.846,31l14.233,12.009c0.238,0.171,0.571,0.269,0.921,0.269s0.683-0.098,0.921-0.269
L57.154,31L58,30.168V19H26z"/>
<path fill="#00561D" d="M29,25h26v1H29V25z M29,28h21v1H29V28z M29,31h21v1H29V31z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="85px" height="66px" viewBox="0 0 85 66" enable-background="new 0 0 85 66" xml:space="preserve">
<path fill="#B77437" d="M64,49c0,1.65-1.35,3-3,3H22c-1.65,0-3-1.35-3-3V28c0-1.65,1.35-3,3-3h39c1.65,0,3,1.35,3,3V49z"/>
<path fill="#FFA342" d="M22,51c-1.1,0-2-0.9-2-2V28c0-1.1,0.9-2,2-2h39c1.1,0,2,0.9,2,2v21c0,1.1-0.9,2-2,2H22z"/>
<path fill="#B77437" d="M60,52c2,0,2-1.094,2.425-1.094l-19.85-15.467c-0.866-0.679-2.284-0.644-3.15,0.035l-19.85,15.414
C20,51,20.9,52,22,52H60z"/>
<path fill="#FFA342" d="M41,36c0.369,0,0.719-0.029,0.959,0.158L61.1,51H20.9l19.141-14.842C40.281,35.971,40.631,36,41,36z"/>
<path fill="#B77437" d="M23,25c0,0-2.425,0-2.425,1.232l19.85,17.536c0.866,0.678,2.284,0.678,3.15,0l19.85-17.536
C63.096,25.904,62.1,25,61,25H23z"/>
<path fill="#B77437" d="M23,27c0,0-3,0.138-3-1.095l20.425-15.466c0.866-0.678,2.284-0.644,3.15,0.034L63,25.888
C62.671,26.216,62.1,27,61,27H23z"/>
<path fill="#B77437" d="M42,44.275c-0.559,0-1.092-0.16-1.502-0.452l-0.064-0.046L25,30.587V18h34v12.587l-15.434,13.19
l-0.064,0.046C43.092,44.115,42.559,44.275,42,44.275z"/>
<path fill="#FFFFFF" d="M26,19v11.168L26.846,31l14.233,12.009c0.238,0.171,0.571,0.269,0.921,0.269s0.683-0.098,0.921-0.269
L57.154,31L58,30.168V19H26z"/>
<path fill="#B77437" d="M29,25h26v1H29V25z M29,28h21v1H29V28z M29,31h21v1H29V31z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="85px" height="66px" viewBox="0 0 85 66" enable-background="new 0 0 85 66" xml:space="preserve">
<path fill="#78519B" d="M64,49c0,1.65-1.35,3-3,3H22c-1.65,0-3-1.35-3-3V28c0-1.65,1.35-3,3-3h39c1.65,0,3,1.35,3,3V49z"/>
<path fill="#C475FF" d="M22,51c-1.1,0-2-0.9-2-2V28c0-1.1,0.9-2,2-2h39c1.1,0,2,0.9,2,2v21c0,1.1-0.9,2-2,2H22z"/>
<path fill="#78519B" d="M60,52c2,0,2-1.094,2.425-1.094l-19.85-15.467c-0.866-0.679-2.284-0.644-3.15,0.035l-19.85,15.414
C20,51,20.9,52,22,52H60z"/>
<path fill="#C475FF" d="M41,36c0.369,0,0.719-0.029,0.959,0.158L61.1,51H20.9l19.141-14.842C40.281,35.971,40.631,36,41,36z"/>
<path fill="#78519B" d="M23,25c0,0-2.425,0-2.425,1.232l19.85,17.536c0.866,0.678,2.284,0.678,3.15,0l19.85-17.536
C63.096,25.904,62.1,25,61,25H23z"/>
<path fill="#78519B" d="M23,27c0,0-3,0.138-3-1.095l20.425-15.466c0.866-0.678,2.284-0.644,3.15,0.034L63,25.888
C62.671,26.216,62.1,27,61,27H23z"/>
<path fill="#78519B" d="M42,44.275c-0.559,0-1.092-0.16-1.502-0.452l-0.064-0.046L25,30.587V18h34v12.587l-15.434,13.19
l-0.064,0.046C43.092,44.115,42.559,44.275,42,44.275z"/>
<path fill="#FFFFFF" d="M26,19v11.168L26.846,31l14.233,12.009c0.238,0.171,0.571,0.269,0.921,0.269s0.683-0.098,0.921-0.269
L57.154,31L58,30.168V19H26z"/>
<path fill="#78519B" d="M29,25h26v1H29V25z M29,28h21v1H29V28z M29,31h21v1H29V31z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="85px" height="66px" viewBox="0 0 85 66" enable-background="new 0 0 85 66" xml:space="preserve">
<path fill="#A5000C" d="M64,49c0,1.65-1.35,3-3,3H22c-1.65,0-3-1.35-3-3V28c0-1.65,1.35-3,3-3h39c1.65,0,3,1.35,3,3V49z"/>
<path fill="#FF0000" d="M22,51c-1.1,0-2-0.9-2-2V28c0-1.1,0.9-2,2-2h39c1.1,0,2,0.9,2,2v21c0,1.1-0.9,2-2,2H22z"/>
<path fill="#A5000C" d="M60,52c2,0,2-1.094,2.425-1.094l-19.85-15.467c-0.866-0.679-2.284-0.644-3.15,0.035l-19.85,15.414
C20,51,20.9,52,22,52H60z"/>
<path fill="#FF0000" d="M41,36c0.369,0,0.719-0.029,0.959,0.158L61.1,51H20.9l19.141-14.842C40.281,35.971,40.631,36,41,36z"/>
<path fill="#A5000C" d="M23,25c0,0-2.425,0-2.425,1.232l19.85,17.536c0.866,0.678,2.284,0.678,3.15,0l19.85-17.536
C63.096,25.904,62.1,25,61,25H23z"/>
<path fill="#A5000C" d="M23,27c0,0-3,0.138-3-1.095l20.425-15.466c0.866-0.678,2.284-0.644,3.15,0.034L63,25.888
C62.671,26.216,62.1,27,61,27H23z"/>
<path fill="#A5000C" d="M42,44.275c-0.559,0-1.092-0.16-1.502-0.452l-0.064-0.046L25,30.587V18h34v12.587l-15.434,13.19
l-0.064,0.046C43.092,44.115,42.559,44.275,42,44.275z"/>
<path fill="#FFFFFF" d="M26,19v11.168L26.846,31l14.233,12.009c0.238,0.171,0.571,0.269,0.921,0.269s0.683-0.098,0.921-0.269
L57.154,31L58,30.168V19H26z"/>
<path fill="#A5000C" d="M29,25h26v1H29V25z M29,28h21v1H29V28z M29,31h21v1H29V31z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="85px" height="66px" viewBox="0 0 85 66" enable-background="new 0 0 85 66" xml:space="preserve">
<path fill="#D6BD05" d="M64,49c0,1.65-1.35,3-3,3H22c-1.65,0-3-1.35-3-3V28c0-1.65,1.35-3,3-3h39c1.65,0,3,1.35,3,3V49z"/>
<path fill="#FFFF91" d="M22,51c-1.1,0-2-0.9-2-2V28c0-1.1,0.9-2,2-2h39c1.1,0,2,0.9,2,2v21c0,1.1-0.9,2-2,2H22z"/>
<path fill="#D6BD05" d="M60,52c2,0,2-1.094,2.425-1.094l-19.85-15.467c-0.866-0.68-2.284-0.645-3.15,0.035l-19.85,15.414
C20,51,20.9,52,22,52H60z"/>
<path fill="#FFFF91" d="M41,36c0.369,0,0.719-0.029,0.959,0.158L61.1,51H20.9l19.141-14.842C40.281,35.971,40.631,36,41,36z"/>
<path fill="#D6BD05" d="M23,25c0,0-2.425,0-2.425,1.232l19.85,17.536c0.866,0.678,2.284,0.678,3.15,0l19.85-17.536
C63.096,25.904,62.1,25,61,25H23z"/>
<path fill="#D6BD05" d="M23,27c0,0-3,0.138-3-1.095l20.425-15.466c0.866-0.678,2.284-0.644,3.15,0.034L63,25.888
C62.671,26.216,62.1,27,61,27H23z"/>
<path fill="#D6BD05" d="M42,44.275c-0.559,0-1.092-0.16-1.502-0.452l-0.064-0.046L25,30.587V18h34v12.587l-15.434,13.19
l-0.064,0.046C43.092,44.115,42.559,44.275,42,44.275z"/>
<path fill="#FFFFFF" d="M26,19v11.168L26.846,31l14.233,12.009c0.238,0.171,0.571,0.269,0.921,0.269s0.683-0.098,0.921-0.269
L57.154,31L58,30.168V19H26z"/>
<path fill="#EAE78B" d="M29,25h26v1H29V25z M29,28h21v1H29V28z M29,31h21v1H29V31z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -210,8 +210,15 @@ h1 {
<xml id="toolbox" style="display: none">
<category name="Events">
<block type="event_whenflagclicked"></block>
<block type="event_whenbroadcastreceived"></block>
<block type="event_broadcast"></block>
<block type="event_whenbroadcastreceived">
<value name="CHOICE">
<shadow type="dropdown_whenbroadcast">
<field name="CHOICE">blue</field>
</shadow>
</value>
</block>
<block type="event_broadcast">
</block>
<block type="event_broadcast_text">
<value name="STRING">
<shadow type="text">
@ -241,7 +248,8 @@ h1 {
</category>
<category name="Wedo">
<block type="wedo_setcolor"></block>
<block type="wedo_setcolor">
</block>
<block type="wedo_motorclockwise">
<value name="DURATION">
<shadow type="math_number">
@ -256,8 +264,10 @@ h1 {
</shadow>
</value>
</block>
<block type="wedo_motorspeed"></block>
<block type="wedo_whentilt"></block>
<block type="wedo_motorspeed">
</block>
<block type="wedo_whentilt">
</block>
<block type="wedo_whendistanceclose"></block>
</category>
</xml>

View file

@ -185,8 +185,15 @@ h1 {
<xml id="toolbox_categories" style="display: none">
<category name="Events">
<block type="event_whenflagclicked"></block>
<block type="event_whenbroadcastreceived"></block>
<block type="event_broadcast"></block>
<block type="event_whenbroadcastreceived">
<value name="CHOICE">
<shadow type="dropdown_whenbroadcast">
<field name="CHOICE">blue</field>
</shadow>
</value>
</block>
<block type="event_broadcast">
</block>
<block type="event_broadcast_text">
<value name="STRING">
<shadow type="text">
@ -216,7 +223,8 @@ h1 {
</category>
<category name="Wedo">
<block type="wedo_setcolor"></block>
<block type="wedo_setcolor">
</block>
<block type="wedo_motorclockwise">
<value name="DURATION">
<shadow type="math_number">
@ -231,8 +239,10 @@ h1 {
</shadow>
</value>
</block>
<block type="wedo_motorspeed"></block>
<block type="wedo_whentilt"></block>
<block type="wedo_motorspeed">
</block>
<block type="wedo_whentilt">
</block>
<block type="wedo_whendistanceclose"></block>
</category>
</xml>

View file

@ -15,8 +15,7 @@
<script src="../blocks/text.js"></script>
<script src="../blocks_horizontal/control.js"></script>
<script src="../blocks_horizontal/event.js"></script>
<script src="../blocks_horizontal/looks.js"></script>
<script src="../blocks_horizontal/motion.js"></script>
<script src="../blocks_horizontal/wedo.js"></script>
<script>
'use strict';
// Depending on the URL argument, render as LTR or RTL.
@ -87,23 +86,27 @@ h1 {
<div id="blocklyDiv"></div>
<xml id="toolbox" style="display: none">
<category name="Looks">
<block type="looks_say">
<value name="MESSAGE">
<shadow type="text">
<field name="TEXT">Hey!</field>
<category name="Events">
<block type="event_whenflagclicked"></block>
<block type="event_whenbroadcastreceived">
<value name="CHOICE">
<shadow type="dropdown_whenbroadcast">
<field name="CHOICE">blue</field>
</shadow>
</value>
</block>
<block type="event_broadcast">
</block>
<block type="event_broadcast_text">
<value name="STRING">
<shadow type="text">
<field name="TEXT">Hi</field>
</shadow>
</value>
</block>
</category>
<category name="Events">
<block type="event_whenflagclicked"></block>
</category>
<category name="Motion">
<block type="motion_moveright"></block>
</category>
<!-- <block type="control_repeat"></block> -->
<category name="Pants">
<category name="Control">
<block type="control_forever"></block>
<block type="control_repeat">
<value name="TIMES">
@ -112,6 +115,38 @@ h1 {
</shadow>
</value>
</block>
<block type="control_stop"></block>
<block type="control_wait">
<value name="DURATION">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
</category>
<category name="Wedo">
<block type="wedo_setcolor">
</block>
<block type="wedo_motorclockwise">
<value name="DURATION">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
<block type="wedo_motorcounterclockwise">
<value name="DURATION">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
<block type="wedo_motorspeed">
</block>
<block type="wedo_whentilt">
</block>
<block type="wedo_whendistanceclose"></block>
</category>
</xml>

View file

@ -11,7 +11,9 @@
<script src="../generators/javascript/event.js"></script>
<script src="../msg/messages.js"></script>
<script src="../blocks/math.js"></script>
<script src="../blocks/text.js"></script>
<script src="../blocks_horizontal/control.js"></script>
<script src="../blocks_horizontal/dropdown.js"></script>
<script src="../blocks_horizontal/event.js"></script>
<script src="../blocks_horizontal/wedo.js"></script>
<script>
@ -151,8 +153,22 @@ h1 {
<xml id="toolbox" style="display: none">
<category name="Events">
<block type="event_whenflagclicked"></block>
<block type="event_whenbroadcastreceived"></block>
<block type="event_broadcast"></block>
<block type="event_whenbroadcastreceived">
<value name="CHOICE">
<shadow type="dropdown_whenbroadcast">
<field name="CHOICE">blue</field>
</shadow>
</value>
</block>
<block type="event_broadcast">
</block>
<block type="event_broadcast_text">
<value name="STRING">
<shadow type="text">
<field name="TEXT">Hi</field>
</shadow>
</value>
</block>
</category>
<category name="Control">
@ -175,7 +191,8 @@ h1 {
</category>
<category name="Wedo">
<block type="wedo_setcolor"></block>
<block type="wedo_setcolor">
</block>
<block type="wedo_motorclockwise">
<value name="DURATION">
<shadow type="math_number">
@ -190,8 +207,10 @@ h1 {
</shadow>
</value>
</block>
<block type="wedo_motorspeed"></block>
<block type="wedo_whentilt"></block>
<block type="wedo_motorspeed">
</block>
<block type="wedo_whentilt">
</block>
<block type="wedo_whendistanceclose"></block>
</category>
</xml>