// Do not edit this file; automatically generated by build.py.
'use strict';


// Copyright 2012 Google Inc.  Apache License 2.0
Blockly.Blocks.colour={};Blockly.Blocks.colour.HUE=20;Blockly.Blocks.colour_picker={init:function(){this.jsonInit({message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",colour:Blockly.Blocks.colour.HUE,helpUrl:Blockly.Msg.COLOUR_PICKER_HELPURL});var a=this;this.setTooltip(function(){var b=a.getParent();return b&&b.getInputsInline()&&b.tooltip||Blockly.Msg.COLOUR_PICKER_TOOLTIP})}};
Blockly.Blocks.colour_random={init:function(){this.jsonInit({message0:Blockly.Msg.COLOUR_RANDOM_TITLE,output:"Colour",colour:Blockly.Blocks.colour.HUE,tooltip:Blockly.Msg.COLOUR_RANDOM_TOOLTIP,helpUrl:Blockly.Msg.COLOUR_RANDOM_HELPURL})}};
Blockly.Blocks.colour_rgb={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_RGB_HELPURL);this.setColour(Blockly.Blocks.colour.HUE);this.appendValueInput("RED").setCheck(Blockly.Types.NUMBER.checkList).setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_TITLE).appendField(Blockly.Msg.COLOUR_RGB_RED);this.appendValueInput("GREEN").setCheck(Blockly.Types.NUMBER.checkList).setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_GREEN);this.appendValueInput("BLUE").setCheck(Blockly.Types.NUMBER.checkList).setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_BLUE);
this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_RGB_TOOLTIP)}};
Blockly.Blocks.colour_blend={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_BLEND_HELPURL);this.setColour(Blockly.Blocks.colour.HUE);this.appendValueInput("COLOUR1").setCheck("Colour").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_TITLE).appendField(Blockly.Msg.COLOUR_BLEND_COLOUR1);this.appendValueInput("COLOUR2").setCheck("Colour").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_COLOUR2);this.appendValueInput("RATIO").setCheck(Blockly.Types.NUMBER.checkList).setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_RATIO);
this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_BLEND_TOOLTIP)}};Blockly.Blocks.lists={};Blockly.Blocks.lists.HUE=260;Blockly.Blocks.lists_create_empty={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_CREATE_EMPTY_TITLE,output:"Array",colour:Blockly.Blocks.lists.HUE,tooltip:Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP,helpUrl:Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL})}};
Blockly.Blocks.lists_create_with={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_CREATE_WITH_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new Blockly.Mutator(["lists_create_with_item"]));this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),
10);this.updateShape_()},decompose:function(a){var b=a.newBlock("lists_create_with_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("lists_create_with_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)a.push(b.valueConnection_),b=b.nextConnection&&b.nextConnection.targetBlock();for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;
c&&-1==a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)Blockly.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;b++;a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||
this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+a);0==a&&b.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH)}for(;this.getInput("ADD"+a);)this.removeInput("ADD"+a),a++}};
Blockly.Blocks.lists_create_with_container={init:function(){this.setColour(Blockly.Blocks.lists.HUE);this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.lists_create_with_item={init:function(){this.setColour(Blockly.Blocks.lists.HUE);this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.lists_repeat={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_REPEAT_TITLE,args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:Blockly.Types.NUMBER.checkList}],output:"Array",colour:Blockly.Blocks.lists.HUE,tooltip:Blockly.Msg.LISTS_REPEAT_TOOLTIP,helpUrl:Blockly.Msg.LISTS_REPEAT_HELPURL})}};
Blockly.Blocks.lists_length={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_LENGTH_TITLE,args0:[{type:"input_value",name:"VALUE",check:Blockly.Types.TEXT.checkList.concat("Array")}],output:Blockly.Types.NUMBER.output,colour:Blockly.Blocks.lists.HUE,tooltip:Blockly.Msg.LISTS_LENGTH_TOOLTIP,helpUrl:Blockly.Msg.LISTS_LENGTH_HELPURL})}};
Blockly.Blocks.lists_isEmpty={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_ISEMPTY_TITLE,args0:[{type:"input_value",name:"VALUE",check:Blockly.Types.TEXT.checkList.concat("Array")}],output:Blockly.Types.BOOLEAN.output,colour:Blockly.Blocks.lists.HUE,tooltip:Blockly.Msg.LISTS_ISEMPTY_TOOLTIP,helpUrl:Blockly.Msg.LISTS_ISEMPTY_HELPURL})}};
Blockly.Blocks.lists_indexOf={init:function(){var a=[[Blockly.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[Blockly.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_INDEX_OF_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.setOutput(!0,Blockly.Types.NUMBER.output);this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);this.appendValueInput("FIND").appendField(new Blockly.FieldDropdown(a),"END");this.setInputsInline(!0);this.setTooltip(Blockly.Msg.LISTS_INDEX_OF_TOOLTIP)}};
Blockly.Blocks.lists_getIndex={init:function(){var a=[[Blockly.Msg.LISTS_GET_INDEX_GET,"GET"],[Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[Blockly.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl(Blockly.Msg.LISTS_GET_INDEX_HELPURL);
this.setColour(Blockly.Blocks.lists.HUE);a=new Blockly.FieldDropdown(a,function(a){this.sourceBlock_.updateStatement_("REMOVE"==a)});this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);this.appendDummyInput().appendField(a,"MODE").appendField("","SPACE");this.appendDummyInput("AT");Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_INDEX_TAIL);this.setInputsInline(!0);this.setOutput(!0);this.updateAt_(!0);
var b=this;this.setTooltip(function(){var a=b.getFieldValue("MODE")+"_"+b.getFieldValue("WHERE");return Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_"+a]})},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("statement",!this.outputConnection);var b=this.getInput("AT").type==Blockly.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("statement");this.updateStatement_(b);a="false"!=a.getAttribute("at");this.updateAt_(a)},updateStatement_:function(a){a!=
!this.outputConnection&&(this.unplug(!0,!0),a?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck(Blockly.Types.NUMBER.checkList),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new Blockly.FieldDropdown(this.WHERE_OPTIONS,
function(b){var d="FROM_START"==b||"FROM_END"==b;if(d!=a){var e=this.sourceBlock_;e.updateAt_(d);e.setFieldValue(b,"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE");Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};
Blockly.Blocks.lists_setIndex={init:function(){var a=[[Blockly.Msg.LISTS_SET_INDEX_SET,"SET"],[Blockly.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl(Blockly.Msg.LISTS_SET_INDEX_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);
this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"MODE").appendField("","SPACE");this.appendDummyInput("AT");this.appendValueInput("TO").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.LISTS_SET_INDEX_TOOLTIP);this.updateAt_(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("MODE")+"_"+b.getFieldValue("WHERE");return Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_"+a]})},
mutationToDom:function(){var a=document.createElement("mutation"),b=this.getInput("AT").type==Blockly.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){a="false"!=a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck(Blockly.Types.NUMBER.checkList),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");
var b=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(b){var d="FROM_START"==b||"FROM_END"==b;if(d!=a){var e=this.sourceBlock_;e.updateAt_(d);e.setFieldValue(b,"WHERE");return null}});this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO");this.getInput("AT").appendField(b,"WHERE")}};
Blockly.Blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_GET_SUBLIST_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);
this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);this.appendDummyInput("AT1");this.appendDummyInput("AT2");Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_SUBLIST_TAIL);this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip(Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation"),b=this.getInput("AT1").type==
Blockly.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type==Blockly.INPUT_VALUE;a.setAttribute("at2",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck(Blockly.Types.NUMBER.checkList),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):
this.appendDummyInput("AT"+a);var c=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+a],function(c){var e="FROM_START"==c||"FROM_END"==c;if(e!=b){var f=this.sourceBlock_;f.updateAt_(a,e);f.setFieldValue(c,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,"WHERE"+a);1==a&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"));Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};
Blockly.Blocks.lists_sort={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[Blockly.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[Blockly.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[Blockly.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[Blockly.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",colour:Blockly.Blocks.lists.HUE,
tooltip:Blockly.Msg.LISTS_SORT_TOOLTIP,helpUrl:Blockly.Msg.LISTS_SORT_HELPURL})}};
Blockly.Blocks.lists_split={init:function(){var a=this,b=new Blockly.FieldDropdown([[Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(b){a.updateType_(b)});this.setHelpUrl(Blockly.Msg.LISTS_SPLIT_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.appendValueInput("INPUT").setCheck(Blockly.Types.TEXT.checkList).appendField(b,"MODE");this.appendValueInput("DELIM").setCheck(Blockly.Types.TEXT.checkList).appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);this.setInputsInline(!0);
this.setOutput(!0,"Array");this.setTooltip(function(){var b=a.getFieldValue("MODE");if("SPLIT"==b)return Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==b)return Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw"Unknown mode: "+b;})},updateType_:function(a){"SPLIT"==a?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck(Blockly.Types.TEXT.checkList)):(this.outputConnection.setCheck(Blockly.Types.TEXT.checkList),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=
document.createElement("mutation");a.setAttribute("mode",this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))}};Blockly.Blocks.logic={};Blockly.Blocks.logic.HUE=210;
Blockly.Blocks.controls_if={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_IF_HELPURL);this.setColour("#7365CF");this.appendValueInput("IF0").setCheck(Blockly.Types.BOOLEAN.checkList).appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);this.appendStatementInput("DO0").appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setMutator(new Blockly.Mutator(["controls_if_elseif","controls_if_else"]));var a=this;this.setTooltip(function(){if(a.elseifCount_||
a.elseCount_){if(!a.elseifCount_&&a.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_2;if(a.elseifCount_&&!a.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_3;if(a.elseifCount_&&a.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_4}else return Blockly.Msg.CONTROLS_IF_TOOLTIP_1;return""});this.elseCount_=this.elseifCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=document.createElement("mutation");this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_);
this.elseCount_&&a.setAttribute("else",1);return a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0;this.elseCount_=parseInt(a.getAttribute("else"),10)||0;this.updateShape_()},decompose:function(a){var b=a.newBlock("controls_if_if");b.initSvg();for(var c=b.nextConnection,d=1;d<=this.elseifCount_;d++){var e=a.newBlock("controls_if_elseif");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}this.elseCount_&&(a=a.newBlock("controls_if_else"),a.initSvg(),
c.connect(a.previousConnection));return b},compose:function(a){var b=a.nextConnection.targetBlock();this.elseCount_=this.elseifCount_=0;a=[null];for(var c=[null],d=null;b;){switch(b.type){case "controls_if_elseif":this.elseifCount_++;a.push(b.valueConnection_);c.push(b.statementConnection_);break;case "controls_if_else":this.elseCount_++;d=b.statementConnection_;break;default:throw"Unknown block type.";}b=b.nextConnection&&b.nextConnection.targetBlock()}this.updateShape_();for(b=1;b<=this.elseifCount_;b++)Blockly.Mutator.reconnect(a[b],
this,"IF"+b),Blockly.Mutator.reconnect(c[b],this,"DO"+b);Blockly.Mutator.reconnect(d,this,"ELSE")},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){switch(a.type){case "controls_if_elseif":var c=this.getInput("IF"+b),d=this.getInput("DO"+b);a.valueConnection_=c&&c.connection.targetConnection;a.statementConnection_=d&&d.connection.targetConnection;b++;break;case "controls_if_else":d=this.getInput("ELSE");a.statementConnection_=d&&d.connection.targetConnection;break;default:throw"Unknown block type.";
}a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);)this.removeInput("IF"+a),this.removeInput("DO"+a),a++;for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)}};
Blockly.Blocks.controls_if_if={init:function(){this.setColour("#7365CF");this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.controls_if_elseif={init:function(){this.setColour("#7365CF");this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.controls_if_else={init:function(){this.setColour("#7365CF");this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);this.setPreviousStatement(!0);this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.logic_compare={init:function(){var a=this.RTL?[["=","EQ"],["\u2260","NEQ"],[">","LT"],["\u2265","LTE"],["<","GT"],["\u2264","GTE"]]:[["=","EQ"],["\u2260","NEQ"],["<","LT"],["\u2264","LTE"],[">","GT"],["\u2265","GTE"]];this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL);this.setColour("#7365CF");this.setOutput(!0,Blockly.Types.BOOLEAN.output);this.appendValueInput("A");this.appendValueInput("B").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=
b.getFieldValue("OP");return{EQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[a]});this.prevBlocks_=[null,null]},onchange:function(a){var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");if(b&&c&&!b.outputConnection.checkType_(c.outputConnection)){Blockly.Events.setGroup(a.group);for(a=0;a<
this.prevBlocks_.length;a++){var d=this.prevBlocks_[a];if(d===b||d===c)d.unplug(),d.bumpNeighbours_()}Blockly.Events.setGroup(!1)}this.prevBlocks_[0]=b;this.prevBlocks_[1]=c},getBlockType:function(){return Blockly.Types.BOOLEAN}};
Blockly.Blocks.logic_operation={init:function(){var a=[[Blockly.Msg.LOGIC_OPERATION_AND,"AND"],[Blockly.Msg.LOGIC_OPERATION_OR,"OR"]];this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL);this.setColour("#7365CF");this.setOutput(!0,Blockly.Types.BOOLEAN.output);this.appendValueInput("A").setCheck(Blockly.Types.BOOLEAN.checkList);this.appendValueInput("B").setCheck(Blockly.Types.BOOLEAN.checkList).appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=
b.getFieldValue("OP");return{AND:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND,OR:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR}[a]})},getBlockType:function(){return Blockly.Types.BOOLEAN}};Blockly.Blocks.logic_negate={init:function(){this.jsonInit({message0:Blockly.Msg.LOGIC_NEGATE_TITLE,args0:[{type:"input_value",name:"BOOL",check:Blockly.Types.BOOLEAN.checkList}],output:Blockly.Types.BOOLEAN.output,colour:"#7365CF",tooltip:Blockly.Msg.LOGIC_NEGATE_TOOLTIP,helpUrl:Blockly.Msg.LOGIC_NEGATE_HELPURL})},getBlockType:function(){return Blockly.Types.BOOLEAN}};
Blockly.Blocks.logic_boolean={init:function(){this.jsonInit({message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[[Blockly.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[Blockly.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]]}],output:Blockly.Types.BOOLEAN.output,colour:"#7365CF",tooltip:Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP,helpUrl:Blockly.Msg.LOGIC_BOOLEAN_HELPURL})},getBlockType:function(){return Blockly.Types.BOOLEAN}};
Blockly.Blocks.logic_null={init:function(){this.jsonInit({message0:Blockly.Msg.LOGIC_NULL,output:Blockly.Types.NULL.output,colour:"#7365CF",tooltip:Blockly.Msg.LOGIC_NULL_TOOLTIP,helpUrl:Blockly.Msg.LOGIC_NULL_HELPURL})},getBlockType:function(){return Blockly.Types.NULL}};
Blockly.Blocks.logic_ternary={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_TERNARY_HELPURL);this.setColour("#7365CF");this.appendValueInput("IF").setCheck(Blockly.Types.BOOLEAN.checkList).appendField(Blockly.Msg.LOGIC_TERNARY_CONDITION);this.appendValueInput("THEN").appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE);this.appendValueInput("ELSE").appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE);this.setOutput(!0);this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP);this.prevParentConnection_=null},onchange:function(a){var b=
this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;2>e;e++){var f=1==e?b:c;f&&!f.outputConnection.checkType_(d)&&(Blockly.Events.setGroup(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours_()):(f.unplug(),f.bumpNeighbours_()),Blockly.Events.setGroup(!1))}this.prevParentConnection_=d}};Blockly.Blocks.loops={};Blockly.Blocks.loops.HUE=120;Blockly.Blocks.controls_repeat_ext={init:function(){this.jsonInit({message0:Blockly.Msg.CONTROLS_REPEAT_TITLE,args0:[{type:"input_value",name:"TIMES",check:Blockly.Types.NUMBER.checkList}],previousStatement:null,nextStatement:null,colour:"#7FCE3D",tooltip:Blockly.Msg.CONTROLS_REPEAT_TOOLTIP,helpUrl:Blockly.Msg.CONTROLS_REPEAT_HELPURL});this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO)}};
Blockly.Blocks.controls_repeat={init:function(){this.jsonInit({message0:Blockly.Msg.CONTROLS_REPEAT_TITLE,args0:[{type:"field_number",name:"TIMES",check:Blockly.Types.NUMBER.checkList,text:"10"}],previousStatement:null,nextStatement:null,colour:"#7FCE3D",tooltip:Blockly.Msg.CONTROLS_REPEAT_TOOLTIP,helpUrl:Blockly.Msg.CONTROLS_REPEAT_HELPURL});this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);this.getField("TIMES").setValidator(Blockly.FieldTextInput.nonnegativeIntegerValidator)}};
Blockly.Blocks.controls_whileUntil={init:function(){var a=[[Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"WHILE"],[Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"UNTIL"]];this.setHelpUrl(Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL);this.setColour("#7FCE3D");this.appendValueInput("BOOL").setCheck(Blockly.Types.BOOLEAN.checkList).appendField(new Blockly.FieldDropdown(a),"MODE");this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO);this.setPreviousStatement(!0);this.setNextStatement(!0);
var b=this;this.setTooltip(function(){var a=b.getFieldValue("MODE");return{WHILE:Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,UNTIL:Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}[a]})}};
Blockly.Blocks.controls_for={init:function(){this.jsonInit({message0:Blockly.Msg.CONTROLS_FOR_TITLE,args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:Blockly.Types.NUMBER.checkList,align:"RIGHT"},{type:"input_value",name:"TO",check:Blockly.Types.NUMBER.checkList,align:"RIGHT"},{type:"input_value",name:"BY",check:Blockly.Types.NUMBER.checkList,align:"RIGHT"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:"#7FCE3D",helpUrl:Blockly.Msg.CONTROLS_FOR_HELPURL});
this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOR_INPUT_DO);var a=this;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOR_TOOLTIP.replace("%1",a.getFieldValue("VAR"))})},customContextMenu:function(a){if(!this.isCollapsed()){var b={enabled:!0},c=this.getFieldValue("VAR");b.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c);c=goog.dom.createDom("field",null,c);c.setAttribute("name","VAR");c=goog.dom.createDom("block",null,c);c.setAttribute("type","variables_get");b.callback=
Blockly.ContextMenu.callbackFactory(this,c);a.push(b)}},getVarType:function(a){return Blockly.Types.NUMBER}};
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:Blockly.Types.ARRAY.checkList}],previousStatement:null,nextStatement:null,colour:"#7FCE3D",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,getVarType:function(a){return Blockly.Types.NUMBER}};
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("#7FCE3D");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.Blocks.math={};Blockly.Blocks.math.HUE=230;
Blockly.Blocks.math_number={init:function(){this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);this.setColour("#00B3CE");this.appendDummyInput().appendField(new Blockly.FieldTextInput("0",Blockly.FieldTextInput.numberValidator),"NUM");this.setOutput(!0,Blockly.Types.NUMBER.output);var a=this;this.setTooltip(function(){var b=a.getParent();return b&&b.getInputsInline()&&b.tooltip||Blockly.Msg.MATH_NUMBER_TOOLTIP})},getBlockType:function(){var a=this.getFieldValue("NUM");return Blockly.Types.identifyNumber(a)}};
Blockly.Blocks.math_arithmetic={init:function(){this.jsonInit({message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:Blockly.Types.NUMBER.checkList},{type:"field_dropdown",name:"OP",options:[[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"]]},{type:"input_value",name:"B",check:Blockly.Types.NUMBER.checkList}],inputsInline:!0,
output:Blockly.Types.NUMBER.output,colour:"#00B3CE",helpUrl:Blockly.Msg.MATH_ARITHMETIC_HELPURL});var a=this;this.setTooltip(function(){var b=a.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}[b]})}};
Blockly.Blocks.math_single={init:function(){this.jsonInit({message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[[Blockly.Msg.MATH_SINGLE_OP_ROOT,"ROOT"],[Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE,"ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:Blockly.Types.DECIMAL.checkList}],output:Blockly.Types.DECIMAL.output,colour:"#00B3CE",helpUrl:Blockly.Msg.MATH_SINGLE_HELPURL});var a=this;this.setTooltip(function(){var b=a.getFieldValue("OP");
return{ROOT:Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT,ABS:Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS,NEG:Blockly.Msg.MATH_SINGLE_TOOLTIP_NEG,LN:Blockly.Msg.MATH_SINGLE_TOOLTIP_LN,LOG10:Blockly.Msg.MATH_SINGLE_TOOLTIP_LOG10,EXP:Blockly.Msg.MATH_SINGLE_TOOLTIP_EXP,POW10:Blockly.Msg.MATH_SINGLE_TOOLTIP_POW10}[b]})},getBlockType:function(){return Blockly.Types.DECIMAL}};
Blockly.Blocks.math_trig={init:function(){this.jsonInit({message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[[Blockly.Msg.MATH_TRIG_SIN,"SIN"],[Blockly.Msg.MATH_TRIG_COS,"COS"],[Blockly.Msg.MATH_TRIG_TAN,"TAN"],[Blockly.Msg.MATH_TRIG_ASIN,"ASIN"],[Blockly.Msg.MATH_TRIG_ACOS,"ACOS"],[Blockly.Msg.MATH_TRIG_ATAN,"ATAN"]]},{type:"input_value",name:"NUM",check:Blockly.Types.DECIMAL.checkList}],output:Blockly.Types.DECIMAL.output,colour:"#00B3CE",helpUrl:Blockly.Msg.MATH_TRIG_HELPURL});var a=
this;this.setTooltip(function(){var b=a.getFieldValue("OP");return{SIN:Blockly.Msg.MATH_TRIG_TOOLTIP_SIN,COS:Blockly.Msg.MATH_TRIG_TOOLTIP_COS,TAN:Blockly.Msg.MATH_TRIG_TOOLTIP_TAN,ASIN:Blockly.Msg.MATH_TRIG_TOOLTIP_ASIN,ACOS:Blockly.Msg.MATH_TRIG_TOOLTIP_ACOS,ATAN:Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN}[b]})},getBlockType:function(){return Blockly.Types.DECIMAL}};
Blockly.Blocks.math_constant={init:function(){this.jsonInit({message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:Blockly.Types.DECIMAL.output,colour:"#00B3CE",tooltip:Blockly.Msg.MATH_CONSTANT_TOOLTIP,helpUrl:Blockly.Msg.MATH_CONSTANT_HELPURL})}};
Blockly.Blocks.math_number_property={init:function(){var a=[[Blockly.Msg.MATH_IS_EVEN,"EVEN"],[Blockly.Msg.MATH_IS_ODD,"ODD"],[Blockly.Msg.MATH_IS_PRIME,"PRIME"],[Blockly.Msg.MATH_IS_WHOLE,"WHOLE"],[Blockly.Msg.MATH_IS_POSITIVE,"POSITIVE"],[Blockly.Msg.MATH_IS_NEGATIVE,"NEGATIVE"],[Blockly.Msg.MATH_IS_DIVISIBLE_BY,"DIVISIBLE_BY"]];this.setColour("#00B3CE");this.appendValueInput("NUMBER_TO_CHECK").setCheck(Blockly.Types.NUMBER.checkList);a=new Blockly.FieldDropdown(a,function(a){this.sourceBlock_.updateShape_("DIVISIBLE_BY"==
a)});this.appendDummyInput().appendField(a,"PROPERTY");this.setInputsInline(!0);this.setOutput(!0,Blockly.Types.BOOLEAN.output);this.setTooltip(Blockly.Msg.MATH_IS_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation"),b="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");a.setAttribute("divisor_input",b);return a},domToMutation:function(a){a="true"==a.getAttribute("divisor_input");this.updateShape_(a)},updateShape_:function(a){var b=this.getInput("DIVISOR");a?b||this.appendValueInput("DIVISOR").setCheck(Blockly.Types.NUMBER.checkList):
b&&this.removeInput("DIVISOR")},getBlockType:function(){return Blockly.Types.BOOLEAN}};
Blockly.Blocks.math_change={init:function(){this.jsonInit({message0:Blockly.Msg.MATH_CHANGE_TITLE,args0:[{type:"field_variable",name:"VAR",variable:Blockly.Msg.MATH_CHANGE_TITLE_ITEM},{type:"input_value",name:"DELTA",check:Blockly.Types.NUMBER.checkList,align:"RIGHT"}],previousStatement:null,nextStatement:null,colour:"#00B3CE",helpUrl:Blockly.Msg.MATH_CHANGE_HELPURL});var a=this;this.setTooltip(function(){return Blockly.Msg.MATH_CHANGE_TOOLTIP.replace("%1",a.getFieldValue("VAR"))})},getVarType:function(a){return Blockly.Types.NUMBER}};
Blockly.Blocks.math_round={init:function(){this.jsonInit({message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[[Blockly.Msg.MATH_ROUND_OPERATOR_ROUND,"ROUND"],[Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP,"ROUNDUP"],[Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN,"ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:Blockly.Types.DECIMAL.checkList}],output:Blockly.Types.DECIMAL.output,colour:"#00B3CE",tooltip:Blockly.Msg.MATH_ROUND_TOOLTIP,helpUrl:Blockly.Msg.MATH_ROUND_HELPURL})},getBlockType:function(){return Blockly.Types.DECIMAL}};
Blockly.Blocks.math_on_list={init:function(){var a=[[Blockly.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[Blockly.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"],[Blockly.Msg.MATH_ONLIST_OPERATOR_RANDOM,"RANDOM"]],b=this;this.setHelpUrl(Blockly.Msg.MATH_ONLIST_HELPURL);this.setColour("#00B3CE");
this.setOutput(!0,Blockly.Types.NUMBER.output);a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendValueInput("LIST").setCheck(Blockly.Types.ARRAY.checkList).appendField(a,"OP");this.setTooltip(function(){var a=b.getFieldValue("OP");return{SUM:Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM,MIN:Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN,MAX:Blockly.Msg.MATH_ONLIST_TOOLTIP_MAX,AVERAGE:Blockly.Msg.MATH_ONLIST_TOOLTIP_AVERAGE,MEDIAN:Blockly.Msg.MATH_ONLIST_TOOLTIP_MEDIAN,MODE:Blockly.Msg.MATH_ONLIST_TOOLTIP_MODE,
STD_DEV:Blockly.Msg.MATH_ONLIST_TOOLTIP_STD_DEV,RANDOM:Blockly.Msg.MATH_ONLIST_TOOLTIP_RANDOM}[a]})},updateType_:function(a){"MODE"==a?this.outputConnection.setCheck(Blockly.Types.ARRAY.output):this.outputConnection.setCheck(Blockly.Types.NUMBER.output)},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}};
Blockly.Blocks.math_modulo={init:function(){this.jsonInit({message0:Blockly.Msg.MATH_MODULO_TITLE,args0:[{type:"input_value",name:"DIVIDEND",check:Blockly.Types.NUMBER.checkList},{type:"input_value",name:"DIVISOR",check:Blockly.Types.NUMBER.checkList}],inputsInline:!0,output:Blockly.Types.NUMBER.output,colour:"#00B3CE",tooltip:Blockly.Msg.MATH_MODULO_TOOLTIP,helpUrl:Blockly.Msg.MATH_MODULO_HELPURL})},getBlockType:function(){return Blockly.Types.NUMBER}};
Blockly.Blocks.math_constrain={init:function(){this.jsonInit({message0:Blockly.Msg.MATH_CONSTRAIN_TITLE,args0:[{type:"input_value",name:"VALUE",check:Blockly.Types.NUMBER.checkList},{type:"input_value",name:"LOW",check:Blockly.Types.NUMBER.checkList},{type:"input_value",name:"HIGH",check:Blockly.Types.NUMBER.checkList}],inputsInline:!0,output:Blockly.Types.NUMBER.output,colour:"#00B3CE",tooltip:Blockly.Msg.MATH_CONSTRAIN_TOOLTIP,helpUrl:Blockly.Msg.MATH_CONSTRAIN_HELPURL})}};
Blockly.Blocks.math_random_int={init:function(){this.jsonInit({message0:Blockly.Msg.MATH_RANDOM_INT_TITLE,args0:[{type:"input_value",name:"FROM",check:Blockly.Types.NUMBER.checkList},{type:"input_value",name:"TO",check:Blockly.Types.NUMBER.checkList}],inputsInline:!0,output:Blockly.Types.NUMBER.output,colour:"#00B3CE",tooltip:Blockly.Msg.MATH_RANDOM_INT_TOOLTIP,helpUrl:Blockly.Msg.MATH_RANDOM_INT_HELPURL})},getBlockType:function(){return Blockly.Types.NUMBER}};
Blockly.Blocks.math_random_float={init:function(){this.jsonInit({message0:Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM,output:Blockly.Types.DECIMAL.output,colour:"#00B3CE",tooltip:Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP,helpUrl:Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL})},getBlockType:function(){return Blockly.Types.DECIMAL}};Blockly.Blocks.procedures={};Blockly.Blocks.procedures.HUE=290;
Blockly.Blocks.procedures_defnoreturn={init:function(){var a=new Blockly.FieldTextInput(Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT);this.setColour("#FFAFCC");this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);
this.arguments_=[];this.setStatements_(!0);this.statementConnection_=null},validate:function(){var a=Blockly.Procedures.findLegalName(this.getFieldValue("NAME"),this);this.setFieldValue(a,"NAME")},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){for(var a=!1,b={},c=
0;c<this.arguments_.length;c++){if(b["arg_"+this.arguments_[c].toLowerCase()]){a=!0;break}b["arg_"+this.arguments_[c].toLowerCase()]=!0}a?this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING):this.setWarningText(null);a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));Blockly.Events.disable();this.setFieldValue(a,"PARAMS");Blockly.Events.enable()},mutationToDom:function(a){var b=document.createElement("mutation");a&&b.setAttribute("name",
this.getFieldValue("NAME"));for(var c=0;c<this.arguments_.length;c++){var d=document.createElement("arg");d.setAttribute("name",this.arguments_[c]);a&&this.paramIds_&&d.setAttribute("paramId",this.paramIds_[c]);b.appendChild(d)}this.hasStatements_||b.setAttribute("statements","false");return b},domToMutation:function(a){this.arguments_=[];for(var b=0,c;c=a.childNodes[b];b++)"arg"==c.nodeName.toLowerCase()&&this.arguments_.push(c.getAttribute("name"));this.updateParams_();Blockly.Procedures.mutateCallers(this);
this.setStatements_("false"!==a.getAttribute("statements"))},decompose:function(a){var b=a.newBlock("procedures_mutatorcontainer");b.initSvg();this.getInput("RETURN")?b.setFieldValue(this.hasStatements_?"TRUE":"FALSE","STATEMENTS"):b.getInput("STATEMENT_INPUT").setVisible(!1);for(var c=b.getInput("STACK").connection,d=0;d<this.arguments_.length;d++){var e=a.newBlock("procedures_mutatorarg");e.initSvg();e.setFieldValue(this.arguments_[d],"NAME");e.oldLocation=d;c.connect(e.previousConnection);c=e.nextConnection}Blockly.Procedures.mutateCallers(this);
return b},compose:function(a){this.arguments_=[];this.paramIds_=[];for(var b=a.getInputTargetBlock("STACK");b;)this.arguments_.push(b.getFieldValue("NAME")),this.paramIds_.push(b.id),b=b.nextConnection&&b.nextConnection.targetBlock();this.updateParams_();Blockly.Procedures.mutateCallers(this);a=a.getFieldValue("STATEMENTS");if(null!==a&&(a="TRUE"==a,this.hasStatements_!=a))if(a)this.setStatements_(!0),Blockly.Mutator.reconnect(this.statementConnection_,this,"STACK"),this.statementConnection_=null;
else{a=this.getInput("STACK").connection;if(this.statementConnection_=a.targetConnection)a=a.targetBlock(),a.unplug(),a.bumpNeighbours_();this.setStatements_(!1)}},dispose:function(){var a=this.getFieldValue("NAME");Blockly.Procedures.disposeCallers(a,this.workspace);this.constructor.prototype.dispose.apply(this,arguments)},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},renameVar:function(a,b){for(var c=!1,d=0;d<this.arguments_.length;d++)Blockly.Names.equals(a,
this.arguments_[d])&&(this.arguments_[d]=b,c=!0);if(c&&(this.updateParams_(),this.mutator.isVisible()))for(var c=this.mutator.workspace_.getAllBlocks(),d=0,e;e=c[d];d++)"procedures_mutatorarg"==e.type&&Blockly.Names.equals(a,e.getFieldValue("NAME"))&&e.setFieldValue(b,"NAME")},customContextMenu:function(a){var b={enabled:!0},c=this.getFieldValue("NAME");b.text=Blockly.Msg.PROCEDURES_CREATE_DO.replace("%1",c);var d=goog.dom.createDom("mutation");d.setAttribute("name",c);for(var e=0;e<this.arguments_.length;e++)c=
goog.dom.createDom("arg"),c.setAttribute("name",this.arguments_[e]),d.appendChild(c);d=goog.dom.createDom("block",null,d);d.setAttribute("type",this.callType_);b.callback=Blockly.ContextMenu.callbackFactory(this,d);a.push(b);if(!this.isCollapsed())for(e=0;e<this.arguments_.length;e++)b={enabled:!0},c=this.arguments_[e],b.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c),d=goog.dom.createDom("field",null,c),d.setAttribute("name","VAR"),d=goog.dom.createDom("block",null,d),d.setAttribute("type",
"variables_get"),b.callback=Blockly.ContextMenu.callbackFactory(this,d),a.push(b)},callType_:"procedures_callnoreturn",getVarType:function(a){return Blockly.Types.UNDEF},argsTypes:{},setArgsType:function(a){var b=this.arguments_,c;for(c in a)for(var d=0,e=b.length;d<e;d++)c===b[d]&&(this.argsTypes[c]=a[c])},getArgType:function(a){for(var b in this.argsTypes)if(b==a)return this.argsTypes[a];return null}};
Blockly.Blocks.procedures_defreturn={init:function(){var a=new Blockly.FieldTextInput(Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE,Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT);
this.setColour("#FFAFCC");this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);this.arguments_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:Blockly.Blocks.procedures_defnoreturn.setStatements_,validate:Blockly.Blocks.procedures_defnoreturn.validate,updateParams_:Blockly.Blocks.procedures_defnoreturn.updateParams_,mutationToDom:Blockly.Blocks.procedures_defnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_defnoreturn.domToMutation,
decompose:Blockly.Blocks.procedures_defnoreturn.decompose,compose:Blockly.Blocks.procedures_defnoreturn.compose,dispose:Blockly.Blocks.procedures_defnoreturn.dispose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:Blockly.Blocks.procedures_defnoreturn.getVars,renameVar:Blockly.Blocks.procedures_defnoreturn.renameVar,customContextMenu:Blockly.Blocks.procedures_defnoreturn.customContextMenu,callType_:"procedures_callreturn",getVarType:Blockly.Blocks.procedures_defnoreturn.getVarType,
argsTypes:{},setArgsType:Blockly.Blocks.procedures_defnoreturn.setArgsType,getArgType:Blockly.Blocks.procedures_defnoreturn.getArgType,getReturnType:function(){var a=Blockly.Types.NULL,b=this.getInputTargetBlock("RETURN");b&&(a=b.getBlockType?b.getBlockType():Blockly.Types.getChildBlockType(b));return a}};
Blockly.Blocks.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField(Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new Blockly.FieldCheckbox("TRUE"),"STATEMENTS");this.setColour("#FFAFCC");this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.procedures_mutatorarg={init:function(){this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(new Blockly.FieldTextInput("x",this.validator_),"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour("#FFAFCC");this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1},validator_:function(a){return(a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,""))||null}};
Blockly.Blocks.procedures_callnoreturn={init:function(){this.appendDummyInput("TOPROW").appendField(this.id,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour("#FFAFCC");this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.quarkConnections_={};this.quarkIds_=null},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){Blockly.Names.equals(a,this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?
Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=Blockly.Procedures.getDefinition(this.getProcedureCall(),this.workspace),d=c&&c.mutator&&c.mutator.isVisible();d||(this.quarkConnections_={},this.quarkIds_=null);if(b)if(goog.array.equals(this.arguments_,a))this.quarkIds_=b;else{if(b.length!=a.length)throw"Error: paramNames and paramIds must be the same length.";this.setCollapsed(!1);this.quarkIds_||
(this.quarkConnections_={},a.join("\n")==this.arguments_.join("\n")?this.quarkIds_=b:this.quarkIds_=[]);c=this.rendered;this.rendered=!1;for(var e=0;e<this.arguments_.length;e++){var f=this.getInput("ARG"+e);f&&(f=f.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=f,d&&f&&-1==b.indexOf(this.quarkIds_[e])&&(f.disconnect(),f.getSourceBlock().bumpNeighbours_()))}this.arguments_=[].concat(a);this.updateShape_();if(this.quarkIds_=b)for(e=0;e<this.arguments_.length;e++)d=this.quarkIds_[e],
d in this.quarkConnections_&&(f=this.quarkConnections_[d],Blockly.Mutator.reconnect(f,this,"ARG"+e)||delete this.quarkConnections_[d]);(this.rendered=c)&&this.render()}},updateShape_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);b?(Blockly.Events.disable(),b.setValue(this.arguments_[a]),Blockly.Events.enable()):(b=new Blockly.FieldLabel(this.arguments_[a]),this.appendValueInput("ARG"+a).setAlign(Blockly.ALIGN_RIGHT).appendField(b,"ARGNAME"+a).init())}for(;this.getInput("ARG"+
a);)this.removeInput("ARG"+a),a++;if(a=this.getInput("TOPROW"))this.arguments_.length?this.getField("WITH")||(a.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),a.init()):this.getField("WITH")&&a.removeField("WITH")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("name",this.getProcedureCall());for(var b=0;b<this.arguments_.length;b++){var c=document.createElement("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=
a.getAttribute("name");this.renameProcedure(this.getProcedureCall(),b);for(var b=[],c=[],d=0,e;e=a.childNodes[d];d++)"arg"==e.nodeName.toLowerCase()&&(b.push(e.getAttribute("name")),c.push(e.getAttribute("paramId")));this.setProcedureParameters_(b,c)},renameVar:function(a,b){for(var c=0;c<this.arguments_.length;c++)Blockly.Names.equals(a,this.arguments_[c])&&(this.arguments_[c]=b,this.getField("ARGNAME"+c).setValue(b))},customContextMenu:function(a){var b={enabled:!0};b.text=Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;
var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){var a=Blockly.Procedures.getDefinition(c,d);a&&a.select()};a.push(b)}};
Blockly.Blocks.procedures_callreturn={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setColour("#FFAFCC");this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.quarkConnections_={};this.quarkIds_=null},getProcedureCall:Blockly.Blocks.procedures_callnoreturn.getProcedureCall,renameProcedure:Blockly.Blocks.procedures_callnoreturn.renameProcedure,setProcedureParameters_:Blockly.Blocks.procedures_callnoreturn.setProcedureParameters_,
updateShape_:Blockly.Blocks.procedures_callnoreturn.updateShape_,mutationToDom:Blockly.Blocks.procedures_callnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_callnoreturn.domToMutation,renameVar:Blockly.Blocks.procedures_callnoreturn.renameVar,customContextMenu:Blockly.Blocks.procedures_callnoreturn.customContextMenu};
Blockly.Blocks.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck(Blockly.Types.BOOLEAN.checkList).appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour("#FFAFCC");this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},
mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("value",Number(this.hasReturnValue_));return a},domToMutation:function(a){this.hasReturnValue_=1==a.getAttribute("value");this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(a){a=!1;var b=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?("procedures_defnoreturn"==b.type&&
this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=b.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING)},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};Blockly.Blocks.texts={};Blockly.Blocks.texts.HUE=160;
Blockly.Blocks.text={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));this.setColour("#BD4F8C");this.setOutput(!0,Blockly.Types.TEXT.output);var a=this;this.setTooltip(function(){var b=a.getParent();return b&&b.getInputsInline()&&b.tooltip||Blockly.Msg.TEXT_TEXT_TOOLTIP})},newQuote_:function(a){return new Blockly.FieldImage(a==
this.RTL?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",
12,12,'"')},getBlockType:function(){return Blockly.Types.TEXT}};
Blockly.Blocks.text_join={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_JOIN_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.itemCount_=2;this.updateShape_();this.setOutput(!0,Blockly.Types.TEXT.output);this.setMutator(new Blockly.Mutator(["text_create_join_item"]));this.setTooltip(Blockly.Msg.TEXT_JOIN_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),
10);this.updateShape_()},decompose:function(a){var b=a.newBlock("text_create_join_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("text_create_join_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)a.push(b.valueConnection_),b=b.nextConnection&&b.nextConnection.targetBlock();for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;
c&&-1==a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)Blockly.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;b++;a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||
this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+a);0==a&&b.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH)}for(;this.getInput("ADD"+a);)this.removeInput("ADD"+a),a++},newQuote_:Blockly.Blocks.text.newQuote_,getBlockType:function(){return Blockly.Types.TEXT}};
Blockly.Blocks.text_create_join_container={init:function(){this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.text_create_join_item={init:function(){this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP);this.contextMenu=!1}};
Blockly.Blocks.text_append={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_APPEND_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendValueInput("TEXT").appendField(Blockly.Msg.TEXT_APPEND_TO).appendField(new Blockly.FieldVariable(Blockly.Msg.TEXT_APPEND_VARIABLE),"VAR").appendField(Blockly.Msg.TEXT_APPEND_APPENDTEXT);this.setPreviousStatement(!0);this.setNextStatement(!0);var a=this;this.setTooltip(function(){return Blockly.Msg.TEXT_APPEND_TOOLTIP.replace("%1",a.getFieldValue("VAR"))})},
getVarType:function(a){return Blockly.Types.TEXT}};Blockly.Blocks.text_length={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_LENGTH_TITLE,args0:[{type:"input_value",name:"VALUE",check:Blockly.Types.TEXT.checkList.concat("Array")}],output:Blockly.Types.NUMBER.output,colour:Blockly.Blocks.texts.HUE,tooltip:Blockly.Msg.TEXT_LENGTH_TOOLTIP,helpUrl:Blockly.Msg.TEXT_LENGTH_HELPURL})},getBlockType:function(){return Blockly.Types.NUMBER}};
Blockly.Blocks.text_isEmpty={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_ISEMPTY_TITLE,args0:[{type:"input_value",name:"VALUE",check:Blockly.Types.TEXT.checkList.concat("Array")}],output:Blockly.Types.BOOLEAN.output,colour:Blockly.Blocks.texts.HUE,tooltip:Blockly.Msg.TEXT_ISEMPTY_TOOLTIP,helpUrl:Blockly.Msg.TEXT_ISEMPTY_HELPURL})},getBlockType:function(){return Blockly.Types.BOOLEAN}};
Blockly.Blocks.text_indexOf={init:function(){var a=[[Blockly.Msg.TEXT_INDEXOF_OPERATOR_FIRST,"FIRST"],[Blockly.Msg.TEXT_INDEXOF_OPERATOR_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.TEXT_INDEXOF_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.setOutput(!0,Blockly.Types.NUMBER.output);this.appendValueInput("VALUE").setCheck(Blockly.Types.TEXT.checkList).appendField(Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT);this.appendValueInput("FIND").setCheck(Blockly.Types.TEXT.checkList).appendField(new Blockly.FieldDropdown(a),
"END");Blockly.Msg.TEXT_INDEXOF_TAIL&&this.appendDummyInput().appendField(Blockly.Msg.TEXT_INDEXOF_TAIL);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.TEXT_INDEXOF_TOOLTIP)}};
Blockly.Blocks.text_charAt={init:function(){this.WHERE_OPTIONS=[[Blockly.Msg.TEXT_CHARAT_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_CHARAT_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_CHARAT_FIRST,"FIRST"],[Blockly.Msg.TEXT_CHARAT_LAST,"LAST"],[Blockly.Msg.TEXT_CHARAT_RANDOM,"RANDOM"]];this.setHelpUrl(Blockly.Msg.TEXT_CHARAT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.setOutput(!0,Blockly.Types.TEXT.output);this.appendValueInput("VALUE").setCheck(Blockly.Types.TEXT.checkList).appendField(Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT);
this.appendDummyInput("AT");this.setInputsInline(!0);this.updateAt_(!0);this.setTooltip(Blockly.Msg.TEXT_CHARAT_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation"),b=this.getInput("AT").type==Blockly.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){a="false"!=a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck(Blockly.Types.NUMBER.checkList),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&
this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");Blockly.Msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_CHARAT_TAIL));var b=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(b){var d="FROM_START"==b||"FROM_END"==b;if(d!=a){var e=this.sourceBlock_;e.updateAt_(d);e.setFieldValue(b,"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE")}};
Blockly.Blocks.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);
this.appendValueInput("STRING").setCheck(Blockly.Types.TEXT.checkList).appendField(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);this.appendDummyInput("AT1");this.appendDummyInput("AT2");Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);this.setInputsInline(!0);this.setOutput(!0,Blockly.Types.TEXT.output);this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip(Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=
document.createElement("mutation"),b=this.getInput("AT1").type==Blockly.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type==Blockly.INPUT_VALUE;a.setAttribute("at2",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck(Blockly.Types.NUMBER.checkList),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&
this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);2==a&&Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL));var c=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+a],function(c){var e="FROM_START"==c||"FROM_END"==c;if(e!=b){var f=this.sourceBlock_;f.updateAt_(a,e);f.setFieldValue(c,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,
"WHERE"+a);1==a&&this.moveInputBefore("AT1","AT2")}};
Blockly.Blocks.text_changeCase={init:function(){var a=[[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(Blockly.Msg.TEXT_CHANGECASE_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendValueInput("TEXT").setCheck(Blockly.Types.TEXT.checkList).appendField(new Blockly.FieldDropdown(a),"CASE");this.setOutput(!0,Blockly.Types.TEXT.output);this.setTooltip(Blockly.Msg.TEXT_CHANGECASE_TOOLTIP)}};
Blockly.Blocks.text_trim={init:function(){var a=[[Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(Blockly.Msg.TEXT_TRIM_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendValueInput("TEXT").setCheck(Blockly.Types.TEXT.checkList).appendField(new Blockly.FieldDropdown(a),"MODE");this.setOutput(!0,Blockly.Types.TEXT.output);this.setTooltip(Blockly.Msg.TEXT_TRIM_TOOLTIP)},getBlockType:function(){return Blockly.Types.TEXT}};
Blockly.Blocks.text_print={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,colour:Blockly.Blocks.texts.HUE,tooltip:Blockly.Msg.TEXT_PRINT_TOOLTIP,helpUrl:Blockly.Msg.TEXT_PRINT_HELPURL})}};
Blockly.Blocks.text_prompt_ext={init:function(){var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,Blockly.Types.TEXT.output],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,Blockly.Types.NUMBER.output]];this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);var b=this,a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendValueInput("TEXT").appendField(a,"TYPE");this.setOutput(!0,Blockly.Types.TEXT.output);this.setTooltip(function(){return b.getFieldValue("TYPE")==
Blockly.Types.TEXT.output?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},updateType_:function(a){this.outputConnection.setCheck(a==Blockly.Types.NUMBER.output?Blockly.Types.NUMBER.checkList:Blockly.Types.TEXT.checkList)},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))},getBlockType:function(){return this.getFieldValue("TYPE")==
Blockly.Types.TEXT.output?Blockly.Types.TEXT:Blockly.Types.NUMBER}};
Blockly.Blocks.text_prompt={init:function(){var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,Blockly.Types.TEXT.output],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,Blockly.Types.NUMBER.output]],b=this;this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,
Blockly.Types.TEXT.output);this.setTooltip(function(){return b.getFieldValue("TYPE")==Blockly.Types.TEXT.output?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},newQuote_:Blockly.Blocks.text.newQuote_,updateType_:Blockly.Blocks.text_prompt_ext.updateType_,mutationToDom:Blockly.Blocks.text_prompt_ext.mutationToDom,domToMutation:Blockly.Blocks.text_prompt_ext.domToMutation,getBlockType:function(){return this.getFieldValue("TYPE")==Blockly.Types.NUMBER.output?Blockly.Types.NUMBER:
Blockly.Types.TEXT}};Blockly.Blocks.variables={};Blockly.Blocks.variables.HUE=330;
Blockly.Blocks.variables_get={init:function(){this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);this.setColour("#BD4F8D");this.appendDummyInput().appendField(new Blockly.FieldVariable(Blockly.Msg.VARIABLES_DEFAULT_NAME),"VAR");this.setOutput(!0);this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP);this.contextMenuMsg_=Blockly.Msg.VARIABLES_GET_CREATE_SET},contextMenuType_:"variables_set",customContextMenu:function(a){var b={enabled:!0},c=this.getFieldValue("VAR");b.text=this.contextMenuMsg_.replace("%1",
c);c=goog.dom.createDom("field",null,c);c.setAttribute("name","VAR");c=goog.dom.createDom("block",null,c);c.setAttribute("type",this.contextMenuType_);b.callback=Blockly.ContextMenu.callbackFactory(this,c);a.push(b)},getBlockType:function(){return[Blockly.Types.UNDEF,this.getFieldValue("VAR")]},getVarType:function(a){return[Blockly.Types.UNDEF,this.getFieldValue("VAR")]}};
Blockly.Blocks.variables_set={init:function(){this.jsonInit({message0:Blockly.Msg.VARIABLES_SET,args0:[{type:"field_variable",name:"VAR",variable:Blockly.Msg.VARIABLES_DEFAULT_NAME},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,colour:"#BD4F8D",tooltip:Blockly.Msg.VARIABLES_SET_TOOLTIP,helpUrl:Blockly.Msg.VARIABLES_SET_HELPURL});this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET},contextMenuType_:"variables_get",customContextMenu:Blockly.Blocks.variables_get.customContextMenu,
getVarType:function(a){return Blockly.Types.getChildBlockType(this)}};/*
 Licensed under the Apache License, Version 2.0 (the "License"):
          http://www.apache.org/licenses/LICENSE-2.0
*/
Blockly.Blocks.io={};Blockly.Blocks.io.HUE=250;
Blockly.Blocks.io_digitalwrite={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/DigitalWrite");this.setColour(Blockly.Blocks.io.HUE);this.appendValueInput("STATE").appendField(Blockly.Msg.ARD_DIGITALWRITE).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),"PIN").appendField(Blockly.Msg.ARD_WRITE_TO).setCheck(Blockly.Types.BOOLEAN.checkList);this.setInputsInline(!1);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_DIGITALWRITE_TIP)},
updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,"PIN","digitalPins")}};
Blockly.Blocks.io_digitalread={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/DigitalRead");this.setColour(Blockly.Blocks.io.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_DIGITALREAD).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),"PIN");this.setOutput(!0,Blockly.Types.BOOLEAN.output);this.setTooltip(Blockly.Msg.ARD_DIGITALREAD_TIP)},getBlockType:function(){return Blockly.Types.BOOLEAN},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,
"PIN","digitalPins")}};
Blockly.Blocks.io_builtin_led={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/DigitalWrite");this.setColour(Blockly.Blocks.io.HUE);this.appendValueInput("STATE").appendField(Blockly.Msg.ARD_BUILTIN_LED).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.builtinLed),"BUILT_IN_LED").appendField("to").setCheck(Blockly.Types.BOOLEAN.checkList);this.setInputsInline(!1);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_BUILTIN_LED_TIP)},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,
"BUILT_IN_LED","builtinLed")},getBlockType:function(){return Blockly.Types.BOOLEAN}};
Blockly.Blocks.io_analogwrite={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/AnalogWrite");this.setColour(Blockly.Blocks.io.HUE);this.appendValueInput("NUM").appendField(Blockly.Msg.ARD_ANALOGWRITE).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.pwmPins),"PIN").appendField(Blockly.Msg.ARD_WRITE_TO).setCheck(Blockly.Types.NUMBER.output);this.setInputsInline(!1);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_ANALOGWRITE_TIP)},
updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,"PIN","pwmPins")},getBlockType:function(){return Blockly.Types.NUMBER}};
Blockly.Blocks.io_analogread={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/AnalogRead");this.setColour(Blockly.Blocks.io.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_ANALOGREAD).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.analogPins),"PIN");this.setOutput(!0,Blockly.Types.NUMBER.output);this.setTooltip(Blockly.Msg.ARD_ANALOGREAD_TIP)},getBlockType:function(){return Blockly.Types.NUMBER},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,
"PIN","analogPins")}};Blockly.Blocks.io_highlow={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/Constants");this.setColour(Blockly.Blocks.io.HUE);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Blockly.Msg.ARD_HIGH,"HIGH"],[Blockly.Msg.ARD_LOW,"LOW"]]),"STATE");this.setOutput(!0,Blockly.Types.BOOLEAN.output);this.setTooltip(Blockly.Msg.ARD_HIGHLOW_TIP)},getBlockType:function(){return Blockly.Types.BOOLEAN}};
Blockly.Blocks.io_pulsein={init:function(){this.appendDummyInput().appendField(Blockly.Msg.ARD_PULSEREAD);this.appendValueInput("PULSETYPE").setCheck(Blockly.Types.BOOLEAN.check);this.appendDummyInput().appendField(Blockly.Msg.ARD_PULSEON).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),"PULSEPIN");this.setOutput(!0);this.setInputsInline(!0);this.setColour(Blockly.Blocks.io.HUE);this.setTooltip(Blockly.Msg.ARD_PULSE_TIP);this.setHelpUrl("https://www.arduino.cc/en/Reference/PulseIn")},
getBlockType:function(){return Blockly.Types.NUMBER}};
Blockly.Blocks.io_pulsetimeout={init:function(){this.appendDummyInput().appendField(Blockly.Msg.ARD_PULSEREAD);this.appendValueInput("PULSETYPE").setCheck(Blockly.Types.BOOLEAN.check);this.appendDummyInput().appendField(Blockly.Msg.ARD_PULSEON).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),"PULSEPIN");this.appendDummyInput().appendField(Blockly.Msg.ARD_PULSETIMEOUT);this.appendValueInput("TIMEOUT").setCheck(Blockly.Types.NUMBER.output);this.appendDummyInput().appendField(Blockly.Msg.ARD_PULSETIMEOUT_MS);
this.setOutput(!0);this.setInputsInline(!0);this.setColour(Blockly.Blocks.io.HUE);this.setTooltip(Blockly.Msg.ARD_PULSETIMEOUT_TIP);this.setHelpUrl("https://www.arduino.cc/en/Reference/PulseIn")},getBlockType:function(){return Blockly.Types.NUMBER}};Blockly.Blocks.logo={};Blockly.Blocks.logo.HUE=180;Blockly.Blocks.ardublockly_name_top={init:function(){this.appendDummyInput().appendField("Ardublockly");this.setPreviousStatement(!0);this.setColour(Blockly.Blocks.logo.HUE)}};Blockly.Blocks.ardublockly_name_bottom={init:function(){this.appendDummyInput().appendField("Ardublockly");this.setNextStatement(!0);this.setColour(Blockly.Blocks.logo.HUE);this.setTooltip("")}};
Blockly.Blocks.ardublockly_plus_top_large={init:function(){this.appendValueInput("NAME").appendField("     +");this.setNextStatement(!0);this.setColour(Blockly.Blocks.logo.HUE)}};Blockly.Blocks.ardublockly_plus_top_small={init:function(){this.appendValueInput("NAME").appendField("  +");this.setNextStatement(!0);this.setColour(Blockly.Blocks.logo.HUE)}};Blockly.Blocks.ardublockly_plus_bottom_large={init:function(){this.appendValueInput("NAME").appendField("     +");this.setPreviousStatement(!0);this.setColour(Blockly.Blocks.logo.HUE)}};
Blockly.Blocks.ardublockly_plus_bottom_small={init:function(){this.appendValueInput("NAME").appendField("  +");this.setPreviousStatement(!0);this.setColour(Blockly.Blocks.logo.HUE)}};Blockly.Blocks.ardublockly_plus_both_small={init:function(){this.appendValueInput("NAME").appendField("  +");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Blocks.logo.HUE)}};
Blockly.Blocks.ardublockly_plus_both_large={init:function(){this.appendValueInput("NAME").appendField("     +");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Blocks.logo.HUE)}};Blockly.Blocks.ardublockly_minus_large={init:function(){this.appendDummyInput().appendField("-     ");this.setInputsInline(!1);this.setOutput(!0);this.setColour(Blockly.Blocks.logo.HUE)}};
Blockly.Blocks.ardublockly_minus_small={init:function(){this.appendDummyInput().appendField("-  ");this.setInputsInline(!1);this.setOutput(!0);this.setColour(Blockly.Blocks.logo.HUE)}};Blockly.Blocks.map={};Blockly.Blocks.map.HUE=230;
Blockly.Blocks.base_map={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/map");this.setColour(Blockly.Blocks.map.HUE);this.appendValueInput("NUM").appendField(Blockly.Msg.ARD_MAP).setCheck(Blockly.Types.NUMBER.checkList);this.appendValueInput("DMAX").appendField(Blockly.Msg.ARD_MAP_VAL).setCheck(Blockly.Types.NUMBER.checkList);this.appendDummyInput().appendField("]");this.setInputsInline(!0);this.setOutput(!0);this.setTooltip(Blockly.Msg.ARD_MAP_TIP)},getBlockType:function(){return Blockly.Types.NUMBER}};Blockly.Blocks.procedures.HUE=290;Blockly.Blocks.arduino_functions={init:function(){this.appendDummyInput().appendField(Blockly.Msg.ARD_FUN_RUN_SETUP);this.appendStatementInput("SETUP_FUNC");this.appendDummyInput().appendField(Blockly.Msg.ARD_FUN_RUN_LOOP);this.appendStatementInput("LOOP_FUNC");this.setInputsInline(!1);this.setColour("#FF6C17");this.setTooltip(Blockly.Msg.ARD_FUN_RUN_TIP);this.setHelpUrl("https://arduino.cc/en/Reference/Loop");this.contextMenu=!1},getArduinoLoopsInstance:function(){return!0}};Blockly.Blocks.serial={};Blockly.Blocks.serial.HUE=160;
Blockly.Blocks.serial_setup={init:function(){this.setHelpUrl("http://arduino.cc/en/Serial/Begin");this.setColour(Blockly.Blocks.serial.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_SERIAL_SETUP).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.serial),"SERIAL_ID").appendField(Blockly.Msg.ARD_SERIAL_SPEED).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.serialSpeed),"SPEED").appendField(Blockly.Msg.ARD_SERIAL_BPS);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.ARD_SERIAL_SETUP_TIP)},
getSerialSetupInstance:function(){return this.getFieldValue("SERIAL_ID")},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,"SERIAL_ID","serial");Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,"SPEED","serialSpeed")}};
Blockly.Blocks.serial_print={init:function(){this.setHelpUrl("http://www.arduino.cc/en/Serial/Print");this.setColour(Blockly.Blocks.serial.HUE);this.appendDummyInput().appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.serial),"SERIAL_ID").appendField(Blockly.Msg.ARD_SERIAL_PRINT);this.appendValueInput("CONTENT").setCheck(Blockly.Types.TEXT.checkList);this.appendDummyInput().appendField(new Blockly.FieldCheckbox("TRUE"),"NEW_LINE").appendField(Blockly.Msg.ARD_SERIAL_PRINT_NEWLINE);
this.setInputsInline(!0);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_SERIAL_PRINT_TIP)},onchange:function(){if(this.workspace){for(var a=this.getFieldValue("SERIAL_ID"),b=Blockly.mainWorkspace.getTopBlocks(),c=!1,d=0;d<b.length;d++){var e=b[d].getSerialSetupInstance;e&&(e=e.call(b[d]),a==e&&(c=!0))}c?this.setWarningText(null,"serial_setup"):this.setWarningText(Blockly.Msg.ARD_SERIAL_PRINT_WARN.replace("%1",a),"serial_setup")}},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,
"SERIAL_ID","serial")}};Blockly.Blocks.servo={};Blockly.Blocks.servo.HUE=60;
Blockly.Blocks.servo_write={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/ServoWrite");this.setColour(Blockly.Blocks.servo.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_SERVO_WRITE).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.pwmPins),"SERVO_PIN");this.setInputsInline(!1);this.appendValueInput("SERVO_ANGLE").setCheck(Blockly.Types.NUMBER.checkList).appendField(Blockly.Msg.ARD_SERVO_WRITE_TO);this.appendDummyInput().appendField(Blockly.Msg.ARD_SERVO_WRITE_DEG_180);
this.setInputsInline(!0);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_SERVO_WRITE_TIP)},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,"SERVO_PIN","pwmPins")}};
Blockly.Blocks.servo_read={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/ServoRead");this.setColour(Blockly.Blocks.servo.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_SERVO_READ).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.pwmPins),"SERVO_PIN");this.setOutput(!0,Blockly.Types.NUMBER.output);this.setTooltip(Blockly.Msg.ARD_SERVO_READ_TIP)},getBlockType:function(){return Blockly.Types.NUMBER},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,
"SERVO_PIN","pwmPins")}};Blockly.Blocks.spi={};Blockly.Blocks.spi.HUE=170;
Blockly.Blocks.spi_setup={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/SPI");this.setColour(Blockly.Blocks.spi.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_SPI_SETUP).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.spi),"SPI_ID").appendField(Blockly.Msg.ARD_SPI_SETUP_CONF);this.appendDummyInput().appendField(Blockly.Msg.ARD_SPI_SETUP_SHIFT).appendField(new Blockly.FieldDropdown([[Blockly.Msg.ARD_SPI_SETUP_MSBFIRST,"MSBFIRST"],[Blockly.Msg.ARD_SPI_SETUP_LSBFIRST,
"LSBFIRST"]]),"SPI_SHIFT_ORDER");this.appendDummyInput().appendField(Blockly.Msg.ARD_SPI_SETUP_DIVIDE).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.spiClockDivide),"SPI_CLOCK_DIVIDE");this.appendDummyInput().appendField(Blockly.Msg.ARD_SPI_SETUP_MODE).appendField(new Blockly.FieldDropdown([[Blockly.Msg.ARD_SPI_SETUP_MODE0,"SPI_MODE0"],[Blockly.Msg.ARD_SPI_SETUP_MODE1,"SPI_MODE1"],[Blockly.Msg.ARD_SPI_SETUP_MODE2,"SPI_MODE2"],[Blockly.Msg.ARD_SPI_SETUP_MODE3,"SPI_MODE3"]]),
"SPI_MODE");this.setTooltip(Blockly.Msg.ARD_SPI_SETUP_TIP)},getSpiSetupInstance:function(){return this.getFieldValue("SPI_ID")},updateFields:function(){Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,"SPI_ID","spi");Blockly.Arduino.Boards.refreshBlockFieldDropdown(this,"SPI_CLOCK_DIVIDE","spiClockDivide")}};
Blockly.Blocks.spi_transfer={init:function(){var a=[[Blockly.Msg.ARD_SPI_TRANS_NONE,"none"]].concat(Blockly.Arduino.Boards.selected.digitalPins);this.setHelpUrl("http://arduino.cc/en/Reference/SPITransfer");this.setColour(Blockly.Blocks.spi.HUE);this.appendDummyInput().appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.spi),"SPI_ID");this.appendValueInput("SPI_DATA").setCheck(Blockly.Types.NUMBER.checkList).appendField(Blockly.Msg.ARD_SPI_TRANS_VAL);this.appendDummyInput().appendField(Blockly.Msg.ARD_SPI_TRANS_SLAVE).appendField(new Blockly.FieldDropdown(a),
"SPI_SS");this.setInputsInline(!0);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_SPI_TRANS_TIP)},onchange:function(){if(this.workspace){for(var a=this.getFieldValue("SPI_ID"),b=Blockly.mainWorkspace.getTopBlocks(),c=!1,d=0,e=b.length;d<e;d++){var f=b[d].getSpiSetupInstance;f&&(f=f.call(b[d]),a==f&&(c=!0))}c?this.setWarningText(null,"spi_setup"):this.setWarningText(Blockly.Msg.ARD_SPI_TRANS_WARN1.replace("%1",a),"spi_setup")}},getBlockType:function(){return Blockly.Types.NUMBER},
updateFields:function(){var a=this.getField("SPI_SS"),b=a.getValue();a.menuGenerator_=[[Blockly.Msg.ARD_SPI_TRANS_NONE,"none"]].concat(Blockly.Arduino.Boards.selected.digitalPins);for(var c=!1,d=0,e=a.menuGenerator_.length;d<e;d++)b==a.menuGenerator_[d][1]&&(c=!0);c?this.setWarningText(null,"bPin"):this.setWarningText(Blockly.Msg.ARD_SPI_TRANS_WARN2.replace("%1",b),"bPin")}};
Blockly.Blocks.spi_transfer_return={init:function(){var a=[[Blockly.Msg.ARD_SPI_TRANS_NONE,"none"]].concat(Blockly.Arduino.Boards.selected.digitalPins);this.setHelpUrl("http://arduino.cc/en/Reference/SPITransfer");this.setColour(Blockly.Blocks.spi.HUE);this.appendDummyInput().appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.spi),"SPI_ID");this.appendValueInput("SPI_DATA").appendField(Blockly.Msg.ARD_SPI_TRANS_VAL);this.appendDummyInput().appendField(Blockly.Msg.ARD_SPI_TRANS_SLAVE).appendField(new Blockly.FieldDropdown(a),
"SPI_SS");this.setInputsInline(!0);this.setOutput(!0);this.setTooltip(Blockly.Msg.ARD_SPI_TRANSRETURN_TIP)},onchange:Blockly.Blocks.spi_transfer.onchange,getBlockType:Blockly.Blocks.spi_transfer.getBlockType,updateFields:Blockly.Blocks.spi_transfer.updateFields};Blockly.Blocks.stepper={};Blockly.Blocks.stepper.HUE=80;
Blockly.Blocks.stepper_config={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/StepperConstructor");this.setColour(Blockly.Blocks.stepper.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_STEPPER_SETUP).appendField(new Blockly.FieldInstance("Stepper",Blockly.Msg.ARD_STEPPER_DEFAULT_NAME,!0,!0,!1),"STEPPER_NAME").appendField(Blockly.Msg.ARD_STEPPER_MOTOR);this.appendDummyInput().setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.ARD_STEPPER_PIN1).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),"STEPPER_PIN1").appendField(Blockly.Msg.ARD_STEPPER_PIN2).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),
"STEPPER_PIN2");this.appendValueInput("STEPPER_STEPS").setCheck(Blockly.Types.NUMBER.checkList).setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.ARD_STEPPER_REVOLVS);this.appendValueInput("STEPPER_SPEED").setCheck(Blockly.Types.NUMBER.checkList).setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.ARD_STEPPER_SPEED);this.setTooltip(Blockly.Msg.ARD_STEPPER_SETUP_TIP)},updateFields:function(){Blockly.Boards.refreshBlockFieldDropdown(this,"STEPPER_PIN1","digitalPins");Blockly.Boards.refreshBlockFieldDropdown(this,
"STEPPER_PIN2","digitalPins")}};
Blockly.Blocks.stepper_step={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/StepperStep");this.setColour(Blockly.Blocks.stepper.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_STEPPER_STEP).appendField(new Blockly.FieldInstance("Stepper",Blockly.Msg.ARD_STEPPER_DEFAULT_NAME,!1,!0,!1),"STEPPER_NAME");this.appendValueInput("STEPPER_STEPS").setCheck(Blockly.Types.NUMBER.checkList);this.appendDummyInput().appendField(Blockly.Msg.ARD_STEPPER_STEPS);this.setPreviousStatement(!0);
this.setNextStatement(!0);this.setTooltip(Blockly.Msg.ARD_STEPPER_STEP_TIP)},onchange:function(){if(this.workspace){var a=this.getFieldValue("STEPPER_NAME");Blockly.Instances.isInstancePresent(a,"Stepper",this)?this.setWarningText(null):this.setWarningText(Blockly.Msg.ARD_COMPONENT_WARN1.replace("%1",Blockly.Msg.ARD_STEPPER_COMPONENT).replace("%2",a))}}};Blockly.Blocks.time={};Blockly.Blocks.time.HUE=140;Blockly.Blocks.time_delay={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/Delay");this.setColour("#7FCE3D");this.appendValueInput("DELAY_TIME_MILI").setCheck(Blockly.Types.NUMBER.checkList).appendField(Blockly.Msg.ARD_TIME_DELAY);this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MS);this.setInputsInline(!0);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_TIP)}};
Blockly.Blocks.time_delaymicros={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/DelayMicroseconds");this.setColour(Blockly.Blocks.time.HUE);this.appendValueInput("DELAY_TIME_MICRO").setCheck(Blockly.Types.NUMBER.checkList).appendField(Blockly.Msg.ARD_TIME_DELAY);this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_DELAY_MICROS);this.setInputsInline(!0);this.setPreviousStatement(!0,null);this.setNextStatement(!0,null);this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_MICRO_TIP)}};
Blockly.Blocks.time_millis={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/Millis");this.setColour("#FFC758");this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MILLIS);this.setOutput(!0,Blockly.Types.LARGE_NUMBER.output);this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP)},getBlockType:function(){return Blockly.Types.LARGE_NUMBER}};
Blockly.Blocks.time_micros={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/Micros");this.setColour(Blockly.Blocks.time.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MICROS);this.setOutput(!0,Blockly.Types.LARGE_NUMBER.output);this.setTooltip(Blockly.Msg.ARD_TIME_MICROS_TIP)},getBlockType:function(){return Blockly.Types.LARGE_NUMBER}};
Blockly.Blocks.infinite_loop={init:function(){this.setHelpUrl("");this.setColour(Blockly.Blocks.time.HUE);this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_INF);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setTooltip(Blockly.Msg.ARD_TIME_INF_TIP)}};Blockly.Blocks.tone={};Blockly.Blocks.tone.HUE=250;
Blockly.Blocks.io_tone={init:function(){this.appendDummyInput().appendField(Blockly.Msg.ARD_SETTONE).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),"TONEPIN");this.appendValueInput("FREQUENCY").setCheck(Blockly.Types.NUMBER.checkList).appendField(Blockly.Msg.ARD_TONEFREQ);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Blocks.tone.HUE);this.setTooltip(Blockly.Msg.ARD_TONE_TIP);this.setHelpUrl("https://www.arduino.cc/en/Reference/tone")},
onchange:function(){var a=Blockly.Arduino.valueToCode(this,"FREQUENCY",Blockly.Arduino.ORDER_ATOMIC);31>a||65535<a?this.setWarningText(Blockly.Msg.ARD_TONE_WARNING,"io_tone"):this.setWarningText(null,"io_tone")},getBlockType:function(){return Blockly.Types.NUMBER}};
Blockly.Blocks.io_notone={init:function(){this.appendDummyInput().appendField(Blockly.Msg.ARD_NOTONE).appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.digitalPins),"TONEPIN");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Blocks.tone.HUE);this.setTooltip(Blockly.Msg.ARD_NOTONE_TIP);this.setHelpUrl("https://www.arduino.cc/en/Reference/noTone")},getBlockType:function(){return Blockly.Types.NUMBER}};Blockly.Blocks.variables.HUE=330;
Blockly.Blocks.variables_set_type={init:function(){this.setHelpUrl("http://arduino.cc/en/Reference/HomePage");this.setColour(Blockly.Blocks.variables.HUE);this.appendValueInput("VARIABLE_SETTYPE_INPUT");this.appendDummyInput().appendField(Blockly.Msg.ARD_VAR_AS).appendField(new Blockly.FieldDropdown(Blockly.Types.getValidTypeArray()),"VARIABLE_SETTYPE_TYPE");this.setInputsInline(!0);this.setOutput(!0);this.setTooltip(Blockly.Msg.ARD_VAR_AS_TIP)},getBlockType:function(){var a=this.getFieldValue("VARIABLE_SETTYPE_TYPE");
return Blockly.Types[a]}};