mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-21 23:29:48 +00:00
1 line
3.0 MiB
1 line
3.0 MiB
{"version":3,"sources":["core/touch.ts","core/browser_events.ts","core/common.ts","core/utils/dom.ts","core/utils/math.ts","core/utils/deprecation.ts","core/utils/style.ts","core/dropdowndiv.ts","core/registry.ts","core/utils/idgenerator.ts","core/events/utils.ts","core/utils/xml.ts","core/dialog.ts","core/variables.ts","core/css.ts","core/utils/svg_math.ts","core/xml.ts","core/utils/string.ts","core/tooltip.ts","core/utils/colour.ts","core/utils/parsing.ts","core/widgetdiv.ts","core/field_registry.ts","core/utils/aria.ts","core/field_dropdown.ts","core/utils/object.ts","core/utils/toolbox.ts","core/extensions.ts","core/utils/array.ts","core/utils/svg_paths.ts","core/utils.ts","core/serialization/registry.ts","core/serialization/blocks.ts","core/connection.ts","core/keyboard_nav/ast_node.ts","core/block_animations.ts","core/clipboard.ts","core/contextmenu.ts","core/positionable_helpers.ts","core/shortcut_items.ts","core/procedures.ts","core/renderers/common/constants.ts","core/renderers/common/debug.ts","core/renderers/common/block_rendering.ts","core/variables_dynamic.ts","core/workspace_svg.ts","core/serialization/workspaces.ts","core/bump_objects.ts","core/inject.ts","core/contextmenu_items.ts","core/block_dragger.ts","core/blockly.ts","src/com/google/javascript/jscomp/js/base.js","src/com/google/javascript/jscomp/js/util/defines.js","src/com/google/javascript/jscomp/js/util/defineproperty.js","src/com/google/javascript/jscomp/js/util/global.js","src/com/google/javascript/jscomp/js/util/shouldpolyfill.js","src/com/google/javascript/jscomp/js/util/polyfill.js","src/com/google/javascript/jscomp/js/es6/globalthis.js","src/com/google/javascript/jscomp/js/es6/util/arrayiterator.js","src/com/google/javascript/jscomp/js/es6/symbol.js","src/com/google/javascript/jscomp/js/es6/util/iteratorfromarray.js","src/com/google/javascript/jscomp/js/es6/array/values.js","src/com/google/javascript/jscomp/js/util/owns.js","src/com/google/javascript/jscomp/js/es6/object/values.js","src/com/google/javascript/jscomp/js/es6/array/flat.js","src/com/google/javascript/jscomp/js/es6/object/entries.js","closure/goog/goog.js","closure/goog/base_minimal.js","core/utils/useragent.ts","core/blocks.ts","core/utils/rect.ts","core/utils/coordinate.ts","core/utils/size.ts","core/input_types.ts","core/msg.ts","core/events/events_abstract.ts","core/events/events_var_base.ts","core/events/events_var_create.ts","core/variable_model.ts","core/workspace_comment.ts","core/events/events_ui_base.ts","core/events/events_selected.ts","core/utils/svg.ts","core/workspace_comment_svg.ts","core/events/events_block_base.ts","core/events/events_block_change.ts","core/marker_manager.ts","core/utils/sentinel.ts","core/field.ts","core/utils/keycodes.ts","core/menu.ts","core/menuitem.ts","core/events/events_bubble_open.ts","core/scrollbar.ts","core/bubble.ts","core/config.ts","core/icon.ts","core/theme.ts","core/theme/classic.ts","core/options.ts","core/mutator.ts","core/events/events_trashcan_open.ts","core/component_manager.ts","core/serialization/exceptions.ts","core/serialization/priorities.ts","core/events/events_block_create.ts","core/events/events_block_delete.ts","core/connection_type.ts","core/constants.ts","core/field_label.ts","core/input.ts","core/block.ts","core/comment.ts","core/contextmenu_registry.ts","core/internal_constants.ts","core/keyboard_nav/marker.ts","core/keyboard_nav/cursor.ts","core/keyboard_nav/basic_cursor.ts","core/keyboard_nav/tab_navigate_cursor.ts","core/rendered_connection.ts","core/warning.ts","core/block_svg.ts","core/drag_target.ts","core/delete_area.ts","core/sprites.ts","core/trashcan.ts","core/events/events_toolbox_item_select.ts","core/toolbox/toolbox_item.ts","core/toolbox/category.ts","core/toolbox/separator.ts","core/toolbox/collapsible_category.ts","core/toolbox/toolbox.ts","core/theme/zelos.ts","core/theme/themes.ts","core/events/events_click.ts","core/bubble_dragger.ts","core/workspace_dragger.ts","core/gesture.ts","core/shortcut_registry.ts","core/events/events_theme_change.ts","core/events/events_viewport.ts","core/connection_db.ts","core/grid.ts","core/names.ts","core/renderers/measurables/types.ts","core/renderers/measurables/base.ts","core/renderers/measurables/row.ts","core/renderers/measurables/bottom_row.ts","core/renderers/measurables/connection.ts","core/renderers/measurables/input_connection.ts","core/renderers/measurables/external_value_input.ts","core/renderers/measurables/field.ts","core/renderers/measurables/hat.ts","core/renderers/measurables/icon.ts","core/renderers/measurables/in_row_spacer.ts","core/renderers/measurables/inline_input.ts","core/renderers/measurables/statement_input.ts","core/renderers/measurables/input_row.ts","core/renderers/measurables/jagged_edge.ts","core/renderers/measurables/next_connection.ts","core/renderers/measurables/output_connection.ts","core/renderers/measurables/previous_connection.ts","core/renderers/measurables/round_corner.ts","core/renderers/measurables/spacer_row.ts","core/renderers/measurables/square_corner.ts","core/renderers/measurables/top_row.ts","core/renderers/common/debugger.ts","core/renderers/common/drawer.ts","core/renderers/common/info.ts","core/events/events_marker_move.ts","core/renderers/common/marker_svg.ts","core/renderers/common/path_object.ts","core/insertion_marker_manager.ts","core/renderers/common/renderer.ts","core/theme_manager.ts","core/touch_gesture.ts","core/connection_checker.ts","core/events/events_var_delete.ts","core/events/events_var_rename.ts","core/variable_map.ts","core/workspace.ts","core/workspace_audio.ts","core/zoom_controls.ts","core/serialization/variables.ts","core/renderers/zelos/constants.ts","core/renderers/zelos/drawer.ts","core/field_image.ts","core/field_textinput.ts","core/renderers/zelos/measurables/bottom_row.ts","core/renderers/zelos/measurables/inputs.ts","core/renderers/zelos/measurables/row_elements.ts","core/renderers/zelos/measurables/top_row.ts","core/renderers/zelos/info.ts","core/renderers/zelos/marker_svg.ts","core/renderers/zelos/path_object.ts","core/renderers/zelos/renderer.ts","core/renderers/zelos/zelos.ts","core/renderers/thrasos/info.ts","core/renderers/thrasos/renderer.ts","core/renderers/thrasos/thrasos.ts","core/renderers/minimalist/constants.ts","core/renderers/minimalist/drawer.ts","core/renderers/minimalist/info.ts","core/renderers/minimalist/renderer.ts","core/renderers/minimalist/minimalist.ts","core/renderers/geras/constants.ts","core/renderers/geras/highlighter.ts","core/renderers/geras/drawer.ts","core/renderers/geras/highlight_constants.ts","core/renderers/geras/measurables/inline_input.ts","core/renderers/geras/measurables/statement_input.ts","core/renderers/geras/info.ts","core/renderers/geras/path_object.ts","core/renderers/geras/renderer.ts","core/renderers/geras/geras.ts","core/workspace_drag_surface_svg.ts","core/block_drag_surface.ts","core/scrollbar_pair.ts","core/generator.ts","core/flyout_button.ts","core/metrics_manager.ts","core/flyout_metrics_manager.ts","core/flyout_base.ts","core/flyout_vertical.ts","core/flyout_horizontal.ts","core/field_variable.ts","core/field_number.ts","core/field_multilineinput.ts","core/field_label_serializable.ts","core/field_colour.ts","core/field_checkbox.ts","core/field_angle.ts","core/events/events_block_move.ts","core/events/events_comment_base.ts","core/events/events_comment_change.ts","core/events/events_comment_create.ts","core/events/events_comment_delete.ts","core/events/events_comment_move.ts","core/events/events_block_drag.ts","core/events/events_ui.ts","core/events/workspace_events.ts","core/events/events.ts","core/main.js"],"names":["longStart","e","gesture","longStop","changedTouches","length","longPid_","setTimeout","button","clientX","clientY","handleRightClick","LONGPRESS","clearTimeout","clearTouchIdentifier","touchIdentifier_","shouldHandleEvent","isMouseOrTouchEvent","checkTouchIdentifier","getTouchIdentifierFromEvent","PointerEvent","String","pointerId","MouseEvent","undefined","identifier","type","setClientFromTouch","startsWith","touchPoint","isTouchEvent","splitEventByTouches","events","i","newEvent","target","stopPropagation","preventDefault","push","conditionalBind","node","name","thisObject","func","opt_noCaptureIdentifier","opt_noPreventDefault","wrapFunc","captureIdentifier","event","call","handled","bindData","globalThis","TOUCH_MAP","addEventListener","touchWrapFunc","preventDef","bind","TouchEvent","unbind","callback","bindDatum","pop","removeEventListener","isTargetInput","HTMLElement","isContentEditable","getAttribute","HTMLInputElement","HTMLTextAreaElement","isRightButton","ctrlKey","MAC","mouseToSvg","svg","matrix","svgPoint","createSVGPoint","x","y","getScreenCTM","inverse","matrixTransform","getScrollDeltaPixels","deltaMode","deltaX","deltaY","LINE_MODE_MULTIPLIER","PAGE_MODE_MULTIPLIER","getWorkspaceById","id","WorkspaceDB_","getAllWorkspaces","workspaces","workspaceId","registerWorkspace","workspace","unregisterWorkpace","getMainWorkspace","mainWorkspace","setMainWorkspace","getSelected","selected","setSelected","newSelection","getParentContainer","parentContainer","setParentContainer","newParent","svgResize","options","parentWorkspace","getParentSvg","cachedSize","getCachedParentSvgSize","div","parentElement","width","offsetWidth","height","offsetHeight","setAttribute","setCachedParentSvgSize","resize","getBlockTypeCounts","block","opt_stripFollowing","typeCountsMap","Object","create","descendants","getDescendants","nextBlock","getNextBlock","index","indexOf","splice","checkBlock","jsonInitFactory","jsonDef","jsonInit","defineBlocksWithJsonArray","jsonArray","TEST_ONLY","defineBlocksWithJsonArrayInternal","defineBlocks","createBlockDefinitionsFromJsonArray","blocks","elem","console","warn","init","keys","definition","Blocks","createSvgElement","attrs","opt_parent","document","createElementNS","SVG_NS","key","appendChild","addClass","element","className","classNames","split","every","classList","contains","add","removeClasses","remove","removeClass","hasClass","removeNode","parentNode","removeChild","insertAfter","newNode","refNode","siblingNode","nextSibling","Error","insertBefore","containsNode","parent","descendant","compareDocumentPosition","NodeType","DOCUMENT_POSITION_CONTAINED_BY","setCssTransform","transform","style","startTextWidthCache","cacheReference","cacheWidths","stopTextWidthCache","getTextWidth","textElement","textContent","baseVal","getComputedTextLength","getFastTextWidth","fontSize","fontWeight","fontFamily","getFastTextWidthWithSizeString","text","canvasContext","computeCanvas","createElement","body","getContext","font","measureText","measureFontMetrics","span","result","baseline","alignItems","offsetTop","toRadians","angleDegrees","Math","PI","toDegrees","angleRadians","clamp","lowerBound","number","upperBound","temp","max","min","deprecationDate","deletionDate","opt_use","msg","getSize","getSizeInternal","getComputedStyle","getSizeWithDisplay","originalDisplay","display","originalVisibility","visibility","originalPosition","position","Size","property","styles","window","getPropertyValue","getCascadedStyle","currentStyle","getPageOffset","el","pos","Coordinate","box","getBoundingClientRect","documentElement","scrollCoord","pageXOffset","scrollLeft","pageYOffset","scrollTop","left","top","getViewportPageOffset","getBorderBox","parseFloat","right","bottom","Rect","scrollIntoContainerView","container","opt_center","offset","getContainerOffsetToScrollInto","elementPos","containerPos","containerBorder","relX","relY","elementSize","spaceX","clientWidth","spaceY","clientHeight","createDom","content","arrow","opacity","transition","ANIMATION_TIME","setBoundsElement","boundsElem","boundsElement","getContentDiv","clearContent","setColour","backgroundColour","borderColour","backgroundColor","borderColor","showPositionedByBlock","field","opt_onHide","opt_secondaryYOffset","showPositionedByRect","getScaledBboxOfBlock","showPositionedByField","positionToField","getScaledBboxOfField","blockSvg","getSvgRoot","scale","scaledHeight","scaledWidth","xy","bBox","getScaledBBox","primaryX","primaryY","secondaryY","sourceBlock","getSourceBlock","show","RTL","newOwner","rtl","secondaryX","owner","onHide","direction","renderedClassName","getRenderer","getClassName","themeClassName","getTheme","positionInternal","getPositionBelowMetrics","boundsInfo","divSize","xCoords","getPositionX","initialX","divX","initialY","finalX","finalY","PADDING_Y","arrowX","arrowY","ARROW_SIZE","BORDER_SIZE","arrowAtTop","arrowVisible","getPositionAboveMetrics","getPositionTopOfPageMetrics","sourceX","boundsLeft","boundsRight","divWidth","relativeArrowX","horizPadding","ARROW_HORIZONTAL_PADDING","isVisible","hideIfOwner","divOwner","opt_withoutAnimation","hideWithoutAnimation","hide","animateOutTimer","markFocused","metrics","internal","getPositionMetrics","floor","repositionForWindowResize","register","registryItem","opt_allowOverrides","Type","trim","toLowerCase","caselessName","typeRegistry","typeMap","nameRegistry","nameMap","validate","FIELD","fromJson","unregister","getItem","opt_throwIfMissing","hasItem","getClass","getObject","getAllItems","opt_cased","casedRegistry","getClassFromOptions","plugin","plugins","toString","typeName","DEFAULT","getNextUniqueId","nextId","genUid","setRecordUndo","newValue","recordUndo","getRecordUndo","fire","fireInternal","isEnabled","FIRE_QUEUE","fireNow","queue","filter","eventWorkspace","fireChangeListener","queueIn","forward","slice","reverse","mergedQueue","hash","isNull","isUiEvent","eventType","UI","blockId","join","lastEntry","lastEvent","MOVE","moveEvent","newParentId","newInputName","newCoordinate","CHANGE","VIEWPORT_CHANGE","viewportEvent","viewTop","viewLeft","oldScale","CLICK","BUBBLE_OPEN","unshift","clearPendingUndo","disable","disabled","enable","getGroup","group","setGroup","state","setGroupInternal","getDescendantIds","ids","json","eventClass","get","EVENT","disableOrphans","CREATE","getBlockById","initialUndoFlag","getParent","children","child","setEnabled","outputConnection","previousConnection","isDragging","getDocument","xmlDocument","setDocument","tagName","NAME_SPACE","createTextNode","textToDomDocument","parseFromString","oParser","DOMParser","domToText","dom","serializeToString","oSerializer","XMLSerializer","alert","message","opt_callback","alertImplementation","setAlert","alertFunction","confirm","confirmInternal","confirmImplementation","setConfirm","confirmFunction","prompt","defaultValue","promptImplementation","setPrompt","promptFunction","allUsedVarModels","ws","getAllBlocks","variables","Set","blockVariables","getVarModels","j","variable","getId","Array","from","values","allDeveloperVariables","getDeveloperVariables","devVars","flyoutCategory","xmlList","registerButtonCallback","createVariableButtonHandler","getTargetWorkspace","blockList","flyoutCategoryBlocks","concat","variableModelList","getVariablesOfType","mostRecentVariable","generateVariableFieldDom","value","textToDom","sort","VariableModel","compareByName","generateUniqueName","generateUniqueNameInternal","generateUniqueNameFromOptions","VAR_LETTER_OPTIONS","charAt","getAllVariableNames","startChar","usedNames","letters","suffix","letterIndex","inUse","potName","Number","opt_type","promptAndCheckWithAlert","defaultName","promptName","Msg","existing","nameUsedWithAnyType","replace","createVariable","renameVariable","promptText","newName","nameUsedWithOtherType","renameVariableById","defaultText","newVar","allVariables","getVariableMap","getAllVariables","variableModel","getOrCreateVariablePackage","opt_name","getVariable","potentialVariableMap","getPotentialVariableMap","getVariableById","isFlyout","targetWorkspace","getAddedVariables","originalVariables","allCurrentVariables","addedVariables","cssContent","injected","inject","hasCss","pathToMedia","mediaPath","cssNode","cssTextNode","head","firstChild","getRelativeXY","parseInt","r","match","XY_REGEX","styleComponents","XY_STYLE_REGEX","getInjectionDivXY","is3dSupported","getViewportBBox","scrollOffset","getDocumentScroll","win","screenToWsCoordinates","screenCoordinates","screenX","screenY","boundingRect","getInjectionDiv","injectionDiv","clientOffsetPixels","mainOffsetPixels","getOriginOffsetInPixels","difference","finalOffsetPixels","finalOffsetMainWs","workspaceToDom","opt_noId","treeXml","variablesElement","variablesToDom","hasChildNodes","comments","getTopComments","comment","toXmlWithXY","getTopBlocks","blockToDomWithXY","variableList","isInsertionMarker","getChildren","DocumentFragment","getWidth","blockToDom","getRelativeToSurfaceXY","round","fieldToDom","isSerializable","toXml","allFieldsToDom","inputList","input","fieldRow","fieldDom","isShadow","mutationToDom","mutation","hasAttributes","commentText","getCommentText","size","commentModel","pinned","commentElement","data","dataElement","empty","inputTypes","DUMMY","childBlock","connection","targetBlock","VALUE","STATEMENT","childShadow","getShadowDom","cloneShadow","childElem","nodeType","ELEMENT_NODE","inputsInline","inputsInlineDefault","isCollapsed","isDeletable","isMovable","isEditable","nextElem","nextShadow","nextConnection","shadow","cloneNode","textNode","nodeName","removeAttribute","TEXT_NODE","domToPrettyText","lines","blob","indent","line","substring","doc","getElementsByTagName","clearWorkspaceAndLoadFromXml","xml","setResizesEnabled","clear","blockIds","domToWorkspace","newBlockIds","existingGroup","variablesFirst","xmlChild","childNodes","xmlChildElement","domToBlock","blockX","hasAttribute","blockY","isNaN","moveBy","TypeError","rendered","WorkspaceCommentSvg","fromXmlRendered","WorkspaceComment","fromXml","domToVariables","FINISHED_LOADING","appendDomToWorkspace","getBlocksBoundingBox","bbox","farY","topX","newLeftX","Infinity","newRightX","newY","blockXY","offsetY","ySeparation","offsetX","xmlBlock","variablesBeforeCreation","topBlock","domToBlockHeadless","topBlockSvg","setConnectionTracking","initSvg","render","disposed","updateDisabled","resizeContents","initModel","newVariables","thisVariable","VAR_CREATE","xmlVariables","mapSupportedXmlTags","childNodeMap","next","applyMutationTagNodes","xmlChildren","shouldCallInitSvg","domToMutation","applyCommentTagNodes","setCommentText","getCommentIcon","isInFlyout","setVisible","applyDataTagNodes","applyFieldTagNodes","domToField","findChildBlocks","xmlNode","childBlockInfo","childBlockElement","childShadowElement","applyInputTagNodes","prototypeName","getInput","setShadowDom","applyNextTagNodes","isConnected","parentConnection","connectedToParentNext","outerHTML","newBlock","xmlChildNameMap","connect","inline","setInputsInline","deletable","setDeletable","movable","setMovable","editable","setEditable","collapsed","setCollapsed","setShadow","fieldName","getField","deleteNext","str","prefix","shortestStringLength","array","reduce","a","b","commonWordPrefix","opt_shortest","wordPrefix","len","letter","commonWordSuffix","substr","wrap","limit","wrapLine","words","score","lastText","lineCount","lastScore","wordBreaks","steps","insertedBreaks","wrapMutate","wrapScore","wrapToText","lineLengths","linePunctuation","maxLength","pow","abs","bestScore","bestBreaks","mutatedWordBreaks","mutatedScore","isNumber","test","setCustomTooltip","customFn","customTooltip","getCustomTooltip","visible","getDiv","containerDiv","getTooltipOfObject","object","obj","getTargetObject","tooltip","bindMouseEvents","mouseOverWrapper_","onMouseOver","mouseOutWrapper_","onMouseOut","onMouseMove","unbindMouseEvents","blocked","newElement","currentTarget","poisonedElement","mouseOutPid","_e","showPid","dx","lastX","pageX","dy","lastY","pageY","sqrt","RADIUS_OK","HOVER_MS","dispose","unblock","renderContent","renderDefaultContent","tip","LIMIT","getPosition","windowWidth","windowHeight","anchorX","OFFSET_X","anchorY","OFFSET_Y","scrollY","MARGINS","scrollX","getHsvSaturation","hsvSaturation","setHsvSaturation","newSaturation","getHsvValue","hsvValue","setHsvValue","parse","hex","names","rgb","g","rgbToHex","hexToRgb","colour","hsvToHex","h","s","v","red","green","blue","sextant","remainder","val1","val2","val3","blend","colour1","colour2","factor","hex1","hex2","rgb1","rgb2","hueToHex","hue","tokenizeInterpolationInternal","parseInterpolationTokens","tokens","chars","buffer","c","rawKey","keyUpper","toUpperCase","bklyKey","rawValue","prototype","apply","mergedTokens","tokenizeInterpolation","replaceMessageReferences","interpolatedResult","checkMessageReferences","validSoFar","msgTable","m","msgKey","parseBlockColour","dereferenced","errorMsg","testOnly_setDiv","newDiv","newDispose","rendererClassName","oldOwner","positionWithAnchor","viewportBBox","anchorBBox","widgetSize","calculateY","calculateX","fieldClass","fromJsonInternal","fieldObject","setRole","roleName","ROLE_ATTRIBUTE","setState","stateName","isArray","ARIA_PREFIX","validateOptions","foundError","tuple","error","src","inherits","childCtor","parentCtor","superClass_","setPrototypeOf","constructor","mixin","source","deepMerge","convertToolboxDefToJson","toolboxDef","Element","parseToolboxTree","convertToToolboxJson","validateToolbox","toolboxJson","toolboxKind","toolboxContents","FLYOUT_TOOLBOX_KIND","CATEGORY_TOOLBOX_KIND","convertFlyoutDefToJsonArray","flyoutDef","xmlToJsonArray","hasCategories","hasCategoriesInternal","categories","item","isCategoryCollapsible","categoryInfo","contents","Node","addAttributes","arr","attributes","attr","parsedToolboxDef","initFn","allExtensions","registerMixin","mixinObj","registerMutator","opt_helperFn","opt_blockList","errorPrefix","checkHasMutatorProperties","hasMutatorDialog","checkMutatorDialog","setMutator","Mutator","isRegistered","isMutator","extensionFn","mutatorProperties","checkNoMutatorProperties","getMutatorProperties","mutatorPropertiesMatch","mutationName","properties","checkXmlHooks","checkHasFunctionPair","checkJsonHooks","saveExtraState","loadExtraState","compose","decompose","func1","func2","hasXmlHooks","hasJsonHooks","oldProperties","newProperties","runAfterPageLoad","fn","readyState","readyStateCheckInterval","setInterval","clearInterval","buildTooltipForDropdown","dropdownName","lookupTable","blockTypesChecked","checkDropdownOptionsInTable","setTooltip","getFieldValue","warning","dropdown","FieldDropdown","isOptionListDynamic","getOptions","optionKey","buildTooltipWithFieldText","msgTemplate","getText","extensionParentTooltip","tooltipWhenNotConnected","getInputsInline","removeElem","point","curve","command","points","moveTo","lineTo","lineOnAxis","val","arc","flags","radius","arrayRemove","serializer","SERIALIZER","save","addCoordinates","addInputBlocks","addNextBlocks","doFullSerialization","saveCoords","saveAttributes","saveIcons","saveFields","saveInputBlocks","saveNextBlocks","extraState","fields","saveState","inputs","connectionState","saveConnection","getShadowState","append","appendInternal","prevRecordUndo","appendPrivate","BLOCK_CREATE","MissingBlockType","loadCoords","loadAttributes","tryToConnectParent","loadIcons","loadFields","loadInputBlocks","loadNextBlocks","initBlock","RealChildOfShadow","childConnection","MissingConnection","connected","checker","connectionChecker","BadConnectionCheck","getErrorMessage","canConnectWithReason","fieldState","loadState","inputName","loadConnection","setShadowState","icons","getIcons","computeIconLocation","connectReciprocally","first","second","targetConnection","getSingleConnection","orphanBlock","foundConnection","output","typeChecker","getConnectionChecker","canConnect","getConnectionForOrphanedOutput","startBlock","getParentConnection","topConnection","disposeUiEffect","svgGroup","getAudioManager","play","getSvgXY","clone","disposeUiStep","cloneRect","Date","rect","start","workspaceScale","percent","getTime","connectionUiEffect","ripple","Svg","CIRCLE","connectionUiStep","disconnectPid","disconnectUiEffect","disconnectUiStop","getHeightWidth","magnitude","atan","DISPLACEMENT","disconnectGroup","disconnectUiStep","DURATION","skew","sin","WIGGLES","skew_","translate_","copy","toCopy","copyInternal","copyData","toCopyData","paste","typeCounts","isCapacityAvailable","saveInfo","duplicate","toDuplicate","duplicateInternal","oldCopyData","pastedThing","getCurrentBlock","currentBlock","setCurrentBlock","dummyOwner","menu","populate_","menu_","position_","focus","Menu","Role","MENU","option","menuItem","MenuItem","setRightToLeft","MENUITEM","addChild","enabled","onAction","actionHandler","scope","createWidget_","menuSize","menuDom","haltPropagation","callbackFactory","config","snapRadius","select","commentDeleteOption","deleteOption","commentDuplicateOption","duplicateOption","workspaceCommentOption","wsCommentOption","wsCommentOption.callback","DEFAULT_SIZE","finalOffset","getStartPositionRect","horizontalPadding","verticalPadding","hasVerticalScrollbar","scrollbar","canScrollVertically","horizontal","horizontalPosition","LEFT","absoluteMetrics","Scrollbar","scrollbarThickness","viewMetrics","vertical","verticalPosition","TOP","canScrollHorizontally","getCornerOppositeToolbox","toolboxMetrics","hPosition","Position","horizontalLayout","RIGHT","vPosition","BOTTOM","bumpPositionRect","startRect","margin","bumpDir","savedPositions","otherEl","intersects","bumpDirection","UP","registerEscape","ShortcutRegistry","registry","escapeAction","ESCAPE","preconditionFn","readOnly","hideChaff","keyCodes","KeyCodes","ESC","registerDelete","deleteShortcut","DELETE","Gesture","inProgress","checkAndDelete","BACKSPACE","registerCopy","ctrlC","createSerializedKey","C","CTRL","altC","ALT","metaC","META","copyShortcut","COPY","registerCut","ctrlX","X","altX","metaX","cutShortcut","CUT","BlockSvg","registerPaste","ctrlV","V","altV","metaV","pasteShortcut","PASTE","registerUndo","ctrlZ","Z","altZ","metaZ","undoShortcut","UNDO","undo","registerRedo","ctrlShiftZ","SHIFT","altShiftZ","metaShiftZ","ctrlY","Y","redoShortcut","REDO","registerDefaultShortcuts","allProcedures","root","proceduresNoReturn","getBlocksByType","map","getProcedureDef","proceduresReturn","procTupleComparator","ta","tb","localeCompare","sensitivity","findLegalName","isLegalName","opt_exclude","isNameUsed","procedureBlock","procName","Names","equals","rename","UnattachedFieldError","legalName","oldName","getValue","renameProcedure","populateProcedures","procedureList","templateName","args","arg","nameField","updateMutatorFlyout","xmlElement","argBlock","argValue","DEFAULT_ARG","fieldContent","updateToolbox","mutatorOpenListener","bubbleType","isOpen","mutator","getWorkspace","addChangeListener","mutatorChangeListener","BLOCK_DELETE","BLOCK_CHANGE","getCallers","callers","getProcedureCall","mutateCallers","defBlock","oldRecordUndo","caller","oldMutation","oldMutationDom","newMutationDom","newMutation","getDefinition","isDynamicShape","shape","isDynamic","isDebuggerEnabled","useDebugger","startDebugger","stopDebugger","rendererClass","RENDERER","theme","opt_rendererOverrides","renderer","stringButtonClickHandler","numberButtonClickHandler","colourButtonClickHandler","firstVariable","resizeSvgContents","serializerMap","load","deserializers","entries","priority","WorkspaceSvg","deserializer","pluginState","bumpObjectIntoBounds","scrollMetrics","objectMetrics","getBoundingRectangle","newYPosition","leftClamp","rightClamp","newXPosition","bumpIntoBoundsHandler","metricsManager","getMetricsManager","hasFixedEdges","BUMP_EVENTS","scrollMetricsInWsCoords","getScrollMetrics","extractObjectFromEvent","oldGroup","wasBumped","bumpTopObjectsIntoBounds","BLOCK_MOVE","getRootBlock","COMMENT_CREATE","COMMENT_MOVE","getCommentById","commentId","topBlocks","getTopBoundedElements","opt_options","getElementById","querySelector","Options","subContainer","tabIndex","State","LABEL","blockDragSurface","BlockDragSurfaceSvg","workspaceDragSurface","WorkspaceDragSurfaceSvg","createMainWorkspace","SVG","HTML_NS","XLINK_NS","defs","DEFS","rnd","random","gridPattern","Grid","gridOptions","wsOptions","zoomOptions","startScale","languageTree","flyout","addFlyout","hasTrashcan","addTrashcan","controls","addZoomControls","getThemeManager","subscribe","translate","workspaceResizeHandler","setResizeHandlerWrapper","bindDocumentEvents","toolbox","getToolbox","getFlyout","scrollToStart","trashcan","zoomControls_","moveOptions","scrollbars","ScrollbarPair","setMetrics","hasSounds","loadSounds","onKeyDown","documentEventsBound","updateInverseScreenCTM","IPAD","unbindSounds","soundBinds","audioMgr","preload","ContextMenuRegistry","undoOption","displayText","getUndoStack","scopeType","ScopeType","WORKSPACE","weight","redoOption","getRedoStack","registerCleanup","cleanOption","cleanUp","toggleOption_","shouldCollapse","timeoutFn","timeoutCounter","ms","DELAY","registerCollapse","collapseOption","collapse","registerExpand","expandOption","addDeletableBlocks_","deleteList","getDeletableBlocks_","deleteNext_","eventGroup","shift","isDeadOrDying","registerDeleteAll","deletableBlocksLength","cancelCurrentGesture","deletableBlocks","ok","registerWorkspaceOptions_","registerDuplicate","isDuplicatable","BLOCK","registerComment","commentOption","registerInline","inlineOption","registerCollapseExpandBlock","collapseExpandOption","registerDisable","disableOption","getInheritedDisabled","descendantCount","registerHelp","helpOption","url","helpUrl","showHelp","registerBlockOptions_","registerDefaultOptions","initIconData","dragIconData","location","getIconLocation","icon","opt_onlyClosePopups","resizeSvgContentsLocal","realResizeSvgContents","bindEvent_","unbindEvent_","bindEventWithChecks_","global","declareModuleId","namespace","goog","$jscomp$tmp$exports$module$name","COMPILED","define","goog.define","DEBUG","DISALLOW_TEST_ONLY_CODE","provide","goog.provide","module","goog.module","goog.module.get","declareLegacyNamespace","goog.module.declareLegacyNamespace","setTestOnly","goog.setTestOnly","opt_message","require","goog.require","requireType","goog.requireType","TOUCH_ENABLED","rawUserAgent","isJavaFx","isWebKit","isGecko","isAndroid","isIPad","isIPhone","isMac","isTablet","isMobile","raw","has","rawUpper","maxTouchPoints","JavaFx","GECKO","ANDROID","IPHONE","MOBILE","draggingConnections","other","tx","ty","distance","sum","getBoundsInfo","boundPosition","boundSize","clientTop","CONNECTION_CHECKER","CURSOR","TOOLBOX","THEME","TOOLBOX_ITEM","FLYOUTS_VERTICAL_TOOLBOX","FLYOUTS_HORIZONTAL_TOOLBOX","METRICS_MANAGER","BLOCK_DRAGGER","soup","soupLength","VAR_DELETE","VAR_RENAME","BLOCK_DRAG","SELECTED","MARKER_MOVE","TRASHCAN_OPEN","TOOLBOX_ITEM_SELECT","THEME_CHANGE","COMMENT_DELETE","COMMENT_CHANGE","setLocale","locale","forEach","k","Abstract","toJson","isBlank","run","_forward","getEventWorkspace_","VarBase","AbstractEvent","opt_variable","varId","VarCreate","varType","varName","deleteVariableById","opt_id","id_","var1","var2","CATEGORY_NAME","editable_","movable_","deletable_","disposed_","isComment","addTopComment","xy_","height_","width_","content_","fireCreateEvent","removeTopComment","getHeight","setHeight","setWidth","getXY","recordNew","getContent","setContent","xmlComment","info","parseAttributes","w","xmlX","xmlY","commentX","NaN","commentY","xmlH","xmlW","xmlId","UiBase","opt_workspaceId","Selected","opt_oldElementId","opt_newElementId","oldElementId","newElementId","ANIMATE","CLIPPATH","FECOMPOSITE","FECOMPONENTTRANSFER","FEFLOOD","FEFUNCA","FEGAUSSIANBLUR","FEPOINTLIGHT","FESPECULARLIGHTING","FILTER","FOREIGNOBJECT","G","IMAGE","LINE","PATH","PATTERN","POLYGON","RECT","TEXT","TSPAN","RESIZE_SIZE","BORDER_RADIUS","TEXTAREA_OFFSET","onMouseMoveWrapper_","onMouseUpWrapper_","eventsInit_","deleteIconBorder_","deleteGroup_","resizeGroup_","foreignObject_","svgHandleTarget_","svgRectTarget_","textarea_","rendered_","autoLayout_","focused_","svgGroup_","svgRect_","useDragSurface_","getBlockDragSurface","unselect","disposeInternal_","opt_noSelect","pathMouseDown_","updateMovable","getBubbleCanvas","getGesture","handleBubbleStart","showContextMenu","oldId","addSelect","removeSelect","blurFocus","setFocus","addFocus","removeFocus","dragSurfaceGroup","surfaceTranslation","getSurfaceTranslation","moveToDragSurface","clearTransformAttributes_","translateSurface","setBlocksAndShow","moveDuringDrag","dragSurface","newLoc","commentBounds","setDragging","adding","setDeleteStyle","setAutoLayout","_enable","createEditor_","addResizeDom_","addDeleteDom_","setSize_","resizeMouseDown_","deleteMouseDown_","deleteMouseOut_","deleteMouseUp_","TOP_OFFSET","textarea","unbindDragEvents_","startDrag","resizeMouseUp_","resizeMouseMove_","newXY","moveDrag","resizeComment_","topOffset","textOffset","blur","opt_wsWidth","wsWidth","BlockBase","opt_block","BlockChange","opt_element","opt_oldValue","opt_newValue","oldValue","setValue","oldState","getExtraBlockState_","JSON","stringify","MarkerManager","cursorSvg_","cursor_","markers","Map","markerSvg_","registerMarker","marker","unregisterMarker","setDrawer","makeMarkerDrawer","setMarkerSvg","getDrawer","set","delete","getCursor","getMarker","setCursor","cursor","drawer","setCursorSvg","cursorSvg","getBlockCanvas","markerSvg","updateMarkers","keyboardAccessibilityMode","draw","markerIds","markerId","LOCAL_MARKER","Sentinel","Field","opt_validator","opt_config","constants_","mouseDownWrapper_","textContent_","textElement_","borderRect_","fieldGroup_","tooltip_","validator_","maxDisplayLength","sourceBlock_","enabled_","visible_","isDirty_","suffixField","prefixField","clickTarget_","EDITABLE","SERIALIZABLE","value_","DEFAULT_VALUE","size_","SKIP_SETUP","configure_","setValidator","setSourceBlock","getConstants","initView","updateEditable","bindEvents_","createBorderRect_","createTextElement_","FIELD_BORDER_RECT_RADIUS","FIELD_TEXT_BASELINE_CENTER","clickTarget","getClickTarget_","onMouseDown_","fieldElement","_doFullSerialization","legacyState","saveLegacyState","loadLegacyState","callingClass","isClickable","showEditor_","isCurrentlyEditable","handler","getValidator","getBorderRect","getTextElement","getTextContent","applyColour","render_","nodeValue","getDisplayText_","updateSize_","showEditor","opt_e","opt_margin","constants","xOffset","FIELD_BORDER_RECT_X_PADDING","totalWidth","totalHeight","FIELD_TEXT_HEIGHT","contentWidth","FIELD_TEXT_FONTSIZE","FIELD_TEXT_FONTWEIGHT","FIELD_TEXT_FONTFAMILY","FIELD_BORDER_RECT_HEIGHT","positionTextElement_","positionBorderRect_","halfHeight","FIELD_TEXT_BASELINE","getAbsoluteXY_","NBSP","getText_","markDirty","forceRerender","bumpNeighbours","updateMarkers_","validatedValue","doClassValidation_","processValidation_","localValidator","doValueUpdate_","doValueInvalid_","_invalidValue","setStartField","newTip","getTooltip","referencesVariables","refreshVariableName","getParentInput","parentInput","idx","fieldRows","getFlipRtl","isTabNavigable","onShortcut","_shortcut","menuItems_","roleName_","element_","onKeyDownHandler_","mouseLeaveHandler_","mouseEnterHandler_","clickHandler_","mouseOverHandler_","highlightedItem_","openingCoords","handleMouseOver_","handleClick_","handleMouseEnter_","handleMouseLeave_","handleKeyEvent_","getElement","preventScroll","blur_","getMenuItem_","menuElem","currentElement","setHighlighted","currentHighlighted","ACTIVEDESCENDANT","highlightNext","highlightHelper_","highlightPrevious","highlightFirst_","highlightLast_","startIndex","delta","oldCoords","newCoords","performAction","shiftKey","metaKey","altKey","highlighted","keyCode","ENTER","SPACE","DOWN","PAGE_UP","HOME","PAGE_DOWN","END","scrollHeight","opt_value","rightToLeft_","highlight_","checked_","checkable_","actionHandler_","checkbox","contentDom","DISABLED","setCheckable","checkable","setChecked","checked","highlight","nameDep","menuGenerator","svgArrow_","arrow_","imageElement_","selectedMenuItem_","generatedOptions_","menuGenerator_","trimOptions_","selectedOption_","shouldAddBorderRect_","FIELD_DROPDOWN_SVG_ARROW","createSVGArrow_","createTextArrow_","FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW","ARROW_CHAR","FIELD_DROPDOWN_SVG_ARROW_SIZE","setAttributeNS","FIELD_DROPDOWN_SVG_ARROW_DATAURI","dropdownCreate_","menuElement","FIELD_DROPDOWN_COLOURED_DIV","primaryColour","getColour","colourTertiary","dropdownDispose_","LISTBOX","image","Image","alt","OPTION","handleMenuActionEvent_","onItemSelected_","hasImages","label","strings","shortest","prefixLength","suffixLength","applyTrim_","opt_useCache","isValueValid","colourSecondary","fill","colourPrimary","renderSelectedImage_","renderSelectedText_","imageJson","imageHeight","imageWidth","hasBorder","FIELD_DROPDOWN_BORDER_RECT_HEIGHT","IMAGE_Y_PADDING","xPadding","arrowWidth","positionSVGArrow_","textWidth","textPadding","FIELD_DROPDOWN_SVG_ARROW_PADDING","svgArrowSize","newOptions","CHECKMARK_OVERHANG","MAX_MENU_HEIGHT_VH","IMAGE_Y_OFFSET","BubbleOpen","opt_isOpen","opt_bubbleType","BubbleType","opt_pair","opt_class","oldHostMetrics_","ratio","startDragHandle","handlePosition_","handleLength_","scrollbarLength_","startDragMouse_","containerVisible_","isVisible_","outerSvg_","svgHandle_","svgBackground_","lengthAttribute_","positionAttribute_","pair_","margin_","DEFAULT_SCROLLBAR_MARGIN","origin_","createDom_","onMouseDownBarWrapper_","onMouseDownBar_","onMouseDownHandleWrapper_","onMouseDownHandle_","cleanUp_","unsubscribe","constrainHandleLength_","setHandleLength_","newLength","constrainHandlePosition_","setHandlePosition","newPosition","setScrollbarLength_","newSize","setPosition","tempX","tempY","opt_metrics","hostMetrics","getMetrics","metricsAreEquivalent_","resizeHorizontal_","resizeVertical_","updateMetrics_","requiresViewResize_","viewWidth","viewHeight","absoluteLeft","absoluteTop","resizeViewHorizontal","resizeContentHorizontal","viewSize","xCoordinate","scrollWidth","handleLength","maxScrollDistance","maxHandleOffset","handleOffset","resizeViewVertical","resizeContentVertical","setContainerVisible","visibilityChanged","updateDisplay_","mouseXY","getInverseScreenCTM","mouseLocation","handleXY","handleStart","handlePosition","pageLength","setupDragSurface","onMouseUpHandle_","onMouseMoveHandle_","currentMouse","resetDragSurface","getRatio_","updateMetrics","setOrigin","Bubble","anchorXY","bubbleWidth","bubbleHeight","bubbleBack_","bubbleArrow_","bubbleGroup_","relativeTop_","relativeLeft_","onMouseDownResizeWrapper_","onMouseDownBubbleWrapper_","moveCallback_","resizeCallback_","workspace_","shape_","angle","ARROW_ANGLE","arrow_radians_","canvas","setAnchorLocation","getBBox","BORDER_WIDTH","setBubbleSize","positionBubble_","renderArrow_","hasResize","embossFilterId","bubbleEmboss","resizeSize","bubbleMouseDown_","setSvgId","promote","bubbleMouseUp_","registerResizeEvent","registerMoveEvent","lastChild","anchorXY_","layoutBubble_","getViewMetrics","optimalLeft","getOptimalRelativeLeft_","optimalTop","getOptimalRelativeTop_","topPosition","MIN_BLOCK_HEIGHT","startPosition","endPosition","bottomPosition","closerPosition","fartherPosition","topPositionOverlap","getOverlap_","startPositionOverlap","closerPositionOverlap","fartherPositionOverlap","mostOverlap","relativeMin","relativeLeft","bubbleRight","workspaceRight","workspaceLeft","bubbleLeft","relativeTop","bubbleTop","bubbleBottom","workspaceTop","workspaceBottom","getBubbleSize","doubleBorderWidth","relBubbleX","relBubbleY","relAnchorX","relAnchorY","rise","hypotenuse","acos","rightAngle","rightRise","rightRun","cos","bubbleSize","thickness","ARROW_THICKNESS","backoffRatio","ANCHOR_RADIUS","baseX1","baseY1","baseX2","baseY2","swirlAngle","swirlRise","ARROW_BEND","swirlRun","hexColour","paragraph","tspanElement","createNonEditableBubble","paragraphElement","iconXY","bubble","pathObject","svgPath","maxWidth","DEFAULT_SNAP_RADIUS","dragRadius","flyoutDragRadius","connectingSnapRadius","currentConnectionPreference","bumpDelay","Icon","iconGroup_","collapseHidden","SIZE","iconXY_","bubble_","block_","createIcon","getBlock","drawIcon_","iconClick_","setIconLocation","getCorrectedSize","_group","_visible","Theme","opt_blockStyles","opt_categoryStyles","opt_componentStyles","startHats","blockStyles","categoryStyles","componentStyles","fontStyle","setBlockStyle","blockStyleName","blockStyle","setCategoryStyle","categoryStyleName","categoryStyle","getComponentStyle","componentName","setComponentStyle","styleValue","setFontStyle","setStartHats","defineTheme","themeObj","base","defaultBlockStyles","Classic","toolboxJsonDef","hasCollapse","hasComments","hasDisable","rawHasTrashcan","rawHasCollapse","rawHasComments","rawHasDisable","rawHasSounds","maxTrashcanContents","toolboxAtStart","toolboxPosition","endsWith","rawOneBasedIndex","oneBasedIndex","maxBlocks","maxInstances","parseMoveOptions_","hasScrollbars","parseGridOptions_","parseZoomOptions_","parseThemeOptions_","rendererOverrides","move","wheel","drag","zoom","maxScale","minScale","scaleSpeed","pinch","grid","spacing","snap","quarkNames","workspaceHeight_","workspaceWidth_","updateWorkspacePid_","sourceListener_","rootBlock_","svgDialog_","quarkNames_","setBlock","quarkXml","quarkName","workspaceOptions","hasFlyout","newWorkspaceSvg","internalIsMutator","flyoutSvg","background","svgBlockCanvas_","resizeBubble_","workspaceSize","getCanvas","flyoutScrollMetrics","translation","onBubbleMove_","recordDragTargets","tree","CORNER_RADIUS","saveConnections","thisRootBlock","this.sourceListener_","workspaceChanged_","updateWorkspace_","removeChangeListener","shouldIgnoreMutatorEvent_","MARGIN","oldExtraState","savedRendered","newExtraState","mutationGroup","updateBlockStyle","workspaceBlocks","setStyle","getStyleName","flyoutBlocks","reconnect","connectionChild","connectionParent","currentParent","disconnect","findParentWs","outerWs","getInjectionDivXY_","aria","arrayUtils","browserEvents","deprecation","extensions","idGenerator","math","parsing","stringUtils","svgMath","svgPaths","userAgent","TrashcanOpen","Capability","name_","POSITIONABLE","DRAG_TARGET","DELETE_AREA","AUTOHIDEABLE","ComponentManager","componentData","capabilityToComponentIds","addComponent","componentInfo","component","capabilities","stringCapabilities","capability","removeComponent","addCapability","getComponent","hasCapability","removeCapability","getComponents","sorted","componentIds","components","componentDataList","componentDatum","DeserializationError","toDevString","reason","childState","VARIABLES","BLOCKS","saveBlock","BlockSerializer","blockStates","BlockCreate","BlockDelete","oldXml","wasShadow","oldJson","ConnectionType","Connection","shadowDom_","check_","shadowState_","connect_","INPUT","INPUT_VALUE","parentBlock","orphan","shadowState","stashShadowState_","applyShadowState_","setParent","orphanConnection","getConnectionForOrphanedConnection","onFailedConnect","setShadowStateInternal_","unplug","isSuperior","NEXT_STATEMENT","_otherConnection","otherConnection","disconnectInternal_","respawnShadow_","createShadowBlock_","onCheckChanged_","setCheck","check","getCheck","shadowDom","returnCurrent","neighbours","_maxLimit","serializeShadow_","attemptToConnect","blockShadow","OUTPUT_VALUE","lastConnectionInStack","CAN_CONNECT","REASON_SELF_CONNECTION","REASON_WRONG_TYPE","REASON_TARGET_NULL","REASON_CHECKS_FAILED","REASON_DIFFERENT_WORKSPACES","REASON_SHADOW_PARENT","REASON_DRAG_CHECKS_FAILED","REASON_PREVIOUS_AND_OUTPUT","COLLAPSED_INPUT_NAME","COLLAPSED_FIELD_NAME","FieldLabel","class_","class","setClass","cssClass","Input","align","Align","appendField","insertFieldAt","removeField","opt_quiet","renderList","renderedConnection","startTrackingAll","stopTrackingAll","setAlign","ASTNode","opt_params","wsCoordinate_","type_","isConnection_","isConnectionType_","location_","processParams_","params","wsCoordinate","getLocation","getType","getWsCoordinate","isConnection","findNextForInput_","curIdx","NAVIGATE_ALL_FIELDS","createFieldNode","createInputNode","findNextForField_","fieldIdx","newInput","findPrevForInput_","findPrevForField_","navigateBetweenStacks_","curLocation","curLocationAsBlock","curRoot","resultIndex","createStackNode","findTopASTNodeForBlock_","createConnectionNode","createBlockNode","getOutAstNodeForBlock_","getTopStackBlock","findFirstFieldOrInput_","types","STACK","OUTPUT","PREVIOUS","NEXT","in","prev","out","blockPos","DEFAULT_OFFSET_Y","createWorkspaceNode","PREVIOUS_STATEMENT","createTopNode","astNode","Block","hue_","colour_","styleName_","suppressPrefixSuffix","contextMenu","parentBlock_","childBlocks_","collapsed_","isShadow_","outputShape_","disposing","isInsertionMarker_","hat","onchangeWrapper_","statementInputCount","setBlockById","isInMutator","assign","addTopBlock","addTypedBlock","doInit_","onchange","setOnChange","healStack","removeTopBlock","removeTypedBlock","removeBlockById","connections","getConnections_","opt_healStack","unplugFromRow_","unplugFromStack_","thisConnection","getOnlyValueConnection_","previousTarget","nextTarget","_all","myConnections","ignoreShadows","getInputWithBlock","getSurroundParent","prevBlock","getPreviousBlock","getFirstStatementConnection","rootBlock","previous","ordered","childBlocks","hasBlockLimits","setInsertionMarker","insertionMarker","isDisposed","getMatchingConnection","otherBlock","conn","otherConnections","setHelpUrl","getHue","parsed","onchangeFn","getVars","vars","model","updateVarName","renameVarById","newId","setFieldValue","setPreviousStatement","newBoolean","opt_check","makeConnection_","setNextStatement","setOutput","setOutputShape","outputShape","getOutputShape","ancestor","opt_maxLength","opt_emptyToken","shouldAddParentheses","checks","checkRoot","rootNode","emptyFieldPlaceholder","prevNavigateFields","current","acc","appendValueInput","appendInput_","appendStatementInput","appendDummyInput","warningPrefix","jsonInitStyle_","jsonInitColour_","interpolate_","localizedText","localizedValue","extensionNames","styleError","opt_disableCheck","overwrites","lastDummyAlign","validateTokens_","elements","interpolateArguments_","fieldStack","isInputKeyword_","inputFromJson_","fieldFromJson_","argsCount","visitedArgsHash","visitedArgsCount","token","stringToFieldJson_","dummyInput","alignmentLookup","CENTRE","alignment","moveInputBefore","refName","inputIndex","refIndex","moveNumberedInputBefore","RangeError","removeInput","getInputTargetBlock","setWarningText","_text","_opt_id","_mutator","allInputsFilled","opt_shadowBlocksAreFilled","Comment","cachedText_","paragraphElement_","onInputWrapper_","onChangeWrapper_","onWheelWrapper_","model_","resizeTextarea_","startEdit_","disposeBubble_","createBubble_","onBubbleResize_","widthMinusBorder","heightMinusBorder","createEditableBubble_","createNonEditableBubble_","updateText","registry_","reset","getContextMenuOptions","menuOptions","precondition","menuOption","COLLAPSE_CHARS","DRAG_STACK","OPPOSITE_TYPE","RENAME_VARIABLE_ID","DELETE_VARIABLE_ID","Marker","drawer_","curNode_","getCurNode","setCurNode","oldNode","Cursor","curNode","BasicCursor","getNextNode_","validNode_","getPreviousNode_","isValid","siblingOrParent","findSiblingOrParent_","getRightMostChild_","nextNode","registrationName","TabNavigateCursor","BUMP_RANDOMNESS","RenderedConnection","highlightPath","db_","connectionDBList","dbOpposite_","offsetInBlock_","trackedState_","TrackedState","WILL_TRACK","TRACKED","removeConnection","distanceFrom","xDiff","yDiff","bumpAwayFrom","staticConnection","addConnection","moveToOffset","blockTL","setOffsetInBlock","getOffsetInBlock","tighten","svgRoot","moveConnections","closest","maxLimit","dxy","searchForClosest","renderConstants","shapeFor","yLen","TAB_OFFSET_FROM_TOP","pathDown","xLen","NOTCH_OFFSET_LEFT","pathLeft","unhighlight","setTracking","doTracking","UNTRACKED","getNeighbours","parentRendered","childRendered","Warning","text_","setText","allWarnings","renderingDebugger","warningTextDb","commentIcon_","renderIsInProgress_","customContextMenu","getBlockStyle","makePathObject","getColourSecondary","getColourTertiary","oldParent","isClearing","oldXY","eventsEnabled","curXY","moveOffDragSurface","clearAndHide","snapToGrid","getGrid","shouldSnap","getSpacing","half","blockBounds","updateCollapsed_","collapsedInputName","collapsedFieldName","tab","tabCursor","currentNode","nextField","handleBlockStart","open","generateContextMenu","INSERTION_MARKER_COLOUR","updateInsertionMarker","animate","blockWorkspace","n","shouldHaveComment","timeout","changedState","collapsedParent","COLLAPSED_WARNING_ID","oldText","newText","updateHighlighted","updateSelected","updateDraggingDelete","styleObj","getBlockStyleForColour","bringToFront","removed","track","all","renderedConn","renderedOther","scheduleSnapAndBump","positionNearConnection","sourceConnection","opt_bubble","updateConnectionLocations_","nextHeightWidth","tabHeight","NOTCH_HEIGHT","fadeForReplacement","updateReplacementFade","highlightShapeForInput","updateShapeForInputHighlight","INLINE","DragTarget","onDragEnter","_dragElement","onDragOver","onDragExit","onDrop","getClientRect","shouldPreventMove","DeleteArea","wouldDelete_","wouldDelete","couldConnect","couldDeleteBlock","updateWouldDelete_","SPRITE","Trashcan","contents_","isLidOpen","minOpenness_","lidTask_","svgLid_","top_","left_","lidOpen_","initialized_","flyoutWorkspaceOptions","HorizontalFlyout","VerticalFlyout","onDelete_","clip","WIDTH","BODY_HEIGHT","LID_HEIGHT","SPRITE_LEFT","SPRITE_TOP","blockMouseDownWhenOpenable_","click","mouseOver_","mouseOut_","animateLid_","getComponentManager","setLidOpen","hasContents_","contentsIsOpen","openFlyout","string","fireUiEvent_","closeFlyout","autoHide","onlyClosePopups","emptyContents","setMinOpenness_","cornerPosition","MARGIN_HORIZONTAL","MARGIN_VERTICAL","positionRect","trashRect","MARGIN_HOTSPOT","frames","ANIMATION_FRAMES","setLidAngle_","MAX_LID_ANGLE","OPACITY_MIN","OPACITY_MAX","ANIMATION_LENGTH","lidAngle","openAtRight","newMin","closeLid","trashcanOpen","uiEvent","cleanedJson","cleanBlockJson_","HAS_BLOCKS_LID_ANGLE","cleanRec","blockInfo","ToolboxItemSelect","opt_oldItem","opt_newItem","oldItem","newItem","ToolboxItem","toolboxItemDef","parentToolbox","level_","parent_","getLevel","toolboxItemDef_","parentToolbox_","getClickTarget","isSelectable","isCollapsible","setVisible_","_isVisible","ToolboxCategory","categoryDef","labelDom_","iconDom_","rowContents_","rowDiv_","htmlDiv_","isDisabled_","isHidden_","flyoutItems_","cssConfig_","makeDefaultCssConfig_","parseCategoryDef_","parseContents_","flyoutItem","itemDef","getColour_","createContainer_","TREEITEM","LEVEL","createRowContainer_","pointerEvents","createRowContentsContainer_","createIconDom_","PRESENTATION","createLabelDom_","LABELLEDBY","addColourBorder_","rowDiv","nestedPadding","paddingRight","paddingLeft","contentsContainer","toolboxIcon","isHorizontal","toolboxLabel","refreshTheme","border","borderWidth","borderRight","borderLeft","styleName","getColourfromStyle_","parseColour_","colourValue","openIcon_","iconDiv","closedIconClass","closeIcon_","openIconClass","getSelectedItem","clearSelection","allAncestorsExpanded_","category","isExpanded","onClick","isSelected","defaultColour","defaultBackgroundColour","setDisabled","isDisabled","getName","getContents","updateFlyoutContents","newDefinition","kind","custom","categorystyle","cssconfig","hidden","ToolboxSeparator","separatorDef","CollapsibleToolboxCategory","subcategoriesDiv_","expanded_","toolboxItems_","cssConfig","prevIsFlyoutItem","createToolboxItem_","registryName","toolboxItem","ToolboxItemClass","setExpanded","subCategories","getChildToolboxItems","createSubCategoriesDom_","GROUP","subcategories","newCategory","newCategoryDiv","EXPANDED","handleToolboxItemResize","childToolboxItems","toggleExpanded","Toolbox","contentsDiv_","HtmlDiv","previouslySelectedItem_","selectedItem_","flyout_","boundEvents_","toolboxDef_","horizontalLayout_","contentMap_","createFlyout_","themeManager","createContentsContainer_","TREE","attachEvents_","toolboxContainer","flexDirection","clickEvent","onClick_","keyDownEvent","onKeyDown_","itemId","getToolboxItemById","setSelectedItem","selectNext_","selectPrevious_","selectParent_","selectChild_","untypedItem","FlyoutClass","renderContents_","fragment","createDocumentFragment","addToolboxItem_","toolboxItemDom","getToolboxItems","addStyle","removeStyle","toolboxRect","BIG_NUM","_couldConnect","updateCursorDeleteStyle_","getPreviouslySelectedItem","workspaceMetrics","toolboxDiv","newX","childAsCategory","refreshSelection","autoClose","shouldDeselectItem_","deselectItem_","shouldSelectItem_","selectItem_","updateFlyout_","fireSelectEvent_","selectItemByPosition","oldElement","collapsibleItem","nextItemIdx","nextItem","prevItemIdx","prevItem","Zelos","Click","opt_targetType","targetType","ClickTarget","BubbleDragger","dragTarget_","wouldDeleteBubble_","startXY_","dragSurface_","startBubbleDrag","dragBubble","currentDragDeltaXY","pixelsToWorkspaceUnits_","oldDragTarget","getDragTarget","oldWouldDeleteBubble","shouldDelete_","updateCursorDuringBubbleDrag_","dragTarget","componentManager","isDeleteArea","endBubbleDrag","fireMoveEvent_","setOldCoordinate","pixelCoord","WorkspaceDragger","horizontalScrollEnabled_","isMovableHorizontally","verticalScrollEnabled_","isMovableVertically","startScrollXY_","endDrag","scroll","creatorWorkspace","mouseDownXY_","startWorkspace_","targetBlock_","startBlock_","startField_","startBubble_","hasExceededDragRadius_","workspaceDragger_","blockDragger_","bubbleDragger_","onUpWrapper_","onMoveWrapper_","isEnding_","hasStarted_","calledUpdateIsDragging_","mostRecentEvent_","currentDragDeltaXY_","healStack_","clearGesture","updateFromEvent_","currentXY","updateDragDelta_","changed","updateIsDragging_","currentDragDelta","limitRadius","updateIsDraggingFromFlyout_","isBlockCreatable","isScrollable","isDragTowardWorkspace","updateScreenCalculationsIfScrolled","createBlock","updateIsDraggingBubble_","startDraggingBubble_","updateIsDraggingBlock_","startDraggingBlock_","updateIsDraggingWorkspace_","wsMovable","isDraggable","BlockDraggerClass","doStart","cancel","pointerType","handleMove","handleUp","log","isBubbleClick_","doBubbleClick_","isFieldClick_","doFieldClick_","isBlockClick_","doBlockClick_","isWorkspaceClick_","doWorkspaceClick_","bringBlockToFront_","handleWsStart","setStartWorkspace_","fireWorkspaceClick_","handleFlyoutStart","setStartFlyout_","setStartBlock","setStartBubble","setTargetBlock_","hasStartBubble","hasStartBlock","fieldClickable","hasStarted","getInsertionMarkers","getCurrentDragger","currentGesture_","shortcuts","keyMap","shortcut","registeredShortcut","addKeyMapping","allowCollision","shortcutName","removeAllKeyMappings","opt_allowCollision","shortcutNames","removeKeyMapping","shortcutIdx","setKeyMap","newKeyMap","getKeyMap","legacyKeyMap","getRegistry","legacyRegistry","serializeKeyEvent_","getShortcutNamesByKeyCode","getKeyCodesByShortcutName","serializedKey","modifier","modifierKeys","getModifierState","checkModifiers_","modifiers","modifierKeyCode","ThemeChange","opt_themeName","themeName","ViewportChange","opt_top","opt_left","opt_scale","opt_oldScale","ConnectionDB","connections_","yPos","calculateIndexForYPos_","findIndexOfConnection_","bestGuess","pointer","pointerMin","pointerMax","pointerMid","maxRadius","checkConnection_","yIndex","currentX","db","currentY","isInYRange_","baseY","baseX","closestIndex","bestConnection","bestRadius","dbList","pattern","line2","line1","getPatternId","update","safeSpacing","end","setLineAttributes","x1","x2","y1","y2","reservedWordsList","opt_variablePrefix","dbReverse","variableMap_","variablePrefix_","reservedWords","setVariableMap","getNameForUserVariable_","populateVariables","NameType","VARIABLE","nameOrId","normalizedName","DEVELOPER_VARIABLE","typeDb","safeName","getDistinctName","getUserNames","userNames","safeName_","encodeURI","name1","name2","DEVELOPER_VARIABLE_TYPE","TypesContainer","NONE","HAT","ICON","SPACER","BETWEEN_ROW_SPACER","IN_ROW_SPACER","EXTERNAL_VALUE_INPUT","INLINE_INPUT","STATEMENT_INPUT","CONNECTION","PREVIOUS_CONNECTION","NEXT_CONNECTION","OUTPUT_CONNECTION","CORNER","LEFT_SQUARE_CORNER","LEFT_ROUND_CORNER","RIGHT_SQUARE_CORNER","RIGHT_ROUND_CORNER","JAGGED_EDGE","ROW","TOP_ROW","BOTTOM_ROW","INPUT_ROW","LEFT_CORNER","RIGHT_CORNER","nextTypeValue_","hasOwnProperty","isField","isHat","isIcon","isSpacer","isInRowSpacer","isInput","isExternalInput","isInlineInput","isStatementInput","isPreviousConnection","isNextConnection","isPreviousOrNextConnection","isLeftRoundedCorner","isRightRoundedCorner","isLeftSquareCorner","isRightSquareCorner","isCorner","isJaggedEdge","isRow","row","isBetweenRowSpacer","isTopRow","isBottomRow","isTopOrBottomRow","isInputRow","Types","Measurable","centerline","xPos","notchOffset","Row","widthWithConnectedBlocks","minWidth","minHeight","hasStatement","hasExternalInput","statementEdge","hasJaggedEdge","hasDummyInput","hasInlineInput","getLastInput","measure","startsWithElemSpacer","endsWithElemSpacer","getFirstSpacer","getLastSpacer","BottomRow","hasNextConnection","descenderHeight","hasLeftSquareCorner","hasRightSquareCorner","_block","connectionModel","InputConnection","connectionOffsetY","connectionOffsetX","connectedBlock","connectedBlockWidth","connectedBlockHeight","ExternalValueInput","MEDIUM_PADDING","EXTERNAL_VALUE_INPUT_PADDING","connectionHeight","connectionWidth","flipRtl","Hat","START_HAT","ascenderHeight","InRowSpacer","SPACER_DEFAULT_HEIGHT","InlineInput","EMPTY_INLINE_INPUT_HEIGHT","EMPTY_INLINE_INPUT_PADDING","StatementInput","STATEMENT_BOTTOM_SPACER","EMPTY_STATEMENT_INPUT_HEIGHT","STATEMENT_INPUT_NOTCH_OFFSET","InputRow","connectedBlockWidths","JaggedEdge","JAGGED_TEETH","NextConnection","OutputConnection","startX","PreviousConnection","RoundCorner","opt_position","SpacerRow","precedesStatement","followsStatement","SquareCorner","NO_PADDING","TopRow","capline","hasPreviousConnection","hasHat","ADD_START_HATS","ConstantProvider","SMALL_PADDING","MEDIUM_LARGE_PADDING","LARGE_PADDING","TAB_HEIGHT","TAB_VERTICAL_OVERLAP","TAB_WIDTH","NOTCH_WIDTH","MIN_BLOCK_WIDTH","EMPTY_BLOCK_SPACER_HEIGHT","STATEMENT_INPUT_PADDING_LEFT","BETWEEN_STATEMENT_PADDING_Y","START_HAT_HEIGHT","START_HAT_WIDTH","JAGGED_TEETH_HEIGHT","JAGGED_TEETH_WIDTH","FIELD_BORDER_RECT_Y_PADDING","FIELD_BORDER_RECT_COLOUR","FIELD_COLOUR_FULL_BLOCK","FIELD_TEXTINPUT_BOX_SHADOW","FIELD_COLOUR_DEFAULT_WIDTH","defs_","embossFilter_","disabledPatternId","disabledPattern_","debugFilterId","cssNode_","debugFilter_","CURSOR_COLOUR","MARKER_COLOUR","CURSOR_WS_WIDTH","WS_CURSOR_HEIGHT","CURSOR_STACK_PADDING","CURSOR_BLOCK_PADDING","CURSOR_STROKE_WIDTH","FULL_BLOCK_FIELDS","INSERTION_MARKER_OPACITY","SHAPES","PUZZLE","NOTCH","TALL_INPUT_FIELD_OFFSET_Y","DUMMY_INPUT_SHADOW_MIN_HEIGHT","DUMMY_INPUT_MIN_HEIGHT","TOP_ROW_MIN_HEIGHT","TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT","BOTTOM_ROW_MIN_HEIGHT","BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT","START_POINT","FIELD_COLOUR_DEFAULT_HEIGHT","FIELD_CHECKBOX_X_OFFSET","randomIdentifier","makeJaggedTeeth","makeNotch","makeStartHat","PUZZLE_TAB","makePuzzleTab","INSIDE_CORNERS","makeInsideCorners","OUTSIDE_CORNERS","makeOutsideCorners","setTheme","validatedBlockStyle_","setDynamicProperties_","setFontConstants_","setComponentConstants_","fontMetrics","createBlockStyle_","valid","parsedColour","generateSecondaryColour_","generateTertiaryColour_","inputColour","mainPath","path","makeMainPath","up","back","control1Y","overlap","control2Y","endPoint1","endPoint2","pathUp","dir","outerWidth","innerWidth","pathRight","innerTopLeftCorner","innerBottomLeftCorner","pathTop","pathBottom","topLeft","topRight","bottomLeft","bottomRight","rightHeight","selector","injectCSS_","embossFilter","feSpecularLighting","disabledPattern","createDebugFilter","debugFilter","debugComponentTransfer","cssArray","getCSS_","cssNodeId","Debug","debugElements_","svgRoot_","randomColour_","clearElems","drawSpacerRow","cursorY","isRtl","rowSpacers","isNegativeSpacing","drawSpacerElem","rowHeight","elemSpacers","drawRenderedElem","elems","drawConnection","drawRenderedRow","rows","connectedBlockBounds","drawRowWithElements","drawBoundingBox","widthWithChildren","drawDebug","rightSide","drawRender","Drawer","inlinePath_","outlinePath_","info_","topLeft_","hideHiddenIcons_","drawOutline_","drawInternals_","setPath","flipRTL","recordSizeOnBlock_","iconInfo","hiddenIcons","drawTop_","drawJaggedEdge_","drawStatementInput_","drawValueInput_","drawRightSideRow_","drawBottom_","drawLeft_","topRow","positionPreviousConnection_","startY","positionExternalValueConnection_","innerHeight","positionStatementInputConnection_","bottomRow","positionNextConnection_","rightCornerYOffset","outlinePath","positionOutputConnection_","tabBottom","drawInlineInput_","layoutField_","fieldInfo","connectionTop","connectionBottom","positionInlineInputConnection_","connX","connInfo","RenderInfo","inputRows","renderer_","isInline","createRows_","addElemSpacing_","addRowSpacing_","computeBounds_","alignRowElements_","finalize_","populateTopRow_","activeRow","lastInput","shouldStartNewRow_","addInput_","populateBottomRow_","hasPrevious","cornerClass","leftSquareCorner","rightSquareCorner","oldElems","getInRowSpacing_","widestStatementRowFields","blockWidth","widestRowWithConnectedBlocks","statementInput","alignStatementRow_","currentWidth","missingSpace","getDesiredRowWidth_","desiredWidth","addAlignmentPadding_","_row","firstSpacer","lastSpacer","oldRows","makeSpacerRow_","getSpacerRowHeight_","getSpacerRowWidth_","spacer","_prev","_next","getElemCenterline_","recordElemPositions_","xCursor","yCursor","MarkerMove","isCursor","opt_oldNode","opt_newNode","CURSOR_CLASS","MARKER_CLASS","HEIGHT_MULTIPLIER","MarkerSvg","markerSvgRect_","markerSvgLine_","markerInput_","markerBlock_","currentMarkerSvg","createDomInternal_","setParent_","applyColour_","showAtLocation_","fireMarkerEvent_","beginElement","connectionType","curNodeAsConnection","showWithBlock_","showWithOutput_","showWithInput_","showWithNext_","showWithPrevious_","showWithField_","showWithCoordinates_","showWithStack_","showWithBlockPrevOutput_","markerHeight","markerOffset","connectionShape","positionPrevious_","positionOutput_","positionBlock_","showCurrent_","positionLine_","positionRect_","positionInput_","heightWidth","yPadding","markerPath","flipRtl_","curBlock","getBlinkProperties_","blinkProperties","attributeName","_curNode","firstElementChild","PathObject","pathString","updateShadow_","updateDisabled_","setClass_","_conn","DUPLICATE_BLOCK_ERROR","InsertionMarkerManager","localConnection_","closestConnection_","lastMarker_","lastOnStack_","wouldDeleteBlock_","fadedBlock_","highlightedBlock_","markerConnection_","topBlock_","firstMarker_","createMarkerBlock_","availableConnections_","initAvailableConnections_","updateAvailableConnections","wouldDeleteBlock","wouldConnectBlock","applyConnections","hidePreview_","inferiorConnection","candidate","getCandidate_","shouldUpdatePreviews_","maybeHidePreview_","maybeShowPreview_","imType","sourceInput","resultInput","sourceField","resultField","available","lastOnStack","candidateLocal","local","candidateClosest","curDistance","getStartRadius_","myConnection","neighbour","showPreview_","getConnectionPreviewMethod","method","PREVIEW_TYPE","INPUT_OUTLINE","showInsertionInputOutline_","INSERTION_MARKER","showInsertionMarker_","REPLACEMENT_FADE","showReplacementFade_","shouldHighlightConnection","closestChanged","localChanged","hideReplacementFade_","hideInsertionInputOutline_","hideInsertionMarker_","isLastInStack","imConn","imBlock","markerNext","markerPrev","markerOutput","isFirstInOutputStack","isFirstInStatementStack","innerConnection","previousBlockNextConnection","PreviewType","Renderer","overrides","makeConstants_","refreshDom","previousConstants","makeRenderInfo_","makeDrawer_","makeDebugger_","orphanCanConnectAtEnd","localType","ThemeManager","subscribedWorkspaces_","componentDB","prevTheme","oldClassName","newClassName","componentList","propertyName","subscribeWorkspace","unsubscribeWorkspace","owner_","ZOOM_IN_MULTIPLIER","ZOOM_OUT_MULTIPLIER","TouchGesture","arguments","isMultiTouch_","cachedPoints","startDistance_","previousScale_","isPinchZoomEnabled_","onStartWrapper_","handleTouchStart","isMultiTouch","handleTouchMove","handleTouchEnd","getTouchPoint","pointers","point0","point1","handlePinch_","moveDistance","gestureScale","onCreateVariableButtonClick_String","onCreateVariableButtonClick_Number","onCreateVariableButtonClick_Colour","ConnectionChecker","opt_distance","safety","doSafetyChecks","doTypeChecks","doDragChecks","errorCode","superiorBlock","inferiorBlock","superiorConnection","checkArrayOne","checkArrayTwo","canConnectToPrevious_","VarDelete","VarRename","VariableMap","variableMap","conflictVar","renameVariableWithConflict_","renameVariableAndUses_","deleteVariable","variableId","tempVar","variableName","uses","getVariableUsesById","procedureName","deleteText","confirmText","deleteVariableInternal","list","getVariableTypes","variableTypes","flat","Workspace","internalIsFlyout","MAX_UNDO","topBlocks_","topComments_","commentDB","listeners_","undoStack_","redoStack_","blockDB","typedBlocksDB","potentialVariableMap_","connectionCheckerClass","sortObjects_","aXY","bXY","SCAN_ANGLE","filtered","remainingCapacity","remainingCapacityOfType","maxInstanceOfType","copyableBlocksCount","redo","inputStack","outputStack","inputEvent","clearUndo","createPotentialVariableMap","getById","getAll","SOUND_LIMIT","WorkspaceAudio","sounds","lastSound_","filenames","audioTest","filename","ext","canPlayType","sound","volume","playPromise","then","pause","catch","opt_volume","now","mySound","ZoomControls","zoomResetGroup","zoomOutGroup","zoomInGroup","onZoomOutWrapper_","onZoomInWrapper_","onZoomResetWrapper_","HEIGHT_","WIDTH_","SMALL_SPACING_","LARGE_SPACING_","MARGIN_HORIZONTAL_","MARGIN_VERTICAL_","createZoomOutSvg_","createZoomInSvg_","createZoomResetSvg_","zoomInTranslateY","zoomOutTranslateY","zoomoutSvg","zoom_","zoominSvg","amount","zoomCenter","fireZoomEvent_","zoomresetSvg","resetZoom_","beginCanvasTransition","scrollCenter","endCanvasTransition","ZOOM_TO_FIT_MARGIN","opt_blockDragSurface","opt_wsDragSurface","resizeHandlerWrapper_","resizesEnabled_","startScrollY","startScrollX","dragDeltaXY_","oldScale_","oldLeft_","oldTop_","workspaceDragSurface_","blockDragSurface_","toolbox_","isDragSurfaceActive_","inverseScreenCTM_","configureContextMenu","lastRecordedPageScroll_","injectionDiv_","inverseScreenCTMDirty_","highlightedBlocks_","toolboxCategoryCallbacks","flyoutButtonCallbacks","cachedParentSvg_","topBoundedElements_","dragTargetAreas_","metricsManager_","MetricsManagerClass","setTopLevelWorkspaceMetrics_","componentManager_","useWorkspaceDragSurface_","audioManager_","grid_","markerManager_","Variables","registerToolboxCategoryCallback","VariablesDynamic","Procedures","themeManager_","cachedParentSvgSize_","getMarkerManager","setMetricsManager","updateBlockStyles_","refreshToolboxSelection","ctm","opt_backgroundClass","svgBubbleCanvas_","onMouseWheel_","ToolboxClass","CursorClass","parentSvg","newTrashcan","svgTrashcan","_workspace","svgZoomControls","opt_own","updateScreenCalculations_","positionables","getUiMetrics","positionable","currScroll","maybeFireViewportChangeEvent","translateAndScaleGroup","trans","previousElement","previousSibling","coord","setContentsAndShow","imList","highlightBlock","opt_state","pasteBlock_","pasteWorkspaceComment_","jsonBlock","collide","allBlocks","otherXY","dragTargets","targetArea","clientRect","canWheelZoom","canWheelMove","scrollDelta","commandKey","PIXELS_PER_ZOOM_STEP","topElements","boundary","topElement","blockBoundary","setBrowserFocus","activeElement","setActive","scaleChange","newScale","getCTM","center","f","setScale","svgWidth","svgHeight","zoomToFit","workspaceWidth","workspaceHeight","blocksBox","doubleMargin","blocksWidth","blocksHeight","ratioX","ratioY","centerOnBlock","pixelX","multiplier","pixelY","reflow","resizeView","resizeContent","getScale","maxYScroll","maxYDisplacement","maxXDisplacement","addTopBoundedElement","removeTopBoundedElement","reenabled","getButtonCallback","removeButtonCallback","getToolboxCategoryCallback","removeToolboxCategoryCallback","isStart","autoHideables","autoHideable","xyRatio","VariableSerializer","variableStates","varState","BaseConstantProvider","GRID_UNIT","CURSOR_RADIUS","HEXAGONAL","ROUND","SQUARE","SHAPE_IN_SHAPE_PADDING","SELECTED_GLOW_COLOUR","SELECTED_GLOW_SIZE","REPLACEMENT_GLOW_COLOUR","REPLACEMENT_GLOW_SIZE","selectedGlowFilterId","selectedGlowFilter_","replacementGlowFilterId","SQUARED","ROUNDED","replacementGlowFilter_","STATEMENT_INPUT_SPACER_MIN_WIDTH","MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH","makeHexagonal","makeRounded","makeSquared","rightWidth","selectedGlowSize","replacementGlowSize","pathRightDown","pathRightUp","blockHeight","remainingHeight","maxHeight","_height","curveWidth","quarterHeight","innerTopRightCorner","innerBottomRightCorner","pathTopRight","pathBottomRight","selectedGlowFilter","selectedComponentTransfer","replacementGlowFilter","replacementComponentTransfer","BaseDrawer","beginDrawing","outputShapeType","endDrawing","hasStatementInput","drawFlatTop_","drawRightDynamicConnection_","drawFlatBottom_","drawLeftDynamicConnection_","cornerHeight","setOutlinePath","connectedBottomNextConnection","FieldImage","opt_alt","opt_onClick","opt_flipRtl","altText_","Y_PADDING","imageHeight_","setAlt","setOnClickHandler","FieldTextInput","spellcheck_","htmlInput_","isTextValid_","isBeingEdited_","onKeyInputWrapper_","onKeyDownWrapper_","fullBlockClickTarget_","spellcheck","nFields","nConnections","resizeEditor_","htmlInput","INVALID","setSpellcheck","_opt_e","opt_quietInput","quietInput","showPromptEditor_","showInlineEditor_","getValueFromEditorText_","widgetDispose_","widgetCreate_","borderRadius","BORDERRADIUS","strokeColour","boxShadow","getEditorText_","bindInputEvents_","onFinishEditing_","unbindInputEvents_","_value","onHtmlInputKeyDown_","onHtmlInputChange_","TAB","setEditorValue_","BaseBottomRow","BaseStatementInput","RightConnectionShape","BaseTopRow","BaseRenderInfo","isMultiRow","rightAlignedDummyInputs_","WeakMap","adjustXPosition_","alignmentDivider","notchTotalWidth","minXPos","prevSpacer","nextSpacer","hasPrevNotch","hasNextNotch","prevInRowSpacer","finalizeOutputConnection_","outputConnectionShape","rightConnectionWidth","finalizeHorizontalAlignment_","totalNegativeSpacing","lastElem","leftNegPadding","getNegativeSpacing_","firstElem","rightNegPadding","minBlockWidth","outerShape","innerShape","finalizeVerticalAlignment_","firstRow","hasSingleTextOrImageField","hasNonShadowConnectedBlocks","minVerticalTightNestingHeight","BaseMarkerSvg","markerCircle_","showWithInputOutput_","offsetInBlock","positionCircle_","BasePathObject","svgPathSelected_","outlines","remainingOutlines","outline","getOutlinePath_","removeOutlinePath_","BaseRenderer","hasExternalInputs","heightWithoutHat","diff","DARK_PATH_OFFSET","MAX_BOTTOM_WIDTH","Highlighter","inlineSteps_","steps_","RTL_","highlightConstants_","getHighlightConstants","highlightOffset_","OFFSET","outsideCornerPaths_","OUTSIDE_CORNER","insideCornerPaths_","INSIDE_CORNER","puzzleTabPaths_","notchPaths_","startPaths_","jaggedTeethPaths_","getPath","drawTopCorner","drawValueInput","belowTabHeight","drawStatementInput","drawRightSideRow","rightEdge","drawBottomRow","cornerElem","drawLeft","drawInlineInput","connectionRight","bottomHighlightWidth","aboveTabHeight","highlighter_","setHighlightPath","HighlightConstantProvider","constantProvider","makeInsideCorner","makeOutsideCorner","distance45outside","SQRT1_2","pathTopRtl","pathBottomRtl","pathBottomLtr","distance45inside","topLeftCornerHighlightRtl","topLeftCornerHighlightLtr","bottomLeftStartY","bottomLeftPath","highlightRtlUp","highlightRtlDown","verticalOverlap","highlightLtrUp","highlightLtrDown","hatHeight","pathRtl","pathLtr","BaseInlineInput","nextRightEdge","rowNextRightEdges","prevInput","prevRightEdge","colourDark","svgPathDark","svgPathLight","makeHighlightConstants_","fixedX","fixedY","newSurface","blockCanvas","bubbleCanvas","scale_","surfaceXY_","childSurfaceXY_","svg_","dragGroup_","roundX","roundY","translateSurfaceInternal_","translateBy","getWsTranslation","opt_newSurface","currentBlockElement","bumpIntoBounds","addHorizontal","addVertical","corner_","vScroll","hScroll","isPair","resizeH","resizeV","setX","setY","Generator","FUNCTION_NAME_PLACEHOLDER_","STATEMENT_SUFFIX","STATEMENT_PREFIX","INFINITE_LOOP_TRAP","INDENT","COMMENT_WRAP","ORDER_OVERRIDES","isInitialized","RESERVED_WORDS_","definitions_","functionNames_","nameDB_","FUNCTION_NAME_PLACEHOLDER_REGEXP_","RegExp","workspaceToCode","code","blockToCode","scrubNakedValue","injectId","codeString","finish","prefixLines","allNestedComments","opt_thisOnly","scrub_","SyntaxError","valueToCode","outerOrder","innerOrder","parensNeeded","outerOrderClass","innerOrderClass","statementToCode","addLoopTrap","branch","addReservedWords","provideFunction_","desiredName","functionName","PROCEDURE","codeText","oldCodeText","_opt_thisOnly","defineProperties","variableDB_","nameDb","FlyoutButton","isLabel_","svgText_","callbackKey_","cssClass_","svgText","TEXT_MARGIN_X","TEXT_MARGIN_Y","updateTransform_","onMouseUp_","isLabel","getButtonText","MetricsManager","getDimensionsPx_","getFlyoutMetrics","flyoutDimensions","getToolboxMetrics","toolboxDimensions","getSvgMetrics","getAbsoluteMetrics","flyoutMetrics","doesToolboxExist","doesFlyoutExist","atLeft","atTop","opt_getWorkspaceCoordinates","svgMetrics","getContentMetrics","blockBox","getComputedFixedEdges_","opt_viewMetrics","hScrollEnabled","vScrollEnabled","edges","getPaddedContent_","contentMetrics","contentBottom","contentRight","halfWidth","opt_contentMetrics","fixedEdges","paddedContent","contentHeight","contentTop","contentLeft","toolboxWidth","toolboxHeight","flyoutWidth","flyoutHeight","FlyoutMetricsManager","getBoundingBox_","blockBoundingBox","FlyoutItemType","Flyout","eventWrappers_","filterWrapper_","reflowWrapper_","mats_","buttons_","permanentlyDisabled_","recycledBlocks_","SCROLLBAR_MARGIN","dragAngleRange_","setMetrics_","toolboxPosition_","tabWidth_","rectMap_","GAP_X","GAP_Y","wheel_","filterForCapacity_","getFlyoutScale","positionAt_","listen","clearOldBlocks_","getDynamicCategoryContents_","parsedContent","flyoutInfo","createFlyoutInfo_","layout_","gaps","deselectAll","emptyRecycledBlocks_","defaultGap","contentInfo","categoryName","parsedDynamicContent","createFlyoutBlock_","addBlockGap_","addSeparatorGap_","createButton_","BUTTON","fnToApply","btnInfo","curButton","getRecycledBlock_","blockType","gap","sepInfo","newGap","oldBlocks","blockIsRecyclable_","recycleBlock_","addBlockListeners_","blockMouseDown_","originalBlock","placeNewBlock_","initFlyoutButton_","buttonSvg","createRect_","blockHW","moveRectToBlock_","reflowInternal_","oldBlock","svgRootOld","positionNewBlock_","flyoutOffsetPixels","oldBlockPos","oldBlockOffsetPixels","getX","getY","targetWorkspaceViewMetrics","setBackgroundPath_","atRight","cursorX","moveX","dragDirection","atan2","range","flyoutRect","oldX","buttons","FieldVariable","opt_variableTypes","opt_defaultType","defaultType_","variable_","dropdownCreate","defaultVariableName","setTypes_","defaultType","variableType","typeIsAllowed_","typeList","getVariableTypes_","isInArray","FieldNumber","opt_min","opt_max","opt_precision","min_","max_","precision_","decimalPlaces_","setConstraints","setMinInternal_","setMaxInternal_","setPrecisionInternal_","precision","setMin","getMin","setMax","getMax","setPrecision","precisionString","toLocaleString","maximumFractionDigits","decimalIndex","getPrecision","isFinite","toFixed","VALUEMIN","VALUEMAX","FieldMultilineInput","textGroup_","maxLines_","isOverflowedY_","maxLines","setMaxLines","textLines","displayLinesNumber","currentChild","lineHeight","nodes","tspan","actualEditorLines","dummyTextElement","lineWidth","paddingX","paddingY","padding","getMaxLines","FieldLabelSerializable","FieldColour","onMouseLeaveWrapper_","onMouseEnterWrapper_","onClickWrapper_","highlightedIndex_","picker_","titles_","colours_","columns_","colourOptions","colourTitles","columns","setColours","colours","opt_titles","setColumns","cell","moveHighlightBy_","getHighlighted_","COLOURS","COLUMNS","setHighlightedCell_","onMouseMove_","onMouseEnter_","onMouseLeave_","col","titles","TITLES","selectedColour","table","GRID","ROWCOUNT","COLCOUNT","title","GRIDCELL","FieldCheckbox","checkChar_","CHECK_CHAR","checkCharacter","getValueBoolean","setCheckCharacter","character","convertValueToBool_","FieldAngle","moveSurfaceWrapper_","clickSurfaceWrapper_","clickWrapper_","symbol_","line_","gauge_","editor_","clockwise_","CLOCKWISE","offset_","wrap_","WRAP","round_","mode","Mode","COMPASS","PROTRACTOR","clockwise","updateGraph_","HALF","circle","RADIUS","hide_","ownerSVGElement","displayMouseOrKeyboardValue_","wrapValue_","clockwiseFlag","angle1","largeFlag","BlockMove","currentLocation_","oldParentId","parentId","oldInputName","oldCoordinate","coordinate","blockConnection","CommentBase","opt_comment","CommentCreateDeleteHelper","CommentChange","opt_oldContents","opt_newContents","oldContents_","newContents_","CommentCreate","CommentDelete","CommentMove","comment_","oldCoordinate_","newCoordinate_","BlockDrag","opt_isStart","opt_blocks","Ui","FinishedLoading","opt_workspace","BlockDragger","draggingBlock_","draggedConnectionManager_","dragIconData_","fireDragStartEvent_","shouldDisconnect_","disconnectBlock_","dragIcons_","oldWouldDeleteBlock","updateCursorDuringBlockDrag_","fireDragEndEvent_","newValues","getNewLocationAfterDrag_","newLocation","maybeDeleteBlock_","deleted","updateBlockAfterMove_","updateToolboxStyle_","isEnd","VERSION","ALIGN_LEFT","ALIGN_CENTRE","ALIGN_RIGHT","DUMMY_INPUT","TOOLBOX_AT_TOP","TOOLBOX_AT_BOTTOM","TOOLBOX_AT_LEFT","TOOLBOX_AT_RIGHT","VARIABLE_CATEGORY_NAME","VARIABLE_DYNAMIC_CATEGORY_NAME","PROCEDURE_CATEGORY_NAME","Workspace.prototype.newBlock","WorkspaceSvg.prototype.newBlock","WorkspaceSvg.newTrashcan","WorkspaceCommentSvg.prototype.showContextMenu","Mutator.prototype.newWorkspaceSvg","Names.prototype.populateProcedures","procedures","flattenedProcedures","DropDownDiv","dropDownDiv","connectionTypes","serialization","serializationBlocks","exceptions","serializationExceptions","priorities","serializationPriorities","serializationRegistry","serializationVariables","serializationWorkspaces","ContextMenu","ContextMenuItems","Css","Events","Extensions","ShortcutItems","Themes","Tooltip","Touch","WidgetDiv","Xml","blockAnimations","blockRendering","bumpObjects","clipboard","common","dialog","fieldRegistry","geras","minimalist","thrasos","uiPosition","utils","zelos","Blockly","eventUtils","newAlert","newConfirm","newPrompt","HSV_SATURATION","HSV_VALUE","record","DIV"],"mappings":"A;;;;;;;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ockly_compressed.js","sourcesContent":["/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Touch handling for Blockly.\n *\n * @namespace Blockly.Touch\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Touch');\n\nimport type {Gesture} from './gesture.js';\n\n\n/**\n * A mock event, created from either a mouse or touch event,\n * with no more than one entry in the changedTouches array.\n */\ninterface PseudoEvent {\n type: string;\n changedTouches: Touch[];\n target: Element;\n stopPropagation: () => void;\n preventDefault: () => void;\n}\n\n/** Length in ms for a touch to become a long press. */\nconst LONGPRESS = 750;\n\n/**\n * Whether touch is enabled in the browser.\n * Copied from Closure's goog.events.BrowserFeature.TOUCH_ENABLED\n */\nexport const TOUCH_ENABLED = 'ontouchstart' in globalThis ||\n !!(globalThis['document'] && document.documentElement &&\n 'ontouchstart' in\n document.documentElement) || // IE10 uses non-standard touch events,\n // so it has a different check.\n !!(globalThis['navigator'] &&\n (globalThis['navigator']['maxTouchPoints'] ||\n (globalThis['navigator'] as any)['msMaxTouchPoints']));\n\n/** Which touch events are we currently paying attention to? */\nlet touchIdentifier_: string|null = null;\n\n/**\n * The TOUCH_MAP lookup dictionary specifies additional touch events to fire,\n * in conjunction with mouse events.\n *\n * @alias Blockly.Touch.TOUCH_MAP\n */\nexport const TOUCH_MAP: {[key: string]: string[]} = globalThis['PointerEvent'] ?\n {\n 'mousedown': ['pointerdown'],\n 'mouseenter': ['pointerenter'],\n 'mouseleave': ['pointerleave'],\n 'mousemove': ['pointermove'],\n 'mouseout': ['pointerout'],\n 'mouseover': ['pointerover'],\n 'mouseup': ['pointerup', 'pointercancel'],\n 'touchend': ['pointerup'],\n 'touchcancel': ['pointercancel'],\n } :\n {\n 'mousedown': ['touchstart'],\n 'mousemove': ['touchmove'],\n 'mouseup': ['touchend', 'touchcancel'],\n };\n\n/** PID of queued long-press task. */\nlet longPid_: AnyDuringMigration = 0;\n\n/**\n * Context menus on touch devices are activated using a long-press.\n * Unfortunately the contextmenu touch event is currently (2015) only supported\n * by Chrome. This function is fired on any touchstart event, queues a task,\n * which after about a second opens the context menu. The tasks is killed\n * if the touch event terminates early.\n *\n * @param e Touch start event.\n * @param gesture The gesture that triggered this longStart.\n * @alias Blockly.Touch.longStart\n * @internal\n */\nexport function longStart(e: Event, gesture: Gesture) {\n longStop();\n // Punt on multitouch events.\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'Event'.\n if ((e as AnyDuringMigration).changedTouches &&\n (e as AnyDuringMigration).changedTouches.length !== 1) {\n return;\n }\n longPid_ = setTimeout(function() {\n // TODO(#6097): Make types accurate, possibly by refactoring touch handling.\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'Event'.\n const typelessEvent = e as AnyDuringMigration;\n // Additional check to distinguish between touch events and pointer events\n if (typelessEvent.changedTouches) {\n // TouchEvent\n typelessEvent.button = 2; // Simulate a right button click.\n // e was a touch event. It needs to pretend to be a mouse event.\n typelessEvent.clientX = typelessEvent.changedTouches[0].clientX;\n typelessEvent.clientY = typelessEvent.changedTouches[0].clientY;\n }\n\n // Let the gesture route the right-click correctly.\n if (gesture) {\n gesture.handleRightClick(e);\n }\n }, LONGPRESS);\n}\n\n/**\n * Nope, that's not a long-press. Either touchend or touchcancel was fired,\n * or a drag hath begun. Kill the queued long-press task.\n *\n * @alias Blockly.Touch.longStop\n * @internal\n */\nexport function longStop() {\n if (longPid_) {\n clearTimeout(longPid_);\n longPid_ = 0;\n }\n}\n\n/**\n * Clear the touch identifier that tracks which touch stream to pay attention\n * to. This ends the current drag/gesture and allows other pointers to be\n * captured.\n *\n * @alias Blockly.Touch.clearTouchIdentifier\n */\nexport function clearTouchIdentifier() {\n touchIdentifier_ = null;\n}\n\n/**\n * Decide whether Blockly should handle or ignore this event.\n * Mouse and touch events require special checks because we only want to deal\n * with one touch stream at a time. All other events should always be handled.\n *\n * @param e The event to check.\n * @returns True if this event should be passed through to the registered\n * handler; false if it should be blocked.\n * @alias Blockly.Touch.shouldHandleEvent\n */\nexport function shouldHandleEvent(e: Event|PseudoEvent): boolean {\n return !isMouseOrTouchEvent(e) || checkTouchIdentifier(e);\n}\n\n/**\n * Get the touch identifier from the given event. If it was a mouse event, the\n * identifier is the string 'mouse'.\n *\n * @param e Pointer event, mouse event, or touch event.\n * @returns The pointerId, or touch identifier from the first changed touch, if\n * defined. Otherwise 'mouse'.\n * @alias Blockly.Touch.getTouchIdentifierFromEvent\n */\nexport function getTouchIdentifierFromEvent(e: Event|PseudoEvent): string {\n if (e instanceof PointerEvent) {\n return String(e.pointerId);\n }\n\n if (e instanceof MouseEvent) {\n return 'mouse';\n }\n\n /**\n * TODO(#6097): Fix types. This is a catch-all for everything but mouse\n * and pointer events.\n */\n const pseudoEvent = /** {!PseudoEvent} */ e;\n\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'PseudoEvent | Event'. AnyDuringMigration because: Property\n // 'changedTouches' does not exist on type 'PseudoEvent | Event'.\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'PseudoEvent | Event'. AnyDuringMigration because: Property\n // 'changedTouches' does not exist on type 'PseudoEvent | Event'.\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'PseudoEvent | Event'.\n return (pseudoEvent as AnyDuringMigration).changedTouches &&\n (pseudoEvent as AnyDuringMigration).changedTouches[0] &&\n (pseudoEvent as AnyDuringMigration).changedTouches[0].identifier !==\n undefined &&\n (pseudoEvent as AnyDuringMigration).changedTouches[0].identifier !==\n null ?\n String((pseudoEvent as AnyDuringMigration).changedTouches[0].identifier) :\n 'mouse';\n}\n\n/**\n * Check whether the touch identifier on the event matches the current saved\n * identifier. If there is no identifier, that means it's a mouse event and\n * we'll use the identifier \"mouse\". This means we won't deal well with\n * multiple mice being used at the same time. That seems okay.\n * If the current identifier was unset, save the identifier from the\n * event. This starts a drag/gesture, during which touch events with other\n * identifiers will be silently ignored.\n *\n * @param e Mouse event or touch event.\n * @returns Whether the identifier on the event matches the current saved\n * identifier.\n * @alias Blockly.Touch.checkTouchIdentifier\n */\nexport function checkTouchIdentifier(e: Event|PseudoEvent): boolean {\n const identifier = getTouchIdentifierFromEvent(e);\n\n // if (touchIdentifier_) is insufficient because Android touch\n // identifiers may be zero.\n if (touchIdentifier_ !== undefined && touchIdentifier_ !== null) {\n // We're already tracking some touch/mouse event. Is this from the same\n // source?\n return touchIdentifier_ === identifier;\n }\n if (e.type === 'mousedown' || e.type === 'touchstart' ||\n e.type === 'pointerdown') {\n // No identifier set yet, and this is the start of a drag. Set it and\n // return.\n touchIdentifier_ = identifier;\n return true;\n }\n // There was no identifier yet, but this wasn't a start event so we're going\n // to ignore it. This probably means that another drag finished while this\n // pointer was down.\n return false;\n}\n\n/**\n * Set an event's clientX and clientY from its first changed touch. Use this to\n * make a touch event work in a mouse event handler.\n *\n * @param e A touch event.\n * @alias Blockly.Touch.setClientFromTouch\n */\nexport function setClientFromTouch(e: Event|PseudoEvent) {\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'PseudoEvent | Event'.\n if (e.type.startsWith('touch') && (e as AnyDuringMigration).changedTouches) {\n // Map the touch event's properties to the event.\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'PseudoEvent | Event'.\n const touchPoint = (e as AnyDuringMigration).changedTouches[0];\n // AnyDuringMigration because: Property 'clientX' does not exist on type\n // 'PseudoEvent | Event'.\n (e as AnyDuringMigration).clientX = touchPoint.clientX;\n // AnyDuringMigration because: Property 'clientY' does not exist on type\n // 'PseudoEvent | Event'.\n (e as AnyDuringMigration).clientY = touchPoint.clientY;\n }\n}\n\n/**\n * Check whether a given event is a mouse, touch, or pointer event.\n *\n * @param e An event.\n * @returns True if it is a mouse, touch, or pointer event; false otherwise.\n * @alias Blockly.Touch.isMouseOrTouchEvent\n */\nexport function isMouseOrTouchEvent(e: Event|PseudoEvent): boolean {\n return e.type.startsWith('touch') || e.type.startsWith('mouse') ||\n e.type.startsWith('pointer');\n}\n\n/**\n * Check whether a given event is a touch event or a pointer event.\n *\n * @param e An event.\n * @returns True if it is a touch or pointer event; false otherwise.\n * @alias Blockly.Touch.isTouchEvent\n */\nexport function isTouchEvent(e: Event|PseudoEvent): boolean {\n return e.type.startsWith('touch') || e.type.startsWith('pointer');\n}\n\n/**\n * Split an event into an array of events, one per changed touch or mouse\n * point.\n *\n * @param e A mouse event or a touch event with one or more changed touches.\n * @returns An array of events or pseudo events.\n * Each pseudo-touch event will have exactly one changed touch and there\n * will be no real touch events.\n * @alias Blockly.Touch.splitEventByTouches\n */\nexport function splitEventByTouches(e: Event): Array<Event|PseudoEvent> {\n const events = [];\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'PseudoEvent | Event'.\n if ((e as AnyDuringMigration).changedTouches) {\n // AnyDuringMigration because: Property 'changedTouches' does not exist on\n // type 'PseudoEvent | Event'.\n for (let i = 0; i < (e as AnyDuringMigration).changedTouches.length; i++) {\n const newEvent = {\n type: e.type,\n // AnyDuringMigration because: Property 'changedTouches' does not exist\n // on type 'PseudoEvent | Event'.\n changedTouches: [(e as AnyDuringMigration).changedTouches[i]],\n target: e.target,\n stopPropagation() {\n e.stopPropagation();\n },\n preventDefault() {\n e.preventDefault();\n },\n };\n events[i] = newEvent;\n }\n } else {\n events.push(e);\n }\n // AnyDuringMigration because: Type '(Event | { type: string; changedTouches:\n // Touch[]; target: EventTarget | null; stopPropagation(): void;\n // preventDefault(): void; })[]' is not assignable to type '(PseudoEvent |\n // Event)[]'.\n return events as AnyDuringMigration;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Browser event handling.\n *\n * @namespace Blockly.browserEvents\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.browserEvents');\n\nimport * as Touch from './touch.js';\nimport * as userAgent from './utils/useragent.js';\n\n\n/**\n * Blockly opaque event data used to unbind events when using\n * `bind` and `conditionalBind`.\n *\n * @alias Blockly.browserEvents.Data\n */\nexport type Data = [EventTarget, string, (e: Event) => void][];\n\n/**\n * The multiplier for scroll wheel deltas using the line delta mode.\n * See https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode\n * for more information on deltaMode.\n */\nconst LINE_MODE_MULTIPLIER = 40;\n\n/**\n * The multiplier for scroll wheel deltas using the page delta mode.\n * See https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode\n * for more information on deltaMode.\n */\nconst PAGE_MODE_MULTIPLIER = 125;\n\n/**\n * Bind an event handler that can be ignored if it is not part of the active\n * touch stream.\n * Use this for events that either start or continue a multi-part gesture (e.g.\n * mousedown or mousemove, which may be part of a drag or click).\n *\n * @param node Node upon which to listen.\n * @param name Event name to listen to (e.g. 'mousedown').\n * @param thisObject The value of 'this' in the function.\n * @param func Function to call when event is triggered.\n * @param opt_noCaptureIdentifier True if triggering on this event should not\n * block execution of other event handlers on this touch or other\n * simultaneous touches. False by default.\n * @param opt_noPreventDefault True if triggering on this event should prevent\n * the default handler. False by default. If opt_noPreventDefault is\n * provided, opt_noCaptureIdentifier must also be provided.\n * @returns Opaque data that can be passed to unbindEvent_.\n * @alias Blockly.browserEvents.conditionalBind\n */\nexport function conditionalBind(\n node: EventTarget, name: string, thisObject: Object|null, func: Function,\n opt_noCaptureIdentifier?: boolean, opt_noPreventDefault?: boolean): Data {\n let handled = false;\n /**\n *\n * @param e\n */\n function wrapFunc(e: Event) {\n const captureIdentifier = !opt_noCaptureIdentifier;\n // Handle each touch point separately. If the event was a mouse event, this\n // will hand back an array with one element, which we're fine handling.\n const events = Touch.splitEventByTouches(e);\n for (let i = 0; i < events.length; i++) {\n const event = events[i];\n if (captureIdentifier && !Touch.shouldHandleEvent(event)) {\n continue;\n }\n Touch.setClientFromTouch(event);\n if (thisObject) {\n func.call(thisObject, event);\n } else {\n func(event);\n }\n handled = true;\n }\n }\n\n const bindData: Data = [];\n if (globalThis['PointerEvent'] && name in Touch.TOUCH_MAP) {\n for (let i = 0; i < Touch.TOUCH_MAP[name].length; i++) {\n const type = Touch.TOUCH_MAP[name][i];\n node.addEventListener(type, wrapFunc, false);\n bindData.push([node, type, wrapFunc]);\n }\n } else {\n node.addEventListener(name, wrapFunc, false);\n bindData.push([node, name, wrapFunc]);\n\n // Add equivalent touch event.\n if (name in Touch.TOUCH_MAP) {\n const touchWrapFunc = (e: Event) => {\n wrapFunc(e);\n // Calling preventDefault stops the browser from scrolling/zooming the\n // page.\n const preventDef = !opt_noPreventDefault;\n if (handled && preventDef) {\n e.preventDefault();\n }\n };\n for (let i = 0; i < Touch.TOUCH_MAP[name].length; i++) {\n const type = Touch.TOUCH_MAP[name][i];\n node.addEventListener(type, touchWrapFunc, false);\n bindData.push([node, type, touchWrapFunc]);\n }\n }\n }\n return bindData;\n}\n\n/**\n * Bind an event handler that should be called regardless of whether it is part\n * of the active touch stream.\n * Use this for events that are not part of a multi-part gesture (e.g.\n * mouseover for tooltips).\n *\n * @param node Node upon which to listen.\n * @param name Event name to listen to (e.g. 'mousedown').\n * @param thisObject The value of 'this' in the function.\n * @param func Function to call when event is triggered.\n * @returns Opaque data that can be passed to unbindEvent_.\n * @alias Blockly.browserEvents.bind\n */\nexport function bind(\n node: EventTarget, name: string, thisObject: Object|null,\n func: Function): Data {\n /**\n *\n * @param e\n */\n function wrapFunc(e: Event) {\n if (thisObject) {\n func.call(thisObject, e);\n } else {\n func(e);\n }\n }\n\n const bindData: Data = [];\n if (globalThis['PointerEvent'] && name in Touch.TOUCH_MAP) {\n for (let i = 0; i < Touch.TOUCH_MAP[name].length; i++) {\n const type = Touch.TOUCH_MAP[name][i];\n node.addEventListener(type, wrapFunc, false);\n bindData.push([node, type, wrapFunc]);\n }\n } else {\n node.addEventListener(name, wrapFunc, false);\n bindData.push([node, name, wrapFunc]);\n\n // Add equivalent touch event.\n if (name in Touch.TOUCH_MAP) {\n const touchWrapFunc = (e: Event) => {\n // Punt on multitouch events.\n if (e instanceof TouchEvent && e.changedTouches &&\n e.changedTouches.length === 1) {\n // Map the touch event's properties to the event.\n const touchPoint = e.changedTouches[0];\n // TODO (6311): We are trying to make a touch event look like a mouse\n // event, which is not allowed, because it requires adding more\n // properties to the event. How do we want to deal with this?\n (e as AnyDuringMigration).clientX = touchPoint.clientX;\n (e as AnyDuringMigration).clientY = touchPoint.clientY;\n }\n wrapFunc(e);\n\n // Stop the browser from scrolling/zooming the page.\n e.preventDefault();\n };\n for (let i = 0; i < Touch.TOUCH_MAP[name].length; i++) {\n const type = Touch.TOUCH_MAP[name][i];\n node.addEventListener(type, touchWrapFunc, false);\n bindData.push([node, type, touchWrapFunc]);\n }\n }\n }\n return bindData;\n}\n\n/**\n * Unbind one or more events event from a function call.\n *\n * @param bindData Opaque data from bindEvent_.\n * This list is emptied during the course of calling this function.\n * @returns The function call.\n * @alias Blockly.browserEvents.unbind\n */\nexport function unbind(bindData: Data): (e: Event) => void {\n // Accessing an element of the last property of the array is unsafe if the\n // bindData is an empty array. But that should never happen because developers\n // should only pass Data from bind or conditionalBind.\n const callback = bindData[bindData.length - 1][2];\n while (bindData.length) {\n const bindDatum = bindData.pop();\n const node = bindDatum![0];\n const name = bindDatum![1];\n const func = bindDatum![2];\n node.removeEventListener(name, func, false);\n }\n return callback;\n}\n\n/**\n * Returns true if this event is targeting a text input widget?\n *\n * @param e An event.\n * @returns True if text input.\n * @alias Blockly.browserEvents.isTargetInput\n */\nexport function isTargetInput(e: Event): boolean {\n if (e.target instanceof HTMLElement) {\n if (e.target.isContentEditable ||\n e.target.getAttribute('data-is-text-input') === 'true') {\n return true;\n }\n\n if (e.target instanceof HTMLInputElement) {\n const target = e.target;\n return target.type === 'text' || target.type === 'number' ||\n target.type === 'email' || target.type === 'password' ||\n target.type === 'search' || target.type === 'tel' ||\n target.type === 'url';\n }\n\n if (e.target instanceof HTMLTextAreaElement) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns true this event is a right-click.\n *\n * @param e Mouse event.\n * @returns True if right-click.\n * @alias Blockly.browserEvents.isRightButton\n */\nexport function isRightButton(e: MouseEvent): boolean {\n if (e.ctrlKey && userAgent.MAC) {\n // Control-clicking on Mac OS X is treated as a right-click.\n // WebKit on Mac OS X fails to change button to 2 (but Gecko does).\n return true;\n }\n return e.button === 2;\n}\n\n/**\n * Returns the converted coordinates of the given mouse event.\n * The origin (0,0) is the top-left corner of the Blockly SVG.\n *\n * @param e Mouse event.\n * @param svg SVG element.\n * @param matrix Inverted screen CTM to use.\n * @returns Object with .x and .y properties.\n * @alias Blockly.browserEvents.mouseToSvg\n */\nexport function mouseToSvg(\n e: MouseEvent, svg: SVGSVGElement, matrix: SVGMatrix|null): SVGPoint {\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = e.clientX;\n svgPoint.y = e.clientY;\n\n if (!matrix) {\n matrix = svg.getScreenCTM()!.inverse();\n }\n return svgPoint.matrixTransform(matrix);\n}\n\n/**\n * Returns the scroll delta of a mouse event in pixel units.\n *\n * @param e Mouse event.\n * @returns Scroll delta object with .x and .y properties.\n * @alias Blockly.browserEvents.getScrollDeltaPixels\n */\nexport function getScrollDeltaPixels(e: WheelEvent): {x: number, y: number} {\n switch (e.deltaMode) {\n case 0x00: // Pixel mode.\n default:\n return {x: e.deltaX, y: e.deltaY};\n case 0x01: // Line mode.\n return {\n x: e.deltaX * LINE_MODE_MULTIPLIER,\n y: e.deltaY * LINE_MODE_MULTIPLIER,\n };\n case 0x02: // Page mode.\n return {\n x: e.deltaX * PAGE_MODE_MULTIPLIER,\n y: e.deltaY * PAGE_MODE_MULTIPLIER,\n };\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Common functions used both internally and externally, but which\n * must not be at the top level to avoid circular dependencies.\n *\n * @namespace Blockly.common\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.common');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Block} from './block.js';\nimport {BlockDefinition, Blocks} from './blocks.js';\nimport type {Connection} from './connection.js';\nimport type {ICopyable} from './interfaces/i_copyable.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/** Database of all workspaces. */\nconst WorkspaceDB_ = Object.create(null);\n\n\n/**\n * Find the workspace with the specified ID.\n *\n * @param id ID of workspace to find.\n * @returns The sought after workspace or null if not found.\n */\nexport function getWorkspaceById(id: string): Workspace|null {\n return WorkspaceDB_[id] || null;\n}\n\n/**\n * Find all workspaces.\n *\n * @returns Array of workspaces.\n */\nexport function getAllWorkspaces(): Workspace[] {\n const workspaces = [];\n for (const workspaceId in WorkspaceDB_) {\n workspaces.push(WorkspaceDB_[workspaceId]);\n }\n return workspaces;\n}\n\n/**\n * Register a workspace in the workspace db.\n *\n * @param workspace\n */\nexport function registerWorkspace(workspace: Workspace) {\n WorkspaceDB_[workspace.id] = workspace;\n}\n\n/**\n * Unregister a workspace from the workspace db.\n *\n * @param workspace\n */\nexport function unregisterWorkpace(workspace: Workspace) {\n delete WorkspaceDB_[workspace.id];\n}\n\n/**\n * The main workspace most recently used.\n * Set by Blockly.WorkspaceSvg.prototype.markFocused\n */\nlet mainWorkspace: Workspace;\n\n/**\n * Returns the last used top level workspace (based on focus). Try not to use\n * this function, particularly if there are multiple Blockly instances on a\n * page.\n *\n * @returns The main workspace.\n * @alias Blockly.common.getMainWorkspace\n */\nexport function getMainWorkspace(): Workspace {\n return mainWorkspace;\n}\n\n/**\n * Sets last used main workspace.\n *\n * @param workspace The most recently used top level workspace.\n * @alias Blockly.common.setMainWorkspace\n */\nexport function setMainWorkspace(workspace: Workspace) {\n mainWorkspace = workspace;\n}\n\n/**\n * Currently selected copyable object.\n */\nlet selected: ICopyable|null = null;\n\n/**\n * Returns the currently selected copyable object.\n *\n * @alias Blockly.common.getSelected\n */\nexport function getSelected(): ICopyable|null {\n return selected;\n}\n\n/**\n * Sets the currently selected block. This function does not visually mark the\n * block as selected or fire the required events. If you wish to\n * programmatically select a block, use `BlockSvg#select`.\n *\n * @param newSelection The newly selected block.\n * @alias Blockly.common.setSelected\n * @internal\n */\nexport function setSelected(newSelection: ICopyable|null) {\n selected = newSelection;\n}\n\n/**\n * Container element in which to render the WidgetDiv, DropDownDiv and Tooltip.\n */\nlet parentContainer: Element|null;\n\n/**\n * Get the container element in which to render the WidgetDiv, DropDownDiv and\n * Tooltip.\n *\n * @returns The parent container.\n * @alias Blockly.common.getParentContainer\n */\nexport function getParentContainer(): Element|null {\n return parentContainer;\n}\n\n/**\n * Set the parent container. This is the container element that the WidgetDiv,\n * DropDownDiv, and Tooltip are rendered into the first time `Blockly.inject`\n * is called.\n * This method is a NOP if called after the first `Blockly.inject`.\n *\n * @param newParent The container element.\n * @alias Blockly.common.setParentContainer\n */\nexport function setParentContainer(newParent: Element) {\n parentContainer = newParent;\n}\n\n/**\n * Size the SVG image to completely fill its container. Call this when the view\n * actually changes sizes (e.g. on a window resize/device orientation change).\n * See workspace.resizeContents to resize the workspace when the contents\n * change (e.g. when a block is added or removed).\n * Record the height/width of the SVG image.\n *\n * @param workspace Any workspace in the SVG.\n * @alias Blockly.common.svgResize\n */\nexport function svgResize(workspace: WorkspaceSvg) {\n let mainWorkspace = workspace;\n while (mainWorkspace.options.parentWorkspace) {\n mainWorkspace = mainWorkspace.options.parentWorkspace;\n }\n const svg = mainWorkspace.getParentSvg();\n const cachedSize = mainWorkspace.getCachedParentSvgSize();\n const div = svg.parentElement;\n if (!(div instanceof HTMLElement)) {\n // Workspace deleted, or something.\n return;\n }\n\n const width = div.offsetWidth;\n const height = div.offsetHeight;\n if (cachedSize.width !== width) {\n svg.setAttribute('width', width + 'px');\n mainWorkspace.setCachedParentSvgSize(width, null);\n }\n if (cachedSize.height !== height) {\n svg.setAttribute('height', height + 'px');\n mainWorkspace.setCachedParentSvgSize(null, height);\n }\n mainWorkspace.resize();\n}\n\n/**\n * All of the connections on blocks that are currently being dragged.\n */\nexport const draggingConnections: Connection[] = [];\n\n/**\n * Get a map of all the block's descendants mapping their type to the number of\n * children with that type.\n *\n * @param block The block to map.\n * @param opt_stripFollowing Optionally ignore all following\n * statements (blocks that are not inside a value or statement input\n * of the block).\n * @returns Map of types to type counts for descendants of the bock.\n * @alias Blockly.common.getBlockTypeCounts\n */\nexport function getBlockTypeCounts(\n block: Block, opt_stripFollowing?: boolean): {[key: string]: number} {\n const typeCountsMap = Object.create(null);\n const descendants = block.getDescendants(true);\n if (opt_stripFollowing) {\n const nextBlock = block.getNextBlock();\n if (nextBlock) {\n const index = descendants.indexOf(nextBlock);\n descendants.splice(index, descendants.length - index);\n }\n }\n for (let i = 0, checkBlock; checkBlock = descendants[i]; i++) {\n if (typeCountsMap[checkBlock.type]) {\n typeCountsMap[checkBlock.type]++;\n } else {\n typeCountsMap[checkBlock.type] = 1;\n }\n }\n return typeCountsMap;\n}\n\n/**\n * Helper function for defining a block from JSON. The resulting function has\n * the correct value of jsonDef at the point in code where jsonInit is called.\n *\n * @param jsonDef The JSON definition of a block.\n * @returns A function that calls jsonInit with the correct value\n * of jsonDef.\n */\nfunction jsonInitFactory(jsonDef: AnyDuringMigration): () => void {\n return function(this: Block) {\n this.jsonInit(jsonDef);\n };\n}\n\n/**\n * Define blocks from an array of JSON block definitions, as might be generated\n * by the Blockly Developer Tools.\n *\n * @param jsonArray An array of JSON block definitions.\n * @alias Blockly.common.defineBlocksWithJsonArray\n */\nexport function defineBlocksWithJsonArray(jsonArray: AnyDuringMigration[]) {\n TEST_ONLY.defineBlocksWithJsonArrayInternal(jsonArray);\n}\n\n/**\n * Private version of defineBlocksWithJsonArray for stubbing in tests.\n */\nfunction defineBlocksWithJsonArrayInternal(jsonArray: AnyDuringMigration[]) {\n defineBlocks(createBlockDefinitionsFromJsonArray(jsonArray));\n}\n\n/**\n * Define blocks from an array of JSON block definitions, as might be generated\n * by the Blockly Developer Tools.\n *\n * @param jsonArray An array of JSON block definitions.\n * @returns A map of the block\n * definitions created.\n * @alias Blockly.common.defineBlocksWithJsonArray\n */\nexport function createBlockDefinitionsFromJsonArray(\n jsonArray: AnyDuringMigration[]): {[key: string]: BlockDefinition} {\n const blocks: {[key: string]: BlockDefinition} = {};\n for (let i = 0; i < jsonArray.length; i++) {\n const elem = jsonArray[i];\n if (!elem) {\n console.warn(`Block definition #${i} in JSON array is ${elem}. Skipping`);\n continue;\n }\n const type = elem['type'];\n if (!type) {\n console.warn(\n `Block definition #${i} in JSON array is missing a type attribute. ` +\n 'Skipping.');\n continue;\n }\n blocks[type] = {init: jsonInitFactory(elem)};\n }\n return blocks;\n}\n\n/**\n * Add the specified block definitions to the block definitions\n * dictionary (Blockly.Blocks).\n *\n * @param blocks A map of block\n * type names to block definitions.\n * @alias Blockly.common.defineBlocks\n */\nexport function defineBlocks(blocks: {[key: string]: BlockDefinition}) {\n // Iterate over own enumerable properties.\n for (const type of Object.keys(blocks)) {\n const definition = blocks[type];\n if (type in Blocks) {\n console.warn(`Block definiton \"${type}\" overwrites previous definition.`);\n }\n Blocks[type] = definition;\n }\n}\n\nexport const TEST_ONLY = {defineBlocksWithJsonArrayInternal};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for DOM manipulation.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.dom\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.dom');\n\nimport type {Svg} from './svg.js';\n\n\n/**\n * Required name space for SVG elements.\n *\n * @alias Blockly.utils.dom.SVG_NS\n */\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * Required name space for HTML elements.\n *\n * @alias Blockly.utils.dom.HTML_NS\n */\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\n\n/**\n * Required name space for XLINK elements.\n *\n * @alias Blockly.utils.dom.XLINK_NS\n */\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\n\n/**\n * Node type constants.\n * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\n *\n * @alias Blockly.utils.dom.NodeType\n */\nexport enum NodeType {\n ELEMENT_NODE = 1,\n TEXT_NODE = 3,\n COMMENT_NODE = 8,\n DOCUMENT_POSITION_CONTAINED_BY = 16\n}\n\n/** Temporary cache of text widths. */\nlet cacheWidths: {[key: string]: number}|null = null;\n\n/** Number of current references to cache. */\nlet cacheReference = 0;\n\n/** A HTML canvas context used for computing text width. */\nlet canvasContext: CanvasRenderingContext2D|null = null;\n\n/**\n * Helper method for creating SVG elements.\n *\n * @param name Element's tag name.\n * @param attrs Dictionary of attribute names and values.\n * @param opt_parent Optional parent on which to append the element.\n * @returns if name is a string or a more specific type if it a member of Svg.\n * @alias Blockly.utils.dom.createSvgElement\n */\nexport function createSvgElement<T extends SVGElement>(\n name: string|Svg<T>, attrs: {[key: string]: string|number},\n opt_parent?: Element|null): T {\n const e = document.createElementNS(SVG_NS, String(name)) as T;\n for (const key in attrs) {\n e.setAttribute(key, `${attrs[key]}`);\n }\n if (opt_parent) {\n opt_parent.appendChild(e);\n }\n return e;\n}\n\n/**\n * Add a CSS class to a element.\n *\n * Handles multiple space-separated classes for legacy reasons.\n *\n * @param element DOM element to add class to.\n * @param className Name of class to add.\n * @returns True if class was added, false if already present.\n * @alias Blockly.utils.dom.addClass\n */\nexport function addClass(element: Element, className: string): boolean {\n const classNames = className.split(' ');\n if (classNames.every((name) => element.classList.contains(name))) {\n return false;\n }\n element.classList.add(...classNames);\n return true;\n}\n\n/**\n * Removes multiple classes from an element.\n *\n * @param element DOM element to remove classes from.\n * @param classNames A string of one or multiple class names for an element.\n * @alias Blockly.utils.dom.removeClasses\n */\nexport function removeClasses(element: Element, classNames: string) {\n element.classList.remove(...classNames.split(' '));\n}\n\n/**\n * Remove a CSS class from a element.\n *\n * Handles multiple space-separated classes for legacy reasons.\n *\n * @param element DOM element to remove class from.\n * @param className Name of class to remove.\n * @returns True if class was removed, false if never present.\n * @alias Blockly.utils.dom.removeClass\n */\nexport function removeClass(element: Element, className: string): boolean {\n const classNames = className.split(' ');\n if (classNames.every((name) => !element.classList.contains(name))) {\n return false;\n }\n element.classList.remove(...classNames);\n return true;\n}\n\n/**\n * Checks if an element has the specified CSS class.\n *\n * @param element DOM element to check.\n * @param className Name of class to check.\n * @returns True if class exists, false otherwise.\n * @alias Blockly.utils.dom.hasClass\n */\nexport function hasClass(element: Element, className: string): boolean {\n return element.classList.contains(className);\n}\n\n/**\n * Removes a node from its parent. No-op if not attached to a parent.\n *\n * @param node The node to remove.\n * @returns The node removed if removed; else, null.\n * @alias Blockly.utils.dom.removeNode\n */\n// Copied from Closure goog.dom.removeNode\nexport function removeNode(node: Node|null): Node|null {\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\n}\n\n/**\n * Insert a node after a reference node.\n * Contrast with node.insertBefore function.\n *\n * @param newNode New element to insert.\n * @param refNode Existing element to precede new node.\n * @alias Blockly.utils.dom.insertAfter\n */\nexport function insertAfter(newNode: Element, refNode: Element) {\n const siblingNode = refNode.nextSibling;\n const parentNode = refNode.parentNode;\n if (!parentNode) {\n throw Error('Reference node has no parent.');\n }\n if (siblingNode) {\n parentNode.insertBefore(newNode, siblingNode);\n } else {\n parentNode.appendChild(newNode);\n }\n}\n\n/**\n * Whether a node contains another node.\n *\n * @param parent The node that should contain the other node.\n * @param descendant The node to test presence of.\n * @returns Whether the parent node contains the descendant node.\n * @alias Blockly.utils.dom.containsNode\n */\nexport function containsNode(parent: Node, descendant: Node): boolean {\n return !!(\n parent.compareDocumentPosition(descendant) &\n NodeType.DOCUMENT_POSITION_CONTAINED_BY);\n}\n\n/**\n * Sets the CSS transform property on an element. This function sets the\n * non-vendor-prefixed and vendor-prefixed versions for backwards compatibility\n * with older browsers. See https://caniuse.com/#feat=transforms2d\n *\n * @param element Element to which the CSS transform will be applied.\n * @param transform The value of the CSS `transform` property.\n * @alias Blockly.utils.dom.setCssTransform\n */\nexport function setCssTransform(\n element: HTMLElement|SVGElement, transform: string) {\n element.style['transform'] = transform;\n element.style['-webkit-transform' as any] = transform;\n}\n\n/**\n * Start caching text widths. Every call to this function MUST also call\n * stopTextWidthCache. Caches must not survive between execution threads.\n *\n * @alias Blockly.utils.dom.startTextWidthCache\n */\nexport function startTextWidthCache() {\n cacheReference++;\n if (!cacheWidths) {\n cacheWidths = Object.create(null);\n }\n}\n\n/**\n * Stop caching field widths. Unless caching was already on when the\n * corresponding call to startTextWidthCache was made.\n *\n * @alias Blockly.utils.dom.stopTextWidthCache\n */\nexport function stopTextWidthCache() {\n cacheReference--;\n if (!cacheReference) {\n cacheWidths = null;\n }\n}\n\n/**\n * Gets the width of a text element, caching it in the process.\n *\n * @param textElement An SVG 'text' element.\n * @returns Width of element.\n * @alias Blockly.utils.dom.getTextWidth\n */\nexport function getTextWidth(textElement: SVGTextElement): number {\n const key = textElement.textContent + '\\n' + textElement.className.baseVal;\n let width;\n // Return the cached width if it exists.\n if (cacheWidths) {\n width = cacheWidths[key];\n if (width) {\n return width;\n }\n }\n\n // Attempt to compute fetch the width of the SVG text element.\n try {\n width = textElement.getComputedTextLength();\n } catch (e) {\n // In other cases where we fail to get the computed text. Instead, use an\n // approximation and do not cache the result. At some later point in time\n // when the block is inserted into the visible DOM, this method will be\n // called again and, at that point in time, will not throw an exception.\n return textElement.textContent!.length * 8;\n }\n\n // Cache the computed width and return.\n if (cacheWidths) {\n cacheWidths[key] = width;\n }\n return width;\n}\n\n/**\n * Gets the width of a text element using a faster method than `getTextWidth`.\n * This method requires that we know the text element's font family and size in\n * advance. Similar to `getTextWidth`, we cache the width we compute.\n *\n * @param textElement An SVG 'text' element.\n * @param fontSize The font size to use.\n * @param fontWeight The font weight to use.\n * @param fontFamily The font family to use.\n * @returns Width of element.\n * @alias Blockly.utils.dom.getFastTextWidth\n */\nexport function getFastTextWidth(\n textElement: SVGTextElement, fontSize: number, fontWeight: string,\n fontFamily: string): number {\n return getFastTextWidthWithSizeString(\n textElement, fontSize + 'pt', fontWeight, fontFamily);\n}\n\n/**\n * Gets the width of a text element using a faster method than `getTextWidth`.\n * This method requires that we know the text element's font family and size in\n * advance. Similar to `getTextWidth`, we cache the width we compute.\n * This method is similar to `getFastTextWidth` but expects the font size\n * parameter to be a string.\n *\n * @param textElement An SVG 'text' element.\n * @param fontSize The font size to use.\n * @param fontWeight The font weight to use.\n * @param fontFamily The font family to use.\n * @returns Width of element.\n * @alias Blockly.utils.dom.getFastTextWidthWithSizeString\n */\nexport function getFastTextWidthWithSizeString(\n textElement: SVGTextElement, fontSize: string, fontWeight: string,\n fontFamily: string): number {\n const text = textElement.textContent;\n const key = text + '\\n' + textElement.className.baseVal;\n let width;\n\n // Return the cached width if it exists.\n if (cacheWidths) {\n width = cacheWidths[key];\n if (width) {\n return width;\n }\n }\n\n if (!canvasContext) {\n // Inject the canvas element used for computing text widths.\n const computeCanvas = (document.createElement('canvas'));\n computeCanvas.className = 'blocklyComputeCanvas';\n document.body.appendChild(computeCanvas);\n\n // Initialize the HTML canvas context and set the font.\n // The context font must match blocklyText's fontsize and font-family\n // set in CSS.\n canvasContext = computeCanvas.getContext('2d') as CanvasRenderingContext2D;\n }\n // Set the desired font size and family.\n canvasContext.font = fontWeight + ' ' + fontSize + ' ' + fontFamily;\n\n // Measure the text width using the helper canvas context.\n if (text) {\n width = canvasContext.measureText(text).width;\n } else {\n width = 0;\n }\n\n // Cache the computed width and return.\n if (cacheWidths) {\n cacheWidths[key] = width;\n }\n return width;\n}\n\n/**\n * Measure a font's metrics. The height and baseline values.\n *\n * @param text Text to measure the font dimensions of.\n * @param fontSize The font size to use.\n * @param fontWeight The font weight to use.\n * @param fontFamily The font family to use.\n * @returns Font measurements.\n * @alias Blockly.utils.dom.measureFontMetrics\n */\nexport function measureFontMetrics(\n text: string, fontSize: string, fontWeight: string,\n fontFamily: string): {height: number, baseline: number} {\n const span = (document.createElement('span'));\n span.style.font = fontWeight + ' ' + fontSize + ' ' + fontFamily;\n span.textContent = text;\n\n const block = (document.createElement('div'));\n block.style.width = '1px';\n block.style.height = '0';\n\n const div = (document.createElement('div'));\n div.setAttribute('style', 'position: fixed; top: 0; left: 0; display: flex;');\n div.appendChild(span);\n div.appendChild(block);\n\n document.body.appendChild(div);\n const result = {\n height: 0,\n baseline: 0,\n };\n try {\n div.style.alignItems = 'baseline';\n result.baseline = block.offsetTop - span.offsetTop;\n div.style.alignItems = 'flex-end';\n result.height = block.offsetTop - span.offsetTop;\n } finally {\n document.body.removeChild(div);\n }\n return result;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for math.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.math\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.math');\n\n\n/**\n * Converts degrees to radians.\n * Copied from Closure's goog.math.toRadians.\n *\n * @param angleDegrees Angle in degrees.\n * @returns Angle in radians.\n * @alias Blockly.utils.math.toRadians\n */\nexport function toRadians(angleDegrees: number): number {\n return angleDegrees * Math.PI / 180;\n}\n\n/**\n * Converts radians to degrees.\n * Copied from Closure's goog.math.toDegrees.\n *\n * @param angleRadians Angle in radians.\n * @returns Angle in degrees.\n * @alias Blockly.utils.math.toDegrees\n */\nexport function toDegrees(angleRadians: number): number {\n return angleRadians * 180 / Math.PI;\n}\n\n/**\n * Clamp the provided number between the lower bound and the upper bound.\n *\n * @param lowerBound The desired lower bound.\n * @param number The number to clamp.\n * @param upperBound The desired upper bound.\n * @returns The clamped number.\n * @alias Blockly.utils.math.clamp\n */\nexport function clamp(\n lowerBound: number, number: number, upperBound: number): number {\n if (upperBound < lowerBound) {\n const temp = upperBound;\n upperBound = lowerBound;\n lowerBound = temp;\n }\n return Math.max(lowerBound, Math.min(number, upperBound));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Helper function for warning developers about deprecations.\n * This method is not specific to Blockly.\n *\n * @namespace Blockly.utils.deprecation\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.deprecation');\n\n\n/**\n * Warn developers that a function or property is deprecated.\n *\n * @param name The name of the function or property.\n * @param deprecationDate The date of deprecation. Prefer 'version n.0.0'\n * format, and fall back to 'month yyyy' or 'quarter yyyy' format.\n * @param deletionDate The date of deletion. Prefer 'version n.0.0'\n * format, and fall back to 'month yyyy' or 'quarter yyyy' format.\n * @param opt_use The name of a function or property to use instead, if any.\n * @alias Blockly.utils.deprecation.warn\n * @internal\n */\nexport function warn(\n name: string, deprecationDate: string, deletionDate: string,\n opt_use?: string) {\n let msg = name + ' was deprecated in ' + deprecationDate +\n ' and will be deleted in ' + deletionDate + '.';\n if (opt_use) {\n msg += '\\nUse ' + opt_use + ' instead.';\n }\n console.warn(msg);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utilities for element styles.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.style\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.style');\n\nimport * as deprecation from './deprecation.js';\nimport {Coordinate} from './coordinate.js';\nimport {Rect} from './rect.js';\nimport {Size} from './size.js';\n\n\n/**\n * Gets the height and width of an element.\n * Similar to Closure's goog.style.getSize\n *\n * @param element Element to get size of.\n * @returns Object with width/height properties.\n * @alias Blockly.utils.style.getSize\n */\nexport function getSize(element: Element): Size {\n return TEST_ONLY.getSizeInternal(element);\n}\n\n/**\n * Private version of getSize for stubbing in tests.\n */\nfunction getSizeInternal(element: Element): Size {\n if (getComputedStyle(element, 'display') !== 'none') {\n return getSizeWithDisplay(element);\n }\n\n // Evaluate size with a temporary element.\n // AnyDuringMigration because: Property 'style' does not exist on type\n // 'Element'.\n const style = (element as AnyDuringMigration).style;\n const originalDisplay = style.display;\n const originalVisibility = style.visibility;\n const originalPosition = style.position;\n\n style.visibility = 'hidden';\n style.position = 'absolute';\n style.display = 'inline';\n\n const offsetWidth = (element as HTMLElement).offsetWidth;\n const offsetHeight = (element as HTMLElement).offsetHeight;\n\n style.display = originalDisplay;\n style.position = originalPosition;\n style.visibility = originalVisibility;\n\n return new Size(offsetWidth, offsetHeight);\n}\n\n/**\n * Gets the height and width of an element when the display is not none.\n *\n * @param element Element to get size of.\n * @returns Object with width/height properties.\n */\nfunction getSizeWithDisplay(element: Element): Size {\n const offsetWidth = (element as HTMLElement).offsetWidth;\n const offsetHeight = (element as HTMLElement).offsetHeight;\n return new Size(offsetWidth, offsetHeight);\n}\n\n/**\n * Retrieves a computed style value of a node. It returns empty string\n * if the property requested is an SVG one and it has not been\n * explicitly set (firefox and webkit).\n *\n * Copied from Closure's goog.style.getComputedStyle\n *\n * @param element Element to get style of.\n * @param property Property to get (camel-case).\n * @returns Style value.\n * @alias Blockly.utils.style.getComputedStyle\n */\nexport function getComputedStyle(element: Element, property: string): string {\n const styles = window.getComputedStyle(element);\n // element.style[..] is undefined for browser specific styles\n // as 'filter'.\n return (styles as AnyDuringMigration)[property] ||\n styles.getPropertyValue(property);\n}\n\n/**\n * Gets the cascaded style value of a node, or null if the value cannot be\n * computed (only Internet Explorer can do this).\n *\n * Copied from Closure's goog.style.getCascadedStyle\n *\n * @param element Element to get style of.\n * @param style Property to get (camel-case).\n * @returns Style value.\n * @deprecated No longer provided by Blockly.\n * @alias Blockly.utils.style.getCascadedStyle\n */\nexport function getCascadedStyle(element: Element, style: string): string {\n deprecation.warn(\n 'Blockly.utils.style.getCascadedStyle', 'version 9', 'version 10');\n // AnyDuringMigration because: Property 'currentStyle' does not exist on type\n // 'Element'. AnyDuringMigration because: Property 'currentStyle' does not\n // exist on type 'Element'.\n return (element as AnyDuringMigration).currentStyle ?\n (element as AnyDuringMigration).currentStyle[style] :\n '' as string;\n}\n\n/**\n * Returns a Coordinate object relative to the top-left of the HTML document.\n * Similar to Closure's goog.style.getPageOffset\n *\n * @param el Element to get the page offset for.\n * @returns The page offset.\n * @alias Blockly.utils.style.getPageOffset\n */\nexport function getPageOffset(el: Element): Coordinate {\n const pos = new Coordinate(0, 0);\n const box = el.getBoundingClientRect();\n const documentElement = document.documentElement;\n // Must add the scroll coordinates in to get the absolute page offset\n // of element since getBoundingClientRect returns relative coordinates to\n // the viewport.\n const scrollCoord = new Coordinate(\n window.pageXOffset || documentElement.scrollLeft,\n window.pageYOffset || documentElement.scrollTop);\n pos.x = box.left + scrollCoord.x;\n pos.y = box.top + scrollCoord.y;\n\n return pos;\n}\n\n/**\n * Calculates the viewport coordinates relative to the document.\n * Similar to Closure's goog.style.getViewportPageOffset\n *\n * @returns The page offset of the viewport.\n * @alias Blockly.utils.style.getViewportPageOffset\n */\nexport function getViewportPageOffset(): Coordinate {\n const body = document.body;\n const documentElement = document.documentElement;\n const scrollLeft = body.scrollLeft || documentElement.scrollLeft;\n const scrollTop = body.scrollTop || documentElement.scrollTop;\n return new Coordinate(scrollLeft, scrollTop);\n}\n\n/**\n * Gets the computed border widths (on all sides) in pixels\n * Copied from Closure's goog.style.getBorderBox\n *\n * @param element The element to get the border widths for.\n * @returns The computed border widths.\n * @alias Blockly.utils.style.getBorderBox\n */\nexport function getBorderBox(element: Element): Rect {\n const left = parseFloat(getComputedStyle(element, 'borderLeftWidth'));\n const right = parseFloat(getComputedStyle(element, 'borderRightWidth'));\n const top = parseFloat(getComputedStyle(element, 'borderTopWidth'));\n const bottom = parseFloat(getComputedStyle(element, 'borderBottomWidth'));\n\n return new Rect(top, bottom, left, right);\n}\n\n/**\n * Changes the scroll position of `container` with the minimum amount so\n * that the content and the borders of the given `element` become visible.\n * If the element is bigger than the container, its top left corner will be\n * aligned as close to the container's top left corner as possible.\n * Copied from Closure's goog.style.scrollIntoContainerView\n *\n * @param element The element to make visible.\n * @param container The container to scroll. If not set, then the document\n * scroll element will be used.\n * @param opt_center Whether to center the element in the container.\n * Defaults to false.\n * @alias Blockly.utils.style.scrollIntoContainerView\n */\nexport function scrollIntoContainerView(\n element: Element, container: Element, opt_center?: boolean) {\n const offset = getContainerOffsetToScrollInto(element, container, opt_center);\n container.scrollLeft = offset.x;\n container.scrollTop = offset.y;\n}\n\n/**\n * Calculate the scroll position of `container` with the minimum amount so\n * that the content and the borders of the given `element` become visible.\n * If the element is bigger than the container, its top left corner will be\n * aligned as close to the container's top left corner as possible.\n * Copied from Closure's goog.style.getContainerOffsetToScrollInto\n *\n * @param element The element to make visible.\n * @param container The container to scroll. If not set, then the document\n * scroll element will be used.\n * @param opt_center Whether to center the element in the container.\n * Defaults to false.\n * @returns The new scroll position of the container.\n * @alias Blockly.utils.style.getContainerOffsetToScrollInto\n */\nexport function getContainerOffsetToScrollInto(\n element: Element, container: Element, opt_center?: boolean): Coordinate {\n // Absolute position of the element's border's top left corner.\n const elementPos = getPageOffset(element);\n // Absolute position of the container's border's top left corner.\n const containerPos = getPageOffset(container);\n const containerBorder = getBorderBox(container);\n // Relative pos. of the element's border box to the container's content box.\n const relX = elementPos.x - containerPos.x - containerBorder.left;\n const relY = elementPos.y - containerPos.y - containerBorder.top;\n // How much the element can move in the container, i.e. the difference between\n // the element's bottom-right-most and top-left-most position where it's\n // fully visible.\n const elementSize = getSizeWithDisplay(element);\n const spaceX = container.clientWidth - elementSize.width;\n const spaceY = container.clientHeight - elementSize.height;\n let scrollLeft = container.scrollLeft;\n let scrollTop = container.scrollTop;\n if (opt_center) {\n // All browsers round non-integer scroll positions down.\n scrollLeft += relX - spaceX / 2;\n scrollTop += relY - spaceY / 2;\n } else {\n // This formula was designed to give the correct scroll values in the\n // following cases:\n // - element is higher than container (spaceY < 0) => scroll down by relY\n // - element is not higher that container (spaceY >= 0):\n // - it is above container (relY < 0) => scroll up by abs(relY)\n // - it is below container (relY > spaceY) => scroll down by relY - spaceY\n // - it is in the container => don't scroll\n scrollLeft += Math.min(relX, Math.max(relX - spaceX, 0));\n scrollTop += Math.min(relY, Math.max(relY - spaceY, 0));\n }\n return new Coordinate(scrollLeft, scrollTop);\n}\n\nexport const TEST_ONLY = {\n getSizeInternal,\n};\n","/**\n * @license\n * Copyright 2016 Massachusetts Institute of Technology\n * All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A div that floats on top of the workspace, for drop-down menus.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.dropDownDiv');\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as common from './common.js';\nimport * as dom from './utils/dom.js';\nimport type {Field} from './field.js';\nimport * as math from './utils/math.js';\nimport {Rect} from './utils/rect.js';\nimport type {Size} from './utils/size.js';\nimport * as style from './utils/style.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Arrow size in px. Should match the value in CSS\n * (need to position pre-render).\n */\nexport const ARROW_SIZE = 16;\n\n/**\n * Drop-down border size in px. Should match the value in CSS (need to position\n * the arrow).\n */\nexport const BORDER_SIZE = 1;\n\n/**\n * Amount the arrow must be kept away from the edges of the main drop-down div,\n * in px.\n */\nexport const ARROW_HORIZONTAL_PADDING = 12;\n\n/** Amount drop-downs should be padded away from the source, in px. */\nexport const PADDING_Y = 16;\n\n/** Length of animations in seconds. */\nexport const ANIMATION_TIME = 0.25;\n\n/**\n * Timer for animation out, to be cleared if we need to immediately hide\n * without disrupting new shows.\n */\nlet animateOutTimer: ReturnType<typeof setTimeout>|null = null;\n\n/** Callback for when the drop-down is hidden. */\nlet onHide: Function|null = null;\n\n/** A class name representing the current owner's workspace renderer. */\nlet renderedClassName = '';\n\n/** A class name representing the current owner's workspace theme. */\nlet themeClassName = '';\n\n/** The content element. */\nlet div: HTMLDivElement;\n\n/** The content element. */\nlet content: HTMLDivElement;\n\n/** The arrow element. */\nlet arrow: HTMLDivElement;\n\n/**\n * Drop-downs will appear within the bounds of this element if possible.\n * Set in setBoundsElement.\n */\nlet boundsElement: Element|null = null;\n\n/** The object currently using the drop-down. */\nlet owner: Field|null = null;\n\n/** Whether the dropdown was positioned to a field or the source block. */\nlet positionToField: boolean|null = null;\n\n/**\n * Dropdown bounds info object used to encapsulate sizing information about a\n * bounding element (bounding box and width/height).\n */\nexport interface BoundsInfo {\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n}\n\n/** Dropdown position metrics. */\nexport interface PositionMetrics {\n initialX: number;\n initialY: number;\n finalX: number;\n finalY: number;\n arrowX: number|null;\n arrowY: number|null;\n arrowAtTop: boolean|null;\n arrowVisible: boolean;\n}\n\n/**\n * Create and insert the DOM element for this div.\n *\n * @internal\n */\nexport function createDom() {\n if (div) {\n return; // Already created.\n }\n div = document.createElement('div');\n div.className = 'blocklyDropDownDiv';\n const parentDiv = common.getParentContainer() || document.body;\n parentDiv.appendChild(div);\n\n content = document.createElement('div');\n content.className = 'blocklyDropDownContent';\n div.appendChild(content);\n\n arrow = document.createElement('div');\n arrow.className = 'blocklyDropDownArrow';\n div.appendChild(arrow);\n\n div.style.opacity = '0';\n // Transition animation for transform: translate() and opacity.\n div.style.transition = 'transform ' + ANIMATION_TIME + 's, ' +\n 'opacity ' + ANIMATION_TIME + 's';\n\n // Handle focusin/out events to add a visual indicator when\n // a child is focused or blurred.\n div.addEventListener('focusin', function() {\n dom.addClass(div, 'blocklyFocused');\n });\n div.addEventListener('focusout', function() {\n dom.removeClass(div, 'blocklyFocused');\n });\n}\n\n/**\n * Set an element to maintain bounds within. Drop-downs will appear\n * within the box of this element if possible.\n *\n * @param boundsElem Element to bind drop-down to.\n */\nexport function setBoundsElement(boundsElem: Element|null) {\n boundsElement = boundsElem;\n}\n\n/**\n * Provide the div for inserting content into the drop-down.\n *\n * @returns Div to populate with content.\n */\nexport function getContentDiv(): Element {\n return content;\n}\n\n/** Clear the content of the drop-down. */\nexport function clearContent() {\n content.textContent = '';\n content.style.width = '';\n}\n\n/**\n * Set the colour for the drop-down.\n *\n * @param backgroundColour Any CSS colour for the background.\n * @param borderColour Any CSS colour for the border.\n */\nexport function setColour(backgroundColour: string, borderColour: string) {\n div.style.backgroundColor = backgroundColour;\n div.style.borderColor = borderColour;\n}\n\n/**\n * Shortcut to show and place the drop-down with positioning determined\n * by a particular block. The primary position will be below the block,\n * and the secondary position above the block. Drop-down will be\n * constrained to the block's workspace.\n *\n * @param field The field showing the drop-down.\n * @param block Block to position the drop-down around.\n * @param opt_onHide Optional callback for when the drop-down is hidden.\n * @param opt_secondaryYOffset Optional Y offset for above-block positioning.\n * @returns True if the menu rendered below block; false if above.\n */\nexport function showPositionedByBlock(\n field: Field, block: BlockSvg, opt_onHide?: Function,\n opt_secondaryYOffset?: number): boolean {\n return showPositionedByRect(\n getScaledBboxOfBlock(block), field, opt_onHide, opt_secondaryYOffset);\n}\n\n/**\n * Shortcut to show and place the drop-down with positioning determined\n * by a particular field. The primary position will be below the field,\n * and the secondary position above the field. Drop-down will be\n * constrained to the block's workspace.\n *\n * @param field The field to position the dropdown against.\n * @param opt_onHide Optional callback for when the drop-down is hidden.\n * @param opt_secondaryYOffset Optional Y offset for above-block positioning.\n * @returns True if the menu rendered below block; false if above.\n */\nexport function showPositionedByField(\n field: Field, opt_onHide?: Function,\n opt_secondaryYOffset?: number): boolean {\n positionToField = true;\n return showPositionedByRect(\n getScaledBboxOfField(field), field, opt_onHide, opt_secondaryYOffset);\n}\n/**\n * Get the scaled bounding box of a block.\n *\n * @param block The block.\n * @returns The scaled bounding box of the block.\n */\nfunction getScaledBboxOfBlock(block: BlockSvg): Rect {\n const blockSvg = block.getSvgRoot();\n const scale = block.workspace.scale;\n const scaledHeight = block.height * scale;\n const scaledWidth = block.width * scale;\n const xy = style.getPageOffset(blockSvg);\n return new Rect(xy.y, xy.y + scaledHeight, xy.x, xy.x + scaledWidth);\n}\n\n/**\n * Get the scaled bounding box of a field.\n *\n * @param field The field.\n * @returns The scaled bounding box of the field.\n */\nfunction getScaledBboxOfField(field: Field): Rect {\n const bBox = field.getScaledBBox();\n return new Rect(bBox.top, bBox.bottom, bBox.left, bBox.right);\n}\n\n/**\n * Helper method to show and place the drop-down with positioning determined\n * by a scaled bounding box. The primary position will be below the rect,\n * and the secondary position above the rect. Drop-down will be constrained to\n * the block's workspace.\n *\n * @param bBox The scaled bounding box.\n * @param field The field to position the dropdown against.\n * @param opt_onHide Optional callback for when the drop-down is hidden.\n * @param opt_secondaryYOffset Optional Y offset for above-block positioning.\n * @returns True if the menu rendered below block; false if above.\n */\nfunction showPositionedByRect(\n bBox: Rect, field: Field, opt_onHide?: Function,\n opt_secondaryYOffset?: number): boolean {\n // If we can fit it, render below the block.\n const primaryX = bBox.left + (bBox.right - bBox.left) / 2;\n const primaryY = bBox.bottom;\n // If we can't fit it, render above the entire parent block.\n const secondaryX = primaryX;\n let secondaryY = bBox.top;\n if (opt_secondaryYOffset) {\n secondaryY += opt_secondaryYOffset;\n }\n const sourceBlock = field.getSourceBlock() as BlockSvg;\n // Set bounds to main workspace; show the drop-down.\n let workspace = sourceBlock.workspace;\n while (workspace.options.parentWorkspace) {\n workspace = workspace.options.parentWorkspace;\n }\n setBoundsElement(workspace.getParentSvg().parentNode as Element | null);\n return show(\n field, sourceBlock.RTL, primaryX, primaryY, secondaryX, secondaryY,\n opt_onHide);\n}\n\n/**\n * Show and place the drop-down.\n * The drop-down is placed with an absolute \"origin point\" (x, y) - i.e.,\n * the arrow will point at this origin and box will positioned below or above\n * it. If we can maintain the container bounds at the primary point, the arrow\n * will point there, and the container will be positioned below it.\n * If we can't maintain the container bounds at the primary point, fall-back to\n * the secondary point and position above.\n *\n * @param newOwner The object showing the drop-down\n * @param rtl Right-to-left (true) or left-to-right (false).\n * @param primaryX Desired origin point x, in absolute px.\n * @param primaryY Desired origin point y, in absolute px.\n * @param secondaryX Secondary/alternative origin point x, in absolute px.\n * @param secondaryY Secondary/alternative origin point y, in absolute px.\n * @param opt_onHide Optional callback for when the drop-down is hidden.\n * @returns True if the menu rendered at the primary origin point.\n * @internal\n */\nexport function show(\n newOwner: Field, rtl: boolean, primaryX: number, primaryY: number,\n secondaryX: number, secondaryY: number, opt_onHide?: Function): boolean {\n owner = newOwner;\n onHide = opt_onHide || null;\n // Set direction.\n div.style.direction = rtl ? 'rtl' : 'ltr';\n\n const mainWorkspace = common.getMainWorkspace() as WorkspaceSvg;\n renderedClassName = mainWorkspace.getRenderer().getClassName();\n themeClassName = mainWorkspace.getTheme().getClassName();\n if (renderedClassName) {\n dom.addClass(div, renderedClassName);\n }\n if (themeClassName) {\n dom.addClass(div, themeClassName);\n }\n\n // When we change `translate` multiple times in close succession,\n // Chrome may choose to wait and apply them all at once.\n // Since we want the translation to initial X, Y to be immediate,\n // and the translation to final X, Y to be animated,\n // we saw problems where both would be applied after animation was turned on,\n // making the dropdown appear to fly in from (0, 0).\n // Using both `left`, `top` for the initial translation and then `translate`\n // for the animated transition to final X, Y is a workaround.\n return positionInternal(primaryX, primaryY, secondaryX, secondaryY);\n}\n\nconst internal = {\n /**\n * Get sizing info about the bounding element.\n *\n * @returns An object containing size information about the bounding element\n * (bounding box and width/height).\n */\n getBoundsInfo: function(): BoundsInfo {\n const boundPosition = style.getPageOffset(boundsElement as Element);\n const boundSize = style.getSize(boundsElement as Element);\n\n return {\n left: boundPosition.x,\n right: boundPosition.x + boundSize.width,\n top: boundPosition.y,\n bottom: boundPosition.y + boundSize.height,\n width: boundSize.width,\n height: boundSize.height,\n };\n },\n\n /**\n * Helper to position the drop-down and the arrow, maintaining bounds.\n * See explanation of origin points in show.\n *\n * @param primaryX Desired origin point x, in absolute px.\n * @param primaryY Desired origin point y, in absolute px.\n * @param secondaryX Secondary/alternative origin point x, in absolute px.\n * @param secondaryY Secondary/alternative origin point y, in absolute px.\n * @returns Various final metrics, including rendered positions for drop-down\n * and arrow.\n */\n getPositionMetrics: function(\n primaryX: number, primaryY: number, secondaryX: number,\n secondaryY: number): PositionMetrics {\n const boundsInfo = internal.getBoundsInfo();\n const divSize = style.getSize(div as Element);\n\n // Can we fit in-bounds below the target?\n if (primaryY + divSize.height < boundsInfo.bottom) {\n return getPositionBelowMetrics(primaryX, primaryY, boundsInfo, divSize);\n }\n // Can we fit in-bounds above the target?\n if (secondaryY - divSize.height > boundsInfo.top) {\n return getPositionAboveMetrics(\n secondaryX, secondaryY, boundsInfo, divSize);\n }\n // Can we fit outside the workspace bounds (but inside the window)\n // below?\n if (primaryY + divSize.height < document.documentElement.clientHeight) {\n return getPositionBelowMetrics(primaryX, primaryY, boundsInfo, divSize);\n }\n // Can we fit outside the workspace bounds (but inside the window)\n // above?\n if (secondaryY - divSize.height > document.documentElement.clientTop) {\n return getPositionAboveMetrics(\n secondaryX, secondaryY, boundsInfo, divSize);\n }\n\n // Last resort, render at top of page.\n return getPositionTopOfPageMetrics(primaryX, boundsInfo, divSize);\n },\n};\n\n/**\n * Get the metrics for positioning the div below the source.\n *\n * @param primaryX Desired origin point x, in absolute px.\n * @param primaryY Desired origin point y, in absolute px.\n * @param boundsInfo An object containing size information about the bounding\n * element (bounding box and width/height).\n * @param divSize An object containing information about the size of the\n * DropDownDiv (width & height).\n * @returns Various final metrics, including rendered positions for drop-down\n * and arrow.\n */\nfunction getPositionBelowMetrics(\n primaryX: number, primaryY: number, boundsInfo: BoundsInfo,\n divSize: Size): PositionMetrics {\n const xCoords =\n getPositionX(primaryX, boundsInfo.left, boundsInfo.right, divSize.width);\n\n const arrowY = -(ARROW_SIZE / 2 + BORDER_SIZE);\n const finalY = primaryY + PADDING_Y;\n\n return {\n initialX: xCoords.divX,\n initialY: primaryY,\n finalX: xCoords.divX, // X position remains constant during animation.\n finalY,\n arrowX: xCoords.arrowX,\n arrowY,\n arrowAtTop: true,\n arrowVisible: true,\n };\n}\n\n/**\n * Get the metrics for positioning the div above the source.\n *\n * @param secondaryX Secondary/alternative origin point x, in absolute px.\n * @param secondaryY Secondary/alternative origin point y, in absolute px.\n * @param boundsInfo An object containing size information about the bounding\n * element (bounding box and width/height).\n * @param divSize An object containing information about the size of the\n * DropDownDiv (width & height).\n * @returns Various final metrics, including rendered positions for drop-down\n * and arrow.\n */\nfunction getPositionAboveMetrics(\n secondaryX: number, secondaryY: number, boundsInfo: BoundsInfo,\n divSize: Size): PositionMetrics {\n const xCoords = getPositionX(\n secondaryX, boundsInfo.left, boundsInfo.right, divSize.width);\n\n const arrowY = divSize.height - BORDER_SIZE * 2 - ARROW_SIZE / 2;\n const finalY = secondaryY - divSize.height - PADDING_Y;\n const initialY = secondaryY - divSize.height; // No padding on Y.\n\n return {\n initialX: xCoords.divX,\n initialY,\n finalX: xCoords.divX, // X position remains constant during animation.\n finalY,\n arrowX: xCoords.arrowX,\n arrowY,\n arrowAtTop: false,\n arrowVisible: true,\n };\n}\n\n/**\n * Get the metrics for positioning the div at the top of the page.\n *\n * @param sourceX Desired origin point x, in absolute px.\n * @param boundsInfo An object containing size information about the bounding\n * element (bounding box and width/height).\n * @param divSize An object containing information about the size of the\n * DropDownDiv (width & height).\n * @returns Various final metrics, including rendered positions for drop-down\n * and arrow.\n */\nfunction getPositionTopOfPageMetrics(\n sourceX: number, boundsInfo: BoundsInfo, divSize: Size): PositionMetrics {\n const xCoords =\n getPositionX(sourceX, boundsInfo.left, boundsInfo.right, divSize.width);\n\n // No need to provide arrow-specific information because it won't be visible.\n return {\n initialX: xCoords.divX,\n initialY: 0,\n finalX: xCoords.divX, // X position remains constant during animation.\n finalY: 0, // Y position remains constant during animation.\n arrowAtTop: null,\n arrowX: null,\n arrowY: null,\n arrowVisible: false,\n };\n}\n\n/**\n * Get the x positions for the left side of the DropDownDiv and the arrow,\n * accounting for the bounds of the workspace.\n *\n * @param sourceX Desired origin point x, in absolute px.\n * @param boundsLeft The left edge of the bounding element, in absolute px.\n * @param boundsRight The right edge of the bounding element, in absolute px.\n * @param divWidth The width of the div in px.\n * @returns An object containing metrics for the x positions of the left side of\n * the DropDownDiv and the arrow.\n * @internal\n */\nexport function getPositionX(\n sourceX: number, boundsLeft: number, boundsRight: number,\n divWidth: number): {divX: number, arrowX: number} {\n let divX = sourceX;\n // Offset the topLeft coord so that the dropdowndiv is centered.\n divX -= divWidth / 2;\n // Fit the dropdowndiv within the bounds of the workspace.\n divX = math.clamp(boundsLeft, divX, boundsRight - divWidth);\n\n let arrowX = sourceX;\n // Offset the arrow coord so that the arrow is centered.\n arrowX -= ARROW_SIZE / 2;\n // Convert the arrow position to be relative to the top left of the div.\n let relativeArrowX = arrowX - divX;\n const horizPadding = ARROW_HORIZONTAL_PADDING;\n // Clamp the arrow position so that it stays attached to the dropdowndiv.\n relativeArrowX = math.clamp(\n horizPadding, relativeArrowX, divWidth - horizPadding - ARROW_SIZE);\n\n return {arrowX: relativeArrowX, divX};\n}\n\n/**\n * Is the container visible?\n *\n * @returns True if visible.\n */\nexport function isVisible(): boolean {\n return !!owner;\n}\n\n/**\n * Hide the menu only if it is owned by the provided object.\n *\n * @param divOwner Object which must be owning the drop-down to hide.\n * @param opt_withoutAnimation True if we should hide the dropdown without\n * animating.\n * @returns True if hidden.\n */\nexport function hideIfOwner(\n divOwner: Field, opt_withoutAnimation?: boolean): boolean {\n if (owner === divOwner) {\n if (opt_withoutAnimation) {\n hideWithoutAnimation();\n } else {\n hide();\n }\n return true;\n }\n return false;\n}\n\n/** Hide the menu, triggering animation. */\nexport function hide() {\n // Start the animation by setting the translation and fading out.\n // Reset to (initialX, initialY) - i.e., no translation.\n div.style.transform = 'translate(0, 0)';\n div.style.opacity = '0';\n // Finish animation - reset all values to default.\n animateOutTimer = setTimeout(function() {\n hideWithoutAnimation();\n }, ANIMATION_TIME * 1000);\n if (onHide) {\n onHide();\n onHide = null;\n }\n}\n\n/** Hide the menu, without animation. */\nexport function hideWithoutAnimation() {\n if (!isVisible()) {\n return;\n }\n if (animateOutTimer) {\n clearTimeout(animateOutTimer);\n }\n\n // Reset style properties in case this gets called directly\n // instead of hide() - see discussion on #2551.\n div.style.transform = '';\n div.style.left = '';\n div.style.top = '';\n div.style.opacity = '0';\n div.style.display = 'none';\n div.style.backgroundColor = '';\n div.style.borderColor = '';\n\n if (onHide) {\n onHide();\n onHide = null;\n }\n clearContent();\n owner = null;\n\n if (renderedClassName) {\n dom.removeClass(div, renderedClassName);\n renderedClassName = '';\n }\n if (themeClassName) {\n dom.removeClass(div, themeClassName);\n themeClassName = '';\n }\n (common.getMainWorkspace() as WorkspaceSvg).markFocused();\n}\n\n/**\n * Set the dropdown div's position.\n *\n * @param primaryX Desired origin point x, in absolute px.\n * @param primaryY Desired origin point y, in absolute px.\n * @param secondaryX Secondary/alternative origin point x, in absolute px.\n * @param secondaryY Secondary/alternative origin point y, in absolute px.\n * @returns True if the menu rendered at the primary origin point.\n */\nfunction positionInternal(\n primaryX: number, primaryY: number, secondaryX: number,\n secondaryY: number): boolean {\n const metrics =\n internal.getPositionMetrics(primaryX, primaryY, secondaryX, secondaryY);\n\n // Update arrow CSS.\n if (metrics.arrowVisible) {\n arrow.style.display = '';\n arrow.style.transform = 'translate(' + metrics.arrowX + 'px,' +\n metrics.arrowY + 'px) rotate(45deg)';\n arrow.setAttribute(\n 'class',\n metrics.arrowAtTop ? 'blocklyDropDownArrow blocklyArrowTop' :\n 'blocklyDropDownArrow blocklyArrowBottom');\n } else {\n arrow.style.display = 'none';\n }\n\n const initialX = Math.floor(metrics.initialX);\n const initialY = Math.floor(metrics.initialY);\n const finalX = Math.floor(metrics.finalX);\n const finalY = Math.floor(metrics.finalY);\n\n // First apply initial translation.\n div.style.left = initialX + 'px';\n div.style.top = initialY + 'px';\n\n // Show the div.\n div.style.display = 'block';\n div.style.opacity = '1';\n // Add final translate, animated through `transition`.\n // Coordinates are relative to (initialX, initialY),\n // where the drop-down is absolutely positioned.\n const dx = finalX - initialX;\n const dy = finalY - initialY;\n div.style.transform = 'translate(' + dx + 'px,' + dy + 'px)';\n\n return !!metrics.arrowAtTop;\n}\n\n/**\n * Repositions the dropdownDiv on window resize. If it doesn't know how to\n * calculate the new position, it will just hide it instead.\n *\n * @internal\n */\nexport function repositionForWindowResize() {\n // This condition mainly catches the dropdown div when it is being used as a\n // dropdown. It is important not to close it in this case because on Android,\n // when a field is focused, the soft keyboard opens triggering a window resize\n // event and we want the dropdown div to stick around so users can type into\n // it.\n if (owner) {\n const block = owner.getSourceBlock() as BlockSvg;\n const bBox = positionToField ? getScaledBboxOfField(owner) :\n getScaledBboxOfBlock(block);\n // If we can fit it, render below the block.\n const primaryX = bBox.left + (bBox.right - bBox.left) / 2;\n const primaryY = bBox.bottom;\n // If we can't fit it, render above the entire parent block.\n const secondaryX = primaryX;\n const secondaryY = bBox.top;\n positionInternal(primaryX, primaryY, secondaryX, secondaryY);\n } else {\n hide();\n }\n}\n\nexport const TEST_ONLY = internal;\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * This file is a universal registry that provides generic methods\n * for registering and unregistering different types of classes.\n *\n * @namespace Blockly.registry\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.registry');\n\nimport type {Abstract} from './events/events_abstract.js';\nimport type {Field} from './field.js';\nimport type {IBlockDragger} from './interfaces/i_block_dragger.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IMetricsManager} from './interfaces/i_metrics_manager.js';\nimport type {ISerializer} from './interfaces/i_serializer.js';\nimport type {IToolbox} from './interfaces/i_toolbox.js';\nimport type {Cursor} from './keyboard_nav/cursor.js';\nimport type {Options} from './options.js';\nimport type {Renderer} from './renderers/common/renderer.js';\nimport type {Theme} from './theme.js';\nimport type {ToolboxItem} from './toolbox/toolbox_item.js';\n\n\n/**\n * A map of maps. With the keys being the type and name of the class we are\n * registering and the value being the constructor function.\n * e.g. {'field': {'field_angle': Blockly.FieldAngle}}\n */\nconst typeMap: {\n [key: string]:\n {[key: string]: (new () => AnyDuringMigration)|AnyDuringMigration}\n} = Object.create(null);\nexport const TEST_ONLY = {typeMap};\n\n/**\n * A map of maps. With the keys being the type and caseless name of the class we\n * are registring, and the value being the most recent cased name for that\n * registration.\n */\nconst nameMap: {[key: string]: {[key: string]: string}} = Object.create(null);\n\n/**\n * The string used to register the default class for a type of plugin.\n *\n * @alias Blockly.registry.DEFAULT\n */\nexport const DEFAULT = 'default';\n\n/**\n * A name with the type of the element stored in the generic.\n *\n * @alias Blockly.registry.Type\n */\nexport class Type<_T> {\n /** @param name The name of the registry type. */\n constructor(private readonly name: string) {}\n\n /**\n * Returns the name of the type.\n *\n * @returns The name.\n */\n toString(): string {\n return this.name;\n }\n\n static CONNECTION_CHECKER = new Type<IConnectionChecker>('connectionChecker');\n\n static CURSOR = new Type<Cursor>('cursor');\n\n static EVENT = new Type<Abstract>('event');\n\n static FIELD = new Type<Field>('field');\n\n static RENDERER = new Type<Renderer>('renderer');\n\n static TOOLBOX = new Type<IToolbox>('toolbox');\n\n static THEME = new Type<Theme>('theme');\n\n static TOOLBOX_ITEM = new Type<ToolboxItem>('toolboxItem');\n\n static FLYOUTS_VERTICAL_TOOLBOX = new Type<IFlyout>('flyoutsVerticalToolbox');\n\n static FLYOUTS_HORIZONTAL_TOOLBOX =\n new Type<IFlyout>('flyoutsHorizontalToolbox');\n\n static METRICS_MANAGER = new Type<IMetricsManager>('metricsManager');\n\n static BLOCK_DRAGGER = new Type<IBlockDragger>('blockDragger');\n\n /** @internal */\n static SERIALIZER = new Type<ISerializer>('serializer');\n}\n\n/**\n * Registers a class based on a type and name.\n *\n * @param type The type of the plugin.\n * (e.g. Field, Renderer)\n * @param name The plugin's name. (Ex. field_angle, geras)\n * @param registryItem The class or object to register.\n * @param opt_allowOverrides True to prevent an error when overriding an already\n * registered item.\n * @throws {Error} if the type or name is empty, a name with the given type has\n * already been registered, or if the given class or object is not valid for\n * its type.\n * @alias Blockly.registry.register\n */\nexport function register<T>(\n type: string|Type<T>, name: string,\n registryItem: (new (...p1: AnyDuringMigration[]) => T)|null|\n AnyDuringMigration,\n opt_allowOverrides?: boolean): void {\n if (!(type instanceof Type) && typeof type !== 'string' ||\n String(type).trim() === '') {\n throw Error(\n 'Invalid type \"' + type + '\". The type must be a' +\n ' non-empty string or a Blockly.registry.Type.');\n }\n type = String(type).toLowerCase();\n\n if (typeof name !== 'string' || name.trim() === '') {\n throw Error(\n 'Invalid name \"' + name + '\". The name must be a' +\n ' non-empty string.');\n }\n const caselessName = name.toLowerCase();\n if (!registryItem) {\n throw Error('Can not register a null value');\n }\n let typeRegistry = typeMap[type];\n let nameRegistry = nameMap[type];\n // If the type registry has not been created, create it.\n if (!typeRegistry) {\n typeRegistry = typeMap[type] = Object.create(null);\n nameRegistry = nameMap[type] = Object.create(null);\n }\n\n // Validate that the given class has all the required properties.\n validate(type, registryItem);\n\n // Don't throw an error if opt_allowOverrides is true.\n if (!opt_allowOverrides && typeRegistry[caselessName]) {\n throw Error(\n 'Name \"' + caselessName + '\" with type \"' + type +\n '\" already registered.');\n }\n typeRegistry[caselessName] = registryItem;\n nameRegistry[caselessName] = name;\n}\n\n/**\n * Checks the given registry item for properties that are required based on the\n * type.\n *\n * @param type The type of the plugin. (e.g. Field, Renderer)\n * @param registryItem A class or object that we are checking for the required\n * properties.\n */\nfunction validate(type: string, registryItem: Function|AnyDuringMigration) {\n switch (type) {\n case String(Type.FIELD):\n if (typeof registryItem.fromJson !== 'function') {\n throw Error('Type \"' + type + '\" must have a fromJson function');\n }\n break;\n }\n}\n\n/**\n * Unregisters the registry item with the given type and name.\n *\n * @param type The type of the plugin.\n * (e.g. Field, Renderer)\n * @param name The plugin's name. (Ex. field_angle, geras)\n * @alias Blockly.registry.unregister\n */\nexport function unregister<T>(type: string|Type<T>, name: string) {\n type = String(type).toLowerCase();\n name = name.toLowerCase();\n const typeRegistry = typeMap[type];\n if (!typeRegistry || !typeRegistry[name]) {\n console.warn(\n 'Unable to unregister [' + name + '][' + type + '] from the ' +\n 'registry.');\n return;\n }\n delete typeMap[type][name];\n delete nameMap[type][name];\n}\n\n/**\n * Gets the registry item for the given name and type. This can be either a\n * class or an object.\n *\n * @param type The type of the plugin.\n * (e.g. Field, Renderer)\n * @param name The plugin's name. (Ex. field_angle, geras)\n * @param opt_throwIfMissing Whether or not to throw an error if we are unable\n * to find the plugin.\n * @returns The class or object with the given name and type or null if none\n * exists.\n */\nfunction getItem<T>(\n type: string|Type<T>, name: string, opt_throwIfMissing?: boolean):\n (new (...p1: AnyDuringMigration[]) => T)|null|AnyDuringMigration {\n type = String(type).toLowerCase();\n name = name.toLowerCase();\n const typeRegistry = typeMap[type];\n if (!typeRegistry || !typeRegistry[name]) {\n const msg = 'Unable to find [' + name + '][' + type + '] in the registry.';\n if (opt_throwIfMissing) {\n throw new Error(\n msg + ' You must require or register a ' + type + ' plugin.');\n } else {\n console.warn(msg);\n }\n return null;\n }\n return typeRegistry[name];\n}\n\n/**\n * Returns whether or not the registry contains an item with the given type and\n * name.\n *\n * @param type The type of the plugin.\n * (e.g. Field, Renderer)\n * @param name The plugin's name. (Ex. field_angle, geras)\n * @returns True if the registry has an item with the given type and name, false\n * otherwise.\n * @alias Blockly.registry.hasItem\n */\nexport function hasItem<T>(type: string|Type<T>, name: string): boolean {\n type = String(type).toLowerCase();\n name = name.toLowerCase();\n const typeRegistry = typeMap[type];\n if (!typeRegistry) {\n return false;\n }\n return !!typeRegistry[name];\n}\n\n/**\n * Gets the class for the given name and type.\n *\n * @param type The type of the plugin.\n * (e.g. Field, Renderer)\n * @param name The plugin's name. (Ex. field_angle, geras)\n * @param opt_throwIfMissing Whether or not to throw an error if we are unable\n * to find the plugin.\n * @returns The class with the given name and type or null if none exists.\n * @alias Blockly.registry.getClass\n */\nexport function getClass<T>(\n type: string|Type<T>, name: string, opt_throwIfMissing?: boolean):\n (new (...p1: AnyDuringMigration[]) => T)|null {\n return getItem(type, name, opt_throwIfMissing) as (\n new (...p1: AnyDuringMigration[]) => T) |\n null;\n}\n\n/**\n * Gets the object for the given name and type.\n *\n * @param type The type of the plugin.\n * (e.g. Category)\n * @param name The plugin's name. (Ex. logic_category)\n * @param opt_throwIfMissing Whether or not to throw an error if we are unable\n * to find the object.\n * @returns The object with the given name and type or null if none exists.\n * @alias Blockly.registry.getObject\n */\nexport function getObject<T>(\n type: string|Type<T>, name: string, opt_throwIfMissing?: boolean): T|null {\n return getItem(type, name, opt_throwIfMissing) as T;\n}\n\n/**\n * Returns a map of items registered with the given type.\n *\n * @param type The type of the plugin. (e.g. Category)\n * @param opt_cased Whether or not to return a map with cased keys (rather than\n * caseless keys). False by default.\n * @param opt_throwIfMissing Whether or not to throw an error if we are unable\n * to find the object. False by default.\n * @returns A map of objects with the given type, or null if none exists.\n * @alias Blockly.registry.getAllItems\n */\nexport function getAllItems<T>(\n type: string|Type<T>, opt_cased?: boolean, opt_throwIfMissing?: boolean):\n {[key: string]: T|null|(new (...p1: AnyDuringMigration[]) => T)}|null {\n type = String(type).toLowerCase();\n const typeRegistry = typeMap[type];\n if (!typeRegistry) {\n const msg = `Unable to find [${type}] in the registry.`;\n if (opt_throwIfMissing) {\n throw new Error(`${msg} You must require or register a ${type} plugin.`);\n } else {\n console.warn(msg);\n }\n return null;\n }\n if (!opt_cased) {\n return typeRegistry;\n }\n const nameRegistry = nameMap[type];\n const casedRegistry = Object.create(null);\n const keys = Object.keys(typeRegistry);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n casedRegistry[nameRegistry[key]] = typeRegistry[key];\n }\n return casedRegistry;\n}\n\n/**\n * Gets the class from Blockly options for the given type.\n * This is used for plugins that override a built in feature. (e.g. Toolbox)\n *\n * @param type The type of the plugin.\n * @param options The option object to check for the given plugin.\n * @param opt_throwIfMissing Whether or not to throw an error if we are unable\n * to find the plugin.\n * @returns The class for the plugin.\n * @alias Blockly.registry.getClassFromOptions\n */\nexport function getClassFromOptions<T>(\n type: Type<T>, options: Options, opt_throwIfMissing?: boolean):\n (new (...p1: AnyDuringMigration[]) => T)|null {\n const typeName = type.toString();\n const plugin = options.plugins[typeName] || DEFAULT;\n\n // If the user passed in a plugin class instead of a registered plugin name.\n if (typeof plugin === 'function') {\n return plugin;\n }\n return getClass(type, plugin, opt_throwIfMissing);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Generators for unique IDs.\n *\n * @namespace Blockly.utils.idGenerator\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.idGenerator');\n\n/**\n * Legal characters for the universally unique IDs. Should be all on\n * a US keyboard. No characters that conflict with XML or JSON.\n * Requests to remove additional 'problematic' characters from this\n * soup will be denied. That's your failure to properly escape in\n * your own environment. Issues #251, #625, #682, #1304.\n */\nconst soup = '!#$%()*+,-./:;=?@[]^_`{|}~' +\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n\n/**\n * Namespace object for internal implementations we want to be able to\n * stub in tests. Do not use externally.\n *\n * @internal\n */\nconst internal = {\n /**\n * Generate a random unique ID. This should be globally unique.\n * 87 characters ^ 20 length is greater than 128 bits (better than a UUID).\n *\n * @returns A globally unique ID string.\n */\n genUid: () => {\n const length = 20;\n const soupLength = soup.length;\n const id = [];\n for (let i = 0; i < length; i++) {\n id[i] = soup.charAt(Math.random() * soupLength);\n }\n return id.join('');\n },\n};\nexport const TEST_ONLY = internal;\n\n/** Next unique ID to use. */\nlet nextId = 0;\n\n/**\n * Generate the next unique element IDs.\n * IDs are compatible with the HTML4 'id' attribute restrictions:\n * Use only ASCII letters, digits, '_', '-' and '.'\n *\n * For UUIDs use genUid (below) instead; this ID generator should\n * primarily be used for IDs that end up in the DOM.\n *\n * @returns The next unique identifier.\n * @alias Blockly.utils.idGenerator.getNextUniqueId\n */\nexport function getNextUniqueId(): string {\n return 'blockly-' + (nextId++).toString(36);\n}\n\n/**\n * Generate a random unique ID.\n *\n * @see internal.genUid\n * @returns A globally unique ID string.\n * @alias Blockly.utils.idGenerator.genUid\n */\nexport function genUid(): string {\n return internal.genUid();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Helper methods for events that are fired as a result of\n * actions in Blockly's editor.\n *\n * @namespace Blockly.Events.utils\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.utils');\n\nimport type {Block} from '../block.js';\nimport * as common from '../common.js';\nimport * as registry from '../registry.js';\nimport * as idGenerator from '../utils/idgenerator.js';\nimport type {Workspace} from '../workspace.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\n\nimport type {Abstract} from './events_abstract.js';\nimport type {BlockChange} from './events_block_change.js';\nimport type {BlockCreate} from './events_block_create.js';\nimport type {BlockMove} from './events_block_move.js';\nimport type {CommentCreate} from './events_comment_create.js';\nimport type {CommentMove} from './events_comment_move.js';\nimport type {ViewportChange} from './events_viewport.js';\n\n\n/** Group ID for new events. Grouped events are indivisible. */\nlet group = '';\n\n/** Sets whether the next event should be added to the undo stack. */\nlet recordUndo = true;\n\n/**\n * Sets whether events should be added to the undo stack.\n *\n * @param newValue True if events should be added to the undo stack.\n * @alias Blockly.Events.utils.setRecordUndo\n */\nexport function setRecordUndo(newValue: boolean) {\n recordUndo = newValue;\n}\n\n/**\n * Returns whether or not events will be added to the undo stack.\n *\n * @returns True if events will be added to the undo stack.\n * @alias Blockly.Events.utils.getRecordUndo\n */\nexport function getRecordUndo(): boolean {\n return recordUndo;\n}\n\n/** Allow change events to be created and fired. */\nlet disabled = 0;\n\n/**\n * Name of event that creates a block. Will be deprecated for BLOCK_CREATE.\n *\n * @alias Blockly.Events.utils.CREATE\n */\nexport const CREATE = 'create';\n\n/**\n * Name of event that creates a block.\n *\n * @alias Blockly.Events.utils.BLOCK_CREATE\n */\nexport const BLOCK_CREATE = CREATE;\n\n/**\n * Name of event that deletes a block. Will be deprecated for BLOCK_DELETE.\n *\n * @alias Blockly.Events.utils.DELETE\n */\nexport const DELETE = 'delete';\n\n/**\n * Name of event that deletes a block.\n *\n * @alias Blockly.Events.utils.BLOCK_DELETE\n */\nexport const BLOCK_DELETE = DELETE;\n\n/**\n * Name of event that changes a block. Will be deprecated for BLOCK_CHANGE.\n *\n * @alias Blockly.Events.utils.CHANGE\n */\nexport const CHANGE = 'change';\n\n/**\n * Name of event that changes a block.\n *\n * @alias Blockly.Events.utils.BLOCK_CHANGE\n */\nexport const BLOCK_CHANGE = CHANGE;\n\n/**\n * Name of event that moves a block. Will be deprecated for BLOCK_MOVE.\n *\n * @alias Blockly.Events.utils.MOVE\n */\nexport const MOVE = 'move';\n\n/**\n * Name of event that moves a block.\n *\n * @alias Blockly.Events.utils.BLOCK_MOVE\n */\nexport const BLOCK_MOVE = MOVE;\n\n/**\n * Name of event that creates a variable.\n *\n * @alias Blockly.Events.utils.VAR_CREATE\n */\nexport const VAR_CREATE = 'var_create';\n\n/**\n * Name of event that deletes a variable.\n *\n * @alias Blockly.Events.utils.VAR_DELETE\n */\nexport const VAR_DELETE = 'var_delete';\n\n/**\n * Name of event that renames a variable.\n *\n * @alias Blockly.Events.utils.VAR_RENAME\n */\nexport const VAR_RENAME = 'var_rename';\n\n/**\n * Name of generic event that records a UI change.\n *\n * @alias Blockly.Events.utils.UI\n */\nexport const UI = 'ui';\n\n/**\n * Name of event that record a block drags a block.\n *\n * @alias Blockly.Events.utils.BLOCK_DRAG\n */\nexport const BLOCK_DRAG = 'drag';\n\n/**\n * Name of event that records a change in selected element.\n *\n * @alias Blockly.Events.utils.SELECTED\n */\nexport const SELECTED = 'selected';\n\n/**\n * Name of event that records a click.\n *\n * @alias Blockly.Events.utils.CLICK\n */\nexport const CLICK = 'click';\n\n/**\n * Name of event that records a marker move.\n *\n * @alias Blockly.Events.utils.MARKER_MOVE\n */\nexport const MARKER_MOVE = 'marker_move';\n\n/**\n * Name of event that records a bubble open.\n *\n * @alias Blockly.Events.utils.BUBBLE_OPEN\n */\nexport const BUBBLE_OPEN = 'bubble_open';\n\n/**\n * Name of event that records a trashcan open.\n *\n * @alias Blockly.Events.utils.TRASHCAN_OPEN\n */\nexport const TRASHCAN_OPEN = 'trashcan_open';\n\n/**\n * Name of event that records a toolbox item select.\n *\n * @alias Blockly.Events.utils.TOOLBOX_ITEM_SELECT\n */\nexport const TOOLBOX_ITEM_SELECT = 'toolbox_item_select';\n\n/**\n * Name of event that records a theme change.\n *\n * @alias Blockly.Events.utils.THEME_CHANGE\n */\nexport const THEME_CHANGE = 'theme_change';\n\n/**\n * Name of event that records a viewport change.\n *\n * @alias Blockly.Events.utils.VIEWPORT_CHANGE\n */\nexport const VIEWPORT_CHANGE = 'viewport_change';\n\n/**\n * Name of event that creates a comment.\n *\n * @alias Blockly.Events.utils.COMMENT_CREATE\n */\nexport const COMMENT_CREATE = 'comment_create';\n\n/**\n * Name of event that deletes a comment.\n *\n * @alias Blockly.Events.utils.COMMENT_DELETE\n */\nexport const COMMENT_DELETE = 'comment_delete';\n\n/**\n * Name of event that changes a comment.\n *\n * @alias Blockly.Events.utils.COMMENT_CHANGE\n */\nexport const COMMENT_CHANGE = 'comment_change';\n\n/**\n * Name of event that moves a comment.\n *\n * @alias Blockly.Events.utils.COMMENT_MOVE\n */\nexport const COMMENT_MOVE = 'comment_move';\n\n/**\n * Name of event that records a workspace load.\n *\n * @alias Blockly.Events.utils.FINISHED_LOADING\n */\nexport const FINISHED_LOADING = 'finished_loading';\n\n/**\n * Type of events that cause objects to be bumped back into the visible\n * portion of the workspace.\n *\n * Not to be confused with bumping so that disconnected connections do not\n * appear connected.\n *\n * @alias Blockly.Events.utils.BumpEvent\n */\nexport type BumpEvent = BlockCreate|BlockMove|CommentCreate|CommentMove;\n\n/**\n * List of events that cause objects to be bumped back into the visible\n * portion of the workspace.\n *\n * Not to be confused with bumping so that disconnected connections do not\n * appear connected.\n *\n * @alias Blockly.Events.utils.BUMP_EVENTS\n */\nexport const BUMP_EVENTS: string[] =\n [BLOCK_CREATE, BLOCK_MOVE, COMMENT_CREATE, COMMENT_MOVE];\n\n/** List of events queued for firing. */\nconst FIRE_QUEUE: Abstract[] = [];\n\n/**\n * Create a custom event and fire it.\n *\n * @param event Custom data for event.\n * @alias Blockly.Events.utils.fire\n */\nexport function fire(event: Abstract) {\n TEST_ONLY.fireInternal(event);\n}\n\n/**\n * Private version of fireInternal for stubbing in tests.\n */\nfunction fireInternal(event: Abstract) {\n if (!isEnabled()) {\n return;\n }\n if (!FIRE_QUEUE.length) {\n // First event added; schedule a firing of the event queue.\n setTimeout(fireNow, 0);\n }\n FIRE_QUEUE.push(event);\n}\n\n\n/** Fire all queued events. */\nfunction fireNow() {\n const queue = filter(FIRE_QUEUE, true);\n FIRE_QUEUE.length = 0;\n for (let i = 0, event; event = queue[i]; i++) {\n if (!event.workspaceId) {\n continue;\n }\n const eventWorkspace = common.getWorkspaceById(event.workspaceId);\n if (eventWorkspace) {\n eventWorkspace.fireChangeListener(event);\n }\n }\n}\n\n/**\n * Filter the queued events and merge duplicates.\n *\n * @param queueIn Array of events.\n * @param forward True if forward (redo), false if backward (undo).\n * @returns Array of filtered events.\n * @alias Blockly.Events.utils.filter\n */\nexport function filter(queueIn: Abstract[], forward: boolean): Abstract[] {\n let queue = queueIn.slice();\n // Shallow copy of queue.\n if (!forward) {\n // Undo is merged in reverse order.\n queue.reverse();\n }\n const mergedQueue = [];\n const hash = Object.create(null);\n // Merge duplicates.\n for (let i = 0, event; event = queue[i]; i++) {\n if (!event.isNull()) {\n // Treat all UI events as the same type in hash table.\n const eventType = event.isUiEvent ? UI : event.type;\n // TODO(#5927): Check whether `blockId` exists before accessing it.\n const blockId = (event as AnyDuringMigration).blockId;\n const key = [eventType, blockId, event.workspaceId].join(' ');\n\n const lastEntry = hash[key];\n const lastEvent = lastEntry ? lastEntry.event : null;\n if (!lastEntry) {\n // Each item in the hash table has the event and the index of that event\n // in the input array. This lets us make sure we only merge adjacent\n // move events.\n hash[key] = {event, index: i};\n mergedQueue.push(event);\n } else if (event.type === MOVE && lastEntry.index === i - 1) {\n const moveEvent = event as BlockMove;\n // Merge move events.\n lastEvent.newParentId = moveEvent.newParentId;\n lastEvent.newInputName = moveEvent.newInputName;\n lastEvent.newCoordinate = moveEvent.newCoordinate;\n lastEntry.index = i;\n } else if (\n event.type === CHANGE &&\n (event as BlockChange).element === lastEvent.element &&\n (event as BlockChange).name === lastEvent.name) {\n const changeEvent = event as BlockChange;\n // Merge change events.\n lastEvent.newValue = changeEvent.newValue;\n } else if (event.type === VIEWPORT_CHANGE) {\n const viewportEvent = event as ViewportChange;\n // Merge viewport change events.\n lastEvent.viewTop = viewportEvent.viewTop;\n lastEvent.viewLeft = viewportEvent.viewLeft;\n lastEvent.scale = viewportEvent.scale;\n lastEvent.oldScale = viewportEvent.oldScale;\n } else if (event.type === CLICK && lastEvent.type === BUBBLE_OPEN) {\n // Drop click events caused by opening/closing bubbles.\n } else {\n // Collision: newer events should merge into this event to maintain\n // order.\n hash[key] = {event, index: i};\n mergedQueue.push(event);\n }\n }\n }\n // Filter out any events that have become null due to merging.\n queue = mergedQueue.filter(function(e) {\n return !e.isNull();\n });\n if (!forward) {\n // Restore undo order.\n queue.reverse();\n }\n // Move mutation events to the top of the queue.\n // Intentionally skip first event.\n for (let i = 1, event; event = queue[i]; i++) {\n // AnyDuringMigration because: Property 'element' does not exist on type\n // 'Abstract'.\n if (event.type === CHANGE &&\n (event as AnyDuringMigration).element === 'mutation') {\n queue.unshift(queue.splice(i, 1)[0]);\n }\n }\n return queue;\n}\n\n/**\n * Modify pending undo events so that when they are fired they don't land\n * in the undo stack. Called by Workspace.clearUndo.\n *\n * @alias Blockly.Events.utils.clearPendingUndo\n */\nexport function clearPendingUndo() {\n for (let i = 0, event; event = FIRE_QUEUE[i]; i++) {\n event.recordUndo = false;\n }\n}\n\n/**\n * Stop sending events. Every call to this function MUST also call enable.\n *\n * @alias Blockly.Events.utils.disable\n */\nexport function disable() {\n disabled++;\n}\n\n/**\n * Start sending events. Unless events were already disabled when the\n * corresponding call to disable was made.\n *\n * @alias Blockly.Events.utils.enable\n */\nexport function enable() {\n disabled--;\n}\n\n/**\n * Returns whether events may be fired or not.\n *\n * @returns True if enabled.\n * @alias Blockly.Events.utils.isEnabled\n */\nexport function isEnabled(): boolean {\n return disabled === 0;\n}\n\n/**\n * Current group.\n *\n * @returns ID string.\n * @alias Blockly.Events.utils.getGroup\n */\nexport function getGroup(): string {\n return group;\n}\n\n/**\n * Start or stop a group.\n *\n * @param state True to start new group, false to end group.\n * String to set group explicitly.\n * @alias Blockly.Events.utils.setGroup\n */\nexport function setGroup(state: boolean|string) {\n TEST_ONLY.setGroupInternal(state);\n}\n\n/**\n * Private version of setGroup for stubbing in tests.\n */\nfunction setGroupInternal(state: boolean|string) {\n if (typeof state === 'boolean') {\n group = state ? idGenerator.genUid() : '';\n } else {\n group = state;\n }\n}\n\n/**\n * Compute a list of the IDs of the specified block and all its descendants.\n *\n * @param block The root block.\n * @returns List of block IDs.\n * @alias Blockly.Events.utils.getDescendantIds\n * @internal\n */\nexport function getDescendantIds(block: Block): string[] {\n const ids = [];\n const descendants = block.getDescendants(false);\n for (let i = 0, descendant; descendant = descendants[i]; i++) {\n ids[i] = descendant.id;\n }\n return ids;\n}\n\n/**\n * Decode the JSON into an event.\n *\n * @param json JSON representation.\n * @param workspace Target workspace for event.\n * @returns The event represented by the JSON.\n * @throws {Error} if an event type is not found in the registry.\n * @alias Blockly.Events.utils.fromJson\n */\nexport function fromJson(\n json: AnyDuringMigration, workspace: Workspace): Abstract {\n const eventClass = get(json['type']);\n if (!eventClass) {\n throw Error('Unknown event type.');\n }\n const event = new eventClass();\n event.fromJson(json);\n event.workspaceId = workspace.id;\n return event;\n}\n\n/**\n * Gets the class for a specific event type from the registry.\n *\n * @param eventType The type of the event to get.\n * @returns The event class with the given type.\n * @alias Blockly.Events.utils.get\n */\nexport function get(eventType: string):\n (new (...p1: AnyDuringMigration[]) => Abstract) {\n const event = registry.getClass(registry.Type.EVENT, eventType);\n if (!event) {\n throw new Error(`Event type ${eventType} not found in registry.`);\n }\n return event;\n}\n\n/**\n * Enable/disable a block depending on whether it is properly connected.\n * Use this on applications where all blocks should be connected to a top block.\n * Recommend setting the 'disable' option to 'false' in the config so that\n * users don't try to re-enable disabled orphan blocks.\n *\n * @param event Custom data for event.\n * @alias Blockly.Events.utils.disableOrphans\n */\nexport function disableOrphans(event: Abstract) {\n if (event.type === MOVE || event.type === CREATE) {\n const blockEvent = event as BlockMove | BlockCreate;\n if (!blockEvent.workspaceId) {\n return;\n }\n const eventWorkspace =\n common.getWorkspaceById(blockEvent.workspaceId) as WorkspaceSvg;\n if (!blockEvent.blockId) {\n throw new Error('Encountered a blockEvent without a proper blockId');\n }\n let block = eventWorkspace.getBlockById(blockEvent.blockId);\n if (block) {\n // Changing blocks as part of this event shouldn't be undoable.\n const initialUndoFlag = recordUndo;\n try {\n recordUndo = false;\n const parent = block.getParent();\n if (parent && parent.isEnabled()) {\n const children = block.getDescendants(false);\n for (let i = 0, child; child = children[i]; i++) {\n child.setEnabled(true);\n }\n } else if (\n (block.outputConnection || block.previousConnection) &&\n !eventWorkspace.isDragging()) {\n do {\n block.setEnabled(false);\n block = block.getNextBlock();\n } while (block);\n }\n } finally {\n recordUndo = initialUndoFlag;\n }\n }\n }\n}\n\nexport const TEST_ONLY = {\n FIRE_QUEUE,\n fireNow,\n fireInternal,\n setGroupInternal,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * XML element manipulation.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.xml\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.xml');\n\n\n/**\n * Namespace for Blockly's XML.\n *\n * @alias Blockly.utils.xml.NAME_SPACE\n */\nexport const NAME_SPACE = 'https://developers.google.com/blockly/xml';\n\n/**\n * The Document object to use. By default this is just document, but\n * the Node.js build of Blockly (see scripts/package/node/core.js)\n * calls setDocument to supply a Document implementation from the\n * jsdom package instead.\n */\nlet xmlDocument: Document = globalThis['document'];\n\n/**\n * Get the document object to use for XML serialization.\n *\n * @returns The document object.\n * @alias Blockly.utils.xml.getDocument\n */\nexport function getDocument(): Document {\n return xmlDocument;\n}\n\n/**\n * Get the document object to use for XML serialization.\n *\n * @param document The document object to use.\n * @alias Blockly.utils.xml.setDocument\n */\nexport function setDocument(document: Document) {\n xmlDocument = document;\n}\n\n/**\n * Create DOM element for XML.\n *\n * @param tagName Name of DOM element.\n * @returns New DOM element.\n * @alias Blockly.utils.xml.createElement\n */\nexport function createElement(tagName: string): Element {\n return xmlDocument.createElementNS(NAME_SPACE, tagName);\n}\n\n/**\n * Create text element for XML.\n *\n * @param text Text content.\n * @returns New DOM text node.\n * @alias Blockly.utils.xml.createTextNode\n */\nexport function createTextNode(text: string): Text {\n return xmlDocument.createTextNode(text);\n}\n\n/**\n * Converts an XML string into a DOM tree.\n *\n * @param text XML string.\n * @returns The DOM document.\n * @throws if XML doesn't parse.\n * @alias Blockly.utils.xml.textToDomDocument\n */\nexport function textToDomDocument(text: string): Document {\n const oParser = new DOMParser();\n return oParser.parseFromString(text, 'text/xml');\n}\n\n/**\n * Converts a DOM structure into plain text.\n * Currently the text format is fairly ugly: all one line with no whitespace.\n *\n * @param dom A tree of XML nodes.\n * @returns Text representation.\n * @alias Blockly.utils.xml.domToText\n */\nexport function domToText(dom: Node): string {\n const oSerializer = new XMLSerializer();\n return oSerializer.serializeToString(dom);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Wrapper functions around JS functions for showing alert/confirmation dialogs.\n *\n * @namespace Blockly.dialog\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.dialog');\n\n\nlet alertImplementation = function(message: string, opt_callback?: () => void) {\n window.alert(message);\n if (opt_callback) {\n opt_callback();\n }\n};\n\nlet confirmImplementation = function(\n message: string, callback: (result: boolean) => void) {\n callback(window.confirm(message));\n};\n\nlet promptImplementation = function(\n message: string, defaultValue: string,\n callback: (result: string|null) => void) {\n callback(window.prompt(message, defaultValue));\n};\n\n/**\n * Wrapper to window.alert() that app developers may override via setAlert to\n * provide alternatives to the modal browser window.\n *\n * @param message The message to display to the user.\n * @param opt_callback The callback when the alert is dismissed.\n * @alias Blockly.dialog.alert\n */\nexport function alert(message: string, opt_callback?: () => void) {\n alertImplementation(message, opt_callback);\n}\n\n/**\n * Sets the function to be run when Blockly.dialog.alert() is called.\n *\n * @param alertFunction The function to be run.\n * @see Blockly.dialog.alert\n * @alias Blockly.dialog.setAlert\n */\nexport function setAlert(alertFunction: (p1: string, p2?: () => void) => void) {\n alertImplementation = alertFunction;\n}\n\n/**\n * Wrapper to window.confirm() that app developers may override via setConfirm\n * to provide alternatives to the modal browser window.\n *\n * @param message The message to display to the user.\n * @param callback The callback for handling user response.\n * @alias Blockly.dialog.confirm\n */\nexport function confirm(message: string, callback: (p1: boolean) => void) {\n TEST_ONLY.confirmInternal(message, callback);\n}\n\n/**\n * Private version of confirm for stubbing in tests.\n */\nfunction confirmInternal(message: string, callback: (p1: boolean) => void) {\n confirmImplementation(message, callback);\n}\n\n\n/**\n * Sets the function to be run when Blockly.dialog.confirm() is called.\n *\n * @param confirmFunction The function to be run.\n * @see Blockly.dialog.confirm\n * @alias Blockly.dialog.setConfirm\n */\nexport function setConfirm(\n confirmFunction: (p1: string, p2: (p1: boolean) => void) => void) {\n confirmImplementation = confirmFunction;\n}\n\n/**\n * Wrapper to window.prompt() that app developers may override via setPrompt to\n * provide alternatives to the modal browser window. Built-in browser prompts\n * are often used for better text input experience on mobile device. We strongly\n * recommend testing mobile when overriding this.\n *\n * @param message The message to display to the user.\n * @param defaultValue The value to initialize the prompt with.\n * @param callback The callback for handling user response.\n * @alias Blockly.dialog.prompt\n */\nexport function prompt(\n message: string, defaultValue: string,\n callback: (p1: string|null) => void) {\n promptImplementation(message, defaultValue, callback);\n}\n\n/**\n * Sets the function to be run when Blockly.dialog.prompt() is called.\n *\n * @param promptFunction The function to be run.\n * @see Blockly.dialog.prompt\n * @alias Blockly.dialog.setPrompt\n */\nexport function setPrompt(\n promptFunction: (p1: string, p2: string, p3: (p1: string|null) => void) =>\n void) {\n promptImplementation = promptFunction;\n}\n\nexport const TEST_ONLY = {\n confirmInternal,\n};\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility functions for handling variables.\n *\n * @namespace Blockly.Variables\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Variables');\n\nimport {Blocks} from './blocks.js';\nimport * as dialog from './dialog.js';\nimport {Msg} from './msg.js';\nimport * as utilsXml from './utils/xml.js';\nimport {VariableModel} from './variable_model.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\n\n\n/**\n * String for use in the \"custom\" attribute of a category in toolbox XML.\n * This string indicates that the category should be dynamically populated with\n * variable blocks.\n * See also Blockly.Procedures.CATEGORY_NAME and\n * Blockly.VariablesDynamic.CATEGORY_NAME.\n *\n * @alias Blockly.Variables.CATEGORY_NAME\n */\nexport const CATEGORY_NAME = 'VARIABLE';\n\n/**\n * Find all user-created variables that are in use in the workspace.\n * For use by generators.\n * To get a list of all variables on a workspace, including unused variables,\n * call Workspace.getAllVariables.\n *\n * @param ws The workspace to search for variables.\n * @returns Array of variable models.\n * @alias Blockly.Variables.allUsedVarModels\n */\nexport function allUsedVarModels(ws: Workspace): VariableModel[] {\n const blocks = ws.getAllBlocks(false);\n const variables = new Set<VariableModel>();\n // Iterate through every block and add each variable to the set.\n for (let i = 0; i < blocks.length; i++) {\n const blockVariables = blocks[i].getVarModels();\n if (blockVariables) {\n for (let j = 0; j < blockVariables.length; j++) {\n const variable = blockVariables[j];\n const id = variable.getId();\n if (id) {\n variables.add(variable);\n }\n }\n }\n }\n // Convert the set into a list.\n return Array.from(variables.values());\n}\n\n/**\n * Find all developer variables used by blocks in the workspace.\n * Developer variables are never shown to the user, but are declared as global\n * variables in the generated code.\n * To declare developer variables, define the getDeveloperVariables function on\n * your block and return a list of variable names.\n * For use by generators.\n *\n * @param workspace The workspace to search.\n * @returns A list of non-duplicated variable names.\n * @alias Blockly.Variables.allDeveloperVariables\n */\nexport function allDeveloperVariables(workspace: Workspace): string[] {\n const blocks = workspace.getAllBlocks(false);\n const variables = new Set<string>();\n for (let i = 0, block; block = blocks[i]; i++) {\n const getDeveloperVariables = block.getDeveloperVariables;\n if (getDeveloperVariables) {\n const devVars = getDeveloperVariables();\n for (let j = 0; j < devVars.length; j++) {\n variables.add(devVars[j]);\n }\n }\n }\n // Convert the set into a list.\n return Array.from(variables.values());\n}\n\n/**\n * Construct the elements (blocks and button) required by the flyout for the\n * variable category.\n *\n * @param workspace The workspace containing variables.\n * @returns Array of XML elements.\n * @alias Blockly.Variables.flyoutCategory\n */\nexport function flyoutCategory(workspace: WorkspaceSvg): Element[] {\n let xmlList = new Array<Element>();\n const button = document.createElement('button');\n button.setAttribute('text', '%{BKY_NEW_VARIABLE}');\n button.setAttribute('callbackKey', 'CREATE_VARIABLE');\n\n workspace.registerButtonCallback('CREATE_VARIABLE', function(button) {\n createVariableButtonHandler(button.getTargetWorkspace());\n });\n\n xmlList.push(button);\n\n const blockList = flyoutCategoryBlocks(workspace);\n xmlList = xmlList.concat(blockList);\n return xmlList;\n}\n\n/**\n * Construct the blocks required by the flyout for the variable category.\n *\n * @param workspace The workspace containing variables.\n * @returns Array of XML block elements.\n * @alias Blockly.Variables.flyoutCategoryBlocks\n */\nexport function flyoutCategoryBlocks(workspace: Workspace): Element[] {\n const variableModelList = workspace.getVariablesOfType('');\n\n const xmlList = [];\n if (variableModelList.length > 0) {\n // New variables are added to the end of the variableModelList.\n const mostRecentVariable = variableModelList[variableModelList.length - 1];\n if (Blocks['variables_set']) {\n const block = utilsXml.createElement('block');\n block.setAttribute('type', 'variables_set');\n block.setAttribute('gap', Blocks['math_change'] ? '8' : '24');\n block.appendChild(generateVariableFieldDom(mostRecentVariable));\n xmlList.push(block);\n }\n if (Blocks['math_change']) {\n const block = utilsXml.createElement('block');\n block.setAttribute('type', 'math_change');\n block.setAttribute('gap', Blocks['variables_get'] ? '20' : '8');\n block.appendChild(generateVariableFieldDom(mostRecentVariable));\n const value = Xml.textToDom(\n '<value name=\"DELTA\">' +\n '<shadow type=\"math_number\">' +\n '<field name=\"NUM\">1</field>' +\n '</shadow>' +\n '</value>');\n block.appendChild(value);\n xmlList.push(block);\n }\n\n if (Blocks['variables_get']) {\n variableModelList.sort(VariableModel.compareByName);\n for (let i = 0, variable; variable = variableModelList[i]; i++) {\n const block = utilsXml.createElement('block');\n block.setAttribute('type', 'variables_get');\n block.setAttribute('gap', '8');\n block.appendChild(generateVariableFieldDom(variable));\n xmlList.push(block);\n }\n }\n }\n return xmlList;\n}\n\n/** @alias Blockly.Variables.VAR_LETTER_OPTIONS */\nexport const VAR_LETTER_OPTIONS = 'ijkmnopqrstuvwxyzabcdefgh';\n\n/**\n * Return a new variable name that is not yet being used. This will try to\n * generate single letter variable names in the range 'i' to 'z' to start with.\n * If no unique name is located it will try 'i' to 'z', 'a' to 'h',\n * then 'i2' to 'z2' etc. Skip 'l'.\n *\n * @param workspace The workspace to be unique in.\n * @returns New variable name.\n * @alias Blockly.Variables.generateUniqueName\n */\nexport function generateUniqueName(workspace: Workspace): string {\n return TEST_ONLY.generateUniqueNameInternal(workspace);\n}\n\n/**\n * Private version of generateUniqueName for stubbing in tests.\n */\nfunction generateUniqueNameInternal(workspace: Workspace): string {\n return generateUniqueNameFromOptions(\n VAR_LETTER_OPTIONS.charAt(0), workspace.getAllVariableNames());\n}\n\n/**\n * Returns a unique name that is not present in the usedNames array. This\n * will try to generate single letter names in the range a - z (skip l). It\n * will start with the character passed to startChar.\n *\n * @param startChar The character to start the search at.\n * @param usedNames A list of all of the used names.\n * @returns A unique name that is not present in the usedNames array.\n * @alias Blockly.Variables.generateUniqueNameFromOptions\n */\nexport function generateUniqueNameFromOptions(\n startChar: string, usedNames: string[]): string {\n if (!usedNames.length) {\n return startChar;\n }\n\n const letters = VAR_LETTER_OPTIONS;\n let suffix = '';\n let letterIndex = letters.indexOf(startChar);\n let potName = startChar;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n let inUse = false;\n for (let i = 0; i < usedNames.length; i++) {\n if (usedNames[i].toLowerCase() === potName) {\n inUse = true;\n break;\n }\n }\n if (!inUse) {\n return potName;\n }\n\n letterIndex++;\n if (letterIndex === letters.length) {\n // Reached the end of the character sequence so back to 'i'.\n letterIndex = 0;\n suffix = `${Number(suffix) + 1}`;\n }\n potName = letters.charAt(letterIndex) + suffix;\n }\n}\n\n/**\n * Handles \"Create Variable\" button in the default variables toolbox category.\n * It will prompt the user for a variable name, including re-prompts if a name\n * is already in use among the workspace's variables.\n *\n * Custom button handlers can delegate to this function, allowing variables\n * types and after-creation processing. More complex customization (e.g.,\n * prompting for variable type) is beyond the scope of this function.\n *\n * @param workspace The workspace on which to create the variable.\n * @param opt_callback A callback. It will be passed an acceptable new variable\n * name, or null if change is to be aborted (cancel button), or undefined if\n * an existing variable was chosen.\n * @param opt_type The type of the variable like 'int', 'string', or ''. This\n * will default to '', which is a specific type.\n * @alias Blockly.Variables.createVariableButtonHandler\n */\nexport function createVariableButtonHandler(\n workspace: Workspace, opt_callback?: (p1?: string|null) => void,\n opt_type?: string) {\n const type = opt_type || '';\n // This function needs to be named so it can be called recursively.\n function promptAndCheckWithAlert(defaultName: string) {\n promptName(Msg['NEW_VARIABLE_TITLE'], defaultName, function(text) {\n if (text) {\n const existing = nameUsedWithAnyType(text, workspace);\n if (existing) {\n let msg;\n if (existing.type === type) {\n msg = Msg['VARIABLE_ALREADY_EXISTS'].replace('%1', existing.name);\n } else {\n msg = Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE'];\n msg = msg.replace('%1', existing.name).replace('%2', existing.type);\n }\n dialog.alert(msg, function() {\n promptAndCheckWithAlert(text);\n });\n } else {\n // No conflict\n workspace.createVariable(text, type);\n if (opt_callback) {\n opt_callback(text);\n }\n }\n } else {\n // User canceled prompt.\n if (opt_callback) {\n opt_callback(null);\n }\n }\n });\n }\n promptAndCheckWithAlert('');\n}\n\n/**\n * Opens a prompt that allows the user to enter a new name for a variable.\n * Triggers a rename if the new name is valid. Or re-prompts if there is a\n * collision.\n *\n * @param workspace The workspace on which to rename the variable.\n * @param variable Variable to rename.\n * @param opt_callback A callback. It will be passed an acceptable new variable\n * name, or null if change is to be aborted (cancel button), or undefined if\n * an existing variable was chosen.\n * @alias Blockly.Variables.renameVariable\n */\nexport function renameVariable(\n workspace: Workspace, variable: VariableModel,\n opt_callback?: (p1?: string|null) => void) {\n // This function needs to be named so it can be called recursively.\n function promptAndCheckWithAlert(defaultName: string) {\n const promptText =\n Msg['RENAME_VARIABLE_TITLE'].replace('%1', variable.name);\n promptName(promptText, defaultName, function(newName) {\n if (newName) {\n const existing =\n nameUsedWithOtherType(newName, variable.type, workspace);\n if (existing) {\n const msg = Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE']\n .replace('%1', existing.name)\n .replace('%2', existing.type);\n dialog.alert(msg, function() {\n promptAndCheckWithAlert(newName);\n });\n } else {\n workspace.renameVariableById(variable.getId(), newName);\n if (opt_callback) {\n opt_callback(newName);\n }\n }\n } else {\n // User canceled prompt.\n if (opt_callback) {\n opt_callback(null);\n }\n }\n });\n }\n promptAndCheckWithAlert('');\n}\n\n/**\n * Prompt the user for a new variable name.\n *\n * @param promptText The string of the prompt.\n * @param defaultText The default value to show in the prompt's field.\n * @param callback A callback. It will be passed the new variable name, or null\n * if the user picked something illegal.\n * @alias Blockly.Variables.promptName\n */\nexport function promptName(\n promptText: string, defaultText: string,\n callback: (p1: string|null) => void) {\n dialog.prompt(promptText, defaultText, function(newVar) {\n // Merge runs of whitespace. Strip leading and trailing whitespace.\n // Beyond this, all names are legal.\n if (newVar) {\n newVar = newVar.replace(/[\\s\\xa0]+/g, ' ').trim();\n if (newVar === Msg['RENAME_VARIABLE'] || newVar === Msg['NEW_VARIABLE']) {\n // Ok, not ALL names are legal...\n newVar = null;\n }\n }\n callback(newVar);\n });\n}\n/**\n * Check whether there exists a variable with the given name but a different\n * type.\n *\n * @param name The name to search for.\n * @param type The type to exclude from the search.\n * @param workspace The workspace to search for the variable.\n * @returns The variable with the given name and a different type, or null if\n * none was found.\n */\nfunction nameUsedWithOtherType(\n name: string, type: string, workspace: Workspace): VariableModel|null {\n const allVariables = workspace.getVariableMap().getAllVariables();\n\n name = name.toLowerCase();\n for (let i = 0, variable; variable = allVariables[i]; i++) {\n if (variable.name.toLowerCase() === name && variable.type !== type) {\n return variable;\n }\n }\n return null;\n}\n\n/**\n * Check whether there exists a variable with the given name of any type.\n *\n * @param name The name to search for.\n * @param workspace The workspace to search for the variable.\n * @returns The variable with the given name, or null if none was found.\n * @alias Blockly.Variables.nameUsedWithAnyType\n */\nexport function nameUsedWithAnyType(\n name: string, workspace: Workspace): VariableModel|null {\n const allVariables = workspace.getVariableMap().getAllVariables();\n\n name = name.toLowerCase();\n for (let i = 0, variable; variable = allVariables[i]; i++) {\n if (variable.name.toLowerCase() === name) {\n return variable;\n }\n }\n return null;\n}\n\n/**\n * Generate DOM objects representing a variable field.\n *\n * @param variableModel The variable model to represent.\n * @returns The generated DOM.\n * @alias Blockly.Variables.generateVariableFieldDom\n */\nexport function generateVariableFieldDom(variableModel: VariableModel):\n Element {\n /* Generates the following XML:\n * <field name=\"VAR\" id=\"goKTKmYJ8DhVHpruv\" variabletype=\"int\">foo</field>\n */\n const field = utilsXml.createElement('field');\n field.setAttribute('name', 'VAR');\n field.setAttribute('id', variableModel.getId());\n field.setAttribute('variabletype', variableModel.type);\n const name = utilsXml.createTextNode(variableModel.name);\n field.appendChild(name);\n return field;\n}\n\n/**\n * Helper function to look up or create a variable on the given workspace.\n * If no variable exists, creates and returns it.\n *\n * @param workspace The workspace to search for the variable. It may be a\n * flyout workspace or main workspace.\n * @param id The ID to use to look up or create the variable, or null.\n * @param opt_name The string to use to look up or create the variable.\n * @param opt_type The type to use to look up or create the variable.\n * @returns The variable corresponding to the given ID or name + type\n * combination.\n * @alias Blockly.Variables.getOrCreateVariablePackage\n */\nexport function getOrCreateVariablePackage(\n workspace: Workspace, id: string|null, opt_name?: string,\n opt_type?: string): VariableModel {\n let variable = getVariable(workspace, id, opt_name, opt_type);\n if (!variable) {\n variable = createVariable(workspace, id, opt_name, opt_type);\n }\n return variable;\n}\n\n/**\n * Look up a variable on the given workspace.\n * Always looks in the main workspace before looking in the flyout workspace.\n * Always prefers lookup by ID to lookup by name + type.\n *\n * @param workspace The workspace to search for the variable. It may be a\n * flyout workspace or main workspace.\n * @param id The ID to use to look up the variable, or null.\n * @param opt_name The string to use to look up the variable.\n * Only used if lookup by ID fails.\n * @param opt_type The type to use to look up the variable.\n * Only used if lookup by ID fails.\n * @returns The variable corresponding to the given ID or name + type\n * combination, or null if not found.\n * @alias Blockly.Variables.getVariable\n */\nexport function getVariable(\n workspace: Workspace, id: string|null, opt_name?: string,\n opt_type?: string): VariableModel|null {\n const potentialVariableMap = workspace.getPotentialVariableMap();\n let variable = null;\n // Try to just get the variable, by ID if possible.\n if (id) {\n // Look in the real variable map before checking the potential variable map.\n variable = workspace.getVariableById(id);\n if (!variable && potentialVariableMap) {\n variable = potentialVariableMap.getVariableById(id);\n }\n if (variable) {\n return variable;\n }\n }\n // If there was no ID, or there was an ID but it didn't match any variables,\n // look up by name and type.\n if (opt_name) {\n if (opt_type === undefined) {\n throw Error('Tried to look up a variable by name without a type');\n }\n // Otherwise look up by name and type.\n variable = workspace.getVariable(opt_name, opt_type);\n if (!variable && potentialVariableMap) {\n variable = potentialVariableMap.getVariable(opt_name, opt_type);\n }\n }\n return variable;\n}\n\n/**\n * Helper function to create a variable on the given workspace.\n *\n * @param workspace The workspace in which to create the variable. It may be a\n * flyout workspace or main workspace.\n * @param id The ID to use to create the variable, or null.\n * @param opt_name The string to use to create the variable.\n * @param opt_type The type to use to create the variable.\n * @returns The variable corresponding to the given ID or name + type\n * combination.\n */\nfunction createVariable(\n workspace: Workspace, id: string|null, opt_name?: string,\n opt_type?: string): VariableModel {\n const potentialVariableMap = workspace.getPotentialVariableMap();\n // Variables without names get uniquely named for this workspace.\n if (!opt_name) {\n const ws =\n (workspace.isFlyout ? (workspace as WorkspaceSvg).targetWorkspace :\n workspace);\n opt_name = generateUniqueName(ws!);\n }\n\n // Create a potential variable if in the flyout.\n let variable = null;\n if (potentialVariableMap) {\n variable = potentialVariableMap.createVariable(opt_name, opt_type, id);\n } else {\n // In the main workspace, create a real variable.\n variable = workspace.createVariable(opt_name, opt_type, id);\n }\n return variable;\n}\n\n/**\n * Helper function to get the list of variables that have been added to the\n * workspace after adding a new block, using the given list of variables that\n * were in the workspace before the new block was added.\n *\n * @param workspace The workspace to inspect.\n * @param originalVariables The array of variables that existed in the workspace\n * before adding the new block.\n * @returns The new array of variables that were freshly added to the workspace\n * after creating the new block, or [] if no new variables were added to the\n * workspace.\n * @alias Blockly.Variables.getAddedVariables\n * @internal\n */\nexport function getAddedVariables(\n workspace: Workspace, originalVariables: VariableModel[]): VariableModel[] {\n const allCurrentVariables = workspace.getAllVariables();\n const addedVariables = [];\n if (originalVariables.length !== allCurrentVariables.length) {\n for (let i = 0; i < allCurrentVariables.length; i++) {\n const variable = allCurrentVariables[i];\n // For any variable that is present in allCurrentVariables but not\n // present in originalVariables, add the variable to addedVariables.\n if (originalVariables.indexOf(variable) === -1) {\n addedVariables.push(variable);\n }\n }\n }\n return addedVariables;\n}\n\nexport const TEST_ONLY = {\n generateUniqueNameInternal,\n};\n","/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Inject Blockly's CSS synchronously.\n *\n * @namespace Blockly.Css\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Css');\n\n\n/** Has CSS already been injected? */\nlet injected = false;\n\n/**\n * Add some CSS to the blob that will be injected later. Allows optional\n * components such as fields and the toolbox to store separate CSS.\n *\n * @param cssContent Multiline CSS string or an array of single lines of CSS.\n * @alias Blockly.Css.register\n */\nexport function register(cssContent: string) {\n if (injected) {\n throw Error('CSS already injected');\n }\n content += '\\n' + cssContent;\n}\n\n/**\n * Inject the CSS into the DOM. This is preferable over using a regular CSS\n * file since:\n * a) It loads synchronously and doesn't force a redraw later.\n * b) It speeds up loading by not blocking on a separate HTTP transfer.\n * c) The CSS content may be made dynamic depending on init options.\n *\n * @param hasCss If false, don't inject CSS (providing CSS becomes the\n * document's responsibility).\n * @param pathToMedia Path from page to the Blockly media directory.\n * @alias Blockly.Css.inject\n */\nexport function inject(hasCss: boolean, pathToMedia: string) {\n // Only inject the CSS once.\n if (injected) {\n return;\n }\n injected = true;\n if (!hasCss) {\n return;\n }\n // Strip off any trailing slash (either Unix or Windows).\n const mediaPath = pathToMedia.replace(/[\\\\/]$/, '');\n const cssContent = content.replace(/<<<PATH>>>/g, mediaPath);\n // Cleanup the collected css content after injecting it to the DOM.\n content = '';\n\n // Inject CSS tag at start of head.\n const cssNode = document.createElement('style');\n cssNode.id = 'blockly-common-style';\n const cssTextNode = document.createTextNode(cssContent);\n cssNode.appendChild(cssTextNode);\n document.head.insertBefore(cssNode, document.head.firstChild);\n}\n\n/**\n * The CSS content for Blockly.\n *\n * @alias Blockly.Css.content\n */\nlet content = `\n.blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}\n\n.blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}\n\n.injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n}\n\n.blocklyNonSelectable {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyWsDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n/* Added as a separate rule with multiple classes to make it more specific\n than a bootstrap rule that selects svg:root. See issue #1275 for context.\n*/\n.blocklyWsDragSurface.blocklyOverflowVisible {\n overflow: visible;\n}\n\n.blocklyBlockDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: visible !important;\n z-index: 50; /* Display below toolbox, but above everything else. */\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\n}\n\n.blocklyTooltipDiv {\n background-color: #ffffc7;\n border: 1px solid #ddc;\n box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);\n color: #000;\n display: none;\n font: 9pt sans-serif;\n opacity: .9;\n padding: 2px;\n position: absolute;\n z-index: 100000; /* big value for bootstrap3 compatibility */\n}\n\n.blocklyDropDownDiv {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n display: none;\n border: 1px solid;\n border-color: #dadce0;\n background-color: #fff;\n border-radius: 2px;\n padding: 4px;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownContent {\n max-height: 300px; // @todo: spec for maximum height.\n overflow: auto;\n overflow-x: hidden;\n position: relative;\n}\n\n.blocklyDropDownArrow {\n position: absolute;\n left: 0;\n top: 0;\n width: 16px;\n height: 16px;\n z-index: -1;\n background-color: inherit;\n border-color: inherit;\n}\n\n.blocklyDropDownButton {\n display: inline-block;\n float: left;\n padding: 0;\n margin: 4px;\n border-radius: 4px;\n outline: none;\n border: 1px solid;\n transition: box-shadow .1s;\n cursor: pointer;\n}\n\n.blocklyArrowTop {\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyArrowBottom {\n border-bottom: 1px solid;\n border-right: 1px solid;\n border-bottom-right-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyResizeSE {\n cursor: se-resize;\n fill: #aaa;\n}\n\n.blocklyResizeSW {\n cursor: sw-resize;\n fill: #aaa;\n}\n\n.blocklyResizeLine {\n stroke: #515A5A;\n stroke-width: 1;\n}\n\n.blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}\n\n.blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.blocklySelected>.blocklyPathLight {\n display: none;\n}\n\n.blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don't support grab */\n cursor: url(\"<<<PATH>>>/handopen.cur\"), auto;\n cursor: grab;\n cursor: -webkit-grab;\n}\n\n /* backup for browsers (e.g. IE11) that don't support grabbing */\n.blocklyDragging {\n /* backup for browsers (e.g. IE11) that don't support grabbing */\n cursor: url(\"<<<PATH>>>/handclosed.cur\"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n /* Changes cursor on mouse down. Not effective in Firefox because of\n https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */\n.blocklyDraggable:active {\n /* backup for browsers (e.g. IE11) that don't support grabbing */\n cursor: url(\"<<<PATH>>>/handclosed.cur\"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Change the cursor on the whole drag surface in case the mouse gets\n ahead of block during a drag. This way the cursor is still a closed hand.\n */\n.blocklyBlockDragSurface .blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don't support grabbing */\n cursor: url(\"<<<PATH>>>/handclosed.cur\"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete {\n cursor: url(\"<<<PATH>>>/handdelete.cur\"), auto;\n}\n\n.blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}\n\n.blocklyDragging>.blocklyPathDark {\n display: none;\n}\n\n.blocklyDisabled>.blocklyPath {\n fill-opacity: .5;\n stroke-opacity: .5;\n}\n\n.blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}\n\n.blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}\n\n.blocklyMultilineText {\n font-family: monospace;\n}\n\n.blocklyNonEditableText>text {\n pointer-events: none;\n}\n\n.blocklyFlyout {\n position: absolute;\n z-index: 20;\n}\n\n.blocklyText text {\n cursor: default;\n}\n\n/*\n Don't allow users to select text. It gets annoying when trying to\n drag a block and selected text moves instead.\n*/\n.blocklySvg text,\n.blocklyBlockDragSurface text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}\n\n.blocklyHidden {\n display: none;\n}\n\n.blocklyFieldDropdown:not(.blocklyHidden) {\n display: block;\n}\n\n.blocklyIconGroup {\n cursor: default;\n}\n\n.blocklyIconGroup:not(:hover),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}\n\n.blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}\n\n.blocklyIconSymbol {\n fill: #fff;\n}\n\n.blocklyMinimalBody {\n margin: 0;\n padding: 0;\n}\n\n.blocklyHtmlInput {\n border: none;\n border-radius: 4px;\n height: 100%;\n margin: 0;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: center;\n display: block;\n box-sizing: border-box;\n}\n\n/* Edge and IE introduce a close icon when the input value is longer than a\n certain length. This affects our sizing calculations of the text input.\n Hiding the close icon to avoid that. */\n.blocklyHtmlInput::-ms-clear {\n display: none;\n}\n\n.blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */\n}\n\n.blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}\n\n.blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}\n\n.blocklyFlyoutScrollbar {\n z-index: 30;\n}\n\n.blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}\n\n.blocklyScrollbarBackground {\n opacity: 0;\n}\n\n.blocklyScrollbarHandle {\n fill: #ccc;\n}\n\n.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}\n\n/* Darken flyout scrollbars due to being on a grey background. */\n/* By contrast, workspace scrollbars are on a white background. */\n.blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}\n\n.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}\n\n.blocklyInvalidInput {\n background: #faa;\n}\n\n.blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}\n\n.blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.blocklyNoPointerEvents {\n pointer-events: none;\n}\n\n.blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}\n\n.blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}\n\n.blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}\n\n/* BiDi override for the resting state. */\n.blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\n}\n\n.blocklyWidgetDiv .blocklyMenu {\n background: #fff;\n border: 1px solid transparent;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n font: normal 13px Arial, sans-serif;\n margin: 0;\n outline: none;\n padding: 4px 0;\n position: absolute;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n.blocklyWidgetDiv .blocklyMenu.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n background: inherit; /* Compatibility with gapi, reset from goog-menu */\n border: inherit; /* Compatibility with gapi, reset from goog-menu */\n font: normal 13px \"Helvetica Neue\", Helvetica, sans-serif;\n outline: none;\n position: relative; /* Compatibility with gapi, reset from goog-menu */\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n/* State: resting. */\n.blocklyMenuItem {\n border: none;\n color: #000;\n cursor: pointer;\n list-style: none;\n margin: 0;\n /* 7em on the right for shortcut. */\n min-width: 7em;\n padding: 6px 15px;\n white-space: nowrap;\n}\n\n/* State: disabled. */\n.blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}\n\n/* State: hover. */\n.blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}\n\n/* State: selected/checked. */\n.blocklyMenuItemCheckbox {\n height: 16px;\n position: absolute;\n width: 16px;\n}\n\n.blocklyMenuItemSelected .blocklyMenuItemCheckbox {\n background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;\n float: left;\n margin-left: -24px;\n position: static; /* Scroll with the menu. */\n}\n\n.blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}\n`;\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods realted to figuring out positions of SVG elements.\n *\n * @namespace Blockly.utils.svgMath\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.svgMath');\n\nimport type {WorkspaceSvg} from '../workspace_svg.js';\n\nimport {Coordinate} from './coordinate.js';\nimport * as deprecation from './deprecation.js';\nimport {Rect} from './rect.js';\nimport * as style from './style.js';\n\n\n/**\n * Static regex to pull the x,y values out of an SVG translate() directive.\n * Note that Firefox and IE (9,10) return 'translate(12)' instead of\n * 'translate(12, 0)'.\n * Note that IE (9,10) returns 'translate(16 8)' instead of 'translate(16, 8)'.\n * Note that IE has been reported to return scientific notation (0.123456e-42).\n */\nconst XY_REGEX = /translate\\(\\s*([-+\\d.e]+)([ ,]\\s*([-+\\d.e]+)\\s*)?/;\n\n/**\n * Static regex to pull the x,y values out of a translate() or translate3d()\n * style property.\n * Accounts for same exceptions as XY_REGEX.\n */\nconst XY_STYLE_REGEX =\n /transform:\\s*translate(?:3d)?\\(\\s*([-+\\d.e]+)\\s*px([ ,]\\s*([-+\\d.e]+)\\s*px)?/;\n\n/**\n * Return the coordinates of the top-left corner of this element relative to\n * its parent. Only for SVG elements and children (e.g. rect, g, path).\n *\n * @param element SVG element to find the coordinates of.\n * @returns Object with .x and .y properties.\n * @alias Blockly.utils.svgMath.getRelativeXY\n */\nexport function getRelativeXY(element: Element): Coordinate {\n const xy = new Coordinate(0, 0);\n // First, check for x and y attributes.\n // Checking for the existence of x/y properties is faster than getAttribute.\n // However, x/y contains an SVGAnimatedLength object, so rely on getAttribute\n // to get the number.\n const x = (element as any).x && element.getAttribute('x');\n const y = (element as any).y && element.getAttribute('y');\n if (x) {\n xy.x = parseInt(x);\n }\n if (y) {\n xy.y = parseInt(y);\n }\n // Second, check for transform=\"translate(...)\" attribute.\n const transform = element.getAttribute('transform');\n const r = transform && transform.match(XY_REGEX);\n if (r) {\n xy.x += Number(r[1]);\n if (r[3]) {\n xy.y += Number(r[3]);\n }\n }\n\n // Then check for style = transform: translate(...) or translate3d(...)\n const style = element.getAttribute('style');\n if (style && style.indexOf('translate') > -1) {\n const styleComponents = style.match(XY_STYLE_REGEX);\n if (styleComponents) {\n xy.x += Number(styleComponents[1]);\n if (styleComponents[3]) {\n xy.y += Number(styleComponents[3]);\n }\n }\n }\n return xy;\n}\n\n/**\n * Return the coordinates of the top-left corner of this element relative to\n * the div Blockly was injected into.\n *\n * @param element SVG element to find the coordinates of. If this is not a child\n * of the div Blockly was injected into, the behaviour is undefined.\n * @returns Object with .x and .y properties.\n * @alias Blockly.utils.svgMath.getInjectionDivXY\n */\nexport function getInjectionDivXY(element: Element): Coordinate {\n let x = 0;\n let y = 0;\n while (element) {\n const xy = getRelativeXY(element);\n x = x + xy.x;\n y = y + xy.y;\n const classes = element.getAttribute('class') || '';\n if ((' ' + classes + ' ').indexOf(' injectionDiv ') !== -1) {\n break;\n }\n element = element.parentNode as Element;\n }\n return new Coordinate(x, y);\n}\n\n/**\n * Check if 3D transforms are supported by adding an element\n * and attempting to set the property.\n *\n * @returns True if 3D transforms are supported.\n * @deprecated No longer provided by Blockly.\n * @alias Blockly.utils.svgMath.is3dSupported\n */\nexport function is3dSupported(): boolean {\n // All browsers support translate3d in 2022.\n deprecation.warn(\n 'Blockly.utils.svgMath.is3dSupported', 'version 9', 'version 10');\n return true;\n}\n\n/**\n * Get the position of the current viewport in window coordinates. This takes\n * scroll into account.\n *\n * @returns An object containing window width, height, and scroll position in\n * window coordinates.\n * @alias Blockly.utils.svgMath.getViewportBBox\n * @internal\n */\nexport function getViewportBBox(): Rect {\n // Pixels, in window coordinates.\n const scrollOffset = style.getViewportPageOffset();\n return new Rect(\n scrollOffset.y, document.documentElement.clientHeight + scrollOffset.y,\n scrollOffset.x, document.documentElement.clientWidth + scrollOffset.x);\n}\n\n/**\n * Gets the document scroll distance as a coordinate object.\n * Copied from Closure's goog.dom.getDocumentScroll.\n *\n * @returns Object with values 'x' and 'y'.\n * @alias Blockly.utils.svgMath.getDocumentScroll\n */\nexport function getDocumentScroll(): Coordinate {\n const el = document.documentElement;\n const win = window;\n return new Coordinate(\n win.pageXOffset || el.scrollLeft, win.pageYOffset || el.scrollTop);\n}\n\n/**\n * Converts screen coordinates to workspace coordinates.\n *\n * @param ws The workspace to find the coordinates on.\n * @param screenCoordinates The screen coordinates to be converted to workspace\n * coordinates\n * @returns The workspace coordinates.\n * @alias Blockly.utils.svgMath.screenToWsCoordinates\n */\nexport function screenToWsCoordinates(\n ws: WorkspaceSvg, screenCoordinates: Coordinate): Coordinate {\n const screenX = screenCoordinates.x;\n const screenY = screenCoordinates.y;\n\n const injectionDiv = ws.getInjectionDiv();\n // Bounding rect coordinates are in client coordinates, meaning that they\n // are in pixels relative to the upper left corner of the visible browser\n // window. These coordinates change when you scroll the browser window.\n const boundingRect = injectionDiv.getBoundingClientRect();\n\n // The client coordinates offset by the injection div's upper left corner.\n const clientOffsetPixels =\n new Coordinate(screenX - boundingRect.left, screenY - boundingRect.top);\n\n // The offset in pixels between the main workspace's origin and the upper\n // left corner of the injection div.\n const mainOffsetPixels = ws.getOriginOffsetInPixels();\n\n // The position of the new comment in pixels relative to the origin of the\n // main workspace.\n const finalOffsetPixels =\n Coordinate.difference(clientOffsetPixels, mainOffsetPixels);\n // The position in main workspace coordinates.\n const finalOffsetMainWs = finalOffsetPixels.scale(1 / ws.scale);\n return finalOffsetMainWs;\n}\n\nexport const TEST_ONLY = {\n XY_REGEX,\n XY_STYLE_REGEX,\n};\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * XML reader and writer.\n *\n * @namespace Blockly.Xml\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Xml');\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport type {Connection} from './connection.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Field} from './field.js';\nimport {inputTypes} from './input_types.js';\nimport * as dom from './utils/dom.js';\nimport {Size} from './utils/size.js';\nimport * as utilsXml from './utils/xml.js';\nimport type {VariableModel} from './variable_model.js';\nimport * as Variables from './variables.js';\nimport type {Workspace} from './workspace.js';\nimport {WorkspaceComment} from './workspace_comment.js';\nimport {WorkspaceCommentSvg} from './workspace_comment_svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Encode a block tree as XML.\n *\n * @param workspace The workspace containing blocks.\n * @param opt_noId True if the encoder should skip the block IDs.\n * @returns XML DOM element.\n * @alias Blockly.Xml.workspaceToDom\n */\nexport function workspaceToDom(\n workspace: Workspace, opt_noId?: boolean): Element {\n const treeXml = utilsXml.createElement('xml');\n const variablesElement =\n variablesToDom(Variables.allUsedVarModels(workspace));\n if (variablesElement.hasChildNodes()) {\n treeXml.appendChild(variablesElement);\n }\n const comments = workspace.getTopComments(true);\n for (let i = 0; i < comments.length; i++) {\n const comment = comments[i];\n treeXml.appendChild(comment.toXmlWithXY(opt_noId));\n }\n const blocks = workspace.getTopBlocks(true);\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n treeXml.appendChild(blockToDomWithXY(block, opt_noId));\n }\n return treeXml;\n}\n\n/**\n * Encode a list of variables as XML.\n *\n * @param variableList List of all variable models.\n * @returns Tree of XML elements.\n * @alias Blockly.Xml.variablesToDom\n */\nexport function variablesToDom(variableList: VariableModel[]): Element {\n const variables = utilsXml.createElement('variables');\n for (let i = 0; i < variableList.length; i++) {\n const variable = variableList[i];\n const element = utilsXml.createElement('variable');\n element.appendChild(utilsXml.createTextNode(variable.name));\n if (variable.type) {\n element.setAttribute('type', variable.type);\n }\n element.id = variable.getId();\n variables.appendChild(element);\n }\n return variables;\n}\n\n/**\n * Encode a block subtree as XML with XY coordinates.\n *\n * @param block The root block to encode.\n * @param opt_noId True if the encoder should skip the block ID.\n * @returns Tree of XML elements or an empty document fragment if the block was\n * an insertion marker.\n * @alias Blockly.Xml.blockToDomWithXY\n */\nexport function blockToDomWithXY(block: Block, opt_noId?: boolean): Element|\n DocumentFragment {\n if (block.isInsertionMarker()) { // Skip over insertion markers.\n block = block.getChildren(false)[0];\n if (!block) {\n // Disappears when appended.\n return new DocumentFragment();\n }\n }\n\n let width = 0; // Not used in LTR.\n if (block.workspace.RTL) {\n width = block.workspace.getWidth();\n }\n\n const element = blockToDom(block, opt_noId);\n const xy = block.getRelativeToSurfaceXY();\n // AnyDuringMigration because: Property 'setAttribute' does not exist on type\n // 'Element | DocumentFragment'.\n (element as AnyDuringMigration)\n .setAttribute('x', Math.round(block.workspace.RTL ? width - xy.x : xy.x));\n // AnyDuringMigration because: Property 'setAttribute' does not exist on type\n // 'Element | DocumentFragment'.\n (element as AnyDuringMigration).setAttribute('y', Math.round(xy.y));\n return element;\n}\n\n/**\n * Encode a field as XML.\n *\n * @param field The field to encode.\n * @returns XML element, or null if the field did not need to be serialized.\n */\nfunction fieldToDom(field: Field): Element|null {\n if (field.isSerializable()) {\n const container = utilsXml.createElement('field');\n container.setAttribute('name', field.name || '');\n return field.toXml(container);\n }\n return null;\n}\n\n/**\n * Encode all of a block's fields as XML and attach them to the given tree of\n * XML elements.\n *\n * @param block A block with fields to be encoded.\n * @param element The XML element to which the field DOM should be attached.\n */\nfunction allFieldsToDom(block: Block, element: Element) {\n for (let i = 0; i < block.inputList.length; i++) {\n const input = block.inputList[i];\n for (let j = 0; j < input.fieldRow.length; j++) {\n const field = input.fieldRow[j];\n const fieldDom = fieldToDom(field);\n if (fieldDom) {\n element.appendChild(fieldDom);\n }\n }\n }\n}\n\n/**\n * Encode a block subtree as XML.\n *\n * @param block The root block to encode.\n * @param opt_noId True if the encoder should skip the block ID.\n * @returns Tree of XML elements or an empty document fragment if the block was\n * an insertion marker.\n * @alias Blockly.Xml.blockToDom\n */\nexport function blockToDom(block: Block, opt_noId?: boolean): Element|\n DocumentFragment {\n // Skip over insertion markers.\n if (block.isInsertionMarker()) {\n const child = block.getChildren(false)[0];\n if (child) {\n return blockToDom(child);\n } else {\n // Disappears when appended.\n return new DocumentFragment();\n }\n }\n\n const element = utilsXml.createElement(block.isShadow() ? 'shadow' : 'block');\n element.setAttribute('type', block.type);\n if (!opt_noId) {\n // It's important to use setAttribute here otherwise IE11 won't serialize\n // the block's ID when domToText is called.\n element.setAttribute('id', block.id);\n }\n if (block.mutationToDom) {\n // Custom data for an advanced block.\n const mutation = block.mutationToDom();\n if (mutation && (mutation.hasChildNodes() || mutation.hasAttributes())) {\n element.appendChild(mutation);\n }\n }\n\n allFieldsToDom(block, element);\n\n const commentText = block.getCommentText();\n if (commentText) {\n const size = block.commentModel.size;\n const pinned = block.commentModel.pinned;\n\n const commentElement = utilsXml.createElement('comment');\n commentElement.appendChild(utilsXml.createTextNode(commentText));\n // AnyDuringMigration because: Argument of type 'boolean' is not assignable\n // to parameter of type 'string'.\n commentElement.setAttribute('pinned', pinned as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n commentElement.setAttribute('h', size.height as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n commentElement.setAttribute('w', size.width as AnyDuringMigration);\n\n element.appendChild(commentElement);\n }\n\n if (block.data) {\n const dataElement = utilsXml.createElement('data');\n dataElement.appendChild(utilsXml.createTextNode(block.data));\n element.appendChild(dataElement);\n }\n\n for (let i = 0; i < block.inputList.length; i++) {\n const input = block.inputList[i];\n let container: Element;\n let empty = true;\n if (input.type === inputTypes.DUMMY) {\n continue;\n } else {\n const childBlock = input.connection!.targetBlock();\n if (input.type === inputTypes.VALUE) {\n container = utilsXml.createElement('value');\n } else if (input.type === inputTypes.STATEMENT) {\n container = utilsXml.createElement('statement');\n }\n const childShadow = input.connection!.getShadowDom();\n if (childShadow && (!childBlock || !childBlock.isShadow())) {\n container!.appendChild(cloneShadow(childShadow, opt_noId));\n }\n if (childBlock) {\n const childElem = blockToDom(childBlock, opt_noId);\n if (childElem.nodeType === dom.NodeType.ELEMENT_NODE) {\n container!.appendChild(childElem);\n empty = false;\n }\n }\n }\n container!.setAttribute('name', input.name);\n if (!empty) {\n element.appendChild(container!);\n }\n }\n if (block.inputsInline !== undefined &&\n block.inputsInline !== block.inputsInlineDefault) {\n element.setAttribute('inline', block.inputsInline.toString());\n }\n if (block.isCollapsed()) {\n element.setAttribute('collapsed', 'true');\n }\n if (!block.isEnabled()) {\n element.setAttribute('disabled', 'true');\n }\n if (!block.isDeletable() && !block.isShadow()) {\n element.setAttribute('deletable', 'false');\n }\n if (!block.isMovable() && !block.isShadow()) {\n element.setAttribute('movable', 'false');\n }\n if (!block.isEditable()) {\n element.setAttribute('editable', 'false');\n }\n\n const nextBlock = block.getNextBlock();\n let container: Element;\n if (nextBlock) {\n const nextElem = blockToDom(nextBlock, opt_noId);\n if (nextElem.nodeType === dom.NodeType.ELEMENT_NODE) {\n container = utilsXml.createElement('next');\n container.appendChild(nextElem);\n element.appendChild(container);\n }\n }\n const nextShadow =\n block.nextConnection && block.nextConnection.getShadowDom();\n if (nextShadow && (!nextBlock || !nextBlock.isShadow())) {\n container!.appendChild(cloneShadow(nextShadow, opt_noId));\n }\n\n return element;\n}\n\n/**\n * Deeply clone the shadow's DOM so that changes don't back-wash to the block.\n *\n * @param shadow A tree of XML elements.\n * @param opt_noId True if the encoder should skip the block ID.\n * @returns A tree of XML elements.\n */\nfunction cloneShadow(shadow: Element, opt_noId?: boolean): Element {\n shadow = shadow.cloneNode(true) as Element;\n // Walk the tree looking for whitespace. Don't prune whitespace in a tag.\n let node: Node|null = shadow;\n let textNode;\n while (node) {\n if (opt_noId && node.nodeName === 'shadow') {\n // Strip off IDs from shadow blocks. There should never be a 'block' as\n // a child of a 'shadow', so no need to check that.\n (node as Element).removeAttribute('id');\n }\n if (node.firstChild) {\n node = node.firstChild;\n } else {\n while (node && !node.nextSibling) {\n textNode = node;\n node = node.parentNode;\n if (textNode.nodeType === dom.NodeType.TEXT_NODE &&\n (textNode as Text).data.trim() === '' &&\n node?.firstChild !== textNode) {\n // Prune whitespace after a tag.\n dom.removeNode(textNode);\n }\n }\n if (node) {\n textNode = node;\n node = node.nextSibling;\n if (textNode.nodeType === dom.NodeType.TEXT_NODE &&\n (textNode as Text).data.trim() === '') {\n // Prune whitespace before a tag.\n dom.removeNode(textNode);\n }\n }\n }\n }\n return shadow;\n}\n\n/**\n * Converts a DOM structure into plain text.\n * Currently the text format is fairly ugly: all one line with no whitespace,\n * unless the DOM itself has whitespace built-in.\n *\n * @param dom A tree of XML nodes.\n * @returns Text representation.\n * @alias Blockly.Xml.domToText\n */\nexport function domToText(dom: Node): string {\n const text = utilsXml.domToText(dom);\n // Unpack self-closing tags. These tags fail when embedded in HTML.\n // <block name=\"foo\"/> -> <block name=\"foo\"></block>\n return text.replace(/<(\\w+)([^<]*)\\/>/g, '<$1$2></$1>');\n}\n\n/**\n * Converts a DOM structure into properly indented text.\n *\n * @param dom A tree of XML elements.\n * @returns Text representation.\n * @alias Blockly.Xml.domToPrettyText\n */\nexport function domToPrettyText(dom: Node): string {\n // This function is not guaranteed to be correct for all XML.\n // But it handles the XML that Blockly generates.\n const blob = domToText(dom);\n // Place every open and close tag on its own line.\n const lines = blob.split('<');\n // Indent every line.\n let indent = '';\n for (let i = 1; i < lines.length; i++) {\n const line = lines[i];\n if (line[0] === '/') {\n indent = indent.substring(2);\n }\n lines[i] = indent + '<' + line;\n if (line[0] !== '/' && line.slice(-2) !== '/>') {\n indent += ' ';\n }\n }\n // Pull simple tags back together.\n // E.g. <foo></foo>\n let text = lines.join('\\n');\n text = text.replace(/(<(\\w+)\\b[^>]*>[^\\n]*)\\n *<\\/\\2>/g, '$1</$2>');\n // Trim leading blank line.\n return text.replace(/^\\n/, '');\n}\n\n/**\n * Converts an XML string into a DOM structure.\n *\n * @param text An XML string.\n * @returns A DOM object representing the singular child of the document\n * element.\n * @throws if the text doesn't parse.\n * @alias Blockly.Xml.textToDom\n */\nexport function textToDom(text: string): Element {\n const doc = utilsXml.textToDomDocument(text);\n if (!doc || !doc.documentElement ||\n doc.getElementsByTagName('parsererror').length) {\n throw Error('textToDom was unable to parse: ' + text);\n }\n return doc.documentElement;\n}\n\n/**\n * Clear the given workspace then decode an XML DOM and\n * create blocks on the workspace.\n *\n * @param xml XML DOM.\n * @param workspace The workspace.\n * @returns An array containing new block IDs.\n * @alias Blockly.Xml.clearWorkspaceAndLoadFromXml\n */\nexport function clearWorkspaceAndLoadFromXml(\n xml: Element, workspace: WorkspaceSvg): string[] {\n workspace.setResizesEnabled(false);\n workspace.clear();\n // AnyDuringMigration because: Argument of type 'WorkspaceSvg' is not\n // assignable to parameter of type 'Workspace'.\n const blockIds = domToWorkspace(xml, workspace as AnyDuringMigration);\n workspace.setResizesEnabled(true);\n return blockIds;\n}\n\n/**\n * Decode an XML DOM and create blocks on the workspace.\n *\n * @param xml XML DOM.\n * @param workspace The workspace.\n * @returns An array containing new block IDs.\n * @suppress {strictModuleDepCheck} Suppress module check while workspace\n * comments are not bundled in.\n * @alias Blockly.Xml.domToWorkspace\n */\nexport function domToWorkspace(xml: Element, workspace: Workspace): string[] {\n let width = 0; // Not used in LTR.\n if (workspace.RTL) {\n width = workspace.getWidth();\n }\n const newBlockIds = []; // A list of block IDs added by this call.\n dom.startTextWidthCache();\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n\n // Disable workspace resizes as an optimization.\n // Assume it is rendered so we can check.\n if ((workspace as WorkspaceSvg).setResizesEnabled) {\n (workspace as WorkspaceSvg).setResizesEnabled(false);\n }\n let variablesFirst = true;\n try {\n for (let i = 0, xmlChild; xmlChild = xml.childNodes[i]; i++) {\n const name = xmlChild.nodeName.toLowerCase();\n const xmlChildElement = xmlChild as Element;\n if (name === 'block' ||\n name === 'shadow' && !eventUtils.getRecordUndo()) {\n // Allow top-level shadow blocks if recordUndo is disabled since\n // that means an undo is in progress. Such a block is expected\n // to be moved to a nested destination in the next operation.\n const block = domToBlock(xmlChildElement, workspace);\n newBlockIds.push(block.id);\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string'.\n const blockX = xmlChildElement.hasAttribute('x') ?\n parseInt(xmlChildElement.getAttribute('x') as AnyDuringMigration) :\n 10;\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string'.\n const blockY = xmlChildElement.hasAttribute('y') ?\n parseInt(xmlChildElement.getAttribute('y') as AnyDuringMigration) :\n 10;\n if (!isNaN(blockX) && !isNaN(blockY)) {\n block.moveBy(workspace.RTL ? width - blockX : blockX, blockY);\n }\n variablesFirst = false;\n } else if (name === 'shadow') {\n throw TypeError('Shadow block cannot be a top-level block.');\n } else if (name === 'comment') {\n if (workspace.rendered) {\n WorkspaceCommentSvg.fromXmlRendered(\n xmlChildElement, workspace as WorkspaceSvg, width);\n } else {\n WorkspaceComment.fromXml(xmlChildElement, workspace);\n }\n } else if (name === 'variables') {\n if (variablesFirst) {\n domToVariables(xmlChildElement, workspace);\n } else {\n throw Error(\n '\\'variables\\' tag must exist once before block and ' +\n 'shadow tag elements in the workspace XML, but it was found in ' +\n 'another location.');\n }\n variablesFirst = false;\n }\n }\n } finally {\n if (!existingGroup) {\n eventUtils.setGroup(false);\n }\n dom.stopTextWidthCache();\n }\n // Re-enable workspace resizing.\n if ((workspace as WorkspaceSvg).setResizesEnabled) {\n (workspace as WorkspaceSvg).setResizesEnabled(true);\n }\n eventUtils.fire(new (eventUtils.get(eventUtils.FINISHED_LOADING))(workspace));\n return newBlockIds;\n}\n\n/**\n * Decode an XML DOM and create blocks on the workspace. Position the new\n * blocks immediately below prior blocks, aligned by their starting edge.\n *\n * @param xml The XML DOM.\n * @param workspace The workspace to add to.\n * @returns An array containing new block IDs.\n * @alias Blockly.Xml.appendDomToWorkspace\n */\nexport function appendDomToWorkspace(\n xml: Element, workspace: WorkspaceSvg): string[] {\n // First check if we have a WorkspaceSvg, otherwise the blocks have no shape\n // and the position does not matter.\n // Assume it is rendered so we can check.\n if (!(workspace as WorkspaceSvg).getBlocksBoundingBox) {\n return domToWorkspace(xml, workspace);\n }\n\n const bbox = (workspace as WorkspaceSvg).getBlocksBoundingBox();\n // Load the new blocks into the workspace and get the IDs of the new blocks.\n const newBlockIds = domToWorkspace(xml, workspace);\n if (bbox && bbox.top !== bbox.bottom) { // Check if any previous block.\n let offsetY = 0; // Offset to add to y of the new block.\n let offsetX = 0;\n const farY = bbox.bottom; // Bottom position.\n const topX = workspace.RTL ? bbox.right : bbox.left; // X of bounding box.\n // Check position of the new blocks.\n let newLeftX = Infinity; // X of top left corner.\n let newRightX = -Infinity; // X of top right corner.\n let newY = Infinity; // Y of top corner.\n const ySeparation = 10;\n for (let i = 0; i < newBlockIds.length; i++) {\n const blockXY =\n workspace.getBlockById(newBlockIds[i])!.getRelativeToSurfaceXY();\n if (blockXY.y < newY) {\n newY = blockXY.y;\n }\n if (blockXY.x < newLeftX) { // if we left align also on x\n newLeftX = blockXY.x;\n }\n if (blockXY.x > newRightX) { // if we right align also on x\n newRightX = blockXY.x;\n }\n }\n offsetY = farY - newY + ySeparation;\n offsetX = workspace.RTL ? topX - newRightX : topX - newLeftX;\n for (let i = 0; i < newBlockIds.length; i++) {\n const block = workspace.getBlockById(newBlockIds[i]);\n block!.moveBy(offsetX, offsetY);\n }\n }\n return newBlockIds;\n}\n\n/**\n * Decode an XML block tag and create a block (and possibly sub blocks) on the\n * workspace.\n *\n * @param xmlBlock XML block element.\n * @param workspace The workspace.\n * @returns The root block created.\n * @alias Blockly.Xml.domToBlock\n */\nexport function domToBlock(xmlBlock: Element, workspace: Workspace): Block {\n // Create top-level block.\n eventUtils.disable();\n const variablesBeforeCreation = workspace.getAllVariables();\n let topBlock;\n try {\n topBlock = domToBlockHeadless(xmlBlock, workspace);\n // Generate list of all blocks.\n if (workspace.rendered) {\n const topBlockSvg = topBlock as BlockSvg;\n const blocks = topBlock.getDescendants(false);\n topBlockSvg.setConnectionTracking(false);\n // Render each block.\n for (let i = blocks.length - 1; i >= 0; i--) {\n (blocks[i] as BlockSvg).initSvg();\n }\n for (let i = blocks.length - 1; i >= 0; i--) {\n (blocks[i] as BlockSvg).render(false);\n }\n // Populating the connection database may be deferred until after the\n // blocks have rendered.\n setTimeout(function() {\n if (!topBlockSvg.disposed) {\n topBlockSvg.setConnectionTracking(true);\n }\n }, 1);\n topBlockSvg.updateDisabled();\n // Allow the scrollbars to resize and move based on the new contents.\n // TODO(@picklesrus): #387. Remove when domToBlock avoids resizing.\n (workspace as WorkspaceSvg).resizeContents();\n } else {\n const blocks = topBlock.getDescendants(false);\n for (let i = blocks.length - 1; i >= 0; i--) {\n blocks[i].initModel();\n }\n }\n } finally {\n eventUtils.enable();\n }\n if (eventUtils.isEnabled()) {\n // AnyDuringMigration because: Property 'get' does not exist on type\n // '(name: string) => void'.\n const newVariables =\n Variables.getAddedVariables(workspace, variablesBeforeCreation);\n // Fire a VarCreate event for each (if any) new variable created.\n for (let i = 0; i < newVariables.length; i++) {\n const thisVariable = newVariables[i];\n eventUtils.fire(\n new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable));\n }\n // Block events come after var events, in case they refer to newly created\n // variables.\n eventUtils.fire(new (eventUtils.get(eventUtils.CREATE))(topBlock));\n }\n return topBlock;\n}\n\n/**\n * Decode an XML list of variables and add the variables to the workspace.\n *\n * @param xmlVariables List of XML variable elements.\n * @param workspace The workspace to which the variable should be added.\n * @alias Blockly.Xml.domToVariables\n */\nexport function domToVariables(xmlVariables: Element, workspace: Workspace) {\n for (let i = 0; i < xmlVariables.children.length; i++) {\n const xmlChild = xmlVariables.children[i];\n const type = xmlChild.getAttribute('type');\n const id = xmlChild.getAttribute('id');\n const name = xmlChild.textContent;\n\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string'.\n workspace.createVariable(name as AnyDuringMigration, type, id);\n }\n}\n\n/** A mapping of nodeName to node for child nodes of xmlBlock. */\ninterface childNodeTagMap {\n mutation: Element[];\n comment: Element[];\n data: Element[];\n field: Element[];\n input: Element[];\n next: Element[];\n}\n\n/**\n * Creates a mapping of childNodes for each supported XML tag for the provided\n * xmlBlock. Logs a warning for any encountered unsupported tags.\n *\n * @param xmlBlock XML block element.\n * @returns The childNode map from nodeName to node.\n */\nfunction mapSupportedXmlTags(xmlBlock: Element): childNodeTagMap {\n const childNodeMap = {\n mutation: new Array<Element>(),\n comment: new Array<Element>(),\n data: new Array<Element>(),\n field: new Array<Element>(),\n input: new Array<Element>(),\n next: new Array<Element>(),\n };\n for (let i = 0; i < xmlBlock.children.length; i++) {\n const xmlChild = xmlBlock.children[i];\n if (xmlChild.nodeType === dom.NodeType.TEXT_NODE) {\n // Ignore any text at the <block> level. It's all whitespace anyway.\n continue;\n }\n switch (xmlChild.nodeName.toLowerCase()) {\n case 'mutation':\n childNodeMap.mutation.push(xmlChild);\n break;\n case 'comment':\n childNodeMap.comment.push(xmlChild);\n break;\n case 'data':\n childNodeMap.data.push(xmlChild);\n break;\n case 'title':\n // Titles were renamed to field in December 2013.\n // Fall through.\n case 'field':\n childNodeMap.field.push(xmlChild);\n break;\n case 'value':\n case 'statement':\n childNodeMap.input.push(xmlChild);\n break;\n case 'next':\n childNodeMap.next.push(xmlChild);\n break;\n default:\n // Unknown tag; ignore. Same principle as HTML parsers.\n console.warn('Ignoring unknown tag: ' + xmlChild.nodeName);\n }\n }\n return childNodeMap;\n}\n\n/**\n * Applies mutation tag child nodes to the given block.\n *\n * @param xmlChildren Child nodes.\n * @param block The block to apply the child nodes on.\n * @returns True if mutation may have added some elements that need\n * initialization (requiring initSvg call).\n */\nfunction applyMutationTagNodes(xmlChildren: Element[], block: Block): boolean {\n let shouldCallInitSvg = false;\n for (let i = 0; i < xmlChildren.length; i++) {\n const xmlChild = xmlChildren[i];\n // Custom data for an advanced block.\n if (block.domToMutation) {\n block.domToMutation(xmlChild);\n if ((block as BlockSvg).initSvg) {\n // Mutation may have added some elements that need initializing.\n shouldCallInitSvg = true;\n }\n }\n }\n return shouldCallInitSvg;\n}\n\n/**\n * Applies comment tag child nodes to the given block.\n *\n * @param xmlChildren Child nodes.\n * @param block The block to apply the child nodes on.\n */\nfunction applyCommentTagNodes(xmlChildren: Element[], block: Block) {\n for (let i = 0; i < xmlChildren.length; i++) {\n const xmlChild = xmlChildren[i];\n const text = xmlChild.textContent;\n const pinned = xmlChild.getAttribute('pinned') === 'true';\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string'.\n const width = parseInt(xmlChild.getAttribute('w') as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string'.\n const height = parseInt(xmlChild.getAttribute('h') as AnyDuringMigration);\n\n block.setCommentText(text);\n block.commentModel.pinned = pinned;\n if (!isNaN(width) && !isNaN(height)) {\n block.commentModel.size = new Size(width, height);\n }\n\n if (pinned && (block as BlockSvg).getCommentIcon && !block.isInFlyout) {\n const blockSvg = block as BlockSvg;\n setTimeout(function() {\n blockSvg.getCommentIcon()!.setVisible(true);\n }, 1);\n }\n }\n}\n\n/**\n * Applies data tag child nodes to the given block.\n *\n * @param xmlChildren Child nodes.\n * @param block The block to apply the child nodes on.\n */\nfunction applyDataTagNodes(xmlChildren: Element[], block: Block) {\n for (let i = 0; i < xmlChildren.length; i++) {\n const xmlChild = xmlChildren[i];\n block.data = xmlChild.textContent;\n }\n}\n\n/**\n * Applies field tag child nodes to the given block.\n *\n * @param xmlChildren Child nodes.\n * @param block The block to apply the child nodes on.\n */\nfunction applyFieldTagNodes(xmlChildren: Element[], block: Block) {\n for (let i = 0; i < xmlChildren.length; i++) {\n const xmlChild = xmlChildren[i];\n const nodeName = xmlChild.getAttribute('name');\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string'.\n domToField(block, nodeName as AnyDuringMigration, xmlChild);\n }\n}\n\n/**\n * Finds any enclosed blocks or shadows within this XML node.\n *\n * @param xmlNode The XML node to extract child block info from.\n * @returns Any found child block.\n */\nfunction findChildBlocks(xmlNode: Element):\n {childBlockElement: Element|null, childShadowElement: Element|null} {\n const childBlockInfo = {childBlockElement: null, childShadowElement: null};\n for (let i = 0; i < xmlNode.childNodes.length; i++) {\n const xmlChild = xmlNode.childNodes[i];\n if (xmlChild.nodeType === dom.NodeType.ELEMENT_NODE) {\n if (xmlChild.nodeName.toLowerCase() === 'block') {\n // AnyDuringMigration because: Type 'Element' is not assignable to type\n // 'null'.\n childBlockInfo.childBlockElement =\n xmlChild as Element as AnyDuringMigration;\n } else if (xmlChild.nodeName.toLowerCase() === 'shadow') {\n // AnyDuringMigration because: Type 'Element' is not assignable to type\n // 'null'.\n childBlockInfo.childShadowElement =\n xmlChild as Element as AnyDuringMigration;\n }\n }\n }\n return childBlockInfo;\n}\n/**\n * Applies input child nodes (value or statement) to the given block.\n *\n * @param xmlChildren Child nodes.\n * @param workspace The workspace containing the given block.\n * @param block The block to apply the child nodes on.\n * @param prototypeName The prototype name of the block.\n */\nfunction applyInputTagNodes(\n xmlChildren: Element[], workspace: Workspace, block: Block,\n prototypeName: string) {\n for (let i = 0; i < xmlChildren.length; i++) {\n const xmlChild = xmlChildren[i];\n const nodeName = xmlChild.getAttribute('name');\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string'.\n const input = block.getInput(nodeName as AnyDuringMigration);\n if (!input) {\n console.warn(\n 'Ignoring non-existent input ' + nodeName + ' in block ' +\n prototypeName);\n break;\n }\n const childBlockInfo = findChildBlocks(xmlChild);\n if (childBlockInfo.childBlockElement) {\n if (!input.connection) {\n throw TypeError('Input connection does not exist.');\n }\n domToBlockHeadless(\n childBlockInfo.childBlockElement, workspace, input.connection, false);\n }\n // Set shadow after so we don't create a shadow we delete immediately.\n if (childBlockInfo.childShadowElement) {\n input.connection?.setShadowDom(childBlockInfo.childShadowElement);\n }\n }\n}\n\n/**\n * Applies next child nodes to the given block.\n *\n * @param xmlChildren Child nodes.\n * @param workspace The workspace containing the given block.\n * @param block The block to apply the child nodes on.\n */\nfunction applyNextTagNodes(\n xmlChildren: Element[], workspace: Workspace, block: Block) {\n for (let i = 0; i < xmlChildren.length; i++) {\n const xmlChild = xmlChildren[i];\n const childBlockInfo = findChildBlocks(xmlChild);\n if (childBlockInfo.childBlockElement) {\n if (!block.nextConnection) {\n throw TypeError('Next statement does not exist.');\n }\n // If there is more than one XML 'next' tag.\n if (block.nextConnection.isConnected()) {\n throw TypeError('Next statement is already connected.');\n }\n // Create child block.\n domToBlockHeadless(\n childBlockInfo.childBlockElement, workspace, block.nextConnection,\n true);\n }\n // Set shadow after so we don't create a shadow we delete immediately.\n if (childBlockInfo.childShadowElement && block.nextConnection) {\n block.nextConnection.setShadowDom(childBlockInfo.childShadowElement);\n }\n }\n}\n\n/**\n * Decode an XML block tag and create a block (and possibly sub blocks) on the\n * workspace.\n *\n * @param xmlBlock XML block element.\n * @param workspace The workspace.\n * @param parentConnection The parent connection to to connect this block to\n * after instantiating.\n * @param connectedToParentNext Whether the provided parent connection is a next\n * connection, rather than output or statement.\n * @returns The root block created.\n */\nfunction domToBlockHeadless(\n xmlBlock: Element, workspace: Workspace, parentConnection?: Connection,\n connectedToParentNext?: boolean): Block {\n let block = null;\n const prototypeName = xmlBlock.getAttribute('type');\n if (!prototypeName) {\n throw TypeError('Block type unspecified: ' + xmlBlock.outerHTML);\n }\n const id = xmlBlock.getAttribute('id');\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string | undefined'.\n block = workspace.newBlock(prototypeName, id as AnyDuringMigration);\n\n // Preprocess childNodes so tags can be processed in a consistent order.\n const xmlChildNameMap = mapSupportedXmlTags(xmlBlock);\n\n const shouldCallInitSvg =\n applyMutationTagNodes(xmlChildNameMap.mutation, block);\n applyCommentTagNodes(xmlChildNameMap.comment, block);\n applyDataTagNodes(xmlChildNameMap.data, block);\n\n // Connect parent after processing mutation and before setting fields.\n if (parentConnection) {\n if (connectedToParentNext) {\n if (block.previousConnection) {\n parentConnection.connect(block.previousConnection);\n } else {\n throw TypeError('Next block does not have previous statement.');\n }\n } else {\n if (block.outputConnection) {\n parentConnection.connect(block.outputConnection);\n } else if (block.previousConnection) {\n parentConnection.connect(block.previousConnection);\n } else {\n throw TypeError(\n 'Child block does not have output or previous statement.');\n }\n }\n }\n\n applyFieldTagNodes(xmlChildNameMap.field, block);\n applyInputTagNodes(xmlChildNameMap.input, workspace, block, prototypeName);\n applyNextTagNodes(xmlChildNameMap.next, workspace, block);\n\n if (shouldCallInitSvg) {\n // This shouldn't even be called here\n // (ref: https://github.com/google/blockly/pull/4296#issuecomment-884226021\n // But the XML serializer/deserializer is iceboxed so I'm not going to fix\n // it.\n (block as BlockSvg).initSvg();\n }\n\n const inline = xmlBlock.getAttribute('inline');\n if (inline) {\n block.setInputsInline(inline === 'true');\n }\n const disabled = xmlBlock.getAttribute('disabled');\n if (disabled) {\n block.setEnabled(disabled !== 'true' && disabled !== 'disabled');\n }\n const deletable = xmlBlock.getAttribute('deletable');\n if (deletable) {\n block.setDeletable(deletable === 'true');\n }\n const movable = xmlBlock.getAttribute('movable');\n if (movable) {\n block.setMovable(movable === 'true');\n }\n const editable = xmlBlock.getAttribute('editable');\n if (editable) {\n block.setEditable(editable === 'true');\n }\n const collapsed = xmlBlock.getAttribute('collapsed');\n if (collapsed) {\n block.setCollapsed(collapsed === 'true');\n }\n if (xmlBlock.nodeName.toLowerCase() === 'shadow') {\n // Ensure all children are also shadows.\n const children = block.getChildren(false);\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!child.isShadow()) {\n throw TypeError('Shadow block not allowed non-shadow child.');\n }\n }\n // Ensure this block doesn't have any variable inputs.\n if (block.getVarModels().length) {\n throw TypeError('Shadow blocks cannot have variable references.');\n }\n block.setShadow(true);\n }\n return block;\n}\n\n/**\n * Decode an XML field tag and set the value of that field on the given block.\n *\n * @param block The block that is currently being deserialized.\n * @param fieldName The name of the field on the block.\n * @param xml The field tag to decode.\n */\nfunction domToField(block: Block, fieldName: string, xml: Element) {\n const field = block.getField(fieldName);\n if (!field) {\n console.warn(\n 'Ignoring non-existent field ' + fieldName + ' in block ' + block.type);\n return;\n }\n field.fromXml(xml);\n}\n\n/**\n * Remove any 'next' block (statements in a stack).\n *\n * @param xmlBlock XML block element or an empty DocumentFragment if the block\n * was an insertion marker.\n * @alias Blockly.Xml.deleteNext\n */\nexport function deleteNext(xmlBlock: Element|DocumentFragment) {\n for (let i = 0; i < xmlBlock.childNodes.length; i++) {\n const child = xmlBlock.childNodes[i];\n if (child.nodeName.toLowerCase() === 'next') {\n xmlBlock.removeChild(child);\n break;\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for string manipulation.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.string\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.string');\n\nimport * as deprecation from './deprecation.js';\n\n\n/**\n * Fast prefix-checker.\n * Copied from Closure's goog.string.startsWith.\n *\n * @param str The string to check.\n * @param prefix A string to look for at the start of `str`.\n * @returns True if `str` begins with `prefix`.\n * @alias Blockly.utils.string.startsWith\n * @deprecated Use built-in **string.startsWith** instead.\n */\nexport function startsWith(str: string, prefix: string): boolean {\n deprecation.warn(\n 'Blockly.utils.string.startsWith()', 'April 2022', 'April 2023',\n 'Use built-in string.startsWith');\n return str.startsWith(prefix);\n}\n\n/**\n * Given an array of strings, return the length of the shortest one.\n *\n * @param array Array of strings.\n * @returns Length of shortest string.\n * @alias Blockly.utils.string.shortestStringLength\n */\nexport function shortestStringLength(array: string[]): number {\n if (!array.length) {\n return 0;\n }\n return array\n .reduce(function(a, b) {\n return a.length < b.length ? a : b;\n })\n .length;\n}\n\n/**\n * Given an array of strings, return the length of the common prefix.\n * Words may not be split. Any space after a word is included in the length.\n *\n * @param array Array of strings.\n * @param opt_shortest Length of shortest string.\n * @returns Length of common prefix.\n * @alias Blockly.utils.string.commonWordPrefix\n */\nexport function commonWordPrefix(\n array: string[], opt_shortest?: number): number {\n if (!array.length) {\n return 0;\n } else if (array.length === 1) {\n return array[0].length;\n }\n let wordPrefix = 0;\n const max = opt_shortest || shortestStringLength(array);\n let len;\n for (len = 0; len < max; len++) {\n const letter = array[0][len];\n for (let i = 1; i < array.length; i++) {\n if (letter !== array[i][len]) {\n return wordPrefix;\n }\n }\n if (letter === ' ') {\n wordPrefix = len + 1;\n }\n }\n for (let i = 1; i < array.length; i++) {\n const letter = array[i][len];\n if (letter && letter !== ' ') {\n return wordPrefix;\n }\n }\n return max;\n}\n\n/**\n * Given an array of strings, return the length of the common suffix.\n * Words may not be split. Any space after a word is included in the length.\n *\n * @param array Array of strings.\n * @param opt_shortest Length of shortest string.\n * @returns Length of common suffix.\n * @alias Blockly.utils.string.commonWordSuffix\n */\nexport function commonWordSuffix(\n array: string[], opt_shortest?: number): number {\n if (!array.length) {\n return 0;\n } else if (array.length === 1) {\n return array[0].length;\n }\n let wordPrefix = 0;\n const max = opt_shortest || shortestStringLength(array);\n let len;\n for (len = 0; len < max; len++) {\n const letter = array[0].substr(-len - 1, 1);\n for (let i = 1; i < array.length; i++) {\n if (letter !== array[i].substr(-len - 1, 1)) {\n return wordPrefix;\n }\n }\n if (letter === ' ') {\n wordPrefix = len + 1;\n }\n }\n for (let i = 1; i < array.length; i++) {\n const letter = array[i].charAt(array[i].length - len - 1);\n if (letter && letter !== ' ') {\n return wordPrefix;\n }\n }\n return max;\n}\n\n/**\n * Wrap text to the specified width.\n *\n * @param text Text to wrap.\n * @param limit Width to wrap each line.\n * @returns Wrapped text.\n * @alias Blockly.utils.string.wrap\n */\nexport function wrap(text: string, limit: number): string {\n const lines = text.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n lines[i] = wrapLine(lines[i], limit);\n }\n return lines.join('\\n');\n}\n\n/**\n * Wrap single line of text to the specified width.\n *\n * @param text Text to wrap.\n * @param limit Width to wrap each line.\n * @returns Wrapped text.\n */\nfunction wrapLine(text: string, limit: number): string {\n if (text.length <= limit) {\n // Short text, no need to wrap.\n return text;\n }\n // Split the text into words.\n const words = text.trim().split(/\\s+/);\n // Set limit to be the length of the largest word.\n for (let i = 0; i < words.length; i++) {\n if (words[i].length > limit) {\n limit = words[i].length;\n }\n }\n\n let lastScore;\n let score = -Infinity;\n let lastText;\n let lineCount = 1;\n do {\n lastScore = score;\n lastText = text;\n // Create a list of booleans representing if a space (false) or\n // a break (true) appears after each word.\n let wordBreaks = [];\n // Seed the list with evenly spaced linebreaks.\n const steps = words.length / lineCount;\n let insertedBreaks = 1;\n for (let i = 0; i < words.length - 1; i++) {\n if (insertedBreaks < (i + 1.5) / steps) {\n insertedBreaks++;\n wordBreaks[i] = true;\n } else {\n wordBreaks[i] = false;\n }\n }\n wordBreaks = wrapMutate(words, wordBreaks, limit);\n score = wrapScore(words, wordBreaks, limit);\n text = wrapToText(words, wordBreaks);\n lineCount++;\n } while (score > lastScore);\n return lastText;\n}\n\n/**\n * Compute a score for how good the wrapping is.\n *\n * @param words Array of each word.\n * @param wordBreaks Array of line breaks.\n * @param limit Width to wrap each line.\n * @returns Larger the better.\n */\nfunction wrapScore(\n words: string[], wordBreaks: boolean[], limit: number): number {\n // If this function becomes a performance liability, add caching.\n // Compute the length of each line.\n const lineLengths = [0];\n const linePunctuation = [];\n for (let i = 0; i < words.length; i++) {\n lineLengths[lineLengths.length - 1] += words[i].length;\n if (wordBreaks[i] === true) {\n lineLengths.push(0);\n linePunctuation.push(words[i].charAt(words[i].length - 1));\n } else if (wordBreaks[i] === false) {\n lineLengths[lineLengths.length - 1]++;\n }\n }\n const maxLength = Math.max(...lineLengths);\n\n let score = 0;\n for (let i = 0; i < lineLengths.length; i++) {\n // Optimize for width.\n // -2 points per char over limit (scaled to the power of 1.5).\n score -= Math.pow(Math.abs(limit - lineLengths[i]), 1.5) * 2;\n // Optimize for even lines.\n // -1 point per char smaller than max (scaled to the power of 1.5).\n score -= Math.pow(maxLength - lineLengths[i], 1.5);\n // Optimize for structure.\n // Add score to line endings after punctuation.\n if ('.?!'.indexOf(linePunctuation[i]) !== -1) {\n score += limit / 3;\n } else if (',;)]}'.indexOf(linePunctuation[i]) !== -1) {\n score += limit / 4;\n }\n }\n // All else being equal, the last line should not be longer than the\n // previous line. For example, this looks wrong:\n // aaa bbb\n // ccc ddd eee\n if (lineLengths.length > 1 &&\n lineLengths[lineLengths.length - 1] <=\n lineLengths[lineLengths.length - 2]) {\n score += 0.5;\n }\n return score;\n}\n/**\n * Mutate the array of line break locations until an optimal solution is found.\n * No line breaks are added or deleted, they are simply moved around.\n *\n * @param words Array of each word.\n * @param wordBreaks Array of line breaks.\n * @param limit Width to wrap each line.\n * @returns New array of optimal line breaks.\n */\nfunction wrapMutate(\n words: string[], wordBreaks: boolean[], limit: number): boolean[] {\n let bestScore = wrapScore(words, wordBreaks, limit);\n let bestBreaks;\n // Try shifting every line break forward or backward.\n for (let i = 0; i < wordBreaks.length - 1; i++) {\n if (wordBreaks[i] === wordBreaks[i + 1]) {\n continue;\n }\n const mutatedWordBreaks = (new Array<boolean>()).concat(wordBreaks);\n mutatedWordBreaks[i] = !mutatedWordBreaks[i];\n mutatedWordBreaks[i + 1] = !mutatedWordBreaks[i + 1];\n const mutatedScore = wrapScore(words, mutatedWordBreaks, limit);\n if (mutatedScore > bestScore) {\n bestScore = mutatedScore;\n bestBreaks = mutatedWordBreaks;\n }\n }\n if (bestBreaks) {\n // Found an improvement. See if it may be improved further.\n return wrapMutate(words, bestBreaks, limit);\n }\n // No improvements found. Done.\n return wordBreaks;\n}\n\n/**\n * Reassemble the array of words into text, with the specified line breaks.\n *\n * @param words Array of each word.\n * @param wordBreaks Array of line breaks.\n * @returns Plain text.\n */\nfunction wrapToText(words: string[], wordBreaks: boolean[]): string {\n const text = [];\n for (let i = 0; i < words.length; i++) {\n text.push(words[i]);\n if (wordBreaks[i] !== undefined) {\n text.push(wordBreaks[i] ? '\\n' : ' ');\n }\n }\n return text.join('');\n}\n\n/**\n * Is the given string a number (includes negative and decimals).\n *\n * @param str Input string.\n * @returns True if number, false otherwise.\n * @alias Blockly.utils.string.isNumber\n */\nexport function isNumber(str: string): boolean {\n return /^\\s*-?\\d+(\\.\\d+)?\\s*$/.test(str);\n}\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Library to create tooltips for Blockly.\n * First, call createDom() after onload.\n * Second, set the 'tooltip' property on any SVG element that needs a tooltip.\n * If the tooltip is a string, or a function that returns a string, that message\n * will be displayed. If the tooltip is an SVG element, then that object's\n * tooltip will be used. Third, call bindMouseEvents(e) passing the SVG element.\n *\n * @namespace Blockly.Tooltip\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Tooltip');\n\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\nimport * as blocklyString from './utils/string.js';\n\n\n/**\n * A type which can define a tooltip.\n * Either a string, an object containing a tooltip property, or a function which\n * returns either a string, or another arbitrarily nested function which\n * eventually unwinds to a string.\n *\n * @alias Blockly.Tooltip.TipInfo\n */\nexport type TipInfo =\n string|{tooltip: AnyDuringMigration}|(() => TipInfo|string|Function);\n\n/**\n * A function that renders custom tooltip UI.\n * 1st parameter: the div element to render content into.\n * 2nd parameter: the element being moused over (i.e., the element for which the\n * tooltip should be shown).\n *\n * @alias Blockly.Tooltip.CustomTooltip\n */\nexport type CustomTooltip = (p1: Element, p2: Element) => AnyDuringMigration;\n\n/**\n * An optional function that renders custom tooltips into the provided DIV. If\n * this is defined, the function will be called instead of rendering the default\n * tooltip UI.\n */\nlet customTooltip: CustomTooltip|undefined = undefined;\n\n/**\n * Sets a custom function that will be called if present instead of the default\n * tooltip UI.\n *\n * @param customFn A custom tooltip used to render an alternate tooltip UI.\n * @alias Blockly.Tooltip.setCustomTooltip\n */\nexport function setCustomTooltip(customFn: CustomTooltip) {\n customTooltip = customFn;\n}\n\n/**\n * Gets the custom tooltip function.\n *\n * @returns The custom tooltip function, if defined.\n */\nexport function getCustomTooltip(): CustomTooltip|undefined {\n return customTooltip;\n}\n\n/** Is a tooltip currently showing? */\nlet visible = false;\n\n/**\n * Returns whether or not a tooltip is showing\n *\n * @returns True if a tooltip is showing\n * @alias Blockly.Tooltip.isVisible\n */\nexport function isVisible(): boolean {\n return visible;\n}\n\n/** Is someone else blocking the tooltip from being shown? */\nlet blocked = false;\n\n/**\n * Maximum width (in characters) of a tooltip.\n *\n * @alias Blockly.Tooltip.LIMIT\n */\nexport const LIMIT = 50;\n\n/** PID of suspended thread to clear tooltip on mouse out. */\nlet mouseOutPid: AnyDuringMigration = 0;\n\n/** PID of suspended thread to show the tooltip. */\nlet showPid: AnyDuringMigration = 0;\n\n/**\n * Last observed X location of the mouse pointer (freezes when tooltip appears).\n */\nlet lastX = 0;\n\n/**\n * Last observed Y location of the mouse pointer (freezes when tooltip appears).\n */\nlet lastY = 0;\n\n/** Current element being pointed at. */\nlet element: AnyDuringMigration = null;\n\n/**\n * Once a tooltip has opened for an element, that element is 'poisoned' and\n * cannot respawn a tooltip until the pointer moves over a different element.\n */\nlet poisonedElement: AnyDuringMigration = null;\n\n/**\n * Horizontal offset between mouse cursor and tooltip.\n *\n * @alias Blockly.Tooltip.OFFSET_X\n */\nexport const OFFSET_X = 0;\n\n/**\n * Vertical offset between mouse cursor and tooltip.\n *\n * @alias Blockly.Tooltip.OFFSET_Y\n */\nexport const OFFSET_Y = 10;\n\n/**\n * Radius mouse can move before killing tooltip.\n *\n * @alias Blockly.Tooltip.RADIUS_OK\n */\nexport const RADIUS_OK = 10;\n\n/**\n * Delay before tooltip appears.\n *\n * @alias Blockly.Tooltip.HOVER_MS\n */\nexport const HOVER_MS = 750;\n\n/**\n * Horizontal padding between tooltip and screen edge.\n *\n * @alias Blockly.Tooltip.MARGINS\n */\nexport const MARGINS = 5;\n\n/** The HTML container. Set once by createDom. */\nlet containerDiv: HTMLDivElement|null = null;\n\n/**\n * Returns the HTML tooltip container.\n *\n * @returns The HTML tooltip container.\n * @alias Blockly.Tooltip.getDiv\n */\nexport function getDiv(): HTMLDivElement|null {\n return containerDiv;\n}\n\n/**\n * Returns the tooltip text for the given element.\n *\n * @param object The object to get the tooltip text of.\n * @returns The tooltip text of the element.\n * @alias Blockly.Tooltip.getTooltipOfObject\n */\nexport function getTooltipOfObject(object: AnyDuringMigration|null): string {\n const obj = getTargetObject(object);\n if (obj) {\n let tooltip = obj.tooltip;\n while (typeof tooltip === 'function') {\n tooltip = tooltip();\n }\n if (typeof tooltip !== 'string') {\n throw Error('Tooltip function must return a string.');\n }\n return tooltip;\n }\n return '';\n}\n\n/**\n * Returns the target object that the given object is targeting for its\n * tooltip. Could be the object itself.\n *\n * @param obj The object are trying to find the target tooltip object of.\n * @returns The target tooltip object.\n */\nfunction getTargetObject(obj: object|null): {tooltip: AnyDuringMigration}|null {\n while (obj && (obj as any).tooltip) {\n if (typeof (obj as any).tooltip === 'string' ||\n typeof (obj as any).tooltip === 'function') {\n return obj as {tooltip: string | (() => string)};\n }\n obj = (obj as any).tooltip;\n }\n return null;\n}\n\n/**\n * Create the tooltip div and inject it onto the page.\n *\n * @alias Blockly.Tooltip.createDom\n */\nexport function createDom() {\n if (containerDiv) {\n return; // Already created.\n }\n // Create an HTML container for popup overlays (e.g. editor widgets).\n containerDiv = document.createElement('div');\n containerDiv.className = 'blocklyTooltipDiv';\n const container = common.getParentContainer() || document.body;\n container.appendChild(containerDiv);\n}\n\n/**\n * Binds the required mouse events onto an SVG element.\n *\n * @param element SVG element onto which tooltip is to be bound.\n * @alias Blockly.Tooltip.bindMouseEvents\n */\nexport function bindMouseEvents(element: Element) {\n // TODO (#6097): Don't stash wrapper info on the DOM.\n (element as AnyDuringMigration).mouseOverWrapper_ =\n browserEvents.bind(element, 'mouseover', null, onMouseOver);\n (element as AnyDuringMigration).mouseOutWrapper_ =\n browserEvents.bind(element, 'mouseout', null, onMouseOut);\n\n // Don't use bindEvent_ for mousemove since that would create a\n // corresponding touch handler, even though this only makes sense in the\n // context of a mouseover/mouseout.\n element.addEventListener('mousemove', onMouseMove, false);\n}\n\n/**\n * Unbinds tooltip mouse events from the SVG element.\n *\n * @param element SVG element onto which tooltip is bound.\n * @alias Blockly.Tooltip.unbindMouseEvents\n */\nexport function unbindMouseEvents(element: Element|null) {\n if (!element) {\n return;\n }\n // TODO (#6097): Don't stash wrapper info on the DOM.\n browserEvents.unbind((element as AnyDuringMigration).mouseOverWrapper_);\n browserEvents.unbind((element as AnyDuringMigration).mouseOutWrapper_);\n element.removeEventListener('mousemove', onMouseMove);\n}\n\n/**\n * Hide the tooltip if the mouse is over a different object.\n * Initialize the tooltip to potentially appear for this object.\n *\n * @param e Mouse event.\n */\nfunction onMouseOver(e: Event) {\n if (blocked) {\n // Someone doesn't want us to show tooltips.\n return;\n }\n // If the tooltip is an object, treat it as a pointer to the next object in\n // the chain to look at. Terminate when a string or function is found.\n const newElement = getTargetObject(e.currentTarget);\n if (element !== newElement) {\n hide();\n poisonedElement = null;\n element = newElement;\n }\n // Forget about any immediately preceding mouseOut event.\n clearTimeout(mouseOutPid);\n}\n\n/**\n * Hide the tooltip if the mouse leaves the object and enters the workspace.\n *\n * @param _e Mouse event.\n */\nfunction onMouseOut(_e: Event) {\n if (blocked) {\n // Someone doesn't want us to show tooltips.\n return;\n }\n // Moving from one element to another (overlapping or with no gap) generates\n // a mouseOut followed instantly by a mouseOver. Fork off the mouseOut\n // event and kill it if a mouseOver is received immediately.\n // This way the task only fully executes if mousing into the void.\n mouseOutPid = setTimeout(function() {\n element = null;\n poisonedElement = null;\n hide();\n }, 1);\n clearTimeout(showPid);\n}\n\n/**\n * When hovering over an element, schedule a tooltip to be shown. If a tooltip\n * is already visible, hide it if the mouse strays out of a certain radius.\n *\n * @param e Mouse event.\n */\nfunction onMouseMove(e: Event) {\n if (!element || !(element as AnyDuringMigration).tooltip) {\n // No tooltip here to show.\n return;\n } else if (blocked) {\n // Someone doesn't want us to show tooltips. We are probably handling a\n // user gesture, such as a click or drag.\n return;\n }\n if (visible) {\n // Compute the distance between the mouse position when the tooltip was\n // shown and the current mouse position. Pythagorean theorem.\n // AnyDuringMigration because: Property 'pageX' does not exist on type\n // 'Event'.\n const dx = lastX - (e as AnyDuringMigration).pageX;\n // AnyDuringMigration because: Property 'pageY' does not exist on type\n // 'Event'.\n const dy = lastY - (e as AnyDuringMigration).pageY;\n if (Math.sqrt(dx * dx + dy * dy) > RADIUS_OK) {\n hide();\n }\n } else if (poisonedElement !== element) {\n // The mouse moved, clear any previously scheduled tooltip.\n clearTimeout(showPid);\n // Maybe this time the mouse will stay put. Schedule showing of tooltip.\n // AnyDuringMigration because: Property 'pageX' does not exist on type\n // 'Event'.\n lastX = (e as AnyDuringMigration).pageX;\n // AnyDuringMigration because: Property 'pageY' does not exist on type\n // 'Event'.\n lastY = (e as AnyDuringMigration).pageY;\n showPid = setTimeout(show, HOVER_MS);\n }\n}\n\n/**\n * Dispose of the tooltip.\n *\n * @alias Blockly.Tooltip.dispose\n * @internal\n */\nexport function dispose() {\n element = null;\n poisonedElement = null;\n hide();\n}\n\n/**\n * Hide the tooltip.\n *\n * @alias Blockly.Tooltip.hide\n */\nexport function hide() {\n if (visible) {\n visible = false;\n if (containerDiv) {\n containerDiv.style.display = 'none';\n }\n }\n if (showPid) {\n clearTimeout(showPid);\n }\n}\n\n/**\n * Hide any in-progress tooltips and block showing new tooltips until the next\n * call to unblock().\n *\n * @alias Blockly.Tooltip.block\n * @internal\n */\nexport function block() {\n hide();\n blocked = true;\n}\n\n/**\n * Unblock tooltips: allow them to be scheduled and shown according to their own\n * logic.\n *\n * @alias Blockly.Tooltip.unblock\n * @internal\n */\nexport function unblock() {\n blocked = false;\n}\n\n/** Renders the tooltip content into the tooltip div. */\nfunction renderContent() {\n if (!containerDiv || !element) {\n // This shouldn't happen, but if it does, we can't render.\n return;\n }\n if (typeof customTooltip === 'function') {\n customTooltip(containerDiv, element);\n } else {\n renderDefaultContent();\n }\n}\n\n/** Renders the default tooltip UI. */\nfunction renderDefaultContent() {\n let tip = getTooltipOfObject(element);\n tip = blocklyString.wrap(tip, LIMIT);\n // Create new text, line by line.\n const lines = tip.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n const div = (document.createElement('div'));\n div.appendChild(document.createTextNode(lines[i]));\n containerDiv!.appendChild(div);\n }\n}\n\n/**\n * Gets the coordinates for the tooltip div, taking into account the edges of\n * the screen to prevent showing the tooltip offscreen.\n *\n * @param rtl True if the tooltip should be in right-to-left layout.\n * @returns Coordinates at which the tooltip div should be placed.\n */\nfunction getPosition(rtl: boolean): {x: number, y: number} {\n // Position the tooltip just below the cursor.\n const windowWidth = document.documentElement.clientWidth;\n const windowHeight = document.documentElement.clientHeight;\n\n let anchorX = lastX;\n if (rtl) {\n anchorX -= OFFSET_X + containerDiv!.offsetWidth;\n } else {\n anchorX += OFFSET_X;\n }\n\n let anchorY = lastY + OFFSET_Y;\n if (anchorY + containerDiv!.offsetHeight > windowHeight + window.scrollY) {\n // Falling off the bottom of the screen; shift the tooltip up.\n anchorY -= containerDiv!.offsetHeight + 2 * OFFSET_Y;\n }\n\n if (rtl) {\n // Prevent falling off left edge in RTL mode.\n anchorX = Math.max(MARGINS - window.scrollX, anchorX);\n } else {\n if (anchorX + containerDiv!.offsetWidth >\n windowWidth + window.scrollX - 2 * MARGINS) {\n // Falling off the right edge of the screen;\n // clamp the tooltip on the edge.\n anchorX = windowWidth - containerDiv!.offsetWidth - 2 * MARGINS;\n }\n }\n\n return {x: anchorX, y: anchorY};\n}\n\n/** Create the tooltip and show it. */\nfunction show() {\n if (blocked) {\n // Someone doesn't want us to show tooltips.\n return;\n }\n poisonedElement = element;\n if (!containerDiv) {\n return;\n }\n // Erase all existing text.\n containerDiv.textContent = '';\n\n // Add new content.\n renderContent();\n\n // Display the tooltip.\n const rtl = (element as any).RTL;\n containerDiv.style.direction = rtl ? 'rtl' : 'ltr';\n containerDiv.style.display = 'block';\n visible = true;\n\n const {x, y} = getPosition(rtl);\n containerDiv.style.left = x + 'px';\n containerDiv.style.top = y + 'px';\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for colour manipulation.\n *\n * @namespace Blockly.utils.colour\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.colour');\n\n\n/**\n * The richness of block colours, regardless of the hue.\n * Must be in the range of 0 (inclusive) to 1 (exclusive).\n *\n * @alias Blockly.utils.colour.hsvSaturation\n */\nlet hsvSaturation = 0.45;\n\n/**\n * Get the richness of block colours, regardless of the hue.\n *\n * @alias Blockly.utils.colour.getHsvSaturation\n * @returns The current richness.\n * @internal\n */\nexport function getHsvSaturation(): number {\n return hsvSaturation;\n}\n\n/**\n * Set the richness of block colours, regardless of the hue.\n *\n * @param newSaturation The new richness, in the range of 0 (inclusive) to 1\n * (exclusive)\n * @alias Blockly.utils.colour.setHsvSaturation\n * @internal\n */\nexport function setHsvSaturation(newSaturation: number) {\n hsvSaturation = newSaturation;\n}\n\n/**\n * The intensity of block colours, regardless of the hue.\n * Must be in the range of 0 (inclusive) to 1 (exclusive).\n *\n * @alias Blockly.utils.colour.hsvValue\n */\nlet hsvValue = 0.65;\n\n/**\n * Get the intensity of block colours, regardless of the hue.\n *\n * @alias Blockly.utils.colour.getHsvValue\n * @returns The current intensity.\n * @internal\n */\nexport function getHsvValue(): number {\n return hsvValue;\n}\n\n/**\n * Set the intensity of block colours, regardless of the hue.\n *\n * @param newValue The new intensity, in the range of 0 (inclusive) to 1\n * (exclusive)\n * @alias Blockly.utils.colour.setHsvValue\n * @internal\n */\nexport function setHsvValue(newValue: number) {\n hsvValue = newValue;\n}\n\n/**\n * Parses a colour from a string.\n * .parse('red') = '#ff0000'\n * .parse('#f00') = '#ff0000'\n * .parse('#ff0000') = '#ff0000'\n * .parse('0xff0000') = '#ff0000'\n * .parse('rgb(255, 0, 0)') = '#ff0000'\n *\n * @param str Colour in some CSS format.\n * @returns A string containing a hex representation of the colour, or null if\n * can't be parsed.\n * @alias Blockly.utils.colour.parse\n */\nexport function parse(str: string|number): string|null {\n str = String(str).toLowerCase().trim();\n let hex = names[str];\n if (hex) {\n // e.g. 'red'\n return hex;\n }\n hex = str.substring(0, 2) === '0x' ? '#' + str.substring(2) : str;\n hex = hex[0] === '#' ? hex : '#' + hex;\n if (/^#[0-9a-f]{6}$/.test(hex)) {\n // e.g. '#00ff88'\n return hex;\n }\n if (/^#[0-9a-f]{3}$/.test(hex)) {\n // e.g. '#0f8'\n return ['#', hex[1], hex[1], hex[2], hex[2], hex[3], hex[3]].join('');\n }\n const rgb = str.match(/^(?:rgb)?\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$/);\n if (rgb) {\n // e.g. 'rgb(0, 128, 255)'\n const r = Number(rgb[1]);\n const g = Number(rgb[2]);\n const b = Number(rgb[3]);\n if (r >= 0 && r < 256 && g >= 0 && g < 256 && b >= 0 && b < 256) {\n return rgbToHex(r, g, b);\n }\n }\n return null;\n}\n\n/**\n * Converts a colour from RGB to hex representation.\n *\n * @param r Amount of red, int between 0 and 255.\n * @param g Amount of green, int between 0 and 255.\n * @param b Amount of blue, int between 0 and 255.\n * @returns Hex representation of the colour.\n * @alias Blockly.utils.colour.rgbToHex\n */\nexport function rgbToHex(r: number, g: number, b: number): string {\n const rgb = r << 16 | g << 8 | b;\n if (r < 0x10) {\n return '#' + (0x1000000 | rgb).toString(16).substr(1);\n }\n return '#' + rgb.toString(16);\n}\n\n/**\n * Converts a colour to RGB.\n *\n * @param colour String representing colour in any colour format ('#ff0000',\n * 'red', '0xff000', etc).\n * @returns RGB representation of the colour.\n * @alias Blockly.utils.colour.hexToRgb\n */\nexport function hexToRgb(colour: string): number[] {\n const hex = parse(colour);\n if (!hex) {\n return [0, 0, 0];\n }\n\n const rgb = parseInt(hex.substr(1), 16);\n const r = rgb >> 16;\n const g = rgb >> 8 & 255;\n const b = rgb & 255;\n\n return [r, g, b];\n}\n\n/**\n * Converts an HSV triplet to hex representation.\n *\n * @param h Hue value in [0, 360].\n * @param s Saturation value in [0, 1].\n * @param v Brightness in [0, 255].\n * @returns Hex representation of the colour.\n * @alias Blockly.utils.colour.hsvToHex\n */\nexport function hsvToHex(h: number, s: number, v: number): string {\n let red = 0;\n let green = 0;\n let blue = 0;\n if (s === 0) {\n red = v;\n green = v;\n blue = v;\n } else {\n const sextant = Math.floor(h / 60);\n const remainder = h / 60 - sextant;\n const val1 = v * (1 - s);\n const val2 = v * (1 - s * remainder);\n const val3 = v * (1 - s * (1 - remainder));\n switch (sextant) {\n case 1:\n red = val2;\n green = v;\n blue = val1;\n break;\n case 2:\n red = val1;\n green = v;\n blue = val3;\n break;\n case 3:\n red = val1;\n green = val2;\n blue = v;\n break;\n case 4:\n red = val3;\n green = val1;\n blue = v;\n break;\n case 5:\n red = v;\n green = val1;\n blue = val2;\n break;\n case 6:\n case 0:\n red = v;\n green = val3;\n blue = val1;\n break;\n }\n }\n return rgbToHex(Math.floor(red), Math.floor(green), Math.floor(blue));\n}\n\n/**\n * Blend two colours together, using the specified factor to indicate the\n * weight given to the first colour.\n *\n * @param colour1 First colour.\n * @param colour2 Second colour.\n * @param factor The weight to be given to colour1 over colour2.\n * Values should be in the range [0, 1].\n * @returns Combined colour represented in hex.\n * @alias Blockly.utils.colour.blend\n */\nexport function blend(colour1: string, colour2: string, factor: number): string|\n null {\n const hex1 = parse(colour1);\n if (!hex1) {\n return null;\n }\n const hex2 = parse(colour2);\n if (!hex2) {\n return null;\n }\n const rgb1 = hexToRgb(hex1);\n const rgb2 = hexToRgb(hex2);\n const r = Math.round(rgb2[0] + factor * (rgb1[0] - rgb2[0]));\n const g = Math.round(rgb2[1] + factor * (rgb1[1] - rgb2[1]));\n const b = Math.round(rgb2[2] + factor * (rgb1[2] - rgb2[2]));\n return rgbToHex(r, g, b);\n}\n\n/**\n * A map that contains the 16 basic colour keywords as defined by W3C:\n * https://www.w3.org/TR/2018/REC-css-color-3-20180619/#html4\n * The keys of this map are the lowercase \"readable\" names of the colours,\n * while the values are the \"hex\" values.\n *\n * @alias Blockly.utils.colour.names\n */\nexport const names: {[key: string]: string} = {\n 'aqua': '#00ffff',\n 'black': '#000000',\n 'blue': '#0000ff',\n 'fuchsia': '#ff00ff',\n 'gray': '#808080',\n 'green': '#008000',\n 'lime': '#00ff00',\n 'maroon': '#800000',\n 'navy': '#000080',\n 'olive': '#808000',\n 'purple': '#800080',\n 'red': '#ff0000',\n 'silver': '#c0c0c0',\n 'teal': '#008080',\n 'white': '#ffffff',\n 'yellow': '#ffff00',\n};\n\n/**\n * Convert a hue (HSV model) into an RGB hex triplet.\n *\n * @param hue Hue on a colour wheel (0-360).\n * @returns RGB code, e.g. '#5ba65b'.\n * @alias Blockly.utils.colour.hueToHex\n */\nexport function hueToHex(hue: number): string {\n return hsvToHex(hue, hsvSaturation, hsvValue * 255);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @namespace Blockly.utils.parsing\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.parsing');\n\nimport {Msg} from '../msg.js';\n\nimport * as colourUtils from './colour.js';\n\n\n/**\n * Internal implementation of the message reference and interpolation token\n * parsing used by tokenizeInterpolation() and replaceMessageReferences().\n *\n * @param message Text which might contain string table references and\n * interpolation tokens.\n * @param parseInterpolationTokens Option to parse numeric\n * interpolation tokens (%1, %2, ...) when true.\n * @returns Array of strings and numbers.\n */\nfunction tokenizeInterpolationInternal(\n message: string, parseInterpolationTokens: boolean): (string|number)[] {\n const tokens = [];\n const chars = message.split('');\n chars.push( // End marker.\n '');\n // Parse the message with a finite state machine.\n // 0 - Base case.\n // 1 - % found.\n // 2 - Digit found.\n // 3 - Message ref found.\n let state = 0;\n const buffer = new Array<string>();\n let number = null;\n for (let i = 0; i < chars.length; i++) {\n const c = chars[i];\n if (state === 0) { // Start escape.\n if (c === '%') {\n const text = buffer.join('');\n if (text) {\n tokens.push(text);\n }\n buffer.length = 0;\n state = 1;\n } else {\n buffer.push(c); // Regular char.\n }\n } else if (state === 1) {\n if (c === '%') {\n buffer.push(c); // Escaped %: %%\n state = 0;\n } else if (parseInterpolationTokens && '0' <= c && c <= '9') {\n state = 2;\n number = c;\n const text = buffer.join('');\n if (text) {\n tokens.push(text);\n }\n buffer.length = 0;\n } else if (c === '{') {\n state = 3;\n } else {\n buffer.push('%', c); // Not recognized. Return as literal.\n state = 0;\n }\n } else if (state === 2) {\n if ('0' <= c && c <= '9') {\n number += c; // Multi-digit number.\n } else {\n tokens.push(parseInt(number ?? '', 10));\n i--; // Parse this char again.\n state = 0;\n }\n } else if (state === 3) { // String table reference\n if (c === '') {\n // Premature end before closing '}'\n buffer.splice(0, 0, '%{'); // Re-insert leading delimiter\n i--; // Parse this char again.\n state = 0; // and parse as string literal.\n } else if (c !== '}') {\n buffer.push(c);\n } else {\n const rawKey = buffer.join('');\n if (/[A-Z]\\w*/i.test(rawKey)) { // Strict matching\n // Found a valid string key. Attempt case insensitive match.\n const keyUpper = rawKey.toUpperCase();\n\n // BKY_ is the prefix used to namespace the strings used in\n // Blockly core files and the predefined blocks in ../blocks/.\n // These strings are defined in ../msgs/ files.\n const bklyKey =\n keyUpper.startsWith('BKY_') ? keyUpper.substring(4) : null;\n if (bklyKey && bklyKey in Msg) {\n const rawValue = Msg[bklyKey];\n if (typeof rawValue === 'string') {\n // Attempt to dereference substrings, too, appending to the\n // end.\n Array.prototype.push.apply(\n tokens,\n tokenizeInterpolationInternal(\n rawValue, parseInterpolationTokens));\n } else if (parseInterpolationTokens) {\n // When parsing interpolation tokens, numbers are special\n // placeholders (%1, %2, etc). Make sure all other values are\n // strings.\n tokens.push(String(rawValue));\n } else {\n tokens.push(rawValue);\n }\n } else {\n // No entry found in the string table. Pass reference as string.\n tokens.push('%{' + rawKey + '}');\n }\n buffer.length = 0; // Clear the array\n state = 0;\n } else {\n tokens.push('%{' + rawKey + '}');\n buffer.length = 0;\n state = 0; // and parse as string literal.\n }\n }\n }\n }\n let text = buffer.join('');\n if (text) {\n tokens.push(text);\n }\n\n // Merge adjacent text tokens into a single string.\n const mergedTokens = [];\n buffer.length = 0;\n for (let i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'string') {\n buffer.push(tokens[i] as string);\n } else {\n text = buffer.join('');\n if (text) {\n mergedTokens.push(text);\n }\n buffer.length = 0;\n mergedTokens.push(tokens[i]);\n }\n }\n text = buffer.join('');\n if (text) {\n mergedTokens.push(text);\n }\n buffer.length = 0;\n\n return mergedTokens;\n}\n\n/**\n * Parse a string with any number of interpolation tokens (%1, %2, ...).\n * It will also replace string table references (e.g., %{bky_my_msg} and\n * %{BKY_MY_MSG} will both be replaced with the value in\n * Msg['MY_MSG']). Percentage sign characters '%' may be self-escaped\n * (e.g., '%%').\n *\n * @param message Text which might contain string table references and\n * interpolation tokens.\n * @returns Array of strings and numbers.\n * @alias Blockly.utils.parsing.tokenizeInterpolation\n */\nexport function tokenizeInterpolation(message: string): (string|number)[] {\n return tokenizeInterpolationInternal(message, true);\n}\n\n/**\n * Replaces string table references in a message, if the message is a string.\n * For example, \"%{bky_my_msg}\" and \"%{BKY_MY_MSG}\" will both be replaced with\n * the value in Msg['MY_MSG'].\n *\n * @param message Message, which may be a string that contains\n * string table references.\n * @returns String with message references replaced.\n * @alias Blockly.utils.parsing.replaceMessageReferences\n */\nexport function replaceMessageReferences(message: string|any): string {\n if (typeof message !== 'string') {\n return message;\n }\n const interpolatedResult = tokenizeInterpolationInternal(message, false);\n // When parseInterpolationTokens === false, interpolatedResult should be at\n // most length 1.\n return interpolatedResult.length ? String(interpolatedResult[0]) : '';\n}\n\n/**\n * Validates that any %{MSG_KEY} references in the message refer to keys of\n * the Msg string table.\n *\n * @param message Text which might contain string table references.\n * @returns True if all message references have matching values.\n * Otherwise, false.\n * @alias Blockly.utils.parsing.checkMessageReferences\n */\nexport function checkMessageReferences(message: string): boolean {\n let validSoFar = true;\n\n const msgTable = Msg;\n // TODO (#1169): Implement support for other string tables,\n // prefixes other than BKY_.\n const m = message.match(/%{BKY_[A-Z]\\w*}/ig);\n if (m) {\n for (let i = 0; i < m.length; i++) {\n const msgKey = m[i].toUpperCase();\n if (msgTable[msgKey.slice(6, -1)] === undefined) {\n console.warn('No message string for ' + m[i] + ' in ' + message);\n validSoFar = false; // Continue to report other errors.\n }\n }\n }\n\n return validSoFar;\n}\n\n/**\n * Parse a block colour from a number or string, as provided in a block\n * definition.\n *\n * @param colour HSV hue value (0 to 360), #RRGGBB string,\n * or a message reference string pointing to one of those two values.\n * @returns An object containing the colour as\n * a #RRGGBB string, and the hue if the input was an HSV hue value.\n * @throws {Error} If the colour cannot be parsed.\n * @alias Blockly.utils.parsing.parseBlockColour\n */\nexport function parseBlockColour(colour: number|\n string): {hue: number|null, hex: string} {\n const dereferenced =\n typeof colour === 'string' ? replaceMessageReferences(colour) : colour;\n\n const hue = Number(dereferenced);\n if (!isNaN(hue) && 0 <= hue && hue <= 360) {\n return {\n hue: hue,\n hex: colourUtils.hsvToHex(\n hue, colourUtils.getHsvSaturation(), colourUtils.getHsvValue() * 255),\n };\n } else {\n const hex = colourUtils.parse(dereferenced);\n if (hex) {\n // Only store hue if colour is set as a hue.\n return {hue: null, hex: hex};\n } else {\n let errorMsg = 'Invalid colour: \"' + dereferenced + '\"';\n if (colour !== dereferenced) {\n errorMsg += ' (from \"' + colour + '\")';\n }\n throw Error(errorMsg);\n }\n }\n}\n","/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A div that floats on top of Blockly. This singleton contains\n * temporary HTML UI widgets that the user is currently interacting with.\n * E.g. text input areas, colour pickers, context menus.\n *\n * @namespace Blockly.WidgetDiv\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.WidgetDiv');\n\nimport * as common from './common.js';\nimport * as dom from './utils/dom.js';\nimport type {Rect} from './utils/rect.js';\nimport type {Size} from './utils/size.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/** The object currently using this container. */\nlet owner: unknown = null;\n\n/** Optional cleanup function set by whichever object uses the widget. */\nlet dispose: (() => void)|null = null;\n\n/** A class name representing the current owner's workspace renderer. */\nlet rendererClassName = '';\n\n/** A class name representing the current owner's workspace theme. */\nlet themeClassName = '';\n\n/** The HTML container for popup overlays (e.g. editor widgets). */\nlet containerDiv: HTMLDivElement|null;\n\n/**\n * Returns the HTML container for editor widgets.\n *\n * @returns The editor widget container.\n * @alias Blockly.WidgetDiv.getDiv\n */\nexport function getDiv(): HTMLDivElement|null {\n return containerDiv;\n}\n\n/**\n * Allows unit tests to reset the div. Do not use outside of tests.\n *\n * @param newDiv The new value for the DIV field.\n * @alias Blockly.WidgetDiv.testOnly_setDiv\n * @internal\n */\nexport function testOnly_setDiv(newDiv: HTMLDivElement|null) {\n containerDiv = newDiv;\n}\n\n/**\n * Create the widget div and inject it onto the page.\n *\n * @alias Blockly.WidgetDiv.createDom\n */\nexport function createDom() {\n if (containerDiv) {\n return; // Already created.\n }\n\n containerDiv = document.createElement('div') as HTMLDivElement;\n containerDiv.className = 'blocklyWidgetDiv';\n const container = common.getParentContainer() || document.body;\n container.appendChild(containerDiv);\n}\n\n/**\n * Initialize and display the widget div. Close the old one if needed.\n *\n * @param newOwner The object that will be using this container.\n * @param rtl Right-to-left (true) or left-to-right (false).\n * @param newDispose Optional cleanup function to be run when the widget is\n * closed.\n * @alias Blockly.WidgetDiv.show\n */\nexport function show(newOwner: unknown, rtl: boolean, newDispose: () => void) {\n hide();\n owner = newOwner;\n dispose = newDispose;\n const div = containerDiv;\n if (!div) return;\n div.style.direction = rtl ? 'rtl' : 'ltr';\n div.style.display = 'block';\n const mainWorkspace = common.getMainWorkspace() as WorkspaceSvg;\n rendererClassName = mainWorkspace.getRenderer().getClassName();\n themeClassName = mainWorkspace.getTheme().getClassName();\n if (rendererClassName) {\n dom.addClass(div, rendererClassName);\n }\n if (themeClassName) {\n dom.addClass(div, themeClassName);\n }\n}\n\n/**\n * Destroy the widget and hide the div.\n *\n * @alias Blockly.WidgetDiv.hide\n */\nexport function hide() {\n if (!isVisible()) {\n return;\n }\n owner = null;\n\n const div = containerDiv;\n if (!div) return;\n div.style.display = 'none';\n div.style.left = '';\n div.style.top = '';\n dispose && dispose();\n dispose = null;\n div.textContent = '';\n\n if (rendererClassName) {\n dom.removeClass(div, rendererClassName);\n rendererClassName = '';\n }\n if (themeClassName) {\n dom.removeClass(div, themeClassName);\n themeClassName = '';\n }\n (common.getMainWorkspace() as WorkspaceSvg).markFocused();\n}\n\n/**\n * Is the container visible?\n *\n * @returns True if visible.\n * @alias Blockly.WidgetDiv.isVisible\n */\nexport function isVisible(): boolean {\n return !!owner;\n}\n\n/**\n * Destroy the widget and hide the div if it is being used by the specified\n * object.\n *\n * @param oldOwner The object that was using this container.\n * @alias Blockly.WidgetDiv.hideIfOwner\n */\nexport function hideIfOwner(oldOwner: unknown) {\n if (owner === oldOwner) {\n hide();\n }\n}\n/**\n * Set the widget div's position and height. This function does nothing clever:\n * it will not ensure that your widget div ends up in the visible window.\n *\n * @param x Horizontal location (window coordinates, not body).\n * @param y Vertical location (window coordinates, not body).\n * @param height The height of the widget div (pixels).\n */\nfunction positionInternal(x: number, y: number, height: number) {\n containerDiv!.style.left = x + 'px';\n containerDiv!.style.top = y + 'px';\n containerDiv!.style.height = height + 'px';\n}\n\n/**\n * Position the widget div based on an anchor rectangle.\n * The widget should be placed adjacent to but not overlapping the anchor\n * rectangle. The preferred position is directly below and aligned to the left\n * (LTR) or right (RTL) side of the anchor.\n *\n * @param viewportBBox The bounding rectangle of the current viewport, in window\n * coordinates.\n * @param anchorBBox The bounding rectangle of the anchor, in window\n * coordinates.\n * @param widgetSize The size of the widget that is inside the widget div, in\n * window coordinates.\n * @param rtl Whether the workspace is in RTL mode. This determines horizontal\n * alignment.\n * @alias Blockly.WidgetDiv.positionWithAnchor\n * @internal\n */\nexport function positionWithAnchor(\n viewportBBox: Rect, anchorBBox: Rect, widgetSize: Size, rtl: boolean) {\n const y = calculateY(viewportBBox, anchorBBox, widgetSize);\n const x = calculateX(viewportBBox, anchorBBox, widgetSize, rtl);\n\n if (y < 0) {\n positionInternal(x, 0, widgetSize.height + y);\n } else {\n positionInternal(x, y, widgetSize.height);\n }\n}\n\n/**\n * Calculate an x position (in window coordinates) such that the widget will not\n * be offscreen on the right or left.\n *\n * @param viewportBBox The bounding rectangle of the current viewport, in window\n * coordinates.\n * @param anchorBBox The bounding rectangle of the anchor, in window\n * coordinates.\n * @param widgetSize The dimensions of the widget inside the widget div.\n * @param rtl Whether the Blockly workspace is in RTL mode.\n * @returns A valid x-coordinate for the top left corner of the widget div, in\n * window coordinates.\n */\nfunction calculateX(\n viewportBBox: Rect, anchorBBox: Rect, widgetSize: Size,\n rtl: boolean): number {\n if (rtl) {\n // Try to align the right side of the field and the right side of widget.\n const widgetLeft = anchorBBox.right - widgetSize.width;\n // Don't go offscreen left.\n const x = Math.max(widgetLeft, viewportBBox.left);\n // But really don't go offscreen right:\n return Math.min(x, viewportBBox.right - widgetSize.width);\n } else {\n // Try to align the left side of the field and the left side of widget.\n // Don't go offscreen right.\n const x = Math.min(anchorBBox.left, viewportBBox.right - widgetSize.width);\n // But left is more important, because that's where the text is.\n return Math.max(x, viewportBBox.left);\n }\n}\n\n/**\n * Calculate a y position (in window coordinates) such that the widget will not\n * be offscreen on the top or bottom.\n *\n * @param viewportBBox The bounding rectangle of the current viewport, in window\n * coordinates.\n * @param anchorBBox The bounding rectangle of the anchor, in window\n * coordinates.\n * @param widgetSize The dimensions of the widget inside the widget div.\n * @returns A valid y-coordinate for the top left corner of the widget div, in\n * window coordinates.\n */\nfunction calculateY(\n viewportBBox: Rect, anchorBBox: Rect, widgetSize: Size): number {\n // Flip the widget vertically if off the bottom.\n // The widget could go off the top of the window, but it would also go off\n // the bottom. The window is just too small.\n if (anchorBBox.bottom + widgetSize.height >= viewportBBox.bottom) {\n // The bottom of the widget is at the top of the field.\n return anchorBBox.top - widgetSize.height;\n } else {\n // The top of the widget is at the bottom of the field.\n return anchorBBox.bottom;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Fields can be created based on a JSON definition. This file\n * contains methods for registering those JSON definitions, and building the\n * fields based on JSON.\n *\n * @namespace Blockly.fieldRegistry\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.fieldRegistry');\n\nimport type {Field} from './field.js';\nimport type {IRegistrableField} from './interfaces/i_registrable_field.js';\nimport * as registry from './registry.js';\n\n\n/**\n * Registers a field type.\n * fieldRegistry.fromJson uses this registry to\n * find the appropriate field type.\n *\n * @param type The field type name as used in the JSON definition.\n * @param fieldClass The field class containing a fromJson function that can\n * construct an instance of the field.\n * @throws {Error} if the type name is empty, the field is already registered,\n * or the fieldClass is not an object containing a fromJson function.\n * @alias Blockly.fieldRegistry.register\n */\nexport function register(type: string, fieldClass: IRegistrableField) {\n registry.register(registry.Type.FIELD, type, fieldClass);\n}\n\n/**\n * Unregisters the field registered with the given type.\n *\n * @param type The field type name as used in the JSON definition.\n * @alias Blockly.fieldRegistry.unregister\n */\nexport function unregister(type: string) {\n registry.unregister(registry.Type.FIELD, type);\n}\n\n/**\n * Construct a Field from a JSON arg object.\n * Finds the appropriate registered field by the type name as registered using\n * fieldRegistry.register.\n *\n * @param options A JSON object with a type and options specific to the field\n * type.\n * @returns The new field instance or null if a field wasn't found with the\n * given type name\n * @alias Blockly.fieldRegistry.fromJson\n * @internal\n */\nexport function fromJson(options: AnyDuringMigration): Field|null {\n return TEST_ONLY.fromJsonInternal(options);\n}\n\n/**\n * Private version of fromJson for stubbing in tests.\n *\n * @param options\n */\nfunction fromJsonInternal(options: AnyDuringMigration): Field|null {\n const fieldObject = registry.getObject(registry.Type.FIELD, options['type']);\n if (!fieldObject) {\n console.warn(\n 'Blockly could not create a field of type ' + options['type'] +\n '. The field is probably not being registered. This could be because' +\n ' the file is not loaded, the field does not register itself (Issue' +\n ' #1584), or the registration is not being reached.');\n return null;\n } else if (typeof (fieldObject as any)['fromJson'] !== 'function') {\n throw new TypeError('returned Field was not a IRegistrableField');\n } else {\n return (fieldObject as unknown as IRegistrableField).fromJson(options);\n }\n}\n\nexport const TEST_ONLY = {\n fromJsonInternal,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * ARIA-related constants and utilities.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.aria\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.aria');\n\n\n/** ARIA states/properties prefix. */\nconst ARIA_PREFIX = 'aria-';\n\n/** ARIA role attribute. */\nconst ROLE_ATTRIBUTE = 'role';\n\n/**\n * ARIA role values.\n * Copied from Closure's goog.a11y.aria.Role\n *\n * @alias Blockly.utils.aria.Role\n */\nexport enum Role {\n // ARIA role for an interactive control of tabular data.\n GRID = 'grid',\n\n // ARIA role for a cell in a grid.\n GRIDCELL = 'gridcell',\n // ARIA role for a group of related elements like tree item siblings.\n GROUP = 'group',\n\n // ARIA role for a listbox.\n LISTBOX = 'listbox',\n\n // ARIA role for a popup menu.\n MENU = 'menu',\n\n // ARIA role for menu item elements.\n MENUITEM = 'menuitem',\n // ARIA role for a checkbox box element inside a menu.\n MENUITEMCHECKBOX = 'menuitemcheckbox',\n // ARIA role for option items that are children of combobox, listbox, menu,\n // radiogroup, or tree elements.\n OPTION = 'option',\n // ARIA role for ignorable cosmetic elements with no semantic significance.\n PRESENTATION = 'presentation',\n\n // ARIA role for a row of cells in a grid.\n ROW = 'row',\n // ARIA role for a tree.\n TREE = 'tree',\n\n // ARIA role for a tree item that sometimes may be expanded or collapsed.\n TREEITEM = 'treeitem'\n}\n\n/**\n * ARIA states and properties.\n * Copied from Closure's goog.a11y.aria.State\n *\n * @alias Blockly.utils.aria.State\n */\nexport enum State {\n // ARIA property for setting the currently active descendant of an element,\n // for example the selected item in a list box. Value: ID of an element.\n ACTIVEDESCENDANT = 'activedescendant',\n // ARIA property defines the total number of columns in a table, grid, or\n // treegrid.\n // Value: integer.\n COLCOUNT = 'colcount',\n // ARIA state for a disabled item. Value: one of {true, false}.\n DISABLED = 'disabled',\n\n // ARIA state for setting whether the element like a tree node is expanded.\n // Value: one of {true, false, undefined}.\n EXPANDED = 'expanded',\n\n // ARIA state indicating that the entered value does not conform. Value:\n // one of {false, true, 'grammar', 'spelling'}\n INVALID = 'invalid',\n\n // ARIA property that provides a label to override any other text, value, or\n // contents used to describe this element. Value: string.\n LABEL = 'label',\n // ARIA property for setting the element which labels another element.\n // Value: space-separated IDs of elements.\n LABELLEDBY = 'labelledby',\n\n // ARIA property for setting the level of an element in the hierarchy.\n // Value: integer.\n LEVEL = 'level',\n // ARIA property indicating if the element is horizontal or vertical.\n // Value: one of {'vertical', 'horizontal'}.\n ORIENTATION = 'orientation',\n\n // ARIA property that defines an element's number of position in a list.\n // Value: integer.\n POSINSET = 'posinset',\n\n // ARIA property defines the total number of rows in a table, grid, or\n // treegrid.\n // Value: integer.\n ROWCOUNT = 'rowcount',\n\n // ARIA state for setting the currently selected item in the list.\n // Value: one of {true, false, undefined}.\n SELECTED = 'selected',\n // ARIA property defining the number of items in a list. Value: integer.\n SETSIZE = 'setsize',\n\n // ARIA property for slider maximum value. Value: number.\n VALUEMAX = 'valuemax',\n\n // ARIA property for slider minimum value. Value: number.\n VALUEMIN = 'valuemin'\n}\n\n/**\n * Sets the role of an element.\n *\n * Similar to Closure's goog.a11y.aria\n *\n * @param element DOM node to set role of.\n * @param roleName Role name.\n * @alias Blockly.utils.aria.setRole\n */\nexport function setRole(element: Element, roleName: Role) {\n element.setAttribute(ROLE_ATTRIBUTE, roleName);\n}\n\n/**\n * Sets the state or property of an element.\n * Copied from Closure's goog.a11y.aria\n *\n * @param element DOM node where we set state.\n * @param stateName State attribute being set.\n * Automatically adds prefix 'aria-' to the state name if the attribute is\n * not an extra attribute.\n * @param value Value for the state attribute.\n * @alias Blockly.utils.aria.setState\n */\nexport function setState(\n element: Element, stateName: State, value: string|boolean|number|string[]) {\n if (Array.isArray(value)) {\n value = value.join(' ');\n }\n const attrStateName = ARIA_PREFIX + stateName;\n element.setAttribute(attrStateName, `${value}`);\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Dropdown input field. Used for editable titles and variables.\n * In the interests of a consistent UI, the toolbox shares some functions and\n * properties with the context menu.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldDropdown');\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {FieldConfig, Field, UnattachedFieldError} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {Menu} from './menu.js';\nimport {MenuItem} from './menuitem.js';\nimport * as aria from './utils/aria.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport * as parsing from './utils/parsing.js';\nimport type {Sentinel} from './utils/sentinel.js';\nimport * as utilsString from './utils/string.js';\nimport {Svg} from './utils/svg.js';\nimport * as userAgent from './utils/useragent.js';\n\n\n/**\n * Class for an editable dropdown field.\n *\n * @alias Blockly.FieldDropdown\n */\nexport class FieldDropdown extends Field {\n /** Horizontal distance that a checkmark overhangs the dropdown. */\n static CHECKMARK_OVERHANG = 25;\n\n /**\n * Maximum height of the dropdown menu, as a percentage of the viewport\n * height.\n */\n static MAX_MENU_HEIGHT_VH = 0.45;\n static ARROW_CHAR: AnyDuringMigration;\n\n /** A reference to the currently selected menu item. */\n private selectedMenuItem_: MenuItem|null = null;\n\n /** The dropdown menu. */\n protected menu_: Menu|null = null;\n\n /**\n * SVG image element if currently selected option is an image, or null.\n */\n private imageElement_: SVGImageElement|null = null;\n\n /** Tspan based arrow element. */\n private arrow_: SVGTSpanElement|null = null;\n\n /** SVG based arrow element. */\n private svgArrow_: SVGElement|null = null;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable.\n */\n override SERIALIZABLE = true;\n\n /** Mouse cursor style when over the hotspot that initiates the editor. */\n override CURSOR = 'default';\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n protected menuGenerator_!: AnyDuringMigration[][]|\n ((this: FieldDropdown) => AnyDuringMigration[][]);\n\n /** A cache of the most recently generated options. */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'string[][]'.\n private generatedOptions_: string[][] = null as AnyDuringMigration;\n\n /**\n * The prefix field label, of common words set after options are trimmed.\n *\n * @internal\n */\n override prefixField: string|null = null;\n\n /**\n * The suffix field label, of common words set after options are trimmed.\n *\n * @internal\n */\n override suffixField: string|null = null;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n private selectedOption_!: Array<string|ImageProperties>;\n override clickTarget_: AnyDuringMigration;\n\n /**\n * @param menuGenerator A non-empty array of options for a dropdown list, or a\n * function which generates these options. Also accepts Field.SKIP_SETUP\n * if you wish to skip setup (only used by subclasses that want to handle\n * configuration and setting the field value after their own constructors\n * have run).\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a language-neutral dropdown option & returns a\n * validated language-neutral dropdown option, or null to abort the\n * change.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/dropdown#creation}\n * for a list of properties this parameter supports.\n * @throws {TypeError} If `menuGenerator` options are incorrectly structured.\n */\n constructor(\n menuGenerator: AnyDuringMigration[][]|Function|Sentinel,\n opt_validator?: Function, opt_config?: FieldConfig) {\n super(Field.SKIP_SETUP);\n\n // If we pass SKIP_SETUP, don't do *anything* with the menu generator.\n if (menuGenerator === Field.SKIP_SETUP) {\n return;\n }\n\n if (Array.isArray(menuGenerator)) {\n validateOptions(menuGenerator);\n // Deep copy the option structure so it doesn't change.\n menuGenerator = JSON.parse(JSON.stringify(menuGenerator));\n }\n\n /**\n * An array of options for a dropdown list,\n * or a function which generates these options.\n */\n this.menuGenerator_ = menuGenerator as AnyDuringMigration[][] |\n ((this: FieldDropdown) => AnyDuringMigration[][]);\n\n this.trimOptions_();\n\n /**\n * The currently selected option. The field is initialized with the\n * first option selected.\n */\n this.selectedOption_ = this.getOptions(false)[0];\n\n if (opt_config) {\n this.configure_(opt_config);\n }\n this.setValue(this.selectedOption_[1]);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n /**\n * Sets the field's value based on the given XML element. Should only be\n * called by Blockly.Xml.\n *\n * @param fieldElement The element containing info about the field's state.\n * @internal\n */\n override fromXml(fieldElement: Element) {\n if (this.isOptionListDynamic()) {\n this.getOptions(false);\n }\n this.setValue(fieldElement.textContent);\n }\n\n /**\n * Sets the field's value based on the given state.\n *\n * @param state The state to apply to the dropdown field.\n * @internal\n */\n override loadState(state: AnyDuringMigration) {\n if (this.loadLegacyState(FieldDropdown, state)) {\n return;\n }\n if (this.isOptionListDynamic()) {\n this.getOptions(false);\n }\n this.setValue(state);\n }\n\n /**\n * Create the block UI for this dropdown.\n *\n * @internal\n */\n override initView() {\n if (this.shouldAddBorderRect_()) {\n this.createBorderRect_();\n } else {\n this.clickTarget_ = (this.sourceBlock_ as BlockSvg).getSvgRoot();\n }\n this.createTextElement_();\n\n this.imageElement_ = dom.createSvgElement(Svg.IMAGE, {}, this.fieldGroup_);\n\n if (this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW) {\n this.createSVGArrow_();\n } else {\n this.createTextArrow_();\n }\n\n if (this.borderRect_) {\n dom.addClass(this.borderRect_, 'blocklyDropdownRect');\n }\n }\n\n /**\n * Whether or not the dropdown should add a border rect.\n *\n * @returns True if the dropdown field should add a border rect.\n */\n protected shouldAddBorderRect_(): boolean {\n return !this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW ||\n this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW &&\n !this.getSourceBlock()?.isShadow();\n }\n\n /** Create a tspan based arrow. */\n protected createTextArrow_() {\n this.arrow_ = dom.createSvgElement(Svg.TSPAN, {}, this.textElement_);\n this.arrow_!.appendChild(document.createTextNode(\n this.getSourceBlock()?.RTL ? FieldDropdown.ARROW_CHAR + ' ' :\n ' ' + FieldDropdown.ARROW_CHAR));\n if (this.getSourceBlock()?.RTL) {\n // AnyDuringMigration because: Argument of type 'SVGTSpanElement | null'\n // is not assignable to parameter of type 'Node'.\n this.getTextElement().insertBefore(\n this.arrow_ as AnyDuringMigration, this.textContent_);\n } else {\n // AnyDuringMigration because: Argument of type 'SVGTSpanElement | null'\n // is not assignable to parameter of type 'Node'.\n this.getTextElement().appendChild(this.arrow_ as AnyDuringMigration);\n }\n }\n\n /** Create an SVG based arrow. */\n protected createSVGArrow_() {\n this.svgArrow_ = dom.createSvgElement(\n Svg.IMAGE, {\n 'height': this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px',\n 'width': this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px',\n },\n this.fieldGroup_);\n this.svgArrow_!.setAttributeNS(\n dom.XLINK_NS, 'xlink:href',\n this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_DATAURI);\n }\n\n /**\n * Create a dropdown menu under the text.\n *\n * @param opt_e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n */\n protected override showEditor_(opt_e?: Event) {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n this.dropdownCreate_();\n // AnyDuringMigration because: Property 'clientX' does not exist on type\n // 'Event'.\n if (opt_e && typeof (opt_e as AnyDuringMigration).clientX === 'number') {\n // AnyDuringMigration because: Property 'clientY' does not exist on type\n // 'Event'. AnyDuringMigration because: Property 'clientX' does not exist\n // on type 'Event'.\n this.menu_!.openingCoords = new Coordinate(\n (opt_e as AnyDuringMigration).clientX,\n (opt_e as AnyDuringMigration).clientY);\n } else {\n this.menu_!.openingCoords = null;\n }\n\n // Remove any pre-existing elements in the dropdown.\n dropDownDiv.clearContent();\n // Element gets created in render.\n const menuElement = this.menu_!.render(dropDownDiv.getContentDiv());\n dom.addClass(menuElement, 'blocklyDropdownMenu');\n\n if (this.getConstants()!.FIELD_DROPDOWN_COLOURED_DIV) {\n const primaryColour =\n block.isShadow() ? block.getParent()!.getColour() : block.getColour();\n const borderColour = block.isShadow() ?\n (block.getParent() as BlockSvg).style.colourTertiary :\n (this.sourceBlock_ as BlockSvg).style.colourTertiary;\n if (!borderColour) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n dropDownDiv.setColour(primaryColour, borderColour);\n }\n\n dropDownDiv.showPositionedByField(this, this.dropdownDispose_.bind(this));\n\n // Focusing needs to be handled after the menu is rendered and positioned.\n // Otherwise it will cause a page scroll to get the misplaced menu in\n // view. See issue #1329.\n this.menu_!.focus();\n\n if (this.selectedMenuItem_) {\n this.menu_!.setHighlighted(this.selectedMenuItem_);\n }\n\n this.applyColour();\n }\n\n /** Create the dropdown editor. */\n private dropdownCreate_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n const menu = new Menu();\n menu.setRole(aria.Role.LISTBOX);\n this.menu_ = menu;\n\n const options = this.getOptions(false);\n this.selectedMenuItem_ = null;\n for (let i = 0; i < options.length; i++) {\n let content = options[i][0]; // Human-readable text or image.\n const value = options[i][1]; // Language-neutral value.\n if (typeof content === 'object') {\n // An image, not text.\n const image = new Image(content['width'], content['height']);\n image.src = content['src'];\n image.alt = content['alt'] || '';\n content = image;\n }\n const menuItem = new MenuItem(content, value);\n menuItem.setRole(aria.Role.OPTION);\n menuItem.setRightToLeft(block.RTL);\n menuItem.setCheckable(true);\n menu.addChild(menuItem);\n menuItem.setChecked(value === this.value_);\n if (value === this.value_) {\n this.selectedMenuItem_ = menuItem;\n }\n menuItem.onAction(this.handleMenuActionEvent_, this);\n }\n }\n\n /**\n * Disposes of events and DOM-references belonging to the dropdown editor.\n */\n private dropdownDispose_() {\n if (this.menu_) {\n this.menu_.dispose();\n }\n this.menu_ = null;\n this.selectedMenuItem_ = null;\n this.applyColour();\n }\n\n /**\n * Handle an action in the dropdown menu.\n *\n * @param menuItem The MenuItem selected within menu.\n */\n private handleMenuActionEvent_(menuItem: MenuItem) {\n dropDownDiv.hideIfOwner(this, true);\n this.onItemSelected_(this.menu_ as Menu, menuItem);\n }\n\n /**\n * Handle the selection of an item in the dropdown menu.\n *\n * @param menu The Menu component clicked.\n * @param menuItem The MenuItem selected within menu.\n */\n protected onItemSelected_(menu: Menu, menuItem: MenuItem) {\n this.setValue(menuItem.getValue());\n }\n\n /**\n * Factor out common words in statically defined options.\n * Create prefix and/or suffix labels.\n */\n private trimOptions_() {\n const options = this.menuGenerator_;\n if (!Array.isArray(options)) {\n return;\n }\n let hasImages = false;\n\n // Localize label text and image alt text.\n for (let i = 0; i < options.length; i++) {\n const label = options[i][0];\n if (typeof label === 'string') {\n options[i][0] = parsing.replaceMessageReferences(label);\n } else {\n if (label.alt !== null) {\n options[i][0].alt = parsing.replaceMessageReferences(label.alt);\n }\n hasImages = true;\n }\n }\n if (hasImages || options.length < 2) {\n return; // Do nothing if too few items or at least one label is an image.\n }\n const strings = [];\n for (let i = 0; i < options.length; i++) {\n strings.push(options[i][0]);\n }\n const shortest = utilsString.shortestStringLength(strings);\n const prefixLength = utilsString.commonWordPrefix(strings, shortest);\n const suffixLength = utilsString.commonWordSuffix(strings, shortest);\n if (!prefixLength && !suffixLength) {\n return;\n }\n if (shortest <= prefixLength + suffixLength) {\n // One or more strings will entirely vanish if we proceed. Abort.\n return;\n }\n if (prefixLength) {\n this.prefixField = strings[0].substring(0, prefixLength - 1);\n }\n if (suffixLength) {\n this.suffixField = strings[0].substr(1 - suffixLength);\n }\n\n this.menuGenerator_ =\n FieldDropdown.applyTrim_(options, prefixLength, suffixLength);\n }\n\n /**\n * @returns True if the option list is generated by a function.\n * Otherwise false.\n */\n isOptionListDynamic(): boolean {\n return typeof this.menuGenerator_ === 'function';\n }\n\n /**\n * Return a list of the options for this dropdown.\n *\n * @param opt_useCache For dynamic options, whether or not to use the cached\n * options or to re-generate them.\n * @returns A non-empty array of option tuples:\n * (human-readable text or image, language-neutral name).\n * @throws {TypeError} If generated options are incorrectly structured.\n */\n getOptions(opt_useCache?: boolean): AnyDuringMigration[][] {\n if (this.isOptionListDynamic()) {\n if (!this.generatedOptions_ || !opt_useCache) {\n // AnyDuringMigration because: Property 'call' does not exist on type\n // 'any[][] | ((this: FieldDropdown) => any[][])'.\n this.generatedOptions_ =\n (this.menuGenerator_ as AnyDuringMigration).call(this);\n validateOptions(this.generatedOptions_);\n }\n return this.generatedOptions_;\n }\n return this.menuGenerator_ as string[][];\n }\n\n /**\n * Ensure that the input value is a valid language-neutral option.\n *\n * @param opt_newValue The input value.\n * @returns A valid language-neutral option, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n string|null {\n let isValueValid = false;\n const options = this.getOptions(true);\n for (let i = 0, option; option = options[i]; i++) {\n // Options are tuples of human-readable text and language-neutral values.\n if (option[1] === opt_newValue) {\n isValueValid = true;\n break;\n }\n }\n if (!isValueValid) {\n if (this.sourceBlock_) {\n console.warn(\n 'Cannot set the dropdown\\'s value to an unavailable option.' +\n ' Block type: ' + this.sourceBlock_.type +\n ', Field name: ' + this.name + ', Value: ' + opt_newValue);\n }\n return null;\n }\n return opt_newValue as string;\n }\n\n /**\n * Update the value of this dropdown field.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is one of the valid dropdown options.\n */\n protected override doValueUpdate_(newValue: AnyDuringMigration) {\n super.doValueUpdate_(newValue);\n const options = this.getOptions(true);\n for (let i = 0, option; option = options[i]; i++) {\n if (option[1] === this.value_) {\n this.selectedOption_ = option;\n }\n }\n }\n\n /**\n * Updates the dropdown arrow to match the colour/style of the block.\n *\n * @internal\n */\n override applyColour() {\n const style = (this.sourceBlock_ as BlockSvg).style;\n if (!style.colourSecondary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n if (!style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n if (this.borderRect_) {\n this.borderRect_.setAttribute('stroke', style.colourTertiary);\n if (this.menu_) {\n this.borderRect_.setAttribute('fill', style.colourTertiary);\n } else {\n this.borderRect_.setAttribute('fill', 'transparent');\n }\n }\n // Update arrow's colour.\n if (this.sourceBlock_ && this.arrow_) {\n if (this.sourceBlock_.isShadow()) {\n this.arrow_.style.fill = style.colourSecondary;\n } else {\n this.arrow_.style.fill = style.colourPrimary;\n }\n }\n }\n\n /** Draws the border with the correct width. */\n protected override render_() {\n // Hide both elements.\n this.getTextContent().nodeValue = '';\n this.imageElement_!.style.display = 'none';\n\n // Show correct element.\n const option = this.selectedOption_ && this.selectedOption_[0];\n if (option && typeof option === 'object') {\n this.renderSelectedImage_((option));\n } else {\n this.renderSelectedText_();\n }\n\n this.positionBorderRect_();\n }\n\n /**\n * Renders the selected option, which must be an image.\n *\n * @param imageJson Selected option that must be an image.\n */\n private renderSelectedImage_(imageJson: ImageProperties) {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n this.imageElement_!.style.display = '';\n this.imageElement_!.setAttributeNS(\n dom.XLINK_NS, 'xlink:href', imageJson.src);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.imageElement_!.setAttribute(\n 'height', imageJson.height as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.imageElement_!.setAttribute(\n 'width', imageJson.width as AnyDuringMigration);\n\n const imageHeight = Number(imageJson.height);\n const imageWidth = Number(imageJson.width);\n\n // Height and width include the border rect.\n const hasBorder = !!this.borderRect_;\n const height = Math.max(\n hasBorder ? this.getConstants()!.FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0,\n imageHeight + IMAGE_Y_PADDING);\n const xPadding =\n hasBorder ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING : 0;\n let arrowWidth = 0;\n if (this.svgArrow_) {\n arrowWidth = this.positionSVGArrow_(\n imageWidth + xPadding,\n height / 2 - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2);\n } else {\n arrowWidth = dom.getFastTextWidth(\n this.arrow_ as SVGTSpanElement,\n this.getConstants()!.FIELD_TEXT_FONTSIZE,\n this.getConstants()!.FIELD_TEXT_FONTWEIGHT,\n this.getConstants()!.FIELD_TEXT_FONTFAMILY);\n }\n this.size_.width = imageWidth + arrowWidth + xPadding * 2;\n this.size_.height = height;\n\n let arrowX = 0;\n if (block.RTL) {\n const imageX = xPadding + arrowWidth;\n this.imageElement_!.setAttribute('x', imageX.toString());\n } else {\n arrowX = imageWidth + arrowWidth;\n this.getTextElement().setAttribute('text-anchor', 'end');\n this.imageElement_!.setAttribute('x', xPadding.toString());\n }\n this.imageElement_!.setAttribute(\n 'y', (height / 2 - imageHeight / 2).toString());\n\n this.positionTextElement_(arrowX + xPadding, imageWidth + arrowWidth);\n }\n\n /** Renders the selected option, which must be text. */\n private renderSelectedText_() {\n // Retrieves the selected option to display through getText_.\n this.getTextContent().nodeValue = this.getDisplayText_();\n const textElement = this.getTextElement();\n dom.addClass(textElement, 'blocklyDropdownText');\n textElement.setAttribute('text-anchor', 'start');\n\n // Height and width include the border rect.\n const hasBorder = !!this.borderRect_;\n const height = Math.max(\n hasBorder ? this.getConstants()!.FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0,\n this.getConstants()!.FIELD_TEXT_HEIGHT);\n const textWidth = dom.getFastTextWidth(\n this.getTextElement(), this.getConstants()!.FIELD_TEXT_FONTSIZE,\n this.getConstants()!.FIELD_TEXT_FONTWEIGHT,\n this.getConstants()!.FIELD_TEXT_FONTFAMILY);\n const xPadding =\n hasBorder ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING : 0;\n let arrowWidth = 0;\n if (this.svgArrow_) {\n arrowWidth = this.positionSVGArrow_(\n textWidth + xPadding,\n height / 2 - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2);\n }\n this.size_.width = textWidth + arrowWidth + xPadding * 2;\n this.size_.height = height;\n\n this.positionTextElement_(xPadding, textWidth);\n }\n\n /**\n * Position a drop-down arrow at the appropriate location at render-time.\n *\n * @param x X position the arrow is being rendered at, in px.\n * @param y Y position the arrow is being rendered at, in px.\n * @returns Amount of space the arrow is taking up, in px.\n */\n private positionSVGArrow_(x: number, y: number): number {\n if (!this.svgArrow_) {\n return 0;\n }\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n const hasBorder = !!this.borderRect_;\n const xPadding =\n hasBorder ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING : 0;\n const textPadding = this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_PADDING;\n const svgArrowSize = this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE;\n const arrowX = block.RTL ? xPadding : x + textPadding;\n this.svgArrow_.setAttribute(\n 'transform', 'translate(' + arrowX + ',' + y + ')');\n return svgArrowSize + textPadding;\n }\n\n /**\n * Use the `getText_` developer hook to override the field's text\n * representation. Get the selected option text. If the selected option is an\n * image we return the image alt text.\n *\n * @returns Selected option text.\n */\n protected override getText_(): string|null {\n if (!this.selectedOption_) {\n return null;\n }\n const option = this.selectedOption_[0];\n if (typeof option === 'object') {\n return option['alt'];\n }\n return option;\n }\n\n /**\n * Construct a FieldDropdown from a JSON arg object.\n *\n * @param options A JSON object with options (options).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static fromJson(options: FieldDropdownFromJsonConfig): FieldDropdown {\n if (!options.options) {\n throw new Error(\n 'options are required for the dropdown field. The ' +\n 'options property must be assigned an array of ' +\n '[humanReadableValue, languageNeutralValue] tuples.');\n }\n // `this` might be a subclass of FieldDropdown if that class doesn't\n // override the static fromJson method.\n return new this(options.options, undefined, options);\n }\n\n /**\n * Use the calculated prefix and suffix lengths to trim all of the options in\n * the given array.\n *\n * @param options Array of option tuples:\n * (human-readable text or image, language-neutral name).\n * @param prefixLength The length of the common prefix.\n * @param suffixLength The length of the common suffix\n * @returns A new array with all of the option text trimmed.\n */\n static applyTrim_(\n options: AnyDuringMigration[][], prefixLength: number,\n suffixLength: number): AnyDuringMigration[][] {\n const newOptions = [];\n // Remove the prefix and suffix from the options.\n for (let i = 0; i < options.length; i++) {\n let text = options[i][0];\n const value = options[i][1];\n text = text.substring(prefixLength, text.length - suffixLength);\n newOptions[i] = [text, value];\n }\n return newOptions;\n }\n}\n\n/**\n * Definition of a human-readable image dropdown option.\n */\nexport interface ImageProperties {\n src: string;\n alt: string;\n width: number;\n height: number;\n}\n\n/**\n * An individual option in the dropdown menu. The first element is the human-\n * readable value (text or image), and the second element is the language-\n * neutral value.\n */\nexport type MenuOption = [string | ImageProperties, string];\n\n/**\n * fromJson config for the dropdown field.\n */\nexport interface FieldDropdownFromJsonConfig extends FieldConfig {\n options?: MenuOption[];\n}\n\n/**\n * The y offset from the top of the field to the top of the image, if an image\n * is selected.\n */\nconst IMAGE_Y_OFFSET = 5;\n\n/** The total vertical padding above and below an image. */\nconst IMAGE_Y_PADDING: number = IMAGE_Y_OFFSET * 2;\n\n/** Android can't (in 2014) display \"▾\", so use \"▼\" instead. */\nFieldDropdown.ARROW_CHAR = userAgent.ANDROID ? '▼' : '▾';\n\n/**\n * Validates the data structure to be processed as an options list.\n *\n * @param options The proposed dropdown options.\n * @throws {TypeError} If proposed options are incorrectly structured.\n */\nfunction validateOptions(options: AnyDuringMigration) {\n if (!Array.isArray(options)) {\n throw TypeError('FieldDropdown options must be an array.');\n }\n if (!options.length) {\n throw TypeError('FieldDropdown options must not be an empty array.');\n }\n let foundError = false;\n for (let i = 0; i < options.length; i++) {\n const tuple = options[i];\n if (!Array.isArray(tuple)) {\n foundError = true;\n console.error(\n 'Invalid option[' + i + ']: Each FieldDropdown option must be an ' +\n 'array. Found: ',\n tuple);\n } else if (typeof tuple[1] !== 'string') {\n foundError = true;\n console.error(\n 'Invalid option[' + i + ']: Each FieldDropdown option id must be ' +\n 'a string. Found ' + tuple[1] + ' in: ',\n tuple);\n } else if (\n tuple[0] && typeof tuple[0] !== 'string' &&\n typeof tuple[0].src !== 'string') {\n foundError = true;\n console.error(\n 'Invalid option[' + i + ']: Each FieldDropdown option must have a ' +\n 'string label or image description. Found' + tuple[0] + ' in: ',\n tuple);\n }\n }\n if (foundError) {\n throw TypeError('Found invalid FieldDropdown options.');\n }\n}\n\nfieldRegistry.register('field_dropdown', FieldDropdown);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for objects.\n *\n * @namespace Blockly.utils.object\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.object');\n\nimport * as deprecation from './deprecation.js';\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * @param childCtor Child class.\n * @param parentCtor Parent class.\n * @suppress {strictMissingProperties} superClass_ is not defined on Function.\n * @deprecated No longer provided by Blockly.\n * @alias Blockly.utils.object.inherits\n */\nexport function inherits(childCtor: Function, parentCtor: Function) {\n deprecation.warn('Blockly.utils.object.inherits', 'version 9', 'version 10');\n // Set a .superClass_ property so that methods can call parent methods\n // without hard-coding the parent class name.\n // Could be replaced by ES6's super().\n // AnyDuringMigration because: Property 'superClass_' does not exist on type\n // 'Function'.\n (childCtor as AnyDuringMigration).superClass_ = parentCtor.prototype;\n\n // Link the child class to the parent class so that static methods inherit.\n Object.setPrototypeOf(childCtor, parentCtor);\n\n // Replace the child constructor's prototype object with an instance\n // of the parent class.\n childCtor.prototype = Object.create(parentCtor.prototype);\n childCtor.prototype.constructor = childCtor;\n}\n// Alternatively, one could use this instead:\n// Object.setPrototypeOf(childCtor.prototype, parentCtor.prototype);\n\n/**\n * Copies all the members of a source object to a target object.\n *\n * @param target Target.\n * @param source Source.\n * @deprecated Use the built-in **Object.assign** instead.\n * @alias Blockly.utils.object.mixin\n */\nexport function mixin(target: AnyDuringMigration, source: AnyDuringMigration) {\n deprecation.warn(\n 'Blockly.utils.object.mixin', 'May 2022', 'May 2023', 'Object.assign');\n for (const x in source) {\n target[x] = source[x];\n }\n}\n\n/**\n * Complete a deep merge of all members of a source object with a target object.\n *\n * @param target Target.\n * @param source Source.\n * @returns The resulting object.\n * @alias Blockly.utils.object.deepMerge\n */\nexport function deepMerge(\n target: AnyDuringMigration,\n source: AnyDuringMigration): AnyDuringMigration {\n for (const x in source) {\n if (source[x] !== null && typeof source[x] === 'object') {\n target[x] = deepMerge(target[x] || Object.create(null), source[x]);\n } else {\n target[x] = source[x];\n }\n }\n return target;\n}\n\n/**\n * Returns an array of a given object's own enumerable property values.\n *\n * @param obj Object containing values.\n * @returns Array of values.\n * @deprecated Use the built-in **Object.values** instead.\n * @alias Blockly.utils.object.values\n */\nexport function values(obj: AnyDuringMigration): AnyDuringMigration[] {\n deprecation.warn(\n 'Blockly.utils.object.values', 'version 9', 'version 10',\n 'Object.values');\n return Object.values(obj);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility functions for the toolbox and flyout.\n *\n * @namespace Blockly.utils.toolbox\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.toolbox');\n\nimport type {ConnectionState} from '../serialization/blocks.js';\nimport type {CssConfig as CategoryCssConfig} from '../toolbox/category.js';\nimport type {CssConfig as SeparatorCssConfig} from '../toolbox/separator.js';\nimport * as Xml from '../xml.js';\n\n\n/**\n * The information needed to create a block in the toolbox.\n * Note that disabled has a different type for backwards compatibility.\n *\n * @alias Blockly.utils.toolbox.BlockInfo\n */\nexport interface BlockInfo {\n kind: string;\n blockxml?: string|Node;\n type?: string;\n gap?: string|number;\n disabled?: string|boolean;\n enabled?: boolean;\n id?: string;\n x?: number;\n y?: number;\n collapsed?: boolean;\n inline?: boolean;\n data?: string;\n extraState?: AnyDuringMigration;\n icons?: {[key: string]: AnyDuringMigration};\n fields?: {[key: string]: AnyDuringMigration};\n inputs?: {[key: string]: ConnectionState};\n next?: ConnectionState;\n}\n\n/**\n * The information needed to create a separator in the toolbox.\n *\n * @alias Blockly.utils.toolbox.SeparatorInfo\n */\nexport interface SeparatorInfo {\n kind: string;\n id: string|undefined;\n gap: number|undefined;\n cssconfig: SeparatorCssConfig|undefined;\n}\n\n/**\n * The information needed to create a button in the toolbox.\n *\n * @alias Blockly.utils.toolbox.ButtonInfo\n */\nexport interface ButtonInfo {\n kind: string;\n text: string;\n callbackkey: string;\n}\n\n/**\n * The information needed to create a label in the toolbox.\n *\n * @alias Blockly.utils.toolbox.LabelInfo\n */\nexport interface LabelInfo {\n kind: string;\n text: string;\n id: string|undefined;\n}\n\n/**\n * The information needed to create either a button or a label in the flyout.\n *\n * @alias Blockly.utils.toolbox.ButtonOrLabelInfo\n */\nexport type ButtonOrLabelInfo = ButtonInfo|LabelInfo;\n\n/**\n * The information needed to create a category in the toolbox.\n *\n * @alias Blockly.utils.toolbox.StaticCategoryInfo\n */\nexport interface StaticCategoryInfo {\n kind: string;\n name: string;\n contents: ToolboxItemInfo[];\n id: string|undefined;\n categorystyle: string|undefined;\n colour: string|undefined;\n cssconfig: CategoryCssConfig|undefined;\n hidden: string|undefined;\n}\n\n/**\n * The information needed to create a custom category.\n *\n * @alias Blockly.utils.toolbox.DynamicCategoryInfo\n */\nexport interface DynamicCategoryInfo {\n kind: string;\n custom: string;\n id: string|undefined;\n categorystyle: string|undefined;\n colour: string|undefined;\n cssconfig: CategoryCssConfig|undefined;\n hidden: string|undefined;\n}\n\n/**\n * The information needed to create either a dynamic or static category.\n *\n * @alias Blockly.utils.toolbox.CategoryInfo\n */\nexport type CategoryInfo = StaticCategoryInfo|DynamicCategoryInfo;\n\n/**\n * Any information that can be used to create an item in the toolbox.\n *\n * @alias Blockly.utils.toolbox.ToolboxItemInfo\n */\nexport type ToolboxItemInfo = FlyoutItemInfo|StaticCategoryInfo;\n\n/**\n * All the different types that can be displayed in a flyout.\n *\n * @alias Blockly.utils.toolbox.FlyoutItemInfo\n */\nexport type FlyoutItemInfo =\n BlockInfo|SeparatorInfo|ButtonInfo|LabelInfo|DynamicCategoryInfo;\n\n/**\n * The JSON definition of a toolbox.\n *\n * @alias Blockly.utils.toolbox.ToolboxInfo\n */\nexport interface ToolboxInfo {\n kind?: string;\n contents: ToolboxItemInfo[];\n}\n\n/**\n * An array holding flyout items.\n *\n * @alias Blockly.utils.toolbox.FlyoutItemInfoArray\n */\nexport type FlyoutItemInfoArray = FlyoutItemInfo[];\n\n/**\n * All of the different types that can create a toolbox.\n *\n * @alias Blockly.utils.toolbox.ToolboxDefinition\n */\nexport type ToolboxDefinition = Node|ToolboxInfo|string;\n\n/**\n * All of the different types that can be used to show items in a flyout.\n *\n * @alias Blockly.utils.toolbox.FlyoutDefinition\n */\nexport type FlyoutDefinition = FlyoutItemInfoArray|NodeList|ToolboxInfo|Node[];\n\n/**\n * The name used to identify a toolbox that has category like items.\n * This only needs to be used if a toolbox wants to be treated like a category\n * toolbox but does not actually contain any toolbox items with the kind\n * 'category'.\n */\nconst CATEGORY_TOOLBOX_KIND = 'categoryToolbox';\n\n/**\n * The name used to identify a toolbox that has no categories and is displayed\n * as a simple flyout displaying blocks, buttons, or labels.\n */\nconst FLYOUT_TOOLBOX_KIND = 'flyoutToolbox';\n\n/**\n * Position of the toolbox and/or flyout relative to the workspace.\n *\n * @alias Blockly.utils.toolbox.Position\n */\nexport enum Position {\n TOP,\n BOTTOM,\n LEFT,\n RIGHT\n}\n\n/**\n * Converts the toolbox definition into toolbox JSON.\n *\n * @param toolboxDef The definition of the toolbox in one of its many forms.\n * @returns Object holding information for creating a toolbox.\n * @alias Blockly.utils.toolbox.convertToolboxDefToJson\n * @internal\n */\nexport function convertToolboxDefToJson(toolboxDef: ToolboxDefinition|\n null): ToolboxInfo|null {\n if (!toolboxDef) {\n return null;\n }\n\n if (toolboxDef instanceof Element || typeof toolboxDef === 'string') {\n toolboxDef = parseToolboxTree(toolboxDef);\n // AnyDuringMigration because: Argument of type 'Node | null' is not\n // assignable to parameter of type 'Node'.\n toolboxDef = convertToToolboxJson(toolboxDef as AnyDuringMigration);\n }\n\n const toolboxJson = toolboxDef as ToolboxInfo;\n validateToolbox(toolboxJson);\n return toolboxJson;\n}\n\n/**\n * Validates the toolbox JSON fields have been set correctly.\n *\n * @param toolboxJson Object holding information for creating a toolbox.\n * @throws {Error} if the toolbox is not the correct format.\n */\nfunction validateToolbox(toolboxJson: ToolboxInfo) {\n const toolboxKind = toolboxJson['kind'];\n const toolboxContents = toolboxJson['contents'];\n\n if (toolboxKind) {\n if (toolboxKind !== FLYOUT_TOOLBOX_KIND &&\n toolboxKind !== CATEGORY_TOOLBOX_KIND) {\n throw Error(\n 'Invalid toolbox kind ' + toolboxKind + '.' +\n ' Please supply either ' + FLYOUT_TOOLBOX_KIND + ' or ' +\n CATEGORY_TOOLBOX_KIND);\n }\n }\n if (!toolboxContents) {\n throw Error('Toolbox must have a contents attribute.');\n }\n}\n\n/**\n * Converts the flyout definition into a list of flyout items.\n *\n * @param flyoutDef The definition of the flyout in one of its many forms.\n * @returns A list of flyout items.\n * @alias Blockly.utils.toolbox.convertFlyoutDefToJsonArray\n * @internal\n */\nexport function convertFlyoutDefToJsonArray(flyoutDef: FlyoutDefinition|\n null): FlyoutItemInfoArray {\n if (!flyoutDef) {\n return [];\n }\n\n if ((flyoutDef as AnyDuringMigration)['contents']) {\n return (flyoutDef as AnyDuringMigration)['contents'];\n }\n // If it is already in the correct format return the flyoutDef.\n // AnyDuringMigration because: Property 'nodeType' does not exist on type\n // 'Node | FlyoutItemInfo'.\n if (Array.isArray(flyoutDef) && flyoutDef.length > 0 &&\n !((flyoutDef[0]) as AnyDuringMigration).nodeType) {\n // AnyDuringMigration because: Type 'FlyoutItemInfoArray | Node[]' is not\n // assignable to type 'FlyoutItemInfoArray'.\n return flyoutDef as AnyDuringMigration;\n }\n\n // AnyDuringMigration because: Type 'ToolboxItemInfo[] | FlyoutItemInfoArray'\n // is not assignable to type 'FlyoutItemInfoArray'.\n return xmlToJsonArray(flyoutDef as Node[] | NodeList) as AnyDuringMigration;\n}\n\n/**\n * Whether or not the toolbox definition has categories.\n *\n * @param toolboxJson Object holding information for creating a toolbox.\n * @returns True if the toolbox has categories.\n * @alias Blockly.utils.toolbox.hasCategories\n * @internal\n */\nexport function hasCategories(toolboxJson: ToolboxInfo|null): boolean {\n return TEST_ONLY.hasCategoriesInternal(toolboxJson);\n}\n\n/**\n * Private version of hasCategories for stubbing in tests.\n */\nfunction hasCategoriesInternal(toolboxJson: ToolboxInfo|null): boolean {\n if (!toolboxJson) {\n return false;\n }\n\n const toolboxKind = toolboxJson['kind'];\n if (toolboxKind) {\n return toolboxKind === CATEGORY_TOOLBOX_KIND;\n }\n\n const categories = toolboxJson['contents'].filter(function(item) {\n return item['kind'].toUpperCase() === 'CATEGORY';\n });\n return !!categories.length;\n}\n\n/**\n * Whether or not the category is collapsible.\n *\n * @param categoryInfo Object holing information for creating a category.\n * @returns True if the category has subcategories.\n * @alias Blockly.utils.toolbox.isCategoryCollapsible\n * @internal\n */\nexport function isCategoryCollapsible(categoryInfo: CategoryInfo): boolean {\n if (!categoryInfo || !(categoryInfo as AnyDuringMigration)['contents']) {\n return false;\n }\n\n const categories =\n (categoryInfo as AnyDuringMigration)['contents'].filter(function(\n item: AnyDuringMigration) {\n return item['kind'].toUpperCase() === 'CATEGORY';\n });\n return !!categories.length;\n}\n\n/**\n * Parses the provided toolbox definition into a consistent format.\n *\n * @param toolboxDef The definition of the toolbox in one of its many forms.\n * @returns Object holding information for creating a toolbox.\n */\nfunction convertToToolboxJson(toolboxDef: Node): ToolboxInfo {\n const contents = xmlToJsonArray(toolboxDef as Node | Node[]);\n const toolboxJson = {'contents': contents};\n if (toolboxDef instanceof Node) {\n addAttributes(toolboxDef, toolboxJson);\n }\n return toolboxJson;\n}\n\n/**\n * Converts the xml for a toolbox to JSON.\n *\n * @param toolboxDef The definition of the toolbox in one of its many forms.\n * @returns A list of objects in the toolbox.\n */\nfunction xmlToJsonArray(toolboxDef: Node|Node[]|NodeList): FlyoutItemInfoArray|\n ToolboxItemInfo[] {\n const arr = [];\n // If it is a node it will have children.\n // AnyDuringMigration because: Property 'childNodes' does not exist on type\n // 'Node | NodeList | Node[]'.\n let childNodes = (toolboxDef as AnyDuringMigration).childNodes;\n if (!childNodes) {\n // Otherwise the toolboxDef is an array or collection.\n childNodes = toolboxDef;\n }\n for (let i = 0, child; child = childNodes[i]; i++) {\n if (!child.tagName) {\n continue;\n }\n const obj = {};\n const tagName = child.tagName.toUpperCase();\n (obj as AnyDuringMigration)['kind'] = tagName;\n\n // Store the XML for a block.\n if (tagName === 'BLOCK') {\n (obj as AnyDuringMigration)['blockxml'] = child;\n } else if (child.childNodes && child.childNodes.length > 0) {\n // Get the contents of a category\n (obj as AnyDuringMigration)['contents'] = xmlToJsonArray(child);\n }\n\n // Add XML attributes to object\n addAttributes(child, obj);\n arr.push(obj);\n }\n // AnyDuringMigration because: Type '{}[]' is not assignable to type\n // 'ToolboxItemInfo[] | FlyoutItemInfoArray'.\n return arr as AnyDuringMigration;\n}\n\n/**\n * Adds the attributes on the node to the given object.\n *\n * @param node The node to copy the attributes from.\n * @param obj The object to copy the attributes to.\n */\nfunction addAttributes(node: Node, obj: AnyDuringMigration) {\n // AnyDuringMigration because: Property 'attributes' does not exist on type\n // 'Node'.\n for (let j = 0; j < (node as AnyDuringMigration).attributes.length; j++) {\n // AnyDuringMigration because: Property 'attributes' does not exist on type\n // 'Node'.\n const attr = (node as AnyDuringMigration).attributes[j];\n if (attr.nodeName.indexOf('css-') > -1) {\n obj['cssconfig'] = obj['cssconfig'] || {};\n obj['cssconfig'][attr.nodeName.replace('css-', '')] = attr.value;\n } else {\n obj[attr.nodeName] = attr.value;\n }\n }\n}\n\n/**\n * Parse the provided toolbox tree into a consistent DOM format.\n *\n * @param toolboxDef DOM tree of blocks, or text representation of same.\n * @returns DOM tree of blocks, or null.\n * @alias Blockly.utils.toolbox.parseToolboxTree\n */\nexport function parseToolboxTree(toolboxDef: Element|null|string): Element|\n null {\n let parsedToolboxDef: Element|null = null;\n if (toolboxDef) {\n if (typeof toolboxDef === 'string') {\n parsedToolboxDef = Xml.textToDom(toolboxDef);\n if (parsedToolboxDef.nodeName.toLowerCase() !== 'xml') {\n throw TypeError('Toolbox should be an <xml> document.');\n }\n } else if (toolboxDef instanceof Element) {\n parsedToolboxDef = toolboxDef;\n }\n }\n return parsedToolboxDef;\n}\n\nexport const TEST_ONLY = {\n hasCategoriesInternal,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Extensions are functions that help initialize blocks, usually\n * adding dynamic behavior such as onchange handlers and mutators. These\n * are applied using Block.applyExtension(), or the JSON \"extensions\"\n * array attribute.\n *\n * @namespace Blockly.Extensions\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Extensions');\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport {FieldDropdown} from './field_dropdown.js';\nimport {Mutator} from './mutator.js';\nimport * as parsing from './utils/parsing.js';\n\n\n/** The set of all registered extensions, keyed by extension name/id. */\nconst allExtensions = Object.create(null);\nexport const TEST_ONLY = {allExtensions};\n\n/**\n * Registers a new extension function. Extensions are functions that help\n * initialize blocks, usually adding dynamic behavior such as onchange\n * handlers and mutators. These are applied using Block.applyExtension(), or\n * the JSON \"extensions\" array attribute.\n *\n * @param name The name of this extension.\n * @param initFn The function to initialize an extended block.\n * @throws {Error} if the extension name is empty, the extension is already\n * registered, or extensionFn is not a function.\n * @alias Blockly.Extensions.register\n */\nexport function register(name: string, initFn: Function) {\n if (typeof name !== 'string' || name.trim() === '') {\n throw Error('Error: Invalid extension name \"' + name + '\"');\n }\n if (allExtensions[name]) {\n throw Error('Error: Extension \"' + name + '\" is already registered.');\n }\n if (typeof initFn !== 'function') {\n throw Error('Error: Extension \"' + name + '\" must be a function');\n }\n allExtensions[name] = initFn;\n}\n\n/**\n * Registers a new extension function that adds all key/value of mixinObj.\n *\n * @param name The name of this extension.\n * @param mixinObj The values to mix in.\n * @throws {Error} if the extension name is empty or the extension is already\n * registered.\n * @alias Blockly.Extensions.registerMixin\n */\nexport function registerMixin(name: string, mixinObj: AnyDuringMigration) {\n if (!mixinObj || typeof mixinObj !== 'object') {\n throw Error('Error: Mixin \"' + name + '\" must be a object');\n }\n register(name, function(this: Block) {\n this.mixin(mixinObj);\n });\n}\n\n/**\n * Registers a new extension function that adds a mutator to the block.\n * At register time this performs some basic sanity checks on the mutator.\n * The wrapper may also add a mutator dialog to the block, if both compose and\n * decompose are defined on the mixin.\n *\n * @param name The name of this mutator extension.\n * @param mixinObj The values to mix in.\n * @param opt_helperFn An optional function to apply after mixing in the object.\n * @param opt_blockList A list of blocks to appear in the flyout of the mutator\n * dialog.\n * @throws {Error} if the mutation is invalid or can't be applied to the block.\n * @alias Blockly.Extensions.registerMutator\n */\nexport function registerMutator(\n name: string, mixinObj: AnyDuringMigration,\n opt_helperFn?: () => AnyDuringMigration, opt_blockList?: string[]) {\n const errorPrefix = 'Error when registering mutator \"' + name + '\": ';\n\n checkHasMutatorProperties(errorPrefix, mixinObj);\n const hasMutatorDialog = checkMutatorDialog(mixinObj, errorPrefix);\n\n if (opt_helperFn && typeof opt_helperFn !== 'function') {\n throw Error(errorPrefix + 'Extension \"' + name + '\" is not a function');\n }\n\n // Sanity checks passed.\n register(name, function(this: Block) {\n if (hasMutatorDialog) {\n this.setMutator(new Mutator(opt_blockList || [], this as BlockSvg));\n }\n // Mixin the object.\n this.mixin(mixinObj);\n\n if (opt_helperFn) {\n opt_helperFn.apply(this);\n }\n });\n}\n\n/**\n * Unregisters the extension registered with the given name.\n *\n * @param name The name of the extension to unregister.\n * @alias Blockly.Extensions.unregister\n */\nexport function unregister(name: string) {\n if (isRegistered(name)) {\n delete allExtensions[name];\n } else {\n console.warn(\n 'No extension mapping for name \"' + name + '\" found to unregister');\n }\n}\n\n/**\n * Returns whether an extension is registered with the given name.\n *\n * @param name The name of the extension to check for.\n * @returns True if the extension is registered. False if it is not registered.\n * @alias Blockly.Extensions.isRegistered\n */\nexport function isRegistered(name: string): boolean {\n return !!allExtensions[name];\n}\n\n/**\n * Applies an extension method to a block. This should only be called during\n * block construction.\n *\n * @param name The name of the extension.\n * @param block The block to apply the named extension to.\n * @param isMutator True if this extension defines a mutator.\n * @throws {Error} if the extension is not found.\n * @alias Blockly.Extensions.apply\n */\nexport function apply(name: string, block: Block, isMutator: boolean) {\n const extensionFn = allExtensions[name];\n if (typeof extensionFn !== 'function') {\n throw Error('Error: Extension \"' + name + '\" not found.');\n }\n let mutatorProperties;\n if (isMutator) {\n // Fail early if the block already has mutation properties.\n checkNoMutatorProperties(name, block);\n } else {\n // Record the old properties so we can make sure they don't change after\n // applying the extension.\n mutatorProperties = getMutatorProperties(block);\n }\n extensionFn.apply(block);\n\n if (isMutator) {\n const errorPrefix = 'Error after applying mutator \"' + name + '\": ';\n checkHasMutatorProperties(errorPrefix, block);\n } else {\n if (!mutatorPropertiesMatch(\n mutatorProperties as AnyDuringMigration[], block)) {\n throw Error(\n 'Error when applying extension \"' + name + '\": ' +\n 'mutation properties changed when applying a non-mutator extension.');\n }\n }\n}\n\n/**\n * Check that the given block does not have any of the four mutator properties\n * defined on it. This function should be called before applying a mutator\n * extension to a block, to make sure we are not overwriting properties.\n *\n * @param mutationName The name of the mutation to reference in error messages.\n * @param block The block to check.\n * @throws {Error} if any of the properties already exist on the block.\n */\nfunction checkNoMutatorProperties(mutationName: string, block: Block) {\n const properties = getMutatorProperties(block);\n if (properties.length) {\n throw Error(\n 'Error: tried to apply mutation \"' + mutationName +\n '\" to a block that already has mutator functions.' +\n ' Block id: ' + block.id);\n }\n}\n\n/**\n * Checks if the given object has both the 'mutationToDom' and 'domToMutation'\n * functions.\n *\n * @param object The object to check.\n * @param errorPrefix The string to prepend to any error message.\n * @returns True if the object has both functions. False if it has neither\n * function.\n * @throws {Error} if the object has only one of the functions, or either is not\n * actually a function.\n */\nfunction checkXmlHooks(\n object: AnyDuringMigration, errorPrefix: string): boolean {\n return checkHasFunctionPair(\n object.mutationToDom, object.domToMutation,\n errorPrefix + ' mutationToDom/domToMutation');\n}\n/**\n * Checks if the given object has both the 'saveExtraState' and 'loadExtraState'\n * functions.\n *\n * @param object The object to check.\n * @param errorPrefix The string to prepend to any error message.\n * @returns True if the object has both functions. False if it has neither\n * function.\n * @throws {Error} if the object has only one of the functions, or either is not\n * actually a function.\n */\nfunction checkJsonHooks(\n object: AnyDuringMigration, errorPrefix: string): boolean {\n return checkHasFunctionPair(\n object.saveExtraState, object.loadExtraState,\n errorPrefix + ' saveExtraState/loadExtraState');\n}\n\n/**\n * Checks if the given object has both the 'compose' and 'decompose' functions.\n *\n * @param object The object to check.\n * @param errorPrefix The string to prepend to any error message.\n * @returns True if the object has both functions. False if it has neither\n * function.\n * @throws {Error} if the object has only one of the functions, or either is not\n * actually a function.\n */\nfunction checkMutatorDialog(\n object: AnyDuringMigration, errorPrefix: string): boolean {\n return checkHasFunctionPair(\n object.compose, object.decompose, errorPrefix + ' compose/decompose');\n}\n\n/**\n * Checks that both or neither of the given functions exist and that they are\n * indeed functions.\n *\n * @param func1 The first function in the pair.\n * @param func2 The second function in the pair.\n * @param errorPrefix The string to prepend to any error message.\n * @returns True if the object has both functions. False if it has neither\n * function.\n * @throws {Error} If the object has only one of the functions, or either is not\n * actually a function.\n */\nfunction checkHasFunctionPair(\n func1: AnyDuringMigration, func2: AnyDuringMigration,\n errorPrefix: string): boolean {\n if (func1 && func2) {\n if (typeof func1 !== 'function' || typeof func2 !== 'function') {\n throw Error(errorPrefix + ' must be a function');\n }\n return true;\n } else if (!func1 && !func2) {\n return false;\n }\n throw Error(errorPrefix + 'Must have both or neither functions');\n}\n\n/**\n * Checks that the given object required mutator properties.\n *\n * @param errorPrefix The string to prepend to any error message.\n * @param object The object to inspect.\n */\nfunction checkHasMutatorProperties(\n errorPrefix: string, object: AnyDuringMigration) {\n const hasXmlHooks = checkXmlHooks(object, errorPrefix);\n const hasJsonHooks = checkJsonHooks(object, errorPrefix);\n if (!hasXmlHooks && !hasJsonHooks) {\n throw Error(\n errorPrefix +\n 'Mutations must contain either XML hooks, or JSON hooks, or both');\n }\n // A block with a mutator isn't required to have a mutation dialog, but\n // it should still have both or neither of compose and decompose.\n checkMutatorDialog(object, errorPrefix);\n}\n\n/**\n * Get a list of values of mutator properties on the given block.\n *\n * @param block The block to inspect.\n * @returns A list with all of the defined properties, which should be\n * functions, but may be anything other than undefined.\n */\nfunction getMutatorProperties(block: Block): AnyDuringMigration[] {\n const result = [];\n // List each function explicitly by reference to allow for renaming\n // during compilation.\n if (block.domToMutation !== undefined) {\n result.push(block.domToMutation);\n }\n if (block.mutationToDom !== undefined) {\n result.push(block.mutationToDom);\n }\n if (block.saveExtraState !== undefined) {\n result.push(block.saveExtraState);\n }\n if (block.loadExtraState !== undefined) {\n result.push(block.loadExtraState);\n }\n if (block.compose !== undefined) {\n result.push(block.compose);\n }\n if (block.decompose !== undefined) {\n result.push(block.decompose);\n }\n return result;\n}\n\n/**\n * Check that the current mutator properties match a list of old mutator\n * properties. This should be called after applying a non-mutator extension,\n * to verify that the extension didn't change properties it shouldn't.\n *\n * @param oldProperties The old values to compare to.\n * @param block The block to inspect for new values.\n * @returns True if the property lists match.\n */\nfunction mutatorPropertiesMatch(\n oldProperties: AnyDuringMigration[], block: Block): boolean {\n const newProperties = getMutatorProperties(block);\n if (newProperties.length !== oldProperties.length) {\n return false;\n }\n for (let i = 0; i < newProperties.length; i++) {\n if (oldProperties[i] !== newProperties[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Calls a function after the page has loaded, possibly immediately.\n *\n * @param fn Function to run.\n * @throws Error Will throw if no global document can be found (e.g., Node.js).\n * @internal\n */\nexport function runAfterPageLoad(fn: () => void) {\n if (typeof document !== 'object') {\n throw Error('runAfterPageLoad() requires browser document.');\n }\n if (document.readyState === 'complete') {\n fn(); // Page has already loaded. Call immediately.\n } else {\n // Poll readyState.\n const readyStateCheckInterval = setInterval(function() {\n if (document.readyState === 'complete') {\n clearInterval(readyStateCheckInterval);\n fn();\n }\n }, 10);\n }\n}\n\n/**\n * Builds an extension function that will map a dropdown value to a tooltip\n * string.\n *\n * This method includes multiple checks to ensure tooltips, dropdown options,\n * and message references are aligned. This aims to catch errors as early as\n * possible, without requiring developers to manually test tooltips under each\n * option. After the page is loaded, each tooltip text string will be checked\n * for matching message keys in the internationalized string table. Deferring\n * this until the page is loaded decouples loading dependencies. Later, upon\n * loading the first block of any given type, the extension will validate every\n * dropdown option has a matching tooltip in the lookupTable. Errors are\n * reported as warnings in the console, and are never fatal.\n *\n * @param dropdownName The name of the field whose value is the key to the\n * lookup table.\n * @param lookupTable The table of field values to tooltip text.\n * @returns The extension function.\n * @alias Blockly.Extensions.buildTooltipForDropdown\n */\nexport function buildTooltipForDropdown(\n dropdownName: string, lookupTable: {[key: string]: string}): Function {\n // List of block types already validated, to minimize duplicate warnings.\n const blockTypesChecked: AnyDuringMigration[] = [];\n\n // Check the tooltip string messages for invalid references.\n // Wait for load, in case Blockly.Msg is not yet populated.\n // runAfterPageLoad() does not run in a Node.js environment due to lack\n // of document object, in which case skip the validation.\n if (typeof document === 'object') { // Relies on document.readyState\n runAfterPageLoad(function() {\n for (const key in lookupTable) {\n // Will print warnings if reference is missing.\n parsing.checkMessageReferences(lookupTable[key]);\n }\n });\n }\n\n /** The actual extension. */\n function extensionFn(this: Block) {\n if (this.type && blockTypesChecked.indexOf(this.type) === -1) {\n checkDropdownOptionsInTable(this, dropdownName, lookupTable);\n blockTypesChecked.push(this.type);\n }\n\n this.setTooltip(function(this: Block) {\n const value = String(this.getFieldValue(dropdownName));\n let tooltip = lookupTable[value];\n if (tooltip === null) {\n if (blockTypesChecked.indexOf(this.type) === -1) {\n // Warn for missing values on generated tooltips.\n let warning = 'No tooltip mapping for value ' + value + ' of field ' +\n dropdownName;\n if (this.type !== null) {\n warning += ' of block type ' + this.type;\n }\n console.warn(warning + '.');\n }\n } else {\n tooltip = parsing.replaceMessageReferences(tooltip);\n }\n return tooltip;\n }.bind(this));\n }\n return extensionFn;\n}\n\n/**\n * Checks all options keys are present in the provided string lookup table.\n * Emits console warnings when they are not.\n *\n * @param block The block containing the dropdown\n * @param dropdownName The name of the dropdown\n * @param lookupTable The string lookup table\n */\nfunction checkDropdownOptionsInTable(\n block: Block, dropdownName: string, lookupTable: {[key: string]: string}) {\n // Validate all dropdown options have values.\n const dropdown = block.getField(dropdownName);\n if (dropdown instanceof FieldDropdown && !dropdown.isOptionListDynamic()) {\n const options = dropdown.getOptions();\n for (let i = 0; i < options.length; i++) {\n const optionKey = options[i][1]; // label, then value\n if (lookupTable[optionKey] === null) {\n console.warn(\n 'No tooltip mapping for value ' + optionKey + ' of field ' +\n dropdownName + ' of block type ' + block.type);\n }\n }\n }\n}\n\n/**\n * Builds an extension function that will install a dynamic tooltip. The\n * tooltip message should include the string '%1' and that string will be\n * replaced with the text of the named field.\n *\n * @param msgTemplate The template form to of the message text, with %1\n * placeholder.\n * @param fieldName The field with the replacement text.\n * @returns The extension function.\n * @alias Blockly.Extensions.buildTooltipWithFieldText\n */\nexport function buildTooltipWithFieldText(\n msgTemplate: string, fieldName: string): Function {\n // Check the tooltip string messages for invalid references.\n // Wait for load, in case Blockly.Msg is not yet populated.\n // runAfterPageLoad() does not run in a Node.js environment due to lack\n // of document object, in which case skip the validation.\n if (typeof document === 'object') { // Relies on document.readyState\n runAfterPageLoad(function() {\n // Will print warnings if reference is missing.\n parsing.checkMessageReferences(msgTemplate);\n });\n }\n\n /** The actual extension. */\n function extensionFn(this: Block) {\n this.setTooltip(function(this: Block) {\n const field = this.getField(fieldName);\n return parsing.replaceMessageReferences(msgTemplate)\n .replace('%1', field ? field.getText() : '');\n }.bind(this));\n }\n return extensionFn;\n}\n\n/**\n * Configures the tooltip to mimic the parent block when connected. Otherwise,\n * uses the tooltip text at the time this extension is initialized. This takes\n * advantage of the fact that all other values from JSON are initialized before\n * extensions.\n */\nfunction extensionParentTooltip(this: Block) {\n const tooltipWhenNotConnected = this.tooltip;\n this.setTooltip(function(this: Block) {\n const parent = this.getParent();\n return parent && parent.getInputsInline() && parent.tooltip ||\n tooltipWhenNotConnected;\n }.bind(this));\n}\nregister('parent_tooltip_when_inline', extensionParentTooltip);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @namespace Blockly.utils.array */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.array');\n\n\n/**\n * Removes the first occurrence of a particular value from an array.\n *\n * @param arr Array from which to remove value.\n * @param value Value to remove.\n * @returns True if an element was removed.\n * @alias Blockly.array.removeElem\n * @internal\n */\nexport function removeElem<T>(arr: Array<T>, value: T): boolean {\n const i = arr.indexOf(value);\n if (i === -1) {\n return false;\n }\n arr.splice(i, 1);\n return true;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for creating parts of SVG path strings. See\n *\n * @namespace Blockly.utils.svgPaths\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.svgPaths');\n\n\n/**\n * Create a string representing the given x, y pair. It does not matter whether\n * the coordinate is relative or absolute. The result has leading\n * and trailing spaces, and separates the x and y coordinates with a comma but\n * no space.\n *\n * @param x The x coordinate.\n * @param y The y coordinate.\n * @returns A string of the format ' x,y '\n * @alias Blockly.utils.svgPaths.point\n */\nexport function point(x: number, y: number): string {\n return ' ' + x + ',' + y + ' ';\n}\n\n/**\n * Draw a cubic or quadratic curve. See\n * developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Cubic_B%C3%A9zier_Curve\n * These coordinates are unitless and hence in the user coordinate system.\n *\n * @param command The command to use.\n * Should be one of: c, C, s, S, q, Q.\n * @param points An array containing all of the points to pass to the curve\n * command, in order. The points are represented as strings of the format '\n * x, y '.\n * @returns A string defining one or more Bezier curves. See the MDN\n * documentation for exact format.\n * @alias Blockly.utils.svgPaths.curve\n */\nexport function curve(command: string, points: string[]): string {\n return ' ' + command + points.join('');\n}\n\n/**\n * Move the cursor to the given position without drawing a line.\n * The coordinates are absolute.\n * These coordinates are unitless and hence in the user coordinate system.\n * See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands\n *\n * @param x The absolute x coordinate.\n * @param y The absolute y coordinate.\n * @returns A string of the format ' M x,y '\n * @alias Blockly.utils.svgPaths.moveTo\n */\nexport function moveTo(x: number, y: number): string {\n return ' M ' + x + ',' + y + ' ';\n}\n\n/**\n * Move the cursor to the given position without drawing a line.\n * Coordinates are relative.\n * These coordinates are unitless and hence in the user coordinate system.\n * See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands\n *\n * @param dx The relative x coordinate.\n * @param dy The relative y coordinate.\n * @returns A string of the format ' m dx,dy '\n * @alias Blockly.utils.svgPaths.moveBy\n */\nexport function moveBy(dx: number, dy: number): string {\n return ' m ' + dx + ',' + dy + ' ';\n}\n\n/**\n * Draw a line from the current point to the end point, which is the current\n * point shifted by dx along the x-axis and dy along the y-axis.\n * These coordinates are unitless and hence in the user coordinate system.\n * See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands\n *\n * @param dx The relative x coordinate.\n * @param dy The relative y coordinate.\n * @returns A string of the format ' l dx,dy '\n * @alias Blockly.utils.svgPaths.lineTo\n */\nexport function lineTo(dx: number, dy: number): string {\n return ' l ' + dx + ',' + dy + ' ';\n}\n\n/**\n * Draw multiple lines connecting all of the given points in order. This is\n * equivalent to a series of 'l' commands.\n * These coordinates are unitless and hence in the user coordinate system.\n * See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands\n *\n * @param points An array containing all of the points to draw lines to, in\n * order. The points are represented as strings of the format ' dx,dy '.\n * @returns A string of the format ' l (dx,dy)+ '\n * @alias Blockly.utils.svgPaths.line\n */\nexport function line(points: string[]): string {\n return ' l' + points.join('');\n}\n\n/**\n * Draw a horizontal or vertical line.\n * The first argument specifies the direction and whether the given position is\n * relative or absolute.\n * These coordinates are unitless and hence in the user coordinate system.\n * See developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#LineTo_path_commands\n *\n * @param command The command to prepend to the coordinate. This should be one\n * of: V, v, H, h.\n * @param val The coordinate to pass to the command. It may be absolute or\n * relative.\n * @returns A string of the format ' command val '\n * @alias Blockly.utils.svgPaths.lineOnAxis\n */\nexport function lineOnAxis(command: string, val: number): string {\n return ' ' + command + ' ' + val + ' ';\n}\n\n/**\n * Draw an elliptical arc curve.\n * These coordinates are unitless and hence in the user coordinate system.\n * See developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Elliptical_Arc_Curve\n *\n * @param command The command string. Either 'a' or 'A'.\n * @param flags The flag string. See the MDN documentation for a description\n * and examples.\n * @param radius The radius of the arc to draw.\n * @param point The point to move the cursor to after drawing the arc, specified\n * either in absolute or relative coordinates depending on the command.\n * @returns A string of the format 'command radius radius flags point'\n * @alias Blockly.utils.svgPaths.arc\n */\nexport function arc(\n command: string, flags: string, radius: number, point: string): string {\n return command + ' ' + radius + ' ' + radius + ' ' + flags + point;\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods.\n *\n * @namespace Blockly.utils\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils');\n\nimport type {Block} from './block.js';\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\nimport * as extensions from './extensions.js';\nimport * as aria from './utils/aria.js';\nimport * as arrayUtils from './utils/array.js';\nimport * as colour from './utils/colour.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as deprecation from './utils/deprecation.js';\nimport * as dom from './utils/dom.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport * as math from './utils/math.js';\nimport type {Metrics} from './utils/metrics.js';\nimport * as object from './utils/object.js';\nimport * as parsing from './utils/parsing.js';\nimport {Rect} from './utils/rect.js';\nimport {Size} from './utils/size.js';\nimport * as stringUtils from './utils/string.js';\nimport * as style from './utils/style.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\nimport * as svgPaths from './utils/svg_paths.js';\nimport * as toolbox from './utils/toolbox.js';\nimport * as userAgent from './utils/useragent.js';\nimport * as xml from './utils/xml.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\nexport {\n aria,\n arrayUtils as array,\n browserEvents,\n colour,\n Coordinate,\n deprecation,\n dom,\n extensions,\n idGenerator,\n KeyCodes,\n math,\n Metrics,\n object,\n parsing,\n Rect,\n Size,\n stringUtils as string,\n style,\n Svg,\n svgMath,\n svgPaths,\n toolbox,\n userAgent,\n xml,\n};\n\n/**\n * Return the coordinates of the top-left corner of this element relative to\n * its parent. Only for SVG elements and children (e.g. rect, g, path).\n *\n * @param element SVG element to find the coordinates of.\n * @returns Object with .x and .y properties.\n * @deprecated Use **Blockly.utils.svgMath.getRelativeXY** instead.\n * @alias Blockly.utils.getRelativeXY\n */\nexport function getRelativeXY(element: Element): Coordinate {\n deprecation.warn(\n 'Blockly.utils.getRelativeXY', 'December 2021', 'December 2022',\n 'Blockly.utils.svgMath.getRelativeXY');\n return svgMath.getRelativeXY(element);\n}\n\n/**\n * Return the coordinates of the top-left corner of this element relative to\n * the div Blockly was injected into.\n *\n * @param element SVG element to find the coordinates of. If this is not a child\n * of the div Blockly was injected into, the behaviour is undefined.\n * @returns Object with .x and .y properties.\n * @deprecated Use **Blockly.utils.svgMath.getInjectionDivXY** instead.\n * @alias Blockly.utils.getInjectionDivXY_\n */\nfunction getInjectionDivXY(element: Element): Coordinate {\n deprecation.warn(\n 'Blockly.utils.getInjectionDivXY_', 'December 2021', 'December 2022',\n 'Blockly.utils.svgMath.getInjectionDivXY');\n return svgMath.getInjectionDivXY(element);\n}\nexport const getInjectionDivXY_ = getInjectionDivXY;\n\n/**\n * Parse a string with any number of interpolation tokens (%1, %2, ...).\n * It will also replace string table references (e.g., %{bky_my_msg} and\n * %{BKY_MY_MSG} will both be replaced with the value in\n * Msg['MY_MSG']). Percentage sign characters '%' may be self-escaped\n * (e.g., '%%').\n *\n * @param message Text which might contain string table references and\n * interpolation tokens.\n * @returns Array of strings and numbers.\n * @deprecated Use **Blockly.utils.parsing.tokenizeInterpolation** instead.\n * @alias Blockly.utils.tokenizeInterpolation\n */\nexport function tokenizeInterpolation(message: string): Array<string|number> {\n deprecation.warn(\n 'Blockly.utils.tokenizeInterpolation', 'December 2021', 'December 2022',\n 'Blockly.utils.parsing.tokenizeInterpolation');\n return parsing.tokenizeInterpolation(message);\n}\n\n/**\n * Replaces string table references in a message, if the message is a string.\n * For example, \"%{bky_my_msg}\" and \"%{BKY_MY_MSG}\" will both be replaced with\n * the value in Msg['MY_MSG'].\n *\n * @param message Message, which may be a string that contains string table\n * references.\n * @returns String with message references replaced.\n * @deprecated Use **Blockly.utils.parsing.replaceMessageReferences** instead.\n * @alias Blockly.utils.replaceMessageReferences\n */\nexport function replaceMessageReferences(message: string|any): string {\n deprecation.warn(\n 'Blockly.utils.replaceMessageReferences', 'December 2021',\n 'December 2022', 'Blockly.utils.parsing.replaceMessageReferences');\n return parsing.replaceMessageReferences(message);\n}\n\n/**\n * Validates that any %{MSG_KEY} references in the message refer to keys of\n * the Msg string table.\n *\n * @param message Text which might contain string table references.\n * @returns True if all message references have matching values.\n * Otherwise, false.\n * @deprecated Use **Blockly.utils.parsing.checkMessageReferences** instead.\n * @alias Blockly.utils.checkMessageReferences\n */\nexport function checkMessageReferences(message: string): boolean {\n deprecation.warn(\n 'Blockly.utils.checkMessageReferences', 'December 2021', 'December 2022',\n 'Blockly.utils.parsing.checkMessageReferences');\n return parsing.checkMessageReferences(message);\n}\n\n/**\n * Check if 3D transforms are supported by adding an element\n * and attempting to set the property.\n *\n * @returns True if 3D transforms are supported.\n * @deprecated Use **Blockly.utils.svgMath.is3dSupported** instead.\n * @alias Blockly.utils.is3dSupported\n */\nexport function is3dSupported(): boolean {\n deprecation.warn(\n 'Blockly.utils.is3dSupported', 'December 2021', 'December 2022',\n 'Blockly.utils.svgMath.is3dSupported');\n return svgMath.is3dSupported();\n}\n\n/**\n * Get the position of the current viewport in window coordinates. This takes\n * scroll into account.\n *\n * @returns An object containing window width, height, and scroll position in\n * window coordinates.\n * @alias Blockly.utils.getViewportBBox\n * @deprecated Use **Blockly.utils.svgMath.getViewportBBox** instead.\n * @internal\n */\nexport function getViewportBBox(): Rect {\n deprecation.warn(\n 'Blockly.utils.getViewportBBox', 'December 2021', 'December 2022',\n 'Blockly.utils.svgMath.getViewportBBox');\n return svgMath.getViewportBBox();\n}\n\n/**\n * Removes the first occurrence of a particular value from an array.\n *\n * @param arr Array from which to remove value.\n * @param value Value to remove.\n * @returns True if an element was removed.\n * @alias Blockly.utils.arrayRemove\n * @deprecated Use **Blockly.array.removeElem** instead.\n * @internal\n */\nexport function arrayRemove<T>(arr: Array<T>, value: T): boolean {\n deprecation.warn(\n 'Blockly.utils.arrayRemove', 'December 2021', 'December 2022',\n 'Blockly.array.removeElem');\n return arrayUtils.removeElem(arr, value);\n}\n\n/**\n * Gets the document scroll distance as a coordinate object.\n * Copied from Closure's goog.dom.getDocumentScroll.\n *\n * @returns Object with values 'x' and 'y'.\n * @deprecated Use **Blockly.utils.svgMath.getDocumentScroll** instead.\n * @alias Blockly.utils.getDocumentScroll\n */\nexport function getDocumentScroll(): Coordinate {\n deprecation.warn(\n 'Blockly.utils.getDocumentScroll', 'December 2021', 'December 2022',\n 'Blockly.utils.svgMath.getDocumentScroll');\n return svgMath.getDocumentScroll();\n}\n\n/**\n * Get a map of all the block's descendants mapping their type to the number of\n * children with that type.\n *\n * @param block The block to map.\n * @param opt_stripFollowing Optionally ignore all following statements (blocks\n * that are not inside a value or statement input of the block).\n * @returns Map of types to type counts for descendants of the bock.\n * @deprecated Use **Blockly.common.getBlockTypeCounts** instead.\n * @alias Blockly.utils.getBlockTypeCounts\n */\nexport function getBlockTypeCounts(\n block: Block, opt_stripFollowing?: boolean): {[key: string]: number} {\n deprecation.warn(\n 'Blockly.utils.getBlockTypeCounts', 'December 2021', 'December 2022',\n 'Blockly.common.getBlockTypeCounts');\n return common.getBlockTypeCounts(block, opt_stripFollowing);\n}\n\n/**\n * Converts screen coordinates to workspace coordinates.\n *\n * @param ws The workspace to find the coordinates on.\n * @param screenCoordinates The screen coordinates to be converted to workspace\n * coordinates\n * @deprecated Use **Blockly.utils.svgMath.screenToWsCoordinates** instead.\n * @returns The workspace coordinates.\n */\nexport function screenToWsCoordinates(\n ws: WorkspaceSvg, screenCoordinates: Coordinate): Coordinate {\n deprecation.warn(\n 'Blockly.utils.screenToWsCoordinates', 'December 2021', 'December 2022',\n 'Blockly.utils.svgMath.screenToWsCoordinates');\n return svgMath.screenToWsCoordinates(ws, screenCoordinates);\n}\n\n/**\n * Parse a block colour from a number or string, as provided in a block\n * definition.\n *\n * @param colour HSV hue value (0 to 360), #RRGGBB string, or a message\n * reference string pointing to one of those two values.\n * @returns An object containing the colour as a #RRGGBB string, and the hue if\n * the input was an HSV hue value.\n * @throws {Error} If the colour cannot be parsed.\n * @deprecated Use **Blockly.utils.parsing.parseBlockColour** instead.\n * @alias Blockly.utils.parseBlockColour\n */\nexport function parseBlockColour(colour: number|\n string): {hue: number|null, hex: string} {\n deprecation.warn(\n 'Blockly.utils.parseBlockColour', 'December 2021', 'December 2022',\n 'Blockly.utils.parsing.parseBlockColour');\n return parsing.parseBlockColour(colour);\n}\n\n/**\n * Calls a function after the page has loaded, possibly immediately.\n *\n * @param fn Function to run.\n * @throws Error Will throw if no global document can be found (e.g., Node.js).\n * @deprecated No longer provided by Blockly.\n * @alias Blockly.utils.runAfterPageLoad\n */\nexport function runAfterPageLoad(fn: () => void) {\n deprecation.warn(\n 'Blockly.utils.runAfterPageLoad', 'December 2021', 'December 2022');\n extensions.runAfterPageLoad(fn);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Contains functions registering serializers (eg blocks, variables, plugins,\n * etc).\n *\n * @namespace Blockly.serialization.registry\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.serialization.registry');\n\n// eslint-disable-next-line no-unused-vars\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport * as registry from '../registry.js';\n\n\n/**\n * Registers the given serializer so that it can be used for serialization and\n * deserialization.\n *\n * @param name The name of the serializer to register.\n * @param serializer The serializer to register.\n * @alias Blockly.serialization.registry.register\n */\nexport function register(name: string, serializer: ISerializer) {\n registry.register(registry.Type.SERIALIZER, name, serializer);\n}\n\n/**\n * Unregisters the serializer associated with the given name.\n *\n * @param name The name of the serializer to unregister.\n * @alias Blockly.serialization.registry.unregister\n */\nexport function unregister(name: string) {\n registry.unregister(registry.Type.SERIALIZER, name);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Handles serializing blocks to plain JavaScript objects only containing state.\n *\n * @namespace Blockly.serialization.blocks\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.serialization.blocks');\n\nimport type {Block} from '../block.js';\nimport type {BlockSvg} from '../block_svg.js';\nimport type {Connection} from '../connection.js';\nimport * as eventUtils from '../events/utils.js';\nimport {inputTypes} from '../input_types.js';\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport {Size} from '../utils/size.js';\nimport type {Workspace} from '../workspace.js';\nimport * as Xml from '../xml.js';\n\nimport {BadConnectionCheck, MissingBlockType, MissingConnection, RealChildOfShadow} from './exceptions.js';\nimport * as priorities from './priorities.js';\nimport * as serializationRegistry from './registry.js';\n\n\n// TODO(#5160): Remove this once lint is fixed.\n/* eslint-disable no-use-before-define */\n\n/**\n * Represents the state of a connection.\n *\n * @alias Blockly.serialization.blocks.ConnectionState\n */\nexport interface ConnectionState {\n shadow: State|undefined;\n block: State|undefined;\n}\n\n/**\n * Represents the state of a given block.\n *\n * @alias Blockly.serialization.blocks.State\n */\nexport interface State {\n type: string;\n id?: string;\n x?: number;\n y?: number;\n collapsed?: boolean;\n enabled?: boolean;\n inline?: boolean;\n data?: string;\n extraState?: AnyDuringMigration;\n icons?: {[key: string]: AnyDuringMigration};\n fields?: {[key: string]: AnyDuringMigration};\n inputs?: {[key: string]: ConnectionState};\n next?: ConnectionState;\n}\n\n/**\n * Returns the state of the given block as a plain JavaScript object.\n *\n * @param block The block to serialize.\n * @param param1 addCoordinates: If true, the coordinates of the block are added\n * to the serialized state. False by default. addinputBlocks: If true,\n * children of the block which are connected to inputs will be serialized.\n * True by default. addNextBlocks: If true, children of the block which are\n * connected to the block's next connection (if it exists) will be\n * serialized. True by default. doFullSerialization: If true, fields that\n * normally just save a reference to some external state (eg variables) will\n * instead serialize all of the info about that state. This supports\n * deserializing the block into a workspace where that state doesn't yet\n * exist. True by default.\n * @returns The serialized state of the block, or null if the block could not be\n * serialied (eg it was an insertion marker).\n * @alias Blockly.serialization.blocks.save\n */\nexport function save(block: Block, {\n addCoordinates = false,\n addInputBlocks = true,\n addNextBlocks = true,\n doFullSerialization = true,\n}: {\n addCoordinates?: boolean,\n addInputBlocks?: boolean,\n addNextBlocks?: boolean,\n doFullSerialization?: boolean\n} = {}): State|null {\n if (block.isInsertionMarker()) {\n return null;\n }\n\n const state = {\n 'type': block.type,\n 'id': block.id,\n };\n\n if (addCoordinates) {\n // AnyDuringMigration because: Argument of type '{ type: string; id:\n // string; }' is not assignable to parameter of type 'State'.\n saveCoords(block, state as AnyDuringMigration);\n }\n // AnyDuringMigration because: Argument of type '{ type: string; id: string;\n // }' is not assignable to parameter of type 'State'.\n saveAttributes(block, state as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type '{ type: string; id: string;\n // }' is not assignable to parameter of type 'State'.\n saveExtraState(block, state as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type '{ type: string; id: string;\n // }' is not assignable to parameter of type 'State'.\n saveIcons(block, state as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type '{ type: string; id: string;\n // }' is not assignable to parameter of type 'State'.\n saveFields(block, state as AnyDuringMigration, doFullSerialization);\n if (addInputBlocks) {\n // AnyDuringMigration because: Argument of type '{ type: string; id:\n // string; }' is not assignable to parameter of type 'State'.\n saveInputBlocks(block, state as AnyDuringMigration, doFullSerialization);\n }\n if (addNextBlocks) {\n // AnyDuringMigration because: Argument of type '{ type: string; id:\n // string; }' is not assignable to parameter of type 'State'.\n saveNextBlocks(block, state as AnyDuringMigration, doFullSerialization);\n }\n\n // AnyDuringMigration because: Type '{ type: string; id: string; }' is not\n // assignable to type 'State'.\n return state as AnyDuringMigration;\n}\n\n/**\n * Adds attributes to the given state object based on the state of the block.\n * Eg collapsed, disabled, inline, etc.\n *\n * @param block The block to base the attributes on.\n * @param state The state object to append to.\n */\nfunction saveAttributes(block: Block, state: State) {\n if (block.isCollapsed()) {\n state['collapsed'] = true;\n }\n if (!block.isEnabled()) {\n state['enabled'] = false;\n }\n if (block.inputsInline !== undefined &&\n block.inputsInline !== block.inputsInlineDefault) {\n state['inline'] = block.inputsInline;\n }\n // Data is a nullable string, so we don't need to worry about falsy values.\n if (block.data) {\n state['data'] = block.data;\n }\n}\n\n/**\n * Adds the coordinates of the given block to the given state object.\n *\n * @param block The block to base the coordinates on.\n * @param state The state object to append to.\n */\nfunction saveCoords(block: Block, state: State) {\n const workspace = block.workspace;\n const xy = block.getRelativeToSurfaceXY();\n state['x'] = Math.round(workspace.RTL ? workspace.getWidth() - xy.x : xy.x);\n state['y'] = Math.round(xy.y);\n}\n/**\n * Adds any extra state the block may provide to the given state object.\n *\n * @param block The block to serialize the extra state of.\n * @param state The state object to append to.\n */\nfunction saveExtraState(block: Block, state: State) {\n if (block.saveExtraState) {\n const extraState = block.saveExtraState();\n if (extraState !== null) {\n state['extraState'] = extraState;\n }\n } else if (block.mutationToDom) {\n const extraState = block.mutationToDom();\n if (extraState !== null) {\n state['extraState'] =\n Xml.domToText(extraState)\n .replace(\n ' xmlns=\"https://developers.google.com/blockly/xml\"', '');\n }\n }\n}\n\n/**\n * Adds the state of all of the icons on the block to the given state object.\n *\n * @param block The block to serialize the icon state of.\n * @param state The state object to append to.\n */\nfunction saveIcons(block: Block, state: State) {\n // TODO(#2105): Remove this logic and put it in the icon.\n if (block.getCommentText()) {\n state['icons'] = {\n 'comment': {\n 'text': block.getCommentText(),\n 'pinned': block.commentModel.pinned,\n 'height': Math.round(block.commentModel.size.height),\n 'width': Math.round(block.commentModel.size.width),\n },\n };\n }\n}\n\n/**\n * Adds the state of all of the fields on the block to the given state object.\n *\n * @param block The block to serialize the field state of.\n * @param state The state object to append to.\n * @param doFullSerialization Whether or not to serialize the full state of the\n * field (rather than possibly saving a reference to some state).\n */\nfunction saveFields(block: Block, state: State, doFullSerialization: boolean) {\n const fields = Object.create(null);\n for (let i = 0; i < block.inputList.length; i++) {\n const input = block.inputList[i];\n for (let j = 0; j < input.fieldRow.length; j++) {\n const field = input.fieldRow[j];\n if (field.isSerializable()) {\n fields[field.name!] = field.saveState(doFullSerialization);\n }\n }\n }\n if (Object.keys(fields).length) {\n state['fields'] = fields;\n }\n}\n\n/**\n * Adds the state of all of the child blocks of the given block (which are\n * connected to inputs) to the given state object.\n *\n * @param block The block to serialize the input blocks of.\n * @param state The state object to append to.\n * @param doFullSerialization Whether or not to do full serialization.\n */\nfunction saveInputBlocks(\n block: Block, state: State, doFullSerialization: boolean) {\n const inputs = Object.create(null);\n for (let i = 0; i < block.inputList.length; i++) {\n const input = block.inputList[i];\n if (input.type === inputTypes.DUMMY) {\n continue;\n }\n const connectionState =\n saveConnection(input.connection as Connection, doFullSerialization);\n if (connectionState) {\n inputs[input.name] = connectionState;\n }\n }\n\n if (Object.keys(inputs).length) {\n state['inputs'] = inputs;\n }\n}\n\n/**\n * Adds the state of all of the next blocks of the given block to the given\n * state object.\n *\n * @param block The block to serialize the next blocks of.\n * @param state The state object to append to.\n * @param doFullSerialization Whether or not to do full serialization.\n */\nfunction saveNextBlocks(\n block: Block, state: State, doFullSerialization: boolean) {\n if (!block.nextConnection) {\n return;\n }\n const connectionState =\n saveConnection(block.nextConnection, doFullSerialization);\n if (connectionState) {\n state['next'] = connectionState;\n }\n}\n\n/**\n * Returns the state of the given connection (ie the state of any connected\n * shadow or real blocks).\n *\n * @param connection The connection to serialize the connected blocks of.\n * @returns An object containing the state of any connected shadow block, or any\n * connected real block.\n * @param doFullSerialization Whether or not to do full serialization.\n */\nfunction saveConnection(connection: Connection, doFullSerialization: boolean):\n ConnectionState|null {\n const shadow = connection.getShadowState(true);\n const child = connection.targetBlock();\n if (!shadow && !child) {\n return null;\n }\n const state = Object.create(null);\n if (shadow) {\n state['shadow'] = shadow;\n }\n if (child && !child.isShadow()) {\n state['block'] = save(child, {doFullSerialization});\n }\n return state;\n}\n\n/**\n * Loads the block represented by the given state into the given workspace.\n *\n * @param state The state of a block to deserialize into the workspace.\n * @param workspace The workspace to add the block to.\n * @param param1 recordUndo: If true, events triggered by this function will be\n * undo-able by the user. False by default.\n * @returns The block that was just loaded.\n * @alias Blockly.serialization.blocks.append\n */\nexport function append(\n state: State, workspace: Workspace,\n {recordUndo = false}: {recordUndo?: boolean} = {}): Block {\n return appendInternal(state, workspace, {recordUndo});\n}\n\n/**\n * Loads the block represented by the given state into the given workspace.\n * This is defined internally so that the extra parameters don't clutter our\n * external API.\n * But it is exported so that other places within Blockly can call it directly\n * with the extra parameters.\n *\n * @param state The state of a block to deserialize into the workspace.\n * @param workspace The workspace to add the block to.\n * @param param1 parentConnection: If provided, the system will attempt to\n * connect the block to this connection after it is created. Undefined by\n * default. isShadow: If true, the block will be set to a shadow block after\n * it is created. False by default. recordUndo: If true, events triggered by\n * this function will be undo-able by the user. False by default.\n * @returns The block that was just appended.\n * @alias Blockly.serialization.blocks.appendInternal\n * @internal\n */\nexport function appendInternal(\n state: State, workspace: Workspace,\n {parentConnection = undefined, isShadow = false, recordUndo = false}: {\n parentConnection?: Connection,\n isShadow?: boolean,\n recordUndo?: boolean\n } = {}): Block {\n const prevRecordUndo = eventUtils.getRecordUndo();\n eventUtils.setRecordUndo(recordUndo);\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n eventUtils.disable();\n\n const block = appendPrivate(state, workspace, {parentConnection, isShadow});\n\n eventUtils.enable();\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CREATE))(block));\n eventUtils.setGroup(existingGroup);\n eventUtils.setRecordUndo(prevRecordUndo);\n\n // Adding connections to the connection db is expensive. This defers that\n // operation to decrease load time.\n if (workspace.rendered) {\n const blockSvg = block as BlockSvg;\n setTimeout(() => {\n if (!blockSvg.disposed) {\n blockSvg.setConnectionTracking(true);\n }\n }, 1);\n }\n\n return block;\n}\n\n/**\n * Loads the block represented by the given state into the given workspace.\n * This is defined privately so that it can be called recursively without firing\n * eroneous events. Events (and other things we only want to occur on the top\n * block) are handled by appendInternal.\n *\n * @param state The state of a block to deserialize into the workspace.\n * @param workspace The workspace to add the block to.\n * @param param1 parentConnection: If provided, the system will attempt to\n * connect the block to this connection after it is created. Undefined by\n * default. isShadow: The block will be set to a shadow block after it is\n * created. False by default.\n * @returns The block that was just appended.\n */\nfunction appendPrivate(\n state: State, workspace: Workspace,\n {parentConnection = undefined, isShadow = false}:\n {parentConnection?: Connection, isShadow?: boolean} = {}): Block {\n if (!state['type']) {\n throw new MissingBlockType(state);\n }\n\n const block = workspace.newBlock(state['type'], state['id']);\n block.setShadow(isShadow);\n loadCoords(block, state);\n loadAttributes(block, state);\n loadExtraState(block, state);\n tryToConnectParent(parentConnection, block, state);\n loadIcons(block, state);\n loadFields(block, state);\n loadInputBlocks(block, state);\n loadNextBlocks(block, state);\n initBlock(block, workspace.rendered);\n\n return block;\n}\n\n/**\n * Applies any coordinate information available on the state object to the\n * block.\n *\n * @param block The block to set the position of.\n * @param state The state object to reference.\n */\nfunction loadCoords(block: Block, state: State) {\n let x = state['x'] === undefined ? 0 : state['x'];\n const y = state['y'] === undefined ? 0 : state['y'];\n\n const workspace = block.workspace;\n x = workspace.RTL ? workspace.getWidth() - x : x;\n\n block.moveBy(x, y);\n}\n\n/**\n * Applies any attribute information available on the state object to the block.\n *\n * @param block The block to set the attributes of.\n * @param state The state object to reference.\n */\nfunction loadAttributes(block: Block, state: State) {\n if (state['collapsed']) {\n block.setCollapsed(true);\n }\n if (state['enabled'] === false) {\n block.setEnabled(false);\n }\n if (state['inline'] !== undefined) {\n block.setInputsInline(state['inline']);\n }\n if (state['data'] !== undefined) {\n block.data = state['data'];\n }\n}\n\n/**\n * Applies any extra state information available on the state object to the\n * block.\n *\n * @param block The block to set the extra state of.\n * @param state The state object to reference.\n */\nfunction loadExtraState(block: Block, state: State) {\n if (!state['extraState']) {\n return;\n }\n if (block.loadExtraState) {\n block.loadExtraState(state['extraState']);\n } else if (block.domToMutation) {\n block.domToMutation(Xml.textToDom(state['extraState']));\n }\n}\n\n/**\n * Attempts to connect the block to the parent connection, if it exists.\n *\n * @param parentConnection The parent connection to try to connect the block to.\n * @param child The block to try to connect to the parent.\n * @param state The state which defines the given block\n */\nfunction tryToConnectParent(\n parentConnection: Connection|undefined, child: Block, state: State) {\n if (!parentConnection) {\n return;\n }\n\n if (parentConnection.getSourceBlock().isShadow() && !child.isShadow()) {\n throw new RealChildOfShadow(state);\n }\n\n let connected = false;\n let childConnection;\n if (parentConnection.type === inputTypes.VALUE) {\n childConnection = child.outputConnection;\n if (!childConnection) {\n throw new MissingConnection('output', child, state);\n }\n connected = parentConnection.connect(childConnection);\n } else { // Statement type.\n childConnection = child.previousConnection;\n if (!childConnection) {\n throw new MissingConnection('previous', child, state);\n }\n connected = parentConnection.connect(childConnection);\n }\n\n if (!connected) {\n const checker = child.workspace.connectionChecker;\n throw new BadConnectionCheck(\n checker.getErrorMessage(\n checker.canConnectWithReason(\n childConnection, parentConnection, false),\n childConnection, parentConnection),\n parentConnection.type === inputTypes.VALUE ? 'output connection' :\n 'previous connection',\n child, state);\n }\n}\n\n/**\n * Applies icon state to the icons on the block, based on the given state\n * object.\n *\n * @param block The block to set the icon state of.\n * @param state The state object to reference.\n */\nfunction loadIcons(block: Block, state: State) {\n if (!state['icons']) {\n return;\n }\n // TODO(#2105): Remove this logic and put it in the icon.\n const comment = state['icons']['comment'];\n if (comment) {\n block.setCommentText(comment['text']);\n // Load if saved. (Cleaned unnecessary attributes when in the trashcan.)\n if ('pinned' in comment) {\n block.commentModel.pinned = comment['pinned'];\n }\n if ('width' in comment && 'height' in comment) {\n block.commentModel.size = new Size(comment['width'], comment['height']);\n }\n if (comment['pinned'] && block.rendered && !block.isInFlyout) {\n // Give the block a chance to be positioned and rendered before showing.\n const blockSvg = block as BlockSvg;\n setTimeout(() => blockSvg.getCommentIcon()!.setVisible(true), 1);\n }\n }\n}\n\n/**\n * Applies any field information available on the state object to the block.\n *\n * @param block The block to set the field state of.\n * @param state The state object to reference.\n */\nfunction loadFields(block: Block, state: State) {\n if (!state['fields']) {\n return;\n }\n const keys = Object.keys(state['fields']);\n for (let i = 0; i < keys.length; i++) {\n const fieldName = keys[i];\n const fieldState = state['fields'][fieldName];\n const field = block.getField(fieldName);\n if (!field) {\n console.warn(\n `Ignoring non-existant field ${fieldName} in block ${block.type}`);\n continue;\n }\n field.loadState(fieldState);\n }\n}\n\n/**\n * Creates any child blocks (attached to inputs) defined by the given state\n * and attaches them to the given block.\n *\n * @param block The block to attach input blocks to.\n * @param state The state object to reference.\n */\nfunction loadInputBlocks(block: Block, state: State) {\n if (!state['inputs']) {\n return;\n }\n const keys = Object.keys(state['inputs']);\n for (let i = 0; i < keys.length; i++) {\n const inputName = keys[i];\n const input = block.getInput(inputName);\n if (!input || !input.connection) {\n throw new MissingConnection(inputName, block, state);\n }\n loadConnection(input.connection, state['inputs'][inputName]);\n }\n}\n\n/**\n * Creates any next blocks defined by the given state and attaches them to the\n * given block.\n *\n * @param block The block to attach next blocks to.\n * @param state The state object to reference.\n */\nfunction loadNextBlocks(block: Block, state: State) {\n if (!state['next']) {\n return;\n }\n if (!block.nextConnection) {\n throw new MissingConnection('next', block, state);\n }\n loadConnection(block.nextConnection, state['next']);\n}\n/**\n * Applies the state defined by connectionState to the given connection, ie\n * assigns shadows and attaches child blocks.\n *\n * @param connection The connection to deserialize the connected blocks of.\n * @param connectionState The object containing the state of any connected\n * shadow block, or any connected real block.\n */\nfunction loadConnection(\n connection: Connection, connectionState: ConnectionState) {\n if (connectionState['shadow']) {\n connection.setShadowState(connectionState['shadow']);\n }\n if (connectionState['block']) {\n appendPrivate(\n connectionState['block'], connection.getSourceBlock().workspace,\n {parentConnection: connection});\n }\n}\n\n// TODO(#5146): Remove this from the serialization system.\n/**\n * Initializes the give block, eg init the model, inits the svg, renders, etc.\n *\n * @param block The block to initialize.\n * @param rendered Whether the block is a rendered or headless block.\n */\nfunction initBlock(block: Block, rendered: boolean) {\n if (rendered) {\n const blockSvg = block as BlockSvg;\n // Adding connections to the connection db is expensive. This defers that\n // operation to decrease load time.\n blockSvg.setConnectionTracking(false);\n\n blockSvg.initSvg();\n blockSvg.render(false);\n // fixes #6076 JSO deserialization doesn't\n // set .iconXY_ property so here it will be set\n const icons = blockSvg.getIcons();\n for (let i = 0; i < icons.length; i++) {\n icons[i].computeIconLocation();\n }\n } else {\n block.initModel();\n }\n}\n\n// Alias to disambiguate saving within the serializer.\nconst saveBlock = save;\n\n/**\n * Serializer for saving and loading block state.\n *\n * @alias Blockly.serialization.blocks.BlockSerializer\n */\nclass BlockSerializer implements ISerializer {\n priority: number;\n\n /* eslint-disable-next-line require-jsdoc */\n constructor() {\n /** The priority for deserializing blocks. */\n this.priority = priorities.BLOCKS;\n }\n\n /**\n * Serializes the blocks of the given workspace.\n *\n * @param workspace The workspace to save the blocks of.\n * @returns The state of the workspace's blocks, or null if there are no\n * blocks.\n */\n save(workspace: Workspace): {languageVersion: number, blocks: State[]}|null {\n const blockStates = [];\n for (const block of workspace.getTopBlocks(false)) {\n const state =\n saveBlock(block, {addCoordinates: true, doFullSerialization: false});\n if (state) {\n blockStates.push(state);\n }\n }\n if (blockStates.length) {\n return {\n 'languageVersion': 0, // Currently unused.\n 'blocks': blockStates,\n };\n }\n return null;\n }\n\n /**\n * Deserializes the blocks defined by the given state into the given\n * workspace.\n *\n * @param state The state of the blocks to deserialize.\n * @param workspace The workspace to deserialize into.\n */\n load(\n state: {languageVersion: number, blocks: State[]}, workspace: Workspace) {\n const blockStates = state['blocks'];\n for (const state of blockStates) {\n append(state, workspace, {recordUndo: eventUtils.getRecordUndo()});\n }\n }\n\n /**\n * Disposes of any blocks that exist on the workspace.\n *\n * @param workspace The workspace to clear the blocks of.\n */\n clear(workspace: Workspace) {\n // Cannot use workspace.clear() because that also removes variables.\n for (const block of workspace.getTopBlocks(false)) {\n block.dispose(false);\n }\n }\n}\n\nserializationRegistry.register('blocks', new BlockSerializer());\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Components for creating connections between blocks.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Connection');\n\nimport type {Block} from './block.js';\nimport {ConnectionType} from './connection_type.js';\nimport type {BlockMove} from './events/events_block_move.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Input} from './input.js';\nimport type {IASTNodeLocationWithBlock} from './interfaces/i_ast_node_location_with_block.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport * as blocks from './serialization/blocks.js';\nimport * as Xml from './xml.js';\n\n\n/**\n * Class for a connection between blocks.\n *\n * @alias Blockly.Connection\n */\nexport class Connection implements IASTNodeLocationWithBlock {\n /** Constants for checking whether two connections are compatible. */\n static CAN_CONNECT = 0;\n static REASON_SELF_CONNECTION = 1;\n static REASON_WRONG_TYPE = 2;\n static REASON_TARGET_NULL = 3;\n static REASON_CHECKS_FAILED = 4;\n static REASON_DIFFERENT_WORKSPACES = 5;\n static REASON_SHADOW_PARENT = 6;\n static REASON_DRAG_CHECKS_FAILED = 7;\n static REASON_PREVIOUS_AND_OUTPUT = 8;\n\n protected sourceBlock_: Block;\n\n /** Connection this connection connects to. Null if not connected. */\n targetConnection: Connection|null = null;\n\n /**\n * Has this connection been disposed of?\n *\n * @internal\n */\n disposed = false;\n\n /** List of compatible value types. Null if all types are compatible. */\n private check_: string[]|null = null;\n\n /** DOM representation of a shadow block, or null if none. */\n private shadowDom_: Element|null = null;\n\n /**\n * Horizontal location of this connection.\n *\n * @internal\n */\n x = 0;\n\n /**\n * Vertical location of this connection.\n *\n * @internal\n */\n y = 0;\n\n private shadowState_: blocks.State|null = null;\n\n /**\n * @param source The block establishing this connection.\n * @param type The type of the connection.\n */\n constructor(source: Block, public type: number) {\n this.sourceBlock_ = source;\n }\n\n /**\n * Connect two connections together. This is the connection on the superior\n * block.\n *\n * @param childConnection Connection on inferior block.\n */\n protected connect_(childConnection: Connection) {\n const INPUT = ConnectionType.INPUT_VALUE;\n const parentBlock = this.getSourceBlock();\n const childBlock = childConnection.getSourceBlock();\n\n // Make sure the childConnection is available.\n if (childConnection.isConnected()) {\n childConnection.disconnect();\n }\n\n // Make sure the parentConnection is available.\n let orphan;\n if (this.isConnected()) {\n const shadowState = this.stashShadowState_();\n const target = this.targetBlock();\n if (target!.isShadow()) {\n target!.dispose(false);\n } else {\n this.disconnect();\n orphan = target;\n }\n this.applyShadowState_(shadowState);\n }\n\n // Connect the new connection to the parent.\n let event;\n if (eventUtils.isEnabled()) {\n event =\n new (eventUtils.get(eventUtils.BLOCK_MOVE))(childBlock) as BlockMove;\n }\n connectReciprocally(this, childConnection);\n childBlock.setParent(parentBlock);\n if (event) {\n event.recordNew();\n eventUtils.fire(event);\n }\n\n // Deal with the orphan if it exists.\n if (orphan) {\n const orphanConnection = this.type === INPUT ? orphan.outputConnection :\n orphan.previousConnection;\n const connection = Connection.getConnectionForOrphanedConnection(\n childBlock, (orphanConnection));\n if (connection) {\n orphanConnection.connect(connection);\n } else {\n orphanConnection.onFailedConnect(this);\n }\n }\n }\n\n /**\n * Dispose of this connection and deal with connected blocks.\n *\n * @internal\n */\n dispose() {\n // isConnected returns true for shadows and non-shadows.\n if (this.isConnected()) {\n // Destroy the attached shadow block & its children (if it exists).\n this.setShadowStateInternal_();\n\n const targetBlock = this.targetBlock();\n if (targetBlock) {\n // Disconnect the attached normal block.\n targetBlock.unplug();\n }\n }\n\n this.disposed = true;\n }\n\n /**\n * Get the source block for this connection.\n *\n * @returns The source block.\n */\n getSourceBlock(): Block {\n return this.sourceBlock_;\n }\n\n /**\n * Does the connection belong to a superior block (higher in the source\n * stack)?\n *\n * @returns True if connection faces down or right.\n */\n isSuperior(): boolean {\n return this.type === ConnectionType.INPUT_VALUE ||\n this.type === ConnectionType.NEXT_STATEMENT;\n }\n\n /**\n * Is the connection connected?\n *\n * @returns True if connection is connected to another connection.\n */\n isConnected(): boolean {\n return !!this.targetConnection;\n }\n\n /**\n * Get the workspace's connection type checker object.\n *\n * @returns The connection type checker for the source block's workspace.\n * @internal\n */\n getConnectionChecker(): IConnectionChecker {\n return this.sourceBlock_.workspace.connectionChecker;\n }\n\n /**\n * Called when an attempted connection fails. NOP by default (i.e. for\n * headless workspaces).\n *\n * @param _otherConnection Connection that this connection failed to connect\n * to.\n * @internal\n */\n onFailedConnect(_otherConnection: Connection) {}\n // NOP\n\n /**\n * Connect this connection to another connection.\n *\n * @param otherConnection Connection to connect to.\n * @returns Whether the the blocks are now connected or not.\n */\n connect(otherConnection: Connection): boolean {\n if (this.targetConnection === otherConnection) {\n // Already connected together. NOP.\n return true;\n }\n\n const checker = this.getConnectionChecker();\n if (checker.canConnect(this, otherConnection, false)) {\n const eventGroup = eventUtils.getGroup();\n if (!eventGroup) {\n eventUtils.setGroup(true);\n }\n // Determine which block is superior (higher in the source stack).\n if (this.isSuperior()) {\n // Superior block.\n this.connect_(otherConnection);\n } else {\n // Inferior block.\n otherConnection.connect_(this);\n }\n if (!eventGroup) {\n eventUtils.setGroup(false);\n }\n }\n\n return this.isConnected();\n }\n\n /** Disconnect this connection. */\n disconnect() {\n const otherConnection = this.targetConnection;\n if (!otherConnection) {\n throw Error('Source connection not connected.');\n }\n if (otherConnection.targetConnection !== this) {\n throw Error('Target connection not connected to source connection.');\n }\n let parentBlock;\n let childBlock;\n let parentConnection;\n if (this.isSuperior()) {\n // Superior block.\n parentBlock = this.sourceBlock_;\n childBlock = otherConnection.getSourceBlock();\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n parentConnection = this;\n } else {\n // Inferior block.\n parentBlock = otherConnection.getSourceBlock();\n childBlock = this.sourceBlock_;\n parentConnection = otherConnection;\n }\n\n const eventGroup = eventUtils.getGroup();\n if (!eventGroup) {\n eventUtils.setGroup(true);\n }\n this.disconnectInternal_(parentBlock, childBlock);\n if (!childBlock.isShadow()) {\n // If we were disconnecting a shadow, no need to spawn a new one.\n parentConnection.respawnShadow_();\n }\n if (!eventGroup) {\n eventUtils.setGroup(false);\n }\n }\n\n /**\n * Disconnect two blocks that are connected by this connection.\n *\n * @param parentBlock The superior block.\n * @param childBlock The inferior block.\n */\n protected disconnectInternal_(parentBlock: Block, childBlock: Block) {\n let event;\n if (eventUtils.isEnabled()) {\n event =\n new (eventUtils.get(eventUtils.BLOCK_MOVE))(childBlock) as BlockMove;\n }\n const otherConnection = this.targetConnection;\n if (otherConnection) {\n otherConnection.targetConnection = null;\n }\n this.targetConnection = null;\n childBlock.setParent(null);\n if (event) {\n event.recordNew();\n eventUtils.fire(event);\n }\n }\n\n /**\n * Respawn the shadow block if there was one connected to the this connection.\n */\n protected respawnShadow_() {\n // Have to keep respawnShadow_ for backwards compatibility.\n this.createShadowBlock_(true);\n }\n\n /**\n * Returns the block that this connection connects to.\n *\n * @returns The connected block or null if none is connected.\n */\n targetBlock(): Block|null {\n if (this.isConnected()) {\n return this.targetConnection?.getSourceBlock() ?? null;\n }\n return null;\n }\n\n /**\n * Function to be called when this connection's compatible types have changed.\n */\n protected onCheckChanged_() {\n // The new value type may not be compatible with the existing connection.\n if (this.isConnected() &&\n (!this.targetConnection ||\n !this.getConnectionChecker().canConnect(\n this, this.targetConnection, false))) {\n const child = this.isSuperior() ? this.targetBlock() : this.sourceBlock_;\n child!.unplug();\n }\n }\n\n /**\n * Change a connection's compatibility.\n *\n * @param check Compatible value type or list of value types. Null if all\n * types are compatible.\n * @returns The connection being modified (to allow chaining).\n */\n setCheck(check: string|string[]|null): Connection {\n if (check) {\n if (!Array.isArray(check)) {\n check = [check];\n }\n this.check_ = check;\n this.onCheckChanged_();\n } else {\n this.check_ = null;\n }\n return this;\n }\n\n /**\n * Get a connection's compatibility.\n *\n * @returns List of compatible value types.\n * Null if all types are compatible.\n */\n getCheck(): string[]|null {\n return this.check_;\n }\n\n /**\n * Changes the connection's shadow block.\n *\n * @param shadowDom DOM representation of a block or null.\n */\n setShadowDom(shadowDom: Element|null) {\n this.setShadowStateInternal_({shadowDom});\n }\n\n /**\n * Returns the xml representation of the connection's shadow block.\n *\n * @param returnCurrent If true, and the shadow block is currently attached to\n * this connection, this serializes the state of that block and returns it\n * (so that field values are correct). Otherwise the saved shadowDom is\n * just returned.\n * @returns Shadow DOM representation of a block or null.\n */\n getShadowDom(returnCurrent?: boolean): Element|null {\n return returnCurrent && this.targetBlock()!.isShadow() ?\n Xml.blockToDom((this.targetBlock() as Block)) as Element :\n this.shadowDom_;\n }\n\n /**\n * Changes the connection's shadow block.\n *\n * @param shadowState An state represetation of the block or null.\n */\n setShadowState(shadowState: blocks.State|null) {\n this.setShadowStateInternal_({shadowState});\n }\n\n /**\n * Returns the serialized object representation of the connection's shadow\n * block.\n *\n * @param returnCurrent If true, and the shadow block is currently attached to\n * this connection, this serializes the state of that block and returns it\n * (so that field values are correct). Otherwise the saved state is just\n * returned.\n * @returns Serialized object representation of the block, or null.\n */\n getShadowState(returnCurrent?: boolean): blocks.State|null {\n if (returnCurrent && this.targetBlock() && this.targetBlock()!.isShadow()) {\n return blocks.save(this.targetBlock() as Block);\n }\n return this.shadowState_;\n }\n\n /**\n * Find all nearby compatible connections to this connection.\n * Type checking does not apply, since this function is used for bumping.\n *\n * Headless configurations (the default) do not have neighboring connection,\n * and always return an empty list (the default).\n * {@link RenderedConnection#neighbours} overrides this behavior with a list\n * computed from the rendered positioning.\n *\n * @param _maxLimit The maximum radius to another connection.\n * @returns List of connections.\n * @internal\n */\n neighbours(_maxLimit: number): Connection[] {\n return [];\n }\n\n /**\n * Get the parent input of a connection.\n *\n * @returns The input that the connection belongs to or null if no parent\n * exists.\n * @internal\n */\n getParentInput(): Input|null {\n let parentInput = null;\n const inputs = this.sourceBlock_.inputList;\n for (let i = 0; i < inputs.length; i++) {\n if (inputs[i].connection === this) {\n parentInput = inputs[i];\n break;\n }\n }\n return parentInput;\n }\n\n /**\n * This method returns a string describing this Connection in developer terms\n * (English only). Intended to on be used in console logs and errors.\n *\n * @returns The description.\n */\n toString(): string {\n const block = this.sourceBlock_;\n if (!block) {\n return 'Orphan Connection';\n }\n let msg;\n if (block.outputConnection === this) {\n msg = 'Output Connection of ';\n } else if (block.previousConnection === this) {\n msg = 'Previous Connection of ';\n } else if (block.nextConnection === this) {\n msg = 'Next Connection of ';\n } else {\n let parentInput = null;\n for (let i = 0, input; input = block.inputList[i]; i++) {\n if (input.connection === this) {\n parentInput = input;\n break;\n }\n }\n if (parentInput) {\n msg = 'Input \"' + parentInput.name + '\" connection on ';\n } else {\n console.warn('Connection not actually connected to sourceBlock_');\n return 'Orphan Connection';\n }\n }\n return msg + block.toDevString();\n }\n\n /**\n * Returns the state of the shadowDom_ and shadowState_ properties, then\n * temporarily sets those properties to null so no shadow respawns.\n *\n * @returns The state of both the shadowDom_ and shadowState_ properties.\n */\n private stashShadowState_():\n {shadowDom: Element|null, shadowState: blocks.State|null} {\n const shadowDom = this.getShadowDom(true);\n const shadowState = this.getShadowState(true);\n // Set to null so it doesn't respawn.\n this.shadowDom_ = null;\n this.shadowState_ = null;\n return {shadowDom, shadowState};\n }\n\n /**\n * Reapplies the stashed state of the shadowDom_ and shadowState_ properties.\n *\n * @param param0 The state to reapply to the shadowDom_ and shadowState_\n * properties.\n */\n private applyShadowState_({shadowDom, shadowState}: {\n shadowDom: Element|null,\n shadowState: blocks.State|null\n }) {\n this.shadowDom_ = shadowDom;\n this.shadowState_ = shadowState;\n }\n\n /**\n * Sets the state of the shadow of this connection.\n *\n * @param param0 The state to set the shadow of this connection to.\n */\n private setShadowStateInternal_({shadowDom = null, shadowState = null}: {\n shadowDom?: Element|null,\n shadowState?: blocks.State|null\n } = {}) {\n // One or both of these should always be null.\n // If neither is null, the shadowState will get priority.\n this.shadowDom_ = shadowDom;\n this.shadowState_ = shadowState;\n\n const target = this.targetBlock();\n if (!target) {\n this.respawnShadow_();\n if (this.targetBlock() && this.targetBlock()!.isShadow()) {\n this.serializeShadow_(this.targetBlock());\n }\n } else if (target.isShadow()) {\n target.dispose(false);\n this.respawnShadow_();\n if (this.targetBlock() && this.targetBlock()!.isShadow()) {\n this.serializeShadow_(this.targetBlock());\n }\n } else {\n const shadow = this.createShadowBlock_(false);\n this.serializeShadow_(shadow);\n if (shadow) {\n shadow.dispose(false);\n }\n }\n }\n\n /**\n * Creates a shadow block based on the current shadowState_ or shadowDom_.\n * shadowState_ gets priority.\n *\n * @param attemptToConnect Whether to try to connect the shadow block to this\n * connection or not.\n * @returns The shadow block that was created, or null if both the\n * shadowState_ and shadowDom_ are null.\n */\n private createShadowBlock_(attemptToConnect: boolean): Block|null {\n const parentBlock = this.getSourceBlock();\n const shadowState = this.getShadowState();\n const shadowDom = this.getShadowDom();\n if (parentBlock.isDeadOrDying() || !shadowState && !shadowDom) {\n return null;\n }\n\n let blockShadow;\n if (shadowState) {\n blockShadow = blocks.appendInternal(shadowState, parentBlock.workspace, {\n parentConnection: attemptToConnect ? this : undefined,\n isShadow: true,\n recordUndo: false,\n });\n return blockShadow;\n }\n\n if (shadowDom) {\n blockShadow = Xml.domToBlock(shadowDom, parentBlock.workspace);\n if (attemptToConnect) {\n if (this.type === ConnectionType.INPUT_VALUE) {\n if (!blockShadow.outputConnection) {\n throw new Error('Shadow block is missing an output connection');\n }\n if (!this.connect(blockShadow.outputConnection)) {\n throw new Error('Could not connect shadow block to connection');\n }\n } else if (this.type === ConnectionType.NEXT_STATEMENT) {\n if (!blockShadow.previousConnection) {\n throw new Error('Shadow block is missing previous connection');\n }\n if (!this.connect(blockShadow.previousConnection)) {\n throw new Error('Could not connect shadow block to connection');\n }\n } else {\n throw new Error(\n 'Cannot connect a shadow block to a previous/output connection');\n }\n }\n return blockShadow;\n }\n return null;\n }\n\n /**\n * Saves the given shadow block to both the shadowDom_ and shadowState_\n * properties, in their respective serialized forms.\n *\n * @param shadow The shadow to serialize, or null.\n */\n private serializeShadow_(shadow: Block|null) {\n if (!shadow) {\n return;\n }\n this.shadowDom_ = Xml.blockToDom(shadow) as Element;\n this.shadowState_ = blocks.save(shadow);\n }\n\n /**\n * Returns the connection (starting at the startBlock) which will accept\n * the given connection. This includes compatible connection types and\n * connection checks.\n *\n * @param startBlock The block on which to start the search.\n * @param orphanConnection The connection that is looking for a home.\n * @returns The suitable connection point on the chain of blocks, or null.\n */\n static getConnectionForOrphanedConnection(\n startBlock: Block, orphanConnection: Connection): Connection|null {\n if (orphanConnection.type === ConnectionType.OUTPUT_VALUE) {\n return getConnectionForOrphanedOutput(\n startBlock, orphanConnection.getSourceBlock());\n }\n // Otherwise we're dealing with a stack.\n const connection = startBlock.lastConnectionInStack(true);\n const checker = orphanConnection.getConnectionChecker();\n if (connection && checker.canConnect(orphanConnection, connection, false)) {\n return connection;\n }\n return null;\n }\n}\n\n/**\n * Update two connections to target each other.\n *\n * @param first The first connection to update.\n * @param second The second connection to update.\n */\nfunction connectReciprocally(first: Connection, second: Connection) {\n if (!first || !second) {\n throw Error('Cannot connect null connections.');\n }\n first.targetConnection = second;\n second.targetConnection = first;\n}\n/**\n * Returns the single connection on the block that will accept the orphaned\n * block, if one can be found. If the block has multiple compatible connections\n * (even if they are filled) this returns null. If the block has no compatible\n * connections, this returns null.\n *\n * @param block The superior block.\n * @param orphanBlock The inferior block.\n * @returns The suitable connection point on 'block', or null.\n */\nfunction getSingleConnection(block: Block, orphanBlock: Block): Connection|\n null {\n let foundConnection = null;\n const output = orphanBlock.outputConnection;\n const typeChecker = output.getConnectionChecker();\n\n for (let i = 0, input; input = block.inputList[i]; i++) {\n const connection = input.connection;\n if (connection && typeChecker.canConnect(output, connection, false)) {\n if (foundConnection) {\n return null; // More than one connection.\n }\n foundConnection = connection;\n }\n }\n return foundConnection;\n}\n\n/**\n * Walks down a row a blocks, at each stage checking if there are any\n * connections that will accept the orphaned block. If at any point there\n * are zero or multiple eligible connections, returns null. Otherwise\n * returns the only input on the last block in the chain.\n * Terminates early for shadow blocks.\n *\n * @param startBlock The block on which to start the search.\n * @param orphanBlock The block that is looking for a home.\n * @returns The suitable connection point on the chain of blocks, or null.\n */\nfunction getConnectionForOrphanedOutput(\n startBlock: Block, orphanBlock: Block): Connection|null {\n let newBlock: Block|null = startBlock;\n let connection;\n while (connection = getSingleConnection(newBlock, orphanBlock)) {\n newBlock = connection.targetBlock();\n if (!newBlock || newBlock.isShadow()) {\n return connection;\n }\n }\n return null;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing an AST node.\n * Used to traverse the Blockly AST.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ASTNode');\n\nimport type {Block} from '../block.js';\nimport type {Connection} from '../connection.js';\nimport {ConnectionType} from '../connection_type.js';\nimport type {Field} from '../field.js';\nimport type {Input} from '../input.js';\nimport type {IASTNodeLocation} from '../interfaces/i_ast_node_location.js';\nimport type {IASTNodeLocationWithBlock} from '../interfaces/i_ast_node_location_with_block.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport type {Workspace} from '../workspace.js';\n\n\n/**\n * Class for an AST node.\n * It is recommended that you use one of the createNode methods instead of\n * creating a node directly.\n *\n * @alias Blockly.ASTNode\n */\nexport class ASTNode {\n /**\n * True to navigate to all fields. False to only navigate to clickable fields.\n */\n static NAVIGATE_ALL_FIELDS = false;\n\n /**\n * The default y offset to use when moving the cursor from a stack to the\n * workspace.\n */\n private static readonly DEFAULT_OFFSET_Y: number = -20;\n private readonly type_: string;\n private readonly isConnection_: boolean;\n private readonly location_: IASTNodeLocation;\n\n /** The coordinate on the workspace. */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Coordinate'.\n private wsCoordinate_: Coordinate = null as AnyDuringMigration;\n\n /**\n * @param type The type of the location.\n * Must be in ASTNode.types.\n * @param location The position in the AST.\n * @param opt_params Optional dictionary of options.\n * @alias Blockly.ASTNode\n */\n constructor(type: string, location: IASTNodeLocation, opt_params?: Params) {\n if (!location) {\n throw Error('Cannot create a node without a location.');\n }\n\n /**\n * The type of the location.\n * One of ASTNode.types\n */\n this.type_ = type;\n\n /** Whether the location points to a connection. */\n this.isConnection_ = ASTNode.isConnectionType_(type);\n\n /** The location of the AST node. */\n this.location_ = location;\n\n this.processParams_(opt_params || null);\n }\n\n /**\n * Parse the optional parameters.\n *\n * @param params The user specified parameters.\n */\n private processParams_(params: Params|null) {\n if (!params) {\n return;\n }\n if (params.wsCoordinate) {\n this.wsCoordinate_ = params.wsCoordinate;\n }\n }\n\n /**\n * Gets the value pointed to by this node.\n * It is the callers responsibility to check the node type to figure out what\n * type of object they get back from this.\n *\n * @returns The current field, connection, workspace, or block the cursor is\n * on.\n */\n getLocation(): IASTNodeLocation {\n return this.location_;\n }\n\n /**\n * The type of the current location.\n * One of ASTNode.types\n *\n * @returns The type of the location.\n */\n getType(): string {\n return this.type_;\n }\n\n /**\n * The coordinate on the workspace.\n *\n * @returns The workspace coordinate or null if the location is not a\n * workspace.\n */\n getWsCoordinate(): Coordinate {\n return this.wsCoordinate_;\n }\n\n /**\n * Whether the node points to a connection.\n *\n * @returns [description]\n * @internal\n */\n isConnection(): boolean {\n return this.isConnection_;\n }\n\n /**\n * Given an input find the next editable field or an input with a non null\n * connection in the same block. The current location must be an input\n * connection.\n *\n * @returns The AST node holding the next field or connection or null if there\n * is no editable field or input connection after the given input.\n */\n private findNextForInput_(): ASTNode|null {\n const location = this.location_ as Connection;\n const parentInput = location.getParentInput();\n const block = parentInput!.getSourceBlock();\n // AnyDuringMigration because: Argument of type 'Input | null' is not\n // assignable to parameter of type 'Input'.\n const curIdx = block!.inputList.indexOf(parentInput as AnyDuringMigration);\n for (let i = curIdx + 1; i < block!.inputList.length; i++) {\n const input = block!.inputList[i];\n const fieldRow = input.fieldRow;\n for (let j = 0; j < fieldRow.length; j++) {\n const field = fieldRow[j];\n if (field.isClickable() || ASTNode.NAVIGATE_ALL_FIELDS) {\n return ASTNode.createFieldNode(field);\n }\n }\n if (input.connection) {\n return ASTNode.createInputNode(input);\n }\n }\n return null;\n }\n\n /**\n * Given a field find the next editable field or an input with a non null\n * connection in the same block. The current location must be a field.\n *\n * @returns The AST node pointing to the next field or connection or null if\n * there is no editable field or input connection after the given input.\n */\n private findNextForField_(): ASTNode|null {\n const location = this.location_ as Field;\n const input = location.getParentInput();\n const block = location.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The current AST location is not associated with a block');\n }\n const curIdx = block.inputList.indexOf((input));\n let fieldIdx = input.fieldRow.indexOf(location) + 1;\n for (let i = curIdx; i < block.inputList.length; i++) {\n const newInput = block.inputList[i];\n const fieldRow = newInput.fieldRow;\n while (fieldIdx < fieldRow.length) {\n if (fieldRow[fieldIdx].isClickable() || ASTNode.NAVIGATE_ALL_FIELDS) {\n return ASTNode.createFieldNode(fieldRow[fieldIdx]);\n }\n fieldIdx++;\n }\n fieldIdx = 0;\n if (newInput.connection) {\n return ASTNode.createInputNode(newInput);\n }\n }\n return null;\n }\n\n /**\n * Given an input find the previous editable field or an input with a non null\n * connection in the same block. The current location must be an input\n * connection.\n *\n * @returns The AST node holding the previous field or connection.\n */\n private findPrevForInput_(): ASTNode|null {\n const location = this.location_ as Connection;\n const parentInput = location.getParentInput();\n const block = parentInput!.getSourceBlock();\n // AnyDuringMigration because: Argument of type 'Input | null' is not\n // assignable to parameter of type 'Input'.\n const curIdx = block!.inputList.indexOf(parentInput as AnyDuringMigration);\n for (let i = curIdx; i >= 0; i--) {\n const input = block!.inputList[i];\n if (input.connection && input !== parentInput) {\n return ASTNode.createInputNode(input);\n }\n const fieldRow = input.fieldRow;\n for (let j = fieldRow.length - 1; j >= 0; j--) {\n const field = fieldRow[j];\n if (field.isClickable() || ASTNode.NAVIGATE_ALL_FIELDS) {\n return ASTNode.createFieldNode(field);\n }\n }\n }\n return null;\n }\n\n /**\n * Given a field find the previous editable field or an input with a non null\n * connection in the same block. The current location must be a field.\n *\n * @returns The AST node holding the previous input or field.\n */\n private findPrevForField_(): ASTNode|null {\n const location = this.location_ as Field;\n const parentInput = location.getParentInput();\n const block = location.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The current AST location is not associated with a block');\n }\n const curIdx = block.inputList.indexOf((parentInput));\n let fieldIdx = parentInput.fieldRow.indexOf(location) - 1;\n for (let i = curIdx; i >= 0; i--) {\n const input = block.inputList[i];\n if (input.connection && input !== parentInput) {\n return ASTNode.createInputNode(input);\n }\n const fieldRow = input.fieldRow;\n while (fieldIdx > -1) {\n if (fieldRow[fieldIdx].isClickable() || ASTNode.NAVIGATE_ALL_FIELDS) {\n return ASTNode.createFieldNode(fieldRow[fieldIdx]);\n }\n fieldIdx--;\n }\n // Reset the fieldIdx to the length of the field row of the previous\n // input.\n if (i - 1 >= 0) {\n fieldIdx = block.inputList[i - 1].fieldRow.length - 1;\n }\n }\n return null;\n }\n\n /**\n * Navigate between stacks of blocks on the workspace.\n *\n * @param forward True to go forward. False to go backwards.\n * @returns The first block of the next stack or null if there are no blocks\n * on the workspace.\n */\n private navigateBetweenStacks_(forward: boolean): ASTNode|null {\n let curLocation = this.getLocation();\n // TODO(#6097): Use instanceof checks to exit early for values of\n // curLocation that don't make sense.\n if ((curLocation as IASTNodeLocationWithBlock).getSourceBlock) {\n const block = (curLocation as IASTNodeLocationWithBlock).getSourceBlock();\n if (block) {\n curLocation = block;\n }\n }\n // TODO(#6097): Use instanceof checks to exit early for values of\n // curLocation that don't make sense.\n const curLocationAsBlock = curLocation as Block;\n if (!curLocationAsBlock || curLocationAsBlock.isDeadOrDying()) {\n return null;\n }\n const curRoot = curLocationAsBlock.getRootBlock();\n const topBlocks = curRoot.workspace.getTopBlocks(true);\n for (let i = 0; i < topBlocks.length; i++) {\n const topBlock = topBlocks[i];\n if (curRoot.id === topBlock.id) {\n const offset = forward ? 1 : -1;\n const resultIndex = i + offset;\n if (resultIndex === -1 || resultIndex === topBlocks.length) {\n return null;\n }\n return ASTNode.createStackNode(topBlocks[resultIndex]);\n }\n }\n throw Error(\n 'Couldn\\'t find ' + (forward ? 'next' : 'previous') + ' stack?!');\n }\n\n /**\n * Finds the top most AST node for a given block.\n * This is either the previous connection, output connection or block\n * depending on what kind of connections the block has.\n *\n * @param block The block that we want to find the top connection on.\n * @returns The AST node containing the top connection.\n */\n private findTopASTNodeForBlock_(block: Block): ASTNode|null {\n const topConnection = getParentConnection(block);\n if (topConnection) {\n return ASTNode.createConnectionNode(topConnection);\n } else {\n return ASTNode.createBlockNode(block);\n }\n }\n\n /**\n * Get the AST node pointing to the input that the block is nested under or if\n * the block is not nested then get the stack AST node.\n *\n * @param block The source block of the current location.\n * @returns The AST node pointing to the input connection or the top block of\n * the stack this block is in.\n */\n private getOutAstNodeForBlock_(block: Block): ASTNode|null {\n if (!block) {\n return null;\n }\n // If the block doesn't have a previous connection then it is the top of the\n // substack.\n const topBlock = block.getTopStackBlock();\n const topConnection = getParentConnection(topBlock);\n // If the top connection has a parentInput, create an AST node pointing to\n // that input.\n if (topConnection && topConnection.targetConnection &&\n topConnection.targetConnection.getParentInput()) {\n // AnyDuringMigration because: Argument of type 'Input | null' is not\n // assignable to parameter of type 'Input'.\n return ASTNode.createInputNode(\n topConnection.targetConnection.getParentInput() as\n AnyDuringMigration);\n } else {\n // Go to stack level if you are not underneath an input.\n return ASTNode.createStackNode(topBlock);\n }\n }\n\n /**\n * Find the first editable field or input with a connection on a given block.\n *\n * @param block The source block of the current location.\n * @returns An AST node pointing to the first field or input.\n * Null if there are no editable fields or inputs with connections on the\n * block.\n */\n private findFirstFieldOrInput_(block: Block): ASTNode|null {\n const inputs = block.inputList;\n for (let i = 0; i < inputs.length; i++) {\n const input = inputs[i];\n const fieldRow = input.fieldRow;\n for (let j = 0; j < fieldRow.length; j++) {\n const field = fieldRow[j];\n if (field.isClickable() || ASTNode.NAVIGATE_ALL_FIELDS) {\n return ASTNode.createFieldNode(field);\n }\n }\n if (input.connection) {\n return ASTNode.createInputNode(input);\n }\n }\n return null;\n }\n\n /**\n * Finds the source block of the location of this node.\n *\n * @returns The source block of the location, or null if the node is of type\n * workspace.\n */\n getSourceBlock(): Block|null {\n if (this.getType() === ASTNode.types.BLOCK) {\n return this.getLocation() as Block;\n } else if (this.getType() === ASTNode.types.STACK) {\n return this.getLocation() as Block;\n } else if (this.getType() === ASTNode.types.WORKSPACE) {\n return null;\n } else {\n return (this.getLocation() as IASTNodeLocationWithBlock).getSourceBlock();\n }\n }\n\n /**\n * Find the element to the right of the current element in the AST.\n *\n * @returns An AST node that wraps the next field, connection, block, or\n * workspace. Or null if there is no node to the right.\n */\n next(): ASTNode|null {\n switch (this.type_) {\n case ASTNode.types.STACK:\n return this.navigateBetweenStacks_(true);\n\n case ASTNode.types.OUTPUT: {\n const connection = this.location_ as Connection;\n return ASTNode.createBlockNode(connection.getSourceBlock());\n }\n case ASTNode.types.FIELD:\n return this.findNextForField_();\n\n case ASTNode.types.INPUT:\n return this.findNextForInput_();\n\n case ASTNode.types.BLOCK: {\n const block = this.location_ as Block;\n const nextConnection = block.nextConnection;\n return ASTNode.createConnectionNode(nextConnection);\n }\n case ASTNode.types.PREVIOUS: {\n const connection = this.location_ as Connection;\n return ASTNode.createBlockNode(connection.getSourceBlock());\n }\n case ASTNode.types.NEXT: {\n const connection = this.location_ as Connection;\n const targetConnection = connection.targetConnection;\n return ASTNode.createConnectionNode(targetConnection!);\n }\n }\n\n return null;\n }\n\n /**\n * Find the element one level below and all the way to the left of the current\n * location.\n *\n * @returns An AST node that wraps the next field, connection, workspace, or\n * block. Or null if there is nothing below this node.\n */\n in(): ASTNode|null {\n switch (this.type_) {\n case ASTNode.types.WORKSPACE: {\n const workspace = this.location_ as Workspace;\n const topBlocks = workspace.getTopBlocks(true);\n if (topBlocks.length > 0) {\n return ASTNode.createStackNode(topBlocks[0]);\n }\n break;\n }\n case ASTNode.types.STACK: {\n const block = this.location_ as Block;\n return this.findTopASTNodeForBlock_(block);\n }\n case ASTNode.types.BLOCK: {\n const block = this.location_ as Block;\n return this.findFirstFieldOrInput_(block);\n }\n case ASTNode.types.INPUT: {\n const connection = this.location_ as Connection;\n const targetConnection = connection.targetConnection;\n return ASTNode.createConnectionNode(targetConnection!);\n }\n }\n\n return null;\n }\n\n /**\n * Find the element to the left of the current element in the AST.\n *\n * @returns An AST node that wraps the previous field, connection, workspace\n * or block. Or null if no node exists to the left. null.\n */\n prev(): ASTNode|null {\n switch (this.type_) {\n case ASTNode.types.STACK:\n return this.navigateBetweenStacks_(false);\n\n case ASTNode.types.OUTPUT:\n return null;\n\n case ASTNode.types.FIELD:\n return this.findPrevForField_();\n\n case ASTNode.types.INPUT:\n return this.findPrevForInput_();\n\n case ASTNode.types.BLOCK: {\n const block = this.location_ as Block;\n const topConnection = getParentConnection(block);\n return ASTNode.createConnectionNode(topConnection);\n }\n case ASTNode.types.PREVIOUS: {\n const connection = this.location_ as Connection;\n const targetConnection = connection.targetConnection;\n if (targetConnection && !targetConnection.getParentInput()) {\n return ASTNode.createConnectionNode(targetConnection);\n }\n break;\n }\n case ASTNode.types.NEXT: {\n const connection = this.location_ as Connection;\n return ASTNode.createBlockNode(connection.getSourceBlock());\n }\n }\n\n return null;\n }\n\n /**\n * Find the next element that is one position above and all the way to the\n * left of the current location.\n *\n * @returns An AST node that wraps the next field, connection, workspace or\n * block. Or null if we are at the workspace level.\n */\n out(): ASTNode|null {\n switch (this.type_) {\n case ASTNode.types.STACK: {\n const block = this.location_ as Block;\n const blockPos = block.getRelativeToSurfaceXY();\n // TODO: Make sure this is in the bounds of the workspace.\n const wsCoordinate =\n new Coordinate(blockPos.x, blockPos.y + ASTNode.DEFAULT_OFFSET_Y);\n return ASTNode.createWorkspaceNode(block.workspace, wsCoordinate);\n }\n case ASTNode.types.OUTPUT: {\n const connection = this.location_ as Connection;\n const target = connection.targetConnection;\n if (target) {\n return ASTNode.createConnectionNode(target);\n }\n return ASTNode.createStackNode(connection.getSourceBlock());\n }\n case ASTNode.types.FIELD: {\n const field = this.location_ as Field;\n const block = field.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The current AST location is not associated with a block');\n }\n return ASTNode.createBlockNode(block);\n }\n case ASTNode.types.INPUT: {\n const connection = this.location_ as Connection;\n return ASTNode.createBlockNode(connection.getSourceBlock());\n }\n case ASTNode.types.BLOCK: {\n const block = this.location_ as Block;\n return this.getOutAstNodeForBlock_(block);\n }\n case ASTNode.types.PREVIOUS: {\n const connection = this.location_ as Connection;\n return this.getOutAstNodeForBlock_(connection.getSourceBlock());\n }\n case ASTNode.types.NEXT: {\n const connection = this.location_ as Connection;\n return this.getOutAstNodeForBlock_(connection.getSourceBlock());\n }\n }\n\n return null;\n }\n\n /**\n * Whether an AST node of the given type points to a connection.\n *\n * @param type The type to check. One of ASTNode.types.\n * @returns True if a node of the given type points to a connection.\n */\n private static isConnectionType_(type: string): boolean {\n switch (type) {\n case ASTNode.types.PREVIOUS:\n case ASTNode.types.NEXT:\n case ASTNode.types.INPUT:\n case ASTNode.types.OUTPUT:\n return true;\n }\n return false;\n }\n\n /**\n * Create an AST node pointing to a field.\n *\n * @param field The location of the AST node.\n * @returns An AST node pointing to a field.\n */\n static createFieldNode(field: Field): ASTNode|null {\n if (!field) {\n return null;\n }\n return new ASTNode(ASTNode.types.FIELD, field);\n }\n\n /**\n * Creates an AST node pointing to a connection. If the connection has a\n * parent input then create an AST node of type input that will hold the\n * connection.\n *\n * @param connection This is the connection the node will point to.\n * @returns An AST node pointing to a connection.\n */\n static createConnectionNode(connection: Connection): ASTNode|null {\n if (!connection) {\n return null;\n }\n const type = connection.type;\n if (type === ConnectionType.INPUT_VALUE) {\n // AnyDuringMigration because: Argument of type 'Input | null' is not\n // assignable to parameter of type 'Input'.\n return ASTNode.createInputNode(\n connection.getParentInput() as AnyDuringMigration);\n } else if (\n type === ConnectionType.NEXT_STATEMENT && connection.getParentInput()) {\n // AnyDuringMigration because: Argument of type 'Input | null' is not\n // assignable to parameter of type 'Input'.\n return ASTNode.createInputNode(\n connection.getParentInput() as AnyDuringMigration);\n } else if (type === ConnectionType.NEXT_STATEMENT) {\n return new ASTNode(ASTNode.types.NEXT, connection);\n } else if (type === ConnectionType.OUTPUT_VALUE) {\n return new ASTNode(ASTNode.types.OUTPUT, connection);\n } else if (type === ConnectionType.PREVIOUS_STATEMENT) {\n return new ASTNode(ASTNode.types.PREVIOUS, connection);\n }\n return null;\n }\n\n /**\n * Creates an AST node pointing to an input. Stores the input connection as\n * the location.\n *\n * @param input The input used to create an AST node.\n * @returns An AST node pointing to a input.\n */\n static createInputNode(input: Input): ASTNode|null {\n if (!input || !input.connection) {\n return null;\n }\n return new ASTNode(ASTNode.types.INPUT, input.connection);\n }\n\n /**\n * Creates an AST node pointing to a block.\n *\n * @param block The block used to create an AST node.\n * @returns An AST node pointing to a block.\n */\n static createBlockNode(block: Block): ASTNode|null {\n if (!block) {\n return null;\n }\n return new ASTNode(ASTNode.types.BLOCK, block);\n }\n\n /**\n * Create an AST node of type stack. A stack, represented by its top block, is\n * the set of all blocks connected to a top block, including the top\n * block.\n *\n * @param topBlock A top block has no parent and can be found in the list\n * returned by workspace.getTopBlocks().\n * @returns An AST node of type stack that points to the top block on the\n * stack.\n */\n static createStackNode(topBlock: Block): ASTNode|null {\n if (!topBlock) {\n return null;\n }\n return new ASTNode(ASTNode.types.STACK, topBlock);\n }\n\n /**\n * Creates an AST node pointing to a workspace.\n *\n * @param workspace The workspace that we are on.\n * @param wsCoordinate The position on the workspace for this node.\n * @returns An AST node pointing to a workspace and a position on the\n * workspace.\n */\n static createWorkspaceNode(\n workspace: Workspace|null, wsCoordinate: Coordinate|null): ASTNode|null {\n if (!wsCoordinate || !workspace) {\n return null;\n }\n const params = {wsCoordinate};\n return new ASTNode(ASTNode.types.WORKSPACE, workspace, params);\n }\n\n /**\n * Creates an AST node for the top position on a block.\n * This is either an output connection, previous connection, or block.\n *\n * @param block The block to find the top most AST node on.\n * @returns The AST node holding the top most position on the block.\n */\n static createTopNode(block: Block): ASTNode|null {\n let astNode;\n const topConnection = getParentConnection(block);\n if (topConnection) {\n astNode = ASTNode.createConnectionNode(topConnection);\n } else {\n astNode = ASTNode.createBlockNode(block);\n }\n return astNode;\n }\n}\n\nexport namespace ASTNode {\n export interface Params {\n wsCoordinate: Coordinate;\n }\n\n export enum types {\n FIELD = 'field',\n BLOCK = 'block',\n INPUT = 'input',\n OUTPUT = 'output',\n NEXT = 'next',\n PREVIOUS = 'previous',\n STACK = 'stack',\n WORKSPACE = 'workspace',\n }\n}\n\nexport type Params = ASTNode.Params;\n// No need to export ASTNode.types from the module at this time because (1) it\n// wasn't automatically converted by the automatic migration script, (2) the\n// name doesn't follow the styleguide.\n\n\n/**\n * Gets the parent connection on a block.\n * This is either an output connection, previous connection or undefined.\n * If both connections exist return the one that is actually connected\n * to another block.\n *\n * @param block The block to find the parent connection on.\n * @returns The connection connecting to the parent of the block.\n */\nfunction getParentConnection(block: Block): Connection {\n let topConnection = block.outputConnection;\n if (!topConnection ||\n block.previousConnection && block.previousConnection.isConnected()) {\n topConnection = block.previousConnection;\n }\n return topConnection;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods animating a block on connection and disconnection.\n *\n * @namespace Blockly.blockAnimations\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockAnimations');\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\n\n\n/** A bounding box for a cloned block. */\ninterface CloneRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** PID of disconnect UI animation. There can only be one at a time. */\nlet disconnectPid: ReturnType<typeof setTimeout>|null = null;\n\n/** SVG group of wobbling block. There can only be one at a time. */\nlet disconnectGroup: SVGElement|null = null;\n\n\n/**\n * Play some UI effects (sound, animation) when disposing of a block.\n *\n * @param block The block being disposed of.\n * @alias Blockly.blockAnimations.disposeUiEffect\n * @internal\n */\nexport function disposeUiEffect(block: BlockSvg) {\n const workspace = block.workspace;\n const svgGroup = block.getSvgRoot();\n workspace.getAudioManager().play('delete');\n\n const xy = workspace.getSvgXY(svgGroup);\n // Deeply clone the current block.\n const clone: SVGGElement = svgGroup.cloneNode(true) as SVGGElement;\n clone.setAttribute('transform', 'translate(' + xy.x + ',' + xy.y + ')');\n workspace.getParentSvg().appendChild(clone);\n const cloneRect =\n {'x': xy.x, 'y': xy.y, 'width': block.width, 'height': block.height};\n disposeUiStep(clone, cloneRect, workspace.RTL, new Date(), workspace.scale);\n}\n/**\n * Animate a cloned block and eventually dispose of it.\n * This is a class method, not an instance method since the original block has\n * been destroyed and is no longer accessible.\n *\n * @param clone SVG element to animate and dispose of.\n * @param rect Starting rect of the clone.\n * @param rtl True if RTL, false if LTR.\n * @param start Date of animation's start.\n * @param workspaceScale Scale of workspace.\n */\nfunction disposeUiStep(\n clone: Element, rect: CloneRect, rtl: boolean, start: Date,\n workspaceScale: number) {\n const ms = new Date().getTime() - start.getTime();\n const percent = ms / 150;\n if (percent > 1) {\n dom.removeNode(clone);\n } else {\n const x =\n rect.x + (rtl ? -1 : 1) * rect.width * workspaceScale / 2 * percent;\n const y = rect.y + rect.height * workspaceScale * percent;\n const scale = (1 - percent) * workspaceScale;\n clone.setAttribute(\n 'transform',\n 'translate(' + x + ',' + y + ')' +\n ' scale(' + scale + ')');\n setTimeout(disposeUiStep, 10, clone, rect, rtl, start, workspaceScale);\n }\n}\n\n/**\n * Play some UI effects (sound, ripple) after a connection has been established.\n *\n * @param block The block being connected.\n * @alias Blockly.blockAnimations.connectionUiEffect\n * @internal\n */\nexport function connectionUiEffect(block: BlockSvg) {\n const workspace = block.workspace;\n const scale = workspace.scale;\n workspace.getAudioManager().play('click');\n if (scale < 1) {\n return; // Too small to care about visual effects.\n }\n // Determine the absolute coordinates of the inferior block.\n const xy = workspace.getSvgXY(block.getSvgRoot());\n // Offset the coordinates based on the two connection types, fix scale.\n if (block.outputConnection) {\n xy.x += (block.RTL ? 3 : -3) * scale;\n xy.y += 13 * scale;\n } else if (block.previousConnection) {\n xy.x += (block.RTL ? -23 : 23) * scale;\n xy.y += 3 * scale;\n }\n const ripple = dom.createSvgElement(\n Svg.CIRCLE, {\n 'cx': xy.x,\n 'cy': xy.y,\n 'r': 0,\n 'fill': 'none',\n 'stroke': '#888',\n 'stroke-width': 10,\n },\n workspace.getParentSvg());\n // Start the animation.\n connectionUiStep(ripple, new Date(), scale);\n}\n\n/**\n * Expand a ripple around a connection.\n *\n * @param ripple Element to animate.\n * @param start Date of animation's start.\n * @param scale Scale of workspace.\n */\nfunction connectionUiStep(ripple: SVGElement, start: Date, scale: number) {\n const ms = new Date().getTime() - start.getTime();\n const percent = ms / 150;\n if (percent > 1) {\n dom.removeNode(ripple);\n } else {\n ripple.setAttribute('r', (percent * 25 * scale).toString());\n ripple.style.opacity = (1 - percent).toString();\n disconnectPid = setTimeout(connectionUiStep, 10, ripple, start, scale);\n }\n}\n\n/**\n * Play some UI effects (sound, animation) when disconnecting a block.\n *\n * @param block The block being disconnected.\n * @alias Blockly.blockAnimations.disconnectUiEffect\n * @internal\n */\nexport function disconnectUiEffect(block: BlockSvg) {\n disconnectUiStop();\n block.workspace.getAudioManager().play('disconnect');\n if (block.workspace.scale < 1) {\n return; // Too small to care about visual effects.\n }\n // Horizontal distance for bottom of block to wiggle.\n const DISPLACEMENT = 10;\n // Scale magnitude of skew to height of block.\n const height = block.getHeightWidth().height;\n let magnitude = Math.atan(DISPLACEMENT / height) / Math.PI * 180;\n if (!block.RTL) {\n magnitude *= -1;\n }\n // Start the animation.\n disconnectGroup = block.getSvgRoot();\n disconnectUiStep(disconnectGroup, magnitude, new Date());\n}\n\n/**\n * Animate a brief wiggle of a disconnected block.\n *\n * @param group SVG element to animate.\n * @param magnitude Maximum degrees skew (reversed for RTL).\n * @param start Date of animation's start.\n */\nfunction disconnectUiStep(group: SVGElement, magnitude: number, start: Date) {\n const DURATION = 200; // Milliseconds.\n const WIGGLES = 3; // Half oscillations.\n\n const ms = new Date().getTime() - start.getTime();\n const percent = ms / DURATION;\n\n let skew = '';\n if (percent <= 1) {\n const val = Math.round(\n Math.sin(percent * Math.PI * WIGGLES) * (1 - percent) * magnitude);\n skew = `skewX(${val})`;\n disconnectPid = setTimeout(disconnectUiStep, 10, group, magnitude, start);\n }\n (group as AnyDuringMigration).skew_ = skew;\n group.setAttribute(\n 'transform',\n (group as AnyDuringMigration).translate_ +\n (group as AnyDuringMigration).skew_);\n}\n\n/**\n * Stop the disconnect UI animation immediately.\n *\n * @alias Blockly.blockAnimations.disconnectUiStop\n * @internal\n */\nexport function disconnectUiStop() {\n if (disconnectGroup) {\n if (disconnectPid) {\n clearTimeout(disconnectPid);\n }\n const group = disconnectGroup;\n (group as AnyDuringMigration).skew_ = '';\n group.setAttribute('transform', (group as AnyDuringMigration).translate_);\n disconnectGroup = null;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Blockly's internal clipboard for managing copy-paste.\n *\n * @namespace Blockly.clipboard\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.clipboard');\n\nimport type {CopyData, ICopyable} from './interfaces/i_copyable.js';\n\n\n/** Metadata about the object that is currently on the clipboard. */\nlet copyData: CopyData|null = null;\n\n/**\n * Copy a block or workspace comment onto the local clipboard.\n *\n * @param toCopy Block or Workspace Comment to be copied.\n * @alias Blockly.clipboard.copy\n * @internal\n */\nexport function copy(toCopy: ICopyable) {\n TEST_ONLY.copyInternal(toCopy);\n}\n\n/**\n * Private version of copy for stubbing in tests.\n */\nfunction copyInternal(toCopy: ICopyable) {\n copyData = toCopy.toCopyData();\n}\n\n/**\n * Paste a block or workspace comment on to the main workspace.\n *\n * @returns The pasted thing if the paste was successful, null otherwise.\n * @alias Blockly.clipboard.paste\n * @internal\n */\nexport function paste(): ICopyable|null {\n if (!copyData) {\n return null;\n }\n // Pasting always pastes to the main workspace, even if the copy\n // started in a flyout workspace.\n let workspace = copyData.source;\n if (workspace.isFlyout) {\n workspace = workspace.targetWorkspace!;\n }\n if (copyData.typeCounts &&\n workspace.isCapacityAvailable(copyData.typeCounts)) {\n return workspace.paste(copyData.saveInfo);\n }\n return null;\n}\n\n/**\n * Duplicate this block and its children, or a workspace comment.\n *\n * @param toDuplicate Block or Workspace Comment to be duplicated.\n * @returns The block or workspace comment that was duplicated, or null if the\n * duplication failed.\n * @alias Blockly.clipboard.duplicate\n * @internal\n */\nexport function duplicate(toDuplicate: ICopyable): ICopyable|null {\n return TEST_ONLY.duplicateInternal(toDuplicate);\n}\n\n/**\n * Private version of duplicate for stubbing in tests.\n */\nfunction duplicateInternal(toDuplicate: ICopyable): ICopyable|null {\n const oldCopyData = copyData;\n copy(toDuplicate);\n const pastedThing =\n toDuplicate.toCopyData()?.source?.paste(copyData!.saveInfo) ?? null;\n copyData = oldCopyData;\n return pastedThing;\n}\n\nexport const TEST_ONLY = {\n duplicateInternal,\n copyInternal,\n};\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Functionality for the right-click context menus.\n *\n * @namespace Blockly.ContextMenu\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ContextMenu');\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as clipboard from './clipboard.js';\nimport {config} from './config.js';\nimport * as dom from './utils/dom.js';\nimport type {ContextMenuOption, LegacyContextMenuOption} from './contextmenu_registry.js';\nimport * as eventUtils from './events/utils.js';\nimport {Menu} from './menu.js';\nimport {MenuItem} from './menuitem.js';\nimport {Msg} from './msg.js';\nimport * as aria from './utils/aria.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport {Rect} from './utils/rect.js';\nimport * as svgMath from './utils/svg_math.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport {WorkspaceCommentSvg} from './workspace_comment_svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\n\n\n/**\n * Which block is the context menu attached to?\n */\nlet currentBlock: Block|null = null;\n\nconst dummyOwner = {};\n\n/**\n * Gets the block the context menu is currently attached to.\n *\n * @returns The block the context menu is attached to.\n * @alias Blockly.ContextMenu.getCurrentBlock\n */\nexport function getCurrentBlock(): Block|null {\n return currentBlock;\n}\n\n/**\n * Sets the block the context menu is currently attached to.\n *\n * @param block The block the context menu is attached to.\n * @alias Blockly.ContextMenu.setCurrentBlock\n */\nexport function setCurrentBlock(block: Block|null) {\n currentBlock = block;\n}\n\n/**\n * Menu object.\n */\nlet menu_: Menu|null = null;\n\n/**\n * Construct the menu based on the list of options and show the menu.\n *\n * @param e Mouse event.\n * @param options Array of menu options.\n * @param rtl True if RTL, false if LTR.\n * @alias Blockly.ContextMenu.show\n */\nexport function show(\n e: Event, options: (ContextMenuOption|LegacyContextMenuOption)[],\n rtl: boolean) {\n WidgetDiv.show(dummyOwner, rtl, dispose);\n if (!options.length) {\n hide();\n return;\n }\n const menu = populate_(options, rtl);\n menu_ = menu;\n\n position_(menu, e, rtl);\n // 1ms delay is required for focusing on context menus because some other\n // mouse event is still waiting in the queue and clears focus.\n setTimeout(function() {\n menu.focus();\n }, 1);\n currentBlock = null; // May be set by Blockly.Block.\n}\n\n/**\n * Create the context menu object and populate it with the given options.\n *\n * @param options Array of menu options.\n * @param rtl True if RTL, false if LTR.\n * @returns The menu that will be shown on right click.\n */\nfunction populate_(\n options: (ContextMenuOption|LegacyContextMenuOption)[],\n rtl: boolean): Menu {\n /* Here's what one option object looks like:\n {text: 'Make It So',\n enabled: true,\n callback: Blockly.MakeItSo}\n */\n const menu = new Menu();\n menu.setRole(aria.Role.MENU);\n for (let i = 0; i < options.length; i++) {\n const option = options[i];\n const menuItem = new MenuItem(option.text);\n menuItem.setRightToLeft(rtl);\n menuItem.setRole(aria.Role.MENUITEM);\n menu.addChild(menuItem);\n menuItem.setEnabled(option.enabled);\n if (option.enabled) {\n const actionHandler = function() {\n hide();\n // If .scope does not exist on the option, then the callback will not\n // be expecting a scope parameter, so there should be no problems. Just\n // assume it is a ContextMenuOption and we'll pass undefined if it's\n // not.\n option.callback((option as ContextMenuOption).scope);\n };\n menuItem.onAction(actionHandler, {});\n }\n }\n return menu;\n}\n\n/**\n * Add the menu to the page and position it correctly.\n *\n * @param menu The menu to add and position.\n * @param e Mouse event for the right click that is making the context\n * menu appear.\n * @param rtl True if RTL, false if LTR.\n */\nfunction position_(menu: Menu, e: Event, rtl: boolean) {\n // Record windowSize and scrollOffset before adding menu.\n const viewportBBox = svgMath.getViewportBBox();\n const mouseEvent = e as MouseEvent;\n // This one is just a point, but we'll pretend that it's a rect so we can use\n // some helper functions.\n const anchorBBox = new Rect(\n mouseEvent.clientY + viewportBBox.top,\n mouseEvent.clientY + viewportBBox.top,\n mouseEvent.clientX + viewportBBox.left,\n mouseEvent.clientX + viewportBBox.left);\n\n createWidget_(menu);\n const menuSize = menu.getSize();\n\n if (rtl) {\n anchorBBox.left += menuSize.width;\n anchorBBox.right += menuSize.width;\n viewportBBox.left += menuSize.width;\n viewportBBox.right += menuSize.width;\n }\n\n WidgetDiv.positionWithAnchor(viewportBBox, anchorBBox, menuSize, rtl);\n // Calling menuDom.focus() has to wait until after the menu has been placed\n // correctly. Otherwise it will cause a page scroll to get the misplaced menu\n // in view. See issue #1329.\n menu.focus();\n}\n\n/**\n * Create and render the menu widget inside Blockly's widget div.\n *\n * @param menu The menu to add to the widget div.\n */\nfunction createWidget_(menu: Menu) {\n const div = WidgetDiv.getDiv();\n if (!div) {\n throw Error('Attempting to create a context menu when widget div is null');\n }\n const menuDom = menu.render(div);\n dom.addClass(menuDom, 'blocklyContextMenu');\n // Prevent system context menu when right-clicking a Blockly context menu.\n browserEvents.conditionalBind(\n (menuDom as EventTarget), 'contextmenu', null, haltPropagation);\n // Focus only after the initial render to avoid issue #1329.\n menu.focus();\n}\n/**\n * Halts the propagation of the event without doing anything else.\n *\n * @param e An event.\n */\nfunction haltPropagation(e: Event) {\n // This event has been handled. No need to bubble up to the document.\n e.preventDefault();\n e.stopPropagation();\n}\n\n/**\n * Hide the context menu.\n *\n * @alias Blockly.ContextMenu.hide\n */\nexport function hide() {\n WidgetDiv.hideIfOwner(dummyOwner);\n currentBlock = null;\n}\n\n/**\n * Dispose of the menu.\n *\n * @alias Blockly.ContextMenu.dispose\n */\nexport function dispose() {\n if (menu_) {\n menu_.dispose();\n menu_ = null;\n }\n}\n\n/**\n * Create a callback function that creates and configures a block,\n * then places the new block next to the original.\n *\n * @param block Original block.\n * @param xml XML representation of new block.\n * @returns Function that creates a block.\n * @alias Blockly.ContextMenu.callbackFactory\n */\nexport function callbackFactory(block: Block, xml: Element): Function {\n return () => {\n eventUtils.disable();\n let newBlock;\n try {\n newBlock = Xml.domToBlock(xml, block.workspace!) as BlockSvg;\n // Move the new block next to the old block.\n const xy = block.getRelativeToSurfaceXY();\n if (block.RTL) {\n xy.x -= config.snapRadius;\n } else {\n xy.x += config.snapRadius;\n }\n xy.y += config.snapRadius * 2;\n newBlock.moveBy(xy.x, xy.y);\n } finally {\n eventUtils.enable();\n }\n if (eventUtils.isEnabled() && !newBlock.isShadow()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CREATE))(newBlock));\n }\n newBlock.select();\n };\n}\n\n// Helper functions for creating context menu options.\n\n/**\n * Make a context menu option for deleting the current workspace comment.\n *\n * @param comment The workspace comment where the\n * right-click originated.\n * @returns A menu option,\n * containing text, enabled, and a callback.\n * @alias Blockly.ContextMenu.commentDeleteOption\n * @internal\n */\nexport function commentDeleteOption(comment: WorkspaceCommentSvg):\n LegacyContextMenuOption {\n const deleteOption = {\n text: Msg['REMOVE_COMMENT'],\n enabled: true,\n callback: function() {\n eventUtils.setGroup(true);\n comment.dispose();\n eventUtils.setGroup(false);\n },\n };\n return deleteOption;\n}\n\n/**\n * Make a context menu option for duplicating the current workspace comment.\n *\n * @param comment The workspace comment where the\n * right-click originated.\n * @returns A menu option,\n * containing text, enabled, and a callback.\n * @alias Blockly.ContextMenu.commentDuplicateOption\n * @internal\n */\nexport function commentDuplicateOption(comment: WorkspaceCommentSvg):\n LegacyContextMenuOption {\n const duplicateOption = {\n text: Msg['DUPLICATE_COMMENT'],\n enabled: true,\n callback: function() {\n clipboard.duplicate(comment);\n },\n };\n return duplicateOption;\n}\n\n/**\n * Make a context menu option for adding a comment on the workspace.\n *\n * @param ws The workspace where the right-click\n * originated.\n * @param e The right-click mouse event.\n * @returns A menu option, containing text, enabled, and a callback.\n * @suppress {strictModuleDepCheck,checkTypes} Suppress checks while workspace\n * comments are not bundled in.\n * @alias Blockly.ContextMenu.workspaceCommentOption\n * @internal\n */\nexport function workspaceCommentOption(\n ws: WorkspaceSvg, e: Event): ContextMenuOption {\n /**\n * Helper function to create and position a comment correctly based on the\n * location of the mouse event.\n */\n function addWsComment() {\n const comment = new WorkspaceCommentSvg(\n ws, Msg['WORKSPACE_COMMENT_DEFAULT_TEXT'],\n WorkspaceCommentSvg.DEFAULT_SIZE, WorkspaceCommentSvg.DEFAULT_SIZE);\n\n const injectionDiv = ws.getInjectionDiv();\n // Bounding rect coordinates are in client coordinates, meaning that they\n // are in pixels relative to the upper left corner of the visible browser\n // window. These coordinates change when you scroll the browser window.\n const boundingRect = injectionDiv.getBoundingClientRect();\n\n // The client coordinates offset by the injection div's upper left corner.\n const mouseEvent = e as MouseEvent;\n const clientOffsetPixels = new Coordinate(\n mouseEvent.clientX - boundingRect.left,\n mouseEvent.clientY - boundingRect.top);\n\n // The offset in pixels between the main workspace's origin and the upper\n // left corner of the injection div.\n const mainOffsetPixels = ws.getOriginOffsetInPixels();\n\n // The position of the new comment in pixels relative to the origin of the\n // main workspace.\n const finalOffset =\n Coordinate.difference(clientOffsetPixels, mainOffsetPixels);\n // The position of the new comment in main workspace coordinates.\n finalOffset.scale(1 / ws.scale);\n\n const commentX = finalOffset.x;\n const commentY = finalOffset.y;\n comment.moveBy(commentX, commentY);\n if (ws.rendered) {\n comment.initSvg();\n comment.render();\n comment.select();\n }\n }\n\n const wsCommentOption = {\n enabled: true,\n } as ContextMenuOption;\n wsCommentOption.text = Msg['ADD_COMMENT'];\n wsCommentOption.callback = function() {\n addWsComment();\n };\n return wsCommentOption;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility functions for positioning UI elements.\n *\n * @namespace Blockly.uiPosition\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.uiPosition');\n\nimport type {UiMetrics} from './metrics_manager.js';\nimport {Scrollbar} from './scrollbar.js';\nimport {Rect} from './utils/rect.js';\nimport type {Size} from './utils/size.js';\nimport * as toolbox from './utils/toolbox.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Enum for vertical positioning.\n *\n * @alias Blockly.uiPosition.verticalPosition\n * @internal\n */\nexport enum verticalPosition {\n TOP,\n BOTTOM\n}\n\n/**\n * Enum for horizontal positioning.\n *\n * @alias Blockly.uiPosition.horizontalPosition\n * @internal\n */\nexport enum horizontalPosition {\n LEFT,\n RIGHT\n}\n\n/**\n * An object defining a horizontal and vertical positioning.\n *\n * @alias Blockly.uiPosition.Position\n * @internal\n */\nexport interface Position {\n horizontal: horizontalPosition;\n vertical: verticalPosition;\n}\n\n/**\n * Enum for bump rules to use for dealing with collisions.\n *\n * @alias Blockly.uiPosition.bumpDirection\n * @internal\n */\nexport enum bumpDirection {\n UP,\n DOWN\n}\n\n/**\n * Returns a rectangle representing reasonable position for where to place a UI\n * element of the specified size given the restraints and locations of the\n * scrollbars. This method does not take into account any already placed UI\n * elements.\n *\n * @param position The starting horizontal and vertical position.\n * @param size the size of the UI element to get a start position for.\n * @param horizontalPadding The horizontal padding to use.\n * @param verticalPadding The vertical padding to use.\n * @param metrics The workspace UI metrics.\n * @param workspace The workspace.\n * @returns The suggested start position.\n * @alias Blockly.uiPosition.getStartPositionRect\n * @internal\n */\nexport function getStartPositionRect(\n position: Position, size: Size, horizontalPadding: number,\n verticalPadding: number, metrics: UiMetrics,\n workspace: WorkspaceSvg): Rect {\n // Horizontal positioning.\n let left = 0;\n const hasVerticalScrollbar =\n workspace.scrollbar && workspace.scrollbar.canScrollVertically();\n if (position.horizontal === horizontalPosition.LEFT) {\n left = metrics.absoluteMetrics.left + horizontalPadding;\n if (hasVerticalScrollbar && workspace.RTL) {\n left += Scrollbar.scrollbarThickness;\n }\n } else { // position.horizontal === horizontalPosition.RIGHT\n left = metrics.absoluteMetrics.left + metrics.viewMetrics.width -\n size.width - horizontalPadding;\n if (hasVerticalScrollbar && !workspace.RTL) {\n left -= Scrollbar.scrollbarThickness;\n }\n }\n // Vertical positioning.\n let top = 0;\n if (position.vertical === verticalPosition.TOP) {\n top = metrics.absoluteMetrics.top + verticalPadding;\n } else { // position.vertical === verticalPosition.BOTTOM\n top = metrics.absoluteMetrics.top + metrics.viewMetrics.height -\n size.height - verticalPadding;\n if (workspace.scrollbar && workspace.scrollbar.canScrollHorizontally()) {\n // The scrollbars are always positioned on the bottom if they exist.\n top -= Scrollbar.scrollbarThickness;\n }\n }\n return new Rect(top, top + size.height, left, left + size.width);\n}\n\n/**\n * Returns a corner position that is on the opposite side of the workspace from\n * the toolbox.\n * If in horizontal orientation, defaults to the bottom corner. If in vertical\n * orientation, defaults to the right corner.\n *\n * @param workspace The workspace.\n * @param metrics The workspace metrics.\n * @returns The suggested corner position.\n * @alias Blockly.uiPosition.getCornerOppositeToolbox\n * @internal\n */\nexport function getCornerOppositeToolbox(\n workspace: WorkspaceSvg, metrics: UiMetrics): Position {\n const leftCorner =\n metrics.toolboxMetrics.position !== toolbox.Position.LEFT &&\n (!workspace.horizontalLayout || workspace.RTL);\n const topCorner = metrics.toolboxMetrics.position === toolbox.Position.BOTTOM;\n const hPosition =\n leftCorner ? horizontalPosition.LEFT : horizontalPosition.RIGHT;\n const vPosition = topCorner ? verticalPosition.TOP : verticalPosition.BOTTOM;\n return {horizontal: hPosition, vertical: vPosition};\n}\n\n/**\n * Returns a position Rect based on a starting position that is bumped\n * so that it doesn't intersect with any of the provided savedPositions. This\n * method does not check that the bumped position is still within bounds.\n *\n * @param startRect The starting position to use.\n * @param margin The margin to use between elements when bumping.\n * @param bumpDir The direction to bump if there is a collision with an existing\n * UI element.\n * @param savedPositions List of rectangles that represent the positions of UI\n * elements already placed.\n * @returns The suggested position rectangle.\n * @alias Blockly.uiPosition.bumpPositionRect\n * @internal\n */\nexport function bumpPositionRect(\n startRect: Rect, margin: number, bumpDir: bumpDirection,\n savedPositions: Rect[]): Rect {\n let top = startRect.top;\n const left = startRect.left;\n const width = startRect.right - startRect.left;\n const height = startRect.bottom - startRect.top;\n\n // Check for collision and bump if needed.\n let boundingRect = startRect;\n for (let i = 0; i < savedPositions.length; i++) {\n const otherEl = savedPositions[i];\n if (boundingRect.intersects(otherEl)) {\n if (bumpDir === bumpDirection.UP) {\n top = otherEl.top - height - margin;\n } else { // bumpDir === bumpDirection.DOWN\n top = otherEl.bottom + margin;\n }\n // Recheck other savedPositions\n boundingRect = new Rect(top, top + height, left, left + width);\n i = -1;\n }\n }\n return boundingRect;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Registers default keyboard shortcuts.\n *\n * @namespace Blockly.ShortcutItems\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ShortcutItems');\n\nimport {BlockSvg} from './block_svg.js';\nimport * as clipboard from './clipboard.js';\nimport * as common from './common.js';\nimport {Gesture} from './gesture.js';\nimport type {ICopyable} from './interfaces/i_copyable.js';\nimport {KeyboardShortcut, ShortcutRegistry} from './shortcut_registry.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Object holding the names of the default shortcut items.\n *\n * @alias Blockly.ShortcutItems.names\n */\nexport enum names {\n ESCAPE = 'escape',\n DELETE = 'delete',\n COPY = 'copy',\n CUT = 'cut',\n PASTE = 'paste',\n UNDO = 'undo',\n REDO = 'redo'\n}\n\n/**\n * Keyboard shortcut to hide chaff on escape.\n *\n * @alias Blockly.ShortcutItems.registerEscape\n */\nexport function registerEscape() {\n const escapeAction: KeyboardShortcut = {\n name: names.ESCAPE,\n preconditionFn(workspace) {\n return !workspace.options.readOnly;\n },\n callback(workspace) {\n // AnyDuringMigration because: Property 'hideChaff' does not exist on\n // type 'Workspace'.\n (workspace as AnyDuringMigration).hideChaff();\n return true;\n },\n keyCodes: [KeyCodes.ESC],\n };\n ShortcutRegistry.registry.register(escapeAction);\n}\n\n/**\n * Keyboard shortcut to delete a block on delete or backspace\n *\n * @alias Blockly.ShortcutItems.registerDelete\n */\nexport function registerDelete() {\n const deleteShortcut: KeyboardShortcut = {\n name: names.DELETE,\n preconditionFn(workspace) {\n const selected = common.getSelected();\n return !workspace.options.readOnly && selected != null &&\n selected.isDeletable();\n },\n callback(workspace, e) {\n // Delete or backspace.\n // Stop the browser from going back to the previous page.\n // Do this first to prevent an error in the delete code from resulting in\n // data loss.\n e.preventDefault();\n // Don't delete while dragging. Jeez.\n if (Gesture.inProgress()) {\n return false;\n }\n (common.getSelected() as BlockSvg).checkAndDelete();\n return true;\n },\n keyCodes: [KeyCodes.DELETE, KeyCodes.BACKSPACE],\n };\n ShortcutRegistry.registry.register(deleteShortcut);\n}\n\n/**\n * Keyboard shortcut to copy a block on ctrl+c, cmd+c, or alt+c.\n *\n * @alias Blockly.ShortcutItems.registerCopy\n */\nexport function registerCopy() {\n const ctrlC = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.C, [KeyCodes.CTRL]);\n const altC =\n ShortcutRegistry.registry.createSerializedKey(KeyCodes.C, [KeyCodes.ALT]);\n const metaC = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.C, [KeyCodes.META]);\n\n const copyShortcut: KeyboardShortcut = {\n name: names.COPY,\n preconditionFn(workspace) {\n const selected = common.getSelected();\n return !workspace.options.readOnly && !Gesture.inProgress() &&\n selected != null && selected.isDeletable() && selected.isMovable();\n },\n callback(workspace, e) {\n // Prevent the default copy behavior, which may beep or otherwise indicate\n // an error due to the lack of a selection.\n e.preventDefault();\n // AnyDuringMigration because: Property 'hideChaff' does not exist on\n // type 'Workspace'.\n (workspace as AnyDuringMigration).hideChaff();\n clipboard.copy(common.getSelected() as ICopyable);\n return true;\n },\n keyCodes: [ctrlC, altC, metaC],\n };\n ShortcutRegistry.registry.register(copyShortcut);\n}\n\n/**\n * Keyboard shortcut to copy and delete a block on ctrl+x, cmd+x, or alt+x.\n *\n * @alias Blockly.ShortcutItems.registerCut\n */\nexport function registerCut() {\n const ctrlX = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.X, [KeyCodes.CTRL]);\n const altX =\n ShortcutRegistry.registry.createSerializedKey(KeyCodes.X, [KeyCodes.ALT]);\n const metaX = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.X, [KeyCodes.META]);\n\n const cutShortcut: KeyboardShortcut = {\n name: names.CUT,\n preconditionFn(workspace) {\n const selected = common.getSelected();\n return !workspace.options.readOnly && !Gesture.inProgress() &&\n selected != null && selected instanceof BlockSvg &&\n selected.isDeletable() && selected.isMovable() &&\n !selected.workspace!.isFlyout;\n },\n callback() {\n const selected = common.getSelected();\n if (!selected) {\n // Shouldn't happen but appeases the type system\n return false;\n }\n clipboard.copy(selected);\n (selected as BlockSvg).checkAndDelete();\n return true;\n },\n keyCodes: [ctrlX, altX, metaX],\n };\n\n ShortcutRegistry.registry.register(cutShortcut);\n}\n\n/**\n * Keyboard shortcut to paste a block on ctrl+v, cmd+v, or alt+v.\n *\n * @alias Blockly.ShortcutItems.registerPaste\n */\nexport function registerPaste() {\n const ctrlV = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.V, [KeyCodes.CTRL]);\n const altV =\n ShortcutRegistry.registry.createSerializedKey(KeyCodes.V, [KeyCodes.ALT]);\n const metaV = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.V, [KeyCodes.META]);\n\n const pasteShortcut: KeyboardShortcut = {\n name: names.PASTE,\n preconditionFn(workspace) {\n return !workspace.options.readOnly && !Gesture.inProgress();\n },\n callback() {\n return !!(clipboard.paste());\n },\n keyCodes: [ctrlV, altV, metaV],\n };\n\n ShortcutRegistry.registry.register(pasteShortcut);\n}\n\n/**\n * Keyboard shortcut to undo the previous action on ctrl+z, cmd+z, or alt+z.\n *\n * @alias Blockly.ShortcutItems.registerUndo\n */\nexport function registerUndo() {\n const ctrlZ = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.Z, [KeyCodes.CTRL]);\n const altZ =\n ShortcutRegistry.registry.createSerializedKey(KeyCodes.Z, [KeyCodes.ALT]);\n const metaZ = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.Z, [KeyCodes.META]);\n\n const undoShortcut: KeyboardShortcut = {\n name: names.UNDO,\n preconditionFn(workspace) {\n return !workspace.options.readOnly && !Gesture.inProgress();\n },\n callback(workspace) {\n // 'z' for undo 'Z' is for redo.\n (workspace as WorkspaceSvg).hideChaff();\n workspace.undo(false);\n return true;\n },\n keyCodes: [ctrlZ, altZ, metaZ],\n };\n ShortcutRegistry.registry.register(undoShortcut);\n}\n\n/**\n * Keyboard shortcut to redo the previous action on ctrl+shift+z, cmd+shift+z,\n * or alt+shift+z.\n *\n * @alias Blockly.ShortcutItems.registerRedo\n */\nexport function registerRedo() {\n const ctrlShiftZ = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.Z, [KeyCodes.SHIFT, KeyCodes.CTRL]);\n const altShiftZ = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.Z, [KeyCodes.SHIFT, KeyCodes.ALT]);\n const metaShiftZ = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.Z, [KeyCodes.SHIFT, KeyCodes.META]);\n // Ctrl-y is redo in Windows. Command-y is never valid on Macs.\n const ctrlY = ShortcutRegistry.registry.createSerializedKey(\n KeyCodes.Y, [KeyCodes.CTRL]);\n\n const redoShortcut: KeyboardShortcut = {\n name: names.REDO,\n preconditionFn(workspace) {\n return !Gesture.inProgress() && !workspace.options.readOnly;\n },\n callback(workspace) {\n // 'z' for undo 'Z' is for redo.\n (workspace as WorkspaceSvg).hideChaff();\n workspace.undo(true);\n return true;\n },\n keyCodes: [ctrlShiftZ, altShiftZ, metaShiftZ, ctrlY],\n };\n ShortcutRegistry.registry.register(redoShortcut);\n}\n\n/**\n * Registers all default keyboard shortcut item. This should be called once per\n * instance of KeyboardShortcutRegistry.\n *\n * @alias Blockly.ShortcutItems.registerDefaultShortcuts\n * @internal\n */\nexport function registerDefaultShortcuts() {\n registerEscape();\n registerDelete();\n registerCopy();\n registerCut();\n registerPaste();\n registerUndo();\n registerRedo();\n}\n\nregisterDefaultShortcuts();\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility functions for handling procedures.\n *\n * @namespace Blockly.Procedures\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Procedures');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport {Blocks} from './blocks.js';\nimport * as common from './common.js';\nimport type {Abstract} from './events/events_abstract.js';\nimport type {BubbleOpen} from './events/events_bubble_open.js';\nimport * as eventUtils from './events/utils.js';\nimport {Field, UnattachedFieldError} from './field.js';\nimport {Msg} from './msg.js';\nimport {Names} from './names.js';\nimport * as utilsXml from './utils/xml.js';\nimport * as Variables from './variables.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\n\n\n/**\n * String for use in the \"custom\" attribute of a category in toolbox XML.\n * This string indicates that the category should be dynamically populated with\n * procedure blocks.\n * See also Blockly.Variables.CATEGORY_NAME and\n * Blockly.VariablesDynamic.CATEGORY_NAME.\n *\n * @alias Blockly.Procedures.CATEGORY_NAME\n */\nexport const CATEGORY_NAME = 'PROCEDURE';\n\n/**\n * The default argument for a procedures_mutatorarg block.\n *\n * @alias Blockly.Procedures.DEFAULT_ARG\n */\nexport const DEFAULT_ARG = 'x';\n\nexport type ProcedureTuple = [string, string[], boolean];\n\n/**\n * Procedure block type.\n *\n * @alias Blockly.Procedures.ProcedureBlock\n */\nexport interface ProcedureBlock {\n getProcedureCall: () => string;\n renameProcedure: (p1: string, p2: string) => void;\n getProcedureDef: () => ProcedureTuple;\n}\n\n/**\n * Find all user-created procedure definitions in a workspace.\n *\n * @param root Root workspace.\n * @returns Pair of arrays, the first contains procedures without return\n * variables, the second with. Each procedure is defined by a three-element\n * list of name, parameter list, and return value boolean.\n * @alias Blockly.Procedures.allProcedures\n */\nexport function allProcedures(root: Workspace):\n [ProcedureTuple[], ProcedureTuple[]] {\n const proceduresNoReturn =\n root.getBlocksByType('procedures_defnoreturn', false)\n .map(function(block) {\n return (block as unknown as ProcedureBlock).getProcedureDef();\n });\n const proceduresReturn =\n root.getBlocksByType('procedures_defreturn', false).map(function(block) {\n return (block as unknown as ProcedureBlock).getProcedureDef();\n });\n proceduresNoReturn.sort(procTupleComparator);\n proceduresReturn.sort(procTupleComparator);\n return [proceduresNoReturn, proceduresReturn];\n}\n\n/**\n * Comparison function for case-insensitive sorting of the first element of\n * a tuple.\n *\n * @param ta First tuple.\n * @param tb Second tuple.\n * @returns -1, 0, or 1 to signify greater than, equality, or less than.\n */\nfunction procTupleComparator(ta: ProcedureTuple, tb: ProcedureTuple): number {\n return ta[0].localeCompare(tb[0], undefined, {sensitivity: 'base'});\n}\n\n/**\n * Ensure two identically-named procedures don't exist.\n * Take the proposed procedure name, and return a legal name i.e. one that\n * is not empty and doesn't collide with other procedures.\n *\n * @param name Proposed procedure name.\n * @param block Block to disambiguate.\n * @returns Non-colliding name.\n * @alias Blockly.Procedures.findLegalName\n */\nexport function findLegalName(name: string, block: Block): string {\n if (block.isInFlyout) {\n // Flyouts can have multiple procedures called 'do something'.\n return name;\n }\n name = name || Msg['UNNAMED_KEY'] || 'unnamed';\n while (!isLegalName(name, block.workspace, block)) {\n // Collision with another procedure.\n const r = name.match(/^(.*?)(\\d+)$/);\n if (!r) {\n name += '2';\n } else {\n name = r[1] + (parseInt(r[2]) + 1);\n }\n }\n return name;\n}\n/**\n * Does this procedure have a legal name? Illegal names include names of\n * procedures already defined.\n *\n * @param name The questionable name.\n * @param workspace The workspace to scan for collisions.\n * @param opt_exclude Optional block to exclude from comparisons (one doesn't\n * want to collide with oneself).\n * @returns True if the name is legal.\n */\nfunction isLegalName(\n name: string, workspace: Workspace, opt_exclude?: Block): boolean {\n return !isNameUsed(name, workspace, opt_exclude);\n}\n\n/**\n * Return if the given name is already a procedure name.\n *\n * @param name The questionable name.\n * @param workspace The workspace to scan for collisions.\n * @param opt_exclude Optional block to exclude from comparisons (one doesn't\n * want to collide with oneself).\n * @returns True if the name is used, otherwise return false.\n * @alias Blockly.Procedures.isNameUsed\n */\nexport function isNameUsed(\n name: string, workspace: Workspace, opt_exclude?: Block): boolean {\n const blocks = workspace.getAllBlocks(false);\n // Iterate through every block and check the name.\n for (let i = 0; i < blocks.length; i++) {\n if (blocks[i] === opt_exclude) {\n continue;\n }\n // Assume it is a procedure block so we can check.\n const procedureBlock = blocks[i] as unknown as ProcedureBlock;\n if (procedureBlock.getProcedureDef) {\n const procName = procedureBlock.getProcedureDef();\n if (Names.equals(procName[0], name)) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Rename a procedure. Called by the editable field.\n *\n * @param name The proposed new name.\n * @returns The accepted name.\n * @alias Blockly.Procedures.rename\n */\nexport function rename(this: Field, name: string): string {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n\n // Strip leading and trailing whitespace. Beyond this, all names are legal.\n name = name.trim();\n\n const legalName = findLegalName(name, block);\n const oldName = this.getValue();\n if (oldName !== name && oldName !== legalName) {\n // Rename any callers.\n const blocks = block.workspace.getAllBlocks(false);\n for (let i = 0; i < blocks.length; i++) {\n // Assume it is a procedure so we can check.\n const procedureBlock = blocks[i] as unknown as ProcedureBlock;\n if (procedureBlock.renameProcedure) {\n procedureBlock.renameProcedure(oldName as string, legalName);\n }\n }\n }\n return legalName;\n}\n\n/**\n * Construct the blocks required by the flyout for the procedure category.\n *\n * @param workspace The workspace containing procedures.\n * @returns Array of XML block elements.\n * @alias Blockly.Procedures.flyoutCategory\n */\nexport function flyoutCategory(workspace: WorkspaceSvg): Element[] {\n const xmlList = [];\n if (Blocks['procedures_defnoreturn']) {\n // <block type=\"procedures_defnoreturn\" gap=\"16\">\n // <field name=\"NAME\">do something</field>\n // </block>\n const block = utilsXml.createElement('block');\n block.setAttribute('type', 'procedures_defnoreturn');\n block.setAttribute('gap', '16');\n const nameField = utilsXml.createElement('field');\n nameField.setAttribute('name', 'NAME');\n nameField.appendChild(\n utilsXml.createTextNode(Msg['PROCEDURES_DEFNORETURN_PROCEDURE']));\n block.appendChild(nameField);\n xmlList.push(block);\n }\n if (Blocks['procedures_defreturn']) {\n // <block type=\"procedures_defreturn\" gap=\"16\">\n // <field name=\"NAME\">do something</field>\n // </block>\n const block = utilsXml.createElement('block');\n block.setAttribute('type', 'procedures_defreturn');\n block.setAttribute('gap', '16');\n const nameField = utilsXml.createElement('field');\n nameField.setAttribute('name', 'NAME');\n nameField.appendChild(\n utilsXml.createTextNode(Msg['PROCEDURES_DEFRETURN_PROCEDURE']));\n block.appendChild(nameField);\n xmlList.push(block);\n }\n if (Blocks['procedures_ifreturn']) {\n // <block type=\"procedures_ifreturn\" gap=\"16\"></block>\n const block = utilsXml.createElement('block');\n block.setAttribute('type', 'procedures_ifreturn');\n block.setAttribute('gap', '16');\n xmlList.push(block);\n }\n if (xmlList.length) {\n // Add slightly larger gap between system blocks and user calls.\n xmlList[xmlList.length - 1].setAttribute('gap', '24');\n }\n\n /**\n * Add items to xmlList for each listed procedure.\n *\n * @param procedureList A list of procedures, each of which is defined by a\n * three-element list of name, parameter list, and return value boolean.\n * @param templateName The type of the block to generate.\n */\n function populateProcedures(\n procedureList: ProcedureTuple[], templateName: string) {\n for (let i = 0; i < procedureList.length; i++) {\n const name = procedureList[i][0];\n const args = procedureList[i][1];\n // <block type=\"procedures_callnoreturn\" gap=\"16\">\n // <mutation name=\"do something\">\n // <arg name=\"x\"></arg>\n // </mutation>\n // </block>\n const block = utilsXml.createElement('block');\n block.setAttribute('type', templateName);\n block.setAttribute('gap', '16');\n const mutation = utilsXml.createElement('mutation');\n mutation.setAttribute('name', name);\n block.appendChild(mutation);\n for (let j = 0; j < args.length; j++) {\n const arg = utilsXml.createElement('arg');\n arg.setAttribute('name', args[j]);\n mutation.appendChild(arg);\n }\n xmlList.push(block);\n }\n }\n\n const tuple = allProcedures(workspace);\n populateProcedures(tuple[0], 'procedures_callnoreturn');\n populateProcedures(tuple[1], 'procedures_callreturn');\n return xmlList;\n}\n\n/**\n * Updates the procedure mutator's flyout so that the arg block is not a\n * duplicate of another arg.\n *\n * @param workspace The procedure mutator's workspace. This workspace's flyout\n * is what is being updated.\n */\nfunction updateMutatorFlyout(workspace: WorkspaceSvg) {\n const usedNames = [];\n const blocks = workspace.getBlocksByType('procedures_mutatorarg', false);\n for (let i = 0, block; block = blocks[i]; i++) {\n usedNames.push(block.getFieldValue('NAME'));\n }\n\n const xmlElement = utilsXml.createElement('xml');\n const argBlock = utilsXml.createElement('block');\n argBlock.setAttribute('type', 'procedures_mutatorarg');\n const nameField = utilsXml.createElement('field');\n nameField.setAttribute('name', 'NAME');\n const argValue =\n Variables.generateUniqueNameFromOptions(DEFAULT_ARG, usedNames);\n const fieldContent = utilsXml.createTextNode(argValue);\n\n nameField.appendChild(fieldContent);\n argBlock.appendChild(nameField);\n xmlElement.appendChild(argBlock);\n\n workspace.updateToolbox(xmlElement);\n}\n\n/**\n * Listens for when a procedure mutator is opened. Then it triggers a flyout\n * update and adds a mutator change listener to the mutator workspace.\n *\n * @param e The event that triggered this listener.\n * @alias Blockly.Procedures.mutatorOpenListener\n * @internal\n */\nexport function mutatorOpenListener(e: Abstract) {\n if (e.type !== eventUtils.BUBBLE_OPEN) {\n return;\n }\n const bubbleEvent = e as BubbleOpen;\n if (!(bubbleEvent.bubbleType === 'mutator' && bubbleEvent.isOpen) ||\n !bubbleEvent.blockId) {\n return;\n }\n const workspaceId = (bubbleEvent.workspaceId);\n const block = common.getWorkspaceById(workspaceId)!.getBlockById(\n bubbleEvent.blockId) as BlockSvg;\n const type = block.type;\n if (type !== 'procedures_defnoreturn' && type !== 'procedures_defreturn') {\n return;\n }\n const workspace = block.mutator!.getWorkspace() as WorkspaceSvg;\n updateMutatorFlyout(workspace);\n workspace.addChangeListener(mutatorChangeListener);\n}\n/**\n * Listens for changes in a procedure mutator and triggers flyout updates when\n * necessary.\n *\n * @param e The event that triggered this listener.\n */\nfunction mutatorChangeListener(e: Abstract) {\n if (e.type !== eventUtils.BLOCK_CREATE &&\n e.type !== eventUtils.BLOCK_DELETE &&\n e.type !== eventUtils.BLOCK_CHANGE) {\n return;\n }\n const workspaceId = e.workspaceId as string;\n const workspace = common.getWorkspaceById(workspaceId) as WorkspaceSvg;\n updateMutatorFlyout(workspace);\n}\n\n/**\n * Find all the callers of a named procedure.\n *\n * @param name Name of procedure.\n * @param workspace The workspace to find callers in.\n * @returns Array of caller blocks.\n * @alias Blockly.Procedures.getCallers\n */\nexport function getCallers(name: string, workspace: Workspace): Block[] {\n const callers = [];\n const blocks = workspace.getAllBlocks(false);\n // Iterate through every block and check the name.\n for (let i = 0; i < blocks.length; i++) {\n // Assume it is a procedure block so we can check.\n const procedureBlock = blocks[i] as unknown as ProcedureBlock;\n if (procedureBlock.getProcedureCall) {\n const procName = procedureBlock.getProcedureCall();\n // Procedure name may be null if the block is only half-built.\n if (procName && Names.equals(procName, name)) {\n callers.push(blocks[i]);\n }\n }\n }\n return callers;\n}\n\n/**\n * When a procedure definition changes its parameters, find and edit all its\n * callers.\n *\n * @param defBlock Procedure definition block.\n * @alias Blockly.Procedures.mutateCallers\n */\nexport function mutateCallers(defBlock: Block) {\n const oldRecordUndo = eventUtils.getRecordUndo();\n const procedureBlock = defBlock as unknown as ProcedureBlock;\n const name = procedureBlock.getProcedureDef()[0];\n const xmlElement = defBlock.mutationToDom!(true);\n const callers = getCallers(name, defBlock.workspace);\n for (let i = 0, caller; caller = callers[i]; i++) {\n const oldMutationDom = caller.mutationToDom!();\n const oldMutation = oldMutationDom && Xml.domToText(oldMutationDom);\n if (caller.domToMutation) {\n caller.domToMutation(xmlElement);\n }\n const newMutationDom = caller.mutationToDom!();\n const newMutation = newMutationDom && Xml.domToText(newMutationDom);\n if (oldMutation !== newMutation) {\n // Fire a mutation on every caller block. But don't record this as an\n // undo action since it is deterministically tied to the procedure's\n // definition mutation.\n eventUtils.setRecordUndo(false);\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n caller, 'mutation', null, oldMutation, newMutation));\n eventUtils.setRecordUndo(oldRecordUndo);\n }\n }\n}\n\n/**\n * Find the definition block for the named procedure.\n *\n * @param name Name of procedure.\n * @param workspace The workspace to search.\n * @returns The procedure definition block, or null not found.\n * @alias Blockly.Procedures.getDefinition\n */\nexport function getDefinition(name: string, workspace: Workspace): Block|null {\n // Do not assume procedure is a top block. Some languages allow nested\n // procedures. Also do not assume it is one of the built-in blocks. Only\n // rely on getProcedureDef.\n const blocks = workspace.getAllBlocks(false);\n for (let i = 0; i < blocks.length; i++) {\n // Assume it is a procedure block so we can check.\n const procedureBlock = blocks[i] as unknown as ProcedureBlock;\n if (procedureBlock.getProcedureDef) {\n const tuple = procedureBlock.getProcedureDef();\n if (tuple && Names.equals(tuple[0], name)) {\n return blocks[i]; // Can't use procedureBlock var due to type check.\n }\n }\n }\n return null;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that provides constants for rendering blocks.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.ConstantProvider');\n\nimport {ConnectionType} from '../../connection_type.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {BlockStyle, Theme} from '../../theme.js';\nimport * as colour from '../../utils/colour.js';\nimport * as dom from '../../utils/dom.js';\nimport * as parsing from '../../utils/parsing.js';\nimport {Svg} from '../../utils/svg.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\n\n\n/** An object containing sizing and path information about outside corners. */\nexport interface OutsideCorners {\n topLeft: string;\n topRight: string;\n bottomRight: string;\n bottomLeft: string;\n rightHeight: number;\n}\n\n/** An object containing sizing and path information about inside corners. */\nexport interface InsideCorners {\n width: number;\n height: number;\n pathTop: string;\n pathBottom: string;\n}\n\n/** An object containing sizing and path information about a start hat. */\nexport interface StartHat {\n height: number;\n width: number;\n path: string;\n}\n\n/** An object containing sizing and path information about a notch. */\nexport interface Notch {\n type: number;\n width: number;\n height: number;\n pathLeft: string;\n pathRight: string;\n}\n\n/** An object containing sizing and path information about a puzzle tab. */\nexport interface PuzzleTab {\n type: number;\n width: number;\n height: number;\n pathDown: string|((p1: number) => string);\n pathUp: string|((p1: number) => string);\n}\n\n/**\n * An object containing sizing and path information about collapsed block\n * indicators.\n */\nexport interface JaggedTeeth {\n height: number;\n width: number;\n path: string;\n}\n\nexport type BaseShape = {\n type: number; width: number; height: number;\n};\n\n/** An object containing sizing and type information about a dynamic shape. */\nexport type DynamicShape = {\n type: number; width: (p1: number) => number; height: (p1: number) => number;\n isDynamic: true;\n connectionOffsetY: (p1: number) => number;\n connectionOffsetX: (p1: number) => number;\n pathDown: (p1: number) => string;\n pathUp: (p1: number) => string;\n pathRightDown: (p1: number) => string;\n pathRightUp: (p1: number) => string;\n};\n\n/** An object containing sizing and type information about a shape. */\nexport type Shape = BaseShape|DynamicShape;\n\n/**\n * Returns whether the shape is dynamic or not.\n *\n * @param shape The shape to check for dynamic-ness.\n * @returns Whether the shape is a dynamic shape or not.\n */\nexport function isDynamicShape(shape: Shape): shape is DynamicShape {\n return (shape as DynamicShape).isDynamic;\n}\n\n/**\n * An object that provides constants for rendering blocks.\n *\n * @alias Blockly.blockRendering.ConstantProvider\n */\nexport class ConstantProvider {\n /** The size of an empty spacer. */\n NO_PADDING = 0;\n\n /** The size of small padding. */\n SMALL_PADDING = 3;\n\n /** The size of medium padding. */\n MEDIUM_PADDING = 5;\n\n /** The size of medium-large padding. */\n MEDIUM_LARGE_PADDING = 8;\n\n /** The size of large padding. */\n LARGE_PADDING = 10;\n TALL_INPUT_FIELD_OFFSET_Y: number;\n\n /** The height of the puzzle tab used for input and output connections. */\n TAB_HEIGHT = 15;\n\n /**\n * The offset from the top of the block at which a puzzle tab is positioned.\n */\n TAB_OFFSET_FROM_TOP = 5;\n\n /**\n * Vertical overlap of the puzzle tab, used to make it look more like a\n * puzzle piece.\n */\n TAB_VERTICAL_OVERLAP = 2.5;\n\n /** The width of the puzzle tab used for input and output connections. */\n TAB_WIDTH = 8;\n\n /** The width of the notch used for previous and next connections. */\n NOTCH_WIDTH = 15;\n\n /** The height of the notch used for previous and next connections. */\n NOTCH_HEIGHT = 4;\n\n /** The minimum width of the block. */\n MIN_BLOCK_WIDTH = 12;\n EMPTY_BLOCK_SPACER_HEIGHT = 16;\n DUMMY_INPUT_MIN_HEIGHT: number;\n DUMMY_INPUT_SHADOW_MIN_HEIGHT: number;\n\n /** Rounded corner radius. */\n CORNER_RADIUS = 8;\n\n /**\n * Offset from the left side of a block or the inside of a statement input\n * to the left side of the notch.\n */\n NOTCH_OFFSET_LEFT = 15;\n STATEMENT_INPUT_NOTCH_OFFSET: number;\n\n STATEMENT_BOTTOM_SPACER = 0;\n STATEMENT_INPUT_PADDING_LEFT = 20;\n\n /** Vertical padding between consecutive statement inputs. */\n BETWEEN_STATEMENT_PADDING_Y = 4;\n TOP_ROW_MIN_HEIGHT: number;\n TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT: number;\n BOTTOM_ROW_MIN_HEIGHT: number;\n BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT: number;\n\n /**\n * Whether to add a 'hat' on top of all blocks with no previous or output\n * connections. Can be overridden by 'hat' property on Theme.BlockStyle.\n */\n ADD_START_HATS = false;\n\n /** Height of the top hat. */\n START_HAT_HEIGHT = 15;\n\n /** Width of the top hat. */\n START_HAT_WIDTH = 100;\n\n SPACER_DEFAULT_HEIGHT = 15;\n\n MIN_BLOCK_HEIGHT = 24;\n\n EMPTY_INLINE_INPUT_PADDING = 14.5;\n EMPTY_INLINE_INPUT_HEIGHT: number;\n\n EXTERNAL_VALUE_INPUT_PADDING = 2;\n EMPTY_STATEMENT_INPUT_HEIGHT: number;\n START_POINT: string;\n\n /** Height of SVG path for jagged teeth at the end of collapsed blocks. */\n JAGGED_TEETH_HEIGHT = 12;\n\n /** Width of SVG path for jagged teeth at the end of collapsed blocks. */\n JAGGED_TEETH_WIDTH = 6;\n\n /** Point size of text. */\n FIELD_TEXT_FONTSIZE = 11;\n\n /** Text font weight. */\n FIELD_TEXT_FONTWEIGHT = 'normal';\n\n /** Text font family. */\n FIELD_TEXT_FONTFAMILY = 'sans-serif';\n\n /**\n * Height of text. This constant is dynamically set in\n * `setFontConstants_` to be the height of the text based on the font\n * used.\n */\n FIELD_TEXT_HEIGHT = -1; // Dynamically set.\n\n /**\n * Text baseline. This constant is dynamically set in `setFontConstants_`\n * to be the baseline of the text based on the font used.\n */\n FIELD_TEXT_BASELINE = -1; // Dynamically set.\n\n /** A field's border rect corner radius. */\n FIELD_BORDER_RECT_RADIUS = 4;\n\n /** A field's border rect default height. */\n FIELD_BORDER_RECT_HEIGHT = 16;\n\n /** A field's border rect X padding. */\n FIELD_BORDER_RECT_X_PADDING = 5;\n\n /** A field's border rect Y padding. */\n FIELD_BORDER_RECT_Y_PADDING = 3;\n\n /**\n * The backing colour of a field's border rect.\n *\n * @internal\n */\n FIELD_BORDER_RECT_COLOUR = '#fff';\n FIELD_TEXT_BASELINE_CENTER: boolean;\n FIELD_DROPDOWN_BORDER_RECT_HEIGHT: number;\n\n /**\n * Whether or not a dropdown field should add a border rect when in a shadow\n * block.\n */\n FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW = false;\n\n /**\n * Whether or not a dropdown field's div should be coloured to match the\n * block colours.\n */\n FIELD_DROPDOWN_COLOURED_DIV = false;\n\n /** Whether or not a dropdown field uses a text or SVG arrow. */\n FIELD_DROPDOWN_SVG_ARROW = false;\n FIELD_DROPDOWN_SVG_ARROW_PADDING: number;\n\n /** A dropdown field's SVG arrow size. */\n FIELD_DROPDOWN_SVG_ARROW_SIZE = 12;\n FIELD_DROPDOWN_SVG_ARROW_DATAURI: string;\n\n /**\n * Whether or not to show a box shadow around the widget div. This is only a\n * feature of full block fields.\n */\n FIELD_TEXTINPUT_BOX_SHADOW = false;\n\n /**\n * Whether or not the colour field should display its colour value on the\n * entire block.\n */\n FIELD_COLOUR_FULL_BLOCK = false;\n\n /** A colour field's default width. */\n FIELD_COLOUR_DEFAULT_WIDTH = 26;\n FIELD_COLOUR_DEFAULT_HEIGHT: number;\n FIELD_CHECKBOX_X_OFFSET: number;\n /** @internal */\n randomIdentifier: string;\n\n /**\n * The defs tag that contains all filters and patterns for this Blockly\n * instance.\n */\n private defs_: SVGElement|null = null;\n\n /**\n * The ID of the emboss filter, or the empty string if no filter is set.\n *\n * @internal\n */\n embossFilterId = '';\n\n /** The <filter> element to use for highlighting, or null if not set. */\n private embossFilter_: SVGElement|null = null;\n\n /**\n * The ID of the disabled pattern, or the empty string if no pattern is set.\n *\n * @internal\n */\n disabledPatternId = '';\n\n /**\n * The <pattern> element to use for disabled blocks, or null if not set.\n */\n private disabledPattern_: SVGElement|null = null;\n\n /**\n * The ID of the debug filter, or the empty string if no pattern is set.\n */\n debugFilterId = '';\n\n /**\n * The <filter> element to use for a debug highlight, or null if not set.\n */\n private debugFilter_: SVGElement|null = null;\n\n /** The <style> element to use for injecting renderer specific CSS. */\n private cssNode_: HTMLStyleElement|null = null;\n\n /**\n * Cursor colour.\n *\n * @internal\n */\n CURSOR_COLOUR = '#cc0a0a';\n\n /**\n * Immovable marker colour.\n *\n * @internal\n */\n MARKER_COLOUR = '#4286f4';\n\n /**\n * Width of the horizontal cursor.\n *\n * @internal\n */\n CURSOR_WS_WIDTH = 100;\n\n /**\n * Height of the horizontal cursor.\n *\n * @internal\n */\n WS_CURSOR_HEIGHT = 5;\n\n /**\n * Padding around a stack.\n *\n * @internal\n */\n CURSOR_STACK_PADDING = 10;\n\n /**\n * Padding around a block.\n *\n * @internal\n */\n CURSOR_BLOCK_PADDING = 2;\n\n /**\n * Stroke of the cursor.\n *\n * @internal\n */\n CURSOR_STROKE_WIDTH = 4;\n\n /**\n * Whether text input and colour fields fill up the entire source block.\n *\n * @internal\n */\n FULL_BLOCK_FIELDS = false;\n\n /**\n * The main colour of insertion markers, in hex. The block is rendered a\n * transparent grey by changing the fill opacity in CSS.\n *\n * @internal\n */\n INSERTION_MARKER_COLOUR = '#000000';\n\n /**\n * The insertion marker opacity.\n *\n * @internal\n */\n INSERTION_MARKER_OPACITY = 0.2;\n\n SHAPES: {[key: string]: number} = {PUZZLE: 1, NOTCH: 2};\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n JAGGED_TEETH!: JaggedTeeth;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n NOTCH!: Notch;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n START_HAT!: StartHat;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n PUZZLE_TAB!: PuzzleTab;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n INSIDE_CORNERS!: InsideCorners;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n OUTSIDE_CORNERS!: OutsideCorners;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n /** @internal */\n blockStyles!: {[key: string]: BlockStyle};\n\n /** @internal */\n constructor() {\n /**\n * Offset from the top of the row for placing fields on inline input rows\n * and statement input rows.\n * Matches existing rendering (in 2019).\n */\n this.TALL_INPUT_FIELD_OFFSET_Y = this.MEDIUM_PADDING;\n\n /** The minimum height of a dummy input row. */\n this.DUMMY_INPUT_MIN_HEIGHT = this.TAB_HEIGHT;\n\n /** The minimum height of a dummy input row in a shadow block. */\n this.DUMMY_INPUT_SHADOW_MIN_HEIGHT = this.TAB_HEIGHT;\n\n /**\n * Additional offset added to the statement input's width to account for the\n * notch.\n */\n this.STATEMENT_INPUT_NOTCH_OFFSET = this.NOTCH_OFFSET_LEFT;\n\n /** The top row's minimum height. */\n this.TOP_ROW_MIN_HEIGHT = this.MEDIUM_PADDING;\n\n /** The top row's minimum height if it precedes a statement. */\n this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT = this.LARGE_PADDING;\n\n /** The bottom row's minimum height. */\n this.BOTTOM_ROW_MIN_HEIGHT = this.MEDIUM_PADDING;\n\n /** The bottom row's minimum height if it follows a statement input. */\n this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT = this.LARGE_PADDING;\n\n /** The height of an empty inline input. */\n this.EMPTY_INLINE_INPUT_HEIGHT = this.TAB_HEIGHT + 11;\n\n /**\n * The height of an empty statement input. Note that in the old rendering\n * this varies slightly depending on whether the block has external or\n * inline inputs. In the new rendering this is consistent. It seems\n * unlikely that the old behaviour was intentional.\n */\n this.EMPTY_STATEMENT_INPUT_HEIGHT = this.MIN_BLOCK_HEIGHT;\n\n this.START_POINT = svgPaths.moveBy(0, 0);\n\n /**\n * A field's text element's dominant baseline. Pre-2022 this could be false\n * for certain browsers.\n */\n this.FIELD_TEXT_BASELINE_CENTER = true;\n\n /** A dropdown field's border rect height. */\n this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT = this.FIELD_BORDER_RECT_HEIGHT;\n\n /** A dropdown field's SVG arrow padding. */\n this.FIELD_DROPDOWN_SVG_ARROW_PADDING = this.FIELD_BORDER_RECT_X_PADDING;\n\n /** A dropdown field's SVG arrow datauri. */\n this.FIELD_DROPDOWN_SVG_ARROW_DATAURI =\n 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllci' +\n 'AxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaG' +\n 'VpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLW' +\n 'Fycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuND' +\n 'EsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTD' +\n 'AuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNz' +\n 'FDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMC' +\n 'wxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNz' +\n 'lhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYz' +\n 'AuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMz' +\n 'dBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=';\n\n /** A colour field's default height. */\n this.FIELD_COLOUR_DEFAULT_HEIGHT = this.FIELD_BORDER_RECT_HEIGHT;\n\n /** A checkbox field's X offset. */\n this.FIELD_CHECKBOX_X_OFFSET = this.FIELD_BORDER_RECT_X_PADDING - 3;\n\n /**\n * A random identifier used to ensure a unique ID is used for each\n * filter/pattern for the case of multiple Blockly instances on a page.\n *\n * @internal\n */\n this.randomIdentifier = String(Math.random()).substring(2);\n }\n\n /**\n * Initialize shape objects based on the constants set in the constructor.\n *\n * @internal\n */\n init() {\n /**\n * An object containing sizing and path information about collapsed block\n * indicators.\n */\n this.JAGGED_TEETH = this.makeJaggedTeeth();\n\n /** An object containing sizing and path information about notches. */\n this.NOTCH = this.makeNotch();\n\n /** An object containing sizing and path information about start hats */\n this.START_HAT = this.makeStartHat();\n\n /**\n * An object containing sizing and path information about puzzle tabs.\n */\n this.PUZZLE_TAB = this.makePuzzleTab();\n\n /**\n * An object containing sizing and path information about inside corners\n */\n this.INSIDE_CORNERS = this.makeInsideCorners();\n\n /**\n * An object containing sizing and path information about outside corners.\n */\n this.OUTSIDE_CORNERS = this.makeOutsideCorners();\n }\n\n /**\n * Refresh constants properties that depend on the theme.\n *\n * @param theme The current workspace theme.\n * @internal\n */\n setTheme(theme: Theme) {\n /** The block styles map. */\n this.blockStyles = Object.create(null);\n\n const blockStyles = theme.blockStyles;\n for (const key in blockStyles) {\n this.blockStyles[key] = this.validatedBlockStyle_(blockStyles[key]);\n }\n\n this.setDynamicProperties_(theme);\n }\n\n /**\n * Sets dynamic properties that depend on other values or theme properties.\n *\n * @param theme The current workspace theme.\n */\n protected setDynamicProperties_(theme: Theme) {\n this.setFontConstants_(theme);\n this.setComponentConstants_(theme);\n\n this.ADD_START_HATS =\n theme.startHats !== undefined ? theme.startHats : this.ADD_START_HATS;\n }\n\n /**\n * Set constants related to fonts.\n *\n * @param theme The current workspace theme.\n */\n protected setFontConstants_(theme: Theme) {\n if (theme.fontStyle && theme.fontStyle['family']) {\n this.FIELD_TEXT_FONTFAMILY = theme.fontStyle['family'];\n }\n\n if (theme.fontStyle && theme.fontStyle['weight']) {\n this.FIELD_TEXT_FONTWEIGHT = theme.fontStyle['weight'];\n }\n\n if (theme.fontStyle && theme.fontStyle['size']) {\n this.FIELD_TEXT_FONTSIZE = theme.fontStyle['size'];\n }\n\n const fontMetrics = dom.measureFontMetrics(\n 'Hg', this.FIELD_TEXT_FONTSIZE + 'pt', this.FIELD_TEXT_FONTWEIGHT,\n this.FIELD_TEXT_FONTFAMILY);\n\n this.FIELD_TEXT_HEIGHT = fontMetrics.height;\n this.FIELD_TEXT_BASELINE = fontMetrics.baseline;\n }\n\n /**\n * Set constants from a theme's component styles.\n *\n * @param theme The current workspace theme.\n */\n protected setComponentConstants_(theme: Theme) {\n this.CURSOR_COLOUR =\n theme.getComponentStyle('cursorColour') || this.CURSOR_COLOUR;\n this.MARKER_COLOUR =\n theme.getComponentStyle('markerColour') || this.MARKER_COLOUR;\n this.INSERTION_MARKER_COLOUR =\n theme.getComponentStyle('insertionMarkerColour') ||\n this.INSERTION_MARKER_COLOUR;\n this.INSERTION_MARKER_OPACITY =\n Number(theme.getComponentStyle('insertionMarkerOpacity')) ||\n this.INSERTION_MARKER_OPACITY;\n }\n\n /**\n * Get or create a block style based on a single colour value. Generate a\n * name for the style based on the colour.\n *\n * @param colour #RRGGBB colour string.\n * @returns An object containing the style and an autogenerated name for that\n * style.\n * @internal\n */\n getBlockStyleForColour(colour: string): {style: BlockStyle, name: string} {\n const name = 'auto_' + colour;\n if (!this.blockStyles[name]) {\n this.blockStyles[name] = this.createBlockStyle_(colour);\n }\n return {style: this.blockStyles[name], name};\n }\n\n /**\n * Gets the BlockStyle for the given block style name.\n *\n * @param blockStyleName The name of the block style.\n * @returns The named block style, or a default style if no style with the\n * given name was found.\n */\n getBlockStyle(blockStyleName: string|null): BlockStyle {\n return this.blockStyles[blockStyleName || ''] ||\n (blockStyleName && blockStyleName.indexOf('auto_') === 0 ?\n this.getBlockStyleForColour(blockStyleName.substring(5)).style :\n this.createBlockStyle_('#000000'));\n }\n\n /**\n * Create a block style object based on the given colour.\n *\n * @param colour #RRGGBB colour string.\n * @returns A populated block style based on the given colour.\n */\n protected createBlockStyle_(colour: string): BlockStyle {\n return this.validatedBlockStyle_({'colourPrimary': colour});\n }\n\n /**\n * Get a full block style object based on the input style object. Populate\n * any missing values.\n *\n * @param blockStyle A full or partial block style object.\n * @returns A full block style object, with all required properties populated.\n */\n protected validatedBlockStyle_(blockStyle: {\n colourPrimary: string,\n colourSecondary?: string,\n colourTertiary?: string,\n hat?: string\n }): BlockStyle {\n // Make a new object with all of the same properties.\n const valid = {} as BlockStyle;\n if (blockStyle) {\n Object.assign(valid, blockStyle);\n }\n // Validate required properties.\n const parsedColour =\n parsing.parseBlockColour(valid['colourPrimary'] || '#000');\n valid.colourPrimary = parsedColour.hex;\n valid.colourSecondary = valid['colourSecondary'] ?\n parsing.parseBlockColour(valid['colourSecondary']).hex :\n this.generateSecondaryColour_(valid.colourPrimary);\n valid.colourTertiary = valid['colourTertiary'] ?\n parsing.parseBlockColour(valid['colourTertiary']).hex :\n this.generateTertiaryColour_(valid.colourPrimary);\n\n valid.hat = valid['hat'] || '';\n return valid;\n }\n\n /**\n * Generate a secondary colour from the passed in primary colour.\n *\n * @param inputColour Primary colour.\n * @returns The generated secondary colour.\n */\n protected generateSecondaryColour_(inputColour: string): string {\n return colour.blend('#fff', inputColour, 0.6) || inputColour;\n }\n\n /**\n * Generate a tertiary colour from the passed in primary colour.\n *\n * @param inputColour Primary colour.\n * @returns The generated tertiary colour.\n */\n protected generateTertiaryColour_(inputColour: string): string {\n return colour.blend('#fff', inputColour, 0.3) || inputColour;\n }\n\n /**\n * Dispose of this constants provider.\n * Delete all DOM elements that this provider created.\n *\n * @internal\n */\n dispose() {\n if (this.embossFilter_) {\n dom.removeNode(this.embossFilter_);\n }\n if (this.disabledPattern_) {\n dom.removeNode(this.disabledPattern_);\n }\n if (this.debugFilter_) {\n dom.removeNode(this.debugFilter_);\n }\n this.cssNode_ = null;\n }\n\n /**\n * @returns An object containing sizing and path information about collapsed\n * block indicators.\n * @internal\n */\n makeJaggedTeeth(): JaggedTeeth {\n const height = this.JAGGED_TEETH_HEIGHT;\n const width = this.JAGGED_TEETH_WIDTH;\n\n const mainPath = svgPaths.line([\n svgPaths.point(width, height / 4),\n svgPaths.point(-width * 2, height / 2),\n svgPaths.point(width, height / 4),\n ]);\n return {height, width, path: mainPath};\n }\n\n /**\n * @returns An object containing sizing and path information about start hats.\n * @internal\n */\n makeStartHat(): StartHat {\n const height = this.START_HAT_HEIGHT;\n const width = this.START_HAT_WIDTH;\n\n const mainPath = svgPaths.curve('c', [\n svgPaths.point(30, -height),\n svgPaths.point(70, -height),\n svgPaths.point(width, 0),\n ]);\n return {height, width, path: mainPath};\n }\n\n /**\n * @returns An object containing sizing and path information about puzzle\n * tabs.\n * @internal\n */\n makePuzzleTab(): PuzzleTab {\n const width = this.TAB_WIDTH;\n const height = this.TAB_HEIGHT;\n\n /**\n * Make the main path for the puzzle tab made out of a few curves (c and s).\n * Those curves are defined with relative positions. The 'up' and 'down'\n * versions of the paths are the same, but the Y sign flips. Forward and\n * back are the signs to use to move the cursor in the direction that the\n * path is being drawn.\n *\n * @param up True if the path should be drawn from bottom to top, false\n * otherwise.\n * @returns A path fragment describing a puzzle tab.\n */\n function makeMainPath(up: boolean): string {\n const forward = up ? -1 : 1;\n const back = -forward;\n\n const overlap = 2.5;\n const halfHeight = height / 2;\n const control1Y = halfHeight + overlap;\n const control2Y = halfHeight + 0.5;\n const control3Y = overlap; // 2.5\n\n const endPoint1 = svgPaths.point(-width, forward * halfHeight);\n const endPoint2 = svgPaths.point(width, forward * halfHeight);\n\n return svgPaths.curve(\n 'c',\n [\n svgPaths.point(0, forward * control1Y),\n svgPaths.point(-width, back * control2Y),\n endPoint1,\n ]) +\n svgPaths.curve(\n 's', [svgPaths.point(width, back * control3Y), endPoint2]);\n }\n\n // c 0,-10 -8,8 -8,-7.5 s 8,2.5 8,-7.5\n const pathUp = makeMainPath(true);\n // c 0,10 -8,-8 -8,7.5 s 8,-2.5 8,7.5\n const pathDown = makeMainPath(false);\n\n return {\n type: this.SHAPES.PUZZLE,\n width,\n height,\n pathDown,\n pathUp,\n };\n }\n\n /**\n * @returns An object containing sizing and path information about notches.\n * @internal\n */\n makeNotch(): Notch {\n const width = this.NOTCH_WIDTH;\n const height = this.NOTCH_HEIGHT;\n const innerWidth = 3;\n const outerWidth = (width - innerWidth) / 2;\n\n /**\n * Make the main path for the notch.\n *\n * @param dir Direction multiplier to apply to horizontal offsets along the\n * path. Either 1 or -1.\n * @returns A path fragment describing a notch.\n */\n function makeMainPath(dir: number): string {\n return svgPaths.line([\n svgPaths.point(dir * outerWidth, height),\n svgPaths.point(dir * innerWidth, 0),\n svgPaths.point(dir * outerWidth, -height),\n ]);\n }\n const pathLeft = makeMainPath(1);\n const pathRight = makeMainPath(-1);\n\n return {\n type: this.SHAPES.NOTCH,\n width,\n height,\n pathLeft,\n pathRight,\n };\n }\n\n /**\n * @returns An object containing sizing and path information about inside\n * corners.\n * @internal\n */\n makeInsideCorners(): InsideCorners {\n const radius = this.CORNER_RADIUS;\n\n const innerTopLeftCorner =\n svgPaths.arc('a', '0 0,0', radius, svgPaths.point(-radius, radius));\n\n const innerBottomLeftCorner =\n svgPaths.arc('a', '0 0,0', radius, svgPaths.point(radius, radius));\n\n return {\n width: radius,\n height: radius,\n pathTop: innerTopLeftCorner,\n pathBottom: innerBottomLeftCorner,\n };\n }\n\n /**\n * @returns An object containing sizing and path information about outside\n * corners.\n * @internal\n */\n makeOutsideCorners(): OutsideCorners {\n const radius = this.CORNER_RADIUS;\n /** SVG path for drawing the rounded top-left corner. */\n const topLeft = svgPaths.moveBy(0, radius) +\n svgPaths.arc('a', '0 0,1', radius, svgPaths.point(radius, -radius));\n\n /** SVG path for drawing the rounded top-right corner. */\n const topRight =\n svgPaths.arc('a', '0 0,1', radius, svgPaths.point(radius, radius));\n\n /** SVG path for drawing the rounded bottom-left corner. */\n const bottomLeft =\n svgPaths.arc('a', '0 0,1', radius, svgPaths.point(-radius, -radius));\n\n /** SVG path for drawing the rounded bottom-right corner. */\n const bottomRight =\n svgPaths.arc('a', '0 0,1', radius, svgPaths.point(-radius, radius));\n\n return {\n topLeft,\n topRight,\n bottomRight,\n bottomLeft,\n rightHeight: radius,\n };\n }\n\n /**\n * Get an object with connection shape and sizing information based on the\n * type of the connection.\n *\n * @param connection The connection to find a shape object for\n * @returns The shape object for the connection.\n * @internal\n */\n shapeFor(connection: RenderedConnection): Shape {\n switch (connection.type) {\n case ConnectionType.INPUT_VALUE:\n case ConnectionType.OUTPUT_VALUE:\n return this.PUZZLE_TAB;\n case ConnectionType.PREVIOUS_STATEMENT:\n case ConnectionType.NEXT_STATEMENT:\n return this.NOTCH;\n default:\n throw Error('Unknown connection type');\n }\n }\n\n /**\n * Create any DOM elements that this renderer needs (filters, patterns, etc).\n *\n * @param svg The root of the workspace's SVG.\n * @param tagName The name to use for the CSS style tag.\n * @param selector The CSS selector to use.\n * @suppress {strictModuleDepCheck} Debug renderer only included in\n * playground.\n * @internal\n */\n createDom(svg: SVGElement, tagName: string, selector: string) {\n this.injectCSS_(tagName, selector);\n\n /*\n <defs>\n ... filters go here ...\n </defs>\n */\n this.defs_ = dom.createSvgElement(Svg.DEFS, {}, svg);\n /*\n <filter id=\"blocklyEmbossFilter837493\">\n <feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"1\" result=\"blur\" />\n <feSpecularLighting in=\"blur\" surfaceScale=\"1\"\n specularConstant=\"0.5\" specularExponent=\"10\" lighting-color=\"white\"\n result=\"specOut\">\n <fePointLight x=\"-5000\" y=\"-10000\" z=\"20000\" />\n </feSpecularLighting>\n <feComposite in=\"specOut\" in2=\"SourceAlpha\" operator=\"in\"\n result=\"specOut\" />\n <feComposite in=\"SourceGraphic\" in2=\"specOut\" operator=\"arithmetic\"\n k1=\"0\" k2=\"1\" k3=\"1\" k4=\"0\" />\n </filter>\n */\n const embossFilter = dom.createSvgElement(\n Svg.FILTER, {'id': 'blocklyEmbossFilter' + this.randomIdentifier},\n this.defs_);\n dom.createSvgElement(\n Svg.FEGAUSSIANBLUR,\n {'in': 'SourceAlpha', 'stdDeviation': 1, 'result': 'blur'},\n embossFilter);\n const feSpecularLighting = dom.createSvgElement(\n Svg.FESPECULARLIGHTING, {\n 'in': 'blur',\n 'surfaceScale': 1,\n 'specularConstant': 0.5,\n 'specularExponent': 10,\n 'lighting-color': 'white',\n 'result': 'specOut',\n },\n embossFilter);\n dom.createSvgElement(\n Svg.FEPOINTLIGHT, {'x': -5000, 'y': -10000, 'z': 20000},\n feSpecularLighting);\n dom.createSvgElement(\n Svg.FECOMPOSITE, {\n 'in': 'specOut',\n 'in2': 'SourceAlpha',\n 'operator': 'in',\n 'result': 'specOut',\n },\n embossFilter);\n dom.createSvgElement(\n Svg.FECOMPOSITE, {\n 'in': 'SourceGraphic',\n 'in2': 'specOut',\n 'operator': 'arithmetic',\n 'k1': 0,\n 'k2': 1,\n 'k3': 1,\n 'k4': 0,\n },\n embossFilter);\n this.embossFilterId = embossFilter.id;\n this.embossFilter_ = embossFilter;\n\n /*\n <pattern id=\"blocklyDisabledPattern837493\"\n patternUnits=\"userSpaceOnUse\" width=\"10\" height=\"10\"> <rect width=\"10\"\n height=\"10\" fill=\"#aaa\" /> <path d=\"M 0 0 L 10 10 M 10 0 L 0 10\"\n stroke=\"#cc0\" />\n </pattern>\n */\n const disabledPattern = dom.createSvgElement(\n Svg.PATTERN, {\n 'id': 'blocklyDisabledPattern' + this.randomIdentifier,\n 'patternUnits': 'userSpaceOnUse',\n 'width': 10,\n 'height': 10,\n },\n this.defs_);\n dom.createSvgElement(\n Svg.RECT, {'width': 10, 'height': 10, 'fill': '#aaa'}, disabledPattern);\n dom.createSvgElement(\n Svg.PATH, {'d': 'M 0 0 L 10 10 M 10 0 L 0 10', 'stroke': '#cc0'},\n disabledPattern);\n this.disabledPatternId = disabledPattern.id;\n this.disabledPattern_ = disabledPattern;\n\n this.createDebugFilter();\n }\n\n /**\n * Create a filter for highlighting the currently rendering block during\n * render debugging.\n */\n private createDebugFilter() {\n // Only create the debug filter once.\n if (!this.debugFilter_) {\n const debugFilter = dom.createSvgElement(\n Svg.FILTER, {\n 'id': 'blocklyDebugFilter' + this.randomIdentifier,\n 'height': '160%',\n 'width': '180%',\n 'y': '-30%',\n 'x': '-40%',\n },\n this.defs_);\n // Set all gaussian blur pixels to 1 opacity before applying flood\n const debugComponentTransfer = dom.createSvgElement(\n Svg.FECOMPONENTTRANSFER, {'result': 'outBlur'}, debugFilter);\n dom.createSvgElement(\n Svg.FEFUNCA,\n {'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'},\n debugComponentTransfer);\n // Color the highlight\n dom.createSvgElement(\n Svg.FEFLOOD, {\n 'flood-color': '#ff0000',\n 'flood-opacity': 0.5,\n 'result': 'outColor',\n },\n debugFilter);\n dom.createSvgElement(\n Svg.FECOMPOSITE, {\n 'in': 'outColor',\n 'in2': 'outBlur',\n 'operator': 'in',\n 'result': 'outGlow',\n },\n debugFilter);\n this.debugFilterId = debugFilter.id;\n this.debugFilter_ = debugFilter;\n }\n }\n\n /**\n * Inject renderer specific CSS into the page.\n *\n * @param tagName The name of the style tag to use.\n * @param selector The CSS selector to use.\n */\n protected injectCSS_(tagName: string, selector: string) {\n const cssArray = this.getCSS_(selector);\n const cssNodeId = 'blockly-renderer-style-' + tagName;\n this.cssNode_ = document.getElementById(cssNodeId) as HTMLStyleElement;\n const text = cssArray.join('\\n');\n if (this.cssNode_) {\n // Already injected, update if the theme changed.\n this.cssNode_.firstChild!.textContent = text;\n return;\n }\n // Inject CSS tag at start of head.\n const cssNode = (document.createElement('style'));\n cssNode.id = cssNodeId;\n const cssTextNode = document.createTextNode(text);\n cssNode.appendChild(cssTextNode);\n document.head.insertBefore(cssNode, document.head.firstChild);\n this.cssNode_ = cssNode;\n }\n\n /**\n * Get any renderer specific CSS to inject when the renderer is initialized.\n *\n * @param selector CSS selector to use.\n * @returns Array of CSS strings.\n */\n protected getCSS_(selector: string): string[] {\n return [\n /* eslint-disable indent */\n /* clang-format off */\n // Text.\n `${selector} .blocklyText, `,\n `${selector} .blocklyFlyoutLabelText {`,\n `font: ${this.FIELD_TEXT_FONTWEIGHT} ` +\n `${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,\n `}`,\n\n // Fields.\n `${selector} .blocklyText {`,\n `fill: #fff;`,\n `}`,\n `${selector} .blocklyNonEditableText>rect,`,\n `${selector} .blocklyEditableText>rect {`,\n `fill: ${this.FIELD_BORDER_RECT_COLOUR};`,\n `fill-opacity: .6;`,\n `stroke: none;`,\n `}`,\n `${selector} .blocklyNonEditableText>text,`,\n `${selector} .blocklyEditableText>text {`,\n `fill: #000;`,\n `}`,\n\n // Flyout labels.\n `${selector} .blocklyFlyoutLabelText {`,\n `fill: #000;`,\n `}`,\n\n // Bubbles.\n `${selector} .blocklyText.blocklyBubbleText {`,\n `fill: #000;`,\n `}`,\n\n // Editable field hover.\n `${selector} .blocklyEditableText:not(.editing):hover>rect {`,\n `stroke: #fff;`,\n `stroke-width: 2;`,\n `}`,\n\n // Text field input.\n `${selector} .blocklyHtmlInput {`,\n `font-family: ${this.FIELD_TEXT_FONTFAMILY};`,\n `font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,\n `}`,\n\n // Selection highlight.\n `${selector} .blocklySelected>.blocklyPath {`,\n `stroke: #fc3;`,\n `stroke-width: 3px;`,\n `}`,\n\n // Connection highlight.\n `${selector} .blocklyHighlightedConnectionPath {`,\n `stroke: #fc3;`,\n `}`,\n\n // Replaceable highlight.\n `${selector} .blocklyReplaceable .blocklyPath {`,\n `fill-opacity: .5;`,\n `}`,\n `${selector} .blocklyReplaceable .blocklyPathLight,`,\n `${selector} .blocklyReplaceable .blocklyPathDark {`,\n `display: none;`,\n `}`,\n\n // Insertion marker.\n `${selector} .blocklyInsertionMarker>.blocklyPath {`,\n `fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,\n `stroke: none;`,\n `}`,\n /* clang-format on */\n /* eslint-enable indent */\n ];\n }\n}\n/* clang-format on */\n/* eslint-enable indent */\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Block rendering debugging functionality.\n *\n * @namespace Blockly.blockRendering.debug\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.debug');\n\nimport * as deprecation from '../../utils/deprecation.js';\n\n\n/** Whether or not the debugger is turned on. */\nlet useDebugger = false;\n/**\n * Returns whether the debugger is turned on.\n *\n * @returns Whether the debugger is turned on.\n * @alias Blockly.blockRendering.debug.isDebuggerEnabled\n * @internal\n */\nexport function isDebuggerEnabled(): boolean {\n return useDebugger;\n}\n\n/**\n * Turn on the blocks debugger.\n *\n * @alias Blockly.blockRendering.debug.startDebugger\n * @deprecated March 2022. Use the rendering debugger in @blockly/dev-tools.\n * See https://www.npmjs.com/package/@blockly/dev-tools for more information.\n * @internal\n */\nexport function startDebugger() {\n deprecation.warn(\n 'Blockly.blockRendering.debug.startDebugger()', 'version 8', 'version 10',\n 'the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)');\n useDebugger = true;\n}\n\n/**\n * Turn off the blocks debugger.\n *\n * @alias Blockly.blockRendering.debug.stopDebugger\n * @deprecated March 2022. Use the rendering debugger in @blockly/dev-tools.\n * See https://www.npmjs.com/package/@blockly/dev-tools for more information.\n * @internal\n */\nexport function stopDebugger() {\n deprecation.warn(\n 'Blockly.blockRendering.debug.stopDebugger()', 'version 8', 'version 10',\n 'the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)');\n useDebugger = false;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Namespace for block rendering functionality.\n *\n * @namespace Blockly.blockRendering\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering');\n\nimport * as registry from '../../registry.js';\nimport type {Theme} from '../../theme.js';\nimport * as deprecation from '../../utils/deprecation.js';\nimport {Measurable} from '../measurables/base.js';\nimport {BottomRow} from '../measurables/bottom_row.js';\nimport {Connection} from '../measurables/connection.js';\nimport {ExternalValueInput} from '../measurables/external_value_input.js';\nimport {Field} from '../measurables/field.js';\nimport {Hat} from '../measurables/hat.js';\nimport {Icon} from '../measurables/icon.js';\nimport {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport {InlineInput} from '../measurables/inline_input.js';\nimport {InputConnection} from '../measurables/input_connection.js';\nimport {InputRow} from '../measurables/input_row.js';\nimport {JaggedEdge} from '../measurables/jagged_edge.js';\nimport {NextConnection} from '../measurables/next_connection.js';\nimport {OutputConnection} from '../measurables/output_connection.js';\nimport {PreviousConnection} from '../measurables/previous_connection.js';\nimport {RoundCorner} from '../measurables/round_corner.js';\nimport {Row} from '../measurables/row.js';\nimport {SpacerRow} from '../measurables/spacer_row.js';\nimport {SquareCorner} from '../measurables/square_corner.js';\nimport {StatementInput} from '../measurables/statement_input.js';\nimport {TopRow} from '../measurables/top_row.js';\nimport {Types} from '../measurables/types.js';\n\nimport {ConstantProvider} from './constants.js';\nimport * as debug from './debug.js';\nimport {Debug} from './debugger.js';\nimport {Drawer} from './drawer.js';\nimport type {IPathObject} from './i_path_object.js';\nimport {RenderInfo} from './info.js';\nimport {MarkerSvg} from './marker_svg.js';\nimport {PathObject} from './path_object.js';\nimport {Renderer} from './renderer.js';\n\n/**\n * Registers a new renderer.\n *\n * @param name The name of the renderer.\n * @param rendererClass The new renderer class to register.\n * @throws {Error} if a renderer with the same name has already been registered.\n */\nexport function register(name: string, rendererClass: Function) {\n registry.register(registry.Type.RENDERER, name, rendererClass);\n}\n\n/**\n * Unregisters the renderer registered with the given name.\n *\n * @param name The name of the renderer.\n * @alias Blockly.blockRendering.unregister\n */\nexport function unregister(name: string) {\n registry.unregister(registry.Type.RENDERER, name);\n}\n\n/**\n * Turn off the blocks debugger.\n *\n * @alias Blockly.blockRendering.stopDebugger\n * @deprecated Use the debug renderer in **\\@blockly/dev-tools** (See {@link\n * https://www.npmjs.com/package/@blockly/dev-tools}.)\n * @internal\n */\nexport function stopDebugger() {\n deprecation.warn(\n 'Blockly.blockRendering.stopDebugger()', 'September 2021',\n 'September 2022',\n 'the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)');\n debug.stopDebugger();\n}\n\n/**\n * Initialize anything needed for rendering (constants, etc).\n *\n * @param name Name of the renderer to initialize.\n * @param theme The workspace theme object.\n * @param opt_rendererOverrides Rendering constant overrides.\n * @returns The new instance of a renderer.\n * Already initialized.\n * @alias Blockly.blockRendering.init\n * @internal\n */\nexport function init(\n name: string, theme: Theme,\n opt_rendererOverrides?: {[rendererConstant: string]: any}): Renderer {\n const rendererClass = registry.getClass(registry.Type.RENDERER, name);\n const renderer = new rendererClass!(name);\n renderer.init(theme, opt_rendererOverrides);\n return renderer;\n}\nexport {BottomRow};\nexport {Connection};\nexport {ConstantProvider};\nexport {Debug};\nexport {Drawer};\nexport {ExternalValueInput};\nexport {Field};\nexport {Hat};\nexport {Icon};\nexport {InRowSpacer};\nexport {InlineInput};\nexport {InputConnection};\nexport {InputRow};\nexport {IPathObject};\nexport {JaggedEdge};\nexport {MarkerSvg};\nexport {Measurable};\nexport {NextConnection};\nexport {OutputConnection};\nexport {PathObject};\nexport {PreviousConnection};\nexport {Renderer};\nexport {RenderInfo};\nexport {RoundCorner};\nexport {Row};\nexport {SpacerRow};\nexport {SquareCorner};\nexport {StatementInput};\nexport {TopRow};\nexport {Types};\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility functions for handling typed variables.\n *\n * @namespace Blockly.VariablesDynamic\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.VariablesDynamic');\n\nimport {Blocks} from './blocks.js';\nimport {Msg} from './msg.js';\nimport * as xml from './utils/xml.js';\nimport {VariableModel} from './variable_model.js';\nimport * as Variables from './variables.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\nimport type {FlyoutButton} from './flyout_button.js';\n\n\n/**\n * String for use in the \"custom\" attribute of a category in toolbox XML.\n * This string indicates that the category should be dynamically populated with\n * variable blocks.\n * See also Blockly.Variables.CATEGORY_NAME and\n * Blockly.Procedures.CATEGORY_NAME.\n *\n * @alias Blockly.VariablesDynamic.CATEGORY_NAME\n */\nexport const CATEGORY_NAME = 'VARIABLE_DYNAMIC';\n\n/**\n * Click handler for a button that creates String variables.\n *\n * @param button\n */\nfunction stringButtonClickHandler(button: FlyoutButton) {\n Variables.createVariableButtonHandler(\n button.getTargetWorkspace(), undefined, 'String');\n}\n// eslint-disable-next-line camelcase\nexport const onCreateVariableButtonClick_String = stringButtonClickHandler;\n\n/**\n * Click handler for a button that creates Number variables.\n *\n * @param button\n */\nfunction numberButtonClickHandler(button: FlyoutButton) {\n Variables.createVariableButtonHandler(\n button.getTargetWorkspace(), undefined, 'Number');\n}\n// eslint-disable-next-line camelcase\nexport const onCreateVariableButtonClick_Number = numberButtonClickHandler;\n\n/**\n * Click handler for a button that creates Colour variables.\n *\n * @param button\n */\nfunction colourButtonClickHandler(button: FlyoutButton) {\n Variables.createVariableButtonHandler(\n button.getTargetWorkspace(), undefined, 'Colour');\n}\n// eslint-disable-next-line camelcase\nexport const onCreateVariableButtonClick_Colour = colourButtonClickHandler;\n\n/**\n * Construct the elements (blocks and button) required by the flyout for the\n * variable category.\n *\n * @param workspace The workspace containing variables.\n * @returns Array of XML elements.\n * @alias Blockly.VariablesDynamic.flyoutCategory\n */\nexport function flyoutCategory(workspace: WorkspaceSvg): Element[] {\n let xmlList = new Array<Element>();\n let button = document.createElement('button');\n button.setAttribute('text', Msg['NEW_STRING_VARIABLE']);\n button.setAttribute('callbackKey', 'CREATE_VARIABLE_STRING');\n xmlList.push(button);\n button = document.createElement('button');\n button.setAttribute('text', Msg['NEW_NUMBER_VARIABLE']);\n button.setAttribute('callbackKey', 'CREATE_VARIABLE_NUMBER');\n xmlList.push(button);\n button = document.createElement('button');\n button.setAttribute('text', Msg['NEW_COLOUR_VARIABLE']);\n button.setAttribute('callbackKey', 'CREATE_VARIABLE_COLOUR');\n xmlList.push(button);\n\n workspace.registerButtonCallback(\n 'CREATE_VARIABLE_STRING', stringButtonClickHandler);\n workspace.registerButtonCallback(\n 'CREATE_VARIABLE_NUMBER', numberButtonClickHandler);\n workspace.registerButtonCallback(\n 'CREATE_VARIABLE_COLOUR', colourButtonClickHandler);\n\n const blockList = flyoutCategoryBlocks(workspace);\n xmlList = xmlList.concat(blockList);\n return xmlList;\n}\n\n/**\n * Construct the blocks required by the flyout for the variable category.\n *\n * @param workspace The workspace containing variables.\n * @returns Array of XML block elements.\n * @alias Blockly.VariablesDynamic.flyoutCategoryBlocks\n */\nexport function flyoutCategoryBlocks(workspace: Workspace): Element[] {\n const variableModelList = workspace.getAllVariables();\n\n const xmlList = [];\n if (variableModelList.length > 0) {\n if (Blocks['variables_set_dynamic']) {\n const firstVariable = variableModelList[variableModelList.length - 1];\n const block = xml.createElement('block');\n block.setAttribute('type', 'variables_set_dynamic');\n block.setAttribute('gap', '24');\n block.appendChild(Variables.generateVariableFieldDom(firstVariable));\n xmlList.push(block);\n }\n if (Blocks['variables_get_dynamic']) {\n variableModelList.sort(VariableModel.compareByName);\n for (let i = 0, variable; variable = variableModelList[i]; i++) {\n const block = xml.createElement('block');\n block.setAttribute('type', 'variables_get_dynamic');\n block.setAttribute('gap', '8');\n block.appendChild(Variables.generateVariableFieldDom(variable));\n xmlList.push(block);\n }\n }\n }\n return xmlList;\n}\n","/**\n * @license\n * Copyright 2014 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a workspace rendered as SVG.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.WorkspaceSvg');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_create.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_theme_change.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_viewport.js';\n\nimport type {Block} from './block.js';\nimport type {BlockDragSurfaceSvg} from './block_drag_surface.js';\nimport type {BlockSvg} from './block_svg.js';\nimport type {BlocklyOptions} from './blockly_options.js';\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\nimport {ComponentManager} from './component_manager.js';\nimport {config} from './config.js';\nimport {ConnectionDB} from './connection_db.js';\nimport * as ContextMenu from './contextmenu.js';\nimport {ContextMenuRegistry} from './contextmenu_registry.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport * as eventUtils from './events/utils.js';\nimport type {FlyoutButton} from './flyout_button.js';\nimport {Gesture} from './gesture.js';\nimport {Grid} from './grid.js';\nimport type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {ICopyable} from './interfaces/i_copyable.js';\nimport type {IDragTarget} from './interfaces/i_drag_target.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IMetricsManager} from './interfaces/i_metrics_manager.js';\nimport type {IToolbox} from './interfaces/i_toolbox.js';\nimport type {Cursor} from './keyboard_nav/cursor.js';\nimport type {Marker} from './keyboard_nav/marker.js';\nimport {MarkerManager} from './marker_manager.js';\nimport {Options} from './options.js';\nimport * as Procedures from './procedures.js';\nimport * as registry from './registry.js';\nimport * as blockRendering from './renderers/common/block_rendering.js';\nimport type {Renderer} from './renderers/common/renderer.js';\nimport type {ScrollbarPair} from './scrollbar_pair.js';\nimport * as blocks from './serialization/blocks.js';\nimport type {Theme} from './theme.js';\nimport {Classic} from './theme/classic.js';\nimport {ThemeManager} from './theme_manager.js';\nimport * as Tooltip from './tooltip.js';\nimport {TouchGesture} from './touch_gesture.js';\nimport type {Trashcan} from './trashcan.js';\nimport * as arrayUtils from './utils/array.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport type {Metrics} from './utils/metrics.js';\nimport {Rect} from './utils/rect.js';\nimport {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\nimport * as toolbox from './utils/toolbox.js';\nimport * as userAgent from './utils/useragent.js';\nimport type {VariableModel} from './variable_model.js';\nimport * as Variables from './variables.js';\nimport * as VariablesDynamic from './variables_dynamic.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport {Workspace} from './workspace.js';\nimport {WorkspaceAudio} from './workspace_audio.js';\nimport {WorkspaceComment} from './workspace_comment.js';\nimport {WorkspaceCommentSvg} from './workspace_comment_svg.js';\nimport type {WorkspaceDragSurfaceSvg} from './workspace_drag_surface_svg.js';\nimport * as Xml from './xml.js';\nimport {ZoomControls} from './zoom_controls.js';\nimport {ContextMenuOption} from './contextmenu_registry.js';\n\n\n/** Margin around the top/bottom/left/right after a zoomToFit call. */\nconst ZOOM_TO_FIT_MARGIN = 20;\n\n/**\n * Class for a workspace. This is an onscreen area with optional trashcan,\n * scrollbars, bubbles, and dragging.\n *\n * @alias Blockly.WorkspaceSvg\n */\nexport class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {\n /**\n * A wrapper function called when a resize event occurs.\n * You can pass the result to `eventHandling.unbind`.\n */\n private resizeHandlerWrapper_: browserEvents.Data|null = null;\n\n /**\n * The render status of an SVG workspace.\n * Returns `false` for headless workspaces and true for instances of\n * `WorkspaceSvg`.\n */\n override rendered = true;\n\n /**\n * Whether the workspace is visible. False if the workspace has been hidden\n * by calling `setVisible(false)`.\n */\n private isVisible_ = true;\n\n /**\n * Whether this workspace has resizes enabled.\n * Disable during batch operations for a performance improvement.\n */\n private resizesEnabled_ = true;\n\n /**\n * Current horizontal scrolling offset in pixel units, relative to the\n * workspace origin.\n *\n * It is useful to think about a view, and a canvas moving beneath that\n * view. As the canvas moves right, this value becomes more positive, and\n * the view is now \"seeing\" the left side of the canvas. As the canvas moves\n * left, this value becomes more negative, and the view is now \"seeing\" the\n * right side of the canvas.\n *\n * The confusing thing about this value is that it does not, and must not\n * include the absoluteLeft offset. This is because it is used to calculate\n * the viewLeft value.\n *\n * The viewLeft is relative to the workspace origin (although in pixel\n * units). The workspace origin is the top-left corner of the workspace (at\n * least when it is enabled). It is shifted from the top-left of the\n * blocklyDiv so as not to be beneath the toolbox.\n *\n * When the workspace is enabled the viewLeft and workspace origin are at\n * the same X location. As the canvas slides towards the right beneath the\n * view this value (scrollX) becomes more positive, and the viewLeft becomes\n * more negative relative to the workspace origin (imagine the workspace\n * origin as a dot on the canvas sliding to the right as the canvas moves).\n *\n * So if the scrollX were to include the absoluteLeft this would in a way\n * \"unshift\" the workspace origin. This means that the viewLeft would be\n * representing the left edge of the blocklyDiv, rather than the left edge\n * of the workspace.\n */\n scrollX = 0;\n\n /**\n * Current vertical scrolling offset in pixel units, relative to the\n * workspace origin.\n *\n * It is useful to think about a view, and a canvas moving beneath that\n * view. As the canvas moves down, this value becomes more positive, and the\n * view is now \"seeing\" the upper part of the canvas. As the canvas moves\n * up, this value becomes more negative, and the view is \"seeing\" the lower\n * part of the canvas.\n *\n * This confusing thing about this value is that it does not, and must not\n * include the absoluteTop offset. This is because it is used to calculate\n * the viewTop value.\n *\n * The viewTop is relative to the workspace origin (although in pixel\n * units). The workspace origin is the top-left corner of the workspace (at\n * least when it is enabled). It is shifted from the top-left of the\n * blocklyDiv so as not to be beneath the toolbox.\n *\n * When the workspace is enabled the viewTop and workspace origin are at the\n * same Y location. As the canvas slides towards the bottom this value\n * (scrollY) becomes more positive, and the viewTop becomes more negative\n * relative to the workspace origin (image in the workspace origin as a dot\n * on the canvas sliding downwards as the canvas moves).\n *\n * So if the scrollY were to include the absoluteTop this would in a way\n * \"unshift\" the workspace origin. This means that the viewTop would be\n * representing the top edge of the blocklyDiv, rather than the top edge of\n * the workspace.\n */\n scrollY = 0;\n\n /** Horizontal scroll value when scrolling started in pixel units. */\n startScrollX = 0;\n\n /** Vertical scroll value when scrolling started in pixel units. */\n startScrollY = 0;\n\n /** Distance from mouse to object being dragged. */\n private dragDeltaXY_: Coordinate|null = null;\n\n /** Current scale. */\n scale = 1;\n\n /** Cached scale value. Used to detect changes in viewport. */\n private oldScale_ = 1;\n\n /** Cached viewport top value. Used to detect changes in viewport. */\n private oldTop_ = 0;\n\n /** Cached viewport left value. Used to detect changes in viewport. */\n private oldLeft_ = 0;\n\n /** The workspace's trashcan (if any). */\n trashcan: Trashcan|null = null;\n\n /** This workspace's scrollbars, if they exist. */\n scrollbar: ScrollbarPair|null = null;\n\n /**\n * Fixed flyout providing blocks which may be dragged into this workspace.\n */\n private flyout_: IFlyout|null = null;\n\n /**\n * Category-based toolbox providing blocks which may be dragged into this\n * workspace.\n */\n private toolbox_: IToolbox|null = null;\n\n /**\n * The current gesture in progress on this workspace, if any.\n *\n * @internal\n */\n currentGesture_: TouchGesture|null = null;\n\n /** This workspace's surface for dragging blocks, if it exists. */\n private readonly blockDragSurface_: BlockDragSurfaceSvg|null = null;\n\n /** This workspace's drag surface, if it exists. */\n private readonly workspaceDragSurface_: WorkspaceDragSurfaceSvg|null = null;\n\n /**\n * Whether to move workspace to the drag surface when it is dragged.\n * True if it should move, false if it should be translated directly.\n */\n private readonly useWorkspaceDragSurface_;\n\n /**\n * Whether the drag surface is actively in use. When true, calls to\n * translate will translate the drag surface instead of the translating the\n * workspace directly.\n * This is set to true in setupDragSurface and to false in resetDragSurface.\n */\n private isDragSurfaceActive_ = false;\n\n /**\n * The first parent div with 'injectionDiv' in the name, or null if not set.\n * Access this with getInjectionDiv.\n */\n private injectionDiv_: Element|null = null;\n\n /**\n * Last known position of the page scroll.\n * This is used to determine whether we have recalculated screen coordinate\n * stuff since the page scrolled.\n */\n private lastRecordedPageScroll_: Coordinate|null = null;\n\n /**\n * Developers may define this function to add custom menu options to the\n * workspace's context menu or edit the workspace-created set of menu\n * options.\n *\n * @param options List of menu options to add to.\n * @param e The right-click event that triggered the context menu.\n */\n configureContextMenu:\n ((menuOptions: ContextMenuOption[], e: Event) => void)|null = null;\n\n /**\n * In a flyout, the target workspace where blocks should be placed after a\n * drag. Otherwise null.\n *\n * @internal\n */\n targetWorkspace: WorkspaceSvg|null = null;\n\n /** Inverted screen CTM, for use in mouseToSvg. */\n private inverseScreenCTM_: SVGMatrix|null = null;\n\n /** Inverted screen CTM is dirty, recalculate it. */\n private inverseScreenCTMDirty_ = true;\n private metricsManager_: IMetricsManager;\n /** @internal */\n getMetrics: () => Metrics;\n /** @internal */\n setMetrics: (p1: {x?: number, y?: number}) => void;\n private readonly componentManager_: ComponentManager;\n\n /**\n * List of currently highlighted blocks. Block highlighting is often used\n * to visually mark blocks currently being executed.\n */\n private readonly highlightedBlocks_: BlockSvg[] = [];\n private audioManager_: WorkspaceAudio;\n private grid_: Grid|null;\n private markerManager_: MarkerManager;\n\n /**\n * Map from function names to callbacks, for deciding what to do when a\n * custom toolbox category is opened.\n */\n private toolboxCategoryCallbacks =\n new Map<string, (p1: WorkspaceSvg) => toolbox.FlyoutDefinition>();\n\n /**\n * Map from function names to callbacks, for deciding what to do when a\n * button is clicked.\n */\n private flyoutButtonCallbacks = new Map<string, (p1: FlyoutButton) => void>();\n protected themeManager_: ThemeManager;\n private readonly renderer_: Renderer;\n\n /** Cached parent SVG. */\n private cachedParentSvg_: SVGElement|null = null;\n\n /** True if keyboard accessibility mode is on, false otherwise. */\n keyboardAccessibilityMode = false;\n\n /** The list of top-level bounded elements on the workspace. */\n private topBoundedElements_: IBoundedElement[] = [];\n\n /** The recorded drag targets. */\n private dragTargetAreas_: Array<{component: IDragTarget, clientRect: Rect}> =\n [];\n private readonly cachedParentSvgSize_: Size;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n svgGroup_!: SVGElement;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n svgBackground_!: SVGElement;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n svgBlockCanvas_!: SVGElement;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n svgBubbleCanvas_!: SVGElement;\n zoomControls_: ZoomControls|null = null;\n\n /**\n * @param options Dictionary of options.\n * @param opt_blockDragSurface Drag surface for blocks.\n * @param opt_wsDragSurface Drag surface for the workspace.\n */\n constructor(\n options: Options, opt_blockDragSurface?: BlockDragSurfaceSvg,\n opt_wsDragSurface?: WorkspaceDragSurfaceSvg) {\n super(options);\n\n const MetricsManagerClass = registry.getClassFromOptions(\n registry.Type.METRICS_MANAGER, options, true);\n /** Object in charge of calculating metrics for the workspace. */\n this.metricsManager_ = new MetricsManagerClass!(this);\n\n /** Method to get all the metrics that have to do with a workspace. */\n this.getMetrics = options.getMetrics ||\n this.metricsManager_.getMetrics.bind(this.metricsManager_);\n\n /** Translates the workspace. */\n this.setMetrics =\n options.setMetrics || WorkspaceSvg.setTopLevelWorkspaceMetrics_;\n\n this.componentManager_ = new ComponentManager();\n\n this.connectionDBList = ConnectionDB.init(this.connectionChecker);\n\n if (opt_blockDragSurface) {\n this.blockDragSurface_ = opt_blockDragSurface;\n }\n\n if (opt_wsDragSurface) {\n this.workspaceDragSurface_ = opt_wsDragSurface;\n }\n\n this.useWorkspaceDragSurface_ = !!this.workspaceDragSurface_;\n\n /**\n * Object in charge of loading, storing, and playing audio for a workspace.\n */\n this.audioManager_ =\n new WorkspaceAudio((options.parentWorkspace as WorkspaceSvg));\n\n /** This workspace's grid object or null. */\n this.grid_ = this.options.gridPattern ?\n new Grid(this.options.gridPattern, options.gridOptions) :\n null;\n\n /** Manager in charge of markers and cursors. */\n this.markerManager_ = new MarkerManager(this);\n\n if (Variables && Variables.flyoutCategory) {\n this.registerToolboxCategoryCallback(\n Variables.CATEGORY_NAME, Variables.flyoutCategory);\n }\n\n if (VariablesDynamic && VariablesDynamic.flyoutCategory) {\n this.registerToolboxCategoryCallback(\n VariablesDynamic.CATEGORY_NAME, VariablesDynamic.flyoutCategory);\n }\n\n if (Procedures && Procedures.flyoutCategory) {\n this.registerToolboxCategoryCallback(\n Procedures.CATEGORY_NAME, Procedures.flyoutCategory);\n this.addChangeListener(Procedures.mutatorOpenListener);\n }\n\n /** Object in charge of storing and updating the workspace theme. */\n this.themeManager_ = this.options.parentWorkspace ?\n this.options.parentWorkspace.getThemeManager() :\n new ThemeManager(this, this.options.theme || Classic);\n this.themeManager_.subscribeWorkspace(this);\n\n /** The block renderer used for rendering blocks on this workspace. */\n this.renderer_ = blockRendering.init(\n this.options.renderer || 'geras', this.getTheme(),\n this.options.rendererOverrides ?? undefined);\n\n /**\n * The cached size of the parent svg element.\n * Used to compute svg metrics.\n */\n this.cachedParentSvgSize_ = new Size(0, 0);\n }\n\n /**\n * Get the marker manager for this workspace.\n *\n * @returns The marker manager.\n */\n getMarkerManager(): MarkerManager {\n return this.markerManager_;\n }\n\n /**\n * Gets the metrics manager for this workspace.\n *\n * @returns The metrics manager.\n */\n getMetricsManager(): IMetricsManager {\n return this.metricsManager_;\n }\n\n /**\n * Sets the metrics manager for the workspace.\n *\n * @param metricsManager The metrics manager.\n * @internal\n */\n setMetricsManager(metricsManager: IMetricsManager) {\n this.metricsManager_ = metricsManager;\n this.getMetrics =\n this.metricsManager_.getMetrics.bind(this.metricsManager_);\n }\n\n /**\n * Gets the component manager for this workspace.\n *\n * @returns The component manager.\n */\n getComponentManager(): ComponentManager {\n return this.componentManager_;\n }\n\n /**\n * Add the cursor SVG to this workspaces SVG group.\n *\n * @param cursorSvg The SVG root of the cursor to be added to the workspace\n * SVG group.\n * @internal\n */\n setCursorSvg(cursorSvg: SVGElement) {\n this.markerManager_.setCursorSvg(cursorSvg);\n }\n\n /**\n * Add the marker SVG to this workspaces SVG group.\n *\n * @param markerSvg The SVG root of the marker to be added to the workspace\n * SVG group.\n * @internal\n */\n setMarkerSvg(markerSvg: SVGElement) {\n this.markerManager_.setMarkerSvg(markerSvg);\n }\n\n /**\n * Get the marker with the given ID.\n *\n * @param id The ID of the marker.\n * @returns The marker with the given ID or null if no marker with the given\n * ID exists.\n * @internal\n */\n getMarker(id: string): Marker|null {\n if (this.markerManager_) {\n return this.markerManager_.getMarker(id);\n }\n return null;\n }\n\n /**\n * The cursor for this workspace.\n *\n * @returns The cursor for the workspace.\n */\n getCursor(): Cursor|null {\n if (this.markerManager_) {\n return this.markerManager_.getCursor();\n }\n return null;\n }\n\n /**\n * Get the block renderer attached to this workspace.\n *\n * @returns The renderer attached to this workspace.\n */\n getRenderer(): Renderer {\n return this.renderer_;\n }\n\n /**\n * Get the theme manager for this workspace.\n *\n * @returns The theme manager for this workspace.\n * @internal\n */\n getThemeManager(): ThemeManager {\n return this.themeManager_;\n }\n\n /**\n * Get the workspace theme object.\n *\n * @returns The workspace theme object.\n */\n getTheme(): Theme {\n return this.themeManager_.getTheme();\n }\n\n /**\n * Set the workspace theme object.\n * If no theme is passed, default to the `Classic` theme.\n *\n * @param theme The workspace theme object.\n */\n setTheme(theme: Theme) {\n if (!theme) {\n theme = Classic as Theme;\n }\n this.themeManager_.setTheme(theme);\n }\n\n /**\n * Refresh all blocks on the workspace after a theme update.\n */\n refreshTheme() {\n if (this.svgGroup_) {\n this.renderer_.refreshDom(this.svgGroup_, this.getTheme());\n }\n\n // Update all blocks in workspace that have a style name.\n this.updateBlockStyles_(this.getAllBlocks(false).filter(function(block) {\n return !!block.getStyleName();\n }));\n\n // Update current toolbox selection.\n this.refreshToolboxSelection();\n if (this.toolbox_) {\n this.toolbox_.refreshTheme();\n }\n\n // Re-render if workspace is visible\n if (this.isVisible()) {\n this.setVisible(true);\n }\n\n const event = new (eventUtils.get(eventUtils.THEME_CHANGE))(\n this.getTheme().name, this.id);\n eventUtils.fire(event);\n }\n\n /**\n * Updates all the blocks with new style.\n *\n * @param blocks List of blocks to update the style on.\n */\n private updateBlockStyles_(blocks: Block[]) {\n for (let i = 0, block; block = blocks[i]; i++) {\n const blockStyleName = block.getStyleName();\n if (blockStyleName) {\n const blockSvg = block as BlockSvg;\n blockSvg.setStyle(blockStyleName);\n if (blockSvg.mutator) {\n blockSvg.mutator.updateBlockStyle();\n }\n }\n }\n }\n\n /**\n * Getter for the inverted screen CTM.\n *\n * @returns The matrix to use in mouseToSvg\n */\n getInverseScreenCTM(): SVGMatrix|null {\n // Defer getting the screen CTM until we actually need it, this should\n // avoid forced reflows from any calls to updateInverseScreenCTM.\n if (this.inverseScreenCTMDirty_) {\n const ctm = this.getParentSvg().getScreenCTM();\n if (ctm) {\n this.inverseScreenCTM_ = (ctm).inverse();\n this.inverseScreenCTMDirty_ = false;\n }\n }\n\n return this.inverseScreenCTM_;\n }\n\n /** Mark the inverse screen CTM as dirty. */\n updateInverseScreenCTM() {\n this.inverseScreenCTMDirty_ = true;\n }\n\n /**\n * Getter for isVisible\n *\n * @returns Whether the workspace is visible.\n * False if the workspace has been hidden by calling `setVisible(false)`.\n */\n isVisible(): boolean {\n return this.isVisible_;\n }\n\n /**\n * Return the absolute coordinates of the top-left corner of this element,\n * scales that after canvas SVG element, if it's a descendant.\n * The origin (0,0) is the top-left corner of the Blockly SVG.\n *\n * @param element SVG element to find the coordinates of.\n * @returns Object with .x and .y properties.\n * @internal\n */\n getSvgXY(element: SVGElement): Coordinate {\n let x = 0;\n let y = 0;\n let scale = 1;\n if (dom.containsNode(this.getCanvas(), element) ||\n dom.containsNode(this.getBubbleCanvas(), element)) {\n // Before the SVG canvas, scale the coordinates.\n scale = this.scale;\n }\n do {\n // Loop through this block and every parent.\n const xy = svgMath.getRelativeXY(element);\n if (element === this.getCanvas() || element === this.getBubbleCanvas()) {\n // After the SVG canvas, don't scale the coordinates.\n scale = 1;\n }\n x += xy.x * scale;\n y += xy.y * scale;\n element = element.parentNode as SVGElement;\n } while (element && element !== this.getParentSvg());\n return new Coordinate(x, y);\n }\n\n /**\n * Gets the size of the workspace's parent SVG element.\n *\n * @returns The cached width and height of the workspace's parent SVG element.\n * @internal\n */\n getCachedParentSvgSize(): Size {\n const size = this.cachedParentSvgSize_;\n return new Size(size.width, size.height);\n }\n\n /**\n * Return the position of the workspace origin relative to the injection div\n * origin in pixels.\n * The workspace origin is where a block would render at position (0, 0).\n * It is not the upper left corner of the workspace SVG.\n *\n * @returns Offset in pixels.\n * @internal\n */\n getOriginOffsetInPixels(): Coordinate {\n return svgMath.getInjectionDivXY(this.getCanvas());\n }\n\n /**\n * Return the injection div that is a parent of this workspace.\n * Walks the DOM the first time it's called, then returns a cached value.\n * Note: We assume this is only called after the workspace has been injected\n * into the DOM.\n *\n * @returns The first parent div with 'injectionDiv' in the name.\n * @internal\n */\n getInjectionDiv(): Element {\n // NB: it would be better to pass this in at createDom, but is more likely\n // to break existing uses of Blockly.\n if (!this.injectionDiv_) {\n let element: Element = this.svgGroup_;\n while (element) {\n const classes = element.getAttribute('class') || '';\n if ((' ' + classes + ' ').indexOf(' injectionDiv ') !== -1) {\n this.injectionDiv_ = element;\n break;\n }\n element = element.parentNode as Element;\n }\n }\n return this.injectionDiv_!;\n }\n\n /**\n * Get the SVG block canvas for the workspace.\n *\n * @returns The SVG group for the workspace.\n * @internal\n */\n getBlockCanvas(): SVGElement|null {\n return this.svgBlockCanvas_;\n }\n\n /**\n * Save resize handler data so we can delete it later in dispose.\n *\n * @param handler Data that can be passed to eventHandling.unbind.\n */\n setResizeHandlerWrapper(handler: browserEvents.Data) {\n this.resizeHandlerWrapper_ = handler;\n }\n\n /**\n * Create the workspace DOM elements.\n *\n * @param opt_backgroundClass Either 'blocklyMainBackground' or\n * 'blocklyMutatorBackground'.\n * @returns The workspace's SVG group.\n */\n createDom(opt_backgroundClass?: string): Element {\n /**\n * <g class=\"blocklyWorkspace\">\n * <rect class=\"blocklyMainBackground\" height=\"100%\" width=\"100%\"></rect>\n * [Trashcan and/or flyout may go here]\n * <g class=\"blocklyBlockCanvas\"></g>\n * <g class=\"blocklyBubbleCanvas\"></g>\n * </g>\n */\n this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': 'blocklyWorkspace'});\n\n // Note that a <g> alone does not receive mouse events--it must have a\n // valid target inside it. If no background class is specified, as in the\n // flyout, the workspace will not receive mouse events.\n if (opt_backgroundClass) {\n this.svgBackground_ = dom.createSvgElement(\n Svg.RECT,\n {'height': '100%', 'width': '100%', 'class': opt_backgroundClass},\n this.svgGroup_);\n\n if (opt_backgroundClass === 'blocklyMainBackground' && this.grid_) {\n this.svgBackground_.style.fill =\n 'url(#' + this.grid_.getPatternId() + ')';\n } else {\n this.themeManager_.subscribe(\n this.svgBackground_, 'workspaceBackgroundColour', 'fill');\n }\n }\n this.svgBlockCanvas_ = dom.createSvgElement(\n Svg.G, {'class': 'blocklyBlockCanvas'}, this.svgGroup_);\n this.svgBubbleCanvas_ = dom.createSvgElement(\n Svg.G, {'class': 'blocklyBubbleCanvas'}, this.svgGroup_);\n\n if (!this.isFlyout) {\n browserEvents.conditionalBind(\n this.svgGroup_, 'mousedown', this, this.onMouseDown_, false, true);\n // This no-op works around https://bugs.webkit.org/show_bug.cgi?id=226683,\n // which otherwise prevents zoom/scroll events from being observed in\n // Safari. Once that bug is fixed it should be removed.\n document.body.addEventListener('wheel', function() {});\n browserEvents.conditionalBind(\n this.svgGroup_, 'wheel', this, this.onMouseWheel_);\n }\n\n // Determine if there needs to be a category tree, or a simple list of\n // blocks. This cannot be changed later, since the UI is very different.\n if (this.options.hasCategories) {\n const ToolboxClass = registry.getClassFromOptions(\n registry.Type.TOOLBOX, this.options, true);\n this.toolbox_ = new ToolboxClass!(this);\n }\n if (this.grid_) {\n this.grid_.update(this.scale);\n }\n this.recordDragTargets();\n const CursorClass =\n registry.getClassFromOptions(registry.Type.CURSOR, this.options);\n\n CursorClass && this.markerManager_.setCursor(new CursorClass());\n\n this.renderer_.createDom(this.svgGroup_, this.getTheme());\n return this.svgGroup_;\n }\n\n /**\n * Dispose of this workspace.\n * Unlink from all DOM elements to prevent memory leaks.\n *\n * @suppress {checkTypes}\n */\n override dispose() {\n // Stop rerendering.\n this.rendered = false;\n if (this.currentGesture_) {\n this.currentGesture_.cancel();\n }\n if (this.svgGroup_) {\n dom.removeNode(this.svgGroup_);\n }\n if (this.toolbox_) {\n this.toolbox_.dispose();\n this.toolbox_ = null;\n }\n if (this.flyout_) {\n this.flyout_.dispose();\n this.flyout_ = null;\n }\n if (this.trashcan) {\n this.trashcan.dispose();\n this.trashcan = null;\n }\n if (this.scrollbar) {\n this.scrollbar.dispose();\n this.scrollbar = null;\n }\n if (this.zoomControls_) {\n this.zoomControls_.dispose();\n }\n\n if (this.audioManager_) {\n this.audioManager_.dispose();\n }\n\n if (this.grid_) {\n this.grid_ = null;\n }\n\n this.renderer_.dispose();\n\n if (this.markerManager_) {\n this.markerManager_.dispose();\n }\n\n super.dispose();\n\n // Dispose of theme manager after all blocks and mutators are disposed of.\n if (this.themeManager_) {\n this.themeManager_.unsubscribeWorkspace(this);\n this.themeManager_.unsubscribe(this.svgBackground_);\n if (!this.options.parentWorkspace) {\n this.themeManager_.dispose();\n }\n }\n\n this.connectionDBList.length = 0;\n\n this.toolboxCategoryCallbacks.clear();\n this.flyoutButtonCallbacks.clear();\n\n if (!this.options.parentWorkspace) {\n // Top-most workspace. Dispose of the div that the\n // SVG is injected into (i.e. injectionDiv).\n const parentSvg = this.getParentSvg();\n if (parentSvg && parentSvg.parentNode) {\n dom.removeNode(parentSvg.parentNode);\n }\n }\n if (this.resizeHandlerWrapper_) {\n browserEvents.unbind(this.resizeHandlerWrapper_);\n this.resizeHandlerWrapper_ = null;\n }\n }\n\n /**\n * Add a trashcan.\n *\n * @internal\n */\n addTrashcan() {\n this.trashcan = WorkspaceSvg.newTrashcan(this);\n const svgTrashcan = this.trashcan.createDom();\n this.svgGroup_.insertBefore(svgTrashcan, this.svgBlockCanvas_);\n }\n\n /**\n * @param _workspace\n * @internal\n */\n static newTrashcan(_workspace: WorkspaceSvg): Trashcan {\n throw new Error(\n 'The implementation of newTrashcan should be ' +\n 'monkey-patched in by blockly.ts');\n }\n\n /**\n * Add zoom controls.\n *\n * @internal\n */\n addZoomControls() {\n this.zoomControls_ = new ZoomControls(this);\n const svgZoomControls = this.zoomControls_.createDom();\n this.svgGroup_.appendChild(svgZoomControls);\n }\n\n /**\n * Add a flyout element in an element with the given tag name.\n *\n * @param tagName What type of tag the flyout belongs in.\n * @returns The element containing the flyout DOM.\n * @internal\n */\n addFlyout(tagName: string|Svg<SVGSVGElement>|Svg<SVGGElement>): Element {\n const workspaceOptions = new Options(({\n 'parentWorkspace': this,\n 'rtl': this.RTL,\n 'oneBasedIndex': this.options.oneBasedIndex,\n 'horizontalLayout': this.horizontalLayout,\n 'renderer': this.options.renderer,\n 'rendererOverrides': this.options.rendererOverrides,\n 'move': {\n 'scrollbars': true,\n },\n } as BlocklyOptions));\n workspaceOptions.toolboxPosition = this.options.toolboxPosition;\n if (this.horizontalLayout) {\n const HorizontalFlyout = registry.getClassFromOptions(\n registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, this.options, true);\n this.flyout_ = new HorizontalFlyout!(workspaceOptions);\n } else {\n const VerticalFlyout = registry.getClassFromOptions(\n registry.Type.FLYOUTS_VERTICAL_TOOLBOX, this.options, true);\n this.flyout_ = new VerticalFlyout!(workspaceOptions);\n }\n this.flyout_.autoClose = false;\n this.flyout_.getWorkspace().setVisible(true);\n\n // Return the element so that callers can place it in their desired\n // spot in the DOM. For example, mutator flyouts do not go in the same\n // place as main workspace flyouts.\n return this.flyout_.createDom(tagName);\n }\n\n /**\n * Getter for the flyout associated with this workspace. This flyout may be\n * owned by either the toolbox or the workspace, depending on toolbox\n * configuration. It will be null if there is no flyout.\n *\n * @param opt_own Whether to only return the workspace's own flyout.\n * @returns The flyout on this workspace.\n * @internal\n */\n getFlyout(opt_own?: boolean): IFlyout|null {\n if (this.flyout_ || opt_own) {\n return this.flyout_;\n }\n if (this.toolbox_) {\n return this.toolbox_.getFlyout();\n }\n return null;\n }\n\n /**\n * Getter for the toolbox associated with this workspace, if one exists.\n *\n * @returns The toolbox on this workspace.\n * @internal\n */\n getToolbox(): IToolbox|null {\n return this.toolbox_;\n }\n\n /**\n * Update items that use screen coordinate calculations\n * because something has changed (e.g. scroll position, window size).\n */\n private updateScreenCalculations_() {\n this.updateInverseScreenCTM();\n this.recordDragTargets();\n }\n\n /**\n * If enabled, resize the parts of the workspace that change when the\n * workspace contents (e.g. block positions) change. This will also scroll\n * the workspace contents if needed.\n *\n * @internal\n */\n resizeContents() {\n if (!this.resizesEnabled_ || !this.rendered) {\n return;\n }\n if (this.scrollbar) {\n this.scrollbar.resize();\n }\n this.updateInverseScreenCTM();\n }\n\n /**\n * Resize and reposition all of the workspace chrome (toolbox,\n * trash, scrollbars etc.)\n * This should be called when something changes that\n * requires recalculating dimensions and positions of the\n * trash, zoom, toolbox, etc. (e.g. window resize).\n */\n resize() {\n if (this.toolbox_) {\n this.toolbox_.position();\n }\n if (this.flyout_) {\n this.flyout_.position();\n }\n\n const positionables = this.componentManager_.getComponents(\n ComponentManager.Capability.POSITIONABLE, true);\n const metrics = this.getMetricsManager().getUiMetrics();\n const savedPositions = [];\n for (let i = 0, positionable; positionable = positionables[i]; i++) {\n positionable.position(metrics, savedPositions);\n const boundingRect = positionable.getBoundingRectangle();\n if (boundingRect) {\n savedPositions.push(boundingRect);\n }\n }\n\n if (this.scrollbar) {\n this.scrollbar.resize();\n }\n this.updateScreenCalculations_();\n }\n\n /**\n * Resizes and repositions workspace chrome if the page has a new\n * scroll position.\n *\n * @internal\n */\n updateScreenCalculationsIfScrolled() {\n /* eslint-disable indent */\n const currScroll = svgMath.getDocumentScroll();\n if (!Coordinate.equals(this.lastRecordedPageScroll_, currScroll)) {\n this.lastRecordedPageScroll_ = currScroll;\n this.updateScreenCalculations_();\n }\n }\n /* eslint-enable indent */\n\n /**\n * Get the SVG element that forms the drawing surface.\n *\n * @returns SVG group element.\n */\n getCanvas(): SVGGElement {\n return this.svgBlockCanvas_ as SVGGElement;\n }\n\n /**\n * Caches the width and height of the workspace's parent SVG element for use\n * with getSvgMetrics.\n *\n * @param width The width of the parent SVG element.\n * @param height The height of the parent SVG element\n * @internal\n */\n setCachedParentSvgSize(width: number|null, height: number|null) {\n const svg = this.getParentSvg();\n if (width != null) {\n this.cachedParentSvgSize_.width = width;\n // This is set to support the public (but deprecated) Blockly.svgSize\n // method.\n svg.setAttribute('data-cached-width', width.toString());\n }\n if (height != null) {\n this.cachedParentSvgSize_.height = height;\n // This is set to support the public (but deprecated) Blockly.svgSize\n // method.\n svg.setAttribute('data-cached-height', height.toString());\n }\n }\n\n /**\n * Get the SVG element that forms the bubble surface.\n *\n * @returns SVG group element.\n */\n getBubbleCanvas(): SVGGElement {\n return this.svgBubbleCanvas_ as SVGGElement;\n }\n\n /**\n * Get the SVG element that contains this workspace.\n * Note: We assume this is only called after the workspace has been injected\n * into the DOM.\n *\n * @returns SVG element.\n */\n getParentSvg(): SVGSVGElement {\n if (!this.cachedParentSvg_) {\n let element = this.svgGroup_;\n while (element) {\n if (element.tagName === 'svg') {\n this.cachedParentSvg_ = element;\n break;\n }\n element = element.parentNode as SVGSVGElement;\n }\n }\n return this.cachedParentSvg_ as SVGSVGElement;\n }\n\n /**\n * Fires a viewport event if events are enabled and there is a change in\n * viewport values.\n *\n * @internal\n */\n maybeFireViewportChangeEvent() {\n if (!eventUtils.isEnabled()) {\n return;\n }\n const scale = this.scale;\n const top = -this.scrollY;\n const left = -this.scrollX;\n if (scale === this.oldScale_ && Math.abs(top - this.oldTop_) < 1 &&\n Math.abs(left - this.oldLeft_) < 1) {\n // Ignore sub-pixel changes in top and left. Due to #4192 there are a lot\n // of negligible changes in viewport top/left.\n return;\n }\n const event = new (eventUtils.get(eventUtils.VIEWPORT_CHANGE))(\n top, left, scale, this.id, this.oldScale_);\n this.oldScale_ = scale;\n this.oldTop_ = top;\n this.oldLeft_ = left;\n eventUtils.fire(event);\n }\n\n /**\n * Translate this workspace to new coordinates.\n *\n * @param x Horizontal translation, in pixel units relative to the top left of\n * the Blockly div.\n * @param y Vertical translation, in pixel units relative to the top left of\n * the Blockly div.\n */\n translate(x: number, y: number) {\n if (this.useWorkspaceDragSurface_ && this.isDragSurfaceActive_) {\n this.workspaceDragSurface_?.translateSurface(x, y);\n } else {\n const translation = 'translate(' + x + ',' + y + ') ' +\n 'scale(' + this.scale + ')';\n this.svgBlockCanvas_.setAttribute('transform', translation);\n this.svgBubbleCanvas_.setAttribute('transform', translation);\n }\n // Now update the block drag surface if we're using one.\n if (this.blockDragSurface_) {\n this.blockDragSurface_.translateAndScaleGroup(x, y, this.scale);\n }\n // And update the grid if we're using one.\n if (this.grid_) {\n this.grid_.moveTo(x, y);\n }\n\n this.maybeFireViewportChangeEvent();\n }\n\n /**\n * Called at the end of a workspace drag to take the contents\n * out of the drag surface and put them back into the workspace SVG.\n * Does nothing if the workspace drag surface is not enabled.\n *\n * @internal\n */\n resetDragSurface() {\n // Don't do anything if we aren't using a drag surface.\n if (!this.useWorkspaceDragSurface_) {\n return;\n }\n\n this.isDragSurfaceActive_ = false;\n\n const trans = this.workspaceDragSurface_!.getSurfaceTranslation();\n this.workspaceDragSurface_!.clearAndHide(this.svgGroup_);\n const translation = 'translate(' + trans.x + ',' + trans.y + ') ' +\n 'scale(' + this.scale + ')';\n this.svgBlockCanvas_.setAttribute('transform', translation);\n this.svgBubbleCanvas_.setAttribute('transform', translation);\n }\n\n /**\n * Called at the beginning of a workspace drag to move contents of\n * the workspace to the drag surface.\n * Does nothing if the drag surface is not enabled.\n *\n * @internal\n */\n setupDragSurface() {\n // Don't do anything if we aren't using a drag surface.\n if (!this.useWorkspaceDragSurface_) {\n return;\n }\n\n // This can happen if the user starts a drag, mouses up outside of the\n // document where the mouseup listener is registered (e.g. outside of an\n // iframe) and then moves the mouse back in the workspace. On mobile and\n // ff, we get the mouseup outside the frame. On chrome and safari desktop we\n // do not.\n if (this.isDragSurfaceActive_) {\n return;\n }\n\n this.isDragSurfaceActive_ = true;\n\n // Figure out where we want to put the canvas back. The order\n // in the is important because things are layered.\n const previousElement = this.svgBlockCanvas_.previousSibling as Element;\n const width = parseInt(this.getParentSvg().getAttribute('width') ?? '0');\n const height = parseInt(this.getParentSvg().getAttribute('height') ?? '0');\n const coord = svgMath.getRelativeXY(this.getCanvas());\n this.workspaceDragSurface_!.setContentsAndShow(\n this.getCanvas(), this.getBubbleCanvas(), previousElement, width,\n height, this.scale);\n this.workspaceDragSurface_!.translateSurface(coord.x, coord.y);\n }\n\n /**\n * Gets the drag surface blocks are moved to when a drag is started.\n *\n * @returns This workspace's block drag surface, if one is in use.\n * @internal\n */\n getBlockDragSurface(): BlockDragSurfaceSvg|null {\n return this.blockDragSurface_;\n }\n\n /**\n * Returns the horizontal offset of the workspace.\n * Intended for LTR/RTL compatibility in XML.\n *\n * @returns Width.\n */\n override getWidth(): number {\n const metrics = this.getMetrics();\n return metrics ? metrics.viewWidth / this.scale : 0;\n }\n\n /**\n * Toggles the visibility of the workspace.\n * Currently only intended for main workspace.\n *\n * @param isVisible True if workspace should be visible.\n */\n setVisible(isVisible: boolean) {\n this.isVisible_ = isVisible;\n if (!this.svgGroup_) {\n return;\n }\n\n // Tell the scrollbar whether its container is visible so it can\n // tell when to hide itself.\n if (this.scrollbar) {\n this.scrollbar.setContainerVisible(isVisible);\n }\n\n // Tell the flyout whether its container is visible so it can\n // tell when to hide itself.\n if (this.getFlyout()) {\n this.getFlyout()!.setContainerVisible(isVisible);\n }\n\n this.getParentSvg().style.display = isVisible ? 'block' : 'none';\n if (this.toolbox_) {\n // Currently does not support toolboxes in mutators.\n this.toolbox_.setVisible(isVisible);\n }\n if (isVisible) {\n const blocks = this.getAllBlocks(false);\n // Tell each block on the workspace to mark its fields as dirty.\n for (let i = blocks.length - 1; i >= 0; i--) {\n blocks[i].markDirty();\n }\n\n this.render();\n if (this.toolbox_) {\n this.toolbox_.position();\n }\n } else {\n this.hideChaff(true);\n }\n }\n\n /** Render all blocks in workspace. */\n render() {\n // Generate list of all blocks.\n const blocks = this.getAllBlocks(false);\n // Render each block.\n for (let i = blocks.length - 1; i >= 0; i--) {\n blocks[i].render(false);\n }\n\n if (this.currentGesture_) {\n const imList = this.currentGesture_.getInsertionMarkers();\n for (let i = 0; i < imList.length; i++) {\n imList[i].render(false);\n }\n }\n\n this.markerManager_.updateMarkers();\n }\n\n /**\n * Highlight or unhighlight a block in the workspace. Block highlighting is\n * often used to visually mark blocks currently being executed.\n *\n * @param id ID of block to highlight/unhighlight, or null for no block (used\n * to unhighlight all blocks).\n * @param opt_state If undefined, highlight specified block and automatically\n * unhighlight all others. If true or false, manually\n * highlight/unhighlight the specified block.\n */\n highlightBlock(id: string|null, opt_state?: boolean) {\n if (opt_state === undefined) {\n // Unhighlight all blocks.\n for (let i = 0, block; block = this.highlightedBlocks_[i]; i++) {\n block.setHighlighted(false);\n }\n this.highlightedBlocks_.length = 0;\n }\n // Highlight/unhighlight the specified block.\n const block = id ? this.getBlockById(id) : null;\n if (block) {\n const state = opt_state === undefined || opt_state;\n // Using Set here would be great, but at the cost of IE10 support.\n if (!state) {\n arrayUtils.removeElem(this.highlightedBlocks_, block);\n } else if (this.highlightedBlocks_.indexOf(block) === -1) {\n this.highlightedBlocks_.push(block);\n }\n block.setHighlighted(state);\n }\n }\n\n /**\n * Pastes the provided block or workspace comment onto the workspace.\n * Does not check whether there is remaining capacity for the object, that\n * should be done before calling this method.\n *\n * @param state The representation of the thing to paste.\n * @returns The pasted thing, or null if the paste was not successful.\n */\n paste(state: AnyDuringMigration|Element|DocumentFragment): ICopyable|null {\n if (!this.rendered || !state['type'] && !state['tagName']) {\n return null;\n }\n if (this.currentGesture_) { // Dragging while pasting? No.\n this.currentGesture_.cancel();\n }\n\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n\n let pastedThing;\n // Checks if this is JSON. JSON has a type property, while elements don't.\n if (state['type']) {\n pastedThing = this.pasteBlock_(null, state as blocks.State);\n } else {\n const xmlBlock = state as Element;\n if (xmlBlock.tagName.toLowerCase() === 'comment') {\n pastedThing = this.pasteWorkspaceComment_(xmlBlock);\n } else {\n pastedThing = this.pasteBlock_(xmlBlock, null);\n }\n }\n\n eventUtils.setGroup(existingGroup);\n return pastedThing;\n }\n\n /**\n * Paste the provided block onto the workspace.\n *\n * @param xmlBlock XML block element.\n * @param jsonBlock JSON block representation.\n * @returns The pasted block.\n */\n private pasteBlock_(xmlBlock: Element|null, jsonBlock: blocks.State|null):\n BlockSvg {\n eventUtils.disable();\n let block: BlockSvg;\n try {\n let blockX = 0;\n let blockY = 0;\n if (xmlBlock) {\n block = Xml.domToBlock(xmlBlock, this) as BlockSvg;\n blockX = parseInt(xmlBlock.getAttribute('x') ?? '0');\n if (this.RTL) {\n blockX = -blockX;\n }\n blockY = parseInt(xmlBlock.getAttribute('y') ?? '0');\n } else if (jsonBlock) {\n block = blocks.append(jsonBlock, this) as BlockSvg;\n blockX = jsonBlock['x'] || 10;\n if (this.RTL) {\n blockX = this.getWidth() - blockX;\n }\n blockY = jsonBlock['y'] || 10;\n }\n\n // Move the duplicate to original position.\n if (!isNaN(blockX) && !isNaN(blockY)) {\n // Offset block until not clobbering another block and not in connection\n // distance with neighbouring blocks.\n let collide;\n do {\n collide = false;\n const allBlocks = this.getAllBlocks(false);\n for (let i = 0, otherBlock; otherBlock = allBlocks[i]; i++) {\n const otherXY = otherBlock.getRelativeToSurfaceXY();\n if (Math.abs(blockX - otherXY.x) <= 1 &&\n Math.abs(blockY - otherXY.y) <= 1) {\n collide = true;\n break;\n }\n }\n if (!collide) {\n // Check for blocks in snap range to any of its connections.\n const connections = block!.getConnections_(false);\n for (let i = 0, connection; connection = connections[i]; i++) {\n const neighbour =\n (connection)\n .closest(\n config.snapRadius, new Coordinate(blockX, blockY));\n if (neighbour.connection) {\n collide = true;\n break;\n }\n }\n }\n if (collide) {\n if (this.RTL) {\n blockX -= config.snapRadius;\n } else {\n blockX += config.snapRadius;\n }\n blockY += config.snapRadius * 2;\n }\n } while (collide);\n block!.moveTo(new Coordinate(blockX, blockY));\n }\n } finally {\n eventUtils.enable();\n }\n if (eventUtils.isEnabled() && !block!.isShadow()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CREATE))(block!));\n }\n block!.select();\n return block!;\n }\n\n /**\n * Paste the provided comment onto the workspace.\n *\n * @param xmlComment XML workspace comment element.\n * @returns The pasted workspace comment.\n * @suppress {checkTypes} Suppress checks while workspace comments are not\n * bundled in.\n */\n private pasteWorkspaceComment_(xmlComment: Element): WorkspaceCommentSvg {\n eventUtils.disable();\n let comment: WorkspaceCommentSvg;\n try {\n comment = WorkspaceCommentSvg.fromXmlRendered(xmlComment, this);\n // Move the duplicate to original position.\n let commentX = parseInt(xmlComment.getAttribute('x') ?? '0');\n let commentY = parseInt(xmlComment.getAttribute('y') ?? '0');\n if (!isNaN(commentX) && !isNaN(commentY)) {\n if (this.RTL) {\n commentX = -commentX;\n }\n // Offset workspace comment.\n // TODO (#1719): Properly offset comment such that it's not interfering\n // with any blocks.\n commentX += 50;\n commentY += 50;\n comment.moveBy(commentX, commentY);\n }\n } finally {\n eventUtils.enable();\n }\n if (eventUtils.isEnabled()) {\n WorkspaceComment.fireCreateEvent(comment);\n }\n comment.select();\n return comment;\n }\n\n /**\n * Refresh the toolbox unless there's a drag in progress.\n *\n * @internal\n */\n refreshToolboxSelection() {\n const ws = this.isFlyout ? this.targetWorkspace : this;\n if (ws && !ws.currentGesture_ && ws.toolbox_ && ws.toolbox_.getFlyout()) {\n ws.toolbox_.refreshSelection();\n }\n }\n\n /**\n * Rename a variable by updating its name in the variable map. Update the\n * flyout to show the renamed variable immediately.\n *\n * @param id ID of the variable to rename.\n * @param newName New variable name.\n */\n override renameVariableById(id: string, newName: string) {\n super.renameVariableById(id, newName);\n this.refreshToolboxSelection();\n }\n\n /**\n * Delete a variable by the passed in ID. Update the flyout to show\n * immediately that the variable is deleted.\n *\n * @param id ID of variable to delete.\n */\n override deleteVariableById(id: string) {\n super.deleteVariableById(id);\n this.refreshToolboxSelection();\n }\n\n /**\n * Create a new variable with the given name. Update the flyout to show the\n * new variable immediately.\n *\n * @param name The new variable's name.\n * @param opt_type The type of the variable like 'int' or 'string'.\n * Does not need to be unique. Field_variable can filter variables based\n * on their type. This will default to '' which is a specific type.\n * @param opt_id The unique ID of the variable. This will default to a UUID.\n * @returns The newly created variable.\n */\n override createVariable(\n name: string, opt_type?: string|null,\n opt_id?: string|null): VariableModel {\n const newVar = super.createVariable(name, opt_type, opt_id);\n this.refreshToolboxSelection();\n return newVar;\n }\n\n /** Make a list of all the delete areas for this workspace. */\n recordDragTargets() {\n const dragTargets = this.componentManager_.getComponents(\n ComponentManager.Capability.DRAG_TARGET, true);\n\n this.dragTargetAreas_ = [];\n for (let i = 0, targetArea; targetArea = dragTargets[i]; i++) {\n const rect = targetArea.getClientRect();\n if (rect) {\n this.dragTargetAreas_.push({\n component: targetArea,\n clientRect: rect,\n });\n }\n }\n }\n /* eslint-disable jsdoc/require-returns-check */\n /* eslint-disable @typescript-eslint/no-unused-vars */\n /**\n * Obtain a newly created block.\n *\n * @param prototypeName Name of the language object containing type-specific\n * functions for this block.\n * @param opt_id Optional ID. Use this ID if provided, otherwise create a new\n * ID.\n * @returns The created block.\n */\n override newBlock(prototypeName: string, opt_id?: string): BlockSvg {\n throw new Error(\n 'The implementation of newBlock should be ' +\n 'monkey-patched in by blockly.ts');\n }\n /* eslint-enable */\n\n /**\n * Returns the drag target the mouse event is over.\n *\n * @param e Mouse move event.\n * @returns Null if not over a drag target, or the drag target the event is\n * over.\n */\n getDragTarget(e: Event): IDragTarget|null {\n for (let i = 0, targetArea; targetArea = this.dragTargetAreas_[i]; i++) {\n if (targetArea.clientRect.contains(\n (e as AnyDuringMigration).clientX,\n (e as AnyDuringMigration).clientY)) {\n return targetArea.component;\n }\n }\n return null;\n }\n\n /**\n * Handle a mouse-down on SVG drawing surface.\n *\n * @param e Mouse down event.\n */\n private onMouseDown_(e: MouseEvent) {\n const gesture = this.getGesture(e);\n if (gesture) {\n gesture.handleWsStart(e, this);\n }\n }\n\n /**\n * Start tracking a drag of an object on this workspace.\n *\n * @param e Mouse down event.\n * @param xy Starting location of object.\n */\n startDrag(e: MouseEvent, xy: Coordinate) {\n // Record the starting offset between the bubble's location and the mouse.\n const point = browserEvents.mouseToSvg(\n e, this.getParentSvg(), this.getInverseScreenCTM());\n // Fix scale of mouse event.\n point.x /= this.scale;\n point.y /= this.scale;\n this.dragDeltaXY_ = Coordinate.difference(xy, point);\n }\n\n /**\n * Track a drag of an object on this workspace.\n *\n * @param e Mouse move event.\n * @returns New location of object.\n */\n moveDrag(e: MouseEvent): Coordinate {\n const point = browserEvents.mouseToSvg(\n e, this.getParentSvg(), this.getInverseScreenCTM());\n // Fix scale of mouse event.\n point.x /= this.scale;\n point.y /= this.scale;\n return Coordinate.sum((this.dragDeltaXY_!), point);\n }\n\n /**\n * Is the user currently dragging a block or scrolling the flyout/workspace?\n *\n * @returns True if currently dragging or scrolling.\n */\n isDragging(): boolean {\n return this.currentGesture_ !== null && this.currentGesture_.isDragging();\n }\n\n /**\n * Is this workspace draggable?\n *\n * @returns True if this workspace may be dragged.\n */\n isDraggable(): boolean {\n return this.options.moveOptions && this.options.moveOptions.drag;\n }\n\n /**\n * Is this workspace movable?\n *\n * This means the user can reposition the X Y coordinates of the workspace\n * through input. This can be through scrollbars, scroll wheel, dragging, or\n * through zooming with the scroll wheel or pinch (since the zoom is centered\n * on the mouse position). This does not include zooming with the zoom\n * controls since the X Y coordinates are decided programmatically.\n *\n * @returns True if the workspace is movable, false otherwise.\n */\n isMovable(): boolean {\n return this.options.moveOptions && !!this.options.moveOptions.scrollbars ||\n this.options.moveOptions && this.options.moveOptions.wheel ||\n this.options.moveOptions && this.options.moveOptions.drag ||\n this.options.zoomOptions && this.options.zoomOptions.wheel ||\n this.options.zoomOptions && this.options.zoomOptions.pinch;\n }\n\n /**\n * Is this workspace movable horizontally?\n *\n * @returns True if the workspace is movable horizontally, false otherwise.\n */\n isMovableHorizontally(): boolean {\n const hasScrollbars = !!this.scrollbar;\n return this.isMovable() &&\n (!hasScrollbars ||\n hasScrollbars && this.scrollbar!.canScrollHorizontally());\n }\n\n /**\n * Is this workspace movable vertically?\n *\n * @returns True if the workspace is movable vertically, false otherwise.\n */\n isMovableVertically(): boolean {\n const hasScrollbars = !!this.scrollbar;\n return this.isMovable() &&\n (!hasScrollbars ||\n hasScrollbars && this.scrollbar!.canScrollVertically());\n }\n\n /**\n * Handle a mouse-wheel on SVG drawing surface.\n *\n * @param e Mouse wheel event.\n */\n private onMouseWheel_(e: WheelEvent) {\n // Don't scroll or zoom anything if drag is in progress.\n if (Gesture.inProgress()) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n const canWheelZoom =\n this.options.zoomOptions && this.options.zoomOptions.wheel;\n const canWheelMove =\n this.options.moveOptions && this.options.moveOptions.wheel;\n if (!canWheelZoom && !canWheelMove) {\n return;\n }\n\n const scrollDelta = browserEvents.getScrollDeltaPixels(e);\n\n // Zoom should also be enabled by the command key on Mac devices,\n // but not super on Unix.\n let commandKey;\n if (userAgent.MAC) {\n commandKey = e.metaKey;\n }\n\n if (canWheelZoom && (e.ctrlKey || commandKey || !canWheelMove)) {\n // Zoom.\n // The vertical scroll distance that corresponds to a click of a zoom\n // button.\n const PIXELS_PER_ZOOM_STEP = 50;\n const delta = -scrollDelta.y / PIXELS_PER_ZOOM_STEP;\n const position = browserEvents.mouseToSvg(\n e, this.getParentSvg(), this.getInverseScreenCTM());\n this.zoom(position.x, position.y, delta);\n } else {\n // Scroll.\n let x = this.scrollX - scrollDelta.x;\n let y = this.scrollY - scrollDelta.y;\n\n if (e.shiftKey && !scrollDelta.x) {\n // Scroll horizontally (based on vertical scroll delta).\n // This is needed as for some browser/system combinations which do not\n // set deltaX.\n x = this.scrollX - scrollDelta.y;\n y = this.scrollY; // Don't scroll vertically.\n }\n this.scroll(x, y);\n }\n e.preventDefault();\n }\n\n /**\n * Calculate the bounding box for the blocks on the workspace.\n * Coordinate system: workspace coordinates.\n *\n * @returns Contains the position and size of the bounding box containing the\n * blocks on the workspace.\n */\n getBlocksBoundingBox(): Rect {\n const topElements = this.getTopBoundedElements();\n // There are no blocks, return empty rectangle.\n if (!topElements.length) {\n return new Rect(0, 0, 0, 0);\n }\n\n // Initialize boundary using the first block.\n const boundary = topElements[0].getBoundingRectangle();\n\n // Start at 1 since the 0th block was used for initialization.\n for (let i = 1; i < topElements.length; i++) {\n const topElement = topElements[i];\n if ((topElement as any).isInsertionMarker &&\n (topElement as any).isInsertionMarker()) {\n continue;\n }\n const blockBoundary = topElement.getBoundingRectangle();\n if (blockBoundary.top < boundary.top) {\n boundary.top = blockBoundary.top;\n }\n if (blockBoundary.bottom > boundary.bottom) {\n boundary.bottom = blockBoundary.bottom;\n }\n if (blockBoundary.left < boundary.left) {\n boundary.left = blockBoundary.left;\n }\n if (blockBoundary.right > boundary.right) {\n boundary.right = blockBoundary.right;\n }\n }\n return boundary;\n }\n\n /** Clean up the workspace by ordering all the blocks in a column. */\n cleanUp() {\n this.setResizesEnabled(false);\n eventUtils.setGroup(true);\n const topBlocks = this.getTopBlocks(true);\n let cursorY = 0;\n for (let i = 0, block; block = topBlocks[i]; i++) {\n if (!block.isMovable()) {\n continue;\n }\n const xy = block.getRelativeToSurfaceXY();\n block.moveBy(-xy.x, cursorY - xy.y);\n block.snapToGrid();\n cursorY = block.getRelativeToSurfaceXY().y +\n block.getHeightWidth().height +\n this.renderer_.getConstants().MIN_BLOCK_HEIGHT;\n }\n eventUtils.setGroup(false);\n this.setResizesEnabled(true);\n }\n\n /**\n * Show the context menu for the workspace.\n *\n * @param e Mouse event.\n * @internal\n */\n showContextMenu(e: Event) {\n if (this.options.readOnly || this.isFlyout) {\n return;\n }\n const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(\n ContextMenuRegistry.ScopeType.WORKSPACE, {workspace: this});\n\n // Allow the developer to add or modify menuOptions.\n if (this.configureContextMenu) {\n this.configureContextMenu(menuOptions, e);\n }\n\n ContextMenu.show(e, menuOptions, this.RTL);\n }\n\n /**\n * Modify the block tree on the existing toolbox.\n *\n * @param toolboxDef DOM tree of toolbox contents, string of toolbox contents,\n * or JSON representing toolbox definition.\n */\n updateToolbox(toolboxDef: toolbox.ToolboxDefinition|null) {\n const parsedToolboxDef = toolbox.convertToolboxDefToJson(toolboxDef);\n\n if (!parsedToolboxDef) {\n if (this.options.languageTree) {\n throw Error('Can\\'t nullify an existing toolbox.');\n }\n return; // No change (null to null).\n }\n if (!this.options.languageTree) {\n throw Error('Existing toolbox is null. Can\\'t create new toolbox.');\n }\n\n if (toolbox.hasCategories(parsedToolboxDef)) {\n if (!this.toolbox_) {\n throw Error('Existing toolbox has no categories. Can\\'t change mode.');\n }\n this.options.languageTree = parsedToolboxDef;\n this.toolbox_.render(parsedToolboxDef);\n } else {\n if (!this.flyout_) {\n throw Error('Existing toolbox has categories. Can\\'t change mode.');\n }\n this.options.languageTree = parsedToolboxDef;\n this.flyout_.show(parsedToolboxDef);\n }\n }\n\n /** Mark this workspace as the currently focused main workspace. */\n markFocused() {\n if (this.options.parentWorkspace) {\n this.options.parentWorkspace.markFocused();\n } else {\n common.setMainWorkspace(this);\n // We call e.preventDefault in many event handlers which means we\n // need to explicitly grab focus (e.g from a textarea) because\n // the browser will not do it for us. How to do this is browser\n // dependent.\n this.setBrowserFocus();\n }\n }\n\n /** Set the workspace to have focus in the browser. */\n private setBrowserFocus() {\n // Blur whatever was focused since explicitly grabbing focus below does not\n // work in Edge.\n // In IE, SVGs can't be blurred or focused. Check to make sure the current\n // focus can be blurred before doing so.\n // See https://github.com/google/blockly/issues/4440\n if (document.activeElement &&\n document.activeElement instanceof HTMLElement) {\n document.activeElement.blur();\n }\n try {\n // Focus the workspace SVG - this is for Chrome and Firefox.\n this.getParentSvg().focus({preventScroll: true});\n } catch (e) {\n // IE and Edge do not support focus on SVG elements. When that fails\n // above, get the injectionDiv (the workspace's parent) and focus that\n // instead. This doesn't work in Chrome.\n try {\n // In IE11, use setActive (which is IE only) so the page doesn't scroll\n // to the workspace gaining focus.\n (this.getParentSvg().parentElement as any).setActive();\n } catch (e) {\n // setActive support was discontinued in Edge so when that fails, call\n // focus instead.\n this.getParentSvg().parentElement!.focus({preventScroll: true});\n }\n }\n }\n\n /**\n * Zooms the workspace in or out relative to/centered on the given (x, y)\n * coordinate.\n *\n * @param x X coordinate of center, in pixel units relative to the top-left\n * corner of the parentSVG.\n * @param y Y coordinate of center, in pixel units relative to the top-left\n * corner of the parentSVG.\n * @param amount Amount of zooming. The formula for the new scale is newScale\n * = currentScale * (scaleSpeed^amount). scaleSpeed is set in the\n * workspace options. Negative amount values zoom out, and positive amount\n * values zoom in.\n */\n zoom(x: number, y: number, amount: number) {\n // Scale factor.\n const speed = this.options.zoomOptions.scaleSpeed;\n let scaleChange = Math.pow(speed, amount);\n const newScale = this.scale * scaleChange;\n if (this.scale === newScale) {\n return; // No change in zoom.\n }\n\n // Clamp scale within valid range.\n if (newScale > this.options.zoomOptions.maxScale) {\n scaleChange = this.options.zoomOptions.maxScale / this.scale;\n } else if (newScale < this.options.zoomOptions.minScale) {\n scaleChange = this.options.zoomOptions.minScale / this.scale;\n }\n\n // Transform the x/y coordinates from the parentSVG's space into the\n // canvas' space, so that they are in workspace units relative to the top\n // left of the visible portion of the workspace.\n let matrix = this.getCanvas().getCTM();\n let center = (this.getParentSvg()).createSVGPoint();\n center.x = x;\n center.y = y;\n center = center.matrixTransform(matrix!.inverse());\n x = center.x;\n y = center.y;\n\n // Find the new scrollX/scrollY so that the center remains in the same\n // position (relative to the center) after we zoom.\n // newScale and matrix.a should be identical (within a rounding error).\n matrix = matrix!.translate(x * (1 - scaleChange), y * (1 - scaleChange))\n .scale(scaleChange);\n // scrollX and scrollY are in pixels.\n // The scrollX and scrollY still need to have absoluteLeft and absoluteTop\n // subtracted from them, but we'll leave that for setScale so that they're\n // correctly updated for the new flyout size if we have a simple toolbox.\n this.scrollX = matrix.e;\n this.scrollY = matrix.f;\n this.setScale(newScale);\n }\n\n /**\n * Zooming the blocks centered in the center of view with zooming in or out.\n *\n * @param type Type of zooming (-1 zooming out and 1 zooming in).\n */\n zoomCenter(type: number) {\n const metrics = this.getMetrics();\n let x;\n let y;\n if (this.flyout_) {\n // If you want blocks in the center of the view (visible portion of the\n // workspace) to stay centered when the size of the view decreases (i.e.\n // when the size of the flyout increases) you need the center of the\n // *blockly div* to stay in the same pixel-position.\n // Note: This only works because of how scrollCenter positions blocks.\n x = metrics.svgWidth ? metrics.svgWidth / 2 : 0;\n y = metrics.svgHeight ? metrics.svgHeight / 2 : 0;\n } else {\n x = metrics.viewWidth / 2 + metrics.absoluteLeft;\n y = metrics.viewHeight / 2 + metrics.absoluteTop;\n }\n this.zoom(x, y, type);\n }\n\n /** Zoom the blocks to fit in the workspace if possible. */\n zoomToFit() {\n if (!this.isMovable()) {\n console.warn(\n 'Tried to move a non-movable workspace. This could result' +\n ' in blocks becoming inaccessible.');\n return;\n }\n\n const metrics = this.getMetrics();\n let workspaceWidth = metrics.viewWidth;\n let workspaceHeight = metrics.viewHeight;\n const blocksBox = this.getBlocksBoundingBox();\n const doubleMargin = ZOOM_TO_FIT_MARGIN * 2;\n let blocksWidth = blocksBox.right - blocksBox.left + doubleMargin;\n let blocksHeight = blocksBox.bottom - blocksBox.top + doubleMargin;\n if (!blocksWidth) {\n return; // Prevents zooming to infinity.\n }\n if (this.flyout_) {\n // We have to add the flyout size to both the workspace size and the\n // block size because the blocks we want to resize include the blocks in\n // the flyout, and the area we want to fit them includes the portion of\n // the workspace that is behind the flyout.\n if (this.horizontalLayout) {\n workspaceHeight += this.flyout_.getHeight();\n // Convert from pixels to workspace coordinates.\n blocksHeight += this.flyout_.getHeight() / this.scale;\n } else {\n workspaceWidth += this.flyout_.getWidth();\n // Convert from pixels to workspace coordinates.\n blocksWidth += this.flyout_.getWidth() / this.scale;\n }\n }\n\n // Scale Units: (pixels / workspaceUnit)\n const ratioX = workspaceWidth / blocksWidth;\n const ratioY = workspaceHeight / blocksHeight;\n eventUtils.disable();\n try {\n this.setScale(Math.min(ratioX, ratioY));\n this.scrollCenter();\n } finally {\n eventUtils.enable();\n }\n this.maybeFireViewportChangeEvent();\n }\n\n /**\n * Add a transition class to the block and bubble canvas, to animate any\n * transform changes.\n *\n * @internal\n */\n beginCanvasTransition() {\n dom.addClass(this.svgBlockCanvas_, 'blocklyCanvasTransitioning');\n dom.addClass(this.svgBubbleCanvas_, 'blocklyCanvasTransitioning');\n }\n\n /**\n * Remove transition class from the block and bubble canvas.\n *\n * @internal\n */\n endCanvasTransition() {\n dom.removeClass(this.svgBlockCanvas_, 'blocklyCanvasTransitioning');\n dom.removeClass(this.svgBubbleCanvas_, 'blocklyCanvasTransitioning');\n }\n\n /** Center the workspace. */\n scrollCenter() {\n if (!this.isMovable()) {\n console.warn(\n 'Tried to move a non-movable workspace. This could result' +\n ' in blocks becoming inaccessible.');\n return;\n }\n\n const metrics = this.getMetrics();\n let x = (metrics.scrollWidth - metrics.viewWidth) / 2;\n let y = (metrics.scrollHeight - metrics.viewHeight) / 2;\n\n // Convert from workspace directions to canvas directions.\n x = -x - metrics.scrollLeft;\n y = -y - metrics.scrollTop;\n this.scroll(x, y);\n }\n\n /**\n * Scroll the workspace to center on the given block. If the block has other\n * blocks stacked below it, the workspace will be centered on the stack.\n *\n * @param id ID of block center on.\n */\n centerOnBlock(id: string|null) {\n if (!this.isMovable()) {\n console.warn(\n 'Tried to move a non-movable workspace. This could result' +\n ' in blocks becoming inaccessible.');\n return;\n }\n\n const block = id ? this.getBlockById(id) : null;\n if (!block) {\n return;\n }\n\n // XY is in workspace coordinates.\n const xy = block.getRelativeToSurfaceXY();\n // Height/width is in workspace units.\n const heightWidth = block.getHeightWidth();\n\n // Find the enter of the block in workspace units.\n const blockCenterY = xy.y + heightWidth.height / 2;\n\n // In RTL the block's position is the top right of the block, not top left.\n const multiplier = this.RTL ? -1 : 1;\n const blockCenterX = xy.x + multiplier * heightWidth.width / 2;\n\n // Workspace scale, used to convert from workspace coordinates to pixels.\n const scale = this.scale;\n\n // Center of block in pixels, relative to workspace origin (center 0,0).\n // Scrolling to here would put the block in the top-left corner of the\n // visible workspace.\n const pixelX = blockCenterX * scale;\n const pixelY = blockCenterY * scale;\n\n const metrics = this.getMetrics();\n\n // viewHeight and viewWidth are in pixels.\n const halfViewWidth = metrics.viewWidth / 2;\n const halfViewHeight = metrics.viewHeight / 2;\n\n // Put the block in the center of the visible workspace instead.\n const scrollToCenterX = pixelX - halfViewWidth;\n const scrollToCenterY = pixelY - halfViewHeight;\n\n // Convert from workspace directions to canvas directions.\n const x = -scrollToCenterX;\n const y = -scrollToCenterY;\n\n this.scroll(x, y);\n }\n\n /**\n * Set the workspace's zoom factor.\n *\n * @param newScale Zoom factor. Units: (pixels / workspaceUnit).\n */\n setScale(newScale: number) {\n if (this.options.zoomOptions.maxScale &&\n newScale > this.options.zoomOptions.maxScale) {\n newScale = this.options.zoomOptions.maxScale;\n } else if (\n this.options.zoomOptions.minScale &&\n newScale < this.options.zoomOptions.minScale) {\n newScale = this.options.zoomOptions.minScale;\n }\n this.scale = newScale;\n\n this.hideChaff(false);\n // Get the flyout, if any, whether our own or owned by the toolbox.\n const flyout = this.getFlyout(false);\n if (flyout && flyout.isVisible()) {\n flyout.reflow();\n this.recordDragTargets();\n }\n if (this.grid_) {\n this.grid_.update(this.scale);\n }\n\n // We call scroll instead of scrollbar.resize() so that we can center the\n // zoom correctly without scrollbars, but scroll does not resize the\n // scrollbars so we have to call resizeView/resizeContent as well.\n const metrics = this.getMetrics();\n\n this.scrollX -= metrics.absoluteLeft;\n this.scrollY -= metrics.absoluteTop;\n // The scroll values and the view values are additive inverses of\n // each other, so when we subtract from one we have to add to the other.\n metrics.viewLeft += metrics.absoluteLeft;\n metrics.viewTop += metrics.absoluteTop;\n\n this.scroll(this.scrollX, this.scrollY);\n if (this.scrollbar) {\n if (this.flyout_) {\n this.scrollbar.resizeView(metrics);\n } else {\n this.scrollbar.resizeContent(metrics);\n }\n }\n }\n\n /**\n * Get the workspace's zoom factor. If the workspace has a parent, we call\n * into the parent to get the workspace scale.\n *\n * @returns The workspace zoom factor. Units: (pixels / workspaceUnit).\n */\n getScale(): number {\n if (this.options.parentWorkspace) {\n return this.options.parentWorkspace.getScale();\n }\n return this.scale;\n }\n\n /**\n * Scroll the workspace to a specified offset (in pixels), keeping in the\n * workspace bounds. See comment on workspaceSvg.scrollX for more detail on\n * the meaning of these values.\n *\n * @param x Target X to scroll to.\n * @param y Target Y to scroll to.\n * @internal\n */\n scroll(x: number, y: number) {\n this.hideChaff(/* opt_onlyClosePopups= */\n true);\n\n // Keep scrolling within the bounds of the content.\n const metrics = this.getMetrics();\n // Canvas coordinates (aka scroll coordinates) have inverse directionality\n // to workspace coordinates so we have to inverse them.\n x = Math.min(x, -metrics.scrollLeft);\n y = Math.min(y, -metrics.scrollTop);\n const maxXDisplacement =\n Math.max(0, metrics.scrollWidth - metrics.viewWidth);\n const maxXScroll = metrics.scrollLeft + maxXDisplacement;\n const maxYDisplacement =\n Math.max(0, metrics.scrollHeight - metrics.viewHeight);\n const maxYScroll = metrics.scrollTop + maxYDisplacement;\n x = Math.max(x, -maxXScroll);\n y = Math.max(y, -maxYScroll);\n this.scrollX = x;\n this.scrollY = y;\n\n if (this.scrollbar) {\n // The content position (displacement from the content's top-left to the\n // origin) plus the scroll position (displacement from the view's top-left\n // to the origin) gives us the distance from the view's top-left to the\n // content's top-left. Then we negate this so we get the displacement from\n // the content's top-left to the view's top-left, matching the\n // directionality of the scrollbars.\n this.scrollbar.set(\n -(x + metrics.scrollLeft), -(y + metrics.scrollTop), false);\n }\n // We have to shift the translation so that when the canvas is at 0, 0 the\n // workspace origin is not underneath the toolbox.\n x += metrics.absoluteLeft;\n y += metrics.absoluteTop;\n this.translate(x, y);\n }\n\n /**\n * Find the block on this workspace with the specified ID.\n *\n * @param id ID of block to find.\n * @returns The sought after block, or null if not found.\n */\n override getBlockById(id: string): BlockSvg|null {\n return super.getBlockById(id) as BlockSvg;\n }\n\n /**\n * Find all blocks in workspace. Blocks are optionally sorted\n * by position; top to bottom (with slight LTR or RTL bias).\n *\n * @param ordered Sort the list if true.\n * @returns Array of blocks.\n */\n override getAllBlocks(ordered: boolean): BlockSvg[] {\n return super.getAllBlocks(ordered) as BlockSvg[];\n }\n\n /**\n * Finds the top-level blocks and returns them. Blocks are optionally sorted\n * by position; top to bottom (with slight LTR or RTL bias).\n *\n * @param ordered Sort the list if true.\n * @returns The top-level block objects.\n */\n override getTopBlocks(ordered: boolean): BlockSvg[] {\n return super.getTopBlocks(ordered) as BlockSvg[];\n }\n\n /**\n * Adds a block to the list of top blocks.\n *\n * @param block Block to add.\n */\n override addTopBlock(block: Block) {\n this.addTopBoundedElement(block as BlockSvg);\n super.addTopBlock(block);\n }\n\n /**\n * Removes a block from the list of top blocks.\n *\n * @param block Block to remove.\n */\n override removeTopBlock(block: Block) {\n this.removeTopBoundedElement(block as BlockSvg);\n super.removeTopBlock(block);\n }\n\n /**\n * Adds a comment to the list of top comments.\n *\n * @param comment comment to add.\n */\n override addTopComment(comment: WorkspaceComment) {\n this.addTopBoundedElement(comment as WorkspaceCommentSvg);\n super.addTopComment(comment);\n }\n\n /**\n * Removes a comment from the list of top comments.\n *\n * @param comment comment to remove.\n */\n override removeTopComment(comment: WorkspaceComment) {\n this.removeTopBoundedElement(comment as WorkspaceCommentSvg);\n super.removeTopComment(comment);\n }\n\n /**\n * Adds a bounded element to the list of top bounded elements.\n *\n * @param element Bounded element to add.\n */\n addTopBoundedElement(element: IBoundedElement) {\n this.topBoundedElements_.push(element);\n }\n\n /**\n * Removes a bounded element from the list of top bounded elements.\n *\n * @param element Bounded element to remove.\n */\n removeTopBoundedElement(element: IBoundedElement) {\n arrayUtils.removeElem(this.topBoundedElements_, element);\n }\n\n /**\n * Finds the top-level bounded elements and returns them.\n *\n * @returns The top-level bounded elements.\n */\n getTopBoundedElements(): IBoundedElement[] {\n return (new Array<IBoundedElement>()).concat(this.topBoundedElements_);\n }\n\n /**\n * Update whether this workspace has resizes enabled.\n * If enabled, workspace will resize when appropriate.\n * If disabled, workspace will not resize until re-enabled.\n * Use to avoid resizing during a batch operation, for performance.\n *\n * @param enabled Whether resizes should be enabled.\n */\n setResizesEnabled(enabled: boolean) {\n const reenabled = !this.resizesEnabled_ && enabled;\n this.resizesEnabled_ = enabled;\n if (reenabled) {\n // Newly enabled. Trigger a resize.\n this.resizeContents();\n }\n }\n\n /**\n * Dispose of all blocks in workspace, with an optimization to prevent\n * resizes.\n */\n override clear() {\n this.setResizesEnabled(false);\n super.clear();\n this.topBoundedElements_ = [];\n this.setResizesEnabled(true);\n }\n\n /**\n * Register a callback function associated with a given key, for clicks on\n * buttons and labels in the flyout.\n * For instance, a button specified by the XML\n * <button text=\"create variable\" callbackKey=\"CREATE_VARIABLE\"></button>\n * should be matched by a call to\n * registerButtonCallback(\"CREATE_VARIABLE\", yourCallbackFunction).\n *\n * @param key The name to use to look up this function.\n * @param func The function to call when the given button is clicked.\n */\n registerButtonCallback(key: string, func: (p1: FlyoutButton) => void) {\n if (typeof func !== 'function') {\n throw TypeError('Button callbacks must be functions.');\n }\n this.flyoutButtonCallbacks.set(key, func);\n }\n\n /**\n * Get the callback function associated with a given key, for clicks on\n * buttons and labels in the flyout.\n *\n * @param key The name to use to look up the function.\n * @returns The function corresponding to the given key for this workspace;\n * null if no callback is registered.\n */\n getButtonCallback(key: string): ((p1: FlyoutButton) => void)|null {\n return this.flyoutButtonCallbacks.get(key) ?? null;\n }\n\n /**\n * Remove a callback for a click on a button in the flyout.\n *\n * @param key The name associated with the callback function.\n */\n removeButtonCallback(key: string) {\n this.flyoutButtonCallbacks.delete(key);\n }\n\n /**\n * Register a callback function associated with a given key, for populating\n * custom toolbox categories in this workspace. See the variable and\n * procedure categories as an example.\n *\n * @param key The name to use to look up this function.\n * @param func The function to call when the given toolbox category is opened.\n */\n registerToolboxCategoryCallback(\n key: string, func: (p1: WorkspaceSvg) => toolbox.FlyoutDefinition) {\n if (typeof func !== 'function') {\n throw TypeError('Toolbox category callbacks must be functions.');\n }\n this.toolboxCategoryCallbacks.set(key, func);\n }\n\n /**\n * Get the callback function associated with a given key, for populating\n * custom toolbox categories in this workspace.\n *\n * @param key The name to use to look up the function.\n * @returns The function corresponding to the given key for this workspace, or\n * null if no function is registered.\n */\n getToolboxCategoryCallback(key: string):\n ((p1: WorkspaceSvg) => toolbox.FlyoutDefinition)|null {\n return this.toolboxCategoryCallbacks.get(key) || null;\n }\n\n /**\n * Remove a callback for a click on a custom category's name in the toolbox.\n *\n * @param key The name associated with the callback function.\n */\n removeToolboxCategoryCallback(key: string) {\n this.toolboxCategoryCallbacks.delete(key);\n }\n\n /**\n * Look up the gesture that is tracking this touch stream on this workspace.\n * May create a new gesture.\n *\n * @param e Mouse event or touch event.\n * @returns The gesture that is tracking this touch stream, or null if no\n * valid gesture exists.\n * @internal\n */\n getGesture(e: Event): TouchGesture|null {\n const isStart = e.type === 'mousedown' || e.type === 'touchstart' ||\n e.type === 'pointerdown';\n\n const gesture = this.currentGesture_;\n if (gesture) {\n if (isStart && gesture.hasStarted()) {\n console.warn('Tried to start the same gesture twice.');\n // That's funny. We must have missed a mouse up.\n // Cancel it, rather than try to retrieve all of the state we need.\n gesture.cancel();\n return null;\n }\n return gesture;\n }\n\n // No gesture existed on this workspace, but this looks like the start of a\n // new gesture.\n if (isStart) {\n this.currentGesture_ = new TouchGesture(e, this);\n return this.currentGesture_;\n }\n // No gesture existed and this event couldn't be the start of a new gesture.\n return null;\n }\n\n /**\n * Clear the reference to the current gesture.\n *\n * @internal\n */\n clearGesture() {\n this.currentGesture_ = null;\n }\n\n /**\n * Cancel the current gesture, if one exists.\n *\n * @internal\n */\n cancelCurrentGesture() {\n if (this.currentGesture_) {\n this.currentGesture_.cancel();\n }\n }\n\n /**\n * Get the audio manager for this workspace.\n *\n * @returns The audio manager for this workspace.\n */\n getAudioManager(): WorkspaceAudio {\n return this.audioManager_;\n }\n\n /**\n * Get the grid object for this workspace, or null if there is none.\n *\n * @returns The grid object for this workspace.\n * @internal\n */\n getGrid(): Grid|null {\n return this.grid_;\n }\n\n /**\n * Close tooltips, context menus, dropdown selections, etc.\n *\n * @param opt_onlyClosePopups Whether only popups should be closed.\n */\n hideChaff(opt_onlyClosePopups?: boolean) {\n Tooltip.hide();\n WidgetDiv.hide();\n dropDownDiv.hideWithoutAnimation();\n\n const onlyClosePopups = !!opt_onlyClosePopups;\n const autoHideables = this.getComponentManager().getComponents(\n ComponentManager.Capability.AUTOHIDEABLE, true);\n autoHideables.forEach(\n (autoHideable) => autoHideable.autoHide(onlyClosePopups));\n }\n\n /**\n * Sets the X/Y translations of a top level workspace.\n *\n * @param xyRatio Contains an x and/or y property which is a float between 0\n * and 1 specifying the degree of scrolling.\n */\n private static setTopLevelWorkspaceMetrics_(\n this: WorkspaceSvg, xyRatio: {x?: number, y?: number}) {\n const metrics = this.getMetrics();\n\n if (typeof xyRatio.x === 'number') {\n this.scrollX =\n -(metrics.scrollLeft +\n (metrics.scrollWidth - metrics.viewWidth) * xyRatio.x);\n }\n if (typeof xyRatio.y === 'number') {\n this.scrollY =\n -(metrics.scrollTop +\n (metrics.scrollHeight - metrics.viewHeight) * xyRatio.y);\n }\n // We have to shift the translation so that when the canvas is at 0, 0 the\n // workspace origin is not underneath the toolbox.\n const x = this.scrollX + metrics.absoluteLeft;\n const y = this.scrollY + metrics.absoluteTop;\n // We could call scroll here, but that has extra checks we don't need to do.\n this.translate(x, y);\n }\n}\n\n/**\n * Size the workspace when the contents change. This also updates\n * scrollbars accordingly.\n *\n * @param workspace The workspace to resize.\n * @alias Blockly.WorkspaceSvg.resizeSvgContents\n * @internal\n */\nexport function resizeSvgContents(workspace: WorkspaceSvg) {\n workspace.resizeContents();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Contains top-level functions for serializing workspaces to plain JavaScript\n * objects.\n *\n * @namespace Blockly.serialization.workspaces\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.serialization.workspaces');\n\nimport * as eventUtils from '../events/utils.js';\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport * as registry from '../registry.js';\nimport * as dom from '../utils/dom.js';\n// eslint-disable-next-line no-unused-vars\nimport type {Workspace} from '../workspace.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\n\n/**\n * Returns the state of the workspace as a plain JavaScript object.\n *\n * @param workspace The workspace to serialize.\n * @returns The serialized state of the workspace.\n * @alias Blockly.serialization.workspaces.save\n */\nexport function save(workspace: Workspace):\n {[key: string]: AnyDuringMigration} {\n const state = Object.create(null);\n const serializerMap = registry.getAllItems(registry.Type.SERIALIZER, true);\n for (const key in serializerMap) {\n const save = (serializerMap[key] as ISerializer)?.save(workspace);\n if (save) {\n state[key] = save;\n }\n }\n return state;\n}\n\n/**\n * Loads the variable represented by the given state into the given workspace.\n *\n * @param state The state of the workspace to deserialize into the workspace.\n * @param workspace The workspace to add the new state to.\n * @param param1 recordUndo: If true, events triggered by this function will be\n * undo-able by the user. False by default.\n * @alias Blockly.serialization.workspaces.load\n */\nexport function load(\n state: {[key: string]: AnyDuringMigration}, workspace: Workspace,\n {recordUndo = false}: {recordUndo?: boolean} = {}) {\n const serializerMap = registry.getAllItems(registry.Type.SERIALIZER, true);\n if (!serializerMap) {\n return;\n }\n\n const deserializers = Object.entries(serializerMap)\n .sort(\n (a, b) => (b[1] as ISerializer)!.priority -\n (a[1] as ISerializer)!.priority);\n\n const prevRecordUndo = eventUtils.getRecordUndo();\n eventUtils.setRecordUndo(recordUndo);\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n\n dom.startTextWidthCache();\n if (workspace instanceof WorkspaceSvg) {\n workspace.setResizesEnabled(false);\n }\n\n // We want to trigger clearing in reverse priority order so plugins don't end\n // up missing dependencies.\n for (const [, deserializer] of deserializers.reverse()) {\n (deserializer as ISerializer)?.clear(workspace);\n }\n\n // reverse() is destructive, so we have to re-reverse to correct the order.\n for (let [name, deserializer] of deserializers.reverse()) {\n name = name;\n const pluginState = state[name];\n if (pluginState) {\n (deserializer as ISerializer)?.load(state[name], workspace);\n }\n }\n\n if (workspace instanceof WorkspaceSvg) {\n workspace.setResizesEnabled(true);\n }\n dom.stopTextWidthCache();\n\n eventUtils.fire(new (eventUtils.get(eventUtils.FINISHED_LOADING))(workspace));\n\n eventUtils.setGroup(existingGroup);\n eventUtils.setRecordUndo(prevRecordUndo);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utilities for bumping objects back into worksapce bounds.\n *\n * @namespace Blockly.bumpObjects\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.bumpObjects');\n\nimport type {BlockSvg} from './block_svg.js';\nimport type {Abstract} from './events/events_abstract.js';\nimport type {BlockCreate} from './events/events_block_create.js';\nimport type {BlockMove} from './events/events_block_move.js';\nimport type {CommentCreate} from './events/events_comment_create.js';\nimport type {CommentMove} from './events/events_comment_move.js';\nimport type {ViewportChange} from './events/events_viewport.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {ContainerRegion} from './metrics_manager.js';\nimport * as mathUtils from './utils/math.js';\nimport type {WorkspaceCommentSvg} from './workspace_comment_svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Bumps the given object that has passed out of bounds.\n *\n * @param workspace The workspace containing the object.\n * @param scrollMetrics Scroll metrics\n * in workspace coordinates.\n * @param object The object to bump.\n * @returns True if block was bumped.\n * @alias Blockly.bumpObjects.bumpIntoBounds\n */\nfunction bumpObjectIntoBounds(\n workspace: WorkspaceSvg, scrollMetrics: ContainerRegion,\n object: IBoundedElement): boolean {\n // Compute new top/left position for object.\n const objectMetrics = object.getBoundingRectangle();\n const height = objectMetrics.bottom - objectMetrics.top;\n const width = objectMetrics.right - objectMetrics.left;\n\n const topClamp = scrollMetrics.top;\n const scrollMetricsBottom = scrollMetrics.top + scrollMetrics.height;\n const bottomClamp = scrollMetricsBottom - height;\n // If the object is taller than the workspace we want to\n // top-align the block\n const newYPosition =\n mathUtils.clamp(topClamp, objectMetrics.top, bottomClamp);\n const deltaY = newYPosition - objectMetrics.top;\n\n // Note: Even in RTL mode the \"anchor\" of the object is the\n // top-left corner of the object.\n let leftClamp = scrollMetrics.left;\n const scrollMetricsRight = scrollMetrics.left + scrollMetrics.width;\n let rightClamp = scrollMetricsRight - width;\n if (workspace.RTL) {\n // If the object is wider than the workspace and we're in RTL\n // mode we want to right-align the block, which means setting\n // the left clamp to match.\n leftClamp = Math.min(rightClamp, leftClamp);\n } else {\n // If the object is wider than the workspace and we're in LTR\n // mode we want to left-align the block, which means setting\n // the right clamp to match.\n rightClamp = Math.max(leftClamp, rightClamp);\n }\n const newXPosition =\n mathUtils.clamp(leftClamp, objectMetrics.left, rightClamp);\n const deltaX = newXPosition - objectMetrics.left;\n\n if (deltaX || deltaY) {\n object.moveBy(deltaX, deltaY);\n return true;\n }\n return false;\n}\nexport const bumpIntoBounds = bumpObjectIntoBounds;\n\n/**\n * Creates a handler for bumping objects when they cross fixed bounds.\n *\n * @param workspace The workspace to handle.\n * @returns The event handler.\n * @alias Blockly.bumpObjects.bumpIntoBoundsHandler\n */\nexport function bumpIntoBoundsHandler(workspace: WorkspaceSvg):\n (p1: Abstract) => void {\n return (e) => {\n const metricsManager = workspace.getMetricsManager();\n if (!metricsManager.hasFixedEdges() || workspace.isDragging()) {\n return;\n }\n\n if (eventUtils.BUMP_EVENTS.indexOf(e.type ?? '') !== -1) {\n const scrollMetricsInWsCoords = metricsManager.getScrollMetrics(true);\n\n // Triggered by move/create event\n const object =\n extractObjectFromEvent(workspace, e as eventUtils.BumpEvent);\n if (!object) {\n return;\n }\n // Handle undo.\n const oldGroup = eventUtils.getGroup();\n eventUtils.setGroup(e.group);\n\n const wasBumped = bumpObjectIntoBounds(\n workspace, scrollMetricsInWsCoords, (object as IBoundedElement));\n\n if (wasBumped && !e.group) {\n console.warn(\n 'Moved object in bounds but there was no' +\n ' event group. This may break undo.');\n }\n if (oldGroup !== null) {\n eventUtils.setGroup(oldGroup);\n }\n } else if (e.type === eventUtils.VIEWPORT_CHANGE) {\n const viewportEvent = (e as ViewportChange);\n if (viewportEvent.scale && viewportEvent.oldScale &&\n viewportEvent.scale > viewportEvent.oldScale) {\n bumpTopObjectsIntoBounds(workspace);\n }\n }\n };\n}\n\n/**\n * Extracts the object from the given event.\n *\n * @param workspace The workspace the event originated\n * from.\n * @param e An event containing an object.\n * @returns The extracted\n * object.\n */\nfunction extractObjectFromEvent(\n workspace: WorkspaceSvg, e: eventUtils.BumpEvent): BlockSvg|null|\n WorkspaceCommentSvg {\n let object = null;\n switch (e.type) {\n case eventUtils.BLOCK_CREATE:\n case eventUtils.BLOCK_MOVE:\n object = workspace.getBlockById((e as BlockCreate | BlockMove).blockId!);\n if (object) {\n object = object.getRootBlock();\n }\n break;\n case eventUtils.COMMENT_CREATE:\n case eventUtils.COMMENT_MOVE:\n object =\n workspace.getCommentById((e as CommentCreate | CommentMove).commentId!\n ) as WorkspaceCommentSvg |\n null;\n break;\n }\n return object;\n}\n\n/**\n * Bumps the top objects in the given workspace into bounds.\n *\n * @param workspace The workspace.\n * @alias Blockly.bumpObjects.bumpTopObjectsIntoBounds\n */\nexport function bumpTopObjectsIntoBounds(workspace: WorkspaceSvg) {\n const metricsManager = workspace.getMetricsManager();\n if (!metricsManager.hasFixedEdges() || workspace.isDragging()) {\n return;\n }\n\n const scrollMetricsInWsCoords = metricsManager.getScrollMetrics(true);\n const topBlocks = workspace.getTopBoundedElements();\n for (let i = 0, block; block = topBlocks[i]; i++) {\n bumpObjectIntoBounds(workspace, scrollMetricsInWsCoords, block);\n }\n}\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Functions for injecting Blockly into a web page.\n *\n * @namespace Blockly.inject\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.inject');\n\nimport {BlockDragSurfaceSvg} from './block_drag_surface.js';\nimport type {BlocklyOptions} from './blockly_options.js';\nimport * as browserEvents from './browser_events.js';\nimport * as bumpObjects from './bump_objects.js';\nimport * as common from './common.js';\nimport * as Css from './css.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {Grid} from './grid.js';\nimport {Msg} from './msg.js';\nimport {Options} from './options.js';\nimport {ScrollbarPair} from './scrollbar_pair.js';\nimport {ShortcutRegistry} from './shortcut_registry.js';\nimport * as Tooltip from './tooltip.js';\nimport * as Touch from './touch.js';\nimport * as aria from './utils/aria.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport * as userAgent from './utils/useragent.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport {WorkspaceDragSurfaceSvg} from './workspace_drag_surface_svg.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Inject a Blockly editor into the specified container element (usually a div).\n *\n * @param container Containing element, or its ID, or a CSS selector.\n * @param opt_options Optional dictionary of options.\n * @returns Newly created main workspace.\n * @alias Blockly.inject\n */\nexport function inject(\n container: Element|string, opt_options?: BlocklyOptions): WorkspaceSvg {\n if (typeof container === 'string') {\n // AnyDuringMigration because: Type 'Element | null' is not assignable to\n // type 'string | Element'.\n container = (document.getElementById(container) ||\n document.querySelector(container)) as AnyDuringMigration;\n }\n // Verify that the container is in document.\n // AnyDuringMigration because: Argument of type 'string | Element' is not\n // assignable to parameter of type 'Node'.\n if (!container ||\n !dom.containsNode(document, container as AnyDuringMigration)) {\n throw Error('Error: container is not in current document.');\n }\n const options = new Options(opt_options || {} as BlocklyOptions);\n const subContainer = (document.createElement('div'));\n subContainer.className = 'injectionDiv';\n subContainer.tabIndex = 0;\n aria.setState(subContainer, aria.State.LABEL, Msg['WORKSPACE_ARIA_LABEL']);\n\n // AnyDuringMigration because: Property 'appendChild' does not exist on type\n // 'string | Element'.\n (container as AnyDuringMigration).appendChild(subContainer);\n const svg = createDom(subContainer, options);\n\n // Create surfaces for dragging things. These are optimizations\n // so that the browser does not repaint during the drag.\n const blockDragSurface = new BlockDragSurfaceSvg(subContainer);\n\n const workspaceDragSurface = new WorkspaceDragSurfaceSvg(subContainer);\n\n const workspace =\n createMainWorkspace(svg, options, blockDragSurface, workspaceDragSurface);\n\n init(workspace);\n\n // Keep focus on the first workspace so entering keyboard navigation looks\n // correct.\n // AnyDuringMigration because: Argument of type 'WorkspaceSvg' is not\n // assignable to parameter of type 'Workspace'.\n common.setMainWorkspace(workspace as AnyDuringMigration);\n\n common.svgResize(workspace);\n\n subContainer.addEventListener('focusin', function() {\n // AnyDuringMigration because: Argument of type 'WorkspaceSvg' is not\n // assignable to parameter of type 'Workspace'.\n common.setMainWorkspace(workspace as AnyDuringMigration);\n });\n\n return workspace;\n}\n\n/**\n * Create the SVG image.\n *\n * @param container Containing element.\n * @param options Dictionary of options.\n * @returns Newly created SVG image.\n */\nfunction createDom(container: Element, options: Options): Element {\n // Sadly browsers (Chrome vs Firefox) are currently inconsistent in laying\n // out content in RTL mode. Therefore Blockly forces the use of LTR,\n // then manually positions content in RTL as needed.\n container.setAttribute('dir', 'LTR');\n\n // Load CSS.\n Css.inject(options.hasCss, options.pathToMedia);\n\n // Build the SVG DOM.\n /*\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:html=\"http://www.w3.org/1999/xhtml\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n class=\"blocklySvg\">\n ...\n </svg>\n */\n const svg = dom.createSvgElement(\n Svg.SVG, {\n 'xmlns': dom.SVG_NS,\n 'xmlns:html': dom.HTML_NS,\n 'xmlns:xlink': dom.XLINK_NS,\n 'version': '1.1',\n 'class': 'blocklySvg',\n 'tabindex': '0',\n },\n container);\n /*\n <defs>\n ... filters go here ...\n </defs>\n */\n const defs = dom.createSvgElement(Svg.DEFS, {}, svg);\n // Each filter/pattern needs a unique ID for the case of multiple Blockly\n // instances on a page. Browser behaviour becomes undefined otherwise.\n // https://neil.fraser.name/news/2015/11/01/\n const rnd = String(Math.random()).substring(2);\n\n options.gridPattern = Grid.createDom(rnd, options.gridOptions, defs);\n return svg;\n}\n\n/**\n * Create a main workspace and add it to the SVG.\n *\n * @param svg SVG element with pattern defined.\n * @param options Dictionary of options.\n * @param blockDragSurface Drag surface SVG for the blocks.\n * @param workspaceDragSurface Drag surface SVG for the workspace.\n * @returns Newly created main workspace.\n */\nfunction createMainWorkspace(\n svg: Element, options: Options, blockDragSurface: BlockDragSurfaceSvg,\n workspaceDragSurface: WorkspaceDragSurfaceSvg): WorkspaceSvg {\n options.parentWorkspace = null;\n const mainWorkspace =\n new WorkspaceSvg(options, blockDragSurface, workspaceDragSurface);\n const wsOptions = mainWorkspace.options;\n mainWorkspace.scale = wsOptions.zoomOptions.startScale;\n svg.appendChild(mainWorkspace.createDom('blocklyMainBackground'));\n\n // Set the theme name and renderer name onto the injection div.\n const injectionDiv = mainWorkspace.getInjectionDiv();\n const rendererClassName = mainWorkspace.getRenderer().getClassName();\n if (rendererClassName) {\n dom.addClass(injectionDiv, rendererClassName);\n }\n const themeClassName = mainWorkspace.getTheme().getClassName();\n if (themeClassName) {\n dom.addClass(injectionDiv, themeClassName);\n }\n\n if (!wsOptions.hasCategories && wsOptions.languageTree) {\n // Add flyout as an <svg> that is a sibling of the workspace SVG.\n const flyout = mainWorkspace.addFlyout(Svg.SVG);\n dom.insertAfter(flyout, svg);\n }\n if (wsOptions.hasTrashcan) {\n mainWorkspace.addTrashcan();\n }\n if (wsOptions.zoomOptions && wsOptions.zoomOptions.controls) {\n mainWorkspace.addZoomControls();\n }\n // Register the workspace svg as a UI component.\n mainWorkspace.getThemeManager().subscribe(\n svg, 'workspaceBackgroundColour', 'background-color');\n\n // A null translation will also apply the correct initial scale.\n mainWorkspace.translate(0, 0);\n\n mainWorkspace.addChangeListener(\n bumpObjects.bumpIntoBoundsHandler(mainWorkspace));\n\n // The SVG is now fully assembled.\n common.svgResize(mainWorkspace);\n WidgetDiv.createDom();\n dropDownDiv.createDom();\n Tooltip.createDom();\n return mainWorkspace;\n}\n\n/**\n * Initialize Blockly with various handlers.\n *\n * @param mainWorkspace Newly created main workspace.\n */\nfunction init(mainWorkspace: WorkspaceSvg) {\n const options = mainWorkspace.options;\n const svg = mainWorkspace.getParentSvg();\n\n // Suppress the browser's context menu.\n browserEvents.conditionalBind(\n svg.parentNode as Element, 'contextmenu', null,\n function(e: AnyDuringMigration) {\n if (!browserEvents.isTargetInput(e)) {\n e.preventDefault();\n }\n });\n\n const workspaceResizeHandler =\n browserEvents.conditionalBind(window, 'resize', null, function() {\n mainWorkspace.hideChaff(true);\n common.svgResize(mainWorkspace);\n bumpObjects.bumpTopObjectsIntoBounds(mainWorkspace);\n });\n mainWorkspace.setResizeHandlerWrapper(workspaceResizeHandler);\n\n bindDocumentEvents();\n\n if (options.languageTree) {\n const toolbox = mainWorkspace.getToolbox();\n const flyout = mainWorkspace.getFlyout(true);\n if (toolbox) {\n toolbox.init();\n } else if (flyout) {\n // Build a fixed flyout with the root blocks.\n flyout.init(mainWorkspace);\n flyout.show(options.languageTree);\n if (typeof flyout.scrollToStart === 'function') {\n flyout.scrollToStart();\n }\n }\n }\n\n if (options.hasTrashcan) {\n mainWorkspace.trashcan!.init();\n }\n if (options.zoomOptions && options.zoomOptions.controls) {\n mainWorkspace.zoomControls_!.init();\n }\n\n if (options.moveOptions && options.moveOptions.scrollbars) {\n const horizontalScroll = options.moveOptions.scrollbars === true ||\n !!options.moveOptions.scrollbars.horizontal;\n const verticalScroll = options.moveOptions.scrollbars === true ||\n !!options.moveOptions.scrollbars.vertical;\n mainWorkspace.scrollbar = new ScrollbarPair(\n mainWorkspace, horizontalScroll, verticalScroll,\n 'blocklyMainWorkspaceScrollbar');\n mainWorkspace.scrollbar.resize();\n } else {\n mainWorkspace.setMetrics({x: 0.5, y: 0.5});\n }\n\n // Load the sounds.\n if (options.hasSounds) {\n loadSounds(options.pathToMedia, mainWorkspace);\n }\n}\n\n/**\n * Handle a key-down on SVG drawing surface. Does nothing if the main workspace\n * is not visible.\n *\n * @param e Key down event.\n */\n// TODO (https://github.com/google/blockly/issues/1998) handle cases where there\n// are multiple workspaces and non-main workspaces are able to accept input.\nfunction onKeyDown(e: KeyboardEvent) {\n const mainWorkspace = common.getMainWorkspace() as WorkspaceSvg;\n if (!mainWorkspace) {\n return;\n }\n\n if (browserEvents.isTargetInput(e) ||\n mainWorkspace.rendered && !mainWorkspace.isVisible()) {\n // When focused on an HTML text input widget, don't trap any keys.\n // Ignore keypresses on rendered workspaces that have been explicitly\n // hidden.\n return;\n }\n ShortcutRegistry.registry.onKeyDown(mainWorkspace, e);\n}\n\n/**\n * Whether event handlers have been bound. Document event handlers will only\n * be bound once, even if Blockly is destroyed and reinjected.\n */\nlet documentEventsBound = false;\n\n/**\n * Bind document events, but only once. Destroying and reinjecting Blockly\n * should not bind again.\n * Bind events for scrolling the workspace.\n * Most of these events should be bound to the SVG's surface.\n * However, 'mouseup' has to be on the whole document so that a block dragged\n * out of bounds and released will know that it has been released.\n * Also, 'keydown' has to be on the whole document since the browser doesn't\n * understand a concept of focus on the SVG image.\n */\nfunction bindDocumentEvents() {\n if (!documentEventsBound) {\n browserEvents.conditionalBind(document, 'scroll', null, function() {\n const workspaces = common.getAllWorkspaces();\n for (let i = 0, workspace; workspace = workspaces[i]; i++) {\n if (workspace instanceof WorkspaceSvg) {\n workspace.updateInverseScreenCTM();\n }\n }\n });\n browserEvents.conditionalBind(document, 'keydown', null, onKeyDown);\n // longStop needs to run to stop the context menu from showing up. It\n // should run regardless of what other touch event handlers have run.\n browserEvents.bind(document, 'touchend', null, Touch.longStop);\n browserEvents.bind(document, 'touchcancel', null, Touch.longStop);\n // Some iPad versions don't fire resize after portrait to landscape change.\n if (userAgent.IPAD) {\n browserEvents.conditionalBind(\n window, 'orientationchange', document, function() {\n // TODO (#397): Fix for multiple Blockly workspaces.\n common.svgResize(common.getMainWorkspace() as WorkspaceSvg);\n });\n }\n }\n documentEventsBound = true;\n}\n\n/**\n * Load sounds for the given workspace.\n *\n * @param pathToMedia The path to the media directory.\n * @param workspace The workspace to load sounds for.\n */\nfunction loadSounds(pathToMedia: string, workspace: WorkspaceSvg) {\n const audioMgr = workspace.getAudioManager();\n audioMgr.load(\n [\n pathToMedia + 'click.mp3',\n pathToMedia + 'click.wav',\n pathToMedia + 'click.ogg',\n ],\n 'click');\n audioMgr.load(\n [\n pathToMedia + 'disconnect.wav',\n pathToMedia + 'disconnect.mp3',\n pathToMedia + 'disconnect.ogg',\n ],\n 'disconnect');\n audioMgr.load(\n [\n pathToMedia + 'delete.mp3',\n pathToMedia + 'delete.ogg',\n pathToMedia + 'delete.wav',\n ],\n 'delete');\n\n // Bind temporary hooks that preload the sounds.\n const soundBinds: AnyDuringMigration[] = [];\n /**\n *\n */\n function unbindSounds() {\n while (soundBinds.length) {\n browserEvents.unbind(soundBinds.pop());\n }\n audioMgr.preload();\n }\n\n // These are bound on mouse/touch events with\n // Blockly.browserEvents.conditionalBind, so they restrict the touch\n // identifier that will be recognized. But this is really something that\n // happens on a click, not a drag, so that's not necessary.\n\n // Android ignores any sound not loaded as a result of a user action.\n soundBinds.push(browserEvents.conditionalBind(\n document, 'mousemove', null, unbindSounds, true));\n soundBinds.push(browserEvents.conditionalBind(\n document, 'touchstart', null, unbindSounds, true));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Registers default context menu items.\n *\n * @namespace Blockly.ContextMenuItems\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ContextMenuItems');\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as clipboard from './clipboard.js';\nimport {ContextMenuRegistry, RegistryItem, Scope} from './contextmenu_registry.js';\nimport * as dialog from './dialog.js';\nimport * as Events from './events/events.js';\nimport * as eventUtils from './events/utils.js';\nimport {inputTypes} from './input_types.js';\nimport {Msg} from './msg.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Option to undo previous action.\n *\n * @alias Blockly.ContextMenuItems.registerUndo\n */\nexport function registerUndo() {\n const undoOption: RegistryItem = {\n displayText() {\n return Msg['UNDO'];\n },\n preconditionFn(scope: Scope) {\n if (scope.workspace!.getUndoStack().length > 0) {\n return 'enabled';\n }\n return 'disabled';\n },\n callback(scope: Scope) {\n scope.workspace!.undo(false);\n },\n scopeType: ContextMenuRegistry.ScopeType.WORKSPACE,\n id: 'undoWorkspace',\n weight: 1,\n };\n ContextMenuRegistry.registry.register(undoOption);\n}\n\n/**\n * Option to redo previous action.\n *\n * @alias Blockly.ContextMenuItems.registerRedo\n */\nexport function registerRedo() {\n const redoOption: RegistryItem = {\n displayText() {\n return Msg['REDO'];\n },\n preconditionFn(scope: Scope) {\n if (scope.workspace!.getRedoStack().length > 0) {\n return 'enabled';\n }\n return 'disabled';\n },\n callback(scope: Scope) {\n scope.workspace!.undo(true);\n },\n scopeType: ContextMenuRegistry.ScopeType.WORKSPACE,\n id: 'redoWorkspace',\n weight: 2,\n };\n ContextMenuRegistry.registry.register(redoOption);\n}\n\n/**\n * Option to clean up blocks.\n *\n * @alias Blockly.ContextMenuItems.registerCleanup\n */\nexport function registerCleanup() {\n const cleanOption: RegistryItem = {\n displayText() {\n return Msg['CLEAN_UP'];\n },\n preconditionFn(scope: Scope) {\n if (scope.workspace!.isMovable()) {\n if (scope.workspace!.getTopBlocks(false).length > 1) {\n return 'enabled';\n }\n return 'disabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n scope.workspace!.cleanUp();\n },\n scopeType: ContextMenuRegistry.ScopeType.WORKSPACE,\n id: 'cleanWorkspace',\n weight: 3,\n };\n ContextMenuRegistry.registry.register(cleanOption);\n}\n/**\n * Creates a callback to collapse or expand top blocks.\n *\n * @param shouldCollapse Whether a block should collapse.\n * @param topBlocks Top blocks in the workspace.\n */\nfunction toggleOption_(shouldCollapse: boolean, topBlocks: BlockSvg[]) {\n const DELAY = 10;\n let ms = 0;\n let timeoutCounter = 0;\n function timeoutFn(block: BlockSvg) {\n timeoutCounter--;\n block.setCollapsed(shouldCollapse);\n if (timeoutCounter === 0) {\n Events.setGroup(false);\n }\n }\n Events.setGroup(true);\n for (let i = 0; i < topBlocks.length; i++) {\n let block: BlockSvg|null = topBlocks[i];\n while (block) {\n timeoutCounter++;\n setTimeout(timeoutFn.bind(null, block), ms);\n block = block.getNextBlock();\n ms += DELAY;\n }\n }\n}\n\n/**\n * Option to collapse all blocks.\n *\n * @alias Blockly.ContextMenuItems.registerCollapse\n */\nexport function registerCollapse() {\n const collapseOption: RegistryItem = {\n displayText() {\n return Msg['COLLAPSE_ALL'];\n },\n preconditionFn(scope: Scope) {\n if (scope.workspace!.options.collapse) {\n const topBlocks = scope.workspace!.getTopBlocks(false);\n for (let i = 0; i < topBlocks.length; i++) {\n let block: BlockSvg|null = topBlocks[i];\n while (block) {\n if (!block.isCollapsed()) {\n return 'enabled';\n }\n block = block.getNextBlock();\n }\n }\n return 'disabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n toggleOption_(true, scope.workspace!.getTopBlocks(true));\n },\n scopeType: ContextMenuRegistry.ScopeType.WORKSPACE,\n id: 'collapseWorkspace',\n weight: 4,\n };\n ContextMenuRegistry.registry.register(collapseOption);\n}\n\n/**\n * Option to expand all blocks.\n *\n * @alias Blockly.ContextMenuItems.registerExpand\n */\nexport function registerExpand() {\n const expandOption: RegistryItem = {\n displayText() {\n return Msg['EXPAND_ALL'];\n },\n preconditionFn(scope: Scope) {\n if (scope.workspace!.options.collapse) {\n const topBlocks = scope.workspace!.getTopBlocks(false);\n for (let i = 0; i < topBlocks.length; i++) {\n let block: BlockSvg|null = topBlocks[i];\n while (block) {\n if (block.isCollapsed()) {\n return 'enabled';\n }\n block = block.getNextBlock();\n }\n }\n return 'disabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n toggleOption_(false, scope.workspace!.getTopBlocks(true));\n },\n scopeType: ContextMenuRegistry.ScopeType.WORKSPACE,\n id: 'expandWorkspace',\n weight: 5,\n };\n ContextMenuRegistry.registry.register(expandOption);\n}\n/**\n * Adds a block and its children to a list of deletable blocks.\n *\n * @param block to delete.\n * @param deleteList list of blocks that can be deleted.\n * This will be modified in place with the given block and its descendants.\n */\nfunction addDeletableBlocks_(block: BlockSvg, deleteList: BlockSvg[]) {\n if (block.isDeletable()) {\n Array.prototype.push.apply(deleteList, block.getDescendants(false));\n } else {\n const children = block.getChildren(false);\n for (let i = 0; i < children.length; i++) {\n addDeletableBlocks_(children[i], deleteList);\n }\n }\n}\n\n/**\n * Constructs a list of blocks that can be deleted in the given workspace.\n *\n * @param workspace to delete all blocks from.\n * @returns list of blocks to delete.\n */\nfunction getDeletableBlocks_(workspace: WorkspaceSvg): BlockSvg[] {\n const deleteList: BlockSvg[] = [];\n const topBlocks = workspace.getTopBlocks(true);\n for (let i = 0; i < topBlocks.length; i++) {\n addDeletableBlocks_(topBlocks[i], deleteList);\n }\n return deleteList;\n}\n\n/**\n * Deletes the given blocks. Used to delete all blocks in the workspace.\n *\n * @param deleteList list of blocks to delete.\n * @param eventGroup event group ID with which all delete events should be\n * associated.\n */\nfunction deleteNext_(deleteList: BlockSvg[], eventGroup: string) {\n const DELAY = 10;\n eventUtils.setGroup(eventGroup);\n const block = deleteList.shift();\n if (block) {\n if (!block.isDeadOrDying()) {\n block.dispose(false, true);\n setTimeout(deleteNext_, DELAY, deleteList, eventGroup);\n } else {\n deleteNext_(deleteList, eventGroup);\n }\n }\n eventUtils.setGroup(false);\n}\n\n/**\n * Option to delete all blocks.\n *\n * @alias Blockly.ContextMenuItems.registerDeleteAll\n */\nexport function registerDeleteAll() {\n const deleteOption: RegistryItem = {\n displayText(scope: Scope) {\n if (!scope.workspace) {\n return '';\n }\n const deletableBlocksLength = getDeletableBlocks_(scope.workspace).length;\n if (deletableBlocksLength === 1) {\n return Msg['DELETE_BLOCK'];\n } else {\n return Msg['DELETE_X_BLOCKS'].replace(\n '%1', String(deletableBlocksLength));\n }\n },\n preconditionFn(scope: Scope) {\n if (!scope.workspace) {\n return 'disabled';\n }\n const deletableBlocksLength = getDeletableBlocks_(scope.workspace).length;\n return deletableBlocksLength > 0 ? 'enabled' : 'disabled';\n },\n callback(scope: Scope) {\n if (!scope.workspace) {\n return;\n }\n scope.workspace.cancelCurrentGesture();\n const deletableBlocks = getDeletableBlocks_(scope.workspace);\n const eventGroup = idGenerator.genUid();\n if (deletableBlocks.length < 2) {\n deleteNext_(deletableBlocks, eventGroup);\n } else {\n dialog.confirm(\n Msg['DELETE_ALL_BLOCKS'].replace(\n '%1', String(deletableBlocks.length)),\n function(ok) {\n if (ok) {\n deleteNext_(deletableBlocks, eventGroup);\n }\n });\n }\n },\n scopeType: ContextMenuRegistry.ScopeType.WORKSPACE,\n id: 'workspaceDelete',\n weight: 6,\n };\n ContextMenuRegistry.registry.register(deleteOption);\n}\n/** Registers all workspace-scoped context menu items. */\nfunction registerWorkspaceOptions_() {\n registerUndo();\n registerRedo();\n registerCleanup();\n registerCollapse();\n registerExpand();\n registerDeleteAll();\n}\n\n/**\n * Option to duplicate a block.\n *\n * @alias Blockly.ContextMenuItems.registerDuplicate\n */\nexport function registerDuplicate() {\n const duplicateOption: RegistryItem = {\n displayText() {\n return Msg['DUPLICATE_BLOCK'];\n },\n preconditionFn(scope: Scope) {\n const block = scope.block;\n if (!block!.isInFlyout && block!.isDeletable() && block!.isMovable()) {\n if (block!.isDuplicatable()) {\n return 'enabled';\n }\n return 'disabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n if (scope.block) {\n clipboard.duplicate(scope.block);\n }\n },\n scopeType: ContextMenuRegistry.ScopeType.BLOCK,\n id: 'blockDuplicate',\n weight: 1,\n };\n ContextMenuRegistry.registry.register(duplicateOption);\n}\n\n/**\n * Option to add or remove block-level comment.\n *\n * @alias Blockly.ContextMenuItems.registerComment\n */\nexport function registerComment() {\n const commentOption: RegistryItem = {\n displayText(scope: Scope) {\n if (scope.block!.getCommentIcon()) {\n // If there's already a comment, option is to remove.\n return Msg['REMOVE_COMMENT'];\n }\n // If there's no comment yet, option is to add.\n return Msg['ADD_COMMENT'];\n },\n preconditionFn(scope: Scope) {\n const block = scope.block;\n if (!block!.isInFlyout && block!.workspace.options.comments &&\n !block!.isCollapsed() && block!.isEditable()) {\n return 'enabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n const block = scope.block;\n if (block!.getCommentIcon()) {\n block!.setCommentText(null);\n } else {\n block!.setCommentText('');\n }\n },\n scopeType: ContextMenuRegistry.ScopeType.BLOCK,\n id: 'blockComment',\n weight: 2,\n };\n ContextMenuRegistry.registry.register(commentOption);\n}\n\n/**\n * Option to inline variables.\n *\n * @alias Blockly.ContextMenuItems.registerInline\n */\nexport function registerInline() {\n const inlineOption: RegistryItem = {\n displayText(scope: Scope) {\n return scope.block!.getInputsInline() ? Msg['EXTERNAL_INPUTS'] :\n Msg['INLINE_INPUTS'];\n },\n preconditionFn(scope: Scope) {\n const block = scope.block;\n if (!block!.isInFlyout && block!.isMovable() && !block!.isCollapsed()) {\n for (let i = 1; i < block!.inputList.length; i++) {\n // Only display this option if there are two value or dummy inputs\n // next to each other.\n if (block!.inputList[i - 1].type !== inputTypes.STATEMENT &&\n block!.inputList[i].type !== inputTypes.STATEMENT) {\n return 'enabled';\n }\n }\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n scope.block!.setInputsInline(!scope.block!.getInputsInline());\n },\n scopeType: ContextMenuRegistry.ScopeType.BLOCK,\n id: 'blockInline',\n weight: 3,\n };\n ContextMenuRegistry.registry.register(inlineOption);\n}\n\n/**\n * Option to collapse or expand a block.\n *\n * @alias Blockly.ContextMenuItems.registerCollapseExpandBlock\n */\nexport function registerCollapseExpandBlock() {\n const collapseExpandOption: RegistryItem = {\n displayText(scope: Scope) {\n return scope.block!.isCollapsed() ? Msg['EXPAND_BLOCK'] :\n Msg['COLLAPSE_BLOCK'];\n },\n preconditionFn(scope: Scope) {\n const block = scope.block;\n if (!block!.isInFlyout && block!.isMovable() &&\n block!.workspace.options.collapse) {\n return 'enabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n scope.block!.setCollapsed(!scope.block!.isCollapsed());\n },\n scopeType: ContextMenuRegistry.ScopeType.BLOCK,\n id: 'blockCollapseExpand',\n weight: 4,\n };\n ContextMenuRegistry.registry.register(collapseExpandOption);\n}\n\n/**\n * Option to disable or enable a block.\n *\n * @alias Blockly.ContextMenuItems.registerDisable\n */\nexport function registerDisable() {\n const disableOption: RegistryItem = {\n displayText(scope: Scope) {\n return scope.block!.isEnabled() ? Msg['DISABLE_BLOCK'] :\n Msg['ENABLE_BLOCK'];\n },\n preconditionFn(scope: Scope) {\n const block = scope.block;\n if (!block!.isInFlyout && block!.workspace.options.disable &&\n block!.isEditable()) {\n if (block!.getInheritedDisabled()) {\n return 'disabled';\n }\n return 'enabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n const block = scope.block;\n const group = eventUtils.getGroup();\n if (!group) {\n eventUtils.setGroup(true);\n }\n block!.setEnabled(!block!.isEnabled());\n if (!group) {\n eventUtils.setGroup(false);\n }\n },\n scopeType: ContextMenuRegistry.ScopeType.BLOCK,\n id: 'blockDisable',\n weight: 5,\n };\n ContextMenuRegistry.registry.register(disableOption);\n}\n\n/**\n * Option to delete a block.\n *\n * @alias Blockly.ContextMenuItems.registerDelete\n */\nexport function registerDelete() {\n const deleteOption: RegistryItem = {\n displayText(scope: Scope) {\n const block = scope.block;\n // Count the number of blocks that are nested in this block.\n let descendantCount = block!.getDescendants(false).length;\n const nextBlock = block!.getNextBlock();\n if (nextBlock) {\n // Blocks in the current stack would survive this block's deletion.\n descendantCount -= nextBlock.getDescendants(false).length;\n }\n return descendantCount === 1 ?\n Msg['DELETE_BLOCK'] :\n Msg['DELETE_X_BLOCKS'].replace('%1', String(descendantCount));\n },\n preconditionFn(scope: Scope) {\n if (!scope.block!.isInFlyout && scope.block!.isDeletable()) {\n return 'enabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n if (scope.block) {\n scope.block.checkAndDelete();\n }\n },\n scopeType: ContextMenuRegistry.ScopeType.BLOCK,\n id: 'blockDelete',\n weight: 6,\n };\n ContextMenuRegistry.registry.register(deleteOption);\n}\n\n/**\n * Option to open help for a block.\n *\n * @alias Blockly.ContextMenuItems.registerHelp\n */\nexport function registerHelp() {\n const helpOption: RegistryItem = {\n displayText() {\n return Msg['HELP'];\n },\n preconditionFn(scope: Scope) {\n const block = scope.block;\n const url = typeof block!.helpUrl === 'function' ? block!.helpUrl() :\n block!.helpUrl;\n if (url) {\n return 'enabled';\n }\n return 'hidden';\n },\n callback(scope: Scope) {\n scope.block!.showHelp();\n },\n scopeType: ContextMenuRegistry.ScopeType.BLOCK,\n id: 'blockHelp',\n weight: 7,\n };\n ContextMenuRegistry.registry.register(helpOption);\n}\n\n/** Registers all block-scoped context menu items. */\nfunction registerBlockOptions_() {\n registerDuplicate();\n registerComment();\n registerInline();\n registerCollapseExpandBlock();\n registerDisable();\n registerDelete();\n registerHelp();\n}\n\n/**\n * Registers all default context menu items. This should be called once per\n * instance of ContextMenuRegistry.\n *\n * @alias Blockly.ContextMenuItems.registerDefaultOptions\n * @internal\n */\nexport function registerDefaultOptions() {\n registerWorkspaceOptions_();\n registerBlockOptions_();\n}\n\nregisterDefaultOptions();\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for dragging a block visually.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.BlockDragger');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_drag.js';\n\nimport * as blockAnimation from './block_animations.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as bumpObjects from './bump_objects.js';\nimport * as common from './common.js';\nimport type {BlockMove} from './events/events_block_move.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Icon} from './icon.js';\nimport {InsertionMarkerManager} from './insertion_marker_manager.js';\nimport type {IBlockDragger} from './interfaces/i_block_dragger.js';\nimport type {IDragTarget} from './interfaces/i_drag_target.js';\nimport * as registry from './registry.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a block dragger. It moves blocks around the workspace when they\n * are being dragged by a mouse or touch.\n *\n * @alias Blockly.BlockDragger\n */\nexport class BlockDragger implements IBlockDragger {\n /** The top block in the stack that is being dragged. */\n protected draggingBlock_: BlockSvg;\n protected draggedConnectionManager_: InsertionMarkerManager;\n\n /** The workspace on which the block is being dragged. */\n protected workspace_: WorkspaceSvg;\n\n /** Which drag area the mouse pointer is over, if any. */\n private dragTarget_: IDragTarget|null = null;\n\n /** Whether the block would be deleted if dropped immediately. */\n protected wouldDeleteBlock_ = false;\n protected startXY_: Coordinate;\n protected dragIconData_: IconPositionData[];\n\n /**\n * @param block The block to drag.\n * @param workspace The workspace to drag on.\n */\n constructor(block: BlockSvg, workspace: WorkspaceSvg) {\n this.draggingBlock_ = block;\n\n /** Object that keeps track of connections on dragged blocks. */\n this.draggedConnectionManager_ =\n new InsertionMarkerManager(this.draggingBlock_);\n\n this.workspace_ = workspace;\n\n /**\n * The location of the top left corner of the dragging block at the\n * beginning of the drag in workspace coordinates.\n */\n this.startXY_ = this.draggingBlock_.getRelativeToSurfaceXY();\n\n /**\n * A list of all of the icons (comment, warning, and mutator) that are\n * on this block and its descendants. Moving an icon moves the bubble that\n * extends from it if that bubble is open.\n */\n this.dragIconData_ = initIconData(block);\n }\n\n /**\n * Sever all links from this object.\n *\n * @internal\n */\n dispose() {\n this.dragIconData_.length = 0;\n\n if (this.draggedConnectionManager_) {\n this.draggedConnectionManager_.dispose();\n }\n }\n\n /**\n * Start dragging a block. This includes moving it to the drag surface.\n *\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at mouse down, in pixel units.\n * @param healStack Whether or not to heal the stack after disconnecting.\n */\n startDrag(currentDragDeltaXY: Coordinate, healStack: boolean) {\n if (!eventUtils.getGroup()) {\n eventUtils.setGroup(true);\n }\n this.fireDragStartEvent_();\n\n // Mutators don't have the same type of z-ordering as the normal workspace\n // during a drag. They have to rely on the order of the blocks in the SVG.\n // For performance reasons that usually happens at the end of a drag,\n // but do it at the beginning for mutators.\n if (this.workspace_.isMutator) {\n this.draggingBlock_.bringToFront();\n }\n\n // During a drag there may be a lot of rerenders, but not field changes.\n // Turn the cache on so we don't do spurious remeasures during the drag.\n dom.startTextWidthCache();\n this.workspace_.setResizesEnabled(false);\n blockAnimation.disconnectUiStop();\n\n if (this.shouldDisconnect_(healStack)) {\n this.disconnectBlock_(healStack, currentDragDeltaXY);\n }\n this.draggingBlock_.setDragging(true);\n // For future consideration: we may be able to put moveToDragSurface inside\n // the block dragger, which would also let the block not track the block\n // drag surface.\n this.draggingBlock_.moveToDragSurface();\n }\n\n /**\n * Whether or not we should disconnect the block when a drag is started.\n *\n * @param healStack Whether or not to heal the stack after disconnecting.\n * @returns True to disconnect the block, false otherwise.\n */\n protected shouldDisconnect_(healStack: boolean): boolean {\n return !!(\n this.draggingBlock_.getParent() ||\n healStack && this.draggingBlock_.nextConnection &&\n this.draggingBlock_.nextConnection.targetBlock());\n }\n\n /**\n * Disconnects the block and moves it to a new location.\n *\n * @param healStack Whether or not to heal the stack after disconnecting.\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at mouse down, in pixel units.\n */\n protected disconnectBlock_(\n healStack: boolean, currentDragDeltaXY: Coordinate) {\n this.draggingBlock_.unplug(healStack);\n const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY);\n const newLoc = Coordinate.sum(this.startXY_, delta);\n\n this.draggingBlock_.translate(newLoc.x, newLoc.y);\n blockAnimation.disconnectUiEffect(this.draggingBlock_);\n this.draggedConnectionManager_.updateAvailableConnections();\n }\n\n /** Fire a UI event at the start of a block drag. */\n protected fireDragStartEvent_() {\n const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))(\n this.draggingBlock_, true, this.draggingBlock_.getDescendants(false));\n eventUtils.fire(event);\n }\n\n /**\n * Execute a step of block dragging, based on the given event. Update the\n * display accordingly.\n *\n * @param e The most recent move event.\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at the start of the drag, in pixel units.\n */\n drag(e: Event, currentDragDeltaXY: Coordinate) {\n const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY);\n const newLoc = Coordinate.sum(this.startXY_, delta);\n this.draggingBlock_.moveDuringDrag(newLoc);\n this.dragIcons_(delta);\n\n const oldDragTarget = this.dragTarget_;\n this.dragTarget_ = this.workspace_.getDragTarget(e);\n\n this.draggedConnectionManager_.update(delta, this.dragTarget_);\n const oldWouldDeleteBlock = this.wouldDeleteBlock_;\n this.wouldDeleteBlock_ = this.draggedConnectionManager_.wouldDeleteBlock();\n if (oldWouldDeleteBlock !== this.wouldDeleteBlock_) {\n // Prevent unnecessary add/remove class calls.\n this.updateCursorDuringBlockDrag_();\n }\n\n // Call drag enter/exit/over after wouldDeleteBlock is called in\n // InsertionMarkerManager.update.\n if (this.dragTarget_ !== oldDragTarget) {\n oldDragTarget && oldDragTarget.onDragExit(this.draggingBlock_);\n this.dragTarget_ && this.dragTarget_.onDragEnter(this.draggingBlock_);\n }\n this.dragTarget_ && this.dragTarget_.onDragOver(this.draggingBlock_);\n }\n\n /**\n * Finish a block drag and put the block back on the workspace.\n *\n * @param e The mouseup/touchend event.\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at the start of the drag, in pixel units.\n */\n endDrag(e: Event, currentDragDeltaXY: Coordinate) {\n // Make sure internal state is fresh.\n this.drag(e, currentDragDeltaXY);\n this.dragIconData_ = [];\n this.fireDragEndEvent_();\n\n dom.stopTextWidthCache();\n\n blockAnimation.disconnectUiStop();\n\n const preventMove = !!this.dragTarget_ &&\n this.dragTarget_.shouldPreventMove(this.draggingBlock_);\n let newLoc: Coordinate;\n let delta: Coordinate|null = null;\n if (preventMove) {\n newLoc = this.startXY_;\n } else {\n const newValues = this.getNewLocationAfterDrag_(currentDragDeltaXY);\n delta = newValues.delta;\n newLoc = newValues.newLocation;\n }\n this.draggingBlock_.moveOffDragSurface(newLoc);\n\n if (this.dragTarget_) {\n this.dragTarget_.onDrop(this.draggingBlock_);\n }\n\n const deleted = this.maybeDeleteBlock_();\n if (!deleted) {\n // These are expensive and don't need to be done if we're deleting.\n this.draggingBlock_.setDragging(false);\n if (delta) { // !preventMove\n this.updateBlockAfterMove_(delta);\n } else {\n // Blocks dragged directly from a flyout may need to be bumped into\n // bounds.\n bumpObjects.bumpIntoBounds(\n this.draggingBlock_.workspace,\n this.workspace_.getMetricsManager().getScrollMetrics(true),\n this.draggingBlock_);\n }\n }\n this.workspace_.setResizesEnabled(true);\n\n eventUtils.setGroup(false);\n }\n\n /**\n * Calculates the drag delta and new location values after a block is dragged.\n *\n * @param currentDragDeltaXY How far the pointer has moved from the start of\n * the drag, in pixel units.\n * @returns New location after drag. delta is in workspace units. newLocation\n * is the new coordinate where the block should end up.\n */\n protected getNewLocationAfterDrag_(currentDragDeltaXY: Coordinate):\n {delta: Coordinate, newLocation: Coordinate} {\n const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY);\n const newLocation = Coordinate.sum(this.startXY_, delta);\n return {\n delta,\n newLocation,\n };\n }\n\n /**\n * May delete the dragging block, if allowed. If `this.wouldDeleteBlock_` is\n * not true, the block will not be deleted. This should be called at the end\n * of a block drag.\n *\n * @returns True if the block was deleted.\n */\n protected maybeDeleteBlock_(): boolean {\n if (this.wouldDeleteBlock_) {\n // Fire a move event, so we know where to go back to for an undo.\n this.fireMoveEvent_();\n this.draggingBlock_.dispose(false, true);\n common.draggingConnections.length = 0;\n return true;\n }\n return false;\n }\n\n /**\n * Updates the necessary information to place a block at a certain location.\n *\n * @param delta The change in location from where the block started the drag\n * to where it ended the drag.\n */\n protected updateBlockAfterMove_(delta: Coordinate) {\n this.draggingBlock_.moveConnections(delta.x, delta.y);\n this.fireMoveEvent_();\n if (this.draggedConnectionManager_.wouldConnectBlock()) {\n // Applying connections also rerenders the relevant blocks.\n this.draggedConnectionManager_.applyConnections();\n } else {\n this.draggingBlock_.render();\n }\n this.draggingBlock_.scheduleSnapAndBump();\n }\n\n /** Fire a UI event at the end of a block drag. */\n protected fireDragEndEvent_() {\n const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))(\n this.draggingBlock_, false, this.draggingBlock_.getDescendants(false));\n eventUtils.fire(event);\n }\n\n /**\n * Adds or removes the style of the cursor for the toolbox.\n * This is what changes the cursor to display an x when a deletable block is\n * held over the toolbox.\n *\n * @param isEnd True if we are at the end of a drag, false otherwise.\n */\n protected updateToolboxStyle_(isEnd: boolean) {\n const toolbox = this.workspace_.getToolbox();\n\n if (toolbox) {\n const style = this.draggingBlock_.isDeletable() ? 'blocklyToolboxDelete' :\n 'blocklyToolboxGrab';\n\n // AnyDuringMigration because: Property 'removeStyle' does not exist on\n // type 'IToolbox'.\n if (isEnd &&\n typeof (toolbox as AnyDuringMigration).removeStyle === 'function') {\n // AnyDuringMigration because: Property 'removeStyle' does not exist on\n // type 'IToolbox'.\n (toolbox as AnyDuringMigration).removeStyle(style);\n // AnyDuringMigration because: Property 'addStyle' does not exist on\n // type 'IToolbox'.\n } else if (\n !isEnd &&\n typeof (toolbox as AnyDuringMigration).addStyle === 'function') {\n // AnyDuringMigration because: Property 'addStyle' does not exist on\n // type 'IToolbox'.\n (toolbox as AnyDuringMigration).addStyle(style);\n }\n }\n }\n\n /** Fire a move event at the end of a block drag. */\n protected fireMoveEvent_() {\n const event = new (eventUtils.get(eventUtils.BLOCK_MOVE))(\n this.draggingBlock_) as BlockMove;\n event.oldCoordinate = this.startXY_;\n event.recordNew();\n eventUtils.fire(event);\n }\n\n /**\n * Update the cursor (and possibly the trash can lid) to reflect whether the\n * dragging block would be deleted if released immediately.\n */\n protected updateCursorDuringBlockDrag_() {\n this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_);\n }\n\n /**\n * Convert a coordinate object from pixels to workspace units, including a\n * correction for mutator workspaces.\n * This function does not consider differing origins. It simply scales the\n * input's x and y values.\n *\n * @param pixelCoord A coordinate with x and y values in CSS pixel units.\n * @returns The input coordinate divided by the workspace scale.\n */\n protected pixelsToWorkspaceUnits_(pixelCoord: Coordinate): Coordinate {\n const result = new Coordinate(\n pixelCoord.x / this.workspace_.scale,\n pixelCoord.y / this.workspace_.scale);\n if (this.workspace_.isMutator) {\n // If we're in a mutator, its scale is always 1, purely because of some\n // oddities in our rendering optimizations. The actual scale is the same\n // as the scale on the parent workspace. Fix that for dragging.\n const mainScale = this.workspace_.options.parentWorkspace!.scale;\n result.scale(1 / mainScale);\n }\n return result;\n }\n\n /**\n * Move all of the icons connected to this drag.\n *\n * @param dxy How far to move the icons from their original positions, in\n * workspace units.\n */\n protected dragIcons_(dxy: Coordinate) {\n // Moving icons moves their associated bubbles.\n for (let i = 0; i < this.dragIconData_.length; i++) {\n const data = this.dragIconData_[i];\n data.icon.setIconLocation(Coordinate.sum(data.location, dxy));\n }\n }\n\n /**\n * Get a list of the insertion markers that currently exist. Drags have 0, 1,\n * or 2 insertion markers.\n *\n * @returns A possibly empty list of insertion marker blocks.\n */\n getInsertionMarkers(): BlockSvg[] {\n // No insertion markers with the old style of dragged connection managers.\n if (this.draggedConnectionManager_ &&\n this.draggedConnectionManager_.getInsertionMarkers) {\n return this.draggedConnectionManager_.getInsertionMarkers();\n }\n return [];\n }\n}\n\n/** Data about the position of a given icon. */\nexport interface IconPositionData {\n location: Coordinate;\n icon: Icon;\n}\n\n/**\n * Make a list of all of the icons (comment, warning, and mutator) that are\n * on this block and its descendants. Moving an icon moves the bubble that\n * extends from it if that bubble is open.\n *\n * @param block The root block that is being dragged.\n * @returns The list of all icons and their locations.\n */\nfunction initIconData(block: BlockSvg): IconPositionData[] {\n // Build a list of icons that need to be moved and where they started.\n const dragIconData = [];\n const descendants = (block.getDescendants(false));\n\n for (let i = 0, descendant; descendant = descendants[i]; i++) {\n const icons = descendant.getIcons();\n for (let j = 0; j < icons.length; j++) {\n const data = {\n // Coordinate with x and y properties (workspace\n // coordinates).\n location: icons[j].getIconLocation(), // Blockly.Icon\n icon: icons[j],\n };\n dragIconData.push(data);\n }\n }\n // AnyDuringMigration because: Type '{ location: Coordinate | null; icon:\n // Icon; }[]' is not assignable to type 'IconPositionData[]'.\n return dragIconData as AnyDuringMigration;\n}\n\nregistry.register(registry.Type.BLOCK_DRAGGER, registry.DEFAULT, BlockDragger);\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The top level namespace used to access the Blockly library.\n *\n * @namespace Blockly\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_create.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/workspace_events.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_ui.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_ui_base.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_var_create.js';\n\nimport {Block} from './block.js';\nimport * as blockAnimations from './block_animations.js';\nimport {BlockDragSurfaceSvg} from './block_drag_surface.js';\nimport {BlockDragger} from './block_dragger.js';\nimport {BlockSvg} from './block_svg.js';\nimport {BlocklyOptions} from './blockly_options.js';\nimport {Blocks} from './blocks.js';\nimport * as browserEvents from './browser_events.js';\nimport {Bubble} from './bubble.js';\nimport {BubbleDragger} from './bubble_dragger.js';\nimport * as bumpObjects from './bump_objects.js';\nimport * as clipboard from './clipboard.js';\nimport {Comment} from './comment.js';\nimport * as common from './common.js';\nimport {ComponentManager} from './component_manager.js';\nimport {config} from './config.js';\nimport {Connection} from './connection.js';\nimport {ConnectionChecker} from './connection_checker.js';\nimport {ConnectionDB} from './connection_db.js';\nimport {ConnectionType} from './connection_type.js';\nimport * as ContextMenu from './contextmenu.js';\nimport * as ContextMenuItems from './contextmenu_items.js';\nimport {ContextMenuRegistry} from './contextmenu_registry.js';\nimport * as Css from './css.js';\nimport {DeleteArea} from './delete_area.js';\nimport * as dialog from './dialog.js';\nimport {DragTarget} from './drag_target.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport * as Events from './events/events.js';\nimport * as Extensions from './extensions.js';\nimport {Field} from './field.js';\nimport {FieldAngle} from './field_angle.js';\nimport {FieldCheckbox} from './field_checkbox.js';\nimport {FieldColour} from './field_colour.js';\nimport {FieldDropdown} from './field_dropdown.js';\nimport {FieldImage} from './field_image.js';\nimport {FieldLabel} from './field_label.js';\nimport {FieldLabelSerializable} from './field_label_serializable.js';\nimport {FieldMultilineInput} from './field_multilineinput.js';\nimport {FieldNumber} from './field_number.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {FieldTextInput} from './field_textinput.js';\nimport {FieldVariable} from './field_variable.js';\nimport {Flyout} from './flyout_base.js';\nimport {FlyoutButton} from './flyout_button.js';\nimport {HorizontalFlyout} from './flyout_horizontal.js';\nimport {FlyoutMetricsManager} from './flyout_metrics_manager.js';\nimport {VerticalFlyout} from './flyout_vertical.js';\nimport {Generator} from './generator.js';\nimport {Gesture} from './gesture.js';\nimport {Grid} from './grid.js';\nimport {Icon} from './icon.js';\nimport {inject} from './inject.js';\nimport {Align, Input} from './input.js';\nimport {inputTypes} from './input_types.js';\nimport {InsertionMarkerManager} from './insertion_marker_manager.js';\nimport {IASTNodeLocation} from './interfaces/i_ast_node_location.js';\nimport {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';\nimport {IASTNodeLocationWithBlock} from './interfaces/i_ast_node_location_with_block.js';\nimport {IAutoHideable} from './interfaces/i_autohideable.js';\nimport {IBlockDragger} from './interfaces/i_block_dragger.js';\nimport {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport {IBubble} from './interfaces/i_bubble.js';\nimport {ICollapsibleToolboxItem} from './interfaces/i_collapsible_toolbox_item.js';\nimport {IComponent} from './interfaces/i_component.js';\nimport {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport {IContextMenu} from './interfaces/i_contextmenu.js';\nimport {ICopyable} from './interfaces/i_copyable.js';\nimport {IDeletable} from './interfaces/i_deletable.js';\nimport {IDeleteArea} from './interfaces/i_delete_area.js';\nimport {IDragTarget} from './interfaces/i_drag_target.js';\nimport {IDraggable} from './interfaces/i_draggable.js';\nimport {IFlyout} from './interfaces/i_flyout.js';\nimport {IKeyboardAccessible} from './interfaces/i_keyboard_accessible.js';\nimport {IMetricsManager} from './interfaces/i_metrics_manager.js';\nimport {IMovable} from './interfaces/i_movable.js';\nimport {IPositionable} from './interfaces/i_positionable.js';\nimport {IRegistrable} from './interfaces/i_registrable.js';\nimport {IRegistrableField} from './interfaces/i_registrable_field.js';\nimport {ISelectable} from './interfaces/i_selectable.js';\nimport {ISelectableToolboxItem} from './interfaces/i_selectable_toolbox_item.js';\nimport {ISerializer as SerializerInterface} from './interfaces/i_serializer.js';\nimport {IStyleable} from './interfaces/i_styleable.js';\nimport {IToolbox} from './interfaces/i_toolbox.js';\nimport {IToolboxItem} from './interfaces/i_toolbox_item.js';\nimport * as internalConstants from './internal_constants.js';\nimport {ASTNode} from './keyboard_nav/ast_node.js';\nimport {BasicCursor} from './keyboard_nav/basic_cursor.js';\nimport {Cursor} from './keyboard_nav/cursor.js';\nimport {Marker} from './keyboard_nav/marker.js';\nimport {TabNavigateCursor} from './keyboard_nav/tab_navigate_cursor.js';\nimport {MarkerManager} from './marker_manager.js';\nimport {Menu} from './menu.js';\nimport {MenuItem} from './menuitem.js';\nimport {MetricsManager} from './metrics_manager.js';\nimport {Msg, setLocale} from './msg.js';\nimport {Mutator} from './mutator.js';\nimport {Names} from './names.js';\nimport {Options} from './options.js';\nimport * as uiPosition from './positionable_helpers.js';\nimport * as Procedures from './procedures.js';\nimport * as registry from './registry.js';\nimport {RenderedConnection} from './rendered_connection.js';\nimport * as blockRendering from './renderers/common/block_rendering.js';\nimport * as constants from './constants.js';\nimport * as geras from './renderers/geras/geras.js';\nimport * as minimalist from './renderers/minimalist/minimalist.js';\nimport * as thrasos from './renderers/thrasos/thrasos.js';\nimport * as zelos from './renderers/zelos/zelos.js';\nimport {Scrollbar} from './scrollbar.js';\nimport {ScrollbarPair} from './scrollbar_pair.js';\nimport * as serializationBlocks from './serialization/blocks.js';\nimport * as serializationExceptions from './serialization/exceptions.js';\nimport * as serializationPriorities from './serialization/priorities.js';\nimport * as serializationRegistry from './serialization/registry.js';\nimport * as serializationVariables from './serialization/variables.js';\nimport * as serializationWorkspaces from './serialization/workspaces.js';\nimport * as ShortcutItems from './shortcut_items.js';\nimport {ShortcutRegistry} from './shortcut_registry.js';\nimport {Theme} from './theme.js';\nimport * as Themes from './theme/themes.js';\nimport {ThemeManager} from './theme_manager.js';\nimport {ToolboxCategory} from './toolbox/category.js';\nimport {CollapsibleToolboxCategory} from './toolbox/collapsible_category.js';\nimport {ToolboxSeparator} from './toolbox/separator.js';\nimport {Toolbox} from './toolbox/toolbox.js';\nimport {ToolboxItem} from './toolbox/toolbox_item.js';\nimport * as Tooltip from './tooltip.js';\nimport * as Touch from './touch.js';\nimport {TouchGesture} from './touch_gesture.js';\nimport {Trashcan} from './trashcan.js';\nimport * as utils from './utils.js';\nimport * as colour from './utils/colour.js';\nimport * as deprecation from './utils/deprecation.js';\nimport * as svgMath from './utils/svg_math.js';\nimport * as toolbox from './utils/toolbox.js';\nimport {VariableMap} from './variable_map.js';\nimport {VariableModel} from './variable_model.js';\nimport * as Variables from './variables.js';\nimport * as VariablesDynamic from './variables_dynamic.js';\nimport {Warning} from './warning.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport {Workspace} from './workspace.js';\nimport {WorkspaceAudio} from './workspace_audio.js';\nimport {WorkspaceComment} from './workspace_comment.js';\nimport {WorkspaceCommentSvg} from './workspace_comment_svg.js';\nimport {WorkspaceDragSurfaceSvg} from './workspace_drag_surface_svg.js';\nimport {WorkspaceDragger} from './workspace_dragger.js';\nimport {resizeSvgContents as realResizeSvgContents, WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\nimport {ZoomControls} from './zoom_controls.js';\n\n\n/**\n * Blockly core version.\n * This constant is overridden by the build script (npm run build) to the value\n * of the version in package.json. This is done by the Closure Compiler in the\n * buildCompressed gulp task.\n * For local builds, you can pass --define='Blockly.VERSION=X.Y.Z' to the\n * compiler to override this constant.\n *\n * @define {string}\n * @alias Blockly.VERSION\n */\nexport const VERSION = 'uncompiled';\n\n/*\n * Top-level functions and properties on the Blockly namespace.\n * These are used only in external code. Do not reference these\n * from internal code as importing from this file can cause circular\n * dependencies. Do not add new functions here. There is probably a better\n * namespace to put new functions on.\n */\n\n/*\n * Aliases for input alignments used in block defintions.\n */\n\n/**\n * @see Blockly.Input.Align.LEFT\n * @alias Blockly.ALIGN_LEFT\n */\nexport const ALIGN_LEFT = Align.LEFT;\n\n/**\n * @see Blockly.Input.Align.CENTRE\n * @alias Blockly.ALIGN_CENTRE\n */\nexport const ALIGN_CENTRE = Align.CENTRE;\n\n/**\n * @see Blockly.Input.Align.RIGHT\n * @alias Blockly.ALIGN_RIGHT\n */\nexport const ALIGN_RIGHT = Align.RIGHT;\n/*\n * Aliases for constants used for connection and input types.\n */\n\n/**\n * @see ConnectionType.INPUT_VALUE\n * @alias Blockly.INPUT_VALUE\n */\nexport const INPUT_VALUE = ConnectionType.INPUT_VALUE;\n\n/**\n * @see ConnectionType.OUTPUT_VALUE\n * @alias Blockly.OUTPUT_VALUE\n */\nexport const OUTPUT_VALUE = ConnectionType.OUTPUT_VALUE;\n\n/**\n * @see ConnectionType.NEXT_STATEMENT\n * @alias Blockly.NEXT_STATEMENT\n */\nexport const NEXT_STATEMENT = ConnectionType.NEXT_STATEMENT;\n\n/**\n * @see ConnectionType.PREVIOUS_STATEMENT\n * @alias Blockly.PREVIOUS_STATEMENT\n */\nexport const PREVIOUS_STATEMENT = ConnectionType.PREVIOUS_STATEMENT;\n\n/**\n * @see inputTypes.DUMMY_INPUT\n * @alias Blockly.DUMMY_INPUT\n */\nexport const DUMMY_INPUT = inputTypes.DUMMY;\n\n/** Aliases for toolbox positions. */\n\n/**\n * @see toolbox.Position.TOP\n * @alias Blockly.TOOLBOX_AT_TOP\n */\nexport const TOOLBOX_AT_TOP = toolbox.Position.TOP;\n\n/**\n * @see toolbox.Position.BOTTOM\n * @alias Blockly.TOOLBOX_AT_BOTTOM\n */\nexport const TOOLBOX_AT_BOTTOM = toolbox.Position.BOTTOM;\n\n/**\n * @see toolbox.Position.LEFT\n * @alias Blockly.TOOLBOX_AT_LEFT\n */\nexport const TOOLBOX_AT_LEFT = toolbox.Position.LEFT;\n\n/**\n * @see toolbox.Position.RIGHT\n * @alias Blockly.TOOLBOX_AT_RIGHT\n */\nexport const TOOLBOX_AT_RIGHT = toolbox.Position.RIGHT;\n\n/*\n * Other aliased functions.\n */\n\n/**\n * Size the SVG image to completely fill its container. Call this when the view\n * actually changes sizes (e.g. on a window resize/device orientation change).\n * See workspace.resizeContents to resize the workspace when the contents\n * change (e.g. when a block is added or removed).\n * Record the height/width of the SVG image.\n *\n * @param workspace Any workspace in the SVG.\n * @see Blockly.common.svgResize\n * @alias Blockly.svgResize\n */\nexport const svgResize = common.svgResize;\n\n/**\n * Close tooltips, context menus, dropdown selections, etc.\n *\n * @param opt_onlyClosePopups Whether only popups should be closed.\n * @see Blockly.WorkspaceSvg.hideChaff\n * @alias Blockly.hideChaff\n */\nexport function hideChaff(opt_onlyClosePopups?: boolean) {\n (common.getMainWorkspace() as WorkspaceSvg).hideChaff(opt_onlyClosePopups);\n}\n\n/**\n * Returns the main workspace. Returns the last used main workspace (based on\n * focus). Try not to use this function, particularly if there are multiple\n * Blockly instances on a page.\n *\n * @see Blockly.common.getMainWorkspace\n * @alias Blockly.getMainWorkspace\n */\nexport const getMainWorkspace = common.getMainWorkspace;\n\n/**\n * Returns the currently selected copyable object.\n *\n * @alias Blockly.common.getSelected\n */\nexport const getSelected = common.getSelected;\n\n/**\n * Define blocks from an array of JSON block definitions, as might be generated\n * by the Blockly Developer Tools.\n *\n * @param jsonArray An array of JSON block definitions.\n * @see Blockly.common.defineBlocksWithJsonArray\n * @alias Blockly.defineBlocksWithJsonArray\n */\nexport const defineBlocksWithJsonArray = common.defineBlocksWithJsonArray;\n\n/**\n * Set the parent container. This is the container element that the WidgetDiv,\n * dropDownDiv, and Tooltip are rendered into the first time `Blockly.inject`\n * is called.\n * This method is a NOP if called after the first `Blockly.inject`.\n *\n * @param container The container element.\n * @see Blockly.common.setParentContainer\n * @alias Blockly.setParentContainer\n */\nexport const setParentContainer = common.setParentContainer;\n\n/**\n * Size the workspace when the contents change. This also updates\n * scrollbars accordingly.\n *\n * @param workspace The workspace to resize.\n * @deprecated Use **workspace.resizeContents** instead.\n * @see Blockly.WorkspaceSvg.resizeContents\n * @alias Blockly.resizeSvgContents\n */\nfunction resizeSvgContentsLocal(workspace: WorkspaceSvg) {\n deprecation.warn(\n 'Blockly.resizeSvgContents', 'December 2021', 'December 2022',\n 'Blockly.WorkspaceSvg.resizeSvgContents');\n realResizeSvgContents(workspace);\n}\nexport const resizeSvgContents = resizeSvgContentsLocal;\n\n/**\n * Copy a block or workspace comment onto the local clipboard.\n *\n * @param toCopy Block or Workspace Comment to be copied.\n * @deprecated Use **Blockly.clipboard.copy** instead.\n * @see Blockly.clipboard.copy\n * @alias Blockly.copy\n */\nexport function copy(toCopy: ICopyable) {\n deprecation.warn(\n 'Blockly.copy', 'December 2021', 'December 2022',\n 'Blockly.clipboard.copy');\n clipboard.copy(toCopy);\n}\n\n/**\n * Paste a block or workspace comment on to the main workspace.\n *\n * @returns True if the paste was successful, false otherwise.\n * @deprecated Use **Blockly.clipboard.paste** instead.\n * @see Blockly.clipboard.paste\n * @alias Blockly.paste\n */\nexport function paste(): boolean {\n deprecation.warn(\n 'Blockly.paste', 'December 2021', 'December 2022',\n 'Blockly.clipboard.paste');\n return !!clipboard.paste();\n}\n\n/**\n * Duplicate this block and its children, or a workspace comment.\n *\n * @param toDuplicate Block or Workspace Comment to be copied.\n * @deprecated Use **Blockly.clipboard.duplicate** instead.\n * @see Blockly.clipboard.duplicate\n * @alias Blockly.duplicate\n */\nexport function duplicate(toDuplicate: ICopyable) {\n deprecation.warn(\n 'Blockly.duplicate', 'December 2021', 'December 2022',\n 'Blockly.clipboard.duplicate');\n clipboard.duplicate(toDuplicate);\n}\n\n/**\n * Is the given string a number (includes negative and decimals).\n *\n * @param str Input string.\n * @returns True if number, false otherwise.\n * @deprecated Use **Blockly.utils.string.isNumber** instead.\n * @see Blockly.utils.string.isNumber\n * @alias Blockly.isNumber\n */\nexport function isNumber(str: string): boolean {\n deprecation.warn(\n 'Blockly.isNumber', 'December 2021', 'December 2022',\n 'Blockly.utils.string.isNumber');\n return utils.string.isNumber(str);\n}\n\n/**\n * Convert a hue (HSV model) into an RGB hex triplet.\n *\n * @param hue Hue on a colour wheel (0-360).\n * @returns RGB code, e.g. '#5ba65b'.\n * @deprecated Use **Blockly.utils.colour.hueToHex** instead.\n * @see Blockly.utils.colour.hueToHex\n * @alias Blockly.hueToHex\n */\nexport function hueToHex(hue: number): string {\n deprecation.warn(\n 'Blockly.hueToHex', 'December 2021', 'December 2022',\n 'Blockly.utils.colour.hueToHex');\n return colour.hueToHex(hue);\n}\n\n/**\n * Bind an event handler that should be called regardless of whether it is part\n * of the active touch stream.\n * Use this for events that are not part of a multi-part gesture (e.g.\n * mouseover for tooltips).\n *\n * @param node Node upon which to listen.\n * @param name Event name to listen to (e.g. 'mousedown').\n * @param thisObject The value of 'this' in the function.\n * @param func Function to call when event is triggered.\n * @returns Opaque data that can be passed to unbindEvent_.\n * @deprecated Use **Blockly.browserEvents.bind** instead.\n * @see Blockly.browserEvents.bind\n * @alias Blockly.bindEvent_\n */\nexport function bindEvent_(\n node: EventTarget, name: string, thisObject: Object|null,\n func: Function): browserEvents.Data {\n deprecation.warn(\n 'Blockly.bindEvent_', 'December 2021', 'December 2022',\n 'Blockly.browserEvents.bind');\n return browserEvents.bind(node, name, thisObject, func);\n}\n\n/**\n * Unbind one or more events event from a function call.\n *\n * @param bindData Opaque data from bindEvent_.\n * This list is emptied during the course of calling this function.\n * @returns The function call.\n * @deprecated Use **Blockly.browserEvents.unbind** instead.\n * @see browserEvents.unbind\n * @alias Blockly.unbindEvent_\n */\nexport function unbindEvent_(bindData: browserEvents.Data): Function {\n deprecation.warn(\n 'Blockly.unbindEvent_', 'December 2021', 'December 2022',\n 'Blockly.browserEvents.unbind');\n return browserEvents.unbind(bindData);\n}\n\n/**\n * Bind an event handler that can be ignored if it is not part of the active\n * touch stream.\n * Use this for events that either start or continue a multi-part gesture (e.g.\n * mousedown or mousemove, which may be part of a drag or click).\n *\n * @param node Node upon which to listen.\n * @param name Event name to listen to (e.g. 'mousedown').\n * @param thisObject The value of 'this' in the function.\n * @param func Function to call when event is triggered.\n * @param opt_noCaptureIdentifier True if triggering on this event should not\n * block execution of other event handlers on this touch or other\n * simultaneous touches. False by default.\n * @param opt_noPreventDefault True if triggering on this event should prevent\n * the default handler. False by default. If opt_noPreventDefault is\n * provided, opt_noCaptureIdentifier must also be provided.\n * @returns Opaque data that can be passed to unbindEvent_.\n * @deprecated Use **Blockly.browserEvents.conditionalBind** instead.\n * @see browserEvents.conditionalBind\n * @alias Blockly.bindEventWithChecks_\n */\nexport function bindEventWithChecks_(\n node: EventTarget, name: string, thisObject: Object|null, func: Function,\n opt_noCaptureIdentifier?: boolean,\n opt_noPreventDefault?: boolean): browserEvents.Data {\n deprecation.warn(\n 'Blockly.bindEventWithChecks_', 'December 2021', 'December 2022',\n 'Blockly.browserEvents.conditionalBind');\n return browserEvents.conditionalBind(\n node, name, thisObject, func, opt_noCaptureIdentifier,\n opt_noPreventDefault);\n}\n\n// Aliases to allow external code to access these values for legacy reasons.\nexport const COLLAPSE_CHARS = internalConstants.COLLAPSE_CHARS;\nexport const DRAG_STACK = internalConstants.DRAG_STACK;\nexport const OPPOSITE_TYPE = internalConstants.OPPOSITE_TYPE;\nexport const RENAME_VARIABLE_ID = internalConstants.RENAME_VARIABLE_ID;\nexport const DELETE_VARIABLE_ID = internalConstants.DELETE_VARIABLE_ID;\nexport const COLLAPSED_INPUT_NAME = constants.COLLAPSED_INPUT_NAME;\nexport const COLLAPSED_FIELD_NAME = constants.COLLAPSED_FIELD_NAME;\n\n/**\n * String for use in the \"custom\" attribute of a category in toolbox XML.\n * This string indicates that the category should be dynamically populated with\n * variable blocks.\n *\n * @alias Blockly.VARIABLE_CATEGORY_NAME\n */\nexport const VARIABLE_CATEGORY_NAME: string = Variables.CATEGORY_NAME;\n\n/**\n * String for use in the \"custom\" attribute of a category in toolbox XML.\n * This string indicates that the category should be dynamically populated with\n * variable blocks.\n *\n * @alias Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME\n */\nexport const VARIABLE_DYNAMIC_CATEGORY_NAME: string =\n VariablesDynamic.CATEGORY_NAME;\n/**\n * String for use in the \"custom\" attribute of a category in toolbox XML.\n * This string indicates that the category should be dynamically populated with\n * procedure blocks.\n *\n * @alias Blockly.PROCEDURE_CATEGORY_NAME\n */\nexport const PROCEDURE_CATEGORY_NAME: string = Procedures.CATEGORY_NAME;\n\n\n// Context for why we need to monkey-patch in these functions (internal):\n// https://docs.google.com/document/d/1MbO0LEA-pAyx1ErGLJnyUqTLrcYTo-5zga9qplnxeXo/edit?usp=sharing&resourcekey=0-5h_32-i-dHwHjf_9KYEVKg\n\n// clang-format off\nWorkspace.prototype.newBlock =\n function(prototypeName: string, opt_id?: string): Block {\n return new Block(this, prototypeName, opt_id);\n };\n\nWorkspaceSvg.prototype.newBlock =\n function(prototypeName: string, opt_id?: string): BlockSvg {\n return new BlockSvg(this, prototypeName, opt_id);\n };\n\nWorkspaceSvg.newTrashcan = function(workspace: WorkspaceSvg): Trashcan {\n return new Trashcan(workspace);\n};\n\nWorkspaceCommentSvg.prototype.showContextMenu =\n function(this: WorkspaceCommentSvg, e: Event) {\n if (this.workspace.options.readOnly) {\n return;\n }\n const menuOptions = [];\n \n if (this.isDeletable() && this.isMovable()) {\n menuOptions.push(ContextMenu.commentDuplicateOption(this));\n menuOptions.push(ContextMenu.commentDeleteOption(this));\n }\n \n ContextMenu.show(e, menuOptions, this.RTL);\n };\n\nMutator.prototype.newWorkspaceSvg =\n function(options: Options): WorkspaceSvg {\n return new WorkspaceSvg(options);\n };\n\nNames.prototype.populateProcedures =\n function(this: Names, workspace: Workspace) {\n const procedures = Procedures.allProcedures(workspace);\n // Flatten the return vs no-return procedure lists.\n const flattenedProcedures: AnyDuringMigration[][] =\n procedures[0].concat(procedures[1]);\n for (let i = 0; i < flattenedProcedures.length; i++) {\n this.getName(flattenedProcedures[i][0], Names.NameType.PROCEDURE);\n }\n };\n// clang-format on\n\n\n// Re-export submodules that no longer declareLegacyNamespace.\nexport {browserEvents};\nexport {ContextMenu};\nexport {ContextMenuItems};\nexport {Css};\nexport {Events};\nexport {Extensions};\nexport {Procedures};\nexport {ShortcutItems};\nexport {Themes};\nexport {Tooltip};\nexport {Touch};\nexport {Variables};\nexport {VariablesDynamic};\nexport {WidgetDiv};\nexport {Xml};\nexport {blockAnimations};\nexport {blockRendering};\nexport {bumpObjects};\nexport {clipboard};\nexport {common};\nexport {constants};\nexport {dialog};\nexport {fieldRegistry};\nexport {geras};\nexport {minimalist};\nexport {registry};\nexport {thrasos};\nexport {uiPosition};\nexport {utils};\nexport {zelos};\nexport {ASTNode};\nexport {BasicCursor};\nexport {Block};\nexport {BlocklyOptions};\nexport {BlockDragger};\nexport {BlockDragSurfaceSvg};\nexport {BlockSvg};\nexport {Blocks};\nexport {Bubble};\nexport {BubbleDragger};\nexport {CollapsibleToolboxCategory};\nexport {Comment};\nexport {ComponentManager};\nexport {Connection};\nexport {ConnectionType};\nexport {ConnectionChecker};\nexport {ConnectionDB};\nexport {ContextMenuRegistry};\nexport {Cursor};\nexport {DeleteArea};\nexport {DragTarget};\nexport const DropDownDiv = dropDownDiv;\nexport {Field};\nexport {FieldAngle};\nexport {FieldCheckbox};\nexport {FieldColour};\nexport {FieldDropdown};\nexport {FieldImage};\nexport {FieldLabel};\nexport {FieldLabelSerializable};\nexport {FieldMultilineInput};\nexport {FieldNumber};\nexport {FieldTextInput};\nexport {FieldVariable};\nexport {Flyout};\nexport {FlyoutButton};\nexport {FlyoutMetricsManager};\nexport {Generator};\nexport {Gesture};\nexport {Grid};\nexport {HorizontalFlyout};\nexport {IASTNodeLocation};\nexport {IASTNodeLocationSvg};\nexport {IASTNodeLocationWithBlock};\nexport {IAutoHideable};\nexport {IBlockDragger};\nexport {IBoundedElement};\nexport {IBubble};\nexport {ICollapsibleToolboxItem};\nexport {IComponent};\nexport {IConnectionChecker};\nexport {IContextMenu};\nexport {Icon};\nexport {ICopyable};\nexport {IDeletable};\nexport {IDeleteArea};\nexport {IDragTarget};\nexport {IDraggable};\nexport {IFlyout};\nexport {IKeyboardAccessible};\nexport {IMetricsManager};\nexport {IMovable};\nexport {Input};\nexport {InsertionMarkerManager};\nexport {IPositionable};\nexport {IRegistrable};\nexport {IRegistrableField};\nexport {ISelectable};\nexport {ISelectableToolboxItem};\nexport {IStyleable};\nexport {IToolbox};\nexport {IToolboxItem};\nexport {Marker};\nexport {MarkerManager};\nexport {Menu};\nexport {MenuItem};\nexport {MetricsManager};\nexport {Mutator};\nexport {Msg, setLocale};\nexport {Names};\nexport {Options};\nexport {RenderedConnection};\nexport {Scrollbar};\nexport {ScrollbarPair};\nexport {ShortcutRegistry};\nexport {TabNavigateCursor};\nexport {Theme};\nexport {ThemeManager};\nexport {Toolbox};\nexport {ToolboxCategory};\nexport {ToolboxItem};\nexport {ToolboxSeparator};\nexport {TouchGesture};\nexport {Trashcan};\nexport {VariableMap};\nexport {VariableModel};\nexport {VerticalFlyout};\nexport {Warning};\nexport {Workspace};\nexport {WorkspaceAudio};\nexport {WorkspaceComment};\nexport {WorkspaceCommentSvg};\nexport {WorkspaceDragSurfaceSvg};\nexport {WorkspaceDragger};\nexport {WorkspaceSvg};\nexport {ZoomControls};\nexport {config};\n/** @deprecated Use Blockly.ConnectionType instead. */\nexport const connectionTypes = ConnectionType;\nexport {inject};\nexport {inputTypes};\nexport namespace serialization {\n export const blocks = serializationBlocks;\n export const exceptions = serializationExceptions;\n export const priorities = serializationPriorities;\n export const registry = serializationRegistry;\n export const variables = serializationVariables;\n export const workspaces = serializationWorkspaces;\n export type ISerializer = SerializerInterface;\n}\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"// Copyright 2018 The Closure Library Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * @fileoverview ES6 module that exports symbols from base.js so that ES6\n * modules do not need to use globals and so that is clear if a project is using\n * Closure's base.js file. It is also a subset of properties in base.js, meaning\n * it should be clearer what should not be used in ES6 modules\n * (goog.module/provide are not exported here, for example). Though that is not\n * to say that everything in this file should be used in an ES6 module; some\n * depreciated functions are exported to make migration easier (e.g.\n * goog.scope).\n *\n * Note that this does not load Closure's base.js file, it is still up to the\n * programmer to include it. Nor does the fact that this is an ES6 module mean\n * that projects no longer require deps.js files for debug loading - they do.\n * Closure will need to load your ES6 modules for you if you have any Closure\n * file (goog.provide/goog.module) dependencies, as they need to be available\n * before the ES6 module evaluates.\n *\n * Also note that this file has special compiler handling! It is okay to export\n * anything from this file, but the name also needs to exist on the global goog.\n * This special compiler pass enforces that you always import this file as\n * `import * as goog`, as many tools use regex based parsing to find\n * goog.require calls.\n */\n\nexport const global = globalThis;\n// export const require = goog.require;\n// export const define = goog.define;\n// export const DEBUG = goog.DEBUG;\n// export const LOCALE = goog.LOCALE;\n// export const TRUSTED_SITE = goog.TRUSTED_SITE;\n// export const DISALLOW_TEST_ONLY_CODE = goog.DISALLOW_TEST_ONLY_CODE;\n// export const getGoogModule = goog.module.get;\n// export const setTestOnly = goog.setTestOnly;\n// export const forwardDeclare = goog.forwardDeclare;\n// export const getObjectByName = goog.getObjectByName;\n// export const basePath = goog.basePath;\n// export const addSingletonGetter = goog.addSingletonGetter;\n// export const typeOf = goog.typeOf;\n// export const isArrayLike = goog.isArrayLike;\n// export const isDateLike = goog.isDateLike;\n// export const isObject = goog.isObject;\n// export const getUid = goog.getUid;\n// export const hasUid = goog.hasUid;\n// export const removeUid = goog.removeUid;\n// export const now = Date.now;\n// export const globalEval = goog.globalEval;\n// export const getCssName = goog.getCssName;\n// export const setCssNameMapping = goog.setCssNameMapping;\n// export const getMsg = goog.getMsg;\n// export const getMsgWithFallback = goog.getMsgWithFallback;\n// export const exportSymbol = goog.exportSymbol;\n// export const exportProperty = goog.exportProperty;\n// export const abstractMethod = goog.abstractMethod;\n// export const cloneObject = goog.cloneObject;\n// export const bind = goog.bind;\n// export const partial = goog.partial;\n// export const inherits = goog.inherits;\n// export const scope = goog.scope;\n// export const defineClass = goog.defineClass;\nexport const declareModuleId = function(namespace) {\n if (window.goog && window.goog.declareModuleId) {\n window.goog.declareModuleId.call(this, namespace);\n }\n};\n\n\n// Export select properties of module. Do not export the function itself or\n// goog.module.declareLegacyNamespace.\n// export const module = {\n// get: goog.module.get,\n// };\n\n// Omissions include:\n// goog.ENABLE_DEBUG_LOADER - define only used in base.\n// goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING - define only used in base.\n// goog.provide - ES6 modules do not provide anything.\n// goog.module - ES6 modules cannot be goog.modules.\n// goog.module.declareLegacyNamespace - ES6 modules cannot declare namespaces.\n// goog.addDependency - meant to only be used by dependency files.\n// goog.DEPENDENCIES_ENABLED - constant only used in base.\n// goog.TRANSPILE - define only used in base.\n// goog.TRANSPILER - define only used in base.\n// goog.loadModule - should not be called by any ES6 module; exists for\n// generated bundles.\n// goog.LOAD_MODULE_USING_EVAL - define only used in base.\n// goog.SEAL_MODULE_EXPORTS - define only used in base.\n// goog.DebugLoader - used rarely, only outside of compiled code.\n// goog.Transpiler - used rarely, only outside of compiled code.\n","/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview A minimal implementation of base.js.\n *\n * This file is used in place of base.js (Closure library bootstrap\n * code) when building Blockly using the Closure Compiler. Refer to\n * base.js for more information about items defined here.\n *\n * @provideGoog\n */\n\n/** @define {boolean} Overridden to true by the compiler. */\nvar COMPILED = false;\n\n/** @const */\nvar goog = goog || {};\n\n/**\n * Reference to the global object. This is provided as 'root' by the\n * UMD wrapper, but prefer globalThis if it is defined.\n * \n * https://www.ecma-international.org/ecma-262/9.0/index.html#sec-global-object\n *\n * @const\n * @type {!Global}\n * @suppress {undefinedVars}\n */\ngoog.global = globalThis || root;\n\n/** @type {Object<string, (string|number|boolean)>|undefined} */\ngoog.global.CLOSURE_DEFINES;\n\n/**\n * Defines a named value.\n * When compiled the default can be overridden using the compiler options or the\n * value set in the CLOSURE_DEFINES object. Returns the defined value so that it\n * can be used safely in modules. Note that the value type MUST be either\n * boolean, number, or string.\n *\n * @param {string} name\n * @param {T} defaultValue\n * @return {T}\n * @template T\n */\ngoog.define = function(name, defaultValue) {\n return defaultValue;\n};\n\n/** @define {boolean} */\ngoog.DEBUG = goog.define('goog.DEBUG', false);\n\n/** @define {boolean} */\ngoog.DISALLOW_TEST_ONLY_CODE =\n goog.define('goog.DISALLOW_TEST_ONLY_CODE', COMPILED && !goog.DEBUG);\n\n/**\n * @param {string} name\n */\ngoog.provide = function(name) {};\n\n/**\n * @param {string} name\n * @return {void}\n */\ngoog.module = function(name) {};\n\n/**\n * @param {string} name\n * @return {?}\n * @suppress {missingProvide}\n */\ngoog.module.get = function(name) {};\n\n/** @suppress {missingProvide} */\ngoog.module.declareLegacyNamespace = function() {};\n\n/**\n * Marks that the current file should only be used for testing, and never for\n * live code in production.\n *\n * In the case of unit tests, the message may optionally be an exact namespace\n * for the test (e.g. 'goog.stringTest'). The linter will then ignore the extra\n * provide (if not explicitly defined in the code).\n *\n * @param {string=} opt_message Optional message to add to the error that's\n * raised when used in production code.\n */\ngoog.setTestOnly = function(opt_message) {\n if (goog.DISALLOW_TEST_ONLY_CODE) {\n opt_message = opt_message || '';\n throw new Error(\n 'Importing test-only code into non-debug environment' +\n (opt_message ? ': ' + opt_message : '.'));\n }\n};\n\n/**\n * @param {string} namespace\n * @return {?}\n */\ngoog.require = function(namespace) {};\n\n/**\n * @param {string} namespace\n * @return {?}\n */\ngoog.requireType = function(namespace) {};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Useragent detection.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.userAgent\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.userAgent');\n\n\n/** The raw useragent string. */\nlet rawUserAgent: string;\n\nlet isJavaFx: boolean;\n\nlet isWebKit: boolean;\n\nlet isGecko: boolean;\n\nlet isAndroid: boolean;\n\nlet isIPad: boolean;\n\nlet isIPhone: boolean;\n\nlet isMac: boolean;\n\nlet isTablet: boolean;\n\nlet isMobile: boolean;\n\n(function(raw) {\nrawUserAgent = raw;\nconst rawUpper = rawUserAgent.toUpperCase();\n/**\n * Case-insensitive test of whether name is in the useragent string.\n *\n * @param name Name to test.\n * @returns True if name is present.\n */\nfunction has(name: string): boolean {\n return rawUpper.indexOf(name.toUpperCase()) !== -1;\n}\n\n// Browsers. Logic from:\n// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/browser.js\n// Useragent for JavaFX:\n// Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.44\n// (KHTML, like Gecko) JavaFX/8.0 Safari/537.44\nisJavaFx = has('JavaFX');\n\n// Engines. Logic from:\n// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/engine.js\nisWebKit = has('WebKit');\nisGecko = has('Gecko') && !isWebKit;\n\n// Platforms. Logic from:\n// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/platform.js\n// and\n// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/extra.js\nisAndroid = has('Android');\nconst maxTouchPoints =\n globalThis['navigator'] && globalThis['navigator']['maxTouchPoints'];\nisIPad = has('iPad') || has('Macintosh') && maxTouchPoints > 0;\nisIPhone = has('iPhone') && !isIPad;\nisMac = has('Macintosh');\n\n// Devices. Logic from:\n// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/device.js\nisTablet = isIPad || isAndroid && !has('Mobile') || has('Silk');\nisMobile = !isTablet && (isIPhone || isAndroid);\n})(globalThis['navigator'] && globalThis['navigator']['userAgent'] || '');\n\n/** @alias Blockly.utils.userAgent.raw */\nexport const raw: string = rawUserAgent;\n\n/** @alias Blockly.utils.userAgent.JavaFx */\nexport const JavaFx: boolean = isJavaFx;\n\n/** @alias Blockly.utils.userAgent.GECKO */\nexport const GECKO: boolean = isGecko;\n\n/** @alias Blockly.utils.userAgent.ANDROID */\nexport const ANDROID: boolean = isAndroid;\n\n/** @alias Blockly.utils.userAgent.IPAD */\nexport const IPAD: boolean = isIPad;\n\n/** @alias Blockly.utils.userAgent.IPHONE */\nexport const IPHONE: boolean = isIPhone;\n\n/** @alias Blockly.utils.userAgent.MAC */\nexport const MAC: boolean = isMac;\n\n/** @alias Blockly.utils.userAgent.MOBILE */\nexport const MOBILE: boolean = isMobile;\n","/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A mapping of block type names to block prototype objects.\n *\n * @namespace Blockly.blocks\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blocks');\n\n\n/**\n * A block definition. For now this very lose, but it can potentially\n * be refined e.g. by replacing this typedef with a class definition.\n */\nexport type BlockDefinition = AnyDuringMigration;\n\n/**\n * A mapping of block type names to block prototype objects.\n *\n * @alias Blockly.blocks.Blocks\n */\nexport const Blocks: {[key: string]: BlockDefinition} = Object.create(null);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for rectangle manipulation.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.Rect');\n\n\n/**\n * Class for representing rectangular regions.\n *\n * @alias Blockly.utils.Rect\n */\nexport class Rect {\n /**\n * @param top Top.\n * @param bottom Bottom.\n * @param left Left.\n * @param right Right.\n */\n constructor(\n public top: number, public bottom: number, public left: number,\n public right: number) {}\n\n /**\n * Tests whether this rectangle contains a x/y coordinate.\n *\n * @param x The x coordinate to test for containment.\n * @param y The y coordinate to test for containment.\n * @returns Whether this rectangle contains given coordinate.\n */\n contains(x: number, y: number): boolean {\n return x >= this.left && x <= this.right && y >= this.top &&\n y <= this.bottom;\n }\n\n /**\n * Tests whether this rectangle intersects the provided rectangle.\n * Assumes that the coordinate system increases going down and left.\n *\n * @param other The other rectangle to check for intersection with.\n * @returns Whether this rectangle intersects the provided rectangle.\n */\n intersects(other: Rect): boolean {\n return !(\n this.left > other.right || this.right < other.left ||\n this.top > other.bottom || this.bottom < other.top);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for coordinate manipulation.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.Coordinate');\n\n\n/**\n * Class for representing coordinates and positions.\n *\n * @alias Blockly.utils.Coordinate\n */\nexport class Coordinate {\n /**\n * @param x Left.\n * @param y Top.\n */\n constructor(public x: number, public y: number) {}\n\n /**\n * Creates a new copy of this coordinate.\n *\n * @returns A copy of this coordinate.\n */\n clone(): Coordinate {\n return new Coordinate(this.x, this.y);\n }\n\n /**\n * Scales this coordinate by the given scale factor.\n *\n * @param s The scale factor to use for both x and y dimensions.\n * @returns This coordinate after scaling.\n */\n scale(s: number): Coordinate {\n this.x *= s;\n this.y *= s;\n return this;\n }\n\n /**\n * Translates this coordinate by the given offsets.\n * respectively.\n *\n * @param tx The value to translate x by.\n * @param ty The value to translate y by.\n * @returns This coordinate after translating.\n */\n translate(tx: number, ty: number): Coordinate {\n this.x += tx;\n this.y += ty;\n return this;\n }\n\n /**\n * Compares coordinates for equality.\n *\n * @param a A Coordinate.\n * @param b A Coordinate.\n * @returns True iff the coordinates are equal, or if both are null.\n */\n static equals(a?: Coordinate|null, b?: Coordinate|null): boolean {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.x === b.x && a.y === b.y;\n }\n\n /**\n * Returns the distance between two coordinates.\n *\n * @param a A Coordinate.\n * @param b A Coordinate.\n * @returns The distance between `a` and `b`.\n */\n static distance(a: Coordinate, b: Coordinate): number {\n const dx = a.x - b.x;\n const dy = a.y - b.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * Returns the magnitude of a coordinate.\n *\n * @param a A Coordinate.\n * @returns The distance between the origin and `a`.\n */\n static magnitude(a: Coordinate): number {\n return Math.sqrt(a.x * a.x + a.y * a.y);\n }\n\n /**\n * Returns the difference between two coordinates as a new\n * Coordinate.\n *\n * @param a An x/y coordinate.\n * @param b An x/y coordinate.\n * @returns A Coordinate representing the difference between `a` and `b`.\n */\n static difference(a: Coordinate|SVGPoint, b: Coordinate|SVGPoint):\n Coordinate {\n return new Coordinate(a.x - b.x, a.y - b.y);\n }\n\n /**\n * Returns the sum of two coordinates as a new Coordinate.\n *\n * @param a An x/y coordinate.\n * @param b An x/y coordinate.\n * @returns A Coordinate representing the sum of the two coordinates.\n */\n static sum(a: Coordinate|SVGPoint, b: Coordinate|SVGPoint): Coordinate {\n return new Coordinate(a.x + b.x, a.y + b.y);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility methods for size calculation.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.Size');\n\n\n/**\n * Class for representing sizes consisting of a width and height.\n *\n * @alias Blockly.utils.Size\n */\nexport class Size {\n /**\n * @param width Width.\n * @param height Height.\n */\n constructor(public width: number, public height: number) {}\n\n /**\n * Compares sizes for equality.\n *\n * @param a A Size.\n * @param b A Size.\n * @returns True iff the sizes have equal widths and equal heights, or if both\n * are null.\n */\n static equals(a: Size|null, b: Size|null): boolean {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.width === b.width && a.height === b.height;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An enum for the possible types of inputs.\n *\n * @namespace Blockly.inputTypes\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.inputTypes');\n\nimport {ConnectionType} from './connection_type.js';\n\n\n/**\n * Enum for the type of a connection or input.\n *\n * @alias Blockly.inputTypes\n */\nexport enum inputTypes {\n // A right-facing value input. E.g. 'set item to' or 'return'.\n VALUE = ConnectionType.INPUT_VALUE,\n // A down-facing block stack. E.g. 'if-do' or 'else'.\n STATEMENT = ConnectionType.NEXT_STATEMENT,\n // A dummy input. Used to add field(s) with no input.\n DUMMY = 5\n}\n","/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Empty name space for the Message singleton.\n *\n * @namespace Blockly.Msg\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Msg');\n\n\n/** A dictionary of localised messages. */\nexport const Msg: {[key: string]: string} = Object.create(null);\n\n/**\n * Sets the locale (i.e. the localized messages/block-text/etc) to the given\n * locale.\n *\n * This is not useful/necessary when loading from a script tag, because the\n * messages are automatically cluged into the Blockly.Msg object. But we provide\n * it in both the script-tag and non-script-tag contexts so that the tscompiler\n * can properly create our type definition files.\n *\n * @param locale An object defining the messages for a given language.\n */\nexport const setLocale = function(locale: {[key: string]: string}) {\n Object.keys(locale).forEach(function(k) {\n Msg[k] = locale[k];\n });\n};\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Abstract class for events fired as a result of actions in\n * Blockly's editor.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.Abstract');\n\nimport * as common from '../common.js';\nimport type {Workspace} from '../workspace.js';\n\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Abstract class for an event.\n *\n * @alias Blockly.Events.Abstract\n */\nexport abstract class Abstract {\n /** Whether or not the event is blank (to be populated by fromJson). */\n abstract isBlank: boolean;\n\n /** The workspace identifier for this event. */\n workspaceId?: string = undefined;\n group: string;\n recordUndo: boolean;\n\n /** Whether or not the event is a UI event. */\n isUiEvent = false;\n\n /** Type of this event. */\n type = '';\n\n /** @alias Blockly.Events.Abstract */\n constructor() {\n /**\n * The event group ID for the group this event belongs to. Groups define\n * events that should be treated as an single action from the user's\n * perspective, and should be undone together.\n */\n this.group = eventUtils.getGroup();\n\n /** Sets whether the event should be added to the undo stack. */\n this.recordUndo = eventUtils.getRecordUndo();\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n toJson(): AbstractEventJson {\n return {\n 'type': this.type,\n 'group': this.group,\n };\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n fromJson(json: AbstractEventJson) {\n this.isBlank = false;\n this.group = json['group'] || '';\n }\n\n /**\n * Does this event record any change of state?\n *\n * @returns True if null, false if something changed.\n */\n isNull(): boolean {\n return false;\n }\n\n /**\n * Run an event.\n *\n * @param _forward True if run forward, false if run backward (undo).\n */\n run(_forward: boolean) {}\n // Defined by subclasses.\n\n /**\n * Get workspace the event belongs to.\n *\n * @returns The workspace the event belongs to.\n * @throws {Error} if workspace is null.\n * @internal\n */\n getEventWorkspace_(): Workspace {\n let workspace;\n if (this.workspaceId) {\n workspace = common.getWorkspaceById(this.workspaceId);\n }\n if (!workspace) {\n throw Error(\n 'Workspace is null. Event must have been generated from real' +\n ' Blockly events.');\n }\n return workspace;\n }\n}\n\nexport interface AbstractEventJson {\n type: string;\n group: string;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Abstract class for a variable event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.VarBase');\n\nimport type {VariableModel} from '../variable_model.js';\n\nimport {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js';\n\n\n/**\n * Abstract class for a variable event.\n *\n * @alias Blockly.Events.VarBase\n */\nexport class VarBase extends AbstractEvent {\n override isBlank = true;\n varId?: string;\n\n /**\n * @param opt_variable The variable this event corresponds to. Undefined for\n * a blank event.\n */\n constructor(opt_variable?: VariableModel) {\n super();\n this.isBlank = typeof opt_variable === 'undefined';\n if (!opt_variable) return;\n\n /** The variable id for the variable this event pertains to. */\n this.varId = opt_variable.getId();\n\n /** The workspace identifier for this event. */\n this.workspaceId = opt_variable.workspace.id;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): VarBaseJson {\n const json = super.toJson() as VarBaseJson;\n if (!this.varId) {\n throw new Error(\n 'The var ID is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n json['varId'] = this.varId;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: VarBaseJson) {\n super.fromJson(json);\n this.varId = json['varId'];\n }\n}\n\nexport interface VarBaseJson extends AbstractEventJson {\n varId: string;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a variable creation event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.VarCreate');\n\nimport * as registry from '../registry.js';\nimport type {VariableModel} from '../variable_model.js';\n\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a variable creation event.\n *\n * @alias Blockly.Events.VarCreate\n */\nexport class VarCreate extends VarBase {\n override type = eventUtils.VAR_CREATE;\n varType?: string;\n varName?: string;\n\n /**\n * @param opt_variable The created variable. Undefined for a blank event.\n */\n constructor(opt_variable?: VariableModel) {\n super(opt_variable);\n\n if (!opt_variable) {\n return; // Blank event to be populated by fromJson.\n }\n this.varType = opt_variable.type;\n this.varName = opt_variable.name;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): VarCreateJson {\n const json = super.toJson() as VarCreateJson;\n if (!this.varType) {\n throw new Error(\n 'The var type is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.varName) {\n throw new Error(\n 'The var name is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n json['varType'] = this.varType;\n json['varName'] = this.varName;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: VarCreateJson) {\n super.fromJson(json);\n this.varType = json['varType'];\n this.varName = json['varName'];\n }\n\n /**\n * Run a variable creation event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.varId) {\n throw new Error(\n 'The var ID is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.varName) {\n throw new Error(\n 'The var name is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (forward) {\n workspace.createVariable(this.varName, this.varType, this.varId);\n } else {\n workspace.deleteVariableById(this.varId);\n }\n }\n}\n\nexport interface VarCreateJson extends VarBaseJson {\n varType: string;\n varName: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.VAR_CREATE, VarCreate);\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Components for the variable model.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.VariableModel');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_var_create.js';\n\nimport * as eventUtils from './events/utils.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport type {Workspace} from './workspace.js';\n\n\n/**\n * Class for a variable model.\n * Holds information for the variable including name, ID, and type.\n *\n * @see {Blockly.FieldVariable}\n * @alias Blockly.VariableModel\n */\nexport class VariableModel {\n type: string;\n private readonly id_: string;\n\n /**\n * @param workspace The variable's workspace.\n * @param name The name of the variable. This is the user-visible name (e.g.\n * 'my var' or '私の変数'), not the generated name.\n * @param opt_type The type of the variable like 'int' or 'string'.\n * Does not need to be unique. Field_variable can filter variables based\n * on their type. This will default to '' which is a specific type.\n * @param opt_id The unique ID of the variable. This will default to a UUID.\n */\n constructor(\n public workspace: Workspace, public name: string, opt_type?: string,\n opt_id?: string) {\n /**\n * The type of the variable, such as 'int' or 'sound_effect'. This may be\n * used to build a list of variables of a specific type. By default this is\n * the empty string '', which is a specific type.\n *\n * @see {Blockly.FieldVariable}\n */\n this.type = opt_type || '';\n\n /**\n * A unique ID for the variable. This should be defined at creation and\n * not change, even if the name changes. In most cases this should be a\n * UUID.\n */\n this.id_ = opt_id || idGenerator.genUid();\n\n eventUtils.fire(new (eventUtils.get(eventUtils.VAR_CREATE))(this));\n }\n\n /** @returns The ID for the variable. */\n getId(): string {\n return this.id_;\n }\n\n /**\n * A custom compare function for the VariableModel objects.\n *\n * @param var1 First variable to compare.\n * @param var2 Second variable to compare.\n * @returns -1 if name of var1 is less than name of var2, 0 if equal, and 1 if\n * greater.\n * @internal\n */\n static compareByName(var1: VariableModel, var2: VariableModel): number {\n return var1.name.localeCompare(var2.name, undefined, {sensitivity: 'base'});\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a code comment on the workspace.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.WorkspaceComment');\n\nimport type {CommentMove} from './events/events_comment_move.js';\nimport * as eventUtils from './events/utils.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport * as xml from './utils/xml.js';\nimport type {Workspace} from './workspace.js';\n\n\n/**\n * Class for a workspace comment.\n *\n * @alias Blockly.WorkspaceComment\n */\nexport class WorkspaceComment {\n id: string;\n protected xy_: Coordinate;\n protected height_: number;\n protected width_: number;\n protected RTL: boolean;\n\n private deletable_ = true;\n\n private movable_ = true;\n\n private editable_ = true;\n protected content_: string;\n\n /** Whether this comment has been disposed. */\n protected disposed_ = false;\n /** @internal */\n isComment = true;\n\n /**\n * @param workspace The block's workspace.\n * @param content The content of this workspace comment.\n * @param height Height of the comment.\n * @param width Width of the comment.\n * @param opt_id Optional ID. Use this ID if provided, otherwise create a new\n * ID.\n */\n constructor(\n public workspace: Workspace, content: string, height: number,\n width: number, opt_id?: string) {\n this.id = opt_id && !workspace.getCommentById(opt_id) ?\n opt_id :\n idGenerator.genUid();\n\n workspace.addTopComment(this);\n\n /**\n * The comment's position in workspace units. (0, 0) is at the workspace's\n * origin; scale does not change this value.\n */\n this.xy_ = new Coordinate(0, 0);\n\n /**\n * The comment's height in workspace units. Scale does not change this\n * value.\n */\n this.height_ = height;\n\n /**\n * The comment's width in workspace units. Scale does not change this\n * value.\n */\n this.width_ = width;\n\n this.RTL = workspace.RTL;\n\n this.content_ = content;\n\n WorkspaceComment.fireCreateEvent(this);\n }\n\n /**\n * Dispose of this comment.\n *\n * @internal\n */\n dispose() {\n if (this.disposed_) {\n return;\n }\n\n if (eventUtils.isEnabled()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.COMMENT_DELETE))(this));\n }\n // Remove from the list of top comments and the comment database.\n this.workspace.removeTopComment(this);\n this.disposed_ = true;\n }\n\n // Height, width, x, and y are all stored on even non-rendered comments, to\n // preserve state if you pass the contents through a headless workspace.\n\n /**\n * Get comment height.\n *\n * @returns Comment height.\n * @internal\n */\n getHeight(): number {\n return this.height_;\n }\n\n /**\n * Set comment height.\n *\n * @param height Comment height.\n * @internal\n */\n setHeight(height: number) {\n this.height_ = height;\n }\n\n /**\n * Get comment width.\n *\n * @returns Comment width.\n * @internal\n */\n getWidth(): number {\n return this.width_;\n }\n\n /**\n * Set comment width.\n *\n * @param width comment width.\n * @internal\n */\n setWidth(width: number) {\n this.width_ = width;\n }\n\n /**\n * Get stored location.\n *\n * @returns The comment's stored location.\n * This is not valid if the comment is currently being dragged.\n * @internal\n */\n getXY(): Coordinate {\n return new Coordinate(this.xy_.x, this.xy_.y);\n }\n\n /**\n * Move a comment by a relative offset.\n *\n * @param dx Horizontal offset, in workspace units.\n * @param dy Vertical offset, in workspace units.\n * @internal\n */\n moveBy(dx: number, dy: number) {\n const event =\n new (eventUtils.get(eventUtils.COMMENT_MOVE))(this) as CommentMove;\n this.xy_.translate(dx, dy);\n event.recordNew();\n eventUtils.fire(event);\n }\n\n /**\n * Get whether this comment is deletable or not.\n *\n * @returns True if deletable.\n * @internal\n */\n isDeletable(): boolean {\n return this.deletable_ &&\n !(this.workspace && this.workspace.options.readOnly);\n }\n\n /**\n * Set whether this comment is deletable or not.\n *\n * @param deletable True if deletable.\n * @internal\n */\n setDeletable(deletable: boolean) {\n this.deletable_ = deletable;\n }\n\n /**\n * Get whether this comment is movable or not.\n *\n * @returns True if movable.\n * @internal\n */\n isMovable(): boolean {\n return this.movable_ &&\n !(this.workspace && this.workspace.options.readOnly);\n }\n\n /**\n * Set whether this comment is movable or not.\n *\n * @param movable True if movable.\n * @internal\n */\n setMovable(movable: boolean) {\n this.movable_ = movable;\n }\n\n /**\n * Get whether this comment is editable or not.\n *\n * @returns True if editable.\n */\n isEditable(): boolean {\n return this.editable_ &&\n !(this.workspace && this.workspace.options.readOnly);\n }\n\n /**\n * Set whether this comment is editable or not.\n *\n * @param editable True if editable.\n */\n setEditable(editable: boolean) {\n this.editable_ = editable;\n }\n\n /**\n * Returns this comment's text.\n *\n * @returns Comment text.\n * @internal\n */\n getContent(): string {\n return this.content_;\n }\n\n /**\n * Set this comment's content.\n *\n * @param content Comment content.\n * @internal\n */\n setContent(content: string) {\n if (this.content_ !== content) {\n eventUtils.fire(new (eventUtils.get(eventUtils.COMMENT_CHANGE))(\n this, this.content_, content));\n this.content_ = content;\n }\n }\n\n /**\n * Encode a comment subtree as XML with XY coordinates.\n *\n * @param opt_noId True if the encoder should skip the comment ID.\n * @returns Tree of XML elements.\n * @internal\n */\n toXmlWithXY(opt_noId?: boolean): Element {\n const element = this.toXml(opt_noId);\n element.setAttribute('x', `${Math.round(this.xy_.x)}`);\n element.setAttribute('y', `${Math.round(this.xy_.y)}`);\n element.setAttribute('h', `${this.height_}`);\n element.setAttribute('w', `${this.width_}`);\n return element;\n }\n\n /**\n * Encode a comment subtree as XML, but don't serialize the XY coordinates.\n * This method avoids some expensive metrics-related calls that are made in\n * toXmlWithXY().\n *\n * @param opt_noId True if the encoder should skip the comment ID.\n * @returns Tree of XML elements.\n * @internal\n */\n toXml(opt_noId?: boolean): Element {\n const commentElement = xml.createElement('comment');\n if (!opt_noId) {\n commentElement.id = this.id;\n }\n commentElement.textContent = this.getContent();\n return commentElement;\n }\n\n /**\n * Fire a create event for the given workspace comment, if comments are\n * enabled.\n *\n * @param comment The comment that was just created.\n * @internal\n */\n static fireCreateEvent(comment: WorkspaceComment) {\n if (eventUtils.isEnabled()) {\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n try {\n eventUtils.fire(\n new (eventUtils.get(eventUtils.COMMENT_CREATE))(comment));\n } finally {\n if (!existingGroup) {\n eventUtils.setGroup(false);\n }\n }\n }\n }\n\n /**\n * Decode an XML comment tag and create a comment on the workspace.\n *\n * @param xmlComment XML comment element.\n * @param workspace The workspace.\n * @returns The created workspace comment.\n * @internal\n */\n static fromXml(xmlComment: Element, workspace: Workspace): WorkspaceComment {\n const info = WorkspaceComment.parseAttributes(xmlComment);\n\n const comment =\n new WorkspaceComment(workspace, info.content, info.h, info.w, info.id);\n\n const xmlX = xmlComment.getAttribute('x');\n const xmlY = xmlComment.getAttribute('y');\n const commentX = xmlX ? parseInt(xmlX, 10) : NaN;\n const commentY = xmlY ? parseInt(xmlY, 10) : NaN;\n if (!isNaN(commentX) && !isNaN(commentY)) {\n comment.moveBy(commentX, commentY);\n }\n\n WorkspaceComment.fireCreateEvent(comment);\n return comment;\n }\n\n /**\n * Decode an XML comment tag and return the results in an object.\n *\n * @param xml XML comment element.\n * @returns An object containing the id, size, position, and comment string.\n * @internal\n */\n static parseAttributes(xml: Element): {\n id: string,\n w: number,\n h: number,\n x: number,\n y: number,\n content: string\n } {\n const xmlH = xml.getAttribute('h');\n const xmlW = xml.getAttribute('w');\n const xmlX = xml.getAttribute('x');\n const xmlY = xml.getAttribute('y');\n const xmlId = xml.getAttribute('id');\n\n if (!xmlId) {\n throw new Error('No ID present in XML comment definition.');\n }\n\n return {\n id: xmlId,\n // The height of the comment in workspace units, or 100 if not specified.\n h: xmlH ? parseInt(xmlH) : 100,\n // The width of the comment in workspace units, or 100 if not specified.\n w: xmlW ? parseInt(xmlW) : 100,\n // The x position of the comment in workspace coordinates, or NaN if not\n // specified in the XML.\n x: xmlX ? parseInt(xmlX) : NaN,\n // The y position of the comment in workspace coordinates, or NaN if not\n // specified in the XML.\n y: xmlY ? parseInt(xmlY) : NaN,\n content: xml.textContent ?? '',\n };\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Base class for events fired as a result of UI actions in\n * Blockly's editor.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.UiBase');\n\nimport {Abstract as AbstractEvent} from './events_abstract.js';\n\n\n/**\n * Base class for a UI event.\n * UI events are events that don't need to be sent over the wire for multi-user\n * editing to work (e.g. scrolling the workspace, zooming, opening toolbox\n * categories).\n * UI events do not undo or redo.\n *\n * @alias Blockly.Events.UiBase\n */\nexport class UiBase extends AbstractEvent {\n override isBlank = true;\n override workspaceId: string;\n\n // UI events do not undo or redo.\n override recordUndo = false;\n\n /** Whether or not the event is a UI event. */\n override isUiEvent = true;\n\n /**\n * @param opt_workspaceId The workspace identifier for this event.\n * Undefined for a blank event.\n */\n constructor(opt_workspaceId?: string) {\n super();\n\n /** Whether or not the event is blank (to be populated by fromJson). */\n this.isBlank = typeof opt_workspaceId === 'undefined';\n\n /** The workspace identifier for this event. */\n this.workspaceId = opt_workspaceId ? opt_workspaceId : '';\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of element select action.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.Selected');\n\nimport * as registry from '../registry.js';\nimport {AbstractEventJson} from './events_abstract.js';\n\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a selected event.\n *\n * @alias Blockly.Events.Selected\n */\nexport class Selected extends UiBase {\n oldElementId?: string;\n newElementId?: string;\n override type = eventUtils.SELECTED;\n\n /**\n * @param opt_oldElementId The ID of the previously selected element. Null if\n * no element last selected. Undefined for a blank event.\n * @param opt_newElementId The ID of the selected element. Null if no element\n * currently selected (deselect). Undefined for a blank event.\n * @param opt_workspaceId The workspace identifier for this event.\n * Null if no element previously selected. Undefined for a blank event.\n */\n constructor(\n opt_oldElementId?: string|null, opt_newElementId?: string|null,\n opt_workspaceId?: string) {\n super(opt_workspaceId);\n\n /** The id of the last selected element. */\n this.oldElementId = opt_oldElementId ?? undefined;\n\n /** The id of the selected element. */\n this.newElementId = opt_newElementId ?? undefined;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): SelectedJson {\n const json = super.toJson() as SelectedJson;\n json['oldElementId'] = this.oldElementId;\n json['newElementId'] = this.newElementId;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: SelectedJson) {\n super.fromJson(json);\n this.oldElementId = json['oldElementId'];\n this.newElementId = json['newElementId'];\n }\n}\n\nexport interface SelectedJson extends AbstractEventJson {\n oldElementId?: string;\n newElementId?: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.SELECTED, Selected);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Defines the Svg class. Its constants enumerate\n * all SVG tag names used by Blockly.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.Svg');\n\n\n/**\n * A name with the type of the SVG element stored in the generic.\n *\n * @alias Blockly.utils.Svg\n */\nexport class Svg<_T> {\n /** @internal */\n static ANIMATE = new Svg<SVGAnimateElement>('animate');\n /** @internal */\n static CIRCLE = new Svg<SVGCircleElement>('circle');\n /** @internal */\n static CLIPPATH = new Svg<SVGClipPathElement>('clipPath');\n /** @internal */\n static DEFS = new Svg<SVGDefsElement>('defs');\n /** @internal */\n static FECOMPOSITE = new Svg<SVGFECompositeElement>('feComposite');\n /** @internal */\n static FECOMPONENTTRANSFER =\n new Svg<SVGFEComponentTransferElement>('feComponentTransfer');\n /** @internal */\n static FEFLOOD = new Svg<SVGFEFloodElement>('feFlood');\n /** @internal */\n static FEFUNCA = new Svg<SVGFEFuncAElement>('feFuncA');\n /** @internal */\n static FEGAUSSIANBLUR = new Svg<SVGFEGaussianBlurElement>('feGaussianBlur');\n /** @internal */\n static FEPOINTLIGHT = new Svg<SVGFEPointLightElement>('fePointLight');\n /** @internal */\n static FESPECULARLIGHTING =\n new Svg<SVGFESpecularLightingElement>('feSpecularLighting');\n /** @internal */\n static FILTER = new Svg<SVGFilterElement>('filter');\n /** @internal */\n static FOREIGNOBJECT = new Svg<SVGForeignObjectElement>('foreignObject');\n /** @internal */\n static G = new Svg<SVGGElement>('g');\n /** @internal */\n static IMAGE = new Svg<SVGImageElement>('image');\n /** @internal */\n static LINE = new Svg<SVGLineElement>('line');\n /** @internal */\n static PATH = new Svg<SVGPathElement>('path');\n /** @internal */\n static PATTERN = new Svg<SVGPatternElement>('pattern');\n /** @internal */\n static POLYGON = new Svg<SVGPolygonElement>('polygon');\n /** @internal */\n static RECT = new Svg<SVGRectElement>('rect');\n /** @internal */\n static SVG = new Svg<SVGSVGElement>('svg');\n /** @internal */\n static TEXT = new Svg<SVGTextElement>('text');\n /** @internal */\n static TSPAN = new Svg<SVGTSpanElement>('tspan');\n\n /**\n * @param tagName The SVG element tag name.\n * @internal\n */\n constructor(private readonly tagName: string) {}\n\n /**\n * Returns the SVG element tag name.\n *\n * @returns The name.\n */\n toString(): string {\n return this.tagName;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a code comment on a rendered workspace.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.WorkspaceCommentSvg');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_selected.js';\n\nimport type {BlockDragSurfaceSvg} from './block_drag_surface.js';\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\n// import * as ContextMenu from './contextmenu.js';\nimport * as Css from './css.js';\nimport type {CommentMove} from './events/events_comment_move.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {IBubble} from './interfaces/i_bubble.js';\nimport type {CopyData, ICopyable} from './interfaces/i_copyable.js';\nimport * as Touch from './touch.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Rect} from './utils/rect.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\nimport {WorkspaceComment} from './workspace_comment.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/** Size of the resize icon. */\nconst RESIZE_SIZE = 8;\n\n/** Radius of the border around the comment. */\nconst BORDER_RADIUS = 3;\n\n/** Offset from the foreignobject edge to the textarea edge. */\nconst TEXTAREA_OFFSET = 2;\n\n/**\n * Class for a workspace comment's SVG representation.\n *\n * @alias Blockly.WorkspaceCommentSvg\n */\nexport class WorkspaceCommentSvg extends WorkspaceComment implements\n IBoundedElement, IBubble, ICopyable {\n /**\n * The width and height to use to size a workspace comment when it is first\n * added, before it has been edited by the user.\n *\n * @internal\n */\n static DEFAULT_SIZE = 100;\n\n /** Offset from the top to make room for a top bar. */\n private static readonly TOP_OFFSET = 10;\n override workspace: WorkspaceSvg;\n\n /** Mouse up event data. */\n private onMouseUpWrapper_: browserEvents.Data|null = null;\n\n /** Mouse move event data. */\n private onMouseMoveWrapper_: browserEvents.Data|null = null;\n\n /** Whether event handlers have been initialized. */\n private eventsInit_ = false;\n private textarea_: HTMLTextAreaElement|null = null;\n\n private svgRectTarget_: SVGRectElement|null = null;\n\n private svgHandleTarget_: SVGRectElement|null = null;\n\n private foreignObject_: SVGForeignObjectElement|null = null;\n\n private resizeGroup_: SVGGElement|null = null;\n\n private deleteGroup_: SVGGElement|null = null;\n\n private deleteIconBorder_: SVGCircleElement|null = null;\n\n private focused_ = false;\n private autoLayout_ = false;\n // Create core elements for the block.\n private readonly svgGroup_: SVGElement;\n svgRect_: AnyDuringMigration;\n\n /** Whether the comment is rendered onscreen and is a part of the DOM. */\n private rendered_ = false;\n private readonly useDragSurface_: boolean;\n\n /**\n * @param workspace The block's workspace.\n * @param content The content of this workspace comment.\n * @param height Height of the comment.\n * @param width Width of the comment.\n * @param opt_id Optional ID. Use this ID if provided, otherwise create a new\n * ID.\n */\n constructor(\n workspace: WorkspaceSvg, content: string, height: number, width: number,\n opt_id?: string) {\n super(workspace, content, height, width, opt_id);\n this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': 'blocklyComment'});\n (this.svgGroup_ as AnyDuringMigration).translate_ = '';\n this.workspace = workspace;\n\n this.svgRect_ = dom.createSvgElement(Svg.RECT, {\n 'class': 'blocklyCommentRect',\n 'x': 0,\n 'y': 0,\n 'rx': BORDER_RADIUS,\n 'ry': BORDER_RADIUS,\n });\n this.svgGroup_.appendChild(this.svgRect_);\n\n /**\n * Whether to move the comment to the drag surface when it is dragged.\n * True if it should move, false if it should be translated directly.\n */\n this.useDragSurface_ = !!workspace.getBlockDragSurface();\n\n this.render();\n }\n\n /**\n * Dispose of this comment.\n *\n * @internal\n */\n override dispose() {\n if (this.disposed_) {\n return;\n }\n // If this comment is being dragged, unlink the mouse events.\n if (common.getSelected() === this) {\n this.unselect();\n this.workspace.cancelCurrentGesture();\n }\n\n if (eventUtils.isEnabled()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.COMMENT_DELETE))(this));\n }\n\n dom.removeNode(this.svgGroup_);\n // Dispose of any rendered components\n this.disposeInternal_();\n\n eventUtils.disable();\n super.dispose();\n eventUtils.enable();\n }\n\n /**\n * Create and initialize the SVG representation of a workspace comment.\n * May be called more than once.\n *\n * @param opt_noSelect Text inside text area will be selected if false\n * @internal\n */\n initSvg(opt_noSelect?: boolean) {\n if (!this.workspace.rendered) {\n throw TypeError('Workspace is headless.');\n }\n if (!this.workspace.options.readOnly && !this.eventsInit_) {\n browserEvents.conditionalBind(\n this.svgRectTarget_ as SVGRectElement, 'mousedown', this,\n this.pathMouseDown_);\n browserEvents.conditionalBind(\n this.svgHandleTarget_ as SVGRectElement, 'mousedown', this,\n this.pathMouseDown_);\n }\n this.eventsInit_ = true;\n\n this.updateMovable();\n if (!this.getSvgRoot().parentNode) {\n this.workspace.getBubbleCanvas().appendChild(this.getSvgRoot());\n }\n\n if (!opt_noSelect && this.textarea_) {\n this.textarea_.select();\n }\n }\n\n /**\n * Handle a mouse-down on an SVG comment.\n *\n * @param e Mouse down event or touch start event.\n */\n private pathMouseDown_(e: Event) {\n const gesture = this.workspace.getGesture(e);\n if (gesture) {\n gesture.handleBubbleStart(e, this);\n }\n }\n\n /**\n * Show the context menu for this workspace comment.\n *\n * @param e Mouse event.\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n showContextMenu(e: Event) {\n throw new Error(\n 'The implementation of showContextMenu should be ' +\n 'monkey-patched in by blockly.ts');\n }\n\n /**\n * Select this comment. Highlight it visually.\n *\n * @internal\n */\n select() {\n if (common.getSelected() === this) {\n return;\n }\n let oldId = null;\n if (common.getSelected()) {\n oldId = common.getSelected()!.id;\n // Unselect any previously selected block.\n eventUtils.disable();\n try {\n common.getSelected()!.unselect();\n } finally {\n eventUtils.enable();\n }\n }\n const event = new (eventUtils.get(eventUtils.SELECTED))(\n oldId, this.id, this.workspace.id);\n eventUtils.fire(event);\n common.setSelected(this);\n this.addSelect();\n }\n\n /**\n * Unselect this comment. Remove its highlighting.\n *\n * @internal\n */\n unselect() {\n if (common.getSelected() !== this) {\n return;\n }\n const event = new (eventUtils.get(eventUtils.SELECTED))(\n this.id, null, this.workspace.id);\n eventUtils.fire(event);\n common.setSelected(null);\n this.removeSelect();\n this.blurFocus();\n }\n\n /**\n * Select this comment. Highlight it visually.\n *\n * @internal\n */\n addSelect() {\n dom.addClass(this.svgGroup_, 'blocklySelected');\n this.setFocus();\n }\n\n /**\n * Unselect this comment. Remove its highlighting.\n *\n * @internal\n */\n removeSelect() {\n dom.addClass(this.svgGroup_, 'blocklySelected');\n this.blurFocus();\n }\n\n /**\n * Focus this comment. Highlight it visually.\n *\n * @internal\n */\n addFocus() {\n dom.addClass(this.svgGroup_, 'blocklyFocused');\n }\n\n /**\n * Unfocus this comment. Remove its highlighting.\n *\n * @internal\n */\n removeFocus() {\n dom.removeClass(this.svgGroup_, 'blocklyFocused');\n }\n\n /**\n * Return the coordinates of the top-left corner of this comment relative to\n * the drawing surface's origin (0,0), in workspace units.\n * If the comment is on the workspace, (0, 0) is the origin of the workspace\n * coordinate system.\n * This does not change with workspace scale.\n *\n * @returns Object with .x and .y properties in workspace coordinates.\n * @internal\n */\n getRelativeToSurfaceXY(): Coordinate {\n let x = 0;\n let y = 0;\n\n const dragSurfaceGroup = this.useDragSurface_ ?\n this.workspace.getBlockDragSurface()!.getGroup() :\n null;\n\n let element = this.getSvgRoot();\n if (element) {\n do {\n // Loop through this comment and every parent.\n const xy = svgMath.getRelativeXY(element as Element);\n x += xy.x;\n y += xy.y;\n // If this element is the current element on the drag surface, include\n // the translation of the drag surface itself.\n if (this.useDragSurface_ &&\n this.workspace.getBlockDragSurface()!.getCurrentBlock() ===\n element) {\n const surfaceTranslation =\n this.workspace.getBlockDragSurface()!.getSurfaceTranslation();\n x += surfaceTranslation.x;\n y += surfaceTranslation.y;\n }\n // AnyDuringMigration because: Type 'ParentNode | null' is not\n // assignable to type 'SVGElement'.\n element = element.parentNode as AnyDuringMigration;\n } while (element && element !== this.workspace.getBubbleCanvas() &&\n element !== dragSurfaceGroup);\n }\n this.xy_ = new Coordinate(x, y);\n return this.xy_;\n }\n\n /**\n * Move a comment by a relative offset.\n *\n * @param dx Horizontal offset, in workspace units.\n * @param dy Vertical offset, in workspace units.\n * @internal\n */\n override moveBy(dx: number, dy: number) {\n const event =\n new (eventUtils.get(eventUtils.COMMENT_MOVE))(this) as CommentMove;\n // TODO: Do I need to look up the relative to surface XY position here?\n const xy = this.getRelativeToSurfaceXY();\n this.translate(xy.x + dx, xy.y + dy);\n this.xy_ = new Coordinate(xy.x + dx, xy.y + dy);\n event.recordNew();\n eventUtils.fire(event);\n this.workspace.resizeContents();\n }\n\n /**\n * Transforms a comment by setting the translation on the transform attribute\n * of the block's SVG.\n *\n * @param x The x coordinate of the translation in workspace units.\n * @param y The y coordinate of the translation in workspace units.\n * @internal\n */\n translate(x: number, y: number) {\n this.xy_ = new Coordinate(x, y);\n this.getSvgRoot().setAttribute(\n 'transform', 'translate(' + x + ',' + y + ')');\n }\n\n /**\n * Move this comment to its workspace's drag surface, accounting for\n * positioning. Generally should be called at the same time as\n * setDragging(true). Does nothing if useDragSurface_ is false.\n *\n * @internal\n */\n moveToDragSurface() {\n if (!this.useDragSurface_) {\n return;\n }\n // The translation for drag surface blocks,\n // is equal to the current relative-to-surface position,\n // to keep the position in sync as it move on/off the surface.\n // This is in workspace coordinates.\n const xy = this.getRelativeToSurfaceXY();\n this.clearTransformAttributes_();\n this.workspace.getBlockDragSurface()!.translateSurface(xy.x, xy.y);\n // Execute the move on the top-level SVG component\n this.workspace.getBlockDragSurface()!.setBlocksAndShow(this.getSvgRoot());\n }\n\n /**\n * Move this comment during a drag, taking into account whether we are using a\n * drag surface to translate blocks.\n *\n * @param dragSurface The surface that carries rendered items during a drag,\n * or null if no drag surface is in use.\n * @param newLoc The location to translate to, in workspace coordinates.\n * @internal\n */\n moveDuringDrag(dragSurface: BlockDragSurfaceSvg, newLoc: Coordinate) {\n if (dragSurface) {\n dragSurface.translateSurface(newLoc.x, newLoc.y);\n } else {\n (this.svgGroup_ as AnyDuringMigration).translate_ =\n 'translate(' + newLoc.x + ',' + newLoc.y + ')';\n (this.svgGroup_ as AnyDuringMigration)\n .setAttribute(\n 'transform',\n (this.svgGroup_ as AnyDuringMigration).translate_ +\n (this.svgGroup_ as AnyDuringMigration).skew_);\n }\n }\n\n /**\n * Move the bubble group to the specified location in workspace coordinates.\n *\n * @param x The x position to move to.\n * @param y The y position to move to.\n * @internal\n */\n moveTo(x: number, y: number) {\n this.translate(x, y);\n }\n\n /**\n * Clear the comment of transform=\"...\" attributes.\n * Used when the comment is switching from 3d to 2d transform or vice versa.\n */\n private clearTransformAttributes_() {\n this.getSvgRoot().removeAttribute('transform');\n }\n\n /**\n * Returns the coordinates of a bounding box describing the dimensions of this\n * comment.\n * Coordinate system: workspace coordinates.\n *\n * @returns Object with coordinates of the bounding box.\n * @internal\n */\n getBoundingRectangle(): Rect {\n const blockXY = this.getRelativeToSurfaceXY();\n const commentBounds = this.getHeightWidth();\n const top = blockXY.y;\n const bottom = blockXY.y + commentBounds.height;\n let left;\n let right;\n if (this.RTL) {\n left = blockXY.x - commentBounds.width;\n // Add the width of the tab/puzzle piece knob to the x coordinate\n // since X is the corner of the rectangle, not the whole puzzle piece.\n right = blockXY.x;\n } else {\n // Subtract the width of the tab/puzzle piece knob to the x coordinate\n // since X is the corner of the rectangle, not the whole puzzle piece.\n left = blockXY.x;\n right = blockXY.x + commentBounds.width;\n }\n return new Rect(top, bottom, left, right);\n }\n\n /**\n * Add or remove the UI indicating if this comment is movable or not.\n *\n * @internal\n */\n updateMovable() {\n if (this.isMovable()) {\n dom.addClass(this.svgGroup_, 'blocklyDraggable');\n } else {\n dom.removeClass(this.svgGroup_, 'blocklyDraggable');\n }\n }\n\n /**\n * Set whether this comment is movable or not.\n *\n * @param movable True if movable.\n * @internal\n */\n override setMovable(movable: boolean) {\n super.setMovable(movable);\n this.updateMovable();\n }\n\n /**\n * Set whether this comment is editable or not.\n *\n * @param editable True if editable.\n */\n override setEditable(editable: boolean) {\n super.setEditable(editable);\n if (this.textarea_) {\n this.textarea_.readOnly = !editable;\n }\n }\n\n /**\n * Recursively adds or removes the dragging class to this node and its\n * children.\n *\n * @param adding True if adding, false if removing.\n * @internal\n */\n setDragging(adding: boolean) {\n if (adding) {\n const group = this.getSvgRoot();\n (group as AnyDuringMigration).translate_ = '';\n (group as AnyDuringMigration).skew_ = '';\n dom.addClass(this.svgGroup_, 'blocklyDragging');\n } else {\n dom.removeClass(this.svgGroup_, 'blocklyDragging');\n }\n }\n\n /**\n * Return the root node of the SVG or null if none exists.\n *\n * @returns The root SVG node (probably a group).\n * @internal\n */\n getSvgRoot(): SVGElement {\n return this.svgGroup_;\n }\n\n /**\n * Returns this comment's text.\n *\n * @returns Comment text.\n * @internal\n */\n override getContent(): string {\n return this.textarea_ ? this.textarea_.value : this.content_;\n }\n\n /**\n * Set this comment's content.\n *\n * @param content Comment content.\n * @internal\n */\n override setContent(content: string) {\n super.setContent(content);\n if (this.textarea_) {\n this.textarea_.value = content;\n }\n }\n\n /**\n * Update the cursor over this comment by adding or removing a class.\n *\n * @param enable True if the delete cursor should be shown, false otherwise.\n * @internal\n */\n setDeleteStyle(enable: boolean) {\n if (enable) {\n dom.addClass(this.svgGroup_, 'blocklyDraggingDelete');\n } else {\n dom.removeClass(this.svgGroup_, 'blocklyDraggingDelete');\n }\n }\n\n /**\n * Set whether auto-layout of this bubble is enabled. The first time a bubble\n * is shown it positions itself to not cover any blocks. Once a user has\n * dragged it to reposition, it renders where the user put it.\n *\n * @param _enable True if auto-layout should be enabled, false otherwise.\n * @internal\n */\n setAutoLayout(_enable: boolean) {}\n // NOP for compatibility with the bubble dragger.\n\n /**\n * Encode a comment subtree as XML with XY coordinates.\n *\n * @param opt_noId True if the encoder should skip the comment ID.\n * @returns Tree of XML elements.\n * @internal\n */\n override toXmlWithXY(opt_noId?: boolean): Element {\n let width = 0; // Not used in LTR.\n if (this.workspace.RTL) {\n // Here be performance dragons: This calls getMetrics().\n width = this.workspace.getWidth();\n }\n const element = this.toXml(opt_noId);\n const xy = this.getRelativeToSurfaceXY();\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n element.setAttribute(\n 'x',\n Math.round(this.workspace.RTL ? width - xy.x : xy.x) as\n AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n element.setAttribute('y', Math.round(xy.y) as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n element.setAttribute('h', this.getHeight() as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n element.setAttribute('w', this.getWidth() as AnyDuringMigration);\n return element;\n }\n\n /**\n * Encode a comment for copying.\n *\n * @returns Copy metadata.\n * @internal\n */\n toCopyData(): CopyData {\n return {\n saveInfo: this.toXmlWithXY(),\n source: this.workspace,\n typeCounts: null,\n };\n }\n\n /**\n * Returns a bounding box describing the dimensions of this comment.\n *\n * @returns Object with height and width properties in workspace units.\n * @internal\n */\n getHeightWidth(): {height: number, width: number} {\n return {width: this.getWidth(), height: this.getHeight()};\n }\n\n /**\n * Renders the workspace comment.\n *\n * @internal\n */\n render() {\n if (this.rendered_) {\n return;\n }\n\n const size = this.getHeightWidth();\n\n // Add text area\n this.createEditor_();\n // AnyDuringMigration because: Argument of type 'SVGForeignObjectElement |\n // null' is not assignable to parameter of type 'Node'.\n this.svgGroup_.appendChild(this.foreignObject_ as AnyDuringMigration);\n\n this.svgHandleTarget_ = dom.createSvgElement(\n Svg.RECT, {'class': 'blocklyCommentHandleTarget', 'x': 0, 'y': 0});\n // AnyDuringMigration because: Argument of type 'SVGRectElement | null' is\n // not assignable to parameter of type 'Node'.\n this.svgGroup_.appendChild(this.svgHandleTarget_ as AnyDuringMigration);\n this.svgRectTarget_ = dom.createSvgElement(Svg.RECT, {\n 'class': 'blocklyCommentTarget',\n 'x': 0,\n 'y': 0,\n 'rx': BORDER_RADIUS,\n 'ry': BORDER_RADIUS,\n });\n // AnyDuringMigration because: Argument of type 'SVGRectElement | null' is\n // not assignable to parameter of type 'Node'.\n this.svgGroup_.appendChild(this.svgRectTarget_ as AnyDuringMigration);\n\n // Add the resize icon\n this.addResizeDom_();\n if (this.isDeletable()) {\n // Add the delete icon\n this.addDeleteDom_();\n }\n\n this.setSize_(size.width, size.height);\n\n // Set the content\n this.textarea_!.value = this.content_;\n\n this.rendered_ = true;\n\n if (this.resizeGroup_) {\n browserEvents.conditionalBind(\n (this.resizeGroup_), 'mousedown', this, this.resizeMouseDown_);\n }\n\n if (this.isDeletable()) {\n browserEvents.conditionalBind(\n this.deleteGroup_ as SVGGElement, 'mousedown', this,\n this.deleteMouseDown_);\n browserEvents.conditionalBind(\n this.deleteGroup_ as SVGGElement, 'mouseout', this,\n this.deleteMouseOut_);\n browserEvents.conditionalBind(\n this.deleteGroup_ as SVGGElement, 'mouseup', this,\n this.deleteMouseUp_);\n }\n }\n\n /**\n * Create the text area for the comment.\n *\n * @returns The top-level node of the editor.\n */\n private createEditor_(): Element {\n /* Create the editor. Here's the markup that will be generated:\n <foreignObject class=\"blocklyCommentForeignObject\" x=\"0\" y=\"10\"\n width=\"164\" height=\"164\"> <body xmlns=\"http://www.w3.org/1999/xhtml\"\n class=\"blocklyMinimalBody\"> <textarea\n xmlns=\"http://www.w3.org/1999/xhtml\" class=\"blocklyCommentTextarea\"\n style=\"height: 164px; width: 164px;\"></textarea>\n </body>\n </foreignObject>\n */\n this.foreignObject_ = dom.createSvgElement(Svg.FOREIGNOBJECT, {\n 'x': 0,\n 'y': WorkspaceCommentSvg.TOP_OFFSET,\n 'class': 'blocklyCommentForeignObject',\n });\n const body = document.createElementNS(dom.HTML_NS, 'body');\n body.setAttribute('xmlns', dom.HTML_NS);\n body.className = 'blocklyMinimalBody';\n const textarea = document.createElementNS(dom.HTML_NS, 'textarea') as\n HTMLTextAreaElement;\n textarea.className = 'blocklyCommentTextarea';\n textarea.setAttribute('dir', this.RTL ? 'RTL' : 'LTR');\n textarea.readOnly = !this.isEditable();\n body.appendChild(textarea);\n this.textarea_ = textarea;\n this.foreignObject_!.appendChild(body);\n // Don't zoom with mousewheel.\n browserEvents.conditionalBind(\n textarea, 'wheel', this, function(e: AnyDuringMigration) {\n e.stopPropagation();\n });\n browserEvents.conditionalBind(\n textarea, 'change', this,\n function(this: WorkspaceCommentSvg, _e: Event) {\n this.setContent(textarea.value);\n });\n // AnyDuringMigration because: Type 'SVGForeignObjectElement | null' is not\n // assignable to type 'Element'.\n return this.foreignObject_ as AnyDuringMigration;\n }\n\n /** Add the resize icon to the DOM */\n private addResizeDom_() {\n this.resizeGroup_ = dom.createSvgElement(\n Svg.G, {'class': this.RTL ? 'blocklyResizeSW' : 'blocklyResizeSE'},\n this.svgGroup_);\n // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not\n // assignable to parameter of type 'Element | undefined'.\n dom.createSvgElement(\n Svg.POLYGON,\n {'points': '0,x x,x x,0'.replace(/x/g, RESIZE_SIZE.toString())},\n this.resizeGroup_ as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not\n // assignable to parameter of type 'Element | undefined'.\n dom.createSvgElement(\n Svg.LINE, {\n 'class': 'blocklyResizeLine',\n 'x1': RESIZE_SIZE / 3,\n 'y1': RESIZE_SIZE - 1,\n 'x2': RESIZE_SIZE - 1,\n 'y2': RESIZE_SIZE / 3,\n },\n this.resizeGroup_ as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not\n // assignable to parameter of type 'Element | undefined'.\n dom.createSvgElement(\n Svg.LINE, {\n 'class': 'blocklyResizeLine',\n 'x1': RESIZE_SIZE * 2 / 3,\n 'y1': RESIZE_SIZE - 1,\n 'x2': RESIZE_SIZE - 1,\n 'y2': RESIZE_SIZE * 2 / 3,\n },\n this.resizeGroup_ as AnyDuringMigration);\n }\n\n /** Add the delete icon to the DOM */\n private addDeleteDom_() {\n this.deleteGroup_ = dom.createSvgElement(\n Svg.G, {'class': 'blocklyCommentDeleteIcon'}, this.svgGroup_);\n // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not\n // assignable to parameter of type 'Element | undefined'.\n this.deleteIconBorder_ = dom.createSvgElement(\n Svg.CIRCLE,\n {'class': 'blocklyDeleteIconShape', 'r': '7', 'cx': '7.5', 'cy': '7.5'},\n this.deleteGroup_ as AnyDuringMigration);\n // x icon.\n // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not\n // assignable to parameter of type 'Element | undefined'.\n dom.createSvgElement(\n Svg.LINE, {\n 'x1': '5',\n 'y1': '10',\n 'x2': '10',\n 'y2': '5',\n 'stroke': '#fff',\n 'stroke-width': '2',\n },\n this.deleteGroup_ as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not\n // assignable to parameter of type 'Element | undefined'.\n dom.createSvgElement(\n Svg.LINE, {\n 'x1': '5',\n 'y1': '5',\n 'x2': '10',\n 'y2': '10',\n 'stroke': '#fff',\n 'stroke-width': '2',\n },\n this.deleteGroup_ as AnyDuringMigration);\n }\n\n /**\n * Handle a mouse-down on comment's resize corner.\n *\n * @param e Mouse down event.\n */\n private resizeMouseDown_(e: MouseEvent) {\n this.unbindDragEvents_();\n if (browserEvents.isRightButton(e)) {\n // No right-click.\n e.stopPropagation();\n return;\n }\n // Left-click (or middle click)\n this.workspace.startDrag(\n e,\n new Coordinate(\n this.workspace.RTL ? -this.width_ : this.width_, this.height_));\n\n this.onMouseUpWrapper_ = browserEvents.conditionalBind(\n document, 'mouseup', this, this.resizeMouseUp_);\n this.onMouseMoveWrapper_ = browserEvents.conditionalBind(\n document, 'mousemove', this, this.resizeMouseMove_);\n this.workspace.hideChaff();\n // This event has been handled. No need to bubble up to the document.\n e.stopPropagation();\n }\n\n /**\n * Handle a mouse-down on comment's delete icon.\n *\n * @param e Mouse down event.\n */\n private deleteMouseDown_(e: Event) {\n // Highlight the delete icon.\n if (this.deleteIconBorder_) {\n dom.addClass(this.deleteIconBorder_, 'blocklyDeleteIconHighlighted');\n }\n // This event has been handled. No need to bubble up to the document.\n e.stopPropagation();\n }\n\n /**\n * Handle a mouse-out on comment's delete icon.\n *\n * @param _e Mouse out event.\n */\n private deleteMouseOut_(_e: Event) {\n // Restore highlight on the delete icon.\n if (this.deleteIconBorder_) {\n dom.removeClass(this.deleteIconBorder_, 'blocklyDeleteIconHighlighted');\n }\n }\n\n /**\n * Handle a mouse-up on comment's delete icon.\n *\n * @param e Mouse up event.\n */\n private deleteMouseUp_(e: Event) {\n // Delete this comment.\n this.dispose();\n // This event has been handled. No need to bubble up to the document.\n e.stopPropagation();\n }\n\n /** Stop binding to the global mouseup and mousemove events. */\n private unbindDragEvents_() {\n if (this.onMouseUpWrapper_) {\n browserEvents.unbind(this.onMouseUpWrapper_);\n this.onMouseUpWrapper_ = null;\n }\n if (this.onMouseMoveWrapper_) {\n browserEvents.unbind(this.onMouseMoveWrapper_);\n this.onMouseMoveWrapper_ = null;\n }\n }\n\n /**\n * Handle a mouse-up event while dragging a comment's border or resize handle.\n *\n * @param _e Mouse up event.\n */\n private resizeMouseUp_(_e: Event) {\n Touch.clearTouchIdentifier();\n this.unbindDragEvents_();\n }\n\n /**\n * Resize this comment to follow the mouse.\n *\n * @param e Mouse move event.\n */\n private resizeMouseMove_(e: MouseEvent) {\n this.autoLayout_ = false;\n const newXY = this.workspace.moveDrag(e);\n this.setSize_(this.RTL ? -newXY.x : newXY.x, newXY.y);\n }\n\n /**\n * Callback function triggered when the comment has resized.\n * Resize the text area accordingly.\n */\n private resizeComment_() {\n const size = this.getHeightWidth();\n const topOffset = WorkspaceCommentSvg.TOP_OFFSET;\n const textOffset = TEXTAREA_OFFSET * 2;\n\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.foreignObject_!.setAttribute(\n 'width', size.width as AnyDuringMigration);\n this.foreignObject_!.setAttribute(\n 'height', (size.height - topOffset).toString());\n if (this.RTL) {\n this.foreignObject_!.setAttribute('x', (-size.width).toString());\n }\n this.textarea_!.style.width = size.width - textOffset + 'px';\n this.textarea_!.style.height = size.height - textOffset - topOffset + 'px';\n }\n\n /**\n * Set size\n *\n * @param width width of the container\n * @param height height of the container\n */\n private setSize_(width: number, height: number) {\n // Minimum size of a comment.\n width = Math.max(width, 45);\n height = Math.max(height, 20 + WorkspaceCommentSvg.TOP_OFFSET);\n this.width_ = width;\n this.height_ = height;\n this.svgRect_.setAttribute('width', width);\n this.svgRect_.setAttribute('height', height);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.svgRectTarget_!.setAttribute('width', width as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.svgRectTarget_!.setAttribute('height', height as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.svgHandleTarget_!.setAttribute('width', width as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.svgHandleTarget_!.setAttribute(\n 'height', WorkspaceCommentSvg.TOP_OFFSET as AnyDuringMigration);\n if (this.RTL) {\n this.svgRect_.setAttribute('transform', 'scale(-1 1)');\n this.svgRectTarget_!.setAttribute('transform', 'scale(-1 1)');\n }\n\n if (this.resizeGroup_) {\n if (this.RTL) {\n // Mirror the resize group.\n this.resizeGroup_.setAttribute(\n 'transform',\n 'translate(' + (-width + RESIZE_SIZE) + ',' +\n (height - RESIZE_SIZE) + ') scale(-1 1)');\n this.deleteGroup_!.setAttribute(\n 'transform',\n 'translate(' + (-width + RESIZE_SIZE) + ',' + -RESIZE_SIZE +\n ') scale(-1 1)');\n } else {\n this.resizeGroup_.setAttribute(\n 'transform',\n 'translate(' + (width - RESIZE_SIZE) + ',' +\n (height - RESIZE_SIZE) + ')');\n this.deleteGroup_!.setAttribute(\n 'transform',\n 'translate(' + (width - RESIZE_SIZE) + ',' + -RESIZE_SIZE + ')');\n }\n }\n\n // Allow the contents to resize.\n this.resizeComment_();\n }\n\n /** Dispose of any rendered comment components. */\n private disposeInternal_() {\n this.textarea_ = null;\n this.foreignObject_ = null;\n this.svgRectTarget_ = null;\n this.svgHandleTarget_ = null;\n this.disposed_ = true;\n }\n\n /**\n * Set the focus on the text area.\n *\n * @internal\n */\n setFocus() {\n this.focused_ = true;\n // Defer CSS changes.\n setTimeout(() => {\n if (this.disposed_) {\n return;\n }\n this.textarea_!.focus();\n this.addFocus();\n if (this.svgRectTarget_) {\n dom.addClass(this.svgRectTarget_, 'blocklyCommentTargetFocused');\n }\n if (this.svgHandleTarget_) {\n dom.addClass(\n this.svgHandleTarget_, 'blocklyCommentHandleTargetFocused');\n }\n }, 0);\n }\n\n /**\n * Remove focus from the text area.\n *\n * @internal\n */\n blurFocus() {\n this.focused_ = false;\n // Defer CSS changes.\n setTimeout(() => {\n if (this.disposed_) {\n return;\n }\n\n this.textarea_!.blur();\n this.removeFocus();\n if (this.svgRectTarget_) {\n dom.removeClass(this.svgRectTarget_, 'blocklyCommentTargetFocused');\n }\n if (this.svgHandleTarget_) {\n dom.removeClass(\n this.svgHandleTarget_, 'blocklyCommentHandleTargetFocused');\n }\n }, 0);\n }\n\n /**\n * Decode an XML comment tag and create a rendered comment on the workspace.\n *\n * @param xmlComment XML comment element.\n * @param workspace The workspace.\n * @param opt_wsWidth The width of the workspace, which is used to position\n * comments correctly in RTL.\n * @returns The created workspace comment.\n * @internal\n */\n static fromXmlRendered(\n xmlComment: Element, workspace: WorkspaceSvg,\n opt_wsWidth?: number): WorkspaceCommentSvg {\n eventUtils.disable();\n let comment;\n try {\n const info = WorkspaceComment.parseAttributes(xmlComment);\n\n comment = new WorkspaceCommentSvg(\n workspace, info.content, info.h, info.w, info.id);\n if (workspace.rendered) {\n comment.initSvg(true);\n comment.render();\n }\n // Position the comment correctly, taking into account the width of a\n // rendered RTL workspace.\n if (!isNaN(info.x) && !isNaN(info.y)) {\n if (workspace.RTL) {\n const wsWidth = opt_wsWidth || workspace.getWidth();\n comment.moveBy(wsWidth - info.x, info.y);\n } else {\n comment.moveBy(info.x, info.y);\n }\n }\n } finally {\n eventUtils.enable();\n }\n\n WorkspaceComment.fireCreateEvent((comment));\n return comment;\n }\n}\n\n/** CSS for workspace comment. See css.js for use. */\nCss.register(`\n.blocklyCommentForeignObject {\n position: relative;\n z-index: 0;\n}\n\n.blocklyCommentRect {\n fill: #E7DE8E;\n stroke: #bcA903;\n stroke-width: 1px;\n}\n\n.blocklyCommentTarget {\n fill: transparent;\n stroke: #bcA903;\n}\n\n.blocklyCommentTargetFocused {\n fill: none;\n}\n\n.blocklyCommentHandleTarget {\n fill: none;\n}\n\n.blocklyCommentHandleTargetFocused {\n fill: transparent;\n}\n\n.blocklyFocused>.blocklyCommentRect {\n fill: #B9B272;\n stroke: #B9B272;\n}\n\n.blocklySelected>.blocklyCommentTarget {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCommentDeleteIcon {\n cursor: pointer;\n fill: #000;\n display: none;\n}\n\n.blocklySelected > .blocklyCommentDeleteIcon {\n display: block;\n}\n\n.blocklyDeleteIconShape {\n fill: #000;\n stroke: #000;\n stroke-width: 1px;\n}\n\n.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {\n stroke: #fc3;\n}\n`);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Base class for all types of block events.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.BlockBase');\n\nimport type {Block} from '../block.js';\n\nimport {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js';\n\n\n/**\n * Abstract class for a block event.\n *\n * @alias Blockly.Events.BlockBase\n */\nexport class BlockBase extends AbstractEvent {\n override isBlank = true;\n blockId?: string;\n\n /**\n * @param opt_block The block this event corresponds to.\n * Undefined for a blank event.\n */\n constructor(opt_block?: Block) {\n super();\n this.isBlank = !!opt_block;\n\n if (!opt_block) return;\n\n /** The block ID for the block this event pertains to */\n this.blockId = opt_block.id;\n\n /** The workspace identifier for this event. */\n this.workspaceId = opt_block.workspace.id;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): AbstractEventJson {\n const json = super.toJson() as BlockBaseJson;\n if (!this.blockId) {\n throw new Error(\n 'The block ID is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n json['blockId'] = this.blockId;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: BlockBaseJson) {\n super.fromJson(json);\n this.blockId = json['blockId'];\n }\n}\n\nexport interface BlockBaseJson extends AbstractEventJson {\n blockId: string;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a block change event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.BlockChange');\n\nimport type {Block} from '../block.js';\nimport type {BlockSvg} from '../block_svg.js';\nimport * as registry from '../registry.js';\nimport * as Xml from '../xml.js';\n\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a block change event.\n *\n * @alias Blockly.Events.BlockChange\n */\nexport class BlockChange extends BlockBase {\n override type = eventUtils.BLOCK_CHANGE;\n element?: string;\n name?: string;\n oldValue: unknown;\n newValue: unknown;\n\n /**\n * @param opt_block The changed block. Undefined for a blank event.\n * @param opt_element One of 'field', 'comment', 'disabled', etc.\n * @param opt_name Name of input or field affected, or null.\n * @param opt_oldValue Previous value of element.\n * @param opt_newValue New value of element.\n */\n constructor(\n opt_block?: Block, opt_element?: string, opt_name?: string|null,\n opt_oldValue?: unknown, opt_newValue?: unknown) {\n super(opt_block);\n\n if (!opt_block) {\n return; // Blank event to be populated by fromJson.\n }\n this.element = opt_element;\n this.name = opt_name || undefined;\n this.oldValue = opt_oldValue;\n this.newValue = opt_newValue;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): BlockChangeJson {\n const json = super.toJson() as BlockChangeJson;\n if (!this.element) {\n throw new Error(\n 'The changed element is undefined. Either pass an ' +\n 'element to the constructor, or call fromJson');\n }\n json['element'] = this.element;\n json['name'] = this.name;\n json['oldValue'] = this.oldValue;\n json['newValue'] = this.newValue;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: BlockChangeJson) {\n super.fromJson(json);\n this.element = json['element'];\n this.name = json['name'];\n this.oldValue = json['oldValue'];\n this.newValue = json['newValue'];\n }\n\n /**\n * Does this event record any change of state?\n *\n * @returns False if something changed.\n */\n override isNull(): boolean {\n return this.oldValue === this.newValue;\n }\n\n /**\n * Run a change event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.blockId) {\n throw new Error(\n 'The block ID is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n const block = workspace.getBlockById(this.blockId);\n if (!block) {\n throw new Error(\n 'The associated block is undefined. Either pass a ' +\n 'block to the constructor, or call fromJson');\n }\n // Assume the block is rendered so that then we can check.\n const blockSvg = block as BlockSvg;\n if (blockSvg.mutator) {\n // Close the mutator (if open) since we don't want to update it.\n blockSvg.mutator.setVisible(false);\n }\n const value = forward ? this.newValue : this.oldValue;\n switch (this.element) {\n case 'field': {\n const field = block.getField(this.name!);\n if (field) {\n field.setValue(value);\n } else {\n console.warn('Can\\'t set non-existent field: ' + this.name);\n }\n break;\n }\n case 'comment':\n block.setCommentText(value as string || null);\n break;\n case 'collapsed':\n block.setCollapsed(!!value);\n break;\n case 'disabled':\n block.setEnabled(!value);\n break;\n case 'inline':\n block.setInputsInline(!!value);\n break;\n case 'mutation': {\n const oldState = BlockChange.getExtraBlockState_(block as BlockSvg);\n if (block.loadExtraState) {\n block.loadExtraState(JSON.parse(value as string || '{}'));\n } else if (block.domToMutation) {\n block.domToMutation(Xml.textToDom(value as string || '<mutation/>'));\n }\n eventUtils.fire(\n new BlockChange(block, 'mutation', null, oldState, value));\n break;\n }\n default:\n console.warn('Unknown change type: ' + this.element);\n }\n }\n\n // TODO (#5397): Encapsulate this in the BlocklyMutationChange event when\n // refactoring change events.\n /**\n * Returns the extra state of the given block (either as XML or a JSO,\n * depending on the block's definition).\n *\n * @param block The block to get the extra state of.\n * @returns A stringified version of the extra state of the given block.\n * @internal\n */\n static getExtraBlockState_(block: BlockSvg): string {\n if (block.saveExtraState) {\n const state = block.saveExtraState();\n return state ? JSON.stringify(state) : '';\n } else if (block.mutationToDom) {\n const state = block.mutationToDom();\n return state ? Xml.domToText(state) : '';\n }\n return '';\n }\n}\n\nexport interface BlockChangeJson extends BlockBaseJson {\n element: string;\n name?: string;\n newValue: unknown;\n oldValue: unknown;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.CHANGE, BlockChange);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object in charge of managing markers and the cursor.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.MarkerManager');\n\nimport type {Cursor} from './keyboard_nav/cursor.js';\nimport type {Marker} from './keyboard_nav/marker.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class to manage the multiple markers and the cursor on a workspace.\n *\n * @alias Blockly.MarkerManager\n */\nexport class MarkerManager {\n /** The name of the local marker. */\n static readonly LOCAL_MARKER = 'local_marker_1';\n\n /** The cursor. */\n private cursor_: Cursor|null = null;\n\n /** The cursor's SVG element. */\n private cursorSvg_: SVGElement|null = null;\n\n /** The map of markers for the workspace. */\n private markers = new Map<string, Marker>();\n\n /** The marker's SVG element. */\n private markerSvg_: SVGElement|null = null;\n\n /**\n * @param workspace The workspace for the marker manager.\n * @internal\n */\n constructor(private readonly workspace: WorkspaceSvg) {}\n\n /**\n * Register the marker by adding it to the map of markers.\n *\n * @param id A unique identifier for the marker.\n * @param marker The marker to register.\n */\n registerMarker(id: string, marker: Marker) {\n if (this.markers.has(id)) {\n this.unregisterMarker(id);\n }\n marker.setDrawer(\n this.workspace.getRenderer().makeMarkerDrawer(this.workspace, marker));\n this.setMarkerSvg(marker.getDrawer().createDom());\n this.markers.set(id, marker);\n }\n\n /**\n * Unregister the marker by removing it from the map of markers.\n *\n * @param id The ID of the marker to unregister.\n */\n unregisterMarker(id: string) {\n const marker = this.markers.get(id);\n if (marker) {\n marker.dispose();\n this.markers.delete(id);\n } else {\n throw Error(\n 'Marker with ID ' + id + ' does not exist. ' +\n 'Can only unregister markers that exist.');\n }\n }\n\n /**\n * Get the cursor for the workspace.\n *\n * @returns The cursor for this workspace.\n */\n getCursor(): Cursor|null {\n return this.cursor_;\n }\n\n /**\n * Get a single marker that corresponds to the given ID.\n *\n * @param id A unique identifier for the marker.\n * @returns The marker that corresponds to the given ID, or null if none\n * exists.\n */\n getMarker(id: string): Marker|null {\n return this.markers.get(id) || null;\n }\n\n /**\n * Sets the cursor and initializes the drawer for use with keyboard\n * navigation.\n *\n * @param cursor The cursor used to move around this workspace.\n */\n setCursor(cursor: Cursor) {\n if (this.cursor_ && this.cursor_.getDrawer()) {\n this.cursor_.getDrawer().dispose();\n }\n this.cursor_ = cursor;\n if (this.cursor_) {\n const drawer = this.workspace.getRenderer().makeMarkerDrawer(\n this.workspace, this.cursor_);\n this.cursor_.setDrawer(drawer);\n this.setCursorSvg(this.cursor_.getDrawer().createDom());\n }\n }\n\n /**\n * Add the cursor SVG to this workspace SVG group.\n *\n * @param cursorSvg The SVG root of the cursor to be added to the workspace\n * SVG group.\n * @internal\n */\n setCursorSvg(cursorSvg: SVGElement|null) {\n if (!cursorSvg) {\n this.cursorSvg_ = null;\n return;\n }\n\n this.workspace.getBlockCanvas()!.appendChild(cursorSvg);\n this.cursorSvg_ = cursorSvg;\n }\n\n /**\n * Add the marker SVG to this workspaces SVG group.\n *\n * @param markerSvg The SVG root of the marker to be added to the workspace\n * SVG group.\n * @internal\n */\n setMarkerSvg(markerSvg: SVGElement|null) {\n if (!markerSvg) {\n this.markerSvg_ = null;\n return;\n }\n\n if (this.workspace.getBlockCanvas()) {\n if (this.cursorSvg_) {\n this.workspace.getBlockCanvas()!.insertBefore(\n markerSvg, this.cursorSvg_);\n } else {\n this.workspace.getBlockCanvas()!.appendChild(markerSvg);\n }\n }\n }\n\n /**\n * Redraw the attached cursor SVG if needed.\n *\n * @internal\n */\n updateMarkers() {\n if (this.workspace.keyboardAccessibilityMode && this.cursorSvg_) {\n this.workspace.getCursor()!.draw();\n }\n }\n\n /**\n * Dispose of the marker manager.\n * Go through and delete all markers associated with this marker manager.\n *\n * @suppress {checkTypes}\n * @internal\n */\n dispose() {\n const markerIds = Object.keys(this.markers);\n for (let i = 0, markerId; markerId = markerIds[i]; i++) {\n this.unregisterMarker(markerId);\n }\n this.markers.clear();\n if (this.cursor_) {\n this.cursor_.dispose();\n this.cursor_ = null;\n }\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A type used to create flag values.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.Sentinel');\n\n\n/**\n * A type used to create flag values.\n *\n * @alias Blockly.utils.Sentinel\n */\nexport class Sentinel {}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Field. Used for editable titles, variables, etc.\n * This is an abstract class that defines the UI on the block. Actual\n * instances would be FieldTextInput, FieldDropdown, etc.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Field');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Input} from './input.js';\nimport type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';\nimport type {IASTNodeLocationWithBlock} from './interfaces/i_ast_node_location_with_block.js';\nimport type {IKeyboardAccessible} from './interfaces/i_keyboard_accessible.js';\nimport type {IRegistrable} from './interfaces/i_registrable.js';\nimport {MarkerManager} from './marker_manager.js';\nimport type {ConstantProvider} from './renderers/common/constants.js';\nimport type {KeyboardShortcut} from './shortcut_registry.js';\nimport * as Tooltip from './tooltip.js';\nimport type {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport * as parsing from './utils/parsing.js';\nimport {Rect} from './utils/rect.js';\nimport {Sentinel} from './utils/sentinel.js';\nimport {Size} from './utils/size.js';\nimport * as style from './utils/style.js';\nimport {Svg} from './utils/svg.js';\nimport * as userAgent from './utils/useragent.js';\nimport * as utilsXml from './utils/xml.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\n\n\n/**\n * Abstract class for an editable field.\n *\n * @alias Blockly.Field\n */\nexport abstract class Field implements IASTNodeLocationSvg,\n IASTNodeLocationWithBlock,\n IKeyboardAccessible, IRegistrable {\n /** Non-breaking space. */\n static readonly NBSP = '\\u00A0';\n\n /**\n * A value used to signal when a field's constructor should *not* set the\n * field's value or run configure_, and should allow a subclass to do that\n * instead.\n */\n static readonly SKIP_SETUP = new Sentinel();\n\n /**\n * Name of field. Unique within each block.\n * Static labels are usually unnamed.\n */\n name?: string = undefined;\n protected value_: AnyDuringMigration;\n\n /** Validation function called when user edits an editable field. */\n protected validator_: Function|null = null;\n\n /**\n * Used to cache the field's tooltip value if setTooltip is called when the\n * field is not yet initialized. Is *not* guaranteed to be accurate.\n */\n private tooltip_: Tooltip.TipInfo|null = null;\n protected size_: Size;\n\n /**\n * Holds the cursors svg element when the cursor is attached to the field.\n * This is null if there is no cursor on the field.\n */\n private cursorSvg_: SVGElement|null = null;\n\n /**\n * Holds the markers svg element when the marker is attached to the field.\n * This is null if there is no marker on the field.\n */\n private markerSvg_: SVGElement|null = null;\n\n /** The rendered field's SVG group element. */\n protected fieldGroup_: SVGGElement|null = null;\n\n /** The rendered field's SVG border element. */\n protected borderRect_: SVGRectElement|null = null;\n\n /** The rendered field's SVG text element. */\n protected textElement_: SVGTextElement|null = null;\n\n /** The rendered field's text content element. */\n protected textContent_: Text|null = null;\n\n /** Mouse down event listener data. */\n private mouseDownWrapper_: browserEvents.Data|null = null;\n\n /** Constants associated with the source block's renderer. */\n protected constants_: ConstantProvider|null = null;\n\n /**\n * Has this field been disposed of?\n *\n * @internal\n */\n disposed = false;\n\n /** Maximum characters of text to display before adding an ellipsis. */\n maxDisplayLength = 50;\n\n /** Block this field is attached to. Starts as null, then set in init. */\n protected sourceBlock_: Block|null = null;\n\n /** Does this block need to be re-rendered? */\n protected isDirty_ = true;\n\n /** Is the field visible, or hidden due to the block being collapsed? */\n protected visible_ = true;\n\n /**\n * Can the field value be changed using the editor on an editable block?\n */\n protected enabled_ = true;\n\n /** The element the click handler is bound to. */\n protected clickTarget_: Element|null = null;\n\n /**\n * The prefix field.\n *\n * @internal\n */\n prefixField: string|null = null;\n\n /**\n * The suffix field.\n *\n * @internal\n */\n suffixField: string|null = null;\n\n /**\n * Editable fields usually show some sort of UI indicating they are\n * editable. They will also be saved by the serializer.\n */\n EDITABLE = true;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable. This is not the\n * case by default so that SERIALIZABLE is backwards compatible.\n */\n SERIALIZABLE = false;\n\n /** Mouse cursor style when over the hotspot that initiates the editor. */\n CURSOR = '';\n\n /**\n * @param value The initial value of the field.\n * Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by\n * subclasses that want to handle configuration and setting the field value\n * after their own constructors have run).\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a value & returns a validated value, or null to\n * abort the change.\n * @param opt_config A map of options used to configure the field.\n * Refer to the individual field's documentation for a list of properties\n * this parameter supports.\n */\n constructor(\n value: AnyDuringMigration, opt_validator?: Function|null,\n opt_config?: FieldConfig) {\n /**\n * A generic value possessed by the field.\n * Should generally be non-null, only null when the field is created.\n */\n this.value_ = ('DEFAULT_VALUE' in (new.target).prototype) ?\n ((new.target).prototype as AnyDuringMigration).DEFAULT_VALUE :\n null;\n\n /** The size of the area rendered by the field. */\n this.size_ = new Size(0, 0);\n\n if (value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n }\n this.setValue(value);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n /**\n * Process the configuration map passed to the field.\n *\n * @param config A map of options used to configure the field. See the\n * individual field's documentation for a list of properties this\n * parameter supports.\n */\n protected configure_(config: FieldConfig) {\n // TODO (#2884): Possibly add CSS class config option.\n // TODO (#2885): Possibly add cursor config option.\n if (config.tooltip) {\n this.setTooltip(parsing.replaceMessageReferences(config.tooltip));\n }\n }\n\n /**\n * Attach this field to a block.\n *\n * @param block The block containing this field.\n */\n setSourceBlock(block: Block) {\n if (this.sourceBlock_) {\n throw Error('Field already bound to a block');\n }\n this.sourceBlock_ = block;\n }\n\n /**\n * Get the renderer constant provider.\n *\n * @returns The renderer constant provider.\n */\n getConstants(): ConstantProvider|null {\n if (!this.constants_ && this.sourceBlock_ &&\n !this.sourceBlock_.isDeadOrDying() &&\n this.sourceBlock_.workspace.rendered) {\n this.constants_ = (this.sourceBlock_.workspace as WorkspaceSvg)\n .getRenderer()\n .getConstants();\n }\n return this.constants_;\n }\n\n /**\n * Get the block this field is attached to.\n *\n * @returns The block containing this field.\n * @throws An error if the source block is not defined.\n */\n getSourceBlock(): Block|null {\n return this.sourceBlock_;\n }\n\n /**\n * Initialize everything to render this field. Override\n * methods initModel and initView rather than this method.\n *\n * @sealed\n * @internal\n */\n init() {\n if (this.fieldGroup_) {\n // Field has already been initialized once.\n return;\n }\n this.fieldGroup_ = dom.createSvgElement(Svg.G, {});\n if (!this.isVisible()) {\n this.fieldGroup_.style.display = 'none';\n }\n const sourceBlockSvg = this.sourceBlock_ as BlockSvg;\n sourceBlockSvg.getSvgRoot().appendChild(this.fieldGroup_);\n this.initView();\n this.updateEditable();\n this.setTooltip(this.tooltip_);\n this.bindEvents_();\n this.initModel();\n }\n\n /**\n * Create the block UI for this field.\n *\n * @internal\n */\n initView() {\n this.createBorderRect_();\n this.createTextElement_();\n }\n\n /**\n * Initializes the model of the field after it has been installed on a block.\n * No-op by default.\n *\n * @internal\n */\n initModel() {}\n\n /**\n * Create a field border rect element. Not to be overridden by subclasses.\n * Instead modify the result of the function inside initView, or create a\n * separate function to call.\n */\n protected createBorderRect_() {\n this.borderRect_ = dom.createSvgElement(\n Svg.RECT, {\n 'rx': this.getConstants()!.FIELD_BORDER_RECT_RADIUS,\n 'ry': this.getConstants()!.FIELD_BORDER_RECT_RADIUS,\n 'x': 0,\n 'y': 0,\n 'height': this.size_.height,\n 'width': this.size_.width,\n 'class': 'blocklyFieldRect',\n },\n this.fieldGroup_);\n }\n\n /**\n * Create a field text element. Not to be overridden by subclasses. Instead\n * modify the result of the function inside initView, or create a separate\n * function to call.\n */\n protected createTextElement_() {\n this.textElement_ = dom.createSvgElement(\n Svg.TEXT, {\n 'class': 'blocklyText',\n },\n this.fieldGroup_);\n if (this.getConstants()!.FIELD_TEXT_BASELINE_CENTER) {\n this.textElement_.setAttribute('dominant-baseline', 'central');\n }\n this.textContent_ = document.createTextNode('');\n this.textElement_.appendChild(this.textContent_);\n }\n\n /**\n * Bind events to the field. Can be overridden by subclasses if they need to\n * do custom input handling.\n */\n protected bindEvents_() {\n const clickTarget = this.getClickTarget_();\n if (!clickTarget) throw new Error('A click target has not been set.');\n Tooltip.bindMouseEvents(clickTarget);\n this.mouseDownWrapper_ = browserEvents.conditionalBind(\n clickTarget, 'mousedown', this, this.onMouseDown_);\n }\n\n /**\n * Sets the field's value based on the given XML element. Should only be\n * called by Blockly.Xml.\n *\n * @param fieldElement The element containing info about the field's state.\n * @internal\n */\n fromXml(fieldElement: Element) {\n this.setValue(fieldElement.textContent);\n }\n\n /**\n * Serializes this field's value to XML. Should only be called by Blockly.Xml.\n *\n * @param fieldElement The element to populate with info about the field's\n * state.\n * @returns The element containing info about the field's state.\n * @internal\n */\n toXml(fieldElement: Element): Element {\n fieldElement.textContent = this.getValue();\n return fieldElement;\n }\n\n /**\n * Saves this fields value as something which can be serialized to JSON.\n * Should only be called by the serialization system.\n *\n * @param _doFullSerialization If true, this signals to the field that if it\n * normally just saves a reference to some state (eg variable fields) it\n * should instead serialize the full state of the thing being referenced.\n * @returns JSON serializable state.\n * @internal\n */\n saveState(_doFullSerialization?: boolean): AnyDuringMigration {\n const legacyState = this.saveLegacyState(Field);\n if (legacyState !== null) {\n return legacyState;\n }\n return this.getValue();\n }\n\n /**\n * Sets the field's state based on the given state value. Should only be\n * called by the serialization system.\n *\n * @param state The state we want to apply to the field.\n * @internal\n */\n loadState(state: AnyDuringMigration) {\n if (this.loadLegacyState(Field, state)) {\n return;\n }\n this.setValue(state);\n }\n\n /**\n * Returns a stringified version of the XML state, if it should be used.\n * Otherwise this returns null, to signal the field should use its own\n * serialization.\n *\n * @param callingClass The class calling this method.\n * Used to see if `this` has overridden any relevant hooks.\n * @returns The stringified version of the XML state, or null.\n */\n protected saveLegacyState(callingClass: FieldProto): string|null {\n if (callingClass.prototype.saveState === this.saveState &&\n callingClass.prototype.toXml !== this.toXml) {\n const elem = utilsXml.createElement('field');\n elem.setAttribute('name', this.name || '');\n const text = Xml.domToText(this.toXml(elem));\n return text.replace(\n ' xmlns=\"https://developers.google.com/blockly/xml\"', '');\n }\n // Either they called this on purpose from their saveState, or they have\n // no implementations of either hook. Just do our thing.\n return null;\n }\n\n /**\n * Loads the given state using either the old XML hooks, if they should be\n * used. Returns true to indicate loading has been handled, false otherwise.\n *\n * @param callingClass The class calling this method.\n * Used to see if `this` has overridden any relevant hooks.\n * @param state The state to apply to the field.\n * @returns Whether the state was applied or not.\n */\n loadLegacyState(callingClass: FieldProto, state: AnyDuringMigration):\n boolean {\n if (callingClass.prototype.loadState === this.loadState &&\n callingClass.prototype.fromXml !== this.fromXml) {\n this.fromXml(Xml.textToDom(state as string));\n return true;\n }\n // Either they called this on purpose from their loadState, or they have\n // no implementations of either hook. Just do our thing.\n return false;\n }\n\n /**\n * Dispose of all DOM objects and events belonging to this editable field.\n *\n * @internal\n */\n dispose() {\n dropDownDiv.hideIfOwner(this);\n WidgetDiv.hideIfOwner(this);\n Tooltip.unbindMouseEvents(this.getClickTarget_());\n\n if (this.mouseDownWrapper_) {\n browserEvents.unbind(this.mouseDownWrapper_);\n }\n\n dom.removeNode(this.fieldGroup_);\n\n this.disposed = true;\n }\n\n /** Add or remove the UI indicating if this field is editable or not. */\n updateEditable() {\n const group = this.fieldGroup_;\n const block = this.getSourceBlock();\n if (!this.EDITABLE || !group || !block) {\n return;\n }\n if (this.enabled_ && block.isEditable()) {\n dom.addClass(group, 'blocklyEditableText');\n dom.removeClass(group, 'blocklyNonEditableText');\n group.style.cursor = this.CURSOR;\n } else {\n dom.addClass(group, 'blocklyNonEditableText');\n dom.removeClass(group, 'blocklyEditableText');\n group.style.cursor = '';\n }\n }\n\n /**\n * Set whether this field's value can be changed using the editor when the\n * source block is editable.\n *\n * @param enabled True if enabled.\n */\n setEnabled(enabled: boolean) {\n this.enabled_ = enabled;\n this.updateEditable();\n }\n\n /**\n * Check whether this field's value can be changed using the editor when the\n * source block is editable.\n *\n * @returns Whether this field is enabled.\n */\n isEnabled(): boolean {\n return this.enabled_;\n }\n\n /**\n * Check whether this field defines the showEditor_ function.\n *\n * @returns Whether this field is clickable.\n */\n isClickable(): boolean {\n return this.enabled_ && !!this.sourceBlock_ &&\n this.sourceBlock_.isEditable() &&\n this.showEditor_ !== Field.prototype.showEditor_;\n }\n\n /**\n * Check whether this field is currently editable. Some fields are never\n * EDITABLE (e.g. text labels). Other fields may be EDITABLE but may exist on\n * non-editable blocks or be currently disabled.\n *\n * @returns Whether this field is currently enabled, editable and on an\n * editable block.\n */\n isCurrentlyEditable(): boolean {\n return this.enabled_ && this.EDITABLE && !!this.sourceBlock_ &&\n this.sourceBlock_.isEditable();\n }\n\n /**\n * Check whether this field should be serialized by the XML renderer.\n * Handles the logic for backwards compatibility and incongruous states.\n *\n * @returns Whether this field should be serialized or not.\n */\n isSerializable(): boolean {\n let isSerializable = false;\n if (this.name) {\n if (this.SERIALIZABLE) {\n isSerializable = true;\n } else if (this.EDITABLE) {\n console.warn(\n 'Detected an editable field that was not serializable.' +\n ' Please define SERIALIZABLE property as true on all editable custom' +\n ' fields. Proceeding with serialization.');\n isSerializable = true;\n }\n }\n return isSerializable;\n }\n\n /**\n * Gets whether this editable field is visible or not.\n *\n * @returns True if visible.\n */\n isVisible(): boolean {\n return this.visible_;\n }\n\n /**\n * Sets whether this editable field is visible or not. Should only be called\n * by input.setVisible.\n *\n * @param visible True if visible.\n * @internal\n */\n setVisible(visible: boolean) {\n if (this.visible_ === visible) {\n return;\n }\n this.visible_ = visible;\n const root = this.fieldGroup_;\n if (root) {\n root.style.display = visible ? 'block' : 'none';\n }\n }\n\n /**\n * Sets a new validation function for editable fields, or clears a previously\n * set validator.\n *\n * The validator function takes in the new field value, and returns\n * validated value. The validated value could be the input value, a modified\n * version of the input value, or null to abort the change.\n *\n * If the function does not return anything (or returns undefined) the new\n * value is accepted as valid. This is to allow for fields using the\n * validated function as a field-level change event notification.\n *\n * @param handler The validator function or null to clear a previous\n * validator.\n */\n setValidator(handler: Function) {\n this.validator_ = handler;\n }\n\n /**\n * Gets the validation function for editable fields, or null if not set.\n *\n * @returns Validation function, or null.\n */\n getValidator(): Function|null {\n return this.validator_;\n }\n\n /**\n * Gets the group element for this editable field.\n * Used for measuring the size and for positioning.\n *\n * @returns The group element.\n */\n getSvgRoot(): SVGGElement|null {\n return this.fieldGroup_;\n }\n\n /**\n * Gets the border rectangle element.\n *\n * @returns The border rectangle element.\n * @throws An error if the border rectangle element is not defined.\n */\n protected getBorderRect(): SVGRectElement {\n if (!this.borderRect_) {\n throw new Error(`The border rectangle is ${this.borderRect_}.`);\n }\n return this.borderRect_;\n }\n\n /**\n * Gets the text element.\n *\n * @returns The text element.\n * @throws An error if the text element is not defined.\n */\n protected getTextElement(): SVGTextElement {\n if (!this.textElement_) {\n throw new Error(`The text element is ${this.textElement_}.`);\n }\n return this.textElement_;\n }\n\n /**\n * Gets the text content.\n *\n * @returns The text content.\n * @throws An error if the text content is not defined.\n */\n protected getTextContent(): Text {\n if (!this.textContent_) {\n throw new Error(`The text content is ${this.textContent_}.`);\n }\n return this.textContent_;\n }\n\n /**\n * Updates the field to match the colour/style of the block. Should only be\n * called by BlockSvg.applyColour().\n *\n * @internal\n */\n applyColour() {}\n // Non-abstract sub-classes may wish to implement this. See FieldDropdown.\n\n /**\n * Used by getSize() to move/resize any DOM elements, and get the new size.\n *\n * All rendering that has an effect on the size/shape of the block should be\n * done here, and should be triggered by getSize().\n */\n protected render_() {\n if (this.textContent_) {\n this.textContent_.nodeValue = this.getDisplayText_();\n }\n this.updateSize_();\n }\n\n /**\n * Calls showEditor_ when the field is clicked if the field is clickable.\n * Do not override.\n *\n * @param opt_e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n * @sealed\n * @internal\n */\n showEditor(opt_e?: Event) {\n if (this.isClickable()) {\n this.showEditor_(opt_e);\n }\n }\n\n /**\n * A developer hook to create an editor for the field. This is no-op by\n * default, and must be overriden to create an editor.\n *\n * @param _e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n */\n protected showEditor_(_e?: Event): void {}\n // NOP\n\n /**\n * Updates the size of the field based on the text.\n *\n * @param opt_margin margin to use when positioning the text element.\n */\n protected updateSize_(opt_margin?: number) {\n const constants = this.getConstants();\n const xOffset = opt_margin !== undefined ? opt_margin :\n this.borderRect_ ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING :\n 0;\n let totalWidth = xOffset * 2;\n let totalHeight = constants!.FIELD_TEXT_HEIGHT;\n\n let contentWidth = 0;\n if (this.textElement_) {\n contentWidth = dom.getFastTextWidth(\n this.textElement_, constants!.FIELD_TEXT_FONTSIZE,\n constants!.FIELD_TEXT_FONTWEIGHT, constants!.FIELD_TEXT_FONTFAMILY);\n totalWidth += contentWidth;\n }\n if (this.borderRect_) {\n totalHeight = Math.max(totalHeight, constants!.FIELD_BORDER_RECT_HEIGHT);\n }\n\n this.size_.height = totalHeight;\n this.size_.width = totalWidth;\n\n this.positionTextElement_(xOffset, contentWidth);\n this.positionBorderRect_();\n }\n\n /**\n * Position a field's text element after a size change. This handles both LTR\n * and RTL positioning.\n *\n * @param xOffset x offset to use when positioning the text element.\n * @param contentWidth The content width.\n */\n protected positionTextElement_(xOffset: number, contentWidth: number) {\n if (!this.textElement_) {\n return;\n }\n const constants = this.getConstants();\n const halfHeight = this.size_.height / 2;\n\n this.textElement_.setAttribute(\n 'x',\n `${\n this.getSourceBlock()?.RTL ?\n this.size_.width - contentWidth - xOffset :\n xOffset}`);\n this.textElement_.setAttribute(\n 'y',\n `${\n constants!.FIELD_TEXT_BASELINE_CENTER ?\n halfHeight :\n halfHeight - constants!.FIELD_TEXT_HEIGHT / 2 +\n constants!.FIELD_TEXT_BASELINE}`);\n }\n\n /** Position a field's border rect after a size change. */\n protected positionBorderRect_() {\n if (!this.borderRect_) {\n return;\n }\n this.borderRect_.setAttribute('width', `${this.size_.width}`);\n this.borderRect_.setAttribute('height', `${this.size_.height}`);\n this.borderRect_.setAttribute(\n 'rx', `${this.getConstants()!.FIELD_BORDER_RECT_RADIUS}`);\n this.borderRect_.setAttribute(\n 'ry', `${this.getConstants()!.FIELD_BORDER_RECT_RADIUS}`);\n }\n\n /**\n * Returns the height and width of the field.\n *\n * This should *in general* be the only place render_ gets called from.\n *\n * @returns Height and width.\n */\n getSize(): Size {\n if (!this.isVisible()) {\n return new Size(0, 0);\n }\n\n if (this.isDirty_) {\n this.render_();\n this.isDirty_ = false;\n } else if (this.visible_ && this.size_.width === 0) {\n // If the field is not visible the width will be 0 as well, one of the\n // problems with the old system.\n console.warn(\n 'Deprecated use of setting size_.width to 0 to rerender a' +\n ' field. Set field.isDirty_ to true instead.');\n this.render_();\n }\n return this.size_;\n }\n\n /**\n * Returns the bounding box of the rendered field, accounting for workspace\n * scaling.\n *\n * @returns An object with top, bottom, left, and right in pixels relative to\n * the top left corner of the page (window coordinates).\n * @internal\n */\n getScaledBBox(): Rect {\n let scaledWidth;\n let scaledHeight;\n let xy;\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n\n if (!this.borderRect_) {\n // Browsers are inconsistent in what they return for a bounding box.\n // - Webkit / Blink: fill-box / object bounding box\n // - Gecko: stroke-box\n const bBox = (this.sourceBlock_ as BlockSvg).getHeightWidth();\n const scale = (block.workspace as WorkspaceSvg).scale;\n xy = this.getAbsoluteXY_();\n scaledWidth = (bBox.width + 1) * scale;\n scaledHeight = (bBox.height + 1) * scale;\n\n if (userAgent.GECKO) {\n xy.x += 1.5 * scale;\n xy.y += 1.5 * scale;\n } else {\n xy.x -= 0.5 * scale;\n xy.y -= 0.5 * scale;\n }\n } else {\n const bBox = this.borderRect_.getBoundingClientRect();\n xy = style.getPageOffset(this.borderRect_);\n scaledWidth = bBox.width;\n scaledHeight = bBox.height;\n }\n return new Rect(xy.y, xy.y + scaledHeight, xy.x, xy.x + scaledWidth);\n }\n\n /**\n * Get the text from this field to display on the block. May differ from\n * `getText` due to ellipsis, and other formatting.\n *\n * @returns Text to display.\n */\n protected getDisplayText_(): string {\n let text = this.getText();\n if (!text) {\n // Prevent the field from disappearing if empty.\n return Field.NBSP;\n }\n if (text.length > this.maxDisplayLength) {\n // Truncate displayed string and add an ellipsis ('...').\n text = text.substring(0, this.maxDisplayLength - 2) + '…';\n }\n // Replace whitespace with non-breaking spaces so the text doesn't collapse.\n text = text.replace(/\\s/g, Field.NBSP);\n if (this.sourceBlock_ && this.sourceBlock_.RTL) {\n // The SVG is LTR, force text to be RTL by adding an RLM.\n text += '\\u200F';\n }\n return text;\n }\n\n /**\n * Get the text from this field.\n * Override getText_ to provide a different behavior than simply casting the\n * value to a string.\n *\n * @returns Current text.\n * @sealed\n */\n getText(): string {\n // this.getText_ was intended so that devs don't have to remember to call\n // super when overriding how the text of the field is generated. (#2910)\n const text = this.getText_();\n if (text !== null) {\n return String(text);\n }\n return String(this.getValue());\n }\n\n /**\n * A developer hook to override the returned text of this field.\n * Override if the text representation of the value of this field\n * is not just a string cast of its value.\n * Return null to resort to a string cast.\n *\n * @returns Current text or null.\n */\n protected getText_(): string|null {\n return null;\n }\n\n /**\n * Force a rerender of the block that this field is installed on, which will\n * rerender this field and adjust for any sizing changes.\n * Other fields on the same block will not rerender, because their sizes have\n * already been recorded.\n *\n * @internal\n */\n markDirty() {\n this.isDirty_ = true;\n this.constants_ = null;\n }\n\n /**\n * Force a rerender of the block that this field is installed on, which will\n * rerender this field and adjust for any sizing changes.\n * Other fields on the same block will not rerender, because their sizes have\n * already been recorded.\n *\n * @internal\n */\n forceRerender() {\n this.isDirty_ = true;\n if (this.sourceBlock_ && this.sourceBlock_.rendered) {\n (this.sourceBlock_ as BlockSvg).render();\n (this.sourceBlock_ as BlockSvg).bumpNeighbours();\n this.updateMarkers_();\n }\n }\n\n /**\n * Used to change the value of the field. Handles validation and events.\n * Subclasses should override doClassValidation_ and doValueUpdate_ rather\n * than this method.\n *\n * @param newValue New value.\n * @sealed\n */\n setValue(newValue: AnyDuringMigration) {\n const doLogging = false;\n if (newValue === null) {\n doLogging && console.log('null, return');\n // Not a valid value to check.\n return;\n }\n\n let validatedValue = this.doClassValidation_(newValue);\n // Class validators might accidentally forget to return, we'll ignore that.\n newValue = this.processValidation_(newValue, validatedValue);\n if (newValue instanceof Error) {\n doLogging && console.log('invalid class validation, return');\n return;\n }\n\n const localValidator = this.getValidator();\n if (localValidator) {\n validatedValue = localValidator.call(this, newValue);\n // Local validators might accidentally forget to return, we'll ignore\n // that.\n newValue = this.processValidation_(newValue, validatedValue);\n if (newValue instanceof Error) {\n doLogging && console.log('invalid local validation, return');\n return;\n }\n }\n const source = this.sourceBlock_;\n if (source && source.disposed) {\n doLogging && console.log('source disposed, return');\n return;\n }\n const oldValue = this.getValue();\n if (oldValue === newValue) {\n doLogging && console.log('same, doValueUpdate_, return');\n this.doValueUpdate_(newValue);\n return;\n }\n\n this.doValueUpdate_(newValue);\n if (source && eventUtils.isEnabled()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n source, 'field', this.name || null, oldValue, newValue));\n }\n if (this.isDirty_) {\n this.forceRerender();\n }\n doLogging && console.log(this.value_);\n }\n\n /**\n * Process the result of validation.\n *\n * @param newValue New value.\n * @param validatedValue Validated value.\n * @returns New value, or an Error object.\n */\n private processValidation_(\n newValue: AnyDuringMigration,\n validatedValue: AnyDuringMigration): AnyDuringMigration {\n if (validatedValue === null) {\n this.doValueInvalid_(newValue);\n if (this.isDirty_) {\n this.forceRerender();\n }\n return Error();\n }\n if (validatedValue !== undefined) {\n newValue = validatedValue;\n }\n return newValue;\n }\n\n /**\n * Get the current value of the field.\n *\n * @returns Current value.\n */\n getValue(): AnyDuringMigration {\n return this.value_;\n }\n\n /**\n * Used to validate a value. Returns input by default. Can be overridden by\n * subclasses, see FieldDropdown.\n *\n * @param opt_newValue The value to be validated.\n * @returns The validated value, same as input by default.\n */\n protected doClassValidation_(opt_newValue?: AnyDuringMigration):\n AnyDuringMigration {\n if (opt_newValue === null || opt_newValue === undefined) {\n return null;\n }\n return opt_newValue;\n }\n\n /**\n * Used to update the value of a field. Can be overridden by subclasses to do\n * custom storage of values/updating of external things.\n *\n * @param newValue The value to be saved.\n */\n protected doValueUpdate_(newValue: AnyDuringMigration) {\n this.value_ = newValue;\n this.isDirty_ = true;\n }\n\n /**\n * Used to notify the field an invalid value was input. Can be overridden by\n * subclasses, see FieldTextInput.\n * No-op by default.\n *\n * @param _invalidValue The input value that was determined to be invalid.\n */\n protected doValueInvalid_(_invalidValue: AnyDuringMigration) {}\n // NOP\n\n /**\n * Handle a mouse down event on a field.\n *\n * @param e Mouse down event.\n */\n protected onMouseDown_(e: Event) {\n if (!this.sourceBlock_ || this.sourceBlock_.isDeadOrDying()) {\n return;\n }\n const gesture = (this.sourceBlock_.workspace as WorkspaceSvg).getGesture(e);\n if (gesture) {\n gesture.setStartField(this);\n }\n }\n\n /**\n * Sets the tooltip for this field.\n *\n * @param newTip The text for the tooltip, a function that returns the text\n * for the tooltip, a parent object whose tooltip will be used, or null to\n * display the tooltip of the parent block. To not display a tooltip pass\n * the empty string.\n */\n setTooltip(newTip: Tooltip.TipInfo|null) {\n if (!newTip && newTip !== '') { // If null or undefined.\n newTip = this.sourceBlock_;\n }\n const clickTarget = this.getClickTarget_();\n if (clickTarget) {\n (clickTarget as AnyDuringMigration).tooltip = newTip;\n } else {\n // Field has not been initialized yet.\n this.tooltip_ = newTip;\n }\n }\n\n /**\n * Returns the tooltip text for this field.\n *\n * @returns The tooltip text for this field.\n */\n getTooltip(): string {\n const clickTarget = this.getClickTarget_();\n if (clickTarget) {\n return Tooltip.getTooltipOfObject(clickTarget);\n }\n // Field has not been initialized yet. Return stashed this.tooltip_ value.\n return Tooltip.getTooltipOfObject({tooltip: this.tooltip_});\n }\n\n /**\n * The element to bind the click handler to. If not set explicitly, defaults\n * to the SVG root of the field. When this element is\n * clicked on an editable field, the editor will open.\n *\n * @returns Element to bind click handler to.\n */\n protected getClickTarget_(): Element|null {\n return this.clickTarget_ || this.getSvgRoot();\n }\n\n /**\n * Return the absolute coordinates of the top-left corner of this field.\n * The origin (0,0) is the top-left corner of the page body.\n *\n * @returns Object with .x and .y properties.\n */\n protected getAbsoluteXY_(): Coordinate {\n return style.getPageOffset(this.getClickTarget_() as SVGRectElement);\n }\n\n /**\n * Whether this field references any Blockly variables. If true it may need\n * to be handled differently during serialization and deserialization.\n * Subclasses may override this.\n *\n * @returns True if this field has any variable references.\n * @internal\n */\n referencesVariables(): boolean {\n return false;\n }\n\n /**\n * Refresh the variable name referenced by this field if this field references\n * variables.\n *\n * @internal\n */\n refreshVariableName() {}\n // NOP\n\n /**\n * Search through the list of inputs and their fields in order to find the\n * parent input of a field.\n *\n * @returns The input that the field belongs to.\n * @internal\n */\n getParentInput(): Input {\n let parentInput = null;\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n const inputs = block.inputList;\n\n for (let idx = 0; idx < block.inputList.length; idx++) {\n const input = inputs[idx];\n const fieldRows = input.fieldRow;\n for (let j = 0; j < fieldRows.length; j++) {\n if (fieldRows[j] === this) {\n parentInput = input;\n break;\n }\n }\n }\n return parentInput!;\n }\n\n /**\n * Returns whether or not we should flip the field in RTL.\n *\n * @returns True if we should flip in RTL.\n */\n getFlipRtl(): boolean {\n return false;\n }\n\n /**\n * Returns whether or not the field is tab navigable.\n *\n * @returns True if the field is tab navigable.\n */\n isTabNavigable(): boolean {\n return false;\n }\n\n /**\n * Handles the given keyboard shortcut.\n *\n * @param _shortcut The shortcut to be handled.\n * @returns True if the shortcut has been handled, false otherwise.\n */\n onShortcut(_shortcut: KeyboardShortcut): boolean {\n return false;\n }\n\n /**\n * Add the cursor SVG to this fields SVG group.\n *\n * @param cursorSvg The SVG root of the cursor to be added to the field group.\n * @internal\n */\n setCursorSvg(cursorSvg: SVGElement) {\n if (!cursorSvg) {\n this.cursorSvg_ = null;\n return;\n }\n\n if (!this.fieldGroup_) {\n throw new Error(`The field group is ${this.fieldGroup_}.`);\n }\n this.fieldGroup_.appendChild(cursorSvg);\n this.cursorSvg_ = cursorSvg;\n }\n\n /**\n * Add the marker SVG to this fields SVG group.\n *\n * @param markerSvg The SVG root of the marker to be added to the field group.\n * @internal\n */\n setMarkerSvg(markerSvg: SVGElement) {\n if (!markerSvg) {\n this.markerSvg_ = null;\n return;\n }\n\n if (!this.fieldGroup_) {\n throw new Error(`The field group is ${this.fieldGroup_}.`);\n }\n this.fieldGroup_.appendChild(markerSvg);\n this.markerSvg_ = markerSvg;\n }\n\n /** Redraw any attached marker or cursor svgs if needed. */\n protected updateMarkers_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n const workspace = block.workspace as WorkspaceSvg;\n if (workspace.keyboardAccessibilityMode && this.cursorSvg_) {\n workspace.getCursor()!.draw();\n }\n if (workspace.keyboardAccessibilityMode && this.markerSvg_) {\n // TODO(#4592): Update all markers on the field.\n workspace.getMarker(MarkerManager.LOCAL_MARKER)!.draw();\n }\n }\n}\n\n/**\n * Extra configuration options for the base field.\n */\nexport interface FieldConfig {\n tooltip?: string;\n}\n\n/**\n * For use by Field and descendants of Field. Constructors can change\n * in descendants, though they should contain all of Field's prototype methods.\n */\nexport type FieldProto = Pick<typeof Field, 'prototype'>;\n\n/**\n * Represents an error where the field is trying to access its block or\n * information about its block before it has actually been attached to said\n * block.\n */\nexport class UnattachedFieldError extends Error {\n /** @internal */\n constructor() {\n super(\n 'The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.');\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Constant declarations for common key codes.\n * These methods are not specific to Blockly, and could be factored out into\n * a JavaScript framework such as Closure.\n *\n * @namespace Blockly.utils.KeyCodes\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.utils.KeyCodes');\n\n\n/**\n * Key codes for common characters.\n *\n * Copied from Closure's goog.events.KeyCodes\n *\n * This list is not localized and therefore some of the key codes are not\n * correct for non US keyboard layouts. See comments below.\n *\n * @alias Blockly.utils.KeyCodes\n */\nexport enum KeyCodes {\n WIN_KEY_FF_LINUX = 0,\n MAC_ENTER = 3,\n BACKSPACE = 8,\n TAB = 9,\n NUM_CENTER = 12, // NUMLOCK on FF/Safari Mac\n ENTER = 13,\n SHIFT = 16,\n CTRL = 17,\n ALT = 18,\n PAUSE = 19,\n CAPS_LOCK = 20,\n ESC = 27,\n SPACE = 32,\n PAGE_UP = 33, // also NUM_NORTH_EAST\n PAGE_DOWN = 34, // also NUM_SOUTH_EAST\n END = 35, // also NUM_SOUTH_WEST\n HOME = 36, // also NUM_NORTH_WEST\n LEFT = 37, // also NUM_WEST\n UP = 38, // also NUM_NORTH\n RIGHT = 39, // also NUM_EAST\n DOWN = 40, // also NUM_SOUTH\n PLUS_SIGN = 43, // NOT numpad plus\n PRINT_SCREEN = 44,\n INSERT = 45, // also NUM_INSERT\n DELETE = 46, // also NUM_DELETE\n ZERO = 48,\n ONE = 49,\n TWO = 50,\n THREE = 51,\n FOUR = 52,\n FIVE = 53,\n SIX = 54,\n SEVEN = 55,\n EIGHT = 56,\n NINE = 57,\n FF_SEMICOLON = 59, // Firefox (Gecko) fires this for semicolon instead of 186\n FF_EQUALS = 61, // Firefox (Gecko) fires this for equals instead of 187\n FF_DASH = 173, // Firefox (Gecko) fires this for dash instead of 189\n // Firefox (Gecko) fires this for # on UK keyboards, rather than\n // Shift+SINGLE_QUOTE.\n FF_HASH = 163,\n QUESTION_MARK = 63, // needs localization\n AT_SIGN = 64,\n A = 65,\n B = 66,\n C = 67,\n D = 68,\n E = 69,\n F = 70,\n G = 71,\n H = 72,\n I = 73,\n J = 74,\n K = 75,\n L = 76,\n M = 77,\n N = 78,\n O = 79,\n P = 80,\n Q = 81,\n R = 82,\n S = 83,\n T = 84,\n U = 85,\n V = 86,\n W = 87,\n X = 88,\n Y = 89,\n Z = 90,\n META = 91, // WIN_KEY_LEFT\n WIN_KEY_RIGHT = 92,\n CONTEXT_MENU = 93,\n NUM_ZERO = 96,\n NUM_ONE = 97,\n NUM_TWO = 98,\n NUM_THREE = 99,\n NUM_FOUR = 100,\n NUM_FIVE = 101,\n NUM_SIX = 102,\n NUM_SEVEN = 103,\n NUM_EIGHT = 104,\n NUM_NINE = 105,\n NUM_MULTIPLY = 106,\n NUM_PLUS = 107,\n NUM_MINUS = 109,\n NUM_PERIOD = 110,\n NUM_DIVISION = 111,\n F1 = 112,\n F2 = 113,\n F3 = 114,\n F4 = 115,\n F5 = 116,\n F6 = 117,\n F7 = 118,\n F8 = 119,\n F9 = 120,\n F10 = 121,\n F11 = 122,\n F12 = 123,\n NUMLOCK = 144,\n SCROLL_LOCK = 145,\n\n // OS-specific media keys like volume controls and browser controls.\n FIRST_MEDIA_KEY = 166,\n LAST_MEDIA_KEY = 183,\n\n SEMICOLON = 186, // needs localization\n DASH = 189, // needs localization\n EQUALS = 187, // needs localization\n COMMA = 188, // needs localization\n PERIOD = 190, // needs localization\n SLASH = 191, // needs localization\n APOSTROPHE = 192, // needs localization\n TILDE = 192, // needs localization\n SINGLE_QUOTE = 222, // needs localization\n OPEN_SQUARE_BRACKET = 219, // needs localization\n BACKSLASH = 220, // needs localization\n CLOSE_SQUARE_BRACKET = 221, // needs localization\n WIN_KEY = 224,\n MAC_FF_META =\n 224, // Firefox (Gecko) fires this for the meta key instead of 91\n MAC_WK_CMD_LEFT = 91, // WebKit Left Command key fired, same as META\n MAC_WK_CMD_RIGHT = 93, // WebKit Right Command key fired, different from META\n WIN_IME = 229,\n\n // \"Reserved for future use\". Some programs (e.g. the SlingPlayer 2.4 ActiveX\n // control) fire this as a hacky way to disable screensavers.\n VK_NONAME = 252,\n\n // We've seen users whose machines fire this keycode at regular one\n // second intervals. The common thread among these users is that\n // they're all using Dell Inspiron laptops, so we suspect that this\n // indicates a hardware/bios problem.\n // http://en.community.dell.com/support-forums/laptop/f/3518/p/19285957/19523128.aspx\n PHANTOM = 255,\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Blockly menu similar to Closure's goog.ui.Menu\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Menu');\n\nimport * as browserEvents from './browser_events.js';\nimport type {MenuItem} from './menuitem.js';\nimport * as aria from './utils/aria.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport type {Size} from './utils/size.js';\nimport * as style from './utils/style.js';\n\n\n/**\n * A basic menu class.\n *\n * @alias Blockly.Menu\n */\nexport class Menu {\n /**\n * Array of menu items.\n * (Nulls are never in the array, but typing the array as nullable prevents\n * the compiler from objecting to .indexOf(null))\n */\n private readonly menuItems_: MenuItem[] = [];\n\n /**\n * Coordinates of the mousedown event that caused this menu to open. Used to\n * prevent the consequent mouseup event due to a simple click from\n * activating a menu item immediately.\n */\n openingCoords: Coordinate|null = null;\n\n /**\n * This is the element that we will listen to the real focus events on.\n * A value of null means no menu item is highlighted.\n */\n private highlightedItem_: MenuItem|null = null;\n\n /** Mouse over event data. */\n private mouseOverHandler_: browserEvents.Data|null = null;\n\n /** Click event data. */\n private clickHandler_: browserEvents.Data|null = null;\n\n /** Mouse enter event data. */\n private mouseEnterHandler_: browserEvents.Data|null = null;\n\n /** Mouse leave event data. */\n private mouseLeaveHandler_: browserEvents.Data|null = null;\n\n /** Key down event data. */\n private onKeyDownHandler_: browserEvents.Data|null = null;\n\n /** The menu's root DOM element. */\n private element_: HTMLDivElement|null = null;\n\n /** ARIA name for this menu. */\n private roleName_: aria.Role|null = null;\n\n /** Constructs a new Menu instance. */\n constructor() {}\n\n /**\n * Add a new menu item to the bottom of this menu.\n *\n * @param menuItem Menu item to append.\n * @internal\n */\n addChild(menuItem: MenuItem) {\n this.menuItems_.push(menuItem);\n }\n\n /**\n * Creates the menu DOM.\n *\n * @param container Element upon which to append this menu.\n * @returns The menu's root DOM element.\n */\n render(container: Element): HTMLDivElement {\n const element = (document.createElement('div'));\n // goog-menu is deprecated, use blocklyMenu. May 2020.\n element.className = 'blocklyMenu goog-menu blocklyNonSelectable';\n element.tabIndex = 0;\n if (this.roleName_) {\n aria.setRole(element, this.roleName_);\n }\n this.element_ = element;\n\n // Add menu items.\n for (let i = 0, menuItem; menuItem = this.menuItems_[i]; i++) {\n element.appendChild(menuItem.createDom());\n }\n\n // Add event handlers.\n this.mouseOverHandler_ = browserEvents.conditionalBind(\n element, 'mouseover', this, this.handleMouseOver_, true);\n this.clickHandler_ = browserEvents.conditionalBind(\n element, 'click', this, this.handleClick_, true);\n this.mouseEnterHandler_ = browserEvents.conditionalBind(\n element, 'mouseenter', this, this.handleMouseEnter_, true);\n this.mouseLeaveHandler_ = browserEvents.conditionalBind(\n element, 'mouseleave', this, this.handleMouseLeave_, true);\n this.onKeyDownHandler_ = browserEvents.conditionalBind(\n element, 'keydown', this, this.handleKeyEvent_);\n\n container.appendChild(element);\n return element;\n }\n\n /**\n * Gets the menu's element.\n *\n * @returns The DOM element.\n * @internal\n */\n getElement(): HTMLDivElement|null {\n return this.element_;\n }\n\n /**\n * Focus the menu element.\n *\n * @internal\n */\n focus() {\n const el = this.getElement();\n if (el) {\n el.focus({preventScroll: true});\n dom.addClass(el, 'blocklyFocused');\n }\n }\n\n /** Blur the menu element. */\n private blur_() {\n const el = this.getElement();\n if (el) {\n el.blur();\n dom.removeClass(el, 'blocklyFocused');\n }\n }\n\n /**\n * Set the menu accessibility role.\n *\n * @param roleName role name.\n * @internal\n */\n setRole(roleName: aria.Role) {\n this.roleName_ = roleName;\n }\n\n /** Dispose of this menu. */\n dispose() {\n // Remove event handlers.\n if (this.mouseOverHandler_) {\n browserEvents.unbind(this.mouseOverHandler_);\n this.mouseOverHandler_ = null;\n }\n if (this.clickHandler_) {\n browserEvents.unbind(this.clickHandler_);\n this.clickHandler_ = null;\n }\n if (this.mouseEnterHandler_) {\n browserEvents.unbind(this.mouseEnterHandler_);\n this.mouseEnterHandler_ = null;\n }\n if (this.mouseLeaveHandler_) {\n browserEvents.unbind(this.mouseLeaveHandler_);\n this.mouseLeaveHandler_ = null;\n }\n if (this.onKeyDownHandler_) {\n browserEvents.unbind(this.onKeyDownHandler_);\n this.onKeyDownHandler_ = null;\n }\n\n // Remove menu items.\n for (let i = 0, menuItem; menuItem = this.menuItems_[i]; i++) {\n menuItem.dispose();\n }\n this.element_ = null;\n }\n\n // Child component management.\n\n /**\n * Returns the child menu item that owns the given DOM element,\n * or null if no such menu item is found.\n *\n * @param elem DOM element whose owner is to be returned.\n * @returns Menu item for which the DOM element belongs to.\n */\n private getMenuItem_(elem: Element): MenuItem|null {\n const menuElem = this.getElement();\n // Node might be the menu border (resulting in no associated menu item), or\n // a menu item's div, or some element within the menu item.\n // Walk up parents until one meets either the menu's root element, or\n // a menu item's div.\n let currentElement: Element|null = elem;\n while (currentElement && currentElement !== menuElem) {\n if (currentElement.classList.contains('blocklyMenuItem')) {\n // Having found a menu item's div, locate that menu item in this menu.\n for (let i = 0, menuItem; menuItem = this.menuItems_[i]; i++) {\n if (menuItem.getElement() === currentElement) {\n return menuItem;\n }\n }\n }\n currentElement = currentElement.parentElement;\n }\n return null;\n }\n\n // Highlight management.\n\n /**\n * Highlights the given menu item, or clears highlighting if null.\n *\n * @param item Item to highlight, or null.\n * @internal\n */\n setHighlighted(item: MenuItem|null) {\n const currentHighlighted = this.highlightedItem_;\n if (currentHighlighted) {\n currentHighlighted.setHighlighted(false);\n this.highlightedItem_ = null;\n }\n if (item) {\n item.setHighlighted(true);\n this.highlightedItem_ = item;\n // Bring the highlighted item into view. This has no effect if the menu is\n // not scrollable.\n const el = this.getElement() as Element;\n style.scrollIntoContainerView(item.getElement() as Element, el);\n\n aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());\n }\n }\n\n /**\n * Highlights the next highlightable item (or the first if nothing is\n * currently highlighted).\n *\n * @internal\n */\n highlightNext() {\n const index = this.highlightedItem_ ?\n this.menuItems_.indexOf(this.highlightedItem_) :\n -1;\n this.highlightHelper_(index, 1);\n }\n\n /**\n * Highlights the previous highlightable item (or the last if nothing is\n * currently highlighted).\n *\n * @internal\n */\n highlightPrevious() {\n const index = this.highlightedItem_ ?\n this.menuItems_.indexOf(this.highlightedItem_) :\n -1;\n this.highlightHelper_(index < 0 ? this.menuItems_.length : index, -1);\n }\n\n /** Highlights the first highlightable item. */\n private highlightFirst_() {\n this.highlightHelper_(-1, 1);\n }\n\n /** Highlights the last highlightable item. */\n private highlightLast_() {\n this.highlightHelper_(this.menuItems_.length, -1);\n }\n\n /**\n * Helper function that manages the details of moving the highlight among\n * child menuitems in response to keyboard events.\n *\n * @param startIndex Start index.\n * @param delta Step direction: 1 to go down, -1 to go up.\n */\n private highlightHelper_(startIndex: number, delta: number) {\n let index = startIndex + delta;\n let menuItem;\n while (menuItem = this.menuItems_[index]) {\n if (menuItem.isEnabled()) {\n this.setHighlighted(menuItem);\n break;\n }\n index += delta;\n }\n }\n\n // Mouse events.\n\n /**\n * Handles mouseover events. Highlight menuitems as the user hovers over them.\n *\n * @param e Mouse event to handle.\n */\n private handleMouseOver_(e: Event) {\n const menuItem = this.getMenuItem_(e.target as Element);\n\n if (menuItem) {\n if (menuItem.isEnabled()) {\n if (this.highlightedItem_ !== menuItem) {\n this.setHighlighted(menuItem);\n }\n } else {\n this.setHighlighted(null);\n }\n }\n }\n\n /**\n * Handles click events. Pass the event onto the child menuitem to handle.\n *\n * @param e Click event to handle.\n */\n private handleClick_(e: Event) {\n const oldCoords = this.openingCoords;\n // Clear out the saved opening coords immediately so they're not used twice.\n this.openingCoords = null;\n // AnyDuringMigration because: Property 'clientX' does not exist on type\n // 'Event'.\n if (oldCoords && typeof (e as AnyDuringMigration).clientX === 'number') {\n // AnyDuringMigration because: Property 'clientY' does not exist on type\n // 'Event'. AnyDuringMigration because: Property 'clientX' does not exist\n // on type 'Event'.\n const newCoords = new Coordinate(\n (e as AnyDuringMigration).clientX, (e as AnyDuringMigration).clientY);\n if (Coordinate.distance(oldCoords, newCoords) < 1) {\n // This menu was opened by a mousedown and we're handling the consequent\n // click event. The coords haven't changed, meaning this was the same\n // opening event. Don't do the usual behavior because the menu just\n // popped up under the mouse and the user didn't mean to activate this\n // item.\n return;\n }\n }\n\n const menuItem = this.getMenuItem_(e.target as Element);\n if (menuItem) {\n menuItem.performAction();\n }\n }\n\n /**\n * Handles mouse enter events. Focus the element.\n *\n * @param _e Mouse event to handle.\n */\n private handleMouseEnter_(_e: Event) {\n this.focus();\n }\n\n /**\n * Handles mouse leave events. Blur and clear highlight.\n *\n * @param _e Mouse event to handle.\n */\n private handleMouseLeave_(_e: Event) {\n if (this.getElement()) {\n this.blur_();\n this.setHighlighted(null);\n }\n }\n\n // Keyboard events.\n\n /**\n * Attempts to handle a keyboard event, if the menu item is enabled, by\n * calling\n * {@link Menu#handleKeyEventInternal_}.\n *\n * @param e Key event to handle.\n */\n private handleKeyEvent_(e: Event) {\n if (!this.menuItems_.length) {\n // Empty menu.\n return;\n }\n // AnyDuringMigration because: Property 'altKey' does not exist on type\n // 'Event'. AnyDuringMigration because: Property 'metaKey' does not exist\n // on type 'Event'. AnyDuringMigration because: Property 'ctrlKey' does not\n // exist on type 'Event'. AnyDuringMigration because: Property 'shiftKey'\n // does not exist on type 'Event'.\n if ((e as AnyDuringMigration).shiftKey ||\n (e as AnyDuringMigration).ctrlKey ||\n (e as AnyDuringMigration).metaKey || (e as AnyDuringMigration).altKey) {\n // Do not handle the key event if any modifier key is pressed.\n return;\n }\n\n const highlighted = this.highlightedItem_;\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n switch ((e as AnyDuringMigration).keyCode) {\n case KeyCodes.ENTER:\n case KeyCodes.SPACE:\n if (highlighted) {\n highlighted.performAction();\n }\n break;\n\n case KeyCodes.UP:\n this.highlightPrevious();\n break;\n\n case KeyCodes.DOWN:\n this.highlightNext();\n break;\n\n case KeyCodes.PAGE_UP:\n case KeyCodes.HOME:\n this.highlightFirst_();\n break;\n\n case KeyCodes.PAGE_DOWN:\n case KeyCodes.END:\n this.highlightLast_();\n break;\n\n default:\n // Not a key the menu is interested in.\n return;\n }\n // The menu used this key, don't let it have secondary effects.\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * Get the size of a rendered menu.\n *\n * @returns Object with width and height properties.\n * @internal\n */\n getSize(): Size {\n const menuDom = this.getElement();\n const menuSize = style.getSize(menuDom as Element);\n // Recalculate height for the total content, not only box height.\n menuSize.height = menuDom!.scrollHeight;\n return menuSize;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Blockly menu item similar to Closure's goog.ui.MenuItem\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.MenuItem');\n\nimport * as aria from './utils/aria.js';\nimport * as dom from './utils/dom.js';\nimport * as idGenerator from './utils/idgenerator.js';\n\n\n/**\n * Class representing an item in a menu.\n *\n * @alias Blockly.MenuItem\n */\nexport class MenuItem {\n /** Is the menu item clickable, as opposed to greyed-out. */\n private enabled_ = true;\n\n /** The DOM element for the menu item. */\n private element_: HTMLDivElement|null = null;\n\n /** Whether the menu item is rendered right-to-left. */\n private rightToLeft_ = false;\n\n /** ARIA name for this menu. */\n private roleName_: aria.Role|null = null;\n\n /** Is this menu item checkable. */\n private checkable_ = false;\n\n /** Is this menu item currently checked. */\n private checked_ = false;\n\n /** Is this menu item currently highlighted. */\n private highlight_ = false;\n\n /** Bound function to call when this menu item is clicked. */\n private actionHandler_: Function|null = null;\n\n /**\n * @param content Text caption to display as the content of the item, or a\n * HTML element to display.\n * @param opt_value Data/model associated with the menu item.\n */\n constructor(\n private readonly content: string|HTMLElement,\n private readonly opt_value?: string) {}\n\n /**\n * Creates the menuitem's DOM.\n *\n * @returns Completed DOM.\n */\n createDom(): Element {\n const element = (document.createElement('div'));\n element.id = idGenerator.getNextUniqueId();\n this.element_ = element;\n\n // Set class and style\n // goog-menuitem* is deprecated, use blocklyMenuItem*. May 2020.\n element.className = 'blocklyMenuItem goog-menuitem ' +\n (this.enabled_ ? '' :\n 'blocklyMenuItemDisabled goog-menuitem-disabled ') +\n (this.checked_ ? 'blocklyMenuItemSelected goog-option-selected ' : '') +\n (this.highlight_ ? 'blocklyMenuItemHighlight goog-menuitem-highlight ' :\n '') +\n (this.rightToLeft_ ? 'blocklyMenuItemRtl goog-menuitem-rtl ' : '');\n\n const content = (document.createElement('div'));\n content.className = 'blocklyMenuItemContent goog-menuitem-content';\n // Add a checkbox for checkable menu items.\n if (this.checkable_) {\n const checkbox = (document.createElement('div'));\n checkbox.className = 'blocklyMenuItemCheckbox goog-menuitem-checkbox';\n content.appendChild(checkbox);\n }\n\n let contentDom: Node = this.content as HTMLElement;\n if (typeof this.content === 'string') {\n contentDom = document.createTextNode(this.content);\n }\n content.appendChild(contentDom);\n element.appendChild(content);\n\n // Initialize ARIA role and state.\n if (this.roleName_) {\n aria.setRole(element, this.roleName_);\n }\n aria.setState(\n element, aria.State.SELECTED,\n this.checkable_ && this.checked_ || false);\n aria.setState(element, aria.State.DISABLED, !this.enabled_);\n\n return element;\n }\n\n /** Dispose of this menu item. */\n dispose() {\n this.element_ = null;\n }\n\n /**\n * Gets the menu item's element.\n *\n * @returns The DOM element.\n * @internal\n */\n getElement(): Element|null {\n return this.element_;\n }\n\n /**\n * Gets the unique ID for this menu item.\n *\n * @returns Unique component ID.\n * @internal\n */\n getId(): string {\n return this.element_!.id;\n }\n\n /**\n * Gets the value associated with the menu item.\n *\n * @returns value Value associated with the menu item.\n * @internal\n */\n getValue(): string|null {\n return this.opt_value ?? null;\n }\n\n /**\n * Set menu item's rendering direction.\n *\n * @param rtl True if RTL, false if LTR.\n * @internal\n */\n setRightToLeft(rtl: boolean) {\n this.rightToLeft_ = rtl;\n }\n\n /**\n * Set the menu item's accessibility role.\n *\n * @param roleName Role name.\n * @internal\n */\n setRole(roleName: aria.Role) {\n this.roleName_ = roleName;\n }\n\n /**\n * Sets the menu item to be checkable or not. Set to true for menu items\n * that represent checkable options.\n *\n * @param checkable Whether the menu item is checkable.\n * @internal\n */\n setCheckable(checkable: boolean) {\n this.checkable_ = checkable;\n }\n\n /**\n * Checks or unchecks the component.\n *\n * @param checked Whether to check or uncheck the component.\n * @internal\n */\n setChecked(checked: boolean) {\n this.checked_ = checked;\n }\n\n /**\n * Highlights or unhighlights the component.\n *\n * @param highlight Whether to highlight or unhighlight the component.\n * @internal\n */\n setHighlighted(highlight: boolean) {\n this.highlight_ = highlight;\n\n const el = this.getElement();\n if (el && this.isEnabled()) {\n // goog-menuitem-highlight is deprecated, use blocklyMenuItemHighlight.\n // May 2020.\n const name = 'blocklyMenuItemHighlight';\n const nameDep = 'goog-menuitem-highlight';\n if (highlight) {\n dom.addClass(el, name);\n dom.addClass(el, nameDep);\n } else {\n dom.removeClass(el, name);\n dom.removeClass(el, nameDep);\n }\n }\n }\n\n /**\n * Returns true if the menu item is enabled, false otherwise.\n *\n * @returns Whether the menu item is enabled.\n * @internal\n */\n isEnabled(): boolean {\n return this.enabled_;\n }\n\n /**\n * Enables or disables the menu item.\n *\n * @param enabled Whether to enable or disable the menu item.\n * @internal\n */\n setEnabled(enabled: boolean) {\n this.enabled_ = enabled;\n }\n\n /**\n * Performs the appropriate action when the menu item is activated\n * by the user.\n *\n * @internal\n */\n performAction() {\n if (this.isEnabled() && this.actionHandler_) {\n this.actionHandler_(this);\n }\n }\n\n /**\n * Set the handler that's called when the menu item is activated by the user.\n * `obj` will be used as the 'this' object in the function when called.\n *\n * @param fn The handler.\n * @param obj Used as the 'this' object in fn when called.\n * @internal\n */\n onAction(fn: (p1: MenuItem) => void, obj: object) {\n this.actionHandler_ = fn.bind(obj);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of bubble open.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.BubbleOpen');\n\nimport type {AbstractEventJson} from './events_abstract.js';\nimport type {BlockSvg} from '../block_svg.js';\nimport * as registry from '../registry.js';\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a bubble open event.\n *\n * @alias Blockly.Events.BubbleOpen\n */\nexport class BubbleOpen extends UiBase {\n blockId?: string;\n isOpen?: boolean;\n bubbleType?: BubbleType;\n override type = eventUtils.BUBBLE_OPEN;\n\n /**\n * @param opt_block The associated block. Undefined for a blank event.\n * @param opt_isOpen Whether the bubble is opening (false if closing).\n * Undefined for a blank event.\n * @param opt_bubbleType The type of bubble. One of 'mutator', 'comment' or\n * 'warning'. Undefined for a blank event.\n */\n constructor(\n opt_block?: BlockSvg, opt_isOpen?: boolean, opt_bubbleType?: BubbleType) {\n const workspaceId = opt_block ? opt_block.workspace.id : undefined;\n super(workspaceId);\n if (!opt_block) return;\n\n this.blockId = opt_block.id;\n\n /** Whether the bubble is opening (false if closing). */\n this.isOpen = opt_isOpen;\n\n /** The type of bubble. One of 'mutator', 'comment', or 'warning'. */\n this.bubbleType = opt_bubbleType;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): BubbleOpenJson {\n const json = super.toJson() as BubbleOpenJson;\n if (this.isOpen === undefined) {\n throw new Error(\n 'Whether this event is for opening the bubble is ' +\n 'undefined. Either pass the value to the constructor, or call ' +\n 'fromJson');\n }\n if (!this.bubbleType) {\n throw new Error(\n 'The type of bubble is undefined. Either pass the ' +\n 'value to the constructor, or call ' +\n 'fromJson');\n }\n json['isOpen'] = this.isOpen;\n json['bubbleType'] = this.bubbleType;\n json['blockId'] = this.blockId || '';\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: BubbleOpenJson) {\n super.fromJson(json);\n this.isOpen = json['isOpen'];\n this.bubbleType = json['bubbleType'];\n this.blockId = json['blockId'];\n }\n}\n\nexport enum BubbleType {\n MUTATOR = 'mutator',\n COMMENT = 'comment',\n WARNING = 'warning',\n}\n\nexport interface BubbleOpenJson extends AbstractEventJson {\n isOpen: boolean;\n bubbleType: BubbleType;\n blockId: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.BUBBLE_OPEN, BubbleOpen);\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a scrollbar.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Scrollbar');\n\nimport * as browserEvents from './browser_events.js';\nimport * as Touch from './touch.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport type {Metrics} from './utils/metrics.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * A note on units: most of the numbers that are in CSS pixels are scaled if the\n * scrollbar is in a mutator.\n */\n\n/**\n * Class for a pure SVG scrollbar.\n * This technique offers a scrollbar that is guaranteed to work, but may not\n * look or behave like the system's scrollbars.\n *\n * @alias Blockly.Scrollbar\n */\nexport class Scrollbar {\n /**\n * Width of vertical scrollbar or height of horizontal scrollbar in CSS\n * pixels. Scrollbars should be larger on touch devices.\n */\n static scrollbarThickness = Touch.TOUCH_ENABLED ? 25 : 15;\n\n /**\n * Default margin around the scrollbar (between the scrollbar and the edge of\n * the viewport in pixels).\n *\n * @internal\n */\n static readonly DEFAULT_SCROLLBAR_MARGIN = 0.5;\n private readonly pair_: boolean;\n private readonly margin_: number;\n\n /** Previously recorded metrics from the workspace. */\n private oldHostMetrics_: Metrics|null = null;\n\n /**\n * The ratio of handle position offset to workspace content displacement.\n *\n * @internal\n */\n ratio = 1;\n private origin_: Coordinate;\n\n /**\n * The position of the mouse along this scrollbar's major axis at the start\n * of the most recent drag. Units are CSS pixels, with (0, 0) at the top\n * left of the browser window. For a horizontal scrollbar this is the x\n * coordinate of the mouse down event; for a vertical scrollbar it's the y\n * coordinate of the mouse down event.\n */\n private startDragMouse_ = 0;\n\n /**\n * The length of the scrollbars (including the handle and the background),\n * in CSS pixels. This is equivalent to scrollbar background length and the\n * area within which the scrollbar handle can move.\n */\n private scrollbarLength_ = 0;\n\n /** The length of the scrollbar handle in CSS pixels. */\n private handleLength_ = 0;\n\n /**\n * The offset of the start of the handle from the scrollbar position, in CSS\n * pixels.\n */\n private handlePosition_ = 0;\n\n private startDragHandle = 0;\n\n /** Whether the scrollbar handle is visible. */\n private isVisible_ = true;\n\n /** Whether the workspace containing this scrollbar is visible. */\n private containerVisible_ = true;\n private svgBackground_: SVGRectElement|null = null;\n\n private svgHandle_: SVGRectElement|null = null;\n\n private outerSvg_: SVGSVGElement|null = null;\n\n private svgGroup_: SVGGElement|null = null;\n position: Coordinate;\n\n lengthAttribute_ = 'width';\n positionAttribute_ = 'x';\n onMouseDownBarWrapper_: browserEvents.Data|null;\n onMouseDownHandleWrapper_: browserEvents.Data|null;\n onMouseUpWrapper_: browserEvents.Data|null = null;\n onMouseMoveWrapper_: browserEvents.Data|null = null;\n\n /**\n * @param workspace Workspace to bind the scrollbar to.\n * @param horizontal True if horizontal, false if vertical.\n * @param opt_pair True if scrollbar is part of a horiz/vert pair.\n * @param opt_class A class to be applied to this scrollbar.\n * @param opt_margin The margin to apply to this scrollbar.\n */\n constructor(\n private workspace: WorkspaceSvg, private readonly horizontal: boolean,\n opt_pair?: boolean, opt_class?: string, opt_margin?: number) {\n /** Whether this scrollbar is part of a pair. */\n this.pair_ = opt_pair || false;\n /**\n * Margin around the scrollbar (between the scrollbar and the edge of the\n * viewport in pixels).\n */\n this.margin_ = opt_margin !== undefined ?\n opt_margin :\n Scrollbar.DEFAULT_SCROLLBAR_MARGIN;\n\n /**\n * The location of the origin of the workspace that the scrollbar is in,\n * measured in CSS pixels relative to the injection div origin. This is\n * usually (0, 0). When the scrollbar is in a flyout it may have a\n * different origin.\n */\n this.origin_ = new Coordinate(0, 0);\n\n this.createDom_(opt_class);\n\n /**\n * The upper left corner of the scrollbar's SVG group in CSS pixels relative\n * to the scrollbar's origin. This is usually relative to the injection div\n * origin.\n *\n * @internal\n */\n this.position = new Coordinate(0, 0);\n\n // Store the thickness in a temp variable for readability.\n const scrollbarThickness = Scrollbar.scrollbarThickness;\n if (horizontal) {\n this.svgBackground_!.setAttribute('height', String(scrollbarThickness));\n this.outerSvg_!.setAttribute('height', String(scrollbarThickness));\n this.svgHandle_!.setAttribute('height', String(scrollbarThickness - 5));\n this.svgHandle_!.setAttribute('y', String(2.5));\n } else {\n this.svgBackground_!.setAttribute('width', String(scrollbarThickness));\n this.outerSvg_!.setAttribute('width', String(scrollbarThickness));\n this.svgHandle_!.setAttribute('width', String(scrollbarThickness - 5));\n this.svgHandle_!.setAttribute('x', String(2.5));\n\n this.lengthAttribute_ = 'height';\n this.positionAttribute_ = 'y';\n }\n this.onMouseDownBarWrapper_ = browserEvents.conditionalBind(\n this.svgBackground_!, 'mousedown', this, this.onMouseDownBar_);\n this.onMouseDownHandleWrapper_ = browserEvents.conditionalBind(\n this.svgHandle_!, 'mousedown', this, this.onMouseDownHandle_);\n }\n\n /**\n * Dispose of this scrollbar.\n * Unlink from all DOM elements to prevent memory leaks.\n *\n * @suppress {checkTypes}\n */\n dispose() {\n this.cleanUp_();\n if (this.onMouseDownBarWrapper_) {\n browserEvents.unbind(this.onMouseDownBarWrapper_);\n this.onMouseDownBarWrapper_ = null;\n }\n if (this.onMouseDownHandleWrapper_) {\n browserEvents.unbind(this.onMouseDownHandleWrapper_);\n this.onMouseDownHandleWrapper_ = null;\n }\n\n dom.removeNode(this.outerSvg_);\n this.outerSvg_ = null;\n this.svgGroup_ = null;\n this.svgBackground_ = null;\n if (this.svgHandle_) {\n this.workspace.getThemeManager().unsubscribe(this.svgHandle_);\n this.svgHandle_ = null;\n }\n }\n\n /**\n * Constrain the handle's length within the minimum (0) and maximum\n * (scrollbar background) values allowed for the scrollbar.\n *\n * @param value Value that is potentially out of bounds, in CSS pixels.\n * @returns Constrained value, in CSS pixels.\n */\n private constrainHandleLength_(value: number): number {\n if (value <= 0 || isNaN(value)) {\n value = 0;\n } else {\n value = Math.min(value, this.scrollbarLength_);\n }\n return value;\n }\n\n /**\n * Set the length of the scrollbar's handle and change the SVG attribute\n * accordingly.\n *\n * @param newLength The new scrollbar handle length in CSS pixels.\n */\n private setHandleLength_(newLength: number) {\n this.handleLength_ = newLength;\n this.svgHandle_!.setAttribute(\n this.lengthAttribute_, String(this.handleLength_));\n }\n\n /**\n * Constrain the handle's position within the minimum (0) and maximum values\n * allowed for the scrollbar.\n *\n * @param value Value that is potentially out of bounds, in CSS pixels.\n * @returns Constrained value, in CSS pixels.\n */\n private constrainHandlePosition_(value: number): number {\n if (value <= 0 || isNaN(value)) {\n value = 0;\n } else {\n // Handle length should never be greater than this.scrollbarLength_.\n // If the viewSize is greater than or equal to the scrollSize, the\n // handleLength will end up equal to this.scrollbarLength_.\n value = Math.min(value, this.scrollbarLength_ - this.handleLength_);\n }\n return value;\n }\n\n /**\n * Set the offset of the scrollbar's handle from the scrollbar's position, and\n * change the SVG attribute accordingly.\n *\n * @param newPosition The new scrollbar handle offset in CSS pixels.\n */\n setHandlePosition(newPosition: number) {\n this.handlePosition_ = newPosition;\n this.svgHandle_!.setAttribute(\n this.positionAttribute_, String(this.handlePosition_));\n }\n\n /**\n * Set the size of the scrollbar's background and change the SVG attribute\n * accordingly.\n *\n * @param newSize The new scrollbar background length in CSS pixels.\n */\n private setScrollbarLength_(newSize: number) {\n this.scrollbarLength_ = newSize;\n this.outerSvg_!.setAttribute(\n this.lengthAttribute_, String(this.scrollbarLength_));\n this.svgBackground_!.setAttribute(\n this.lengthAttribute_, String(this.scrollbarLength_));\n }\n\n /**\n * Set the position of the scrollbar's SVG group in CSS pixels relative to the\n * scrollbar's origin. This sets the scrollbar's location within the\n * workspace.\n *\n * @param x The new x coordinate.\n * @param y The new y coordinate.\n * @internal\n */\n setPosition(x: number, y: number) {\n this.position.x = x;\n this.position.y = y;\n\n const tempX = this.position.x + this.origin_.x;\n const tempY = this.position.y + this.origin_.y;\n const transform = 'translate(' + tempX + 'px,' + tempY + 'px)';\n if (this.outerSvg_) {\n dom.setCssTransform(this.outerSvg_, transform);\n }\n }\n\n /**\n * Recalculate the scrollbar's location and its length.\n *\n * @param opt_metrics A data structure of from the describing all the required\n * dimensions. If not provided, it will be fetched from the host object.\n */\n resize(opt_metrics?: Metrics) {\n // Determine the location, height and width of the host element.\n let hostMetrics = opt_metrics;\n if (!hostMetrics) {\n hostMetrics = this.workspace.getMetrics();\n if (!hostMetrics) {\n // Host element is likely not visible.\n return;\n }\n }\n\n if (this.oldHostMetrics_ &&\n Scrollbar.metricsAreEquivalent_(hostMetrics, this.oldHostMetrics_)) {\n return;\n }\n\n if (this.horizontal) {\n this.resizeHorizontal_(hostMetrics);\n } else {\n this.resizeVertical_(hostMetrics);\n }\n\n this.oldHostMetrics_ = hostMetrics;\n\n // Resizing may have caused some scrolling.\n this.updateMetrics_();\n }\n\n /**\n * Returns whether the a resizeView is necessary by comparing the passed\n * hostMetrics with cached old host metrics.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n * @returns Whether a resizeView is necessary.\n */\n private requiresViewResize_(hostMetrics: Metrics): boolean {\n if (!this.oldHostMetrics_) {\n return true;\n }\n return this.oldHostMetrics_.viewWidth !== hostMetrics.viewWidth ||\n this.oldHostMetrics_.viewHeight !== hostMetrics.viewHeight ||\n this.oldHostMetrics_.absoluteLeft !== hostMetrics.absoluteLeft ||\n this.oldHostMetrics_.absoluteTop !== hostMetrics.absoluteTop;\n }\n\n /**\n * Recalculate a horizontal scrollbar's location and length.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n private resizeHorizontal_(hostMetrics: Metrics) {\n if (this.requiresViewResize_(hostMetrics)) {\n this.resizeViewHorizontal(hostMetrics);\n } else {\n this.resizeContentHorizontal(hostMetrics);\n }\n }\n\n /**\n * Recalculate a horizontal scrollbar's location on the screen and path\n * length. This should be called when the layout or size of the window has\n * changed.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n resizeViewHorizontal(hostMetrics: Metrics) {\n let viewSize = hostMetrics.viewWidth - this.margin_ * 2;\n if (this.pair_) {\n // Shorten the scrollbar to make room for the corner square.\n viewSize -= Scrollbar.scrollbarThickness;\n }\n this.setScrollbarLength_(Math.max(0, viewSize));\n\n let xCoordinate = hostMetrics.absoluteLeft + this.margin_;\n if (this.pair_ && this.workspace.RTL) {\n xCoordinate += Scrollbar.scrollbarThickness;\n }\n\n // Horizontal toolbar should always be just above the bottom of the\n // workspace.\n const yCoordinate = hostMetrics.absoluteTop + hostMetrics.viewHeight -\n Scrollbar.scrollbarThickness - this.margin_;\n this.setPosition(xCoordinate, yCoordinate);\n\n // If the view has been resized, a content resize will also be necessary.\n // The reverse is not true.\n this.resizeContentHorizontal(hostMetrics);\n }\n\n /**\n * Recalculate a horizontal scrollbar's location within its path and length.\n * This should be called when the contents of the workspace have changed.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n resizeContentHorizontal(hostMetrics: Metrics) {\n if (hostMetrics.viewWidth >= hostMetrics.scrollWidth) {\n // viewWidth is often greater than scrollWidth in flyouts and\n // non-scrollable workspaces.\n this.setHandleLength_(this.scrollbarLength_);\n this.setHandlePosition(0);\n if (!this.pair_) {\n // The scrollbar isn't needed.\n // This doesn't apply to scrollbar pairs because interactions with the\n // corner square aren't handled.\n this.setVisible(false);\n }\n return;\n } else if (!this.pair_) {\n // The scrollbar is needed. Only non-paired scrollbars are hidden/shown.\n this.setVisible(true);\n }\n\n // Resize the handle.\n let handleLength =\n this.scrollbarLength_ * hostMetrics.viewWidth / hostMetrics.scrollWidth;\n handleLength = this.constrainHandleLength_(handleLength);\n this.setHandleLength_(handleLength);\n\n // Compute the handle offset.\n // The position of the handle can be between:\n // 0 and this.scrollbarLength_ - handleLength\n // If viewLeft === scrollLeft\n // then the offset should be 0\n // If viewRight === scrollRight\n // then viewLeft = scrollLeft + scrollWidth - viewWidth\n // then the offset should be max offset\n\n const maxScrollDistance = hostMetrics.scrollWidth - hostMetrics.viewWidth;\n const contentDisplacement = hostMetrics.viewLeft - hostMetrics.scrollLeft;\n // Percent of content to the left of our current position.\n const offsetRatio = contentDisplacement / maxScrollDistance;\n // Area available to scroll * percent to the left\n const maxHandleOffset = this.scrollbarLength_ - this.handleLength_;\n let handleOffset = maxHandleOffset * offsetRatio;\n handleOffset = this.constrainHandlePosition_(handleOffset);\n this.setHandlePosition(handleOffset);\n\n // Compute ratio (for use with set calls, which pass in content\n // displacement).\n this.ratio = maxHandleOffset / maxScrollDistance;\n }\n\n /**\n * Recalculate a vertical scrollbar's location and length.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n private resizeVertical_(hostMetrics: Metrics) {\n if (this.requiresViewResize_(hostMetrics)) {\n this.resizeViewVertical(hostMetrics);\n } else {\n this.resizeContentVertical(hostMetrics);\n }\n }\n\n /**\n * Recalculate a vertical scrollbar's location on the screen and path length.\n * This should be called when the layout or size of the window has changed.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n resizeViewVertical(hostMetrics: Metrics) {\n let viewSize = hostMetrics.viewHeight - this.margin_ * 2;\n if (this.pair_) {\n // Shorten the scrollbar to make room for the corner square.\n viewSize -= Scrollbar.scrollbarThickness;\n }\n this.setScrollbarLength_(Math.max(0, viewSize));\n\n const xCoordinate = this.workspace.RTL ?\n hostMetrics.absoluteLeft + this.margin_ :\n hostMetrics.absoluteLeft + hostMetrics.viewWidth -\n Scrollbar.scrollbarThickness - this.margin_;\n\n const yCoordinate = hostMetrics.absoluteTop + this.margin_;\n this.setPosition(xCoordinate, yCoordinate);\n\n // If the view has been resized, a content resize will also be necessary.\n // The reverse is not true.\n this.resizeContentVertical(hostMetrics);\n }\n\n /**\n * Recalculate a vertical scrollbar's location within its path and length.\n * This should be called when the contents of the workspace have changed.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n resizeContentVertical(hostMetrics: Metrics) {\n if (hostMetrics.viewHeight >= hostMetrics.scrollHeight) {\n // viewHeight is often greater than scrollHeight in flyouts and\n // non-scrollable workspaces.\n this.setHandleLength_(this.scrollbarLength_);\n this.setHandlePosition(0);\n if (!this.pair_) {\n // The scrollbar isn't needed.\n // This doesn't apply to scrollbar pairs because interactions with the\n // corner square aren't handled.\n this.setVisible(false);\n }\n return;\n } else if (!this.pair_) {\n // The scrollbar is needed. Only non-paired scrollbars are hidden/shown.\n this.setVisible(true);\n }\n\n // Resize the handle.\n let handleLength = this.scrollbarLength_ * hostMetrics.viewHeight /\n hostMetrics.scrollHeight;\n handleLength = this.constrainHandleLength_(handleLength);\n this.setHandleLength_(handleLength);\n\n // Compute the handle offset.\n // The position of the handle can be between:\n // 0 and this.scrollbarLength_ - handleLength\n // If viewTop === scrollTop\n // then the offset should be 0\n // If viewBottom === scrollBottom\n // then viewTop = scrollTop + scrollHeight - viewHeight\n // then the offset should be max offset\n\n const maxScrollDistance = hostMetrics.scrollHeight - hostMetrics.viewHeight;\n const contentDisplacement = hostMetrics.viewTop - hostMetrics.scrollTop;\n // Percent of content to the left of our current position.\n const offsetRatio = contentDisplacement / maxScrollDistance;\n // Area available to scroll * percent to the left\n const maxHandleOffset = this.scrollbarLength_ - this.handleLength_;\n let handleOffset = maxHandleOffset * offsetRatio;\n handleOffset = this.constrainHandlePosition_(handleOffset);\n this.setHandlePosition(handleOffset);\n\n // Compute ratio (for use with set calls, which pass in content\n // displacement).\n this.ratio = maxHandleOffset / maxScrollDistance;\n }\n\n /**\n * Create all the DOM elements required for a scrollbar.\n * The resulting widget is not sized.\n *\n * @param opt_class A class to be applied to this scrollbar.\n */\n private createDom_(opt_class?: string) {\n /* Create the following DOM:\n <svg class=\"blocklyScrollbarHorizontal optionalClass\">\n <g>\n <rect class=\"blocklyScrollbarBackground\" />\n <rect class=\"blocklyScrollbarHandle\" rx=\"8\" ry=\"8\" />\n </g>\n </svg>\n */\n let className =\n 'blocklyScrollbar' + (this.horizontal ? 'Horizontal' : 'Vertical');\n if (opt_class) {\n className += ' ' + opt_class;\n }\n this.outerSvg_ = dom.createSvgElement(Svg.SVG, {'class': className});\n this.svgGroup_ = dom.createSvgElement(Svg.G, {}, this.outerSvg_);\n this.svgBackground_ = dom.createSvgElement(\n Svg.RECT, {'class': 'blocklyScrollbarBackground'}, this.svgGroup_);\n const radius = Math.floor((Scrollbar.scrollbarThickness - 5) / 2);\n this.svgHandle_ = dom.createSvgElement(\n Svg.RECT,\n {'class': 'blocklyScrollbarHandle', 'rx': radius, 'ry': radius},\n this.svgGroup_);\n this.workspace.getThemeManager().subscribe(\n this.svgHandle_!, 'scrollbarColour', 'fill');\n this.workspace.getThemeManager().subscribe(\n this.svgHandle_!, 'scrollbarOpacity', 'fill-opacity');\n dom.insertAfter(this.outerSvg_!, this.workspace.getParentSvg());\n }\n\n /**\n * Is the scrollbar visible. Non-paired scrollbars disappear when they aren't\n * needed.\n *\n * @returns True if visible.\n */\n isVisible(): boolean {\n return this.isVisible_;\n }\n\n /**\n * Set whether the scrollbar's container is visible and update\n * display accordingly if visibility has changed.\n *\n * @param visible Whether the container is visible\n */\n setContainerVisible(visible: boolean) {\n const visibilityChanged = visible !== this.containerVisible_;\n\n this.containerVisible_ = visible;\n if (visibilityChanged) {\n this.updateDisplay_();\n }\n }\n\n /**\n * Set whether the scrollbar is visible.\n * Only applies to non-paired scrollbars.\n *\n * @param visible True if visible.\n */\n setVisible(visible: boolean) {\n const visibilityChanged = visible !== this.isVisible();\n\n // Ideally this would also apply to scrollbar pairs, but that's a bigger\n // headache (due to interactions with the corner square).\n if (this.pair_) {\n throw Error('Unable to toggle visibility of paired scrollbars.');\n }\n this.isVisible_ = visible;\n if (visibilityChanged) {\n this.updateDisplay_();\n }\n }\n\n /**\n * Update visibility of scrollbar based on whether it thinks it should\n * be visible and whether its containing workspace is visible.\n * We cannot rely on the containing workspace being hidden to hide us\n * because it is not necessarily our parent in the DOM.\n */\n updateDisplay_() {\n let show = true;\n // Check whether our parent/container is visible.\n if (!this.containerVisible_) {\n show = false;\n } else {\n show = this.isVisible();\n }\n if (show) {\n this.outerSvg_!.setAttribute('display', 'block');\n } else {\n this.outerSvg_!.setAttribute('display', 'none');\n }\n }\n\n /**\n * Scroll by one pageful.\n * Called when scrollbar background is clicked.\n *\n * @param e Mouse down event.\n */\n private onMouseDownBar_(e: MouseEvent) {\n this.workspace.markFocused();\n Touch.clearTouchIdentifier(); // This is really a click.\n this.cleanUp_();\n if (browserEvents.isRightButton(e)) {\n // Right-click.\n // Scrollbars have no context menu.\n e.stopPropagation();\n return;\n }\n const mouseXY = browserEvents.mouseToSvg(\n e, this.workspace.getParentSvg(), this.workspace.getInverseScreenCTM());\n const mouseLocation = this.horizontal ? mouseXY.x : mouseXY.y;\n\n const handleXY = svgMath.getInjectionDivXY(this.svgHandle_ as Element);\n const handleStart = this.horizontal ? handleXY.x : handleXY.y;\n let handlePosition = this.handlePosition_;\n\n const pageLength = this.handleLength_ * 0.95;\n if (mouseLocation <= handleStart) {\n // Decrease the scrollbar's value by a page.\n handlePosition -= pageLength;\n } else if (mouseLocation >= handleStart + this.handleLength_) {\n // Increase the scrollbar's value by a page.\n handlePosition += pageLength;\n }\n\n this.setHandlePosition(this.constrainHandlePosition_(handlePosition));\n\n this.updateMetrics_();\n e.stopPropagation();\n e.preventDefault();\n }\n\n /**\n * Start a dragging operation.\n * Called when scrollbar handle is clicked.\n *\n * @param e Mouse down event.\n */\n private onMouseDownHandle_(e: MouseEvent) {\n this.workspace.markFocused();\n this.cleanUp_();\n if (browserEvents.isRightButton(e)) {\n // Right-click.\n // Scrollbars have no context menu.\n e.stopPropagation();\n return;\n }\n // Look up the current translation and record it.\n this.startDragHandle = this.handlePosition_;\n\n // Tell the workspace to setup its drag surface since it is about to move.\n // onMouseMoveHandle will call onScroll which actually tells the workspace\n // to move.\n this.workspace.setupDragSurface();\n\n // Record the current mouse position.\n this.startDragMouse_ = this.horizontal ? e.clientX : e.clientY;\n this.onMouseUpWrapper_ = browserEvents.conditionalBind(\n document, 'mouseup', this, this.onMouseUpHandle_);\n this.onMouseMoveWrapper_ = browserEvents.conditionalBind(\n document, 'mousemove', this, this.onMouseMoveHandle_);\n e.stopPropagation();\n e.preventDefault();\n }\n\n /**\n * Drag the scrollbar's handle.\n *\n * @param e Mouse move event.\n */\n private onMouseMoveHandle_(e: MouseEvent) {\n const currentMouse = this.horizontal ? e.clientX : e.clientY;\n const mouseDelta = currentMouse - this.startDragMouse_;\n const handlePosition = this.startDragHandle + mouseDelta;\n // Position the bar.\n this.setHandlePosition(this.constrainHandlePosition_(handlePosition));\n this.updateMetrics_();\n }\n\n /** Release the scrollbar handle and reset state accordingly. */\n private onMouseUpHandle_() {\n // Tell the workspace to clean up now that the workspace is done moving.\n this.workspace.resetDragSurface();\n Touch.clearTouchIdentifier();\n this.cleanUp_();\n }\n\n /**\n * Hide chaff and stop binding to mouseup and mousemove events. Call this to\n * wrap up loose ends associated with the scrollbar.\n */\n private cleanUp_() {\n this.workspace.hideChaff(true);\n if (this.onMouseUpWrapper_) {\n browserEvents.unbind(this.onMouseUpWrapper_);\n this.onMouseUpWrapper_ = null;\n }\n if (this.onMouseMoveWrapper_) {\n browserEvents.unbind(this.onMouseMoveWrapper_);\n this.onMouseMoveWrapper_ = null;\n }\n }\n\n /**\n * Helper to calculate the ratio of handle position to scrollbar view size.\n *\n * @returns Ratio.\n * @internal\n */\n getRatio_(): number {\n const scrollHandleRange = this.scrollbarLength_ - this.handleLength_;\n let ratio = this.handlePosition_ / scrollHandleRange;\n if (isNaN(ratio)) {\n ratio = 0;\n }\n return ratio;\n }\n\n /**\n * Updates workspace metrics based on new scroll ratio. Called when scrollbar\n * is moved.\n */\n private updateMetrics_() {\n const ratio = this.getRatio_();\n if (this.horizontal) {\n this.workspace.setMetrics({x: ratio});\n } else {\n this.workspace.setMetrics({y: ratio});\n }\n }\n\n /**\n * Set the scrollbar handle's position.\n *\n * @param value The content displacement, relative to the view in pixels.\n * @param updateMetrics Whether to update metrics on this set call.\n * Defaults to true.\n */\n set(value: number, updateMetrics?: boolean) {\n this.setHandlePosition(this.constrainHandlePosition_(value * this.ratio));\n if (updateMetrics || updateMetrics === undefined) {\n this.updateMetrics_();\n }\n }\n\n /**\n * Record the origin of the workspace that the scrollbar is in, in pixels\n * relative to the injection div origin. This is for times when the scrollbar\n * is used in an object whose origin isn't the same as the main workspace\n * (e.g. in a flyout.)\n *\n * @param x The x coordinate of the scrollbar's origin, in CSS pixels.\n * @param y The y coordinate of the scrollbar's origin, in CSS pixels.\n */\n setOrigin(x: number, y: number) {\n this.origin_ = new Coordinate(x, y);\n }\n\n /**\n * @param first An object containing computed measurements of a workspace.\n * @param second Another object containing computed measurements of a\n * workspace.\n * @returns Whether the two sets of metrics are equivalent.\n */\n private static metricsAreEquivalent_(first: Metrics, second: Metrics):\n boolean {\n return first.viewWidth === second.viewWidth &&\n first.viewHeight === second.viewHeight &&\n first.viewLeft === second.viewLeft &&\n first.viewTop === second.viewTop &&\n first.absoluteTop === second.absoluteTop &&\n first.absoluteLeft === second.absoluteLeft &&\n first.scrollWidth === second.scrollWidth &&\n first.scrollHeight === second.scrollHeight &&\n first.scrollLeft === second.scrollLeft &&\n first.scrollTop === second.scrollTop;\n }\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a UI bubble.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Bubble');\n\nimport type {BlockDragSurfaceSvg} from './block_drag_surface.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport type {IBubble} from './interfaces/i_bubble.js';\nimport type {ContainerRegion} from './metrics_manager.js';\nimport {Scrollbar} from './scrollbar.js';\nimport * as Touch from './touch.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport * as math from './utils/math.js';\nimport {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\nimport * as userAgent from './utils/useragent.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for UI bubble.\n *\n * @alias Blockly.Bubble\n */\nexport class Bubble implements IBubble {\n /** Width of the border around the bubble. */\n static BORDER_WIDTH = 6;\n\n /**\n * Determines the thickness of the base of the arrow in relation to the size\n * of the bubble. Higher numbers result in thinner arrows.\n */\n static ARROW_THICKNESS = 5;\n\n /** The number of degrees that the arrow bends counter-clockwise. */\n static ARROW_ANGLE = 20;\n\n /**\n * The sharpness of the arrow's bend. Higher numbers result in smoother\n * arrows.\n */\n static ARROW_BEND = 4;\n\n /** Distance between arrow point and anchor point. */\n static ANCHOR_RADIUS = 8;\n\n /** Mouse up event data. */\n private static onMouseUpWrapper_: browserEvents.Data|null = null;\n\n /** Mouse move event data. */\n private static onMouseMoveWrapper_: browserEvents.Data|null = null;\n workspace_: WorkspaceSvg;\n content_: SVGElement;\n shape_: SVGElement;\n\n /** Flag to stop incremental rendering during construction. */\n private readonly rendered_: boolean;\n\n /** The SVG group containing all parts of the bubble. */\n private bubbleGroup_: SVGGElement|null = null;\n\n /**\n * The SVG path for the arrow from the bubble to the icon on the block.\n */\n private bubbleArrow_: SVGPathElement|null = null;\n\n /** The SVG rect for the main body of the bubble. */\n private bubbleBack_: SVGRectElement|null = null;\n\n /** The SVG group for the resize hash marks on some bubbles. */\n private resizeGroup_: SVGGElement|null = null;\n\n /** Absolute coordinate of anchor point, in workspace coordinates. */\n private anchorXY_!: Coordinate;\n\n /**\n * Relative X coordinate of bubble with respect to the anchor's centre,\n * in workspace units.\n * In RTL mode the initial value is negated.\n */\n private relativeLeft_ = 0;\n\n /**\n * Relative Y coordinate of bubble with respect to the anchor's centre, in\n * workspace units.\n */\n private relativeTop_ = 0;\n\n /** Width of bubble, in workspace units. */\n private width_ = 0;\n\n /** Height of bubble, in workspace units. */\n private height_ = 0;\n\n /** Automatically position and reposition the bubble. */\n private autoLayout_ = true;\n\n /** Method to call on resize of bubble. */\n private resizeCallback_: (() => void)|null = null;\n\n /** Method to call on move of bubble. */\n private moveCallback_: (() => void)|null = null;\n\n /** Mouse down on bubbleBack_ event data. */\n private onMouseDownBubbleWrapper_: browserEvents.Data|null = null;\n\n /** Mouse down on resizeGroup_ event data. */\n private onMouseDownResizeWrapper_: browserEvents.Data|null = null;\n\n /**\n * Describes whether this bubble has been disposed of (nodes and event\n * listeners removed from the page) or not.\n *\n * @internal\n */\n disposed = false;\n private arrow_radians_: number;\n\n /**\n * @param workspace The workspace on which to draw the bubble.\n * @param content SVG content for the bubble.\n * @param shape SVG element to avoid eclipsing.\n * @param anchorXY Absolute position of bubble's anchor point.\n * @param bubbleWidth Width of bubble, or null if not resizable.\n * @param bubbleHeight Height of bubble, or null if not resizable.\n */\n constructor(\n workspace: WorkspaceSvg, content: SVGElement, shape: SVGElement,\n anchorXY: Coordinate, bubbleWidth: number|null,\n bubbleHeight: number|null) {\n this.rendered_ = false;\n this.workspace_ = workspace;\n this.content_ = content;\n this.shape_ = shape;\n\n let angle = Bubble.ARROW_ANGLE;\n if (this.workspace_.RTL) {\n angle = -angle;\n }\n this.arrow_radians_ = math.toRadians(angle);\n\n const canvas = workspace.getBubbleCanvas();\n canvas.appendChild(\n this.createDom_(content, !!(bubbleWidth && bubbleHeight)));\n\n this.setAnchorLocation(anchorXY);\n if (!bubbleWidth || !bubbleHeight) {\n const bBox = (this.content_ as SVGGraphicsElement).getBBox();\n bubbleWidth = bBox.width + 2 * Bubble.BORDER_WIDTH;\n bubbleHeight = bBox.height + 2 * Bubble.BORDER_WIDTH;\n }\n this.setBubbleSize(bubbleWidth, bubbleHeight);\n\n // Render the bubble.\n this.positionBubble_();\n this.renderArrow_();\n this.rendered_ = true;\n }\n\n /**\n * Create the bubble's DOM.\n *\n * @param content SVG content for the bubble.\n * @param hasResize Add diagonal resize gripper if true.\n * @returns The bubble's SVG group.\n */\n private createDom_(content: Element, hasResize: boolean): SVGElement {\n /* Create the bubble. Here's the markup that will be generated:\n <g>\n <g filter=\"url(#blocklyEmbossFilter837493)\">\n <path d=\"... Z\" />\n <rect class=\"blocklyDraggable\" rx=\"8\" ry=\"8\" width=\"180\"\n height=\"180\"/>\n </g>\n <g transform=\"translate(165, 165)\" class=\"blocklyResizeSE\">\n <polygon points=\"0,15 15,15 15,0\"/>\n <line class=\"blocklyResizeLine\" x1=\"5\" y1=\"14\" x2=\"14\" y2=\"5\"/>\n <line class=\"blocklyResizeLine\" x1=\"10\" y1=\"14\" x2=\"14\" y2=\"10\"/>\n </g>\n [...content goes here...]\n </g>\n */\n this.bubbleGroup_ = dom.createSvgElement(Svg.G, {});\n let filter: {filter?: string} = {\n 'filter': 'url(#' +\n this.workspace_.getRenderer().getConstants().embossFilterId + ')',\n };\n if (userAgent.JavaFx) {\n // Multiple reports that JavaFX can't handle filters.\n // https://github.com/google/blockly/issues/99\n filter = {};\n }\n const bubbleEmboss = dom.createSvgElement(Svg.G, filter, this.bubbleGroup_);\n this.bubbleArrow_ = dom.createSvgElement(Svg.PATH, {}, bubbleEmboss);\n this.bubbleBack_ = dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blocklyDraggable',\n 'x': 0,\n 'y': 0,\n 'rx': Bubble.BORDER_WIDTH,\n 'ry': Bubble.BORDER_WIDTH,\n },\n bubbleEmboss);\n if (hasResize) {\n this.resizeGroup_ = dom.createSvgElement(\n Svg.G, {\n 'class': this.workspace_.RTL ? 'blocklyResizeSW' :\n 'blocklyResizeSE',\n },\n this.bubbleGroup_);\n const resizeSize = 2 * Bubble.BORDER_WIDTH;\n dom.createSvgElement(\n Svg.POLYGON,\n {'points': '0,x x,x x,0'.replace(/x/g, resizeSize.toString())},\n this.resizeGroup_);\n dom.createSvgElement(\n Svg.LINE, {\n 'class': 'blocklyResizeLine',\n 'x1': resizeSize / 3,\n 'y1': resizeSize - 1,\n 'x2': resizeSize - 1,\n 'y2': resizeSize / 3,\n },\n this.resizeGroup_);\n dom.createSvgElement(\n Svg.LINE, {\n 'class': 'blocklyResizeLine',\n 'x1': resizeSize * 2 / 3,\n 'y1': resizeSize - 1,\n 'x2': resizeSize - 1,\n 'y2': resizeSize * 2 / 3,\n },\n this.resizeGroup_);\n } else {\n this.resizeGroup_ = null;\n }\n\n if (!this.workspace_.options.readOnly) {\n this.onMouseDownBubbleWrapper_ = browserEvents.conditionalBind(\n this.bubbleBack_, 'mousedown', this, this.bubbleMouseDown_);\n if (this.resizeGroup_) {\n this.onMouseDownResizeWrapper_ = browserEvents.conditionalBind(\n this.resizeGroup_, 'mousedown', this, this.resizeMouseDown_);\n }\n }\n this.bubbleGroup_.appendChild(content);\n return this.bubbleGroup_;\n }\n\n /**\n * Return the root node of the bubble's SVG group.\n *\n * @returns The root SVG node of the bubble's group.\n */\n getSvgRoot(): SVGElement {\n return this.bubbleGroup_ as SVGElement;\n }\n\n /**\n * Expose the block's ID on the bubble's top-level SVG group.\n *\n * @param id ID of block.\n */\n setSvgId(id: string) {\n this.bubbleGroup_?.setAttribute('data-block-id', id);\n }\n\n /**\n * Handle a mouse-down on bubble's border.\n *\n * @param e Mouse down event.\n */\n private bubbleMouseDown_(e: Event) {\n const gesture = this.workspace_.getGesture(e);\n if (gesture) {\n gesture.handleBubbleStart(e, this);\n }\n }\n\n /**\n * Show the context menu for this bubble.\n *\n * @param _e Mouse event.\n * @internal\n */\n showContextMenu(_e: Event) {}\n // NOP on bubbles, but used by the bubble dragger to pass events to\n // workspace comments.\n\n /**\n * Get whether this bubble is deletable or not.\n *\n * @returns True if deletable.\n * @internal\n */\n isDeletable(): boolean {\n return false;\n }\n\n /**\n * Update the style of this bubble when it is dragged over a delete area.\n *\n * @param _enable True if the bubble is about to be deleted, false otherwise.\n */\n setDeleteStyle(_enable: boolean) {}\n // NOP if bubble is not deletable.\n\n /**\n * Handle a mouse-down on bubble's resize corner.\n *\n * @param e Mouse down event.\n */\n private resizeMouseDown_(e: MouseEvent) {\n this.promote();\n Bubble.unbindDragEvents_();\n if (browserEvents.isRightButton(e)) {\n // No right-click.\n e.stopPropagation();\n return;\n }\n // Left-click (or middle click)\n this.workspace_.startDrag(\n e,\n new Coordinate(\n this.workspace_.RTL ? -this.width_ : this.width_, this.height_));\n\n Bubble.onMouseUpWrapper_ = browserEvents.conditionalBind(\n document, 'mouseup', this, Bubble.bubbleMouseUp_);\n Bubble.onMouseMoveWrapper_ = browserEvents.conditionalBind(\n document, 'mousemove', this, this.resizeMouseMove_);\n this.workspace_.hideChaff();\n // This event has been handled. No need to bubble up to the document.\n e.stopPropagation();\n }\n\n /**\n * Resize this bubble to follow the mouse.\n *\n * @param e Mouse move event.\n */\n private resizeMouseMove_(e: MouseEvent) {\n this.autoLayout_ = false;\n const newXY = this.workspace_.moveDrag(e);\n this.setBubbleSize(this.workspace_.RTL ? -newXY.x : newXY.x, newXY.y);\n if (this.workspace_.RTL) {\n // RTL requires the bubble to move its left edge.\n this.positionBubble_();\n }\n }\n\n /**\n * Register a function as a callback event for when the bubble is resized.\n *\n * @param callback The function to call on resize.\n */\n registerResizeEvent(callback: () => void) {\n this.resizeCallback_ = callback;\n }\n\n /**\n * Register a function as a callback event for when the bubble is moved.\n *\n * @param callback The function to call on move.\n */\n registerMoveEvent(callback: () => void) {\n this.moveCallback_ = callback;\n }\n\n /**\n * Move this bubble to the top of the stack.\n *\n * @returns Whether or not the bubble has been moved.\n * @internal\n */\n promote(): boolean {\n const svgGroup = this.bubbleGroup_?.parentNode;\n if (svgGroup?.lastChild !== this.bubbleGroup_ && this.bubbleGroup_) {\n svgGroup?.appendChild(this.bubbleGroup_);\n return true;\n }\n return false;\n }\n\n /**\n * Notification that the anchor has moved.\n * Update the arrow and bubble accordingly.\n *\n * @param xy Absolute location.\n */\n setAnchorLocation(xy: Coordinate) {\n this.anchorXY_ = xy;\n if (this.rendered_) {\n this.positionBubble_();\n }\n }\n\n /** Position the bubble so that it does not fall off-screen. */\n private layoutBubble_() {\n // Get the metrics in workspace units.\n const viewMetrics =\n this.workspace_.getMetricsManager().getViewMetrics(true);\n\n const optimalLeft = this.getOptimalRelativeLeft_(viewMetrics);\n const optimalTop = this.getOptimalRelativeTop_(viewMetrics);\n const bbox = (this.shape_ as SVGGraphicsElement).getBBox();\n\n const topPosition = {\n x: optimalLeft,\n y: -this.height_ -\n this.workspace_.getRenderer().getConstants().MIN_BLOCK_HEIGHT as\n number,\n };\n const startPosition = {x: -this.width_ - 30, y: optimalTop};\n const endPosition = {x: bbox.width, y: optimalTop};\n const bottomPosition = {x: optimalLeft, y: bbox.height};\n\n const closerPosition =\n bbox.width < bbox.height ? endPosition : bottomPosition;\n const fartherPosition =\n bbox.width < bbox.height ? bottomPosition : endPosition;\n\n const topPositionOverlap = this.getOverlap_(topPosition, viewMetrics);\n const startPositionOverlap = this.getOverlap_(startPosition, viewMetrics);\n const closerPositionOverlap = this.getOverlap_(closerPosition, viewMetrics);\n const fartherPositionOverlap =\n this.getOverlap_(fartherPosition, viewMetrics);\n\n // Set the position to whichever position shows the most of the bubble,\n // with tiebreaks going in the order: top > start > close > far.\n const mostOverlap = Math.max(\n topPositionOverlap, startPositionOverlap, closerPositionOverlap,\n fartherPositionOverlap);\n if (topPositionOverlap === mostOverlap) {\n this.relativeLeft_ = topPosition.x;\n this.relativeTop_ = topPosition.y;\n return;\n }\n if (startPositionOverlap === mostOverlap) {\n this.relativeLeft_ = startPosition.x;\n this.relativeTop_ = startPosition.y;\n return;\n }\n if (closerPositionOverlap === mostOverlap) {\n this.relativeLeft_ = closerPosition.x;\n this.relativeTop_ = closerPosition.y;\n return;\n }\n // TODO: I believe relativeLeft_ should actually be called relativeStart_\n // and then the math should be fixed to reflect this. (hopefully it'll\n // make it look simpler)\n this.relativeLeft_ = fartherPosition.x;\n this.relativeTop_ = fartherPosition.y;\n }\n\n /**\n * Calculate the what percentage of the bubble overlaps with the visible\n * workspace (what percentage of the bubble is visible).\n *\n * @param relativeMin The position of the top-left corner of the bubble\n * relative to the anchor point.\n * @param viewMetrics The view metrics of the workspace the bubble will appear\n * in.\n * @returns The percentage of the bubble that is visible.\n */\n private getOverlap_(\n relativeMin: {x: number, y: number},\n viewMetrics: ContainerRegion): number {\n // The position of the top-left corner of the bubble in workspace units.\n const bubbleMin = {\n x: this.workspace_.RTL ? this.anchorXY_.x - relativeMin.x - this.width_ :\n relativeMin.x + this.anchorXY_.x,\n y: relativeMin.y + this.anchorXY_.y,\n };\n // The position of the bottom-right corner of the bubble in workspace units.\n const bubbleMax = {\n x: bubbleMin.x + this.width_,\n y: bubbleMin.y + this.height_,\n };\n\n // We could adjust these values to account for the scrollbars, but the\n // bubbles should have been adjusted to not collide with them anyway, so\n // giving the workspace a slightly larger \"bounding box\" shouldn't affect\n // the calculation.\n\n // The position of the top-left corner of the workspace.\n const workspaceMin = {x: viewMetrics.left, y: viewMetrics.top};\n // The position of the bottom-right corner of the workspace.\n const workspaceMax = {\n x: viewMetrics.left + viewMetrics.width,\n y: viewMetrics.top + viewMetrics.height,\n };\n\n const overlapWidth = Math.min(bubbleMax.x, workspaceMax.x) -\n Math.max(bubbleMin.x, workspaceMin.x);\n const overlapHeight = Math.min(bubbleMax.y, workspaceMax.y) -\n Math.max(bubbleMin.y, workspaceMin.y);\n return Math.max(\n 0,\n Math.min(\n 1, overlapWidth * overlapHeight / (this.width_ * this.height_)));\n }\n\n /**\n * Calculate what the optimal horizontal position of the top-left corner of\n * the bubble is (relative to the anchor point) so that the most area of the\n * bubble is shown.\n *\n * @param viewMetrics The view metrics of the workspace the bubble will appear\n * in.\n * @returns The optimal horizontal position of the top-left corner of the\n * bubble.\n */\n private getOptimalRelativeLeft_(viewMetrics: ContainerRegion): number {\n let relativeLeft = -this.width_ / 4;\n\n // No amount of sliding left or right will give us a better overlap.\n if (this.width_ > viewMetrics.width) {\n return relativeLeft;\n }\n\n if (this.workspace_.RTL) {\n // Bubble coordinates are flipped in RTL.\n const bubbleRight = this.anchorXY_.x - relativeLeft;\n const bubbleLeft = bubbleRight - this.width_;\n\n const workspaceRight = viewMetrics.left + viewMetrics.width;\n const workspaceLeft = viewMetrics.left +\n // Thickness in workspace units.\n Scrollbar.scrollbarThickness / this.workspace_.scale;\n\n if (bubbleLeft < workspaceLeft) {\n // Slide the bubble right until it is onscreen.\n relativeLeft = -(workspaceLeft - this.anchorXY_.x + this.width_);\n } else if (bubbleRight > workspaceRight) {\n // Slide the bubble left until it is onscreen.\n relativeLeft = -(workspaceRight - this.anchorXY_.x);\n }\n } else {\n const bubbleLeft = relativeLeft + this.anchorXY_.x;\n const bubbleRight = bubbleLeft + this.width_;\n\n const workspaceLeft = viewMetrics.left;\n const workspaceRight = viewMetrics.left + viewMetrics.width -\n // Thickness in workspace units.\n Scrollbar.scrollbarThickness / this.workspace_.scale;\n\n if (bubbleLeft < workspaceLeft) {\n // Slide the bubble right until it is onscreen.\n relativeLeft = workspaceLeft - this.anchorXY_.x;\n } else if (bubbleRight > workspaceRight) {\n // Slide the bubble left until it is onscreen.\n relativeLeft = workspaceRight - this.anchorXY_.x - this.width_;\n }\n }\n\n return relativeLeft;\n }\n\n /**\n * Calculate what the optimal vertical position of the top-left corner of\n * the bubble is (relative to the anchor point) so that the most area of the\n * bubble is shown.\n *\n * @param viewMetrics The view metrics of the workspace the bubble will appear\n * in.\n * @returns The optimal vertical position of the top-left corner of the\n * bubble.\n */\n private getOptimalRelativeTop_(viewMetrics: ContainerRegion): number {\n let relativeTop = -this.height_ / 4;\n\n // No amount of sliding up or down will give us a better overlap.\n if (this.height_ > viewMetrics.height) {\n return relativeTop;\n }\n\n const bubbleTop = this.anchorXY_.y + relativeTop;\n const bubbleBottom = bubbleTop + this.height_;\n const workspaceTop = viewMetrics.top;\n const workspaceBottom = viewMetrics.top +\n viewMetrics.height - // Thickness in workspace units.\n Scrollbar.scrollbarThickness / this.workspace_.scale;\n\n const anchorY = this.anchorXY_.y;\n if (bubbleTop < workspaceTop) {\n // Slide the bubble down until it is onscreen.\n relativeTop = workspaceTop - anchorY;\n } else if (bubbleBottom > workspaceBottom) {\n // Slide the bubble up until it is onscreen.\n relativeTop = workspaceBottom - anchorY - this.height_;\n }\n\n return relativeTop;\n }\n\n /** Move the bubble to a location relative to the anchor's centre. */\n private positionBubble_() {\n let left = this.anchorXY_.x;\n if (this.workspace_.RTL) {\n left -= this.relativeLeft_ + this.width_;\n } else {\n left += this.relativeLeft_;\n }\n const top = this.relativeTop_ + this.anchorXY_.y;\n this.moveTo(left, top);\n }\n\n /**\n * Move the bubble group to the specified location in workspace coordinates.\n *\n * @param x The x position to move to.\n * @param y The y position to move to.\n * @internal\n */\n moveTo(x: number, y: number) {\n this.bubbleGroup_?.setAttribute(\n 'transform', 'translate(' + x + ',' + y + ')');\n }\n\n /**\n * Triggers a move callback if one exists at the end of a drag.\n *\n * @param adding True if adding, false if removing.\n * @internal\n */\n setDragging(adding: boolean) {\n if (!adding && this.moveCallback_) {\n this.moveCallback_();\n }\n }\n\n /**\n * Get the dimensions of this bubble.\n *\n * @returns The height and width of the bubble.\n */\n getBubbleSize(): Size {\n return new Size(this.width_, this.height_);\n }\n\n /**\n * Size this bubble.\n *\n * @param width Width of the bubble.\n * @param height Height of the bubble.\n */\n setBubbleSize(width: number, height: number) {\n const doubleBorderWidth = 2 * Bubble.BORDER_WIDTH;\n // Minimum size of a bubble.\n width = Math.max(width, doubleBorderWidth + 45);\n height = Math.max(height, doubleBorderWidth + 20);\n this.width_ = width;\n this.height_ = height;\n this.bubbleBack_?.setAttribute('width', width.toString());\n this.bubbleBack_?.setAttribute('height', height.toString());\n if (this.resizeGroup_) {\n if (this.workspace_.RTL) {\n // Mirror the resize group.\n const resizeSize = 2 * Bubble.BORDER_WIDTH;\n this.resizeGroup_.setAttribute(\n 'transform',\n 'translate(' + resizeSize + ',' + (height - doubleBorderWidth) +\n ') scale(-1 1)');\n } else {\n this.resizeGroup_.setAttribute(\n 'transform',\n 'translate(' + (width - doubleBorderWidth) + ',' +\n (height - doubleBorderWidth) + ')');\n }\n }\n if (this.autoLayout_) {\n this.layoutBubble_();\n }\n this.positionBubble_();\n this.renderArrow_();\n\n // Allow the contents to resize.\n if (this.resizeCallback_) {\n this.resizeCallback_();\n }\n }\n\n /** Draw the arrow between the bubble and the origin. */\n private renderArrow_() {\n const steps = [];\n // Find the relative coordinates of the center of the bubble.\n const relBubbleX = this.width_ / 2;\n const relBubbleY = this.height_ / 2;\n // Find the relative coordinates of the center of the anchor.\n let relAnchorX = -this.relativeLeft_;\n let relAnchorY = -this.relativeTop_;\n if (relBubbleX === relAnchorX && relBubbleY === relAnchorY) {\n // Null case. Bubble is directly on top of the anchor.\n // Short circuit this rather than wade through divide by zeros.\n steps.push('M ' + relBubbleX + ',' + relBubbleY);\n } else {\n // Compute the angle of the arrow's line.\n const rise = relAnchorY - relBubbleY;\n let run = relAnchorX - relBubbleX;\n if (this.workspace_.RTL) {\n run *= -1;\n }\n const hypotenuse = Math.sqrt(rise * rise + run * run);\n let angle = Math.acos(run / hypotenuse);\n if (rise < 0) {\n angle = 2 * Math.PI - angle;\n }\n // Compute a line perpendicular to the arrow.\n let rightAngle = angle + Math.PI / 2;\n if (rightAngle > Math.PI * 2) {\n rightAngle -= Math.PI * 2;\n }\n const rightRise = Math.sin(rightAngle);\n const rightRun = Math.cos(rightAngle);\n\n // Calculate the thickness of the base of the arrow.\n const bubbleSize = this.getBubbleSize();\n let thickness =\n (bubbleSize.width + bubbleSize.height) / Bubble.ARROW_THICKNESS;\n thickness = Math.min(thickness, bubbleSize.width, bubbleSize.height) / 4;\n\n // Back the tip of the arrow off of the anchor.\n const backoffRatio = 1 - Bubble.ANCHOR_RADIUS / hypotenuse;\n relAnchorX = relBubbleX + backoffRatio * run;\n relAnchorY = relBubbleY + backoffRatio * rise;\n\n // Coordinates for the base of the arrow.\n const baseX1 = relBubbleX + thickness * rightRun;\n const baseY1 = relBubbleY + thickness * rightRise;\n const baseX2 = relBubbleX - thickness * rightRun;\n const baseY2 = relBubbleY - thickness * rightRise;\n\n // Distortion to curve the arrow.\n let swirlAngle = angle + this.arrow_radians_;\n if (swirlAngle > Math.PI * 2) {\n swirlAngle -= Math.PI * 2;\n }\n const swirlRise = Math.sin(swirlAngle) * hypotenuse / Bubble.ARROW_BEND;\n const swirlRun = Math.cos(swirlAngle) * hypotenuse / Bubble.ARROW_BEND;\n\n steps.push('M' + baseX1 + ',' + baseY1);\n steps.push(\n 'C' + (baseX1 + swirlRun) + ',' + (baseY1 + swirlRise) + ' ' +\n relAnchorX + ',' + relAnchorY + ' ' + relAnchorX + ',' + relAnchorY);\n steps.push(\n 'C' + relAnchorX + ',' + relAnchorY + ' ' + (baseX2 + swirlRun) +\n ',' + (baseY2 + swirlRise) + ' ' + baseX2 + ',' + baseY2);\n }\n steps.push('z');\n this.bubbleArrow_?.setAttribute('d', steps.join(' '));\n }\n\n /**\n * Change the colour of a bubble.\n *\n * @param hexColour Hex code of colour.\n */\n setColour(hexColour: string) {\n this.bubbleBack_?.setAttribute('fill', hexColour);\n this.bubbleArrow_?.setAttribute('fill', hexColour);\n }\n\n /** Dispose of this bubble. */\n dispose() {\n if (this.onMouseDownBubbleWrapper_) {\n browserEvents.unbind(this.onMouseDownBubbleWrapper_);\n }\n if (this.onMouseDownResizeWrapper_) {\n browserEvents.unbind(this.onMouseDownResizeWrapper_);\n }\n Bubble.unbindDragEvents_();\n dom.removeNode(this.bubbleGroup_);\n this.disposed = true;\n }\n\n /**\n * Move this bubble during a drag, taking into account whether or not there is\n * a drag surface.\n *\n * @param dragSurface The surface that carries rendered items during a drag,\n * or null if no drag surface is in use.\n * @param newLoc The location to translate to, in workspace coordinates.\n * @internal\n */\n moveDuringDrag(dragSurface: BlockDragSurfaceSvg, newLoc: Coordinate) {\n if (dragSurface) {\n dragSurface.translateSurface(newLoc.x, newLoc.y);\n } else {\n this.moveTo(newLoc.x, newLoc.y);\n }\n if (this.workspace_.RTL) {\n this.relativeLeft_ = this.anchorXY_.x - newLoc.x - this.width_;\n } else {\n this.relativeLeft_ = newLoc.x - this.anchorXY_.x;\n }\n this.relativeTop_ = newLoc.y - this.anchorXY_.y;\n this.renderArrow_();\n }\n\n /**\n * Return the coordinates of the top-left corner of this bubble's body\n * relative to the drawing surface's origin (0,0), in workspace units.\n *\n * @returns Object with .x and .y properties.\n */\n getRelativeToSurfaceXY(): Coordinate {\n return new Coordinate(\n this.workspace_.RTL ?\n -this.relativeLeft_ + this.anchorXY_.x - this.width_ :\n this.anchorXY_.x + this.relativeLeft_,\n this.anchorXY_.y + this.relativeTop_);\n }\n\n /**\n * Set whether auto-layout of this bubble is enabled. The first time a bubble\n * is shown it positions itself to not cover any blocks. Once a user has\n * dragged it to reposition, it renders where the user put it.\n *\n * @param enable True if auto-layout should be enabled, false otherwise.\n * @internal\n */\n setAutoLayout(enable: boolean) {\n this.autoLayout_ = enable;\n }\n\n /** Stop binding to the global mouseup and mousemove events. */\n private static unbindDragEvents_() {\n if (Bubble.onMouseUpWrapper_) {\n browserEvents.unbind(Bubble.onMouseUpWrapper_);\n Bubble.onMouseUpWrapper_ = null;\n }\n if (Bubble.onMouseMoveWrapper_) {\n browserEvents.unbind(Bubble.onMouseMoveWrapper_);\n Bubble.onMouseMoveWrapper_ = null;\n }\n }\n\n /**\n * Handle a mouse-up event while dragging a bubble's border or resize handle.\n *\n * @param _e Mouse up event.\n */\n private static bubbleMouseUp_(_e: MouseEvent) {\n Touch.clearTouchIdentifier();\n Bubble.unbindDragEvents_();\n }\n\n /**\n * Create the text for a non editable bubble.\n *\n * @param text The text to display.\n * @returns The top-level node of the text.\n * @internal\n */\n static textToDom(text: string): SVGTextElement {\n const paragraph = dom.createSvgElement(Svg.TEXT, {\n 'class': 'blocklyText blocklyBubbleText blocklyNoPointerEvents',\n 'y': Bubble.BORDER_WIDTH,\n });\n const lines = text.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n const tspanElement = dom.createSvgElement(\n Svg.TSPAN, {'dy': '1em', 'x': Bubble.BORDER_WIDTH}, paragraph);\n const textNode = document.createTextNode(lines[i]);\n tspanElement.appendChild(textNode);\n }\n return paragraph;\n }\n\n /**\n * Creates a bubble that can not be edited.\n *\n * @param paragraphElement The text element for the non editable bubble.\n * @param block The block that the bubble is attached to.\n * @param iconXY The coordinate of the icon.\n * @returns The non editable bubble.\n * @internal\n */\n static createNonEditableBubble(\n paragraphElement: SVGTextElement, block: BlockSvg,\n iconXY: Coordinate): Bubble {\n const bubble = new Bubble(\n block.workspace!, paragraphElement, block.pathObject.svgPath, (iconXY),\n null, null);\n // Expose this bubble's block's ID on its top-level SVG group.\n bubble.setSvgId(block.id);\n if (block.RTL) {\n // Right-align the paragraph.\n // This cannot be done until the bubble is rendered on screen.\n const maxWidth = paragraphElement.getBBox().width;\n for (let i = 0, textElement;\n textElement = paragraphElement.childNodes[i] as SVGTSpanElement;\n i++) {\n textElement.setAttribute('text-anchor', 'end');\n textElement.setAttribute(\n 'x', (maxWidth + Bubble.BORDER_WIDTH).toString());\n }\n }\n return bubble;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * All the values that we expect developers to be able to change\n * before injecting Blockly. Changing these values during run time is not\n * generally recommended.\n *\n * @namespace Blockly.config\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.config');\n\n\n/**\n * All the values that we expect developers to be able to change\n * before injecting Blockly.\n */\ninterface Config {\n dragRadius: number;\n flyoutDragRadius: number;\n snapRadius: number;\n currentConnectionPreference: number;\n bumpDelay: number;\n connectingSnapRadius: number;\n}\n\n/** Default snap radius. */\nconst DEFAULT_SNAP_RADIUS = 28;\n\n/**\n * Object holding all the values on Blockly that we expect developers to be\n * able to change.\n */\nexport const config: Config = {\n /**\n * Number of pixels the mouse must move before a drag starts.\n *\n * @alias Blockly.config.dragRadius\n */\n dragRadius: 5,\n /**\n * Number of pixels the mouse must move before a drag/scroll starts from the\n * flyout. Because the drag-intention is determined when this is reached, it\n * is larger than dragRadius so that the drag-direction is clearer.\n *\n * @alias Blockly.config.flyoutDragRadius\n */\n flyoutDragRadius: 10,\n /**\n * Maximum misalignment between connections for them to snap together.\n *\n * @alias Blockly.config.snapRadius\n */\n snapRadius: DEFAULT_SNAP_RADIUS,\n /**\n * Maximum misalignment between connections for them to snap together.\n * This should be the same as the snap radius.\n *\n * @alias Blockly.config.connectingSnapRadius\n */\n connectingSnapRadius: DEFAULT_SNAP_RADIUS,\n /**\n * How much to prefer staying connected to the current connection over moving\n * to a new connection. The current previewed connection is considered to be\n * this much closer to the matching connection on the block than it actually\n * is.\n *\n * @alias Blockly.config.currentConnectionPreference\n */\n currentConnectionPreference: 8,\n /**\n * Delay in ms between trigger and bumping unconnected block out of alignment.\n *\n * @alias Blockly.config.bumpDelay\n */\n bumpDelay: 250,\n};\n","/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing an icon on a block.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Icon');\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport type {Bubble} from './bubble.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\nimport * as deprecation from './utils/deprecation.js';\n\n\n/**\n * Class for an icon.\n *\n * @alias Blockly.Icon\n */\nexport abstract class Icon {\n protected block_: BlockSvg|null;\n /** The icon SVG group. */\n iconGroup_: SVGGElement|null = null;\n\n /** Whether this icon gets hidden when the block is collapsed. */\n collapseHidden = true;\n\n /** Height and width of icons. */\n readonly SIZE = 17;\n\n /** Bubble UI (if visible). */\n protected bubble_: Bubble|null = null;\n\n /** Absolute coordinate of icon's center. */\n protected iconXY_: Coordinate|null = null;\n\n /** @param block The block associated with this icon. */\n constructor(block: BlockSvg|null) {\n if (!block) {\n deprecation.warn(\n 'Calling the Icon constructor with a null block', 'version 9',\n 'version 10', 'a non-null block');\n }\n this.block_ = block;\n }\n\n /** Create the icon on the block. */\n createIcon() {\n if (this.iconGroup_) {\n // Icon already exists.\n return;\n }\n /* Here's the markup that will be generated:\n <g class=\"blocklyIconGroup\">\n ...\n </g>\n */\n this.iconGroup_ =\n dom.createSvgElement(Svg.G, {'class': 'blocklyIconGroup'});\n if (this.getBlock().isInFlyout) {\n dom.addClass(this.iconGroup_, 'blocklyIconGroupReadonly');\n }\n this.drawIcon_(this.iconGroup_);\n\n this.getBlock().getSvgRoot().appendChild(this.iconGroup_);\n browserEvents.conditionalBind(\n this.iconGroup_, 'mouseup', this, this.iconClick_);\n this.updateEditable();\n }\n\n /** Dispose of this icon. */\n dispose() {\n dom.removeNode(this.iconGroup_); // Dispose of and unlink the icon.\n this.setVisible(false); // Dispose of and unlink the bubble.\n }\n\n /** Add or remove the UI indicating if this icon may be clicked or not. */\n updateEditable() {\n // No-op on the base class.\n }\n\n /**\n * Is the associated bubble visible?\n *\n * @returns True if the bubble is visible.\n */\n isVisible(): boolean {\n return !!this.bubble_;\n }\n\n /**\n * Clicking on the icon toggles if the bubble is visible.\n *\n * @param e Mouse click event.\n */\n protected iconClick_(e: MouseEvent) {\n if (this.getBlock().workspace.isDragging()) {\n // Drag operation is concluding. Don't open the editor.\n return;\n }\n if (!this.getBlock().isInFlyout && !browserEvents.isRightButton(e)) {\n this.setVisible(!this.isVisible());\n }\n }\n\n /** Change the colour of the associated bubble to match its block. */\n applyColour() {\n if (this.bubble_ && this.isVisible()) {\n this.bubble_.setColour(this.getBlock().style.colourPrimary);\n }\n }\n\n /**\n * Notification that the icon has moved. Update the arrow accordingly.\n *\n * @param xy Absolute location in workspace coordinates.\n */\n setIconLocation(xy: Coordinate) {\n this.iconXY_ = xy;\n if (this.bubble_ && this.isVisible()) {\n this.bubble_.setAnchorLocation(xy);\n }\n }\n\n /**\n * Notification that the icon has moved, but we don't really know where.\n * Recompute the icon's location from scratch.\n */\n computeIconLocation() {\n // Find coordinates for the centre of the icon and update the arrow.\n const blockXY = this.getBlock().getRelativeToSurfaceXY();\n const iconXY = svgMath.getRelativeXY(this.iconGroup_ as SVGElement);\n const newXY = new Coordinate(\n blockXY.x + iconXY.x + this.SIZE / 2,\n blockXY.y + iconXY.y + this.SIZE / 2);\n if (!Coordinate.equals(this.getIconLocation(), newXY)) {\n this.setIconLocation(newXY);\n }\n }\n\n /**\n * Returns the center of the block's icon relative to the surface.\n *\n * @returns Object with x and y properties in workspace coordinates.\n */\n getIconLocation(): Coordinate|null {\n return this.iconXY_;\n }\n\n /**\n * Get the size of the icon as used for rendering.\n * This differs from the actual size of the icon, because it bulges slightly\n * out of its row rather than increasing the height of its row.\n *\n * @returns Height and width.\n */\n getCorrectedSize(): Size {\n // TODO (#2562): Remove getCorrectedSize.\n return new Size(this.SIZE, this.SIZE - 2);\n }\n\n /**\n * Draw the icon.\n *\n * @param _group The icon group.\n */\n protected drawIcon_(_group: Element) {}\n // No-op on base class.\n\n /**\n * Show or hide the icon.\n *\n * @param _visible True if the icon should be visible.\n */\n setVisible(_visible: boolean) {}\n\n /**\n * Returns the block this icon is attached to.\n */\n protected getBlock(): BlockSvg {\n if (!this.block_) {\n throw new Error('Block is not set for this icon.');\n }\n\n return this.block_;\n }\n}\n// No-op on base class\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing a theme.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Theme');\n\nimport * as registry from './registry.js';\nimport * as object from './utils/object.js';\n\n\nexport interface ITheme {\n blockStyles?: {[key: string]: BlockStyle};\n categoryStyles?: {[key: string]: CategoryStyle};\n componentStyles?: ComponentStyle;\n fontStyle?: FontStyle;\n startHats?: boolean;\n base?: string|Theme;\n name: string;\n}\n\n/**\n * Class for a theme.\n *\n * @alias Blockly.Theme\n */\nexport class Theme implements ITheme {\n /** @internal */\n blockStyles: {[key: string]: BlockStyle};\n /** @internal */\n categoryStyles: {[key: string]: CategoryStyle};\n /** @internal */\n componentStyles: ComponentStyle;\n /** @internal */\n fontStyle: FontStyle;\n\n /**\n * Whether or not to add a 'hat' on top of all blocks with no previous or\n * output connections.\n *\n * @internal\n */\n startHats?: boolean = false;\n\n /**\n * @param name Theme name.\n * @param opt_blockStyles A map from style names (strings) to objects with\n * style attributes for blocks.\n * @param opt_categoryStyles A map from style names (strings) to objects with\n * style attributes for categories.\n * @param opt_componentStyles A map of Blockly component names to style value.\n */\n constructor(\n public name: string, opt_blockStyles?: {[key: string]: BlockStyle},\n opt_categoryStyles?: {[key: string]: CategoryStyle},\n opt_componentStyles?: ComponentStyle) {\n /** The block styles map. */\n this.blockStyles = opt_blockStyles || Object.create(null);\n\n /** The category styles map. */\n this.categoryStyles = opt_categoryStyles || Object.create(null);\n\n /** The UI components styles map. */\n this.componentStyles =\n opt_componentStyles || Object.create(null) as ComponentStyle;\n\n /** The font style. */\n this.fontStyle = Object.create(null) as FontStyle;\n\n // Register the theme by name.\n registry.register(registry.Type.THEME, name, this);\n }\n\n /**\n * Gets the class name that identifies this theme.\n *\n * @returns The CSS class name.\n * @internal\n */\n getClassName(): string {\n return this.name + '-theme';\n }\n\n /**\n * Overrides or adds a style to the blockStyles map.\n *\n * @param blockStyleName The name of the block style.\n * @param blockStyle The block style.\n */\n setBlockStyle(blockStyleName: string, blockStyle: BlockStyle) {\n this.blockStyles[blockStyleName] = blockStyle;\n }\n\n /**\n * Overrides or adds a style to the categoryStyles map.\n *\n * @param categoryStyleName The name of the category style.\n * @param categoryStyle The category style.\n */\n setCategoryStyle(categoryStyleName: string, categoryStyle: CategoryStyle) {\n this.categoryStyles[categoryStyleName] = categoryStyle;\n }\n\n /**\n * Gets the style for a given Blockly UI component. If the style value is a\n * string, we attempt to find the value of any named references.\n *\n * @param componentName The name of the component.\n * @returns The style value.\n */\n getComponentStyle(componentName: string): string|null {\n const style = (this.componentStyles as AnyDuringMigration)[componentName];\n if (style && typeof style === 'string' && this.getComponentStyle((style))) {\n return this.getComponentStyle((style));\n }\n return style ? String(style) : null;\n }\n\n /**\n * Configure a specific Blockly UI component with a style value.\n *\n * @param componentName The name of the component.\n * @param styleValue The style value.\n */\n setComponentStyle(componentName: string, styleValue: AnyDuringMigration) {\n (this.componentStyles as AnyDuringMigration)[componentName] = styleValue;\n }\n\n /**\n * Configure a theme's font style.\n *\n * @param fontStyle The font style.\n */\n setFontStyle(fontStyle: FontStyle) {\n this.fontStyle = fontStyle;\n }\n\n /**\n * Configure a theme's start hats.\n *\n * @param startHats True if the theme enables start hats, false otherwise.\n */\n setStartHats(startHats: boolean) {\n this.startHats = startHats;\n }\n\n /**\n * Define a new Blockly theme.\n *\n * @param name The name of the theme.\n * @param themeObj An object containing theme properties.\n * @returns A new Blockly theme.\n */\n static defineTheme(name: string, themeObj: ITheme): Theme {\n name = name.toLowerCase();\n const theme = new Theme(name);\n let base = themeObj['base'];\n if (base) {\n if (typeof base === 'string') {\n base = registry.getObject(registry.Type.THEME, base) ?? undefined;\n }\n if (base instanceof Theme) {\n object.deepMerge(theme, base);\n theme.name = name;\n }\n }\n\n object.deepMerge(theme.blockStyles, themeObj['blockStyles']);\n object.deepMerge(theme.categoryStyles, themeObj['categoryStyles']);\n object.deepMerge(theme.componentStyles, themeObj['componentStyles']);\n object.deepMerge(theme.fontStyle, themeObj['fontStyle']);\n if (themeObj['startHats'] !== null) {\n theme.startHats = themeObj['startHats'];\n }\n\n return theme;\n }\n}\n\nexport namespace Theme {\n export interface BlockStyle {\n colourPrimary: string;\n colourSecondary?: string;\n colourTertiary?: string;\n hat?: string;\n }\n\n export interface CategoryStyle {\n colour: string;\n }\n\n export interface ComponentStyle {\n workspaceBackgroundColour?: string;\n toolboxBackgroundColour?: string;\n toolboxForegroundColour?: string;\n flyoutBackgroundColour?: string;\n flyoutForegroundColour?: string;\n flyoutOpacity?: number;\n scrollbarColour?: string;\n scrollbarOpacity?: number;\n insertionMarkerColour?: string;\n insertionMarkerOpacity?: number;\n markerColour?: string;\n cursorColour?: string;\n selectedGlowColour?: string;\n selectedGlowOpacity?: number;\n replacementGlowColour?: string;\n replacementGlowOpacity?: number;\n }\n\n export interface FontStyle {\n family?: string;\n weight?: string;\n size?: number;\n }\n}\n\nexport type BlockStyle = Theme.BlockStyle;\nexport type CategoryStyle = Theme.CategoryStyle;\nexport type ComponentStyle = Theme.ComponentStyle;\nexport type FontStyle = Theme.FontStyle;\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Classic theme.\n * Contains multi-coloured border to create shadow effect.\n *\n * @namespace Blockly.Themes.Classic\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Themes.Classic');\n\nimport {Theme} from '../theme.js';\n\n\nconst defaultBlockStyles = {\n 'colour_blocks': {'colourPrimary': '20'},\n 'list_blocks': {'colourPrimary': '260'},\n 'logic_blocks': {'colourPrimary': '210'},\n 'loop_blocks': {'colourPrimary': '120'},\n 'math_blocks': {'colourPrimary': '230'},\n 'procedure_blocks': {'colourPrimary': '290'},\n 'text_blocks': {'colourPrimary': '160'},\n 'variable_blocks': {'colourPrimary': '330'},\n 'variable_dynamic_blocks': {'colourPrimary': '310'},\n 'hat_blocks': {'colourPrimary': '330', 'hat': 'cap'},\n};\n\nconst categoryStyles = {\n 'colour_category': {'colour': '20'},\n 'list_category': {'colour': '260'},\n 'logic_category': {'colour': '210'},\n 'loop_category': {'colour': '120'},\n 'math_category': {'colour': '230'},\n 'procedure_category': {'colour': '290'},\n 'text_category': {'colour': '160'},\n 'variable_category': {'colour': '330'},\n 'variable_dynamic_category': {'colour': '310'},\n};\n\n/**\n * Classic theme.\n * Contains multi-coloured border to create shadow effect.\n *\n * @alias Blockly.Themes.Classic\n */\nexport const Classic = new Theme(\n 'classic', defaultBlockStyles as AnyDuringMigration, categoryStyles);\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object that controls settings for the workspace.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Options');\n\nimport type {BlocklyOptions} from './blockly_options.js';\nimport * as deprecation from './utils/deprecation.js';\nimport * as registry from './registry.js';\nimport {Theme} from './theme.js';\nimport {Classic} from './theme/classic.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport type {Metrics} from './utils/metrics.js';\nimport * as toolbox from './utils/toolbox.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Parse the user-specified options, using reasonable defaults where behaviour\n * is unspecified.\n *\n * @alias Blockly.Options\n */\nexport class Options {\n RTL: boolean;\n oneBasedIndex: boolean;\n collapse: boolean;\n comments: boolean;\n disable: boolean;\n readOnly: boolean;\n maxBlocks: number;\n maxInstances: {[key: string]: number}|null;\n pathToMedia: string;\n hasCategories: boolean;\n moveOptions: MoveOptions;\n hasScrollbars: boolean;\n hasTrashcan: boolean;\n maxTrashcanContents: number;\n hasSounds: boolean;\n hasCss: boolean;\n horizontalLayout: boolean;\n languageTree: toolbox.ToolboxInfo|null;\n gridOptions: GridOptions;\n zoomOptions: ZoomOptions;\n toolboxPosition: toolbox.Position;\n theme: Theme;\n renderer: string;\n rendererOverrides: {[rendererConstant: string]: any}|null;\n\n /**\n * The SVG element for the grid pattern.\n * Created during injection.\n */\n gridPattern: SVGElement|null = null;\n parentWorkspace: WorkspaceSvg|null;\n plugins: {[key: string]: (new(...p1: any[]) => any)|string};\n\n /**\n * If set, sets the translation of the workspace to match the scrollbars.\n * A function that\n * sets the translation of the workspace to match the scrollbars. The\n * argument Contains an x and/or y property which is a float between 0\n * and 1 specifying the degree of scrolling.\n */\n setMetrics?: ((p1: {x?: number, y?: number}) => void) = undefined;\n\n /**\n * A function that returns a metrics\n * object that describes the current workspace.\n */\n getMetrics?: (() => Metrics) = undefined;\n\n /**\n * @param options Dictionary of options.\n * Specification:\n * https://developers.google.com/blockly/guides/get-started/web#configuration\n */\n constructor(options: BlocklyOptions) {\n let toolboxJsonDef = null;\n let hasCategories = false;\n let hasTrashcan = false;\n let hasCollapse = false;\n let hasComments = false;\n let hasDisable = false;\n let hasSounds = false;\n const readOnly = !!options['readOnly'];\n if (!readOnly) {\n toolboxJsonDef =\n toolbox.convertToolboxDefToJson(options['toolbox'] ?? null);\n hasCategories = toolbox.hasCategories(toolboxJsonDef);\n const rawHasTrashcan = options['trashcan'];\n hasTrashcan =\n rawHasTrashcan === undefined ? hasCategories : rawHasTrashcan;\n const rawHasCollapse = options['collapse'];\n hasCollapse =\n rawHasCollapse === undefined ? hasCategories : rawHasCollapse;\n const rawHasComments = options['comments'];\n hasComments =\n rawHasComments === undefined ? hasCategories : rawHasComments;\n const rawHasDisable = options['disable'];\n hasDisable = rawHasDisable === undefined ? hasCategories : rawHasDisable;\n const rawHasSounds = options['sounds'];\n hasSounds = rawHasSounds === undefined ? true : rawHasSounds;\n }\n\n let maxTrashcanContents = options['maxTrashcanContents'];\n if (hasTrashcan) {\n if (maxTrashcanContents === undefined) {\n maxTrashcanContents = 32;\n }\n } else {\n maxTrashcanContents = 0;\n }\n const rtl = !!options['rtl'];\n let horizontalLayout = options['horizontalLayout'];\n if (horizontalLayout === undefined) {\n horizontalLayout = false;\n }\n const toolboxAtStart = options['toolboxPosition'] !== 'end';\n\n let toolboxPosition: toolbox.Position;\n if (horizontalLayout) {\n toolboxPosition =\n toolboxAtStart ? toolbox.Position.TOP : toolbox.Position.BOTTOM;\n } else {\n toolboxPosition = toolboxAtStart === rtl ? toolbox.Position.RIGHT :\n toolbox.Position.LEFT;\n }\n\n let hasCss = options['css'];\n if (hasCss === undefined) {\n hasCss = true;\n }\n let pathToMedia = 'https://blockly-demo.appspot.com/static/media/';\n if (options['media']) {\n pathToMedia = options['media'].endsWith('/') ? options['media'] :\n options['media'] + '/';\n } else if ('path' in options) {\n // 'path' is a deprecated option which has been replaced by 'media'.\n deprecation.warn('path', 'Nov 2014', 'Jul 2023', 'media');\n pathToMedia = (options as any)['path'] + 'media/';\n }\n const rawOneBasedIndex = options['oneBasedIndex'];\n const oneBasedIndex =\n rawOneBasedIndex === undefined ? true : rawOneBasedIndex;\n const renderer = options['renderer'] || 'geras';\n\n const plugins = options['plugins'] || {};\n\n this.RTL = rtl;\n this.oneBasedIndex = oneBasedIndex;\n this.collapse = hasCollapse;\n this.comments = hasComments;\n this.disable = hasDisable;\n this.readOnly = readOnly;\n this.maxBlocks = options['maxBlocks'] || Infinity;\n this.maxInstances = options['maxInstances'] ?? null;\n this.pathToMedia = pathToMedia;\n this.hasCategories = hasCategories;\n this.moveOptions = Options.parseMoveOptions_(options, hasCategories);\n /** @deprecated January 2019 */\n this.hasScrollbars = !!this.moveOptions.scrollbars;\n this.hasTrashcan = hasTrashcan;\n this.maxTrashcanContents = maxTrashcanContents;\n this.hasSounds = hasSounds;\n this.hasCss = hasCss;\n this.horizontalLayout = horizontalLayout;\n this.languageTree = toolboxJsonDef;\n this.gridOptions = Options.parseGridOptions_(options);\n this.zoomOptions = Options.parseZoomOptions_(options);\n this.toolboxPosition = toolboxPosition;\n this.theme = Options.parseThemeOptions_(options);\n this.renderer = renderer;\n this.rendererOverrides = options['rendererOverrides'] ?? null;\n\n /**\n * The parent of the current workspace, or null if there is no parent\n * workspace. We can assert that this is of type WorkspaceSvg as opposed to\n * Workspace as this is only used in a rendered workspace.\n */\n this.parentWorkspace = options['parentWorkspace'] ?? null;\n\n /** Map of plugin type to name of registered plugin or plugin class. */\n this.plugins = plugins;\n }\n\n /**\n * Parse the user-specified move options, using reasonable defaults where\n * behaviour is unspecified.\n *\n * @param options Dictionary of options.\n * @param hasCategories Whether the workspace has categories or not.\n * @returns Normalized move options.\n */\n private static parseMoveOptions_(\n options: BlocklyOptions, hasCategories: boolean): MoveOptions {\n const move = options['move'] || {};\n const moveOptions = {} as MoveOptions;\n if (move['scrollbars'] === undefined &&\n options['scrollbars'] === undefined) {\n moveOptions.scrollbars = hasCategories;\n } else if (typeof move['scrollbars'] === 'object') {\n moveOptions.scrollbars = {\n 'horizontal': !!move['scrollbars']['horizontal'],\n 'vertical': !!move['scrollbars']['vertical'],\n };\n // Convert scrollbars object to boolean if they have the same value.\n // This allows us to easily check for whether any scrollbars exist using\n // !!moveOptions.scrollbars.\n if (moveOptions.scrollbars.horizontal &&\n moveOptions.scrollbars.vertical) {\n moveOptions.scrollbars = true;\n } else if (\n !moveOptions.scrollbars.horizontal &&\n !moveOptions.scrollbars.vertical) {\n moveOptions.scrollbars = false;\n }\n } else {\n moveOptions.scrollbars = !!move['scrollbars'] || !!options['scrollbars'];\n }\n\n if (!moveOptions.scrollbars || move['wheel'] === undefined) {\n // Defaults to true if single-direction scroll is enabled.\n moveOptions.wheel = typeof moveOptions.scrollbars === 'object';\n } else {\n moveOptions.wheel = !!move['wheel'];\n }\n if (!moveOptions.scrollbars) {\n moveOptions.drag = false;\n } else if (move['drag'] === undefined) {\n // Defaults to true if scrollbars is true.\n moveOptions.drag = true;\n } else {\n moveOptions.drag = !!move['drag'];\n }\n return moveOptions;\n }\n\n /**\n * Parse the user-specified zoom options, using reasonable defaults where\n * behaviour is unspecified. See zoom documentation:\n * https://developers.google.com/blockly/guides/configure/web/zoom\n *\n * @param options Dictionary of options.\n * @returns Normalized zoom options.\n */\n private static parseZoomOptions_(options: BlocklyOptions): ZoomOptions {\n const zoom = options['zoom'] || {};\n const zoomOptions = {} as ZoomOptions;\n if (zoom['controls'] === undefined) {\n zoomOptions.controls = false;\n } else {\n zoomOptions.controls = !!zoom['controls'];\n }\n if (zoom['wheel'] === undefined) {\n zoomOptions.wheel = false;\n } else {\n zoomOptions.wheel = !!zoom['wheel'];\n }\n if (zoom['startScale'] === undefined) {\n zoomOptions.startScale = 1;\n } else {\n zoomOptions.startScale = Number(zoom['startScale']);\n }\n if (zoom['maxScale'] === undefined) {\n zoomOptions.maxScale = 3;\n } else {\n zoomOptions.maxScale = Number(zoom['maxScale']);\n }\n if (zoom['minScale'] === undefined) {\n zoomOptions.minScale = 0.3;\n } else {\n zoomOptions.minScale = Number(zoom['minScale']);\n }\n if (zoom['scaleSpeed'] === undefined) {\n zoomOptions.scaleSpeed = 1.2;\n } else {\n zoomOptions.scaleSpeed = Number(zoom['scaleSpeed']);\n }\n if (zoom['pinch'] === undefined) {\n zoomOptions.pinch = zoomOptions.wheel || zoomOptions.controls;\n } else {\n zoomOptions.pinch = !!zoom['pinch'];\n }\n return zoomOptions;\n }\n\n /**\n * Parse the user-specified grid options, using reasonable defaults where\n * behaviour is unspecified. See grid documentation:\n * https://developers.google.com/blockly/guides/configure/web/grid\n *\n * @param options Dictionary of options.\n * @returns Normalized grid options.\n */\n private static parseGridOptions_(options: BlocklyOptions): GridOptions {\n const grid = options['grid'] || {};\n const gridOptions = {} as GridOptions;\n gridOptions.spacing = Number(grid['spacing']) || 0;\n gridOptions.colour = grid['colour'] || '#888';\n gridOptions.length =\n grid['length'] === undefined ? 1 : Number(grid['length']);\n gridOptions.snap = gridOptions.spacing > 0 && !!grid['snap'];\n return gridOptions;\n }\n\n /**\n * Parse the user-specified theme options, using the classic theme as a\n * default. https://developers.google.com/blockly/guides/configure/web/themes\n *\n * @param options Dictionary of options.\n * @returns A Blockly Theme.\n */\n private static parseThemeOptions_(options: BlocklyOptions): Theme {\n const theme = options['theme'] || Classic;\n if (typeof theme === 'string') {\n return registry.getObject(registry.Type.THEME, theme) as Theme;\n } else if (theme instanceof Theme) {\n return theme;\n }\n return Theme.defineTheme(\n theme.name || 'builtin' + idGenerator.getNextUniqueId(), theme);\n }\n}\n\nexport namespace Options {\n export interface GridOptions {\n colour: string;\n length: number;\n snap: boolean;\n spacing: number;\n }\n\n export interface MoveOptions {\n drag: boolean;\n scrollbars: boolean|ScrollbarOptions;\n wheel: boolean;\n }\n\n export interface ScrollbarOptions {\n horizontal: boolean;\n vertical: boolean;\n }\n\n export interface ZoomOptions {\n controls: boolean;\n maxScale: number;\n minScale: number;\n pinch: boolean;\n scaleSpeed: number;\n startScale: number;\n wheel: boolean;\n }\n}\n\nexport type GridOptions = Options.GridOptions;\nexport type MoveOptions = Options.MoveOptions;\nexport type ScrollbarOptions = Options.ScrollbarOptions;\nexport type ZoomOptions = Options.ZoomOptions;\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a mutator dialog. A mutator allows the\n * user to change the shape of a block using a nested blocks editor.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Mutator');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_bubble_open.js';\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport type {BlocklyOptions} from './blockly_options.js';\nimport {Bubble} from './bubble.js';\nimport {config} from './config.js';\nimport type {Connection} from './connection.js';\nimport type {Abstract} from './events/events_abstract.js';\nimport {BlockChange} from './events/events_block_change.js';\nimport * as eventUtils from './events/utils.js';\nimport {Icon} from './icon.js';\nimport {Options} from './options.js';\nimport type {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport * as toolbox from './utils/toolbox.js';\nimport * as xml from './utils/xml.js';\nimport * as deprecation from './utils/deprecation.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a mutator dialog.\n *\n * @alias Blockly.Mutator\n */\nexport class Mutator extends Icon {\n private quarkNames_: string[];\n\n /** Workspace in the mutator's bubble. */\n private workspace_: WorkspaceSvg|null = null;\n\n /** Width of workspace. */\n private workspaceWidth_ = 0;\n\n /** Height of workspace. */\n private workspaceHeight_ = 0;\n\n /**\n * The SVG element that is the parent of the mutator workspace, or null if\n * not created.\n */\n private svgDialog_: SVGSVGElement|null = null;\n\n /**\n * The root block of the mutator workspace, created by decomposing the\n * source block.\n */\n private rootBlock_: BlockSvg|null = null;\n\n /**\n * Function registered on the main workspace to update the mutator contents\n * when the main workspace changes.\n */\n private sourceListener_: Function|null = null;\n\n /**\n * The PID associated with the updateWorkpace_ timeout, or null if no timeout\n * is currently running.\n */\n private updateWorkspacePid_: ReturnType<typeof setTimeout>|null = null;\n\n /** @param quarkNames List of names of sub-blocks for flyout. */\n constructor(quarkNames: string[], block?: BlockSvg) {\n if (!block) {\n deprecation.warn(\n 'Calling the Mutator constructor without passing the block it is attached to',\n 'version 9', 'version 10',\n 'the constructor by passing the list of subblocks and the block instance to attach the mutator to');\n }\n super(block ?? null);\n this.quarkNames_ = quarkNames;\n }\n\n /**\n * Set the block this mutator is associated with.\n *\n * @param block The block associated with this mutator.\n * @internal\n */\n setBlock(block: BlockSvg) {\n this.block_ = block;\n }\n\n /**\n * Returns the workspace inside this mutator icon's bubble.\n *\n * @returns The workspace inside this mutator icon's bubble or null if the\n * mutator isn't open.\n * @internal\n */\n getWorkspace(): WorkspaceSvg|null {\n return this.workspace_;\n }\n\n /**\n * Draw the mutator icon.\n *\n * @param group The icon group.\n */\n protected override drawIcon_(group: Element) {\n // Square with rounded corners.\n dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blocklyIconShape',\n 'rx': '4',\n 'ry': '4',\n 'height': '16',\n 'width': '16',\n },\n group);\n // Gear teeth.\n dom.createSvgElement(\n Svg.PATH, {\n 'class': 'blocklyIconSymbol',\n 'd': 'm4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,' +\n '0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,' +\n '-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,' +\n '-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,' +\n '-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 ' +\n '-0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,' +\n '0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z',\n },\n group);\n // Axle hole.\n dom.createSvgElement(\n Svg.CIRCLE,\n {'class': 'blocklyIconShape', 'r': '2.7', 'cx': '8', 'cy': '8'}, group);\n }\n\n /**\n * Clicking on the icon toggles if the mutator bubble is visible.\n * Disable if block is uneditable.\n *\n * @param e Mouse click event.\n */\n protected override iconClick_(e: MouseEvent) {\n if (this.getBlock().isEditable()) {\n super.iconClick_(e);\n }\n }\n\n /**\n * Create the editor for the mutator's bubble.\n *\n * @returns The top-level node of the editor.\n */\n private createEditor_(): SVGElement {\n /* Create the editor. Here's the markup that will be generated:\n <svg>\n [Workspace]\n </svg>\n */\n this.svgDialog_ = dom.createSvgElement(\n Svg.SVG, {'x': Bubble.BORDER_WIDTH, 'y': Bubble.BORDER_WIDTH});\n // Convert the list of names into a list of XML objects for the flyout.\n let quarkXml;\n if (this.quarkNames_.length) {\n quarkXml = xml.createElement('xml');\n for (let i = 0, quarkName; quarkName = this.quarkNames_[i]; i++) {\n const element = xml.createElement('block');\n element.setAttribute('type', quarkName);\n quarkXml.appendChild(element);\n }\n } else {\n quarkXml = null;\n }\n const block = this.getBlock();\n const workspaceOptions = new Options(({\n // If you want to enable disabling, also remove the\n // event filter from workspaceChanged_ .\n 'disable': false,\n 'parentWorkspace': block.workspace,\n 'media': block.workspace.options.pathToMedia,\n 'rtl': block.RTL,\n 'horizontalLayout': false,\n 'renderer': block.workspace.options.renderer,\n 'rendererOverrides': block.workspace.options.rendererOverrides,\n } as BlocklyOptions));\n workspaceOptions.toolboxPosition =\n block.RTL ? toolbox.Position.RIGHT : toolbox.Position.LEFT;\n const hasFlyout = !!quarkXml;\n if (hasFlyout) {\n workspaceOptions.languageTree = toolbox.convertToolboxDefToJson(quarkXml);\n }\n this.workspace_ = this.newWorkspaceSvg(workspaceOptions);\n this.workspace_.internalIsMutator = true;\n this.workspace_.addChangeListener(eventUtils.disableOrphans);\n\n // Mutator flyouts go inside the mutator workspace's <g> rather than in\n // a top level SVG. Instead of handling scale themselves, mutators\n // inherit scale from the parent workspace.\n // To fix this, scale needs to be applied at a different level in the DOM.\n const flyoutSvg = hasFlyout ? this.workspace_.addFlyout(Svg.G) : null;\n const background = this.workspace_.createDom('blocklyMutatorBackground');\n\n if (flyoutSvg) {\n // Insert the flyout after the <rect> but before the block canvas so that\n // the flyout is underneath in z-order. This makes blocks layering during\n // dragging work properly.\n background.insertBefore(flyoutSvg, this.workspace_.svgBlockCanvas_);\n }\n this.svgDialog_!.appendChild(background);\n\n return this.svgDialog_;\n }\n\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n newWorkspaceSvg(options: Options): WorkspaceSvg {\n throw new Error(\n 'The implementation of newWorkspaceSvg should be ' +\n 'monkey-patched in by blockly.ts');\n }\n\n /** Add or remove the UI indicating if this icon may be clicked or not. */\n override updateEditable() {\n super.updateEditable();\n if (!this.getBlock().isInFlyout) {\n if (this.getBlock().isEditable()) {\n if (this.iconGroup_) {\n dom.removeClass(this.iconGroup_, 'blocklyIconGroupReadonly');\n }\n } else {\n // Close any mutator bubble. Icon is not clickable.\n this.setVisible(false);\n if (this.iconGroup_) {\n dom.addClass(this.iconGroup_, 'blocklyIconGroupReadonly');\n }\n }\n }\n }\n\n /** Resize the bubble to match the size of the workspace. */\n private resizeBubble_() {\n const doubleBorderWidth = 2 * Bubble.BORDER_WIDTH;\n const workspaceSize = this.workspace_!.getCanvas().getBBox();\n let width = workspaceSize.width + workspaceSize.x;\n let height = workspaceSize.height + doubleBorderWidth * 3;\n const flyout = this.workspace_!.getFlyout();\n if (flyout) {\n const flyoutScrollMetrics =\n flyout.getWorkspace().getMetricsManager().getScrollMetrics();\n height = Math.max(height, flyoutScrollMetrics.height + 20);\n width += flyout.getWidth();\n }\n if (this.getBlock().RTL) {\n width = -workspaceSize.x;\n }\n width += doubleBorderWidth * 3;\n // Only resize if the size difference is significant. Eliminates\n // shuddering.\n if (Math.abs(this.workspaceWidth_ - width) > doubleBorderWidth ||\n Math.abs(this.workspaceHeight_ - height) > doubleBorderWidth) {\n // Record some layout information for workspace metrics.\n this.workspaceWidth_ = width;\n this.workspaceHeight_ = height;\n // Resize the bubble.\n this.bubble_!.setBubbleSize(\n width + doubleBorderWidth, height + doubleBorderWidth);\n this.svgDialog_!.setAttribute('width', `${this.workspaceWidth_}`);\n this.svgDialog_!.setAttribute('height', `${this.workspaceHeight_}`);\n this.workspace_!.setCachedParentSvgSize(\n this.workspaceWidth_, this.workspaceHeight_);\n }\n\n if (this.getBlock().RTL) {\n // Scroll the workspace to always left-align.\n const translation = 'translate(' + this.workspaceWidth_ + ',0)';\n this.workspace_!.getCanvas().setAttribute('transform', translation);\n }\n this.workspace_!.resize();\n }\n\n /** A method handler for when the bubble is moved. */\n private onBubbleMove_() {\n if (this.workspace_) {\n this.workspace_.recordDragTargets();\n }\n }\n\n /**\n * Show or hide the mutator bubble.\n *\n * @param visible True if the bubble should be visible.\n */\n override setVisible(visible: boolean) {\n if (visible === this.isVisible()) {\n // No change.\n return;\n }\n const block = this.getBlock();\n eventUtils.fire(new (eventUtils.get(eventUtils.BUBBLE_OPEN))(\n block, visible, 'mutator'));\n if (visible) {\n // Create the bubble.\n this.bubble_ = new Bubble(\n block.workspace, this.createEditor_(), block.pathObject.svgPath,\n (this.iconXY_ as Coordinate), null, null);\n // Expose this mutator's block's ID on its top-level SVG group.\n this.bubble_.setSvgId(block.id);\n this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));\n const tree = this.workspace_!.options.languageTree;\n const flyout = this.workspace_!.getFlyout();\n if (tree) {\n flyout!.init(this.workspace_!);\n flyout!.show(tree);\n }\n\n this.rootBlock_ = block.decompose!(this.workspace_!)!;\n const blocks = this.rootBlock_!.getDescendants(false);\n for (let i = 0, child; child = blocks[i]; i++) {\n child.render();\n }\n // The root block should not be draggable or deletable.\n this.rootBlock_!.setMovable(false);\n this.rootBlock_!.setDeletable(false);\n let margin;\n let x;\n if (flyout) {\n margin = flyout.CORNER_RADIUS * 2;\n x = this.rootBlock_!.RTL ? flyout.getWidth() + margin : margin;\n } else {\n margin = 16;\n x = margin;\n }\n if (block.RTL) {\n x = -x;\n }\n this.rootBlock_!.moveBy(x, margin);\n // Save the initial connections, then listen for further changes.\n if (block.saveConnections) {\n const thisRootBlock = this.rootBlock_;\n block.saveConnections(thisRootBlock);\n this.sourceListener_ = () => {\n const currentBlock = this.getBlock();\n if (currentBlock.saveConnections) {\n currentBlock.saveConnections(thisRootBlock);\n }\n };\n block.workspace.addChangeListener(this.sourceListener_);\n }\n this.resizeBubble_();\n // When the mutator's workspace changes, update the source block.\n this.workspace_!.addChangeListener(this.workspaceChanged_.bind(this));\n // Update the source block immediately after the bubble becomes visible.\n this.updateWorkspace_();\n this.applyColour();\n } else {\n // Dispose of the bubble.\n this.svgDialog_ = null;\n this.workspace_!.dispose();\n this.workspace_ = null;\n this.rootBlock_ = null;\n this.bubble_?.dispose();\n this.bubble_ = null;\n this.workspaceWidth_ = 0;\n this.workspaceHeight_ = 0;\n if (this.sourceListener_) {\n block.workspace.removeChangeListener(this.sourceListener_);\n this.sourceListener_ = null;\n }\n }\n }\n\n /**\n * Fired whenever a change is made to the mutator's workspace.\n *\n * @param e Custom data for event.\n */\n private workspaceChanged_(e: Abstract) {\n if (!this.shouldIgnoreMutatorEvent_(e) && !this.updateWorkspacePid_) {\n this.updateWorkspacePid_ = setTimeout(() => {\n this.updateWorkspacePid_ = null;\n this.updateWorkspace_();\n }, 0);\n }\n }\n\n /**\n * Returns whether the given event in the mutator workspace should be ignored\n * when deciding whether to update the workspace and compose the block or not.\n *\n * @param e The event.\n * @returns Whether to ignore the event or not.\n */\n shouldIgnoreMutatorEvent_(e: Abstract) {\n return e.isUiEvent || e.type === eventUtils.CREATE ||\n e.type === eventUtils.CHANGE &&\n (e as BlockChange).element === 'disabled';\n }\n\n /**\n * Updates the source block when the mutator's blocks are changed.\n * Bump down any block that's too high.\n */\n private updateWorkspace_() {\n if (!this.workspace_!.isDragging()) {\n const blocks = this.workspace_!.getTopBlocks(false);\n const MARGIN = 20;\n\n for (let b = 0, block; block = blocks[b]; b++) {\n const blockXY = block.getRelativeToSurfaceXY();\n\n // Bump any block that's above the top back inside.\n if (blockXY.y < MARGIN) {\n block.moveBy(0, MARGIN - blockXY.y);\n }\n // Bump any block overlapping the flyout back inside.\n if (block.RTL) {\n let right = -MARGIN;\n const flyout = this.workspace_!.getFlyout();\n if (flyout) {\n right -= flyout.getWidth();\n }\n if (blockXY.x > right) {\n block.moveBy(right - blockXY.x, 0);\n }\n } else if (blockXY.x < MARGIN) {\n block.moveBy(MARGIN - blockXY.x, 0);\n }\n }\n }\n\n // When the mutator's workspace changes, update the source block.\n if (this.rootBlock_ && this.rootBlock_.workspace === this.workspace_) {\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n const block = this.getBlock();\n const oldExtraState = BlockChange.getExtraBlockState_(block);\n\n // Switch off rendering while the source block is rebuilt.\n const savedRendered = block.rendered;\n // TODO(#4288): We should not be setting the rendered property to false.\n block.rendered = false;\n\n // Allow the source block to rebuild itself.\n block.compose!(this.rootBlock_);\n // Restore rendering and show the changes.\n block.rendered = savedRendered;\n // Mutation may have added some elements that need initializing.\n block.initSvg();\n\n if (block.rendered) {\n block.render();\n }\n\n const newExtraState = BlockChange.getExtraBlockState_(block);\n if (oldExtraState !== newExtraState) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n block, 'mutation', null, oldExtraState, newExtraState));\n // Ensure that any bump is part of this mutation's event group.\n const mutationGroup = eventUtils.getGroup();\n setTimeout(function() {\n const oldGroup = eventUtils.getGroup();\n eventUtils.setGroup(mutationGroup);\n block.bumpNeighbours();\n eventUtils.setGroup(oldGroup);\n }, config.bumpDelay);\n }\n\n // Don't update the bubble until the drag has ended, to avoid moving\n // blocks under the cursor.\n if (!this.workspace_!.isDragging()) {\n setTimeout(() => this.resizeBubble_(), 0);\n }\n eventUtils.setGroup(existingGroup);\n }\n }\n\n /** Dispose of this mutator. */\n override dispose() {\n this.getBlock().mutator = null;\n super.dispose();\n }\n\n /** Update the styles on all blocks in the mutator. */\n updateBlockStyle() {\n const ws = this.workspace_;\n\n if (ws && ws.getAllBlocks(false)) {\n const workspaceBlocks = ws.getAllBlocks(false);\n for (let i = 0, block; block = workspaceBlocks[i]; i++) {\n block.setStyle(block.getStyleName());\n }\n\n const flyout = ws.getFlyout();\n if (flyout) {\n const flyoutBlocks = flyout.getWorkspace().getAllBlocks(false);\n for (let i = 0, block; block = flyoutBlocks[i]; i++) {\n block.setStyle(block.getStyleName());\n }\n }\n }\n }\n\n /**\n * Reconnect an block to a mutated input.\n *\n * @param connectionChild Connection on child block.\n * @param block Parent block.\n * @param inputName Name of input on parent block.\n * @returns True iff a reconnection was made, false otherwise.\n */\n static reconnect(\n connectionChild: Connection, block: Block, inputName: string): boolean {\n if (!connectionChild || !connectionChild.getSourceBlock().workspace) {\n return false; // No connection or block has been deleted.\n }\n const connectionParent = block.getInput(inputName)!.connection;\n const currentParent = connectionChild.targetBlock();\n if ((!currentParent || currentParent === block) && connectionParent &&\n connectionParent.targetConnection !== connectionChild) {\n if (connectionParent.isConnected()) {\n // There's already something connected here. Get rid of it.\n connectionParent.disconnect();\n }\n connectionParent.connect(connectionChild);\n return true;\n }\n return false;\n }\n\n /**\n * Get the parent workspace of a workspace that is inside a mutator, taking\n * into account whether it is a flyout.\n *\n * @param workspace The workspace that is inside a mutator.\n * @returns The mutator's parent workspace or null.\n */\n static findParentWs(workspace: WorkspaceSvg): WorkspaceSvg|null {\n let outerWs = null;\n if (workspace && workspace.options) {\n const parent = workspace.options.parentWorkspace;\n // If we were in a flyout in a mutator, need to go up two levels to find\n // the actual parent.\n if (workspace.isFlyout) {\n if (parent && parent.options) {\n outerWs = parent.options.parentWorkspace;\n }\n } else if (parent) {\n outerWs = parent;\n }\n }\n return outerWs;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of trashcan flyout open and close.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.TrashcanOpen');\n\nimport * as registry from '../registry.js';\nimport {AbstractEventJson} from './events_abstract.js';\n\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a trashcan open event.\n *\n * @alias Blockly.Events.TrashcanOpen\n */\nexport class TrashcanOpen extends UiBase {\n isOpen?: boolean;\n override type = eventUtils.TRASHCAN_OPEN;\n\n /**\n * @param opt_isOpen Whether the trashcan flyout is opening (false if\n * opening). Undefined for a blank event.\n * @param opt_workspaceId The workspace identifier for this event.\n * Undefined for a blank event.\n */\n constructor(opt_isOpen?: boolean, opt_workspaceId?: string) {\n super(opt_workspaceId);\n\n /** Whether the trashcan flyout is opening (false if closing). */\n this.isOpen = opt_isOpen;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): TrashcanOpenJson {\n const json = super.toJson() as TrashcanOpenJson;\n if (this.isOpen === undefined) {\n throw new Error(\n 'Whether this is already open or not is undefined. Either pass ' +\n 'a value to the constructor, or call fromJson');\n }\n json['isOpen'] = this.isOpen;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: TrashcanOpenJson) {\n super.fromJson(json);\n this.isOpen = json['isOpen'];\n }\n}\n\nexport interface TrashcanOpenJson extends AbstractEventJson {\n isOpen: boolean;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.TRASHCAN_OPEN, TrashcanOpen);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Manager for all items registered with the workspace.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ComponentManager');\n\nimport type {IAutoHideable} from './interfaces/i_autohideable.js';\nimport type {IComponent} from './interfaces/i_component.js';\nimport type {IDeleteArea} from './interfaces/i_delete_area.js';\nimport type {IDragTarget} from './interfaces/i_drag_target.js';\nimport type {IPositionable} from './interfaces/i_positionable.js';\nimport * as arrayUtils from './utils/array.js';\n\n\nclass Capability<_T> {\n static POSITIONABLE = new Capability<IPositionable>('positionable');\n static DRAG_TARGET = new Capability<IDragTarget>('drag_target');\n static DELETE_AREA = new Capability<IDeleteArea>('delete_area');\n static AUTOHIDEABLE = new Capability<IAutoHideable>('autohideable');\n private readonly name_: string;\n /** @param name The name of the component capability. */\n constructor(name: string) {\n this.name_ = name;\n }\n\n /**\n * Returns the name of the capability.\n *\n * @returns The name.\n */\n toString(): string {\n return this.name_;\n }\n}\n\n/**\n * Manager for all items registered with the workspace.\n *\n * @alias Blockly.ComponentManager\n */\nexport class ComponentManager {\n static Capability = Capability;\n\n /**\n * A map of the components registered with the workspace, mapped to id.\n */\n private readonly componentData = new Map<string, ComponentDatum>();\n\n /** A map of capabilities to component IDs. */\n private readonly capabilityToComponentIds = new Map<string, string[]>();\n\n /**\n * Adds a component.\n *\n * @param componentInfo The data for the component to register.\n * @param opt_allowOverrides True to prevent an error when overriding an\n * already registered item.\n */\n addComponent(componentInfo: ComponentDatum, opt_allowOverrides?: boolean) {\n // Don't throw an error if opt_allowOverrides is true.\n const id = componentInfo.component.id;\n if (!opt_allowOverrides && this.componentData.has(id)) {\n throw Error(\n 'Plugin \"' + id + '\" with capabilities \"' +\n this.componentData.get(id)?.capabilities + '\" already added.');\n }\n this.componentData.set(id, componentInfo);\n const stringCapabilities = [];\n for (let i = 0; i < componentInfo.capabilities.length; i++) {\n const capability = String(componentInfo.capabilities[i]).toLowerCase();\n stringCapabilities.push(capability);\n if (!this.capabilityToComponentIds.has(capability)) {\n this.capabilityToComponentIds.set(capability, [id]);\n } else {\n this.capabilityToComponentIds.get(capability)?.push(id);\n }\n }\n this.componentData.get(id)!.capabilities = stringCapabilities;\n }\n\n /**\n * Removes a component.\n *\n * @param id The ID of the component to remove.\n */\n removeComponent(id: string) {\n const componentInfo = this.componentData.get(id);\n if (!componentInfo) {\n return;\n }\n for (let i = 0; i < componentInfo.capabilities.length; i++) {\n const capability = String(componentInfo.capabilities[i]).toLowerCase();\n arrayUtils.removeElem(this.capabilityToComponentIds.get(capability)!, id);\n }\n this.componentData.delete(id);\n }\n\n /**\n * Adds a capability to a existing registered component.\n *\n * @param id The ID of the component to add the capability to.\n * @param capability The capability to add.\n */\n addCapability<T>(id: string, capability: string|Capability<T>) {\n if (!this.getComponent(id)) {\n throw Error(\n 'Cannot add capability, \"' + capability + '\". Plugin \"' + id +\n '\" has not been added to the ComponentManager');\n }\n if (this.hasCapability(id, capability)) {\n console.warn(\n 'Plugin \"' + id + 'already has capability \"' + capability + '\"');\n return;\n }\n capability = String(capability).toLowerCase();\n this.componentData.get(id)?.capabilities.push(capability);\n this.capabilityToComponentIds.get(capability)?.push(id);\n }\n\n /**\n * Removes a capability from an existing registered component.\n *\n * @param id The ID of the component to remove the capability from.\n * @param capability The capability to remove.\n */\n removeCapability<T>(id: string, capability: string|Capability<T>) {\n if (!this.getComponent(id)) {\n throw Error(\n 'Cannot remove capability, \"' + capability + '\". Plugin \"' + id +\n '\" has not been added to the ComponentManager');\n }\n if (!this.hasCapability(id, capability)) {\n console.warn(\n 'Plugin \"' + id + 'doesn\\'t have capability \"' + capability +\n '\" to remove');\n return;\n }\n capability = String(capability).toLowerCase();\n arrayUtils.removeElem(this.componentData.get(id)!.capabilities, capability);\n arrayUtils.removeElem(this.capabilityToComponentIds.get(capability)!, id);\n }\n\n /**\n * Returns whether the component with this id has the specified capability.\n *\n * @param id The ID of the component to check.\n * @param capability The capability to check for.\n * @returns Whether the component has the capability.\n */\n hasCapability<T>(id: string, capability: string|Capability<T>): boolean {\n capability = String(capability).toLowerCase();\n return this.componentData.has(id) &&\n this.componentData.get(id)!.capabilities.indexOf(capability) !== -1;\n }\n\n /**\n * Gets the component with the given ID.\n *\n * @param id The ID of the component to get.\n * @returns The component with the given name or undefined if not found.\n */\n getComponent(id: string): IComponent|undefined {\n return this.componentData.get(id)?.component;\n }\n\n /**\n * Gets all the components with the specified capability.\n *\n * @param capability The capability of the component.\n * @param sorted Whether to return list ordered by weights.\n * @returns The components that match the specified capability.\n */\n getComponents<T extends IComponent>(\n capability: string|Capability<T>, sorted: boolean): T[] {\n capability = String(capability).toLowerCase();\n const componentIds = this.capabilityToComponentIds.get(capability);\n if (!componentIds) {\n return [];\n }\n const components: T[] = [];\n if (sorted) {\n const componentDataList: ComponentDatum[] = [];\n componentIds.forEach((id) => {\n componentDataList.push(this.componentData.get(id)!);\n });\n componentDataList.sort(function(a, b) {\n return a.weight - b.weight;\n });\n componentDataList.forEach(function(componentDatum) {\n components.push(componentDatum.component as T);\n });\n } else {\n componentIds.forEach((id) => {\n components.push(this.componentData.get(id)!.component as T);\n });\n }\n return components;\n }\n}\n\nexport namespace ComponentManager {\n /** An object storing component information. */\n export interface ComponentDatum {\n component: IComponent;\n capabilities: Array<string|Capability<IComponent>>;\n weight: number;\n }\n}\n\nexport type ComponentDatum = ComponentManager.ComponentDatum;\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Contains custom errors thrown by the serialization system.\n *\n * @namespace Blockly.serialization.exceptions\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.serialization.exceptions');\n\nimport type {Block} from '../block.js';\nimport type {State} from './blocks.js';\n\n\n/** @alias Blockly.serialization.exceptions.DeserializationError */\nexport class DeserializationError extends Error {}\n\n/**\n * Represents an error where the serialized state is expected to provide a\n * block type, but it is not provided.\n *\n * @alias Blockly.serialization.exceptions.MissingBlockType\n */\nexport class MissingBlockType extends DeserializationError {\n /**\n * @param state The state object which is missing the block type.\n * @internal\n */\n constructor(public state: State) {\n super(`Expected to find a 'type' property, defining the block type`);\n }\n}\n\n/**\n * Represents an error where deserialization encountered a block that did\n * not have a connection that was defined in the serialized state.\n *\n * @alias Blockly.serialization.exceptions.MissingConnection\n */\nexport class MissingConnection extends DeserializationError {\n /**\n * @param connection The name of the connection that is missing. E.g.\n * 'IF0', or 'next'.\n * @param block The block missing the connection.\n * @param state The state object containing the bad connection.\n * @internal\n */\n constructor(connection: string, public block: Block, public state: State) {\n super(`The block ${block.toDevString()} is missing a(n) ${connection}\nconnection`);\n }\n}\n\n/**\n * Represents an error where deserialization tried to connect two connections\n * that were not compatible.\n *\n * @alias Blockly.serialization.exceptions.BadConnectionCheck\n */\nexport class BadConnectionCheck extends DeserializationError {\n /**\n * @param reason The reason the connections were not compatible.\n * @param childConnection The name of the incompatible child connection. E.g.\n * 'output' or 'previous'.\n * @param childBlock The child block that could not connect to its parent.\n * @param childState The state object representing the child block.\n * @internal\n */\n constructor(\n reason: string, childConnection: string, public childBlock: Block,\n public childState: State) {\n super(`The block ${childBlock.toDevString()} could not connect its\n${childConnection} to its parent, because: ${reason}`);\n }\n}\n\n/**\n * Represents an error where deserialization encountered a real block as it\n * was deserializing children of a shadow.\n * This is an error because it is an invariant of Blockly that shadow blocks\n * do not have real children.\n *\n * @alias Blockly.serialization.exceptions.RealChildOfShadow\n */\nexport class RealChildOfShadow extends DeserializationError {\n /**\n * @param state The state object representing the real block.\n * @internal\n */\n constructor(public state: State) {\n super(`Encountered a real block which is defined as a child of a shadow\nblock. It is an invariant of Blockly that shadow blocks only have shadow\nchildren`);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The top level namespace for priorities of plugin serializers.\n * Includes constants for the priorities of different plugin serializers. Higher\n * priorities are deserialized first.\n *\n * @namespace Blockly.serialization.priorities\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.serialization.priorities');\n\n\n/**\n * The priority for deserializing variables.\n *\n * @alias Blockly.serialization.priorities.VARIABLES\n */\nexport const VARIABLES = 100;\n/**\n * The priority for deserializing blocks.\n *\n * @alias Blockly.serialization.priorities.BLOCKS\n */\nexport const BLOCKS = 50;\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a block creation event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.BlockCreate');\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport * as blocks from '../serialization/blocks.js';\nimport * as Xml from '../xml.js';\n\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a block creation event.\n *\n * @alias Blockly.Events.BlockCreate\n */\nexport class BlockCreate extends BlockBase {\n override type = eventUtils.BLOCK_CREATE;\n xml?: Element|DocumentFragment;\n ids?: string[];\n json?: blocks.State;\n\n /** @param opt_block The created block. Undefined for a blank event. */\n constructor(opt_block?: Block) {\n super(opt_block);\n\n if (!opt_block) {\n return; // Blank event to be populated by fromJson.\n }\n\n if (opt_block.isShadow()) {\n // Moving shadow blocks is handled via disconnection.\n this.recordUndo = false;\n }\n\n this.xml = Xml.blockToDomWithXY(opt_block);\n this.ids = eventUtils.getDescendantIds(opt_block);\n\n /** JSON representation of the block that was just created. */\n this.json = blocks.save(opt_block, {addCoordinates: true}) as blocks.State;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): BlockCreateJson {\n const json = super.toJson() as BlockCreateJson;\n if (!this.xml) {\n throw new Error(\n 'The block XML is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.ids) {\n throw new Error(\n 'The block IDs are undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.json) {\n throw new Error(\n 'The block JSON is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n json['xml'] = Xml.domToText(this.xml);\n json['ids'] = this.ids;\n json['json'] = this.json;\n if (!this.recordUndo) {\n json['recordUndo'] = this.recordUndo;\n }\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: BlockCreateJson) {\n super.fromJson(json);\n this.xml = Xml.textToDom(json['xml']);\n this.ids = json['ids'];\n this.json = json['json'] as blocks.State;\n if (json['recordUndo'] !== undefined) {\n this.recordUndo = json['recordUndo'];\n }\n }\n\n /**\n * Run a creation event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.json) {\n throw new Error(\n 'The block JSON is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.ids) {\n throw new Error(\n 'The block IDs are undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n if (forward) {\n blocks.append(this.json, workspace);\n } else {\n for (let i = 0; i < this.ids.length; i++) {\n const id = this.ids[i];\n const block = workspace.getBlockById(id);\n if (block) {\n block.dispose(false);\n } else if (id === this.blockId) {\n // Only complain about root-level block.\n console.warn('Can\\'t uncreate non-existent block: ' + id);\n }\n }\n }\n }\n}\n\nexport interface BlockCreateJson extends BlockBaseJson {\n xml: string;\n ids: string[];\n json: object;\n recordUndo?: boolean;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.CREATE, BlockCreate);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a block delete event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.BlockDelete');\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport * as blocks from '../serialization/blocks.js';\nimport * as Xml from '../xml.js';\n\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a block deletion event.\n *\n * @alias Blockly.Events.BlockDelete\n */\nexport class BlockDelete extends BlockBase {\n oldXml?: Element|DocumentFragment;\n ids?: string[];\n wasShadow?: boolean;\n oldJson?: blocks.State;\n override type = eventUtils.BLOCK_DELETE;\n\n /** @param opt_block The deleted block. Undefined for a blank event. */\n constructor(opt_block?: Block) {\n super(opt_block);\n\n if (!opt_block) {\n return; // Blank event to be populated by fromJson.\n }\n\n if (opt_block.getParent()) {\n throw Error('Connected blocks cannot be deleted.');\n }\n if (opt_block.isShadow()) {\n // Respawning shadow blocks is handled via disconnection.\n this.recordUndo = false;\n }\n\n this.oldXml = Xml.blockToDomWithXY(opt_block);\n this.ids = eventUtils.getDescendantIds(opt_block);\n\n /** Was the block that was just deleted a shadow? */\n this.wasShadow = opt_block.isShadow();\n\n /** JSON representation of the block that was just deleted. */\n this.oldJson =\n blocks.save(opt_block, {addCoordinates: true}) as blocks.State;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): BlockDeleteJson {\n const json = super.toJson() as BlockDeleteJson;\n if (!this.oldXml) {\n throw new Error(\n 'The old block XML is undefined. Either pass a block ' +\n 'to the constructor, or call fromJson');\n }\n if (!this.ids) {\n throw new Error(\n 'The block IDs are undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n if (this.wasShadow === undefined) {\n throw new Error(\n 'Whether the block was a shadow is undefined. Either ' +\n 'pass a block to the constructor, or call fromJson');\n }\n if (!this.oldJson) {\n throw new Error(\n 'The old block JSON is undefined. Either pass a block ' +\n 'to the constructor, or call fromJson');\n }\n json['oldXml'] = Xml.domToText(this.oldXml);\n json['ids'] = this.ids;\n json['wasShadow'] = this.wasShadow;\n json['oldJson'] = this.oldJson;\n if (!this.recordUndo) {\n json['recordUndo'] = this.recordUndo;\n }\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: BlockDeleteJson) {\n super.fromJson(json);\n this.oldXml = Xml.textToDom(json['oldXml']);\n this.ids = json['ids'];\n this.wasShadow =\n json['wasShadow'] || this.oldXml.tagName.toLowerCase() === 'shadow';\n this.oldJson = json['oldJson'];\n if (json['recordUndo'] !== undefined) {\n this.recordUndo = json['recordUndo'];\n }\n }\n\n /**\n * Run a deletion event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.ids) {\n throw new Error(\n 'The block IDs are undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.oldJson) {\n throw new Error(\n 'The old block JSON is undefined. Either pass a block ' +\n 'to the constructor, or call fromJson');\n }\n if (forward) {\n for (let i = 0; i < this.ids.length; i++) {\n const id = this.ids[i];\n const block = workspace.getBlockById(id);\n if (block) {\n block.dispose(false);\n } else if (id === this.blockId) {\n // Only complain about root-level block.\n console.warn('Can\\'t delete non-existent block: ' + id);\n }\n }\n } else {\n blocks.append(this.oldJson, workspace);\n }\n }\n}\n\nexport interface BlockDeleteJson extends BlockBaseJson {\n oldXml: string;\n ids: string[];\n wasShadow: boolean;\n oldJson: blocks.State;\n recordUndo?: boolean;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.DELETE, BlockDelete);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An enum for the possible types of connections.\n *\n * @namespace Blockly.ConnectionType\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ConnectionType');\n\n\n/**\n * Enum for the type of a connection or input.\n *\n * @alias Blockly.ConnectionType\n */\nexport enum ConnectionType {\n // A right-facing value input. E.g. 'set item to' or 'return'.\n INPUT_VALUE = 1,\n // A left-facing value output. E.g. 'random fraction'.\n OUTPUT_VALUE,\n // A down-facing block stack. E.g. 'if-do' or 'else'.\n NEXT_STATEMENT,\n // An up-facing block stack. E.g. 'break out of loop'.\n PREVIOUS_STATEMENT\n}\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Blockly constants.\n *\n * @namespace Blockly.constants\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.constants');\n\n\n/**\n * The language-neutral ID given to the collapsed input.\n *\n * @alias Blockly.constants.COLLAPSED_INPUT_NAME\n */\nexport const COLLAPSED_INPUT_NAME = '_TEMP_COLLAPSED_INPUT';\n\n/**\n * The language-neutral ID given to the collapsed field.\n *\n * @alias Blockly.constants.COLLAPSED_FIELD_NAME\n */\nexport const COLLAPSED_FIELD_NAME = '_TEMP_COLLAPSED_FIELD';\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Non-editable, non-serializable text field. Used for titles,\n * labels, etc.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldLabel');\n\nimport * as dom from './utils/dom.js';\nimport {FieldConfig, Field} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as parsing from './utils/parsing.js';\nimport type {Sentinel} from './utils/sentinel.js';\n\n\n/**\n * Class for a non-editable, non-serializable text field.\n *\n * @alias Blockly.FieldLabel\n */\nexport class FieldLabel extends Field {\n /** The html class name to use for this field. */\n private class_: string|null = null;\n\n /**\n * Editable fields usually show some sort of UI indicating they are\n * editable. This field should not.\n */\n override EDITABLE = false;\n\n /**\n * @param opt_value The initial value of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param opt_class Optional CSS class for the field's text.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/label#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string|Sentinel, opt_class?: string,\n opt_config?: FieldLabelConfig) {\n super(Field.SKIP_SETUP);\n\n if (opt_value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n } else {\n this.class_ = opt_class || null;\n }\n this.setValue(opt_value);\n }\n\n protected override configure_(config: FieldLabelConfig) {\n super.configure_(config);\n if (config.class) this.class_ = config.class;\n }\n\n /**\n * Create block UI for this label.\n *\n * @internal\n */\n override initView() {\n this.createTextElement_();\n if (this.class_) {\n dom.addClass(this.getTextElement(), this.class_);\n }\n }\n\n /**\n * Ensure that the input value casts to a valid string.\n *\n * @param opt_newValue The input value.\n * @returns A valid string, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n string|null {\n if (opt_newValue === null || opt_newValue === undefined) {\n return null;\n }\n return String(opt_newValue);\n }\n\n /**\n * Set the CSS class applied to the field's textElement_.\n *\n * @param cssClass The new CSS class name, or null to remove.\n */\n setClass(cssClass: string|null) {\n if (this.textElement_) {\n if (this.class_) {\n dom.removeClass(this.textElement_, this.class_);\n }\n if (cssClass) {\n dom.addClass(this.textElement_, cssClass);\n }\n }\n this.class_ = cssClass;\n }\n\n /**\n * Construct a FieldLabel from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and class).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static fromJson(options: FieldLabelFromJsonConfig): FieldLabel {\n const text = parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldLabel if that class doesn't override\n // the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n\nfieldRegistry.register('field_label', FieldLabel);\n\n(FieldLabel.prototype as AnyDuringMigration).DEFAULT_VALUE = '';\n\n// clang-format off\n// Clang does not like the 'class' keyword being used as a property.\n/**\n * Config options for the label field.\n */\nexport interface FieldLabelConfig extends FieldConfig {\n class?: string;\n}\n// clang-format on\n\n\n/**\n * fromJson config options for the label field.\n */\nexport interface FieldLabelFromJsonConfig extends FieldLabelConfig {\n text?: string;\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing an input (value, statement, or dummy).\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Input');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './field_label.js';\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport type {Connection} from './connection.js';\nimport type {Field} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {inputTypes} from './input_types.js';\nimport type {RenderedConnection} from './rendered_connection.js';\n\n\n/**\n * Class for an input with an optional field.\n *\n * @alias Blockly.Input\n */\nexport class Input {\n private sourceBlock_: Block;\n fieldRow: Field[] = [];\n align: Align;\n\n /** Is the input visible? */\n private visible_ = true;\n\n /**\n * @param type The type of the input.\n * @param name Language-neutral identifier which may used to find this input\n * again.\n * @param block The block containing this input.\n * @param connection Optional connection for this input.\n */\n constructor(\n public type: number, public name: string, block: Block,\n public connection: Connection|null) {\n if (type !== inputTypes.DUMMY && !name) {\n throw Error(\n 'Value inputs and statement inputs must have non-empty name.');\n }\n this.sourceBlock_ = block;\n\n /** Alignment of input's fields (left, right or centre). */\n this.align = Align.LEFT;\n }\n\n /**\n * Get the source block for this input.\n *\n * @returns The source block, or null if there is none.\n */\n getSourceBlock(): Block {\n return this.sourceBlock_;\n }\n\n /**\n * Add a field (or label from string), and all prefix and suffix fields, to\n * the end of the input's field row.\n *\n * @param field Something to add as a field.\n * @param opt_name Language-neutral identifier which may used to find this\n * field again. Should be unique to the host block.\n * @returns The input being append to (to allow chaining).\n */\n appendField(field: string|Field, opt_name?: string): Input {\n this.insertFieldAt(this.fieldRow.length, field, opt_name);\n return this;\n }\n\n /**\n * Inserts a field (or label from string), and all prefix and suffix fields,\n * at the location of the input's field row.\n *\n * @param index The index at which to insert field.\n * @param field Something to add as a field.\n * @param opt_name Language-neutral identifier which may used to find this\n * field again. Should be unique to the host block.\n * @returns The index following the last inserted field.\n */\n insertFieldAt(index: number, field: string|Field, opt_name?: string): number {\n if (index < 0 || index > this.fieldRow.length) {\n throw Error('index ' + index + ' out of bounds.');\n }\n // Falsy field values don't generate a field, unless the field is an empty\n // string and named.\n if (!field && !(field === '' && opt_name)) {\n return index;\n }\n\n // Generate a FieldLabel when given a plain text field.\n if (typeof field === 'string') {\n field = fieldRegistry.fromJson({\n 'type': 'field_label',\n 'text': field,\n }) as Field;\n }\n\n field.setSourceBlock(this.sourceBlock_);\n if (this.sourceBlock_.rendered) {\n field.init();\n field.applyColour();\n }\n field.name = opt_name;\n field.setVisible(this.isVisible());\n\n if (field.prefixField) {\n // Add any prefix.\n index = this.insertFieldAt(index, field.prefixField);\n }\n // Add the field to the field row.\n this.fieldRow.splice(index, 0, field);\n index++;\n if (field.suffixField) {\n // Add any suffix.\n index = this.insertFieldAt(index, field.suffixField);\n }\n\n if (this.sourceBlock_.rendered) {\n (this.sourceBlock_ as BlockSvg).render();\n // Adding a field will cause the block to change shape.\n this.sourceBlock_.bumpNeighbours();\n }\n return index;\n }\n\n /**\n * Remove a field from this input.\n *\n * @param name The name of the field.\n * @param opt_quiet True to prevent an error if field is not present.\n * @returns True if operation succeeds, false if field is not present and\n * opt_quiet is true.\n * @throws {Error} if the field is not present and opt_quiet is false.\n */\n removeField(name: string, opt_quiet?: boolean): boolean {\n for (let i = 0, field; field = this.fieldRow[i]; i++) {\n if (field.name === name) {\n field.dispose();\n this.fieldRow.splice(i, 1);\n if (this.sourceBlock_.rendered) {\n (this.sourceBlock_ as BlockSvg).render();\n // Removing a field will cause the block to change shape.\n this.sourceBlock_.bumpNeighbours();\n }\n return true;\n }\n }\n if (opt_quiet) {\n return false;\n }\n throw Error('Field \"' + name + '\" not found.');\n }\n\n /**\n * Gets whether this input is visible or not.\n *\n * @returns True if visible.\n */\n isVisible(): boolean {\n return this.visible_;\n }\n\n /**\n * Sets whether this input is visible or not.\n * Should only be used to collapse/uncollapse a block.\n *\n * @param visible True if visible.\n * @returns List of blocks to render.\n * @internal\n */\n setVisible(visible: boolean): BlockSvg[] {\n // Note: Currently there are only unit tests for block.setCollapsed()\n // because this function is package. If this function goes back to being a\n // public API tests (lots of tests) should be added.\n let renderList: AnyDuringMigration[] = [];\n if (this.visible_ === visible) {\n return renderList;\n }\n this.visible_ = visible;\n\n for (let y = 0, field; field = this.fieldRow[y]; y++) {\n field.setVisible(visible);\n }\n if (this.connection) {\n const renderedConnection = this.connection as RenderedConnection;\n // Has a connection.\n if (visible) {\n renderList = renderedConnection.startTrackingAll();\n } else {\n renderedConnection.stopTrackingAll();\n }\n const child = renderedConnection.targetBlock();\n if (child) {\n child.getSvgRoot().style.display = visible ? 'block' : 'none';\n }\n }\n return renderList;\n }\n\n /**\n * Mark all fields on this input as dirty.\n *\n * @internal\n */\n markDirty() {\n for (let y = 0, field; field = this.fieldRow[y]; y++) {\n field.markDirty();\n }\n }\n\n /**\n * Change a connection's compatibility.\n *\n * @param check Compatible value type or list of value types. Null if all\n * types are compatible.\n * @returns The input being modified (to allow chaining).\n */\n setCheck(check: string|string[]|null): Input {\n if (!this.connection) {\n throw Error('This input does not have a connection.');\n }\n this.connection.setCheck(check);\n return this;\n }\n\n /**\n * Change the alignment of the connection's field(s).\n *\n * @param align One of the values of Align. In RTL mode directions\n * are reversed, and Align.RIGHT aligns to the left.\n * @returns The input being modified (to allow chaining).\n */\n setAlign(align: Align): Input {\n this.align = align;\n if (this.sourceBlock_.rendered) {\n const sourceBlock = this.sourceBlock_ as BlockSvg;\n sourceBlock.render();\n }\n return this;\n }\n\n /**\n * Changes the connection's shadow block.\n *\n * @param shadow DOM representation of a block or null.\n * @returns The input being modified (to allow chaining).\n */\n setShadowDom(shadow: Element|null): Input {\n if (!this.connection) {\n throw Error('This input does not have a connection.');\n }\n this.connection.setShadowDom(shadow);\n return this;\n }\n\n /**\n * Returns the XML representation of the connection's shadow block.\n *\n * @returns Shadow DOM representation of a block or null.\n */\n getShadowDom(): Element|null {\n if (!this.connection) {\n throw Error('This input does not have a connection.');\n }\n return this.connection.getShadowDom();\n }\n\n /** Initialize the fields on this input. */\n init() {\n if (!this.sourceBlock_.workspace.rendered) {\n return; // Headless blocks don't need fields initialized.\n }\n for (let i = 0; i < this.fieldRow.length; i++) {\n this.fieldRow[i].init();\n }\n }\n\n /**\n * Sever all links to this input.\n *\n * @suppress {checkTypes}\n */\n dispose() {\n for (let i = 0, field; field = this.fieldRow[i]; i++) {\n field.dispose();\n }\n if (this.connection) {\n this.connection.dispose();\n }\n }\n}\n\nexport namespace Input {\n /**\n * Enum for alignment of inputs.\n *\n * @alias Blockly.Input.Align\n */\n export enum Align {\n LEFT = -1,\n CENTRE = 0,\n RIGHT = 1,\n }\n}\n\nexport type Align = Input.Align;\nexport const Align = Input.Align;\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing one block.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Block');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_create.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_delete.js';\n\nimport {Blocks} from './blocks.js';\nimport type {Comment} from './comment.js';\nimport * as common from './common.js';\nimport {Connection} from './connection.js';\nimport {ConnectionType} from './connection_type.js';\nimport * as constants from './constants.js';\nimport type {Abstract} from './events/events_abstract.js';\nimport type {BlockMove} from './events/events_block_move.js';\nimport * as eventUtils from './events/utils.js';\nimport * as Extensions from './extensions.js';\nimport type {Field} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {Align, Input} from './input.js';\nimport {inputTypes} from './input_types.js';\nimport type {IASTNodeLocation} from './interfaces/i_ast_node_location.js';\nimport type {IDeletable} from './interfaces/i_deletable.js';\nimport {ASTNode} from './keyboard_nav/ast_node.js';\nimport type {Mutator} from './mutator.js';\nimport * as Tooltip from './tooltip.js';\nimport * as arrayUtils from './utils/array.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport * as parsing from './utils/parsing.js';\nimport {Size} from './utils/size.js';\nimport type {VariableModel} from './variable_model.js';\nimport type {Workspace} from './workspace.js';\n\n\n/**\n * Class for one block.\n * Not normally called directly, workspace.newBlock() is preferred.\n *\n * @alias Blockly.Block\n */\nexport class Block implements IASTNodeLocation, IDeletable {\n /**\n * An optional callback method to use whenever the block's parent workspace\n * changes. This is usually only called from the constructor, the block type\n * initializer function, or an extension initializer function.\n */\n onchange?: ((p1: Abstract) => AnyDuringMigration)|null;\n\n /** The language-neutral ID given to the collapsed input. */\n static readonly COLLAPSED_INPUT_NAME: string = constants.COLLAPSED_INPUT_NAME;\n\n /** The language-neutral ID given to the collapsed field. */\n static readonly COLLAPSED_FIELD_NAME: string = constants.COLLAPSED_FIELD_NAME;\n\n /**\n * Optional text data that round-trips between blocks and XML.\n * Has no effect. May be used by 3rd parties for meta information.\n */\n data: string|null = null;\n\n /**\n * Has this block been disposed of?\n *\n * @internal\n */\n disposed = false;\n\n /**\n * Colour of the block as HSV hue value (0-360)\n * This may be null if the block colour was not set via a hue number.\n */\n private hue_: number|null = null;\n\n /** Colour of the block in '#RRGGBB' format. */\n protected colour_ = '#000000';\n\n /** Name of the block style. */\n protected styleName_ = '';\n\n /** An optional method called during initialization. */\n init?: (() => AnyDuringMigration)|null = undefined;\n\n /**\n * An optional serialization method for defining how to serialize the\n * mutation state to XML. This must be coupled with defining\n * `domToMutation`.\n */\n mutationToDom?: ((...p1: AnyDuringMigration[]) => Element)|null = undefined;\n\n /**\n * An optional deserialization method for defining how to deserialize the\n * mutation state from XML. This must be coupled with defining\n * `mutationToDom`.\n */\n domToMutation?: ((p1: Element) => AnyDuringMigration)|null = undefined;\n\n /**\n * An optional serialization method for defining how to serialize the\n * block's extra state (eg mutation state) to something JSON compatible.\n * This must be coupled with defining `loadExtraState`.\n */\n saveExtraState?: (() => AnyDuringMigration)|null = undefined;\n\n /**\n * An optional serialization method for defining how to deserialize the\n * block's extra state (eg mutation state) from something JSON compatible.\n * This must be coupled with defining `saveExtraState`.\n */\n loadExtraState?:\n ((p1: AnyDuringMigration) => AnyDuringMigration)|null = undefined;\n\n /**\n * An optional property for suppressing adding STATEMENT_PREFIX and\n * STATEMENT_SUFFIX to generated code.\n */\n suppressPrefixSuffix: boolean|null = false;\n\n /**\n * An optional property for declaring developer variables. Return a list of\n * variable names for use by generators. Developer variables are never\n * shown to the user, but are declared as global variables in the generated\n * code.\n */\n getDeveloperVariables?: (() => string[]) = undefined;\n\n /**\n * An optional function that reconfigures the block based on the contents of\n * the mutator dialog.\n */\n compose?: ((p1: Block) => void) = undefined;\n\n /**\n * An optional function that populates the mutator's dialog with\n * this block's components.\n */\n decompose?: ((p1: Workspace) => Block) = undefined;\n id: string;\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Connection'.\n outputConnection: Connection = null as AnyDuringMigration;\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Connection'.\n nextConnection: Connection = null as AnyDuringMigration;\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Connection'.\n previousConnection: Connection = null as AnyDuringMigration;\n inputList: Input[] = [];\n inputsInline?: boolean = undefined;\n private disabled = false;\n tooltip: Tooltip.TipInfo = '';\n contextMenu = true;\n\n protected parentBlock_: this|null = null;\n\n protected childBlocks_: this[] = [];\n\n private deletable_ = true;\n\n private movable_ = true;\n\n private editable_ = true;\n\n private isShadow_ = false;\n\n protected collapsed_ = false;\n protected outputShape_: number|null = null;\n\n /**\n * Is the current block currently in the process of being disposed?\n */\n private disposing = false;\n\n /**\n * A string representing the comment attached to this block.\n *\n * @deprecated August 2019. Use getCommentText instead.\n */\n comment: string|Comment|null = null;\n /** @internal */\n commentModel: CommentModel;\n private readonly xy_: Coordinate;\n isInFlyout: boolean;\n isInMutator: boolean;\n RTL: boolean;\n\n /** True if this block is an insertion marker. */\n protected isInsertionMarker_ = false;\n\n /** Name of the type of hat. */\n hat?: string = undefined;\n\n rendered: boolean|null = null;\n\n /**\n * String for block help, or function that returns a URL. Null for no help.\n */\n // AnyDuringMigration because: Type 'null' is not assignable to type 'string\n // | Function'.\n helpUrl: string|Function = null as AnyDuringMigration;\n\n /** A bound callback function to use when the parent workspace changes. */\n private onchangeWrapper_: ((p1: Abstract) => AnyDuringMigration)|null = null;\n\n /**\n * A count of statement inputs on the block.\n *\n * @internal\n */\n statementInputCount = 0;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n type!: string;\n // Record initial inline state.\n inputsInlineDefault?: boolean;\n workspace: Workspace;\n\n /**\n * @param workspace The block's workspace.\n * @param prototypeName Name of the language object containing type-specific\n * functions for this block.\n * @param opt_id Optional ID. Use this ID if provided, otherwise create a new\n * ID.\n * @throws When the prototypeName is not valid or not allowed.\n */\n constructor(workspace: Workspace, prototypeName: string, opt_id?: string) {\n this.workspace = workspace;\n\n this.id = opt_id && !workspace.getBlockById(opt_id) ? opt_id :\n idGenerator.genUid();\n workspace.setBlockById(this.id, this);\n\n /** A model of the comment attached to this block. */\n this.commentModel = {text: null, pinned: false, size: new Size(160, 80)};\n\n /**\n * The block's position in workspace units. (0, 0) is at the workspace's\n * origin; scale does not change this value.\n */\n this.xy_ = new Coordinate(0, 0);\n this.isInFlyout = workspace.isFlyout;\n this.isInMutator = workspace.isMutator;\n\n this.RTL = workspace.RTL;\n\n // Copy the type-specific functions and data from the prototype.\n if (prototypeName) {\n this.type = prototypeName;\n const prototype = Blocks[prototypeName];\n if (!prototype || typeof prototype !== 'object') {\n throw TypeError('Invalid block definition for type: ' + prototypeName);\n }\n Object.assign(this, prototype);\n }\n\n workspace.addTopBlock(this);\n workspace.addTypedBlock(this);\n\n if (new.target === Block) {\n this.doInit_();\n }\n }\n\n /** Calls the init() function and handles associated event firing, etc. */\n protected doInit_() {\n // All events fired should be part of the same group.\n // Any events fired during init should not be undoable,\n // so that block creation is atomic.\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n const initialUndoFlag = eventUtils.getRecordUndo();\n\n try {\n // Call an initialization function, if it exists.\n if (typeof this.init === 'function') {\n eventUtils.setRecordUndo(false);\n this.init();\n eventUtils.setRecordUndo(initialUndoFlag);\n }\n\n // Fire a create event.\n if (eventUtils.isEnabled()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CREATE))(this));\n }\n } finally {\n if (!existingGroup) {\n eventUtils.setGroup(false);\n }\n // In case init threw, recordUndo flag should still be reset.\n eventUtils.setRecordUndo(initialUndoFlag);\n }\n this.inputsInlineDefault = this.inputsInline;\n\n // Bind an onchange function, if it exists.\n if (typeof this.onchange === 'function') {\n this.setOnChange(this.onchange);\n }\n }\n\n /**\n * Dispose of this block.\n *\n * @param healStack If true, then try to heal any gap by connecting the next\n * statement with the previous statement. Otherwise, dispose of all\n * children of this block.\n * @suppress {checkTypes}\n */\n dispose(healStack: boolean) {\n if (this.isDeadOrDying()) {\n return;\n }\n\n this.unplug(healStack);\n if (eventUtils.isEnabled()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_DELETE))(this));\n }\n\n if (this.onchangeWrapper_) {\n this.workspace.removeChangeListener(this.onchangeWrapper_);\n }\n\n eventUtils.disable();\n\n try {\n // This block is now at the top of the workspace.\n // Remove this block from the workspace's list of top-most blocks.\n this.workspace.removeTopBlock(this);\n this.workspace.removeTypedBlock(this);\n // Remove from block database.\n this.workspace.removeBlockById(this.id);\n this.disposing = true;\n\n // First, dispose of all my children.\n for (let i = this.childBlocks_.length - 1; i >= 0; i--) {\n this.childBlocks_[i].dispose(false);\n }\n // Then dispose of myself.\n // Dispose of all inputs and their fields.\n for (let i = 0, input; input = this.inputList[i]; i++) {\n input.dispose();\n }\n this.inputList.length = 0;\n // Dispose of any remaining connections (next/previous/output).\n const connections = this.getConnections_(true);\n for (let i = 0, connection; connection = connections[i]; i++) {\n connection.dispose();\n }\n } finally {\n eventUtils.enable();\n this.disposed = true;\n }\n }\n\n /**\n * Returns true if the block is either in the process of being disposed, or\n * is disposed.\n *\n * @internal\n */\n isDeadOrDying(): boolean {\n return this.disposing || this.disposed;\n }\n\n /**\n * Call initModel on all fields on the block.\n * May be called more than once.\n * Either initModel or initSvg must be called after creating a block and\n * before the first interaction with it. Interactions include UI actions\n * (e.g. clicking and dragging) and firing events (e.g. create, delete, and\n * change).\n */\n initModel() {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n if (field.initModel) {\n field.initModel();\n }\n }\n }\n }\n\n /**\n * Unplug this block from its superior block. If this block is a statement,\n * optionally reconnect the block underneath with the block on top.\n *\n * @param opt_healStack Disconnect child statement and reconnect stack.\n * Defaults to false.\n */\n unplug(opt_healStack?: boolean) {\n if (this.outputConnection) {\n this.unplugFromRow_(opt_healStack);\n }\n if (this.previousConnection) {\n this.unplugFromStack_(opt_healStack);\n }\n }\n\n /**\n * Unplug this block's output from an input on another block. Optionally\n * reconnect the block's parent to the only child block, if possible.\n *\n * @param opt_healStack Disconnect right-side block and connect to left-side\n * block. Defaults to false.\n */\n private unplugFromRow_(opt_healStack?: boolean) {\n let parentConnection = null;\n if (this.outputConnection.isConnected()) {\n parentConnection = this.outputConnection.targetConnection;\n // Disconnect from any superior block.\n this.outputConnection.disconnect();\n }\n\n // Return early in obvious cases.\n if (!parentConnection || !opt_healStack) {\n return;\n }\n\n const thisConnection = this.getOnlyValueConnection_();\n if (!thisConnection || !thisConnection.isConnected() ||\n thisConnection.targetBlock()!.isShadow()) {\n // Too many or too few possible connections on this block, or there's\n // nothing on the other side of this connection.\n return;\n }\n\n const childConnection = thisConnection.targetConnection;\n // Disconnect the child block.\n childConnection?.disconnect();\n // Connect child to the parent if possible, otherwise bump away.\n if (this.workspace.connectionChecker.canConnect(\n childConnection, parentConnection, false)) {\n parentConnection.connect(childConnection!);\n } else {\n childConnection?.onFailedConnect(parentConnection);\n }\n }\n\n /**\n * Returns the connection on the value input that is connected to another\n * block. When an insertion marker is connected to a connection with a block\n * already attached, the connected block is attached to the insertion marker.\n * Since only one block can be displaced and attached to the insertion marker\n * this should only ever return one connection.\n *\n * @returns The connection on the value input, or null.\n */\n private getOnlyValueConnection_(): Connection|null {\n let connection = null;\n for (let i = 0; i < this.inputList.length; i++) {\n const thisConnection = this.inputList[i].connection;\n if (thisConnection &&\n thisConnection.type === ConnectionType.INPUT_VALUE &&\n thisConnection.targetConnection) {\n if (connection) {\n return null; // More than one value input found.\n }\n connection = thisConnection;\n }\n }\n return connection;\n }\n\n /**\n * Unplug this statement block from its superior block. Optionally reconnect\n * the block underneath with the block on top.\n *\n * @param opt_healStack Disconnect child statement and reconnect stack.\n * Defaults to false.\n */\n private unplugFromStack_(opt_healStack?: boolean) {\n let previousTarget = null;\n if (this.previousConnection.isConnected()) {\n // Remember the connection that any next statements need to connect to.\n previousTarget = this.previousConnection.targetConnection;\n // Detach this block from the parent's tree.\n this.previousConnection.disconnect();\n }\n const nextBlock = this.getNextBlock();\n if (opt_healStack && nextBlock && !nextBlock.isShadow()) {\n // Disconnect the next statement.\n const nextTarget = this.nextConnection.targetConnection;\n nextTarget?.disconnect();\n if (previousTarget &&\n this.workspace.connectionChecker.canConnect(\n previousTarget, nextTarget, false)) {\n // Attach the next statement to the previous statement.\n previousTarget.connect(nextTarget!);\n }\n }\n }\n\n /**\n * Returns all connections originating from this block.\n *\n * @param _all If true, return all connections even hidden ones.\n * @returns Array of connections.\n * @internal\n */\n getConnections_(_all: boolean): Connection[] {\n const myConnections = [];\n if (this.outputConnection) {\n myConnections.push(this.outputConnection);\n }\n if (this.previousConnection) {\n myConnections.push(this.previousConnection);\n }\n if (this.nextConnection) {\n myConnections.push(this.nextConnection);\n }\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.connection) {\n myConnections.push(input.connection);\n }\n }\n return myConnections;\n }\n\n /**\n * Walks down a stack of blocks and finds the last next connection on the\n * stack.\n *\n * @param ignoreShadows If true,the last connection on a non-shadow block will\n * be returned. If false, this will follow shadows to find the last\n * connection.\n * @returns The last next connection on the stack, or null.\n * @internal\n */\n lastConnectionInStack(ignoreShadows: boolean): Connection|null {\n let nextConnection = this.nextConnection;\n while (nextConnection) {\n const nextBlock = nextConnection.targetBlock();\n if (!nextBlock || ignoreShadows && nextBlock.isShadow()) {\n return nextConnection;\n }\n nextConnection = nextBlock.nextConnection;\n }\n return null;\n }\n\n /**\n * Bump unconnected blocks out of alignment. Two blocks which aren't actually\n * connected should not coincidentally line up on screen.\n */\n bumpNeighbours() {}\n // noop.\n\n /**\n * Return the parent block or null if this block is at the top level. The\n * parent block is either the block connected to the previous connection (for\n * a statement block) or the block connected to the output connection (for a\n * value block).\n *\n * @returns The block (if any) that holds the current block.\n */\n getParent(): this|null {\n return this.parentBlock_;\n }\n\n /**\n * Return the input that connects to the specified block.\n *\n * @param block A block connected to an input on this block.\n * @returns The input (if any) that connects to the specified block.\n */\n getInputWithBlock(block: Block): Input|null {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.connection && input.connection.targetBlock() === block) {\n return input;\n }\n }\n return null;\n }\n\n /**\n * Return the parent block that surrounds the current block, or null if this\n * block has no surrounding block. A parent block might just be the previous\n * statement, whereas the surrounding block is an if statement, while loop,\n * etc.\n *\n * @returns The block (if any) that surrounds the current block.\n */\n getSurroundParent(): this|null {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let block: this|null = this;\n let prevBlock;\n do {\n prevBlock = block;\n block = block.getParent();\n if (!block) {\n // Ran off the top.\n return null;\n }\n } while (block.getNextBlock() === prevBlock);\n // This block is an enclosing parent, not just a statement in a stack.\n return block;\n }\n\n /**\n * Return the next statement block directly connected to this block.\n *\n * @returns The next statement block or null.\n */\n getNextBlock(): Block|null {\n return this.nextConnection && this.nextConnection.targetBlock();\n }\n\n /**\n * Returns the block connected to the previous connection.\n *\n * @returns The previous statement block or null.\n */\n getPreviousBlock(): Block|null {\n return this.previousConnection && this.previousConnection.targetBlock();\n }\n\n /**\n * Return the connection on the first statement input on this block, or null\n * if there are none.\n *\n * @returns The first statement connection or null.\n * @internal\n */\n getFirstStatementConnection(): Connection|null {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.connection &&\n input.connection.type === ConnectionType.NEXT_STATEMENT) {\n return input.connection;\n }\n }\n return null;\n }\n\n /**\n * Return the top-most block in this block's tree.\n * This will return itself if this block is at the top level.\n *\n * @returns The root block.\n */\n getRootBlock(): this {\n let rootBlock: this;\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let block: this|null = this;\n do {\n rootBlock = block;\n block = rootBlock.parentBlock_;\n } while (block);\n return rootBlock;\n }\n\n /**\n * Walk up from the given block up through the stack of blocks to find\n * the top block of the sub stack. If we are nested in a statement input only\n * find the top-most nested block. Do not go all the way to the root block.\n *\n * @returns The top block in a stack.\n * @internal\n */\n getTopStackBlock(): this {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let block = this;\n let previous;\n do {\n previous = block.getPreviousBlock();\n // AnyDuringMigration because: Type 'Block' is not assignable to type\n // 'this'.\n } while (previous && previous.getNextBlock() === block &&\n (block = previous as AnyDuringMigration));\n return block;\n }\n\n /**\n * Find all the blocks that are directly nested inside this one.\n * Includes value and statement inputs, as well as any following statement.\n * Excludes any connection on an output tab or any preceding statement.\n * Blocks are optionally sorted by position; top to bottom.\n *\n * @param ordered Sort the list if true.\n * @returns Array of blocks.\n */\n getChildren(ordered: boolean): Block[] {\n if (!ordered) {\n return this.childBlocks_;\n }\n const blocks = [];\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.connection) {\n const child = input.connection.targetBlock();\n if (child) {\n blocks.push(child);\n }\n }\n }\n const next = this.getNextBlock();\n if (next) {\n blocks.push(next);\n }\n return blocks;\n }\n\n /**\n * Set parent of this block to be a new block or null.\n *\n * @param newParent New parent block.\n * @internal\n */\n setParent(newParent: this|null) {\n if (newParent === this.parentBlock_) {\n return;\n }\n\n // Check that block is connected to new parent if new parent is not null and\n // that block is not connected to superior one if new parent is null.\n const targetBlock =\n this.previousConnection && this.previousConnection.targetBlock() ||\n this.outputConnection && this.outputConnection.targetBlock();\n const isConnected = !!targetBlock;\n\n if (isConnected && newParent && targetBlock !== newParent) {\n throw Error('Block connected to superior one that is not new parent.');\n } else if (!isConnected && newParent) {\n throw Error('Block not connected to new parent.');\n } else if (isConnected && !newParent) {\n throw Error(\n 'Cannot set parent to null while block is still connected to' +\n ' superior block.');\n }\n\n // This block hasn't actually moved on-screen, so there's no need to\n // update\n // its connection locations.\n if (this.parentBlock_) {\n // Remove this block from the old parent's child list.\n arrayUtils.removeElem(this.parentBlock_.childBlocks_, this);\n } else {\n // New parent must be non-null so remove this block from the workspace's\n // list of top-most blocks.\n this.workspace.removeTopBlock(this);\n }\n\n this.parentBlock_ = newParent;\n if (newParent) {\n // Add this block to the new parent's child list.\n newParent.childBlocks_.push(this);\n } else {\n this.workspace.addTopBlock(this);\n }\n }\n\n /**\n * Find all the blocks that are directly or indirectly nested inside this one.\n * Includes this block in the list.\n * Includes value and statement inputs, as well as any following statements.\n * Excludes any connection on an output tab or any preceding statements.\n * Blocks are optionally sorted by position; top to bottom.\n *\n * @param ordered Sort the list if true.\n * @returns Flattened array of blocks.\n */\n getDescendants(ordered: boolean): this[] {\n const blocks = [this];\n const childBlocks = this.getChildren(ordered);\n for (let child, i = 0; child = childBlocks[i]; i++) {\n // AnyDuringMigration because: Argument of type 'Block[]' is not\n // assignable to parameter of type 'this[]'.\n blocks.push(...child.getDescendants(ordered) as AnyDuringMigration);\n }\n return blocks;\n }\n\n /**\n * Get whether this block is deletable or not.\n *\n * @returns True if deletable.\n */\n isDeletable(): boolean {\n return this.deletable_ && !this.isShadow_ && !this.isDeadOrDying() &&\n !this.workspace.options.readOnly;\n }\n\n /**\n * Set whether this block is deletable or not.\n *\n * @param deletable True if deletable.\n */\n setDeletable(deletable: boolean) {\n this.deletable_ = deletable;\n }\n\n /**\n * Get whether this block is movable or not.\n *\n * @returns True if movable.\n */\n isMovable(): boolean {\n return this.movable_ && !this.isShadow_ && !this.isDeadOrDying() &&\n !this.workspace.options.readOnly;\n }\n\n /**\n * Set whether this block is movable or not.\n *\n * @param movable True if movable.\n */\n setMovable(movable: boolean) {\n this.movable_ = movable;\n }\n\n /**\n * Get whether is block is duplicatable or not. If duplicating this block and\n * descendants will put this block over the workspace's capacity this block is\n * not duplicatable. If duplicating this block and descendants will put any\n * type over their maxInstances this block is not duplicatable.\n *\n * @returns True if duplicatable.\n */\n isDuplicatable(): boolean {\n if (!this.workspace.hasBlockLimits()) {\n return true;\n }\n return this.workspace.isCapacityAvailable(\n common.getBlockTypeCounts(this, true));\n }\n\n /**\n * Get whether this block is a shadow block or not.\n *\n * @returns True if a shadow.\n */\n isShadow(): boolean {\n return this.isShadow_;\n }\n\n /**\n * Set whether this block is a shadow block or not.\n *\n * @param shadow True if a shadow.\n * @internal\n */\n setShadow(shadow: boolean) {\n this.isShadow_ = shadow;\n }\n\n /**\n * Get whether this block is an insertion marker block or not.\n *\n * @returns True if an insertion marker.\n */\n isInsertionMarker(): boolean {\n return this.isInsertionMarker_;\n }\n\n /**\n * Set whether this block is an insertion marker block or not.\n * Once set this cannot be unset.\n *\n * @param insertionMarker True if an insertion marker.\n * @internal\n */\n setInsertionMarker(insertionMarker: boolean) {\n this.isInsertionMarker_ = insertionMarker;\n }\n\n /**\n * Get whether this block is editable or not.\n *\n * @returns True if editable.\n */\n isEditable(): boolean {\n return this.editable_ && !this.isDeadOrDying() &&\n !this.workspace.options.readOnly;\n }\n\n /**\n * Set whether this block is editable or not.\n *\n * @param editable True if editable.\n */\n setEditable(editable: boolean) {\n this.editable_ = editable;\n for (let i = 0, input; input = this.inputList[i]; i++) {\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n field.updateEditable();\n }\n }\n }\n\n /**\n * Returns if this block has been disposed of / deleted.\n *\n * @returns True if this block has been disposed of / deleted.\n */\n isDisposed(): boolean {\n return this.disposed;\n }\n\n /**\n * Find the connection on this block that corresponds to the given connection\n * on the other block.\n * Used to match connections between a block and its insertion marker.\n *\n * @param otherBlock The other block to match against.\n * @param conn The other connection to match.\n * @returns The matching connection on this block, or null.\n * @internal\n */\n getMatchingConnection(otherBlock: Block, conn: Connection): Connection|null {\n const connections = this.getConnections_(true);\n const otherConnections = otherBlock.getConnections_(true);\n if (connections.length !== otherConnections.length) {\n throw Error('Connection lists did not match in length.');\n }\n for (let i = 0; i < otherConnections.length; i++) {\n if (otherConnections[i] === conn) {\n return connections[i];\n }\n }\n return null;\n }\n\n /**\n * Set the URL of this block's help page.\n *\n * @param url URL string for block help, or function that returns a URL. Null\n * for no help.\n */\n setHelpUrl(url: string|Function) {\n this.helpUrl = url;\n }\n\n /**\n * Sets the tooltip for this block.\n *\n * @param newTip The text for the tooltip, a function that returns the text\n * for the tooltip, or a parent object whose tooltip will be used. To not\n * display a tooltip pass the empty string.\n */\n setTooltip(newTip: Tooltip.TipInfo) {\n this.tooltip = newTip;\n }\n\n /**\n * Returns the tooltip text for this block.\n *\n * @returns The tooltip text for this block.\n */\n getTooltip(): string {\n return Tooltip.getTooltipOfObject(this);\n }\n\n /**\n * Get the colour of a block.\n *\n * @returns #RRGGBB string.\n */\n getColour(): string {\n return this.colour_;\n }\n\n /**\n * Get the name of the block style.\n *\n * @returns Name of the block style.\n */\n getStyleName(): string {\n return this.styleName_;\n }\n\n /**\n * Get the HSV hue value of a block. Null if hue not set.\n *\n * @returns Hue value (0-360).\n */\n getHue(): number|null {\n return this.hue_;\n }\n\n /**\n * Change the colour of a block.\n *\n * @param colour HSV hue value (0 to 360), #RRGGBB string, or a message\n * reference string pointing to one of those two values.\n */\n setColour(colour: number|string) {\n const parsed = parsing.parseBlockColour(colour);\n this.hue_ = parsed.hue;\n this.colour_ = parsed.hex;\n }\n\n /**\n * Set the style and colour values of a block.\n *\n * @param blockStyleName Name of the block style.\n */\n setStyle(blockStyleName: string) {\n this.styleName_ = blockStyleName;\n }\n\n /**\n * Sets a callback function to use whenever the block's parent workspace\n * changes, replacing any prior onchange handler. This is usually only called\n * from the constructor, the block type initializer function, or an extension\n * initializer function.\n *\n * @param onchangeFn The callback to call when the block's workspace changes.\n * @throws {Error} if onchangeFn is not falsey and not a function.\n */\n setOnChange(onchangeFn: (p1: Abstract) => AnyDuringMigration) {\n if (onchangeFn && typeof onchangeFn !== 'function') {\n throw Error('onchange must be a function.');\n }\n if (this.onchangeWrapper_) {\n this.workspace.removeChangeListener(this.onchangeWrapper_);\n }\n this.onchange = onchangeFn;\n this.onchangeWrapper_ = onchangeFn.bind(this);\n this.workspace.addChangeListener(this.onchangeWrapper_);\n }\n\n /**\n * Returns the named field from a block.\n *\n * @param name The name of the field.\n * @returns Named field, or null if field does not exist.\n */\n getField(name: string): Field|null {\n if (typeof name !== 'string') {\n throw TypeError(\n 'Block.prototype.getField expects a string ' +\n 'with the field name but received ' +\n (name === undefined ? 'nothing' : name + ' of type ' + typeof name) +\n ' instead');\n }\n for (let i = 0, input; input = this.inputList[i]; i++) {\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n if (field.name === name) {\n return field;\n }\n }\n }\n return null;\n }\n\n /**\n * Return all variables referenced by this block.\n *\n * @returns List of variable ids.\n */\n getVars(): string[] {\n const vars = [];\n for (let i = 0, input; input = this.inputList[i]; i++) {\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n if (field.referencesVariables()) {\n vars.push(field.getValue());\n }\n }\n }\n return vars;\n }\n\n /**\n * Return all variables referenced by this block.\n *\n * @returns List of variable models.\n * @internal\n */\n getVarModels(): VariableModel[] {\n const vars = [];\n for (let i = 0, input; input = this.inputList[i]; i++) {\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n if (field.referencesVariables()) {\n const model =\n this.workspace.getVariableById(field.getValue() as string);\n // Check if the variable actually exists (and isn't just a potential\n // variable).\n if (model) {\n vars.push(model);\n }\n }\n }\n }\n return vars;\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 *\n * @param variable The variable being renamed.\n * @internal\n */\n updateVarName(variable: VariableModel) {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n if (field.referencesVariables() &&\n variable.getId() === field.getValue()) {\n field.refreshVariableName();\n }\n }\n }\n }\n\n /**\n * Notification that a variable is renaming.\n * If the ID matches one of this block's variables, rename it.\n *\n * @param oldId ID of variable to rename.\n * @param newId ID of new variable. May be the same as oldId, but with an\n * updated name.\n */\n renameVarById(oldId: string, newId: string) {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n if (field.referencesVariables() && oldId === field.getValue()) {\n field.setValue(newId);\n }\n }\n }\n }\n\n /**\n * Returns the language-neutral value of the given field.\n *\n * @param name The name of the field.\n * @returns Value of the field or null if field does not exist.\n */\n getFieldValue(name: string): AnyDuringMigration {\n const field = this.getField(name);\n if (field) {\n return field.getValue();\n }\n return null;\n }\n\n /**\n * Sets the value of the given field for this block.\n *\n * @param newValue The value to set.\n * @param name The name of the field to set the value of.\n */\n setFieldValue(newValue: AnyDuringMigration, name: string) {\n const field = this.getField(name);\n if (!field) {\n throw Error('Field \"' + name + '\" not found.');\n }\n field.setValue(newValue);\n }\n\n /**\n * Set whether this block can chain onto the bottom of another block.\n *\n * @param newBoolean True if there can be a previous statement.\n * @param opt_check Statement type or list of statement types. Null/undefined\n * if any type could be connected.\n */\n setPreviousStatement(newBoolean: boolean, opt_check?: string|string[]|null) {\n if (newBoolean) {\n if (opt_check === undefined) {\n opt_check = null;\n }\n if (!this.previousConnection) {\n this.previousConnection =\n this.makeConnection_(ConnectionType.PREVIOUS_STATEMENT);\n }\n this.previousConnection.setCheck(opt_check);\n } else {\n if (this.previousConnection) {\n if (this.previousConnection.isConnected()) {\n throw Error(\n 'Must disconnect previous statement before removing ' +\n 'connection.');\n }\n this.previousConnection.dispose();\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Connection'.\n this.previousConnection = null as AnyDuringMigration;\n }\n }\n }\n\n /**\n * Set whether another block can chain onto the bottom of this block.\n *\n * @param newBoolean True if there can be a next statement.\n * @param opt_check Statement type or list of statement types. Null/undefined\n * if any type could be connected.\n */\n setNextStatement(newBoolean: boolean, opt_check?: string|string[]|null) {\n if (newBoolean) {\n if (opt_check === undefined) {\n opt_check = null;\n }\n if (!this.nextConnection) {\n this.nextConnection =\n this.makeConnection_(ConnectionType.NEXT_STATEMENT);\n }\n this.nextConnection.setCheck(opt_check);\n } else {\n if (this.nextConnection) {\n if (this.nextConnection.isConnected()) {\n throw Error(\n 'Must disconnect next statement before removing ' +\n 'connection.');\n }\n this.nextConnection.dispose();\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Connection'.\n this.nextConnection = null as AnyDuringMigration;\n }\n }\n }\n\n /**\n * Set whether this block returns a value.\n *\n * @param newBoolean True if there is an output.\n * @param opt_check Returned type or list of returned types. Null or\n * undefined if any type could be returned (e.g. variable get).\n */\n setOutput(newBoolean: boolean, opt_check?: string|string[]|null) {\n if (newBoolean) {\n if (opt_check === undefined) {\n opt_check = null;\n }\n if (!this.outputConnection) {\n this.outputConnection =\n this.makeConnection_(ConnectionType.OUTPUT_VALUE);\n }\n this.outputConnection.setCheck(opt_check);\n } else {\n if (this.outputConnection) {\n if (this.outputConnection.isConnected()) {\n throw Error(\n 'Must disconnect output value before removing connection.');\n }\n this.outputConnection.dispose();\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Connection'.\n this.outputConnection = null as AnyDuringMigration;\n }\n }\n }\n\n /**\n * Set whether value inputs are arranged horizontally or vertically.\n *\n * @param newBoolean True if inputs are horizontal.\n */\n setInputsInline(newBoolean: boolean) {\n if (this.inputsInline !== newBoolean) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n this, 'inline', null, this.inputsInline, newBoolean));\n this.inputsInline = newBoolean;\n }\n }\n\n /**\n * Get whether value inputs are arranged horizontally or vertically.\n *\n * @returns True if inputs are horizontal.\n */\n getInputsInline(): boolean {\n if (this.inputsInline !== undefined) {\n // Set explicitly.\n return this.inputsInline;\n }\n // Not defined explicitly. Figure out what would look best.\n for (let i = 1; i < this.inputList.length; i++) {\n if (this.inputList[i - 1].type === inputTypes.DUMMY &&\n this.inputList[i].type === inputTypes.DUMMY) {\n // Two dummy inputs in a row. Don't inline them.\n return false;\n }\n }\n for (let i = 1; i < this.inputList.length; i++) {\n if (this.inputList[i - 1].type === inputTypes.VALUE &&\n this.inputList[i].type === inputTypes.DUMMY) {\n // Dummy input after a value input. Inline them.\n return true;\n }\n }\n return false;\n }\n\n /**\n * Set the block's output shape.\n *\n * @param outputShape Value representing an output shape.\n */\n setOutputShape(outputShape: number|null) {\n this.outputShape_ = outputShape;\n }\n\n /**\n * Get the block's output shape.\n *\n * @returns Value representing output shape if one exists.\n */\n getOutputShape(): number|null {\n return this.outputShape_;\n }\n\n /**\n * Get whether this block is enabled or not.\n *\n * @returns True if enabled.\n */\n isEnabled(): boolean {\n return !this.disabled;\n }\n\n /**\n * Set whether the block is enabled or not.\n *\n * @param enabled True if enabled.\n */\n setEnabled(enabled: boolean) {\n if (this.isEnabled() !== enabled) {\n const oldValue = this.disabled;\n this.disabled = !enabled;\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n this, 'disabled', null, oldValue, !enabled));\n }\n }\n\n /**\n * Get whether the block is disabled or not due to parents.\n * The block's own disabled property is not considered.\n *\n * @returns True if disabled.\n */\n getInheritedDisabled(): boolean {\n let ancestor = this.getSurroundParent();\n while (ancestor) {\n if (ancestor.disabled) {\n return true;\n }\n ancestor = ancestor.getSurroundParent();\n }\n // Ran off the top.\n return false;\n }\n\n /**\n * Get whether the block is collapsed or not.\n *\n * @returns True if collapsed.\n */\n isCollapsed(): boolean {\n return this.collapsed_;\n }\n\n /**\n * Set whether the block is collapsed or not.\n *\n * @param collapsed True if collapsed.\n */\n setCollapsed(collapsed: boolean) {\n if (this.collapsed_ !== collapsed) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n this, 'collapsed', null, this.collapsed_, collapsed));\n this.collapsed_ = collapsed;\n }\n }\n\n /**\n * Create a human-readable text representation of this block and any children.\n *\n * @param opt_maxLength Truncate the string to this length.\n * @param opt_emptyToken The placeholder string used to denote an empty field.\n * If not specified, '?' is used.\n * @returns Text of block.\n */\n toString(opt_maxLength?: number, opt_emptyToken?: string): string {\n const tokens = [];\n const emptyFieldPlaceholder = opt_emptyToken || '?';\n\n // Temporarily set flag to navigate to all fields.\n const prevNavigateFields = ASTNode.NAVIGATE_ALL_FIELDS;\n ASTNode.NAVIGATE_ALL_FIELDS = true;\n\n let node = ASTNode.createBlockNode(this);\n const rootNode = node;\n\n /**\n * Whether or not to add parentheses around an input.\n *\n * @param connection The connection.\n * @returns True if we should add parentheses around the input.\n */\n function shouldAddParentheses(connection: Connection): boolean {\n let checks = connection.getCheck();\n if (!checks && connection.targetConnection) {\n checks = connection.targetConnection.getCheck();\n }\n return !!checks &&\n (checks.indexOf('Boolean') !== -1 || checks.indexOf('Number') !== -1);\n }\n\n /** Check that we haven't circled back to the original root node. */\n function checkRoot() {\n if (node && node.getType() === rootNode?.getType() &&\n node.getLocation() === rootNode?.getLocation()) {\n node = null;\n }\n }\n\n // Traverse the AST building up our text string.\n while (node) {\n switch (node.getType()) {\n case ASTNode.types.INPUT: {\n const connection = node.getLocation() as Connection;\n if (!node.in()) {\n tokens.push(emptyFieldPlaceholder);\n } else if (shouldAddParentheses(connection)) {\n tokens.push('(');\n }\n break;\n }\n case ASTNode.types.FIELD: {\n const field = node.getLocation() as Field;\n if (field.name !== constants.COLLAPSED_FIELD_NAME) {\n tokens.push(field.getText());\n }\n break;\n }\n }\n\n const current = node;\n node = current.in() || current.next();\n if (!node) {\n // Can't go in or next, keep going out until we can go next.\n node = current.out();\n checkRoot();\n while (node && !node.next()) {\n node = node.out();\n checkRoot();\n // If we hit an input on the way up, possibly close out parentheses.\n if (node && node.getType() === ASTNode.types.INPUT &&\n shouldAddParentheses(node.getLocation() as Connection)) {\n tokens.push(')');\n }\n }\n if (node) {\n node = node.next();\n }\n }\n }\n\n // Restore state of NAVIGATE_ALL_FIELDS.\n ASTNode.NAVIGATE_ALL_FIELDS = prevNavigateFields;\n\n // Run through our text array and simplify expression to remove parentheses\n // around single field blocks.\n // E.g. ['repeat', '(', '10', ')', 'times', 'do', '?']\n for (let i = 2; i < tokens.length; i++) {\n if (tokens[i - 2] === '(' && tokens[i] === ')') {\n tokens[i - 2] = tokens[i - 1];\n tokens.splice(i - 1, 2);\n }\n }\n\n // Join the text array, removing spaces around added parentheses.\n let text: string = tokens.reduce(function(acc, value) {\n return acc + (acc.substr(-1) === '(' || value === ')' ? '' : ' ') + value;\n }, '');\n\n text = text.trim() || '???';\n if (opt_maxLength) {\n // TODO: Improve truncation so that text from this block is given\n // priority. E.g. \"1+2+3+4+5+6+7+8+9=0\" should be \"...6+7+8+9=0\", not\n // \"1+2+3+4+5...\". E.g. \"1+2+3+4+5=6+7+8+9+0\" should be \"...4+5=6+7...\".\n if (text.length > opt_maxLength) {\n text = text.substring(0, opt_maxLength - 3) + '...';\n }\n }\n return text;\n }\n\n /**\n * Shortcut for appending a value input row.\n *\n * @param name Language-neutral identifier which may used to find this input\n * again. Should be unique to this block.\n * @returns The input object created.\n */\n appendValueInput(name: string): Input {\n return this.appendInput_(inputTypes.VALUE, name);\n }\n\n /**\n * Shortcut for appending a statement input row.\n *\n * @param name Language-neutral identifier which may used to find this input\n * again. Should be unique to this block.\n * @returns The input object created.\n */\n appendStatementInput(name: string): Input {\n return this.appendInput_(inputTypes.STATEMENT, name);\n }\n\n /**\n * Shortcut for appending a dummy input row.\n *\n * @param opt_name Language-neutral identifier which may used to find this\n * input again. Should be unique to this block.\n * @returns The input object created.\n */\n appendDummyInput(opt_name?: string): Input {\n return this.appendInput_(inputTypes.DUMMY, opt_name || '');\n }\n\n /**\n * Initialize this block using a cross-platform, internationalization-friendly\n * JSON description.\n *\n * @param json Structured data describing the block.\n */\n jsonInit(json: AnyDuringMigration) {\n const warningPrefix = json['type'] ? 'Block \"' + json['type'] + '\": ' : '';\n\n // Validate inputs.\n if (json['output'] && json['previousStatement']) {\n throw Error(\n warningPrefix +\n 'Must not have both an output and a previousStatement.');\n }\n\n // Set basic properties of block.\n // Makes styles backward compatible with old way of defining hat style.\n if (json['style'] && json['style'].hat) {\n this.hat = json['style'].hat;\n // Must set to null so it doesn't error when checking for style and\n // colour.\n json['style'] = null;\n }\n\n if (json['style'] && json['colour']) {\n throw Error(warningPrefix + 'Must not have both a colour and a style.');\n } else if (json['style']) {\n this.jsonInitStyle_(json, warningPrefix);\n } else {\n this.jsonInitColour_(json, warningPrefix);\n }\n\n // Interpolate the message blocks.\n let i = 0;\n while (json['message' + i] !== undefined) {\n this.interpolate_(\n json['message' + i], json['args' + i] || [],\n json['lastDummyAlign' + i], warningPrefix);\n i++;\n }\n\n if (json['inputsInline'] !== undefined) {\n this.setInputsInline(json['inputsInline']);\n }\n // Set output and previous/next connections.\n if (json['output'] !== undefined) {\n this.setOutput(true, json['output']);\n }\n if (json['outputShape'] !== undefined) {\n this.setOutputShape(json['outputShape']);\n }\n if (json['previousStatement'] !== undefined) {\n this.setPreviousStatement(true, json['previousStatement']);\n }\n if (json['nextStatement'] !== undefined) {\n this.setNextStatement(true, json['nextStatement']);\n }\n if (json['tooltip'] !== undefined) {\n const rawValue = json['tooltip'];\n const localizedText = parsing.replaceMessageReferences(rawValue);\n this.setTooltip(localizedText);\n }\n if (json['enableContextMenu'] !== undefined) {\n this.contextMenu = !!json['enableContextMenu'];\n }\n if (json['suppressPrefixSuffix'] !== undefined) {\n this.suppressPrefixSuffix = !!json['suppressPrefixSuffix'];\n }\n if (json['helpUrl'] !== undefined) {\n const rawValue = json['helpUrl'];\n const localizedValue = parsing.replaceMessageReferences(rawValue);\n this.setHelpUrl(localizedValue);\n }\n if (typeof json['extensions'] === 'string') {\n console.warn(\n warningPrefix +\n 'JSON attribute \\'extensions\\' should be an array of' +\n ' strings. Found raw string in JSON for \\'' + json['type'] +\n '\\' block.');\n json['extensions'] = [json['extensions']]; // Correct and continue.\n }\n\n // Add the mutator to the block.\n if (json['mutator'] !== undefined) {\n Extensions.apply(json['mutator'], this, true);\n }\n\n const extensionNames = json['extensions'];\n if (Array.isArray(extensionNames)) {\n for (let j = 0; j < extensionNames.length; j++) {\n Extensions.apply(extensionNames[j], this, false);\n }\n }\n }\n\n /**\n * Initialize the colour of this block from the JSON description.\n *\n * @param json Structured data describing the block.\n * @param warningPrefix Warning prefix string identifying block.\n */\n private jsonInitColour_(json: AnyDuringMigration, warningPrefix: string) {\n if ('colour' in json) {\n if (json['colour'] === undefined) {\n console.warn(warningPrefix + 'Undefined colour value.');\n } else {\n const rawValue = json['colour'];\n try {\n this.setColour(rawValue);\n } catch (e) {\n console.warn(warningPrefix + 'Illegal colour value: ', rawValue);\n }\n }\n }\n }\n\n /**\n * Initialize the style of this block from the JSON description.\n *\n * @param json Structured data describing the block.\n * @param warningPrefix Warning prefix string identifying block.\n */\n private jsonInitStyle_(json: AnyDuringMigration, warningPrefix: string) {\n const blockStyleName = json['style'];\n try {\n this.setStyle(blockStyleName);\n } catch (styleError) {\n console.warn(warningPrefix + 'Style does not exist: ', blockStyleName);\n }\n }\n\n /**\n * Add key/values from mixinObj to this block object. By default, this method\n * will check that the keys in mixinObj will not overwrite existing values in\n * the block, including prototype values. This provides some insurance against\n * mixin / extension incompatibilities with future block features. This check\n * can be disabled by passing true as the second argument.\n *\n * @param mixinObj The key/values pairs to add to this block object.\n * @param opt_disableCheck Option flag to disable overwrite checks.\n */\n mixin(mixinObj: AnyDuringMigration, opt_disableCheck?: boolean) {\n if (opt_disableCheck !== undefined &&\n typeof opt_disableCheck !== 'boolean') {\n throw Error('opt_disableCheck must be a boolean if provided');\n }\n if (!opt_disableCheck) {\n const overwrites = [];\n for (const key in mixinObj) {\n if ((this as AnyDuringMigration)[key] !== undefined) {\n overwrites.push(key);\n }\n }\n if (overwrites.length) {\n throw Error(\n 'Mixin will overwrite block members: ' +\n JSON.stringify(overwrites));\n }\n }\n Object.assign(this, mixinObj);\n }\n\n /**\n * Interpolate a message description onto the block.\n *\n * @param message Text contains interpolation tokens (%1, %2, ...) that match\n * with fields or inputs defined in the args array.\n * @param args Array of arguments to be interpolated.\n * @param lastDummyAlign If a dummy input is added at the end, how should it\n * be aligned?\n * @param warningPrefix Warning prefix string identifying block.\n */\n private interpolate_(\n message: string, args: AnyDuringMigration[],\n lastDummyAlign: string|undefined, warningPrefix: string) {\n const tokens = parsing.tokenizeInterpolation(message);\n this.validateTokens_(tokens, args.length);\n const elements = this.interpolateArguments_(tokens, args, lastDummyAlign);\n\n // An array of [field, fieldName] tuples.\n const fieldStack = [];\n for (let i = 0, element; element = elements[i]; i++) {\n if (this.isInputKeyword_(element['type'])) {\n const input = this.inputFromJson_(element, warningPrefix);\n // Should never be null, but just in case.\n if (input) {\n for (let j = 0, tuple; tuple = fieldStack[j]; j++) {\n input.appendField(tuple[0], tuple[1]);\n }\n fieldStack.length = 0;\n }\n } else {\n // All other types, including ones starting with 'input_' get routed\n // here.\n const field = this.fieldFromJson_(element);\n if (field) {\n fieldStack.push([field, element['name']]);\n }\n }\n }\n }\n\n /**\n * Validates that the tokens are within the correct bounds, with no\n * duplicates, and that all of the arguments are referred to. Throws errors if\n * any of these things are not true.\n *\n * @param tokens An array of tokens to validate\n * @param argsCount The number of args that need to be referred to.\n */\n private validateTokens_(tokens: Array<string|number>, argsCount: number) {\n const visitedArgsHash = [];\n let visitedArgsCount = 0;\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (typeof token !== 'number') {\n continue;\n }\n if (token < 1 || token > argsCount) {\n throw Error(\n 'Block \"' + this.type + '\": ' +\n 'Message index %' + token + ' out of range.');\n }\n if (visitedArgsHash[token]) {\n throw Error(\n 'Block \"' + this.type + '\": ' +\n 'Message index %' + token + ' duplicated.');\n }\n visitedArgsHash[token] = true;\n visitedArgsCount++;\n }\n if (visitedArgsCount !== argsCount) {\n throw Error(\n 'Block \"' + this.type + '\": ' +\n 'Message does not reference all ' + argsCount + ' arg(s).');\n }\n }\n\n /**\n * Inserts args in place of numerical tokens. String args are converted to\n * JSON that defines a label field. If necessary an extra dummy input is added\n * to the end of the elements.\n *\n * @param tokens The tokens to interpolate\n * @param args The arguments to insert.\n * @param lastDummyAlign The alignment the added dummy input should have, if\n * we are required to add one.\n * @returns The JSON definitions of field and inputs to add to the block.\n */\n private interpolateArguments_(\n tokens: Array<string|number>, args: Array<AnyDuringMigration|string>,\n lastDummyAlign: string|undefined): AnyDuringMigration[] {\n const elements = [];\n for (let i = 0; i < tokens.length; i++) {\n let element = tokens[i];\n if (typeof element === 'number') {\n element = args[element - 1];\n }\n // Args can be strings, which is why this isn't elseif.\n if (typeof element === 'string') {\n // AnyDuringMigration because: Type '{ text: string; type: string; } |\n // null' is not assignable to type 'string | number'.\n element = this.stringToFieldJson_(element) as AnyDuringMigration;\n if (!element) {\n continue;\n }\n }\n elements.push(element);\n }\n\n const length = elements.length;\n if (length &&\n !this.isInputKeyword_(\n (elements as AnyDuringMigration)[length - 1]['type'])) {\n const dummyInput = {'type': 'input_dummy'};\n if (lastDummyAlign) {\n (dummyInput as AnyDuringMigration)['align'] = lastDummyAlign;\n }\n elements.push(dummyInput);\n }\n\n return elements;\n }\n\n /**\n * Creates a field from the JSON definition of a field. If a field with the\n * given type cannot be found, this attempts to create a different field using\n * the 'alt' property of the JSON definition (if it exists).\n *\n * @param element The element to try to turn into a field.\n * @returns The field defined by the JSON, or null if one couldn't be created.\n */\n private fieldFromJson_(element: {alt?: string, type?: string, text?: string}):\n Field|null {\n const field = fieldRegistry.fromJson(element);\n if (!field && element['alt']) {\n if (typeof element['alt'] === 'string') {\n const json = this.stringToFieldJson_(element['alt']);\n return json ? this.fieldFromJson_(json) : null;\n }\n return this.fieldFromJson_(element['alt']);\n }\n return field;\n }\n\n /**\n * Creates an input from the JSON definition of an input. Sets the input's\n * check and alignment if they are provided.\n *\n * @param element The JSON to turn into an input.\n * @param warningPrefix The prefix to add to warnings to help the developer\n * debug.\n * @returns The input that has been created, or null if one could not be\n * created for some reason (should never happen).\n */\n private inputFromJson_(element: AnyDuringMigration, warningPrefix: string):\n Input|null {\n const alignmentLookup = {\n 'LEFT': Align.LEFT,\n 'RIGHT': Align.RIGHT,\n 'CENTRE': Align.CENTRE,\n 'CENTER': Align.CENTRE,\n };\n\n let input = null;\n switch (element['type']) {\n case 'input_value':\n input = this.appendValueInput(element['name']);\n break;\n case 'input_statement':\n input = this.appendStatementInput(element['name']);\n break;\n case 'input_dummy':\n input = this.appendDummyInput(element['name']);\n break;\n }\n // Should never be hit because of interpolate_'s checks, but just in case.\n if (!input) {\n return null;\n }\n\n if (element['check']) {\n input.setCheck(element['check']);\n }\n if (element['align']) {\n const alignment =\n (alignmentLookup as\n AnyDuringMigration)[element['align'].toUpperCase()];\n if (alignment === undefined) {\n console.warn(warningPrefix + 'Illegal align value: ', element['align']);\n } else {\n input.setAlign(alignment);\n }\n }\n return input;\n }\n\n /**\n * Returns true if the given string matches one of the input keywords.\n *\n * @param str The string to check.\n * @returns True if the given string matches one of the input keywords, false\n * otherwise.\n */\n private isInputKeyword_(str: string): boolean {\n return str === 'input_value' || str === 'input_statement' ||\n str === 'input_dummy';\n }\n\n /**\n * Turns a string into the JSON definition of a label field. If the string\n * becomes an empty string when trimmed, this returns null.\n *\n * @param str String to turn into the JSON definition of a label field.\n * @returns The JSON definition or null.\n */\n private stringToFieldJson_(str: string): {text: string, type: string}|null {\n str = str.trim();\n if (str) {\n return {\n 'type': 'field_label',\n 'text': str,\n };\n }\n return null;\n }\n\n /**\n * Add a value input, statement input or local variable to this block.\n *\n * @param type One of Blockly.inputTypes.\n * @param name Language-neutral identifier which may used to find this input\n * again. Should be unique to this block.\n * @returns The input object created.\n */\n protected appendInput_(type: number, name: string): Input {\n let connection = null;\n if (type === inputTypes.VALUE || type === inputTypes.STATEMENT) {\n connection = this.makeConnection_(type);\n }\n if (type === inputTypes.STATEMENT) {\n this.statementInputCount++;\n }\n // AnyDuringMigration because: Argument of type 'Connection | null' is not\n // assignable to parameter of type 'Connection'.\n const input =\n new Input(type, name, this, (connection as AnyDuringMigration));\n // Append input to list.\n this.inputList.push(input);\n return input;\n }\n\n /**\n * Move a named input to a different location on this block.\n *\n * @param name The name of the input to move.\n * @param refName Name of input that should be after the moved input, or null\n * to be the input at the end.\n */\n moveInputBefore(name: string, refName: string|null) {\n if (name === refName) {\n return;\n }\n // Find both inputs.\n let inputIndex = -1;\n let refIndex = refName ? -1 : this.inputList.length;\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.name === name) {\n inputIndex = i;\n if (refIndex !== -1) {\n break;\n }\n } else if (refName && input.name === refName) {\n refIndex = i;\n if (inputIndex !== -1) {\n break;\n }\n }\n }\n if (inputIndex === -1) {\n throw Error('Named input \"' + name + '\" not found.');\n }\n if (refIndex === -1) {\n throw Error('Reference input \"' + refName + '\" not found.');\n }\n this.moveNumberedInputBefore(inputIndex, refIndex);\n }\n\n /**\n * Move a numbered input to a different location on this block.\n *\n * @param inputIndex Index of the input to move.\n * @param refIndex Index of input that should be after the moved input.\n */\n moveNumberedInputBefore(inputIndex: number, refIndex: number) {\n // Validate arguments.\n if (inputIndex === refIndex) {\n throw Error('Can\\'t move input to itself.');\n }\n if (inputIndex >= this.inputList.length) {\n throw RangeError('Input index ' + inputIndex + ' out of bounds.');\n }\n if (refIndex > this.inputList.length) {\n throw RangeError('Reference input ' + refIndex + ' out of bounds.');\n }\n // Remove input.\n const input = this.inputList[inputIndex];\n this.inputList.splice(inputIndex, 1);\n if (inputIndex < refIndex) {\n refIndex--;\n }\n // Reinsert input.\n this.inputList.splice(refIndex, 0, input);\n }\n\n /**\n * Remove an input from this block.\n *\n * @param name The name of the input.\n * @param opt_quiet True to prevent an error if input is not present.\n * @returns True if operation succeeds, false if input is not present and\n * opt_quiet is true.\n * @throws {Error} if the input is not present and opt_quiet is not true.\n */\n removeInput(name: string, opt_quiet?: boolean): boolean {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.name === name) {\n if (input.type === inputTypes.STATEMENT) {\n this.statementInputCount--;\n }\n input.dispose();\n this.inputList.splice(i, 1);\n return true;\n }\n }\n if (opt_quiet) {\n return false;\n }\n throw Error('Input not found: ' + name);\n }\n\n /**\n * Fetches the named input object.\n *\n * @param name The name of the input.\n * @returns The input object, or null if input does not exist.\n */\n getInput(name: string): Input|null {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.name === name) {\n return input;\n }\n }\n // This input does not exist.\n return null;\n }\n\n /**\n * Fetches the block attached to the named input.\n *\n * @param name The name of the input.\n * @returns The attached value block, or null if the input is either\n * disconnected or if the input does not exist.\n */\n getInputTargetBlock(name: string): Block|null {\n const input = this.getInput(name);\n return input && input.connection && input.connection.targetBlock();\n }\n\n /**\n * Returns the comment on this block (or null if there is no comment).\n *\n * @returns Block's comment.\n */\n getCommentText(): string|null {\n return this.commentModel.text;\n }\n\n /**\n * Set this block's comment text.\n *\n * @param text The text, or null to delete.\n */\n setCommentText(text: string|null) {\n if (this.commentModel.text === text) {\n return;\n }\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n this, 'comment', null, this.commentModel.text, text));\n this.commentModel.text = text;\n // AnyDuringMigration because: Type 'string | null' is not assignable to\n // type 'string | Comment'.\n this.comment = text as AnyDuringMigration; // For backwards compatibility.\n }\n\n /**\n * Set this block's warning text.\n *\n * @param _text The text, or null to delete.\n * @param _opt_id An optional ID for the warning text to be able to maintain\n * multiple warnings.\n */\n setWarningText(_text: string|null, _opt_id?: string) {}\n // NOP.\n\n /**\n * Give this block a mutator dialog.\n *\n * @param _mutator A mutator dialog instance or null to remove.\n */\n setMutator(_mutator: Mutator) {}\n // NOP.\n\n /**\n * Return the coordinates of the top-left corner of this block relative to the\n * drawing surface's origin (0,0), in workspace units.\n *\n * @returns Object with .x and .y properties.\n */\n getRelativeToSurfaceXY(): Coordinate {\n return this.xy_;\n }\n\n /**\n * Move a block by a relative offset.\n *\n * @param dx Horizontal offset, in workspace units.\n * @param dy Vertical offset, in workspace units.\n */\n moveBy(dx: number, dy: number) {\n if (this.parentBlock_) {\n throw Error('Block has parent.');\n }\n const event =\n new (eventUtils.get(eventUtils.BLOCK_MOVE))(this) as BlockMove;\n this.xy_.translate(dx, dy);\n event.recordNew();\n eventUtils.fire(event);\n }\n\n /**\n * Create a connection of the specified type.\n *\n * @param type The type of the connection to create.\n * @returns A new connection of the specified type.\n */\n protected makeConnection_(type: number): Connection {\n return new Connection(this, type);\n }\n\n /**\n * Recursively checks whether all statement and value inputs are filled with\n * blocks. Also checks all following statement blocks in this stack.\n *\n * @param opt_shadowBlocksAreFilled An optional argument controlling whether\n * shadow blocks are counted as filled. Defaults to true.\n * @returns True if all inputs are filled, false otherwise.\n */\n allInputsFilled(opt_shadowBlocksAreFilled?: boolean): boolean {\n // Account for the shadow block filledness toggle.\n if (opt_shadowBlocksAreFilled === undefined) {\n opt_shadowBlocksAreFilled = true;\n }\n if (!opt_shadowBlocksAreFilled && this.isShadow()) {\n return false;\n }\n\n // Recursively check each input block of the current block.\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (!input.connection) {\n continue;\n }\n const target = input.connection.targetBlock();\n if (!target || !target.allInputsFilled(opt_shadowBlocksAreFilled)) {\n return false;\n }\n }\n\n // Recursively check the next block after the current block.\n const next = this.getNextBlock();\n if (next) {\n return next.allInputsFilled(opt_shadowBlocksAreFilled);\n }\n\n return true;\n }\n\n /**\n * This method returns a string describing this Block in developer terms (type\n * name and ID; English only).\n *\n * Intended to on be used in console logs and errors. If you need a string\n * that uses the user's native language (including block text, field values,\n * and child blocks), use [toString()]{@link Block#toString}.\n *\n * @returns The description.\n */\n toDevString(): string {\n let msg = this.type ? '\"' + this.type + '\" block' : 'Block';\n if (this.id) {\n msg += ' (id=\"' + this.id + '\")';\n }\n return msg;\n }\n}\n\nexport namespace Block {\n export interface CommentModel {\n text: string|null;\n pinned: boolean;\n size: Size;\n }\n}\n\nexport type CommentModel = Block.CommentModel;\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a code comment.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Comment');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_bubble_open.js';\n\nimport type {CommentModel} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport {Bubble} from './bubble.js';\nimport * as Css from './css.js';\nimport * as eventUtils from './events/utils.js';\nimport {Icon} from './icon.js';\nimport type {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport type {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\n\n\n/**\n * Class for a comment.\n *\n * @alias Blockly.Comment\n */\nexport class Comment extends Icon {\n private readonly model_: CommentModel;\n\n /**\n * The model's text value at the start of an edit.\n * Used to tell if an event should be fired at the end of an edit.\n */\n private cachedText_: string|null = '';\n\n /** Mouse up event data. */\n private onMouseUpWrapper_: browserEvents.Data|null = null;\n\n /** Wheel event data. */\n private onWheelWrapper_: browserEvents.Data|null = null;\n\n /** Change event data. */\n private onChangeWrapper_: browserEvents.Data|null = null;\n\n /** Input event data. */\n private onInputWrapper_: browserEvents.Data|null = null;\n\n /**\n * The SVG element that contains the text edit area, or null if not created.\n */\n private foreignObject_: SVGForeignObjectElement|null = null;\n\n /** The editable text area, or null if not created. */\n private textarea_: HTMLTextAreaElement|null = null;\n\n /** The top-level node of the comment text, or null if not created. */\n private paragraphElement_: SVGTextElement|null = null;\n\n /** @param block The block associated with this comment. */\n constructor(block: BlockSvg) {\n super(block);\n\n /** The model for this comment. */\n this.model_ = block.commentModel;\n // If someone creates the comment directly instead of calling\n // block.setCommentText we want to make sure the text is non-null;\n this.model_.text = this.model_.text ?? '';\n\n this.createIcon();\n }\n\n /**\n * Draw the comment icon.\n *\n * @param group The icon group.\n */\n protected override drawIcon_(group: Element) {\n // Circle.\n dom.createSvgElement(\n Svg.CIRCLE,\n {'class': 'blocklyIconShape', 'r': '8', 'cx': '8', 'cy': '8'}, group);\n // Can't use a real '?' text character since different browsers and\n // operating systems render it differently. Body of question mark.\n dom.createSvgElement(\n Svg.PATH, {\n 'class': 'blocklyIconSymbol',\n 'd': 'm6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.405' +\n '0.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25' +\n '-1.201,0.998 -1.201,1.528 -1.204,2.19z',\n },\n group);\n // Dot of question mark.\n dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blocklyIconSymbol',\n 'x': '6.8',\n 'y': '10.78',\n 'height': '2',\n 'width': '2',\n },\n group);\n }\n\n /**\n * Create the editor for the comment's bubble.\n *\n * @returns The top-level node of the editor.\n */\n private createEditor_(): SVGElement {\n /* Create the editor. Here's the markup that will be generated in\n * editable mode:\n <foreignObject x=\"8\" y=\"8\" width=\"164\" height=\"164\">\n <body xmlns=\"http://www.w3.org/1999/xhtml\"\n class=\"blocklyMinimalBody\"> <textarea\n xmlns=\"http://www.w3.org/1999/xhtml\" class=\"blocklyCommentTextarea\"\n style=\"height: 164px; width: 164px;\"></textarea>\n </body>\n </foreignObject>\n * For non-editable mode see Warning.textToDom_.\n */\n\n this.foreignObject_ = dom.createSvgElement(\n Svg.FOREIGNOBJECT,\n {'x': Bubble.BORDER_WIDTH, 'y': Bubble.BORDER_WIDTH});\n\n const body = document.createElementNS(dom.HTML_NS, 'body');\n body.setAttribute('xmlns', dom.HTML_NS);\n body.className = 'blocklyMinimalBody';\n\n this.textarea_ = document.createElementNS(dom.HTML_NS, 'textarea') as\n HTMLTextAreaElement;\n const textarea = this.textarea_;\n textarea.className = 'blocklyCommentTextarea';\n textarea.setAttribute('dir', this.getBlock().RTL ? 'RTL' : 'LTR');\n textarea.value = this.model_.text ?? '';\n this.resizeTextarea_();\n\n body.appendChild(textarea);\n this.foreignObject_!.appendChild(body);\n\n // Ideally this would be hooked to the focus event for the comment.\n // However doing so in Firefox swallows the cursor for unknown reasons.\n // So this is hooked to mouseup instead. No big deal.\n this.onMouseUpWrapper_ = browserEvents.conditionalBind(\n textarea, 'mouseup', this, this.startEdit_, true, true);\n // Don't zoom with mousewheel.\n this.onWheelWrapper_ = browserEvents.conditionalBind(\n textarea, 'wheel', this, function(e: Event) {\n e.stopPropagation();\n });\n this.onChangeWrapper_ = browserEvents.conditionalBind(\n textarea, 'change', this,\n /**\n * @param _e Unused event parameter.\n */\n function(this: Comment, _e: Event) {\n if (this.cachedText_ !== this.model_.text) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n this.getBlock(), 'comment', null, this.cachedText_,\n this.model_.text));\n }\n });\n this.onInputWrapper_ = browserEvents.conditionalBind(\n textarea, 'input', this,\n /**\n * @param _e Unused event parameter.\n */\n function(this: Comment, _e: Event) {\n this.model_.text = textarea.value;\n });\n\n setTimeout(textarea.focus.bind(textarea), 0);\n\n return this.foreignObject_;\n }\n\n /** Add or remove editability of the comment. */\n override updateEditable() {\n super.updateEditable();\n if (this.isVisible()) {\n // Recreate the bubble with the correct UI.\n this.disposeBubble_();\n this.createBubble_();\n }\n }\n\n /**\n * Callback function triggered when the bubble has resized.\n * Resize the text area accordingly.\n */\n private onBubbleResize_() {\n if (!this.isVisible() || !this.bubble_) {\n return;\n }\n\n this.model_.size = this.bubble_.getBubbleSize();\n this.resizeTextarea_();\n }\n\n /**\n * Resizes the text area to match the size defined on the model (which is\n * the size of the bubble).\n */\n private resizeTextarea_() {\n const size = this.model_.size;\n const doubleBorderWidth = 2 * Bubble.BORDER_WIDTH;\n const widthMinusBorder = size.width - doubleBorderWidth;\n const heightMinusBorder = size.height - doubleBorderWidth;\n this.foreignObject_!.setAttribute('width', `${widthMinusBorder}`);\n this.foreignObject_!.setAttribute('height', `${heightMinusBorder}`);\n this.textarea_!.style.width = widthMinusBorder - 4 + 'px';\n this.textarea_!.style.height = heightMinusBorder - 4 + 'px';\n }\n\n /**\n * Show or hide the comment bubble.\n *\n * @param visible True if the bubble should be visible.\n */\n override setVisible(visible: boolean) {\n if (visible === this.isVisible()) {\n return;\n }\n eventUtils.fire(new (eventUtils.get(eventUtils.BUBBLE_OPEN))(\n this.getBlock(), visible, 'comment'));\n this.model_.pinned = visible;\n if (visible) {\n this.createBubble_();\n } else {\n this.disposeBubble_();\n }\n }\n\n /** Show the bubble. Handles deciding if it should be editable or not. */\n private createBubble_() {\n if (!this.getBlock().isEditable()) {\n this.createNonEditableBubble_();\n } else {\n this.createEditableBubble_();\n }\n }\n\n /** Show an editable bubble. */\n private createEditableBubble_() {\n const block = this.getBlock();\n this.bubble_ = new Bubble(\n block.workspace, this.createEditor_(), block.pathObject.svgPath,\n (this.iconXY_ as Coordinate), this.model_.size.width,\n this.model_.size.height);\n // Expose this comment's block's ID on its top-level SVG group.\n this.bubble_.setSvgId(block.id);\n this.bubble_.registerResizeEvent(this.onBubbleResize_.bind(this));\n this.applyColour();\n }\n\n /**\n * Show a non-editable bubble.\n *\n * @suppress {checkTypes} Suppress `this` type mismatch.\n */\n private createNonEditableBubble_() {\n // TODO (#2917): It would be great if the comment could support line breaks.\n this.paragraphElement_ = Bubble.textToDom(this.model_.text ?? '');\n this.bubble_ = Bubble.createNonEditableBubble(\n this.paragraphElement_, this.getBlock(), this.iconXY_ as Coordinate);\n this.applyColour();\n }\n\n /**\n * Dispose of the bubble.\n *\n * @suppress {checkTypes} Suppress `this` type mismatch.\n */\n private disposeBubble_() {\n if (this.onMouseUpWrapper_) {\n browserEvents.unbind(this.onMouseUpWrapper_);\n this.onMouseUpWrapper_ = null;\n }\n if (this.onWheelWrapper_) {\n browserEvents.unbind(this.onWheelWrapper_);\n this.onWheelWrapper_ = null;\n }\n if (this.onChangeWrapper_) {\n browserEvents.unbind(this.onChangeWrapper_);\n this.onChangeWrapper_ = null;\n }\n if (this.onInputWrapper_) {\n browserEvents.unbind(this.onInputWrapper_);\n this.onInputWrapper_ = null;\n }\n if (this.bubble_) {\n this.bubble_.dispose();\n this.bubble_ = null;\n }\n this.textarea_ = null;\n this.foreignObject_ = null;\n this.paragraphElement_ = null;\n }\n\n /**\n * Callback fired when an edit starts.\n *\n * Bring the comment to the top of the stack when clicked on. Also cache the\n * current text so it can be used to fire a change event.\n *\n * @param _e Mouse up event.\n */\n private startEdit_(_e: Event) {\n if (this.bubble_?.promote()) {\n // Since the act of moving this node within the DOM causes a loss of\n // focus, we need to reapply the focus.\n this.textarea_!.focus();\n }\n\n this.cachedText_ = this.model_.text;\n }\n\n /**\n * Get the dimensions of this comment's bubble.\n *\n * @returns Object with width and height properties.\n */\n getBubbleSize(): Size {\n return this.model_.size;\n }\n\n /**\n * Size this comment's bubble.\n *\n * @param width Width of the bubble.\n * @param height Height of the bubble.\n */\n setBubbleSize(width: number, height: number) {\n if (this.bubble_) {\n this.bubble_.setBubbleSize(width, height);\n } else {\n this.model_.size.width = width;\n this.model_.size.height = height;\n }\n }\n\n /**\n * Update the comment's view to match the model.\n *\n * @internal\n */\n updateText() {\n if (this.textarea_) {\n this.textarea_.value = this.model_.text ?? '';\n } else if (this.paragraphElement_) {\n // Non-Editable mode.\n // TODO (#2917): If 2917 gets added this will probably need to be updated.\n this.paragraphElement_.firstChild!.textContent = this.model_.text;\n }\n }\n\n /**\n * Dispose of this comment.\n *\n * If you want to receive a comment \"delete\" event (newValue: null), then this\n * should not be called directly. Instead call block.setCommentText(null);\n */\n override dispose() {\n this.getBlock().comment = null;\n super.dispose();\n }\n}\n\n/** CSS for block comment. See css.js for use. */\nCss.register(`\n.blocklyCommentTextarea {\n background-color: #fef49c;\n border: 0;\n display: block;\n margin: 0;\n outline: 0;\n padding: 3px;\n resize: none;\n text-overflow: hidden;\n}\n`);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Registry for context menu option items.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ContextMenuRegistry');\n\nimport type {BlockSvg} from './block_svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for the registry of context menu items. This is intended to be a\n * singleton. You should not create a new instance, and only access this class\n * from ContextMenuRegistry.registry.\n *\n * @alias Blockly.ContextMenuRegistry\n */\nexport class ContextMenuRegistry {\n static registry: ContextMenuRegistry;\n /** Registry of all registered RegistryItems, keyed by ID. */\n private registry_ = new Map<string, RegistryItem>();\n\n /** Resets the existing singleton instance of ContextMenuRegistry. */\n constructor() {\n this.reset();\n }\n\n /** Clear and recreate the registry. */\n reset() {\n this.registry_.clear();\n }\n\n /**\n * Registers a RegistryItem.\n *\n * @param item Context menu item to register.\n * @throws {Error} if an item with the given ID already exists.\n */\n register(item: RegistryItem) {\n if (this.registry_.has(item.id)) {\n throw Error('Menu item with ID \"' + item.id + '\" is already registered.');\n }\n this.registry_.set(item.id, item);\n }\n\n /**\n * Unregisters a RegistryItem with the given ID.\n *\n * @param id The ID of the RegistryItem to remove.\n * @throws {Error} if an item with the given ID does not exist.\n */\n unregister(id: string) {\n if (!this.registry_.has(id)) {\n throw new Error('Menu item with ID \"' + id + '\" not found.');\n }\n this.registry_.delete(id);\n }\n\n /**\n * @param id The ID of the RegistryItem to get.\n * @returns RegistryItem or null if not found\n */\n getItem(id: string): RegistryItem|null {\n return this.registry_.get(id) ?? null;\n }\n\n /**\n * Gets the valid context menu options for the given scope type (e.g. block or\n * workspace) and scope. Blocks are only shown if the preconditionFn shows\n * they should not be hidden.\n *\n * @param scopeType Type of scope where menu should be shown (e.g. on a block\n * or on a workspace)\n * @param scope Current scope of context menu (i.e., the exact workspace or\n * block being clicked on)\n * @returns the list of ContextMenuOptions\n */\n getContextMenuOptions(scopeType: ScopeType, scope: Scope):\n ContextMenuOption[] {\n const menuOptions: ContextMenuOption[] = [];\n for (const item of this.registry_.values()) {\n if (scopeType === item.scopeType) {\n const precondition = item.preconditionFn(scope);\n if (precondition !== 'hidden') {\n const displayText = typeof item.displayText === 'function' ?\n item.displayText(scope) :\n item.displayText;\n const menuOption: ContextMenuOption = {\n text: displayText,\n enabled: precondition === 'enabled',\n callback: item.callback,\n scope,\n weight: item.weight,\n };\n menuOptions.push(menuOption);\n }\n }\n }\n menuOptions.sort(function(a, b) {\n return a.weight - b.weight;\n });\n return menuOptions;\n }\n}\n\nexport namespace ContextMenuRegistry {\n /**\n * Where this menu item should be rendered. If the menu item should be\n * rendered in multiple scopes, e.g. on both a block and a workspace, it\n * should be registered for each scope.\n */\n export enum ScopeType {\n BLOCK = 'block',\n WORKSPACE = 'workspace',\n }\n\n /**\n * The actual workspace/block where the menu is being rendered. This is passed\n * to callback and displayText functions that depend on this information.\n */\n export interface Scope {\n block?: BlockSvg;\n workspace?: WorkspaceSvg;\n }\n\n /**\n * A menu item as entered in the registry.\n */\n export interface RegistryItem {\n callback: (p1: Scope) => void;\n scopeType: ScopeType;\n displayText: ((p1: Scope) => string)|string;\n preconditionFn: (p1: Scope) => string;\n weight: number;\n id: string;\n }\n\n /**\n * A menu item as presented to contextmenu.js.\n */\n export interface ContextMenuOption {\n text: string;\n enabled: boolean;\n callback: (p1: Scope) => void;\n scope: Scope;\n weight: number;\n }\n\n /**\n * A subset of ContextMenuOption corresponding to what was publicly\n * documented. ContextMenuOption should be preferred for new code.\n */\n export interface LegacyContextMenuOption {\n text: string;\n enabled: boolean;\n callback: (p1: Scope) => void;\n }\n\n /**\n * Singleton instance of this class. All interactions with this class should\n * be done on this object.\n */\n ContextMenuRegistry.registry = new ContextMenuRegistry();\n}\n\nexport type ScopeType = ContextMenuRegistry.ScopeType;\nexport const ScopeType = ContextMenuRegistry.ScopeType;\nexport type Scope = ContextMenuRegistry.Scope;\nexport type RegistryItem = ContextMenuRegistry.RegistryItem;\nexport type ContextMenuOption = ContextMenuRegistry.ContextMenuOption;\nexport type LegacyContextMenuOption =\n ContextMenuRegistry.LegacyContextMenuOption;\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Module that provides constants for use inside Blockly. Do not\n * use these constants outside of the core library.\n *\n * @namespace Blockly.internalConstants\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.internalConstants');\n\nimport {ConnectionType} from './connection_type.js';\n\n\n/**\n * Number of characters to truncate a collapsed block to.\n *\n * @alias Blockly.internalConstants.COLLAPSE_CHARS\n * @internal\n */\nexport const COLLAPSE_CHARS = 30;\n\n/**\n * When dragging a block out of a stack, split the stack in two (true), or drag\n * out the block healing the stack (false).\n *\n * @alias Blockly.internalConstants.DRAG_STACK\n * @internal\n */\nexport const DRAG_STACK = true;\n\n/**\n * Lookup table for determining the opposite type of a connection.\n *\n * @alias Blockly.internalConstants.OPPOSITE_TYPE\n * @internal\n */\nexport const OPPOSITE_TYPE: number[] = [];\nOPPOSITE_TYPE[ConnectionType.INPUT_VALUE] = ConnectionType.OUTPUT_VALUE;\nOPPOSITE_TYPE[ConnectionType.OUTPUT_VALUE] = ConnectionType.INPUT_VALUE;\nOPPOSITE_TYPE[ConnectionType.NEXT_STATEMENT] =\n ConnectionType.PREVIOUS_STATEMENT;\nOPPOSITE_TYPE[ConnectionType.PREVIOUS_STATEMENT] =\n ConnectionType.NEXT_STATEMENT;\n\n/**\n * String for use in the dropdown created in field_variable.\n * This string indicates that this option in the dropdown is 'Rename\n * variable...' and if selected, should trigger the prompt to rename a variable.\n *\n * @alias Blockly.internalConstants.RENAME_VARIABLE_ID\n * @internal\n */\nexport const RENAME_VARIABLE_ID = 'RENAME_VARIABLE_ID';\n\n/**\n * String for use in the dropdown created in field_variable.\n * This string indicates that this option in the dropdown is 'Delete the \"%1\"\n * variable' and if selected, should trigger the prompt to delete a variable.\n *\n * @alias Blockly.internalConstants.DELETE_VARIABLE_ID\n * @internal\n */\nexport const DELETE_VARIABLE_ID = 'DELETE_VARIABLE_ID';\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing a marker.\n * Used primarily for keyboard navigation to show a marked location.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Marker');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {MarkerSvg} from '../renderers/common/marker_svg.js';\n\nimport type {ASTNode} from './ast_node.js';\n\n\n/**\n * Class for a marker.\n * This is used in keyboard navigation to save a location in the Blockly AST.\n *\n * @alias Blockly.Marker\n */\nexport class Marker {\n /** The colour of the marker. */\n colour: string|null = null;\n\n /** The current location of the marker. */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'ASTNode'.\n private curNode_: ASTNode = null as AnyDuringMigration;\n\n /**\n * The object in charge of drawing the visual representation of the current\n * node.\n */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'MarkerSvg'.\n private drawer_: MarkerSvg = null as AnyDuringMigration;\n\n /** The type of the marker. */\n type = 'marker';\n\n /** Constructs a new Marker instance. */\n constructor() {}\n\n /**\n * Sets the object in charge of drawing the marker.\n *\n * @param drawer The object in charge of drawing the marker.\n */\n setDrawer(drawer: MarkerSvg) {\n this.drawer_ = drawer;\n }\n\n /**\n * Get the current drawer for the marker.\n *\n * @returns The object in charge of drawing the marker.\n */\n getDrawer(): MarkerSvg {\n return this.drawer_;\n }\n\n /**\n * Gets the current location of the marker.\n *\n * @returns The current field, connection, or block the marker is on.\n */\n getCurNode(): ASTNode {\n return this.curNode_;\n }\n\n /**\n * Set the location of the marker and call the update method.\n * Setting isStack to true will only work if the newLocation is the top most\n * output or previous connection on a stack.\n *\n * @param newNode The new location of the marker.\n */\n setCurNode(newNode: ASTNode) {\n const oldNode = this.curNode_;\n this.curNode_ = newNode;\n if (this.drawer_) {\n this.drawer_.draw(oldNode, this.curNode_);\n }\n }\n\n /**\n * Redraw the current marker.\n *\n * @internal\n */\n draw() {\n if (this.drawer_) {\n this.drawer_.draw(this.curNode_, this.curNode_);\n }\n }\n\n /** Hide the marker SVG. */\n hide() {\n if (this.drawer_) {\n this.drawer_.hide();\n }\n }\n\n /** Dispose of this marker. */\n dispose() {\n if (this.getDrawer()) {\n this.getDrawer().dispose();\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing a cursor.\n * Used primarily for keyboard navigation.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Cursor');\n\nimport * as registry from '../registry.js';\n\nimport {ASTNode} from './ast_node.js';\nimport {Marker} from './marker.js';\n\n\n/**\n * Class for a cursor.\n * A cursor controls how a user navigates the Blockly AST.\n *\n * @alias Blockly.Cursor\n */\nexport class Cursor extends Marker {\n override type = 'cursor';\n\n /** @alias Blockly.Cursor */\n constructor() {\n super();\n }\n\n /**\n * Find the next connection, field, or block.\n *\n * @returns The next element, or null if the current node is not set or there\n * is no next value.\n */\n next(): ASTNode|null {\n const curNode = this.getCurNode();\n if (!curNode) {\n return null;\n }\n\n let newNode = curNode.next();\n while (newNode && newNode.next() &&\n (newNode.getType() === ASTNode.types.NEXT ||\n newNode.getType() === ASTNode.types.BLOCK)) {\n newNode = newNode.next();\n }\n\n if (newNode) {\n this.setCurNode(newNode);\n }\n return newNode;\n }\n\n /**\n * Find the in connection or field.\n *\n * @returns The in element, or null if the current node is not set or there is\n * no in value.\n */\n in(): ASTNode|null {\n let curNode: ASTNode|null = this.getCurNode();\n if (!curNode) {\n return null;\n }\n // If we are on a previous or output connection, go to the block level\n // before performing next operation.\n if (curNode.getType() === ASTNode.types.PREVIOUS ||\n curNode.getType() === ASTNode.types.OUTPUT) {\n curNode = curNode.next();\n }\n const newNode = curNode?.in() ?? null;\n\n if (newNode) {\n this.setCurNode(newNode);\n }\n return newNode;\n }\n\n /**\n * Find the previous connection, field, or block.\n *\n * @returns The previous element, or null if the current node is not set or\n * there is no previous value.\n */\n prev(): ASTNode|null {\n const curNode = this.getCurNode();\n if (!curNode) {\n return null;\n }\n let newNode = curNode.prev();\n\n while (newNode && newNode.prev() &&\n (newNode.getType() === ASTNode.types.NEXT ||\n newNode.getType() === ASTNode.types.BLOCK)) {\n newNode = newNode.prev();\n }\n\n if (newNode) {\n this.setCurNode(newNode);\n }\n return newNode;\n }\n\n /**\n * Find the out connection, field, or block.\n *\n * @returns The out element, or null if the current node is not set or there\n * is no out value.\n */\n out(): ASTNode|null {\n const curNode = this.getCurNode();\n if (!curNode) {\n return null;\n }\n let newNode = curNode.out();\n\n if (newNode && newNode.getType() === ASTNode.types.BLOCK) {\n newNode = newNode.prev() || newNode;\n }\n\n if (newNode) {\n this.setCurNode(newNode);\n }\n return newNode;\n }\n}\n\nregistry.register(registry.Type.CURSOR, registry.DEFAULT, Cursor);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing a basic cursor.\n * Used to demo switching between different cursors.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.BasicCursor');\n\nimport * as registry from '../registry.js';\n\nimport {ASTNode} from './ast_node.js';\nimport {Cursor} from './cursor.js';\n\n\n/**\n * Class for a basic cursor.\n * This will allow the user to get to all nodes in the AST by hitting next or\n * previous.\n *\n * @alias Blockly.BasicCursor\n */\nexport class BasicCursor extends Cursor {\n /** Name used for registering a basic cursor. */\n static readonly registrationName = 'basicCursor';\n\n /** @alias Blockly.BasicCursor */\n constructor() {\n super();\n }\n\n /**\n * Find the next node in the pre order traversal.\n *\n * @returns The next node, or null if the current node is not set or there is\n * no next value.\n */\n override next(): ASTNode|null {\n const curNode = this.getCurNode();\n if (!curNode) {\n return null;\n }\n const newNode = this.getNextNode_(curNode, this.validNode_);\n\n if (newNode) {\n this.setCurNode(newNode);\n }\n return newNode;\n }\n\n /**\n * For a basic cursor we only have the ability to go next and previous, so\n * in will also allow the user to get to the next node in the pre order\n * traversal.\n *\n * @returns The next node, or null if the current node is not set or there is\n * no next value.\n */\n override in(): ASTNode|null {\n return this.next();\n }\n\n /**\n * Find the previous node in the pre order traversal.\n *\n * @returns The previous node, or null if the current node is not set or there\n * is no previous value.\n */\n override prev(): ASTNode|null {\n const curNode = this.getCurNode();\n if (!curNode) {\n return null;\n }\n const newNode = this.getPreviousNode_(curNode, this.validNode_);\n\n if (newNode) {\n this.setCurNode(newNode);\n }\n return newNode;\n }\n\n /**\n * For a basic cursor we only have the ability to go next and previous, so\n * out will allow the user to get to the previous node in the pre order\n * traversal.\n *\n * @returns The previous node, or null if the current node is not set or there\n * is no previous value.\n */\n override out(): ASTNode|null {\n return this.prev();\n }\n\n /**\n * Uses pre order traversal to navigate the Blockly AST. This will allow\n * a user to easily navigate the entire Blockly AST without having to go in\n * and out levels on the tree.\n *\n * @param node The current position in the AST.\n * @param isValid A function true/false depending on whether the given node\n * should be traversed.\n * @returns The next node in the traversal.\n */\n protected getNextNode_(\n node: ASTNode|null, isValid: (p1: ASTNode|null) => boolean): ASTNode\n |null {\n if (!node) {\n return null;\n }\n const newNode = node.in() || node.next();\n if (isValid(newNode)) {\n return newNode;\n } else if (newNode) {\n return this.getNextNode_(newNode, isValid);\n }\n const siblingOrParent = this.findSiblingOrParent_(node.out());\n if (isValid(siblingOrParent)) {\n return siblingOrParent;\n } else if (siblingOrParent) {\n return this.getNextNode_(siblingOrParent, isValid);\n }\n return null;\n }\n\n /**\n * Reverses the pre order traversal in order to find the previous node. This\n * will allow a user to easily navigate the entire Blockly AST without having\n * to go in and out levels on the tree.\n *\n * @param node The current position in the AST.\n * @param isValid A function true/false depending on whether the given node\n * should be traversed.\n * @returns The previous node in the traversal or null if no previous node\n * exists.\n */\n protected getPreviousNode_(\n node: ASTNode|null, isValid: (p1: ASTNode|null) => boolean): ASTNode\n |null {\n if (!node) {\n return null;\n }\n let newNode: ASTNode|null = node.prev();\n\n if (newNode) {\n newNode = this.getRightMostChild_(newNode);\n } else {\n newNode = node.out();\n }\n if (isValid(newNode)) {\n return newNode;\n } else if (newNode) {\n return this.getPreviousNode_(newNode, isValid);\n }\n return null;\n }\n\n /**\n * Decides what nodes to traverse and which ones to skip. Currently, it\n * skips output, stack and workspace nodes.\n *\n * @param node The AST node to check whether it is valid.\n * @returns True if the node should be visited, false otherwise.\n */\n protected validNode_(node: ASTNode|null): boolean {\n let isValid = false;\n const type = node && node.getType();\n if (type === ASTNode.types.OUTPUT || type === ASTNode.types.INPUT ||\n type === ASTNode.types.FIELD || type === ASTNode.types.NEXT ||\n type === ASTNode.types.PREVIOUS || type === ASTNode.types.WORKSPACE) {\n isValid = true;\n }\n return isValid;\n }\n\n /**\n * From the given node find either the next valid sibling or parent.\n *\n * @param node The current position in the AST.\n * @returns The parent AST node or null if there are no valid parents.\n */\n private findSiblingOrParent_(node: ASTNode|null): ASTNode|null {\n if (!node) {\n return null;\n }\n const nextNode = node.next();\n if (nextNode) {\n return nextNode;\n }\n return this.findSiblingOrParent_(node.out());\n }\n\n /**\n * Get the right most child of a node.\n *\n * @param node The node to find the right most child of.\n * @returns The right most child of the given node, or the node if no child\n * exists.\n */\n private getRightMostChild_(node: ASTNode|null): ASTNode|null {\n if (!node!.in()) {\n return node;\n }\n let newNode = node!.in();\n while (newNode && newNode.next()) {\n newNode = newNode.next();\n }\n return this.getRightMostChild_(newNode);\n }\n}\n\nregistry.register(\n registry.Type.CURSOR, BasicCursor.registrationName, BasicCursor);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing a cursor that is used to navigate\n * between tab navigable fields.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.TabNavigateCursor');\n\nimport type {Field} from '../field.js';\n\nimport {ASTNode} from './ast_node.js';\nimport {BasicCursor} from './basic_cursor.js';\n\n\n/**\n * A cursor for navigating between tab navigable fields.\n *\n * @alias Blockly.TabNavigateCursor\n */\nexport class TabNavigateCursor extends BasicCursor {\n /**\n * Skip all nodes except for tab navigable fields.\n *\n * @param node The AST node to check whether it is valid.\n * @returns True if the node should be visited, false otherwise.\n */\n override validNode_(node: ASTNode|null): boolean {\n let isValid = false;\n const type = node && node.getType();\n if (node) {\n const location = node.getLocation() as Field;\n if (type === ASTNode.types.FIELD && location &&\n location.isTabNavigable() && location.isClickable()) {\n isValid = true;\n }\n }\n return isValid;\n }\n}\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Components for creating connections between blocks.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.RenderedConnection');\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as common from './common.js';\nimport {config} from './config.js';\nimport {Connection} from './connection.js';\nimport type {ConnectionDB} from './connection_db.js';\nimport {ConnectionType} from './connection_type.js';\nimport * as eventUtils from './events/utils.js';\nimport * as internalConstants from './internal_constants.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\nimport * as svgPaths from './utils/svg_paths.js';\n\n\n/** A shape that has a pathDown property. */\ninterface PathDownShape {\n pathDown: string;\n}\n\n/** A shape that has a pathLeft property. */\ninterface PathLeftShape {\n pathLeft: string;\n}\n\n/** Maximum randomness in workspace units for bumping a block. */\nconst BUMP_RANDOMNESS = 10;\n\n/**\n * Class for a connection between blocks that may be rendered on screen.\n *\n * @alias Blockly.RenderedConnection\n */\nexport class RenderedConnection extends Connection {\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n sourceBlock_!: BlockSvg;\n private readonly db_: ConnectionDB;\n private readonly dbOpposite_: ConnectionDB;\n private readonly offsetInBlock_: Coordinate;\n private trackedState_: TrackedState;\n private highlightPath: SVGPathElement|null = null;\n\n /** Connection this connection connects to. Null if not connected. */\n override targetConnection: RenderedConnection|null = null;\n\n /**\n * @param source The block establishing this connection.\n * @param type The type of the connection.\n */\n constructor(source: BlockSvg, type: number) {\n super(source, type);\n\n /**\n * Connection database for connections of this type on the current\n * workspace.\n */\n this.db_ = source.workspace.connectionDBList[type];\n\n /**\n * Connection database for connections compatible with this type on the\n * current workspace.\n */\n this.dbOpposite_ =\n source.workspace\n .connectionDBList[internalConstants.OPPOSITE_TYPE[type]];\n\n /** Workspace units, (0, 0) is top left of block. */\n this.offsetInBlock_ = new Coordinate(0, 0);\n\n /** Describes the state of this connection's tracked-ness. */\n this.trackedState_ = RenderedConnection.TrackedState.WILL_TRACK;\n }\n\n /**\n * Dispose of this connection. Remove it from the database (if it is\n * tracked) and call the super-function to deal with connected blocks.\n *\n * @internal\n */\n override dispose() {\n super.dispose();\n if (this.trackedState_ === RenderedConnection.TrackedState.TRACKED) {\n this.db_.removeConnection(this, this.y);\n }\n }\n\n /**\n * Get the source block for this connection.\n *\n * @returns The source block.\n */\n override getSourceBlock(): BlockSvg {\n return super.getSourceBlock() as BlockSvg;\n }\n\n /**\n * Returns the block that this connection connects to.\n *\n * @returns The connected block or null if none is connected.\n */\n override targetBlock(): BlockSvg|null {\n return super.targetBlock() as BlockSvg;\n }\n\n /**\n * Returns the distance between this connection and another connection in\n * workspace units.\n *\n * @param otherConnection The other connection to measure the distance to.\n * @returns The distance between connections, in workspace units.\n */\n distanceFrom(otherConnection: Connection): number {\n const xDiff = this.x - otherConnection.x;\n const yDiff = this.y - otherConnection.y;\n return Math.sqrt(xDiff * xDiff + yDiff * yDiff);\n }\n\n /**\n * Move the block(s) belonging to the connection to a point where they don't\n * visually interfere with the specified connection.\n *\n * @param staticConnection The connection to move away from.\n * @internal\n */\n bumpAwayFrom(staticConnection: RenderedConnection) {\n if (this.sourceBlock_.workspace.isDragging()) {\n // Don't move blocks around while the user is doing the same.\n return;\n }\n // Move the root block.\n let rootBlock = this.sourceBlock_.getRootBlock();\n if (rootBlock.isInFlyout) {\n // Don't move blocks around in a flyout.\n return;\n }\n let reverse = false;\n if (!rootBlock.isMovable()) {\n // Can't bump an uneditable block away.\n // Check to see if the other block is movable.\n rootBlock = staticConnection.getSourceBlock().getRootBlock();\n if (!rootBlock.isMovable()) {\n return;\n }\n // Swap the connections and move the 'static' connection instead.\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n staticConnection = this;\n reverse = true;\n }\n // Raise it to the top for extra visibility.\n const selected = common.getSelected() == rootBlock;\n selected || rootBlock.addSelect();\n let dx = staticConnection.x + config.snapRadius +\n Math.floor(Math.random() * BUMP_RANDOMNESS) - this.x;\n let dy = staticConnection.y + config.snapRadius +\n Math.floor(Math.random() * BUMP_RANDOMNESS) - this.y;\n if (reverse) {\n // When reversing a bump due to an uneditable block, bump up.\n dy = -dy;\n }\n if (rootBlock.RTL) {\n dx = staticConnection.x - config.snapRadius -\n Math.floor(Math.random() * BUMP_RANDOMNESS) - this.x;\n }\n rootBlock.moveBy(dx, dy);\n selected || rootBlock.removeSelect();\n }\n\n /**\n * Change the connection's coordinates.\n *\n * @param x New absolute x coordinate, in workspace coordinates.\n * @param y New absolute y coordinate, in workspace coordinates.\n */\n moveTo(x: number, y: number) {\n if (this.trackedState_ === RenderedConnection.TrackedState.WILL_TRACK) {\n this.db_.addConnection(this, y);\n this.trackedState_ = RenderedConnection.TrackedState.TRACKED;\n } else if (this.trackedState_ === RenderedConnection.TrackedState.TRACKED) {\n this.db_.removeConnection(this, this.y);\n this.db_.addConnection(this, y);\n }\n this.x = x;\n this.y = y;\n }\n\n /**\n * Change the connection's coordinates.\n *\n * @param dx Change to x coordinate, in workspace units.\n * @param dy Change to y coordinate, in workspace units.\n */\n moveBy(dx: number, dy: number) {\n this.moveTo(this.x + dx, this.y + dy);\n }\n\n /**\n * Move this connection to the location given by its offset within the block\n * and the location of the block's top left corner.\n *\n * @param blockTL The location of the top left corner of the block, in\n * workspace coordinates.\n */\n moveToOffset(blockTL: Coordinate) {\n this.moveTo(\n blockTL.x + this.offsetInBlock_.x, blockTL.y + this.offsetInBlock_.y);\n }\n\n /**\n * Set the offset of this connection relative to the top left of its block.\n *\n * @param x The new relative x, in workspace units.\n * @param y The new relative y, in workspace units.\n */\n setOffsetInBlock(x: number, y: number) {\n this.offsetInBlock_.x = x;\n this.offsetInBlock_.y = y;\n }\n\n /**\n * Get the offset of this connection relative to the top left of its block.\n *\n * @returns The offset of the connection.\n * @internal\n */\n getOffsetInBlock(): Coordinate {\n return this.offsetInBlock_;\n }\n\n /**\n * Move the blocks on either side of this connection right next to each other.\n *\n * @internal\n */\n tighten() {\n const dx = this.targetConnection!.x - this.x;\n const dy = this.targetConnection!.y - this.y;\n if (dx !== 0 || dy !== 0) {\n const block = this.targetBlock();\n const svgRoot = block!.getSvgRoot();\n if (!svgRoot) {\n throw Error('block is not rendered.');\n }\n // Workspace coordinates.\n const xy = svgMath.getRelativeXY(svgRoot);\n block!.getSvgRoot().setAttribute(\n 'transform', 'translate(' + (xy.x - dx) + ',' + (xy.y - dy) + ')');\n block!.moveConnections(-dx, -dy);\n }\n }\n\n /**\n * Find the closest compatible connection to this connection.\n * All parameters are in workspace units.\n *\n * @param maxLimit The maximum radius to another connection.\n * @param dxy Offset between this connection's location in the database and\n * the current location (as a result of dragging).\n * @returns Contains two properties: 'connection' which is either another\n * connection or null, and 'radius' which is the distance.\n */\n closest(maxLimit: number, dxy: Coordinate):\n {connection: RenderedConnection|null, radius: number} {\n return this.dbOpposite_.searchForClosest(this, maxLimit, dxy);\n }\n\n /** Add highlighting around this connection. */\n highlight() {\n let steps;\n const sourceBlockSvg = (this.sourceBlock_);\n const renderConstants =\n sourceBlockSvg.workspace.getRenderer().getConstants();\n const shape = renderConstants.shapeFor(this);\n if (this.type === ConnectionType.INPUT_VALUE ||\n this.type === ConnectionType.OUTPUT_VALUE) {\n // Vertical line, puzzle tab, vertical line.\n const yLen = renderConstants.TAB_OFFSET_FROM_TOP;\n steps = svgPaths.moveBy(0, -yLen) + svgPaths.lineOnAxis('v', yLen) +\n (shape as unknown as PathDownShape).pathDown +\n svgPaths.lineOnAxis('v', yLen);\n } else {\n const xLen =\n renderConstants.NOTCH_OFFSET_LEFT - renderConstants.CORNER_RADIUS;\n // Horizontal line, notch, horizontal line.\n steps = svgPaths.moveBy(-xLen, 0) + svgPaths.lineOnAxis('h', xLen) +\n (shape as unknown as PathLeftShape).pathLeft +\n svgPaths.lineOnAxis('h', xLen);\n }\n const xy = this.sourceBlock_.getRelativeToSurfaceXY();\n const x = this.x - xy.x;\n const y = this.y - xy.y;\n this.highlightPath = dom.createSvgElement(\n Svg.PATH, {\n 'class': 'blocklyHighlightedConnectionPath',\n 'd': steps,\n 'transform': 'translate(' + x + ',' + y + ')' +\n (this.sourceBlock_.RTL ? ' scale(-1 1)' : ''),\n },\n this.sourceBlock_.getSvgRoot());\n }\n\n /** Remove the highlighting around this connection. */\n unhighlight() {\n if (this.highlightPath) {\n dom.removeNode(this.highlightPath);\n this.highlightPath = null;\n }\n }\n\n /**\n * Set whether this connections is tracked in the database or not.\n *\n * @param doTracking If true, start tracking. If false, stop tracking.\n * @internal\n */\n setTracking(doTracking: boolean) {\n if (doTracking &&\n this.trackedState_ === RenderedConnection.TrackedState.TRACKED ||\n !doTracking &&\n this.trackedState_ === RenderedConnection.TrackedState.UNTRACKED) {\n return;\n }\n if (this.sourceBlock_.isInFlyout) {\n // Don't bother maintaining a database of connections in a flyout.\n return;\n }\n if (doTracking) {\n this.db_.addConnection(this, this.y);\n this.trackedState_ = RenderedConnection.TrackedState.TRACKED;\n return;\n }\n if (this.trackedState_ === RenderedConnection.TrackedState.TRACKED) {\n this.db_.removeConnection(this, this.y);\n }\n this.trackedState_ = RenderedConnection.TrackedState.UNTRACKED;\n }\n\n /**\n * Stop tracking this connection, as well as all down-stream connections on\n * any block attached to this connection. This happens when a block is\n * collapsed.\n *\n * Also closes down-stream icons/bubbles.\n *\n * @internal\n */\n stopTrackingAll() {\n this.setTracking(false);\n if (this.targetConnection) {\n const blocks = this.targetBlock()!.getDescendants(false);\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n // Stop tracking connections of all children.\n const connections = block.getConnections_(true);\n for (let j = 0; j < connections.length; j++) {\n (connections[j]).setTracking(false);\n }\n // Close all bubbles of all children.\n const icons = block.getIcons();\n for (let j = 0; j < icons.length; j++) {\n icons[j].setVisible(false);\n }\n }\n }\n }\n\n /**\n * Start tracking this connection, as well as all down-stream connections on\n * any block attached to this connection. This happens when a block is\n * expanded.\n *\n * @returns List of blocks to render.\n */\n startTrackingAll(): Block[] {\n this.setTracking(true);\n // All blocks that are not tracked must start tracking before any\n // rendering takes place, since rendering requires knowing the dimensions\n // of lower blocks. Also, since rendering a block renders all its parents,\n // we only need to render the leaf nodes.\n let renderList: Block[] = [];\n if (this.type !== ConnectionType.INPUT_VALUE &&\n this.type !== ConnectionType.NEXT_STATEMENT) {\n // Only spider down.\n return renderList;\n }\n const block = this.targetBlock();\n if (block) {\n let connections;\n if (block.isCollapsed()) {\n // This block should only be partially revealed since it is collapsed.\n connections = [];\n block.outputConnection && connections.push(block.outputConnection);\n block.nextConnection && connections.push(block.nextConnection);\n block.previousConnection && connections.push(block.previousConnection);\n } else {\n // Show all connections of this block.\n connections = block.getConnections_(true);\n }\n for (let i = 0; i < connections.length; i++) {\n renderList.push(...connections[i].startTrackingAll());\n }\n if (!renderList.length) {\n // Leaf block.\n renderList = [block];\n }\n }\n return renderList;\n }\n\n /**\n * Behavior after a connection attempt fails.\n * Bumps this connection away from the other connection. Called when an\n * attempted connection fails.\n *\n * @param otherConnection Connection that this connection failed to connect\n * to.\n * @internal\n */\n override onFailedConnect(otherConnection: Connection) {\n const block = this.getSourceBlock();\n if (eventUtils.getRecordUndo()) {\n const group = eventUtils.getGroup();\n setTimeout(function(this: RenderedConnection) {\n if (!block.isDisposed() && !block.getParent()) {\n eventUtils.setGroup(group);\n this.bumpAwayFrom(otherConnection as RenderedConnection);\n eventUtils.setGroup(false);\n }\n }.bind(this), config.bumpDelay);\n }\n }\n\n /**\n * Disconnect two blocks that are connected by this connection.\n *\n * @param parentBlock The superior block.\n * @param childBlock The inferior block.\n */\n protected override disconnectInternal_(\n parentBlock: Block, childBlock: Block) {\n super.disconnectInternal_(parentBlock, childBlock);\n const renderedParent = parentBlock as BlockSvg;\n const renderedChild = childBlock as BlockSvg;\n // Rerender the parent so that it may reflow.\n if (renderedParent.rendered) {\n renderedParent.render();\n }\n if (renderedChild.rendered) {\n renderedChild.updateDisabled();\n renderedChild.render();\n // Reset visibility, since the child is now a top block.\n renderedChild.getSvgRoot().style.display = 'block';\n }\n }\n\n /**\n * Respawn the shadow block if there was one connected to the this connection.\n * Render/rerender blocks as needed.\n */\n protected override respawnShadow_() {\n super.respawnShadow_();\n const blockShadow = this.targetBlock();\n if (!blockShadow) {\n return;\n }\n blockShadow.initSvg();\n blockShadow.render(false);\n\n const parentBlock = this.getSourceBlock();\n if (parentBlock.rendered) {\n parentBlock.render();\n }\n }\n\n /**\n * Find all nearby compatible connections to this connection.\n * Type checking does not apply, since this function is used for bumping.\n *\n * @param maxLimit The maximum radius to another connection, in workspace\n * units.\n * @returns List of connections.\n * @internal\n */\n override neighbours(maxLimit: number): Connection[] {\n return this.dbOpposite_.getNeighbours(this, maxLimit);\n }\n\n /**\n * Connect two connections together. This is the connection on the superior\n * block. Rerender blocks as needed.\n *\n * @param childConnection Connection on inferior block.\n */\n protected override connect_(childConnection: Connection) {\n super.connect_(childConnection);\n\n const renderedChildConnection = childConnection as RenderedConnection;\n\n const parentBlock = this.getSourceBlock();\n const childBlock = renderedChildConnection.getSourceBlock();\n const parentRendered = parentBlock.rendered;\n const childRendered = childBlock.rendered;\n\n if (parentRendered) {\n parentBlock.updateDisabled();\n }\n if (childRendered) {\n childBlock.updateDisabled();\n }\n if (parentRendered && childRendered) {\n if (this.type === ConnectionType.NEXT_STATEMENT ||\n this.type === ConnectionType.PREVIOUS_STATEMENT) {\n // Child block may need to square off its corners if it is in a stack.\n // Rendering a child will render its parent.\n childBlock.render();\n } else {\n // Child block does not change shape. Rendering the parent node will\n // move its connected children into position.\n parentBlock.render();\n }\n }\n\n // The input the child block is connected to (if any).\n const parentInput = parentBlock.getInputWithBlock(childBlock);\n if (parentInput) {\n const visible = parentInput.isVisible();\n childBlock.getSvgRoot().style.display = visible ? 'block' : 'none';\n }\n }\n\n /**\n * Function to be called when this connection's compatible types have changed.\n */\n protected override onCheckChanged_() {\n // The new value type may not be compatible with the existing connection.\n if (this.isConnected() &&\n (!this.targetConnection ||\n !this.getConnectionChecker().canConnect(\n this, this.targetConnection, false))) {\n const child = this.isSuperior() ? this.targetBlock() : this.sourceBlock_;\n child!.unplug();\n // Bump away.\n this.sourceBlock_.bumpNeighbours();\n }\n }\n}\n\nexport namespace RenderedConnection {\n /**\n * Enum for different kinds of tracked states.\n *\n * WILL_TRACK means that this connection will add itself to\n * the db on the next moveTo call it receives.\n *\n * UNTRACKED means that this connection will not add\n * itself to the database until setTracking(true) is explicitly called.\n *\n * TRACKED means that this connection is currently being tracked.\n */\n export enum TrackedState {\n WILL_TRACK = -1,\n UNTRACKED = 0,\n TRACKED = 1,\n }\n}\n\nexport type TrackedState = RenderedConnection.TrackedState;\nexport const TrackedState = RenderedConnection.TrackedState;\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a warning.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Warning');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_bubble_open.js';\n\nimport type {BlockSvg} from './block_svg.js';\nimport {Bubble} from './bubble.js';\nimport * as eventUtils from './events/utils.js';\nimport {Icon} from './icon.js';\nimport type {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\n\n\n/**\n * Class for a warning.\n *\n * @alias Blockly.Warning\n */\nexport class Warning extends Icon {\n private text_: {[key: string]: string};\n\n /** The top-level node of the warning text, or null if not created. */\n private paragraphElement_: SVGTextElement|null = null;\n\n /** Does this icon get hidden when the block is collapsed? */\n override collapseHidden = false;\n\n /** @param block The block associated with this warning. */\n constructor(block: BlockSvg) {\n super(block);\n this.createIcon();\n // The text_ object can contain multiple warnings.\n this.text_ = Object.create(null);\n }\n\n /**\n * Draw the warning icon.\n *\n * @param group The icon group.\n */\n protected override drawIcon_(group: Element) {\n // Triangle with rounded corners.\n dom.createSvgElement(\n Svg.PATH, {\n 'class': 'blocklyIconShape',\n 'd': 'M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z',\n },\n group);\n // Can't use a real '!' text character since different browsers and\n // operating systems render it differently. Body of exclamation point.\n dom.createSvgElement(\n Svg.PATH, {\n 'class': 'blocklyIconSymbol',\n 'd': 'm7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z',\n },\n group);\n // Dot of exclamation point.\n dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blocklyIconSymbol',\n 'x': '7',\n 'y': '11',\n 'height': '2',\n 'width': '2',\n },\n group);\n }\n\n /**\n * Show or hide the warning bubble.\n *\n * @param visible True if the bubble should be visible.\n */\n override setVisible(visible: boolean) {\n if (visible === this.isVisible()) {\n return;\n }\n eventUtils.fire(new (eventUtils.get(eventUtils.BUBBLE_OPEN))(\n this.getBlock(), visible, 'warning'));\n if (visible) {\n this.createBubble_();\n } else {\n this.disposeBubble_();\n }\n }\n\n /** Show the bubble. */\n private createBubble_() {\n this.paragraphElement_ = Bubble.textToDom(this.getText());\n this.bubble_ = Bubble.createNonEditableBubble(\n this.paragraphElement_, this.getBlock(), this.iconXY_ as Coordinate);\n this.applyColour();\n }\n\n /** Dispose of the bubble and references to it. */\n private disposeBubble_() {\n if (this.bubble_) {\n this.bubble_.dispose();\n this.bubble_ = null;\n }\n this.paragraphElement_ = null;\n }\n\n /**\n * Set this warning's text.\n *\n * @param text Warning text (or '' to delete). This supports linebreaks.\n * @param id An ID for this text entry to be able to maintain multiple\n * warnings.\n */\n setText(text: string, id: string) {\n if (this.text_[id] === text) {\n return;\n }\n if (text) {\n this.text_[id] = text;\n } else {\n delete this.text_[id];\n }\n if (this.isVisible()) {\n this.setVisible(false);\n this.setVisible(true);\n }\n }\n\n /**\n * Get this warning's texts.\n *\n * @returns All texts concatenated into one string.\n */\n getText(): string {\n const allWarnings = [];\n for (const id in this.text_) {\n allWarnings.push(this.text_[id]);\n }\n return allWarnings.join('\\n');\n }\n\n /** Dispose of this warning. */\n override dispose() {\n this.getBlock().warning = null;\n super.dispose();\n }\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for graphically rendering a block as SVG.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.BlockSvg');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_selected.js';\n\nimport {Block} from './block.js';\nimport * as blockAnimations from './block_animations.js';\nimport * as browserEvents from './browser_events.js';\nimport {Comment} from './comment.js';\nimport * as common from './common.js';\nimport {config} from './config.js';\nimport type {Connection} from './connection.js';\nimport {ConnectionType} from './connection_type.js';\nimport * as constants from './constants.js';\nimport * as ContextMenu from './contextmenu.js';\nimport {ContextMenuOption, ContextMenuRegistry, LegacyContextMenuOption} from './contextmenu_registry.js';\nimport type {BlockMove} from './events/events_block_move.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Field} from './field.js';\nimport {FieldLabel} from './field_label.js';\nimport type {Icon} from './icon.js';\nimport type {Input} from './input.js';\nimport type {IASTNodeLocationSvg} from './interfaces/i_ast_node_location_svg.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {CopyData, ICopyable} from './interfaces/i_copyable.js';\nimport type {IDraggable} from './interfaces/i_draggable.js';\nimport * as internalConstants from './internal_constants.js';\nimport {ASTNode} from './keyboard_nav/ast_node.js';\nimport {TabNavigateCursor} from './keyboard_nav/tab_navigate_cursor.js';\nimport {MarkerManager} from './marker_manager.js';\nimport {Msg} from './msg.js';\nimport type {Mutator} from './mutator.js';\nimport {RenderedConnection} from './rendered_connection.js';\nimport type {Debug as BlockRenderingDebug} from './renderers/common/debugger.js';\nimport type {IPathObject} from './renderers/common/i_path_object.js';\nimport * as blocks from './serialization/blocks.js';\nimport type {BlockStyle} from './theme.js';\nimport * as Tooltip from './tooltip.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Rect} from './utils/rect.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\nimport {Warning} from './warning.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a block's SVG representation.\n * Not normally called directly, workspace.newBlock() is preferred.\n *\n * @alias Blockly.BlockSvg\n */\nexport class BlockSvg extends Block implements IASTNodeLocationSvg,\n IBoundedElement, ICopyable,\n IDraggable {\n /**\n * Constant for identifying rows that are to be rendered inline.\n * Don't collide with Blockly.inputTypes.\n */\n static readonly INLINE = -1;\n\n /**\n * ID to give the \"collapsed warnings\" warning. Allows us to remove the\n * \"collapsed warnings\" warning without removing any warnings that belong to\n * the block.\n */\n static readonly COLLAPSED_WARNING_ID = 'TEMP_COLLAPSED_WARNING_';\n override decompose?: ((p1: Workspace) => BlockSvg);\n // override compose?: ((p1: BlockSvg) => void)|null;\n saveConnections?: ((p1: BlockSvg) => AnyDuringMigration);\n customContextMenu?:\n ((p1: Array<ContextMenuOption|LegacyContextMenuOption>) =>\n AnyDuringMigration)|null;\n\n /**\n * An property used internally to reference the block's rendering debugger.\n *\n * @internal\n */\n renderingDebugger: BlockRenderingDebug|null = null;\n\n /**\n * Height of this block, not including any statement blocks above or below.\n * Height is in workspace units.\n */\n height = 0;\n\n /**\n * Width of this block, including any connected value blocks.\n * Width is in workspace units.\n */\n width = 0;\n\n /**\n * Map from IDs for warnings text to PIDs of functions to apply them.\n * Used to be able to maintain multiple warnings.\n */\n private warningTextDb = new Map<string, ReturnType<typeof setTimeout>>();\n\n /** Block's mutator icon (if any). */\n mutator: Mutator|null = null;\n\n /** Block's comment icon (if any). */\n private commentIcon_: Comment|null = null;\n\n /** Block's warning icon (if any). */\n warning: Warning|null = null;\n\n private svgGroup_: SVGGElement;\n style: BlockStyle;\n /** @internal */\n pathObject: IPathObject;\n override rendered = false;\n\n /**\n * Is this block currently rendering? Used to stop recursive render calls\n * from actually triggering a re-render.\n */\n private renderIsInProgress_ = false;\n\n /** Whether mousedown events have been bound yet. */\n private eventsInit_ = false;\n\n override workspace: WorkspaceSvg;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override outputConnection!: RenderedConnection;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override nextConnection!: RenderedConnection;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override previousConnection!: RenderedConnection;\n private readonly useDragSurface_: boolean;\n\n /**\n * @param workspace The block's workspace.\n * @param prototypeName Name of the language object containing type-specific\n * functions for this block.\n * @param opt_id Optional ID. Use this ID if provided, otherwise create a new\n * ID.\n */\n constructor(workspace: WorkspaceSvg, prototypeName: string, opt_id?: string) {\n super(workspace, prototypeName, opt_id);\n this.workspace = workspace;\n\n /**\n * An optional method called when a mutator dialog is first opened.\n * This function must create and initialize a top-level block for the\n * mutator dialog, and return it. This function should also populate this\n * top-level block with any sub-blocks which are appropriate. This method\n * must also be coupled with defining a `compose` method for the default\n * mutation dialog button and UI to appear.\n */\n this.decompose = this.decompose;\n\n /**\n * An optional method called when a mutator dialog saves its content.\n * This function is called to modify the original block according to new\n * settings. This method must also be coupled with defining a `decompose`\n * method for the default mutation dialog button and UI to appear.\n */\n this.compose = this.compose;\n\n /**\n * An optional method called by the default mutator UI which gives the block\n * a chance to save information about what child blocks are connected to\n * what mutated connections.\n */\n this.saveConnections = this.saveConnections;\n\n /** An optional method for defining custom block context menu items. */\n this.customContextMenu = this.customContextMenu;\n this.svgGroup_ = dom.createSvgElement(Svg.G, {});\n (this.svgGroup_ as AnyDuringMigration).translate_ = '';\n\n /** A block style object. */\n this.style = workspace.getRenderer().getConstants().getBlockStyle(null);\n\n /** The renderer's path object. */\n this.pathObject =\n workspace.getRenderer().makePathObject(this.svgGroup_, this.style);\n\n /**\n * Whether to move the block to the drag surface when it is dragged.\n * True if it should move, false if it should be translated directly.\n */\n this.useDragSurface_ = !!workspace.getBlockDragSurface();\n\n const svgPath = this.pathObject.svgPath;\n (svgPath as AnyDuringMigration).tooltip = this;\n Tooltip.bindMouseEvents(svgPath);\n\n // Expose this block's ID on its top-level SVG group.\n this.svgGroup_.setAttribute('data-id', this.id);\n\n this.doInit_();\n }\n\n /**\n * Create and initialize the SVG representation of the block.\n * May be called more than once.\n */\n initSvg() {\n if (!this.workspace.rendered) {\n throw TypeError('Workspace is headless.');\n }\n for (let i = 0, input; input = this.inputList[i]; i++) {\n input.init();\n }\n const icons = this.getIcons();\n for (let i = 0; i < icons.length; i++) {\n icons[i].createIcon();\n }\n this.applyColour();\n this.pathObject.updateMovable(this.isMovable());\n const svg = this.getSvgRoot();\n if (!this.workspace.options.readOnly && !this.eventsInit_ && svg) {\n browserEvents.conditionalBind(svg, 'mousedown', this, this.onMouseDown_);\n }\n this.eventsInit_ = true;\n\n if (!svg.parentNode) {\n this.workspace.getCanvas().appendChild(svg);\n }\n }\n\n /**\n * Get the secondary colour of a block.\n *\n * @returns #RRGGBB string.\n */\n getColourSecondary(): string|undefined {\n return this.style.colourSecondary;\n }\n\n /**\n * Get the tertiary colour of a block.\n *\n * @returns #RRGGBB string.\n */\n getColourTertiary(): string|undefined {\n return this.style.colourTertiary;\n }\n\n /**\n * Selects this block. Highlights the block visually and fires a select event\n * if the block is not already selected.\n */\n select() {\n if (this.isShadow() && this.getParent()) {\n // Shadow blocks should not be selected.\n this.getParent()!.select();\n return;\n }\n if (common.getSelected() === this) {\n return;\n }\n let oldId = null;\n if (common.getSelected()) {\n oldId = common.getSelected()!.id;\n // Unselect any previously selected block.\n eventUtils.disable();\n try {\n common.getSelected()!.unselect();\n } finally {\n eventUtils.enable();\n }\n }\n const event = new (eventUtils.get(eventUtils.SELECTED))(\n oldId, this.id, this.workspace.id);\n eventUtils.fire(event);\n common.setSelected(this);\n this.addSelect();\n }\n\n /**\n * Unselects this block. Unhighlights the block and fires a select (false)\n * event if the block is currently selected.\n */\n unselect() {\n if (common.getSelected() !== this) {\n return;\n }\n const event = new (eventUtils.get(eventUtils.SELECTED))(\n this.id, null, this.workspace.id);\n event.workspaceId = this.workspace.id;\n eventUtils.fire(event);\n common.setSelected(null);\n this.removeSelect();\n }\n\n /**\n * Returns a list of mutator, comment, and warning icons.\n *\n * @returns List of icons.\n */\n getIcons(): Icon[] {\n const icons = [];\n if (this.mutator) {\n icons.push(this.mutator);\n }\n if (this.commentIcon_) {\n icons.push(this.commentIcon_);\n }\n if (this.warning) {\n icons.push(this.warning);\n }\n return icons;\n }\n\n /**\n * Sets the parent of this block to be a new block or null.\n *\n * @param newParent New parent block.\n * @internal\n */\n override setParent(newParent: this|null) {\n const oldParent = this.parentBlock_;\n if (newParent === oldParent) {\n return;\n }\n\n dom.startTextWidthCache();\n super.setParent(newParent);\n dom.stopTextWidthCache();\n\n const svgRoot = this.getSvgRoot();\n\n // Bail early if workspace is clearing, or we aren't rendered.\n // We won't need to reattach ourselves anywhere.\n if (this.workspace.isClearing || !svgRoot) {\n return;\n }\n\n const oldXY = this.getRelativeToSurfaceXY();\n if (newParent) {\n (newParent as BlockSvg).getSvgRoot().appendChild(svgRoot);\n const newXY = this.getRelativeToSurfaceXY();\n // Move the connections to match the child's new position.\n this.moveConnections(newXY.x - oldXY.x, newXY.y - oldXY.y);\n } else if (oldParent) {\n // If we are losing a parent, we want to move our DOM element to the\n // root of the workspace.\n this.workspace.getCanvas().appendChild(svgRoot);\n this.translate(oldXY.x, oldXY.y);\n }\n\n this.applyColour();\n }\n\n /**\n * Return the coordinates of the top-left corner of this block relative to the\n * drawing surface's origin (0,0), in workspace units.\n * If the block is on the workspace, (0, 0) is the origin of the workspace\n * coordinate system.\n * This does not change with workspace scale.\n *\n * @returns Object with .x and .y properties in workspace coordinates.\n */\n override getRelativeToSurfaceXY(): Coordinate {\n let x = 0;\n let y = 0;\n\n const dragSurfaceGroup = this.useDragSurface_ ?\n this.workspace.getBlockDragSurface()!.getGroup() :\n null;\n\n let element: SVGElement = this.getSvgRoot();\n if (element) {\n do {\n // Loop through this block and every parent.\n const xy = svgMath.getRelativeXY(element);\n x += xy.x;\n y += xy.y;\n // If this element is the current element on the drag surface, include\n // the translation of the drag surface itself.\n if (this.useDragSurface_ &&\n this.workspace.getBlockDragSurface()!.getCurrentBlock() ===\n element) {\n const surfaceTranslation =\n this.workspace.getBlockDragSurface()!.getSurfaceTranslation();\n x += surfaceTranslation.x;\n y += surfaceTranslation.y;\n }\n element = element.parentNode as SVGElement;\n } while (element && element !== this.workspace.getCanvas() &&\n element !== dragSurfaceGroup);\n }\n return new Coordinate(x, y);\n }\n\n /**\n * Move a block by a relative offset.\n *\n * @param dx Horizontal offset in workspace units.\n * @param dy Vertical offset in workspace units.\n */\n override moveBy(dx: number, dy: number) {\n if (this.parentBlock_) {\n throw Error('Block has parent.');\n }\n const eventsEnabled = eventUtils.isEnabled();\n let event: BlockMove|null = null;\n if (eventsEnabled) {\n event = new (eventUtils.get(eventUtils.BLOCK_MOVE))!(this) as BlockMove;\n }\n const xy = this.getRelativeToSurfaceXY();\n this.translate(xy.x + dx, xy.y + dy);\n this.moveConnections(dx, dy);\n if (eventsEnabled && event) {\n event!.recordNew();\n eventUtils.fire(event);\n }\n this.workspace.resizeContents();\n }\n\n /**\n * Transforms a block by setting the translation on the transform attribute\n * of the block's SVG.\n *\n * @param x The x coordinate of the translation in workspace units.\n * @param y The y coordinate of the translation in workspace units.\n */\n translate(x: number, y: number) {\n this.getSvgRoot().setAttribute(\n 'transform', 'translate(' + x + ',' + y + ')');\n }\n\n /**\n * Move this block to its workspace's drag surface, accounting for\n * positioning. Generally should be called at the same time as\n * setDragging_(true). Does nothing if useDragSurface_ is false.\n *\n * @internal\n */\n moveToDragSurface() {\n if (!this.useDragSurface_) {\n return;\n }\n // The translation for drag surface blocks,\n // is equal to the current relative-to-surface position,\n // to keep the position in sync as it move on/off the surface.\n // This is in workspace coordinates.\n const xy = this.getRelativeToSurfaceXY();\n this.clearTransformAttributes_();\n this.workspace.getBlockDragSurface()!.translateSurface(xy.x, xy.y);\n // Execute the move on the top-level SVG component\n const svg = this.getSvgRoot();\n if (svg) {\n this.workspace.getBlockDragSurface()!.setBlocksAndShow(svg);\n }\n }\n\n /**\n * Move a block to a position.\n *\n * @param xy The position to move to in workspace units.\n */\n moveTo(xy: Coordinate) {\n const curXY = this.getRelativeToSurfaceXY();\n this.moveBy(xy.x - curXY.x, xy.y - curXY.y);\n }\n\n /**\n * Move this block back to the workspace block canvas.\n * Generally should be called at the same time as setDragging_(false).\n * Does nothing if useDragSurface_ is false.\n *\n * @param newXY The position the block should take on on the workspace canvas,\n * in workspace coordinates.\n * @internal\n */\n moveOffDragSurface(newXY: Coordinate) {\n if (!this.useDragSurface_) {\n return;\n }\n // Translate to current position, turning off 3d.\n this.translate(newXY.x, newXY.y);\n this.workspace.getBlockDragSurface()!.clearAndHide(\n this.workspace.getCanvas());\n }\n\n /**\n * Move this block during a drag, taking into account whether we are using a\n * drag surface to translate blocks.\n * This block must be a top-level block.\n *\n * @param newLoc The location to translate to, in workspace coordinates.\n * @internal\n */\n moveDuringDrag(newLoc: Coordinate) {\n if (this.useDragSurface_) {\n this.workspace.getBlockDragSurface()!.translateSurface(\n newLoc.x, newLoc.y);\n } else {\n (this.svgGroup_ as AnyDuringMigration).translate_ =\n 'translate(' + newLoc.x + ',' + newLoc.y + ')';\n (this.svgGroup_ as AnyDuringMigration)\n .setAttribute(\n 'transform',\n (this.svgGroup_ as AnyDuringMigration).translate_ +\n (this.svgGroup_ as AnyDuringMigration).skew_);\n }\n }\n\n /**\n * Clear the block of transform=\"...\" attributes.\n * Used when the block is switching from 3d to 2d transform or vice versa.\n */\n private clearTransformAttributes_() {\n this.getSvgRoot().removeAttribute('transform');\n }\n\n /** Snap this block to the nearest grid point. */\n snapToGrid() {\n if (this.isDeadOrDying()) {\n return; // Deleted block.\n }\n if (this.workspace.isDragging()) {\n return; // Don't bump blocks during a drag.;\n }\n\n if (this.getParent()) {\n return; // Only snap top-level blocks.\n }\n if (this.isInFlyout) {\n return; // Don't move blocks around in a flyout.\n }\n const grid = this.workspace.getGrid();\n if (!grid || !grid.shouldSnap()) {\n return; // Config says no snapping.\n }\n const spacing = grid.getSpacing();\n const half = spacing / 2;\n const xy = this.getRelativeToSurfaceXY();\n const dx =\n Math.round(Math.round((xy.x - half) / spacing) * spacing + half - xy.x);\n const dy =\n Math.round(Math.round((xy.y - half) / spacing) * spacing + half - xy.y);\n if (dx || dy) {\n this.moveBy(dx, dy);\n }\n }\n\n /**\n * Returns the coordinates of a bounding box describing the dimensions of this\n * block and any blocks stacked below it.\n * Coordinate system: workspace coordinates.\n *\n * @returns Object with coordinates of the bounding box.\n */\n getBoundingRectangle(): Rect {\n const blockXY = this.getRelativeToSurfaceXY();\n const blockBounds = this.getHeightWidth();\n let left;\n let right;\n if (this.RTL) {\n left = blockXY.x - blockBounds.width;\n right = blockXY.x;\n } else {\n left = blockXY.x;\n right = blockXY.x + blockBounds.width;\n }\n return new Rect(blockXY.y, blockXY.y + blockBounds.height, left, right);\n }\n\n /**\n * Notify every input on this block to mark its fields as dirty.\n * A dirty field is a field that needs to be re-rendered.\n */\n markDirty() {\n this.pathObject.constants = this.workspace.getRenderer().getConstants();\n for (let i = 0, input; input = this.inputList[i]; i++) {\n input.markDirty();\n }\n }\n\n /**\n * Set whether the block is collapsed or not.\n *\n * @param collapsed True if collapsed.\n */\n override setCollapsed(collapsed: boolean) {\n if (this.collapsed_ === collapsed) {\n return;\n }\n super.setCollapsed(collapsed);\n if (!collapsed) {\n this.updateCollapsed_();\n } else if (this.rendered) {\n this.render();\n // Don't bump neighbours. Users like to store collapsed functions together\n // and bumping makes them go out of alignment.\n }\n }\n\n /**\n * Makes sure that when the block is collapsed, it is rendered correctly\n * for that state.\n */\n private updateCollapsed_() {\n const collapsed = this.isCollapsed();\n const collapsedInputName = constants.COLLAPSED_INPUT_NAME;\n const collapsedFieldName = constants.COLLAPSED_FIELD_NAME;\n\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.name !== collapsedInputName) {\n input.setVisible(!collapsed);\n }\n }\n\n if (!collapsed) {\n this.updateDisabled();\n this.removeInput(collapsedInputName);\n return;\n }\n\n const icons = this.getIcons();\n for (let i = 0, icon; icon = icons[i]; i++) {\n icon.setVisible(false);\n }\n\n const text = this.toString(internalConstants.COLLAPSE_CHARS);\n const field = this.getField(collapsedFieldName);\n if (field) {\n field.setValue(text);\n return;\n }\n const input = this.getInput(collapsedInputName) ||\n this.appendDummyInput(collapsedInputName);\n input.appendField(new FieldLabel(text), collapsedFieldName);\n }\n\n /**\n * Open the next (or previous) FieldTextInput.\n *\n * @param start Current field.\n * @param forward If true go forward, otherwise backward.\n */\n tab(start: Field, forward: boolean) {\n const tabCursor = new TabNavigateCursor();\n tabCursor.setCurNode(ASTNode.createFieldNode(start)!);\n const currentNode = tabCursor.getCurNode();\n\n if (forward) {\n tabCursor.next();\n } else {\n tabCursor.prev();\n }\n\n const nextNode = tabCursor.getCurNode();\n if (nextNode && nextNode !== currentNode) {\n const nextField = nextNode.getLocation() as Field;\n nextField.showEditor();\n\n // Also move the cursor if we're in keyboard nav mode.\n if (this.workspace.keyboardAccessibilityMode) {\n this.workspace.getCursor()!.setCurNode(nextNode);\n }\n }\n }\n\n /**\n * Handle a mouse-down on an SVG block.\n *\n * @param e Mouse down event or touch start event.\n */\n private onMouseDown_(e: Event) {\n const gesture = this.workspace.getGesture(e);\n if (gesture) {\n gesture.handleBlockStart(e, this);\n }\n }\n\n /**\n * Load the block's help page in a new window.\n *\n * @internal\n */\n showHelp() {\n const url =\n typeof this.helpUrl === 'function' ? this.helpUrl() : this.helpUrl;\n if (url) {\n window.open(url);\n }\n }\n\n /**\n * Generate the context menu for this block.\n *\n * @returns Context menu options or null if no menu.\n */\n protected generateContextMenu():\n Array<ContextMenuOption|LegacyContextMenuOption>|null {\n if (this.workspace.options.readOnly || !this.contextMenu) {\n return null;\n }\n // AnyDuringMigration because: Argument of type '{ block: this; }' is not\n // assignable to parameter of type 'Scope'.\n const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(\n ContextMenuRegistry.ScopeType.BLOCK,\n {block: this} as AnyDuringMigration);\n\n // Allow the block to add or modify menuOptions.\n if (this.customContextMenu) {\n this.customContextMenu(menuOptions);\n }\n\n return menuOptions;\n }\n\n /**\n * Show the context menu for this block.\n *\n * @param e Mouse event.\n * @internal\n */\n showContextMenu(e: Event) {\n const menuOptions = this.generateContextMenu();\n\n if (menuOptions && menuOptions.length) {\n ContextMenu.show(e, menuOptions, this.RTL);\n ContextMenu.setCurrentBlock(this);\n }\n }\n\n /**\n * Move the connections for this block and all blocks attached under it.\n * Also update any attached bubbles.\n *\n * @param dx Horizontal offset from current location, in workspace units.\n * @param dy Vertical offset from current location, in workspace units.\n * @internal\n */\n moveConnections(dx: number, dy: number) {\n if (!this.rendered) {\n // Rendering is required to lay out the blocks.\n // This is probably an invisible block attached to a collapsed block.\n return;\n }\n const myConnections = this.getConnections_(false);\n for (let i = 0; i < myConnections.length; i++) {\n myConnections[i].moveBy(dx, dy);\n }\n const icons = this.getIcons();\n for (let i = 0; i < icons.length; i++) {\n icons[i].computeIconLocation();\n }\n\n // Recurse through all blocks attached under this one.\n for (let i = 0; i < this.childBlocks_.length; i++) {\n (this.childBlocks_[i] as BlockSvg).moveConnections(dx, dy);\n }\n }\n\n /**\n * Recursively adds or removes the dragging class to this node and its\n * children.\n *\n * @param adding True if adding, false if removing.\n * @internal\n */\n setDragging(adding: boolean) {\n if (adding) {\n const group = this.getSvgRoot();\n (group as AnyDuringMigration).translate_ = '';\n (group as AnyDuringMigration).skew_ = '';\n common.draggingConnections.push(...this.getConnections_(true));\n dom.addClass(this.svgGroup_, 'blocklyDragging');\n } else {\n common.draggingConnections.length = 0;\n dom.removeClass(this.svgGroup_, 'blocklyDragging');\n }\n // Recurse through all blocks attached under this one.\n for (let i = 0; i < this.childBlocks_.length; i++) {\n (this.childBlocks_[i] as BlockSvg).setDragging(adding);\n }\n }\n\n /**\n * Set whether this block is movable or not.\n *\n * @param movable True if movable.\n */\n override setMovable(movable: boolean) {\n super.setMovable(movable);\n this.pathObject.updateMovable(movable);\n }\n\n /**\n * Set whether this block is editable or not.\n *\n * @param editable True if editable.\n */\n override setEditable(editable: boolean) {\n super.setEditable(editable);\n const icons = this.getIcons();\n for (let i = 0; i < icons.length; i++) {\n icons[i].updateEditable();\n }\n }\n\n /**\n * Sets whether this block is a shadow block or not.\n *\n * @param shadow True if a shadow.\n * @internal\n */\n override setShadow(shadow: boolean) {\n super.setShadow(shadow);\n this.applyColour();\n }\n\n /**\n * Set whether this block is an insertion marker block or not.\n * Once set this cannot be unset.\n *\n * @param insertionMarker True if an insertion marker.\n * @internal\n */\n override setInsertionMarker(insertionMarker: boolean) {\n if (this.isInsertionMarker_ === insertionMarker) {\n return; // No change.\n }\n this.isInsertionMarker_ = insertionMarker;\n if (this.isInsertionMarker_) {\n this.setColour(\n this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR);\n this.pathObject.updateInsertionMarker(true);\n }\n }\n\n /**\n * Return the root node of the SVG or null if none exists.\n *\n * @returns The root SVG node (probably a group).\n */\n getSvgRoot(): SVGGElement {\n return this.svgGroup_;\n }\n\n /**\n * Dispose of this block.\n *\n * @param healStack If true, then try to heal any gap by connecting the next\n * statement with the previous statement. Otherwise, dispose of all\n * children of this block.\n * @param animate If true, show a disposal animation and sound.\n * @suppress {checkTypes}\n */\n override dispose(healStack?: boolean, animate?: boolean) {\n if (this.isDeadOrDying()) {\n return;\n }\n Tooltip.dispose();\n Tooltip.unbindMouseEvents(this.pathObject.svgPath);\n dom.startTextWidthCache();\n // Save the block's workspace temporarily so we can resize the\n // contents once the block is disposed.\n const blockWorkspace = this.workspace;\n // If this block is being dragged, unlink the mouse events.\n if (common.getSelected() === this) {\n this.unselect();\n this.workspace.cancelCurrentGesture();\n }\n // If this block has a context menu open, close it.\n if (ContextMenu.getCurrentBlock() === this) {\n ContextMenu.hide();\n }\n\n if (animate && this.rendered) {\n this.unplug(healStack);\n blockAnimations.disposeUiEffect(this);\n }\n // Stop rerendering.\n this.rendered = false;\n\n // Clear pending warnings.\n for (const n of this.warningTextDb.values()) {\n clearTimeout(n);\n }\n this.warningTextDb.clear();\n\n const icons = this.getIcons();\n for (let i = 0; i < icons.length; i++) {\n icons[i].dispose();\n }\n\n // Just deleting this block from the DOM would result in a memory leak as\n // well as corruption of the connection database. Therefore we must\n // methodically step through the blocks and carefully disassemble them.\n if (common.getSelected() === this) {\n common.setSelected(null);\n }\n\n super.dispose(!!healStack);\n\n dom.removeNode(this.svgGroup_);\n blockWorkspace.resizeContents();\n // Sever JavaScript to DOM connections.\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'SVGGElement'.\n this.svgGroup_ = null as AnyDuringMigration;\n dom.stopTextWidthCache();\n }\n\n /**\n * Delete a block and hide chaff when doing so. The block will not be deleted\n * if it's in a flyout. This is called from the context menu and keyboard\n * shortcuts as the full delete action. If you are disposing of a block from\n * the workspace and don't need to perform flyout checks, handle event\n * grouping, or hide chaff, then use `block.dispose()` directly.\n */\n checkAndDelete() {\n if (this.workspace.isFlyout) {\n return;\n }\n eventUtils.setGroup(true);\n this.workspace.hideChaff();\n if (this.outputConnection) {\n // Do not attempt to heal rows\n // (https://github.com/google/blockly/issues/4832)\n this.dispose(false, true);\n } else {\n this.dispose(/* heal */\n true, true);\n }\n eventUtils.setGroup(false);\n }\n\n /**\n * Encode a block for copying.\n *\n * @returns Copy metadata, or null if the block is an insertion marker.\n * @internal\n */\n toCopyData(): CopyData|null {\n if (this.isInsertionMarker_) {\n return null;\n }\n return {\n saveInfo:\n blocks.save(this, {addCoordinates: true, addNextBlocks: false}) as\n blocks.State,\n source: this.workspace,\n typeCounts: common.getBlockTypeCounts(this, true),\n };\n }\n\n /**\n * Updates the colour of the block to match the block's state.\n *\n * @internal\n */\n applyColour() {\n this.pathObject.applyColour(this);\n\n const icons = this.getIcons();\n for (let i = 0; i < icons.length; i++) {\n icons[i].applyColour();\n }\n\n for (let x = 0, input; input = this.inputList[x]; x++) {\n for (let y = 0, field; field = input.fieldRow[y]; y++) {\n field.applyColour();\n }\n }\n }\n\n /**\n * Updates the color of the block (and children) to match the current disabled\n * state.\n *\n * @internal\n */\n updateDisabled() {\n const children = (this.getChildren(false));\n this.applyColour();\n if (this.isCollapsed()) {\n return;\n }\n for (let i = 0, child; child = children[i]; i++) {\n if (child.rendered) {\n child.updateDisabled();\n }\n }\n }\n\n /**\n * Get the comment icon attached to this block, or null if the block has no\n * comment.\n *\n * @returns The comment icon attached to this block, or null.\n */\n getCommentIcon(): Comment|null {\n return this.commentIcon_;\n }\n\n /**\n * Set this block's comment text.\n *\n * @param text The text, or null to delete.\n */\n override setCommentText(text: string|null) {\n // AnyDuringMigration because: Property 'get' does not exist on type\n // '(name: string) => void'.\n if (this.commentModel.text === text) {\n return;\n }\n super.setCommentText(text);\n\n const shouldHaveComment = text !== null;\n if (!!this.commentIcon_ === shouldHaveComment) {\n // If the comment's state of existence is correct, but the text is new\n // that means we're just updating a comment.\n this.commentIcon_!.updateText();\n return;\n }\n if (shouldHaveComment) {\n this.commentIcon_ = new Comment(this);\n this.comment = this.commentIcon_; // For backwards compatibility.\n } else {\n this.commentIcon_!.dispose();\n this.commentIcon_ = null;\n this.comment = null; // For backwards compatibility.\n }\n if (this.rendered) {\n this.render();\n // Adding or removing a comment icon will cause the block to change shape.\n this.bumpNeighbours();\n }\n }\n\n /**\n * Set this block's warning text.\n *\n * @param text The text, or null to delete.\n * @param opt_id An optional ID for the warning text to be able to maintain\n * multiple warnings.\n */\n override setWarningText(text: string|null, opt_id?: string) {\n const id = opt_id || '';\n if (!id) {\n // Kill all previous pending processes, this edit supersedes them all.\n for (const timeout of this.warningTextDb.values()) {\n clearTimeout(timeout);\n }\n this.warningTextDb.clear();\n } else if (this.warningTextDb.has(id)) {\n // Only queue up the latest change. Kill any earlier pending process.\n clearTimeout(this.warningTextDb.get(id)!);\n this.warningTextDb.delete(id);\n }\n if (this.workspace.isDragging()) {\n // Don't change the warning text during a drag.\n // Wait until the drag finishes.\n this.warningTextDb.set(id, setTimeout(() => {\n if (!this.isDeadOrDying()) {\n this.warningTextDb.delete(id);\n this.setWarningText(text, id);\n }\n }, 100));\n return;\n }\n if (this.isInFlyout) {\n text = null;\n }\n\n let changedState = false;\n if (typeof text === 'string') {\n // Bubble up to add a warning on top-most collapsed block.\n let parent = this.getSurroundParent();\n let collapsedParent = null;\n while (parent) {\n if (parent.isCollapsed()) {\n collapsedParent = parent;\n }\n parent = parent.getSurroundParent();\n }\n if (collapsedParent) {\n collapsedParent.setWarningText(\n Msg['COLLAPSED_WARNINGS_WARNING'], BlockSvg.COLLAPSED_WARNING_ID);\n }\n\n if (!this.warning) {\n this.warning = new Warning(this);\n changedState = true;\n }\n this.warning!.setText((text), id);\n } else {\n // Dispose all warnings if no ID is given.\n if (this.warning && !id) {\n this.warning.dispose();\n changedState = true;\n } else if (this.warning) {\n const oldText = this.warning.getText();\n this.warning.setText('', id);\n const newText = this.warning.getText();\n if (!newText) {\n this.warning.dispose();\n }\n changedState = oldText !== newText;\n }\n }\n if (changedState && this.rendered) {\n this.render();\n // Adding or removing a warning icon will cause the block to change shape.\n this.bumpNeighbours();\n }\n }\n\n /**\n * Give this block a mutator dialog.\n *\n * @param mutator A mutator dialog instance or null to remove.\n */\n override setMutator(mutator: Mutator|null) {\n if (this.mutator && this.mutator !== mutator) {\n this.mutator.dispose();\n }\n if (mutator) {\n mutator.setBlock(this);\n this.mutator = mutator;\n mutator.createIcon();\n }\n if (this.rendered) {\n this.render();\n // Adding or removing a mutator icon will cause the block to change shape.\n this.bumpNeighbours();\n }\n }\n\n /**\n * Set whether the block is enabled or not.\n *\n * @param enabled True if enabled.\n */\n override setEnabled(enabled: boolean) {\n if (this.isEnabled() !== enabled) {\n super.setEnabled(enabled);\n if (this.rendered && !this.getInheritedDisabled()) {\n this.updateDisabled();\n }\n }\n }\n\n /**\n * Set whether the block is highlighted or not. Block highlighting is\n * often used to visually mark blocks currently being executed.\n *\n * @param highlighted True if highlighted.\n */\n setHighlighted(highlighted: boolean) {\n if (!this.rendered) {\n return;\n }\n this.pathObject.updateHighlighted(highlighted);\n }\n\n /**\n * Adds the visual \"select\" effect to the block, but does not actually select\n * it or fire an event.\n *\n * @see BlockSvg#select\n */\n addSelect() {\n this.pathObject.updateSelected(true);\n }\n\n /**\n * Removes the visual \"select\" effect from the block, but does not actually\n * unselect it or fire an event.\n *\n * @see BlockSvg#unselect\n */\n removeSelect() {\n this.pathObject.updateSelected(false);\n }\n\n /**\n * Update the cursor over this block by adding or removing a class.\n *\n * @param enable True if the delete cursor should be shown, false otherwise.\n * @internal\n */\n setDeleteStyle(enable: boolean) {\n this.pathObject.updateDraggingDelete(enable);\n }\n\n // Overrides of functions on Blockly.Block that take into account whether the\n\n // block has been rendered.\n\n /**\n * Get the colour of a block.\n *\n * @returns #RRGGBB string.\n */\n override getColour(): string {\n return this.style.colourPrimary;\n }\n\n /**\n * Change the colour of a block.\n *\n * @param colour HSV hue value, or #RRGGBB string.\n */\n override setColour(colour: number|string) {\n super.setColour(colour);\n const styleObj =\n this.workspace.getRenderer().getConstants().getBlockStyleForColour(\n this.colour_);\n\n this.pathObject.setStyle(styleObj.style);\n this.style = styleObj.style;\n this.styleName_ = styleObj.name;\n\n this.applyColour();\n }\n\n /**\n * Set the style and colour values of a block.\n *\n * @param blockStyleName Name of the block style.\n * @throws {Error} if the block style does not exist.\n */\n override setStyle(blockStyleName: string) {\n const blockStyle =\n this.workspace.getRenderer().getConstants().getBlockStyle(\n blockStyleName);\n this.styleName_ = blockStyleName;\n\n if (blockStyle) {\n this.hat = blockStyle.hat;\n this.pathObject.setStyle(blockStyle);\n // Set colour to match Block.\n this.colour_ = blockStyle.colourPrimary;\n this.style = blockStyle;\n\n this.applyColour();\n } else {\n throw Error('Invalid style name: ' + blockStyleName);\n }\n }\n\n /**\n * Move this block to the front of the visible workspace.\n * <g> tags do not respect z-index so SVG renders them in the\n * order that they are in the DOM. By placing this block first within the\n * block group's <g>, it will render on top of any other blocks.\n *\n * @internal\n */\n bringToFront() {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let block: this|null = this;\n do {\n const root = block.getSvgRoot();\n const parent = root.parentNode;\n const childNodes = parent!.childNodes;\n // Avoid moving the block if it's already at the bottom.\n if (childNodes[childNodes.length - 1] !== root) {\n parent!.appendChild(root);\n }\n block = block.getParent();\n } while (block);\n }\n\n /**\n * Set whether this block can chain onto the bottom of another block.\n *\n * @param newBoolean True if there can be a previous statement.\n * @param opt_check Statement type or list of statement types. Null/undefined\n * if any type could be connected.\n */\n override setPreviousStatement(\n newBoolean: boolean, opt_check?: string|string[]|null) {\n super.setPreviousStatement(newBoolean, opt_check);\n\n if (this.rendered) {\n this.render();\n this.bumpNeighbours();\n }\n }\n\n /**\n * Set whether another block can chain onto the bottom of this block.\n *\n * @param newBoolean True if there can be a next statement.\n * @param opt_check Statement type or list of statement types. Null/undefined\n * if any type could be connected.\n */\n override setNextStatement(\n newBoolean: boolean, opt_check?: string|string[]|null) {\n super.setNextStatement(newBoolean, opt_check);\n\n if (this.rendered) {\n this.render();\n this.bumpNeighbours();\n }\n }\n\n /**\n * Set whether this block returns a value.\n *\n * @param newBoolean True if there is an output.\n * @param opt_check Returned type or list of returned types. Null or\n * undefined if any type could be returned (e.g. variable get).\n */\n override setOutput(newBoolean: boolean, opt_check?: string|string[]|null) {\n super.setOutput(newBoolean, opt_check);\n\n if (this.rendered) {\n this.render();\n this.bumpNeighbours();\n }\n }\n\n /**\n * Set whether value inputs are arranged horizontally or vertically.\n *\n * @param newBoolean True if inputs are horizontal.\n */\n override setInputsInline(newBoolean: boolean) {\n super.setInputsInline(newBoolean);\n\n if (this.rendered) {\n this.render();\n this.bumpNeighbours();\n }\n }\n\n /**\n * Remove an input from this block.\n *\n * @param name The name of the input.\n * @param opt_quiet True to prevent error if input is not present.\n * @returns True if operation succeeds, false if input is not present and\n * opt_quiet is true\n * @throws {Error} if the input is not present and opt_quiet is not true.\n */\n override removeInput(name: string, opt_quiet?: boolean): boolean {\n const removed = super.removeInput(name, opt_quiet);\n\n if (this.rendered) {\n this.render();\n // Removing an input will cause the block to change shape.\n this.bumpNeighbours();\n }\n\n return removed;\n }\n\n /**\n * Move a numbered input to a different location on this block.\n *\n * @param inputIndex Index of the input to move.\n * @param refIndex Index of input that should be after the moved input.\n */\n override moveNumberedInputBefore(inputIndex: number, refIndex: number) {\n super.moveNumberedInputBefore(inputIndex, refIndex);\n\n if (this.rendered) {\n this.render();\n // Moving an input will cause the block to change shape.\n this.bumpNeighbours();\n }\n }\n\n /**\n * Add a value input, statement input or local variable to this block.\n *\n * @param type One of Blockly.inputTypes.\n * @param name Language-neutral identifier which may used to find this input\n * again. Should be unique to this block.\n * @returns The input object created.\n */\n protected override appendInput_(type: number, name: string): Input {\n const input = super.appendInput_(type, name);\n\n if (this.rendered) {\n this.render();\n // Adding an input will cause the block to change shape.\n this.bumpNeighbours();\n }\n return input;\n }\n\n /**\n * Sets whether this block's connections are tracked in the database or not.\n *\n * Used by the deserializer to be more efficient. Setting a connection's\n * tracked_ value to false keeps it from adding itself to the db when it\n * gets its first moveTo call, saving expensive ops for later.\n *\n * @param track If true, start tracking. If false, stop tracking.\n * @internal\n */\n setConnectionTracking(track: boolean) {\n if (this.previousConnection) {\n (this.previousConnection).setTracking(track);\n }\n if (this.outputConnection) {\n (this.outputConnection).setTracking(track);\n }\n if (this.nextConnection) {\n (this.nextConnection).setTracking(track);\n const child = (this.nextConnection).targetBlock();\n if (child) {\n child.setConnectionTracking(track);\n }\n }\n\n if (this.collapsed_) {\n // When track is true, we don't want to start tracking collapsed\n // connections. When track is false, we're already not tracking\n // collapsed connections, so no need to update.\n return;\n }\n\n for (let i = 0; i < this.inputList.length; i++) {\n const conn = this.inputList[i].connection as RenderedConnection;\n if (conn) {\n conn.setTracking(track);\n\n // Pass tracking on down the chain.\n const block = conn.targetBlock();\n if (block) {\n block.setConnectionTracking(track);\n }\n }\n }\n }\n\n /**\n * Returns connections originating from this block.\n *\n * @param all If true, return all connections even hidden ones.\n * Otherwise, for a non-rendered block return an empty list, and for a\n * collapsed block don't return inputs connections.\n * @returns Array of connections.\n * @internal\n */\n override getConnections_(all: boolean): RenderedConnection[] {\n const myConnections = [];\n if (all || this.rendered) {\n if (this.outputConnection) {\n myConnections.push(this.outputConnection);\n }\n if (this.previousConnection) {\n myConnections.push(this.previousConnection);\n }\n if (this.nextConnection) {\n myConnections.push(this.nextConnection);\n }\n if (all || !this.collapsed_) {\n for (let i = 0, input; input = this.inputList[i]; i++) {\n if (input.connection) {\n myConnections.push(input.connection as RenderedConnection);\n }\n }\n }\n }\n return myConnections;\n }\n\n /**\n * Walks down a stack of blocks and finds the last next connection on the\n * stack.\n *\n * @param ignoreShadows If true,the last connection on a non-shadow block will\n * be returned. If false, this will follow shadows to find the last\n * connection.\n * @returns The last next connection on the stack, or null.\n * @internal\n */\n override lastConnectionInStack(ignoreShadows: boolean): RenderedConnection\n |null {\n return super.lastConnectionInStack(ignoreShadows) as RenderedConnection;\n }\n\n /**\n * Find the connection on this block that corresponds to the given connection\n * on the other block.\n * Used to match connections between a block and its insertion marker.\n *\n * @param otherBlock The other block to match against.\n * @param conn The other connection to match.\n * @returns The matching connection on this block, or null.\n * @internal\n */\n override getMatchingConnection(otherBlock: Block, conn: Connection):\n RenderedConnection|null {\n return super.getMatchingConnection(otherBlock, conn) as RenderedConnection;\n }\n\n /**\n * Create a connection of the specified type.\n *\n * @param type The type of the connection to create.\n * @returns A new connection of the specified type.\n */\n protected override makeConnection_(type: number): RenderedConnection {\n return new RenderedConnection(this, type);\n }\n\n /**\n * Return the next statement block directly connected to this block.\n *\n * @returns The next statement block or null.\n */\n override getNextBlock(): BlockSvg|null {\n return super.getNextBlock() as BlockSvg;\n }\n\n /**\n * Returns the block connected to the previous connection.\n *\n * @returns The previous statement block or null.\n */\n override getPreviousBlock(): BlockSvg|null {\n return super.getPreviousBlock() as BlockSvg;\n }\n\n /**\n * Bump unconnected blocks out of alignment. Two blocks which aren't actually\n * connected should not coincidentally line up on screen.\n */\n override bumpNeighbours() {\n if (this.isDeadOrDying()) {\n return;\n }\n if (this.workspace.isDragging()) {\n return;\n }\n const rootBlock = this.getRootBlock();\n if (rootBlock.isInFlyout) {\n return;\n }\n // Don't move blocks around in a flyout.\n // Loop through every connection on this block.\n const myConnections = this.getConnections_(false);\n for (let i = 0, connection; connection = myConnections[i]; i++) {\n const renderedConn = (connection);\n // Spider down from this block bumping all sub-blocks.\n if (renderedConn.isConnected() && renderedConn.isSuperior()) {\n renderedConn.targetBlock()!.bumpNeighbours();\n }\n\n const neighbours = connection.neighbours(config.snapRadius);\n for (let j = 0, otherConnection; otherConnection = neighbours[j]; j++) {\n const renderedOther = otherConnection as RenderedConnection;\n // If both connections are connected, that's probably fine. But if\n // either one of them is unconnected, then there could be confusion.\n if (!renderedConn.isConnected() || !renderedOther.isConnected()) {\n // Only bump blocks if they are from different tree structures.\n if (renderedOther.getSourceBlock().getRootBlock() !== rootBlock) {\n // Always bump the inferior block.\n if (renderedConn.isSuperior()) {\n renderedOther.bumpAwayFrom(renderedConn);\n } else {\n renderedConn.bumpAwayFrom(renderedOther);\n }\n }\n }\n }\n }\n }\n\n /**\n * Schedule snapping to grid and bumping neighbours to occur after a brief\n * delay.\n *\n * @internal\n */\n scheduleSnapAndBump() {\n // Ensure that any snap and bump are part of this move's event group.\n const group = eventUtils.getGroup();\n\n setTimeout(() => {\n eventUtils.setGroup(group);\n this.snapToGrid();\n eventUtils.setGroup(false);\n }, config.bumpDelay / 2);\n\n setTimeout(() => {\n eventUtils.setGroup(group);\n this.bumpNeighbours();\n eventUtils.setGroup(false);\n }, config.bumpDelay);\n }\n\n /**\n * Position a block so that it doesn't move the target block when connected.\n * The block to position is usually either the first block in a dragged stack\n * or an insertion marker.\n *\n * @param sourceConnection The connection on the moving block's stack.\n * @param targetConnection The connection that should stay stationary as this\n * block is positioned.\n * @internal\n */\n positionNearConnection(\n sourceConnection: RenderedConnection,\n targetConnection: RenderedConnection) {\n // We only need to position the new block if it's before the existing one,\n // otherwise its position is set by the previous block.\n if (sourceConnection.type === ConnectionType.NEXT_STATEMENT ||\n sourceConnection.type === ConnectionType.INPUT_VALUE) {\n const dx = targetConnection.x - sourceConnection.x;\n const dy = targetConnection.y - sourceConnection.y;\n\n this.moveBy(dx, dy);\n }\n }\n\n /**\n * @returns The first statement connection or null.\n * @internal\n */\n override getFirstStatementConnection(): RenderedConnection|null {\n return super.getFirstStatementConnection() as RenderedConnection | null;\n }\n\n /**\n * Find all the blocks that are directly nested inside this one.\n * Includes value and statement inputs, as well as any following statement.\n * Excludes any connection on an output tab or any preceding statement.\n * Blocks are optionally sorted by position; top to bottom.\n *\n * @param ordered Sort the list if true.\n * @returns Array of blocks.\n */\n override getChildren(ordered: boolean): BlockSvg[] {\n return super.getChildren(ordered) as BlockSvg[];\n }\n\n /**\n * Lays out and reflows a block based on its contents and settings.\n *\n * @param opt_bubble If false, just render this block.\n * If true, also render block's parent, grandparent, etc. Defaults to true.\n */\n render(opt_bubble?: boolean) {\n if (this.renderIsInProgress_) {\n return; // Don't allow recursive renders.\n }\n this.renderIsInProgress_ = true;\n try {\n this.rendered = true;\n dom.startTextWidthCache();\n\n if (this.isCollapsed()) {\n this.updateCollapsed_();\n }\n this.workspace.getRenderer().render(this);\n this.updateConnectionLocations_();\n\n if (opt_bubble !== false) {\n const parentBlock = this.getParent();\n if (parentBlock) {\n parentBlock.render(true);\n } else {\n // Top-most block. Fire an event to allow scrollbars to resize.\n this.workspace.resizeContents();\n }\n }\n\n dom.stopTextWidthCache();\n this.updateMarkers_();\n } finally {\n this.renderIsInProgress_ = false;\n }\n }\n\n /** Redraw any attached marker or cursor svgs if needed. */\n protected updateMarkers_() {\n if (this.workspace.keyboardAccessibilityMode && this.pathObject.cursorSvg) {\n this.workspace.getCursor()!.draw();\n }\n if (this.workspace.keyboardAccessibilityMode && this.pathObject.markerSvg) {\n // TODO(#4592): Update all markers on the block.\n this.workspace.getMarker(MarkerManager.LOCAL_MARKER)!.draw();\n }\n }\n\n /**\n * Update all of the connections on this block with the new locations\n * calculated during rendering. Also move all of the connected blocks based\n * on the new connection locations.\n */\n private updateConnectionLocations_() {\n const blockTL = this.getRelativeToSurfaceXY();\n // Don't tighten previous or output connections because they are inferior\n // connections.\n if (this.previousConnection) {\n this.previousConnection.moveToOffset(blockTL);\n }\n if (this.outputConnection) {\n this.outputConnection.moveToOffset(blockTL);\n }\n\n for (let i = 0; i < this.inputList.length; i++) {\n const conn = this.inputList[i].connection as RenderedConnection;\n if (conn) {\n conn.moveToOffset(blockTL);\n if (conn.isConnected()) {\n conn.tighten();\n }\n }\n }\n\n if (this.nextConnection) {\n this.nextConnection.moveToOffset(blockTL);\n if (this.nextConnection.isConnected()) {\n this.nextConnection.tighten();\n }\n }\n }\n\n /**\n * Add the cursor SVG to this block's SVG group.\n *\n * @param cursorSvg The SVG root of the cursor to be added to the block SVG\n * group.\n * @internal\n */\n setCursorSvg(cursorSvg: SVGElement) {\n this.pathObject.setCursorSvg(cursorSvg);\n }\n\n /**\n * Add the marker SVG to this block's SVG group.\n *\n * @param markerSvg The SVG root of the marker to be added to the block SVG\n * group.\n * @internal\n */\n setMarkerSvg(markerSvg: SVGElement) {\n this.pathObject.setMarkerSvg(markerSvg);\n }\n\n /**\n * Returns a bounding box describing the dimensions of this block\n * and any blocks stacked below it.\n *\n * @returns Object with height and width properties in workspace units.\n * @internal\n */\n getHeightWidth(): {height: number, width: number} {\n let height = this.height;\n let width = this.width;\n // Recursively add size of subsequent blocks.\n const nextBlock = this.getNextBlock();\n if (nextBlock) {\n const nextHeightWidth = nextBlock.getHeightWidth();\n const tabHeight =\n this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;\n height += nextHeightWidth.height - tabHeight;\n width = Math.max(width, nextHeightWidth.width);\n }\n return {height, width};\n }\n\n /**\n * Visual effect to show that if the dragging block is dropped, this block\n * will be replaced. If a shadow block, it will disappear. Otherwise it will\n * bump.\n *\n * @param add True if highlighting should be added.\n * @internal\n */\n fadeForReplacement(add: boolean) {\n this.pathObject.updateReplacementFade(add);\n }\n\n /**\n * Visual effect to show that if the dragging block is dropped it will connect\n * to this input.\n *\n * @param conn The connection on the input to highlight.\n * @param add True if highlighting should be added.\n * @internal\n */\n highlightShapeForInput(conn: RenderedConnection, add: boolean) {\n this.pathObject.updateShapeForInputHighlight(conn, add);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The abstract class for a component with custom behaviour when a\n * block or bubble is dragged over or dropped on top of it.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.DragTarget');\n\nimport type {IDragTarget} from './interfaces/i_drag_target.js';\nimport type {IDraggable} from './interfaces/i_draggable.js';\nimport type {Rect} from './utils/rect.js';\n\n\n/**\n * Abstract class for a component with custom behaviour when a block or bubble\n * is dragged over or dropped on top of it.\n *\n * @alias Blockly.DragTarget\n */\nexport class DragTarget implements IDragTarget {\n /**\n * The unique id for this component that is used to register with the\n * ComponentManager.\n */\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n id!: string;\n\n /**\n * Constructor for DragTarget. It exists to add the id property and should not\n * be called directly, only by a subclass.\n */\n constructor() {}\n\n /**\n * Handles when a cursor with a block or bubble enters this drag target.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n onDragEnter(_dragElement: IDraggable) {}\n // no-op\n\n /**\n * Handles when a cursor with a block or bubble is dragged over this drag\n * target.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n onDragOver(_dragElement: IDraggable) {}\n // no-op\n\n /**\n * Handles when a cursor with a block or bubble exits this drag target.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n onDragExit(_dragElement: IDraggable) {}\n // no-op\n /**\n * Handles when a block or bubble is dropped on this component.\n * Should not handle delete here.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n onDrop(_dragElement: IDraggable) {}\n // no-op\n\n /**\n * Returns the bounding rectangle of the drag target area in pixel units\n * relative to the Blockly injection div.\n *\n * @returns The component's bounding box. Null if drag target area should be\n * ignored.\n */\n getClientRect(): Rect|null {\n return null;\n }\n\n /**\n * Returns whether the provided block or bubble should not be moved after\n * being dropped on this component. If true, the element will return to where\n * it was when the drag started.\n *\n * @param _dragElement The block or bubble currently being dragged.\n * @returns Whether the block or bubble provided should be returned to drag\n * start.\n */\n shouldPreventMove(_dragElement: IDraggable): boolean {\n return false;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The abstract class for a component that can delete a block or\n * bubble that is dropped on top of it.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.DeleteArea');\n\nimport {BlockSvg} from './block_svg.js';\nimport {DragTarget} from './drag_target.js';\nimport type {IDeleteArea} from './interfaces/i_delete_area.js';\nimport type {IDraggable} from './interfaces/i_draggable.js';\n\n\n/**\n * Abstract class for a component that can delete a block or bubble that is\n * dropped on top of it.\n *\n * @alias Blockly.DeleteArea\n */\nexport class DeleteArea extends DragTarget implements IDeleteArea {\n /**\n * Whether the last block or bubble dragged over this delete area would be\n * deleted if dropped on this component.\n * This property is not updated after the block or bubble is deleted.\n */\n protected wouldDelete_ = false;\n\n /**\n * The unique id for this component that is used to register with the\n * ComponentManager.\n */\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override id!: string;\n\n /**\n * Constructor for DeleteArea. Should not be called directly, only by a\n * subclass.\n */\n constructor() {\n super();\n }\n\n /**\n * Returns whether the provided block or bubble would be deleted if dropped on\n * this area.\n * This method should check if the element is deletable and is always called\n * before onDragEnter/onDragOver/onDragExit.\n *\n * @param element The block or bubble currently being dragged.\n * @param couldConnect Whether the element could could connect to another.\n * @returns Whether the element provided would be deleted if dropped on this\n * area.\n */\n wouldDelete(element: IDraggable, couldConnect: boolean): boolean {\n if (element instanceof BlockSvg) {\n const block = (element);\n const couldDeleteBlock = !block.getParent() && block.isDeletable();\n this.updateWouldDelete_(couldDeleteBlock && !couldConnect);\n } else {\n this.updateWouldDelete_(element.isDeletable());\n }\n return this.wouldDelete_;\n }\n\n /**\n * Updates the internal wouldDelete_ state.\n *\n * @param wouldDelete The new value for the wouldDelete state.\n */\n protected updateWouldDelete_(wouldDelete: boolean) {\n this.wouldDelete_ = wouldDelete;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Contains the path to a single png tat holds the images for the trashcan\n * as well as the zoom controls.\n *\n * @alias Blockly.sprite.SPRITE\n */\nexport const SPRITE = {\n width: 96,\n height: 124,\n url: 'sprites.png',\n};\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a trash can icon.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Trashcan');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_trashcan_open.js';\n\nimport type {BlocklyOptions} from './blockly_options.js';\nimport * as browserEvents from './browser_events.js';\nimport {ComponentManager} from './component_manager.js';\nimport {DeleteArea} from './delete_area.js';\nimport type {Abstract} from './events/events_abstract.js';\nimport type {BlockDelete} from './events/events_block_delete.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IAutoHideable} from './interfaces/i_autohideable.js';\nimport type {IDraggable} from './interfaces/i_draggable.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IPositionable} from './interfaces/i_positionable.js';\nimport type {UiMetrics} from './metrics_manager.js';\nimport {Options} from './options.js';\nimport * as uiPosition from './positionable_helpers.js';\nimport * as registry from './registry.js';\nimport type * as blocks from './serialization/blocks.js';\nimport {SPRITE} from './sprites.js';\nimport * as dom from './utils/dom.js';\nimport {Rect} from './utils/rect.js';\nimport {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\nimport {BlockInfo} from './utils/toolbox.js';\nimport * as toolbox from './utils/toolbox.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a trash can.\n *\n * @alias Blockly.Trashcan\n */\nexport class Trashcan extends DeleteArea implements IAutoHideable,\n IPositionable {\n /**\n * The unique id for this component that is used to register with the\n * ComponentManager.\n */\n override id = 'trashcan';\n\n /**\n * A list of JSON (stored as strings) representing blocks in the trashcan.\n */\n private readonly contents_: string[] = [];\n\n /**\n * The trashcan flyout.\n *\n * @internal\n */\n flyout: IFlyout|null = null;\n\n /** Current open/close state of the lid. */\n isLidOpen = false;\n\n /**\n * The minimum openness of the lid. Used to indicate if the trashcan\n * contains blocks.\n */\n private minOpenness_ = 0;\n\n /** The SVG group containing the trash can. */\n private svgGroup_: SVGElement|null = null;\n\n /** The SVG image element of the trash can lid. */\n private svgLid_: SVGElement|null = null;\n\n /** Task ID of opening/closing animation. */\n private lidTask_: ReturnType<typeof setTimeout>|null = null;\n\n /** Current state of lid opening (0.0 = closed, 1.0 = open). */\n private lidOpen_ = 0;\n\n /** Left coordinate of the trash can. */\n private left_ = 0;\n\n /** Top coordinate of the trash can. */\n private top_ = 0;\n\n /** Whether this trash can has been initialized. */\n private initialized_ = false;\n\n /** @param workspace The workspace to sit in. */\n constructor(private workspace: WorkspaceSvg) {\n super();\n\n if (this.workspace.options.maxTrashcanContents <= 0) {\n return;\n }\n\n // Create flyout options.\n const flyoutWorkspaceOptions = new Options(({\n 'scrollbars': true,\n 'parentWorkspace': this.workspace,\n 'rtl': this.workspace.RTL,\n 'oneBasedIndex': this.workspace.options.oneBasedIndex,\n 'renderer': this.workspace.options.renderer,\n 'rendererOverrides': this.workspace.options.rendererOverrides,\n 'move': {\n 'scrollbars': true,\n },\n } as BlocklyOptions));\n // Create vertical or horizontal flyout.\n if (this.workspace.horizontalLayout) {\n flyoutWorkspaceOptions.toolboxPosition =\n this.workspace.toolboxPosition === toolbox.Position.TOP ?\n toolbox.Position.BOTTOM :\n toolbox.Position.TOP;\n const HorizontalFlyout = registry.getClassFromOptions(\n registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, this.workspace.options,\n true);\n this.flyout = new HorizontalFlyout!(flyoutWorkspaceOptions);\n } else {\n flyoutWorkspaceOptions.toolboxPosition =\n this.workspace.toolboxPosition === toolbox.Position.RIGHT ?\n toolbox.Position.LEFT :\n toolbox.Position.RIGHT;\n const VerticalFlyout = registry.getClassFromOptions(\n registry.Type.FLYOUTS_VERTICAL_TOOLBOX, this.workspace.options, true);\n this.flyout = new VerticalFlyout!(flyoutWorkspaceOptions);\n }\n this.workspace.addChangeListener(this.onDelete_.bind(this));\n }\n\n /**\n * Create the trash can elements.\n *\n * @returns The trash can's SVG group.\n */\n createDom(): SVGElement {\n /* Here's the markup that will be generated:\n <g class=\"blocklyTrash\">\n <clippath id=\"blocklyTrashBodyClipPath837493\">\n <rect width=\"47\" height=\"45\" y=\"15\"></rect>\n </clippath>\n <image width=\"64\" height=\"92\" y=\"-32\" xlink:href=\"media/sprites.png\"\n clip-path=\"url(#blocklyTrashBodyClipPath837493)\"></image>\n <clippath id=\"blocklyTrashLidClipPath837493\">\n <rect width=\"47\" height=\"15\"></rect>\n </clippath>\n <image width=\"84\" height=\"92\" y=\"-32\" xlink:href=\"media/sprites.png\"\n clip-path=\"url(#blocklyTrashLidClipPath837493)\"></image>\n </g>\n */\n this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': 'blocklyTrash'});\n let clip;\n const rnd = String(Math.random()).substring(2);\n clip = dom.createSvgElement(\n Svg.CLIPPATH, {'id': 'blocklyTrashBodyClipPath' + rnd}, this.svgGroup_);\n dom.createSvgElement(\n Svg.RECT, {'width': WIDTH, 'height': BODY_HEIGHT, 'y': LID_HEIGHT},\n clip);\n const body = dom.createSvgElement(\n Svg.IMAGE, {\n 'width': SPRITE.width,\n 'x': -SPRITE_LEFT,\n 'height': SPRITE.height,\n 'y': -SPRITE_TOP,\n 'clip-path': 'url(#blocklyTrashBodyClipPath' + rnd + ')',\n },\n this.svgGroup_);\n body.setAttributeNS(\n dom.XLINK_NS, 'xlink:href',\n this.workspace.options.pathToMedia + SPRITE.url);\n\n clip = dom.createSvgElement(\n Svg.CLIPPATH, {'id': 'blocklyTrashLidClipPath' + rnd}, this.svgGroup_);\n dom.createSvgElement(\n Svg.RECT, {'width': WIDTH, 'height': LID_HEIGHT}, clip);\n this.svgLid_ = dom.createSvgElement(\n Svg.IMAGE, {\n 'width': SPRITE.width,\n 'x': -SPRITE_LEFT,\n 'height': SPRITE.height,\n 'y': -SPRITE_TOP,\n 'clip-path': 'url(#blocklyTrashLidClipPath' + rnd + ')',\n },\n this.svgGroup_);\n this.svgLid_.setAttributeNS(\n dom.XLINK_NS, 'xlink:href',\n this.workspace.options.pathToMedia + SPRITE.url);\n\n // bindEventWithChecks_ quashes events too aggressively. See:\n // https://groups.google.com/forum/#!topic/blockly/QF4yB9Wx00s\n // Using bindEventWithChecks_ for blocking mousedown causes issue in mobile.\n // See #4303\n browserEvents.bind(\n this.svgGroup_, 'mousedown', this, this.blockMouseDownWhenOpenable_);\n browserEvents.bind(this.svgGroup_, 'mouseup', this, this.click);\n // Bind to body instead of this.svgGroup_ so that we don't get lid jitters\n browserEvents.bind(body, 'mouseover', this, this.mouseOver_);\n browserEvents.bind(body, 'mouseout', this, this.mouseOut_);\n this.animateLid_();\n return this.svgGroup_;\n }\n\n /** Initializes the trash can. */\n init() {\n if (this.workspace.options.maxTrashcanContents > 0) {\n dom.insertAfter(\n this.flyout!.createDom(Svg.SVG)!, this.workspace.getParentSvg());\n this.flyout!.init(this.workspace);\n }\n this.workspace.getComponentManager().addComponent({\n component: this,\n weight: 1,\n capabilities: [\n ComponentManager.Capability.AUTOHIDEABLE,\n ComponentManager.Capability.DELETE_AREA,\n ComponentManager.Capability.DRAG_TARGET,\n ComponentManager.Capability.POSITIONABLE,\n ],\n });\n this.initialized_ = true;\n this.setLidOpen(false);\n }\n\n /**\n * Dispose of this trash can.\n * Unlink from all DOM elements to prevent memory leaks.\n *\n * @suppress {checkTypes}\n */\n dispose() {\n this.workspace.getComponentManager().removeComponent('trashcan');\n if (this.svgGroup_) {\n dom.removeNode(this.svgGroup_);\n this.svgGroup_ = null;\n }\n this.svgLid_ = null;\n if (this.lidTask_) {\n clearTimeout(this.lidTask_);\n }\n }\n\n /**\n * Whether the trashcan has contents.\n *\n * @returns True if the trashcan has contents.\n */\n private hasContents_(): boolean {\n return !!this.contents_.length;\n }\n\n /**\n * Returns true if the trashcan contents-flyout is currently open.\n *\n * @returns True if the trashcan contents-flyout is currently open.\n */\n contentsIsOpen(): boolean {\n return !!this.flyout && this.flyout.isVisible();\n }\n\n /** Opens the trashcan flyout. */\n openFlyout() {\n if (this.contentsIsOpen()) {\n return;\n }\n const contents = this.contents_.map(function(string) {\n return JSON.parse(string);\n });\n this.flyout?.show(contents);\n this.fireUiEvent_(true);\n }\n\n /** Closes the trashcan flyout. */\n closeFlyout() {\n if (!this.contentsIsOpen()) {\n return;\n }\n this.flyout?.hide();\n this.fireUiEvent_(false);\n this.workspace.recordDragTargets();\n }\n\n /**\n * Hides the component. Called in WorkspaceSvg.hideChaff.\n *\n * @param onlyClosePopups Whether only popups should be closed.\n * Flyouts should not be closed if this is true.\n */\n autoHide(onlyClosePopups: boolean) {\n // For now the trashcan flyout always autocloses because it overlays the\n // trashcan UI (no trashcan to click to close it).\n if (!onlyClosePopups && this.flyout) {\n this.closeFlyout();\n }\n }\n\n /**\n * Empties the trashcan's contents. If the contents-flyout is currently open\n * it will be closed.\n */\n emptyContents() {\n if (!this.hasContents_()) {\n return;\n }\n this.contents_.length = 0;\n this.setMinOpenness_(0);\n this.closeFlyout();\n }\n\n /**\n * Positions the trashcan.\n * It is positioned in the opposite corner to the corner the\n * categories/toolbox starts at.\n *\n * @param metrics The workspace metrics.\n * @param savedPositions List of rectangles that are already on the workspace.\n */\n position(metrics: UiMetrics, savedPositions: Rect[]) {\n // Not yet initialized.\n if (!this.initialized_) {\n return;\n }\n\n const cornerPosition =\n uiPosition.getCornerOppositeToolbox(this.workspace, metrics);\n\n const height = BODY_HEIGHT + LID_HEIGHT;\n const startRect = uiPosition.getStartPositionRect(\n cornerPosition, new Size(WIDTH, height), MARGIN_HORIZONTAL,\n MARGIN_VERTICAL, metrics, this.workspace);\n\n const verticalPosition = cornerPosition.vertical;\n const bumpDirection = verticalPosition === uiPosition.verticalPosition.TOP ?\n uiPosition.bumpDirection.DOWN :\n uiPosition.bumpDirection.UP;\n const positionRect = uiPosition.bumpPositionRect(\n startRect, MARGIN_VERTICAL, bumpDirection, savedPositions);\n\n this.top_ = positionRect.top;\n this.left_ = positionRect.left;\n this.svgGroup_?.setAttribute(\n 'transform', 'translate(' + this.left_ + ',' + this.top_ + ')');\n }\n\n /**\n * Returns the bounding rectangle of the UI element in pixel units relative to\n * the Blockly injection div.\n *\n * @returns The UI elements's bounding box. Null if bounding box should be\n * ignored by other UI elements.\n */\n getBoundingRectangle(): Rect|null {\n const bottom = this.top_ + BODY_HEIGHT + LID_HEIGHT;\n const right = this.left_ + WIDTH;\n return new Rect(this.top_, bottom, this.left_, right);\n }\n\n /**\n * Returns the bounding rectangle of the drag target area in pixel units\n * relative to viewport.\n *\n * @returns The component's bounding box. Null if drag target area should be\n * ignored.\n */\n override getClientRect(): Rect|null {\n if (!this.svgGroup_) {\n return null;\n }\n\n const trashRect = this.svgGroup_.getBoundingClientRect();\n const top = trashRect.top + SPRITE_TOP - MARGIN_HOTSPOT;\n const bottom = top + LID_HEIGHT + BODY_HEIGHT + 2 * MARGIN_HOTSPOT;\n const left = trashRect.left + SPRITE_LEFT - MARGIN_HOTSPOT;\n const right = left + WIDTH + 2 * MARGIN_HOTSPOT;\n return new Rect(top, bottom, left, right);\n }\n\n /**\n * Handles when a cursor with a block or bubble is dragged over this drag\n * target.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n override onDragOver(_dragElement: IDraggable) {\n this.setLidOpen(this.wouldDelete_);\n }\n\n /**\n * Handles when a cursor with a block or bubble exits this drag target.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n override onDragExit(_dragElement: IDraggable) {\n this.setLidOpen(false);\n }\n\n /**\n * Handles when a block or bubble is dropped on this component.\n * Should not handle delete here.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n override onDrop(_dragElement: IDraggable) {\n setTimeout(this.setLidOpen.bind(this, false), 100);\n }\n\n /**\n * Flip the lid open or shut.\n *\n * @param state True if open.\n * @internal\n */\n setLidOpen(state: boolean) {\n if (this.isLidOpen === state) {\n return;\n }\n if (this.lidTask_) {\n clearTimeout(this.lidTask_);\n }\n this.isLidOpen = state;\n this.animateLid_();\n }\n\n /** Rotate the lid open or closed by one step. Then wait and recurse. */\n private animateLid_() {\n const frames = ANIMATION_FRAMES;\n\n const delta = 1 / (frames + 1);\n this.lidOpen_ += this.isLidOpen ? delta : -delta;\n this.lidOpen_ = Math.min(Math.max(this.lidOpen_, this.minOpenness_), 1);\n\n this.setLidAngle_(this.lidOpen_ * MAX_LID_ANGLE);\n\n // Linear interpolation between min and max.\n const opacity = OPACITY_MIN + this.lidOpen_ * (OPACITY_MAX - OPACITY_MIN);\n if (this.svgGroup_) {\n this.svgGroup_.style.opacity = opacity.toString();\n }\n\n if (this.lidOpen_ > this.minOpenness_ && this.lidOpen_ < 1) {\n this.lidTask_ =\n setTimeout(this.animateLid_.bind(this), ANIMATION_LENGTH / frames);\n }\n }\n\n /**\n * Set the angle of the trashcan's lid.\n *\n * @param lidAngle The angle at which to set the lid.\n */\n private setLidAngle_(lidAngle: number) {\n const openAtRight =\n this.workspace.toolboxPosition === toolbox.Position.RIGHT ||\n this.workspace.horizontalLayout && this.workspace.RTL;\n this.svgLid_?.setAttribute(\n 'transform',\n 'rotate(' + (openAtRight ? -lidAngle : lidAngle) + ',' +\n (openAtRight ? 4 : WIDTH - 4) + ',' + (LID_HEIGHT - 2) + ')');\n }\n\n /**\n * Sets the minimum openness of the trashcan lid. If the lid is currently\n * closed, this will update lid's position.\n *\n * @param newMin The new minimum openness of the lid. Should be between 0\n * and 1.\n */\n private setMinOpenness_(newMin: number) {\n this.minOpenness_ = newMin;\n if (!this.isLidOpen) {\n this.setLidAngle_(newMin * MAX_LID_ANGLE);\n }\n }\n\n /**\n * Flip the lid shut.\n * Called externally after a drag.\n */\n closeLid() {\n this.setLidOpen(false);\n }\n\n /** Inspect the contents of the trash. */\n click() {\n if (!this.hasContents_()) {\n return;\n }\n this.openFlyout();\n }\n\n /**\n * Fires a UI event for trashcan flyout open or close.\n *\n * @param trashcanOpen Whether the flyout is opening.\n */\n private fireUiEvent_(trashcanOpen: boolean) {\n const uiEvent = new (eventUtils.get(eventUtils.TRASHCAN_OPEN))(\n trashcanOpen, this.workspace.id);\n eventUtils.fire(uiEvent);\n }\n\n /**\n * Prevents a workspace scroll and click event if the trashcan has blocks.\n *\n * @param e A mouse down event.\n */\n private blockMouseDownWhenOpenable_(e: Event) {\n if (!this.contentsIsOpen() && this.hasContents_()) {\n // Don't start a workspace scroll.\n e.stopPropagation();\n }\n }\n\n /**\n * Indicate that the trashcan can be clicked (by opening it) if it has blocks.\n */\n private mouseOver_() {\n if (this.hasContents_()) {\n this.setLidOpen(true);\n }\n }\n\n /**\n * Close the lid of the trashcan if it was open (Vis. it was indicating it had\n * blocks).\n */\n private mouseOut_() {\n // No need to do a .hasBlocks check here because if it doesn't the trashcan\n // won't be open in the first place, and setOpen won't run.\n this.setLidOpen(false);\n }\n\n /**\n * Handle a BLOCK_DELETE event. Adds deleted blocks oldXml to the content\n * array.\n *\n * @param event Workspace event.\n */\n private onDelete_(event: Abstract) {\n if (this.workspace.options.maxTrashcanContents <= 0 ||\n event.type !== eventUtils.BLOCK_DELETE) {\n return;\n }\n const deleteEvent = event as BlockDelete;\n if (event.type === eventUtils.BLOCK_DELETE && !deleteEvent.wasShadow) {\n if (!deleteEvent.oldJson) {\n throw new Error('Encountered a delete event without proper oldJson');\n }\n const cleanedJson =\n JSON.stringify(this.cleanBlockJson_(deleteEvent.oldJson));\n if (this.contents_.indexOf(cleanedJson) !== -1) {\n return;\n }\n this.contents_.unshift(cleanedJson);\n while (this.contents_.length >\n this.workspace.options.maxTrashcanContents) {\n this.contents_.pop();\n }\n\n this.setMinOpenness_(HAS_BLOCKS_LID_ANGLE);\n }\n }\n\n /**\n * Converts JSON representing a block into text that can be stored in the\n * content array.\n *\n * @param json A JSON representation of a block's state.\n * @returns A BlockInfo object corresponding to the JSON, cleaned of all\n * unnecessary attributes.\n */\n private cleanBlockJson_(json: blocks.State): BlockInfo {\n // Create a deep copy.\n json = JSON.parse(JSON.stringify(json)) as blocks.State;\n\n /**\n * Reshape JSON into a nicer format.\n *\n * @param json The JSON to clean.\n */\n function cleanRec(json: blocks.State) {\n if (!json) {\n return;\n }\n\n delete json['id'];\n delete json['x'];\n delete json['y'];\n delete json['enabled'];\n\n if (json['icons'] && json['icons']['comment']) {\n const comment = json['icons']['comment'];\n delete comment['height'];\n delete comment['width'];\n delete comment['pinned'];\n }\n\n const inputs = json['inputs'];\n for (const name in inputs) {\n const input = inputs[name];\n const block = input['block'];\n const shadow = input['shadow'];\n if (block) {\n cleanRec(block);\n }\n if (shadow) {\n cleanRec(shadow);\n }\n }\n if (json['next']) {\n const next = json['next'];\n const block = next['block'];\n const shadow = next['shadow'];\n if (block) {\n cleanRec(block);\n }\n if (shadow) {\n cleanRec(shadow);\n }\n }\n }\n\n cleanRec(json);\n\n const blockInfo: BlockInfo = {\n 'kind': 'BLOCK',\n ...json,\n };\n return blockInfo;\n }\n}\n\n\n/** Width of both the trash can and lid images. */\nconst WIDTH = 47;\n\n/** Height of the trashcan image (minus lid). */\nconst BODY_HEIGHT = 44;\n\n/** Height of the lid image. */\nconst LID_HEIGHT = 16;\n\n/** Distance between trashcan and bottom or top edge of workspace. */\nconst MARGIN_VERTICAL = 20;\n\n/** Distance between trashcan and right or left edge of workspace. */\nconst MARGIN_HORIZONTAL = 20;\n\n/** Extent of hotspot on all sides beyond the size of the image. */\nconst MARGIN_HOTSPOT = 10;\n\n/** Location of trashcan in sprite image. */\nconst SPRITE_LEFT = 0;\n\n/** Location of trashcan in sprite image. */\nconst SPRITE_TOP = 32;\n\n/**\n * The openness of the lid when the trashcan contains blocks.\n * (0.0 = closed, 1.0 = open)\n */\nconst HAS_BLOCKS_LID_ANGLE = 0.1;\n\n/** The length of the lid open/close animation in milliseconds. */\nconst ANIMATION_LENGTH = 80;\n\n/** The number of frames in the animation. */\nconst ANIMATION_FRAMES = 4;\n\n/** The minimum (resting) opacity of the trashcan and lid. */\nconst OPACITY_MIN = 0.4;\n\n/** The maximum (hovered) opacity of the trashcan and lid. */\nconst OPACITY_MAX = 0.8;\n\n/**\n * The maximum angle the trashcan lid can opens to. At the end of the open\n * animation the lid will be open to this angle.\n */\nconst MAX_LID_ANGLE = 45;\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of selecting an item on the toolbox.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.ToolboxItemSelect');\n\nimport * as registry from '../registry.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a toolbox item select event.\n *\n * @alias Blockly.Events.ToolboxItemSelect\n */\nexport class ToolboxItemSelect extends UiBase {\n oldItem?: string;\n newItem?: string;\n override type = eventUtils.TOOLBOX_ITEM_SELECT;\n\n /**\n * @param opt_oldItem The previously selected toolbox item.\n * Undefined for a blank event.\n * @param opt_newItem The newly selected toolbox item. Undefined for a blank\n * event.\n * @param opt_workspaceId The workspace identifier for this event.\n * Undefined for a blank event.\n */\n constructor(\n opt_oldItem?: string|null, opt_newItem?: string|null,\n opt_workspaceId?: string) {\n super(opt_workspaceId);\n\n /** The previously selected toolbox item. */\n this.oldItem = opt_oldItem ?? undefined;\n\n /** The newly selected toolbox item. */\n this.newItem = opt_newItem ?? undefined;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): ToolboxItemSelectJson {\n const json = super.toJson() as ToolboxItemSelectJson;\n json['oldItem'] = this.oldItem;\n json['newItem'] = this.newItem;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: ToolboxItemSelectJson) {\n super.fromJson(json);\n this.oldItem = json['oldItem'];\n this.newItem = json['newItem'];\n }\n}\n\nexport interface ToolboxItemSelectJson extends AbstractEventJson {\n oldItem?: string;\n newItem?: string;\n}\n\nregistry.register(\n registry.Type.EVENT, eventUtils.TOOLBOX_ITEM_SELECT, ToolboxItemSelect);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An item in the toolbox.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ToolboxItem');\n\nimport type {ICollapsibleToolboxItem} from '../interfaces/i_collapsible_toolbox_item.js';\nimport type {IToolbox} from '../interfaces/i_toolbox.js';\nimport type {IToolboxItem} from '../interfaces/i_toolbox_item.js';\nimport * as idGenerator from '../utils/idgenerator.js';\nimport type * as toolbox from '../utils/toolbox.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\n\n\n/**\n * Class for an item in the toolbox.\n *\n * @alias Blockly.ToolboxItem\n */\nexport class ToolboxItem implements IToolboxItem {\n protected id_: string;\n protected parent_: ICollapsibleToolboxItem|null;\n protected level_: number;\n protected toolboxItemDef_: toolbox.ToolboxItemInfo|null;\n protected workspace_: WorkspaceSvg;\n /** The toolbox this category belongs to. */\n protected readonly parentToolbox_: IToolbox;\n\n /**\n * @param toolboxItemDef The JSON defining the toolbox item.\n * @param parentToolbox The toolbox that holds the toolbox item.\n * @param opt_parent The parent toolbox item or null if the category does not\n * have a parent.\n */\n constructor(\n toolboxItemDef: toolbox.ToolboxItemInfo, parentToolbox: IToolbox,\n opt_parent?: ICollapsibleToolboxItem) {\n /** The ID for the category. */\n this.id_ = (toolboxItemDef as AnyDuringMigration)['toolboxitemid'] ||\n idGenerator.getNextUniqueId();\n\n /** The parent of the category. */\n this.parent_ = opt_parent || null;\n\n /** The level that the category is nested at. */\n this.level_ = this.parent_ ? this.parent_.getLevel() + 1 : 0;\n\n /** The JSON definition of the toolbox item. */\n this.toolboxItemDef_ = toolboxItemDef;\n\n this.parentToolbox_ = parentToolbox;\n\n /** The workspace of the parent toolbox. */\n this.workspace_ = this.parentToolbox_.getWorkspace();\n }\n\n /**\n * Initializes the toolbox item.\n * This includes creating the DOM and updating the state of any items based\n * on the info object.\n */\n init() {}\n // No-op by default.\n\n /**\n * Gets the div for the toolbox item.\n *\n * @returns The div for the toolbox item.\n */\n getDiv(): Element|null {\n return null;\n }\n\n /**\n * Gets the HTML element that is clickable.\n * The parent toolbox element receives clicks. The parent toolbox will add an\n * ID to this element so it can pass the onClick event to the correct\n * toolboxItem.\n *\n * @returns The HTML element that receives clicks, or null if this item should\n * not receive clicks.\n */\n getClickTarget(): Element|null {\n return null;\n }\n\n /**\n * Gets a unique identifier for this toolbox item.\n *\n * @returns The ID for the toolbox item.\n */\n getId(): string {\n return this.id_;\n }\n\n /**\n * Gets the parent if the toolbox item is nested.\n *\n * @returns The parent toolbox item, or null if this toolbox item is not\n * nested.\n */\n getParent(): ICollapsibleToolboxItem|null {\n return null;\n }\n\n /**\n * Gets the nested level of the category.\n *\n * @returns The nested level of the category.\n * @internal\n */\n getLevel(): number {\n return this.level_;\n }\n\n /**\n * Whether the toolbox item is selectable.\n *\n * @returns True if the toolbox item can be selected.\n */\n isSelectable(): boolean {\n return false;\n }\n\n /**\n * Whether the toolbox item is collapsible.\n *\n * @returns True if the toolbox item is collapsible.\n */\n isCollapsible(): boolean {\n return false;\n }\n\n /** Dispose of this toolbox item. No-op by default. */\n dispose() {}\n\n /**\n * Sets whether the category is visible or not.\n * For a category to be visible its parent category must also be expanded.\n *\n * @param _isVisible True if category should be visible.\n */\n setVisible_(_isVisible: boolean) {}\n}\n// nop by default\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A toolbox category used to organize blocks in the toolbox.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ToolboxCategory');\n\nimport * as Css from '../css.js';\nimport type {ICollapsibleToolboxItem} from '../interfaces/i_collapsible_toolbox_item.js';\nimport type {ISelectableToolboxItem} from '../interfaces/i_selectable_toolbox_item.js';\nimport type {IToolbox} from '../interfaces/i_toolbox.js';\nimport type {IToolboxItem} from '../interfaces/i_toolbox_item.js';\nimport type {CategoryInfo, DynamicCategoryInfo, FlyoutDefinition, FlyoutItemInfo, FlyoutItemInfoArray, StaticCategoryInfo} from '../utils/toolbox.js';\nimport * as registry from '../registry.js';\nimport * as aria from '../utils/aria.js';\nimport * as colourUtils from '../utils/colour.js';\nimport * as dom from '../utils/dom.js';\nimport * as parsing from '../utils/parsing.js';\nimport * as toolbox from '../utils/toolbox.js';\n\nimport {ToolboxItem} from './toolbox_item.js';\n\n\n/**\n * Class for a category in a toolbox.\n *\n * @alias Blockly.ToolboxCategory\n */\nexport class ToolboxCategory extends ToolboxItem implements\n ISelectableToolboxItem {\n /** Name used for registering a toolbox category. */\n static registrationName = 'category';\n\n /** The number of pixels to move the category over at each nested level. */\n static nestedPadding = 19;\n\n /** The width in pixels of the strip of colour next to each category. */\n static borderWidth = 8;\n\n /**\n * The default colour of the category. This is used as the background colour\n * of the category when it is selected.\n */\n static defaultBackgroundColour = '#57e';\n\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override toolboxItemDef_!: CategoryInfo;\n\n /** The name that will be displayed on the category. */\n protected name_ = '';\n\n /** The colour of the category. */\n protected colour_ = '';\n\n /** The html container for the category. */\n protected htmlDiv_: HTMLDivElement|null = null;\n\n /** The html element for the category row. */\n protected rowDiv_: HTMLDivElement|null = null;\n\n /** The html element that holds children elements of the category row. */\n protected rowContents_: HTMLDivElement|null = null;\n\n /** The html element for the toolbox icon. */\n protected iconDom_: Element|null = null;\n\n /** The html element for the toolbox label. */\n protected labelDom_: Element|null = null;\n protected cssConfig_: CssConfig;\n\n /** True if the category is meant to be hidden, false otherwise. */\n protected isHidden_ = false;\n\n /** True if this category is disabled, false otherwise. */\n protected isDisabled_ = false;\n\n /** The flyout items for this category. */\n protected flyoutItems_: string|FlyoutItemInfoArray = [];\n\n /**\n * @param categoryDef The information needed to create a category in the\n * toolbox.\n * @param parentToolbox The parent toolbox for the category.\n * @param opt_parent The parent category or null if the category does not have\n * a parent.\n */\n constructor(\n categoryDef: CategoryInfo, parentToolbox: IToolbox,\n opt_parent?: ICollapsibleToolboxItem) {\n super(categoryDef, parentToolbox, opt_parent);\n\n /** All the css class names that are used to create a category. */\n this.cssConfig_ = this.makeDefaultCssConfig_();\n }\n\n /**\n * Initializes the toolbox item.\n * This includes creating the DOM and updating the state of any items based\n * on the info object.\n * Init should be called immediately after the construction of the toolbox\n * item, to ensure that the category contents are properly parsed.\n */\n override init() {\n this.parseCategoryDef_(this.toolboxItemDef_);\n this.parseContents_(this.toolboxItemDef_);\n this.createDom_();\n if (this.toolboxItemDef_['hidden'] === 'true') {\n this.hide();\n }\n }\n\n /**\n * Creates an object holding the default classes for a category.\n *\n * @returns The configuration object holding all the CSS classes for a\n * category.\n */\n protected makeDefaultCssConfig_(): CssConfig {\n return {\n 'container': 'blocklyToolboxCategory',\n 'row': 'blocklyTreeRow',\n 'rowcontentcontainer': 'blocklyTreeRowContentContainer',\n 'icon': 'blocklyTreeIcon',\n 'label': 'blocklyTreeLabel',\n 'contents': 'blocklyToolboxContents',\n 'selected': 'blocklyTreeSelected',\n 'openicon': 'blocklyTreeIconOpen',\n 'closedicon': 'blocklyTreeIconClosed',\n };\n }\n\n /**\n * Parses the contents array depending on if the category is a dynamic\n * category, or if its contents are meant to be shown in the flyout.\n *\n * @param categoryDef The information needed to create a category.\n */\n protected parseContents_(categoryDef: CategoryInfo) {\n if ('custom' in categoryDef) {\n this.flyoutItems_ = categoryDef['custom'];\n } else {\n const contents = categoryDef['contents'];\n if (!contents) return;\n\n for (let i = 0; i < contents.length; i++) {\n const itemDef = contents[i];\n const flyoutItem = itemDef as FlyoutItemInfo;\n if (Array.isArray(this.flyoutItems_)) {\n this.flyoutItems_.push(flyoutItem);\n }\n }\n }\n }\n\n /**\n * Parses the non-contents parts of the category def.\n *\n * @param categoryDef The information needed to create a category.\n */\n protected parseCategoryDef_(categoryDef: CategoryInfo) {\n this.name_ = 'name' in categoryDef ?\n parsing.replaceMessageReferences(categoryDef['name']) :\n '';\n this.colour_ = this.getColour_(categoryDef);\n Object.assign(\n this.cssConfig_,\n categoryDef['cssconfig'] || (categoryDef as any)['cssConfig']);\n }\n\n /**\n * Creates the DOM for the category.\n *\n * @returns The parent element for the category.\n */\n protected createDom_(): HTMLDivElement {\n this.htmlDiv_ = this.createContainer_();\n aria.setRole(this.htmlDiv_, aria.Role.TREEITEM);\n aria.setState(this.htmlDiv_, aria.State.SELECTED, false);\n aria.setState(this.htmlDiv_, aria.State.LEVEL, this.level_);\n\n this.rowDiv_ = this.createRowContainer_();\n this.rowDiv_.style.pointerEvents = 'auto';\n this.htmlDiv_.appendChild(this.rowDiv_);\n\n this.rowContents_ = this.createRowContentsContainer_();\n this.rowContents_.style.pointerEvents = 'none';\n this.rowDiv_.appendChild(this.rowContents_);\n\n this.iconDom_ = this.createIconDom_();\n aria.setRole(this.iconDom_, aria.Role.PRESENTATION);\n this.rowContents_.appendChild(this.iconDom_);\n\n this.labelDom_ = this.createLabelDom_(this.name_);\n this.rowContents_.appendChild(this.labelDom_);\n\n const id = this.labelDom_.getAttribute('id');\n if (id) {\n aria.setState(this.htmlDiv_, aria.State.LABELLEDBY, id);\n }\n\n this.addColourBorder_(this.colour_);\n\n return this.htmlDiv_;\n }\n\n /**\n * Creates the container that holds the row and any subcategories.\n *\n * @returns The div that holds the icon and the label.\n */\n protected createContainer_(): HTMLDivElement {\n const container = document.createElement('div');\n const className = this.cssConfig_['container'];\n if (className) {\n dom.addClass(container, className);\n }\n return container;\n }\n\n /**\n * Creates the parent of the contents container. All clicks will happen on\n * this div.\n *\n * @returns The div that holds the contents container.\n */\n protected createRowContainer_(): HTMLDivElement {\n const rowDiv = document.createElement('div');\n const className = this.cssConfig_['row'];\n if (className) {\n dom.addClass(rowDiv, className);\n }\n const nestedPadding =\n `${ToolboxCategory.nestedPadding * this.getLevel()}px`;\n this.workspace_.RTL ? rowDiv.style.paddingRight = nestedPadding :\n rowDiv.style.paddingLeft = nestedPadding;\n return rowDiv;\n }\n\n /**\n * Creates the container for the label and icon.\n * This is necessary so we can set all subcategory pointer events to none.\n *\n * @returns The div that holds the icon and the label.\n */\n protected createRowContentsContainer_(): HTMLDivElement {\n const contentsContainer = document.createElement('div');\n const className = this.cssConfig_['rowcontentcontainer'];\n if (className) {\n dom.addClass(contentsContainer, className);\n }\n return contentsContainer;\n }\n\n /**\n * Creates the span that holds the category icon.\n *\n * @returns The span that holds the category icon.\n */\n protected createIconDom_(): Element {\n const toolboxIcon = document.createElement('span');\n if (!this.parentToolbox_.isHorizontal()) {\n const className = this.cssConfig_['icon'];\n if (className) {\n dom.addClass(toolboxIcon, className);\n }\n }\n\n toolboxIcon.style.display = 'inline-block';\n return toolboxIcon;\n }\n\n /**\n * Creates the span that holds the category label.\n * This should have an ID for accessibility purposes.\n *\n * @param name The name of the category.\n * @returns The span that holds the category label.\n */\n protected createLabelDom_(name: string): Element {\n const toolboxLabel = document.createElement('span');\n toolboxLabel.setAttribute('id', this.getId() + '.label');\n toolboxLabel.textContent = name;\n const className = this.cssConfig_['label'];\n if (className) {\n dom.addClass(toolboxLabel, className);\n }\n return toolboxLabel;\n }\n\n /** Updates the colour for this category. */\n refreshTheme() {\n this.colour_ = this.getColour_(this.toolboxItemDef_);\n this.addColourBorder_(this.colour_);\n }\n\n /**\n * Add the strip of colour to the toolbox category.\n *\n * @param colour The category colour.\n */\n protected addColourBorder_(colour: string) {\n if (colour) {\n const border =\n ToolboxCategory.borderWidth + 'px solid ' + (colour || '#ddd');\n if (this.workspace_.RTL) {\n this.rowDiv_!.style.borderRight = border;\n } else {\n this.rowDiv_!.style.borderLeft = border;\n }\n }\n }\n\n /**\n * Gets either the colour or the style for a category.\n *\n * @param categoryDef The object holding information on the category.\n * @returns The hex colour for the category.\n */\n protected getColour_(categoryDef: CategoryInfo): string {\n const styleName =\n categoryDef['categorystyle'] || (categoryDef as any)['categoryStyle'];\n const colour = categoryDef['colour'];\n\n if (colour && styleName) {\n console.warn(\n 'Toolbox category \"' + this.name_ +\n '\" must not have both a style and a colour');\n } else if (styleName) {\n return this.getColourfromStyle_(styleName);\n } else if (colour) {\n return this.parseColour_(colour);\n }\n return '';\n }\n\n /**\n * Sets the colour for the category using the style name and returns the new\n * colour as a hex string.\n *\n * @param styleName Name of the style.\n * @returns The hex colour for the category.\n */\n private getColourfromStyle_(styleName: string): string {\n const theme = this.workspace_.getTheme();\n if (styleName && theme) {\n const style = theme.categoryStyles[styleName];\n if (style && style.colour) {\n return this.parseColour_(style.colour);\n } else {\n console.warn(\n 'Style \"' + styleName + '\" must exist and contain a colour value');\n }\n }\n return '';\n }\n\n /**\n * Gets the HTML element that is clickable.\n * The parent toolbox element receives clicks. The parent toolbox will add an\n * ID to this element so it can pass the onClick event to the correct\n * toolboxItem.\n *\n * @returns The HTML element that receives clicks.\n */\n override getClickTarget(): Element {\n return this.rowDiv_ as Element;\n }\n\n /**\n * Parses the colour on the category.\n *\n * @param colourValue HSV hue value (0 to 360), #RRGGBB string, or a message\n * reference string pointing to one of those two values.\n * @returns The hex colour for the category.\n */\n private parseColour_(colourValue: number|string): string {\n // Decode the colour for any potential message references\n // (eg. `%{BKY_MATH_HUE}`).\n const colour = parsing.replaceMessageReferences(colourValue);\n if (colour == null || colour === '') {\n // No attribute. No colour.\n return '';\n } else {\n const hue = Number(colour);\n if (!isNaN(hue)) {\n return colourUtils.hueToHex(hue);\n } else {\n const hex = colourUtils.parse(colour);\n if (hex) {\n return hex;\n } else {\n console.warn(\n 'Toolbox category \"' + this.name_ +\n '\" has unrecognized colour attribute: ' + colour);\n return '';\n }\n }\n }\n }\n\n /**\n * Adds appropriate classes to display an open icon.\n *\n * @param iconDiv The div that holds the icon.\n */\n protected openIcon_(iconDiv: Element|null) {\n if (!iconDiv) {\n return;\n }\n const closedIconClass = this.cssConfig_['closedicon'];\n if (closedIconClass) {\n dom.removeClasses(iconDiv, closedIconClass);\n }\n const className = this.cssConfig_['openicon'];\n if (className) {\n dom.addClass(iconDiv, className);\n }\n }\n\n /**\n * Adds appropriate classes to display a closed icon.\n *\n * @param iconDiv The div that holds the icon.\n */\n protected closeIcon_(iconDiv: Element|null) {\n if (!iconDiv) {\n return;\n }\n const openIconClass = this.cssConfig_['openicon'];\n if (openIconClass) {\n dom.removeClasses(iconDiv, openIconClass);\n }\n const className = this.cssConfig_['closedicon'];\n if (className) {\n dom.addClass(iconDiv, className);\n }\n }\n\n /**\n * Sets whether the category is visible or not.\n * For a category to be visible its parent category must also be expanded.\n *\n * @param isVisible True if category should be visible.\n */\n override setVisible_(isVisible: boolean) {\n this.htmlDiv_!.style.display = isVisible ? 'block' : 'none';\n this.isHidden_ = !isVisible;\n\n if (this.parentToolbox_.getSelectedItem() === this) {\n this.parentToolbox_.clearSelection();\n }\n }\n\n /** Hide the category. */\n hide() {\n this.setVisible_(false);\n }\n\n /**\n * Show the category. Category will only appear if its parent category is also\n * expanded.\n */\n show() {\n this.setVisible_(true);\n }\n\n /**\n * Whether the category is visible.\n * A category is only visible if all of its ancestors are expanded and\n * isHidden_ is false.\n *\n * @returns True if the category is visible, false otherwise.\n */\n isVisible(): boolean {\n return !this.isHidden_ && this.allAncestorsExpanded_();\n }\n\n /**\n * Whether all ancestors of a category (parent and parent's parent, etc.) are\n * expanded.\n *\n * @returns True only if every ancestor is expanded\n */\n protected allAncestorsExpanded_(): boolean {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let category: IToolboxItem = this;\n while (category.getParent()) {\n category = category.getParent()!;\n if (!(category as ICollapsibleToolboxItem).isExpanded()) {\n return false;\n }\n }\n return true;\n }\n\n override isSelectable() {\n return this.isVisible() && !this.isDisabled_;\n }\n\n /**\n * Handles when the toolbox item is clicked.\n *\n * @param _e Click event to handle.\n */\n onClick(_e: Event) {}\n // No-op\n\n /**\n * Sets the current category as selected.\n *\n * @param isSelected True if this category is selected, false otherwise.\n */\n setSelected(isSelected: boolean) {\n if (!this.rowDiv_) {\n return;\n }\n const className = this.cssConfig_['selected'];\n if (isSelected) {\n const defaultColour =\n this.parseColour_(ToolboxCategory.defaultBackgroundColour);\n this.rowDiv_.style.backgroundColor = this.colour_ || defaultColour;\n if (className) {\n dom.addClass(this.rowDiv_, className);\n }\n } else {\n this.rowDiv_.style.backgroundColor = '';\n if (className) {\n dom.removeClass(this.rowDiv_, className);\n }\n }\n aria.setState(this.htmlDiv_ as Element, aria.State.SELECTED, isSelected);\n }\n\n /**\n * Sets whether the category is disabled.\n *\n * @param isDisabled True to disable the category, false otherwise.\n */\n setDisabled(isDisabled: boolean) {\n this.isDisabled_ = isDisabled;\n this.getDiv()!.setAttribute('disabled', `${isDisabled}`);\n isDisabled ? this.getDiv()!.setAttribute('disabled', 'true') :\n this.getDiv()!.removeAttribute('disabled');\n }\n\n /**\n * Gets the name of the category. Used for emitting events.\n *\n * @returns The name of the toolbox item.\n */\n getName(): string {\n return this.name_;\n }\n\n override getParent() {\n return this.parent_;\n }\n\n override getDiv() {\n return this.htmlDiv_;\n }\n\n /**\n * Gets the contents of the category. These are items that are meant to be\n * displayed in the flyout.\n *\n * @returns The definition of items to be displayed in the flyout.\n */\n getContents(): FlyoutItemInfoArray|string {\n return this.flyoutItems_;\n }\n\n /**\n * Updates the contents to be displayed in the flyout.\n * If the flyout is open when the contents are updated, refreshSelection on\n * the toolbox must also be called.\n *\n * @param contents The contents to be displayed in the flyout. A string can be\n * supplied to create a dynamic category.\n */\n updateFlyoutContents(contents: FlyoutDefinition|string) {\n this.flyoutItems_ = [];\n\n if (typeof contents === 'string') {\n const newDefinition: DynamicCategoryInfo = {\n kind: this.toolboxItemDef_.kind,\n custom: contents,\n id: this.toolboxItemDef_.id,\n categorystyle: this.toolboxItemDef_.categorystyle,\n colour: this.toolboxItemDef_.colour,\n cssconfig: this.toolboxItemDef_.cssconfig,\n hidden: this.toolboxItemDef_.hidden,\n };\n this.toolboxItemDef_ = newDefinition;\n } else {\n const newDefinition: StaticCategoryInfo = {\n kind: this.toolboxItemDef_.kind,\n name: 'name' in this.toolboxItemDef_ ? this.toolboxItemDef_['name'] :\n '',\n contents: toolbox.convertFlyoutDefToJsonArray(contents),\n id: this.toolboxItemDef_.id,\n categorystyle: this.toolboxItemDef_.categorystyle,\n colour: this.toolboxItemDef_.colour,\n cssconfig: this.toolboxItemDef_.cssconfig,\n hidden: this.toolboxItemDef_.hidden,\n };\n this.toolboxItemDef_ = newDefinition;\n }\n this.parseContents_(this.toolboxItemDef_);\n }\n\n override dispose() {\n dom.removeNode(this.htmlDiv_);\n }\n}\n\nexport namespace ToolboxCategory {\n /** All the CSS class names that are used to create a category. */\n export interface CssConfig {\n container?: string;\n row?: string;\n rowcontentcontainer?: string;\n icon?: string;\n label?: string;\n contents?: string;\n selected?: string;\n openicon?: string;\n closedicon?: string;\n }\n}\n\nexport type CssConfig = ToolboxCategory.CssConfig;\n\n/** CSS for Toolbox. See css.js for use. */\nCss.register(`\n.blocklyTreeRow:not(.blocklyTreeSelected):hover {\n background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolboxDiv[layout=\"h\"] .blocklyToolboxCategory {\n margin: 1px 5px 1px 0;\n}\n\n.blocklyToolboxDiv[dir=\"RTL\"][layout=\"h\"] .blocklyToolboxCategory {\n margin: 1px 0 1px 5px;\n}\n\n.blocklyTreeRow {\n height: 22px;\n line-height: 22px;\n margin-bottom: 3px;\n padding-right: 8px;\n white-space: nowrap;\n}\n\n.blocklyToolboxDiv[dir=\"RTL\"] .blocklyTreeRow {\n margin-left: 8px;\n padding-right: 0;\n}\n\n.blocklyTreeIcon {\n background-image: url(<<<PATH>>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyTreeIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolboxDiv[dir=\"RTL\"] .blocklyTreeIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolboxDiv[dir=\"RTL\"] .blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyTreeIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyTreeLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyTreeLabel {\n cursor: url(\"<<<PATH>>>/handdelete.cur\"), auto;\n}\n\n.blocklyTreeSelected .blocklyTreeLabel {\n color: #fff;\n}\n`);\n\nregistry.register(\n registry.Type.TOOLBOX_ITEM, ToolboxCategory.registrationName,\n ToolboxCategory);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A separator used for separating toolbox categories.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ToolboxSeparator');\n\nimport * as Css from '../css.js';\nimport type {IToolbox} from '../interfaces/i_toolbox.js';\nimport * as registry from '../registry.js';\nimport * as dom from '../utils/dom.js';\nimport type * as toolbox from '../utils/toolbox.js';\n\nimport {ToolboxItem} from './toolbox_item.js';\n\n\n/**\n * Class for a toolbox separator. This is the thin visual line that appears on\n * the toolbox. This item is not interactable.\n *\n * @alias Blockly.ToolboxSeparator\n */\nexport class ToolboxSeparator extends ToolboxItem {\n /** Name used for registering a toolbox separator. */\n static registrationName = 'sep';\n\n /** All the CSS class names that are used to create a separator. */\n protected cssConfig_: CssConfig = {'container': 'blocklyTreeSeparator'};\n\n private htmlDiv_: HTMLDivElement|null = null;\n\n /**\n * @param separatorDef The information needed to create a separator.\n * @param toolbox The parent toolbox for the separator.\n */\n constructor(separatorDef: toolbox.SeparatorInfo, toolbox: IToolbox) {\n super(separatorDef, toolbox);\n\n const cssConfig =\n separatorDef['cssconfig'] || (separatorDef as any)['cssConfig'];\n Object.assign(this.cssConfig_, cssConfig);\n }\n\n override init() {\n this.createDom_();\n }\n\n /**\n * Creates the DOM for a separator.\n *\n * @returns The parent element for the separator.\n */\n protected createDom_(): HTMLDivElement {\n const container = document.createElement('div');\n const className = this.cssConfig_['container'];\n if (className) {\n dom.addClass(container, className);\n }\n this.htmlDiv_ = container;\n return container;\n }\n\n override getDiv() {\n return this.htmlDiv_ as HTMLDivElement;\n }\n\n override dispose() {\n dom.removeNode(this.htmlDiv_ as HTMLDivElement);\n }\n}\n\nexport namespace ToolboxSeparator {\n export interface CssConfig {\n container: string|undefined;\n }\n}\n\nexport type CssConfig = ToolboxSeparator.CssConfig;\n\n/** CSS for Toolbox. See css.js for use. */\nCss.register(`\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolboxDiv[layout=\"h\"] .blocklyTreeSeparator {\n border-right: solid #e5e5e5 1px;\n border-bottom: none;\n height: auto;\n margin: 0 5px 0 5px;\n padding: 5px 0;\n width: 0;\n}\n`);\n\nregistry.register(\n registry.Type.TOOLBOX_ITEM, ToolboxSeparator.registrationName,\n ToolboxSeparator);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A toolbox category used to organize blocks in the toolbox.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.CollapsibleToolboxCategory');\n\nimport type {ICollapsibleToolboxItem} from '../interfaces/i_collapsible_toolbox_item.js';\nimport type {IToolbox} from '../interfaces/i_toolbox.js';\nimport type {IToolboxItem} from '../interfaces/i_toolbox_item.js';\nimport * as registry from '../registry.js';\nimport * as aria from '../utils/aria.js';\nimport * as dom from '../utils/dom.js';\nimport * as toolbox from '../utils/toolbox.js';\n\nimport {ToolboxCategory} from './category.js';\nimport {ToolboxSeparator} from './separator.js';\n\n\n/**\n * Class for a category in a toolbox that can be collapsed.\n *\n * @alias Blockly.CollapsibleToolboxCategory\n */\nexport class CollapsibleToolboxCategory extends ToolboxCategory implements\n ICollapsibleToolboxItem {\n /** Name used for registering a collapsible toolbox category. */\n static override registrationName = 'collapsibleCategory';\n\n /** Container for any child categories. */\n protected subcategoriesDiv_: HTMLDivElement|null = null;\n\n /** Whether or not the category should display its subcategories. */\n protected expanded_ = false;\n\n /** The child toolbox items for this category. */\n protected toolboxItems_: IToolboxItem[] = [];\n override flyoutItems_: AnyDuringMigration;\n override isHidden_: AnyDuringMigration;\n\n /**\n * @param categoryDef The information needed to create a category in the\n * toolbox.\n * @param toolbox The parent toolbox for the category.\n * @param opt_parent The parent category or null if the category does not have\n * a parent.\n */\n constructor(\n categoryDef: toolbox.CategoryInfo, toolbox: IToolbox,\n opt_parent?: ICollapsibleToolboxItem) {\n super(categoryDef, toolbox, opt_parent);\n }\n\n override makeDefaultCssConfig_() {\n const cssConfig = super.makeDefaultCssConfig_();\n (cssConfig as AnyDuringMigration)['contents'] = 'blocklyToolboxContents';\n return cssConfig;\n }\n\n override parseContents_(categoryDef: toolbox.CategoryInfo) {\n // AnyDuringMigration because: Element implicitly has an 'any' type because\n // expression of type '\"contents\"' can't be used to index type\n // 'CategoryInfo'.\n const contents = (categoryDef as AnyDuringMigration)['contents'];\n let prevIsFlyoutItem = true;\n\n // AnyDuringMigration because: Element implicitly has an 'any' type because\n // expression of type '\"custom\"' can't be used to index type 'CategoryInfo'.\n if ((categoryDef as AnyDuringMigration)['custom']) {\n // AnyDuringMigration because: Element implicitly has an 'any' type\n // because expression of type '\"custom\"' can't be used to index type\n // 'CategoryInfo'.\n this.flyoutItems_ = (categoryDef as AnyDuringMigration)['custom'];\n } else if (contents) {\n for (let i = 0; i < contents.length; i++) {\n const itemDef = contents[i];\n // Separators can exist as either a flyout item or a toolbox item so\n // decide where it goes based on the type of the previous item.\n if (!registry.hasItem(registry.Type.TOOLBOX_ITEM, itemDef['kind']) ||\n itemDef['kind'].toLowerCase() ===\n ToolboxSeparator.registrationName &&\n prevIsFlyoutItem) {\n const flyoutItem = itemDef as toolbox.FlyoutItemInfo;\n this.flyoutItems_.push(flyoutItem);\n prevIsFlyoutItem = true;\n } else {\n this.createToolboxItem_(itemDef);\n prevIsFlyoutItem = false;\n }\n }\n }\n }\n\n /**\n * Creates a toolbox item and adds it to the list of toolbox items.\n *\n * @param itemDef The information needed to create a toolbox item.\n */\n private createToolboxItem_(itemDef: toolbox.ToolboxItemInfo) {\n let registryName = itemDef['kind'];\n const categoryDef = itemDef as toolbox.CategoryInfo;\n // Categories that are collapsible are created using a class registered\n // under a different name.\n if (registryName.toUpperCase() === 'CATEGORY' &&\n toolbox.isCategoryCollapsible(categoryDef)) {\n registryName = CollapsibleToolboxCategory.registrationName;\n }\n const ToolboxItemClass =\n registry.getClass(registry.Type.TOOLBOX_ITEM, registryName);\n const toolboxItem =\n new ToolboxItemClass!(itemDef, this.parentToolbox_, this);\n this.toolboxItems_.push(toolboxItem);\n }\n\n override init() {\n super.init();\n\n this.setExpanded(\n (this.toolboxItemDef_ as AnyDuringMigration)['expanded'] === 'true' ||\n (this.toolboxItemDef_ as AnyDuringMigration)['expanded']);\n }\n\n override createDom_() {\n super.createDom_();\n\n const subCategories = this.getChildToolboxItems();\n this.subcategoriesDiv_ = this.createSubCategoriesDom_(subCategories);\n aria.setRole(this.subcategoriesDiv_, aria.Role.GROUP);\n this.htmlDiv_!.appendChild(this.subcategoriesDiv_);\n\n return this.htmlDiv_!;\n }\n\n override createIconDom_() {\n const toolboxIcon = document.createElement('span');\n if (!this.parentToolbox_.isHorizontal()) {\n const className = (this.cssConfig_ as AnyDuringMigration)['icon'];\n if (className) {\n dom.addClass(toolboxIcon, className);\n }\n toolboxIcon.style.visibility = 'visible';\n }\n\n toolboxIcon.style.display = 'inline-block';\n return toolboxIcon;\n }\n\n /**\n * Create the DOM for all subcategories.\n *\n * @param subcategories The subcategories.\n * @returns The div holding all the subcategories.\n */\n protected createSubCategoriesDom_(subcategories: IToolboxItem[]):\n HTMLDivElement {\n const contentsContainer = document.createElement('div');\n const className = (this.cssConfig_ as AnyDuringMigration)['contents'];\n if (className) {\n dom.addClass(contentsContainer, className);\n }\n\n for (let i = 0; i < subcategories.length; i++) {\n const newCategory = subcategories[i];\n newCategory.init();\n const newCategoryDiv = newCategory.getDiv();\n contentsContainer.appendChild(newCategoryDiv!);\n if (newCategory.getClickTarget) {\n newCategory.getClickTarget()?.setAttribute('id', newCategory.getId());\n }\n }\n return contentsContainer;\n }\n\n /**\n * Opens or closes the current category.\n *\n * @param isExpanded True to expand the category, false to close.\n */\n setExpanded(isExpanded: boolean) {\n if (this.expanded_ === isExpanded) {\n return;\n }\n this.expanded_ = isExpanded;\n if (isExpanded) {\n this.subcategoriesDiv_!.style.display = 'block';\n this.openIcon_(this.iconDom_);\n } else {\n this.subcategoriesDiv_!.style.display = 'none';\n this.closeIcon_(this.iconDom_);\n }\n aria.setState(\n this.htmlDiv_ as HTMLDivElement, aria.State.EXPANDED, isExpanded);\n\n this.parentToolbox_.handleToolboxItemResize();\n }\n\n override setVisible_(isVisible: boolean) {\n this.htmlDiv_!.style.display = isVisible ? 'block' : 'none';\n const childToolboxItems = this.getChildToolboxItems();\n for (let i = 0; i < childToolboxItems.length; i++) {\n const child = childToolboxItems[i];\n child.setVisible_(isVisible);\n }\n this.isHidden_ = !isVisible;\n\n if (this.parentToolbox_.getSelectedItem() === this) {\n this.parentToolbox_.clearSelection();\n }\n }\n\n /**\n * Whether the category is expanded to show its child subcategories.\n *\n * @returns True if the toolbox item shows its children, false if it is\n * collapsed.\n */\n isExpanded(): boolean {\n return this.expanded_;\n }\n\n override isCollapsible() {\n return true;\n }\n\n override onClick(_e: Event) {\n this.toggleExpanded();\n }\n\n /** Toggles whether or not the category is expanded. */\n toggleExpanded() {\n this.setExpanded(!this.expanded_);\n }\n\n override getDiv() {\n return this.htmlDiv_;\n }\n\n /**\n * Gets any children toolbox items. (ex. Gets the subcategories)\n *\n * @returns The child toolbox items.\n */\n getChildToolboxItems(): IToolboxItem[] {\n return this.toolboxItems_;\n }\n}\n\nexport namespace CollapsibleToolboxCategory {\n /**\n * All the CSS class names that are used to create a collapsible\n * category. This is all the properties from the regular category plus\n * contents.\n */\n export interface CssConfig {\n container: string|null;\n row: string|null;\n rowcontentcontainer: string|null;\n icon: string|null;\n label: string|null;\n selected: string|null;\n openicon: string|null;\n closedicon: string|null;\n contents: string|null;\n }\n}\n\nexport type CssConfig = CollapsibleToolboxCategory.CssConfig;\n\nregistry.register(\n registry.Type.TOOLBOX_ITEM, CollapsibleToolboxCategory.registrationName,\n CollapsibleToolboxCategory);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Toolbox from whence to create blocks.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Toolbox');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport '../events/events_toolbox_item_select.js';\n\nimport {BlockSvg} from '../block_svg.js';\nimport type {BlocklyOptions} from '../blockly_options.js';\nimport * as browserEvents from '../browser_events.js';\nimport * as common from '../common.js';\nimport {ComponentManager} from '../component_manager.js';\nimport * as Css from '../css.js';\nimport {DeleteArea} from '../delete_area.js';\nimport * as eventUtils from '../events/utils.js';\nimport type {IAutoHideable} from '../interfaces/i_autohideable.js';\nimport type {ICollapsibleToolboxItem} from '../interfaces/i_collapsible_toolbox_item.js';\nimport type {IDraggable} from '../interfaces/i_draggable.js';\nimport type {IFlyout} from '../interfaces/i_flyout.js';\nimport type {IKeyboardAccessible} from '../interfaces/i_keyboard_accessible.js';\nimport type {ISelectableToolboxItem} from '../interfaces/i_selectable_toolbox_item.js';\nimport type {IStyleable} from '../interfaces/i_styleable.js';\nimport type {IToolbox} from '../interfaces/i_toolbox.js';\nimport type {IToolboxItem} from '../interfaces/i_toolbox_item.js';\nimport {Options} from '../options.js';\nimport * as registry from '../registry.js';\nimport type {KeyboardShortcut} from '../shortcut_registry.js';\nimport * as Touch from '../touch.js';\nimport * as aria from '../utils/aria.js';\nimport * as dom from '../utils/dom.js';\nimport {KeyCodes} from '../utils/keycodes.js';\nimport {Rect} from '../utils/rect.js';\nimport * as toolbox from '../utils/toolbox.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\n\nimport type {ToolboxCategory} from './category.js';\nimport {CollapsibleToolboxCategory} from './collapsible_category.js';\n\n\n/**\n * Class for a Toolbox.\n * Creates the toolbox's DOM.\n *\n * @alias Blockly.Toolbox\n */\nexport class Toolbox extends DeleteArea implements IAutoHideable,\n IKeyboardAccessible,\n IStyleable, IToolbox {\n /**\n * The unique ID for this component that is used to register with the\n * ComponentManager.\n */\n override id = 'toolbox';\n protected toolboxDef_: toolbox.ToolboxInfo;\n private readonly horizontalLayout_: boolean;\n\n /** The html container for the toolbox. */\n HtmlDiv: HTMLDivElement|null = null;\n\n /** The html container for the contents of a toolbox. */\n protected contentsDiv_: HTMLDivElement|null = null;\n\n /** Whether the Toolbox is visible. */\n protected isVisible_ = false;\n\n /** The list of items in the toolbox. */\n protected contents_: IToolboxItem[] = [];\n\n /** The width of the toolbox. */\n protected width_ = 0;\n\n /** The height of the toolbox. */\n protected height_ = 0;\n RTL: boolean;\n\n /** The flyout for the toolbox. */\n private flyout_: IFlyout|null = null;\n protected contentMap_: {[key: string]: IToolboxItem};\n toolboxPosition: toolbox.Position;\n\n /** The currently selected item. */\n protected selectedItem_: ISelectableToolboxItem|null = null;\n\n /** The previously selected item. */\n protected previouslySelectedItem_: ISelectableToolboxItem|null = null;\n\n /**\n * Array holding info needed to unbind event handlers.\n * Used for disposing.\n * Ex: [[node, name, func], [node, name, func]].\n */\n protected boundEvents_: browserEvents.Data[] = [];\n override wouldDelete_: AnyDuringMigration;\n\n /** The workspace this toolbox is on. */\n protected readonly workspace_: WorkspaceSvg;\n\n /** @param workspace The workspace in which to create new blocks. */\n constructor(workspace: WorkspaceSvg) {\n super();\n\n this.workspace_ = workspace;\n\n /** The JSON describing the contents of this toolbox. */\n // AnyDuringMigration because: Type 'ToolboxInfo | { contents: never[]; }'\n // is not assignable to type 'ToolboxInfo'.\n this.toolboxDef_ = (workspace.options.languageTree || {'contents': []}) as\n AnyDuringMigration;\n\n /** Whether the toolbox should be laid out horizontally. */\n this.horizontalLayout_ = workspace.options.horizontalLayout;\n\n /** Is RTL vs LTR. */\n this.RTL = workspace.options.RTL;\n\n /** A map from toolbox item IDs to toolbox items. */\n this.contentMap_ = Object.create(null);\n\n /** Position of the toolbox and flyout relative to the workspace. */\n this.toolboxPosition = workspace.options.toolboxPosition;\n }\n\n /**\n * Handles the given keyboard shortcut.\n *\n * @param _shortcut The shortcut to be handled.\n * @returns True if the shortcut has been handled, false otherwise.\n */\n onShortcut(_shortcut: KeyboardShortcut): boolean {\n return false;\n }\n\n /** Initializes the toolbox */\n init() {\n const workspace = this.workspace_;\n const svg = workspace.getParentSvg();\n\n this.flyout_ = this.createFlyout_();\n\n this.HtmlDiv = this.createDom_(this.workspace_);\n dom.insertAfter(this.flyout_.createDom('svg'), svg);\n this.setVisible(true);\n this.flyout_.init(workspace);\n\n this.render(this.toolboxDef_);\n const themeManager = workspace.getThemeManager();\n themeManager.subscribe(\n this.HtmlDiv, 'toolboxBackgroundColour', 'background-color');\n themeManager.subscribe(this.HtmlDiv, 'toolboxForegroundColour', 'color');\n this.workspace_.getComponentManager().addComponent({\n component: this,\n weight: 1,\n capabilities: [\n ComponentManager.Capability.AUTOHIDEABLE,\n ComponentManager.Capability.DELETE_AREA,\n ComponentManager.Capability.DRAG_TARGET,\n ],\n });\n }\n\n /**\n * Creates the DOM for the toolbox.\n *\n * @param workspace The workspace this toolbox is on.\n * @returns The HTML container for the toolbox.\n */\n protected createDom_(workspace: WorkspaceSvg): HTMLDivElement {\n const svg = workspace.getParentSvg();\n\n const container = this.createContainer_();\n\n this.contentsDiv_ = this.createContentsContainer_();\n this.contentsDiv_.tabIndex = 0;\n aria.setRole(this.contentsDiv_, aria.Role.TREE);\n container.appendChild(this.contentsDiv_);\n\n svg.parentNode!.insertBefore(container, svg);\n\n this.attachEvents_(container, this.contentsDiv_);\n return container;\n }\n\n /**\n * Creates the container div for the toolbox.\n *\n * @returns The HTML container for the toolbox.\n */\n protected createContainer_(): HTMLDivElement {\n const toolboxContainer = (document.createElement('div'));\n toolboxContainer.setAttribute('layout', this.isHorizontal() ? 'h' : 'v');\n dom.addClass(toolboxContainer, 'blocklyToolboxDiv');\n dom.addClass(toolboxContainer, 'blocklyNonSelectable');\n toolboxContainer.setAttribute('dir', this.RTL ? 'RTL' : 'LTR');\n return toolboxContainer;\n }\n\n /**\n * Creates the container for all the contents in the toolbox.\n *\n * @returns The HTML container for the toolbox contents.\n */\n protected createContentsContainer_(): HTMLDivElement {\n const contentsContainer = (document.createElement('div'));\n dom.addClass(contentsContainer, 'blocklyToolboxContents');\n if (this.isHorizontal()) {\n contentsContainer.style.flexDirection = 'row';\n }\n return contentsContainer;\n }\n\n /**\n * Adds event listeners to the toolbox container div.\n *\n * @param container The HTML container for the toolbox.\n * @param contentsContainer The HTML container for the contents of the\n * toolbox.\n */\n protected attachEvents_(\n container: HTMLDivElement, contentsContainer: HTMLDivElement) {\n // Clicking on toolbox closes popups.\n const clickEvent = browserEvents.conditionalBind(\n container, 'click', this, this.onClick_,\n /* opt_noCaptureIdentifier */ false, /* opt_noPreventDefault */ true);\n this.boundEvents_.push(clickEvent);\n\n const keyDownEvent = browserEvents.conditionalBind(\n contentsContainer, 'keydown', this, this.onKeyDown_,\n /* opt_noCaptureIdentifier */ false, /* opt_noPreventDefault */ true);\n this.boundEvents_.push(keyDownEvent);\n }\n\n /**\n * Handles on click events for when the toolbox or toolbox items are clicked.\n *\n * @param e Click event to handle.\n */\n protected onClick_(e: MouseEvent) {\n if (browserEvents.isRightButton(e) || e.target === this.HtmlDiv) {\n // Close flyout.\n (common.getMainWorkspace() as WorkspaceSvg).hideChaff(false);\n } else {\n const targetElement = e.target;\n const itemId = (targetElement as Element).getAttribute('id');\n if (itemId) {\n const item = this.getToolboxItemById(itemId);\n if (item!.isSelectable()) {\n this.setSelectedItem(item);\n (item as ISelectableToolboxItem).onClick(e);\n }\n }\n // Just close popups.\n (common.getMainWorkspace() as WorkspaceSvg).hideChaff(true);\n }\n Touch.clearTouchIdentifier();\n }\n\n /**\n * Handles key down events for the toolbox.\n *\n * @param e The key down event.\n */\n protected onKeyDown_(e: KeyboardEvent) {\n let handled = false;\n switch (e.keyCode) {\n case KeyCodes.DOWN:\n handled = this.selectNext_();\n break;\n case KeyCodes.UP:\n handled = this.selectPrevious_();\n break;\n case KeyCodes.LEFT:\n handled = this.selectParent_();\n break;\n case KeyCodes.RIGHT:\n handled = this.selectChild_();\n break;\n case KeyCodes.ENTER:\n case KeyCodes.SPACE:\n if (this.selectedItem_ && this.selectedItem_.isCollapsible()) {\n const collapsibleItem = this.selectedItem_ as ICollapsibleToolboxItem;\n collapsibleItem.toggleExpanded();\n handled = true;\n }\n break;\n default:\n handled = false;\n break;\n }\n if (!handled && this.selectedItem_) {\n // TODO(#6097): Figure out who implements onKeyDown and which interface it\n // should be part of.\n const untypedItem = this.selectedItem_ as AnyDuringMigration;\n if (untypedItem.onKeyDown) {\n handled = untypedItem.onKeyDown(e);\n }\n }\n\n if (handled) {\n e.preventDefault();\n }\n }\n\n /**\n * Creates the flyout based on the toolbox layout.\n *\n * @returns The flyout for the toolbox.\n * @throws {Error} If missing a require for `Blockly.HorizontalFlyout`,\n * `Blockly.VerticalFlyout`, and no flyout plugin is specified.\n */\n protected createFlyout_(): IFlyout {\n const workspace = this.workspace_;\n // TODO (#4247): Look into adding a makeFlyout method to Blockly Options.\n const workspaceOptions = new Options(({\n 'parentWorkspace': workspace,\n 'rtl': workspace.RTL,\n 'oneBasedIndex': workspace.options.oneBasedIndex,\n 'horizontalLayout': workspace.horizontalLayout,\n 'renderer': workspace.options.renderer,\n 'rendererOverrides': workspace.options.rendererOverrides,\n 'move': {\n 'scrollbars': true,\n },\n } as BlocklyOptions));\n // Options takes in either 'end' or 'start'. This has already been parsed to\n // be either 0 or 1, so set it after.\n workspaceOptions.toolboxPosition = workspace.options.toolboxPosition;\n let FlyoutClass = null;\n if (workspace.horizontalLayout) {\n FlyoutClass = registry.getClassFromOptions(\n registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, workspace.options, true);\n } else {\n FlyoutClass = registry.getClassFromOptions(\n registry.Type.FLYOUTS_VERTICAL_TOOLBOX, workspace.options, true);\n }\n return new FlyoutClass!(workspaceOptions);\n }\n\n /**\n * Fills the toolbox with new toolbox items and removes any old contents.\n *\n * @param toolboxDef Object holding information for creating a toolbox.\n * @internal\n */\n render(toolboxDef: toolbox.ToolboxInfo) {\n this.toolboxDef_ = toolboxDef;\n for (let i = 0; i < this.contents_.length; i++) {\n const toolboxItem = this.contents_[i];\n if (toolboxItem) {\n toolboxItem.dispose();\n }\n }\n this.contents_ = [];\n this.contentMap_ = Object.create(null);\n this.renderContents_(toolboxDef['contents']);\n this.position();\n this.handleToolboxItemResize();\n }\n\n /**\n * Adds all the toolbox items to the toolbox.\n *\n * @param toolboxDef Array holding objects containing information on the\n * contents of the toolbox.\n */\n protected renderContents_(toolboxDef: toolbox.ToolboxItemInfo[]) {\n // This is for performance reasons. By using document fragment we only have\n // to add to the DOM once.\n const fragment = document.createDocumentFragment();\n for (let i = 0; i < toolboxDef.length; i++) {\n const toolboxItemDef = toolboxDef[i];\n this.createToolboxItem_(toolboxItemDef, fragment);\n }\n this.contentsDiv_!.appendChild(fragment);\n }\n\n /**\n * Creates and renders the toolbox item.\n *\n * @param toolboxItemDef Any information that can be used to create an item in\n * the toolbox.\n * @param fragment The document fragment to add the child toolbox elements to.\n */\n private createToolboxItem_(\n toolboxItemDef: toolbox.ToolboxItemInfo, fragment: DocumentFragment) {\n let registryName = toolboxItemDef['kind'];\n\n // Categories that are collapsible are created using a class registered\n // under a different name.\n if (registryName.toUpperCase() === 'CATEGORY' &&\n toolbox.isCategoryCollapsible(toolboxItemDef as toolbox.CategoryInfo)) {\n registryName = CollapsibleToolboxCategory.registrationName;\n }\n\n const ToolboxItemClass = registry.getClass(\n registry.Type.TOOLBOX_ITEM, registryName.toLowerCase());\n if (ToolboxItemClass) {\n const toolboxItem = new ToolboxItemClass(toolboxItemDef, this);\n toolboxItem.init();\n this.addToolboxItem_(toolboxItem);\n const toolboxItemDom = toolboxItem.getDiv();\n if (toolboxItemDom) {\n fragment.appendChild(toolboxItemDom);\n }\n // Adds the ID to the HTML element that can receive a click.\n // This is used in onClick_ to find the toolboxItem that was clicked.\n if (toolboxItem.getClickTarget()) {\n toolboxItem.getClickTarget()!.setAttribute('id', toolboxItem.getId());\n }\n }\n }\n\n /**\n * Adds an item to the toolbox.\n *\n * @param toolboxItem The item in the toolbox.\n */\n protected addToolboxItem_(toolboxItem: IToolboxItem) {\n this.contents_.push(toolboxItem);\n this.contentMap_[toolboxItem.getId()] = toolboxItem;\n if (toolboxItem.isCollapsible()) {\n const collapsibleItem = toolboxItem as ICollapsibleToolboxItem;\n const childToolboxItems = collapsibleItem.getChildToolboxItems();\n for (let i = 0; i < childToolboxItems.length; i++) {\n const child = childToolboxItems[i];\n this.addToolboxItem_(child);\n }\n }\n }\n\n /**\n * Gets the items in the toolbox.\n *\n * @returns The list of items in the toolbox.\n */\n getToolboxItems(): IToolboxItem[] {\n return this.contents_;\n }\n\n /**\n * Adds a style on the toolbox. Usually used to change the cursor.\n *\n * @param style The name of the class to add.\n * @internal\n */\n addStyle(style: string) {\n if (style && this.HtmlDiv) {\n dom.addClass(this.HtmlDiv, style);\n }\n }\n\n /**\n * Removes a style from the toolbox. Usually used to change the cursor.\n *\n * @param style The name of the class to remove.\n * @internal\n */\n removeStyle(style: string) {\n if (style && this.HtmlDiv) {\n dom.removeClass(this.HtmlDiv, style);\n }\n }\n\n /**\n * Returns the bounding rectangle of the drag target area in pixel units\n * relative to viewport.\n *\n * @returns The component's bounding box. Null if drag target area should be\n * ignored.\n */\n override getClientRect(): Rect|null {\n if (!this.HtmlDiv || !this.isVisible_) {\n return null;\n }\n // BIG_NUM is offscreen padding so that blocks dragged beyond the toolbox\n // area are still deleted. Must be smaller than Infinity, but larger than\n // the largest screen size.\n const BIG_NUM = 10000000;\n const toolboxRect = this.HtmlDiv.getBoundingClientRect();\n\n const top = toolboxRect.top;\n const bottom = top + toolboxRect.height;\n const left = toolboxRect.left;\n const right = left + toolboxRect.width;\n\n // Assumes that the toolbox is on the SVG edge. If this changes\n // (e.g. toolboxes in mutators) then this code will need to be more complex.\n if (this.toolboxPosition === toolbox.Position.TOP) {\n return new Rect(-BIG_NUM, bottom, -BIG_NUM, BIG_NUM);\n } else if (this.toolboxPosition === toolbox.Position.BOTTOM) {\n return new Rect(top, BIG_NUM, -BIG_NUM, BIG_NUM);\n } else if (this.toolboxPosition === toolbox.Position.LEFT) {\n return new Rect(-BIG_NUM, BIG_NUM, -BIG_NUM, right);\n } else { // Right\n return new Rect(-BIG_NUM, BIG_NUM, left, BIG_NUM);\n }\n }\n\n /**\n * Returns whether the provided block or bubble would be deleted if dropped on\n * this area.\n * This method should check if the element is deletable and is always called\n * before onDragEnter/onDragOver/onDragExit.\n *\n * @param element The block or bubble currently being dragged.\n * @param _couldConnect Whether the element could could connect to another.\n * @returns Whether the element provided would be deleted if dropped on this\n * area.\n */\n override wouldDelete(element: IDraggable, _couldConnect: boolean): boolean {\n if (element instanceof BlockSvg) {\n const block = (element);\n // Prefer dragging to the toolbox over connecting to other blocks.\n this.updateWouldDelete_(!block.getParent() && block.isDeletable());\n } else {\n this.updateWouldDelete_(element.isDeletable());\n }\n return this.wouldDelete_;\n }\n\n /**\n * Handles when a cursor with a block or bubble enters this drag target.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n override onDragEnter(_dragElement: IDraggable) {\n this.updateCursorDeleteStyle_(true);\n }\n\n /**\n * Handles when a cursor with a block or bubble exits this drag target.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n override onDragExit(_dragElement: IDraggable) {\n this.updateCursorDeleteStyle_(false);\n }\n\n /**\n * Handles when a block or bubble is dropped on this component.\n * Should not handle delete here.\n *\n * @param _dragElement The block or bubble currently being dragged.\n */\n override onDrop(_dragElement: IDraggable) {\n this.updateCursorDeleteStyle_(false);\n }\n\n /**\n * Updates the internal wouldDelete_ state.\n *\n * @param wouldDelete The new value for the wouldDelete state.\n */\n protected override updateWouldDelete_(wouldDelete: boolean) {\n if (wouldDelete === this.wouldDelete_) {\n return;\n }\n // This logic handles updating the deleteStyle properly if the delete state\n // changes while the block is over the Toolbox. This could happen if the\n // implementation of wouldDeleteBlock depends on the couldConnect parameter\n // or if the isDeletable property of the block currently being dragged\n // changes during the drag.\n this.updateCursorDeleteStyle_(false);\n this.wouldDelete_ = wouldDelete;\n this.updateCursorDeleteStyle_(true);\n }\n\n /**\n * Adds or removes the CSS style of the cursor over the toolbox based whether\n * the block or bubble over it is expected to be deleted if dropped (using the\n * internal this.wouldDelete_ property).\n *\n * @param addStyle Whether the style should be added or removed.\n */\n protected updateCursorDeleteStyle_(addStyle: boolean) {\n const style =\n this.wouldDelete_ ? 'blocklyToolboxDelete' : 'blocklyToolboxGrab';\n if (addStyle) {\n this.addStyle(style);\n } else {\n this.removeStyle(style);\n }\n }\n\n /**\n * Gets the toolbox item with the given ID.\n *\n * @param id The ID of the toolbox item.\n * @returns The toolbox item with the given ID, or null if no item exists.\n */\n getToolboxItemById(id: string): IToolboxItem|null {\n return this.contentMap_[id] || null;\n }\n\n /**\n * Gets the width of the toolbox.\n *\n * @returns The width of the toolbox.\n */\n getWidth(): number {\n return this.width_;\n }\n\n /**\n * Gets the height of the toolbox.\n *\n * @returns The width of the toolbox.\n */\n getHeight(): number {\n return this.height_;\n }\n\n /**\n * Gets the toolbox flyout.\n *\n * @returns The toolbox flyout.\n */\n getFlyout(): IFlyout|null {\n return this.flyout_;\n }\n\n /**\n * Gets the workspace for the toolbox.\n *\n * @returns The parent workspace for the toolbox.\n */\n getWorkspace(): WorkspaceSvg {\n return this.workspace_;\n }\n\n /**\n * Gets the selected item.\n *\n * @returns The selected item, or null if no item is currently selected.\n */\n getSelectedItem(): ISelectableToolboxItem|null {\n return this.selectedItem_;\n }\n\n /**\n * Gets the previously selected item.\n *\n * @returns The previously selected item, or null if no item was previously\n * selected.\n */\n getPreviouslySelectedItem(): ISelectableToolboxItem|null {\n return this.previouslySelectedItem_;\n }\n\n /**\n * Gets whether or not the toolbox is horizontal.\n *\n * @returns True if the toolbox is horizontal, false if the toolbox is\n * vertical.\n */\n isHorizontal(): boolean {\n return this.horizontalLayout_;\n }\n\n /**\n * Positions the toolbox based on whether it is a horizontal toolbox and\n * whether the workspace is in rtl.\n */\n position() {\n const workspaceMetrics = this.workspace_.getMetrics();\n const toolboxDiv = this.HtmlDiv;\n if (!toolboxDiv) {\n // Not initialized yet.\n return;\n }\n\n if (this.horizontalLayout_) {\n toolboxDiv.style.left = '0';\n toolboxDiv.style.height = 'auto';\n toolboxDiv.style.width = '100%';\n this.height_ = toolboxDiv.offsetHeight;\n this.width_ = workspaceMetrics.viewWidth;\n if (this.toolboxPosition === toolbox.Position.TOP) {\n toolboxDiv.style.top = '0';\n } else { // Bottom\n toolboxDiv.style.bottom = '0';\n }\n } else {\n if (this.toolboxPosition === toolbox.Position.RIGHT) {\n toolboxDiv.style.right = '0';\n } else { // Left\n toolboxDiv.style.left = '0';\n }\n toolboxDiv.style.height = '100%';\n this.width_ = toolboxDiv.offsetWidth;\n this.height_ = workspaceMetrics.viewHeight;\n }\n this.flyout_!.position();\n }\n\n /**\n * Handles resizing the toolbox when a toolbox item resizes.\n *\n * @internal\n */\n handleToolboxItemResize() {\n // Reposition the workspace so that (0,0) is in the correct position\n // relative to the new absolute edge (ie toolbox edge).\n const workspace = this.workspace_;\n const rect = this.HtmlDiv!.getBoundingClientRect();\n const newX = this.toolboxPosition === toolbox.Position.LEFT ?\n workspace.scrollX + rect.width :\n workspace.scrollX;\n const newY = this.toolboxPosition === toolbox.Position.TOP ?\n workspace.scrollY + rect.height :\n workspace.scrollY;\n workspace.translate(newX, newY);\n\n // Even though the div hasn't changed size, the visible workspace\n // surface of the workspace has, so we may need to reposition everything.\n common.svgResize(workspace);\n }\n\n /** Unhighlights any previously selected item. */\n clearSelection() {\n this.setSelectedItem(null);\n }\n\n /**\n * Updates the category colours and background colour of selected categories.\n *\n * @internal\n */\n refreshTheme() {\n for (let i = 0; i < this.contents_.length; i++) {\n const child = this.contents_[i];\n // TODO(#6097): Fix types or add refreshTheme to IToolboxItem.\n const childAsCategory = child as ToolboxCategory;\n if (childAsCategory.refreshTheme) {\n childAsCategory.refreshTheme();\n }\n }\n }\n\n /**\n * Updates the flyout's content without closing it. Should be used in\n * response to a change in one of the dynamic categories, such as variables or\n * procedures.\n */\n refreshSelection() {\n if (this.selectedItem_ && this.selectedItem_.isSelectable() &&\n this.selectedItem_.getContents().length) {\n this.flyout_!.show(this.selectedItem_.getContents());\n }\n }\n\n /**\n * Shows or hides the toolbox.\n *\n * @param isVisible True if toolbox should be visible.\n */\n setVisible(isVisible: boolean) {\n if (this.isVisible_ === isVisible) {\n return;\n }\n\n this.HtmlDiv!.style.display = isVisible ? 'block' : 'none';\n this.isVisible_ = isVisible;\n // Invisible toolbox is ignored as drag targets and must have the drag\n // target updated.\n this.workspace_.recordDragTargets();\n }\n\n /**\n * Hides the component. Called in WorkspaceSvg.hideChaff.\n *\n * @param onlyClosePopups Whether only popups should be closed.\n * Flyouts should not be closed if this is true.\n */\n autoHide(onlyClosePopups: boolean) {\n if (!onlyClosePopups && this.flyout_ && this.flyout_.autoClose) {\n this.clearSelection();\n }\n }\n\n /**\n * Sets the given item as selected.\n * No-op if the item is not selectable.\n *\n * @param newItem The toolbox item to select.\n */\n setSelectedItem(newItem: IToolboxItem|null) {\n const oldItem = this.selectedItem_;\n\n if (!newItem && !oldItem || newItem && !newItem.isSelectable()) {\n return;\n }\n newItem = newItem as ISelectableToolboxItem;\n\n // AnyDuringMigration because: Argument of type 'IToolboxItem' is not\n // assignable to parameter of type 'ISelectableToolboxItem'.\n if (this.shouldDeselectItem_(oldItem, newItem as AnyDuringMigration) &&\n oldItem !== null) {\n this.deselectItem_(oldItem);\n }\n\n // AnyDuringMigration because: Argument of type 'IToolboxItem' is not\n // assignable to parameter of type 'ISelectableToolboxItem'.\n if (this.shouldSelectItem_(oldItem, newItem as AnyDuringMigration) &&\n newItem !== null) {\n // AnyDuringMigration because: Argument of type 'IToolboxItem' is not\n // assignable to parameter of type 'ISelectableToolboxItem'.\n this.selectItem_(oldItem, newItem as AnyDuringMigration);\n }\n\n // AnyDuringMigration because: Argument of type 'IToolboxItem' is not\n // assignable to parameter of type 'ISelectableToolboxItem'.\n this.updateFlyout_(oldItem, newItem as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'IToolboxItem' is not\n // assignable to parameter of type 'ISelectableToolboxItem'.\n this.fireSelectEvent_(oldItem, newItem as AnyDuringMigration);\n }\n\n /**\n * Decides whether the old item should be deselected.\n *\n * @param oldItem The previously selected toolbox item.\n * @param newItem The newly selected toolbox item.\n * @returns True if the old item should be deselected, false otherwise.\n */\n protected shouldDeselectItem_(\n oldItem: ISelectableToolboxItem|null,\n newItem: ISelectableToolboxItem|null): boolean {\n // Deselect the old item unless the old item is collapsible and has been\n // previously clicked on.\n return oldItem !== null &&\n (!oldItem.isCollapsible() || oldItem !== newItem);\n }\n\n /**\n * Decides whether the new item should be selected.\n *\n * @param oldItem The previously selected toolbox item.\n * @param newItem The newly selected toolbox item.\n * @returns True if the new item should be selected, false otherwise.\n */\n protected shouldSelectItem_(\n oldItem: ISelectableToolboxItem|null,\n newItem: ISelectableToolboxItem|null): boolean {\n // Select the new item unless the old item equals the new item.\n return newItem !== null && newItem !== oldItem;\n }\n\n /**\n * Deselects the given item, marks it as unselected, and updates aria state.\n *\n * @param item The previously selected toolbox item which should be\n * deselected.\n */\n protected deselectItem_(item: ISelectableToolboxItem) {\n this.selectedItem_ = null;\n this.previouslySelectedItem_ = item;\n item.setSelected(false);\n aria.setState(\n this.contentsDiv_ as Element, aria.State.ACTIVEDESCENDANT, '');\n }\n\n /**\n * Selects the given item, marks it selected, and updates aria state.\n *\n * @param oldItem The previously selected toolbox item.\n * @param newItem The newly selected toolbox item.\n */\n protected selectItem_(\n oldItem: ISelectableToolboxItem|null, newItem: ISelectableToolboxItem) {\n this.selectedItem_ = newItem;\n this.previouslySelectedItem_ = oldItem;\n newItem.setSelected(true);\n aria.setState(\n this.contentsDiv_ as Element, aria.State.ACTIVEDESCENDANT,\n newItem.getId());\n }\n\n /**\n * Selects the toolbox item by its position in the list of toolbox items.\n *\n * @param position The position of the item to select.\n */\n selectItemByPosition(position: number) {\n if (position > -1 && position < this.contents_.length) {\n const item = this.contents_[position];\n if (item.isSelectable()) {\n this.setSelectedItem(item);\n }\n }\n }\n\n /**\n * Decides whether to hide or show the flyout depending on the selected item.\n *\n * @param oldItem The previously selected toolbox item.\n * @param newItem The newly selected toolbox item.\n */\n protected updateFlyout_(\n oldItem: ISelectableToolboxItem|null,\n newItem: ISelectableToolboxItem|null) {\n if (!newItem || oldItem === newItem && !newItem.isCollapsible() ||\n !newItem.getContents().length) {\n this.flyout_!.hide();\n } else {\n this.flyout_!.show(newItem.getContents());\n this.flyout_!.scrollToStart();\n }\n }\n\n /**\n * Emits an event when a new toolbox item is selected.\n *\n * @param oldItem The previously selected toolbox item.\n * @param newItem The newly selected toolbox item.\n */\n private fireSelectEvent_(\n oldItem: ISelectableToolboxItem|null,\n newItem: ISelectableToolboxItem|null) {\n const oldElement = oldItem && oldItem.getName();\n let newElement = newItem && newItem.getName();\n // In this case the toolbox closes, so the newElement should be null.\n if (oldItem === newItem) {\n newElement = null;\n }\n const event = new (eventUtils.get(eventUtils.TOOLBOX_ITEM_SELECT))(\n oldElement, newElement, this.workspace_.id);\n eventUtils.fire(event);\n }\n\n /**\n * Closes the current item if it is expanded, or selects the parent.\n *\n * @returns True if a parent category was selected, false otherwise.\n */\n private selectParent_(): boolean {\n if (!this.selectedItem_) {\n return false;\n }\n\n if (this.selectedItem_.isCollapsible() &&\n (this.selectedItem_ as ICollapsibleToolboxItem).isExpanded()) {\n const collapsibleItem = this.selectedItem_ as ICollapsibleToolboxItem;\n collapsibleItem.toggleExpanded();\n return true;\n } else if (\n this.selectedItem_.getParent() &&\n this.selectedItem_.getParent()!.isSelectable()) {\n this.setSelectedItem(this.selectedItem_.getParent());\n return true;\n }\n return false;\n }\n\n /**\n * Selects the first child of the currently selected item, or nothing if the\n * toolbox item has no children.\n *\n * @returns True if a child category was selected, false otherwise.\n */\n private selectChild_(): boolean {\n if (!this.selectedItem_ || !this.selectedItem_.isCollapsible()) {\n return false;\n }\n const collapsibleItem = this.selectedItem_ as ICollapsibleToolboxItem;\n if (!collapsibleItem.isExpanded()) {\n collapsibleItem.toggleExpanded();\n return true;\n } else {\n this.selectNext_();\n return true;\n }\n }\n\n /**\n * Selects the next visible toolbox item.\n *\n * @returns True if a next category was selected, false otherwise.\n */\n private selectNext_(): boolean {\n if (!this.selectedItem_) {\n return false;\n }\n\n let nextItemIdx = this.contents_.indexOf(this.selectedItem_) + 1;\n if (nextItemIdx > -1 && nextItemIdx < this.contents_.length) {\n let nextItem = this.contents_[nextItemIdx];\n while (nextItem && !nextItem.isSelectable()) {\n nextItem = this.contents_[++nextItemIdx];\n }\n if (nextItem && nextItem.isSelectable()) {\n this.setSelectedItem(nextItem);\n return true;\n }\n }\n return false;\n }\n\n /**\n * Selects the previous visible toolbox item.\n *\n * @returns True if a previous category was selected, false otherwise.\n */\n private selectPrevious_(): boolean {\n if (!this.selectedItem_) {\n return false;\n }\n\n let prevItemIdx = this.contents_.indexOf(this.selectedItem_) - 1;\n if (prevItemIdx > -1 && prevItemIdx < this.contents_.length) {\n let prevItem = this.contents_[prevItemIdx];\n while (prevItem && !prevItem.isSelectable()) {\n prevItem = this.contents_[--prevItemIdx];\n }\n if (prevItem && prevItem.isSelectable()) {\n this.setSelectedItem(prevItem);\n return true;\n }\n }\n return false;\n }\n\n /** Disposes of this toolbox. */\n dispose() {\n this.workspace_.getComponentManager().removeComponent('toolbox');\n this.flyout_!.dispose();\n for (let i = 0; i < this.contents_.length; i++) {\n const toolboxItem = this.contents_[i];\n toolboxItem.dispose();\n }\n\n for (let j = 0; j < this.boundEvents_.length; j++) {\n browserEvents.unbind(this.boundEvents_[j]);\n }\n this.boundEvents_ = [];\n this.contents_ = [];\n\n // AnyDuringMigration because: Argument of type 'HTMLDivElement | null' is\n // not assignable to parameter of type 'Element'.\n this.workspace_.getThemeManager().unsubscribe(\n this.HtmlDiv as AnyDuringMigration);\n dom.removeNode(this.HtmlDiv);\n }\n}\n\n/** CSS for Toolbox. See css.js for use. */\nCss.register(`\n.blocklyToolboxDelete {\n cursor: url(\"<<<PATH>>>/handdelete.cur\"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url(\"<<<PATH>>>/handclosed.cur\"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolboxDiv {\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxContents {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxContents:focus {\n outline: none;\n}\n`);\n\nregistry.register(registry.Type.TOOLBOX, registry.DEFAULT, Toolbox);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Zelos theme.\n *\n * @namespace Blockly.Themes.Zelos\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Themes.Zelos');\n\nimport {Theme} from '../theme.js';\n\n\nconst defaultBlockStyles = {\n 'colour_blocks': {\n 'colourPrimary': '#CF63CF',\n 'colourSecondary': '#C94FC9',\n 'colourTertiary': '#BD42BD',\n },\n 'list_blocks': {\n 'colourPrimary': '#9966FF',\n 'colourSecondary': '#855CD6',\n 'colourTertiary': '#774DCB',\n },\n 'logic_blocks': {\n 'colourPrimary': '#4C97FF',\n 'colourSecondary': '#4280D7',\n 'colourTertiary': '#3373CC',\n },\n 'loop_blocks': {\n 'colourPrimary': '#0fBD8C',\n 'colourSecondary': '#0DA57A',\n 'colourTertiary': '#0B8E69',\n },\n 'math_blocks': {\n 'colourPrimary': '#59C059',\n 'colourSecondary': '#46B946',\n 'colourTertiary': '#389438',\n },\n 'procedure_blocks': {\n 'colourPrimary': '#FF6680',\n 'colourSecondary': '#FF4D6A',\n 'colourTertiary': '#FF3355',\n },\n 'text_blocks': {\n 'colourPrimary': '#FFBF00',\n 'colourSecondary': '#E6AC00',\n 'colourTertiary': '#CC9900',\n },\n 'variable_blocks': {\n 'colourPrimary': '#FF8C1A',\n 'colourSecondary': '#FF8000',\n 'colourTertiary': '#DB6E00',\n },\n 'variable_dynamic_blocks': {\n 'colourPrimary': '#FF8C1A',\n 'colourSecondary': '#FF8000',\n 'colourTertiary': '#DB6E00',\n },\n 'hat_blocks': {\n 'colourPrimary': '#4C97FF',\n 'colourSecondary': '#4280D7',\n 'colourTertiary': '#3373CC',\n 'hat': 'cap',\n },\n};\n\nconst categoryStyles = {\n 'colour_category': {'colour': '#CF63CF'},\n 'list_category': {'colour': '#9966FF'},\n 'logic_category': {'colour': '#4C97FF'},\n 'loop_category': {'colour': '#0fBD8C'},\n 'math_category': {'colour': '#59C059'},\n 'procedure_category': {'colour': '#FF6680'},\n 'text_category': {'colour': '#FFBF00'},\n 'variable_category': {'colour': '#FF8C1A'},\n 'variable_dynamic_category': {'colour': '#FF8C1A'},\n};\n\n/**\n * Zelos theme.\n *\n * @alias Blockly.Themes.Zelos\n */\nexport const Zelos = new Theme('zelos', defaultBlockStyles, categoryStyles);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Namespace for themes.\n *\n * @namespace Blockly.Themes\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Themes');\n\nimport {Classic} from './classic.js';\nimport {Zelos} from './zelos.js';\n\n\nexport {Classic, Zelos};\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of UI click in Blockly's editor.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.Click');\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport {AbstractEventJson} from './events_abstract.js';\n\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a click event.\n *\n * @alias Blockly.Events.Click\n */\nexport class Click extends UiBase {\n blockId?: string;\n targetType?: ClickTarget;\n override type = eventUtils.CLICK;\n\n /**\n * @param opt_block The affected block. Null for click events that do not have\n * an associated block (i.e. workspace click). Undefined for a blank\n * event.\n * @param opt_workspaceId The workspace identifier for this event.\n * Not used if block is passed. Undefined for a blank event.\n * @param opt_targetType The type of element targeted by this click event.\n * Undefined for a blank event.\n */\n constructor(\n opt_block?: Block|null, opt_workspaceId?: string|null,\n opt_targetType?: ClickTarget) {\n let workspaceId = opt_block ? opt_block.workspace.id : opt_workspaceId;\n if (workspaceId === null) {\n workspaceId = undefined;\n }\n super(workspaceId);\n\n this.blockId = opt_block ? opt_block.id : undefined;\n\n /** The type of element targeted by this click event. */\n this.targetType = opt_targetType;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): ClickJson {\n const json = super.toJson() as ClickJson;\n if (!this.targetType) {\n throw new Error(\n 'The click target type is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n json['targetType'] = this.targetType;\n json['blockId'] = this.blockId;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: ClickJson) {\n super.fromJson(json);\n this.targetType = json['targetType'];\n this.blockId = json['blockId'];\n }\n}\n\nexport enum ClickTarget {\n BLOCK = 'block',\n WORKSPACE = 'workspace',\n ZOOM_CONTROLS = 'zoom_controls',\n}\n\nexport interface ClickJson extends AbstractEventJson {\n targetType: ClickTarget;\n blockId?: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.CLICK, Click);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for dragging a bubble visually.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.BubbleDragger');\n\nimport type {BlockDragSurfaceSvg} from './block_drag_surface.js';\nimport {ComponentManager} from './component_manager.js';\nimport type {CommentMove} from './events/events_comment_move.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IBubble} from './interfaces/i_bubble.js';\nimport type {IDeleteArea} from './interfaces/i_delete_area.js';\nimport type {IDragTarget} from './interfaces/i_drag_target.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport {WorkspaceCommentSvg} from './workspace_comment_svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a bubble dragger. It moves things on the bubble canvas around the\n * workspace when they are being dragged by a mouse or touch. These can be\n * block comments, mutators, warnings, or workspace comments.\n *\n * @alias Blockly.BubbleDragger\n */\nexport class BubbleDragger {\n /** Which drag target the mouse pointer is over, if any. */\n private dragTarget_: IDragTarget|null = null;\n\n /** Whether the bubble would be deleted if dropped immediately. */\n private wouldDeleteBubble_ = false;\n private readonly startXY_: Coordinate;\n private dragSurface_: BlockDragSurfaceSvg|null;\n\n /**\n * @param bubble The item on the bubble canvas to drag.\n * @param workspace The workspace to drag on.\n */\n constructor(private bubble: IBubble, private workspace: WorkspaceSvg) {\n /**\n * The location of the top left corner of the dragging bubble's body at the\n * beginning of the drag, in workspace coordinates.\n */\n this.startXY_ = this.bubble.getRelativeToSurfaceXY();\n\n /**\n * The drag surface to move bubbles to during a drag, or null if none should\n * be used. Block dragging and bubble dragging use the same surface.\n */\n this.dragSurface_ = workspace.getBlockDragSurface();\n }\n\n /**\n * Start dragging a bubble. This includes moving it to the drag surface.\n *\n * @internal\n */\n startBubbleDrag() {\n if (!eventUtils.getGroup()) {\n eventUtils.setGroup(true);\n }\n\n this.workspace.setResizesEnabled(false);\n this.bubble.setAutoLayout(false);\n if (this.dragSurface_) {\n this.bubble.moveTo(0, 0);\n this.dragSurface_.translateSurface(this.startXY_.x, this.startXY_.y);\n // Execute the move on the top-level SVG component.\n this.dragSurface_.setBlocksAndShow(this.bubble.getSvgRoot());\n }\n\n this.bubble.setDragging && this.bubble.setDragging(true);\n }\n\n /**\n * Execute a step of bubble dragging, based on the given event. Update the\n * display accordingly.\n *\n * @param e The most recent move event.\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at the start of the drag, in pixel units.\n * @internal\n */\n dragBubble(e: Event, currentDragDeltaXY: Coordinate) {\n const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY);\n const newLoc = Coordinate.sum(this.startXY_, delta);\n this.bubble.moveDuringDrag(this.dragSurface_, newLoc);\n\n const oldDragTarget = this.dragTarget_;\n this.dragTarget_ = this.workspace.getDragTarget(e);\n\n const oldWouldDeleteBubble = this.wouldDeleteBubble_;\n this.wouldDeleteBubble_ = this.shouldDelete_(this.dragTarget_);\n if (oldWouldDeleteBubble !== this.wouldDeleteBubble_) {\n // Prevent unnecessary add/remove class calls.\n this.updateCursorDuringBubbleDrag_();\n }\n // Call drag enter/exit/over after wouldDeleteBlock is called in\n // shouldDelete_\n if (this.dragTarget_ !== oldDragTarget) {\n oldDragTarget && oldDragTarget.onDragExit(this.bubble);\n this.dragTarget_ && this.dragTarget_.onDragEnter(this.bubble);\n }\n this.dragTarget_ && this.dragTarget_.onDragOver(this.bubble);\n }\n\n /**\n * Whether ending the drag would delete the bubble.\n *\n * @param dragTarget The drag target that the bubblee is currently over.\n * @returns Whether dropping the bubble immediately would delete the block.\n */\n private shouldDelete_(dragTarget: IDragTarget|null): boolean {\n if (dragTarget) {\n const componentManager = this.workspace.getComponentManager();\n const isDeleteArea = componentManager.hasCapability(\n dragTarget.id, ComponentManager.Capability.DELETE_AREA);\n if (isDeleteArea) {\n return (dragTarget as IDeleteArea).wouldDelete(this.bubble, false);\n }\n }\n return false;\n }\n\n /**\n * Update the cursor (and possibly the trash can lid) to reflect whether the\n * dragging bubble would be deleted if released immediately.\n */\n private updateCursorDuringBubbleDrag_() {\n this.bubble.setDeleteStyle(this.wouldDeleteBubble_);\n }\n\n /**\n * Finish a bubble drag and put the bubble back on the workspace.\n *\n * @param e The mouseup/touchend event.\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at the start of the drag, in pixel units.\n * @internal\n */\n endBubbleDrag(e: Event, currentDragDeltaXY: Coordinate) {\n // Make sure internal state is fresh.\n this.dragBubble(e, currentDragDeltaXY);\n\n const preventMove =\n this.dragTarget_ && this.dragTarget_.shouldPreventMove(this.bubble);\n let newLoc;\n if (preventMove) {\n newLoc = this.startXY_;\n } else {\n const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY);\n newLoc = Coordinate.sum(this.startXY_, delta);\n }\n // Move the bubble to its final location.\n this.bubble.moveTo(newLoc.x, newLoc.y);\n\n if (this.dragTarget_) {\n this.dragTarget_.onDrop(this.bubble);\n }\n\n if (this.wouldDeleteBubble_) {\n // Fire a move event, so we know where to go back to for an undo.\n this.fireMoveEvent_();\n this.bubble.dispose();\n } else {\n // Put everything back onto the bubble canvas.\n if (this.dragSurface_) {\n this.dragSurface_.clearAndHide(this.workspace.getBubbleCanvas());\n }\n if (this.bubble.setDragging) {\n this.bubble.setDragging(false);\n }\n this.fireMoveEvent_();\n }\n this.workspace.setResizesEnabled(true);\n\n eventUtils.setGroup(false);\n }\n\n /** Fire a move event at the end of a bubble drag. */\n private fireMoveEvent_() {\n if (this.bubble instanceof WorkspaceCommentSvg) {\n const event = new (eventUtils.get(eventUtils.COMMENT_MOVE))(\n this.bubble) as CommentMove;\n event.setOldCoordinate(this.startXY_);\n event.recordNew();\n eventUtils.fire(event);\n }\n // TODO (fenichel): move events for comments.\n return;\n }\n\n /**\n * Convert a coordinate object from pixels to workspace units, including a\n * correction for mutator workspaces.\n * This function does not consider differing origins. It simply scales the\n * input's x and y values.\n *\n * @param pixelCoord A coordinate with x and y values in CSS pixel units.\n * @returns The input coordinate divided by the workspace scale.\n */\n private pixelsToWorkspaceUnits_(pixelCoord: Coordinate): Coordinate {\n const result = new Coordinate(\n pixelCoord.x / this.workspace.scale,\n pixelCoord.y / this.workspace.scale);\n if (this.workspace.isMutator) {\n // If we're in a mutator, its scale is always 1, purely because of some\n // oddities in our rendering optimizations. The actual scale is the same\n // as the scale on the parent workspace. Fix that for dragging.\n const mainScale = this.workspace.options.parentWorkspace!.scale;\n result.scale(1 / mainScale);\n }\n return result;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for dragging a workspace visually.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.WorkspaceDragger');\n\nimport * as common from './common.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a workspace dragger. It moves the workspace around when it is\n * being dragged by a mouse or touch.\n * Note that the workspace itself manages whether or not it has a drag surface\n * and how to do translations based on that. This simply passes the right\n * commands based on events.\n *\n * @alias Blockly.WorkspaceDragger\n */\nexport class WorkspaceDragger {\n private readonly horizontalScrollEnabled_: boolean;\n private readonly verticalScrollEnabled_: boolean;\n protected startScrollXY_: Coordinate;\n\n /** @param workspace The workspace to drag. */\n constructor(private workspace: WorkspaceSvg) {\n /** Whether horizontal scroll is enabled. */\n this.horizontalScrollEnabled_ = this.workspace.isMovableHorizontally();\n\n /** Whether vertical scroll is enabled. */\n this.verticalScrollEnabled_ = this.workspace.isMovableVertically();\n\n /**\n * The scroll position of the workspace at the beginning of the drag.\n * Coordinate system: pixel coordinates.\n */\n this.startScrollXY_ = new Coordinate(workspace.scrollX, workspace.scrollY);\n }\n\n /**\n * Sever all links from this object.\n *\n * @suppress {checkTypes}\n * @internal\n */\n dispose() {\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'WorkspaceSvg'.\n this.workspace = null as AnyDuringMigration;\n }\n\n /**\n * Start dragging the workspace.\n *\n * @internal\n */\n startDrag() {\n if (common.getSelected()) {\n common.getSelected()!.unselect();\n }\n this.workspace.setupDragSurface();\n }\n\n /**\n * Finish dragging the workspace and put everything back where it belongs.\n *\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at the start of the drag, in pixel coordinates.\n * @internal\n */\n endDrag(currentDragDeltaXY: Coordinate) {\n // Make sure everything is up to date.\n this.drag(currentDragDeltaXY);\n this.workspace.resetDragSurface();\n }\n\n /**\n * Move the workspace based on the most recent mouse movements.\n *\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at the start of the drag, in pixel coordinates.\n * @internal\n */\n drag(currentDragDeltaXY: Coordinate) {\n const newXY = Coordinate.sum(this.startScrollXY_, currentDragDeltaXY);\n\n if (this.horizontalScrollEnabled_ && this.verticalScrollEnabled_) {\n this.workspace.scroll(newXY.x, newXY.y);\n } else if (this.horizontalScrollEnabled_) {\n this.workspace.scroll(newXY.x, this.workspace.scrollY);\n } else if (this.verticalScrollEnabled_) {\n this.workspace.scroll(this.workspace.scrollX, newXY.y);\n } else {\n throw new TypeError('Invalid state.');\n }\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class representing an in-progress gesture, usually a drag\n * or a tap.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Gesture');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_click.js';\n\nimport * as blockAnimations from './block_animations.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport {BubbleDragger} from './bubble_dragger.js';\nimport * as common from './common.js';\nimport {config} from './config.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Field} from './field.js';\nimport type {IBlockDragger} from './interfaces/i_block_dragger.js';\nimport type {IBubble} from './interfaces/i_bubble.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport * as internalConstants from './internal_constants.js';\nimport * as registry from './registry.js';\nimport * as Tooltip from './tooltip.js';\nimport * as Touch from './touch.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport {WorkspaceCommentSvg} from './workspace_comment_svg.js';\nimport {WorkspaceDragger} from './workspace_dragger.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Note: In this file \"start\" refers to touchstart, mousedown, and pointerstart\n * events. \"End\" refers to touchend, mouseup, and pointerend events.\n */\n// TODO: Consider touchcancel/pointercancel.\n/**\n * Class for one gesture.\n *\n * @alias Blockly.Gesture\n */\nexport class Gesture {\n /**\n * The position of the mouse when the gesture started. Units are CSS\n * pixels, with (0, 0) at the top left of the browser window (mouseEvent\n * clientX/Y).\n */\n private mouseDownXY_ = new Coordinate(0, 0);\n private currentDragDeltaXY_: Coordinate;\n\n /**\n * The bubble that the gesture started on, or null if it did not start on a\n * bubble.\n */\n private startBubble_: IBubble|null = null;\n\n /**\n * The field that the gesture started on, or null if it did not start on a\n * field.\n */\n private startField_: Field|null = null;\n\n /**\n * The block that the gesture started on, or null if it did not start on a\n * block.\n */\n private startBlock_: BlockSvg|null = null;\n\n /**\n * The block that this gesture targets. If the gesture started on a\n * shadow block, this is the first non-shadow parent of the block. If the\n * gesture started in the flyout, this is the root block of the block group\n * that was clicked or dragged.\n */\n private targetBlock_: BlockSvg|null = null;\n\n /**\n * The workspace that the gesture started on. There may be multiple\n * workspaces on a page; this is more accurate than using\n * Blockly.common.getMainWorkspace().\n */\n protected startWorkspace_: WorkspaceSvg|null = null;\n\n /**\n * Whether the pointer has at any point moved out of the drag radius.\n * A gesture that exceeds the drag radius is a drag even if it ends exactly\n * at its start point.\n */\n private hasExceededDragRadius_ = false;\n\n /**\n * A handle to use to unbind a mouse move listener at the end of a drag.\n * Opaque data returned from Blockly.bindEventWithChecks_.\n */\n protected onMoveWrapper_: browserEvents.Data|null = null;\n\n /**\n * A handle to use to unbind a mouse up listener at the end of a drag.\n * Opaque data returned from Blockly.bindEventWithChecks_.\n */\n protected onUpWrapper_: browserEvents.Data|null = null;\n\n /** The object tracking a bubble drag, or null if none is in progress. */\n private bubbleDragger_: BubbleDragger|null = null;\n\n /** The object tracking a block drag, or null if none is in progress. */\n private blockDragger_: IBlockDragger|null = null;\n\n /**\n * The object tracking a workspace or flyout workspace drag, or null if none\n * is in progress.\n */\n private workspaceDragger_: WorkspaceDragger|null = null;\n\n /** The flyout a gesture started in, if any. */\n private flyout_: IFlyout|null = null;\n\n /** Boolean for sanity-checking that some code is only called once. */\n private calledUpdateIsDragging_ = false;\n\n /** Boolean for sanity-checking that some code is only called once. */\n private hasStarted_ = false;\n\n /** Boolean used internally to break a cycle in disposal. */\n protected isEnding_ = false;\n private healStack_: boolean;\n\n /** The event that most recently updated this gesture. */\n private mostRecentEvent_: Event;\n\n /**\n * @param e The event that kicked off this gesture.\n * @param creatorWorkspace The workspace that created this gesture and has a\n * reference to it.\n */\n constructor(e: Event, private readonly creatorWorkspace: WorkspaceSvg) {\n this.mostRecentEvent_ = e;\n\n /**\n * How far the mouse has moved during this drag, in pixel units.\n * (0, 0) is at this.mouseDownXY_.\n */\n this.currentDragDeltaXY_ = new Coordinate(0, 0);\n\n /**\n * Boolean used to indicate whether or not to heal the stack after\n * disconnecting a block.\n */\n this.healStack_ = !internalConstants.DRAG_STACK;\n }\n\n /**\n * Sever all links from this object.\n *\n * @internal\n */\n dispose() {\n Touch.clearTouchIdentifier();\n Tooltip.unblock();\n // Clear the owner's reference to this gesture.\n this.creatorWorkspace.clearGesture();\n\n if (this.onMoveWrapper_) {\n browserEvents.unbind(this.onMoveWrapper_);\n }\n if (this.onUpWrapper_) {\n browserEvents.unbind(this.onUpWrapper_);\n }\n\n if (this.blockDragger_) {\n this.blockDragger_.dispose();\n }\n if (this.workspaceDragger_) {\n this.workspaceDragger_.dispose();\n }\n }\n\n /**\n * Update internal state based on an event.\n *\n * @param e The most recent mouse or touch event.\n */\n private updateFromEvent_(e: Event) {\n // AnyDuringMigration because: Property 'clientY' does not exist on type\n // 'Event'. AnyDuringMigration because: Property 'clientX' does not exist\n // on type 'Event'.\n const currentXY = new Coordinate(\n (e as AnyDuringMigration).clientX, (e as AnyDuringMigration).clientY);\n const changed = this.updateDragDelta_(currentXY);\n // Exceeded the drag radius for the first time.\n if (changed) {\n this.updateIsDragging_();\n Touch.longStop();\n }\n this.mostRecentEvent_ = e;\n }\n\n /**\n * DO MATH to set currentDragDeltaXY_ based on the most recent mouse position.\n *\n * @param currentXY The most recent mouse/pointer position, in pixel units,\n * with (0, 0) at the window's top left corner.\n * @returns True if the drag just exceeded the drag radius for the first time.\n */\n private updateDragDelta_(currentXY: Coordinate): boolean {\n this.currentDragDeltaXY_ =\n Coordinate.difference(currentXY, (this.mouseDownXY_));\n\n if (!this.hasExceededDragRadius_) {\n const currentDragDelta = Coordinate.magnitude(this.currentDragDeltaXY_);\n\n // The flyout has a different drag radius from the rest of Blockly.\n const limitRadius =\n this.flyout_ ? config.flyoutDragRadius : config.dragRadius;\n\n this.hasExceededDragRadius_ = currentDragDelta > limitRadius;\n return this.hasExceededDragRadius_;\n }\n return false;\n }\n\n /**\n * Update this gesture to record whether a block is being dragged from the\n * flyout.\n * This function should be called on a mouse/touch move event the first time\n * the drag radius is exceeded. It should be called no more than once per\n * gesture. If a block should be dragged from the flyout this function creates\n * the new block on the main workspace and updates targetBlock_ and\n * startWorkspace_.\n *\n * @returns True if a block is being dragged from the flyout.\n */\n private updateIsDraggingFromFlyout_(): boolean {\n if (!this.targetBlock_ ||\n !this.flyout_?.isBlockCreatable(this.targetBlock_)) {\n return false;\n }\n if (!this.flyout_.targetWorkspace) {\n throw new Error(`Cannot update dragging from the flyout because the ' +\n 'flyout's target workspace is undefined`);\n }\n if (!this.flyout_.isScrollable() ||\n this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_)) {\n this.startWorkspace_ = this.flyout_.targetWorkspace;\n this.startWorkspace_.updateScreenCalculationsIfScrolled();\n // Start the event group now, so that the same event group is used for\n // block creation and block dragging.\n if (!eventUtils.getGroup()) {\n eventUtils.setGroup(true);\n }\n // The start block is no longer relevant, because this is a drag.\n this.startBlock_ = null;\n this.targetBlock_ = this.flyout_.createBlock(this.targetBlock_);\n this.targetBlock_.select();\n return true;\n }\n return false;\n }\n\n /**\n * Update this gesture to record whether a bubble is being dragged.\n * This function should be called on a mouse/touch move event the first time\n * the drag radius is exceeded. It should be called no more than once per\n * gesture. If a bubble should be dragged this function creates the necessary\n * BubbleDragger and starts the drag.\n *\n * @returns True if a bubble is being dragged.\n */\n private updateIsDraggingBubble_(): boolean {\n if (!this.startBubble_) {\n return false;\n }\n\n this.startDraggingBubble_();\n return true;\n }\n\n /**\n * Check whether to start a block drag. If a block should be dragged, either\n * from the flyout or in the workspace, create the necessary BlockDragger and\n * start the drag.\n *\n * This function should be called on a mouse/touch move event the first time\n * the drag radius is exceeded. It should be called no more than once per\n * gesture. If a block should be dragged, either from the flyout or in the\n * workspace, this function creates the necessary BlockDragger and starts the\n * drag.\n *\n * @returns True if a block is being dragged.\n */\n private updateIsDraggingBlock_(): boolean {\n if (!this.targetBlock_) {\n return false;\n }\n if (this.flyout_) {\n if (this.updateIsDraggingFromFlyout_()) {\n this.startDraggingBlock_();\n return true;\n }\n } else if (this.targetBlock_.isMovable()) {\n this.startDraggingBlock_();\n return true;\n }\n return false;\n }\n\n /**\n * Check whether to start a workspace drag. If a workspace is being dragged,\n * create the necessary WorkspaceDragger and start the drag.\n *\n * This function should be called on a mouse/touch move event the first time\n * the drag radius is exceeded. It should be called no more than once per\n * gesture. If a workspace is being dragged this function creates the\n * necessary WorkspaceDragger and starts the drag.\n */\n private updateIsDraggingWorkspace_() {\n if (!this.startWorkspace_) {\n throw new Error(\n 'Cannot update dragging the workspace because the ' +\n 'start workspace is undefined');\n }\n\n const wsMovable = this.flyout_ ?\n this.flyout_.isScrollable() :\n this.startWorkspace_ && this.startWorkspace_.isDraggable();\n if (!wsMovable) return;\n\n this.workspaceDragger_ = new WorkspaceDragger(this.startWorkspace_);\n\n this.workspaceDragger_.startDrag();\n }\n\n /**\n * Update this gesture to record whether anything is being dragged.\n * This function should be called on a mouse/touch move event the first time\n * the drag radius is exceeded. It should be called no more than once per\n * gesture.\n */\n private updateIsDragging_() {\n // Sanity check.\n if (this.calledUpdateIsDragging_) {\n throw Error('updateIsDragging_ should only be called once per gesture.');\n }\n this.calledUpdateIsDragging_ = true;\n\n // First check if it was a bubble drag. Bubbles always sit on top of\n // blocks.\n if (this.updateIsDraggingBubble_()) {\n return;\n }\n // Then check if it was a block drag.\n if (this.updateIsDraggingBlock_()) {\n return;\n }\n // Then check if it's a workspace drag.\n this.updateIsDraggingWorkspace_();\n }\n\n /** Create a block dragger and start dragging the selected block. */\n private startDraggingBlock_() {\n const BlockDraggerClass = registry.getClassFromOptions(\n registry.Type.BLOCK_DRAGGER, this.creatorWorkspace.options, true);\n\n this.blockDragger_ =\n new BlockDraggerClass!((this.targetBlock_), (this.startWorkspace_));\n this.blockDragger_!.startDrag(this.currentDragDeltaXY_, this.healStack_);\n this.blockDragger_!.drag(this.mostRecentEvent_, this.currentDragDeltaXY_);\n }\n\n // TODO (fenichel): Possibly combine this and startDraggingBlock_.\n /** Create a bubble dragger and start dragging the selected bubble. */\n private startDraggingBubble_() {\n if (!this.startBubble_) {\n throw new Error(\n 'Cannot update dragging the bubble because the start ' +\n 'bubble is undefined');\n }\n if (!this.startWorkspace_) {\n throw new Error(\n 'Cannot update dragging the bubble because the start ' +\n 'workspace is undefined');\n }\n\n this.bubbleDragger_ =\n new BubbleDragger(this.startBubble_, this.startWorkspace_);\n this.bubbleDragger_.startBubbleDrag();\n this.bubbleDragger_.dragBubble(\n this.mostRecentEvent_, this.currentDragDeltaXY_);\n }\n\n /**\n * Start a gesture: update the workspace to indicate that a gesture is in\n * progress and bind mousemove and mouseup handlers.\n *\n * @param e A mouse down or touch start event.\n * @internal\n */\n doStart(e: MouseEvent) {\n if (browserEvents.isTargetInput(e)) {\n this.cancel();\n return;\n }\n\n if (!this.startWorkspace_) {\n throw new Error(\n 'Cannot start the gesture because the start ' +\n 'workspace is undefined');\n }\n\n this.hasStarted_ = true;\n\n blockAnimations.disconnectUiStop();\n\n this.startWorkspace_.updateScreenCalculationsIfScrolled();\n if (this.startWorkspace_.isMutator) {\n // Mutator's coordinate system could be out of date because the bubble was\n // dragged, the block was moved, the parent workspace zoomed, etc.\n this.startWorkspace_.resize();\n }\n // Hide chaff also hides the flyout, so don't do it if the click is in a\n // flyout.\n this.startWorkspace_.hideChaff(!!this.flyout_);\n\n this.startWorkspace_.markFocused();\n this.mostRecentEvent_ = e;\n\n Tooltip.block();\n\n if (this.targetBlock_) {\n this.targetBlock_.select();\n }\n\n if (browserEvents.isRightButton(e)) {\n this.handleRightClick(e);\n return;\n }\n\n // TODO(#6097): Make types accurate, possibly by refactoring touch handling.\n const typelessEvent = e as AnyDuringMigration;\n if ((e.type.toLowerCase() === 'touchstart' ||\n e.type.toLowerCase() === 'pointerdown') &&\n typelessEvent.pointerType !== 'mouse') {\n Touch.longStart(typelessEvent, this);\n }\n\n // AnyDuringMigration because: Property 'clientY' does not exist on type\n // 'Event'. AnyDuringMigration because: Property 'clientX' does not exist\n // on type 'Event'.\n this.mouseDownXY_ = new Coordinate(\n (e as AnyDuringMigration).clientX, (e as AnyDuringMigration).clientY);\n // AnyDuringMigration because: Property 'metaKey' does not exist on type\n // 'Event'. AnyDuringMigration because: Property 'ctrlKey' does not exist\n // on type 'Event'. AnyDuringMigration because: Property 'altKey' does not\n // exist on type 'Event'.\n this.healStack_ = (e as AnyDuringMigration).altKey ||\n (e as AnyDuringMigration).ctrlKey || (e as AnyDuringMigration).metaKey;\n\n this.bindMouseEvents(e);\n }\n\n /**\n * Bind gesture events.\n *\n * @param e A mouse down or touch start event.\n * @internal\n */\n bindMouseEvents(e: Event) {\n this.onMoveWrapper_ = browserEvents.conditionalBind(\n document, 'mousemove', null, this.handleMove.bind(this));\n this.onUpWrapper_ = browserEvents.conditionalBind(\n document, 'mouseup', null, this.handleUp.bind(this));\n\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * Handle a mouse move or touch move event.\n *\n * @param e A mouse move or touch move event.\n * @internal\n */\n handleMove(e: Event) {\n this.updateFromEvent_(e);\n if (this.workspaceDragger_) {\n this.workspaceDragger_.drag(this.currentDragDeltaXY_);\n } else if (this.blockDragger_) {\n this.blockDragger_.drag(this.mostRecentEvent_, this.currentDragDeltaXY_);\n } else if (this.bubbleDragger_) {\n this.bubbleDragger_.dragBubble(\n this.mostRecentEvent_, this.currentDragDeltaXY_);\n }\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * Handle a mouse up or touch end event.\n *\n * @param e A mouse up or touch end event.\n * @internal\n */\n handleUp(e: Event) {\n this.updateFromEvent_(e);\n Touch.longStop();\n\n if (this.isEnding_) {\n console.log('Trying to end a gesture recursively.');\n return;\n }\n this.isEnding_ = true;\n // The ordering of these checks is important: drags have higher priority\n // than clicks. Fields have higher priority than blocks; blocks have higher\n // priority than workspaces.\n // The ordering within drags does not matter, because the three types of\n // dragging are exclusive.\n if (this.bubbleDragger_) {\n this.bubbleDragger_.endBubbleDrag(e, this.currentDragDeltaXY_);\n } else if (this.blockDragger_) {\n this.blockDragger_.endDrag(e, this.currentDragDeltaXY_);\n } else if (this.workspaceDragger_) {\n this.workspaceDragger_.endDrag(this.currentDragDeltaXY_);\n } else if (this.isBubbleClick_()) {\n // Bubbles are in front of all fields and blocks.\n this.doBubbleClick_();\n } else if (this.isFieldClick_()) {\n this.doFieldClick_();\n } else if (this.isBlockClick_()) {\n this.doBlockClick_();\n } else if (this.isWorkspaceClick_()) {\n this.doWorkspaceClick_(e);\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n this.dispose();\n }\n\n /**\n * Cancel an in-progress gesture. If a workspace or block drag is in\n * progress, end the drag at the most recent location.\n *\n * @internal\n */\n cancel() {\n // Disposing of a block cancels in-progress drags, but dragging to a delete\n // area disposes of a block and leads to recursive disposal. Break that\n // cycle.\n if (this.isEnding_) {\n return;\n }\n Touch.longStop();\n if (this.bubbleDragger_) {\n this.bubbleDragger_.endBubbleDrag(\n this.mostRecentEvent_, this.currentDragDeltaXY_);\n } else if (this.blockDragger_) {\n this.blockDragger_.endDrag(\n this.mostRecentEvent_, this.currentDragDeltaXY_);\n } else if (this.workspaceDragger_) {\n this.workspaceDragger_.endDrag(this.currentDragDeltaXY_);\n }\n this.dispose();\n }\n\n /**\n * Handle a real or faked right-click event by showing a context menu.\n *\n * @param e A mouse move or touch move event.\n * @internal\n */\n handleRightClick(e: Event) {\n if (this.targetBlock_) {\n this.bringBlockToFront_();\n this.targetBlock_.workspace.hideChaff(!!this.flyout_);\n this.targetBlock_.showContextMenu(e);\n } else if (this.startBubble_) {\n this.startBubble_.showContextMenu(e);\n } else if (this.startWorkspace_ && !this.flyout_) {\n this.startWorkspace_.hideChaff();\n this.startWorkspace_.showContextMenu(e);\n }\n\n // TODO: Handle right-click on a bubble.\n e.preventDefault();\n e.stopPropagation();\n\n this.dispose();\n }\n\n /**\n * Handle a mousedown/touchstart event on a workspace.\n *\n * @param e A mouse down or touch start event.\n * @param ws The workspace the event hit.\n * @internal\n */\n handleWsStart(e: MouseEvent, ws: WorkspaceSvg) {\n if (this.hasStarted_) {\n throw Error(\n 'Tried to call gesture.handleWsStart, ' +\n 'but the gesture had already been started.');\n }\n this.setStartWorkspace_(ws);\n this.mostRecentEvent_ = e;\n this.doStart(e);\n }\n\n /**\n * Fires a workspace click event.\n *\n * @param ws The workspace that a user clicks on.\n */\n private fireWorkspaceClick_(ws: WorkspaceSvg) {\n eventUtils.fire(\n new (eventUtils.get(eventUtils.CLICK))(null, ws.id, 'workspace'));\n }\n\n /**\n * Handle a mousedown/touchstart event on a flyout.\n *\n * @param e A mouse down or touch start event.\n * @param flyout The flyout the event hit.\n * @internal\n */\n handleFlyoutStart(e: MouseEvent, flyout: IFlyout) {\n if (this.hasStarted_) {\n throw Error(\n 'Tried to call gesture.handleFlyoutStart, ' +\n 'but the gesture had already been started.');\n }\n this.setStartFlyout_(flyout);\n this.handleWsStart(e, flyout.getWorkspace());\n }\n\n /**\n * Handle a mousedown/touchstart event on a block.\n *\n * @param e A mouse down or touch start event.\n * @param block The block the event hit.\n * @internal\n */\n handleBlockStart(e: Event, block: BlockSvg) {\n if (this.hasStarted_) {\n throw Error(\n 'Tried to call gesture.handleBlockStart, ' +\n 'but the gesture had already been started.');\n }\n this.setStartBlock(block);\n this.mostRecentEvent_ = e;\n }\n\n /**\n * Handle a mousedown/touchstart event on a bubble.\n *\n * @param e A mouse down or touch start event.\n * @param bubble The bubble the event hit.\n * @internal\n */\n handleBubbleStart(e: Event, bubble: IBubble) {\n if (this.hasStarted_) {\n throw Error(\n 'Tried to call gesture.handleBubbleStart, ' +\n 'but the gesture had already been started.');\n }\n this.setStartBubble(bubble);\n this.mostRecentEvent_ = e;\n }\n\n /* Begin functions defining what actions to take to execute clicks on each\n * type of target. Any developer wanting to add behaviour on clicks should\n * modify only this code. */\n\n /** Execute a bubble click. */\n private doBubbleClick_() {\n // TODO (#1673): Consistent handling of single clicks.\n if (this.startBubble_ instanceof WorkspaceCommentSvg) {\n this.startBubble_.setFocus();\n this.startBubble_.select();\n }\n }\n\n /** Execute a field click. */\n private doFieldClick_() {\n if (!this.startField_) {\n throw new Error(\n 'Cannot do a field click because the start field is ' +\n 'undefined');\n }\n this.startField_.showEditor(this.mostRecentEvent_);\n this.bringBlockToFront_();\n }\n\n /** Execute a block click. */\n private doBlockClick_() {\n // Block click in an autoclosing flyout.\n if (this.flyout_ && this.flyout_.autoClose) {\n if (!this.targetBlock_) {\n throw new Error(\n 'Cannot do a block click because the target block is ' +\n 'undefined');\n }\n if (this.targetBlock_.isEnabled()) {\n if (!eventUtils.getGroup()) {\n eventUtils.setGroup(true);\n }\n const newBlock = this.flyout_.createBlock(this.targetBlock_);\n newBlock.scheduleSnapAndBump();\n }\n } else {\n if (!this.startWorkspace_) {\n throw new Error(\n 'Cannot do a block click because the start workspace ' +\n 'is undefined');\n }\n // Clicks events are on the start block, even if it was a shadow.\n const event = new (eventUtils.get(eventUtils.CLICK))(\n this.startBlock_, this.startWorkspace_.id, 'block');\n eventUtils.fire(event);\n }\n this.bringBlockToFront_();\n eventUtils.setGroup(false);\n }\n\n /**\n * Execute a workspace click. When in accessibility mode shift clicking will\n * move the cursor.\n *\n * @param _e A mouse up or touch end event.\n */\n private doWorkspaceClick_(_e: Event) {\n const ws = this.creatorWorkspace;\n if (common.getSelected()) {\n common.getSelected()!.unselect();\n }\n this.fireWorkspaceClick_(this.startWorkspace_ || ws);\n }\n\n /* End functions defining what actions to take to execute clicks on each type\n * of target. */\n\n // TODO (fenichel): Move bubbles to the front.\n\n /**\n * Move the dragged/clicked block to the front of the workspace so that it is\n * not occluded by other blocks.\n */\n private bringBlockToFront_() {\n // Blocks in the flyout don't overlap, so skip the work.\n if (this.targetBlock_ && !this.flyout_) {\n this.targetBlock_.bringToFront();\n }\n }\n\n /* Begin functions for populating a gesture at mouse down. */\n\n /**\n * Record the field that a gesture started on.\n *\n * @param field The field the gesture started on.\n * @internal\n */\n setStartField(field: Field) {\n if (this.hasStarted_) {\n throw Error(\n 'Tried to call gesture.setStartField, ' +\n 'but the gesture had already been started.');\n }\n if (!this.startField_) {\n this.startField_ = field;\n }\n }\n\n /**\n * Record the bubble that a gesture started on\n *\n * @param bubble The bubble the gesture started on.\n * @internal\n */\n setStartBubble(bubble: IBubble) {\n if (!this.startBubble_) {\n this.startBubble_ = bubble;\n }\n }\n\n /**\n * Record the block that a gesture started on, and set the target block\n * appropriately.\n *\n * @param block The block the gesture started on.\n * @internal\n */\n setStartBlock(block: BlockSvg) {\n // If the gesture already went through a bubble, don't set the start block.\n if (!this.startBlock_ && !this.startBubble_) {\n this.startBlock_ = block;\n if (block.isInFlyout && block !== block.getRootBlock()) {\n this.setTargetBlock_(block.getRootBlock());\n } else {\n this.setTargetBlock_(block);\n }\n }\n }\n\n /**\n * Record the block that a gesture targets, meaning the block that will be\n * dragged if this turns into a drag. If this block is a shadow, that will be\n * its first non-shadow parent.\n *\n * @param block The block the gesture targets.\n */\n private setTargetBlock_(block: BlockSvg) {\n if (block.isShadow()) {\n // Non-null assertion is fine b/c it is an invariant that shadows always\n // have parents.\n this.setTargetBlock_(block.getParent()!);\n } else {\n this.targetBlock_ = block;\n }\n }\n\n /**\n * Record the workspace that a gesture started on.\n *\n * @param ws The workspace the gesture started on.\n */\n private setStartWorkspace_(ws: WorkspaceSvg) {\n if (!this.startWorkspace_) {\n this.startWorkspace_ = ws;\n }\n }\n\n /**\n * Record the flyout that a gesture started on.\n *\n * @param flyout The flyout the gesture started on.\n */\n private setStartFlyout_(flyout: IFlyout) {\n if (!this.flyout_) {\n this.flyout_ = flyout;\n }\n }\n\n /* End functions for populating a gesture at mouse down. */\n\n /* Begin helper functions defining types of clicks. Any developer wanting\n * to change the definition of a click should modify only this code. */\n\n /**\n * Whether this gesture is a click on a bubble. This should only be called\n * when ending a gesture (mouse up, touch end).\n *\n * @returns Whether this gesture was a click on a bubble.\n */\n private isBubbleClick_(): boolean {\n // A bubble click starts on a bubble and never escapes the drag radius.\n const hasStartBubble = !!this.startBubble_;\n return hasStartBubble && !this.hasExceededDragRadius_;\n }\n\n /**\n * Whether this gesture is a click on a block. This should only be called\n * when ending a gesture (mouse up, touch end).\n *\n * @returns Whether this gesture was a click on a block.\n */\n private isBlockClick_(): boolean {\n // A block click starts on a block, never escapes the drag radius, and is\n // not a field click.\n const hasStartBlock = !!this.startBlock_;\n return hasStartBlock && !this.hasExceededDragRadius_ &&\n !this.isFieldClick_();\n }\n\n /**\n * Whether this gesture is a click on a field. This should only be called\n * when ending a gesture (mouse up, touch end).\n *\n * @returns Whether this gesture was a click on a field.\n */\n private isFieldClick_(): boolean {\n const fieldClickable =\n this.startField_ ? this.startField_.isClickable() : false;\n return fieldClickable && !this.hasExceededDragRadius_ &&\n (!this.flyout_ || !this.flyout_.autoClose);\n }\n\n /**\n * Whether this gesture is a click on a workspace. This should only be called\n * when ending a gesture (mouse up, touch end).\n *\n * @returns Whether this gesture was a click on a workspace.\n */\n private isWorkspaceClick_(): boolean {\n const onlyTouchedWorkspace =\n !this.startBlock_ && !this.startBubble_ && !this.startField_;\n return onlyTouchedWorkspace && !this.hasExceededDragRadius_;\n }\n\n /* End helper functions defining types of clicks. */\n\n /**\n * Whether this gesture is a drag of either a workspace or block.\n * This function is called externally to block actions that cannot be taken\n * mid-drag (e.g. using the keyboard to delete the selected blocks).\n *\n * @returns True if this gesture is a drag of a workspace or block.\n * @internal\n */\n isDragging(): boolean {\n return !!this.workspaceDragger_ || !!this.blockDragger_ ||\n !!this.bubbleDragger_;\n }\n\n /**\n * Whether this gesture has already been started. In theory every mouse down\n * has a corresponding mouse up, but in reality it is possible to lose a\n * mouse up, leaving an in-process gesture hanging.\n *\n * @returns Whether this gesture was a click on a workspace.\n * @internal\n */\n hasStarted(): boolean {\n return this.hasStarted_;\n }\n\n /**\n * Get a list of the insertion markers that currently exist. Block drags have\n * 0, 1, or 2 insertion markers.\n *\n * @returns A possibly empty list of insertion marker blocks.\n * @internal\n */\n getInsertionMarkers(): BlockSvg[] {\n if (this.blockDragger_) {\n return this.blockDragger_.getInsertionMarkers();\n }\n return [];\n }\n\n /**\n * Gets the current dragger if an item is being dragged. Null if nothing is\n * being dragged.\n *\n * @returns The dragger that is currently in use or null if no drag is in\n * progress.\n */\n getCurrentDragger(): WorkspaceDragger|BubbleDragger|IBlockDragger|null {\n return this.blockDragger_ ?? this.workspaceDragger_ ?? this.bubbleDragger_;\n }\n\n /**\n * Is a drag or other gesture currently in progress on any workspace?\n *\n * @returns True if gesture is occurring.\n */\n static inProgress(): boolean {\n const workspaces = common.getAllWorkspaces();\n for (let i = 0, workspace; workspace = workspaces[i]; i++) {\n // Not actually necessarily a WorkspaceSvg, but it doesn't matter b/c\n // we're just checking if the property exists. Theoretically we would\n // want to use instanceof, but that causes a circular dependency.\n if ((workspace as WorkspaceSvg).currentGesture_) {\n return true;\n }\n }\n return false;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The namespace used to keep track of keyboard shortcuts and the\n * key codes used to execute those shortcuts.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ShortcutRegistry');\n\nimport {KeyCodes} from './utils/keycodes.js';\nimport * as object from './utils/object.js';\nimport type {Workspace} from './workspace.js';\n\n\n/**\n * Class for the registry of keyboard shortcuts. This is intended to be a\n * singleton. You should not create a new instance, and only access this class\n * from ShortcutRegistry.registry.\n *\n * @alias Blockly.ShortcutRegistry\n */\nexport class ShortcutRegistry {\n static readonly registry = new ShortcutRegistry();\n\n /** Registry of all keyboard shortcuts, keyed by name of shortcut. */\n private shortcuts = new Map<string, KeyboardShortcut>();\n\n /** Map of key codes to an array of shortcut names. */\n private keyMap = new Map<string, string[]>();\n\n /** Resets the existing ShortcutRegistry singleton. */\n private constructor() {\n this.reset();\n }\n\n /** Clear and recreate the registry and keyMap. */\n reset() {\n this.shortcuts.clear();\n this.keyMap.clear();\n }\n\n /**\n * Registers a keyboard shortcut.\n *\n * @param shortcut The shortcut for this key code.\n * @param opt_allowOverrides True to prevent a warning when overriding an\n * already registered item.\n * @throws {Error} if a shortcut with the same name already exists.\n */\n register(shortcut: KeyboardShortcut, opt_allowOverrides?: boolean) {\n const registeredShortcut = this.shortcuts.get(shortcut.name);\n if (registeredShortcut && !opt_allowOverrides) {\n throw new Error(\n 'Shortcut with name \"' + shortcut.name + '\" already exists.');\n }\n this.shortcuts.set(shortcut.name, shortcut);\n\n const keyCodes = shortcut.keyCodes;\n if (keyCodes && keyCodes.length > 0) {\n for (let i = 0; i < keyCodes.length; i++) {\n this.addKeyMapping(\n keyCodes[i], shortcut.name, !!shortcut.allowCollision);\n }\n }\n }\n\n /**\n * Unregisters a keyboard shortcut registered with the given key code. This\n * will also remove any key mappings that reference this shortcut.\n *\n * @param shortcutName The name of the shortcut to unregister.\n * @returns True if an item was unregistered, false otherwise.\n */\n unregister(shortcutName: string): boolean {\n const shortcut = this.shortcuts.get(shortcutName);\n\n if (!shortcut) {\n console.warn(\n 'Keyboard shortcut with name \"' + shortcutName + '\" not found.');\n return false;\n }\n\n this.removeAllKeyMappings(shortcutName);\n\n this.shortcuts.delete(shortcutName);\n return true;\n }\n\n /**\n * Adds a mapping between a keycode and a keyboard shortcut.\n *\n * @param keyCode The key code for the keyboard shortcut. If registering a key\n * code with a modifier (ex: ctrl+c) use\n * ShortcutRegistry.registry.createSerializedKey;\n * @param shortcutName The name of the shortcut to execute when the given\n * keycode is pressed.\n * @param opt_allowCollision True to prevent an error when adding a shortcut\n * to a key that is already mapped to a shortcut.\n * @throws {Error} if the given key code is already mapped to a shortcut.\n */\n addKeyMapping(\n keyCode: string|number|KeyCodes, shortcutName: string,\n opt_allowCollision?: boolean) {\n keyCode = String(keyCode);\n const shortcutNames = this.keyMap.get(keyCode);\n if (shortcutNames && !opt_allowCollision) {\n throw new Error(\n 'Shortcut with name \"' + shortcutName + '\" collides with shortcuts ' +\n shortcutNames.toString());\n } else if (shortcutNames && opt_allowCollision) {\n shortcutNames.unshift(shortcutName);\n } else {\n this.keyMap.set(keyCode, [shortcutName]);\n }\n }\n\n /**\n * Removes a mapping between a keycode and a keyboard shortcut.\n *\n * @param keyCode The key code for the keyboard shortcut. If registering a key\n * code with a modifier (ex: ctrl+c) use\n * ShortcutRegistry.registry.createSerializedKey;\n * @param shortcutName The name of the shortcut to execute when the given\n * keycode is pressed.\n * @param opt_quiet True to not console warn when there is no shortcut to\n * remove.\n * @returns True if a key mapping was removed, false otherwise.\n */\n removeKeyMapping(keyCode: string, shortcutName: string, opt_quiet?: boolean):\n boolean {\n const shortcutNames = this.keyMap.get(keyCode);\n\n if (!shortcutNames) {\n if (!opt_quiet) {\n console.warn(\n 'No keyboard shortcut with name \"' + shortcutName +\n '\" registered with key code \"' + keyCode + '\"');\n }\n return false;\n }\n\n const shortcutIdx = shortcutNames.indexOf(shortcutName);\n if (shortcutIdx > -1) {\n shortcutNames.splice(shortcutIdx, 1);\n if (shortcutNames.length === 0) {\n this.keyMap.delete(keyCode);\n }\n return true;\n }\n if (!opt_quiet) {\n console.warn(\n 'No keyboard shortcut with name \"' + shortcutName +\n '\" registered with key code \"' + keyCode + '\"');\n }\n return false;\n }\n\n /**\n * Removes all the key mappings for a shortcut with the given name.\n * Useful when changing the default key mappings and the key codes registered\n * to the shortcut are unknown.\n *\n * @param shortcutName The name of the shortcut to remove from the key map.\n */\n removeAllKeyMappings(shortcutName: string) {\n for (const keyCode of this.keyMap.keys()) {\n this.removeKeyMapping(keyCode, shortcutName, true);\n }\n }\n\n /**\n * Sets the key map. Setting the key map will override any default key\n * mappings.\n *\n * @param newKeyMap The object with key code to shortcut names.\n */\n setKeyMap(newKeyMap: {[key: string]: string[]}) {\n this.keyMap.clear();\n for (const key in newKeyMap) {\n this.keyMap.set(key, newKeyMap[key]);\n }\n }\n\n /**\n * Gets the current key map.\n *\n * @returns The object holding key codes to ShortcutRegistry.KeyboardShortcut.\n */\n getKeyMap(): {[key: string]: string[]} {\n const legacyKeyMap: {[key: string]: string[]} = Object.create(null);\n for (const [key, value] of this.keyMap) {\n legacyKeyMap[key] = value;\n }\n return legacyKeyMap;\n }\n\n /**\n * Gets the registry of keyboard shortcuts.\n *\n * @returns The registry of keyboard shortcuts.\n */\n getRegistry(): {[key: string]: KeyboardShortcut} {\n const legacyRegistry: {[key: string]: KeyboardShortcut} =\n Object.create(null);\n for (const [key, value] of this.shortcuts) {\n legacyRegistry[key] = value;\n }\n return object.deepMerge(Object.create(null), legacyRegistry);\n }\n\n /**\n * Handles key down events.\n *\n * @param workspace The main workspace where the event was captured.\n * @param e The key down event.\n * @returns True if the event was handled, false otherwise.\n */\n onKeyDown(workspace: Workspace, e: KeyboardEvent): boolean {\n const key = this.serializeKeyEvent_(e);\n const shortcutNames = this.getShortcutNamesByKeyCode(key);\n if (!shortcutNames) {\n return false;\n }\n for (let i = 0, shortcutName; shortcutName = shortcutNames[i]; i++) {\n const shortcut = this.shortcuts.get(shortcutName);\n if (!shortcut?.preconditionFn || shortcut?.preconditionFn(workspace)) {\n // If the key has been handled, stop processing shortcuts.\n if (shortcut?.callback && shortcut?.callback(workspace, e, shortcut)) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Gets the shortcuts registered to the given key code.\n *\n * @param keyCode The serialized key code.\n * @returns The list of shortcuts to call when the given keyCode is used.\n * Undefined if no shortcuts exist.\n */\n getShortcutNamesByKeyCode(keyCode: string): string[]|undefined {\n return this.keyMap.get(keyCode) || [];\n }\n\n /**\n * Gets the serialized key codes that the shortcut with the given name is\n * registered under.\n *\n * @param shortcutName The name of the shortcut.\n * @returns An array with all the key codes the shortcut is registered under.\n */\n getKeyCodesByShortcutName(shortcutName: string): string[] {\n const keys = [];\n for (const [keyCode, shortcuts] of this.keyMap) {\n const shortcutIdx = shortcuts.indexOf(shortcutName);\n if (shortcutIdx > -1) {\n keys.push(keyCode);\n }\n }\n return keys;\n }\n\n /**\n * Serializes a key event.\n *\n * @param e A key down event.\n * @returns The serialized key code for the given event.\n */\n private serializeKeyEvent_(e: KeyboardEvent): string {\n let serializedKey = '';\n for (const modifier in ShortcutRegistry.modifierKeys) {\n if (e.getModifierState(modifier)) {\n if (serializedKey !== '') {\n serializedKey += '+';\n }\n serializedKey += modifier;\n }\n }\n if (serializedKey !== '' && e.keyCode) {\n serializedKey = serializedKey + '+' + e.keyCode;\n } else if (e.keyCode) {\n serializedKey = e.keyCode.toString();\n }\n return serializedKey;\n }\n\n /**\n * Checks whether any of the given modifiers are not valid.\n *\n * @param modifiers List of modifiers to be used with the key.\n * @throws {Error} if the modifier is not in the valid modifiers list.\n */\n private checkModifiers_(modifiers: KeyCodes[]) {\n for (let i = 0, modifier; modifier = modifiers[i]; i++) {\n if (!(modifier in ShortcutRegistry.modifierKeys)) {\n throw new Error(modifier + ' is not a valid modifier key.');\n }\n }\n }\n\n /**\n * Creates the serialized key code that will be used in the key map.\n *\n * @param keyCode Number code representing the key.\n * @param modifiers List of modifier key codes to be used with the key. All\n * valid modifiers can be found in the ShortcutRegistry.modifierKeys.\n * @returns The serialized key code for the given modifiers and key.\n */\n createSerializedKey(keyCode: number, modifiers: KeyCodes[]|null): string {\n let serializedKey = '';\n\n if (modifiers) {\n this.checkModifiers_(modifiers);\n for (const modifier in ShortcutRegistry.modifierKeys) {\n const modifierKeyCode =\n (ShortcutRegistry.modifierKeys as AnyDuringMigration)[modifier];\n if (modifiers.indexOf(modifierKeyCode) > -1) {\n if (serializedKey !== '') {\n serializedKey += '+';\n }\n serializedKey += modifier;\n }\n }\n }\n\n if (serializedKey !== '' && keyCode) {\n serializedKey = serializedKey + '+' + keyCode;\n } else if (keyCode) {\n serializedKey = keyCode.toString();\n }\n return serializedKey;\n }\n}\n\nexport namespace ShortcutRegistry {\n export interface KeyboardShortcut {\n callback?: ((p1: Workspace, p2: Event, p3: KeyboardShortcut) => boolean);\n name: string;\n preconditionFn?: ((p1: Workspace) => boolean);\n metadata?: object;\n keyCodes?: (number|string)[];\n allowCollision?: boolean;\n }\n\n /** Supported modifiers. */\n export enum modifierKeys {\n Shift = KeyCodes.SHIFT,\n Control = KeyCodes.CTRL,\n Alt = KeyCodes.ALT,\n Meta = KeyCodes.META,\n }\n}\n\nexport type KeyboardShortcut = ShortcutRegistry.KeyboardShortcut;\n// No need to export ShorcutRegistry.modifierKeys from the module at this time\n// because (1) it wasn't automatically converted by the automatic migration\n// script, (2) the name doesn't follow the styleguide.\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of a theme update.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.ThemeChange');\n\nimport * as registry from '../registry.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a theme change event.\n *\n * @alias Blockly.Events.ThemeChange\n */\nexport class ThemeChange extends UiBase {\n themeName?: string;\n override type = eventUtils.THEME_CHANGE;\n\n /**\n * @param opt_themeName The theme name. Undefined for a blank event.\n * @param opt_workspaceId The workspace identifier for this event.\n * event. Undefined for a blank event.\n */\n constructor(opt_themeName?: string, opt_workspaceId?: string) {\n super(opt_workspaceId);\n\n /** The theme name. */\n this.themeName = opt_themeName;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): ThemeChangeJson {\n const json = super.toJson() as ThemeChangeJson;\n if (!this.themeName) {\n throw new Error(\n 'The theme name is undefined. Either pass a theme name to ' +\n 'the constructor, or call fromJson');\n }\n json['themeName'] = this.themeName;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: ThemeChangeJson) {\n super.fromJson(json);\n this.themeName = json['themeName'];\n }\n}\n\nexport interface ThemeChangeJson extends AbstractEventJson {\n themeName: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.THEME_CHANGE, ThemeChange);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of a viewport change.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.ViewportChange');\n\nimport * as registry from '../registry.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a viewport change event.\n *\n * @alias Blockly.Events.ViewportChange\n */\nexport class ViewportChange extends UiBase {\n viewTop?: number;\n viewLeft?: number;\n scale?: number;\n oldScale?: number;\n override type = eventUtils.VIEWPORT_CHANGE;\n\n /**\n * @param opt_top Top-edge of the visible portion of the workspace, relative\n * to the workspace origin. Undefined for a blank event.\n * @param opt_left Left-edge of the visible portion of the workspace relative\n * to the workspace origin. Undefined for a blank event.\n * @param opt_scale The scale of the workspace. Undefined for a blank event.\n * @param opt_workspaceId The workspace identifier for this event.\n * Undefined for a blank event.\n * @param opt_oldScale The old scale of the workspace. Undefined for a blank\n * event.\n */\n constructor(\n opt_top?: number, opt_left?: number, opt_scale?: number,\n opt_workspaceId?: string, opt_oldScale?: number) {\n super(opt_workspaceId);\n\n /**\n * Top-edge of the visible portion of the workspace, relative to the\n * workspace origin.\n */\n this.viewTop = opt_top;\n\n /**\n * Left-edge of the visible portion of the workspace, relative to the\n * workspace origin.\n */\n this.viewLeft = opt_left;\n\n /** The scale of the workspace. */\n this.scale = opt_scale;\n\n /** The old scale of the workspace. */\n this.oldScale = opt_oldScale;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): ViewportChangeJson {\n const json = super.toJson() as ViewportChangeJson;\n if (this.viewTop === undefined) {\n throw new Error(\n 'The view top is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n if (this.viewLeft === undefined) {\n throw new Error(\n 'The view left is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n if (this.scale === undefined) {\n throw new Error(\n 'The scale is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n if (this.oldScale === undefined) {\n throw new Error(\n 'The old scale is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n json['viewTop'] = this.viewTop;\n json['viewLeft'] = this.viewLeft;\n json['scale'] = this.scale;\n json['oldScale'] = this.oldScale;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: ViewportChangeJson) {\n super.fromJson(json);\n this.viewTop = json['viewTop'];\n this.viewLeft = json['viewLeft'];\n this.scale = json['scale'];\n this.oldScale = json['oldScale'];\n }\n}\n\nexport interface ViewportChangeJson extends AbstractEventJson {\n viewTop: number;\n viewLeft: number;\n scale: number;\n oldScale: number;\n}\n\nregistry.register(\n registry.Type.EVENT, eventUtils.VIEWPORT_CHANGE, ViewportChange);\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A database of all the rendered connections that could\n * possibly be connected to (i.e. not collapsed, etc).\n * Sorted by y coordinate.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ConnectionDB');\n\nimport {ConnectionType} from './connection_type.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport type {RenderedConnection} from './rendered_connection.js';\nimport type {Coordinate} from './utils/coordinate.js';\n\n\n/**\n * Database of connections.\n * Connections are stored in order of their vertical component. This way\n * connections in an area may be looked up quickly using a binary search.\n *\n * @alias Blockly.ConnectionDB\n */\nexport class ConnectionDB {\n /** Array of connections sorted by y position in workspace units. */\n private readonly connections_: RenderedConnection[] = [];\n\n /**\n * @param connectionChecker The workspace's connection type checker, used to\n * decide if connections are valid during a drag.\n */\n constructor(private readonly connectionChecker: IConnectionChecker) {}\n\n /**\n * Add a connection to the database. Should not already exist in the database.\n *\n * @param connection The connection to be added.\n * @param yPos The y position used to decide where to insert the connection.\n * @internal\n */\n addConnection(connection: RenderedConnection, yPos: number) {\n const index = this.calculateIndexForYPos_(yPos);\n this.connections_.splice(index, 0, connection);\n }\n\n /**\n * Finds the index of the given connection.\n *\n * Starts by doing a binary search to find the approximate location, then\n * linearly searches nearby for the exact connection.\n *\n * @param conn The connection to find.\n * @param yPos The y position used to find the index of the connection.\n * @returns The index of the connection, or -1 if the connection was not\n * found.\n */\n private findIndexOfConnection_(conn: RenderedConnection, yPos: number):\n number {\n if (!this.connections_.length) {\n return -1;\n }\n\n const bestGuess = this.calculateIndexForYPos_(yPos);\n if (bestGuess >= this.connections_.length) {\n // Not in list\n return -1;\n }\n\n yPos = conn.y;\n // Walk forward and back on the y axis looking for the connection.\n let pointer = bestGuess;\n while (pointer >= 0 && this.connections_[pointer].y === yPos) {\n if (this.connections_[pointer] === conn) {\n return pointer;\n }\n pointer--;\n }\n\n pointer = bestGuess;\n while (pointer < this.connections_.length &&\n this.connections_[pointer].y === yPos) {\n if (this.connections_[pointer] === conn) {\n return pointer;\n }\n pointer++;\n }\n return -1;\n }\n\n /**\n * Finds the correct index for the given y position.\n *\n * @param yPos The y position used to decide where to insert the connection.\n * @returns The candidate index.\n */\n private calculateIndexForYPos_(yPos: number): number {\n if (!this.connections_.length) {\n return 0;\n }\n let pointerMin = 0;\n let pointerMax = this.connections_.length;\n while (pointerMin < pointerMax) {\n const pointerMid = Math.floor((pointerMin + pointerMax) / 2);\n if (this.connections_[pointerMid].y < yPos) {\n pointerMin = pointerMid + 1;\n } else if (this.connections_[pointerMid].y > yPos) {\n pointerMax = pointerMid;\n } else {\n pointerMin = pointerMid;\n break;\n }\n }\n return pointerMin;\n }\n\n /**\n * Remove a connection from the database. Must already exist in DB.\n *\n * @param connection The connection to be removed.\n * @param yPos The y position used to find the index of the connection.\n * @throws {Error} If the connection cannot be found in the database.\n */\n removeConnection(connection: RenderedConnection, yPos: number) {\n const index = this.findIndexOfConnection_(connection, yPos);\n if (index === -1) {\n throw Error('Unable to find connection in connectionDB.');\n }\n this.connections_.splice(index, 1);\n }\n\n /**\n * Find all nearby connections to the given connection.\n * Type checking does not apply, since this function is used for bumping.\n *\n * @param connection The connection whose neighbours should be returned.\n * @param maxRadius The maximum radius to another connection.\n * @returns List of connections.\n */\n getNeighbours(connection: RenderedConnection, maxRadius: number):\n RenderedConnection[] {\n const db = this.connections_;\n const currentX = connection.x;\n const currentY = connection.y;\n\n // Binary search to find the closest y location.\n let pointerMin = 0;\n let pointerMax = db.length - 2;\n let pointerMid = pointerMax;\n while (pointerMin < pointerMid) {\n if (db[pointerMid].y < currentY) {\n pointerMin = pointerMid;\n } else {\n pointerMax = pointerMid;\n }\n pointerMid = Math.floor((pointerMin + pointerMax) / 2);\n }\n\n const neighbours: RenderedConnection[] = [];\n /**\n * Computes if the current connection is within the allowed radius of\n * another connection. This function is a closure and has access to outside\n * variables.\n *\n * @param yIndex The other connection's index in the database.\n * @returns True if the current connection's vertical distance from the\n * other connection is less than the allowed radius.\n */\n function checkConnection_(yIndex: number): boolean {\n const dx = currentX - db[yIndex].x;\n const dy = currentY - db[yIndex].y;\n const r = Math.sqrt(dx * dx + dy * dy);\n if (r <= maxRadius) {\n neighbours.push(db[yIndex]);\n }\n return dy < maxRadius;\n }\n\n // Walk forward and back on the y axis looking for the closest x,y point.\n pointerMin = pointerMid;\n pointerMax = pointerMid;\n if (db.length) {\n while (pointerMin >= 0 && checkConnection_(pointerMin)) {\n pointerMin--;\n }\n do {\n pointerMax++;\n } while (pointerMax < db.length && checkConnection_(pointerMax));\n }\n\n return neighbours;\n }\n\n /**\n * Is the candidate connection close to the reference connection.\n * Extremely fast; only looks at Y distance.\n *\n * @param index Index in database of candidate connection.\n * @param baseY Reference connection's Y value.\n * @param maxRadius The maximum radius to another connection.\n * @returns True if connection is in range.\n */\n private isInYRange_(index: number, baseY: number, maxRadius: number):\n boolean {\n return Math.abs(this.connections_[index].y - baseY) <= maxRadius;\n }\n\n /**\n * Find the closest compatible connection to this connection.\n *\n * @param conn The connection searching for a compatible mate.\n * @param maxRadius The maximum radius to another connection.\n * @param dxy Offset between this connection's location in the database and\n * the current location (as a result of dragging).\n * @returns Contains two properties: 'connection' which is either another\n * connection or null, and 'radius' which is the distance.\n */\n searchForClosest(\n conn: RenderedConnection, maxRadius: number,\n dxy: Coordinate): {connection: RenderedConnection|null, radius: number} {\n if (!this.connections_.length) {\n // Don't bother.\n return {connection: null, radius: maxRadius};\n }\n\n // Stash the values of x and y from before the drag.\n const baseY = conn.y;\n const baseX = conn.x;\n\n conn.x = baseX + dxy.x;\n conn.y = baseY + dxy.y;\n\n // calculateIndexForYPos_ finds an index for insertion, which is always\n // after any block with the same y index. We want to search both forward\n // and back, so search on both sides of the index.\n const closestIndex = this.calculateIndexForYPos_(conn.y);\n\n let bestConnection = null;\n let bestRadius = maxRadius;\n let temp;\n\n // Walk forward and back on the y axis looking for the closest x,y point.\n let pointerMin = closestIndex - 1;\n while (pointerMin >= 0 && this.isInYRange_(pointerMin, conn.y, maxRadius)) {\n temp = this.connections_[pointerMin];\n if (this.connectionChecker.canConnect(conn, temp, true, bestRadius)) {\n bestConnection = temp;\n bestRadius = temp.distanceFrom(conn);\n }\n pointerMin--;\n }\n\n let pointerMax = closestIndex;\n while (pointerMax < this.connections_.length &&\n this.isInYRange_(pointerMax, conn.y, maxRadius)) {\n temp = this.connections_[pointerMax];\n if (this.connectionChecker.canConnect(conn, temp, true, bestRadius)) {\n bestConnection = temp;\n bestRadius = temp.distanceFrom(conn);\n }\n pointerMax++;\n }\n\n // Reset the values of x and y.\n conn.x = baseX;\n conn.y = baseY;\n // If there were no valid connections, bestConnection will be null.\n return {connection: bestConnection, radius: bestRadius};\n }\n\n /**\n * Initialize a set of connection DBs for a workspace.\n *\n * @param checker The workspace's connection checker, used to decide if\n * connections are valid during a drag.\n * @returns Array of databases.\n */\n static init(checker: IConnectionChecker): ConnectionDB[] {\n // Create four databases, one for each connection type.\n const dbList = [];\n dbList[ConnectionType.INPUT_VALUE] = new ConnectionDB(checker);\n dbList[ConnectionType.OUTPUT_VALUE] = new ConnectionDB(checker);\n dbList[ConnectionType.NEXT_STATEMENT] = new ConnectionDB(checker);\n dbList[ConnectionType.PREVIOUS_STATEMENT] = new ConnectionDB(checker);\n return dbList;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object for configuring and updating a workspace grid in\n * Blockly.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Grid');\n\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport {GridOptions} from './options.js';\n\n\n/**\n * Class for a workspace's grid.\n *\n * @alias Blockly.Grid\n */\nexport class Grid {\n private readonly spacing: number;\n private readonly length: number;\n private readonly line1: SVGElement;\n private readonly line2: SVGElement;\n private readonly snapToGrid: boolean;\n\n /**\n * @param pattern The grid's SVG pattern, created during injection.\n * @param options A dictionary of normalized options for the grid.\n * See grid documentation:\n * https://developers.google.com/blockly/guides/configure/web/grid\n */\n constructor(private pattern: SVGElement, options: GridOptions) {\n /** The spacing of the grid lines (in px). */\n this.spacing = options['spacing'] ?? 0;\n\n /** How long the grid lines should be (in px). */\n this.length = options['length'] ?? 1;\n\n /** The horizontal grid line, if it exists. */\n this.line1 = pattern.firstChild as SVGElement;\n\n /** The vertical grid line, if it exists. */\n this.line2 = this.line1 && this.line1.nextSibling as SVGElement;\n\n /** Whether blocks should snap to the grid. */\n this.snapToGrid = options['snap'] ?? false;\n }\n\n /**\n * Whether blocks should snap to the grid, based on the initial configuration.\n *\n * @returns True if blocks should snap, false otherwise.\n * @internal\n */\n shouldSnap(): boolean {\n return this.snapToGrid;\n }\n\n /**\n * Get the spacing of the grid points (in px).\n *\n * @returns The spacing of the grid points.\n * @internal\n */\n getSpacing(): number {\n return this.spacing;\n }\n\n /**\n * Get the ID of the pattern element, which should be randomized to avoid\n * conflicts with other Blockly instances on the page.\n *\n * @returns The pattern ID.\n * @internal\n */\n getPatternId(): string {\n return this.pattern.id;\n }\n\n /**\n * Update the grid with a new scale.\n *\n * @param scale The new workspace scale.\n * @internal\n */\n update(scale: number) {\n // MSIE freaks if it sees a 0x0 pattern, so set empty patterns to 100x100.\n const safeSpacing = this.spacing * scale || 100;\n\n this.pattern.setAttribute('width', safeSpacing.toString());\n this.pattern.setAttribute('height', safeSpacing.toString());\n\n let half = Math.floor(this.spacing / 2) + 0.5;\n let start = half - this.length / 2;\n let end = half + this.length / 2;\n\n half *= scale;\n start *= scale;\n end *= scale;\n\n this.setLineAttributes(this.line1, scale, start, end, half, half);\n this.setLineAttributes(this.line2, scale, half, half, start, end);\n }\n\n /**\n * Set the attributes on one of the lines in the grid. Use this to update the\n * length and stroke width of the grid lines.\n *\n * @param line Which line to update.\n * @param width The new stroke size (in px).\n * @param x1 The new x start position of the line (in px).\n * @param x2 The new x end position of the line (in px).\n * @param y1 The new y start position of the line (in px).\n * @param y2 The new y end position of the line (in px).\n */\n private setLineAttributes(\n line: SVGElement, width: number, x1: number, x2: number, y1: number,\n y2: number) {\n if (line) {\n line.setAttribute('stroke-width', width.toString());\n line.setAttribute('x1', x1.toString());\n line.setAttribute('y1', y1.toString());\n line.setAttribute('x2', x2.toString());\n line.setAttribute('y2', y2.toString());\n }\n }\n\n /**\n * Move the grid to a new x and y position, and make sure that change is\n * visible.\n *\n * @param x The new x position of the grid (in px).\n * @param y The new y position of the grid (in px).\n * @internal\n */\n moveTo(x: number, y: number) {\n this.pattern.setAttribute('x', x.toString());\n this.pattern.setAttribute('y', y.toString());\n }\n\n /**\n * Create the DOM for the grid described by options.\n *\n * @param rnd A random ID to append to the pattern's ID.\n * @param gridOptions The object containing grid configuration.\n * @param defs The root SVG element for this workspace's defs.\n * @returns The SVG element for the grid pattern.\n * @internal\n */\n static createDom(rnd: string, gridOptions: GridOptions, defs: SVGElement):\n SVGElement {\n /*\n <pattern id=\"blocklyGridPattern837493\" patternUnits=\"userSpaceOnUse\">\n <rect stroke=\"#888\" />\n <rect stroke=\"#888\" />\n </pattern>\n */\n const gridPattern = dom.createSvgElement(\n Svg.PATTERN,\n {'id': 'blocklyGridPattern' + rnd, 'patternUnits': 'userSpaceOnUse'},\n defs);\n // x1, y1, x1, x2 properties will be set later in update.\n if ((gridOptions['length'] ?? 1) > 0 && (gridOptions['spacing'] ?? 0) > 0) {\n dom.createSvgElement(\n Svg.LINE, {'stroke': gridOptions['colour']}, gridPattern);\n if (gridOptions['length'] ?? 1 > 1) {\n dom.createSvgElement(\n Svg.LINE, {'stroke': gridOptions['colour']}, gridPattern);\n }\n } else {\n // Edge 16 doesn't handle empty patterns\n dom.createSvgElement(Svg.LINE, {}, gridPattern);\n }\n return gridPattern;\n }\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility functions for handling variable and procedure names.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Names');\n\nimport {Msg} from './msg.js';\n// import * as Procedures from './procedures.js';\nimport type {VariableMap} from './variable_map.js';\nimport * as Variables from './variables.js';\nimport type {Workspace} from './workspace.js';\n\n\n/**\n * Class for a database of entity names (variables, procedures, etc).\n *\n * @alias Blockly.Names\n */\nexport class Names {\n static DEVELOPER_VARIABLE_TYPE: NameType;\n private readonly variablePrefix_: string;\n\n /** A set of reserved words. */\n private readonly reservedWords: Set<string>;\n\n /**\n * A map from type (e.g. name, procedure) to maps from names to generated\n * names.\n */\n private readonly db = new Map<string, Map<string, string>>();\n\n /** A set of used names to avoid collisions. */\n private readonly dbReverse = new Set<string>();\n\n /**\n * The variable map from the workspace, containing Blockly variable models.\n */\n private variableMap_: VariableMap|null = null;\n\n /**\n * @param reservedWordsList A comma-separated string of words that are illegal\n * for use as names in a language (e.g. 'new,if,this,...').\n * @param opt_variablePrefix Some languages need a '$' or a namespace before\n * all variable names (but not procedure names).\n */\n constructor(reservedWordsList: string, opt_variablePrefix?: string) {\n /** The prefix to attach to variable names in generated code. */\n this.variablePrefix_ = opt_variablePrefix || '';\n\n this.reservedWords =\n new Set<string>(reservedWordsList ? reservedWordsList.split(',') : []);\n }\n\n /**\n * Empty the database and start from scratch. The reserved words are kept.\n */\n reset() {\n this.db.clear();\n this.dbReverse.clear();\n this.variableMap_ = null;\n }\n\n /**\n * Set the variable map that maps from variable name to variable object.\n *\n * @param map The map to track.\n */\n setVariableMap(map: VariableMap) {\n this.variableMap_ = map;\n }\n\n /**\n * Get the name for a user-defined variable, based on its ID.\n * This should only be used for variables of NameType VARIABLE.\n *\n * @param id The ID to look up in the variable map.\n * @returns The name of the referenced variable, or null if there was no\n * variable map or the variable was not found in the map.\n */\n private getNameForUserVariable_(id: string): string|null {\n if (!this.variableMap_) {\n console.warn(\n 'Deprecated call to Names.prototype.getName without ' +\n 'defining a variable map. To fix, add the following code in your ' +\n 'generator\\'s init() function:\\n' +\n 'Blockly.YourGeneratorName.nameDB_.setVariableMap(' +\n 'workspace.getVariableMap());');\n return null;\n }\n const variable = this.variableMap_.getVariableById(id);\n if (variable) {\n return variable.name;\n }\n return null;\n }\n\n /**\n * Generate names for user variables, but only ones that are being used.\n *\n * @param workspace Workspace to generate variables from.\n */\n populateVariables(workspace: Workspace) {\n const variables = Variables.allUsedVarModels(workspace);\n for (let i = 0; i < variables.length; i++) {\n this.getName(variables[i].getId(), NameType.VARIABLE);\n }\n }\n\n /**\n * Generate names for procedures.\n *\n * @param workspace Workspace to generate procedures from.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n populateProcedures(workspace: Workspace) {\n throw new Error(\n 'The implementation of populateProcedures should be ' +\n 'monkey-patched in by blockly.ts');\n }\n\n /**\n * Convert a Blockly entity name to a legal exportable entity name.\n *\n * @param nameOrId The Blockly entity name (no constraints) or variable ID.\n * @param type The type of the name in Blockly ('VARIABLE', 'PROCEDURE',\n * 'DEVELOPER_VARIABLE', etc...).\n * @returns An entity name that is legal in the exported language.\n */\n getName(nameOrId: string, type: NameType|string): string {\n let name = nameOrId;\n if (type === NameType.VARIABLE) {\n const varName = this.getNameForUserVariable_(nameOrId);\n if (varName) {\n // Successful ID lookup.\n name = varName;\n }\n }\n const normalizedName = name.toLowerCase();\n\n const isVar =\n type === NameType.VARIABLE || type === NameType.DEVELOPER_VARIABLE;\n\n const prefix = isVar ? this.variablePrefix_ : '';\n if (!this.db.has(type)) {\n this.db.set(type, new Map<string, string>());\n }\n const typeDb = this.db.get(type);\n if (typeDb!.has(normalizedName)) {\n return prefix + typeDb!.get(normalizedName);\n }\n const safeName = this.getDistinctName(name, type);\n typeDb!.set(normalizedName, safeName.substr(prefix.length));\n return safeName;\n }\n\n /**\n * Return a list of all known user-created names of a specified name type.\n *\n * @param type The type of entity in Blockly ('VARIABLE', 'PROCEDURE',\n * 'DEVELOPER_VARIABLE', etc...).\n * @returns A list of Blockly entity names (no constraints).\n */\n getUserNames(type: NameType|string): string[] {\n const userNames = this.db.get(type)?.keys();\n return userNames ? Array.from(userNames) : [];\n }\n\n /**\n * Convert a Blockly entity name to a legal exportable entity name.\n * Ensure that this is a new name not overlapping any previously defined name.\n * Also check against list of reserved words for the current language and\n * ensure name doesn't collide.\n *\n * @param name The Blockly entity name (no constraints).\n * @param type The type of entity in Blockly ('VARIABLE', 'PROCEDURE',\n * 'DEVELOPER_VARIABLE', etc...).\n * @returns An entity name that is legal in the exported language.\n */\n getDistinctName(name: string, type: NameType|string): string {\n let safeName = this.safeName_(name);\n let i = '';\n while (this.dbReverse.has(safeName + i) ||\n this.reservedWords.has(safeName + i)) {\n // Collision with existing name. Create a unique name.\n // AnyDuringMigration because: Type 'string | 2' is not assignable to\n // type 'string'.\n i = (i ? i + 1 : 2) as AnyDuringMigration;\n }\n safeName += i;\n this.dbReverse.add(safeName);\n const isVar =\n type === NameType.VARIABLE || type === NameType.DEVELOPER_VARIABLE;\n const prefix = isVar ? this.variablePrefix_ : '';\n return prefix + safeName;\n }\n\n /**\n * Given a proposed entity name, generate a name that conforms to the\n * [_A-Za-z][_A-Za-z0-9]* format that most languages consider legal for\n * variable and function names.\n *\n * @param name Potentially illegal entity name.\n * @returns Safe entity name.\n */\n private safeName_(name: string): string {\n if (!name) {\n name = Msg['UNNAMED_KEY'] || 'unnamed';\n } else {\n // Unfortunately names in non-latin characters will look like\n // _E9_9F_B3_E4_B9_90 which is pretty meaningless.\n // https://github.com/google/blockly/issues/1654\n name = encodeURI(name.replace(/ /g, '_')).replace(/[^\\w]/g, '_');\n // Most languages don't allow names with leading numbers.\n if ('0123456789'.indexOf(name[0]) !== -1) {\n name = 'my_' + name;\n }\n }\n return name;\n }\n\n /**\n * Do the given two entity names refer to the same entity?\n * Blockly names are case-insensitive.\n *\n * @param name1 First name.\n * @param name2 Second name.\n * @returns True if names are the same.\n */\n static equals(name1: string, name2: string): boolean {\n // name1.localeCompare(name2) is slower.\n return name1.toLowerCase() === name2.toLowerCase();\n }\n}\n\nexport namespace Names {\n /**\n * Enum for the type of a name. Different name types may have different rules\n * about collisions.\n * When JavaScript (or most other languages) is generated, variable 'foo' and\n * procedure 'foo' would collide. However, Blockly has no such problems since\n * variable get 'foo' and procedure call 'foo' are unambiguous.\n * Therefore, Blockly keeps a separate name type to disambiguate.\n * getName('foo', 'VARIABLE') = 'foo'\n * getName('foo', 'PROCEDURE') = 'foo2'\n *\n * @alias Blockly.Names.NameType\n */\n export enum NameType {\n DEVELOPER_VARIABLE = 'DEVELOPER_VARIABLE',\n VARIABLE = 'VARIABLE',\n PROCEDURE = 'PROCEDURE',\n }\n}\n\nexport type NameType = Names.NameType;\nexport const NameType = Names.NameType;\n\n/**\n * Constant to separate developer variable names from user-defined variable\n * names when running generators.\n * A developer variable will be declared as a global in the generated code, but\n * will never be shown to the user in the workspace or stored in the variable\n * map.\n */\nNames.DEVELOPER_VARIABLE_TYPE = NameType.DEVELOPER_VARIABLE;\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Measurable types.\n *\n * @namespace Blockly.blockRendering.Types\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Types');\n\nimport type {Measurable} from './base.js';\nimport type {Row} from './row.js';\n\n\n/**\n * Types of rendering elements.\n *\n * @alias Blockly.blockRendering.Types\n */\nclass TypesContainer {\n [index: string]: number|Function;\n\n NONE = 0; // None\n FIELD = 1 << 0; // Field.\n HAT = 1 << 1; // Hat.\n ICON = 1 << 2; // Icon.\n SPACER = 1 << 3; // Spacer.\n BETWEEN_ROW_SPACER = 1 << 4; // Between Row Spacer.\n IN_ROW_SPACER = 1 << 5; // In Row Spacer.\n EXTERNAL_VALUE_INPUT = 1 << 6; // External Value Input.\n INPUT = 1 << 7; // Input.\n INLINE_INPUT = 1 << 8; // Inline Input.\n STATEMENT_INPUT = 1 << 9; // Statement Input.\n CONNECTION = 1 << 10; // Connection.\n PREVIOUS_CONNECTION = 1 << 11; // Previous Connection.\n NEXT_CONNECTION = 1 << 12; // Next Connection.\n OUTPUT_CONNECTION = 1 << 13; // Output Connection.\n CORNER = 1 << 14; // Corner.\n LEFT_SQUARE_CORNER = 1 << 15; // Square Corner.\n LEFT_ROUND_CORNER = 1 << 16; // Round Corner.\n RIGHT_SQUARE_CORNER = 1 << 17; // Right Square Corner.\n RIGHT_ROUND_CORNER = 1 << 18; // Right Round Corner.\n JAGGED_EDGE = 1 << 19; // Jagged Edge.\n ROW = 1 << 20; // Row.\n TOP_ROW = 1 << 21; // Top Row.\n BOTTOM_ROW = 1 << 22; // Bottom Row.\n INPUT_ROW = 1 << 23; // Input Row.\n\n /**\n * A Left Corner Union Type.\n *\n * @internal\n */\n LEFT_CORNER = this.LEFT_SQUARE_CORNER | this.LEFT_ROUND_CORNER;\n\n /**\n * A Right Corner Union Type.\n *\n * @internal\n */\n RIGHT_CORNER = this.RIGHT_SQUARE_CORNER | this.RIGHT_ROUND_CORNER;\n\n /**\n * Next flag value to use for custom rendering element types.\n * This must be updated to reflect the next enum flag value\n * to use if additional elements are added to\n * `Types`.\n */\n nextTypeValue_ = 1 << 24;\n\n /**\n * Get the enum flag value of an existing type or register a new type.\n *\n * @param type The name of the type.\n * @returns The enum flag value associated with that type.\n * @internal\n */\n getType(type: string): number {\n if (!Object.prototype.hasOwnProperty.call(this, type)) {\n this[type] = this.nextTypeValue_;\n this.nextTypeValue_ <<= 1;\n }\n return this[type] as number;\n }\n\n /**\n * Whether a measurable stores information about a field.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a field.\n * @internal\n */\n isField(elem: Measurable): number {\n return elem.type & this.FIELD;\n }\n\n /**\n * Whether a measurable stores information about a hat.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a hat.\n * @internal\n */\n isHat(elem: Measurable): number {\n return elem.type & this.HAT;\n }\n\n /**\n * Whether a measurable stores information about an icon.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about an icon.\n * @internal\n */\n isIcon(elem: Measurable): number {\n return elem.type & this.ICON;\n }\n\n /**\n * Whether a measurable stores information about a spacer.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a spacer.\n * @internal\n */\n isSpacer(elem: Measurable|Row): number {\n return elem.type & this.SPACER;\n }\n\n /**\n * Whether a measurable stores information about an in-row spacer.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about an in-row spacer.\n * @internal\n */\n isInRowSpacer(elem: Measurable): number {\n return elem.type & this.IN_ROW_SPACER;\n }\n\n /**\n * Whether a measurable stores information about an input.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about an input.\n * @internal\n */\n isInput(elem: Measurable): number {\n return elem.type & this.INPUT;\n }\n\n /**\n * Whether a measurable stores information about an external input.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about an external input.\n * @internal\n */\n isExternalInput(elem: Measurable): number {\n return elem.type & this.EXTERNAL_VALUE_INPUT;\n }\n\n /**\n * Whether a measurable stores information about an inline input.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about an inline input.\n * @internal\n */\n isInlineInput(elem: Measurable): number {\n return elem.type & this.INLINE_INPUT;\n }\n\n /**\n * Whether a measurable stores information about a statement input.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a statement input.\n * @internal\n */\n isStatementInput(elem: Measurable): number {\n return elem.type & this.STATEMENT_INPUT;\n }\n\n /**\n * Whether a measurable stores information about a previous connection.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a previous connection.\n * @internal\n */\n isPreviousConnection(elem: Measurable): number {\n return elem.type & this.PREVIOUS_CONNECTION;\n }\n\n /**\n * Whether a measurable stores information about a next connection.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a next connection.\n * @internal\n */\n isNextConnection(elem: Measurable): number {\n return elem.type & this.NEXT_CONNECTION;\n }\n\n /**\n * Whether a measurable stores information about a previous or next\n * connection.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a previous or next\n * connection.\n * @internal\n */\n isPreviousOrNextConnection(elem: Measurable): number {\n return elem.type & (this.PREVIOUS_CONNECTION | this.NEXT_CONNECTION);\n }\n\n /**\n * Whether a measurable stores information about a left round corner.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a left round corner.\n * @internal\n */\n isLeftRoundedCorner(elem: Measurable): number {\n return elem.type & this.LEFT_ROUND_CORNER;\n }\n\n /**\n * Whether a measurable stores information about a right round corner.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a right round corner.\n * @internal\n */\n isRightRoundedCorner(elem: Measurable): number {\n return elem.type & this.RIGHT_ROUND_CORNER;\n }\n\n /**\n * Whether a measurable stores information about a left square corner.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a left square corner.\n * @internal\n */\n isLeftSquareCorner(elem: Measurable): number {\n return elem.type & this.LEFT_SQUARE_CORNER;\n }\n\n /**\n * Whether a measurable stores information about a right square corner.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a right square corner.\n * @internal\n */\n isRightSquareCorner(elem: Measurable): number {\n return elem.type & this.RIGHT_SQUARE_CORNER;\n }\n\n /**\n * Whether a measurable stores information about a corner.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a corner.\n * @internal\n */\n isCorner(elem: Measurable): number {\n return elem.type & this.CORNER;\n }\n\n /**\n * Whether a measurable stores information about a jagged edge.\n *\n * @param elem The element to check.\n * @returns 1 if the object stores information about a jagged edge.\n * @internal\n */\n isJaggedEdge(elem: Measurable): number {\n return elem.type & this.JAGGED_EDGE;\n }\n\n /**\n * Whether a measurable stores information about a row.\n *\n * @param row The row to check.\n * @returns 1 if the object stores information about a row.\n * @internal\n */\n isRow(row: Row): number {\n return row.type & this.ROW;\n }\n\n /**\n * Whether a measurable stores information about a between-row spacer.\n *\n * @param row The row to check.\n * @returns 1 if the object stores information about a between-row spacer.\n * @internal\n */\n isBetweenRowSpacer(row: Row): number {\n return row.type & this.BETWEEN_ROW_SPACER;\n }\n\n /**\n * Whether a measurable stores information about a top row.\n *\n * @param row The row to check.\n * @returns 1 if the object stores information about a top row.\n * @internal\n */\n isTopRow(row: Row): number {\n return row.type & this.TOP_ROW;\n }\n\n /**\n * Whether a measurable stores information about a bottom row.\n *\n * @param row The row to check.\n * @returns 1 if the object stores information about a bottom row.\n * @internal\n */\n isBottomRow(row: Row): number {\n return row.type & this.BOTTOM_ROW;\n }\n\n /**\n * Whether a measurable stores information about a top or bottom row.\n *\n * @param row The row to check.\n * @returns 1 if the object stores information about a top or bottom row.\n * @internal\n */\n isTopOrBottomRow(row: Row): number {\n return row.type & (this.TOP_ROW | this.BOTTOM_ROW);\n }\n\n /**\n * Whether a measurable stores information about an input row.\n *\n * @param row The row to check.\n * @returns 1 if the object stores information about an input row.\n * @internal\n */\n isInputRow(row: Row): number {\n return row.type & this.INPUT_ROW;\n }\n}\n\nexport const Types = new TypesContainer();\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for graphically rendering a block as SVG.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Measurable');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Types} from './types.js';\n\n\n/**\n * The base class to represent a part of a block that takes up space during\n * rendering. The constructor for each non-spacer Measurable records the size\n * of the block element (e.g. field, statement input).\n *\n * @alias Blockly.blockRendering.Measurable\n */\nexport class Measurable {\n width = 0;\n\n height = 0;\n type: number;\n xPos = 0;\n\n centerline = 0;\n notchOffset: number;\n\n /** The renderer's constant provider. */\n protected readonly constants_: ConstantProvider;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n this.constants_ = constants;\n\n this.type = Types.NONE;\n\n this.notchOffset = this.constants_.NOTCH_OFFSET_LEFT;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a single row on a rendered block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Row');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport type {Measurable} from './base.js';\nimport type {InRowSpacer} from './in_row_spacer.js';\nimport type {InputConnection} from './input_connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object representing a single row on a rendered block and all of its\n * subcomponents.\n *\n * @alias Blockly.blockRendering.Row\n */\nexport class Row {\n /** @internal */\n type: number;\n\n /**\n * An array of elements contained in this row.\n *\n * @internal\n */\n elements: Measurable[] = [];\n\n /**\n * The height of the row.\n *\n * @internal\n */\n height = 0;\n\n /**\n * The width of the row, from the left edge of the block to the right.\n * Does not include child blocks unless they are inline.\n *\n * @internal\n */\n width = 0;\n\n /**\n * The minimum height of the row.\n *\n * @internal\n */\n minHeight = 0;\n\n /**\n * The minimum width of the row, from the left edge of the block to the\n * right. Does not include child blocks unless they are inline.\n *\n * @internal\n */\n minWidth = 0;\n\n /**\n * The width of the row, from the left edge of the block to the edge of the\n * block or any connected child blocks.\n *\n * @internal\n */\n widthWithConnectedBlocks = 0;\n\n /**\n * The Y position of the row relative to the origin of the block's svg\n * group.\n *\n * @internal\n */\n yPos = 0;\n\n /**\n * The X position of the row relative to the origin of the block's svg\n * group.\n *\n * @internal\n */\n xPos = 0;\n\n /**\n * Whether the row has any external inputs.\n *\n * @internal\n */\n hasExternalInput = false;\n\n /**\n * Whether the row has any statement inputs.\n *\n * @internal\n */\n hasStatement = false;\n\n /**\n * Where the left edge of all of the statement inputs on the block should\n * be. This makes sure that statement inputs which are proceded by fields\n * of varius widths are all aligned.\n */\n statementEdge = 0;\n\n /**\n * Whether the row has any inline inputs.\n *\n * @internal\n */\n hasInlineInput = false;\n\n /**\n * Whether the row has any dummy inputs.\n *\n * @internal\n */\n hasDummyInput = false;\n\n /**\n * Whether the row has a jagged edge.\n *\n * @internal\n */\n hasJaggedEdge = false;\n notchOffset: number;\n\n /**\n * Alignment of the row.\n *\n * @internal\n */\n align: number|null = null;\n\n protected readonly constants_: ConstantProvider;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n /** The renderer's constant provider. */\n this.constants_ = constants;\n\n /** The type of this rendering object. */\n this.type = Types.ROW;\n\n this.notchOffset = this.constants_.NOTCH_OFFSET_LEFT;\n }\n\n /**\n * Get the last input on this row, if it has one.\n *\n * @returns The last input on the row, or null.\n * @internal\n */\n getLastInput(): InputConnection|null {\n // TODO: Consider moving this to InputRow, if possible.\n for (let i = this.elements.length - 1; i >= 0; i--) {\n const elem = this.elements[i];\n if (Types.isInput(elem)) {\n return elem as InputConnection;\n }\n }\n return null;\n }\n\n /**\n * Inspect all subcomponents and populate all size properties on the row.\n *\n * @internal\n */\n measure() {\n throw Error('Unexpected attempt to measure a base Row.');\n }\n\n /**\n * Determines whether this row should start with an element spacer.\n *\n * @returns Whether the row should start with a spacer.\n * @internal\n */\n startsWithElemSpacer(): boolean {\n return true;\n }\n\n /**\n * Determines whether this row should end with an element spacer.\n *\n * @returns Whether the row should end with a spacer.\n * @internal\n */\n endsWithElemSpacer(): boolean {\n return true;\n }\n\n /**\n * Convenience method to get the first spacer element on this row.\n *\n * @returns The first spacer element on this row.\n * @internal\n */\n getFirstSpacer(): InRowSpacer|null {\n for (let i = 0; i < this.elements.length; i++) {\n const elem = this.elements[i];\n if (Types.isSpacer(elem)) {\n return elem as InRowSpacer;\n }\n }\n return null;\n }\n\n /**\n * Convenience method to get the last spacer element on this row.\n *\n * @returns The last spacer element on this row.\n * @internal\n */\n getLastSpacer(): InRowSpacer|null {\n for (let i = this.elements.length - 1; i >= 0; i--) {\n const elem = this.elements[i];\n if (Types.isSpacer(elem)) {\n return elem as InRowSpacer;\n }\n }\n return null;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a bottom row on a rendered block.\n * of its subcomponents.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.BottomRow');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport type {NextConnection} from './next_connection.js';\nimport {Row} from './row.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about what elements are in the bottom row of\n * a block as well as spacing information for the bottom row.\n * Elements in a bottom row can consist of corners, spacers and next\n * connections.\n *\n * @alias Blockly.blockRendering.BottomRow\n */\nexport class BottomRow extends Row {\n /**\n * Whether this row has a next connection.\n *\n * @internal\n */\n hasNextConnection = false;\n\n /**\n * The next connection on the row, if any.\n *\n * @internal\n */\n connection: NextConnection|null = null;\n\n /**\n * The amount that the bottom of the block extends below the horizontal\n * edge, e.g. because of a next connection. Must be non-negative (see\n * #2820).\n *\n * @internal\n */\n descenderHeight = 0;\n\n /**\n * The Y position of the bottom edge of the block, relative to the origin\n * of the block rendering.\n */\n baseline = 0;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n this.type |= Types.BOTTOM_ROW;\n }\n\n /**\n * Returns whether or not the bottom row has a left square corner.\n *\n * @param block The block whose bottom row this represents.\n * @returns Whether or not the bottom row has a left square corner.\n */\n hasLeftSquareCorner(block: BlockSvg): boolean {\n return !!block.outputConnection || !!block.getNextBlock();\n }\n\n /**\n * Returns whether or not the bottom row has a right square corner.\n *\n * @param _block The block whose bottom row this represents.\n * @returns Whether or not the bottom row has a right square corner.\n */\n hasRightSquareCorner(_block: BlockSvg): boolean {\n return true;\n }\n\n override measure() {\n let height = 0;\n let width = 0;\n let descenderHeight = 0;\n for (let i = 0; i < this.elements.length; i++) {\n const elem = this.elements[i];\n width += elem.width;\n if (!Types.isSpacer(elem)) {\n // Note: this assumes that next connections have *only* descenderHeight,\n // with no height above the baseline.\n if (Types.isNextConnection(elem)) {\n descenderHeight = Math.max(descenderHeight, elem.height);\n } else {\n height = Math.max(height, elem.height);\n }\n }\n }\n this.width = Math.max(this.minWidth, width);\n this.height = Math.max(this.minHeight, height) + descenderHeight;\n this.descenderHeight = descenderHeight;\n this.widthWithConnectedBlocks = this.width;\n }\n\n override startsWithElemSpacer() {\n return false;\n }\n\n override endsWithElemSpacer() {\n return false;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Base class representing the space a connection takes up during\n * rendering.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Connection');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider, Shape} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * The base class to represent a connection and the space that it takes up on\n * the block.\n *\n * @alias Blockly.blockRendering.Connection\n */\nexport class Connection extends Measurable {\n shape: Shape;\n isDynamicShape: boolean;\n\n /**\n * @param constants The rendering constants provider.\n * @param connectionModel The connection object on the block that this\n * represents.\n * @internal\n */\n constructor(\n constants: ConstantProvider, public connectionModel: RenderedConnection) {\n super(constants);\n\n this.shape = this.constants_.shapeFor(connectionModel);\n\n this.isDynamicShape = 'isDynamic' in this.shape && this.shape.isDynamic;\n this.type |= Types.CONNECTION;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class representing inputs with connections on a rendered block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.InputConnection');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Input} from '../../input.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * The base class to represent an input that takes up space on a block\n * during rendering\n *\n * @alias Blockly.blockRendering.InputConnection\n */\nexport class InputConnection extends Connection {\n align: number;\n connectedBlock: BlockSvg|null;\n connectedBlockWidth: number;\n connectedBlockHeight: number;\n connectionOffsetX = 0;\n connectionOffsetY = 0;\n\n /**\n * @param constants The rendering constants provider.\n * @param input The input to measure and store information for.\n * @internal\n */\n constructor(constants: ConstantProvider, public input: Input) {\n super(constants, input.connection as RenderedConnection);\n\n this.type |= Types.INPUT;\n\n this.align = input.align;\n\n this.connectedBlock =\n (input.connection && input.connection.targetBlock() ?\n input.connection.targetBlock() as BlockSvg :\n null);\n\n if (this.connectedBlock) {\n const bBox = this.connectedBlock.getHeightWidth();\n this.connectedBlockWidth = bBox.width;\n this.connectedBlockHeight = bBox.height;\n } else {\n this.connectedBlockWidth = 0;\n this.connectedBlockHeight = 0;\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class representing external value inputs with connections on a\n * rendered block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.ExternalValueInput');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Input} from '../../input.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {InputConnection} from './input_connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space an external value input\n * takes up during rendering\n *\n * @alias Blockly.blockRendering.ExternalValueInput\n */\nexport class ExternalValueInput extends InputConnection {\n override height = 0;\n override width: number;\n override connectionOffsetY: number;\n connectionHeight: number;\n connectionWidth: number;\n\n /**\n * @param constants The rendering constants provider.\n * @param input The external value input to measure and store information for.\n * @internal\n */\n constructor(constants: ConstantProvider, input: Input) {\n super(constants, input);\n this.type |= Types.EXTERNAL_VALUE_INPUT;\n if (!this.connectedBlock) {\n this.height = this.shape.height as number;\n } else {\n this.height = this.connectedBlockHeight -\n this.constants_.TAB_OFFSET_FROM_TOP - this.constants_.MEDIUM_PADDING;\n }\n\n this.width = this.shape.width as\n number + this.constants_.EXTERNAL_VALUE_INPUT_PADDING;\n\n this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;\n\n this.connectionHeight = this.shape.height as number;\n\n this.connectionWidth = this.shape.width as number;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing a field in a row of a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Field');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Field as BlocklyField} from '../../field.js';\nimport type {Input} from '../../input.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space a field takes up during\n * rendering\n *\n * @alias Blockly.blockRendering.Field\n */\nexport class Field extends Measurable {\n isEditable: boolean;\n flipRtl: boolean;\n override height: number;\n override width: number;\n\n /**\n * @param constants The rendering constants provider.\n * @param field The field to measure and store information for.\n * @param parentInput The parent input for the field.\n * @internal\n */\n constructor(\n constants: ConstantProvider, public field: BlocklyField,\n public parentInput: Input) {\n super(constants);\n\n this.isEditable = field.EDITABLE;\n\n this.flipRtl = field.getFlipRtl();\n this.type |= Types.FIELD;\n\n const size = this.field.getSize();\n\n this.height = size.height;\n\n this.width = size.width;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing a hat in a row of a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Hat');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space a hat takes up during\n * rendering.\n *\n * @alias Blockly.blockRendering.Hat\n */\nexport class Hat extends Measurable {\n ascenderHeight: number;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n this.type |= Types.HAT;\n\n this.height = this.constants_.START_HAT.height;\n this.width = this.constants_.START_HAT.width;\n\n this.ascenderHeight = this.height;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing an icon in a row of a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Icon');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Icon as BlocklyIcon} from '../../icon.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space an icon takes up during\n * rendering\n *\n * @alias Blockly.blockRendering.Icon\n */\nexport class Icon extends Measurable {\n isVisible: boolean;\n flipRtl = false;\n\n /**\n * An object containing information about the space an icon takes up during\n * rendering\n *\n * @param constants The rendering constants provider.\n * @param icon The icon to measure and store information for.\n * @internal\n */\n constructor(constants: ConstantProvider, public icon: BlocklyIcon) {\n super(constants);\n\n this.isVisible = icon.isVisible();\n this.type |= Types.ICON;\n\n const size = icon.getCorrectedSize();\n this.height = size.height;\n this.width = size.width;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing a spacer in a row of a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.InRowSpacer');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about a spacer between two elements on a\n * row.\n *\n * @alias Blockly.blockRendering.InRowSpacer\n */\nexport class InRowSpacer extends Measurable {\n /**\n * @param constants The rendering constants provider.\n * @param width The width of the spacer.\n * @internal\n */\n constructor(constants: ConstantProvider, width: number) {\n super(constants);\n this.type |= Types.SPACER | Types.IN_ROW_SPACER;\n this.width = width;\n this.height = this.constants_.SPACER_DEFAULT_HEIGHT;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class representing inline inputs with connections on a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.InlineInput');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Input} from '../../input.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {InputConnection} from './input_connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space an inline input takes up\n * during rendering\n *\n * @alias Blockly.blockRendering.InlineInput\n */\nexport class InlineInput extends InputConnection {\n connectionHeight: number;\n connectionWidth: number;\n\n /**\n * @param constants The rendering constants provider.\n * @param input The inline input to measure and store information for.\n * @internal\n */\n constructor(constants: ConstantProvider, input: Input) {\n super(constants, input);\n this.type |= Types.INLINE_INPUT;\n\n if (!this.connectedBlock) {\n this.height = this.constants_.EMPTY_INLINE_INPUT_HEIGHT;\n this.width = this.constants_.EMPTY_INLINE_INPUT_PADDING;\n } else {\n // We allow the dark path to show on the parent block so that the child\n // block looks embossed. This takes up an extra pixel in both x and y.\n this.width = this.connectedBlockWidth;\n this.height = this.connectedBlockHeight;\n }\n\n this.connectionHeight = !this.isDynamicShape ?\n this.shape.height as number :\n (this.shape.height as (p1: number) => number)(this.height);\n\n this.connectionWidth = !this.isDynamicShape ?\n this.shape.width as number :\n (this.shape.width as (p1: number) => number)(this.height);\n if (!this.connectedBlock) {\n this.width += this.connectionWidth * (this.isDynamicShape ? 2 : 1);\n }\n\n this.connectionOffsetY = 'connectionOffsetY' in this.shape ?\n this.shape.connectionOffsetY(this.connectionHeight) :\n this.constants_.TAB_OFFSET_FROM_TOP;\n\n this.connectionOffsetX = 'connectionOffsetX' in this.shape ?\n this.shape.connectionOffsetX(this.connectionWidth) :\n 0;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class representing statement inputs with connections on a\n * rendered block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.StatementInput');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Input} from '../../input.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {InputConnection} from './input_connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space a statement input takes up\n * during rendering\n *\n * @alias Blockly.blockRendering.StatementInput\n */\nexport class StatementInput extends InputConnection {\n /**\n * @param constants The rendering constants provider.\n * @param input The statement input to measure and store information for.\n * @internal\n */\n constructor(constants: ConstantProvider, input: Input) {\n super(constants, input);\n this.type |= Types.STATEMENT_INPUT;\n\n if (!this.connectedBlock) {\n this.height = this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;\n } else {\n // We allow the dark path to show on the parent block so that the child\n // block looks embossed. This takes up an extra pixel in both x and y.\n this.height =\n this.connectedBlockHeight + this.constants_.STATEMENT_BOTTOM_SPACER;\n }\n this.width = this.constants_.STATEMENT_INPUT_NOTCH_OFFSET +\n (this.shape.width as number);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a row that holds one or more inputs on a\n * rendered block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.InputRow');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {ExternalValueInput} from './external_value_input.js';\nimport {InputConnection} from './input_connection.js';\nimport {Row} from './row.js';\nimport {StatementInput} from './statement_input.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about a row that holds one or more inputs.\n *\n * @alias Blockly.blockRendering.InputRow\n */\nexport class InputRow extends Row {\n /**\n * The total width of all blocks connected to this row.\n *\n * @internal\n */\n connectedBlockWidths = 0;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n this.type |= Types.INPUT_ROW;\n }\n\n /**\n * Inspect all subcomponents and populate all size properties on the row.\n *\n * @internal\n */\n override measure() {\n this.width = this.minWidth;\n this.height = this.minHeight;\n let connectedBlockWidths = 0;\n for (let i = 0; i < this.elements.length; i++) {\n const elem = this.elements[i];\n this.width += elem.width;\n if (Types.isInput(elem) && elem instanceof InputConnection) {\n if (Types.isStatementInput(elem) && elem instanceof StatementInput) {\n connectedBlockWidths += elem.connectedBlockWidth;\n } else if (\n Types.isExternalInput(elem) && elem instanceof ExternalValueInput &&\n elem.connectedBlockWidth !== 0) {\n connectedBlockWidths +=\n elem.connectedBlockWidth - elem.connectionWidth;\n }\n }\n if (!Types.isSpacer(elem)) {\n this.height = Math.max(this.height, elem.height);\n }\n }\n this.connectedBlockWidths = connectedBlockWidths;\n this.widthWithConnectedBlocks = this.width + connectedBlockWidths;\n }\n\n override endsWithElemSpacer() {\n return !this.hasExternalInput && !this.hasStatement;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing a jagged edge in a row of a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.JaggedEdge');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the jagged edge of a collapsed block\n * takes up during rendering\n *\n * @alias Blockly.blockRendering.JaggedEdge\n */\nexport class JaggedEdge extends Measurable {\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n this.type |= Types.JAGGED_EDGE;\n this.height = this.constants_.JAGGED_TEETH.height;\n this.width = this.constants_.JAGGED_TEETH.width;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class representing the space a next connection takes up during\n * rendering.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.NextConnection');\n\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space a next connection takes\n * up during rendering.\n *\n * @alias Blockly.blockRendering.NextConnection\n */\nexport class NextConnection extends Connection {\n /**\n * @param constants The rendering constants provider.\n * @param connectionModel The connection object on the block that this\n * represents.\n * @internal\n */\n constructor(\n constants: ConstantProvider, connectionModel: RenderedConnection) {\n super(constants, connectionModel);\n this.type |= Types.NEXT_CONNECTION;\n this.height = this.shape.height as number;\n this.width = this.shape.width as number;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class representing the space a output connection takes up\n * during rendering.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.OutputConnection');\n\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space an output connection takes\n * up during rendering.\n *\n * @alias Blockly.blockRendering.OutputConnection\n */\nexport class OutputConnection extends Connection {\n startX: number;\n connectionOffsetY: number;\n connectionOffsetX = 0;\n\n /**\n * @param constants The rendering constants provider.\n * @param connectionModel The connection object on the block that this\n * represents.\n * @internal\n */\n constructor(\n constants: ConstantProvider, connectionModel: RenderedConnection) {\n super(constants, connectionModel);\n this.type |= Types.OUTPUT_CONNECTION;\n\n this.height = !this.isDynamicShape ? this.shape.height as number : 0;\n this.width = !this.isDynamicShape ? this.shape.width as number : 0;\n\n this.startX = this.width;\n\n this.connectionOffsetY = this.constants_.TAB_OFFSET_FROM_TOP;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class representing the space a previous connection takes up\n * during rendering.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.PreviousConnection');\n\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space a previous connection takes\n * up during rendering.\n *\n * @alias Blockly.blockRendering.PreviousConnection\n */\nexport class PreviousConnection extends Connection {\n /**\n * @param constants The rendering constants provider.\n * @param connectionModel The connection object on the block that this\n * represents.\n * @internal\n */\n constructor(\n constants: ConstantProvider, connectionModel: RenderedConnection) {\n super(constants, connectionModel);\n this.type |= Types.PREVIOUS_CONNECTION;\n this.height = this.shape.height as number;\n this.width = this.shape.width as number;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing a round corner in a row of a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.RoundCorner');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space a rounded corner takes up\n * during rendering.\n *\n * @alias Blockly.blockRendering.RoundCorner\n */\nexport class RoundCorner extends Measurable {\n /**\n * @param constants The rendering constants provider.\n * @param opt_position The position of this corner.\n * @internal\n */\n constructor(constants: ConstantProvider, opt_position?: string) {\n super(constants);\n this.type =\n (!opt_position || opt_position === 'left' ? Types.LEFT_ROUND_CORNER :\n Types.RIGHT_ROUND_CORNER) |\n Types.CORNER;\n this.width = this.constants_.CORNER_RADIUS;\n // The rounded corner extends into the next row by 4 so we only take the\n // height that is aligned with this row.\n this.height = this.constants_.CORNER_RADIUS / 2;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a spacer between two rows.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.SpacerRow');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {InRowSpacer} from './in_row_spacer.js';\nimport {Row} from './row.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about a spacer between two rows.\n *\n * @alias Blockly.blockRendering.SpacerRow\n */\nexport class SpacerRow extends Row {\n followsStatement = false;\n\n precedesStatement = false;\n\n override widthWithConnectedBlocks = 0;\n override elements: InRowSpacer[];\n\n /**\n * @param constants The rendering constants provider.\n * @param height The height of the spacer.\n * @param width The width of the spacer.\n * @internal\n */\n constructor(\n constants: ConstantProvider, public override height: number,\n public override width: number) {\n super(constants);\n this.type |= Types.SPACER | Types.BETWEEN_ROW_SPACER;\n\n this.elements = [new InRowSpacer(this.constants_, width)];\n }\n\n override measure() {}\n}\n// NOP. Width and height were set at creation.\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing a square corner in a row of a rendered\n * block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.SquareCorner');\n\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about the space a square corner takes up\n * during rendering.\n *\n * @alias Blockly.blockRendering.SquareCorner\n */\nexport class SquareCorner extends Measurable {\n /**\n * @param constants The rendering constants provider.\n * @param opt_position The position of this corner.\n * @internal\n */\n constructor(constants: ConstantProvider, opt_position?: string) {\n super(constants);\n this.type =\n (!opt_position || opt_position === 'left' ? Types.LEFT_SQUARE_CORNER :\n Types.RIGHT_SQUARE_CORNER) |\n Types.CORNER;\n this.height = this.constants_.NO_PADDING;\n this.width = this.constants_.NO_PADDING;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a top row on a rendered block.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.TopRow');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\nimport {Hat} from './hat.js';\nimport type {PreviousConnection} from './previous_connection.js';\nimport {Row} from './row.js';\nimport {Types} from './types.js';\n\n\n/**\n * An object containing information about what elements are in the top row of a\n * block as well as sizing information for the top row.\n * Elements in a top row can consist of corners, hats, spacers, and previous\n * connections.\n * After this constructor is called, the row will contain all non-spacer\n * elements it needs.\n *\n * @alias Blockly.blockRendering.TopRow\n */\nexport class TopRow extends Row {\n /**\n * The starting point for drawing the row, in the y direction.\n * This allows us to draw hats and similar shapes that don't start at the\n * origin. Must be non-negative (see #2820).\n *\n * @internal\n */\n capline = 0;\n\n /** How much the row extends up above its capline. */\n ascenderHeight = 0;\n\n /** Whether the block has a previous connection. */\n hasPreviousConnection = false;\n\n /** The previous connection on the block, if any. */\n connection: PreviousConnection|null = null;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n\n this.type |= Types.TOP_ROW;\n }\n\n /**\n * Returns whether or not the top row has a left square corner.\n *\n * @param block The block whose top row this represents.\n * @returns Whether or not the top row has a left square corner.\n * @internal\n */\n hasLeftSquareCorner(block: BlockSvg): boolean {\n const hasHat =\n (block.hat ? block.hat === 'cap' : this.constants_.ADD_START_HATS) &&\n !block.outputConnection && !block.previousConnection;\n const prevBlock = block.getPreviousBlock();\n\n return !!block.outputConnection || hasHat ||\n (prevBlock ? prevBlock.getNextBlock() === block : false);\n }\n\n /**\n * Returns whether or not the top row has a right square corner.\n *\n * @param _block The block whose top row this represents.\n * @returns Whether or not the top row has a right square corner.\n */\n hasRightSquareCorner(_block: BlockSvg): boolean {\n return true;\n }\n\n override measure() {\n let height = 0;\n let width = 0;\n let ascenderHeight = 0;\n for (let i = 0; i < this.elements.length; i++) {\n const elem = this.elements[i];\n width += elem.width;\n if (!Types.isSpacer(elem)) {\n if (Types.isHat(elem) && elem instanceof Hat) {\n ascenderHeight = Math.max(ascenderHeight, elem.ascenderHeight);\n } else {\n height = Math.max(height, elem.height);\n }\n }\n }\n this.width = Math.max(this.minWidth, width);\n this.height = Math.max(this.minHeight, height) + ascenderHeight;\n this.ascenderHeight = ascenderHeight;\n this.capline = this.ascenderHeight;\n this.widthWithConnectedBlocks = this.width;\n }\n\n override startsWithElemSpacer() {\n return false;\n }\n\n override endsWithElemSpacer() {\n return false;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for rendering debug graphics.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Debug');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {ConnectionType} from '../../connection_type.js';\nimport {FieldLabel} from '../../field_label.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\nimport type {Measurable} from '../measurables/base.js';\nimport {Field} from '../measurables/field.js';\nimport type {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport {InputConnection} from '../measurables/input_connection.js';\nimport type {Row} from '../measurables/row.js';\nimport {Types} from '../measurables/types.js';\nimport type {RenderInfo as ZelosInfo} from '../zelos/info.js';\n\nimport type {ConstantProvider} from './constants.js';\nimport type {RenderInfo} from './info.js';\n\n\n/**\n * An object that renders rectangles and dots for debugging rendering code.\n *\n * @alias Blockly.blockRendering.Debug\n */\nexport class Debug {\n /**\n * Configuration object containing booleans to enable and disable debug\n * rendering of specific rendering components.\n */\n static config = {\n rowSpacers: true,\n elemSpacers: true,\n rows: true,\n elems: true,\n connections: true,\n blockBounds: true,\n connectedBlockBounds: true,\n render: true,\n };\n\n /** An array of SVG elements that have been created by this object. */\n private debugElements_: SVGElement[] = [];\n\n /**\n * The SVG root of the block that is being rendered. Debug elements will\n * be attached to this root.\n */\n private svgRoot_: SVGElement|null = null;\n\n private randomColour_ = '';\n\n /**\n * @param constants The renderer's constants.\n * @internal\n */\n constructor(private readonly constants: ConstantProvider) {}\n\n /**\n * Remove all elements the this object created on the last pass.\n *\n * @internal\n */\n clearElems() {\n for (let i = 0; i < this.debugElements_.length; i++) {\n const elem = this.debugElements_[i];\n dom.removeNode(elem);\n }\n\n this.debugElements_ = [];\n }\n\n /**\n * Draw a debug rectangle for a spacer (empty) row.\n *\n * @param row The row to render.\n * @param cursorY The y position of the top of the row.\n * @param isRtl Whether the block is rendered RTL.\n * @internal\n */\n drawSpacerRow(row: Row, cursorY: number, isRtl: boolean) {\n if (!Debug.config.rowSpacers) {\n return;\n }\n\n const height = Math.abs(row.height);\n const isNegativeSpacing = row.height < 0;\n if (isNegativeSpacing) {\n cursorY -= height;\n }\n\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'rowSpacerRect blockRenderDebug',\n 'x': isRtl ? -(row.xPos + row.width) : row.xPos,\n 'y': cursorY,\n 'width': row.width,\n 'height': height,\n 'stroke': isNegativeSpacing ? 'black' : 'blue',\n 'fill': 'blue',\n 'fill-opacity': '0.5',\n 'stroke-width': '1px',\n },\n this.svgRoot_));\n }\n\n /**\n * Draw a debug rectangle for a horizontal spacer.\n *\n * @param elem The spacer to render.\n * @param rowHeight The height of the container row.\n * @param isRtl Whether the block is rendered RTL.\n * @internal\n */\n drawSpacerElem(elem: InRowSpacer, rowHeight: number, isRtl: boolean) {\n if (!Debug.config.elemSpacers) {\n return;\n }\n\n const width = Math.abs(elem.width);\n const isNegativeSpacing = elem.width < 0;\n let xPos = isNegativeSpacing ? elem.xPos - width : elem.xPos;\n if (isRtl) {\n xPos = -(xPos + width);\n }\n const yPos = elem.centerline - elem.height / 2;\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'elemSpacerRect blockRenderDebug',\n 'x': xPos,\n 'y': yPos,\n 'width': width,\n 'height': elem.height,\n 'stroke': 'pink',\n 'fill': isNegativeSpacing ? 'black' : 'pink',\n 'fill-opacity': '0.5',\n 'stroke-width': '1px',\n },\n this.svgRoot_));\n }\n\n /**\n * Draw a debug rectangle for an in-row element.\n *\n * @param elem The element to render.\n * @param isRtl Whether the block is rendered RTL.\n * @internal\n */\n drawRenderedElem(elem: Measurable, isRtl: boolean) {\n if (Debug.config.elems) {\n let xPos = elem.xPos;\n if (isRtl) {\n xPos = -(xPos + elem.width);\n }\n const yPos = elem.centerline - elem.height / 2;\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'rowRenderingRect blockRenderDebug',\n 'x': xPos,\n 'y': yPos,\n 'width': elem.width,\n 'height': elem.height,\n 'stroke': 'black',\n 'fill': 'none',\n 'stroke-width': '1px',\n },\n this.svgRoot_));\n\n if (Types.isField(elem) && elem instanceof Field &&\n elem.field instanceof FieldLabel) {\n const baseline = this.constants.FIELD_TEXT_BASELINE;\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'rowRenderingRect blockRenderDebug',\n 'x': xPos,\n 'y': yPos + baseline,\n 'width': elem.width,\n 'height': '0.1px',\n 'stroke': 'red',\n 'fill': 'none',\n 'stroke-width': '0.5px',\n },\n this.svgRoot_));\n }\n }\n\n if (Types.isInput(elem) && elem instanceof InputConnection &&\n Debug.config.connections) {\n this.drawConnection(elem.connectionModel);\n }\n }\n\n /**\n * Draw a circle at the location of the given connection. Inputs and outputs\n * share the same colours, as do previous and next. When positioned correctly\n * a connected pair will look like a bullseye.\n *\n * @param conn The connection to circle.\n * @suppress {visibility} Suppress visibility of conn.offsetInBlock_ since\n * this is a debug module.\n * @internal\n */\n drawConnection(conn: RenderedConnection) {\n if (!Debug.config.connections) {\n return;\n }\n\n let colour = '';\n let size = 0;\n let fill = '';\n if (conn.type === ConnectionType.INPUT_VALUE) {\n size = 4;\n colour = 'magenta';\n fill = 'none';\n } else if (conn.type === ConnectionType.OUTPUT_VALUE) {\n size = 2;\n colour = 'magenta';\n fill = colour;\n } else if (conn.type === ConnectionType.NEXT_STATEMENT) {\n size = 4;\n colour = 'goldenrod';\n fill = 'none';\n } else if (conn.type === ConnectionType.PREVIOUS_STATEMENT) {\n size = 2;\n colour = 'goldenrod';\n fill = colour;\n }\n this.debugElements_.push(dom.createSvgElement(\n Svg.CIRCLE, {\n 'class': 'blockRenderDebug',\n 'cx': conn.getOffsetInBlock().x,\n 'cy': conn.getOffsetInBlock().y,\n 'r': size,\n 'fill': fill,\n 'stroke': colour,\n },\n this.svgRoot_));\n }\n\n /**\n * Draw a debug rectangle for a non-empty row.\n *\n * @param row The non-empty row to render.\n * @param cursorY The y position of the top of the row.\n * @param isRtl Whether the block is rendered RTL.\n * @internal\n */\n drawRenderedRow(row: Row, cursorY: number, isRtl: boolean) {\n if (!Debug.config.rows) {\n return;\n }\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'elemRenderingRect blockRenderDebug',\n 'x': isRtl ? -(row.xPos + row.width) : row.xPos,\n 'y': row.yPos,\n 'width': row.width,\n 'height': row.height,\n 'stroke': 'red',\n 'fill': 'none',\n 'stroke-width': '1px',\n },\n this.svgRoot_));\n\n if (Types.isTopOrBottomRow(row)) {\n return;\n }\n\n if (Debug.config.connectedBlockBounds) {\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'connectedBlockWidth blockRenderDebug',\n 'x': isRtl ? -(row.xPos + row.widthWithConnectedBlocks) : row.xPos,\n 'y': row.yPos,\n 'width': row.widthWithConnectedBlocks,\n 'height': row.height,\n 'stroke': this.randomColour_,\n 'fill': 'none',\n 'stroke-width': '1px',\n 'stroke-dasharray': '3,3',\n },\n this.svgRoot_));\n }\n }\n\n /**\n * Draw debug rectangles for a non-empty row and all of its subcomponents.\n *\n * @param row The non-empty row to render.\n * @param cursorY The y position of the top of the row.\n * @param isRtl Whether the block is rendered RTL.\n * @internal\n */\n drawRowWithElements(row: Row, cursorY: number, isRtl: boolean) {\n for (let i = 0; i < row.elements.length; i++) {\n const elem = row.elements[i];\n if (!elem) {\n console.warn('A row has an undefined or null element.', row, elem);\n continue;\n }\n if (Types.isSpacer(elem)) {\n this.drawSpacerElem(elem as InRowSpacer, row.height, isRtl);\n } else {\n this.drawRenderedElem(elem, isRtl);\n }\n }\n this.drawRenderedRow(row, cursorY, isRtl);\n }\n\n /**\n * Draw a debug rectangle around the entire block.\n *\n * @param info Rendering information about the block to debug.\n * @internal\n */\n drawBoundingBox(info: RenderInfo) {\n if (!Debug.config.blockBounds) {\n return;\n }\n // Bounding box without children.\n let xPos = info.RTL ? -info.width : 0;\n const yPos = 0;\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blockBoundingBox blockRenderDebug',\n 'x': xPos,\n 'y': yPos,\n 'width': info.width,\n 'height': info.height,\n 'stroke': 'black',\n 'fill': 'none',\n 'stroke-width': '1px',\n 'stroke-dasharray': '5,5',\n },\n this.svgRoot_));\n\n if (Debug.config.connectedBlockBounds) {\n // Bounding box with children.\n xPos = info.RTL ? -info.widthWithChildren : 0;\n this.debugElements_.push(dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blockRenderDebug',\n 'x': xPos,\n 'y': yPos,\n 'width': info.widthWithChildren,\n 'height': info.height,\n 'stroke': '#DF57BC',\n 'fill': 'none',\n 'stroke-width': '1px',\n 'stroke-dasharray': '3,3',\n },\n this.svgRoot_));\n }\n }\n\n /**\n * Do all of the work to draw debug information for the whole block.\n *\n * @param block The block to draw debug information for.\n * @param info Rendering information about the block to debug.\n * @internal\n */\n drawDebug(block: BlockSvg, info: RenderInfo) {\n this.clearElems();\n this.svgRoot_ = block.getSvgRoot();\n\n this.randomColour_ =\n '#' + Math.floor(Math.random() * 16777215).toString(16);\n\n let cursorY = 0;\n for (let i = 0; i < info.rows.length; i++) {\n const row = info.rows[i];\n if (Types.isBetweenRowSpacer(row)) {\n this.drawSpacerRow(row, cursorY, info.RTL);\n } else {\n this.drawRowWithElements(row, cursorY, info.RTL);\n }\n cursorY += row.height;\n }\n\n if (block.previousConnection) {\n this.drawConnection(block.previousConnection);\n }\n if (block.nextConnection) {\n this.drawConnection(block.nextConnection);\n }\n if (block.outputConnection) {\n this.drawConnection(block.outputConnection);\n }\n /**\n * TODO: Find a better way to do this check without pulling in all of\n * zelos, or just delete this line or the whole debug renderer.\n */\n const maybeZelosInfo = info as ZelosInfo;\n if (maybeZelosInfo.rightSide) {\n this.drawRenderedElem(maybeZelosInfo.rightSide, info.RTL);\n }\n\n this.drawBoundingBox(info);\n\n this.drawRender(block.pathObject.svgPath);\n }\n\n /**\n * Show a debug filter to highlight that a block has been rendered.\n *\n * @param svgPath The block's SVG path.\n * @internal\n */\n drawRender(svgPath: SVGElement) {\n if (!Debug.config.render) {\n return;\n }\n svgPath.setAttribute(\n 'filter', 'url(#' + this.constants.debugFilterId + ')');\n setTimeout(function() {\n svgPath.setAttribute('filter', '');\n }, 100);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for graphically rendering a block as SVG.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Drawer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {Coordinate} from '../../utils.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport {Connection} from '../measurables/connection.js';\nimport type {ExternalValueInput} from '../measurables/external_value_input.js';\nimport type {Field} from '../measurables/field.js';\nimport type {Icon} from '../measurables/icon.js';\nimport type {InlineInput} from '../measurables/inline_input.js';\nimport type {PreviousConnection} from '../measurables/previous_connection.js';\nimport type {Row} from '../measurables/row.js';\nimport {Types} from '../measurables/types.js';\n\nimport {isDynamicShape} from './constants.js';\nimport type {ConstantProvider, Notch, PuzzleTab} from './constants.js';\nimport * as debug from './debug.js';\nimport type {RenderInfo} from './info.js';\n\n\n/**\n * An object that draws a block based on the given rendering information.\n *\n * @alias Blockly.blockRendering.Drawer\n */\nexport class Drawer {\n block_: BlockSvg;\n info_: RenderInfo;\n topLeft_: Coordinate;\n outlinePath_ = '';\n inlinePath_ = '';\n protected constants_: ConstantProvider;\n\n /**\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @internal\n */\n constructor(block: BlockSvg, info: RenderInfo) {\n this.block_ = block;\n this.info_ = info;\n this.topLeft_ = block.getRelativeToSurfaceXY();\n\n /** The renderer's constant provider. */\n this.constants_ = info.getRenderer().getConstants();\n }\n\n /**\n * Draw the block to the workspace. Here \"drawing\" means setting SVG path\n * elements and moving fields, icons, and connections on the screen.\n *\n * The pieces of the paths are pushed into arrays of \"steps\", which are then\n * joined with spaces and set directly on the block. This guarantees that\n * the steps are separated by spaces for improved readability, but isn't\n * required.\n *\n * @internal\n */\n draw() {\n this.hideHiddenIcons_();\n this.drawOutline_();\n this.drawInternals_();\n\n this.block_.pathObject.setPath(this.outlinePath_ + '\\n' + this.inlinePath_);\n if (this.info_.RTL) {\n this.block_.pathObject.flipRTL();\n }\n if (debug.isDebuggerEnabled()) {\n this.block_.renderingDebugger?.drawDebug(this.block_, this.info_);\n }\n this.recordSizeOnBlock_();\n }\n\n /**\n * Save sizing information back to the block\n * Most of the rendering information can be thrown away at the end of the\n * render. Anything that needs to be kept around should be set in this\n * function.\n */\n protected recordSizeOnBlock_() {\n // This is used when the block is reporting its size to anyone else.\n // The dark path adds to the size of the block in both X and Y.\n this.block_.height = this.info_.height;\n this.block_.width = this.info_.widthWithChildren;\n }\n\n /** Hide icons that were marked as hidden. */\n protected hideHiddenIcons_() {\n for (let i = 0, iconInfo; iconInfo = this.info_.hiddenIcons[i]; i++) {\n iconInfo.icon.iconGroup_?.setAttribute('display', 'none');\n }\n }\n\n /** Create the outline of the block. This is a single continuous path. */\n protected drawOutline_() {\n this.drawTop_();\n for (let r = 1; r < this.info_.rows.length - 1; r++) {\n const row = this.info_.rows[r];\n if (row.hasJaggedEdge) {\n this.drawJaggedEdge_(row);\n } else if (row.hasStatement) {\n this.drawStatementInput_(row);\n } else if (row.hasExternalInput) {\n this.drawValueInput_(row);\n } else {\n this.drawRightSideRow_(row);\n }\n }\n this.drawBottom_();\n this.drawLeft_();\n }\n\n /**\n * Add steps for the top corner of the block, taking into account\n * details such as hats and rounded corners.\n */\n protected drawTop_() {\n const topRow = this.info_.topRow;\n const elements = topRow.elements;\n\n this.positionPreviousConnection_();\n this.outlinePath_ += svgPaths.moveBy(topRow.xPos, this.info_.startY);\n for (let i = 0, elem; elem = elements[i]; i++) {\n if (Types.isLeftRoundedCorner(elem)) {\n this.outlinePath_ += this.constants_.OUTSIDE_CORNERS.topLeft;\n } else if (Types.isRightRoundedCorner(elem)) {\n this.outlinePath_ += this.constants_.OUTSIDE_CORNERS.topRight;\n } else if (\n Types.isPreviousConnection(elem) && elem instanceof Connection) {\n this.outlinePath_ +=\n ((elem as PreviousConnection).shape as Notch).pathLeft;\n } else if (Types.isHat(elem)) {\n this.outlinePath_ += this.constants_.START_HAT.path;\n } else if (Types.isSpacer(elem)) {\n this.outlinePath_ += svgPaths.lineOnAxis('h', elem.width);\n }\n }\n // No branch for a square corner, because it's a no-op.\n this.outlinePath_ += svgPaths.lineOnAxis('v', topRow.height);\n }\n\n /**\n * Add steps for the jagged edge of a row on a collapsed block.\n *\n * @param row The row to draw the side of.\n */\n protected drawJaggedEdge_(row: Row) {\n const remainder = row.height - this.constants_.JAGGED_TEETH.height;\n this.outlinePath_ +=\n this.constants_.JAGGED_TEETH.path + svgPaths.lineOnAxis('v', remainder);\n }\n\n /**\n * Add steps for an external value input, rendered as a notch in the side\n * of the block.\n *\n * @param row The row that this input belongs to.\n */\n protected drawValueInput_(row: Row) {\n const input = row.getLastInput() as ExternalValueInput | InlineInput;\n this.positionExternalValueConnection_(row);\n\n const pathDown = isDynamicShape(input.shape) ?\n input.shape.pathDown(input.height) :\n (input.shape as PuzzleTab).pathDown;\n\n this.outlinePath_ += svgPaths.lineOnAxis('H', input.xPos + input.width) +\n pathDown +\n svgPaths.lineOnAxis('v', row.height - input.connectionHeight);\n }\n\n /**\n * Add steps for a statement input.\n *\n * @param row The row that this input belongs to.\n */\n protected drawStatementInput_(row: Row) {\n const input = row.getLastInput();\n if (!input) return;\n // Where to start drawing the notch, which is on the right side in LTR.\n const x = input.xPos + input.notchOffset + (input.shape as Notch).width;\n\n const innerTopLeftCorner = (input.shape as Notch).pathRight +\n svgPaths.lineOnAxis(\n 'h', -(input.notchOffset - this.constants_.INSIDE_CORNERS.width)) +\n this.constants_.INSIDE_CORNERS.pathTop;\n\n const innerHeight = row.height - 2 * this.constants_.INSIDE_CORNERS.height;\n\n this.outlinePath_ += svgPaths.lineOnAxis('H', x) + innerTopLeftCorner +\n svgPaths.lineOnAxis('v', innerHeight) +\n this.constants_.INSIDE_CORNERS.pathBottom +\n svgPaths.lineOnAxis('H', row.xPos + row.width);\n\n this.positionStatementInputConnection_(row);\n }\n\n /**\n * Add steps for the right side of a row that does not have value or\n * statement input connections.\n *\n * @param row The row to draw the side of.\n */\n protected drawRightSideRow_(row: Row) {\n this.outlinePath_ += svgPaths.lineOnAxis('V', row.yPos + row.height);\n }\n\n /**\n * Add steps for the bottom edge of a block, possibly including a notch\n * for the next connection.\n */\n protected drawBottom_() {\n const bottomRow = this.info_.bottomRow;\n const elems = bottomRow.elements;\n this.positionNextConnection_();\n\n let rightCornerYOffset = 0;\n let outlinePath = '';\n for (let i = elems.length - 1, elem; elem = elems[i]; i--) {\n if (Types.isNextConnection(elem) && elem instanceof Connection) {\n outlinePath += (elem.shape as Notch).pathRight;\n } else if (Types.isLeftSquareCorner(elem)) {\n outlinePath += svgPaths.lineOnAxis('H', bottomRow.xPos);\n } else if (Types.isLeftRoundedCorner(elem)) {\n outlinePath += this.constants_.OUTSIDE_CORNERS.bottomLeft;\n } else if (Types.isRightRoundedCorner(elem)) {\n outlinePath += this.constants_.OUTSIDE_CORNERS.bottomRight;\n rightCornerYOffset = this.constants_.OUTSIDE_CORNERS.rightHeight;\n } else if (Types.isSpacer(elem)) {\n outlinePath += svgPaths.lineOnAxis('h', elem.width * -1);\n }\n }\n\n this.outlinePath_ +=\n svgPaths.lineOnAxis('V', bottomRow.baseline - rightCornerYOffset);\n this.outlinePath_ += outlinePath;\n }\n\n /**\n * Add steps for the left side of the block, which may include an output\n * connection\n */\n protected drawLeft_() {\n const outputConnection = this.info_.outputConnection;\n this.positionOutputConnection_();\n\n if (outputConnection) {\n const tabBottom =\n outputConnection.connectionOffsetY + outputConnection.height;\n const pathUp = isDynamicShape(outputConnection.shape) ?\n outputConnection.shape.pathUp(outputConnection.height) :\n (outputConnection.shape as PuzzleTab).pathUp;\n\n // Draw a line up to the bottom of the tab.\n this.outlinePath_ += svgPaths.lineOnAxis('V', tabBottom) + pathUp;\n }\n // Close off the path. This draws a vertical line up to the start of the\n // block's path, which may be either a rounded or a sharp corner.\n this.outlinePath_ += 'z';\n }\n\n /**\n * Draw the internals of the block: inline inputs, fields, and icons. These\n * do not depend on the outer path for placement.\n */\n protected drawInternals_() {\n for (let i = 0, row; row = this.info_.rows[i]; i++) {\n for (let j = 0, elem; elem = row.elements[j]; j++) {\n if (Types.isInlineInput(elem)) {\n this.drawInlineInput_(elem as InlineInput);\n } else if (Types.isIcon(elem) || Types.isField(elem)) {\n this.layoutField_(elem as Field | Icon);\n }\n }\n }\n }\n\n /**\n * Push a field or icon's new position to its SVG root.\n *\n * @param fieldInfo The rendering information for the field or icon.\n */\n protected layoutField_(fieldInfo: Icon|Field) {\n const svgGroup = Types.isField(fieldInfo) ?\n (fieldInfo as Field).field.getSvgRoot()! :\n (fieldInfo as Icon).icon.iconGroup_!; // Never null in rendered case.\n\n const yPos = fieldInfo.centerline - fieldInfo.height / 2;\n let xPos = fieldInfo.xPos;\n let scale = '';\n if (this.info_.RTL) {\n xPos = -(xPos + fieldInfo.width);\n if (fieldInfo.flipRtl) {\n xPos += fieldInfo.width;\n scale = 'scale(-1 1)';\n }\n }\n if (Types.isIcon(fieldInfo)) {\n svgGroup.setAttribute('display', 'block');\n svgGroup.setAttribute(\n 'transform', 'translate(' + xPos + ',' + yPos + ')');\n (fieldInfo as Icon).icon.computeIconLocation();\n } else {\n svgGroup.setAttribute(\n 'transform', 'translate(' + xPos + ',' + yPos + ')' + scale);\n }\n\n if (this.info_.isInsertionMarker) {\n // Fields and icons are invisible on insertion marker. They still have to\n // be rendered so that the block can be sized correctly.\n svgGroup.setAttribute('display', 'none');\n }\n }\n\n /**\n * Add steps for an inline input.\n *\n * @param input The information about the input to render.\n */\n protected drawInlineInput_(input: InlineInput) {\n const width = input.width;\n const height = input.height;\n const yPos = input.centerline - height / 2;\n\n const connectionTop = input.connectionOffsetY;\n const connectionBottom = input.connectionHeight + connectionTop;\n const connectionRight = input.xPos + input.connectionWidth;\n\n this.inlinePath_ += svgPaths.moveTo(connectionRight, yPos) +\n svgPaths.lineOnAxis('v', connectionTop) +\n (input.shape as PuzzleTab).pathDown +\n svgPaths.lineOnAxis('v', height - connectionBottom) +\n svgPaths.lineOnAxis('h', width - input.connectionWidth) +\n svgPaths.lineOnAxis('v', -height) + 'z';\n\n this.positionInlineInputConnection_(input);\n }\n\n /**\n * Position the connection on an inline value input, taking into account\n * RTL and the small gap between the parent block and child block which lets\n * the parent block's dark path show through.\n *\n * @param input The information about the input that the connection is on.\n */\n protected positionInlineInputConnection_(input: InlineInput) {\n const yPos = input.centerline - input.height / 2;\n // Move the connection.\n if (input.connectionModel) {\n // xPos already contains info about startX\n let connX = input.xPos + input.connectionWidth + input.connectionOffsetX;\n if (this.info_.RTL) {\n connX *= -1;\n }\n input.connectionModel.setOffsetInBlock(\n connX, yPos + input.connectionOffsetY);\n }\n }\n\n /**\n * Position the connection on a statement input, taking into account\n * RTL and the small gap between the parent block and child block which lets\n * the parent block's dark path show through.\n *\n * @param row The row that the connection is on.\n */\n protected positionStatementInputConnection_(row: Row) {\n const input = row.getLastInput();\n if (input?.connectionModel) {\n let connX = row.xPos + row.statementEdge + input.notchOffset;\n if (this.info_.RTL) {\n connX *= -1;\n }\n input.connectionModel.setOffsetInBlock(connX, row.yPos);\n }\n }\n\n /**\n * Position the connection on an external value input, taking into account\n * RTL and the small gap between the parent block and child block which lets\n * the parent block's dark path show through.\n *\n * @param row The row that the connection is on.\n */\n protected positionExternalValueConnection_(row: Row) {\n const input = row.getLastInput();\n if (input && input.connectionModel) {\n let connX = row.xPos + row.width;\n if (this.info_.RTL) {\n connX *= -1;\n }\n input.connectionModel.setOffsetInBlock(connX, row.yPos);\n }\n }\n\n /** Position the previous connection on a block. */\n protected positionPreviousConnection_() {\n const topRow = this.info_.topRow;\n if (topRow.connection) {\n const x = topRow.xPos + topRow.notchOffset;\n const connX = this.info_.RTL ? -x : x;\n topRow.connection.connectionModel.setOffsetInBlock(connX, 0);\n }\n }\n\n /** Position the next connection on a block. */\n protected positionNextConnection_() {\n const bottomRow = this.info_.bottomRow;\n\n if (bottomRow.connection) {\n const connInfo = bottomRow.connection;\n const x = connInfo.xPos; // Already contains info about startX.\n const connX = this.info_.RTL ? -x : x;\n connInfo.connectionModel.setOffsetInBlock(connX, bottomRow.baseline);\n }\n }\n\n /** Position the output connection on a block. */\n protected positionOutputConnection_() {\n if (this.info_.outputConnection) {\n const x =\n this.info_.startX + this.info_.outputConnection.connectionOffsetX;\n const connX = this.info_.RTL ? -x : x;\n this.block_.outputConnection.setOffsetInBlock(\n connX, this.info_.outputConnection.connectionOffsetY);\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for graphically rendering a block as SVG.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.RenderInfo');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {Align, Input} from '../../input.js';\nimport {inputTypes} from '../../input_types.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {Measurable} from '../measurables/base.js';\nimport {BottomRow} from '../measurables/bottom_row.js';\nimport {ExternalValueInput} from '../measurables/external_value_input.js';\nimport {Field} from '../measurables/field.js';\nimport {Hat} from '../measurables/hat.js';\nimport {Icon} from '../measurables/icon.js';\nimport {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport {InlineInput} from '../measurables/inline_input.js';\nimport {InputRow} from '../measurables/input_row.js';\nimport {JaggedEdge} from '../measurables/jagged_edge.js';\nimport {NextConnection} from '../measurables/next_connection.js';\nimport {OutputConnection} from '../measurables/output_connection.js';\nimport {PreviousConnection} from '../measurables/previous_connection.js';\nimport {RoundCorner} from '../measurables/round_corner.js';\nimport type {Row} from '../measurables/row.js';\nimport {SpacerRow} from '../measurables/spacer_row.js';\nimport {SquareCorner} from '../measurables/square_corner.js';\nimport {StatementInput} from '../measurables/statement_input.js';\nimport {TopRow} from '../measurables/top_row.js';\nimport {Types} from '../measurables/types.js';\n\nimport type {ConstantProvider} from './constants.js';\nimport type {Renderer} from './renderer.js';\n\n\n/**\n * An object containing all sizing information needed to draw this block.\n *\n * This measure pass does not propagate changes to the block (although fields\n * may choose to rerender when getSize() is called). However, calling it\n * repeatedly may be expensive.\n *\n * @alias Blockly.blockRendering.RenderInfo\n */\nexport class RenderInfo {\n block_: BlockSvg;\n protected constants_: ConstantProvider;\n outputConnection: OutputConnection|null;\n isInline: boolean;\n isCollapsed: boolean;\n isInsertionMarker: boolean;\n RTL: boolean;\n\n /** The block renderer in use. */\n protected readonly renderer_!: Renderer;\n\n /** The height of the rendered block, including child blocks. */\n height = 0;\n\n /** The width of the rendered block, including child blocks. */\n widthWithChildren = 0;\n\n /**\n * The width of the rendered block, excluding child blocks. This is the\n * right edge of the block when rendered LTR.\n */\n width = 0;\n statementEdge = 0;\n\n /** An array of Row objects containing sizing information. */\n rows: Row[] = [];\n\n /** An array of input rows on the block. */\n inputRows: InputRow[] = [];\n\n /** An array of measurable objects containing hidden icons. */\n hiddenIcons: Icon[] = [];\n topRow: TopRow;\n bottomRow: BottomRow;\n\n // The position of the start point for drawing, relative to the block's\n // location.\n startX = 0;\n startY = 0;\n\n /**\n * @param renderer The renderer in use.\n * @param block The block to measure.\n * @internal\n */\n constructor(renderer: Renderer, block: BlockSvg) {\n this.renderer_ = renderer;\n\n this.block_ = block;\n\n /** The renderer's constant provider. */\n this.constants_ = this.renderer_.getConstants();\n\n /**\n * A measurable representing the output connection if the block has one.\n * Otherwise null.\n */\n this.outputConnection = block.outputConnection ?\n new OutputConnection(this.constants_, block.outputConnection) :\n null;\n\n /**\n * Whether the block should be rendered as a single line, either because\n * it's inline or because it has been collapsed.\n */\n this.isInline = block.getInputsInline() && !block.isCollapsed();\n\n /** Whether the block is collapsed. */\n this.isCollapsed = block.isCollapsed();\n\n /**\n * Whether the block is an insertion marker. Insertion markers are the same\n * shape as normal blocks, but don't show fields.\n */\n this.isInsertionMarker = block.isInsertionMarker();\n\n /** True if the block should be rendered right-to-left. */\n this.RTL = block.RTL;\n\n /**\n * An object with rendering information about the top row of the block.\n */\n this.topRow = new TopRow(this.constants_);\n\n /**\n * An object with rendering information about the bottom row of the block.\n */\n this.bottomRow = new BottomRow(this.constants_);\n }\n\n /**\n * Get the block renderer in use.\n *\n * @returns The block renderer in use.\n * @internal\n */\n getRenderer(): Renderer {\n return this.renderer_;\n }\n\n /**\n * Populate and return an object containing all sizing information needed to\n * draw this block.\n *\n * This measure pass does not propagate changes to the block (although fields\n * may choose to rerender when getSize() is called). However, calling it\n * repeatedly may be expensive.\n *\n * @internal\n */\n measure() {\n this.createRows_();\n this.addElemSpacing_();\n this.addRowSpacing_();\n this.computeBounds_();\n this.alignRowElements_();\n this.finalize_();\n }\n\n /**\n * Create rows of Measurable objects representing all renderable parts of the\n * block.\n */\n protected createRows_() {\n this.populateTopRow_();\n this.rows.push(this.topRow);\n let activeRow = new InputRow(this.constants_);\n this.inputRows.push(activeRow);\n\n // Icons always go on the first row, before anything else.\n const icons = this.block_.getIcons();\n for (let i = 0, icon; icon = icons[i]; i++) {\n const iconInfo = new Icon(this.constants_, icon);\n if (this.isCollapsed && icon.collapseHidden) {\n this.hiddenIcons.push(iconInfo);\n } else {\n activeRow.elements.push(iconInfo);\n }\n }\n\n let lastInput = undefined;\n // Loop across all of the inputs on the block, creating objects for anything\n // that needs to be rendered and breaking the block up into visual rows.\n for (let i = 0, input; input = this.block_.inputList[i]; i++) {\n if (!input.isVisible()) {\n continue;\n }\n if (this.shouldStartNewRow_(input, lastInput)) {\n // Finish this row and create a new one.\n this.rows.push(activeRow);\n activeRow = new InputRow(this.constants_);\n this.inputRows.push(activeRow);\n }\n\n // All of the fields in an input go on the same row.\n for (let j = 0, field; field = input.fieldRow[j]; j++) {\n activeRow.elements.push(new Field(this.constants_, field, input));\n }\n this.addInput_(input, activeRow);\n lastInput = input;\n }\n\n if (this.isCollapsed) {\n activeRow.hasJaggedEdge = true;\n activeRow.elements.push(new JaggedEdge(this.constants_));\n }\n\n if (activeRow.elements.length || activeRow.hasDummyInput) {\n this.rows.push(activeRow);\n }\n this.populateBottomRow_();\n this.rows.push(this.bottomRow);\n }\n\n /**\n * Create all non-spacer elements that belong on the top row.\n *\n * @internal\n */\n populateTopRow_() {\n const hasPrevious = !!this.block_.previousConnection;\n const hasHat = (this.block_.hat ? this.block_.hat === 'cap' :\n this.constants_.ADD_START_HATS) &&\n !this.outputConnection && !hasPrevious;\n\n let cornerClass = this.topRow.hasLeftSquareCorner(this.block_) ?\n SquareCorner :\n RoundCorner;\n this.topRow.elements.push(new cornerClass(this.constants_));\n\n if (hasHat) {\n const hat = new Hat(this.constants_);\n this.topRow.elements.push(hat);\n this.topRow.capline = hat.ascenderHeight;\n } else if (hasPrevious) {\n this.topRow.hasPreviousConnection = true;\n this.topRow.connection = new PreviousConnection(\n this.constants_,\n (this.block_.previousConnection as RenderedConnection));\n this.topRow.elements.push(this.topRow.connection);\n }\n\n const precedesStatement = this.block_.inputList.length &&\n this.block_.inputList[0].type === inputTypes.STATEMENT;\n\n // This is the minimum height for the row. If one of its elements has a\n // greater height it will be overwritten in the compute pass.\n if (precedesStatement && !this.block_.isCollapsed()) {\n this.topRow.minHeight =\n this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT;\n } else {\n this.topRow.minHeight = this.constants_.TOP_ROW_MIN_HEIGHT;\n }\n\n cornerClass = this.topRow.hasRightSquareCorner(this.block_) ? SquareCorner :\n RoundCorner;\n this.topRow.elements.push(new cornerClass(this.constants_, 'right'));\n }\n\n /**\n * Create all non-spacer elements that belong on the bottom row.\n *\n * @internal\n */\n populateBottomRow_() {\n this.bottomRow.hasNextConnection = !!this.block_.nextConnection;\n\n const followsStatement = this.block_.inputList.length &&\n this.block_.inputList[this.block_.inputList.length - 1].type ===\n inputTypes.STATEMENT;\n\n // This is the minimum height for the row. If one of its elements has a\n // greater height it will be overwritten in the compute pass.\n if (followsStatement) {\n this.bottomRow.minHeight =\n this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT;\n } else {\n this.bottomRow.minHeight = this.constants_.BOTTOM_ROW_MIN_HEIGHT;\n }\n\n const leftSquareCorner = this.bottomRow.hasLeftSquareCorner(this.block_);\n\n if (leftSquareCorner) {\n this.bottomRow.elements.push(new SquareCorner(this.constants_));\n } else {\n this.bottomRow.elements.push(new RoundCorner(this.constants_));\n }\n\n if (this.bottomRow.hasNextConnection) {\n this.bottomRow.connection = new NextConnection(\n this.constants_, (this.block_.nextConnection as RenderedConnection));\n this.bottomRow.elements.push(this.bottomRow.connection);\n }\n\n const rightSquareCorner = this.bottomRow.hasRightSquareCorner(this.block_);\n\n if (rightSquareCorner) {\n this.bottomRow.elements.push(new SquareCorner(this.constants_, 'right'));\n } else {\n this.bottomRow.elements.push(new RoundCorner(this.constants_, 'right'));\n }\n }\n\n /**\n * Add an input element to the active row, if needed, and record the type of\n * the input on the row.\n *\n * @param input The input to record information about.\n * @param activeRow The row that is currently being populated.\n */\n protected addInput_(input: Input, activeRow: Row) {\n // Non-dummy inputs have visual representations onscreen.\n if (this.isInline && input.type === inputTypes.VALUE) {\n activeRow.elements.push(new InlineInput(this.constants_, input));\n activeRow.hasInlineInput = true;\n } else if (input.type === inputTypes.STATEMENT) {\n activeRow.elements.push(new StatementInput(this.constants_, input));\n activeRow.hasStatement = true;\n } else if (input.type === inputTypes.VALUE) {\n activeRow.elements.push(new ExternalValueInput(this.constants_, input));\n activeRow.hasExternalInput = true;\n } else if (input.type === inputTypes.DUMMY) {\n // Dummy inputs have no visual representation, but the information is\n // still important.\n activeRow.minHeight = Math.max(\n activeRow.minHeight,\n input.getSourceBlock() && input.getSourceBlock()!.isShadow() ?\n this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT :\n this.constants_.DUMMY_INPUT_MIN_HEIGHT);\n activeRow.hasDummyInput = true;\n }\n if (activeRow.align === null) {\n activeRow.align = input.align;\n }\n }\n\n /**\n * Decide whether to start a new row between the two Blockly.Inputs.\n *\n * @param input The first input to consider\n * @param lastInput The input that follows.\n * @returns True if the next input should be rendered on a new row.\n */\n protected shouldStartNewRow_(input: Input, lastInput?: Input): boolean {\n // If this is the first input, just add to the existing row.\n // That row is either empty or has some icons in it.\n if (!lastInput) {\n return false;\n }\n // A statement input or an input following one always gets a new row.\n if (input.type === inputTypes.STATEMENT ||\n lastInput.type === inputTypes.STATEMENT) {\n return true;\n }\n // Value and dummy inputs get new row if inputs are not inlined.\n if (input.type === inputTypes.VALUE || input.type === inputTypes.DUMMY) {\n return !this.isInline;\n }\n return false;\n }\n\n /** Add horizontal spacing between and around elements within each row. */\n protected addElemSpacing_() {\n for (let i = 0, row; row = this.rows[i]; i++) {\n const oldElems = row.elements;\n row.elements = [];\n // No spacing needed before the corner on the top row or the bottom row.\n if (row.startsWithElemSpacer()) {\n // There's a spacer before the first element in the row.\n row.elements.push(new InRowSpacer(\n this.constants_, this.getInRowSpacing_(null, oldElems[0])));\n }\n if (!oldElems.length) {\n continue;\n }\n for (let e = 0; e < oldElems.length - 1; e++) {\n row.elements.push(oldElems[e]);\n const spacing = this.getInRowSpacing_(oldElems[e], oldElems[e + 1]);\n row.elements.push(new InRowSpacer(this.constants_, spacing));\n }\n row.elements.push(oldElems[oldElems.length - 1]);\n if (row.endsWithElemSpacer()) {\n // There's a spacer after the last element in the row.\n row.elements.push(new InRowSpacer(\n this.constants_,\n this.getInRowSpacing_(oldElems[oldElems.length - 1], null)));\n }\n }\n }\n\n /**\n * Calculate the width of a spacer element in a row based on the previous and\n * next elements in that row. For instance, extra padding is added between\n * two editable fields.\n *\n * @param prev The element before the spacer.\n * @param next The element after the spacer.\n * @returns The size of the spacing between the two elements.\n */\n protected getInRowSpacing_(prev: Measurable|null, next: Measurable|null):\n number {\n if (!prev) {\n // Statement input padding.\n if (next && Types.isStatementInput(next)) {\n return this.constants_.STATEMENT_INPUT_PADDING_LEFT;\n }\n }\n // Between inputs and the end of the row.\n if (prev && Types.isInput(prev) && !next) {\n if (Types.isExternalInput(prev)) {\n return this.constants_.NO_PADDING;\n } else if (Types.isInlineInput(prev)) {\n return this.constants_.LARGE_PADDING;\n } else if (Types.isStatementInput(prev)) {\n return this.constants_.NO_PADDING;\n }\n }\n\n // Spacing between a square corner and a previous or next connection\n if (prev && Types.isLeftSquareCorner(prev) && next) {\n if (Types.isPreviousConnection(next) || Types.isNextConnection(next)) {\n return next.notchOffset;\n }\n }\n\n // Spacing between a rounded corner and a previous or next connection.\n if (prev && Types.isLeftRoundedCorner(prev) && next) {\n if (Types.isPreviousConnection(next) || Types.isNextConnection(next)) {\n return next.notchOffset - this.constants_.CORNER_RADIUS;\n }\n }\n\n return this.constants_.MEDIUM_PADDING;\n }\n\n /**\n * Figure out where the right edge of the block and right edge of statement\n * inputs should be placed.\n */\n protected computeBounds_() {\n let widestStatementRowFields = 0;\n let blockWidth = 0;\n let widestRowWithConnectedBlocks = 0;\n for (let i = 0, row; row = this.rows[i]; i++) {\n row.measure();\n blockWidth = Math.max(blockWidth, row.width);\n if (row.hasStatement) {\n const statementInput = row.getLastInput();\n const innerWidth = row.width - (statementInput?.width ?? 0);\n widestStatementRowFields =\n Math.max(widestStatementRowFields, innerWidth);\n }\n widestRowWithConnectedBlocks =\n Math.max(widestRowWithConnectedBlocks, row.widthWithConnectedBlocks);\n }\n\n this.statementEdge = widestStatementRowFields;\n this.width = blockWidth;\n\n for (let i = 0, row; row = this.rows[i]; i++) {\n if (row.hasStatement) {\n row.statementEdge = this.statementEdge;\n }\n }\n\n this.widthWithChildren = Math.max(blockWidth, widestRowWithConnectedBlocks);\n\n if (this.outputConnection) {\n this.startX = this.outputConnection.width;\n this.width += this.outputConnection.width;\n this.widthWithChildren += this.outputConnection.width;\n }\n }\n\n /**\n * Extra spacing may be necessary to make sure that the right sides of all\n * rows line up. This can only be calculated after a first pass to calculate\n * the sizes of all rows.\n */\n protected alignRowElements_() {\n for (let i = 0, row; row = this.rows[i]; i++) {\n if (row.hasStatement) {\n this.alignStatementRow_(row as InputRow);\n } else {\n const currentWidth = row.width;\n const desiredWidth = this.getDesiredRowWidth_(row);\n const missingSpace = desiredWidth - currentWidth;\n if (missingSpace > 0) {\n this.addAlignmentPadding_(row, missingSpace);\n }\n if (Types.isTopOrBottomRow(row)) {\n row.widthWithConnectedBlocks = row.width;\n }\n }\n }\n }\n\n /**\n * Calculate the desired width of an input row.\n *\n * @param _row The input row.\n * @returns The desired width of the input row.\n */\n protected getDesiredRowWidth_(_row: Row): number {\n return this.width - this.startX;\n }\n\n /**\n * Modify the given row to add the given amount of padding around its fields.\n * The exact location of the padding is based on the alignment property of the\n * last input in the field.\n *\n * @param row The row to add padding to.\n * @param missingSpace How much padding to add.\n */\n protected addAlignmentPadding_(row: Row, missingSpace: number) {\n const firstSpacer = row.getFirstSpacer();\n const lastSpacer = row.getLastSpacer();\n if (row.hasExternalInput || row.hasStatement) {\n row.widthWithConnectedBlocks += missingSpace;\n }\n\n // Decide where the extra padding goes.\n if (row.align === Align.LEFT && lastSpacer) {\n // Add padding to the end of the row.\n lastSpacer.width += missingSpace;\n } else if (row.align === Align.CENTRE && firstSpacer && lastSpacer) {\n // Split the padding between the beginning and end of the row.\n firstSpacer.width += missingSpace / 2;\n lastSpacer.width += missingSpace / 2;\n } else if (row.align === Align.RIGHT && firstSpacer) {\n // Add padding at the beginning of the row.\n firstSpacer.width += missingSpace;\n } else if (lastSpacer) {\n // Default to left-aligning.\n lastSpacer.width += missingSpace;\n } else {\n return;\n }\n row.width += missingSpace;\n }\n\n /**\n * Align the elements of a statement row based on computed bounds.\n * Unlike other types of rows, statement rows add space in multiple places.\n *\n * @param row The statement row to resize.\n */\n protected alignStatementRow_(row: InputRow) {\n const statementInput = row.getLastInput();\n if (!statementInput) return;\n let currentWidth = row.width - statementInput.width;\n let desiredWidth = this.statementEdge;\n // Add padding before the statement input.\n const missingSpace = desiredWidth - currentWidth;\n if (missingSpace > 0) {\n this.addAlignmentPadding_(row, missingSpace);\n }\n // Also widen the statement input to reach to the right side of the\n // block. Note that this does not add padding.\n currentWidth = row.width;\n desiredWidth = this.getDesiredRowWidth_(row);\n statementInput.width += desiredWidth - currentWidth;\n statementInput.height = Math.max(statementInput.height, row.height);\n row.width += desiredWidth - currentWidth;\n row.widthWithConnectedBlocks =\n Math.max(row.width, this.statementEdge + row.connectedBlockWidths);\n }\n\n /** Add spacers between rows and set their sizes. */\n protected addRowSpacing_() {\n const oldRows = this.rows;\n this.rows = [];\n\n for (let r = 0; r < oldRows.length; r++) {\n this.rows.push(oldRows[r]);\n if (r !== oldRows.length - 1) {\n this.rows.push(this.makeSpacerRow_(oldRows[r], oldRows[r + 1]));\n }\n }\n }\n\n /**\n * Create a spacer row to go between prev and next, and set its size.\n *\n * @param prev The previous row.\n * @param next The next row.\n * @returns The newly created spacer row.\n */\n protected makeSpacerRow_(prev: Row, next: Row): SpacerRow {\n const height = this.getSpacerRowHeight_(prev, next);\n const width = this.getSpacerRowWidth_(prev, next);\n const spacer = new SpacerRow(this.constants_, height, width);\n if (prev.hasStatement) {\n spacer.followsStatement = true;\n }\n if (next.hasStatement) {\n spacer.precedesStatement = true;\n }\n return spacer;\n }\n\n /**\n * Calculate the width of a spacer row.\n *\n * @param _prev The row before the spacer.\n * @param _next The row after the spacer.\n * @returns The desired width of the spacer row between these two rows.\n */\n protected getSpacerRowWidth_(_prev: Row, _next: Row): number {\n return this.width - this.startX;\n }\n\n /**\n * Calculate the height of a spacer row.\n *\n * @param _prev The row before the spacer.\n * @param _next The row after the spacer.\n * @returns The desired height of the spacer row between these two rows.\n */\n protected getSpacerRowHeight_(_prev: Row, _next: Row): number {\n return this.constants_.MEDIUM_PADDING;\n }\n\n /**\n * Calculate the centerline of an element in a rendered row.\n * This base implementation puts the centerline at the middle of the row\n * vertically, with no special cases. You will likely need extra logic to\n * handle (at minimum) top and bottom rows.\n *\n * @param row The row containing the element.\n * @param elem The element to place.\n * @returns The desired centerline of the given element, as an offset from the\n * top left of the block.\n */\n protected getElemCenterline_(row: Row, elem: Measurable): number {\n if (Types.isSpacer(elem)) {\n return row.yPos + elem.height / 2;\n }\n if (Types.isBottomRow(row)) {\n const bottomRow = row as BottomRow;\n const baseline =\n bottomRow.yPos + bottomRow.height - bottomRow.descenderHeight;\n if (Types.isNextConnection(elem)) {\n return baseline + elem.height / 2;\n }\n return baseline - elem.height / 2;\n }\n if (Types.isTopRow(row)) {\n const topRow = row as TopRow;\n if (Types.isHat(elem)) {\n return topRow.capline - elem.height / 2;\n }\n return topRow.capline + elem.height / 2;\n }\n return row.yPos + row.height / 2;\n }\n\n /**\n * Record final position information on elements on the given row, for use in\n * drawing. At minimum this records xPos and centerline on each element.\n *\n * @param row The row containing the elements.\n */\n protected recordElemPositions_(row: Row) {\n let xCursor = row.xPos;\n for (let j = 0, elem; elem = row.elements[j]; j++) {\n // Now that row heights are finalized, make spacers use the row height.\n if (Types.isSpacer(elem)) {\n elem.height = row.height;\n }\n elem.xPos = xCursor;\n elem.centerline = this.getElemCenterline_(row, elem);\n xCursor += elem.width;\n }\n }\n\n /**\n * Make any final changes to the rendering information object. In particular,\n * store the y position of each row, and record the height of the full block.\n */\n protected finalize_() {\n // Performance note: this could be combined with the draw pass, if the time\n // that this takes is excessive. But it shouldn't be, because it only\n // accesses and sets properties that already exist on the objects.\n let widestRowWithConnectedBlocks = 0;\n let yCursor = 0;\n for (let i = 0, row; row = this.rows[i]; i++) {\n row.yPos = yCursor;\n row.xPos = this.startX;\n yCursor += row.height;\n\n widestRowWithConnectedBlocks =\n Math.max(widestRowWithConnectedBlocks, row.widthWithConnectedBlocks);\n this.recordElemPositions_(row);\n }\n if (this.outputConnection && this.block_.nextConnection) {\n const target = this.block_.nextConnection.targetBlock();\n if (target) {\n // Include width of connected block in value to stack width measurement.\n widestRowWithConnectedBlocks = Math.max(\n widestRowWithConnectedBlocks, target.getHeightWidth().width);\n }\n }\n\n this.widthWithChildren = widestRowWithConnectedBlocks + this.startX;\n\n this.height = yCursor;\n this.startY = this.topRow.capline;\n this.bottomRow.baseline = yCursor - this.bottomRow.descenderHeight;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of a marker move.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.MarkerMove');\n\nimport type {Block} from '../block.js';\nimport {ASTNode} from '../keyboard_nav/ast_node.js';\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\n\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a marker move event.\n *\n * @alias Blockly.Events.MarkerMove\n */\nexport class MarkerMove extends UiBase {\n blockId?: string;\n oldNode?: ASTNode;\n newNode?: ASTNode;\n isCursor?: boolean;\n override type = eventUtils.MARKER_MOVE;\n\n /**\n * @param opt_block The affected block. Null if current node is of type\n * workspace. Undefined for a blank event.\n * @param isCursor Whether this is a cursor event. Undefined for a blank\n * event.\n * @param opt_oldNode The old node the marker used to be on.\n * Undefined for a blank event.\n * @param opt_newNode The new node the marker is now on.\n * Undefined for a blank event.\n */\n constructor(\n opt_block?: Block|null, isCursor?: boolean, opt_oldNode?: ASTNode|null,\n opt_newNode?: ASTNode) {\n let workspaceId = opt_block ? opt_block.workspace.id : undefined;\n if (opt_newNode && opt_newNode.getType() === ASTNode.types.WORKSPACE) {\n workspaceId = (opt_newNode.getLocation() as Workspace).id;\n }\n super(workspaceId);\n\n /** The block identifier for this event. */\n this.blockId = opt_block?.id;\n\n /** The old node the marker used to be on. */\n this.oldNode = opt_oldNode || undefined;\n\n /** The new node the marker is now on. */\n this.newNode = opt_newNode;\n\n /** Whether this is a cursor event. */\n this.isCursor = isCursor;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): MarkerMoveJson {\n const json = super.toJson() as MarkerMoveJson;\n if (this.isCursor === undefined) {\n throw new Error(\n 'Whether this is a cursor event or not is undefined. Either pass ' +\n 'a value to the constructor, or call fromJson');\n }\n if (!this.newNode) {\n throw new Error(\n 'The new node is undefined. Either pass a node to ' +\n 'the constructor, or call fromJson');\n }\n json['isCursor'] = this.isCursor;\n json['blockId'] = this.blockId;\n json['oldNode'] = this.oldNode;\n json['newNode'] = this.newNode;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: MarkerMoveJson) {\n super.fromJson(json);\n this.isCursor = json['isCursor'];\n this.blockId = json['blockId'];\n this.oldNode = json['oldNode'];\n this.newNode = json['newNode'];\n }\n}\n\nexport interface MarkerMoveJson extends AbstractEventJson {\n isCursor: boolean;\n blockId?: string;\n oldNode?: ASTNode;\n newNode: ASTNode;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.MARKER_MOVE, MarkerMove);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for graphically rendering a marker as SVG.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.MarkerSvg');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport '../../events/events_marker_move.js';\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Connection} from '../../connection.js';\nimport {ConnectionType} from '../../connection_type.js';\nimport * as eventUtils from '../../events/utils.js';\nimport type {Field} from '../../field.js';\nimport type {IASTNodeLocationSvg} from '../../interfaces/i_ast_node_location_svg.js';\nimport {ASTNode} from '../../keyboard_nav/ast_node.js';\nimport type {Marker} from '../../keyboard_nav/marker.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport type {WorkspaceSvg} from '../../workspace_svg.js';\n\nimport type {ConstantProvider, Notch, PuzzleTab} from './constants.js';\n\n\n/** The name of the CSS class for a cursor. */\nconst CURSOR_CLASS = 'blocklyCursor';\n\n/** The name of the CSS class for a marker. */\nconst MARKER_CLASS = 'blocklyMarker';\n\n/**\n * What we multiply the height by to get the height of the marker.\n * Only used for the block and block connections.\n */\nconst HEIGHT_MULTIPLIER = 3 / 4;\n\n/**\n * Class for a marker.\n *\n * @alias Blockly.blockRendering.MarkerSvg\n */\nexport class MarkerSvg {\n /**\n * The workspace, field, or block that the marker SVG element should be\n * attached to.\n */\n private parent_: IASTNodeLocationSvg|null = null;\n\n /** The current SVG element for the marker. */\n currentMarkerSvg: SVGElement|null = null;\n colour_: string;\n\n /** The root SVG group containing the marker. */\n protected markerSvg_: SVGGElement|null = null;\n protected svgGroup_: SVGGElement|null = null;\n\n protected markerBlock_: SVGPathElement|null = null;\n\n protected markerInput_: SVGPathElement|null = null;\n protected markerSvgLine_: SVGRectElement|null = null;\n\n protected markerSvgRect_: SVGRectElement|null = null;\n\n /** The constants necessary to draw the marker. */\n protected constants_: ConstantProvider;\n\n /**\n * @param workspace The workspace the marker belongs to.\n * @param constants The constants for the renderer.\n * @param marker The marker to draw.\n */\n constructor(\n private readonly workspace: WorkspaceSvg, constants: ConstantProvider,\n private readonly marker: Marker) {\n this.constants_ = constants;\n\n const defaultColour = this.isCursor() ? this.constants_.CURSOR_COLOUR :\n this.constants_.MARKER_COLOUR;\n\n /** The colour of the marker. */\n this.colour_ = marker.colour || defaultColour;\n }\n\n /**\n * Return the root node of the SVG or null if none exists.\n *\n * @returns The root SVG node.\n */\n getSvgRoot(): SVGElement|null {\n return this.svgGroup_;\n }\n\n /**\n * Get the marker.\n *\n * @returns The marker to draw for.\n */\n getMarker(): Marker {\n return this.marker;\n }\n\n /**\n * True if the marker should be drawn as a cursor, false otherwise.\n * A cursor is drawn as a flashing line. A marker is drawn as a solid line.\n *\n * @returns True if the marker is a cursor, false otherwise.\n */\n isCursor(): boolean {\n return this.marker.type === 'cursor';\n }\n\n /**\n * Create the DOM element for the marker.\n *\n * @returns The marker controls SVG group.\n * @internal\n */\n createDom(): SVGElement {\n const className = this.isCursor() ? CURSOR_CLASS : MARKER_CLASS;\n\n this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': className});\n\n this.createDomInternal_();\n return this.svgGroup_;\n }\n\n /**\n * Attaches the SVG root of the marker to the SVG group of the parent.\n *\n * @param newParent The workspace, field, or block that the marker SVG element\n * should be attached to.\n */\n protected setParent_(newParent: IASTNodeLocationSvg) {\n if (!this.isCursor()) {\n if (this.parent_) {\n this.parent_.setMarkerSvg(null);\n }\n newParent.setMarkerSvg(this.getSvgRoot());\n } else {\n if (this.parent_) {\n this.parent_.setCursorSvg(null);\n }\n newParent.setCursorSvg(this.getSvgRoot());\n }\n this.parent_ = newParent;\n }\n\n /**\n * Update the marker.\n *\n * @param oldNode The previous node the marker was on or null.\n * @param curNode The node that we want to draw the marker for.\n */\n draw(oldNode: ASTNode, curNode: ASTNode) {\n if (!curNode) {\n this.hide();\n return;\n }\n\n this.constants_ = this.workspace.getRenderer().getConstants();\n\n const defaultColour = this.isCursor() ? this.constants_.CURSOR_COLOUR :\n this.constants_.MARKER_COLOUR;\n this.colour_ = this.marker.colour || defaultColour;\n this.applyColour_(curNode);\n\n this.showAtLocation_(curNode);\n\n this.fireMarkerEvent_(oldNode, curNode);\n\n // Ensures the marker will be visible immediately after the move.\n const animate = this.currentMarkerSvg!.childNodes[0];\n if (animate !== undefined) {\n (animate as SVGAnimationElement).beginElement &&\n (animate as SVGAnimationElement).beginElement();\n }\n }\n\n /**\n * Update the marker's visible state based on the type of curNode..\n *\n * @param curNode The node that we want to draw the marker for.\n */\n protected showAtLocation_(curNode: ASTNode) {\n const curNodeAsConnection = curNode.getLocation() as Connection;\n const connectionType = curNodeAsConnection.type;\n if (curNode.getType() === ASTNode.types.BLOCK) {\n this.showWithBlock_(curNode);\n } else if (curNode.getType() === ASTNode.types.OUTPUT) {\n this.showWithOutput_(curNode);\n } else if (connectionType === ConnectionType.INPUT_VALUE) {\n this.showWithInput_(curNode);\n } else if (connectionType === ConnectionType.NEXT_STATEMENT) {\n this.showWithNext_(curNode);\n } else if (curNode.getType() === ASTNode.types.PREVIOUS) {\n this.showWithPrevious_(curNode);\n } else if (curNode.getType() === ASTNode.types.FIELD) {\n this.showWithField_(curNode);\n } else if (curNode.getType() === ASTNode.types.WORKSPACE) {\n this.showWithCoordinates_(curNode);\n } else if (curNode.getType() === ASTNode.types.STACK) {\n this.showWithStack_(curNode);\n }\n }\n\n /**************************\n * Display\n **************************/\n\n /**\n * Show the marker as a combination of the previous connection and block,\n * the output connection and block, or just the block.\n *\n * @param curNode The node to draw the marker for.\n */\n private showWithBlockPrevOutput_(curNode: ASTNode) {\n const block = curNode.getSourceBlock() as BlockSvg;\n const width = block.width;\n const height = block.height;\n const markerHeight = height * HEIGHT_MULTIPLIER;\n const markerOffset = this.constants_.CURSOR_BLOCK_PADDING;\n\n if (block.previousConnection) {\n const connectionShape =\n this.constants_.shapeFor(block.previousConnection) as Notch;\n this.positionPrevious_(\n width, markerOffset, markerHeight, connectionShape);\n } else if (block.outputConnection) {\n const connectionShape =\n this.constants_.shapeFor(block.outputConnection) as PuzzleTab;\n this.positionOutput_(width, height, connectionShape);\n } else {\n this.positionBlock_(width, markerOffset, markerHeight);\n }\n this.setParent_(block);\n this.showCurrent_();\n }\n\n /**\n * Position and display the marker for a block.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithBlock_(curNode: ASTNode) {\n this.showWithBlockPrevOutput_(curNode);\n }\n\n /**\n * Position and display the marker for a previous connection.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithPrevious_(curNode: ASTNode) {\n this.showWithBlockPrevOutput_(curNode);\n }\n\n /**\n * Position and display the marker for an output connection.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithOutput_(curNode: ASTNode) {\n this.showWithBlockPrevOutput_(curNode);\n }\n\n /**\n * Position and display the marker for a workspace coordinate.\n * This is a horizontal line.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithCoordinates_(curNode: ASTNode) {\n const wsCoordinate = curNode.getWsCoordinate();\n let x = wsCoordinate.x;\n const y = wsCoordinate.y;\n\n if (this.workspace.RTL) {\n x -= this.constants_.CURSOR_WS_WIDTH;\n }\n\n this.positionLine_(x, y, this.constants_.CURSOR_WS_WIDTH);\n this.setParent_(this.workspace);\n this.showCurrent_();\n }\n\n /**\n * Position and display the marker for a field.\n * This is a box around the field.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithField_(curNode: ASTNode) {\n const field = curNode.getLocation() as Field;\n const width = field.getSize().width;\n const height = field.getSize().height;\n\n this.positionRect_(0, 0, width, height);\n this.setParent_(field);\n this.showCurrent_();\n }\n\n /**\n * Position and display the marker for an input.\n * This is a puzzle piece.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithInput_(curNode: ASTNode) {\n const connection = curNode.getLocation() as RenderedConnection;\n const sourceBlock = (connection.getSourceBlock());\n\n this.positionInput_(connection);\n this.setParent_(sourceBlock);\n this.showCurrent_();\n }\n\n /**\n * Position and display the marker for a next connection.\n * This is a horizontal line.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithNext_(curNode: ASTNode) {\n const connection = curNode.getLocation() as RenderedConnection;\n const targetBlock = (connection.getSourceBlock());\n let x = 0;\n const y = connection.getOffsetInBlock().y;\n const width = targetBlock.getHeightWidth().width;\n if (this.workspace.RTL) {\n x = -width;\n }\n this.positionLine_(x, y, width);\n this.setParent_(targetBlock);\n this.showCurrent_();\n }\n\n /**\n * Position and display the marker for a stack.\n * This is a box with extra padding around the entire stack of blocks.\n *\n * @param curNode The node to draw the marker for.\n */\n protected showWithStack_(curNode: ASTNode) {\n const block = curNode.getLocation() as BlockSvg;\n\n // Gets the height and width of entire stack.\n const heightWidth = block.getHeightWidth();\n\n // Add padding so that being on a stack looks different than being on a\n // block.\n const width = heightWidth.width + this.constants_.CURSOR_STACK_PADDING;\n const height = heightWidth.height + this.constants_.CURSOR_STACK_PADDING;\n\n // Shift the rectangle slightly to upper left so padding is equal on all\n // sides.\n const xPadding = -this.constants_.CURSOR_STACK_PADDING / 2;\n const yPadding = -this.constants_.CURSOR_STACK_PADDING / 2;\n\n let x = xPadding;\n const y = yPadding;\n\n if (this.workspace.RTL) {\n x = -(width + xPadding);\n }\n this.positionRect_(x, y, width, height);\n this.setParent_(block);\n this.showCurrent_();\n }\n\n /** Show the current marker. */\n protected showCurrent_() {\n this.hide();\n if (this.currentMarkerSvg) {\n this.currentMarkerSvg.style.display = '';\n }\n }\n\n /**************************\n * Position\n **************************/\n\n /**\n * Position the marker for a block.\n * Displays an outline of the top half of a rectangle around a block.\n *\n * @param width The width of the block.\n * @param markerOffset The extra padding for around the block.\n * @param markerHeight The height of the marker.\n */\n protected positionBlock_(\n width: number, markerOffset: number, markerHeight: number) {\n const markerPath = svgPaths.moveBy(-markerOffset, markerHeight) +\n svgPaths.lineOnAxis('V', -markerOffset) +\n svgPaths.lineOnAxis('H', width + markerOffset * 2) +\n svgPaths.lineOnAxis('V', markerHeight);\n if (!this.markerBlock_) {\n throw new Error(\n 'createDom should be called before positioning the marker');\n }\n this.markerBlock_.setAttribute('d', markerPath);\n if (this.workspace.RTL) {\n this.flipRtl_(this.markerBlock_);\n }\n this.currentMarkerSvg = this.markerBlock_;\n }\n\n /**\n * Position the marker for an input connection.\n * Displays a filled in puzzle piece.\n *\n * @param connection The connection to position marker around.\n */\n protected positionInput_(connection: RenderedConnection) {\n const x = connection.getOffsetInBlock().x;\n const y = connection.getOffsetInBlock().y;\n\n const path = svgPaths.moveTo(0, 0) +\n (this.constants_.shapeFor(connection) as PuzzleTab).pathDown;\n\n this.markerInput_!.setAttribute('d', path);\n this.markerInput_!.setAttribute(\n 'transform',\n 'translate(' + x + ',' + y + ')' +\n (this.workspace.RTL ? ' scale(-1 1)' : ''));\n this.currentMarkerSvg = this.markerInput_;\n }\n\n /**\n * Move and show the marker at the specified coordinate in workspace units.\n * Displays a horizontal line.\n *\n * @param x The new x, in workspace units.\n * @param y The new y, in workspace units.\n * @param width The new width, in workspace units.\n */\n protected positionLine_(x: number, y: number, width: number) {\n if (!this.markerSvgLine_) {\n throw new Error('createDom should be called before positioning the line');\n }\n this.markerSvgLine_.setAttribute('x', `${x}`);\n this.markerSvgLine_.setAttribute('y', `${y}`);\n this.markerSvgLine_.setAttribute('width', `${width}`);\n this.currentMarkerSvg = this.markerSvgLine_;\n }\n\n /**\n * Position the marker for an output connection.\n * Displays a puzzle outline and the top and bottom path.\n *\n * @param width The width of the block.\n * @param height The height of the block.\n * @param connectionShape The shape object for the connection.\n */\n protected positionOutput_(\n width: number, height: number, connectionShape: PuzzleTab) {\n if (!this.markerBlock_) {\n throw new Error(\n 'createDom should be called before positioning the output');\n }\n const markerPath = svgPaths.moveBy(width, 0) +\n svgPaths.lineOnAxis('h', -(width - connectionShape.width)) +\n svgPaths.lineOnAxis('v', this.constants_.TAB_OFFSET_FROM_TOP) +\n connectionShape.pathDown + svgPaths.lineOnAxis('V', height) +\n svgPaths.lineOnAxis('H', width);\n this.markerBlock_.setAttribute('d', markerPath);\n if (this.workspace.RTL) {\n this.flipRtl_(this.markerBlock_);\n }\n this.currentMarkerSvg = this.markerBlock_;\n }\n\n /**\n * Position the marker for a previous connection.\n * Displays a half rectangle with a notch in the top to represent the previous\n * connection.\n *\n * @param width The width of the block.\n * @param markerOffset The offset of the marker from around the block.\n * @param markerHeight The height of the marker.\n * @param connectionShape The shape object for the connection.\n */\n protected positionPrevious_(\n width: number, markerOffset: number, markerHeight: number,\n connectionShape: Notch) {\n if (!this.markerBlock_) {\n throw new Error(\n 'createDom should be called before positioning the previous connection marker');\n }\n const markerPath = svgPaths.moveBy(-markerOffset, markerHeight) +\n svgPaths.lineOnAxis('V', -markerOffset) +\n svgPaths.lineOnAxis('H', this.constants_.NOTCH_OFFSET_LEFT) +\n connectionShape.pathLeft +\n svgPaths.lineOnAxis('H', width + markerOffset * 2) +\n svgPaths.lineOnAxis('V', markerHeight);\n this.markerBlock_.setAttribute('d', markerPath);\n if (this.workspace.RTL) {\n this.flipRtl_(this.markerBlock_);\n }\n this.currentMarkerSvg = this.markerBlock_;\n }\n\n /**\n * Move and show the marker at the specified coordinate in workspace units.\n * Displays a filled in rectangle.\n *\n * @param x The new x, in workspace units.\n * @param y The new y, in workspace units.\n * @param width The new width, in workspace units.\n * @param height The new height, in workspace units.\n */\n protected positionRect_(x: number, y: number, width: number, height: number) {\n if (!this.markerSvgRect_) {\n throw new Error('createDom should be called before positioning the rect');\n }\n this.markerSvgRect_.setAttribute('x', `${x}`);\n this.markerSvgRect_.setAttribute('y', `${y}`);\n this.markerSvgRect_.setAttribute('width', `${width}`);\n this.markerSvgRect_.setAttribute('height', `${height}`);\n this.currentMarkerSvg = this.markerSvgRect_;\n }\n\n /**\n * Flip the SVG paths in RTL.\n *\n * @param markerSvg The marker that we want to flip.\n */\n private flipRtl_(markerSvg: SVGElement) {\n markerSvg.setAttribute('transform', 'scale(-1 1)');\n }\n\n /** Hide the marker. */\n hide() {\n if (!this.markerSvgLine_ || !this.markerSvgRect_ || !this.markerInput_ ||\n !this.markerBlock_) {\n throw new Error('createDom should be called before hiding the marker');\n }\n this.markerSvgLine_.style.display = 'none';\n this.markerSvgRect_.style.display = 'none';\n this.markerInput_.style.display = 'none';\n this.markerBlock_.style.display = 'none';\n }\n\n /**\n * Fire event for the marker or marker.\n *\n * @param oldNode The old node the marker used to be on.\n * @param curNode The new node the marker is currently on.\n */\n private fireMarkerEvent_(oldNode: ASTNode, curNode: ASTNode) {\n const curBlock = curNode.getSourceBlock();\n const event = new (eventUtils.get(eventUtils.MARKER_MOVE))(\n curBlock, this.isCursor(), oldNode, curNode);\n eventUtils.fire(event);\n }\n\n /**\n * Get the properties to make a marker blink.\n *\n * @returns The object holding attributes to make the marker blink.\n */\n protected getBlinkProperties_(): {[key: string]: string} {\n return {\n 'attributeType': 'XML',\n 'attributeName': 'fill',\n 'dur': '1s',\n 'values': this.colour_ + ';transparent;transparent;',\n 'repeatCount': 'indefinite',\n };\n }\n\n /**\n * Create the marker SVG.\n *\n * @returns The SVG node created.\n */\n protected createDomInternal_(): Element {\n /* This markup will be generated and added to the .svgGroup_:\n <g>\n <rect width=\"100\" height=\"5\">\n <animate attributeType=\"XML\" attributeName=\"fill\" dur=\"1s\"\n values=\"transparent;transparent;#fff;transparent\"\n repeatCount=\"indefinite\" />\n </rect>\n </g>\n */\n\n this.markerSvg_ = dom.createSvgElement(\n Svg.G, {\n 'width': this.constants_.CURSOR_WS_WIDTH,\n 'height': this.constants_.WS_CURSOR_HEIGHT,\n },\n this.svgGroup_);\n\n // A horizontal line used to represent a workspace coordinate or next\n // connection.\n this.markerSvgLine_ = dom.createSvgElement(\n Svg.RECT, {\n 'width': this.constants_.CURSOR_WS_WIDTH,\n 'height': this.constants_.WS_CURSOR_HEIGHT,\n 'style': 'display: none',\n },\n this.markerSvg_);\n\n // A filled in rectangle used to represent a stack.\n this.markerSvgRect_ = dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blocklyVerticalMarker',\n 'rx': 10,\n 'ry': 10,\n 'style': 'display: none',\n },\n this.markerSvg_);\n\n // A filled in puzzle piece used to represent an input value.\n this.markerInput_ = dom.createSvgElement(\n Svg.PATH, {'transform': '', 'style': 'display: none'}, this.markerSvg_);\n\n // A path used to represent a previous connection and a block, an output\n // connection and a block, or a block.\n this.markerBlock_ = dom.createSvgElement(\n Svg.PATH, {\n 'transform': '',\n 'style': 'display: none',\n 'fill': 'none',\n 'stroke-width': this.constants_.CURSOR_STROKE_WIDTH,\n },\n this.markerSvg_);\n\n // Markers and stack markers don't blink.\n if (this.isCursor()) {\n const blinkProperties = this.getBlinkProperties_();\n dom.createSvgElement(Svg.ANIMATE, blinkProperties, this.markerSvgLine_);\n dom.createSvgElement(Svg.ANIMATE, blinkProperties, this.markerInput_);\n dom.createSvgElement(\n Svg.ANIMATE, {...blinkProperties, attributeName: 'stroke'},\n this.markerBlock_);\n }\n\n return this.markerSvg_;\n }\n\n /**\n * Apply the marker's colour.\n *\n * @param _curNode The node that we want to draw the marker for.\n */\n protected applyColour_(_curNode: ASTNode) {\n if (!this.markerSvgLine_ || !this.markerSvgRect_ || !this.markerInput_ ||\n !this.markerBlock_) {\n throw new Error(\n 'createDom should be called before applying color to the markerj');\n }\n this.markerSvgLine_.setAttribute('fill', this.colour_);\n this.markerSvgRect_.setAttribute('stroke', this.colour_);\n this.markerInput_.setAttribute('fill', this.colour_);\n this.markerBlock_.setAttribute('stroke', this.colour_);\n\n if (this.isCursor()) {\n const values = this.colour_ + ';transparent;transparent;';\n this.markerSvgLine_.firstElementChild!.setAttribute('values', values);\n this.markerInput_.firstElementChild!.setAttribute('values', values);\n this.markerBlock_.firstElementChild!.setAttribute('values', values);\n }\n }\n\n /** Dispose of this marker. */\n dispose() {\n if (this.svgGroup_) {\n dom.removeNode(this.svgGroup_);\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that owns a block's rendering SVG elements.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.PathObject');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Connection} from '../../connection.js';\nimport type {BlockStyle} from '../../theme.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\n\nimport type {ConstantProvider} from './constants.js';\nimport type {IPathObject} from './i_path_object.js';\n\n\n/**\n * An object that handles creating and setting each of the SVG elements\n * used by the renderer.\n *\n * @alias Blockly.blockRendering.PathObject\n */\nexport class PathObject implements IPathObject {\n svgRoot: SVGElement;\n /** @internal */\n svgPath: SVGElement;\n\n /**\n * Holds the cursors svg element when the cursor is attached to the block.\n * This is null if there is no cursor on the block.\n *\n * @internal\n */\n cursorSvg: SVGElement|null = null;\n\n /**\n * Holds the markers svg element when the marker is attached to the block.\n * This is null if there is no marker on the block.\n *\n * @internal\n */\n markerSvg: SVGElement|null = null;\n\n /** @internal */\n constants: ConstantProvider;\n /** @internal */\n style: BlockStyle;\n\n /**\n * @param root The root SVG element.\n * @param style The style object to use for colouring.\n * @param constants The renderer's constants.\n * @internal\n */\n constructor(\n root: SVGElement, style: BlockStyle, constants: ConstantProvider) {\n this.constants = constants;\n this.style = style;\n this.svgRoot = root;\n\n /** The primary path of the block. */\n this.svgPath =\n dom.createSvgElement(Svg.PATH, {'class': 'blocklyPath'}, this.svgRoot);\n }\n\n /**\n * Set the path generated by the renderer onto the respective SVG element.\n *\n * @param pathString The path.\n * @internal\n */\n setPath(pathString: string) {\n this.svgPath.setAttribute('d', pathString);\n }\n\n /**\n * Flip the SVG paths in RTL.\n *\n * @internal\n */\n flipRTL() {\n // Mirror the block's path.\n this.svgPath.setAttribute('transform', 'scale(-1 1)');\n }\n\n /**\n * Add the cursor SVG to this block's SVG group.\n *\n * @param cursorSvg The SVG root of the cursor to be added to the block SVG\n * group.\n * @internal\n */\n setCursorSvg(cursorSvg: SVGElement) {\n if (!cursorSvg) {\n this.cursorSvg = null;\n return;\n }\n\n this.svgRoot.appendChild(cursorSvg);\n this.cursorSvg = cursorSvg;\n }\n\n /**\n * Add the marker SVG to this block's SVG group.\n *\n * @param markerSvg The SVG root of the marker to be added to the block SVG\n * group.\n * @internal\n */\n setMarkerSvg(markerSvg: SVGElement) {\n if (!markerSvg) {\n this.markerSvg = null;\n return;\n }\n\n if (this.cursorSvg) {\n this.svgRoot.insertBefore(markerSvg, this.cursorSvg);\n } else {\n this.svgRoot.appendChild(markerSvg);\n }\n this.markerSvg = markerSvg;\n }\n\n /**\n * Apply the stored colours to the block's path, taking into account whether\n * the paths belong to a shadow block.\n *\n * @param block The source block.\n * @internal\n */\n applyColour(block: BlockSvg) {\n if (!this.style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n this.svgPath.setAttribute('stroke', this.style.colourTertiary);\n this.svgPath.setAttribute('fill', this.style.colourPrimary);\n\n this.updateShadow_(block.isShadow());\n this.updateDisabled_(!block.isEnabled() || block.getInheritedDisabled());\n }\n\n /**\n * Set the style.\n *\n * @param blockStyle The block style to use.\n * @internal\n */\n setStyle(blockStyle: BlockStyle) {\n this.style = blockStyle;\n }\n\n /**\n * Add or remove the given CSS class on the path object's root SVG element.\n *\n * @param className The name of the class to add or remove\n * @param add True if the class should be added. False if it should be\n * removed.\n */\n protected setClass_(className: string, add: boolean) {\n if (!className) {\n return;\n }\n if (add) {\n dom.addClass(this.svgRoot, className);\n } else {\n dom.removeClass(this.svgRoot, className);\n }\n }\n\n /**\n * Set whether the block shows a highlight or not. Block highlighting is\n * often used to visually mark blocks currently being executed.\n *\n * @param enable True if highlighted.\n * @internal\n */\n updateHighlighted(enable: boolean) {\n if (enable) {\n this.svgPath.setAttribute(\n 'filter', 'url(#' + this.constants.embossFilterId + ')');\n } else {\n this.svgPath.setAttribute('filter', 'none');\n }\n }\n\n /**\n * Updates the look of the block to reflect a shadow state.\n *\n * @param shadow True if the block is a shadow block.\n */\n protected updateShadow_(shadow: boolean) {\n if (shadow) {\n if (!this.style.colourSecondary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n this.svgPath.setAttribute('stroke', 'none');\n this.svgPath.setAttribute('fill', this.style.colourSecondary);\n }\n }\n\n /**\n * Updates the look of the block to reflect a disabled state.\n *\n * @param disabled True if disabled.\n */\n protected updateDisabled_(disabled: boolean) {\n this.setClass_('blocklyDisabled', disabled);\n if (disabled) {\n this.svgPath.setAttribute(\n 'fill', 'url(#' + this.constants.disabledPatternId + ')');\n }\n }\n\n /**\n * Add or remove styling showing that a block is selected.\n *\n * @param enable True if selection is enabled, false otherwise.\n * @internal\n */\n updateSelected(enable: boolean) {\n this.setClass_('blocklySelected', enable);\n }\n\n /**\n * Add or remove styling showing that a block is dragged over a delete area.\n *\n * @param enable True if the block is being dragged over a delete area, false\n * otherwise.\n * @internal\n */\n updateDraggingDelete(enable: boolean) {\n this.setClass_('blocklyDraggingDelete', enable);\n }\n\n /**\n * Add or remove styling showing that a block is an insertion marker.\n *\n * @param enable True if the block is an insertion marker, false otherwise.\n * @internal\n */\n updateInsertionMarker(enable: boolean) {\n this.setClass_('blocklyInsertionMarker', enable);\n }\n\n /**\n * Add or remove styling showing that a block is movable.\n *\n * @param enable True if the block is movable, false otherwise.\n * @internal\n */\n updateMovable(enable: boolean) {\n this.setClass_('blocklyDraggable', enable);\n }\n\n /**\n * Add or remove styling that shows that if the dragging block is dropped,\n * this block will be replaced. If a shadow block, it will disappear.\n * Otherwise it will bump.\n *\n * @param enable True if styling should be added.\n * @internal\n */\n updateReplacementFade(enable: boolean) {\n this.setClass_('blocklyReplaceable', enable);\n }\n\n /**\n * Add or remove styling that shows that if the dragging block is dropped,\n * this block will be connected to the input.\n *\n * @param _conn The connection on the input to highlight.\n * @param _enable True if styling should be added.\n * @internal\n */\n updateShapeForInputHighlight(_conn: Connection, _enable: boolean) {\n // NOOP\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class that controls updates to connections during drags.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.InsertionMarkerManager');\n\nimport * as blockAnimations from './block_animations.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as common from './common.js';\nimport {ComponentManager} from './component_manager.js';\nimport {config} from './config.js';\nimport {ConnectionType} from './connection_type.js';\nimport * as constants from './constants.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IDeleteArea} from './interfaces/i_delete_area.js';\nimport type {IDragTarget} from './interfaces/i_drag_target.js';\nimport type {RenderedConnection} from './rendered_connection.js';\nimport type {Coordinate} from './utils/coordinate.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/** Represents a nearby valid connection. */\ninterface CandidateConnection {\n closest: RenderedConnection|null;\n local: RenderedConnection|null;\n radius: number;\n}\n\n/**\n * An error message to throw if the block created by createMarkerBlock_ is\n * missing any components.\n */\nconst DUPLICATE_BLOCK_ERROR = 'The insertion marker ' +\n 'manager tried to create a marker but the result is missing %1. If ' +\n 'you are using a mutator, make sure your domToMutation method is ' +\n 'properly defined.';\n\n/**\n * Class that controls updates to connections during drags. It is primarily\n * responsible for finding the closest eligible connection and highlighting or\n * unhighlighting it as needed during a drag.\n *\n * @alias Blockly.InsertionMarkerManager\n */\nexport class InsertionMarkerManager {\n private readonly topBlock_: BlockSvg;\n private readonly workspace_: WorkspaceSvg;\n\n /**\n * The last connection on the stack, if it's not the last connection on the\n * first block.\n * Set in initAvailableConnections, if at all.\n */\n private lastOnStack_: RenderedConnection|null = null;\n\n /**\n * The insertion marker corresponding to the last block in the stack, if\n * that's not the same as the first block in the stack.\n * Set in initAvailableConnections, if at all\n */\n private lastMarker_: BlockSvg|null = null;\n private firstMarker_: BlockSvg;\n\n /**\n * The connection that this block would connect to if released immediately.\n * Updated on every mouse move.\n * This is not on any of the blocks that are being dragged.\n */\n private closestConnection_: RenderedConnection|null = null;\n\n /**\n * The connection that would connect to this.closestConnection_ if this\n * block were released immediately. Updated on every mouse move. This is on\n * the top block that is being dragged or the last block in the dragging\n * stack.\n */\n private localConnection_: RenderedConnection|null = null;\n\n /**\n * Whether the block would be deleted if it were dropped immediately.\n * Updated on every mouse move.\n */\n private wouldDeleteBlock_ = false;\n\n /**\n * Connection on the insertion marker block that corresponds to\n * this.localConnection_ on the currently dragged block.\n */\n private markerConnection_: RenderedConnection|null = null;\n\n /** The block that currently has an input being highlighted, or null. */\n private highlightedBlock_: BlockSvg|null = null;\n\n /** The block being faded to indicate replacement, or null. */\n private fadedBlock_: BlockSvg|null = null;\n private availableConnections_: RenderedConnection[];\n\n /** @param block The top block in the stack being dragged. */\n constructor(block: BlockSvg) {\n common.setSelected(block);\n\n /**\n * The top block in the stack being dragged.\n * Does not change during a drag.\n */\n this.topBlock_ = block;\n\n /**\n * The workspace on which these connections are being dragged.\n * Does not change during a drag.\n */\n this.workspace_ = block.workspace;\n\n /**\n * The insertion marker that shows up between blocks to show where a block\n * would go if dropped immediately.\n */\n this.firstMarker_ = this.createMarkerBlock_(this.topBlock_);\n\n /**\n * The connections on the dragging blocks that are available to connect to\n * other blocks. This includes all open connections on the top block, as\n * well as the last connection on the block stack. Does not change during a\n * drag.\n */\n this.availableConnections_ = this.initAvailableConnections_();\n }\n\n /**\n * Sever all links from this object.\n *\n * @internal\n */\n dispose() {\n this.availableConnections_.length = 0;\n\n eventUtils.disable();\n try {\n if (this.firstMarker_) {\n this.firstMarker_.dispose();\n }\n if (this.lastMarker_) {\n this.lastMarker_.dispose();\n }\n } finally {\n eventUtils.enable();\n }\n }\n\n /**\n * Update the available connections for the top block. These connections can\n * change if a block is unplugged and the stack is healed.\n *\n * @internal\n */\n updateAvailableConnections() {\n this.availableConnections_ = this.initAvailableConnections_();\n }\n\n /**\n * Return whether the block would be deleted if dropped immediately, based on\n * information from the most recent move event.\n *\n * @returns True if the block would be deleted if dropped immediately.\n * @internal\n */\n wouldDeleteBlock(): boolean {\n return this.wouldDeleteBlock_;\n }\n\n /**\n * Return whether the block would be connected if dropped immediately, based\n * on information from the most recent move event.\n *\n * @returns True if the block would be connected if dropped immediately.\n * @internal\n */\n wouldConnectBlock(): boolean {\n return !!this.closestConnection_;\n }\n\n /**\n * Connect to the closest connection and render the results.\n * This should be called at the end of a drag.\n *\n * @internal\n */\n applyConnections() {\n if (!this.closestConnection_) return;\n if (!this.localConnection_) {\n throw new Error(\n 'Cannot apply connections because there is no local connection');\n }\n // Don't fire events for insertion markers.\n eventUtils.disable();\n this.hidePreview_();\n eventUtils.enable();\n // Connect two blocks together.\n this.localConnection_.connect(this.closestConnection_);\n if (this.topBlock_.rendered) {\n // Trigger a connection animation.\n // Determine which connection is inferior (lower in the source stack).\n const inferiorConnection = this.localConnection_.isSuperior() ?\n this.closestConnection_ :\n this.localConnection_;\n blockAnimations.connectionUiEffect(inferiorConnection.getSourceBlock());\n // Bring the just-edited stack to the front.\n const rootBlock = this.topBlock_.getRootBlock();\n rootBlock.bringToFront();\n }\n }\n\n /**\n * Update connections based on the most recent move location.\n *\n * @param dxy Position relative to drag start, in workspace units.\n * @param dragTarget The drag target that the block is currently over.\n * @internal\n */\n update(dxy: Coordinate, dragTarget: IDragTarget|null) {\n const candidate = this.getCandidate_(dxy);\n\n this.wouldDeleteBlock_ = this.shouldDelete_(candidate, dragTarget);\n\n const shouldUpdate =\n this.wouldDeleteBlock_ || this.shouldUpdatePreviews_(candidate, dxy);\n\n if (shouldUpdate) {\n // Don't fire events for insertion marker creation or movement.\n eventUtils.disable();\n this.maybeHidePreview_(candidate);\n this.maybeShowPreview_(candidate);\n eventUtils.enable();\n }\n }\n\n /**\n * Create an insertion marker that represents the given block.\n *\n * @param sourceBlock The block that the insertion marker will represent.\n * @returns The insertion marker that represents the given block.\n */\n private createMarkerBlock_(sourceBlock: BlockSvg): BlockSvg {\n const imType = sourceBlock.type;\n\n eventUtils.disable();\n let result: BlockSvg;\n try {\n result = this.workspace_.newBlock(imType);\n result.setInsertionMarker(true);\n if (sourceBlock.saveExtraState) {\n const state = sourceBlock.saveExtraState();\n if (state && result.loadExtraState) {\n result.loadExtraState(state);\n }\n } else if (sourceBlock.mutationToDom) {\n const oldMutationDom = sourceBlock.mutationToDom();\n if (oldMutationDom && result.domToMutation) {\n result.domToMutation(oldMutationDom);\n }\n }\n // Copy field values from the other block. These values may impact the\n // rendered size of the insertion marker. Note that we do not care about\n // child blocks here.\n for (let i = 0; i < sourceBlock.inputList.length; i++) {\n const sourceInput = sourceBlock.inputList[i];\n if (sourceInput.name === constants.COLLAPSED_INPUT_NAME) {\n continue; // Ignore the collapsed input.\n }\n const resultInput = result.inputList[i];\n if (!resultInput) {\n throw new Error(DUPLICATE_BLOCK_ERROR.replace('%1', 'an input'));\n }\n for (let j = 0; j < sourceInput.fieldRow.length; j++) {\n const sourceField = sourceInput.fieldRow[j];\n const resultField = resultInput.fieldRow[j];\n if (!resultField) {\n throw new Error(DUPLICATE_BLOCK_ERROR.replace('%1', 'a field'));\n }\n resultField.setValue(sourceField.getValue());\n }\n }\n\n result.setCollapsed(sourceBlock.isCollapsed());\n result.setInputsInline(sourceBlock.getInputsInline());\n\n result.initSvg();\n result.getSvgRoot().setAttribute('visibility', 'hidden');\n } finally {\n eventUtils.enable();\n }\n\n return result;\n }\n\n /**\n * Populate the list of available connections on this block stack. This\n * should only be called once, at the beginning of a drag. If the stack has\n * more than one block, this function will populate lastOnStack_ and create\n * the corresponding insertion marker.\n *\n * @returns A list of available connections.\n */\n private initAvailableConnections_(): RenderedConnection[] {\n const available = this.topBlock_.getConnections_(false);\n // Also check the last connection on this stack\n const lastOnStack = this.topBlock_.lastConnectionInStack(true);\n if (lastOnStack && lastOnStack !== this.topBlock_.nextConnection) {\n available.push(lastOnStack);\n this.lastOnStack_ = lastOnStack;\n if (this.lastMarker_) {\n eventUtils.disable();\n try {\n this.lastMarker_.dispose();\n } finally {\n eventUtils.enable();\n }\n }\n this.lastMarker_ = this.createMarkerBlock_(lastOnStack.getSourceBlock());\n }\n return available;\n }\n\n /**\n * Whether the previews (insertion marker and replacement marker) should be\n * updated based on the closest candidate and the current drag distance.\n *\n * @param candidate An object containing a local connection, a closest\n * connection, and a radius. Returned by getCandidate_.\n * @param dxy Position relative to drag start, in workspace units.\n * @returns Whether the preview should be updated.\n */\n private shouldUpdatePreviews_(\n candidate: CandidateConnection, dxy: Coordinate): boolean {\n const candidateLocal = candidate.local;\n const candidateClosest = candidate.closest;\n const radius = candidate.radius;\n\n // Found a connection!\n if (candidateLocal && candidateClosest) {\n // We're already showing an insertion marker.\n // Decide whether the new connection has higher priority.\n if (this.localConnection_ && this.closestConnection_) {\n // The connection was the same as the current connection.\n if (this.closestConnection_ === candidateClosest &&\n this.localConnection_ === candidateLocal) {\n return false;\n }\n const xDiff =\n this.localConnection_.x + dxy.x - this.closestConnection_.x;\n const yDiff =\n this.localConnection_.y + dxy.y - this.closestConnection_.y;\n const curDistance = Math.sqrt(xDiff * xDiff + yDiff * yDiff);\n // Slightly prefer the existing preview over a new preview.\n return !(\n candidateClosest &&\n radius > curDistance - config.currentConnectionPreference);\n } else if (!this.localConnection_ && !this.closestConnection_) {\n // We weren't showing a preview before, but we should now.\n return true;\n } else {\n console.error(\n 'Only one of localConnection_ and closestConnection_ was set.');\n }\n } else { // No connection found.\n // Only need to update if we were showing a preview before.\n return !!(this.localConnection_ && this.closestConnection_);\n }\n\n console.error(\n 'Returning true from shouldUpdatePreviews, but it\\'s not clear why.');\n return true;\n }\n\n /**\n * Find the nearest valid connection, which may be the same as the current\n * closest connection.\n *\n * @param dxy Position relative to drag start, in workspace units.\n * @returns An object containing a local connection, a closest connection, and\n * a radius.\n */\n private getCandidate_(dxy: Coordinate): CandidateConnection {\n let radius = this.getStartRadius_();\n let candidateClosest = null;\n let candidateLocal = null;\n\n // It's possible that a block has added or removed connections during a\n // drag, (e.g. in a drag/move event handler), so let's update the available\n // connections. Note that this will be called on every move while dragging,\n // so it might cause slowness, especially if the block stack is large. If\n // so, maybe it could be made more efficient. Also note that we won't update\n // the connections if we've already connected the insertion marker to a\n // block.\n if (!this.markerConnection_ || !this.markerConnection_.isConnected()) {\n this.updateAvailableConnections();\n }\n\n for (let i = 0; i < this.availableConnections_.length; i++) {\n const myConnection = this.availableConnections_[i];\n const neighbour = myConnection.closest(radius, dxy);\n if (neighbour.connection) {\n candidateClosest = neighbour.connection;\n candidateLocal = myConnection;\n radius = neighbour.radius;\n }\n }\n return {closest: candidateClosest, local: candidateLocal, radius};\n }\n\n /**\n * Decide the radius at which to start searching for the closest connection.\n *\n * @returns The radius at which to start the search for the closest\n * connection.\n */\n private getStartRadius_(): number {\n // If there is already a connection highlighted,\n // increase the radius we check for making new connections.\n // Why? When a connection is highlighted, blocks move around when the\n // insertion marker is created, which could cause the connection became out\n // of range. By increasing radiusConnection when a connection already\n // exists, we never \"lose\" the connection from the offset.\n if (this.closestConnection_ && this.localConnection_) {\n return config.connectingSnapRadius;\n }\n return config.snapRadius;\n }\n\n /**\n * Whether ending the drag would delete the block.\n *\n * @param candidate An object containing a local connection, a closest\n * connection, and a radius.\n * @param dragTarget The drag target that the block is currently over.\n * @returns Whether dropping the block immediately would delete the block.\n */\n private shouldDelete_(\n candidate: CandidateConnection, dragTarget: IDragTarget|null): boolean {\n if (dragTarget) {\n const componentManager = this.workspace_.getComponentManager();\n const isDeleteArea = componentManager.hasCapability(\n dragTarget.id, ComponentManager.Capability.DELETE_AREA);\n if (isDeleteArea) {\n return (dragTarget as IDeleteArea)\n .wouldDelete(this.topBlock_, candidate && !!candidate.closest);\n }\n }\n return false;\n }\n\n /**\n * Show an insertion marker or replacement highlighting during a drag, if\n * needed.\n * At the beginning of this function, this.localConnection_ and\n * this.closestConnection_ should both be null.\n *\n * @param candidate An object containing a local connection, a closest\n * connection, and a radius.\n */\n private maybeShowPreview_(candidate: CandidateConnection) {\n // Nope, don't add a marker.\n if (this.wouldDeleteBlock_) {\n return;\n }\n const closest = candidate.closest;\n const local = candidate.local;\n\n // Nothing to connect to.\n if (!closest) {\n return;\n }\n\n // Something went wrong and we're trying to connect to an invalid\n // connection.\n if (closest === this.closestConnection_ ||\n closest.getSourceBlock().isInsertionMarker()) {\n console.log('Trying to connect to an insertion marker');\n return;\n }\n // Add an insertion marker or replacement marker.\n this.closestConnection_ = closest;\n this.localConnection_ = local;\n this.showPreview_();\n }\n\n /**\n * A preview should be shown. This function figures out if it should be a\n * block highlight or an insertion marker, and shows the appropriate one.\n */\n private showPreview_() {\n if (!this.closestConnection_) {\n throw new Error(\n 'Cannot show the preview because there is no closest connection');\n }\n if (!this.localConnection_) {\n throw new Error(\n 'Cannot show the preview because there is no local connection');\n }\n const closest = this.closestConnection_;\n const renderer = this.workspace_.getRenderer();\n const method = renderer.getConnectionPreviewMethod(\n closest, this.localConnection_, this.topBlock_);\n\n switch (method) {\n case InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE:\n this.showInsertionInputOutline_();\n break;\n case InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER:\n this.showInsertionMarker_();\n break;\n case InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE:\n this.showReplacementFade_();\n break;\n }\n\n // Optionally highlight the actual connection, as a nod to previous\n // behaviour.\n if (closest && renderer.shouldHighlightConnection(closest)) {\n closest.highlight();\n }\n }\n\n /**\n * Show an insertion marker or replacement highlighting during a drag, if\n * needed.\n * At the end of this function, this.localConnection_ and\n * this.closestConnection_ should both be null.\n *\n * @param candidate An object containing a local connection, a closest\n * connection, and a radius.\n */\n private maybeHidePreview_(candidate: CandidateConnection) {\n // If there's no new preview, remove the old one but don't bother deleting\n // it. We might need it later, and this saves disposing of it and recreating\n // it.\n if (!candidate.closest) {\n this.hidePreview_();\n } else {\n // If there's a new preview and there was an preview before, and either\n // connection has changed, remove the old preview.\n const hadPreview = this.closestConnection_ && this.localConnection_;\n const closestChanged = this.closestConnection_ !== candidate.closest;\n const localChanged = this.localConnection_ !== candidate.local;\n\n // Also hide if we had a preview before but now we're going to delete\n // instead.\n if (hadPreview &&\n (closestChanged || localChanged || this.wouldDeleteBlock_)) {\n this.hidePreview_();\n }\n }\n\n // Either way, clear out old state.\n this.markerConnection_ = null;\n this.closestConnection_ = null;\n this.localConnection_ = null;\n }\n\n /**\n * A preview should be hidden. This function figures out if it is a block\n * highlight or an insertion marker, and hides the appropriate one.\n */\n private hidePreview_() {\n if (this.closestConnection_ && this.closestConnection_.targetBlock() &&\n this.workspace_.getRenderer().shouldHighlightConnection(\n this.closestConnection_)) {\n this.closestConnection_.unhighlight();\n }\n if (this.fadedBlock_) {\n this.hideReplacementFade_();\n } else if (this.highlightedBlock_) {\n this.hideInsertionInputOutline_();\n } else if (this.markerConnection_) {\n this.hideInsertionMarker_();\n }\n }\n\n /**\n * Shows an insertion marker connected to the appropriate blocks (based on\n * manager state).\n */\n private showInsertionMarker_() {\n if (!this.localConnection_) {\n throw new Error(\n 'Cannot show the insertion marker because there is no local ' +\n 'connection');\n }\n if (!this.closestConnection_) {\n throw new Error(\n 'Cannot show the insertion marker because there is no closest ' +\n 'connection');\n }\n const local = this.localConnection_;\n const closest = this.closestConnection_;\n\n const isLastInStack = this.lastOnStack_ && local === this.lastOnStack_;\n let insertionMarker = isLastInStack ? this.lastMarker_ : this.firstMarker_;\n if (!insertionMarker) {\n throw new Error(\n 'Cannot show the insertion marker because there is no insertion ' +\n 'marker block');\n }\n let imConn;\n try {\n imConn =\n insertionMarker.getMatchingConnection(local.getSourceBlock(), local);\n } catch (e) {\n // It's possible that the number of connections on the local block has\n // changed since the insertion marker was originally created. Let's\n // recreate the insertion marker and try again. In theory we could\n // probably recreate the marker block (e.g. in getCandidate_), which is\n // called more often during the drag, but creating a block that often\n // might be too slow, so we only do it if necessary.\n this.firstMarker_ = this.createMarkerBlock_(this.topBlock_);\n insertionMarker = isLastInStack ? this.lastMarker_ : this.firstMarker_;\n if (!insertionMarker) {\n throw new Error(\n 'Cannot show the insertion marker because there is no insertion ' +\n 'marker block');\n }\n imConn =\n insertionMarker.getMatchingConnection(local.getSourceBlock(), local);\n }\n\n if (!imConn) {\n throw new Error(\n 'Cannot show the insertion marker because there is no ' +\n 'associated connection');\n }\n\n if (imConn === this.markerConnection_) {\n throw new Error(\n 'Made it to showInsertionMarker_ even though the marker isn\\'t ' +\n 'changing');\n }\n\n // Render disconnected from everything else so that we have a valid\n // connection location.\n insertionMarker.render();\n insertionMarker.rendered = true;\n insertionMarker.getSvgRoot().setAttribute('visibility', 'visible');\n\n if (imConn && closest) {\n // Position so that the existing block doesn't move.\n insertionMarker.positionNearConnection(imConn, closest);\n }\n if (closest) {\n // Connect() also renders the insertion marker.\n imConn.connect(closest);\n }\n\n this.markerConnection_ = imConn;\n }\n\n /**\n * Disconnects and hides the current insertion marker. Should return the\n * blocks to their original state.\n */\n private hideInsertionMarker_() {\n if (!this.markerConnection_) {\n console.log('No insertion marker connection to disconnect');\n return;\n }\n\n const imConn = this.markerConnection_;\n const imBlock = imConn.getSourceBlock();\n const markerNext = imBlock.nextConnection;\n const markerPrev = imBlock.previousConnection;\n const markerOutput = imBlock.outputConnection;\n\n const isFirstInStatementStack =\n imConn === markerNext && !(markerPrev && markerPrev.targetConnection);\n\n const isFirstInOutputStack = imConn.type === ConnectionType.INPUT_VALUE &&\n !(markerOutput && markerOutput.targetConnection);\n // The insertion marker is the first block in a stack. Unplug won't do\n // anything in that case. Instead, unplug the following block.\n if (isFirstInStatementStack || isFirstInOutputStack) {\n imConn.targetBlock()!.unplug(false);\n } else if (\n imConn.type === ConnectionType.NEXT_STATEMENT &&\n imConn !== markerNext) {\n // Inside of a C-block, first statement connection.\n const innerConnection = imConn.targetConnection;\n if (innerConnection) {\n innerConnection.getSourceBlock().unplug(false);\n }\n\n const previousBlockNextConnection =\n markerPrev ? markerPrev.targetConnection : null;\n\n imBlock.unplug(true);\n if (previousBlockNextConnection && innerConnection) {\n previousBlockNextConnection.connect(innerConnection);\n }\n } else {\n imBlock.unplug(/* healStack */\n true);\n }\n\n if (imConn.targetConnection) {\n throw Error(\n 'markerConnection_ still connected at the end of ' +\n 'disconnectInsertionMarker');\n }\n\n this.markerConnection_ = null;\n const svg = imBlock.getSvgRoot();\n if (svg) {\n svg.setAttribute('visibility', 'hidden');\n }\n }\n\n /** Shows an outline around the input the closest connection belongs to. */\n private showInsertionInputOutline_() {\n if (!this.closestConnection_) {\n throw new Error(\n 'Cannot show the insertion marker outline because ' +\n 'there is no closest connection');\n }\n const closest = this.closestConnection_;\n this.highlightedBlock_ = closest.getSourceBlock();\n this.highlightedBlock_.highlightShapeForInput(closest, true);\n }\n\n /** Hides any visible input outlines. */\n private hideInsertionInputOutline_() {\n if (!this.highlightedBlock_) {\n throw new Error(\n 'Cannot hide the insertion marker outline because ' +\n 'there is no highlighted block');\n }\n if (!this.closestConnection_) {\n throw new Error(\n 'Cannot hide the insertion marker outline because ' +\n 'there is no closest connection');\n }\n this.highlightedBlock_.highlightShapeForInput(\n this.closestConnection_, false);\n this.highlightedBlock_ = null;\n }\n\n /**\n * Shows a replacement fade affect on the closest connection's target block\n * (the block that is currently connected to it).\n */\n private showReplacementFade_() {\n if (!this.closestConnection_) {\n throw new Error(\n 'Cannot show the replacement fade because there ' +\n 'is no closest connection');\n }\n this.fadedBlock_ = this.closestConnection_.targetBlock();\n if (!this.fadedBlock_) {\n throw new Error(\n 'Cannot show the replacement fade because the ' +\n 'closest connection does not have a target block');\n }\n this.fadedBlock_.fadeForReplacement(true);\n }\n\n /** Hides/Removes any visible fade affects. */\n private hideReplacementFade_() {\n if (!this.fadedBlock_) {\n throw new Error(\n 'Cannot hide the replacement because there is no ' +\n 'faded block');\n }\n this.fadedBlock_.fadeForReplacement(false);\n this.fadedBlock_ = null;\n }\n\n /**\n * Get a list of the insertion markers that currently exist. Drags have 0, 1,\n * or 2 insertion markers.\n *\n * @returns A possibly empty list of insertion marker blocks.\n * @internal\n */\n getInsertionMarkers(): BlockSvg[] {\n const result = [];\n if (this.firstMarker_) {\n result.push(this.firstMarker_);\n }\n if (this.lastMarker_) {\n result.push(this.lastMarker_);\n }\n return result;\n }\n}\n\nexport namespace InsertionMarkerManager {\n /**\n * An enum describing different kinds of previews the InsertionMarkerManager\n * could display.\n */\n export enum PREVIEW_TYPE {\n INSERTION_MARKER = 0,\n INPUT_OUTLINE = 1,\n REPLACEMENT_FADE = 2,\n }\n}\n\nexport type PreviewType = InsertionMarkerManager.PREVIEW_TYPE;\nexport const PreviewType = InsertionMarkerManager.PREVIEW_TYPE;\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Base renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.blockRendering.Renderer');\n\nimport type {Block} from '../../block.js';\nimport type {BlockSvg} from '../../block_svg.js';\nimport {Connection} from '../../connection.js';\nimport {ConnectionType} from '../../connection_type.js';\nimport {InsertionMarkerManager, PreviewType} from '../../insertion_marker_manager.js';\nimport type {IRegistrable} from '../../interfaces/i_registrable.js';\nimport type {Marker} from '../../keyboard_nav/marker.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {BlockStyle, Theme} from '../../theme.js';\nimport type {WorkspaceSvg} from '../../workspace_svg.js';\n\nimport {ConstantProvider} from './constants.js';\nimport * as debug from './debug.js';\nimport {Debug} from './debugger.js';\nimport {Drawer} from './drawer.js';\nimport type {IPathObject} from './i_path_object.js';\nimport {RenderInfo} from './info.js';\nimport {MarkerSvg} from './marker_svg.js';\nimport {PathObject} from './path_object.js';\n\n\n/**\n * The base class for a block renderer.\n *\n * @alias Blockly.blockRendering.Renderer\n */\nexport class Renderer implements IRegistrable {\n /** The renderer's constant provider. */\n protected constants_!: ConstantProvider;\n\n /** @internal */\n name: string;\n\n /**\n * Rendering constant overrides, passed in through options.\n *\n * @internal\n */\n overrides: object|null = null;\n\n /**\n * @param name The renderer name.\n * @internal\n */\n constructor(name: string) {\n this.name = name;\n }\n\n /**\n * Gets the class name that identifies this renderer.\n *\n * @returns The CSS class name.\n * @internal\n */\n getClassName(): string {\n return this.name + '-renderer';\n }\n\n /**\n * Initialize the renderer.\n *\n * @param theme The workspace theme object.\n * @param opt_rendererOverrides Rendering constant overrides.\n * @internal\n */\n init(\n theme: Theme, opt_rendererOverrides?: {[rendererConstant: string]: any}) {\n this.constants_ = this.makeConstants_();\n if (opt_rendererOverrides) {\n this.overrides = opt_rendererOverrides;\n Object.assign(this.constants_, opt_rendererOverrides);\n }\n this.constants_.setTheme(theme);\n this.constants_.init();\n }\n\n /**\n * Create any DOM elements that this renderer needs.\n *\n * @param svg The root of the workspace's SVG.\n * @param theme The workspace theme object.\n * @internal\n */\n createDom(svg: SVGElement, theme: Theme) {\n this.constants_.createDom(\n svg, this.name + '-' + theme.name,\n '.' + this.getClassName() + '.' + theme.getClassName());\n }\n\n /**\n * Refresh the renderer after a theme change.\n *\n * @param svg The root of the workspace's SVG.\n * @param theme The workspace theme object.\n * @internal\n */\n refreshDom(svg: SVGElement, theme: Theme) {\n const previousConstants = this.getConstants();\n previousConstants.dispose();\n this.constants_ = this.makeConstants_();\n if (this.overrides) {\n Object.assign(this.constants_, this.overrides);\n }\n // Ensure the constant provider's random identifier does not change.\n this.constants_.randomIdentifier = previousConstants.randomIdentifier;\n this.constants_.setTheme(theme);\n this.constants_.init();\n this.createDom(svg, theme);\n }\n\n /**\n * Dispose of this renderer.\n * Delete all DOM elements that this renderer and its constants created.\n *\n * @internal\n */\n dispose() {\n if (this.constants_) {\n this.constants_.dispose();\n }\n }\n\n /**\n * Create a new instance of the renderer's constant provider.\n *\n * @returns The constant provider.\n */\n protected makeConstants_(): ConstantProvider {\n return new ConstantProvider();\n }\n\n /**\n * Create a new instance of the renderer's render info object.\n *\n * @param block The block to measure.\n * @returns The render info object.\n */\n protected makeRenderInfo_(block: BlockSvg): RenderInfo {\n return new RenderInfo(this, block);\n }\n\n /**\n * Create a new instance of the renderer's drawer.\n *\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @returns The drawer.\n */\n protected makeDrawer_(block: BlockSvg, info: RenderInfo): Drawer {\n return new Drawer(block, info);\n }\n\n /**\n * Create a new instance of the renderer's debugger.\n *\n * @returns The renderer debugger.\n * @suppress {strictModuleDepCheck} Debug renderer only included in\n * playground.\n */\n protected makeDebugger_(): Debug {\n return new Debug(this.getConstants());\n }\n\n /**\n * Create a new instance of the renderer's marker drawer.\n *\n * @param workspace The workspace the marker belongs to.\n * @param marker The marker.\n * @returns The object in charge of drawing the marker.\n * @internal\n */\n makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker): MarkerSvg {\n return new MarkerSvg(workspace, this.getConstants(), marker);\n }\n\n /**\n * Create a new instance of a renderer path object.\n *\n * @param root The root SVG element.\n * @param style The style object to use for colouring.\n * @returns The renderer path object.\n * @internal\n */\n makePathObject(root: SVGElement, style: BlockStyle): IPathObject {\n return new PathObject(root, style, (this.constants_));\n }\n\n /**\n * Get the current renderer's constant provider. We assume that when this is\n * called, the renderer has already been initialized.\n *\n * @returns The constant provider.\n * @internal\n */\n getConstants(): ConstantProvider {\n return this.constants_;\n }\n\n /**\n * Determine whether or not to highlight a connection.\n *\n * @param _conn The connection to determine whether or not to highlight.\n * @returns True if we should highlight the connection.\n * @internal\n */\n shouldHighlightConnection(_conn: Connection): boolean {\n return true;\n }\n\n /**\n * Checks if an orphaned block can connect to the \"end\" of the topBlock's\n * block-clump. If the clump is a row the end is the last input. If the clump\n * is a stack, the end is the last next connection. If the clump is neither,\n * then this returns false.\n *\n * @param topBlock The top block of the block clump we want to try and connect\n * to.\n * @param orphanBlock The orphan block that wants to find a home.\n * @param localType The type of the connection being dragged.\n * @returns Whether there is a home for the orphan or not.\n * @internal\n */\n orphanCanConnectAtEnd(\n topBlock: BlockSvg, orphanBlock: BlockSvg, localType: number): boolean {\n const orphanConnection = localType === ConnectionType.OUTPUT_VALUE ?\n orphanBlock.outputConnection :\n orphanBlock.previousConnection;\n return !!Connection.getConnectionForOrphanedConnection(\n topBlock as Block, orphanConnection as Connection);\n }\n\n /**\n * Chooses a connection preview method based on the available connection, the\n * current dragged connection, and the block being dragged.\n *\n * @param closest The available connection.\n * @param local The connection currently being dragged.\n * @param topBlock The block currently being dragged.\n * @returns The preview type to display.\n * @internal\n */\n getConnectionPreviewMethod(\n closest: RenderedConnection, local: RenderedConnection,\n topBlock: BlockSvg): PreviewType {\n if (local.type === ConnectionType.OUTPUT_VALUE ||\n local.type === ConnectionType.PREVIOUS_STATEMENT) {\n if (!closest.isConnected() ||\n this.orphanCanConnectAtEnd(\n topBlock, closest.targetBlock() as BlockSvg, local.type)) {\n return InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER;\n }\n return InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE;\n }\n\n return InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER;\n }\n\n /**\n * Render the block.\n *\n * @param block The block to render.\n * @internal\n */\n render(block: BlockSvg) {\n if (debug.isDebuggerEnabled() && !block.renderingDebugger) {\n block.renderingDebugger = this.makeDebugger_();\n }\n const info = this.makeRenderInfo_(block);\n info.measure();\n this.makeDrawer_(block, info).draw();\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object in charge of storing and updating a workspace theme\n * and UI components.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ThemeManager');\n\nimport type {Theme} from './theme.js';\nimport * as arrayUtils from './utils/array.js';\nimport * as dom from './utils/dom.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for storing and updating a workspace's theme and UI components.\n *\n * @alias Blockly.ThemeManager\n */\nexport class ThemeManager {\n /** A list of workspaces that are subscribed to this theme. */\n private subscribedWorkspaces_: Workspace[] = [];\n private componentDB = new Map<string, Component[]>();\n owner_: AnyDuringMigration;\n\n /**\n * @param workspace The main workspace.\n * @param theme The workspace theme.\n * @internal\n */\n constructor(private readonly workspace: WorkspaceSvg, private theme: Theme) {}\n\n /**\n * Get the workspace theme.\n *\n * @returns The workspace theme.\n * @internal\n */\n getTheme(): Theme {\n return this.theme;\n }\n\n /**\n * Set the workspace theme, and refresh the workspace and all components.\n *\n * @param theme The workspace theme.\n * @internal\n */\n setTheme(theme: Theme) {\n const prevTheme = this.theme;\n this.theme = theme;\n // Set the theme name onto the injection div.\n const injectionDiv = this.workspace.getInjectionDiv();\n if (injectionDiv) {\n if (prevTheme) {\n const oldClassName = prevTheme.getClassName();\n if (oldClassName) {\n dom.removeClass(injectionDiv, oldClassName);\n }\n }\n const newClassName = this.theme.getClassName();\n if (newClassName) {\n dom.addClass(injectionDiv, newClassName);\n }\n }\n\n // Refresh all subscribed workspaces.\n for (let i = 0, workspace; workspace = this.subscribedWorkspaces_[i]; i++) {\n (workspace as WorkspaceSvg).refreshTheme();\n }\n\n // Refresh all registered Blockly UI components.\n for (const [key, componentList] of this.componentDB) {\n for (const component of componentList) {\n const element = component.element;\n const propertyName = component.propertyName;\n const style = this.theme && this.theme.getComponentStyle(key);\n // AnyDuringMigration because: Property 'style' does not exist on type\n // 'Element'.\n (element as AnyDuringMigration).style[propertyName] = style || '';\n }\n }\n\n for (const workspace of this.subscribedWorkspaces_) {\n (workspace as WorkspaceSvg).hideChaff();\n }\n }\n\n /**\n * Subscribe a workspace to changes to the selected theme. If a new theme is\n * set, the workspace is called to refresh its blocks.\n *\n * @param workspace The workspace to subscribe.\n * @internal\n */\n subscribeWorkspace(workspace: Workspace) {\n this.subscribedWorkspaces_.push(workspace);\n }\n\n /**\n * Unsubscribe a workspace to changes to the selected theme.\n *\n * @param workspace The workspace to unsubscribe.\n * @internal\n */\n unsubscribeWorkspace(workspace: Workspace) {\n if (!arrayUtils.removeElem(this.subscribedWorkspaces_, workspace)) {\n throw Error(\n 'Cannot unsubscribe a workspace that hasn\\'t been subscribed.');\n }\n }\n\n /**\n * Subscribe an element to changes to the selected theme. If a new theme is\n * selected, the element's style is refreshed with the new theme's style.\n *\n * @param element The element to subscribe.\n * @param componentName The name used to identify the component. This must be\n * the same name used to configure the style in the Theme object.\n * @param propertyName The inline style property name to update.\n * @internal\n */\n subscribe(element: Element, componentName: string, propertyName: string) {\n if (!this.componentDB.has(componentName)) {\n this.componentDB.set(componentName, []);\n }\n\n // Add the element to our component map.\n this.componentDB.get(componentName)!.push({element, propertyName});\n\n // Initialize the element with its corresponding theme style.\n const style = this.theme && this.theme.getComponentStyle(componentName);\n // AnyDuringMigration because: Property 'style' does not exist on type\n // 'Element'.\n (element as AnyDuringMigration).style[propertyName] = style || '';\n }\n\n /**\n * Unsubscribe an element to changes to the selected theme.\n *\n * @param element The element to unsubscribe.\n * @internal\n */\n unsubscribe(element: Element) {\n if (!element) {\n return;\n }\n // Go through all component, and remove any references to this element.\n for (const [componentName, elements] of this.componentDB) {\n for (let i = elements.length - 1; i >= 0; i--) {\n if (elements[i].element === element) {\n elements.splice(i, 1);\n }\n }\n // Clean up the component map entry if the list is empty.\n if (!elements.length) {\n this.componentDB.delete(componentName);\n }\n }\n }\n\n /**\n * Dispose of this theme manager.\n *\n * @suppress {checkTypes}\n * @internal\n */\n dispose() {\n this.owner_ = null;\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Theme'.\n this.theme = null as AnyDuringMigration;\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'Workspace[]'.\n this.subscribedWorkspaces_ = null as AnyDuringMigration;\n this.componentDB.clear();\n }\n}\n\nexport namespace ThemeManager {\n /** The type for a Blockly UI Component. */\n export interface Component {\n element: Element;\n propertyName: string;\n }\n}\n\nexport type Component = ThemeManager.Component;\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The class extends Gesture to support pinch to zoom\n * for both pointer and touch events.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.TouchGesture');\n\nimport * as browserEvents from './browser_events.js';\nimport {Gesture} from './gesture.js';\nimport * as Touch from './touch.js';\nimport {Coordinate} from './utils/coordinate.js';\n\n/*\n * Note: In this file \"start\" refers to touchstart, mousedown, and pointerstart\n * events. \"End\" refers to touchend, mouseup, and pointerend events.\n */\n\n/** A multiplier used to convert the gesture scale to a zoom in delta. */\nconst ZOOM_IN_MULTIPLIER = 5;\n\n/** A multiplier used to convert the gesture scale to a zoom out delta. */\nconst ZOOM_OUT_MULTIPLIER = 6;\n\n/**\n * Class for one gesture.\n *\n * @alias Blockly.TouchGesture\n */\nexport class TouchGesture extends Gesture {\n /** Boolean for whether or not this gesture is a multi-touch gesture. */\n private isMultiTouch_ = false;\n\n /** A map of cached points used for tracking multi-touch gestures. */\n private cachedPoints = new Map<string, Coordinate|null>();\n\n /**\n * This is the ratio between the starting distance between the touch points\n * and the most recent distance between the touch points.\n * Scales between 0 and 1 mean the most recent zoom was a zoom out.\n * Scales above 1.0 mean the most recent zoom was a zoom in.\n */\n private previousScale_ = 0;\n\n /** The starting distance between two touch points. */\n private startDistance_ = 0;\n\n /**\n * A handle to use to unbind the second touch start or pointer down listener\n * at the end of a drag.\n * Opaque data returned from Blockly.bindEventWithChecks_.\n */\n private onStartWrapper_: browserEvents.Data|null = null;\n\n /** Boolean for whether or not the workspace supports pinch-zoom. */\n private isPinchZoomEnabled_: boolean|null = null;\n override onMoveWrapper_: browserEvents.Data|null = null;\n override onUpWrapper_: browserEvents.Data|null = null;\n\n /**\n * Start a gesture: update the workspace to indicate that a gesture is in\n * progress and bind mousemove and mouseup handlers.\n *\n * @param e A mouse down, touch start or pointer down event.\n * @internal\n */\n override doStart(e: MouseEvent) {\n if (!this.startWorkspace_) {\n throw new Error(\n 'Cannot start the touch event becauase the start ' +\n 'workspace is undefined');\n }\n this.isPinchZoomEnabled_ = this.startWorkspace_.options.zoomOptions &&\n this.startWorkspace_.options.zoomOptions.pinch;\n super.doStart(e);\n if (!this.isEnding_ && Touch.isTouchEvent(e)) {\n this.handleTouchStart(e);\n }\n }\n\n /**\n * Bind gesture events.\n * Overriding the gesture definition of this function, binding the same\n * functions for onMoveWrapper_ and onUpWrapper_ but passing\n * opt_noCaptureIdentifier.\n * In addition, binding a second mouse down event to detect multi-touch\n * events.\n *\n * @param e A mouse down or touch start event.\n * @internal\n */\n override bindMouseEvents(e: Event) {\n this.onStartWrapper_ = browserEvents.conditionalBind(\n document, 'mousedown', null, this.handleStart.bind(this),\n /* opt_noCaptureIdentifier */ true);\n this.onMoveWrapper_ = browserEvents.conditionalBind(\n document, 'mousemove', null, this.handleMove.bind(this),\n /* opt_noCaptureIdentifier */ true);\n this.onUpWrapper_ = browserEvents.conditionalBind(\n document, 'mouseup', null, this.handleUp.bind(this),\n /* opt_noCaptureIdentifier */ true);\n\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * Handle a mouse down, touch start, or pointer down event.\n *\n * @param e A mouse down, touch start, or pointer down event.\n * @internal\n */\n handleStart(e: Event) {\n if (this.isDragging()) {\n // A drag has already started, so this can no longer be a pinch-zoom.\n return;\n }\n if (Touch.isTouchEvent(e)) {\n this.handleTouchStart(e);\n\n if (this.isMultiTouch()) {\n Touch.longStop();\n }\n }\n }\n\n /**\n * Handle a mouse move, touch move, or pointer move event.\n *\n * @param e A mouse move, touch move, or pointer move event.\n * @internal\n */\n override handleMove(e: MouseEvent) {\n if (this.isDragging()) {\n // We are in the middle of a drag, only handle the relevant events\n if (Touch.shouldHandleEvent(e)) {\n super.handleMove(e);\n }\n return;\n }\n if (this.isMultiTouch()) {\n if (Touch.isTouchEvent(e)) {\n this.handleTouchMove(e);\n }\n Touch.longStop();\n } else {\n super.handleMove(e);\n }\n }\n\n /**\n * Handle a mouse up, touch end, or pointer up event.\n *\n * @param e A mouse up, touch end, or pointer up event.\n * @internal\n */\n override handleUp(e: Event) {\n if (Touch.isTouchEvent(e) && !this.isDragging()) {\n this.handleTouchEnd(e);\n }\n if (!this.isMultiTouch() || this.isDragging()) {\n if (!Touch.shouldHandleEvent(e)) {\n return;\n }\n super.handleUp(e);\n } else {\n e.preventDefault();\n e.stopPropagation();\n\n this.dispose();\n }\n }\n\n /**\n * Whether this gesture is part of a multi-touch gesture.\n *\n * @returns Whether this gesture is part of a multi-touch gesture.\n * @internal\n */\n isMultiTouch(): boolean {\n return this.isMultiTouch_;\n }\n\n /**\n * Sever all links from this object.\n *\n * @internal\n */\n override dispose() {\n super.dispose();\n\n if (this.onStartWrapper_) {\n browserEvents.unbind(this.onStartWrapper_);\n }\n }\n\n /**\n * Handle a touch start or pointer down event and keep track of current\n * pointers.\n *\n * @param e A touch start, or pointer down event.\n * @internal\n */\n handleTouchStart(e: Event) {\n const pointerId = Touch.getTouchIdentifierFromEvent(e);\n // store the pointerId in the current list of pointers\n this.cachedPoints.set(pointerId, this.getTouchPoint(e));\n const pointers = Array.from(this.cachedPoints.keys());\n // If two pointers are down, store info\n if (pointers.length === 2) {\n const point0 = (this.cachedPoints.get(pointers[0]))!;\n const point1 = (this.cachedPoints.get(pointers[1]))!;\n this.startDistance_ = Coordinate.distance(point0, point1);\n this.isMultiTouch_ = true;\n e.preventDefault();\n }\n }\n\n /**\n * Handle a touch move or pointer move event and zoom in/out if two pointers\n * are on the screen.\n *\n * @param e A touch move, or pointer move event.\n * @internal\n */\n handleTouchMove(e: MouseEvent) {\n const pointerId = Touch.getTouchIdentifierFromEvent(e);\n // Update the cache\n this.cachedPoints.set(pointerId, this.getTouchPoint(e));\n\n if (this.isPinchZoomEnabled_ && this.cachedPoints.size === 2) {\n this.handlePinch_(e);\n } else {\n super.handleMove(e);\n }\n }\n\n /**\n * Handle pinch zoom gesture.\n *\n * @param e A touch move, or pointer move event.\n */\n private handlePinch_(e: MouseEvent) {\n const pointers = Array.from(this.cachedPoints.keys());\n // Calculate the distance between the two pointers\n const point0 = (this.cachedPoints.get(pointers[0]))!;\n const point1 = (this.cachedPoints.get(pointers[1]))!;\n const moveDistance = Coordinate.distance(point0, point1);\n const scale = moveDistance / this.startDistance_;\n\n if (this.previousScale_ > 0 && this.previousScale_ < Infinity) {\n const gestureScale = scale - this.previousScale_;\n const delta = gestureScale > 0 ? gestureScale * ZOOM_IN_MULTIPLIER :\n gestureScale * ZOOM_OUT_MULTIPLIER;\n if (!this.startWorkspace_) {\n throw new Error(\n 'Cannot handle a pinch because the start workspace ' +\n 'is undefined');\n }\n const workspace = this.startWorkspace_;\n const position = browserEvents.mouseToSvg(\n e, workspace.getParentSvg(), workspace.getInverseScreenCTM());\n workspace.zoom(position.x, position.y, delta);\n }\n this.previousScale_ = scale;\n e.preventDefault();\n }\n\n /**\n * Handle a touch end or pointer end event and end the gesture.\n *\n * @param e A touch end, or pointer end event.\n * @internal\n */\n handleTouchEnd(e: Event) {\n const pointerId = Touch.getTouchIdentifierFromEvent(e);\n if (this.cachedPoints.has(pointerId)) {\n this.cachedPoints.delete(pointerId);\n }\n if (this.cachedPoints.size < 2) {\n this.cachedPoints.clear();\n this.previousScale_ = 0;\n }\n }\n\n /**\n * Helper function returning the current touch point coordinate.\n *\n * @param e A touch or pointer event.\n * @returns The current touch point coordinate\n * @internal\n */\n getTouchPoint(e: Event): Coordinate|null {\n if (!this.startWorkspace_) {\n return null;\n }\n // TODO(#6097): Make types accurate, possibly by refactoring touch handling.\n const typelessEvent = e as AnyDuringMigration;\n return new Coordinate(\n typelessEvent.changedTouches ? typelessEvent.changedTouches[0].pageX :\n typelessEvent.pageX,\n typelessEvent.changedTouches ? typelessEvent.changedTouches[0].pageY :\n typelessEvent.pageY);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that encapsulates logic for checking whether a\n * potential connection is safe and valid.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ConnectionChecker');\n\nimport * as common from './common.js';\nimport {Connection} from './connection.js';\nimport {ConnectionType} from './connection_type.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport * as internalConstants from './internal_constants.js';\nimport * as registry from './registry.js';\nimport type {RenderedConnection} from './rendered_connection.js';\n\n\n/**\n * Class for connection type checking logic.\n *\n * @alias Blockly.ConnectionChecker\n */\nexport class ConnectionChecker implements IConnectionChecker {\n /**\n * Check whether the current connection can connect with the target\n * connection.\n *\n * @param a Connection to check compatibility with.\n * @param b Connection to check compatibility with.\n * @param isDragging True if the connection is being made by dragging a block.\n * @param opt_distance The max allowable distance between the connections for\n * drag checks.\n * @returns Whether the connection is legal.\n */\n canConnect(\n a: Connection|null, b: Connection|null, isDragging: boolean,\n opt_distance?: number): boolean {\n return this.canConnectWithReason(a, b, isDragging, opt_distance) ===\n Connection.CAN_CONNECT;\n }\n\n /**\n * Checks whether the current connection can connect with the target\n * connection, and return an error code if there are problems.\n *\n * @param a Connection to check compatibility with.\n * @param b Connection to check compatibility with.\n * @param isDragging True if the connection is being made by dragging a block.\n * @param opt_distance The max allowable distance between the connections for\n * drag checks.\n * @returns Connection.CAN_CONNECT if the connection is legal, an error code\n * otherwise.\n */\n canConnectWithReason(\n a: Connection|null, b: Connection|null, isDragging: boolean,\n opt_distance?: number): number {\n const safety = this.doSafetyChecks(a, b);\n if (safety !== Connection.CAN_CONNECT) {\n return safety;\n }\n\n // If the safety checks passed, both connections are non-null.\n const connOne = a!;\n const connTwo = b!;\n if (!this.doTypeChecks(connOne, connTwo)) {\n return Connection.REASON_CHECKS_FAILED;\n }\n\n if (isDragging &&\n !this.doDragChecks(\n a as RenderedConnection, b as RenderedConnection,\n opt_distance || 0)) {\n return Connection.REASON_DRAG_CHECKS_FAILED;\n }\n\n return Connection.CAN_CONNECT;\n }\n\n /**\n * Helper method that translates a connection error code into a string.\n *\n * @param errorCode The error code.\n * @param a One of the two connections being checked.\n * @param b The second of the two connections being checked.\n * @returns A developer-readable error string.\n */\n getErrorMessage(errorCode: number, a: Connection|null, b: Connection|null):\n string {\n switch (errorCode) {\n case Connection.REASON_SELF_CONNECTION:\n return 'Attempted to connect a block to itself.';\n case Connection.REASON_DIFFERENT_WORKSPACES:\n // Usually this means one block has been deleted.\n return 'Blocks not on same workspace.';\n case Connection.REASON_WRONG_TYPE:\n return 'Attempt to connect incompatible types.';\n case Connection.REASON_TARGET_NULL:\n return 'Target connection is null.';\n case Connection.REASON_CHECKS_FAILED: {\n const connOne = a!;\n const connTwo = b!;\n let msg = 'Connection checks failed. ';\n msg += connOne + ' expected ' + connOne.getCheck() + ', found ' +\n connTwo.getCheck();\n return msg;\n }\n case Connection.REASON_SHADOW_PARENT:\n return 'Connecting non-shadow to shadow block.';\n case Connection.REASON_DRAG_CHECKS_FAILED:\n return 'Drag checks failed.';\n case Connection.REASON_PREVIOUS_AND_OUTPUT:\n return 'Block would have an output and a previous connection.';\n default:\n return 'Unknown connection failure: this should never happen!';\n }\n }\n\n /**\n * Check that connecting the given connections is safe, meaning that it would\n * not break any of Blockly's basic assumptions (e.g. no self connections).\n *\n * @param a The first of the connections to check.\n * @param b The second of the connections to check.\n * @returns An enum with the reason this connection is safe or unsafe.\n */\n doSafetyChecks(a: Connection|null, b: Connection|null): number {\n if (!a || !b) {\n return Connection.REASON_TARGET_NULL;\n }\n let superiorBlock;\n let inferiorBlock;\n let superiorConnection;\n let inferiorConnection;\n if (a.isSuperior()) {\n superiorBlock = a.getSourceBlock();\n inferiorBlock = b.getSourceBlock();\n superiorConnection = a;\n inferiorConnection = b;\n } else {\n inferiorBlock = a.getSourceBlock();\n superiorBlock = b.getSourceBlock();\n inferiorConnection = a;\n superiorConnection = b;\n }\n if (superiorBlock === inferiorBlock) {\n return Connection.REASON_SELF_CONNECTION;\n } else if (\n inferiorConnection.type !==\n internalConstants.OPPOSITE_TYPE[superiorConnection.type]) {\n return Connection.REASON_WRONG_TYPE;\n } else if (superiorBlock.workspace !== inferiorBlock.workspace) {\n return Connection.REASON_DIFFERENT_WORKSPACES;\n } else if (superiorBlock.isShadow() && !inferiorBlock.isShadow()) {\n return Connection.REASON_SHADOW_PARENT;\n } else if (\n inferiorConnection.type === ConnectionType.OUTPUT_VALUE &&\n inferiorBlock.previousConnection &&\n inferiorBlock.previousConnection.isConnected()) {\n return Connection.REASON_PREVIOUS_AND_OUTPUT;\n } else if (\n inferiorConnection.type === ConnectionType.PREVIOUS_STATEMENT &&\n inferiorBlock.outputConnection &&\n inferiorBlock.outputConnection.isConnected()) {\n return Connection.REASON_PREVIOUS_AND_OUTPUT;\n }\n return Connection.CAN_CONNECT;\n }\n\n /**\n * Check whether this connection is compatible with another connection with\n * respect to the value type system. E.g. square_root(\"Hello\") is not\n * compatible.\n *\n * @param a Connection to compare.\n * @param b Connection to compare against.\n * @returns True if the connections share a type.\n */\n doTypeChecks(a: Connection, b: Connection): boolean {\n const checkArrayOne = a.getCheck();\n const checkArrayTwo = b.getCheck();\n\n if (!checkArrayOne || !checkArrayTwo) {\n // One or both sides are promiscuous enough that anything will fit.\n return true;\n }\n // Find any intersection in the check lists.\n for (let i = 0; i < checkArrayOne.length; i++) {\n if (checkArrayTwo.indexOf(checkArrayOne[i]) !== -1) {\n return true;\n }\n }\n // No intersection.\n return false;\n }\n\n /**\n * Check whether this connection can be made by dragging.\n *\n * @param a Connection to compare.\n * @param b Connection to compare against.\n * @param distance The maximum allowable distance between connections.\n * @returns True if the connection is allowed during a drag.\n */\n doDragChecks(a: RenderedConnection, b: RenderedConnection, distance: number):\n boolean {\n if (a.distanceFrom(b) > distance) {\n return false;\n }\n\n // Don't consider insertion markers.\n if (b.getSourceBlock().isInsertionMarker()) {\n return false;\n }\n\n switch (b.type) {\n case ConnectionType.PREVIOUS_STATEMENT:\n return this.canConnectToPrevious_(a, b);\n case ConnectionType.OUTPUT_VALUE: {\n // Don't offer to connect an already connected left (male) value plug to\n // an available right (female) value plug.\n if (b.isConnected() && !b.targetBlock()!.isInsertionMarker() ||\n a.isConnected()) {\n return false;\n }\n break;\n }\n case ConnectionType.INPUT_VALUE: {\n // Offering to connect the left (male) of a value block to an already\n // connected value pair is ok, we'll splice it in.\n // However, don't offer to splice into an immovable block.\n if (b.isConnected() && !b.targetBlock()!.isMovable() &&\n !b.targetBlock()!.isShadow()) {\n return false;\n }\n break;\n }\n case ConnectionType.NEXT_STATEMENT: {\n // Don't let a block with no next connection bump other blocks out of\n // the stack. But covering up a shadow block or stack of shadow blocks\n // is fine. Similarly, replacing a terminal statement with another\n // terminal statement is allowed.\n if (b.isConnected() && !a.getSourceBlock().nextConnection &&\n !b.targetBlock()!.isShadow() && b.targetBlock()!.nextConnection) {\n return false;\n }\n break;\n }\n default:\n // Unexpected connection type.\n return false;\n }\n\n // Don't let blocks try to connect to themselves or ones they nest.\n if (common.draggingConnections.indexOf(b) !== -1) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Helper function for drag checking.\n *\n * @param a The connection to check, which must be a statement input or next\n * connection.\n * @param b A nearby connection to check, which must be a previous connection.\n * @returns True if the connection is allowed, false otherwise.\n */\n protected canConnectToPrevious_(a: Connection, b: Connection): boolean {\n if (a.targetConnection) {\n // This connection is already occupied.\n // A next connection will never disconnect itself mid-drag.\n return false;\n }\n\n // Don't let blocks try to connect to themselves or ones they nest.\n if (common.draggingConnections.indexOf(b) !== -1) {\n return false;\n }\n\n if (!b.targetConnection) {\n return true;\n }\n\n const targetBlock = b.targetBlock();\n // If it is connected to a real block, game over.\n if (!targetBlock!.isInsertionMarker()) {\n return false;\n }\n // If it's connected to an insertion marker but that insertion marker\n // is the first block in a stack, it's still fine. If that insertion\n // marker is in the middle of a stack, it won't work.\n return !targetBlock!.getPreviousBlock();\n }\n}\n\nregistry.register(\n registry.Type.CONNECTION_CHECKER, registry.DEFAULT, ConnectionChecker);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Classes for all types of variable events.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.VarDelete');\n\nimport * as registry from '../registry.js';\nimport type {VariableModel} from '../variable_model.js';\n\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a variable deletion event.\n *\n * @alias Blockly.Events.VarDelete\n */\nexport class VarDelete extends VarBase {\n override type = eventUtils.VAR_DELETE;\n varType?: string;\n varName?: string;\n\n /**\n * @param opt_variable The deleted variable. Undefined for a blank event.\n */\n constructor(opt_variable?: VariableModel) {\n super(opt_variable);\n\n if (!opt_variable) {\n return; // Blank event to be populated by fromJson.\n }\n this.varType = opt_variable.type;\n this.varName = opt_variable.name;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): VarDeleteJson {\n const json = super.toJson() as VarDeleteJson;\n if (!this.varType) {\n throw new Error(\n 'The var type is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.varName) {\n throw new Error(\n 'The var name is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n json['varType'] = this.varType;\n json['varName'] = this.varName;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: VarDeleteJson) {\n super.fromJson(json);\n this.varType = json['varType'];\n this.varName = json['varName'];\n }\n\n /**\n * Run a variable deletion event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.varId) {\n throw new Error(\n 'The var ID is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.varName) {\n throw new Error(\n 'The var name is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (forward) {\n workspace.deleteVariableById(this.varId);\n } else {\n workspace.createVariable(this.varName, this.varType, this.varId);\n }\n }\n}\n\nexport interface VarDeleteJson extends VarBaseJson {\n varType: string;\n varName: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.VAR_DELETE, VarDelete);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a variable rename event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.VarRename');\n\nimport * as registry from '../registry.js';\nimport type {VariableModel} from '../variable_model.js';\n\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a variable rename event.\n *\n * @alias Blockly.Events.VarRename\n */\nexport class VarRename extends VarBase {\n override type = eventUtils.VAR_RENAME;\n oldName?: string;\n newName?: string;\n\n /**\n * @param opt_variable The renamed variable. Undefined for a blank event.\n * @param newName The new name the variable will be changed to.\n */\n constructor(opt_variable?: VariableModel, newName?: string) {\n super(opt_variable);\n\n if (!opt_variable) {\n return; // Blank event to be populated by fromJson.\n }\n this.oldName = opt_variable.name;\n this.newName = typeof newName === 'undefined' ? '' : newName;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): VarRenameJson {\n const json = super.toJson() as VarRenameJson;\n if (!this.oldName) {\n throw new Error(\n 'The old var name is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.newName) {\n throw new Error(\n 'The new var name is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n json['oldName'] = this.oldName;\n json['newName'] = this.newName;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: VarRenameJson) {\n super.fromJson(json);\n this.oldName = json['oldName'];\n this.newName = json['newName'];\n }\n\n /**\n * Run a variable rename event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.varId) {\n throw new Error(\n 'The var ID is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.oldName) {\n throw new Error(\n 'The old var name is undefined. Either pass a variable to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.newName) {\n throw new Error(\n 'The new var name is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n if (forward) {\n workspace.renameVariableById(this.varId, this.newName);\n } else {\n workspace.renameVariableById(this.varId, this.oldName);\n }\n }\n}\n\nexport interface VarRenameJson extends VarBaseJson {\n oldName: string;\n newName: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.VAR_RENAME, VarRename);\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a map of variables and their types.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.VariableMap');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_var_delete.js';\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_var_rename.js';\n\nimport type {Block} from './block.js';\nimport * as dialog from './dialog.js';\nimport * as eventUtils from './events/utils.js';\nimport {Msg} from './msg.js';\nimport {Names} from './names.js';\nimport * as arrayUtils from './utils/array.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport {VariableModel} from './variable_model.js';\nimport type {Workspace} from './workspace.js';\n\n\n/**\n * Class for a variable map. This contains a dictionary data structure with\n * variable types as keys and lists of variables as values. The list of\n * variables are the type indicated by the key.\n *\n * @alias Blockly.VariableMap\n */\nexport class VariableMap {\n /**\n * A map from variable type to list of variable names. The lists contain\n * all of the named variables in the workspace, including variables that are\n * not currently in use.\n */\n private variableMap = new Map<string, VariableModel[]>();\n\n /** @param workspace The workspace this map belongs to. */\n constructor(public workspace: Workspace) {}\n\n /** Clear the variable map. */\n clear() {\n this.variableMap.clear();\n }\n /* Begin functions for renaming variables. */\n /**\n * Rename the given variable by updating its name in the variable map.\n *\n * @param variable Variable to rename.\n * @param newName New variable name.\n * @internal\n */\n renameVariable(variable: VariableModel, newName: string) {\n const type = variable.type;\n const conflictVar = this.getVariable(newName, type);\n const blocks = this.workspace.getAllBlocks(false);\n eventUtils.setGroup(true);\n try {\n // The IDs may match if the rename is a simple case change (name1 ->\n // Name1).\n if (!conflictVar || conflictVar.getId() === variable.getId()) {\n this.renameVariableAndUses_(variable, newName, blocks);\n } else {\n this.renameVariableWithConflict_(\n variable, newName, conflictVar, blocks);\n }\n } finally {\n eventUtils.setGroup(false);\n }\n }\n\n /**\n * Rename a variable by updating its name in the variable map. Identify the\n * variable to rename with the given ID.\n *\n * @param id ID of the variable to rename.\n * @param newName New variable name.\n */\n renameVariableById(id: string, newName: string) {\n const variable = this.getVariableById(id);\n if (!variable) {\n throw Error('Tried to rename a variable that didn\\'t exist. ID: ' + id);\n }\n\n this.renameVariable(variable, newName);\n }\n\n /**\n * Update the name of the given variable and refresh all references to it.\n * The new name must not conflict with any existing variable names.\n *\n * @param variable Variable to rename.\n * @param newName New variable name.\n * @param blocks The list of all blocks in the workspace.\n */\n private renameVariableAndUses_(\n variable: VariableModel, newName: string, blocks: Block[]) {\n eventUtils.fire(\n new (eventUtils.get(eventUtils.VAR_RENAME))(variable, newName));\n variable.name = newName;\n for (let i = 0; i < blocks.length; i++) {\n blocks[i].updateVarName(variable);\n }\n }\n\n /**\n * Update the name of the given variable to the same name as an existing\n * variable. The two variables are coalesced into a single variable with the\n * ID of the existing variable that was already using newName. Refresh all\n * references to the variable.\n *\n * @param variable Variable to rename.\n * @param newName New variable name.\n * @param conflictVar The variable that was already using newName.\n * @param blocks The list of all blocks in the workspace.\n */\n private renameVariableWithConflict_(\n variable: VariableModel, newName: string, conflictVar: VariableModel,\n blocks: Block[]) {\n const type = variable.type;\n const oldCase = conflictVar.name;\n\n if (newName !== oldCase) {\n // Simple rename to change the case and update references.\n this.renameVariableAndUses_(conflictVar, newName, blocks);\n }\n\n // These blocks now refer to a different variable.\n // These will fire change events.\n for (let i = 0; i < blocks.length; i++) {\n blocks[i].renameVarById(variable.getId(), conflictVar.getId());\n }\n // Finally delete the original variable, which is now unreferenced.\n eventUtils.fire(new (eventUtils.get(eventUtils.VAR_DELETE))(variable));\n // And remove it from the list.\n arrayUtils.removeElem(this.variableMap.get(type)!, variable);\n }\n /* End functions for renaming variables. */\n /**\n * Create a variable with a given name, optional type, and optional ID.\n *\n * @param name The name of the variable. This must be unique across variables\n * and procedures.\n * @param opt_type The type of the variable like 'int' or 'string'.\n * Does not need to be unique. Field_variable can filter variables based\n * on their type. This will default to '' which is a specific type.\n * @param opt_id The unique ID of the variable. This will default to a UUID.\n * @returns The newly created variable.\n */\n createVariable(name: string, opt_type?: string|null, opt_id?: string|null):\n VariableModel {\n let variable = this.getVariable(name, opt_type);\n if (variable) {\n if (opt_id && variable.getId() !== opt_id) {\n throw Error(\n 'Variable \"' + name + '\" is already in use and its id is \"' +\n variable.getId() + '\" which conflicts with the passed in ' +\n 'id, \"' + opt_id + '\".');\n }\n // The variable already exists and has the same ID.\n return variable;\n }\n if (opt_id && this.getVariableById(opt_id)) {\n throw Error('Variable id, \"' + opt_id + '\", is already in use.');\n }\n const id = opt_id || idGenerator.genUid();\n const type = opt_type || '';\n variable = new VariableModel(this.workspace, name, type, id);\n\n const variables = this.variableMap.get(type) || [];\n variables.push(variable);\n // Delete the list of variables of this type, and re-add it so that\n // the most recent addition is at the end.\n // This is used so the toolbox's set block is set to the most recent\n // variable.\n this.variableMap.delete(type);\n this.variableMap.set(type, variables);\n\n return variable;\n }\n /* Begin functions for variable deletion. */\n /**\n * Delete a variable.\n *\n * @param variable Variable to delete.\n */\n deleteVariable(variable: VariableModel) {\n const variableId = variable.getId();\n const variableList = this.variableMap.get(variable.type);\n if (variableList) {\n for (let i = 0; i < variableList.length; i++) {\n const tempVar = variableList[i];\n if (tempVar.getId() === variableId) {\n variableList.splice(i, 1);\n eventUtils.fire(\n new (eventUtils.get(eventUtils.VAR_DELETE))(variable));\n return;\n }\n }\n }\n }\n\n /**\n * Delete a variables by the passed in ID and all of its uses from this\n * workspace. May prompt the user for confirmation.\n *\n * @param id ID of variable to delete.\n */\n deleteVariableById(id: string) {\n const variable = this.getVariableById(id);\n if (variable) {\n // Check whether this variable is a function parameter before deleting.\n const variableName = variable.name;\n const uses = this.getVariableUsesById(id);\n for (let i = 0, block; block = uses[i]; i++) {\n if (block.type === 'procedures_defnoreturn' ||\n block.type === 'procedures_defreturn') {\n const procedureName = String(block.getFieldValue('NAME'));\n const deleteText = Msg['CANNOT_DELETE_VARIABLE_PROCEDURE']\n .replace('%1', variableName)\n .replace('%2', procedureName);\n dialog.alert(deleteText);\n return;\n }\n }\n\n if (uses.length > 1) {\n // Confirm before deleting multiple blocks.\n const confirmText = Msg['DELETE_VARIABLE_CONFIRMATION']\n .replace('%1', String(uses.length))\n .replace('%2', variableName);\n dialog.confirm(confirmText, (ok) => {\n if (ok && variable) {\n this.deleteVariableInternal(variable, uses);\n }\n });\n } else {\n // No confirmation necessary for a single block.\n this.deleteVariableInternal(variable, uses);\n }\n } else {\n console.warn('Can\\'t delete non-existent variable: ' + id);\n }\n }\n\n /**\n * Deletes a variable and all of its uses from this workspace without asking\n * the user for confirmation.\n *\n * @param variable Variable to delete.\n * @param uses An array of uses of the variable.\n * @internal\n */\n deleteVariableInternal(variable: VariableModel, uses: Block[]) {\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n try {\n for (let i = 0; i < uses.length; i++) {\n uses[i].dispose(true);\n }\n this.deleteVariable(variable);\n } finally {\n if (!existingGroup) {\n eventUtils.setGroup(false);\n }\n }\n }\n /* End functions for variable deletion. */\n /**\n * Find the variable by the given name and type and return it. Return null if\n * it is not found.\n *\n * @param name The name to check for.\n * @param opt_type The type of the variable. If not provided it defaults to\n * the empty string, which is a specific type.\n * @returns The variable with the given name, or null if it was not found.\n */\n getVariable(name: string, opt_type?: string|null): VariableModel|null {\n const type = opt_type || '';\n const list = this.variableMap.get(type);\n if (list) {\n for (let j = 0, variable; variable = list[j]; j++) {\n if (Names.equals(variable.name, name)) {\n return variable;\n }\n }\n }\n return null;\n }\n\n /**\n * Find the variable by the given ID and return it. Return null if not found.\n *\n * @param id The ID to check for.\n * @returns The variable with the given ID.\n */\n getVariableById(id: string): VariableModel|null {\n for (const [_key, variables] of this.variableMap) {\n for (const variable of variables) {\n if (variable.getId() === id) {\n return variable;\n }\n }\n }\n return null;\n }\n\n /**\n * Get a list containing all of the variables of a specified type. If type is\n * null, return list of variables with empty string type.\n *\n * @param type Type of the variables to find.\n * @returns The sought after variables of the passed in type. An empty array\n * if none are found.\n */\n getVariablesOfType(type: string|null): VariableModel[] {\n type = type || '';\n const variableList = this.variableMap.get(type);\n if (variableList) {\n return variableList.slice();\n }\n return [];\n }\n\n /**\n * Return all variable and potential variable types. This list always\n * contains the empty string.\n *\n * @param ws The workspace used to look for potential variables. This can be\n * different than the workspace stored on this object if the passed in ws\n * is a flyout workspace.\n * @returns List of variable types.\n * @internal\n */\n getVariableTypes(ws: Workspace|null): string[] {\n const variableTypes = new Set<string>(this.variableMap.keys());\n if (ws && ws.getPotentialVariableMap()) {\n for (const key of ws.getPotentialVariableMap()!.variableMap.keys()) {\n variableTypes.add(key);\n }\n }\n if (!variableTypes.has('')) {\n variableTypes.add('');\n }\n return Array.from(variableTypes.values());\n }\n\n /**\n * Return all variables of all types.\n *\n * @returns List of variable models.\n */\n getAllVariables(): VariableModel[] {\n let allVariables: VariableModel[] = [];\n for (const variables of this.variableMap.values()) {\n allVariables = allVariables.concat(variables);\n }\n return allVariables;\n }\n\n /**\n * Returns all of the variable names of all types.\n *\n * @returns All of the variable names of all types.\n */\n getAllVariableNames(): string[] {\n return Array.from(this.variableMap.values())\n .flat()\n .map((variable) => variable.name);\n }\n\n /**\n * Find all the uses of a named variable.\n *\n * @param id ID of the variable to find.\n * @returns Array of block usages.\n */\n getVariableUsesById(id: string): Block[] {\n const uses = [];\n const blocks = this.workspace.getAllBlocks(false);\n // Iterate through every block and check the name.\n for (let i = 0; i < blocks.length; i++) {\n const blockVariables = blocks[i].getVarModels();\n if (blockVariables) {\n for (let j = 0; j < blockVariables.length; j++) {\n if (blockVariables[j].getId() === id) {\n uses.push(blocks[i]);\n }\n }\n }\n }\n return uses;\n }\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a workspace.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Workspace');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './connection_checker.js';\n\nimport type {Block} from './block.js';\nimport type {BlocklyOptions} from './blockly_options.js';\nimport type {ConnectionDB} from './connection_db.js';\nimport type {Abstract} from './events/events_abstract.js';\nimport * as common from './common.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IASTNodeLocation} from './interfaces/i_ast_node_location.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport {Options} from './options.js';\nimport * as registry from './registry.js';\nimport * as arrayUtils from './utils/array.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport * as math from './utils/math.js';\nimport type * as toolbox from './utils/toolbox.js';\nimport {VariableMap} from './variable_map.js';\nimport type {VariableModel} from './variable_model.js';\nimport type {WorkspaceComment} from './workspace_comment.js';\n\n\n/**\n * Class for a workspace. This is a data structure that contains blocks.\n * There is no UI, and can be created headlessly.\n *\n * @alias Blockly.Workspace\n */\nexport class Workspace implements IASTNodeLocation {\n /**\n * Angle away from the horizontal to sweep for blocks. Order of execution is\n * generally top to bottom, but a small angle changes the scan to give a bit\n * of a left to right bias (reversed in RTL). Units are in degrees. See:\n * https://tvtropes.org/pmwiki/pmwiki.php/Main/DiagonalBilling\n */\n static SCAN_ANGLE = 3;\n id: string;\n options: Options;\n RTL: boolean;\n horizontalLayout: boolean;\n toolboxPosition: toolbox.Position;\n\n /**\n * Returns `true` if the workspace is visible and `false` if it's headless.\n */\n rendered = false;\n\n /**\n * Is this workspace the surface for a flyout?\n *\n * @internal\n */\n internalIsFlyout = false;\n\n /** Is this workspace the surface for a flyout? */\n get isFlyout(): boolean {\n return this.internalIsFlyout;\n }\n\n /**\n * Is this workspace the surface for a mutator?\n *\n * @internal\n */\n internalIsMutator = false;\n\n /** Is this workspace the surface for a mutator? */\n get isMutator(): boolean {\n return this.internalIsMutator;\n }\n\n /**\n * Returns `true` if the workspace is currently in the process of a bulk\n * clear.\n *\n * @internal\n */\n isClearing = false;\n\n /**\n * Maximum number of undo events in stack. `0` turns off undo, `Infinity`\n * sets it to unlimited.\n */\n MAX_UNDO = 1024;\n\n /** Set of databases for rapid lookup of connection locations. */\n connectionDBList: ConnectionDB[] = [];\n connectionChecker: IConnectionChecker;\n\n private readonly topBlocks_: Block[] = [];\n private readonly topComments_: WorkspaceComment[] = [];\n private readonly commentDB = new Map<string, WorkspaceComment>();\n private readonly listeners_: Function[] = [];\n protected undoStack_: Abstract[] = [];\n protected redoStack_: Abstract[] = [];\n private readonly blockDB = new Map<string, Block>();\n private readonly typedBlocksDB = new Map<string, Block[]>();\n private variableMap_: VariableMap;\n\n /**\n * Blocks in the flyout can refer to variables that don't exist in the main\n * workspace. For instance, the \"get item in list\" block refers to an\n * \"item\" variable regardless of whether the variable has been created yet.\n * A FieldVariable must always refer to a VariableModel. We reconcile\n * these by tracking \"potential\" variables in the flyout. These variables\n * become real when references to them are dragged into the main workspace.\n */\n private potentialVariableMap_: VariableMap|null = null;\n\n /** @param opt_options Dictionary of options. */\n constructor(opt_options?: Options) {\n this.id = idGenerator.genUid();\n common.registerWorkspace(this);\n this.options = opt_options || new Options(({} as BlocklyOptions));\n this.RTL = !!this.options.RTL;\n this.horizontalLayout = !!this.options.horizontalLayout;\n this.toolboxPosition = this.options.toolboxPosition;\n\n const connectionCheckerClass = registry.getClassFromOptions(\n registry.Type.CONNECTION_CHECKER, this.options, true);\n /**\n * An object that encapsulates logic for safety, type, and dragging checks.\n */\n this.connectionChecker = new connectionCheckerClass!(this);\n\n /**\n * A map from variable type to list of variable names. The lists contain\n * all of the named variables in the workspace, including variables that are\n * not currently in use.\n */\n this.variableMap_ = new VariableMap(this);\n }\n\n /**\n * Dispose of this workspace.\n * Unlink from all DOM elements to prevent memory leaks.\n *\n * @suppress {checkTypes}\n */\n dispose() {\n this.listeners_.length = 0;\n this.clear();\n // Remove from workspace database.\n common.unregisterWorkpace(this);\n }\n\n /**\n * Compare function for sorting objects (blocks, comments, etc) by position;\n * top to bottom (with slight LTR or RTL bias).\n *\n * @param a The first object to compare.\n * @param b The second object to compare.\n * @returns The comparison value. This tells Array.sort() how to change object\n * a's index.\n */\n private sortObjects_(a: Block|WorkspaceComment, b: Block|WorkspaceComment):\n number {\n // AnyDuringMigration because: Property 'getRelativeToSurfaceXY' does not\n // exist on type 'Block | WorkspaceComment'.\n const aXY = (a as AnyDuringMigration).getRelativeToSurfaceXY();\n // AnyDuringMigration because: Property 'getRelativeToSurfaceXY' does not\n // exist on type 'Block | WorkspaceComment'.\n const bXY = (b as AnyDuringMigration).getRelativeToSurfaceXY();\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'.\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'.\n return aXY.y +\n (Workspace.prototype.sortObjects_ as AnyDuringMigration).offset *\n aXY.x -\n (bXY.y +\n (Workspace.prototype.sortObjects_ as AnyDuringMigration).offset *\n bXY.x);\n }\n\n /**\n * Adds a block to the list of top blocks.\n *\n * @param block Block to add.\n */\n addTopBlock(block: Block) {\n this.topBlocks_.push(block);\n }\n\n /**\n * Removes a block from the list of top blocks.\n *\n * @param block Block to remove.\n */\n removeTopBlock(block: Block) {\n if (!arrayUtils.removeElem(this.topBlocks_, block)) {\n throw Error('Block not present in workspace\\'s list of top-most blocks.');\n }\n }\n\n /**\n * Finds the top-level blocks and returns them. Blocks are optionally sorted\n * by position; top to bottom (with slight LTR or RTL bias).\n *\n * @param ordered Sort the list if true.\n * @returns The top-level block objects.\n */\n getTopBlocks(ordered: boolean): Block[] {\n // Copy the topBlocks_ list.\n const blocks = (new Array<Block>()).concat(this.topBlocks_);\n if (ordered && blocks.length > 1) {\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'.\n (this.sortObjects_ as AnyDuringMigration).offset =\n Math.sin(math.toRadians(Workspace.SCAN_ANGLE));\n if (this.RTL) {\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) =>\n // number'.\n (this.sortObjects_ as AnyDuringMigration).offset *= -1;\n }\n blocks.sort(this.sortObjects_);\n }\n return blocks;\n }\n\n /**\n * Add a block to the list of blocks keyed by type.\n *\n * @param block Block to add.\n */\n addTypedBlock(block: Block) {\n if (!this.typedBlocksDB.has(block.type)) {\n this.typedBlocksDB.set(block.type, []);\n }\n this.typedBlocksDB.get(block.type)!.push(block);\n }\n\n /**\n * Remove a block from the list of blocks keyed by type.\n *\n * @param block Block to remove.\n */\n removeTypedBlock(block: Block) {\n arrayUtils.removeElem(this.typedBlocksDB.get(block.type)!, block);\n if (!this.typedBlocksDB.get(block.type)!.length) {\n this.typedBlocksDB.delete(block.type);\n }\n }\n\n /**\n * Finds the blocks with the associated type and returns them. Blocks are\n * optionally sorted by position; top to bottom (with slight LTR or RTL bias).\n *\n * @param type The type of block to search for.\n * @param ordered Sort the list if true.\n * @returns The blocks of the given type.\n */\n getBlocksByType(type: string, ordered: boolean): Block[] {\n if (!this.typedBlocksDB.has(type)) {\n return [];\n }\n const blocks = this.typedBlocksDB.get(type)!.slice(0);\n if (ordered && blocks && blocks.length > 1) {\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'.\n (this.sortObjects_ as AnyDuringMigration).offset =\n Math.sin(math.toRadians(Workspace.SCAN_ANGLE));\n if (this.RTL) {\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) =>\n // number'.\n (this.sortObjects_ as AnyDuringMigration).offset *= -1;\n }\n blocks.sort(this.sortObjects_);\n }\n\n return blocks.filter(function(block: AnyDuringMigration) {\n return !block.isInsertionMarker();\n });\n }\n\n /**\n * Adds a comment to the list of top comments.\n *\n * @param comment comment to add.\n * @internal\n */\n addTopComment(comment: WorkspaceComment) {\n this.topComments_.push(comment);\n\n // Note: If the comment database starts to hold block comments, this may\n // need to move to a separate function.\n if (this.commentDB.has(comment.id)) {\n console.warn(\n 'Overriding an existing comment on this workspace, with id \"' +\n comment.id + '\"');\n }\n this.commentDB.set(comment.id, comment);\n }\n\n /**\n * Removes a comment from the list of top comments.\n *\n * @param comment comment to remove.\n * @internal\n */\n removeTopComment(comment: WorkspaceComment) {\n if (!arrayUtils.removeElem(this.topComments_, comment)) {\n throw Error(\n 'Comment not present in workspace\\'s list of top-most ' +\n 'comments.');\n }\n // Note: If the comment database starts to hold block comments, this may\n // need to move to a separate function.\n this.commentDB.delete(comment.id);\n }\n\n /**\n * Finds the top-level comments and returns them. Comments are optionally\n * sorted by position; top to bottom (with slight LTR or RTL bias).\n *\n * @param ordered Sort the list if true.\n * @returns The top-level comment objects.\n * @internal\n */\n getTopComments(ordered: boolean): WorkspaceComment[] {\n // Copy the topComments_ list.\n const comments = (new Array<WorkspaceComment>()).concat(this.topComments_);\n if (ordered && comments.length > 1) {\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'.\n (this.sortObjects_ as AnyDuringMigration).offset =\n Math.sin(math.toRadians(Workspace.SCAN_ANGLE));\n if (this.RTL) {\n // AnyDuringMigration because: Property 'offset' does not exist on type\n // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) =>\n // number'.\n (this.sortObjects_ as AnyDuringMigration).offset *= -1;\n }\n comments.sort(this.sortObjects_);\n }\n return comments;\n }\n\n /**\n * Find all blocks in workspace. Blocks are optionally sorted\n * by position; top to bottom (with slight LTR or RTL bias).\n *\n * @param ordered Sort the list if true.\n * @returns Array of blocks.\n */\n getAllBlocks(ordered: boolean): Block[] {\n let blocks: AnyDuringMigration[];\n if (ordered) {\n // Slow, but ordered.\n const topBlocks = this.getTopBlocks(true);\n blocks = [];\n for (let i = 0; i < topBlocks.length; i++) {\n blocks.push(...topBlocks[i].getDescendants(true));\n }\n } else {\n // Fast, but in no particular order.\n blocks = this.getTopBlocks(false);\n for (let i = 0; i < blocks.length; i++) {\n blocks.push(...blocks[i].getChildren(false));\n }\n }\n\n // Insertion markers exist on the workspace for rendering reasons, but\n // aren't \"real\" blocks from a developer perspective.\n const filtered = blocks.filter(function(block) {\n return !block.isInsertionMarker();\n });\n\n return filtered;\n }\n\n /** Dispose of all blocks and comments in workspace. */\n clear() {\n this.isClearing = true;\n try {\n const existingGroup = eventUtils.getGroup();\n if (!existingGroup) {\n eventUtils.setGroup(true);\n }\n while (this.topBlocks_.length) {\n this.topBlocks_[0].dispose(false);\n }\n while (this.topComments_.length) {\n this.topComments_[this.topComments_.length - 1].dispose();\n }\n if (!existingGroup) {\n eventUtils.setGroup(false);\n }\n this.variableMap_.clear();\n if (this.potentialVariableMap_) {\n this.potentialVariableMap_.clear();\n }\n } finally {\n this.isClearing = false;\n }\n }\n\n /* Begin functions that are just pass-throughs to the variable map. */\n /**\n * Rename a variable by updating its name in the variable map. Identify the\n * variable to rename with the given ID.\n *\n * @param id ID of the variable to rename.\n * @param newName New variable name.\n */\n renameVariableById(id: string, newName: string) {\n this.variableMap_.renameVariableById(id, newName);\n }\n\n /**\n * Create a variable with a given name, optional type, and optional ID.\n *\n * @param name The name of the variable. This must be unique across variables\n * and procedures.\n * @param opt_type The type of the variable like 'int' or 'string'.\n * Does not need to be unique. Field_variable can filter variables based\n * on their type. This will default to '' which is a specific type.\n * @param opt_id The unique ID of the variable. This will default to a UUID.\n * @returns The newly created variable.\n */\n createVariable(name: string, opt_type?: string|null, opt_id?: string|null):\n VariableModel {\n return this.variableMap_.createVariable(name, opt_type, opt_id);\n }\n\n /**\n * Find all the uses of the given variable, which is identified by ID.\n *\n * @param id ID of the variable to find.\n * @returns Array of block usages.\n */\n getVariableUsesById(id: string): Block[] {\n return this.variableMap_.getVariableUsesById(id);\n }\n\n /**\n * Delete a variables by the passed in ID and all of its uses from this\n * workspace. May prompt the user for confirmation.\n *\n * @param id ID of variable to delete.\n */\n deleteVariableById(id: string) {\n this.variableMap_.deleteVariableById(id);\n }\n\n /**\n * Find the variable by the given name and return it. Return null if not\n * found.\n *\n * @param name The name to check for.\n * @param opt_type The type of the variable. If not provided it defaults to\n * the empty string, which is a specific type.\n * @returns The variable with the given name.\n */\n getVariable(name: string, opt_type?: string): VariableModel|null {\n // TODO (#1559): Possibly delete this function after resolving #1559.\n return this.variableMap_.getVariable(name, opt_type);\n }\n\n /**\n * Find the variable by the given ID and return it. Return null if not found.\n *\n * @param id The ID to check for.\n * @returns The variable with the given ID.\n */\n getVariableById(id: string): VariableModel|null {\n return this.variableMap_.getVariableById(id);\n }\n\n /**\n * Find the variable with the specified type. If type is null, return list of\n * variables with empty string type.\n *\n * @param type Type of the variables to find.\n * @returns The sought after variables of the passed in type. An empty array\n * if none are found.\n */\n getVariablesOfType(type: string|null): VariableModel[] {\n return this.variableMap_.getVariablesOfType(type);\n }\n\n /**\n * Return all variable types.\n *\n * @returns List of variable types.\n * @internal\n */\n getVariableTypes(): string[] {\n return this.variableMap_.getVariableTypes(this);\n }\n\n /**\n * Return all variables of all types.\n *\n * @returns List of variable models.\n */\n getAllVariables(): VariableModel[] {\n return this.variableMap_.getAllVariables();\n }\n\n /**\n * Returns all variable names of all types.\n *\n * @returns List of all variable names of all types.\n */\n getAllVariableNames(): string[] {\n return this.variableMap_.getAllVariableNames();\n }\n /* End functions that are just pass-throughs to the variable map. */\n /**\n * Returns the horizontal offset of the workspace.\n * Intended for LTR/RTL compatibility in XML.\n * Not relevant for a headless workspace.\n *\n * @returns Width.\n */\n getWidth(): number {\n return 0;\n }\n\n /* eslint-disable jsdoc/require-returns-check */\n /* eslint-disable @typescript-eslint/no-unused-vars */\n /**\n * Obtain a newly created block.\n *\n * @param prototypeName Name of the language object containing type-specific\n * functions for this block.\n * @param opt_id Optional ID. Use this ID if provided, otherwise create a new\n * ID.\n * @returns The created block.\n */\n newBlock(prototypeName: string, opt_id?: string): Block {\n throw new Error(\n 'The implementation of newBlock should be ' +\n 'monkey-patched in by blockly.ts');\n }\n /* eslint-enable */\n\n /**\n * The number of blocks that may be added to the workspace before reaching\n * the maxBlocks.\n *\n * @returns Number of blocks left.\n */\n remainingCapacity(): number {\n if (isNaN(this.options.maxBlocks)) {\n return Infinity;\n }\n\n return this.options.maxBlocks - this.getAllBlocks(false).length;\n }\n\n /**\n * The number of blocks of the given type that may be added to the workspace\n * before reaching the maxInstances allowed for that type.\n *\n * @param type Type of block to return capacity for.\n * @returns Number of blocks of type left.\n */\n remainingCapacityOfType(type: string): number {\n if (!this.options.maxInstances) {\n return Infinity;\n }\n\n const maxInstanceOfType = this.options.maxInstances[type] !== undefined ?\n this.options.maxInstances[type] :\n Infinity;\n\n return maxInstanceOfType - this.getBlocksByType(type, false).length;\n }\n\n /**\n * Check if there is remaining capacity for blocks of the given counts to be\n * created. If the total number of blocks represented by the map is more\n * than the total remaining capacity, it returns false. If a type count is\n * more than the remaining capacity for that type, it returns false.\n *\n * @param typeCountsMap A map of types to counts (usually representing blocks\n * to be created).\n * @returns True if there is capacity for the given map, false otherwise.\n */\n isCapacityAvailable(typeCountsMap: AnyDuringMigration): boolean {\n if (!this.hasBlockLimits()) {\n return true;\n }\n let copyableBlocksCount = 0;\n for (const type in typeCountsMap) {\n if (typeCountsMap[type] > this.remainingCapacityOfType(type)) {\n return false;\n }\n copyableBlocksCount += typeCountsMap[type];\n }\n if (copyableBlocksCount > this.remainingCapacity()) {\n return false;\n }\n return true;\n }\n\n /**\n * Checks if the workspace has any limits on the maximum number of blocks,\n * or the maximum number of blocks of specific types.\n *\n * @returns True if it has block limits, false otherwise.\n */\n hasBlockLimits(): boolean {\n return this.options.maxBlocks !== Infinity || !!this.options.maxInstances;\n }\n\n /**\n * Gets the undo stack for workplace.\n *\n * @returns undo stack\n * @internal\n */\n getUndoStack(): Abstract[] {\n return this.undoStack_;\n }\n\n /**\n * Gets the redo stack for workplace.\n *\n * @returns redo stack\n * @internal\n */\n getRedoStack(): Abstract[] {\n return this.redoStack_;\n }\n\n /**\n * Undo or redo the previous action.\n *\n * @param redo False if undo, true if redo.\n */\n undo(redo: boolean) {\n const inputStack = redo ? this.redoStack_ : this.undoStack_;\n const outputStack = redo ? this.undoStack_ : this.redoStack_;\n const inputEvent = inputStack.pop();\n if (!inputEvent) {\n return;\n }\n let events = [inputEvent];\n // Do another undo/redo if the next one is of the same group.\n while (inputStack.length && inputEvent.group &&\n inputEvent.group === inputStack[inputStack.length - 1].group) {\n // AnyDuringMigration because: Argument of type 'Abstract | undefined' is\n // not assignable to parameter of type 'Abstract'.\n events.push(inputStack.pop() as AnyDuringMigration);\n }\n // Push these popped events on the opposite stack.\n for (let i = 0; i < events.length; i++) {\n const event = events[i];\n outputStack.push(event);\n }\n events = eventUtils.filter(events, redo);\n eventUtils.setRecordUndo(false);\n try {\n for (let i = 0; i < events.length; i++) {\n const event = events[i];\n event.run(redo);\n }\n } finally {\n eventUtils.setRecordUndo(true);\n }\n }\n\n /** Clear the undo/redo stacks. */\n clearUndo() {\n this.undoStack_.length = 0;\n this.redoStack_.length = 0;\n // Stop any events already in the firing queue from being undoable.\n eventUtils.clearPendingUndo();\n }\n\n /**\n * When something in this workspace changes, call a function.\n * Note that there may be a few recent events already on the stack. Thus the\n * new change listener might be called with events that occurred a few\n * milliseconds before the change listener was added.\n *\n * @param func Function to call.\n * @returns Obsolete return value, ignore.\n */\n addChangeListener(func: Function): Function {\n this.listeners_.push(func);\n return func;\n }\n\n /**\n * Stop listening for this workspace's changes.\n *\n * @param func Function to stop calling.\n */\n removeChangeListener(func: Function) {\n arrayUtils.removeElem(this.listeners_, func);\n }\n\n /**\n * Fire a change event.\n *\n * @param event Event to fire.\n */\n fireChangeListener(event: Abstract) {\n if (event.recordUndo) {\n this.undoStack_.push(event);\n this.redoStack_.length = 0;\n while (this.undoStack_.length > this.MAX_UNDO && this.MAX_UNDO >= 0) {\n this.undoStack_.shift();\n }\n }\n for (let i = 0; i < this.listeners_.length; i++) {\n const func = this.listeners_[i];\n func(event);\n }\n }\n\n /**\n * Find the block on this workspace with the specified ID.\n *\n * @param id ID of block to find.\n * @returns The sought after block, or null if not found.\n */\n getBlockById(id: string): Block|null {\n return this.blockDB.get(id) || null;\n }\n\n /**\n * Set a block on this workspace with the specified ID.\n *\n * @param id ID of block to set.\n * @param block The block to set.\n * @internal\n */\n setBlockById(id: string, block: Block) {\n this.blockDB.set(id, block);\n }\n\n /**\n * Delete a block off this workspace with the specified ID.\n *\n * @param id ID of block to delete.\n * @internal\n */\n removeBlockById(id: string) {\n this.blockDB.delete(id);\n }\n\n /**\n * Find the comment on this workspace with the specified ID.\n *\n * @param id ID of comment to find.\n * @returns The sought after comment, or null if not found.\n * @internal\n */\n getCommentById(id: string): WorkspaceComment|null {\n return this.commentDB.get(id) ?? null;\n }\n\n /**\n * Checks whether all value and statement inputs in the workspace are filled\n * with blocks.\n *\n * @param opt_shadowBlocksAreFilled An optional argument controlling whether\n * shadow blocks are counted as filled. Defaults to true.\n * @returns True if all inputs are filled, false otherwise.\n */\n allInputsFilled(opt_shadowBlocksAreFilled?: boolean): boolean {\n const blocks = this.getTopBlocks(false);\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n if (!block.allInputsFilled(opt_shadowBlocksAreFilled)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Return the variable map that contains \"potential\" variables.\n * These exist in the flyout but not in the workspace.\n *\n * @returns The potential variable map.\n * @internal\n */\n getPotentialVariableMap(): VariableMap|null {\n return this.potentialVariableMap_;\n }\n\n /**\n * Create and store the potential variable map for this workspace.\n *\n * @internal\n */\n createPotentialVariableMap() {\n this.potentialVariableMap_ = new VariableMap(this);\n }\n\n /**\n * Return the map of all variables on the workspace.\n *\n * @returns The variable map.\n */\n getVariableMap(): VariableMap {\n return this.variableMap_;\n }\n\n /**\n * Set the map of all variables on the workspace.\n *\n * @param variableMap The variable map.\n * @internal\n */\n setVariableMap(variableMap: VariableMap) {\n this.variableMap_ = variableMap;\n }\n\n /**\n * Find the workspace with the specified ID.\n *\n * @param id ID of workspace to find.\n * @returns The sought after workspace or null if not found.\n */\n static getById(id: string): Workspace|null {\n return common.getWorkspaceById(id);\n }\n\n /**\n * Find all workspaces.\n *\n * @returns Array of workspaces.\n */\n static getAll(): Workspace[] {\n return common.getAllWorkspaces();\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object in charge of loading, storing, and playing audio for a\n * workspace.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.WorkspaceAudio');\n\nimport * as userAgent from './utils/useragent.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Prevent a sound from playing if another sound preceded it within this many\n * milliseconds.\n */\nconst SOUND_LIMIT = 100;\n\n/**\n * Class for loading, storing, and playing audio for a workspace.\n *\n * @alias Blockly.WorkspaceAudio\n */\nexport class WorkspaceAudio {\n /** Database of pre-loaded sounds. */\n private sounds = new Map<string, HTMLAudioElement>();\n\n /** Time that the last sound was played. */\n private lastSound_: Date|null = null;\n\n /**\n * @param parentWorkspace The parent of the workspace this audio object\n * belongs to, or null.\n */\n constructor(private parentWorkspace: WorkspaceSvg) {}\n\n /**\n * Dispose of this audio manager.\n *\n * @internal\n */\n dispose() {\n this.sounds.clear();\n }\n\n /**\n * Load an audio file. Cache it, ready for instantaneous playing.\n *\n * @param filenames List of file types in decreasing order of preference (i.e.\n * increasing size). E.g. ['media/go.mp3', 'media/go.wav'] Filenames\n * include path from Blockly's root. File extensions matter.\n * @param name Name of sound.\n */\n load(filenames: string[], name: string) {\n if (!filenames.length) {\n return;\n }\n let audioTest;\n try {\n audioTest = new globalThis['Audio']();\n } catch (e) {\n // No browser support for Audio.\n // IE can throw an error even if the Audio object exists.\n return;\n }\n let sound;\n for (let i = 0; i < filenames.length; i++) {\n const filename = filenames[i];\n const ext = filename.match(/\\.(\\w+)$/);\n if (ext && audioTest.canPlayType('audio/' + ext[1])) {\n // Found an audio format we can play.\n sound = new globalThis['Audio'](filename);\n break;\n }\n }\n if (sound) {\n this.sounds.set(name, sound);\n }\n }\n\n /**\n * Preload all the audio files so that they play quickly when asked for.\n *\n * @internal\n */\n preload() {\n for (const sound of this.sounds.values()) {\n sound.volume = 0.01;\n const playPromise = sound.play();\n // Edge does not return a promise, so we need to check.\n if (playPromise !== undefined) {\n // If we don't wait for the play request to complete before calling\n // pause() we will get an exception: (DOMException: The play() request\n // was interrupted) See more:\n // https://developers.google.com/web/updates/2017/06/play-request-was-interrupted\n playPromise.then(sound.pause)\n .catch(\n // Play without user interaction was prevented.\n function() {});\n } else {\n sound.pause();\n }\n\n // iOS can only process one sound at a time. Trying to load more than one\n // corrupts the earlier ones. Just load one and leave the others\n // uncached.\n if (userAgent.IPAD || userAgent.IPHONE) {\n break;\n }\n }\n }\n\n /**\n * Play a named sound at specified volume. If volume is not specified,\n * use full volume (1).\n *\n * @param name Name of sound.\n * @param opt_volume Volume of sound (0-1).\n */\n play(name: string, opt_volume?: number) {\n const sound = this.sounds.get(name);\n if (sound) {\n // Don't play one sound on top of another.\n const now = new Date();\n if (this.lastSound_ !== null &&\n now.getTime() - this.lastSound_.getTime() < SOUND_LIMIT) {\n return;\n }\n this.lastSound_ = now;\n let mySound;\n if (userAgent.IPAD || userAgent.ANDROID) {\n // Creating a new audio node causes lag in Android and iPad. Android\n // refetches the file from the server, iPad uses a singleton audio\n // node which must be deleted and recreated for each new audio tag.\n mySound = sound;\n } else {\n mySound = sound.cloneNode() as HTMLAudioElement;\n }\n mySound.volume = opt_volume === undefined ? 1 : opt_volume;\n mySound.play();\n } else if (this.parentWorkspace) {\n // Maybe a workspace on a lower level knows about this sound.\n this.parentWorkspace.getAudioManager().play(name, opt_volume);\n }\n }\n}\n","/**\n * @license\n * Copyright 2015 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a zoom icons.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ZoomControls');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_click.js';\n\nimport * as browserEvents from './browser_events.js';\nimport {ComponentManager} from './component_manager.js';\nimport * as Css from './css.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IPositionable} from './interfaces/i_positionable.js';\nimport type {UiMetrics} from './metrics_manager.js';\nimport * as uiPosition from './positionable_helpers.js';\nimport {SPRITE} from './sprites.js';\nimport * as Touch from './touch.js';\nimport * as dom from './utils/dom.js';\nimport {Rect} from './utils/rect.js';\nimport {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a zoom controls.\n *\n * @alias Blockly.ZoomControls\n */\nexport class ZoomControls implements IPositionable {\n /**\n * The unique ID for this component that is used to register with the\n * ComponentManager.\n */\n id = 'zoomControls';\n\n /**\n * A handle to use to unbind the mouse down event handler for zoom reset\n * button. Opaque data returned from browserEvents.conditionalBind.\n */\n private onZoomResetWrapper_: browserEvents.Data|null = null;\n\n /**\n * A handle to use to unbind the mouse down event handler for zoom in\n * button. Opaque data returned from browserEvents.conditionalBind.\n */\n private onZoomInWrapper_: browserEvents.Data|null = null;\n\n /**\n * A handle to use to unbind the mouse down event handler for zoom out\n * button. Opaque data returned from browserEvents.conditionalBind.\n */\n private onZoomOutWrapper_: browserEvents.Data|null = null;\n\n /** The zoom in svg <g> element. */\n private zoomInGroup: SVGGElement|null = null;\n\n /** The zoom out svg <g> element. */\n private zoomOutGroup: SVGGElement|null = null;\n\n /** The zoom reset svg <g> element. */\n private zoomResetGroup: SVGGElement|null = null;\n\n /** Width of the zoom controls. */\n private readonly WIDTH_ = 32;\n\n /** Height of each zoom control. */\n private readonly HEIGHT_ = 32;\n\n /** Small spacing used between the zoom in and out control, in pixels. */\n private readonly SMALL_SPACING_ = 2;\n\n /**\n * Large spacing used between the zoom in and reset control, in pixels.\n */\n private readonly LARGE_SPACING_ = 11;\n\n /** Distance between zoom controls and bottom or top edge of workspace. */\n private readonly MARGIN_VERTICAL_ = 20;\n\n /** Distance between zoom controls and right or left edge of workspace. */\n private readonly MARGIN_HORIZONTAL_ = 20;\n\n /** The SVG group containing the zoom controls. */\n private svgGroup: SVGElement|null = null;\n\n /** Left coordinate of the zoom controls. */\n private left_ = 0;\n\n /** Top coordinate of the zoom controls. */\n private top_ = 0;\n\n /** Whether this has been initialized. */\n private initialized_ = false;\n\n /** @param workspace The workspace to sit in. */\n constructor(private readonly workspace: WorkspaceSvg) {}\n\n /**\n * Create the zoom controls.\n *\n * @returns The zoom controls SVG group.\n */\n createDom(): SVGElement {\n this.svgGroup = dom.createSvgElement(Svg.G, {});\n\n // Each filter/pattern needs a unique ID for the case of multiple Blockly\n // instances on a page. Browser behaviour becomes undefined otherwise.\n // https://neil.fraser.name/news/2015/11/01/\n const rnd = String(Math.random()).substring(2);\n this.createZoomOutSvg_(rnd);\n this.createZoomInSvg_(rnd);\n if (this.workspace.isMovable()) {\n // If we zoom to the center and the workspace isn't movable we could\n // loose blocks at the edges of the workspace.\n this.createZoomResetSvg_(rnd);\n }\n return this.svgGroup;\n }\n\n /** Initializes the zoom controls. */\n init() {\n this.workspace.getComponentManager().addComponent({\n component: this,\n weight: 2,\n capabilities: [ComponentManager.Capability.POSITIONABLE],\n });\n this.initialized_ = true;\n }\n\n /**\n * Disposes of this zoom controls.\n * Unlink from all DOM elements to prevent memory leaks.\n */\n dispose() {\n this.workspace.getComponentManager().removeComponent('zoomControls');\n if (this.svgGroup) {\n dom.removeNode(this.svgGroup);\n }\n if (this.onZoomResetWrapper_) {\n browserEvents.unbind(this.onZoomResetWrapper_);\n }\n if (this.onZoomInWrapper_) {\n browserEvents.unbind(this.onZoomInWrapper_);\n }\n if (this.onZoomOutWrapper_) {\n browserEvents.unbind(this.onZoomOutWrapper_);\n }\n }\n\n /**\n * Returns the bounding rectangle of the UI element in pixel units relative to\n * the Blockly injection div.\n *\n * @returns The UI elements's bounding box. Null if bounding box should be\n * ignored by other UI elements.\n */\n getBoundingRectangle(): Rect|null {\n let height = this.SMALL_SPACING_ + 2 * this.HEIGHT_;\n if (this.zoomResetGroup) {\n height += this.LARGE_SPACING_ + this.HEIGHT_;\n }\n const bottom = this.top_ + height;\n const right = this.left_ + this.WIDTH_;\n return new Rect(this.top_, bottom, this.left_, right);\n }\n\n /**\n * Positions the zoom controls.\n * It is positioned in the opposite corner to the corner the\n * categories/toolbox starts at.\n *\n * @param metrics The workspace metrics.\n * @param savedPositions List of rectangles that are already on the workspace.\n */\n position(metrics: UiMetrics, savedPositions: Rect[]) {\n // Not yet initialized.\n if (!this.initialized_) {\n return;\n }\n\n const cornerPosition =\n uiPosition.getCornerOppositeToolbox(this.workspace, metrics);\n let height = this.SMALL_SPACING_ + 2 * this.HEIGHT_;\n if (this.zoomResetGroup) {\n height += this.LARGE_SPACING_ + this.HEIGHT_;\n }\n const startRect = uiPosition.getStartPositionRect(\n cornerPosition, new Size(this.WIDTH_, height), this.MARGIN_HORIZONTAL_,\n this.MARGIN_VERTICAL_, metrics, this.workspace);\n\n const verticalPosition = cornerPosition.vertical;\n const bumpDirection = verticalPosition === uiPosition.verticalPosition.TOP ?\n uiPosition.bumpDirection.DOWN :\n uiPosition.bumpDirection.UP;\n const positionRect = uiPosition.bumpPositionRect(\n startRect, this.MARGIN_VERTICAL_, bumpDirection, savedPositions);\n\n if (verticalPosition === uiPosition.verticalPosition.TOP) {\n const zoomInTranslateY = this.SMALL_SPACING_ + this.HEIGHT_;\n this.zoomInGroup?.setAttribute(\n 'transform', 'translate(0, ' + zoomInTranslateY + ')');\n if (this.zoomResetGroup) {\n const zoomResetTranslateY =\n zoomInTranslateY + this.LARGE_SPACING_ + this.HEIGHT_;\n this.zoomResetGroup.setAttribute(\n 'transform', 'translate(0, ' + zoomResetTranslateY + ')');\n }\n } else {\n const zoomInTranslateY =\n this.zoomResetGroup ? this.LARGE_SPACING_ + this.HEIGHT_ : 0;\n this.zoomInGroup?.setAttribute(\n 'transform', 'translate(0, ' + zoomInTranslateY + ')');\n const zoomOutTranslateY =\n zoomInTranslateY + this.SMALL_SPACING_ + this.HEIGHT_;\n this.zoomOutGroup?.setAttribute(\n 'transform', 'translate(0, ' + zoomOutTranslateY + ')');\n }\n\n this.top_ = positionRect.top;\n this.left_ = positionRect.left;\n this.svgGroup?.setAttribute(\n 'transform', 'translate(' + this.left_ + ',' + this.top_ + ')');\n }\n\n /**\n * Create the zoom in icon and its event handler.\n *\n * @param rnd The random string to use as a suffix in the clip path's ID.\n * These IDs must be unique in case there are multiple Blockly instances\n * on the same page.\n */\n private createZoomOutSvg_(rnd: string) {\n /* This markup will be generated and added to the .svgGroup:\n <g class=\"blocklyZoom\">\n <clipPath id=\"blocklyZoomoutClipPath837493\">\n <rect width=\"32\" height=\"32></rect>\n </clipPath>\n <image width=\"96\" height=\"124\" x=\"-64\" y=\"-92\"\n xlink:href=\"media/sprites.png\"\n clip-path=\"url(#blocklyZoomoutClipPath837493)\"></image>\n </g>\n */\n this.zoomOutGroup =\n dom.createSvgElement(Svg.G, {'class': 'blocklyZoom'}, this.svgGroup);\n const clip = dom.createSvgElement(\n Svg.CLIPPATH, {'id': 'blocklyZoomoutClipPath' + rnd},\n this.zoomOutGroup);\n dom.createSvgElement(\n Svg.RECT, {\n 'width': 32,\n 'height': 32,\n },\n clip);\n const zoomoutSvg = dom.createSvgElement(\n Svg.IMAGE, {\n 'width': SPRITE.width,\n 'height': SPRITE.height,\n 'x': -64,\n 'y': -92,\n 'clip-path': 'url(#blocklyZoomoutClipPath' + rnd + ')',\n },\n this.zoomOutGroup);\n zoomoutSvg.setAttributeNS(\n dom.XLINK_NS, 'xlink:href',\n this.workspace.options.pathToMedia + SPRITE.url);\n\n // Attach listener.\n this.onZoomOutWrapper_ = browserEvents.conditionalBind(\n this.zoomOutGroup, 'mousedown', null, this.zoom_.bind(this, -1));\n }\n\n /**\n * Create the zoom out icon and its event handler.\n *\n * @param rnd The random string to use as a suffix in the clip path's ID.\n * These IDs must be unique in case there are multiple Blockly instances\n * on the same page.\n */\n private createZoomInSvg_(rnd: string) {\n /* This markup will be generated and added to the .svgGroup:\n <g class=\"blocklyZoom\">\n <clipPath id=\"blocklyZoominClipPath837493\">\n <rect width=\"32\" height=\"32\"></rect>\n </clipPath>\n <image width=\"96\" height=\"124\" x=\"-32\" y=\"-92\"\n xlink:href=\"media/sprites.png\"\n clip-path=\"url(#blocklyZoominClipPath837493)\"></image>\n </g>\n */\n this.zoomInGroup =\n dom.createSvgElement(Svg.G, {'class': 'blocklyZoom'}, this.svgGroup);\n const clip = dom.createSvgElement(\n Svg.CLIPPATH, {'id': 'blocklyZoominClipPath' + rnd}, this.zoomInGroup);\n dom.createSvgElement(\n Svg.RECT, {\n 'width': 32,\n 'height': 32,\n },\n clip);\n const zoominSvg = dom.createSvgElement(\n Svg.IMAGE, {\n 'width': SPRITE.width,\n 'height': SPRITE.height,\n 'x': -32,\n 'y': -92,\n 'clip-path': 'url(#blocklyZoominClipPath' + rnd + ')',\n },\n this.zoomInGroup);\n zoominSvg.setAttributeNS(\n dom.XLINK_NS, 'xlink:href',\n this.workspace.options.pathToMedia + SPRITE.url);\n\n // Attach listener.\n this.onZoomInWrapper_ = browserEvents.conditionalBind(\n this.zoomInGroup, 'mousedown', null, this.zoom_.bind(this, 1));\n }\n\n /**\n * Handles a mouse down event on the zoom in or zoom out buttons on the\n * workspace.\n *\n * @param amount Amount of zooming. Negative amount values zoom out, and\n * positive amount values zoom in.\n * @param e A mouse down event.\n */\n private zoom_(amount: number, e: Event) {\n this.workspace.markFocused();\n this.workspace.zoomCenter(amount);\n this.fireZoomEvent_();\n Touch.clearTouchIdentifier(); // Don't block future drags.\n e.stopPropagation(); // Don't start a workspace scroll.\n e.preventDefault(); // Stop double-clicking from selecting text.\n }\n\n /**\n * Create the zoom reset icon and its event handler.\n *\n * @param rnd The random string to use as a suffix in the clip path's ID.\n * These IDs must be unique in case there are multiple Blockly instances\n * on the same page.\n */\n private createZoomResetSvg_(rnd: string) {\n /* This markup will be generated and added to the .svgGroup:\n <g class=\"blocklyZoom\">\n <clipPath id=\"blocklyZoomresetClipPath837493\">\n <rect width=\"32\" height=\"32\"></rect>\n </clipPath>\n <image width=\"96\" height=\"124\" x=\"-32\" y=\"-92\"\n xlink:href=\"media/sprites.png\"\n clip-path=\"url(#blocklyZoomresetClipPath837493)\"></image>\n </g>\n */\n this.zoomResetGroup =\n dom.createSvgElement(Svg.G, {'class': 'blocklyZoom'}, this.svgGroup);\n const clip = dom.createSvgElement(\n Svg.CLIPPATH, {'id': 'blocklyZoomresetClipPath' + rnd},\n this.zoomResetGroup);\n dom.createSvgElement(Svg.RECT, {'width': 32, 'height': 32}, clip);\n const zoomresetSvg = dom.createSvgElement(\n Svg.IMAGE, {\n 'width': SPRITE.width,\n 'height': SPRITE.height,\n 'y': -92,\n 'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')',\n },\n this.zoomResetGroup);\n zoomresetSvg.setAttributeNS(\n dom.XLINK_NS, 'xlink:href',\n this.workspace.options.pathToMedia + SPRITE.url);\n\n // Attach event listeners.\n this.onZoomResetWrapper_ = browserEvents.conditionalBind(\n this.zoomResetGroup, 'mousedown', null, this.resetZoom_.bind(this));\n }\n\n /**\n * Handles a mouse down event on the reset zoom button on the workspace.\n *\n * @param e A mouse down event.\n */\n private resetZoom_(e: Event) {\n this.workspace.markFocused();\n\n // zoom is passed amount and computes the new scale using the formula:\n // targetScale = currentScale * Math.pow(speed, amount)\n const targetScale = this.workspace.options.zoomOptions.startScale;\n const currentScale = this.workspace.scale;\n const speed = this.workspace.options.zoomOptions.scaleSpeed;\n // To compute amount:\n // amount = log(speed, (targetScale / currentScale))\n // Math.log computes natural logarithm (ln), to change the base, use\n // formula: log(base, value) = ln(value) / ln(base)\n const amount = Math.log(targetScale / currentScale) / Math.log(speed);\n this.workspace.beginCanvasTransition();\n this.workspace.zoomCenter(amount);\n this.workspace.scrollCenter();\n\n setTimeout(this.workspace.endCanvasTransition.bind(this.workspace), 500);\n this.fireZoomEvent_();\n Touch.clearTouchIdentifier(); // Don't block future drags.\n e.stopPropagation(); // Don't start a workspace scroll.\n e.preventDefault(); // Stop double-clicking from selecting text.\n }\n\n /** Fires a zoom control UI event. */\n private fireZoomEvent_() {\n const uiEvent = new (eventUtils.get(eventUtils.CLICK))(\n null, this.workspace.id, 'zoom_controls');\n eventUtils.fire(uiEvent);\n }\n}\n\n/** CSS for zoom controls. See css.js for use. */\nCss.register(`\n.blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}\n\n.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n opacity: .8;\n}\n`);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Handles serializing variables to plain JavaScript objects, only containing\n * state.\n *\n * @namespace Blockly.serialization.variables\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.serialization.variables');\n\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport type {Workspace} from '../workspace.js';\n\nimport * as priorities from './priorities.js';\nimport * as serializationRegistry from './registry.js';\n\n\n/**\n * Represents the state of a given variable.\n *\n * @alias Blockly.serialization.variables.State\n */\nexport interface State {\n name: string;\n id: string;\n type: string|undefined;\n}\n\n/**\n * Serializer for saving and loading variable state.\n *\n * @alias Blockly.serialization.variables.VariableSerializer\n */\nclass VariableSerializer implements ISerializer {\n priority: number;\n\n /* eslint-disable-next-line require-jsdoc */\n constructor() {\n /** The priority for deserializing variables. */\n this.priority = priorities.VARIABLES;\n }\n\n /**\n * Serializes the variables of the given workspace.\n *\n * @param workspace The workspace to save the variables of.\n * @returns The state of the workspace's variables, or null if there are no\n * variables.\n */\n save(workspace: Workspace): State[]|null {\n const variableStates = [];\n for (const variable of workspace.getAllVariables()) {\n const state = {\n 'name': variable.name,\n 'id': variable.getId(),\n };\n if (variable.type) {\n (state as AnyDuringMigration)['type'] = variable.type;\n }\n variableStates.push(state);\n }\n // AnyDuringMigration because: Type '{ name: string; id: string; }[] |\n // null' is not assignable to type 'State[] | null'.\n return (variableStates.length ? variableStates : null) as\n AnyDuringMigration;\n }\n\n /**\n * Deserializes the variable defined by the given state into the given\n * workspace.\n *\n * @param state The state of the variables to deserialize.\n * @param workspace The workspace to deserialize into.\n */\n load(state: State[], workspace: Workspace) {\n for (const varState of state) {\n workspace.createVariable(\n varState['name'], varState['type'], varState['id']);\n }\n }\n\n /**\n * Disposes of any variables that exist on the workspace.\n *\n * @param workspace The workspace to clear the variables of.\n */\n clear(workspace: Workspace) {\n workspace.getVariableMap().clear();\n }\n}\n\nserializationRegistry.register('variables', new VariableSerializer());\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that provides constants for rendering blocks in Zelos\n * mode.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.ConstantProvider');\n\nimport {ConnectionType} from '../../connection_type.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {Theme} from '../../theme.js';\nimport * as utilsColour from '../../utils/colour.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport {ConstantProvider as BaseConstantProvider} from '../common/constants.js';\nimport type {Shape} from '../common/constants.js';\n\n\n/** An object containing sizing and path information about inside corners. */\nexport interface InsideCorners {\n width: number;\n height: number;\n pathTop: string;\n pathBottom: string;\n rightWidth: number;\n rightHeight: number;\n pathTopRight: string;\n pathBottomRight: string;\n}\n\n/**\n * An object that provides constants for rendering blocks in Zelos mode.\n *\n * @alias Blockly.zelos.ConstantProvider\n */\nexport class ConstantProvider extends BaseConstantProvider {\n GRID_UNIT = 4;\n STATEMENT_INPUT_SPACER_MIN_WIDTH: number;\n\n override CURSOR_COLOUR = '#ffa200';\n\n /**\n * Radius of the cursor for input and output connections.\n *\n * @internal\n */\n CURSOR_RADIUS = 5;\n\n override JAGGED_TEETH_HEIGHT = 0;\n\n override JAGGED_TEETH_WIDTH = 0;\n override START_HAT_HEIGHT = 22;\n\n override START_HAT_WIDTH = 96;\n\n override SHAPES = {HEXAGONAL: 1, ROUND: 2, SQUARE: 3, PUZZLE: 4, NOTCH: 5};\n\n /**\n * Map of output/input shapes and the amount they should cause a block to be\n * padded. Outer key is the outer shape, inner key is the inner shape.\n * When a block with the outer shape contains an input block with the inner\n * shape on its left or right edge, the block elements are aligned such that\n * the padding specified is reached.\n *\n * @internal\n */\n SHAPE_IN_SHAPE_PADDING: {[key: number]: {[key: number]: number}} = {\n 1: {\n // Outer shape: hexagon.\n 0: 5 * this.GRID_UNIT, // Field in hexagon.\n 1: 2 * this.GRID_UNIT, // Hexagon in hexagon.\n 2: 5 * this.GRID_UNIT, // Round in hexagon.\n 3: 5 * this.GRID_UNIT, // Square in hexagon.\n },\n 2: {\n // Outer shape: round.\n 0: 3 * this.GRID_UNIT, // Field in round.\n 1: 3 * this.GRID_UNIT, // Hexagon in round.\n 2: 1 * this.GRID_UNIT, // Round in round.\n 3: 2 * this.GRID_UNIT, // Square in round.\n },\n 3: {\n // Outer shape: square.\n 0: 2 * this.GRID_UNIT, // Field in square.\n 1: 2 * this.GRID_UNIT, // Hexagon in square.\n 2: 2 * this.GRID_UNIT, // Round in square.\n 3: 2 * this.GRID_UNIT, // Square in square.\n },\n };\n\n override FULL_BLOCK_FIELDS = true;\n\n override FIELD_TEXT_FONTWEIGHT = 'bold';\n\n override FIELD_TEXT_FONTFAMILY =\n '\"Helvetica Neue\", \"Segoe UI\", Helvetica, sans-serif';\n\n override FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW = true;\n\n override FIELD_DROPDOWN_COLOURED_DIV = true;\n\n override FIELD_DROPDOWN_SVG_ARROW = true;\n override FIELD_TEXTINPUT_BOX_SHADOW = true;\n\n override FIELD_COLOUR_FULL_BLOCK = true;\n MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH: number;\n\n /** The selected glow colour. */\n SELECTED_GLOW_COLOUR = '#fff200';\n\n /** The size of the selected glow. */\n SELECTED_GLOW_SIZE = 0.5;\n\n /** The replacement glow colour. */\n REPLACEMENT_GLOW_COLOUR = '#fff200';\n\n /** The size of the selected glow. */\n REPLACEMENT_GLOW_SIZE = 2;\n\n /**\n * The ID of the selected glow filter, or the empty string if no filter is\n * set.\n *\n * @internal\n */\n selectedGlowFilterId = '';\n\n /**\n * The <filter> element to use for a selected glow, or null if not set.\n */\n private selectedGlowFilter_: SVGElement|null = null;\n\n /**\n * The ID of the replacement glow filter, or the empty string if no filter\n * is set.\n *\n * @internal\n */\n replacementGlowFilterId = '';\n\n /**\n * The <filter> element to use for a replacement glow, or null if not set.\n */\n private replacementGlowFilter_: SVGElement|null = null;\n\n /**\n * The object containing information about the hexagon used for a boolean\n * reporter block. Null before init is called.\n */\n HEXAGONAL: Shape|null = null;\n\n /**\n * The object containing information about the hexagon used for a number or\n * string reporter block. Null before init is called.\n */\n ROUNDED: Shape|null = null;\n\n /**\n * The object containing information about the hexagon used for a\n * rectangular reporter block. Null before init is called.\n */\n SQUARED: Shape|null = null;\n\n /** @internal */\n constructor() {\n super();\n\n this.SMALL_PADDING = this.GRID_UNIT;\n\n this.MEDIUM_PADDING = 2 * this.GRID_UNIT;\n\n this.MEDIUM_LARGE_PADDING = 3 * this.GRID_UNIT;\n\n this.LARGE_PADDING = 4 * this.GRID_UNIT;\n\n this.CORNER_RADIUS = 1 * this.GRID_UNIT;\n\n this.NOTCH_WIDTH = 9 * this.GRID_UNIT;\n\n this.NOTCH_HEIGHT = 2 * this.GRID_UNIT;\n\n this.NOTCH_OFFSET_LEFT = 3 * this.GRID_UNIT;\n\n this.STATEMENT_INPUT_NOTCH_OFFSET = this.NOTCH_OFFSET_LEFT;\n\n this.MIN_BLOCK_WIDTH = 2 * this.GRID_UNIT;\n\n this.MIN_BLOCK_HEIGHT = 12 * this.GRID_UNIT;\n\n this.EMPTY_STATEMENT_INPUT_HEIGHT = 6 * this.GRID_UNIT;\n\n this.TOP_ROW_MIN_HEIGHT = this.CORNER_RADIUS;\n\n this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT = this.LARGE_PADDING;\n\n this.BOTTOM_ROW_MIN_HEIGHT = this.CORNER_RADIUS;\n\n this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT = 6 * this.GRID_UNIT;\n\n this.STATEMENT_BOTTOM_SPACER = -this.NOTCH_HEIGHT;\n\n /** Minimum statement input spacer width. */\n this.STATEMENT_INPUT_SPACER_MIN_WIDTH = 40 * this.GRID_UNIT;\n\n this.STATEMENT_INPUT_PADDING_LEFT = 4 * this.GRID_UNIT;\n\n this.EMPTY_INLINE_INPUT_PADDING = 4 * this.GRID_UNIT;\n\n this.EMPTY_INLINE_INPUT_HEIGHT = 8 * this.GRID_UNIT;\n\n this.DUMMY_INPUT_MIN_HEIGHT = 8 * this.GRID_UNIT;\n\n this.DUMMY_INPUT_SHADOW_MIN_HEIGHT = 6 * this.GRID_UNIT;\n\n this.CURSOR_WS_WIDTH = 20 * this.GRID_UNIT;\n\n this.FIELD_TEXT_FONTSIZE = 3 * this.GRID_UNIT;\n\n this.FIELD_BORDER_RECT_RADIUS = this.CORNER_RADIUS;\n\n this.FIELD_BORDER_RECT_X_PADDING = 2 * this.GRID_UNIT;\n\n this.FIELD_BORDER_RECT_Y_PADDING = 1.625 * this.GRID_UNIT;\n\n this.FIELD_BORDER_RECT_HEIGHT = 8 * this.GRID_UNIT;\n\n this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT = 8 * this.GRID_UNIT;\n\n this.FIELD_DROPDOWN_SVG_ARROW_PADDING = this.FIELD_BORDER_RECT_X_PADDING;\n\n this.FIELD_COLOUR_DEFAULT_WIDTH = 2 * this.GRID_UNIT;\n\n this.FIELD_COLOUR_DEFAULT_HEIGHT = 4 * this.GRID_UNIT;\n\n this.FIELD_CHECKBOX_X_OFFSET = 1 * this.GRID_UNIT;\n\n /** The maximum width of a dynamic connection shape. */\n this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH = 12 * this.GRID_UNIT;\n }\n\n override setFontConstants_(theme: Theme) {\n super.setFontConstants_(theme);\n\n this.FIELD_BORDER_RECT_HEIGHT =\n this.FIELD_TEXT_HEIGHT + this.FIELD_BORDER_RECT_Y_PADDING * 2;\n this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT = this.FIELD_BORDER_RECT_HEIGHT;\n }\n\n override init() {\n super.init();\n this.HEXAGONAL = this.makeHexagonal();\n this.ROUNDED = this.makeRounded();\n this.SQUARED = this.makeSquared();\n\n this.STATEMENT_INPUT_NOTCH_OFFSET = this.NOTCH_OFFSET_LEFT +\n (this.INSIDE_CORNERS as InsideCorners).rightWidth;\n }\n\n override setDynamicProperties_(theme: Theme) {\n super.setDynamicProperties_(theme);\n\n this.SELECTED_GLOW_COLOUR = theme.getComponentStyle('selectedGlowColour') ||\n this.SELECTED_GLOW_COLOUR;\n const selectedGlowSize =\n Number(theme.getComponentStyle('selectedGlowSize'));\n this.SELECTED_GLOW_SIZE = selectedGlowSize && !isNaN(selectedGlowSize) ?\n selectedGlowSize :\n this.SELECTED_GLOW_SIZE;\n this.REPLACEMENT_GLOW_COLOUR =\n theme.getComponentStyle('replacementGlowColour') ||\n this.REPLACEMENT_GLOW_COLOUR;\n const replacementGlowSize =\n Number(theme.getComponentStyle('replacementGlowSize'));\n this.REPLACEMENT_GLOW_SIZE =\n replacementGlowSize && !isNaN(replacementGlowSize) ?\n replacementGlowSize :\n this.REPLACEMENT_GLOW_SIZE;\n }\n\n override dispose() {\n super.dispose();\n if (this.selectedGlowFilter_) {\n dom.removeNode(this.selectedGlowFilter_);\n }\n if (this.replacementGlowFilter_) {\n dom.removeNode(this.replacementGlowFilter_);\n }\n }\n\n override makeStartHat() {\n const height = this.START_HAT_HEIGHT;\n const width = this.START_HAT_WIDTH;\n\n const mainPath = svgPaths.curve('c', [\n svgPaths.point(25, -height),\n svgPaths.point(71, -height),\n svgPaths.point(width, 0),\n ]);\n return {height, width, path: mainPath};\n }\n\n /**\n * Create sizing and path information about a hexagonal shape.\n *\n * @returns An object containing sizing and path information about a hexagonal\n * shape for connections.\n * @internal\n */\n makeHexagonal(): Shape {\n const maxWidth = this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;\n\n /**\n * Make the main path for the hexagonal connection shape out of two lines.\n * The lines are defined with relative positions and require the block\n * height. The 'up' and 'down' versions of the paths are the same, but the Y\n * sign flips. The 'left' and 'right' versions of the path are also the\n * same, but the X sign flips.\n *\n * @param height The height of the block the connection is on.\n * @param up True if the path should be drawn from bottom to top, false\n * otherwise.\n * @param right True if the path is for the right side of the block.\n * @returns A path fragment describing a rounded connection.\n */\n function makeMainPath(height: number, up: boolean, right: boolean): string {\n const halfHeight = height / 2;\n const width = halfHeight > maxWidth ? maxWidth : halfHeight;\n const forward = up ? -1 : 1;\n const direction = right ? -1 : 1;\n const dy = forward * height / 2;\n return svgPaths.lineTo(-direction * width, dy) +\n svgPaths.lineTo(direction * width, dy);\n }\n\n return {\n type: this.SHAPES.HEXAGONAL,\n isDynamic: true,\n width(height: number): number {\n const halfHeight = height / 2;\n return halfHeight > maxWidth ? maxWidth : halfHeight;\n },\n height(height: number): number {\n return height;\n },\n connectionOffsetY(connectionHeight: number): number {\n return connectionHeight / 2;\n },\n connectionOffsetX(connectionWidth: number): number {\n return -connectionWidth;\n },\n pathDown(height: number): string {\n return makeMainPath(height, false, false);\n },\n pathUp(height: number): string {\n return makeMainPath(height, true, false);\n },\n pathRightDown(height: number): string {\n return makeMainPath(height, false, true);\n },\n pathRightUp(height: number): string {\n return makeMainPath(height, false, true);\n },\n };\n }\n\n /**\n * Create sizing and path information about a rounded shape.\n *\n * @returns An object containing sizing and path information about a rounded\n * shape for connections.\n * @internal\n */\n makeRounded(): Shape {\n const maxWidth = this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;\n const maxHeight = maxWidth * 2;\n\n /**\n * Make the main path for the rounded connection shape out of two arcs and\n * a line that joins them. The arcs are defined with relative positions.\n * Usually, the height of the block is split between the two arcs. In the\n * case where the height of the block exceeds the maximum height, a line is\n * drawn in between the two arcs. The 'up' and 'down' versions of the paths\n * are the same, but the Y sign flips. The 'up' and 'right' versions of the\n * path flip the sweep-flag which moves the arc at negative angles.\n *\n * @param blockHeight The height of the block the connection is on.\n * @param up True if the path should be drawn from bottom to top, false\n * otherwise.\n * @param right True if the path is for the right side of the block.\n * @returns A path fragment describing a rounded connection.\n */\n function makeMainPath(\n blockHeight: number, up: boolean, right: boolean): string {\n const remainingHeight =\n blockHeight > maxHeight ? blockHeight - maxHeight : 0;\n const height = blockHeight > maxHeight ? maxHeight : blockHeight;\n const radius = height / 2;\n return svgPaths.arc(\n 'a', '0 0,1', radius,\n svgPaths.point(\n (up ? -1 : 1) * radius, (up ? -1 : 1) * radius)) +\n svgPaths.lineOnAxis('v', (right ? 1 : -1) * remainingHeight) +\n svgPaths.arc(\n 'a', '0 0,1', radius,\n svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius));\n }\n\n return {\n type: this.SHAPES.ROUND,\n isDynamic: true,\n width(height: number): number {\n const halfHeight = height / 2;\n return halfHeight > maxWidth ? maxWidth : halfHeight;\n },\n height(height: number): number {\n return height;\n },\n connectionOffsetY(connectionHeight: number): number {\n return connectionHeight / 2;\n },\n connectionOffsetX(connectionWidth: number): number {\n return -connectionWidth;\n },\n pathDown(height: number): string {\n return makeMainPath(height, false, false);\n },\n pathUp(height: number): string {\n return makeMainPath(height, true, false);\n },\n pathRightDown(height: number): string {\n return makeMainPath(height, false, true);\n },\n pathRightUp(height: number): string {\n return makeMainPath(height, false, true);\n },\n };\n }\n\n /**\n * Create sizing and path information about a squared shape.\n *\n * @returns An object containing sizing and path information about a squared\n * shape for connections.\n * @internal\n */\n makeSquared(): Shape {\n const radius = this.CORNER_RADIUS;\n\n /**\n * Make the main path for the squared connection shape out of two corners\n * and a single line in-between (a and v). These are defined in relative\n * positions and require the height of the block.\n * The 'left' and 'right' versions of the paths are the same, but the Y sign\n * flips. The 'up' and 'down' versions of the path determine where the\n * corner point is placed and in turn the direction of the corners.\n *\n * @param height The height of the block the connection is on.\n * @param up True if the path should be drawn from bottom to top, false\n * otherwise.\n * @param right True if the path is for the right side of the block.\n * @returns A path fragment describing a squared connection.\n */\n function makeMainPath(height: number, up: boolean, right: boolean): string {\n const innerHeight = height - radius * 2;\n return svgPaths.arc(\n 'a', '0 0,1', radius,\n svgPaths.point(\n (up ? -1 : 1) * radius, (up ? -1 : 1) * radius)) +\n svgPaths.lineOnAxis('v', (right ? 1 : -1) * innerHeight) +\n svgPaths.arc(\n 'a', '0 0,1', radius,\n svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius));\n }\n\n return {\n type: this.SHAPES.SQUARE,\n isDynamic: true,\n width(_height: number): number {\n return radius;\n },\n height(height: number): number {\n return height;\n },\n connectionOffsetY(connectionHeight: number): number {\n return connectionHeight / 2;\n },\n connectionOffsetX(connectionWidth: number): number {\n return -connectionWidth;\n },\n pathDown(height: number): string {\n return makeMainPath(height, false, false);\n },\n pathUp(height: number): string {\n return makeMainPath(height, true, false);\n },\n pathRightDown(height: number): string {\n return makeMainPath(height, false, true);\n },\n pathRightUp(height: number): string {\n return makeMainPath(height, false, true);\n },\n };\n }\n\n override shapeFor(connection: RenderedConnection): Shape {\n let checks = connection.getCheck();\n if (!checks && connection.targetConnection) {\n checks = connection.targetConnection.getCheck();\n }\n let outputShape;\n switch (connection.type) {\n case ConnectionType.INPUT_VALUE:\n case ConnectionType.OUTPUT_VALUE:\n outputShape = connection.getSourceBlock().getOutputShape();\n // If the block has an output shape set, use that instead.\n if (outputShape !== null) {\n switch (outputShape) {\n case this.SHAPES.HEXAGONAL:\n return this.HEXAGONAL!;\n case this.SHAPES.ROUND:\n return this.ROUNDED!;\n case this.SHAPES.SQUARE:\n return this.SQUARED!;\n }\n }\n // Includes doesn't work in IE.\n if (checks && checks.indexOf('Boolean') !== -1) {\n return this.HEXAGONAL!;\n }\n if (checks && checks.indexOf('Number') !== -1) {\n return this.ROUNDED!;\n }\n if (checks && checks.indexOf('String') !== -1) {\n return this.ROUNDED!;\n }\n return this.ROUNDED!;\n case ConnectionType.PREVIOUS_STATEMENT:\n case ConnectionType.NEXT_STATEMENT:\n return this.NOTCH!;\n default:\n throw Error('Unknown type');\n }\n }\n\n override makeNotch() {\n const width = this.NOTCH_WIDTH;\n const height = this.NOTCH_HEIGHT;\n\n const innerWidth = width / 3;\n const curveWidth = innerWidth / 3;\n\n const halfHeight = height / 2;\n const quarterHeight = halfHeight / 2;\n\n /**\n * Make the main path for the notch.\n *\n * @param dir Direction multiplier to apply to horizontal offsets along the\n * path. Either 1 or -1.\n * @returns A path fragment describing a notch.\n */\n function makeMainPath(dir: number): string {\n return svgPaths.curve(\n 'c',\n [\n svgPaths.point(dir * curveWidth / 2, 0),\n svgPaths.point(dir * curveWidth * 3 / 4, quarterHeight / 2),\n svgPaths.point(dir * curveWidth, quarterHeight),\n ]) +\n svgPaths.line([svgPaths.point(dir * curveWidth, halfHeight)]) +\n svgPaths.curve(\n 'c',\n [\n svgPaths.point(dir * curveWidth / 4, quarterHeight / 2),\n svgPaths.point(dir * curveWidth / 2, quarterHeight),\n svgPaths.point(dir * curveWidth, quarterHeight),\n ]) +\n svgPaths.lineOnAxis('h', dir * innerWidth) +\n svgPaths.curve(\n 'c',\n [\n svgPaths.point(dir * curveWidth / 2, 0),\n svgPaths.point(dir * curveWidth * 3 / 4, -(quarterHeight / 2)),\n svgPaths.point(dir * curveWidth, -quarterHeight),\n ]) +\n svgPaths.line([svgPaths.point(dir * curveWidth, -halfHeight)]) +\n svgPaths.curve('c', [\n svgPaths.point(dir * curveWidth / 4, -(quarterHeight / 2)),\n svgPaths.point(dir * curveWidth / 2, -quarterHeight),\n svgPaths.point(dir * curveWidth, -quarterHeight),\n ]);\n }\n\n const pathLeft = makeMainPath(1);\n const pathRight = makeMainPath(-1);\n\n return {\n type: this.SHAPES.NOTCH,\n width,\n height,\n pathLeft,\n pathRight,\n };\n }\n\n override makeInsideCorners() {\n const radius = this.CORNER_RADIUS;\n\n const innerTopLeftCorner =\n svgPaths.arc('a', '0 0,0', radius, svgPaths.point(-radius, radius));\n\n const innerTopRightCorner =\n svgPaths.arc('a', '0 0,1', radius, svgPaths.point(-radius, radius));\n\n const innerBottomLeftCorner =\n svgPaths.arc('a', '0 0,0', radius, svgPaths.point(radius, radius));\n\n const innerBottomRightCorner =\n svgPaths.arc('a', '0 0,1', radius, svgPaths.point(radius, radius));\n\n return {\n width: radius,\n height: radius,\n pathTop: innerTopLeftCorner,\n pathBottom: innerBottomLeftCorner,\n rightWidth: radius,\n rightHeight: radius,\n pathTopRight: innerTopRightCorner,\n pathBottomRight: innerBottomRightCorner,\n };\n }\n\n override generateSecondaryColour_(colour: string) {\n return utilsColour.blend('#000', colour, 0.15) || colour;\n }\n\n override generateTertiaryColour_(colour: string) {\n return utilsColour.blend('#000', colour, 0.25) || colour;\n }\n\n override createDom(svg: SVGElement, tagName: string, selector: string) {\n super.createDom(svg, tagName, selector);\n /*\n <defs>\n ... filters go here ...\n </defs>\n */\n const defs = dom.createSvgElement(Svg.DEFS, {}, svg);\n // Using a dilate distorts the block shape.\n // Instead use a gaussian blur, and then set all alpha to 1 with a transfer.\n const selectedGlowFilter = dom.createSvgElement(\n Svg.FILTER, {\n 'id': 'blocklySelectedGlowFilter' + this.randomIdentifier,\n 'height': '160%',\n 'width': '180%',\n 'y': '-30%',\n 'x': '-40%',\n },\n defs);\n dom.createSvgElement(\n Svg.FEGAUSSIANBLUR,\n {'in': 'SourceGraphic', 'stdDeviation': this.SELECTED_GLOW_SIZE},\n selectedGlowFilter);\n // Set all gaussian blur pixels to 1 opacity before applying flood\n const selectedComponentTransfer = dom.createSvgElement(\n Svg.FECOMPONENTTRANSFER, {'result': 'outBlur'}, selectedGlowFilter);\n dom.createSvgElement(\n Svg.FEFUNCA,\n {'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'},\n selectedComponentTransfer);\n // Color the highlight\n dom.createSvgElement(\n Svg.FEFLOOD, {\n 'flood-color': this.SELECTED_GLOW_COLOUR,\n 'flood-opacity': 1,\n 'result': 'outColor',\n },\n selectedGlowFilter);\n dom.createSvgElement(\n Svg.FECOMPOSITE, {\n 'in': 'outColor',\n 'in2': 'outBlur',\n 'operator': 'in',\n 'result': 'outGlow',\n },\n selectedGlowFilter);\n this.selectedGlowFilterId = selectedGlowFilter.id;\n this.selectedGlowFilter_ = selectedGlowFilter;\n\n // Using a dilate distorts the block shape.\n // Instead use a gaussian blur, and then set all alpha to 1 with a transfer.\n const replacementGlowFilter = dom.createSvgElement(\n Svg.FILTER, {\n 'id': 'blocklyReplacementGlowFilter' + this.randomIdentifier,\n 'height': '160%',\n 'width': '180%',\n 'y': '-30%',\n 'x': '-40%',\n },\n defs);\n dom.createSvgElement(\n Svg.FEGAUSSIANBLUR,\n {'in': 'SourceGraphic', 'stdDeviation': this.REPLACEMENT_GLOW_SIZE},\n replacementGlowFilter);\n // Set all gaussian blur pixels to 1 opacity before applying flood\n const replacementComponentTransfer = dom.createSvgElement(\n Svg.FECOMPONENTTRANSFER, {'result': 'outBlur'}, replacementGlowFilter);\n dom.createSvgElement(\n Svg.FEFUNCA,\n {'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'},\n replacementComponentTransfer);\n // Color the highlight\n dom.createSvgElement(\n Svg.FEFLOOD, {\n 'flood-color': this.REPLACEMENT_GLOW_COLOUR,\n 'flood-opacity': 1,\n 'result': 'outColor',\n },\n replacementGlowFilter);\n dom.createSvgElement(\n Svg.FECOMPOSITE, {\n 'in': 'outColor',\n 'in2': 'outBlur',\n 'operator': 'in',\n 'result': 'outGlow',\n },\n replacementGlowFilter);\n dom.createSvgElement(\n Svg.FECOMPOSITE, {\n 'in': 'SourceGraphic',\n 'in2': 'outGlow',\n 'operator': 'over',\n },\n replacementGlowFilter);\n this.replacementGlowFilterId = replacementGlowFilter.id;\n this.replacementGlowFilter_ = replacementGlowFilter;\n }\n\n override getCSS_(selector: string) {\n return [\n /* eslint-disable indent */\n // Text.\n `${selector} .blocklyText,`,\n `${selector} .blocklyFlyoutLabelText {`,\n `font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}` +\n `pt ${this.FIELD_TEXT_FONTFAMILY};`,\n `}`,\n\n // Fields.\n `${selector} .blocklyText {`,\n `fill: #fff;`,\n `}`,\n `${selector} .blocklyNonEditableText>rect:not(.blocklyDropdownRect),`,\n `${selector} .blocklyEditableText>rect:not(.blocklyDropdownRect) {`,\n `fill: ${this.FIELD_BORDER_RECT_COLOUR};`,\n `}`,\n `${selector} .blocklyNonEditableText>text,`,\n `${selector} .blocklyEditableText>text,`,\n `${selector} .blocklyNonEditableText>g>text,`,\n `${selector} .blocklyEditableText>g>text {`,\n `fill: #575E75;`,\n `}`,\n\n // Flyout labels.\n `${selector} .blocklyFlyoutLabelText {`,\n `fill: #575E75;`,\n `}`,\n\n // Bubbles.\n `${selector} .blocklyText.blocklyBubbleText {`,\n `fill: #575E75;`,\n `}`,\n\n // Editable field hover.\n `${selector} .blocklyDraggable:not(.blocklyDisabled)`,\n ` .blocklyEditableText:not(.editing):hover>rect,`,\n `${selector} .blocklyDraggable:not(.blocklyDisabled)`,\n ` .blocklyEditableText:not(.editing):hover>.blocklyPath {`,\n `stroke: #fff;`,\n `stroke-width: 2;`,\n `}`,\n\n // Text field input.\n `${selector} .blocklyHtmlInput {`,\n `font-family: ${this.FIELD_TEXT_FONTFAMILY};`,\n `font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,\n `color: #575E75;`,\n `}`,\n\n // Dropdown field.\n `${selector} .blocklyDropdownText {`,\n `fill: #fff !important;`,\n `}`,\n\n // Widget and Dropdown Div\n `${selector}.blocklyWidgetDiv .goog-menuitem,`,\n `${selector}.blocklyDropDownDiv .goog-menuitem {`,\n `font-family: ${this.FIELD_TEXT_FONTFAMILY};`,\n `}`,\n `${selector}.blocklyDropDownDiv .goog-menuitem-content {`,\n `color: #fff;`,\n `}`,\n\n // Connection highlight.\n `${selector} .blocklyHighlightedConnectionPath {`,\n `stroke: ${this.SELECTED_GLOW_COLOUR};`,\n `}`,\n\n // Disabled outline paths.\n `${selector} .blocklyDisabled > .blocklyOutlinePath {`,\n `fill: url(#blocklyDisabledPattern${this.randomIdentifier})`,\n `}`,\n\n // Insertion marker.\n `${selector} .blocklyInsertionMarker>.blocklyPath {`,\n `fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,\n `stroke: none;`,\n `}`,\n ];\n }\n}\n/* eslint-enable indent */\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Zelos renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.Drawer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport type {BaseShape, DynamicShape, Notch} from '../common/constants.js';\nimport * as debug from '../common/debug.js';\nimport {Drawer as BaseDrawer} from '../common/drawer.js';\nimport type {InlineInput} from '../measurables/inline_input.js';\nimport type {Row} from '../measurables/row.js';\nimport type {SpacerRow} from '../measurables/spacer_row.js';\nimport {Types} from '../measurables/types.js';\n\nimport type {InsideCorners} from './constants.js';\nimport type {RenderInfo} from './info.js';\nimport type {StatementInput} from './measurables/inputs.js';\nimport type {PathObject} from './path_object.js';\n\n\n/**\n * An object that draws a block based on the given rendering information.\n *\n * @alias Blockly.zelos.Drawer\n */\nexport class Drawer extends BaseDrawer {\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override info_!: RenderInfo;\n\n /**\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @internal\n */\n constructor(block: BlockSvg, info: RenderInfo) {\n super(block, info);\n }\n\n override draw() {\n const pathObject = this.block_.pathObject as PathObject;\n pathObject.beginDrawing();\n this.hideHiddenIcons_();\n this.drawOutline_();\n this.drawInternals_();\n\n pathObject.setPath(this.outlinePath_ + '\\n' + this.inlinePath_);\n if (this.info_.RTL) {\n pathObject.flipRTL();\n }\n if (debug.isDebuggerEnabled()) {\n this.block_?.renderingDebugger?.drawDebug(this.block_, this.info_);\n }\n this.recordSizeOnBlock_();\n if (this.info_.outputConnection) {\n // Store the output connection shape type for parent blocks to use during\n // rendering.\n pathObject.outputShapeType = this.info_.outputConnection.shape.type;\n }\n pathObject.endDrawing();\n }\n\n override drawOutline_() {\n if (this.info_.outputConnection &&\n this.info_.outputConnection.isDynamicShape &&\n !this.info_.hasStatementInput &&\n !this.info_.bottomRow.hasNextConnection) {\n this.drawFlatTop_();\n this.drawRightDynamicConnection_();\n this.drawFlatBottom_();\n this.drawLeftDynamicConnection_();\n } else {\n super.drawOutline_();\n }\n }\n\n override drawLeft_() {\n if (this.info_.outputConnection &&\n this.info_.outputConnection.isDynamicShape) {\n this.drawLeftDynamicConnection_();\n } else {\n super.drawLeft_();\n }\n }\n\n /**\n * Add steps for the right side of a row that does not have value or\n * statement input connections.\n *\n * @param row The row to draw the side of.\n */\n protected override drawRightSideRow_(row: Row) {\n if (row.height <= 0) {\n return;\n }\n if (Types.isSpacer(row)) {\n const spacerRow = row as SpacerRow;\n if (spacerRow.precedesStatement || spacerRow.followsStatement) {\n const cornerHeight =\n (this.constants_.INSIDE_CORNERS as InsideCorners).rightHeight;\n const remainingHeight =\n spacerRow.height - (spacerRow.precedesStatement ? cornerHeight : 0);\n this.outlinePath_ +=\n (spacerRow.followsStatement ?\n (this.constants_.INSIDE_CORNERS as InsideCorners)\n .pathBottomRight :\n '') +\n (remainingHeight > 0 ?\n svgPaths.lineOnAxis('V', spacerRow.yPos + remainingHeight) :\n '') +\n (spacerRow.precedesStatement ?\n (this.constants_.INSIDE_CORNERS as InsideCorners)\n .pathTopRight :\n '');\n return;\n }\n }\n this.outlinePath_ += svgPaths.lineOnAxis('V', row.yPos + row.height);\n }\n\n /**\n * Add steps to draw the right side of an output with a dynamic connection.\n */\n protected drawRightDynamicConnection_() {\n if (!this.info_.outputConnection) {\n throw new Error(\n `Cannot draw the output connection of a block that doesn't have one`);\n }\n this.outlinePath_ += (this.info_.outputConnection.shape as DynamicShape)\n .pathRightDown(this.info_.outputConnection.height);\n }\n\n /**\n * Add steps to draw the left side of an output with a dynamic connection.\n */\n protected drawLeftDynamicConnection_() {\n if (!this.info_.outputConnection) {\n throw new Error(\n `Cannot draw the output connection of a block that doesn't have one`);\n }\n this.positionOutputConnection_();\n\n this.outlinePath_ += (this.info_.outputConnection.shape as DynamicShape)\n .pathUp(this.info_.outputConnection.height);\n\n // Close off the path. This draws a vertical line up to the start of the\n // block's path, which may be either a rounded or a sharp corner.\n this.outlinePath_ += 'z';\n }\n\n /** Add steps to draw a flat top row. */\n protected drawFlatTop_() {\n const topRow = this.info_.topRow;\n this.positionPreviousConnection_();\n\n this.outlinePath_ += svgPaths.moveBy(topRow.xPos, this.info_.startY);\n\n this.outlinePath_ += svgPaths.lineOnAxis('h', topRow.width);\n }\n\n /** Add steps to draw a flat bottom row. */\n protected drawFlatBottom_() {\n const bottomRow = this.info_.bottomRow;\n this.positionNextConnection_();\n\n this.outlinePath_ += svgPaths.lineOnAxis('V', bottomRow.baseline);\n\n this.outlinePath_ += svgPaths.lineOnAxis('h', -bottomRow.width);\n }\n\n override drawInlineInput_(input: InlineInput) {\n this.positionInlineInputConnection_(input);\n\n const inputName = input.input.name;\n if (input.connectedBlock || this.info_.isInsertionMarker) {\n return;\n }\n\n const width = input.width - input.connectionWidth * 2;\n const height = input.height;\n const yPos = input.centerline - height / 2;\n\n const connectionRight = input.xPos + input.connectionWidth;\n\n const outlinePath = svgPaths.moveTo(connectionRight, yPos) +\n svgPaths.lineOnAxis('h', width) +\n (input.shape as DynamicShape).pathRightDown(input.height) +\n svgPaths.lineOnAxis('h', -width) +\n (input.shape as DynamicShape).pathUp(input.height) + 'z';\n const pathObject = this.block_.pathObject as PathObject;\n pathObject.setOutlinePath(inputName, outlinePath);\n }\n\n override drawStatementInput_(row: Row) {\n const input = row.getLastInput() as StatementInput;\n // Where to start drawing the notch, which is on the right side in LTR.\n const x = input.xPos + input.notchOffset + (input.shape as BaseShape).width;\n\n const innerTopLeftCorner = (input.shape as Notch).pathRight +\n svgPaths.lineOnAxis(\n 'h', -(input.notchOffset - this.constants_.INSIDE_CORNERS.width)) +\n this.constants_.INSIDE_CORNERS.pathTop;\n\n const innerHeight = row.height - 2 * this.constants_.INSIDE_CORNERS.height;\n\n const innerBottomLeftCorner = this.constants_.INSIDE_CORNERS.pathBottom +\n svgPaths.lineOnAxis(\n 'h', input.notchOffset - this.constants_.INSIDE_CORNERS.width) +\n (input.connectedBottomNextConnection ? '' :\n (input.shape as Notch).pathLeft);\n\n this.outlinePath_ += svgPaths.lineOnAxis('H', x) + innerTopLeftCorner +\n svgPaths.lineOnAxis('v', innerHeight) + innerBottomLeftCorner +\n svgPaths.lineOnAxis('H', row.xPos + row.width);\n\n this.positionStatementInputConnection_(row);\n }\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Image field. Used for pictures, icons, etc.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldImage');\n\nimport {FieldConfig, Field} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as dom from './utils/dom.js';\nimport * as parsing from './utils/parsing.js';\nimport type {Sentinel} from './utils/sentinel.js';\nimport {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\n\n\n/**\n * Class for an image on a block.\n *\n * @alias Blockly.FieldImage\n */\nexport class FieldImage extends Field {\n /**\n * Vertical padding below the image, which is included in the reported height\n * of the field.\n */\n private static readonly Y_PADDING = 1;\n protected override size_: Size;\n private readonly imageHeight_: number;\n\n /** The function to be called when this field is clicked. */\n private clickHandler_: ((p1: FieldImage) => AnyDuringMigration)|null = null;\n\n /** The rendered field's image element. */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'SVGImageElement'.\n private imageElement_: SVGImageElement = null as AnyDuringMigration;\n\n /**\n * Editable fields usually show some sort of UI indicating they are\n * editable. This field should not.\n */\n override readonly EDITABLE = false;\n\n /**\n * Used to tell if the field needs to be rendered the next time the block is\n * rendered. Image fields are statically sized, and only need to be\n * rendered at initialization.\n */\n protected override isDirty_ = false;\n\n /** Whether to flip this image in RTL. */\n private flipRtl_ = false;\n\n /** Alt text of this image. */\n private altText_ = '';\n override value_: AnyDuringMigration;\n\n /**\n * @param src The URL of the image.\n * Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by\n * subclasses that want to handle configuration and setting the field value\n * after their own constructors have run).\n * @param width Width of the image.\n * @param height Height of the image.\n * @param opt_alt Optional alt text for when block is collapsed.\n * @param opt_onClick Optional function to be called when the image is\n * clicked. If opt_onClick is defined, opt_alt must also be defined.\n * @param opt_flipRtl Whether to flip the icon in RTL.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/image#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n src: string|Sentinel, width: string|number, height: string|number,\n opt_alt?: string, opt_onClick?: (p1: FieldImage) => AnyDuringMigration,\n opt_flipRtl?: boolean, opt_config?: FieldImageConfig) {\n super(Field.SKIP_SETUP);\n\n const imageHeight = Number(parsing.replaceMessageReferences(height));\n const imageWidth = Number(parsing.replaceMessageReferences(width));\n if (isNaN(imageHeight) || isNaN(imageWidth)) {\n throw Error(\n 'Height and width values of an image field must cast to' +\n ' numbers.');\n }\n if (imageHeight <= 0 || imageWidth <= 0) {\n throw Error(\n 'Height and width values of an image field must be greater' +\n ' than 0.');\n }\n\n /** The size of the area rendered by the field. */\n this.size_ = new Size(imageWidth, imageHeight + FieldImage.Y_PADDING);\n\n /**\n * Store the image height, since it is different from the field height.\n */\n this.imageHeight_ = imageHeight;\n\n if (typeof opt_onClick === 'function') {\n this.clickHandler_ = opt_onClick;\n }\n\n if (src === Field.SKIP_SETUP) {\n return;\n }\n\n if (opt_config) {\n this.configure_(opt_config);\n } else {\n this.flipRtl_ = !!opt_flipRtl;\n this.altText_ = parsing.replaceMessageReferences(opt_alt) || '';\n }\n this.setValue(parsing.replaceMessageReferences(src));\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n protected override configure_(config: FieldImageConfig) {\n super.configure_(config);\n if (config.flipRtl) this.flipRtl_ = config.flipRtl;\n if (config.alt) {\n this.altText_ = parsing.replaceMessageReferences(config.alt);\n }\n }\n\n /**\n * Create the block UI for this image.\n *\n * @internal\n */\n override initView() {\n this.imageElement_ = dom.createSvgElement(\n Svg.IMAGE, {\n 'height': this.imageHeight_ + 'px',\n 'width': this.size_.width + 'px',\n 'alt': this.altText_,\n },\n this.fieldGroup_);\n this.imageElement_.setAttributeNS(\n dom.XLINK_NS, 'xlink:href', this.value_ as string);\n\n if (this.clickHandler_) {\n this.imageElement_.style.cursor = 'pointer';\n }\n }\n\n override updateSize_() {}\n // NOP\n\n /**\n * Ensure that the input value (the source URL) is a string.\n *\n * @param opt_newValue The input value.\n * @returns A string, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n string|null {\n if (typeof opt_newValue !== 'string') {\n return null;\n }\n return opt_newValue;\n }\n\n /**\n * Update the value of this image field, and update the displayed image.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a string.\n */\n protected override doValueUpdate_(newValue: AnyDuringMigration) {\n this.value_ = newValue;\n if (this.imageElement_) {\n this.imageElement_.setAttributeNS(\n dom.XLINK_NS, 'xlink:href', String(this.value_));\n }\n }\n\n /**\n * Get whether to flip this image in RTL\n *\n * @returns True if we should flip in RTL.\n */\n override getFlipRtl(): boolean {\n return this.flipRtl_;\n }\n\n /**\n * Set the alt text of this image.\n *\n * @param alt New alt text.\n */\n setAlt(alt: string|null) {\n if (alt === this.altText_) {\n return;\n }\n this.altText_ = alt || '';\n if (this.imageElement_) {\n this.imageElement_.setAttribute('alt', this.altText_);\n }\n }\n\n /**\n * If field click is called, and click handler defined,\n * call the handler.\n */\n protected override showEditor_() {\n if (this.clickHandler_) {\n this.clickHandler_(this);\n }\n }\n\n /**\n * Set the function that is called when this image is clicked.\n *\n * @param func The function that is called when the image is clicked, or null\n * to remove.\n */\n setOnClickHandler(func: ((p1: FieldImage) => AnyDuringMigration)|null) {\n this.clickHandler_ = func;\n }\n\n /**\n * Use the `getText_` developer hook to override the field's text\n * representation.\n * Return the image alt text instead.\n *\n * @returns The image alt text.\n */\n protected override getText_(): string|null {\n return this.altText_;\n }\n\n /**\n * Construct a FieldImage from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (src, width, height, alt, and\n * flipRtl).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static fromJson(options: FieldImageFromJsonConfig): FieldImage {\n if (!options.src || !options.width || !options.height) {\n throw new Error(\n 'src, width, and height values for an image field are' +\n 'required. The width and height must be non-zero.');\n }\n // `this` might be a subclass of FieldImage if that class doesn't override\n // the static fromJson method.\n return new this(\n options.src, options.width, options.height, undefined, undefined,\n undefined, options);\n }\n}\n\nfieldRegistry.register('field_image', FieldImage);\n\n(FieldImage.prototype as AnyDuringMigration).DEFAULT_VALUE = '';\n\n/**\n * Config options for the image field.\n */\nexport interface FieldImageConfig extends FieldConfig {\n flipRtl?: boolean;\n alt?: string;\n}\n\n/**\n * fromJson config options for the colour field.\n */\nexport interface FieldImageFromJsonConfig extends FieldImageConfig {\n src?: string;\n width?: number;\n height?: number;\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Text input field.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldTextInput');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as dialog from './dialog.js';\nimport * as dom from './utils/dom.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport * as eventUtils from './events/utils.js';\nimport {FieldConfig, Field, UnattachedFieldError} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {Msg} from './msg.js';\nimport * as aria from './utils/aria.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport * as parsing from './utils/parsing.js';\nimport type {Sentinel} from './utils/sentinel.js';\nimport * as userAgent from './utils/useragent.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for an editable text field.\n *\n * @alias Blockly.FieldTextInput\n */\nexport class FieldTextInput extends Field {\n /**\n * Pixel size of input border radius.\n * Should match blocklyText's border-radius in CSS.\n */\n static BORDERRADIUS = 4;\n\n /** Allow browser to spellcheck this field. */\n protected spellcheck_ = true;\n\n /** The HTML input element. */\n protected htmlInput_: HTMLInputElement|null = null;\n\n /** True if the field's value is currently being edited via the UI. */\n protected isBeingEdited_ = false;\n\n /**\n * True if the value currently displayed in the field's editory UI is valid.\n */\n protected isTextValid_ = false;\n\n /** Key down event data. */\n private onKeyDownWrapper_: browserEvents.Data|null = null;\n\n /** Key input event data. */\n private onKeyInputWrapper_: browserEvents.Data|null = null;\n\n /**\n * Whether the field should consider the whole parent block to be its click\n * target.\n */\n fullBlockClickTarget_: boolean|null = false;\n\n /** The workspace that this field belongs to. */\n protected workspace_: WorkspaceSvg|null = null;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable.\n */\n override SERIALIZABLE = true;\n\n /** Mouse cursor style when over the hotspot that initiates the editor. */\n override CURSOR = 'text';\n override clickTarget_: AnyDuringMigration;\n override value_: AnyDuringMigration;\n override isDirty_: AnyDuringMigration;\n\n /**\n * @param opt_value The initial value of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a string & returns a validated string, or null\n * to abort the change.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string|Sentinel, opt_validator?: Function|null,\n opt_config?: FieldTextInputConfig) {\n super(Field.SKIP_SETUP);\n\n if (opt_value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n }\n this.setValue(opt_value);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n protected override configure_(config: FieldTextInputConfig) {\n super.configure_(config);\n if (config.spellcheck !== undefined) {\n this.spellcheck_ = config.spellcheck;\n }\n }\n\n /** @internal */\n override initView() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n if (this.getConstants()!.FULL_BLOCK_FIELDS) {\n // Step one: figure out if this is the only field on this block.\n // Rendering is quite different in that case.\n let nFields = 0;\n let nConnections = 0;\n // Count the number of fields, excluding text fields\n for (let i = 0, input; input = block.inputList[i]; i++) {\n for (let j = 0; input.fieldRow[j]; j++) {\n nFields++;\n }\n if (input.connection) {\n nConnections++;\n }\n }\n // The special case is when this is the only non-label field on the block\n // and it has an output but no inputs.\n this.fullBlockClickTarget_ =\n nFields <= 1 && block.outputConnection && !nConnections;\n } else {\n this.fullBlockClickTarget_ = false;\n }\n\n if (this.fullBlockClickTarget_) {\n this.clickTarget_ = (this.sourceBlock_ as BlockSvg).getSvgRoot();\n } else {\n this.createBorderRect_();\n }\n this.createTextElement_();\n }\n\n /**\n * Ensure that the input value casts to a valid string.\n *\n * @param opt_newValue The input value.\n * @returns A valid string, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n AnyDuringMigration {\n if (opt_newValue === null || opt_newValue === undefined) {\n return null;\n }\n return String(opt_newValue);\n }\n\n /**\n * Called by setValue if the text input is not valid. If the field is\n * currently being edited it reverts value of the field to the previous\n * value while allowing the display text to be handled by the htmlInput_.\n *\n * @param _invalidValue The input value that was determined to be invalid.\n * This is not used by the text input because its display value is stored\n * on the htmlInput_.\n */\n protected override doValueInvalid_(_invalidValue: AnyDuringMigration) {\n if (this.isBeingEdited_) {\n this.isTextValid_ = false;\n const oldValue = this.value_;\n // Revert value when the text becomes invalid.\n this.value_ = this.htmlInput_!.getAttribute('data-untyped-default-value');\n if (this.sourceBlock_ && eventUtils.isEnabled()) {\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(\n this.sourceBlock_, 'field', this.name || null, oldValue,\n this.value_));\n }\n }\n }\n\n /**\n * Called by setValue if the text input is valid. Updates the value of the\n * field, and updates the text of the field if it is not currently being\n * edited (i.e. handled by the htmlInput_).\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a string.\n */\n protected override doValueUpdate_(newValue: AnyDuringMigration) {\n this.isTextValid_ = true;\n this.value_ = newValue;\n if (!this.isBeingEdited_) {\n // This should only occur if setValue is triggered programmatically.\n this.isDirty_ = true;\n }\n }\n\n /**\n * Updates text field to match the colour/style of the block.\n *\n * @internal\n */\n override applyColour() {\n if (!this.sourceBlock_ || !this.getConstants()!.FULL_BLOCK_FIELDS) return;\n\n const source = this.sourceBlock_ as BlockSvg;\n\n if (this.borderRect_) {\n if (!source.style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n this.borderRect_.setAttribute('stroke', source.style.colourTertiary);\n } else {\n source.pathObject.svgPath.setAttribute(\n 'fill', this.getConstants()!.FIELD_BORDER_RECT_COLOUR);\n }\n }\n\n /**\n * Updates the colour of the htmlInput given the current validity of the\n * field's value.\n */\n protected override render_() {\n super.render_();\n // This logic is done in render_ rather than doValueInvalid_ or\n // doValueUpdate_ so that the code is more centralized.\n if (this.isBeingEdited_) {\n this.resizeEditor_();\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (!this.isTextValid_) {\n dom.addClass(htmlInput, 'blocklyInvalidInput');\n aria.setState(htmlInput, aria.State.INVALID, true);\n } else {\n dom.removeClass(htmlInput, 'blocklyInvalidInput');\n aria.setState(htmlInput, aria.State.INVALID, false);\n }\n }\n }\n\n /**\n * Set whether this field is spellchecked by the browser.\n *\n * @param check True if checked.\n */\n setSpellcheck(check: boolean) {\n if (check === this.spellcheck_) {\n return;\n }\n this.spellcheck_ = check;\n if (this.htmlInput_) {\n // AnyDuringMigration because: Argument of type 'boolean' is not\n // assignable to parameter of type 'string'.\n this.htmlInput_.setAttribute(\n 'spellcheck', this.spellcheck_ as AnyDuringMigration);\n }\n }\n\n /**\n * Show the inline free-text editor on top of the text.\n *\n * @param _opt_e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n * @param opt_quietInput True if editor should be created without focus.\n * Defaults to false.\n */\n protected override showEditor_(_opt_e?: Event, opt_quietInput?: boolean) {\n this.workspace_ = (this.sourceBlock_ as BlockSvg).workspace;\n const quietInput = opt_quietInput || false;\n if (!quietInput &&\n (userAgent.MOBILE || userAgent.ANDROID || userAgent.IPAD)) {\n this.showPromptEditor_();\n } else {\n this.showInlineEditor_(quietInput);\n }\n }\n\n /**\n * Create and show a text input editor that is a prompt (usually a popup).\n * Mobile browsers have issues with in-line textareas (focus and keyboards).\n */\n private showPromptEditor_() {\n dialog.prompt(\n Msg['CHANGE_VALUE_TITLE'], this.getText(), (text: string|null) => {\n // Text is null if user pressed cancel button.\n if (text !== null) {\n this.setValue(this.getValueFromEditorText_(text));\n }\n });\n }\n\n /**\n * Create and show a text input editor that sits directly over the text input.\n *\n * @param quietInput True if editor should be created without focus.\n */\n private showInlineEditor_(quietInput: boolean) {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n WidgetDiv.show(this, block.RTL, this.widgetDispose_.bind(this));\n this.htmlInput_ = this.widgetCreate_() as HTMLInputElement;\n this.isBeingEdited_ = true;\n\n if (!quietInput) {\n (this.htmlInput_ as HTMLElement).focus({\n preventScroll: true,\n });\n this.htmlInput_.select();\n }\n }\n\n /**\n * Create the text input editor widget.\n *\n * @returns The newly created text input editor.\n */\n protected widgetCreate_(): HTMLElement {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n eventUtils.setGroup(true);\n const div = WidgetDiv.getDiv();\n\n const clickTarget = this.getClickTarget_();\n if (!clickTarget) throw new Error('A click target has not been set.');\n dom.addClass(clickTarget, 'editing');\n\n const htmlInput = (document.createElement('input'));\n htmlInput.className = 'blocklyHtmlInput';\n // AnyDuringMigration because: Argument of type 'boolean' is not assignable\n // to parameter of type 'string'.\n htmlInput.setAttribute(\n 'spellcheck', this.spellcheck_ as AnyDuringMigration);\n const scale = this.workspace_!.getScale();\n const fontSize = this.getConstants()!.FIELD_TEXT_FONTSIZE * scale + 'pt';\n div!.style.fontSize = fontSize;\n htmlInput.style.fontSize = fontSize;\n let borderRadius = FieldTextInput.BORDERRADIUS * scale + 'px';\n\n if (this.fullBlockClickTarget_) {\n const bBox = this.getScaledBBox();\n\n // Override border radius.\n borderRadius = (bBox.bottom - bBox.top) / 2 + 'px';\n // Pull stroke colour from the existing shadow block\n const strokeColour = block.getParent() ?\n (block.getParent() as BlockSvg).style.colourTertiary :\n (this.sourceBlock_ as BlockSvg).style.colourTertiary;\n htmlInput.style.border = 1 * scale + 'px solid ' + strokeColour;\n div!.style.borderRadius = borderRadius;\n div!.style.transition = 'box-shadow 0.25s ease 0s';\n if (this.getConstants()!.FIELD_TEXTINPUT_BOX_SHADOW) {\n div!.style.boxShadow =\n 'rgba(255, 255, 255, 0.3) 0 0 0 ' + 4 * scale + 'px';\n }\n }\n htmlInput.style.borderRadius = borderRadius;\n\n div!.appendChild(htmlInput);\n\n htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_);\n htmlInput.setAttribute('data-untyped-default-value', this.value_);\n htmlInput.setAttribute('data-old-value', '');\n\n this.resizeEditor_();\n\n this.bindInputEvents_(htmlInput);\n\n return htmlInput;\n }\n\n /**\n * Closes the editor, saves the results, and disposes of any events or\n * DOM-references belonging to the editor.\n */\n protected widgetDispose_() {\n // Non-disposal related things that we do when the editor closes.\n this.isBeingEdited_ = false;\n this.isTextValid_ = true;\n // Make sure the field's node matches the field's internal value.\n this.forceRerender();\n this.onFinishEditing_(this.value_);\n eventUtils.setGroup(false);\n\n // Actual disposal.\n this.unbindInputEvents_();\n const style = WidgetDiv.getDiv()!.style;\n style.width = 'auto';\n style.height = 'auto';\n style.fontSize = '';\n style.transition = '';\n style.boxShadow = '';\n this.htmlInput_ = null;\n\n const clickTarget = this.getClickTarget_();\n if (!clickTarget) throw new Error('A click target has not been set.');\n dom.removeClass(clickTarget, 'editing');\n }\n\n /**\n * A callback triggered when the user is done editing the field via the UI.\n *\n * @param _value The new value of the field.\n */\n onFinishEditing_(_value: AnyDuringMigration) {}\n // NOP by default.\n // TODO(#2496): Support people passing a func into the field.\n\n /**\n * Bind handlers for user input on the text input field's editor.\n *\n * @param htmlInput The htmlInput to which event handlers will be bound.\n */\n protected bindInputEvents_(htmlInput: HTMLElement) {\n // Trap Enter without IME and Esc to hide.\n this.onKeyDownWrapper_ = browserEvents.conditionalBind(\n htmlInput, 'keydown', this, this.onHtmlInputKeyDown_);\n // Resize after every input change.\n this.onKeyInputWrapper_ = browserEvents.conditionalBind(\n htmlInput, 'input', this, this.onHtmlInputChange_);\n }\n\n /** Unbind handlers for user input and workspace size changes. */\n protected unbindInputEvents_() {\n if (this.onKeyDownWrapper_) {\n browserEvents.unbind(this.onKeyDownWrapper_);\n this.onKeyDownWrapper_ = null;\n }\n if (this.onKeyInputWrapper_) {\n browserEvents.unbind(this.onKeyInputWrapper_);\n this.onKeyInputWrapper_ = null;\n }\n }\n\n /**\n * Handle key down to the editor.\n *\n * @param e Keyboard event.\n */\n protected onHtmlInputKeyDown_(e: Event) {\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n if ((e as AnyDuringMigration).keyCode === KeyCodes.ENTER) {\n WidgetDiv.hide();\n dropDownDiv.hideWithoutAnimation();\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n } else if ((e as AnyDuringMigration).keyCode === KeyCodes.ESC) {\n this.setValue(\n this.htmlInput_!.getAttribute('data-untyped-default-value'));\n WidgetDiv.hide();\n dropDownDiv.hideWithoutAnimation();\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n } else if ((e as AnyDuringMigration).keyCode === KeyCodes.TAB) {\n WidgetDiv.hide();\n dropDownDiv.hideWithoutAnimation();\n // AnyDuringMigration because: Property 'shiftKey' does not exist on type\n // 'Event'. AnyDuringMigration because: Argument of type 'this' is not\n // assignable to parameter of type 'Field'.\n (this.sourceBlock_ as BlockSvg)\n .tab(this as AnyDuringMigration, !(e as AnyDuringMigration).shiftKey);\n e.preventDefault();\n }\n }\n\n /**\n * Handle a change to the editor.\n *\n * @param _e Keyboard event.\n */\n private onHtmlInputChange_(_e: Event) {\n const text = this.htmlInput_!.value;\n if (text !== this.htmlInput_!.getAttribute('data-old-value')) {\n this.htmlInput_!.setAttribute('data-old-value', text);\n\n const value = this.getValueFromEditorText_(text);\n this.setValue(value);\n this.forceRerender();\n this.resizeEditor_();\n }\n }\n\n /**\n * Set the HTML input value and the field's internal value. The difference\n * between this and `setValue` is that this also updates the HTML input\n * value whilst editing.\n *\n * @param newValue New value.\n */\n protected setEditorValue_(newValue: AnyDuringMigration) {\n this.isDirty_ = true;\n if (this.isBeingEdited_) {\n // In the case this method is passed an invalid value, we still\n // pass it through the transformation method `getEditorText` to deal\n // with. Otherwise, the internal field's state will be inconsistent\n // with what's shown to the user.\n this.htmlInput_!.value = this.getEditorText_(newValue);\n }\n this.setValue(newValue);\n }\n\n /** Resize the editor to fit the text. */\n protected resizeEditor_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n const div = WidgetDiv.getDiv();\n const bBox = this.getScaledBBox();\n div!.style.width = bBox.right - bBox.left + 'px';\n div!.style.height = bBox.bottom - bBox.top + 'px';\n\n // In RTL mode block fields and LTR input fields the left edge moves,\n // whereas the right edge is fixed. Reposition the editor.\n const x = block.RTL ? bBox.right - div!.offsetWidth : bBox.left;\n const xy = new Coordinate(x, bBox.top);\n\n div!.style.left = xy.x + 'px';\n div!.style.top = xy.y + 'px';\n }\n\n /**\n * Returns whether or not the field is tab navigable.\n *\n * @returns True if the field is tab navigable.\n */\n override isTabNavigable(): boolean {\n return true;\n }\n\n /**\n * Use the `getText_` developer hook to override the field's text\n * representation. When we're currently editing, return the current HTML value\n * instead. Otherwise, return null which tells the field to use the default\n * behaviour (which is a string cast of the field's value).\n *\n * @returns The HTML value if we're editing, otherwise null.\n */\n protected override getText_(): string|null {\n if (this.isBeingEdited_ && this.htmlInput_) {\n // We are currently editing, return the HTML input value instead.\n return this.htmlInput_.value;\n }\n return null;\n }\n\n /**\n * Transform the provided value into a text to show in the HTML input.\n * Override this method if the field's HTML input representation is different\n * than the field's value. This should be coupled with an override of\n * `getValueFromEditorText_`.\n *\n * @param value The value stored in this field.\n * @returns The text to show on the HTML input.\n */\n protected getEditorText_(value: AnyDuringMigration): string {\n return String(value);\n }\n\n /**\n * Transform the text received from the HTML input into a value to store\n * in this field.\n * Override this method if the field's HTML input representation is different\n * than the field's value. This should be coupled with an override of\n * `getEditorText_`.\n *\n * @param text Text received from the HTML input.\n * @returns The value to store.\n */\n protected getValueFromEditorText_(text: string): AnyDuringMigration {\n return text;\n }\n\n /**\n * Construct a FieldTextInput from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and spellcheck).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static fromJson(options: FieldTextInputFromJsonConfig): FieldTextInput {\n const text = parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldTextInput if that class doesn't\n // override the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n\nfieldRegistry.register('field_input', FieldTextInput);\n\n(FieldTextInput.prototype as AnyDuringMigration).DEFAULT_VALUE = '';\n\n/**\n * Config options for the text input field.\n */\nexport interface FieldTextInputConfig extends FieldConfig {\n spellcheck?: boolean;\n}\n\n/**\n * fromJson config options for the text input field.\n */\nexport interface FieldTextInputFromJsonConfig extends FieldTextInputConfig {\n text?: string;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object representing the bottom row of a rendered block.\n *\n * @class\n */\nimport * as goog from '../../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.BottomRow');\n\nimport type {BlockSvg} from '../../../block_svg.js';\nimport type {ConstantProvider} from '../../../renderers/common/constants.js';\nimport {BottomRow as BaseBottomRow} from '../../../renderers/measurables/bottom_row.js';\n\n\n/**\n * An object containing information about what elements are in the bottom row of\n * a block as well as spacing information for the top row.\n * Elements in a bottom row can consist of corners, spacers and next\n * connections.\n *\n * @alias Blockly.zelos.BottomRow\n */\nexport class BottomRow extends BaseBottomRow {\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n }\n\n override endsWithElemSpacer() {\n return false;\n }\n\n /** Render a round corner unless the block has an output connection. */\n override hasLeftSquareCorner(block: BlockSvg) {\n return !!block.outputConnection;\n }\n\n /** Render a round corner unless the block has an output connection. */\n override hasRightSquareCorner(block: BlockSvg) {\n return !!block.outputConnection && !block.statementInputCount &&\n !block.nextConnection;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Zelos specific objects representing inputs with connections on\n * a rendered block.\n *\n * @class\n */\nimport * as goog from '../../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.StatementInput');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Input} from '../../../input.js';\nimport type {ConstantProvider} from '../../../renderers/common/constants.js';\nimport {StatementInput as BaseStatementInput} from '../../../renderers/measurables/statement_input.js';\n\n\n/**\n * An object containing information about the space a statement input takes up\n * during rendering.\n *\n * @alias Blockly.zelos.StatementInput\n */\nexport class StatementInput extends BaseStatementInput {\n connectedBottomNextConnection = false;\n\n /**\n * @param constants The rendering constants provider.\n * @param input The statement input to measure and store information for.\n * @internal\n */\n constructor(constants: ConstantProvider, input: Input) {\n super(constants, input);\n\n if (this.connectedBlock) {\n // Find the bottom-most connected block in the stack.\n let block = this.connectedBlock;\n let nextBlock;\n while (nextBlock = block.getNextBlock()) {\n block = nextBlock;\n }\n if (!block.nextConnection) {\n this.height = this.connectedBlockHeight;\n this.connectedBottomNextConnection = true;\n }\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Zelos specific objects representing elements in a row of a\n * rendered block.\n *\n * @class\n */\nimport * as goog from '../../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.RightConnectionShape');\n\nimport type {ConstantProvider} from '../../../renderers/common/constants.js';\nimport {Measurable} from '../../../renderers/measurables/base.js';\nimport {Types} from '../../../renderers/measurables/types.js';\n\n\n/**\n * An object containing information about the space a right connection shape\n * takes up during rendering.\n *\n * @alias Blockly.zelos.RightConnectionShape\n */\nexport class RightConnectionShape extends Measurable {\n // Size is dynamic\n override height = 0;\n override width = 0;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n this.type |= Types.getType('RIGHT_CONNECTION');\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object representing the top row of a rendered block.\n *\n * @class\n */\nimport * as goog from '../../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.TopRow');\n\nimport type {BlockSvg} from '../../../block_svg.js';\nimport type {ConstantProvider} from '../../../renderers/common/constants.js';\nimport {TopRow as BaseTopRow} from '../../../renderers/measurables/top_row.js';\n\n\n/**\n * An object containing information about what elements are in the top row of a\n * block as well as sizing information for the top row.\n * Elements in a top row can consist of corners, hats, spacers, and previous\n * connections.\n * After this constructor is called, the row will contain all non-spacer\n * elements it needs.\n *\n * @alias Blockly.zelos.TopRow\n */\nexport class TopRow extends BaseTopRow {\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n super(constants);\n }\n\n override endsWithElemSpacer() {\n return false;\n }\n\n /** Render a round corner unless the block has an output connection. */\n override hasLeftSquareCorner(block: BlockSvg) {\n const hasHat =\n (block.hat ? block.hat === 'cap' : this.constants_.ADD_START_HATS) &&\n !block.outputConnection && !block.previousConnection;\n return !!block.outputConnection || hasHat;\n }\n\n /** Render a round corner unless the block has an output connection. */\n override hasRightSquareCorner(block: BlockSvg) {\n return !!block.outputConnection && !block.statementInputCount &&\n !block.nextConnection;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Makecode/scratch-style renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.RenderInfo');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {FieldImage} from '../../field_image.js';\nimport {FieldLabel} from '../../field_label.js';\nimport {FieldTextInput} from '../../field_textinput.js';\nimport {Align, Input} from '../../input.js';\nimport {inputTypes} from '../../input_types.js';\nimport {RenderInfo as BaseRenderInfo} from '../common/info.js';\nimport type {Measurable} from '../measurables/base.js';\nimport {Field} from '../measurables/field.js';\nimport {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport {InputConnection} from '../measurables/input_connection.js';\nimport type {Row} from '../measurables/row.js';\nimport type {SpacerRow} from '../measurables/spacer_row.js';\nimport {Types} from '../measurables/types.js';\n\nimport type {ConstantProvider, InsideCorners} from './constants.js';\nimport {BottomRow} from './measurables/bottom_row.js';\nimport {StatementInput} from './measurables/inputs.js';\nimport {RightConnectionShape} from './measurables/row_elements.js';\nimport {TopRow} from './measurables/top_row.js';\nimport type {PathObject} from './path_object.js';\nimport type {Renderer} from './renderer.js';\n\n\n/**\n * An object containing all sizing information needed to draw this block.\n *\n * This measure pass does not propagate changes to the block (although fields\n * may choose to rerender when getSize() is called). However, calling it\n * repeatedly may be expensive.\n *\n * @alias Blockly.zelos.RenderInfo\n */\nexport class RenderInfo extends BaseRenderInfo {\n override topRow: TopRow;\n override bottomRow: BottomRow;\n override constants_: ConstantProvider;\n override renderer_: Renderer;\n\n override isInline = true;\n isMultiRow: boolean;\n hasStatementInput: boolean;\n rightSide: RightConnectionShape|null;\n private readonly rightAlignedDummyInputs_: WeakMap<Row, Input>;\n\n /**\n * @param renderer The renderer in use.\n * @param block The block to measure.\n * @internal\n */\n constructor(renderer: Renderer, block: BlockSvg) {\n super(renderer, block);\n\n this.renderer_ = renderer;\n\n this.constants_ = this.renderer_.getConstants();\n\n /**\n * An object with rendering information about the top row of the block.\n */\n this.topRow = new TopRow(this.constants_);\n\n /**\n * An object with rendering information about the bottom row of the block.\n */\n this.bottomRow = new BottomRow(this.constants_);\n\n /**\n * Whether the block should be rendered as a multi-line block, either\n * because it's not inline or because it has been collapsed.\n */\n this.isMultiRow = !block.getInputsInline() || block.isCollapsed();\n\n /**\n * Whether or not the block has a statement input in one of its rows.\n */\n this.hasStatementInput = block.statementInputCount > 0;\n\n /**\n * An object with rendering information about the right connection shape.\n */\n this.rightSide = this.outputConnection ?\n new RightConnectionShape(this.constants_) :\n null;\n\n /**\n * A map of rows to right aligned dummy inputs within those rows. Used to\n * add padding between left and right aligned inputs.\n */\n this.rightAlignedDummyInputs_ = new WeakMap();\n }\n\n /**\n * Get the block renderer in use.\n *\n * @returns The block renderer in use.\n * @internal\n */\n override getRenderer(): Renderer {\n return this.renderer_ as Renderer;\n }\n\n override measure() {\n // Modifying parent measure method to add `adjustXPosition_`.\n this.createRows_();\n this.addElemSpacing_();\n this.addRowSpacing_();\n this.adjustXPosition_();\n this.computeBounds_();\n this.alignRowElements_();\n this.finalize_();\n }\n\n override shouldStartNewRow_(input: Input, lastInput: Input): boolean {\n // If this is the first input, just add to the existing row.\n // That row is either empty or has some icons in it.\n if (!lastInput) {\n return false;\n }\n // A statement input or an input following one always gets a new row.\n if (input.type === inputTypes.STATEMENT ||\n lastInput.type === inputTypes.STATEMENT) {\n return true;\n }\n // Value and dummy inputs get new row if inputs are not inlined.\n if (input.type === inputTypes.VALUE || input.type === inputTypes.DUMMY) {\n return !this.isInline || this.isMultiRow;\n }\n return false;\n }\n\n override getDesiredRowWidth_(row: Row): number {\n if (row.hasStatement) {\n const rightCornerWidth =\n (this.constants_.INSIDE_CORNERS as InsideCorners).rightWidth || 0;\n return this.width - this.startX - rightCornerWidth;\n }\n return super.getDesiredRowWidth_(row);\n }\n\n override getInRowSpacing_(prev: Measurable|null, next: Measurable|null):\n number {\n if (!prev || !next) {\n // No need for padding at the beginning or end of the row if the\n // output shape is dynamic.\n if (this.outputConnection && this.outputConnection.isDynamicShape &&\n !this.hasStatementInput && !this.bottomRow.hasNextConnection) {\n return this.constants_.NO_PADDING;\n }\n }\n if (!prev) {\n // Statement input padding.\n if (next && Types.isStatementInput(next)) {\n return this.constants_.STATEMENT_INPUT_PADDING_LEFT;\n }\n }\n // Spacing between a rounded corner and a previous or next connection.\n if (prev && Types.isLeftRoundedCorner(prev) && next) {\n if (Types.isPreviousConnection(next) || Types.isNextConnection(next)) {\n return next.notchOffset - this.constants_.CORNER_RADIUS;\n }\n }\n // Spacing between a square corner and a hat.\n if (prev && Types.isLeftSquareCorner(prev) && next && Types.isHat(next)) {\n return this.constants_.NO_PADDING;\n }\n return this.constants_.MEDIUM_PADDING;\n }\n\n override getSpacerRowHeight_(prev: Row, next: Row): number {\n // If we have an empty block add a spacer to increase the height.\n if (Types.isTopRow(prev) && Types.isBottomRow(next)) {\n return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;\n }\n const followsStatement = Types.isInputRow(prev) && prev.hasStatement;\n const precedesStatement = Types.isInputRow(next) && next.hasStatement;\n if (precedesStatement || followsStatement) {\n const cornerHeight =\n (this.constants_.INSIDE_CORNERS as InsideCorners).rightHeight || 0;\n const height = Math.max(this.constants_.NOTCH_HEIGHT, cornerHeight);\n return precedesStatement && followsStatement ?\n Math.max(height, this.constants_.DUMMY_INPUT_MIN_HEIGHT) :\n height;\n }\n // Top and bottom rows act as a spacer so we don't need any extra padding.\n if (Types.isTopRow(prev)) {\n const topRow = prev as TopRow;\n if (!topRow.hasPreviousConnection &&\n (!this.outputConnection || this.hasStatementInput)) {\n return Math.abs(\n this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS);\n }\n return this.constants_.NO_PADDING;\n }\n if (Types.isBottomRow(next)) {\n const bottomRow = next as BottomRow;\n if (!this.outputConnection) {\n const topHeight = Math.max(\n this.topRow.minHeight,\n Math.max(\n this.constants_.NOTCH_HEIGHT,\n this.constants_.CORNER_RADIUS)) -\n this.constants_.CORNER_RADIUS;\n return topHeight;\n } else if (!bottomRow.hasNextConnection && this.hasStatementInput) {\n return Math.abs(\n this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS);\n }\n return this.constants_.NO_PADDING;\n }\n return this.constants_.MEDIUM_PADDING;\n }\n\n override getSpacerRowWidth_(prev: Row, next: Row): number {\n const width = this.width - this.startX;\n if (Types.isInputRow(prev) && prev.hasStatement ||\n Types.isInputRow(next) && next.hasStatement) {\n return Math.max(width, this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH);\n }\n return width;\n }\n\n override getElemCenterline_(row: Row, elem: Measurable): number {\n if (row.hasStatement && !Types.isSpacer(elem) &&\n !Types.isStatementInput(elem)) {\n return row.yPos + this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT / 2;\n }\n if (Types.isInlineInput(elem) && elem instanceof InputConnection) {\n const connectedBlock = elem.connectedBlock;\n if (connectedBlock && connectedBlock.outputConnection &&\n connectedBlock.nextConnection) {\n return row.yPos + connectedBlock.height / 2;\n }\n }\n return super.getElemCenterline_(row, elem);\n }\n\n override addInput_(input: Input, activeRow: Row) {\n // If we have two dummy inputs on the same row, one aligned left and the\n // other right, keep track of the right aligned dummy input so we can add\n // padding later.\n if (input.type === inputTypes.DUMMY && activeRow.hasDummyInput &&\n activeRow.align === Align.LEFT && input.align === Align.RIGHT) {\n this.rightAlignedDummyInputs_.set(activeRow, input);\n } else if (input.type === inputTypes.STATEMENT) {\n // Handle statements without next connections correctly.\n activeRow.elements.push(new StatementInput(this.constants_, input));\n activeRow.hasStatement = true;\n\n if (activeRow.align === null) {\n activeRow.align = input.align;\n }\n return;\n }\n super.addInput_(input, activeRow);\n }\n\n override addAlignmentPadding_(row: Row, missingSpace: number) {\n if (this.rightAlignedDummyInputs_.get(row)) {\n let alignmentDivider;\n for (let i = 0; i < row.elements.length; i++) {\n const elem = row.elements[i];\n if (Types.isSpacer(elem)) {\n alignmentDivider = elem;\n }\n if (Types.isField(elem) && elem instanceof Field &&\n elem.parentInput === this.rightAlignedDummyInputs_.get(row)) {\n break;\n }\n }\n if (alignmentDivider) {\n alignmentDivider.width += missingSpace;\n row.width += missingSpace;\n return;\n }\n }\n super.addAlignmentPadding_(row, missingSpace);\n }\n\n /**\n * Adjust the x position of fields to bump all non-label fields in the first\n * row past the notch position. This must be called before `computeBounds`\n * is called.\n */\n protected adjustXPosition_() {\n const notchTotalWidth =\n this.constants_.NOTCH_OFFSET_LEFT + this.constants_.NOTCH_WIDTH;\n let minXPos = notchTotalWidth;\n // Run through every input row on the block and only apply bump logic to the\n // first input row (if the block has prev connection) and every input row\n // that has a prev and next notch.\n for (let i = 2; i < this.rows.length - 1; i += 2) {\n const prevSpacer = this.rows[i - 1] as SpacerRow;\n const row = this.rows[i];\n const nextSpacer = this.rows[i + 1] as SpacerRow;\n\n const hasPrevNotch = i === 2 ? !!this.topRow.hasPreviousConnection :\n !!prevSpacer.followsStatement;\n const hasNextNotch = i + 2 >= this.rows.length - 1 ?\n !!this.bottomRow.hasNextConnection :\n !!nextSpacer.precedesStatement;\n\n if (Types.isInputRow(row) && row.hasStatement) {\n row.measure();\n minXPos =\n row.width - (row.getLastInput()?.width ?? 0) + notchTotalWidth;\n } else if (\n hasPrevNotch && (i === 2 || hasNextNotch) && Types.isInputRow(row) &&\n !row.hasStatement) {\n let xCursor = row.xPos;\n let prevInRowSpacer = null;\n for (let j = 0; j < row.elements.length; j++) {\n const elem = row.elements[j];\n if (Types.isSpacer(elem)) {\n prevInRowSpacer = elem;\n }\n if (prevInRowSpacer && (Types.isField(elem) || Types.isInput(elem))) {\n if (xCursor < minXPos &&\n !(Types.isField(elem) && elem instanceof Field &&\n (elem.field instanceof FieldLabel ||\n elem.field instanceof FieldImage))) {\n const difference = minXPos - xCursor;\n prevInRowSpacer.width += difference;\n }\n }\n xCursor += elem.width;\n }\n }\n }\n }\n\n /**\n * Finalize the output connection info. In particular, set the height of the\n * output connection to match that of the block. For the right side, add a\n * right connection shape element and have it match the dimensions of the\n * output connection.\n */\n protected finalizeOutputConnection_() {\n // Dynamic output connections depend on the height of the block.\n if (!this.outputConnection || !this.outputConnection.isDynamicShape) {\n return;\n }\n const outputConnectionShape = this.outputConnection.shape;\n if (!('isDynamic' in outputConnectionShape &&\n outputConnectionShape.isDynamic)) {\n return;\n }\n\n let yCursor = 0;\n // Determine the block height.\n for (let i = 0; i < this.rows.length; i++) {\n const row = this.rows[i];\n row.yPos = yCursor;\n yCursor += row.height;\n }\n this.height = yCursor;\n\n // Adjust the height of the output connection.\n const blockHeight = this.bottomRow.hasNextConnection ?\n this.height - this.bottomRow.descenderHeight :\n this.height;\n const connectionHeight = outputConnectionShape.height(blockHeight);\n const connectionWidth = outputConnectionShape.width(blockHeight);\n\n this.outputConnection.height = connectionHeight;\n this.outputConnection.width = connectionWidth;\n this.outputConnection.startX = connectionWidth;\n this.outputConnection.connectionOffsetY =\n outputConnectionShape.connectionOffsetY(connectionHeight);\n this.outputConnection.connectionOffsetX =\n outputConnectionShape.connectionOffsetX(connectionWidth);\n\n // Add the right connection measurable.\n // Don't add it if we have a value-to-statement or a value-to-stack block.\n let rightConnectionWidth = 0;\n if (!this.hasStatementInput && !this.bottomRow.hasNextConnection) {\n rightConnectionWidth = connectionWidth;\n this.rightSide!.height = connectionHeight;\n this.rightSide!.width = rightConnectionWidth;\n this.rightSide!.centerline = connectionHeight / 2;\n this.rightSide!.xPos = this.width + rightConnectionWidth;\n }\n this.startX = connectionWidth;\n this.width += connectionWidth + rightConnectionWidth;\n this.widthWithChildren += connectionWidth + rightConnectionWidth;\n }\n\n /**\n * Finalize horizontal alignment of elements on the block. In particular,\n * reduce the implicit spacing created by the left and right output connection\n * shapes by adding setting negative spacing onto the leftmost and rightmost\n * spacers.\n */\n protected finalizeHorizontalAlignment_() {\n if (!this.outputConnection || this.hasStatementInput ||\n this.bottomRow.hasNextConnection) {\n return;\n }\n let totalNegativeSpacing = 0;\n for (let i = 0; i < this.rows.length; i++) {\n const row = this.rows[i];\n if (!Types.isInputRow(row)) {\n continue;\n }\n const firstElem = row.elements[1];\n const lastElem = row.elements[row.elements.length - 2];\n let leftNegPadding = this.getNegativeSpacing_(firstElem);\n let rightNegPadding = this.getNegativeSpacing_(lastElem);\n totalNegativeSpacing = leftNegPadding + rightNegPadding;\n const minBlockWidth =\n this.constants_.MIN_BLOCK_WIDTH + this.outputConnection.width * 2;\n if (this.width - totalNegativeSpacing < minBlockWidth) {\n // Maintain a minimum block width, split negative spacing between left\n // and right edge.\n totalNegativeSpacing = this.width - minBlockWidth;\n leftNegPadding = totalNegativeSpacing / 2;\n rightNegPadding = totalNegativeSpacing / 2;\n }\n // Add a negative spacer on the start and end of the block.\n row.elements.unshift(new InRowSpacer(this.constants_, -leftNegPadding));\n row.elements.push(new InRowSpacer(this.constants_, -rightNegPadding));\n }\n if (totalNegativeSpacing) {\n this.width -= totalNegativeSpacing;\n this.widthWithChildren -= totalNegativeSpacing;\n this.rightSide!.xPos -= totalNegativeSpacing;\n for (let i = 0; i < this.rows.length; i++) {\n const row = this.rows[i];\n if (Types.isTopOrBottomRow(row)) {\n row.elements[1].width -= totalNegativeSpacing;\n }\n row.width -= totalNegativeSpacing;\n row.widthWithConnectedBlocks -= totalNegativeSpacing;\n }\n }\n }\n\n /**\n * Calculate the spacing to reduce the left and right edges by based on the\n * outer and inner connection shape.\n *\n * @param elem The first or last element on a block.\n * @returns The amount of spacing to reduce the first or last spacer.\n */\n protected getNegativeSpacing_(elem: Measurable): number {\n if (!elem || !this.outputConnection) {\n return 0;\n }\n const connectionWidth = this.outputConnection.width;\n const outerShape = this.outputConnection.shape.type;\n const constants = (this.constants_);\n if (this.isMultiRow && this.inputRows.length > 1) {\n switch (outerShape) {\n case constants.SHAPES.ROUND: {\n // Special case for multi-row round reporter blocks.\n const maxWidth = this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;\n const width = this.height / 2 > maxWidth ? maxWidth : this.height / 2;\n const topPadding = this.constants_.SMALL_PADDING;\n const roundPadding =\n width * (1 - Math.sin(Math.acos((width - topPadding) / width)));\n return connectionWidth - roundPadding;\n }\n default:\n return 0;\n }\n }\n if (Types.isInlineInput(elem) && elem instanceof InputConnection) {\n const connectedBlock = elem.connectedBlock;\n const innerShape = connectedBlock ?\n (connectedBlock.pathObject as PathObject).outputShapeType :\n elem.shape.type;\n if (innerShape == null) {\n return 0;\n }\n // Special case for value to stack / value to statement blocks.\n if (connectedBlock && connectedBlock.outputConnection &&\n (connectedBlock.statementInputCount ||\n connectedBlock.nextConnection)) {\n return 0;\n }\n // Special case for hexagonal output.\n if (outerShape === constants.SHAPES.HEXAGONAL &&\n outerShape !== innerShape) {\n return 0;\n }\n return connectionWidth -\n this.constants_.SHAPE_IN_SHAPE_PADDING[outerShape][innerShape];\n } else if (Types.isField(elem) && elem instanceof Field) {\n // Special case for text inputs.\n if (outerShape === constants.SHAPES.ROUND &&\n elem.field instanceof FieldTextInput) {\n return connectionWidth - 2.75 * constants.GRID_UNIT;\n }\n return connectionWidth -\n this.constants_.SHAPE_IN_SHAPE_PADDING[outerShape][0];\n } else if (Types.isIcon(elem)) {\n return this.constants_.SMALL_PADDING;\n }\n return 0;\n }\n\n /**\n * Finalize vertical alignment of rows on a block. In particular, reduce the\n * implicit spacing when a non-shadow block is connected to any of an input\n * row's inline inputs.\n */\n protected finalizeVerticalAlignment_() {\n if (this.outputConnection) {\n return;\n }\n // Run through every input row on the block and only apply tight nesting\n // logic to input rows that have a prev and next notch.\n for (let i = 2; i < this.rows.length - 1; i += 2) {\n const prevSpacer = this.rows[i - 1] as SpacerRow;\n const row = this.rows[i];\n const nextSpacer = this.rows[i + 1] as SpacerRow;\n\n const firstRow = i === 2;\n const hasPrevNotch = firstRow ? !!this.topRow.hasPreviousConnection :\n !!prevSpacer.followsStatement;\n const hasNextNotch = i + 2 >= this.rows.length - 1 ?\n !!this.bottomRow.hasNextConnection :\n !!nextSpacer.precedesStatement;\n\n if (hasPrevNotch) {\n const elem = row.elements[1];\n const hasSingleTextOrImageField = row.elements.length === 3 &&\n elem instanceof Field &&\n (elem.field instanceof FieldLabel ||\n elem.field instanceof FieldImage);\n if (!firstRow && hasSingleTextOrImageField) {\n // Remove some padding if we have a single image or text field.\n prevSpacer.height -= this.constants_.SMALL_PADDING;\n nextSpacer.height -= this.constants_.SMALL_PADDING;\n row.height -= this.constants_.MEDIUM_PADDING;\n } else if (!firstRow && !hasNextNotch) {\n // Add a small padding so the notch doesn't clash with inputs/fields.\n prevSpacer.height += this.constants_.SMALL_PADDING;\n } else if (hasNextNotch) {\n // Determine if the input row has non-shadow connected blocks.\n let hasNonShadowConnectedBlocks = false;\n const minVerticalTightNestingHeight = 40;\n for (let j = 0; j < row.elements.length; j++) {\n const elem = row.elements[j];\n if (elem instanceof InputConnection && Types.isInlineInput(elem) &&\n elem.connectedBlock && !elem.connectedBlock.isShadow() &&\n elem.connectedBlock.getHeightWidth().height >=\n minVerticalTightNestingHeight) {\n hasNonShadowConnectedBlocks = true;\n break;\n }\n }\n // Apply tight-nesting if we have both a prev and next notch and the\n // block has non-shadow connected blocks.\n if (hasNonShadowConnectedBlocks) {\n prevSpacer.height -= this.constants_.SMALL_PADDING;\n nextSpacer.height -= this.constants_.SMALL_PADDING;\n }\n }\n }\n }\n }\n\n override finalize_() {\n this.finalizeOutputConnection_();\n this.finalizeHorizontalAlignment_();\n this.finalizeVerticalAlignment_();\n super.finalize_();\n\n if (this.rightSide) {\n this.widthWithChildren += this.rightSide.width;\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for graphically rendering a marker as SVG.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.MarkerSvg');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {ASTNode} from '../../keyboard_nav/ast_node.js';\nimport type {Marker} from '../../keyboard_nav/marker.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\nimport type {WorkspaceSvg} from '../../workspace_svg.js';\nimport type {ConstantProvider as BaseConstantProvider} from '../common/constants.js';\nimport {MarkerSvg as BaseMarkerSvg} from '../common/marker_svg.js';\n\nimport type {ConstantProvider as ZelosConstantProvider} from './constants.js';\n\n\n/**\n * Class to draw a marker.\n *\n * @alias Blockly.zelos.MarkerSvg\n */\nexport class MarkerSvg extends BaseMarkerSvg {\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n constants_!: ZelosConstantProvider;\n\n private markerCircle_: SVGCircleElement|null = null;\n\n /**\n * @param workspace The workspace the marker belongs to.\n * @param constants The constants for the renderer.\n * @param marker The marker to draw.\n */\n constructor(\n workspace: WorkspaceSvg, constants: BaseConstantProvider,\n marker: Marker) {\n super(workspace, constants, marker);\n }\n\n /**\n * Position and display the marker for an input or an output connection.\n *\n * @param curNode The node to draw the marker for.\n */\n private showWithInputOutput_(curNode: ASTNode) {\n const block = curNode.getSourceBlock() as BlockSvg;\n const connection = curNode.getLocation() as RenderedConnection;\n const offsetInBlock = connection.getOffsetInBlock();\n\n this.positionCircle_(offsetInBlock.x, offsetInBlock.y);\n this.setParent_(block);\n this.showCurrent_();\n }\n\n override showWithOutput_(curNode: ASTNode) {\n this.showWithInputOutput_(curNode);\n }\n\n override showWithInput_(curNode: ASTNode) {\n this.showWithInputOutput_(curNode);\n }\n\n /**\n * Draw a rectangle around the block.\n *\n * @param curNode The current node of the marker.\n */\n override showWithBlock_(curNode: ASTNode) {\n const block = curNode.getLocation() as BlockSvg;\n\n // Gets the height and width of entire stack.\n const heightWidth = block.getHeightWidth();\n // Add padding so that being on a stack looks different than being on a\n // block.\n this.positionRect_(0, 0, heightWidth.width, heightWidth.height);\n this.setParent_(block);\n this.showCurrent_();\n }\n\n /**\n * Position the circle we use for input and output connections.\n *\n * @param x The x position of the circle.\n * @param y The y position of the circle.\n */\n private positionCircle_(x: number, y: number) {\n this.markerCircle_?.setAttribute('cx', x.toString());\n this.markerCircle_?.setAttribute('cy', y.toString());\n this.currentMarkerSvg = this.markerCircle_;\n }\n\n override hide() {\n super.hide();\n if (this.markerCircle_) {\n this.markerCircle_.style.display = 'none';\n }\n }\n\n override createDomInternal_() {\n /* clang-format off */\n /* This markup will be generated and added to the .svgGroup_:\n <g>\n <rect width=\"100\" height=\"5\">\n <animate attributeType=\"XML\" attributeName=\"fill\" dur=\"1s\"\n values=\"transparent;transparent;#fff;transparent\" repeatCount=\"indefinite\" />\n </rect>\n </g>\n */\n /* clang-format on */\n super.createDomInternal_();\n\n this.markerCircle_ = dom.createSvgElement(\n Svg.CIRCLE, {\n 'r': this.constants_.CURSOR_RADIUS,\n 'style': 'display: none',\n 'stroke-width': this.constants_.CURSOR_STROKE_WIDTH,\n },\n this.markerSvg_);\n\n // Markers and stack cursors don't blink.\n if (this.isCursor()) {\n const blinkProperties = this.getBlinkProperties_();\n dom.createSvgElement(Svg.ANIMATE, blinkProperties, this.markerCircle_!);\n }\n\n return this.markerSvg_!;\n }\n\n override applyColour_(curNode: ASTNode) {\n super.applyColour_(curNode);\n\n this.markerCircle_?.setAttribute('fill', this.colour_);\n this.markerCircle_?.setAttribute('stroke', this.colour_);\n\n if (this.isCursor()) {\n const values = this.colour_ + ';transparent;transparent;';\n this.markerCircle_?.firstElementChild!.setAttribute('values', values);\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that owns a block's rendering SVG elements.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.PathObject');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Connection} from '../../connection.js';\nimport type {BlockStyle} from '../../theme.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\nimport {PathObject as BasePathObject} from '../common/path_object.js';\n\nimport type {ConstantProvider} from './constants.js';\n\n\n/**\n * An object that handles creating and setting each of the SVG elements\n * used by the renderer.\n *\n * @alias Blockly.zelos.PathObject\n */\nexport class PathObject extends BasePathObject {\n /** The selected path of the block. */\n private svgPathSelected_: SVGElement|null = null;\n\n /** The outline paths on the block. */\n private readonly outlines = new Map<string, SVGElement>();\n\n /**\n * A set used to determine which outlines were used during a draw pass. The\n * set is initialized with a reference to all the outlines in\n * `this.outlines`. Every time we use an outline during the draw pass, the\n * reference is removed from this set.\n */\n private remainingOutlines = new Set<string>();\n\n /**\n * The type of block's output connection shape. This is set when a block\n * with an output connection is drawn.\n */\n outputShapeType: number|null = null;\n\n /** @internal */\n public override constants: ConstantProvider;\n\n /**\n * @param root The root SVG element.\n * @param style The style object to use for colouring.\n * @param constants The renderer's constants.\n * @internal\n */\n constructor(\n root: SVGElement, style: BlockStyle, constants: ConstantProvider) {\n super(root, style, constants);\n\n this.constants = constants;\n }\n\n override setPath(pathString: string) {\n super.setPath(pathString);\n if (this.svgPathSelected_) {\n this.svgPathSelected_.setAttribute('d', pathString);\n }\n }\n\n override applyColour(block: BlockSvg) {\n super.applyColour(block);\n // Set shadow stroke colour.\n const parent = block.getParent();\n if (block.isShadow() && parent) {\n if (!parent.style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n this.svgPath.setAttribute('stroke', parent.style.colourTertiary);\n }\n\n // Apply colour to outlines.\n for (const outline of this.outlines.values()) {\n if (!this.style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n outline.setAttribute('fill', this.style.colourTertiary);\n }\n }\n\n override flipRTL() {\n super.flipRTL();\n // Mirror each input outline path.\n for (const outline of this.outlines.values()) {\n outline.setAttribute('transform', 'scale(-1 1)');\n }\n }\n\n override updateSelected(enable: boolean) {\n this.setClass_('blocklySelected', enable);\n if (enable) {\n if (!this.svgPathSelected_) {\n this.svgPathSelected_ = this.svgPath.cloneNode(true) as SVGElement;\n this.svgPathSelected_.setAttribute('fill', 'none');\n this.svgPathSelected_.setAttribute(\n 'filter', 'url(#' + this.constants.selectedGlowFilterId + ')');\n this.svgRoot.appendChild(this.svgPathSelected_);\n }\n } else {\n if (this.svgPathSelected_) {\n this.svgRoot.removeChild(this.svgPathSelected_);\n this.svgPathSelected_ = null;\n }\n }\n }\n\n override updateReplacementFade(enable: boolean) {\n this.setClass_('blocklyReplaceable', enable);\n if (enable) {\n this.svgPath.setAttribute(\n 'filter', 'url(#' + this.constants.replacementGlowFilterId + ')');\n } else {\n this.svgPath.removeAttribute('filter');\n }\n }\n\n override updateShapeForInputHighlight(conn: Connection, enable: boolean) {\n const name = conn.getParentInput()!.name;\n const outlinePath = this.getOutlinePath_(name);\n if (!outlinePath) {\n return;\n }\n if (enable) {\n outlinePath.setAttribute(\n 'filter', 'url(#' + this.constants.replacementGlowFilterId + ')');\n } else {\n outlinePath.removeAttribute('filter');\n }\n }\n\n /**\n * Method that's called when the drawer is about to draw the block.\n *\n * @internal\n */\n beginDrawing() {\n this.remainingOutlines.clear();\n for (const key of this.outlines.keys()) {\n this.remainingOutlines.add(key);\n }\n }\n\n /**\n * Method that's called when the drawer is done drawing.\n *\n * @internal\n */\n endDrawing() {\n // Go through all remaining outlines that were not used this draw pass, and\n // remove them.\n if (this.remainingOutlines.size) {\n for (const key of this.remainingOutlines) {\n this.removeOutlinePath_(key);\n }\n }\n this.remainingOutlines.clear();\n }\n\n /**\n * Set the path generated by the renderer for an outline path on the\n * respective outline path SVG element.\n *\n * @param name The input name.\n * @param pathString The path.\n * @internal\n */\n setOutlinePath(name: string, pathString: string) {\n const outline = this.getOutlinePath_(name);\n outline.setAttribute('d', pathString);\n if (!this.style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n outline.setAttribute('fill', this.style.colourTertiary);\n }\n\n /**\n * Create's an outline path for the specified input.\n *\n * @param name The input name.\n * @returns The SVG outline path.\n */\n private getOutlinePath_(name: string): SVGElement {\n if (!this.outlines.has(name)) {\n this.outlines.set(\n name,\n dom.createSvgElement(\n Svg.PATH, {\n 'class':\n 'blocklyOutlinePath', // IE doesn't like paths without the\n // data definition, set empty\n // default\n 'd': '',\n },\n this.svgRoot));\n }\n this.remainingOutlines.delete(name);\n return this.outlines.get(name)!;\n }\n\n /**\n * Remove an outline path that is associated with the specified input.\n *\n * @param name The input name.\n */\n private removeOutlinePath_(name: string) {\n this.outlines.get(name)?.parentNode?.removeChild(this.outlines.get(name)!);\n this.outlines.delete(name);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Zelos renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos.Renderer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Connection} from '../../connection.js';\nimport {ConnectionType} from '../../connection_type.js';\nimport {InsertionMarkerManager} from '../../insertion_marker_manager.js';\nimport type {Marker} from '../../keyboard_nav/marker.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {BlockStyle} from '../../theme.js';\nimport type {WorkspaceSvg} from '../../workspace_svg.js';\nimport * as blockRendering from '../common/block_rendering.js';\nimport type {RenderInfo as BaseRenderInfo} from '../common/info.js';\nimport {Renderer as BaseRenderer} from '../common/renderer.js';\n\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {RenderInfo} from './info.js';\nimport {MarkerSvg} from './marker_svg.js';\nimport {PathObject} from './path_object.js';\n\n\n/**\n * The zelos renderer.\n *\n * @alias Blockly.zelos.Renderer\n */\nexport class Renderer extends BaseRenderer {\n protected override constants_!: ConstantProvider;\n\n /**\n * @param name The renderer name.\n * @internal\n */\n constructor(name: string) {\n super(name);\n }\n\n /**\n * Create a new instance of the renderer's constant provider.\n *\n * @returns The constant provider.\n */\n protected override makeConstants_(): ConstantProvider {\n return new ConstantProvider();\n }\n\n /**\n * Create a new instance of the renderer's render info object.\n *\n * @param block The block to measure.\n * @returns The render info object.\n */\n protected override makeRenderInfo_(block: BlockSvg): RenderInfo {\n return new RenderInfo(this, block);\n }\n\n /**\n * Create a new instance of the renderer's drawer.\n *\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @returns The drawer.\n */\n protected override makeDrawer_(block: BlockSvg, info: BaseRenderInfo):\n Drawer {\n return new Drawer(block, (info as RenderInfo));\n }\n\n /**\n * Create a new instance of the renderer's cursor drawer.\n *\n * @param workspace The workspace the cursor belongs to.\n * @param marker The marker.\n * @returns The object in charge of drawing the marker.\n * @internal\n */\n override makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker):\n MarkerSvg {\n return new MarkerSvg(workspace, this.getConstants(), marker);\n }\n\n /**\n * Create a new instance of a renderer path object.\n *\n * @param root The root SVG element.\n * @param style The style object to use for colouring.\n * @returns The renderer path object.\n * @internal\n */\n override makePathObject(root: SVGElement, style: BlockStyle): PathObject {\n return new PathObject(\n root, style, (this.getConstants() as ConstantProvider));\n }\n\n /**\n * Get the current renderer's constant provider. We assume that when this is\n * called, the renderer has already been initialized.\n *\n * @returns The constant provider.\n */\n override getConstants(): ConstantProvider {\n return this.constants_;\n }\n\n override shouldHighlightConnection(conn: Connection) {\n return conn.type !== ConnectionType.INPUT_VALUE &&\n conn.type !== ConnectionType.OUTPUT_VALUE;\n }\n\n override getConnectionPreviewMethod(\n closest: RenderedConnection, local: RenderedConnection,\n topBlock: BlockSvg) {\n if (local.type === ConnectionType.OUTPUT_VALUE) {\n if (!closest.isConnected()) {\n return InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE;\n }\n // TODO: Returning this is a total hack, because we don't want to show\n // a replacement fade, we want to show an outline affect.\n // Sadly zelos does not support showing an outline around filled\n // inputs, so we have to pretend like the connected block is getting\n // replaced.\n return InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE;\n }\n\n return super.getConnectionPreviewMethod(closest, local, topBlock);\n }\n}\n\nblockRendering.register('zelos', Renderer);\n","/** @file Re-exports of Blockly.zelos.* modules. */\n\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Re-exports of Blockly.zelos.* modules.\n *\n * @namespace Blockly.zelos\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.zelos');\n\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {RenderInfo} from './info.js';\nimport {MarkerSvg} from './marker_svg.js';\nimport {BottomRow} from './measurables/bottom_row.js';\nimport {StatementInput} from './measurables/inputs.js';\nimport {RightConnectionShape} from './measurables/row_elements.js';\nimport {TopRow} from './measurables/top_row.js';\nimport {PathObject} from './path_object.js';\nimport {Renderer} from './renderer.js';\n\n\nexport {\n BottomRow,\n ConstantProvider,\n Drawer,\n MarkerSvg,\n PathObject,\n Renderer,\n RenderInfo,\n RightConnectionShape,\n StatementInput,\n TopRow,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * New (evolving) renderer.\n * Thrasos: spirit of boldness.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.thrasos.RenderInfo');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {RenderInfo as BaseRenderInfo} from '../common/info.js';\nimport type {Measurable} from '../measurables/base.js';\nimport type {BottomRow} from '../measurables/bottom_row.js';\nimport type {Field} from '../measurables/field.js';\nimport {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport type {Row} from '../measurables/row.js';\nimport type {TopRow} from '../measurables/top_row.js';\nimport {Types} from '../measurables/types.js';\n\nimport type {Renderer} from './renderer.js';\n\n\n/**\n * An object containing all sizing information needed to draw this block.\n *\n * This measure pass does not propagate changes to the block (although fields\n * may choose to rerender when getSize() is called). However, calling it\n * repeatedly may be expensive.\n *\n * @alias Blockly.thrasos.RenderInfo\n */\nexport class RenderInfo extends BaseRenderInfo {\n // Exclamation is fine b/c this is assigned by the super constructor.\n protected override renderer_!: Renderer;\n\n /**\n * @param renderer The renderer in use.\n * @param block The block to measure.\n * @internal\n */\n constructor(renderer: Renderer, block: BlockSvg) {\n super(renderer, block);\n }\n\n /**\n * Get the block renderer in use.\n *\n * @returns The block renderer in use.\n * @internal\n */\n override getRenderer(): Renderer {\n return this.renderer_;\n }\n\n override addElemSpacing_() {\n let hasExternalInputs = false;\n for (let i = 0; i < this.rows.length; i++) {\n const row = this.rows[i];\n if (row.hasExternalInput) {\n hasExternalInputs = true;\n break;\n }\n }\n for (let i = 0; i < this.rows.length; i++) {\n const row = this.rows[i];\n const oldElems = row.elements;\n row.elements = [];\n // No spacing needed before the corner on the top row or the bottom row.\n if (row.startsWithElemSpacer()) {\n // There's a spacer before the first element in the row.\n row.elements.push(new InRowSpacer(\n this.constants_, this.getInRowSpacing_(null, oldElems[0])));\n }\n if (!oldElems.length) {\n continue;\n }\n for (let e = 0; e < oldElems.length - 1; e++) {\n row.elements.push(oldElems[e]);\n const spacing = this.getInRowSpacing_(oldElems[e], oldElems[e + 1]);\n row.elements.push(new InRowSpacer(this.constants_, spacing));\n }\n row.elements.push(oldElems[oldElems.length - 1]);\n if (row.endsWithElemSpacer()) {\n let spacing =\n this.getInRowSpacing_(oldElems[oldElems.length - 1], null);\n if (hasExternalInputs && row.hasDummyInput) {\n spacing += this.constants_.TAB_WIDTH;\n }\n // There's a spacer after the last element in the row.\n row.elements.push(new InRowSpacer(this.constants_, spacing));\n }\n }\n }\n\n override getInRowSpacing_(prev: Measurable|null, next: Measurable|null) {\n if (!prev) {\n // Between an editable field and the beginning of the row.\n if (next && Types.isField(next) && (next as Field).isEditable) {\n return this.constants_.MEDIUM_PADDING;\n }\n // Inline input at the beginning of the row.\n if (next && Types.isInlineInput(next)) {\n return this.constants_.MEDIUM_LARGE_PADDING;\n }\n if (next && Types.isStatementInput(next)) {\n return this.constants_.STATEMENT_INPUT_PADDING_LEFT;\n }\n // Anything else at the beginning of the row.\n return this.constants_.LARGE_PADDING;\n }\n\n // Spacing between a non-input and the end of the row.\n if (!Types.isInput(prev) && !next) {\n // Between an editable field and the end of the row.\n if (Types.isField(prev) && (prev as Field).isEditable) {\n return this.constants_.MEDIUM_PADDING;\n }\n // Padding at the end of an icon-only row to make the block shape clearer.\n if (Types.isIcon(prev)) {\n return this.constants_.LARGE_PADDING * 2 + 1;\n }\n if (Types.isHat(prev)) {\n return this.constants_.NO_PADDING;\n }\n // Establish a minimum width for a block with a previous or next\n // connection.\n if (Types.isPreviousOrNextConnection(prev)) {\n return this.constants_.LARGE_PADDING;\n }\n // Between rounded corner and the end of the row.\n if (Types.isLeftRoundedCorner(prev)) {\n return this.constants_.MIN_BLOCK_WIDTH;\n }\n // Between a jagged edge and the end of the row.\n if (Types.isJaggedEdge(prev)) {\n return this.constants_.NO_PADDING;\n }\n // Between noneditable fields and icons and the end of the row.\n return this.constants_.LARGE_PADDING;\n }\n // Between inputs and the end of the row.\n if (Types.isInput(prev) && !next) {\n if (Types.isExternalInput(prev)) {\n return this.constants_.NO_PADDING;\n } else if (Types.isInlineInput(prev)) {\n return this.constants_.LARGE_PADDING;\n } else if (Types.isStatementInput(prev)) {\n return this.constants_.NO_PADDING;\n }\n }\n\n // Spacing between a non-input and an input.\n if (!Types.isInput(prev) && next && Types.isInput(next)) {\n // Between an editable field and an input.\n if (Types.isField(prev) && (prev as Field).isEditable) {\n if (Types.isInlineInput(next)) {\n return this.constants_.SMALL_PADDING;\n } else if (Types.isExternalInput(next)) {\n return this.constants_.SMALL_PADDING;\n }\n } else {\n if (Types.isInlineInput(next)) {\n return this.constants_.MEDIUM_LARGE_PADDING;\n } else if (Types.isExternalInput(next)) {\n return this.constants_.MEDIUM_LARGE_PADDING;\n } else if (Types.isStatementInput(next)) {\n return this.constants_.LARGE_PADDING;\n }\n }\n return this.constants_.LARGE_PADDING - 1;\n }\n\n // Spacing between an icon and an icon or field.\n if (Types.isIcon(prev) && next && !Types.isInput(next)) {\n return this.constants_.LARGE_PADDING;\n }\n\n // Spacing between an inline input and a field.\n if (Types.isInlineInput(prev) && next && Types.isField(next)) {\n // Editable field after inline input.\n if ((next as Field).isEditable) {\n return this.constants_.MEDIUM_PADDING;\n } else {\n // Noneditable field after inline input.\n return this.constants_.LARGE_PADDING;\n }\n }\n\n if (Types.isLeftSquareCorner(prev) && next) {\n // Spacing between a hat and a corner\n if (Types.isHat(next)) {\n return this.constants_.NO_PADDING;\n }\n // Spacing between a square corner and a previous or next connection\n if (Types.isPreviousConnection(next) || Types.isNextConnection(next)) {\n return next.notchOffset;\n }\n }\n // Spacing between a rounded corner and a previous or next connection.\n if (Types.isLeftRoundedCorner(prev) && next) {\n return next.notchOffset - this.constants_.CORNER_RADIUS;\n }\n\n // Spacing between two fields of the same editability.\n if (Types.isField(prev) && next && Types.isField(next) &&\n (prev as Field).isEditable === (next as Field).isEditable) {\n return this.constants_.LARGE_PADDING;\n }\n\n // Spacing between anything and a jagged edge.\n if (next && Types.isJaggedEdge(next)) {\n return this.constants_.LARGE_PADDING;\n }\n\n return this.constants_.MEDIUM_PADDING;\n }\n\n override getSpacerRowHeight_(prev: Row, next: Row) {\n // If we have an empty block add a spacer to increase the height.\n if (Types.isTopRow(prev) && Types.isBottomRow(next)) {\n return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;\n }\n // Top and bottom rows act as a spacer so we don't need any extra padding.\n if (Types.isTopRow(prev) || Types.isBottomRow(next)) {\n return this.constants_.NO_PADDING;\n }\n if (prev.hasExternalInput && next.hasExternalInput) {\n return this.constants_.LARGE_PADDING;\n }\n if (!prev.hasStatement && next.hasStatement) {\n return this.constants_.BETWEEN_STATEMENT_PADDING_Y;\n }\n if (prev.hasStatement && next.hasStatement) {\n return this.constants_.LARGE_PADDING;\n }\n if (prev.hasDummyInput || next.hasDummyInput) {\n return this.constants_.LARGE_PADDING;\n }\n return this.constants_.MEDIUM_PADDING;\n }\n\n override getElemCenterline_(row: Row, elem: Measurable) {\n if (Types.isSpacer(elem)) {\n return row.yPos + elem.height / 2;\n }\n if (Types.isBottomRow(row)) {\n const bottomRow = row as BottomRow;\n const baseline =\n bottomRow.yPos + bottomRow.height - bottomRow.descenderHeight;\n if (Types.isNextConnection(elem)) {\n return baseline + elem.height / 2;\n }\n return baseline - elem.height / 2;\n }\n if (Types.isTopRow(row)) {\n const topRow = row as TopRow;\n if (Types.isHat(elem)) {\n return topRow.capline - elem.height / 2;\n }\n return topRow.capline + elem.height / 2;\n }\n\n let result = row.yPos;\n if (Types.isField(elem) && row.hasStatement) {\n const offset =\n this.constants_.TALL_INPUT_FIELD_OFFSET_Y + elem.height / 2;\n result += offset;\n } else {\n result += row.height / 2;\n }\n return result;\n }\n\n override finalize_() {\n // Performance note: this could be combined with the draw pass, if the time\n // that this takes is excessive. But it shouldn't be, because it only\n // accesses and sets properties that already exist on the objects.\n let widestRowWithConnectedBlocks = 0;\n let yCursor = 0;\n for (let i = 0; i < this.rows.length; i++) {\n const row = this.rows[i];\n row.yPos = yCursor;\n row.xPos = this.startX;\n yCursor += row.height;\n\n widestRowWithConnectedBlocks =\n Math.max(widestRowWithConnectedBlocks, row.widthWithConnectedBlocks);\n // Add padding to the bottom row if block height is less than minimum\n const heightWithoutHat = yCursor - this.topRow.ascenderHeight;\n if (row === this.bottomRow &&\n heightWithoutHat < this.constants_.MIN_BLOCK_HEIGHT) {\n // But the hat height shouldn't be part of this.\n const diff = this.constants_.MIN_BLOCK_HEIGHT - heightWithoutHat;\n this.bottomRow.height += diff;\n yCursor += diff;\n }\n this.recordElemPositions_(row);\n }\n if (this.outputConnection && this.block_.nextConnection &&\n this.block_.nextConnection.isConnected()) {\n const target = this.block_.nextConnection.targetBlock();\n if (target) {\n // Include width of connected block in value to stack width measurement.\n widestRowWithConnectedBlocks = Math.max(\n widestRowWithConnectedBlocks, target.getHeightWidth().width);\n }\n }\n\n this.bottomRow.baseline = yCursor - this.bottomRow.descenderHeight;\n this.widthWithChildren = widestRowWithConnectedBlocks + this.startX;\n\n this.height = yCursor;\n this.startY = this.topRow.capline;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Thrasos renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.thrasos.Renderer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport * as blockRendering from '../common/block_rendering.js';\nimport {Renderer as BaseRenderer} from '../common/renderer.js';\n\nimport {RenderInfo} from './info.js';\n\n\n/**\n * The thrasos renderer.\n *\n * @alias Blockly.thrasos.Renderer\n */\nexport class Renderer extends BaseRenderer {\n /**\n * @param name The renderer name.\n * @internal\n */\n constructor(name: string) {\n super(name);\n }\n\n /**\n * Create a new instance of the renderer's render info object.\n *\n * @param block The block to measure.\n * @returns The render info object.\n */\n protected override makeRenderInfo_(block: BlockSvg): RenderInfo {\n return new RenderInfo(this, block);\n }\n}\n\nblockRendering.register('thrasos', Renderer);\n","/** @file Re-exports of Blockly.thrasos.* modules. */\n\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Re-exports of Blockly.thrasos.* modules.\n *\n * @namespace Blockly.thrasos\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.thrasos');\n\nimport {RenderInfo} from './info.js';\nimport {Renderer} from './renderer.js';\n\n\nexport {Renderer, RenderInfo};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that provides constants for rendering blocks in the\n * minimalist renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.minimalist.ConstantProvider');\n\nimport {ConstantProvider as BaseConstantProvider} from '../common/constants.js';\n\n\n/**\n * An object that provides constants for rendering blocks in the sample.\n *\n * @alias Blockly.minimalist.ConstantProvider\n */\nexport class ConstantProvider extends BaseConstantProvider {\n /** @internal */\n constructor() {\n super();\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Minimalist rendering drawer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.minimalist.Drawer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {Drawer as BaseDrawer} from '../common/drawer.js';\n\nimport type {RenderInfo} from './info.js';\n\n\n/**\n * An object that draws a block based on the given rendering information.\n *\n * @alias Blockly.minimalist.Drawer\n */\nexport class Drawer extends BaseDrawer {\n /**\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @internal\n */\n constructor(block: BlockSvg, info: RenderInfo) {\n super(block, info);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Minimalist render info object.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.minimalist.RenderInfo');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {RenderInfo as BaseRenderInfo} from '../common/info.js';\n\nimport type {Renderer} from './renderer.js';\n\n\n/**\n * An object containing all sizing information needed to draw this block.\n *\n * This measure pass does not propagate changes to the block (although fields\n * may choose to rerender when getSize() is called). However, calling it\n * repeatedly may be expensive.\n *\n * @alias Blockly.minimalist.RenderInfo\n */\nexport class RenderInfo extends BaseRenderInfo {\n // Exclamation is fine b/c this is assigned by the super constructor.\n protected override renderer_!: Renderer;\n\n /**\n * @param renderer The renderer in use.\n * @param block The block to measure.\n * @internal\n */\n constructor(renderer: Renderer, block: BlockSvg) {\n super(renderer, block);\n }\n\n /**\n * Get the block renderer in use.\n *\n * @returns The block renderer in use.\n * @internal\n */\n override getRenderer(): Renderer {\n return this.renderer_;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Minimalist renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.minimalist.Renderer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport * as blockRendering from '../common/block_rendering.js';\nimport type {RenderInfo as BaseRenderInfo} from '../common/info.js';\nimport {Renderer as BaseRenderer} from '../common/renderer.js';\n\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {RenderInfo} from './info.js';\n\n\n/**\n * The minimalist renderer.\n *\n * @alias Blockly.minimalist.Renderer\n */\nexport class Renderer extends BaseRenderer {\n /**\n * @param name The renderer name.\n * @internal\n */\n constructor(name: string) {\n super(name);\n }\n\n /**\n * Create a new instance of the renderer's constant provider.\n *\n * @returns The constant provider.\n */\n protected override makeConstants_(): ConstantProvider {\n return new ConstantProvider();\n }\n\n /**\n * Create a new instance of the renderer's render info object.\n *\n * @param block The block to measure.\n * @returns The render info object.\n */\n protected override makeRenderInfo_(block: BlockSvg): RenderInfo {\n return new RenderInfo(this, block);\n }\n\n /**\n * Create a new instance of the renderer's drawer.\n *\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @returns The drawer.\n */\n protected override makeDrawer_(block: BlockSvg, info: BaseRenderInfo):\n Drawer {\n return new Drawer(block, (info as RenderInfo));\n }\n}\n\nblockRendering.register('minimalist', Renderer);\n","/** @file Re-exports of Blockly.minimalist.* modules. */\n\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Re-exports of Blockly.minimalist.* modules.\n *\n * @namespace Blockly.minimalist\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.minimalist');\n\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {RenderInfo} from './info.js';\nimport {Renderer} from './renderer.js';\n\n\nexport {ConstantProvider, Drawer, Renderer, RenderInfo};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that provides constants for rendering blocks in Geras\n * mode.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.ConstantProvider');\n\nimport {ConstantProvider as BaseConstantProvider} from '../common/constants.js';\n\n\n/**\n * An object that provides constants for rendering blocks in Geras mode.\n *\n * @alias Blockly.geras.ConstantProvider\n */\nexport class ConstantProvider extends BaseConstantProvider {\n override FIELD_TEXT_BASELINE_CENTER = false;\n\n // The dark/shadow path in classic rendering is the same as the normal block\n // path, but translated down one and right one.\n DARK_PATH_OFFSET = 1;\n\n /**\n * The maximum width of a bottom row that follows a statement input and has\n * inputs inline.\n */\n MAX_BOTTOM_WIDTH = 30;\n override STATEMENT_BOTTOM_SPACER = -this.NOTCH_HEIGHT / 2;\n\n /**\n * @internal\n */\n constructor() {\n super();\n }\n\n override getCSS_(selector: string) {\n return super.getCSS_(selector).concat([\n /* eslint-disable indent */\n /* clang-format off */\n // Insertion marker.\n `${selector} .blocklyInsertionMarker>.blocklyPathLight,`,\n `${selector} .blocklyInsertionMarker>.blocklyPathDark {`,\n `fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,\n `stroke: none;`,\n '}',\n /* clang-format on */\n /* eslint-enable indent */\n ]);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Methods for adding highlights on block, for rendering in\n * compatibility mode.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.Highlighter');\n\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport type {BottomRow} from '../measurables/bottom_row.js';\nimport type {Row} from '../measurables/row.js';\nimport {SpacerRow} from '../measurables/spacer_row.js';\nimport type {TopRow} from '../measurables/top_row.js';\nimport {Types} from '../measurables/types.js';\n\nimport type {HighlightConstantProvider, InsideCorner, JaggedTeeth, Notch, OutsideCorner, PuzzleTab, StartHat} from './highlight_constants.js';\nimport type {RenderInfo} from './info.js';\nimport type {InlineInput} from './measurables/inline_input.js';\n\n\n/**\n * An object that adds highlights to a block based on the given rendering\n * information.\n *\n * Highlighting is interesting because the highlights do not fully enclose the\n * block. Instead, they are positioned based on a light source in the top left.\n * This means that rendering highlights requires exact information about the\n * position of each part of the block. The resulting paths are not continuous\n * or closed paths. The highlights for tabs and notches are loosely based on\n * tab and notch shapes, but are not exactly the same.\n *\n * @alias Blockly.geras.Highlighter\n */\nexport class Highlighter {\n info_: RenderInfo;\n steps_ = '';\n inlineSteps_ = '';\n RTL_: boolean;\n constants_: ConstantProvider;\n highlightConstants_: HighlightConstantProvider;\n private readonly highlightOffset_: number;\n outsideCornerPaths_: OutsideCorner;\n insideCornerPaths_: InsideCorner;\n puzzleTabPaths_: PuzzleTab;\n notchPaths_: Notch;\n startPaths_: StartHat;\n jaggedTeethPaths_: JaggedTeeth;\n\n /**\n * @param info An object containing all information needed to render this\n * block.\n * @internal\n */\n constructor(info: RenderInfo) {\n this.info_ = info;\n\n this.RTL_ = this.info_.RTL;\n\n const renderer = (info.getRenderer());\n\n /** The renderer's constant provider. */\n this.constants_ = renderer.getConstants();\n\n this.highlightConstants_ = renderer.getHighlightConstants();\n /** The offset between the block's main path and highlight path. */\n this.highlightOffset_ = this.highlightConstants_.OFFSET;\n\n this.outsideCornerPaths_ = this.highlightConstants_.OUTSIDE_CORNER;\n this.insideCornerPaths_ = this.highlightConstants_.INSIDE_CORNER;\n this.puzzleTabPaths_ = this.highlightConstants_.PUZZLE_TAB;\n this.notchPaths_ = this.highlightConstants_.NOTCH;\n this.startPaths_ = this.highlightConstants_.START_HAT;\n this.jaggedTeethPaths_ = this.highlightConstants_.JAGGED_TEETH;\n }\n\n /**\n * Get the steps for the highlight path.\n *\n * @returns The steps for the highlight path.\n * @internal\n */\n getPath(): string {\n return this.steps_ + '\\n' + this.inlineSteps_;\n }\n\n /**\n * Add a highlight to the top corner of a block.\n *\n * @param row The top row of the block.\n * @internal\n */\n drawTopCorner(row: TopRow) {\n this.steps_ += svgPaths.moveBy(row.xPos, this.info_.startY);\n for (let i = 0, elem; elem = row.elements[i]; i++) {\n if (Types.isLeftSquareCorner(elem)) {\n this.steps_ += this.highlightConstants_.START_POINT;\n } else if (Types.isLeftRoundedCorner(elem)) {\n this.steps_ += this.outsideCornerPaths_.topLeft(this.RTL_);\n } else if (Types.isPreviousConnection(elem)) {\n this.steps_ += this.notchPaths_.pathLeft;\n } else if (Types.isHat(elem)) {\n this.steps_ += this.startPaths_.path(this.RTL_);\n } else if (Types.isSpacer(elem) && elem.width !== 0) {\n // The end point of the spacer needs to be offset by the highlight\n // amount. So instead of using the spacer's width for a relative\n // horizontal, use its width and position for an absolute horizontal\n // move.\n this.steps_ += svgPaths.lineOnAxis(\n 'H', elem.xPos + elem.width - this.highlightOffset_);\n }\n }\n\n const right = row.xPos + row.width - this.highlightOffset_;\n this.steps_ += svgPaths.lineOnAxis('H', right);\n }\n\n /**\n * Add a highlight on a jagged edge for a collapsed block.\n *\n * @param row The row to highlight.\n * @internal\n */\n drawJaggedEdge_(row: Row) {\n if (this.info_.RTL) {\n const remainder =\n row.height - this.jaggedTeethPaths_.height - this.highlightOffset_;\n this.steps_ +=\n this.jaggedTeethPaths_.pathLeft + svgPaths.lineOnAxis('v', remainder);\n }\n }\n\n /**\n * Add a highlight on a value input.\n *\n * @param row The row the input belongs to.\n * @internal\n */\n drawValueInput(row: Row) {\n const input = row.getLastInput() as InlineInput;\n if (this.RTL_) {\n const belowTabHeight = row.height - input.connectionHeight;\n\n this.steps_ +=\n svgPaths.moveTo(\n input.xPos + input.width - this.highlightOffset_, row.yPos) +\n this.puzzleTabPaths_.pathDown(this.RTL_) +\n svgPaths.lineOnAxis('v', belowTabHeight);\n } else {\n this.steps_ += svgPaths.moveTo(input.xPos + input.width, row.yPos) +\n this.puzzleTabPaths_.pathDown(this.RTL_);\n }\n }\n\n /**\n * Add a highlight on a statement input.\n *\n * @param row The row to highlight.\n * @internal\n */\n drawStatementInput(row: Row) {\n const input = row.getLastInput();\n if (!input) return;\n if (this.RTL_) {\n const innerHeight = row.height - 2 * this.insideCornerPaths_.height;\n this.steps_ += svgPaths.moveTo(input.xPos, row.yPos) +\n this.insideCornerPaths_.pathTop(this.RTL_) +\n svgPaths.lineOnAxis('v', innerHeight) +\n this.insideCornerPaths_.pathBottom(this.RTL_) +\n svgPaths.lineTo(\n row.width - input.xPos - this.insideCornerPaths_.width, 0);\n } else {\n this.steps_ += svgPaths.moveTo(input.xPos, row.yPos + row.height) +\n this.insideCornerPaths_.pathBottom(this.RTL_) +\n svgPaths.lineTo(\n row.width - input.xPos - this.insideCornerPaths_.width, 0);\n }\n }\n\n /**\n * Add a highlight on the right side of a row.\n *\n * @param row The row to highlight.\n * @internal\n */\n drawRightSideRow(row: Row) {\n const rightEdge = row.xPos + row.width - this.highlightOffset_;\n if (row instanceof SpacerRow && row.followsStatement) {\n this.steps_ += svgPaths.lineOnAxis('H', rightEdge);\n }\n if (this.RTL_) {\n this.steps_ += svgPaths.lineOnAxis('H', rightEdge);\n if (row.height > this.highlightOffset_) {\n this.steps_ += svgPaths.lineOnAxis(\n 'V', row.yPos + row.height - this.highlightOffset_);\n }\n }\n }\n\n /**\n * Add a highlight to the bottom row.\n *\n * @param row The row to highlight.\n * @internal\n */\n drawBottomRow(row: BottomRow) {\n // Highlight the vertical edge of the bottom row on the input side.\n // Highlighting is always from the top left, both in LTR and RTL.\n if (this.RTL_) {\n this.steps_ +=\n svgPaths.lineOnAxis('V', row.baseline - this.highlightOffset_);\n } else {\n const cornerElem = this.info_.bottomRow.elements[0];\n if (Types.isLeftSquareCorner(cornerElem)) {\n this.steps_ += svgPaths.moveTo(\n row.xPos + this.highlightOffset_,\n row.baseline - this.highlightOffset_);\n } else if (Types.isLeftRoundedCorner(cornerElem)) {\n this.steps_ += svgPaths.moveTo(row.xPos, row.baseline);\n this.steps_ += this.outsideCornerPaths_.bottomLeft();\n }\n }\n }\n\n /**\n * Draw the highlight on the left side of the block.\n *\n * @internal\n */\n drawLeft() {\n const outputConnection = this.info_.outputConnection;\n if (outputConnection) {\n const tabBottom =\n outputConnection.connectionOffsetY + outputConnection.height;\n // Draw a line up to the bottom of the tab.\n if (this.RTL_) {\n this.steps_ += svgPaths.moveTo(this.info_.startX, tabBottom);\n } else {\n const left = this.info_.startX + this.highlightOffset_;\n const bottom = this.info_.bottomRow.baseline - this.highlightOffset_;\n this.steps_ += svgPaths.moveTo(left, bottom);\n this.steps_ += svgPaths.lineOnAxis('V', tabBottom);\n }\n this.steps_ += this.puzzleTabPaths_.pathUp(this.RTL_);\n }\n\n if (!this.RTL_) {\n const topRow = this.info_.topRow;\n if (Types.isLeftRoundedCorner(topRow.elements[0])) {\n this.steps_ +=\n svgPaths.lineOnAxis('V', this.outsideCornerPaths_.height);\n } else {\n this.steps_ +=\n svgPaths.lineOnAxis('V', topRow.capline + this.highlightOffset_);\n }\n }\n }\n\n /**\n * Add a highlight to an inline input.\n *\n * @param input The input to highlight.\n * @internal\n */\n drawInlineInput(input: InlineInput) {\n const offset = this.highlightOffset_;\n\n // Relative to the block's left.\n const connectionRight = input.xPos + input.connectionWidth;\n const yPos = input.centerline - input.height / 2;\n const bottomHighlightWidth = input.width - input.connectionWidth;\n const startY = yPos + offset;\n\n if (this.RTL_) {\n const aboveTabHeight = input.connectionOffsetY - offset;\n const belowTabHeight = input.height -\n (input.connectionOffsetY + input.connectionHeight) + offset;\n\n const startX = connectionRight - offset;\n\n this.inlineSteps_ +=\n svgPaths.moveTo(startX, startY) + // Right edge above tab.\n svgPaths.lineOnAxis('v', aboveTabHeight) + // Back of tab.\n this.puzzleTabPaths_.pathDown(this.RTL_) + // Right edge below tab.\n svgPaths.lineOnAxis('v', belowTabHeight) + // Bottom.\n svgPaths.lineOnAxis('h', bottomHighlightWidth);\n } else {\n this.inlineSteps_ += // Go to top right corner.\n svgPaths.moveTo(\n input.xPos + input.width + offset,\n startY) + // Highlight right edge, bottom.\n svgPaths.lineOnAxis('v', input.height) +\n svgPaths.lineOnAxis(\n 'h', -bottomHighlightWidth) + // Go to top of tab.\n svgPaths.moveTo(\n connectionRight,\n yPos + input.connectionOffsetY) + // Short highlight glint at\n // bottom of tab.\n this.puzzleTabPaths_.pathDown(this.RTL_);\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Renderer that preserves the look and feel of Blockly pre-2019.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.Drawer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport * as debug from '../common/debug.js';\nimport {Drawer as BaseDrawer} from '../common/drawer.js';\nimport type {Row} from '../measurables/row.js';\n\nimport type {ConstantProvider} from './constants.js';\nimport {Highlighter} from './highlighter.js';\nimport type {RenderInfo} from './info.js';\nimport type {InlineInput} from './measurables/inline_input.js';\nimport type {PathObject} from './path_object.js';\n\n\n/**\n * An object that draws a block based on the given rendering information.\n *\n * @alias Blockly.geras.Drawer\n */\nexport class Drawer extends BaseDrawer {\n highlighter_: Highlighter;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override constants_!: ConstantProvider;\n\n /**\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @internal\n */\n constructor(block: BlockSvg, info: RenderInfo) {\n super(block, info);\n // Unlike Thrasos, Geras has highlights and drop shadows.\n this.highlighter_ = new Highlighter(info);\n }\n\n override draw() {\n this.hideHiddenIcons_();\n this.drawOutline_();\n this.drawInternals_();\n\n const pathObject = this.block_.pathObject as PathObject;\n pathObject.setPath(this.outlinePath_ + '\\n' + this.inlinePath_);\n pathObject.setHighlightPath(this.highlighter_.getPath());\n if (this.info_.RTL) {\n pathObject.flipRTL();\n }\n if (debug.isDebuggerEnabled()) {\n this.block_?.renderingDebugger?.drawDebug(this.block_, this.info_);\n }\n this.recordSizeOnBlock_();\n }\n\n override drawTop_() {\n this.highlighter_.drawTopCorner(this.info_.topRow);\n this.highlighter_.drawRightSideRow(this.info_.topRow);\n\n super.drawTop_();\n }\n\n override drawJaggedEdge_(row: Row) {\n this.highlighter_.drawJaggedEdge_(row);\n\n super.drawJaggedEdge_(row);\n }\n\n override drawValueInput_(row: Row) {\n this.highlighter_.drawValueInput(row);\n\n super.drawValueInput_(row);\n }\n\n override drawStatementInput_(row: Row) {\n this.highlighter_.drawStatementInput(row);\n\n super.drawStatementInput_(row);\n }\n\n override drawRightSideRow_(row: Row) {\n this.highlighter_.drawRightSideRow(row);\n\n this.outlinePath_ += svgPaths.lineOnAxis('H', row.xPos + row.width) +\n svgPaths.lineOnAxis('V', row.yPos + row.height);\n }\n\n override drawBottom_() {\n this.highlighter_.drawBottomRow(this.info_.bottomRow);\n\n super.drawBottom_();\n }\n\n /**\n * Add steps for the left side of the block, which may include an output\n * connection\n */\n protected override drawLeft_() {\n this.highlighter_.drawLeft();\n\n super.drawLeft_();\n }\n\n override drawInlineInput_(input: InlineInput) {\n this.highlighter_.drawInlineInput(input as InlineInput);\n\n super.drawInlineInput_(input);\n }\n\n override positionInlineInputConnection_(input: InlineInput) {\n const yPos = input.centerline - input.height / 2;\n // Move the connection.\n if (input.connectionModel) {\n // xPos already contains info about startX\n let connX =\n input.xPos + input.connectionWidth + this.constants_.DARK_PATH_OFFSET;\n if (this.info_.RTL) {\n connX *= -1;\n }\n input.connectionModel.setOffsetInBlock(\n connX,\n yPos + input.connectionOffsetY + this.constants_.DARK_PATH_OFFSET);\n }\n }\n\n override positionStatementInputConnection_(row: Row) {\n const input = row.getLastInput();\n if (input?.connectionModel) {\n let connX = row.xPos + row.statementEdge + input.notchOffset;\n if (this.info_.RTL) {\n connX *= -1;\n } else {\n connX += this.constants_.DARK_PATH_OFFSET;\n }\n input.connectionModel.setOffsetInBlock(\n connX, row.yPos + this.constants_.DARK_PATH_OFFSET);\n }\n }\n\n override positionExternalValueConnection_(row: Row) {\n const input = row.getLastInput();\n if (input && input.connectionModel) {\n let connX = row.xPos + row.width + this.constants_.DARK_PATH_OFFSET;\n if (this.info_.RTL) {\n connX *= -1;\n }\n input.connectionModel.setOffsetInBlock(connX, row.yPos);\n }\n }\n\n override positionNextConnection_() {\n const bottomRow = this.info_.bottomRow;\n\n if (bottomRow.connection) {\n const connInfo = bottomRow.connection;\n const x = connInfo.xPos; // Already contains info about startX.\n const connX =\n (this.info_.RTL ? -x : x) + this.constants_.DARK_PATH_OFFSET / 2;\n connInfo.connectionModel.setOffsetInBlock(\n connX, bottomRow.baseline + this.constants_.DARK_PATH_OFFSET);\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects for rendering highlights on blocks.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.HighlightConstantProvider');\n\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport type {ConstantProvider} from '../common/constants.js';\n\n\n/** An object containing sizing and path information about an outside corner. */\nexport interface OutsideCorner {\n height: number;\n topLeft: (p1: boolean) => string;\n bottomLeft: () => string;\n}\n\n/** An object containing sizing and path information about an inside corner. */\nexport interface InsideCorner {\n width: number;\n height: number;\n pathTop: (p1: boolean) => string;\n pathBottom: (p1: boolean) => string;\n}\n\n/** An object containing sizing and path information about a start hat. */\nexport interface StartHat {\n path: (p1: boolean) => string;\n}\n\n/** An object containing sizing and path information about a notch. */\nexport interface Notch {\n pathLeft: string;\n}\n\n/** An object containing sizing and path information about a puzzle tab. */\nexport interface PuzzleTab {\n width: number;\n height: number;\n pathDown: (p1: boolean) => string;\n pathUp: (p1: boolean) => string;\n}\n\n/**\n * An object containing sizing and path information about collapsed block\n * indicators.\n */\nexport interface JaggedTeeth {\n height: number;\n width: number;\n pathLeft: string;\n}\n\n/**\n * An object that provides constants for rendering highlights on blocks.\n * Some highlights are simple offsets of the parent paths and can be generated\n * programmatically. Others, especially on curves, are just made out of piles\n * of constants and are hard to tweak.\n *\n * @alias Blockly.geras.HighlightConstantProvider\n */\nexport class HighlightConstantProvider {\n constantProvider: ConstantProvider;\n\n /** The offset between the block's main path and highlight path. */\n OFFSET = 0.5;\n START_POINT: string;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n INSIDE_CORNER!: InsideCorner;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n OUTSIDE_CORNER!: OutsideCorner;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n PUZZLE_TAB!: PuzzleTab;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n NOTCH!: Notch;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n JAGGED_TEETH!: JaggedTeeth;\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n START_HAT!: StartHat;\n\n /**\n * @param constants The rendering constants provider.\n * @internal\n */\n constructor(constants: ConstantProvider) {\n /** The renderer's constant provider. */\n this.constantProvider = constants;\n\n /**\n * The start point, which is offset in both X and Y, as an SVG path chunk.\n *\n * @internal\n */\n this.START_POINT = svgPaths.moveBy(this.OFFSET, this.OFFSET);\n }\n\n /**\n * Initialize shape objects based on the constants set in the constructor.\n *\n * @internal\n */\n init() {\n /**\n * An object containing sizing and path information about inside corner\n * highlights.\n */\n this.INSIDE_CORNER = this.makeInsideCorner();\n\n /**\n * An object containing sizing and path information about outside corner\n * highlights.\n */\n this.OUTSIDE_CORNER = this.makeOutsideCorner();\n\n /**\n * An object containing sizing and path information about puzzle tab\n * highlights.\n */\n this.PUZZLE_TAB = this.makePuzzleTab();\n\n /**\n * An object containing sizing and path information about notch highlights.\n */\n this.NOTCH = this.makeNotch();\n\n /**\n * An object containing sizing and path information about highlights for\n * collapsed block indicators.\n */\n this.JAGGED_TEETH = this.makeJaggedTeeth();\n\n /**\n * An object containing sizing and path information about start hat\n * highlights.\n */\n this.START_HAT = this.makeStartHat();\n }\n\n /**\n * @returns An object containing sizing and path information about inside\n * corner highlights.\n * @internal\n */\n makeInsideCorner(): InsideCorner {\n const radius = this.constantProvider.CORNER_RADIUS;\n const offset = this.OFFSET;\n\n /**\n * Distance from shape edge to intersect with a curved corner at 45 degrees.\n * Applies to highlighting on around the outside of a curve.\n */\n const distance45outside = (1 - Math.SQRT1_2) * (radius + offset) - offset;\n\n const pathTopRtl = svgPaths.moveBy(distance45outside, distance45outside) +\n svgPaths.arc(\n 'a', '0 0,0', radius,\n svgPaths.point(\n -distance45outside - offset, radius - distance45outside));\n\n const pathBottomRtl = svgPaths.arc(\n 'a', '0 0,0', radius + offset,\n svgPaths.point(radius + offset, radius + offset));\n\n const pathBottomLtr =\n svgPaths.moveBy(distance45outside, -distance45outside) +\n svgPaths.arc(\n 'a', '0 0,0', radius + offset,\n svgPaths.point(\n radius - distance45outside, distance45outside + offset));\n\n return {\n width: radius + offset,\n height: radius,\n pathTop(rtl) {\n return rtl ? pathTopRtl : '';\n },\n pathBottom(rtl) {\n return rtl ? pathBottomRtl : pathBottomLtr;\n },\n };\n }\n\n /**\n * @returns An object containing sizing and path information about outside\n * corner highlights.\n * @internal\n */\n makeOutsideCorner(): OutsideCorner {\n const radius = this.constantProvider.CORNER_RADIUS;\n const offset = this.OFFSET;\n\n /**\n * Distance from shape edge to intersect with a curved corner at 45 degrees.\n * Applies to highlighting on around the inside of a curve.\n */\n const distance45inside = (1 - Math.SQRT1_2) * (radius - offset) + offset;\n\n const topLeftStartX = distance45inside;\n const topLeftStartY = distance45inside;\n const topLeftCornerHighlightRtl =\n svgPaths.moveBy(topLeftStartX, topLeftStartY) +\n svgPaths.arc(\n 'a', '0 0,1', radius - offset,\n svgPaths.point(radius - topLeftStartX, -topLeftStartY + offset));\n /**\n * SVG path for drawing the highlight on the rounded top-left corner.\n */\n const topLeftCornerHighlightLtr = svgPaths.moveBy(offset, radius) +\n svgPaths.arc(\n 'a', '0 0,1', radius - offset,\n svgPaths.point(radius, -radius + offset));\n\n const bottomLeftStartX = distance45inside;\n const bottomLeftStartY = -distance45inside;\n const bottomLeftPath = svgPaths.moveBy(bottomLeftStartX, bottomLeftStartY) +\n svgPaths.arc(\n 'a', '0 0,1', radius - offset,\n svgPaths.point(\n -bottomLeftStartX + offset, -bottomLeftStartY - radius));\n\n return {\n height: radius,\n topLeft(rtl) {\n return rtl ? topLeftCornerHighlightRtl : topLeftCornerHighlightLtr;\n },\n bottomLeft() {\n return bottomLeftPath;\n },\n };\n }\n\n /**\n * @returns An object containing sizing and path information about puzzle tab\n * highlights.\n * @internal\n */\n makePuzzleTab(): PuzzleTab {\n const width = this.constantProvider.TAB_WIDTH;\n const height = this.constantProvider.TAB_HEIGHT;\n\n // This is how much of the vertical block edge is actually drawn by the\n // puzzle tab.\n const verticalOverlap = 2.5;\n\n const highlightRtlUp =\n svgPaths.moveBy(-2, -height + verticalOverlap + 0.9) +\n svgPaths.lineTo(width * -0.45, -2.1);\n\n const highlightRtlDown = svgPaths.lineOnAxis('v', verticalOverlap) +\n svgPaths.moveBy(-width * 0.97, 2.5) +\n svgPaths.curve(\n 'q',\n [\n svgPaths.point(-width * 0.05, 10),\n svgPaths.point(width * 0.3, 9.5),\n ]) +\n svgPaths.moveBy(width * 0.67, -1.9) +\n svgPaths.lineOnAxis('v', verticalOverlap);\n\n const highlightLtrUp = svgPaths.lineOnAxis('v', -1.5) +\n svgPaths.moveBy(width * -0.92, -0.5) +\n svgPaths.curve(\n 'q',\n [svgPaths.point(width * -0.19, -5.5), svgPaths.point(0, -11)]) +\n svgPaths.moveBy(width * 0.92, 1);\n\n const highlightLtrDown =\n svgPaths.moveBy(-5, height - 0.7) + svgPaths.lineTo(width * 0.46, -2.1);\n\n return {\n width,\n height,\n pathUp(rtl) {\n return rtl ? highlightRtlUp : highlightLtrUp;\n },\n pathDown(rtl) {\n return rtl ? highlightRtlDown : highlightLtrDown;\n },\n };\n }\n\n /**\n * @returns An object containing sizing and path information about notch\n * highlights.\n * @internal\n */\n makeNotch(): Notch {\n // This is only for the previous connection.\n const pathLeft = svgPaths.lineOnAxis('h', this.OFFSET) +\n this.constantProvider.NOTCH.pathLeft;\n return {pathLeft};\n }\n\n /**\n * @returns An object containing sizing and path information about collapsed\n * block edge highlights.\n * @internal\n */\n makeJaggedTeeth(): JaggedTeeth {\n const pathLeft = svgPaths.lineTo(5.1, 2.6) + svgPaths.moveBy(-10.2, 6.8) +\n svgPaths.lineTo(5.1, 2.6);\n return {pathLeft, height: 12, width: 10.2};\n }\n\n /**\n * @returns An object containing sizing and path information about start\n * highlights.\n * @internal\n */\n makeStartHat(): StartHat {\n const hatHeight = this.constantProvider.START_HAT.height;\n const pathRtl = svgPaths.moveBy(25, -8.7) + svgPaths.curve('c', [\n svgPaths.point(29.7, -6.2),\n svgPaths.point(57.2, -0.5),\n svgPaths.point(75, 8.7),\n ]);\n\n const pathLtr = svgPaths.curve('c', [\n svgPaths.point(17.8, -9.2),\n svgPaths.point(45.3, -14.9),\n svgPaths.point(75, -8.7),\n ]) + svgPaths.moveTo(100.5, hatHeight + 0.5);\n return {\n path(rtl) {\n return rtl ? pathRtl : pathLtr;\n },\n };\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing inline inputs with connections on a\n * rendered block.\n *\n * @class\n */\nimport * as goog from '../../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.InlineInput');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Input} from '../../../input.js';\nimport type {ConstantProvider as BaseConstantProvider} from '../../../renderers/common/constants.js';\nimport {InlineInput as BaseInlineInput} from '../../../renderers/measurables/inline_input.js';\nimport type {ConstantProvider as GerasConstantProvider} from '../constants.js';\n\n\n/**\n * An object containing information about the space an inline input takes up\n * during rendering.\n *\n * @alias Blockly.geras.InlineInput\n */\nexport class InlineInput extends BaseInlineInput {\n override constants_: GerasConstantProvider;\n\n /**\n * @param constants The rendering constants provider.\n * @param input The inline input to measure and store information for.\n * @internal\n */\n constructor(constants: BaseConstantProvider, input: Input) {\n super(constants, input);\n this.constants_ = constants as GerasConstantProvider;\n\n if (this.connectedBlock) {\n // We allow the dark path to show on the parent block so that the child\n // block looks embossed. This takes up an extra pixel in both x and y.\n this.width += this.constants_.DARK_PATH_OFFSET;\n this.height += this.constants_.DARK_PATH_OFFSET;\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Objects representing statement inputs with connections on a\n * rendered block.\n *\n * @class\n */\nimport * as goog from '../../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.StatementInput');\n\n/* eslint-disable-next-line no-unused-vars */\nimport type {Input} from '../../../input.js';\nimport type {ConstantProvider as BaseConstantProvider} from '../../../renderers/common/constants.js';\nimport {StatementInput as BaseStatementInput} from '../../../renderers/measurables/statement_input.js';\nimport type {ConstantProvider as GerasConstantProvider} from '../constants.js';\n\n\n/**\n * An object containing information about the space a statement input takes up\n * during rendering.\n *\n * @alias Blockly.geras.StatementInput\n */\nexport class StatementInput extends BaseStatementInput {\n override constants_: GerasConstantProvider;\n\n /**\n * @param constants The rendering constants provider.\n * @param input The statement input to measure and store information for.\n * @internal\n */\n constructor(constants: BaseConstantProvider, input: Input) {\n super(constants, input);\n this.constants_ = constants as GerasConstantProvider;\n\n if (this.connectedBlock) {\n // We allow the dark path to show on the parent block so that the child\n // block looks embossed. This takes up an extra pixel in both x and y.\n this.height += this.constants_.DARK_PATH_OFFSET;\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Old (compatibility) renderer.\n * Geras: spirit of old age.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.RenderInfo');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Input} from '../../input.js';\nimport {inputTypes} from '../../input_types.js';\nimport {RenderInfo as BaseRenderInfo} from '../common/info.js';\nimport type {Measurable} from '../measurables/base.js';\nimport type {BottomRow} from '../measurables/bottom_row.js';\nimport {ExternalValueInput} from '../measurables/external_value_input.js';\nimport type {Field} from '../measurables/field.js';\nimport {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport type {InputRow} from '../measurables/input_row.js';\nimport type {Row} from '../measurables/row.js';\nimport type {TopRow} from '../measurables/top_row.js';\nimport {Types} from '../measurables/types.js';\n\nimport type {ConstantProvider} from './constants.js';\nimport {InlineInput} from './measurables/inline_input.js';\nimport {StatementInput} from './measurables/statement_input.js';\nimport type {Renderer} from './renderer.js';\n\n\n/**\n * An object containing all sizing information needed to draw this block.\n *\n * This measure pass does not propagate changes to the block (although fields\n * may choose to rerender when getSize() is called). However, calling it\n * repeatedly may be expensive.\n *\n * @alias Blockly.geras.RenderInfo\n */\nexport class RenderInfo extends BaseRenderInfo {\n // TODO(b/109816955): remove '!', see go/strict-prop-init-fix.\n override constants_!: ConstantProvider;\n\n protected override readonly renderer_: Renderer;\n\n /**\n * @param renderer The renderer in use.\n * @param block The block to measure.\n * @internal\n */\n constructor(renderer: Renderer, block: BlockSvg) {\n super(renderer, block);\n this.renderer_ = renderer;\n }\n\n /**\n * Get the block renderer in use.\n *\n * @returns The block renderer in use.\n * @internal\n */\n override getRenderer(): Renderer {\n return this.renderer_;\n }\n\n override populateBottomRow_() {\n super.populateBottomRow_();\n\n const followsStatement = this.block_.inputList.length &&\n this.block_.inputList[this.block_.inputList.length - 1].type ===\n inputTypes.STATEMENT;\n // The minimum height of the bottom row is smaller in Geras than in other\n // renderers, because the dark path adds a pixel.\n // If one of the row's elements has a greater height this will be\n // overwritten in the compute pass.\n if (!followsStatement) {\n this.bottomRow.minHeight =\n this.constants_.MEDIUM_PADDING - this.constants_.DARK_PATH_OFFSET;\n }\n }\n\n override addInput_(input: Input, activeRow: Row) {\n // Non-dummy inputs have visual representations onscreen.\n if (this.isInline && input.type === inputTypes.VALUE) {\n activeRow.elements.push(new InlineInput(this.constants_, input));\n activeRow.hasInlineInput = true;\n } else if (input.type === inputTypes.STATEMENT) {\n activeRow.elements.push(new StatementInput(this.constants_, input));\n activeRow.hasStatement = true;\n } else if (input.type === inputTypes.VALUE) {\n activeRow.elements.push(new ExternalValueInput(this.constants_, input));\n activeRow.hasExternalInput = true;\n } else if (input.type === inputTypes.DUMMY) {\n // Dummy inputs have no visual representation, but the information is\n // still important.\n activeRow.minHeight =\n Math.max(activeRow.minHeight, this.constants_.DUMMY_INPUT_MIN_HEIGHT);\n activeRow.hasDummyInput = true;\n }\n // Ignore row alignment if inline.\n if (!this.isInline && activeRow.align === null) {\n activeRow.align = input.align;\n }\n }\n\n override addElemSpacing_() {\n let hasExternalInputs = false;\n for (let i = 0, row; row = this.rows[i]; i++) {\n if (row.hasExternalInput) {\n hasExternalInputs = true;\n }\n }\n for (let i = 0, row; row = this.rows[i]; i++) {\n const oldElems = row.elements;\n row.elements = [];\n // No spacing needed before the corner on the top row or the bottom row.\n if (row.startsWithElemSpacer()) {\n // There's a spacer before the first element in the row.\n row.elements.push(new InRowSpacer(\n this.constants_, this.getInRowSpacing_(null, oldElems[0])));\n }\n if (!oldElems.length) {\n continue;\n }\n for (let e = 0; e < oldElems.length - 1; e++) {\n row.elements.push(oldElems[e]);\n const spacing = this.getInRowSpacing_(oldElems[e], oldElems[e + 1]);\n row.elements.push(new InRowSpacer(this.constants_, spacing));\n }\n row.elements.push(oldElems[oldElems.length - 1]);\n if (row.endsWithElemSpacer()) {\n let spacing =\n this.getInRowSpacing_(oldElems[oldElems.length - 1], null);\n if (hasExternalInputs && row.hasDummyInput) {\n spacing += this.constants_.TAB_WIDTH;\n }\n // There's a spacer after the last element in the row.\n row.elements.push(new InRowSpacer(this.constants_, spacing));\n }\n }\n }\n\n override getInRowSpacing_(prev: Measurable|null, next: Measurable|null) {\n if (!prev) {\n // Between an editable field and the beginning of the row.\n if (next && Types.isField(next) && (next as Field).isEditable) {\n return this.constants_.MEDIUM_PADDING;\n }\n // Inline input at the beginning of the row.\n if (next && Types.isInlineInput(next)) {\n return this.constants_.MEDIUM_LARGE_PADDING;\n }\n if (next && Types.isStatementInput(next)) {\n return this.constants_.STATEMENT_INPUT_PADDING_LEFT;\n }\n // Anything else at the beginning of the row.\n return this.constants_.LARGE_PADDING;\n }\n\n // Spacing between a non-input and the end of the row or a statement input.\n if (!Types.isInput(prev) && (!next || Types.isStatementInput(next))) {\n // Between an editable field and the end of the row.\n if (Types.isField(prev) && (prev as Field).isEditable) {\n return this.constants_.MEDIUM_PADDING;\n }\n // Padding at the end of an icon-only row to make the block shape clearer.\n if (Types.isIcon(prev)) {\n return this.constants_.LARGE_PADDING * 2 + 1;\n }\n if (Types.isHat(prev)) {\n return this.constants_.NO_PADDING;\n }\n // Establish a minimum width for a block with a previous or next\n // connection.\n if (Types.isPreviousOrNextConnection(prev)) {\n return this.constants_.LARGE_PADDING;\n }\n // Between rounded corner and the end of the row.\n if (Types.isLeftRoundedCorner(prev)) {\n return this.constants_.MIN_BLOCK_WIDTH;\n }\n // Between a jagged edge and the end of the row.\n if (Types.isJaggedEdge(prev)) {\n return this.constants_.NO_PADDING;\n }\n // Between noneditable fields and icons and the end of the row.\n return this.constants_.LARGE_PADDING;\n }\n\n // Between inputs and the end of the row.\n if (Types.isInput(prev) && !next) {\n if (Types.isExternalInput(prev)) {\n return this.constants_.NO_PADDING;\n } else if (Types.isInlineInput(prev)) {\n return this.constants_.LARGE_PADDING;\n } else if (Types.isStatementInput(prev)) {\n return this.constants_.NO_PADDING;\n }\n }\n\n // Spacing between a non-input and an input.\n if (!Types.isInput(prev) && next && Types.isInput(next)) {\n // Between an editable field and an input.\n if (Types.isField(prev) && (prev as Field).isEditable) {\n if (Types.isInlineInput(next)) {\n return this.constants_.SMALL_PADDING;\n } else if (Types.isExternalInput(next)) {\n return this.constants_.SMALL_PADDING;\n }\n } else {\n if (Types.isInlineInput(next)) {\n return this.constants_.MEDIUM_LARGE_PADDING;\n } else if (Types.isExternalInput(next)) {\n return this.constants_.MEDIUM_LARGE_PADDING;\n } else if (Types.isStatementInput(next)) {\n return this.constants_.LARGE_PADDING;\n }\n }\n return this.constants_.LARGE_PADDING - 1;\n }\n\n // Spacing between an icon and an icon or field.\n if (Types.isIcon(prev) && next && !Types.isInput(next)) {\n return this.constants_.LARGE_PADDING;\n }\n // Spacing between an inline input and a field.\n if (Types.isInlineInput(prev) && next && Types.isField(next)) {\n // Editable field after inline input.\n if ((next as Field).isEditable) {\n return this.constants_.MEDIUM_PADDING;\n } else {\n // Noneditable field after inline input.\n return this.constants_.LARGE_PADDING;\n }\n }\n\n if (Types.isLeftSquareCorner(prev) && next) {\n // Spacing between a hat and a corner\n if (Types.isHat(next)) {\n return this.constants_.NO_PADDING;\n }\n // Spacing between a square corner and a previous or next connection\n if (Types.isPreviousConnection(next)) {\n return next.notchOffset;\n } else if (Types.isNextConnection(next)) {\n // Next connections are shifted slightly to the left (in both LTR and\n // RTL) to make the dark path under the previous connection show\n // through.\n const offset =\n (this.RTL ? 1 : -1) * this.constants_.DARK_PATH_OFFSET / 2;\n return next.notchOffset + offset;\n }\n }\n\n // Spacing between a rounded corner and a previous or next connection.\n if (Types.isLeftRoundedCorner(prev) && next) {\n if (Types.isPreviousConnection(next)) {\n return next.notchOffset - this.constants_.CORNER_RADIUS;\n } else if (Types.isNextConnection(next)) {\n // Next connections are shifted slightly to the left (in both LTR and\n // RTL) to make the dark path under the previous connection show\n // through.\n const offset =\n (this.RTL ? 1 : -1) * this.constants_.DARK_PATH_OFFSET / 2;\n return next.notchOffset - this.constants_.CORNER_RADIUS + offset;\n }\n }\n\n // Spacing between two fields of the same editability.\n if (Types.isField(prev) && next && Types.isField(next) &&\n (prev as Field).isEditable === (next as Field).isEditable) {\n return this.constants_.LARGE_PADDING;\n }\n\n // Spacing between anything and a jagged edge.\n if (next && Types.isJaggedEdge(next)) {\n return this.constants_.LARGE_PADDING;\n }\n\n return this.constants_.MEDIUM_PADDING;\n }\n\n override getSpacerRowHeight_(prev: Row, next: Row) {\n // If we have an empty block add a spacer to increase the height.\n if (Types.isTopRow(prev) && Types.isBottomRow(next)) {\n return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;\n }\n // Top and bottom rows act as a spacer so we don't need any extra padding.\n if (Types.isTopRow(prev) || Types.isBottomRow(next)) {\n return this.constants_.NO_PADDING;\n }\n if (prev.hasExternalInput && next.hasExternalInput) {\n return this.constants_.LARGE_PADDING;\n }\n if (!prev.hasStatement && next.hasStatement) {\n return this.constants_.BETWEEN_STATEMENT_PADDING_Y;\n }\n if (prev.hasStatement && next.hasStatement) {\n return this.constants_.LARGE_PADDING;\n }\n if (!prev.hasStatement && next.hasDummyInput) {\n return this.constants_.LARGE_PADDING;\n }\n if (prev.hasDummyInput) {\n return this.constants_.LARGE_PADDING;\n }\n return this.constants_.MEDIUM_PADDING;\n }\n\n override getElemCenterline_(row: Row, elem: Measurable) {\n if (Types.isSpacer(elem)) {\n return row.yPos + elem.height / 2;\n }\n if (Types.isBottomRow(row)) {\n const bottomRow = row as BottomRow;\n const baseline =\n bottomRow.yPos + bottomRow.height - bottomRow.descenderHeight;\n if (Types.isNextConnection(elem)) {\n return baseline + elem.height / 2;\n }\n return baseline - elem.height / 2;\n }\n if (Types.isTopRow(row)) {\n const topRow = row as TopRow;\n if (Types.isHat(elem)) {\n return topRow.capline - elem.height / 2;\n }\n return topRow.capline + elem.height / 2;\n }\n\n let result = row.yPos;\n if (Types.isField(elem) || Types.isIcon(elem)) {\n result += elem.height / 2;\n if ((row.hasInlineInput || row.hasStatement) &&\n elem.height + this.constants_.TALL_INPUT_FIELD_OFFSET_Y <=\n row.height) {\n result += this.constants_.TALL_INPUT_FIELD_OFFSET_Y;\n }\n } else if (Types.isInlineInput(elem)) {\n result += elem.height / 2;\n } else {\n result += row.height / 2;\n }\n return result;\n }\n\n override alignRowElements_() {\n if (!this.isInline) {\n super.alignRowElements_();\n return;\n }\n // Walk backgrounds through rows on the block, keeping track of the right\n // input edge.\n let nextRightEdge = 0;\n const rowNextRightEdges = new WeakMap();\n let prevInput = null;\n for (let i = this.rows.length - 1, row; row = this.rows[i]; i--) {\n rowNextRightEdges.set(row, nextRightEdge);\n if (Types.isInputRow(row)) {\n if (row.hasStatement) {\n this.alignStatementRow_(row as InputRow);\n }\n if (prevInput && prevInput.hasStatement &&\n row.width < prevInput.width) {\n rowNextRightEdges.set(row, prevInput.width);\n } else {\n nextRightEdge = row.width;\n }\n prevInput = row;\n }\n }\n // Walk down each row from the top, comparing the prev and next right input\n // edges and setting the desired width to the max of the two.\n let prevRightEdge = 0;\n for (let i = 0, row; row = this.rows[i]; i++) {\n if (row.hasStatement) {\n prevRightEdge = this.getDesiredRowWidth_(row);\n } else if (Types.isSpacer(row)) {\n // Set the spacer row to the max of the prev or next input width.\n row.width = Math.max(prevRightEdge, rowNextRightEdges.get(row));\n } else {\n const currentWidth = row.width;\n const desiredWidth =\n Math.max(prevRightEdge, rowNextRightEdges.get(row));\n const missingSpace = desiredWidth - currentWidth;\n if (missingSpace > 0) {\n this.addAlignmentPadding_(row, missingSpace);\n }\n prevRightEdge = row.width;\n }\n }\n }\n\n override getDesiredRowWidth_(row: Row) {\n // Limit the width of a statement row when a block is inline.\n if (this.isInline && row.hasStatement) {\n return this.statementEdge + this.constants_.MAX_BOTTOM_WIDTH +\n this.startX;\n }\n return super.getDesiredRowWidth_(row);\n }\n\n override finalize_() {\n // Performance note: this could be combined with the draw pass, if the time\n // that this takes is excessive. But it shouldn't be, because it only\n // accesses and sets properties that already exist on the objects.\n let widestRowWithConnectedBlocks = 0;\n let yCursor = 0;\n for (let i = 0, row; row = this.rows[i]; i++) {\n row.yPos = yCursor;\n row.xPos = this.startX;\n yCursor += row.height;\n\n widestRowWithConnectedBlocks =\n Math.max(widestRowWithConnectedBlocks, row.widthWithConnectedBlocks);\n // Add padding to the bottom row if block height is less than minimum\n const heightWithoutHat = yCursor - this.topRow.ascenderHeight;\n if (row === this.bottomRow &&\n heightWithoutHat < this.constants_.MIN_BLOCK_HEIGHT) {\n // But the hat height shouldn't be part of this.\n const diff = this.constants_.MIN_BLOCK_HEIGHT - heightWithoutHat;\n this.bottomRow.height += diff;\n yCursor += diff;\n }\n this.recordElemPositions_(row);\n }\n if (this.outputConnection && this.block_.nextConnection &&\n this.block_.nextConnection.isConnected()) {\n const target = this.block_.nextConnection.targetBlock();\n if (target) {\n // Include width of connected block in value to stack width measurement.\n widestRowWithConnectedBlocks = Math.max(\n widestRowWithConnectedBlocks,\n target.getHeightWidth().width - this.constants_.DARK_PATH_OFFSET);\n }\n }\n\n this.bottomRow.baseline = yCursor - this.bottomRow.descenderHeight;\n this.widthWithChildren = widestRowWithConnectedBlocks + this.startX +\n this.constants_.DARK_PATH_OFFSET;\n this.width += this.constants_.DARK_PATH_OFFSET;\n this.height = yCursor + this.constants_.DARK_PATH_OFFSET;\n this.startY = this.topRow.capline;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that owns a block's rendering SVG elements.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.PathObject');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {BlockStyle} from '../../theme.js';\nimport * as colour from '../../utils/colour.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\nimport {PathObject as BasePathObject} from '../common/path_object.js';\n\nimport type {ConstantProvider} from './constants.js';\n\n\n/**\n * An object that handles creating and setting each of the SVG elements\n * used by the renderer.\n *\n * @alias Blockly.geras.PathObject\n */\nexport class PathObject extends BasePathObject {\n /** @internal */\n svgPathDark: SVGElement;\n /** @internal */\n svgPathLight: SVGElement;\n\n /**\n * The colour of the dark path on the block in '#RRGGBB' format.\n *\n * @internal\n */\n colourDark = '#000000';\n\n /**\n * @param root The root SVG element.\n * @param style The style object to use for colouring.\n * @param constants The renderer's constants.\n * @internal\n */\n constructor(\n root: SVGElement, style: BlockStyle,\n public override constants: ConstantProvider) {\n super(root, style, constants);\n\n /** The dark path of the block. */\n this.svgPathDark = dom.createSvgElement(\n Svg.PATH, {'class': 'blocklyPathDark', 'transform': 'translate(1,1)'});\n // SVG draw order is based on the order of elements (top most = back most)\n // So we need to insert the dark path before the base path to make sure it\n // gets drawn first.\n this.svgRoot.insertBefore(this.svgPathDark, this.svgPath);\n\n /** The light path of the block. */\n this.svgPathLight = dom.createSvgElement(\n Svg.PATH, {'class': 'blocklyPathLight'}, this.svgRoot);\n }\n\n override setPath(mainPath: string) {\n this.svgPath.setAttribute('d', mainPath);\n this.svgPathDark.setAttribute('d', mainPath);\n }\n\n /**\n * Set the highlight path generated by the renderer onto the SVG element.\n *\n * @param highlightPath The highlight path.\n * @internal\n */\n setHighlightPath(highlightPath: string) {\n this.svgPathLight.setAttribute('d', highlightPath);\n }\n\n override flipRTL() {\n // Mirror the block's path.\n this.svgPath.setAttribute('transform', 'scale(-1 1)');\n this.svgPathLight.setAttribute('transform', 'scale(-1 1)');\n this.svgPathDark.setAttribute('transform', 'translate(1,1) scale(-1 1)');\n }\n\n override applyColour(block: BlockSvg) {\n this.svgPathLight.style.display = '';\n this.svgPathDark.style.display = '';\n if (!this.style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the tertiary colour of ' +\n 'the block style');\n }\n this.svgPathLight.setAttribute('stroke', this.style.colourTertiary);\n this.svgPathDark.setAttribute('fill', this.colourDark);\n\n super.applyColour(block);\n\n this.svgPath.setAttribute('stroke', 'none');\n }\n\n override setStyle(blockStyle: BlockStyle) {\n this.style = blockStyle;\n this.colourDark =\n colour.blend('#000', this.style.colourPrimary, 0.2) || this.colourDark;\n }\n\n override updateHighlighted(highlighted: boolean) {\n if (highlighted) {\n this.svgPath.setAttribute(\n 'filter', 'url(#' + this.constants.embossFilterId + ')');\n this.svgPathLight.style.display = 'none';\n } else {\n this.svgPath.setAttribute('filter', 'none');\n this.svgPathLight.style.display = 'inline';\n }\n }\n\n override updateShadow_(shadow: boolean) {\n if (shadow) {\n this.svgPathLight.style.display = 'none';\n if (!this.style.colourSecondary) {\n throw new Error(\n 'The renderer did not properly initialize the secondary colour ' +\n 'of the block style block style');\n }\n this.svgPathDark.setAttribute('fill', this.style.colourSecondary);\n this.svgPath.setAttribute('stroke', 'none');\n this.svgPath.setAttribute('fill', this.style.colourSecondary);\n }\n }\n\n override updateDisabled_(disabled: boolean) {\n super.updateDisabled_(disabled);\n if (disabled) {\n this.svgPath.setAttribute('stroke', 'none');\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Geras renderer.\n *\n * @class\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras.Renderer');\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {BlockStyle, Theme} from '../../theme.js';\nimport * as blockRendering from '../common/block_rendering.js';\nimport type {RenderInfo as BaseRenderInfo} from '../common/info.js';\nimport {Renderer as BaseRenderer} from '../common/renderer.js';\n\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {HighlightConstantProvider} from './highlight_constants.js';\nimport {RenderInfo} from './info.js';\nimport {PathObject} from './path_object.js';\n\n\n/**\n * The geras renderer.\n *\n * @alias Blockly.geras.Renderer\n */\nexport class Renderer extends BaseRenderer {\n /** The renderer's highlight constant provider. */\n private highlightConstants_: HighlightConstantProvider|null = null;\n\n /**\n * @param name The renderer name.\n * @internal\n */\n constructor(name: string) {\n super(name);\n }\n\n /**\n * Initialize the renderer. Geras has a highlight provider in addition to\n * the normal constant provider.\n *\n * @internal\n */\n override init(\n theme: Theme, opt_rendererOverrides?: {[rendererConstant: string]: any}) {\n super.init(theme, opt_rendererOverrides);\n this.highlightConstants_ = this.makeHighlightConstants_();\n this.highlightConstants_.init();\n }\n\n override refreshDom(svg: SVGElement, theme: Theme) {\n super.refreshDom(svg, theme);\n this.getHighlightConstants().init();\n }\n\n override makeConstants_() {\n return new ConstantProvider();\n }\n\n /**\n * Create a new instance of the renderer's render info object.\n *\n * @param block The block to measure.\n * @returns The render info object.\n */\n protected override makeRenderInfo_(block: BlockSvg): RenderInfo {\n return new RenderInfo(this, block);\n }\n\n /**\n * Create a new instance of the renderer's drawer.\n *\n * @param block The block to render.\n * @param info An object containing all information needed to render this\n * block.\n * @returns The drawer.\n */\n protected override makeDrawer_(block: BlockSvg, info: BaseRenderInfo):\n Drawer {\n return new Drawer(block, (info as RenderInfo));\n }\n\n /**\n * Create a new instance of a renderer path object.\n *\n * @param root The root SVG element.\n * @param style The style object to use for colouring.\n * @returns The renderer path object.\n * @internal\n */\n override makePathObject(root: SVGElement, style: BlockStyle): PathObject {\n return new PathObject(\n root, style, (this.getConstants() as ConstantProvider));\n }\n\n /**\n * Create a new instance of the renderer's highlight constant provider.\n *\n * @returns The highlight constant provider.\n */\n protected makeHighlightConstants_(): HighlightConstantProvider {\n return new HighlightConstantProvider((this.getConstants()));\n }\n\n /**\n * Get the renderer's highlight constant provider. We assume that when this\n * is called, the renderer has already been initialized.\n *\n * @returns The highlight constant provider.\n * @internal\n */\n getHighlightConstants(): HighlightConstantProvider {\n if (!this.highlightConstants_) {\n throw new Error(\n 'Cannot access the highlight constants because init has not ' +\n 'been called');\n }\n return this.highlightConstants_;\n }\n}\n\nblockRendering.register('geras', Renderer);\n","/** @file Re-exports of Blockly.geras.* modules. */\n\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Re-exports of Blockly.geras.* modules.\n *\n * @namespace Blockly.geras\n */\nimport * as goog from '../../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.geras');\n\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {HighlightConstantProvider} from './highlight_constants.js';\nimport {Highlighter} from './highlighter.js';\nimport {RenderInfo} from './info.js';\nimport {InlineInput} from './measurables/inline_input.js';\nimport {StatementInput} from './measurables/statement_input.js';\nimport {PathObject} from './path_object.js';\nimport {Renderer} from './renderer.js';\n\n\nexport {\n ConstantProvider,\n Drawer,\n HighlightConstantProvider,\n Highlighter,\n InlineInput,\n PathObject,\n Renderer,\n RenderInfo,\n StatementInput,\n};\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An SVG that floats on top of the workspace.\n * Blocks are moved into this SVG during a drag, improving performance.\n * The entire SVG is translated using CSS translation instead of SVG so the\n * blocks are never repainted during drag improving performance.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.WorkspaceDragSurfaceSvg');\n\nimport type {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\n\n\n/**\n * Blocks are moved into this SVG during a drag, improving performance.\n * The entire SVG is translated using CSS transforms instead of SVG so the\n * blocks are never repainted during drag improving performance.\n *\n * @alias Blockly.WorkspaceDragSurfaceSvg\n */\nexport class WorkspaceDragSurfaceSvg {\n /**\n * The SVG drag surface. Set once by WorkspaceDragSurfaceSvg.createDom.\n */\n private SVG!: SVGElement;\n\n /**\n * The element to insert the block canvas and bubble canvas after when it\n * goes back in the DOM at the end of a drag.\n */\n private previousSibling: Element|null = null;\n\n /** @param container Containing element. */\n constructor(private readonly container: Element) {\n this.createDom();\n }\n\n /** Create the drag surface and inject it into the container. */\n createDom() {\n if (this.SVG) {\n return; // Already created.\n }\n /**\n * Dom structure when the workspace is being dragged. If there is no drag in\n * progress, the SVG is empty and display: none.\n * <svg class=\"blocklyWsDragSurface\" style=transform:translate3d(...)>\n * <g class=\"blocklyBlockCanvas\"></g>\n * <g class=\"blocklyBubbleCanvas\">/g>\n * </svg>\n */\n this.SVG = dom.createSvgElement(Svg.SVG, {\n 'xmlns': dom.SVG_NS,\n 'xmlns:html': dom.HTML_NS,\n 'xmlns:xlink': dom.XLINK_NS,\n 'version': '1.1',\n 'class': 'blocklyWsDragSurface blocklyOverflowVisible',\n });\n this.container.appendChild(this.SVG);\n }\n\n /**\n * Translate the entire drag surface during a drag.\n * We translate the drag surface instead of the blocks inside the surface\n * so that the browser avoids repainting the SVG.\n * Because of this, the drag coordinates must be adjusted by scale.\n *\n * @param x X translation for the entire surface\n * @param y Y translation for the entire surface\n * @internal\n */\n translateSurface(x: number, y: number) {\n // Make sure the svg exists on a pixel boundary so that it is not fuzzy.\n const fixedX = Math.round(x);\n const fixedY = Math.round(y);\n\n this.SVG.style.display = 'block';\n dom.setCssTransform(\n this.SVG, 'translate3d(' + fixedX + 'px, ' + fixedY + 'px, 0)');\n }\n\n /**\n * Reports the surface translation in scaled workspace coordinates.\n * Use this when finishing a drag to return blocks to the correct position.\n *\n * @returns Current translation of the surface\n * @internal\n */\n getSurfaceTranslation(): Coordinate {\n return svgMath.getRelativeXY((this.SVG));\n }\n\n /**\n * Move the blockCanvas and bubbleCanvas out of the surface SVG and on to\n * newSurface.\n *\n * @param newSurface The element to put the drag surface contents into.\n * @internal\n */\n clearAndHide(newSurface: SVGElement) {\n if (!newSurface) {\n throw Error(\n 'Couldn\\'t clear and hide the drag surface: missing new surface.');\n }\n const blockCanvas = this.SVG.childNodes[0] as Element;\n const bubbleCanvas = this.SVG.childNodes[1] as Element;\n if (!blockCanvas || !bubbleCanvas ||\n !(blockCanvas.classList.contains('blocklyBlockCanvas') ||\n !bubbleCanvas.classList.contains('blocklyBubbleCanvas'))) {\n throw Error(\n 'Couldn\\'t clear and hide the drag surface. A node was missing.');\n }\n\n // If there is a previous sibling, put the blockCanvas back right\n // afterwards, otherwise insert it as the first child node in newSurface.\n if (this.previousSibling !== null) {\n dom.insertAfter(blockCanvas, this.previousSibling);\n } else {\n newSurface.insertBefore(blockCanvas, newSurface.firstChild);\n }\n\n // Reattach the bubble canvas after the blockCanvas.\n dom.insertAfter(bubbleCanvas, blockCanvas);\n // Hide the drag surface.\n this.SVG.style.display = 'none';\n if (this.SVG.childNodes.length) {\n throw Error('Drag surface was not cleared.');\n }\n dom.setCssTransform(this.SVG, '');\n this.previousSibling = null;\n }\n\n /**\n * Set the SVG to have the block canvas and bubble canvas in it and then\n * show the surface.\n *\n * @param blockCanvas The block canvas <g> element from the\n * workspace.\n * @param bubbleCanvas The <g> element that contains the\n bubbles.\n * @param previousSibling The element to insert the block canvas and\n bubble canvas after when it goes back in the DOM at the end of a\n drag.\n * @param width The width of the workspace SVG element.\n * @param height The height of the workspace SVG element.\n * @param scale The scale of the workspace being dragged.\n * @internal\n */\n setContentsAndShow(\n blockCanvas: SVGElement, bubbleCanvas: SVGElement,\n previousSibling: Element, width: number, height: number, scale: number) {\n if (this.SVG.childNodes.length) {\n throw Error('Already dragging a block.');\n }\n this.previousSibling = previousSibling;\n // Make sure the blocks and bubble canvas are scaled appropriately.\n blockCanvas.setAttribute(\n 'transform', 'translate(0, 0) scale(' + scale + ')');\n bubbleCanvas.setAttribute(\n 'transform', 'translate(0, 0) scale(' + scale + ')');\n this.SVG.setAttribute('width', String(width));\n this.SVG.setAttribute('height', String(height));\n this.SVG.appendChild(blockCanvas);\n this.SVG.appendChild(bubbleCanvas);\n this.SVG.style.display = 'block';\n }\n}\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A class that manages a surface for dragging blocks. When a\n * block drag is started, we move the block (and children) to a separate DOM\n * element that we move around using translate3d. At the end of the drag, the\n * blocks are put back in into the SVG they came from. This helps\n * performance by avoiding repainting the entire SVG on every mouse move\n * while dragging blocks.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.BlockDragSurfaceSvg');\n\nimport {Coordinate} from './utils/coordinate.js';\nimport * as deprecation from './utils/deprecation.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport * as svgMath from './utils/svg_math.js';\n\n\n/**\n * Class for a drag surface for the currently dragged block. This is a separate\n * SVG that contains only the currently moving block, or nothing.\n *\n * @alias Blockly.BlockDragSurfaceSvg\n */\nexport class BlockDragSurfaceSvg {\n /** The SVG drag surface. Set once by BlockDragSurfaceSvg.createDom. */\n private svg_: SVGElement;\n\n /**\n * This is where blocks live while they are being dragged if the drag\n * surface is enabled.\n */\n private dragGroup_: SVGElement;\n\n /**\n * Cached value for the scale of the drag surface.\n * Used to set/get the correct translation during and after a drag.\n */\n private scale_ = 1;\n\n /**\n * Cached value for the translation of the drag surface.\n * This translation is in pixel units, because the scale is applied to the\n * drag group rather than the top-level SVG.\n */\n private surfaceXY_: Coordinate = new Coordinate(0, 0);\n private readonly childSurfaceXY_: Coordinate;\n\n /** @param container Containing element. */\n constructor(private readonly container: Element) {\n /**\n * Cached value for the translation of the child drag surface in pixel\n * units. Since the child drag surface tracks the translation of the\n * workspace this is ultimately the translation of the workspace.\n */\n this.childSurfaceXY_ = new Coordinate(0, 0);\n\n this.svg_ = dom.createSvgElement(\n Svg.SVG, {\n 'xmlns': dom.SVG_NS,\n 'xmlns:html': dom.HTML_NS,\n 'xmlns:xlink': dom.XLINK_NS,\n 'version': '1.1',\n 'class': 'blocklyBlockDragSurface',\n },\n this.container);\n this.dragGroup_ = dom.createSvgElement(Svg.G, {}, this.svg_ as SVGElement);\n }\n\n /**\n * Create the drag surface and inject it into the container.\n *\n * @deprecated The DOM is automatically created by the constructor.\n */\n createDom() {\n // No alternative provided, because now the dom is just automatically\n // created in the constructor now.\n deprecation.warn('BlockDragSurfaceSvg createDom', 'June 2022', 'June 2023');\n }\n\n /**\n * Set the SVG blocks on the drag surface's group and show the surface.\n * Only one block group should be on the drag surface at a time.\n *\n * @param blocks Block or group of blocks to place on the drag surface.\n */\n setBlocksAndShow(blocks: SVGElement) {\n if (this.dragGroup_.childNodes.length) {\n throw Error('Already dragging a block.');\n }\n // appendChild removes the blocks from the previous parent\n this.dragGroup_.appendChild(blocks);\n this.svg_.style.display = 'block';\n this.surfaceXY_ = new Coordinate(0, 0);\n }\n\n /**\n * Translate and scale the entire drag surface group to the given position, to\n * keep in sync with the workspace.\n *\n * @param x X translation in pixel coordinates.\n * @param y Y translation in pixel coordinates.\n * @param scale Scale of the group.\n */\n translateAndScaleGroup(x: number, y: number, scale: number) {\n this.scale_ = scale;\n // Make sure the svg exists on a pixel boundary so that it is not fuzzy.\n const roundX = Math.round(x);\n const roundY = Math.round(y);\n this.childSurfaceXY_.x = roundX;\n this.childSurfaceXY_.y = roundY;\n this.dragGroup_!.setAttribute(\n 'transform',\n 'translate(' + roundX + ',' + roundY + ') scale(' + scale + ')');\n }\n\n /**\n * Translate the drag surface's SVG based on its internal state.\n *\n * @internal\n */\n translateSurfaceInternal_() {\n let x = this.surfaceXY_!.x;\n let y = this.surfaceXY_!.y;\n // Make sure the svg exists on a pixel boundary so that it is not fuzzy.\n x = Math.round(x);\n y = Math.round(y);\n this.svg_.style.display = 'block';\n dom.setCssTransform(this.svg_, 'translate3d(' + x + 'px, ' + y + 'px, 0)');\n }\n\n /**\n * Translates the entire surface by a relative offset.\n *\n * @param deltaX Horizontal offset in pixel units.\n * @param deltaY Vertical offset in pixel units.\n */\n translateBy(deltaX: number, deltaY: number) {\n const x = this.surfaceXY_.x + deltaX;\n const y = this.surfaceXY_.y + deltaY;\n this.surfaceXY_ = new Coordinate(x, y);\n this.translateSurfaceInternal_();\n }\n\n /**\n * Translate the entire drag surface during a drag.\n * We translate the drag surface instead of the blocks inside the surface\n * so that the browser avoids repainting the SVG.\n * Because of this, the drag coordinates must be adjusted by scale.\n *\n * @param x X translation for the entire surface.\n * @param y Y translation for the entire surface.\n */\n translateSurface(x: number, y: number) {\n this.surfaceXY_ = new Coordinate(x * this.scale_, y * this.scale_);\n this.translateSurfaceInternal_();\n }\n\n /**\n * Reports the surface translation in scaled workspace coordinates.\n * Use this when finishing a drag to return blocks to the correct position.\n *\n * @returns Current translation of the surface.\n */\n getSurfaceTranslation(): Coordinate {\n const xy = svgMath.getRelativeXY(this.svg_ as SVGElement);\n return new Coordinate(xy.x / this.scale_, xy.y / this.scale_);\n }\n\n /**\n * Provide a reference to the drag group (primarily for\n * BlockSvg.getRelativeToSurfaceXY).\n *\n * @returns Drag surface group element.\n */\n getGroup(): SVGElement|null {\n return this.dragGroup_;\n }\n\n /**\n * Returns the SVG drag surface.\n *\n * @returns The SVG drag surface.\n */\n getSvgRoot(): SVGElement|null {\n return this.svg_;\n }\n\n /**\n * Get the current blocks on the drag surface, if any (primarily\n * for BlockSvg.getRelativeToSurfaceXY).\n *\n * @returns Drag surface block DOM element, or null if no blocks exist.\n */\n getCurrentBlock(): Element|null {\n return this.dragGroup_.firstChild as Element;\n }\n\n /**\n * Gets the translation of the child block surface\n * This surface is in charge of keeping track of how much the workspace has\n * moved.\n *\n * @returns The amount the workspace has been moved.\n */\n getWsTranslation(): Coordinate {\n // Returning a copy so the coordinate can not be changed outside this class.\n return this.childSurfaceXY_.clone();\n }\n\n /**\n * Clear the group and hide the surface; move the blocks off onto the provided\n * element.\n * If the block is being deleted it doesn't need to go back to the original\n * surface, since it would be removed immediately during dispose.\n *\n * @param opt_newSurface Surface the dragging blocks should be moved to, or\n * null if the blocks should be removed from this surface without being\n * moved to a different surface.\n */\n clearAndHide(opt_newSurface?: Element) {\n const currentBlockElement = this.getCurrentBlock();\n if (currentBlockElement) {\n if (opt_newSurface) {\n // appendChild removes the node from this.dragGroup_\n opt_newSurface.appendChild(currentBlockElement);\n } else {\n this.dragGroup_.removeChild(currentBlockElement);\n }\n }\n this.svg_.style.display = 'none';\n if (this.dragGroup_.childNodes.length) {\n throw Error('Drag group was not cleared.');\n }\n this.surfaceXY_ = new Coordinate(0, 0);\n }\n}\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Object representing a pair of scrollbars.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.ScrollbarPair');\n\nimport * as eventUtils from './events/utils.js';\nimport {Scrollbar} from './scrollbar.js';\nimport * as dom from './utils/dom.js';\nimport type {Metrics} from './utils/metrics.js';\nimport {Svg} from './utils/svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a pair of scrollbars. Horizontal and vertical.\n *\n * @alias Blockly.ScrollbarPair\n */\nexport class ScrollbarPair {\n hScroll: Scrollbar|null = null;\n vScroll: Scrollbar|null = null;\n corner_: SVGRectElement|null = null;\n\n /** Previously recorded metrics from the workspace. */\n private oldHostMetrics_: Metrics|null = null;\n\n /**\n * @param workspace Workspace to bind the scrollbars to.\n * @param addHorizontal Whether to add a horizontal scrollbar.\n * Defaults to true.\n * @param addVertical Whether to add a vertical scrollbar. Defaults to true.\n * @param opt_class A class to be applied to these scrollbars.\n * @param opt_margin The margin to apply to these scrollbars.\n */\n constructor(\n private workspace: WorkspaceSvg, addHorizontal?: boolean,\n addVertical?: boolean, opt_class?: string, opt_margin?: number) {\n addHorizontal = addHorizontal === undefined ? true : addHorizontal;\n addVertical = addVertical === undefined ? true : addVertical;\n const isPair = addHorizontal && addVertical;\n\n if (addHorizontal) {\n this.hScroll =\n new Scrollbar(workspace, true, isPair, opt_class, opt_margin);\n }\n if (addVertical) {\n this.vScroll =\n new Scrollbar(workspace, false, isPair, opt_class, opt_margin);\n }\n\n if (isPair) {\n this.corner_ = dom.createSvgElement(Svg.RECT, {\n 'height': Scrollbar.scrollbarThickness,\n 'width': Scrollbar.scrollbarThickness,\n 'class': 'blocklyScrollbarBackground',\n });\n dom.insertAfter(this.corner_, workspace.getBubbleCanvas());\n }\n }\n\n /**\n * Dispose of this pair of scrollbars.\n * Unlink from all DOM elements to prevent memory leaks.\n *\n * @suppress {checkTypes}\n */\n dispose() {\n dom.removeNode(this.corner_);\n this.corner_ = null;\n this.oldHostMetrics_ = null;\n if (this.hScroll) {\n this.hScroll.dispose();\n this.hScroll = null;\n }\n if (this.vScroll) {\n this.vScroll.dispose();\n this.vScroll = null;\n }\n }\n\n /**\n * Recalculate both of the scrollbars' locations and lengths.\n * Also reposition the corner rectangle.\n */\n resize() {\n // Look up the host metrics once, and use for both scrollbars.\n const hostMetrics = this.workspace.getMetrics();\n if (!hostMetrics) {\n // Host element is likely not visible.\n return;\n }\n\n // Only change the scrollbars if there has been a change in metrics.\n let resizeH = false;\n let resizeV = false;\n if (!this.oldHostMetrics_ ||\n this.oldHostMetrics_.viewWidth !== hostMetrics.viewWidth ||\n this.oldHostMetrics_.viewHeight !== hostMetrics.viewHeight ||\n this.oldHostMetrics_.absoluteTop !== hostMetrics.absoluteTop ||\n this.oldHostMetrics_.absoluteLeft !== hostMetrics.absoluteLeft) {\n // The window has been resized or repositioned.\n resizeH = true;\n resizeV = true;\n } else {\n // Has the content been resized or moved?\n if (!this.oldHostMetrics_ ||\n this.oldHostMetrics_.scrollWidth !== hostMetrics.scrollWidth ||\n this.oldHostMetrics_.viewLeft !== hostMetrics.viewLeft ||\n this.oldHostMetrics_.scrollLeft !== hostMetrics.scrollLeft) {\n resizeH = true;\n }\n if (!this.oldHostMetrics_ ||\n this.oldHostMetrics_.scrollHeight !== hostMetrics.scrollHeight ||\n this.oldHostMetrics_.viewTop !== hostMetrics.viewTop ||\n this.oldHostMetrics_.scrollTop !== hostMetrics.scrollTop) {\n resizeV = true;\n }\n }\n\n if (resizeH || resizeV) {\n try {\n eventUtils.disable();\n if (this.hScroll && resizeH) {\n this.hScroll.resize(hostMetrics);\n }\n if (this.vScroll && resizeV) {\n this.vScroll.resize(hostMetrics);\n }\n } finally {\n eventUtils.enable();\n }\n this.workspace.maybeFireViewportChangeEvent();\n }\n\n if (this.hScroll && this.vScroll) {\n // Reposition the corner square.\n if (!this.oldHostMetrics_ ||\n this.oldHostMetrics_.viewWidth !== hostMetrics.viewWidth ||\n this.oldHostMetrics_.absoluteLeft !== hostMetrics.absoluteLeft) {\n this.corner_?.setAttribute('x', String(this.vScroll.position.x));\n }\n if (!this.oldHostMetrics_ ||\n this.oldHostMetrics_.viewHeight !== hostMetrics.viewHeight ||\n this.oldHostMetrics_.absoluteTop !== hostMetrics.absoluteTop) {\n this.corner_?.setAttribute('y', String(this.hScroll.position.y));\n }\n }\n\n // Cache the current metrics to potentially short-cut the next resize event.\n this.oldHostMetrics_ = hostMetrics;\n }\n\n /**\n * Returns whether scrolling horizontally is enabled.\n *\n * @returns True if horizontal scroll is enabled.\n */\n canScrollHorizontally(): boolean {\n return !!this.hScroll;\n }\n\n /**\n * Returns whether scrolling vertically is enabled.\n *\n * @returns True if vertical scroll is enabled.\n */\n canScrollVertically(): boolean {\n return !!this.vScroll;\n }\n\n /**\n * Record the origin of the workspace that the scrollbar is in, in pixels\n * relative to the injection div origin. This is for times when the scrollbar\n * is used in an object whose origin isn't the same as the main workspace\n * (e.g. in a flyout.)\n *\n * @param x The x coordinate of the scrollbar's origin, in CSS pixels.\n * @param y The y coordinate of the scrollbar's origin, in CSS pixels.\n * @internal\n */\n setOrigin(x: number, y: number) {\n if (this.hScroll) {\n this.hScroll.setOrigin(x, y);\n }\n if (this.vScroll) {\n this.vScroll.setOrigin(x, y);\n }\n }\n\n /**\n * Set the handles of both scrollbars.\n *\n * @param x The horizontal content displacement, relative to the view in\n * pixels.\n * @param y The vertical content displacement, relative to the view in pixels.\n * @param updateMetrics Whether to update metrics on this set call.\n * Defaults to true.\n */\n set(x: number, y: number, updateMetrics: boolean) {\n // This function is equivalent to:\n // this.hScroll.set(x);\n // this.vScroll.set(y);\n // However, that calls setMetrics twice which causes a chain of\n // getAttribute->setAttribute->getAttribute resulting in an extra layout\n // pass. Combining them speeds up rendering.\n if (this.hScroll) {\n this.hScroll.set(x, false);\n }\n if (this.vScroll) {\n this.vScroll.set(y, false);\n }\n\n if (updateMetrics || updateMetrics === undefined) {\n // Update metrics.\n const xyRatio: {x?: number, y?: number} = {};\n if (this.hScroll) {\n xyRatio.x = this.hScroll.getRatio_();\n }\n if (this.vScroll) {\n xyRatio.y = this.vScroll.getRatio_();\n }\n this.workspace.setMetrics(xyRatio);\n }\n }\n\n /**\n * Set the handle of the horizontal scrollbar to be at a certain position in\n * CSS pixels relative to its parents.\n *\n * @param x Horizontal scroll value.\n */\n setX(x: number) {\n if (this.hScroll) {\n this.hScroll.set(x, true);\n }\n }\n\n /**\n * Set the handle of the vertical scrollbar to be at a certain position in\n * CSS pixels relative to its parents.\n *\n * @param y Vertical scroll value.\n */\n setY(y: number) {\n if (this.vScroll) {\n this.vScroll.set(y, true);\n }\n }\n\n /**\n * Set whether this scrollbar's container is visible.\n *\n * @param visible Whether the container is visible.\n */\n setContainerVisible(visible: boolean) {\n if (this.hScroll) {\n this.hScroll.setContainerVisible(visible);\n }\n if (this.vScroll) {\n this.vScroll.setContainerVisible(visible);\n }\n }\n\n /**\n * If any of the scrollbars are visible. Non-paired scrollbars may disappear\n * when they aren't needed.\n *\n * @returns True if visible.\n */\n isVisible(): boolean {\n let isVisible = false;\n if (this.hScroll) {\n isVisible = this.hScroll.isVisible();\n }\n if (this.vScroll) {\n isVisible = isVisible || this.vScroll.isVisible();\n }\n return isVisible;\n }\n\n /**\n * Recalculates the scrollbars' locations within their path and length.\n * This should be called when the contents of the workspace have changed.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n resizeContent(hostMetrics: Metrics) {\n if (this.hScroll) {\n this.hScroll.resizeContentHorizontal(hostMetrics);\n }\n if (this.vScroll) {\n this.vScroll.resizeContentVertical(hostMetrics);\n }\n }\n\n /**\n * Recalculates the scrollbars' locations on the screen and path length.\n * This should be called when the layout or size of the window has changed.\n *\n * @param hostMetrics A data structure describing all the required dimensions,\n * possibly fetched from the host object.\n */\n resizeView(hostMetrics: Metrics) {\n if (this.hScroll) {\n this.hScroll.resizeViewHorizontal(hostMetrics);\n }\n if (this.vScroll) {\n this.vScroll.resizeViewVertical(hostMetrics);\n }\n }\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Utility functions for generating executable code from\n * Blockly code.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Generator');\n\nimport type {Block} from './block.js';\nimport * as common from './common.js';\nimport {Names, NameType} from './names.js';\nimport * as deprecation from './utils/deprecation.js';\nimport type {Workspace} from './workspace.js';\n\n\n/**\n * Class for a code generator that translates the blocks into a language.\n *\n * @unrestricted\n * @alias Blockly.Generator\n */\nexport class Generator {\n name_: string;\n\n /**\n * This is used as a placeholder in functions defined using\n * Generator.provideFunction_. It must not be legal code that could\n * legitimately appear in a function definition (or comment), and it must\n * not confuse the regular expression parser.\n */\n protected FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}';\n FUNCTION_NAME_PLACEHOLDER_REGEXP_: RegExp;\n\n /**\n * Arbitrary code to inject into locations that risk causing infinite loops.\n * Any instances of '%1' will be replaced by the block ID that failed.\n * E.g. ` checkTimeout(%1);\\n`\n */\n INFINITE_LOOP_TRAP: string|null = null;\n\n /**\n * Arbitrary code to inject before every statement.\n * Any instances of '%1' will be replaced by the block ID of the statement.\n * E.g. `highlight(%1);\\n`\n */\n STATEMENT_PREFIX: string|null = null;\n\n /**\n * Arbitrary code to inject after every statement.\n * Any instances of '%1' will be replaced by the block ID of the statement.\n * E.g. `highlight(%1);\\n`\n */\n STATEMENT_SUFFIX: string|null = null;\n\n /**\n * The method of indenting. Defaults to two spaces, but language generators\n * may override this to increase indent or change to tabs.\n */\n INDENT = ' ';\n\n /**\n * Maximum length for a comment before wrapping. Does not account for\n * indenting level.\n */\n COMMENT_WRAP = 60;\n\n /** List of outer-inner pairings that do NOT require parentheses. */\n ORDER_OVERRIDES: number[][] = [];\n\n /**\n * Whether the init method has been called.\n * Generators that set this flag to false after creation and true in init\n * will cause blockToCode to emit a warning if the generator has not been\n * initialized. If this flag is untouched, it will have no effect.\n */\n isInitialized: boolean|null = null;\n\n /** Comma-separated list of reserved words. */\n protected RESERVED_WORDS_ = '';\n\n /** A dictionary of definitions to be printed before the code. */\n protected definitions_: {[key: string]: string} = Object.create(null);\n\n /**\n * A dictionary mapping desired function names in definitions_ to actual\n * function names (to avoid collisions with user functions).\n */\n protected functionNames_: {[key: string]: string} = Object.create(null);\n\n /** A database of variable and procedure names. */\n protected nameDB_?: Names = undefined;\n\n /** @param name Language name of this generator. */\n constructor(name: string) {\n this.name_ = name;\n\n this.FUNCTION_NAME_PLACEHOLDER_REGEXP_ =\n new RegExp(this.FUNCTION_NAME_PLACEHOLDER_, 'g');\n }\n\n /**\n * Generate code for all blocks in the workspace to the specified language.\n *\n * @param workspace Workspace to generate code from.\n * @returns Generated code.\n */\n workspaceToCode(workspace?: Workspace): string {\n if (!workspace) {\n // Backwards compatibility from before there could be multiple workspaces.\n console.warn(\n 'No workspace specified in workspaceToCode call. Guessing.');\n workspace = common.getMainWorkspace();\n }\n const code = [];\n this.init(workspace);\n const blocks = workspace.getTopBlocks(true);\n for (let i = 0, block; block = blocks[i]; i++) {\n let line = this.blockToCode(block);\n if (Array.isArray(line)) {\n // Value blocks return tuples of code and operator order.\n // Top-level blocks don't care about operator order.\n line = line[0];\n }\n if (line) {\n if (block.outputConnection) {\n // This block is a naked value. Ask the language's code generator if\n // it wants to append a semicolon, or something.\n line = this.scrubNakedValue(line);\n if (this.STATEMENT_PREFIX && !block.suppressPrefixSuffix) {\n line = this.injectId(this.STATEMENT_PREFIX, block) + line;\n }\n if (this.STATEMENT_SUFFIX && !block.suppressPrefixSuffix) {\n line = line + this.injectId(this.STATEMENT_SUFFIX, block);\n }\n }\n code.push(line);\n }\n }\n // Blank line between each section.\n let codeString = code.join('\\n');\n codeString = this.finish(codeString);\n // Final scrubbing of whitespace.\n codeString = codeString.replace(/^\\s+\\n/, '');\n codeString = codeString.replace(/\\n\\s+$/, '\\n');\n codeString = codeString.replace(/[ \\t]+\\n/g, '\\n');\n return codeString;\n }\n\n // The following are some helpful functions which can be used by multiple\n\n // languages.\n\n /**\n * Prepend a common prefix onto each line of code.\n * Intended for indenting code or adding comment markers.\n *\n * @param text The lines of code.\n * @param prefix The common prefix.\n * @returns The prefixed lines of code.\n */\n prefixLines(text: string, prefix: string): string {\n return prefix + text.replace(/(?!\\n$)\\n/g, '\\n' + prefix);\n }\n\n /**\n * Recursively spider a tree of blocks, returning all their comments.\n *\n * @param block The block from which to start spidering.\n * @returns Concatenated list of comments.\n */\n allNestedComments(block: Block): string {\n const comments = [];\n const blocks = block.getDescendants(true);\n for (let i = 0; i < blocks.length; i++) {\n const comment = blocks[i].getCommentText();\n if (comment) {\n comments.push(comment);\n }\n }\n // Append an empty string to create a trailing line break when joined.\n if (comments.length) {\n comments.push('');\n }\n return comments.join('\\n');\n }\n\n /**\n * Generate code for the specified block (and attached blocks).\n * The generator must be initialized before calling this function.\n *\n * @param block The block to generate code for.\n * @param opt_thisOnly True to generate code for only this statement.\n * @returns For statement blocks, the generated code.\n * For value blocks, an array containing the generated code and an\n * operator order value. Returns '' if block is null.\n */\n blockToCode(block: Block|null, opt_thisOnly?: boolean): string\n |[string, number] {\n if (this.isInitialized === false) {\n console.warn(\n 'Generator init was not called before blockToCode was called.');\n }\n if (!block) {\n return '';\n }\n if (!block.isEnabled()) {\n // Skip past this block if it is disabled.\n return opt_thisOnly ? '' : this.blockToCode(block.getNextBlock());\n }\n if (block.isInsertionMarker()) {\n // Skip past insertion markers.\n return opt_thisOnly ? '' : this.blockToCode(block.getChildren(false)[0]);\n }\n\n const func = (this as any)[block.type];\n if (typeof func !== 'function') {\n throw Error(\n 'Language \"' + this.name_ + '\" does not know how to generate ' +\n 'code for block type \"' + block.type + '\".');\n }\n // First argument to func.call is the value of 'this' in the generator.\n // Prior to 24 September 2013 'this' was the only way to access the block.\n // The current preferred method of accessing the block is through the second\n // argument to func.call, which becomes the first parameter to the\n // generator.\n let code = func.call(block, block);\n if (Array.isArray(code)) {\n // Value blocks return tuples of code and operator order.\n if (!block.outputConnection) {\n throw TypeError('Expecting string from statement block: ' + block.type);\n }\n return [this.scrub_(block, code[0], opt_thisOnly), code[1]];\n } else if (typeof code === 'string') {\n if (this.STATEMENT_PREFIX && !block.suppressPrefixSuffix) {\n code = this.injectId(this.STATEMENT_PREFIX, block) + code;\n }\n if (this.STATEMENT_SUFFIX && !block.suppressPrefixSuffix) {\n code = code + this.injectId(this.STATEMENT_SUFFIX, block);\n }\n return this.scrub_(block, code, opt_thisOnly);\n } else if (code === null) {\n // Block has handled code generation itself.\n return '';\n }\n throw SyntaxError('Invalid code generated: ' + code);\n }\n\n /**\n * Generate code representing the specified value input.\n *\n * @param block The block containing the input.\n * @param name The name of the input.\n * @param outerOrder The maximum binding strength (minimum order value) of any\n * operators adjacent to \"block\".\n * @returns Generated code or '' if no blocks are connected or the specified\n * input does not exist.\n */\n valueToCode(block: Block, name: string, outerOrder: number): string {\n if (isNaN(outerOrder)) {\n throw TypeError('Expecting valid order from block: ' + block.type);\n }\n const targetBlock = block.getInputTargetBlock(name);\n if (!targetBlock) {\n return '';\n }\n const tuple = this.blockToCode(targetBlock);\n if (tuple === '') {\n // Disabled block.\n return '';\n }\n // Value blocks must return code and order of operations info.\n // Statement blocks must only return code.\n if (!Array.isArray(tuple)) {\n throw TypeError('Expecting tuple from value block: ' + targetBlock.type);\n }\n let code = tuple[0];\n const innerOrder = tuple[1];\n if (isNaN(innerOrder)) {\n throw TypeError(\n 'Expecting valid order from value block: ' + targetBlock.type);\n }\n if (!code) {\n return '';\n }\n\n // Add parentheses if needed.\n let parensNeeded = false;\n const outerOrderClass = Math.floor(outerOrder);\n const innerOrderClass = Math.floor(innerOrder);\n if (outerOrderClass <= innerOrderClass) {\n if (outerOrderClass === innerOrderClass &&\n (outerOrderClass === 0 || outerOrderClass === 99)) {\n // Don't generate parens around NONE-NONE and ATOMIC-ATOMIC pairs.\n // 0 is the atomic order, 99 is the none order. No parentheses needed.\n // In all known languages multiple such code blocks are not order\n // sensitive. In fact in Python ('a' 'b') 'c' would fail.\n } else {\n // The operators outside this code are stronger than the operators\n // inside this code. To prevent the code from being pulled apart,\n // wrap the code in parentheses.\n parensNeeded = true;\n // Check for special exceptions.\n for (let i = 0; i < this.ORDER_OVERRIDES.length; i++) {\n if (this.ORDER_OVERRIDES[i][0] === outerOrder &&\n this.ORDER_OVERRIDES[i][1] === innerOrder) {\n parensNeeded = false;\n break;\n }\n }\n }\n }\n if (parensNeeded) {\n // Technically, this should be handled on a language-by-language basis.\n // However all known (sane) languages use parentheses for grouping.\n code = '(' + code + ')';\n }\n return code;\n }\n\n /**\n * Generate a code string representing the blocks attached to the named\n * statement input. Indent the code.\n * This is mainly used in generators. When trying to generate code to evaluate\n * look at using workspaceToCode or blockToCode.\n *\n * @param block The block containing the input.\n * @param name The name of the input.\n * @returns Generated code or '' if no blocks are connected.\n */\n statementToCode(block: Block, name: string): string {\n const targetBlock = block.getInputTargetBlock(name);\n let code = this.blockToCode(targetBlock);\n // Value blocks must return code and order of operations info.\n // Statement blocks must only return code.\n if (typeof code !== 'string') {\n throw TypeError(\n 'Expecting code from statement block: ' +\n (targetBlock && targetBlock.type));\n }\n if (code) {\n code = this.prefixLines((code), this.INDENT);\n }\n return code;\n }\n\n /**\n * Add an infinite loop trap to the contents of a loop.\n * Add statement suffix at the start of the loop block (right after the loop\n * statement executes), and a statement prefix to the end of the loop block\n * (right before the loop statement executes).\n *\n * @param branch Code for loop contents.\n * @param block Enclosing block.\n * @returns Loop contents, with infinite loop trap added.\n */\n addLoopTrap(branch: string, block: Block): string {\n if (this.INFINITE_LOOP_TRAP) {\n branch = this.prefixLines(\n this.injectId(this.INFINITE_LOOP_TRAP, block), this.INDENT) +\n branch;\n }\n if (this.STATEMENT_SUFFIX && !block.suppressPrefixSuffix) {\n branch = this.prefixLines(\n this.injectId(this.STATEMENT_SUFFIX, block), this.INDENT) +\n branch;\n }\n if (this.STATEMENT_PREFIX && !block.suppressPrefixSuffix) {\n branch = branch +\n this.prefixLines(\n this.injectId(this.STATEMENT_PREFIX, block), this.INDENT);\n }\n return branch;\n }\n\n /**\n * Inject a block ID into a message to replace '%1'.\n * Used for STATEMENT_PREFIX, STATEMENT_SUFFIX, and INFINITE_LOOP_TRAP.\n *\n * @param msg Code snippet with '%1'.\n * @param block Block which has an ID.\n * @returns Code snippet with ID.\n */\n injectId(msg: string, block: Block): string {\n const id = block.id.replace(/\\$/g, '$$$$'); // Issue 251.\n return msg.replace(/%1/g, '\\'' + id + '\\'');\n }\n\n /**\n * Add one or more words to the list of reserved words for this language.\n *\n * @param words Comma-separated list of words to add to the list.\n * No spaces. Duplicates are ok.\n */\n addReservedWords(words: string) {\n this.RESERVED_WORDS_ += words + ',';\n }\n\n /**\n * Define a developer-defined function (not a user-defined procedure) to be\n * included in the generated code. Used for creating private helper\n * functions. The first time this is called with a given desiredName, the code\n * is saved and an actual name is generated. Subsequent calls with the same\n * desiredName have no effect but have the same return value.\n *\n * It is up to the caller to make sure the same desiredName is not\n * used for different helper functions (e.g. use \"colourRandom\" and\n * \"listRandom\", not \"random\"). There is no danger of colliding with reserved\n * words, or user-defined variable or procedure names.\n *\n * The code gets output when Generator.finish() is called.\n *\n * @param desiredName The desired name of the function (e.g. mathIsPrime).\n * @param code A list of statements or one multi-line code string. Use ' '\n * for indents (they will be replaced).\n * @returns The actual name of the new function. This may differ from\n * desiredName if the former has already been taken by the user.\n */\n protected provideFunction_(desiredName: string, code: string[]|string):\n string {\n if (!this.definitions_[desiredName]) {\n const functionName =\n this.nameDB_!.getDistinctName(desiredName, NameType.PROCEDURE);\n this.functionNames_[desiredName] = functionName;\n if (Array.isArray(code)) {\n code = code.join('\\n');\n }\n let codeText = code.trim().replace(\n this.FUNCTION_NAME_PLACEHOLDER_REGEXP_, functionName);\n // Change all ' ' indents into the desired indent.\n // To avoid an infinite loop of replacements, change all indents to '\\0'\n // character first, then replace them all with the indent.\n // We are assuming that no provided functions contain a literal null char.\n let oldCodeText;\n while (oldCodeText !== codeText) {\n oldCodeText = codeText;\n codeText = codeText.replace(/^(( {2})*) {2}/gm, '$1\\0');\n }\n codeText = codeText.replace(/\\0/g, this.INDENT);\n this.definitions_[desiredName] = codeText;\n }\n return this.functionNames_[desiredName];\n }\n\n /**\n * Hook for code to run before code generation starts.\n * Subclasses may override this, e.g. to initialise the database of variable\n * names.\n *\n * @param _workspace Workspace to generate code from.\n */\n init(_workspace: Workspace) {\n // Optionally override\n // Create a dictionary of definitions to be printed before the code.\n this.definitions_ = Object.create(null);\n // Create a dictionary mapping desired developer-defined function names in\n // definitions_ to actual function names (to avoid collisions with\n // user-defined procedures).\n this.functionNames_ = Object.create(null);\n }\n\n /**\n * Common tasks for generating code from blocks. This is called from\n * blockToCode and is called on every block, not just top level blocks.\n * Subclasses may override this, e.g. to generate code for statements\n * following the block, or to handle comments for the specified block and any\n * connected value blocks.\n *\n * @param _block The current block.\n * @param code The code created for this block.\n * @param _opt_thisOnly True to generate code for only this statement.\n * @returns Code with comments and subsequent blocks added.\n */\n protected scrub_(_block: Block, code: string, _opt_thisOnly?: boolean):\n string {\n // Optionally override\n return code;\n }\n\n /**\n * Hook for code to run at end of code generation.\n * Subclasses may override this, e.g. to prepend the generated code with\n * import statements or variable definitions.\n *\n * @param code Generated code.\n * @returns Completed code.\n */\n finish(code: string): string {\n // Optionally override\n // Clean up temporary data.\n this.definitions_ = Object.create(null);\n this.functionNames_ = Object.create(null);\n return code;\n }\n\n /**\n * Naked values are top-level blocks with outputs that aren't plugged into\n * anything.\n * Subclasses may override this, e.g. if their language does not allow\n * naked values.\n *\n * @param line Line of generated code.\n * @returns Legal line of code.\n */\n scrubNakedValue(line: string): string {\n // Optionally override\n return line;\n }\n}\n\nObject.defineProperties(Generator.prototype, {\n /**\n * A database of variable names.\n *\n * @name Blockly.Generator.prototype.variableDB_\n * @deprecated 'variableDB_' was renamed to 'nameDB_' (May 2021).\n * @suppress {checkTypes}\n */\n variableDB_: ({\n /** @returns Name database. */\n get(this: Generator): Names |\n undefined {\n deprecation.warn('variableDB_', 'version 9', 'version 10', 'nameDB_');\n return this.nameDB_;\n },\n /** @param nameDb New name database. */\n set(this: Generator, nameDb: Names|undefined) {\n deprecation.warn('variableDB_', 'version 9', 'version 10', 'nameDB_');\n this.nameDB_ = nameDb;\n },\n }),\n});\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a button in the flyout.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FlyoutButton');\n\nimport * as browserEvents from './browser_events.js';\nimport * as Css from './css.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport * as parsing from './utils/parsing.js';\nimport * as style from './utils/style.js';\nimport {Svg} from './utils/svg.js';\nimport type * as toolbox from './utils/toolbox.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Class for a button or label in the flyout.\n *\n * @alias Blockly.FlyoutButton\n */\nexport class FlyoutButton {\n /** The horizontal margin around the text in the button. */\n static TEXT_MARGIN_X = 5;\n\n /** The vertical margin around the text in the button. */\n static TEXT_MARGIN_Y = 2;\n private readonly text_: string;\n private readonly position_: Coordinate;\n private readonly callbackKey_: string;\n private readonly cssClass_: string|null;\n\n /** Mouse up event data. */\n private onMouseUpWrapper_: browserEvents.Data|null = null;\n info: toolbox.ButtonOrLabelInfo;\n\n /** The width of the button's rect. */\n width = 0;\n\n /** The height of the button's rect. */\n height = 0;\n\n /** The root SVG group for the button or label. */\n private svgGroup_: SVGGElement|null = null;\n\n /** The SVG element with the text of the label or button. */\n private svgText_: SVGTextElement|null = null;\n\n /**\n * @param workspace The workspace in which to place this button.\n * @param targetWorkspace The flyout's target workspace.\n * @param json The JSON specifying the label/button.\n * @param isLabel_ Whether this button should be styled as a label.\n * @internal\n */\n constructor(\n private readonly workspace: WorkspaceSvg,\n private readonly targetWorkspace: WorkspaceSvg,\n json: toolbox.ButtonOrLabelInfo, private readonly isLabel_: boolean) {\n this.text_ = json['text'];\n\n this.position_ = new Coordinate(0, 0);\n\n /** The key to the function called when this button is clicked. */\n this.callbackKey_ =\n (json as\n AnyDuringMigration)['callbackKey'] || /* Check the lower case version\n too to satisfy IE */\n (json as AnyDuringMigration)['callbackkey'];\n\n /** If specified, a CSS class to add to this button. */\n this.cssClass_ = (json as AnyDuringMigration)['web-class'] || null;\n\n /** The JSON specifying the label / button. */\n this.info = json;\n }\n\n /**\n * Create the button elements.\n *\n * @returns The button's SVG group.\n */\n createDom(): SVGElement {\n let cssClass = this.isLabel_ ? 'blocklyFlyoutLabel' : 'blocklyFlyoutButton';\n if (this.cssClass_) {\n cssClass += ' ' + this.cssClass_;\n }\n\n this.svgGroup_ = dom.createSvgElement(\n Svg.G, {'class': cssClass}, this.workspace.getCanvas());\n\n let shadow;\n if (!this.isLabel_) {\n // Shadow rectangle (light source does not mirror in RTL).\n shadow = dom.createSvgElement(\n Svg.RECT, {\n 'class': 'blocklyFlyoutButtonShadow',\n 'rx': 4,\n 'ry': 4,\n 'x': 1,\n 'y': 1,\n },\n this.svgGroup_!);\n }\n // Background rectangle.\n const rect = dom.createSvgElement(\n Svg.RECT, {\n 'class': this.isLabel_ ? 'blocklyFlyoutLabelBackground' :\n 'blocklyFlyoutButtonBackground',\n 'rx': 4,\n 'ry': 4,\n },\n this.svgGroup_!);\n\n const svgText = dom.createSvgElement(\n Svg.TEXT, {\n 'class': this.isLabel_ ? 'blocklyFlyoutLabelText' : 'blocklyText',\n 'x': 0,\n 'y': 0,\n 'text-anchor': 'middle',\n },\n this.svgGroup_!);\n let text = parsing.replaceMessageReferences(this.text_);\n if (this.workspace.RTL) {\n // Force text to be RTL by adding an RLM.\n text += '\\u200F';\n }\n svgText.textContent = text;\n if (this.isLabel_) {\n this.svgText_ = svgText;\n this.workspace.getThemeManager().subscribe(\n this.svgText_, 'flyoutForegroundColour', 'fill');\n }\n\n const fontSize = style.getComputedStyle(svgText, 'fontSize');\n const fontWeight = style.getComputedStyle(svgText, 'fontWeight');\n const fontFamily = style.getComputedStyle(svgText, 'fontFamily');\n this.width = dom.getFastTextWidthWithSizeString(\n svgText, fontSize, fontWeight, fontFamily);\n const fontMetrics =\n dom.measureFontMetrics(text, fontSize, fontWeight, fontFamily);\n this.height = fontMetrics.height;\n\n if (!this.isLabel_) {\n this.width += 2 * FlyoutButton.TEXT_MARGIN_X;\n this.height += 2 * FlyoutButton.TEXT_MARGIN_Y;\n shadow?.setAttribute('width', this.width.toString());\n shadow?.setAttribute('height', this.height.toString());\n }\n rect.setAttribute('width', this.width.toString());\n rect.setAttribute('height', this.height.toString());\n\n svgText.setAttribute('x', (this.width / 2).toString());\n svgText.setAttribute(\n 'y',\n (this.height / 2 - fontMetrics.height / 2 + fontMetrics.baseline)\n .toString());\n\n this.updateTransform_();\n\n // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not\n // assignable to parameter of type 'EventTarget'.\n this.onMouseUpWrapper_ = browserEvents.conditionalBind(\n this.svgGroup_ as AnyDuringMigration, 'mouseup', this, this.onMouseUp_);\n return this.svgGroup_!;\n }\n\n /** Correctly position the flyout button and make it visible. */\n show() {\n this.updateTransform_();\n this.svgGroup_!.setAttribute('display', 'block');\n }\n\n /** Update SVG attributes to match internal state. */\n private updateTransform_() {\n this.svgGroup_!.setAttribute(\n 'transform',\n 'translate(' + this.position_.x + ',' + this.position_.y + ')');\n }\n\n /**\n * Move the button to the given x, y coordinates.\n *\n * @param x The new x coordinate.\n * @param y The new y coordinate.\n */\n moveTo(x: number, y: number) {\n this.position_.x = x;\n this.position_.y = y;\n this.updateTransform_();\n }\n\n /** @returns Whether or not the button is a label. */\n isLabel(): boolean {\n return this.isLabel_;\n }\n\n /**\n * Location of the button.\n *\n * @returns x, y coordinates.\n * @internal\n */\n getPosition(): Coordinate {\n return this.position_;\n }\n\n /** @returns Text of the button. */\n getButtonText(): string {\n return this.text_;\n }\n\n /**\n * Get the button's target workspace.\n *\n * @returns The target workspace of the flyout where this button resides.\n */\n getTargetWorkspace(): WorkspaceSvg {\n return this.targetWorkspace;\n }\n\n /** Dispose of this button. */\n dispose() {\n if (this.onMouseUpWrapper_) {\n browserEvents.unbind(this.onMouseUpWrapper_);\n }\n if (this.svgGroup_) {\n dom.removeNode(this.svgGroup_);\n }\n if (this.svgText_) {\n this.workspace.getThemeManager().unsubscribe(this.svgText_);\n }\n }\n\n /**\n * Do something when the button is clicked.\n *\n * @param e Mouse up event.\n */\n private onMouseUp_(e: Event) {\n const gesture = this.targetWorkspace.getGesture(e);\n if (gesture) {\n gesture.cancel();\n }\n\n if (this.isLabel_ && this.callbackKey_) {\n console.warn(\n 'Labels should not have callbacks. Label text: ' + this.text_);\n } else if (\n !this.isLabel_ &&\n !(this.callbackKey_ &&\n this.targetWorkspace.getButtonCallback(this.callbackKey_))) {\n console.warn('Buttons should have callbacks. Button text: ' + this.text_);\n } else if (!this.isLabel_) {\n const callback =\n this.targetWorkspace.getButtonCallback(this.callbackKey_);\n if (callback) {\n callback(this);\n }\n }\n }\n}\n\n/** CSS for buttons and labels. See css.js for use. */\nCss.register(`\n.blocklyFlyoutButton {\n fill: #888;\n cursor: default;\n}\n\n.blocklyFlyoutButtonShadow {\n fill: #666;\n}\n\n.blocklyFlyoutButton:hover {\n fill: #aaa;\n}\n\n.blocklyFlyoutLabel {\n cursor: default;\n}\n\n.blocklyFlyoutLabelBackground {\n opacity: 0;\n}\n`);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Calculates and reports workspace metrics.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.MetricsManager');\n\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IMetricsManager} from './interfaces/i_metrics_manager.js';\nimport type {IToolbox} from './interfaces/i_toolbox.js';\nimport * as registry from './registry.js';\nimport type {Metrics} from './utils/metrics.js';\nimport {Size} from './utils/size.js';\nimport * as toolboxUtils from './utils/toolbox.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * The manager for all workspace metrics calculations.\n *\n * @alias Blockly.MetricsManager\n */\nexport class MetricsManager implements IMetricsManager {\n /** The workspace to calculate metrics for. */\n protected readonly workspace_: WorkspaceSvg;\n\n /** @param workspace The workspace to calculate metrics for. */\n constructor(workspace: WorkspaceSvg) {\n this.workspace_ = workspace;\n }\n\n /**\n * Gets the dimensions of the given workspace component, in pixel coordinates.\n *\n * @param elem The element to get the dimensions of, or null. It should be a\n * toolbox or flyout, and should implement getWidth() and getHeight().\n * @returns An object containing width and height attributes, which will both\n * be zero if elem did not exist.\n */\n protected getDimensionsPx_(elem: IToolbox|null|IFlyout): Size {\n let width = 0;\n let height = 0;\n if (elem) {\n width = elem.getWidth();\n height = elem.getHeight();\n }\n return new Size(width, height);\n }\n\n /**\n * Gets the width and the height of the flyout on the workspace in pixel\n * coordinates. Returns 0 for the width and height if the workspace has a\n * category toolbox instead of a simple toolbox.\n *\n * @param opt_own Whether to only return the workspace's own flyout.\n * @returns The width and height of the flyout.\n */\n getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics {\n const flyoutDimensions =\n this.getDimensionsPx_(this.workspace_.getFlyout(opt_own));\n return {\n width: flyoutDimensions.width,\n height: flyoutDimensions.height,\n position: this.workspace_.toolboxPosition,\n };\n }\n\n /**\n * Gets the width, height and position of the toolbox on the workspace in\n * pixel coordinates. Returns 0 for the width and height if the workspace has\n * a simple toolbox instead of a category toolbox. To get the width and height\n * of a\n * simple toolbox @see {@link MetricsManager#getFlyoutMetrics}.\n *\n * @returns The object with the width, height and position of the toolbox.\n */\n getToolboxMetrics(): ToolboxMetrics {\n const toolboxDimensions =\n this.getDimensionsPx_(this.workspace_.getToolbox());\n\n return {\n width: toolboxDimensions.width,\n height: toolboxDimensions.height,\n position: this.workspace_.toolboxPosition,\n };\n }\n\n /**\n * Gets the width and height of the workspace's parent SVG element in pixel\n * coordinates. This area includes the toolbox and the visible workspace area.\n *\n * @returns The width and height of the workspace's parent SVG element.\n */\n getSvgMetrics(): Size {\n return this.workspace_.getCachedParentSvgSize();\n }\n\n /**\n * Gets the absolute left and absolute top in pixel coordinates.\n * This is where the visible workspace starts in relation to the SVG\n * container.\n *\n * @returns The absolute metrics for the workspace.\n */\n getAbsoluteMetrics(): AbsoluteMetrics {\n let absoluteLeft = 0;\n const toolboxMetrics = this.getToolboxMetrics();\n const flyoutMetrics = this.getFlyoutMetrics(true);\n const doesToolboxExist = !!this.workspace_.getToolbox();\n const doesFlyoutExist = !!this.workspace_.getFlyout(true);\n const toolboxPosition =\n doesToolboxExist ? toolboxMetrics.position : flyoutMetrics.position;\n\n const atLeft = toolboxPosition === toolboxUtils.Position.LEFT;\n const atTop = toolboxPosition === toolboxUtils.Position.TOP;\n if (doesToolboxExist && atLeft) {\n absoluteLeft = toolboxMetrics.width;\n } else if (doesFlyoutExist && atLeft) {\n absoluteLeft = flyoutMetrics.width;\n }\n let absoluteTop = 0;\n if (doesToolboxExist && atTop) {\n absoluteTop = toolboxMetrics.height;\n } else if (doesFlyoutExist && atTop) {\n absoluteTop = flyoutMetrics.height;\n }\n\n return {\n top: absoluteTop,\n left: absoluteLeft,\n };\n }\n\n /**\n * Gets the metrics for the visible workspace in either pixel or workspace\n * coordinates. The visible workspace does not include the toolbox or flyout.\n *\n * @param opt_getWorkspaceCoordinates True to get the view metrics in\n * workspace coordinates, false to get them in pixel coordinates.\n * @returns The width, height, top and left of the viewport in either\n * workspace coordinates or pixel coordinates.\n */\n getViewMetrics(opt_getWorkspaceCoordinates?: boolean): ContainerRegion {\n const scale = opt_getWorkspaceCoordinates ? this.workspace_.scale : 1;\n const svgMetrics = this.getSvgMetrics();\n const toolboxMetrics = this.getToolboxMetrics();\n const flyoutMetrics = this.getFlyoutMetrics(true);\n const doesToolboxExist = !!this.workspace_.getToolbox();\n const toolboxPosition =\n doesToolboxExist ? toolboxMetrics.position : flyoutMetrics.position;\n\n if (this.workspace_.getToolbox()) {\n if (toolboxPosition === toolboxUtils.Position.TOP ||\n toolboxPosition === toolboxUtils.Position.BOTTOM) {\n svgMetrics.height -= toolboxMetrics.height;\n } else if (\n toolboxPosition === toolboxUtils.Position.LEFT ||\n toolboxPosition === toolboxUtils.Position.RIGHT) {\n svgMetrics.width -= toolboxMetrics.width;\n }\n } else if (this.workspace_.getFlyout(true)) {\n if (toolboxPosition === toolboxUtils.Position.TOP ||\n toolboxPosition === toolboxUtils.Position.BOTTOM) {\n svgMetrics.height -= flyoutMetrics.height;\n } else if (\n toolboxPosition === toolboxUtils.Position.LEFT ||\n toolboxPosition === toolboxUtils.Position.RIGHT) {\n svgMetrics.width -= flyoutMetrics.width;\n }\n }\n return {\n height: svgMetrics.height / scale,\n width: svgMetrics.width / scale,\n top: -this.workspace_.scrollY / scale,\n left: -this.workspace_.scrollX / scale,\n };\n }\n\n /**\n * Gets content metrics in either pixel or workspace coordinates.\n * The content area is a rectangle around all the top bounded elements on the\n * workspace (workspace comments and blocks).\n *\n * @param opt_getWorkspaceCoordinates True to get the content metrics in\n * workspace coordinates, false to get them in pixel coordinates.\n * @returns The metrics for the content container.\n */\n getContentMetrics(opt_getWorkspaceCoordinates?: boolean): ContainerRegion {\n const scale = opt_getWorkspaceCoordinates ? 1 : this.workspace_.scale;\n // Block bounding box is in workspace coordinates.\n const blockBox = this.workspace_.getBlocksBoundingBox();\n\n return {\n height: (blockBox.bottom - blockBox.top) * scale,\n width: (blockBox.right - blockBox.left) * scale,\n top: blockBox.top * scale,\n left: blockBox.left * scale,\n };\n }\n\n /**\n * Returns whether the scroll area has fixed edges.\n *\n * @returns Whether the scroll area has fixed edges.\n * @internal\n */\n hasFixedEdges(): boolean {\n // This exists for optimization of bump logic.\n return !this.workspace_.isMovableHorizontally() ||\n !this.workspace_.isMovableVertically();\n }\n\n /**\n * Computes the fixed edges of the scroll area.\n *\n * @param opt_viewMetrics The view metrics if they have been previously\n * computed. Passing in null may cause the view metrics to be computed\n * again, if it is needed.\n * @returns The fixed edges of the scroll area.\n */\n protected getComputedFixedEdges_(opt_viewMetrics?: ContainerRegion):\n FixedEdges {\n if (!this.hasFixedEdges()) {\n // Return early if there are no edges.\n return {};\n }\n\n const hScrollEnabled = this.workspace_.isMovableHorizontally();\n const vScrollEnabled = this.workspace_.isMovableVertically();\n\n const viewMetrics = opt_viewMetrics || this.getViewMetrics(false);\n\n const edges = {} as FixedEdges;\n if (!vScrollEnabled) {\n edges.top = viewMetrics.top;\n edges.bottom = viewMetrics.top + viewMetrics.height;\n }\n if (!hScrollEnabled) {\n edges.left = viewMetrics.left;\n edges.right = viewMetrics.left + viewMetrics.width;\n }\n return edges;\n }\n\n /**\n * Returns the content area with added padding.\n *\n * @param viewMetrics The view metrics.\n * @param contentMetrics The content metrics.\n * @returns The padded content area.\n */\n protected getPaddedContent_(\n viewMetrics: ContainerRegion, contentMetrics: ContainerRegion):\n {top: number, bottom: number, left: number, right: number} {\n const contentBottom = contentMetrics.top + contentMetrics.height;\n const contentRight = contentMetrics.left + contentMetrics.width;\n\n const viewWidth = viewMetrics.width;\n const viewHeight = viewMetrics.height;\n const halfWidth = viewWidth / 2;\n const halfHeight = viewHeight / 2;\n\n // Add a padding around the content that is at least half a screen wide.\n // Ensure padding is wide enough that blocks can scroll over entire screen.\n const top =\n Math.min(contentMetrics.top - halfHeight, contentBottom - viewHeight);\n const left =\n Math.min(contentMetrics.left - halfWidth, contentRight - viewWidth);\n const bottom =\n Math.max(contentBottom + halfHeight, contentMetrics.top + viewHeight);\n const right =\n Math.max(contentRight + halfWidth, contentMetrics.left + viewWidth);\n\n return {top, bottom, left, right};\n }\n\n /**\n * Returns the metrics for the scroll area of the workspace.\n *\n * @param opt_getWorkspaceCoordinates True to get the scroll metrics in\n * workspace coordinates, false to get them in pixel coordinates.\n * @param opt_viewMetrics The view metrics if they have been previously\n * computed. Passing in null may cause the view metrics to be computed\n * again, if it is needed.\n * @param opt_contentMetrics The content metrics if they have been previously\n * computed. Passing in null may cause the content metrics to be computed\n * again, if it is needed.\n * @returns The metrics for the scroll container.\n */\n getScrollMetrics(\n opt_getWorkspaceCoordinates?: boolean, opt_viewMetrics?: ContainerRegion,\n opt_contentMetrics?: ContainerRegion): ContainerRegion {\n const scale = opt_getWorkspaceCoordinates ? this.workspace_.scale : 1;\n const viewMetrics = opt_viewMetrics || this.getViewMetrics(false);\n const contentMetrics = opt_contentMetrics || this.getContentMetrics();\n const fixedEdges = this.getComputedFixedEdges_(viewMetrics);\n\n // Add padding around content.\n const paddedContent = this.getPaddedContent_(viewMetrics, contentMetrics);\n\n // Use combination of fixed bounds and padded content to make scroll area.\n const top =\n fixedEdges.top !== undefined ? fixedEdges.top : paddedContent.top;\n const left =\n fixedEdges.left !== undefined ? fixedEdges.left : paddedContent.left;\n const bottom = fixedEdges.bottom !== undefined ? fixedEdges.bottom :\n paddedContent.bottom;\n const right =\n fixedEdges.right !== undefined ? fixedEdges.right : paddedContent.right;\n\n return {\n top: top / scale,\n left: left / scale,\n width: (right - left) / scale,\n height: (bottom - top) / scale,\n };\n }\n\n /**\n * Returns common metrics used by UI elements.\n *\n * @returns The UI metrics.\n */\n getUiMetrics(): UiMetrics {\n return {\n viewMetrics: this.getViewMetrics(),\n absoluteMetrics: this.getAbsoluteMetrics(),\n toolboxMetrics: this.getToolboxMetrics(),\n };\n }\n\n /**\n * Returns an object with all the metrics required to size scrollbars for a\n * top level workspace. The following properties are computed:\n * Coordinate system: pixel coordinates, -left, -up, +right, +down\n * .viewHeight: Height of the visible portion of the workspace.\n * .viewWidth: Width of the visible portion of the workspace.\n * .contentHeight: Height of the content.\n * .contentWidth: Width of the content.\n * .scrollHeight: Height of the scroll area.\n * .scrollWidth: Width of the scroll area.\n * .svgHeight: Height of the Blockly div (the view + the toolbox,\n * simple or otherwise),\n * .svgWidth: Width of the Blockly div (the view + the toolbox,\n * simple or otherwise),\n * .viewTop: Top-edge of the visible portion of the workspace, relative to\n * the workspace origin.\n * .viewLeft: Left-edge of the visible portion of the workspace, relative to\n * the workspace origin.\n * .contentTop: Top-edge of the content, relative to the workspace origin.\n * .contentLeft: Left-edge of the content relative to the workspace origin.\n * .scrollTop: Top-edge of the scroll area, relative to the workspace origin.\n * .scrollLeft: Left-edge of the scroll area relative to the workspace origin.\n * .absoluteTop: Top-edge of the visible portion of the workspace, relative\n * to the blocklyDiv.\n * .absoluteLeft: Left-edge of the visible portion of the workspace, relative\n * to the blocklyDiv.\n * .toolboxWidth: Width of the toolbox, if it exists. Otherwise zero.\n * .toolboxHeight: Height of the toolbox, if it exists. Otherwise zero.\n * .flyoutWidth: Width of the flyout if it is always open. Otherwise zero.\n * .flyoutHeight: Height of the flyout if it is always open. Otherwise zero.\n * .toolboxPosition: Top, bottom, left or right. Use TOOLBOX_AT constants to\n * compare.\n *\n * @returns Contains size and position metrics of a top level workspace.\n */\n getMetrics(): Metrics {\n const toolboxMetrics = this.getToolboxMetrics();\n const flyoutMetrics = this.getFlyoutMetrics(true);\n const svgMetrics = this.getSvgMetrics();\n const absoluteMetrics = this.getAbsoluteMetrics();\n const viewMetrics = this.getViewMetrics();\n const contentMetrics = this.getContentMetrics();\n const scrollMetrics =\n this.getScrollMetrics(false, viewMetrics, contentMetrics);\n\n return {\n contentHeight: contentMetrics.height,\n contentWidth: contentMetrics.width,\n contentTop: contentMetrics.top,\n contentLeft: contentMetrics.left,\n\n scrollHeight: scrollMetrics.height,\n scrollWidth: scrollMetrics.width,\n scrollTop: scrollMetrics.top,\n scrollLeft: scrollMetrics.left,\n\n viewHeight: viewMetrics.height,\n viewWidth: viewMetrics.width,\n viewTop: viewMetrics.top,\n viewLeft: viewMetrics.left,\n\n absoluteTop: absoluteMetrics.top,\n absoluteLeft: absoluteMetrics.left,\n\n svgHeight: svgMetrics.height,\n svgWidth: svgMetrics.width,\n\n toolboxWidth: toolboxMetrics.width,\n toolboxHeight: toolboxMetrics.height,\n toolboxPosition: toolboxMetrics.position,\n\n flyoutWidth: flyoutMetrics.width,\n flyoutHeight: flyoutMetrics.height,\n };\n }\n}\n\nexport namespace MetricsManager {\n /**\n * Describes the width, height and location of the toolbox on the main\n * workspace.\n */\n export interface ToolboxMetrics {\n width: number;\n height: number;\n position: toolboxUtils.Position;\n }\n\n /** Describes where the viewport starts in relation to the workspace SVG. */\n export interface AbsoluteMetrics {\n left: number;\n top: number;\n }\n\n /**\n * All the measurements needed to describe the size and location of a\n * container.\n */\n export interface ContainerRegion {\n height: number;\n width: number;\n top: number;\n left: number;\n }\n\n /** Describes fixed edges of the workspace. */\n export interface FixedEdges {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n }\n\n /** Common metrics used for UI elements. */\n export interface UiMetrics {\n viewMetrics: ContainerRegion;\n absoluteMetrics: AbsoluteMetrics;\n toolboxMetrics: ToolboxMetrics;\n }\n}\n\nexport type ToolboxMetrics = MetricsManager.ToolboxMetrics;\nexport type AbsoluteMetrics = MetricsManager.AbsoluteMetrics;\nexport type ContainerRegion = MetricsManager.ContainerRegion;\nexport type FixedEdges = MetricsManager.FixedEdges;\nexport type UiMetrics = MetricsManager.UiMetrics;\n\nregistry.register(\n registry.Type.METRICS_MANAGER, registry.DEFAULT, MetricsManager);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Calculates and reports flyout workspace metrics.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FlyoutMetricsManager');\n\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport {ContainerRegion, MetricsManager} from './metrics_manager.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n\n/**\n * Calculates metrics for a flyout's workspace.\n * The metrics are mainly used to size scrollbars for the flyout.\n *\n * @alias Blockly.FlyoutMetricsManager\n */\nexport class FlyoutMetricsManager extends MetricsManager {\n /** The flyout that owns the workspace to calculate metrics for. */\n protected flyout_: IFlyout;\n\n /**\n * @param workspace The flyout's workspace.\n * @param flyout The flyout.\n */\n constructor(workspace: WorkspaceSvg, flyout: IFlyout) {\n super(workspace);\n this.flyout_ = flyout;\n }\n\n /**\n * Gets the bounding box of the blocks on the flyout's workspace.\n * This is in workspace coordinates.\n *\n * @returns The bounding box of the blocks on the workspace.\n */\n private getBoundingBox_(): SVGRect|\n {height: number, y: number, width: number, x: number} {\n let blockBoundingBox;\n try {\n blockBoundingBox = this.workspace_.getCanvas().getBBox();\n } catch (e) {\n // Firefox has trouble with hidden elements (Bug 528969).\n // 2021 Update: It looks like this was fixed around Firefox 77 released in\n // 2020.\n blockBoundingBox = {height: 0, y: 0, width: 0, x: 0};\n }\n return blockBoundingBox;\n }\n\n override getContentMetrics(opt_getWorkspaceCoordinates?: boolean) {\n // The bounding box is in workspace coordinates.\n const blockBoundingBox = this.getBoundingBox_();\n const scale = opt_getWorkspaceCoordinates ? 1 : this.workspace_.scale;\n\n return {\n height: blockBoundingBox.height * scale,\n width: blockBoundingBox.width * scale,\n top: blockBoundingBox.y * scale,\n left: blockBoundingBox.x * scale,\n };\n }\n\n override getScrollMetrics(\n opt_getWorkspaceCoordinates?: boolean, opt_viewMetrics?: ContainerRegion,\n opt_contentMetrics?: ContainerRegion) {\n const contentMetrics = opt_contentMetrics || this.getContentMetrics();\n const margin = this.flyout_.MARGIN * this.workspace_.scale;\n const scale = opt_getWorkspaceCoordinates ? this.workspace_.scale : 1;\n\n // The left padding isn't just the margin. Some blocks are also offset by\n // tabWidth so that value and statement blocks line up.\n // The contentMetrics.left value is equivalent to the variable left padding.\n const leftPadding = contentMetrics.left;\n\n return {\n height: (contentMetrics.height + 2 * margin) / scale,\n width: (contentMetrics.width + leftPadding + margin) / scale,\n top: 0,\n left: 0,\n };\n }\n}\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Flyout tray containing blocks which may be created.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Flyout');\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\nimport {ComponentManager} from './component_manager.js';\nimport {DeleteArea} from './delete_area.js';\nimport * as eventUtils from './events/utils.js';\nimport {FlyoutButton} from './flyout_button.js';\nimport {FlyoutMetricsManager} from './flyout_metrics_manager.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {Options} from './options.js';\nimport {ScrollbarPair} from './scrollbar_pair.js';\nimport * as blocks from './serialization/blocks.js';\nimport * as Tooltip from './tooltip.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport {Svg} from './utils/svg.js';\nimport * as toolbox from './utils/toolbox.js';\nimport * as Variables from './variables.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\n\n\nenum FlyoutItemType {\n BLOCK = 'block',\n BUTTON = 'button',\n}\n\n/**\n * Class for a flyout.\n *\n * @alias Blockly.Flyout\n */\nexport abstract class Flyout extends DeleteArea implements IFlyout {\n /**\n * Position the flyout.\n */\n abstract position(): void;\n\n /**\n * Determine if a drag delta is toward the workspace, based on the position\n * and orientation of the flyout. This is used in determineDragIntention_ to\n * determine if a new block should be created or if the flyout should scroll.\n *\n * @param currentDragDeltaXY How far the pointer has\n * moved from the position at mouse down, in pixel units.\n * @returns True if the drag is toward the workspace.\n */\n abstract isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;\n\n /**\n * Sets the translation of the flyout to match the scrollbars.\n *\n * @param xyRatio Contains a y property which is a float\n * between 0 and 1 specifying the degree of scrolling and a\n * similar x property.\n */\n protected abstract setMetrics_(xyRatio: {x?: number, y?: number}): void;\n\n /**\n * Lay out the blocks in the flyout.\n *\n * @param contents The blocks and buttons to lay\n * out.\n * @param gaps The visible gaps between blocks.\n */\n protected abstract layout_(contents: FlyoutItem[], gaps: number[]): void;\n\n /**\n * Scroll the flyout.\n *\n * @param e Mouse wheel scroll event.\n */\n protected abstract wheel_(e: WheelEvent): void;\n\n /**\n * Compute height of flyout. Position mat under each block.\n * For RTL: Lay out the blocks right-aligned.\n */\n protected abstract reflowInternal_(): void;\n\n /**\n * Calculates the x coordinate for the flyout position.\n *\n * @returns X coordinate.\n */\n abstract getX(): number;\n\n /**\n * Calculates the y coordinate for the flyout position.\n *\n * @returns Y coordinate.\n */\n abstract getY(): number;\n\n /**\n * Scroll the flyout to the beginning of its contents.\n */\n abstract scrollToStart(): void;\n\n /**\n * The type of a flyout content item.\n */\n static FlyoutItemType = FlyoutItemType;\n\n protected workspace_: WorkspaceSvg;\n RTL: boolean;\n /**\n * Whether the flyout should be laid out horizontally or not.\n *\n * @internal\n */\n horizontalLayout = false;\n protected toolboxPosition_: number;\n\n /**\n * Opaque data that can be passed to Blockly.unbindEvent_.\n */\n private eventWrappers_: browserEvents.Data = [];\n\n /**\n * Function that will be registered as a change listener on the workspace\n * to reflow when blocks in the flyout workspace change.\n */\n private reflowWrapper_: Function|null = null;\n\n /**\n * Function that disables blocks in the flyout based on max block counts\n * allowed in the target workspace. Registered as a change listener on the\n * target workspace.\n */\n private filterWrapper_: Function|null = null;\n\n /**\n * List of background mats that lurk behind each block to catch clicks\n * landing in the blocks' lakes and bays.\n */\n private mats_: SVGElement[] = [];\n /**\n * List of visible buttons.\n */\n protected buttons_: FlyoutButton[] = [];\n /**\n * List of event listeners.\n */\n private listeners_: browserEvents.Data[] = [];\n\n /**\n * List of blocks that should always be disabled.\n */\n private permanentlyDisabled_: Block[] = [];\n protected readonly tabWidth_: number;\n\n /**\n * The target workspace.\n *\n * @internal\n */\n targetWorkspace!: WorkspaceSvg;\n /**\n * A list of blocks that can be reused.\n */\n private recycledBlocks_: BlockSvg[] = [];\n /**\n * Does the flyout automatically close when a block is created?\n */\n autoClose = true;\n\n /**\n * Whether the flyout is visible.\n */\n private isVisible_ = false;\n\n /**\n * Whether the workspace containing this flyout is visible.\n */\n private containerVisible_ = true;\n protected rectMap_: WeakMap<BlockSvg, SVGElement>;\n\n /**\n * Corner radius of the flyout background.\n */\n readonly CORNER_RADIUS: number = 8;\n readonly MARGIN: number;\n readonly GAP_X: number;\n readonly GAP_Y: number;\n\n /**\n * Top/bottom padding between scrollbar and edge of flyout background.\n */\n readonly SCROLLBAR_MARGIN: number = 2.5;\n\n /**\n * Width of flyout.\n */\n protected width_ = 0;\n\n /**\n * Height of flyout.\n */\n protected height_ = 0;\n // clang-format off\n /**\n * Range of a drag angle from a flyout considered \"dragging toward\n * workspace\". Drags that are within the bounds of this many degrees from\n * the orthogonal line to the flyout edge are considered to be \"drags toward\n * the workspace\".\n *\n * @example\n *\n * ```\n * Flyout Edge Workspace\n * [block] / <-within this angle, drags \"toward workspace\" |\n * [block] ---- orthogonal to flyout boundary ---- |\n * [block] \\ |\n * ```\n *\n * The angle is given in degrees from the orthogonal.\n *\n * This is used to know when to create a new block and when to scroll the\n * flyout. Setting it to 360 means that all drags create a new block.\n */\n // clang-format on\n protected dragAngleRange_ = 70;\n\n /**\n * The path around the background of the flyout, which will be filled with a\n * background colour.\n */\n protected svgBackground_: SVGPathElement|null = null;\n\n /**\n * The root SVG group for the button or label.\n */\n protected svgGroup_: SVGGElement|null = null;\n /**\n * @param workspaceOptions Dictionary of options for the\n * workspace.\n */\n constructor(workspaceOptions: Options) {\n super();\n workspaceOptions.setMetrics = this.setMetrics_.bind(this);\n\n this.workspace_ = new WorkspaceSvg(workspaceOptions);\n this.workspace_.setMetricsManager(\n new FlyoutMetricsManager(this.workspace_, this));\n\n this.workspace_.internalIsFlyout = true;\n // Keep the workspace visibility consistent with the flyout's visibility.\n this.workspace_.setVisible(this.isVisible_);\n\n /**\n * The unique id for this component that is used to register with the\n * ComponentManager.\n */\n this.id = idGenerator.genUid();\n\n /**\n * Is RTL vs LTR.\n */\n this.RTL = !!workspaceOptions.RTL;\n\n /**\n * Position of the toolbox and flyout relative to the workspace.\n */\n this.toolboxPosition_ = workspaceOptions.toolboxPosition;\n\n /**\n * Width of output tab.\n */\n this.tabWidth_ = this.workspace_.getRenderer().getConstants().TAB_WIDTH;\n\n /**\n * A map from blocks to the rects which are beneath them to act as input\n * targets.\n *\n * @internal\n */\n this.rectMap_ = new WeakMap();\n\n /**\n * Margin around the edges of the blocks in the flyout.\n */\n this.MARGIN = this.CORNER_RADIUS;\n\n // TODO: Move GAP_X and GAP_Y to their appropriate files.\n /**\n * Gap between items in horizontal flyouts. Can be overridden with the \"sep\"\n * element.\n */\n this.GAP_X = this.MARGIN * 3;\n\n /**\n * Gap between items in vertical flyouts. Can be overridden with the \"sep\"\n * element.\n */\n this.GAP_Y = this.MARGIN * 3;\n }\n\n /**\n * Creates the flyout's DOM. Only needs to be called once. The flyout can\n * either exist as its own SVG element or be a g element nested inside a\n * separate SVG element.\n *\n * @param tagName The type of tag to\n * put the flyout in. This should be <svg> or <g>.\n * @returns The flyout's SVG group.\n */\n createDom(tagName: string|Svg<SVGSVGElement>|Svg<SVGGElement>): SVGElement {\n /*\n <svg | g>\n <path class=\"blocklyFlyoutBackground\"/>\n <g class=\"blocklyFlyout\"></g>\n </ svg | g>\n */\n // Setting style to display:none to start. The toolbox and flyout\n // hide/show code will set up proper visibility and size later.\n this.svgGroup_ = dom.createSvgElement(\n tagName, {'class': 'blocklyFlyout', 'style': 'display: none'});\n this.svgBackground_ = dom.createSvgElement(\n Svg.PATH, {'class': 'blocklyFlyoutBackground'}, this.svgGroup_);\n this.svgGroup_.appendChild(this.workspace_.createDom());\n this.workspace_.getThemeManager().subscribe(\n this.svgBackground_, 'flyoutBackgroundColour', 'fill');\n this.workspace_.getThemeManager().subscribe(\n this.svgBackground_, 'flyoutOpacity', 'fill-opacity');\n return this.svgGroup_;\n }\n\n /**\n * Initializes the flyout.\n *\n * @param targetWorkspace The workspace in which to\n * create new blocks.\n */\n init(targetWorkspace: WorkspaceSvg) {\n this.targetWorkspace = targetWorkspace;\n this.workspace_.targetWorkspace = targetWorkspace;\n\n this.workspace_.scrollbar = new ScrollbarPair(\n this.workspace_, this.horizontalLayout, !this.horizontalLayout,\n 'blocklyFlyoutScrollbar', this.SCROLLBAR_MARGIN);\n\n this.hide();\n\n Array.prototype.push.apply(\n this.eventWrappers_,\n browserEvents.conditionalBind(\n (this.svgGroup_ as SVGGElement), 'wheel', this, this.wheel_));\n if (!this.autoClose) {\n this.filterWrapper_ = this.filterForCapacity_.bind(this);\n this.targetWorkspace.addChangeListener(this.filterWrapper_);\n }\n\n // Dragging the flyout up and down.\n Array.prototype.push.apply(\n this.eventWrappers_,\n browserEvents.conditionalBind(\n (this.svgBackground_ as SVGPathElement), 'mousedown', this,\n this.onMouseDown_));\n\n // A flyout connected to a workspace doesn't have its own current gesture.\n this.workspace_.getGesture =\n this.targetWorkspace.getGesture.bind(this.targetWorkspace);\n\n // Get variables from the main workspace rather than the target workspace.\n this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap());\n\n this.workspace_.createPotentialVariableMap();\n\n targetWorkspace.getComponentManager().addComponent({\n component: this,\n weight: 1,\n capabilities: [\n ComponentManager.Capability.DELETE_AREA,\n ComponentManager.Capability.DRAG_TARGET,\n ],\n });\n }\n\n /**\n * Dispose of this flyout.\n * Unlink from all DOM elements to prevent memory leaks.\n *\n * @suppress {checkTypes}\n */\n dispose() {\n this.hide();\n this.workspace_.getComponentManager().removeComponent(this.id);\n browserEvents.unbind(this.eventWrappers_);\n if (this.filterWrapper_) {\n this.targetWorkspace.removeChangeListener(this.filterWrapper_);\n this.filterWrapper_ = null;\n }\n if (this.workspace_) {\n this.workspace_.getThemeManager().unsubscribe(this.svgBackground_!);\n this.workspace_.dispose();\n }\n if (this.svgGroup_) {\n dom.removeNode(this.svgGroup_);\n this.svgGroup_ = null;\n }\n this.svgBackground_ = null;\n }\n\n /**\n * Get the width of the flyout.\n *\n * @returns The width of the flyout.\n */\n getWidth(): number {\n return this.width_;\n }\n\n /**\n * Get the height of the flyout.\n *\n * @returns The width of the flyout.\n */\n getHeight(): number {\n return this.height_;\n }\n\n /**\n * Get the scale (zoom level) of the flyout. By default,\n * this matches the target workspace scale, but this can be overridden.\n *\n * @returns Flyout workspace scale.\n */\n getFlyoutScale(): number {\n return this.targetWorkspace.scale;\n }\n\n /**\n * Get the workspace inside the flyout.\n *\n * @returns The workspace inside the flyout.\n * @internal\n */\n getWorkspace(): WorkspaceSvg {\n return this.workspace_;\n }\n\n /**\n * Is the flyout visible?\n *\n * @returns True if visible.\n */\n isVisible(): boolean {\n return this.isVisible_;\n }\n\n /**\n * Set whether the flyout is visible. A value of true does not necessarily\n * mean that the flyout is shown. It could be hidden because its container is\n * hidden.\n *\n * @param visible True if visible.\n */\n setVisible(visible: boolean) {\n const visibilityChanged = visible !== this.isVisible();\n\n this.isVisible_ = visible;\n if (visibilityChanged) {\n if (!this.autoClose) {\n // Auto-close flyouts are ignored as drag targets, so only non\n // auto-close flyouts need to have their drag target updated.\n this.workspace_.recordDragTargets();\n }\n this.updateDisplay_();\n }\n }\n\n /**\n * Set whether this flyout's container is visible.\n *\n * @param visible Whether the container is visible.\n */\n setContainerVisible(visible: boolean) {\n const visibilityChanged = visible !== this.containerVisible_;\n this.containerVisible_ = visible;\n if (visibilityChanged) {\n this.updateDisplay_();\n }\n }\n\n /**\n * Update the display property of the flyout based whether it thinks it should\n * be visible and whether its containing workspace is visible.\n */\n private updateDisplay_() {\n let show = true;\n if (!this.containerVisible_) {\n show = false;\n } else {\n show = this.isVisible();\n }\n if (this.svgGroup_) {\n this.svgGroup_.style.display = show ? 'block' : 'none';\n }\n // Update the scrollbar's visibility too since it should mimic the\n // flyout's visibility.\n this.workspace_.scrollbar?.setContainerVisible(show);\n }\n\n /**\n * Update the view based on coordinates calculated in position().\n *\n * @param width The computed width of the flyout's SVG group\n * @param height The computed height of the flyout's SVG group.\n * @param x The computed x origin of the flyout's SVG group.\n * @param y The computed y origin of the flyout's SVG group.\n */\n protected positionAt_(width: number, height: number, x: number, y: number) {\n this.svgGroup_?.setAttribute('width', width.toString());\n this.svgGroup_?.setAttribute('height', height.toString());\n this.workspace_.setCachedParentSvgSize(width, height);\n\n if (this.svgGroup_?.tagName === 'svg') {\n const transform = 'translate(' + x + 'px,' + y + 'px)';\n dom.setCssTransform(this.svgGroup_, transform);\n } else {\n // IE and Edge don't support CSS transforms on SVG elements so\n // it's important to set the transform on the SVG element itself\n const transform = 'translate(' + x + ',' + y + ')';\n this.svgGroup_?.setAttribute('transform', transform);\n }\n\n // Update the scrollbar (if one exists).\n const scrollbar = this.workspace_.scrollbar;\n if (scrollbar) {\n // Set the scrollbars origin to be the top left of the flyout.\n scrollbar.setOrigin(x, y);\n scrollbar.resize();\n // If origin changed and metrics haven't changed enough to trigger\n // reposition in resize, we need to call setPosition. See issue #4692.\n if (scrollbar.hScroll) {\n scrollbar.hScroll.setPosition(\n scrollbar.hScroll.position.x, scrollbar.hScroll.position.y);\n }\n if (scrollbar.vScroll) {\n scrollbar.vScroll.setPosition(\n scrollbar.vScroll.position.x, scrollbar.vScroll.position.y);\n }\n }\n }\n\n /**\n * Hide and empty the flyout.\n */\n hide() {\n if (!this.isVisible()) {\n return;\n }\n this.setVisible(false);\n // Delete all the event listeners.\n for (let i = 0, listen; listen = this.listeners_[i]; i++) {\n browserEvents.unbind(listen);\n }\n this.listeners_.length = 0;\n if (this.reflowWrapper_) {\n this.workspace_.removeChangeListener(this.reflowWrapper_);\n this.reflowWrapper_ = null;\n }\n }\n // Do NOT delete the blocks here. Wait until Flyout.show.\n // https://neil.fraser.name/news/2014/08/09/\n\n /**\n * Show and populate the flyout.\n *\n * @param flyoutDef Contents to display\n * in the flyout. This is either an array of Nodes, a NodeList, a\n * toolbox definition, or a string with the name of the dynamic category.\n */\n show(flyoutDef: toolbox.FlyoutDefinition|string) {\n this.workspace_.setResizesEnabled(false);\n this.hide();\n this.clearOldBlocks_();\n\n // Handle dynamic categories, represented by a name instead of a list.\n if (typeof flyoutDef === 'string') {\n flyoutDef = this.getDynamicCategoryContents_(flyoutDef);\n }\n this.setVisible(true);\n\n // Parse the Array, Node or NodeList into a a list of flyout items.\n const parsedContent = toolbox.convertFlyoutDefToJsonArray(flyoutDef);\n const flyoutInfo = this.createFlyoutInfo_(parsedContent);\n\n this.layout_(flyoutInfo.contents, flyoutInfo.gaps);\n\n // IE 11 is an incompetent browser that fails to fire mouseout events.\n // When the mouse is over the background, deselect all blocks.\n function deselectAll(this: Flyout) {\n const topBlocks = this.workspace_.getTopBlocks(false);\n for (let i = 0, block; block = topBlocks[i]; i++) {\n block.removeSelect();\n }\n }\n\n this.listeners_.push(browserEvents.conditionalBind(\n (this.svgBackground_ as SVGPathElement), 'mouseover', this,\n deselectAll));\n\n if (this.horizontalLayout) {\n this.height_ = 0;\n } else {\n this.width_ = 0;\n }\n this.workspace_.setResizesEnabled(true);\n this.reflow();\n\n this.filterForCapacity_();\n\n // Correctly position the flyout's scrollbar when it opens.\n this.position();\n\n this.reflowWrapper_ = this.reflow.bind(this);\n this.workspace_.addChangeListener(this.reflowWrapper_);\n this.emptyRecycledBlocks_();\n }\n\n /**\n * Create the contents array and gaps array necessary to create the layout for\n * the flyout.\n *\n * @param parsedContent The array\n * of objects to show in the flyout.\n * @returns The list of contents and gaps needed to lay out the flyout.\n */\n private createFlyoutInfo_(parsedContent: toolbox.FlyoutItemInfoArray):\n {contents: FlyoutItem[], gaps: number[]} {\n const contents: FlyoutItem[] = [];\n const gaps: number[] = [];\n this.permanentlyDisabled_.length = 0;\n const defaultGap = this.horizontalLayout ? this.GAP_X : this.GAP_Y;\n for (let i = 0, contentInfo; contentInfo = parsedContent[i]; i++) {\n if ('custom' in contentInfo) {\n const customInfo = (contentInfo as toolbox.DynamicCategoryInfo);\n const categoryName = customInfo['custom'];\n const flyoutDef = this.getDynamicCategoryContents_(categoryName);\n const parsedDynamicContent =\n toolbox.convertFlyoutDefToJsonArray(flyoutDef);\n // Replace the element at i with the dynamic content it represents.\n parsedContent.splice.apply(\n parsedContent, [i, 1, ...parsedDynamicContent]);\n contentInfo = parsedContent[i];\n }\n\n switch (contentInfo['kind'].toUpperCase()) {\n case 'BLOCK': {\n const blockInfo = (contentInfo as toolbox.BlockInfo);\n const block = this.createFlyoutBlock_(blockInfo);\n contents.push({type: FlyoutItemType.BLOCK, block: block});\n this.addBlockGap_(blockInfo, gaps, defaultGap);\n break;\n }\n case 'SEP': {\n const sepInfo = (contentInfo as toolbox.SeparatorInfo);\n this.addSeparatorGap_(sepInfo, gaps, defaultGap);\n break;\n }\n case 'LABEL': {\n const labelInfo = (contentInfo as toolbox.LabelInfo);\n // A label is a button with different styling.\n const label = this.createButton_(labelInfo, /** isLabel */ true);\n contents.push({type: FlyoutItemType.BUTTON, button: label});\n gaps.push(defaultGap);\n break;\n }\n case 'BUTTON': {\n const buttonInfo = (contentInfo as toolbox.ButtonInfo);\n const button = this.createButton_(buttonInfo, /** isLabel */ false);\n contents.push({type: FlyoutItemType.BUTTON, button: button});\n gaps.push(defaultGap);\n break;\n }\n }\n }\n return {contents: contents, gaps: gaps};\n }\n\n /**\n * Gets the flyout definition for the dynamic category.\n *\n * @param categoryName The name of the dynamic category.\n * @returns The definition of the\n * flyout in one of its many forms.\n */\n private getDynamicCategoryContents_(categoryName: string):\n toolbox.FlyoutDefinition {\n // Look up the correct category generation function and call that to get a\n // valid XML list.\n const fnToApply =\n this.workspace_.targetWorkspace!.getToolboxCategoryCallback(\n categoryName);\n if (typeof fnToApply !== 'function') {\n throw TypeError(\n 'Couldn\\'t find a callback function when opening' +\n ' a toolbox category.');\n }\n return fnToApply(this.workspace_.targetWorkspace!);\n }\n\n /**\n * Creates a flyout button or a flyout label.\n *\n * @param btnInfo The object holding information about a button or a label.\n * @param isLabel True if the button is a label, false otherwise.\n * @returns The object used to display the button in the\n * flyout.\n */\n private createButton_(btnInfo: toolbox.ButtonOrLabelInfo, isLabel: boolean):\n FlyoutButton {\n const curButton = new FlyoutButton(\n this.workspace_, (this.targetWorkspace as WorkspaceSvg), btnInfo,\n isLabel);\n return curButton;\n }\n\n /**\n * Create a block from the xml and permanently disable any blocks that were\n * defined as disabled.\n *\n * @param blockInfo The info of the block.\n * @returns The block created from the blockInfo.\n */\n private createFlyoutBlock_(blockInfo: toolbox.BlockInfo): BlockSvg {\n let block;\n if (blockInfo['blockxml']) {\n const xml = (typeof blockInfo['blockxml'] === 'string' ?\n Xml.textToDom(blockInfo['blockxml']) :\n blockInfo['blockxml']) as Element;\n block = this.getRecycledBlock_(xml.getAttribute('type')!);\n if (!block) {\n block = Xml.domToBlock(xml, this.workspace_);\n }\n } else {\n block = this.getRecycledBlock_(blockInfo['type']!);\n if (!block) {\n if (blockInfo['enabled'] === undefined) {\n blockInfo['enabled'] = blockInfo['disabled'] !== 'true' &&\n blockInfo['disabled'] !== true;\n }\n block = blocks.append((blockInfo as blocks.State), this.workspace_);\n }\n }\n\n if (!block.isEnabled()) {\n // Record blocks that were initially disabled.\n // Do not enable these blocks as a result of capacity filtering.\n this.permanentlyDisabled_.push(block);\n }\n return (block as BlockSvg);\n }\n\n /**\n * Returns a block from the array of recycled blocks with the given type, or\n * undefined if one cannot be found.\n *\n * @param blockType The type of the block to try to recycle.\n * @returns The recycled block, or undefined if\n * one could not be recycled.\n */\n private getRecycledBlock_(blockType: string): BlockSvg|undefined {\n let index = -1;\n for (let i = 0; i < this.recycledBlocks_.length; i++) {\n if (this.recycledBlocks_[i].type === blockType) {\n index = i;\n break;\n }\n }\n return index === -1 ? undefined : this.recycledBlocks_.splice(index, 1)[0];\n }\n\n /**\n * Adds a gap in the flyout based on block info.\n *\n * @param blockInfo Information about a block.\n * @param gaps The list of gaps between items in the flyout.\n * @param defaultGap The default gap between one element and the\n * next.\n */\n private addBlockGap_(\n blockInfo: toolbox.BlockInfo, gaps: number[], defaultGap: number) {\n let gap;\n if (blockInfo['gap']) {\n gap = parseInt(blockInfo['gap'].toString());\n } else if (blockInfo['blockxml']) {\n const xml = (typeof blockInfo['blockxml'] === 'string' ?\n Xml.textToDom(blockInfo['blockxml']) :\n blockInfo['blockxml']) as Element;\n gap = parseInt(xml.getAttribute('gap')!);\n }\n gaps.push(!gap || isNaN(gap) ? defaultGap : gap);\n }\n\n /**\n * Add the necessary gap in the flyout for a separator.\n *\n * @param sepInfo The object holding\n * information about a separator.\n * @param gaps The list gaps between items in the flyout.\n * @param defaultGap The default gap between the button and next\n * element.\n */\n private addSeparatorGap_(\n sepInfo: toolbox.SeparatorInfo, gaps: number[], defaultGap: number) {\n // Change the gap between two toolbox elements.\n // <sep gap=\"36\"></sep>\n // The default gap is 24, can be set larger or smaller.\n // This overwrites the gap attribute on the previous element.\n const newGap = parseInt(sepInfo['gap']!.toString());\n // Ignore gaps before the first block.\n if (!isNaN(newGap) && gaps.length > 0) {\n gaps[gaps.length - 1] = newGap;\n } else {\n gaps.push(defaultGap);\n }\n }\n\n /**\n * Delete blocks, mats and buttons from a previous showing of the flyout.\n */\n private clearOldBlocks_() {\n // Delete any blocks from a previous showing.\n const oldBlocks = this.workspace_.getTopBlocks(false);\n for (let i = 0, block; block = oldBlocks[i]; i++) {\n if (this.blockIsRecyclable_(block)) {\n this.recycleBlock_(block);\n } else {\n block.dispose(false, false);\n }\n }\n // Delete any mats from a previous showing.\n for (let j = 0; j < this.mats_.length; j++) {\n const rect = this.mats_[j];\n if (rect) {\n Tooltip.unbindMouseEvents(rect);\n dom.removeNode(rect);\n }\n }\n this.mats_.length = 0;\n // Delete any buttons from a previous showing.\n for (let i = 0, button; button = this.buttons_[i]; i++) {\n button.dispose();\n }\n this.buttons_.length = 0;\n\n // Clear potential variables from the previous showing.\n this.workspace_.getPotentialVariableMap()?.clear();\n }\n\n /**\n * Empties all of the recycled blocks, properly disposing of them.\n */\n private emptyRecycledBlocks_() {\n for (let i = 0; i < this.recycledBlocks_.length; i++) {\n this.recycledBlocks_[i].dispose();\n }\n this.recycledBlocks_ = [];\n }\n\n /**\n * Returns whether the given block can be recycled or not.\n *\n * @param _block The block to check for recyclability.\n * @returns True if the block can be recycled. False otherwise.\n */\n protected blockIsRecyclable_(_block: BlockSvg): boolean {\n // By default, recycling is disabled.\n return false;\n }\n\n /**\n * Puts a previously created block into the recycle bin and moves it to the\n * top of the workspace. Used during large workspace swaps to limit the number\n * of new DOM elements we need to create.\n *\n * @param block The block to recycle.\n */\n private recycleBlock_(block: BlockSvg) {\n const xy = block.getRelativeToSurfaceXY();\n block.moveBy(-xy.x, -xy.y);\n this.recycledBlocks_.push(block);\n }\n\n /**\n * Add listeners to a block that has been added to the flyout.\n *\n * @param root The root node of the SVG group the block is in.\n * @param block The block to add listeners for.\n * @param rect The invisible rectangle under the block that acts\n * as a mat for that block.\n */\n protected addBlockListeners_(\n root: SVGElement, block: BlockSvg, rect: SVGElement) {\n this.listeners_.push(browserEvents.conditionalBind(\n root, 'mousedown', null, this.blockMouseDown_(block)));\n this.listeners_.push(browserEvents.conditionalBind(\n rect, 'mousedown', null, this.blockMouseDown_(block)));\n this.listeners_.push(\n browserEvents.bind(root, 'mouseenter', block, block.addSelect));\n this.listeners_.push(\n browserEvents.bind(root, 'mouseleave', block, block.removeSelect));\n this.listeners_.push(\n browserEvents.bind(rect, 'mouseenter', block, block.addSelect));\n this.listeners_.push(\n browserEvents.bind(rect, 'mouseleave', block, block.removeSelect));\n }\n\n /**\n * Handle a mouse-down on an SVG block in a non-closing flyout.\n *\n * @param block The flyout block to copy.\n * @returns Function to call when block is clicked.\n */\n private blockMouseDown_(block: BlockSvg): Function {\n return (e: MouseEvent) => {\n const gesture = this.targetWorkspace.getGesture(e);\n if (gesture) {\n gesture.setStartBlock(block);\n gesture.handleFlyoutStart(e, this);\n }\n };\n }\n\n /**\n * Mouse down on the flyout background. Start a vertical scroll drag.\n *\n * @param e Mouse down event.\n */\n private onMouseDown_(e: MouseEvent) {\n const gesture = this.targetWorkspace.getGesture(e);\n if (gesture) {\n gesture.handleFlyoutStart(e, this);\n }\n }\n\n /**\n * Does this flyout allow you to create a new instance of the given block?\n * Used for deciding if a block can be \"dragged out of\" the flyout.\n *\n * @param block The block to copy from the flyout.\n * @returns True if you can create a new instance of the block, false\n * otherwise.\n * @internal\n */\n isBlockCreatable(block: BlockSvg): boolean {\n return block.isEnabled();\n }\n\n /**\n * Create a copy of this block on the workspace.\n *\n * @param originalBlock The block to copy from the flyout.\n * @returns The newly created block.\n * @throws {Error} if something went wrong with deserialization.\n * @internal\n */\n createBlock(originalBlock: BlockSvg): BlockSvg {\n let newBlock = null;\n eventUtils.disable();\n const variablesBeforeCreation = this.targetWorkspace.getAllVariables();\n this.targetWorkspace.setResizesEnabled(false);\n try {\n newBlock = this.placeNewBlock_(originalBlock);\n } finally {\n eventUtils.enable();\n }\n\n // Close the flyout.\n this.targetWorkspace.hideChaff();\n\n const newVariables = Variables.getAddedVariables(\n this.targetWorkspace, variablesBeforeCreation);\n\n if (eventUtils.isEnabled()) {\n eventUtils.setGroup(true);\n // Fire a VarCreate event for each (if any) new variable created.\n for (let i = 0; i < newVariables.length; i++) {\n const thisVariable = newVariables[i];\n eventUtils.fire(\n new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable));\n }\n\n // Block events come after var events, in case they refer to newly created\n // variables.\n eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CREATE))(newBlock));\n }\n if (this.autoClose) {\n this.hide();\n } else {\n this.filterForCapacity_();\n }\n return newBlock;\n }\n\n /**\n * Initialize the given button: move it to the correct location,\n * add listeners, etc.\n *\n * @param button The button to initialize and place.\n * @param x The x position of the cursor during this layout pass.\n * @param y The y position of the cursor during this layout pass.\n */\n protected initFlyoutButton_(button: FlyoutButton, x: number, y: number) {\n const buttonSvg = button.createDom();\n button.moveTo(x, y);\n button.show();\n // Clicking on a flyout button or label is a lot like clicking on the\n // flyout background.\n this.listeners_.push(browserEvents.conditionalBind(\n buttonSvg, 'mousedown', this, this.onMouseDown_));\n\n this.buttons_.push(button);\n }\n\n /**\n * Create and place a rectangle corresponding to the given block.\n *\n * @param block The block to associate the rect to.\n * @param x The x position of the cursor during this layout pass.\n * @param y The y position of the cursor during this layout pass.\n * @param blockHW The height and width of\n * the block.\n * @param index The index into the mats list where this rect should\n * be placed.\n * @returns Newly created SVG element for the rectangle behind\n * the block.\n */\n protected createRect_(\n block: BlockSvg, x: number, y: number,\n blockHW: {height: number, width: number}, index: number): SVGElement {\n // Create an invisible rectangle under the block to act as a button. Just\n // using the block as a button is poor, since blocks have holes in them.\n const rect = dom.createSvgElement(Svg.RECT, {\n 'fill-opacity': 0,\n 'x': x,\n 'y': y,\n 'height': blockHW.height,\n 'width': blockHW.width,\n });\n (rect as AnyDuringMigration).tooltip = block;\n Tooltip.bindMouseEvents(rect);\n // Add the rectangles under the blocks, so that the blocks' tooltips work.\n this.workspace_.getCanvas().insertBefore(rect, block.getSvgRoot());\n\n this.rectMap_.set(block, rect);\n this.mats_[index] = rect;\n return rect;\n }\n\n /**\n * Move a rectangle to sit exactly behind a block, taking into account tabs,\n * hats, and any other protrusions we invent.\n *\n * @param rect The rectangle to move directly behind the block.\n * @param block The block the rectangle should be behind.\n */\n protected moveRectToBlock_(rect: SVGElement, block: BlockSvg) {\n const blockHW = block.getHeightWidth();\n rect.setAttribute('width', blockHW.width.toString());\n rect.setAttribute('height', blockHW.height.toString());\n\n const blockXY = block.getRelativeToSurfaceXY();\n rect.setAttribute('y', blockXY.y.toString());\n rect.setAttribute(\n 'x', (this.RTL ? blockXY.x - blockHW.width : blockXY.x).toString());\n }\n\n /**\n * Filter the blocks on the flyout to disable the ones that are above the\n * capacity limit. For instance, if the user may only place two more blocks\n * on the workspace, an \"a + b\" block that has two shadow blocks would be\n * disabled.\n */\n private filterForCapacity_() {\n const blocks = this.workspace_.getTopBlocks(false);\n for (let i = 0, block; block = blocks[i]; i++) {\n if (this.permanentlyDisabled_.indexOf(block) === -1) {\n const enable = this.targetWorkspace.isCapacityAvailable(\n common.getBlockTypeCounts(block));\n while (block) {\n block.setEnabled(enable);\n block = block.getNextBlock();\n }\n }\n }\n }\n\n /**\n * Reflow blocks and their mats.\n */\n reflow() {\n if (this.reflowWrapper_) {\n this.workspace_.removeChangeListener(this.reflowWrapper_);\n }\n this.reflowInternal_();\n if (this.reflowWrapper_) {\n this.workspace_.addChangeListener(this.reflowWrapper_);\n }\n }\n\n /**\n * @returns True if this flyout may be scrolled with a scrollbar or\n * by dragging.\n * @internal\n */\n isScrollable(): boolean {\n return this.workspace_.scrollbar ? this.workspace_.scrollbar.isVisible() :\n false;\n }\n\n /**\n * Copy a block from the flyout to the workspace and position it correctly.\n *\n * @param oldBlock The flyout block to copy.\n * @returns The new block in the main workspace.\n */\n private placeNewBlock_(oldBlock: BlockSvg): BlockSvg {\n const targetWorkspace = this.targetWorkspace;\n const svgRootOld = oldBlock.getSvgRoot();\n if (!svgRootOld) {\n throw Error('oldBlock is not rendered.');\n }\n\n // Clone the block.\n const json = (blocks.save(oldBlock) as blocks.State);\n // Normallly this resizes leading to weird jumps. Save it for terminateDrag.\n targetWorkspace.setResizesEnabled(false);\n const block = (blocks.append(json, targetWorkspace) as BlockSvg);\n\n this.positionNewBlock_(oldBlock, block);\n\n return block;\n }\n\n /**\n * Positions a block on the target workspace.\n *\n * @param oldBlock The flyout block being copied.\n * @param block The block to posiiton.\n */\n private positionNewBlock_(oldBlock: BlockSvg, block: BlockSvg) {\n const targetWorkspace = this.targetWorkspace;\n\n // The offset in pixels between the main workspace's origin and the upper\n // left corner of the injection div.\n const mainOffsetPixels = targetWorkspace.getOriginOffsetInPixels();\n\n // The offset in pixels between the flyout workspace's origin and the upper\n // left corner of the injection div.\n const flyoutOffsetPixels = this.workspace_.getOriginOffsetInPixels();\n\n // The position of the old block in flyout workspace coordinates.\n const oldBlockPos = oldBlock.getRelativeToSurfaceXY();\n // The position of the old block in pixels relative to the flyout\n // workspace's origin.\n oldBlockPos.scale(this.workspace_.scale);\n\n // The position of the old block in pixels relative to the upper left corner\n // of the injection div.\n const oldBlockOffsetPixels =\n Coordinate.sum(flyoutOffsetPixels, oldBlockPos);\n\n // The position of the old block in pixels relative to the origin of the\n // main workspace.\n const finalOffset =\n Coordinate.difference(oldBlockOffsetPixels, mainOffsetPixels);\n // The position of the old block in main workspace coordinates.\n finalOffset.scale(1 / targetWorkspace.scale);\n\n block.moveTo(new Coordinate(finalOffset.x, finalOffset.y));\n }\n}\n\n/**\n * A flyout content item.\n */\nexport interface FlyoutItem {\n type: FlyoutItemType;\n button?: FlyoutButton|undefined;\n block?: BlockSvg|undefined;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Layout code for a vertical variant of the flyout.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.VerticalFlyout');\n\nimport * as browserEvents from './browser_events.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {Flyout, FlyoutItem} from './flyout_base.js';\nimport type {FlyoutButton} from './flyout_button.js';\nimport type {Options} from './options.js';\nimport * as registry from './registry.js';\nimport {Scrollbar} from './scrollbar.js';\nimport type {Coordinate} from './utils/coordinate.js';\nimport {Rect} from './utils/rect.js';\nimport * as toolbox from './utils/toolbox.js';\nimport * as WidgetDiv from './widgetdiv.js';\n\n\n/**\n * Class for a flyout.\n *\n * @alias Blockly.VerticalFlyout\n */\nexport class VerticalFlyout extends Flyout {\n /** The name of the vertical flyout in the registry. */\n static registryName = 'verticalFlyout';\n\n /** @param workspaceOptions Dictionary of options for the workspace. */\n constructor(workspaceOptions: Options) {\n super(workspaceOptions);\n }\n\n /**\n * Sets the translation of the flyout to match the scrollbars.\n *\n * @param xyRatio Contains a y property which is a float between 0 and 1\n * specifying the degree of scrolling and a similar x property.\n */\n protected override setMetrics_(xyRatio: {x: number, y: number}) {\n if (!this.isVisible()) {\n return;\n }\n const metricsManager = this.workspace_.getMetricsManager();\n const scrollMetrics = metricsManager.getScrollMetrics();\n const viewMetrics = metricsManager.getViewMetrics();\n const absoluteMetrics = metricsManager.getAbsoluteMetrics();\n\n if (typeof xyRatio.y === 'number') {\n this.workspace_.scrollY =\n -(scrollMetrics.top +\n (scrollMetrics.height - viewMetrics.height) * xyRatio.y);\n }\n this.workspace_.translate(\n this.workspace_.scrollX + absoluteMetrics.left,\n this.workspace_.scrollY + absoluteMetrics.top);\n }\n\n /**\n * Calculates the x coordinate for the flyout position.\n *\n * @returns X coordinate.\n */\n override getX(): number {\n if (!this.isVisible()) {\n return 0;\n }\n const metricsManager = this.targetWorkspace!.getMetricsManager();\n const absoluteMetrics = metricsManager.getAbsoluteMetrics();\n const viewMetrics = metricsManager.getViewMetrics();\n const toolboxMetrics = metricsManager.getToolboxMetrics();\n let x = 0;\n\n // If this flyout is not the trashcan flyout (e.g. toolbox or mutator).\n // Trashcan flyout is opposite the main flyout.\n if (this.targetWorkspace!.toolboxPosition === this.toolboxPosition_) {\n // If there is a category toolbox.\n // Simple (flyout-only) toolbox.\n if (this.targetWorkspace!.getToolbox()) {\n if (this.toolboxPosition_ === toolbox.Position.LEFT) {\n x = toolboxMetrics.width;\n } else {\n x = viewMetrics.width - this.width_;\n }\n } else {\n if (this.toolboxPosition_ === toolbox.Position.LEFT) {\n x = 0;\n } else {\n // The simple flyout does not cover the workspace.\n x = viewMetrics.width;\n }\n }\n } else {\n if (this.toolboxPosition_ === toolbox.Position.LEFT) {\n x = 0;\n } else {\n // Because the anchor point of the flyout is on the left, but we want\n // to align the right edge of the flyout with the right edge of the\n // blocklyDiv, we calculate the full width of the div minus the width\n // of the flyout.\n x = viewMetrics.width + absoluteMetrics.left - this.width_;\n }\n }\n\n return x;\n }\n\n /**\n * Calculates the y coordinate for the flyout position.\n *\n * @returns Y coordinate.\n */\n override getY(): number {\n // Y is always 0 since this is a vertical flyout.\n return 0;\n }\n\n /** Move the flyout to the edge of the workspace. */\n override position() {\n if (!this.isVisible() || !this.targetWorkspace!.isVisible()) {\n return;\n }\n const metricsManager = this.targetWorkspace!.getMetricsManager();\n const targetWorkspaceViewMetrics = metricsManager.getViewMetrics();\n this.height_ = targetWorkspaceViewMetrics.height;\n\n const edgeWidth = this.width_ - this.CORNER_RADIUS;\n const edgeHeight =\n targetWorkspaceViewMetrics.height - 2 * this.CORNER_RADIUS;\n this.setBackgroundPath_(edgeWidth, edgeHeight);\n\n const x = this.getX();\n const y = this.getY();\n\n this.positionAt_(this.width_, this.height_, x, y);\n }\n\n /**\n * Create and set the path for the visible boundaries of the flyout.\n *\n * @param width The width of the flyout, not including the rounded corners.\n * @param height The height of the flyout, not including rounded corners.\n */\n private setBackgroundPath_(width: number, height: number) {\n const atRight = this.toolboxPosition_ === toolbox.Position.RIGHT;\n const totalWidth = width + this.CORNER_RADIUS;\n\n // Decide whether to start on the left or right.\n const path: Array<string|number> =\n ['M ' + (atRight ? totalWidth : 0) + ',0'];\n // Top.\n path.push('h', (atRight ? -width : width));\n // Rounded corner.\n path.push(\n 'a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, atRight ? 0 : 1,\n atRight ? -this.CORNER_RADIUS : this.CORNER_RADIUS, this.CORNER_RADIUS);\n // Side closest to workspace.\n path.push('v', Math.max(0, height));\n // Rounded corner.\n path.push(\n 'a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, atRight ? 0 : 1,\n atRight ? this.CORNER_RADIUS : -this.CORNER_RADIUS, this.CORNER_RADIUS);\n // Bottom.\n path.push('h', (atRight ? width : -width));\n path.push('z');\n this.svgBackground_!.setAttribute('d', path.join(' '));\n }\n\n /** Scroll the flyout to the top. */\n override scrollToStart() {\n this.workspace_.scrollbar?.setY(0);\n }\n\n /**\n * Scroll the flyout.\n *\n * @param e Mouse wheel scroll event.\n */\n protected override wheel_(e: WheelEvent) {\n const scrollDelta = browserEvents.getScrollDeltaPixels(e);\n\n if (scrollDelta.y) {\n const metricsManager = this.workspace_.getMetricsManager();\n const scrollMetrics = metricsManager.getScrollMetrics();\n const viewMetrics = metricsManager.getViewMetrics();\n const pos = viewMetrics.top - scrollMetrics.top + scrollDelta.y;\n\n this.workspace_.scrollbar?.setY(pos);\n // When the flyout moves from a wheel event, hide WidgetDiv and\n // dropDownDiv.\n WidgetDiv.hide();\n dropDownDiv.hideWithoutAnimation();\n }\n // Don't scroll the page.\n e.preventDefault();\n // Don't propagate mousewheel event (zooming).\n e.stopPropagation();\n }\n\n /**\n * Lay out the blocks in the flyout.\n *\n * @param contents The blocks and buttons to lay out.\n * @param gaps The visible gaps between blocks.\n */\n protected override layout_(contents: FlyoutItem[], gaps: number[]) {\n this.workspace_.scale = this.targetWorkspace!.scale;\n const margin = this.MARGIN;\n const cursorX = this.RTL ? margin : margin + this.tabWidth_;\n let cursorY = margin;\n\n for (let i = 0, item; item = contents[i]; i++) {\n if (item.type === 'block') {\n const block = item.block;\n const allBlocks = block!.getDescendants(false);\n for (let j = 0, child; child = allBlocks[j]; j++) {\n // Mark blocks as being inside a flyout. This is used to detect and\n // prevent the closure of the flyout if the user right-clicks on such\n // a block.\n child.isInFlyout = true;\n }\n block!.render();\n const root = block!.getSvgRoot();\n const blockHW = block!.getHeightWidth();\n const moveX =\n block!.outputConnection ? cursorX - this.tabWidth_ : cursorX;\n block!.moveBy(moveX, cursorY);\n\n const rect = this.createRect_(\n block!, this.RTL ? moveX - blockHW.width : moveX, cursorY, blockHW,\n i);\n\n this.addBlockListeners_(root, block!, rect);\n\n cursorY += blockHW.height + gaps[i];\n } else if (item.type === 'button') {\n const button = item.button as FlyoutButton;\n this.initFlyoutButton_(button, cursorX, cursorY);\n cursorY += button.height + gaps[i];\n }\n }\n }\n\n /**\n * Determine if a drag delta is toward the workspace, based on the position\n * and orientation of the flyout. This is used in determineDragIntention_ to\n * determine if a new block should be created or if the flyout should scroll.\n *\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at mouse down, in pixel units.\n * @returns True if the drag is toward the workspace.\n * @internal\n */\n override isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean {\n const dx = currentDragDeltaXY.x;\n const dy = currentDragDeltaXY.y;\n // Direction goes from -180 to 180, with 0 toward the right and 90 on top.\n const dragDirection = Math.atan2(dy, dx) / Math.PI * 180;\n\n const range = this.dragAngleRange_;\n // Check for left or right dragging.\n if (dragDirection < range && dragDirection > -range ||\n (dragDirection < -180 + range || dragDirection > 180 - range)) {\n return true;\n }\n return false;\n }\n\n /**\n * Returns the bounding rectangle of the drag target area in pixel units\n * relative to viewport.\n *\n * @returns The component's bounding box. Null if drag target area should be\n * ignored.\n */\n override getClientRect(): Rect|null {\n if (!this.svgGroup_ || this.autoClose || !this.isVisible()) {\n // The bounding rectangle won't compute correctly if the flyout is closed\n // and auto-close flyouts aren't valid drag targets (or delete areas).\n return null;\n }\n\n const flyoutRect = this.svgGroup_.getBoundingClientRect();\n // BIG_NUM is offscreen padding so that blocks dragged beyond the shown\n // flyout area are still deleted. Must be larger than the largest screen\n // size, but be smaller than half Number.MAX_SAFE_INTEGER (not available on\n // IE).\n const BIG_NUM = 1000000000;\n const left = flyoutRect.left;\n\n if (this.toolboxPosition_ === toolbox.Position.LEFT) {\n const width = flyoutRect.width;\n return new Rect(-BIG_NUM, BIG_NUM, -BIG_NUM, left + width);\n } else { // Right\n return new Rect(-BIG_NUM, BIG_NUM, left, BIG_NUM);\n }\n }\n\n /**\n * Compute width of flyout. toolbox.Position mat under each block.\n * For RTL: Lay out the blocks and buttons to be right-aligned.\n */\n protected override reflowInternal_() {\n this.workspace_.scale = this.getFlyoutScale();\n let flyoutWidth = 0;\n const blocks = this.workspace_.getTopBlocks(false);\n for (let i = 0, block; block = blocks[i]; i++) {\n let width = block.getHeightWidth().width;\n if (block.outputConnection) {\n width -= this.tabWidth_;\n }\n flyoutWidth = Math.max(flyoutWidth, width);\n }\n for (let i = 0, button; button = this.buttons_[i]; i++) {\n flyoutWidth = Math.max(flyoutWidth, button.width);\n }\n flyoutWidth += this.MARGIN * 1.5 + this.tabWidth_;\n flyoutWidth *= this.workspace_.scale;\n flyoutWidth += Scrollbar.scrollbarThickness;\n\n if (this.width_ !== flyoutWidth) {\n for (let i = 0, block; block = blocks[i]; i++) {\n if (this.RTL) {\n // With the flyoutWidth known, right-align the blocks.\n const oldX = block.getRelativeToSurfaceXY().x;\n let newX = flyoutWidth / this.workspace_.scale - this.MARGIN;\n if (!block.outputConnection) {\n newX -= this.tabWidth_;\n }\n block.moveBy(newX - oldX, 0);\n }\n if (this.rectMap_.has(block)) {\n this.moveRectToBlock_(this.rectMap_.get(block)!, block);\n }\n }\n if (this.RTL) {\n // With the flyoutWidth known, right-align the buttons.\n for (let i = 0, button; button = this.buttons_[i]; i++) {\n const y = button.getPosition().y;\n const x = flyoutWidth / this.workspace_.scale - button.width -\n this.MARGIN - this.tabWidth_;\n button.moveTo(x, y);\n }\n }\n\n if (this.targetWorkspace!.toolboxPosition === this.toolboxPosition_ &&\n this.toolboxPosition_ === toolbox.Position.LEFT &&\n !this.targetWorkspace!.getToolbox()) {\n // This flyout is a simple toolbox. Reposition the workspace so that\n // (0,0) is in the correct position relative to the new absolute edge\n // (ie toolbox edge).\n this.targetWorkspace!.translate(\n this.targetWorkspace!.scrollX + flyoutWidth,\n this.targetWorkspace!.scrollY);\n }\n this.width_ = flyoutWidth;\n this.position();\n this.targetWorkspace!.recordDragTargets();\n }\n }\n}\n\nregistry.register(\n registry.Type.FLYOUTS_VERTICAL_TOOLBOX, registry.DEFAULT, VerticalFlyout);\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Horizontal flyout tray containing blocks which may be created.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.HorizontalFlyout');\n\nimport * as browserEvents from './browser_events.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {Flyout, FlyoutItem} from './flyout_base.js';\nimport type {FlyoutButton} from './flyout_button.js';\nimport type {Options} from './options.js';\nimport * as registry from './registry.js';\nimport {Scrollbar} from './scrollbar.js';\nimport type {Coordinate} from './utils/coordinate.js';\nimport {Rect} from './utils/rect.js';\nimport * as toolbox from './utils/toolbox.js';\nimport * as WidgetDiv from './widgetdiv.js';\n\n\n/**\n * Class for a flyout.\n *\n * @alias Blockly.HorizontalFlyout\n */\nexport class HorizontalFlyout extends Flyout {\n override horizontalLayout = true;\n\n /** @param workspaceOptions Dictionary of options for the workspace. */\n constructor(workspaceOptions: Options) {\n super(workspaceOptions);\n }\n\n /**\n * Sets the translation of the flyout to match the scrollbars.\n *\n * @param xyRatio Contains a y property which is a float between 0 and 1\n * specifying the degree of scrolling and a similar x property.\n */\n protected override setMetrics_(xyRatio: {x: number, y: number}) {\n if (!this.isVisible()) {\n return;\n }\n\n const metricsManager = this.workspace_.getMetricsManager();\n const scrollMetrics = metricsManager.getScrollMetrics();\n const viewMetrics = metricsManager.getViewMetrics();\n const absoluteMetrics = metricsManager.getAbsoluteMetrics();\n\n if (typeof xyRatio.x === 'number') {\n this.workspace_.scrollX =\n -(scrollMetrics.left +\n (scrollMetrics.width - viewMetrics.width) * xyRatio.x);\n }\n\n this.workspace_.translate(\n this.workspace_.scrollX + absoluteMetrics.left,\n this.workspace_.scrollY + absoluteMetrics.top);\n }\n\n /**\n * Calculates the x coordinate for the flyout position.\n *\n * @returns X coordinate.\n */\n override getX(): number {\n // X is always 0 since this is a horizontal flyout.\n return 0;\n }\n\n /**\n * Calculates the y coordinate for the flyout position.\n *\n * @returns Y coordinate.\n */\n override getY(): number {\n if (!this.isVisible()) {\n return 0;\n }\n const metricsManager = this.targetWorkspace!.getMetricsManager();\n const absoluteMetrics = metricsManager.getAbsoluteMetrics();\n const viewMetrics = metricsManager.getViewMetrics();\n const toolboxMetrics = metricsManager.getToolboxMetrics();\n\n let y = 0;\n const atTop = this.toolboxPosition_ === toolbox.Position.TOP;\n // If this flyout is not the trashcan flyout (e.g. toolbox or mutator).\n // Trashcan flyout is opposite the main flyout.\n if (this.targetWorkspace!.toolboxPosition === this.toolboxPosition_) {\n // If there is a category toolbox.\n // Simple (flyout-only) toolbox.\n if (this.targetWorkspace!.getToolbox()) {\n if (atTop) {\n y = toolboxMetrics.height;\n } else {\n y = viewMetrics.height - this.height_;\n }\n } else {\n if (atTop) {\n y = 0;\n } else {\n // The simple flyout does not cover the workspace.\n y = viewMetrics.height;\n }\n }\n } else {\n if (atTop) {\n y = 0;\n } else {\n // Because the anchor point of the flyout is on the top, but we want\n // to align the bottom edge of the flyout with the bottom edge of the\n // blocklyDiv, we calculate the full height of the div minus the height\n // of the flyout.\n y = viewMetrics.height + absoluteMetrics.top - this.height_;\n }\n }\n\n return y;\n }\n\n /** Move the flyout to the edge of the workspace. */\n override position() {\n if (!this.isVisible() || !this.targetWorkspace!.isVisible()) {\n return;\n }\n const metricsManager = this.targetWorkspace!.getMetricsManager();\n const targetWorkspaceViewMetrics = metricsManager.getViewMetrics();\n this.width_ = targetWorkspaceViewMetrics.width;\n\n const edgeWidth = targetWorkspaceViewMetrics.width - 2 * this.CORNER_RADIUS;\n const edgeHeight = this.height_ - this.CORNER_RADIUS;\n this.setBackgroundPath_(edgeWidth, edgeHeight);\n\n const x = this.getX();\n const y = this.getY();\n\n this.positionAt_(this.width_, this.height_, x, y);\n }\n\n /**\n * Create and set the path for the visible boundaries of the flyout.\n *\n * @param width The width of the flyout, not including the rounded corners.\n * @param height The height of the flyout, not including rounded corners.\n */\n private setBackgroundPath_(width: number, height: number) {\n const atTop = this.toolboxPosition_ === toolbox.Position.TOP;\n // Start at top left.\n const path: (string|number)[] = ['M 0,' + (atTop ? 0 : this.CORNER_RADIUS)];\n\n if (atTop) {\n // Top.\n path.push('h', width + 2 * this.CORNER_RADIUS);\n // Right.\n path.push('v', height);\n // Bottom.\n path.push(\n 'a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1,\n -this.CORNER_RADIUS, this.CORNER_RADIUS);\n path.push('h', -width);\n // Left.\n path.push(\n 'a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1,\n -this.CORNER_RADIUS, -this.CORNER_RADIUS);\n path.push('z');\n } else {\n // Top.\n path.push(\n 'a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1,\n this.CORNER_RADIUS, -this.CORNER_RADIUS);\n path.push('h', width);\n // Right.\n path.push(\n 'a', this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1,\n this.CORNER_RADIUS, this.CORNER_RADIUS);\n path.push('v', height);\n // Bottom.\n path.push('h', -width - 2 * this.CORNER_RADIUS);\n // Left.\n path.push('z');\n }\n this.svgBackground_!.setAttribute('d', path.join(' '));\n }\n\n /** Scroll the flyout to the top. */\n override scrollToStart() {\n this.workspace_.scrollbar?.setX(this.RTL ? Infinity : 0);\n }\n\n /**\n * Scroll the flyout.\n *\n * @param e Mouse wheel scroll event.\n */\n protected override wheel_(e: WheelEvent) {\n const scrollDelta = browserEvents.getScrollDeltaPixels(e);\n const delta = scrollDelta.x || scrollDelta.y;\n\n if (delta) {\n const metricsManager = this.workspace_.getMetricsManager();\n const scrollMetrics = metricsManager.getScrollMetrics();\n const viewMetrics = metricsManager.getViewMetrics();\n\n const pos = viewMetrics.left - scrollMetrics.left + delta;\n this.workspace_.scrollbar?.setX(pos);\n // When the flyout moves from a wheel event, hide WidgetDiv and\n // dropDownDiv.\n WidgetDiv.hide();\n dropDownDiv.hideWithoutAnimation();\n }\n // Don't scroll the page.\n e.preventDefault();\n // Don't propagate mousewheel event (zooming).\n e.stopPropagation();\n }\n\n /**\n * Lay out the blocks in the flyout.\n *\n * @param contents The blocks and buttons to lay out.\n * @param gaps The visible gaps between blocks.\n */\n protected override layout_(contents: FlyoutItem[], gaps: number[]) {\n this.workspace_.scale = this.targetWorkspace!.scale;\n const margin = this.MARGIN;\n let cursorX = margin + this.tabWidth_;\n const cursorY = margin;\n if (this.RTL) {\n contents = contents.reverse();\n }\n\n for (let i = 0, item; item = contents[i]; i++) {\n if (item.type === 'block') {\n const block = item.block;\n const allBlocks = block!.getDescendants(false);\n for (let j = 0, child; child = allBlocks[j]; j++) {\n // Mark blocks as being inside a flyout. This is used to detect and\n // prevent the closure of the flyout if the user right-clicks on such\n // a block.\n child.isInFlyout = true;\n }\n block!.render();\n const root = block!.getSvgRoot();\n const blockHW = block!.getHeightWidth();\n // Figure out where to place the block.\n const tab = block!.outputConnection ? this.tabWidth_ : 0;\n let moveX;\n if (this.RTL) {\n moveX = cursorX + blockHW.width;\n } else {\n moveX = cursorX - tab;\n }\n block!.moveBy(moveX, cursorY);\n\n const rect = this.createRect_(block!, moveX, cursorY, blockHW, i);\n cursorX += blockHW.width + gaps[i];\n\n this.addBlockListeners_(root, block!, rect);\n } else if (item.type === 'button') {\n const button = item.button as FlyoutButton;\n this.initFlyoutButton_(button, cursorX, cursorY);\n cursorX += button.width + gaps[i];\n }\n }\n }\n\n /**\n * Determine if a drag delta is toward the workspace, based on the position\n * and orientation of the flyout. This is used in determineDragIntention_ to\n * determine if a new block should be created or if the flyout should scroll.\n *\n * @param currentDragDeltaXY How far the pointer has moved from the position\n * at mouse down, in pixel units.\n * @returns True if the drag is toward the workspace.\n * @internal\n */\n override isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean {\n const dx = currentDragDeltaXY.x;\n const dy = currentDragDeltaXY.y;\n // Direction goes from -180 to 180, with 0 toward the right and 90 on top.\n const dragDirection = Math.atan2(dy, dx) / Math.PI * 180;\n\n const range = this.dragAngleRange_;\n // Check for up or down dragging.\n if (dragDirection < 90 + range && dragDirection > 90 - range ||\n dragDirection > -90 - range && dragDirection < -90 + range) {\n return true;\n }\n return false;\n }\n\n /**\n * Returns the bounding rectangle of the drag target area in pixel units\n * relative to viewport.\n *\n * @returns The component's bounding box. Null if drag target area should be\n * ignored.\n */\n override getClientRect(): Rect|null {\n if (!this.svgGroup_ || this.autoClose || !this.isVisible()) {\n // The bounding rectangle won't compute correctly if the flyout is closed\n // and auto-close flyouts aren't valid drag targets (or delete areas).\n return null;\n }\n\n const flyoutRect = this.svgGroup_.getBoundingClientRect();\n // BIG_NUM is offscreen padding so that blocks dragged beyond the shown\n // flyout area are still deleted. Must be larger than the largest screen\n // size, but be smaller than half Number.MAX_SAFE_INTEGER (not available on\n // IE).\n const BIG_NUM = 1000000000;\n const top = flyoutRect.top;\n\n if (this.toolboxPosition_ === toolbox.Position.TOP) {\n const height = flyoutRect.height;\n return new Rect(-BIG_NUM, top + height, -BIG_NUM, BIG_NUM);\n } else { // Bottom.\n return new Rect(top, BIG_NUM, -BIG_NUM, BIG_NUM);\n }\n }\n\n /**\n * Compute height of flyout. toolbox.Position mat under each block.\n * For RTL: Lay out the blocks right-aligned.\n */\n protected override reflowInternal_() {\n this.workspace_.scale = this.getFlyoutScale();\n let flyoutHeight = 0;\n const blocks = this.workspace_.getTopBlocks(false);\n for (let i = 0, block; block = blocks[i]; i++) {\n flyoutHeight = Math.max(flyoutHeight, block.getHeightWidth().height);\n }\n const buttons = this.buttons_;\n for (let i = 0, button; button = buttons[i]; i++) {\n flyoutHeight = Math.max(flyoutHeight, button.height);\n }\n flyoutHeight += this.MARGIN * 1.5;\n flyoutHeight *= this.workspace_.scale;\n flyoutHeight += Scrollbar.scrollbarThickness;\n\n if (this.height_ !== flyoutHeight) {\n for (let i = 0, block; block = blocks[i]; i++) {\n if (this.rectMap_.has(block)) {\n this.moveRectToBlock_(this.rectMap_.get(block)!, block);\n }\n }\n\n if (this.targetWorkspace!.toolboxPosition === this.toolboxPosition_ &&\n this.toolboxPosition_ === toolbox.Position.TOP &&\n !this.targetWorkspace!.getToolbox()) {\n // This flyout is a simple toolbox. Reposition the workspace so that\n // (0,0) is in the correct position relative to the new absolute edge\n // (ie toolbox edge).\n this.targetWorkspace!.translate(\n this.targetWorkspace!.scrollX,\n this.targetWorkspace!.scrollY + flyoutHeight);\n }\n this.height_ = flyoutHeight;\n this.position();\n this.targetWorkspace!.recordDragTargets();\n }\n }\n}\n\nregistry.register(\n registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, registry.DEFAULT,\n HorizontalFlyout);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Variable input field.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldVariable');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport type {Block} from './block.js';\nimport {Field, FieldConfig, UnattachedFieldError} from './field.js';\nimport {FieldDropdown} from './field_dropdown.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as internalConstants from './internal_constants.js';\nimport type {Menu} from './menu.js';\nimport type {MenuItem} from './menuitem.js';\nimport {Msg} from './msg.js';\nimport * as parsing from './utils/parsing.js';\nimport type {Sentinel} from './utils/sentinel.js';\nimport {Size} from './utils/size.js';\nimport {VariableModel} from './variable_model.js';\nimport * as Variables from './variables.js';\nimport * as Xml from './xml.js';\n\n\n/**\n * Class for a variable's dropdown field.\n *\n * @alias Blockly.FieldVariable\n */\nexport class FieldVariable extends FieldDropdown {\n protected override menuGenerator_: AnyDuringMigration[][]|\n ((this: FieldDropdown) => AnyDuringMigration[][]);\n defaultVariableName: string;\n\n /** The type of the default variable for this field. */\n private defaultType_ = '';\n\n /**\n * All of the types of variables that will be available in this field's\n * dropdown.\n */\n variableTypes: string[]|null = [];\n protected override size_: Size;\n\n /** The variable model associated with this field. */\n private variable_: VariableModel|null = null;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable.\n */\n override SERIALIZABLE = true;\n\n /**\n * @param varName The default name for the variable.\n * If null, a unique variable name will be generated.\n * Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by\n * subclasses that want to handle configuration and setting the field value\n * after their own constructors have run).\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a variable ID & returns a validated variable\n * ID, or null to abort the change.\n * @param opt_variableTypes A list of the types of variables to include in the\n * dropdown. Will only be used if opt_config is not provided.\n * @param opt_defaultType The type of variable to create if this field's value\n * is not explicitly set. Defaults to ''. Will only be used if opt_config\n * is not provided.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/variable#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n varName: string|null|Sentinel, opt_validator?: Function,\n opt_variableTypes?: string[], opt_defaultType?: string,\n opt_config?: FieldVariableConfig) {\n super(Field.SKIP_SETUP);\n\n /**\n * An array of options for a dropdown list,\n * or a function which generates these options.\n */\n // AnyDuringMigration because: Type '(this: FieldVariable) => any[][]' is\n // not assignable to type 'any[][] | ((this: FieldDropdown) => any[][])'.\n this.menuGenerator_ = FieldVariable.dropdownCreate as AnyDuringMigration;\n\n /**\n * The initial variable name passed to this field's constructor, or an\n * empty string if a name wasn't provided. Used to create the initial\n * variable.\n */\n this.defaultVariableName = typeof varName === 'string' ? varName : '';\n\n /** The size of the area rendered by the field. */\n this.size_ = new Size(0, 0);\n\n if (varName === Field.SKIP_SETUP) {\n return;\n }\n\n if (opt_config) {\n this.configure_(opt_config);\n } else {\n this.setTypes_(opt_variableTypes, opt_defaultType);\n }\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n protected override configure_(config: FieldVariableConfig) {\n super.configure_(config);\n this.setTypes_(config.variableTypes, config.defaultType);\n }\n\n /**\n * Initialize the model for this field if it has not already been initialized.\n * If the value has not been set to a variable by the first render, we make up\n * a variable rather than let the value be invalid.\n *\n * @internal\n */\n override initModel() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n if (this.variable_) {\n return; // Initialization already happened.\n }\n const variable = Variables.getOrCreateVariablePackage(\n block.workspace, null, this.defaultVariableName, this.defaultType_);\n // Don't call setValue because we don't want to cause a rerender.\n this.doValueUpdate_(variable.getId());\n }\n\n override shouldAddBorderRect_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n return super.shouldAddBorderRect_() &&\n (!this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW ||\n block.type !== 'variables_get');\n }\n\n /**\n * Initialize this field based on the given XML.\n *\n * @param fieldElement The element containing information about the variable\n * field's state.\n */\n override fromXml(fieldElement: Element) {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n const id = fieldElement.getAttribute('id');\n const variableName = fieldElement.textContent;\n // 'variabletype' should be lowercase, but until July 2019 it was sometimes\n // recorded as 'variableType'. Thus we need to check for both.\n const variableType = fieldElement.getAttribute('variabletype') ||\n fieldElement.getAttribute('variableType') || '';\n\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string | undefined'.\n const variable = Variables.getOrCreateVariablePackage(\n block.workspace, id, variableName as AnyDuringMigration, variableType);\n\n // This should never happen :)\n if (variableType !== null && variableType !== variable.type) {\n throw Error(\n 'Serialized variable type with id \\'' + variable.getId() +\n '\\' had type ' + variable.type + ', and ' +\n 'does not match variable field that references it: ' +\n Xml.domToText(fieldElement) + '.');\n }\n\n this.setValue(variable.getId());\n }\n\n /**\n * Serialize this field to XML.\n *\n * @param fieldElement The element to populate with info about the field's\n * state.\n * @returns The element containing info about the field's state.\n */\n override toXml(fieldElement: Element): Element {\n // Make sure the variable is initialized.\n this.initModel();\n\n fieldElement.id = this.variable_!.getId();\n fieldElement.textContent = this.variable_!.name;\n if (this.variable_!.type) {\n fieldElement.setAttribute('variabletype', this.variable_!.type);\n }\n return fieldElement;\n }\n\n /**\n * Saves this field's value.\n *\n * @param doFullSerialization If true, the variable field will serialize the\n * full state of the field being referenced (ie ID, name, and type) rather\n * than just a reference to it (ie ID).\n * @returns The state of the variable field.\n * @internal\n */\n override saveState(doFullSerialization?: boolean): AnyDuringMigration {\n const legacyState = this.saveLegacyState(FieldVariable);\n if (legacyState !== null) {\n return legacyState;\n }\n // Make sure the variable is initialized.\n this.initModel();\n const state = {'id': this.variable_!.getId()};\n if (doFullSerialization) {\n (state as AnyDuringMigration)['name'] = this.variable_!.name;\n (state as AnyDuringMigration)['type'] = this.variable_!.type;\n }\n return state;\n }\n\n /**\n * Sets the field's value based on the given state.\n *\n * @param state The state of the variable to assign to this variable field.\n * @internal\n */\n override loadState(state: AnyDuringMigration) {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n if (this.loadLegacyState(FieldVariable, state)) {\n return;\n }\n // This is necessary so that blocks in the flyout can have custom var names.\n const variable = Variables.getOrCreateVariablePackage(\n block.workspace, state['id'] || null, state['name'],\n state['type'] || '');\n this.setValue(variable.getId());\n }\n\n /**\n * Attach this field to a block.\n *\n * @param block The block containing this field.\n */\n override setSourceBlock(block: Block) {\n if (block.isShadow()) {\n throw Error('Variable fields are not allowed to exist on shadow blocks.');\n }\n super.setSourceBlock(block);\n }\n\n /**\n * Get the variable's ID.\n *\n * @returns Current variable's ID.\n */\n override getValue(): string|null {\n return this.variable_ ? this.variable_.getId() : null;\n }\n\n /**\n * Get the text from this field, which is the selected variable's name.\n *\n * @returns The selected variable's name, or the empty string if no variable\n * is selected.\n */\n override getText(): string {\n return this.variable_ ? this.variable_.name : '';\n }\n\n /**\n * Get the variable model for the selected variable.\n * Not guaranteed to be in the variable map on the workspace (e.g. if accessed\n * after the variable has been deleted).\n *\n * @returns The selected variable, or null if none was selected.\n * @internal\n */\n getVariable(): VariableModel|null {\n return this.variable_;\n }\n\n /**\n * Gets the validation function for this field, or null if not set.\n * Returns null if the variable is not set, because validators should not\n * run on the initial setValue call, because the field won't be attached to\n * a block and workspace at that point.\n *\n * @returns Validation function, or null.\n */\n override getValidator(): Function|null {\n // Validators shouldn't operate on the initial setValue call.\n // Normally this is achieved by calling setValidator after setValue, but\n // this is not a possibility with variable fields.\n if (this.variable_) {\n return this.validator_;\n }\n return null;\n }\n\n /**\n * Ensure that the ID belongs to a valid variable of an allowed type.\n *\n * @param opt_newValue The ID of the new variable to set.\n * @returns The validated ID, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n string|null {\n if (opt_newValue === null) {\n return null;\n }\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n const newId = opt_newValue as string;\n const variable = Variables.getVariable(block.workspace, newId);\n if (!variable) {\n console.warn(\n 'Variable id doesn\\'t point to a real variable! ' +\n 'ID was ' + newId);\n return null;\n }\n // Type Checks.\n const type = variable.type;\n if (!this.typeIsAllowed_(type)) {\n console.warn(\n 'Variable type doesn\\'t match this field! Type was ' + type);\n return null;\n }\n return newId;\n }\n\n /**\n * Update the value of this variable field, as well as its variable and text.\n *\n * The variable ID should be valid at this point, but if a variable field\n * validator returns a bad ID, this could break.\n *\n * @param newId The value to be saved.\n */\n protected override doValueUpdate_(newId: AnyDuringMigration) {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n this.variable_ = Variables.getVariable(block.workspace, newId as string);\n super.doValueUpdate_(newId);\n }\n\n /**\n * Check whether the given variable type is allowed on this field.\n *\n * @param type The type to check.\n * @returns True if the type is in the list of allowed types.\n */\n private typeIsAllowed_(type: string): boolean {\n const typeList = this.getVariableTypes_();\n if (!typeList) {\n return true; // If it's null, all types are valid.\n }\n for (let i = 0; i < typeList.length; i++) {\n if (type === typeList[i]) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Return a list of variable types to include in the dropdown.\n *\n * @returns Array of variable types.\n * @throws {Error} if variableTypes is an empty array.\n */\n private getVariableTypes_(): string[] {\n // TODO (#1513): Try to avoid calling this every time the field is edited.\n let variableTypes = this.variableTypes;\n if (variableTypes === null) {\n // If variableTypes is null, return all variable types.\n if (this.sourceBlock_ && !this.sourceBlock_.isDeadOrDying()) {\n return this.sourceBlock_.workspace.getVariableTypes();\n }\n }\n variableTypes = variableTypes || [''];\n if (variableTypes.length === 0) {\n // Throw an error if variableTypes is an empty list.\n const name = this.getText();\n throw Error(\n '\\'variableTypes\\' of field variable ' + name + ' was an empty list');\n }\n return variableTypes;\n }\n\n /**\n * Parse the optional arguments representing the allowed variable types and\n * the default variable type.\n *\n * @param opt_variableTypes A list of the types of variables to include in the\n * dropdown. If null or undefined, variables of all types will be\n * displayed in the dropdown.\n * @param opt_defaultType The type of the variable to create if this field's\n * value is not explicitly set. Defaults to ''.\n */\n private setTypes_(opt_variableTypes?: string[], opt_defaultType?: string) {\n // If you expected that the default type would be the same as the only entry\n // in the variable types array, tell the Blockly team by commenting on\n // #1499.\n const defaultType = opt_defaultType || '';\n let variableTypes;\n // Set the allowable variable types. Null means all types on the workspace.\n if (opt_variableTypes === null || opt_variableTypes === undefined) {\n variableTypes = null;\n } else if (Array.isArray(opt_variableTypes)) {\n variableTypes = opt_variableTypes;\n // Make sure the default type is valid.\n let isInArray = false;\n for (let i = 0; i < variableTypes.length; i++) {\n if (variableTypes[i] === defaultType) {\n isInArray = true;\n }\n }\n if (!isInArray) {\n throw Error(\n 'Invalid default type \\'' + defaultType + '\\' in ' +\n 'the definition of a FieldVariable');\n }\n } else {\n throw Error(\n '\\'variableTypes\\' was not an array in the definition of ' +\n 'a FieldVariable');\n }\n // Only update the field once all checks pass.\n this.defaultType_ = defaultType;\n this.variableTypes = variableTypes;\n }\n\n /**\n * Refreshes the name of the variable by grabbing the name of the model.\n * Used when a variable gets renamed, but the ID stays the same. Should only\n * be called by the block.\n *\n * @internal\n */\n override refreshVariableName() {\n this.forceRerender();\n }\n\n /**\n * Handle the selection of an item in the variable dropdown menu.\n * Special case the 'Rename variable...' and 'Delete variable...' options.\n * In the rename case, prompt the user for a new name.\n *\n * @param menu The Menu component clicked.\n * @param menuItem The MenuItem selected within menu.\n */\n protected override onItemSelected_(menu: Menu, menuItem: MenuItem) {\n const id = menuItem.getValue();\n // Handle special cases.\n if (this.sourceBlock_ && !this.sourceBlock_.isDeadOrDying()) {\n if (id === internalConstants.RENAME_VARIABLE_ID) {\n // Rename variable.\n Variables.renameVariable(\n this.sourceBlock_.workspace, this.variable_ as VariableModel);\n return;\n } else if (id === internalConstants.DELETE_VARIABLE_ID) {\n // Delete variable.\n this.sourceBlock_.workspace.deleteVariableById(this.variable_!.getId());\n return;\n }\n }\n // Handle unspecial case.\n this.setValue(id);\n }\n\n /**\n * Overrides referencesVariables(), indicating this field refers to a\n * variable.\n *\n * @returns True.\n * @internal\n */\n override referencesVariables(): boolean {\n return true;\n }\n\n /**\n * Construct a FieldVariable from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (variable, variableTypes, and\n * defaultType).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static override fromJson(options: FieldVariableFromJsonConfig):\n FieldVariable {\n const varName = parsing.replaceMessageReferences(options.variable);\n // `this` might be a subclass of FieldVariable if that class doesn't\n // override the static fromJson method.\n return new this(varName, undefined, undefined, undefined, options);\n }\n\n /**\n * Return a sorted list of variable names for variable dropdown menus.\n * Include a special option at the end for creating a new variable name.\n *\n * @returns Array of variable names/id tuples.\n */\n static dropdownCreate(this: FieldVariable): AnyDuringMigration[][] {\n if (!this.variable_) {\n throw Error(\n 'Tried to call dropdownCreate on a variable field with no' +\n ' variable selected.');\n }\n const name = this.getText();\n let variableModelList: AnyDuringMigration[] = [];\n if (this.sourceBlock_ && !this.sourceBlock_.isDeadOrDying()) {\n const variableTypes = this.getVariableTypes_();\n // Get a copy of the list, so that adding rename and new variable options\n // doesn't modify the workspace's list.\n for (let i = 0; i < variableTypes.length; i++) {\n const variableType = variableTypes[i];\n const variables =\n this.sourceBlock_.workspace.getVariablesOfType(variableType);\n variableModelList = variableModelList.concat(variables);\n }\n }\n variableModelList.sort(VariableModel.compareByName);\n\n const options = [];\n for (let i = 0; i < variableModelList.length; i++) {\n // Set the UUID as the internal representation of the variable.\n options[i] = [variableModelList[i].name, variableModelList[i].getId()];\n }\n options.push(\n [Msg['RENAME_VARIABLE'], internalConstants.RENAME_VARIABLE_ID]);\n if (Msg['DELETE_VARIABLE']) {\n options.push([\n Msg['DELETE_VARIABLE'].replace('%1', name),\n internalConstants.DELETE_VARIABLE_ID,\n ]);\n }\n\n return options;\n }\n}\n\nfieldRegistry.register('field_variable', FieldVariable);\n\n/**\n * Config options for the variable field.\n */\nexport interface FieldVariableConfig extends FieldConfig {\n variableTypes?: string[];\n defaultType?: string;\n}\n\n/**\n * fromJson config options for the variable field.\n */\nexport interface FieldVariableFromJsonConfig extends FieldVariableConfig {\n variable?: string;\n}\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Number input field\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldNumber');\n\nimport {Field} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {FieldTextInputConfig, FieldTextInput} from './field_textinput.js';\nimport * as aria from './utils/aria.js';\nimport type {Sentinel} from './utils/sentinel.js';\n\n\n/**\n * Class for an editable number field.\n *\n * @alias Blockly.FieldNumber\n */\nexport class FieldNumber extends FieldTextInput {\n /** The minimum value this number field can contain. */\n protected min_ = -Infinity;\n\n /** The maximum value this number field can contain. */\n protected max_ = Infinity;\n\n /** The multiple to which this fields value is rounded. */\n protected precision_ = 0;\n\n /**\n * The number of decimal places to allow, or null to allow any number of\n * decimal digits.\n */\n private decimalPlaces_: number|null = null;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable.\n */\n override SERIALIZABLE = true;\n\n /**\n * @param opt_value The initial value of the field. Should cast to a number.\n * Defaults to 0. Also accepts Field.SKIP_SETUP if you wish to skip setup\n * (only used by subclasses that want to handle configuration and setting\n * the field value after their own constructors have run).\n * @param opt_min Minimum value. Will only be used if opt_config is not\n * provided.\n * @param opt_max Maximum value. Will only be used if opt_config is not\n * provided.\n * @param opt_precision Precision for value. Will only be used if opt_config\n * is not provided.\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a number & returns a validated number, or null\n * to abort the change.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/number#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string|number|Sentinel, opt_min?: string|number|null,\n opt_max?: string|number|null, opt_precision?: string|number|null,\n opt_validator?: Function|null, opt_config?: FieldNumberConfig) {\n // Pass SENTINEL so that we can define properties before value validation.\n super(Field.SKIP_SETUP);\n\n if (opt_value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n } else {\n this.setConstraints(opt_min, opt_max, opt_precision);\n }\n this.setValue(opt_value);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n protected override configure_(config: FieldNumberConfig) {\n super.configure_(config);\n this.setMinInternal_(config.min);\n this.setMaxInternal_(config.max);\n this.setPrecisionInternal_(config.precision);\n }\n\n /**\n * Set the maximum, minimum and precision constraints on this field.\n * Any of these properties may be undefined or NaN to be disabled.\n * Setting precision (usually a power of 10) enforces a minimum step between\n * values. That is, the user's value will rounded to the closest multiple of\n * precision. The least significant digit place is inferred from the\n * precision. Integers values can be enforces by choosing an integer\n * precision.\n *\n * @param min Minimum value.\n * @param max Maximum value.\n * @param precision Precision for value.\n */\n setConstraints(\n min: number|string|undefined|null, max: number|string|undefined|null,\n precision: number|string|undefined|null) {\n this.setMinInternal_(min);\n this.setMaxInternal_(max);\n this.setPrecisionInternal_(precision);\n this.setValue(this.getValue());\n }\n\n /**\n * Sets the minimum value this field can contain. Updates the value to\n * reflect.\n *\n * @param min Minimum value.\n */\n setMin(min: number|string|undefined|null) {\n this.setMinInternal_(min);\n this.setValue(this.getValue());\n }\n\n /**\n * Sets the minimum value this field can contain. Called internally to avoid\n * value updates.\n *\n * @param min Minimum value.\n */\n private setMinInternal_(min: number|string|undefined|null) {\n if (min == null) {\n this.min_ = -Infinity;\n } else {\n min = Number(min);\n if (!isNaN(min)) {\n this.min_ = min;\n }\n }\n }\n\n /**\n * Returns the current minimum value this field can contain. Default is\n * -Infinity.\n *\n * @returns The current minimum value this field can contain.\n */\n getMin(): number {\n return this.min_;\n }\n\n /**\n * Sets the maximum value this field can contain. Updates the value to\n * reflect.\n *\n * @param max Maximum value.\n */\n setMax(max: number|string|undefined|null) {\n this.setMaxInternal_(max);\n this.setValue(this.getValue());\n }\n\n /**\n * Sets the maximum value this field can contain. Called internally to avoid\n * value updates.\n *\n * @param max Maximum value.\n */\n private setMaxInternal_(max: number|string|undefined|null) {\n if (max == null) {\n this.max_ = Infinity;\n } else {\n max = Number(max);\n if (!isNaN(max)) {\n this.max_ = max;\n }\n }\n }\n\n /**\n * Returns the current maximum value this field can contain. Default is\n * Infinity.\n *\n * @returns The current maximum value this field can contain.\n */\n getMax(): number {\n return this.max_;\n }\n\n /**\n * Sets the precision of this field's value, i.e. the number to which the\n * value is rounded. Updates the field to reflect.\n *\n * @param precision The number to which the field's value is rounded.\n */\n setPrecision(precision: number|string|undefined|null) {\n this.setPrecisionInternal_(precision);\n this.setValue(this.getValue());\n }\n\n /**\n * Sets the precision of this field's value. Called internally to avoid\n * value updates.\n *\n * @param precision The number to which the field's value is rounded.\n */\n private setPrecisionInternal_(precision: number|string|undefined|null) {\n this.precision_ = Number(precision) || 0;\n let precisionString = String(this.precision_);\n if (precisionString.indexOf('e') !== -1) {\n // String() is fast. But it turns .0000001 into '1e-7'.\n // Use the much slower toLocaleString to access all the digits.\n precisionString =\n this.precision_.toLocaleString('en-US', {maximumFractionDigits: 20});\n }\n const decimalIndex = precisionString.indexOf('.');\n if (decimalIndex === -1) {\n // If the precision is 0 (float) allow any number of decimals,\n // otherwise allow none.\n this.decimalPlaces_ = precision ? 0 : null;\n } else {\n this.decimalPlaces_ = precisionString.length - decimalIndex - 1;\n }\n }\n\n /**\n * Returns the current precision of this field. The precision being the\n * number to which the field's value is rounded. A precision of 0 means that\n * the value is not rounded.\n *\n * @returns The number to which this field's value is rounded.\n */\n getPrecision(): number {\n return this.precision_;\n }\n\n /**\n * Ensure that the input value is a valid number (must fulfill the\n * constraints placed on the field).\n *\n * @param opt_newValue The input value.\n * @returns A valid number, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n number|null {\n if (opt_newValue === null) {\n return null;\n }\n // Clean up text.\n let newValue = String(opt_newValue);\n // TODO: Handle cases like 'ten', '1.203,14', etc.\n // 'O' is sometimes mistaken for '0' by inexperienced users.\n newValue = newValue.replace(/O/ig, '0');\n // Strip out thousands separators.\n newValue = newValue.replace(/,/g, '');\n // Ignore case of 'Infinity'.\n newValue = newValue.replace(/infinity/i, 'Infinity');\n\n // Clean up number.\n let n = Number(newValue || 0);\n if (isNaN(n)) {\n // Invalid number.\n return null;\n }\n // Get the value in range.\n n = Math.min(Math.max(n, this.min_), this.max_);\n // Round to nearest multiple of precision.\n if (this.precision_ && isFinite(n)) {\n n = Math.round(n / this.precision_) * this.precision_;\n }\n // Clean up floating point errors.\n if (this.decimalPlaces_ !== null) {\n n = Number(n.toFixed(this.decimalPlaces_));\n }\n return n;\n }\n\n /**\n * Create the number input editor widget.\n *\n * @returns The newly created number input editor.\n */\n protected override widgetCreate_(): HTMLElement {\n const htmlInput = super.widgetCreate_();\n\n // Set the accessibility state\n if (this.min_ > -Infinity) {\n aria.setState(htmlInput, aria.State.VALUEMIN, this.min_);\n }\n if (this.max_ < Infinity) {\n aria.setState(htmlInput, aria.State.VALUEMAX, this.max_);\n }\n return htmlInput;\n }\n\n /**\n * Construct a FieldNumber from a JSON arg object.\n *\n * @param options A JSON object with options (value, min, max, and precision).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static override fromJson(options: FieldNumberFromJsonConfig): FieldNumber {\n // `this` might be a subclass of FieldNumber if that class doesn't override\n // the static fromJson method.\n return new this(\n options.value, undefined, undefined, undefined, undefined, options);\n }\n}\n\nfieldRegistry.register('field_number', FieldNumber);\n\n(FieldNumber.prototype as AnyDuringMigration).DEFAULT_VALUE = 0;\n\n/**\n * Config options for the number field.\n */\nexport interface FieldNumberConfig extends FieldTextInputConfig {\n min?: number;\n max?: number;\n precision?: number;\n}\n\n/**\n * fromJson config options for the number field.\n */\nexport interface FieldNumberFromJsonConfig extends FieldNumberConfig {\n value?: number;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Text Area field.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldMultilineInput');\n\nimport * as Css from './css.js';\nimport {Field, UnattachedFieldError} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {FieldTextInputConfig, FieldTextInput} from './field_textinput.js';\nimport * as aria from './utils/aria.js';\nimport * as dom from './utils/dom.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport * as parsing from './utils/parsing.js';\nimport type {Sentinel} from './utils/sentinel.js';\nimport {Svg} from './utils/svg.js';\nimport * as userAgent from './utils/useragent.js';\nimport * as WidgetDiv from './widgetdiv.js';\n\n\n/**\n * Class for an editable text area field.\n *\n * @alias Blockly.FieldMultilineInput\n */\nexport class FieldMultilineInput extends FieldTextInput {\n /**\n * The SVG group element that will contain a text element for each text row\n * when initialized.\n */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'SVGGElement'.\n textGroup_: SVGGElement = null as AnyDuringMigration;\n\n /**\n * Defines the maximum number of lines of field.\n * If exceeded, scrolling functionality is enabled.\n */\n protected maxLines_ = Infinity;\n\n /** Whether Y overflow is currently occurring. */\n protected isOverflowedY_ = false;\n\n /**\n * @param opt_value The initial content of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param opt_validator An optional function that is called to validate any\n * constraints on what the user entered. Takes the new text as an\n * argument and returns either the accepted text, a replacement text, or\n * null to abort the change.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/multiline-text-input#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string|Sentinel, opt_validator?: Function,\n opt_config?: FieldMultilineInputConfig) {\n super(Field.SKIP_SETUP);\n\n if (opt_value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n }\n this.setValue(opt_value);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n protected override configure_(config: FieldMultilineInputConfig) {\n super.configure_(config);\n if (config.maxLines) this.setMaxLines(config.maxLines);\n }\n\n /**\n * Serializes this field's value to XML. Should only be called by Blockly.Xml.\n *\n * @param fieldElement The element to populate with info about the field's\n * state.\n * @returns The element containing info about the field's state.\n * @internal\n */\n override toXml(fieldElement: Element): Element {\n // Replace '\\n' characters with HTML-escaped equivalent '
'. This is\n // needed so the plain-text representation of the XML produced by\n // `Blockly.Xml.domToText` will appear on a single line (this is a\n // limitation of the plain-text format).\n fieldElement.textContent =\n (this.getValue() as string).replace(/\\n/g, ' ');\n return fieldElement;\n }\n\n /**\n * Sets the field's value based on the given XML element. Should only be\n * called by Blockly.Xml.\n *\n * @param fieldElement The element containing info about the field's state.\n * @internal\n */\n override fromXml(fieldElement: Element) {\n this.setValue(fieldElement.textContent!.replace(/ /g, '\\n'));\n }\n\n /**\n * Saves this field's value.\n *\n * @returns The state of this field.\n * @internal\n */\n override saveState(): AnyDuringMigration {\n const legacyState = this.saveLegacyState(FieldMultilineInput);\n if (legacyState !== null) {\n return legacyState;\n }\n return this.getValue();\n }\n\n /**\n * Sets the field's value based on the given state.\n *\n * @param state The state of the variable to assign to this variable field.\n * @internal\n */\n override loadState(state: AnyDuringMigration) {\n if (this.loadLegacyState(Field, state)) {\n return;\n }\n this.setValue(state);\n }\n\n /**\n * Create the block UI for this field.\n *\n * @internal\n */\n override initView() {\n this.createBorderRect_();\n this.textGroup_ = dom.createSvgElement(\n Svg.G, {\n 'class': 'blocklyEditableText',\n },\n this.fieldGroup_);\n }\n\n /**\n * Get the text from this field as displayed on screen. May differ from\n * getText due to ellipsis, and other formatting.\n *\n * @returns Currently displayed text.\n */\n protected override getDisplayText_(): string {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n let textLines = this.getText();\n if (!textLines) {\n // Prevent the field from disappearing if empty.\n return Field.NBSP;\n }\n const lines = textLines.split('\\n');\n textLines = '';\n const displayLinesNumber =\n this.isOverflowedY_ ? this.maxLines_ : lines.length;\n for (let i = 0; i < displayLinesNumber; i++) {\n let text = lines[i];\n if (text.length > this.maxDisplayLength) {\n // Truncate displayed string and add an ellipsis ('...').\n text = text.substring(0, this.maxDisplayLength - 4) + '...';\n } else if (this.isOverflowedY_ && i === displayLinesNumber - 1) {\n text = text.substring(0, text.length - 3) + '...';\n }\n // Replace whitespace with non-breaking spaces so the text doesn't\n // collapse.\n text = text.replace(/\\s/g, Field.NBSP);\n\n textLines += text;\n if (i !== displayLinesNumber - 1) {\n textLines += '\\n';\n }\n }\n if (block.RTL) {\n // The SVG is LTR, force value to be RTL.\n textLines += '\\u200F';\n }\n return textLines;\n }\n\n /**\n * Called by setValue if the text input is valid. Updates the value of the\n * field, and updates the text of the field if it is not currently being\n * edited (i.e. handled by the htmlInput_). Is being redefined here to update\n * overflow state of the field.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a string.\n */\n protected override doValueUpdate_(newValue: AnyDuringMigration) {\n super.doValueUpdate_(newValue);\n this.isOverflowedY_ = this.value_.split('\\n').length > this.maxLines_;\n }\n\n /** Updates the text of the textElement. */\n protected override render_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n // Remove all text group children.\n let currentChild;\n while (currentChild = this.textGroup_.firstChild) {\n this.textGroup_.removeChild(currentChild);\n }\n\n // Add in text elements into the group.\n const lines = this.getDisplayText_().split('\\n');\n let y = 0;\n for (let i = 0; i < lines.length; i++) {\n const lineHeight = this.getConstants()!.FIELD_TEXT_HEIGHT +\n this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING;\n const span = dom.createSvgElement(\n Svg.TEXT, {\n 'class': 'blocklyText blocklyMultilineText',\n 'x': this.getConstants()!.FIELD_BORDER_RECT_X_PADDING,\n 'y': y + this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING,\n 'dy': this.getConstants()!.FIELD_TEXT_BASELINE,\n },\n this.textGroup_);\n span.appendChild(document.createTextNode(lines[i]));\n y += lineHeight;\n }\n\n if (this.isBeingEdited_) {\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (this.isOverflowedY_) {\n dom.addClass(htmlInput, 'blocklyHtmlTextAreaInputOverflowedY');\n } else {\n dom.removeClass(htmlInput, 'blocklyHtmlTextAreaInputOverflowedY');\n }\n }\n\n this.updateSize_();\n\n if (this.isBeingEdited_) {\n if (block.RTL) {\n // in RTL, we need to let the browser reflow before resizing\n // in order to get the correct bounding box of the borderRect\n // avoiding issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (!this.isTextValid_) {\n dom.addClass(htmlInput, 'blocklyInvalidInput');\n aria.setState(htmlInput, aria.State.INVALID, true);\n } else {\n dom.removeClass(htmlInput, 'blocklyInvalidInput');\n aria.setState(htmlInput, aria.State.INVALID, false);\n }\n }\n }\n\n /** Updates the size of the field based on the text. */\n protected override updateSize_() {\n const nodes = this.textGroup_.childNodes;\n const fontSize = this.getConstants()!.FIELD_TEXT_FONTSIZE;\n const fontWeight = this.getConstants()!.FIELD_TEXT_FONTWEIGHT;\n const fontFamily = this.getConstants()!.FIELD_TEXT_FONTFAMILY;\n let totalWidth = 0;\n let totalHeight = 0;\n for (let i = 0; i < nodes.length; i++) {\n const tspan = nodes[i] as SVGTextElement;\n const textWidth =\n dom.getFastTextWidth(tspan, fontSize, fontWeight, fontFamily);\n if (textWidth > totalWidth) {\n totalWidth = textWidth;\n }\n totalHeight += this.getConstants()!.FIELD_TEXT_HEIGHT +\n (i > 0 ? this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING : 0);\n }\n if (this.isBeingEdited_) {\n // The default width is based on the longest line in the display text,\n // but when it's being edited, width should be calculated based on the\n // absolute longest line, even if it would be truncated after editing.\n // Otherwise we would get wrong editor width when there are more\n // lines than this.maxLines_.\n const actualEditorLines = this.value_.split('\\n');\n const dummyTextElement = dom.createSvgElement(\n Svg.TEXT, {'class': 'blocklyText blocklyMultilineText'});\n\n for (let i = 0; i < actualEditorLines.length; i++) {\n if (actualEditorLines[i].length > this.maxDisplayLength) {\n actualEditorLines[i] =\n actualEditorLines[i].substring(0, this.maxDisplayLength);\n }\n dummyTextElement.textContent = actualEditorLines[i];\n const lineWidth = dom.getFastTextWidth(\n dummyTextElement, fontSize, fontWeight, fontFamily);\n if (lineWidth > totalWidth) {\n totalWidth = lineWidth;\n }\n }\n\n const scrollbarWidth =\n this.htmlInput_!.offsetWidth - this.htmlInput_!.clientWidth;\n totalWidth += scrollbarWidth;\n }\n if (this.borderRect_) {\n totalHeight += this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING * 2;\n totalWidth += this.getConstants()!.FIELD_BORDER_RECT_X_PADDING * 2;\n // AnyDuringMigration because: Argument of type 'number' is not\n // assignable to parameter of type 'string'.\n this.borderRect_.setAttribute('width', totalWidth as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not\n // assignable to parameter of type 'string'.\n this.borderRect_.setAttribute(\n 'height', totalHeight as AnyDuringMigration);\n }\n this.size_.width = totalWidth;\n this.size_.height = totalHeight;\n\n this.positionBorderRect_();\n }\n\n /**\n * Show the inline free-text editor on top of the text.\n * Overrides the default behaviour to force rerender in order to\n * correct block size, based on editor text.\n *\n * @param _opt_e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n * @param opt_quietInput True if editor should be created without focus.\n * Defaults to false.\n */\n override showEditor_(_opt_e?: Event, opt_quietInput?: boolean) {\n super.showEditor_(_opt_e, opt_quietInput);\n this.forceRerender();\n }\n\n /**\n * Create the text input editor widget.\n *\n * @returns The newly created text input editor.\n */\n protected override widgetCreate_(): HTMLTextAreaElement {\n const div = WidgetDiv.getDiv();\n const scale = this.workspace_!.getScale();\n\n const htmlInput = (document.createElement('textarea'));\n htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput';\n // AnyDuringMigration because: Argument of type 'boolean' is not assignable\n // to parameter of type 'string'.\n htmlInput.setAttribute(\n 'spellcheck', this.spellcheck_ as AnyDuringMigration);\n const fontSize = this.getConstants()!.FIELD_TEXT_FONTSIZE * scale + 'pt';\n div!.style.fontSize = fontSize;\n htmlInput.style.fontSize = fontSize;\n const borderRadius = FieldTextInput.BORDERRADIUS * scale + 'px';\n htmlInput.style.borderRadius = borderRadius;\n const paddingX = this.getConstants()!.FIELD_BORDER_RECT_X_PADDING * scale;\n const paddingY =\n this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING * scale / 2;\n htmlInput.style.padding = paddingY + 'px ' + paddingX + 'px ' + paddingY +\n 'px ' + paddingX + 'px';\n const lineHeight = this.getConstants()!.FIELD_TEXT_HEIGHT +\n this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING;\n htmlInput.style.lineHeight = lineHeight * scale + 'px';\n\n div!.appendChild(htmlInput);\n\n htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_);\n htmlInput.setAttribute('data-untyped-default-value', this.value_);\n htmlInput.setAttribute('data-old-value', '');\n if (userAgent.GECKO) {\n // In FF, ensure the browser reflows before resizing to avoid issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n\n this.bindInputEvents_(htmlInput);\n\n return htmlInput;\n }\n\n /**\n * Sets the maxLines config for this field.\n *\n * @param maxLines Defines the maximum number of lines allowed, before\n * scrolling functionality is enabled.\n */\n setMaxLines(maxLines: number) {\n if (typeof maxLines === 'number' && maxLines > 0 &&\n maxLines !== this.maxLines_) {\n this.maxLines_ = maxLines;\n this.forceRerender();\n }\n }\n\n /**\n * Returns the maxLines config of this field.\n *\n * @returns The maxLines config value.\n */\n getMaxLines(): number {\n return this.maxLines_;\n }\n\n /**\n * Handle key down to the editor. Override the text input definition of this\n * so as to not close the editor when enter is typed in.\n *\n * @param e Keyboard event.\n */\n protected override onHtmlInputKeyDown_(e: Event) {\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n if ((e as AnyDuringMigration).keyCode !== KeyCodes.ENTER) {\n super.onHtmlInputKeyDown_(e);\n }\n }\n\n /**\n * Construct a FieldMultilineInput from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and spellcheck).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static override fromJson(options: FieldMultilineInputFromJsonConfig):\n FieldMultilineInput {\n const text = parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldMultilineInput if that class doesn't\n // override the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n\n/** CSS for multiline field. See css.js for use. */\nCss.register(`\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n`);\n\nfieldRegistry.register('field_multilinetext', FieldMultilineInput);\n\n/**\n * Config options for the multiline input field.\n */\nexport interface FieldMultilineInputConfig extends FieldTextInputConfig {\n maxLines?: number;\n}\n\n/**\n * fromJson config options for the multiline input field.\n */\nexport interface FieldMultilineInputFromJsonConfig extends\n FieldMultilineInputConfig {\n text?: string;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Non-editable, serializable text field. Behaves like a\n * normal label but is serialized to XML. It may only be\n * edited programmatically.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldLabelSerializable');\n\nimport {FieldLabelConfig, FieldLabelFromJsonConfig, FieldLabel} from './field_label.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as parsing from './utils/parsing.js';\n\n\n/**\n * Class for a non-editable, serializable text field.\n *\n * @alias Blockly.FieldLabelSerializable\n */\nexport class FieldLabelSerializable extends FieldLabel {\n /**\n * Editable fields usually show some sort of UI indicating they are\n * editable. This field should not.\n */\n override EDITABLE = false;\n\n /**\n * Serializable fields are saved by the XML renderer, non-serializable\n * fields are not. This field should be serialized, but only edited\n * programmatically.\n */\n override SERIALIZABLE = true;\n\n /**\n * @param opt_value The initial value of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined.\n * @param opt_class Optional CSS class for the field's text.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/label-serializable#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string, opt_class?: string, opt_config?: FieldLabelConfig) {\n super(String(opt_value ?? ''), opt_class, opt_config);\n }\n\n /**\n * Construct a FieldLabelSerializable from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and class).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static override fromJson(options: FieldLabelFromJsonConfig):\n FieldLabelSerializable {\n const text = parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldLabelSerializable if that class\n // doesn't override the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n\nfieldRegistry.register('field_label_serializable', FieldLabelSerializable);\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Colour input field.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldColour');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as Css from './css.js';\nimport * as dom from './utils/dom.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {FieldConfig, Field} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as aria from './utils/aria.js';\nimport * as colour from './utils/colour.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport type {Sentinel} from './utils/sentinel.js';\nimport {Size} from './utils/size.js';\n\n\n/**\n * Class for a colour input field.\n *\n * @alias Blockly.FieldColour\n */\nexport class FieldColour extends Field {\n /**\n * An array of colour strings for the palette.\n * Copied from goog.ui.ColorPicker.SIMPLE_GRID_COLORS\n * All colour pickers use this unless overridden with setColours.\n */\n static COLOURS: string[] = [\n // grays\n '#ffffff', '#cccccc', '#c0c0c0', '#999999',\n '#666666', '#333333', '#000000', // reds\n '#ffcccc', '#ff6666', '#ff0000', '#cc0000',\n '#990000', '#660000', '#330000', // oranges\n '#ffcc99', '#ff9966', '#ff9900', '#ff6600',\n '#cc6600', '#993300', '#663300', // yellows\n '#ffff99', '#ffff66', '#ffcc66', '#ffcc33',\n '#cc9933', '#996633', '#663333', // olives\n '#ffffcc', '#ffff33', '#ffff00', '#ffcc00',\n '#999900', '#666600', '#333300', // greens\n '#99ff99', '#66ff99', '#33ff33', '#33cc00',\n '#009900', '#006600', '#003300', // turquoises\n '#99ffff', '#33ffff', '#66cccc', '#00cccc',\n '#339999', '#336666', '#003333', // blues\n '#ccffff', '#66ffff', '#33ccff', '#3366ff',\n '#3333ff', '#000099', '#000066', // purples\n '#ccccff', '#9999ff', '#6666cc', '#6633ff',\n '#6600cc', '#333399', '#330099', // violets\n '#ffccff', '#ff99ff', '#cc66cc', '#cc33cc',\n '#993399', '#663366', '#330033',\n ];\n\n /**\n * An array of tooltip strings for the palette. If not the same length as\n * COLOURS, the colour's hex code will be used for any missing titles.\n * All colour pickers use this unless overridden with setColours.\n */\n static TITLES: string[] = [];\n\n /**\n * Number of columns in the palette.\n * All colour pickers use this unless overridden with setColumns.\n */\n static COLUMNS = 7;\n\n /** The field's colour picker element. */\n private picker_: Element|null = null;\n\n /** Index of the currently highlighted element. */\n private highlightedIndex_: number|null = null;\n\n /** Mouse click event data. */\n private onClickWrapper_: browserEvents.Data|null = null;\n\n /** Mouse move event data. */\n private onMouseMoveWrapper_: browserEvents.Data|null = null;\n\n /** Mouse enter event data. */\n private onMouseEnterWrapper_: browserEvents.Data|null = null;\n\n /** Mouse leave event data. */\n private onMouseLeaveWrapper_: browserEvents.Data|null = null;\n\n /** Key down event data. */\n private onKeyDownWrapper_: browserEvents.Data|null = null;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable.\n */\n override SERIALIZABLE = true;\n\n /** Mouse cursor style when over the hotspot that initiates the editor. */\n override CURSOR = 'default';\n\n /**\n * Used to tell if the field needs to be rendered the next time the block is\n * rendered. Colour fields are statically sized, and only need to be\n * rendered at initialization.\n */\n protected override isDirty_ = false;\n\n /** Array of colours used by this field. If null, use the global list. */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'string[]'.\n private colours_: string[] = null as AnyDuringMigration;\n\n /**\n * Array of colour tooltips used by this field. If null, use the global\n * list.\n */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'string[]'.\n private titles_: string[] = null as AnyDuringMigration;\n\n /**\n * Number of colour columns used by this field. If 0, use the global\n * setting. By default use the global constants for columns.\n */\n private columns_ = 0;\n override size_: AnyDuringMigration;\n override clickTarget_: AnyDuringMigration;\n override value_: AnyDuringMigration;\n\n /**\n * @param opt_value The initial value of the field. Should be in '#rrggbb'\n * format. Defaults to the first value in the default colour array. Also\n * accepts Field.SKIP_SETUP if you wish to skip setup (only used by\n * subclasses that want to handle configuration and setting the field\n * value after their own constructors have run).\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a colour string & returns a validated colour\n * string ('#rrggbb' format), or null to abort the change.Blockly.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/colour}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string|Sentinel, opt_validator?: Function,\n opt_config?: FieldColourConfig) {\n super(Field.SKIP_SETUP);\n\n if (opt_value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n }\n this.setValue(opt_value);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n protected override configure_(config: FieldColourConfig) {\n super.configure_(config);\n if (config.colourOptions) this.colours_ = config.colourOptions;\n if (config.colourTitles) this.titles_ = config.colourTitles;\n if (config.columns) this.columns_ = config.columns;\n }\n\n /**\n * Create the block UI for this colour field.\n *\n * @internal\n */\n override initView() {\n this.size_ = new Size(\n this.getConstants()!.FIELD_COLOUR_DEFAULT_WIDTH,\n this.getConstants()!.FIELD_COLOUR_DEFAULT_HEIGHT);\n if (!this.getConstants()!.FIELD_COLOUR_FULL_BLOCK) {\n this.createBorderRect_();\n this.getBorderRect().style['fillOpacity'] = '1';\n } else if (this.sourceBlock_ instanceof BlockSvg) {\n this.clickTarget_ = this.sourceBlock_.getSvgRoot();\n }\n }\n\n override applyColour() {\n if (!this.getConstants()!.FIELD_COLOUR_FULL_BLOCK) {\n if (this.borderRect_) {\n this.borderRect_.style.fill = this.getValue() as string;\n }\n } else if (this.sourceBlock_ instanceof BlockSvg) {\n this.sourceBlock_.pathObject.svgPath.setAttribute(\n 'fill', this.getValue() as string);\n this.sourceBlock_.pathObject.svgPath.setAttribute('stroke', '#fff');\n }\n }\n\n /**\n * Ensure that the input value is a valid colour.\n *\n * @param opt_newValue The input value.\n * @returns A valid colour, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n string|null {\n if (typeof opt_newValue !== 'string') {\n return null;\n }\n return colour.parse(opt_newValue);\n }\n\n /**\n * Update the value of this colour field, and update the displayed colour.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a colour in '#rrggbb' format.\n */\n protected override doValueUpdate_(newValue: AnyDuringMigration) {\n this.value_ = newValue;\n if (this.borderRect_) {\n this.borderRect_.style.fill = newValue as string;\n } else if (\n this.sourceBlock_ && this.sourceBlock_.rendered &&\n this.sourceBlock_ instanceof BlockSvg) {\n this.sourceBlock_.pathObject.svgPath.setAttribute(\n 'fill', newValue as string);\n this.sourceBlock_.pathObject.svgPath.setAttribute('stroke', '#fff');\n }\n }\n\n /**\n * Get the text for this field. Used when the block is collapsed.\n *\n * @returns Text representing the value of this field.\n */\n override getText(): string {\n let colour = this.value_ as string;\n // Try to use #rgb format if possible, rather than #rrggbb.\n if (/^#(.)\\1(.)\\2(.)\\3$/.test(colour)) {\n colour = '#' + colour[1] + colour[3] + colour[5];\n }\n return colour;\n }\n\n /**\n * Set a custom colour grid for this field.\n *\n * @param colours Array of colours for this block, or null to use default\n * (FieldColour.COLOURS).\n * @param opt_titles Optional array of colour tooltips, or null to use default\n * (FieldColour.TITLES).\n * @returns Returns itself (for method chaining).\n */\n setColours(colours: string[], opt_titles?: string[]): FieldColour {\n this.colours_ = colours;\n if (opt_titles) {\n this.titles_ = opt_titles;\n }\n return this;\n }\n\n /**\n * Set a custom grid size for this field.\n *\n * @param columns Number of columns for this block, or 0 to use default\n * (FieldColour.COLUMNS).\n * @returns Returns itself (for method chaining).\n */\n setColumns(columns: number): FieldColour {\n this.columns_ = columns;\n return this;\n }\n\n /** Create and show the colour field's editor. */\n protected override showEditor_() {\n this.dropdownCreate_();\n // AnyDuringMigration because: Argument of type 'Element | null' is not\n // assignable to parameter of type 'Node'.\n dropDownDiv.getContentDiv().appendChild(this.picker_ as AnyDuringMigration);\n\n dropDownDiv.showPositionedByField(this, this.dropdownDispose_.bind(this));\n\n // Focus so we can start receiving keyboard events.\n // AnyDuringMigration because: Property 'focus' does not exist on type\n // 'Element'.\n (this.picker_ as AnyDuringMigration)!.focus({preventScroll: true});\n }\n\n /**\n * Handle a click on a colour cell.\n *\n * @param e Mouse event.\n */\n private onClick_(e: MouseEvent) {\n const cell = e.target as Element;\n const colour = cell && cell.getAttribute('data-colour');\n if (colour !== null) {\n this.setValue(colour);\n dropDownDiv.hideIfOwner(this);\n }\n }\n\n /**\n * Handle a key down event. Navigate around the grid with the\n * arrow keys. Enter selects the highlighted colour.\n *\n * @param e Keyboard event.\n */\n private onKeyDown_(e: KeyboardEvent) {\n let handled = false;\n if (e.keyCode === KeyCodes.UP) {\n this.moveHighlightBy_(0, -1);\n handled = true;\n } else if (e.keyCode === KeyCodes.DOWN) {\n this.moveHighlightBy_(0, 1);\n handled = true;\n } else if (e.keyCode === KeyCodes.LEFT) {\n this.moveHighlightBy_(-1, 0);\n handled = true;\n } else if (e.keyCode === KeyCodes.RIGHT) {\n this.moveHighlightBy_(1, 0);\n handled = true;\n } else if (e.keyCode === KeyCodes.ENTER) {\n // Select the highlighted colour.\n const highlighted = this.getHighlighted_();\n if (highlighted) {\n const colour = highlighted && highlighted.getAttribute('data-colour');\n if (colour !== null) {\n this.setValue(colour);\n }\n }\n dropDownDiv.hideWithoutAnimation();\n handled = true;\n }\n if (handled) {\n e.stopPropagation();\n }\n }\n\n /**\n * Move the currently highlighted position by dx and dy.\n *\n * @param dx Change of x\n * @param dy Change of y\n */\n private moveHighlightBy_(dx: number, dy: number) {\n if (!this.highlightedIndex_) {\n return;\n }\n\n const colours = this.colours_ || FieldColour.COLOURS;\n const columns = this.columns_ || FieldColour.COLUMNS;\n\n // Get the current x and y coordinates\n let x = this.highlightedIndex_ % columns;\n let y = Math.floor(this.highlightedIndex_ / columns);\n\n // Add the offset\n x += dx;\n y += dy;\n\n if (dx < 0) {\n // Move left one grid cell, even in RTL.\n // Loop back to the end of the previous row if we have room.\n if (x < 0 && y > 0) {\n x = columns - 1;\n y--;\n } else if (x < 0) {\n x = 0;\n }\n } else if (dx > 0) {\n // Move right one grid cell, even in RTL.\n // Loop to the start of the next row, if there's room.\n if (x > columns - 1 && y < Math.floor(colours.length / columns) - 1) {\n x = 0;\n y++;\n } else if (x > columns - 1) {\n x--;\n }\n } else if (dy < 0) {\n // Move up one grid cell, stop at the top.\n if (y < 0) {\n y = 0;\n }\n } else if (dy > 0) {\n // Move down one grid cell, stop at the bottom.\n if (y > Math.floor(colours.length / columns) - 1) {\n y = Math.floor(colours.length / columns) - 1;\n }\n }\n\n // Move the highlight to the new coordinates.\n const cell = this.picker_!.childNodes[y].childNodes[x] as Element;\n const index = y * columns + x;\n this.setHighlightedCell_(cell, index);\n }\n\n /**\n * Handle a mouse move event. Highlight the hovered colour.\n *\n * @param e Mouse event.\n */\n private onMouseMove_(e: MouseEvent) {\n const cell = e.target as Element;\n const index = cell && Number(cell.getAttribute('data-index'));\n if (index !== null && index !== this.highlightedIndex_) {\n this.setHighlightedCell_(cell, index);\n }\n }\n\n /** Handle a mouse enter event. Focus the picker. */\n private onMouseEnter_() {\n // AnyDuringMigration because: Property 'focus' does not exist on type\n // 'Element'.\n (this.picker_ as AnyDuringMigration)!.focus({preventScroll: true});\n }\n\n /**\n * Handle a mouse leave event. Blur the picker and unhighlight\n * the currently highlighted colour.\n */\n private onMouseLeave_() {\n // AnyDuringMigration because: Property 'blur' does not exist on type\n // 'Element'.\n (this.picker_ as AnyDuringMigration)!.blur();\n const highlighted = this.getHighlighted_();\n if (highlighted) {\n dom.removeClass(highlighted, 'blocklyColourHighlighted');\n }\n }\n\n /**\n * Returns the currently highlighted item (if any).\n *\n * @returns Highlighted item (null if none).\n */\n private getHighlighted_(): HTMLElement|null {\n if (!this.highlightedIndex_) {\n return null;\n }\n\n const columns = this.columns_ || FieldColour.COLUMNS;\n const x = this.highlightedIndex_ % columns;\n const y = Math.floor(this.highlightedIndex_ / columns);\n const row = this.picker_!.childNodes[y];\n if (!row) {\n return null;\n }\n const col = row.childNodes[x] as HTMLElement;\n return col;\n }\n\n /**\n * Update the currently highlighted cell.\n *\n * @param cell the new cell to highlight\n * @param index the index of the new cell\n */\n private setHighlightedCell_(cell: Element, index: number) {\n // Unhighlight the current item.\n const highlighted = this.getHighlighted_();\n if (highlighted) {\n dom.removeClass(highlighted, 'blocklyColourHighlighted');\n }\n // Highlight new item.\n dom.addClass(cell, 'blocklyColourHighlighted');\n // Set new highlighted index.\n this.highlightedIndex_ = index;\n\n // Update accessibility roles.\n // AnyDuringMigration because: Argument of type 'string | null' is not\n // assignable to parameter of type 'string | number | boolean | string[]'.\n aria.setState(\n this.picker_ as Element, aria.State.ACTIVEDESCENDANT,\n cell.getAttribute('id') as AnyDuringMigration);\n }\n\n /** Create a colour picker dropdown editor. */\n private dropdownCreate_() {\n const columns = this.columns_ || FieldColour.COLUMNS;\n const colours = this.colours_ || FieldColour.COLOURS;\n const titles = this.titles_ || FieldColour.TITLES;\n const selectedColour = this.getValue();\n // Create the palette.\n const table = (document.createElement('table'));\n table.className = 'blocklyColourTable';\n table.tabIndex = 0;\n table.dir = 'ltr';\n aria.setRole(table, aria.Role.GRID);\n aria.setState(table, aria.State.EXPANDED, true);\n aria.setState(\n table, aria.State.ROWCOUNT, Math.floor(colours.length / columns));\n aria.setState(table, aria.State.COLCOUNT, columns);\n let row: Element;\n for (let i = 0; i < colours.length; i++) {\n if (i % columns === 0) {\n row = document.createElement('tr');\n aria.setRole(row, aria.Role.ROW);\n table.appendChild(row);\n }\n const cell = (document.createElement('td'));\n row!.appendChild(cell);\n // This becomes the value, if clicked.\n cell.setAttribute('data-colour', colours[i]);\n cell.title = titles[i] || colours[i];\n cell.id = idGenerator.getNextUniqueId();\n // AnyDuringMigration because: Argument of type 'number' is not\n // assignable to parameter of type 'string'.\n cell.setAttribute('data-index', i as AnyDuringMigration);\n aria.setRole(cell, aria.Role.GRIDCELL);\n aria.setState(cell, aria.State.LABEL, colours[i]);\n aria.setState(cell, aria.State.SELECTED, colours[i] === selectedColour);\n cell.style.backgroundColor = colours[i];\n if (colours[i] === selectedColour) {\n cell.className = 'blocklyColourSelected';\n this.highlightedIndex_ = i;\n }\n }\n\n // Configure event handler on the table to listen for any event in a cell.\n this.onClickWrapper_ = browserEvents.conditionalBind(\n table, 'click', this, this.onClick_, true);\n this.onMouseMoveWrapper_ = browserEvents.conditionalBind(\n table, 'mousemove', this, this.onMouseMove_, true);\n this.onMouseEnterWrapper_ = browserEvents.conditionalBind(\n table, 'mouseenter', this, this.onMouseEnter_, true);\n this.onMouseLeaveWrapper_ = browserEvents.conditionalBind(\n table, 'mouseleave', this, this.onMouseLeave_, true);\n this.onKeyDownWrapper_ =\n browserEvents.conditionalBind(table, 'keydown', this, this.onKeyDown_);\n\n this.picker_ = table;\n }\n\n /** Disposes of events and DOM-references belonging to the colour editor. */\n private dropdownDispose_() {\n if (this.onClickWrapper_) {\n browserEvents.unbind(this.onClickWrapper_);\n this.onClickWrapper_ = null;\n }\n if (this.onMouseMoveWrapper_) {\n browserEvents.unbind(this.onMouseMoveWrapper_);\n this.onMouseMoveWrapper_ = null;\n }\n if (this.onMouseEnterWrapper_) {\n browserEvents.unbind(this.onMouseEnterWrapper_);\n this.onMouseEnterWrapper_ = null;\n }\n if (this.onMouseLeaveWrapper_) {\n browserEvents.unbind(this.onMouseLeaveWrapper_);\n this.onMouseLeaveWrapper_ = null;\n }\n if (this.onKeyDownWrapper_) {\n browserEvents.unbind(this.onKeyDownWrapper_);\n this.onKeyDownWrapper_ = null;\n }\n this.picker_ = null;\n this.highlightedIndex_ = null;\n }\n\n /**\n * Construct a FieldColour from a JSON arg object.\n *\n * @param options A JSON object with options (colour).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static fromJson(options: FieldColourFromJsonConfig): FieldColour {\n // `this` might be a subclass of FieldColour if that class doesn't override\n // the static fromJson method.\n return new this(options['colour'], undefined, options);\n }\n}\n\n/** The default value for this field. */\n// AnyDuringMigration because: Property 'DEFAULT_VALUE' is protected and only\n// accessible within class 'FieldColour' and its subclasses.\n(FieldColour.prototype as AnyDuringMigration).DEFAULT_VALUE =\n FieldColour.COLOURS[0];\n\n/** CSS for colour picker. See css.js for use. */\nCss.register(`\n.blocklyColourTable {\n border-collapse: collapse;\n display: block;\n outline: none;\n padding: 1px;\n}\n\n.blocklyColourTable>tr>td {\n border: .5px solid #888;\n box-sizing: border-box;\n cursor: pointer;\n display: inline-block;\n height: 20px;\n padding: 0;\n width: 20px;\n}\n\n.blocklyColourTable>tr>td.blocklyColourHighlighted {\n border-color: #eee;\n box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);\n position: relative;\n}\n\n.blocklyColourSelected, .blocklyColourSelected:hover {\n border-color: #eee !important;\n outline: 1px solid #333;\n position: relative;\n}\n`);\n\nfieldRegistry.register('field_colour', FieldColour);\n\n/**\n * Config options for the colour field.\n */\nexport interface FieldColourConfig extends FieldConfig {\n colourOptions?: string[];\n colourTitles?: string[];\n columns?: number;\n}\n\n/**\n * fromJson config options for the colour field.\n */\nexport interface FieldColourFromJsonConfig extends FieldColourConfig {\n colour?: string;\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Checkbox field. Checked or not checked.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldCheckbox');\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport * as dom from './utils/dom.js';\nimport {FieldConfig, Field} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport type {Sentinel} from './utils/sentinel.js';\n\n\n/**\n * Class for a checkbox field.\n *\n * @alias Blockly.FieldCheckbox\n */\nexport class FieldCheckbox extends Field {\n /** Default character for the checkmark. */\n static readonly CHECK_CHAR = '✓';\n private checkChar_: string;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable.\n */\n override SERIALIZABLE = true;\n\n /**\n * Mouse cursor style when over the hotspot that initiates editability.\n */\n override CURSOR = 'default';\n override value_: AnyDuringMigration;\n\n /**\n * @param opt_value The initial value of the field. Should either be 'TRUE',\n * 'FALSE' or a boolean. Defaults to 'FALSE'. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a value ('TRUE' or 'FALSE') & returns a\n * validated value ('TRUE' or 'FALSE'), or null to abort the change.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/checkbox#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string|boolean|Sentinel, opt_validator?: Function,\n opt_config?: FieldCheckboxConfig) {\n super(Field.SKIP_SETUP);\n\n /**\n * Character for the check mark. Used to apply a different check mark\n * character to individual fields.\n */\n this.checkChar_ = FieldCheckbox.CHECK_CHAR;\n\n if (opt_value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n }\n this.setValue(opt_value);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n protected override configure_(config: FieldCheckboxConfig) {\n super.configure_(config);\n if (config.checkCharacter) this.checkChar_ = config.checkCharacter;\n }\n\n /**\n * Saves this field's value.\n *\n * @returns The boolean value held by this field.\n * @internal\n */\n override saveState(): AnyDuringMigration {\n const legacyState = this.saveLegacyState(FieldCheckbox);\n if (legacyState !== null) {\n return legacyState;\n }\n return this.getValueBoolean();\n }\n\n /**\n * Create the block UI for this checkbox.\n *\n * @internal\n */\n override initView() {\n super.initView();\n\n const textElement = this.getTextElement();\n dom.addClass(textElement, 'blocklyCheckbox');\n textElement.style.display = this.value_ ? 'block' : 'none';\n }\n\n override render_() {\n if (this.textContent_) {\n this.textContent_.nodeValue = this.getDisplayText_();\n }\n this.updateSize_(this.getConstants()!.FIELD_CHECKBOX_X_OFFSET);\n }\n\n override getDisplayText_() {\n return this.checkChar_;\n }\n\n /**\n * Set the character used for the check mark.\n *\n * @param character The character to use for the check mark, or null to use\n * the default.\n */\n setCheckCharacter(character: string|null) {\n this.checkChar_ = character || FieldCheckbox.CHECK_CHAR;\n this.forceRerender();\n }\n\n /** Toggle the state of the checkbox on click. */\n protected override showEditor_() {\n this.setValue(!this.value_);\n }\n\n /**\n * Ensure that the input value is valid ('TRUE' or 'FALSE').\n *\n * @param opt_newValue The input value.\n * @returns A valid value ('TRUE' or 'FALSE), or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n string|null {\n if (opt_newValue === true || opt_newValue === 'TRUE') {\n return 'TRUE';\n }\n if (opt_newValue === false || opt_newValue === 'FALSE') {\n return 'FALSE';\n }\n return null;\n }\n\n /**\n * Update the value of the field, and update the checkElement.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a either 'TRUE' or 'FALSE'.\n */\n protected override doValueUpdate_(newValue: AnyDuringMigration) {\n this.value_ = this.convertValueToBool_(newValue);\n // Update visual.\n if (this.textElement_) {\n this.textElement_.style.display = this.value_ ? 'block' : 'none';\n }\n }\n\n /**\n * Get the value of this field, either 'TRUE' or 'FALSE'.\n *\n * @returns The value of this field.\n */\n override getValue(): string {\n return this.value_ ? 'TRUE' : 'FALSE';\n }\n\n /**\n * Get the boolean value of this field.\n *\n * @returns The boolean value of this field.\n */\n getValueBoolean(): boolean {\n return this.value_ as boolean;\n }\n\n /**\n * Get the text of this field. Used when the block is collapsed.\n *\n * @returns Text representing the value of this field ('true' or 'false').\n */\n override getText(): string {\n return String(this.convertValueToBool_(this.value_));\n }\n\n /**\n * Convert a value into a pure boolean.\n *\n * Converts 'TRUE' to true and 'FALSE' to false correctly, everything else\n * is cast to a boolean.\n *\n * @param value The value to convert.\n * @returns The converted value.\n */\n private convertValueToBool_(value: AnyDuringMigration): boolean {\n if (typeof value === 'string') {\n return value === 'TRUE';\n } else {\n return !!value;\n }\n }\n\n /**\n * Construct a FieldCheckbox from a JSON arg object.\n *\n * @param options A JSON object with options (checked).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static fromJson(options: FieldCheckboxFromJsonConfig): FieldCheckbox {\n // `this` might be a subclass of FieldCheckbox if that class doesn't\n // 'override' the static fromJson method.\n return new this(options.checked, undefined, options);\n }\n}\n\nfieldRegistry.register('field_checkbox', FieldCheckbox);\n\n(FieldCheckbox.prototype as AnyDuringMigration).DEFAULT_VALUE = false;\n\n/**\n * Config options for the checkbox field.\n */\nexport interface FieldCheckboxConfig extends FieldConfig {\n checkCharacter?: string;\n}\n\n/**\n * fromJson config options for the checkbox field.\n */\nexport interface FieldCheckboxFromJsonConfig extends FieldCheckboxConfig {\n checked?: boolean;\n}\n","/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Angle input field.\n *\n * @class\n */\nimport * as goog from '../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.FieldAngle');\n\nimport {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as Css from './css.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {Field, UnattachedFieldError} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {FieldTextInputConfig, FieldTextInput} from './field_textinput.js';\nimport * as dom from './utils/dom.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport * as math from './utils/math.js';\nimport type {Sentinel} from './utils/sentinel.js';\nimport {Svg} from './utils/svg.js';\nimport * as userAgent from './utils/useragent.js';\nimport * as WidgetDiv from './widgetdiv.js';\n\n\n/**\n * Class for an editable angle field.\n *\n * @alias Blockly.FieldAngle\n */\nexport class FieldAngle extends FieldTextInput {\n /** The default value for this field. */\n // protected override DEFAULT_VALUE = 0;\n\n /**\n * The default amount to round angles to when using a mouse or keyboard nav\n * input. Must be a positive integer to support keyboard navigation.\n */\n static readonly ROUND = 15;\n\n /** Half the width of protractor image. */\n static readonly HALF = 100 / 2;\n\n /**\n * Default property describing which direction makes an angle field's value\n * increase. Angle increases clockwise (true) or counterclockwise (false).\n */\n static readonly CLOCKWISE = false;\n\n /**\n * The default offset of 0 degrees (and all angles). Always offsets in the\n * counterclockwise direction, regardless of the field's clockwise property.\n * Usually either 0 (0 = right) or 90 (0 = up).\n */\n static readonly OFFSET = 0;\n\n /**\n * The default maximum angle to allow before wrapping.\n * Usually either 360 (for 0 to 359.9) or 180 (for -179.9 to 180).\n */\n static readonly WRAP = 360;\n\n /**\n * Radius of protractor circle. Slightly smaller than protractor size since\n * otherwise SVG crops off half the border at the edges.\n */\n static readonly RADIUS: number = FieldAngle.HALF - 1;\n private clockwise_: boolean;\n private offset_: number;\n private wrap_: number;\n private round_: number;\n\n /** The angle picker's SVG element. */\n private editor_: SVGElement|null = null;\n\n /** The angle picker's gauge path depending on the value. */\n gauge_: SVGElement|null = null;\n\n /** The angle picker's line drawn representing the value's angle. */\n line_: SVGElement|null = null;\n\n /** The degree symbol for this field. */\n // AnyDuringMigration because: Type 'null' is not assignable to type\n // 'SVGTSpanElement'.\n protected symbol_: SVGTSpanElement = null as AnyDuringMigration;\n\n /** Wrapper click event data. */\n private clickWrapper_: browserEvents.Data|null = null;\n\n /** Surface click event data. */\n private clickSurfaceWrapper_: browserEvents.Data|null = null;\n\n /** Surface mouse move event data. */\n private moveSurfaceWrapper_: browserEvents.Data|null = null;\n\n /**\n * Serializable fields are saved by the serializer, non-serializable fields\n * are not. Editable fields should also be serializable.\n */\n override SERIALIZABLE = true;\n\n /**\n * @param opt_value The initial value of the field. Should cast to a number.\n * Defaults to 0. Also accepts Field.SKIP_SETUP if you wish to skip setup\n * (only used by subclasses that want to handle configuration and setting\n * the field value after their own constructors have run).\n * @param opt_validator A function that is called to validate changes to the\n * field's value. Takes in a number & returns a validated number, or null\n * to abort the change.\n * @param opt_config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/angle#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n opt_value?: string|number|Sentinel, opt_validator?: Function,\n opt_config?: FieldAngleConfig) {\n super(Field.SKIP_SETUP);\n\n /**\n * Should the angle increase as the angle picker is moved clockwise (true)\n * or counterclockwise (false)\n *\n * @see FieldAngle.CLOCKWISE\n */\n this.clockwise_ = FieldAngle.CLOCKWISE;\n\n /**\n * The offset of zero degrees (and all other angles).\n *\n * @see FieldAngle.OFFSET\n */\n this.offset_ = FieldAngle.OFFSET;\n\n /**\n * The maximum angle to allow before wrapping.\n *\n * @see FieldAngle.WRAP\n */\n this.wrap_ = FieldAngle.WRAP;\n\n /**\n * The amount to round angles to when using a mouse or keyboard nav input.\n *\n * @see FieldAngle.ROUND\n */\n this.round_ = FieldAngle.ROUND;\n\n if (opt_value === Field.SKIP_SETUP) {\n return;\n }\n if (opt_config) {\n this.configure_(opt_config);\n }\n this.setValue(opt_value);\n if (opt_validator) {\n this.setValidator(opt_validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n protected override configure_(config: FieldAngleConfig) {\n super.configure_(config);\n\n switch (config.mode) {\n case Mode.COMPASS:\n this.clockwise_ = true;\n this.offset_ = 90;\n break;\n case Mode.PROTRACTOR:\n // This is the default mode, so we could do nothing. But just to\n // future-proof, we'll set it anyway.\n this.clockwise_ = false;\n this.offset_ = 0;\n break;\n }\n\n // Allow individual settings to override the mode setting.\n if (config.clockwise) this.clockwise_ = config.clockwise;\n if (config.offset) this.offset_ = config.offset;\n if (config.wrap) this.wrap_ = config.wrap;\n if (config.round) this.round_ = config.round;\n }\n\n /**\n * Create the block UI for this field.\n *\n * @internal\n */\n override initView() {\n super.initView();\n // Add the degree symbol to the left of the number, even in RTL (issue\n // #2380)\n this.symbol_ = dom.createSvgElement(Svg.TSPAN, {});\n this.symbol_.appendChild(document.createTextNode('°'));\n this.getTextElement().appendChild(this.symbol_);\n }\n\n /** Updates the graph when the field rerenders. */\n protected override render_() {\n super.render_();\n this.updateGraph_();\n }\n\n /**\n * Create and show the angle field's editor.\n *\n * @param opt_e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n */\n protected override showEditor_(opt_e?: Event) {\n // Mobile browsers have issues with in-line textareas (focus & keyboards).\n const noFocus = userAgent.MOBILE || userAgent.ANDROID || userAgent.IPAD;\n super.showEditor_(opt_e, noFocus);\n\n this.dropdownCreate_();\n // AnyDuringMigration because: Argument of type 'SVGElement | null' is not\n // assignable to parameter of type 'Node'.\n dropDownDiv.getContentDiv().appendChild(this.editor_ as AnyDuringMigration);\n\n if (this.sourceBlock_ instanceof BlockSvg) {\n if (!this.sourceBlock_.style.colourTertiary) {\n throw new Error(\n 'The renderer did not properly initialize the block style');\n }\n dropDownDiv.setColour(\n this.sourceBlock_.style.colourPrimary,\n this.sourceBlock_.style.colourTertiary);\n }\n\n // AnyDuringMigration because: Argument of type 'this' is not assignable to\n // parameter of type 'Field'.\n dropDownDiv.showPositionedByField(\n this as AnyDuringMigration, this.dropdownDispose_.bind(this));\n\n this.updateGraph_();\n }\n\n /** Create the angle dropdown editor. */\n private dropdownCreate_() {\n const svg = dom.createSvgElement(Svg.SVG, {\n 'xmlns': dom.SVG_NS,\n 'xmlns:html': dom.HTML_NS,\n 'xmlns:xlink': dom.XLINK_NS,\n 'version': '1.1',\n 'height': FieldAngle.HALF * 2 + 'px',\n 'width': FieldAngle.HALF * 2 + 'px',\n 'style': 'touch-action: none',\n });\n const circle = dom.createSvgElement(\n Svg.CIRCLE, {\n 'cx': FieldAngle.HALF,\n 'cy': FieldAngle.HALF,\n 'r': FieldAngle.RADIUS,\n 'class': 'blocklyAngleCircle',\n },\n svg);\n this.gauge_ =\n dom.createSvgElement(Svg.PATH, {'class': 'blocklyAngleGauge'}, svg);\n this.line_ = dom.createSvgElement(\n Svg.LINE, {\n 'x1': FieldAngle.HALF,\n 'y1': FieldAngle.HALF,\n 'class': 'blocklyAngleLine',\n },\n svg);\n // Draw markers around the edge.\n for (let angle = 0; angle < 360; angle += 15) {\n dom.createSvgElement(\n Svg.LINE, {\n 'x1': FieldAngle.HALF + FieldAngle.RADIUS,\n 'y1': FieldAngle.HALF,\n 'x2': FieldAngle.HALF + FieldAngle.RADIUS -\n (angle % 45 === 0 ? 10 : 5),\n 'y2': FieldAngle.HALF,\n 'class': 'blocklyAngleMarks',\n 'transform': 'rotate(' + angle + ',' + FieldAngle.HALF + ',' +\n FieldAngle.HALF + ')',\n },\n svg);\n }\n\n // The angle picker is different from other fields in that it updates on\n // mousemove even if it's not in the middle of a drag. In future we may\n // change this behaviour.\n this.clickWrapper_ =\n browserEvents.conditionalBind(svg, 'click', this, this.hide_);\n // On touch devices, the picker's value is only updated with a drag. Add\n // a click handler on the drag surface to update the value if the surface\n // is clicked.\n this.clickSurfaceWrapper_ = browserEvents.conditionalBind(\n circle, 'click', this, this.onMouseMove_, true, true);\n this.moveSurfaceWrapper_ = browserEvents.conditionalBind(\n circle, 'mousemove', this, this.onMouseMove_, true, true);\n this.editor_ = svg;\n }\n\n /** Disposes of events and DOM-references belonging to the angle editor. */\n private dropdownDispose_() {\n if (this.clickWrapper_) {\n browserEvents.unbind(this.clickWrapper_);\n this.clickWrapper_ = null;\n }\n if (this.clickSurfaceWrapper_) {\n browserEvents.unbind(this.clickSurfaceWrapper_);\n this.clickSurfaceWrapper_ = null;\n }\n if (this.moveSurfaceWrapper_) {\n browserEvents.unbind(this.moveSurfaceWrapper_);\n this.moveSurfaceWrapper_ = null;\n }\n this.gauge_ = null;\n this.line_ = null;\n }\n\n /** Hide the editor. */\n private hide_() {\n dropDownDiv.hideIfOwner(this);\n WidgetDiv.hide();\n }\n\n /**\n * Set the angle to match the mouse's position.\n *\n * @param e Mouse move event.\n */\n protected onMouseMove_(e: Event) {\n // Calculate angle.\n const bBox = this.gauge_!.ownerSVGElement!.getBoundingClientRect();\n // AnyDuringMigration because: Property 'clientX' does not exist on type\n // 'Event'.\n const dx = (e as AnyDuringMigration).clientX - bBox.left - FieldAngle.HALF;\n // AnyDuringMigration because: Property 'clientY' does not exist on type\n // 'Event'.\n const dy = (e as AnyDuringMigration).clientY - bBox.top - FieldAngle.HALF;\n let angle = Math.atan(-dy / dx);\n if (isNaN(angle)) {\n // This shouldn't happen, but let's not let this error propagate further.\n return;\n }\n angle = math.toDegrees(angle);\n // 0: East, 90: North, 180: West, 270: South.\n if (dx < 0) {\n angle += 180;\n } else if (dy > 0) {\n angle += 360;\n }\n\n // Do offsetting.\n if (this.clockwise_) {\n angle = this.offset_ + 360 - angle;\n } else {\n angle = 360 - (this.offset_ - angle);\n }\n\n this.displayMouseOrKeyboardValue_(angle);\n }\n\n /**\n * Handles and displays values that are input via mouse or arrow key input.\n * These values need to be rounded and wrapped before being displayed so\n * that the text input's value is appropriate.\n *\n * @param angle New angle.\n */\n private displayMouseOrKeyboardValue_(angle: number) {\n if (this.round_) {\n angle = Math.round(angle / this.round_) * this.round_;\n }\n angle = this.wrapValue_(angle);\n if (angle !== this.value_) {\n this.setEditorValue_(angle);\n }\n }\n\n /** Redraw the graph with the current angle. */\n private updateGraph_() {\n if (!this.gauge_) {\n return;\n }\n // Always display the input (i.e. getText) even if it is invalid.\n let angleDegrees = Number(this.getText()) + this.offset_;\n angleDegrees %= 360;\n let angleRadians = math.toRadians(angleDegrees);\n const path = ['M ', FieldAngle.HALF, ',', FieldAngle.HALF];\n let x2 = FieldAngle.HALF;\n let y2 = FieldAngle.HALF;\n if (!isNaN(angleRadians)) {\n const clockwiseFlag = Number(this.clockwise_);\n const angle1 = math.toRadians(this.offset_);\n const x1 = Math.cos(angle1) * FieldAngle.RADIUS;\n const y1 = Math.sin(angle1) * -FieldAngle.RADIUS;\n if (clockwiseFlag) {\n angleRadians = 2 * angle1 - angleRadians;\n }\n x2 += Math.cos(angleRadians) * FieldAngle.RADIUS;\n y2 -= Math.sin(angleRadians) * FieldAngle.RADIUS;\n // Don't ask how the flag calculations work. They just do.\n let largeFlag =\n Math.abs(Math.floor((angleRadians - angle1) / Math.PI) % 2);\n if (clockwiseFlag) {\n largeFlag = 1 - largeFlag;\n }\n path.push(\n ' l ', x1, ',', y1, ' A ', FieldAngle.RADIUS, ',', FieldAngle.RADIUS,\n ' 0 ', largeFlag, ' ', clockwiseFlag, ' ', x2, ',', y2, ' z');\n }\n this.gauge_.setAttribute('d', path.join(''));\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.line_!.setAttribute('x2', x2 as AnyDuringMigration);\n // AnyDuringMigration because: Argument of type 'number' is not assignable\n // to parameter of type 'string'.\n this.line_!.setAttribute('y2', y2 as AnyDuringMigration);\n }\n\n /**\n * Handle key down to the editor.\n *\n * @param e Keyboard event.\n */\n protected override onHtmlInputKeyDown_(e: Event) {\n super.onHtmlInputKeyDown_(e);\n const block = this.getSourceBlock();\n if (!block) {\n throw new UnattachedFieldError();\n }\n\n let multiplier;\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n if ((e as AnyDuringMigration).keyCode === KeyCodes.LEFT) {\n // decrement (increment in RTL)\n multiplier = block.RTL ? 1 : -1;\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n } else if ((e as AnyDuringMigration).keyCode === KeyCodes.RIGHT) {\n // increment (decrement in RTL)\n multiplier = block.RTL ? -1 : 1;\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n } else if ((e as AnyDuringMigration).keyCode === KeyCodes.DOWN) {\n // decrement\n multiplier = -1;\n // AnyDuringMigration because: Property 'keyCode' does not exist on type\n // 'Event'.\n } else if ((e as AnyDuringMigration).keyCode === KeyCodes.UP) {\n // increment\n multiplier = 1;\n }\n if (multiplier) {\n const value = this.getValue() as number;\n this.displayMouseOrKeyboardValue_(value + multiplier * this.round_);\n e.preventDefault();\n e.stopPropagation();\n }\n }\n\n /**\n * Ensure that the input value is a valid angle.\n *\n * @param opt_newValue The input value.\n * @returns A valid angle, or null if invalid.\n */\n protected override doClassValidation_(opt_newValue?: AnyDuringMigration):\n number|null {\n const value = Number(opt_newValue);\n if (isNaN(value) || !isFinite(value)) {\n return null;\n }\n return this.wrapValue_(value);\n }\n\n /**\n * Wraps the value so that it is in the range (-360 + wrap, wrap).\n *\n * @param value The value to wrap.\n * @returns The wrapped value.\n */\n private wrapValue_(value: number): number {\n value %= 360;\n if (value < 0) {\n value += 360;\n }\n if (value > this.wrap_) {\n value -= 360;\n }\n return value;\n }\n\n /**\n * Construct a FieldAngle from a JSON arg object.\n *\n * @param options A JSON object with options (angle).\n * @returns The new field instance.\n * @nocollapse\n * @internal\n */\n static override fromJson(options: FieldAngleFromJsonConfig): FieldAngle {\n // `this` might be a subclass of FieldAngle if that class doesn't override\n // the static fromJson method.\n return new this(options.angle, undefined, options);\n }\n}\n\n/** CSS for angle field. See css.js for use. */\nCss.register(`\n.blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}\n\n.blocklyAngleGauge {\n fill: #f88;\n fill-opacity: .8;\n pointer-events: none;\n}\n\n.blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}\n`);\n\nfieldRegistry.register('field_angle', FieldAngle);\n\n(FieldAngle.prototype as AnyDuringMigration).DEFAULT_VALUE = 0;\n\n/**\n * The two main modes of the angle field.\n * Compass specifies:\n * - clockwise: true\n * - offset: 90\n * - wrap: 0\n * - round: 15\n *\n * Protractor specifies:\n * - clockwise: false\n * - offset: 0\n * - wrap: 0\n * - round: 15\n */\nexport enum Mode {\n COMPASS = 'compass',\n PROTRACTOR = 'protractor',\n}\n\n/**\n * Extra configuration options for the angle field.\n */\nexport interface FieldAngleConfig extends FieldTextInputConfig {\n mode?: Mode;\n clockwise?: boolean;\n offset?: number;\n wrap?: number;\n round?: number;\n}\n\n/**\n * fromJson configuration options for the angle field.\n */\nexport interface FieldAngleFromJsonConfig extends FieldAngleConfig {\n angle?: number;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a block move event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.BlockMove');\n\nimport type {Block} from '../block.js';\nimport {ConnectionType} from '../connection_type.js';\nimport * as registry from '../registry.js';\nimport {Coordinate} from '../utils/coordinate.js';\n\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport * as eventUtils from './utils.js';\n\n\ninterface BlockLocation {\n parentId?: string;\n inputName?: string;\n coordinate?: Coordinate;\n}\n\n/**\n * Class for a block move event. Created before the move.\n *\n * @alias Blockly.Events.BlockMove\n */\nexport class BlockMove extends BlockBase {\n override type = eventUtils.BLOCK_MOVE;\n oldParentId?: string;\n oldInputName?: string;\n oldCoordinate?: Coordinate;\n\n newParentId?: string;\n newInputName?: string;\n newCoordinate?: Coordinate;\n\n /** @param opt_block The moved block. Undefined for a blank event. */\n constructor(opt_block?: Block) {\n super(opt_block);\n\n if (!opt_block) {\n return;\n }\n // Blank event to be populated by fromJson.\n if (opt_block.isShadow()) {\n // Moving shadow blocks is handled via disconnection.\n this.recordUndo = false;\n }\n\n const location = this.currentLocation_();\n this.oldParentId = location.parentId;\n this.oldInputName = location.inputName;\n this.oldCoordinate = location.coordinate;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): BlockMoveJson {\n const json = super.toJson() as BlockMoveJson;\n json['newParentId'] = this.newParentId;\n json['newInputName'] = this.newInputName;\n if (this.newCoordinate) {\n json['newCoordinate'] = `${Math.round(this.newCoordinate.x)}, ` +\n `${Math.round(this.newCoordinate.y)}`;\n }\n if (!this.recordUndo) {\n json['recordUndo'] = this.recordUndo;\n }\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: BlockMoveJson) {\n super.fromJson(json);\n this.newParentId = json['newParentId'];\n this.newInputName = json['newInputName'];\n if (json['newCoordinate']) {\n const xy = json['newCoordinate'].split(',');\n this.newCoordinate = new Coordinate(Number(xy[0]), Number(xy[1]));\n }\n if (json['recordUndo'] !== undefined) {\n this.recordUndo = json['recordUndo'];\n }\n }\n\n /** Record the block's new location. Called after the move. */\n recordNew() {\n const location = this.currentLocation_();\n this.newParentId = location.parentId;\n this.newInputName = location.inputName;\n this.newCoordinate = location.coordinate;\n }\n\n /**\n * Returns the parentId and input if the block is connected,\n * or the XY location if disconnected.\n *\n * @returns Collection of location info.\n */\n private currentLocation_(): BlockLocation {\n const workspace = this.getEventWorkspace_();\n if (!this.blockId) {\n throw new Error(\n 'The block ID is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n const block = workspace.getBlockById(this.blockId);\n if (!block) {\n throw new Error(\n 'The block associated with the block move event ' +\n 'could not be found');\n }\n const location = {} as BlockLocation;\n const parent = block.getParent();\n if (parent) {\n location.parentId = parent.id;\n const input = parent.getInputWithBlock(block);\n if (input) {\n location.inputName = input.name;\n }\n } else {\n location.coordinate = block.getRelativeToSurfaceXY();\n }\n return location;\n }\n\n /**\n * Does this event record any change of state?\n *\n * @returns False if something changed.\n */\n override isNull(): boolean {\n return this.oldParentId === this.newParentId &&\n this.oldInputName === this.newInputName &&\n Coordinate.equals(this.oldCoordinate, this.newCoordinate);\n }\n\n /**\n * Run a move event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.blockId) {\n throw new Error(\n 'The block ID is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n const block = workspace.getBlockById(this.blockId);\n if (!block) {\n console.warn('Can\\'t move non-existent block: ' + this.blockId);\n return;\n }\n const parentId = forward ? this.newParentId : this.oldParentId;\n const inputName = forward ? this.newInputName : this.oldInputName;\n const coordinate = forward ? this.newCoordinate : this.oldCoordinate;\n let parentBlock: Block|null;\n if (parentId) {\n parentBlock = workspace.getBlockById(parentId);\n if (!parentBlock) {\n console.warn('Can\\'t connect to non-existent block: ' + parentId);\n return;\n }\n }\n if (block.getParent()) {\n block.unplug();\n }\n if (coordinate) {\n const xy = block.getRelativeToSurfaceXY();\n block.moveBy(coordinate.x - xy.x, coordinate.y - xy.y);\n } else {\n let blockConnection = block.outputConnection;\n if (!blockConnection ||\n block.previousConnection && block.previousConnection.isConnected()) {\n blockConnection = block.previousConnection;\n }\n let parentConnection;\n const connectionType = blockConnection.type;\n if (inputName) {\n const input = parentBlock!.getInput(inputName);\n if (input) {\n parentConnection = input.connection;\n }\n } else if (connectionType === ConnectionType.PREVIOUS_STATEMENT) {\n parentConnection = parentBlock!.nextConnection;\n }\n if (parentConnection) {\n blockConnection.connect(parentConnection);\n } else {\n console.warn('Can\\'t connect to non-existent input: ' + inputName);\n }\n }\n }\n}\n\nexport interface BlockMoveJson extends BlockBaseJson {\n newParentId?: string;\n newInputName?: string;\n newCoordinate?: string;\n recordUndo?: boolean;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.MOVE, BlockMove);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Base class for comment events.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.CommentBase');\n\nimport * as utilsXml from '../utils/xml.js';\nimport type {WorkspaceComment} from '../workspace_comment.js';\nimport * as Xml from '../xml.js';\n\nimport {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js';\nimport type {CommentCreate} from './events_comment_create.js';\nimport type {CommentDelete} from './events_comment_delete.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Abstract class for a comment event.\n *\n * @alias Blockly.Events.CommentBase\n */\nexport class CommentBase extends AbstractEvent {\n override isBlank = true;\n commentId?: string;\n\n /**\n * @param opt_comment The comment this event corresponds to. Undefined for a\n * blank event.\n */\n constructor(opt_comment?: WorkspaceComment) {\n super();\n /** Whether or not an event is blank. */\n this.isBlank = !opt_comment;\n\n if (!opt_comment) return;\n\n /** The ID of the comment this event pertains to. */\n this.commentId = opt_comment.id;\n\n /** The workspace identifier for this event. */\n this.workspaceId = opt_comment.workspace.id;\n\n /**\n * The event group ID for the group this event belongs to. Groups define\n * events that should be treated as an single action from the user's\n * perspective, and should be undone together.\n */\n this.group = eventUtils.getGroup();\n\n /** Sets whether the event should be added to the undo stack. */\n this.recordUndo = eventUtils.getRecordUndo();\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): CommentBaseJson {\n const json = super.toJson() as CommentBaseJson;\n if (!this.commentId) {\n throw new Error(\n 'The comment ID is undefined. Either pass a comment to ' +\n 'the constructor, or call fromJson');\n }\n json['commentId'] = this.commentId;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: CommentBaseJson) {\n super.fromJson(json);\n this.commentId = json['commentId'];\n }\n\n /**\n * Helper function for Comment[Create|Delete]\n *\n * @param event The event to run.\n * @param create if True then Create, if False then Delete\n */\n static CommentCreateDeleteHelper(\n event: CommentCreate|CommentDelete, create: boolean) {\n const workspace = event.getEventWorkspace_();\n if (create) {\n const xmlElement = utilsXml.createElement('xml');\n if (!event.xml) {\n throw new Error('Ecountered a comment event without proper xml');\n }\n xmlElement.appendChild(event.xml);\n Xml.domToWorkspace(xmlElement, workspace);\n } else {\n if (!event.commentId) {\n throw new Error(\n 'The comment ID is undefined. Either pass a comment to ' +\n 'the constructor, or call fromJson');\n }\n const comment = workspace.getCommentById(event.commentId);\n if (comment) {\n comment.dispose();\n } else {\n // Only complain about root-level block.\n console.warn(\n 'Can\\'t uncreate non-existent comment: ' + event.commentId);\n }\n }\n }\n}\n\nexport interface CommentBaseJson extends AbstractEventJson {\n commentId: string;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for comment change event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.CommentChange');\n\nimport * as registry from '../registry.js';\nimport type {WorkspaceComment} from '../workspace_comment.js';\n\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a comment change event.\n *\n * @alias Blockly.Events.CommentChange\n */\nexport class CommentChange extends CommentBase {\n override type = eventUtils.COMMENT_CHANGE;\n oldContents_?: string;\n newContents_?: string;\n\n /**\n * @param opt_comment The comment that is being changed. Undefined for a\n * blank event.\n * @param opt_oldContents Previous contents of the comment.\n * @param opt_newContents New contents of the comment.\n */\n constructor(\n opt_comment?: WorkspaceComment, opt_oldContents?: string,\n opt_newContents?: string) {\n super(opt_comment);\n\n if (!opt_comment) {\n return; // Blank event to be populated by fromJson.\n }\n\n this.oldContents_ =\n typeof opt_oldContents === 'undefined' ? '' : opt_oldContents;\n this.newContents_ =\n typeof opt_newContents === 'undefined' ? '' : opt_newContents;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): CommentChangeJson {\n const json = super.toJson() as CommentChangeJson;\n if (!this.oldContents_) {\n throw new Error(\n 'The old contents is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.newContents_) {\n throw new Error(\n 'The new contents is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n json['oldContents'] = this.oldContents_;\n json['newContents'] = this.newContents_;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: CommentChangeJson) {\n super.fromJson(json);\n this.oldContents_ = json['oldContents'];\n this.newContents_ = json['newContents'];\n }\n\n /**\n * Does this event record any change of state?\n *\n * @returns False if something changed.\n */\n override isNull(): boolean {\n return this.oldContents_ === this.newContents_;\n }\n\n /**\n * Run a change event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.commentId) {\n throw new Error(\n 'The comment ID is undefined. Either pass a comment to ' +\n 'the constructor, or call fromJson');\n }\n const comment = workspace.getCommentById(this.commentId);\n if (!comment) {\n console.warn('Can\\'t change non-existent comment: ' + this.commentId);\n return;\n }\n const contents = forward ? this.newContents_ : this.oldContents_;\n if (!contents) {\n if (forward) {\n throw new Error(\n 'The new contents is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n throw new Error(\n 'The old contents is undefined. Either pass a value to ' +\n 'the constructor, or call fromJson');\n }\n comment.setContent(contents);\n }\n}\n\nexport interface CommentChangeJson extends CommentBaseJson {\n oldContents: string;\n newContents: string;\n}\n\nregistry.register(\n registry.Type.EVENT, eventUtils.COMMENT_CHANGE, CommentChange);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for comment creation event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.CommentCreate');\n\nimport * as registry from '../registry.js';\nimport type {WorkspaceComment} from '../workspace_comment.js';\nimport * as Xml from '../xml.js';\n\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a comment creation event.\n *\n * @alias Blockly.Events.CommentCreate\n */\nexport class CommentCreate extends CommentBase {\n override type = eventUtils.COMMENT_CREATE;\n\n xml?: Element|DocumentFragment;\n\n /**\n * @param opt_comment The created comment.\n * Undefined for a blank event.\n */\n constructor(opt_comment?: WorkspaceComment) {\n super(opt_comment);\n\n if (!opt_comment) {\n return;\n }\n // Blank event to be populated by fromJson.\n this.xml = opt_comment.toXmlWithXY();\n }\n\n // TODO (#1266): \"Full\" and \"minimal\" serialization.\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): CommentCreateJson {\n const json = super.toJson() as CommentCreateJson;\n if (!this.xml) {\n throw new Error(\n 'The comment XML is undefined. Either pass a comment to ' +\n 'the constructor, or call fromJson');\n }\n json['xml'] = Xml.domToText(this.xml);\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: CommentCreateJson) {\n super.fromJson(json);\n this.xml = Xml.textToDom(json['xml']);\n }\n\n /**\n * Run a creation event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n CommentBase.CommentCreateDeleteHelper(this, forward);\n }\n}\n\nexport interface CommentCreateJson extends CommentBaseJson {\n xml: string;\n}\n\nregistry.register(\n registry.Type.EVENT, eventUtils.COMMENT_CREATE, CommentCreate);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for comment deletion event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.CommentDelete');\n\nimport * as registry from '../registry.js';\nimport type {WorkspaceComment} from '../workspace_comment.js';\n\nimport {CommentBase} from './events_comment_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a comment deletion event.\n *\n * @alias Blockly.Events.CommentDelete\n */\nexport class CommentDelete extends CommentBase {\n override type = eventUtils.COMMENT_DELETE;\n xml?: Element;\n\n /**\n * @param opt_comment The deleted comment.\n * Undefined for a blank event.\n */\n constructor(opt_comment?: WorkspaceComment) {\n super(opt_comment);\n\n if (!opt_comment) {\n return; // Blank event to be populated by fromJson.\n }\n\n this.xml = opt_comment.toXmlWithXY();\n }\n\n /**\n * Run a creation event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n CommentBase.CommentCreateDeleteHelper(this, !forward);\n }\n}\n\nregistry.register(\n registry.Type.EVENT, eventUtils.COMMENT_DELETE, CommentDelete);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for comment move event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.CommentMove');\n\nimport * as registry from '../registry.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport type {WorkspaceComment} from '../workspace_comment.js';\n\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a comment move event. Created before the move.\n *\n * @alias Blockly.Events.CommentMove\n */\nexport class CommentMove extends CommentBase {\n override type = eventUtils.COMMENT_MOVE;\n comment_?: WorkspaceComment;\n oldCoordinate_?: Coordinate;\n /** The location after the move, in workspace coordinates. */\n newCoordinate_?: Coordinate;\n\n /**\n * @param opt_comment The comment that is being moved. Undefined for a blank\n * event.\n */\n constructor(opt_comment?: WorkspaceComment) {\n super(opt_comment);\n\n if (!opt_comment) {\n return; // Blank event to be populated by fromJson.\n }\n\n /**\n * The comment that is being moved.\n */\n this.comment_ = opt_comment;\n\n /** The location before the move, in workspace coordinates. */\n this.oldCoordinate_ = opt_comment.getXY();\n }\n\n /**\n * Record the comment's new location. Called after the move. Can only be\n * called once.\n */\n recordNew() {\n if (this.newCoordinate_) {\n throw Error(\n 'Tried to record the new position of a comment on the ' +\n 'same event twice.');\n }\n if (!this.comment_) {\n throw new Error(\n 'The comment is undefined. Pass a comment to ' +\n 'the constructor if you want to use the record functionality');\n }\n this.newCoordinate_ = this.comment_.getXY();\n }\n\n /**\n * Override the location before the move. Use this if you don't create the\n * event until the end of the move, but you know the original location.\n *\n * @param xy The location before the move, in workspace coordinates.\n */\n setOldCoordinate(xy: Coordinate) {\n this.oldCoordinate_ = xy;\n }\n\n // TODO (#1266): \"Full\" and \"minimal\" serialization.\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): CommentMoveJson {\n const json = super.toJson() as CommentMoveJson;\n if (!this.oldCoordinate_) {\n throw new Error(\n 'The old comment position is undefined. Either pass a comment to ' +\n 'the constructor, or call fromJson');\n }\n if (!this.newCoordinate_) {\n throw new Error(\n 'The new comment position is undefined. Either call recordNew, or ' +\n 'call fromJson');\n }\n json['oldCoordinate'] = `${Math.round(this.oldCoordinate_.x)}, ` +\n `${Math.round(this.oldCoordinate_.y)}`;\n json['newCoordinate'] = Math.round(this.newCoordinate_.x) + ',' +\n Math.round(this.newCoordinate_.y);\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: CommentMoveJson) {\n super.fromJson(json);\n let xy = json['oldCoordinate'].split(',');\n this.oldCoordinate_ = new Coordinate(Number(xy[0]), Number(xy[1]));\n xy = json['newCoordinate'].split(',');\n this.newCoordinate_ = new Coordinate(Number(xy[0]), Number(xy[1]));\n }\n\n /**\n * Does this event record any change of state?\n *\n * @returns False if something changed.\n */\n override isNull(): boolean {\n return Coordinate.equals(this.oldCoordinate_, this.newCoordinate_);\n }\n\n /**\n * Run a move event.\n *\n * @param forward True if run forward, false if run backward (undo).\n */\n override run(forward: boolean) {\n const workspace = this.getEventWorkspace_();\n if (!this.commentId) {\n throw new Error(\n 'The comment ID is undefined. Either pass a comment to ' +\n 'the constructor, or call fromJson');\n }\n const comment = workspace.getCommentById(this.commentId);\n if (!comment) {\n console.warn('Can\\'t move non-existent comment: ' + this.commentId);\n return;\n }\n\n const target = forward ? this.newCoordinate_ : this.oldCoordinate_;\n if (!target) {\n throw new Error(\n 'Either oldCoordinate_ or newCoordinate_ is undefined. ' +\n 'Either pass a comment to the constructor and call recordNew, ' +\n 'or call fromJson');\n }\n // TODO: Check if the comment is being dragged, and give up if so.\n const current = comment.getXY();\n comment.moveBy(target.x - current.x, target.y - current.y);\n }\n}\n\nexport interface CommentMoveJson extends CommentBaseJson {\n oldCoordinate: string;\n newCoordinate: string;\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.COMMENT_MOVE, CommentMove);\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a block drag.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.BlockDrag');\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a block drag event.\n *\n * @alias Blockly.Events.BlockDrag\n */\nexport class BlockDrag extends UiBase {\n blockId?: string;\n isStart?: boolean;\n blocks?: Block[];\n override type = eventUtils.BLOCK_DRAG;\n\n /**\n * @param opt_block The top block in the stack that is being dragged.\n * Undefined for a blank event.\n * @param opt_isStart Whether this is the start of a block drag.\n * Undefined for a blank event.\n * @param opt_blocks The blocks affected by this drag. Undefined for a blank\n * event.\n */\n constructor(opt_block?: Block, opt_isStart?: boolean, opt_blocks?: Block[]) {\n const workspaceId = opt_block ? opt_block.workspace.id : undefined;\n super(workspaceId);\n if (!opt_block) return;\n\n this.blockId = opt_block.id;\n\n /** Whether this is the start of a block drag. */\n this.isStart = opt_isStart;\n\n /** The blocks affected by this drag event. */\n this.blocks = opt_blocks;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): BlockDragJson {\n const json = super.toJson() as BlockDragJson;\n if (this.isStart === undefined) {\n throw new Error(\n 'Whether this event is the start of a drag is ' +\n 'undefined. Either pass the value to the constructor, or call ' +\n 'fromJson');\n }\n if (this.blockId === undefined) {\n throw new Error(\n 'The block ID is undefined. Either pass a block to ' +\n 'the constructor, or call fromJson');\n }\n json['isStart'] = this.isStart;\n json['blockId'] = this.blockId;\n // TODO: I don't think we should actually apply the blocks array to the JSON\n // object b/c they have functions and aren't actually serializable.\n json['blocks'] = this.blocks;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: BlockDragJson) {\n super.fromJson(json);\n this.isStart = json['isStart'];\n this.blockId = json['blockId'];\n this.blocks = json['blocks'];\n }\n}\n\nexport interface BlockDragJson extends AbstractEventJson {\n isStart: boolean;\n blockId: string;\n blocks?: Block[];\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.BLOCK_DRAG, BlockDrag);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * (Deprecated) Events fired as a result of UI actions in\n * Blockly's editor.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.Ui');\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport {UiBase} from './events_ui_base.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a UI event.\n *\n * @deprecated December 2020. Instead use a more specific UI event.\n * @alias Blockly.Events.Ui\n */\nexport class Ui extends UiBase {\n blockId: AnyDuringMigration;\n element: AnyDuringMigration;\n oldValue: AnyDuringMigration;\n newValue: AnyDuringMigration;\n override type = eventUtils.UI;\n\n /**\n * @param opt_block The affected block. Null for UI events that do not have\n * an associated block. Undefined for a blank event.\n * @param opt_element One of 'selected', 'comment', 'mutatorOpen', etc.\n * @param opt_oldValue Previous value of element.\n * @param opt_newValue New value of element.\n */\n constructor(\n opt_block?: Block|null, opt_element?: string,\n opt_oldValue?: AnyDuringMigration, opt_newValue?: AnyDuringMigration) {\n const workspaceId = opt_block ? opt_block.workspace.id : undefined;\n super(workspaceId);\n\n this.blockId = opt_block ? opt_block.id : null;\n this.element = typeof opt_element === 'undefined' ? '' : opt_element;\n this.oldValue = typeof opt_oldValue === 'undefined' ? '' : opt_oldValue;\n this.newValue = typeof opt_newValue === 'undefined' ? '' : opt_newValue;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): AnyDuringMigration {\n const json = super.toJson() as AnyDuringMigration;\n json['element'] = this.element;\n if (this.newValue !== undefined) {\n json['newValue'] = this.newValue;\n }\n if (this.blockId) {\n json['blockId'] = this.blockId;\n }\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: AnyDuringMigration) {\n super.fromJson(json);\n this.element = json['element'];\n this.newValue = json['newValue'];\n this.blockId = json['blockId'];\n }\n}\n\nregistry.register(registry.Type.EVENT, eventUtils.UI, Ui);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a finished loading workspace event.\n *\n * @class\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events.FinishedLoading');\n\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js';\nimport * as eventUtils from './utils.js';\n\n\n/**\n * Class for a finished loading event.\n * Used to notify the developer when the workspace has finished loading (i.e\n * domToWorkspace).\n * Finished loading events do not record undo or redo.\n *\n * @alias Blockly.Events.FinishedLoading\n */\nexport class FinishedLoading extends AbstractEvent {\n override isBlank = true;\n override recordUndo = false;\n override type = eventUtils.FINISHED_LOADING;\n\n /**\n * @param opt_workspace The workspace that has finished loading. Undefined\n * for a blank event.\n */\n constructor(opt_workspace?: Workspace) {\n super();\n /** Whether or not the event is blank (to be populated by fromJson). */\n this.isBlank = !!opt_workspace;\n\n if (!opt_workspace) return;\n\n /** The workspace identifier for this event. */\n this.workspaceId = opt_workspace.id;\n }\n\n /**\n * Encode the event as JSON.\n *\n * @returns JSON representation.\n */\n override toJson(): FinishedLoadingJson {\n const json = super.toJson() as FinishedLoadingJson;\n if (!this.workspaceId) {\n throw new Error(\n 'The workspace ID is undefined. Either pass a workspace to ' +\n 'the constructor, or call fromJson');\n }\n json['workspaceId'] = this.workspaceId;\n return json;\n }\n\n /**\n * Decode the JSON event.\n *\n * @param json JSON representation.\n */\n override fromJson(json: FinishedLoadingJson) {\n super.fromJson(json);\n this.workspaceId = json['workspaceId'];\n }\n}\n\nexport interface FinishedLoadingJson extends AbstractEventJson {\n workspaceId: string;\n}\n\nregistry.register(\n registry.Type.EVENT, eventUtils.FINISHED_LOADING, FinishedLoading);\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired as a result of actions in Blockly's editor.\n *\n * @namespace Blockly.Events\n */\nimport * as goog from '../../closure/goog/goog.js';\ngoog.declareModuleId('Blockly.Events');\n\n\nimport {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js';\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport {BlockChange, BlockChangeJson} from './events_block_change.js';\nimport {BlockCreate, BlockCreateJson} from './events_block_create.js';\nimport {BlockDelete, BlockDeleteJson} from './events_block_delete.js';\nimport {BlockDrag, BlockDragJson} from './events_block_drag.js';\nimport {BlockMove, BlockMoveJson} from './events_block_move.js';\nimport {BubbleOpen, BubbleOpenJson, BubbleType} from './events_bubble_open.js';\nimport {Click, ClickJson, ClickTarget} from './events_click.js';\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport {CommentChange, CommentChangeJson} from './events_comment_change.js';\nimport {CommentCreate, CommentCreateJson} from './events_comment_create.js';\nimport {CommentDelete} from './events_comment_delete.js';\nimport {CommentMove, CommentMoveJson} from './events_comment_move.js';\nimport {MarkerMove, MarkerMoveJson} from './events_marker_move.js';\nimport {Selected, SelectedJson} from './events_selected.js';\nimport {ThemeChange, ThemeChangeJson} from './events_theme_change.js';\nimport {ToolboxItemSelect, ToolboxItemSelectJson} from './events_toolbox_item_select.js';\nimport {TrashcanOpen, TrashcanOpenJson} from './events_trashcan_open.js';\nimport {Ui} from './events_ui.js';\nimport {UiBase} from './events_ui_base.js';\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport {VarCreate, VarCreateJson} from './events_var_create.js';\nimport {VarDelete, VarDeleteJson} from './events_var_delete.js';\nimport {VarRename, VarRenameJson} from './events_var_rename.js';\nimport {ViewportChange, ViewportChangeJson} from './events_viewport.js';\nimport * as eventUtils from './utils.js';\nimport {FinishedLoading, FinishedLoadingJson} from './workspace_events.js';\n\n\n// Events.\nexport const Abstract = AbstractEvent;\nexport {AbstractEventJson};\nexport {BubbleOpen};\nexport {BubbleOpenJson};\nexport {BubbleType};\nexport {BlockBase};\nexport {BlockBaseJson};\nexport {BlockChange};\nexport {BlockChangeJson};\nexport {BlockCreate};\nexport {BlockCreateJson};\nexport {BlockDelete};\nexport {BlockDeleteJson};\nexport {BlockDrag};\nexport {BlockDragJson};\nexport {BlockMove};\nexport {BlockMoveJson};\nexport {Click};\nexport {ClickJson};\nexport {ClickTarget};\nexport {CommentBase};\nexport {CommentBaseJson};\nexport {CommentChange};\nexport {CommentChangeJson};\nexport {CommentCreate};\nexport {CommentCreateJson};\nexport {CommentDelete};\nexport {CommentMove};\nexport {CommentMoveJson};\nexport {FinishedLoading};\nexport {FinishedLoadingJson};\nexport {MarkerMove};\nexport {MarkerMoveJson};\nexport {Selected};\nexport {SelectedJson};\nexport {ThemeChange};\nexport {ThemeChangeJson};\nexport {ToolboxItemSelect};\nexport {ToolboxItemSelectJson};\nexport {TrashcanOpen};\nexport {TrashcanOpenJson};\nexport {Ui};\nexport {UiBase};\nexport {VarBase};\nexport {VarBaseJson};\nexport {VarCreate};\nexport {VarCreateJson};\nexport {VarDelete};\nexport {VarDeleteJson};\nexport {VarRename};\nexport {VarRenameJson};\nexport {ViewportChange};\nexport {ViewportChangeJson};\n\n// Event types.\nexport const BLOCK_CHANGE = eventUtils.BLOCK_CHANGE;\nexport const BLOCK_CREATE = eventUtils.BLOCK_CREATE;\nexport const BLOCK_DELETE = eventUtils.BLOCK_DELETE;\nexport const BLOCK_DRAG = eventUtils.BLOCK_DRAG;\nexport const BLOCK_MOVE = eventUtils.BLOCK_MOVE;\nexport const BUBBLE_OPEN = eventUtils.BUBBLE_OPEN;\nexport type BumpEvent = eventUtils.BumpEvent;\nexport const BUMP_EVENTS = eventUtils.BUMP_EVENTS;\nexport const CHANGE = eventUtils.CHANGE;\nexport const CLICK = eventUtils.CLICK;\nexport const COMMENT_CHANGE = eventUtils.COMMENT_CHANGE;\nexport const COMMENT_CREATE = eventUtils.COMMENT_CREATE;\nexport const COMMENT_DELETE = eventUtils.COMMENT_DELETE;\nexport const COMMENT_MOVE = eventUtils.COMMENT_MOVE;\nexport const CREATE = eventUtils.CREATE;\nexport const DELETE = eventUtils.DELETE;\nexport const FINISHED_LOADING = eventUtils.FINISHED_LOADING;\nexport const MARKER_MOVE = eventUtils.MARKER_MOVE;\nexport const MOVE = eventUtils.MOVE;\nexport const SELECTED = eventUtils.SELECTED;\nexport const THEME_CHANGE = eventUtils.THEME_CHANGE;\nexport const TOOLBOX_ITEM_SELECT = eventUtils.TOOLBOX_ITEM_SELECT;\nexport const TRASHCAN_OPEN = eventUtils.TRASHCAN_OPEN;\nexport const UI = eventUtils.UI;\nexport const VAR_CREATE = eventUtils.VAR_CREATE;\nexport const VAR_DELETE = eventUtils.VAR_DELETE;\nexport const VAR_RENAME = eventUtils.VAR_RENAME;\nexport const VIEWPORT_CHANGE = eventUtils.VIEWPORT_CHANGE;\n\n// Event utils.\nexport const clearPendingUndo = eventUtils.clearPendingUndo;\nexport const disable = eventUtils.disable;\nexport const enable = eventUtils.enable;\nexport const filter = eventUtils.filter;\nexport const fire = eventUtils.fire;\nexport const fromJson = eventUtils.fromJson;\nexport const getDescendantIds = eventUtils.getDescendantIds;\nexport const get = eventUtils.get;\nexport const getGroup = eventUtils.getGroup;\nexport const getRecordUndo = eventUtils.getRecordUndo;\nexport const isEnabled = eventUtils.isEnabled;\nexport const setGroup = eventUtils.setGroup;\nexport const setRecordUndo = eventUtils.setRecordUndo;\nexport const disableOrphans = eventUtils.disableOrphans;\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview The entrypoint for blockly_compressed.js. Provides\n * various backwards-compatibility hacks. Not used when loading\n * in uncompiled (uncompressed) mode via bootstrap.js.\n */\n'use strict';\n\ngoog.module('Blockly.main');\n\nconst Blockly = goog.require('Blockly');\nconst ContextMenu = goog.require('Blockly.ContextMenu');\nconst Events = goog.require('Blockly.Events');\nconst Msg = goog.require('Blockly.Msg');\nconst Tooltip = goog.require('Blockly.Tooltip');\nconst WidgetDiv = goog.require('Blockly.WidgetDiv');\nconst colour = goog.require('Blockly.utils.colour');\nconst common = goog.require('Blockly.common');\nconst deprecation = goog.require('Blockly.utils.deprecation');\nconst dialog = goog.require('Blockly.dialog');\nconst eventUtils = goog.require('Blockly.Events.utils');\n\n/*\n * Aliased functions and properties that used to be on the Blockly namespace.\n * Everything in this section is deprecated. Both external and internal code\n * should avoid using these functions and use the designated replacements.\n * Everything in this section will be removed in a future version of Blockly.\n */\n\n// Add accessors for properties on Blockly that have now been deprecated.\nObject.defineProperties(Blockly, {\n /**\n * Wrapper to window.alert() that app developers may override to\n * provide alternatives to the modal browser window.\n * @name Blockly.alert\n * @type {!function(string, function()=)}\n * @deprecated Use Blockly.dialog.alert / .setAlert() instead.\n * (December 2021)\n * @suppress {checkTypes}\n */\n alert: {\n set: function(newAlert) {\n deprecation.warn('Blockly.alert', 'December 2021', 'December 2022');\n dialog.setAlert(newAlert);\n },\n get: function() {\n deprecation.warn(\n 'Blockly.alert', 'December 2021', 'December 2022',\n 'Blockly.dialog.alert()');\n return dialog.alert;\n },\n },\n /**\n * Wrapper to window.confirm() that app developers may override to\n * provide alternatives to the modal browser window.\n * @name Blockly.confirm\n * @type {!function(string, function()=)}\n * @deprecated Use Blockly.dialog.confirm / .setConfirm() instead.\n * (December 2021)\n * @suppress {checkTypes}\n */\n confirm: {\n set: function(newConfirm) {\n deprecation.warn('Blockly.confirm', 'December 2021', 'December 2022');\n dialog.setConfirm(newConfirm);\n },\n get: function() {\n deprecation.warn(\n 'Blockly.confirm', 'December 2021', 'December 2022',\n 'Blockly.dialog.confirm()');\n return dialog.confirm;\n },\n },\n /**\n * The main workspace most recently used.\n * Set by Blockly.WorkspaceSvg.prototype.markFocused\n * @name Blockly.mainWorkspace\n * @type {Workspace}\n * @suppress {checkTypes}\n */\n mainWorkspace: {\n set: function(x) {\n deprecation.warn(\n 'Blockly.mainWorkspace', 'version 9', 'version 10',\n 'Blockly.getMainWorkspace');\n common.setMainWorkspace(x);\n },\n get: function() {\n deprecation.warn(\n 'Blockly.mainWorkspace', 'version 9', 'version 10',\n 'Blockly.getMainWorkspace');\n return common.getMainWorkspace();\n },\n },\n /**\n * Wrapper to window.prompt() that app developers may override to\n * provide alternatives to the modal browser window. Built-in\n * browser prompts are often used for better text input experience\n * on mobile device. We strongly recommend testing mobile when\n * overriding this.\n * @name Blockly.prompt\n * @type {!function(string, string, function()=)}\n * @deprecated Use Blockly.dialog.prompt / .setPrompt() instead.\n * (December 2021)\n * @suppress {checkTypes}\n */\n prompt: {\n set: function(newPrompt) {\n deprecation.warn('Blockly.prompt', 'December 2021', 'December 2022');\n dialog.setPrompt(newPrompt);\n },\n get: function() {\n deprecation.warn(\n 'Blockly.prompt', 'December 2021', 'December 2022',\n 'Blockly.dialog.prompt()');\n return dialog.prompt;\n },\n },\n /**\n * Currently selected block.\n * @name Blockly.selected\n * @type {?ICopyable}\n * @suppress {checkTypes}\n */\n selected: {\n get: function() {\n deprecation.warn(\n 'Blockly.selected', 'version 9', 'version 10', 'Blockly.getSelected');\n return common.getSelected();\n },\n set: function(newSelection) {\n deprecation.warn(\n 'Blockly.selected', 'version 9', 'version 10', 'Blockly.getSelected');\n common.setSelected(newSelection);\n },\n },\n /**\n * The richness of block colours, regardless of the hue.\n * Must be in the range of 0 (inclusive) to 1 (exclusive).\n * @name Blockly.HSV_SATURATION\n * @type {number}\n * @suppress {checkTypes}\n */\n HSV_SATURATION: {\n get: function() {\n return colour.getHsvSaturation();\n },\n set: function(newValue) {\n colour.setHsvSaturation(newValue);\n },\n },\n /**\n * The intensity of block colours, regardless of the hue.\n * Must be in the range of 0 (inclusive) to 1 (exclusive).\n * @name Blockly.HSV_VALUE\n * @type {number}\n * @suppress {checkTypes}\n */\n HSV_VALUE: {\n get: function() {\n return colour.getHsvValue();\n },\n set: function(newValue) {\n colour.setHsvValue(newValue);\n },\n },\n});\n\n// Add accessors for properties on Blockly.ContextMenu that have now\n// been deprecated.\nObject.defineProperties(ContextMenu, {\n /**\n * Which block is the context menu attached to?\n * @name Blockly.ContextMenu.currentBlock\n * @type {Block}\n * @deprecated Use Blockly.Tooltip.getCurrentBlock() /\n * .setCurrentBlock() instead. (September 2021)\n * @suppress {checkTypes}\n */\n currentBlock: {\n get: function() {\n deprecation.warn(\n 'Blockly.ContextMenu.currentBlock', 'September 2021',\n 'September 2022', 'Blockly.Tooltip.getCurrentBlock()');\n return ContextMenu.getCurrentBlock();\n },\n set: function(block) {\n deprecation.warn(\n 'Blockly.ContextMenu.currentBlock', 'September 2021',\n 'September 2022', 'Blockly.Tooltip.setCurrentBlock(block)');\n ContextMenu.setCurrentBlock(block);\n },\n },\n});\n\n// Add accessors for properties on Blockly.Events that have now been\n// deprecated.\nObject.defineProperties(Events, {\n /**\n * Sets whether the next event should be added to the undo stack.\n * @name Blockly.Evenents.recordUndo\n * @type {boolean}\n * @deprecated Use Blockly.Events.getRecordUndo() and\n * .setRecordUndo(). (September 2021)\n * @suppress {checkTypes}\n */\n recordUndo: {\n get: function() {\n deprecation.warn(\n 'Blockly.Events.recordUndo', 'September 2021', 'September 2022',\n 'Blockly.Events.getRecordUndo()');\n return eventUtils.getRecordUndo();\n },\n set: function(record) {\n deprecation.warn(\n 'Blockly.Events.recordUndo', 'September 2021', 'September 2022',\n 'Blockly.Events.setRecordUndo()');\n eventUtils.setRecordUndo(record);\n },\n },\n});\n\n\n// Add accessors for properties on Blockly.Tooltip that have now been\n// deprecated.\nObject.defineProperties(Tooltip, {\n /**\n * Is a tooltip currently showing?\n * @name Blockly.Tooltip.visible\n * @type {boolean}\n * @deprecated Use Blockly.Tooltip.isVisible() instead. (September\n * 2021)\n * @suppress {checkTypes}\n */\n visible: {\n get: function() {\n deprecation.warn(\n 'Blockly.Tooltip.visible', 'September 2021', 'September 2022',\n 'Blockly.Tooltip.isVisible()');\n return Tooltip.isVisible();\n },\n },\n /**\n * The HTML container. Set once by createDom.\n * @name Blockly.Tooltip.DIV\n * @type {HTMLDivElement}\n * @deprecated Use Blockly.Tooltip.getDiv() and .setDiv().\n * (September 2021)\n * @suppress {checkTypes}\n */\n DIV: {\n get: function() {\n deprecation.warn(\n 'Blockly.Tooltip.DIV', 'September 2021', 'September 2022',\n 'Blockly.Tooltip.getDiv()');\n return Tooltip.getDiv();\n },\n },\n});\n\n// Add accessors for properties on Blockly.WidgetDiv that have now been\n// deprecated.\nObject.defineProperties(WidgetDiv, {\n /**\n * The HTML container for popup overlays (e.g. editor widgets).\n * @name Blockly.WidgetDiv.DIV\n * @type {?Element}\n * @deprecated Use Blockly.WidgetDiv.getDiv() and .setDiv().\n * (September 2021)\n * @suppress {checkTypes}\n */\n DIV: {\n get: function() {\n deprecation.warn(\n 'Blockly.WidgetDiv.DIV', 'September 2021', 'September 2022',\n 'Blockly.WidgetDiv.getDiv()');\n return WidgetDiv.getDiv();\n },\n },\n});\n\n// If Blockly is compiled with ADVANCED_COMPILATION and/or loaded as a\n// CJS or ES module there will not be a Blockly global variable\n// created. This can cause problems because a very common way of\n// loading translations is to use a <script> tag to load one of\n// msg/js/*.js, which consists of lines like:\n//\n// Blockly.Msg[\"ADD_COMMENT\"] = \"Add Comment\";\n// Blockly.Msg[\"CLEAN_UP\"] = \"Clean up Blocks\";\n//\n// This obviously only works if Blockly.Msg is the Msg export from the\n// Blockly.Msg module - so make sure it is, but only if there is not\n// yet a Blockly global variable.\nif (!('Blockly' in globalThis)) {\n globalThis['Blockly'] = {'Msg': Msg};\n}\n"]} |