mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-21 15:19:48 +00:00
[update] Electron, Blockly 他ライブラリをアップデート。非同期即時関数ブロック追加、非同期ループブロック削除
This commit is contained in:
parent
5cfca9043e
commit
41f1c30cde
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -7,60 +7,61 @@
|
|||||||
} else if (typeof exports === 'object') { // Node.js
|
} else if (typeof exports === 'object') { // Node.js
|
||||||
module.exports = factory(require("./blockly_compressed.js"));
|
module.exports = factory(require("./blockly_compressed.js"));
|
||||||
} else { // Browser
|
} else { // Browser
|
||||||
root.Blockly.Blocks = factory(root.Blockly);
|
var factoryExports = factory(root.Blockly);
|
||||||
|
root.Blockly.libraryBlocks = factoryExports;
|
||||||
}
|
}
|
||||||
}(this, function(Blockly) {
|
}(this, function(__parent__) {
|
||||||
const $=Blockly.internal_;
|
var $=__parent__.__namespace__;
|
||||||
var module$exports$Blockly$blocks$variablesDynamic={};
|
var module$exports$Blockly$libraryBlocks$variablesDynamic={};
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_dynamic_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},
|
module$exports$Blockly$libraryBlocks$variablesDynamic.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_dynamic_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",
|
||||||
{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_dynamic_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableDynamicSetterGetter"]}]);
|
args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_dynamic_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableDynamicSetterGetter"]}]);
|
||||||
var module$contents$Blockly$blocks$variablesDynamic_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getFieldValue("VAR");var c=this.workspace.getVariableById(b).type;if("variables_get_dynamic"===this.type){b="variables_set_dynamic";var d=$.module$exports$Blockly$Msg.Msg.VARIABLES_GET_CREATE_SET}else b="variables_get_dynamic",d=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET;var e={enabled:0<this.workspace.remainingCapacity()},
|
var module$contents$Blockly$libraryBlocks$variablesDynamic_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getFieldValue("VAR");var c=this.workspace.getVariableById(b).type;if("variables_get_dynamic"===this.type){b="variables_set_dynamic";var d=$.module$exports$Blockly$Msg.Msg.VARIABLES_GET_CREATE_SET}else b="variables_get_dynamic",d=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET;var e={enabled:0<this.workspace.remainingCapacity()},
|
||||||
f=this.getField("VAR").getText();e.text=d.replace("%1",f);d=(0,$.module$exports$Blockly$utils$xml.createElement)("field");d.setAttribute("name","VAR");d.setAttribute("variabletype",c);d.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(f));c=(0,$.module$exports$Blockly$utils$xml.createElement)("block");c.setAttribute("type",b);c.appendChild(d);e.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,c);a.push(e)}else if("variables_get_dynamic"===this.type||"variables_get_reporter_dynamic"===
|
f=this.getField("VAR").getText();e.text=d.replace("%1",f);d=(0,$.module$exports$Blockly$utils$xml.createElement)("field");d.setAttribute("name","VAR");d.setAttribute("variabletype",c);d.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(f));c=(0,$.module$exports$Blockly$utils$xml.createElement)("block");c.setAttribute("type",b);c.appendChild(d);e.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,c);a.push(e)}else if("variables_get_dynamic"===this.type||"variables_get_reporter_dynamic"===
|
||||||
this.type)b={text:$.module$exports$Blockly$Msg.Msg.RENAME_VARIABLE,enabled:!0,callback:module$contents$Blockly$blocks$variablesDynamic_renameOptionCallbackFactory(this)},e=this.getField("VAR").getText(),e={text:$.module$exports$Blockly$Msg.Msg.DELETE_VARIABLE.replace("%1",e),enabled:!0,callback:module$contents$Blockly$blocks$variablesDynamic_deleteOptionCallbackFactory(this)},a.unshift(b),a.unshift(e)},onchange:function(a){a=this.getFieldValue("VAR");a=(0,$.module$exports$Blockly$Variables.getVariable)(this.workspace,
|
this.type)b={text:$.module$exports$Blockly$Msg.Msg.RENAME_VARIABLE,enabled:!0,callback:module$contents$Blockly$libraryBlocks$variablesDynamic_renameOptionCallbackFactory(this)},e=this.getField("VAR").getText(),e={text:$.module$exports$Blockly$Msg.Msg.DELETE_VARIABLE.replace("%1",e),enabled:!0,callback:module$contents$Blockly$libraryBlocks$variablesDynamic_deleteOptionCallbackFactory(this)},a.unshift(b),a.unshift(e)},onchange:function(a){a=this.getFieldValue("VAR");a=(0,$.module$exports$Blockly$Variables.getVariable)(this.workspace,
|
||||||
a);"variables_get_dynamic"===this.type?this.outputConnection.setCheck(a.type):this.getInput("VALUE").connection.setCheck(a.type)}},module$contents$Blockly$blocks$variablesDynamic_renameOptionCallbackFactory=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();(0,$.module$exports$Blockly$Variables.renameVariable)(b,c)}},module$contents$Blockly$blocks$variablesDynamic_deleteOptionCallbackFactory=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();
|
a);"variables_get_dynamic"===this.type?this.outputConnection.setCheck(a.type):this.getInput("VALUE").connection.setCheck(a.type)}},module$contents$Blockly$libraryBlocks$variablesDynamic_renameOptionCallbackFactory=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();(0,$.module$exports$Blockly$Variables.renameVariable)(b,c)}},module$contents$Blockly$libraryBlocks$variablesDynamic_deleteOptionCallbackFactory=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();
|
||||||
b.deleteVariableById(c.getId());b.refreshToolboxSelection()}};(0,$.module$exports$Blockly$Extensions.registerMixin)("contextMenu_variableDynamicSetterGetter",module$contents$Blockly$blocks$variablesDynamic_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);var module$exports$Blockly$blocks$variables={};
|
b.deleteVariableById(c.getId());b.refreshToolboxSelection()}};(0,$.module$exports$Blockly$Extensions.registerMixin)("contextMenu_variableDynamicSetterGetter",module$contents$Blockly$libraryBlocks$variablesDynamic_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$variablesDynamic.blocks);var module$exports$Blockly$libraryBlocks$variables={};
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",
|
module$exports$Blockly$libraryBlocks$variables.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",
|
||||||
name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);
|
variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);
|
||||||
var module$contents$Blockly$blocks$variables_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){if("variables_get"===this.type){var b="variables_set";var c=$.module$exports$Blockly$Msg.Msg.VARIABLES_GET_CREATE_SET}else b="variables_get",c=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET;var d={enabled:0<this.workspace.remainingCapacity()},e=this.getField("VAR").getText();d.text=c.replace("%1",e);c=(0,$.module$exports$Blockly$utils$xml.createElement)("field");
|
var module$contents$Blockly$libraryBlocks$variables_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){if("variables_get"===this.type){var b="variables_set";var c=$.module$exports$Blockly$Msg.Msg.VARIABLES_GET_CREATE_SET}else b="variables_get",c=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET;var d={enabled:0<this.workspace.remainingCapacity()},e=this.getField("VAR").getText();d.text=c.replace("%1",e);c=(0,$.module$exports$Blockly$utils$xml.createElement)("field");
|
||||||
c.setAttribute("name","VAR");c.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(e));e=(0,$.module$exports$Blockly$utils$xml.createElement)("block");e.setAttribute("type",b);e.appendChild(c);d.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,e);a.push(d)}else if("variables_get"===this.type||"variables_get_reporter"===this.type)b={text:$.module$exports$Blockly$Msg.Msg.RENAME_VARIABLE,enabled:!0,callback:module$contents$Blockly$blocks$variables_renameOptionCallbackFactory(this)},
|
c.setAttribute("name","VAR");c.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(e));e=(0,$.module$exports$Blockly$utils$xml.createElement)("block");e.setAttribute("type",b);e.appendChild(c);d.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,e);a.push(d)}else if("variables_get"===this.type||"variables_get_reporter"===this.type)b={text:$.module$exports$Blockly$Msg.Msg.RENAME_VARIABLE,enabled:!0,callback:module$contents$Blockly$libraryBlocks$variables_renameOptionCallbackFactory(this)},
|
||||||
d=this.getField("VAR").getText(),d={text:$.module$exports$Blockly$Msg.Msg.DELETE_VARIABLE.replace("%1",d),enabled:!0,callback:module$contents$Blockly$blocks$variables_deleteOptionCallbackFactory(this)},a.unshift(b),a.unshift(d)}},module$contents$Blockly$blocks$variables_renameOptionCallbackFactory=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();(0,$.module$exports$Blockly$Variables.renameVariable)(b,c)}},module$contents$Blockly$blocks$variables_deleteOptionCallbackFactory=
|
d=this.getField("VAR").getText(),d={text:$.module$exports$Blockly$Msg.Msg.DELETE_VARIABLE.replace("%1",d),enabled:!0,callback:module$contents$Blockly$libraryBlocks$variables_deleteOptionCallbackFactory(this)},a.unshift(b),a.unshift(d)}},module$contents$Blockly$libraryBlocks$variables_renameOptionCallbackFactory=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();(0,$.module$exports$Blockly$Variables.renameVariable)(b,c)}},module$contents$Blockly$libraryBlocks$variables_deleteOptionCallbackFactory=
|
||||||
function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();b.deleteVariableById(c.getId());b.refreshToolboxSelection()}};(0,$.module$exports$Blockly$Extensions.registerMixin)("contextMenu_variableSetterGetter",module$contents$Blockly$blocks$variables_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);var module$exports$Blockly$blocks$texts={};
|
function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();b.deleteVariableById(c.getId());b.refreshToolboxSelection()}};(0,$.module$exports$Blockly$Extensions.registerMixin)("contextMenu_variableSetterGetter",module$contents$Blockly$libraryBlocks$variables_CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$variables.blocks);var module$exports$Blockly$libraryBlocks$texts={};
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_multiline",message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,
|
module$exports$Blockly$libraryBlocks$texts.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_multiline",message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,
|
||||||
height:17,alt:"\u00b6"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"},
|
height:17,alt:"\u00b6"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"},
|
||||||
{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}],
|
{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}],
|
||||||
previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",
|
previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",
|
||||||
helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",
|
helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",
|
||||||
args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);
|
args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_END_FROM_END,
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_END_FROM_END,
|
||||||
"FROM_END"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_HELPURL);this.setStyle("text_blocks");this.appendValueInput("STRING").setCheck("String").appendField($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);this.appendDummyInput("AT1");this.appendDummyInput("AT2");$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL);
|
"FROM_END"],[$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_HELPURL);this.setStyle("text_blocks");this.appendValueInput("STRING").setCheck("String").appendField($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);this.appendDummyInput("AT1");this.appendDummyInput("AT2");$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL);
|
||||||
this.setInputsInline(!0);this.setOutput(!0,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation"),b=this.getInput("AT1").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at2",
|
this.setInputsInline(!0);this.setOutput(!0,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation"),b=this.getInput("AT1").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type===$.module$exports$Blockly$ConnectionType.ConnectionType.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"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);2===a&&$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL&&
|
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"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);2===a&&$.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL&&
|
||||||
(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL));var c=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this["WHERE_OPTIONS_"+a],function(d){var e="FROM_START"===d||"FROM_END"===d;if(e!==b){var f=this.getSourceBlock();f.updateAt_(a,e);f.setFieldValue(d,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,"WHERE"+a);1===a&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1",
|
(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.TEXT_GET_SUBSTRING_TAIL));var c=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this["WHERE_OPTIONS_"+a],function(d){var e="FROM_START"===d||"FROM_END"===d;if(e!==b){var f=this.getSourceBlock();f.updateAt_(a,e);f.setFieldValue(d,"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"))}};
|
"AT2"))}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_changeCase={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[$.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[$.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),"CASE");
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_changeCase={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[$.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[$.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),"CASE");
|
||||||
this.setOutput(!0,"String");this.setTooltip($.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_TOOLTIP)}};
|
this.setOutput(!0,"String");this.setTooltip($.module$exports$Blockly$Msg.Msg.TEXT_CHANGECASE_TOOLTIP)}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_trim={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[$.module$exports$Blockly$Msg.Msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[$.module$exports$Blockly$Msg.Msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_TRIM_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),"MODE");this.setOutput(!0,
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_trim={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[$.module$exports$Blockly$Msg.Msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[$.module$exports$Blockly$Msg.Msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_TRIM_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),"MODE");
|
||||||
"String");this.setTooltip($.module$exports$Blockly$Msg.Msg.TEXT_TRIM_TOOLTIP)}};$.module$exports$Blockly$blocks.Blocks.text_print={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_PRINT_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_PRINT_HELPURL})}};
|
this.setOutput(!0,"String");this.setTooltip($.module$exports$Blockly$Msg.Msg.TEXT_TRIM_TOOLTIP)}};module$exports$Blockly$libraryBlocks$texts.blocks.text_print={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_PRINT_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_PRINT_HELPURL})}};
|
||||||
var module$contents$Blockly$blocks$texts_TEXT_PROMPT_COMMON={updateType_:function(a){this.outputConnection.setCheck("NUMBER"===a?"Number":"String")},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
|
var module$contents$Blockly$libraryBlocks$texts_TEXT_PROMPT_COMMON={updateType_:function(a){this.outputConnection.setCheck("NUMBER"===a?"Number":"String")},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_prompt_ext=Object.assign({},module$contents$Blockly$blocks$texts_TEXT_PROMPT_COMMON,{init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");var b=this;a=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a,function(c){b.updateType_(c)});this.appendValueInput("TEXT").appendField(a,
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_prompt_ext=Object.assign({},module$contents$Blockly$libraryBlocks$texts_TEXT_PROMPT_COMMON,{init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");var b=this;a=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a,function(c){b.updateType_(c)});
|
||||||
"TYPE");this.setOutput(!0,"String");this.setTooltip(function(){return"TEXT"===b.getFieldValue("TYPE")?$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_TEXT:$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})}});
|
this.appendValueInput("TEXT").appendField(a,"TYPE");this.setOutput(!0,"String");this.setTooltip(function(){return"TEXT"===b.getFieldValue("TYPE")?$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_TEXT:$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})}});
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_prompt=Object.assign({},module$contents$Blockly$blocks$texts_TEXT_PROMPT_COMMON,{init:function(){this.mixin(module$contents$Blockly$blocks$texts_QUOTE_IMAGE_MIXIN);var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],b=this;this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a,
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_prompt=Object.assign({},module$contents$Blockly$libraryBlocks$texts_TEXT_PROMPT_COMMON,{init:function(){this.mixin(module$contents$Blockly$libraryBlocks$texts_QUOTE_IMAGE_MIXIN);var a=[[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],b=this;this.setHelpUrl($.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a,
|
||||||
function(c){b.updateType_(c)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField(new $.module$exports$Blockly$FieldTextInput.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(function(){return"TEXT"===b.getFieldValue("TYPE")?$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_TEXT:$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})}});
|
function(c){b.updateType_(c)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField(new $.module$exports$Blockly$FieldTextInput.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(function(){return"TEXT"===b.getFieldValue("TYPE")?$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_TEXT:$.module$exports$Blockly$Msg.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})}});
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_count={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_COUNT_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_COUNT_HELPURL})}};
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_count={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_COUNT_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_COUNT_HELPURL})}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_replace={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_REPLACE_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_REPLACE_HELPURL})}};
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_replace={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_REPLACE_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_REPLACE_HELPURL})}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.text_reverse={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_REVERSE_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_REVERSE_HELPURL})}};
|
module$exports$Blockly$libraryBlocks$texts.blocks.text_reverse={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.TEXT_REVERSE_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.TEXT_REVERSE_HELPURL})}};
|
||||||
var module$contents$Blockly$blocks$texts_QUOTE_IMAGE_MIXIN={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
|
var module$contents$Blockly$libraryBlocks$texts_QUOTE_IMAGE_MIXIN={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
|
||||||
QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(a===e.name){c.insertFieldAt(d,this.newQuote_(!0));c.insertFieldAt(d+2,this.newQuote_(!1));return}console.warn('field named "'+a+'" not found in '+this.toDevString())},newQuote_:function(a){a=this.RTL?!a:a;return new $.module$exports$Blockly$FieldImage.FieldImage(a?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,this.QUOTE_IMAGE_WIDTH,this.QUOTE_IMAGE_HEIGHT,
|
QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(a===e.name){c.insertFieldAt(d,this.newQuote_(!0));c.insertFieldAt(d+2,this.newQuote_(!1));return}console.warn('field named "'+a+'" not found in '+this.toDevString())},newQuote_:function(a){a=this.RTL?!a:a;return new $.module$exports$Blockly$FieldImage.FieldImage(a?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,this.QUOTE_IMAGE_WIDTH,this.QUOTE_IMAGE_HEIGHT,
|
||||||
a?"\u201c":"\u201d")}},module$contents$Blockly$blocks$texts_TEXT_QUOTES_EXTENSION=function(){this.mixin(module$contents$Blockly$blocks$texts_QUOTE_IMAGE_MIXIN);this.quoteField_("TEXT")},module$contents$Blockly$blocks$texts_TEXT_JOIN_MUTATOR_MIXIN={mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},
|
a?"\u201c":"\u201d")}},module$contents$Blockly$libraryBlocks$texts_TEXT_QUOTES_EXTENSION=function(){this.mixin(module$contents$Blockly$libraryBlocks$texts_QUOTE_IMAGE_MIXIN);this.quoteField_("TEXT")},module$contents$Blockly$libraryBlocks$texts_TEXT_JOIN_MUTATOR_MIXIN={mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},
|
||||||
loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("text_create_join_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("text_create_join_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b&&!b.isInsertionMarker();)a.push(b.valueConnection_),b=b.nextConnection&&b.nextConnection.targetBlock();
|
saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("text_create_join_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("text_create_join_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b&&!b.isInsertionMarker();)a.push(b.valueConnection_),
|
||||||
for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;c&&-1===a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)$.module$exports$Blockly$Mutator.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;a=a.nextConnection&&a.nextConnection.targetBlock();b++}},updateShape_:function(){this.itemCount_&&
|
b=b.nextConnection&&b.nextConnection.targetBlock();for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;c&&-1===a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)$.module$exports$Blockly$Mutator.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;a=a.nextConnection&&a.nextConnection.targetBlock();
|
||||||
this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+a).setAlign($.module$exports$Blockly$Input.Align.RIGHT);0===a&&b.appendField($.module$exports$Blockly$Msg.Msg.TEXT_JOIN_TITLE_CREATEWITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}},module$contents$Blockly$blocks$texts_TEXT_JOIN_EXTENSION=
|
b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+a).setAlign($.module$exports$Blockly$Input.Align.RIGHT);0===a&&b.appendField($.module$exports$Blockly$Msg.Msg.TEXT_JOIN_TITLE_CREATEWITH)}for(a=this.itemCount_;this.getInput("ADD"+
|
||||||
function(){this.mixin(module$contents$Blockly$blocks$texts_QUOTE_IMAGE_MIXIN);this.itemCount_=2;this.updateShape_();this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["text_create_join_item"]))};(0,$.module$exports$Blockly$Extensions.register)("text_append_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_TEXT_APPEND_TOOLTIP}","VAR"));
|
a);a++)this.removeInput("ADD"+a)}},module$contents$Blockly$libraryBlocks$texts_TEXT_JOIN_EXTENSION=function(){this.mixin(module$contents$Blockly$libraryBlocks$texts_QUOTE_IMAGE_MIXIN);this.itemCount_=2;this.updateShape_();this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["text_create_join_item"]))};(0,$.module$exports$Blockly$Extensions.register)("text_append_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_TEXT_APPEND_TOOLTIP}","VAR"));
|
||||||
var module$contents$Blockly$blocks$texts_TEXT_INDEXOF_TOOLTIP_EXTENSION=function(){var a=this;this.setTooltip(function(){return $.module$exports$Blockly$Msg.Msg.TEXT_INDEXOF_TOOLTIP.replace("%1",a.workspace.options.oneBasedIndex?"0":"-1")})},module$contents$Blockly$blocks$texts_TEXT_CHARAT_MUTATOR_MIXIN={mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("at",!!this.isAt_);return a},domToMutation:function(a){a="false"!==a.getAttribute("at");
|
var module$contents$Blockly$libraryBlocks$texts_TEXT_INDEXOF_TOOLTIP_EXTENSION=function(){var a=this;this.setTooltip(function(){return $.module$exports$Blockly$Msg.Msg.TEXT_INDEXOF_TOOLTIP.replace("%1",a.workspace.options.oneBasedIndex?"0":"-1")})},module$contents$Blockly$libraryBlocks$texts_TEXT_CHARAT_MUTATOR_MIXIN={mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("at",!!this.isAt_);return a},domToMutation:function(a){a="false"!==a.getAttribute("at");
|
||||||
this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT",!0);this.removeInput("ORDINAL",!0);a&&(this.appendValueInput("AT").setCheck("Number"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX));$.module$exports$Blockly$Msg.Msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.TEXT_CHARAT_TAIL));this.isAt_=a}},module$contents$Blockly$blocks$texts_TEXT_CHARAT_EXTENSION=
|
this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT",!0);this.removeInput("ORDINAL",!0);a&&(this.appendValueInput("AT").setCheck("Number"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX));$.module$exports$Blockly$Msg.Msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.TEXT_CHARAT_TAIL));this.isAt_=a}},module$contents$Blockly$libraryBlocks$texts_TEXT_CHARAT_EXTENSION=
|
||||||
function(){this.getField("WHERE").setValidator(function(b){b="FROM_START"===b||"FROM_END"===b;b!==this.isAt_&&this.getSourceBlock().updateAt_(b)});this.updateAt_(!0);var a=this;this.setTooltip(function(){var b=a.getFieldValue("WHERE"),c=$.module$exports$Blockly$Msg.Msg.TEXT_CHARAT_TOOLTIP;("FROM_START"===b||"FROM_END"===b)&&(b="FROM_START"===b?$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_FROM_START_TOOLTIP:$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(c+=" "+b.replace("%1",a.workspace.options.oneBasedIndex?
|
function(){this.getField("WHERE").setValidator(function(b){b="FROM_START"===b||"FROM_END"===b;b!==this.isAt_&&this.getSourceBlock().updateAt_(b)});this.updateAt_(!0);var a=this;this.setTooltip(function(){var b=a.getFieldValue("WHERE"),c=$.module$exports$Blockly$Msg.Msg.TEXT_CHARAT_TOOLTIP;("FROM_START"===b||"FROM_END"===b)&&(b="FROM_START"===b?$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_FROM_START_TOOLTIP:$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(c+=" "+b.replace("%1",a.workspace.options.oneBasedIndex?
|
||||||
"#1":"#0"));return c})};(0,$.module$exports$Blockly$Extensions.register)("text_indexOf_tooltip",module$contents$Blockly$blocks$texts_TEXT_INDEXOF_TOOLTIP_EXTENSION);(0,$.module$exports$Blockly$Extensions.register)("text_quotes",module$contents$Blockly$blocks$texts_TEXT_QUOTES_EXTENSION);(0,$.module$exports$Blockly$Extensions.registerMutator)("text_join_mutator",module$contents$Blockly$blocks$texts_TEXT_JOIN_MUTATOR_MIXIN,module$contents$Blockly$blocks$texts_TEXT_JOIN_EXTENSION);
|
"#1":"#0"));return c})};(0,$.module$exports$Blockly$Extensions.register)("text_indexOf_tooltip",module$contents$Blockly$libraryBlocks$texts_TEXT_INDEXOF_TOOLTIP_EXTENSION);(0,$.module$exports$Blockly$Extensions.register)("text_quotes",module$contents$Blockly$libraryBlocks$texts_TEXT_QUOTES_EXTENSION);(0,$.module$exports$Blockly$Extensions.registerMutator)("text_join_mutator",module$contents$Blockly$libraryBlocks$texts_TEXT_JOIN_MUTATOR_MIXIN,module$contents$Blockly$libraryBlocks$texts_TEXT_JOIN_EXTENSION);
|
||||||
(0,$.module$exports$Blockly$Extensions.registerMutator)("text_charAt_mutator",module$contents$Blockly$blocks$texts_TEXT_CHARAT_MUTATOR_MIXIN,module$contents$Blockly$blocks$texts_TEXT_CHARAT_EXTENSION);var module$exports$Blockly$blocks$procedures={},module$contents$Blockly$blocks$procedures_PROCEDURE_DEF_COMMON={setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=$.module$exports$Blockly$Msg.Msg.PROCEDURES_BEFORE_PARAMS+
|
(0,$.module$exports$Blockly$Extensions.registerMutator)("text_charAt_mutator",module$contents$Blockly$libraryBlocks$texts_TEXT_CHARAT_MUTATOR_MIXIN,module$contents$Blockly$libraryBlocks$texts_TEXT_CHARAT_EXTENSION);(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$texts.blocks);var module$exports$Blockly$libraryBlocks$procedures={blocks:{}},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_DEF_COMMON={setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=$.module$exports$Blockly$Msg.Msg.PROCEDURES_BEFORE_PARAMS+
|
||||||
" "+this.arguments_.join(", "));(0,$.module$exports$Blockly$Events.disable)();try{this.setFieldValue(a,"PARAMS")}finally{(0,$.module$exports$Blockly$Events.enable)()}},mutationToDom:function(a){var b=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a&&b.setAttribute("name",this.getFieldValue("NAME"));for(var c=0;c<this.argumentVarModels_.length;c++){var d=(0,$.module$exports$Blockly$utils$xml.createElement)("arg"),e=this.argumentVarModels_[c];d.setAttribute("name",e.name);d.setAttribute("varid",
|
" "+this.arguments_.join(", "));(0,$.module$exports$Blockly$Events.disable)();try{this.setFieldValue(a,"PARAMS")}finally{(0,$.module$exports$Blockly$Events.enable)()}},mutationToDom:function(a){var b=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a&&b.setAttribute("name",this.getFieldValue("NAME"));for(var c=0;c<this.argumentVarModels_.length;c++){var d=(0,$.module$exports$Blockly$utils$xml.createElement)("arg"),e=this.argumentVarModels_[c];d.setAttribute("name",e.name);d.setAttribute("varid",
|
||||||
e.getId());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_=[];this.argumentVarModels_=[];for(var b=0,c;c=a.childNodes[b];b++)if("arg"===c.nodeName.toLowerCase()){var d=c.getAttribute("name");c=c.getAttribute("varid")||c.getAttribute("varId");this.arguments_.push(d);c=(0,$.module$exports$Blockly$Variables.getOrCreateVariablePackage)(this.workspace,c,d,"");null!==
|
e.getId());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_=[];this.argumentVarModels_=[];for(var b=0,c;c=a.childNodes[b];b++)if("arg"===c.nodeName.toLowerCase()){var d=c.getAttribute("name");c=c.getAttribute("varid")||c.getAttribute("varId");this.arguments_.push(d);c=(0,$.module$exports$Blockly$Variables.getOrCreateVariablePackage)(this.workspace,c,d,"");null!==
|
||||||
c?this.argumentVarModels_.push(c):console.log("Failed to create a variable with name "+d+", ignoring.")}this.updateParams_();(0,$.module$exports$Blockly$Procedures.mutateCallers)(this);this.setStatements_("false"!==a.getAttribute("statements"))},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;var a=Object.create(null);if(this.argumentVarModels_.length){a.params=[];for(var b=0;b<this.argumentVarModels_.length;b++)a.params.push({name:this.argumentVarModels_[b].name,
|
c?this.argumentVarModels_.push(c):console.log("Failed to create a variable with name "+d+", ignoring.")}this.updateParams_();(0,$.module$exports$Blockly$Procedures.mutateCallers)(this);this.setStatements_("false"!==a.getAttribute("statements"))},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;var a=Object.create(null);if(this.argumentVarModels_.length){a.params=[];for(var b=0;b<this.argumentVarModels_.length;b++)a.params.push({name:this.argumentVarModels_[b].name,
|
||||||
@ -72,105 +73,106 @@ $.module$exports$Blockly$Mutator.Mutator.reconnect(this.statementConnection_,thi
|
|||||||
for(var d=!1,e=0;e<this.argumentVarModels_.length;e++)this.argumentVarModels_[e].getId()===a&&(this.arguments_[e]=b.name,this.argumentVarModels_[e]=b,d=!0);d&&(this.displayRenamedVar_(c,b.name),(0,$.module$exports$Blockly$Procedures.mutateCallers)(this))}},updateVarName:function(a){for(var b=a.name,c=!1,d,e=0;e<this.argumentVarModels_.length;e++)this.argumentVarModels_[e].getId()===a.getId()&&(d=this.arguments_[e],this.arguments_[e]=b,c=!0);c&&(this.displayRenamedVar_(d,b),(0,$.module$exports$Blockly$Procedures.mutateCallers)(this))},
|
for(var d=!1,e=0;e<this.argumentVarModels_.length;e++)this.argumentVarModels_[e].getId()===a&&(this.arguments_[e]=b.name,this.argumentVarModels_[e]=b,d=!0);d&&(this.displayRenamedVar_(c,b.name),(0,$.module$exports$Blockly$Procedures.mutateCallers)(this))}},updateVarName:function(a){for(var b=a.name,c=!1,d,e=0;e<this.argumentVarModels_.length;e++)this.argumentVarModels_[e].getId()===a.getId()&&(d=this.arguments_[e],this.arguments_[e]=b,c=!0);c&&(this.displayRenamedVar_(d,b),(0,$.module$exports$Blockly$Procedures.mutateCallers)(this))},
|
||||||
displayRenamedVar_:function(a,b){this.updateParams_();if(this.mutator&&this.mutator.isVisible())for(var c=this.mutator.workspace_.getAllBlocks(!1),d=0,e;e=c[d];d++)"procedures_mutatorarg"===e.type&&$.module$exports$Blockly$Names.Names.equals(a,e.getFieldValue("NAME"))&&e.setFieldValue(b,"NAME")},customContextMenu:function(a){if(!this.isInFlyout){var b={enabled:!0},c=this.getFieldValue("NAME");b.text=$.module$exports$Blockly$Msg.Msg.PROCEDURES_CREATE_DO.replace("%1",c);var d=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");
|
displayRenamedVar_:function(a,b){this.updateParams_();if(this.mutator&&this.mutator.isVisible())for(var c=this.mutator.workspace_.getAllBlocks(!1),d=0,e;e=c[d];d++)"procedures_mutatorarg"===e.type&&$.module$exports$Blockly$Names.Names.equals(a,e.getFieldValue("NAME"))&&e.setFieldValue(b,"NAME")},customContextMenu:function(a){if(!this.isInFlyout){var b={enabled:!0},c=this.getFieldValue("NAME");b.text=$.module$exports$Blockly$Msg.Msg.PROCEDURES_CREATE_DO.replace("%1",c);var d=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");
|
||||||
d.setAttribute("name",c);for(c=0;c<this.arguments_.length;c++){var e=(0,$.module$exports$Blockly$utils$xml.createElement)("arg");e.setAttribute("name",this.arguments_[c]);d.appendChild(e)}c=(0,$.module$exports$Blockly$utils$xml.createElement)("block");c.setAttribute("type",this.callType_);c.appendChild(d);b.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,c);a.push(b);if(!this.isCollapsed())for(b=0;b<this.argumentVarModels_.length;b++)d={enabled:!0},c=this.argumentVarModels_[b],
|
d.setAttribute("name",c);for(c=0;c<this.arguments_.length;c++){var e=(0,$.module$exports$Blockly$utils$xml.createElement)("arg");e.setAttribute("name",this.arguments_[c]);d.appendChild(e)}c=(0,$.module$exports$Blockly$utils$xml.createElement)("block");c.setAttribute("type",this.callType_);c.appendChild(d);b.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,c);a.push(b);if(!this.isCollapsed())for(b=0;b<this.argumentVarModels_.length;b++)d={enabled:!0},c=this.argumentVarModels_[b],
|
||||||
d.text=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c.name),c=(0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(c),e=(0,$.module$exports$Blockly$utils$xml.createElement)("block"),e.setAttribute("type","variables_get"),e.appendChild(c),d.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,e),a.push(d)}},callType_:"procedures_callnoreturn"};
|
d.text=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c.name),c=(0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(c),e=(0,$.module$exports$Blockly$utils$xml.createElement)("block"),e.setAttribute("type","variables_get"),e.appendChild(c),d.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,e),a.push(d)}}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.procedures_defnoreturn=Object.assign({},module$contents$Blockly$blocks$procedures_PROCEDURE_DEF_COMMON,{init:function(){var a=(0,$.module$exports$Blockly$Procedures.findLegalName)("",this);a=new $.module$exports$Blockly$FieldTextInput.FieldTextInput(a,$.module$exports$Blockly$Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_defnoreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_DEF_COMMON,{init:function(){var a=(0,$.module$exports$Blockly$Procedures.findLegalName)("",this);a=new $.module$exports$Blockly$FieldTextInput.FieldTextInput(a,$.module$exports$Blockly$Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("",
|
||||||
this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&$.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_HELPURL);
|
"PARAMS");this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&$.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_HELPURL);
|
||||||
this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]}});
|
this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},callType_:"procedures_callnoreturn"});
|
||||||
$.module$exports$Blockly$blocks.Blocks.procedures_defreturn=Object.assign({},module$contents$Blockly$blocks$procedures_PROCEDURE_DEF_COMMON,{init:function(){var a=(0,$.module$exports$Blockly$Procedures.findLegalName)("",this);a=new $.module$exports$Blockly$FieldTextInput.FieldTextInput(a,$.module$exports$Blockly$Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign($.module$exports$Blockly$Input.Align.RIGHT).appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN);
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_defreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_DEF_COMMON,{init:function(){var a=(0,$.module$exports$Blockly$Procedures.findLegalName)("",this);a=new $.module$exports$Blockly$FieldTextInput.FieldTextInput(a,$.module$exports$Blockly$Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("",
|
||||||
this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&$.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_HELPURL);
|
"PARAMS");this.appendValueInput("RETURN").setAlign($.module$exports$Blockly$Input.Align.RIGHT).appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN);this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&$.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_COMMENT);
|
||||||
this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]}});
|
this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},callType_:"procedures_callreturn"});
|
||||||
$.module$exports$Blockly$blocks.Blocks.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new $.module$exports$Blockly$FieldCheckbox.FieldCheckbox("TRUE"),"STATEMENTS");this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new $.module$exports$Blockly$FieldCheckbox.FieldCheckbox("TRUE"),"STATEMENTS");this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);
|
||||||
this.contextMenu=!1}};
|
this.contextMenu=!1}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.procedures_mutatorarg={init:function(){var a=new $.module$exports$Blockly$FieldTextInput.FieldTextInput($.module$exports$Blockly$Procedures.DEFAULT_ARG,this.validator_);a.oldShowEditorFn_=a.showEditor_;a.showEditor_=function(){this.createdVariables_=[];this.oldShowEditorFn_()};this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(a,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_mutatorarg={init:function(){var a=new $.module$exports$Blockly$FieldTextInput.FieldTextInput($.module$exports$Blockly$Procedures.DEFAULT_ARG,this.validator_);a.oldShowEditorFn_=a.showEditor_;a.showEditor_=function(){this.createdVariables_=[];this.oldShowEditorFn_()};this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(a,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);
|
||||||
this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1;a.onFinishEditing_=this.deleteIntermediateVars_;a.createdVariables_=[];a.onFinishEditing_("x")},validator_:function(a){var b=this.getSourceBlock(),c=$.module$exports$Blockly$Mutator.Mutator.findParentWs(b.workspace);a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"");if(!a)return null;for(var d=(b.workspace.targetWorkspace||b.workspace).getAllBlocks(!1),e=a.toLowerCase(),f=0;f<d.length;f++)if(d[f].id!==
|
this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1;a.onFinishEditing_=this.deleteIntermediateVars_;a.createdVariables_=[];a.onFinishEditing_("x")},validator_:function(a){var b=this.getSourceBlock(),c=$.module$exports$Blockly$Mutator.Mutator.findParentWs(b.workspace);a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"");if(!a)return null;for(var d=(b.workspace.targetWorkspace||b.workspace).getAllBlocks(!1),e=a.toLowerCase(),
|
||||||
this.getSourceBlock().id){var g=d[f].getFieldValue("NAME");if(g&&g.toLowerCase()===e)return null}if(b.isInFlyout)return a;(b=c.getVariable(a,""))&&b.name!==a&&c.renameVariableById(b.getId(),a);b||(b=c.createVariable(a,""))&&this.createdVariables_&&this.createdVariables_.push(b);return a},deleteIntermediateVars_:function(a){var b=$.module$exports$Blockly$Mutator.Mutator.findParentWs(this.getSourceBlock().workspace);if(b)for(var c=0;c<this.createdVariables_.length;c++){var d=this.createdVariables_[c];
|
f=0;f<d.length;f++)if(d[f].id!==this.getSourceBlock().id){var g=d[f].getFieldValue("NAME");if(g&&g.toLowerCase()===e)return null}if(b.isInFlyout)return a;(b=c.getVariable(a,""))&&b.name!==a&&c.renameVariableById(b.getId(),a);b||(b=c.createVariable(a,""))&&this.createdVariables_&&this.createdVariables_.push(b);return a},deleteIntermediateVars_:function(a){var b=$.module$exports$Blockly$Mutator.Mutator.findParentWs(this.getSourceBlock().workspace);if(b)for(var c=0;c<this.createdVariables_.length;c++){var d=
|
||||||
d.name!==a&&b.deleteVariableById(d.getId())}}};
|
this.createdVariables_[c];d.name!==a&&b.deleteVariableById(d.getId())}}};
|
||||||
var module$contents$Blockly$blocks$procedures_PROCEDURE_CALL_COMMON={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){$.module$exports$Blockly$Names.Names.equals(a,this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?$.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLRETURN_TOOLTIP:$.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=(0,$.module$exports$Blockly$Procedures.getDefinition)(this.getProcedureCall(),
|
var module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_CALL_COMMON={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){$.module$exports$Blockly$Names.Names.equals(a,this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?$.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLRETURN_TOOLTIP:$.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=
|
||||||
this.workspace),d=c&&c.mutator&&c.mutator.isVisible();d||(this.quarkConnections_={},this.quarkIds_=null);if(b)if(a.join("\n")===this.arguments_.join("\n"))this.quarkIds_=b;else{if(b.length!==a.length)throw RangeError("paramNames and paramIds must be the same length.");this.setCollapsed(!1);this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);c=this.rendered;this.rendered=!1;for(var e=0;e<this.arguments_.length;e++){var f=this.getInput("ARG"+e);f&&(f=f.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=
|
(0,$.module$exports$Blockly$Procedures.getDefinition)(this.getProcedureCall(),this.workspace),d=c&&c.mutator&&c.mutator.isVisible();d?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=null);if(a.join("\n")===this.arguments_.join("\n"))this.quarkIds_=b;else{if(b.length!==a.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);c=this.rendered;this.rendered=!1;for(var e=0;e<this.arguments_.length;e++){var f=
|
||||||
f,d&&f&&-1===b.indexOf(this.quarkIds_[e])&&(f.disconnect(),f.getSourceBlock().bumpNeighbours()))}this.arguments_=[].concat(a);this.argumentVarModels_=[];for(a=0;a<this.arguments_.length;a++)d=(0,$.module$exports$Blockly$Variables.getOrCreateVariablePackage)(this.workspace,null,this.arguments_[a],""),this.argumentVarModels_.push(d);this.updateShape_();if(this.quarkIds_=b)for(b=0;b<this.arguments_.length;b++)a=this.quarkIds_[b],a in this.quarkConnections_&&($.module$exports$Blockly$Mutator.Mutator.reconnect(this.quarkConnections_[a],
|
this.getInput("ARG"+e);f&&(f=f.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=f,d&&f&&-1===b.indexOf(this.quarkIds_[e])&&(f.disconnect(),f.getSourceBlock().bumpNeighbours()))}this.arguments_=[].concat(a);this.argumentVarModels_=[];for(a=0;a<this.arguments_.length;a++)d=(0,$.module$exports$Blockly$Variables.getOrCreateVariablePackage)(this.workspace,null,this.arguments_[a],""),this.argumentVarModels_.push(d);this.updateShape_();if(this.quarkIds_=b)for(b=0;b<this.arguments_.length;b++)a=
|
||||||
this,"ARG"+b)||delete this.quarkConnections_[a]);(this.rendered=c)&&this.render()}},updateShape_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);if(b){(0,$.module$exports$Blockly$Events.disable)();try{b.setValue(this.arguments_[a])}finally{(0,$.module$exports$Blockly$Events.enable)()}}else b=new $.module$exports$Blockly$FieldLabel.FieldLabel(this.arguments_[a]),this.appendValueInput("ARG"+a).setAlign($.module$exports$Blockly$Input.Align.RIGHT).appendField(b,"ARGNAME"+
|
this.quarkIds_[b],a in this.quarkConnections_&&($.module$exports$Blockly$Mutator.Mutator.reconnect(this.quarkConnections_[a],this,"ARG"+b)||delete this.quarkConnections_[a]);(this.rendered=c)&&this.render()}},updateShape_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);if(b){(0,$.module$exports$Blockly$Events.disable)();try{b.setValue(this.arguments_[a])}finally{(0,$.module$exports$Blockly$Events.enable)()}}else b=new $.module$exports$Blockly$FieldLabel.FieldLabel(this.arguments_[a]),
|
||||||
a).init()}for(a=this.arguments_.length;this.getInput("ARG"+a);a++)this.removeInput("ARG"+a);if(a=this.getInput("TOPROW"))this.arguments_.length?this.getField("WITH")||(a.appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),a.init()):this.getField("WITH")&&a.removeField("WITH")},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("name",this.getProcedureCall());for(var b=0;b<this.arguments_.length;b++){var c=(0,$.module$exports$Blockly$utils$xml.createElement)("arg");
|
this.appendValueInput("ARG"+a).setAlign($.module$exports$Blockly$Input.Align.RIGHT).appendField(b,"ARGNAME"+a).init()}for(a=this.arguments_.length;this.getInput("ARG"+a);a++)this.removeInput("ARG"+a);if(a=this.getInput("TOPROW"))this.arguments_.length?this.getField("WITH")||(a.appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),a.init()):this.getField("WITH")&&a.removeField("WITH")},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");
|
||||||
c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=a.getAttribute("name");this.renameProcedure(this.getProcedureCall(),b);b=[];for(var c=[],d=0,e;e=a.childNodes[d];d++)"arg"===e.nodeName.toLowerCase()&&(b.push(e.getAttribute("name")),c.push(e.getAttribute("paramId")));this.setProcedureParameters_(b,c)},saveExtraState:function(){var a=Object.create(null);a.name=this.getProcedureCall();this.arguments_.length&&(a.params=this.arguments_);return a},loadExtraState:function(a){this.renameProcedure(this.getProcedureCall(),
|
a.setAttribute("name",this.getProcedureCall());for(var b=0;b<this.arguments_.length;b++){var c=(0,$.module$exports$Blockly$utils$xml.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);b=[];for(var c=[],d=0,e;e=a.childNodes[d];d++)"arg"===e.nodeName.toLowerCase()&&(b.push(e.getAttribute("name")),c.push(e.getAttribute("paramId")));this.setProcedureParameters_(b,
|
||||||
a.name);if(a=a.params){var b=[];b.length=a.length;b.fill(null);this.setProcedureParameters_(a,b)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(a){if(this.workspace&&!this.workspace.isFlyout&&a.recordUndo)if(a.type===$.module$exports$Blockly$Events.BLOCK_CREATE&&-1!==a.ids.indexOf(this.id)){var b=this.getProcedureCall();b=(0,$.module$exports$Blockly$Procedures.getDefinition)(b,this.workspace);!b||b.type===this.defType_&&JSON.stringify(b.getVars())===
|
c)},saveExtraState:function(){var a=Object.create(null);a.name=this.getProcedureCall();this.arguments_.length&&(a.params=this.arguments_);return a},loadExtraState:function(a){this.renameProcedure(this.getProcedureCall(),a.name);if(a=a.params){var b=[];b.length=a.length;b.fill(null);this.setProcedureParameters_(a,b)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(a){if(this.workspace&&!this.workspace.isFlyout&&a.recordUndo)if(a.type===
|
||||||
JSON.stringify(this.arguments_)||(b=null);if(!b){(0,$.module$exports$Blockly$Events.setGroup)(a.group);a=(0,$.module$exports$Blockly$utils$xml.createElement)("xml");b=(0,$.module$exports$Blockly$utils$xml.createElement)("block");b.setAttribute("type",this.defType_);var c=this.getRelativeToSurfaceXY(),d=c.y+2*$.module$exports$Blockly$internalConstants.SNAP_RADIUS;b.setAttribute("x",c.x+$.module$exports$Blockly$internalConstants.SNAP_RADIUS*(this.RTL?-1:1));b.setAttribute("y",d);c=this.mutationToDom();
|
$.module$exports$Blockly$Events.BLOCK_CREATE&&-1!==a.ids.indexOf(this.id)){var b=this.getProcedureCall();b=(0,$.module$exports$Blockly$Procedures.getDefinition)(b,this.workspace);!b||b.type===this.defType_&&JSON.stringify(b.getVars())===JSON.stringify(this.arguments_)||(b=null);if(!b){(0,$.module$exports$Blockly$Events.setGroup)(a.group);a=(0,$.module$exports$Blockly$utils$xml.createElement)("xml");b=(0,$.module$exports$Blockly$utils$xml.createElement)("block");b.setAttribute("type",this.defType_);
|
||||||
b.appendChild(c);c=(0,$.module$exports$Blockly$utils$xml.createElement)("field");c.setAttribute("name","NAME");d=this.getProcedureCall();d||(d=(0,$.module$exports$Blockly$Procedures.findLegalName)("",this),this.renameProcedure("",d));c.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(d));b.appendChild(c);a.appendChild(b);(0,$.module$exports$Blockly$Xml.domToWorkspace)(a,this.workspace);(0,$.module$exports$Blockly$Events.setGroup)(!1)}}else a.type===$.module$exports$Blockly$Events.BLOCK_DELETE?
|
var c=this.getRelativeToSurfaceXY(),d=c.y+2*$.module$exports$Blockly$config.config.snapRadius;b.setAttribute("x",c.x+$.module$exports$Blockly$config.config.snapRadius*(this.RTL?-1:1));b.setAttribute("y",d);c=this.mutationToDom();b.appendChild(c);c=(0,$.module$exports$Blockly$utils$xml.createElement)("field");c.setAttribute("name","NAME");d=this.getProcedureCall();var e=(0,$.module$exports$Blockly$Procedures.findLegalName)(d,this);d!==e&&this.renameProcedure(d,e);c.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(d));
|
||||||
(b=this.getProcedureCall(),(0,$.module$exports$Blockly$Procedures.getDefinition)(b,this.workspace)||((0,$.module$exports$Blockly$Events.setGroup)(a.group),this.dispose(!0),(0,$.module$exports$Blockly$Events.setGroup)(!1))):a.type===$.module$exports$Blockly$Events.CHANGE&&"disabled"===a.element&&(b=this.getProcedureCall(),(b=(0,$.module$exports$Blockly$Procedures.getDefinition)(b,this.workspace))&&b.id===a.blockId&&((b=(0,$.module$exports$Blockly$Events.getGroup)())&&console.log("Saw an existing group while responding to a definition change"),
|
b.appendChild(c);a.appendChild(b);(0,$.module$exports$Blockly$Xml.domToWorkspace)(a,this.workspace);(0,$.module$exports$Blockly$Events.setGroup)(!1)}}else a.type===$.module$exports$Blockly$Events.BLOCK_DELETE?(b=this.getProcedureCall(),(0,$.module$exports$Blockly$Procedures.getDefinition)(b,this.workspace)||((0,$.module$exports$Blockly$Events.setGroup)(a.group),this.dispose(!0),(0,$.module$exports$Blockly$Events.setGroup)(!1))):a.type===$.module$exports$Blockly$Events.CHANGE&&"disabled"===a.element&&
|
||||||
(0,$.module$exports$Blockly$Events.setGroup)(a.group),a.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),(0,$.module$exports$Blockly$Events.setGroup)(b)))},customContextMenu:function(a){if(this.workspace.isMovable()){var b={enabled:!0};b.text=$.module$exports$Blockly$Msg.Msg.PROCEDURES_HIGHLIGHT_DEF;var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){var e=(0,$.module$exports$Blockly$Procedures.getDefinition)(c,
|
(b=this.getProcedureCall(),(b=(0,$.module$exports$Blockly$Procedures.getDefinition)(b,this.workspace))&&b.id===a.blockId&&((b=(0,$.module$exports$Blockly$Events.getGroup)())&&console.log("Saw an existing group while responding to a definition change"),(0,$.module$exports$Blockly$Events.setGroup)(a.group),a.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),(0,$.module$exports$Blockly$Events.setGroup)(b)))},customContextMenu:function(a){if(this.workspace.isMovable()){var b=
|
||||||
d);e&&(d.centerOnBlock(e.id),e.select())};a.push(b)}}};
|
{enabled:!0};b.text=$.module$exports$Blockly$Msg.Msg.PROCEDURES_HIGHLIGHT_DEF;var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){var e=(0,$.module$exports$Blockly$Procedures.getDefinition)(c,d);e&&(d.centerOnBlock(e.id),e.select())};a.push(b)}}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.procedures_callnoreturn=Object.assign({},module$contents$Blockly$blocks$procedures_PROCEDURE_CALL_COMMON,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null;this.previousEnabledState_=
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_callnoreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_CALL_COMMON,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null;
|
||||||
!0},defType_:"procedures_defnoreturn"});
|
this.previousEnabledState_=!0},defType_:"procedures_defnoreturn"});
|
||||||
$.module$exports$Blockly$blocks.Blocks.procedures_callreturn=Object.assign({},module$contents$Blockly$blocks$procedures_PROCEDURE_CALL_COMMON,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null;this.previousEnabledState_=!0},defType_:"procedures_defreturn"});
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_callreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_CALL_COMMON,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null;this.previousEnabledState_=!0},defType_:"procedures_defreturn"});
|
||||||
$.module$exports$Blockly$blocks.Blocks.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_IFRETURN_HELPURL);
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.module$exports$Blockly$Msg.Msg.PROCEDURES_IFRETURN_TOOLTIP);
|
||||||
this.hasReturnValue_=!0},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("value",Number(this.hasReturnValue_));return a},domToMutation:function(a){this.hasReturnValue_="1"===a.getAttribute("value");this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(a){if(!this.workspace.isDragging||!this.workspace.isDragging()){a=
|
this.setHelpUrl($.module$exports$Blockly$Msg.Msg.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("value",Number(this.hasReturnValue_));return a},domToMutation:function(a){this.hasReturnValue_="1"===a.getAttribute("value");this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(a){if(!(this.workspace.isDragging&&
|
||||||
!1;var b=this;do{if(-1!==this.FUNCTION_TYPES.indexOf(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?("procedures_defnoreturn"===b.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!==b.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN),
|
this.workspace.isDragging()||a.type!==$.module$exports$Blockly$Events.BLOCK_MOVE)){var b=!1,c=this;do{if(-1!==this.FUNCTION_TYPES.indexOf(c.type)){b=!0;break}c=c.getSurroundParent()}while(c);b?("procedures_defnoreturn"===c.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!==c.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_RETURN),
|
||||||
this.hasReturnValue_=!0),this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText($.module$exports$Blockly$Msg.Msg.PROCEDURES_IFRETURN_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};var module$exports$Blockly$blocks$math={};
|
this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText($.module$exports$Blockly$Msg.Msg.PROCEDURES_IFRETURN_WARNING);this.isInFlyout||(c=(0,$.module$exports$Blockly$Events.getGroup)(),(0,$.module$exports$Blockly$Events.setGroup)(a.group),this.setEnabled(b),(0,$.module$exports$Blockly$Events.setGroup)(c))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$procedures.blocks);var module$exports$Blockly$libraryBlocks$math={};
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}",
|
module$exports$Blockly$libraryBlocks$math.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}",
|
||||||
"MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10",
|
"ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}",
|
||||||
"LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",
|
"ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}",
|
||||||
check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",
|
"ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",
|
||||||
name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",
|
message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},
|
||||||
args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},
|
{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],
|
||||||
{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}",
|
["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}",
|
||||||
"MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",
|
"MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],
|
||||||
tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",
|
inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",
|
||||||
name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},
|
args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",
|
||||||
{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);
|
name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);
|
||||||
var module$contents$Blockly$blocks$math_TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",
|
var module$contents$Blockly$libraryBlocks$math_TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",
|
||||||
POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",
|
POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",
|
||||||
RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};(0,$.module$exports$Blockly$Extensions.register)("math_op_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("OP",module$contents$Blockly$blocks$math_TOOLTIPS_BY_OP));
|
RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};(0,$.module$exports$Blockly$Extensions.register)("math_op_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("OP",module$contents$Blockly$libraryBlocks$math_TOOLTIPS_BY_OP));
|
||||||
var module$contents$Blockly$blocks$math_IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.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")}},module$contents$Blockly$blocks$math_IS_DIVISIBLE_MUTATOR_EXTENSION=
|
var module$contents$Blockly$libraryBlocks$math_IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.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")}},
|
||||||
function(){this.getField("PROPERTY").setValidator(function(a){a="DIVISIBLE_BY"===a;this.getSourceBlock().updateShape_(a)})};(0,$.module$exports$Blockly$Extensions.registerMutator)("math_is_divisibleby_mutator",module$contents$Blockly$blocks$math_IS_DIVISIBLEBY_MUTATOR_MIXIN,module$contents$Blockly$blocks$math_IS_DIVISIBLE_MUTATOR_EXTENSION);
|
module$contents$Blockly$libraryBlocks$math_IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(a){a="DIVISIBLE_BY"===a;this.getSourceBlock().updateShape_(a)})};(0,$.module$exports$Blockly$Extensions.registerMutator)("math_is_divisibleby_mutator",module$contents$Blockly$libraryBlocks$math_IS_DIVISIBLEBY_MUTATOR_MIXIN,module$contents$Blockly$libraryBlocks$math_IS_DIVISIBLE_MUTATOR_EXTENSION);
|
||||||
(0,$.module$exports$Blockly$Extensions.register)("math_change_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));
|
(0,$.module$exports$Blockly$Extensions.register)("math_change_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));
|
||||||
var module$contents$Blockly$blocks$math_LIST_MODES_MUTATOR_MIXIN={updateType_:function(a){"MODE"===a?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}},module$contents$Blockly$blocks$math_LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))};
|
var module$contents$Blockly$libraryBlocks$math_LIST_MODES_MUTATOR_MIXIN={updateType_:function(a){"MODE"===a?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}},module$contents$Blockly$libraryBlocks$math_LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))};
|
||||||
(0,$.module$exports$Blockly$Extensions.registerMutator)("math_modes_of_list_mutator",module$contents$Blockly$blocks$math_LIST_MODES_MUTATOR_MIXIN,module$contents$Blockly$blocks$math_LIST_MODES_MUTATOR_EXTENSION);var module$exports$Blockly$blocks$loops={};
|
(0,$.module$exports$Blockly$Extensions.registerMutator)("math_modes_of_list_mutator",module$contents$Blockly$libraryBlocks$math_LIST_MODES_MUTATOR_MIXIN,module$contents$Blockly$libraryBlocks$math_LIST_MODES_MUTATOR_EXTENSION);(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$math.blocks);var module$exports$Blockly$libraryBlocks$loops={};
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",
|
module$exports$Blockly$libraryBlocks$loops.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",
|
||||||
name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",
|
message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}",
|
||||||
name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_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"},
|
"UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_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",
|
||||||
{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],
|
check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",
|
||||||
message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,
|
name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}",
|
||||||
style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);var module$contents$Blockly$blocks$loops_WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};(0,$.module$exports$Blockly$Extensions.register)("controls_whileUntil_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("MODE",module$contents$Blockly$blocks$loops_WHILE_UNTIL_TOOLTIPS));
|
"CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);var module$contents$Blockly$libraryBlocks$loops_WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};
|
||||||
var module$contents$Blockly$blocks$loops_BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};(0,$.module$exports$Blockly$Extensions.register)("controls_flow_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("FLOW",module$contents$Blockly$blocks$loops_BREAK_CONTINUE_TOOLTIPS));
|
(0,$.module$exports$Blockly$Extensions.register)("controls_whileUntil_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("MODE",module$contents$Blockly$libraryBlocks$loops_WHILE_UNTIL_TOOLTIPS));var module$contents$Blockly$libraryBlocks$loops_BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};
|
||||||
var module$contents$Blockly$blocks$loops_CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getField("VAR").getVariable(),c=b.name;if(!this.isCollapsed()&&null!==c){var d={enabled:!0};d.text=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c);b=(0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(b);c=(0,$.module$exports$Blockly$utils$xml.createElement)("block");c.setAttribute("type","variables_get");c.appendChild(b);
|
(0,$.module$exports$Blockly$Extensions.register)("controls_flow_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("FLOW",module$contents$Blockly$libraryBlocks$loops_BREAK_CONTINUE_TOOLTIPS));
|
||||||
d.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,c);a.push(d)}}}};(0,$.module$exports$Blockly$Extensions.registerMixin)("contextMenu_newGetVariableBlock",module$contents$Blockly$blocks$loops_CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN);(0,$.module$exports$Blockly$Extensions.register)("controls_for_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR"));
|
var module$contents$Blockly$libraryBlocks$loops_CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getField("VAR").getVariable(),c=b.name;if(!this.isCollapsed()&&null!==c){var d={enabled:!0};d.text=$.module$exports$Blockly$Msg.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c);b=(0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(b);c=(0,$.module$exports$Blockly$utils$xml.createElement)("block");c.setAttribute("type","variables_get");
|
||||||
(0,$.module$exports$Blockly$Extensions.register)("controls_forEach_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));module$exports$Blockly$blocks$loops.loopTypes=["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"];
|
c.appendChild(b);d.callback=(0,$.module$exports$Blockly$ContextMenu.callbackFactory)(this,c);a.push(d)}}}};(0,$.module$exports$Blockly$Extensions.registerMixin)("contextMenu_newGetVariableBlock",module$contents$Blockly$libraryBlocks$loops_CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN);(0,$.module$exports$Blockly$Extensions.register)("controls_for_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR"));
|
||||||
var module$contents$Blockly$blocks$loops_CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={getSurroundLoop:function(){var a=this;do{if(module$exports$Blockly$blocks$loops.loopTypes.includes(a.type))return a;a=a.getSurroundParent()}while(a);return null},onchange:function(a){if(this.workspace.isDragging&&!this.workspace.isDragging()&&a.type===$.module$exports$Blockly$Events.BLOCK_MOVE){var b=this.getSurroundLoop(this);this.setWarningText(b?null:$.module$exports$Blockly$Msg.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);if(!this.isInFlyout){var c=
|
(0,$.module$exports$Blockly$Extensions.register)("controls_forEach_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipWithFieldText)("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));module$exports$Blockly$libraryBlocks$loops.loopTypes=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]);
|
||||||
(0,$.module$exports$Blockly$Events.getGroup)();(0,$.module$exports$Blockly$Events.setGroup)(a.group);this.setEnabled(b);(0,$.module$exports$Blockly$Events.setGroup)(c)}}}};(0,$.module$exports$Blockly$Extensions.registerMixin)("controls_flow_in_loop_check",module$contents$Blockly$blocks$loops_CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);var module$exports$Blockly$blocks$logic={};
|
var module$contents$Blockly$libraryBlocks$loops_CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={getSurroundLoop:function(){var a=this;do{if(module$exports$Blockly$libraryBlocks$loops.loopTypes.has(a.type))return a;a=a.getSurroundParent()}while(a);return null},onchange:function(a){if(this.workspace.isDragging&&!this.workspace.isDragging()&&a.type===$.module$exports$Blockly$Events.BLOCK_MOVE){var b=this.getSurroundLoop(this);this.setWarningText(b?null:$.module$exports$Blockly$Msg.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",
|
if(!this.isInFlyout){var c=(0,$.module$exports$Blockly$Events.getGroup)();(0,$.module$exports$Blockly$Events.setGroup)(a.group);this.setEnabled(b);(0,$.module$exports$Blockly$Events.setGroup)(c)}}}};(0,$.module$exports$Blockly$Extensions.registerMixin)("controls_flow_in_loop_check",module$contents$Blockly$libraryBlocks$loops_CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$loops.blocks);var module$exports$Blockly$libraryBlocks$logic={};
|
||||||
args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",
|
module$exports$Blockly$libraryBlocks$logic.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",
|
||||||
name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264","LTE"],["\u200f>","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",
|
check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",
|
||||||
style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",
|
args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264","LTE"],["\u200f>","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],
|
||||||
message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",
|
inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},
|
||||||
args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]},{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",
|
{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],
|
||||||
previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);
|
message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]},{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",
|
||||||
var module$contents$Blockly$blocks$logic_TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};
|
message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);
|
||||||
(0,$.module$exports$Blockly$Extensions.register)("logic_op_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("OP",module$contents$Blockly$blocks$logic_TOOLTIPS_BY_OP));
|
var module$contents$Blockly$libraryBlocks$logic_TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};
|
||||||
var module$contents$Blockly$blocks$logic_CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_);this.elseCount_&&a.setAttribute("else",1);return a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0;this.elseCount_=parseInt(a.getAttribute("else"),10)||0;this.rebuildShape_()},
|
(0,$.module$exports$Blockly$Extensions.register)("logic_op_tooltip",(0,$.module$exports$Blockly$Extensions.buildTooltipForDropdown)("OP",module$contents$Blockly$libraryBlocks$logic_TOOLTIPS_BY_OP));
|
||||||
saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=Object.create(null);this.elseifCount_&&(a.elseIfCount=this.elseifCount_);this.elseCount_&&(a.hasElse=!0);return a},loadExtraState:function(a){this.elseifCount_=a.elseIfCount||0;this.elseCount_=a.hasElse?1:0;this.updateShape_()},decompose:function(a){var b=a.newBlock("controls_if_if");b.initSvg();for(var c=b.nextConnection,d=1;d<=this.elseifCount_;d++){var e=a.newBlock("controls_if_elseif");e.initSvg();c.connect(e.previousConnection);
|
var module$contents$Blockly$libraryBlocks$logic_CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_);this.elseCount_&&a.setAttribute("else",1);return a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0;this.elseCount_=parseInt(a.getAttribute("else"),10)||
|
||||||
c=e.nextConnection}this.elseCount_&&(a=a.newBlock("controls_if_else"),a.initSvg(),c.connect(a.previousConnection));return b},compose:function(a){a=a.nextConnection.targetBlock();this.elseCount_=this.elseifCount_=0;for(var b=[null],c=[null],d=null;a&&!a.isInsertionMarker();){switch(a.type){case "controls_if_elseif":this.elseifCount_++;b.push(a.valueConnection_);c.push(a.statementConnection_);break;case "controls_if_else":this.elseCount_++;d=a.statementConnection_;break;default:throw TypeError("Unknown block type: "+
|
0;this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=Object.create(null);this.elseifCount_&&(a.elseIfCount=this.elseifCount_);this.elseCount_&&(a.hasElse=!0);return a},loadExtraState:function(a){this.elseifCount_=a.elseIfCount||0;this.elseCount_=a.hasElse?1:0;this.updateShape_()},decompose:function(a){var b=a.newBlock("controls_if_if");b.initSvg();for(var c=b.nextConnection,d=1;d<=this.elseifCount_;d++){var e=a.newBlock("controls_if_elseif");
|
||||||
a.type);}a=a.nextConnection&&a.nextConnection.targetBlock()}this.updateShape_();this.reconnectChildBlocks_(b,c,d)},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){switch(a.type){case "controls_if_elseif":var c=this.getInput("IF"+b),d=this.getInput("DO"+b);a.valueConnection_=c&&c.connection.targetConnection;a.statementConnection_=d&&d.connection.targetConnection;b++;break;case "controls_if_else":c=this.getInput("ELSE");a.statementConnection_=c&&c.connection.targetConnection;
|
e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}this.elseCount_&&(a=a.newBlock("controls_if_else"),a.initSvg(),c.connect(a.previousConnection));return b},compose:function(a){a=a.nextConnection.targetBlock();this.elseCount_=this.elseifCount_=0;for(var b=[null],c=[null],d=null;a&&!a.isInsertionMarker();){switch(a.type){case "controls_if_elseif":this.elseifCount_++;b.push(a.valueConnection_);c.push(a.statementConnection_);break;case "controls_if_else":this.elseCount_++;d=a.statementConnection_;
|
||||||
break;default:throw TypeError("Unknown block type: "+a.type);}a=a.nextConnection&&a.nextConnection.targetBlock()}},rebuildShape_:function(){var a=[null],b=[null],c=null;this.getInput("ELSE")&&(c=this.getInput("ELSE").connection.targetConnection);for(var d=1;this.getInput("IF"+d);d++){var e=this.getInput("IF"+d),f=this.getInput("DO"+d);a.push(e.connection.targetConnection);b.push(f.connection.targetConnection)}this.updateShape_();this.reconnectChildBlocks_(a,b,c)},updateShape_:function(){this.getInput("ELSE")&&
|
break;default:throw TypeError("Unknown block type: "+a.type);}a=a.nextConnection&&a.nextConnection.targetBlock()}this.updateShape_();this.reconnectChildBlocks_(b,c,d)},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){switch(a.type){case "controls_if_elseif":var c=this.getInput("IF"+b),d=this.getInput("DO"+b);a.valueConnection_=c&&c.connection.targetConnection;a.statementConnection_=d&&d.connection.targetConnection;b++;break;case "controls_if_else":c=this.getInput("ELSE");
|
||||||
this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);a++)this.removeInput("IF"+a),this.removeInput("DO"+a);for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(a,
|
a.statementConnection_=c&&c.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.nextConnection&&a.nextConnection.targetBlock()}},rebuildShape_:function(){var a=[null],b=[null],c=null;this.getInput("ELSE")&&(c=this.getInput("ELSE").connection.targetConnection);for(var d=1;this.getInput("IF"+d);d++){var e=this.getInput("IF"+d),f=this.getInput("DO"+d);a.push(e.connection.targetConnection);b.push(f.connection.targetConnection)}this.updateShape_();this.reconnectChildBlocks_(a,
|
||||||
b,c){for(var d=1;d<=this.elseifCount_;d++)$.module$exports$Blockly$Mutator.Mutator.reconnect(a[d],this,"IF"+d),$.module$exports$Blockly$Mutator.Mutator.reconnect(b[d],this,"DO"+d);$.module$exports$Blockly$Mutator.Mutator.reconnect(c,this,"ELSE")}};(0,$.module$exports$Blockly$Extensions.registerMutator)("controls_if_mutator",module$contents$Blockly$blocks$logic_CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]);
|
b,c)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);a++)this.removeInput("IF"+a),this.removeInput("DO"+a);for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField($.module$exports$Blockly$Msg.Msg.CONTROLS_IF_MSG_ELSE)},
|
||||||
var module$contents$Blockly$blocks$logic_CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_4}else return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_1;
|
reconnectChildBlocks_:function(a,b,c){for(var d=1;d<=this.elseifCount_;d++)$.module$exports$Blockly$Mutator.Mutator.reconnect(a[d],this,"IF"+d),$.module$exports$Blockly$Mutator.Mutator.reconnect(b[d],this,"DO"+d);$.module$exports$Blockly$Mutator.Mutator.reconnect(c,this,"ELSE")}};(0,$.module$exports$Blockly$Extensions.registerMutator)("controls_if_mutator",module$contents$Blockly$libraryBlocks$logic_CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]);
|
||||||
return""}.bind(this))};(0,$.module$exports$Blockly$Extensions.register)("controls_if_tooltip",module$contents$Blockly$blocks$logic_CONTROLS_IF_TOOLTIP_EXTENSION);
|
var module$contents$Blockly$libraryBlocks$logic_CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_4}else return $.module$exports$Blockly$Msg.Msg.CONTROLS_IF_TOOLTIP_1;
|
||||||
var module$contents$Blockly$blocks$logic_LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(a){this.prevBlocks_||(this.prevBlocks_=[null,null]);var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");b&&c&&!this.workspace.connectionChecker.doTypeChecks(b.outputConnection,c.outputConnection)&&((0,$.module$exports$Blockly$Events.setGroup)(a.group),a=this.prevBlocks_[0],a!==b&&(b.unplug(),!a||a.isDisposed()||a.isShadow()||this.getInput("A").connection.connect(a.outputConnection)),b=this.prevBlocks_[1],
|
return""}.bind(this))};(0,$.module$exports$Blockly$Extensions.register)("controls_if_tooltip",module$contents$Blockly$libraryBlocks$logic_CONTROLS_IF_TOOLTIP_EXTENSION);
|
||||||
b!==c&&(c.unplug(),!b||b.isDisposed()||b.isShadow()||this.getInput("B").connection.connect(b.outputConnection)),this.bumpNeighbours(),(0,$.module$exports$Blockly$Events.setGroup)(!1));this.prevBlocks_[0]=this.getInputTargetBlock("A");this.prevBlocks_[1]=this.getInputTargetBlock("B")}},module$contents$Blockly$blocks$logic_LOGIC_COMPARE_EXTENSION=function(){this.mixin(module$contents$Blockly$blocks$logic_LOGIC_COMPARE_ONCHANGE_MIXIN)};
|
var module$contents$Blockly$libraryBlocks$logic_LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(a){this.prevBlocks_||(this.prevBlocks_=[null,null]);var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");b&&c&&!this.workspace.connectionChecker.doTypeChecks(b.outputConnection,c.outputConnection)&&((0,$.module$exports$Blockly$Events.setGroup)(a.group),a=this.prevBlocks_[0],a!==b&&(b.unplug(),!a||a.isDisposed()||a.isShadow()||this.getInput("A").connection.connect(a.outputConnection)),b=this.prevBlocks_[1],
|
||||||
(0,$.module$exports$Blockly$Extensions.register)("logic_compare",module$contents$Blockly$blocks$logic_LOGIC_COMPARE_EXTENSION);
|
b!==c&&(c.unplug(),!b||b.isDisposed()||b.isShadow()||this.getInput("B").connection.connect(b.outputConnection)),this.bumpNeighbours(),(0,$.module$exports$Blockly$Events.setGroup)(!1));this.prevBlocks_[0]=this.getInputTargetBlock("A");this.prevBlocks_[1]=this.getInputTargetBlock("B")}},module$contents$Blockly$libraryBlocks$logic_LOGIC_COMPARE_EXTENSION=function(){this.mixin(module$contents$Blockly$libraryBlocks$logic_LOGIC_COMPARE_ONCHANGE_MIXIN)};
|
||||||
var module$contents$Blockly$blocks$logic_LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;2>e;e++){var f=1===e?b:c;f&&!f.workspace.connectionChecker.doTypeChecks(f.outputConnection,d)&&((0,$.module$exports$Blockly$Events.setGroup)(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),
|
(0,$.module$exports$Blockly$Extensions.register)("logic_compare",module$contents$Blockly$libraryBlocks$logic_LOGIC_COMPARE_EXTENSION);
|
||||||
f.bumpNeighbours()),(0,$.module$exports$Blockly$Events.setGroup)(!1))}this.prevParentConnection_=d}};(0,$.module$exports$Blockly$Extensions.registerMixin)("logic_ternary",module$contents$Blockly$blocks$logic_LOGIC_TERNARY_ONCHANGE_MIXIN);var module$exports$Blockly$blocks$lists={};
|
var module$contents$Blockly$libraryBlocks$logic_LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;2>e;e++){var f=1===e?b:c;f&&!f.workspace.connectionChecker.doTypeChecks(f.outputConnection,d)&&((0,$.module$exports$Blockly$Events.setGroup)(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},
|
f.bumpNeighbours()),(0,$.module$exports$Blockly$Events.setGroup)(!1))}this.prevParentConnection_=d}};(0,$.module$exports$Blockly$Extensions.registerMixin)("logic_ternary",module$contents$Blockly$libraryBlocks$logic_LOGIC_TERNARY_ONCHANGE_MIXIN);(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$logic.blocks);var module$exports$Blockly$libraryBlocks$lists={};
|
||||||
{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",
|
module$exports$Blockly$libraryBlocks$lists.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",
|
||||||
message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
|
helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_create_with={init:function(){this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["lists_create_with_item"]));this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");
|
{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
|
||||||
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_create_with={init:function(){this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.module$exports$Blockly$Mutator.Mutator(["lists_create_with_item"]));this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");
|
||||||
a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("lists_create_with_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("lists_create_with_item");e.initSvg();c.connect(e.previousConnection);
|
a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("lists_create_with_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("lists_create_with_item");e.initSvg();c.connect(e.previousConnection);
|
||||||
c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b&&!b.isInsertionMarker();)a.push(b.valueConnection_),b=b.nextConnection&&b.nextConnection.targetBlock();for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;c&&-1===a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)$.module$exports$Blockly$Mutator.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=
|
c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b&&!b.isInsertionMarker();)a.push(b.valueConnection_),b=b.nextConnection&&b.nextConnection.targetBlock();for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;c&&-1===a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)$.module$exports$Blockly$Mutator.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=
|
||||||
a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;a=a.nextConnection&&a.nextConnection.targetBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+
|
a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;a=a.nextConnection&&a.nextConnection.targetBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+
|
||||||
a).setAlign($.module$exports$Blockly$Input.Align.RIGHT);0===a&&b.appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_INPUT_WITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}};
|
a).setAlign($.module$exports$Blockly$Input.Align.RIGHT);0===a&&b.appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_INPUT_WITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_create_with_container={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_create_with_container={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_create_with_item={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_create_with_item={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_indexOf={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_HELPURL);this.setStyle("list_blocks");this.setOutput(!0,"Number");this.appendValueInput("VALUE").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);this.appendValueInput("FIND").appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_indexOf={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_HELPURL);this.setStyle("list_blocks");this.setOutput(!0,"Number");this.appendValueInput("VALUE").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);this.appendValueInput("FIND").appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),
|
||||||
"END");this.setInputsInline(!0);var b=this;this.setTooltip(function(){return $.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",b.workspace.options.oneBasedIndex?"0":"-1")})}};
|
"END");this.setInputsInline(!0);var b=this;this.setTooltip(function(){return $.module$exports$Blockly$Msg.Msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",b.workspace.options.oneBasedIndex?"0":"-1")})}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_getIndex={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_GET,"GET"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FIRST,
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_getIndex={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_GET,"GET"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FIRST,
|
||||||
"FIRST"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_LAST,"LAST"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_HELPURL);this.setStyle("list_blocks");a=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a,function(c){c="REMOVE"===c;this.getSourceBlock().updateStatement_(c)});this.appendValueInput("VALUE").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);this.appendDummyInput().appendField(a,
|
"FIRST"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_LAST,"LAST"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_HELPURL);this.setStyle("list_blocks");a=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a,function(c){c="REMOVE"===c;this.getSourceBlock().updateStatement_(c)});this.appendValueInput("VALUE").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);this.appendDummyInput().appendField(a,
|
||||||
"MODE").appendField("","SPACE");this.appendDummyInput("AT");$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TAIL);this.setInputsInline(!0);this.setOutput(!0);this.updateAt_(!0);var b=this;this.setTooltip(function(){var c=b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(c+" "+d){case "GET FROM_START":case "GET FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;
|
"MODE").appendField("","SPACE");this.appendDummyInput("AT");$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TAIL);this.setInputsInline(!0);this.setOutput(!0);this.updateAt_(!0);var b=this;this.setTooltip(function(){var c=b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(c+" "+d){case "GET FROM_START":case "GET FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;
|
||||||
break;case "GET FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case "GET RANDOM":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;
|
break;case "GET FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case "GET RANDOM":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;
|
||||||
@ -179,28 +181,31 @@ break;case "REMOVE RANDOM":e=$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TO
|
|||||||
var b=this.getInput("AT").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){var b="true"===a.getAttribute("statement");this.updateStatement_(b);a="false"!==a.getAttribute("at");this.updateAt_(a)},updateStatement_:function(a){a!==!this.outputConnection&&(this.unplug(!0,!0),a?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},
|
var b=this.getInput("AT").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){var b="true"===a.getAttribute("statement");this.updateStatement_(b);a="false"!==a.getAttribute("at");this.updateAt_(a)},updateStatement_:function(a){a!==!this.outputConnection&&(this.unplug(!0,!0),a?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},
|
||||||
updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this.WHERE_OPTIONS,function(c){var d="FROM_START"===c||"FROM_END"===c;if(d!==a){var e=this.getSourceBlock();e.updateAt_(d);e.setFieldValue(c,
|
updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this.WHERE_OPTIONS,function(c){var d="FROM_START"===c||"FROM_END"===c;if(d!==a){var e=this.getSourceBlock();e.updateAt_(d);e.setFieldValue(c,
|
||||||
"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE");$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};
|
"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE");$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_setIndex={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_SET,"SET"],[$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_LAST,"LAST"],
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_setIndex={init:function(){var a=[[$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_SET,"SET"],[$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_LAST,
|
||||||
[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);this.appendDummyInput().appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),"MODE").appendField("","SPACE");this.appendDummyInput("AT");this.appendValueInput("TO").appendField($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_INPUT_TO);
|
"LAST"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);this.appendDummyInput().appendField(new $.module$exports$Blockly$FieldDropdown.FieldDropdown(a),"MODE").appendField("","SPACE");this.appendDummyInput("AT");this.appendValueInput("TO").appendField($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_INPUT_TO);
|
||||||
this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP);this.updateAt_(!0);var b=this;this.setTooltip(function(){var c=b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(c+" "+d){case "SET FROM_START":case "SET FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":e=
|
this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP);this.updateAt_(!0);var b=this;this.setTooltip(function(){var c=b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(c+" "+d){case "SET FROM_START":case "SET FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":e=
|
||||||
$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case "INSERT FROM_START":case "INSERT FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":e=
|
$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case "INSERT FROM_START":case "INSERT FROM_END":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":e=$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":e=
|
||||||
$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if("FROM_START"===d||"FROM_END"===d)e+=" "+$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",b.workspace.options.oneBasedIndex?"#1":"#0");return e})},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation"),b=this.getInput("AT").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){a=
|
$.module$exports$Blockly$Msg.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if("FROM_START"===d||"FROM_END"===d)e+=" "+$.module$exports$Blockly$Msg.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",b.workspace.options.oneBasedIndex?"#1":"#0");return e})},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation"),b=this.getInput("AT").type===$.module$exports$Blockly$ConnectionType.ConnectionType.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"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this.WHERE_OPTIONS,function(c){var d="FROM_START"===c||"FROM_END"===c;if(d!==
|
"false"!==a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this.WHERE_OPTIONS,function(c){var d="FROM_START"===c||"FROM_END"===c;if(d!==
|
||||||
a){var e=this.getSourceBlock();e.updateAt_(d);e.setFieldValue(c,"WHERE");return null}});this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO");this.getInput("AT").appendField(b,"WHERE")}};
|
a){var e=this.getSourceBlock();e.updateAt_(d);e.setFieldValue(c,"WHERE");return null}});this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO");this.getInput("AT").appendField(b,"WHERE")}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_END_FROM_END,
|
||||||
[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);this.appendDummyInput("AT1");this.appendDummyInput("AT2");$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TAIL);
|
"FROM_END"],[$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);this.appendDummyInput("AT1");this.appendDummyInput("AT2");$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TAIL);
|
||||||
this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation"),b=this.getInput("AT1").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at2",
|
this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation"),b=this.getInput("AT1").type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type===$.module$exports$Blockly$ConnectionType.ConnectionType.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"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);var c=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this["WHERE_OPTIONS_"+
|
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"),$.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.module$exports$Blockly$Msg.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);var c=new $.module$exports$Blockly$FieldDropdown.FieldDropdown(this["WHERE_OPTIONS_"+
|
||||||
a],function(d){var e="FROM_START"===d||"FROM_END"===d;if(e!==b){var f=this.getSourceBlock();f.updateAt_(a,e);f.setFieldValue(d,"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"));$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};
|
a],function(d){var e="FROM_START"===d||"FROM_END"===d;if(e!==b){var f=this.getSourceBlock();f.updateAt_(a,e);f.setFieldValue(d,"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"));$.module$exports$Blockly$Msg.Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_sort={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_ORDER_ASCENDING,
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_sort={init:function(){this.jsonInit({message0:$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_ORDER_ASCENDING,
|
||||||
"1"],[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.LISTS_SORT_HELPURL})}};
|
"1"],[$.module$exports$Blockly$Msg.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:$.module$exports$Blockly$Msg.Msg.LISTS_SORT_TOOLTIP,helpUrl:$.module$exports$Blockly$Msg.Msg.LISTS_SORT_HELPURL})}};
|
||||||
$.module$exports$Blockly$blocks.Blocks.lists_split={init:function(){var a=this,b=new $.module$exports$Blockly$FieldDropdown.FieldDropdown([[$.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[$.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(c){a.updateType_(c)});this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_HELPURL);this.setStyle("list_blocks");this.appendValueInput("INPUT").setCheck("String").appendField(b,"MODE");this.appendValueInput("DELIM").setCheck("String").appendField($.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_WITH_DELIMITER);
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_split={init:function(){var a=this,b=new $.module$exports$Blockly$FieldDropdown.FieldDropdown([[$.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[$.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(c){a.updateType_(c)});this.setHelpUrl($.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_HELPURL);this.setStyle("list_blocks");this.appendValueInput("INPUT").setCheck("String").appendField(b,"MODE");this.appendValueInput("DELIM").setCheck("String").appendField($.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_WITH_DELIMITER);
|
||||||
this.setInputsInline(!0);this.setOutput(!0,"Array");this.setTooltip(function(){var c=a.getFieldValue("MODE");if("SPLIT"===c)return $.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"===c)return $.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+c);})},updateType_:function(a){if(this.getFieldValue("MODE")!==a){var b=this.getInput("INPUT").connection;b.setShadowDom(null);var c=b.targetBlock();c&&(b.disconnect(),c.isShadow()?c.dispose():this.bumpNeighbours())}"SPLIT"===
|
this.setInputsInline(!0);this.setOutput(!0,"Array");this.setTooltip(function(){var c=a.getFieldValue("MODE");if("SPLIT"===c)return $.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"===c)return $.module$exports$Blockly$Msg.Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+c);})},updateType_:function(a){if(this.getFieldValue("MODE")!==a){var b=this.getInput("INPUT").connection;b.setShadowDom(null);var c=b.targetBlock();c&&(b.disconnect(),c.isShadow()?c.dispose():this.bumpNeighbours())}"SPLIT"===
|
||||||
a?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("mode",this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))}};var module$exports$Blockly$blocks$colour={};
|
a?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");a.setAttribute("mode",this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))}};(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$lists.blocks);var module$exports$Blockly$libraryBlocks$colour={};
|
||||||
(0,$.module$exports$Blockly$common.defineBlocksWithJsonArray)([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",
|
module$exports$Blockly$libraryBlocks$colour.blocks=(0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",
|
||||||
message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",
|
tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",
|
||||||
args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]);var module$exports$Blockly$blocks$all={};
|
args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]);(0,$.module$exports$Blockly$common.defineBlocks)(module$exports$Blockly$libraryBlocks$colour.blocks);$.Blockly.libraryBlocks={};$.Blockly.libraryBlocks.colour=module$exports$Blockly$libraryBlocks$colour;$.Blockly.libraryBlocks.lists=module$exports$Blockly$libraryBlocks$lists;$.Blockly.libraryBlocks.logic=module$exports$Blockly$libraryBlocks$logic;$.Blockly.libraryBlocks.loops=module$exports$Blockly$libraryBlocks$loops;$.Blockly.libraryBlocks.math=module$exports$Blockly$libraryBlocks$math;$.Blockly.libraryBlocks.procedures=module$exports$Blockly$libraryBlocks$procedures;
|
||||||
|
$.Blockly.libraryBlocks.texts=module$exports$Blockly$libraryBlocks$texts;$.Blockly.libraryBlocks.variables=module$exports$Blockly$libraryBlocks$variables;$.Blockly.libraryBlocks.variablesDynamic=module$exports$Blockly$libraryBlocks$variablesDynamic;
|
||||||
return $.Blockly.Blocks;
|
var module$contents$Blockly$libraryBlocks_blocks=Object.assign({},module$exports$Blockly$libraryBlocks$colour.blocks,module$exports$Blockly$libraryBlocks$lists.blocks,module$exports$Blockly$libraryBlocks$logic.blocks,module$exports$Blockly$libraryBlocks$loops.blocks,module$exports$Blockly$libraryBlocks$math.blocks,module$exports$Blockly$libraryBlocks$procedures.blocks,module$exports$Blockly$libraryBlocks$variables.blocks,module$exports$Blockly$libraryBlocks$variablesDynamic.blocks);
|
||||||
|
$.Blockly.libraryBlocks.blocks=module$contents$Blockly$libraryBlocks_blocks;
|
||||||
|
$.Blockly.libraryBlocks.__namespace__=$;
|
||||||
|
return $.Blockly.libraryBlocks;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -8,16 +8,17 @@
|
|||||||
* @fileoverview Gulp script to build Blockly for Node & NPM.
|
* @fileoverview Gulp script to build Blockly for Node & NPM.
|
||||||
* Run this script by calling "npm install" in this directory.
|
* Run this script by calling "npm install" in this directory.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-env node */
|
||||||
|
|
||||||
var gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
|
|
||||||
var buildTasks = require('./scripts/gulpfiles/build_tasks');
|
const buildTasks = require('./scripts/gulpfiles/build_tasks');
|
||||||
var packageTasks = require('./scripts/gulpfiles/package_tasks');
|
const packageTasks = require('./scripts/gulpfiles/package_tasks');
|
||||||
var gitTasks = require('./scripts/gulpfiles/git_tasks');
|
const gitTasks = require('./scripts/gulpfiles/git_tasks');
|
||||||
var licenseTasks = require('./scripts/gulpfiles/license_tasks');
|
const licenseTasks = require('./scripts/gulpfiles/license_tasks');
|
||||||
var appengineTasks = require('./scripts/gulpfiles/appengine_tasks');
|
const appengineTasks = require('./scripts/gulpfiles/appengine_tasks');
|
||||||
var releaseTasks = require('./scripts/gulpfiles/release_tasks');
|
const releaseTasks = require('./scripts/gulpfiles/release_tasks');
|
||||||
var cleanupTasks = require('./scripts/gulpfiles/cleanup_tasks');
|
const cleanupTasks = require('./scripts/gulpfiles/cleanup_tasks');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
deployDemos: appengineTasks.deployDemos,
|
deployDemos: appengineTasks.deployDemos,
|
||||||
@ -29,6 +30,7 @@ module.exports = {
|
|||||||
buildLangfiles: buildTasks.langfiles,
|
buildLangfiles: buildTasks.langfiles,
|
||||||
buildCompiled: buildTasks.compiled,
|
buildCompiled: buildTasks.compiled,
|
||||||
buildAdvancedCompilationTest: buildTasks.advancedCompilationTest,
|
buildAdvancedCompilationTest: buildTasks.advancedCompilationTest,
|
||||||
|
buildTs: buildTasks.buildTypescript,
|
||||||
// TODO(5621): Re-enable once typings generation is fixed.
|
// TODO(5621): Re-enable once typings generation is fixed.
|
||||||
// checkin: gulp.parallel(buildTasks.checkinBuilt, typings.checkinTypings),
|
// checkin: gulp.parallel(buildTasks.checkinBuilt, typings.checkinTypings),
|
||||||
checkin: gulp.parallel(buildTasks.checkinBuilt),
|
checkin: gulp.parallel(buildTasks.checkinBuilt),
|
||||||
|
@ -7,10 +7,11 @@
|
|||||||
} else if (typeof exports === 'object') { // Node.js
|
} else if (typeof exports === 'object') { // Node.js
|
||||||
module.exports = factory(require("./blockly_compressed.js"));
|
module.exports = factory(require("./blockly_compressed.js"));
|
||||||
} else { // Browser
|
} else { // Browser
|
||||||
root.Blockly.JavaScript = factory(root.Blockly);
|
var factoryExports = factory(root.Blockly);
|
||||||
|
root.Blockly.JavaScript = factoryExports;
|
||||||
}
|
}
|
||||||
}(this, function(Blockly) {
|
}(this, function(__parent__) {
|
||||||
const $=Blockly.internal_;
|
var $=__parent__.__namespace__;
|
||||||
var module$contents$Blockly$JavaScript_JavaScript=new $.module$exports$Blockly$Generator.Generator("JavaScript");module$contents$Blockly$JavaScript_JavaScript.addReservedWords("break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,in,instanceof,new,return,super,switch,this,throw,try,typeof,var,void,while,with,yield,enum,implements,interface,let,package,private,protected,public,static,await,null,true,false,arguments,"+Object.getOwnPropertyNames($.module$exports$Blockly$utils$global.globalThis).join(","));
|
var module$contents$Blockly$JavaScript_JavaScript=new $.module$exports$Blockly$Generator.Generator("JavaScript");module$contents$Blockly$JavaScript_JavaScript.addReservedWords("break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,in,instanceof,new,return,super,switch,this,throw,try,typeof,var,void,while,with,yield,enum,implements,interface,let,package,private,protected,public,static,await,null,true,false,arguments,"+Object.getOwnPropertyNames($.module$exports$Blockly$utils$global.globalThis).join(","));
|
||||||
module$contents$Blockly$JavaScript_JavaScript.ORDER_ATOMIC=0;module$contents$Blockly$JavaScript_JavaScript.ORDER_NEW=1.1;module$contents$Blockly$JavaScript_JavaScript.ORDER_MEMBER=1.2;module$contents$Blockly$JavaScript_JavaScript.ORDER_FUNCTION_CALL=2;module$contents$Blockly$JavaScript_JavaScript.ORDER_INCREMENT=3;module$contents$Blockly$JavaScript_JavaScript.ORDER_DECREMENT=3;module$contents$Blockly$JavaScript_JavaScript.ORDER_BITWISE_NOT=4.1;
|
module$contents$Blockly$JavaScript_JavaScript.ORDER_ATOMIC=0;module$contents$Blockly$JavaScript_JavaScript.ORDER_NEW=1.1;module$contents$Blockly$JavaScript_JavaScript.ORDER_MEMBER=1.2;module$contents$Blockly$JavaScript_JavaScript.ORDER_FUNCTION_CALL=2;module$contents$Blockly$JavaScript_JavaScript.ORDER_INCREMENT=3;module$contents$Blockly$JavaScript_JavaScript.ORDER_DECREMENT=3;module$contents$Blockly$JavaScript_JavaScript.ORDER_BITWISE_NOT=4.1;
|
||||||
module$contents$Blockly$JavaScript_JavaScript.ORDER_UNARY_PLUS=4.2;module$contents$Blockly$JavaScript_JavaScript.ORDER_UNARY_NEGATION=4.3;module$contents$Blockly$JavaScript_JavaScript.ORDER_LOGICAL_NOT=4.4;module$contents$Blockly$JavaScript_JavaScript.ORDER_TYPEOF=4.5;module$contents$Blockly$JavaScript_JavaScript.ORDER_VOID=4.6;module$contents$Blockly$JavaScript_JavaScript.ORDER_DELETE=4.7;module$contents$Blockly$JavaScript_JavaScript.ORDER_AWAIT=4.8;
|
module$contents$Blockly$JavaScript_JavaScript.ORDER_UNARY_PLUS=4.2;module$contents$Blockly$JavaScript_JavaScript.ORDER_UNARY_NEGATION=4.3;module$contents$Blockly$JavaScript_JavaScript.ORDER_LOGICAL_NOT=4.4;module$contents$Blockly$JavaScript_JavaScript.ORDER_TYPEOF=4.5;module$contents$Blockly$JavaScript_JavaScript.ORDER_VOID=4.6;module$contents$Blockly$JavaScript_JavaScript.ORDER_DELETE=4.7;module$contents$Blockly$JavaScript_JavaScript.ORDER_AWAIT=4.8;
|
||||||
@ -36,19 +37,19 @@ $.Blockly.JavaScript.text_append=function(a){var b=$.Blockly.JavaScript.nameDB_.
|
|||||||
$.Blockly.JavaScript.text_isEmpty=function(a){return["!"+($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+".length",$.Blockly.JavaScript.ORDER_LOGICAL_NOT]};
|
$.Blockly.JavaScript.text_isEmpty=function(a){return["!"+($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+".length",$.Blockly.JavaScript.ORDER_LOGICAL_NOT]};
|
||||||
$.Blockly.JavaScript.text_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",c=$.Blockly.JavaScript.valueToCode(a,"FIND",$.Blockly.JavaScript.ORDER_NONE)||"''";b=($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",$.Blockly.JavaScript.ORDER_ADDITION]:[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.text_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",c=$.Blockly.JavaScript.valueToCode(a,"FIND",$.Blockly.JavaScript.ORDER_NONE)||"''";b=($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",$.Blockly.JavaScript.ORDER_ADDITION]:[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.text_charAt=function(a){var b=a.getFieldValue("WHERE")||"FROM_START",c=$.Blockly.JavaScript.valueToCode(a,"VALUE","RANDOM"===b?$.Blockly.JavaScript.ORDER_NONE:$.Blockly.JavaScript.ORDER_MEMBER)||"''";switch(b){case "FIRST":return[c+".charAt(0)",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];case "LAST":return[c+".slice(-1)",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];case "FROM_START":return a=$.Blockly.JavaScript.getAdjusted(a,"AT"),[c+".charAt("+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];
|
$.Blockly.JavaScript.text_charAt=function(a){var b=a.getFieldValue("WHERE")||"FROM_START",c=$.Blockly.JavaScript.valueToCode(a,"VALUE","RANDOM"===b?$.Blockly.JavaScript.ORDER_NONE:$.Blockly.JavaScript.ORDER_MEMBER)||"''";switch(b){case "FIRST":return[c+".charAt(0)",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];case "LAST":return[c+".slice(-1)",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];case "FROM_START":return a=$.Blockly.JavaScript.getAdjusted(a,"AT"),[c+".charAt("+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];
|
||||||
case "FROM_END":return a=$.Blockly.JavaScript.getAdjusted(a,"AT",1,!0),[c+".slice("+a+").charAt(0)",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];case "RANDOM":return[$.Blockly.JavaScript.provideFunction_("textRandomLetter",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(text) {"," var x = Math.floor(Math.random() * text.length);"," return text[x];","}"])+"("+c+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");};
|
case "FROM_END":return a=$.Blockly.JavaScript.getAdjusted(a,"AT",1,!0),[c+".slice("+a+").charAt(0)",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];case "RANDOM":return[$.Blockly.JavaScript.provideFunction_("textRandomLetter","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(text) {\n var x = Math.floor(Math.random() * text.length);\n return text[x];\n}\n")+"("+c+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");};
|
||||||
$.Blockly.JavaScript.text_getSubstring=function(a){var b=a.getFieldValue("WHERE1"),c=a.getFieldValue("WHERE2"),d="FROM_END"!==b&&"LAST"!==b&&"FROM_END"!==c&&"LAST"!==c,e=$.Blockly.JavaScript.valueToCode(a,"STRING",d?$.Blockly.JavaScript.ORDER_MEMBER:$.Blockly.JavaScript.ORDER_NONE)||"''";if("FIRST"===b&&"LAST"===c)return[e,$.Blockly.JavaScript.ORDER_NONE];if(e.match(/^'?\w+'?$/)||d){switch(b){case "FROM_START":b=$.Blockly.JavaScript.getAdjusted(a,"AT1");break;case "FROM_END":b=$.Blockly.JavaScript.getAdjusted(a,
|
$.Blockly.JavaScript.text_getSubstring=function(a){var b=a.getFieldValue("WHERE1"),c=a.getFieldValue("WHERE2"),d="FROM_END"!==b&&"LAST"!==b&&"FROM_END"!==c&&"LAST"!==c,e=$.Blockly.JavaScript.valueToCode(a,"STRING",d?$.Blockly.JavaScript.ORDER_MEMBER:$.Blockly.JavaScript.ORDER_NONE)||"''";if("FIRST"===b&&"LAST"===c)return[e,$.Blockly.JavaScript.ORDER_NONE];if(e.match(/^'?\w+'?$/)||d){switch(b){case "FROM_START":b=$.Blockly.JavaScript.getAdjusted(a,"AT1");break;case "FROM_END":b=$.Blockly.JavaScript.getAdjusted(a,
|
||||||
"AT1",1,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);b=e+".length - "+b;break;case "FIRST":b="0";break;default:throw Error("Unhandled option (text_getSubstring).");}switch(c){case "FROM_START":c=$.Blockly.JavaScript.getAdjusted(a,"AT2",1);break;case "FROM_END":c=$.Blockly.JavaScript.getAdjusted(a,"AT2",0,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);c=e+".length - "+c;break;case "LAST":c=e+".length";break;default:throw Error("Unhandled option (text_getSubstring).");}e=e+".slice("+b+", "+c+")"}else{d=$.Blockly.JavaScript.getAdjusted(a,
|
"AT1",1,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);b=e+".length - "+b;break;case "FIRST":b="0";break;default:throw Error("Unhandled option (text_getSubstring).");}switch(c){case "FROM_START":c=$.Blockly.JavaScript.getAdjusted(a,"AT2",1);break;case "FROM_END":c=$.Blockly.JavaScript.getAdjusted(a,"AT2",0,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);c=e+".length - "+c;break;case "LAST":c=e+".length";break;default:throw Error("Unhandled option (text_getSubstring).");}e=e+".slice("+b+", "+c+")"}else{d=$.Blockly.JavaScript.getAdjusted(a,
|
||||||
"AT1");a=$.Blockly.JavaScript.getAdjusted(a,"AT2");var f={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};e=$.Blockly.JavaScript.provideFunction_("subsequence"+f[b]+f[c],["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(sequence"+("FROM_END"===b||"FROM_START"===b?", at1":"")+("FROM_END"===c||"FROM_START"===c?", at2":"")+") {"," var start = "+module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",b,"at1")+";"," var end = "+module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",
|
"AT1");a=$.Blockly.JavaScript.getAdjusted(a,"AT2");var f={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};e=$.Blockly.JavaScript.provideFunction_("subsequence"+f[b]+f[c],"\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(sequence"+("FROM_END"===b||"FROM_START"===b?", at1":"")+("FROM_END"===c||"FROM_START"===c?", at2":"")+") {\n var start = "+module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",b,"at1")+";\n var end = "+module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",
|
||||||
c,"at2")+" + 1;"," return sequence.slice(start, end);","}"])+"("+e+("FROM_END"===b||"FROM_START"===b?", "+d:"")+("FROM_END"===c||"FROM_START"===c?", "+a:"")+")"}return[e,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
c,"at2")+" + 1;\n return sequence.slice(start, end);\n}\n")+"("+e+("FROM_END"===b||"FROM_START"===b?", "+d:"")+("FROM_END"===c||"FROM_START"===c?", "+a:"")+")"}return[e,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.text_changeCase=function(a){var b={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=$.Blockly.JavaScript.valueToCode(a,"TEXT",b?$.Blockly.JavaScript.ORDER_MEMBER:$.Blockly.JavaScript.ORDER_NONE)||"''";return[b?a+b:$.Blockly.JavaScript.provideFunction_("textToTitleCase",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(str) {"," return str.replace(/\\S+/g,"," function(txt) {return txt[0].toUpperCase() + txt.substring(1).toLowerCase();});",
|
$.Blockly.JavaScript.text_changeCase=function(a){var b={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=$.Blockly.JavaScript.valueToCode(a,"TEXT",b?$.Blockly.JavaScript.ORDER_MEMBER:$.Blockly.JavaScript.ORDER_NONE)||"''";return[b?a+b:$.Blockly.JavaScript.provideFunction_("textToTitleCase","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(str) {\n return str.replace(/\\S+/g,\n function(txt) {return txt[0].toUpperCase() + txt.substring(1).toLowerCase();});\n}\n")+
|
||||||
"}"])+"("+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.text_trim=function(a){var b={LEFT:".replace(/^[\\s\\xa0]+/, '')",RIGHT:".replace(/[\\s\\xa0]+$/, '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[($.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
"("+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.text_trim=function(a){var b={LEFT:".replace(/^[\\s\\xa0]+/, '')",RIGHT:".replace(/[\\s\\xa0]+$/, '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[($.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.text_print=function(a){return"window.alert("+($.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''")+");\n"};$.Blockly.JavaScript.text_prompt_ext=function(a){var b="window.prompt("+(a.getField("TEXT")?$.Blockly.JavaScript.quote_(a.getFieldValue("TEXT")):$.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''")+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="Number("+b+")");return[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.text_print=function(a){return"window.alert("+($.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''")+");\n"};$.Blockly.JavaScript.text_prompt_ext=function(a){var b="window.prompt("+(a.getField("TEXT")?$.Blockly.JavaScript.quote_(a.getFieldValue("TEXT")):$.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''")+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="Number("+b+")");return[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.text_prompt=$.Blockly.JavaScript.text_prompt_ext;
|
$.Blockly.JavaScript.text_prompt=$.Blockly.JavaScript.text_prompt_ext;
|
||||||
$.Blockly.JavaScript.text_count=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''";a=$.Blockly.JavaScript.valueToCode(a,"SUB",$.Blockly.JavaScript.ORDER_NONE)||"''";return[$.Blockly.JavaScript.provideFunction_("textCount",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(haystack, needle) {"," if (needle.length === 0) {"," return haystack.length + 1;"," } else {"," return haystack.split(needle).length - 1;"," }","}"])+"("+b+", "+
|
$.Blockly.JavaScript.text_count=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''";a=$.Blockly.JavaScript.valueToCode(a,"SUB",$.Blockly.JavaScript.ORDER_NONE)||"''";return[$.Blockly.JavaScript.provideFunction_("textCount","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(haystack, needle) {\n if (needle.length === 0) {\n return haystack.length + 1;\n } else {\n return haystack.split(needle).length - 1;\n }\n}\n")+"("+b+", "+a+
|
||||||
a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.text_replace=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''",c=$.Blockly.JavaScript.valueToCode(a,"FROM",$.Blockly.JavaScript.ORDER_NONE)||"''";a=$.Blockly.JavaScript.valueToCode(a,"TO",$.Blockly.JavaScript.ORDER_NONE)||"''";return[$.Blockly.JavaScript.provideFunction_("textReplace",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(haystack, needle, replacement) {",' needle = needle.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g,"\\\\$1")',
|
$.Blockly.JavaScript.text_replace=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_NONE)||"''",c=$.Blockly.JavaScript.valueToCode(a,"FROM",$.Blockly.JavaScript.ORDER_NONE)||"''";a=$.Blockly.JavaScript.valueToCode(a,"TO",$.Blockly.JavaScript.ORDER_NONE)||"''";return[$.Blockly.JavaScript.provideFunction_("textReplace","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(haystack, needle, replacement) {\n needle = needle.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1')\n .replace(/\\x08/g, '\\\\x08');\n return haystack.replace(new RegExp(needle, 'g'), replacement);\n}\n")+"("+
|
||||||
' .replace(/\\x08/g,"\\\\x08");'," return haystack.replace(new RegExp(needle, 'g'), replacement);","}"])+"("+b+", "+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.text_reverse=function(a){return[($.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+".split('').reverse().join('')",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$procedures={};
|
b+", "+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.text_reverse=function(a){return[($.Blockly.JavaScript.valueToCode(a,"TEXT",$.Blockly.JavaScript.ORDER_MEMBER)||"''")+".split('').reverse().join('')",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$procedures={};
|
||||||
$.Blockly.JavaScript.procedures_defreturn=function(a){var b=$.Blockly.JavaScript.nameDB_.getName(a.getFieldValue("NAME"),$.module$exports$Blockly$Names.NameType.PROCEDURE),c="";$.Blockly.JavaScript.STATEMENT_PREFIX&&(c+=$.Blockly.JavaScript.injectId($.Blockly.JavaScript.STATEMENT_PREFIX,a));$.Blockly.JavaScript.STATEMENT_SUFFIX&&(c+=$.Blockly.JavaScript.injectId($.Blockly.JavaScript.STATEMENT_SUFFIX,a));c&&(c=$.Blockly.JavaScript.prefixLines(c,$.Blockly.JavaScript.INDENT));var d="";$.Blockly.JavaScript.INFINITE_LOOP_TRAP&&
|
$.Blockly.JavaScript.procedures_defreturn=function(a){var b=$.Blockly.JavaScript.nameDB_.getName(a.getFieldValue("NAME"),$.module$exports$Blockly$Names.NameType.PROCEDURE),c="";$.Blockly.JavaScript.STATEMENT_PREFIX&&(c+=$.Blockly.JavaScript.injectId($.Blockly.JavaScript.STATEMENT_PREFIX,a));$.Blockly.JavaScript.STATEMENT_SUFFIX&&(c+=$.Blockly.JavaScript.injectId($.Blockly.JavaScript.STATEMENT_SUFFIX,a));c&&(c=$.Blockly.JavaScript.prefixLines(c,$.Blockly.JavaScript.INDENT));var d="";$.Blockly.JavaScript.INFINITE_LOOP_TRAP&&
|
||||||
(d=$.Blockly.JavaScript.prefixLines($.Blockly.JavaScript.injectId($.Blockly.JavaScript.INFINITE_LOOP_TRAP,a),$.Blockly.JavaScript.INDENT));var e=$.Blockly.JavaScript.statementToCode(a,"STACK"),f=$.Blockly.JavaScript.valueToCode(a,"RETURN",$.Blockly.JavaScript.ORDER_NONE)||"",g="";e&&f&&(g=c);f&&(f=$.Blockly.JavaScript.INDENT+"return "+f+";\n");for(var h=[],k=a.getVars(),l=0;l<k.length;l++)h[l]=$.Blockly.JavaScript.nameDB_.getName(k[l],$.module$exports$Blockly$Names.NameType.VARIABLE);c="async function "+
|
(d=$.Blockly.JavaScript.prefixLines($.Blockly.JavaScript.injectId($.Blockly.JavaScript.INFINITE_LOOP_TRAP,a),$.Blockly.JavaScript.INDENT));var e=$.Blockly.JavaScript.statementToCode(a,"STACK"),f=$.Blockly.JavaScript.valueToCode(a,"RETURN",$.Blockly.JavaScript.ORDER_NONE)||"",g="";e&&f&&(g=c);f&&(f=$.Blockly.JavaScript.INDENT+"return "+f+";\n");for(var h=[],k=a.getVars(),l=0;l<k.length;l++)h[l]=$.Blockly.JavaScript.nameDB_.getName(k[l],$.module$exports$Blockly$Names.NameType.VARIABLE);c="async function "+
|
||||||
b+"("+h.join(", ")+") {\n"+c+d+e+g+f+"}";c=$.Blockly.JavaScript.scrub_(a,c);$.Blockly.JavaScript.definitions_["%"+b]=c;return null};$.Blockly.JavaScript.procedures_defnoreturn=$.Blockly.JavaScript.procedures_defreturn;
|
b+"("+h.join(", ")+") {\n"+c+d+e+g+f+"}";c=$.Blockly.JavaScript.scrub_(a,c);$.Blockly.JavaScript.definitions_["%"+b]=c;return null};$.Blockly.JavaScript.procedures_defnoreturn=$.Blockly.JavaScript.procedures_defreturn;
|
||||||
@ -60,20 +61,19 @@ $.Blockly.JavaScript.math_single=function(a){var b=a.getFieldValue("OP");if("NEG
|
|||||||
case "ROOT":c="Math.sqrt("+a+")";break;case "LN":c="Math.log("+a+")";break;case "EXP":c="Math.exp("+a+")";break;case "POW10":c="Math.pow(10,"+a+")";break;case "ROUND":c="Math.round("+a+")";break;case "ROUNDUP":c="Math.ceil("+a+")";break;case "ROUNDDOWN":c="Math.floor("+a+")";break;case "SIN":c="Math.sin("+a+" / 180 * Math.PI)";break;case "COS":c="Math.cos("+a+" / 180 * Math.PI)";break;case "TAN":c="Math.tan("+a+" / 180 * Math.PI)"}if(c)return[c,$.Blockly.JavaScript.ORDER_FUNCTION_CALL];switch(b){case "LOG10":c=
|
case "ROOT":c="Math.sqrt("+a+")";break;case "LN":c="Math.log("+a+")";break;case "EXP":c="Math.exp("+a+")";break;case "POW10":c="Math.pow(10,"+a+")";break;case "ROUND":c="Math.round("+a+")";break;case "ROUNDUP":c="Math.ceil("+a+")";break;case "ROUNDDOWN":c="Math.floor("+a+")";break;case "SIN":c="Math.sin("+a+" / 180 * Math.PI)";break;case "COS":c="Math.cos("+a+" / 180 * Math.PI)";break;case "TAN":c="Math.tan("+a+" / 180 * Math.PI)"}if(c)return[c,$.Blockly.JavaScript.ORDER_FUNCTION_CALL];switch(b){case "LOG10":c=
|
||||||
"Math.log("+a+") / Math.log(10)";break;case "ASIN":c="Math.asin("+a+") / Math.PI * 180";break;case "ACOS":c="Math.acos("+a+") / Math.PI * 180";break;case "ATAN":c="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+b);}return[c,$.Blockly.JavaScript.ORDER_DIVISION]};
|
"Math.log("+a+") / Math.log(10)";break;case "ASIN":c="Math.asin("+a+") / Math.PI * 180";break;case "ACOS":c="Math.acos("+a+") / Math.PI * 180";break;case "ATAN":c="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+b);}return[c,$.Blockly.JavaScript.ORDER_DIVISION]};
|
||||||
$.Blockly.JavaScript.math_constant=function(a){return{PI:["Math.PI",$.Blockly.JavaScript.ORDER_MEMBER],E:["Math.E",$.Blockly.JavaScript.ORDER_MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",$.Blockly.JavaScript.ORDER_DIVISION],SQRT2:["Math.SQRT2",$.Blockly.JavaScript.ORDER_MEMBER],SQRT1_2:["Math.SQRT1_2",$.Blockly.JavaScript.ORDER_MEMBER],INFINITY:["Infinity",$.Blockly.JavaScript.ORDER_ATOMIC]}[a.getFieldValue("CONSTANT")]};
|
$.Blockly.JavaScript.math_constant=function(a){return{PI:["Math.PI",$.Blockly.JavaScript.ORDER_MEMBER],E:["Math.E",$.Blockly.JavaScript.ORDER_MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",$.Blockly.JavaScript.ORDER_DIVISION],SQRT2:["Math.SQRT2",$.Blockly.JavaScript.ORDER_MEMBER],SQRT1_2:["Math.SQRT1_2",$.Blockly.JavaScript.ORDER_MEMBER],INFINITY:["Infinity",$.Blockly.JavaScript.ORDER_ATOMIC]}[a.getFieldValue("CONSTANT")]};
|
||||||
$.Blockly.JavaScript.math_number_property=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"NUMBER_TO_CHECK",$.Blockly.JavaScript.ORDER_MODULUS)||"0",c=a.getFieldValue("PROPERTY");if("PRIME"===c)return[$.Blockly.JavaScript.provideFunction_("mathIsPrime",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(n) {"," // https://en.wikipedia.org/wiki/Primality_test#Naive_methods"," if (n == 2 || n == 3) {"," return true;"," }"," // False if n is NaN, negative, is 1, or not whole.",
|
$.Blockly.JavaScript.math_number_property=function(a){var b={EVEN:[" % 2 === 0",$.Blockly.JavaScript.ORDER_MODULUS,$.Blockly.JavaScript.ORDER_EQUALITY],ODD:[" % 2 === 1",$.Blockly.JavaScript.ORDER_MODULUS,$.Blockly.JavaScript.ORDER_EQUALITY],WHOLE:[" % 1 === 0",$.Blockly.JavaScript.ORDER_MODULUS,$.Blockly.JavaScript.ORDER_EQUALITY],POSITIVE:[" > 0",$.Blockly.JavaScript.ORDER_RELATIONAL,$.Blockly.JavaScript.ORDER_RELATIONAL],NEGATIVE:[" < 0",$.Blockly.JavaScript.ORDER_RELATIONAL,$.Blockly.JavaScript.ORDER_RELATIONAL],
|
||||||
" // And false if n is divisible by 2 or 3."," if (isNaN(n) || n <= 1 || n % 1 !== 0 || n % 2 === 0 || n % 3 === 0) {"," return false;"," }"," // Check all the numbers of form 6k +/- 1, up to sqrt(n)."," for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {"," if (n % (x - 1) === 0 || n % (x + 1) === 0) {"," return false;"," }"," }"," return true;","}"])+"("+b+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];switch(c){case "EVEN":var d=b+" % 2 === 0";break;case "ODD":d=b+" % 2 === 1";
|
DIVISIBLE_BY:[null,$.Blockly.JavaScript.ORDER_MODULUS,$.Blockly.JavaScript.ORDER_EQUALITY],PRIME:[null,$.Blockly.JavaScript.ORDER_NONE,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]},c=a.getFieldValue("PROPERTY");b=$.$jscomp.makeIterator(b[c]);var d=b.next().value,e=b.next().value;b=b.next().value;e=$.Blockly.JavaScript.valueToCode(a,"NUMBER_TO_CHECK",e)||"0";"PRIME"===c?a=$.Blockly.JavaScript.provideFunction_("mathIsPrime","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(n) {\n // https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n if (n == 2 || n == 3) {\n return true;\n }\n // False if n is NaN, negative, is 1, or not whole.\n // And false if n is divisible by 2 or 3.\n if (isNaN(n) || n <= 1 || n % 1 !== 0 || n % 2 === 0 || n % 3 === 0) {\n return false;\n }\n // Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {\n if (n % (x - 1) === 0 || n % (x + 1) === 0) {\n return false;\n }\n }\n return true;\n}\n")+
|
||||||
break;case "WHOLE":d=b+" % 1 === 0";break;case "POSITIVE":d=b+" > 0";break;case "NEGATIVE":d=b+" < 0";break;case "DIVISIBLE_BY":a=$.Blockly.JavaScript.valueToCode(a,"DIVISOR",$.Blockly.JavaScript.ORDER_MODULUS)||"0",d=b+" % "+a+" === 0"}return[d,$.Blockly.JavaScript.ORDER_EQUALITY]};
|
"("+e+")":"DIVISIBLE_BY"===c?(a=$.Blockly.JavaScript.valueToCode(a,"DIVISOR",$.Blockly.JavaScript.ORDER_MODULUS)||"0",a=e+" % "+a+" === 0"):a=e+d;return[a,b]};$.Blockly.JavaScript.math_change=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"DELTA",$.Blockly.JavaScript.ORDER_ADDITION)||"0";a=$.Blockly.JavaScript.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE);return a+" = (typeof "+a+" === 'number' ? "+a+" : 0) + "+b+";\n"};
|
||||||
$.Blockly.JavaScript.math_change=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"DELTA",$.Blockly.JavaScript.ORDER_ADDITION)||"0";a=$.Blockly.JavaScript.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE);return a+" = (typeof "+a+" === 'number' ? "+a+" : 0) + "+b+";\n"};$.Blockly.JavaScript.math_round=$.Blockly.JavaScript.math_single;$.Blockly.JavaScript.math_trig=$.Blockly.JavaScript.math_single;
|
$.Blockly.JavaScript.math_round=$.Blockly.JavaScript.math_single;$.Blockly.JavaScript.math_trig=$.Blockly.JavaScript.math_single;
|
||||||
$.Blockly.JavaScript.math_on_list=function(a){var b=a.getFieldValue("OP");switch(b){case "SUM":a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_MEMBER)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":b=
|
$.Blockly.JavaScript.math_on_list=function(a){var b=a.getFieldValue("OP");switch(b){case "SUM":a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_MEMBER)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":b=
|
||||||
$.Blockly.JavaScript.provideFunction_("mathMean",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "MEDIAN":b=$.Blockly.JavaScript.provideFunction_("mathMedian",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," var localList = myList.filter(function (x) {return typeof x === 'number';});",
|
$.Blockly.JavaScript.provideFunction_("mathMean","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {\n return myList.reduce(function(x, y) {return x + y;}) / myList.length;\n}\n");a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "MEDIAN":b=$.Blockly.JavaScript.provideFunction_("mathMedian","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {\n var localList = myList.filter(function (x) {return typeof x === 'number';});\n if (!localList.length) return null;\n localList.sort(function(a, b) {return b - a;});\n if (localList.length % 2 === 0) {\n return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;\n } else {\n return localList[(localList.length - 1) / 2];\n }\n}\n");
|
||||||
" if (!localList.length) return null;"," localList.sort(function(a, b) {return b - a;});"," if (localList.length % 2 === 0) {"," return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;"," } else {"," return localList[(localList.length - 1) / 2];"," }","}"]);a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "MODE":b=$.Blockly.JavaScript.provideFunction_("mathModes",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+
|
a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "MODE":b=$.Blockly.JavaScript.provideFunction_("mathModes","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(values) {\n var modes = [];\n var counts = [];\n var maxCount = 0;\n for (var i = 0; i < values.length; i++) {\n var value = values[i];\n var found = false;\n var thisCount;\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][0] === value) {\n thisCount = ++counts[j][1];\n found = true;\n break;\n }\n }\n if (!found) {\n counts.push([value, 1]);\n thisCount = 1;\n }\n maxCount = Math.max(thisCount, maxCount);\n }\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][1] === maxCount) {\n modes.push(counts[j][0]);\n }\n }\n return modes;\n}\n");
|
||||||
"(values) {"," var modes = [];"," var counts = [];"," var maxCount = 0;"," for (var i = 0; i < values.length; i++) {"," var value = values[i];"," var found = false;"," var thisCount;"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][0] === value) {"," thisCount = ++counts[j][1];"," found = true;"," break;"," }"," }"," if (!found) {"," counts.push([value, 1]);"," thisCount = 1;"," }"," maxCount = Math.max(thisCount, maxCount);",
|
a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "STD_DEV":b=$.Blockly.JavaScript.provideFunction_("mathStandardDeviation","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(numbers) {\n var n = numbers.length;\n if (!n) return null;\n var mean = numbers.reduce(function(x, y) {return x + y;}) / n;\n var variance = 0;\n for (var j = 0; j < n; j++) {\n variance += Math.pow(numbers[j] - mean, 2);\n }\n variance = variance / n;\n return Math.sqrt(variance);\n}\n");
|
||||||
" }"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][1] === maxCount) {"," modes.push(counts[j][0]);"," }"," }"," return modes;","}"]);a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "STD_DEV":b=$.Blockly.JavaScript.provideFunction_("mathStandardDeviation",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(numbers) {"," var n = numbers.length;"," if (!n) return null;"," var mean = numbers.reduce(function(x, y) {return x + y;}) / n;",
|
a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "RANDOM":b=$.Blockly.JavaScript.provideFunction_("mathRandomList","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list) {\n var x = Math.floor(Math.random() * list.length);\n return list[x];\n}\n");a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;default:throw Error("Unknown operator: "+b);}return[a,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
" var variance = 0;"," for (var j = 0; j < n; j++) {"," variance += Math.pow(numbers[j] - mean, 2);"," }"," variance = variance / n;"," return Math.sqrt(variance);","}"]);a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;case "RANDOM":b=$.Blockly.JavaScript.provideFunction_("mathRandomList",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]);
|
$.Blockly.JavaScript.math_modulo=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"DIVIDEND",$.Blockly.JavaScript.ORDER_MODULUS)||"0";a=$.Blockly.JavaScript.valueToCode(a,"DIVISOR",$.Blockly.JavaScript.ORDER_MODULUS)||"0";return[b+" % "+a,$.Blockly.JavaScript.ORDER_MODULUS]};
|
||||||
a=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_NONE)||"[]";a=b+"("+a+")";break;default:throw Error("Unknown operator: "+b);}return[a,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.math_modulo=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"DIVIDEND",$.Blockly.JavaScript.ORDER_MODULUS)||"0";a=$.Blockly.JavaScript.valueToCode(a,"DIVISOR",$.Blockly.JavaScript.ORDER_MODULUS)||"0";return[b+" % "+a,$.Blockly.JavaScript.ORDER_MODULUS]};
|
|
||||||
$.Blockly.JavaScript.math_constrain=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_NONE)||"0",c=$.Blockly.JavaScript.valueToCode(a,"LOW",$.Blockly.JavaScript.ORDER_NONE)||"0";a=$.Blockly.JavaScript.valueToCode(a,"HIGH",$.Blockly.JavaScript.ORDER_NONE)||"Infinity";return["Math.min(Math.max("+b+", "+c+"), "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.math_constrain=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_NONE)||"0",c=$.Blockly.JavaScript.valueToCode(a,"LOW",$.Blockly.JavaScript.ORDER_NONE)||"0";a=$.Blockly.JavaScript.valueToCode(a,"HIGH",$.Blockly.JavaScript.ORDER_NONE)||"Infinity";return["Math.min(Math.max("+b+", "+c+"), "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.math_random_int=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"FROM",$.Blockly.JavaScript.ORDER_NONE)||"0";a=$.Blockly.JavaScript.valueToCode(a,"TO",$.Blockly.JavaScript.ORDER_NONE)||"0";return[$.Blockly.JavaScript.provideFunction_("mathRandomInt",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);",
|
$.Blockly.JavaScript.math_random_int=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"FROM",$.Blockly.JavaScript.ORDER_NONE)||"0";a=$.Blockly.JavaScript.valueToCode(a,"TO",$.Blockly.JavaScript.ORDER_NONE)||"0";return[$.Blockly.JavaScript.provideFunction_("mathRandomInt","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(a, b) {\n if (a > b) {\n // Swap a and b to ensure a is smaller.\n var c = a;\n a = b;\n b = c;\n }\n return Math.floor(Math.random() * (b - a + 1) + a);\n}\n")+
|
||||||
"}"])+"("+b+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.math_random_float=function(a){return["Math.random()",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.math_atan2=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"X",$.Blockly.JavaScript.ORDER_NONE)||"0";return["Math.atan2("+($.Blockly.JavaScript.valueToCode(a,"Y",$.Blockly.JavaScript.ORDER_NONE)||"0")+", "+b+") / Math.PI * 180",$.Blockly.JavaScript.ORDER_DIVISION]};var module$exports$Blockly$JavaScript$loops={};
|
"("+b+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.math_random_float=function(a){return["Math.random()",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.math_atan2=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"X",$.Blockly.JavaScript.ORDER_NONE)||"0";return["Math.atan2("+($.Blockly.JavaScript.valueToCode(a,"Y",$.Blockly.JavaScript.ORDER_NONE)||"0")+", "+b+") / Math.PI * 180",$.Blockly.JavaScript.ORDER_DIVISION]};var module$exports$Blockly$JavaScript$loops={};
|
||||||
$.Blockly.JavaScript.controls_repeat_ext=function(a){var b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):$.Blockly.JavaScript.valueToCode(a,"TIMES",$.Blockly.JavaScript.ORDER_ASSIGNMENT)||"0";var c=$.Blockly.JavaScript.statementToCode(a,"DO");c=$.Blockly.JavaScript.addLoopTrap(c,a);a="";var d=$.Blockly.JavaScript.nameDB_.getDistinctName("count",$.module$exports$Blockly$Names.NameType.VARIABLE),e=b;b.match(/^\w+$/)||(0,$.module$exports$Blockly$utils$string.isNumber)(b)||(e=$.Blockly.JavaScript.nameDB_.getDistinctName("repeat_end",
|
$.Blockly.JavaScript.controls_repeat_ext=function(a){var b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):$.Blockly.JavaScript.valueToCode(a,"TIMES",$.Blockly.JavaScript.ORDER_ASSIGNMENT)||"0";var c=$.Blockly.JavaScript.statementToCode(a,"DO");c=$.Blockly.JavaScript.addLoopTrap(c,a);a="";var d=$.Blockly.JavaScript.nameDB_.getDistinctName("count",$.module$exports$Blockly$Names.NameType.VARIABLE),e=b;b.match(/^\w+$/)||(0,$.module$exports$Blockly$utils$string.isNumber)(b)||(e=$.Blockly.JavaScript.nameDB_.getDistinctName("repeat_end",
|
||||||
$.module$exports$Blockly$Names.NameType.VARIABLE),a+="var "+e+" = "+b+";\n");return a+("for (var "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n")};$.Blockly.JavaScript.controls_repeat=$.Blockly.JavaScript.controls_repeat_ext;
|
$.module$exports$Blockly$Names.NameType.VARIABLE),a+="var "+e+" = "+b+";\n");return a+("for (var "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n")};$.Blockly.JavaScript.controls_repeat=$.Blockly.JavaScript.controls_repeat_ext;
|
||||||
$.Blockly.JavaScript.controls_whileUntil=function(a){var b="UNTIL"===a.getFieldValue("MODE"),c=$.Blockly.JavaScript.valueToCode(a,"BOOL",b?$.Blockly.JavaScript.ORDER_LOGICAL_NOT:$.Blockly.JavaScript.ORDER_NONE)||"false",d=$.Blockly.JavaScript.statementToCode(a,"DO");d=$.Blockly.JavaScript.addLoopTrap(d,a);b&&(c="!"+c);return"while ("+c+") {\n"+d+"}\n"};
|
$.Blockly.JavaScript.controls_whileUntil=function(a){var b="UNTIL"===a.getFieldValue("MODE"),c=$.Blockly.JavaScript.valueToCode(a,"BOOL",b?$.Blockly.JavaScript.ORDER_LOGICAL_NOT:$.Blockly.JavaScript.ORDER_NONE)||"false",d=$.Blockly.JavaScript.statementToCode(a,"DO");d=$.Blockly.JavaScript.addLoopTrap(d,a);b&&(c="!"+c);return"while ("+c+") {\n"+d+"}\n"};
|
||||||
@ -91,31 +91,29 @@ $.Blockly.JavaScript.logic_compare=function(a){var b={EQ:"==",NEQ:"!=",LT:"<",LT
|
|||||||
$.Blockly.JavaScript.logic_operation=function(a){var b="AND"===a.getFieldValue("OP")?"&&":"||",c="&&"===b?$.Blockly.JavaScript.ORDER_LOGICAL_AND:$.Blockly.JavaScript.ORDER_LOGICAL_OR,d=$.Blockly.JavaScript.valueToCode(a,"A",c);a=$.Blockly.JavaScript.valueToCode(a,"B",c);if(d||a){var e="&&"===b?"true":"false";d||(d=e);a||(a=e)}else a=d="false";return[d+" "+b+" "+a,c]};
|
$.Blockly.JavaScript.logic_operation=function(a){var b="AND"===a.getFieldValue("OP")?"&&":"||",c="&&"===b?$.Blockly.JavaScript.ORDER_LOGICAL_AND:$.Blockly.JavaScript.ORDER_LOGICAL_OR,d=$.Blockly.JavaScript.valueToCode(a,"A",c);a=$.Blockly.JavaScript.valueToCode(a,"B",c);if(d||a){var e="&&"===b?"true":"false";d||(d=e);a||(a=e)}else a=d="false";return[d+" "+b+" "+a,c]};
|
||||||
$.Blockly.JavaScript.logic_negate=function(a){var b=$.Blockly.JavaScript.ORDER_LOGICAL_NOT;return["!"+($.Blockly.JavaScript.valueToCode(a,"BOOL",b)||"true"),b]};$.Blockly.JavaScript.logic_boolean=function(a){return["TRUE"===a.getFieldValue("BOOL")?"true":"false",$.Blockly.JavaScript.ORDER_ATOMIC]};$.Blockly.JavaScript.logic_null=function(a){return["null",$.Blockly.JavaScript.ORDER_ATOMIC]};
|
$.Blockly.JavaScript.logic_negate=function(a){var b=$.Blockly.JavaScript.ORDER_LOGICAL_NOT;return["!"+($.Blockly.JavaScript.valueToCode(a,"BOOL",b)||"true"),b]};$.Blockly.JavaScript.logic_boolean=function(a){return["TRUE"===a.getFieldValue("BOOL")?"true":"false",$.Blockly.JavaScript.ORDER_ATOMIC]};$.Blockly.JavaScript.logic_null=function(a){return["null",$.Blockly.JavaScript.ORDER_ATOMIC]};
|
||||||
$.Blockly.JavaScript.logic_ternary=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"IF",$.Blockly.JavaScript.ORDER_CONDITIONAL)||"false",c=$.Blockly.JavaScript.valueToCode(a,"THEN",$.Blockly.JavaScript.ORDER_CONDITIONAL)||"null";a=$.Blockly.JavaScript.valueToCode(a,"ELSE",$.Blockly.JavaScript.ORDER_CONDITIONAL)||"null";return[b+" ? "+c+" : "+a,$.Blockly.JavaScript.ORDER_CONDITIONAL]};var module$exports$Blockly$JavaScript$lists={};$.Blockly.JavaScript.lists_create_empty=function(a){return["[]",$.Blockly.JavaScript.ORDER_ATOMIC]};$.Blockly.JavaScript.lists_create_with=function(a){for(var b=Array(a.itemCount_),c=0;c<a.itemCount_;c++)b[c]=$.Blockly.JavaScript.valueToCode(a,"ADD"+c,$.Blockly.JavaScript.ORDER_NONE)||"null";return["["+b.join(", ")+"]",$.Blockly.JavaScript.ORDER_ATOMIC]};
|
$.Blockly.JavaScript.logic_ternary=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"IF",$.Blockly.JavaScript.ORDER_CONDITIONAL)||"false",c=$.Blockly.JavaScript.valueToCode(a,"THEN",$.Blockly.JavaScript.ORDER_CONDITIONAL)||"null";a=$.Blockly.JavaScript.valueToCode(a,"ELSE",$.Blockly.JavaScript.ORDER_CONDITIONAL)||"null";return[b+" ? "+c+" : "+a,$.Blockly.JavaScript.ORDER_CONDITIONAL]};var module$exports$Blockly$JavaScript$lists={};$.Blockly.JavaScript.lists_create_empty=function(a){return["[]",$.Blockly.JavaScript.ORDER_ATOMIC]};$.Blockly.JavaScript.lists_create_with=function(a){for(var b=Array(a.itemCount_),c=0;c<a.itemCount_;c++)b[c]=$.Blockly.JavaScript.valueToCode(a,"ADD"+c,$.Blockly.JavaScript.ORDER_NONE)||"null";return["["+b.join(", ")+"]",$.Blockly.JavaScript.ORDER_ATOMIC]};
|
||||||
$.Blockly.JavaScript.lists_repeat=function(a){var b=$.Blockly.JavaScript.provideFunction_("listsRepeat",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(value, n) {"," var array = [];"," for (var i = 0; i < n; i++) {"," array[i] = value;"," }"," return array;","}"]),c=$.Blockly.JavaScript.valueToCode(a,"ITEM",$.Blockly.JavaScript.ORDER_NONE)||"null";a=$.Blockly.JavaScript.valueToCode(a,"NUM",$.Blockly.JavaScript.ORDER_NONE)||"0";return[b+"("+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.lists_repeat=function(a){var b=$.Blockly.JavaScript.provideFunction_("listsRepeat","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(value, n) {\n var array = [];\n for (var i = 0; i < n; i++) {\n array[i] = value;\n }\n return array;\n}\n"),c=$.Blockly.JavaScript.valueToCode(a,"ITEM",$.Blockly.JavaScript.ORDER_NONE)||"null";a=$.Blockly.JavaScript.valueToCode(a,"NUM",$.Blockly.JavaScript.ORDER_NONE)||"0";return[b+"("+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.lists_length=function(a){return[($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"[]")+".length",$.Blockly.JavaScript.ORDER_MEMBER]};$.Blockly.JavaScript.lists_isEmpty=function(a){return["!"+($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"[]")+".length",$.Blockly.JavaScript.ORDER_LOGICAL_NOT]};
|
$.Blockly.JavaScript.lists_length=function(a){return[($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"[]")+".length",$.Blockly.JavaScript.ORDER_MEMBER]};$.Blockly.JavaScript.lists_isEmpty=function(a){return["!"+($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"[]")+".length",$.Blockly.JavaScript.ORDER_LOGICAL_NOT]};
|
||||||
$.Blockly.JavaScript.lists_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",c=$.Blockly.JavaScript.valueToCode(a,"FIND",$.Blockly.JavaScript.ORDER_NONE)||"''";b=($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"[]")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",$.Blockly.JavaScript.ORDER_ADDITION]:[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.lists_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",c=$.Blockly.JavaScript.valueToCode(a,"FIND",$.Blockly.JavaScript.ORDER_NONE)||"''";b=($.Blockly.JavaScript.valueToCode(a,"VALUE",$.Blockly.JavaScript.ORDER_MEMBER)||"[]")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",$.Blockly.JavaScript.ORDER_ADDITION]:[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.lists_getIndex=function(a){var b=a.getFieldValue("MODE")||"GET",c=a.getFieldValue("WHERE")||"FROM_START",d=$.Blockly.JavaScript.valueToCode(a,"VALUE","RANDOM"===c?$.Blockly.JavaScript.ORDER_NONE:$.Blockly.JavaScript.ORDER_MEMBER)||"[]";switch(c){case "FIRST":if("GET"===b)return[d+"[0]",$.Blockly.JavaScript.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".shift()",$.Blockly.JavaScript.ORDER_MEMBER];if("REMOVE"===b)return d+".shift();\n";break;case "LAST":if("GET"===b)return[d+".slice(-1)[0]",
|
$.Blockly.JavaScript.lists_getIndex=function(a){var b=a.getFieldValue("MODE")||"GET",c=a.getFieldValue("WHERE")||"FROM_START",d=$.Blockly.JavaScript.valueToCode(a,"VALUE","RANDOM"===c?$.Blockly.JavaScript.ORDER_NONE:$.Blockly.JavaScript.ORDER_MEMBER)||"[]";switch(c){case "FIRST":if("GET"===b)return[d+"[0]",$.Blockly.JavaScript.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".shift()",$.Blockly.JavaScript.ORDER_MEMBER];if("REMOVE"===b)return d+".shift();\n";break;case "LAST":if("GET"===b)return[d+".slice(-1)[0]",
|
||||||
$.Blockly.JavaScript.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop()",$.Blockly.JavaScript.ORDER_MEMBER];if("REMOVE"===b)return d+".pop();\n";break;case "FROM_START":a=$.Blockly.JavaScript.getAdjusted(a,"AT");if("GET"===b)return[d+"["+a+"]",$.Blockly.JavaScript.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".splice("+a+", 1)[0]",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);\n";break;case "FROM_END":a=$.Blockly.JavaScript.getAdjusted(a,"AT",1,!0);if("GET"===
|
$.Blockly.JavaScript.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop()",$.Blockly.JavaScript.ORDER_MEMBER];if("REMOVE"===b)return d+".pop();\n";break;case "FROM_START":a=$.Blockly.JavaScript.getAdjusted(a,"AT");if("GET"===b)return[d+"["+a+"]",$.Blockly.JavaScript.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".splice("+a+", 1)[0]",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);\n";break;case "FROM_END":a=$.Blockly.JavaScript.getAdjusted(a,"AT",1,!0);if("GET"===
|
||||||
b)return[d+".slice("+a+")[0]",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("GET_REMOVE"===b)return[d+".splice("+a+", 1)[0]",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);";break;case "RANDOM":d=$.Blockly.JavaScript.provideFunction_("listsGetRandomItem",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list, remove) {"," var x = Math.floor(Math.random() * list.length);"," if (remove) {"," return list.splice(x, 1)[0];"," } else {"," return list[x];",
|
b)return[d+".slice("+a+")[0]",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("GET_REMOVE"===b)return[d+".splice("+a+", 1)[0]",$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);";break;case "RANDOM":d=$.Blockly.JavaScript.provideFunction_("listsGetRandomItem","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list, remove) {\n var x = Math.floor(Math.random() * list.length);\n if (remove) {\n return list.splice(x, 1)[0];\n } else {\n return list[x];\n }\n}\n")+
|
||||||
" }","}"])+"("+d+", "+("GET"!==b)+")";if("GET"===b||"GET_REMOVE"===b)return[d,$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+";\n"}throw Error("Unhandled combination (lists_getIndex).");};
|
"("+d+", "+("GET"!==b)+")";if("GET"===b||"GET_REMOVE"===b)return[d,$.Blockly.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+";\n"}throw Error("Unhandled combination (lists_getIndex).");};
|
||||||
$.Blockly.JavaScript.lists_setIndex=function(a){function b(){if(c.match(/^\w+$/))return"";var g=$.Blockly.JavaScript.nameDB_.getDistinctName("tmpList",$.module$exports$Blockly$Names.NameType.VARIABLE),h="var "+g+" = "+c+";\n";c=g;return h}var c=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_MEMBER)||"[]",d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=$.Blockly.JavaScript.valueToCode(a,"TO",$.Blockly.JavaScript.ORDER_ASSIGNMENT)||"null";switch(e){case "FIRST":if("SET"===
|
$.Blockly.JavaScript.lists_setIndex=function(a){function b(){if(c.match(/^\w+$/))return"";var g=$.Blockly.JavaScript.nameDB_.getDistinctName("tmpList",$.module$exports$Blockly$Names.NameType.VARIABLE),h="var "+g+" = "+c+";\n";c=g;return h}var c=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_MEMBER)||"[]",d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=$.Blockly.JavaScript.valueToCode(a,"TO",$.Blockly.JavaScript.ORDER_ASSIGNMENT)||"null";switch(e){case "FIRST":if("SET"===
|
||||||
d)return c+"[0] = "+f+";\n";if("INSERT"===d)return c+".unshift("+f+");\n";break;case "LAST":if("SET"===d)return b()+(c+"["+c+".length - 1] = "+f+";\n");if("INSERT"===d)return c+".push("+f+");\n";break;case "FROM_START":a=$.Blockly.JavaScript.getAdjusted(a,"AT");if("SET"===d)return c+"["+a+"] = "+f+";\n";if("INSERT"===d)return c+".splice("+a+", 0, "+f+");\n";break;case "FROM_END":a=$.Blockly.JavaScript.getAdjusted(a,"AT",1,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);e=b();if("SET"===d)return e+(c+"["+
|
d)return c+"[0] = "+f+";\n";if("INSERT"===d)return c+".unshift("+f+");\n";break;case "LAST":if("SET"===d)return b()+(c+"["+c+".length - 1] = "+f+";\n");if("INSERT"===d)return c+".push("+f+");\n";break;case "FROM_START":a=$.Blockly.JavaScript.getAdjusted(a,"AT");if("SET"===d)return c+"["+a+"] = "+f+";\n";if("INSERT"===d)return c+".splice("+a+", 0, "+f+");\n";break;case "FROM_END":a=$.Blockly.JavaScript.getAdjusted(a,"AT",1,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);e=b();if("SET"===d)return e+(c+"["+
|
||||||
c+".length - "+a+"] = "+f+";\n");if("INSERT"===d)return e+(c+".splice("+c+".length - "+a+", 0, "+f+");\n");break;case "RANDOM":a=b();e=$.Blockly.JavaScript.nameDB_.getDistinctName("tmpX",$.module$exports$Blockly$Names.NameType.VARIABLE);a+="var "+e+" = Math.floor(Math.random() * "+c+".length);\n";if("SET"===d)return a+(c+"["+e+"] = "+f+";\n");if("INSERT"===d)return a+(c+".splice("+e+", 0, "+f+");\n")}throw Error("Unhandled combination (lists_setIndex).");};
|
c+".length - "+a+"] = "+f+";\n");if("INSERT"===d)return e+(c+".splice("+c+".length - "+a+", 0, "+f+");\n");break;case "RANDOM":a=b();e=$.Blockly.JavaScript.nameDB_.getDistinctName("tmpX",$.module$exports$Blockly$Names.NameType.VARIABLE);a+="var "+e+" = Math.floor(Math.random() * "+c+".length);\n";if("SET"===d)return a+(c+"["+e+"] = "+f+";\n");if("INSERT"===d)return a+(c+".splice("+e+", 0, "+f+");\n")}throw Error("Unhandled combination (lists_setIndex).");};
|
||||||
var module$contents$Blockly$JavaScript$lists_getSubstringIndex=function(a,b,c){return"FIRST"===b?"0":"FROM_END"===b?a+".length - 1 - "+c:"LAST"===b?a+".length - 1":c};
|
var module$contents$Blockly$JavaScript$lists_getSubstringIndex=function(a,b,c){return"FIRST"===b?"0":"FROM_END"===b?a+".length - 1 - "+c:"LAST"===b?a+".length - 1":c};
|
||||||
$.Blockly.JavaScript.lists_getSublist=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_MEMBER)||"[]",c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2");if("FIRST"===c&&"LAST"===d)b+=".slice(0)";else if(b.match(/^\w+$/)||"FROM_END"!==c&&"FROM_START"===d){switch(c){case "FROM_START":c=$.Blockly.JavaScript.getAdjusted(a,"AT1");break;case "FROM_END":c=$.Blockly.JavaScript.getAdjusted(a,"AT1",1,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);c=b+".length - "+c;break;
|
$.Blockly.JavaScript.lists_getSublist=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_MEMBER)||"[]",c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2");if("FIRST"===c&&"LAST"===d)b+=".slice(0)";else if(b.match(/^\w+$/)||"FROM_END"!==c&&"FROM_START"===d){switch(c){case "FROM_START":c=$.Blockly.JavaScript.getAdjusted(a,"AT1");break;case "FROM_END":c=$.Blockly.JavaScript.getAdjusted(a,"AT1",1,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);c=b+".length - "+c;break;
|
||||||
case "FIRST":c="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(d){case "FROM_START":d=$.Blockly.JavaScript.getAdjusted(a,"AT2",1);break;case "FROM_END":d=$.Blockly.JavaScript.getAdjusted(a,"AT2",0,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);d=b+".length - "+d;break;case "LAST":d=b+".length";break;default:throw Error("Unhandled option (lists_getSublist).");}b=b+".slice("+c+", "+d+")"}else{var e=$.Blockly.JavaScript.getAdjusted(a,"AT1");a=$.Blockly.JavaScript.getAdjusted(a,
|
case "FIRST":c="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(d){case "FROM_START":d=$.Blockly.JavaScript.getAdjusted(a,"AT2",1);break;case "FROM_END":d=$.Blockly.JavaScript.getAdjusted(a,"AT2",0,!1,$.Blockly.JavaScript.ORDER_SUBTRACTION);d=b+".length - "+d;break;case "LAST":d=b+".length";break;default:throw Error("Unhandled option (lists_getSublist).");}b=b+".slice("+c+", "+d+")"}else{var e=$.Blockly.JavaScript.getAdjusted(a,"AT1");a=$.Blockly.JavaScript.getAdjusted(a,
|
||||||
"AT2");var f={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};b=$.Blockly.JavaScript.provideFunction_("subsequence"+f[c]+f[d],["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(sequence"+("FROM_END"===c||"FROM_START"===c?", at1":"")+("FROM_END"===d||"FROM_START"===d?", at2":"")+") {",module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",c,"at1")+";"," var end = "+module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",d,"at2")+" + 1;",
|
"AT2");var f={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};b=$.Blockly.JavaScript.provideFunction_("subsequence"+f[c]+f[d],"\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(sequence"+("FROM_END"===c||"FROM_START"===c?", at1":"")+("FROM_END"===d||"FROM_START"===d?", at2":"")+") {\n var start = "+module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",c,"at1")+";\n var end = "+module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",
|
||||||
" return sequence.slice(start, end);","}"])+"("+b+("FROM_END"===c||"FROM_START"===c?", "+e:"")+("FROM_END"===d||"FROM_START"===d?", "+a:"")+")"}return[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
d,"at2")+" + 1;\n return sequence.slice(start, end);\n}\n")+"("+b+("FROM_END"===c||"FROM_START"===c?", "+e:"")+("FROM_END"===d||"FROM_START"===d?", "+a:"")+")"}return[b,$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.lists_sort=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_FUNCTION_CALL)||"[]",c="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");var d=$.Blockly.JavaScript.provideFunction_("listsGetSortCompare",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(type, direction) {"," var compareFuncs = {",' "NUMERIC": function(a, b) {'," return Number(a) - Number(b); },",' "TEXT": function(a, b) {'," return a.toString() > b.toString() ? 1 : -1; },",
|
$.Blockly.JavaScript.lists_sort=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_FUNCTION_CALL)||"[]",c="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");var d=$.Blockly.JavaScript.provideFunction_("listsGetSortCompare","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(type, direction) {\n var compareFuncs = {\n 'NUMERIC': function(a, b) {\n return Number(a) - Number(b); },\n 'TEXT': function(a, b) {\n return a.toString() > b.toString() ? 1 : -1; },\n 'IGNORE_CASE': function(a, b) {\n return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },\n };\n var compare = compareFuncs[type];\n return function(a, b) { return compare(a, b) * direction; };\n}\n ");
|
||||||
' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];"," return function(a, b) { return compare(a, b) * direction; }","}"]);return[b+".slice().sort("+d+'("'+a+'", '+c+"))",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
return[b+".slice().sort("+d+'("'+a+'", '+c+"))",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};$.Blockly.JavaScript.lists_split=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"INPUT",$.Blockly.JavaScript.ORDER_MEMBER),c=$.Blockly.JavaScript.valueToCode(a,"DELIM",$.Blockly.JavaScript.ORDER_NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)b||(b="''"),a="split";else if("JOIN"===a)b||(b="[]"),a="join";else throw Error("Unknown mode: "+a);return[b+"."+a+"("+c+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.lists_split=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"INPUT",$.Blockly.JavaScript.ORDER_MEMBER),c=$.Blockly.JavaScript.valueToCode(a,"DELIM",$.Blockly.JavaScript.ORDER_NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)b||(b="''"),a="split";else if("JOIN"===a)b||(b="[]"),a="join";else throw Error("Unknown mode: "+a);return[b+"."+a+"("+c+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.lists_reverse=function(a){return[($.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$colour={};$.Blockly.JavaScript.colour_picker=function(a){return[$.Blockly.JavaScript.quote_(a.getFieldValue("COLOUR")),$.Blockly.JavaScript.ORDER_ATOMIC]};$.Blockly.JavaScript.colour_random=function(a){return[$.Blockly.JavaScript.provideFunction_("colourRandom","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"() {\n var num = Math.floor(Math.random() * Math.pow(2, 24));\n return '#' + ('00000' + num.toString(16)).substr(-6);\n}\n")+"()",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.JavaScript.lists_reverse=function(a){return[($.Blockly.JavaScript.valueToCode(a,"LIST",$.Blockly.JavaScript.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$colour={};$.Blockly.JavaScript.colour_picker=function(a){return[$.Blockly.JavaScript.quote_(a.getFieldValue("COLOUR")),$.Blockly.JavaScript.ORDER_ATOMIC]};$.Blockly.JavaScript.colour_random=function(a){return[$.Blockly.JavaScript.provideFunction_("colourRandom",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"() {"," var num = Math.floor(Math.random() * Math.pow(2, 24));"," return '#' + ('00000' + num.toString(16)).substr(-6);","}"])+"()",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.colour_rgb=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"RED",$.Blockly.JavaScript.ORDER_NONE)||0,c=$.Blockly.JavaScript.valueToCode(a,"GREEN",$.Blockly.JavaScript.ORDER_NONE)||0;a=$.Blockly.JavaScript.valueToCode(a,"BLUE",$.Blockly.JavaScript.ORDER_NONE)||0;return[$.Blockly.JavaScript.provideFunction_("colourRgb","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b) {\n r = Math.max(Math.min(Number(r), 100), 0) * 2.55;\n g = Math.max(Math.min(Number(g), 100), 0) * 2.55;\n b = Math.max(Math.min(Number(b), 100), 0) * 2.55;\n r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);\n g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);\n b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n")+
|
||||||
$.Blockly.JavaScript.colour_rgb=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"RED",$.Blockly.JavaScript.ORDER_NONE)||0,c=$.Blockly.JavaScript.valueToCode(a,"GREEN",$.Blockly.JavaScript.ORDER_NONE)||0;a=$.Blockly.JavaScript.valueToCode(a,"BLUE",$.Blockly.JavaScript.ORDER_NONE)||0;return[$.Blockly.JavaScript.provideFunction_("colourRgb",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b) {"," r = Math.max(Math.min(Number(r), 100), 0) * 2.55;"," g = Math.max(Math.min(Number(g), 100), 0) * 2.55;",
|
"("+b+", "+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
||||||
" b = Math.max(Math.min(Number(b), 100), 0) * 2.55;"," r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);"," g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);"," b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);"," return '#' + r + g + b;","}"])+"("+b+", "+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};
|
$.Blockly.JavaScript.colour_blend=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"COLOUR1",$.Blockly.JavaScript.ORDER_NONE)||"'#000000'",c=$.Blockly.JavaScript.valueToCode(a,"COLOUR2",$.Blockly.JavaScript.ORDER_NONE)||"'#000000'";a=$.Blockly.JavaScript.valueToCode(a,"RATIO",$.Blockly.JavaScript.ORDER_NONE)||.5;return[$.Blockly.JavaScript.provideFunction_("colourBlend","\nfunction "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(c1, c2, ratio) {\n ratio = Math.max(Math.min(Number(ratio), 1), 0);\n var r1 = parseInt(c1.substring(1, 3), 16);\n var g1 = parseInt(c1.substring(3, 5), 16);\n var b1 = parseInt(c1.substring(5, 7), 16);\n var r2 = parseInt(c2.substring(1, 3), 16);\n var g2 = parseInt(c2.substring(3, 5), 16);\n var b2 = parseInt(c2.substring(5, 7), 16);\n var r = Math.round(r1 * (1 - ratio) + r2 * ratio);\n var g = Math.round(g1 * (1 - ratio) + g2 * ratio);\n var b = Math.round(b1 * (1 - ratio) + b2 * ratio);\n r = ('0' + (r || 0).toString(16)).slice(-2);\n g = ('0' + (g || 0).toString(16)).slice(-2);\n b = ('0' + (b || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n")+
|
||||||
$.Blockly.JavaScript.colour_blend=function(a){var b=$.Blockly.JavaScript.valueToCode(a,"COLOUR1",$.Blockly.JavaScript.ORDER_NONE)||"'#000000'",c=$.Blockly.JavaScript.valueToCode(a,"COLOUR2",$.Blockly.JavaScript.ORDER_NONE)||"'#000000'";a=$.Blockly.JavaScript.valueToCode(a,"RATIO",$.Blockly.JavaScript.ORDER_NONE)||.5;return[$.Blockly.JavaScript.provideFunction_("colourBlend",["function "+$.Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(c1, c2, ratio) {"," ratio = Math.max(Math.min(Number(ratio), 1), 0);",
|
"("+b+", "+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$all={};
|
||||||
" var r1 = parseInt(c1.substring(1, 3), 16);"," var g1 = parseInt(c1.substring(3, 5), 16);"," var b1 = parseInt(c1.substring(5, 7), 16);"," var r2 = parseInt(c2.substring(1, 3), 16);"," var g2 = parseInt(c2.substring(3, 5), 16);"," var b2 = parseInt(c2.substring(5, 7), 16);"," var r = Math.round(r1 * (1 - ratio) + r2 * ratio);"," var g = Math.round(g1 * (1 - ratio) + g2 * ratio);"," var b = Math.round(b1 * (1 - ratio) + b2 * ratio);"," r = ('0' + (r || 0).toString(16)).slice(-2);"," g = ('0' + (g || 0).toString(16)).slice(-2);",
|
$.Blockly.JavaScript.__namespace__=$;
|
||||||
" b = ('0' + (b || 0).toString(16)).slice(-2);"," return '#' + r + g + b;","}"])+"("+b+", "+c+", "+a+")",$.Blockly.JavaScript.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$all={};
|
|
||||||
|
|
||||||
return $.Blockly.JavaScript;
|
return $.Blockly.JavaScript;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -192,9 +192,9 @@ Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_DIVIDE"] = "2 つの数の商を返しま
|
|||||||
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MINUS"] = "2 つの数の差を返します。";
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MINUS"] = "2 つの数の差を返します。";
|
||||||
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MULTIPLY"] = "2 つの数の積を返します。";
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MULTIPLY"] = "2 つの数の積を返します。";
|
||||||
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_POWER"] = "最初の数を2 番目の値で累乗した結果を返します。";
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_POWER"] = "最初の数を2 番目の値で累乗した結果を返します。";
|
||||||
Blockly.Msg["MATH_ATAN2_HELPURL"] = "https://en.wikipedia.org/wiki/Atan2";
|
Blockly.Msg["MATH_ATAN2_HELPURL"] = "https://ja.wikipedia.org/wiki/Atan2";
|
||||||
Blockly.Msg["MATH_ATAN2_TITLE"] = "X:%1 Y:%2のaran2";
|
Blockly.Msg["MATH_ATAN2_TITLE"] = "X:%1 Y:%2のatan2";
|
||||||
Blockly.Msg["MATH_ATAN2_TOOLTIP"] = "点 (X, Y) の逆関数を -180 度から 180度まで返します。";
|
Blockly.Msg["MATH_ATAN2_TOOLTIP"] = "アークタンジェントを用いて、点 (X, Y) の角度を -180度から 180度で返します。";
|
||||||
Blockly.Msg["MATH_CHANGE_HELPURL"] = "https://ja.wikipedia.org/wiki/加法";
|
Blockly.Msg["MATH_CHANGE_HELPURL"] = "https://ja.wikipedia.org/wiki/加法";
|
||||||
Blockly.Msg["MATH_CHANGE_TITLE"] = "%1 を %2 増やす";
|
Blockly.Msg["MATH_CHANGE_TITLE"] = "%1 を %2 増やす";
|
||||||
Blockly.Msg["MATH_CHANGE_TOOLTIP"] = "変数'%1'に数をたす。";
|
Blockly.Msg["MATH_CHANGE_TOOLTIP"] = "変数'%1'に数をたす。";
|
||||||
@ -212,7 +212,7 @@ Blockly.Msg["MATH_IS_POSITIVE"] = "は正";
|
|||||||
Blockly.Msg["MATH_IS_PRIME"] = "は素数";
|
Blockly.Msg["MATH_IS_PRIME"] = "は素数";
|
||||||
Blockly.Msg["MATH_IS_TOOLTIP"] = "数字が、偶数、奇数、素数、整数、正数、負数、または特定の数で割り切れるかどうかを判定し、true か false を返します。";
|
Blockly.Msg["MATH_IS_TOOLTIP"] = "数字が、偶数、奇数、素数、整数、正数、負数、または特定の数で割り切れるかどうかを判定し、true か false を返します。";
|
||||||
Blockly.Msg["MATH_IS_WHOLE"] = "は整数";
|
Blockly.Msg["MATH_IS_WHOLE"] = "は整数";
|
||||||
Blockly.Msg["MATH_MODULO_HELPURL"] = "https://en.wikipedia.org/wiki/Modulo_operation";
|
Blockly.Msg["MATH_MODULO_HELPURL"] = "https://ja.wikipedia.org/wiki/剰余演算";
|
||||||
Blockly.Msg["MATH_MODULO_TITLE"] = "%1÷%2の余り";
|
Blockly.Msg["MATH_MODULO_TITLE"] = "%1÷%2の余り";
|
||||||
Blockly.Msg["MATH_MODULO_TOOLTIP"] = "2つの数値の割り算の余りを返す。";
|
Blockly.Msg["MATH_MODULO_TOOLTIP"] = "2つの数値の割り算の余りを返す。";
|
||||||
Blockly.Msg["MATH_MULTIPLICATION_SYMBOL"] = "×";
|
Blockly.Msg["MATH_MULTIPLICATION_SYMBOL"] = "×";
|
||||||
@ -236,10 +236,10 @@ Blockly.Msg["MATH_ONLIST_TOOLTIP_RANDOM"] = "リストからランダムに選
|
|||||||
Blockly.Msg["MATH_ONLIST_TOOLTIP_STD_DEV"] = "リストの標準偏差を返す。";
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_STD_DEV"] = "リストの標準偏差を返す。";
|
||||||
Blockly.Msg["MATH_ONLIST_TOOLTIP_SUM"] = "リストの数値を足して返す。";
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_SUM"] = "リストの数値を足して返す。";
|
||||||
Blockly.Msg["MATH_POWER_SYMBOL"] = "^";
|
Blockly.Msg["MATH_POWER_SYMBOL"] = "^";
|
||||||
Blockly.Msg["MATH_RANDOM_FLOAT_HELPURL"] = "https://en.wikipedia.org/wiki/Random_number_generation";
|
Blockly.Msg["MATH_RANDOM_FLOAT_HELPURL"] = "https://ja.wikipedia.org/wiki/疑似乱数";
|
||||||
Blockly.Msg["MATH_RANDOM_FLOAT_TITLE_RANDOM"] = "1未満の正の乱数";
|
Blockly.Msg["MATH_RANDOM_FLOAT_TITLE_RANDOM"] = "1未満の正の乱数";
|
||||||
Blockly.Msg["MATH_RANDOM_FLOAT_TOOLTIP"] = "0.0以上で1.0未満の範囲の乱数を返します。";
|
Blockly.Msg["MATH_RANDOM_FLOAT_TOOLTIP"] = "0.0以上で1.0未満の範囲の乱数を返します。";
|
||||||
Blockly.Msg["MATH_RANDOM_INT_HELPURL"] = "https://en.wikipedia.org/wiki/Random_number_generation";
|
Blockly.Msg["MATH_RANDOM_INT_HELPURL"] = "https://ja.wikipedia.org/wiki/疑似乱数";
|
||||||
Blockly.Msg["MATH_RANDOM_INT_TITLE"] = "%1から%2までのランダムな整数";
|
Blockly.Msg["MATH_RANDOM_INT_TITLE"] = "%1から%2までのランダムな整数";
|
||||||
Blockly.Msg["MATH_RANDOM_INT_TOOLTIP"] = "指定された(上下限を含む)範囲のランダムな整数を返します。";
|
Blockly.Msg["MATH_RANDOM_INT_TOOLTIP"] = "指定された(上下限を含む)範囲のランダムな整数を返します。";
|
||||||
Blockly.Msg["MATH_ROUND_HELPURL"] = "https://ja.wikipedia.org/wiki/端数処理";
|
Blockly.Msg["MATH_ROUND_HELPURL"] = "https://ja.wikipedia.org/wiki/端数処理";
|
||||||
@ -333,7 +333,7 @@ Blockly.Msg["TEXT_CREATE_JOIN_TITLE_JOIN"] = "結合";
|
|||||||
Blockly.Msg["TEXT_CREATE_JOIN_TOOLTIP"] = "セクションを追加、削除、または順序変更して、ブロックを再構成。";
|
Blockly.Msg["TEXT_CREATE_JOIN_TOOLTIP"] = "セクションを追加、削除、または順序変更して、ブロックを再構成。";
|
||||||
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_END"] = "終了位置:後ろから";
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_END"] = "終了位置:後ろから";
|
||||||
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_START"] = "終了位置:";
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_START"] = "終了位置:";
|
||||||
Blockly.Msg["TEXT_GET_SUBSTRING_END_LAST"] = "最後のの文字";
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_LAST"] = "最後の文字";
|
||||||
Blockly.Msg["TEXT_GET_SUBSTRING_HELPURL"] = "https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text";
|
Blockly.Msg["TEXT_GET_SUBSTRING_HELPURL"] = "https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text";
|
||||||
Blockly.Msg["TEXT_GET_SUBSTRING_INPUT_IN_TEXT"] = "テキスト";
|
Blockly.Msg["TEXT_GET_SUBSTRING_INPUT_IN_TEXT"] = "テキスト";
|
||||||
Blockly.Msg["TEXT_GET_SUBSTRING_START_FIRST"] = "の部分文字列を取得;最初から";
|
Blockly.Msg["TEXT_GET_SUBSTRING_START_FIRST"] = "の部分文字列を取得;最初から";
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
"Suiato",
|
"Suiato",
|
||||||
"Sujiniku",
|
"Sujiniku",
|
||||||
"TAKAHASHI Shuuji",
|
"TAKAHASHI Shuuji",
|
||||||
|
"Tokoroten",
|
||||||
"しぃ",
|
"しぃ",
|
||||||
"ネイ",
|
"ネイ",
|
||||||
"아라"
|
"아라"
|
||||||
@ -104,19 +105,6 @@
|
|||||||
"CONTROLS_IF_IF_TOOLTIP": "追加、削除、またはセクションを順序変更して、ブロックをこれを再構成します。",
|
"CONTROLS_IF_IF_TOOLTIP": "追加、削除、またはセクションを順序変更して、ブロックをこれを再構成します。",
|
||||||
"CONTROLS_IF_ELSEIF_TOOLTIP": "「もしも」のブロックに条件を追加します。",
|
"CONTROLS_IF_ELSEIF_TOOLTIP": "「もしも」のブロックに条件を追加します。",
|
||||||
"CONTROLS_IF_ELSE_TOOLTIP": "Ifブロックに、すべてをキャッチする条件を追加。",
|
"CONTROLS_IF_ELSE_TOOLTIP": "Ifブロックに、すべてをキャッチする条件を追加。",
|
||||||
"IOS_OK": "OK",
|
|
||||||
"IOS_CANCEL": "キャンセル",
|
|
||||||
"IOS_ERROR": "エラー",
|
|
||||||
"IOS_PROCEDURES_INPUTS": "入力",
|
|
||||||
"IOS_PROCEDURES_ADD_INPUT": "+ 入力を追加",
|
|
||||||
"IOS_PROCEDURES_ALLOW_STATEMENTS": "ステートメントを許可",
|
|
||||||
"IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR": "この関数には重複する入力があります。",
|
|
||||||
"IOS_VARIABLES_ADD_VARIABLE": "+ 変数を追加",
|
|
||||||
"IOS_VARIABLES_ADD_BUTTON": "追加",
|
|
||||||
"IOS_VARIABLES_RENAME_BUTTON": "名前を変更",
|
|
||||||
"IOS_VARIABLES_DELETE_BUTTON": "削除",
|
|
||||||
"IOS_VARIABLES_VARIABLE_NAME": "変数名",
|
|
||||||
"IOS_VARIABLES_EMPTY_NAME_ERROR": "空の変数名は使用できません。",
|
|
||||||
"LOGIC_COMPARE_HELPURL": "https://ja.wikipedia.org/wiki/不等式",
|
"LOGIC_COMPARE_HELPURL": "https://ja.wikipedia.org/wiki/不等式",
|
||||||
"LOGIC_COMPARE_TOOLTIP_EQ": "両方の入力が互いに等しい場合に true を返します。",
|
"LOGIC_COMPARE_TOOLTIP_EQ": "両方の入力が互いに等しい場合に true を返します。",
|
||||||
"LOGIC_COMPARE_TOOLTIP_NEQ": "両方の入力が互いに等しくない場合に true を返します。",
|
"LOGIC_COMPARE_TOOLTIP_NEQ": "両方の入力が互いに等しくない場合に true を返します。",
|
||||||
@ -214,21 +202,21 @@
|
|||||||
"MATH_ONLIST_TOOLTIP_STD_DEV": "リストの標準偏差を返す。",
|
"MATH_ONLIST_TOOLTIP_STD_DEV": "リストの標準偏差を返す。",
|
||||||
"MATH_ONLIST_OPERATOR_RANDOM": "リストからランダムに選ばれた項目",
|
"MATH_ONLIST_OPERATOR_RANDOM": "リストからランダムに選ばれた項目",
|
||||||
"MATH_ONLIST_TOOLTIP_RANDOM": "リストからランダムに選ばれた要素を返す。",
|
"MATH_ONLIST_TOOLTIP_RANDOM": "リストからランダムに選ばれた要素を返す。",
|
||||||
"MATH_MODULO_HELPURL": "https://en.wikipedia.org/wiki/Modulo_operation",
|
"MATH_MODULO_HELPURL": "https://ja.wikipedia.org/wiki/剰余演算",
|
||||||
"MATH_MODULO_TITLE": "%1÷%2の余り",
|
"MATH_MODULO_TITLE": "%1÷%2の余り",
|
||||||
"MATH_MODULO_TOOLTIP": "2つの数値の割り算の余りを返す。",
|
"MATH_MODULO_TOOLTIP": "2つの数値の割り算の余りを返す。",
|
||||||
"MATH_CONSTRAIN_HELPURL": "https://en.wikipedia.org/wiki/Clamping_(graphics)",
|
"MATH_CONSTRAIN_HELPURL": "https://en.wikipedia.org/wiki/Clamping_(graphics)",
|
||||||
"MATH_CONSTRAIN_TITLE": "%1 を %2 以上 %3 以下の範囲に制限",
|
"MATH_CONSTRAIN_TITLE": "%1 を %2 以上 %3 以下の範囲に制限",
|
||||||
"MATH_CONSTRAIN_TOOLTIP": "指定した上限と下限の間に値を制限する(上限と下限の値を含む)。",
|
"MATH_CONSTRAIN_TOOLTIP": "指定した上限と下限の間に値を制限する(上限と下限の値を含む)。",
|
||||||
"MATH_RANDOM_INT_HELPURL": "https://en.wikipedia.org/wiki/Random_number_generation",
|
"MATH_RANDOM_INT_HELPURL": "https://ja.wikipedia.org/wiki/疑似乱数",
|
||||||
"MATH_RANDOM_INT_TITLE": "%1から%2までのランダムな整数",
|
"MATH_RANDOM_INT_TITLE": "%1から%2までのランダムな整数",
|
||||||
"MATH_RANDOM_INT_TOOLTIP": "指定された(上下限を含む)範囲のランダムな整数を返します。",
|
"MATH_RANDOM_INT_TOOLTIP": "指定された(上下限を含む)範囲のランダムな整数を返します。",
|
||||||
"MATH_RANDOM_FLOAT_HELPURL": "https://en.wikipedia.org/wiki/Random_number_generation",
|
"MATH_RANDOM_FLOAT_HELPURL": "https://ja.wikipedia.org/wiki/疑似乱数",
|
||||||
"MATH_RANDOM_FLOAT_TITLE_RANDOM": "1未満の正の乱数",
|
"MATH_RANDOM_FLOAT_TITLE_RANDOM": "1未満の正の乱数",
|
||||||
"MATH_RANDOM_FLOAT_TOOLTIP": "0.0以上で1.0未満の範囲の乱数を返します。",
|
"MATH_RANDOM_FLOAT_TOOLTIP": "0.0以上で1.0未満の範囲の乱数を返します。",
|
||||||
"MATH_ATAN2_HELPURL": "https://en.wikipedia.org/wiki/Atan2",
|
"MATH_ATAN2_HELPURL": "https://ja.wikipedia.org/wiki/Atan2",
|
||||||
"MATH_ATAN2_TITLE": "X:%1 Y:%2のaran2",
|
"MATH_ATAN2_TITLE": "X:%1 Y:%2のatan2",
|
||||||
"MATH_ATAN2_TOOLTIP": "点 (X, Y) の逆関数を -180 度から 180度まで返します。",
|
"MATH_ATAN2_TOOLTIP": "アークタンジェントを用いて、点 (X, Y) の角度を -180度から 180度で返します。",
|
||||||
"TEXT_TEXT_HELPURL": "https://ja.wikipedia.org/wiki/文字列",
|
"TEXT_TEXT_HELPURL": "https://ja.wikipedia.org/wiki/文字列",
|
||||||
"TEXT_TEXT_TOOLTIP": "文字、単語、または行のテキスト。",
|
"TEXT_TEXT_TOOLTIP": "文字、単語、または行のテキスト。",
|
||||||
"TEXT_JOIN_HELPURL": "https://github.com/google/blockly/wiki/Text#text-creation",
|
"TEXT_JOIN_HELPURL": "https://github.com/google/blockly/wiki/Text#text-creation",
|
||||||
@ -268,7 +256,7 @@
|
|||||||
"TEXT_GET_SUBSTRING_START_FIRST": "の部分文字列を取得;最初から",
|
"TEXT_GET_SUBSTRING_START_FIRST": "の部分文字列を取得;最初から",
|
||||||
"TEXT_GET_SUBSTRING_END_FROM_START": "終了位置:",
|
"TEXT_GET_SUBSTRING_END_FROM_START": "終了位置:",
|
||||||
"TEXT_GET_SUBSTRING_END_FROM_END": "終了位置:後ろから",
|
"TEXT_GET_SUBSTRING_END_FROM_END": "終了位置:後ろから",
|
||||||
"TEXT_GET_SUBSTRING_END_LAST": "最後のの文字",
|
"TEXT_GET_SUBSTRING_END_LAST": "最後の文字",
|
||||||
"TEXT_GET_SUBSTRING_TAIL": "",
|
"TEXT_GET_SUBSTRING_TAIL": "",
|
||||||
"TEXT_CHANGECASE_HELPURL": "https://github.com/google/blockly/wiki/Text#adjusting-text-case",
|
"TEXT_CHANGECASE_HELPURL": "https://github.com/google/blockly/wiki/Text#adjusting-text-case",
|
||||||
"TEXT_CHANGECASE_TOOLTIP": "別のケースに、テキストのコピーを返します。",
|
"TEXT_CHANGECASE_TOOLTIP": "別のケースに、テキストのコピーを返します。",
|
||||||
|
@ -7,10 +7,11 @@
|
|||||||
} else if (typeof exports === 'object') { // Node.js
|
} else if (typeof exports === 'object') { // Node.js
|
||||||
module.exports = factory(require("./blockly_compressed.js"));
|
module.exports = factory(require("./blockly_compressed.js"));
|
||||||
} else { // Browser
|
} else { // Browser
|
||||||
root.Blockly.Python = factory(root.Blockly);
|
var factoryExports = factory(root.Blockly);
|
||||||
|
root.Blockly.Python = factoryExports;
|
||||||
}
|
}
|
||||||
}(this, function(Blockly) {
|
}(this, function(__parent__) {
|
||||||
const $=Blockly.internal_;
|
var $=__parent__.__namespace__;
|
||||||
var module$contents$Blockly$Python_Python=new $.module$exports$Blockly$Generator.Generator("Python");module$contents$Blockly$Python_Python.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip");
|
var module$contents$Blockly$Python_Python=new $.module$exports$Blockly$Generator.Generator("Python");module$contents$Blockly$Python_Python.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip");
|
||||||
module$contents$Blockly$Python_Python.ORDER_ATOMIC=0;module$contents$Blockly$Python_Python.ORDER_COLLECTION=1;module$contents$Blockly$Python_Python.ORDER_STRING_CONVERSION=1;module$contents$Blockly$Python_Python.ORDER_MEMBER=2.1;module$contents$Blockly$Python_Python.ORDER_FUNCTION_CALL=2.2;module$contents$Blockly$Python_Python.ORDER_EXPONENTIATION=3;module$contents$Blockly$Python_Python.ORDER_UNARY_SIGN=4;module$contents$Blockly$Python_Python.ORDER_BITWISE_NOT=4;
|
module$contents$Blockly$Python_Python.ORDER_ATOMIC=0;module$contents$Blockly$Python_Python.ORDER_COLLECTION=1;module$contents$Blockly$Python_Python.ORDER_STRING_CONVERSION=1;module$contents$Blockly$Python_Python.ORDER_MEMBER=2.1;module$contents$Blockly$Python_Python.ORDER_FUNCTION_CALL=2.2;module$contents$Blockly$Python_Python.ORDER_EXPONENTIATION=3;module$contents$Blockly$Python_Python.ORDER_UNARY_SIGN=4;module$contents$Blockly$Python_Python.ORDER_BITWISE_NOT=4;
|
||||||
module$contents$Blockly$Python_Python.ORDER_MULTIPLICATIVE=5;module$contents$Blockly$Python_Python.ORDER_ADDITIVE=6;module$contents$Blockly$Python_Python.ORDER_BITWISE_SHIFT=7;module$contents$Blockly$Python_Python.ORDER_BITWISE_AND=8;module$contents$Blockly$Python_Python.ORDER_BITWISE_XOR=9;module$contents$Blockly$Python_Python.ORDER_BITWISE_OR=10;module$contents$Blockly$Python_Python.ORDER_RELATIONAL=11;module$contents$Blockly$Python_Python.ORDER_LOGICAL_NOT=12;
|
module$contents$Blockly$Python_Python.ORDER_MULTIPLICATIVE=5;module$contents$Blockly$Python_Python.ORDER_ADDITIVE=6;module$contents$Blockly$Python_Python.ORDER_BITWISE_SHIFT=7;module$contents$Blockly$Python_Python.ORDER_BITWISE_AND=8;module$contents$Blockly$Python_Python.ORDER_BITWISE_XOR=9;module$contents$Blockly$Python_Python.ORDER_BITWISE_OR=10;module$contents$Blockly$Python_Python.ORDER_RELATIONAL=11;module$contents$Blockly$Python_Python.ORDER_LOGICAL_NOT=12;
|
||||||
@ -30,12 +31,12 @@ $.Blockly.Python.text_append=function(a){var b=$.Blockly.Python.nameDB_.getName(
|
|||||||
$.Blockly.Python.text_isEmpty=function(a){return["not len("+($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"''")+")",$.Blockly.Python.ORDER_LOGICAL_NOT]};
|
$.Blockly.Python.text_isEmpty=function(a){return["not len("+($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"''")+")",$.Blockly.Python.ORDER_LOGICAL_NOT]};
|
||||||
$.Blockly.Python.text_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"find":"rfind",c=$.Blockly.Python.valueToCode(a,"FIND",$.Blockly.Python.ORDER_NONE)||"''";b=($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_MEMBER)||"''")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",$.Blockly.Python.ORDER_ADDITIVE]:[b,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.text_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"find":"rfind",c=$.Blockly.Python.valueToCode(a,"FIND",$.Blockly.Python.ORDER_NONE)||"''";b=($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_MEMBER)||"''")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?[b+" + 1",$.Blockly.Python.ORDER_ADDITIVE]:[b,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.text_charAt=function(a){var b=a.getFieldValue("WHERE")||"FROM_START",c=$.Blockly.Python.valueToCode(a,"VALUE","RANDOM"===b?$.Blockly.Python.ORDER_NONE:$.Blockly.Python.ORDER_MEMBER)||"''";switch(b){case "FIRST":return[c+"[0]",$.Blockly.Python.ORDER_MEMBER];case "LAST":return[c+"[-1]",$.Blockly.Python.ORDER_MEMBER];case "FROM_START":return a=$.Blockly.Python.getAdjustedInt(a,"AT"),[c+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];case "FROM_END":return a=$.Blockly.Python.getAdjustedInt(a,
|
$.Blockly.Python.text_charAt=function(a){var b=a.getFieldValue("WHERE")||"FROM_START",c=$.Blockly.Python.valueToCode(a,"VALUE","RANDOM"===b?$.Blockly.Python.ORDER_NONE:$.Blockly.Python.ORDER_MEMBER)||"''";switch(b){case "FIRST":return[c+"[0]",$.Blockly.Python.ORDER_MEMBER];case "LAST":return[c+"[-1]",$.Blockly.Python.ORDER_MEMBER];case "FROM_START":return a=$.Blockly.Python.getAdjustedInt(a,"AT"),[c+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];case "FROM_END":return a=$.Blockly.Python.getAdjustedInt(a,
|
||||||
"AT",1,!0),[c+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];case "RANDOM":return $.Blockly.Python.definitions_.import_random="import random",[$.Blockly.Python.provideFunction_("text_random_letter",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(text):"," x = int(random.random() * len(text))"," return text[x];"])+"("+c+")",$.Blockly.Python.ORDER_FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");};
|
"AT",1,!0),[c+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];case "RANDOM":return $.Blockly.Python.definitions_.import_random="import random",[$.Blockly.Python.provideFunction_("text_random_letter","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(text):\n x = int(random.random() * len(text))\n return text[x]\n")+"("+c+")",$.Blockly.Python.ORDER_FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");};
|
||||||
$.Blockly.Python.text_getSubstring=function(a){var b=a.getFieldValue("WHERE1"),c=a.getFieldValue("WHERE2"),d=$.Blockly.Python.valueToCode(a,"STRING",$.Blockly.Python.ORDER_MEMBER)||"''";switch(b){case "FROM_START":b=$.Blockly.Python.getAdjustedInt(a,"AT1");0===b&&(b="");break;case "FROM_END":b=$.Blockly.Python.getAdjustedInt(a,"AT1",1,!0);break;case "FIRST":b="";break;default:throw Error("Unhandled option (text_getSubstring)");}switch(c){case "FROM_START":a=$.Blockly.Python.getAdjustedInt(a,"AT2",
|
$.Blockly.Python.text_getSubstring=function(a){var b=a.getFieldValue("WHERE1"),c=a.getFieldValue("WHERE2"),d=$.Blockly.Python.valueToCode(a,"STRING",$.Blockly.Python.ORDER_MEMBER)||"''";switch(b){case "FROM_START":b=$.Blockly.Python.getAdjustedInt(a,"AT1");0===b&&(b="");break;case "FROM_END":b=$.Blockly.Python.getAdjustedInt(a,"AT1",1,!0);break;case "FIRST":b="";break;default:throw Error("Unhandled option (text_getSubstring)");}switch(c){case "FROM_START":a=$.Blockly.Python.getAdjustedInt(a,"AT2",
|
||||||
1);break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT2",0,!0);(0,$.module$exports$Blockly$utils$string.isNumber)(String(a))?0===a&&(a=""):($.Blockly.Python.definitions_.import_sys="import sys",a+=" or sys.maxsize");break;case "LAST":a="";break;default:throw Error("Unhandled option (text_getSubstring)");}return[d+"["+b+" : "+a+"]",$.Blockly.Python.ORDER_MEMBER]};
|
1);break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT2",0,!0);(0,$.module$exports$Blockly$utils$string.isNumber)(String(a))?0===a&&(a=""):($.Blockly.Python.definitions_.import_sys="import sys",a+=" or sys.maxsize");break;case "LAST":a="";break;default:throw Error("Unhandled option (text_getSubstring)");}return[d+"["+b+" : "+a+"]",$.Blockly.Python.ORDER_MEMBER]};
|
||||||
$.Blockly.Python.text_changeCase=function(a){var b={UPPERCASE:".upper()",LOWERCASE:".lower()",TITLECASE:".title()"}[a.getFieldValue("CASE")];return[($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''")+b,$.Blockly.Python.ORDER_FUNCTION_CALL]};$.Blockly.Python.text_trim=function(a){var b={LEFT:".lstrip()",RIGHT:".rstrip()",BOTH:".strip()"}[a.getFieldValue("MODE")];return[($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''")+b,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.text_changeCase=function(a){var b={UPPERCASE:".upper()",LOWERCASE:".lower()",TITLECASE:".title()"}[a.getFieldValue("CASE")];return[($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''")+b,$.Blockly.Python.ORDER_FUNCTION_CALL]};$.Blockly.Python.text_trim=function(a){var b={LEFT:".lstrip()",RIGHT:".rstrip()",BOTH:".strip()"}[a.getFieldValue("MODE")];return[($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''")+b,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.text_print=function(a){return"print("+($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_NONE)||"''")+")\n"};
|
$.Blockly.Python.text_print=function(a){return"print("+($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_NONE)||"''")+")\n"};
|
||||||
$.Blockly.Python.text_prompt_ext=function(a){var b=$.Blockly.Python.provideFunction_("text_prompt",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(msg):"," try:"," return raw_input(msg)"," except NameError:"," return input(msg)"]);var c=a.getField("TEXT")?$.Blockly.Python.quote_(a.getFieldValue("TEXT")):$.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_NONE)||"''";b=b+"("+c+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="float("+b+")");return[b,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.text_prompt_ext=function(a){var b=$.Blockly.Python.provideFunction_("text_prompt","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(msg):\n try:\n return raw_input(msg)\n except NameError:\n return input(msg)\n");var c=a.getField("TEXT")?$.Blockly.Python.quote_(a.getFieldValue("TEXT")):$.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_NONE)||"''";b=b+"("+c+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="float("+b+")");return[b,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.text_prompt=$.Blockly.Python.text_prompt_ext;$.Blockly.Python.text_count=function(a){var b=$.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''";a=$.Blockly.Python.valueToCode(a,"SUB",$.Blockly.Python.ORDER_NONE)||"''";return[b+".count("+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.text_prompt=$.Blockly.Python.text_prompt_ext;$.Blockly.Python.text_count=function(a){var b=$.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''";a=$.Blockly.Python.valueToCode(a,"SUB",$.Blockly.Python.ORDER_NONE)||"''";return[b+".count("+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.text_replace=function(a){var b=$.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''",c=$.Blockly.Python.valueToCode(a,"FROM",$.Blockly.Python.ORDER_NONE)||"''";a=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"''";return[b+".replace("+c+", "+a+")",$.Blockly.Python.ORDER_MEMBER]};$.Blockly.Python.text_reverse=function(a){return[($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''")+"[::-1]",$.Blockly.Python.ORDER_MEMBER]};var module$exports$Blockly$Python$procedures={};
|
$.Blockly.Python.text_replace=function(a){var b=$.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''",c=$.Blockly.Python.valueToCode(a,"FROM",$.Blockly.Python.ORDER_NONE)||"''";a=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"''";return[b+".replace("+c+", "+a+")",$.Blockly.Python.ORDER_MEMBER]};$.Blockly.Python.text_reverse=function(a){return[($.Blockly.Python.valueToCode(a,"TEXT",$.Blockly.Python.ORDER_MEMBER)||"''")+"[::-1]",$.Blockly.Python.ORDER_MEMBER]};var module$exports$Blockly$Python$procedures={};
|
||||||
$.Blockly.Python.procedures_defreturn=function(a){for(var b=[],c=a.workspace,d=(0,$.module$exports$Blockly$Variables.allUsedVarModels)(c)||[],e=0,f;f=d[e];e++)f=f.name,-1===a.getVars().indexOf(f)&&b.push($.Blockly.Python.nameDB_.getName(f,$.module$exports$Blockly$Names.NameType.VARIABLE));c=(0,$.module$exports$Blockly$Variables.allDeveloperVariables)(c);for(d=0;d<c.length;d++)b.push($.Blockly.Python.nameDB_.getName(c[d],$.module$exports$Blockly$Names.NameType.DEVELOPER_VARIABLE));c=b.length?$.Blockly.Python.INDENT+
|
$.Blockly.Python.procedures_defreturn=function(a){for(var b=[],c=a.workspace,d=(0,$.module$exports$Blockly$Variables.allUsedVarModels)(c)||[],e=0,f;f=d[e];e++)f=f.name,-1===a.getVars().indexOf(f)&&b.push($.Blockly.Python.nameDB_.getName(f,$.module$exports$Blockly$Names.NameType.VARIABLE));c=(0,$.module$exports$Blockly$Variables.allDeveloperVariables)(c);for(d=0;d<c.length;d++)b.push($.Blockly.Python.nameDB_.getName(c[d],$.module$exports$Blockly$Names.NameType.DEVELOPER_VARIABLE));c=b.length?$.Blockly.Python.INDENT+
|
||||||
@ -49,23 +50,23 @@ $.Blockly.Python.math_single=function(a){var b=a.getFieldValue("OP");if("NEG"===
|
|||||||
case "ROOT":c="math.sqrt("+a+")";break;case "LN":c="math.log("+a+")";break;case "LOG10":c="math.log10("+a+")";break;case "EXP":c="math.exp("+a+")";break;case "POW10":c="math.pow(10,"+a+")";break;case "ROUND":c="round("+a+")";break;case "ROUNDUP":c="math.ceil("+a+")";break;case "ROUNDDOWN":c="math.floor("+a+")";break;case "SIN":c="math.sin("+a+" / 180.0 * math.pi)";break;case "COS":c="math.cos("+a+" / 180.0 * math.pi)";break;case "TAN":c="math.tan("+a+" / 180.0 * math.pi)"}if(c)return[c,$.Blockly.Python.ORDER_FUNCTION_CALL];
|
case "ROOT":c="math.sqrt("+a+")";break;case "LN":c="math.log("+a+")";break;case "LOG10":c="math.log10("+a+")";break;case "EXP":c="math.exp("+a+")";break;case "POW10":c="math.pow(10,"+a+")";break;case "ROUND":c="round("+a+")";break;case "ROUNDUP":c="math.ceil("+a+")";break;case "ROUNDDOWN":c="math.floor("+a+")";break;case "SIN":c="math.sin("+a+" / 180.0 * math.pi)";break;case "COS":c="math.cos("+a+" / 180.0 * math.pi)";break;case "TAN":c="math.tan("+a+" / 180.0 * math.pi)"}if(c)return[c,$.Blockly.Python.ORDER_FUNCTION_CALL];
|
||||||
switch(b){case "ASIN":c="math.asin("+a+") / math.pi * 180";break;case "ACOS":c="math.acos("+a+") / math.pi * 180";break;case "ATAN":c="math.atan("+a+") / math.pi * 180";break;default:throw Error("Unknown math operator: "+b);}return[c,$.Blockly.Python.ORDER_MULTIPLICATIVE]};
|
switch(b){case "ASIN":c="math.asin("+a+") / math.pi * 180";break;case "ACOS":c="math.acos("+a+") / math.pi * 180";break;case "ATAN":c="math.atan("+a+") / math.pi * 180";break;default:throw Error("Unknown math operator: "+b);}return[c,$.Blockly.Python.ORDER_MULTIPLICATIVE]};
|
||||||
$.Blockly.Python.math_constant=function(a){var b={PI:["math.pi",$.Blockly.Python.ORDER_MEMBER],E:["math.e",$.Blockly.Python.ORDER_MEMBER],GOLDEN_RATIO:["(1 + math.sqrt(5)) / 2",$.Blockly.Python.ORDER_MULTIPLICATIVE],SQRT2:["math.sqrt(2)",$.Blockly.Python.ORDER_MEMBER],SQRT1_2:["math.sqrt(1.0 / 2)",$.Blockly.Python.ORDER_MEMBER],INFINITY:["float('inf')",$.Blockly.Python.ORDER_ATOMIC]};a=a.getFieldValue("CONSTANT");"INFINITY"!==a&&($.Blockly.Python.definitions_.import_math="import math");return b[a]};
|
$.Blockly.Python.math_constant=function(a){var b={PI:["math.pi",$.Blockly.Python.ORDER_MEMBER],E:["math.e",$.Blockly.Python.ORDER_MEMBER],GOLDEN_RATIO:["(1 + math.sqrt(5)) / 2",$.Blockly.Python.ORDER_MULTIPLICATIVE],SQRT2:["math.sqrt(2)",$.Blockly.Python.ORDER_MEMBER],SQRT1_2:["math.sqrt(1.0 / 2)",$.Blockly.Python.ORDER_MEMBER],INFINITY:["float('inf')",$.Blockly.Python.ORDER_ATOMIC]};a=a.getFieldValue("CONSTANT");"INFINITY"!==a&&($.Blockly.Python.definitions_.import_math="import math");return b[a]};
|
||||||
$.Blockly.Python.math_number_property=function(a){var b=$.Blockly.Python.valueToCode(a,"NUMBER_TO_CHECK",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0",c=a.getFieldValue("PROPERTY");if("PRIME"===c)return $.Blockly.Python.definitions_.import_math="import math",$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number",[$.Blockly.Python.provideFunction_("math_isPrime",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(n):"," # https://en.wikipedia.org/wiki/Primality_test#Naive_methods",
|
$.Blockly.Python.math_number_property=function(a){var b={EVEN:[" % 2 == 0",$.Blockly.Python.ORDER_MULTIPLICATIVE,$.Blockly.Python.ORDER_RELATIONAL],ODD:[" % 2 == 1",$.Blockly.Python.ORDER_MULTIPLICATIVE,$.Blockly.Python.ORDER_RELATIONAL],WHOLE:[" % 1 == 0",$.Blockly.Python.ORDER_MULTIPLICATIVE,$.Blockly.Python.ORDER_RELATIONAL],POSITIVE:[" > 0",$.Blockly.Python.ORDER_RELATIONAL,$.Blockly.Python.ORDER_RELATIONAL],NEGATIVE:[" < 0",$.Blockly.Python.ORDER_RELATIONAL,$.Blockly.Python.ORDER_RELATIONAL],
|
||||||
" # If n is not a number but a string, try parsing it."," if not isinstance(n, Number):"," try:"," n = float(n)"," except:"," return False"," if n == 2 or n == 3:"," return True"," # False if n is negative, is 1, or not whole, or if n is divisible by 2 or 3."," if n <= 1 or n % 1 != 0 or n % 2 == 0 or n % 3 == 0:"," return False"," # Check all the numbers of form 6k +/- 1, up to sqrt(n)."," for x in range(6, int(math.sqrt(n)) + 2, 6):"," if n % (x - 1) == 0 or n % (x + 1) == 0:",
|
DIVISIBLE_BY:[null,$.Blockly.Python.ORDER_MULTIPLICATIVE,$.Blockly.Python.ORDER_RELATIONAL],PRIME:[null,$.Blockly.Python.ORDER_NONE,$.Blockly.Python.ORDER_FUNCTION_CALL]},c=a.getFieldValue("PROPERTY");b=$.$jscomp.makeIterator(b[c]);var d=b.next().value,e=b.next().value;b=b.next().value;e=$.Blockly.Python.valueToCode(a,"NUMBER_TO_CHECK",e)||"0";if("PRIME"===c)$.Blockly.Python.definitions_.import_math="import math",$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number",
|
||||||
" return False"," return True"])+"("+b+")",$.Blockly.Python.ORDER_FUNCTION_CALL];switch(c){case "EVEN":var d=b+" % 2 == 0";break;case "ODD":d=b+" % 2 == 1";break;case "WHOLE":d=b+" % 1 == 0";break;case "POSITIVE":d=b+" > 0";break;case "NEGATIVE":d=b+" < 0";break;case "DIVISIBLE_BY":a=$.Blockly.Python.valueToCode(a,"DIVISOR",$.Blockly.Python.ORDER_MULTIPLICATIVE);if(!a||"0"===a)return["False",$.Blockly.Python.ORDER_ATOMIC];d=b+" % "+a+" == 0"}return[d,$.Blockly.Python.ORDER_RELATIONAL]};
|
a=$.Blockly.Python.provideFunction_("math_isPrime","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(n):\n # https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n # If n is not a number but a string, try parsing it.\n if not isinstance(n, Number):\n try:\n n = float(n)\n except:\n return False\n if n == 2 or n == 3:\n return True\n # False if n is negative, is 1, or not whole, or if n is divisible by 2 or 3.\n if n <= 1 or n % 1 != 0 or n % 2 == 0 or n % 3 == 0:\n return False\n # Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for x in range(6, int(math.sqrt(n)) + 2, 6):\n if n % (x - 1) == 0 or n % (x + 1) == 0:\n return False\n return True\n")+
|
||||||
|
"("+e+")";else if("DIVISIBLE_BY"===c){a=$.Blockly.Python.valueToCode(a,"DIVISOR",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0";if("0"===a)return["False",$.Blockly.Python.ORDER_ATOMIC];a=e+" % "+a+" == 0"}else a=e+d;return[a,b]};
|
||||||
$.Blockly.Python.math_change=function(a){$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number";var b=$.Blockly.Python.valueToCode(a,"DELTA",$.Blockly.Python.ORDER_ADDITIVE)||"0";a=$.Blockly.Python.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE);return a+" = ("+a+" if isinstance("+a+", Number) else 0) + "+b+"\n"};$.Blockly.Python.math_round=$.Blockly.Python.math_single;$.Blockly.Python.math_trig=$.Blockly.Python.math_single;
|
$.Blockly.Python.math_change=function(a){$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number";var b=$.Blockly.Python.valueToCode(a,"DELTA",$.Blockly.Python.ORDER_ADDITIVE)||"0";a=$.Blockly.Python.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE);return a+" = ("+a+" if isinstance("+a+", Number) else 0) + "+b+"\n"};$.Blockly.Python.math_round=$.Blockly.Python.math_single;$.Blockly.Python.math_trig=$.Blockly.Python.math_single;
|
||||||
$.Blockly.Python.math_on_list=function(a){var b=a.getFieldValue("OP");a=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_NONE)||"[]";switch(b){case "SUM":b="sum("+a+")";break;case "MIN":b="min("+a+")";break;case "MAX":b="max("+a+")";break;case "AVERAGE":$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number";b=$.Blockly.Python.provideFunction_("math_mean",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = [e for e in myList if isinstance(e, Number)]",
|
$.Blockly.Python.math_on_list=function(a){var b=a.getFieldValue("OP");a=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_NONE)||"[]";switch(b){case "SUM":b="sum("+a+")";break;case "MIN":b="min("+a+")";break;case "MAX":b="max("+a+")";break;case "AVERAGE":$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number";b=$.Blockly.Python.provideFunction_("math_mean","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(myList):\n localList = [e for e in myList if isinstance(e, Number)]\n if not localList: return\n return float(sum(localList)) / len(localList)\n")+
|
||||||
" if not localList: return"," return float(sum(localList)) / len(localList)"])+"("+a+")";break;case "MEDIAN":$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number";b=$.Blockly.Python.provideFunction_("math_median",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = sorted([e for e in myList if isinstance(e, Number)])"," if not localList: return"," if len(localList) % 2 == 0:"," return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0",
|
"("+a+")";break;case "MEDIAN":$.Blockly.Python.definitions_.from_numbers_import_Number="from numbers import Number";b=$.Blockly.Python.provideFunction_("math_median","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(myList):\n localList = sorted([e for e in myList if isinstance(e, Number)])\n if not localList: return\n if len(localList) % 2 == 0:\n return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0\n else:\n return localList[(len(localList) - 1) // 2]\n")+
|
||||||
" else:"," return localList[(len(localList) - 1) // 2]"])+"("+a+")";break;case "MODE":b=$.Blockly.Python.provideFunction_("math_modes",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(some_list):"," modes = []"," # Using a lists of [item, count] to keep count rather than dict",' # to avoid "unhashable" errors when the counted item is itself a list or dict.'," counts = []"," maxCount = 1"," for item in some_list:"," found = False"," for count in counts:"," if count[0] == item:",
|
"("+a+")";break;case "MODE":b=$.Blockly.Python.provideFunction_("math_modes","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+'(some_list):\n modes = []\n # Using a lists of [item, count] to keep count rather than dict\n # to avoid "unhashable" errors when the counted item is itself a list or dict.\n counts = []\n maxCount = 1\n for item in some_list:\n found = False\n for count in counts:\n if count[0] == item:\n count[1] += 1\n maxCount = max(maxCount, count[1])\n found = True\n if not found:\n counts.append([item, 1])\n for counted_item, item_count in counts:\n if item_count == maxCount:\n modes.append(counted_item)\n return modes\n')+
|
||||||
" count[1] += 1"," maxCount = max(maxCount, count[1])"," found = True"," if not found:"," counts.append([item, 1])"," for counted_item, item_count in counts:"," if item_count == maxCount:"," modes.append(counted_item)"," return modes"])+"("+a+")";break;case "STD_DEV":$.Blockly.Python.definitions_.import_math="import math";b=$.Blockly.Python.provideFunction_("math_standard_deviation",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(numbers):"," n = len(numbers)",
|
"("+a+")";break;case "STD_DEV":$.Blockly.Python.definitions_.import_math="import math";b=$.Blockly.Python.provideFunction_("math_standard_deviation","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(numbers):\n n = len(numbers)\n if n == 0: return\n mean = float(sum(numbers)) / n\n variance = sum((x - mean) ** 2 for x in numbers) / n\n return math.sqrt(variance)\n")+"("+a+")";break;case "RANDOM":$.Blockly.Python.definitions_.import_random="import random";b="random.choice("+a+")";break;default:throw Error("Unknown operator: "+
|
||||||
" if n == 0: return"," mean = float(sum(numbers)) / n"," variance = sum((x - mean) ** 2 for x in numbers) / n"," return math.sqrt(variance)"])+"("+a+")";break;case "RANDOM":$.Blockly.Python.definitions_.import_random="import random";b="random.choice("+a+")";break;default:throw Error("Unknown operator: "+b);}return[b,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
b);}return[b,$.Blockly.Python.ORDER_FUNCTION_CALL]};$.Blockly.Python.math_modulo=function(a){var b=$.Blockly.Python.valueToCode(a,"DIVIDEND",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0";a=$.Blockly.Python.valueToCode(a,"DIVISOR",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0";return[b+" % "+a,$.Blockly.Python.ORDER_MULTIPLICATIVE]};
|
||||||
$.Blockly.Python.math_modulo=function(a){var b=$.Blockly.Python.valueToCode(a,"DIVIDEND",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0";a=$.Blockly.Python.valueToCode(a,"DIVISOR",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0";return[b+" % "+a,$.Blockly.Python.ORDER_MULTIPLICATIVE]};
|
|
||||||
$.Blockly.Python.math_constrain=function(a){var b=$.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"0",c=$.Blockly.Python.valueToCode(a,"LOW",$.Blockly.Python.ORDER_NONE)||"0";a=$.Blockly.Python.valueToCode(a,"HIGH",$.Blockly.Python.ORDER_NONE)||"float('inf')";return["min(max("+b+", "+c+"), "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.math_constrain=function(a){var b=$.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"0",c=$.Blockly.Python.valueToCode(a,"LOW",$.Blockly.Python.ORDER_NONE)||"0";a=$.Blockly.Python.valueToCode(a,"HIGH",$.Blockly.Python.ORDER_NONE)||"float('inf')";return["min(max("+b+", "+c+"), "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.math_random_int=function(a){$.Blockly.Python.definitions_.import_random="import random";var b=$.Blockly.Python.valueToCode(a,"FROM",$.Blockly.Python.ORDER_NONE)||"0";a=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"0";return["random.randint("+b+", "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};$.Blockly.Python.math_random_float=function(a){$.Blockly.Python.definitions_.import_random="import random";return["random.random()",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.math_random_int=function(a){$.Blockly.Python.definitions_.import_random="import random";var b=$.Blockly.Python.valueToCode(a,"FROM",$.Blockly.Python.ORDER_NONE)||"0";a=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"0";return["random.randint("+b+", "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};$.Blockly.Python.math_random_float=function(a){$.Blockly.Python.definitions_.import_random="import random";return["random.random()",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.math_atan2=function(a){$.Blockly.Python.definitions_.import_math="import math";var b=$.Blockly.Python.valueToCode(a,"X",$.Blockly.Python.ORDER_NONE)||"0";return["math.atan2("+($.Blockly.Python.valueToCode(a,"Y",$.Blockly.Python.ORDER_NONE)||"0")+", "+b+") / math.pi * 180",$.Blockly.Python.ORDER_MULTIPLICATIVE]};var module$exports$Blockly$Python$loops={};
|
$.Blockly.Python.math_atan2=function(a){$.Blockly.Python.definitions_.import_math="import math";var b=$.Blockly.Python.valueToCode(a,"X",$.Blockly.Python.ORDER_NONE)||"0";return["math.atan2("+($.Blockly.Python.valueToCode(a,"Y",$.Blockly.Python.ORDER_NONE)||"0")+", "+b+") / math.pi * 180",$.Blockly.Python.ORDER_MULTIPLICATIVE]};var module$exports$Blockly$Python$loops={};
|
||||||
$.Blockly.Python.controls_repeat_ext=function(a){var b=a.getField("TIMES")?String(parseInt(a.getFieldValue("TIMES"),10)):$.Blockly.Python.valueToCode(a,"TIMES",$.Blockly.Python.ORDER_NONE)||"0";b=(0,$.module$exports$Blockly$utils$string.isNumber)(b)?parseInt(b,10):"int("+b+")";var c=$.Blockly.Python.statementToCode(a,"DO");c=$.Blockly.Python.addLoopTrap(c,a)||$.Blockly.Python.PASS;return"for "+$.Blockly.Python.nameDB_.getDistinctName("count",$.module$exports$Blockly$Names.NameType.VARIABLE)+" in range("+
|
$.Blockly.Python.controls_repeat_ext=function(a){var b=a.getField("TIMES")?String(parseInt(a.getFieldValue("TIMES"),10)):$.Blockly.Python.valueToCode(a,"TIMES",$.Blockly.Python.ORDER_NONE)||"0";b=(0,$.module$exports$Blockly$utils$string.isNumber)(b)?parseInt(b,10):"int("+b+")";var c=$.Blockly.Python.statementToCode(a,"DO");c=$.Blockly.Python.addLoopTrap(c,a)||$.Blockly.Python.PASS;return"for "+$.Blockly.Python.nameDB_.getDistinctName("count",$.module$exports$Blockly$Names.NameType.VARIABLE)+" in range("+
|
||||||
b+"):\n"+c};$.Blockly.Python.controls_repeat=$.Blockly.Python.controls_repeat_ext;$.Blockly.Python.controls_whileUntil=function(a){var b="UNTIL"===a.getFieldValue("MODE"),c=$.Blockly.Python.valueToCode(a,"BOOL",b?$.Blockly.Python.ORDER_LOGICAL_NOT:$.Blockly.Python.ORDER_NONE)||"False",d=$.Blockly.Python.statementToCode(a,"DO");d=$.Blockly.Python.addLoopTrap(d,a)||$.Blockly.Python.PASS;b&&(c="not "+c);return"while "+c+":\n"+d};
|
b+"):\n"+c};$.Blockly.Python.controls_repeat=$.Blockly.Python.controls_repeat_ext;$.Blockly.Python.controls_whileUntil=function(a){var b="UNTIL"===a.getFieldValue("MODE"),c=$.Blockly.Python.valueToCode(a,"BOOL",b?$.Blockly.Python.ORDER_LOGICAL_NOT:$.Blockly.Python.ORDER_NONE)||"False",d=$.Blockly.Python.statementToCode(a,"DO");d=$.Blockly.Python.addLoopTrap(d,a)||$.Blockly.Python.PASS;b&&(c="not "+c);return"while "+c+":\n"+d};
|
||||||
$.Blockly.Python.controls_for=function(a){var b=$.Blockly.Python.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE),c=$.Blockly.Python.valueToCode(a,"FROM",$.Blockly.Python.ORDER_NONE)||"0",d=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"0",e=$.Blockly.Python.valueToCode(a,"BY",$.Blockly.Python.ORDER_NONE)||"1",f=$.Blockly.Python.statementToCode(a,"DO");f=$.Blockly.Python.addLoopTrap(f,a)||$.Blockly.Python.PASS;var g="";a=function(){return $.Blockly.Python.provideFunction_("upRange",
|
$.Blockly.Python.controls_for=function(a){var b=$.Blockly.Python.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE),c=$.Blockly.Python.valueToCode(a,"FROM",$.Blockly.Python.ORDER_NONE)||"0",d=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"0",e=$.Blockly.Python.valueToCode(a,"BY",$.Blockly.Python.ORDER_NONE)||"1",f=$.Blockly.Python.statementToCode(a,"DO");f=$.Blockly.Python.addLoopTrap(f,a)||$.Blockly.Python.PASS;var g="";a=function(){return $.Blockly.Python.provideFunction_("upRange",
|
||||||
["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start <= stop:"," yield start"," start += abs(step)"])};var h=function(){return $.Blockly.Python.provideFunction_("downRange",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start >= stop:"," yield start"," start -= abs(step)"])};if((0,$.module$exports$Blockly$utils$string.isNumber)(c)&&(0,$.module$exports$Blockly$utils$string.isNumber)(d)&&(0,$.module$exports$Blockly$utils$string.isNumber)(e))c=
|
"\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):\n while start <= stop:\n yield start\n start += abs(step)\n")};var h=function(){return $.Blockly.Python.provideFunction_("downRange","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):\n while start >= stop:\n yield start\n start -= abs(step)\n")};if((0,$.module$exports$Blockly$utils$string.isNumber)(c)&&(0,$.module$exports$Blockly$utils$string.isNumber)(d)&&(0,$.module$exports$Blockly$utils$string.isNumber)(e))c=
|
||||||
Number(c),d=Number(d),e=Math.abs(Number(e)),0===c%1&&0===d%1&&0===e%1?(c<=d?(d++,a=0===c&&1===e?d:c+", "+d,1!==e&&(a+=", "+e)):(d--,a=c+", "+d+", -"+e),a="range("+a+")"):(a=c<d?a():h(),a+="("+c+", "+d+", "+e+")");else{var k=function(l,m){(0,$.module$exports$Blockly$utils$string.isNumber)(l)?l=Number(l):l.match(/^\w+$/)?l="float("+l+")":(m=$.Blockly.Python.nameDB_.getDistinctName(b+m,$.module$exports$Blockly$Names.NameType.VARIABLE),g+=m+" = float("+l+")\n",l=m);return l};c=k(c,"_start");d=k(d,"_end");
|
Number(c),d=Number(d),e=Math.abs(Number(e)),0===c%1&&0===d%1&&0===e%1?(c<=d?(d++,a=0===c&&1===e?d:c+", "+d,1!==e&&(a+=", "+e)):(d--,a=c+", "+d+", -"+e),a="range("+a+")"):(a=c<d?a():h(),a+="("+c+", "+d+", "+e+")");else{var k=function(l,m){(0,$.module$exports$Blockly$utils$string.isNumber)(l)?l=Number(l):l.match(/^\w+$/)?l="float("+l+")":(m=$.Blockly.Python.nameDB_.getDistinctName(b+m,$.module$exports$Blockly$Names.NameType.VARIABLE),g+=m+" = float("+l+")\n",l=m);return l};c=k(c,"_start");d=k(d,"_end");
|
||||||
e=k(e,"_inc");"number"===typeof c&&"number"===typeof d?(a=c<d?a():h(),a+="("+c+", "+d+", "+e+")"):a="("+c+" <= "+d+") and "+a()+"("+c+", "+d+", "+e+") or "+h()+"("+c+", "+d+", "+e+")"}return g+="for "+b+" in "+a+":\n"+f};
|
e=k(e,"_inc");"number"===typeof c&&"number"===typeof d?(a=c<d?a():h(),a+="("+c+", "+d+", "+e+")"):a="("+c+" <= "+d+") and "+a()+"("+c+", "+d+", "+e+") or "+h()+"("+c+", "+d+", "+e+")"}return g+="for "+b+" in "+a+":\n"+f};
|
||||||
$.Blockly.Python.controls_forEach=function(a){var b=$.Blockly.Python.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE),c=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_RELATIONAL)||"[]",d=$.Blockly.Python.statementToCode(a,"DO");d=$.Blockly.Python.addLoopTrap(d,a)||$.Blockly.Python.PASS;return"for "+b+" in "+c+":\n"+d};
|
$.Blockly.Python.controls_forEach=function(a){var b=$.Blockly.Python.nameDB_.getName(a.getFieldValue("VAR"),$.module$exports$Blockly$Names.NameType.VARIABLE),c=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_RELATIONAL)||"[]",d=$.Blockly.Python.statementToCode(a,"DO");d=$.Blockly.Python.addLoopTrap(d,a)||$.Blockly.Python.PASS;return"for "+b+" in "+c+":\n"+d};
|
||||||
@ -79,26 +80,26 @@ $.Blockly.Python.logic_boolean=function(a){return["TRUE"===a.getFieldValue("BOOL
|
|||||||
$.Blockly.Python.logic_ternary=function(a){var b=$.Blockly.Python.valueToCode(a,"IF",$.Blockly.Python.ORDER_CONDITIONAL)||"False",c=$.Blockly.Python.valueToCode(a,"THEN",$.Blockly.Python.ORDER_CONDITIONAL)||"None";a=$.Blockly.Python.valueToCode(a,"ELSE",$.Blockly.Python.ORDER_CONDITIONAL)||"None";return[c+" if "+b+" else "+a,$.Blockly.Python.ORDER_CONDITIONAL]};var module$exports$Blockly$Python$lists={};$.Blockly.Python.lists_create_empty=function(a){return["[]",$.Blockly.Python.ORDER_ATOMIC]};$.Blockly.Python.lists_create_with=function(a){for(var b=Array(a.itemCount_),c=0;c<a.itemCount_;c++)b[c]=$.Blockly.Python.valueToCode(a,"ADD"+c,$.Blockly.Python.ORDER_NONE)||"None";return["["+b.join(", ")+"]",$.Blockly.Python.ORDER_ATOMIC]};
|
$.Blockly.Python.logic_ternary=function(a){var b=$.Blockly.Python.valueToCode(a,"IF",$.Blockly.Python.ORDER_CONDITIONAL)||"False",c=$.Blockly.Python.valueToCode(a,"THEN",$.Blockly.Python.ORDER_CONDITIONAL)||"None";a=$.Blockly.Python.valueToCode(a,"ELSE",$.Blockly.Python.ORDER_CONDITIONAL)||"None";return[c+" if "+b+" else "+a,$.Blockly.Python.ORDER_CONDITIONAL]};var module$exports$Blockly$Python$lists={};$.Blockly.Python.lists_create_empty=function(a){return["[]",$.Blockly.Python.ORDER_ATOMIC]};$.Blockly.Python.lists_create_with=function(a){for(var b=Array(a.itemCount_),c=0;c<a.itemCount_;c++)b[c]=$.Blockly.Python.valueToCode(a,"ADD"+c,$.Blockly.Python.ORDER_NONE)||"None";return["["+b.join(", ")+"]",$.Blockly.Python.ORDER_ATOMIC]};
|
||||||
$.Blockly.Python.lists_repeat=function(a){var b=$.Blockly.Python.valueToCode(a,"ITEM",$.Blockly.Python.ORDER_NONE)||"None";a=$.Blockly.Python.valueToCode(a,"NUM",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0";return["["+b+"] * "+a,$.Blockly.Python.ORDER_MULTIPLICATIVE]};$.Blockly.Python.lists_length=function(a){return["len("+($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"[]")+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.lists_repeat=function(a){var b=$.Blockly.Python.valueToCode(a,"ITEM",$.Blockly.Python.ORDER_NONE)||"None";a=$.Blockly.Python.valueToCode(a,"NUM",$.Blockly.Python.ORDER_MULTIPLICATIVE)||"0";return["["+b+"] * "+a,$.Blockly.Python.ORDER_MULTIPLICATIVE]};$.Blockly.Python.lists_length=function(a){return["len("+($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"[]")+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.lists_isEmpty=function(a){return["not len("+($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"[]")+")",$.Blockly.Python.ORDER_LOGICAL_NOT]};
|
$.Blockly.Python.lists_isEmpty=function(a){return["not len("+($.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"[]")+")",$.Blockly.Python.ORDER_LOGICAL_NOT]};
|
||||||
$.Blockly.Python.lists_indexOf=function(a){var b=$.Blockly.Python.valueToCode(a,"FIND",$.Blockly.Python.ORDER_NONE)||"[]",c=$.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"''",d=" -1",e="",f=" - 1";a.workspace.options.oneBasedIndex&&(d=" 0",e=" + 1",f="");return"FIRST"===a.getFieldValue("END")?[$.Blockly.Python.provideFunction_("first_index",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(my_list, elem):"," try: index = my_list.index(elem)"+e," except: index ="+d," return index"])+
|
$.Blockly.Python.lists_indexOf=function(a){var b=$.Blockly.Python.valueToCode(a,"FIND",$.Blockly.Python.ORDER_NONE)||"[]",c=$.Blockly.Python.valueToCode(a,"VALUE",$.Blockly.Python.ORDER_NONE)||"''",d=" -1",e="",f=" - 1";a.workspace.options.oneBasedIndex&&(d=" 0",e=" + 1",f="");return[("FIRST"===a.getFieldValue("END")?$.Blockly.Python.provideFunction_("first_index","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(my_list, elem):\n try: index = my_list.index(elem)"+e+"\n except: index ="+d+
|
||||||
"("+c+", "+b+")",$.Blockly.Python.ORDER_FUNCTION_CALL]:[$.Blockly.Python.provideFunction_("last_index",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(my_list, elem):"," try: index = len(my_list) - my_list[::-1].index(elem)"+f," except: index ="+d," return index"])+"("+c+", "+b+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
"\n return index\n"):$.Blockly.Python.provideFunction_("last_index","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(my_list, elem):\n try: index = len(my_list) - my_list[::-1].index(elem)"+f+"\n except: index ="+d+"\n return index\n"))+"("+c+", "+b+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.lists_getIndex=function(a){var b=a.getFieldValue("MODE")||"GET",c=a.getFieldValue("WHERE")||"FROM_START",d=$.Blockly.Python.valueToCode(a,"VALUE","RANDOM"===c?$.Blockly.Python.ORDER_NONE:$.Blockly.Python.ORDER_MEMBER)||"[]";switch(c){case "FIRST":if("GET"===b)return[d+"[0]",$.Blockly.Python.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop(0)",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop(0)\n";break;case "LAST":if("GET"===b)return[d+"[-1]",$.Blockly.Python.ORDER_MEMBER];
|
$.Blockly.Python.lists_getIndex=function(a){var b=a.getFieldValue("MODE")||"GET",c=a.getFieldValue("WHERE")||"FROM_START",d=$.Blockly.Python.valueToCode(a,"VALUE","RANDOM"===c?$.Blockly.Python.ORDER_NONE:$.Blockly.Python.ORDER_MEMBER)||"[]";switch(c){case "FIRST":if("GET"===b)return[d+"[0]",$.Blockly.Python.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop(0)",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop(0)\n";break;case "LAST":if("GET"===b)return[d+"[-1]",$.Blockly.Python.ORDER_MEMBER];
|
||||||
if("GET_REMOVE"===b)return[d+".pop()",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop()\n";break;case "FROM_START":a=$.Blockly.Python.getAdjustedInt(a,"AT");if("GET"===b)return[d+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop("+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop("+a+")\n";break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT",1,!0);if("GET"===b)return[d+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];if("GET_REMOVE"===
|
if("GET_REMOVE"===b)return[d+".pop()",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop()\n";break;case "FROM_START":a=$.Blockly.Python.getAdjustedInt(a,"AT");if("GET"===b)return[d+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop("+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop("+a+")\n";break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT",1,!0);if("GET"===b)return[d+"["+a+"]",$.Blockly.Python.ORDER_MEMBER];if("GET_REMOVE"===
|
||||||
b)return[d+".pop("+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop("+a+")\n";break;case "RANDOM":$.Blockly.Python.definitions_.import_random="import random";if("GET"===b)return["random.choice("+d+")",$.Blockly.Python.ORDER_FUNCTION_CALL];d=$.Blockly.Python.provideFunction_("lists_remove_random_item",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," x = int(random.random() * len(myList))"," return myList.pop(x)"])+"("+d+")";if("GET_REMOVE"===b)return[d,
|
b)return[d+".pop("+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".pop("+a+")\n";break;case "RANDOM":$.Blockly.Python.definitions_.import_random="import random";if("GET"===b)return["random.choice("+d+")",$.Blockly.Python.ORDER_FUNCTION_CALL];d=$.Blockly.Python.provideFunction_("lists_remove_random_item","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(myList):\n x = int(random.random() * len(myList))\n return myList.pop(x)\n")+"("+d+")";if("GET_REMOVE"===b)return[d,
|
||||||
$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+"\n"}throw Error("Unhandled combination (lists_getIndex).");};
|
$.Blockly.Python.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+"\n"}throw Error("Unhandled combination (lists_getIndex).");};
|
||||||
$.Blockly.Python.lists_setIndex=function(a){var b=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_MEMBER)||"[]",c=a.getFieldValue("MODE")||"GET",d=a.getFieldValue("WHERE")||"FROM_START",e=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"None";switch(d){case "FIRST":if("SET"===c)return b+"[0] = "+e+"\n";if("INSERT"===c)return b+".insert(0, "+e+")\n";break;case "LAST":if("SET"===c)return b+"[-1] = "+e+"\n";if("INSERT"===c)return b+".append("+e+")\n";break;case "FROM_START":a=
|
$.Blockly.Python.lists_setIndex=function(a){var b=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_MEMBER)||"[]",c=a.getFieldValue("MODE")||"GET",d=a.getFieldValue("WHERE")||"FROM_START",e=$.Blockly.Python.valueToCode(a,"TO",$.Blockly.Python.ORDER_NONE)||"None";switch(d){case "FIRST":if("SET"===c)return b+"[0] = "+e+"\n";if("INSERT"===c)return b+".insert(0, "+e+")\n";break;case "LAST":if("SET"===c)return b+"[-1] = "+e+"\n";if("INSERT"===c)return b+".append("+e+")\n";break;case "FROM_START":a=
|
||||||
$.Blockly.Python.getAdjustedInt(a,"AT");if("SET"===c)return b+"["+a+"] = "+e+"\n";if("INSERT"===c)return b+".insert("+a+", "+e+")\n";break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT",1,!0);if("SET"===c)return b+"["+a+"] = "+e+"\n";if("INSERT"===c)return b+".insert("+a+", "+e+")\n";break;case "RANDOM":$.Blockly.Python.definitions_.import_random="import random";b.match(/^\w+$/)?a="":(a=$.Blockly.Python.nameDB_.getDistinctName("tmp_list",$.module$exports$Blockly$Names.NameType.VARIABLE),
|
$.Blockly.Python.getAdjustedInt(a,"AT");if("SET"===c)return b+"["+a+"] = "+e+"\n";if("INSERT"===c)return b+".insert("+a+", "+e+")\n";break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT",1,!0);if("SET"===c)return b+"["+a+"] = "+e+"\n";if("INSERT"===c)return b+".insert("+a+", "+e+")\n";break;case "RANDOM":$.Blockly.Python.definitions_.import_random="import random";b.match(/^\w+$/)?a="":(a=$.Blockly.Python.nameDB_.getDistinctName("tmp_list",$.module$exports$Blockly$Names.NameType.VARIABLE),
|
||||||
d=a+" = "+b+"\n",b=a,a=d);d=$.Blockly.Python.nameDB_.getDistinctName("tmp_x",$.module$exports$Blockly$Names.NameType.VARIABLE);a+=d+" = int(random.random() * len("+b+"))\n";if("SET"===c)return a+(b+"["+d+"] = "+e+"\n");if("INSERT"===c)return a+(b+".insert("+d+", "+e+")\n")}throw Error("Unhandled combination (lists_setIndex).");};
|
d=a+" = "+b+"\n",b=a,a=d);d=$.Blockly.Python.nameDB_.getDistinctName("tmp_x",$.module$exports$Blockly$Names.NameType.VARIABLE);a+=d+" = int(random.random() * len("+b+"))\n";if("SET"===c)return a+(b+"["+d+"] = "+e+"\n");if("INSERT"===c)return a+(b+".insert("+d+", "+e+")\n")}throw Error("Unhandled combination (lists_setIndex).");};
|
||||||
$.Blockly.Python.lists_getSublist=function(a){var b=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_MEMBER)||"[]",c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2");switch(c){case "FROM_START":c=$.Blockly.Python.getAdjustedInt(a,"AT1");0===c&&(c="");break;case "FROM_END":c=$.Blockly.Python.getAdjustedInt(a,"AT1",1,!0);break;case "FIRST":c="";break;default:throw Error("Unhandled option (lists_getSublist)");}switch(d){case "FROM_START":a=$.Blockly.Python.getAdjustedInt(a,"AT2",1);
|
$.Blockly.Python.lists_getSublist=function(a){var b=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_MEMBER)||"[]",c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2");switch(c){case "FROM_START":c=$.Blockly.Python.getAdjustedInt(a,"AT1");0===c&&(c="");break;case "FROM_END":c=$.Blockly.Python.getAdjustedInt(a,"AT1",1,!0);break;case "FIRST":c="";break;default:throw Error("Unhandled option (lists_getSublist)");}switch(d){case "FROM_START":a=$.Blockly.Python.getAdjustedInt(a,"AT2",1);
|
||||||
break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT2",0,!0);(0,$.module$exports$Blockly$utils$string.isNumber)(String(a))?0===a&&(a=""):($.Blockly.Python.definitions_.import_sys="import sys",a+=" or sys.maxsize");break;case "LAST":a="";break;default:throw Error("Unhandled option (lists_getSublist)");}return[b+"["+c+" : "+a+"]",$.Blockly.Python.ORDER_MEMBER]};
|
break;case "FROM_END":a=$.Blockly.Python.getAdjustedInt(a,"AT2",0,!0);(0,$.module$exports$Blockly$utils$string.isNumber)(String(a))?0===a&&(a=""):($.Blockly.Python.definitions_.import_sys="import sys",a+=" or sys.maxsize");break;case "LAST":a="";break;default:throw Error("Unhandled option (lists_getSublist)");}return[b+"["+c+" : "+a+"]",$.Blockly.Python.ORDER_MEMBER]};
|
||||||
$.Blockly.Python.lists_sort=function(a){var b=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_NONE)||"[]",c=a.getFieldValue("TYPE");a="1"===a.getFieldValue("DIRECTION")?"False":"True";return[$.Blockly.Python.provideFunction_("lists_sort",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(my_list, type, reverse):"," def try_float(s):"," try:"," return float(s)"," except:"," return 0"," key_funcs = {",' "NUMERIC": try_float,',' "TEXT": str,',' "IGNORE_CASE": lambda s: str(s).lower()',
|
$.Blockly.Python.lists_sort=function(a){var b=$.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_NONE)||"[]",c=a.getFieldValue("TYPE");a="1"===a.getFieldValue("DIRECTION")?"False":"True";return[$.Blockly.Python.provideFunction_("lists_sort","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+'(my_list, type, reverse):\n def try_float(s):\n try:\n return float(s)\n except:\n return 0\n key_funcs = {\n "NUMERIC": try_float,\n "TEXT": str,\n "IGNORE_CASE": lambda s: str(s).lower()\n }\n key_func = key_funcs[type]\n list_cpy = list(my_list)\n return sorted(list_cpy, key=key_func, reverse=reverse)\n')+
|
||||||
" }"," key_func = key_funcs[type]"," list_cpy = list(my_list)"," return sorted(list_cpy, key=key_func, reverse=reverse)"])+"("+b+', "'+c+'", '+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
"("+b+', "'+c+'", '+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.lists_split=function(a){var b=a.getFieldValue("MODE");if("SPLIT"===b)b=$.Blockly.Python.valueToCode(a,"INPUT",$.Blockly.Python.ORDER_MEMBER)||"''",a=$.Blockly.Python.valueToCode(a,"DELIM",$.Blockly.Python.ORDER_NONE),a=b+".split("+a+")";else if("JOIN"===b)b=$.Blockly.Python.valueToCode(a,"INPUT",$.Blockly.Python.ORDER_NONE)||"[]",a=($.Blockly.Python.valueToCode(a,"DELIM",$.Blockly.Python.ORDER_MEMBER)||"''")+".join("+b+")";else throw Error("Unknown mode: "+b);return[a,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.lists_split=function(a){var b=a.getFieldValue("MODE");if("SPLIT"===b)b=$.Blockly.Python.valueToCode(a,"INPUT",$.Blockly.Python.ORDER_MEMBER)||"''",a=$.Blockly.Python.valueToCode(a,"DELIM",$.Blockly.Python.ORDER_NONE),a=b+".split("+a+")";else if("JOIN"===b)b=$.Blockly.Python.valueToCode(a,"INPUT",$.Blockly.Python.ORDER_NONE)||"[]",a=($.Blockly.Python.valueToCode(a,"DELIM",$.Blockly.Python.ORDER_MEMBER)||"''")+".join("+b+")";else throw Error("Unknown mode: "+b);return[a,$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.lists_reverse=function(a){return["list(reversed("+($.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_NONE)||"[]")+"))",$.Blockly.Python.ORDER_FUNCTION_CALL]};var module$exports$Blockly$Python$colour={};$.Blockly.Python.colour_picker=function(a){return[$.Blockly.Python.quote_(a.getFieldValue("COLOUR")),$.Blockly.Python.ORDER_ATOMIC]};$.Blockly.Python.colour_random=function(a){$.Blockly.Python.definitions_.import_random="import random";return["'#%06x' % random.randint(0, 2**24 - 1)",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.lists_reverse=function(a){return["list(reversed("+($.Blockly.Python.valueToCode(a,"LIST",$.Blockly.Python.ORDER_NONE)||"[]")+"))",$.Blockly.Python.ORDER_FUNCTION_CALL]};var module$exports$Blockly$Python$colour={};$.Blockly.Python.colour_picker=function(a){return[$.Blockly.Python.quote_(a.getFieldValue("COLOUR")),$.Blockly.Python.ORDER_ATOMIC]};$.Blockly.Python.colour_random=function(a){$.Blockly.Python.definitions_.import_random="import random";return["'#%06x' % random.randint(0, 2**24 - 1)",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.colour_rgb=function(a){var b=$.Blockly.Python.provideFunction_("colour_rgb",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b):"," r = round(min(100, max(0, r)) * 2.55)"," g = round(min(100, max(0, g)) * 2.55)"," b = round(min(100, max(0, b)) * 2.55)"," return '#%02x%02x%02x' % (r, g, b)"]),c=$.Blockly.Python.valueToCode(a,"RED",$.Blockly.Python.ORDER_NONE)||0,d=$.Blockly.Python.valueToCode(a,"GREEN",$.Blockly.Python.ORDER_NONE)||0;a=$.Blockly.Python.valueToCode(a,
|
$.Blockly.Python.colour_rgb=function(a){var b=$.Blockly.Python.provideFunction_("colour_rgb","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b):\n r = round(min(100, max(0, r)) * 2.55)\n g = round(min(100, max(0, g)) * 2.55)\n b = round(min(100, max(0, b)) * 2.55)\n return '#%02x%02x%02x' % (r, g, b)\n"),c=$.Blockly.Python.valueToCode(a,"RED",$.Blockly.Python.ORDER_NONE)||0,d=$.Blockly.Python.valueToCode(a,"GREEN",$.Blockly.Python.ORDER_NONE)||0;a=$.Blockly.Python.valueToCode(a,"BLUE",
|
||||||
"BLUE",$.Blockly.Python.ORDER_NONE)||0;return[b+"("+c+", "+d+", "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
$.Blockly.Python.ORDER_NONE)||0;return[b+"("+c+", "+d+", "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};
|
||||||
$.Blockly.Python.colour_blend=function(a){var b=$.Blockly.Python.provideFunction_("colour_blend",["def "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(colour1, colour2, ratio):"," r1, r2 = int(colour1[1:3], 16), int(colour2[1:3], 16)"," g1, g2 = int(colour1[3:5], 16), int(colour2[3:5], 16)"," b1, b2 = int(colour1[5:7], 16), int(colour2[5:7], 16)"," ratio = min(1, max(0, ratio))"," r = round(r1 * (1 - ratio) + r2 * ratio)"," g = round(g1 * (1 - ratio) + g2 * ratio)"," b = round(b1 * (1 - ratio) + b2 * ratio)",
|
$.Blockly.Python.colour_blend=function(a){var b=$.Blockly.Python.provideFunction_("colour_blend","\ndef "+$.Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(colour1, colour2, ratio):\n r1, r2 = int(colour1[1:3], 16), int(colour2[1:3], 16)\n g1, g2 = int(colour1[3:5], 16), int(colour2[3:5], 16)\n b1, b2 = int(colour1[5:7], 16), int(colour2[5:7], 16)\n ratio = min(1, max(0, ratio))\n r = round(r1 * (1 - ratio) + r2 * ratio)\n g = round(g1 * (1 - ratio) + g2 * ratio)\n b = round(b1 * (1 - ratio) + b2 * ratio)\n return '#%02x%02x%02x' % (r, g, b)\n"),c=
|
||||||
" return '#%02x%02x%02x' % (r, g, b)"]),c=$.Blockly.Python.valueToCode(a,"COLOUR1",$.Blockly.Python.ORDER_NONE)||"'#000000'",d=$.Blockly.Python.valueToCode(a,"COLOUR2",$.Blockly.Python.ORDER_NONE)||"'#000000'";a=$.Blockly.Python.valueToCode(a,"RATIO",$.Blockly.Python.ORDER_NONE)||0;return[b+"("+c+", "+d+", "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};var module$exports$Blockly$Python$all={};
|
$.Blockly.Python.valueToCode(a,"COLOUR1",$.Blockly.Python.ORDER_NONE)||"'#000000'",d=$.Blockly.Python.valueToCode(a,"COLOUR2",$.Blockly.Python.ORDER_NONE)||"'#000000'";a=$.Blockly.Python.valueToCode(a,"RATIO",$.Blockly.Python.ORDER_NONE)||0;return[b+"("+c+", "+d+", "+a+")",$.Blockly.Python.ORDER_FUNCTION_CALL]};var module$exports$Blockly$Python$all={};
|
||||||
|
$.Blockly.Python.__namespace__=$;
|
||||||
return $.Blockly.Python;
|
return $.Blockly.Python;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
23
index.html
23
index.html
@ -194,6 +194,13 @@
|
|||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
<block type="math_random_float"></block>
|
<block type="math_random_float"></block>
|
||||||
|
<block type="ugj_bintodec">
|
||||||
|
<value name="bin">
|
||||||
|
<shadow type="text">
|
||||||
|
<field name="TEXT">0000</field>
|
||||||
|
</shadow>
|
||||||
|
</value>
|
||||||
|
</block>
|
||||||
<block type="ugj_hextodec">
|
<block type="ugj_hextodec">
|
||||||
<value name="hex">
|
<value name="hex">
|
||||||
<shadow type="text">
|
<shadow type="text">
|
||||||
@ -846,21 +853,7 @@
|
|||||||
</shadow>
|
</shadow>
|
||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
<block type="ugj_set_timeout">
|
<block type="ugj_async_iife"></block>
|
||||||
<value name="sec">
|
|
||||||
<shadow type="math_number">
|
|
||||||
<field name="NUM">1</field>
|
|
||||||
</shadow>
|
|
||||||
</value>
|
|
||||||
</block>
|
|
||||||
<block type="ugj_set_interval">
|
|
||||||
<value name="sec">
|
|
||||||
<shadow type="math_number">
|
|
||||||
<field name="NUM">1</field>
|
|
||||||
</shadow>
|
|
||||||
</value>
|
|
||||||
</block>
|
|
||||||
<block type="ugj_special_clearinterval"></block>
|
|
||||||
<label text="外部アプリ連携" web-line="4.0" web-line-width="200"></label>
|
<label text="外部アプリ連携" web-line="4.0" web-line-width="200"></label>
|
||||||
<block type="ugj_spawnsync">
|
<block type="ugj_spawnsync">
|
||||||
<value name="data">
|
<value name="data">
|
||||||
|
2
lib/beautify.min.js
vendored
2
lib/beautify.min.js
vendored
File diff suppressed because one or more lines are too long
6
lib/skyway.min.js
vendored
6
lib/skyway.min.js
vendored
File diff suppressed because one or more lines are too long
216
package-lock.json
generated
216
package-lock.json
generated
@ -1,22 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "ocoge",
|
"name": "ocoge",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ocoge",
|
"name": "ocoge",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ocoge.club/pigpio": "file:local_modules/@ocoge.club/pigpio",
|
"@ocoge.club/pigpio": "file:local_modules/@ocoge.club/pigpio",
|
||||||
"@tensorflow-models/blazeface": "^0.0.7",
|
"@tensorflow-models/blazeface": "^0.0.7",
|
||||||
"@tensorflow-models/knn-classifier": "^1.2.4",
|
"@tensorflow-models/knn-classifier": "^1.2.4",
|
||||||
"@tensorflow-models/mobilenet": "^2.1.0",
|
"@tensorflow-models/mobilenet": "^2.1.0",
|
||||||
"@tensorflow/tfjs": "^3.17.0",
|
"@tensorflow/tfjs": "^3.18.0",
|
||||||
"@tensorflow/tfjs-backend-wasm": "^3.17.0",
|
"@tensorflow/tfjs-backend-wasm": "^3.18.0",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"electron-squirrel-startup": "^1.0.0",
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
|
"node-abi": "^3.22.0",
|
||||||
"nodemailer": "^6.7.5",
|
"nodemailer": "^6.7.5",
|
||||||
"tensorset": "^1.2.9"
|
"tensorset": "^1.2.9"
|
||||||
},
|
},
|
||||||
@ -26,13 +27,12 @@
|
|||||||
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
|
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
|
||||||
"@electron-forge/maker-squirrel": "6.0.0-beta.33",
|
"@electron-forge/maker-squirrel": "6.0.0-beta.33",
|
||||||
"@electron-forge/maker-zip": "^6.0.0-beta.63",
|
"@electron-forge/maker-zip": "^6.0.0-beta.63",
|
||||||
"electron": "^18.2.3",
|
"electron": "^19.0.3",
|
||||||
"electron-rebuild": "^3.2.7"
|
"electron-rebuild": "^3.2.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"local_modules/@ocoge.club/pigpio": {
|
"local_modules/@ocoge.club/pigpio": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bindings": "^1.5.0",
|
"bindings": "^1.5.0",
|
||||||
@ -1270,9 +1270,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@electron/get": {
|
"node_modules/@electron/get": {
|
||||||
"version": "1.13.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz",
|
||||||
"integrity": "sha512-U5vkXDZ9DwXtkPqlB45tfYnnYBN8PePp1z/XDCupnSpdrxT8/ThCv9WCwPLf9oqiSGZTkH6dx2jDUPuoXpjkcA==",
|
"integrity": "sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
@ -1483,16 +1483,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs": {
|
"node_modules/@tensorflow/tfjs": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-3.18.0.tgz",
|
||||||
"integrity": "sha512-mLN0z5fOdjzikQbYeZQALQYjSFt7OYTrTl+Ky8nkMv0bvb69szFVS/655ir4zkTYL4F/YmU140w8Ml+DVHtNkQ==",
|
"integrity": "sha512-mOzz4jJdgIpqFS7EHndVuxrQnLUDVIKGyTqOPTYps89fZwcOFfTVxi4BHemDNQpqlVE8IaGh9UUxVXpjgPY5+Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tensorflow/tfjs-backend-cpu": "3.17.0",
|
"@tensorflow/tfjs-backend-cpu": "3.18.0",
|
||||||
"@tensorflow/tfjs-backend-webgl": "3.17.0",
|
"@tensorflow/tfjs-backend-webgl": "3.18.0",
|
||||||
"@tensorflow/tfjs-converter": "3.17.0",
|
"@tensorflow/tfjs-converter": "3.18.0",
|
||||||
"@tensorflow/tfjs-core": "3.17.0",
|
"@tensorflow/tfjs-core": "3.18.0",
|
||||||
"@tensorflow/tfjs-data": "3.17.0",
|
"@tensorflow/tfjs-data": "3.18.0",
|
||||||
"@tensorflow/tfjs-layers": "3.17.0",
|
"@tensorflow/tfjs-layers": "3.18.0",
|
||||||
"argparse": "^1.0.10",
|
"argparse": "^1.0.10",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"core-js": "3",
|
"core-js": "3",
|
||||||
@ -1504,9 +1504,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs-backend-cpu": {
|
"node_modules/@tensorflow/tfjs-backend-cpu": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.18.0.tgz",
|
||||||
"integrity": "sha512-alfmaPLnsa/DvkhnPoX/r9ZVDcSuRZUJEElaG3o84JrCBOqzq2jcFwaT9KxchN8rDLmKjJMLQkcQx/bSp/Oz4w==",
|
"integrity": "sha512-LcSqlylzGtpgngcMFIL3q9Q3eVaPRJ7ITZt7ivhzkCj4R5ZsnPa9qM3DCVihkQ77heAwSw4hPTo2jp5C4mJ4Cg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/seedrandom": "2.4.27",
|
"@types/seedrandom": "2.4.27",
|
||||||
"seedrandom": "2.4.3"
|
"seedrandom": "2.4.3"
|
||||||
@ -1515,27 +1515,27 @@
|
|||||||
"yarn": ">= 1.3.2"
|
"yarn": ">= 1.3.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tensorflow/tfjs-core": "3.17.0"
|
"@tensorflow/tfjs-core": "3.18.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs-backend-wasm": {
|
"node_modules/@tensorflow/tfjs-backend-wasm": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-wasm/-/tfjs-backend-wasm-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-wasm/-/tfjs-backend-wasm-3.18.0.tgz",
|
||||||
"integrity": "sha512-hfh4VpYr0C1Qu1uuO2SQH4WuX62OdDkg2e5/rFFgyjMg/avf94udgXtvkD2f4VUMwsoiZk1p40+rZCCnoCBB2A==",
|
"integrity": "sha512-LbMCSXYv4CUKiplNiqGvW9XKLCXfYribpQwuV2QMmfrNaDSa7pR19Y29ajoDCN7Tij9FmqWh4suajAVK6rE+7w==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tensorflow/tfjs-backend-cpu": "3.17.0",
|
"@tensorflow/tfjs-backend-cpu": "3.18.0",
|
||||||
"@types/emscripten": "~0.0.34"
|
"@types/emscripten": "~0.0.34"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tensorflow/tfjs-core": "3.17.0"
|
"@tensorflow/tfjs-core": "3.18.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs-backend-webgl": {
|
"node_modules/@tensorflow/tfjs-backend-webgl": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.18.0.tgz",
|
||||||
"integrity": "sha512-OC/IvU4TNx+B0J51kzCvSPWrC5qXtjY2aAsUvqXb9edhSMwrhC0sSS64t+KuIuPbNiAlVqPvlWZDz3WKPiIPdA==",
|
"integrity": "sha512-3NknSzS1oX2BEBOrpjPMZl823S12RgshQthmIbG6QADHb4bCJA8aM4UjWpw+3bNQnRKbRDQdFbuvj10Un79s2A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tensorflow/tfjs-backend-cpu": "3.17.0",
|
"@tensorflow/tfjs-backend-cpu": "3.18.0",
|
||||||
"@types/offscreencanvas": "~2019.3.0",
|
"@types/offscreencanvas": "~2019.3.0",
|
||||||
"@types/seedrandom": "2.4.27",
|
"@types/seedrandom": "2.4.27",
|
||||||
"@types/webgl-ext": "0.0.30",
|
"@types/webgl-ext": "0.0.30",
|
||||||
@ -1546,21 +1546,21 @@
|
|||||||
"yarn": ">= 1.3.2"
|
"yarn": ">= 1.3.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tensorflow/tfjs-core": "3.17.0"
|
"@tensorflow/tfjs-core": "3.18.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs-converter": {
|
"node_modules/@tensorflow/tfjs-converter": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-3.18.0.tgz",
|
||||||
"integrity": "sha512-AlnIg7aKtfiFq7/ZrWDsVgaw82Uig2KLJY2MOAwadpI4OqhKwwArFHVbVBiOhAEHmp6obwwYaGtItmSM+dzlUQ==",
|
"integrity": "sha512-hpChA+zVNQOVwRnCfqDb1WI9jbEAKA6DuEm4m75Zb3dIlE6VVooDmAaHBhlc++z2q2G1sBzF9A4Bv48SUpN6vA==",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tensorflow/tfjs-core": "3.17.0"
|
"@tensorflow/tfjs-core": "3.18.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs-core": {
|
"node_modules/@tensorflow/tfjs-core": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-3.18.0.tgz",
|
||||||
"integrity": "sha512-PMqEDysVy3WsSK4pU+UaoINRjps1RTF2CPvS1sWgOJqc/rUz8mSMibMosti0Is6DHGw7UiAq53y9VMuzQRVJqA==",
|
"integrity": "sha512-gMxisZozqsr5sCKlphF/eVBLg91MjlBiN60tjX8hJAu0WlSn6Gi5k65GNIL+Pq6hrxpvImcfdCmTH/2XJVZ0Mg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/long": "^4.0.1",
|
"@types/long": "^4.0.1",
|
||||||
"@types/offscreencanvas": "~2019.3.0",
|
"@types/offscreencanvas": "~2019.3.0",
|
||||||
@ -1576,24 +1576,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs-data": {
|
"node_modules/@tensorflow/tfjs-data": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-3.18.0.tgz",
|
||||||
"integrity": "sha512-RgsdrGzWaQtxlRnk7Yiz8ebxbFfgNLITaFri6WxSPNZFI5ajLtw/daxp04ij9l1MIUJeJYgaKeMVXFvJwy8TAQ==",
|
"integrity": "sha512-s43vISJh8K/UN2E2zGRhtj/Kyn8dr4ll8EQkapwzm7fGO9afXCnMsTp6rkZq3fFXouCYA2k1B/j7JssIDr50+w==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node-fetch": "^2.1.2",
|
"@types/node-fetch": "^2.1.2",
|
||||||
"node-fetch": "~2.6.1"
|
"node-fetch": "~2.6.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tensorflow/tfjs-core": "3.17.0",
|
"@tensorflow/tfjs-core": "3.18.0",
|
||||||
"seedrandom": "~2.4.3"
|
"seedrandom": "~2.4.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tensorflow/tfjs-layers": {
|
"node_modules/@tensorflow/tfjs-layers": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-3.18.0.tgz",
|
||||||
"integrity": "sha512-SXx6k1va/RfiCmwaglbaN/eQzZ33xhCUZgk5zpRJkxk3Gx9xXRHb05HszM0BH+cokwmueWcJQpRjcnvjdKxtUg==",
|
"integrity": "sha512-AV7yDnPlH+RCcq8VPqkX1iyEchObE+e66m0XmJvLj+ncfKHYLa+39ZNroUA+OgB2/cMG6jgq77R4EhZbT6hwJA==",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tensorflow/tfjs-core": "3.17.0"
|
"@tensorflow/tfjs-core": "3.18.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tootallnate/once": {
|
"node_modules/@tootallnate/once": {
|
||||||
@ -1733,9 +1733,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webgpu/types": {
|
"node_modules/@webgpu/types": {
|
||||||
"version": "0.1.16",
|
"version": "0.1.17",
|
||||||
"resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.16.tgz",
|
"resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.17.tgz",
|
||||||
"integrity": "sha512-9E61voMP4+Rze02jlTXud++Htpjyyk8vw5Hyw9FGRrmhHQg2GqbuOfwf5Klrb8vTxc2XWI3EfO7RUHMpxTj26A=="
|
"integrity": "sha512-M8INbXsMdkWtVsSHRPEiTXHe0S4gxMhYA/Kz4pNoUF9IXd3PHMi6/2n8EAsqkAEdna+aeCm2RmscWV0hsmIf0Q=="
|
||||||
},
|
},
|
||||||
"node_modules/abbrev": {
|
"node_modules/abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
@ -2856,13 +2856,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/electron": {
|
"node_modules/electron": {
|
||||||
"version": "18.2.3",
|
"version": "19.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-18.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-19.0.3.tgz",
|
||||||
"integrity": "sha512-DJWX03hCRKTscsfXxmW4gmgFuseop+g+m4ml7NfOMfankD8uYyr2Xyi3Ui02inL9qZOlbLMeLVCu6jKCKs8p/w==",
|
"integrity": "sha512-V/8pFkXUOsoHcBzuTYVSbIQKLIwI/FAxfpvbkMazdaO/weZoIf9AN3Qc4Wuo9+489mhelDYc8lSX5N7c6A5n6A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/get": "^1.13.0",
|
"@electron/get": "^1.14.1",
|
||||||
"@types/node": "^16.11.26",
|
"@types/node": "^16.11.26",
|
||||||
"extract-zip": "^1.0.3"
|
"extract-zip": "^1.0.3"
|
||||||
},
|
},
|
||||||
@ -5175,7 +5175,6 @@
|
|||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"yallist": "^4.0.0"
|
"yallist": "^4.0.0"
|
||||||
},
|
},
|
||||||
@ -5690,10 +5689,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/node-abi": {
|
"node_modules/node-abi": {
|
||||||
"version": "3.8.0",
|
"version": "3.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.22.0.tgz",
|
||||||
"integrity": "sha512-tzua9qWWi7iW4I42vUPKM+SfaF0vQSLAm4yO5J83mSwB7GeoWrDKC/K+8YCnYNwqP5duwazbw2X9l4m8SC2cUw==",
|
"integrity": "sha512-u4uAs/4Zzmp/jjsD9cyFYDXeISfUWaAVWshPmDZOFOv4Xl4SbzTXm53I04C2uRueYJ+0t5PEtLH/owbn2Npf/w==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
},
|
},
|
||||||
@ -6936,7 +6934,6 @@
|
|||||||
"version": "7.3.5",
|
"version": "7.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
|
||||||
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
|
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
},
|
},
|
||||||
@ -8008,8 +8005,7 @@
|
|||||||
"node_modules/yallist": {
|
"node_modules/yallist": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/yargs": {
|
"node_modules/yargs": {
|
||||||
"version": "16.2.0",
|
"version": "16.2.0",
|
||||||
@ -9079,9 +9075,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@electron/get": {
|
"@electron/get": {
|
||||||
"version": "1.13.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz",
|
||||||
"integrity": "sha512-U5vkXDZ9DwXtkPqlB45tfYnnYBN8PePp1z/XDCupnSpdrxT8/ThCv9WCwPLf9oqiSGZTkH6dx2jDUPuoXpjkcA==",
|
"integrity": "sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
@ -9243,16 +9239,16 @@
|
|||||||
"integrity": "sha512-JjqT9ijHDFA2FEpUGWg7H2lQ0GrMuE2VmiCRBYmUew6b4JKht8LXDjG5HxZh95YH6c/25sZWTpGeHbquloH+hw=="
|
"integrity": "sha512-JjqT9ijHDFA2FEpUGWg7H2lQ0GrMuE2VmiCRBYmUew6b4JKht8LXDjG5HxZh95YH6c/25sZWTpGeHbquloH+hw=="
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs": {
|
"@tensorflow/tfjs": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-3.18.0.tgz",
|
||||||
"integrity": "sha512-mLN0z5fOdjzikQbYeZQALQYjSFt7OYTrTl+Ky8nkMv0bvb69szFVS/655ir4zkTYL4F/YmU140w8Ml+DVHtNkQ==",
|
"integrity": "sha512-mOzz4jJdgIpqFS7EHndVuxrQnLUDVIKGyTqOPTYps89fZwcOFfTVxi4BHemDNQpqlVE8IaGh9UUxVXpjgPY5+Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@tensorflow/tfjs-backend-cpu": "3.17.0",
|
"@tensorflow/tfjs-backend-cpu": "3.18.0",
|
||||||
"@tensorflow/tfjs-backend-webgl": "3.17.0",
|
"@tensorflow/tfjs-backend-webgl": "3.18.0",
|
||||||
"@tensorflow/tfjs-converter": "3.17.0",
|
"@tensorflow/tfjs-converter": "3.18.0",
|
||||||
"@tensorflow/tfjs-core": "3.17.0",
|
"@tensorflow/tfjs-core": "3.18.0",
|
||||||
"@tensorflow/tfjs-data": "3.17.0",
|
"@tensorflow/tfjs-data": "3.18.0",
|
||||||
"@tensorflow/tfjs-layers": "3.17.0",
|
"@tensorflow/tfjs-layers": "3.18.0",
|
||||||
"argparse": "^1.0.10",
|
"argparse": "^1.0.10",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"core-js": "3",
|
"core-js": "3",
|
||||||
@ -9261,29 +9257,29 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs-backend-cpu": {
|
"@tensorflow/tfjs-backend-cpu": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.18.0.tgz",
|
||||||
"integrity": "sha512-alfmaPLnsa/DvkhnPoX/r9ZVDcSuRZUJEElaG3o84JrCBOqzq2jcFwaT9KxchN8rDLmKjJMLQkcQx/bSp/Oz4w==",
|
"integrity": "sha512-LcSqlylzGtpgngcMFIL3q9Q3eVaPRJ7ITZt7ivhzkCj4R5ZsnPa9qM3DCVihkQ77heAwSw4hPTo2jp5C4mJ4Cg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/seedrandom": "2.4.27",
|
"@types/seedrandom": "2.4.27",
|
||||||
"seedrandom": "2.4.3"
|
"seedrandom": "2.4.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs-backend-wasm": {
|
"@tensorflow/tfjs-backend-wasm": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-wasm/-/tfjs-backend-wasm-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-wasm/-/tfjs-backend-wasm-3.18.0.tgz",
|
||||||
"integrity": "sha512-hfh4VpYr0C1Qu1uuO2SQH4WuX62OdDkg2e5/rFFgyjMg/avf94udgXtvkD2f4VUMwsoiZk1p40+rZCCnoCBB2A==",
|
"integrity": "sha512-LbMCSXYv4CUKiplNiqGvW9XKLCXfYribpQwuV2QMmfrNaDSa7pR19Y29ajoDCN7Tij9FmqWh4suajAVK6rE+7w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@tensorflow/tfjs-backend-cpu": "3.17.0",
|
"@tensorflow/tfjs-backend-cpu": "3.18.0",
|
||||||
"@types/emscripten": "~0.0.34"
|
"@types/emscripten": "~0.0.34"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs-backend-webgl": {
|
"@tensorflow/tfjs-backend-webgl": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.18.0.tgz",
|
||||||
"integrity": "sha512-OC/IvU4TNx+B0J51kzCvSPWrC5qXtjY2aAsUvqXb9edhSMwrhC0sSS64t+KuIuPbNiAlVqPvlWZDz3WKPiIPdA==",
|
"integrity": "sha512-3NknSzS1oX2BEBOrpjPMZl823S12RgshQthmIbG6QADHb4bCJA8aM4UjWpw+3bNQnRKbRDQdFbuvj10Un79s2A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@tensorflow/tfjs-backend-cpu": "3.17.0",
|
"@tensorflow/tfjs-backend-cpu": "3.18.0",
|
||||||
"@types/offscreencanvas": "~2019.3.0",
|
"@types/offscreencanvas": "~2019.3.0",
|
||||||
"@types/seedrandom": "2.4.27",
|
"@types/seedrandom": "2.4.27",
|
||||||
"@types/webgl-ext": "0.0.30",
|
"@types/webgl-ext": "0.0.30",
|
||||||
@ -9292,14 +9288,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs-converter": {
|
"@tensorflow/tfjs-converter": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-3.18.0.tgz",
|
||||||
"integrity": "sha512-AlnIg7aKtfiFq7/ZrWDsVgaw82Uig2KLJY2MOAwadpI4OqhKwwArFHVbVBiOhAEHmp6obwwYaGtItmSM+dzlUQ=="
|
"integrity": "sha512-hpChA+zVNQOVwRnCfqDb1WI9jbEAKA6DuEm4m75Zb3dIlE6VVooDmAaHBhlc++z2q2G1sBzF9A4Bv48SUpN6vA=="
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs-core": {
|
"@tensorflow/tfjs-core": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-3.18.0.tgz",
|
||||||
"integrity": "sha512-PMqEDysVy3WsSK4pU+UaoINRjps1RTF2CPvS1sWgOJqc/rUz8mSMibMosti0Is6DHGw7UiAq53y9VMuzQRVJqA==",
|
"integrity": "sha512-gMxisZozqsr5sCKlphF/eVBLg91MjlBiN60tjX8hJAu0WlSn6Gi5k65GNIL+Pq6hrxpvImcfdCmTH/2XJVZ0Mg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/long": "^4.0.1",
|
"@types/long": "^4.0.1",
|
||||||
"@types/offscreencanvas": "~2019.3.0",
|
"@types/offscreencanvas": "~2019.3.0",
|
||||||
@ -9312,18 +9308,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs-data": {
|
"@tensorflow/tfjs-data": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-3.18.0.tgz",
|
||||||
"integrity": "sha512-RgsdrGzWaQtxlRnk7Yiz8ebxbFfgNLITaFri6WxSPNZFI5ajLtw/daxp04ij9l1MIUJeJYgaKeMVXFvJwy8TAQ==",
|
"integrity": "sha512-s43vISJh8K/UN2E2zGRhtj/Kyn8dr4ll8EQkapwzm7fGO9afXCnMsTp6rkZq3fFXouCYA2k1B/j7JssIDr50+w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node-fetch": "^2.1.2",
|
"@types/node-fetch": "^2.1.2",
|
||||||
"node-fetch": "~2.6.1"
|
"node-fetch": "~2.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tensorflow/tfjs-layers": {
|
"@tensorflow/tfjs-layers": {
|
||||||
"version": "3.17.0",
|
"version": "3.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-3.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-3.18.0.tgz",
|
||||||
"integrity": "sha512-SXx6k1va/RfiCmwaglbaN/eQzZ33xhCUZgk5zpRJkxk3Gx9xXRHb05HszM0BH+cokwmueWcJQpRjcnvjdKxtUg=="
|
"integrity": "sha512-AV7yDnPlH+RCcq8VPqkX1iyEchObE+e66m0XmJvLj+ncfKHYLa+39ZNroUA+OgB2/cMG6jgq77R4EhZbT6hwJA=="
|
||||||
},
|
},
|
||||||
"@tootallnate/once": {
|
"@tootallnate/once": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
@ -9459,9 +9455,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@webgpu/types": {
|
"@webgpu/types": {
|
||||||
"version": "0.1.16",
|
"version": "0.1.17",
|
||||||
"resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.16.tgz",
|
"resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.17.tgz",
|
||||||
"integrity": "sha512-9E61voMP4+Rze02jlTXud++Htpjyyk8vw5Hyw9FGRrmhHQg2GqbuOfwf5Klrb8vTxc2XWI3EfO7RUHMpxTj26A=="
|
"integrity": "sha512-M8INbXsMdkWtVsSHRPEiTXHe0S4gxMhYA/Kz4pNoUF9IXd3PHMi6/2n8EAsqkAEdna+aeCm2RmscWV0hsmIf0Q=="
|
||||||
},
|
},
|
||||||
"abbrev": {
|
"abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
@ -10310,12 +10306,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "18.2.3",
|
"version": "19.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-18.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-19.0.3.tgz",
|
||||||
"integrity": "sha512-DJWX03hCRKTscsfXxmW4gmgFuseop+g+m4ml7NfOMfankD8uYyr2Xyi3Ui02inL9qZOlbLMeLVCu6jKCKs8p/w==",
|
"integrity": "sha512-V/8pFkXUOsoHcBzuTYVSbIQKLIwI/FAxfpvbkMazdaO/weZoIf9AN3Qc4Wuo9+489mhelDYc8lSX5N7c6A5n6A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@electron/get": "^1.13.0",
|
"@electron/get": "^1.14.1",
|
||||||
"@types/node": "^16.11.26",
|
"@types/node": "^16.11.26",
|
||||||
"extract-zip": "^1.0.3"
|
"extract-zip": "^1.0.3"
|
||||||
},
|
},
|
||||||
@ -12142,7 +12138,6 @@
|
|||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"yallist": "^4.0.0"
|
"yallist": "^4.0.0"
|
||||||
}
|
}
|
||||||
@ -12551,10 +12546,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node-abi": {
|
"node-abi": {
|
||||||
"version": "3.8.0",
|
"version": "3.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.22.0.tgz",
|
||||||
"integrity": "sha512-tzua9qWWi7iW4I42vUPKM+SfaF0vQSLAm4yO5J83mSwB7GeoWrDKC/K+8YCnYNwqP5duwazbw2X9l4m8SC2cUw==",
|
"integrity": "sha512-u4uAs/4Zzmp/jjsD9cyFYDXeISfUWaAVWshPmDZOFOv4Xl4SbzTXm53I04C2uRueYJ+0t5PEtLH/owbn2Npf/w==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
}
|
}
|
||||||
@ -13482,7 +13476,6 @@
|
|||||||
"version": "7.3.5",
|
"version": "7.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
|
||||||
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
|
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
}
|
}
|
||||||
@ -14351,8 +14344,7 @@
|
|||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "16.2.0",
|
"version": "16.2.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ocoge",
|
"name": "ocoge",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"description": "ブロックベースビジュアルプログラム開発・実行環境",
|
"description": "ブロックベースビジュアルプログラム開発・実行環境",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
|
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
|
||||||
"@electron-forge/maker-squirrel": "6.0.0-beta.33",
|
"@electron-forge/maker-squirrel": "6.0.0-beta.33",
|
||||||
"@electron-forge/maker-zip": "^6.0.0-beta.63",
|
"@electron-forge/maker-zip": "^6.0.0-beta.63",
|
||||||
"electron": "^18.2.3",
|
"electron": "^19.0.3",
|
||||||
"electron-rebuild": "^3.2.7"
|
"electron-rebuild": "^3.2.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -35,10 +35,11 @@
|
|||||||
"@tensorflow-models/blazeface": "^0.0.7",
|
"@tensorflow-models/blazeface": "^0.0.7",
|
||||||
"@tensorflow-models/knn-classifier": "^1.2.4",
|
"@tensorflow-models/knn-classifier": "^1.2.4",
|
||||||
"@tensorflow-models/mobilenet": "^2.1.0",
|
"@tensorflow-models/mobilenet": "^2.1.0",
|
||||||
"@tensorflow/tfjs": "^3.17.0",
|
"@tensorflow/tfjs": "^3.18.0",
|
||||||
"@tensorflow/tfjs-backend-wasm": "^3.17.0",
|
"@tensorflow/tfjs-backend-wasm": "^3.18.0",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"electron-squirrel-startup": "^1.0.0",
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
|
"node-abi": "^3.22.0",
|
||||||
"nodemailer": "^6.7.5",
|
"nodemailer": "^6.7.5",
|
||||||
"tensorset": "^1.2.9"
|
"tensorset": "^1.2.9"
|
||||||
},
|
},
|
||||||
|
228
ugj_blocks.js
228
ugj_blocks.js
@ -176,6 +176,23 @@ Blockly.Python['ugj_charcode'] = function (block) {
|
|||||||
return [code, Blockly.Python.ORDER_NONE];
|
return [code, Blockly.Python.ORDER_NONE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks['ugj_bintodec'] = {
|
||||||
|
init: function () {
|
||||||
|
this.appendValueInput("bin")
|
||||||
|
.setCheck("String")
|
||||||
|
.appendField("0b");
|
||||||
|
this.setInputsInline(true);
|
||||||
|
this.setOutput(true, "Number");
|
||||||
|
this.setTooltip("2進数を10進数に変換します");
|
||||||
|
this.setHelpUrl("");
|
||||||
|
this.setStyle('math_blocks');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Blockly.JavaScript['ugj_bintodec'] = function (block) {
|
||||||
|
var value_bin = Blockly.JavaScript.valueToCode(block, 'bin', Blockly.JavaScript.ORDER_ATOMIC);
|
||||||
|
var code = `parseInt (${value_bin}, 2)`;
|
||||||
|
return [code, Blockly.JavaScript.ORDER_NONE];
|
||||||
|
};
|
||||||
|
|
||||||
var ugjHextodecDefinition = {
|
var ugjHextodecDefinition = {
|
||||||
"type": "ugj_hextodec",
|
"type": "ugj_hextodec",
|
||||||
@ -1444,6 +1461,9 @@ Blockly.Blocks['ugj_event_key'] = {
|
|||||||
.appendField(new Blockly.FieldDropdown([["押したとき", "keydown"], ["離したとき", "keyup"]]), "updown");
|
.appendField(new Blockly.FieldDropdown([["押したとき", "keydown"], ["離したとき", "keyup"]]), "updown");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -1806,6 +1826,9 @@ Blockly.Blocks['ugj_skyway_newpeer'] = {
|
|||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null)
|
.setCheck(null)
|
||||||
.appendField("接続したら");
|
.appendField("接続したら");
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -1880,6 +1903,9 @@ Blockly.Blocks['ugj_skyway_events'] = {
|
|||||||
.appendField("との接続後にすること");
|
.appendField("との接続後にすること");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -1910,6 +1936,9 @@ Blockly.Blocks['ugj_skyway_eventopen'] = {
|
|||||||
.appendField("接続したらすぐ");
|
.appendField("接続したらすぐ");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -1939,6 +1968,9 @@ Blockly.Blocks['ugj_skyway_eventdata'] = {
|
|||||||
.appendField("を受けとったら");
|
.appendField("を受けとったら");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -1970,6 +2002,9 @@ Blockly.Blocks['ugj_skyway_eventsend'] = {
|
|||||||
.appendField("を送信するとき");
|
.appendField("を送信するとき");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -2115,7 +2150,11 @@ Blockly.Blocks['ugj_event_answer'] = {
|
|||||||
.appendField("を待つ");
|
.appendField("を待つ");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip("質問をして答えを待ちます。入力欄でキーボードのエンターキーが入力されるか、チェックマークボタンが押されると実行されます。");
|
this.setTooltip("質問をして答えを待ちます。入力欄でキーボードのエンターキーが入力されるか、チェックマークボタンが押されると実行されます。");
|
||||||
this.setHelpUrl("");
|
this.setHelpUrl("");
|
||||||
this.setStyle('special_blocks')
|
this.setStyle('special_blocks')
|
||||||
@ -2192,6 +2231,9 @@ Blockly.Blocks['ugj_spawn'] = {
|
|||||||
.appendField("を受け取る");
|
.appendField("を受け取る");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -2486,7 +2528,7 @@ Blockly.Blocks['ugj_blackboard_content'] = {
|
|||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true, "String");
|
this.setOutput(true, "String");
|
||||||
this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
|
this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
|
||||||
this.setStyle('special_blocks')
|
this.setStyle('special_blocks');
|
||||||
this.setTooltip("黒板の内容をプレーンテキストで取得します。");
|
this.setTooltip("黒板の内容をプレーンテキストで取得します。");
|
||||||
this.setHelpUrl("");
|
this.setHelpUrl("");
|
||||||
}
|
}
|
||||||
@ -2539,6 +2581,35 @@ Blockly.Python['ugj_sleep'] = function (block) {
|
|||||||
var code = `sleep(${value_sec})\n`;
|
var code = `sleep(${value_sec})\n`;
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
/**************** */
|
||||||
|
/** Async IIFE ** */
|
||||||
|
/**************** */
|
||||||
|
Blockly.Blocks['ugj_async_iife'] = {
|
||||||
|
init: function () {
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField("非同期で実行");
|
||||||
|
this.appendStatementInput("do")
|
||||||
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("Async▼");
|
||||||
|
this.setInputsInline(true);
|
||||||
|
this.setPreviousStatement(true, null);
|
||||||
|
this.setNextStatement(true, null);
|
||||||
|
this.setTooltip("ステートメントを非同期で実行します。即時関数を生成するのでスコープに注意。");
|
||||||
|
this.setHelpUrl("");
|
||||||
|
this.setStyle('special_blocks');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Blockly.JavaScript['ugj_async_iife'] = function (block) {
|
||||||
|
var statements_do = Blockly.JavaScript.statementToCode(block, 'do');
|
||||||
|
var code = `(async () => {
|
||||||
|
${statements_do}
|
||||||
|
})();
|
||||||
|
`;
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
/********************* */
|
/********************* */
|
||||||
/** Carriage Return ** */
|
/** Carriage Return ** */
|
||||||
/********************* */
|
/********************* */
|
||||||
@ -2617,81 +2688,6 @@ Blockly.JavaScript['ugj_text_cursor'] = function (block) {
|
|||||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************/
|
|
||||||
/** Set Interval **/
|
|
||||||
/******************/
|
|
||||||
Blockly.Blocks['ugj_set_interval'] = {
|
|
||||||
init: function () {
|
|
||||||
this.appendValueInput("sec")
|
|
||||||
.setCheck("Number");
|
|
||||||
this.appendDummyInput()
|
|
||||||
.appendField("秒ごとにくり返す");
|
|
||||||
this.appendStatementInput("do")
|
|
||||||
.setCheck(null);
|
|
||||||
this.setInputsInline(true);
|
|
||||||
this.setPreviousStatement(true, null);
|
|
||||||
this.setNextStatement(true, null);
|
|
||||||
this.setStyle('special_blocks')
|
|
||||||
this.setTooltip("非同期で繰り返し処理を行います(停止ボタンまたは停止ブロックで停止)。");
|
|
||||||
this.setHelpUrl("");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Blockly.JavaScript['ugj_set_interval'] = function (block) {
|
|
||||||
var value_sec = Blockly.JavaScript.valueToCode(block, 'sec', Blockly.JavaScript.ORDER_ATOMIC);
|
|
||||||
var statements_do = Blockly.JavaScript.statementToCode(block, 'do');
|
|
||||||
var code = [
|
|
||||||
'let _interval = setInterval( async () => {',
|
|
||||||
statements_do,
|
|
||||||
`}, ${value_sec}*1000);`,
|
|
||||||
''
|
|
||||||
].join('\n');
|
|
||||||
return code;
|
|
||||||
};
|
|
||||||
/******************** */
|
|
||||||
/** Clear Interval ** */
|
|
||||||
/******************** */
|
|
||||||
Blockly.Blocks['ugj_special_clearinterval'] = {
|
|
||||||
init: function () {
|
|
||||||
this.appendDummyInput()
|
|
||||||
.appendField("繰り返しを停止する");
|
|
||||||
this.setInputsInline(true);
|
|
||||||
this.setPreviousStatement(true, null);
|
|
||||||
this.setNextStatement(true, null);
|
|
||||||
this.setStyle('special_blocks')
|
|
||||||
this.setTooltip("非同期の繰り返し処理を停止します。");
|
|
||||||
this.setHelpUrl("");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Blockly.JavaScript['ugj_special_clearinterval'] = function (block) {
|
|
||||||
var code = 'clearInterval(_interval);\n';
|
|
||||||
return code;
|
|
||||||
};
|
|
||||||
/********+********/
|
|
||||||
/** Set Timeout **/
|
|
||||||
/********+********/
|
|
||||||
Blockly.Blocks['ugj_set_timeout'] = {
|
|
||||||
init: function () {
|
|
||||||
this.appendValueInput("sec")
|
|
||||||
.setCheck("Number");
|
|
||||||
this.appendDummyInput()
|
|
||||||
.appendField("秒待ってから");
|
|
||||||
this.appendStatementInput("do")
|
|
||||||
.setCheck(null);
|
|
||||||
this.setInputsInline(true);
|
|
||||||
this.setPreviousStatement(true, null);
|
|
||||||
this.setNextStatement(true, null);
|
|
||||||
this.setStyle('special_blocks')
|
|
||||||
this.setTooltip("指定した秒数だけ待ってから実行します。");//内側のブロック部を 外側下に接続したものは待たずに直ちに実行されます(非同期動作)。
|
|
||||||
this.setHelpUrl("");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Blockly.JavaScript['ugj_set_timeout'] = function (block) {
|
|
||||||
var value_sec = Blockly.JavaScript.valueToCode(block, 'sec', Blockly.JavaScript.ORDER_ATOMIC);
|
|
||||||
var statements_do = Blockly.JavaScript.statementToCode(block, 'do');
|
|
||||||
var code = `let _interval = setTimeout(async () => {\n${statements_do}}, ${value_sec}*1000);\n`;
|
|
||||||
return code;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**************************** */
|
/**************************** */
|
||||||
/** Dinamic Load JS Libraries */
|
/** Dinamic Load JS Libraries */
|
||||||
/**************************** */
|
/**************************** */
|
||||||
@ -2741,6 +2737,9 @@ Blockly.Blocks['ugj_control_button'] = {
|
|||||||
.appendField("ツールチップ");
|
.appendField("ツールチップ");
|
||||||
this.appendStatementInput("do")
|
this.appendStatementInput("do")
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
|
.appendField("▼");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@ -2834,3 +2833,80 @@ Blockly.JavaScript['testblock'] = function (block) {
|
|||||||
var code = `${value_foo} = 42;\n`;
|
var code = `${value_foo} = 42;\n`;
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 互換性 */
|
||||||
|
|
||||||
|
// /******************/
|
||||||
|
// /** Set Interval **/
|
||||||
|
// /******************/
|
||||||
|
// Blockly.Blocks['ugj_set_interval'] = {
|
||||||
|
// init: function () {
|
||||||
|
// this.appendValueInput("sec")
|
||||||
|
// .setCheck("Number");
|
||||||
|
// this.appendDummyInput()
|
||||||
|
// .appendField("秒ごとにくり返す");
|
||||||
|
// this.appendStatementInput("do")
|
||||||
|
// .setCheck(null);
|
||||||
|
// this.setInputsInline(true);
|
||||||
|
// this.setPreviousStatement(true, null);
|
||||||
|
// this.setNextStatement(true, null);
|
||||||
|
// this.setStyle('special_blocks')
|
||||||
|
// this.setTooltip("非同期で繰り返し処理を行います(停止ボタンまたは停止ブロックで停止)。");
|
||||||
|
// this.setHelpUrl("");
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// Blockly.JavaScript['ugj_set_interval'] = function (block) {
|
||||||
|
// var value_sec = Blockly.JavaScript.valueToCode(block, 'sec', Blockly.JavaScript.ORDER_ATOMIC);
|
||||||
|
// var statements_do = Blockly.JavaScript.statementToCode(block, 'do');
|
||||||
|
// var code = [
|
||||||
|
// 'let _interval = setInterval( async () => {',
|
||||||
|
// statements_do,
|
||||||
|
// `}, ${value_sec}*1000);`,
|
||||||
|
// ''
|
||||||
|
// ].join('\n');
|
||||||
|
// return code;
|
||||||
|
// };
|
||||||
|
// /******************** */
|
||||||
|
// /** Clear Interval ** */
|
||||||
|
// /******************** */
|
||||||
|
// Blockly.Blocks['ugj_special_clearinterval'] = {
|
||||||
|
// init: function () {
|
||||||
|
// this.appendDummyInput()
|
||||||
|
// .appendField("繰り返しを停止する");
|
||||||
|
// this.setInputsInline(true);
|
||||||
|
// this.setPreviousStatement(true, null);
|
||||||
|
// this.setNextStatement(true, null);
|
||||||
|
// this.setStyle('special_blocks')
|
||||||
|
// this.setTooltip("非同期の繰り返し処理を停止します。");
|
||||||
|
// this.setHelpUrl("");
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// Blockly.JavaScript['ugj_special_clearinterval'] = function (block) {
|
||||||
|
// var code = 'clearInterval(_interval);\n';
|
||||||
|
// return code;
|
||||||
|
// };
|
||||||
|
// /********+********/
|
||||||
|
// /** Set Timeout **/
|
||||||
|
// /********+********/
|
||||||
|
// Blockly.Blocks['ugj_set_timeout'] = {
|
||||||
|
// init: function () {
|
||||||
|
// this.appendValueInput("sec")
|
||||||
|
// .setCheck("Number");
|
||||||
|
// this.appendDummyInput()
|
||||||
|
// .appendField("秒待ってから");
|
||||||
|
// this.appendStatementInput("do")
|
||||||
|
// .setCheck(null);
|
||||||
|
// this.setInputsInline(true);
|
||||||
|
// this.setPreviousStatement(true, null);
|
||||||
|
// this.setNextStatement(true, null);
|
||||||
|
// this.setStyle('special_blocks')
|
||||||
|
// this.setTooltip("指定した秒数だけ待ってから実行します。");//内側のブロック部を 外側下に接続したものは待たずに直ちに実行されます(非同期動作)。
|
||||||
|
// this.setHelpUrl("");
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// Blockly.JavaScript['ugj_set_timeout'] = function (block) {
|
||||||
|
// var value_sec = Blockly.JavaScript.valueToCode(block, 'sec', Blockly.JavaScript.ORDER_ATOMIC);
|
||||||
|
// var statements_do = Blockly.JavaScript.statementToCode(block, 'do');
|
||||||
|
// var code = `let _interval = setTimeout(async () => {\n${statements_do}}, ${value_sec}*1000);\n`;
|
||||||
|
// return code;
|
||||||
|
// };
|
Loading…
Reference in New Issue
Block a user