blocks_compressed.js 112 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. // Do not edit this file; automatically generated by build.py.
  2. 'use strict';
  3. // Copyright 2012 Google Inc. Apache License 2.0
  4. Blockly.Blocks.colour={};Blockly.Blocks.colour_picker={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_PICKER_HELPURL);this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"COLOUR");this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_PICKER_TOOLTIP)}};
  5. Blockly.Blocks.colour_random={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_RANDOM_HELPURL);this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockly.Msg.COLOUR_RANDOM_TITLE);this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_RANDOM_TOOLTIP)}};
  6. Blockly.Blocks.colour_rgb={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_RGB_HELPURL);this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendValueInput("RED").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_TITLE).appendField(Blockly.Msg.COLOUR_RGB_RED);this.appendValueInput("GREEN").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_GREEN);this.appendValueInput("BLUE").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_BLUE);
  7. this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_RGB_TOOLTIP)}};
  8. Blockly.Blocks.colour_blend={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_BLEND_HELPURL);this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);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("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_RATIO);
  9. this.setOutput(!0,"Colour");this.setTooltip(Blockly.Msg.COLOUR_BLEND_TOOLTIP)}};Blockly.Blocks.union={init:function(){this.category="SET_OP";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_SETOP);this.appendDummyInput().appendField(Blockscad.Msg.UNION);this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.appendStatementInput("PLUS0").appendField(Blockscad.Msg.PLUS).setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.UNION_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));
  10. this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).appendField(Blockscad.Msg.PLUS).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==
  11. a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).appendField(Blockscad.Msg.PLUS).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a){if(this.workspace){this.previousConnection.setCheck(a);this.getInput("A").connection.setCheck(a);
  12. this.getInput("PLUS0").connection.setCheck(a);for(var b=1;b<=this.plusCount_;b++)this.getInput("PLUS"+b).connection.setCheck(a)}}};
  13. Blockly.Blocks.difference={init:function(){this.category="SET_OP";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_SETOP);this.appendDummyInput().appendField(Blockscad.Msg.DIFFERENCE);this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.appendStatementInput("MINUS0").appendField(Blockscad.Msg.MINUS).setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.DIFFERENCE_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));
  14. this.minusCount_=0},mutationToDom:function(){if(!this.minusCount_)return null;var a=document.createElement("mutation");this.minusCount_&&a.setAttribute("minus",this.minusCount_);return a},domToMutation:function(a){this.minusCount_=parseInt(a.getAttribute("minus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.minusCount_;b++)this.appendStatementInput("MINUS"+b).appendField(Blockscad.Msg.MINUS).setCheck(a);1<=this.minusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==
  15. a?(this.minusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("MINUS"+this.minusCount_).appendField(Blockscad.Msg.MINUS).setCheck(a)):-1==a&&(this.removeInput("MINUS"+this.minusCount_),this.minusCount_--);1<=this.minusCount_?1==this.minusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a){if(this.workspace){this.previousConnection.setCheck(a);this.getInput("A").connection.setCheck(a);
  16. this.getInput("MINUS0").connection.setCheck(a);for(var b=1;b<=this.minusCount_;b++)this.getInput("MINUS"+b).connection.setCheck(a)}}};
  17. Blockly.Blocks.intersection={init:function(){this.category="SET_OP";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_SETOP);this.appendDummyInput().appendField(Blockscad.Msg.INTERSECTION);this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.appendStatementInput("WITH0").appendField(Blockscad.Msg.WITH).setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.INTERSECTION_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));
  18. this.withCount_=0},mutationToDom:function(){if(!this.withCount_)return null;var a=document.createElement("mutation");this.withCount_&&a.setAttribute("with",this.withCount_);return a},domToMutation:function(a){this.withCount_=parseInt(a.getAttribute("with"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.withCount_;b++)this.appendStatementInput("WITH"+b).appendField(Blockscad.Msg.WITH).setCheck(a);1<=this.withCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==
  19. a?(this.withCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("WITH"+this.withCount_).appendField(Blockscad.Msg.WITH).setCheck(a)):-1==a&&(this.removeInput("WITH"+this.withCount_),this.withCount_--);1<=this.withCount_?1==this.withCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a){if(this.workspace){this.previousConnection.setCheck(a);this.getInput("A").connection.setCheck(a);
  20. this.getInput("WITH0").connection.setCheck(a);for(var b=1;b<=this.withCount_;b++)this.getInput("WITH"+b).connection.setCheck(a)}}};
  21. Blockly.Blocks.hull={init:function(){this.category="SET_OP";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_SETOP);this.appendDummyInput().appendField(Blockscad.Msg.CONVEX_HULL);this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.appendStatementInput("WITH0").appendField(Blockscad.Msg.WITH).setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.HULL_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));
  22. this.withCount_=0},mutationToDom:function(){if(!this.withCount_)return null;var a=document.createElement("mutation");this.withCount_&&a.setAttribute("with",this.withCount_);return a},domToMutation:function(a){this.withCount_=parseInt(a.getAttribute("with"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.withCount_;b++)this.appendStatementInput("WITH"+b).appendField(Blockscad.Msg.WITH).setCheck(a);1<=this.withCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==
  23. a?(this.withCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("WITH"+this.withCount_).appendField(Blockscad.Msg.WITH).setCheck(a)):-1==a&&(this.removeInput("WITH"+this.withCount_),this.withCount_--);1<=this.withCount_?1==this.withCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a){if(this.workspace){this.previousConnection.setCheck(a);this.getInput("A").connection.setCheck(a);
  24. this.getInput("WITH0").connection.setCheck(a);for(var b=1;b<=this.withCount_;b++)this.getInput("WITH"+b).connection.setCheck(a)}}};Blockly.Blocks.lists={};Blockscad.Toolbox=Blockscad.Toolbox||{};Blockly.Blocks.lists.HUE=Blockscad.Toolbox.HEX_LOGIC;Blockly.Blocks.lists_create_empty={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.setOutput(!0,"Array");this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);this.setTooltip(Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP)}};
  25. 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"),
  26. 10);this.updateShape_()},decompose:function(a){var b=Blockly.Block.obtain(a,"lists_create_with_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=Blockly.Block.obtain(a,"lists_create_with_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){a=a.getInputTargetBlock("STACK");for(var b=[],c=0;a;)b[c]=a.valueConnection_,a=a.nextConnection&&a.nextConnection.targetBlock(),c++;this.itemCount_=c;this.updateShape_();
  27. for(c=0;c<this.itemCount_;c++)b[c]&&this.getInput("ADD"+c).connection.connect(b[c])},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(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var a=0;this.getInput("ADD"+a);)this.removeInput("ADD"+a),a++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
  28. else for(a=0;a<this.itemCount_;a++){var b=this.appendValueInput("ADD"+a);0==a&&b.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH)}}};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}};
  29. 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}};
  30. 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:"Number"}],output:"Array",colour:Blockly.Blocks.lists.HUE,tooltip:Blockly.Msg.LISTS_REPEAT_TOOLTIP,helpUrl:Blockly.Msg.LISTS_REPEAT_HELPURL})}};
  31. Blockly.Blocks.lists_length={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_LENGTH_TITLE,args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",colour:Blockly.Blocks.lists.HUE,tooltip:Blockly.Msg.LISTS_LENGTH_TOOLTIP,helpUrl:Blockly.Msg.LISTS_LENGTH_HELPURL})}};
  32. Blockly.Blocks.lists_isEmpty={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_ISEMPTY_TITLE,args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",colour:Blockly.Blocks.lists.HUE,tooltip:Blockly.Msg.LISTS_ISEMPTY_TOOLTIP,helpUrl:Blockly.Msg.LISTS_ISEMPTY_HELPURL})}};
  33. 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,"Number");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)}};
  34. 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);
  35. 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);
  36. 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!=
  37. !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("Number"),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,
  38. function(b){var c="FROM_START"==b||"FROM_END"==b;if(c!=a){var e=this.sourceBlock_;e.updateAt_(c);e.setFieldValue(b,"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE");Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};
  39. 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);
  40. 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]})},
  41. 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("Number"),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,
  42. function(b){var c="FROM_START"==b||"FROM_END"==b;if(c!=a){var e=this.sourceBlock_;e.updateAt_(c);e.setFieldValue(b,"WHERE");return null}});this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO");this.getInput("AT").appendField(b,"WHERE")}};
  43. 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);
  44. 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==
  45. 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("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):
  46. this.appendDummyInput("AT"+a);var c=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+a],function(c){var d="FROM_START"==c||"FROM_END"==c;if(d!=b){var f=this.sourceBlock_;f.updateAt_(a,d);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)}};
  47. 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("String").appendField(b,"MODE");this.appendValueInput("DELIM").setCheck("String").appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);this.setInputsInline(!0);
  48. 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("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("mode",
  49. this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))}};Blockly.Blocks.logic={};
  50. Blockly.Blocks.controls_if={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_IF_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOGIC);this.appendValueInput("IF0").setCheck(["Boolean","Number"]).appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);this.appendStatementInput("DO0").appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN).setCheck(["CSG","CAG"]);this.setPreviousStatement(!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_&&
  51. 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",
  52. 1);return a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0;this.elseCount_=parseInt(a.getAttribute("else"),10)||0;for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).setCheck(["CSG","CAG"]).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").setCheck(["CSG","CAG"]).appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)},
  53. decompose:function(a){var b=Blockly.Block.obtain(a,"controls_if_if");b.initSvg();for(var c=b.getInput("STACK").connection,d=1;d<=this.elseifCount_;d++){var e=Blockly.Block.obtain(a,"controls_if_elseif");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}this.elseCount_&&(a=Blockly.Block.obtain(a,"controls_if_else"),a.initSvg(),c.connect(a.previousConnection));return b},compose:function(a){this.elseCount_&&this.removeInput("ELSE");this.elseCount_=0;for(var b=this.elseifCount_;0<b;b--)this.removeInput("IF"+
  54. b),this.removeInput("DO"+b);this.elseifCount_=0;for(a=a.getInputTargetBlock("STACK");a;){switch(a.type){case "controls_if_elseif":this.elseifCount_++;var b=this.appendValueInput("IF"+this.elseifCount_).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),c=this.appendStatementInput("DO"+this.elseifCount_).setCheck(["CSG","CAG"]);c.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);a.valueConnection_&&b.connection.connect(a.valueConnection_);a.statementConnection_&&c.connection.connect(a.statementConnection_);
  55. break;case "controls_if_else":this.elseCount_++;b=this.appendStatementInput("ELSE").setCheck(["CSG","CAG"]);b.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);a.statementConnection_&&b.connection.connect(a.statementConnection_);break;default:throw"Unknown block type.";}a=a.nextConnection&&a.nextConnection.targetBlock()}},saveConnections:function(a){a=a.getInputTargetBlock("STACK");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_=
  56. 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()}}};
  57. Blockly.Blocks.controls_if_if={init:function(){this.setColour(Blockscad.Toolbox.HEX_LOGIC);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);this.contextMenu=!1}};
  58. Blockly.Blocks.controls_if_elseif={init:function(){this.setColour(Blockscad.Toolbox.HEX_LOGIC);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}};
  59. Blockly.Blocks.controls_if_else={init:function(){this.setColour(Blockscad.Toolbox.HEX_LOGIC);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);this.setPreviousStatement(!0);this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);this.contextMenu=!1}};
  60. 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(Blockscad.Toolbox.HEX_LOGIC);this.setOutput(!0,"Boolean");this.appendValueInput("A");this.appendValueInput("B").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=
  61. 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(){var a=this.getInputTargetBlock("A"),b=this.getInputTargetBlock("B");if(a&&b&&!a.outputConnection.checkType_(b.outputConnection))for(var c=0;c<this.prevBlocks_.length;c++){var d=
  62. this.prevBlocks_[c];if(d===a||d===b)d.setParent(null),d.bumpNeighbours_()}this.prevBlocks_[0]=a;this.prevBlocks_[1]=b}};
  63. 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(Blockscad.Toolbox.HEX_LOGIC);this.setOutput(!0,"Boolean");this.appendValueInput("A").setCheck("Boolean");this.appendValueInput("B").setCheck("Boolean").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,
  64. OR:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR}[a]})}};Blockly.Blocks.logic_negate={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NEGATE_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOGIC);this.setOutput(!0,"Boolean");this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE,["BOOL","Boolean",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP)}};
  65. Blockly.Blocks.logic_boolean={init:function(){var a=[[Blockly.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[Blockly.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOGIC);this.setOutput(!0,"Boolean");this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"BOOL");this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP)}};
  66. Blockly.Blocks.logic_null={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NULL_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOGIC);this.setOutput(!0,"Boolean");this.appendDummyInput().appendField(Blockly.Msg.LOGIC_NULL);this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP)}};
  67. Blockly.Blocks.logic_ternary={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_TERNARY_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOGIC);this.appendValueInput("IF").setCheck("Boolean").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,"Number");this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP)}};Blockly.Blocks.loops={};
  68. Blockly.Blocks.controls_repeat={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_REPEAT_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOOP);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_REPEAT).appendField(new Blockly.FieldTextInput("10",Blockly.FieldTextInput.nonnegativeIntegerValidator),"TIMES").appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_TIMES);this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);this.setPreviousStatement(!0);this.setNextStatement(!0);
  69. this.setTooltip(Blockly.Msg.CONTROLS_REPEAT_TOOLTIP)}};Blockly.Blocks.controls_repeat_ext={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_REPEAT_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOOP);this.interpolateMsg(Blockly.Msg.CONTROLS_REPEAT_TITLE,["TIMES","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.CONTROLS_REPEAT_TOOLTIP)}};
  70. 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(Blockscad.Toolbox.HEX_LOOP);this.appendValueInput("BOOL").setCheck("Boolean").appendField(new Blockly.FieldDropdown(a),"MODE");this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO);this.setPreviousStatement(!0);this.setNextStatement(!0);
  71. 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]})}};
  72. Blockly.Blocks.controls_for={init:function(){this.category="LOOP";this.setHelpUrl(Blockly.Msg.CONTROLS_FOR_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOOP);this.jsonInit({message0:Blockly.Msg.CONTROLS_FOR_TITLE,args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],inputsInline:!0,previousStatement:null});this.appendDummyInput().appendField("("+
  73. Blockscad.Msg.CONVEX_HULL).appendField(new Blockly.FieldCheckbox("FALSE"),"HULL").appendField(")");this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOR_INPUT_DO).setCheck(["CSG","CAG"]);this.setPreviousStatement(!0,["CSG","CAG"]);this.setInputsInline(!0);var a=this;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOR_TOOLTIP.replace("%1",a.getFieldValue("VAR"))+"\n"+Blockscad.Msg.CONTROLS_FOR_TOOLTIP_CHAINHULL})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,
  74. b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"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)}},setType:function(a){this.workspace&&(this.previousConnection.setCheck(a),
  75. this.getInput("DO").connection.setCheck(a))}};
  76. Blockly.Blocks.controls_for_chainhull={init:function(){this.category="LOOP";this.setHelpUrl(Blockly.Msg.CONTROLS_FOR_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOOP);this.jsonInit({message0:Blockly.Msg.CONTROLS_FOR_TITLE,args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],inputsInline:!0,previousStatement:null});
  77. this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOR_INPUT_DO).setCheck(["CSG","CAG"]);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(function(){return Blockscad.Msg.CONTROLS_FOR_TOOLTIP_CHAINHULL})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"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",
  78. 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)}},setType:function(a){this.workspace&&(this.previousConnection.setCheck(a),this.getInput("DO").connection.setCheck(a))}};
  79. Blockly.Blocks.controls_forEach={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_FOREACH_HELPURL);this.setColour(Blockscad.Toolbox.HEX_LOOP);this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM).appendField(new Blockly.FieldVariable(null),"VAR").appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST);Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL&&(this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL),this.setInputsInline(!0));
  80. this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_DO);this.setPreviousStatement(!0);this.setNextStatement(!0);var a=this;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOREACH_TOOLTIP.replace("%1",a.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")},customContextMenu:Blockly.Blocks.controls_for.customContextMenu};
  81. 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(Blockscad.Toolbox.HEX_LOOP);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,
  82. CONTINUE:Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}[a]})},onchange:function(){var a=!1,b=this;do{if("controls_repeat"==b.type||"controls_repeat_ext"==b.type||"controls_forEach"==b.type||"controls_for"==b.type||"controls_whileUntil"==b.type){a=!0;break}b=b.getSurroundParent()}while(b);a?this.setWarningText(null):this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING)}};Blockly.Blocks.math={};Blockly.Blocks.math_number={init:function(){this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.appendDummyInput().appendField(new Blockly.FieldNumber("0"),"NUM");this.setOutput(!0,"Number");var a=this;this.setTooltip(function(){var b=a.getParent();return b&&b.getInputsInline()&&b.tooltip||Blockly.Msg.MATH_NUMBER_TOOLTIP})}};
  83. 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(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.appendValueInput("A").setCheck("Number");this.appendValueInput("B").setCheck("Number").appendField(new Blockly.FieldDropdown(a),
  84. "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]})}};
  85. 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(Blockscad.Toolbox.HEX_MATH);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,
  86. 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}[a]})}};
  87. Blockly.Blocks.math_trig={init:function(){var a=[[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"]];this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.appendValueInput("NUM").setCheck("Number").appendField(new Blockly.FieldDropdown(a),"OP");var b=this;this.setTooltip(function(){var a=
  88. b.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}[a]})}};
  89. Blockly.Blocks.math_constant={init:function(){this.setHelpUrl(Blockly.Msg.MATH_CONSTANT_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]),"CONSTANT");this.setTooltip(Blockly.Msg.MATH_CONSTANT_TOOLTIP)}};
  90. 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_WHOLE,"WHOLE"],[Blockly.Msg.MATH_IS_POSITIVE,"POSITIVE"],[Blockly.Msg.MATH_IS_NEGATIVE,"NEGATIVE"],[Blockly.Msg.MATH_IS_DIVISIBLE_BY,"DIVISIBLE_BY"]];this.setColour(Blockscad.Toolbox.HEX_MATH);this.appendValueInput("NUMBER_TO_CHECK").setCheck("Number");a=new Blockly.FieldDropdown(a,function(a){this.sourceBlock_.updateShape_("DIVISIBLE_BY"==a)});this.appendDummyInput().appendField(a,
  91. "PROPERTY");this.setInputsInline(!0);this.setOutput(!0,"Boolean");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("Number"):b&&this.removeInput("DIVISOR")}};
  92. Blockly.Blocks.math_change={init:function(){this.setHelpUrl(Blockly.Msg.MATH_CHANGE_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.interpolateMsg(Blockly.Msg.MATH_CHANGE_TITLE_CHANGE+" %1 "+Blockly.Msg.MATH_CHANGE_INPUT_BY+" %2",["VAR",new Blockly.FieldVariable(Blockly.Msg.MATH_CHANGE_TITLE_ITEM)],["DELTA","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setPreviousStatement(!0);this.setNextStatement(!0);var a=this;this.setTooltip(function(){return Blockly.Msg.MATH_CHANGE_TOOLTIP.replace("%1",
  93. a.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")}};
  94. Blockly.Blocks.math_round={init:function(){var a=[[Blockly.Msg.MATH_ROUND_OPERATOR_ROUND,"ROUND"],[Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP,"ROUNDUP"],[Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN,"ROUNDDOWN"]];this.setHelpUrl(Blockly.Msg.MATH_ROUND_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.appendValueInput("NUM").setCheck("Number").appendField(new Blockly.FieldDropdown(a),"OP");this.setTooltip(Blockly.Msg.MATH_ROUND_TOOLTIP)}};
  95. 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(Blockscad.Toolbox.HEX_MATH);
  96. this.setOutput(!0,"Number");a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendValueInput("LIST").setCheck("Array").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,
  97. RANDOM:Blockly.Msg.MATH_ONLIST_TOOLTIP_RANDOM}[a]})},updateType_:function(a){"MODE"==a?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}};
  98. Blockly.Blocks.math_modulo={init:function(){this.setHelpUrl(Blockly.Msg.MATH_MODULO_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.interpolateMsg(Blockly.Msg.MATH_MODULO_TITLE,["DIVIDEND","Number",Blockly.ALIGN_RIGHT],["DIVISOR","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.MATH_MODULO_TOOLTIP)}};
  99. Blockly.Blocks.math_constrain={init:function(){this.setHelpUrl(Blockly.Msg.MATH_CONSTRAIN_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.interpolateMsg(Blockly.Msg.MATH_CONSTRAIN_TITLE,["VALUE","Number",Blockly.ALIGN_RIGHT],["LOW","Number",Blockly.ALIGN_RIGHT],["HIGH","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.MATH_CONSTRAIN_TOOLTIP)}};
  100. Blockly.Blocks.math_random_int={init:function(){this.setHelpUrl(Blockly.Msg.MATH_RANDOM_INT_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.interpolateMsg(Blockly.Msg.MATH_RANDOM_INT_TITLE,["FROM","Number",Blockly.ALIGN_RIGHT],["TO","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.MATH_RANDOM_INT_TOOLTIP)}};
  101. Blockly.Blocks.math_random_float={init:function(){this.setHelpUrl(Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.appendDummyInput().appendField(Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM);this.setTooltip(Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP)}};Blockly.Blocks.sphere={init:function(){this.category="PRIMITIVE_CSG";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.appendDummyInput().appendField(Blockscad.Msg.SPHERE+" ");this.appendValueInput("RAD").setCheck("Number").appendField(Blockscad.Msg.RADIUS).setAlign(Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip(Blockscad.Msg.SPHERE_TOOLTIP)}};
  102. Blockly.Blocks.cylinder={init:function(){this.category="PRIMITIVE_CSG";this.pR2id=this.pR1id=this.prevR2=this.prevR1=null;this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.appendDummyInput().appendField(Blockscad.Msg.CYLINDER+" ");this.appendValueInput("RAD1").setCheck("Number").appendField(Blockscad.Msg.RADIUS+"1").setAlign(Blockly.ALIGN_RIGHT);null==Blockscad.inputVersion||"1.0.0"==Blockscad.inputVersion||"1.0.1"==Blockscad.inputVersion||"1.1.0"==
  103. Blockscad.inputVersion?this.appendDummyInput().setAlign(Blockly.ALIGN_RIGHT).appendField(new Blockly.FieldCheckbox("FALSE",null,"imgs/lock_icon.png","imgs/unlock_icon.png"),"LOCKED"):this.appendDummyInput().setAlign(Blockly.ALIGN_RIGHT).appendField(new Blockly.FieldCheckbox("TRUE",null,"imgs/lock_icon.png","imgs/unlock_icon.png"),"LOCKED");this.appendValueInput("RAD2").setCheck("Number").appendField(Blockscad.Msg.RADIUS+"2").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("HEIGHT").setCheck("Number").appendField(Blockscad.Msg.HEIGHT).setAlign(Blockly.ALIGN_RIGHT);
  104. this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Blockscad.Msg.NOT_CENTERED,"false"],[Blockscad.Msg.CENTERED,"true"]]),"CENTERDROPDOWN");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip(Blockscad.Msg.CYLINDER_TOOLTIP)},updateRadii:function(){if(this.workspace){var a=this.getField("LOCKED").getValue();if("FALSE"!=a){var b=null,c=null;this.getInput("RAD1").connection.targetConnection&&"math_number"==this.getInput("RAD1").connection.targetConnection.sourceBlock_.type&&
  105. (b=this.getInput("RAD1").connection.targetConnection.sourceBlock_.getField("NUM").getValue());this.getInput("RAD2").connection.targetConnection&&"math_number"==this.getInput("RAD2").connection.targetConnection.sourceBlock_.type&&(c=this.getInput("RAD2").connection.targetConnection.sourceBlock_.getField("NUM").getValue());"TRUE"==a&&b&&c&&b!=c&&(b!=this.prevR1?this.getInput("RAD2").connection.targetConnection.sourceBlock_.getField("NUM").setValue(b,!0):c!=this.prevR2&&this.getInput("RAD1").connection.targetConnection.sourceBlock_.getField("NUM").setValue(c,
  106. !0));this.prevR1=b;this.prevR2=c}}}};
  107. Blockly.Blocks.simple_cylinder={init:function(){this.category="PRIMITIVE_CSG";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.appendDummyInput().appendField(Blockscad.Msg.CYLINDER+" ");this.appendValueInput("RAD1").setCheck("Number").appendField(Blockscad.Msg.RADIUS).setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("HEIGHT").setCheck("Number").appendField(Blockscad.Msg.HEIGHT).setAlign(Blockly.ALIGN_RIGHT);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Blockscad.Msg.NOT_CENTERED,
  108. "false"],[Blockscad.Msg.CENTERED,"true"]]),"CENTERDROPDOWN");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip("Creates a cylinder with a specified radius and height. It may optionally be centered at the origin.")}};
  109. Blockly.Blocks.cube={init:function(){this.category="PRIMITIVE_CSG";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.appendDummyInput().appendField(Blockscad.Msg.CUBE+" ");this.appendValueInput("XVAL").setCheck("Number").appendField("X").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("YVAL").setCheck("Number").appendField("Y").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("ZVAL").setCheck("Number").appendField("Z").setAlign(Blockly.ALIGN_RIGHT);
  110. this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Blockscad.Msg.NOT_CENTERED,"false"],[Blockscad.Msg.CENTERED,"true"]]),"CENTERDROPDOWN");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip(Blockscad.Msg.CUBE_TOOLTIP)}};
  111. Blockly.Blocks.torus={init:function(){this.category="PRIMITIVE_CSG";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.appendDummyInput().appendField(Blockscad.Msg.TORUS+" ");this.appendValueInput("RAD1").setCheck("Number").appendField(Blockscad.Msg.RADIUS+"1").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("RAD2").setCheck("Number").appendField(Blockscad.Msg.RADIUS+"2").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("SIDES").setCheck("Number").appendField(Blockscad.Msg.SIDES).setAlign(Blockly.ALIGN_RIGHT);
  112. this.appendValueInput("FACES").setCheck("Number").appendField(Blockscad.Msg.FACES).setAlign(Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip(Blockscad.Msg.TORUS_TOOLTIP)}};
  113. Blockly.Blocks.twistytorus={init:function(){this.category="PRIMITIVE_CSG";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.appendDummyInput().appendField("Twisty Torus ");this.appendValueInput("RAD1").setCheck("Number").appendField("ring radius").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("RAD2").setCheck("Number").appendField("cross-section radius").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("SIDES").setCheck("Number").appendField("ring sides").setAlign(Blockly.ALIGN_RIGHT);
  114. this.appendValueInput("FACES").setCheck("Number").appendField("cross section faces").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("TWIST").setCheck("Number").appendField("twist (degrees)").setAlign(Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip('Creates a torus with a ring of specified distance on-center from the origin (radius1), with a specified radius (radius2), a specified number of sides and faces. The "twist" is in degrees, and should be used with caution')}};
  115. Blockly.Blocks.circle={init:function(){this.category="PRIMITIVE_CAG";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_2D_PRIMITIVE);this.appendDummyInput().appendField(Blockscad.Msg.CIRCLE+" ");this.appendValueInput("RAD").setCheck("Number").appendField(Blockscad.Msg.RADIUS).setAlign(Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setPreviousStatement(!0,"CAG");this.setTooltip(Blockscad.Msg.CIRCLE_TOOLTIP)}};
  116. Blockly.Blocks.square={init:function(){this.category="PRIMITIVE_CAG";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_2D_PRIMITIVE);this.appendDummyInput().appendField(Blockscad.Msg.SQUARE+" ");this.appendValueInput("XVAL").setCheck("Number").appendField("X").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("YVAL").setCheck("Number").appendField("Y").setAlign(Blockly.ALIGN_RIGHT);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Blockscad.Msg.NOT_CENTERED,
  117. "false"],[Blockscad.Msg.CENTERED,"true"]]),"CENTERDROPDOWN");this.setInputsInline(!0);this.setPreviousStatement(!0,"CAG");this.setTooltip(Blockscad.Msg.SQUARE_TOOLTIP)}};
  118. Blockly.Blocks.translate={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.TRANSLATE);this.appendValueInput("XVAL").setCheck("Number").appendField("X").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("YVAL").setCheck("Number").appendField("Y").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("ZVAL").setCheck("Number").appendField("Z").setAlign(Blockly.ALIGN_RIGHT);
  119. this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.TRANSLATE_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;
  120. for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),
  121. this.mutatorMinus=null,this.render())},setType:function(a,b){if(this.workspace){goog.isArray(a)||(a=[a]);var c=this.getInput("ZVAL"),d=this.getInput("A"),e=this.previousConnection.check_;this.previousConnection.setCheck(a);d.connection.setCheck(a);for(d=1;d<=this.plusCount_;d++)this.getInput("PLUS"+d).connection.setCheck(a);"CAG"==a[0]&&"CSG"==e[0]?hideMyInput(c,b):"CSG"==a[0]&&"CAG"==e[0]&&showMyInput(c,b)}}};
  122. Blockly.Blocks.scale={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.SCALE);this.appendValueInput("XVAL").setCheck("Number").appendField("X").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("YVAL").setCheck("Number").appendField("Y").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("ZVAL").setCheck("Number").appendField("Z").setAlign(Blockly.ALIGN_RIGHT);this.appendStatementInput("A").setCheck(["CSG",
  123. "CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.SCALE_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+
  124. b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a,
  125. b){if(this.workspace){goog.isArray(a)||(a=[a]);var c=this.getInput("ZVAL"),d=this.getInput("A"),e=this.previousConnection.check_;this.previousConnection.setCheck(a);d.connection.setCheck(a);for(d=1;d<=this.plusCount_;d++)this.getInput("PLUS"+d).connection.setCheck(a);"CAG"==a[0]&&"CSG"==e[0]?hideMyInput(c,b):"CSG"==a[0]&&"CAG"==e[0]&&showMyInput(c,b)}}};
  126. Blockly.Blocks.fancymirror={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.MIRROR_ADVANCED);this.appendValueInput("XVAL").setCheck("Number").appendField("X").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("YVAL").setCheck("Number").appendField("Y").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("ZVAL").setCheck("Number").appendField("Z").setAlign(Blockly.ALIGN_RIGHT);
  127. this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.FANCYMIRROR_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;
  128. for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),
  129. this.mutatorMinus=null,this.render())},setType:function(a,b){if(this.workspace){this.getInput("ZVAL");this.previousConnection.setCheck(a);this.getInput("A").connection.setCheck(a);for(var c=1;c<=this.plusCount_;c++)this.getInput("PLUS"+c).connection.setCheck(a)}}};
  130. Blockly.Blocks.simplemirror={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField("Simple Mirror");this.appendDummyInput().appendField("across").appendField(new Blockly.FieldDropdown([["+","pos"],["-","neg"]]),"sign").appendField(new Blockly.FieldDropdown([["XY","XY"],["YZ","YZ"],["XZ","XZ"]]),"mirrorplane");this.appendStatementInput("A").setCheck("CSG");this.setInputsInline(!0);this.setPreviousStatement(!0,
  131. "CSG");this.setTooltip(Blockscad.Msg.SIMPLEMIRROR_TOOLTIP)},setType:function(a,b){if(this.workspace){var c=this.getInput("A");this.previousConnection.setCheck(a);c.connection.setCheck(a)}}};
  132. Blockly.Blocks.simplemirror_new={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.MIRROR);this.appendDummyInput("3D").appendField(Blockscad.Msg.ACROSS).appendField(new Blockly.FieldDropdown([["XY","XY"],["YZ","YZ"],["XZ","XZ"]]),"mirrorplane");this.appendDummyInput("2D").appendField(Blockscad.Msg.ACROSS).appendField(new Blockly.FieldDropdown([["YZ","YZ"],["XZ","XZ"]]),
  133. "mirrorplane_cag").setVisible(!1);this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.SIMPLEMIRROR_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),
  134. 10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),
  135. this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a,b){if(this.workspace){goog.isArray(a)||(a=[a]);var c=this.getInput("3D"),d=this.getInput("2D"),e=this.getInput("A"),f=this.previousConnection.check_;this.previousConnection.setCheck(a);e.connection.setCheck(a);for(e=1;e<=this.plusCount_;e++)this.getInput("PLUS"+e).connection.setCheck(a);"CAG"==a[0]&&"CSG"==f[0]?(hideMyInput(c,b),showMyInput(d,b)):"CSG"==a[0]&&"CAG"==f[0]&&(hideMyInput(d,b),showMyInput(c,
  136. b))}}};
  137. Blockly.Blocks.taper={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.TAPER);this.appendDummyInput("3D").appendField(Blockscad.Msg.ALONG+" ").appendField(new Blockly.FieldDropdown([["X","X"],["Y","Y"],["Z","Z"]]),"taperaxis").appendField(Blockscad.Msg.AXIS);this.appendDummyInput("2D").appendField(Blockscad.Msg.ALONG+" ").appendField(new Blockly.FieldDropdown([["X","X"],
  138. ["Y","Y"]]),"taperaxis_cag").appendField(Blockscad.Msg.AXIS).setVisible(!1);this.appendValueInput("FACTOR").setCheck("Number").appendField(Blockscad.Msg.SCALE).setAlign(Blockly.ALIGN_RIGHT);this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.TAPER_TOOLTIP);this.setWarningText(Blockscad.Msg.NOT_COMPATIBLE_WITH_OPENSCAD);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;
  139. var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+
  140. this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a,b){if(this.workspace){goog.isArray(a)||(a=[a]);var c=this.getInput("3D"),d=this.getInput("2D"),e=this.getInput("A"),f=this.previousConnection.check_;this.previousConnection.setCheck(a);e.connection.setCheck(a);
  141. for(e=1;e<=this.plusCount_;e++)this.getInput("PLUS"+e).connection.setCheck(a);"CAG"==a[0]&&"CSG"==f[0]?(hideMyInput(c,b),showMyInput(d,b)):"CSG"==a[0]&&"CAG"==f[0]&&(hideMyInput(d,b),showMyInput(c,b),b&&this.render())}}};
  142. Blockly.Blocks.simplerotate={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.ROTATE);this.appendValueInput("XVAL").setCheck("Number").appendField("X").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("YVAL").setCheck("Number").appendField("Y").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("ZVAL").setCheck("Number").appendField("Z").setAlign(Blockly.ALIGN_RIGHT);
  143. this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.SIMPLEROTATE_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;
  144. for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),
  145. this.mutatorMinus=null,this.render())},setType:function(a,b){if(this.workspace){var c=this.getInput("A");this.previousConnection.setCheck(a);c.connection.setCheck(a);for(c=1;c<=this.plusCount_;c++)this.getInput("PLUS"+c).connection.setCheck(a)}}};
  146. Blockly.Blocks.fancyrotate={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.ROTATE_ADVANCED);this.appendValueInput("AVAL").setCheck("Number");this.appendValueInput("XVAL").setCheck("Number").appendField(Blockscad.Msg.AROUND+" X").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("YVAL").setCheck("Number").appendField("Y").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("ZVAL").setCheck("Number").appendField("Z").setAlign(Blockly.ALIGN_RIGHT);
  147. this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.FANCYROTATE_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;
  148. for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),
  149. this.mutatorMinus=null,this.render())},setType:function(a,b){if(this.workspace){goog.isArray(a)||(a=[a]);var c=this.getInput("ZVAL"),d=this.getInput("XVAL"),e=this.getInput("YVAL"),f=this.getInput("A"),g=this.previousConnection.check_;this.previousConnection.setCheck(a);f.connection.setCheck(a);for(f=1;f<=this.plusCount_;f++)this.getInput("PLUS"+f).connection.setCheck(a);"CAG"==a[0]&&"CSG"==g[0]?(hideMyInput(d,b),hideMyInput(e,b),hideMyInput(c,b)):"CSG"==a[0]&&"CAG"==g[0]&&(showMyInput(d,b),showMyInput(e,
  150. b),showMyInput(c,b))}}};
  151. Blockly.Blocks.color={init:function(){this.category="COLOR";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.COLOR);this.appendValueInput("COLOR").setCheck("Colour");this.appendStatementInput("A").setCheck("CSG");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip(Blockscad.Msg.COLOR_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;
  152. var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+
  153. this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())}};
  154. Blockly.Blocks.color_rgb={init:function(){this.category="COLOR";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.COLOR+" ");var a=new Blockly.FieldDropdown([[Blockscad.Msg.HSV_COLOR_MODEL,"HSV"],[Blockscad.Msg.RGB_COLOR_MODEL,"RGB"]],function(a){this.sourceBlock_.optUpdateShape_("RGB"==a)});this.appendDummyInput().appendField(a,"SCHEME").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("RED").setCheck("Number").appendField(Blockscad.Msg.COLOR_HUE,
  155. "1").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("GREEN").setCheck("Number").appendField(Blockscad.Msg.COLOR_SATURATION,"2").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("BLUE").setCheck("Number").appendField(Blockscad.Msg.COLOR_VALUE,"3").setAlign(Blockly.ALIGN_RIGHT);this.appendStatementInput("A").setCheck("CSG");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");var b=this;this.setTooltip(function(){var a=b.getFieldValue("SCHEME");return{RGB:Blockscad.Msg.COLOR_RGB_TOOLTIP,
  156. HSV:Blockscad.Msg.COLOR_HSV_TOOLTIP}[a]});this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){var a=document.createElement("mutation");this.plusCount_?a.setAttribute("plus",this.plusCount_):a.setAttribute("plus",0);var b="RGB"==this.getFieldValue("SCHEME");a.setAttribute("isrgb",b);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);for(var b=this.getInput("A").connection.check_,c=1;c<=this.plusCount_;c++)this.appendStatementInput("PLUS"+
  157. c).setCheck(b);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this));a="true"==a.getAttribute("isrgb");this.optUpdateShape_(a)},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus&&this.mutatorMinus.dispose(),
  158. this.mutatorMinus=null,this.render())},optUpdateShape_:function(a){var b=this.getField("1"),c=this.getField("2"),d=this.getField("3");a?(b.setText(Blockly.Msg.COLOUR_RGB_RED),c.setText(Blockly.Msg.COLOUR_RGB_GREEN),d.setText(Blockly.Msg.COLOUR_RGB_BLUE)):(b.setText(Blockscad.Msg.COLOR_HUE),c.setText(Blockscad.Msg.COLOR_SATURATION),d.setText(Blockscad.Msg.COLOR_VALUE))}};
  159. Blockly.Blocks.$fn={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendValueInput("SIDES").setCheck("Number").appendField(Blockscad.Msg.SIDES);this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.FN_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;
  160. var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+
  161. this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a){if(this.workspace){this.previousConnection.setCheck(a);this.getInput("A").connection.setCheck(a);for(var b=1;b<=this.plusCount_;b++)this.getInput("PLUS"+b).connection.setCheck(a)}}};
  162. Blockly.Blocks.assign={init:function(){this.category="TRANSFORM";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendValueInput("NAME").appendField("set ").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("VALUE").setCheck("Number").appendField(" = ");this.appendStatementInput("A").setCheck(["CSG","CAG"]);this.setInputsInline(!0);this.setPreviousStatement(!0,["CSG","CAG"]);this.setTooltip(Blockscad.Msg.FN_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));
  163. this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,
  164. a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())},setType:function(a){if(this.workspace){this.previousConnection.setCheck(a);this.getInput("A").connection.setCheck(a);for(var b=1;b<=this.plusCount_;b++)this.getInput("PLUS"+
  165. b).connection.setCheck(a)}}};
  166. Blockly.Blocks.linearextrude={init:function(){this.category="EXTRUDE";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.LINEAR_EXTRUDE+" ");this.appendValueInput("HEIGHT").setCheck("Number").appendField(Blockscad.Msg.HEIGHT).setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("TWIST").setCheck("Number").appendField(Blockscad.Msg.TWIST).setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("XSCALE").setCheck("Number").appendField(Blockscad.Msg.SCALE+": x").setAlign(Blockly.ALIGN_RIGHT);
  167. this.appendValueInput("YSCALE").setCheck("Number").appendField("y").setAlign(Blockly.ALIGN_RIGHT);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Blockscad.Msg.NOT_CENTERED,"false"],[Blockscad.Msg.CENTERED,"true"]]),"CENTERDROPDOWN").setAlign(Blockly.ALIGN_RIGHT);this.appendStatementInput("A").setCheck("CAG");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip(Blockscad.Msg.LINEAREXTRUDE_TOOLTIP);this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=
  168. 0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,
  169. this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())}};
  170. Blockly.Blocks.rotateextrude={init:function(){this.category="EXTRUDE";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField(Blockscad.Msg.ROTATE_EXTRUDE+" ");this.appendValueInput("FACES").setCheck("Number").appendField(Blockscad.Msg.SIDES).setAlign(Blockly.ALIGN_RIGHT);this.appendStatementInput("A").setCheck("CAG");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip(Blockscad.Msg.ROTATEEXTRUDE_TOOLTIP);
  171. this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},
  172. updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())}};
  173. Blockly.Blocks.rotateextrudetwist={init:function(){this.category="EXTRUDE";this.setHelpUrl("http://www.example.com/");this.setColour(Blockscad.Toolbox.HEX_TRANSFORM);this.appendDummyInput().appendField("Rotate Extrude Twist ");this.appendValueInput("RAD").setCheck("Number").appendField("R").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("FACES").setCheck("Number").appendField("Sides").setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("TWIST").setCheck("Number").appendField("Twist").setAlign(Blockly.ALIGN_RIGHT);
  174. this.appendValueInput("TSTEPS").setCheck("Number").appendField("Twist-steps").setAlign(Blockly.ALIGN_RIGHT);this.appendStatementInput("A").setCheck("CAG");this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setTooltip("Rotate extrudes shape translated by radius around the Z axis with a specified number of sides. ");this.setMutatorPlus(new Blockly.MutatorPlus(this));this.plusCount_=0},mutationToDom:function(){if(!this.plusCount_)return null;var a=document.createElement("mutation");this.plusCount_&&
  175. a.setAttribute("plus",this.plusCount_);return a},domToMutation:function(a){this.plusCount_=parseInt(a.getAttribute("plus"),10);a=this.getInput("A").connection.check_;for(var b=1;b<=this.plusCount_;b++)this.appendStatementInput("PLUS"+b).setCheck(a);1<=this.plusCount_&&this.setMutatorMinus(new Blockly.MutatorMinus(this))},updateShape_:function(a){1==a?(this.plusCount_++,a=this.getInput("A").connection.check_,this.appendStatementInput("PLUS"+this.plusCount_).setCheck(a)):-1==a&&(this.removeInput("PLUS"+
  176. this.plusCount_),this.plusCount_--);1<=this.plusCount_?1==this.plusCount_&&(this.setMutatorMinus(new Blockly.MutatorMinus(this)),this.render()):(this.mutatorMinus.dispose(),this.mutatorMinus=null,this.render())}};Blockly.Blocks.math_angle={init:function(){this.setColour(Blockscad.Toolbox.HEX_MATH);this.appendDummyInput().appendField(new Blockly.FieldAngle("0"),"NUM");this.setOutput(!0,"Number")}};
  177. Blockly.Blocks.math_constant_bs={init:function(){this.setHelpUrl(Blockly.Msg.MATH_CONSTANT_HELPURL);this.setColour(Blockscad.Toolbox.HEX_MATH);this.setOutput(!0,"Number");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"]]),"CONSTANT");this.setTooltip(Blockly.Msg.MATH_CONSTANT_TOOLTIP)}};
  178. Blockly.Blocks.stl_import={init:function(){this.category="PRIMITIVE_CSG";this.appendDummyInput().appendField(Blockscad.Msg.IMPORT_STL);this.appendDummyInput("").setAlign(Blockly.ALIGN_RIGHT).appendField(new Blockly.FieldLabel(""),"STL_FILENAME");this.appendDummyInput("").setAlign(Blockly.ALIGN_RIGHT).appendField(new Blockly.FieldButton(Blockscad.Msg.BROWSE),"STL_BUTTON");this.appendDummyInput("C").appendField(new Blockly.FieldLabel(""),"STL_CONTENTS").setVisible(!1);this.setInputsInline(!0);this.setPreviousStatement(!0);
  179. this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.setTooltip("");this.setWarningText(Blockscad.Msg.STL_IMPORT_WARNING);this.setHelpUrl("http://www.example.com/")},onchange:function(){if(this.workspace){var a=this.getField("STL_FILENAME").getText(),b=this.getField("STL_CONTENTS").getText();0<a.length&&(this.getField("STL_BUTTON").setVisible(!1),this.setCommentText(a+"\ncenter: ("+Blockscad.csg_center[b]+")"));this.getField("STL_CONTENTS").setVisible(!1)}}};
  180. Blockly.Blocks.bs_text={init:function(){for(var a=[],b=0;b<Blockscad.fontName.length;b++)a.push([Blockscad.fontName[b],b.toString()]);this.category="PRIMITIVE_CAG";this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);this.appendValueInput("TEXT").appendField(Blockscad.Msg.BLOCK_TEXT_2D).setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("SIZE").setCheck("Number").appendField(" "+Blockscad.Msg.FONT_SIZE).setAlign(Blockly.ALIGN_RIGHT);this.appendDummyInput().appendField(" "+Blockscad.Msg.FONT_NAME).appendField(new Blockly.FieldDropdown(a),
  181. "FONT");this.setInputsInline(!0);this.setPreviousStatement(!0,"CAG");this.setColour(Blockscad.Toolbox.HEX_2D_PRIMITIVE);this.setTooltip(Blockscad.Msg.BS_TEXT_TOOLTIP)},newQuote_:function(a){return new Blockly.FieldImage(a==this.RTL?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==":
  182. "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",12,12,'"')}};
  183. Blockly.Blocks.bs_3dtext={init:function(){for(var a=[],b=0;b<Blockscad.fontName.length;b++)a.push([Blockscad.fontName[b],b.toString()]);this.category="PRIMITIVE_CSG";this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);this.appendValueInput("TEXT").appendField(Blockscad.Msg.BLOCK_TEXT_3D).setAlign(Blockly.ALIGN_RIGHT);this.appendValueInput("SIZE").setCheck("Number").appendField(" "+Blockscad.Msg.FONT_SIZE).setAlign(Blockly.ALIGN_RIGHT);this.appendDummyInput().appendField(" "+Blockscad.Msg.FONT_NAME).appendField(new Blockly.FieldDropdown(a),
  184. "FONT");this.appendValueInput("THICKNESS").appendField(" "+Blockscad.Msg.TEXT_THICKNESS).setCheck("Number").setAlign(Blockly.ALIGN_RIGHT);this.setInputsInline(!0);this.setPreviousStatement(!0,"CSG");this.setColour(Blockscad.Toolbox.HEX_3D_PRIMITIVE);this.setTooltip(Blockscad.Msg.BS_3DTEXT_TOOLTIP)},newQuote_:function(a){return new Blockly.FieldImage(a==this.RTL?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==":
  185. "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",12,12,'"')}};function hideMyInput(a,b){b&&Blockscad.executeAfterDrag_(function(){a.isVisible()&&a.setVisible(!1);a.sourceBlock_.render()},a)}
  186. function showMyInput(a,b){!a.isVisible()&&b&&Blockscad.executeAfterDrag_(function(){var b=a.setVisible(!0);0<b.length&&b[0].render()},a)}Blockly.Blocks.bs_text_length={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_LENGTH_HELPURL);this.setColour(Blockscad.Toolbox.HEX_TEXT);this.interpolateMsg(Blockly.Msg.TEXT_LENGTH_TITLE,["VALUE",["String","Array"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setOutput(!0,"Number");this.setTooltip(Blockly.Msg.TEXT_LENGTH_TOOLTIP)}};Blockly.Blocks.procedures={};
  187. Blockly.Blocks.procedures_defnoreturn={init:function(){this.category="PROCEDURE";this.myType_=["CSG","CAG"];this.backlightBlocks=[];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");this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);this.setColour(Blockscad.Toolbox.HEX_PROCEDURE);
  188. this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.arguments_=[];this.setStatements_(!0,"VariableSet");this.statementConnection_=null},setType:function(a,b){if(this.workspace&&(goog.isArray(a)||(a=[a]),!Blockscad.arraysEqual(a,this.myType_))){var c=this.myType_,d=Blockly.Procedures.getCallers(this.getFieldValue("NAME"),this.workspace),e=[];this.myType_=a;var f=!0;Blockscad.workspace.undoStack_.length&&(f=Blockscad.workspace.undoStack_[Blockscad.workspace.undoStack_.length-1].group);
  189. Blockly.Events.setGroup(f);if(d.length)for(f=0;f<d.length;f++){var g=Blockscad.findBlockType(d[f],d);if("EITHER"!=g&&g!=a[0]&&(e.push(d[f]),g=d[f].collapsedParents()))for(var h=0;h<g.length;h++)g[h].setCollapsed(!1);d[f].previousConnection.setCheck(a);Blockly.Events.isEnabled()&&e.length&&Blockly.Events.fire(new Blockly.Events.Typing(d[f],c,a));d[f].category="CSG"==a[0]&&1==a.length?"PRIMITIVE_CSG":"CAG"==a[0]?"PRIMITIVE_CAG":"UNKNOWN";var k=Blockscad.hasParentOfType(d[f],"procedures_defnoreturn");
  190. k&&setTimeout(function(){k&&k.setType(a)},0);(g=d[f].getParent())&&Blockscad.assignBlockTypes(g)}Blockly.Events.setGroup(!1);for(c=0;c<e.length;c++)e[c].backlight(),this.backlightBlocks.push(e[c].id),d="",d+=Blockscad.Msg.BLOCKS_BUMPED_OUT_DIMENSIONS.replace("%1",e.length),this.setWarningText(d)}},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):
  191. 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();try{this.setFieldValue(a,"PARAMS")}finally{Blockly.Events.enable()}},
  192. 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()&&
  193. 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();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],
  194. "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),
  195. 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)}},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]=
  196. 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++){var f=goog.dom.createDom("arg");
  197. f.setAttribute("name",this.arguments_[e]);d.appendChild(f)}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=
  198. Blockly.ContextMenu.callbackFactory(this,d),a.push(b);b={enabled:!0};c=this.getFieldValue("NAME");b.text=Blockscad.Msg.HIGHLIGHT_INSTANCES.replace("%1",c);var g=this.workspace;b.callback=function(){if(Blockly.Procedures.getDefinition(c,g)){var a=Blockly.Procedures.getCallers(c,g);g.clearBacklight();Blockly.selected.unselect();for(var b=0;a&&b<a.length;b++){a[b]&&a[b].backlight();var d=a[b].collapsedParents();if(d)for(var e=0;e<d.length;e++)d[e].backlight()}}};a.push(b)},callType_:"procedures_callnoreturn"};
  199. Blockly.Blocks.procedures_defreturn={init:function(){this.category="PROCEDURE";this.myType_=null;this.backlightBlocks=[];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);this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));
  200. this.setColour(Blockscad.Toolbox.HEX_PROCEDURE);this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);this.arguments_=[];this.setStatements_(!1);this.statementConnection_=null},setType:function(a,b){if(this.workspace){var c=this.getInput("RETURN");a=c.connection.targetConnection?"Number"==c.connection.targetConnection.check_?"Number":"Boolean"==c.connection.targetConnection.check_?"Boolean":"String"==c.connection.targetConnection.check_?
  201. "String":null:null;if(this.myType_!=a){this.myType_=a;var d=Blockly.Procedures.getCallers(this.getFieldValue("NAME"),this.workspace),c=[],e,f=!0;Blockscad.workspace.undoStack_.length&&(f=Blockscad.workspace.undoStack_[Blockscad.workspace.undoStack_.length-1].group);Blockly.Events.setGroup(f);if(d.length)for(f=0;f<d.length;f++)if(d[f]){var g=d[f].getParent();if(g&&((e=d[f].outputConnection.targetConnection.check_)&&!goog.isArray(e)&&(e=[e]),e)){for(var h=0,g=0;g<e.length;g++)e[g]==this.myType_&&(h=
  202. 1);if(!h&&(c.push(d[f]),h=d[f].collapsedParents()))for(g=0;g<h.length;g++)h[g].setCollapsed(!1)}d[f]&&(d[f].outputConnection.setCheck(this.myType_),d[f].category="Number"==this.myType_?"NUMBER":"Boolean"==this.myType_?"BOOLEAN":"String"==this.myType_?"STRING":"UNKNOWN");var k=Blockscad.hasParentOfType(d[f],"procedures_defreturn");k||(k=Blockscad.hasParentOfType(d[f],"variables_set"));k?setTimeout(function(){k.setType(a)},0):(g=!1,d[f]&&(g=d[f].getParent()),g&&Blockscad.assignBlockTypes(g))}Blockly.Events.setGroup(!1);
  203. for(d=0;d<c.length;d++)c[d].backlight(),this.backlightBlocks.push(c[d].id),f="",f+=Blockscad.Msg.BLOCKS_BUMPED_OUT_TYPES.replace("%1",c.length).replace("%2",e).replace("%3",a),this.setWarningText(f)}}},setStatements_:Blockly.Blocks.procedures_defnoreturn.setStatements_,updateParams_:Blockly.Blocks.procedures_defnoreturn.updateParams_,mutationToDom:Blockly.Blocks.procedures_defnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_defnoreturn.domToMutation,decompose:Blockly.Blocks.procedures_defnoreturn.decompose,
  204. compose:Blockly.Blocks.procedures_defnoreturn.compose,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"};
  205. Blockly.Blocks.procedures_mutatorcontainer={init:function(){this.setColour(Blockscad.Toolbox.HEX_PROCEDURE);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.setTooltip(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1}};
  206. Blockly.Blocks.procedures_mutatorarg={init:function(){this.setColour(Blockscad.Toolbox.HEX_PROCEDURE);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(new Blockly.FieldTextInput("x",this.validator_),"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1},validator_:function(a){return(a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,""))||null}};
  207. Blockly.Blocks.procedures_callnoreturn={init:function(){this.category="UNKNOWN";this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.setColour(Blockscad.Toolbox.HEX_PROCEDURE);this.appendDummyInput("TOPROW").appendField(this.id,"NAME");this.setPreviousStatement(!0);this.arguments_=[];this.quarkConnections_={};this.quarkIds_=null;this.setType()},setType:function(){var a=Blockly.Procedures.getDefinition(this.getProcedureCall(),this.workspace);a&&(a=a.myType_)&&(this.previousConnection.setCheck(a),
  208. this.category="CSG"==a||a==["CSG"]?"PRIMITIVE_CSG":"CAG"==a||a==["CAG"]?"PRIMITIVE_CAG":"UNKNOWN")},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(),
  209. 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);
  210. 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=
  211. 0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);if(b){Blockly.Events.disable();try{b.setValue(this.arguments_[a])}finally{Blockly.Events.enable()}}else 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"),
  212. 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")),
  213. 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))},onchange:function(a){if(this.workspace&&!this.workspace.isFlyout)if(a.type==Blockly.Events.CREATE&&-1!=a.ids.indexOf(this.id)){var b=this.getProcedureCall(),b=Blockly.Procedures.getDefinition(b,this.workspace);!b||b.type==this.defType_&&JSON.stringify(b.arguments_)==
  214. JSON.stringify(this.arguments_)||(b=null);if(!b){Blockly.Events.setGroup(a.group);a=goog.dom.createDom("xml");b=goog.dom.createDom("block");b.setAttribute("type",this.defType_);var c=this.getRelativeToSurfaceXY(),d=c.y+2*Blockly.SNAP_RADIUS;b.setAttribute("x",c.x+Blockly.SNAP_RADIUS*(this.RTL?-1:1));b.setAttribute("y",d);c=this.mutationToDom();b.appendChild(c);c=goog.dom.createDom("field");c.setAttribute("name","NAME");c.appendChild(document.createTextNode(this.getProcedureCall()));b.appendChild(c);
  215. a.appendChild(b);Blockly.Xml.domToWorkspace(a,this.workspace);Blockly.Events.setGroup(!1)}}else a.type==Blockly.Events.DELETE&&(b=this.getProcedureCall(),b=Blockly.Procedures.getDefinition(b,this.workspace),b||(Blockly.Events.setGroup(a.group),this.dispose(!0,!1),Blockly.Events.setGroup(!1)))},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);
  216. d.clearBacklight();a&&a.select()};a.push(b);b={enabled:!0};c=this.getProcedureCall();b.text=Blockscad.Msg.HIGHLIGHT_INSTANCES.replace("%1",c);d=this.workspace;b.callback=function(){if(Blockly.Procedures.getDefinition(c,d)){var a=Blockly.Procedures.getCallers(c,d);d.clearBacklight();Blockly.selected.unselect();for(var b=0;a&&b<a.length;b++){a[b]&&a[b].backlight();var g=a[b].collapsedParents();if(g)for(var h=0;h<g.length;h++)g[h].backlight()}}};a.push(b)},defType_:"procedures_defnoreturn"};
  217. Blockly.Blocks.procedures_callreturn={init:function(){this.category="UNKNOWN";this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);this.setColour(Blockscad.Toolbox.HEX_PROCEDURE);this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.arguments_=[];this.quarkConnections_={};this.quarkIds_=null;this.setType()},setType:function(){var a=Blockly.Procedures.getDefinition(this.getFieldValue("NAME"),this.workspace);a&&(a=a.myType_)&&(this.outputConnection.setCheck(a),this.category=
  218. "Number"==a?"NUMBER":"Boolean"==a?"BOOLEAN":"UNKNOWN")},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,
  219. onchange:Blockly.Blocks.procedures_callnoreturn.onchange,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);d.clearBacklight();a&&a.backlight()};a.push(b);c=this.getProcedureCall();b={enabled:!0};b.text=Blockscad.Msg.HIGHLIGHT_INSTANCES.replace("%1",c);d=this.workspace;b.callback=function(){if(Blockly.Procedures.getDefinition(c,d)){var a=Blockly.Procedures.getCallers(c,
  220. d);d.clearBacklight();Blockly.selected.unselect();for(var b=0;a&&b<a.length;b++){a[b]&&a[b].backlight();var g=a[b].collapsedParents();if(g)for(var h=0;h<g.length;h++)g[h].backlight()}}};a.push(b)},defType_:"procedures_defreturn"};Blockly.Blocks.texts={};Blockscad.Toolbox=Blockscad.Toolbox||{};Blockly.Blocks.texts.HUE=Blockscad.Toolbox.HEX_TEXT;
  221. Blockly.Blocks.text={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);this.setColour(Blockscad.Toolbox.HEX_TEXT);this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new Blockly.FieldTextInput(Blockscad.Msg.TEXT_DEFAULT_VALUE),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(a){return new Blockly.FieldImage(a==this.RTL?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==":
  222. "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",10,10,"")}};
  223. 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,"String");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);
  224. this.updateShape_()},decompose:function(a){var b=Blockly.Block.obtain(a,"text_create_join_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=Blockly.Block.obtain(a,"text_create_join_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){a=a.getInputTargetBlock("STACK");for(var b=[],c=0;a;)b[c]=a.valueConnection_,a=a.nextConnection&&a.nextConnection.targetBlock(),c++;this.itemCount_=c;this.updateShape_();for(c=
  225. 0;c<this.itemCount_;c++)b[c]&&this.getInput("ADD"+c).connection.connect(b[c])},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(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var a=0;this.getInput("ADD"+a);)this.removeInput("ADD"+a),a++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));
  226. else for(a=0;a<this.itemCount_;a++){var b=this.appendValueInput("ADD"+a);0==a&&b.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH)}},newQuote_:Blockly.Blocks.text.newQuote_};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}};
  227. 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}};
  228. 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"))})},
  229. getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")}};Blockly.Blocks.text_length={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_LENGTH_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.interpolateMsg(Blockly.Msg.TEXT_LENGTH_TITLE,["VALUE",["String","Array"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setOutput(!0,"Number");this.setTooltip(Blockly.Msg.TEXT_LENGTH_TOOLTIP)}};
  230. Blockly.Blocks.text_isEmpty={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_ISEMPTY_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.interpolateMsg(Blockly.Msg.TEXT_ISEMPTY_TITLE,["VALUE",["String","Array"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setOutput(!0,"Boolean");this.setTooltip(Blockly.Msg.TEXT_ISEMPTY_TOOLTIP)}};
  231. 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,"Number");this.appendValueInput("VALUE").setCheck("String").appendField(Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT);this.appendValueInput("FIND").setCheck("String").appendField(new Blockly.FieldDropdown(a),"END");Blockly.Msg.TEXT_INDEXOF_TAIL&&this.appendDummyInput().appendField(Blockly.Msg.TEXT_INDEXOF_TAIL);
  232. this.setInputsInline(!0);this.setTooltip(Blockly.Msg.TEXT_INDEXOF_TOOLTIP)}};
  233. 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,"String");this.appendValueInput("VALUE").setCheck("String").appendField(Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT);this.appendDummyInput("AT");
  234. 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("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):
  235. 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 c="FROM_START"==b||"FROM_END"==b;if(c!=a){var e=this.sourceBlock_;e.updateAt_(c);e.setFieldValue(b,"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE")}};
  236. 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);
  237. this.appendValueInput("STRING").setCheck("String").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,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip(Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation"),
  238. 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("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):
  239. 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 d="FROM_START"==c||"FROM_END"==c;if(d!=b){var f=this.sourceBlock_;f.updateAt_(a,d);f.setFieldValue(c,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,"WHERE"+a);1==a&&this.moveInputBefore("AT1","AT2")}};
  240. 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("String").appendField(new Blockly.FieldDropdown(a),"CASE");this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_CHANGECASE_TOOLTIP)}};
  241. 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("String").appendField(new Blockly.FieldDropdown(a),"MODE");this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_TRIM_TOOLTIP)}};
  242. Blockly.Blocks.text_print={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_PRINT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.interpolateMsg(Blockly.Msg.TEXT_PRINT_TITLE,["TEXT",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP)}};
  243. Blockly.Blocks.text_prompt_ext={init:function(){var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];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,"String");this.setTooltip(function(){return"TEXT"==b.getFieldValue("TYPE")?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},
  244. updateType_:function(a){"NUMBER"==a?this.outputConnection.setCheck("Number"):this.outputConnection.setCheck("String")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
  245. Blockly.Blocks.text_prompt={init:function(){var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],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,"String");b=this;this.setTooltip(function(){return"TEXT"==
  246. b.getFieldValue("TYPE")?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};Blockly.Blocks.variables={};
  247. Blockly.Blocks.variables_get={init:function(){this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);this.setColour(Blockscad.Toolbox.HEX_VARIABLE);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;for(var a=Blockly.Variables.getInstances(this.getFieldValue("VAR"),this.workspace),b=0,c=0;c<a.length;c++){if("variables_set"==a[c].type){this.outputConnection.setCheck(a[c].myType_);
  248. b=1;break}if("controls_for"==a[c].type||"controls_for_chainhull"==a[c].type)this.outputConnection.setCheck(null),b=1}b||this.outputConnection.setCheck(null)},contextMenuType_:"variables_set",customContextMenu:function(a){var b={enabled:!0},c=this.getFieldValue("VAR");b.text=this.contextMenuMsg_.replace("%1",c);var d=goog.dom.createDom("field",null,c);d.setAttribute("name","VAR");d=goog.dom.createDom("block",null,d);d.setAttribute("type",this.contextMenuType_);b.callback=Blockly.ContextMenu.callbackFactory(this,
  249. d);a.push(b);b={enabled:!0};b.text=Blockscad.Msg.HIGHLIGHT_INSTANCES.replace("%1",c);var e=this.workspace,f=this;b.callback=function(){var a=Blockly.Variables.getInstances(c,e);e.clearBacklight();f.unselect();for(var b=0;a&&b<a.length;b++){a[b]&&a[b].backlight();var d=a[b].collapsedParents();if(d)for(var l=0;l<d.length;l++)d[l].backlight()}};a.push(b)}};
  250. Blockly.Blocks.variables_set={init:function(){this.myType_=null;this.backlightBlocks=[];this.jsonInit({message0:Blockly.Msg.VARIABLES_SET,args0:[{type:"field_variable",name:"VAR",variable:Blockly.Msg.VARIABLES_DEFAULT_NAME},{type:"input_value",name:"VALUE"}],inputsInline:!0});this.setHelpUrl(Blockly.Msg.VARIABLES_SET_HELPURL);this.setColour(Blockscad.Toolbox.HEX_VARIABLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP);this.contextMenuMsg_=
  251. Blockly.Msg.VARIABLES_SET_CREATE_GET},contextMenuType_:"variables_get",setType:function(a){if(this.workspace&&(null==a||goog.isArray(a)||(a=[a]),!Blockscad.arraysEqual(a,this.myType_))){var b=this.myType_;this.myType_=a;var c=Blockly.Variables.getInstances(this.getFieldValue("VAR"),this.workspace),d=[],e,f=!0;Blockscad.workspace.undoStack_.length&&(f=Blockscad.workspace.undoStack_[Blockscad.workspace.undoStack_.length-1].group);Blockly.Events.setGroup(f);if(0<c.length)for(f=0;f<c.length;f++)if("variables_get"==
  252. c[f].type){var g=c[f].getParent();if(null!=this.myType_&&g&&(e=c[f].outputConnection.targetConnection.check_,null!=e&&(e=e[0]),null!=e&&null!=a&&e!=a[0]&&(d.push(c[f]),g=c[f].collapsedParents())))for(var h=0;h<g.length;h++)g[h].setCollapsed(!1);c[f].outputConnection.setCheck(a);Blockly.Events.isEnabled()&&d.length&&Blockly.Events.fire(new Blockly.Events.Typing(c[f],b,a));var k=Blockscad.hasParentOfType(c[f],"procedures_defreturn");k||(k=Blockscad.hasParentOfType(c[f],"variables_set"));var l=Blockscad.hasParentOfType(c[f],
  253. "logic_ternary");setTimeout(function(){k&&!l&&k.setType(a)},0)}Blockly.Events.setGroup(!1);if(d.length){for(f=0;f<d.length;f++)d[f].backlight(),this.backlightBlocks.push(d[f].id);b=""+(Blockscad.Msg.VARIABLES_BUMPED_ONE.replace("%1",d.length)+"\n");b+=Blockscad.Msg.VARIABLES_BUMPED_TWO.replace("%1",this.getFieldValue("VAR")).replace("%2",e).replace("%3",a);this.setWarningText(b)}else this.setWarningText(null)}},customContextMenu:Blockly.Blocks.variables_get.customContextMenu};