mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-25 00:49:48 +00:00
1 line
270 KiB
Plaintext
1 line
270 KiB
Plaintext
{"version":3,"sources":["blocks/variables_dynamic.js","blocks/variables.js","blocks/text.js","blocks/procedures.js","blocks/math.js","blocks/loops.js","blocks/logic.js","blocks/lists.js","blocks/colour.js","blocks/blocks.js"],"names":["ContextMenu","Extensions","Variables","xml","BlockDefinition","Object","Msg","createBlockDefinitionsFromJsonArray","defineBlocks","blocks","CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN","customContextMenu","options","isInFlyout","id","getFieldValue","varType","workspace","getVariableById","variableModel","type","oppositeType","contextMenuMsg","option","enabled","remainingCapacity","name","getField","getText","text","replace","xmlField","createElement","setAttribute","appendChild","createTextNode","xmlBlock","callback","callbackFactory","push","renameOption","renameOptionCallbackFactory","deleteOption","deleteOptionCallbackFactory","unshift","onchange","_e","getVariable","outputConnection","setCheck","getInput","connection","block","variable","renameVariable","deleteVariableById","getId","refreshToolboxSelection","registerMixin","xmlUtils","Align","ConnectionType","FieldDropdown","FieldImage","FieldTextInput","Mutator","init","setHelpUrl","setStyle","appendValueInput","appendField","appendDummyInput","setInputsInline","setOutput","updateAt_","setTooltip","mutationToDom","container","isAt1","INPUT_VALUE","isAt2","domToMutation","xmlElement","getAttribute","n","isAt","removeInput","menu","value","newAt","getSourceBlock","setFieldValue","moveInputBefore","OPERATORS","jsonInit","TEXT_PROMPT_COMMON","updateType_","newOp","TYPES","thisBlock","dropdown","mixin","QUOTE_IMAGE_MIXIN","newQuote_","QUOTE_IMAGE_LEFT_DATAURI","QUOTE_IMAGE_RIGHT_DATAURI","QUOTE_IMAGE_WIDTH","QUOTE_IMAGE_HEIGHT","quoteField_","fieldName","i","input","inputList","j","field","fieldRow","insertFieldAt","console","warn","toDevString","open","isLeft","RTL","dataUri","TEXT_QUOTES_EXTENSION","TEXT_JOIN_MUTATOR_MIXIN","itemCount_","parseInt","updateShape_","saveExtraState","loadExtraState","state","decompose","containerBlock","newBlock","initSvg","itemBlock","connect","previousConnection","nextConnection","compose","getInputTargetBlock","connections","isInsertionMarker","valueConnection_","getNextBlock","targetConnection","indexOf","disconnect","length","reconnect","saveConnections","setAlign","RIGHT","TEXT_JOIN_EXTENSION","setMutator","register","buildTooltipWithFieldText","TEXT_INDEXOF_TOOLTIP_EXTENSION","oneBasedIndex","TEXT_CHARAT_MUTATOR_MIXIN","isAt_","TEXT_CHARAT_EXTENSION","setValidator","where","tooltip","msg","registerMutator","Events","Procedures","Xml","config","FieldCheckbox","FieldLabel","Names","PROCEDURE_DEF_COMMON","setStatements_","hasStatements","hasStatements_","appendStatementInput","updateParams_","paramString","arguments_","join","disable","enable","opt_paramIds","argumentVarModels_","parameter","argModel","paramIds_","childNode","childNodes","nodeName","toLowerCase","varName","varId","getOrCreateVariablePackage","log","mutateCallers","create","param","containerBlockNode","statementNode","argBlockNode","fieldNode","argumentName","nextNode","node","domToBlock","paramBlock","targetBlock","statementConnection_","stackConnection","stackBlock","unplug","bumpNeighbours","getVars","getVarModels","renameVarById","oldId","newId","oldVariable","oldName","newVar","change","displayRenamedVar_","updateVarName","newName","mutator","isVisible","workspace_","getAllBlocks","equals","xmlMutation","xmlArg","callType_","isCollapsed","argOption","argVar","argXmlField","generateVariableFieldDom","argXmlBlock","initName","findLegalName","nameField","rename","setSpellcheck","comments","parentWorkspace","setCommentText","getProcedureDef","contextMenu","DEFAULT_ARG","validator_","oldShowEditorFn_","showEditor_","newShowEditorFn","createdVariables_","setPreviousStatement","setNextStatement","onFinishEditing_","deleteIntermediateVars_","sourceBlock","outerWs","findParentWs","targetWorkspace","caselessName","otherVar","model","renameVariableById","createVariable","newText","PROCEDURE_CALL_COMMON","getProcedureCall","renameProcedure","baseMsg","setProcedureParameters_","paramNames","paramIds","defBlock","getDefinition","mutatorOpen","setCollapsed","quarkConnections_","quarkIds_","RangeError","savedRendered","rendered","concat","quarkId","render","argField","setValue","newField","topRow","removeField","args","params","ids","fill","event","isFlyout","recordUndo","BLOCK_CREATE","def","defType_","JSON","stringify","setGroup","group","xy","getRelativeToSurfaceXY","y","snapRadius","x","mutation","callName","domToWorkspace","BLOCK_DELETE","blockId","dispose","CHANGE","element","oldGroup","getGroup","newValue","previousEnabledState_","isEnabled","setEnabled","isMovable","option.callback","centerOnBlock","select","hasReturnValue_","Number","e","isDragging","BLOCK_MOVE","legal","FUNCTION_TYPES","getSurroundParent","setWarningText","TOOLTIPS_BY_OP","buildTooltipForDropdown","IS_DIVISIBLEBY_MUTATOR_MIXIN","divisorInput","inputExists","IS_DIVISIBLE_MUTATOR_EXTENSION","LIST_MODES_MUTATOR_MIXIN","LIST_MODES_MUTATOR_EXTENSION","bind","WHILE_UNTIL_TOOLTIPS","BREAK_CONTINUE_TOOLTIPS","CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN","loopTypes","Set","CONTROL_FLOW_IN_LOOP_CHECK_MIXIN","getSurroundLoop","has","CONTROLS_IF_MUTATOR_MIXIN","elseifCount_","elseCount_","rebuildShape_","elseifBlock","elseBlock","clauseBlock","valueConnections","statementConnections","elseStatementConnection","TypeError","reconnectChildBlocks_","inputIf","inputDo","CONTROLS_IF_TOOLTIP_EXTENSION","LOGIC_COMPARE_ONCHANGE_MIXIN","prevBlocks_","blockA","blockB","connectionChecker","doTypeChecks","prevA","isDisposed","isShadow","prevB","LOGIC_COMPARE_EXTENSION","LOGIC_TERNARY_ONCHANGE_MIXIN","prevParentConnection_","parentConnection","MODE","WHERE_OPTIONS","modeMenu","isStatement","updateStatement_","mode","textToDom","newStatement","oldStatement","newMode","Error","inputConnection","setShadowDom","inputBlock","exports","colour","lists","logic","loops","math","procedures","texts","variables","variablesDynamic","assign"],"mappings":"A;;;;;;;;;;;;;;AAYA,IAAA,sDAAA,EAAA,CAIMA,mEAAc,CAAA,CAAA,iCAJpB,CAKMC,kEAAa,CAAA,CAAA,gCALnB,CAMMC,iEAAY,CAAA,CAAA,+BANlB,CAOMC,2D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AQE,CAAAA,KAAR,CAAgBA,0CAChBF,qCAAQG,CAAAA,KAAR,CAAgBA,0CAChBH,qCAAQI,CAAAA,KAAR,CAAgBA,0CAChBJ,qCAAQK,CAAAA,IAAR,CAAeA,yCACfL;oCAAQM,CAAAA,UAAR,CAAqBA,+CACrBN,qCAAQO,CAAAA,KAAR,CAAgBA,0CAChBP,qCAAQQ,CAAAA,SAAR,CAAoBA,8CACpBR,qCAAQS,CAAAA,gBAAR,CAA2BA,qDAOrBnZ;oCAAAA,CAAAA,MAAN,CAAeJ,MAAOwZ,CAAAA,MAAP,CACX,EADW,CACPT,2CAAO3Y,CAAAA,MADA,CACQ4Y,0CAAM5Y,CAAAA,MADd,CACsB6Y,0CAAM7Y,CAAAA,MAD5B,CACoC8Y,0CAAM9Y,CAAAA,MAD1C,CACkD+Y,yCAAK/Y,CAAAA,MADvD,CAEXgZ,+CAAWhZ,CAAAA,MAFA,CAEQkZ,8CAAUlZ,CAAAA,MAFlB,CAE0BmZ,qDAAiBnZ,CAAAA,MAF3C","file":"blocks_compressed.js","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Variable blocks for Blockly.\n * @suppress {checkTypes}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.variablesDynamic');\n\n/* eslint-disable-next-line no-unused-vars */\nconst AbstractEvent = goog.requireType('Blockly.Events.Abstract');\nconst ContextMenu = goog.require('Blockly.ContextMenu');\nconst Extensions = goog.require('Blockly.Extensions');\nconst Variables = goog.require('Blockly.Variables');\nconst xml = goog.require('Blockly.utils.xml');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {Msg} = goog.require('Blockly.Msg');\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldLabel');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldVariable');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for variable getter.\n {\n 'type': 'variables_get_dynamic',\n 'message0': '%1',\n 'args0': [{\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': '%{BKY_VARIABLES_DEFAULT_NAME}',\n }],\n 'output': null,\n 'style': 'variable_dynamic_blocks',\n 'helpUrl': '%{BKY_VARIABLES_GET_HELPURL}',\n 'tooltip': '%{BKY_VARIABLES_GET_TOOLTIP}',\n 'extensions': ['contextMenu_variableDynamicSetterGetter'],\n },\n // Block for variable setter.\n {\n 'type': 'variables_set_dynamic',\n 'message0': '%{BKY_VARIABLES_SET}',\n 'args0': [\n {\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': '%{BKY_VARIABLES_DEFAULT_NAME}',\n },\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n },\n ],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'variable_dynamic_blocks',\n 'tooltip': '%{BKY_VARIABLES_SET_TOOLTIP}',\n 'helpUrl': '%{BKY_VARIABLES_SET_HELPURL}',\n 'extensions': ['contextMenu_variableDynamicSetterGetter'],\n },\n]);\nexports.blocks = blocks;\n\n/**\n * Mixin to add context menu items to create getter/setter blocks for this\n * setter/getter.\n * Used by blocks 'variables_set_dynamic' and 'variables_get_dynamic'.\n * @mixin\n * @augments Block\n * @readonly\n */\nconst CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = {\n /**\n * Add menu option to create getter/setter block for this setter/getter.\n * @param {!Array} options List of menu options to add to.\n * @this {Block}\n */\n customContextMenu: function(options) {\n // Getter blocks have the option to create a setter block, and vice versa.\n if (!this.isInFlyout) {\n let oppositeType;\n let contextMenuMsg;\n const id = this.getFieldValue('VAR');\n const variableModel = this.workspace.getVariableById(id);\n const varType = variableModel.type;\n if (this.type === 'variables_get_dynamic') {\n oppositeType = 'variables_set_dynamic';\n contextMenuMsg = Msg['VARIABLES_GET_CREATE_SET'];\n } else {\n oppositeType = 'variables_get_dynamic';\n contextMenuMsg = Msg['VARIABLES_SET_CREATE_GET'];\n }\n\n const option = {enabled: this.workspace.remainingCapacity() > 0};\n const name = this.getField('VAR').getText();\n option.text = contextMenuMsg.replace('%1', name);\n const xmlField = xml.createElement('field');\n xmlField.setAttribute('name', 'VAR');\n xmlField.setAttribute('variabletype', varType);\n xmlField.appendChild(xml.createTextNode(name));\n const xmlBlock = xml.createElement('block');\n xmlBlock.setAttribute('type', oppositeType);\n xmlBlock.appendChild(xmlField);\n option.callback = ContextMenu.callbackFactory(this, xmlBlock);\n options.push(option);\n } else {\n if (this.type === 'variables_get_dynamic' ||\n this.type === 'variables_get_reporter_dynamic') {\n const renameOption = {\n text: Msg['RENAME_VARIABLE'],\n enabled: true,\n callback: renameOptionCallbackFactory(this),\n };\n const name = this.getField('VAR').getText();\n const deleteOption = {\n text: Msg['DELETE_VARIABLE'].replace('%1', name),\n enabled: true,\n callback: deleteOptionCallbackFactory(this),\n };\n options.unshift(renameOption);\n options.unshift(deleteOption);\n }\n }\n },\n /**\n * Called whenever anything on the workspace changes.\n * Set the connection type for this block.\n * @param {AbstractEvent} _e Change event.\n * @this {Block}\n */\n onchange: function(_e) {\n const id = this.getFieldValue('VAR');\n const variableModel = Variables.getVariable(this.workspace, id);\n if (this.type === 'variables_get_dynamic') {\n this.outputConnection.setCheck(variableModel.type);\n } else {\n this.getInput('VALUE').connection.setCheck(variableModel.type);\n }\n },\n};\n\n/**\n * Factory for callbacks for rename variable dropdown menu option\n * associated with a variable getter block.\n * @param {!Block} block The block with the variable to rename.\n * @return {!function()} A function that renames the variable.\n */\nconst renameOptionCallbackFactory = function(block) {\n return function() {\n const workspace = block.workspace;\n const variable = block.getField('VAR').getVariable();\n Variables.renameVariable(workspace, variable);\n };\n};\n\n/**\n * Factory for callbacks for delete variable dropdown menu option\n * associated with a variable getter block.\n * @param {!Block} block The block with the variable to delete.\n * @return {!function()} A function that deletes the variable.\n */\nconst deleteOptionCallbackFactory = function(block) {\n return function() {\n const workspace = block.workspace;\n const variable = block.getField('VAR').getVariable();\n workspace.deleteVariableById(variable.getId());\n workspace.refreshToolboxSelection();\n };\n};\n\nExtensions.registerMixin(\n 'contextMenu_variableDynamicSetterGetter',\n CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Variable blocks for Blockly.\n * @suppress {checkTypes}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.variables');\n\nconst ContextMenu = goog.require('Blockly.ContextMenu');\nconst Extensions = goog.require('Blockly.Extensions');\nconst Variables = goog.require('Blockly.Variables');\nconst xmlUtils = goog.require('Blockly.utils.xml');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {Msg} = goog.require('Blockly.Msg');\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldLabel');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldVariable');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for variable getter.\n {\n 'type': 'variables_get',\n 'message0': '%1',\n 'args0': [\n {\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': '%{BKY_VARIABLES_DEFAULT_NAME}',\n },\n ],\n 'output': null,\n 'style': 'variable_blocks',\n 'helpUrl': '%{BKY_VARIABLES_GET_HELPURL}',\n 'tooltip': '%{BKY_VARIABLES_GET_TOOLTIP}',\n 'extensions': ['contextMenu_variableSetterGetter'],\n },\n // Block for variable setter.\n {\n 'type': 'variables_set',\n 'message0': '%{BKY_VARIABLES_SET}',\n 'args0': [\n {\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': '%{BKY_VARIABLES_DEFAULT_NAME}',\n },\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n },\n ],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'variable_blocks',\n 'tooltip': '%{BKY_VARIABLES_SET_TOOLTIP}',\n 'helpUrl': '%{BKY_VARIABLES_SET_HELPURL}',\n 'extensions': ['contextMenu_variableSetterGetter'],\n },\n]);\nexports.blocks = blocks;\n\n\n/**\n * Mixin to add context menu items to create getter/setter blocks for this\n * setter/getter.\n * Used by blocks 'variables_set' and 'variables_get'.\n * @mixin\n * @augments Block\n * @package\n * @readonly\n */\nconst CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = {\n /**\n * Add menu option to create getter/setter block for this setter/getter.\n * @param {!Array} options List of menu options to add to.\n * @this {Block}\n */\n customContextMenu: function(options) {\n if (!this.isInFlyout) {\n let oppositeType;\n let contextMenuMsg;\n // Getter blocks have the option to create a setter block, and vice versa.\n if (this.type === 'variables_get') {\n oppositeType = 'variables_set';\n contextMenuMsg = Msg['VARIABLES_GET_CREATE_SET'];\n } else {\n oppositeType = 'variables_get';\n contextMenuMsg = Msg['VARIABLES_SET_CREATE_GET'];\n }\n\n const option = {enabled: this.workspace.remainingCapacity() > 0};\n const name = this.getField('VAR').getText();\n option.text = contextMenuMsg.replace('%1', name);\n const xmlField = xmlUtils.createElement('field');\n xmlField.setAttribute('name', 'VAR');\n xmlField.appendChild(xmlUtils.createTextNode(name));\n const xmlBlock = xmlUtils.createElement('block');\n xmlBlock.setAttribute('type', oppositeType);\n xmlBlock.appendChild(xmlField);\n option.callback = ContextMenu.callbackFactory(this, xmlBlock);\n options.push(option);\n // Getter blocks have the option to rename or delete that variable.\n } else {\n if (this.type === 'variables_get' ||\n this.type === 'variables_get_reporter') {\n const renameOption = {\n text: Msg['RENAME_VARIABLE'],\n enabled: true,\n callback: renameOptionCallbackFactory(this),\n };\n const name = this.getField('VAR').getText();\n const deleteOption = {\n text: Msg['DELETE_VARIABLE'].replace('%1', name),\n enabled: true,\n callback: deleteOptionCallbackFactory(this),\n };\n options.unshift(renameOption);\n options.unshift(deleteOption);\n }\n }\n },\n};\n\n/**\n * Factory for callbacks for rename variable dropdown menu option\n * associated with a variable getter block.\n * @param {!Block} block The block with the variable to rename.\n * @return {!function()} A function that renames the variable.\n */\nconst renameOptionCallbackFactory = function(block) {\n return function() {\n const workspace = block.workspace;\n const variable = block.getField('VAR').getVariable();\n Variables.renameVariable(workspace, variable);\n };\n};\n\n/**\n * Factory for callbacks for delete variable dropdown menu option\n * associated with a variable getter block.\n * @param {!Block} block The block with the variable to delete.\n * @return {!function()} A function that deletes the variable.\n */\nconst deleteOptionCallbackFactory = function(block) {\n return function() {\n const workspace = block.workspace;\n const variable = block.getField('VAR').getVariable();\n workspace.deleteVariableById(variable.getId());\n workspace.refreshToolboxSelection();\n };\n};\n\nExtensions.registerMixin(\n 'contextMenu_variableSetterGetter',\n CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Text blocks for Blockly.\n * @suppress {checkTypes}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.texts');\n\nconst Extensions = goog.require('Blockly.Extensions');\nconst {Msg} = goog.require('Blockly.Msg');\n/* eslint-disable-next-line no-unused-vars */\nconst xmlUtils = goog.require('Blockly.utils.xml');\nconst {Align} = goog.require('Blockly.Input');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {ConnectionType} = goog.require('Blockly.ConnectionType');\nconst {FieldDropdown} = goog.require('Blockly.FieldDropdown');\nconst {FieldImage} = goog.require('Blockly.FieldImage');\nconst {FieldTextInput} = goog.require('Blockly.FieldTextInput');\nconst {Mutator} = goog.require('Blockly.Mutator');\n/* eslint-disable-next-line no-unused-vars */\nconst {Workspace} = goog.requireType('Blockly.Workspace');\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldMultilineInput');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldVariable');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for text value\n {\n 'type': 'text',\n 'message0': '%1',\n 'args0': [{\n 'type': 'field_input',\n 'name': 'TEXT',\n 'text': '',\n }],\n 'output': 'String',\n 'style': 'text_blocks',\n 'helpUrl': '%{BKY_TEXT_TEXT_HELPURL}',\n 'tooltip': '%{BKY_TEXT_TEXT_TOOLTIP}',\n 'extensions': [\n 'text_quotes',\n 'parent_tooltip_when_inline',\n ],\n },\n {\n 'type': 'text_multiline',\n 'message0': '%1 %2',\n 'args0': [\n {\n 'type': 'field_image',\n 'src':\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpP' +\n 'U2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0' +\n 'U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjm' +\n 'RIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z88' +\n '73zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5luj' +\n 'nYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiD' +\n 'MYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYX' +\n 'fwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4z' +\n 'wA5X2Z9AYnQrEAAAAASUVORK5CYII=',\n 'width': 12,\n 'height': 17,\n 'alt': '\\u00B6',\n },\n {\n 'type': 'field_multilinetext',\n 'name': 'TEXT',\n 'text': '',\n },\n ],\n 'output': 'String',\n 'style': 'text_blocks',\n 'helpUrl': '%{BKY_TEXT_TEXT_HELPURL}',\n 'tooltip': '%{BKY_TEXT_TEXT_TOOLTIP}',\n 'extensions': [\n 'parent_tooltip_when_inline',\n ],\n },\n {\n 'type': 'text_join',\n 'message0': '',\n 'output': 'String',\n 'style': 'text_blocks',\n 'helpUrl': '%{BKY_TEXT_JOIN_HELPURL}',\n 'tooltip': '%{BKY_TEXT_JOIN_TOOLTIP}',\n 'mutator': 'text_join_mutator',\n\n },\n {\n 'type': 'text_create_join_container',\n 'message0': '%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2',\n 'args0': [\n {\n 'type': 'input_dummy',\n },\n {\n 'type': 'input_statement',\n 'name': 'STACK',\n },\n ],\n 'style': 'text_blocks',\n 'tooltip': '%{BKY_TEXT_CREATE_JOIN_TOOLTIP}',\n 'enableContextMenu': false,\n },\n {\n 'type': 'text_create_join_item',\n 'message0': '%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}',\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'text_blocks',\n 'tooltip': '%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}',\n 'enableContextMenu': false,\n },\n {\n 'type': 'text_append',\n 'message0': '%{BKY_TEXT_APPEND_TITLE}',\n 'args0': [\n {\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': '%{BKY_TEXT_APPEND_VARIABLE}',\n },\n {\n 'type': 'input_value',\n 'name': 'TEXT',\n },\n ],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'text_blocks',\n 'extensions': [\n 'text_append_tooltip',\n ],\n },\n {\n 'type': 'text_length',\n 'message0': '%{BKY_TEXT_LENGTH_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n 'check': ['String', 'Array'],\n },\n ],\n 'output': 'Number',\n 'style': 'text_blocks',\n 'tooltip': '%{BKY_TEXT_LENGTH_TOOLTIP}',\n 'helpUrl': '%{BKY_TEXT_LENGTH_HELPURL}',\n },\n {\n 'type': 'text_isEmpty',\n 'message0': '%{BKY_TEXT_ISEMPTY_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n 'check': ['String', 'Array'],\n },\n ],\n 'output': 'Boolean',\n 'style': 'text_blocks',\n 'tooltip': '%{BKY_TEXT_ISEMPTY_TOOLTIP}',\n 'helpUrl': '%{BKY_TEXT_ISEMPTY_HELPURL}',\n },\n {\n 'type': 'text_indexOf',\n 'message0': '%{BKY_TEXT_INDEXOF_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n 'check': 'String',\n },\n {\n 'type': 'field_dropdown',\n 'name': 'END',\n 'options': [\n [\n '%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}',\n 'FIRST',\n ],\n [\n '%{BKY_TEXT_INDEXOF_OPERATOR_LAST}',\n 'LAST',\n ],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'FIND',\n 'check': 'String',\n },\n ],\n 'output': 'Number',\n 'style': 'text_blocks',\n 'helpUrl': '%{BKY_TEXT_INDEXOF_HELPURL}',\n 'inputsInline': true,\n 'extensions': [\n 'text_indexOf_tooltip',\n ],\n },\n {\n 'type': 'text_charAt',\n 'message0': '%{BKY_TEXT_CHARAT_TITLE}', // \"in text %1 %2\"\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n 'check': 'String',\n },\n {\n 'type': 'field_dropdown',\n 'name': 'WHERE',\n 'options': [\n ['%{BKY_TEXT_CHARAT_FROM_START}', 'FROM_START'],\n ['%{BKY_TEXT_CHARAT_FROM_END}', 'FROM_END'],\n ['%{BKY_TEXT_CHARAT_FIRST}', 'FIRST'],\n ['%{BKY_TEXT_CHARAT_LAST}', 'LAST'],\n ['%{BKY_TEXT_CHARAT_RANDOM}', 'RANDOM'],\n ],\n },\n ],\n 'output': 'String',\n 'style': 'text_blocks',\n 'helpUrl': '%{BKY_TEXT_CHARAT_HELPURL}',\n 'inputsInline': true,\n 'mutator': 'text_charAt_mutator',\n },\n]);\nexports.blocks = blocks;\n\nblocks['text_getSubstring'] = {\n /**\n * Block for getting substring.\n * @this {Block}\n */\n init: function() {\n this['WHERE_OPTIONS_1'] = [\n [Msg['TEXT_GET_SUBSTRING_START_FROM_START'], 'FROM_START'],\n [Msg['TEXT_GET_SUBSTRING_START_FROM_END'], 'FROM_END'],\n [Msg['TEXT_GET_SUBSTRING_START_FIRST'], 'FIRST'],\n ];\n this['WHERE_OPTIONS_2'] = [\n [Msg['TEXT_GET_SUBSTRING_END_FROM_START'], 'FROM_START'],\n [Msg['TEXT_GET_SUBSTRING_END_FROM_END'], 'FROM_END'],\n [Msg['TEXT_GET_SUBSTRING_END_LAST'], 'LAST'],\n ];\n this.setHelpUrl(Msg['TEXT_GET_SUBSTRING_HELPURL']);\n this.setStyle('text_blocks');\n this.appendValueInput('STRING').setCheck('String').appendField(\n Msg['TEXT_GET_SUBSTRING_INPUT_IN_TEXT']);\n this.appendDummyInput('AT1');\n this.appendDummyInput('AT2');\n if (Msg['TEXT_GET_SUBSTRING_TAIL']) {\n this.appendDummyInput('TAIL').appendField(Msg['TEXT_GET_SUBSTRING_TAIL']);\n }\n this.setInputsInline(true);\n this.setOutput(true, 'String');\n this.updateAt_(1, true);\n this.updateAt_(2, true);\n this.setTooltip(Msg['TEXT_GET_SUBSTRING_TOOLTIP']);\n },\n /**\n * Create XML to represent whether there are 'AT' inputs.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n const isAt1 = this.getInput('AT1').type === ConnectionType.INPUT_VALUE;\n container.setAttribute('at1', isAt1);\n const isAt2 = this.getInput('AT2').type === ConnectionType.INPUT_VALUE;\n container.setAttribute('at2', isAt2);\n return container;\n },\n /**\n * Parse XML to restore the 'AT' inputs.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n const isAt1 = (xmlElement.getAttribute('at1') === 'true');\n const isAt2 = (xmlElement.getAttribute('at2') === 'true');\n this.updateAt_(1, isAt1);\n this.updateAt_(2, isAt2);\n },\n\n // This block does not need JSO serialization hooks (saveExtraState and\n // loadExtraState) because the state of this object is already encoded in the\n // dropdown values.\n // XML hooks are kept for backwards compatibility.\n\n /**\n * Create or delete an input for a numeric index.\n * This block has two such inputs, independent of each other.\n * @param {number} n Specify first or second input (1 or 2).\n * @param {boolean} isAt True if the input should exist.\n * @private\n * @this {Block}\n */\n updateAt_: function(n, isAt) {\n // Create or delete an input for the numeric index.\n // Destroy old 'AT' and 'ORDINAL' inputs.\n this.removeInput('AT' + n);\n this.removeInput('ORDINAL' + n, true);\n // Create either a value 'AT' input or a dummy input.\n if (isAt) {\n this.appendValueInput('AT' + n).setCheck('Number');\n if (Msg['ORDINAL_NUMBER_SUFFIX']) {\n this.appendDummyInput('ORDINAL' + n)\n .appendField(Msg['ORDINAL_NUMBER_SUFFIX']);\n }\n } else {\n this.appendDummyInput('AT' + n);\n }\n // Move tail, if present, to end of block.\n if (n === 2 && Msg['TEXT_GET_SUBSTRING_TAIL']) {\n this.removeInput('TAIL', true);\n this.appendDummyInput('TAIL').appendField(Msg['TEXT_GET_SUBSTRING_TAIL']);\n }\n const menu = new FieldDropdown(\n this['WHERE_OPTIONS_' + n],\n /**\n * @param {*} value The input value.\n * @this {FieldDropdown}\n * @return {null|undefined} Null if the field has been replaced;\n * otherwise undefined.\n */\n function(value) {\n const newAt = (value === 'FROM_START') || (value === 'FROM_END');\n // The 'isAt' variable is available due to this function being a\n // closure.\n if (newAt !== isAt) {\n const block = this.getSourceBlock();\n block.updateAt_(n, newAt);\n // This menu has been destroyed and replaced.\n // Update the replacement.\n block.setFieldValue(value, 'WHERE' + n);\n return null;\n }\n return undefined;\n });\n\n this.getInput('AT' + n).appendField(menu, 'WHERE' + n);\n if (n === 1) {\n this.moveInputBefore('AT1', 'AT2');\n if (this.getInput('ORDINAL1')) {\n this.moveInputBefore('ORDINAL1', 'AT2');\n }\n }\n },\n};\n\nblocks['text_changeCase'] = {\n /**\n * Block for changing capitalization.\n * @this {Block}\n */\n init: function() {\n const OPERATORS = [\n [Msg['TEXT_CHANGECASE_OPERATOR_UPPERCASE'], 'UPPERCASE'],\n [Msg['TEXT_CHANGECASE_OPERATOR_LOWERCASE'], 'LOWERCASE'],\n [Msg['TEXT_CHANGECASE_OPERATOR_TITLECASE'], 'TITLECASE'],\n ];\n this.setHelpUrl(Msg['TEXT_CHANGECASE_HELPURL']);\n this.setStyle('text_blocks');\n this.appendValueInput('TEXT').setCheck('String').appendField(\n new FieldDropdown(OPERATORS), 'CASE');\n this.setOutput(true, 'String');\n this.setTooltip(Msg['TEXT_CHANGECASE_TOOLTIP']);\n },\n};\n\nblocks['text_trim'] = {\n /**\n * Block for trimming spaces.\n * @this {Block}\n */\n init: function() {\n const OPERATORS = [\n [Msg['TEXT_TRIM_OPERATOR_BOTH'], 'BOTH'],\n [Msg['TEXT_TRIM_OPERATOR_LEFT'], 'LEFT'],\n [Msg['TEXT_TRIM_OPERATOR_RIGHT'], 'RIGHT'],\n ];\n this.setHelpUrl(Msg['TEXT_TRIM_HELPURL']);\n this.setStyle('text_blocks');\n this.appendValueInput('TEXT').setCheck('String').appendField(\n new FieldDropdown(OPERATORS), 'MODE');\n this.setOutput(true, 'String');\n this.setTooltip(Msg['TEXT_TRIM_TOOLTIP']);\n },\n};\n\nblocks['text_print'] = {\n /**\n * Block for print statement.\n * @this {Block}\n */\n init: function() {\n this.jsonInit({\n 'message0': Msg['TEXT_PRINT_TITLE'],\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'TEXT',\n },\n ],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'text_blocks',\n 'tooltip': Msg['TEXT_PRINT_TOOLTIP'],\n 'helpUrl': Msg['TEXT_PRINT_HELPURL'],\n });\n },\n};\n\n\n/**\n * Common properties for the text_prompt_ext and text_prompt blocks\n * definitions.\n */\nconst TEXT_PROMPT_COMMON = {\n /**\n * Modify this block to have the correct output type.\n * @param {string} newOp Either 'TEXT' or 'NUMBER'.\n * @private\n * @this {Block}\n */\n updateType_: function(newOp) {\n this.outputConnection.setCheck(newOp === 'NUMBER' ? 'Number' : 'String');\n },\n /**\n * Create XML to represent the output type.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('type', this.getFieldValue('TYPE'));\n return container;\n },\n /**\n * Parse XML to restore the output type.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n this.updateType_(xmlElement.getAttribute('type'));\n },\n};\n\nblocks['text_prompt_ext'] = {\n ...TEXT_PROMPT_COMMON,\n /**\n * Block for prompt function (external message).\n * @this {Block}\n */\n init: function() {\n const TYPES = [\n [Msg['TEXT_PROMPT_TYPE_TEXT'], 'TEXT'],\n [Msg['TEXT_PROMPT_TYPE_NUMBER'], 'NUMBER'],\n ];\n this.setHelpUrl(Msg['TEXT_PROMPT_HELPURL']);\n this.setStyle('text_blocks');\n // Assign 'this' to a variable for use in the closures below.\n const thisBlock = this;\n const dropdown = new FieldDropdown(TYPES, function(newOp) {\n thisBlock.updateType_(newOp);\n });\n this.appendValueInput('TEXT').appendField(dropdown, 'TYPE');\n this.setOutput(true, 'String');\n this.setTooltip(function() {\n return (thisBlock.getFieldValue('TYPE') === 'TEXT') ?\n Msg['TEXT_PROMPT_TOOLTIP_TEXT'] :\n Msg['TEXT_PROMPT_TOOLTIP_NUMBER'];\n });\n },\n\n // This block does not need JSO serialization hooks (saveExtraState and\n // loadExtraState) because the state of this object is already encoded in the\n // dropdown values.\n // XML hooks are kept for backwards compatibility.\n};\n\nblocks['text_prompt'] = {\n ...TEXT_PROMPT_COMMON,\n /**\n * Block for prompt function (internal message).\n * The 'text_prompt_ext' block is preferred as it is more flexible.\n * @this {Block}\n */\n init: function() {\n this.mixin(QUOTE_IMAGE_MIXIN);\n const TYPES = [\n [Msg['TEXT_PROMPT_TYPE_TEXT'], 'TEXT'],\n [Msg['TEXT_PROMPT_TYPE_NUMBER'], 'NUMBER'],\n ];\n\n // Assign 'this' to a variable for use in the closures below.\n const thisBlock = this;\n this.setHelpUrl(Msg['TEXT_PROMPT_HELPURL']);\n this.setStyle('text_blocks');\n const dropdown = new FieldDropdown(TYPES, function(newOp) {\n thisBlock.updateType_(newOp);\n });\n this.appendDummyInput()\n .appendField(dropdown, 'TYPE')\n .appendField(this.newQuote_(true))\n .appendField(new FieldTextInput(''), 'TEXT')\n .appendField(this.newQuote_(false));\n this.setOutput(true, 'String');\n this.setTooltip(function() {\n return (thisBlock.getFieldValue('TYPE') === 'TEXT') ?\n Msg['TEXT_PROMPT_TOOLTIP_TEXT'] :\n Msg['TEXT_PROMPT_TOOLTIP_NUMBER'];\n });\n },\n};\n\nblocks['text_count'] = {\n /**\n * Block for counting how many times one string appears within another string.\n * @this {Block}\n */\n init: function() {\n this.jsonInit({\n 'message0': Msg['TEXT_COUNT_MESSAGE0'],\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'SUB',\n 'check': 'String',\n },\n {\n 'type': 'input_value',\n 'name': 'TEXT',\n 'check': 'String',\n },\n ],\n 'output': 'Number',\n 'inputsInline': true,\n 'style': 'text_blocks',\n 'tooltip': Msg['TEXT_COUNT_TOOLTIP'],\n 'helpUrl': Msg['TEXT_COUNT_HELPURL'],\n });\n },\n};\n\nblocks['text_replace'] = {\n /**\n * Block for replacing one string with another in the text.\n * @this {Block}\n */\n init: function() {\n this.jsonInit({\n 'message0': Msg['TEXT_REPLACE_MESSAGE0'],\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'FROM',\n 'check': 'String',\n },\n {\n 'type': 'input_value',\n 'name': 'TO',\n 'check': 'String',\n },\n {\n 'type': 'input_value',\n 'name': 'TEXT',\n 'check': 'String',\n },\n ],\n 'output': 'String',\n 'inputsInline': true,\n 'style': 'text_blocks',\n 'tooltip': Msg['TEXT_REPLACE_TOOLTIP'],\n 'helpUrl': Msg['TEXT_REPLACE_HELPURL'],\n });\n },\n};\n\nblocks['text_reverse'] = {\n /**\n * Block for reversing a string.\n * @this {Block}\n */\n init: function() {\n this.jsonInit({\n 'message0': Msg['TEXT_REVERSE_MESSAGE0'],\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'TEXT',\n 'check': 'String',\n },\n ],\n 'output': 'String',\n 'inputsInline': true,\n 'style': 'text_blocks',\n 'tooltip': Msg['TEXT_REVERSE_TOOLTIP'],\n 'helpUrl': Msg['TEXT_REVERSE_HELPURL'],\n });\n },\n};\n\n/**\n * @mixin\n * @package\n * @readonly\n */\nconst QUOTE_IMAGE_MIXIN = {\n /**\n * Image data URI of an LTR opening double quote (same as RTL closing double\n * quote).\n * @readonly\n */\n QUOTE_IMAGE_LEFT_DATAURI:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAA' +\n 'n0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY' +\n '1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1' +\n 'HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMf' +\n 'z9AylsaRRgGzvZAAAAAElFTkSuQmCC',\n /**\n * Image data URI of an LTR closing double quote (same as RTL opening double\n * quote).\n * @readonly\n */\n QUOTE_IMAGE_RIGHT_DATAURI:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAA' +\n 'qUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhg' +\n 'gONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvB' +\n 'O3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5Aos' +\n 'lLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==',\n /**\n * Pixel width of QUOTE_IMAGE_LEFT_DATAURI and QUOTE_IMAGE_RIGHT_DATAURI.\n * @readonly\n */\n QUOTE_IMAGE_WIDTH: 12,\n /**\n * Pixel height of QUOTE_IMAGE_LEFT_DATAURI and QUOTE_IMAGE_RIGHT_DATAURI.\n * @readonly\n */\n QUOTE_IMAGE_HEIGHT: 12,\n\n /**\n * Inserts appropriate quote images before and after the named field.\n * @param {string} fieldName The name of the field to wrap with quotes.\n * @this {Block}\n */\n quoteField_: function(fieldName) {\n for (let i = 0, input; (input = this.inputList[i]); i++) {\n for (let j = 0, field; (field = input.fieldRow[j]); j++) {\n if (fieldName === field.name) {\n input.insertFieldAt(j, this.newQuote_(true));\n input.insertFieldAt(j + 2, this.newQuote_(false));\n return;\n }\n }\n }\n console.warn(\n 'field named \"' + fieldName + '\" not found in ' + this.toDevString());\n },\n\n /**\n * A helper function that generates a FieldImage of an opening or\n * closing double quote. The selected quote will be adapted for RTL blocks.\n * @param {boolean} open If the image should be open quote (“ in LTR).\n * Otherwise, a closing quote is used (” in LTR).\n * @return {!FieldImage} The new field.\n * @this {Block}\n */\n newQuote_: function(open) {\n const isLeft = this.RTL ? !open : open;\n const dataUri =\n isLeft ? this.QUOTE_IMAGE_LEFT_DATAURI : this.QUOTE_IMAGE_RIGHT_DATAURI;\n return new FieldImage(\n dataUri, this.QUOTE_IMAGE_WIDTH, this.QUOTE_IMAGE_HEIGHT,\n isLeft ? '\\u201C' : '\\u201D');\n },\n};\n\n/**\n * Wraps TEXT field with images of double quote characters.\n * @this {Block}\n */\nconst TEXT_QUOTES_EXTENSION = function() {\n this.mixin(QUOTE_IMAGE_MIXIN);\n this.quoteField_('TEXT');\n};\n\n/**\n * Mixin for mutator functions in the 'text_join_mutator' extension.\n * @mixin\n * @augments Block\n * @package\n */\nconst TEXT_JOIN_MUTATOR_MIXIN = {\n /**\n * Create XML to represent number of text inputs.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('items', this.itemCount_);\n return container;\n },\n /**\n * Parse XML to restore the text inputs.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);\n this.updateShape_();\n },\n /**\n * Returns the state of this block as a JSON serializable object.\n * @return {{itemCount: number}} The state of this block, ie the item count.\n */\n saveExtraState: function() {\n return {\n 'itemCount': this.itemCount_,\n };\n },\n /**\n * Applies the given state to this block.\n * @param {*} state The state to apply to this block, ie the item count.\n */\n loadExtraState: function(state) {\n this.itemCount_ = state['itemCount'];\n this.updateShape_();\n },\n /**\n * Populate the mutator's dialog with this block's components.\n * @param {!Workspace} workspace Mutator's workspace.\n * @return {!Block} Root block in mutator.\n * @this {Block}\n */\n decompose: function(workspace) {\n const containerBlock = workspace.newBlock('text_create_join_container');\n containerBlock.initSvg();\n let connection = containerBlock.getInput('STACK').connection;\n for (let i = 0; i < this.itemCount_; i++) {\n const itemBlock = workspace.newBlock('text_create_join_item');\n itemBlock.initSvg();\n connection.connect(itemBlock.previousConnection);\n connection = itemBlock.nextConnection;\n }\n return containerBlock;\n },\n /**\n * Reconfigure this block based on the mutator dialog's components.\n * @param {!Block} containerBlock Root block in mutator.\n * @this {Block}\n */\n compose: function(containerBlock) {\n let itemBlock = containerBlock.getInputTargetBlock('STACK');\n // Count number of inputs.\n const connections = [];\n while (itemBlock) {\n if (itemBlock.isInsertionMarker()) {\n itemBlock = itemBlock.getNextBlock();\n continue;\n }\n connections.push(itemBlock.valueConnection_);\n itemBlock = itemBlock.getNextBlock();\n }\n // Disconnect any children that don't belong.\n for (let i = 0; i < this.itemCount_; i++) {\n const connection = this.getInput('ADD' + i).connection.targetConnection;\n if (connection && connections.indexOf(connection) === -1) {\n connection.disconnect();\n }\n }\n this.itemCount_ = connections.length;\n this.updateShape_();\n // Reconnect any child blocks.\n for (let i = 0; i < this.itemCount_; i++) {\n Mutator.reconnect(connections[i], this, 'ADD' + i);\n }\n },\n /**\n * Store pointers to any connected child blocks.\n * @param {!Block} containerBlock Root block in mutator.\n * @this {Block}\n */\n saveConnections: function(containerBlock) {\n let itemBlock = containerBlock.getInputTargetBlock('STACK');\n let i = 0;\n while (itemBlock) {\n if (itemBlock.isInsertionMarker()) {\n itemBlock = itemBlock.getNextBlock();\n continue;\n }\n const input = this.getInput('ADD' + i);\n itemBlock.valueConnection_ = input && input.connection.targetConnection;\n itemBlock = itemBlock.getNextBlock();\n i++;\n }\n },\n /**\n * Modify this block to have the correct number of inputs.\n * @private\n * @this {Block}\n */\n updateShape_: function() {\n if (this.itemCount_ && this.getInput('EMPTY')) {\n this.removeInput('EMPTY');\n } else if (!this.itemCount_ && !this.getInput('EMPTY')) {\n this.appendDummyInput('EMPTY')\n .appendField(this.newQuote_(true))\n .appendField(this.newQuote_(false));\n }\n // Add new inputs.\n for (let i = 0; i < this.itemCount_; i++) {\n if (!this.getInput('ADD' + i)) {\n const input = this.appendValueInput('ADD' + i).setAlign(Align.RIGHT);\n if (i === 0) {\n input.appendField(Msg['TEXT_JOIN_TITLE_CREATEWITH']);\n }\n }\n }\n // Remove deleted inputs.\n for (let i = this.itemCount_; this.getInput('ADD' + i); i++) {\n this.removeInput('ADD' + i);\n }\n },\n};\n\n/**\n * Performs final setup of a text_join block.\n * @this {Block}\n */\nconst TEXT_JOIN_EXTENSION = function() {\n // Add the quote mixin for the itemCount_ = 0 case.\n this.mixin(QUOTE_IMAGE_MIXIN);\n // Initialize the mutator values.\n this.itemCount_ = 2;\n this.updateShape_();\n // Configure the mutator UI.\n this.setMutator(new Mutator(['text_create_join_item'], this));\n};\n\n// Update the tooltip of 'text_append' block to reference the variable.\nExtensions.register(\n 'text_append_tooltip',\n Extensions.buildTooltipWithFieldText('%{BKY_TEXT_APPEND_TOOLTIP}', 'VAR'));\n\n/**\n * Update the tooltip of 'text_append' block to reference the variable.\n * @this {Block}\n */\nconst TEXT_INDEXOF_TOOLTIP_EXTENSION = function() {\n // Assign 'this' to a variable for use in the tooltip closure below.\n const thisBlock = this;\n this.setTooltip(function() {\n return Msg['TEXT_INDEXOF_TOOLTIP'].replace(\n '%1', thisBlock.workspace.options.oneBasedIndex ? '0' : '-1');\n });\n};\n\n/**\n * Mixin for mutator functions in the 'text_charAt_mutator' extension.\n * @mixin\n * @augments Block\n * @package\n */\nconst TEXT_CHARAT_MUTATOR_MIXIN = {\n /**\n * Create XML to represent whether there is an 'AT' input.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('at', !!this.isAt_);\n return container;\n },\n /**\n * Parse XML to restore the 'AT' input.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n // Note: Until January 2013 this block did not have mutations,\n // so 'at' defaults to true.\n const isAt = (xmlElement.getAttribute('at') !== 'false');\n this.updateAt_(isAt);\n },\n\n // This block does not need JSO serialization hooks (saveExtraState and\n // loadExtraState) because the state of this object is already encoded in the\n // dropdown values.\n // XML hooks are kept for backwards compatibility.\n\n /**\n * Create or delete an input for the numeric index.\n * @param {boolean} isAt True if the input should exist.\n * @private\n * @this {Block}\n */\n updateAt_: function(isAt) {\n // Destroy old 'AT' and 'ORDINAL' inputs.\n this.removeInput('AT', true);\n this.removeInput('ORDINAL', true);\n // Create either a value 'AT' input or a dummy input.\n if (isAt) {\n this.appendValueInput('AT').setCheck('Number');\n if (Msg['ORDINAL_NUMBER_SUFFIX']) {\n this.appendDummyInput('ORDINAL').appendField(\n Msg['ORDINAL_NUMBER_SUFFIX']);\n }\n }\n if (Msg['TEXT_CHARAT_TAIL']) {\n this.removeInput('TAIL', true);\n this.appendDummyInput('TAIL').appendField(Msg['TEXT_CHARAT_TAIL']);\n }\n\n this.isAt_ = isAt;\n },\n};\n\n/**\n * Does the initial mutator update of text_charAt and adds the tooltip\n * @this {Block}\n */\nconst TEXT_CHARAT_EXTENSION = function() {\n const dropdown = this.getField('WHERE');\n dropdown.setValidator(\n /**\n * @param {*} value The input value.\n * @this {FieldDropdown}\n */\n function(value) {\n const newAt = (value === 'FROM_START') || (value === 'FROM_END');\n if (newAt !== this.isAt_) {\n const block = this.getSourceBlock();\n block.updateAt_(newAt);\n }\n });\n this.updateAt_(true);\n // Assign 'this' to a variable for use in the tooltip closure below.\n const thisBlock = this;\n this.setTooltip(function() {\n const where = thisBlock.getFieldValue('WHERE');\n let tooltip = Msg['TEXT_CHARAT_TOOLTIP'];\n if (where === 'FROM_START' || where === 'FROM_END') {\n const msg = (where === 'FROM_START') ?\n Msg['LISTS_INDEX_FROM_START_TOOLTIP'] :\n Msg['LISTS_INDEX_FROM_END_TOOLTIP'];\n if (msg) {\n tooltip += ' ' +\n msg.replace(\n '%1', thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');\n }\n }\n return tooltip;\n });\n};\n\nExtensions.register('text_indexOf_tooltip', TEXT_INDEXOF_TOOLTIP_EXTENSION);\n\nExtensions.register('text_quotes', TEXT_QUOTES_EXTENSION);\n\nExtensions.registerMutator(\n 'text_join_mutator', TEXT_JOIN_MUTATOR_MIXIN, TEXT_JOIN_EXTENSION);\n\nExtensions.registerMutator(\n 'text_charAt_mutator', TEXT_CHARAT_MUTATOR_MIXIN, TEXT_CHARAT_EXTENSION);\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Procedure blocks for Blockly.\n * @suppress {checkTypes|visibility}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.procedures');\n\n/* eslint-disable-next-line no-unused-vars */\nconst AbstractEvent = goog.requireType('Blockly.Events.Abstract');\nconst ContextMenu = goog.require('Blockly.ContextMenu');\nconst Events = goog.require('Blockly.Events');\nconst Procedures = goog.require('Blockly.Procedures');\nconst Variables = goog.require('Blockly.Variables');\nconst Xml = goog.require('Blockly.Xml');\nconst xmlUtils = goog.require('Blockly.utils.xml');\nconst {Align} = goog.require('Blockly.Input');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {config} = goog.require('Blockly.config');\n/* eslint-disable-next-line no-unused-vars */\nconst {FieldCheckbox} = goog.require('Blockly.FieldCheckbox');\nconst {FieldLabel} = goog.require('Blockly.FieldLabel');\nconst {FieldTextInput} = goog.require('Blockly.FieldTextInput');\nconst {Msg} = goog.require('Blockly.Msg');\nconst {Mutator} = goog.require('Blockly.Mutator');\nconst {Names} = goog.require('Blockly.Names');\n/* eslint-disable-next-line no-unused-vars */\nconst {VariableModel} = goog.requireType('Blockly.VariableModel');\n/* eslint-disable-next-line no-unused-vars */\nconst {Workspace} = goog.requireType('Blockly.Workspace');\nconst {defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.Comment');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.Warning');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = {};\nexports.blocks = blocks;\n\n/**\n * Common properties for the procedure_defnoreturn and\n * procedure_defreturn blocks.\n */\nconst PROCEDURE_DEF_COMMON = {\n /**\n * Add or remove the statement block from this function definition.\n * @param {boolean} hasStatements True if a statement block is needed.\n * @this {Block}\n */\n setStatements_: function(hasStatements) {\n if (this.hasStatements_ === hasStatements) {\n return;\n }\n if (hasStatements) {\n this.appendStatementInput('STACK').appendField(\n Msg['PROCEDURES_DEFNORETURN_DO']);\n if (this.getInput('RETURN')) {\n this.moveInputBefore('STACK', 'RETURN');\n }\n } else {\n this.removeInput('STACK', true);\n }\n this.hasStatements_ = hasStatements;\n },\n /**\n * Update the display of parameters for this procedure definition block.\n * @private\n * @this {Block}\n */\n updateParams_: function() {\n // Merge the arguments into a human-readable list.\n let paramString = '';\n if (this.arguments_.length) {\n paramString =\n Msg['PROCEDURES_BEFORE_PARAMS'] + ' ' + this.arguments_.join(', ');\n }\n // The params field is deterministic based on the mutation,\n // no need to fire a change event.\n Events.disable();\n try {\n this.setFieldValue(paramString, 'PARAMS');\n } finally {\n Events.enable();\n }\n },\n /**\n * Create XML to represent the argument inputs.\n * Backwards compatible serialization implementation.\n * @param {boolean=} opt_paramIds If true include the IDs of the parameter\n * quarks. Used by Procedures.mutateCallers for reconnection.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function(opt_paramIds) {\n const container = xmlUtils.createElement('mutation');\n if (opt_paramIds) {\n container.setAttribute('name', this.getFieldValue('NAME'));\n }\n for (let i = 0; i < this.argumentVarModels_.length; i++) {\n const parameter = xmlUtils.createElement('arg');\n const argModel = this.argumentVarModels_[i];\n parameter.setAttribute('name', argModel.name);\n parameter.setAttribute('varid', argModel.getId());\n if (opt_paramIds && this.paramIds_) {\n parameter.setAttribute('paramId', this.paramIds_[i]);\n }\n container.appendChild(parameter);\n }\n\n // Save whether the statement input is visible.\n if (!this.hasStatements_) {\n container.setAttribute('statements', 'false');\n }\n return container;\n },\n /**\n * Parse XML to restore the argument inputs.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n this.arguments_ = [];\n this.argumentVarModels_ = [];\n for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) {\n if (childNode.nodeName.toLowerCase() === 'arg') {\n const varName = childNode.getAttribute('name');\n const varId =\n childNode.getAttribute('varid') || childNode.getAttribute('varId');\n this.arguments_.push(varName);\n const variable = Variables.getOrCreateVariablePackage(\n this.workspace, varId, varName, '');\n if (variable !== null) {\n this.argumentVarModels_.push(variable);\n } else {\n console.log(\n 'Failed to create a variable with name ' + varName +\n ', ignoring.');\n }\n }\n }\n this.updateParams_();\n Procedures.mutateCallers(this);\n\n // Show or hide the statement input.\n this.setStatements_(xmlElement.getAttribute('statements') !== 'false');\n },\n /**\n * Returns the state of this block as a JSON serializable object.\n * @return {?{params: (!Array<{name: string, id: string}>|undefined),\n * hasStatements: (boolean|undefined)}} The state of this block, eg the\n * parameters and statements.\n */\n saveExtraState: function() {\n if (!this.argumentVarModels_.length && this.hasStatements_) {\n return null;\n }\n const state = Object.create(null);\n if (this.argumentVarModels_.length) {\n state['params'] = [];\n for (let i = 0; i < this.argumentVarModels_.length; i++) {\n state['params'].push({\n // We don't need to serialize the name, but just in case we decide\n // to separate params from variables.\n 'name': this.argumentVarModels_[i].name,\n 'id': this.argumentVarModels_[i].getId(),\n });\n }\n }\n if (!this.hasStatements_) {\n state['hasStatements'] = false;\n }\n return state;\n },\n /**\n * Applies the given state to this block.\n * @param {*} state The state to apply to this block, eg the parameters and\n * statements.\n */\n loadExtraState: function(state) {\n this.arguments_ = [];\n this.argumentVarModels_ = [];\n if (state['params']) {\n for (let i = 0; i < state['params'].length; i++) {\n const param = state['params'][i];\n const variable = Variables.getOrCreateVariablePackage(\n this.workspace, param['id'], param['name'], '');\n this.arguments_.push(variable.name);\n this.argumentVarModels_.push(variable);\n }\n }\n this.updateParams_();\n Procedures.mutateCallers(this);\n this.setStatements_(state['hasStatements'] === false ? false : true);\n },\n /**\n * Populate the mutator's dialog with this block's components.\n * @param {!Workspace} workspace Mutator's workspace.\n * @return {!Block} Root block in mutator.\n * @this {Block}\n */\n decompose: function(workspace) {\n /*\n * Creates the following XML:\n * <block type=\"procedures_mutatorcontainer\">\n * <statement name=\"STACK\">\n * <block type=\"procedures_mutatorarg\">\n * <field name=\"NAME\">arg1_name</field>\n * <next>etc...</next>\n * </block>\n * </statement>\n * </block>\n */\n\n const containerBlockNode = xmlUtils.createElement('block');\n containerBlockNode.setAttribute('type', 'procedures_mutatorcontainer');\n const statementNode = xmlUtils.createElement('statement');\n statementNode.setAttribute('name', 'STACK');\n containerBlockNode.appendChild(statementNode);\n\n let node = statementNode;\n for (let i = 0; i < this.arguments_.length; i++) {\n const argBlockNode = xmlUtils.createElement('block');\n argBlockNode.setAttribute('type', 'procedures_mutatorarg');\n const fieldNode = xmlUtils.createElement('field');\n fieldNode.setAttribute('name', 'NAME');\n const argumentName = xmlUtils.createTextNode(this.arguments_[i]);\n fieldNode.appendChild(argumentName);\n argBlockNode.appendChild(fieldNode);\n const nextNode = xmlUtils.createElement('next');\n argBlockNode.appendChild(nextNode);\n\n node.appendChild(argBlockNode);\n node = nextNode;\n }\n\n const containerBlock = Xml.domToBlock(containerBlockNode, workspace);\n\n if (this.type === 'procedures_defreturn') {\n containerBlock.setFieldValue(this.hasStatements_, 'STATEMENTS');\n } else {\n containerBlock.removeInput('STATEMENT_INPUT');\n }\n\n // Initialize procedure's callers with blank IDs.\n Procedures.mutateCallers(this);\n return containerBlock;\n },\n /**\n * Reconfigure this block based on the mutator dialog's components.\n * @param {!Block} containerBlock Root block in mutator.\n * @this {Block}\n */\n compose: function(containerBlock) {\n // Parameter list.\n this.arguments_ = [];\n this.paramIds_ = [];\n this.argumentVarModels_ = [];\n let paramBlock = containerBlock.getInputTargetBlock('STACK');\n while (paramBlock && !paramBlock.isInsertionMarker()) {\n const varName = paramBlock.getFieldValue('NAME');\n this.arguments_.push(varName);\n const variable = this.workspace.getVariable(varName, '');\n this.argumentVarModels_.push(variable);\n\n this.paramIds_.push(paramBlock.id);\n paramBlock =\n paramBlock.nextConnection && paramBlock.nextConnection.targetBlock();\n }\n this.updateParams_();\n Procedures.mutateCallers(this);\n\n // Show/hide the statement input.\n let hasStatements = containerBlock.getFieldValue('STATEMENTS');\n if (hasStatements !== null) {\n hasStatements = hasStatements === 'TRUE';\n if (this.hasStatements_ !== hasStatements) {\n if (hasStatements) {\n this.setStatements_(true);\n // Restore the stack, if one was saved.\n Mutator.reconnect(this.statementConnection_, this, 'STACK');\n this.statementConnection_ = null;\n } else {\n // Save the stack, then disconnect it.\n const stackConnection = this.getInput('STACK').connection;\n this.statementConnection_ = stackConnection.targetConnection;\n if (this.statementConnection_) {\n const stackBlock = stackConnection.targetBlock();\n stackBlock.unplug();\n stackBlock.bumpNeighbours();\n }\n this.setStatements_(false);\n }\n }\n }\n },\n /**\n * Return all variables referenced by this block.\n * @return {!Array<string>} List of variable names.\n * @this {Block}\n */\n getVars: function() {\n return this.arguments_;\n },\n /**\n * Return all variables referenced by this block.\n * @return {!Array<!VariableModel>} List of variable models.\n * @this {Block}\n */\n getVarModels: function() {\n return this.argumentVarModels_;\n },\n /**\n * Notification that a variable is renaming.\n * If the ID matches one of this block's variables, rename it.\n * @param {string} oldId ID of variable to rename.\n * @param {string} newId ID of new variable. May be the same as oldId, but\n * with an updated name. Guaranteed to be the same type as the old\n * variable.\n * @override\n * @this {Block}\n */\n renameVarById: function(oldId, newId) {\n const oldVariable = this.workspace.getVariableById(oldId);\n if (oldVariable.type !== '') {\n // Procedure arguments always have the empty type.\n return;\n }\n const oldName = oldVariable.name;\n const newVar = this.workspace.getVariableById(newId);\n\n let change = false;\n for (let i = 0; i < this.argumentVarModels_.length; i++) {\n if (this.argumentVarModels_[i].getId() === oldId) {\n this.arguments_[i] = newVar.name;\n this.argumentVarModels_[i] = newVar;\n change = true;\n }\n }\n if (change) {\n this.displayRenamedVar_(oldName, newVar.name);\n Procedures.mutateCallers(this);\n }\n },\n /**\n * Notification that a variable is renaming but keeping the same ID. If the\n * variable is in use on this block, rerender to show the new name.\n * @param {!VariableModel} variable The variable being renamed.\n * @package\n * @override\n * @this {Block}\n */\n updateVarName: function(variable) {\n const newName = variable.name;\n let change = false;\n let oldName;\n for (let i = 0; i < this.argumentVarModels_.length; i++) {\n if (this.argumentVarModels_[i].getId() === variable.getId()) {\n oldName = this.arguments_[i];\n this.arguments_[i] = newName;\n change = true;\n }\n }\n if (change) {\n this.displayRenamedVar_(oldName, newName);\n Procedures.mutateCallers(this);\n }\n },\n /**\n * Update the display to reflect a newly renamed argument.\n * @param {string} oldName The old display name of the argument.\n * @param {string} newName The new display name of the argument.\n * @private\n * @this {Block}\n */\n displayRenamedVar_: function(oldName, newName) {\n this.updateParams_();\n // Update the mutator's variables if the mutator is open.\n if (this.mutator && this.mutator.isVisible()) {\n const blocks = this.mutator.workspace_.getAllBlocks(false);\n for (let i = 0, block; (block = blocks[i]); i++) {\n if (block.type === 'procedures_mutatorarg' &&\n Names.equals(oldName, block.getFieldValue('NAME'))) {\n block.setFieldValue(newName, 'NAME');\n }\n }\n }\n },\n /**\n * Add custom menu options to this block's context menu.\n * @param {!Array} options List of menu options to add to.\n * @this {Block}\n */\n customContextMenu: function(options) {\n if (this.isInFlyout) {\n return;\n }\n // Add option to create caller.\n const option = {enabled: true};\n const name = this.getFieldValue('NAME');\n option.text = Msg['PROCEDURES_CREATE_DO'].replace('%1', name);\n const xmlMutation = xmlUtils.createElement('mutation');\n xmlMutation.setAttribute('name', name);\n for (let i = 0; i < this.arguments_.length; i++) {\n const xmlArg = xmlUtils.createElement('arg');\n xmlArg.setAttribute('name', this.arguments_[i]);\n xmlMutation.appendChild(xmlArg);\n }\n const xmlBlock = xmlUtils.createElement('block');\n xmlBlock.setAttribute('type', this.callType_);\n xmlBlock.appendChild(xmlMutation);\n option.callback = ContextMenu.callbackFactory(this, xmlBlock);\n options.push(option);\n\n // Add options to create getters for each parameter.\n if (!this.isCollapsed()) {\n for (let i = 0; i < this.argumentVarModels_.length; i++) {\n const argOption = {enabled: true};\n const argVar = this.argumentVarModels_[i];\n argOption.text =\n Msg['VARIABLES_SET_CREATE_GET'].replace('%1', argVar.name);\n\n const argXmlField = Variables.generateVariableFieldDom(argVar);\n const argXmlBlock = xmlUtils.createElement('block');\n argXmlBlock.setAttribute('type', 'variables_get');\n argXmlBlock.appendChild(argXmlField);\n argOption.callback = ContextMenu.callbackFactory(this, argXmlBlock);\n options.push(argOption);\n }\n }\n },\n};\n\nblocks['procedures_defnoreturn'] = {\n ...PROCEDURE_DEF_COMMON,\n /**\n * Block for defining a procedure with no return value.\n * @this {Block}\n */\n init: function() {\n const initName = Procedures.findLegalName('', this);\n const nameField = new FieldTextInput(initName, Procedures.rename);\n nameField.setSpellcheck(false);\n this.appendDummyInput()\n .appendField(Msg['PROCEDURES_DEFNORETURN_TITLE'])\n .appendField(nameField, 'NAME')\n .appendField('', 'PARAMS');\n this.setMutator(new Mutator(['procedures_mutatorarg'], this));\n if ((this.workspace.options.comments ||\n (this.workspace.options.parentWorkspace &&\n this.workspace.options.parentWorkspace.options.comments)) &&\n Msg['PROCEDURES_DEFNORETURN_COMMENT']) {\n this.setCommentText(Msg['PROCEDURES_DEFNORETURN_COMMENT']);\n }\n this.setStyle('procedure_blocks');\n this.setTooltip(Msg['PROCEDURES_DEFNORETURN_TOOLTIP']);\n this.setHelpUrl(Msg['PROCEDURES_DEFNORETURN_HELPURL']);\n this.arguments_ = [];\n this.argumentVarModels_ = [];\n this.setStatements_(true);\n this.statementConnection_ = null;\n },\n /**\n * Return the signature of this procedure definition.\n * @return {!Array} Tuple containing three elements:\n * - the name of the defined procedure,\n * - a list of all its arguments,\n * - that it DOES NOT have a return value.\n * @this {Block}\n */\n getProcedureDef: function() {\n return [this.getFieldValue('NAME'), this.arguments_, false];\n },\n callType_: 'procedures_callnoreturn',\n};\n\nblocks['procedures_defreturn'] = {\n ...PROCEDURE_DEF_COMMON,\n /**\n * Block for defining a procedure with a return value.\n * @this {Block}\n */\n init: function() {\n const initName = Procedures.findLegalName('', this);\n const nameField = new FieldTextInput(initName, Procedures.rename);\n nameField.setSpellcheck(false);\n this.appendDummyInput()\n .appendField(Msg['PROCEDURES_DEFRETURN_TITLE'])\n .appendField(nameField, 'NAME')\n .appendField('', 'PARAMS');\n this.appendValueInput('RETURN')\n .setAlign(Align.RIGHT)\n .appendField(Msg['PROCEDURES_DEFRETURN_RETURN']);\n this.setMutator(new Mutator(['procedures_mutatorarg'], this));\n if ((this.workspace.options.comments ||\n (this.workspace.options.parentWorkspace &&\n this.workspace.options.parentWorkspace.options.comments)) &&\n Msg['PROCEDURES_DEFRETURN_COMMENT']) {\n this.setCommentText(Msg['PROCEDURES_DEFRETURN_COMMENT']);\n }\n this.setStyle('procedure_blocks');\n this.setTooltip(Msg['PROCEDURES_DEFRETURN_TOOLTIP']);\n this.setHelpUrl(Msg['PROCEDURES_DEFRETURN_HELPURL']);\n this.arguments_ = [];\n this.argumentVarModels_ = [];\n this.setStatements_(true);\n this.statementConnection_ = null;\n },\n /**\n * Return the signature of this procedure definition.\n * @return {!Array} Tuple containing three elements:\n * - the name of the defined procedure,\n * - a list of all its arguments,\n * - that it DOES have a return value.\n * @this {Block}\n */\n getProcedureDef: function() {\n return [this.getFieldValue('NAME'), this.arguments_, true];\n },\n callType_: 'procedures_callreturn',\n};\n\nblocks['procedures_mutatorcontainer'] = {\n /**\n * Mutator block for procedure container.\n * @this {Block}\n */\n init: function() {\n this.appendDummyInput().appendField(\n Msg['PROCEDURES_MUTATORCONTAINER_TITLE']);\n this.appendStatementInput('STACK');\n this.appendDummyInput('STATEMENT_INPUT')\n .appendField(Msg['PROCEDURES_ALLOW_STATEMENTS'])\n .appendField(new FieldCheckbox('TRUE'), 'STATEMENTS');\n this.setStyle('procedure_blocks');\n this.setTooltip(Msg['PROCEDURES_MUTATORCONTAINER_TOOLTIP']);\n this.contextMenu = false;\n },\n};\n\nblocks['procedures_mutatorarg'] = {\n /**\n * Mutator block for procedure argument.\n * @this {Block}\n */\n init: function() {\n const field = new FieldTextInput(Procedures.DEFAULT_ARG, this.validator_);\n // Hack: override showEditor to do just a little bit more work.\n // We don't have a good place to hook into the start of a text edit.\n field.oldShowEditorFn_ = field.showEditor_;\n /**\n * @this {FieldTextInput}\n */\n const newShowEditorFn = function() {\n this.createdVariables_ = [];\n this.oldShowEditorFn_();\n };\n field.showEditor_ = newShowEditorFn;\n\n this.appendDummyInput()\n .appendField(Msg['PROCEDURES_MUTATORARG_TITLE'])\n .appendField(field, 'NAME');\n this.setPreviousStatement(true);\n this.setNextStatement(true);\n this.setStyle('procedure_blocks');\n this.setTooltip(Msg['PROCEDURES_MUTATORARG_TOOLTIP']);\n this.contextMenu = false;\n\n // Create the default variable when we drag the block in from the flyout.\n // Have to do this after installing the field on the block.\n field.onFinishEditing_ = this.deleteIntermediateVars_;\n // Create an empty list so onFinishEditing_ has something to look at, even\n // though the editor was never opened.\n field.createdVariables_ = [];\n field.onFinishEditing_('x');\n },\n\n /**\n * Obtain a valid name for the procedure argument. Create a variable if\n * necessary.\n * Merge runs of whitespace. Strip leading and trailing whitespace.\n * Beyond this, all names are legal.\n * @param {string} varName User-supplied name.\n * @return {?string} Valid name, or null if a name was not specified.\n * @private\n * @this {FieldTextInput}\n */\n validator_: function(varName) {\n const sourceBlock = this.getSourceBlock();\n const outerWs = Mutator.findParentWs(sourceBlock.workspace);\n varName = varName.replace(/[\\s\\xa0]+/g, ' ').replace(/^ | $/g, '');\n if (!varName) {\n return null;\n }\n\n // Prevents duplicate parameter names in functions\n const workspace =\n sourceBlock.workspace.targetWorkspace || sourceBlock.workspace;\n const blocks = workspace.getAllBlocks(false);\n const caselessName = varName.toLowerCase();\n for (let i = 0; i < blocks.length; i++) {\n if (blocks[i].id === this.getSourceBlock().id) {\n continue;\n }\n // Other blocks values may not be set yet when this is loaded.\n const otherVar = blocks[i].getFieldValue('NAME');\n if (otherVar && otherVar.toLowerCase() === caselessName) {\n return null;\n }\n }\n\n // Don't create variables for arg blocks that\n // only exist in the mutator's flyout.\n if (sourceBlock.isInFlyout) {\n return varName;\n }\n\n let model = outerWs.getVariable(varName, '');\n if (model && model.name !== varName) {\n // Rename the variable (case change)\n outerWs.renameVariableById(model.getId(), varName);\n }\n if (!model) {\n model = outerWs.createVariable(varName, '');\n if (model && this.createdVariables_) {\n this.createdVariables_.push(model);\n }\n }\n return varName;\n },\n\n /**\n * Called when focusing away from the text field.\n * Deletes all variables that were created as the user typed their intended\n * variable name.\n * @param {string} newText The new variable name.\n * @private\n * @this {FieldTextInput}\n */\n deleteIntermediateVars_: function(newText) {\n const outerWs = Mutator.findParentWs(this.getSourceBlock().workspace);\n if (!outerWs) {\n return;\n }\n for (let i = 0; i < this.createdVariables_.length; i++) {\n const model = this.createdVariables_[i];\n if (model.name !== newText) {\n outerWs.deleteVariableById(model.getId());\n }\n }\n },\n};\n\n/**\n * Common properties for the procedure_callnoreturn and\n * procedure_callreturn blocks.\n */\nconst PROCEDURE_CALL_COMMON = {\n /**\n * Returns the name of the procedure this block calls.\n * @return {string} Procedure name.\n * @this {Block}\n */\n getProcedureCall: function() {\n // The NAME field is guaranteed to exist, null will never be returned.\n return /** @type {string} */ (this.getFieldValue('NAME'));\n },\n /**\n * Notification that a procedure is renaming.\n * If the name matches this block's procedure, rename it.\n * @param {string} oldName Previous name of procedure.\n * @param {string} newName Renamed procedure.\n * @this {Block}\n */\n renameProcedure: function(oldName, newName) {\n if (Names.equals(oldName, this.getProcedureCall())) {\n this.setFieldValue(newName, 'NAME');\n const baseMsg = this.outputConnection ?\n Msg['PROCEDURES_CALLRETURN_TOOLTIP'] :\n Msg['PROCEDURES_CALLNORETURN_TOOLTIP'];\n this.setTooltip(baseMsg.replace('%1', newName));\n }\n },\n /**\n * Notification that the procedure's parameters have changed.\n * @param {!Array<string>} paramNames New param names, e.g. ['x', 'y', 'z'].\n * @param {!Array<string>} paramIds IDs of params (consistent for each\n * parameter through the life of a mutator, regardless of param renaming),\n * e.g. ['piua', 'f8b_', 'oi.o'].\n * @private\n * @this {Block}\n */\n setProcedureParameters_: function(paramNames, paramIds) {\n // Data structures:\n // this.arguments = ['x', 'y']\n // Existing param names.\n // this.quarkConnections_ {piua: null, f8b_: Connection}\n // Look-up of paramIds to connections plugged into the call block.\n // this.quarkIds_ = ['piua', 'f8b_']\n // Existing param IDs.\n // Note that quarkConnections_ may include IDs that no longer exist, but\n // which might reappear if a param is reattached in the mutator.\n const defBlock =\n Procedures.getDefinition(this.getProcedureCall(), this.workspace);\n const mutatorOpen =\n defBlock && defBlock.mutator && defBlock.mutator.isVisible();\n if (!mutatorOpen) {\n this.quarkConnections_ = {};\n this.quarkIds_ = null;\n } else {\n // fix #6091 - this call could cause an error when outside if-else\n // expanding block while mutating prevents another error (ancient fix)\n this.setCollapsed(false);\n }\n // Test arguments (arrays of strings) for changes. '\\n' is not a valid\n // argument name character, so it is a valid delimiter here.\n if (paramNames.join('\\n') === this.arguments_.join('\\n')) {\n // No change.\n this.quarkIds_ = paramIds;\n return;\n }\n if (paramIds.length !== paramNames.length) {\n throw RangeError('paramNames and paramIds must be the same length.');\n }\n if (!this.quarkIds_) {\n // Initialize tracking for this block.\n this.quarkConnections_ = {};\n this.quarkIds_ = [];\n }\n // Switch off rendering while the block is rebuilt.\n const savedRendered = this.rendered;\n this.rendered = false;\n // Update the quarkConnections_ with existing connections.\n for (let i = 0; i < this.arguments_.length; i++) {\n const input = this.getInput('ARG' + i);\n if (input) {\n const connection = input.connection.targetConnection;\n this.quarkConnections_[this.quarkIds_[i]] = connection;\n if (mutatorOpen && connection &&\n paramIds.indexOf(this.quarkIds_[i]) === -1) {\n // This connection should no longer be attached to this block.\n connection.disconnect();\n connection.getSourceBlock().bumpNeighbours();\n }\n }\n }\n // Rebuild the block's arguments.\n this.arguments_ = [].concat(paramNames);\n // And rebuild the argument model list.\n this.argumentVarModels_ = [];\n for (let i = 0; i < this.arguments_.length; i++) {\n const variable = Variables.getOrCreateVariablePackage(\n this.workspace, null, this.arguments_[i], '');\n this.argumentVarModels_.push(variable);\n }\n\n this.updateShape_();\n this.quarkIds_ = paramIds;\n // Reconnect any child blocks.\n if (this.quarkIds_) {\n for (let i = 0; i < this.arguments_.length; i++) {\n const quarkId = this.quarkIds_[i];\n if (quarkId in this.quarkConnections_) {\n const connection = this.quarkConnections_[quarkId];\n if (!Mutator.reconnect(connection, this, 'ARG' + i)) {\n // Block no longer exists or has been attached elsewhere.\n delete this.quarkConnections_[quarkId];\n }\n }\n }\n }\n // Restore rendering and show the changes.\n this.rendered = savedRendered;\n if (this.rendered) {\n this.render();\n }\n },\n /**\n * Modify this block to have the correct number of arguments.\n * @private\n * @this {Block}\n */\n updateShape_: function() {\n for (let i = 0; i < this.arguments_.length; i++) {\n const argField = this.getField('ARGNAME' + i);\n if (argField) {\n // Ensure argument name is up to date.\n // The argument name field is deterministic based on the mutation,\n // no need to fire a change event.\n Events.disable();\n try {\n argField.setValue(this.arguments_[i]);\n } finally {\n Events.enable();\n }\n } else {\n // Add new input.\n const newField = new FieldLabel(this.arguments_[i]);\n const input = this.appendValueInput('ARG' + i)\n .setAlign(Align.RIGHT)\n .appendField(newField, 'ARGNAME' + i);\n input.init();\n }\n }\n // Remove deleted inputs.\n for (let i = this.arguments_.length; this.getInput('ARG' + i); i++) {\n this.removeInput('ARG' + i);\n }\n // Add 'with:' if there are parameters, remove otherwise.\n const topRow = this.getInput('TOPROW');\n if (topRow) {\n if (this.arguments_.length) {\n if (!this.getField('WITH')) {\n topRow.appendField(Msg['PROCEDURES_CALL_BEFORE_PARAMS'], 'WITH');\n topRow.init();\n }\n } else {\n if (this.getField('WITH')) {\n topRow.removeField('WITH');\n }\n }\n }\n },\n /**\n * Create XML to represent the (non-editable) name and arguments.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('name', this.getProcedureCall());\n for (let i = 0; i < this.arguments_.length; i++) {\n const parameter = xmlUtils.createElement('arg');\n parameter.setAttribute('name', this.arguments_[i]);\n container.appendChild(parameter);\n }\n return container;\n },\n /**\n * Parse XML to restore the (non-editable) name and parameters.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n const name = xmlElement.getAttribute('name');\n this.renameProcedure(this.getProcedureCall(), name);\n const args = [];\n const paramIds = [];\n for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) {\n if (childNode.nodeName.toLowerCase() === 'arg') {\n args.push(childNode.getAttribute('name'));\n paramIds.push(childNode.getAttribute('paramId'));\n }\n }\n this.setProcedureParameters_(args, paramIds);\n },\n /**\n * Returns the state of this block as a JSON serializable object.\n * @return {{name: string, params:(!Array<string>|undefined)}} The state of\n * this block, ie the params and procedure name.\n */\n saveExtraState: function() {\n const state = Object.create(null);\n state['name'] = this.getProcedureCall();\n if (this.arguments_.length) {\n state['params'] = this.arguments_;\n }\n return state;\n },\n /**\n * Applies the given state to this block.\n * @param {*} state The state to apply to this block, ie the params and\n * procedure name.\n */\n loadExtraState: function(state) {\n this.renameProcedure(this.getProcedureCall(), state['name']);\n const params = state['params'];\n if (params) {\n const ids = [];\n ids.length = params.length;\n ids.fill(null);\n this.setProcedureParameters_(params, ids);\n }\n },\n /**\n * Return all variables referenced by this block.\n * @return {!Array<string>} List of variable names.\n * @this {Block}\n */\n getVars: function() {\n return this.arguments_;\n },\n /**\n * Return all variables referenced by this block.\n * @return {!Array<!VariableModel>} List of variable models.\n * @this {Block}\n */\n getVarModels: function() {\n return this.argumentVarModels_;\n },\n /**\n * Procedure calls cannot exist without the corresponding procedure\n * definition. Enforce this link whenever an event is fired.\n * @param {!AbstractEvent} event Change event.\n * @this {Block}\n */\n onchange: function(event) {\n if (!this.workspace || this.workspace.isFlyout) {\n // Block is deleted or is in a flyout.\n return;\n }\n if (!event.recordUndo) {\n // Events not generated by user. Skip handling.\n return;\n }\n if (event.type === Events.BLOCK_CREATE &&\n event.ids.indexOf(this.id) !== -1) {\n // Look for the case where a procedure call was created (usually through\n // paste) and there is no matching definition. In this case, create\n // an empty definition block with the correct signature.\n const name = this.getProcedureCall();\n let def = Procedures.getDefinition(name, this.workspace);\n if (def &&\n (def.type !== this.defType_ ||\n JSON.stringify(def.getVars()) !== JSON.stringify(this.arguments_))) {\n // The signatures don't match.\n def = null;\n }\n if (!def) {\n Events.setGroup(event.group);\n /**\n * Create matching definition block.\n * <xml xmlns=\"https://developers.google.com/blockly/xml\">\n * <block type=\"procedures_defreturn\" x=\"10\" y=\"20\">\n * <mutation name=\"test\">\n * <arg name=\"x\"></arg>\n * </mutation>\n * <field name=\"NAME\">test</field>\n * </block>\n * </xml>\n */\n const xml = xmlUtils.createElement('xml');\n const block = xmlUtils.createElement('block');\n block.setAttribute('type', this.defType_);\n const xy = this.getRelativeToSurfaceXY();\n const x = xy.x + config.snapRadius * (this.RTL ? -1 : 1);\n const y = xy.y + config.snapRadius * 2;\n block.setAttribute('x', x);\n block.setAttribute('y', y);\n const mutation = this.mutationToDom();\n block.appendChild(mutation);\n const field = xmlUtils.createElement('field');\n field.setAttribute('name', 'NAME');\n const callName = this.getProcedureCall();\n const newName = Procedures.findLegalName(callName, this);\n if (callName !== newName) {\n this.renameProcedure(callName, newName);\n }\n field.appendChild(xmlUtils.createTextNode(callName));\n block.appendChild(field);\n xml.appendChild(block);\n Xml.domToWorkspace(xml, this.workspace);\n Events.setGroup(false);\n }\n } else if (event.type === Events.BLOCK_DELETE && event.blockId != this.id) {\n // Look for the case where a procedure definition has been deleted,\n // leaving this block (a procedure call) orphaned. In this case, delete\n // the orphan.\n const name = this.getProcedureCall();\n const def = Procedures.getDefinition(name, this.workspace);\n if (!def) {\n Events.setGroup(event.group);\n this.dispose(true);\n Events.setGroup(false);\n }\n } else if (event.type === Events.CHANGE && event.element === 'disabled') {\n const name = this.getProcedureCall();\n const def = Procedures.getDefinition(name, this.workspace);\n if (def && def.id === event.blockId) {\n // in most cases the old group should be ''\n const oldGroup = Events.getGroup();\n if (oldGroup) {\n // This should only be possible programmatically and may indicate a\n // problem with event grouping. If you see this message please\n // investigate. If the use ends up being valid we may need to reorder\n // events in the undo stack.\n console.log(\n 'Saw an existing group while responding to a definition change');\n }\n Events.setGroup(event.group);\n if (event.newValue) {\n this.previousEnabledState_ = this.isEnabled();\n this.setEnabled(false);\n } else {\n this.setEnabled(this.previousEnabledState_);\n }\n Events.setGroup(oldGroup);\n }\n }\n },\n /**\n * Add menu option to find the definition block for this call.\n * @param {!Array} options List of menu options to add to.\n * @this {Block}\n */\n customContextMenu: function(options) {\n if (!this.workspace.isMovable()) {\n // If we center on the block and the workspace isn't movable we could\n // loose blocks at the edges of the workspace.\n return;\n }\n\n const option = {enabled: true};\n option.text = Msg['PROCEDURES_HIGHLIGHT_DEF'];\n const name = this.getProcedureCall();\n const workspace = this.workspace;\n option.callback = function() {\n const def = Procedures.getDefinition(name, workspace);\n if (def) {\n workspace.centerOnBlock(def.id);\n def.select();\n }\n };\n options.push(option);\n },\n};\n\nblocks['procedures_callnoreturn'] = {\n ...PROCEDURE_CALL_COMMON,\n /**\n * Block for calling a procedure with no return value.\n * @this {Block}\n */\n init: function() {\n this.appendDummyInput('TOPROW').appendField('', 'NAME');\n this.setPreviousStatement(true);\n this.setNextStatement(true);\n this.setStyle('procedure_blocks');\n // Tooltip is set in renameProcedure.\n this.setHelpUrl(Msg['PROCEDURES_CALLNORETURN_HELPURL']);\n this.arguments_ = [];\n this.argumentVarModels_ = [];\n this.quarkConnections_ = {};\n this.quarkIds_ = null;\n this.previousEnabledState_ = true;\n },\n\n defType_: 'procedures_defnoreturn',\n};\n\nblocks['procedures_callreturn'] = {\n ...PROCEDURE_CALL_COMMON,\n /**\n * Block for calling a procedure with a return value.\n * @this {Block}\n */\n init: function() {\n this.appendDummyInput('TOPROW').appendField('', 'NAME');\n this.setOutput(true);\n this.setStyle('procedure_blocks');\n // Tooltip is set in domToMutation.\n this.setHelpUrl(Msg['PROCEDURES_CALLRETURN_HELPURL']);\n this.arguments_ = [];\n this.argumentVarModels_ = [];\n this.quarkConnections_ = {};\n this.quarkIds_ = null;\n this.previousEnabledState_ = true;\n },\n\n defType_: 'procedures_defreturn',\n};\n\nblocks['procedures_ifreturn'] = {\n /**\n * Block for conditionally returning a value from a procedure.\n * @this {Block}\n */\n init: function() {\n this.appendValueInput('CONDITION')\n .setCheck('Boolean')\n .appendField(Msg['CONTROLS_IF_MSG_IF']);\n this.appendValueInput('VALUE').appendField(\n Msg['PROCEDURES_DEFRETURN_RETURN']);\n this.setInputsInline(true);\n this.setPreviousStatement(true);\n this.setNextStatement(true);\n this.setStyle('procedure_blocks');\n this.setTooltip(Msg['PROCEDURES_IFRETURN_TOOLTIP']);\n this.setHelpUrl(Msg['PROCEDURES_IFRETURN_HELPURL']);\n this.hasReturnValue_ = true;\n },\n /**\n * Create XML to represent whether this block has a return value.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('value', Number(this.hasReturnValue_));\n return container;\n },\n /**\n * Parse XML to restore whether this block has a return value.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n const value = xmlElement.getAttribute('value');\n this.hasReturnValue_ = (value === '1');\n if (!this.hasReturnValue_) {\n this.removeInput('VALUE');\n this.appendDummyInput('VALUE').appendField(\n Msg['PROCEDURES_DEFRETURN_RETURN']);\n }\n },\n\n // This block does not need JSO serialization hooks (saveExtraState and\n // loadExtraState) because the state of this block is already encoded in the\n // block's position in the workspace.\n // XML hooks are kept for backwards compatibility.\n\n /**\n * Called whenever anything on the workspace changes.\n * Add warning if this flow block is not nested inside a loop.\n * @param {!AbstractEvent} e Move event.\n * @this {Block}\n */\n onchange: function(e) {\n if (this.workspace.isDragging && this.workspace.isDragging() ||\n e.type !== Events.BLOCK_MOVE) {\n return; // Don't change state at the start of a drag.\n }\n let legal = false;\n // Is the block nested in a procedure?\n let block = this;\n do {\n if (this.FUNCTION_TYPES.indexOf(block.type) !== -1) {\n legal = true;\n break;\n }\n block = block.getSurroundParent();\n } while (block);\n if (legal) {\n // If needed, toggle whether this block has a return value.\n if (block.type === 'procedures_defnoreturn' && this.hasReturnValue_) {\n this.removeInput('VALUE');\n this.appendDummyInput('VALUE').appendField(\n Msg['PROCEDURES_DEFRETURN_RETURN']);\n this.hasReturnValue_ = false;\n } else if (\n block.type === 'procedures_defreturn' && !this.hasReturnValue_) {\n this.removeInput('VALUE');\n this.appendValueInput('VALUE').appendField(\n Msg['PROCEDURES_DEFRETURN_RETURN']);\n this.hasReturnValue_ = true;\n }\n this.setWarningText(null);\n } else {\n this.setWarningText(Msg['PROCEDURES_IFRETURN_WARNING']);\n }\n if (!this.isInFlyout) {\n const group = Events.getGroup();\n // Makes it so the move and the disable event get undone together.\n Events.setGroup(e.group);\n this.setEnabled(legal);\n Events.setGroup(group);\n }\n },\n /**\n * List of block types that are functions and thus do not need warnings.\n * To add a new function type add this to your code:\n * Blocks['procedures_ifreturn'].FUNCTION_TYPES.push('custom_func');\n */\n FUNCTION_TYPES: ['procedures_defnoreturn', 'procedures_defreturn'],\n};\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Math blocks for Blockly.\n * @suppress {checkTypes}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.math');\n\nconst Extensions = goog.require('Blockly.Extensions');\n// N.B.: Blockly.FieldDropdown needed for type AND side-effects.\n/* eslint-disable-next-line no-unused-vars */\nconst FieldDropdown = goog.require('Blockly.FieldDropdown');\nconst xmlUtils = goog.require('Blockly.utils.xml');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldLabel');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldNumber');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldVariable');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for numeric value.\n {\n 'type': 'math_number',\n 'message0': '%1',\n 'args0': [{\n 'type': 'field_number',\n 'name': 'NUM',\n 'value': 0,\n }],\n 'output': 'Number',\n 'helpUrl': '%{BKY_MATH_NUMBER_HELPURL}',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_NUMBER_TOOLTIP}',\n 'extensions': ['parent_tooltip_when_inline'],\n },\n\n // Block for basic arithmetic operator.\n {\n 'type': 'math_arithmetic',\n 'message0': '%1 %2 %3',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'A',\n 'check': 'Number',\n },\n {\n 'type': 'field_dropdown',\n 'name': 'OP',\n 'options': [\n ['%{BKY_MATH_ADDITION_SYMBOL}', 'ADD'],\n ['%{BKY_MATH_SUBTRACTION_SYMBOL}', 'MINUS'],\n ['%{BKY_MATH_MULTIPLICATION_SYMBOL}', 'MULTIPLY'],\n ['%{BKY_MATH_DIVISION_SYMBOL}', 'DIVIDE'],\n ['%{BKY_MATH_POWER_SYMBOL}', 'POWER'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'B',\n 'check': 'Number',\n },\n ],\n 'inputsInline': true,\n 'output': 'Number',\n 'style': 'math_blocks',\n 'helpUrl': '%{BKY_MATH_ARITHMETIC_HELPURL}',\n 'extensions': ['math_op_tooltip'],\n },\n\n // Block for advanced math operators with single operand.\n {\n 'type': 'math_single',\n 'message0': '%1 %2',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'OP',\n 'options': [\n ['%{BKY_MATH_SINGLE_OP_ROOT}', 'ROOT'],\n ['%{BKY_MATH_SINGLE_OP_ABSOLUTE}', 'ABS'],\n ['-', 'NEG'],\n ['ln', 'LN'],\n ['log10', 'LOG10'],\n ['e^', 'EXP'],\n ['10^', 'POW10'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'NUM',\n 'check': 'Number',\n },\n ],\n 'output': 'Number',\n 'style': 'math_blocks',\n 'helpUrl': '%{BKY_MATH_SINGLE_HELPURL}',\n 'extensions': ['math_op_tooltip'],\n },\n\n // Block for trigonometry operators.\n {\n 'type': 'math_trig',\n 'message0': '%1 %2',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'OP',\n 'options': [\n ['%{BKY_MATH_TRIG_SIN}', 'SIN'],\n ['%{BKY_MATH_TRIG_COS}', 'COS'],\n ['%{BKY_MATH_TRIG_TAN}', 'TAN'],\n ['%{BKY_MATH_TRIG_ASIN}', 'ASIN'],\n ['%{BKY_MATH_TRIG_ACOS}', 'ACOS'],\n ['%{BKY_MATH_TRIG_ATAN}', 'ATAN'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'NUM',\n 'check': 'Number',\n },\n ],\n 'output': 'Number',\n 'style': 'math_blocks',\n 'helpUrl': '%{BKY_MATH_TRIG_HELPURL}',\n 'extensions': ['math_op_tooltip'],\n },\n\n // Block for constants: PI, E, the Golden Ratio, sqrt(2), 1/sqrt(2), INFINITY.\n {\n 'type': 'math_constant',\n 'message0': '%1',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'CONSTANT',\n 'options': [\n ['\\u03c0', 'PI'],\n ['e', 'E'],\n ['\\u03c6', 'GOLDEN_RATIO'],\n ['sqrt(2)', 'SQRT2'],\n ['sqrt(\\u00bd)', 'SQRT1_2'],\n ['\\u221e', 'INFINITY'],\n ],\n },\n ],\n 'output': 'Number',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_CONSTANT_TOOLTIP}',\n 'helpUrl': '%{BKY_MATH_CONSTANT_HELPURL}',\n },\n\n // Block for checking if a number is even, odd, prime, whole, positive,\n // negative or if it is divisible by certain number.\n {\n 'type': 'math_number_property',\n 'message0': '%1 %2',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'NUMBER_TO_CHECK',\n 'check': 'Number',\n },\n {\n 'type': 'field_dropdown',\n 'name': 'PROPERTY',\n 'options': [\n ['%{BKY_MATH_IS_EVEN}', 'EVEN'],\n ['%{BKY_MATH_IS_ODD}', 'ODD'],\n ['%{BKY_MATH_IS_PRIME}', 'PRIME'],\n ['%{BKY_MATH_IS_WHOLE}', 'WHOLE'],\n ['%{BKY_MATH_IS_POSITIVE}', 'POSITIVE'],\n ['%{BKY_MATH_IS_NEGATIVE}', 'NEGATIVE'],\n ['%{BKY_MATH_IS_DIVISIBLE_BY}', 'DIVISIBLE_BY'],\n ],\n },\n ],\n 'inputsInline': true,\n 'output': 'Boolean',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_IS_TOOLTIP}',\n 'mutator': 'math_is_divisibleby_mutator',\n },\n\n // Block for adding to a variable in place.\n {\n 'type': 'math_change',\n 'message0': '%{BKY_MATH_CHANGE_TITLE}',\n 'args0': [\n {\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': '%{BKY_MATH_CHANGE_TITLE_ITEM}',\n },\n {\n 'type': 'input_value',\n 'name': 'DELTA',\n 'check': 'Number',\n },\n ],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'variable_blocks',\n 'helpUrl': '%{BKY_MATH_CHANGE_HELPURL}',\n 'extensions': ['math_change_tooltip'],\n },\n\n // Block for rounding functions.\n {\n 'type': 'math_round',\n 'message0': '%1 %2',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'OP',\n 'options': [\n ['%{BKY_MATH_ROUND_OPERATOR_ROUND}', 'ROUND'],\n ['%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}', 'ROUNDUP'],\n ['%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}', 'ROUNDDOWN'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'NUM',\n 'check': 'Number',\n },\n ],\n 'output': 'Number',\n 'style': 'math_blocks',\n 'helpUrl': '%{BKY_MATH_ROUND_HELPURL}',\n 'tooltip': '%{BKY_MATH_ROUND_TOOLTIP}',\n },\n\n // Block for evaluating a list of numbers to return sum, average, min, max,\n // etc. Some functions also work on text (min, max, mode, median).\n {\n 'type': 'math_on_list',\n 'message0': '%1 %2',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'OP',\n 'options': [\n ['%{BKY_MATH_ONLIST_OPERATOR_SUM}', 'SUM'],\n ['%{BKY_MATH_ONLIST_OPERATOR_MIN}', 'MIN'],\n ['%{BKY_MATH_ONLIST_OPERATOR_MAX}', 'MAX'],\n ['%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}', 'AVERAGE'],\n ['%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}', 'MEDIAN'],\n ['%{BKY_MATH_ONLIST_OPERATOR_MODE}', 'MODE'],\n ['%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}', 'STD_DEV'],\n ['%{BKY_MATH_ONLIST_OPERATOR_RANDOM}', 'RANDOM'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'LIST',\n 'check': 'Array',\n },\n ],\n 'output': 'Number',\n 'style': 'math_blocks',\n 'helpUrl': '%{BKY_MATH_ONLIST_HELPURL}',\n 'mutator': 'math_modes_of_list_mutator',\n 'extensions': ['math_op_tooltip'],\n },\n\n // Block for remainder of a division.\n {\n 'type': 'math_modulo',\n 'message0': '%{BKY_MATH_MODULO_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'DIVIDEND',\n 'check': 'Number',\n },\n {\n 'type': 'input_value',\n 'name': 'DIVISOR',\n 'check': 'Number',\n },\n ],\n 'inputsInline': true,\n 'output': 'Number',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_MODULO_TOOLTIP}',\n 'helpUrl': '%{BKY_MATH_MODULO_HELPURL}',\n },\n\n // Block for constraining a number between two limits.\n {\n 'type': 'math_constrain',\n 'message0': '%{BKY_MATH_CONSTRAIN_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n 'check': 'Number',\n },\n {\n 'type': 'input_value',\n 'name': 'LOW',\n 'check': 'Number',\n },\n {\n 'type': 'input_value',\n 'name': 'HIGH',\n 'check': 'Number',\n },\n ],\n 'inputsInline': true,\n 'output': 'Number',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_CONSTRAIN_TOOLTIP}',\n 'helpUrl': '%{BKY_MATH_CONSTRAIN_HELPURL}',\n },\n\n // Block for random integer between [X] and [Y].\n {\n 'type': 'math_random_int',\n 'message0': '%{BKY_MATH_RANDOM_INT_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'FROM',\n 'check': 'Number',\n },\n {\n 'type': 'input_value',\n 'name': 'TO',\n 'check': 'Number',\n },\n ],\n 'inputsInline': true,\n 'output': 'Number',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_RANDOM_INT_TOOLTIP}',\n 'helpUrl': '%{BKY_MATH_RANDOM_INT_HELPURL}',\n },\n\n // Block for random integer between [X] and [Y].\n {\n 'type': 'math_random_float',\n 'message0': '%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}',\n 'output': 'Number',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}',\n 'helpUrl': '%{BKY_MATH_RANDOM_FLOAT_HELPURL}',\n },\n\n // Block for calculating atan2 of [X] and [Y].\n {\n 'type': 'math_atan2',\n 'message0': '%{BKY_MATH_ATAN2_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'X',\n 'check': 'Number',\n },\n {\n 'type': 'input_value',\n 'name': 'Y',\n 'check': 'Number',\n },\n ],\n 'inputsInline': true,\n 'output': 'Number',\n 'style': 'math_blocks',\n 'tooltip': '%{BKY_MATH_ATAN2_TOOLTIP}',\n 'helpUrl': '%{BKY_MATH_ATAN2_HELPURL}',\n },\n]);\nexports.blocks = blocks;\n\n/**\n * Mapping of math block OP value to tooltip message for blocks\n * math_arithmetic, math_simple, math_trig, and math_on_lists.\n * @see {Extensions#buildTooltipForDropdown}\n * @package\n * @readonly\n */\nconst TOOLTIPS_BY_OP = {\n // math_arithmetic\n 'ADD': '%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}',\n 'MINUS': '%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}',\n 'MULTIPLY': '%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}',\n 'DIVIDE': '%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}',\n 'POWER': '%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}',\n\n // math_simple\n 'ROOT': '%{BKY_MATH_SINGLE_TOOLTIP_ROOT}',\n 'ABS': '%{BKY_MATH_SINGLE_TOOLTIP_ABS}',\n 'NEG': '%{BKY_MATH_SINGLE_TOOLTIP_NEG}',\n 'LN': '%{BKY_MATH_SINGLE_TOOLTIP_LN}',\n 'LOG10': '%{BKY_MATH_SINGLE_TOOLTIP_LOG10}',\n 'EXP': '%{BKY_MATH_SINGLE_TOOLTIP_EXP}',\n 'POW10': '%{BKY_MATH_SINGLE_TOOLTIP_POW10}',\n\n // math_trig\n 'SIN': '%{BKY_MATH_TRIG_TOOLTIP_SIN}',\n 'COS': '%{BKY_MATH_TRIG_TOOLTIP_COS}',\n 'TAN': '%{BKY_MATH_TRIG_TOOLTIP_TAN}',\n 'ASIN': '%{BKY_MATH_TRIG_TOOLTIP_ASIN}',\n 'ACOS': '%{BKY_MATH_TRIG_TOOLTIP_ACOS}',\n 'ATAN': '%{BKY_MATH_TRIG_TOOLTIP_ATAN}',\n\n // math_on_lists\n 'SUM': '%{BKY_MATH_ONLIST_TOOLTIP_SUM}',\n 'MIN': '%{BKY_MATH_ONLIST_TOOLTIP_MIN}',\n 'MAX': '%{BKY_MATH_ONLIST_TOOLTIP_MAX}',\n 'AVERAGE': '%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}',\n 'MEDIAN': '%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}',\n 'MODE': '%{BKY_MATH_ONLIST_TOOLTIP_MODE}',\n 'STD_DEV': '%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}',\n 'RANDOM': '%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}',\n};\n\nExtensions.register(\n 'math_op_tooltip',\n Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP));\n\n\n/**\n * Mixin for mutator functions in the 'math_is_divisibleby_mutator'\n * extension.\n * @mixin\n * @augments Block\n * @package\n */\nconst IS_DIVISIBLEBY_MUTATOR_MIXIN = {\n /**\n * Create XML to represent whether the 'divisorInput' should be present.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n const divisorInput = (this.getFieldValue('PROPERTY') === 'DIVISIBLE_BY');\n container.setAttribute('divisor_input', divisorInput);\n return container;\n },\n /**\n * Parse XML to restore the 'divisorInput'.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n const divisorInput = (xmlElement.getAttribute('divisor_input') === 'true');\n this.updateShape_(divisorInput);\n },\n\n // This block does not need JSO serialization hooks (saveExtraState and\n // loadExtraState) because the state of this object is already encoded in the\n // dropdown values.\n // XML hooks are kept for backwards compatibility.\n\n /**\n * Modify this block to have (or not have) an input for 'is divisible by'.\n * @param {boolean} divisorInput True if this block has a divisor input.\n * @private\n * @this {Block}\n */\n updateShape_: function(divisorInput) {\n // Add or remove a Value Input.\n const inputExists = this.getInput('DIVISOR');\n if (divisorInput) {\n if (!inputExists) {\n this.appendValueInput('DIVISOR').setCheck('Number');\n }\n } else if (inputExists) {\n this.removeInput('DIVISOR');\n }\n },\n};\n\n/**\n * 'math_is_divisibleby_mutator' extension to the 'math_property' block that\n * can update the block shape (add/remove divisor input) based on whether\n * property is \"divisible by\".\n * @this {Block}\n * @package\n */\nconst IS_DIVISIBLE_MUTATOR_EXTENSION = function() {\n this.getField('PROPERTY')\n .setValidator(\n /**\n * @this {FieldDropdown}\n * @param {*} option The selected dropdown option.\n */\n function(option) {\n const divisorInput = (option === 'DIVISIBLE_BY');\n this.getSourceBlock().updateShape_(divisorInput);\n });\n};\n\nExtensions.registerMutator(\n 'math_is_divisibleby_mutator', IS_DIVISIBLEBY_MUTATOR_MIXIN,\n IS_DIVISIBLE_MUTATOR_EXTENSION);\n\n// Update the tooltip of 'math_change' block to reference the variable.\nExtensions.register(\n 'math_change_tooltip',\n Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR'));\n\n/**\n * Mixin with mutator methods to support alternate output based if the\n * 'math_on_list' block uses the 'MODE' operation.\n * @mixin\n * @augments Block\n * @package\n * @readonly\n */\nconst LIST_MODES_MUTATOR_MIXIN = {\n /**\n * Modify this block to have the correct output type.\n * @param {string} newOp Either 'MODE' or some op than returns a number.\n * @private\n * @this {Block}\n */\n updateType_: function(newOp) {\n if (newOp === 'MODE') {\n this.outputConnection.setCheck('Array');\n } else {\n this.outputConnection.setCheck('Number');\n }\n },\n /**\n * Create XML to represent the output type.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('op', this.getFieldValue('OP'));\n return container;\n },\n /**\n * Parse XML to restore the output type.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n this.updateType_(xmlElement.getAttribute('op'));\n },\n\n // This block does not need JSO serialization hooks (saveExtraState and\n // loadExtraState) because the state of this object is already encoded in the\n // dropdown values.\n // XML hooks are kept for backwards compatibility.\n};\n\n/**\n * Extension to 'math_on_list' blocks that allows support of\n * modes operation (outputs a list of numbers).\n * @this {Block}\n * @package\n */\nconst LIST_MODES_MUTATOR_EXTENSION = function() {\n this.getField('OP').setValidator(function(newOp) {\n this.updateType_(newOp);\n }.bind(this));\n};\n\nExtensions.registerMutator(\n 'math_modes_of_list_mutator', LIST_MODES_MUTATOR_MIXIN,\n LIST_MODES_MUTATOR_EXTENSION);\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Loop blocks for Blockly.\n * @suppress {checkTypes}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.loops');\n\n/* eslint-disable-next-line no-unused-vars */\nconst AbstractEvent = goog.requireType('Blockly.Events.Abstract');\nconst ContextMenu = goog.require('Blockly.ContextMenu');\nconst Events = goog.require('Blockly.Events');\nconst Extensions = goog.require('Blockly.Extensions');\nconst Variables = goog.require('Blockly.Variables');\nconst xmlUtils = goog.require('Blockly.utils.xml');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {Msg} = goog.require('Blockly.Msg');\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldDropdown');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldLabel');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldNumber');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldVariable');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.Warning');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for repeat n times (external number).\n {\n 'type': 'controls_repeat_ext',\n 'message0': '%{BKY_CONTROLS_REPEAT_TITLE}',\n 'args0': [{\n 'type': 'input_value',\n 'name': 'TIMES',\n 'check': 'Number',\n }],\n 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1',\n 'args1': [{\n 'type': 'input_statement',\n 'name': 'DO',\n }],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'loop_blocks',\n 'tooltip': '%{BKY_CONTROLS_REPEAT_TOOLTIP}',\n 'helpUrl': '%{BKY_CONTROLS_REPEAT_HELPURL}',\n },\n // Block for repeat n times (internal number).\n // The 'controls_repeat_ext' block is preferred as it is more flexible.\n {\n 'type': 'controls_repeat',\n 'message0': '%{BKY_CONTROLS_REPEAT_TITLE}',\n 'args0': [{\n 'type': 'field_number',\n 'name': 'TIMES',\n 'value': 10,\n 'min': 0,\n 'precision': 1,\n }],\n 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1',\n 'args1': [{\n 'type': 'input_statement',\n 'name': 'DO',\n }],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'loop_blocks',\n 'tooltip': '%{BKY_CONTROLS_REPEAT_TOOLTIP}',\n 'helpUrl': '%{BKY_CONTROLS_REPEAT_HELPURL}',\n },\n // Block for 'do while/until' loop.\n {\n 'type': 'controls_whileUntil',\n 'message0': '%1 %2',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'MODE',\n 'options': [\n ['%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}', 'WHILE'],\n ['%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}', 'UNTIL'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'BOOL',\n 'check': 'Boolean',\n },\n ],\n 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1',\n 'args1': [{\n 'type': 'input_statement',\n 'name': 'DO',\n }],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'loop_blocks',\n 'helpUrl': '%{BKY_CONTROLS_WHILEUNTIL_HELPURL}',\n 'extensions': ['controls_whileUntil_tooltip'],\n },\n // Block for 'for' loop.\n {\n 'type': 'controls_for',\n 'message0': '%{BKY_CONTROLS_FOR_TITLE}',\n 'args0': [\n {\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': null,\n },\n {\n 'type': 'input_value',\n 'name': 'FROM',\n 'check': 'Number',\n 'align': 'RIGHT',\n },\n {\n 'type': 'input_value',\n 'name': 'TO',\n 'check': 'Number',\n 'align': 'RIGHT',\n },\n {\n 'type': 'input_value',\n 'name': 'BY',\n 'check': 'Number',\n 'align': 'RIGHT',\n },\n ],\n 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1',\n 'args1': [{\n 'type': 'input_statement',\n 'name': 'DO',\n }],\n 'inputsInline': true,\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'loop_blocks',\n 'helpUrl': '%{BKY_CONTROLS_FOR_HELPURL}',\n 'extensions': [\n 'contextMenu_newGetVariableBlock',\n 'controls_for_tooltip',\n ],\n },\n // Block for 'for each' loop.\n {\n 'type': 'controls_forEach',\n 'message0': '%{BKY_CONTROLS_FOREACH_TITLE}',\n 'args0': [\n {\n 'type': 'field_variable',\n 'name': 'VAR',\n 'variable': null,\n },\n {\n 'type': 'input_value',\n 'name': 'LIST',\n 'check': 'Array',\n },\n ],\n 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1',\n 'args1': [{\n 'type': 'input_statement',\n 'name': 'DO',\n }],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'loop_blocks',\n 'helpUrl': '%{BKY_CONTROLS_FOREACH_HELPURL}',\n 'extensions': [\n 'contextMenu_newGetVariableBlock',\n 'controls_forEach_tooltip',\n ],\n },\n // Block for flow statements: continue, break.\n {\n 'type': 'controls_flow_statements',\n 'message0': '%1',\n 'args0': [{\n 'type': 'field_dropdown',\n 'name': 'FLOW',\n 'options': [\n ['%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}', 'BREAK'],\n ['%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}', 'CONTINUE'],\n ],\n }],\n 'previousStatement': null,\n 'style': 'loop_blocks',\n 'helpUrl': '%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}',\n 'suppressPrefixSuffix': true,\n 'extensions': [\n 'controls_flow_tooltip',\n 'controls_flow_in_loop_check',\n ],\n },\n]);\nexports.blocks = blocks;\n\n/**\n * Tooltips for the 'controls_whileUntil' block, keyed by MODE value.\n * @see {Extensions#buildTooltipForDropdown}\n * @readonly\n */\nconst WHILE_UNTIL_TOOLTIPS = {\n 'WHILE': '%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}',\n 'UNTIL': '%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}',\n};\n\nExtensions.register(\n 'controls_whileUntil_tooltip',\n Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS));\n\n/**\n * Tooltips for the 'controls_flow_statements' block, keyed by FLOW value.\n * @see {Extensions#buildTooltipForDropdown}\n * @readonly\n */\nconst BREAK_CONTINUE_TOOLTIPS = {\n 'BREAK': '%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}',\n 'CONTINUE': '%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}',\n};\n\nExtensions.register(\n 'controls_flow_tooltip',\n Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS));\n\n/**\n * Mixin to add a context menu item to create a 'variables_get' block.\n * Used by blocks 'controls_for' and 'controls_forEach'.\n * @mixin\n * @augments Block\n * @package\n * @readonly\n */\nconst CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = {\n /**\n * Add context menu option to create getter block for the loop's variable.\n * (customContextMenu support limited to web BlockSvg.)\n * @param {!Array} options List of menu options to add to.\n * @this {Block}\n */\n customContextMenu: function(options) {\n if (this.isInFlyout) {\n return;\n }\n const variable = this.getField('VAR').getVariable();\n const varName = variable.name;\n if (!this.isCollapsed() && varName !== null) {\n const option = {enabled: true};\n option.text = Msg['VARIABLES_SET_CREATE_GET'].replace('%1', varName);\n const xmlField = Variables.generateVariableFieldDom(variable);\n const xmlBlock = xmlUtils.createElement('block');\n xmlBlock.setAttribute('type', 'variables_get');\n xmlBlock.appendChild(xmlField);\n option.callback = ContextMenu.callbackFactory(this, xmlBlock);\n options.push(option);\n }\n },\n};\n\nExtensions.registerMixin(\n 'contextMenu_newGetVariableBlock',\n CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN);\n\nExtensions.register(\n 'controls_for_tooltip',\n Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR'));\n\nExtensions.register(\n 'controls_forEach_tooltip',\n Extensions.buildTooltipWithFieldText(\n '%{BKY_CONTROLS_FOREACH_TOOLTIP}', 'VAR'));\n\n/**\n * List of block types that are loops and thus do not need warnings.\n * To add a new loop type add this to your code:\n *\n * // If using the Blockly npm package and es6 import syntax:\n * import {loops} from 'blockly/blocks';\n * loops.loopTypes.add('custom_loop');\n *\n * // Else if using Closure Compiler and goog.modules:\n * const {loopTypes} = goog.require('Blockly.libraryBlocks.loops');\n * loopTypes.add('custom_loop');\n *\n * // Else if using blockly_compressed + blockss_compressed.js in browser:\n * Blockly.libraryBlocks.loopTypes.add('custom_loop');\n *\n * @type {!Set<string>}\n */\nconst loopTypes = new Set([\n 'controls_repeat',\n 'controls_repeat_ext',\n 'controls_forEach',\n 'controls_for',\n 'controls_whileUntil',\n]);\nexports.loopTypes = loopTypes;\n\n/**\n * This mixin adds a check to make sure the 'controls_flow_statements' block\n * is contained in a loop. Otherwise a warning is added to the block.\n * @mixin\n * @augments Block\n * @public\n * @readonly\n */\nconst CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = {\n /**\n * Is this block enclosed (at any level) by a loop?\n * @return {Block} The nearest surrounding loop, or null if none.\n * @this {Block}\n */\n getSurroundLoop: function() {\n let block = this;\n do {\n if (loopTypes.has(block.type)) {\n return block;\n }\n block = block.getSurroundParent();\n } while (block);\n return null;\n },\n\n /**\n * Called whenever anything on the workspace changes.\n * Add warning if this flow block is not nested inside a loop.\n * @param {!AbstractEvent} e Move event.\n * @this {Block}\n */\n onchange: function(e) {\n // Don't change state if:\n // * It's at the start of a drag.\n // * It's not a move event.\n if (!this.workspace.isDragging || this.workspace.isDragging() ||\n e.type !== Events.BLOCK_MOVE) {\n return;\n }\n const enabled = this.getSurroundLoop(this);\n this.setWarningText(\n enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING']);\n if (!this.isInFlyout) {\n const group = Events.getGroup();\n // Makes it so the move and the disable event get undone together.\n Events.setGroup(e.group);\n this.setEnabled(enabled);\n Events.setGroup(group);\n }\n },\n};\n\nExtensions.registerMixin(\n 'controls_flow_in_loop_check', CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Logic blocks for Blockly.\n * @suppress {checkTypes}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.logic');\n\n/* eslint-disable-next-line no-unused-vars */\nconst AbstractEvent = goog.requireType('Blockly.Events.Abstract');\nconst Events = goog.require('Blockly.Events');\nconst Extensions = goog.require('Blockly.Extensions');\nconst xmlUtils = goog.require('Blockly.utils.xml');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {Msg} = goog.require('Blockly.Msg');\nconst {Mutator} = goog.require('Blockly.Mutator');\n/* eslint-disable-next-line no-unused-vars */\nconst {RenderedConnection} = goog.requireType('Blockly.RenderedConnection');\n/* eslint-disable-next-line no-unused-vars */\nconst {Workspace} = goog.requireType('Blockly.Workspace');\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldDropdown');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldLabel');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for boolean data type: true and false.\n {\n 'type': 'logic_boolean',\n 'message0': '%1',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'BOOL',\n 'options': [\n ['%{BKY_LOGIC_BOOLEAN_TRUE}', 'TRUE'],\n ['%{BKY_LOGIC_BOOLEAN_FALSE}', 'FALSE'],\n ],\n },\n ],\n 'output': 'Boolean',\n 'style': 'logic_blocks',\n 'tooltip': '%{BKY_LOGIC_BOOLEAN_TOOLTIP}',\n 'helpUrl': '%{BKY_LOGIC_BOOLEAN_HELPURL}',\n },\n // Block for if/elseif/else condition.\n {\n 'type': 'controls_if',\n 'message0': '%{BKY_CONTROLS_IF_MSG_IF} %1',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'IF0',\n 'check': 'Boolean',\n },\n ],\n 'message1': '%{BKY_CONTROLS_IF_MSG_THEN} %1',\n 'args1': [\n {\n 'type': 'input_statement',\n 'name': 'DO0',\n },\n ],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'logic_blocks',\n 'helpUrl': '%{BKY_CONTROLS_IF_HELPURL}',\n 'suppressPrefixSuffix': true,\n 'mutator': 'controls_if_mutator',\n 'extensions': ['controls_if_tooltip'],\n },\n // If/else block that does not use a mutator.\n {\n 'type': 'controls_ifelse',\n 'message0': '%{BKY_CONTROLS_IF_MSG_IF} %1',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'IF0',\n 'check': 'Boolean',\n },\n ],\n 'message1': '%{BKY_CONTROLS_IF_MSG_THEN} %1',\n 'args1': [\n {\n 'type': 'input_statement',\n 'name': 'DO0',\n },\n ],\n 'message2': '%{BKY_CONTROLS_IF_MSG_ELSE} %1',\n 'args2': [\n {\n 'type': 'input_statement',\n 'name': 'ELSE',\n },\n ],\n 'previousStatement': null,\n 'nextStatement': null,\n 'style': 'logic_blocks',\n 'tooltip': '%{BKYCONTROLS_IF_TOOLTIP_2}',\n 'helpUrl': '%{BKY_CONTROLS_IF_HELPURL}',\n 'suppressPrefixSuffix': true,\n 'extensions': ['controls_if_tooltip'],\n },\n // Block for comparison operator.\n {\n 'type': 'logic_compare',\n 'message0': '%1 %2 %3',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'A',\n },\n {\n 'type': 'field_dropdown',\n 'name': 'OP',\n 'options': [\n ['=', 'EQ'],\n ['\\u2260', 'NEQ'],\n ['\\u200F<', 'LT'],\n ['\\u200F\\u2264', 'LTE'],\n ['\\u200F>', 'GT'],\n ['\\u200F\\u2265', 'GTE'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'B',\n },\n ],\n 'inputsInline': true,\n 'output': 'Boolean',\n 'style': 'logic_blocks',\n 'helpUrl': '%{BKY_LOGIC_COMPARE_HELPURL}',\n 'extensions': ['logic_compare', 'logic_op_tooltip'],\n },\n // Block for logical operations: 'and', 'or'.\n {\n 'type': 'logic_operation',\n 'message0': '%1 %2 %3',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'A',\n 'check': 'Boolean',\n },\n {\n 'type': 'field_dropdown',\n 'name': 'OP',\n 'options': [\n ['%{BKY_LOGIC_OPERATION_AND}', 'AND'],\n ['%{BKY_LOGIC_OPERATION_OR}', 'OR'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'B',\n 'check': 'Boolean',\n },\n ],\n 'inputsInline': true,\n 'output': 'Boolean',\n 'style': 'logic_blocks',\n 'helpUrl': '%{BKY_LOGIC_OPERATION_HELPURL}',\n 'extensions': ['logic_op_tooltip'],\n },\n // Block for negation.\n {\n 'type': 'logic_negate',\n 'message0': '%{BKY_LOGIC_NEGATE_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'BOOL',\n 'check': 'Boolean',\n },\n ],\n 'output': 'Boolean',\n 'style': 'logic_blocks',\n 'tooltip': '%{BKY_LOGIC_NEGATE_TOOLTIP}',\n 'helpUrl': '%{BKY_LOGIC_NEGATE_HELPURL}',\n },\n // Block for null data type.\n {\n 'type': 'logic_null',\n 'message0': '%{BKY_LOGIC_NULL}',\n 'output': null,\n 'style': 'logic_blocks',\n 'tooltip': '%{BKY_LOGIC_NULL_TOOLTIP}',\n 'helpUrl': '%{BKY_LOGIC_NULL_HELPURL}',\n },\n // Block for ternary operator.\n {\n 'type': 'logic_ternary',\n 'message0': '%{BKY_LOGIC_TERNARY_CONDITION} %1',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'IF',\n 'check': 'Boolean',\n },\n ],\n 'message1': '%{BKY_LOGIC_TERNARY_IF_TRUE} %1',\n 'args1': [\n {\n 'type': 'input_value',\n 'name': 'THEN',\n },\n ],\n 'message2': '%{BKY_LOGIC_TERNARY_IF_FALSE} %1',\n 'args2': [\n {\n 'type': 'input_value',\n 'name': 'ELSE',\n },\n ],\n 'output': null,\n 'style': 'logic_blocks',\n 'tooltip': '%{BKY_LOGIC_TERNARY_TOOLTIP}',\n 'helpUrl': '%{BKY_LOGIC_TERNARY_HELPURL}',\n 'extensions': ['logic_ternary'],\n },\n // Block representing the if statement in the controls_if mutator.\n {\n 'type': 'controls_if_if',\n 'message0': '%{BKY_CONTROLS_IF_IF_TITLE_IF}',\n 'nextStatement': null,\n 'enableContextMenu': false,\n 'style': 'logic_blocks',\n 'tooltip': '%{BKY_CONTROLS_IF_IF_TOOLTIP}',\n },\n // Block representing the else-if statement in the controls_if mutator.\n {\n 'type': 'controls_if_elseif',\n 'message0': '%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}',\n 'previousStatement': null,\n 'nextStatement': null,\n 'enableContextMenu': false,\n 'style': 'logic_blocks',\n 'tooltip': '%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}',\n },\n // Block representing the else statement in the controls_if mutator.\n {\n 'type': 'controls_if_else',\n 'message0': '%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}',\n 'previousStatement': null,\n 'enableContextMenu': false,\n 'style': 'logic_blocks',\n 'tooltip': '%{BKY_CONTROLS_IF_ELSE_TOOLTIP}',\n },\n]);\nexports.blocks = blocks;\n\n/**\n * Tooltip text, keyed by block OP value. Used by logic_compare and\n * logic_operation blocks.\n * @see {Extensions#buildTooltipForDropdown}\n * @readonly\n */\nconst TOOLTIPS_BY_OP = {\n // logic_compare\n 'EQ': '%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}',\n 'NEQ': '%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}',\n 'LT': '%{BKY_LOGIC_COMPARE_TOOLTIP_LT}',\n 'LTE': '%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}',\n 'GT': '%{BKY_LOGIC_COMPARE_TOOLTIP_GT}',\n 'GTE': '%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}',\n\n // logic_operation\n 'AND': '%{BKY_LOGIC_OPERATION_TOOLTIP_AND}',\n 'OR': '%{BKY_LOGIC_OPERATION_TOOLTIP_OR}',\n};\n\nExtensions.register(\n 'logic_op_tooltip',\n Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP));\n\n/**\n * Mutator methods added to controls_if blocks.\n * @mixin\n * @augments Block\n * @readonly\n */\nconst CONTROLS_IF_MUTATOR_MIXIN = {\n elseifCount_: 0,\n elseCount_: 0,\n\n /**\n * Create XML to represent the number of else-if and else inputs.\n * Backwards compatible serialization implementation.\n * @return {Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n if (!this.elseifCount_ && !this.elseCount_) {\n return null;\n }\n const container = xmlUtils.createElement('mutation');\n if (this.elseifCount_) {\n container.setAttribute('elseif', this.elseifCount_);\n }\n if (this.elseCount_) {\n container.setAttribute('else', 1);\n }\n return container;\n },\n /**\n * Parse XML to restore the else-if and else inputs.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n this.elseifCount_ = parseInt(xmlElement.getAttribute('elseif'), 10) || 0;\n this.elseCount_ = parseInt(xmlElement.getAttribute('else'), 10) || 0;\n this.rebuildShape_();\n },\n /**\n * Returns the state of this block as a JSON serializable object.\n * @return {?{elseIfCount: (number|undefined), haseElse: (boolean|undefined)}}\n * The state of this block, ie the else if count and else state.\n */\n saveExtraState: function() {\n if (!this.elseifCount_ && !this.elseCount_) {\n return null;\n }\n const state = Object.create(null);\n if (this.elseifCount_) {\n state['elseIfCount'] = this.elseifCount_;\n }\n if (this.elseCount_) {\n state['hasElse'] = true;\n }\n return state;\n },\n /**\n * Applies the given state to this block.\n * @param {*} state The state to apply to this block, ie the else if count and\n * else state.\n */\n loadExtraState: function(state) {\n this.elseifCount_ = state['elseIfCount'] || 0;\n this.elseCount_ = state['hasElse'] ? 1 : 0;\n this.updateShape_();\n },\n /**\n * Populate the mutator's dialog with this block's components.\n * @param {!Workspace} workspace Mutator's workspace.\n * @return {!Block} Root block in mutator.\n * @this {Block}\n */\n decompose: function(workspace) {\n const containerBlock = workspace.newBlock('controls_if_if');\n containerBlock.initSvg();\n let connection = containerBlock.nextConnection;\n for (let i = 1; i <= this.elseifCount_; i++) {\n const elseifBlock = workspace.newBlock('controls_if_elseif');\n elseifBlock.initSvg();\n connection.connect(elseifBlock.previousConnection);\n connection = elseifBlock.nextConnection;\n }\n if (this.elseCount_) {\n const elseBlock = workspace.newBlock('controls_if_else');\n elseBlock.initSvg();\n connection.connect(elseBlock.previousConnection);\n }\n return containerBlock;\n },\n /**\n * Reconfigure this block based on the mutator dialog's components.\n * @param {!Block} containerBlock Root block in mutator.\n * @this {Block}\n */\n compose: function(containerBlock) {\n let clauseBlock = containerBlock.nextConnection.targetBlock();\n // Count number of inputs.\n this.elseifCount_ = 0;\n this.elseCount_ = 0;\n const valueConnections = [null];\n const statementConnections = [null];\n let elseStatementConnection = null;\n while (clauseBlock) {\n if (clauseBlock.isInsertionMarker()) {\n clauseBlock = clauseBlock.getNextBlock();\n continue;\n }\n switch (clauseBlock.type) {\n case 'controls_if_elseif':\n this.elseifCount_++;\n valueConnections.push(clauseBlock.valueConnection_);\n statementConnections.push(clauseBlock.statementConnection_);\n break;\n case 'controls_if_else':\n this.elseCount_++;\n elseStatementConnection = clauseBlock.statementConnection_;\n break;\n default:\n throw TypeError('Unknown block type: ' + clauseBlock.type);\n }\n clauseBlock = clauseBlock.getNextBlock();\n }\n this.updateShape_();\n // Reconnect any child blocks.\n this.reconnectChildBlocks_(\n valueConnections, statementConnections, elseStatementConnection);\n },\n /**\n * Store pointers to any connected child blocks.\n * @param {!Block} containerBlock Root block in mutator.\n * @this {Block}\n */\n saveConnections: function(containerBlock) {\n let clauseBlock = containerBlock.nextConnection.targetBlock();\n let i = 1;\n while (clauseBlock) {\n if (clauseBlock.isInsertionMarker()) {\n clauseBlock = clauseBlock.getNextBlock();\n continue;\n }\n switch (clauseBlock.type) {\n case 'controls_if_elseif': {\n const inputIf = this.getInput('IF' + i);\n const inputDo = this.getInput('DO' + i);\n clauseBlock.valueConnection_ =\n inputIf && inputIf.connection.targetConnection;\n clauseBlock.statementConnection_ =\n inputDo && inputDo.connection.targetConnection;\n i++;\n break;\n }\n case 'controls_if_else': {\n const inputDo = this.getInput('ELSE');\n clauseBlock.statementConnection_ =\n inputDo && inputDo.connection.targetConnection;\n break;\n }\n default:\n throw TypeError('Unknown block type: ' + clauseBlock.type);\n }\n clauseBlock = clauseBlock.getNextBlock();\n }\n },\n /**\n * Reconstructs the block with all child blocks attached.\n * @this {Block}\n */\n rebuildShape_: function() {\n const valueConnections = [null];\n const statementConnections = [null];\n let elseStatementConnection = null;\n\n if (this.getInput('ELSE')) {\n elseStatementConnection =\n this.getInput('ELSE').connection.targetConnection;\n }\n for (let i = 1; this.getInput('IF' + i); i++) {\n const inputIf = this.getInput('IF' + i);\n const inputDo = this.getInput('DO' + i);\n valueConnections.push(inputIf.connection.targetConnection);\n statementConnections.push(inputDo.connection.targetConnection);\n }\n this.updateShape_();\n this.reconnectChildBlocks_(\n valueConnections, statementConnections, elseStatementConnection);\n },\n /**\n * Modify this block to have the correct number of inputs.\n * @this {Block}\n * @private\n */\n updateShape_: function() {\n // Delete everything.\n if (this.getInput('ELSE')) {\n this.removeInput('ELSE');\n }\n for (let i = 1; this.getInput('IF' + i); i++) {\n this.removeInput('IF' + i);\n this.removeInput('DO' + i);\n }\n // Rebuild block.\n for (let i = 1; i <= this.elseifCount_; i++) {\n this.appendValueInput('IF' + i).setCheck('Boolean').appendField(\n Msg['CONTROLS_IF_MSG_ELSEIF']);\n this.appendStatementInput('DO' + i).appendField(\n Msg['CONTROLS_IF_MSG_THEN']);\n }\n if (this.elseCount_) {\n this.appendStatementInput('ELSE').appendField(\n Msg['CONTROLS_IF_MSG_ELSE']);\n }\n },\n /**\n * Reconnects child blocks.\n * @param {!Array<?RenderedConnection>} valueConnections List of\n * value connections for 'if' input.\n * @param {!Array<?RenderedConnection>} statementConnections List of\n * statement connections for 'do' input.\n * @param {?RenderedConnection} elseStatementConnection Statement\n * connection for else input.\n * @this {Block}\n */\n reconnectChildBlocks_: function(\n valueConnections, statementConnections, elseStatementConnection) {\n for (let i = 1; i <= this.elseifCount_; i++) {\n Mutator.reconnect(valueConnections[i], this, 'IF' + i);\n Mutator.reconnect(statementConnections[i], this, 'DO' + i);\n }\n Mutator.reconnect(elseStatementConnection, this, 'ELSE');\n },\n};\n\nExtensions.registerMutator(\n 'controls_if_mutator', CONTROLS_IF_MUTATOR_MIXIN, null,\n ['controls_if_elseif', 'controls_if_else']);\n/**\n * \"controls_if\" extension function. Adds mutator, shape updating methods, and\n * dynamic tooltip to \"controls_if\" blocks.\n * @this {Block}\n */\nconst CONTROLS_IF_TOOLTIP_EXTENSION = function() {\n this.setTooltip(function() {\n if (!this.elseifCount_ && !this.elseCount_) {\n return Msg['CONTROLS_IF_TOOLTIP_1'];\n } else if (!this.elseifCount_ && this.elseCount_) {\n return Msg['CONTROLS_IF_TOOLTIP_2'];\n } else if (this.elseifCount_ && !this.elseCount_) {\n return Msg['CONTROLS_IF_TOOLTIP_3'];\n } else if (this.elseifCount_ && this.elseCount_) {\n return Msg['CONTROLS_IF_TOOLTIP_4'];\n }\n return '';\n }.bind(this));\n};\n\nExtensions.register('controls_if_tooltip', CONTROLS_IF_TOOLTIP_EXTENSION);\n\n/**\n * Adds dynamic type validation for the left and right sides of a logic_compare\n * block.\n * @mixin\n * @augments Block\n * @readonly\n */\nconst LOGIC_COMPARE_ONCHANGE_MIXIN = {\n /**\n * Called whenever anything on the workspace changes.\n * Prevent mismatched types from being compared.\n * @param {!AbstractEvent} e Change event.\n * @this {Block}\n */\n onchange: function(e) {\n if (!this.prevBlocks_) {\n this.prevBlocks_ = [null, null];\n }\n\n const blockA = this.getInputTargetBlock('A');\n const blockB = this.getInputTargetBlock('B');\n // Disconnect blocks that existed prior to this change if they don't match.\n if (blockA && blockB &&\n !this.workspace.connectionChecker.doTypeChecks(\n blockA.outputConnection, blockB.outputConnection)) {\n // Mismatch between two inputs. Revert the block connections,\n // bumping away the newly connected block(s).\n Events.setGroup(e.group);\n const prevA = this.prevBlocks_[0];\n if (prevA !== blockA) {\n blockA.unplug();\n if (prevA && !prevA.isDisposed() && !prevA.isShadow()) {\n // The shadow block is automatically replaced during unplug().\n this.getInput('A').connection.connect(prevA.outputConnection);\n }\n }\n const prevB = this.prevBlocks_[1];\n if (prevB !== blockB) {\n blockB.unplug();\n if (prevB && !prevB.isDisposed() && !prevB.isShadow()) {\n // The shadow block is automatically replaced during unplug().\n this.getInput('B').connection.connect(prevB.outputConnection);\n }\n }\n this.bumpNeighbours();\n Events.setGroup(false);\n }\n this.prevBlocks_[0] = this.getInputTargetBlock('A');\n this.prevBlocks_[1] = this.getInputTargetBlock('B');\n },\n};\n\n/**\n * \"logic_compare\" extension function. Adds type left and right side type\n * checking to \"logic_compare\" blocks.\n * @this {Block}\n * @readonly\n */\nconst LOGIC_COMPARE_EXTENSION = function() {\n // Add onchange handler to ensure types are compatible.\n this.mixin(LOGIC_COMPARE_ONCHANGE_MIXIN);\n};\n\nExtensions.register('logic_compare', LOGIC_COMPARE_EXTENSION);\n\n/**\n * Adds type coordination between inputs and output.\n * @mixin\n * @augments Block\n * @readonly\n */\nconst LOGIC_TERNARY_ONCHANGE_MIXIN = {\n prevParentConnection_: null,\n\n /**\n * Called whenever anything on the workspace changes.\n * Prevent mismatched types.\n * @param {!AbstractEvent} e Change event.\n * @this {Block}\n */\n onchange: function(e) {\n const blockA = this.getInputTargetBlock('THEN');\n const blockB = this.getInputTargetBlock('ELSE');\n const parentConnection = this.outputConnection.targetConnection;\n // Disconnect blocks that existed prior to this change if they don't match.\n if ((blockA || blockB) && parentConnection) {\n for (let i = 0; i < 2; i++) {\n const block = (i === 1) ? blockA : blockB;\n if (block &&\n !block.workspace.connectionChecker.doTypeChecks(\n block.outputConnection, parentConnection)) {\n // Ensure that any disconnections are grouped with the causing event.\n Events.setGroup(e.group);\n if (parentConnection === this.prevParentConnection_) {\n this.unplug();\n parentConnection.getSourceBlock().bumpNeighbours();\n } else {\n block.unplug();\n block.bumpNeighbours();\n }\n Events.setGroup(false);\n }\n }\n }\n this.prevParentConnection_ = parentConnection;\n },\n};\n\nExtensions.registerMixin('logic_ternary', LOGIC_TERNARY_ONCHANGE_MIXIN);\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview List blocks for Blockly.\n * @suppress {checkTypes}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.lists');\n\nconst xmlUtils = goog.require('Blockly.utils.xml');\nconst Xml = goog.require('Blockly.Xml');\nconst {Align} = goog.require('Blockly.Input');\n/* eslint-disable-next-line no-unused-vars */\nconst {Block} = goog.requireType('Blockly.Block');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {ConnectionType} = goog.require('Blockly.ConnectionType');\nconst {FieldDropdown} = goog.require('Blockly.FieldDropdown');\nconst {Msg} = goog.require('Blockly.Msg');\nconst {Mutator} = goog.require('Blockly.Mutator');\n/* eslint-disable-next-line no-unused-vars */\nconst {Workspace} = goog.requireType('Blockly.Workspace');\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldDropdown');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for creating an empty list\n // The 'list_create_with' block is preferred as it is more flexible.\n // <block type=\"lists_create_with\">\n // <mutation items=\"0\"></mutation>\n // </block>\n {\n 'type': 'lists_create_empty',\n 'message0': '%{BKY_LISTS_CREATE_EMPTY_TITLE}',\n 'output': 'Array',\n 'style': 'list_blocks',\n 'tooltip': '%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}',\n 'helpUrl': '%{BKY_LISTS_CREATE_EMPTY_HELPURL}',\n },\n // Block for creating a list with one element repeated.\n {\n 'type': 'lists_repeat',\n 'message0': '%{BKY_LISTS_REPEAT_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'ITEM',\n },\n {\n 'type': 'input_value',\n 'name': 'NUM',\n 'check': 'Number',\n },\n ],\n 'output': 'Array',\n 'style': 'list_blocks',\n 'tooltip': '%{BKY_LISTS_REPEAT_TOOLTIP}',\n 'helpUrl': '%{BKY_LISTS_REPEAT_HELPURL}',\n },\n // Block for reversing a list.\n {\n 'type': 'lists_reverse',\n 'message0': '%{BKY_LISTS_REVERSE_MESSAGE0}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'LIST',\n 'check': 'Array',\n },\n ],\n 'output': 'Array',\n 'inputsInline': true,\n 'style': 'list_blocks',\n 'tooltip': '%{BKY_LISTS_REVERSE_TOOLTIP}',\n 'helpUrl': '%{BKY_LISTS_REVERSE_HELPURL}',\n },\n // Block for checking if a list is empty\n {\n 'type': 'lists_isEmpty',\n 'message0': '%{BKY_LISTS_ISEMPTY_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n 'check': ['String', 'Array'],\n },\n ],\n 'output': 'Boolean',\n 'style': 'list_blocks',\n 'tooltip': '%{BKY_LISTS_ISEMPTY_TOOLTIP}',\n 'helpUrl': '%{BKY_LISTS_ISEMPTY_HELPURL}',\n },\n // Block for getting the list length\n {\n 'type': 'lists_length',\n 'message0': '%{BKY_LISTS_LENGTH_TITLE}',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'VALUE',\n 'check': ['String', 'Array'],\n },\n ],\n 'output': 'Number',\n 'style': 'list_blocks',\n 'tooltip': '%{BKY_LISTS_LENGTH_TOOLTIP}',\n 'helpUrl': '%{BKY_LISTS_LENGTH_HELPURL}',\n },\n]);\nexports.blocks = blocks;\n\nblocks['lists_create_with'] = {\n /**\n * Block for creating a list with any number of elements of any type.\n * @this {Block}\n */\n init: function() {\n this.setHelpUrl(Msg['LISTS_CREATE_WITH_HELPURL']);\n this.setStyle('list_blocks');\n this.itemCount_ = 3;\n this.updateShape_();\n this.setOutput(true, 'Array');\n this.setMutator(new Mutator(['lists_create_with_item'], this));\n this.setTooltip(Msg['LISTS_CREATE_WITH_TOOLTIP']);\n },\n /**\n * Create XML to represent list inputs.\n * Backwards compatible serialization implementation.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('items', this.itemCount_);\n return container;\n },\n /**\n * Parse XML to restore the list inputs.\n * Backwards compatible serialization implementation.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);\n this.updateShape_();\n },\n /**\n * Returns the state of this block as a JSON serializable object.\n * @return {{itemCount: number}} The state of this block, ie the item count.\n */\n saveExtraState: function() {\n return {\n 'itemCount': this.itemCount_,\n };\n },\n /**\n * Applies the given state to this block.\n * @param {*} state The state to apply to this block, ie the item count.\n */\n loadExtraState: function(state) {\n this.itemCount_ = state['itemCount'];\n this.updateShape_();\n },\n /**\n * Populate the mutator's dialog with this block's components.\n * @param {!Workspace} workspace Mutator's workspace.\n * @return {!Block} Root block in mutator.\n * @this {Block}\n */\n decompose: function(workspace) {\n const containerBlock = workspace.newBlock('lists_create_with_container');\n containerBlock.initSvg();\n let connection = containerBlock.getInput('STACK').connection;\n for (let i = 0; i < this.itemCount_; i++) {\n const itemBlock = workspace.newBlock('lists_create_with_item');\n itemBlock.initSvg();\n connection.connect(itemBlock.previousConnection);\n connection = itemBlock.nextConnection;\n }\n return containerBlock;\n },\n /**\n * Reconfigure this block based on the mutator dialog's components.\n * @param {!Block} containerBlock Root block in mutator.\n * @this {Block}\n */\n compose: function(containerBlock) {\n let itemBlock = containerBlock.getInputTargetBlock('STACK');\n // Count number of inputs.\n const connections = [];\n while (itemBlock) {\n if (itemBlock.isInsertionMarker()) {\n itemBlock = itemBlock.getNextBlock();\n continue;\n }\n connections.push(itemBlock.valueConnection_);\n itemBlock = itemBlock.getNextBlock();\n }\n // Disconnect any children that don't belong.\n for (let i = 0; i < this.itemCount_; i++) {\n const connection = this.getInput('ADD' + i).connection.targetConnection;\n if (connection && connections.indexOf(connection) === -1) {\n connection.disconnect();\n }\n }\n this.itemCount_ = connections.length;\n this.updateShape_();\n // Reconnect any child blocks.\n for (let i = 0; i < this.itemCount_; i++) {\n Mutator.reconnect(connections[i], this, 'ADD' + i);\n }\n },\n /**\n * Store pointers to any connected child blocks.\n * @param {!Block} containerBlock Root block in mutator.\n * @this {Block}\n */\n saveConnections: function(containerBlock) {\n let itemBlock = containerBlock.getInputTargetBlock('STACK');\n let i = 0;\n while (itemBlock) {\n if (itemBlock.isInsertionMarker()) {\n itemBlock = itemBlock.getNextBlock();\n continue;\n }\n const input = this.getInput('ADD' + i);\n itemBlock.valueConnection_ = input && input.connection.targetConnection;\n itemBlock = itemBlock.getNextBlock();\n i++;\n }\n },\n /**\n * Modify this block to have the correct number of inputs.\n * @private\n * @this {Block}\n */\n updateShape_: function() {\n if (this.itemCount_ && this.getInput('EMPTY')) {\n this.removeInput('EMPTY');\n } else if (!this.itemCount_ && !this.getInput('EMPTY')) {\n this.appendDummyInput('EMPTY').appendField(\n Msg['LISTS_CREATE_EMPTY_TITLE']);\n }\n // Add new inputs.\n for (let i = 0; i < this.itemCount_; i++) {\n if (!this.getInput('ADD' + i)) {\n const input = this.appendValueInput('ADD' + i).setAlign(Align.RIGHT);\n if (i === 0) {\n input.appendField(Msg['LISTS_CREATE_WITH_INPUT_WITH']);\n }\n }\n }\n // Remove deleted inputs.\n for (let i = this.itemCount_; this.getInput('ADD' + i); i++) {\n this.removeInput('ADD' + i);\n }\n },\n};\n\nblocks['lists_create_with_container'] = {\n /**\n * Mutator block for list container.\n * @this {Block}\n */\n init: function() {\n this.setStyle('list_blocks');\n this.appendDummyInput().appendField(\n Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD']);\n this.appendStatementInput('STACK');\n this.setTooltip(Msg['LISTS_CREATE_WITH_CONTAINER_TOOLTIP']);\n this.contextMenu = false;\n },\n};\n\nblocks['lists_create_with_item'] = {\n /**\n * Mutator block for adding items.\n * @this {Block}\n */\n init: function() {\n this.setStyle('list_blocks');\n this.appendDummyInput().appendField(Msg['LISTS_CREATE_WITH_ITEM_TITLE']);\n this.setPreviousStatement(true);\n this.setNextStatement(true);\n this.setTooltip(Msg['LISTS_CREATE_WITH_ITEM_TOOLTIP']);\n this.contextMenu = false;\n },\n};\n\nblocks['lists_indexOf'] = {\n /**\n * Block for finding an item in the list.\n * @this {Block}\n */\n init: function() {\n const OPERATORS = [\n [Msg['LISTS_INDEX_OF_FIRST'], 'FIRST'],\n [Msg['LISTS_INDEX_OF_LAST'], 'LAST'],\n ];\n this.setHelpUrl(Msg['LISTS_INDEX_OF_HELPURL']);\n this.setStyle('list_blocks');\n this.setOutput(true, 'Number');\n this.appendValueInput('VALUE').setCheck('Array').appendField(\n Msg['LISTS_INDEX_OF_INPUT_IN_LIST']);\n this.appendValueInput('FIND').appendField(\n new FieldDropdown(OPERATORS), 'END');\n this.setInputsInline(true);\n // Assign 'this' to a variable for use in the tooltip closure below.\n const thisBlock = this;\n this.setTooltip(function() {\n return Msg['LISTS_INDEX_OF_TOOLTIP'].replace(\n '%1', thisBlock.workspace.options.oneBasedIndex ? '0' : '-1');\n });\n },\n};\n\nblocks['lists_getIndex'] = {\n /**\n * Block for getting element at index.\n * @this {Block}\n */\n init: function() {\n const MODE = [\n [Msg['LISTS_GET_INDEX_GET'], 'GET'],\n [Msg['LISTS_GET_INDEX_GET_REMOVE'], 'GET_REMOVE'],\n [Msg['LISTS_GET_INDEX_REMOVE'], 'REMOVE'],\n ];\n this.WHERE_OPTIONS = [\n [Msg['LISTS_GET_INDEX_FROM_START'], 'FROM_START'],\n [Msg['LISTS_GET_INDEX_FROM_END'], 'FROM_END'],\n [Msg['LISTS_GET_INDEX_FIRST'], 'FIRST'],\n [Msg['LISTS_GET_INDEX_LAST'], 'LAST'],\n [Msg['LISTS_GET_INDEX_RANDOM'], 'RANDOM'],\n ];\n this.setHelpUrl(Msg['LISTS_GET_INDEX_HELPURL']);\n this.setStyle('list_blocks');\n const modeMenu = new FieldDropdown(\n MODE,\n /**\n * @param {*} value The input value.\n * @this {FieldDropdown}\n */\n function(value) {\n const isStatement = (value === 'REMOVE');\n this.getSourceBlock().updateStatement_(isStatement);\n });\n this.appendValueInput('VALUE').setCheck('Array').appendField(\n Msg['LISTS_GET_INDEX_INPUT_IN_LIST']);\n this.appendDummyInput()\n .appendField(modeMenu, 'MODE')\n .appendField('', 'SPACE');\n this.appendDummyInput('AT');\n if (Msg['LISTS_GET_INDEX_TAIL']) {\n this.appendDummyInput('TAIL').appendField(Msg['LISTS_GET_INDEX_TAIL']);\n }\n this.setInputsInline(true);\n this.setOutput(true);\n this.updateAt_(true);\n // Assign 'this' to a variable for use in the tooltip closure below.\n const thisBlock = this;\n this.setTooltip(function() {\n const mode = thisBlock.getFieldValue('MODE');\n const where = thisBlock.getFieldValue('WHERE');\n let tooltip = '';\n switch (mode + ' ' + where) {\n case 'GET FROM_START':\n case 'GET FROM_END':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_FROM'];\n break;\n case 'GET FIRST':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_FIRST'];\n break;\n case 'GET LAST':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_LAST'];\n break;\n case 'GET RANDOM':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_RANDOM'];\n break;\n case 'GET_REMOVE FROM_START':\n case 'GET_REMOVE FROM_END':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM'];\n break;\n case 'GET_REMOVE FIRST':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST'];\n break;\n case 'GET_REMOVE LAST':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST'];\n break;\n case 'GET_REMOVE RANDOM':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM'];\n break;\n case 'REMOVE FROM_START':\n case 'REMOVE FROM_END':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM'];\n break;\n case 'REMOVE FIRST':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST'];\n break;\n case 'REMOVE LAST':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST'];\n break;\n case 'REMOVE RANDOM':\n tooltip = Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM'];\n break;\n }\n if (where === 'FROM_START' || where === 'FROM_END') {\n const msg = (where === 'FROM_START') ?\n Msg['LISTS_INDEX_FROM_START_TOOLTIP'] :\n Msg['LISTS_INDEX_FROM_END_TOOLTIP'];\n tooltip += ' ' +\n msg.replace(\n '%1', thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');\n }\n return tooltip;\n });\n },\n /**\n * Create XML to represent whether the block is a statement or a value.\n * Also represent whether there is an 'AT' input.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n const isStatement = !this.outputConnection;\n container.setAttribute('statement', isStatement);\n const isAt = this.getInput('AT').type === ConnectionType.INPUT_VALUE;\n container.setAttribute('at', isAt);\n return container;\n },\n /**\n * Parse XML to restore the 'AT' input.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n // Note: Until January 2013 this block did not have mutations,\n // so 'statement' defaults to false and 'at' defaults to true.\n const isStatement = (xmlElement.getAttribute('statement') === 'true');\n this.updateStatement_(isStatement);\n const isAt = (xmlElement.getAttribute('at') !== 'false');\n this.updateAt_(isAt);\n },\n\n /**\n * Returns the state of this block as a JSON serializable object.\n * Returns null for efficiency if no state is needed (not a statement)\n * @return {?{isStatement: boolean}} The state of this block, ie whether it's\n * a statement.\n */\n saveExtraState: function() {\n if (!this.outputConnection) {\n return {\n 'isStatement': true,\n };\n }\n return null;\n },\n\n /**\n * Applies the given state to this block.\n * @param {*} state The state to apply to this block, ie whether it's a\n * statement.\n */\n loadExtraState: function(state) {\n if (state['isStatement']) {\n this.updateStatement_(true);\n } else if (typeof state === 'string') {\n // backward compatible for json serialised mutations\n this.domToMutation(Xml.textToDom(state));\n }\n },\n\n /**\n * Switch between a value block and a statement block.\n * @param {boolean} newStatement True if the block should be a statement.\n * False if the block should be a value.\n * @private\n * @this {Block}\n */\n updateStatement_: function(newStatement) {\n const oldStatement = !this.outputConnection;\n if (newStatement !== oldStatement) {\n this.unplug(true, true);\n if (newStatement) {\n this.setOutput(false);\n this.setPreviousStatement(true);\n this.setNextStatement(true);\n } else {\n this.setPreviousStatement(false);\n this.setNextStatement(false);\n this.setOutput(true);\n }\n }\n },\n /**\n * Create or delete an input for the numeric index.\n * @param {boolean} isAt True if the input should exist.\n * @private\n * @this {Block}\n */\n updateAt_: function(isAt) {\n // Destroy old 'AT' and 'ORDINAL' inputs.\n this.removeInput('AT');\n this.removeInput('ORDINAL', true);\n // Create either a value 'AT' input or a dummy input.\n if (isAt) {\n this.appendValueInput('AT').setCheck('Number');\n if (Msg['ORDINAL_NUMBER_SUFFIX']) {\n this.appendDummyInput('ORDINAL').appendField(\n Msg['ORDINAL_NUMBER_SUFFIX']);\n }\n } else {\n this.appendDummyInput('AT');\n }\n const menu = new FieldDropdown(\n this.WHERE_OPTIONS,\n /**\n * @param {*} value The input value.\n * @this {FieldDropdown}\n * @return {null|undefined} Null if the field has been replaced;\n * otherwise undefined.\n */\n function(value) {\n const newAt = (value === 'FROM_START') || (value === 'FROM_END');\n // The 'isAt' variable is available due to this function being a\n // closure.\n if (newAt !== isAt) {\n const block = this.getSourceBlock();\n block.updateAt_(newAt);\n // This menu has been destroyed and replaced. Update the\n // replacement.\n block.setFieldValue(value, 'WHERE');\n return null;\n }\n return undefined;\n });\n this.getInput('AT').appendField(menu, 'WHERE');\n if (Msg['LISTS_GET_INDEX_TAIL']) {\n this.moveInputBefore('TAIL', null);\n }\n },\n};\n\nblocks['lists_setIndex'] = {\n /**\n * Block for setting the element at index.\n * @this {Block}\n */\n init: function() {\n const MODE = [\n [Msg['LISTS_SET_INDEX_SET'], 'SET'],\n [Msg['LISTS_SET_INDEX_INSERT'], 'INSERT'],\n ];\n this.WHERE_OPTIONS = [\n [Msg['LISTS_GET_INDEX_FROM_START'], 'FROM_START'],\n [Msg['LISTS_GET_INDEX_FROM_END'], 'FROM_END'],\n [Msg['LISTS_GET_INDEX_FIRST'], 'FIRST'],\n [Msg['LISTS_GET_INDEX_LAST'], 'LAST'],\n [Msg['LISTS_GET_INDEX_RANDOM'], 'RANDOM'],\n ];\n this.setHelpUrl(Msg['LISTS_SET_INDEX_HELPURL']);\n this.setStyle('list_blocks');\n this.appendValueInput('LIST').setCheck('Array').appendField(\n Msg['LISTS_SET_INDEX_INPUT_IN_LIST']);\n this.appendDummyInput()\n .appendField(new FieldDropdown(MODE), 'MODE')\n .appendField('', 'SPACE');\n this.appendDummyInput('AT');\n this.appendValueInput('TO').appendField(Msg['LISTS_SET_INDEX_INPUT_TO']);\n this.setInputsInline(true);\n this.setPreviousStatement(true);\n this.setNextStatement(true);\n this.setTooltip(Msg['LISTS_SET_INDEX_TOOLTIP']);\n this.updateAt_(true);\n // Assign 'this' to a variable for use in the tooltip closure below.\n const thisBlock = this;\n this.setTooltip(function() {\n const mode = thisBlock.getFieldValue('MODE');\n const where = thisBlock.getFieldValue('WHERE');\n let tooltip = '';\n switch (mode + ' ' + where) {\n case 'SET FROM_START':\n case 'SET FROM_END':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_SET_FROM'];\n break;\n case 'SET FIRST':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_SET_FIRST'];\n break;\n case 'SET LAST':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_SET_LAST'];\n break;\n case 'SET RANDOM':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_SET_RANDOM'];\n break;\n case 'INSERT FROM_START':\n case 'INSERT FROM_END':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_FROM'];\n break;\n case 'INSERT FIRST':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST'];\n break;\n case 'INSERT LAST':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_LAST'];\n break;\n case 'INSERT RANDOM':\n tooltip = Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM'];\n break;\n }\n if (where === 'FROM_START' || where === 'FROM_END') {\n tooltip += ' ' +\n Msg['LISTS_INDEX_FROM_START_TOOLTIP'].replace(\n '%1', thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');\n }\n return tooltip;\n });\n },\n /**\n * Create XML to represent whether there is an 'AT' input.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n const isAt = this.getInput('AT').type === ConnectionType.INPUT_VALUE;\n container.setAttribute('at', isAt);\n return container;\n },\n /**\n * Parse XML to restore the 'AT' input.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n // Note: Until January 2013 this block did not have mutations,\n // so 'at' defaults to true.\n const isAt = (xmlElement.getAttribute('at') !== 'false');\n this.updateAt_(isAt);\n },\n\n /**\n * Returns the state of this block as a JSON serializable object.\n * This block does not need to serialize any specific state as it is already\n * encoded in the dropdown values, but must have an implementation to avoid\n * the backward compatible XML mutations being serialized.\n * @return {null} The state of this block.\n */\n saveExtraState: function() {\n return null;\n },\n\n /**\n * Applies the given state to this block.\n * No extra state is needed or expected as it is already encoded in the\n * dropdown values.\n */\n loadExtraState: function() {},\n\n /**\n * Create or delete an input for the numeric index.\n * @param {boolean} isAt True if the input should exist.\n * @private\n * @this {Block}\n */\n updateAt_: function(isAt) {\n // Destroy old 'AT' and 'ORDINAL' input.\n this.removeInput('AT');\n this.removeInput('ORDINAL', true);\n // Create either a value 'AT' input or a dummy input.\n if (isAt) {\n this.appendValueInput('AT').setCheck('Number');\n if (Msg['ORDINAL_NUMBER_SUFFIX']) {\n this.appendDummyInput('ORDINAL').appendField(\n Msg['ORDINAL_NUMBER_SUFFIX']);\n }\n } else {\n this.appendDummyInput('AT');\n }\n const menu = new FieldDropdown(\n this.WHERE_OPTIONS,\n /**\n * @param {*} value The input value.\n * @this {FieldDropdown}\n * @return {null|undefined} Null if the field has been replaced;\n * otherwise undefined.\n */\n function(value) {\n const newAt = (value === 'FROM_START') || (value === 'FROM_END');\n // The 'isAt' variable is available due to this function being a\n // closure.\n if (newAt !== isAt) {\n const block = this.getSourceBlock();\n block.updateAt_(newAt);\n // This menu has been destroyed and replaced. Update the\n // replacement.\n block.setFieldValue(value, 'WHERE');\n return null;\n }\n return undefined;\n });\n this.moveInputBefore('AT', 'TO');\n if (this.getInput('ORDINAL')) {\n this.moveInputBefore('ORDINAL', 'TO');\n }\n\n this.getInput('AT').appendField(menu, 'WHERE');\n },\n};\n\nblocks['lists_getSublist'] = {\n /**\n * Block for getting sublist.\n * @this {Block}\n */\n init: function() {\n this['WHERE_OPTIONS_1'] = [\n [Msg['LISTS_GET_SUBLIST_START_FROM_START'], 'FROM_START'],\n [Msg['LISTS_GET_SUBLIST_START_FROM_END'], 'FROM_END'],\n [Msg['LISTS_GET_SUBLIST_START_FIRST'], 'FIRST'],\n ];\n this['WHERE_OPTIONS_2'] = [\n [Msg['LISTS_GET_SUBLIST_END_FROM_START'], 'FROM_START'],\n [Msg['LISTS_GET_SUBLIST_END_FROM_END'], 'FROM_END'],\n [Msg['LISTS_GET_SUBLIST_END_LAST'], 'LAST'],\n ];\n this.setHelpUrl(Msg['LISTS_GET_SUBLIST_HELPURL']);\n this.setStyle('list_blocks');\n this.appendValueInput('LIST').setCheck('Array').appendField(\n Msg['LISTS_GET_SUBLIST_INPUT_IN_LIST']);\n this.appendDummyInput('AT1');\n this.appendDummyInput('AT2');\n if (Msg['LISTS_GET_SUBLIST_TAIL']) {\n this.appendDummyInput('TAIL').appendField(Msg['LISTS_GET_SUBLIST_TAIL']);\n }\n this.setInputsInline(true);\n this.setOutput(true, 'Array');\n this.updateAt_(1, true);\n this.updateAt_(2, true);\n this.setTooltip(Msg['LISTS_GET_SUBLIST_TOOLTIP']);\n },\n /**\n * Create XML to represent whether there are 'AT' inputs.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n const isAt1 = this.getInput('AT1').type === ConnectionType.INPUT_VALUE;\n container.setAttribute('at1', isAt1);\n const isAt2 = this.getInput('AT2').type === ConnectionType.INPUT_VALUE;\n container.setAttribute('at2', isAt2);\n return container;\n },\n /**\n * Parse XML to restore the 'AT' inputs.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n const isAt1 = (xmlElement.getAttribute('at1') === 'true');\n const isAt2 = (xmlElement.getAttribute('at2') === 'true');\n this.updateAt_(1, isAt1);\n this.updateAt_(2, isAt2);\n },\n\n /**\n * Returns the state of this block as a JSON serializable object.\n * This block does not need to serialize any specific state as it is already\n * encoded in the dropdown values, but must have an implementation to avoid\n * the backward compatible XML mutations being serialized.\n * @return {null} The state of this block.\n */\n saveExtraState: function() {\n return null;\n },\n\n /**\n * Applies the given state to this block.\n * No extra state is needed or expected as it is already encoded in the\n * dropdown values.\n */\n loadExtraState: function() {},\n\n /**\n * Create or delete an input for a numeric index.\n * This block has two such inputs, independent of each other.\n * @param {number} n Specify first or second input (1 or 2).\n * @param {boolean} isAt True if the input should exist.\n * @private\n * @this {Block}\n */\n updateAt_: function(n, isAt) {\n // Create or delete an input for the numeric index.\n // Destroy old 'AT' and 'ORDINAL' inputs.\n this.removeInput('AT' + n);\n this.removeInput('ORDINAL' + n, true);\n // Create either a value 'AT' input or a dummy input.\n if (isAt) {\n this.appendValueInput('AT' + n).setCheck('Number');\n if (Msg['ORDINAL_NUMBER_SUFFIX']) {\n this.appendDummyInput('ORDINAL' + n)\n .appendField(Msg['ORDINAL_NUMBER_SUFFIX']);\n }\n } else {\n this.appendDummyInput('AT' + n);\n }\n const menu = new FieldDropdown(\n this['WHERE_OPTIONS_' + n],\n /**\n * @param {*} value The input value.\n * @this {FieldDropdown}\n * @return {null|undefined} Null if the field has been replaced;\n * otherwise undefined.\n */\n function(value) {\n const newAt = (value === 'FROM_START') || (value === 'FROM_END');\n // The 'isAt' variable is available due to this function being a\n // closure.\n if (newAt !== isAt) {\n const block = this.getSourceBlock();\n block.updateAt_(n, newAt);\n // This menu has been destroyed and replaced.\n // Update the replacement.\n block.setFieldValue(value, 'WHERE' + n);\n return null;\n }\n });\n this.getInput('AT' + n).appendField(menu, 'WHERE' + n);\n if (n === 1) {\n this.moveInputBefore('AT1', 'AT2');\n if (this.getInput('ORDINAL1')) {\n this.moveInputBefore('ORDINAL1', 'AT2');\n }\n }\n if (Msg['LISTS_GET_SUBLIST_TAIL']) {\n this.moveInputBefore('TAIL', null);\n }\n },\n};\n\nblocks['lists_sort'] = {\n /**\n * Block for sorting a list.\n * @this {Block}\n */\n init: function() {\n this.jsonInit({\n 'message0': '%{BKY_LISTS_SORT_TITLE}',\n 'args0': [\n {\n 'type': 'field_dropdown',\n 'name': 'TYPE',\n 'options': [\n ['%{BKY_LISTS_SORT_TYPE_NUMERIC}', 'NUMERIC'],\n ['%{BKY_LISTS_SORT_TYPE_TEXT}', 'TEXT'],\n ['%{BKY_LISTS_SORT_TYPE_IGNORECASE}', 'IGNORE_CASE'],\n ],\n },\n {\n 'type': 'field_dropdown',\n 'name': 'DIRECTION',\n 'options': [\n ['%{BKY_LISTS_SORT_ORDER_ASCENDING}', '1'],\n ['%{BKY_LISTS_SORT_ORDER_DESCENDING}', '-1'],\n ],\n },\n {\n 'type': 'input_value',\n 'name': 'LIST',\n 'check': 'Array',\n },\n ],\n 'output': 'Array',\n 'style': 'list_blocks',\n 'tooltip': '%{BKY_LISTS_SORT_TOOLTIP}',\n 'helpUrl': '%{BKY_LISTS_SORT_HELPURL}',\n });\n },\n};\n\nblocks['lists_split'] = {\n /**\n * Block for splitting text into a list, or joining a list into text.\n * @this {Block}\n */\n init: function() {\n // Assign 'this' to a variable for use in the closures below.\n const thisBlock = this;\n const dropdown = new FieldDropdown(\n [\n [Msg['LISTS_SPLIT_LIST_FROM_TEXT'], 'SPLIT'],\n [Msg['LISTS_SPLIT_TEXT_FROM_LIST'], 'JOIN'],\n ],\n function(newMode) {\n thisBlock.updateType_(newMode);\n });\n this.setHelpUrl(Msg['LISTS_SPLIT_HELPURL']);\n this.setStyle('list_blocks');\n this.appendValueInput('INPUT').setCheck('String').appendField(\n dropdown, 'MODE');\n this.appendValueInput('DELIM').setCheck('String').appendField(\n Msg['LISTS_SPLIT_WITH_DELIMITER']);\n this.setInputsInline(true);\n this.setOutput(true, 'Array');\n this.setTooltip(function() {\n const mode = thisBlock.getFieldValue('MODE');\n if (mode === 'SPLIT') {\n return Msg['LISTS_SPLIT_TOOLTIP_SPLIT'];\n } else if (mode === 'JOIN') {\n return Msg['LISTS_SPLIT_TOOLTIP_JOIN'];\n }\n throw Error('Unknown mode: ' + mode);\n });\n },\n /**\n * Modify this block to have the correct input and output types.\n * @param {string} newMode Either 'SPLIT' or 'JOIN'.\n * @private\n * @this {Block}\n */\n updateType_: function(newMode) {\n const mode = this.getFieldValue('MODE');\n if (mode !== newMode) {\n const inputConnection = this.getInput('INPUT').connection;\n inputConnection.setShadowDom(null);\n const inputBlock = inputConnection.targetBlock();\n if (inputBlock) {\n inputConnection.disconnect();\n if (inputBlock.isShadow()) {\n inputBlock.dispose();\n } else {\n this.bumpNeighbours();\n }\n }\n }\n if (newMode === 'SPLIT') {\n this.outputConnection.setCheck('Array');\n this.getInput('INPUT').setCheck('String');\n } else {\n this.outputConnection.setCheck('String');\n this.getInput('INPUT').setCheck('Array');\n }\n },\n /**\n * Create XML to represent the input and output types.\n * @return {!Element} XML storage element.\n * @this {Block}\n */\n mutationToDom: function() {\n const container = xmlUtils.createElement('mutation');\n container.setAttribute('mode', this.getFieldValue('MODE'));\n return container;\n },\n /**\n * Parse XML to restore the input and output types.\n * @param {!Element} xmlElement XML storage element.\n * @this {Block}\n */\n domToMutation: function(xmlElement) {\n this.updateType_(xmlElement.getAttribute('mode'));\n },\n\n /**\n * Returns the state of this block as a JSON serializable object.\n * This block does not need to serialize any specific state as it is already\n * encoded in the dropdown values, but must have an implementation to avoid\n * the backward compatible XML mutations being serialized.\n * @return {null} The state of this block.\n */\n saveExtraState: function() {\n return null;\n },\n\n /**\n * Applies the given state to this block.\n * No extra state is needed or expected as it is already encoded in the\n * dropdown values.\n */\n loadExtraState: function() {},\n};\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Colour blocks for Blockly.\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks.colour');\n\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\nconst {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common');\n/** @suppress {extraRequire} */\ngoog.require('Blockly.FieldColour');\n\n\n/**\n * A dictionary of the block definitions provided by this module.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = createBlockDefinitionsFromJsonArray([\n // Block for colour picker.\n {\n 'type': 'colour_picker',\n 'message0': '%1',\n 'args0': [\n {\n 'type': 'field_colour',\n 'name': 'COLOUR',\n 'colour': '#ff0000',\n },\n ],\n 'output': 'Colour',\n 'helpUrl': '%{BKY_COLOUR_PICKER_HELPURL}',\n 'style': 'colour_blocks',\n 'tooltip': '%{BKY_COLOUR_PICKER_TOOLTIP}',\n 'extensions': ['parent_tooltip_when_inline'],\n },\n\n // Block for random colour.\n {\n 'type': 'colour_random',\n 'message0': '%{BKY_COLOUR_RANDOM_TITLE}',\n 'output': 'Colour',\n 'helpUrl': '%{BKY_COLOUR_RANDOM_HELPURL}',\n 'style': 'colour_blocks',\n 'tooltip': '%{BKY_COLOUR_RANDOM_TOOLTIP}',\n },\n\n // Block for composing a colour from RGB components.\n {\n 'type': 'colour_rgb',\n 'message0':\n '%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'RED',\n 'check': 'Number',\n 'align': 'RIGHT',\n },\n {\n 'type': 'input_value',\n 'name': 'GREEN',\n 'check': 'Number',\n 'align': 'RIGHT',\n },\n {\n 'type': 'input_value',\n 'name': 'BLUE',\n 'check': 'Number',\n 'align': 'RIGHT',\n },\n ],\n 'output': 'Colour',\n 'helpUrl': '%{BKY_COLOUR_RGB_HELPURL}',\n 'style': 'colour_blocks',\n 'tooltip': '%{BKY_COLOUR_RGB_TOOLTIP}',\n },\n\n // Block for blending two colours together.\n {\n 'type': 'colour_blend',\n 'message0': '%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} ' +\n '%1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3',\n 'args0': [\n {\n 'type': 'input_value',\n 'name': 'COLOUR1',\n 'check': 'Colour',\n 'align': 'RIGHT',\n },\n {\n 'type': 'input_value',\n 'name': 'COLOUR2',\n 'check': 'Colour',\n 'align': 'RIGHT',\n },\n {\n 'type': 'input_value',\n 'name': 'RATIO',\n 'check': 'Number',\n 'align': 'RIGHT',\n },\n ],\n 'output': 'Colour',\n 'helpUrl': '%{BKY_COLOUR_BLEND_HELPURL}',\n 'style': 'colour_blocks',\n 'tooltip': '%{BKY_COLOUR_BLEND_TOOLTIP}',\n },\n]);\nexports.blocks = blocks;\n\n// Register provided blocks.\ndefineBlocks(blocks);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview All the blocks. (Entry point for blocks_compressed.js.)\n * @suppress {extraRequire}\n */\n'use strict';\n\ngoog.module('Blockly.libraryBlocks');\n\nconst colour = goog.require('Blockly.libraryBlocks.colour');\nconst lists = goog.require('Blockly.libraryBlocks.lists');\nconst logic = goog.require('Blockly.libraryBlocks.logic');\nconst loops = goog.require('Blockly.libraryBlocks.loops');\nconst math = goog.require('Blockly.libraryBlocks.math');\nconst procedures = goog.require('Blockly.libraryBlocks.procedures');\nconst texts = goog.require('Blockly.libraryBlocks.texts');\nconst variables = goog.require('Blockly.libraryBlocks.variables');\nconst variablesDynamic = goog.require('Blockly.libraryBlocks.variablesDynamic');\n// const {BlockDefinition} = goog.requireType('Blockly.blocks');\n// TODO (6248): Properly import the BlockDefinition type.\n/* eslint-disable-next-line no-unused-vars */\nconst BlockDefinition = Object;\n\n\nexports.colour = colour;\nexports.lists = lists;\nexports.logic = logic;\nexports.loops = loops;\nexports.math = math;\nexports.procedures = procedures;\nexports.texts = texts;\nexports.variables = variables;\nexports.variablesDynamic = variablesDynamic;\n\n/**\n * A dictionary of the block definitions provided by all the\n * Blockly.libraryBlocks.* modules.\n * @type {!Object<string, !BlockDefinition>}\n */\nconst blocks = Object.assign(\n {}, colour.blocks, lists.blocks, logic.blocks, loops.blocks, math.blocks,\n procedures.blocks, variables.blocks, variablesDynamic.blocks);\nexports.blocks = blocks;\n"]} |