{"version":3,"sources":["core/registry.ts","core/touch.ts","core/browser_events.ts","core/utils/idgenerator.ts","core/events/predicates.ts","core/events/utils.ts","core/utils/dom.ts","core/interfaces/i_focusable_node.ts","core/interfaces/i_selectable.ts","core/utils/object.ts","core/common.ts","core/utils/array.ts","core/css.ts","core/utils/style.ts","core/utils/svg_math.ts","core/utils/xml.ts","core/utils/toolbox.ts","core/positionable_helpers.ts","core/serialization/registry.ts","core/serialization/workspace_comments.ts","core/clipboard/registry.ts","core/clipboard/workspace_comment_paster.ts","core/utils/aria.ts","core/interfaces/i_serializable.ts","core/render_management.ts","core/dialog.ts","core/interfaces/i_legacy_procedure_blocks.ts","core/interfaces/i_variable_backed_parameter_model.ts","core/utils/deprecation.ts","core/variables.ts","core/serialization/blocks.ts","core/interfaces/i_has_bubble.ts","core/utils/math.ts","core/dropdowndiv.ts","core/utils/string.ts","core/tooltip.ts","core/utils/colour.ts","core/utils/parsing.ts","core/widgetdiv.ts","core/contextmenu.ts","core/utils/drag.ts","core/xml.ts","core/field_registry.ts","core/field_dropdown.ts","core/extensions.ts","core/utils/svg_paths.ts","core/connection.ts","core/interfaces/i_icon.ts","core/interfaces/i_comment_icon.ts","core/block_animations.ts","core/clipboard/block_paster.ts","core/bump_objects.ts","core/interfaces/i_deletable.ts","core/keyboard_nav/block_navigation_policy.ts","core/icons/registry.ts","core/interfaces/i_draggable.ts","core/interfaces/i_autohideable.ts","core/interfaces/i_procedure_block.ts","core/interfaces/i_observable.ts","core/procedures.ts","core/renderers/common/constants.ts","core/renderers/common/block_rendering.ts","core/variables_dynamic.ts","core/workspace_svg.ts","core/clipboard.ts","core/interfaces/i_copyable.ts","core/shortcut_items.ts","core/serialization/procedures.ts","core/serialization/workspaces.ts","core/inject.ts","core/contextmenu_items.ts","core/interfaces/i_paster.ts","core/interfaces/i_rendered_element.ts","core/interfaces/i_selectable_toolbox_item.ts","core/blockly.ts","core/interfaces/i_focusable_tree.ts","src/com/google/javascript/jscomp/js/base.js","core/focus_manager.ts","src/com/google/javascript/jscomp/js/util/defines.js","src/com/google/javascript/jscomp/js/util/objectcreate.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/util/construct.js","src/com/google/javascript/jscomp/js/es6/util/setprototypeof.js","src/com/google/javascript/jscomp/js/es6/util/inherits.js","src/com/google/javascript/jscomp/js/es6/util/arrayiterator.js","src/com/google/javascript/jscomp/js/es6/util/makeiterator.js","src/com/google/javascript/jscomp/js/es6/util/arrayfromiterator.js","src/com/google/javascript/jscomp/js/es6/util/arrayfromiterable.js","src/com/google/javascript/jscomp/js/es6/generator_engine.js","src/com/google/javascript/jscomp/js/es6/execute_async_generator.js","src/com/google/javascript/jscomp/js/es6/globalthis.js","src/com/google/javascript/jscomp/js/es6/array/includes.js","src/com/google/javascript/jscomp/js/es6/conformance.js","src/com/google/javascript/jscomp/js/es6/symbol.js","src/com/google/javascript/jscomp/js/util/owns.js","src/com/google/javascript/jscomp/js/es6/map.js","src/com/google/javascript/jscomp/js/es6/set_extensions.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/es6/array/flatmap.js","src/com/google/javascript/jscomp/js/es6/array/flat.js","src/com/google/javascript/jscomp/js/es6/object/entries.js","src/com/google/javascript/jscomp/js/es6/object/values.js","core/blocks.ts","core/utils/useragent.ts","core/events/type.ts","core/utils/focusable_tree_traverser.ts","core/shortcut_registry.ts","core/events/events_abstract.ts","core/events/events_ui_base.ts","core/events/events_click.ts","core/component_manager.ts","core/utils/coordinate.ts","core/utils/svg.ts","core/utils/rect.ts","core/utils/size.ts","core/scrollbar.ts","core/sprites.ts","core/zoom_controls.ts","core/serialization/priorities.ts","core/config.ts","core/menuitem.ts","core/menu.ts","core/menu_separator.ts","core/constants.ts","core/inputs/input_types.ts","core/msg.ts","core/toast.ts","core/serialization/exceptions.ts","core/icons/icon_types.ts","core/events/events_block_base.ts","core/events/events_block_change.ts","core/field.ts","core/contextmenu_registry.ts","core/layers.ts","core/dragging/comment_drag_strategy.ts","core/comments/comment_bar_button.ts","core/comments/collapse_comment_bar_button.ts","core/comments/comment_editor.ts","core/comments/delete_comment_bar_button.ts","core/comments/comment_view.ts","core/comments/workspace_comment.ts","core/comments/rendered_workspace_comment.ts","core/events/events_block_create.ts","core/events/events_theme_change.ts","core/events/events_viewport.ts","core/theme.ts","core/theme/classic.ts","core/options.ts","core/dragging/bubble_drag_strategy.ts","core/bubbles/bubble.ts","core/bubbles/mini_workspace_bubble.ts","core/icons/icon.ts","core/icons/mutator_icon.ts","core/utils/keycodes.ts","core/utils.ts","core/bubbles/textinput_bubble.ts","core/connection_type.ts","core/connection_db.ts","core/events/events_selected.ts","core/events/events_block_delete.ts","core/icons/exceptions.ts","core/inputs/align.ts","core/field_label.ts","core/internal_constants.ts","core/rendered_connection.ts","core/inputs/input.ts","core/inputs/dummy_input.ts","core/inputs/end_row_input.ts","core/inputs/statement_input.ts","core/inputs/value_input.ts","core/block.ts","core/dragging/block_drag_strategy.ts","core/bubbles/text_bubble.ts","core/icons/warning_icon.ts","core/block_svg.ts","core/drag_target.ts","core/delete_area.ts","core/flyout_item.ts","core/metrics_manager.ts","core/flyout_metrics_manager.ts","core/flyout_button.ts","core/keyboard_nav/flyout_button_navigation_policy.ts","core/keyboard_nav/flyout_navigation_policy.ts","core/flyout_separator.ts","core/keyboard_nav/flyout_separator_navigation_policy.ts","core/keyboard_nav/block_comment_navigation_policy.ts","core/keyboard_nav/comment_bar_button_navigation_policy.ts","core/keyboard_nav/comment_editor_navigation_policy.ts","core/keyboard_nav/connection_navigation_policy.ts","core/keyboard_nav/field_navigation_policy.ts","core/icons/comment_icon.ts","core/keyboard_nav/icon_navigation_policy.ts","core/keyboard_nav/workspace_comment_navigation_policy.ts","core/keyboard_nav/workspace_navigation_policy.ts","core/navigator.ts","core/flyout_navigator.ts","core/scrollbar_pair.ts","core/separator_flyout_inflater.ts","core/flyout_base.ts","core/keyboard_navigation_controller.ts","core/workspace_dragger.ts","core/gesture.ts","core/grid.ts","core/layer_manager.ts","core/keyboard_nav/marker.ts","core/keyboard_nav/line_cursor.ts","core/marker_manager.ts","core/icons.ts","core/names.ts","core/observable_procedure_map.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/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/statement_input.ts","core/renderers/measurables/top_row.ts","core/renderers/common/drawer.ts","core/renderers/common/info.ts","core/renderers/common/path_object.ts","core/renderers/common/renderer.ts","core/theme_manager.ts","core/connection_checker.ts","core/workspace.ts","core/workspace_audio.ts","core/events/events_var_base.ts","core/events/events_var_create.ts","core/variable_model.ts","core/events/events_var_delete.ts","core/events/events_var_rename.ts","core/variable_map.ts","core/events/events_trashcan_open.ts","core/trashcan.ts","core/comments.ts","core/serialization/variables.ts","core/serialization.ts","core/main.ts","core/label_flyout_inflater.ts","core/renderers/zelos/constants.ts","core/renderers/zelos/drawer.ts","core/field_image.ts","core/field_input.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/path_object.ts","core/renderers/zelos/renderer.ts","core/insertion_marker_previewer.ts","core/inputs.ts","core/generator.ts","core/flyout_vertical.ts","core/flyout_horizontal.ts","core/field_variable.ts","core/field_number.ts","core/field_label_serializable.ts","core/field_checkbox.ts","core/dragging/dragger.ts","core/dragging.ts","core/events/events_block_drag.ts","core/events/events_block_field_intermediate_change.ts","core/events/events_block_move.ts","core/events/events_bubble_open.ts","core/events/events_comment_base.ts","core/events/events_comment_change.ts","core/events/events_comment_collapse.ts","core/events/events_comment_create.ts","core/events/events_comment_delete.ts","core/events/events_comment_drag.ts","core/events/events_comment_move.ts","core/events/events_comment_resize.ts","core/events/events_toolbox_item_select.ts","core/events/events_var_type_change.ts","core/events/workspace_events.ts","core/events/events.ts","core/renderers/zelos/zelos.ts","core/button_flyout_inflater.ts","core/bubbles.ts","core/blockly_options.ts","core/block_flyout_inflater.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/renderers/thrasos/info.ts","core/renderers/thrasos/renderer.ts","core/renderers/thrasos/thrasos.ts","core/theme/zelos.ts","core/theme/themes.ts","core/toolbox/toolbox_item.ts","core/toolbox/category.ts","core/toolbox/separator.ts","core/toolbox/collapsible_category.ts","core/toolbox/toolbox.ts","core/interfaces/i_navigation_policy.ts","core/utils/metrics.ts","core/renderers/common/i_path_object.ts","core/interfaces/i_variable_model.ts","core/interfaces/i_variable_map.ts","core/interfaces/i_toolbox_item.ts","core/interfaces/i_toolbox.ts","core/interfaces/i_styleable.ts","core/interfaces/i_serializer.ts","core/interfaces/i_registrable.ts","core/interfaces/i_procedure_model.ts","core/interfaces/i_procedure_map.ts","core/interfaces/i_positionable.ts","core/interfaces/i_parameter_model.ts","core/interfaces/i_movable.ts","core/interfaces/i_metrics_manager.ts","core/interfaces/i_keyboard_accessible.ts","build/src/core/interfaces/i_flyout_inflater.js","core/interfaces/i_flyout.ts","core/interfaces/i_dragger.ts","core/interfaces/i_drag_target.ts","core/interfaces/i_delete_area.ts","core/interfaces/i_contextmenu.ts","core/interfaces/i_connection_previewer.ts","core/interfaces/i_connection_checker.ts","core/interfaces/i_component.ts","core/interfaces/i_collapsible_toolbox_item.ts","core/interfaces/i_bubble.ts","core/interfaces/i_bounded_element.ts"],"names":["register","validate","unregister","getItem","hasItem","getClass","getObject","getAllItems","getClassFromOptions","longStart","longStop","clearTouchIdentifier","shouldHandleEvent","getTouchIdentifierFromEvent","checkTouchIdentifier","conditionalBind","bind","unbind","isTargetInput","isRightButton","mouseToSvg","getScrollDeltaPixels","getNextUniqueId","genUid","isBlockCreate","isBlockDelete","isBlockChange","isBlockFieldIntermediateChange","isBlockMove","isVarCreate","isVarDelete","isVarRename","isBlockDrag","isSelected","isClick","isBubbleOpen","isTrashcanOpen","isToolboxItemSelect","isThemeChange","isViewportChange","isCommentCreate","isCommentDelete","isCommentChange","isCommentMove","isCommentResize","isCommentDrag","isCommentCollapse","isFinishedLoading","getRecordUndo","fire","fireInternal","fireNow","enqueueEvent","filter","clearPendingUndo","isEnabled","setGroupInternal","getDescendantIds","fromJson","get","disableOrphans","createSvgElement","addClass","removeClasses","removeClass","hasClass","removeNode","insertAfter","setCssTransform","startTextWidthCache","stopTextWidthCache","getTextWidth","getFastTextWidth","getFastTextWidthWithSizeString","measureFontMetrics","isFocusableNode","isSelectable","deepMerge","getWorkspaceById","getAllWorkspaces","registerWorkspace","unregisterWorkpace","getMainWorkspace","setMainWorkspace","getSelected","setSelected","fireSelectedEvent","getParentContainer","setParentContainer","svgResize","getBlockTypeCounts","jsonInitFactory","defineBlocksWithJsonArray","defineBlocksWithJsonArrayInternal","globalShortcutHandler","removeElem","inject","getSize","getSizeInternal","getSizeWithDisplay","getComputedStyle","getPageOffset","getViewportPageOffset","getBorderBox","scrollIntoContainerView","getContainerOffsetToScrollInto","getRelativeXY","getInjectionDivXY","getViewportBBox","getDocumentScroll","screenToWsCoordinates","wsToScreenCoordinates","injectDependencies","domToText","sanitizeText","convertToolboxDefToJson","validateToolbox","convertFlyoutDefToJsonArray","hasCategories","hasCategoriesInternal","isCategoryCollapsible","convertToToolboxJson","xmlToJsonArray","addAttributes","parseToolboxTree","getStartPositionRect","getCornerOppositeToolbox","bumpPositionRect","save","append","moveCommentToNotConflict","commentOverlapsOtherExactly","setRole","setState","isSerializable","queueRender","finishQueuedRenders","triggerQueuedRenders","alwaysImmediatelyRender","queueBlock","doRenders","dequeueBlock","shouldRenderRootBlock","renderBlock","alert","setAlert","confirm","setConfirm","prompt","setPrompt","toast","setToast","isLegacyProcedureDefBlock","isLegacyProcedureCallBlock","isVariableBackedParameterModel","warn","internalFlyoutCategory","flyoutCategory","generateVariableFieldJson","jsonFlyoutCategoryBlocks","xmlFlyoutCategory","flyoutCategoryBlocks","generateUniqueName","generateUniqueNameInternal","generateUniqueNameFromOptions","createVariableButtonHandler","promptName","nameUsedWithOtherType","nameUsedWithAnyType","nameUsedWithConflictingParam","checkForConflictingParamWithProcedureModels","checkForConflictingParamWithLegacyProcedures","generateVariableFieldDom","createVariable","getAddedVariables","compareByName","getVariableUsesById","saveAttributes","saveCoords","saveExtraState","saveIcons","saveFields","saveInputBlocks","saveNextBlocks","saveConnection","appendInternal","appendPrivate","checkNewVariables","loadCoords","loadAttributes","loadExtraState","tryToConnectParent","loadIcons","loadFields","loadInputBlocks","loadNextBlocks","loadConnection","initBlock","hasBubble","toRadians","toDegrees","clamp","createDom","setBoundsElement","getOwner","getContentDiv","clearContent","setColour","showPositionedByBlock","showPositionedByField","getScaledBboxOfBlock","getScaledBboxOfField","showPositionedByRect","show","getPositionBelowMetrics","getPositionAboveMetrics","getPositionTopOfPageMetrics","getPositionX","isVisible","hideIfOwner","hide","hideWithoutAnimation","positionInternal","repositionForWindowResize","shortestStringLength","commonWordPrefix","commonWordSuffix","wrapLine","wrapScore","wrapMutate","wrapToText","setCustomTooltip","getCustomTooltip","getDiv","getTooltipOfObject","getTargetObject","bindMouseEvents","unbindMouseEvents","onMouseOver","onMouseOut","onMouseMove","dispose","block","unblock","renderContent","renderDefaultContent","getPosition","getHsvSaturation","setHsvSaturation","getHsvValue","setHsvValue","parse","rgbToHex","hexToRgb","hsvToHex","blend","hueToHex","tokenizeInterpolationInternal","tokenizeInterpolation","replaceMessageReferences","checkMessageReferences","parseBlockColour","testOnly_setDiv","hideIfOwnerIsInWorkspace","positionWithAnchor","calculateX","calculateY","isRepositionable","getCurrentBlock","setCurrentBlock","populate_","position_","createWidget_","haltPropagation","mouseToWorkspacePoint","start","move","workspaceToDom","saveWorkspaceComment","variablesToDom","blockToDomWithXY","fieldToDom","allFieldsToDom","blockToDom","cloneShadow","domToPrettyText","clearWorkspaceAndLoadFromXml","loadWorkspaceComment","appendDomToWorkspace","domToBlockInternal","domToVariables","mapSupportedXmlTags","applyMutationTagNodes","applyCommentTagNodes","applyDataTagNodes","applyFieldTagNodes","findChildBlocks","applyInputTagNodes","applyNextTagNodes","domToBlockHeadless","domToField","deleteNext","isElement","fromJsonInternal","isImageProperties","isRegistered","apply","checkNoMutatorProperties","checkXmlHooks","checkJsonHooks","checkMutatorDialog","checkHasFunctionPair","checkHasMutatorProperties","getMutatorProperties","mutatorPropertiesMatch","runAfterPageLoad","checkDropdownOptionsInTable","extensionParentTooltip","point","curve","moveTo","moveBy","lineTo","line","lineOnAxis","arc","connectReciprocally","getSingleConnection","getConnectionForOrphanedOutput","isIcon","isCommentIcon","disposeUiEffect","disposeUiStep","connectionUiEffect","disconnectUiEffect","disconnectUiStep","disconnectUiStop","moveBlockToNotConflict","blockOverlapsOtherExactly","blockIsInSnapRadius","bumpObjectIntoBounds","bumpIntoBoundsHandler","extractObjectFromEvent","bumpTopObjectsIntoBounds","isDeletable","getBlockNavigationCandidates","navigateStacks","navigateBlock","isDraggable","isAutoHideable","isProcedureBlock","isObservable","allProcedures","procTupleComparator","isLegalName","isNameUsed","updateMutatorFlyout","mutatorOpenListener","mutatorChangeListener","getCallers","blockIsModernCallerFor","isDynamicShape","isPuzzleTab","isNotch","init","stringButtonClickHandler","numberButtonClickHandler","colourButtonClickHandler","resizeSvgContents","copy","getLastCopiedData","setLastCopiedData","getLastCopiedWorkspace","setLastCopiedWorkspace","getLastCopiedLocation","setLastCopiedLocation","paste","pasteFromData","isCopyable","registerEscape","registerDelete","isCuttable","registerCopy","registerCut","registerPaste","registerUndo","registerRedo","registerDefaultShortcuts","saveProcedure","loadProcedure","load","createMainWorkspace","bindDocumentEvents","loadSounds","isFullBlockField","registerCleanup","toggleOption_","registerCollapse","registerExpand","addDeletableBlocks_","getDeletableBlocks_","deleteNext_","registerDeleteAll","registerWorkspaceOptions_","registerDuplicate","registerComment","registerInline","registerCollapseExpandBlock","registerDisable","registerHelp","registerCommentDelete","registerCommentDuplicate","registerCommentCreate","registerBlockOptions_","registerCommentOptions","registerDefaultOptions","isPaster","isRenderedElement","isSelectableToolboxItem","hideChaff","isFocusableTree","type","name","registryItem","opt_allowOverrides","Type","trim","Error","toLowerCase","caselessName","typeRegistry","typeMap","nameRegistry","nameMap","Object","create","String","FIELD","console","opt_throwIfMissing","msg","opt_cased","casedRegistry","key","keys","options","plugin","plugins","DEFAULT","e","gesture","longPid_","setTimeout","handleRightClick","LONGPRESS","clearTimeout","touchIdentifier_","startsWith","PointerEvent","pointerId","identifier","node","thisObject","func","opt_noCaptureIdentifier","wrapFunc","call","bindData","TOUCH_MAP","i","length","addEventListener","push","callback","pop","removeEventListener","target","HTMLElement","isContentEditable","getAttribute","HTMLInputElement","HTMLTextAreaElement","ctrlKey","MAC","button","svg","matrix","svgPoint","createSVGPoint","x","clientX","y","clientY","getScreenCTM","inverse","matrixTransform","deltaMode","deltaX","deltaY","LINE_MODE_MULTIPLIER","PAGE_MODE_MULTIPLIER","toString","nextId","internal","event","EventType","BLOCK_CREATE","BLOCK_DELETE","BLOCK_CHANGE","BLOCK_FIELD_INTERMEDIATE_CHANGE","BLOCK_MOVE","VAR_CREATE","VAR_DELETE","VAR_RENAME","BLOCK_DRAG","SELECTED","CLICK","BUBBLE_OPEN","TRASHCAN_OPEN","TOOLBOX_ITEM_SELECT","THEME_CHANGE","VIEWPORT_CHANGE","COMMENT_CREATE","COMMENT_DELETE","COMMENT_CHANGE","COMMENT_MOVE","COMMENT_RESIZE","COMMENT_DRAG","COMMENT_COLLAPSE","FINISHED_LOADING","setRecordUndo","newValue","recordUndo","TEST_ONLY","FIRE_QUEUE","requestAnimationFrame","queue","workspaceId","fireChangeListener","element","otherEvent","group","newParentId","blockId","splice","mergedQueue","lastEvent","isNull","newInputName","newCoordinate","reason","Array","from","Set","concat","viewTop","viewLeft","scale","oldScale","disable","disabled","enable","getGroup","setGroup","state","ids","descendants","getDescendants","descendant","id","json","workspace","eventClass","eventType","EVENT","eventWorkspace","getBlockById","initialUndoFlag","parent","getParent","hasDisabledReason","ORPHANED_BLOCK_DISABLED_REASON","children","child","setDisabledReason","outputConnection","previousConnection","isDragging","getNextBlock","attrs","opt_parent","document","createElementNS","SVG_NS","setAttribute","appendChild","className","classNames","split","every","classList","contains","add","remove","parentNode","removeChild","newNode","refNode","siblingNode","nextSibling","insertBefore","transform","style","cacheReference","cacheWidths","textElement","textContent","baseVal","width","window","fontSize","fontWeight","fontFamily","text","canvasContext","computeCanvas","createElement","body","getContext","font","measureText","span","height","div","display","position","top","left","result","baseline","alignItems","offsetTop","getFocusManager","FocusManager","obj","getFocusableElement","getFocusableTree","onNodeFocus","onNodeBlur","canBeFocused","select","unselect","source","isArray","WorkspaceDB_","workspaces","mainWorkspace","focused","getFocusedNode","newSelection","focusNode","selected","parentContainer","newParent","parentWorkspace","getParentSvg","cachedSize","getCachedParentSvgSize","parentElement","offsetWidth","offsetHeight","setCachedParentSvgSize","resize","opt_stripFollowing","typeCountsMap","nextBlock","index","indexOf","checkBlock","jsonDef","jsonInit","jsonArray","defineBlocks","createBlockDefinitionsFromJsonArray","blocks","elem","definition","Blocks","focusedTree","getFocusedTree","ws","rendered","isFlyout","ShortcutRegistry","registry","onKeyDown","arr","value","cssContent","injected","content","hasCss","pathToMedia","mediaPath","replace","cssNode","cssTextNode","createTextNode","head","firstChild","originalDisplay","originalVisibility","visibility","originalPosition","Size","property","styles","getPropertyValue","el","pos","Coordinate","box","getBoundingClientRect","documentElement","scrollCoord","pageXOffset","scrollLeft","pageYOffset","scrollTop","parseFloat","right","bottom","Rect","container","opt_center","offset","elementPos","containerPos","containerBorder","relX","relY","elementSize","spaceX","clientWidth","spaceY","clientHeight","Math","min","max","xy","parseInt","r","match","XY_REGEX","Number","includes","styleComponents","XY_STYLE_REGEX","scrollOffset","win","screenCoordinates","screenX","screenY","boundingRect","getInjectionDiv","injectionDiv","clientOffsetPixels","mainOffsetPixels","getOriginOffsetInPixels","difference","finalOffsetPixels","finalOffsetMainWs","workspaceCoordinates","mainOffset","dependencies","DOMParser","XMLSerializer","domParser","xmlSerializer","tagName","NAME_SPACE","textToDom","doc","parseFromString","getElementsByTagName","nodeName","dom","serializeToString","INVALID_CONTROL_CHARS","charCodeAt","toolboxDef","Element","toolboxJson","toolboxKind","toolboxContents","FLYOUT_TOOLBOX_KIND","CATEGORY_TOOLBOX_KIND","flyoutDef","nodeType","categories","item","toUpperCase","categoryInfo","contents","Node","childNodes","j","attributes","attr","parsedToolboxDef","TypeError","size","horizontalPadding","verticalPadding","metrics","hasVerticalScrollbar","scrollbar","canScrollVertically","horizontal","horizontalPosition","LEFT","absoluteMetrics","RTL","Scrollbar","scrollbarThickness","viewMetrics","vertical","verticalPosition","TOP","canScrollHorizontally","toolboxMetrics","hPosition","Position","horizontalLayout","RIGHT","vPosition","BOTTOM","startRect","margin","bumpDir","savedPositions","otherEl","intersects","bumpDirection","UP","serializer","SERIALIZER","comment","addCoordinates","saveIds","loc","getRelativeToSurfaceXY","getWidth","getText","isCollapsed","collapsed","isOwnEditable","editable","isOwnMovable","movable","isOwnDeletable","deletable","prevRecordUndo","newComment","undefined","setText","defaultLoc","defaultSize","setSize","setCollapsed","setEditable","setMovable","setDeletable","paster","PASTER","coord","otherCoords","getTopComments","otherComment","map","c","sum","translate","translateDistance","some","otherCoord","abs","roleName","ROLE_ATTRIBUTE","stateName","join","ARIA_PREFIX","saveState","loadState","Promise","resolve","afterRendersPromise","afterRendersResolver","animationRequestId","cancelAnimationFrame","JavaFx","dirtyBlocks","eventGroups","set","rootBlocks","b","has","resizeContents","blockOrigin","updateComponentLocations","oldGroup","newGroup","bumpNeighbours","delete","getChildren","isDisposed","initialized","renderEfficiently","message","opt_callback","alertImplementation","alertFunction","defaultAlert","confirmImplementation","confirmFunction","defaultConfirm","defaultValue","promptImplementation","promptFunction","defaultPrompt","toastImplementation","toastFunction","defaultToast","getProcedureDef","getProcedureCall","renameProcedure","param","getVariableModel","deprecationDate","deletionDate","opt_use","previousWarnings","allUsedVarModels","getAllBlocks","variables","blockVariables","getVarModels","variable","getId","values","allDeveloperVariables","getDeveloperVariables","devVars","useXml","registerButtonCallback","getTargetWorkspace","getVariableMap","getVariablesOfType","getName","getType","includeChangeBlocks","getterType","setterType","mostRecentVariable","slice","kind","gap","fields","sort","xmlList","blockList","variableModelList","VAR_LETTER_OPTIONS","charAt","getAllVariables","v","startChar","usedNames","letters","suffix","letterIndex","inUse","potName","opt_type","promptAndCheckWithAlert","defaultName","Msg","existing","renameVariable","promptText","newName","procedure","defaultText","newVar","allVariables","oldName","getProcedureMap","getProcedures","procedures","params","getParameters","procHasOld","procHasNew","def","blockHasOld","blockHasNew","variableModel","field","getOrCreateVariablePackage","opt_name","getVariable","potentialVariableMap","getPotentialVariableMap","getVariableById","variableMap","targetWorkspace","originalVariables","allCurrentVariables","addedVariables","var1","var2","localeCompare","sensitivity","uses","deleteVariable","triggeringBlock","variableName","procedureName","getFieldValue","deleteText","confirmText","ok","addInputBlocks","addNextBlocks","doFullSerialization","isInsertionMarker","getDisabledReasons","inputsInline","inputsInlineDefault","data","round","extraState","mutationToDom","icons","icon","getIcons","getFields","inputs","inputList","input","connection","connectionState","nextConnection","shadow","getShadowState","targetBlock","isShadow","parentConnection","existingGroup","variablesBeforeCreation","blockSvg","disposed","setConnectionTracking","MissingBlockType","newBlock","setShadow","newVariables","thisVariable","MANUALLY_DISABLED","setInputsInline","domToMutation","getSourceBlock","RealChildOfShadow","inputTypes","VALUE","childConnection","MissingConnection","connect","connected","checker","connectionChecker","BadConnectionCheck","getErrorMessage","canConnectWithReason","iconTypes","iconType","iconState","getIcon","constructor","ICON","UnregisteredIcon","addIcon","fieldName","fieldState","getField","inputName","getInput","setShadowState","initSvg","onLocationChange","initModel","bubbleIsVisible","setBubbleVisible","getBubble","angleDegrees","PI","angleRadians","lowerBound","number","upperBound","temp","querySelector","tabIndex","keydownListener","arrow","opacity","transition","ANIMATION_TIME","boundsElem","boundsElement","owner","backgroundColour","borderColour","backgroundColor","borderColor","opt_onHide","opt_secondaryYOffset","manageEphemeralFocus","positionToField","getSvgRoot","scaledHeight","scaledWidth","bBox","getScaledBBox","primaryX","primaryY","secondaryY","sourceBlock","newOwner","rtl","secondaryX","onHide","direction","renderedClassName","getRenderer","getClassName","themeClassName","getTheme","atOrigin","returnEphemeralFocus","takeEphemeralFocus","boundsInfo","divSize","xCoords","initialX","divX","initialY","finalX","finalY","PADDING_Y","arrowX","arrowY","ARROW_SIZE","BORDER_SIZE","arrowAtTop","arrowVisible","sourceX","boundsLeft","boundsRight","divWidth","relativeArrowX","horizPadding","ARROW_HORIZONTAL_PADDING","divOwner","opt_withoutAnimation","animateOutTimer","markFocused","getPositionMetrics","rotation","floor","array","reduce","a","opt_shortest","wordPrefix","len","letter","substr","wrap","limit","lines","words","score","Infinity","lastText","lineCount","lastScore","wordBreaks","steps","insertedBreaks","lineLengths","linePunctuation","maxLength","pow","bestScore","bestBreaks","mutatedWordBreaks","mutatedScore","isNumber","str","test","customFn","customTooltip","visible","containerDiv","object","tooltip","mouseOverWrapper_","mouseOutWrapper_","blocked","newElement","currentTarget","poisonedElement","mouseOutPid","_e","showPid","dx","lastX","pageX","dy","lastY","pageY","sqrt","RADIUS_OK","HOVER_MS","tip","LIMIT","windowWidth","windowHeight","anchorX","OFFSET_X","anchorY","OFFSET_Y","scrollY","MARGINS","scrollX","hsvSaturation","newSaturation","hsvValue","hex","names","substring","rgb","g","colour","h","s","red","green","blue","sextant","remainder","val1","val2","val3","colour1","colour2","factor","hex1","hex2","rgb1","rgb2","hue","parseInterpolationTokens","tokenizeNewlines","tokens","chars","buffer","rawKey","keyUpper","bklyKey","rawValue","prototype","mergedTokens","interpolatedResult","validSoFar","msgTable","m","msgKey","dereferenced","isNaN","errorMsg","newDiv","containerClassName","existingContainer","newDispose","Field","ownerWorkspace","rendererWorkspace","rendererClassName","oldOwner","ownerIsInWorkspace","currentWorkspace","viewportBBox","anchorBBox","widgetSize","currentBlock","menuOpenEvent","location","dummyOwner","menu","menu_","focus","Menu","Role","MENU","option","separator","addChild","MenuSeparator","menuItem","MenuItem","setRightToLeft","MENUITEM","setEnabled","enabled","onAction","actionHandler","p1","menuSelectEvent","scope","menuSize","menuDom","render","preventDefault","stopPropagation","callbackFactory","config","snapRadius","getInverseScreenCTM","workspaceToDragDelta","dragDelta","skipId","treeXml","variablesElement","hasChildNodes","getTopBlocks","clone","variableList","opt_noId","DocumentFragment","toXml","fieldDom","mutation","hasAttributes","commentText","getCommentText","IconType","COMMENT","getBubbleSize","pinned","getBubbleLocation","commentElement","dataElement","empty","DUMMY","END_ROW","childBlock","STATEMENT","childShadow","getShadowDom","childElem","NodeType","ELEMENT_NODE","encodeURIComponent","nextElem","nextShadow","cloneNode","textNode","removeAttribute","TEXT_NODE","blob","indent","xml","setResizesEnabled","clear","blockIds","domToWorkspace","newBlockIds","variablesFirst","xmlChild","xmlChildElement","blockX","blockY","RenderedWorkspaceComment","WorkspaceComment","w","getBlocksBoundingBox","bbox","farY","topX","newLeftX","newRightX","newY","blockXY","offsetY","ySeparation","offsetX","domToBlock","xmlBlock","topBlock","topBlockSvg","xmlVariables","childNodeMap","next","xmlChildren","shouldCallInitSvg","setCommentText","setBubbleSize","setBubbleLocation","xmlNode","childBlockElement","childShadowElement","prototypeName","childBlockInfo","setShadowDom","isConnected","connectedToParentNext","outerHTML","xmlChildNameMap","inline","disabledReasons","decodeURIComponent","fromXml","fieldClass","fieldObject","src","alt","initFn","allExtensions","registerMixin","mixinObj","mixin","registerMutator","opt_helperFn","opt_blockList","errorPrefix","hasMutatorDialog","setMutator","MutatorIcon","isMutator","extensionFn","mutatorProperties","mutationName","properties","compose","decompose","func1","func2","hasXmlHooks","hasJsonHooks","oldProperties","newProperties","fn","readyState","readyStateCheckInterval","setInterval","clearInterval","buildTooltipForDropdown","dropdownName","lookupTable","blockTypesChecked","setTooltip","dropdown","FieldDropdown","isOptionListDynamic","getOptions","SEPARATOR","buildTooltipWithFieldText","msgTemplate","tooltipWhenNotConnected","getInputsInline","command","points","val","flags","radius","first","second","targetConnection","orphanBlock","foundConnection","output","typeChecker","getConnectionChecker","canConnect","startBlock","initView","getWeight","applyColour","hideForInsertionMarker","updateEditable","updateCollapsed","isShownWhenCollapsed","setOffsetInBlock","onClick","svgGroup","getAudioManager","play","getLayerManager","appendToAnimationLayer","cloneRect","Date","rect","percent","getTime","getSvgXY","ripple","Svg","CIRCLE","scaleAnimation","ANIMATE","opacityAnimation","beginElement","getHeightWidth","magnitude","atan","DISPLACEMENT","wobblingBlock","step","WIGGLES","skew","DURATION","disconnectPid","getTranslation","bumpOffset","otherBlock","getConnections_","closest","bounds","objectMetrics","getBoundingRectangle","newYPosition","leftClamp","rightClamp","newXPosition","metricsManager","getMetricsManager","hasFixedEdges","BUMP_EVENTS","scrollMetricsInWsCoords","getScrollMetrics","wasBumped","getRootBlock","getCommentById","commentId","topBlocks","getTopBoundedElements","setDeleteStyle","forward","candidates","fieldRow","connectedBlock","ConnectionType","NEXT_STATEMENT","lastStackBlock","lastConnectionInStack","INPUT_VALUE","current","delta","stacks","targetIndex","currentIndex","BlockSvg","getSurroundParent","iconConstructor","isMovable","startDrag","drag","endDrag","revertDrag","autoHide","getProcedureModel","doProcedureUpdate","isProcedureDef","startPublishing","stopPublishing","root","proceduresNoReturn","p","getReturnTypes","pa","getBlocksByType","forEach","proceduresReturn","ta","tb","findLegalName","isInFlyout","opt_exclude","Names","equals","excludeModel","model","rename","UnattachedFieldError","legalName","setName","getValue","procedureBlock","populateProcedures","procedureList","templateName","args","arg","nameField","tuple","xmlElement","argBlock","argValue","DEFAULT_ARG","fieldContent","updateToolbox","bubbleType","isOpen","TYPE","getWorkspace","addChangeListener","procName","mutateCallers","defBlock","oldRecordUndo","callers","caller","oldMutation","oldMutationDom","newMutationDom","newMutation","getDefinition","shape","isDynamic","pathDown","pathUp","pathLeft","pathRight","rendererClass","RENDERER","theme","opt_rendererOverrides","renderer","firstVariable","toCopy","toCopyData","stashedCopyData","stashedWorkspace","WorkspaceSvg","stashedCoordinates","copyData","coordinate","escapeAction","ESCAPE","preconditionFn","isReadOnly","keyCodes","KeyCodes","ESC","deleteShortcut","DELETE","focusedNode","isIDeletable","ephemeralFocusTaken","shortcut","checkAndDelete","BACKSPACE","isICopyable","ctrlC","createSerializedKey","C","CTRL","metaC","META","copyShortcut","COPY","copyCoords","ctrlX","X","metaX","cutShortcut","CUT","ctrlV","V","metaV","pasteShortcut","PASTE","copyWorkspace","mouseCoords","getViewMetrics","viewportRect","centerCoords","ctrlZ","Z","metaZ","undoShortcut","UNDO","undo","ctrlShiftZ","SHIFT","metaShiftZ","ctrlY","Y","redoShortcut","REDO","proc","parameters","procedureModelClass","parameterModelClass","entries","insertParameter","serializerMap","deserializers","priority","deserializer","reverse","pluginState","opt_options","containerElement","getElementById","ownerDocument","Options","subContainer","SVG","HTML_NS","XLINK_NS","defs","DEFS","rnd","random","gridPattern","Grid","gridOptions","wsOptions","zoomOptions","startScale","languageTree","flyout","addFlyout","hasTrashcan","addTrashcan","controls","addZoomControls","getThemeManager","subscribe","workspaceResizeHandler","hideComponents","setResizeHandlerWrapper","toolbox","getToolbox","getFlyout","scrollToStart","trashcan","zoomControls_","moveOptions","scrollbars","ScrollbarPair","setMetrics","hasSounds","documentEventsBound","updateInverseScreenCTM","unbindSounds","soundBinds","oldSoundBinding","audioMgr","preload","isSimpleReporter","firstField","ContextMenuRegistry","undoOption","displayText","getUndoStack","scopeType","ScopeType","WORKSPACE","weight","redoOption","getRedoStack","cleanOption","cleanUp","shouldCollapse","timeoutFn","timeoutCounter","ms","DELAY","collapseOption","collapse","expandOption","deleteList","eventGroup","shift","isDeadOrDying","deleteOption","deletableBlocksLength","cancelCurrentGesture","deletableBlocks","duplicateOption","isDuplicatable","BLOCK","commentOption","hasIcon","CommentIcon","comments","isEditable","inlineOption","StatementInput","collapseExpandOption","disableOption","isDisabledForOtherReason","getInheritedDisabled","descendantCount","helpOption","helpUrl","url","showHelp","createOption","setPlaceholderText","toolboxItem","opt_onlyClosePopups","getRootFocusableNode","getRestoredFocusableNode","getNestedTrees","lookUpFocusableNode","onTreeFocus","onTreeBlur","CONNECTION_CHECKER","CONNECTION_PREVIEWER","CURSOR","INPUT","TOOLBOX","THEME","TOOLBOX_ITEM","FLYOUTS_VERTICAL_TOOLBOX","FLYOUTS_HORIZONTAL_TOOLBOX","FLYOUT_INFLATER","METRICS_MANAGER","BLOCK_DRAGGER","VARIABLE_MODEL","VARIABLE_MAP","$jscomp$tmp$exports$module$name","TOUCH_ENABLED","globalThis","rawUserAgent","isJavaFx","isWebKit","isGecko","isAndroid","isIPad","isIPhone","isMac","isTablet","isMobile","raw","rawUpper","maxTouchPoints","GECKO","ANDROID","IPAD","IPHONE","MOBILE","VAR_TYPE_CHANGE","UI","MARKER_MOVE","soup","soupLength","COMMENT_NODE","FocusableTreeTraverser","findFocusedNode","tree","rootNode","ACTIVE_CLASS_NAME","PASSIVE_CSS_CLASS_NAME","activeEl","ACTIVE_FOCUS_NODE_CSS_SELECTOR","SVGElement","active","findFocusableNodeFor","passiveEl","PASSIVE_FOCUS_NODE_CSS_SELECTOR","passive","subTreeMatches","findIndex","matchedChildNode","elementParent","TreeRegistration","rootShouldBeAutoTabbable","addGlobalEventListener","previouslyFocusedNode","registeredTrees","isUpdatingFocusedNode","recentlyLostAllFocus","lockFocusStateChanges","currentlyHoldsEphemeralFocus","maybeFocus","reg","newTree","oldTree","focusTree","defocusCurrentFocusedNode","FocusEvent","activeElement","relatedTarget","registerTree","ensureManagerIsUnlocked","rootElement","lookUpRegistration","find","unregisterTree","treeIndex","registration","removeHighlight","updateFocusedNode","focusableTree","currNode","nodeToRestore","rootFallback","focusableNode","mustRestoreUpdatingNode","hasDesyncedState","prevFocusedElement","nextTree","focusableNodeElement","matchedNode","prevNodeNextTree","nodeToFocus","prevNode","prevTree","passivelyFocusNode","nextTreeRoot","activelyFocusNode","focusableElement","preventScroll","hasFinishedEphemeralFocus","capturedNode","newFocusedNode","nextTreeReg","treeIsTabManaged","hasAttribute","setNodeToVisualActiveFocus","setNodeToVisualPassiveFocus","ACTIVE_FOCUS_NODE_CSS_CLASS_NAME","PASSIVE_FOCUS_NODE_CSS_CLASS_NAME","focusManager","shortcuts","Map","keyMap","reset","allowOverrides","registeredShortcut","keyCode","addKeyMapping","allowCollision","shortcutName","removeAllKeyMappings","shortcutNames","unshift","removeKeyMapping","quiet","shortcutIdx","setKeyMap","newKeyMap","getKeyMap","legacyKeyMap","getRegistry","legacyRegistry","serializeKeyEvent","getShortcutNamesByKeyCode","getKeyCodesByShortcutName","serializedKey","modifier","modifierKeys","getModifierState","checkModifiers","modifiers","modifierKeyCode","Shift","Control","Alt","Meta","draggingConnections","Abstract","isUiEvent","toJson","isBlank","run","_forward","getEventWorkspace_","UiBase","AbstractEvent","opt_workspaceId","Click","opt_block","opt_targetType","targetType","newEvent","ClickTarget","ZOOM_CONTROLS","Capability","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","ComponentWeight","TOOLBOX_WEIGHT","FLYOUT_WEIGHT","TRASHCAN_WEIGHT","ZOOM_CONTROLS_WEIGHT","tx","ty","distance","CLIPPATH","FECOMPOSITE","FECOMPONENTTRANSFER","FEFLOOD","FEFUNCA","FEGAUSSIANBLUR","FEPOINTLIGHT","FESPECULARLIGHTING","FILTER","FOREIGNOBJECT","G","IMAGE","LINE","PATH","PATTERN","POLYGON","RECT","TEXT","TSPAN","getHeight","getOrigin","other","createFromPoint","opt_pair","opt_class","opt_margin","oldHostMetrics","ratio","origin","startDragHandle","handlePosition","handleLength","scrollbarLength","startDragMouse","containerVisible","isHandleVisible","onMouseMoveWrapper_","onMouseUpWrapper_","pair","DEFAULT_SCROLLBAR_MARGIN","outerSvg","svgBackground","svgHandle","setInitialThickness","lengthAttribute_","positionAttribute_","onMouseDownBarWrapper_","onMouseDownBar","onMouseDownHandleWrapper_","onMouseDownHandle","unsubscribe","constrainHandleLength","setHandleLength","newLength","constrainHandlePosition","setHandlePosition","newPosition","setScrollbarLength","newSize","setPosition","opt_metrics","hostMetrics","getMetrics","metricsAreEquivalent","resizeHorizontal","resizeVertical","updateMetrics","requiresViewResize","viewWidth","viewHeight","absoluteLeft","absoluteTop","resizeViewHorizontal","resizeContentHorizontal","viewSize","xCoordinate","scrollWidth","setVisible","maxScrollDistance","maxHandleOffset","handleOffset","resizeViewVertical","resizeContentVertical","scrollHeight","setContainerVisible","visibilityChanged","updateDisplay_","setVisibleInternal","mouseXY","mouseLocation","handleXY","handleStart","pageLength","onMouseUpHandle","onMouseMoveHandle","currentMouse","getRatio_","setOrigin","DOWN","SPRITE","ZoomControls","boundEvents","zoomResetGroup","zoomOutGroup","zoomInGroup","HEIGHT","WIDTH","SMALL_SPACING","LARGE_SPACING","MARGIN_HORIZONTAL","MARGIN_VERTICAL","createZoomOutSvg","createZoomInSvg","createZoomResetSvg","getComponentManager","cornerPosition","positionRect","zoomInTranslateY","zoomOutTranslateY","clip","zoomoutSvg","setAttributeNS","zoom","zoominSvg","amount","zoomCenter","fireZoomEvent","zoomresetSvg","resetZoom","log","scaleSpeed","beginCanvasTransition","scrollCenter","endCanvasTransition","uiEvent","VARIABLES","PROCEDURES","BLOCKS","WORKSPACE_COMMENTS","saveComment","WorkspaceCommentSerializer","commentStates","commentState","WorkspaceCommentPaster","DEFAULT_SNAP_RADIUS","dragRadius","flyoutDragRadius","connectingSnapRadius","currentConnectionPreference","bumpDelay","GRID","GRIDCELL","GROUP","LISTBOX","MENUITEMCHECKBOX","OPTION","PRESENTATION","ROW","TREE","TREEITEM","STATUS","State","opt_value","rightToLeft","highlight","checked","checkable","checkbox","contentDom","DISABLED","getElement","setCheckable","setChecked","setHighlighted","performAction","menuItems","onKeyDownHandler","pointerLeaveHandler","pointerEnterHandler","clickHandler","pointerMoveHandler","highlightedItem","openingCoords","handlePointerMove","handleClick","handlePointerEnter","handlePointerLeave","handleKeyEvent","blur","getMenuItem","menuElem","currentElement","items","getMenuItems","currentHighlighted","menuElement","menuItemElement","ACTIVEDESCENDANT","highlightNext","highlightHelper","highlightPrevious","highlightFirst","highlightLast","startIndex","movementX","movementY","oldCoords","newCoords","shiftKey","metaKey","altKey","highlighted","COLLAPSED_INPUT_NAME","COLLAPSED_FIELD_NAME","CUSTOM","WeakSet","WeakMap","setLocale","locale","k","CLASS_NAME","MESSAGE_CLASS_NAME","CLOSE_BUTTON_CLASS_NAME","Toast","oncePerSession","shownIds","duration","assertiveness","Assertiveness","POLITE","dataset","toastId","LIVE","messageElement","innerText","closeButton","LABEL","closeIcon","viewBox","fill","HIDDEN","timeout","setToastTimeout","clearToastTimeout","ASSERTIVE","CATEGORY_NAME","DeserializationError","toDevString","childState","saveBlock","BlockSerializer","blockStates","MUTATOR","WARNING","BlockBase","BlockChange","opt_element","opt_oldValue","opt_newValue","oldValue","disabledReason","setValue","oldState","getExtraBlockState_","JSON","stringify","getBoundsInfo","boundPosition","boundSize","clientTop","validator","DEFAULT_VALUE","validator_","constants_","mouseDownWrapper","textContent_","textElement_","borderRect_","fieldGroup_","maxDisplayLength","sourceBlock_","enabled_","visible_","isDirty_","suffixField","prefixField","clickTarget_","EDITABLE","SERIALIZABLE","id_","value_","size_","SKIP_SETUP","configure_","setValidator","setSourceBlock","getConstants","bindEvents_","createBorderRect_","createTextElement_","FIELD_BORDER_RECT_RADIUS","FIELD_TEXT_BASELINE_CENTER","clickTarget","getClickTarget_","onMouseDown_","fieldElement","_doFullSerialization","legacyState","saveLegacyState","loadLegacyState","callingClass","isClickable","showEditor_","isClickableInFlyout","autoClosingFlyout","isCurrentlyEditable","handler","getValidator","getBorderRect","getTextElement","getTextContent","render_","nodeValue","getDisplayText_","updateSize_","showEditor","constants","xOffset","FIELD_BORDER_RECT_X_PADDING","totalWidth","totalHeight","FIELD_TEXT_HEIGHT","contentWidth","FIELD_BORDER_RECT_HEIGHT","positionTextElement_","positionBorderRect_","halfHeight","FIELD_TEXT_BASELINE","getAbsoluteXY_","_","NBSP","getText_","markDirty","forceRerender","fireChangeEvent","classValidation","doClassValidation_","classValue","processValidation","localValidation","localValue","doValueUpdate_","validatedValue","doValueInvalid_","_invalidValue","_fireChangeEvent","getGesture","setStartField","newTip","getTooltip","referencesVariables","refreshVariableName","getParentInput","parentInput","idx","fieldRows","getFlipRtl","onShortcut","_shortcut","scrollBoundsIntoView","getBoundingRectangleWithoutChildren","_options","Symbol","registeredItems","getContextMenuOptions","menuOptions","menuOption","precondition","BUBBLE","CommentDragStrategy","startLoc","fireDragStartEvent","moveToDragLayer","setDragging","newLoc","moveDuringDrag","fireDragEndEvent","fireMoveEvent","moveOffDragLayer","snapToGrid","setReason","oldCoordinate_","recordNew","CommentBarButton","commentView","checkVisibility","getCommentView","includeMargin","getBBox","getMargin","COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER","CollapseCommentBarButton","bindId","reposition","bringToFront","COMMENT_EDITOR_FOCUS_IDENTIFIER","CommentEditor","onFinishEditing","textChangeListeners","foreignObject","textArea","onTextChange","handleKeyDown","getDom","oldText","addTextChangeListener","listener","removeTextChangeListener","placeholder","updateSize","topBarSize","COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER","DeleteCommentBarButton","containerSize","CommentView","sizeChangeListeners","disposeListeners","collapseChangeListeners","resizePointerMoveListener","resizePointerUpListener","disposing","svgRoot","highlightRect","createHighlightRect","topBarGroup","topBarBackground","deleteButton","foldoutButton","textPreview","textPreviewNode","createTopBar","commentEditor","createTextArea","resizeHandle","createResizeHandle","defaultCommentSize","setSizeWithoutFiringEvents","addDisposeListener","newText","updateTextPreview","getEditorFocusableNode","onResizePointerDown","textPreviewSize","resizeSize","calcMinSize","updateHighlightRect","updateTopBarSize","updateTextPreviewSize","updateResizeHandlePosition","oldSize","preResizeSize","onSizeChange","textPreviewWidth","textPreviewMargin","foldoutSize","deleteSize","addSizeChangeListener","removeSizeChangeListener","onResizePointerUp","onResizePointerMove","onCollapse","addOnCollapseListener","removeOnCollapseListener","truncateText","onDeleteDown","removeDisposeListener","getCommentBarButtons","addTopComment","fireCreateEvent","fireDeleteEvent","fireCollapseEvent","newCollapsed","recordCurrentSizeAsNewSize","removeTopComment","dragStrategy","view","addModelUpdateBindings","startGesture","dragging","handleCommentStart","wouldDelete","showContextMenu","grid","getGrid","shouldSnap","currentXY","alignedXY","alignXY","BlockCreate","allShadowBlocks","shadows","ThemeChange","opt_themeName","themeName","ViewportChange","opt_top","opt_left","opt_scale","opt_oldScale","menuGenerator","svgArrow","imageElement","selectedMenuItem","generatedOptions","setOptions","shouldAddBorderRect_","FIELD_DROPDOWN_SVG_ARROW","createSVGArrow_","createTextArrow_","FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW","ARROW_CHAR","FIELD_DROPDOWN_SVG_ARROW_SIZE","FIELD_DROPDOWN_SVG_ARROW_DATAURI","dropdownCreate","FIELD_DROPDOWN_COLOURED_DIV","primaryColour","getColour","getColourTertiary","dropdownDispose_","label","image","Image","handleMenuActionEvent","onItemSelected_","menuGenerator_","useCache","validateOptions","trimmed","trimOptions","prefix","selectedOption","isValueValid","getColourSecondary","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","title","ariaLabel","hasNonTextContent","trimmedOptions","imageLabel","stringLabels","shortest","prefixLength","suffixLength","applyTrim","foundError","error","IMAGE_Y_OFFSET","Theme","opt_blockStyles","opt_categoryStyles","opt_componentStyles","startHats","blockStyles","categoryStyles","componentStyles","fontStyle","setBlockStyle","blockStyleName","blockStyle","setCategoryStyle","categoryStyleName","categoryStyle","getComponentStyle","componentName","recursiveStyle","setComponentStyle","styleValue","setFontStyle","setStartHats","defineTheme","themeObj","base","defaultBlockStyles","Classic","toolboxJsonDef","hasCollapse","hasComments","hasDisable","readOnly","rawHasTrashcan","rawHasCollapse","rawHasComments","rawHasDisable","rawHasSounds","maxTrashcanContents","toolboxAtStart","toolboxPosition","endsWith","rawOneBasedIndex","modalInputs","oneBasedIndex","maxBlocks","maxInstances","parseMoveOptions","hasScrollbars","parseGridOptions","parseZoomOptions","parseThemeOptions","rendererOverrides","wheel","maxScale","minScale","pinch","spacing","snap","BubbleDragStrategy","bubble","_a","Bubble","anchor","ownerRect","overriddenFocusableElement","relativeLeft","relativeTop","getBubbleCanvas","embossGroup","tail","background","BORDER_WIDTH","contentContainer","onMouseDown","setAnchorLocation","relayout","positionByRect","positionRelativeToAnchor","renderTail","setPositionRelativeToAnchor","MIN_SIZE","handleBubbleStart","optimalLeft","getOptimalRelativeLeft","optimalTop","getOptimalRelativeTop","topPosition","MIN_BLOCK_HEIGHT","startPosition","endPosition","bottomPosition","closerPosition","fartherPosition","topPositionOverlap","getOverlap","startPositionOverlap","closerPositionOverlap","fartherPositionOverlap","mostOverlap","relativeMin","workspaceRect","getWorkspaceViewRect","bubbleRight","bubbleLeft","getScrollbarThickness","relBubbleX","relBubbleY","relAnchorX","relAnchorY","rise","hypotenuse","angle","acos","rightAngle","rightRise","sin","rightRun","cos","thickness","TAIL_THICKNESS","backoffRatio","ANCHOR_RADIUS","baseX1","baseY1","baseX2","baseY2","radians","TAIL_ANGLE","swirlAngle","swirlRise","TAIL_BEND","swirlRun","lastChild","_start","_enable","DOUBLE_BORDER","MiniWorkspaceBubble","workspaceOptions","autoLayout","validateWorkspaceOptions","svgDialog","miniWorkspace","newWorkspaceSvg","internalIsMutator","getCanvas","onWorkspaceChange","updateBubbleSize","addWorkspaceChangeListener","bumpBlocksIntoBounds","keyboardMoveInProgress","MARGIN","currSize","calculateWorkspaceSize","MINIMUM_VIEW_CHANGE","recordDragTargets","workspaceSize","flyoutScrollMetrics","updateBlockStyles","setStyle","getStyleName","flyoutWs","Icon","offsetInBlock","workspaceLocation","pointerdownListener","svgBlock","updateSvgRootOffset","blockBounds","SIZE","WORKSPACE_MARGIN","flyoutBlockTypes","saveConnectionsListener","updateWorkspacePid","rootBlock","miniWorkspaceBubble","WEIGHT","getAnchorLocation","getMiniWorkspaceConfig","getBubbleOwnerRect","createRootBlock","addSaveConnectionsListener","createMiniWorkspaceChangeListener","removeChangeListener","midIcon","flyoutWidth","saveConnections","this.saveConnectionsListener","isIgnorableMutatorEvent","recomposeSourceBlock","oldExtraState","newExtraState","WIN_KEY_FF_LINUX","MAC_ENTER","TAB","NUM_CENTER","ENTER","ALT","PAUSE","CAPS_LOCK","SPACE","PAGE_UP","PAGE_DOWN","END","HOME","PLUS_SIGN","PRINT_SCREEN","INSERT","ZERO","ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","FF_SEMICOLON","FF_EQUALS","FF_DASH","FF_HASH","QUESTION_MARK","AT_SIGN","A","B","D","E","F","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","W","WIN_KEY_RIGHT","CONTEXT_MENU","NUM_ZERO","NUM_ONE","NUM_TWO","NUM_THREE","NUM_FOUR","NUM_FIVE","NUM_SIX","NUM_SEVEN","NUM_EIGHT","NUM_NINE","NUM_MULTIPLY","NUM_PLUS","NUM_MINUS","NUM_PERIOD","NUM_DIVISION","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NUMLOCK","SCROLL_LOCK","FIRST_MEDIA_KEY","LAST_MEDIA_KEY","SEMICOLON","DASH","EQUALS","COMMA","PERIOD","SLASH","APOSTROPHE","TILDE","SINGLE_QUOTE","OPEN_SQUARE_BRACKET","BACKSLASH","CLOSE_SQUARE_BRACKET","WIN_KEY","MAC_FF_META","MAC_WK_CMD_LEFT","MAC_WK_CMD_RIGHT","WIN_IME","VK_NONAME","PHANTOM","aria","arrayUtils","browserEvents","deprecation","extensions","idGenerator","math","parsing","stringUtils","svgMath","svgPaths","userAgent","TextInputBubble","locationChangeListeners","DEFAULT_SIZE","editor","resizeGroup","addLocationChangeListener","widthMinusBorder","heightMinusBorder","getEditor","OUTPUT_VALUE","PREVIOUS_STATEMENT","ConnectionDB","connections","addConnection","yPos","calculateIndexForYPos","findIndexOfConnection","conn","bestGuess","pointer","pointerMin","pointerMax","pointerMid","removeConnection","getNeighbours","maxRadius","checkConnection","yIndex","currentX","db","currentY","neighbours","isInYRange","baseY","searchForClosest","dxy","baseX","closestIndex","bestConnection","bestRadius","distanceFrom","dbList","Selected","opt_oldElementId","opt_newElementId","oldElementId","newElementId","BlockDelete","oldXml","wasShadow","oldJson","Connection","shadowDom","check","shadowState","connect_","parentBlock","disconnectInternal","orphan","stashShadowState","applyShadowState","setParent","orphanConnection","getConnectionForOrphanedConnection","onFailedConnect","isSuperior","setShadowStateInternal","unplug","_superiorConnection","otherConnection","disconnect","getParentAndChildConnections","respawnShadow_","createShadowBlock","reconnect","connectionParent","currentParent","onCheckChanged_","setCheck","getCheck","returnCurrent","_maxLimit","serializeShadow","attemptToConnect","blockShadow","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","DuplicateIconType","Align","CENTRE","FieldLabel","textClass","class","setClass","cssClass","COLLAPSE_CHARS","OPPOSITE_TYPE","RENAME_VARIABLE_ID","DELETE_VARIABLE_ID","BUMP_RANDOMNESS","RenderedConnection","connectionDBList","dbOpposite","trackedState","TrackedState","WILL_TRACK","TRACKED","pathObject","removeConnectionHighlight","xDiff","yDiff","bumpAwayFrom","superiorConnection","initiatedByThis","superiorRootBlock","inferiorRootBlock","inferiorConnection","moveInferior","staticConnection","dynamicConnection","dynamicRootBlock","updated","moveToOffset","blockTL","getOffsetInBlock","tightenEfficiently","maxLimit","highlightSvg","findHighlightSvg","unhighlight","isHighlighted","setTracking","doTracking","UNTRACKED","stopTrackingAll","startTrackingAll","renderList","updateDisabled","getInputWithBlock","connectionWSCoords","connectionScreenCoords","Input","align","appendField","insertFieldAt","initField","removeField","opt_quiet","setAlign","makeConnection","makeConnection_","DummyInput","EndRowInput","ValueInput","Block","opt_id","colour_","styleName_","suppressPrefixSuffix","contextMenu","parentBlock_","childBlocks_","collapsed_","outputShape_","isInsertionMarker_","onchangeWrapper","statementInputCount","setBlockById","isInMutator","assign","addTopBlock","addTypedBlock","doInit_","onchange","setOnChange","healStack","removeTopBlock","disposeInternal","removeTypedBlock","removeBlockById","destroy","opt_healStack","unplugFromRow","unplugFromStack","thisConnection","getOnlyValueConnection","previousTarget","nextTarget","_all","myConnections","ignoreShadows","prevBlock","getPreviousBlock","getTopStackBlock","previous","ordered","childBlocks","hasBlockLimits","isCapacityAvailable","setInsertionMarker","insertionMarker","getMatchingConnection","otherConnections","setHelpUrl","getHue","parsed","onchangeFn","getVars","vars","updateVarName","renameVarById","oldId","newId","setFieldValue","setPreviousStatement","newBoolean","opt_check","setNextStatement","setOutput","setOutputShape","outputShape","getOutputShape","blockChangeEvent","ancestor","opt_maxLength","opt_emptyToken","toTokens","prev","acc","curr","emptyToken","checks","shouldAddParens","appendValueInput","appendInput","appendStatementInput","appendDummyInput","appendEndRowInput","appendInputFromRegistry","inputConstructor","warningPrefix","n","hat","jsonInitStyle","jsonInitColour","interpolate","localizedText","localizedValue","extensionNames","opt_disableCheck","overwrites","implicitAlign","validateTokens","elements","interpolateArguments","fieldStack","isInputKeyword","inputFromJson","fieldFromJson","argsCount","visitedArgsHash","visitedArgsCount","token","newlineInput","stringToFieldJson","dummyInput","alignmentLookup","alignment","moveInputBefore","refName","inputIndex","refIndex","moveNumberedInputBefore","RangeError","removeInput","getInputTargetBlock","commentConstructor","removeIcon","setWarningText","_text","_opt_id","_mutator","allInputsFilled","opt_shadowBlocksAreFilled","BlockPaster","typeCounts","blockState","initialCoordinates","then","bumpIntoBounds","BlockDragStrategy","connectionPreviewer","connectionCandidate","startChildConn","startParentConn","dragOffset","originalEventGroup","startDraggingShadow","previewerConstructor","shouldHealStack","shouldDisconnect","disconnectBlock","oldCoordinate","updateConnectionPreview","draggingBlock","currCandidate","newCandidate","getConnectionCandidate","candidate","currCandidateIsBetter","local","neighbour","localIsOutputOrPrevious","neighbourIsConnectedToRealBlock","orphanCanConnectAtEnd","previewReplacement","previewConnection","hidePreview","localType","currCandiate","currLocal","currNeighbour","localPos","neighbourPos","currDistance","localConns","getLocalConnections","getSearchRadius","rad","available","lastOnStack","applyConnections","disposeStep","TextBubble","paragraph","stringToSvg","createParagraph","fragments","createTextFragments","rightAlignTextFragments","lineNum","fragment","maxWidth","WarningIcon","textMap","textBubble","addMessage","childlessWidth","warningTextDb","mutator","visuallyDisabled","translation","relativeCoords","getBlockStyle","makePathObject","svgPath","createIconPointerDownListener","updateMovable","colourSecondary","colourTertiary","addSelect","removeSelect","oldParent","isClearing","oldXY","restoreFocus","draggingBlockElement","draggingParentElement","canvas","layerManger","hasLayer","eventsEnabled","currLoc","curXY","getBoundingRectangleWithDimensions","childHasWarning","collapsedInputName","collapsedFieldName","COLLAPSED_WARNING_ID","handleBlockStart","open","generateContextMenu","customContextMenu","calculateContextMenuLocation","blockCoords","fieldBoundingClientRect","flatMap","f","updateConnectionLocations","updateIconLocations","updateFieldLocations","adding","INSERTION_MARKER_COLOUR","updateInsertionMarker","animate","collapsedParent","setStartIcon","removed","wasEnabled","updateHighlighted","updateSelected","updateDraggingDelete","colourPrimary","styleObj","getBlockStyleForColour","getStyle","blockOnly","previouslyFocused","track","all","scheduleSnapAndBump","positionNearConnection","sourceConnection","originalOffsetToTarget","originalOffsetInBlock","tightenChildrenEfficiently","nextHeightWidth","tabHeight","NOTCH_HEIGHT","fadeForReplacement","updateReplacementFade","highlightShapeForInput","updateShapeForInputHighlight","getDragStrategy","setDragStrategy","toFlyoutInfo","toRemove","traverseJson","INLINE","DragTarget","onDragEnter","_dragElement","onDragOver","onDragExit","onDrop","getClientRect","shouldPreventMove","DeleteArea","wouldDelete_","couldDeleteBlock","updateWouldDelete_","FlyoutItem","MetricsManager","workspace_","getDimensionsPx_","getFlyoutMetrics","opt_own","flyoutDimensions","getToolboxMetrics","toolboxDimensions","getSvgMetrics","getAbsoluteMetrics","flyoutMetrics","respectToolbox","respectFlyout","autoClose","atTop","opt_getWorkspaceCoordinates","svgMetrics","vertToolbox","getContentMetrics","blockBox","isMovableHorizontally","isMovableVertically","getComputedFixedEdges_","opt_viewMetrics","hScrollEnabled","vScrollEnabled","edges","getPaddedContent_","contentMetrics","contentBottom","contentRight","halfWidth","opt_contentMetrics","fixedEdges","paddedContent","getUiMetrics","scrollMetrics","contentHeight","contentTop","contentLeft","svgHeight","svgWidth","toolboxWidth","toolboxHeight","flyoutHeight","FlyoutMetricsManager","flyout_","getBoundingBox","blockBoundingBox","FlyoutButton","isFlyoutLabel","cursorSvg","svgText","callbackKey","info","BORDER_RADIUS","fontMetrics","TEXT_MARGIN_X","TEXT_MARGIN_Y","updateTransform","onMouseDownWrapper","onMouseUpWrapper","onMouseUp","_reason","isLabel","getButtonText","setCursorSvg","cancel","getButtonCallback","handleFlyoutStart","FlyoutButtonNavigationPolicy","getFirstChild","_current","getNextSibling","getPreviousSibling","isNavigable","isApplicable","FlyoutNavigationPolicy","policy","flyoutContents","getContents","flyoutItem","FlyoutSeparator","axis","FlyoutSeparatorNavigationPolicy","BlockCommentNavigationPolicy","BlockNavigationPolicy","surroundParent","CommentBarButtonNavigationPolicy","CommentEditorNavigationPolicy","ConnectionNavigationPolicy","getParentConnection","previousRootBlock","FieldNavigationPolicy","DEFAULT_BUBBLE_WIDTH","DEFAULT_BUBBLE_HEIGHT","textInputBubble","bubbleSize","bubbleVisiblity","oldLocation","bubbleLocation","anchorLocation","onBubbleLocationChange","showEditableBubble","showNonEditableBubble","hideBubble","createBubble","IconNavigationPolicy","WorkspaceCommentNavigationPolicy","WorkspaceNavigationPolicy","Navigator","rules","addNavigationPolicy","rule","FlyoutNavigator","addHorizontal","addVertical","corner_","vScroll","hScroll","isPair","resizeH","resizeV","maybeFireViewportChangeEvent","xyRatio","setX","setY","resizeContent","resizeView","SEPARATOR_TYPE","SeparatorFlyoutInflater","_state","flyoutAxis","gapForItem","defaultGap","newGap","disposeItem","_item","Flyout","reflowWrapper","CORNER_RADIUS","SCROLLBAR_MARGIN","height_","width_","dragAngleRange_","svgGroup_","svgBackground_","inflaters","setMetrics_","setMetricsManager","internalIsFlyout","setNavigator","toolboxPosition_","tabWidth_","TAB_WIDTH","GAP_X","GAP_Y","wheel_","setVariableMap","createPotentialVariableMap","getFlyoutScale","setAutoClose","onlyClosePopups","updateDisplay","setContents","positionAt_","clearOldBlocks","getDynamicCategoryContents","parsedContent","flyoutInfo","createFlyoutInfo","layout_","reflow","this.reflowWrapper","inflater","categoryName","parsedDynamicContent","getInflaterForType","normalizeSeparators","elementType","previousElementType","fnToApply","getToolboxCategoryCallback","isBlockCreatable","createBlock","originalBlock","placeNewBlock","reflowInternal_","isScrollable","oldBlock","svgRootOld","serializeBlock","positionNewBlock","flyoutOffsetPixels","oldBlockPos","oldBlockOffsetPixels","finalOffset","InflaterClass","_previousNode","_id","_node","_previousTree","_nextTree","KeyboardNavigationController","isActive","activeClassName","setIsActive","isUsing","updateActiveVisualization","getIsActive","keyboardNavigationController","WorkspaceDragger","horizontalScrollEnabled","verticalScrollEnabled","startScrollXY_","currentDragDeltaXY","newXY","scroll","ZOOM_IN_MULTIPLIER","ZOOM_OUT_MULTIPLIER","Gesture","creatorWorkspace","mouseDownXY","startWorkspace_","startComment","startIcon","startField","startBubble","hasExceededDragRadius","workspaceDragger","dragger","multiTouch","isEnding_","gestureHasStarted","calledUpdateIsDragging","cachedPoints","startDistance","previousScale","currentDropdownOwner","isPinchZoomEnabled","mostRecentEvent","clearGesture","updateFromEvent","updateDragDelta","changed","updateIsDragging","currentDragDelta","limitRadius","updateIsDraggingFromFlyout","isDragTowardWorkspace","updateScreenCalculationsIfScrolled","updateIsDraggingWorkspace","wsMovable","createDragger","onDragStart","onDrag","draggable","DraggerClass","doStart","pointerType","handleTouchStart","handleMove","handleUp","isMultiTouch","handleTouchMove","handleTouchEnd","onDragEnd","isBubbleClick","isCommentClick","isFieldClick","doFieldClick","isIconClick","doIconClick","isBlockClick","doBlockClick","isWorkspaceClick","doWorkspaceClick","getTouchPoint","pointers","point0","point1","handlePinch","moveDistance","gestureScale","bringBlockToFront","handleWsStart","setStartWorkspace","fireWorkspaceClick","setStartFlyout","setStartBlock","setStartBubble","setStartComment","setTargetBlock","hasStartBubble","hasStartBlock","handleInFlyout","getCurrentDragger","hasStarted","inProgress","currentGesture_","pattern","line2","line1","setSpacing","update","getSpacing","setLength","getLength","setSnapToGrid","getPatternId","safeSpacing","half","end","setLineAttributes","x1","x2","y1","y2","setProperty","LayerManager","layers","dragLayer","createDragLayer","animationLayer","createAnimationLayer","blockLayer","createLayer","bubbleLayer","currentTransform","translateLayers","newCoord","newScale","layer","layerNum","getSvgGroup","inserted","sortedLayers","num","sib","getBlockLayer","getBubbleLayer","Marker","curNode","getCurNode","setCurNode","getSourceBlockFromNode","LineCursor","potentialNodes","getNextNode","in","getPreviousNode","out","atEndOfLine","inNode","nextNode","getNextNodeImpl","isValid","visitedNodes","getNavigator","loop","getLastNode","getPreviousNodeImpl","getRightMostChild","getFirstNode","stopIfFound","preDelete","deletedBlock","nodes","postDelete","MarkerManager","markers","cursor","registerMarker","marker","unregisterMarker","getCursor","getMarker","setCursor","markerIds","markerId","LOCAL_MARKER","exceptions","reservedWordsList","opt_variablePrefix","dbReverse","variablePrefix","reservedWords","getNameForUserVariable","populateVariables","NameType","VARIABLE","nameOrId","varName","normalizedName","DEVELOPER_VARIABLE","typeDb","safeName","getDistinctName","getUserNames","userNames","encodeURI","name1","name2","PROCEDURE","DEVELOPER_VARIABLE_TYPE","ObservableProcedureMap","existed","TypesContainer","NONE","HAT","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","TOP_ROW","BOTTOM_ROW","INPUT_ROW","LEFT_CORNER","RIGHT_CORNER","nextTypeValue_","hasOwnProperty","isField","isHat","isSpacer","isInRowSpacer","isSpacerRow","row","isInput","isExternalInput","isInlineInput","isStatementInput","isPreviousConnection","isNextConnection","isPreviousOrNextConnection","isRoundCorner","isLeftRoundedCorner","isRightRoundedCorner","isLeftSquareCorner","isRightSquareCorner","isCorner","isJaggedEdge","isRow","isBetweenRowSpacer","isTopRow","isBottomRow","isTopOrBottomRow","isInputRow","Types","Measurable","centerline","xPos","notchOffset","NOTCH_OFFSET_LEFT","Row","widthWithConnectedBlocks","minWidth","minHeight","hasStatement","hasExternalInput","statementEdge","hasJaggedEdge","hasDummyInput","hasInlineInput","getLastInput","measure","startsWithElemSpacer","endsWithElemSpacer","getFirstSpacer","getLastSpacer","BottomRow","hasNextConnection","descenderHeight","hasLeftSquareCorner","hasRightSquareCorner","_block","connectionModel","shapeFor","InputConnection","connectionOffsetY","connectionOffsetX","connectedBlockWidth","connectedBlockHeight","ExternalValueInput","TAB_OFFSET_FROM_TOP","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","InputRow","connectedBlockWidths","JaggedEdge","JAGGED_TEETH","NextConnection","OutputConnection","startX","PreviousConnection","RoundCorner","opt_position","SpacerRow","precedesStatement","followsStatement","SquareCorner","NO_PADDING","STATEMENT_BOTTOM_SPACER","EMPTY_STATEMENT_INPUT_HEIGHT","STATEMENT_INPUT_NOTCH_OFFSET","TopRow","capline","hasPreviousConnection","hasHat","ADD_START_HATS","ConstantProvider","SMALL_PADDING","MEDIUM_LARGE_PADDING","LARGE_PADDING","TAB_HEIGHT","TAB_VERTICAL_OVERLAP","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_TEXT_FONTSIZE","FIELD_TEXT_FONTWEIGHT","FIELD_TEXT_FONTFAMILY","FIELD_BORDER_RECT_Y_PADDING","FIELD_BORDER_RECT_COLOUR","FIELD_COLOUR_FULL_BLOCK","FIELD_TEXTINPUT_BOX_SHADOW","FIELD_COLOUR_DEFAULT_WIDTH","embossFilterId","embossFilter","disabledPatternId","disabledPattern","debugFilterId","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_","createBlockStyle_","valid","parsedColour","generateSecondaryColour_","generateTertiaryColour_","inputColour","mainPath","path","makeMainPath","up","back","control1Y","overlap","control2Y","endPoint1","endPoint2","dir","outerWidth","innerWidth","innerTopLeftCorner","innerBottomLeftCorner","pathTop","pathBottom","topLeft","topRight","bottomLeft","bottomRight","rightHeight","selector","injectionDivIfIsParent","injectCSS_","feSpecularLighting","createDebugFilter","debugComponentTransfer","cssArray","getCSS_","cssNodeId","Drawer","inlinePath_","outlinePath_","block_","info_","topLeft_","draw","drawOutline_","drawInternals_","updateConnectionHighlights","setPath","flipRTL","recordSizeOnBlock_","widthWithChildren","drawTop_","rows","drawJaggedEdge_","drawStatementInput_","drawValueInput_","drawRightSideRow_","drawBottom_","drawLeft_","topRow","positionPreviousConnection_","startY","positionExternalValueConnection_","innerHeight","positionStatementInputConnection_","bottomRow","elems","positionNextConnection_","rightCornerYOffset","outlinePath","positionOutputConnection_","tabBottom","drawInlineInput_","layoutField_","fieldInfo","connectionTop","connectionBottom","positionInlineInputConnection_","connX","connInfo","drawConnectionHighlightPath","measurable","getExpressionConnectionHighlightPath","getStatementConnectionHighlightPath","addConnectionHighlight","connPath","yLen","xLen","RenderInfo","inputRows","renderer_","isInline","createRows_","addElemSpacing_","addRowSpacing_","computeBounds_","alignRowElements_","finalize_","populateTopRow_","activeRow","iconInfo","lastInput","shouldStartNewRow_","addInput_","populateBottomRow_","hasPrevious","cornerClass","leftSquareCorner","rightSquareCorner","StatementInputMeasurable","currInput","prevInput","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","getMeasureableForConnection","PathObject","connectionHighlights","highlightOffsets","setClass_","pathString","updateShadow_","updateDisabled_","_conn","connectionPath","transformation","previousHighlight","Renderer","overrides","makeConstants_","refreshDom","previousConstants","makeRenderInfo_","makeDrawer_","shouldHighlightConnection","ThemeManager","subscribedWorkspaces","componentDB","prevTheme","oldClassName","newClassName","refreshTheme","componentList","propertyName","subscribeWorkspace","unsubscribeWorkspace","onCreateVariableButtonClick_String","onCreateVariableButtonClick_Number","onCreateVariableButtonClick_Colour","ConnectionChecker","opt_distance","safety","doSafetyChecks","doTypeChecks","doDragChecks","errorCode","superiorBlock","inferiorBlock","checkArrayOne","checkArrayTwo","canConnectToPrevious_","Workspace","MAX_UNDO","topComments","commentDB","listeners","undoStack_","redoStack_","blockDB","typedBlocksDB","procedureMap","connectionCheckerClass","getVariableMapClass","VariableMap","setIsReadOnly","sortObjects","sortByOrigin","SCAN_ANGLE","aXY","bXY","renameVariableById","deleteVariableById","getAllVariableNames","remainingCapacity","remainingCapacityOfType","maxInstanceOfType","copyableBlocksCount","redo","inputStack","outputStack","inputEvent","events","clearUndo","getRootWorkspace","outerWs","getById","getAll","SOUND_LIMIT","WorkspaceAudio","sounds","lastSound","muted","filenames","audioTest","filename","ext","canPlayType","sound","volume","playPromise","pause","catch","opt_volume","now","mySound","setMuted","getMuted","ZOOM_TO_FIT_MARGIN","resizeHandlerWrapper","resizesEnabled","startScrollY","startScrollX","oldLeft","oldTop","inverseScreenCTM","dummyWheelListener","configureContextMenu","lastRecordedPageScroll","inverseScreenCTMDirty","highlightedBlocks","toolboxCategoryCallbacks","flyoutButtonCallbacks","cachedParentSvg","keyboardAccessibilityMode","topBoundedElements","dragTargetAreas","layerManager","navigator","MetricsManagerClass","setTopLevelWorkspaceMetrics","componentManager","audioManager","markerManager","Variables","registerToolboxCategoryCallback","VariablesDynamic","Procedures","variableChangeCallback","themeManager_","cachedParentSvgSize","getMarkerManager","isParentWorkspace","refreshToolboxSelection","ctm","getBlockCanvas","opt_backgroundClass","svgBlockCanvas_","svgBubbleCanvas_","this.dummyWheelListener","onMouseWheel","ToolboxClass","CursorClass","parentSvg","newTrashcan","svgTrashcan","_workspace","svgZoomControls","copyOptionsForFlyout","HorizontalFlyout","VerticalFlyout","updateScreenCalculations","positionables","positionable","currScroll","highlightBlock","opt_state","refreshSelection","dragTargets","targetArea","clientRect","getDragTarget","moveDrag","setKeyboardMoveInProgress","canWheelZoom","canWheelMove","scrollDelta","commandKey","PIXELS_PER_ZOOM_STEP","topElements","boundary","topElement","blockBoundary","movableBlocks","immovableBlockBounds","immovableBlocks","getNextIntersectingImmovableBlock","immovableRect","cursorY","minBlockHeight","conflictingRect","scaleChange","getCTM","center","setScale","zoomToFit","workspaceWidth","workspaceHeight","blocksBox","doubleMargin","blocksWidth","blocksHeight","ratioX","ratioY","centerOnBlock","heightWidth","pixelX","multiplier","pixelY","getScale","getAbsoluteScale","getLocalScale","computeScale","maxYScroll","maxYDisplacement","maxXDisplacement","addTopBoundedElement","removeTopBoundedElement","reenabled","removeButtonCallback","removeToolboxCategoryCallback","isStart","autoHideables","autoHideable","padding","rawViewport","viewport","previousNode","nestedWorkspaces","flat","ownFlyout","searchForWorkspaceComment","fieldIndicatorIndex","connectionIndicatorIndex","commentIdSeparatorIndex","newNavigator","VarBase","opt_variable","varId","VarCreate","varType","VariableModel","setType","newType","addVariable","VarDelete","VarRename","potentialMap","conflictVar","renameVariableWithConflict","renameVariableAndUses","changeVariableType","oldType","newTypeVariables","oldCase","getTypes","TrashcanOpen","opt_isOpen","Trashcan","isLidOpen","minOpenness","lidTask","svgLid","lidOpen","flyoutWorkspaceOptions","onDelete","BODY_HEIGHT","LID_HEIGHT","SPRITE_LEFT","SPRITE_TOP","blockMouseDownWhenOpenable","click","mouseOver","mouseOut","animateLid","flyoutDom","setLidOpen","hasContents","contentsIsOpen","openFlyout","string","blocklyStyle","fireUiEvent","closeFlyout","emptyContents","setMinOpenness","trashRect","MARGIN_HOTSPOT","frames","ANIMATION_FRAMES","setLidAngle","MAX_LID_ANGLE","OPACITY_MIN","OPACITY_MAX","ANIMATION_LENGTH","lidAngle","openAtRight","newMin","closeLid","trashcanOpen","cleanedJson","cleanBlockJson","HAS_BLOCKS_LID_ANGLE","cleanRec","blockInfo","ProcedureSerializer","procState","VariableSerializer","variableStates","priorities","workspaceComments","LABEL_TYPE","LabelFlyoutInflater","BaseConstantProvider","gridUnit","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","sweep","_height","curveWidth","quarterHeight","innerTopRightCorner","innerBottomRightCorner","pathTopRight","pathBottomRight","selectedComponentTransfer","replacementComponentTransfer","BaseDrawer","beginDrawing","outputShapeType","endDrawing","hasStatementInput","drawFlatTop_","drawRightDynamicConnection_","drawFlatBottom_","drawLeftDynamicConnection_","insideCorners","cornerHeight","bottomRightPath","verticalPath","topRightPath","getInlineInputPath","setOutlinePath","connectedBottomNextConnection","FieldImage","altText","Y_PADDING","setAlt","setOnClickHandler","MINIMUM_WIDTH","FieldInput","spellcheck_","htmlInput_","isTextValid_","isBeingEdited_","onInputWrapper","onKeyDownWrapper","valueWhenEditorWasOpened_","fullBlockClickTarget_","spellcheck","resizeEditor_","htmlInput","INVALID","setSpellcheck","quietInput","showPromptEditor","showInlineEditor","getValueFromEditorText_","onFinishEditing_","widgetDispose_","widgetCreate_","borderRadius","BORDERRADIUS","strokeColour","border","boxShadow","getEditorText_","bindInputEvents_","unbindInputEvents_","_value","onHtmlInputKeyDown_","onHtmlInputChange","isValidDestination","targetSourceBlock","setEditorValue_","bumped","xMargin","effectiveWidth","FieldTextInput","BaseBottomRow","BaseStatementInput","RightConnectionShape","BaseTopRow","BaseRenderInfo","isMultiRow","rightSide","rightAlignedDummyInputs","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","BasePathObject","svgPathSelected","outlines","remainingOutlines","outline","getOutlinePath","removeOutlinePath","BaseRenderer","InsertionMarkerPreviewer","draggedBlock","staticConn","draggedConn","markerConn","fadedBlock","replacedBlock","shouldUseMarkerPreview","previewMarker","_draggedConn","ZelosRenderer","dragged","createInsertionMarker","serializeBlockToInsertionMarker","blockJson","origBlock","orig","origConn","origConns","markerConns","hideInsertionMarker","markerOutput","markerPrev","CodeGenerator","forBlock","FUNCTION_NAME_PLACEHOLDER_","STATEMENT_SUFFIX","STATEMENT_PREFIX","INFINITE_LOOP_TRAP","INDENT","COMMENT_WRAP","ORDER_OVERRIDES","isInitialized","RESERVED_WORDS_","definitions_","functionNames_","nameDB_","name_","FUNCTION_NAME_PLACEHOLDER_REGEXP_","RegExp","workspaceToCode","code","blockToCode","scrubNakedValue","injectId","codeString","finish","prefixLines","allNestedComments","opt_thisOnly","scrub_","SyntaxError","valueToCode","outerOrder","ReferenceError","innerOrder","parensNeeded","outerOrderClass","innerOrderClass","statementToCode","addLoopTrap","branch","addReservedWords","provideFunction_","desiredName","functionName","codeText","oldCodeText","getVariableName","getProcedureName","_opt_thisOnly","getX","getY","targetWorkspaceViewMetrics","edgeWidth","setBackgroundPath","atRight","cursorX","dragDirection","atan2","range","flyoutRect","BIG_NUM","maxWidthSoFar","oldX","newX","registryName","edgeHeight","moveX","maxHeightSoFar","FieldVariable","variableTypes","defaultType","defaultVariableName","setTypes","variableType","getDefaultType","typeIsAllowed","typeList","getVariableTypes","allTypes","isInArray","FieldNumber","precision","min_","max_","precision_","decimalPlaces","setConstraints","setMinInternal","setMaxInternal","setPrecisionInternal","setMin","getMin","setMax","getMax","setPrecision","precisionString","toLocaleString","maximumFractionDigits","decimalIndex","getPrecision","isFinite","toFixed","VALUEMIN","VALUEMAX","FieldLabelSerializable","FieldCheckbox","checkChar","CHECK_CHAR","checkCharacter","getValueBoolean","setCheckCharacter","character","convertValueToBool","Dragger","dragTarget","totalDelta","moveDraggable","getRoot","wouldDeleteDraggable","updateDragTarget","newDragTarget","pixelsToWorkspaceUnits","rootDraggable","isDeleteArea","origGroup","shouldReturnToStart","pixelCoord","BlockDrag","opt_isStart","opt_blocks","BlockFieldIntermediateChange","BlockMove","currentLocation","oldParentId","parentId","oldInputName","blockConnection","connectionType","BubbleOpen","opt_bubbleType","BubbleType","CommentBase","opt_comment","CommentCreateDeleteHelper","CommentChange","opt_oldContents","opt_newContents","oldContents_","newContents_","CommentCollapse","CommentCreate","CommentDelete","CommentDrag","CommentMove","comment_","newCoordinate_","setOldCoordinate","CommentResize","ToolboxItemSelect","opt_oldItem","opt_newItem","oldItem","newItem","VarTypeChange","FinishedLoading","opt_workspace","CHANGE","CREATE","MOVE","BUTTON_TYPE","ButtonFlyoutInflater","WORKSPACE_AT_BLOCK_CAPACITY_DISABLED_REASON","BLOCK_TYPE","BlockFlyoutInflater","permanentlyDisabledBlocks","capacityWrapper","filterFlyoutBasedOnCapacity","setFlyout","updateStateBasedOnCapacity","addBlockListeners","blockDefinition","removeListeners","blockListeners","l","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","verticalOverlap","highlightRtlDown","highlightLtrUp","highlightLtrDown","hatHeight","pathRtl","pathLtr","BaseInlineInput","hasExternalInputs","nextRightEdge","rowNextRightEdges","prevRightEdge","heightWithoutHat","diff","colourDark","svgPathDark","svgPathLight","highlightPath","highlightConstants","makeHighlightConstants_","Zelos","ToolboxItem","toolboxItemDef","parentToolbox","level_","parent_","getLevel","toolboxItemDef_","parentToolbox_","getClickTarget","isCollapsible","setVisible_","_isVisible","ToolboxCategory","categoryDef","labelDom_","iconDom_","rowContents_","rowDiv_","htmlDiv_","isDisabled_","isHidden_","flyoutItems_","cssConfig_","makeDefaultCssConfig_","parseCategoryDef_","parseContents_","createDom_","itemDef","getColour_","createContainer_","LEVEL","createRowContainer_","pointerEvents","createRowContentsContainer_","createIconDom_","createLabelDom_","LABELLEDBY","addColourBorder_","rowDiv","nestedPadding","paddingRight","paddingLeft","contentsContainer","toolboxIcon","isHorizontal","toolboxLabel","borderWidth","borderRight","borderLeft","styleName","getColourfromStyle","parseColour","colourValue","openIcon_","iconDiv","closedIconClass","closeIcon_","openIconClass","getSelectedItem","clearSelection","allAncestorsExpanded_","category","isExpanded","defaultColour","defaultBackgroundColour","setDisabled","isDisabled","updateFlyoutContents","newDefinition","custom","categorystyle","cssconfig","hidden","registrationName","ToolboxSeparator","separatorDef","htmlDiv","CollapsibleToolboxCategory","subcategoriesDiv_","expanded_","toolboxItems_","cssConfig","prevIsFlyoutItem","createToolboxItem","ToolboxItemClass","setExpanded","subCategories","getChildToolboxItems","createSubCategoriesDom_","EXPANDED","subcategories","newCategory","newCategoryDiv","handleToolboxItemResize","childToolboxItems","toggleExpanded","Toolbox","contentsDiv_","HtmlDiv","isVisible_","previouslySelectedItem_","selectedItem_","boundEvents_","toolboxDef_","createFlyout_","themeManager","createContentsContainer_","attachEvents_","toolboxContainer","flexDirection","clickEvent","onClick_","keyDownEvent","onKeyDown_","itemId","getToolboxItemById","setSelectedItem","handled","selectNext","selectPrevious","selectParent","selectChild","FlyoutClass","renderContents_","createDocumentFragment","addToolboxItem_","toolboxItemDom","getToolboxItems","addStyle","removeStyle","toolboxRect","updateCursorDeleteStyle_","getPreviouslySelectedItem","workspaceMetrics","toolboxDiv","shouldDeselectItem_","deselectItem_","shouldSelectItem_","selectItem_","updateFlyout_","fireSelectEvent","selectItemByPosition","oldElement","collapsibleItem","nextItemIdx","nextItem","prevItemIdx","prevItem","VERSION","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","Workspace.prototype.newComment","WorkspaceSvg.prototype.newComment","WorkspaceSvg.newTrashcan","MiniWorkspaceBubble.prototype.newWorkspaceSvg","Names.prototype.populateProcedures","flattenedProcedures","DropDownDiv","dropDownDiv","ContextMenu","ContextMenuItems","Css","Events","Extensions","ShortcutItems","Themes","Tooltip","Touch","WidgetDiv","Xml","blockAnimations","blockRendering","bubbles","bumpObjects","clipboard","common","dialog","fieldRegistry","geras","renderManagement","serialization","thrasos","uiPosition","utils","zelos"],"mappings":"A;;;;;;;;;;;;;AA+IMA,IAAAA,wCAAAA,CAqENC,wCArEMD,CAsFAE,0CAtFAF,CAqHNG,uCArHMH,CAqJAI,uCArJAJ,CAyKAK,wCAzKAL,CA6LAM,yCA7LAN,CA+MAO,2CA/MAP,CAoPAQ,mDApPAR,CC9EAS,sCD8EAT,CC9DAU,qCD8DAV,CClDAW,iDDkDAX;ACrCAY,8CDqCAZ,CCpBAa,wDDoBAb,CCNAc,iDDMAd,CE7FAe,qDF6FAf,CE5CAgB,0CF4CAhB,CELAiB,4CFKAjB,CEaAkB,mDFbAlB,CEiDAmB,mDFjDAnB,CEmEAoB,gDFnEApB,CEwFAqB,0DFxFArB;AGtFAsB,wDHsFAtB,CG5EAuB,+CH4EAvB,CInGAwB,sDJmGAxB,CI9FAyB,sDJ8FAzB,CIzFA0B,sDJyFA1B,CIpFA2B,uEJoFA3B,CI7EA4B,oDJ6EA5B,CIxEA6B,oDJwEA7B,CInEA8B,oDJmEA9B;AI9DA+B,oDJ8DA/B,CIzDAgC,oDJyDAhC,CIpDAiC,mDJoDAjC,CI/CAkC,gDJ+CAlC,CI1CAmC,qDJ0CAnC,CIrCAoC,uDJqCApC,CIhCAqC,4DJgCArC,CIzBAsC,sDJyBAtC,CIpBAuC,yDJoBAvC,CIfAwC,wDJeAxC;AIVAyC,wDJUAzC,CILA0C,wDJ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AA,6CAAA,E,CCAA,IAAAA,4DAAA,E,CCAA,IAAAA,0CAAA,E,CCAA,IAAAA,mDAAA","file":"blockly_compressed.js","sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.registry\n\nimport type {Abstract} from './events/events_abstract.js';\nimport type {Field} from './field.js';\nimport type {Input} from './inputs/input.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport type {IConnectionPreviewer} from './interfaces/i_connection_previewer.js';\nimport type {ICopyData, ICopyable} from './interfaces/i_copyable.js';\nimport type {IDragger} from './interfaces/i_dragger.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js';\nimport type {IIcon} from './interfaces/i_icon.js';\nimport type {IMetricsManager} from './interfaces/i_metrics_manager.js';\nimport type {IPaster} from './interfaces/i_paster.js';\nimport type {ISerializer} from './interfaces/i_serializer.js';\nimport type {IToolbox} from './interfaces/i_toolbox.js';\nimport type {IVariableMap} from './interfaces/i_variable_map.js';\nimport type {\n  IVariableModel,\n  IVariableModelStatic,\n  IVariableState,\n} from './interfaces/i_variable_model.js';\nimport type {LineCursor} from './keyboard_nav/line_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 * 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  };\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 */\nexport const DEFAULT = 'default';\n\n/**\n * A name with the type of the element stored in the generic.\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 CONNECTION_PREVIEWER = new Type<IConnectionPreviewer>(\n    'connectionPreviewer',\n  );\n\n  static CURSOR = new Type<LineCursor>('cursor');\n\n  static EVENT = new Type<Abstract>('event');\n\n  static FIELD = new Type<Field>('field');\n\n  static INPUT = new Type<Input>('input');\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 = new Type<IFlyout>(\n    'flyoutsHorizontalToolbox',\n  );\n\n  static FLYOUT_INFLATER = new Type<IFlyoutInflater>('flyoutInflater');\n\n  static METRICS_MANAGER = new Type<IMetricsManager>('metricsManager');\n\n  /**\n   * Type for an IDragger. Formerly behavior was mostly covered by\n   * BlockDraggeers, which is why the name is inaccurate.\n   */\n  static BLOCK_DRAGGER = new Type<IDragger>('blockDragger');\n\n  /** @internal */\n  static SERIALIZER = new Type<ISerializer>('serializer');\n\n  /** @internal */\n  static ICON = new Type<IIcon>('icon');\n\n  /** @internal */\n  static PASTER = new Type<IPaster<ICopyData, ICopyable<ICopyData>>>('paster');\n\n  static VARIABLE_MODEL = new Type<\n    IVariableModelStatic<IVariableState> & IVariableModel<IVariableState>\n  >('variableModel');\n\n  static VARIABLE_MAP = new Type<IVariableMap<IVariableModel<IVariableState>>>(\n    'variableMap',\n  );\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 */\nexport function register<T>(\n  type: string | Type<T>,\n  name: string,\n  registryItem:\n    | (new (...p1: AnyDuringMigration[]) => T)\n    | null\n    | AnyDuringMigration,\n  opt_allowOverrides?: boolean,\n): void {\n  if (\n    (!(type instanceof Type) && typeof type !== 'string') ||\n    `${type}`.trim() === ''\n  ) {\n    throw Error(\n      'Invalid type \"' +\n        type +\n        '\". The type must be a' +\n        ' non-empty string or a Blockly.registry.Type.',\n    );\n  }\n  type = `${type}`.toLowerCase();\n\n  if (typeof name !== 'string' || name.trim() === '') {\n    throw Error(\n      'Invalid name \"' + name + '\". The name must be a' + ' non-empty string.',\n    );\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  // or if we're trying to register the same item.\n  if (\n    !opt_allowOverrides &&\n    typeRegistry[caselessName] &&\n    typeRegistry[caselessName] !== registryItem\n  ) {\n    throw Error(\n      'Name \"' +\n        caselessName +\n        '\" with type \"' +\n        type +\n        '\" already registered.',\n    );\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: 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 */\nexport function unregister<T>(type: string | Type<T>, name: string) {\n  type = `${type}`.toLowerCase();\n  name = name.toLowerCase();\n  const typeRegistry = typeMap[type];\n  if (!typeRegistry || !typeRegistry[name]) {\n    console.warn(\n      'Unable to unregister [' +\n        name +\n        '][' +\n        type +\n        '] from the ' +\n        'registry.',\n    );\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>,\n  name: string,\n  opt_throwIfMissing?: boolean,\n): (new (...p1: AnyDuringMigration[]) => T) | null | AnyDuringMigration {\n  type = `${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      );\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 */\nexport function hasItem<T>(type: string | Type<T>, name: string): boolean {\n  type = `${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 */\nexport function getClass<T>(\n  type: string | Type<T>,\n  name: string,\n  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 */\nexport function getObject<T>(\n  type: string | Type<T>,\n  name: string,\n  opt_throwIfMissing?: boolean,\n): 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 */\nexport function getAllItems<T>(\n  type: string | Type<T>,\n  opt_cased?: boolean,\n  opt_throwIfMissing?: boolean,\n): {[key: string]: T | null | (new (...p1: AnyDuringMigration[]) => T)} | null {\n  type = `${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  for (const key of Object.keys(typeRegistry)) {\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 */\nexport function getClassFromOptions<T>(\n  type: Type<T>,\n  options: Options,\n  opt_throwIfMissing?: boolean,\n): (new (...p1: AnyDuringMigration[]) => T) | null {\n  const plugin = options.plugins[String(type)] || 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 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Touch\n\nimport type {Gesture} from './gesture.js';\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 =\n  'ontouchstart' in globalThis ||\n  !!(\n    globalThis['document'] &&\n    document.documentElement &&\n    'ontouchstart' in document.documentElement\n  ) || // IE10 uses non-standard touch events,\n  // so it has a different check.\n  !!(\n    globalThis['navigator'] &&\n    (globalThis['navigator']['maxTouchPoints'] ||\n      (globalThis['navigator'] as any)['msMaxTouchPoints'])\n  );\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 */\nexport const TOUCH_MAP: {[key: string]: string[]} = {\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  'pointerup': ['pointerup', 'pointercancel'],\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 * @internal\n */\nexport function longStart(e: PointerEvent, gesture: Gesture) {\n  longStop();\n  longPid_ = setTimeout(function () {\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 * @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 */\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 */\nexport function shouldHandleEvent(e: Event): boolean {\n  // Do not replace the startsWith with a check for `instanceof PointerEvent`.\n  // `click` and `contextmenu` are PointerEvents in some browsers,\n  // despite not starting with `pointer`, but we want to always handle them\n  // without worrying about touch identifiers.\n  return (\n    !e.type.startsWith('pointer') ||\n    (e instanceof PointerEvent && checkTouchIdentifier(e))\n  );\n}\n\n/**\n * Get the pointer identifier from the given event.\n *\n * @param e Pointer event.\n * @returns The pointerId of the event.\n */\nexport function getTouchIdentifierFromEvent(e: PointerEvent): string {\n  return `${e.pointerId}`;\n}\n\n/**\n * Check whether the pointer identifier on the event matches the current saved\n * identifier. If the current identifier was unset, save the identifier from\n * the event. This starts a drag/gesture, during which pointer events with\n * other identifiers will be silently ignored.\n *\n * @param e Pointer event.\n * @returns Whether the identifier on the event matches the current saved\n *     identifier.\n */\nexport function checkTouchIdentifier(e: PointerEvent): boolean {\n  const identifier = getTouchIdentifierFromEvent(e);\n\n  if (touchIdentifier_) {\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 === '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 * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.browserEvents\n\n// Theoretically we could figure out a way to type the event params correctly,\n// but it's not high priority.\n/* eslint-disable @typescript-eslint/no-unsafe-function-type */\n\nimport * as Touch from './touch.js';\nimport * as userAgent from './utils/useragent.js';\n\n/**\n * Blockly opaque event data used to unbind events when using\n * `bind` and `conditionalBind`.\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 * @returns Opaque data that can be passed to unbindEvent_.\n */\nexport function conditionalBind(\n  node: EventTarget,\n  name: string,\n  thisObject: object | null,\n  func: Function,\n  opt_noCaptureIdentifier?: boolean,\n): Data {\n  /**\n   *\n   * @param e\n   */\n  function wrapFunc(e: Event) {\n    const captureIdentifier = !opt_noCaptureIdentifier;\n\n    if (!(captureIdentifier && !Touch.shouldHandleEvent(e))) {\n      if (thisObject) {\n        func.call(thisObject, e);\n      } else {\n        func(e);\n      }\n    }\n  }\n\n  const bindData: Data = [];\n  if (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  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 */\nexport function bind(\n  node: EventTarget,\n  name: string,\n  thisObject: object | null,\n  func: Function,\n): 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 (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  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 */\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 [node, name, func] = bindData.pop()!;\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 */\nexport function isTargetInput(e: Event): boolean {\n  if (e.target instanceof HTMLElement) {\n    if (\n      e.target.isContentEditable ||\n      e.target.getAttribute('data-is-text-input') === 'true'\n    ) {\n      return true;\n    }\n\n    if (e.target instanceof HTMLInputElement) {\n      const target = e.target;\n      return (\n        target.type === 'text' ||\n        target.type === 'number' ||\n        target.type === 'email' ||\n        target.type === 'password' ||\n        target.type === 'search' ||\n        target.type === 'tel' ||\n        target.type === 'url'\n      );\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 */\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 */\nexport function mouseToSvg(\n  e: MouseEvent,\n  svg: SVGSVGElement,\n  matrix: SVGMatrix | null,\n): 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 */\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 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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  '!#$%()*+,-./:;=?@[]^_`{|}~' +\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 */\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 */\nexport function genUid(): string {\n  return internal.genUid();\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @file Predicates for testing Abstract event subclasses based on\n * their .type properties.  These are useful because there are places\n * where it is not possible to use instanceof <ClassConstructor> tests\n * for type narrowing due to load ordering issues that would be caused\n * by the need to import (rather than just import type) the class\n * constructors in question.\n */\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 {BlockDelete} from './events_block_delete.js';\nimport type {BlockDrag} from './events_block_drag.js';\nimport type {BlockFieldIntermediateChange} from './events_block_field_intermediate_change.js';\nimport type {BlockMove} from './events_block_move.js';\nimport type {BubbleOpen} from './events_bubble_open.js';\nimport type {Click} from './events_click.js';\nimport type {CommentChange} from './events_comment_change.js';\nimport type {CommentCollapse} from './events_comment_collapse.js';\nimport type {CommentCreate} from './events_comment_create.js';\nimport type {CommentDelete} from './events_comment_delete.js';\nimport type {CommentDrag} from './events_comment_drag.js';\nimport type {CommentMove} from './events_comment_move.js';\nimport type {CommentResize} from './events_comment_resize.js';\nimport type {Selected} from './events_selected.js';\nimport type {ThemeChange} from './events_theme_change.js';\nimport type {ToolboxItemSelect} from './events_toolbox_item_select.js';\nimport type {TrashcanOpen} from './events_trashcan_open.js';\nimport type {VarCreate} from './events_var_create.js';\nimport type {VarDelete} from './events_var_delete.js';\nimport type {VarRename} from './events_var_rename.js';\nimport type {ViewportChange} from './events_viewport.js';\nimport type {FinishedLoading} from './workspace_events.js';\n\nimport {EventType} from './type.js';\n\n/** @returns true iff event.type is EventType.BLOCK_CREATE */\nexport function isBlockCreate(event: Abstract): event is BlockCreate {\n  return event.type === EventType.BLOCK_CREATE;\n}\n\n/** @returns true iff event.type is EventType.BLOCK_DELETE */\nexport function isBlockDelete(event: Abstract): event is BlockDelete {\n  return event.type === EventType.BLOCK_DELETE;\n}\n\n/** @returns true iff event.type is EventType.BLOCK_CHANGE */\nexport function isBlockChange(event: Abstract): event is BlockChange {\n  return event.type === EventType.BLOCK_CHANGE;\n}\n\n/** @returns true iff event.type is EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE */\nexport function isBlockFieldIntermediateChange(\n  event: Abstract,\n): event is BlockFieldIntermediateChange {\n  return event.type === EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE;\n}\n\n/** @returns true iff event.type is EventType.BLOCK_MOVE */\nexport function isBlockMove(event: Abstract): event is BlockMove {\n  return event.type === EventType.BLOCK_MOVE;\n}\n\n/** @returns true iff event.type is EventType.VAR_CREATE */\nexport function isVarCreate(event: Abstract): event is VarCreate {\n  return event.type === EventType.VAR_CREATE;\n}\n\n/** @returns true iff event.type is EventType.VAR_DELETE */\nexport function isVarDelete(event: Abstract): event is VarDelete {\n  return event.type === EventType.VAR_DELETE;\n}\n\n/** @returns true iff event.type is EventType.VAR_RENAME */\nexport function isVarRename(event: Abstract): event is VarRename {\n  return event.type === EventType.VAR_RENAME;\n}\n\n/** @returns true iff event.type is EventType.BLOCK_DRAG */\nexport function isBlockDrag(event: Abstract): event is BlockDrag {\n  return event.type === EventType.BLOCK_DRAG;\n}\n\n/** @returns true iff event.type is EventType.SELECTED */\nexport function isSelected(event: Abstract): event is Selected {\n  return event.type === EventType.SELECTED;\n}\n\n/** @returns true iff event.type is EventType.CLICK */\nexport function isClick(event: Abstract): event is Click {\n  return event.type === EventType.CLICK;\n}\n\n/** @returns true iff event.type is EventType.BUBBLE_OPEN */\nexport function isBubbleOpen(event: Abstract): event is BubbleOpen {\n  return event.type === EventType.BUBBLE_OPEN;\n}\n\n/** @returns true iff event.type is EventType.TRASHCAN_OPEN */\nexport function isTrashcanOpen(event: Abstract): event is TrashcanOpen {\n  return event.type === EventType.TRASHCAN_OPEN;\n}\n\n/** @returns true iff event.type is EventType.TOOLBOX_ITEM_SELECT */\nexport function isToolboxItemSelect(\n  event: Abstract,\n): event is ToolboxItemSelect {\n  return event.type === EventType.TOOLBOX_ITEM_SELECT;\n}\n\n/** @returns true iff event.type is EventType.THEME_CHANGE */\nexport function isThemeChange(event: Abstract): event is ThemeChange {\n  return event.type === EventType.THEME_CHANGE;\n}\n\n/** @returns true iff event.type is EventType.VIEWPORT_CHANGE */\nexport function isViewportChange(event: Abstract): event is ViewportChange {\n  return event.type === EventType.VIEWPORT_CHANGE;\n}\n\n/** @returns true iff event.type is EventType.COMMENT_CREATE */\nexport function isCommentCreate(event: Abstract): event is CommentCreate {\n  return event.type === EventType.COMMENT_CREATE;\n}\n\n/** @returns true iff event.type is EventType.COMMENT_DELETE */\nexport function isCommentDelete(event: Abstract): event is CommentDelete {\n  return event.type === EventType.COMMENT_DELETE;\n}\n\n/** @returns true iff event.type is EventType.COMMENT_CHANGE */\nexport function isCommentChange(event: Abstract): event is CommentChange {\n  return event.type === EventType.COMMENT_CHANGE;\n}\n\n/** @returns true iff event.type is EventType.COMMENT_MOVE */\nexport function isCommentMove(event: Abstract): event is CommentMove {\n  return event.type === EventType.COMMENT_MOVE;\n}\n\n/** @returns true iff event.type is EventType.COMMENT_RESIZE */\nexport function isCommentResize(event: Abstract): event is CommentResize {\n  return event.type === EventType.COMMENT_RESIZE;\n}\n\n/** @returns true iff event.type is EventType.COMMENT_DRAG */\nexport function isCommentDrag(event: Abstract): event is CommentDrag {\n  return event.type === EventType.COMMENT_DRAG;\n}\n\n/** @returns true iff event.type is EventType.COMMENT_COLLAPSE */\nexport function isCommentCollapse(event: Abstract): event is CommentCollapse {\n  return event.type === EventType.COMMENT_COLLAPSE;\n}\n\n/** @returns true iff event.type is EventType.FINISHED_LOADING */\nexport function isFinishedLoading(event: Abstract): event is FinishedLoading {\n  return event.type === EventType.FINISHED_LOADING;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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';\nimport type {Abstract} from './events_abstract.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 {CommentResize} from './events_comment_resize.js';\nimport {\n  isBlockChange,\n  isBlockCreate,\n  isBlockMove,\n  isBubbleOpen,\n  isClick,\n  isViewportChange,\n} from './predicates.js';\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 */\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 */\nexport function getRecordUndo(): boolean {\n  return recordUndo;\n}\n\n/** Allow change events to be created and fired. */\nlet disabled = 0;\n\n/**\n * The language-neutral ID for when the reason why a block is disabled is\n * because the block is not descended from a root block.\n */\nconst ORPHANED_BLOCK_DISABLED_REASON = 'ORPHANED_BLOCK';\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 */\nexport type BumpEvent =\n  | BlockCreate\n  | BlockMove\n  | CommentCreate\n  | CommentMove\n  | CommentResize;\n\n/** List of events queued for firing. */\nconst FIRE_QUEUE: Abstract[] = [];\n\n/**\n * Enqueue an event to be dispatched to change listeners.\n *\n * Notes:\n *\n * - Events are enqueued until a timeout, generally after rendering is\n *   complete or at the end of the current microtask, if not running\n *   in a browser.\n * - Queued events are subject to destructive modification by being\n *   combined with later-enqueued events, but only until they are\n *   fired.\n * - Events are dispatched via the fireChangeListener method on the\n *   affected workspace.\n *\n * @param event Any Blockly event.\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    try {\n      // If we are in a browser context, we want to make sure that the event\n      // fires after blocks have been rerendered this frame.\n      requestAnimationFrame(() => {\n        setTimeout(fireNow, 0);\n      });\n    } catch {\n      // Otherwise we just want to delay so events can be coallesced.\n      // requestAnimationFrame will error triggering this.\n      setTimeout(fireNow, 0);\n    }\n  }\n  enqueueEvent(event);\n}\n\n/** Dispatch all queued events. */\nfunction fireNow() {\n  const queue = filter(FIRE_QUEUE);\n  FIRE_QUEUE.length = 0;\n  for (const event of queue) {\n    if (!event.workspaceId) continue;\n    common.getWorkspaceById(event.workspaceId)?.fireChangeListener(event);\n  }\n}\n\n/**\n * Enqueue an event on FIRE_QUEUE.\n *\n * Normally this is equivalent to FIRE_QUEUE.push(event), but if the\n * enqueued event is a BlockChange event and the most recent event(s)\n * on the queue are BlockMove events that (re)connect other blocks to\n * the changed block (and belong to the same event group) then the\n * enqueued event will be enqueued before those events rather than\n * after.\n *\n * This is a workaround for a problem caused by the fact that\n * MutatorIcon.prototype.recomposeSourceBlock can only fire a\n * BlockChange event after the mutating block's compose method\n * returns, meaning that if the compose method reconnects child blocks\n * the corresponding BlockMove events are emitted _before_ the\n * BlockChange event, causing issues with undo, mirroring, etc.; see\n * https://github.com/google/blockly/issues/8225#issuecomment-2195751783\n * (and following) for details.\n */\nfunction enqueueEvent(event: Abstract) {\n  if (isBlockChange(event) && event.element === 'mutation') {\n    let i;\n    for (i = FIRE_QUEUE.length; i > 0; i--) {\n      const otherEvent = FIRE_QUEUE[i - 1];\n      if (\n        otherEvent.group !== event.group ||\n        otherEvent.workspaceId !== event.workspaceId ||\n        !isBlockMove(otherEvent) ||\n        otherEvent.newParentId !== event.blockId\n      ) {\n        break;\n      }\n    }\n    FIRE_QUEUE.splice(i, 0, event);\n    return;\n  }\n\n  FIRE_QUEUE.push(event);\n}\n\n/**\n * Filter the queued events by merging duplicates, removing null\n * events and reording BlockChange events.\n *\n * History of this function:\n *\n * This function was originally added in commit cf257ea5 with the\n * intention of dramatically reduing the total number of dispatched\n * events.  Initialy it affected only BlockMove events but others were\n * added over time.\n *\n * Code was added to reorder BlockChange events added in commit\n * 5578458, for uncertain reasons but most probably as part of an\n * only-partially-successful attemp to fix problems with event\n * ordering during block mutations.  This code should probably have\n * been added to the top of the function, before merging and\n * null-removal, but was added at the bottom for now-forgotten\n * reasons.  See these bug investigations for a fuller discussion of\n * the underlying issue and some of the failures that arose because of\n * this incomplete/incorrect fix:\n *\n * https://github.com/google/blockly/issues/8225#issuecomment-2195751783\n * https://github.com/google/blockly/issues/2037#issuecomment-2209696351\n *\n * Later, in PR #1205 the original O(n^2) implementation was replaced\n * by a linear-time implementation, though additonal fixes were made\n * subsequently.\n *\n * In August 2024 a number of significant simplifications were made:\n *\n * This function was previously called from Workspace.prototype.undo,\n * but the mutation of events by this function was the cause of issue\n * #7026 (note that events would combine differently in reverse order\n * vs. forward order).  The originally-chosen fix for this was the\n * addition (in PR #7069) of code to fireNow to post-filter the\n * .undoStack_ and .redoStack_ of any workspace that had just been\n * involved in dispatching events; this apparently resolved the issue\n * but added considerable additional complexity and made it difficult\n * to reason about how events are processed for undo/redo, so both the\n * call from undo and the post-processing code was removed, and\n * forward=true was made the default while calling the function with\n * forward=false was deprecated.\n *\n * At the same time, the buggy code to reorder BlockChange events was\n * replaced by a less-buggy version of the same functionality in a new\n * function, enqueueEvent, called from fireInternal, thus assuring\n * that events will be in the correct order at the time filter is\n * called.\n *\n * Additionally, the event merging code was modified so that only\n * immediately adjacent events would be merged.  This simplified the\n * implementation while ensuring that the merging of events cannot\n * cause them to be reordered.\n *\n * @param queue Array of events.\n * @returns Array of filtered events.\n */\nexport function filter(queue: Abstract[]): Abstract[] {\n  const mergedQueue: Abstract[] = [];\n  // Merge duplicates.\n  for (const event of queue) {\n    const lastEvent = mergedQueue[mergedQueue.length - 1];\n    if (event.isNull()) continue;\n    if (\n      !lastEvent ||\n      lastEvent.workspaceId !== event.workspaceId ||\n      lastEvent.group !== event.group\n    ) {\n      mergedQueue.push(event);\n      continue;\n    }\n    if (\n      isBlockMove(event) &&\n      isBlockMove(lastEvent) &&\n      event.blockId === lastEvent.blockId\n    ) {\n      // Merge move events.\n      lastEvent.newParentId = event.newParentId;\n      lastEvent.newInputName = event.newInputName;\n      lastEvent.newCoordinate = event.newCoordinate;\n      // Concatenate reasons without duplicates.\n      if (lastEvent.reason || event.reason) {\n        lastEvent.reason = Array.from(\n          new Set((lastEvent.reason ?? []).concat(event.reason ?? [])),\n        );\n      }\n    } else if (\n      isBlockChange(event) &&\n      isBlockChange(lastEvent) &&\n      event.blockId === lastEvent.blockId &&\n      event.element === lastEvent.element &&\n      event.name === lastEvent.name\n    ) {\n      // Merge change events.\n      lastEvent.newValue = event.newValue;\n    } else if (isViewportChange(event) && isViewportChange(lastEvent)) {\n      // Merge viewport change events.\n      lastEvent.viewTop = event.viewTop;\n      lastEvent.viewLeft = event.viewLeft;\n      lastEvent.scale = event.scale;\n      lastEvent.oldScale = event.oldScale;\n    } else if (isClick(event) && isBubbleOpen(lastEvent)) {\n      // Drop click events caused by opening/closing bubbles.\n    } else {\n      mergedQueue.push(event);\n    }\n  }\n  // Filter out any events that have become null due to merging.\n  queue = mergedQueue.filter((e) => !e.isNull());\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 */\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 */\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 */\nexport function enable() {\n  disabled--;\n}\n\n/**\n * Returns whether events may be fired or not.\n *\n * @returns True if enabled.\n */\nexport function isEnabled(): boolean {\n  return disabled === 0;\n}\n\n/**\n * Current group.\n *\n * @returns ID string.\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 */\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 * @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 */\nexport function fromJson(\n  json: AnyDuringMigration,\n  workspace: Workspace,\n): Abstract {\n  const eventClass = get(json['type']);\n  if (!eventClass) throw Error('Unknown event type.');\n\n  return (eventClass as any).fromJson(json, workspace);\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 */\nexport function get(\n  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 * Set if a block is disabled depending on whether it is properly connected.\n * Use this on applications where all blocks should be connected to a top block.\n *\n * @param event Custom data for event.\n */\nexport function disableOrphans(event: Abstract) {\n  if (isBlockMove(event) || isBlockCreate(event)) {\n    const blockEvent = event as BlockMove | BlockCreate;\n    if (!blockEvent.workspaceId) {\n      return;\n    }\n    const eventWorkspace = common.getWorkspaceById(\n      blockEvent.workspaceId,\n    ) 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 (\n          parent &&\n          !parent.hasDisabledReason(ORPHANED_BLOCK_DISABLED_REASON)\n        ) {\n          const children = block.getDescendants(false);\n          for (let i = 0, child; (child = children[i]); i++) {\n            child.setDisabledReason(false, ORPHANED_BLOCK_DISABLED_REASON);\n          }\n        } else if (\n          (block.outputConnection || block.previousConnection) &&\n          !eventWorkspace.isDragging()\n        ) {\n          do {\n            block.setDisabledReason(true, ORPHANED_BLOCK_DISABLED_REASON);\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  enqueueEvent,\n  fireNow,\n  fireInternal,\n  setGroupInternal,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.dom\n\nimport type {Svg} from './svg.js';\n\n/**\n * Required name space for SVG elements.\n */\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * Required name space for HTML elements.\n */\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\n\n/**\n * Required name space for XLINK elements.\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 */\nexport enum NodeType {\n  ELEMENT_NODE = 1,\n  TEXT_NODE = 3,\n  COMMENT_NODE = 8,\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 */\nexport function createSvgElement<T extends SVGElement>(\n  name: string | Svg<T>,\n  attrs: {[key: string]: string | number},\n  opt_parent?: Element | null,\n): T {\n  const e = document.createElementNS(SVG_NS, `${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 */\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 */\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 */\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 */\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 */\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 */\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 * 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 */\nexport function setCssTransform(\n  element: HTMLElement | SVGElement,\n  transform: string,\n) {\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 */\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 */\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 */\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  // Compute the width of the SVG text element.\n  const style = window.getComputedStyle(textElement);\n  width = getFastTextWidthWithSizeString(\n    textElement,\n    style.fontSize,\n    style.fontWeight,\n    style.fontFamily,\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 */\nexport function getFastTextWidth(\n  textElement: SVGTextElement,\n  fontSize: number,\n  fontWeight: string,\n  fontFamily: string,\n): number {\n  return getFastTextWidthWithSizeString(\n    textElement,\n    fontSize + 'pt',\n    fontWeight,\n    fontFamily,\n  );\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 */\nexport function getFastTextWidthWithSizeString(\n  textElement: SVGTextElement,\n  fontSize: string,\n  fontWeight: string,\n  fontFamily: string,\n): 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');\n  }\n\n  // Measure the text width using the helper canvas context.\n  if (text && canvasContext) {\n    // Set the desired font size and family.\n    canvasContext.font = fontWeight + ' ' + fontSize + ' ' + fontFamily;\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 */\nexport function measureFontMetrics(\n  text: string,\n  fontSize: string,\n  fontWeight: string,\n  fontFamily: string,\n): {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.style.display = 'flex';\n  div.style.position = 'fixed';\n  div.style.top = '0';\n  div.style.left = '0';\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 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableTree} from './i_focusable_tree.js';\n\n/** Represents anything that can have input focus. */\nexport interface IFocusableNode {\n  /**\n   * Returns the DOM element that can be explicitly requested to receive focus.\n   *\n   * IMPORTANT: Please note that this element is expected to have a visual\n   * presence on the page as it will both be explicitly focused and have its\n   * style changed depending on its current focus state (i.e. blurred, actively\n   * focused, and passively focused). The element will have one of two styles\n   * attached (where no style indicates blurred/not focused):\n   * - blocklyActiveFocus\n   * - blocklyPassiveFocus\n   *\n   * The returned element must also have a valid ID specified, and this ID\n   * should be unique across the entire page. Failing to have a properly unique\n   * ID could result in trying to focus one node (such as via a mouse click)\n   * leading to another node with the same ID actually becoming focused by\n   * FocusManager.\n   *\n   * The returned element must be visible if the node is ever focused via\n   * FocusManager.focusNode() or FocusManager.focusTree(). It's allowed for an\n   * element to be hidden until onNodeFocus() is called, or become hidden with a\n   * call to onNodeBlur().\n   *\n   * It's expected the actual returned element will not change for the lifetime\n   * of the node (that is, its properties can change but a new element should\n   * never be returned). Also, the returned element will have its tabindex\n   * overwritten throughout the lifecycle of this node and FocusManager.\n   *\n   * If a node requires the ability to be focused directly without first being\n   * focused via FocusManager then it must set its own tab index.\n   *\n   * @returns The HTMLElement or SVGElement which can both receive focus and be\n   *     visually represented as actively or passively focused for this node.\n   */\n  getFocusableElement(): HTMLElement | SVGElement;\n\n  /**\n   * Returns the closest parent tree of this node (in cases where a tree has\n   * distinct trees underneath it), which represents the tree to which this node\n   * belongs.\n   *\n   * @returns The node's IFocusableTree.\n   */\n  getFocusableTree(): IFocusableTree;\n\n  /**\n   * Called when this node receives active focus.\n   *\n   * Note that it's fine for implementations to change visibility modifiers, but\n   * they should avoid the following:\n   * - Creating or removing DOM elements (including via the renderer or drawer).\n   * - Affecting focus via DOM focus() calls or the FocusManager.\n   *\n   * Implementations may consider scrolling themselves into view here; that is\n   * not handled by the focus manager.\n   */\n  onNodeFocus(): void;\n\n  /**\n   * Called when this node loses active focus. It may still have passive focus.\n   *\n   * This has the same implementation restrictions as onNodeFocus().\n   */\n  onNodeBlur(): void;\n\n  /**\n   * Indicates whether this node allows focus. If this returns false then none\n   * of the other IFocusableNode methods will be called.\n   *\n   * Note that special care must be taken if implementations of this function\n   * dynamically change their return value value over the lifetime of the node\n   * as certain environment conditions could affect the focusability of this\n   * node's DOM element (such as whether the element has a positive or zero\n   * tabindex). Also, changing from a true to a false value while the node holds\n   * focus will not immediately change the current focus of the node nor\n   * FocusManager's internal state, and thus may result in some of the node's\n   * functions being called later on when defocused (since it was previously\n   * considered focusable at the time of being focused).\n   *\n   * Implementations should generally always return true here unless there are\n   * circumstances under which this node should be skipped for focus\n   * considerations. Examples may include being disabled, read-only, a purely\n   * visual decoration, or a node with no visual representation that must\n   * implement this interface (e.g. due to a parent interface extending it).\n   * Keep in mind accessibility best practices when determining whether a node\n   * should be focusable since even disabled and read-only elements are still\n   * often relevant to providing organizational context to users (particularly\n   * when using a screen reader).\n   *\n   * @returns Whether this node can be focused by FocusManager.\n   */\n  canBeFocused(): boolean;\n}\n\n/**\n * Determines whether the provided object fulfills the contract of\n * IFocusableNode.\n *\n * @param obj The object to test.\n * @returns Whether the provided object can be used as an IFocusableNode.\n */\nexport function isFocusableNode(obj: any): obj is IFocusableNode {\n  return (\n    obj &&\n    typeof obj.getFocusableElement === 'function' &&\n    typeof obj.getFocusableTree === 'function' &&\n    typeof obj.onNodeFocus === 'function' &&\n    typeof obj.onNodeBlur === 'function' &&\n    typeof obj.canBeFocused === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ISelectable\n\nimport type {Workspace} from '../workspace.js';\nimport {IFocusableNode, isFocusableNode} from './i_focusable_node.js';\n\n/**\n * The interface for an object that is selectable.\n *\n * Implementations are generally expected to use their implementations of\n * onNodeFocus() and onNodeBlur() to call setSelected() with themselves and\n * null, respectively, in order to ensure that selections are correctly updated\n * and the selection change event is fired.\n */\nexport interface ISelectable extends IFocusableNode {\n  id: string;\n\n  workspace: Workspace;\n\n  /** Select this.  Highlight it visually. */\n  select(): void;\n\n  /** Unselect this.  Unhighlight it visually. */\n  unselect(): void;\n}\n\n/** Checks whether the given object is an ISelectable. */\nexport function isSelectable(obj: any): obj is ISelectable {\n  return (\n    isFocusableNode(obj) &&\n    typeof (obj as ISelectable).id === 'string' &&\n    typeof (obj as ISelectable).workspace === 'object' &&\n    typeof (obj as ISelectable).select === 'function' &&\n    typeof (obj as ISelectable).unselect === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.object\n\n/**\n * Complete a deep merge of all members of a source object with a target object.\n *\n * N.B. This is not a very sophisticated merge algorithm and does not\n * handle complex cases. Use with caution.\n *\n * @param target Target.\n * @param source Source.\n * @returns The resulting object.\n */\nexport function deepMerge(\n  target: AnyDuringMigration,\n  source: AnyDuringMigration,\n): AnyDuringMigration {\n  for (const x in source) {\n    if (source[x] !== null && Array.isArray(source[x])) {\n      target[x] = deepMerge(target[x] || [], source[x]);\n    } else 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 * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.common\n\nimport type {Block} from './block.js';\nimport {BlockDefinition, Blocks} from './blocks.js';\nimport * as browserEvents from './browser_events.js';\nimport type {Connection} from './connection.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {getFocusManager} from './focus_manager.js';\nimport {ISelectable, isSelectable} from './interfaces/i_selectable.js';\nimport {ShortcutRegistry} from './shortcut_registry.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/** Database of all workspaces. */\nconst WorkspaceDB_ = Object.create(null);\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 */\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 */\nexport function setMainWorkspace(workspace: Workspace) {\n  mainWorkspace = workspace;\n}\n\n/**\n * Returns the current selection.\n */\nexport function getSelected(): ISelectable | null {\n  const focused = getFocusManager().getFocusedNode();\n  if (focused && isSelectable(focused)) return focused;\n  return null;\n}\n\n/**\n * Sets the current selection.\n *\n * To clear the current selection, select another ISelectable or focus a\n * non-selectable (like the workspace root node).\n *\n * @param newSelection The new selection to make.\n * @internal\n */\nexport function setSelected(newSelection: ISelectable) {\n  getFocusManager().focusNode(newSelection);\n}\n\n/**\n * Fires a selection change event based on the new selection.\n *\n * This is only expected to be called by ISelectable implementations and should\n * always be called before updating the current selection state. It does not\n * change focus or selection state.\n *\n * @param newSelection The new selection.\n * @internal\n */\nexport function fireSelectedEvent(newSelection: ISelectable | null) {\n  const selected = getSelected();\n  const event = new (eventUtils.get(EventType.SELECTED))(\n    selected?.id ?? null,\n    newSelection?.id ?? null,\n    newSelection?.workspace.id ?? selected?.workspace.id ?? '',\n  );\n  eventUtils.fire(event);\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 */\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 */\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 */\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 */\nexport function getBlockTypeCounts(\n  block: Block,\n  opt_stripFollowing?: boolean,\n): {[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 */\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 */\nexport function createBlockDefinitionsFromJsonArray(\n  jsonArray: AnyDuringMigration[],\n): {[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      );\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 */\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(\n        `Block definition \"${type}\" overwrites previous definition.`,\n      );\n    }\n    Blocks[type] = definition;\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 * @internal\n * @param e Key down event.\n */\nexport function globalShortcutHandler(e: KeyboardEvent) {\n  // This would ideally just be a `focusedTree instanceof WorkspaceSvg`, but\n  // importing `WorkspaceSvg` (as opposed to just its type) causes cycles.\n  let workspace: WorkspaceSvg = getMainWorkspace() as WorkspaceSvg;\n  const focusedTree = getFocusManager().getFocusedTree();\n  for (const ws of getAllWorkspaces()) {\n    if (focusedTree === (ws as WorkspaceSvg)) {\n      workspace = ws as WorkspaceSvg;\n      break;\n    }\n  }\n\n  if (\n    browserEvents.isTargetInput(e) ||\n    !workspace ||\n    (workspace.rendered && !workspace.isFlyout && !workspace.isVisible())\n  ) {\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(workspace, e);\n}\n\nexport const TEST_ONLY = {defineBlocksWithJsonArrayInternal};\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.array\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 * @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 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Css\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 */\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 */\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 */\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  user-select: none;\n  -webkit-user-select: none;\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n  transition: transform .5s;\n}\n\n.blocklyEmboss {\n  filter: var(--blocklyEmbossFilter);\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:focus {\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}\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  border-top: 1px solid;\n  border-left: 1px solid;\n  border-top-left-radius: 4px;\n  border-color: inherit;\n}\n\n.blocklyHighlighted>.blocklyPath {\n  filter: var(--blocklyEmbossFilter);\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  cursor: grab;\n  cursor: -webkit-grab;\n}\n\n.blocklyDragging {\n  cursor: grabbing;\n  cursor: -webkit-grabbing;\n  /* Drag surface disables events to not block the toolbox, so we have to\n   * reenable them here for the cursor values to work. */\n  pointer-events: auto;\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  cursor: grabbing;\n  cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete,\n.blocklyDragging.blocklyDraggingDelete .blocklyField {\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.blocklyDisabledPattern>.blocklyPath {\n  fill: var(--blocklyDisabledPattern);\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.blocklyNonEditableField>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  user-select: none;\n  -ms-user-select: none;\n  -webkit-user-select: none;\n  cursor: inherit;\n}\n\n.blocklyIconGroup {\n  cursor: default;\n}\n\n.blocklyIconGroup:not(:hover):not(:focus),\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  height: 100%;\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/* Remove the increase and decrease arrows on the field number editor */\ninput.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,\ninput.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {\n  -webkit-appearance: none;\n  margin: 0;\n}\n\ninput[type=number] {\n  -moz-appearance: textfield;\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  pointer-events: none;\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  user-select: none;\n  -ms-user-select: none;\n  -webkit-user-select: none;\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:focus {\n  box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n  user-select: none;\n  -ms-user-select: none;\n  -webkit-user-select: none;\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  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/* 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.blocklyMenuSeparator {\n  background-color: #ccc;\n  height: 1px;\n  border: 0;\n  margin-left: 4px;\n  margin-right: 4px;\n}\n\n.blocklyBlockDragSurface, .blocklyAnimationLayer {\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  overflow: visible !important;\n  z-index: 80;\n  pointer-events: none;\n}\n\n.blocklyField {\n  cursor: default;\n}\n\n.blocklyInputField {\n  cursor: text;\n}\n\n.blocklyDragging .blocklyField,\n.blocklyDragging .blocklyIconGroup {\n  cursor: grabbing;\n}\n\n.blocklyActiveFocus:is(\n  .blocklyFlyout,\n  .blocklyWorkspace,\n  .blocklyField,\n  .blocklyPath,\n  .blocklyHighlightedConnectionPath,\n  .blocklyComment,\n  .blocklyBubble,\n  .blocklyIconGroup,\n  .blocklyTextarea\n) {\n  outline: none;\n}\n`;\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.style\n\nimport {Coordinate} from './coordinate.js';\nimport {Rect} from './rect.js';\nimport {Size} from './size.js';\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 */\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 */\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 (\n    (styles as AnyDuringMigration)[property] ||\n    styles.getPropertyValue(property)\n  );\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 */\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  );\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 */\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 */\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 */\nexport function scrollIntoContainerView(\n  element: Element,\n  container: Element,\n  opt_center?: boolean,\n) {\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 */\nexport function getContainerOffsetToScrollInto(\n  element: Element,\n  container: Element,\n  opt_center?: boolean,\n): 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 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.svgMath\n\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport {Coordinate} from './coordinate.js';\nimport {Rect} from './rect.js';\nimport * as style from './style.js';\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 */\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.includes('translate')) {\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 */\nexport function getInjectionDivXY(element: Element): Coordinate {\n  let x = 0;\n  let y = 0;\n  while (element) {\n    const xy = getRelativeXY(element);\n    x += xy.x;\n    y += xy.y;\n    const classes = element.getAttribute('class') || '';\n    if ((' ' + classes + ' ').includes(' injectionDiv ')) {\n      break;\n    }\n    element = element.parentNode as Element;\n  }\n  return new Coordinate(x, y);\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 * @internal\n */\nexport function getViewportBBox(): Rect {\n  // Pixels, in window coordinates.\n  const scrollOffset = style.getViewportPageOffset();\n  return new Rect(\n    scrollOffset.y,\n    document.documentElement.clientHeight + scrollOffset.y,\n    scrollOffset.x,\n    document.documentElement.clientWidth + scrollOffset.x,\n  );\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 */\nexport function getDocumentScroll(): Coordinate {\n  const el = document.documentElement;\n  const win = window;\n  return new Coordinate(\n    win.pageXOffset || el.scrollLeft,\n    win.pageYOffset || el.scrollTop,\n  );\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 */\nexport function screenToWsCoordinates(\n  ws: WorkspaceSvg,\n  screenCoordinates: Coordinate,\n): 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 = new Coordinate(\n    screenX - boundingRect.left,\n    screenY - boundingRect.top,\n  );\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 = Coordinate.difference(\n    clientOffsetPixels,\n    mainOffsetPixels,\n  );\n  // The position in main workspace coordinates.\n  const finalOffsetMainWs = finalOffsetPixels.scale(1 / ws.scale);\n  return finalOffsetMainWs;\n}\n\n/**\n * Converts workspace coordinates to screen coordinates.\n *\n * @param ws The workspace to get the coordinates out of.\n * @param workspaceCoordinates  The workspace coordinates to be converted\n *     to screen coordinates.\n * @returns The screen coordinates.\n */\nexport function wsToScreenCoordinates(\n  ws: WorkspaceSvg,\n  workspaceCoordinates: Coordinate,\n): Coordinate {\n  // Fix workspace scale vs browser scale.\n  const screenCoordinates = workspaceCoordinates.scale(ws.scale);\n  const screenX = screenCoordinates.x;\n  const screenY = screenCoordinates.y;\n\n  const injectionDiv = ws.getInjectionDiv();\n  const boundingRect = injectionDiv.getBoundingClientRect();\n  const mainOffset = ws.getOriginOffsetInPixels();\n\n  // Fix workspace origin vs browser origin.\n  return new Coordinate(\n    screenX + boundingRect.left + mainOffset.x,\n    screenY + boundingRect.top + mainOffset.y,\n  );\n}\n\nexport const TEST_ONLY = {\n  XY_REGEX,\n  XY_STYLE_REGEX,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.xml\n\nlet domParser: DOMParser = {\n  parseFromString: function () {\n    throw new Error(\n      'DOMParser was not found in the global scope and was not properly ' +\n        'injected using injectDependencies',\n    );\n  },\n};\n\nlet xmlSerializer: XMLSerializer = {\n  serializeToString: function () {\n    throw new Error(\n      'XMLSerializer was not foundin the global scope and was not properly ' +\n        'injected using injectDependencies',\n    );\n  },\n};\n\n/**\n * Injected dependencies.  By default these are just (and have the\n * same types as) the corresponding DOM Window properties, but the\n * Node.js wrapper for Blockly (see scripts/package/node/core.js)\n * calls injectDependencies to supply implementations from the jsdom\n * package instead.\n */\nlet {document, DOMParser, XMLSerializer} = globalThis;\nif (DOMParser) domParser = new DOMParser();\nif (XMLSerializer) xmlSerializer = new XMLSerializer();\n\n/**\n * Inject implementations of document, DOMParser and/or XMLSerializer\n * to use instead of the default ones.\n *\n * Used by the Node.js wrapper for Blockly (see\n * scripts/package/node/core.js) to supply implementations from the\n * jsdom package instead.\n *\n * While they may be set individually, it is normally the case that\n * all three will be sourced from the same JSDOM instance.  They MUST\n * at least come from the same copy of the jsdom package.  (Typically\n * this is hard to avoid satsifying this requirement, but it can be\n * inadvertently violated by using webpack to build multiple bundles\n * containing Blockly and jsdom, and then loading more than one into\n * the same JavaScript runtime.  See\n * https://github.com/google/blockly-samples/pull/1452#issuecomment-1364442135\n * for an example of how this happened.)\n *\n * @param dependencies Options object containing dependencies to set.\n */\nexport function injectDependencies(dependencies: {\n  document?: Document;\n  DOMParser?: typeof DOMParser;\n  XMLSerializer?: typeof XMLSerializer;\n}) {\n  ({\n    // Default to existing value if option not supplied.\n    document = document,\n    DOMParser = DOMParser,\n    XMLSerializer = XMLSerializer,\n  } = dependencies);\n\n  domParser = new DOMParser();\n  xmlSerializer = new XMLSerializer();\n}\n\n/**\n * Namespace for Blockly's XML.\n */\nexport const NAME_SPACE = 'https://developers.google.com/blockly/xml';\n\n// eslint-disable-next-line no-control-regex\nconst INVALID_CONTROL_CHARS = /[\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F]/g;\n\n/**\n * Create DOM element for XML.\n *\n * @param tagName Name of DOM element.\n * @returns New DOM element.\n */\nexport function createElement(tagName: string): Element {\n  return document.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 */\nexport function createTextNode(text: string): Text {\n  return document.createTextNode(text);\n}\n\n/**\n * Converts an XML string into a DOM structure.\n *\n * Control characters should be escaped. (But we will try to best-effort parse\n * unescaped characters.)\n *\n * Note that even when escaped, U+0000 will be parsed as U+FFFD (the\n * \"replacement character\") because U+0000 is never a valid XML character\n * (even in XML 1.1).\n * https://www.w3.org/TR/xml11/#charsets\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 */\nexport function textToDom(text: string): Element {\n  let doc = domParser.parseFromString(text, 'text/xml');\n  if (\n    doc &&\n    doc.documentElement &&\n    !doc.getElementsByTagName('parsererror').length\n  ) {\n    return doc.documentElement;\n  }\n\n  // Attempt to parse as HTML to deserialize control characters that were\n  // serialized before the serializer did proper escaping.\n  doc = domParser.parseFromString(text, 'text/html');\n  if (\n    doc &&\n    doc.body.firstChild &&\n    doc.body.firstChild.nodeName.toLowerCase() === 'xml'\n  ) {\n    return doc.body.firstChild as Element;\n  }\n\n  throw new Error(`DOMParser was unable to parse: ${text}`);\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 * Control characters are escaped using their decimal encodings. This includes\n * U+0000 even though it is technically never a valid XML character (even in\n * XML 1.1).\n * https://www.w3.org/TR/xml11/#charsets\n *\n * When decoded U+0000 will be parsed as U+FFFD (the \"replacement character\").\n *\n * @param dom A tree of XML nodes.\n * @returns Text representation.\n */\nexport function domToText(dom: Node): string {\n  return sanitizeText(xmlSerializer.serializeToString(dom));\n}\n\nfunction sanitizeText(text: string) {\n  return text.replace(\n    INVALID_CONTROL_CHARS,\n    (match) => `&#${match.charCodeAt(0)};`,\n  );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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 utilsXml from './xml.js';\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 */\nexport interface BlockInfo {\n  kind: string;\n  blockxml?: string | Node;\n  type?: string;\n  gap?: string | number;\n  disabled?: string | boolean;\n  disabledReasons?: string[];\n  enabled?: boolean;\n  id?: string;\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 */\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 */\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 */\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 */\nexport type ButtonOrLabelInfo = ButtonInfo | LabelInfo;\n\n/**\n * The information needed to create a category in the toolbox.\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  expanded?: string | boolean;\n}\n\n/**\n * The information needed to create a custom category.\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  expanded?: string | boolean;\n}\n\n/**\n * The information needed to create either a dynamic or static category.\n */\nexport type CategoryInfo = StaticCategoryInfo | DynamicCategoryInfo;\n\n/**\n * Any information that can be used to create an item in the toolbox.\n */\nexport type ToolboxItemInfo = FlyoutItemInfo | StaticCategoryInfo;\n\n/**\n * All the different types that can be displayed in a flyout.\n */\nexport type FlyoutItemInfo =\n  | BlockInfo\n  | SeparatorInfo\n  | ButtonInfo\n  | LabelInfo\n  | DynamicCategoryInfo;\n\n/**\n * The JSON definition of a toolbox.\n */\nexport interface ToolboxInfo {\n  kind?: string;\n  contents: ToolboxItemInfo[];\n}\n\n/**\n * An array holding flyout items.\n */\nexport type FlyoutItemInfoArray = FlyoutItemInfo[];\n\n/**\n * All of the different types that can create a toolbox.\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 */\nexport type FlyoutDefinition =\n  | FlyoutItemInfoArray\n  | NodeList\n  | ToolboxInfo\n  | 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 */\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 * @internal\n */\nexport function convertToolboxDefToJson(\n  toolboxDef: ToolboxDefinition | null,\n): 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 (\n      toolboxKind !== FLYOUT_TOOLBOX_KIND &&\n      toolboxKind !== CATEGORY_TOOLBOX_KIND\n    ) {\n      throw Error(\n        'Invalid toolbox kind ' +\n          toolboxKind +\n          '.' +\n          ' Please supply either ' +\n          FLYOUT_TOOLBOX_KIND +\n          ' or ' +\n          CATEGORY_TOOLBOX_KIND,\n      );\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 * @internal\n */\nexport function convertFlyoutDefToJsonArray(\n  flyoutDef: FlyoutDefinition | null,\n): 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 (\n    Array.isArray(flyoutDef) &&\n    flyoutDef.length > 0 &&\n    !(flyoutDef[0] as AnyDuringMigration).nodeType\n  ) {\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 * @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(\n    (item) => 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 * @internal\n */\nexport function isCategoryCollapsible(categoryInfo: CategoryInfo): boolean {\n  if (!categoryInfo || !(categoryInfo as AnyDuringMigration)['contents']) {\n    return false;\n  }\n\n  const categories = (categoryInfo as AnyDuringMigration)['contents'].filter(\n    function (item: AnyDuringMigration) {\n      return item['kind'].toUpperCase() === 'CATEGORY';\n    },\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(\n  toolboxDef: Node | Node[] | NodeList,\n): FlyoutItemInfoArray | 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.includes('css-')) {\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 */\nexport function parseToolboxTree(\n  toolboxDef: Element | null | string,\n): Element | null {\n  let parsedToolboxDef: Element | null = null;\n  if (toolboxDef) {\n    if (typeof toolboxDef === 'string') {\n      parsedToolboxDef = utilsXml.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 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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 * Enum for vertical positioning.\n *\n * @internal\n */\nexport enum verticalPosition {\n  TOP,\n  BOTTOM,\n}\n\n/**\n * Enum for horizontal positioning.\n *\n * @internal\n */\nexport enum horizontalPosition {\n  LEFT,\n  RIGHT,\n}\n\n/**\n * An object defining a horizontal and vertical positioning.\n *\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 * @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 * @internal\n */\nexport function getStartPositionRect(\n  position: Position,\n  size: Size,\n  horizontalPadding: number,\n  verticalPadding: number,\n  metrics: UiMetrics,\n  workspace: WorkspaceSvg,\n): 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 {\n    // position.horizontal === horizontalPosition.RIGHT\n    left =\n      metrics.absoluteMetrics.left +\n      metrics.viewMetrics.width -\n      size.width -\n      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 {\n    // position.vertical === verticalPosition.BOTTOM\n    top =\n      metrics.absoluteMetrics.top +\n      metrics.viewMetrics.height -\n      size.height -\n      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 * @internal\n */\nexport function getCornerOppositeToolbox(\n  workspace: WorkspaceSvg,\n  metrics: UiMetrics,\n): 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 = leftCorner\n    ? horizontalPosition.LEFT\n    : 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 * @internal\n */\nexport function bumpPositionRect(\n  startRect: Rect,\n  margin: number,\n  bumpDir: bumpDirection,\n  savedPositions: Rect[],\n): 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 {\n        // 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 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.serialization.registry\n\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport * as registry from '../registry.js';\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 */\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 */\nexport function unregister(name: string) {\n  registry.unregister(registry.Type.SERIALIZER, name);\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as eventUtils from '../events/utils.js';\nimport {ISerializer} from '../interfaces/i_serializer.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport {Size} from '../utils/size.js';\nimport {Workspace} from '../workspace.js';\nimport * as priorities from './priorities.js';\nimport * as serializationRegistry from './registry.js';\n\nexport interface State {\n  id?: string;\n  text?: string;\n  x?: number;\n  y?: number;\n  width?: number;\n  height?: number;\n  collapsed?: boolean;\n  editable?: boolean;\n  movable?: boolean;\n  deletable?: boolean;\n}\n\n/** Serializes the state of the given comment to JSON. */\nexport function save(\n  comment: WorkspaceComment,\n  {\n    addCoordinates = false,\n    saveIds = true,\n  }: {\n    addCoordinates?: boolean;\n    saveIds?: boolean;\n  } = {},\n): State {\n  const workspace = comment.workspace;\n  const state: State = Object.create(null);\n\n  state.height = comment.getSize().height;\n  state.width = comment.getSize().width;\n\n  if (saveIds) state.id = comment.id;\n  if (addCoordinates) {\n    const loc = comment.getRelativeToSurfaceXY();\n    state.x = workspace.RTL ? workspace.getWidth() - loc.x : loc.x;\n    state.y = loc.y;\n  }\n\n  if (comment.getText()) state.text = comment.getText();\n  if (comment.isCollapsed()) state.collapsed = true;\n  if (!comment.isOwnEditable()) state.editable = false;\n  if (!comment.isOwnMovable()) state.movable = false;\n  if (!comment.isOwnDeletable()) state.deletable = false;\n\n  return state;\n}\n\n/** Appends the comment defined by the given state to the given workspace. */\nexport function append(\n  state: State,\n  workspace: Workspace,\n  {recordUndo = false}: {recordUndo?: boolean} = {},\n): WorkspaceComment {\n  const prevRecordUndo = eventUtils.getRecordUndo();\n  eventUtils.setRecordUndo(recordUndo);\n\n  const comment = workspace.newComment(state.id);\n\n  if (state.text !== undefined) comment.setText(state.text);\n  if (state.x !== undefined || state.y !== undefined) {\n    const defaultLoc = comment.getRelativeToSurfaceXY();\n    let x = state.x ?? defaultLoc.x;\n    x = workspace.RTL ? workspace.getWidth() - x : x;\n    const y = state.y ?? defaultLoc.y;\n    comment.moveTo(new Coordinate(x, y));\n  }\n  if (state.width !== undefined || state.height) {\n    const defaultSize = comment.getSize();\n    comment.setSize(\n      new Size(\n        state.width ?? defaultSize.width,\n        state.height ?? defaultSize.height,\n      ),\n    );\n  }\n  if (state.collapsed !== undefined) comment.setCollapsed(state.collapsed);\n  if (state.editable !== undefined) comment.setEditable(state.editable);\n  if (state.movable !== undefined) comment.setMovable(state.movable);\n  if (state.deletable !== undefined) comment.setDeletable(state.deletable);\n\n  eventUtils.setRecordUndo(prevRecordUndo);\n\n  return comment;\n}\n\n// Alias to disambiguate saving within the serializer.\nconst saveComment = save;\n\n/** Serializer for saving and loading workspace comment state. */\nexport class WorkspaceCommentSerializer implements ISerializer {\n  priority = priorities.WORKSPACE_COMMENTS;\n\n  /**\n   * Returns the state of all workspace comments in the given workspace.\n   */\n  save(workspace: Workspace): State[] | null {\n    const commentStates = [];\n    for (const comment of workspace.getTopComments()) {\n      const state = saveComment(comment as AnyDuringMigration, {\n        addCoordinates: true,\n        saveIds: true,\n      });\n      if (state) commentStates.push(state);\n    }\n    return commentStates.length ? commentStates : null;\n  }\n\n  /**\n   * Deserializes the comments defined by the given state into the given\n   * workspace.\n   */\n  load(state: State[], workspace: Workspace) {\n    for (const commentState of state) {\n      append(commentState, workspace, {recordUndo: eventUtils.getRecordUndo()});\n    }\n  }\n\n  /** Disposes of any comments that exist on the given workspace. */\n  clear(workspace: Workspace) {\n    for (const comment of workspace.getTopComments()) {\n      comment.dispose();\n    }\n  }\n}\n\nserializationRegistry.register(\n  'workspaceComments',\n  new WorkspaceCommentSerializer(),\n);\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ICopyable, ICopyData} from '../interfaces/i_copyable.js';\nimport type {IPaster} from '../interfaces/i_paster.js';\nimport * as registry from '../registry.js';\n\n/**\n * Registers the given paster so that it cna be used for pasting.\n *\n * @param type The type of the paster to register, e.g. 'block', 'comment', etc.\n * @param paster The paster to register.\n */\nexport function register<U extends ICopyData, T extends ICopyable<U>>(\n  type: string,\n  paster: IPaster<U, T>,\n) {\n  registry.register(registry.Type.PASTER, type, paster);\n}\n\n/**\n * Unregisters the paster associated with the given type.\n *\n * @param type The type of the paster to unregister.\n */\nexport function unregister(type: string) {\n  registry.unregister(registry.Type.PASTER, type);\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {RenderedWorkspaceComment} from '../comments/rendered_workspace_comment.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {ICopyData} from '../interfaces/i_copyable.js';\nimport {IPaster} from '../interfaces/i_paster.js';\nimport * as commentSerialiation from '../serialization/workspace_comments.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\nimport * as registry from './registry.js';\n\nexport class WorkspaceCommentPaster\n  implements IPaster<WorkspaceCommentCopyData, RenderedWorkspaceComment>\n{\n  static TYPE = 'workspace-comment';\n\n  paste(\n    copyData: WorkspaceCommentCopyData,\n    workspace: WorkspaceSvg,\n    coordinate?: Coordinate,\n  ): RenderedWorkspaceComment | null {\n    const state = copyData.commentState;\n\n    if (coordinate) {\n      state['x'] = coordinate.x;\n      state['y'] = coordinate.y;\n    }\n\n    eventUtils.disable();\n    let comment;\n    try {\n      comment = commentSerialiation.append(\n        state,\n        workspace,\n      ) as RenderedWorkspaceComment;\n      moveCommentToNotConflict(comment);\n    } finally {\n      eventUtils.enable();\n    }\n\n    if (!comment) return null;\n\n    if (eventUtils.isEnabled()) {\n      eventUtils.fire(new (eventUtils.get(EventType.COMMENT_CREATE))(comment));\n    }\n    getFocusManager().focusNode(comment);\n    return comment;\n  }\n}\n\nfunction moveCommentToNotConflict(comment: RenderedWorkspaceComment) {\n  const workspace = comment.workspace;\n  const translateDistance = 30;\n  const coord = comment.getRelativeToSurfaceXY();\n  const offset = new Coordinate(0, 0);\n  // getRelativeToSurfaceXY is really expensive, so we want to cache this.\n  const otherCoords = workspace\n    .getTopComments(false)\n    .filter((otherComment) => otherComment.id !== comment.id)\n    .map((c) => c.getRelativeToSurfaceXY());\n\n  while (\n    commentOverlapsOtherExactly(Coordinate.sum(coord, offset), otherCoords)\n  ) {\n    offset.translate(\n      workspace.RTL ? -translateDistance : translateDistance,\n      translateDistance,\n    );\n  }\n\n  comment.moveTo(Coordinate.sum(coord, offset));\n}\n\nfunction commentOverlapsOtherExactly(\n  coord: Coordinate,\n  otherCoords: Coordinate[],\n): boolean {\n  return otherCoords.some(\n    (otherCoord) =>\n      Math.abs(otherCoord.x - coord.x) <= 1 &&\n      Math.abs(otherCoord.y - coord.y) <= 1,\n  );\n}\n\nexport interface WorkspaceCommentCopyData extends ICopyData {\n  commentState: commentSerialiation.State;\n}\n\nregistry.register(WorkspaceCommentPaster.TYPE, new WorkspaceCommentPaster());\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.aria\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 */\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  // ARIA role for a visual separator in e.g. a menu.\n  SEPARATOR = 'separator',\n\n  // ARIA role for a live region providing information.\n  STATUS = 'status',\n}\n\n/**\n * ARIA states and properties.\n * Copied from Closure's goog.a11y.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  // ARIA property for live region chattiness.\n  // Value: one of {polite, assertive, off}.\n  LIVE = 'live',\n\n  // ARIA property for removing elements from the accessibility tree.\n  // Value: one of {true, false, undefined}.\n  HIDDEN = 'hidden',\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 */\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 */\nexport function setState(\n  element: Element,\n  stateName: State,\n  value: string | boolean | number | string[],\n) {\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 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface ISerializable {\n  /**\n   * @param doFullSerialization If true, this signals that any backing data\n   *     structures used by this ISerializable should also be serialized. This\n   *     is used for copy-paste.\n   * @returns a JSON serializable value that records the ISerializable's state.\n   */\n  saveState(doFullSerialization: boolean): any;\n\n  /**\n   * Takes in a JSON serializable value and sets the ISerializable's state\n   * based on that.\n   *\n   * @param state The state to apply to the ISerializable.\n   */\n  loadState(state: any): void;\n}\n\n/** Type guard that checks whether the given object is a ISerializable. */\nexport function isSerializable(obj: any): obj is ISerializable {\n  return (\n    obj &&\n    typeof obj.saveState === 'function' &&\n    typeof obj.loadState === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BlockSvg} from './block_svg.js';\nimport * as eventUtils from './events/utils.js';\nimport * as userAgent from './utils/useragent.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/** The set of all blocks in need of rendering which don't have parents. */\nconst rootBlocks = new Set<BlockSvg>();\n\n/** The set of all blocks in need of rendering. */\nconst dirtyBlocks = new WeakSet<BlockSvg>();\n\n/** A map from queued blocks to the event group from when they were queued. */\nconst eventGroups = new WeakMap<BlockSvg, string>();\n\n/**\n * The promise which resolves after the current set of renders is completed. Or\n * null if there are no queued renders.\n *\n * Stored so that we can return it from afterQueuedRenders.\n */\nlet afterRendersPromise: Promise<void> | null = null;\n\n/** The function to call to resolve the `afterRendersPromise`. */\nlet afterRendersResolver: (() => void) | null = null;\n\n/**\n * The ID of the current animation frame request. Used to cancel the request\n * if necessary.\n */\nlet animationRequestId = 0;\n\n/**\n * Registers that the given block and all of its parents need to be rerendered,\n * and registers a callback to do so after a delay, to allowf or batching.\n *\n * @param block The block to rerender.\n * @returns A promise that resolves after the currently queued renders have been\n *     completed. Used for triggering other behavior that relies on updated\n *     size/position location for the block.\n * @internal\n */\nexport function queueRender(block: BlockSvg): Promise<void> {\n  queueBlock(block);\n\n  if (alwaysImmediatelyRender()) {\n    doRenders();\n    return Promise.resolve();\n  }\n\n  if (!afterRendersPromise) {\n    afterRendersPromise = new Promise((resolve) => {\n      afterRendersResolver = resolve;\n      animationRequestId = window.requestAnimationFrame(() => {\n        doRenders();\n        resolve();\n      });\n    });\n  }\n  return afterRendersPromise;\n}\n\n/**\n * @returns A promise that resolves after the currently queued renders have\n *     been completed.\n */\nexport function finishQueuedRenders(): Promise<void> {\n  // If there are no queued renders, return a resolved promise so `then`\n  // callbacks trigger immediately.\n  return afterRendersPromise ? afterRendersPromise : Promise.resolve();\n}\n\n/**\n * Triggers an immediate render of all queued renders. Should only be used in\n * cases where queueing renders breaks functionality + backwards compatibility\n * (such as rendering icons).\n *\n * @param workspace If provided, only rerender blocks in this workspace.\n *\n * @internal\n */\nexport function triggerQueuedRenders(workspace?: WorkspaceSvg) {\n  if (!workspace) window.cancelAnimationFrame(animationRequestId);\n  doRenders(workspace);\n  if (!workspace && afterRendersResolver) afterRendersResolver();\n}\n\n/**\n * @returns True if we should always trigger an immediate render.\n *     Some platforms don't properly support `requestAnimationFrame`, so to\n *     avoid glitchiness, we give up the performance improvements.\n */\nfunction alwaysImmediatelyRender() {\n  return userAgent.JavaFx;\n}\n\n/**\n * Adds the given block and its parents to the render queue. Adds the root block\n * to the list of root blocks.\n *\n * @param block The block to queue.\n */\nfunction queueBlock(block: BlockSvg) {\n  dirtyBlocks.add(block);\n  eventGroups.set(block, eventUtils.getGroup());\n  const parent = block.getParent();\n  if (parent) {\n    queueBlock(parent);\n  } else {\n    rootBlocks.add(block);\n  }\n}\n\n/**\n * Rerenders all of the blocks in the queue.\n *\n * @param workspace If provided, only rerender blocks in this workspace.\n */\nfunction doRenders(workspace?: WorkspaceSvg) {\n  const workspaces = workspace\n    ? new Set([workspace])\n    : new Set([...rootBlocks].map((block) => block.workspace));\n  const blocks = [...rootBlocks]\n    .filter(shouldRenderRootBlock)\n    .filter((b) => workspaces.has(b.workspace));\n  for (const block of blocks) {\n    renderBlock(block);\n  }\n  for (const workspace of workspaces) {\n    workspace.resizeContents();\n  }\n  for (const block of blocks) {\n    const blockOrigin = block.getRelativeToSurfaceXY();\n    block.updateComponentLocations(blockOrigin);\n  }\n  for (const block of blocks) {\n    const oldGroup = eventUtils.getGroup();\n    const newGroup = eventGroups.get(block);\n    if (newGroup) eventUtils.setGroup(newGroup);\n\n    block.bumpNeighbours();\n\n    eventUtils.setGroup(oldGroup);\n  }\n\n  for (const block of blocks) {\n    dequeueBlock(block);\n  }\n  if (!workspace) afterRendersPromise = null;\n}\n\n/** Removes the given block and children from the render queue. */\nfunction dequeueBlock(block: BlockSvg) {\n  rootBlocks.delete(block);\n  dirtyBlocks.delete(block);\n  eventGroups.delete(block);\n  for (const child of block.getChildren(false)) {\n    dequeueBlock(child);\n  }\n}\n\n/**\n * Returns true if the block should be rendered.\n *\n * No need to render dead blocks.\n *\n * No need to render blocks with parents. A render for the block may have been\n * queued, and the block was connected to a parent, so it is no longer a\n * root block. Rendering will be triggered through the real root block.\n */\nfunction shouldRenderRootBlock(block: BlockSvg): boolean {\n  return !block.isDisposed() && !block.getParent();\n}\n\n/**\n * Recursively renders all of the dirty children of the given block, and\n * then renders the block.\n *\n * @param block The block to rerender.\n */\nfunction renderBlock(block: BlockSvg) {\n  if (!dirtyBlocks.has(block)) return;\n  if (!block.initialized) return;\n  for (const child of block.getChildren(false)) {\n    renderBlock(child);\n  }\n  block.renderEfficiently();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.dialog\n\nimport type {ToastOptions} from './toast.js';\nimport {Toast} from './toast.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\nconst defaultAlert = function (message: string, opt_callback?: () => void) {\n  window.alert(message);\n  if (opt_callback) {\n    opt_callback();\n  }\n};\n\nlet alertImplementation = defaultAlert;\n\nconst defaultConfirm = function (\n  message: string,\n  callback: (result: boolean) => void,\n) {\n  callback(window.confirm(message));\n};\n\nlet confirmImplementation = defaultConfirm;\n\nconst defaultPrompt = function (\n  message: string,\n  defaultValue: string,\n  callback: (result: string | null) => void,\n) {\n  // NOTE TO DEVELOPER: Ephemeral focus doesn't need to be taken for the native\n  // window prompt since it prevents focus from changing while open.\n  callback(window.prompt(message, defaultValue));\n};\n\nlet promptImplementation = defaultPrompt;\n\nconst defaultToast = Toast.show.bind(Toast);\nlet toastImplementation = defaultToast;\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 */\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, or undefined to restore the\n *     default implementation.\n * @see Blockly.dialog.alert\n */\nexport function setAlert(\n  alertFunction: (\n    message: string,\n    callback?: () => void,\n  ) => void = defaultAlert,\n) {\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 */\nexport function confirm(message: string, callback: (result: boolean) => void) {\n  confirmImplementation(message, callback);\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, or undefined to restore the\n *     default implementation.\n * @see Blockly.dialog.confirm\n */\nexport function setConfirm(\n  confirmFunction: (\n    message: string,\n    callback: (result: boolean) => void,\n  ) => void = defaultConfirm,\n) {\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 */\nexport function prompt(\n  message: string,\n  defaultValue: string,\n  callback: (result: string | null) => void,\n) {\n  promptImplementation(message, defaultValue, callback);\n}\n\n/**\n * Sets the function to be run when Blockly.dialog.prompt() is called.\n *\n * **Important**: When overridding this, be aware that non-native prompt\n * experiences may require managing ephemeral focus in FocusManager. This isn't\n * needed for the native window prompt because it prevents focus from being\n * changed while open.\n *\n * @param promptFunction The function to be run, or undefined to restore the\n *     default implementation.\n * @see Blockly.dialog.prompt\n */\nexport function setPrompt(\n  promptFunction: (\n    message: string,\n    defaultValue: string,\n    callback: (result: string | null) => void,\n  ) => void = defaultPrompt,\n) {\n  promptImplementation = promptFunction;\n}\n\n/**\n * Displays a temporary notification atop the workspace. Blockly provides a\n * default toast implementation, but developers may provide their own via\n * setToast. For simple appearance customization, CSS should be sufficient.\n *\n * @param workspace The workspace to display the toast notification atop.\n * @param options Configuration options for the notification, including its\n *     message and duration.\n */\nexport function toast(workspace: WorkspaceSvg, options: ToastOptions) {\n  toastImplementation(workspace, options);\n}\n\n/**\n * Sets the function to be run when Blockly.dialog.toast() is called.\n *\n * @param toastFunction The function to be run, or undefined to restore the\n *     default implementation.\n * @see Blockly.dialog.toast\n */\nexport function setToast(\n  toastFunction: (\n    workspace: WorkspaceSvg,\n    options: ToastOptions,\n  ) => void = defaultToast,\n) {\n  toastImplementation = toastFunction;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Legacy means of representing a procedure signature. The elements are\n * respectively: name, parameter names, and whether it has a return value.\n */\nexport type ProcedureTuple = [string, string[], boolean];\n\n/**\n * Procedure block type.\n *\n * @internal\n */\nexport interface ProcedureBlock {\n  getProcedureCall: () => string;\n  renameProcedure: (p1: string, p2: string) => void;\n  getProcedureDef: () => ProcedureTuple;\n}\n\n/** @internal */\nexport interface LegacyProcedureDefBlock {\n  getProcedureDef: () => ProcedureTuple;\n}\n\n/** @internal */\nexport function isLegacyProcedureDefBlock(\n  obj: any,\n): obj is LegacyProcedureDefBlock {\n  return obj && typeof obj.getProcedureDef === 'function';\n}\n\n/** @internal */\nexport interface LegacyProcedureCallBlock {\n  getProcedureCall: () => string;\n  renameProcedure: (p1: string, p2: string) => void;\n}\n\n/** @internal */\nexport function isLegacyProcedureCallBlock(\n  obj: any,\n): obj is LegacyProcedureCallBlock {\n  return (\n    obj &&\n    typeof obj.getProcedureCall === 'function' &&\n    typeof obj.renameProcedure === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {IParameterModel} from './i_parameter_model.js';\nimport type {IVariableModel, IVariableState} from './i_variable_model.js';\n\n/** Interface for a parameter model that holds a variable model. */\nexport interface IVariableBackedParameterModel extends IParameterModel {\n  /** Returns the variable model held by this type. */\n  getVariableModel(): IVariableModel<IVariableState>;\n}\n\n/**\n * Returns whether the given object is a variable holder or not.\n */\nexport function isVariableBackedParameterModel(\n  param: IParameterModel,\n): param is IVariableBackedParameterModel {\n  return (param as any).getVariableModel !== undefined;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.deprecation\n\n// Set of previously-emitted warnings.\nconst previousWarnings = new Set();\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 * @internal\n */\nexport function warn(\n  name: string,\n  deprecationDate: string,\n  deletionDate: string,\n  opt_use?: string,\n) {\n  let msg =\n    name +\n    ' was deprecated in ' +\n    deprecationDate +\n    ' and will be deleted in ' +\n    deletionDate +\n    '.';\n  if (opt_use) {\n    msg += '\\nUse ' + opt_use + ' instead.';\n  }\n\n  // Don't log deprecation warnings multiple times.\n  if (previousWarnings.has(msg)) {\n    return;\n  }\n\n  previousWarnings.add(msg);\n  console.warn(msg);\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Variables\n\nimport type {Block} from './block.js';\nimport {Blocks} from './blocks.js';\nimport * as dialog from './dialog.js';\nimport {isLegacyProcedureDefBlock} from './interfaces/i_legacy_procedure_blocks.js';\nimport {isVariableBackedParameterModel} from './interfaces/i_variable_backed_parameter_model.js';\nimport {IVariableModel, IVariableState} from './interfaces/i_variable_model.js';\nimport {Msg} from './msg.js';\nimport * as deprecation from './utils/deprecation.js';\nimport type {BlockInfo, FlyoutItemInfo} from './utils/toolbox.js';\nimport * as utilsXml from './utils/xml.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\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 */\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 *\n * To get a list of all variables on a workspace, including unused variables,\n * call getAllVariables.\n *\n * @param ws The workspace to search for variables.\n * @returns Array of variable models.\n */\nexport function allUsedVarModels(\n  ws: Workspace,\n): IVariableModel<IVariableState>[] {\n  const blocks = ws.getAllBlocks(false);\n  const variables = new Set<IVariableModel<IVariableState>>();\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 *\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 */\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 * Internal wrapper that returns the contents of the variables category.\n *\n * @internal\n * @param workspace The workspace to populate variable blocks for.\n */\nexport function internalFlyoutCategory(\n  workspace: WorkspaceSvg,\n): FlyoutItemInfo[] {\n  return flyoutCategory(workspace, false);\n}\n\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml: true,\n): Element[];\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml: false,\n): FlyoutItemInfo[];\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 * @param useXml True to return the contents as XML, false to use JSON.\n * @returns List of flyout contents as either XML or JSON.\n */\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml = true,\n): Element[] | FlyoutItemInfo[] {\n  if (!Blocks['variables_set'] && !Blocks['variables_get']) {\n    console.warn(\n      'There are no variable blocks, but there is a variable category.',\n    );\n  }\n\n  if (useXml) {\n    deprecation.warn(\n      'The XML return value of Blockly.Variables.flyoutCategory()',\n      'v12',\n      'v13',\n      'the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead.',\n    );\n    return xmlFlyoutCategory(workspace);\n  }\n\n  workspace.registerButtonCallback('CREATE_VARIABLE', function (button) {\n    createVariableButtonHandler(button.getTargetWorkspace());\n  });\n\n  return [\n    {\n      'kind': 'button',\n      'text': '%{BKY_NEW_VARIABLE}',\n      'callbackkey': 'CREATE_VARIABLE',\n    },\n    ...jsonFlyoutCategoryBlocks(\n      workspace,\n      workspace.getVariableMap().getVariablesOfType(''),\n      true,\n    ),\n  ];\n}\n\n/**\n * Returns the JSON definition for a variable field.\n *\n * @param variable The variable the field should reference.\n * @returns JSON for a variable field.\n */\nfunction generateVariableFieldJson(variable: IVariableModel<IVariableState>) {\n  return {\n    'VAR': {\n      'name': variable.getName(),\n      'type': variable.getType(),\n    },\n  };\n}\n\n/**\n * Construct the blocks required by the flyout for the variable category.\n *\n * @internal\n * @param workspace The workspace containing variables.\n * @param variables List of variables to create blocks for.\n * @param includeChangeBlocks True to include `change x by _` blocks.\n * @param getterType The type of the variable getter block to generate.\n * @param setterType The type of the variable setter block to generate.\n * @returns JSON list of blocks.\n */\nexport function jsonFlyoutCategoryBlocks(\n  workspace: Workspace,\n  variables: IVariableModel<IVariableState>[],\n  includeChangeBlocks: boolean,\n  getterType = 'variables_get',\n  setterType = 'variables_set',\n): BlockInfo[] {\n  includeChangeBlocks &&= Blocks['math_change'];\n\n  const blocks = [];\n  const mostRecentVariable = variables.slice(-1)[0];\n  if (mostRecentVariable) {\n    // Show one setter block, with the name of the most recently created variable.\n    if (Blocks[setterType]) {\n      blocks.push({\n        kind: 'block',\n        type: setterType,\n        gap: includeChangeBlocks ? 8 : 24,\n        fields: generateVariableFieldJson(mostRecentVariable),\n      });\n    }\n\n    if (includeChangeBlocks) {\n      blocks.push({\n        'kind': 'block',\n        'type': 'math_change',\n        'gap': Blocks[getterType] ? 20 : 8,\n        'fields': generateVariableFieldJson(mostRecentVariable),\n        'inputs': {\n          'DELTA': {\n            'shadow': {\n              'type': 'math_number',\n              'fields': {\n                'NUM': 1,\n              },\n            },\n          },\n        },\n      });\n    }\n  }\n\n  if (Blocks[getterType]) {\n    // Show one getter block for each variable, sorted in alphabetical order.\n    blocks.push(\n      ...variables.sort(compareByName).map((variable) => {\n        return {\n          'kind': 'block',\n          'type': getterType,\n          'gap': 8,\n          'fields': generateVariableFieldJson(variable),\n        };\n      }),\n    );\n  }\n\n  return blocks;\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 */\nfunction xmlFlyoutCategory(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 */\nexport function flyoutCategoryBlocks(workspace: Workspace): Element[] {\n  const variableModelList = workspace.getVariableMap().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 = utilsXml.textToDom(\n        '<value name=\"DELTA\">' +\n          '<shadow type=\"math_number\">' +\n          '<field name=\"NUM\">1</field>' +\n          '</shadow>' +\n          '</value>',\n      );\n      block.appendChild(value);\n      xmlList.push(block);\n    }\n\n    if (Blocks['variables_get']) {\n      variableModelList.sort(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\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 */\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),\n    workspace\n      .getVariableMap()\n      .getAllVariables()\n      .map((v) => v.getName()),\n  );\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 */\nexport function generateUniqueNameFromOptions(\n  startChar: string,\n  usedNames: string[],\n): 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  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      break;\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  return potName;\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 */\nexport function createVariableButtonHandler(\n  workspace: Workspace,\n  opt_callback?: (p1?: string | null) => void,\n  opt_type?: string,\n) {\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        // User canceled prompt.\n        if (opt_callback) opt_callback(null);\n        return;\n      }\n\n      const existing = nameUsedWithAnyType(text, workspace);\n      if (!existing) {\n        // No conflict\n        workspace.getVariableMap().createVariable(text, type);\n        if (opt_callback) opt_callback(text);\n        return;\n      }\n\n      let msg;\n      if (existing.getType() === type) {\n        msg = Msg['VARIABLE_ALREADY_EXISTS'].replace('%1', existing.getName());\n      } else {\n        msg = Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE'];\n        msg = msg\n          .replace('%1', existing.getName())\n          .replace('%2', existing.getType());\n      }\n      dialog.alert(msg, function () {\n        promptAndCheckWithAlert(text);\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 */\nexport function renameVariable(\n  workspace: Workspace,\n  variable: IVariableModel<IVariableState>,\n  opt_callback?: (p1?: string | null) => void,\n) {\n  // This function needs to be named so it can be called recursively.\n  function promptAndCheckWithAlert(defaultName: string) {\n    const promptText = Msg['RENAME_VARIABLE_TITLE'].replace(\n      '%1',\n      variable.getName(),\n    );\n    promptName(promptText, defaultName, function (newName) {\n      if (!newName) {\n        // User canceled prompt.\n        if (opt_callback) opt_callback(null);\n        return;\n      }\n\n      const existing = nameUsedWithOtherType(\n        newName,\n        variable.getType(),\n        workspace,\n      );\n      const procedure = nameUsedWithConflictingParam(\n        variable.getName(),\n        newName,\n        workspace,\n      );\n      if (!existing && !procedure) {\n        // No conflict.\n        workspace.getVariableMap().renameVariable(variable, newName);\n        if (opt_callback) opt_callback(newName);\n        return;\n      }\n\n      let msg = '';\n      if (existing) {\n        msg = Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE']\n          .replace('%1', existing.getName())\n          .replace('%2', existing.getType());\n      } else if (procedure) {\n        msg = Msg['VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER']\n          .replace('%1', newName)\n          .replace('%2', procedure);\n      }\n      dialog.alert(msg, function () {\n        promptAndCheckWithAlert(newName);\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 */\nexport function promptName(\n  promptText: string,\n  defaultText: string,\n  callback: (p1: string | null) => void,\n) {\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,\n  type: string,\n  workspace: Workspace,\n): IVariableModel<IVariableState> | null {\n  const allVariables = workspace.getVariableMap().getAllVariables();\n\n  name = name.toLowerCase();\n  for (let i = 0, variable; (variable = allVariables[i]); i++) {\n    if (\n      variable.getName().toLowerCase() === name &&\n      variable.getType() !== type\n    ) {\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 */\nexport function nameUsedWithAnyType(\n  name: string,\n  workspace: Workspace,\n): IVariableModel<IVariableState> | 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.getName().toLowerCase() === name) {\n      return variable;\n    }\n  }\n  return null;\n}\n\n/**\n * Returns the name of the procedure with a conflicting parameter name, or null\n * if one does not exist.\n *\n * This checks the procedure map if it contains models, and the legacy procedure\n * blocks otherwise.\n *\n * @param oldName The old name of the variable.\n * @param newName The proposed name of the variable.\n * @param workspace The workspace to search for conflicting parameters.\n * @internal\n */\nexport function nameUsedWithConflictingParam(\n  oldName: string,\n  newName: string,\n  workspace: Workspace,\n): string | null {\n  return workspace.getProcedureMap().getProcedures().length\n    ? checkForConflictingParamWithProcedureModels(oldName, newName, workspace)\n    : checkForConflictingParamWithLegacyProcedures(oldName, newName, workspace);\n}\n\n/**\n * Returns the name of the procedure model with a conflicting param name, or\n * null if one does not exist.\n */\nfunction checkForConflictingParamWithProcedureModels(\n  oldName: string,\n  newName: string,\n  workspace: Workspace,\n): string | null {\n  oldName = oldName.toLowerCase();\n  newName = newName.toLowerCase();\n\n  const procedures = workspace.getProcedureMap().getProcedures();\n  for (const procedure of procedures) {\n    const params = procedure\n      .getParameters()\n      .filter(isVariableBackedParameterModel)\n      .map((param) => param.getVariableModel().getName());\n    if (!params) continue;\n    const procHasOld = params.some((param) => param.toLowerCase() === oldName);\n    const procHasNew = params.some((param) => param.toLowerCase() === newName);\n    if (procHasOld && procHasNew) return procedure.getName();\n  }\n  return null;\n}\n\n/**\n * Returns the name of the procedure block with a conflicting param name, or\n * null if one does not exist.\n */\nfunction checkForConflictingParamWithLegacyProcedures(\n  oldName: string,\n  newName: string,\n  workspace: Workspace,\n): string | null {\n  oldName = oldName.toLowerCase();\n  newName = newName.toLowerCase();\n\n  const blocks = workspace.getAllBlocks(false);\n  for (const block of blocks) {\n    if (!isLegacyProcedureDefBlock(block)) continue;\n    const def = block.getProcedureDef();\n    const params = def[1];\n    const blockHasOld = params.some((param) => param.toLowerCase() === oldName);\n    const blockHasNew = params.some((param) => param.toLowerCase() === newName);\n    if (blockHasOld && blockHasNew) return def[0];\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 */\nexport function generateVariableFieldDom(\n  variableModel: IVariableModel<IVariableState>,\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.getType());\n  const name = utilsXml.createTextNode(variableModel.getName());\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 */\nexport function getOrCreateVariablePackage(\n  workspace: Workspace,\n  id: string | null,\n  opt_name?: string,\n  opt_type?: string,\n): IVariableModel<IVariableState> {\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 */\nexport function getVariable(\n  workspace: Workspace,\n  id: string | null,\n  opt_name?: string,\n  opt_type?: string,\n): IVariableModel<IVariableState> | 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,\n  id: string | null,\n  opt_name?: string,\n  opt_type?: string,\n): IVariableModel<IVariableState> {\n  const variableMap = workspace.getVariableMap();\n  const potentialVariableMap = workspace.getPotentialVariableMap();\n  // Variables without names get uniquely named for this workspace.\n  if (!opt_name) {\n    const ws = workspace.isFlyout\n      ? (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(\n      opt_name,\n      opt_type,\n      id ?? undefined,\n    );\n  } else {\n    // In the main workspace, create a real variable.\n    variable = variableMap.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 * @internal\n */\nexport function getAddedVariables(\n  workspace: Workspace,\n  originalVariables: IVariableModel<IVariableState>[],\n): IVariableModel<IVariableState>[] {\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.includes(variable)) {\n        addedVariables.push(variable);\n      }\n    }\n  }\n  return addedVariables;\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 */\nexport function compareByName(\n  var1: IVariableModel<IVariableState>,\n  var2: IVariableModel<IVariableState>,\n): number {\n  return var1\n    .getName()\n    .localeCompare(var2.getName(), undefined, {sensitivity: 'base'});\n}\n\n/**\n * Find all the uses of a named variable.\n *\n * @param workspace The workspace to search for the variable.\n * @param id ID of the variable to find.\n * @returns Array of block usages.\n */\nexport function getVariableUsesById(workspace: Workspace, id: string): Block[] {\n  const uses = [];\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    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 * Delete a variable and all of its uses from the given workspace. May prompt\n * the user for confirmation.\n *\n * @param workspace The workspace from which to delete the variable.\n * @param variable The variable to delete.\n * @param triggeringBlock The block from which this deletion was triggered, if\n *     any. Used to exclude it from checking and warning about blocks\n *     referencing the variable being deleted.\n */\nexport function deleteVariable(\n  workspace: Workspace,\n  variable: IVariableModel<IVariableState>,\n  triggeringBlock?: Block,\n) {\n  // Check whether this variable is a function parameter before deleting.\n  const variableName = variable.getName();\n  const uses = getVariableUsesById(workspace, variable.getId());\n  for (let i = uses.length - 1; i >= 0; i--) {\n    const block = uses[i];\n    if (\n      block.type === 'procedures_defnoreturn' ||\n      block.type === 'procedures_defreturn'\n    ) {\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    if (block === triggeringBlock) {\n      uses.splice(i, 1);\n    }\n  }\n\n  if ((triggeringBlock && uses.length) || uses.length > 1) {\n    // Confirm before deleting multiple blocks.\n    const confirmText = Msg['DELETE_VARIABLE_CONFIRMATION']\n      .replace(\n        '%1',\n        String(\n          uses.length +\n            (triggeringBlock && !triggeringBlock.workspace.isFlyout ? 1 : 0),\n        ),\n      )\n      .replace('%2', variableName);\n    dialog.confirm(confirmText, (ok) => {\n      if (ok && variable) {\n        workspace.getVariableMap().deleteVariable(variable);\n      }\n    });\n  } else {\n    // No confirmation necessary when the block that triggered the deletion is\n    // the only block referencing this variable or if only one block referencing\n    // this variable exists and the deletion was triggered programmatically.\n    workspace.getVariableMap().deleteVariable(variable);\n  }\n}\n\nexport const TEST_ONLY = {\n  generateUniqueNameInternal,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.serialization.blocks\n\nimport type {Block} from '../block.js';\nimport type {BlockSvg} from '../block_svg.js';\nimport type {Connection} from '../connection.js';\nimport {MANUALLY_DISABLED} from '../constants.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport {inputTypes} from '../inputs/input_types.js';\nimport {isSerializable} from '../interfaces/i_serializable.js';\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport type {\n  IVariableModel,\n  IVariableState,\n} from '../interfaces/i_variable_model.js';\nimport * as registry from '../registry.js';\nimport * as renderManagement from '../render_management.js';\nimport * as utilsXml from '../utils/xml.js';\nimport * as Variables from '../variables.js';\nimport type {Workspace} from '../workspace.js';\nimport * as Xml from '../xml.js';\nimport {\n  BadConnectionCheck,\n  MissingBlockType,\n  MissingConnection,\n  RealChildOfShadow,\n  UnregisteredIcon,\n} from './exceptions.js';\nimport * as priorities from './priorities.js';\nimport * as serializationRegistry from './registry.js';\n\n// TODO(#5160): Remove this once lint is fixed.\n\n/**\n * Represents the state of a connection.\n */\nexport interface ConnectionState {\n  shadow?: State;\n  block?: State;\n}\n\n/**\n * Represents the state of a given block.\n */\nexport interface State {\n  type: string;\n  id?: string;\n  x?: number;\n  y?: number;\n  collapsed?: boolean;\n  deletable?: boolean;\n  movable?: boolean;\n  editable?: boolean;\n  enabled?: boolean;\n  disabledReasons?: string[];\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 */\nexport function save(\n  block: Block,\n  {\n    addCoordinates = false,\n    addInputBlocks = true,\n    addNextBlocks = true,\n    doFullSerialization = true,\n    saveIds = true,\n  }: {\n    addCoordinates?: boolean;\n    addInputBlocks?: boolean;\n    addNextBlocks?: boolean;\n    doFullSerialization?: boolean;\n    saveIds?: boolean;\n  } = {},\n): State | null {\n  if (block.isInsertionMarker()) {\n    return null;\n  }\n  const state = {\n    'type': block.type,\n    'id': saveIds ? block.id : undefined,\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, doFullSerialization);\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, doFullSerialization);\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(\n      block,\n      state as AnyDuringMigration,\n      doFullSerialization,\n      saveIds,\n    );\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(\n      block,\n      state as AnyDuringMigration,\n      doFullSerialization,\n      saveIds,\n    );\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['disabledReasons'] = Array.from(block.getDisabledReasons());\n  }\n  if (!block.isOwnDeletable()) {\n    state['deletable'] = false;\n  }\n  if (!block.isOwnMovable()) {\n    state['movable'] = false;\n  }\n  if (!block.isOwnEditable()) {\n    state['editable'] = false;\n  }\n  if (\n    block.inputsInline !== undefined &&\n    block.inputsInline !== block.inputsInlineDefault\n  ) {\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/**\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 * @param doFullSerialization Whether or not to serialize the full state of the\n *     extra state (rather than possibly saving a reference to some state).\n */\nfunction saveExtraState(\n  block: Block,\n  state: State,\n  doFullSerialization: boolean,\n) {\n  if (block.saveExtraState) {\n    const extraState = block.saveExtraState(doFullSerialization);\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'] = Xml.domToText(extraState).replace(\n        ' xmlns=\"https://developers.google.com/blockly/xml\"',\n        '',\n      );\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 * @param doFullSerialization Whether or not to serialize the full state of the\n *     icon (rather than possibly saving a reference to some state).\n */\nfunction saveIcons(block: Block, state: State, doFullSerialization: boolean) {\n  const icons = Object.create(null);\n  for (const icon of block.getIcons()) {\n    if (isSerializable(icon)) {\n      const state = icon.saveState(doFullSerialization);\n      if (state) icons[icon.getType().toString()] = state;\n    }\n  }\n\n  if (Object.keys(icons).length) {\n    state['icons'] = icons;\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 (const field of block.getFields()) {\n    if (field.isSerializable()) {\n      fields[field.name!] = field.saveState(doFullSerialization);\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,\n  state: State,\n  doFullSerialization: boolean,\n  saveIds: boolean,\n) {\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.connection) continue;\n    const connectionState = saveConnection(\n      input.connection as Connection,\n      doFullSerialization,\n      saveIds,\n    );\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,\n  state: State,\n  doFullSerialization: boolean,\n  saveIds: boolean,\n) {\n  if (!block.nextConnection) {\n    return;\n  }\n  const connectionState = saveConnection(\n    block.nextConnection,\n    doFullSerialization,\n    saveIds,\n  );\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(\n  connection: Connection,\n  doFullSerialization: boolean,\n  saveIds: 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, saveIds});\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 */\nexport function append(\n  state: State,\n  workspace: Workspace,\n  {recordUndo = false}: {recordUndo?: boolean} = {},\n): Block {\n  const block = appendInternal(state, workspace, {recordUndo});\n  if (workspace.rendered) renderManagement.triggerQueuedRenders();\n  return block;\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 * @internal\n */\nexport function appendInternal(\n  state: State,\n  workspace: Workspace,\n  {\n    parentConnection = undefined,\n    isShadow = false,\n    recordUndo = false,\n  }: {\n    parentConnection?: Connection;\n    isShadow?: boolean;\n    recordUndo?: boolean;\n  } = {},\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 variablesBeforeCreation = workspace.getAllVariables();\n  let block;\n  try {\n    block = appendPrivate(state, workspace, {parentConnection, isShadow});\n  } finally {\n    eventUtils.enable();\n  }\n\n  // Fire a VarCreate event for each (if any) new variable created.\n  checkNewVariables(workspace, variablesBeforeCreation);\n\n  if (eventUtils.isEnabled()) {\n    // Block events come after var events, in case they refer to newly created\n    // variables.\n    eventUtils.fire(new (eventUtils.get(EventType.BLOCK_CREATE))(block));\n  }\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,\n  workspace: Workspace,\n  {\n    parentConnection = undefined,\n    isShadow = false,\n  }: {parentConnection?: Connection; isShadow?: boolean} = {},\n): 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 * Checks the workspace for any new variables that were created during the\n * deserialization of a block and fires a VarCreate event for each.\n *\n * @param workspace The workspace where new variables are being created\n * @param originalVariables The array of variables that existed in the workspace\n *     before adding the new block.\n */\nfunction checkNewVariables(\n  workspace: Workspace,\n  originalVariables: IVariableModel<IVariableState>[],\n) {\n  if (eventUtils.isEnabled()) {\n    const newVariables = Variables.getAddedVariables(\n      workspace,\n      originalVariables,\n    );\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(new (eventUtils.get(EventType.VAR_CREATE))(thisVariable));\n    }\n  }\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['deletable'] === false) {\n    block.setDeletable(false);\n  }\n  if (state['movable'] === false) {\n    block.setMovable(false);\n  }\n  if (state['editable'] === false) {\n    block.setEditable(false);\n  }\n  if (state['enabled'] === false) {\n    // Before May 2024 we just used 'enabled', with no reasons.\n    // Contiune to support this syntax.\n    block.setDisabledReason(true, MANUALLY_DISABLED);\n  }\n  if (Array.isArray(state['disabledReasons'])) {\n    for (const reason of state['disabledReasons']) {\n      block.setDisabledReason(true, reason);\n    }\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(utilsXml.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,\n  child: Block,\n  state: State,\n) {\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 {\n    // 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(childConnection, parentConnection, false),\n        childConnection,\n        parentConnection,\n      ),\n      parentConnection.type === inputTypes.VALUE\n        ? 'output connection'\n        : 'previous connection',\n      child,\n      state,\n    );\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']) return;\n\n  const iconTypes = Object.keys(state['icons']);\n  for (const iconType of iconTypes) {\n    const iconState = state['icons'][iconType];\n    let icon = block.getIcon(iconType);\n    if (!icon) {\n      const constructor = registry.getClass(\n        registry.Type.ICON,\n        iconType,\n        false,\n      );\n      if (!constructor) throw new UnregisteredIcon(iconType, block, state);\n      icon = new constructor(block);\n      block.addIcon(icon);\n    }\n    if (isSerializable(icon)) icon.loadState(iconState);\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      );\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,\n  connectionState: ConnectionState,\n) {\n  if (connectionState['shadow']) {\n    connection.setShadowState(connectionState['shadow']);\n  }\n  if (connectionState['block']) {\n    appendPrivate(\n      connectionState['block'],\n      connection.getSourceBlock().workspace,\n      {parentConnection: connection},\n    );\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.queueRender();\n\n    // fixes #6076 JSO deserialization doesn't\n    // set .iconXY_ property so here it will be set\n    for (const icon of blockSvg.getIcons()) {\n      icon.onLocationChange(blockSvg.getRelativeToSurfaceXY());\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 */\nexport class BlockSerializer implements ISerializer {\n  priority: number;\n\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(\n    workspace: Workspace,\n  ): {languageVersion: number; blocks: State[]} | null {\n    const blockStates = [];\n    for (const block of workspace.getTopBlocks(false)) {\n      const state = saveBlock(block, {\n        addCoordinates: true,\n        doFullSerialization: false,\n      });\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[]},\n    workspace: Workspace,\n  ) {\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 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IBubble} from './i_bubble';\n\nexport interface IHasBubble {\n  /** @returns True if the bubble is currently open, false otherwise. */\n  bubbleIsVisible(): boolean;\n\n  /** Sets whether the bubble is open or not. */\n  setBubbleVisible(visible: boolean): Promise<void>;\n\n  /**\n   * Returns the current IBubble that implementations are managing, or null if\n   * there isn't one.\n   *\n   * Note that this cannot be expected to return null if bubbleIsVisible()\n   * returns false, i.e., the nullability of the returned bubble does not\n   * necessarily imply visibility.\n   *\n   * @returns The current IBubble maintained by implementations, or null if\n   *     there is not one.\n   */\n  getBubble(): IBubble | null;\n}\n\n/** Type guard that checks whether the given object is a IHasBubble. */\nexport function hasBubble(obj: any): obj is IHasBubble {\n  return (\n    typeof obj.bubbleIsVisible === 'function' &&\n    typeof obj.setBubbleVisible === 'function' &&\n    typeof obj.getBubble === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.math\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 */\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 */\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 */\nexport function clamp(\n  lowerBound: number,\n  number: number,\n  upperBound: number,\n): 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 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 */\n// Former goog.module ID: Blockly.dropDownDiv\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\nimport type {Field} from './field.js';\nimport {ReturnEphemeralFocus, getFocusManager} from './focus_manager.js';\nimport * as dom from './utils/dom.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 * 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: (() => void) | 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/** Callback to FocusManager to return ephemeral focus when the div closes. */\nlet returnEphemeralFocus: ReturnEphemeralFocus | null = null;\n\n/** Identifier for shortcut keydown listener used to unbind it. */\nlet keydownListener: browserEvents.Data | 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 (document.querySelector('.blocklyDropDownDiv')) {\n    return; // Already created.\n  }\n  div = document.createElement('div');\n  div.className = 'blocklyDropDownDiv';\n  div.tabIndex = -1;\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  keydownListener = browserEvents.conditionalBind(\n    content,\n    'keydown',\n    null,\n    common.globalShortcutHandler,\n  );\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 =\n    'transform ' + ANIMATION_TIME + 's, ' + 'opacity ' + ANIMATION_TIME + 's';\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 * @returns The field that currently owns this, or null.\n */\nexport function getOwner(): Field | null {\n  return owner;\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(): HTMLDivElement {\n  return content;\n}\n\n/** Clear the content of the drop-down. */\nexport function clearContent() {\n  if (keydownListener) {\n    browserEvents.unbind(keydownListener);\n    keydownListener = null;\n  }\n  div.remove();\n  createDom();\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 * @param manageEphemeralFocus Whether ephemeral focus should be managed\n *     according to the drop-down div's lifetime. Note that if a false value is\n *     passed in here then callers should manage ephemeral focus directly\n *     otherwise focus may not properly restore when the widget closes. Defaults\n *     to true.\n * @returns True if the menu rendered below block; false if above.\n */\nexport function showPositionedByBlock<T>(\n  field: Field<T>,\n  block: BlockSvg,\n  opt_onHide?: () => void,\n  opt_secondaryYOffset?: number,\n  manageEphemeralFocus: boolean = true,\n): boolean {\n  return showPositionedByRect(\n    getScaledBboxOfBlock(block),\n    field as Field,\n    manageEphemeralFocus,\n    opt_onHide,\n    opt_secondaryYOffset,\n  );\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 * @param manageEphemeralFocus Whether ephemeral focus should be managed\n *     according to the drop-down div's lifetime. Note that if a false value is\n *     passed in here then callers should manage ephemeral focus directly\n *     otherwise focus may not properly restore when the widget closes. Defaults\n *     to true.\n * @returns True if the menu rendered below block; false if above.\n */\nexport function showPositionedByField<T>(\n  field: Field<T>,\n  opt_onHide?: () => void,\n  opt_secondaryYOffset?: number,\n  manageEphemeralFocus: boolean = true,\n): boolean {\n  positionToField = true;\n  return showPositionedByRect(\n    getScaledBboxOfField(field as Field),\n    field as Field,\n    manageEphemeralFocus,\n    opt_onHide,\n    opt_secondaryYOffset,\n  );\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 * @param manageEphemeralFocus Whether ephemeral focus should be managed\n *     according to the drop-down div's lifetime. Note that if a false value is\n *     passed in here then callers should manage ephemeral focus directly\n *     otherwise focus may not properly restore when the widget closes.\n * @returns True if the menu rendered below block; false if above.\n */\nfunction showPositionedByRect(\n  bBox: Rect,\n  field: Field,\n  manageEphemeralFocus: boolean,\n  opt_onHide?: () => void,\n  opt_secondaryYOffset?: number,\n): 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,\n    sourceBlock.RTL,\n    primaryX,\n    primaryY,\n    secondaryX,\n    secondaryY,\n    manageEphemeralFocus,\n    opt_onHide,\n  );\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 * @param manageEphemeralFocus Whether ephemeral focus should be managed\n *     according to the widget div's lifetime.\n * @returns True if the menu rendered at the primary origin point.\n * @internal\n */\nexport function show<T>(\n  newOwner: Field<T>,\n  rtl: boolean,\n  primaryX: number,\n  primaryY: number,\n  secondaryX: number,\n  secondaryY: number,\n  manageEphemeralFocus: boolean,\n  opt_onHide?: () => void,\n): boolean {\n  owner = newOwner as Field;\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  dom.addClass(div, renderedClassName);\n  dom.addClass(div, themeClassName);\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  const atOrigin = positionInternal(primaryX, primaryY, secondaryX, secondaryY);\n\n  // Ephemeral focus must happen after the div is fully visible in order to\n  // ensure that it properly receives focus.\n  if (manageEphemeralFocus) {\n    returnEphemeralFocus = getFocusManager().takeEphemeralFocus(div);\n  }\n\n  return atOrigin;\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,\n    primaryY: number,\n    secondaryX: number,\n    secondaryY: number,\n  ): 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,\n        secondaryY,\n        boundsInfo,\n        divSize,\n      );\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,\n        secondaryY,\n        boundsInfo,\n        divSize,\n      );\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,\n  primaryY: number,\n  boundsInfo: BoundsInfo,\n  divSize: Size,\n): PositionMetrics {\n  const xCoords = getPositionX(\n    primaryX,\n    boundsInfo.left,\n    boundsInfo.right,\n    divSize.width,\n  );\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,\n  secondaryY: number,\n  boundsInfo: BoundsInfo,\n  divSize: Size,\n): PositionMetrics {\n  const xCoords = getPositionX(\n    secondaryX,\n    boundsInfo.left,\n    boundsInfo.right,\n    divSize.width,\n  );\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,\n  boundsInfo: BoundsInfo,\n  divSize: Size,\n): PositionMetrics {\n  const xCoords = getPositionX(\n    sourceX,\n    boundsInfo.left,\n    boundsInfo.right,\n    divSize.width,\n  );\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,\n  boundsLeft: number,\n  boundsRight: number,\n  divWidth: number,\n): {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,\n    relativeArrowX,\n    divWidth - horizPadding - ARROW_SIZE,\n  );\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<T>(\n  divOwner: Field<T>,\n  opt_withoutAnimation?: boolean,\n): 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  if (onHide) {\n    onHide();\n    onHide = null;\n  }\n  clearContent();\n  owner = null;\n\n  (common.getMainWorkspace() as WorkspaceSvg).markFocused();\n\n  if (returnEphemeralFocus) {\n    returnEphemeralFocus();\n    returnEphemeralFocus = null;\n  }\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,\n  primaryY: number,\n  secondaryX: number,\n  secondaryY: number,\n): boolean {\n  const metrics = internal.getPositionMetrics(\n    primaryX,\n    primaryY,\n    secondaryX,\n    secondaryY,\n  );\n\n  // Update arrow CSS.\n  if (metrics.arrowVisible) {\n    const x = metrics.arrowX;\n    const y = metrics.arrowY;\n    const rotation = metrics.arrowAtTop ? 45 : 225;\n    arrow.style.display = '';\n    arrow.style.transform = `translate(${x}px, ${y}px) rotate(${rotation}deg)`;\n    arrow.setAttribute('class', 'blocklyDropDownArrow');\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\n      ? 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 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.string\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 */\nexport function shortestStringLength(array: string[]): number {\n  if (!array.length) {\n    return 0;\n  }\n  return array.reduce(function (a, b) {\n    return a.length < b.length ? a : b;\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 */\nexport function commonWordPrefix(\n  array: string[],\n  opt_shortest?: number,\n): 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 */\nexport function commonWordSuffix(\n  array: string[],\n  opt_shortest?: number,\n): 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 */\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[],\n  wordBreaks: boolean[],\n  limit: number,\n): 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 ('.?!'.includes(linePunctuation[i])) {\n      score += limit / 3;\n    } else if (',;)]}'.includes(linePunctuation[i])) {\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 (\n    lineLengths.length > 1 &&\n    lineLengths[lineLengths.length - 1] <= lineLengths[lineLengths.length - 2]\n  ) {\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[],\n  wordBreaks: boolean[],\n  limit: number,\n): 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 */\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// Former goog.module ID: 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 * 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 */\nexport type TipInfo =\n  | string\n  | {tooltip: AnyDuringMigration}\n  | (() => TipInfo | string);\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 */\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 */\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 */\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 */\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 */\nexport const OFFSET_X = 0;\n\n/**\n * Vertical offset between mouse cursor and tooltip.\n */\nexport const OFFSET_Y = 10;\n\n/**\n * Radius mouse can move before killing tooltip.\n */\nexport const RADIUS_OK = 10;\n\n/**\n * Delay before tooltip appears.\n */\nexport const HOVER_MS = 750;\n\n/**\n * Horizontal padding between tooltip and screen edge.\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 */\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 */\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(\n  obj: object | null,\n): {tooltip: AnyDuringMigration} | null {\n  while (obj && (obj as any).tooltip) {\n    if (\n      typeof (obj as any).tooltip === 'string' ||\n      typeof (obj as any).tooltip === 'function'\n    ) {\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 */\nexport function createDom() {\n  if (document.querySelector('.blocklyTooltipDiv')) {\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 */\nexport function bindMouseEvents(element: Element) {\n  // TODO (#6097): Don't stash wrapper info on the DOM.\n  (element as AnyDuringMigration).mouseOverWrapper_ = browserEvents.bind(\n    element,\n    'pointerover',\n    null,\n    onMouseOver,\n  );\n  (element as AnyDuringMigration).mouseOutWrapper_ = browserEvents.bind(\n    element,\n    'pointerout',\n    null,\n    onMouseOut,\n  );\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('pointermove', 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 */\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('pointermove', 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: PointerEvent) {\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: PointerEvent) {\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  showPid = 0;\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 * @internal\n */\nexport function dispose() {\n  element = null;\n  poisonedElement = null;\n  hide();\n}\n\n/**\n * Hide the tooltip.\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    showPid = 0;\n  }\n}\n\n/**\n * Hide any in-progress tooltips and block showing new tooltips until the next\n * call to unblock().\n *\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 * @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 (\n      anchorX + containerDiv!.offsetWidth >\n      windowWidth + window.scrollX - 2 * MARGINS\n    ) {\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// Former goog.module ID: Blockly.utils.colour\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 */\nlet hsvSaturation = 0.45;\n\n/**\n * Get the richness of block colours, regardless of the hue.\n *\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 * @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 */\nlet hsvValue = 0.65;\n\n/**\n * Get the intensity of block colours, regardless of the hue.\n *\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 * @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 */\nexport function parse(str: string | number): string | null {\n  str = `${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 */\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 */\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 */\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 */\nexport function blend(\n  colour1: string,\n  colour2: string,\n  factor: number,\n): string | 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 */\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 */\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// Former goog.module ID: Blockly.utils.parsing\n\nimport {Msg} from '../msg.js';\nimport * as colourUtils from './colour.js';\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 interpolation\n *     tokens (%1, %2, ...) when true.\n * @param tokenizeNewlines Split individual newline characters into separate\n *     tokens when true.\n * @returns Array of strings and numbers.\n */\nfunction tokenizeInterpolationInternal(\n  message: string,\n  parseInterpolationTokens: boolean,\n  tokenizeNewlines: boolean,\n): (string | number)[] {\n  const tokens = [];\n  const chars = message.split('');\n  chars.push(''); // End marker.\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) {\n      // 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 if (tokenizeNewlines && c === '\\n') {\n        // Output newline characters as single-character tokens, to be replaced\n        // with endOfRow dummies during interpolation.\n        const text = buffer.join('');\n        if (text) {\n          tokens.push(text);\n        }\n        buffer.length = 0;\n        tokens.push(c);\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) {\n      // 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)) {\n          // 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 = keyUpper.startsWith('BKY_')\n            ? keyUpper.substring(4)\n            : 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,\n                  parseInterpolationTokens,\n                  tokenizeNewlines,\n                ),\n              );\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(`${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 (but if newlines should be\n  // tokenized, don't merge those with adjacent text).\n  const mergedTokens = [];\n  buffer.length = 0;\n  for (let i = 0; i < tokens.length; i++) {\n    if (\n      typeof tokens[i] === 'string' &&\n      !(tokenizeNewlines && tokens[i] === '\\n')\n    ) {\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., '%%'). Newline characters will also be output as string tokens\n * containing a single newline character.\n *\n * @param message Text which might contain string table references and\n *     interpolation tokens.\n * @returns Array of strings and numbers.\n */\nexport function tokenizeInterpolation(message: string): (string | number)[] {\n  return tokenizeInterpolationInternal(message, true, 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 */\nexport function replaceMessageReferences(message: string | any): string {\n  if (typeof message !== 'string') {\n    return message;\n  }\n  const interpolatedResult = tokenizeInterpolationInternal(\n    message,\n    false,\n    false,\n  );\n  // When parseInterpolationTokens and tokenizeNewlines are false,\n  // interpolatedResult should be at 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 */\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*}/gi);\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 */\nexport function parseBlockColour(colour: number | string): {\n  hue: number | null;\n  hex: string;\n} {\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,\n        colourUtils.getHsvSaturation(),\n        colourUtils.getHsvValue() * 255,\n      ),\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// Former goog.module ID: Blockly.WidgetDiv\n\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\nimport {Field} from './field.js';\nimport {ReturnEphemeralFocus, getFocusManager} from './focus_manager.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/** The object currently using this container. */\nlet owner: unknown = null;\n\n/** The workspace associated with the owner currently using this container. */\nlet ownerWorkspace: WorkspaceSvg | null = 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 container. */\nconst containerClassName = 'blocklyWidgetDiv';\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/** Callback to FocusManager to return ephemeral focus when the div closes. */\nlet returnEphemeralFocus: ReturnEphemeralFocus | null = null;\n\n/**\n * Returns the HTML container for editor widgets.\n *\n * @returns The editor widget container.\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 * @internal\n */\nexport function testOnly_setDiv(newDiv: HTMLDivElement | null) {\n  containerDiv = newDiv;\n  if (newDiv === null) {\n    document.querySelector('.' + containerClassName)?.remove();\n  }\n}\n\n/**\n * Create the widget div and inject it onto the page.\n */\nexport function createDom() {\n  const container = common.getParentContainer() || document.body;\n\n  const existingContainer = document.querySelector('div.' + containerClassName);\n  if (existingContainer) {\n    containerDiv = existingContainer as HTMLDivElement;\n  } else {\n    containerDiv = document.createElement('div');\n    containerDiv.className = containerClassName;\n    containerDiv.tabIndex = -1;\n  }\n\n  browserEvents.conditionalBind(\n    containerDiv,\n    'keydown',\n    null,\n    common.globalShortcutHandler,\n  );\n\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 * @param workspace The workspace associated with the widget owner.\n * @param manageEphemeralFocus Whether ephemeral focus should be managed\n *     according to the widget div's lifetime. Note that if a false value is\n *     passed in here then callers should manage ephemeral focus directly\n *     otherwise focus may not properly restore when the widget closes. Defaults\n *     to true.\n */\nexport function show(\n  newOwner: unknown,\n  rtl: boolean,\n  newDispose: () => void,\n  workspace?: WorkspaceSvg | null,\n  manageEphemeralFocus: boolean = true,\n) {\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  if (!workspace && newOwner instanceof Field) {\n    // For backward compatibility with plugin fields that do not provide a\n    // workspace to this function, attempt to derive it from the field.\n    workspace = (newOwner as Field).getSourceBlock()?.workspace as WorkspaceSvg;\n  }\n  ownerWorkspace = workspace ?? null;\n  const rendererWorkspace =\n    workspace ?? (common.getMainWorkspace() as WorkspaceSvg);\n  rendererClassName = rendererWorkspace.getRenderer().getClassName();\n  themeClassName = rendererWorkspace.getTheme().getClassName();\n  if (rendererClassName) {\n    dom.addClass(div, rendererClassName);\n  }\n  if (themeClassName) {\n    dom.addClass(div, themeClassName);\n  }\n  if (manageEphemeralFocus) {\n    returnEphemeralFocus = getFocusManager().takeEphemeralFocus(div);\n  }\n}\n\n/**\n * Destroy the widget and hide the div.\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  if (dispose) {\n    dispose();\n    dispose = null;\n  }\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  if (returnEphemeralFocus) {\n    returnEphemeralFocus();\n    returnEphemeralFocus = null;\n  }\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 * 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 */\nexport function hideIfOwner(oldOwner: unknown) {\n  if (owner === oldOwner) {\n    hide();\n  }\n}\n\n/**\n * Destroy the widget and hide the div if it is being used by an object in the\n * specified workspace, or if it is used by an unknown workspace.\n *\n * @param workspace The workspace that was using this container.\n */\nexport function hideIfOwnerIsInWorkspace(workspace: WorkspaceSvg) {\n  let ownerIsInWorkspace = ownerWorkspace === null;\n  // Check if the given workspace is a parent workspace of the one containing\n  // our owner.\n  let currentWorkspace: WorkspaceSvg | null = workspace;\n  while (!ownerIsInWorkspace && currentWorkspace) {\n    if (currentWorkspace === workspace) {\n      ownerIsInWorkspace = true;\n      break;\n    }\n    currentWorkspace = workspace.options.parentWorkspace;\n  }\n\n  if (ownerIsInWorkspace) {\n    hide();\n  }\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 * @internal\n */\nexport function positionWithAnchor(\n  viewportBBox: Rect,\n  anchorBBox: Rect,\n  widgetSize: Size,\n  rtl: boolean,\n) {\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,\n  anchorBBox: Rect,\n  widgetSize: Size,\n  rtl: boolean,\n): 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,\n  anchorBBox: Rect,\n  widgetSize: Size,\n): 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/**\n * Determine if the owner is a field for purposes of repositioning.\n * We can't simply check `instanceof Field` as that would introduce a circular\n * dependency.\n */\nfunction isRepositionable(item: any): item is Field {\n  return !!item?.repositionForWindowResize;\n}\n\n/**\n * Reposition the widget div if the owner of it says to.\n * If the owner isn't a field, just give up and hide it.\n */\nexport function repositionForWindowResize(): void {\n  if (!isRepositionable(owner) || !owner.repositionForWindowResize()) {\n    // If the owner is not a Field, or if the owner returns false from the\n    // reposition method, we should hide the widget div. Otherwise, we'll assume\n    // the owner handled any needed resize.\n    hide();\n  }\n}\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ContextMenu\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport {config} from './config.js';\nimport type {\n  ContextMenuOption,\n  LegacyContextMenuOption,\n} from './contextmenu_registry.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {getFocusManager} from './focus_manager.js';\nimport {Menu} from './menu.js';\nimport {MenuSeparator} from './menu_separator.js';\nimport {MenuItem} from './menuitem.js';\nimport * as serializationBlocks from './serialization/blocks.js';\nimport * as aria from './utils/aria.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Rect} from './utils/rect.js';\nimport * as svgMath from './utils/svg_math.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\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 * It is not recommended that you use this function; instead,\n * use the scope object passed to the context menu callback.\n *\n * @returns The block the context menu is attached to.\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 */\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 menuOpenEvent Event that caused the menu to open.\n * @param options Array of menu options.\n * @param rtl True if RTL, false if LTR.\n * @param workspace The workspace associated with the context menu, if any.\n * @param location The screen coordinates at which to show the menu.\n */\nexport function show(\n  menuOpenEvent: Event,\n  options: (ContextMenuOption | LegacyContextMenuOption)[],\n  rtl: boolean,\n  workspace?: WorkspaceSvg,\n  location?: Coordinate,\n) {\n  WidgetDiv.show(dummyOwner, rtl, dispose, workspace);\n  if (!options.length) {\n    hide();\n    return;\n  }\n\n  if (!location) {\n    if (menuOpenEvent instanceof PointerEvent) {\n      location = new Coordinate(menuOpenEvent.clientX, menuOpenEvent.clientY);\n    } else {\n      // We got a keyboard event that didn't tell us where to open the menu, so just guess\n      console.warn('Context menu opened with keyboard but no location given');\n      location = new Coordinate(0, 0);\n    }\n  }\n  const menu = populate_(options, rtl, menuOpenEvent, location);\n  menu_ = menu;\n\n  position_(menu, rtl, location);\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 * @param menuOpenEvent The event that triggered the context menu to open.\n * @param location The screen coordinates at which to show the menu.\n * @returns The menu that will be shown on right click.\n */\nfunction populate_(\n  options: (ContextMenuOption | LegacyContextMenuOption)[],\n  rtl: boolean,\n  menuOpenEvent: Event,\n  location: Coordinate,\n): 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    if (option.separator) {\n      menu.addChild(new MenuSeparator());\n      continue;\n    }\n\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 (p1: MenuItem, menuSelectEvent: Event) {\n        hide();\n        requestAnimationFrame(() => {\n          setTimeout(() => {\n            // If .scope does not exist on the option, then the callback\n            // will not be expecting a scope parameter, so there should be\n            // no problems. Just assume it is a ContextMenuOption and we'll\n            // pass undefined if it's not.\n            option.callback(\n              (option as ContextMenuOption).scope,\n              menuOpenEvent,\n              menuSelectEvent,\n              location,\n            );\n          }, 0);\n        });\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 rtl True if RTL, false if LTR.\n * @param location The location at which to anchor the menu.\n */\nfunction position_(menu: Menu, rtl: boolean, location: Coordinate) {\n  // Record windowSize and scrollOffset before adding menu.\n  const viewportBBox = svgMath.getViewportBBox();\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    location.y + viewportBBox.top,\n    location.y + viewportBBox.top,\n    location.x + viewportBBox.left,\n    location.x + viewportBBox.left,\n  );\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,\n    'contextmenu',\n    null,\n    haltPropagation,\n  );\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 */\nexport function hide() {\n  WidgetDiv.hideIfOwner(dummyOwner);\n  currentBlock = null;\n}\n\n/**\n * Dispose of the menu.\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 and returns it.\n *\n * @param block Original block.\n * @param state XML or JSON object representation of the new block.\n * @returns Function that creates a block.\n */\nexport function callbackFactory(\n  block: Block,\n  state: Element | serializationBlocks.State,\n): () => BlockSvg {\n  return () => {\n    eventUtils.disable();\n    let newBlock: BlockSvg;\n    try {\n      if (state instanceof Element) {\n        newBlock = Xml.domToBlockInternal(state, block.workspace!) as BlockSvg;\n      } else {\n        newBlock = serializationBlocks.appendInternal(\n          state,\n          block.workspace,\n        ) as BlockSvg;\n      }\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(EventType.BLOCK_CREATE))(newBlock));\n    }\n    getFocusManager().focusNode(newBlock);\n    return newBlock;\n  };\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as browserEvents from '../browser_events.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport {Coordinate} from './coordinate.js';\n\nconst workspaceToDragDelta: WeakMap<WorkspaceSvg, Coordinate> = new WeakMap();\n\n/**\n * Convert from mouse coordinates to workspace coordinates.\n *\n * @param workspace The workspace where the pointer event is occurring.\n * @param e The pointer event with the source coordinates.\n */\nfunction mouseToWorkspacePoint(\n  workspace: WorkspaceSvg,\n  e: PointerEvent,\n): SVGPoint {\n  const point = browserEvents.mouseToSvg(\n    e,\n    workspace.getParentSvg(),\n    workspace.getInverseScreenCTM(),\n  );\n  // Fix scale of mouse event.\n  point.x /= workspace.scale;\n  point.y /= workspace.scale;\n  return point;\n}\n\n/**\n * Start tracking a drag of an object on this workspace by recording the offset\n * between the pointer's current location and the object's starting location.\n *\n * Used for resizing block comments and workspace comments.\n *\n * @param workspace The workspace where the drag is occurring.\n * @param e Pointer down event.\n * @param xy Starting location of object.\n */\nexport function start(\n  workspace: WorkspaceSvg,\n  e: PointerEvent,\n  xy: Coordinate,\n) {\n  const point = mouseToWorkspacePoint(workspace, e);\n  // Record the starting offset between the bubble's location and the mouse.\n  workspaceToDragDelta.set(workspace, Coordinate.difference(xy, point));\n}\n\n/**\n * Compute the new position of a dragged object in this workspace based on the\n * current pointer position and the offset between the pointer's starting\n * location and the object's starting location.\n *\n * The start function should have be called previously, when the drag started.\n *\n * Used for resizing block comments and workspace comments.\n *\n * @param workspace The workspace where the drag is occurring.\n * @param e Pointer move event.\n * @returns New location of object.\n */\nexport function move(workspace: WorkspaceSvg, e: PointerEvent): Coordinate {\n  const point = mouseToWorkspacePoint(workspace, e);\n  const dragDelta = workspaceToDragDelta.get(workspace);\n  if (!dragDelta) {\n    throw new Error('Drag not initialized');\n  }\n  return Coordinate.sum(dragDelta, point);\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Xml\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport {RenderedWorkspaceComment} from './comments/rendered_workspace_comment.js';\nimport {WorkspaceComment} from './comments/workspace_comment.js';\nimport type {Connection} from './connection.js';\nimport {MANUALLY_DISABLED} from './constants.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Field} from './field.js';\nimport {IconType} from './icons/icon_types.js';\nimport {inputTypes} from './inputs/input_types.js';\nimport type {\n  IVariableModel,\n  IVariableState,\n} from './interfaces/i_variable_model.js';\nimport * as renderManagement from './render_management.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Size} from './utils/size.js';\nimport * as utilsXml from './utils/xml.js';\nimport * as Variables from './variables.js';\nimport type {Workspace} from './workspace.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Encode a block tree as XML.\n *\n * @param workspace The workspace containing blocks.\n * @param skipId True if the encoder should skip the block IDs. False by\n *     default.\n * @returns XML DOM element.\n */\nexport function workspaceToDom(workspace: Workspace, skipId = false): Element {\n  const treeXml = utilsXml.createElement('xml');\n  const variablesElement = variablesToDom(\n    Variables.allUsedVarModels(workspace),\n  );\n  if (variablesElement.hasChildNodes()) {\n    treeXml.appendChild(variablesElement);\n  }\n  for (const comment of workspace.getTopComments()) {\n    treeXml.appendChild(\n      saveWorkspaceComment(comment as AnyDuringMigration, skipId),\n    );\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, skipId));\n  }\n  return treeXml;\n}\n\n/** Serializes the given workspace comment to XML. */\nexport function saveWorkspaceComment(\n  comment: WorkspaceComment,\n  skipId = false,\n): Element {\n  const elem = utilsXml.createElement('comment');\n  if (!skipId) elem.setAttribute('id', comment.id);\n\n  const workspace = comment.workspace;\n  const loc = comment.getRelativeToSurfaceXY().clone();\n  loc.x = workspace.RTL ? workspace.getWidth() - loc.x : loc.x;\n  elem.setAttribute('x', `${loc.x}`);\n  elem.setAttribute('y', `${loc.y}`);\n  elem.setAttribute('w', `${comment.getSize().width}`);\n  elem.setAttribute('h', `${comment.getSize().height}`);\n\n  if (comment.getText()) elem.textContent = comment.getText();\n  if (comment.isCollapsed()) elem.setAttribute('collapsed', 'true');\n  if (!comment.isOwnEditable()) elem.setAttribute('editable', 'false');\n  if (!comment.isOwnMovable()) elem.setAttribute('movable', 'false');\n  if (!comment.isOwnDeletable()) elem.setAttribute('deletable', 'false');\n\n  return elem;\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 */\nexport function variablesToDom(\n  variableList: IVariableModel<IVariableState>[],\n): 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.getName()));\n    if (variable.getType()) {\n      element.setAttribute('type', variable.getType());\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 */\nexport function blockToDomWithXY(\n  block: Block,\n  opt_noId?: boolean,\n): Element | DocumentFragment {\n  if (block.isInsertionMarker()) {\n    // 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  if (isElement(element)) {\n    const xy = block.getRelativeToSurfaceXY();\n    element.setAttribute(\n      'x',\n      String(Math.round(block.workspace.RTL ? width - xy.x : xy.x)),\n    );\n    element.setAttribute('y', String(Math.round(xy.y)));\n  }\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 (const field of block.getFields()) {\n    const fieldDom = fieldToDom(field);\n    if (fieldDom) {\n      element.appendChild(fieldDom);\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 */\nexport function blockToDom(\n  block: Block,\n  opt_noId?: boolean,\n): Element | 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    element.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 comment = block.getIcon(IconType.COMMENT)!;\n    const size = comment.getBubbleSize();\n    const pinned = comment.bubbleIsVisible();\n    const location = comment.getBubbleLocation();\n\n    const commentElement = utilsXml.createElement('comment');\n    commentElement.appendChild(utilsXml.createTextNode(commentText));\n    commentElement.setAttribute('pinned', `${pinned}`);\n    commentElement.setAttribute('h', `${size.height}`);\n    commentElement.setAttribute('w', `${size.width}`);\n    if (location) {\n      commentElement.setAttribute(\n        'x',\n        `${\n          block.workspace.RTL\n            ? block.workspace.getWidth() - (location.x + size.width)\n            : location.x\n        }`,\n      );\n      commentElement.setAttribute('y', `${location.y}`);\n    }\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 || input.type === inputTypes.END_ROW) {\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 (\n    block.inputsInline !== undefined &&\n    block.inputsInline !== block.inputsInlineDefault\n  ) {\n    element.setAttribute('inline', String(block.inputsInline));\n  }\n  if (block.isCollapsed()) {\n    element.setAttribute('collapsed', 'true');\n  }\n  if (!block.isEnabled()) {\n    // Set the value of the attribute to a comma-separated list of reasons.\n    // Use encodeURIComponent to escape commas in the reasons so that they\n    // won't be confused with separator commas.\n    element.setAttribute(\n      'disabled-reasons',\n      Array.from(block.getDisabledReasons()).map(encodeURIComponent).join(','),\n    );\n  }\n  if (!block.isOwnDeletable()) {\n    element.setAttribute('deletable', 'false');\n  }\n  if (!block.isOwnMovable()) {\n    element.setAttribute('movable', 'false');\n  }\n  if (!block.isOwnEditable()) {\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 (\n          textNode.nodeType === dom.NodeType.TEXT_NODE &&\n          (textNode as Text).data.trim() === '' &&\n          node?.firstChild !== textNode\n        ) {\n          // Prune whitespace after a tag.\n          dom.removeNode(textNode);\n        }\n      }\n      if (node) {\n        textNode = node;\n        node = node.nextSibling;\n        if (\n          textNode.nodeType === dom.NodeType.TEXT_NODE &&\n          (textNode as Text).data.trim() === ''\n        ) {\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 */\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 */\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 * 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 */\nexport function clearWorkspaceAndLoadFromXml(\n  xml: Element,\n  workspace: WorkspaceSvg,\n): string[] {\n  workspace.setResizesEnabled(false);\n  workspace.clear();\n  const blockIds = domToWorkspace(xml, workspace);\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 */\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 (\n        name === 'block' ||\n        (name === 'shadow' && !eventUtils.getRecordUndo())\n      ) {\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 = domToBlockInternal(xmlChildElement, workspace);\n        newBlockIds.push(block.id);\n        const blockX = parseInt(xmlChildElement.getAttribute('x') ?? '10', 10);\n        const blockY = parseInt(xmlChildElement.getAttribute('y') ?? '10', 10);\n        if (!isNaN(blockX) && !isNaN(blockY)) {\n          block.moveBy(workspace.RTL ? width - blockX : blockX, blockY, [\n            'create',\n          ]);\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        loadWorkspaceComment(xmlChildElement, workspace);\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        }\n        variablesFirst = false;\n      }\n    }\n  } finally {\n    eventUtils.setGroup(existingGroup);\n    if ((workspace as WorkspaceSvg).setResizesEnabled) {\n      (workspace as WorkspaceSvg).setResizesEnabled(true);\n    }\n    if (workspace.rendered) renderManagement.triggerQueuedRenders();\n    dom.stopTextWidthCache();\n  }\n  // Re-enable workspace resizing.\n  eventUtils.fire(new (eventUtils.get(EventType.FINISHED_LOADING))(workspace));\n  return newBlockIds;\n}\n\n/** Deserializes the given comment state into the given workspace. */\nexport function loadWorkspaceComment(\n  elem: Element,\n  workspace: Workspace,\n): WorkspaceComment {\n  const id = elem.getAttribute('id') ?? undefined;\n  const comment = workspace.rendered\n    ? new RenderedWorkspaceComment(workspace as WorkspaceSvg, id)\n    : new WorkspaceComment(workspace, id);\n\n  comment.setText(elem.textContent ?? '');\n\n  let x = parseInt(elem.getAttribute('x') ?? '', 10);\n  const y = parseInt(elem.getAttribute('y') ?? '', 10);\n  if (!isNaN(x) && !isNaN(y)) {\n    x = workspace.RTL ? workspace.getWidth() - x : x;\n    comment.moveTo(new Coordinate(x, y));\n  }\n\n  const w = parseInt(elem.getAttribute('w') ?? '', 10);\n  const h = parseInt(elem.getAttribute('h') ?? '', 10);\n  if (!isNaN(w) && !isNaN(h)) comment.setSize(new Size(w, h));\n\n  if (elem.getAttribute('collapsed') === 'true') comment.setCollapsed(true);\n  if (elem.getAttribute('editable') === 'false') comment.setEditable(false);\n  if (elem.getAttribute('movable') === 'false') comment.setMovable(false);\n  if (elem.getAttribute('deletable') === 'false') comment.setDeletable(false);\n\n  return comment;\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 */\nexport function appendDomToWorkspace(\n  xml: Element,\n  workspace: WorkspaceSvg,\n): 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) {\n    // 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 = workspace\n        .getBlockById(newBlockIds[i])!\n        .getRelativeToSurfaceXY();\n      if (blockXY.y < newY) {\n        newY = blockXY.y;\n      }\n      if (blockXY.x < newLeftX) {\n        // if we left align also on x\n        newLeftX = blockXY.x;\n      }\n      if (blockXY.x > newRightX) {\n        // 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, ['create']);\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 */\nexport function domToBlock(xmlBlock: Element, workspace: Workspace): Block {\n  const block = domToBlockInternal(xmlBlock, workspace);\n  if (workspace.rendered) renderManagement.triggerQueuedRenders();\n  return block;\n}\n\n/**\n * Decode an XML block tag and create a block (and possibly sub blocks) on the\n * workspace.\n *\n * This is defined internally so that it doesn't trigger an immediate render,\n * which we do want to happen for external calls.\n *\n * @param xmlBlock XML block element.\n * @param workspace The workspace.\n * @returns The root block created.\n * @internal\n */\nexport function domToBlockInternal(\n  xmlBlock: Element,\n  workspace: Workspace,\n): 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).queueRender();\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      // 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    const newVariables = Variables.getAddedVariables(\n      workspace,\n      variablesBeforeCreation,\n    );\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(new (eventUtils.get(EventType.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(EventType.BLOCK_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 */\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    if (!name) return;\n    workspace.getVariableMap().createVariable(name, type ?? undefined, 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    const width = parseInt(xmlChild.getAttribute('w') ?? '50', 10);\n    const height = parseInt(xmlChild.getAttribute('h') ?? '50', 10);\n    let x = parseInt(xmlChild.getAttribute('x') ?? '', 10);\n    const y = parseInt(xmlChild.getAttribute('y') ?? '', 10);\n\n    block.setCommentText(text);\n    const comment = block.getIcon(IconType.COMMENT)!;\n    if (!isNaN(width) && !isNaN(height)) {\n      comment.setBubbleSize(new Size(width, height));\n    }\n    // Set the pinned state of the bubble.\n    comment.setBubbleVisible(pinned);\n\n    // Actually show the bubble after the block has been rendered.\n    setTimeout(() => {\n      if (!isNaN(x) && !isNaN(y)) {\n        x = block.workspace.RTL ? block.workspace.getWidth() - (x + width) : x;\n        comment.setBubbleLocation(new Coordinate(x, y));\n      }\n      comment.setBubbleVisible(pinned);\n    }, 1);\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    if (!nodeName) {\n      console.warn(`Ignoring unnamed field in block ${block.type}`);\n      continue;\n    }\n    domToField(block, nodeName, 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;\n  childShadowElement: Element | null;\n} {\n  let childBlockElement: Element | null = null;\n  let childShadowElement: Element | null = null;\n  for (let i = 0; i < xmlNode.childNodes.length; i++) {\n    const xmlChild = xmlNode.childNodes[i];\n    if (isElement(xmlChild)) {\n      if (xmlChild.nodeName.toLowerCase() === 'block') {\n        childBlockElement = xmlChild;\n      } else if (xmlChild.nodeName.toLowerCase() === 'shadow') {\n        childShadowElement = xmlChild;\n      }\n    }\n  }\n  return {childBlockElement, childShadowElement};\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[],\n  workspace: Workspace,\n  block: Block,\n  prototypeName: string,\n) {\n  for (let i = 0; i < xmlChildren.length; i++) {\n    const xmlChild = xmlChildren[i];\n    const nodeName = xmlChild.getAttribute('name');\n    const input = nodeName ? block.getInput(nodeName) : null;\n    if (!input) {\n      console.warn(\n        'Ignoring non-existent input ' +\n          nodeName +\n          ' in block ' +\n          prototypeName,\n      );\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,\n        workspace,\n        input.connection,\n        false,\n      );\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[],\n  workspace: Workspace,\n  block: Block,\n) {\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,\n        workspace,\n        block.nextConnection,\n        true,\n      );\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 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,\n  workspace: Workspace,\n  parentConnection?: Connection,\n  connectedToParentNext?: boolean,\n): 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') ?? undefined;\n  block = workspace.newBlock(prototypeName, id);\n\n  // Preprocess childNodes so tags can be processed in a consistent order.\n  const xmlChildNameMap = mapSupportedXmlTags(xmlBlock);\n\n  const shouldCallInitSvg = applyMutationTagNodes(\n    xmlChildNameMap.mutation,\n    block,\n  );\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\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    // Before May 2024 we just used 'disabled', with no reasons.\n    // Contiune to support this syntax.\n    block.setDisabledReason(\n      disabled === 'true' || disabled === 'disabled',\n      MANUALLY_DISABLED,\n    );\n  }\n  const disabledReasons = xmlBlock.getAttribute('disabled-reasons');\n  if (disabledReasons !== null) {\n    for (const reason of disabledReasons.split(',')) {\n      // Use decodeURIComponent to restore characters that were encoded in the\n      // value, such as commas.\n      block.setDisabledReason(true, decodeURIComponent(reason));\n    }\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\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    );\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 */\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\nfunction isElement(node: Node): node is Element {\n  return node.nodeType === dom.NodeType.ELEMENT_NODE;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.fieldRegistry\n\nimport type {Field, FieldConfig} from './field.js';\nimport * as registry from './registry.js';\n\n/**\n * When constructing a field from JSON using the registry, the\n * `fromJson` method in this file is called with an options parameter\n * object consisting of the \"type\" which is the name of the field, and\n * other options that are part of the field's config object.\n *\n * These options are then passed to the field's static `fromJson`\n * method. That method accepts an options parameter with a type that usually\n * extends from FieldConfig, and may or may not have a \"type\" attribute (in\n * fact, it shouldn't, because we'd overwrite it as described above!)\n *\n * Unfortunately the registry has no way of knowing the actual Field subclass\n * that will be returned from passing in the name of the field. Therefore it\n * also has no way of knowing that the options object not only implements\n * `FieldConfig`, but it also should satisfy the Config that belongs to that\n * specific class's `fromJson` method.\n *\n * Because of this uncertainty, we just give up on type checking the properties\n * passed to the `fromJson` method, and allow arbitrary string keys with\n * unknown types.\n */\ntype RegistryOptions = FieldConfig & {\n  // The name of the field, e.g. field_dropdown\n  type: string;\n  [key: string]: unknown;\n};\n\n/**\n * Represents the static methods that must be defined on any\n * field that is registered, i.e. the constructor and fromJson methods.\n *\n * Because we don't know which Field subclass will be registered, we\n * are unable to typecheck the parameters of the constructor.\n */\nexport interface RegistrableField {\n  new (...args: any[]): Field;\n  fromJson(options: FieldConfig): Field;\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 or the fieldClass is not an object\n *     containing a fromJson function.\n */\nexport function register(type: string, fieldClass: RegistrableField) {\n  registry.register(registry.Type.FIELD, type, fieldClass, true);\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 */\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 * @internal\n */\nexport function fromJson<T>(options: RegistryOptions): Field<T> | 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<T>(options: RegistryOptions): Field<T> | null {\n  const fieldObject = registry.getObject(\n    registry.Type.FIELD,\n    options.type,\n  ) as unknown as RegistrableField;\n  if (!fieldObject) {\n    console.warn(\n      'Blockly could not create a field of type ' +\n        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    );\n    return null;\n  }\n  return fieldObject.fromJson(options);\n}\n\nexport const TEST_ONLY = {\n  fromJsonInternal,\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 */\n// Former goog.module ID: Blockly.FieldDropdown\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {\n  Field,\n  FieldConfig,\n  FieldValidator,\n  UnattachedFieldError,\n} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {Menu} from './menu.js';\nimport {MenuSeparator} from './menu_separator.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 {Size} from './utils/size.js';\nimport * as utilsString from './utils/string.js';\nimport {Svg} from './utils/svg.js';\n\n/**\n * Class for an editable dropdown field.\n */\nexport class FieldDropdown extends Field<string> {\n  /**\n   * Magic constant used to represent a separator in a list of dropdown items.\n   */\n  static readonly SEPARATOR = 'separator';\n\n  static ARROW_CHAR = '▾';\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  protected menuGenerator_?: MenuGenerator;\n\n  /** A cache of the most recently generated options. */\n  private generatedOptions: MenuOption[] | null = null;\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!: MenuOption;\n  override clickTarget_: SVGElement | null = null;\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   */\n  protected static IMAGE_Y_OFFSET = 5;\n\n  /** The total vertical padding above and below an image. */\n  protected static IMAGE_Y_PADDING = FieldDropdown.IMAGE_Y_OFFSET * 2;\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 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 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: MenuGenerator,\n    validator?: FieldDropdownValidator,\n    config?: FieldDropdownConfig,\n  );\n  constructor(menuGenerator: typeof Field.SKIP_SETUP);\n  constructor(\n    menuGenerator: MenuGenerator | typeof Field.SKIP_SETUP,\n    validator?: FieldDropdownValidator,\n    config?: FieldDropdownConfig,\n  ) {\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) return;\n\n    this.setOptions(menuGenerator);\n\n    if (config) {\n      this.configure_(config);\n    }\n    if (validator) {\n      this.setValidator(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  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    if (this.fieldGroup_) {\n      dom.addClass(this.fieldGroup_, 'blocklyField');\n      dom.addClass(this.fieldGroup_, 'blocklyDropdownField');\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 (\n      !this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW ||\n      (this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW &&\n        !this.getSourceBlock()?.isShadow())\n    );\n  }\n\n  /** Create a tspan based arrow. */\n  protected createTextArrow_() {\n    this.arrow = dom.createSvgElement(Svg.TSPAN, {}, this.textElement_);\n    this.arrow!.appendChild(\n      document.createTextNode(\n        this.getSourceBlock()?.RTL\n          ? FieldDropdown.ARROW_CHAR + ' '\n          : ' ' + FieldDropdown.ARROW_CHAR,\n      ),\n    );\n    if (this.getConstants()!.FIELD_TEXT_BASELINE_CENTER) {\n      this.arrow.setAttribute('dominant-baseline', 'central');\n    }\n    if (this.getSourceBlock()?.RTL) {\n      this.getTextElement().insertBefore(this.arrow, this.textContent_);\n    } else {\n      this.getTextElement().appendChild(this.arrow);\n    }\n  }\n\n  /** Create an SVG based arrow. */\n  protected createSVGArrow_() {\n    this.svgArrow = dom.createSvgElement(\n      Svg.IMAGE,\n      {\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    );\n    this.svgArrow!.setAttributeNS(\n      dom.XLINK_NS,\n      'xlink:href',\n      this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_DATAURI,\n    );\n  }\n\n  /**\n   * Create a dropdown menu under the text.\n   *\n   * @param e Optional mouse event that triggered the field to open, or\n   *     undefined if triggered programmatically.\n   */\n  protected override showEditor_(e?: MouseEvent) {\n    const block = this.getSourceBlock();\n    if (!block) {\n      throw new UnattachedFieldError();\n    }\n    this.dropdownCreate();\n    if (!this.menu_) return;\n\n    if (e && typeof e.clientX === 'number') {\n      this.menu_.openingCoords = new Coordinate(e.clientX, e.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 = block.getColour();\n      const borderColour = (this.sourceBlock_ as BlockSvg).getColourTertiary();\n      dropDownDiv.setColour(primaryColour, borderColour);\n    }\n\n    dropDownDiv.showPositionedByField(this, this.dropdownDispose_.bind(this));\n\n    dropDownDiv.getContentDiv().style.height = `${this.menu_.getSize().height}px`;\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      const option = options[i];\n      if (option === FieldDropdown.SEPARATOR) {\n        menu.addChild(new MenuSeparator());\n        continue;\n      }\n\n      const [label, value] = option;\n      const content = (() => {\n        if (isImageProperties(label)) {\n          // Convert ImageProperties to an HTMLImageElement.\n          const image = new Image(label.width, label.height);\n          image.src = label.src;\n          image.alt = label.alt;\n          return image;\n        }\n        return label;\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  protected 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   * @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 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(useCache?: boolean): MenuOption[] {\n    if (!this.menuGenerator_) {\n      // A subclass improperly skipped setup without defining the menu\n      // generator.\n      throw TypeError('A menu generator was never defined.');\n    }\n    if (Array.isArray(this.menuGenerator_)) return this.menuGenerator_;\n    if (useCache && this.generatedOptions) return this.generatedOptions;\n\n    this.generatedOptions = this.menuGenerator_();\n    this.validateOptions(this.generatedOptions);\n    return this.generatedOptions;\n  }\n\n  /**\n   * Update the options on this dropdown. This will reset the selected item to\n   * the first item in the list.\n   *\n   * @param menuGenerator The array of options or a generator function.\n   */\n  setOptions(menuGenerator: MenuGenerator) {\n    if (Array.isArray(menuGenerator)) {\n      this.validateOptions(menuGenerator);\n      const trimmed = this.trimOptions(menuGenerator);\n      this.menuGenerator_ = trimmed.options;\n      this.prefixField = trimmed.prefix || null;\n      this.suffixField = trimmed.suffix || null;\n    } else {\n      this.menuGenerator_ = menuGenerator;\n    }\n    // The currently selected option. The field is initialized with the\n    // first option selected.\n    this.selectedOption = this.getOptions(false)[0];\n    this.setValue(this.selectedOption[1]);\n  }\n\n  /**\n   * Ensure that the input value is a valid language-neutral option.\n   *\n   * @param newValue The input value.\n   * @returns A valid language-neutral option, or null if invalid.\n   */\n  protected override doClassValidation_(\n    newValue: string,\n  ): string | null | undefined;\n  protected override doClassValidation_(newValue?: string): string | null;\n  protected override doClassValidation_(\n    newValue?: string,\n  ): string | null | undefined {\n    const options = this.getOptions(true);\n    const isValueValid = options.some((option) => option[1] === newValue);\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: ' +\n            this.sourceBlock_.type +\n            ', Field name: ' +\n            this.name +\n            ', Value: ' +\n            newValue,\n        );\n      }\n      return null;\n    }\n    return newValue;\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: string) {\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  override applyColour() {\n    const sourceBlock = this.sourceBlock_ as BlockSvg;\n    if (this.borderRect_) {\n      this.borderRect_.setAttribute('stroke', sourceBlock.getColourTertiary());\n      if (this.menu_) {\n        this.borderRect_.setAttribute('fill', sourceBlock.getColourTertiary());\n      } else {\n        this.borderRect_.setAttribute('fill', 'transparent');\n      }\n    }\n    // Update arrow's colour.\n    if (sourceBlock && this.arrow) {\n      if (sourceBlock.isShadow()) {\n        this.arrow.style.fill = sourceBlock.getColourSecondary();\n      } else {\n        this.arrow.style.fill = sourceBlock.getColour();\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 (isImageProperties(option)) {\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,\n      'xlink:href',\n      imageJson.src,\n    );\n    this.imageElement!.setAttribute('height', String(imageJson.height));\n    this.imageElement!.setAttribute('width', String(imageJson.width));\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 + FieldDropdown.IMAGE_Y_PADDING,\n    );\n    const xPadding = hasBorder\n      ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING\n      : 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      );\n    } else {\n      arrowWidth = dom.getTextWidth(this.arrow as SVGTSpanElement);\n    }\n    this.size_ = new Size(imageWidth + arrowWidth + xPadding * 2, height);\n\n    let arrowX = 0;\n    if (block.RTL) {\n      const imageX = xPadding + arrowWidth;\n      this.imageElement!.setAttribute('x', `${imageX}`);\n    } else {\n      arrowX = imageWidth + arrowWidth;\n      this.getTextElement().setAttribute('text-anchor', 'end');\n      this.imageElement!.setAttribute('x', `${xPadding}`);\n    }\n    this.imageElement!.setAttribute('y', String(height / 2 - imageHeight / 2));\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    );\n    const textWidth = dom.getTextWidth(this.getTextElement());\n    const xPadding = hasBorder\n      ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING\n      : 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    }\n    this.size_ = new Size(textWidth + arrowWidth + xPadding * 2, 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 = hasBorder\n      ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING\n      : 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',\n      'translate(' + arrowX + ',' + y + ')',\n    );\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\n   * an image we return the image alt text. If the selected option is\n   * an HTMLElement, return the title, ariaLabel, or innerText of the\n   * element.\n   *\n   * If you use HTMLElement options in Node.js and call this function,\n   * ensure that you are supplying an implementation of HTMLElement,\n   * such as through jsdom-global.\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 (isImageProperties(option)) {\n      return option.alt;\n    } else if (\n      typeof HTMLElement !== 'undefined' &&\n      option instanceof HTMLElement\n    ) {\n      return option.title ?? option.ariaLabel ?? option.innerText;\n    } else if (typeof option === 'string') {\n      return option;\n    }\n\n    console.warn(\n      \"Can't get text for existing dropdown option. If \" +\n        \"you're using HTMLElement dropdown options in node, ensure you're \" +\n        'using jsdom-global or similar.',\n    );\n    return null;\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 override fromJson(\n    options: FieldDropdownFromJsonConfig,\n  ): 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    }\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   * Factor out common words in statically defined options.\n   * Create prefix and/or suffix labels.\n   */\n  protected trimOptions(options: MenuOption[]): {\n    options: MenuOption[];\n    prefix?: string;\n    suffix?: string;\n  } {\n    let hasNonTextContent = false;\n    const trimmedOptions = options.map((option): MenuOption => {\n      if (option === FieldDropdown.SEPARATOR) {\n        hasNonTextContent = true;\n        return option;\n      }\n\n      const [label, value] = option;\n      if (typeof label === 'string') {\n        return [parsing.replaceMessageReferences(label), value];\n      }\n\n      hasNonTextContent = true;\n      // Copy the image properties so they're not influenced by the original.\n      // NOTE: No need to deep copy since image properties are only 1 level deep.\n      const imageLabel = isImageProperties(label)\n        ? {...label, alt: parsing.replaceMessageReferences(label.alt)}\n        : label;\n      return [imageLabel, value];\n    });\n\n    if (hasNonTextContent || options.length < 2) {\n      return {options: trimmedOptions};\n    }\n\n    const stringOptions = trimmedOptions as [string, string][];\n    const stringLabels = stringOptions.map(([label]) => label);\n\n    const shortest = utilsString.shortestStringLength(stringLabels);\n    const prefixLength = utilsString.commonWordPrefix(stringLabels, shortest);\n    const suffixLength = utilsString.commonWordSuffix(stringLabels, shortest);\n\n    if (\n      (!prefixLength && !suffixLength) ||\n      shortest <= prefixLength + suffixLength\n    ) {\n      // One or more strings will entirely vanish if we proceed.  Abort.\n      return {options: stringOptions};\n    }\n\n    const prefix = prefixLength\n      ? stringLabels[0].substring(0, prefixLength - 1)\n      : undefined;\n    const suffix = suffixLength\n      ? stringLabels[0].substr(1 - suffixLength)\n      : undefined;\n    return {\n      options: this.applyTrim(stringOptions, prefixLength, suffixLength),\n      prefix,\n      suffix,\n    };\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  private applyTrim(\n    options: [string, string][],\n    prefixLength: number,\n    suffixLength: number,\n  ): MenuOption[] {\n    return options.map(([text, value]) => [\n      text.substring(prefixLength, text.length - suffixLength),\n      value,\n    ]);\n  }\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   */\n  protected validateOptions(options: MenuOption[]) {\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 option = options[i];\n      if (!Array.isArray(option) && option !== FieldDropdown.SEPARATOR) {\n        foundError = true;\n        console.error(\n          `Invalid option[${i}]: Each FieldDropdown option must be an array or\n          the string literal 'separator'. Found: ${option}`,\n        );\n      } else if (typeof option[1] !== 'string') {\n        foundError = true;\n        console.error(\n          `Invalid option[${i}]: Each FieldDropdown option id must be a string.\n          Found ${option[1]} in: ${option}`,\n        );\n      } else if (\n        option[0] &&\n        typeof option[0] !== 'string' &&\n        !isImageProperties(option[0]) &&\n        !(\n          typeof HTMLElement !== 'undefined' && option[0] instanceof HTMLElement\n        )\n      ) {\n        foundError = true;\n        console.error(\n          `Invalid option[${i}]: Each FieldDropdown option must have a string\n          label, image description, or HTML element. Found ${option[0]} in: ${option}`,\n        );\n      }\n    }\n    if (foundError) {\n      throw TypeError('Found invalid FieldDropdown options.');\n    }\n  }\n}\n\n/**\n * Returns whether or not an object conforms to the ImageProperties interface.\n *\n * @param obj The object to test.\n * @returns True if the object conforms to ImageProperties, otherwise false.\n */\nfunction isImageProperties(obj: any): obj is ImageProperties {\n  return (\n    obj &&\n    typeof obj === 'object' &&\n    'src' in obj &&\n    typeof obj.src === 'string' &&\n    'alt' in obj &&\n    typeof obj.alt === 'string' &&\n    'width' in obj &&\n    typeof obj.width === 'number' &&\n    'height' in obj &&\n    typeof obj.height === 'number'\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. Can be either the string literal\n * `separator` for a menu separator item, or an array for normal action menu\n * items. In the latter case, the first element is the human-readable value\n * (text, ImageProperties object, or HTML element), and the second element is\n * the language-neutral value.\n */\nexport type MenuOption =\n  | [string | ImageProperties | HTMLElement, string]\n  | 'separator';\n\n/**\n * A function that generates an array of menu options for FieldDropdown\n * or its descendants.\n */\nexport type MenuGeneratorFunction = (this: FieldDropdown) => MenuOption[];\n\n/**\n * Either an array of menu options or a function that generates an array of\n * menu options for FieldDropdown or its descendants.\n */\nexport type MenuGenerator = MenuOption[] | MenuGeneratorFunction;\n\n/**\n * Config options for the dropdown field.\n */\nexport type FieldDropdownConfig = FieldConfig;\n\n/**\n * fromJson config for the dropdown field.\n */\nexport interface FieldDropdownFromJsonConfig extends FieldDropdownConfig {\n  options?: MenuOption[];\n}\n\n/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldDropdownValidator = FieldValidator<string>;\n\nfieldRegistry.register('field_dropdown', FieldDropdown);\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Extensions\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.js';\nimport {FieldDropdown} from './field_dropdown.js';\nimport {MutatorIcon} from './icons/mutator_icon.js';\nimport * as parsing from './utils/parsing.js';\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 */\nexport function register<T extends Block>(\n  name: string,\n  initFn: (this: T) => void,\n) {\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 */\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 */\nexport function registerMutator(\n  name: string,\n  mixinObj: AnyDuringMigration,\n  opt_helperFn?: () => AnyDuringMigration,\n  opt_blockList?: string[],\n) {\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 MutatorIcon(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 */\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/**\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 */\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 */\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 (\n      !mutatorPropertiesMatch(mutatorProperties as AnyDuringMigration[], block)\n    ) {\n      throw Error(\n        'Error when applying extension \"' +\n          name +\n          '\": ' +\n          'mutation properties changed when applying a non-mutator extension.',\n      );\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 \"' +\n        mutationName +\n        '\" to a block that already has mutator functions.' +\n        '  Block id: ' +\n        block.id,\n    );\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,\n  errorPrefix: string,\n): boolean {\n  return checkHasFunctionPair(\n    object.mutationToDom,\n    object.domToMutation,\n    errorPrefix + ' mutationToDom/domToMutation',\n  );\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,\n  errorPrefix: string,\n): boolean {\n  return checkHasFunctionPair(\n    object.saveExtraState,\n    object.loadExtraState,\n    errorPrefix + ' saveExtraState/loadExtraState',\n  );\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,\n  errorPrefix: string,\n): boolean {\n  return checkHasFunctionPair(\n    object.compose,\n    object.decompose,\n    errorPrefix + ' compose/decompose',\n  );\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,\n  func2: AnyDuringMigration,\n  errorPrefix: string,\n): 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,\n  object: AnyDuringMigration,\n) {\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  }\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[],\n  block: Block,\n): 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 * @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 */\nexport function buildTooltipForDropdown(\n  dropdownName: string,\n  lookupTable: {[key: string]: string},\n): (this: Block) => void {\n  // List of block types already validated, to minimize duplicate warnings.\n  const blockTypesChecked: string[] = [];\n\n  return function (this: Block) {\n    if (!blockTypesChecked.includes(this.type)) {\n      checkDropdownOptionsInTable(this, dropdownName, lookupTable);\n      blockTypesChecked.push(this.type);\n    }\n\n    this.setTooltip(\n      function (this: Block) {\n        const value = String(this.getFieldValue(dropdownName));\n        return parsing.replaceMessageReferences(lookupTable[value]);\n      }.bind(this),\n    );\n  };\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,\n  dropdownName: string,\n  lookupTable: {[key: string]: string},\n) {\n  const dropdown = block.getField(dropdownName);\n  if (!(dropdown instanceof FieldDropdown) || dropdown.isOptionListDynamic()) {\n    return;\n  }\n\n  const options = dropdown.getOptions();\n  for (const option of options) {\n    if (option === FieldDropdown.SEPARATOR) continue;\n\n    const [, key] = option;\n    if (lookupTable[key] === undefined) {\n      console.warn(\n        `No tooltip mapping for value ${key} 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 */\nexport function buildTooltipWithFieldText(\n  msgTemplate: string,\n  fieldName: string,\n): (this: Block) => void {\n  return function (this: Block) {\n    this.setTooltip(\n      function (this: Block) {\n        const field = this.getField(fieldName);\n        return parsing\n          .replaceMessageReferences(msgTemplate)\n          .replace('%1', field ? field.getText() : '');\n      }.bind(this),\n    );\n  };\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(\n    function (this: Block) {\n      const parent = this.getParent();\n      return (\n        (parent && parent.getInputsInline() && parent.tooltip) ||\n        tooltipWhenNotConnected\n      );\n    }.bind(this),\n  );\n}\nregister('parent_tooltip_when_inline', extensionParentTooltip);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.svgPaths\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 */\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 */\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 */\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 */\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 */\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 */\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 */\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 */\nexport function arc(\n  command: string,\n  flags: string,\n  radius: number,\n  point: string,\n): string {\n  return command + ' ' + radius + ' ' + radius + ' ' + flags + point;\n}\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 */\n// Former goog.module ID: 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 {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Input} from './inputs/input.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport * as blocks from './serialization/blocks.js';\nimport {idGenerator} from './utils.js';\nimport * as Xml from './xml.js';\n\n/**\n * Class for a connection between blocks.\n */\nexport class Connection {\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  /** The unique ID of this connection. */\n  id: string;\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(\n    source: Block,\n    public type: number,\n  ) {\n    this.sourceBlock_ = source;\n    if (source.id.includes('_connection')) {\n      throw new Error(\n        `Connection ID indicator is contained in block ID. This will cause ` +\n          `problems with focus: ${source.id}.`,\n      );\n    }\n    this.id = `${source.id}_connection_${idGenerator.getNextUniqueId()}`;\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.disconnectInternal(false);\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.disconnectInternal();\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 = new (eventUtils.get(EventType.BLOCK_MOVE))(\n        childBlock,\n      ) as BlockMove;\n      event.setReason(['connect']);\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 =\n        this.type === INPUT\n          ? orphan.outputConnection\n          : orphan.previousConnection;\n      if (!orphanConnection) return;\n      const connection = Connection.getConnectionForOrphanedConnection(\n        childBlock,\n        orphanConnection,\n      );\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      if (this.isSuperior()) {\n        // Destroy the attached shadow block & its children (if it exists).\n        this.setShadowStateInternal();\n      }\n\n      const targetBlock = this.targetBlock();\n      if (targetBlock && !targetBlock.isDeadOrDying()) {\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 (\n      this.type === ConnectionType.INPUT_VALUE ||\n      this.type === ConnectionType.NEXT_STATEMENT\n    );\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 _superiorConnection Connection that this connection failed to connect\n   *     to. The provided connection should be the superior connection.\n   * @internal\n   */\n  onFailedConnect(_superiorConnection: Connection) {}\n  // NOP\n\n  /**\n   * Connect this connection to another connection.\n   *\n   * @param otherConnection Connection to connect to.\n   * @returns Whether 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 existingGroup = eventUtils.getGroup();\n      if (!existingGroup) {\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      eventUtils.setGroup(existingGroup);\n    }\n\n    return this.isConnected();\n  }\n\n  /**\n   * Disconnect this connection.\n   */\n  disconnect() {\n    this.disconnectInternal();\n  }\n\n  /**\n   * Disconnect two blocks that are connected by this connection.\n   *\n   * @param setParent Whether to set the parent of the disconnected block or\n   *     not, defaults to true.\n   *     If you do not set the parent, ensure that a subsequent action does,\n   *     otherwise the view and model will be out of sync.\n   */\n  protected disconnectInternal(setParent = true) {\n    const {parentConnection, childConnection} =\n      this.getParentAndChildConnections();\n    if (!parentConnection || !childConnection) {\n      throw Error('Source connection not connected.');\n    }\n\n    const existingGroup = eventUtils.getGroup();\n    if (!existingGroup) {\n      eventUtils.setGroup(true);\n    }\n\n    let event;\n    if (eventUtils.isEnabled()) {\n      event = new (eventUtils.get(EventType.BLOCK_MOVE))(\n        childConnection.getSourceBlock(),\n      ) as BlockMove;\n      event.setReason(['disconnect']);\n    }\n    const otherConnection = this.targetConnection;\n    if (otherConnection) {\n      otherConnection.targetConnection = null;\n    }\n    this.targetConnection = null;\n    if (setParent) childConnection.getSourceBlock().setParent(null);\n    if (event) {\n      event.recordNew();\n      eventUtils.fire(event);\n    }\n\n    if (!childConnection.getSourceBlock().isShadow()) {\n      // If we were disconnecting a shadow, no need to spawn a new one.\n      parentConnection.respawnShadow_();\n    }\n\n    eventUtils.setGroup(existingGroup);\n  }\n\n  /**\n   * Returns the parent connection (superior) and child connection (inferior)\n   * given this connection and the connection it is connected to.\n   *\n   * @returns The parent connection and child connection, given this connection\n   *     and the connection it is connected to.\n   */\n  protected getParentAndChildConnections(): {\n    parentConnection?: Connection;\n    childConnection?: Connection;\n  } {\n    if (!this.targetConnection) return {};\n    if (this.isSuperior()) {\n      return {\n        parentConnection: this,\n        childConnection: this.targetConnection,\n      };\n    }\n    return {\n      parentConnection: this.targetConnection,\n      childConnection: this,\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   * Reconnects this connection to the input with the given name on the given\n   * block. If there is already a connection connected to that input, that\n   * connection is disconnected.\n   *\n   * @param block The block to connect this connection to.\n   * @param inputName The name of the input to connect this connection to.\n   * @returns True if this connection was able to connect, false otherwise.\n   */\n  reconnect(block: Block, inputName: string): boolean {\n    // No need to reconnect if this connection's block is deleted.\n    if (this.getSourceBlock().isDeadOrDying()) return false;\n\n    const connectionParent = block.getInput(inputName)?.connection;\n    const currentParent = this.targetBlock();\n    if (\n      (!currentParent || currentParent === block) &&\n      connectionParent &&\n      connectionParent.targetConnection !== this\n    ) {\n      if (connectionParent.isConnected()) {\n        // There's already something connected here.  Get rid of it.\n        connectionParent.disconnect();\n      }\n      connectionParent.connect(this);\n      return true;\n    }\n    return false;\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 (\n      this.isConnected() &&\n      (!this.targetConnection ||\n        !this.getConnectionChecker().canConnect(\n          this,\n          this.targetConnection,\n          false,\n        ))\n    ) {\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:class).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;\n    shadowState: blocks.State | null;\n  } {\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({\n    shadowDom,\n    shadowState,\n  }: {\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({\n    shadowDom = null,\n    shadowState = null,\n  }: {\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    if (this.getSourceBlock().isDeadOrDying()) return;\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.domToBlockInternal(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      }\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,\n    orphanConnection: Connection,\n  ): Connection | null {\n    if (orphanConnection.type === ConnectionType.OUTPUT_VALUE) {\n      return getConnectionForOrphanedOutput(\n        startBlock,\n        orphanConnection.getSourceBlock(),\n      );\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(\n  block: Block,\n  orphanBlock: Block,\n): Connection | 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,\n  orphanBlock: Block,\n): 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 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IconType} from '../icons/icon_types.js';\nimport type {Coordinate} from '../utils/coordinate.js';\nimport type {Size} from '../utils/size.js';\nimport {IFocusableNode, isFocusableNode} from './i_focusable_node.js';\n\nexport interface IIcon extends IFocusableNode {\n  /**\n   * @returns the IconType representing the type of the icon. This value should\n   *     also be used to register the icon via `Blockly.icons.registry.register`.\n   */\n  getType(): IconType<IIcon>;\n\n  /**\n   * Creates the SVG elements for the icon that will live on the block.\n   *\n   * @param pointerdownListener An event listener that must be attached to the\n   *     root SVG element by the implementation of `initView`. Used by Blockly's\n   *     gesture system to properly handle clicks and drags.\n   */\n  initView(pointerdownListener: (e: PointerEvent) => void): void;\n\n  /**\n   * Disposes of any elements of the icon.\n   *\n   * @remarks\n   *\n   * In particular, if this icon is currently showing a bubble, this should be\n   * used to hide it.\n   */\n  dispose(): void;\n\n  /**\n   * @returns the \"weight\" of the icon, which determines the static order which\n   *     icons should be rendered in. More positive numbers are rendered farther\n   *     toward the end of the block.\n   */\n  getWeight(): number;\n\n  /** @returns The dimensions of the icon for use in rendering. */\n  getSize(): Size;\n\n  /** Updates the icon's color when the block's color changes.. */\n  applyColour(): void;\n\n  /** Hides the icon when it is part of an insertion marker. */\n  hideForInsertionMarker(): void;\n\n  /** Updates the icon's editability when the block's editability changes. */\n  updateEditable(): void;\n\n  /**\n   * Updates the icon's collapsed-ness/view when the block's collapsed-ness\n   * changes.\n   */\n  updateCollapsed(): void;\n\n  /**\n   * @returns Whether this icon is shown when the block is collapsed. Used\n   *     to allow renderers to account for padding.\n   */\n  isShownWhenCollapsed(): boolean;\n\n  /**\n   * Notifies the icon where it is relative to its block's top-start, in\n   * workspace units.\n   */\n  setOffsetInBlock(offset: Coordinate): void;\n\n  /**\n   * Notifies the icon that it has changed locations.\n   *\n   * @param blockOrigin The location of this icon's block's top-start corner\n   *     in workspace coordinates.\n   */\n  onLocationChange(blockOrigin: Coordinate): void;\n\n  /**\n   * Notifies the icon that it has been clicked.\n   */\n  onClick(): void;\n\n  /**\n   * Check whether the icon should be clickable while the block is in a flyout.\n   * If this function is not defined, the icon will be clickable in all flyouts.\n   *\n   * @param autoClosingFlyout true if the containing flyout is an auto-closing one.\n   * @returns Whether the icon should be clickable while the block is in a flyout.\n   */\n  isClickableInFlyout?(autoClosingFlyout: boolean): boolean;\n}\n\n/** Type guard that checks whether the given object is an IIcon. */\nexport function isIcon(obj: any): obj is IIcon {\n  return (\n    isFocusableNode(obj) &&\n    typeof (obj as IIcon).getType === 'function' &&\n    typeof (obj as IIcon).initView === 'function' &&\n    typeof (obj as IIcon).dispose === 'function' &&\n    typeof (obj as IIcon).getWeight === 'function' &&\n    typeof (obj as IIcon).getSize === 'function' &&\n    typeof (obj as IIcon).applyColour === 'function' &&\n    typeof (obj as IIcon).hideForInsertionMarker === 'function' &&\n    typeof (obj as IIcon).updateEditable === 'function' &&\n    typeof (obj as IIcon).updateCollapsed === 'function' &&\n    typeof (obj as IIcon).isShownWhenCollapsed === 'function' &&\n    typeof (obj as IIcon).setOffsetInBlock === 'function' &&\n    typeof (obj as IIcon).onLocationChange === 'function' &&\n    typeof (obj as IIcon).onClick === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CommentState} from '../icons/comment_icon.js';\nimport {IconType} from '../icons/icon_types.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport {Size} from '../utils/size.js';\nimport {IHasBubble, hasBubble} from './i_has_bubble.js';\nimport {IIcon, isIcon} from './i_icon.js';\nimport {ISerializable, isSerializable} from './i_serializable.js';\n\nexport interface ICommentIcon extends IIcon, IHasBubble, ISerializable {\n  setText(text: string): void;\n\n  getText(): string;\n\n  setBubbleSize(size: Size): void;\n\n  getBubbleSize(): Size;\n\n  setBubbleLocation(location: Coordinate): void;\n\n  getBubbleLocation(): Coordinate | undefined;\n\n  saveState(): CommentState;\n\n  loadState(state: CommentState): void;\n}\n\n/** Checks whether the given object is an ICommentIcon. */\nexport function isCommentIcon(obj: any): obj is ICommentIcon {\n  return (\n    isIcon(obj) &&\n    hasBubble(obj) &&\n    isSerializable(obj) &&\n    typeof (obj as any).setText === 'function' &&\n    typeof (obj as any).getText === 'function' &&\n    typeof (obj as any).setBubbleSize === 'function' &&\n    typeof (obj as any).getBubbleSize === 'function' &&\n    typeof (obj as any).setBubbleLocation === 'function' &&\n    typeof (obj as any).getBubbleLocation === 'function' &&\n    obj.getType() === IconType.COMMENT\n  );\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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/** 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/** The wobbling block.  There can only be one at a time. */\nlet wobblingBlock: BlockSvg | null = null;\n\n/**\n * Play some UI effects (sound, animation) when disposing of a block.\n *\n * @param block The block being disposed of.\n * @internal\n */\nexport function disposeUiEffect(block: BlockSvg) {\n  // Disposing is going to take so long the animation won't play anyway.\n  if (block.getDescendants(false).length > 100) return;\n\n  const workspace = block.workspace;\n  const svgGroup = block.getSvgRoot();\n  workspace.getAudioManager().play('delete');\n\n  const xy = block.getRelativeToSurfaceXY();\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.getLayerManager()?.appendToAnimationLayer({\n    getSvgRoot: () => {\n      return clone;\n    },\n  });\n  const cloneRect = {\n    'x': xy.x,\n    'y': xy.y,\n    'width': block.width,\n    'height': block.height,\n  };\n  disposeUiStep(clone, cloneRect, workspace.RTL, new Date());\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 */\nfunction disposeUiStep(\n  clone: Element,\n  rect: CloneRect,\n  rtl: boolean,\n  start: Date,\n) {\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 = rect.x + (((rtl ? -1 : 1) * rect.width) / 2) * percent;\n    const y = rect.y + (rect.height / 2) * percent;\n    const scale = 1 - percent;\n    clone.setAttribute(\n      'transform',\n      'translate(' + x + ',' + y + ')' + ' scale(' + scale + ')',\n    );\n    setTimeout(disposeUiStep, 10, clone, rect, rtl, start);\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 * @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    {\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  );\n\n  const scaleAnimation = dom.createSvgElement(\n    Svg.ANIMATE,\n    {\n      'id': 'animationCircle',\n      'begin': 'indefinite',\n      'attributeName': 'r',\n      'dur': '150ms',\n      'from': 0,\n      'to': 25 * scale,\n    },\n    ripple,\n  );\n  const opacityAnimation = dom.createSvgElement(\n    Svg.ANIMATE,\n    {\n      'id': 'animationOpacity',\n      'begin': 'indefinite',\n      'attributeName': 'opacity',\n      'dur': '150ms',\n      'from': 1,\n      'to': 0,\n    },\n    ripple,\n  );\n\n  scaleAnimation.beginElement();\n  opacityAnimation.beginElement();\n\n  setTimeout(() => void dom.removeNode(ripple), 150);\n}\n\n/**\n * Play some UI effects (sound, animation) when disconnecting a block.\n *\n * @param block The block being disconnected.\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  wobblingBlock = block;\n  disconnectUiStep(block, magnitude, new Date(), 0);\n}\n\n/**\n * Animate a brief wiggle of a disconnected block.\n *\n * @param block Block to animate.\n * @param magnitude Maximum degrees skew (reversed for RTL).\n * @param start Date of animation's start for deciding when to stop.\n * @param step Which step of the animation we're on.\n */\nfunction disconnectUiStep(\n  block: BlockSvg,\n  magnitude: number,\n  start: Date,\n  step: number,\n) {\n  const DURATION = 200; // Milliseconds.\n  const WIGGLES = [0.66, 1, 0.66, 0, -0.66, -1, -0.66, 0]; // Single cycle\n\n  let skew = '';\n  if (start.getTime() + DURATION > new Date().getTime()) {\n    const val = Math.round(WIGGLES[step % WIGGLES.length] * magnitude);\n    skew = `skewX(${val})`;\n    disconnectPid = setTimeout(\n      disconnectUiStep,\n      15,\n      block,\n      magnitude,\n      start,\n      step + 1,\n    );\n  }\n\n  block\n    .getSvgRoot()\n    .setAttribute('transform', `${block.getTranslation()} ${skew}`);\n}\n\n/**\n * Stop the disconnect UI animation immediately.\n *\n * @internal\n */\nexport function disconnectUiStop() {\n  if (!wobblingBlock) return;\n  if (disconnectPid) {\n    clearTimeout(disconnectPid);\n    disconnectPid = null;\n  }\n  wobblingBlock\n    .getSvgRoot()\n    .setAttribute('transform', wobblingBlock.getTranslation());\n  wobblingBlock = null;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BlockSvg} from '../block_svg.js';\nimport {IFocusableNode} from '../blockly.js';\nimport {config} from '../config.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {ICopyData} from '../interfaces/i_copyable.js';\nimport {IPaster} from '../interfaces/i_paster.js';\nimport * as renderManagement from '../render_management.js';\nimport {State, append} from '../serialization/blocks.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\nimport * as registry from './registry.js';\n\nexport class BlockPaster implements IPaster<BlockCopyData, BlockSvg> {\n  static TYPE = 'block';\n\n  paste(\n    copyData: BlockCopyData,\n    workspace: WorkspaceSvg,\n    coordinate?: Coordinate,\n  ): BlockSvg | null {\n    if (!workspace.isCapacityAvailable(copyData.typeCounts!)) return null;\n\n    if (coordinate) {\n      copyData.blockState['x'] = coordinate.x;\n      copyData.blockState['y'] = coordinate.y;\n    }\n\n    // After appending the block to the workspace, it will be bumped from its neighbors\n    // However, the algorithm for deciding where to paste a block depends on\n    // the starting position of the copied block, so we'll pass those coordinates along\n    const initialCoordinates =\n      coordinate ||\n      new Coordinate(\n        copyData.blockState['x'] || 0,\n        copyData.blockState['y'] || 0,\n      );\n\n    eventUtils.disable();\n    let block;\n    try {\n      block = append(copyData.blockState, workspace) as BlockSvg;\n      moveBlockToNotConflict(block, initialCoordinates);\n    } finally {\n      eventUtils.enable();\n    }\n\n    if (!block) return block;\n\n    if (eventUtils.isEnabled() && !block.isShadow()) {\n      eventUtils.fire(new (eventUtils.get(EventType.BLOCK_CREATE))(block));\n    }\n\n    // Sometimes there's a delay before the block is fully created and ready for\n    // focusing, so wait slightly before focusing the newly pasted block.\n    const nodeToFocus: IFocusableNode = block;\n    renderManagement\n      .finishQueuedRenders()\n      .then(() => getFocusManager().focusNode(nodeToFocus));\n    return block;\n  }\n}\n\n/**\n * Moves the given block to a location where it does not: (1) overlap exactly\n * with any other blocks, or (2) look like it is connected to any other blocks.\n *\n * Exported for testing.\n *\n * @param block The block to move to an unambiguous location.\n * @param originalPosition The initial coordinate to start searching from,\n *    likely the position of the copied block.\n * @internal\n */\nexport function moveBlockToNotConflict(\n  block: BlockSvg,\n  originalPosition: Coordinate,\n) {\n  if (block.workspace.RTL) {\n    originalPosition.x = block.workspace.getWidth() - originalPosition.x;\n  }\n  const workspace = block.workspace;\n  const snapRadius = config.snapRadius;\n  const bumpOffset = Coordinate.difference(\n    originalPosition,\n    block.getRelativeToSurfaceXY(),\n  );\n  const offset = new Coordinate(0, 0);\n  // getRelativeToSurfaceXY is really expensive, so we want to cache this.\n  const otherCoords = workspace\n    .getAllBlocks(false)\n    .filter((otherBlock) => otherBlock.id != block.id)\n    .map((b) => b.getRelativeToSurfaceXY());\n\n  while (\n    blockOverlapsOtherExactly(\n      Coordinate.sum(originalPosition, offset),\n      otherCoords,\n    ) ||\n    blockIsInSnapRadius(block, Coordinate.sum(bumpOffset, offset), snapRadius)\n  ) {\n    if (workspace.RTL) {\n      offset.translate(-snapRadius, snapRadius * 2);\n    } else {\n      offset.translate(snapRadius, snapRadius * 2);\n    }\n  }\n\n  block!.moveTo(Coordinate.sum(originalPosition, offset));\n}\n\n/**\n * @returns true if the given block coordinates are less than a delta of 1 from\n *     any of the other coordinates.\n */\nfunction blockOverlapsOtherExactly(\n  coord: Coordinate,\n  otherCoords: Coordinate[],\n): boolean {\n  return otherCoords.some(\n    (otherCoord) =>\n      Math.abs(otherCoord.x - coord.x) <= 1 &&\n      Math.abs(otherCoord.y - coord.y) <= 1,\n  );\n}\n\n/**\n * @returns true if the given block (when offset by the given amount) is close\n *     enough to any other connections (within the snap radius) that it looks\n *     like they could connect.\n */\nfunction blockIsInSnapRadius(\n  block: BlockSvg,\n  offset: Coordinate,\n  snapRadius: number,\n): boolean {\n  return block\n    .getConnections_(false)\n    .some((connection) => !!connection.closest(snapRadius, offset).connection);\n}\n\nexport interface BlockCopyData extends ICopyData {\n  blockState: State;\n  typeCounts: {[key: string]: number};\n}\n\nregistry.register(BlockPaster.TYPE, new BlockPaster());\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.bumpObjects\n\nimport {RenderedWorkspaceComment} from './comments/rendered_workspace_comment.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 {CommentResize} from './events/events_comment_resize.js';\nimport {isViewportChange} from './events/predicates.js';\nimport {BUMP_EVENTS, EventType} from './events/type.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 {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Bumps the given object that has passed out of bounds.\n *\n * @param workspace The workspace containing the object.\n * @param bounds The region to bump an object into. For example, pass\n *     ScrollMetrics to bump a block into the scrollable region of the\n *     workspace, or pass ViewMetrics to bump a block into the visible region of\n *     the workspace. This should be specified in workspace coordinates.\n * @param object The object to bump.\n * @returns True if object was bumped.\n */\nfunction bumpObjectIntoBounds(\n  workspace: WorkspaceSvg,\n  bounds: ContainerRegion,\n  object: IBoundedElement,\n): 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 = bounds.top;\n  const boundsBottom = bounds.top + bounds.height;\n  const bottomClamp = boundsBottom - height;\n  // If the object is taller than the workspace we want to\n  // top-align the block\n  const newYPosition = mathUtils.clamp(\n    topClamp,\n    objectMetrics.top,\n    bottomClamp,\n  );\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 = bounds.left;\n  const boundsRight = bounds.left + bounds.width;\n  let rightClamp = boundsRight - 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 = mathUtils.clamp(\n    leftClamp,\n    objectMetrics.left,\n    rightClamp,\n  );\n  const deltaX = newXPosition - objectMetrics.left;\n\n  if (deltaX || deltaY) {\n    object.moveBy(deltaX, deltaY, ['inbounds']);\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 */\nexport function bumpIntoBoundsHandler(\n  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 (BUMP_EVENTS.includes(e.type ?? '')) {\n      const scrollMetricsInWsCoords = metricsManager.getScrollMetrics(true);\n\n      // Triggered by move/create event\n      const object = extractObjectFromEvent(\n        workspace,\n        e as eventUtils.BumpEvent,\n      );\n      if (!object) {\n        return;\n      }\n      // Handle undo.\n      const existingGroup = eventUtils.getGroup() || false;\n      eventUtils.setGroup(e.group);\n\n      const wasBumped = bumpObjectIntoBounds(\n        workspace,\n        scrollMetricsInWsCoords,\n        object as IBoundedElement,\n      );\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      }\n      eventUtils.setGroup(existingGroup);\n    } else if (isViewportChange(e)) {\n      if (e.scale && e.oldScale && e.scale > e.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,\n  e: eventUtils.BumpEvent,\n): IBoundedElement | null {\n  let object = null;\n  switch (e.type) {\n    case EventType.BLOCK_CREATE:\n    case EventType.BLOCK_MOVE:\n      object = workspace.getBlockById((e as BlockCreate | BlockMove).blockId!);\n      if (object) {\n        object = object.getRootBlock();\n      }\n      break;\n    case EventType.COMMENT_CREATE:\n    case EventType.COMMENT_MOVE:\n    case EventType.COMMENT_RESIZE:\n      object = workspace.getCommentById(\n        (e as CommentCreate | CommentMove | CommentResize).commentId!,\n      ) as RenderedWorkspaceComment;\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 */\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 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IDeletable\n\n/**\n * The interface for an object that can be deleted.\n */\nexport interface IDeletable {\n  /**\n   * Get whether this object is deletable or not.\n   *\n   * @returns True if deletable.\n   */\n  isDeletable(): boolean;\n\n  /** Disposes of this object, cleaning up any references or DOM elements. */\n  dispose(): void;\n\n  /** Visually indicates that the object is pending deletion. */\n  setDeleteStyle(wouldDelete: boolean): void;\n}\n\n/** Returns whether the given object is an IDeletable. */\nexport function isDeletable(obj: any): obj is IDeletable {\n  return (\n    obj &&\n    typeof obj.isDeletable === 'function' &&\n    typeof obj.dispose === 'function' &&\n    typeof obj.setDeleteStyle === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BlockSvg} from '../block_svg.js';\nimport {ConnectionType} from '../connection_type.js';\nimport type {Field} from '../field.js';\nimport type {Icon} from '../icons/icon.js';\nimport type {IBoundedElement} from '../interfaces/i_bounded_element.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport {isFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\nimport type {ISelectable} from '../interfaces/i_selectable.js';\nimport {RenderedConnection} from '../rendered_connection.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\n/**\n * Set of rules controlling keyboard navigation from a block.\n */\nexport class BlockNavigationPolicy implements INavigationPolicy<BlockSvg> {\n  /**\n   * Returns the first child of the given block.\n   *\n   * @param current The block to return the first child of.\n   * @returns The first field or input of the given block, if any.\n   */\n  getFirstChild(current: BlockSvg): IFocusableNode | null {\n    const candidates = getBlockNavigationCandidates(current, true);\n    return candidates[0];\n  }\n\n  /**\n   * Returns the parent of the given block.\n   *\n   * @param current The block to return the parent of.\n   * @returns The top block of the given block's stack, or the connection to\n   *     which it is attached.\n   */\n  getParent(current: BlockSvg): IFocusableNode | null {\n    if (current.previousConnection?.targetBlock()) {\n      const surroundParent = current.getSurroundParent();\n      if (surroundParent) return surroundParent;\n    } else if (current.outputConnection?.targetBlock()) {\n      return current.outputConnection.targetBlock();\n    }\n\n    return current.workspace;\n  }\n\n  /**\n   * Returns the next peer node of the given block.\n   *\n   * @param current The block to find the following element of.\n   * @returns The first node of the next input/stack if the given block is a terminal\n   *     block, or its next connection.\n   */\n  getNextSibling(current: BlockSvg): IFocusableNode | null {\n    if (current.nextConnection?.targetBlock()) {\n      return current.nextConnection?.targetBlock();\n    } else if (current.outputConnection?.targetBlock()) {\n      return navigateBlock(current, 1);\n    } else if (current.getSurroundParent()) {\n      return navigateBlock(current.getTopStackBlock(), 1);\n    } else if (this.getParent(current) instanceof WorkspaceSvg) {\n      return navigateStacks(current, 1);\n    }\n\n    return null;\n  }\n\n  /**\n   * Returns the previous peer node of the given block.\n   *\n   * @param current The block to find the preceding element of.\n   * @returns The block's previous/output connection, or the last\n   *     connection/block of the previous block stack if it is a root block.\n   */\n  getPreviousSibling(current: BlockSvg): IFocusableNode | null {\n    if (current.previousConnection?.targetBlock()) {\n      return current.previousConnection?.targetBlock();\n    } else if (current.outputConnection?.targetBlock()) {\n      return navigateBlock(current, -1);\n    } else if (this.getParent(current) instanceof WorkspaceSvg) {\n      return navigateStacks(current, -1);\n    }\n\n    return null;\n  }\n\n  /**\n   * Returns whether or not the given block can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given block can be focused.\n   */\n  isNavigable(current: BlockSvg): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a BlockSvg.\n   */\n  isApplicable(current: any): current is BlockSvg {\n    return current instanceof BlockSvg;\n  }\n}\n\n/**\n * Returns a list of the navigable children of the given block.\n *\n * @param block The block to retrieve the navigable children of.\n * @returns A list of navigable/focusable children of the given block.\n */\nfunction getBlockNavigationCandidates(\n  block: BlockSvg,\n  forward: boolean,\n): IFocusableNode[] {\n  const candidates: IFocusableNode[] = block.getIcons();\n\n  for (const input of block.inputList) {\n    if (!input.isVisible()) continue;\n    candidates.push(...input.fieldRow);\n    if (input.connection?.targetBlock()) {\n      const connectedBlock = input.connection.targetBlock() as BlockSvg;\n      if (input.connection.type === ConnectionType.NEXT_STATEMENT && !forward) {\n        const lastStackBlock = connectedBlock\n          .lastConnectionInStack(false)\n          ?.getSourceBlock();\n        if (lastStackBlock) {\n          candidates.push(lastStackBlock);\n        }\n      } else {\n        candidates.push(connectedBlock);\n      }\n    } else if (input.connection?.type === ConnectionType.INPUT_VALUE) {\n      candidates.push(input.connection as RenderedConnection);\n    }\n  }\n\n  return candidates;\n}\n\n/**\n * Returns the next/previous stack relative to the given element's stack.\n *\n * @param current The element whose stack will be navigated relative to.\n * @param delta The difference in index to navigate; positive values navigate\n *     to the nth next stack, while negative values navigate to the nth previous\n *     stack.\n * @returns The first element in the stack offset by `delta` relative to the\n *     current element's stack, or the last element in the stack offset by\n * `delta` relative to the current element's stack when navigating backwards.\n */\nexport function navigateStacks(current: ISelectable, delta: number) {\n  const stacks: IFocusableNode[] = (current.workspace as WorkspaceSvg)\n    .getTopBoundedElements(true)\n    .filter((element: IBoundedElement) => isFocusableNode(element));\n  const currentIndex = stacks.indexOf(\n    current instanceof BlockSvg ? current.getRootBlock() : current,\n  );\n  const targetIndex = currentIndex + delta;\n  let result: IFocusableNode | null = null;\n  if (targetIndex >= 0 && targetIndex < stacks.length) {\n    result = stacks[targetIndex];\n  } else if (targetIndex < 0) {\n    result = stacks[stacks.length - 1];\n  } else if (targetIndex >= stacks.length) {\n    result = stacks[0];\n  }\n\n  // When navigating to a previous block stack, our previous sibling is the last\n  // block in it.\n  if (delta < 0 && result instanceof BlockSvg) {\n    return result.lastConnectionInStack(false)?.getSourceBlock() ?? result;\n  }\n\n  return result;\n}\n\n/**\n * Returns the next navigable item relative to the provided block child.\n *\n * @param current The navigable block child item to navigate relative to.\n * @param delta The difference in index to navigate; positive values navigate\n *     forward by n, while negative values navigate backwards by n.\n * @returns The navigable block child offset by `delta` relative to `current`.\n */\nexport function navigateBlock(\n  current: Icon | Field | RenderedConnection | BlockSvg,\n  delta: number,\n): IFocusableNode | null {\n  const block =\n    current instanceof BlockSvg\n      ? (current.outputConnection?.targetBlock() ?? current.getSurroundParent())\n      : current.getSourceBlock();\n  if (!(block instanceof BlockSvg)) return null;\n\n  const candidates = getBlockNavigationCandidates(block, delta > 0);\n  const currentIndex = candidates.indexOf(current);\n  if (currentIndex === -1) return null;\n\n  const targetIndex = currentIndex + delta;\n  if (targetIndex >= 0 && targetIndex < candidates.length) {\n    return candidates[targetIndex];\n  }\n\n  return null;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Block} from '../block.js';\nimport type {IIcon} from '../interfaces/i_icon.js';\nimport * as registry from '../registry.js';\nimport {IconType} from './icon_types.js';\n\n/**\n * Registers the given icon so that it can be deserialized.\n *\n * @param type The type of the icon to register. This should be the same string\n *     that is returned from its `getType` method.\n * @param iconConstructor The icon class/constructor to register.\n */\nexport function register(\n  type: IconType<IIcon>,\n  iconConstructor: new (block: Block) => IIcon,\n) {\n  registry.register(registry.Type.ICON, type.toString(), iconConstructor);\n}\n\n/**\n * Unregisters the icon associated with the given type.\n *\n * @param type The type of the icon to unregister.\n */\nexport function unregister(type: string) {\n  registry.unregister(registry.Type.ICON, type);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Coordinate} from '../utils/coordinate';\n\n/**\n * Represents an object that can be dragged.\n */\nexport interface IDraggable extends IDragStrategy {\n  /**\n   * Returns the current location of the draggable in workspace\n   * coordinates.\n   *\n   * @returns Coordinate of current location on workspace.\n   */\n  getRelativeToSurfaceXY(): Coordinate;\n}\n\nexport interface IDragStrategy {\n  /** Returns true iff the element is currently movable. */\n  isMovable(): boolean;\n\n  /**\n   * Handles any drag startup (e.g moving elements to the front of the\n   * workspace).\n   *\n   * @param e PointerEvent that started the drag; can be used to\n   *     check modifier keys, etc.  May be missing when dragging is\n   *     triggered programatically rather than by user.\n   */\n  startDrag(e?: PointerEvent): void;\n\n  /**\n   * Handles moving elements to the new location, and updating any\n   * visuals based on that (e.g connection previews for blocks).\n   *\n   * @param newLoc Workspace coordinate to which the draggable has\n   *     been dragged.\n   * @param e PointerEvent that continued the drag.  Can be\n   *     used to check modifier keys, etc.\n   */\n  drag(newLoc: Coordinate, e?: PointerEvent): void;\n\n  /**\n   * Handles any drag cleanup, including e.g. connecting or deleting\n   * blocks.\n   *\n   * @param newLoc Workspace coordinate at which the drag finished.\n   *     been dragged.\n   * @param e PointerEvent that finished the drag.  Can be\n   *     used to check modifier keys, etc.\n   */\n  endDrag(e?: PointerEvent): void;\n\n  /** Moves the draggable back to where it was at the start of the drag. */\n  revertDrag(): void;\n}\n\n/** Returns whether the given object is an IDraggable or not. */\nexport function isDraggable(obj: any): obj is IDraggable {\n  return (\n    obj &&\n    typeof obj.getRelativeToSurfaceXY === 'function' &&\n    typeof obj.isMovable === 'function' &&\n    typeof obj.startDrag === 'function' &&\n    typeof obj.drag === 'function' &&\n    typeof obj.endDrag === 'function' &&\n    typeof obj.revertDrag === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IAutoHideable\n\nimport type {IComponent} from './i_component.js';\n\n/**\n * Interface for a component that can be automatically hidden.\n */\nexport interface IAutoHideable extends IComponent {\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): void;\n}\n\n/** Returns true if the given object is autohideable. */\nexport function isAutoHideable(obj: any): obj is IAutoHideable {\n  return obj && typeof obj.autoHide === 'function';\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.procedures.IProcedureBlock\n\nimport type {Block} from '../block.js';\nimport {IProcedureModel} from './i_procedure_model.js';\n\n/** The interface for a block which models a procedure. */\nexport interface IProcedureBlock {\n  getProcedureModel(): IProcedureModel;\n  doProcedureUpdate(): void;\n  isProcedureDef(): boolean;\n}\n\n/** A type guard which checks if the given block is a procedure block. */\nexport function isProcedureBlock(\n  block: Block | IProcedureBlock,\n): block is IProcedureBlock {\n  block = block as IProcedureBlock;\n  return (\n    typeof block.getProcedureModel === 'function' &&\n    typeof block.doProcedureUpdate === 'function' &&\n    typeof block.isProcedureDef === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * An object that fires events optionally.\n *\n * @internal\n */\nexport interface IObservable {\n  startPublishing(): void;\n  stopPublishing(): void;\n}\n\n/**\n * Type guard for checking if an object fulfills IObservable.\n *\n * @internal\n */\nexport function isObservable(obj: any): obj is IObservable {\n  return (\n    obj &&\n    typeof obj.startPublishing === 'function' &&\n    typeof obj.stopPublishing === 'function'\n  );\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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 {\n  isBlockChange,\n  isBlockCreate,\n  isBlockDelete,\n  isBlockFieldIntermediateChange,\n  isBubbleOpen,\n} from './events/predicates.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {Field, UnattachedFieldError} from './field.js';\nimport {MutatorIcon} from './icons.js';\nimport {\n  isLegacyProcedureCallBlock,\n  isLegacyProcedureDefBlock,\n  ProcedureBlock,\n  ProcedureTuple,\n} from './interfaces/i_legacy_procedure_blocks.js';\nimport {IParameterModel} from './interfaces/i_parameter_model.js';\nimport {\n  IProcedureBlock,\n  isProcedureBlock,\n} from './interfaces/i_procedure_block.js';\nimport {IProcedureMap} from './interfaces/i_procedure_map.js';\nimport {IProcedureModel} from './interfaces/i_procedure_model.js';\nimport {Msg} from './msg.js';\nimport {Names} from './names.js';\nimport {ObservableProcedureMap} from './observable_procedure_map.js';\nimport * as deprecation from './utils/deprecation.js';\nimport type {FlyoutItemInfo} from './utils/toolbox.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';\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 */\nexport const CATEGORY_NAME = 'PROCEDURE';\n\n/**\n * The default argument for a procedures_mutatorarg block.\n */\nexport const DEFAULT_ARG = 'x';\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 */\nexport function allProcedures(\n  root: Workspace,\n): [ProcedureTuple[], ProcedureTuple[]] {\n  const proceduresNoReturn: ProcedureTuple[] = root\n    .getProcedureMap()\n    .getProcedures()\n    .filter((p) => !p.getReturnTypes())\n    .map((p) => [\n      p.getName(),\n      p.getParameters().map((pa) => pa.getName()),\n      false,\n    ]);\n  root.getBlocksByType('procedures_defnoreturn', false).forEach((b) => {\n    if (!isProcedureBlock(b) && isLegacyProcedureDefBlock(b)) {\n      proceduresNoReturn.push(b.getProcedureDef());\n    }\n  });\n\n  const proceduresReturn: ProcedureTuple[] = root\n    .getProcedureMap()\n    .getProcedures()\n    .filter((p) => !!p.getReturnTypes())\n    .map((p) => [\n      p.getName(),\n      p.getParameters().map((pa) => pa.getName()),\n      true,\n    ]);\n  root.getBlocksByType('procedures_defreturn', false).forEach((b) => {\n    if (!isProcedureBlock(b) && isLegacyProcedureDefBlock(b)) {\n      proceduresReturn.push(b.getProcedureDef());\n    }\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 */\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,\n  workspace: Workspace,\n  opt_exclude?: Block,\n): 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 */\nexport function isNameUsed(\n  name: string,\n  workspace: Workspace,\n  opt_exclude?: Block,\n): boolean {\n  for (const block of workspace.getAllBlocks(false)) {\n    if (block === opt_exclude) continue;\n\n    if (\n      isLegacyProcedureDefBlock(block) &&\n      Names.equals(block.getProcedureDef()[0], name)\n    ) {\n      return true;\n    }\n  }\n\n  const excludeModel =\n    opt_exclude && isProcedureBlock(opt_exclude)\n      ? opt_exclude?.getProcedureModel()\n      : undefined;\n  for (const model of workspace.getProcedureMap().getProcedures()) {\n    if (model === excludeModel) continue;\n    if (Names.equals(model.getName(), name)) return true;\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 */\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  if (isProcedureBlock(block) && !block.isInsertionMarker()) {\n    block.getProcedureModel().setName(legalName);\n  }\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 */\nfunction xmlFlyoutCategory(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    );\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    );\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[],\n    templateName: string,\n  ) {\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 * Internal wrapper that returns the contents of the procedure category.\n *\n * @internal\n * @param workspace The workspace to populate procedure blocks for.\n */\nexport function internalFlyoutCategory(\n  workspace: WorkspaceSvg,\n): FlyoutItemInfo[] {\n  return flyoutCategory(workspace, false);\n}\n\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml: true,\n): Element[];\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml: false,\n): FlyoutItemInfo[];\n/**\n * Construct the blocks required by the flyout for the procedure category.\n *\n * @param workspace The workspace containing procedures.\n * @param useXml True to return the contents as XML, false to use JSON.\n * @returns List of flyout contents as either XML or JSON.\n */\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml = true,\n): Element[] | FlyoutItemInfo[] {\n  if (useXml) {\n    deprecation.warn(\n      'The XML return value of Blockly.Procedures.flyoutCategory()',\n      'v12',\n      'v13',\n      'the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead.',\n    );\n    return xmlFlyoutCategory(workspace);\n  }\n  const blocks = [];\n  if (Blocks['procedures_defnoreturn']) {\n    blocks.push({\n      'kind': 'block',\n      'type': 'procedures_defnoreturn',\n      'gap': 16,\n      'fields': {\n        'NAME': Msg['PROCEDURES_DEFNORETURN_PROCEDURE'],\n      },\n    });\n  }\n  if (Blocks['procedures_defreturn']) {\n    blocks.push({\n      'kind': 'block',\n      'type': 'procedures_defreturn',\n      'gap': 16,\n      'fields': {\n        'NAME': Msg['PROCEDURES_DEFRETURN_PROCEDURE'],\n      },\n    });\n  }\n  if (Blocks['procedures_ifreturn']) {\n    blocks.push({\n      'kind': 'block',\n      'type': 'procedures_ifreturn',\n      'gap': 16,\n    });\n  }\n  if (blocks.length) {\n    // Add slightly larger gap between system blocks and user calls.\n    blocks[blocks.length - 1]['gap'] = 24;\n  }\n\n  /**\n   * Creates JSON block definitions for each of the given procedures.\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[],\n    templateName: string,\n  ) {\n    for (const [name, args] of procedureList) {\n      blocks.push({\n        'kind': 'block',\n        'type': templateName,\n        'gap': 16,\n        'extraState': {\n          'name': name,\n          'params': args,\n        },\n      });\n    }\n  }\n\n  const tuple = allProcedures(workspace);\n  populateProcedures(tuple[0], 'procedures_callnoreturn');\n  populateProcedures(tuple[1], 'procedures_callreturn');\n  return blocks;\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 = Variables.generateUniqueNameFromOptions(\n    DEFAULT_ARG,\n    usedNames,\n  );\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 * @internal\n */\nexport function mutatorOpenListener(e: Abstract) {\n  if (!isBubbleOpen(e)) return;\n\n  const bubbleEvent = e as BubbleOpen;\n  if (\n    !(bubbleEvent.bubbleType === 'mutator' && bubbleEvent.isOpen) ||\n    !bubbleEvent.blockId\n  ) {\n    return;\n  }\n  const workspaceId = bubbleEvent.workspaceId;\n  const block = common\n    .getWorkspaceById(workspaceId)!\n    .getBlockById(bubbleEvent.blockId) as BlockSvg;\n  const type = block.type;\n  if (type !== 'procedures_defnoreturn' && type !== 'procedures_defreturn') {\n    return;\n  }\n  const workspace = (\n    block.getIcon(MutatorIcon.TYPE) as MutatorIcon\n  ).getWorkspace()!;\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 (\n    !isBlockCreate(e) &&\n    !isBlockDelete(e) &&\n    !isBlockChange(e) &&\n    !isBlockFieldIntermediateChange(e)\n  ) {\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 */\nexport function getCallers(name: string, workspace: Workspace): Block[] {\n  return workspace.getAllBlocks(false).filter((block) => {\n    return (\n      blockIsModernCallerFor(block, name) ||\n      (isLegacyProcedureCallBlock(block) &&\n        Names.equals(block.getProcedureCall(), name))\n    );\n  });\n}\n\n/**\n * @returns True if the given block is a modern-style caller block of the given\n *     procedure name.\n */\nfunction blockIsModernCallerFor(block: Block, procName: string): boolean {\n  return (\n    isProcedureBlock(block) &&\n    !block.isProcedureDef() &&\n    block.getProcedureModel() &&\n    Names.equals(block.getProcedureModel().getName(), procName)\n  );\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 */\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 && utilsXml.domToText(oldMutationDom);\n    if (caller.domToMutation) {\n      caller.domToMutation(xmlElement);\n    }\n    const newMutationDom = caller.mutationToDom!();\n    const newMutation = newMutationDom && utilsXml.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(\n        new (eventUtils.get(EventType.BLOCK_CHANGE))(\n          caller,\n          'mutation',\n          null,\n          oldMutation,\n          newMutation,\n        ),\n      );\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 */\nexport function getDefinition(\n  name: string,\n  workspace: Workspace,\n): 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 isProcedureDef and getProcedureDef.\n  for (const block of workspace.getAllBlocks(false)) {\n    if (\n      isProcedureBlock(block) &&\n      block.isProcedureDef() &&\n      Names.equals(block.getProcedureModel().getName(), name)\n    ) {\n      return block;\n    }\n    if (\n      isLegacyProcedureDefBlock(block) &&\n      Names.equals(block.getProcedureDef()[0], name)\n    ) {\n      return block;\n    }\n  }\n  return null;\n}\n\nexport {\n  IParameterModel,\n  IProcedureBlock,\n  IProcedureMap,\n  IProcedureModel,\n  isProcedureBlock,\n  ObservableProcedureMap,\n  ProcedureTuple,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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/** 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;\n  pathUp: 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;\n  width: number;\n  height: number;\n};\n\n/** An object containing sizing and type information about a dynamic shape. */\nexport type DynamicShape = {\n  type: number;\n  width: (p1: number) => number;\n  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/** Returns whether the shape is a puzzle tab or not. */\nexport function isPuzzleTab(shape: Shape): shape is PuzzleTab {\n  return (\n    (shape as PuzzleTab).pathDown !== undefined &&\n    (shape as PuzzleTab).pathUp !== undefined\n  );\n}\n\n/** Returns whether the shape is a notch or not. */\nexport function isNotch(shape: Shape): shape is Notch {\n  return (\n    (shape as Notch).pathLeft !== undefined &&\n    (shape as Notch).pathRight !== undefined\n  );\n}\n\n/**\n * An object that provides constants for rendering blocks.\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  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  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  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  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  CURSOR_COLOUR = '#cc0a0a';\n\n  /**\n   * Immovable marker colour.\n   */\n  MARKER_COLOUR = '#4286f4';\n\n  /**\n   * Width of the horizontal cursor.\n   */\n  CURSOR_WS_WIDTH = 100;\n\n  /**\n   * Height of the horizontal cursor.\n   */\n  WS_CURSOR_HEIGHT = 5;\n\n  /**\n   * Padding around a stack.\n   */\n  CURSOR_STACK_PADDING = 10;\n\n  /**\n   * Padding around a block.\n   */\n  CURSOR_BLOCK_PADDING = 2;\n\n  /**\n   * Stroke of the cursor.\n   */\n  CURSOR_STROKE_WIDTH = 4;\n\n  /**\n   * Whether text input and colour fields fill up the entire source block.\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  INSERTION_MARKER_COLOUR = '#000000';\n\n  /**\n   * The insertion marker opacity.\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\n  blockStyles!: {[key: string]: BlockStyle};\n\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    this.randomIdentifier = String(Math.random()).substring(2);\n  }\n\n  /**\n   * Initialize shape objects based on the constants set in the constructor.\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   */\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',\n      this.FIELD_TEXT_FONTSIZE + 'pt',\n      this.FIELD_TEXT_FONTWEIGHT,\n      this.FIELD_TEXT_FONTFAMILY,\n    );\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   */\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 (\n      this.blockStyles[blockStyleName || ''] ||\n      (blockStyleName && blockStyleName.startsWith('auto_')\n        ? this.getBlockStyleForColour(blockStyleName.substring(5)).style\n        : this.createBlockStyle_('#000000'))\n    );\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: Partial<BlockStyle>): 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 = parsing.parseBlockColour(\n      valid['colourPrimary'] || '#000',\n    );\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  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   */\n  protected 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   */\n  protected 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    // Height is actually the Y position of the control points defining the\n    // curve of the hat; the hat's actual rendered height is 3/4 of the control\n    // points' Y position, per https://stackoverflow.com/a/5327329\n    return {height: height * 0.75, width, path: mainPath};\n  }\n\n  /**\n   * @returns An object containing sizing and path information about puzzle\n   *     tabs.\n   */\n  protected 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 (\n        svgPaths.curve('c', [\n          svgPaths.point(0, forward * control1Y),\n          svgPaths.point(-width, back * control2Y),\n          endPoint1,\n        ]) +\n        svgPaths.curve('s', [\n          svgPaths.point(width, back * control3Y),\n          endPoint2,\n        ])\n      );\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   */\n  protected 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   */\n  protected makeInsideCorners(): InsideCorners {\n    const radius = this.CORNER_RADIUS;\n\n    const innerTopLeftCorner = svgPaths.arc(\n      'a',\n      '0 0,0',\n      radius,\n      svgPaths.point(-radius, radius),\n    );\n\n    const innerBottomLeftCorner = svgPaths.arc(\n      'a',\n      '0 0,0',\n      radius,\n      svgPaths.point(radius, radius),\n    );\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   */\n  protected makeOutsideCorners(): OutsideCorners {\n    const radius = this.CORNER_RADIUS;\n    /** SVG path for drawing the rounded top-left corner. */\n    const topLeft =\n      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 = svgPaths.arc(\n      'a',\n      '0 0,1',\n      radius,\n      svgPaths.point(radius, radius),\n    );\n\n    /** SVG path for drawing the rounded bottom-left corner. */\n    const bottomLeft = svgPaths.arc(\n      'a',\n      '0 0,1',\n      radius,\n      svgPaths.point(-radius, -radius),\n    );\n\n    /** SVG path for drawing the rounded bottom-right corner. */\n    const bottomRight = svgPaths.arc(\n      'a',\n      '0 0,1',\n      radius,\n      svgPaths.point(-radius, radius),\n    );\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   */\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   * @param injectionDivIfIsParent The div containing the parent workspace and\n   *   all related workspaces and block containers, if this renderer is for the\n   *   parent workspace. CSS variables representing SVG patterns will be scoped\n   *   to this container. Child workspaces should not override the CSS variables\n   *   created by the parent and thus do not need access to the injection div.\n   */\n  createDom(\n    svg: SVGElement,\n    tagName: string,\n    selector: string,\n    injectionDivIfIsParent?: HTMLElement,\n  ) {\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,\n      {'id': 'blocklyEmbossFilter' + this.randomIdentifier},\n      this.defs,\n    );\n    dom.createSvgElement(\n      Svg.FEGAUSSIANBLUR,\n      {'in': 'SourceAlpha', 'stdDeviation': 1, 'result': 'blur'},\n      embossFilter,\n    );\n    const feSpecularLighting = dom.createSvgElement(\n      Svg.FESPECULARLIGHTING,\n      {\n        'in': 'blur',\n        'surfaceScale': 1,\n        'specularConstant': 0.5,\n        'specularExponent': 10,\n        'lighting-color': 'white',\n        'result': 'specOut',\n      },\n      embossFilter,\n    );\n    dom.createSvgElement(\n      Svg.FEPOINTLIGHT,\n      {'x': -5000, 'y': -10000, 'z': 20000},\n      feSpecularLighting,\n    );\n    dom.createSvgElement(\n      Svg.FECOMPOSITE,\n      {\n        'in': 'specOut',\n        'in2': 'SourceAlpha',\n        'operator': 'in',\n        'result': 'specOut',\n      },\n      embossFilter,\n    );\n    dom.createSvgElement(\n      Svg.FECOMPOSITE,\n      {\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    );\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      {\n        'id': 'blocklyDisabledPattern' + this.randomIdentifier,\n        'patternUnits': 'userSpaceOnUse',\n        'width': 10,\n        'height': 10,\n      },\n      this.defs,\n    );\n    dom.createSvgElement(\n      Svg.RECT,\n      {'width': 10, 'height': 10, 'fill': '#aaa'},\n      disabledPattern,\n    );\n    dom.createSvgElement(\n      Svg.PATH,\n      {'d': 'M 0 0 L 10 10 M 10 0 L 0 10', 'stroke': '#cc0'},\n      disabledPattern,\n    );\n    this.disabledPatternId = disabledPattern.id;\n    this.disabledPattern = disabledPattern;\n\n    this.createDebugFilter();\n\n    if (injectionDivIfIsParent) {\n      // If this renderer is for the parent workspace, add CSS variables scoped\n      // to the injection div referencing the created patterns so that CSS can\n      // apply the patterns to any element in the injection div.\n      injectionDivIfIsParent.style.setProperty(\n        '--blocklyEmbossFilter',\n        `url(#${this.embossFilterId})`,\n      );\n      injectionDivIfIsParent.style.setProperty(\n        '--blocklyDisabledPattern',\n        `url(#${this.disabledPatternId})`,\n      );\n      injectionDivIfIsParent.style.setProperty(\n        '--blocklyDebugFilter',\n        `url(#${this.debugFilterId})`,\n      );\n    }\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        {\n          'id': 'blocklyDebugFilter' + this.randomIdentifier,\n          'height': '160%',\n          'width': '180%',\n          'y': '-30%',\n          'x': '-40%',\n        },\n        this.defs,\n      );\n      // Set all gaussian blur pixels to 1 opacity before applying flood\n      const debugComponentTransfer = dom.createSvgElement(\n        Svg.FECOMPONENTTRANSFER,\n        {'result': 'outBlur'},\n        debugFilter,\n      );\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      );\n      // Color the highlight\n      dom.createSvgElement(\n        Svg.FEFLOOD,\n        {\n          'flood-color': '#ff0000',\n          'flood-opacity': 0.5,\n          'result': 'outColor',\n        },\n        debugFilter,\n      );\n      dom.createSvgElement(\n        Svg.FECOMPOSITE,\n        {\n          'in': 'outColor',\n          'in2': 'outBlur',\n          'operator': 'in',\n          'result': 'outGlow',\n        },\n        debugFilter,\n      );\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    // prettier-ignore\n    return [\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} .blocklyNonEditableField>rect,`,\n      `${selector} .blocklyEditableField>rect {`,\n        `fill: ${this.FIELD_BORDER_RECT_COLOUR};`,\n        `fill-opacity: .6;`,\n        `stroke: none;`,\n      `}`,\n      `${selector} .blocklyNonEditableField>text,`,\n      `${selector} .blocklyEditableField>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} .blocklyEditableField:not(.blocklyEditing):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    ];\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.blockRendering\n\nimport * as registry from '../../registry.js';\nimport type {Theme} from '../../theme.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';\nimport {Drawer} from './drawer.js';\nimport type {IPathObject} from './i_path_object.js';\nimport {RenderInfo} from './info.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(\n  name: string,\n  rendererClass: new (name: string) => Renderer,\n) {\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 */\nexport function unregister(name: string) {\n  registry.unregister(registry.Type.RENDERER, name);\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 * @internal\n */\nexport function init(\n  name: string,\n  theme: Theme,\n  opt_rendererOverrides?: {[rendererConstant: string]: any},\n): 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 {\n  BottomRow,\n  Connection,\n  Drawer,\n  ExternalValueInput,\n  Field,\n  Hat,\n  Icon,\n  InlineInput,\n  InputConnection,\n  InputRow,\n  InRowSpacer,\n  IPathObject,\n  JaggedEdge,\n  Measurable,\n  NextConnection,\n  OutputConnection,\n  PathObject,\n  PreviousConnection,\n  Renderer,\n  RenderInfo,\n  RoundCorner,\n  Row,\n  SpacerRow,\n  SquareCorner,\n  StatementInput,\n  TopRow,\n  Types,\n};\n\nexport {\n  BaseShape,\n  ConstantProvider,\n  DynamicShape,\n  InsideCorners,\n  JaggedTeeth,\n  Notch,\n  OutsideCorners,\n  PuzzleTab,\n  StartHat,\n} from './constants.js';\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.VariablesDynamic\n\nimport {Blocks} from './blocks.js';\nimport type {FlyoutButton} from './flyout_button.js';\nimport {Msg} from './msg.js';\nimport * as deprecation from './utils/deprecation.js';\nimport type {FlyoutItemInfo} from './utils/toolbox.js';\nimport * as xml from './utils/xml.js';\nimport * as Variables from './variables.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\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 */\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(),\n    undefined,\n    'String',\n  );\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(),\n    undefined,\n    'Number',\n  );\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(),\n    undefined,\n    'Colour',\n  );\n}\n// eslint-disable-next-line camelcase\nexport const onCreateVariableButtonClick_Colour = colourButtonClickHandler;\n\n/**\n * Internal wrapper that returns the contents of the dynamic variables category.\n *\n * @internal\n * @param workspace The workspace to populate variable blocks for.\n */\nexport function internalFlyoutCategory(\n  workspace: WorkspaceSvg,\n): FlyoutItemInfo[] {\n  return flyoutCategory(workspace, false);\n}\n\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml: true,\n): Element[];\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml: false,\n): FlyoutItemInfo[];\n/**\n * Construct the elements (blocks and button) required by the flyout for the\n * dynamic variables category.\n *\n * @param useXml True to return the contents as XML, false to use JSON.\n * @returns List of flyout contents as either XML or JSON.\n */\nexport function flyoutCategory(\n  workspace: WorkspaceSvg,\n  useXml = true,\n): Element[] | FlyoutItemInfo[] {\n  if (!Blocks['variables_set_dynamic'] && !Blocks['variables_get_dynamic']) {\n    console.warn(\n      'There are no dynamic variable blocks, but there is a dynamic variable category.',\n    );\n  }\n\n  if (useXml) {\n    deprecation.warn(\n      'The XML return value of Blockly.VariablesDynamic.flyoutCategory()',\n      'v12',\n      'v13',\n      'the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead.',\n    );\n    return xmlFlyoutCategory(workspace);\n  }\n\n  workspace.registerButtonCallback(\n    'CREATE_VARIABLE_STRING',\n    stringButtonClickHandler,\n  );\n  workspace.registerButtonCallback(\n    'CREATE_VARIABLE_NUMBER',\n    numberButtonClickHandler,\n  );\n  workspace.registerButtonCallback(\n    'CREATE_VARIABLE_COLOUR',\n    colourButtonClickHandler,\n  );\n\n  return [\n    {\n      'kind': 'button',\n      'text': Msg['NEW_STRING_VARIABLE'],\n      'callbackkey': 'CREATE_VARIABLE_STRING',\n    },\n    {\n      'kind': 'button',\n      'text': Msg['NEW_NUMBER_VARIABLE'],\n      'callbackkey': 'CREATE_VARIABLE_NUMBER',\n    },\n    {\n      'kind': 'button',\n      'text': Msg['NEW_COLOUR_VARIABLE'],\n      'callbackkey': 'CREATE_VARIABLE_COLOUR',\n    },\n    ...Variables.jsonFlyoutCategoryBlocks(\n      workspace,\n      workspace.getVariableMap().getAllVariables(),\n      false,\n      'variables_get_dynamic',\n      'variables_set_dynamic',\n    ),\n  ];\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 */\nfunction xmlFlyoutCategory(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',\n    stringButtonClickHandler,\n  );\n  workspace.registerButtonCallback(\n    'CREATE_VARIABLE_NUMBER',\n    numberButtonClickHandler,\n  );\n  workspace.registerButtonCallback(\n    'CREATE_VARIABLE_COLOUR',\n    colourButtonClickHandler,\n  );\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 */\nexport function flyoutCategoryBlocks(workspace: Workspace): Element[] {\n  const variableModelList = workspace.getVariableMap().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(Variables.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 */\n// Former goog.module ID: 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 {BlockSvg} from './block_svg.js';\nimport type {BlocklyOptions} from './blockly_options.js';\nimport * as browserEvents from './browser_events.js';\nimport {TextInputBubble} from './bubbles/textinput_bubble.js';\nimport {COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER} from './comments/collapse_comment_bar_button.js';\nimport {COMMENT_EDITOR_FOCUS_IDENTIFIER} from './comments/comment_editor.js';\nimport {COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER} from './comments/delete_comment_bar_button.js';\nimport {RenderedWorkspaceComment} from './comments/rendered_workspace_comment.js';\nimport {WorkspaceComment} from './comments/workspace_comment.js';\nimport * as common from './common.js';\nimport {ComponentManager} from './component_manager.js';\nimport {ConnectionDB} from './connection_db.js';\nimport * as ContextMenu from './contextmenu.js';\nimport {\n  ContextMenuOption,\n  ContextMenuRegistry,\n} from './contextmenu_registry.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {Abstract as AbstractEvent} from './events/events.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {Flyout} from './flyout_base.js';\nimport type {FlyoutButton} from './flyout_button.js';\nimport {getFocusManager} from './focus_manager.js';\nimport {Gesture} from './gesture.js';\nimport {Grid} from './grid.js';\nimport {MutatorIcon} from './icons/mutator_icon.js';\nimport {isAutoHideable} from './interfaces/i_autohideable.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport {IContextMenu} from './interfaces/i_contextmenu.js';\nimport type {IDragTarget} from './interfaces/i_drag_target.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport {\n  isFocusableNode,\n  type IFocusableNode,\n} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport {hasBubble} from './interfaces/i_has_bubble.js';\nimport type {IMetricsManager} from './interfaces/i_metrics_manager.js';\nimport type {IToolbox} from './interfaces/i_toolbox.js';\nimport type {LineCursor} from './keyboard_nav/line_cursor.js';\nimport type {Marker} from './keyboard_nav/marker.js';\nimport {LayerManager} from './layer_manager.js';\nimport {MarkerManager} from './marker_manager.js';\nimport {Msg} from './msg.js';\nimport {Navigator} from './navigator.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 type {Theme} from './theme.js';\nimport {Classic} from './theme/classic.js';\nimport {ThemeManager} from './theme_manager.js';\nimport * as Tooltip from './tooltip.js';\nimport type {Trashcan} from './trashcan.js';\nimport * as aria from './utils/aria.js';\nimport * as arrayUtils from './utils/array.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport * as drag from './utils/drag.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 * 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 {ZoomControls} from './zoom_controls.js';\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 */\nexport class WorkspaceSvg\n  extends Workspace\n  implements IContextMenu, IFocusableNode, IFocusableTree\n{\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 visible = 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  /** 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_: Gesture | null = null;\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: HTMLElement | 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)\n    | null = null;\n\n  /**\n   * A dummy wheel event listener used as a workaround for a Safari scrolling issue.\n   * Set in createDom and used for removal in dispose to ensure proper cleanup.\n   */\n  private dummyWheelListener: (() => 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 = new Map<\n    string,\n    (p1: WorkspaceSvg) => toolbox.FlyoutDefinition\n  >();\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  /** True iff a keyboard-initiated move (\"drag\") is in progress. */\n  keyboardMoveInProgress = false; // TODO(#8960): Delete this.\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  private layerManager: LayerManager | null = null;\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   * Navigator that handles moving focus between items in this workspace in\n   * response to keyboard navigation commands.\n   */\n  private navigator = new Navigator();\n\n  /**\n   * @param options Dictionary of options.\n   */\n  constructor(options: Options) {\n    super(options);\n\n    const MetricsManagerClass = registry.getClassFromOptions(\n      registry.Type.METRICS_MANAGER,\n      options,\n      true,\n    );\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 =\n      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    /**\n     * Object in charge of loading, storing, and playing audio for a workspace.\n     */\n    this.audioManager = new WorkspaceAudio(\n      options.parentWorkspace as WorkspaceSvg,\n    );\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.internalFlyoutCategory) {\n      this.registerToolboxCategoryCallback(\n        Variables.CATEGORY_NAME,\n        Variables.internalFlyoutCategory,\n      );\n    }\n\n    if (VariablesDynamic && VariablesDynamic.internalFlyoutCategory) {\n      this.registerToolboxCategoryCallback(\n        VariablesDynamic.CATEGORY_NAME,\n        VariablesDynamic.internalFlyoutCategory,\n      );\n    }\n\n    if (Procedures && Procedures.internalFlyoutCategory) {\n      this.registerToolboxCategoryCallback(\n        Procedures.CATEGORY_NAME,\n        Procedures.internalFlyoutCategory,\n      );\n      this.addChangeListener(Procedures.mutatorOpenListener);\n    }\n\n    // Set up callbacks to refresh the toolbox when variables change\n    this.addChangeListener(this.variableChangeCallback.bind(this));\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',\n      this.getTheme(),\n      this.options.rendererOverrides ?? undefined,\n    );\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 = 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   * 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    return this.markerManager.getMarker(id);\n  }\n\n  /**\n   * The cursor for this workspace.\n   *\n   * @returns The cursor for the workspace.\n   */\n  getCursor(): LineCursor {\n    return this.markerManager.getCursor();\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      const isParentWorkspace = this.options.parentWorkspace === null;\n      this.renderer.refreshDom(\n        this.svgGroup_,\n        this.getTheme(),\n        isParentWorkspace ? this.getInjectionDiv() : undefined,\n      );\n    }\n\n    // Update all blocks in workspace that have a style name.\n    this.updateBlockStyles(\n      this.getAllBlocks(false).filter((block) => !!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(EventType.THEME_CHANGE))(\n      this.getTheme().name,\n      this.id,\n    );\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      }\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.visible;\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 (\n      this.getCanvas().contains(element) ||\n      this.getBubbleCanvas().contains(element)\n    ) {\n      // Before the SVG canvas, scale the coordinates.\n      scale = this.scale;\n    }\n    let ancestor: Element = element;\n    do {\n      // Loop through this block and every parent.\n      const xy = svgMath.getRelativeXY(ancestor);\n      if (\n        ancestor === this.getCanvas() ||\n        ancestor === this.getBubbleCanvas()\n      ) {\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      ancestor = ancestor.parentNode as Element;\n    } while (\n      ancestor &&\n      ancestor !== this.getParentSvg() &&\n      ancestor !== this.getInjectionDiv()\n    );\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(): HTMLElement {\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 + ' ').includes(' injectionDiv ')) {\n          this.injectionDiv = element as HTMLElement;\n          break;\n        }\n        element = element.parentNode as Element;\n      }\n    }\n    return this.injectionDiv!;\n  }\n\n  /**\n   * Returns the SVG group for the workspace.\n   *\n   * @returns The SVG group for the workspace.\n   */\n  getSvgGroup(): Element {\n    return this.svgGroup_;\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.getCanvas();\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, injectionDiv?: HTMLElement): Element {\n    if (!this.injectionDiv) {\n      this.injectionDiv = injectionDiv ?? null;\n    }\n\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, {\n      'class': 'blocklyWorkspace',\n      'id': this.id,\n    });\n    if (injectionDiv) {\n      aria.setState(\n        this.svgGroup_,\n        aria.State.LABEL,\n        Msg['WORKSPACE_ARIA_LABEL'],\n      );\n    }\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\n      if (opt_backgroundClass === 'blocklyMainBackground' && this.grid) {\n        this.svgBackground_.style.fill = 'var(--blocklyGridPattern)';\n      } else {\n        this.themeManager_.subscribe(\n          this.svgBackground_,\n          'workspaceBackgroundColour',\n          'fill',\n        );\n      }\n    }\n\n    this.layerManager = new LayerManager(this);\n    // Assign the canvases for backwards compatibility.\n    this.svgBlockCanvas_ = this.layerManager.getBlockLayer();\n    this.svgBubbleCanvas_ = this.layerManager.getBubbleLayer();\n\n    if (!this.isFlyout) {\n      browserEvents.conditionalBind(\n        this.svgGroup_,\n        'pointerdown',\n        this,\n        this.onMouseDown,\n        false,\n      );\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      this.dummyWheelListener = () => {};\n      document.body.addEventListener('wheel', this.dummyWheelListener);\n      browserEvents.conditionalBind(\n        this.svgGroup_,\n        'wheel',\n        this,\n        this.onMouseWheel,\n      );\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,\n        this.options,\n        true,\n      );\n      this.toolbox = new ToolboxClass!(this);\n    }\n    if (this.grid) {\n      this.grid.update(this.scale);\n    }\n    this.recordDragTargets();\n    const CursorClass = registry.getClassFromOptions(\n      registry.Type.CURSOR,\n      this.options,\n    );\n\n    if (CursorClass) this.markerManager.setCursor(new CursorClass(this));\n\n    const isParentWorkspace = this.options.parentWorkspace === null;\n    this.renderer.createDom(\n      this.svgGroup_,\n      this.getTheme(),\n      isParentWorkspace ? this.getInjectionDiv() : undefined,\n    );\n\n    // Only the top-level and flyout workspaces should be tabbable.\n    getFocusManager().registerTree(this, !!this.injectionDiv || this.isFlyout);\n\n    return this.svgGroup_;\n  }\n\n  /**\n   * Dispose of this workspace.\n   * Unlink from all DOM elements to prevent memory leaks.\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    this.markerManager.dispose();\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    // Remove the dummy wheel listener\n    if (this.dummyWheelListener) {\n      document.body.removeEventListener('wheel', this.dummyWheelListener);\n      this.dummyWheelListener = null;\n    }\n\n    if (getFocusManager().isRegistered(this)) {\n      getFocusManager().unregisterTree(this);\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.getCanvas());\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  /**\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   * Creates a new set of options from this workspace's options with just the\n   * values that are relevant to a flyout.\n   *\n   * @returns A subset of this workspace's options.\n   */\n  copyOptionsForFlyout(): Options {\n    return 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      'plugins': this.options.plugins,\n      'modalInputs': this.options.modalInputs,\n      'move': {\n        'scrollbars': true,\n      },\n    } as BlocklyOptions);\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 = this.copyOptionsForFlyout();\n    workspaceOptions.toolboxPosition = this.options.toolboxPosition;\n    if (this.horizontalLayout) {\n      const HorizontalFlyout = registry.getClassFromOptions(\n        registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,\n        this.options,\n        true,\n      );\n      this.flyout = new HorizontalFlyout!(workspaceOptions);\n    } else {\n      const VerticalFlyout = registry.getClassFromOptions(\n        registry.Type.FLYOUTS_VERTICAL_TOOLBOX,\n        this.options,\n        true,\n      );\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   */\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   */\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    } else if (this.flyout) {\n      this.flyout.position();\n    }\n\n    const positionables = this.componentManager.getComponents(\n      ComponentManager.Capability.POSITIONABLE,\n      true,\n    );\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    const currScroll = svgMath.getDocumentScroll();\n    if (!Coordinate.equals(this.lastRecordedPageScroll, currScroll)) {\n      this.lastRecordedPageScroll = currScroll;\n      this.updateScreenCalculations();\n    }\n  }\n\n  /**\n   * @returns The layer manager for this workspace.\n   * @internal\n   */\n  getLayerManager(): LayerManager | null {\n    return this.layerManager;\n  }\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.layerManager!.getBlockLayer();\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}`);\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}`);\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.layerManager!.getBubbleLayer();\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 (\n      scale === this.oldScale &&\n      Math.abs(top - this.oldTop) < 1 &&\n      Math.abs(left - this.oldLeft) < 1\n    ) {\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(EventType.VIEWPORT_CHANGE))(\n      top,\n      left,\n      scale,\n      this.id,\n      this.oldScale,\n    );\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    this.layerManager?.translateLayers(new Coordinate(x, y), this.scale);\n    this.grid?.moveTo(x, y);\n    this.maybeFireViewportChangeEvent();\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.visible = 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      this.hideChaff(true);\n    }\n  }\n\n  /**\n   * Render all blocks in workspace.\n   */\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].queueRender();\n    }\n\n    this.getTopBlocks()\n      .flatMap((block) => block.getDescendants(false))\n      .filter((block) => block.isInsertionMarker())\n      .forEach((block) => block.queueRender());\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.includes(block)) {\n        this.highlightedBlocks.push(block);\n      }\n      block.setHighlighted(state);\n    }\n  }\n\n  /**\n   * Handles any necessary updates when a variable changes.\n   *\n   * @internal\n   */\n  private variableChangeCallback(event: AbstractEvent) {\n    switch (event.type) {\n      case EventType.VAR_CREATE:\n      case EventType.VAR_DELETE:\n      case EventType.VAR_RENAME:\n      case EventType.VAR_TYPE_CHANGE:\n        this.refreshToolboxSelection();\n        break;\n      default:\n    }\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  /** Make a list of all the delete areas for this workspace. */\n  recordDragTargets() {\n    const dragTargets = this.componentManager.getComponents(\n      ComponentManager.Capability.DRAG_TARGET,\n      true,\n    );\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  }\n\n  /**\n   * Obtain a newly created comment.\n   *\n   * @param id Optional ID.  Use this ID if provided, otherwise create a new\n   *     ID.\n   * @returns The created comment.\n   */\n  newComment(id?: string): WorkspaceComment {\n    throw new Error(\n      'The implementation of newComment should be ' +\n        'monkey-patched in by blockly.ts',\n    );\n  }\n  /* eslint-enable */\n\n  /**\n   * Returns the drag target the pointer event is over.\n   *\n   * @param e Pointer move event.\n   * @returns Null if not over a drag target, or the drag target the event is\n   *     over.\n   */\n  getDragTarget(e: PointerEvent): IDragTarget | null {\n    for (let i = 0, targetArea; (targetArea = this.dragTargetAreas[i]); i++) {\n      if (targetArea.clientRect.contains(e.clientX, e.clientY)) {\n        return targetArea.component;\n      }\n    }\n    return null;\n  }\n\n  /**\n   * Handle a pointerdown on SVG drawing surface.\n   *\n   * @param e Pointer down event.\n   */\n  private onMouseDown(e: PointerEvent) {\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 Pointer down event.\n   * @param xy Starting location of object.\n   */\n  startDrag(e: PointerEvent, xy: Coordinate) {\n    drag.start(this, e, xy);\n  }\n\n  /**\n   * Track a drag of an object on this workspace.\n   *\n   * @param e Pointer move event.\n   * @returns New location of object.\n   */\n  moveDrag(e: PointerEvent): Coordinate {\n    return drag.move(this, e);\n  }\n\n  /**\n   * Indicate whether a keyboard move is in progress or not.\n   *\n   * Should be called with true when a keyboard move of an IDraggable\n   * is starts, and false when it finishes or is aborted.\n   *\n   * N.B.: This method is experimental and internal-only.  It is\n   * intended only to called only from the keyboard navigation plugin.\n   * Its signature and behaviour may be modified, or the method\n   * removed, at an time without notice and without being treated\n   * as a breaking change.\n   *\n   * TODO(#8960): Delete this.\n   *\n   * @internal\n   * @param inProgress Is a keyboard-initated move in progress?\n   */\n  setKeyboardMoveInProgress(inProgress: boolean) {\n    this.keyboardMoveInProgress = inProgress;\n  }\n\n  /**\n   * Returns true iff the user is currently engaged in a drag gesture,\n   * or if a keyboard-initated move is in progress.\n   *\n   * Dragging gestures normally entail moving a block or other item on\n   * the workspace, or scrolling the flyout/workspace.\n   *\n   * Keyboard-initated movements are implemnted using the dragging\n   * infrastructure and are intended to emulate (a subset of) drag\n   * gestures and so should typically be treated as if they were a\n   * gesture-based drag.\n   *\n   * @returns True iff a drag gesture or keyboard move is in porgress.\n   */\n  isDragging(): boolean {\n    return (\n      // TODO(#8960): Query Mover.isMoving to see if move is in\n      // progress rather than relying on a status flag.\n      this.keyboardMoveInProgress ||\n      (this.currentGesture_ !== null && this.currentGesture_.isDragging())\n    );\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 (\n      (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  /**\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 (\n      this.isMovable() &&\n      (!hasScrollbars ||\n        (hasScrollbars && this.scrollbar!.canScrollHorizontally()))\n    );\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 (\n      this.isMovable() &&\n      (!hasScrollbars ||\n        (hasScrollbars && this.scrollbar!.canScrollVertically()))\n    );\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,\n        this.getParentSvg(),\n        this.getInverseScreenCTM(),\n      );\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 (\n        (topElement as any).isInsertionMarker &&\n        (topElement as any).isInsertionMarker()\n      ) {\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 such that none overlap. */\n  cleanUp() {\n    this.setResizesEnabled(false);\n    const existingGroup = eventUtils.getGroup();\n    if (!existingGroup) {\n      eventUtils.setGroup(true);\n    }\n\n    const topBlocks = this.getTopBlocks(true);\n    const movableBlocks = topBlocks.filter((block) => block.isMovable());\n    const immovableBlocks = topBlocks.filter((block) => !block.isMovable());\n\n    const immovableBlockBounds = immovableBlocks.map((block) =>\n      block.getBoundingRectangle(),\n    );\n\n    const getNextIntersectingImmovableBlock = function (\n      rect: Rect,\n    ): Rect | null {\n      for (const immovableRect of immovableBlockBounds) {\n        if (rect.intersects(immovableRect)) {\n          return immovableRect;\n        }\n      }\n      return null;\n    };\n\n    let cursorY = 0;\n    const minBlockHeight = this.renderer.getConstants().MIN_BLOCK_HEIGHT;\n    for (const block of movableBlocks) {\n      // Make the initial movement of shifting the block to its best possible position.\n      let boundingRect = block.getBoundingRectangle();\n      block.moveBy(-boundingRect.left, cursorY - boundingRect.top, ['cleanup']);\n      block.snapToGrid();\n\n      boundingRect = block.getBoundingRectangle();\n      let conflictingRect = getNextIntersectingImmovableBlock(boundingRect);\n      while (conflictingRect != null) {\n        // If the block intersects with an immovable block, move it down past that immovable block.\n        cursorY =\n          conflictingRect.top + conflictingRect.getHeight() + minBlockHeight;\n        block.moveBy(0, cursorY - boundingRect.top, ['cleanup']);\n        block.snapToGrid();\n        boundingRect = block.getBoundingRectangle();\n        conflictingRect = getNextIntersectingImmovableBlock(boundingRect);\n      }\n\n      // Ensure all next blocks start past the most recent (which will also put them past all\n      // previously intersecting immovable blocks).\n      cursorY =\n        block.getRelativeToSurfaceXY().y +\n        block.getHeightWidth().height +\n        minBlockHeight;\n    }\n    eventUtils.setGroup(existingGroup);\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.isReadOnly() || this.isFlyout) {\n      return;\n    }\n    const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(\n      {workspace: this, focusedNode: this},\n      e,\n    );\n\n    // Allow the developer to add or modify menuOptions.\n    if (this.configureContextMenu) {\n      this.configureContextMenu(menuOptions, e);\n    }\n\n    let location;\n    if (e instanceof PointerEvent) {\n      location = new Coordinate(e.clientX, e.clientY);\n    } else {\n      // TODO: Get the location based on the workspace cursor location\n      location = svgMath.wsToScreenCoordinates(this, new Coordinate(5, 5));\n    }\n\n    ContextMenu.show(e, menuOptions, this.RTL, this, location);\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.\n      this.getParentSvg().focus({preventScroll: true});\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!\n      .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      );\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.getCanvas(), 'blocklyCanvasTransitioning');\n    dom.addClass(this.getBubbleCanvas(), 'blocklyCanvasTransitioning');\n  }\n\n  /**\n   * Remove transition class from the block and bubble canvas.\n   *\n   * @internal\n   */\n  endCanvasTransition() {\n    dom.removeClass(this.getCanvas(), 'blocklyCanvasTransitioning');\n    dom.removeClass(this.getBubbleCanvas(), '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      );\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   * unless blockOnly is true.\n   *\n   * @param id ID of block center on.\n   * @param blockOnly True to center only on the block itself, not its stack.\n   */\n  centerOnBlock(id: string | null, blockOnly?: boolean) {\n    if (!this.isMovable()) {\n      console.warn(\n        'Tried to move a non-movable workspace. This could result' +\n          ' in blocks becoming inaccessible.',\n      );\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 = blockOnly\n      ? {height: block.height, width: block.width}\n      : 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 (\n      this.options.zoomOptions.maxScale &&\n      newScale > this.options.zoomOptions.maxScale\n    ) {\n      newScale = this.options.zoomOptions.maxScale;\n    } else if (\n      this.options.zoomOptions.minScale &&\n      newScale < this.options.zoomOptions.minScale\n    ) {\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.\n   *\n   * @returns The workspace zoom factor. Units: (pixels / workspaceUnit).\n   */\n  getScale(): number {\n    return this.scale;\n  }\n\n  /**\n   * Returns the absolute scale of the workspace.\n   *\n   * Workspace scaling is multiplicative; if a workspace B (e.g. a mutator editor)\n   * with scale Y is nested within a root workspace A with scale X, workspace B's\n   * effective scale is X * Y, because, as a child of A, it is already transformed\n   * by A's scaling factor, and then further transforms itself by its own scaling\n   * factor. Normally this Just Works, but for global elements (e.g. field\n   * editors) that are visually associated with a particular workspace but live at\n   * the top level of the DOM rather than being a child of their associated\n   * workspace, the absolute/effective scale may be needed to render\n   * appropriately.\n   *\n   * @returns The absolute/effective scale of the given workspace.\n   */\n  getAbsoluteScale() {\n    // Returns a workspace's own scale, without regard to multiplicative scaling.\n    const getLocalScale = (workspace: WorkspaceSvg): number => {\n      // Workspaces in flyouts may have a distinct scale; use this if relevant.\n      if (workspace.isFlyout) {\n        const flyout = workspace.targetWorkspace?.getFlyout();\n        if (flyout instanceof Flyout) {\n          return flyout.getFlyoutScale();\n        }\n      }\n\n      return workspace.getScale();\n    };\n\n    const computeScale = (workspace: WorkspaceSvg, scale: number): number => {\n      // If the workspace has no parent, or it does have a parent but is not\n      // actually a child of its parent workspace in the DOM (this is the case for\n      // flyouts in the main workspace), we're done; just return the scale so far\n      // multiplied by the workspace's own scale.\n      if (\n        !workspace.options.parentWorkspace ||\n        !workspace.options.parentWorkspace\n          .getSvgGroup()\n          .contains(workspace.getSvgGroup())\n      ) {\n        return scale * getLocalScale(workspace);\n      }\n\n      // If there is a parent workspace, and this workspace is a child of it in\n      // the DOM, scales are multiplicative, so recurse up the workspace\n      // hierarchy.\n      return computeScale(\n        workspace.options.parentWorkspace,\n        scale * getLocalScale(workspace),\n      );\n    };\n\n    return computeScale(this, 1);\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   */\n  scroll(x: number, y: number) {\n    this.hideChaff(/* opt_onlyClosePopups= */ 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 = Math.max(\n      0,\n      metrics.scrollWidth - metrics.viewWidth,\n    );\n    const maxXScroll = metrics.scrollLeft + maxXDisplacement;\n    const maxYDisplacement = Math.max(\n      0,\n      metrics.scrollHeight - metrics.viewHeight,\n    );\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),\n        -(y + metrics.scrollTop),\n        false,\n      );\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 = false): 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 = false): 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: RenderedWorkspaceComment) {\n    this.addTopBoundedElement(comment);\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: RenderedWorkspaceComment) {\n    this.removeTopBoundedElement(comment);\n    super.removeTopComment(comment);\n  }\n\n  /**\n   * Returns a list of comments on this workspace.\n   *\n   * @param ordered If true, sorts the comments based on their position.\n   * @returns A list of workspace comments.\n   */\n  override getTopComments(ordered = false): RenderedWorkspaceComment[] {\n    return super.getTopComments(ordered) as RenderedWorkspaceComment[];\n  }\n\n  /**\n   * Returns the workspace comment with the given ID, if any.\n   *\n   * @param id The ID of the comment to retrieve.\n   * @returns The workspace comment with the given ID, or null.\n   */\n  override getCommentById(id: string): RenderedWorkspaceComment | null {\n    return super.getCommentById(id) as RenderedWorkspaceComment | null;\n  }\n\n  override getRootWorkspace(): WorkspaceSvg | null {\n    return super.getRootWorkspace() as WorkspaceSvg | null;\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(ordered = false): IBoundedElement[] {\n    const elements = new Array<IBoundedElement>().concat(\n      this.topBoundedElements,\n    );\n    if (ordered) {\n      elements.sort(this.sortByOrigin.bind(this));\n    }\n\n    return elements;\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,\n    func: (p1: WorkspaceSvg) => toolbox.FlyoutDefinition,\n  ) {\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(\n    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   *\n   * Returns the gesture in progress, except:\n   *\n   * - If there is a keyboard-initiate move in progress then null will\n   *   be returned - after calling event.preventDefault() and\n   *   event.stopPropagation() to ensure the pointer event is ignored.\n   * - If there is a gesture in progress but event.type is\n   *   'pointerdown' then the in-progress gesture will be cancelled;\n   *   this will result in null being returned.\n   * - If no gesutre is in progress but event is a pointerdown then a\n   *   new gesture will be created and returned.\n   *\n   * @param e Pointer 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: PointerEvent): Gesture | null {\n    // TODO(#8960): Query Mover.isMoving to see if move is in progress\n    // rather than relying on .keyboardMoveInProgress status flag.\n    if (this.keyboardMoveInProgress) {\n      // Normally these would be called from Gesture.doStart.\n      e.preventDefault();\n      e.stopPropagation();\n      return null;\n    }\n\n    const isStart = e.type === 'pointerdown';\n    if (isStart && this.currentGesture_?.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      this.currentGesture_.cancel(); // Sets this.currentGesture_ to null.\n    }\n    if (!this.currentGesture_ && isStart) {\n      // No gesture existed on this workspace, but this looks like the\n      // start of a new gesture.\n      this.currentGesture_ = new Gesture(e, this);\n    }\n\n    return this.currentGesture_;\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   */\n  getGrid(): Grid | null {\n    return this.grid;\n  }\n\n  /**\n   * Close tooltips, context menus, dropdown selections, etc.\n   *\n   * @param onlyClosePopups Whether only popups should be closed. Defaults to\n   *     false.\n   */\n  hideChaff(onlyClosePopups = false) {\n    Tooltip.hide();\n    WidgetDiv.hideIfOwnerIsInWorkspace(this);\n    dropDownDiv.hideWithoutAnimation();\n\n    this.hideComponents(onlyClosePopups);\n  }\n\n  /**\n   * Hide any autohideable components (like flyout, trashcan, and any\n   * user-registered components).\n   *\n   * @param onlyClosePopups Whether only popups should be closed. Defaults to\n   *     false.\n   */\n  hideComponents(onlyClosePopups = false) {\n    const autoHideables = this.getComponentManager().getComponents(\n      ComponentManager.Capability.AUTOHIDEABLE,\n      true,\n    );\n    autoHideables.forEach((autoHideable) =>\n      autoHideable.autoHide(onlyClosePopups),\n    );\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,\n    xyRatio: {x?: number; y?: number},\n  ) {\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    }\n    if (typeof xyRatio.y === 'number') {\n      this.scrollY = -(\n        metrics.scrollTop +\n        (metrics.scrollHeight - metrics.viewHeight) * xyRatio.y\n      );\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   * Adds a CSS class to the workspace.\n   *\n   * @param className Name of class to add.\n   */\n  addClass(className: string) {\n    if (this.injectionDiv) {\n      dom.addClass(this.injectionDiv, className);\n    }\n  }\n\n  /**\n   * Removes a CSS class from the workspace.\n   *\n   * @param className Name of class to remove.\n   */\n  removeClass(className: string) {\n    if (this.injectionDiv) {\n      dom.removeClass(this.injectionDiv, className);\n    }\n  }\n\n  override setIsReadOnly(readOnly: boolean) {\n    super.setIsReadOnly(readOnly);\n    if (readOnly) {\n      this.addClass('blocklyReadOnly');\n    } else {\n      this.removeClass('blocklyReadOnly');\n    }\n  }\n\n  /**\n   * Scrolls the provided bounds into view.\n   *\n   * In the case of small workspaces/large bounds, this function prioritizes\n   * getting the top left corner of the bounds into view. It also adds some\n   * padding around the bounds to allow the element to be comfortably in view.\n   *\n   * @internal\n   * @param bounds A rectangle to scroll into view, as best as possible.\n   * @param padding Amount of spacing to put between the bounds and the edge of\n   *     the workspace's viewport.\n   */\n  scrollBoundsIntoView(bounds: Rect, padding = 10) {\n    if (Gesture.inProgress()) {\n      // This can cause jumps during a drag and is only suited for keyboard nav.\n      return;\n    }\n    const scale = this.getScale();\n\n    const rawViewport = this.getMetricsManager().getViewMetrics(true);\n    const viewport = new Rect(\n      rawViewport.top,\n      rawViewport.top + rawViewport.height,\n      rawViewport.left,\n      rawViewport.left + rawViewport.width,\n    );\n\n    if (\n      bounds.left >= viewport.left &&\n      bounds.top >= viewport.top &&\n      bounds.right <= viewport.right &&\n      bounds.bottom <= viewport.bottom\n    ) {\n      // Do nothing if the block is fully inside the viewport.\n      return;\n    }\n\n    // Add some padding to the bounds so the element is scrolled comfortably\n    // into view.\n    bounds = bounds.clone();\n    bounds.top -= padding;\n    bounds.bottom += padding;\n    bounds.left -= padding;\n    bounds.right += padding;\n\n    let deltaX = 0;\n    let deltaY = 0;\n\n    if (bounds.left < viewport.left) {\n      deltaX = this.RTL\n        ? Math.min(\n            viewport.left - bounds.left,\n            viewport.right - bounds.right, // Don't move the right side out of view\n          )\n        : viewport.left - bounds.left;\n    } else if (bounds.right > viewport.right) {\n      deltaX = this.RTL\n        ? viewport.right - bounds.right\n        : Math.max(\n            viewport.right - bounds.right,\n            viewport.left - bounds.left, // Don't move the left side out of view\n          );\n    }\n\n    if (bounds.top < viewport.top) {\n      deltaY = viewport.top - bounds.top;\n    } else if (bounds.bottom > viewport.bottom) {\n      deltaY = Math.max(\n        viewport.bottom - bounds.bottom,\n        viewport.top - bounds.top, // Don't move the top out of view\n      );\n    }\n\n    deltaX *= scale;\n    deltaY *= scale;\n    this.scroll(this.scrollX + deltaX, this.scrollY + deltaY);\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    return this.svgGroup_;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return (this.isMutator && this.options.parentWorkspace) || this;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {}\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\n\n  /** See IFocusableTree.getRootFocusableNode. */\n  getRootFocusableNode(): IFocusableNode {\n    return this;\n  }\n\n  /** See IFocusableTree.getRestoredFocusableNode. */\n  getRestoredFocusableNode(\n    previousNode: IFocusableNode | null,\n  ): IFocusableNode | null {\n    if (!previousNode) {\n      const flyout = this.targetWorkspace?.getFlyout();\n      if (this.isFlyout && flyout) {\n        // Return the first focusable item of the flyout.\n        return (\n          flyout\n            .getContents()\n            .find((flyoutItem) => {\n              const element = flyoutItem.getElement();\n              return isFocusableNode(element) && element.canBeFocused();\n            })\n            ?.getElement() ?? null\n        );\n      }\n      return this.getTopBlocks(true)[0] ?? null;\n    } else return null;\n  }\n\n  /** See IFocusableTree.getNestedTrees. */\n  getNestedTrees(): Array<IFocusableTree> {\n    const nestedWorkspaces = this.getAllBlocks()\n      .map((block) => block.getIcons())\n      .flat()\n      .filter(\n        (icon): icon is MutatorIcon =>\n          icon instanceof MutatorIcon && icon.bubbleIsVisible(),\n      )\n      .map((icon) => icon.getBubble()?.getWorkspace())\n      .filter((workspace) => !!workspace);\n\n    const ownFlyout = this.getFlyout(true);\n    if (ownFlyout) {\n      nestedWorkspaces.push(ownFlyout.getWorkspace());\n    }\n\n    return nestedWorkspaces;\n  }\n\n  /**\n   * Used for searching for a specific workspace comment.\n   * We can't use this.getWorkspaceCommentById because the workspace\n   * comment ids might not be globally unique, but the id assigned to\n   * the focusable element for the comment should be.\n   */\n  private searchForWorkspaceComment(\n    id: string,\n  ): RenderedWorkspaceComment | undefined {\n    for (const comment of this.getTopComments()) {\n      if (\n        comment instanceof RenderedWorkspaceComment &&\n        comment.canBeFocused() &&\n        comment.getFocusableElement().id === id\n      ) {\n        return comment;\n      }\n    }\n  }\n\n  /** See IFocusableTree.lookUpFocusableNode. */\n  lookUpFocusableNode(id: string): IFocusableNode | null {\n    // Check against flyout items if this workspace is part of a flyout. Note\n    // that blocks may match against this pass before reaching getBlockById()\n    // below (but only for a flyout workspace).\n    const flyout = this.targetWorkspace?.getFlyout();\n    if (this.isFlyout && flyout) {\n      for (const flyoutItem of flyout.getContents()) {\n        const elem = flyoutItem.getElement();\n        if (\n          isFocusableNode(elem) &&\n          elem.canBeFocused() &&\n          elem.getFocusableElement().id === id\n        ) {\n          return elem;\n        }\n      }\n    }\n\n    // Search for fields and connections (based on ID indicators).\n    const fieldIndicatorIndex = id.indexOf('_field_');\n    const connectionIndicatorIndex = id.indexOf('_connection_');\n    if (fieldIndicatorIndex !== -1) {\n      const blockId = id.substring(0, fieldIndicatorIndex);\n      const block = this.getBlockById(blockId);\n      if (block) {\n        for (const field of block.getFields()) {\n          if (field.canBeFocused() && field.getFocusableElement().id === id) {\n            return field;\n          }\n        }\n      }\n      return null;\n    } else if (connectionIndicatorIndex !== -1) {\n      const blockId = id.substring(0, connectionIndicatorIndex);\n      const block = this.getBlockById(blockId);\n      if (block) {\n        for (const connection of block.getConnections_(true)) {\n          if (connection.id === id) return connection;\n        }\n      }\n      return null;\n    }\n\n    // Search for a specific workspace comment or comment icon if the ID\n    // indicates the presence of one.\n    const commentIdSeparatorIndex = Math.max(\n      id.indexOf(COMMENT_EDITOR_FOCUS_IDENTIFIER),\n      id.indexOf(COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER),\n      id.indexOf(COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER),\n    );\n    if (commentIdSeparatorIndex !== -1) {\n      const commentId = id.substring(0, commentIdSeparatorIndex);\n      const comment = this.searchForWorkspaceComment(commentId);\n      if (comment) {\n        if (id.indexOf(COMMENT_EDITOR_FOCUS_IDENTIFIER) > -1) {\n          return comment.getEditorFocusableNode();\n        } else {\n          return (\n            comment.view\n              .getCommentBarButtons()\n              .find((button) => button.getFocusableElement().id.includes(id)) ??\n            null\n          );\n        }\n      }\n    }\n\n    // Search for a specific block.\n    // Don't use `getBlockById` because the block ID is not guaranteed\n    // to be globally unique, but the ID on the focusable element is.\n    const block = this.getAllBlocks(false).find(\n      (block) => block.getFocusableElement().id === id,\n    );\n    if (block) return block;\n\n    // Search for a workspace comment (semi-expensive).\n    const comment = this.searchForWorkspaceComment(id);\n    if (comment) {\n      return comment;\n    }\n\n    // Search for icons and bubbles (which requires an expensive getAllBlocks).\n    const icons = this.getAllBlocks()\n      .map((block) => block.getIcons())\n      .flat();\n    for (const icon of icons) {\n      if (icon.canBeFocused() && icon.getFocusableElement().id === id) {\n        return icon;\n      }\n      if (hasBubble(icon)) {\n        const bubble = icon.getBubble();\n        if (\n          bubble &&\n          bubble.canBeFocused() &&\n          bubble.getFocusableElement().id === id\n        ) {\n          return bubble;\n        } else if (\n          bubble instanceof TextInputBubble &&\n          bubble.getEditor().getFocusableElement().id === id\n        ) {\n          return bubble.getEditor();\n        }\n      }\n    }\n\n    return null;\n  }\n\n  /** See IFocusableTree.onTreeFocus. */\n  onTreeFocus(\n    _node: IFocusableNode,\n    _previousTree: IFocusableTree | null,\n  ): void {}\n\n  /** See IFocusableTree.onTreeBlur. */\n  onTreeBlur(nextTree: IFocusableTree | null): void {\n    // If the flyout loses focus, make sure to close it unless focus is being\n    // lost to the toolbox or ephemeral focus.\n    if (this.isFlyout && this.targetWorkspace) {\n      // Only hide the flyout if the flyout's workspace is losing focus and that\n      // focus isn't returning to the flyout itself, the toolbox, or ephemeral.\n      if (getFocusManager().ephemeralFocusTaken()) return;\n      const toolbox = this.targetWorkspace.getToolbox();\n      if (toolbox && nextTree === toolbox) return;\n      if (isAutoHideable(toolbox)) toolbox.autoHide(false);\n    }\n  }\n\n  /**\n   * Returns an object responsible for coordinating movement of focus between\n   * items on this workspace in response to keyboard navigation commands.\n   *\n   * @returns This workspace's Navigator instance.\n   */\n  getNavigator(): Navigator {\n    return this.navigator;\n  }\n\n  /**\n   * Sets the Navigator instance used by this workspace.\n   *\n   * @param newNavigator A Navigator object to coordinate movement between\n   *     elements on the workspace.\n   */\n  setNavigator(newNavigator: Navigator) {\n    this.navigator = newNavigator;\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 * @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// Former goog.module ID: Blockly.clipboard\n\nimport {BlockCopyData, BlockPaster} from './clipboard/block_paster.js';\nimport * as registry from './clipboard/registry.js';\nimport type {ICopyData, ICopyable} from './interfaces/i_copyable.js';\nimport {isSelectable} from './interfaces/i_selectable.js';\nimport * as globalRegistry from './registry.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\n\n/** Metadata about the object that is currently on the clipboard. */\nlet stashedCopyData: ICopyData | null = null;\n\nlet stashedWorkspace: WorkspaceSvg | null = null;\n\nlet stashedCoordinates: Coordinate | undefined = undefined;\n\n/**\n * Copy a copyable item, and record its data and the workspace it was\n * copied from.\n *\n * This function does not perform any checks to ensure the copy\n * should be allowed, e.g. to ensure the block is deletable. Such\n * checks should be done before calling this function.\n *\n * Note that if the copyable item is not an `ISelectable` or its\n * `workspace` property is not a `WorkspaceSvg`, the copy will be\n * successful, but there will be no saved workspace data. This will\n * impact the ability to paste the data unless you explictily pass\n * a workspace into the paste method.\n *\n * @param toCopy item to copy.\n * @param location location to save as a potential paste location.\n * @returns the copied data if copy was successful, otherwise null.\n */\nexport function copy<T extends ICopyData>(\n  toCopy: ICopyable<T>,\n  location?: Coordinate,\n): T | null {\n  const data = toCopy.toCopyData();\n  stashedCopyData = data;\n  if (isSelectable(toCopy) && toCopy.workspace instanceof WorkspaceSvg) {\n    stashedWorkspace = toCopy.workspace;\n  } else {\n    stashedWorkspace = null;\n  }\n\n  stashedCoordinates = location;\n  return data;\n}\n\n/**\n * Gets the copy data for the last item copied. This is useful if you\n * are implementing custom copy/paste behavior. If you want the default\n * behavior, just use the copy and paste methods directly.\n *\n * @returns copy data for the last item copied, or null if none set.\n */\nexport function getLastCopiedData() {\n  return stashedCopyData;\n}\n\n/**\n * Sets the last copied item. You should call this method if you implement\n * custom copy behavior, so that other callers are working with the correct\n * data. This method is called automatically if you use the built-in copy\n * method.\n *\n * @param copyData copy data for the last item copied.\n */\nexport function setLastCopiedData(copyData: ICopyData) {\n  stashedCopyData = copyData;\n}\n\n/**\n * Gets the workspace that was last copied from. This is useful if you\n * are implementing custom copy/paste behavior and want to paste on the\n * same workspace that was copied from. If you want the default behavior,\n * just use the copy and paste methods directly.\n *\n * @returns workspace that was last copied from, or null if none set.\n */\nexport function getLastCopiedWorkspace() {\n  return stashedWorkspace;\n}\n\n/**\n * Sets the workspace that was last copied from. You should call this method\n * if you implement custom copy behavior, so that other callers are working\n * with the correct data. This method is called automatically if you use the\n * built-in copy method.\n *\n * @param workspace workspace that was last copied from.\n */\nexport function setLastCopiedWorkspace(workspace: WorkspaceSvg) {\n  stashedWorkspace = workspace;\n}\n\n/**\n * Gets the location that was last copied from. This is useful if you\n * are implementing custom copy/paste behavior. If you want the\n * default behavior, just use the copy and paste methods directly.\n *\n * @returns last saved location, or null if none set.\n */\nexport function getLastCopiedLocation() {\n  return stashedCoordinates;\n}\n\n/**\n * Sets the location that was last copied from. You should call this method\n * if you implement custom copy behavior, so that other callers are working\n * with the correct data. This method is called automatically if you use the\n * built-in copy method.\n *\n * @param location last saved location, which can be used to paste at.\n */\nexport function setLastCopiedLocation(location: Coordinate) {\n  stashedCoordinates = location;\n}\n\n/**\n * Paste a pasteable element into the given workspace.\n *\n * This function does not perform any checks to ensure the paste\n * is allowed, e.g. that the workspace is rendered or the block\n * is pasteable. Such checks should be done before calling this\n * function.\n *\n * @param copyData The data to paste into the workspace.\n * @param workspace The workspace to paste the data into.\n * @param coordinate The location to paste the thing at.\n * @returns The pasted thing if the paste was successful, null otherwise.\n */\nexport function paste<T extends ICopyData>(\n  copyData: T,\n  workspace: WorkspaceSvg,\n  coordinate?: Coordinate,\n): ICopyable<T> | null;\n\n/**\n * Pastes the last copied ICopyable into the last copied-from workspace.\n *\n * @returns the pasted thing if the paste was successful, null otherwise.\n */\nexport function paste(): ICopyable<ICopyData> | null;\n\n/**\n * Pastes the given data into the workspace, or the last copied ICopyable if\n * no data is passed.\n *\n * @param copyData The data to paste into the workspace.\n * @param workspace The workspace to paste the data into.\n * @param coordinate The location to paste the thing at.\n * @returns The pasted thing if the paste was successful, null otherwise.\n */\nexport function paste<T extends ICopyData>(\n  copyData?: T,\n  workspace?: WorkspaceSvg,\n  coordinate?: Coordinate,\n): ICopyable<ICopyData> | null {\n  if (!copyData || !workspace) {\n    if (!stashedCopyData || !stashedWorkspace) return null;\n    return pasteFromData(stashedCopyData, stashedWorkspace, stashedCoordinates);\n  }\n  return pasteFromData(copyData, workspace, coordinate);\n}\n\n/**\n * Paste a pasteable element into the workspace.\n *\n * @param copyData The data to paste into the workspace.\n * @param workspace The workspace to paste the data into.\n * @param coordinate The location to paste the thing at.\n * @returns The pasted thing if the paste was successful, null otherwise.\n */\nfunction pasteFromData<T extends ICopyData>(\n  copyData: T,\n  workspace: WorkspaceSvg,\n  coordinate?: Coordinate,\n): ICopyable<T> | null {\n  workspace = workspace.isMutator\n    ? workspace\n    : // Use the parent workspace if it exists (e.g. for pasting into flyouts)\n      (workspace.options.parentWorkspace ?? workspace);\n  return (globalRegistry\n    .getObject(globalRegistry.Type.PASTER, copyData.paster, false)\n    ?.paste(copyData, workspace, coordinate) ?? null) as ICopyable<T> | null;\n}\n\nexport {BlockCopyData, BlockPaster, registry};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ICopyable\n\nimport type {ISelectable} from './i_selectable.js';\n\nexport interface ICopyable<T extends ICopyData> extends ISelectable {\n  /**\n   * Encode for copying.\n   *\n   * @returns Copy metadata.\n   */\n  toCopyData(): T | null;\n\n  /**\n   * Whether this instance is currently copyable. The standard implementation\n   * is to return true if isOwnDeletable and isOwnMovable return true.\n   *\n   * @returns True if it can currently be copied.\n   */\n  isCopyable?(): boolean;\n}\n\nexport namespace ICopyable {\n  export interface ICopyData {\n    paster: string;\n  }\n}\n\nexport type ICopyData = ICopyable.ICopyData;\n\n/** @returns true if the given object is an ICopyable. */\nexport function isCopyable(obj: any): obj is ICopyable<ICopyData> {\n  return obj && typeof obj.toCopyData === 'function';\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ShortcutItems\n\nimport {BlockSvg} from './block_svg.js';\nimport * as clipboard from './clipboard.js';\nimport {RenderedWorkspaceComment} from './comments.js';\nimport * as eventUtils from './events/utils.js';\nimport {getFocusManager} from './focus_manager.js';\nimport {isCopyable as isICopyable} from './interfaces/i_copyable.js';\nimport {isDeletable as isIDeletable} from './interfaces/i_deletable.js';\nimport {isDraggable} from './interfaces/i_draggable.js';\nimport {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport {KeyboardShortcut, ShortcutRegistry} from './shortcut_registry.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport {Rect} from './utils/rect.js';\nimport * as svgMath from './utils/svg_math.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Object holding the names of the default shortcut items.\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 */\nexport function registerEscape() {\n  const escapeAction: KeyboardShortcut = {\n    name: names.ESCAPE,\n    preconditionFn(workspace) {\n      return !workspace.isReadOnly();\n    },\n    callback(workspace) {\n      workspace.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 */\nexport function registerDelete() {\n  const deleteShortcut: KeyboardShortcut = {\n    name: names.DELETE,\n    preconditionFn(workspace, scope) {\n      const focused = scope.focusedNode;\n      return (\n        !workspace.isReadOnly() &&\n        focused != null &&\n        isIDeletable(focused) &&\n        focused.isDeletable() &&\n        !workspace.isDragging() &&\n        // Don't delete the block if a field editor is open\n        !getFocusManager().ephemeralFocusTaken()\n      );\n    },\n    callback(workspace, e, shortcut, scope) {\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      const focused = scope.focusedNode;\n      if (focused instanceof BlockSvg) {\n        focused.checkAndDelete();\n      } else if (isIDeletable(focused) && focused.isDeletable()) {\n        eventUtils.setGroup(true);\n        focused.dispose();\n        eventUtils.setGroup(false);\n      }\n      return true;\n    },\n    keyCodes: [KeyCodes.DELETE, KeyCodes.BACKSPACE],\n  };\n  ShortcutRegistry.registry.register(deleteShortcut);\n}\n\n/**\n * Determine if a focusable node can be copied.\n *\n * This will use the isCopyable method if the node implements it, otherwise\n * it will fall back to checking if the node is deletable and draggable not\n * considering the workspace's edit state.\n *\n * @param focused The focused object.\n */\nfunction isCopyable(focused: IFocusableNode): boolean {\n  if (!isICopyable(focused) || !isIDeletable(focused) || !isDraggable(focused))\n    return false;\n  if (focused.isCopyable) {\n    return focused.isCopyable();\n  } else if (\n    focused instanceof BlockSvg ||\n    focused instanceof RenderedWorkspaceComment\n  ) {\n    return focused.isOwnDeletable() && focused.isOwnMovable();\n  }\n  // This isn't a class Blockly knows about, so fall back to the stricter\n  // checks for deletable and movable.\n  return focused.isDeletable() && focused.isMovable();\n}\n\n/**\n * Determine if a focusable node can be cut.\n *\n * This will check if the node can be both copied and deleted in its current\n * workspace.\n *\n * @param focused The focused object.\n */\nfunction isCuttable(focused: IFocusableNode): boolean {\n  return isCopyable(focused) && isIDeletable(focused) && focused.isDeletable();\n}\n\n/**\n * Keyboard shortcut to copy a block on ctrl+c, cmd+c, or alt+c.\n */\nexport function registerCopy() {\n  const ctrlC = ShortcutRegistry.registry.createSerializedKey(KeyCodes.C, [\n    KeyCodes.CTRL,\n  ]);\n  const metaC = ShortcutRegistry.registry.createSerializedKey(KeyCodes.C, [\n    KeyCodes.META,\n  ]);\n\n  const copyShortcut: KeyboardShortcut = {\n    name: names.COPY,\n    preconditionFn(workspace, scope) {\n      const focused = scope.focusedNode;\n\n      const targetWorkspace = workspace.isFlyout\n        ? workspace.targetWorkspace\n        : workspace;\n      return (\n        !!focused &&\n        !!targetWorkspace &&\n        !targetWorkspace.isDragging() &&\n        !getFocusManager().ephemeralFocusTaken() &&\n        isCopyable(focused)\n      );\n    },\n    callback(workspace, e, shortcut, scope) {\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\n      const focused = scope.focusedNode;\n      if (!focused || !isICopyable(focused) || !isCopyable(focused))\n        return false;\n      const targetWorkspace = workspace.isFlyout\n        ? workspace.targetWorkspace\n        : workspace;\n      if (!targetWorkspace) return false;\n\n      if (!focused.workspace.isFlyout) {\n        targetWorkspace.hideChaff();\n      }\n\n      const copyCoords =\n        isDraggable(focused) && focused.workspace == targetWorkspace\n          ? focused.getRelativeToSurfaceXY()\n          : undefined;\n      return !!clipboard.copy(focused, copyCoords);\n    },\n    keyCodes: [ctrlC, 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 */\nexport function registerCut() {\n  const ctrlX = ShortcutRegistry.registry.createSerializedKey(KeyCodes.X, [\n    KeyCodes.CTRL,\n  ]);\n  const metaX = ShortcutRegistry.registry.createSerializedKey(KeyCodes.X, [\n    KeyCodes.META,\n  ]);\n\n  const cutShortcut: KeyboardShortcut = {\n    name: names.CUT,\n    preconditionFn(workspace, scope) {\n      const focused = scope.focusedNode;\n      return (\n        !!focused &&\n        !workspace.isReadOnly() &&\n        !workspace.isDragging() &&\n        !getFocusManager().ephemeralFocusTaken() &&\n        isCuttable(focused)\n      );\n    },\n    callback(workspace, e, shortcut, scope) {\n      const focused = scope.focusedNode;\n      if (!focused || !isCuttable(focused) || !isICopyable(focused)) {\n        return false;\n      }\n      const copyCoords = isDraggable(focused)\n        ? focused.getRelativeToSurfaceXY()\n        : undefined;\n      const copyData = clipboard.copy(focused, copyCoords);\n\n      if (focused instanceof BlockSvg) {\n        focused.checkAndDelete();\n      } else if (isIDeletable(focused)) {\n        focused.dispose();\n      }\n      return !!copyData;\n    },\n    keyCodes: [ctrlX, 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 */\nexport function registerPaste() {\n  const ctrlV = ShortcutRegistry.registry.createSerializedKey(KeyCodes.V, [\n    KeyCodes.CTRL,\n  ]);\n  const metaV = ShortcutRegistry.registry.createSerializedKey(KeyCodes.V, [\n    KeyCodes.META,\n  ]);\n\n  const pasteShortcut: KeyboardShortcut = {\n    name: names.PASTE,\n    preconditionFn() {\n      // Regardless of the currently focused workspace, we will only\n      // paste into the last-copied-from workspace.\n      const workspace = clipboard.getLastCopiedWorkspace();\n      // If we don't know where we copied from, we don't know where to paste.\n      // If the workspace isn't rendered (e.g. closed mutator workspace),\n      // we can't paste into it.\n      if (!workspace || !workspace.rendered) return false;\n      const targetWorkspace = workspace.isFlyout\n        ? workspace.targetWorkspace\n        : workspace;\n      return (\n        !!clipboard.getLastCopiedData() &&\n        !!targetWorkspace &&\n        !targetWorkspace.isReadOnly() &&\n        !targetWorkspace.isDragging() &&\n        !getFocusManager().ephemeralFocusTaken()\n      );\n    },\n    callback(workspace: WorkspaceSvg, e: Event) {\n      const copyData = clipboard.getLastCopiedData();\n      if (!copyData) return false;\n\n      const copyWorkspace = clipboard.getLastCopiedWorkspace();\n      if (!copyWorkspace) return false;\n\n      const targetWorkspace = copyWorkspace.isFlyout\n        ? copyWorkspace.targetWorkspace\n        : copyWorkspace;\n      if (!targetWorkspace || targetWorkspace.isReadOnly()) return false;\n\n      if (e instanceof PointerEvent) {\n        // The event that triggers a shortcut would conventionally be a KeyboardEvent.\n        // However, it may be a PointerEvent if a context menu item was used as a\n        // wrapper for this callback, in which case the new block(s) should be pasted\n        // at the mouse coordinates where the menu was opened, and this PointerEvent\n        // is where the menu was opened.\n        const mouseCoords = svgMath.screenToWsCoordinates(\n          targetWorkspace,\n          new Coordinate(e.clientX, e.clientY),\n        );\n        return !!clipboard.paste(copyData, targetWorkspace, mouseCoords);\n      }\n\n      const copyCoords = clipboard.getLastCopiedLocation();\n      if (!copyCoords) {\n        // If we don't have location data about the original copyable, let the\n        // paster determine position.\n        return !!clipboard.paste(copyData, targetWorkspace);\n      }\n\n      const {left, top, width, height} = targetWorkspace\n        .getMetricsManager()\n        .getViewMetrics(true);\n      const viewportRect = new Rect(top, top + height, left, left + width);\n\n      if (viewportRect.contains(copyCoords.x, copyCoords.y)) {\n        // If the original copyable is inside the viewport, let the paster\n        // determine position.\n        return !!clipboard.paste(copyData, targetWorkspace);\n      }\n\n      // Otherwise, paste in the middle of the viewport.\n      const centerCoords = new Coordinate(left + width / 2, top + height / 2);\n      return !!clipboard.paste(copyData, targetWorkspace, centerCoords);\n    },\n    keyCodes: [ctrlV, 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 */\nexport function registerUndo() {\n  const ctrlZ = ShortcutRegistry.registry.createSerializedKey(KeyCodes.Z, [\n    KeyCodes.CTRL,\n  ]);\n  const metaZ = ShortcutRegistry.registry.createSerializedKey(KeyCodes.Z, [\n    KeyCodes.META,\n  ]);\n\n  const undoShortcut: KeyboardShortcut = {\n    name: names.UNDO,\n    preconditionFn(workspace) {\n      return (\n        !workspace.isReadOnly() &&\n        !workspace.isDragging() &&\n        !getFocusManager().ephemeralFocusTaken()\n      );\n    },\n    callback(workspace, e) {\n      // 'z' for undo 'Z' is for redo.\n      (workspace as WorkspaceSvg).hideChaff();\n      workspace.undo(false);\n      e.preventDefault();\n      return true;\n    },\n    keyCodes: [ctrlZ, 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 */\nexport function registerRedo() {\n  const ctrlShiftZ = ShortcutRegistry.registry.createSerializedKey(KeyCodes.Z, [\n    KeyCodes.CTRL,\n    KeyCodes.SHIFT,\n  ]);\n  const metaShiftZ = ShortcutRegistry.registry.createSerializedKey(KeyCodes.Z, [\n    KeyCodes.META,\n    KeyCodes.SHIFT,\n  ]);\n  // Ctrl-y is redo in Windows.  Command-y is never valid on Macs.\n  const ctrlY = ShortcutRegistry.registry.createSerializedKey(KeyCodes.Y, [\n    KeyCodes.CTRL,\n  ]);\n\n  const redoShortcut: KeyboardShortcut = {\n    name: names.REDO,\n    preconditionFn(workspace) {\n      return (\n        !workspace.isDragging() &&\n        !workspace.isReadOnly() &&\n        !getFocusManager().ephemeralFocusTaken()\n      );\n    },\n    callback(workspace, e) {\n      // 'z' for undo 'Z' is for redo.\n      (workspace as WorkspaceSvg).hideChaff();\n      workspace.undo(true);\n      e.preventDefault();\n      return true;\n    },\n    keyCodes: [ctrlShiftZ, 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 * @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 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {IParameterModel} from '../interfaces/i_parameter_model.js';\nimport {IProcedureModel} from '../interfaces/i_procedure_model.js';\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport type {Workspace} from '../workspace.js';\nimport * as priorities from './priorities.js';\n\n/** Represents the state of a procedure model. */\nexport interface State {\n  id: string;\n  name: string;\n  returnTypes: string[] | null;\n  parameters?: ParameterState[];\n  [key: string]: unknown;\n}\n\n/** Represents the state of a parameter model. */\nexport interface ParameterState {\n  id: string;\n  name: string;\n  types?: string[];\n  [key: string]: unknown;\n}\n\n/**\n * A newable signature for an IProcedureModel.\n *\n * Refer to\n * https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes\n * for what is going on with this.\n */\ninterface ProcedureModelConstructor<ProcedureModel extends IProcedureModel> {\n  new (workspace: Workspace, name: string, id: string): ProcedureModel;\n\n  /**\n   * Deserializes the JSON state and returns a procedure model.\n   *\n   * @param state The state to deserialize.\n   * @param workspace The workspace to load the procedure model into.\n   * @returns The constructed procedure model.\n   */\n  loadState(state: object, workspace: Workspace): ProcedureModel;\n}\n\n/**\n * A newable signature for an IParameterModel.\n *\n * Refer to\n * https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes\n * for what is going on with this.\n */\ninterface ParameterModelConstructor<ParameterModel extends IParameterModel> {\n  new (workspace: Workspace, name: string, id: string): ParameterModel;\n\n  /**\n   * Deserializes the JSON state and returns a parameter model.\n   *\n   * @param state The state to deserialize.\n   * @param workspace The workspace to load the parameter model into.\n   * @returns The constructed parameter model.\n   */\n  loadState(state: object, workspace: Workspace): ParameterModel;\n}\n\n/**\n * Serializes the given IProcedureModel to JSON.\n */\nexport function saveProcedure(proc: IProcedureModel): State {\n  const state: State = proc.saveState();\n  if (!proc.getParameters().length) return state;\n  state.parameters = proc.getParameters().map((param) => param.saveState());\n  return state;\n}\n\n/**\n * Deserializes the given procedure model State from JSON.\n */\nexport function loadProcedure<\n  ProcedureModel extends IProcedureModel,\n  ParameterModel extends IParameterModel,\n>(\n  procedureModelClass: ProcedureModelConstructor<ProcedureModel>,\n  parameterModelClass: ParameterModelConstructor<ParameterModel>,\n  state: State,\n  workspace: Workspace,\n): ProcedureModel {\n  const proc = procedureModelClass.loadState(state, workspace);\n  if (!state.parameters) return proc;\n  for (const [index, param] of state.parameters.entries()) {\n    proc.insertParameter(\n      parameterModelClass.loadState(param, workspace),\n      index,\n    );\n  }\n  return proc;\n}\n\n/** Serializer for saving and loading procedure state. */\nexport class ProcedureSerializer<\n  ProcedureModel extends IProcedureModel,\n  ParameterModel extends IParameterModel,\n> implements ISerializer\n{\n  public priority = priorities.PROCEDURES;\n\n  /**\n   * Constructs the procedure serializer.\n   *\n   * Example usage:\n   *   new ProcedureSerializer(MyProcedureModelClass, MyParameterModelClass)\n   *\n   * @param procedureModelClass The class (implementing IProcedureModel) that\n   *     you want this serializer to deserialize.\n   * @param parameterModelClass The class (implementing IParameterModel) that\n   *     you want this serializer to deserialize.\n   */\n  constructor(\n    private readonly procedureModelClass: ProcedureModelConstructor<ProcedureModel>,\n    private readonly parameterModelClass: ParameterModelConstructor<ParameterModel>,\n  ) {}\n\n  /** Serializes the procedure models of the given workspace. */\n  save(workspace: Workspace): State[] | null {\n    const save = workspace\n      .getProcedureMap()\n      .getProcedures()\n      .map((proc) => saveProcedure(proc));\n    return save.length ? save : null;\n  }\n\n  /**\n   * Deserializes the procedures models defined by the given state into the\n   * workspace.\n   */\n  load(state: State[], workspace: Workspace) {\n    const map = workspace.getProcedureMap();\n    for (const procState of state) {\n      map.add(\n        loadProcedure(\n          this.procedureModelClass,\n          this.parameterModelClass,\n          procState,\n          workspace,\n        ),\n      );\n    }\n  }\n\n  /** Disposes of any procedure models that exist on the workspace. */\n  clear(workspace: Workspace) {\n    workspace.getProcedureMap().clear();\n  }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.serialization.workspaces\n\nimport {EventType} from '../events/type.js';\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';\nimport type {Workspace} from '../workspace.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\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 */\nexport function save(workspace: Workspace): {\n  [key: string]: AnyDuringMigration;\n} {\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 */\nexport function load(\n  state: {[key: string]: AnyDuringMigration},\n  workspace: Workspace,\n  {recordUndo = false}: {recordUndo?: boolean} = {},\n) {\n  const serializerMap = registry.getAllItems(registry.Type.SERIALIZER, true);\n  if (!serializerMap) {\n    return;\n  }\n\n  const deserializers = Object.entries(serializerMap).sort(\n    (a, b) => (b[1] as ISerializer)!.priority - (a[1] as ISerializer)!.priority,\n  );\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 (const [name, deserializer] of deserializers.reverse()) {\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(EventType.FINISHED_LOADING))(workspace));\n\n  eventUtils.setGroup(existingGroup);\n  eventUtils.setRecordUndo(prevRecordUndo);\n}\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.inject\n\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 {Options} from './options.js';\nimport {ScrollbarPair} from './scrollbar_pair.js';\nimport * as Tooltip from './tooltip.js';\nimport * as Touch from './touch.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\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 */\nexport function inject(\n  container: Element | string,\n  opt_options?: BlocklyOptions,\n): WorkspaceSvg {\n  let containerElement: Element | null = null;\n  if (typeof container === 'string') {\n    containerElement =\n      document.getElementById(container) || document.querySelector(container);\n  } else {\n    containerElement = container;\n  }\n  // Verify that the container is in document.\n  if (\n    !document.contains(containerElement) &&\n    document !== containerElement?.ownerDocument\n  ) {\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  dom.addClass(subContainer, 'injectionDiv');\n  if (opt_options?.rtl) {\n    dom.addClass(subContainer, 'blocklyRTL');\n  }\n\n  containerElement!.appendChild(subContainer);\n  const svg = createDom(subContainer, options);\n\n  const workspace = createMainWorkspace(subContainer, svg, options);\n\n  init(workspace);\n\n  // Keep focus on the first workspace so entering keyboard navigation looks\n  // correct.\n  common.setMainWorkspace(workspace);\n\n  common.svgResize(workspace);\n\n  subContainer.addEventListener('focusin', function () {\n    common.setMainWorkspace(workspace);\n  });\n\n  browserEvents.conditionalBind(\n    subContainer,\n    'keydown',\n    null,\n    common.globalShortcutHandler,\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: HTMLElement, options: Options): SVGElement {\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    {\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    },\n    container,\n  );\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(\n    rnd,\n    options.gridOptions,\n    defs,\n    container,\n  );\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 * @returns Newly created main workspace.\n */\nfunction createMainWorkspace(\n  injectionDiv: HTMLElement,\n  svg: SVGElement,\n  options: Options,\n): WorkspaceSvg {\n  options.parentWorkspace = null;\n  const mainWorkspace = new WorkspaceSvg(options);\n  const wsOptions = mainWorkspace.options;\n  mainWorkspace.scale = wsOptions.zoomOptions.startScale;\n  svg.appendChild(\n    mainWorkspace.createDom('blocklyMainBackground', injectionDiv),\n  );\n\n  // Set the theme name and renderer name onto the injection div.\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\n    .getThemeManager()\n    .subscribe(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\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,\n    'contextmenu',\n    null,\n    function (e: Event) {\n      if (!browserEvents.isTargetInput(e)) {\n        e.preventDefault();\n      }\n    },\n  );\n\n  const workspaceResizeHandler = browserEvents.conditionalBind(\n    window,\n    'resize',\n    null,\n    function () {\n      // Don't hide all the chaff. Leave the dropdown and widget divs open if\n      // possible.\n      Tooltip.hide();\n      mainWorkspace.hideComponents(true);\n      dropDownDiv.repositionForWindowResize();\n      WidgetDiv.repositionForWindowResize();\n      common.svgResize(mainWorkspace);\n      bumpObjects.bumpTopObjectsIntoBounds(mainWorkspace);\n    },\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 =\n      options.moveOptions.scrollbars === true ||\n      !!options.moveOptions.scrollbars.horizontal;\n    const verticalScroll =\n      options.moveOptions.scrollbars === true ||\n      !!options.moveOptions.scrollbars.vertical;\n    mainWorkspace.scrollbar = new ScrollbarPair(\n      mainWorkspace,\n      horizontalScroll,\n      verticalScroll,\n      'blocklyMainWorkspaceScrollbar',\n    );\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 * 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 */\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    // 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  }\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  );\n  audioMgr.load(\n    [\n      pathToMedia + 'disconnect.wav',\n      pathToMedia + 'disconnect.mp3',\n      pathToMedia + 'disconnect.ogg',\n    ],\n    'disconnect',\n  );\n  audioMgr.load(\n    [\n      pathToMedia + 'delete.mp3',\n      pathToMedia + 'delete.ogg',\n      pathToMedia + 'delete.wav',\n    ],\n    'delete',\n  );\n\n  // Bind temporary hooks that preload the sounds.\n  const soundBinds: browserEvents.Data[] = [];\n  /**\n   *\n   */\n  function unbindSounds() {\n    while (soundBinds.length) {\n      const oldSoundBinding = soundBinds.pop();\n      if (oldSoundBinding) {\n        browserEvents.unbind(oldSoundBinding);\n      }\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(\n    browserEvents.conditionalBind(\n      document,\n      'pointermove',\n      null,\n      unbindSounds,\n      true,\n    ),\n  );\n  soundBinds.push(\n    browserEvents.conditionalBind(\n      document,\n      'touchstart',\n      null,\n      unbindSounds,\n      true,\n    ),\n  );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ContextMenuItems\n\nimport type {BlockSvg} from './block_svg.js';\nimport * as clipboard from './clipboard.js';\nimport {RenderedWorkspaceComment} from './comments/rendered_workspace_comment.js';\nimport {MANUALLY_DISABLED} from './constants.js';\nimport {\n  ContextMenuRegistry,\n  RegistryItem,\n  Scope,\n} 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 {getFocusManager} from './focus_manager.js';\nimport {CommentIcon} from './icons/comment_icon.js';\nimport {Msg} from './msg.js';\nimport {StatementInput} from './renderers/zelos/zelos.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as svgMath from './utils/svg_math.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\nfunction isFullBlockField(block?: BlockSvg) {\n  if (!block || !block.isSimpleReporter()) return false;\n  const firstField = block.getFields().next().value;\n  return firstField?.isFullBlockField();\n}\n\n/**\n * Option to undo previous action.\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 */\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 */\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 */\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 */\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.  If not specified, create a new group.\n */\nfunction deleteNext_(deleteList: BlockSvg[], eventGroup?: string) {\n  const DELAY = 10;\n  if (eventGroup) {\n    eventUtils.setGroup(eventGroup);\n  } else {\n    eventUtils.setGroup(true);\n    eventGroup = eventUtils.getGroup();\n  }\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 */\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      }\n      return Msg['DELETE_X_BLOCKS'].replace('%1', `${deletableBlocksLength}`);\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      if (deletableBlocks.length < 2) {\n        deleteNext_(deletableBlocks);\n      } else {\n        dialog.confirm(\n          Msg['DELETE_ALL_BLOCKS'].replace(\n            '%1',\n            String(deletableBlocks.length),\n          ),\n          function (ok) {\n            if (ok) {\n              deleteNext_(deletableBlocks);\n            }\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 */\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) return;\n      const data = scope.block.toCopyData();\n      if (!data) return;\n      clipboard.paste(data, scope.block.workspace);\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 */\nexport function registerComment() {\n  const commentOption: RegistryItem = {\n    displayText(scope: Scope) {\n      if (scope.block!.hasIcon(CommentIcon.TYPE)) {\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 (\n        block &&\n        !block.isInFlyout &&\n        block.workspace.options.comments &&\n        !block.isCollapsed() &&\n        block.isEditable() &&\n        // Either block already has a comment so let us remove it,\n        // or the block isn't just one full-block field block, which\n        // shouldn't be allowed to have comments as there's no way to read them.\n        (block.hasIcon(CommentIcon.TYPE) || !isFullBlockField(block))\n      ) {\n        return 'enabled';\n      }\n      return 'hidden';\n    },\n    callback(scope: Scope) {\n      const block = scope.block;\n      if (block && block.hasIcon(CommentIcon.TYPE)) {\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 */\nexport function registerInline() {\n  const inlineOption: RegistryItem = {\n    displayText(scope: Scope) {\n      return scope.block!.getInputsInline()\n        ? 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 (\n            !(block!.inputList[i - 1] instanceof StatementInput) &&\n            !(block!.inputList[i] instanceof StatementInput)\n          ) {\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 */\nexport function registerCollapseExpandBlock() {\n  const collapseExpandOption: RegistryItem = {\n    displayText(scope: Scope) {\n      return scope.block!.isCollapsed()\n        ? Msg['EXPAND_BLOCK']\n        : Msg['COLLAPSE_BLOCK'];\n    },\n    preconditionFn(scope: Scope) {\n      const block = scope.block;\n      if (\n        !block!.isInFlyout &&\n        block!.isMovable() &&\n        block!.workspace.options.collapse\n      ) {\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 */\nexport function registerDisable() {\n  const disableOption: RegistryItem = {\n    displayText(scope: Scope) {\n      return scope.block!.hasDisabledReason(MANUALLY_DISABLED)\n        ? Msg['ENABLE_BLOCK']\n        : Msg['DISABLE_BLOCK'];\n    },\n    preconditionFn(scope: Scope) {\n      const block = scope.block;\n      if (\n        !block!.isInFlyout &&\n        block!.workspace.options.disable &&\n        block!.isEditable()\n      ) {\n        // Determine whether this block is currently disabled for any reason\n        // other than the manual reason that this context menu item controls.\n        const disabledReasons = block!.getDisabledReasons();\n        const isDisabledForOtherReason =\n          disabledReasons.size >\n          (disabledReasons.has(MANUALLY_DISABLED) ? 1 : 0);\n\n        if (block!.getInheritedDisabled() || isDisabledForOtherReason) {\n          return 'disabled';\n        }\n        return 'enabled';\n      }\n      return 'hidden';\n    },\n    callback(scope: Scope) {\n      const block = scope.block;\n      const existingGroup = eventUtils.getGroup();\n      if (!existingGroup) {\n        eventUtils.setGroup(true);\n      }\n      block!.setDisabledReason(\n        !block!.hasDisabledReason(MANUALLY_DISABLED),\n        MANUALLY_DISABLED,\n      );\n      eventUtils.setGroup(existingGroup);\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 */\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', `${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 */\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 =\n        typeof block!.helpUrl === 'function'\n          ? 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 an option for deleting a workspace comment. */\nexport function registerCommentDelete() {\n  const deleteOption: RegistryItem = {\n    displayText: () => Msg['REMOVE_COMMENT'],\n    preconditionFn(scope: Scope) {\n      return scope.comment?.isDeletable() ? 'enabled' : 'hidden';\n    },\n    callback(scope: Scope) {\n      eventUtils.setGroup(true);\n      scope.comment?.dispose();\n      eventUtils.setGroup(false);\n    },\n    scopeType: ContextMenuRegistry.ScopeType.COMMENT,\n    id: 'commentDelete',\n    weight: 6,\n  };\n  ContextMenuRegistry.registry.register(deleteOption);\n}\n\n/** Registers an option for duplicating a workspace comment. */\nexport function registerCommentDuplicate() {\n  const duplicateOption: RegistryItem = {\n    displayText: () => Msg['DUPLICATE_COMMENT'],\n    preconditionFn(scope: Scope) {\n      return scope.comment?.isMovable() ? 'enabled' : 'hidden';\n    },\n    callback(scope: Scope) {\n      if (!scope.comment) return;\n      const data = scope.comment.toCopyData();\n      if (!data) return;\n      clipboard.paste(data, scope.comment.workspace);\n    },\n    scopeType: ContextMenuRegistry.ScopeType.COMMENT,\n    id: 'commentDuplicate',\n    weight: 1,\n  };\n  ContextMenuRegistry.registry.register(duplicateOption);\n}\n\n/** Registers an option for adding a workspace comment to the workspace. */\nexport function registerCommentCreate() {\n  const createOption: RegistryItem = {\n    displayText: () => Msg['ADD_COMMENT'],\n    preconditionFn: (scope: Scope) => {\n      return scope.workspace?.isMutator ? 'hidden' : 'enabled';\n    },\n    callback: (\n      scope: Scope,\n      menuOpenEvent: Event,\n      menuSelectEvent: Event,\n      location: Coordinate,\n    ) => {\n      const workspace = scope.workspace;\n      if (!workspace) return;\n      eventUtils.setGroup(true);\n      const comment = new RenderedWorkspaceComment(workspace);\n      comment.setPlaceholderText(Msg['WORKSPACE_COMMENT_DEFAULT_TEXT']);\n      comment.moveTo(\n        svgMath.screenToWsCoordinates(\n          workspace,\n          new Coordinate(location.x, location.y),\n        ),\n      );\n      getFocusManager().focusNode(comment);\n      eventUtils.setGroup(false);\n    },\n    scopeType: ContextMenuRegistry.ScopeType.WORKSPACE,\n    id: 'commentCreate',\n    weight: 8,\n  };\n  ContextMenuRegistry.registry.register(createOption);\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/** Registers all workspace comment related menu items. */\nexport function registerCommentOptions() {\n  registerCommentDuplicate();\n  registerCommentDelete();\n  registerCommentCreate();\n}\n\n/**\n * Registers all default context menu items. This should be called once per\n * instance of ContextMenuRegistry.\n *\n * @internal\n */\nexport function registerDefaultOptions() {\n  registerWorkspaceOptions_();\n  registerBlockOptions_();\n}\n\nregisterDefaultOptions();\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Coordinate} from '../utils/coordinate.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\nimport {ICopyable, ICopyData} from './i_copyable.js';\n\n/** An object that can paste data into a workspace. */\nexport interface IPaster<U extends ICopyData, T extends ICopyable<U>> {\n  paste(\n    copyData: U,\n    workspace: WorkspaceSvg,\n    coordinate?: Coordinate,\n  ): T | null;\n}\n\n/** @returns True if the given object is a paster. */\nexport function isPaster(\n  obj: any,\n): obj is IPaster<ICopyData, ICopyable<ICopyData>> {\n  return obj && typeof obj.paste === 'function';\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface IRenderedElement {\n  /**\n   * @returns The root SVG element of this rendered element.\n   */\n  getSvgRoot(): SVGElement;\n}\n\n/**\n * @returns True if the given object is an IRenderedElement.\n */\nexport function isRenderedElement(obj: any): obj is IRenderedElement {\n  return obj && typeof obj.getSvgRoot === 'function';\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ISelectableToolboxItem\n\nimport type {FlyoutItemInfoArray} from '../utils/toolbox';\nimport type {IToolboxItem} from './i_toolbox_item.js';\n\n/**\n * Interface for an item in the toolbox that can be selected.\n */\nexport interface ISelectableToolboxItem extends IToolboxItem {\n  /**\n   * Gets the name of the toolbox item. Used for emitting events.\n   *\n   * @returns The name of the toolbox item.\n   */\n  getName(): string;\n\n  /**\n   * Gets the contents of the toolbox item. 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\n  /**\n   * Sets the current toolbox item as selected.\n   *\n   * @param _isSelected True if this category is selected, false otherwise.\n   */\n  setSelected(_isSelected: boolean): void;\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  getClickTarget(): Element;\n\n  /**\n   * Handles when the toolbox item is clicked.\n   *\n   * @param _e Click event to handle.\n   */\n  onClick(_e: Event): void;\n}\n\n/**\n * Type guard that checks whether an IToolboxItem is an ISelectableToolboxItem.\n */\nexport function isSelectableToolboxItem(\n  toolboxItem: IToolboxItem,\n): toolboxItem is ISelectableToolboxItem {\n  return toolboxItem.isSelectable();\n}\n","/**\n * @license\n * Copyright 2011 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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_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 {BlockFlyoutInflater} from './block_flyout_inflater.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 * as bubbles from './bubbles.js';\nimport {MiniWorkspaceBubble} from './bubbles/mini_workspace_bubble.js';\nimport * as bumpObjects from './bump_objects.js';\nimport {ButtonFlyoutInflater} from './button_flyout_inflater.js';\nimport * as clipboard from './clipboard.js';\nimport * as comments from './comments.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 constants from './constants.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 dragging from './dragging.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport * as Events from './events/events.js';\nimport * as Extensions from './extensions.js';\nimport {\n  Field,\n  FieldConfig,\n  FieldValidator,\n  UnattachedFieldError,\n} from './field.js';\nimport {\n  FieldCheckbox,\n  FieldCheckboxConfig,\n  FieldCheckboxFromJsonConfig,\n  FieldCheckboxValidator,\n} from './field_checkbox.js';\nimport {\n  FieldDropdown,\n  FieldDropdownConfig,\n  FieldDropdownFromJsonConfig,\n  FieldDropdownValidator,\n  ImageProperties,\n  MenuGenerator,\n  MenuGeneratorFunction,\n  MenuOption,\n} from './field_dropdown.js';\nimport {\n  FieldImage,\n  FieldImageConfig,\n  FieldImageFromJsonConfig,\n} from './field_image.js';\nimport {\n  FieldLabel,\n  FieldLabelConfig,\n  FieldLabelFromJsonConfig,\n} from './field_label.js';\nimport {FieldLabelSerializable} from './field_label_serializable.js';\nimport {\n  FieldNumber,\n  FieldNumberConfig,\n  FieldNumberFromJsonConfig,\n  FieldNumberValidator,\n} from './field_number.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {\n  FieldTextInput,\n  FieldTextInputConfig,\n  FieldTextInputFromJsonConfig,\n  FieldTextInputValidator,\n} from './field_textinput.js';\nimport {\n  FieldVariable,\n  FieldVariableConfig,\n  FieldVariableFromJsonConfig,\n  FieldVariableValidator,\n} from './field_variable.js';\nimport {Flyout} from './flyout_base.js';\nimport {FlyoutButton} from './flyout_button.js';\nimport {HorizontalFlyout} from './flyout_horizontal.js';\nimport {FlyoutItem} from './flyout_item.js';\nimport {FlyoutMetricsManager} from './flyout_metrics_manager.js';\nimport {FlyoutSeparator} from './flyout_separator.js';\nimport {VerticalFlyout} from './flyout_vertical.js';\nimport {\n  FocusManager,\n  ReturnEphemeralFocus,\n  getFocusManager,\n} from './focus_manager.js';\nimport {CodeGenerator} from './generator.js';\nimport {Gesture} from './gesture.js';\nimport {Grid} from './grid.js';\nimport * as icons from './icons.js';\nimport {inject} from './inject.js';\nimport * as inputs from './inputs.js';\nimport {IFlyoutInflater} from './interfaces/i_flyout_inflater.js';\nimport {LabelFlyoutInflater} from './label_flyout_inflater.js';\nimport {SeparatorFlyoutInflater} from './separator_flyout_inflater.js';\nimport {FocusableTreeTraverser} from './utils/focusable_tree_traverser.js';\n\nimport {Input} from './inputs/input.js';\nimport {InsertionMarkerPreviewer} from './insertion_marker_previewer.js';\nimport {IAutoHideable} from './interfaces/i_autohideable.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 {IConnectionPreviewer} from './interfaces/i_connection_previewer.js';\nimport {IContextMenu} from './interfaces/i_contextmenu.js';\nimport {ICopyData, ICopyable, isCopyable} from './interfaces/i_copyable.js';\nimport {IDeletable, isDeletable} from './interfaces/i_deletable.js';\nimport {IDeleteArea} from './interfaces/i_delete_area.js';\nimport {IDragTarget} from './interfaces/i_drag_target.js';\nimport {\n  IDragStrategy,\n  IDraggable,\n  isDraggable,\n} from './interfaces/i_draggable.js';\nimport {IDragger} from './interfaces/i_dragger.js';\nimport {IFlyout} from './interfaces/i_flyout.js';\nimport {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport {IHasBubble, hasBubble} from './interfaces/i_has_bubble.js';\nimport {IIcon, isIcon} from './interfaces/i_icon.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 {IObservable, isObservable} from './interfaces/i_observable.js';\nimport {IPaster, isPaster} from './interfaces/i_paster.js';\nimport {IPositionable} from './interfaces/i_positionable.js';\nimport {IRegistrable} from './interfaces/i_registrable.js';\nimport {\n  IRenderedElement,\n  isRenderedElement,\n} from './interfaces/i_rendered_element.js';\nimport {ISelectable, isSelectable} from './interfaces/i_selectable.js';\nimport {ISelectableToolboxItem} from './interfaces/i_selectable_toolbox_item.js';\nimport {ISerializable, isSerializable} from './interfaces/i_serializable.js';\nimport {IStyleable} from './interfaces/i_styleable.js';\nimport {IToolbox} from './interfaces/i_toolbox.js';\nimport {IToolboxItem} from './interfaces/i_toolbox_item.js';\nimport {\n  IVariableBackedParameterModel,\n  isVariableBackedParameterModel,\n} from './interfaces/i_variable_backed_parameter_model.js';\nimport {IVariableMap} from './interfaces/i_variable_map.js';\nimport {IVariableModel, IVariableState} from './interfaces/i_variable_model.js';\nimport * as internalConstants from './internal_constants.js';\nimport {LineCursor} from './keyboard_nav/line_cursor.js';\nimport {Marker} from './keyboard_nav/marker.js';\nimport {\n  KeyboardNavigationController,\n  keyboardNavigationController,\n} from './keyboard_navigation_controller.js';\nimport type {LayerManager} from './layer_manager.js';\nimport * as layers from './layers.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 {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 * as renderManagement from './render_management.js';\nimport {RenderedConnection} from './rendered_connection.js';\nimport * as blockRendering from './renderers/common/block_rendering.js';\nimport * as geras from './renderers/geras/geras.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 serialization from './serialization.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 {Trashcan} from './trashcan.js';\nimport * as utils from './utils.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 * as WidgetDiv from './widgetdiv.js';\nimport {Workspace} from './workspace.js';\nimport {WorkspaceAudio} from './workspace_audio.js';\nimport {WorkspaceDragger} from './workspace_dragger.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\nimport {ZoomControls} from './zoom_controls.js';\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 */\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 constants used for connection and input types.\n */\n\n/**\n * @see ConnectionType.INPUT_VALUE\n */\nexport const INPUT_VALUE = ConnectionType.INPUT_VALUE;\n\n/**\n * @see ConnectionType.OUTPUT_VALUE\n */\nexport const OUTPUT_VALUE = ConnectionType.OUTPUT_VALUE;\n\n/**\n * @see ConnectionType.NEXT_STATEMENT\n */\nexport const NEXT_STATEMENT = ConnectionType.NEXT_STATEMENT;\n\n/**\n * @see ConnectionType.PREVIOUS_STATEMENT\n */\nexport const PREVIOUS_STATEMENT = ConnectionType.PREVIOUS_STATEMENT;\n\n/** Aliases for toolbox positions. */\n\n/**\n * @see toolbox.Position.TOP\n */\nexport const TOOLBOX_AT_TOP = toolbox.Position.TOP;\n\n/**\n * @see toolbox.Position.BOTTOM\n */\nexport const TOOLBOX_AT_BOTTOM = toolbox.Position.BOTTOM;\n\n/**\n * @see toolbox.Position.LEFT\n */\nexport const TOOLBOX_AT_LEFT = toolbox.Position.LEFT;\n\n/**\n * @see toolbox.Position.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 */\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 */\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 */\nexport const getMainWorkspace = common.getMainWorkspace;\n\n/**\n * Returns the currently selected copyable object.\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 */\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 */\nexport const setParentContainer = common.setParentContainer;\n\n// Aliases to allow external code to access these values for legacy reasons.\nexport const COLLAPSE_CHARS = internalConstants.COLLAPSE_CHARS;\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 */\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 */\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 */\nexport const PROCEDURE_CATEGORY_NAME: string = Procedures.CATEGORY_NAME;\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 = function (\n  prototypeName: string,\n  opt_id?: string,\n): Block {\n  return new Block(this, prototypeName, opt_id);\n};\n\nWorkspaceSvg.prototype.newBlock = function (\n  prototypeName: string,\n  opt_id?: string,\n): BlockSvg {\n  return new BlockSvg(this, prototypeName, opt_id);\n};\n\nWorkspace.prototype.newComment = function (\n  id?: string,\n): comments.WorkspaceComment {\n  return new comments.WorkspaceComment(this, id);\n};\n\nWorkspaceSvg.prototype.newComment = function (\n  id?: string,\n): comments.RenderedWorkspaceComment {\n  return new comments.RenderedWorkspaceComment(this, id);\n};\n\nWorkspaceSvg.newTrashcan = function (workspace: WorkspaceSvg): Trashcan {\n  return new Trashcan(workspace);\n};\n\nMiniWorkspaceBubble.prototype.newWorkspaceSvg = function (\n  options: Options,\n): WorkspaceSvg {\n  return new WorkspaceSvg(options);\n};\n\nNames.prototype.populateProcedures = function (\n  this: Names,\n  workspace: Workspace,\n) {\n  const procedures = Procedures.allProcedures(workspace);\n  // Flatten the return vs no-return procedure lists.\n  const flattenedProcedures = 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\nexport * from './flyout_navigator.js';\nexport * from './interfaces/i_navigation_policy.js';\nexport * from './keyboard_nav/block_navigation_policy.js';\nexport * from './keyboard_nav/connection_navigation_policy.js';\nexport * from './keyboard_nav/field_navigation_policy.js';\nexport * from './keyboard_nav/flyout_button_navigation_policy.js';\nexport * from './keyboard_nav/flyout_navigation_policy.js';\nexport * from './keyboard_nav/flyout_separator_navigation_policy.js';\nexport * from './keyboard_nav/workspace_navigation_policy.js';\nexport * from './navigator.js';\nexport * from './toast.js';\n\n// Re-export submodules that no longer declareLegacyNamespace.\nexport {\n  Block,\n  BlockSvg,\n  BlocklyOptions,\n  Blocks,\n  CollapsibleToolboxCategory,\n  ComponentManager,\n  Connection,\n  ConnectionChecker,\n  ConnectionDB,\n  ConnectionType,\n  ContextMenu,\n  ContextMenuItems,\n  ContextMenuRegistry,\n  Css,\n  DeleteArea,\n  DragTarget,\n  Events,\n  Extensions,\n  LineCursor,\n  Procedures,\n  ShortcutItems,\n  Themes,\n  Tooltip,\n  Touch,\n  Variables,\n  VariablesDynamic,\n  WidgetDiv,\n  Xml,\n  blockAnimations,\n  blockRendering,\n  browserEvents,\n  bubbles,\n  bumpObjects,\n  clipboard,\n  comments,\n  common,\n  constants,\n  dialog,\n  dragging,\n  fieldRegistry,\n  geras,\n  Procedures as procedures,\n  registry,\n  thrasos,\n  uiPosition,\n  utils,\n  zelos,\n};\nexport const DropDownDiv = dropDownDiv;\nexport {\n  BlockFlyoutInflater,\n  ButtonFlyoutInflater,\n  CodeGenerator,\n  Field,\n  FieldCheckbox,\n  FieldCheckboxConfig,\n  FieldCheckboxFromJsonConfig,\n  FieldCheckboxValidator,\n  FieldConfig,\n  FieldDropdown,\n  FieldDropdownConfig,\n  FieldDropdownFromJsonConfig,\n  FieldDropdownValidator,\n  FieldImage,\n  FieldImageConfig,\n  FieldImageFromJsonConfig,\n  FieldLabel,\n  FieldLabelConfig,\n  FieldLabelFromJsonConfig,\n  FieldLabelSerializable,\n  FieldNumber,\n  FieldNumberConfig,\n  FieldNumberFromJsonConfig,\n  FieldNumberValidator,\n  FieldTextInput,\n  FieldTextInputConfig,\n  FieldTextInputFromJsonConfig,\n  FieldTextInputValidator,\n  FieldValidator,\n  FieldVariable,\n  FieldVariableConfig,\n  FieldVariableFromJsonConfig,\n  FieldVariableValidator,\n  Flyout,\n  FlyoutButton,\n  FlyoutItem,\n  FlyoutMetricsManager,\n  FlyoutSeparator,\n  FocusManager,\n  FocusableTreeTraverser,\n  CodeGenerator as Generator,\n  Gesture,\n  Grid,\n  HorizontalFlyout,\n  IAutoHideable,\n  IBoundedElement,\n  IBubble,\n  ICollapsibleToolboxItem,\n  IComponent,\n  IConnectionChecker,\n  IConnectionPreviewer,\n  IContextMenu,\n  ICopyData,\n  ICopyable,\n  IDeletable,\n  IDeleteArea,\n  IDragStrategy,\n  IDragTarget,\n  IDraggable,\n  IDragger,\n  IFlyout,\n  IFlyoutInflater,\n  IFocusableNode,\n  IFocusableTree,\n  IHasBubble,\n  IIcon,\n  IKeyboardAccessible,\n  IMetricsManager,\n  IMovable,\n  IObservable,\n  IPaster,\n  IPositionable,\n  IRegistrable,\n  IRenderedElement,\n  ISelectable,\n  ISelectableToolboxItem,\n  ISerializable,\n  IStyleable,\n  IToolbox,\n  IToolboxItem,\n  IVariableBackedParameterModel,\n  IVariableMap,\n  IVariableModel,\n  IVariableState,\n  ImageProperties,\n  Input,\n  InsertionMarkerPreviewer,\n  KeyboardNavigationController,\n  LabelFlyoutInflater,\n  LayerManager,\n  Marker,\n  MarkerManager,\n  Menu,\n  MenuGenerator,\n  MenuGeneratorFunction,\n  MenuItem,\n  MenuOption,\n  MetricsManager,\n  Msg,\n  Names,\n  Options,\n  RenderedConnection,\n  ReturnEphemeralFocus,\n  Scrollbar,\n  ScrollbarPair,\n  SeparatorFlyoutInflater,\n  ShortcutRegistry,\n  Theme,\n  ThemeManager,\n  Toolbox,\n  ToolboxCategory,\n  ToolboxItem,\n  ToolboxSeparator,\n  Trashcan,\n  UnattachedFieldError,\n  VariableMap,\n  VariableModel,\n  VerticalFlyout,\n  Workspace,\n  WorkspaceAudio,\n  WorkspaceDragger,\n  WorkspaceSvg,\n  ZoomControls,\n  config,\n  getFocusManager,\n  hasBubble,\n  icons,\n  inject,\n  inputs,\n  isCopyable,\n  isDeletable,\n  isDraggable,\n  isIcon,\n  isObservable,\n  isPaster,\n  isRenderedElement,\n  isSelectable,\n  isSerializable,\n  isVariableBackedParameterModel,\n  keyboardNavigationController,\n  layers,\n  renderManagement,\n  serialization,\n  setLocale,\n};\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableNode} from './i_focusable_node.js';\n\n/**\n * Represents a tree of focusable elements with its own active/passive focus\n * context.\n *\n * Note that focus is handled by FocusManager, and tree implementations can have\n * at most one IFocusableNode focused at one time. If the tree itself has focus,\n * then the tree's focused node is considered 'active' ('passive' if another\n * tree has focus).\n *\n * Focus is shared between one or more trees, where each tree can have exactly\n * one active or passive node (and only one active node can exist on the whole\n * page at any given time). The idea of passive focus is to provide context to\n * users on where their focus will be restored upon navigating back to a\n * previously focused tree.\n *\n * Note that if the tree's current focused node (passive or active) is needed,\n * FocusableTreeTraverser.findFocusedNode can be used.\n *\n * Note that if specific nodes are needed to be retrieved for this tree, either\n * use lookUpFocusableNode or FocusableTreeTraverser.findFocusableNodeFor.\n */\nexport interface IFocusableTree {\n  /**\n   * Returns the top-level focusable node of the tree.\n   *\n   * It's expected that the returned node will be focused in cases where\n   * FocusManager wants to focus a tree in a situation where it does not\n   * currently have a focused node.\n   */\n  getRootFocusableNode(): IFocusableNode;\n\n  /**\n   * Returns the IFocusableNode of this tree that should receive active focus\n   * when the tree itself has focus returned to it.\n   *\n   * There are some very important notes to consider about a tree's focus\n   * lifecycle when implementing a version of this method that doesn't return\n   * null:\n   * 1. A null previousNode does not guarantee first-time focus state as nodes\n   *    can be deleted.\n   * 2. This method is only used when the tree itself is focused, either through\n   *    tab navigation or via FocusManager.focusTree(). In many cases, the\n   *    previously focused node will be directly focused instead which will\n   *    bypass this method.\n   * 3. The default behavior (i.e. returning null here) involves either\n   *    restoring the previous node (previousNode) or focusing the tree's root.\n   * 4. The provided node may sometimes no longer be valid, such as in the case\n   *    an attempt is made to focus a node that has been recently removed from\n   *    its parent tree. Implementations can check for the validity of the node\n   *    in order to specialize the node to which focus should fall back.\n   *\n   * This method is largely intended to provide tree implementations with the\n   * means of specifying a better default node than their root.\n   *\n   * @param previousNode The node that previously held passive focus for this\n   *     tree, or null if the tree hasn't yet been focused.\n   * @returns The IFocusableNode that should now receive focus, or null if\n   *     default behavior should be used, instead.\n   */\n  getRestoredFocusableNode(\n    previousNode: IFocusableNode | null,\n  ): IFocusableNode | null;\n\n  /**\n   * Returns all directly nested trees under this tree.\n   *\n   * Note that the returned list of trees doesn't need to be stable, however all\n   * returned trees *do* need to be registered with FocusManager. Additionally,\n   * this must return actual nested trees as omitting a nested tree will affect\n   * how focus changes map to a specific node and its tree, potentially leading\n   * to user confusion.\n   */\n  getNestedTrees(): Array<IFocusableTree>;\n\n  /**\n   * Returns the IFocusableNode corresponding to the specified element ID, or\n   * null if there's no exact node within this tree with that ID or if the ID\n   * corresponds to the root of the tree.\n   *\n   * This will never match against nested trees.\n   *\n   * @param id The ID of the node's focusable HTMLElement or SVGElement.\n   */\n  lookUpFocusableNode(id: string): IFocusableNode | null;\n\n  /**\n   * Called when a node of this tree has received active focus.\n   *\n   * Note that a null previousTree does not necessarily indicate that this is\n   * the first time Blockly is receiving focus. In fact, few assumptions can be\n   * made about previous focus state as a previous null tree simply indicates\n   * that Blockly did not hold active focus prior to this tree becoming focused\n   * (which can happen due to focus exiting the Blockly injection div, or for\n   * other cases like ephemeral focus).\n   *\n   * See IFocusableNode.onNodeFocus() as implementations have the same\n   * restrictions as with that method.\n   *\n   * @param node The node receiving active focus.\n   * @param previousTree The previous tree that held active focus, or null if\n   *     none.\n   */\n  onTreeFocus(node: IFocusableNode, previousTree: IFocusableTree | null): void;\n\n  /**\n   * Called when the previously actively focused node of this tree is now\n   * passively focused and there is no other active node of this tree taking its\n   * place.\n   *\n   * This has the same implementation restrictions and considerations as\n   * onTreeFocus().\n   *\n   * @param nextTree The next tree receiving active focus, or null if none (such\n   *     as in the case that Blockly is entirely losing DOM focus).\n   */\n  onTreeBlur(nextTree: IFocusableTree | null): void;\n}\n\n/**\n * Determines whether the provided object fulfills the contract of\n * IFocusableTree.\n *\n * @param obj The object to test.\n * @returns Whether the provided object can be used as an IFocusableTree.\n */\nexport function isFocusableTree(obj: any): obj is IFocusableTree {\n  return (\n    obj &&\n    typeof obj.getRootFocusableNode === 'function' &&\n    typeof obj.getRestoredFocusableNode === 'function' &&\n    typeof obj.getNestedTrees === 'function' &&\n    typeof obj.lookUpFocusableNode === 'function' &&\n    typeof obj.onTreeFocus === 'function' &&\n    typeof obj.onTreeBlur === 'function'\n  );\n}\n",null,"/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport * as dom from './utils/dom.js';\nimport {FocusableTreeTraverser} from './utils/focusable_tree_traverser.js';\n\n/**\n * Type declaration for returning focus to FocusManager upon completing an\n * ephemeral UI flow (such as a dialog).\n *\n * See FocusManager.takeEphemeralFocus for more details.\n */\nexport type ReturnEphemeralFocus = () => void;\n\n/**\n * Represents an IFocusableTree that has been registered for focus management in\n * FocusManager.\n */\nclass TreeRegistration {\n  /**\n   * Constructs a new TreeRegistration.\n   *\n   * @param tree The tree being registered.\n   * @param rootShouldBeAutoTabbable Whether the tree should have automatic\n   *     top-level tab management.\n   */\n  constructor(\n    readonly tree: IFocusableTree,\n    readonly rootShouldBeAutoTabbable: boolean,\n  ) {}\n}\n\n/**\n * A per-page singleton that manages Blockly focus across one or more\n * IFocusableTrees, and bidirectionally synchronizes this focus with the DOM.\n *\n * Callers that wish to explicitly change input focus for select Blockly\n * components on the page should use the focus functions in this manager.\n *\n * The manager is responsible for handling focus events from the DOM (which may\n * may arise from users clicking on page elements) and ensuring that\n * corresponding IFocusableNodes are clearly marked as actively/passively\n * highlighted in the same way that this would be represented with calls to\n * focusNode().\n */\nexport class FocusManager {\n  /**\n   * The CSS class assigned to IFocusableNode elements that presently have\n   * active DOM and Blockly focus.\n   *\n   * This should never be used directly. Instead, rely on FocusManager to ensure\n   * nodes have active focus (either automatically through DOM focus or manually\n   * through the various focus* methods provided by this class).\n   *\n   * It's recommended to not query using this class name, either. Instead, use\n   * FocusableTreeTraverser or IFocusableTree's methods to find a specific node.\n   */\n  static readonly ACTIVE_FOCUS_NODE_CSS_CLASS_NAME = 'blocklyActiveFocus';\n\n  /**\n   * The CSS class assigned to IFocusableNode elements that presently have\n   * passive focus (that is, they were the most recent node in their relative\n   * tree to have active focus--see ACTIVE_FOCUS_NODE_CSS_CLASS_NAME--and will\n   * receive active focus again if their surrounding tree is requested to become\n   * focused, i.e. using focusTree below).\n   *\n   * See ACTIVE_FOCUS_NODE_CSS_CLASS_NAME for caveats and limitations around\n   * using this constant directly (generally it never should need to be used).\n   */\n  static readonly PASSIVE_FOCUS_NODE_CSS_CLASS_NAME = 'blocklyPassiveFocus';\n\n  private focusedNode: IFocusableNode | null = null;\n  private previouslyFocusedNode: IFocusableNode | null = null;\n  private registeredTrees: Array<TreeRegistration> = [];\n\n  private currentlyHoldsEphemeralFocus: boolean = false;\n  private lockFocusStateChanges: boolean = false;\n  private recentlyLostAllFocus: boolean = false;\n  private isUpdatingFocusedNode: boolean = false;\n\n  constructor(\n    addGlobalEventListener: (type: string, listener: EventListener) => void,\n  ) {\n    // Note that 'element' here is the element *gaining* focus.\n    const maybeFocus = (element: Element | EventTarget | null) => {\n      // Skip processing the event if the focused node is currently updating.\n      if (this.isUpdatingFocusedNode) return;\n\n      this.recentlyLostAllFocus = !element;\n      let newNode: IFocusableNode | null | undefined = null;\n      if (element instanceof HTMLElement || element instanceof SVGElement) {\n        // If the target losing or gaining focus maps to any tree, then it\n        // should be updated. Per the contract of findFocusableNodeFor only one\n        // tree should claim the element, so the search can be exited early.\n        for (const reg of this.registeredTrees) {\n          const tree = reg.tree;\n          newNode = FocusableTreeTraverser.findFocusableNodeFor(element, tree);\n          if (newNode) break;\n        }\n      }\n\n      if (newNode && newNode.canBeFocused()) {\n        const newTree = newNode.getFocusableTree();\n        const oldTree = this.focusedNode?.getFocusableTree();\n        if (newNode === newTree.getRootFocusableNode() && newTree !== oldTree) {\n          // If the root of the tree is the one taking focus (such as due to\n          // being tabbed), try to focus the whole tree explicitly to ensure the\n          // correct node re-receives focus.\n          this.focusTree(newTree);\n        } else {\n          this.focusNode(newNode);\n        }\n      } else {\n        this.defocusCurrentFocusedNode();\n      }\n    };\n\n    // Register root document focus listeners for tracking when focus leaves all\n    // tracked focusable trees. Note that focusin and focusout can be somewhat\n    // overlapping in the information that they provide. This is fine because\n    // they both aim to check for focus changes on the element gaining or having\n    // received focus, and maybeFocus should behave relatively deterministic.\n    addGlobalEventListener('focusin', (event) => {\n      if (!(event instanceof FocusEvent)) return;\n\n      // When something receives focus, always use the current active element as\n      // the source of truth.\n      maybeFocus(document.activeElement);\n    });\n    addGlobalEventListener('focusout', (event) => {\n      if (!(event instanceof FocusEvent)) return;\n\n      // When something loses focus, it seems that document.activeElement may\n      // not necessarily be correct. Instead, use relatedTarget.\n      maybeFocus(event.relatedTarget);\n    });\n  }\n\n  /**\n   * Registers a new IFocusableTree for automatic focus management.\n   *\n   * If the tree currently has an element with DOM focus, it will not affect the\n   * internal state in this manager until the focus changes to a new,\n   * now-monitored element/node.\n   *\n   * This function throws if the provided tree is already currently registered\n   * in this manager. Use isRegistered to check in cases when it can't be\n   * certain whether the tree has been registered.\n   *\n   * The tree's registration can be customized to configure automatic tab stops.\n   * This specifically provides capability for the user to be able to tab\n   * navigate to the root of the tree but only when the tree doesn't hold active\n   * focus. If this functionality is disabled then the tree's root will\n   * automatically be made focusable (but not tabbable) when it is first focused\n   * in the same way as any other focusable node.\n   *\n   * @param tree The IFocusableTree to register.\n   * @param rootShouldBeAutoTabbable Whether the root of this tree should be\n   *     added as a top-level page tab stop when it doesn't hold active focus.\n   */\n  registerTree(\n    tree: IFocusableTree,\n    rootShouldBeAutoTabbable: boolean = false,\n  ): void {\n    this.ensureManagerIsUnlocked();\n    if (this.isRegistered(tree)) {\n      throw Error(`Attempted to re-register already registered tree: ${tree}.`);\n    }\n    this.registeredTrees.push(\n      new TreeRegistration(tree, rootShouldBeAutoTabbable),\n    );\n    const rootElement = tree.getRootFocusableNode().getFocusableElement();\n    if (!rootElement.id || rootElement.id === 'null') {\n      throw Error(\n        `Attempting to register a tree with a root element that has an ` +\n          `invalid ID: ${tree}.`,\n      );\n    }\n    if (rootShouldBeAutoTabbable) {\n      rootElement.tabIndex = 0;\n    }\n  }\n\n  /**\n   * Returns whether the specified tree has already been registered in this\n   * manager using registerTree and hasn't yet been unregistered using\n   * unregisterTree.\n   */\n  isRegistered(tree: IFocusableTree): boolean {\n    return !!this.lookUpRegistration(tree);\n  }\n\n  /**\n   * Returns the TreeRegistration for the specified tree, or null if the tree is\n   * not currently registered.\n   */\n  private lookUpRegistration(tree: IFocusableTree): TreeRegistration | null {\n    return this.registeredTrees.find((reg) => reg.tree === tree) ?? null;\n  }\n\n  /**\n   * Unregisters a IFocusableTree from automatic focus management.\n   *\n   * If the tree had a previous focused node, it will have its highlight\n   * removed. This function does NOT change DOM focus.\n   *\n   * This function throws if the provided tree is not currently registered in\n   * this manager.\n   *\n   * This function will reset the tree's root element tabindex if the tree was\n   * registered with automatic tab management.\n   */\n  unregisterTree(tree: IFocusableTree): void {\n    this.ensureManagerIsUnlocked();\n    if (!this.isRegistered(tree)) {\n      throw Error(`Attempted to unregister not registered tree: ${tree}.`);\n    }\n    const treeIndex = this.registeredTrees.findIndex(\n      (reg) => reg.tree === tree,\n    );\n    const registration = this.registeredTrees[treeIndex];\n    this.registeredTrees.splice(treeIndex, 1);\n\n    const focusedNode = FocusableTreeTraverser.findFocusedNode(tree);\n    const root = tree.getRootFocusableNode();\n    if (focusedNode) this.removeHighlight(focusedNode);\n    if (this.focusedNode === focusedNode || this.focusedNode === root) {\n      this.updateFocusedNode(null);\n    }\n    this.removeHighlight(root);\n\n    if (registration.rootShouldBeAutoTabbable) {\n      tree\n        .getRootFocusableNode()\n        .getFocusableElement()\n        .removeAttribute('tabindex');\n    }\n  }\n\n  /**\n   * Returns the current IFocusableTree that has focus, or null if none\n   * currently do.\n   *\n   * Note also that if ephemeral focus is currently captured (e.g. using\n   * takeEphemeralFocus) then the returned tree here may not currently have DOM\n   * focus.\n   */\n  getFocusedTree(): IFocusableTree | null {\n    return this.focusedNode?.getFocusableTree() ?? null;\n  }\n\n  /**\n   * Returns the current IFocusableNode with focus (which is always tied to a\n   * focused IFocusableTree), or null if there isn't one.\n   *\n   * Note that this function will maintain parity with\n   * IFocusableTree.getFocusedNode(). That is, if a tree itself has focus but\n   * none of its non-root children do, this will return null but\n   * getFocusedTree() will not.\n   *\n   * Note also that if ephemeral focus is currently captured (e.g. using\n   * takeEphemeralFocus) then the returned node here may not currently have DOM\n   * focus.\n   */\n  getFocusedNode(): IFocusableNode | null {\n    return this.focusedNode;\n  }\n\n  /**\n   * Focuses the specific IFocusableTree. This either means restoring active\n   * focus to the tree's passively focused node, or focusing the tree's root\n   * node.\n   *\n   * Note that if the specified tree already has a focused node then this will\n   * not change any existing focus (unless that node has passive focus, then it\n   * will be restored to active focus).\n   *\n   * See getFocusedNode for details on how other nodes are affected.\n   *\n   * @param focusableTree The tree that should receive active\n   *     focus.\n   */\n  focusTree(focusableTree: IFocusableTree): void {\n    this.ensureManagerIsUnlocked();\n    if (!this.isRegistered(focusableTree)) {\n      throw Error(`Attempted to focus unregistered tree: ${focusableTree}.`);\n    }\n    const currNode = FocusableTreeTraverser.findFocusedNode(focusableTree);\n    const nodeToRestore = focusableTree.getRestoredFocusableNode(currNode);\n    const rootFallback = focusableTree.getRootFocusableNode();\n    this.focusNode(nodeToRestore ?? currNode ?? rootFallback);\n  }\n\n  /**\n   * Focuses DOM input on the specified node, and marks it as actively focused.\n   *\n   * Any previously focused node will be updated to be passively highlighted (if\n   * it's in a different focusable tree) or blurred (if it's in the same one).\n   *\n   * **Important**: If the provided node is not able to be focused (e.g. its\n   * canBeFocused() method returns false), it will be ignored and any existing\n   * focus state will remain unchanged.\n   *\n   * Note that this may update the specified node's element's tabindex to ensure\n   * that it can be properly read out by screenreaders while focused.\n   *\n   * The focused node will not be automatically scrolled into view.\n   *\n   * @param focusableNode The node that should receive active focus.\n   */\n  focusNode(focusableNode: IFocusableNode): void {\n    this.ensureManagerIsUnlocked();\n    const mustRestoreUpdatingNode = !this.currentlyHoldsEphemeralFocus;\n    if (mustRestoreUpdatingNode) {\n      // Disable state syncing from DOM events since possible calls to focus()\n      // below will loop a call back to focusNode().\n      this.isUpdatingFocusedNode = true;\n    }\n\n    // Double check that state wasn't desynchronized in the background. See:\n    // https://github.com/google/blockly-keyboard-experimentation/issues/87.\n    // This is only done for the case where the same node is being focused twice\n    // since other cases should automatically correct (due to the rest of the\n    // routine running as normal).\n    const prevFocusedElement = this.focusedNode?.getFocusableElement();\n    const hasDesyncedState = prevFocusedElement !== document.activeElement;\n    if (this.focusedNode === focusableNode && !hasDesyncedState) {\n      if (mustRestoreUpdatingNode) {\n        // Reenable state syncing from DOM events.\n        this.isUpdatingFocusedNode = false;\n      }\n      return; // State is unchanged.\n    }\n\n    if (!focusableNode.canBeFocused()) {\n      // This node can't be focused.\n      console.warn(\"Trying to focus a node that can't be focused.\");\n\n      if (mustRestoreUpdatingNode) {\n        // Reenable state syncing from DOM events.\n        this.isUpdatingFocusedNode = false;\n      }\n      return;\n    }\n\n    const nextTree = focusableNode.getFocusableTree();\n    if (!this.isRegistered(nextTree)) {\n      throw Error(`Attempted to focus unregistered node: ${focusableNode}.`);\n    }\n\n    const focusableNodeElement = focusableNode.getFocusableElement();\n    if (!focusableNodeElement.id || focusableNodeElement.id === 'null') {\n      // Warn that the ID is invalid, but continue execution since an invalid ID\n      // will result in an unmatched (null) node. Since a request to focus\n      // something was initiated, the code below will attempt to find the next\n      // best thing to focus, instead.\n      console.warn('Trying to focus a node that has an invalid ID.');\n    }\n\n    // Safety check for ensuring focusNode() doesn't get called for a node that\n    // isn't actually hooked up to its parent tree correctly. This usually\n    // happens when calls to focusNode() interleave with asynchronous clean-up\n    // operations (which can happen due to ephemeral focus and in other cases).\n    // Fall back to a reasonable default since there's no valid node to focus.\n    const matchedNode = FocusableTreeTraverser.findFocusableNodeFor(\n      focusableNodeElement,\n      nextTree,\n    );\n    const prevNodeNextTree = FocusableTreeTraverser.findFocusedNode(nextTree);\n    let nodeToFocus = focusableNode;\n    if (matchedNode !== focusableNode) {\n      const nodeToRestore = nextTree.getRestoredFocusableNode(prevNodeNextTree);\n      const rootFallback = nextTree.getRootFocusableNode();\n      nodeToFocus = nodeToRestore ?? prevNodeNextTree ?? rootFallback;\n    }\n\n    const prevNode = this.focusedNode;\n    const prevTree = prevNode?.getFocusableTree();\n    if (prevNode) {\n      this.passivelyFocusNode(prevNode, nextTree);\n    }\n\n    // If there's a focused node in the new node's tree, ensure it's reset.\n    const nextTreeRoot = nextTree.getRootFocusableNode();\n    if (prevNodeNextTree) {\n      this.removeHighlight(prevNodeNextTree);\n    }\n    // For caution, ensure that the root is always reset since getFocusedNode()\n    // is expected to return null if the root was highlighted, if the root is\n    // not the node now being set to active.\n    if (nextTreeRoot !== nodeToFocus) {\n      this.removeHighlight(nextTreeRoot);\n    }\n\n    if (!this.currentlyHoldsEphemeralFocus) {\n      // Only change the actively focused node if ephemeral state isn't held.\n      this.activelyFocusNode(nodeToFocus, prevTree ?? null);\n    }\n    this.updateFocusedNode(nodeToFocus);\n    if (mustRestoreUpdatingNode) {\n      // Reenable state syncing from DOM events.\n      this.isUpdatingFocusedNode = false;\n    }\n  }\n\n  /**\n   * Ephemerally captures focus for a specific element until the returned lambda\n   * is called. This is expected to be especially useful for ephemeral UI flows\n   * like dialogs.\n   *\n   * IMPORTANT: the returned lambda *must* be called, otherwise automatic focus\n   * will no longer work anywhere on the page. It is highly recommended to tie\n   * the lambda call to the closure of the corresponding UI so that if input is\n   * manually changed to an element outside of the ephemeral UI, the UI should\n   * close and automatic input restored. Note that this lambda must be called\n   * exactly once and that subsequent calls will throw an error.\n   *\n   * Note that the manager will continue to track DOM input signals even when\n   * ephemeral focus is active, but it won't actually change node state until\n   * the returned lambda is called. Additionally, only 1 ephemeral focus context\n   * can be active at any given time (attempting to activate more than one\n   * simultaneously will result in an error being thrown).\n   *\n   * This method does not scroll the ephemerally focused element into view.\n   */\n  takeEphemeralFocus(\n    focusableElement: HTMLElement | SVGElement,\n  ): ReturnEphemeralFocus {\n    this.ensureManagerIsUnlocked();\n    if (this.currentlyHoldsEphemeralFocus) {\n      throw Error(\n        `Attempted to take ephemeral focus when it's already held, ` +\n          `with new element: ${focusableElement}.`,\n      );\n    }\n    this.currentlyHoldsEphemeralFocus = true;\n\n    if (this.focusedNode) {\n      this.passivelyFocusNode(this.focusedNode, null);\n    }\n    focusableElement.focus({preventScroll: true});\n\n    let hasFinishedEphemeralFocus = false;\n    return () => {\n      if (hasFinishedEphemeralFocus) {\n        throw Error(\n          `Attempted to finish ephemeral focus twice for element: ` +\n            `${focusableElement}.`,\n        );\n      }\n      hasFinishedEphemeralFocus = true;\n      this.currentlyHoldsEphemeralFocus = false;\n\n      if (this.focusedNode) {\n        this.activelyFocusNode(this.focusedNode, null);\n\n        // Even though focus was restored, check if it's lost again. It's\n        // possible for the browser to force focus away from all elements once\n        // the ephemeral element disappears. This ensures focus is restored.\n        const capturedNode = this.focusedNode;\n        setTimeout(() => {\n          // These checks are set up to minimize the risk that a legitimate\n          // focus change occurred within the delay that this would override.\n          if (\n            !this.focusedNode &&\n            this.previouslyFocusedNode === capturedNode &&\n            this.recentlyLostAllFocus\n          ) {\n            this.focusNode(capturedNode);\n          }\n        }, 0);\n      }\n    };\n  }\n\n  /**\n   * @returns whether something is currently holding ephemeral focus\n   */\n  ephemeralFocusTaken(): boolean {\n    return this.currentlyHoldsEphemeralFocus;\n  }\n\n  /**\n   * Ensures that the manager is currently allowing operations that change its\n   * internal focus state (such as via focusNode()).\n   *\n   * If the manager is currently not allowing state changes, an exception is\n   * thrown.\n   */\n  private ensureManagerIsUnlocked(): void {\n    if (this.lockFocusStateChanges) {\n      throw Error(\n        'FocusManager state changes cannot happen in a tree/node focus/blur ' +\n          'callback.',\n      );\n    }\n  }\n\n  /**\n   * Updates the internally tracked focused node to the specified node, or null\n   * if focus is being lost. This also updates previous focus tracking.\n   *\n   * @param newFocusedNode The new node to set as focused.\n   */\n  private updateFocusedNode(newFocusedNode: IFocusableNode | null) {\n    this.previouslyFocusedNode = this.focusedNode;\n    this.focusedNode = newFocusedNode;\n  }\n\n  /**\n   * Defocuses the current actively focused node tracked by the manager, iff\n   * there's a node being tracked and the manager doesn't have ephemeral focus.\n   */\n  private defocusCurrentFocusedNode(): void {\n    // The current node will likely be defocused while ephemeral focus is held,\n    // but internal manager state shouldn't change since the node should be\n    // restored upon exiting ephemeral focus mode.\n    if (this.focusedNode && !this.currentlyHoldsEphemeralFocus) {\n      this.passivelyFocusNode(this.focusedNode, null);\n      this.updateFocusedNode(null);\n    }\n  }\n\n  /**\n   * Marks the specified node as actively focused, also calling related\n   * lifecycle callback methods for both the node and its parent tree. This\n   * ensures that the node is properly styled to indicate its active focus.\n   *\n   * This does not change the manager's currently tracked node, nor does it\n   * change any other nodes.\n   *\n   * @param node The node to be actively focused.\n   * @param prevTree The tree of the previously actively focused node, or null\n   *     if there wasn't a previously actively focused node.\n   */\n  private activelyFocusNode(\n    node: IFocusableNode,\n    prevTree: IFocusableTree | null,\n  ): void {\n    // Note that order matters here. Focus callbacks are allowed to change\n    // element visibility which can influence focusability, including for a\n    // node's focusable element (which *is* allowed to be invisible until the\n    // node needs to be focused).\n    this.lockFocusStateChanges = true;\n    const tree = node.getFocusableTree();\n    const elem = node.getFocusableElement();\n    const nextTreeReg = this.lookUpRegistration(tree);\n    const treeIsTabManaged = nextTreeReg?.rootShouldBeAutoTabbable;\n    if (tree !== prevTree) {\n      tree.onTreeFocus(node, prevTree);\n\n      if (treeIsTabManaged) {\n        // If this node's tree has its tab auto-managed, ensure that it's no\n        // longer tabbable now that it holds active focus.\n        tree.getRootFocusableNode().getFocusableElement().tabIndex = -1;\n      }\n    }\n    node.onNodeFocus();\n    this.lockFocusStateChanges = false;\n\n    // The tab index should be set in all cases where:\n    // - It doesn't overwrite an pre-set tab index for the node.\n    // - The node is part of a tree whose tab index is unmanaged.\n    // OR\n    // - The node is part of a managed tree but this isn't the root. Managed\n    //   roots are ignored since they are always overwritten to have a tab index\n    //   of -1 with active focus so that they cannot be tab navigated.\n    //\n    // Setting the tab index ensures that the node's focusable element can\n    // actually receive DOM focus.\n    if (!treeIsTabManaged || node !== tree.getRootFocusableNode()) {\n      if (!elem.hasAttribute('tabindex')) elem.tabIndex = -1;\n    }\n\n    this.setNodeToVisualActiveFocus(node);\n    elem.focus({preventScroll: true});\n  }\n\n  /**\n   * Marks the specified node as passively focused, also calling related\n   * lifecycle callback methods for both the node and its parent tree. This\n   * ensures that the node is properly styled to indicate its passive focus.\n   *\n   * This does not change the manager's currently tracked node, nor does it\n   * change any other nodes.\n   *\n   * @param node The node to be passively focused.\n   * @param nextTree The tree of the node receiving active focus, or null if no\n   *     node will be actively focused.\n   */\n  private passivelyFocusNode(\n    node: IFocusableNode,\n    nextTree: IFocusableTree | null,\n  ): void {\n    this.lockFocusStateChanges = true;\n    const tree = node.getFocusableTree();\n    if (tree !== nextTree) {\n      tree.onTreeBlur(nextTree);\n\n      const reg = this.lookUpRegistration(tree);\n      if (reg?.rootShouldBeAutoTabbable) {\n        // If this node's tree has its tab auto-managed, ensure that it's now\n        // tabbable since it no longer holds active focus.\n        tree.getRootFocusableNode().getFocusableElement().tabIndex = 0;\n      }\n    }\n    node.onNodeBlur();\n    this.lockFocusStateChanges = false;\n\n    if (tree !== nextTree) {\n      this.setNodeToVisualPassiveFocus(node);\n    }\n  }\n\n  /**\n   * Updates the node's styling to indicate that it should have an active focus\n   * indicator.\n   *\n   * @param node The node to be styled for active focus.\n   */\n  private setNodeToVisualActiveFocus(node: IFocusableNode): void {\n    const element = node.getFocusableElement();\n    dom.addClass(element, FocusManager.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME);\n    dom.removeClass(element, FocusManager.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME);\n  }\n\n  /**\n   * Updates the node's styling to indicate that it should have a passive focus\n   * indicator.\n   *\n   * @param node The node to be styled for passive focus.\n   */\n  private setNodeToVisualPassiveFocus(node: IFocusableNode): void {\n    const element = node.getFocusableElement();\n    dom.removeClass(element, FocusManager.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME);\n    dom.addClass(element, FocusManager.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME);\n  }\n\n  /**\n   * Removes any active/passive indicators for the specified node.\n   *\n   * @param node The node which should have neither passive nor active focus\n   *     indication.\n   */\n  private removeHighlight(node: IFocusableNode): void {\n    const element = node.getFocusableElement();\n    dom.removeClass(element, FocusManager.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME);\n    dom.removeClass(element, FocusManager.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME);\n  }\n\n  private static focusManager: FocusManager | null = null;\n\n  /**\n   * Returns the page-global FocusManager.\n   *\n   * The returned instance is guaranteed to not change across function calls,\n   * but may change across page loads.\n   */\n  static getFocusManager(): FocusManager {\n    if (!FocusManager.focusManager) {\n      FocusManager.focusManager = new FocusManager(document.addEventListener);\n    }\n    return FocusManager.focusManager;\n  }\n}\n\n/** Convenience function for FocusManager.getFocusManager. */\nexport function getFocusManager(): FocusManager {\n  return FocusManager.getFocusManager();\n}\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.blocks\n\n/**\n * A block definition.  For now this very loose, 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 */\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// Former goog.module ID: Blockly.utils.userAgent\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) {\n  rawUserAgent = raw;\n  const 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   */\n  function has(name: string): boolean {\n    return rawUpper.includes(name.toUpperCase());\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\n  isJavaFx = has('JavaFX');\n\n  // Engines.  Logic from:\n  // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/engine.js\n  isWebKit = has('WebKit');\n  isGecko = 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\n  isAndroid = has('Android');\n  const maxTouchPoints =\n    globalThis['navigator'] && globalThis['navigator']['maxTouchPoints'];\n  isIPad = has('iPad') || (has('Macintosh') && maxTouchPoints > 0);\n  isIPhone = has('iPhone') && !isIPad;\n  isMac = has('Macintosh');\n\n  // Devices.  Logic from:\n  // https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/device.js\n  isTablet = isIPad || (isAndroid && !has('Mobile')) || has('Silk');\n  isMobile = !isTablet && (isIPhone || isAndroid);\n})((globalThis['navigator'] && globalThis['navigator']['userAgent']) || '');\n\nexport const raw: string = rawUserAgent;\n\nexport const JavaFx: boolean = isJavaFx;\n\nexport const GECKO: boolean = isGecko;\n\nexport const ANDROID: boolean = isAndroid;\n\nexport const IPAD: boolean = isIPad;\n\nexport const IPHONE: boolean = isIPhone;\n\nexport const MAC: boolean = isMac;\n\nexport const MOBILE: boolean = isMobile;\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Enum of values for the .type property for event classes (concrete subclasses\n * of Abstract).\n */\nexport enum EventType {\n  /** Type of event that creates a block. */\n  BLOCK_CREATE = 'create',\n  /** Type of event that deletes a block. */\n  BLOCK_DELETE = 'delete',\n  /** Type of event that changes a block. */\n  BLOCK_CHANGE = 'change',\n  /**\n   * Type of event representing an in-progress change to a field of a\n   * block, which is expected to be followed by a block change event.\n   */\n  BLOCK_FIELD_INTERMEDIATE_CHANGE = 'block_field_intermediate_change',\n  /** Type of event that moves a block. */\n  BLOCK_MOVE = 'move',\n  /** Type of event that creates a variable. */\n  VAR_CREATE = 'var_create',\n  /** Type of event that deletes a variable. */\n  VAR_DELETE = 'var_delete',\n  /** Type of event that renames a variable. */\n  VAR_RENAME = 'var_rename',\n  /** Type of event that changes the type of a variable. */\n  VAR_TYPE_CHANGE = 'var_type_change',\n  /**\n   * Type of generic event that records a UI change.\n   *\n   * @deprecated Was only ever intended for internal use.\n   */\n  UI = 'ui',\n  /** Type of event that drags a block. */\n  BLOCK_DRAG = 'drag',\n  /** Type of event that records a change in selected element. */\n  SELECTED = 'selected',\n  /** Type of event that records a click. */\n  CLICK = 'click',\n  /** Type of event that records a marker move. */\n  MARKER_MOVE = 'marker_move',\n  /** Type of event that records a bubble open. */\n  BUBBLE_OPEN = 'bubble_open',\n  /** Type of event that records a trashcan open. */\n  TRASHCAN_OPEN = 'trashcan_open',\n  /** Type of event that records a toolbox item select. */\n  TOOLBOX_ITEM_SELECT = 'toolbox_item_select',\n  /** Type of event that records a theme change. */\n  THEME_CHANGE = 'theme_change',\n  /** Type of event that records a viewport change. */\n  VIEWPORT_CHANGE = 'viewport_change',\n  /** Type of event that creates a comment. */\n  COMMENT_CREATE = 'comment_create',\n  /** Type of event that deletes a comment. */\n  COMMENT_DELETE = 'comment_delete',\n  /** Type of event that changes a comment. */\n  COMMENT_CHANGE = 'comment_change',\n  /** Type of event that moves a comment. */\n  COMMENT_MOVE = 'comment_move',\n  /** Type of event that resizes a comment. */\n  COMMENT_RESIZE = 'comment_resize',\n  /**  Type of event that drags a comment. */\n  COMMENT_DRAG = 'comment_drag',\n  /** Type of event that collapses a comment. */\n  COMMENT_COLLAPSE = 'comment_collapse',\n  /** Type of event that records a workspace load. */\n  FINISHED_LOADING = 'finished_loading',\n}\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 */\nexport const BUMP_EVENTS: string[] = [\n  EventType.BLOCK_CREATE,\n  EventType.BLOCK_MOVE,\n  EventType.COMMENT_CREATE,\n  EventType.COMMENT_MOVE,\n];\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from '../interfaces/i_focusable_tree.js';\nimport * as dom from '../utils/dom.js';\n\n/**\n * A helper utility for IFocusableTree implementations to aid with common\n * tree traversals.\n */\nexport class FocusableTreeTraverser {\n  private static readonly ACTIVE_CLASS_NAME = 'blocklyActiveFocus';\n  private static readonly PASSIVE_CSS_CLASS_NAME = 'blocklyPassiveFocus';\n  private static readonly ACTIVE_FOCUS_NODE_CSS_SELECTOR = `.${FocusableTreeTraverser.ACTIVE_CLASS_NAME}`;\n  private static readonly PASSIVE_FOCUS_NODE_CSS_SELECTOR = `.${FocusableTreeTraverser.PASSIVE_CSS_CLASS_NAME}`;\n\n  /**\n   * Returns the current IFocusableNode that is styled (and thus represented) as\n   * having either passive or active focus, only considering HTML and SVG\n   * elements.\n   *\n   * This can match against the tree's root.\n   *\n   * Note that this will never return a node from a nested sub-tree as that tree\n   * should specifically be used to retrieve its focused node.\n   *\n   * @param tree The IFocusableTree in which to search for a focused node.\n   * @returns The IFocusableNode currently with focus, or null if none.\n   */\n  static findFocusedNode(tree: IFocusableTree): IFocusableNode | null {\n    const rootNode = tree.getRootFocusableNode();\n    if (!rootNode.canBeFocused()) return null;\n    const root = rootNode.getFocusableElement();\n    if (\n      dom.hasClass(root, FocusableTreeTraverser.ACTIVE_CLASS_NAME) ||\n      dom.hasClass(root, FocusableTreeTraverser.PASSIVE_CSS_CLASS_NAME)\n    ) {\n      // The root has focus.\n      return rootNode;\n    }\n\n    const activeEl = root.querySelector(this.ACTIVE_FOCUS_NODE_CSS_SELECTOR);\n    if (activeEl instanceof HTMLElement || activeEl instanceof SVGElement) {\n      const active = FocusableTreeTraverser.findFocusableNodeFor(\n        activeEl,\n        tree,\n      );\n      if (active) return active;\n    }\n\n    // At most there should be one passive indicator per tree (not considering\n    // subtrees).\n    const passiveEl = root.querySelector(this.PASSIVE_FOCUS_NODE_CSS_SELECTOR);\n    if (passiveEl instanceof HTMLElement || passiveEl instanceof SVGElement) {\n      const passive = FocusableTreeTraverser.findFocusableNodeFor(\n        passiveEl,\n        tree,\n      );\n      if (passive) return passive;\n    }\n\n    return null;\n  }\n\n  /**\n   * Returns the IFocusableNode corresponding to the specified HTML or SVG\n   * element iff it's the root element or a descendent of the root element of\n   * the specified IFocusableTree.\n   *\n   * If the element exists within the specified tree's DOM structure but does\n   * not directly correspond to a node, the nearest parent node (or the tree's\n   * root) will be returned to represent the provided element.\n   *\n   * If the tree contains another nested IFocusableTree, the nested tree may be\n   * traversed but its nodes will never be returned here per the contract of\n   * IFocusableTree.lookUpFocusableNode.\n   *\n   * The provided element must have a non-null, non-empty ID that conforms to\n   * the contract mentioned in IFocusableNode.\n   *\n   * @param element The HTML or SVG element being sought.\n   * @param tree The tree under which the provided element may be a descendant.\n   * @returns The matching IFocusableNode, or null if there is no match.\n   */\n  static findFocusableNodeFor(\n    element: HTMLElement | SVGElement,\n    tree: IFocusableTree,\n  ): IFocusableNode | null {\n    // Note that the null check is due to Element.setAttribute() converting null\n    // to a string.\n    if (!element.id || element.id === 'null') return null;\n\n    // First, match against subtrees.\n    const subTreeMatches = tree.getNestedTrees().map((tree) => {\n      return FocusableTreeTraverser.findFocusableNodeFor(element, tree);\n    });\n    if (subTreeMatches.findIndex((match) => !!match) !== -1) {\n      // At least one subtree has a match for the element so it cannot be part\n      // of the outer tree.\n      return null;\n    }\n\n    // Second, check against the tree's root.\n    const rootNode = tree.getRootFocusableNode();\n    if (rootNode.canBeFocused() && element === rootNode.getFocusableElement()) {\n      return rootNode;\n    }\n\n    // Third, check if the element has a node.\n    const matchedChildNode = tree.lookUpFocusableNode(element.id) ?? null;\n    if (matchedChildNode) return matchedChildNode;\n\n    // Fourth, recurse up to find the nearest tree/node if it's possible.\n    const elementParent = element.parentElement;\n    if (!matchedChildNode && elementParent) {\n      return FocusableTreeTraverser.findFocusableNodeFor(elementParent, tree);\n    }\n\n    // Otherwise, there's no matching node.\n    return null;\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 */\n// Former goog.module ID: Blockly.ShortcutRegistry\n\nimport {Scope} from './contextmenu_registry.js';\nimport {getFocusManager} from './focus_manager.js';\nimport {KeyCodes} from './utils/keycodes.js';\nimport * as object from './utils/object.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\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 */\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 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, allowOverrides?: boolean) {\n    const registeredShortcut = this.shortcuts.get(shortcut.name);\n    if (registeredShortcut && !allowOverrides) {\n      throw new Error(`Shortcut named \"${shortcut.name}\" already exists.`);\n    }\n    this.shortcuts.set(shortcut.name, shortcut);\n\n    const keyCodes = shortcut.keyCodes;\n    if (keyCodes?.length) {\n      for (const keyCode of keyCodes) {\n        this.addKeyMapping(keyCode, shortcut.name, !!shortcut.allowCollision);\n      }\n    }\n  }\n\n  /**\n   * Unregisters a keyboard shortcut registered with the given name. 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(`Keyboard shortcut named \"${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   * Normally only one shortcut can be mapped to any given keycode,\n   * but setting allowCollisions to true allows a keyboard to be\n   * mapped to multiple shortcuts.  In that case, when onKeyDown is\n   * called with the given keystroke, it will process the mapped\n   * shortcuts in reverse order, from the most- to least-recently\n   * mapped).\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 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,\n    shortcutName: string,\n    allowCollision?: boolean,\n  ) {\n    keyCode = `${keyCode}`;\n    const shortcutNames = this.keyMap.get(keyCode);\n    if (shortcutNames && !allowCollision) {\n      throw new Error(\n        `Shortcut named \"${shortcutName}\" collides with shortcuts \"${shortcutNames}\"`,\n      );\n    } else if (shortcutNames && 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 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(\n    keyCode: string,\n    shortcutName: string,\n    quiet?: boolean,\n  ): boolean {\n    const shortcutNames = this.keyMap.get(keyCode);\n\n    if (!shortcutNames) {\n      if (!quiet) {\n        console.warn(\n          `No keyboard shortcut named \"${shortcutName}\" registered with key code \"${keyCode}\"`,\n        );\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 (!quiet) {\n      console.warn(\n        `No keyboard shortcut named \"${shortcutName}\" registered with key code \"${keyCode}\"`,\n      );\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, /* quiet= */ 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   * - Any `KeyboardShortcut`(s) mapped to the keycodes that cause\n   *   event `e` to be fired will be processed, in order from least-\n   *   to most-recently registered.\n   * - If the shortcut's `preconditionFn` exists it will be called.\n   *   If `preconditionFn` returns false the shortcut's `callback`\n   *   function will be skipped.  Processing will continue with the\n   *   next shortcut, if any.\n   * - The shortcut's `callback` function will then be called.  If it\n   *   returns true, processing will terminate and `onKeyDown` will\n   *   return true.  If it returns false, processing will continue\n   *   with with the next shortcut, if any.\n   * - If all registered shortcuts for the given keycode have been\n   *   processed without any having returned true, `onKeyDown` will\n   *   return false.\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: WorkspaceSvg, e: KeyboardEvent): boolean {\n    const key = this.serializeKeyEvent(e);\n    const shortcutNames = this.getShortcutNamesByKeyCode(key);\n    if (!shortcutNames) return false;\n    for (const shortcutName of shortcutNames) {\n      const shortcut = this.shortcuts.get(shortcutName);\n      if (\n        !shortcut ||\n        (shortcut.preconditionFn &&\n          !shortcut.preconditionFn(workspace, {\n            focusedNode: getFocusManager().getFocusedNode() ?? undefined,\n          }))\n      ) {\n        continue;\n      }\n      // If the key has been handled, stop processing shortcuts.\n      if (\n        shortcut.callback?.(workspace, e, shortcut, {\n          focusedNode: getFocusManager().getFocusedNode() ?? undefined,\n        })\n      ) {\n        return true;\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    // Copy the list of shortcuts in case one of them unregisters itself\n    // in its callback.\n    return this.keyMap.get(keyCode)?.slice() || [];\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 += '+' + e.keyCode;\n    } else if (e.keyCode) {\n      serializedKey = String(e.keyCode);\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 (const modifier of modifiers) {\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\n        )[modifier];\n        if (modifiers.includes(modifierKeyCode)) {\n          if (serializedKey !== '') {\n            serializedKey += '+';\n          }\n          serializedKey += modifier;\n        }\n      }\n    }\n\n    if (serializedKey !== '' && keyCode) {\n      serializedKey += '+' + keyCode;\n    } else if (keyCode) {\n      serializedKey = `${keyCode}`;\n    }\n    return serializedKey;\n  }\n}\n\nexport namespace ShortcutRegistry {\n  /** Interface defining a keyboard shortcut. */\n  export interface KeyboardShortcut {\n    /**\n     * The function to be called when the shorctut is invoked.\n     *\n     * @param workspace The `WorkspaceSvg` when the shortcut was\n     *     invoked.\n     * @param e The event that caused the shortcut to be activated.\n     * @param shortcut The `KeyboardShortcut` that was activated\n     *     (i.e., the one this callback is attached to).\n     * @param scope Information about the focused item when the\n     * shortcut was invoked.\n     * @returns Returning true ends processing of the invoked keycode.\n     *     Returning false causes processing to continue with the\n     *     next-most-recently registered shortcut for the invoked\n     *     keycode.\n     */\n    callback?: (\n      workspace: WorkspaceSvg,\n      e: Event,\n      shortcut: KeyboardShortcut,\n      scope: Scope,\n    ) => boolean;\n\n    /** The name of the shortcut.  Should be unique. */\n    name: string;\n\n    /**\n     * A function to be called when the shortcut is invoked, before\n     * calling `callback`, to decide if this shortcut is applicable in\n     * the current situation.\n     *\n     * @param workspace The `WorkspaceSvg` where the shortcut was\n     *     invoked.\n     * @param scope Information about the focused item when the\n     * shortcut would be invoked.\n     * @returns True iff `callback` function should be called.\n     */\n    preconditionFn?: (workspace: WorkspaceSvg, scope: Scope) => boolean;\n\n    /** Optional arbitray extra data attached to the shortcut. */\n    metadata?: object;\n\n    /**\n     * Optional list of key codes to be bound (via\n     * ShortcutRegistry.prototype.addKeyMapping) to this shortcut.\n     */\n    keyCodes?: (number | string)[];\n\n    /**\n     * Value of `allowCollision` to pass to `addKeyMapping` when\n     * binding this shortcut's `.keyCodes` (if any).\n     *\n     * N.B.: this is only used for binding keycodes at the time this\n     * shortcut is initially registered, not for any subsequent\n     * `addKeyMapping` calls that happen to reference this shortcut's\n     * name.\n     */\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 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 */\n// Former goog.module ID: Blockly.Events.Abstract\n\nimport * as common from '../common.js';\nimport type {Workspace} from '../workspace.js';\nimport {getGroup, getRecordUndo} from './utils.js';\n\n/**\n * Abstract class for an event.\n */\nexport abstract class Abstract {\n  /**\n   * Whether or not the event was constructed without necessary parameters\n   * (to be populated by fromJson).\n   */\n  abstract isBlank: boolean;\n\n  /** The workspace identifier for this event. */\n  workspaceId?: string = undefined;\n\n  /**\n   * An ID for the group of events this block is associated with.\n   *\n   * Groups define events that should be treated as an single action from the\n   * user's perspective, and should be undone together.\n   */\n  group: string;\n\n  /** Whether this event is undoable or not. */\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  constructor() {\n    this.group = getGroup();\n    this.recordUndo = 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   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of Abstract (like all events), but we can't specify that due to the\n   *     fact that parameters to static methods in subclasses must be\n   *     supertypes of parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: AbstractEventJson,\n    workspace: Workspace,\n    event: any,\n  ): Abstract {\n    event.isBlank = false;\n    event.group = json['group'] || '';\n    event.workspaceId = workspace.id;\n    return event;\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. Cannot be abstract b/c UI events do /not/ define\n    // this.\n  }\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   */\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    }\n    return workspace;\n  }\n}\n\nexport interface AbstractEventJson {\n  type: string;\n  group: string;\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 */\n// Former goog.module ID: Blockly.Events.UiBase\n\nimport {Abstract as AbstractEvent} from './events_abstract.js';\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 */\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 UI click in Blockly's editor.\n *\n * @class\n */\n\n// Former goog.module ID: Blockly.Events.Click\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that some blockly element was clicked.\n */\nexport class Click extends UiBase {\n  /** The ID of the block that was clicked, if a block was clicked. */\n  blockId?: string;\n\n  /**\n   * The type of element that was clicked; one of 'block', 'workspace',\n   * or 'zoom_controls'.\n   */\n  targetType?: ClickTarget;\n  override type = EventType.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,\n    opt_workspaceId?: string | null,\n    opt_targetType?: ClickTarget,\n  ) {\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    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    }\n    json['targetType'] = this.targetType;\n    json['blockId'] = this.blockId;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of Click, but we can't specify that due to the fact that parameters to\n   *     static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(json: ClickJson, workspace: Workspace, event?: any): Click {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new Click(),\n    ) as Click;\n    newEvent.targetType = json['targetType'];\n    newEvent.blockId = json['blockId'];\n    return newEvent;\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, EventType.CLICK, Click);\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 */\n// Former goog.module ID: 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\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 */\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 \"' +\n          id +\n          '\" with capabilities \"' +\n          this.componentData.get(id)?.capabilities +\n          '\" already added.',\n      );\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, \"' +\n          capability +\n          '\". Plugin \"' +\n          id +\n          '\" has not been added to the ComponentManager',\n      );\n    }\n    if (this.hasCapability(id, capability)) {\n      console.warn(\n        'Plugin \"' + id + 'already has capability \"' + capability + '\"',\n      );\n      return;\n    }\n    capability = `${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, \"' +\n          capability +\n          '\". Plugin \"' +\n          id +\n          '\" has not been added to the ComponentManager',\n      );\n    }\n    if (!this.hasCapability(id, capability)) {\n      console.warn(\n        'Plugin \"' +\n          id +\n          'doesn\\'t have capability \"' +\n          capability +\n          '\" to remove',\n      );\n      return;\n    }\n    capability = `${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 = `${capability}`.toLowerCase();\n    return (\n      this.componentData.has(id) &&\n      this.componentData.get(id)!.capabilities.includes(capability)\n    );\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>,\n    sorted: boolean,\n  ): T[] {\n    capability = `${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  export enum ComponentWeight {\n    // The toolbox weight is lower (higher precedence) than the flyout, so that\n    // if both are under the pointer, the toolbox takes precedence even though\n    // the flyout's drag target area is large enough to include the toolbox.\n    TOOLBOX_WEIGHT = 0,\n    FLYOUT_WEIGHT = 1,\n    TRASHCAN_WEIGHT = 2,\n    ZOOM_CONTROLS_WEIGHT = 3,\n  }\n\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 ComponentWeight = ComponentManager.ComponentWeight;\nexport const ComponentWeight = ComponentManager.ComponentWeight;\nexport type ComponentDatum = ComponentManager.ComponentDatum;\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 */\n// Former goog.module ID: Blockly.utils.Coordinate\n\n/**\n * Class for representing coordinates and positions.\n */\nexport class Coordinate {\n  /**\n   * @param x Left.\n   * @param y Top.\n   */\n  constructor(\n    public x: number,\n    public y: number,\n  ) {}\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(\n    a: Coordinate | SVGPoint,\n    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 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 */\n// Former goog.module ID: Blockly.utils.Svg\n\n/**\n * A name with the type of the SVG element stored in the generic.\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 = new Svg<SVGFEComponentTransferElement>(\n    'feComponentTransfer',\n  );\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 = new Svg<SVGFESpecularLightingElement>(\n    'feSpecularLighting',\n  );\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 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 */\n// Former goog.module ID: Blockly.utils.Rect\n\nimport {Coordinate} from './coordinate.js';\n\n/**\n * Class for representing rectangular regions.\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,\n    public bottom: number,\n    public left: number,\n    public right: number,\n  ) {}\n\n  /**\n   * Converts a DOM or SVG Rect to a Blockly Rect.\n   *\n   * @param rect The rectangle to convert.\n   * @returns A representation of the same rectangle as a Blockly Rect.\n   */\n  static from(rect: DOMRect | SVGRect): Rect {\n    return new Rect(rect.y, rect.y + rect.height, rect.x, rect.x + rect.width);\n  }\n\n  /**\n   * Creates a new copy of this rectangle.\n   *\n   * @returns A copy of this Rect.\n   */\n  clone(): Rect {\n    return new Rect(this.top, this.bottom, this.left, this.right);\n  }\n\n  /** Returns the height of this rectangle. */\n  getHeight(): number {\n    return this.bottom - this.top;\n  }\n\n  /** Returns the width of this rectangle. */\n  getWidth(): number {\n    return this.right - this.left;\n  }\n\n  /** Returns the top left coordinate of this rectangle. */\n  getOrigin(): Coordinate {\n    return new Coordinate(this.left, this.top);\n  }\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 (\n      x >= this.left && x <= this.right && y >= this.top && y <= this.bottom\n    );\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    // The following logic can be derived and then simplified from a longer form symmetrical check\n    // of verifying each rectangle's borders with the other rectangle by checking if either end of\n    // the border's line segment is contained within the other rectangle. The simplified version\n    // used here can be logically interpreted as ensuring that each line segment of 'this' rectangle\n    // is not outside the bounds of the 'other' rectangle (proving there's an intersection).\n    return (\n      this.left <= other.right &&\n      this.right >= other.left &&\n      this.bottom >= other.top &&\n      this.top <= other.bottom\n    );\n  }\n\n  /**\n   * Compares bounding rectangles for equality.\n   *\n   * @param a A Rect.\n   * @param b A Rect.\n   * @returns True iff the bounding rectangles are equal, or if both are null.\n   */\n  static equals(a?: Rect | null, b?: Rect | null): boolean {\n    if (a === b) {\n      return true;\n    }\n    if (!a || !b) {\n      return false;\n    }\n    return (\n      a.top === b.top &&\n      a.bottom === b.bottom &&\n      a.left === b.left &&\n      a.right === b.right\n    );\n  }\n\n  /**\n   * Creates a new Rect using a position and supplied dimensions.\n   *\n   * @param position The upper left coordinate of the new rectangle.\n   * @param width The width of the rectangle, in pixels.\n   * @param height The height of the rectangle, in pixels.\n   * @returns A newly created Rect using the provided Coordinate and dimensions.\n   */\n  static createFromPoint(\n    position: Coordinate,\n    width: number,\n    height: number,\n  ): Rect {\n    const left = position.x;\n    const top = position.y;\n    return new Rect(top, top + height, left, left + width);\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 */\n// Former goog.module ID: Blockly.utils.Size\n\n/**\n * Class for representing sizes consisting of a width and height.\n */\nexport class Size {\n  /**\n   * @param width Width.\n   * @param height Height.\n   */\n  constructor(\n    public width: number,\n    public height: number,\n  ) {}\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   * Returns a new size with the maximum width and height values out of both\n   * sizes.\n   */\n  static max(a: Size, b: Size): Size {\n    return new Size(Math.max(a.width, b.width), Math.max(a.height, b.height));\n  }\n\n  /**\n   * Returns a new size with the minimum width and height values out of both\n   * sizes.\n   */\n  static min(a: Size, b: Size): Size {\n    return new Size(Math.min(a.width, b.width), Math.min(a.height, b.height));\n  }\n}\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 */\n// Former goog.module ID: 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 * 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 */\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\n  /** Whether this scrollbar is part of a pair. */\n  private readonly pair: boolean;\n\n  /**\n   * Margin around the scrollbar (between the scrollbar and the edge of the\n   * viewport in pixels).\n   */\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\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  private origin = new Coordinate(0, 0);\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 isHandleVisible = true;\n\n  /** Whether the workspace containing this scrollbar is visible. */\n  private containerVisible = true;\n\n  /** The transparent background behind the handle. */\n  private svgBackground: SVGRectElement;\n\n  /** The visible handle that can be dragged around. */\n  private svgHandle: SVGRectElement;\n\n  /** The outermost SVG element, which contains all parts of the scrollbar. */\n  private outerSvg: SVGSVGElement;\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  position = new Coordinate(0, 0);\n\n  /**\n   * The DOM attribute that controls the length of the scrollbar. Different\n   * for horizontal and vertical scrollbars.\n   */\n  lengthAttribute_: string;\n\n  /**\n   * The DOM attribute that controls the position of the scrollbar.\n   * Different for horizontal and vertical scrollbars.\n   */\n  positionAttribute_: string;\n\n  /** Handler for mouse down events on the background of the scrollbar. */\n  onMouseDownBarWrapper_: browserEvents.Data;\n\n  /** Handler for mouse down events on the handle of the scrollbar. */\n  onMouseDownHandleWrapper_: browserEvents.Data;\n\n  /** Handler for mouse move events during scrollbar drags. */\n  onMouseUpWrapper_: browserEvents.Data | null = null;\n\n  /** Handler for mouse up events to end scrollbar drags. */\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,\n    private readonly horizontal: boolean,\n    opt_pair?: boolean,\n    opt_class?: string,\n    opt_margin?: number,\n  ) {\n    this.pair = opt_pair || false;\n\n    this.margin =\n      opt_margin !== undefined\n        ? opt_margin\n        : Scrollbar.DEFAULT_SCROLLBAR_MARGIN;\n\n    let className =\n      'blocklyScrollbar' + (this.horizontal ? 'Horizontal' : 'Vertical');\n    if (opt_class) {\n      className += ' ' + opt_class;\n    }\n\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    this.outerSvg = dom.createSvgElement(Svg.SVG, {'class': className});\n    // Child group to hold the handle and background together.\n    const group = dom.createSvgElement(Svg.G, {}, this.outerSvg);\n\n    this.svgBackground = dom.createSvgElement(\n      Svg.RECT,\n      {'class': 'blocklyScrollbarBackground'},\n      group,\n    );\n\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      group,\n    );\n\n    this.workspace\n      .getThemeManager()\n      .subscribe(this.svgHandle, 'scrollbarColour', 'fill');\n    this.workspace\n      .getThemeManager()\n      .subscribe(this.svgHandle, 'scrollbarOpacity', 'fill-opacity');\n\n    // Add everything to the DOM.\n    dom.insertAfter(this.outerSvg, this.workspace.getParentSvg());\n\n    this.setInitialThickness();\n\n    if (horizontal) {\n      this.lengthAttribute_ = 'width';\n      this.positionAttribute_ = 'x';\n    } else {\n      this.lengthAttribute_ = 'height';\n      this.positionAttribute_ = 'y';\n    }\n\n    this.onMouseDownBarWrapper_ = browserEvents.conditionalBind(\n      this.svgBackground,\n      'pointerdown',\n      this,\n      this.onMouseDownBar,\n    );\n    this.onMouseDownHandleWrapper_ = browserEvents.conditionalBind(\n      this.svgHandle,\n      'pointerdown',\n      this,\n      this.onMouseDownHandle,\n    );\n  }\n\n  /**\n   * Set the size of the scrollbar DOM elements along the minor axis.\n   */\n  private setInitialThickness() {\n    const scrollbarThickness = Scrollbar.scrollbarThickness;\n    if (this.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', '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', '2.5');\n    }\n  }\n\n  /**\n   * Dispose of this scrollbar. Remove DOM elements, event listeners,\n   * and theme subscriptions.\n   */\n  dispose() {\n    this.cleanUp();\n    browserEvents.unbind(this.onMouseDownBarWrapper_);\n    browserEvents.unbind(this.onMouseDownHandleWrapper_);\n\n    dom.removeNode(this.outerSvg);\n    this.workspace.getThemeManager().unsubscribe(this.svgHandle);\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_,\n      String(this.handleLength),\n    );\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_,\n      String(this.handlePosition),\n    );\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_,\n      String(this.scrollbarLength),\n    );\n    this.svgBackground.setAttribute(\n      this.lengthAttribute_,\n      String(this.scrollbarLength),\n    );\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    dom.setCssTransform(this.outerSvg, transform);\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 (\n      this.oldHostMetrics &&\n      Scrollbar.metricsAreEquivalent(hostMetrics, this.oldHostMetrics)\n    ) {\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 (\n      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  /**\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 =\n      hostMetrics.absoluteTop +\n      hostMetrics.viewHeight -\n      Scrollbar.scrollbarThickness -\n      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 +\n        hostMetrics.viewWidth -\n        Scrollbar.scrollbarThickness -\n        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 =\n      (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   * 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.isHandleVisible;\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    // Ideally this would also apply to scrollbar pairs, but that's a bigger\n    // headache (due to interactions with the corner square), and the fact\n    // that telling the pair to resize itself would cause circular dependencies.\n    if (this.pair) {\n      throw Error('Unable to toggle visibility of paired scrollbars.');\n    }\n    this.setVisibleInternal(visible);\n  }\n\n  /**\n   * Set whether the scrollbar is visible. Bypasses checking whether this\n   * scrollbar is part of a pair so that it can be toggled by the scrollbar\n   * pair.\n   *\n   * @param visible True if visible.\n   * @internal\n   */\n  setVisibleInternal(visible: boolean) {\n    const visibilityChanged = visible !== this.isVisible();\n    this.isHandleVisible = 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,\n      this.workspace.getParentSvg(),\n      this.workspace.getInverseScreenCTM(),\n    );\n    const mouseLocation = this.horizontal ? mouseXY.x : mouseXY.y;\n\n    const handleXY = svgMath.getInjectionDivXY(this.svgHandle);\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: PointerEvent) {\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    // Record the current mouse position.\n    this.startDragMouse = this.horizontal ? e.clientX : e.clientY;\n    this.onMouseUpWrapper_ = browserEvents.conditionalBind(\n      document,\n      'pointerup',\n      this,\n      this.onMouseUpHandle,\n    );\n    this.onMouseMoveWrapper_ = browserEvents.conditionalBind(\n      document,\n      'pointermove',\n      this,\n      this.onMouseMoveHandle,\n    );\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: PointerEvent) {\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    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(\n    first: Metrics,\n    second: Metrics,\n  ): boolean {\n    return (\n      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","/**\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 */\nexport const SPRITE = {\n  width: 96,\n  height: 124,\n  url: 'sprites.png',\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 */\n// Former goog.module ID: 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 {EventType} from './events/type.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 * Class for a zoom controls.\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   * Array holding info needed to unbind events.\n   * Used for disposing.\n   * Ex: [[node, name, func], [node, name, func]].\n   */\n  private boundEvents: browserEvents.Data[] = [];\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: ComponentManager.ComponentWeight.ZOOM_CONTROLS_WEIGHT,\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    for (const event of this.boundEvents) {\n      browserEvents.unbind(event);\n    }\n    this.boundEvents.length = 0;\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 = uiPosition.getCornerOppositeToolbox(\n      this.workspace,\n      metrics,\n    );\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,\n      new Size(this.WIDTH, height),\n      this.MARGIN_HORIZONTAL,\n      this.MARGIN_VERTICAL,\n      metrics,\n      this.workspace,\n    );\n\n    const verticalPosition = cornerPosition.vertical;\n    const bumpDirection =\n      verticalPosition === uiPosition.verticalPosition.TOP\n        ? uiPosition.bumpDirection.DOWN\n        : uiPosition.bumpDirection.UP;\n    const positionRect = uiPosition.bumpPositionRect(\n      startRect,\n      this.MARGIN_VERTICAL,\n      bumpDirection,\n      savedPositions,\n    );\n\n    if (verticalPosition === uiPosition.verticalPosition.TOP) {\n      const zoomInTranslateY = this.SMALL_SPACING + this.HEIGHT;\n      this.zoomInGroup?.setAttribute(\n        'transform',\n        'translate(0, ' + zoomInTranslateY + ')',\n      );\n      if (this.zoomResetGroup) {\n        const zoomResetTranslateY =\n          zoomInTranslateY + this.LARGE_SPACING + this.HEIGHT;\n        this.zoomResetGroup.setAttribute(\n          'transform',\n          'translate(0, ' + zoomResetTranslateY + ')',\n        );\n      }\n    } else {\n      const zoomInTranslateY = this.zoomResetGroup\n        ? this.LARGE_SPACING + this.HEIGHT\n        : 0;\n      this.zoomInGroup?.setAttribute(\n        'transform',\n        'translate(0, ' + zoomInTranslateY + ')',\n      );\n      const zoomOutTranslateY =\n        zoomInTranslateY + this.SMALL_SPACING + this.HEIGHT;\n      this.zoomOutGroup?.setAttribute(\n        'transform',\n        'translate(0, ' + zoomOutTranslateY + ')',\n      );\n    }\n\n    this.top = positionRect.top;\n    this.left = positionRect.left;\n    this.svgGroup?.setAttribute(\n      'transform',\n      'translate(' + this.left + ',' + this.top + ')',\n    );\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 = dom.createSvgElement(\n      Svg.G,\n      {'class': 'blocklyZoom blocklyZoomOut'},\n      this.svgGroup,\n    );\n    const clip = dom.createSvgElement(\n      Svg.CLIPPATH,\n      {'id': 'blocklyZoomoutClipPath' + rnd},\n      this.zoomOutGroup,\n    );\n    dom.createSvgElement(\n      Svg.RECT,\n      {\n        'width': 32,\n        'height': 32,\n      },\n      clip,\n    );\n    const zoomoutSvg = dom.createSvgElement(\n      Svg.IMAGE,\n      {\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    );\n    zoomoutSvg.setAttributeNS(\n      dom.XLINK_NS,\n      'xlink:href',\n      this.workspace.options.pathToMedia + SPRITE.url,\n    );\n\n    // Attach listener.\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        this.zoomOutGroup,\n        'pointerdown',\n        null,\n        this.zoom.bind(this, -1),\n      ),\n    );\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 = dom.createSvgElement(\n      Svg.G,\n      {'class': 'blocklyZoom blocklyZoomIn'},\n      this.svgGroup,\n    );\n    const clip = dom.createSvgElement(\n      Svg.CLIPPATH,\n      {'id': 'blocklyZoominClipPath' + rnd},\n      this.zoomInGroup,\n    );\n    dom.createSvgElement(\n      Svg.RECT,\n      {\n        'width': 32,\n        'height': 32,\n      },\n      clip,\n    );\n    const zoominSvg = dom.createSvgElement(\n      Svg.IMAGE,\n      {\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    );\n    zoominSvg.setAttributeNS(\n      dom.XLINK_NS,\n      'xlink:href',\n      this.workspace.options.pathToMedia + SPRITE.url,\n    );\n\n    // Attach listener.\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        this.zoomInGroup,\n        'pointerdown',\n        null,\n        this.zoom.bind(this, 1),\n      ),\n    );\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: PointerEvent) {\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 = dom.createSvgElement(\n      Svg.G,\n      {'class': 'blocklyZoom blocklyZoomReset'},\n      this.svgGroup,\n    );\n    const clip = dom.createSvgElement(\n      Svg.CLIPPATH,\n      {'id': 'blocklyZoomresetClipPath' + rnd},\n      this.zoomResetGroup,\n    );\n    dom.createSvgElement(Svg.RECT, {'width': 32, 'height': 32}, clip);\n    const zoomresetSvg = dom.createSvgElement(\n      Svg.IMAGE,\n      {\n        'width': SPRITE.width,\n        'height': SPRITE.height,\n        'y': -92,\n        'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')',\n      },\n      this.zoomResetGroup,\n    );\n    zoomresetSvg.setAttributeNS(\n      dom.XLINK_NS,\n      'xlink:href',\n      this.workspace.options.pathToMedia + SPRITE.url,\n    );\n\n    // Attach event listeners.\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        this.zoomResetGroup,\n        'pointerdown',\n        null,\n        this.resetZoom.bind(this),\n      ),\n    );\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: PointerEvent) {\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(EventType.CLICK))(\n      null,\n      this.workspace.id,\n      'zoom_controls',\n    );\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// Former goog.module ID: Blockly.serialization.priorities\n\n/**\n * The priority for deserializing variables.\n */\nexport const VARIABLES = 100;\n\n/**\n * The priority for deserializing variable data.\n */\nexport const PROCEDURES = 75;\n\n/**\n * The priority for deserializing blocks.\n */\nexport const BLOCKS = 50;\n\n/** The priority for deserializing workspace comments. */\nexport const WORKSPACE_COMMENTS = 25;\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.config\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   */\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   */\n  flyoutDragRadius: 10,\n  /**\n   * Maximum misalignment between connections for them to snap together.\n   *\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  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   */\n  currentConnectionPreference: 8,\n  /**\n   * Delay in ms between trigger and bumping unconnected block out of alignment.\n   *\n   */\n  bumpDelay: 250,\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 */\n// Former goog.module ID: 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 * Class representing an item in a menu.\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: ((obj: this, menuSelectEvent: Event) => void) | null =\n    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  /**\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    element.className =\n      'blocklyMenuItem ' +\n      (this.enabled ? '' : 'blocklyMenuItemDisabled ') +\n      (this.checked ? 'blocklyMenuItemSelected ' : '') +\n      (this.highlight ? 'blocklyMenuItemHighlight ' : '') +\n      (this.rightToLeft ? 'blocklyMenuItemRtl ' : '');\n\n    const content = document.createElement('div');\n    content.className = 'blocklyMenuItemContent';\n    // Add a checkbox for checkable menu items.\n    if (this.checkable) {\n      const checkbox = document.createElement('div');\n      checkbox.className = 'blocklyMenuItemCheckbox ';\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,\n      aria.State.SELECTED,\n      (this.checkable && this.checked) || false,\n    );\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    const el = this.getElement();\n    if (el && this.isEnabled()) {\n      const name = 'blocklyMenuItemHighlight';\n      if (highlight) {\n        dom.addClass(el, name);\n      } else {\n        dom.removeClass(el, name);\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   * @param menuSelectEvent the event that triggered the selection\n   * of the menu item.\n   *\n   * @internal\n   */\n  performAction(menuSelectEvent: Event) {\n    if (this.isEnabled() && this.actionHandler) {\n      this.actionHandler(this, menuSelectEvent);\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, menuSelectEvent: Event) => void, obj: object) {\n    this.actionHandler = fn.bind(obj);\n  }\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 */\n// Former goog.module ID: Blockly.Menu\n\nimport * as browserEvents from './browser_events.js';\nimport type {MenuSeparator} from './menu_separator.js';\nimport {MenuItem} from './menuitem.js';\nimport * as aria from './utils/aria.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport type {Size} from './utils/size.js';\nimport * as style from './utils/style.js';\n\n/**\n * A basic menu class.\n */\nexport class Menu {\n  /**\n   * Array of menu items and separators.\n   */\n  private readonly menuItems: Array<MenuItem | MenuSeparator> = [];\n\n  /**\n   * Coordinates of the pointerdown event that caused this menu to open. Used to\n   * prevent the consequent pointerup 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  /** Pointer over event data. */\n  private pointerMoveHandler: browserEvents.Data | null = null;\n\n  /** Click event data. */\n  private clickHandler: browserEvents.Data | null = null;\n\n  /** Pointer enter event data. */\n  private pointerEnterHandler: browserEvents.Data | null = null;\n\n  /** Pointer leave event data. */\n  private pointerLeaveHandler: 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 or separator to append.\n   * @internal\n   */\n  addChild(menuItem: MenuItem | MenuSeparator) {\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\n  render(container: Element): HTMLDivElement {\n    const element = document.createElement('div');\n    element.className = 'blocklyMenu';\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.pointerMoveHandler = browserEvents.conditionalBind(\n      element,\n      'pointermove',\n      this,\n      this.handlePointerMove,\n      true,\n    );\n    this.clickHandler = browserEvents.conditionalBind(\n      element,\n      'pointerup',\n      this,\n      this.handleClick,\n      true,\n    );\n    this.pointerEnterHandler = browserEvents.conditionalBind(\n      element,\n      'pointerenter',\n      this,\n      this.handlePointerEnter,\n      true,\n    );\n    this.pointerLeaveHandler = browserEvents.conditionalBind(\n      element,\n      'pointerleave',\n      this,\n      this.handlePointerLeave,\n      true,\n    );\n    this.onKeyDownHandler = browserEvents.conditionalBind(\n      element,\n      'keydown',\n      this,\n      this.handleKeyEvent,\n    );\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    }\n  }\n\n  /** Blur the menu element. */\n  private blur() {\n    const el = this.getElement();\n    if (el) {\n      el.blur();\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.pointerMoveHandler) {\n      browserEvents.unbind(this.pointerMoveHandler);\n      this.pointerMoveHandler = null;\n    }\n    if (this.clickHandler) {\n      browserEvents.unbind(this.clickHandler);\n      this.clickHandler = null;\n    }\n    if (this.pointerEnterHandler) {\n      browserEvents.unbind(this.pointerEnterHandler);\n      this.pointerEnterHandler = null;\n    }\n    if (this.pointerLeaveHandler) {\n      browserEvents.unbind(this.pointerLeaveHandler);\n      this.pointerLeaveHandler = 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        const items = this.getMenuItems();\n        for (let i = 0, menuItem; (menuItem = items[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 menuElement = this.getElement();\n      const menuItemElement = item.getElement();\n      if (!menuElement || !menuItemElement) return;\n\n      style.scrollIntoContainerView(menuItemElement, menuElement);\n      aria.setState(menuElement, 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    const items = this.getMenuItems();\n    while ((menuItem = items[index])) {\n      if (menuItem.isEnabled()) {\n        this.setHighlighted(menuItem);\n        break;\n      }\n      index += delta;\n    }\n  }\n\n  // Pointer events.\n\n  /**\n   * Handles pointermove events. Highlight menu items as the user hovers over\n   * them.\n   *\n   * @param e Pointer event to handle.\n   */\n  private handlePointerMove(e: PointerEvent) {\n    // Check whether the pointer actually did move. Move events are triggered if\n    // the element underneath the pointer moves, even if the pointer itself has\n    // remained stationary. In the case where the pointer is hovering over\n    // the menu but the user is navigating through the list of items via the\n    // keyboard and causing items off the end of the menu to scroll into view,\n    // a pointermove event would be triggered due to the pointer now being over\n    // a new child, but we don't want to highlight the item that's now under the\n    // pointer.\n    const delta = Math.max(Math.abs(e.movementX), Math.abs(e.movementY));\n    if (delta === 0) return;\n\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: PointerEvent) {\n    const oldCoords = this.openingCoords;\n    // Clear out the saved opening coords immediately so they're not used twice.\n    this.openingCoords = null;\n    if (oldCoords && typeof e.clientX === 'number') {\n      const newCoords = new Coordinate(e.clientX, e.clientY);\n      if (Coordinate.distance(oldCoords, newCoords) < 1) {\n        // This menu was opened by a pointerdown and we're handling the\n        // consequent click event. The coords haven't changed, meaning this was\n        // the same opening event. Don't do the usual behavior because the menu\n        // just popped up under the pointer and the user didn't mean to activate\n        // this item.\n        return;\n      }\n    }\n\n    const menuItem = this.getMenuItem(e.target as Element);\n    if (menuItem) {\n      menuItem.performAction(e);\n    }\n  }\n\n  /**\n   * Handles pointer enter events. Focus the element.\n   *\n   * @param _e Pointer event to handle.\n   */\n  private handlePointerEnter(_e: PointerEvent) {\n    this.focus();\n  }\n\n  /**\n   * Handles pointer leave events by clearing the active highlight.\n   *\n   * @param _e Pointer event to handle.\n   */\n  private handlePointerLeave(_e: PointerEvent) {\n    if (this.getElement()) {\n      this.setHighlighted(null);\n    }\n  }\n\n  // Keyboard events.\n\n  /**\n   * Attempts to handle a keyboard event.\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    const keyboardEvent = e as KeyboardEvent;\n    if (\n      keyboardEvent.shiftKey ||\n      keyboardEvent.ctrlKey ||\n      keyboardEvent.metaKey ||\n      keyboardEvent.altKey\n    ) {\n      // Do not handle the key event if any modifier key is pressed.\n      return;\n    }\n\n    const highlighted = this.highlightedItem;\n    switch (keyboardEvent.key) {\n      case 'Enter':\n      case ' ':\n        if (highlighted) {\n          highlighted.performAction(e);\n        }\n        break;\n\n      case 'ArrowUp':\n        this.highlightPrevious();\n        break;\n\n      case 'ArrowDown':\n        this.highlightNext();\n        break;\n\n      case 'PageUp':\n      case 'Home':\n        this.highlightFirst();\n        break;\n\n      case 'PageDown':\n      case '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() as HTMLDivElement;\n    const menuSize = style.getSize(menuDom);\n    // Recalculate height for the total content, not only box height.\n    menuSize.height = menuDom.scrollHeight;\n    return menuSize;\n  }\n\n  /**\n   * Returns the action menu items (omitting separators) in this menu.\n   *\n   * @returns The MenuItem objects displayed in this menu.\n   */\n  private getMenuItems(): MenuItem[] {\n    return this.menuItems.filter((item) => item instanceof MenuItem);\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as aria from './utils/aria.js';\n\n/**\n * Representation of a section separator in a menu.\n */\nexport class MenuSeparator {\n  /**\n   * DOM element representing this separator in a menu.\n   */\n  private element: HTMLHRElement | null = null;\n\n  /**\n   * Creates the DOM representation of this separator.\n   *\n   * @returns An <hr> element.\n   */\n  createDom(): HTMLHRElement {\n    this.element = document.createElement('hr');\n    this.element.className = 'blocklyMenuSeparator';\n    aria.setRole(this.element, aria.Role.SEPARATOR);\n\n    return this.element;\n  }\n\n  /**\n   * Disposes of this separator.\n   */\n  dispose() {\n    this.element?.remove();\n    this.element = null;\n  }\n}\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.constants\n\n/**\n * The language-neutral ID given to the collapsed input.\n */\nexport const COLLAPSED_INPUT_NAME = '_TEMP_COLLAPSED_INPUT';\n\n/**\n * The language-neutral ID given to the collapsed field.\n */\nexport const COLLAPSED_FIELD_NAME = '_TEMP_COLLAPSED_FIELD';\n\n/**\n * The language-neutral ID for when the reason why a block is disabled is\n * because the user manually disabled it, such as via the context menu.\n */\nexport const MANUALLY_DISABLED = 'MANUALLY_DISABLED';\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.inputTypes\n\nimport {ConnectionType} from '../connection_type.js';\n\n/**\n * Enum for the type of a connection or input.\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  // An unknown type of input defined by an external developer.\n  CUSTOM = 6,\n  // An input with no connections that is always the last input of a row. Any\n  // subsequent input will be rendered on the next row. Any newline character in\n  // a JSON block definition's message will be parsed as an end-row input.\n  END_ROW = 7,\n}\n","/**\n * @license\n * Copyright 2013 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Msg\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 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as Css from './css.js';\nimport {Msg} from './msg.js';\nimport * as aria from './utils/aria.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\nconst CLASS_NAME = 'blocklyToast';\nconst MESSAGE_CLASS_NAME = 'blocklyToastMessage';\nconst CLOSE_BUTTON_CLASS_NAME = 'blocklyToastCloseButton';\n\n/**\n * Display/configuration options for a toast notification.\n */\nexport interface ToastOptions {\n  /**\n   * Toast ID. If set along with `oncePerSession`, will cause subsequent toasts\n   * with this ID to not be shown.\n   */\n  id?: string;\n\n  /**\n   * Flag to show the toast once per session only.\n   * Subsequent calls are ignored.\n   */\n  oncePerSession?: boolean;\n\n  /**\n   * Text of the message to display on the toast.\n   */\n  message: string;\n\n  /**\n   * Duration in seconds before the toast is removed. Defaults to 5.\n   */\n  duration?: number;\n\n  /**\n   * How prominently/interrupting the readout of the toast should be for\n   * screenreaders. Corresponds to aria-live and defaults to polite.\n   */\n  assertiveness?: Toast.Assertiveness;\n}\n\n/**\n * Class that allows for showing and dismissing temporary notifications.\n */\nexport class Toast {\n  /** IDs of toasts that have previously been shown. */\n  private static shownIds = new Set<string>();\n\n  /**\n   * Shows a toast notification.\n   *\n   * @param workspace The workspace to show the toast on.\n   * @param options Configuration options for the toast message, duration, etc.\n   */\n  static show(workspace: WorkspaceSvg, options: ToastOptions) {\n    if (options.oncePerSession && options.id) {\n      if (this.shownIds.has(options.id)) return;\n      this.shownIds.add(options.id);\n    }\n\n    // Clear any existing toasts.\n    this.hide(workspace);\n\n    const toast = this.createDom(workspace, options);\n\n    // Animate the toast into view.\n    requestAnimationFrame(() => {\n      toast.style.bottom = '2rem';\n    });\n  }\n\n  /**\n   * Creates the DOM representation of a toast.\n   *\n   * @param workspace The workspace to inject the toast notification onto.\n   * @param options Configuration options for the toast.\n   * @returns The root DOM element of the toast.\n   */\n  protected static createDom(workspace: WorkspaceSvg, options: ToastOptions) {\n    const {\n      message,\n      duration = 5,\n      assertiveness = Toast.Assertiveness.POLITE,\n    } = options;\n\n    const toast = document.createElement('div');\n    workspace.getInjectionDiv().appendChild(toast);\n    toast.dataset.toastId = options.id;\n    toast.className = CLASS_NAME;\n    aria.setRole(toast, aria.Role.STATUS);\n    aria.setState(toast, aria.State.LIVE, assertiveness);\n\n    const messageElement = toast.appendChild(document.createElement('div'));\n    messageElement.className = MESSAGE_CLASS_NAME;\n    messageElement.innerText = message;\n    const closeButton = toast.appendChild(document.createElement('button'));\n    closeButton.className = CLOSE_BUTTON_CLASS_NAME;\n    aria.setState(closeButton, aria.State.LABEL, Msg['CLOSE']);\n    const closeIcon = dom.createSvgElement(\n      Svg.SVG,\n      {\n        width: 24,\n        height: 24,\n        viewBox: '0 0 24 24',\n        fill: 'none',\n      },\n      closeButton,\n    );\n    aria.setState(closeIcon, aria.State.HIDDEN, true);\n    dom.createSvgElement(\n      Svg.RECT,\n      {\n        x: 19.7782,\n        y: 2.80762,\n        width: 2,\n        height: 24,\n        transform: 'rotate(45, 19.7782, 2.80762)',\n        fill: 'black',\n      },\n      closeIcon,\n    );\n    dom.createSvgElement(\n      Svg.RECT,\n      {\n        x: 2.80762,\n        y: 4.22183,\n        width: 2,\n        height: 24,\n        transform: 'rotate(-45, 2.80762, 4.22183)',\n        fill: 'black',\n      },\n      closeIcon,\n    );\n    closeButton.addEventListener('click', () => {\n      toast.remove();\n      workspace.markFocused();\n    });\n\n    let timeout: ReturnType<typeof setTimeout>;\n    const setToastTimeout = () => {\n      timeout = setTimeout(() => toast.remove(), duration * 1000);\n    };\n    const clearToastTimeout = () => clearTimeout(timeout);\n    toast.addEventListener('focusin', clearToastTimeout);\n    toast.addEventListener('focusout', setToastTimeout);\n    toast.addEventListener('mouseenter', clearToastTimeout);\n    toast.addEventListener('mousemove', clearToastTimeout);\n    toast.addEventListener('mouseleave', setToastTimeout);\n    setToastTimeout();\n\n    return toast;\n  }\n\n  /**\n   * Dismiss a toast, e.g. in response to a user action.\n   *\n   * @param workspace The workspace to dismiss a toast in.\n   * @param id The toast ID, or undefined to clear any toast.\n   */\n  static hide(workspace: WorkspaceSvg, id?: string) {\n    const toast = workspace.getInjectionDiv().querySelector(`.${CLASS_NAME}`);\n    if (toast instanceof HTMLElement && (!id || id === toast.dataset.toastId)) {\n      toast.remove();\n    }\n  }\n}\n\n/**\n * Options for how aggressively toasts should be read out by screenreaders.\n * Values correspond to those for aria-live.\n */\nexport namespace Toast {\n  export enum Assertiveness {\n    ASSERTIVE = 'assertive',\n    POLITE = 'polite',\n  }\n}\n\nCss.register(`\n.${CLASS_NAME} {\n  font-size: 1.2rem;\n  position: absolute;\n  bottom: -10rem;\n  right: 2rem;\n  padding: 1rem;\n  color: black;\n  background-color: white;\n  border: 2px solid black;\n  border-radius: 0.4rem;\n  z-index: 999;\n  display: flex;\n  align-items: center;\n  gap: 0.8rem;\n  line-height: 1.5;\n  transition: bottom 0.3s ease-out;\n}\n\n.${CLASS_NAME} .${MESSAGE_CLASS_NAME} {\n  maxWidth: 18rem;\n}\n\n.${CLASS_NAME} .${CLOSE_BUTTON_CLASS_NAME} {\n  margin: 0;\n  padding: 0.2rem;\n  background-color: transparent;\n  color: black;\n  border: none;\n  cursor: pointer;\n}\n`);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.serialization.exceptions\n\nimport type {Block} from '../block.js';\nimport type {State} from './blocks.js';\n\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 */\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 */\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(\n    connection: string,\n    public block: Block,\n    public state: State,\n  ) {\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 */\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,\n    childConnection: string,\n    public childBlock: Block,\n    public childState: State,\n  ) {\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 */\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\nexport class UnregisteredIcon extends DeserializationError {\n  /**\n   * @param iconType The type of the unregistered icon we are attempting to\n   *     deserialize.\n   * @param block The block we are attempting to add the unregistered icon to.\n   * @param state The state object representing the block.\n   */\n  constructor(\n    iconType: string,\n    public block: Block,\n    public state: State,\n  ) {\n    super(\n      `Cannot add an icon of type '${iconType}' to the block ` +\n        `${block.toDevString()}, because there is no icon registered with ` +\n        `type '${iconType}'. Make sure that all of your icons have been ` +\n        `registered.`,\n    );\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ICommentIcon} from '../interfaces/i_comment_icon.js';\nimport {IIcon} from '../interfaces/i_icon.js';\nimport {MutatorIcon} from './mutator_icon.js';\nimport {WarningIcon} from './warning_icon.js';\n\n/**\n * Defines the type of an icon, so that it can be retrieved from block.getIcon\n */\nexport class IconType<_T extends IIcon> {\n  /** @param name The name of the registry type. */\n  constructor(private readonly name: string) {}\n\n  /** @returns the name of the type. */\n  toString(): string {\n    return this.name;\n  }\n\n  /** @returns true if this icon type is equivalent to the given icon type. */\n  equals(type: IconType<IIcon>): boolean {\n    return this.name === type.toString();\n  }\n\n  static MUTATOR = new IconType<MutatorIcon>('mutator');\n  static WARNING = new IconType<WarningIcon>('warning');\n  static COMMENT = new IconType<ICommentIcon>('comment');\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 */\n// Former goog.module ID: Blockly.Events.BlockBase\n\nimport type {Block} from '../block.js';\nimport type {Workspace} from '../workspace.js';\nimport {\n  Abstract as AbstractEvent,\n  AbstractEventJson,\n} from './events_abstract.js';\n\n/**\n * Abstract class for any event related to blocks.\n */\nexport class BlockBase extends AbstractEvent {\n  override isBlank = true;\n\n  /** The ID of the block associated with this event. */\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    this.blockId = opt_block.id;\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(): BlockBaseJson {\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    }\n    json['blockId'] = this.blockId;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BlockBase, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: BlockBaseJson,\n    workspace: Workspace,\n    event?: any,\n  ): BlockBase {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BlockBase(),\n    ) as BlockBase;\n    newEvent.blockId = json['blockId'];\n    return newEvent;\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 */\n// Former goog.module ID: Blockly.Events.BlockChange\n\nimport type {Block} from '../block.js';\nimport type {BlockSvg} from '../block_svg.js';\nimport {MANUALLY_DISABLED} from '../constants.js';\nimport {IconType} from '../icons/icon_types.js';\nimport {hasBubble} from '../interfaces/i_has_bubble.js';\nimport * as registry from '../registry.js';\nimport * as utilsXml from '../utils/xml.js';\nimport {Workspace} from '../workspace.js';\nimport * as Xml from '../xml.js';\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport {EventType} from './type.js';\nimport * as eventUtils from './utils.js';\n\n/**\n * Notifies listeners when some element of a block has changed (e.g.\n * field values, comments, etc).\n */\nexport class BlockChange extends BlockBase {\n  override type = EventType.BLOCK_CHANGE;\n  /**\n   * The element that changed; one of 'field', 'comment', 'collapsed',\n   * 'disabled', 'inline', or 'mutation'\n   */\n  element?: string;\n\n  /** The name of the field that changed, if this is a change to a field. */\n  name?: string;\n\n  /** The original value of the element. */\n  oldValue: unknown;\n\n  /** The new value of the element. */\n  newValue: unknown;\n\n  /**\n   * If element is 'disabled', this is the language-neutral identifier of the\n   * reason why the block was or was not disabled.\n   */\n  private disabledReason?: string;\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,\n    opt_element?: string,\n    opt_name?: string | null,\n    opt_oldValue?: unknown,\n    opt_newValue?: unknown,\n  ) {\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    }\n    json['element'] = this.element;\n    json['name'] = this.name;\n    json['oldValue'] = this.oldValue;\n    json['newValue'] = this.newValue;\n    if (this.disabledReason) {\n      json['disabledReason'] = this.disabledReason;\n    }\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BlockChange, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: BlockChangeJson,\n    workspace: Workspace,\n    event?: any,\n  ): BlockChange {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BlockChange(),\n    ) as BlockChange;\n    newEvent.element = json['element'];\n    newEvent.name = json['name'];\n    newEvent.oldValue = json['oldValue'];\n    newEvent.newValue = json['newValue'];\n    if (json['disabledReason'] !== undefined) {\n      newEvent.disabledReason = json['disabledReason'];\n    }\n    return newEvent;\n  }\n\n  /**\n   * Set the language-neutral identifier for the reason why the block was or was\n   * not disabled. This is only valid for events where element is 'disabled'.\n   * Defaults to 'MANUALLY_DISABLED'.\n   *\n   * @param disabledReason The identifier of the reason why the block was or was\n   *     not disabled.\n   */\n  setDisabledReason(disabledReason: string) {\n    if (this.element !== 'disabled') {\n      throw new Error(\n        'Cannot set the disabled reason for a BlockChange event if the ' +\n          'element is not \"disabled\".',\n      );\n    }\n    this.disabledReason = disabledReason;\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    }\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    }\n    // Assume the block is rendered so that then we can check.\n    const icon = block.getIcon(IconType.MUTATOR);\n    if (icon && hasBubble(icon) && icon.bubbleIsVisible()) {\n      // Close the mutator (if open) since we don't want to update it.\n      icon.setBubbleVisible(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.setDisabledReason(\n          !!value,\n          this.disabledReason ?? MANUALLY_DISABLED,\n        );\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(\n            utilsXml.textToDom((value as string) || '<mutation/>'),\n          );\n        }\n        eventUtils.fire(\n          new BlockChange(block, 'mutation', null, oldState, value),\n        );\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(true);\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  disabledReason?: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.BLOCK_CHANGE, BlockChange);\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 */\n// Former goog.module ID: 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 {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Input} from './inputs/input.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport type {IKeyboardAccessible} from './interfaces/i_keyboard_accessible.js';\nimport type {IRegistrable} from './interfaces/i_registrable.js';\nimport {ISerializable} from './interfaces/i_serializable.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 idGenerator from './utils/idgenerator.js';\nimport * as parsing from './utils/parsing.js';\nimport {Rect} from './utils/rect.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 {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldValidator<T = any> = (newValue: T) => T | null | undefined;\n\n/**\n * Abstract class for an editable field.\n *\n * @typeParam T - The value stored on the field.\n */\nexport abstract class Field<T = any>\n  implements IKeyboardAccessible, IRegistrable, ISerializable, IFocusableNode\n{\n  /**\n   * To overwrite the default value which is set in **Field**, directly update\n   * the prototype.\n   *\n   * Example:\n   * `FieldImage.prototype.DEFAULT_VALUE = null;`\n   */\n  DEFAULT_VALUE: T | null = null;\n\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 = Symbol('SKIP_SETUP');\n\n  /**\n   * Name of field.  Unique within each block.\n   * Static labels are usually unnamed.\n   */\n  name?: string = undefined;\n  protected value_: T | null;\n\n  /** Validation function called when user edits an editable field. */\n  protected validator_: FieldValidator<T> | 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\n  /** This field's dimensions. */\n  private size: Size = new Size(0, 0);\n\n  /**\n   * Gets the size of this field. Because getSize() and updateSize() have side\n   * effects, this acts as a shim for subclasses which wish to adjust field\n   * bounds when setting/getting the size without triggering unwanted rendering\n   * or other side effects. Note that subclasses must override *both* get and\n   * set if either is overridden; the implementation may just call directly\n   * through to super, but it must exist per the JS spec.\n   */\n  protected get size_(): Size {\n    return this.size;\n  }\n\n  protected set size_(newValue: Size) {\n    this.size = newValue;\n  }\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  /** The unique ID of this field. */\n  private id_: string | null = null;\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 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 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: T | typeof Field.SKIP_SETUP,\n    validator?: FieldValidator<T> | null,\n    config?: FieldConfig,\n  ) {\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_ =\n      'DEFAULT_VALUE' in new.target.prototype\n        ? new.target.prototype.DEFAULT_VALUE\n        : this.DEFAULT_VALUE;\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) return;\n    if (config) {\n      this.configure_(config);\n    }\n    this.setValue(value);\n    if (validator) {\n      this.setValidator(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    if (block.id.includes('_field')) {\n      throw new Error(\n        `Field ID indicator is contained in block ID. This may cause ` +\n          `problems with focus: ${block.id}.`,\n      );\n    }\n    this.id_ = `${block.id}_field_${idGenerator.getNextUniqueId()}`;\n  }\n\n  /**\n   * Get the renderer constant provider.\n   *\n   * @returns The renderer constant provider.\n   */\n  getConstants(): ConstantProvider | null {\n    if (\n      !this.constants_ &&\n      this.sourceBlock_ &&\n      !this.sourceBlock_.isDeadOrDying() &&\n      this.sourceBlock_.workspace.rendered\n    ) {\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    const id = this.id_;\n    if (!id) throw new Error('Expected ID to be defined prior to init.');\n    this.fieldGroup_ = dom.createSvgElement(Svg.G, {\n      'id': id,\n    });\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    this.applyColour();\n  }\n\n  /**\n   * Create the block UI for this field.\n   */\n  protected initView() {\n    this.createBorderRect_();\n    this.createTextElement_();\n    if (this.fieldGroup_) {\n      dom.addClass(this.fieldGroup_, 'blocklyField');\n    }\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  initModel() {}\n\n  /**\n   * Defines whether this field should take up the full block or not.\n   *\n   * Be cautious when overriding this function. It may not work as you expect /\n   * intend because the behavior was kind of hacked in. If you are thinking\n   * about overriding this function, post on the forum with your intended\n   * behavior to see if there's another approach.\n   *\n   * @internal\n   */\n  isFullBlockField(): boolean {\n    return !this.borderRect_;\n  }\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      {\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  /**\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      {\n        'class': 'blocklyText blocklyFieldText',\n      },\n      this.fieldGroup_,\n    );\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,\n      'pointerdown',\n      this,\n      this.onMouseDown_,\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   */\n  fromXml(fieldElement: Element) {\n    // Any because gremlins live here. No touchie!\n    this.setValue(fieldElement.textContent as any);\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   */\n  toXml(fieldElement: Element): Element {\n    // Any because gremlins live here. No touchie!\n    fieldElement.textContent = this.getValue() as any;\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   *     See the\n   *     {@link https://developers.devsite.google.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating#full_serialization_and_backing_data | field serialization docs}\n   *     for more information.\n   * @returns JSON serializable state.\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   */\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 (\n      callingClass.prototype.saveState === this.saveState &&\n      callingClass.prototype.toXml !== this.toXml\n    ) {\n      const elem = utilsXml.createElement('field');\n      elem.setAttribute('name', this.name || '');\n      const text = utilsXml.domToText(this.toXml(elem));\n      return text.replace(\n        ' xmlns=\"https://developers.google.com/blockly/xml\"',\n        '',\n      );\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(\n    callingClass: FieldProto,\n    state: AnyDuringMigration,\n  ): boolean {\n    if (\n      callingClass.prototype.loadState === this.loadState &&\n      callingClass.prototype.fromXml !== this.fromXml\n    ) {\n      this.fromXml(utilsXml.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  dispose() {\n    dropDownDiv.hideIfOwner(this);\n    WidgetDiv.hideIfOwner(this);\n\n    if (!this.getSourceBlock()?.isDeadOrDying()) {\n      dom.removeNode(this.fieldGroup_);\n    }\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, 'blocklyEditableField');\n      dom.removeClass(group, 'blocklyNonEditableField');\n    } else {\n      dom.addClass(group, 'blocklyNonEditableField');\n      dom.removeClass(group, 'blocklyEditableField');\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 (\n      this.enabled_ &&\n      !!this.sourceBlock_ &&\n      this.sourceBlock_.isEditable() &&\n      this.showEditor_ !== Field.prototype.showEditor_\n    );\n  }\n\n  /**\n   * Check whether the field should be clickable while the block is in a flyout.\n   * The default is that fields are clickable in always-open flyouts such as the\n   * simple toolbox, but not in autoclosing flyouts such as the category toolbox.\n   * Subclasses may override this function to change this behavior. Note that\n   * `isClickable` must also return true for this to have any effect.\n   *\n   * @param autoClosingFlyout true if the containing flyout is an auto-closing one.\n   * @returns Whether the field should be clickable while the block is in a flyout.\n   */\n  isClickableInFlyout(autoClosingFlyout: boolean): boolean {\n    return !autoClosingFlyout;\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 (\n      this.enabled_ &&\n      this.EDITABLE &&\n      !!this.sourceBlock_ &&\n      this.sourceBlock_.isEditable()\n    );\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        );\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: FieldValidator<T>) {\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(): FieldValidator<T> | 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.\n   *\n   * Non-abstract sub-classes may wish to implement this if the colour of the\n   * field depends on the colour of the block. It will automatically be called\n   * at relevant times, such as when the parent block or renderer changes.\n   *\n   * See {@link\n   * https://developers.google.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating#matching_block_colours\n   * | the field documentation} for more information, or FieldDropdown for an\n   * example.\n   */\n  applyColour() {}\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 e Optional mouse event that triggered the field to open, or\n   *     undefined if triggered programmatically.\n   * @sealed\n   * @internal\n   */\n  showEditor(e?: Event) {\n    if (this.isClickable()) {\n      this.showEditor_(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   * A developer hook to reposition the WidgetDiv during a window resize. You\n   * need to define this hook if your field has a WidgetDiv that needs to\n   * reposition itself when the window is resized. For example, text input\n   * fields define this hook so that the input WidgetDiv can reposition itself\n   * on a window resize event. This is especially important when modal inputs\n   * have been disabled, as Android devices will fire a window resize event when\n   * the soft keyboard opens.\n   *\n   * If you want the WidgetDiv to hide itself instead of repositioning, return\n   * false. This is the default behavior.\n   *\n   * DropdownDivs already handle their own positioning logic, so you do not need\n   * to override this function if your field only has a DropdownDiv.\n   *\n   * @returns True if the field should be repositioned,\n   *    false if the WidgetDiv should hide itself instead.\n   */\n  repositionForWindowResize(): boolean {\n    return false;\n  }\n\n  /**\n   * Updates the size of the field based on the text.\n   *\n   * @param margin margin to use when positioning the text element.\n   */\n  protected updateSize_(margin?: number) {\n    const constants = this.getConstants();\n    const xOffset =\n      margin !== undefined\n        ? margin\n        : !this.isFullBlockField()\n          ? 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.getTextWidth(this.textElement_);\n      totalWidth += contentWidth;\n    }\n    if (!this.isFullBlockField()) {\n      totalHeight = Math.max(totalHeight, constants!.FIELD_BORDER_RECT_HEIGHT);\n    }\n\n    this.size_ = new Size(totalWidth, totalHeight);\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      String(\n        this.getSourceBlock()?.RTL\n          ? this.size_.width - contentWidth - xOffset\n          : xOffset,\n      ),\n    );\n    this.textElement_.setAttribute(\n      'y',\n      String(\n        constants!.FIELD_TEXT_BASELINE_CENTER\n          ? halfHeight\n          : halfHeight -\n              constants!.FIELD_TEXT_HEIGHT / 2 +\n              constants!.FIELD_TEXT_BASELINE,\n      ),\n    );\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', String(this.size_.width));\n    this.borderRect_.setAttribute('height', String(this.size_.height));\n    this.borderRect_.setAttribute(\n      'rx',\n      String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS),\n    );\n    this.borderRect_.setAttribute(\n      'ry',\n      String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS),\n    );\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    }\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.isFullBlockField()) {\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   * Notifies the field that it has changed locations.\n   *\n   * @param _ The location of this field's block's top-start corner\n   *     in workspace coordinates.\n   */\n  onLocationChange(_: Coordinate) {}\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.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  forceRerender() {\n    this.isDirty_ = true;\n    if (this.sourceBlock_ && this.sourceBlock_.rendered) {\n      (this.sourceBlock_ as BlockSvg).queueRender();\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   * @param fireChangeEvent Whether to fire a change event. Defaults to true.\n   *     Should usually be true unless the change will be reported some other\n   *     way, e.g. an intermediate field change event.\n   * @sealed\n   */\n  setValue(newValue: AnyDuringMigration, fireChangeEvent = true) {\n    const doLogging = false;\n    if (newValue === null) {\n      if (doLogging) console.log('null, return');\n      // Not a valid value to check.\n      return;\n    }\n\n    // Field validators are allowed to make changes to the workspace, which\n    // should get grouped with the field value change event.\n    const existingGroup = eventUtils.getGroup();\n    if (!existingGroup) {\n      eventUtils.setGroup(true);\n    }\n\n    try {\n      const classValidation = this.doClassValidation_(newValue);\n      const classValue = this.processValidation(\n        newValue,\n        classValidation,\n        fireChangeEvent,\n      );\n      if (classValue instanceof Error) {\n        if (doLogging) console.log('invalid class validation, return');\n        return;\n      }\n\n      const localValidation = this.getValidator()?.call(this, classValue);\n      const localValue = this.processValidation(\n        classValue,\n        localValidation,\n        fireChangeEvent,\n      );\n      if (localValue instanceof Error) {\n        if (doLogging) console.log('invalid local validation, return');\n        return;\n      }\n\n      const source = this.sourceBlock_;\n      if (source && source.disposed) {\n        if (doLogging) console.log('source disposed, return');\n        return;\n      }\n\n      const oldValue = this.getValue();\n      if (oldValue === localValue) {\n        if (doLogging) console.log('same, doValueUpdate_, return');\n        this.doValueUpdate_(localValue);\n        return;\n      }\n\n      this.doValueUpdate_(localValue);\n      if (fireChangeEvent && source && eventUtils.isEnabled()) {\n        eventUtils.fire(\n          new (eventUtils.get(EventType.BLOCK_CHANGE))(\n            source,\n            'field',\n            this.name || null,\n            oldValue,\n            localValue,\n          ),\n        );\n      }\n      if (this.isDirty_) {\n        this.forceRerender();\n      }\n      if (doLogging) console.log(this.value_);\n    } finally {\n      eventUtils.setGroup(existingGroup);\n    }\n  }\n\n  /**\n   * Process the result of validation.\n   *\n   * @param newValue New value.\n   * @param validatedValue Validated value.\n   * @param fireChangeEvent Whether to fire a change event if the value changes.\n   * @returns New value, or an Error object.\n   */\n  private processValidation(\n    newValue: AnyDuringMigration,\n    validatedValue: T | null | undefined,\n    fireChangeEvent: boolean,\n  ): T | Error {\n    if (validatedValue === null) {\n      this.doValueInvalid_(newValue, fireChangeEvent);\n      if (this.isDirty_) {\n        this.forceRerender();\n      }\n      return Error();\n    }\n    return validatedValue === undefined ? (newValue as T) : validatedValue;\n  }\n\n  /**\n   * Get the current value of the field.\n   *\n   * @returns Current value.\n   */\n  getValue(): T | null {\n    return this.value_;\n  }\n\n  /**\n   * Validate the changes to a field's value before they are set. See\n   * **FieldDropdown** for an example of subclass implementation.\n   *\n   * **NOTE:** Validation returns one option between `T`, `null`, and\n   * `undefined`. **Field**'s implementation will never return `undefined`, but\n   * it is valid for a subclass to return `undefined` if the new value is\n   * compatible with `T`.\n   *\n   * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n   * @param newValue - The value to be validated.\n   * @returns One of three instructions for setting the new value: `T`, `null`,\n   * or `undefined`.\n   *\n   * - `T` to set this function's returned value instead of `newValue`.\n   *\n   * - `null` to invoke `doValueInvalid_` and not set a value.\n   *\n   * - `undefined` to set `newValue` as is.\n   */\n  protected doClassValidation_(newValue: T): T | null | undefined;\n  protected doClassValidation_(newValue?: AnyDuringMigration): T | null;\n  protected doClassValidation_(\n    newValue?: T | AnyDuringMigration,\n  ): T | null | undefined {\n    if (newValue === null || newValue === undefined) {\n      return null;\n    }\n\n    return newValue as T;\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: T) {\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   * @param _fireChangeEvent Whether to fire a change event if the value changes.\n   */\n  protected doValueInvalid_(\n    _invalidValue: AnyDuringMigration,\n    _fireChangeEvent: boolean = true,\n  ) {}\n  // NOP\n\n  /**\n   * Handle a pointerdown event on a field.\n   *\n   * @param e Pointer down event.\n   */\n  protected onMouseDown_(e: PointerEvent) {\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 !== '') {\n      // 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   */\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  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   * 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  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    if (!this.fieldGroup_) {\n      throw Error('This field currently has no representative DOM element.');\n    }\n    return this.fieldGroup_;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    const block = this.getSourceBlock();\n    if (!block) {\n      throw new UnattachedFieldError();\n    }\n    return block.workspace as WorkspaceSvg;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {\n    const block = this.getSourceBlock() as BlockSvg;\n    block.workspace.scrollBoundsIntoView(\n      block.getBoundingRectangleWithoutChildren(),\n    );\n  }\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\n\n  /**\n   * Subclasses should reimplement this method to construct their Field\n   * subclass from a JSON arg object.\n   *\n   * It is an error to attempt to register a field subclass in the\n   * FieldRegistry if that subclass has not overridden this method.\n   *\n   * @param _options JSON configuration object with properties needed\n   *    to configure a specific field.\n   */\n  static fromJson(_options: FieldConfig): Field {\n    throw new Error(\n      `Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.`,\n    );\n  }\n}\n\n/**\n * Extra configuration options for the base field.\n */\nexport interface FieldConfig {\n  tooltip?: string;\n}\n\n/**\n * Represents an object that has all the prototype properties of the `Field`\n * class. This is necessary because constructors can change\n * in descendants, though they should contain all of Field's prototype methods.\n *\n * This type should only be used in places where we directly access the prototype\n * of a Field class or subclass.\n */\ntype 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","/**\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 */\n// Former goog.module ID: Blockly.ContextMenuRegistry\n\nimport type {BlockSvg} from './block_svg.js';\nimport {RenderedWorkspaceComment} from './comments/rendered_workspace_comment.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\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 */\nexport class ContextMenuRegistry {\n  static registry: ContextMenuRegistry;\n  /** Registry of all registered RegistryItems, keyed by ID. */\n  private registeredItems = 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.registeredItems.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.registeredItems.has(item.id)) {\n      throw Error('Menu item with ID \"' + item.id + '\" is already registered.');\n    }\n    this.registeredItems.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.registeredItems.has(id)) {\n      throw new Error('Menu item with ID \"' + id + '\" not found.');\n    }\n    this.registeredItems.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.registeredItems.get(id) ?? null;\n  }\n\n  /**\n   * Gets the valid context menu options for the given scope.\n   * Options are only included if the preconditionFn shows\n   * they should not be hidden.\n   *\n   * @param scope Current scope of context menu (i.e., the exact workspace or\n   *     block being clicked on).\n   * @param menuOpenEvent Event that caused the menu to open.\n   * @returns the list of ContextMenuOptions\n   */\n  getContextMenuOptions(\n    scope: Scope,\n    menuOpenEvent: Event,\n  ): ContextMenuOption[] {\n    const menuOptions: ContextMenuOption[] = [];\n    for (const item of this.registeredItems.values()) {\n      if (item.scopeType) {\n        // If the scopeType is present, check to make sure\n        // that the option is compatible with the current scope\n        if (item.scopeType === ScopeType.BLOCK && !scope.block) continue;\n        if (item.scopeType === ScopeType.COMMENT && !scope.comment) continue;\n        if (item.scopeType === ScopeType.WORKSPACE && !scope.workspace)\n          continue;\n      }\n      let menuOption:\n        | ContextMenuRegistry.CoreContextMenuOption\n        | ContextMenuRegistry.SeparatorContextMenuOption\n        | ContextMenuRegistry.ActionContextMenuOption;\n      menuOption = {\n        scope,\n        weight: item.weight,\n      };\n\n      if (item.separator) {\n        menuOption = {\n          ...menuOption,\n          separator: true,\n        };\n      } else {\n        const precondition = item.preconditionFn(scope, menuOpenEvent);\n        if (precondition === 'hidden') continue;\n\n        const displayText =\n          typeof item.displayText === 'function'\n            ? item.displayText(scope)\n            : item.displayText;\n        menuOption = {\n          ...menuOption,\n          text: displayText,\n          callback: item.callback,\n          enabled: precondition === 'enabled',\n        };\n      }\n\n      menuOptions.push(menuOption);\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    COMMENT = 'comment',\n  }\n\n  /**\n   * The actual workspace/block/focused object where the menu is being\n   * rendered. This is passed to callback and displayText functions\n   * that depend on this information.\n   */\n  export interface Scope {\n    block?: BlockSvg;\n    workspace?: WorkspaceSvg;\n    comment?: RenderedWorkspaceComment;\n    focusedNode?: IFocusableNode;\n  }\n\n  /**\n   * Fields common to all context menu registry items.\n   */\n  interface CoreRegistryItem {\n    scopeType?: ScopeType;\n    weight: number;\n    id: string;\n  }\n\n  /**\n   * A representation of a normal, clickable menu item in the registry.\n   */\n  interface ActionRegistryItem extends CoreRegistryItem {\n    /**\n     * @param scope Object that provides a reference to the thing that had its\n     *     context menu opened.\n     * @param menuOpenEvent The original event that triggered the context menu to open.\n     * @param menuSelectEvent The event that triggered the option being selected.\n     * @param location The location in screen coordinates where the menu was opened.\n     */\n    callback: (\n      scope: Scope,\n      menuOpenEvent: Event,\n      menuSelectEvent: Event,\n      location: Coordinate,\n    ) => void;\n    displayText: ((p1: Scope) => string | HTMLElement) | string | HTMLElement;\n    preconditionFn: (p1: Scope, menuOpenEvent: Event) => string;\n    separator?: never;\n  }\n\n  /**\n   * A representation of a menu separator item in the registry.\n   */\n  interface SeparatorRegistryItem extends CoreRegistryItem {\n    separator: true;\n    callback?: never;\n    displayText?: never;\n    preconditionFn?: never;\n  }\n\n  /**\n   * A menu item as entered in the registry.\n   */\n  export type RegistryItem = ActionRegistryItem | SeparatorRegistryItem;\n\n  /**\n   * Fields common to all context menu items as used by contextmenu.ts.\n   */\n  export interface CoreContextMenuOption {\n    scope: Scope;\n    weight: number;\n  }\n\n  /**\n   * A representation of a normal, clickable menu item in contextmenu.ts.\n   */\n  export interface ActionContextMenuOption extends CoreContextMenuOption {\n    text: string | HTMLElement;\n    enabled: boolean;\n    /**\n     * @param scope Object that provides a reference to the thing that had its\n     *     context menu opened.\n     * @param menuOpenEvent The original event that triggered the context menu to open.\n     * @param menuSelectEvent The event that triggered the option being selected.\n     * @param location The location in screen coordinates where the menu was opened.\n     */\n    callback: (\n      scope: Scope,\n      menuOpenEvent: Event,\n      menuSelectEvent: Event,\n      location: Coordinate,\n    ) => void;\n    separator?: never;\n  }\n\n  /**\n   * A representation of a menu separator item in contextmenu.ts.\n   */\n  export interface SeparatorContextMenuOption extends CoreContextMenuOption {\n    separator: true;\n    text?: never;\n    enabled?: never;\n    callback?: never;\n  }\n\n  /**\n   * A menu item as presented to contextmenu.ts.\n   */\n  export type ContextMenuOption =\n    | ActionContextMenuOption\n    | SeparatorContextMenuOption;\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    separator?: never;\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 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The layer to place blocks on.\n *\n */\nexport const BLOCK = 50;\n\n/**\n * The layer to place bubbles on.\n *\n */\nexport const BUBBLE = 100;\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {RenderedWorkspaceComment} from '../comments.js';\nimport {CommentMove} from '../events/events_comment_move.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport {IDragStrategy} from '../interfaces/i_draggable.js';\nimport * as layers from '../layers.js';\nimport {Coordinate} from '../utils.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\nexport class CommentDragStrategy implements IDragStrategy {\n  private startLoc: Coordinate | null = null;\n\n  private workspace: WorkspaceSvg;\n\n  constructor(private comment: RenderedWorkspaceComment) {\n    this.workspace = comment.workspace;\n  }\n\n  isMovable(): boolean {\n    return (\n      this.comment.isOwnMovable() &&\n      !this.comment.isDeadOrDying() &&\n      !this.workspace.isReadOnly()\n    );\n  }\n\n  startDrag(): void {\n    this.fireDragStartEvent();\n    this.startLoc = this.comment.getRelativeToSurfaceXY();\n    this.workspace.setResizesEnabled(false);\n    this.workspace.getLayerManager()?.moveToDragLayer(this.comment);\n    this.comment.setDragging(true);\n  }\n\n  drag(newLoc: Coordinate): void {\n    this.comment.moveDuringDrag(newLoc);\n  }\n\n  endDrag(): void {\n    this.fireDragEndEvent();\n    this.fireMoveEvent();\n\n    this.workspace\n      .getLayerManager()\n      ?.moveOffDragLayer(this.comment, layers.BLOCK);\n    this.comment.setDragging(false);\n\n    this.comment.snapToGrid();\n\n    this.workspace.setResizesEnabled(true);\n  }\n\n  /** Fire a UI event at the start of a comment drag. */\n  private fireDragStartEvent() {\n    const event = new (eventUtils.get(EventType.COMMENT_DRAG))(\n      this.comment,\n      true,\n    );\n    eventUtils.fire(event);\n  }\n\n  /** Fire a UI event at the end of a comment drag. */\n  private fireDragEndEvent() {\n    const event = new (eventUtils.get(EventType.COMMENT_DRAG))(\n      this.comment,\n      false,\n    );\n    eventUtils.fire(event);\n  }\n\n  /** Fire a move event at the end of a comment drag. */\n  private fireMoveEvent() {\n    if (this.comment.isDeadOrDying()) return;\n    const event = new (eventUtils.get(EventType.COMMENT_MOVE))(\n      this.comment,\n    ) as CommentMove;\n    event.setReason(['drag']);\n    event.oldCoordinate_ = this.startLoc!;\n    event.recordNew();\n    eventUtils.fire(event);\n  }\n\n  revertDrag(): void {\n    if (this.startLoc) this.comment.moveDuringDrag(this.startLoc);\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport {Rect} from '../utils/rect.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport type {CommentView} from './comment_view.js';\n\n/**\n * Button displayed on a comment's top bar.\n */\nexport abstract class CommentBarButton implements IFocusableNode {\n  /**\n   * SVG image displayed on this button.\n   */\n  protected abstract readonly icon: SVGImageElement;\n\n  /**\n   * Creates a new CommentBarButton instance.\n   *\n   * @param id The ID of this button's parent comment.\n   * @param workspace The workspace this button's parent comment is on.\n   * @param container An SVG group that this button should be a child of.\n   */\n  constructor(\n    protected readonly id: string,\n    protected readonly workspace: WorkspaceSvg,\n    protected readonly container: SVGGElement,\n    protected readonly commentView: CommentView,\n  ) {}\n\n  /**\n   * Returns whether or not this button is currently visible.\n   */\n  isVisible(): boolean {\n    return this.icon.checkVisibility();\n  }\n\n  /**\n   * Returns the parent comment view of this comment bar button.\n   */\n  getCommentView(): CommentView {\n    return this.commentView;\n  }\n\n  /** Adjusts the position of this button within its parent container. */\n  abstract reposition(): void;\n\n  /** Perform the action this button should take when it is acted on. */\n  abstract performAction(e?: Event): void;\n\n  /**\n   * Returns the dimensions of this button in workspace coordinates.\n   *\n   * @param includeMargin True to include the margin when calculating the size.\n   * @returns The size of this button.\n   */\n  getSize(includeMargin = false): Rect {\n    const bounds = this.icon.getBBox();\n    const rect = Rect.from(bounds);\n    if (includeMargin) {\n      const margin = this.getMargin();\n      rect.left -= margin;\n      rect.top -= margin;\n      rect.bottom += margin;\n      rect.right += margin;\n    }\n    return rect;\n  }\n\n  /** Returns the margin in workspace coordinates surrounding this button. */\n  getMargin(): number {\n    return (this.container.getBBox().height - this.icon.getBBox().height) / 2;\n  }\n\n  /** Returns a DOM element representing this button that can receive focus. */\n  getFocusableElement() {\n    return this.icon;\n  }\n\n  /** Returns the workspace this button is a child of. */\n  getFocusableTree() {\n    return this.workspace;\n  }\n\n  /** Called when this button's focusable DOM element gains focus. */\n  onNodeFocus() {\n    const commentView = this.getCommentView();\n    const xy = commentView.getRelativeToSurfaceXY();\n    const size = commentView.getSize();\n    const bounds = new Rect(xy.y, xy.y + size.height, xy.x, xy.x + size.width);\n    commentView.workspace.scrollBoundsIntoView(bounds);\n  }\n\n  /** Called when this button's focusable DOM element loses focus. */\n  onNodeBlur() {}\n\n  /** Returns whether this button can be focused. True if it is visible. */\n  canBeFocused() {\n    return this.isVisible();\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as browserEvents from '../browser_events.js';\nimport * as touch from '../touch.js';\nimport * as dom from '../utils/dom.js';\nimport {Svg} from '../utils/svg.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport {CommentBarButton} from './comment_bar_button.js';\nimport type {CommentView} from './comment_view.js';\n\n/**\n * Magic string appended to the comment ID to create a unique ID for this button.\n */\nexport const COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER =\n  '_collapse_bar_button';\n\n/**\n * Button that toggles the collapsed state of a comment.\n */\nexport class CollapseCommentBarButton extends CommentBarButton {\n  /**\n   * Opaque ID used to unbind event handlers during disposal.\n   */\n  private readonly bindId: browserEvents.Data;\n\n  /**\n   * SVG image displayed on this button.\n   */\n  protected override readonly icon: SVGImageElement;\n\n  /**\n   * Creates a new CollapseCommentBarButton instance.\n   *\n   * @param id The ID of this button's parent comment.\n   * @param workspace The workspace this button's parent comment is displayed on.\n   * @param container An SVG group that this button should be a child of.\n   */\n  constructor(\n    protected readonly id: string,\n    protected readonly workspace: WorkspaceSvg,\n    protected readonly container: SVGGElement,\n    protected readonly commentView: CommentView,\n  ) {\n    super(id, workspace, container, commentView);\n\n    this.icon = dom.createSvgElement(\n      Svg.IMAGE,\n      {\n        'class': 'blocklyFoldoutIcon',\n        'href': `${this.workspace.options.pathToMedia}foldout-icon.svg`,\n        'id': `${this.id}${COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER}`,\n      },\n      this.container,\n    );\n    this.bindId = browserEvents.conditionalBind(\n      this.icon,\n      'pointerdown',\n      this,\n      this.performAction.bind(this),\n    );\n  }\n\n  /**\n   * Disposes of this button.\n   */\n  dispose() {\n    browserEvents.unbind(this.bindId);\n  }\n\n  /**\n   * Adjusts the positioning of this button within its container.\n   */\n  override reposition() {\n    const margin = this.getMargin();\n    this.icon.setAttribute('y', `${margin}`);\n    this.icon.setAttribute('x', `${margin}`);\n  }\n\n  /**\n   * Toggles the collapsed state of the parent comment.\n   *\n   * @param e The event that triggered this action.\n   */\n  override performAction(e?: Event) {\n    touch.clearTouchIdentifier();\n\n    this.getCommentView().bringToFront();\n    if (e && e instanceof PointerEvent && browserEvents.isRightButton(e)) {\n      e.stopPropagation();\n      return;\n    }\n\n    this.getCommentView().setCollapsed(!this.getCommentView().isCollapsed());\n    this.workspace.hideChaff();\n\n    e?.stopPropagation();\n  }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as browserEvents from '../browser_events.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport {IFocusableTree} from '../interfaces/i_focusable_tree.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 * as svgMath from '../utils/svg_math.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\n/**\n * String added to the ID of a workspace comment to identify\n * the focusable node for the comment editor.\n */\nexport const COMMENT_EDITOR_FOCUS_IDENTIFIER = '_comment_textarea_';\n\n/** The part of a comment that can be typed into. */\nexport class CommentEditor implements IFocusableNode {\n  id?: string;\n  /** The foreignObject containing the HTML text area. */\n  private foreignObject: SVGForeignObjectElement;\n\n  /** The text area where the user can type. */\n  private textArea: HTMLTextAreaElement;\n\n  /** Listeners for changes to text. */\n  private textChangeListeners: Array<\n    (oldText: string, newText: string) => void\n  > = [];\n\n  /** The current text of the comment. Updates on text area change. */\n  private text: string = '';\n\n  constructor(\n    public workspace: WorkspaceSvg,\n    commentId?: string,\n    private onFinishEditing?: () => void,\n  ) {\n    this.foreignObject = dom.createSvgElement(Svg.FOREIGNOBJECT, {\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    this.textArea = document.createElementNS(\n      dom.HTML_NS,\n      'textarea',\n    ) as HTMLTextAreaElement;\n    this.textArea.setAttribute('tabindex', '-1');\n    this.textArea.setAttribute('dir', this.workspace.RTL ? 'RTL' : 'LTR');\n    dom.addClass(this.textArea, 'blocklyCommentText');\n    dom.addClass(this.textArea, 'blocklyTextarea');\n    dom.addClass(this.textArea, 'blocklyText');\n    body.appendChild(this.textArea);\n    this.foreignObject.appendChild(body);\n\n    if (commentId) {\n      this.id = commentId + COMMENT_EDITOR_FOCUS_IDENTIFIER;\n      this.textArea.setAttribute('id', this.id);\n    }\n\n    // Register browser event listeners for the user typing in the textarea.\n    browserEvents.conditionalBind(\n      this.textArea,\n      'change',\n      this,\n      this.onTextChange,\n    );\n\n    // Register listener for pointerdown to focus the textarea.\n    browserEvents.conditionalBind(\n      this.textArea,\n      'pointerdown',\n      this,\n      (e: PointerEvent) => {\n        // don't allow this event to bubble up\n        // and steal focus away from the editor/comment.\n        e.stopPropagation();\n        getFocusManager().focusNode(this);\n        touch.clearTouchIdentifier();\n      },\n    );\n\n    // Don't zoom with mousewheel; let it scroll instead.\n    browserEvents.conditionalBind(this.textArea, 'wheel', this, (e: Event) => {\n      e.stopPropagation();\n    });\n\n    // Register listener for keydown events that would finish editing.\n    browserEvents.conditionalBind(\n      this.textArea,\n      'keydown',\n      this,\n      this.handleKeyDown,\n    );\n  }\n\n  /** Gets the dom structure for this comment editor. */\n  getDom(): SVGForeignObjectElement {\n    return this.foreignObject;\n  }\n\n  /** Gets the current text of the comment. */\n  getText(): string {\n    return this.text;\n  }\n\n  /** Sets the current text of the comment and fires change listeners. */\n  setText(text: string) {\n    this.textArea.value = text;\n    this.onTextChange();\n  }\n\n  /**\n   * Triggers listeners when the text of the comment changes, either\n   * programmatically or manually by the user.\n   */\n  private onTextChange() {\n    const oldText = this.text;\n    this.text = this.textArea.value;\n    // Loop through listeners backwards in case they remove themselves.\n    for (let i = this.textChangeListeners.length - 1; i >= 0; i--) {\n      this.textChangeListeners[i](oldText, this.text);\n    }\n  }\n\n  /**\n   * Do something when the user indicates they've finished editing.\n   *\n   * @param e Keyboard event.\n   */\n  private handleKeyDown(e: KeyboardEvent) {\n    if (e.key === 'Escape' || (e.key === 'Enter' && (e.ctrlKey || e.metaKey))) {\n      if (this.onFinishEditing) this.onFinishEditing();\n      e.stopPropagation();\n    }\n  }\n\n  /** Registers a callback that listens for text changes. */\n  addTextChangeListener(listener: (oldText: string, newText: string) => void) {\n    this.textChangeListeners.push(listener);\n  }\n\n  /** Removes the given listener from the list of text change listeners. */\n  removeTextChangeListener(listener: () => void) {\n    this.textChangeListeners.splice(\n      this.textChangeListeners.indexOf(listener),\n      1,\n    );\n  }\n\n  /** Sets the placeholder text displayed for an empty comment. */\n  setPlaceholderText(text: string) {\n    this.textArea.placeholder = text;\n  }\n\n  /** Sets whether the textarea is editable. If not, the textarea will be readonly. */\n  setEditable(isEditable: boolean) {\n    if (isEditable) {\n      this.textArea.removeAttribute('readonly');\n    } else {\n      this.textArea.setAttribute('readonly', 'true');\n    }\n  }\n\n  /** Update the size of the comment editor element. */\n  updateSize(size: Size, topBarSize: Size) {\n    this.foreignObject.setAttribute(\n      'height',\n      `${size.height - topBarSize.height}`,\n    );\n    this.foreignObject.setAttribute('width', `${size.width}`);\n    this.foreignObject.setAttribute('y', `${topBarSize.height}`);\n    if (this.workspace.RTL) {\n      this.foreignObject.setAttribute('x', `${-size.width}`);\n    }\n  }\n\n  getFocusableElement(): HTMLElement | SVGElement {\n    return this.textArea;\n  }\n  getFocusableTree(): IFocusableTree {\n    return this.workspace;\n  }\n  onNodeFocus(): void {\n    const bbox = Rect.from(this.foreignObject.getBoundingClientRect());\n    this.workspace.scrollBoundsIntoView(\n      Rect.createFromPoint(\n        svgMath.screenToWsCoordinates(this.workspace, bbox.getOrigin()),\n        bbox.getWidth(),\n        bbox.getHeight(),\n      ),\n    );\n  }\n  onNodeBlur(): void {}\n  canBeFocused(): boolean {\n    if (this.id) return true;\n    return false;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as browserEvents from '../browser_events.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport * as touch from '../touch.js';\nimport * as dom from '../utils/dom.js';\nimport {Svg} from '../utils/svg.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport {CommentBarButton} from './comment_bar_button.js';\nimport type {CommentView} from './comment_view.js';\n\n/**\n * Magic string appended to the comment ID to create a unique ID for this button.\n */\nexport const COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER = '_delete_bar_button';\n\n/**\n * Button that deletes a comment.\n */\nexport class DeleteCommentBarButton extends CommentBarButton {\n  /**\n   * Opaque ID used to unbind event handlers during disposal.\n   */\n  private readonly bindId: browserEvents.Data;\n\n  /**\n   * SVG image displayed on this button.\n   */\n  protected override readonly icon: SVGImageElement;\n\n  /**\n   * Creates a new DeleteCommentBarButton instance.\n   *\n   * @param id The ID of this button's parent comment.\n   * @param workspace The workspace this button's parent comment is shown on.\n   * @param container An SVG group that this button should be a child of.\n   */\n  constructor(\n    protected readonly id: string,\n    protected readonly workspace: WorkspaceSvg,\n    protected readonly container: SVGGElement,\n    protected readonly commentView: CommentView,\n  ) {\n    super(id, workspace, container, commentView);\n\n    this.icon = dom.createSvgElement(\n      Svg.IMAGE,\n      {\n        'class': 'blocklyDeleteIcon',\n        'href': `${this.workspace.options.pathToMedia}delete-icon.svg`,\n        'id': `${this.id}${COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER}`,\n      },\n      container,\n    );\n    this.bindId = browserEvents.conditionalBind(\n      this.icon,\n      'pointerdown',\n      this,\n      this.performAction.bind(this),\n    );\n  }\n\n  /**\n   * Disposes of this button.\n   */\n  dispose() {\n    browserEvents.unbind(this.bindId);\n  }\n\n  /**\n   * Adjusts the positioning of this button within its container.\n   */\n  override reposition() {\n    const margin = this.getMargin();\n    // Reset to 0 so that our position doesn't force the parent container to\n    // grow.\n    this.icon.setAttribute('x', `0`);\n    const containerSize = this.container.getBBox();\n    this.icon.setAttribute('y', `${margin}`);\n    this.icon.setAttribute(\n      'x',\n      `${containerSize.width - this.getSize(true).getWidth()}`,\n    );\n  }\n\n  /**\n   * Deletes parent comment.\n   *\n   * @param e The event that triggered this action.\n   */\n  override performAction(e?: Event) {\n    touch.clearTouchIdentifier();\n    if (e && e instanceof PointerEvent && browserEvents.isRightButton(e)) {\n      e.stopPropagation();\n      return;\n    }\n\n    this.getCommentView().dispose();\n    e?.stopPropagation();\n    getFocusManager().focusNode(this.workspace);\n  }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as browserEvents from '../browser_events.js';\nimport * as css from '../css.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node';\nimport {IRenderedElement} from '../interfaces/i_rendered_element.js';\nimport * as layers from '../layers.js';\nimport * as touch from '../touch.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport * as dom from '../utils/dom.js';\nimport * as drag from '../utils/drag.js';\nimport {Size} from '../utils/size.js';\nimport {Svg} from '../utils/svg.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\nimport {CollapseCommentBarButton} from './collapse_comment_bar_button.js';\nimport {CommentBarButton} from './comment_bar_button.js';\nimport {CommentEditor} from './comment_editor.js';\nimport {DeleteCommentBarButton} from './delete_comment_bar_button.js';\n\nexport class CommentView implements IRenderedElement {\n  /** The root group element of the comment view. */\n  private svgRoot: SVGGElement;\n\n  /**\n   * The SVG rect element that we use to create a highlight around the comment.\n   */\n  private highlightRect: SVGRectElement;\n\n  /** The group containing all of the top bar elements. */\n  private topBarGroup: SVGGElement;\n\n  /** The rect background for the top bar. */\n  private topBarBackground: SVGRectElement;\n\n  /** The delete button that goes in the top bar. */\n  private deleteButton: DeleteCommentBarButton;\n\n  /** The foldout button that goes in the top bar. */\n  private foldoutButton: CollapseCommentBarButton;\n\n  /** The text element that goes in the top bar. */\n  private textPreview: SVGTextElement;\n\n  /** The actual text node in the text preview. */\n  private textPreviewNode: Text;\n\n  /** The resize handle element. */\n  private resizeHandle: SVGImageElement;\n\n  /** The part of the comment view that contains the textarea to edit the comment. */\n  private commentEditor: CommentEditor;\n\n  /** The current size of the comment in workspace units. */\n  private size: Size;\n\n  /** Whether the comment is collapsed or not. */\n  private collapsed: boolean = false;\n\n  /** Whether the comment is editable or not. */\n  private editable: boolean = true;\n\n  /** The current location of the comment in workspace coordinates. */\n  private location: Coordinate = new Coordinate(0, 0);\n\n  /** Listeners for changes to size. */\n  private sizeChangeListeners: Array<(oldSize: Size, newSize: Size) => void> =\n    [];\n\n  /** Listeners for disposal. */\n  private disposeListeners: Array<() => void> = [];\n\n  /** Listeners for collapsing. */\n  private collapseChangeListeners: Array<(newCollapse: boolean) => void> = [];\n\n  /**\n   * Event data for the pointer up event on the resize handle. Used to\n   * unregister the listener.\n   */\n  private resizePointerUpListener: browserEvents.Data | null = null;\n\n  /**\n   * Event data for the pointer move event on the resize handle. Used to\n   * unregister the listener.\n   */\n  private resizePointerMoveListener: browserEvents.Data | null = null;\n\n  /** Whether this comment view is currently being disposed or not. */\n  protected disposing = false;\n\n  /** Whether this comment view has been disposed or not. */\n  protected disposed = false;\n\n  /** Size of this comment when the resize drag was initiated. */\n  private preResizeSize?: Size;\n\n  /** The default size of newly created comments. */\n  static defaultCommentSize = new Size(120, 100);\n\n  constructor(\n    readonly workspace: WorkspaceSvg,\n    readonly commentId: string,\n  ) {\n    this.svgRoot = dom.createSvgElement(Svg.G, {\n      'class': 'blocklyComment blocklyEditable blocklyDraggable',\n    });\n\n    this.highlightRect = this.createHighlightRect(this.svgRoot);\n\n    ({\n      topBarGroup: this.topBarGroup,\n      topBarBackground: this.topBarBackground,\n      deleteButton: this.deleteButton,\n      foldoutButton: this.foldoutButton,\n      textPreview: this.textPreview,\n      textPreviewNode: this.textPreviewNode,\n    } = this.createTopBar(this.svgRoot));\n\n    this.commentEditor = this.createTextArea();\n\n    this.resizeHandle = this.createResizeHandle(this.svgRoot, workspace);\n\n    // TODO: Remove this comment before merging.\n    // I think we want comments to exist on the same layer as blocks.\n    workspace.getLayerManager()?.append(this, layers.BLOCK);\n\n    // Set size to the default size.\n    this.size = CommentView.defaultCommentSize;\n    this.setSizeWithoutFiringEvents(this.size);\n\n    // Set default transform (including inverted scale for RTL).\n    this.moveTo(new Coordinate(0, 0));\n  }\n\n  /**\n   * Creates the rect we use for highlighting the comment when it's selected.\n   */\n  private createHighlightRect(svgRoot: SVGGElement): SVGRectElement {\n    return dom.createSvgElement(\n      Svg.RECT,\n      {'class': 'blocklyCommentHighlight'},\n      svgRoot,\n    );\n  }\n\n  /**\n   * Creates the top bar and the elements visually within it.\n   * Registers event listeners.\n   */\n  private createTopBar(svgRoot: SVGGElement): {\n    topBarGroup: SVGGElement;\n    topBarBackground: SVGRectElement;\n    deleteButton: DeleteCommentBarButton;\n    foldoutButton: CollapseCommentBarButton;\n    textPreview: SVGTextElement;\n    textPreviewNode: Text;\n  } {\n    const topBarGroup = dom.createSvgElement(\n      Svg.G,\n      {\n        'class': 'blocklyCommentTopbar',\n      },\n      svgRoot,\n    );\n    const topBarBackground = dom.createSvgElement(\n      Svg.RECT,\n      {\n        'class': 'blocklyCommentTopbarBackground',\n      },\n      topBarGroup,\n    );\n    const deleteButton = new DeleteCommentBarButton(\n      this.commentId,\n      this.workspace,\n      topBarGroup,\n      this,\n    );\n    const foldoutButton = new CollapseCommentBarButton(\n      this.commentId,\n      this.workspace,\n      topBarGroup,\n      this,\n    );\n    this.addDisposeListener(() => {\n      deleteButton.dispose();\n      foldoutButton.dispose();\n    });\n    const textPreview = dom.createSvgElement(\n      Svg.TEXT,\n      {\n        'class': 'blocklyCommentPreview blocklyCommentText blocklyText',\n      },\n      topBarGroup,\n    );\n    const textPreviewNode = document.createTextNode('');\n    textPreview.appendChild(textPreviewNode);\n\n    return {\n      topBarGroup,\n      topBarBackground,\n      deleteButton,\n      foldoutButton,\n      textPreview,\n      textPreviewNode,\n    };\n  }\n\n  /**\n   * Creates the text area where users can type. Registers event listeners.\n   */\n  private createTextArea() {\n    // When the user is done editing comment, focus the entire comment.\n    const onFinishEditing = () => this.svgRoot.focus();\n    const commentEditor = new CommentEditor(\n      this.workspace,\n      this.commentId,\n      onFinishEditing,\n    );\n\n    this.svgRoot.appendChild(commentEditor.getDom());\n\n    commentEditor.addTextChangeListener((oldText, newText) => {\n      this.updateTextPreview(newText);\n      // Update size in case our minimum size increased.\n      this.setSize(this.size);\n    });\n\n    return commentEditor;\n  }\n\n  /**\n   *\n   * @returns The FocusableNode representing the editor portion of this comment.\n   */\n  getEditorFocusableNode(): IFocusableNode {\n    return this.commentEditor;\n  }\n\n  /** Creates the DOM elements for the comment resize handle. */\n  private createResizeHandle(\n    svgRoot: SVGGElement,\n    workspace: WorkspaceSvg,\n  ): SVGImageElement {\n    const resizeHandle = dom.createSvgElement(\n      Svg.IMAGE,\n      {\n        'class': 'blocklyResizeHandle',\n        'href': `${workspace.options.pathToMedia}resize-handle.svg`,\n      },\n      svgRoot,\n    );\n\n    browserEvents.conditionalBind(\n      resizeHandle,\n      'pointerdown',\n      this,\n      this.onResizePointerDown,\n    );\n\n    return resizeHandle;\n  }\n\n  /** Returns the root SVG group element of the comment view. */\n  getSvgRoot(): SVGGElement {\n    return this.svgRoot;\n  }\n\n  /**\n   * Returns the current size of the comment in workspace units.\n   * Respects collapsing.\n   */\n  getSize(): Size {\n    return this.collapsed ? this.topBarBackground.getBBox() : this.size;\n  }\n\n  /**\n   * Sets the size of the comment in workspace units, and updates the view\n   * elements to reflect the new size.\n   */\n  setSizeWithoutFiringEvents(size: Size) {\n    const topBarSize = this.topBarBackground.getBBox();\n    const textPreviewSize = this.textPreview.getBBox();\n    const resizeSize = this.resizeHandle.getBBox();\n\n    size = Size.max(size, this.calcMinSize(topBarSize));\n    this.size = size;\n\n    this.svgRoot.setAttribute('height', `${size.height}`);\n    this.svgRoot.setAttribute('width', `${size.width}`);\n\n    this.updateHighlightRect(size);\n    this.updateTopBarSize(size);\n    this.commentEditor.updateSize(size, topBarSize);\n    this.deleteButton.reposition();\n    this.foldoutButton.reposition();\n    this.updateTextPreviewSize(size, topBarSize, textPreviewSize);\n    this.updateResizeHandlePosition(size, resizeSize);\n  }\n\n  /**\n   * Sets the size of the comment in workspace units, updates the view\n   * elements to reflect the new size, and triggers size change listeners.\n   */\n  setSize(size: Size) {\n    const oldSize = this.preResizeSize || this.size;\n    this.setSizeWithoutFiringEvents(size);\n    this.onSizeChange(oldSize, this.size);\n  }\n\n  /**\n   * Calculates the minimum size for the uncollapsed comment based on text\n   * size and visible icons.\n   *\n   * The minimum width is based on the width of the truncated preview text.\n   *\n   * The minimum height is based on the height of the top bar.\n   */\n  private calcMinSize(topBarSize: Size): Size {\n    this.updateTextPreview(this.commentEditor.getText() ?? '');\n    const textPreviewWidth = dom.getTextWidth(this.textPreview);\n\n    let width = textPreviewWidth;\n    if (this.foldoutButton.isVisible()) {\n      width += this.foldoutButton.getSize(true).getWidth();\n    } else if (textPreviewWidth) {\n      width += 4; // Arbitrary margin before text.\n    }\n    if (this.deleteButton.isVisible()) {\n      width += this.deleteButton.getSize(true).getWidth();\n    } else if (textPreviewWidth) {\n      width += 4; // Arbitrary margin after text.\n    }\n\n    // Arbitrary additional height.\n    const height = topBarSize.height + 20;\n\n    return new Size(width, height);\n  }\n\n  /** Updates the size of the highlight rect to reflect the new size. */\n  private updateHighlightRect(size: Size) {\n    this.highlightRect.setAttribute('height', `${size.height}`);\n    this.highlightRect.setAttribute('width', `${size.width}`);\n    if (this.workspace.RTL) {\n      this.highlightRect.setAttribute('x', `${-size.width}`);\n    }\n  }\n\n  /** Updates the size of the top bar to reflect the new size. */\n  private updateTopBarSize(size: Size) {\n    this.topBarBackground.setAttribute('width', `${size.width}`);\n  }\n\n  /**\n   * Updates the size and position of the text preview elements to reflect the new size.\n   */\n  private updateTextPreviewSize(\n    size: Size,\n    topBarSize: Size,\n    textPreviewSize: Size,\n  ) {\n    const textPreviewMargin = (topBarSize.height - textPreviewSize.height) / 2;\n    const foldoutSize = this.foldoutButton.getSize(true);\n    const deleteSize = this.deleteButton.getSize(true);\n\n    const textPreviewWidth =\n      size.width - foldoutSize.getWidth() - deleteSize.getWidth();\n    this.textPreview.setAttribute(\n      'x',\n      `${(this.workspace.RTL ? -1 : 1) * foldoutSize.getWidth()}`,\n    );\n    this.textPreview.setAttribute(\n      'y',\n      `${textPreviewMargin + textPreviewSize.height / 2}`,\n    );\n    this.textPreview.setAttribute('width', `${textPreviewWidth}`);\n  }\n\n  /** Updates the position of the resize handle to reflect the new size. */\n  private updateResizeHandlePosition(size: Size, resizeSize: Size) {\n    this.resizeHandle.setAttribute('y', `${size.height - resizeSize.height}`);\n    this.resizeHandle.setAttribute('x', `${size.width - resizeSize.width}`);\n  }\n\n  /**\n   * Triggers listeners when the size of the comment changes, either\n   * programmatically or manually by the user.\n   */\n  private onSizeChange(oldSize: Size, newSize: Size) {\n    // Loop through listeners backwards in case they remove themselves.\n    for (let i = this.sizeChangeListeners.length - 1; i >= 0; i--) {\n      this.sizeChangeListeners[i](oldSize, newSize);\n    }\n  }\n\n  /**\n   * Registers a callback that listens for size changes.\n   *\n   * @param listener Receives callbacks when the size of the comment changes.\n   *     The new and old size are in workspace units.\n   */\n  addSizeChangeListener(listener: (oldSize: Size, newSize: Size) => void) {\n    this.sizeChangeListeners.push(listener);\n  }\n\n  /** Removes the given listener from the list of size change listeners. */\n  removeSizeChangeListener(listener: () => void) {\n    this.sizeChangeListeners.splice(\n      this.sizeChangeListeners.indexOf(listener),\n      1,\n    );\n  }\n\n  /**\n   * Handles starting an interaction with the resize handle to resize the\n   * comment.\n   */\n  private onResizePointerDown(e: PointerEvent) {\n    if (!this.isEditable()) return;\n\n    this.bringToFront();\n    if (browserEvents.isRightButton(e)) {\n      e.stopPropagation();\n      return;\n    }\n\n    this.preResizeSize = this.getSize();\n\n    drag.start(\n      this.workspace,\n      e,\n      new Coordinate(\n        this.workspace.RTL ? -this.getSize().width : this.getSize().width,\n        this.getSize().height,\n      ),\n    );\n\n    this.resizePointerUpListener = browserEvents.conditionalBind(\n      document,\n      'pointerup',\n      this,\n      this.onResizePointerUp,\n    );\n    this.resizePointerMoveListener = browserEvents.conditionalBind(\n      document,\n      'pointermove',\n      this,\n      this.onResizePointerMove,\n    );\n\n    this.workspace.hideChaff();\n\n    e.stopPropagation();\n  }\n\n  /** Ends an interaction with the resize handle. */\n  private onResizePointerUp(_e: PointerEvent) {\n    touch.clearTouchIdentifier();\n    if (this.resizePointerUpListener) {\n      browserEvents.unbind(this.resizePointerUpListener);\n      this.resizePointerUpListener = null;\n    }\n    if (this.resizePointerMoveListener) {\n      browserEvents.unbind(this.resizePointerMoveListener);\n      this.resizePointerMoveListener = null;\n    }\n    // When ending a resize drag, notify size change listeners to fire an event.\n    this.setSize(this.size);\n    this.preResizeSize = undefined;\n  }\n\n  /** Resizes the comment in response to a drag on the resize handle. */\n  private onResizePointerMove(e: PointerEvent) {\n    const size = drag.move(this.workspace, e);\n    this.setSizeWithoutFiringEvents(\n      new Size(this.workspace.RTL ? -size.x : size.x, size.y),\n    );\n  }\n\n  /** Returns true if the comment is currently collapsed. */\n  isCollapsed(): boolean {\n    return this.collapsed;\n  }\n\n  /** Sets whether the comment is currently collapsed or not. */\n  setCollapsed(collapsed: boolean) {\n    this.collapsed = collapsed;\n    if (collapsed) {\n      dom.addClass(this.svgRoot, 'blocklyCollapsed');\n    } else {\n      dom.removeClass(this.svgRoot, 'blocklyCollapsed');\n    }\n    // Repositions resize handle and such.\n    this.setSizeWithoutFiringEvents(this.size);\n    this.onCollapse();\n  }\n\n  /**\n   * Triggers listeners when the collapsed-ness of the comment changes, either\n   * progrmatically or manually by the user.\n   */\n  private onCollapse() {\n    // Loop through listeners backwards in case they remove themselves.\n    for (let i = this.collapseChangeListeners.length - 1; i >= 0; i--) {\n      this.collapseChangeListeners[i](this.collapsed);\n    }\n  }\n\n  /** Registers a callback that listens for collapsed-ness changes. */\n  addOnCollapseListener(listener: (newCollapse: boolean) => void) {\n    this.collapseChangeListeners.push(listener);\n  }\n\n  /** Removes the given listener from the list of on collapse listeners. */\n  removeOnCollapseListener(listener: () => void) {\n    this.collapseChangeListeners.splice(\n      this.collapseChangeListeners.indexOf(listener),\n      1,\n    );\n  }\n\n  /** Returns true if the comment is currently editable. */\n  isEditable(): boolean {\n    return this.editable;\n  }\n\n  /** Sets the editability of the comment. */\n  setEditable(editable: boolean) {\n    this.editable = editable;\n    if (this.editable) {\n      dom.addClass(this.svgRoot, 'blocklyEditable');\n      dom.removeClass(this.svgRoot, 'blocklyReadonly');\n    } else {\n      dom.removeClass(this.svgRoot, 'blocklyEditable');\n      dom.addClass(this.svgRoot, 'blocklyReadonly');\n    }\n    this.commentEditor.setEditable(editable);\n  }\n\n  /** Returns the current location of the comment in workspace coordinates. */\n  getRelativeToSurfaceXY(): Coordinate {\n    return this.location;\n  }\n\n  /**\n   * Moves the comment view to the given location.\n   *\n   * @param location The location to move to in workspace coordinates.\n   */\n  moveTo(location: Coordinate) {\n    this.location = location;\n    this.svgRoot.setAttribute(\n      'transform',\n      `translate(${location.x}, ${location.y})`,\n    );\n  }\n\n  /** Returns the current text of the comment. */\n  getText() {\n    return this.commentEditor.getText();\n  }\n\n  /** Sets the current text of the comment. */\n  setText(text: string) {\n    this.commentEditor.setText(text);\n  }\n\n  /** Sets the placeholder text displayed for an empty comment. */\n  setPlaceholderText(text: string) {\n    this.commentEditor.setPlaceholderText(text);\n  }\n\n  /** Registers a callback that listens for text changes on the comment editor. */\n  addTextChangeListener(listener: (oldText: string, newText: string) => void) {\n    this.commentEditor.addTextChangeListener(listener);\n  }\n\n  /** Removes the given listener from the comment editor. */\n  removeTextChangeListener(listener: () => void) {\n    this.commentEditor.removeTextChangeListener(listener);\n  }\n\n  /** Updates the preview text element to reflect the given text. */\n  private updateTextPreview(text: string) {\n    this.textPreviewNode.textContent = this.truncateText(text);\n  }\n\n  /** Truncates the text to fit within the top view. */\n  private truncateText(text: string): string {\n    return text.length >= 12 ? `${text.substring(0, 9)}...` : text;\n  }\n\n  /** Brings the workspace comment to the front of its layer. */\n  bringToFront() {\n    const parent = this.svgRoot.parentNode;\n    const childNodes = parent!.childNodes;\n    // Avoid moving the comment if it's already at the bottom.\n    if (childNodes[childNodes.length - 1] !== this.svgRoot) {\n      parent!.appendChild(this.svgRoot);\n    }\n  }\n\n  /**\n   * Handles disposing of the comment when we get a pointer down event on the\n   * delete icon.\n   */\n  private onDeleteDown(e: PointerEvent) {\n    touch.clearTouchIdentifier();\n    if (browserEvents.isRightButton(e)) {\n      e.stopPropagation();\n      return;\n    }\n\n    this.dispose();\n    e.stopPropagation();\n  }\n\n  /** Disposes of this comment view. */\n  dispose() {\n    this.disposing = true;\n    dom.removeNode(this.svgRoot);\n    // Loop through listeners backwards in case they remove themselves.\n    for (let i = this.disposeListeners.length - 1; i >= 0; i--) {\n      this.disposeListeners[i]();\n    }\n    this.disposeListeners.length = 0;\n    this.disposed = true;\n  }\n\n  /** Returns whether this comment view has been disposed or not. */\n  isDisposed(): boolean {\n    return this.disposed;\n  }\n\n  /**\n   * Returns true if this comment view is currently being disposed or has\n   * already been disposed.\n   */\n  isDeadOrDying(): boolean {\n    return this.disposing || this.disposed;\n  }\n\n  /** Registers a callback that listens for disposal of this view. */\n  addDisposeListener(listener: () => void) {\n    this.disposeListeners.push(listener);\n  }\n\n  /** Removes the given listener from the list of disposal listeners. */\n  removeDisposeListener(listener: () => void) {\n    this.disposeListeners.splice(this.disposeListeners.indexOf(listener), 1);\n  }\n\n  /**\n   * @internal\n   */\n  getCommentBarButtons(): CommentBarButton[] {\n    return [this.foldoutButton, this.deleteButton];\n  }\n}\n\ncss.register(`\n.injectionDiv {\n  --commentFillColour: #FFFCC7;\n  --commentBorderColour: #F2E49B;\n}\n\n.blocklyComment .blocklyTextarea {\n  background-color: var(--commentFillColour);\n  border: 1px solid var(--commentBorderColour);\n  box-sizing: border-box;\n  display: block;\n  outline: 0;\n  padding: 5px;\n  resize: none;\n  width: 100%;\n  height: 100%;\n}\n\n.blocklyReadonly.blocklyComment .blocklyTextarea {\n  cursor: inherit;\n}\n\n.blocklyDeleteIcon {\n  width: 20px;\n  height: 20px;\n  display: none;\n  cursor: pointer;\n}\n\n.blocklyFoldoutIcon {\n  width: 20px;\n  height: 20px;\n  transform-origin: 12px 12px;\n  cursor: pointer;\n}\n.blocklyResizeHandle {\n  width: 12px;\n  height: 12px;\n  cursor: se-resize;\n}\n.blocklyReadonly.blocklyComment .blocklyResizeHandle {\n  cursor: inherit;\n}\n\n.blocklyCommentTopbarBackground {\n  fill: var(--commentBorderColour);\n  height: 24px;\n}\n\n.blocklyComment .blocklyCommentPreview.blocklyText {\n  fill: #000;\n  dominant-baseline: middle;\n  visibility: hidden;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentPreview {\n  visibility: visible;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,\n.blocklyCollapsed.blocklyComment .blocklyResizeHandle {\n  display: none;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {\n  transform: rotate(-90deg);\n}\n\n.blocklyRTL .blocklyCommentTopbar {\n  transform: scale(-1, 1);\n}\n\n.blocklyRTL .blocklyCommentForeignObject {\n  direction: rtl;\n}\n\n.blocklyRTL .blocklyCommentPreview {\n  /* Revert the scale and control RTL using direction instead. */\n  transform: scale(-1, 1);\n  direction: rtl;\n}\n\n.blocklyRTL .blocklyResizeHandle {\n  transform: scale(-1, 1);\n  cursor: sw-resize;\n}\n\n.blocklyCommentHighlight {\n  fill: none;\n}\n\n.blocklyCommentText.blocklyActiveFocus {\n  border-color: #fc3;\n  border-width: 2px;\n}\n\n.blocklySelected .blocklyCommentHighlight {\n  stroke: #fc3;\n  stroke-width: 3px;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentHighlight {\n  stroke: none;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentTopbarBackground {\n  stroke: #fc3;\n  stroke-width: 3px;\n}\n`);\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CommentMove} from '../events/events_comment_move.js';\nimport {CommentResize} from '../events/events_comment_resize.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport * as idGenerator from '../utils/idgenerator.js';\nimport {Size} from '../utils/size.js';\nimport {Workspace} from '../workspace.js';\nimport {CommentView} from './comment_view.js';\n\nexport class WorkspaceComment {\n  /** The unique identifier for this comment. */\n  public readonly id: string;\n\n  /** The text of the comment. */\n  private text = '';\n\n  /** The size of the comment in workspace units. */\n  private size: Size;\n\n  /** Whether the comment is collapsed or not. */\n  private collapsed = false;\n\n  /** Whether the comment is editable or not. */\n  private editable = true;\n\n  /** Whether the comment is movable or not. */\n  private movable = true;\n\n  /** Whether the comment is deletable or not. */\n  private deletable = true;\n\n  /** The location of the comment in workspace coordinates. */\n  protected location = new Coordinate(0, 0);\n\n  /** Whether this comment has been disposed or not. */\n  protected disposed = false;\n\n  /** Whether this comment is being disposed or not. */\n  protected disposing = false;\n\n  /**\n   * Constructs the comment.\n   *\n   * @param workspace The workspace to construct the comment in.\n   * @param id An optional ID to give to the comment. If not provided, one will\n   *     be generated.\n   */\n  constructor(\n    public readonly workspace: Workspace,\n    id?: string,\n  ) {\n    this.id = id && !workspace.getCommentById(id) ? id : idGenerator.genUid();\n    this.size = CommentView.defaultCommentSize;\n\n    workspace.addTopComment(this);\n\n    this.fireCreateEvent();\n  }\n\n  private fireCreateEvent() {\n    if (eventUtils.isEnabled()) {\n      eventUtils.fire(new (eventUtils.get(EventType.COMMENT_CREATE))(this));\n    }\n  }\n\n  private fireDeleteEvent() {\n    if (eventUtils.isEnabled()) {\n      eventUtils.fire(new (eventUtils.get(EventType.COMMENT_DELETE))(this));\n    }\n  }\n\n  /** Fires a comment change event. */\n  private fireChangeEvent(oldText: string, newText: string) {\n    if (eventUtils.isEnabled()) {\n      eventUtils.fire(\n        new (eventUtils.get(EventType.COMMENT_CHANGE))(this, oldText, newText),\n      );\n    }\n  }\n\n  /** Fires a comment collapse event. */\n  private fireCollapseEvent(newCollapsed: boolean) {\n    if (eventUtils.isEnabled()) {\n      eventUtils.fire(\n        new (eventUtils.get(EventType.COMMENT_COLLAPSE))(this, newCollapsed),\n      );\n    }\n  }\n\n  /** Sets the text of the comment. */\n  setText(text: string) {\n    const oldText = this.text;\n    this.text = text;\n    this.fireChangeEvent(oldText, text);\n  }\n\n  /** Returns the text of the comment. */\n  getText(): string {\n    return this.text;\n  }\n\n  /** Sets the comment's size in workspace units. */\n  setSize(size: Size) {\n    const event = new (eventUtils.get(EventType.COMMENT_RESIZE))(\n      this,\n    ) as CommentResize;\n\n    this.size = size;\n\n    event.recordCurrentSizeAsNewSize();\n    eventUtils.fire(event);\n  }\n\n  /** Returns the comment's size in workspace units. */\n  getSize(): Size {\n    return this.size;\n  }\n\n  /** Sets whether the comment is collapsed or not. */\n  setCollapsed(collapsed: boolean) {\n    this.collapsed = collapsed;\n    this.fireCollapseEvent(collapsed);\n  }\n\n  /** Returns whether the comment is collapsed or not. */\n  isCollapsed(): boolean {\n    return this.collapsed;\n  }\n\n  /** Sets whether the comment is editable or not. */\n  setEditable(editable: boolean) {\n    this.editable = editable;\n  }\n\n  /**\n   * Returns whether the comment is editable or not, respecting whether the\n   * workspace is read-only.\n   */\n  isEditable(): boolean {\n    return this.isOwnEditable() && !this.workspace.isReadOnly();\n  }\n\n  /**\n   * Returns whether the comment is editable or not, only examining its own\n   * state and ignoring the state of the workspace.\n   */\n  isOwnEditable(): boolean {\n    return this.editable;\n  }\n\n  /** Sets whether the comment is movable or not. */\n  setMovable(movable: boolean) {\n    this.movable = movable;\n  }\n\n  /**\n   * Returns whether the comment is movable or not, respecting whether the\n   * workspace is read-only.\n   */\n  isMovable() {\n    return (\n      this.isOwnMovable() &&\n      !this.workspace.isReadOnly() &&\n      !this.workspace.isFlyout\n    );\n  }\n\n  /**\n   * Returns whether the comment is movable or not, only examining its own\n   * state and ignoring the state of the workspace.\n   */\n  isOwnMovable() {\n    return this.movable;\n  }\n\n  /** Sets whether the comment is deletable or not. */\n  setDeletable(deletable: boolean) {\n    this.deletable = deletable;\n  }\n\n  /**\n   * Returns whether the comment is deletable or not, respecting whether the\n   * workspace is read-only.\n   */\n  isDeletable(): boolean {\n    return (\n      this.isOwnDeletable() &&\n      !this.isDeadOrDying() &&\n      !this.workspace.isReadOnly() &&\n      !this.workspace.isFlyout\n    );\n  }\n\n  /**\n   * Returns whether the comment is deletable or not, only examining its own\n   * state and ignoring the state of the workspace.\n   */\n  isOwnDeletable(): boolean {\n    return this.deletable;\n  }\n\n  /** Moves the comment to the given location in workspace coordinates. */\n  moveTo(location: Coordinate, reason?: string[] | undefined) {\n    const event = new (eventUtils.get(EventType.COMMENT_MOVE))(\n      this,\n    ) as CommentMove;\n    if (reason) event.setReason(reason);\n\n    this.location = location;\n\n    event.recordNew();\n    eventUtils.fire(event);\n  }\n\n  /** Returns the position of the comment in workspace coordinates. */\n  getRelativeToSurfaceXY(): Coordinate {\n    return this.location;\n  }\n\n  /** Disposes of this comment. */\n  dispose() {\n    this.disposing = true;\n    this.fireDeleteEvent();\n    this.workspace.removeTopComment(this);\n    this.disposed = true;\n  }\n\n  /** Returns whether the comment has been disposed or not. */\n  isDisposed() {\n    return this.disposed;\n  }\n\n  /**\n   * Returns true if this comment view is currently being disposed or has\n   * already been disposed.\n   */\n  isDeadOrDying(): boolean {\n    return this.disposing || this.disposed;\n  }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as browserEvents from '../browser_events.js';\nimport {\n  WorkspaceCommentCopyData,\n  WorkspaceCommentPaster,\n} from '../clipboard/workspace_comment_paster.js';\nimport * as common from '../common.js';\nimport * as contextMenu from '../contextmenu.js';\nimport {ContextMenuRegistry} from '../contextmenu_registry.js';\nimport {CommentDragStrategy} from '../dragging/comment_drag_strategy.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {IBoundedElement} from '../interfaces/i_bounded_element.js';\nimport {IContextMenu} from '../interfaces/i_contextmenu.js';\nimport {ICopyable} from '../interfaces/i_copyable.js';\nimport {IDeletable} from '../interfaces/i_deletable.js';\nimport {IDraggable} from '../interfaces/i_draggable.js';\nimport {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from '../interfaces/i_focusable_tree.js';\nimport {IRenderedElement} from '../interfaces/i_rendered_element.js';\nimport {ISelectable} from '../interfaces/i_selectable.js';\nimport * as layers from '../layers.js';\nimport * as commentSerialization from '../serialization/workspace_comments.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport * as dom from '../utils/dom.js';\nimport {Rect} from '../utils/rect.js';\nimport {Size} from '../utils/size.js';\nimport * as svgMath from '../utils/svg_math.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\nimport {CommentView} from './comment_view.js';\nimport {WorkspaceComment} from './workspace_comment.js';\n\nexport class RenderedWorkspaceComment\n  extends WorkspaceComment\n  implements\n    IBoundedElement,\n    IRenderedElement,\n    IDraggable,\n    ISelectable,\n    IDeletable,\n    ICopyable<WorkspaceCommentCopyData>,\n    IContextMenu,\n    IFocusableNode\n{\n  /** The class encompassing the svg elements making up the workspace comment. */\n  view: CommentView;\n\n  public readonly workspace: WorkspaceSvg;\n\n  private dragStrategy = new CommentDragStrategy(this);\n\n  /** Constructs the workspace comment, including the view. */\n  constructor(workspace: WorkspaceSvg, id?: string) {\n    super(workspace, id);\n\n    this.workspace = workspace;\n\n    this.view = new CommentView(workspace, this.id);\n    // Set the size to the default size as defined in the superclass.\n    this.view.setSize(this.getSize());\n    this.view.setEditable(this.isEditable());\n    this.view.getSvgRoot().setAttribute('data-id', this.id);\n    this.view.getSvgRoot().setAttribute('id', this.id);\n\n    this.addModelUpdateBindings();\n\n    browserEvents.conditionalBind(\n      this.view.getSvgRoot(),\n      'pointerdown',\n      this,\n      this.startGesture,\n    );\n  }\n\n  /**\n   * Adds listeners to the view that updates the model (i.e. the superclass)\n   * when changes are made to the view.\n   */\n  private addModelUpdateBindings() {\n    this.view.addTextChangeListener(\n      (_, newText: string) => void super.setText(newText),\n    );\n    this.view.addSizeChangeListener(\n      (_, newSize: Size) => void super.setSize(newSize),\n    );\n    this.view.addOnCollapseListener(\n      () => void super.setCollapsed(this.view.isCollapsed()),\n    );\n    this.view.addDisposeListener(() => {\n      if (!this.isDeadOrDying()) this.dispose();\n    });\n  }\n\n  /** Sets the text of the comment. */\n  override setText(text: string): void {\n    // setText will trigger the change listener that updates\n    // the model aka superclass.\n    this.view.setText(text);\n  }\n\n  /** Sets the placeholder text displayed if the comment is empty. */\n  setPlaceholderText(text: string): void {\n    this.view.setPlaceholderText(text);\n  }\n\n  /** Sets the size of the comment. */\n  override setSize(size: Size) {\n    // setSize will trigger the change listener that updates\n    // the model aka superclass.\n    this.view.setSize(size);\n  }\n\n  /** Sets whether the comment is collapsed or not. */\n  override setCollapsed(collapsed: boolean) {\n    // setCollapsed will trigger the change listener that updates\n    // the model aka superclass.\n    this.view.setCollapsed(collapsed);\n  }\n\n  /** Sets whether the comment is editable or not. */\n  override setEditable(editable: boolean): void {\n    super.setEditable(editable);\n    // Use isEditable rather than isOwnEditable to account for workspace state.\n    this.view.setEditable(this.isEditable());\n  }\n\n  /** Returns the root SVG element of this comment. */\n  getSvgRoot(): SVGElement {\n    return this.view.getSvgRoot();\n  }\n\n  /**\n   * Returns the comment's size in workspace units.\n   * Does not respect collapsing.\n   */\n  getSize(): Size {\n    return super.getSize();\n  }\n\n  /**\n   * Returns the bounding rectangle of this comment in workspace coordinates.\n   * Respects collapsing.\n   */\n  getBoundingRectangle(): Rect {\n    const loc = this.getRelativeToSurfaceXY();\n    const size = this.view?.getSize() ?? this.getSize();\n    let left;\n    let right;\n    if (this.workspace.RTL) {\n      left = loc.x - size.width;\n      right = loc.x;\n    } else {\n      left = loc.x;\n      right = loc.x + size.width;\n    }\n    return new Rect(loc.y, loc.y + size.height, left, right);\n  }\n\n  /** Move the comment by the given amounts in workspace coordinates. */\n  moveBy(dx: number, dy: number, reason?: string[] | undefined): void {\n    const loc = this.getRelativeToSurfaceXY();\n    const newLoc = new Coordinate(loc.x + dx, loc.y + dy);\n    this.moveTo(newLoc, reason);\n  }\n\n  /** Moves the comment to the given location in workspace coordinates. */\n  override moveTo(location: Coordinate, reason?: string[] | undefined): void {\n    super.moveTo(location, reason);\n    this.view.moveTo(location);\n  }\n\n  /**\n   * Moves the comment during a drag. Doesn't fire move events.\n   *\n   * @internal\n   */\n  moveDuringDrag(location: Coordinate): void {\n    this.location = location;\n    this.view.moveTo(location);\n  }\n\n  /**\n   * Adds the dragging CSS class to this comment.\n   *\n   * @internal\n   */\n  setDragging(dragging: boolean): void {\n    if (dragging) {\n      dom.addClass(this.getSvgRoot(), 'blocklyDragging');\n    } else {\n      dom.removeClass(this.getSvgRoot(), 'blocklyDragging');\n    }\n  }\n\n  /** Disposes of the view. */\n  override dispose() {\n    this.disposing = true;\n    const focusManager = getFocusManager();\n    if (focusManager.getFocusedNode() === this) {\n      setTimeout(() => focusManager.focusTree(this.workspace), 0);\n    }\n    if (!this.view.isDeadOrDying()) this.view.dispose();\n\n    super.dispose();\n  }\n\n  /**\n   * Starts a gesture because we detected a pointer down on the comment\n   * (that wasn't otherwise gobbled up, e.g. by resizing).\n   */\n  private startGesture(e: PointerEvent) {\n    const gesture = this.workspace.getGesture(e);\n    if (gesture) {\n      gesture.handleCommentStart(e, this);\n      getFocusManager().focusNode(this);\n    }\n  }\n\n  /** Visually indicates that this comment would be deleted if dropped. */\n  setDeleteStyle(wouldDelete: boolean): void {\n    if (wouldDelete) {\n      dom.addClass(this.getSvgRoot(), 'blocklyDraggingDelete');\n    } else {\n      dom.removeClass(this.getSvgRoot(), 'blocklyDraggingDelete');\n    }\n  }\n\n  /** Returns whether this comment is copyable or not */\n  isCopyable(): boolean {\n    return this.isOwnMovable() && this.isOwnDeletable();\n  }\n\n  /** Returns whether this comment is movable or not. */\n  isMovable(): boolean {\n    return this.dragStrategy.isMovable();\n  }\n\n  /** Starts a drag on the comment. */\n  startDrag(): void {\n    this.dragStrategy.startDrag();\n  }\n\n  /** Drags the comment to the given location. */\n  drag(newLoc: Coordinate): void {\n    this.dragStrategy.drag(newLoc);\n  }\n\n  /** Ends the drag on the comment. */\n  endDrag(): void {\n    this.dragStrategy.endDrag();\n  }\n\n  /** Moves the comment back to where it was at the start of a drag. */\n  revertDrag(): void {\n    this.dragStrategy.revertDrag();\n  }\n\n  /** Visually highlights the comment. */\n  select(): void {\n    dom.addClass(this.getSvgRoot(), 'blocklySelected');\n    common.fireSelectedEvent(this);\n  }\n\n  /** Visually unhighlights the comment. */\n  unselect(): void {\n    dom.removeClass(this.getSvgRoot(), 'blocklySelected');\n    common.fireSelectedEvent(null);\n  }\n\n  /**\n   * Returns a JSON serializable representation of this comment's state that\n   * can be used for pasting.\n   */\n  toCopyData(): WorkspaceCommentCopyData | null {\n    return {\n      paster: WorkspaceCommentPaster.TYPE,\n      commentState: commentSerialization.save(this, {\n        addCoordinates: true,\n        saveIds: false,\n      }),\n    };\n  }\n\n  /** Show a context menu for this comment. */\n  showContextMenu(e: Event): void {\n    const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(\n      {comment: this, focusedNode: this},\n      e,\n    );\n\n    let location: Coordinate;\n    if (e instanceof PointerEvent) {\n      location = new Coordinate(e.clientX, e.clientY);\n    } else {\n      // Show the menu based on the location of the comment\n      const xy = svgMath.wsToScreenCoordinates(\n        this.workspace,\n        this.getRelativeToSurfaceXY(),\n      );\n      location = xy.translate(10, 10);\n    }\n\n    contextMenu.show(\n      e,\n      menuOptions,\n      this.workspace.RTL,\n      this.workspace,\n      location,\n    );\n  }\n\n  /** Snap this comment to the nearest grid point. */\n  snapToGrid(): void {\n    if (this.isDeadOrDying()) return;\n    const grid = this.workspace.getGrid();\n    if (!grid?.shouldSnap()) return;\n    const currentXY = this.getRelativeToSurfaceXY();\n    const alignedXY = grid.alignXY(currentXY);\n    if (alignedXY !== currentXY) {\n      this.moveTo(alignedXY, ['snap']);\n    }\n  }\n\n  /**\n   * @returns The FocusableNode representing the editor portion of this comment.\n   */\n  getEditorFocusableNode(): IFocusableNode {\n    return this.view.getEditorFocusableNode();\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    return this.getSvgRoot();\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this.workspace;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {\n    this.select();\n    // Ensure that the comment is always at the top when focused.\n    this.workspace.getLayerManager()?.append(this, layers.BLOCK);\n    this.workspace.scrollBoundsIntoView(this.getBoundingRectangle());\n  }\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {\n    this.unselect();\n  }\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\n}\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 */\n// Former goog.module ID: 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 utilsXml from '../utils/xml.js';\nimport {Workspace} from '../workspace.js';\nimport * as Xml from '../xml.js';\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport {EventType} from './type.js';\nimport * as eventUtils from './utils.js';\n\n/**\n * Notifies listeners when a block (or connected stack of blocks) is\n * created.\n */\nexport class BlockCreate extends BlockBase {\n  override type = EventType.BLOCK_CREATE;\n\n  /** The XML representation of the created block(s). */\n  xml?: Element | DocumentFragment;\n\n  /** The JSON respresentation of the created block(s). */\n  json?: blocks.State;\n\n  /** All of the IDs of created blocks. */\n  ids?: string[];\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    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    }\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    }\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    }\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   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BlockCreate, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: BlockCreateJson,\n    workspace: Workspace,\n    event?: any,\n  ): BlockCreate {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BlockCreate(),\n    ) as BlockCreate;\n    newEvent.xml = utilsXml.textToDom(json['xml']);\n    newEvent.ids = json['ids'];\n    newEvent.json = json['json'] as blocks.State;\n    if (json['recordUndo'] !== undefined) {\n      newEvent.recordUndo = json['recordUndo'];\n    }\n    return newEvent;\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    }\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    }\n    if (allShadowBlocks(workspace, this.ids)) return;\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/**\n * Returns true if all blocks in the list are shadow blocks. If so, that means\n * the top-level block being created is a shadow block. This only happens when a\n * block that was covering up a shadow block is removed. We don't need to create\n * an additional block in that case because the original block still has its\n * shadow block.\n *\n * @param workspace Workspace to check for blocks\n * @param ids A list of block ids that were created in this event\n * @returns True if all block ids in the list are shadow blocks\n */\nconst allShadowBlocks = function (\n  workspace: Workspace,\n  ids: string[],\n): boolean {\n  const shadows = ids\n    .map((id) => workspace.getBlockById(id))\n    .filter((block) => block && block.isShadow());\n  return shadows.length === ids.length;\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, EventType.BLOCK_CREATE, BlockCreate);\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 */\n// Former goog.module ID: Blockly.Events.ThemeChange\n\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that the workspace theme has changed.\n */\nexport class ThemeChange extends UiBase {\n  /** The name of the new theme that has been set. */\n  themeName?: string;\n\n  override type = EventType.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    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    }\n    json['themeName'] = this.themeName;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of ThemeChange, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: ThemeChangeJson,\n    workspace: Workspace,\n    event?: any,\n  ): ThemeChange {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new ThemeChange(),\n    ) as ThemeChange;\n    newEvent.themeName = json['themeName'];\n    return newEvent;\n  }\n}\n\nexport interface ThemeChangeJson extends AbstractEventJson {\n  themeName: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.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 */\n// Former goog.module ID: Blockly.Events.ViewportChange\n\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that the workspace surface's position or scale has\n * changed.\n *\n * Does not notify when the workspace itself resizes.\n */\nexport class ViewportChange extends UiBase {\n  /**\n   * Top edge of the visible portion of the workspace, relative to the\n   * workspace origin.\n   */\n  viewTop?: number;\n\n  /**\n   * The left edge of the visible portion of the workspace, relative to\n   * the workspace origin.\n   */\n  viewLeft?: number;\n\n  /** The scale of the workpace. */\n  scale?: number;\n\n  /** The previous scale of the workspace. */\n  oldScale?: number;\n\n  override type = EventType.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,\n    opt_left?: number,\n    opt_scale?: number,\n    opt_workspaceId?: string,\n    opt_oldScale?: number,\n  ) {\n    super(opt_workspaceId);\n\n    this.viewTop = opt_top;\n    this.viewLeft = opt_left;\n    this.scale = opt_scale;\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    }\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    }\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    }\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    }\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   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of Viewport, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: ViewportChangeJson,\n    workspace: Workspace,\n    event?: any,\n  ): ViewportChange {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new ViewportChange(),\n    ) as ViewportChange;\n    newEvent.viewTop = json['viewTop'];\n    newEvent.viewLeft = json['viewLeft'];\n    newEvent.scale = json['scale'];\n    newEvent.oldScale = json['oldScale'];\n    return newEvent;\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,\n  EventType.VIEWPORT_CHANGE,\n  ViewportChange,\n);\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 */\n// Former goog.module ID: Blockly.Theme\n\nimport * as registry from './registry.js';\nimport * as object from './utils/object.js';\n\nexport interface ITheme {\n  blockStyles?: {[key: string]: Partial<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 */\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,\n    opt_blockStyles?: {[key: string]: Partial<BlockStyle>},\n    opt_categoryStyles?: {[key: string]: CategoryStyle},\n    opt_componentStyles?: ComponentStyle,\n  ) {\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, true);\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) {\n      return null;\n    }\n    if (typeof style === 'string') {\n      const recursiveStyle = this.getComponentStyle(style);\n      if (recursiveStyle) {\n        return recursiveStyle;\n      }\n    }\n    return `${style}`;\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// Former goog.module ID: Blockly.Themes.Classic\n\nimport {Theme} from '../theme.js';\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 */\nexport const Classic = new Theme('classic', defaultBlockStyles, 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 */\n// Former goog.module ID: Blockly.Options\n\nimport type {BlocklyOptions} from './blockly_options.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 * Parse the user-specified options, using reasonable defaults where behaviour\n * is unspecified.\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  modalInputs: boolean;\n  pathToMedia: string;\n  hasCategories: boolean;\n  moveOptions: MoveOptions;\n  /** @deprecated  January 2019 */\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 = toolbox.convertToolboxDefToJson(\n        options['toolbox'] ?? null,\n      );\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 = toolboxAtStart\n        ? toolbox.Position.TOP\n        : toolbox.Position.BOTTOM;\n    } else {\n      toolboxPosition =\n        toolboxAtStart === rtl ? toolbox.Position.RIGHT : 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('/')\n        ? options['media']\n        : options['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    let modalInputs = options['modalInputs'];\n    if (modalInputs === undefined) {\n      modalInputs = true;\n    }\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.modalInputs = modalInputs;\n    this.pathToMedia = pathToMedia;\n    this.hasCategories = hasCategories;\n    this.moveOptions = Options.parseMoveOptions(options, hasCategories);\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,\n    hasCategories: boolean,\n  ): MoveOptions {\n    const move = options['move'] || {};\n    const moveOptions = {} as MoveOptions;\n    if (\n      move['scrollbars'] === undefined &&\n      options['scrollbars'] === undefined\n    ) {\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 (\n        moveOptions.scrollbars.horizontal &&\n        moveOptions.scrollbars.vertical\n      ) {\n        moveOptions.scrollbars = true;\n      } else if (\n        !moveOptions.scrollbars.horizontal &&\n        !moveOptions.scrollbars.vertical\n      ) {\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(),\n      theme,\n    );\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 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {IBubble, WorkspaceSvg} from '../blockly.js';\nimport {IDragStrategy} from '../interfaces/i_draggable.js';\nimport * as layers from '../layers.js';\nimport {Coordinate} from '../utils.js';\n\nexport class BubbleDragStrategy implements IDragStrategy {\n  private startLoc: Coordinate | null = null;\n\n  constructor(\n    private bubble: IBubble,\n    private workspace: WorkspaceSvg,\n  ) {}\n\n  isMovable(): boolean {\n    return true;\n  }\n\n  startDrag(): void {\n    this.startLoc = this.bubble.getRelativeToSurfaceXY();\n    this.workspace.setResizesEnabled(false);\n    this.workspace.getLayerManager()?.moveToDragLayer(this.bubble);\n    if (this.bubble.setDragging) {\n      this.bubble.setDragging(true);\n    }\n  }\n\n  drag(newLoc: Coordinate): void {\n    this.bubble.moveDuringDrag(newLoc);\n  }\n\n  endDrag(): void {\n    this.workspace.setResizesEnabled(true);\n\n    this.workspace\n      .getLayerManager()\n      ?.moveOffDragLayer(this.bubble, layers.BUBBLE);\n    this.bubble.setDragging(false);\n  }\n\n  revertDrag(): void {\n    if (this.startLoc) this.bubble.moveDuringDrag(this.startLoc);\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as browserEvents from '../browser_events.js';\nimport * as common from '../common.js';\nimport {BubbleDragStrategy} from '../dragging/bubble_drag_strategy.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {IBubble} from '../interfaces/i_bubble.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from '../interfaces/i_focusable_tree.js';\nimport type {IHasBubble} from '../interfaces/i_has_bubble.js';\nimport {ISelectable} from '../interfaces/i_selectable.js';\nimport {ContainerRegion} from '../metrics_manager.js';\nimport {Scrollbar} from '../scrollbar.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport * as dom from '../utils/dom.js';\nimport * as idGenerator from '../utils/idgenerator.js';\nimport * as math from '../utils/math.js';\nimport {Rect} from '../utils/rect.js';\nimport {Size} from '../utils/size.js';\nimport {Svg} from '../utils/svg.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\n/**\n * The abstract pop-up bubble class. This creates a UI that looks like a speech\n * bubble, where it has a \"tail\" that points to the block, and a \"head\" that\n * displays arbitrary svg elements.\n */\nexport abstract class Bubble implements IBubble, ISelectable, IFocusableNode {\n  /** The width of the border around the bubble. */\n  static readonly BORDER_WIDTH = 6;\n\n  /** Double the width of the border around the bubble. */\n  static readonly DOUBLE_BORDER = this.BORDER_WIDTH * 2;\n\n  /** The minimum size the bubble can have. */\n  static readonly MIN_SIZE = this.DOUBLE_BORDER;\n\n  /**\n   * The thickness of the base of the tail in relation to the size of the\n   * bubble. Higher numbers result in thinner tails.\n   */\n  static readonly TAIL_THICKNESS = 1;\n\n  /** The number of degrees that the tail bends counter-clockwise. */\n  static readonly TAIL_ANGLE = 20;\n\n  /**\n   * The sharpness of the tail's bend. Higher numbers result in smoother\n   * tails.\n   */\n  static readonly TAIL_BEND = 4;\n\n  /** Distance between arrow point and anchor point. */\n  static readonly ANCHOR_RADIUS = 8;\n\n  public id: string;\n\n  /** The SVG group containing all parts of the bubble. */\n  protected svgRoot: SVGGElement;\n\n  /** The SVG path for the arrow from the anchor to the bubble. */\n  private tail: SVGPathElement;\n\n  /** The SVG background rect for the main body of the bubble. */\n  private background: SVGRectElement;\n\n  /** The SVG group containing the contents of the bubble. */\n  protected contentContainer: SVGGElement;\n\n  /**\n   * The size of the bubble (including background and contents but not tail).\n   */\n  private size = new Size(0, 0);\n\n  /** The colour of the background of the bubble. */\n  private colour = '#ffffff';\n\n  /** True if the bubble has been disposed, false otherwise. */\n  public disposed = false;\n\n  /** The position of the top of the bubble relative to its anchor. */\n  private relativeTop = 0;\n\n  /** The position of the left of the bubble realtive to its anchor. */\n  private relativeLeft = 0;\n\n  private dragStrategy = new BubbleDragStrategy(this, this.workspace);\n\n  private focusableElement: SVGElement | HTMLElement;\n\n  /**\n   * @param workspace The workspace this bubble belongs to.\n   * @param anchor The anchor location of the thing this bubble is attached to.\n   *     The tail of the bubble will point to this location.\n   * @param ownerRect An optional rect we don't want the bubble to overlap with\n   *     when automatically positioning.\n   * @param overriddenFocusableElement An optional replacement to the focusable\n   *     element that's represented by this bubble (as a focusable node). This\n   *     element will have its ID overwritten. If not provided, the focusable\n   *     element of this node will default to the bubble's SVG root.\n   * @param owner The object responsible for hosting/spawning this bubble.\n   */\n  constructor(\n    public readonly workspace: WorkspaceSvg,\n    protected anchor: Coordinate,\n    protected ownerRect?: Rect,\n    overriddenFocusableElement?: SVGElement | HTMLElement,\n    protected owner?: IHasBubble & IFocusableNode,\n  ) {\n    this.id = idGenerator.getNextUniqueId();\n    this.svgRoot = dom.createSvgElement(\n      Svg.G,\n      {'class': 'blocklyBubble'},\n      workspace.getBubbleCanvas(),\n    );\n    const embossGroup = dom.createSvgElement(\n      Svg.G,\n      {'class': 'blocklyEmboss'},\n      this.svgRoot,\n    );\n    this.tail = dom.createSvgElement(\n      Svg.PATH,\n      {'class': 'blocklyBubbleTail'},\n      embossGroup,\n    );\n    this.background = dom.createSvgElement(\n      Svg.RECT,\n      {\n        'class': 'blocklyDraggable',\n        'x': 0,\n        'y': 0,\n        'rx': Bubble.BORDER_WIDTH,\n        'ry': Bubble.BORDER_WIDTH,\n      },\n      embossGroup,\n    );\n    this.contentContainer = dom.createSvgElement(Svg.G, {}, this.svgRoot);\n\n    this.focusableElement = overriddenFocusableElement ?? this.svgRoot;\n    this.focusableElement.setAttribute('id', this.id);\n\n    browserEvents.conditionalBind(\n      this.background,\n      'pointerdown',\n      this,\n      this.onMouseDown,\n    );\n\n    browserEvents.conditionalBind(\n      this.focusableElement,\n      'keydown',\n      this,\n      this.onKeyDown,\n    );\n  }\n\n  /** Dispose of this bubble. */\n  dispose() {\n    dom.removeNode(this.svgRoot);\n    this.disposed = true;\n  }\n\n  /**\n   * Set the location the tail of this bubble points to.\n   *\n   * @param anchor The location the tail of this bubble points to.\n   * @param relayout If true, reposition the bubble from scratch so that it is\n   *     optimally visible. If false, reposition it so it maintains the same\n   *     position relative to the anchor.\n   */\n  setAnchorLocation(anchor: Coordinate, relayout = false) {\n    this.anchor = anchor;\n    if (relayout) {\n      this.positionByRect(this.ownerRect);\n    } else {\n      this.positionRelativeToAnchor();\n    }\n    this.renderTail();\n  }\n\n  /** Sets the position of this bubble relative to its anchor. */\n  setPositionRelativeToAnchor(left: number, top: number) {\n    this.relativeLeft = left;\n    this.relativeTop = top;\n    this.positionRelativeToAnchor();\n    this.renderTail();\n  }\n\n  /** @returns the size of this bubble. */\n  protected getSize() {\n    return this.size;\n  }\n\n  /**\n   * Sets the size of this bubble, including the border.\n   *\n   * @param size Sets the size of this bubble, including the border.\n   * @param relayout If true, reposition the bubble from scratch so that it is\n   *     optimally visible. If false, reposition it so it maintains the same\n   *     position relative to the anchor.\n   */\n  protected setSize(size: Size, relayout = false) {\n    size.width = Math.max(size.width, Bubble.MIN_SIZE);\n    size.height = Math.max(size.height, Bubble.MIN_SIZE);\n    this.size = size;\n\n    this.background.setAttribute('width', `${size.width}`);\n    this.background.setAttribute('height', `${size.height}`);\n\n    if (relayout) {\n      this.positionByRect(this.ownerRect);\n    } else {\n      this.positionRelativeToAnchor();\n    }\n    this.renderTail();\n  }\n\n  /** Returns the colour of the background and tail of this bubble. */\n  protected getColour(): string {\n    return this.colour;\n  }\n\n  /** Sets the colour of the background and tail of this bubble. */\n  public setColour(colour: string) {\n    this.colour = colour;\n    this.tail.setAttribute('fill', colour);\n    this.background.setAttribute('fill', colour);\n  }\n\n  /**\n   * Passes the pointer event off to the gesture system and ensures the bubble\n   * is focused.\n   */\n  private onMouseDown(e: PointerEvent) {\n    this.workspace.getGesture(e)?.handleBubbleStart(e, this);\n    getFocusManager().focusNode(this);\n  }\n\n  /**\n   * Handles key events when this bubble is focused. By default, closes the\n   * bubble on Escape.\n   *\n   * @param e The keyboard event to handle.\n   */\n  protected onKeyDown(e: KeyboardEvent) {\n    if (e.key === 'Escape' && this.owner) {\n      this.owner.setBubbleVisible(false);\n      getFocusManager().focusNode(this.owner);\n    }\n  }\n\n  /** Positions the bubble relative to its anchor. Does not render its tail. */\n  protected positionRelativeToAnchor() {\n    let left = this.anchor.x;\n    if (this.workspace.RTL) {\n      left -= this.relativeLeft + this.size.width;\n    } else {\n      left += this.relativeLeft;\n    }\n    const top = this.relativeTop + this.anchor.y;\n    this.moveTo(left, top);\n  }\n\n  /**\n   * Moves the bubble to the given coordinates.\n   *\n   * @internal\n   */\n  moveTo(x: number, y: number) {\n    this.svgRoot.setAttribute('transform', `translate(${x}, ${y})`);\n  }\n\n  /**\n   * Positions the bubble \"optimally\" so that the most of it is visible and\n   * it does not overlap the rect (if provided).\n   */\n  protected positionByRect(rect = new Rect(0, 0, 0, 0)) {\n    const viewMetrics = this.workspace.getMetricsManager().getViewMetrics(true);\n\n    const optimalLeft = this.getOptimalRelativeLeft(viewMetrics);\n    const optimalTop = this.getOptimalRelativeTop(viewMetrics);\n\n    const topPosition = {\n      x: optimalLeft,\n      y: (-this.size.height -\n        this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT) as number,\n    };\n    const startPosition = {x: -this.size.width - 30, y: optimalTop};\n    const endPosition = {x: rect.getWidth(), y: optimalTop};\n    const bottomPosition = {x: optimalLeft, y: rect.getHeight()};\n\n    const closerPosition =\n      rect.getWidth() < rect.getHeight() ? endPosition : bottomPosition;\n    const fartherPosition =\n      rect.getWidth() < rect.getHeight() ? 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 = this.getOverlap(\n      fartherPosition,\n      viewMetrics,\n    );\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,\n      startPositionOverlap,\n      closerPositionOverlap,\n      fartherPositionOverlap,\n    );\n    if (topPositionOverlap === mostOverlap) {\n      this.relativeLeft = topPosition.x;\n      this.relativeTop = topPosition.y;\n      this.positionRelativeToAnchor();\n      return;\n    }\n    if (startPositionOverlap === mostOverlap) {\n      this.relativeLeft = startPosition.x;\n      this.relativeTop = startPosition.y;\n      this.positionRelativeToAnchor();\n      return;\n    }\n    if (closerPositionOverlap === mostOverlap) {\n      this.relativeLeft = closerPosition.x;\n      this.relativeTop = closerPosition.y;\n      this.positionRelativeToAnchor();\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    this.positionRelativeToAnchor();\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,\n  ): number {\n    // The position of the top-left corner of the bubble in workspace units.\n    const bubbleMin = {\n      x: this.workspace.RTL\n        ? this.anchor.x - relativeMin.x - this.size.width\n        : relativeMin.x + this.anchor.x,\n      y: relativeMin.y + this.anchor.y,\n    };\n    // The position of the bottom-right corner of the bubble in workspace units.\n    const bubbleMax = {\n      x: bubbleMin.x + this.size.width,\n      y: bubbleMin.y + this.size.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 =\n      Math.min(bubbleMax.x, workspaceMax.x) -\n      Math.max(bubbleMin.x, workspaceMin.x);\n    const overlapHeight =\n      Math.min(bubbleMax.y, workspaceMax.y) -\n      Math.max(bubbleMin.y, workspaceMin.y);\n    return Math.max(\n      0,\n      Math.min(\n        1,\n        (overlapWidth * overlapHeight) / (this.size.width * this.size.height),\n      ),\n    );\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    // By default, show the bubble just a bit to the left of the anchor.\n    let relativeLeft = -this.size.width / 4;\n\n    // No amount of sliding left or right will give us better overlap.\n    if (this.size.width > viewMetrics.width) return relativeLeft;\n\n    const workspaceRect = this.getWorkspaceViewRect(viewMetrics);\n\n    if (this.workspace.RTL) {\n      // Bubble coordinates are flipped in RTL.\n      const bubbleRight = this.anchor.x - relativeLeft;\n      const bubbleLeft = bubbleRight - this.size.width;\n\n      if (bubbleLeft < workspaceRect.left) {\n        // Slide the bubble right until it is onscreen.\n        relativeLeft = -(workspaceRect.left - this.anchor.x + this.size.width);\n      } else if (bubbleRight > workspaceRect.right) {\n        // Slide the bubble left until it is onscreen.\n        relativeLeft = -(workspaceRect.right - this.anchor.x);\n      }\n    } else {\n      const bubbleLeft = relativeLeft + this.anchor.x;\n      const bubbleRight = bubbleLeft + this.size.width;\n\n      if (bubbleLeft < workspaceRect.left) {\n        // Slide the bubble right until it is onscreen.\n        relativeLeft = workspaceRect.left - this.anchor.x;\n      } else if (bubbleRight > workspaceRect.right) {\n        // Slide the bubble left until it is onscreen.\n        relativeLeft = workspaceRect.right - this.anchor.x - this.size.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    // By default, show the bubble just a bit higher than the anchor.\n    let relativeTop = -this.size.height / 4;\n\n    // No amount of sliding up or down will give us better overlap.\n    if (this.size.height > viewMetrics.height) return relativeTop;\n\n    const top = this.anchor.y + relativeTop;\n    const bottom = top + this.size.height;\n    const workspaceRect = this.getWorkspaceViewRect(viewMetrics);\n\n    if (top < workspaceRect.top) {\n      // Slide the bubble down until it is onscreen.\n      relativeTop = workspaceRect.top - this.anchor.y;\n    } else if (bottom > workspaceRect.bottom) {\n      // Slide the bubble up until it is onscreen.\n      relativeTop = workspaceRect.bottom - this.anchor.y - this.size.height;\n    }\n\n    return relativeTop;\n  }\n\n  /**\n   * @returns a rect defining the bounds of the workspace's view in workspace\n   * coordinates.\n   */\n  private getWorkspaceViewRect(viewMetrics: ContainerRegion): Rect {\n    const top = viewMetrics.top;\n    let bottom = viewMetrics.top + viewMetrics.height;\n    let left = viewMetrics.left;\n    let right = viewMetrics.left + viewMetrics.width;\n\n    bottom -= this.getScrollbarThickness();\n    if (this.workspace.RTL) {\n      left -= this.getScrollbarThickness();\n    } else {\n      right -= this.getScrollbarThickness();\n    }\n\n    return new Rect(top, bottom, left, right);\n  }\n\n  /** @returns the scrollbar thickness in workspace units. */\n  private getScrollbarThickness() {\n    return Scrollbar.scrollbarThickness / this.workspace.scale;\n  }\n\n  /** Draws the tail of the bubble. */\n  private renderTail() {\n    const steps = [];\n    // Find the relative coordinates of the center of the bubble.\n    const relBubbleX = this.size.width / 2;\n    const relBubbleY = this.size.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 tail'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 tail.\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 tail.\n      let thickness =\n        (this.size.width + this.size.height) / Bubble.TAIL_THICKNESS;\n      thickness = Math.min(thickness, this.size.width, this.size.height) / 4;\n\n      // Back the tip of the tail 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 tail.\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 tail.\n      const radians = math.toRadians(\n        this.workspace.RTL ? -Bubble.TAIL_ANGLE : Bubble.TAIL_ANGLE,\n      );\n      let swirlAngle = angle + radians;\n      if (swirlAngle > Math.PI * 2) {\n        swirlAngle -= Math.PI * 2;\n      }\n      const swirlRise = (Math.sin(swirlAngle) * hypotenuse) / Bubble.TAIL_BEND;\n      const swirlRun = (Math.cos(swirlAngle) * hypotenuse) / Bubble.TAIL_BEND;\n\n      steps.push('M' + baseX1 + ',' + baseY1);\n      steps.push(\n        'C' +\n          (baseX1 + swirlRun) +\n          ',' +\n          (baseY1 + swirlRise) +\n          ' ' +\n          relAnchorX +\n          ',' +\n          relAnchorY +\n          ' ' +\n          relAnchorX +\n          ',' +\n          relAnchorY,\n      );\n      steps.push(\n        'C' +\n          relAnchorX +\n          ',' +\n          relAnchorY +\n          ' ' +\n          (baseX2 + swirlRun) +\n          ',' +\n          (baseY2 + swirlRise) +\n          ' ' +\n          baseX2 +\n          ',' +\n          baseY2,\n      );\n    }\n    steps.push('z');\n    this.tail?.setAttribute('d', steps.join(' '));\n  }\n  /**\n   * Move this bubble to the front of the visible workspace.\n   *\n   * @returns Whether or not the bubble has been moved.\n   * @internal\n   */\n  bringToFront(): boolean {\n    const svgGroup = this.svgRoot?.parentNode;\n    if (this.svgRoot && svgGroup?.lastChild !== this.svgRoot) {\n      svgGroup?.appendChild(this.svgRoot);\n      return true;\n    }\n    return false;\n  }\n\n  /** @internal */\n  getRelativeToSurfaceXY(): Coordinate {\n    return new Coordinate(\n      this.workspace.RTL\n        ? -this.relativeLeft + this.anchor.x - this.size.width\n        : this.anchor.x + this.relativeLeft,\n      this.anchor.y + this.relativeTop,\n    );\n  }\n\n  /** @internal */\n  getSvgRoot(): SVGElement {\n    return this.svgRoot;\n  }\n\n  /**\n   * Move this bubble during a drag.\n   *\n   * @param newLoc The location to translate to, in workspace coordinates.\n   * @internal\n   */\n  moveDuringDrag(newLoc: Coordinate) {\n    this.moveTo(newLoc.x, newLoc.y);\n    if (this.workspace.RTL) {\n      this.relativeLeft = this.anchor.x - newLoc.x - this.size.width;\n    } else {\n      this.relativeLeft = newLoc.x - this.anchor.x;\n    }\n    this.relativeTop = newLoc.y - this.anchor.y;\n    this.renderTail();\n  }\n\n  setDragging(_start: boolean) {\n    // NOOP in base class.\n  }\n\n  /** @internal */\n  setDeleteStyle(_enable: boolean) {\n    // NOOP in base class.\n  }\n\n  /** @internal */\n  isDeletable(): boolean {\n    return false;\n  }\n\n  /** @internal */\n  showContextMenu(_e: Event) {\n    // NOOP in base class.\n  }\n\n  /** Returns whether this bubble is movable or not. */\n  isMovable(): boolean {\n    return true;\n  }\n\n  /** Starts a drag on the bubble. */\n  startDrag(): void {\n    this.dragStrategy.startDrag();\n  }\n\n  /** Drags the bubble to the given location. */\n  drag(newLoc: Coordinate): void {\n    this.dragStrategy.drag(newLoc);\n  }\n\n  /** Ends the drag on the bubble. */\n  endDrag(): void {\n    this.dragStrategy.endDrag();\n  }\n\n  /** Moves the bubble back to where it was at the start of a drag. */\n  revertDrag(): void {\n    this.dragStrategy.revertDrag();\n  }\n\n  select(): void {\n    // Bubbles don't have any visual for being selected.\n    common.fireSelectedEvent(this);\n  }\n\n  unselect(): void {\n    // Bubbles don't have any visual for being selected.\n    common.fireSelectedEvent(null);\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    return this.focusableElement;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this.workspace;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {\n    this.select();\n    this.bringToFront();\n    const xy = this.getRelativeToSurfaceXY();\n    const size = this.getSize();\n    const bounds = new Rect(xy.y, xy.y + size.height, xy.x, xy.x + size.width);\n    this.workspace.scrollBoundsIntoView(bounds);\n  }\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {\n    this.unselect();\n  }\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\n\n  /**\n   * Returns the object that owns/hosts this bubble, if any.\n   */\n  getOwner(): (IHasBubble & IFocusableNode) | undefined {\n    return this.owner;\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {BlocklyOptions} from '../blockly_options.js';\nimport {Abstract as AbstractEvent} from '../events/events_abstract.js';\nimport {Options} from '../options.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport * as dom from '../utils/dom.js';\nimport type {Rect} from '../utils/rect.js';\nimport {Size} from '../utils/size.js';\nimport {Svg} from '../utils/svg.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport {Bubble} from './bubble.js';\n\n/**\n * A bubble that contains a mini-workspace which can hold arbitrary blocks.\n * Used by the mutator icon.\n */\nexport class MiniWorkspaceBubble extends Bubble {\n  /**\n   * The minimum amount of change to the mini workspace view to trigger\n   * resizing the bubble.\n   */\n  private static readonly MINIMUM_VIEW_CHANGE = 10;\n\n  /**\n   * An arbitrary margin of whitespace to put around the blocks in the\n   * workspace.\n   */\n  private static readonly MARGIN = Bubble.DOUBLE_BORDER * 3;\n\n  /** The root svg element containing the workspace. */\n  private svgDialog: SVGElement;\n\n  /** The workspace that gets shown within this bubble. */\n  private miniWorkspace: WorkspaceSvg;\n\n  /**\n   * Should this bubble automatically reposition itself when it resizes?\n   * Becomes false after this bubble is first dragged.\n   */\n  private autoLayout = true;\n\n  /** @internal */\n  constructor(\n    workspaceOptions: BlocklyOptions,\n    public readonly workspace: WorkspaceSvg,\n    protected anchor: Coordinate,\n    protected ownerRect?: Rect,\n  ) {\n    super(workspace, anchor, ownerRect);\n    const options = new Options(workspaceOptions);\n    this.validateWorkspaceOptions(options);\n\n    this.svgDialog = dom.createSvgElement(\n      Svg.SVG,\n      {\n        'x': Bubble.BORDER_WIDTH,\n        'y': Bubble.BORDER_WIDTH,\n      },\n      this.contentContainer,\n    );\n    workspaceOptions.parentWorkspace = this.workspace;\n    this.miniWorkspace = this.newWorkspaceSvg(new Options(workspaceOptions));\n    // TODO (#7422): Change this to `internalIsMiniWorkspace` or something. Not\n    //   all mini workspaces are necessarily mutators.\n    this.miniWorkspace.internalIsMutator = true;\n    const background = this.miniWorkspace.createDom('blocklyMutatorBackground');\n    this.svgDialog.appendChild(background);\n    if (options.languageTree) {\n      background.insertBefore(\n        this.miniWorkspace.addFlyout(Svg.G),\n        this.miniWorkspace.getCanvas(),\n      );\n      const flyout = this.miniWorkspace.getFlyout();\n      flyout?.init(this.miniWorkspace);\n      flyout?.show(options.languageTree);\n    }\n\n    dom.addClass(this.svgRoot, 'blocklyMiniWorkspaceBubble');\n    this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this));\n    this.miniWorkspace\n      .getFlyout()\n      ?.getWorkspace()\n      ?.addChangeListener(this.onWorkspaceChange.bind(this));\n    this.updateBubbleSize();\n  }\n\n  dispose() {\n    this.miniWorkspace.dispose();\n    super.dispose();\n  }\n\n  /** @internal */\n  getWorkspace(): WorkspaceSvg {\n    return this.miniWorkspace;\n  }\n\n  /** Adds a change listener to the mini workspace. */\n  addWorkspaceChangeListener(listener: (e: AbstractEvent) => void) {\n    this.miniWorkspace.addChangeListener(listener);\n  }\n\n  /**\n   * Validates the workspace options to make sure folks aren't trying to\n   * enable things the miniworkspace doesn't support.\n   */\n  private validateWorkspaceOptions(options: Options) {\n    if (options.hasCategories) {\n      throw new Error(\n        'The miniworkspace bubble does not support toolboxes with categories',\n      );\n    }\n    if (options.hasTrashcan) {\n      throw new Error('The miniworkspace bubble does not support trashcans');\n    }\n    if (\n      options.zoomOptions.controls ||\n      options.zoomOptions.wheel ||\n      options.zoomOptions.pinch\n    ) {\n      throw new Error('The miniworkspace bubble does not support zooming');\n    }\n    if (\n      options.moveOptions.scrollbars ||\n      options.moveOptions.wheel ||\n      options.moveOptions.drag\n    ) {\n      throw new Error(\n        'The miniworkspace bubble does not scrolling/moving the workspace',\n      );\n    }\n    if (options.horizontalLayout) {\n      throw new Error(\n        'The miniworkspace bubble does not support horizontal layouts',\n      );\n    }\n  }\n\n  private onWorkspaceChange() {\n    this.bumpBlocksIntoBounds();\n    this.updateBubbleSize();\n  }\n\n  /**\n   * Bumps blocks that are above the top or outside the start-side of the\n   * workspace back within the workspace.\n   *\n   * Blocks that are below the bottom or outside the end-side of the workspace\n   * are dealt with by resizing the workspace to show them.\n   */\n  private bumpBlocksIntoBounds() {\n    if (\n      this.miniWorkspace.isDragging() &&\n      !this.miniWorkspace.keyboardMoveInProgress\n    )\n      return;\n\n    const MARGIN = 20;\n\n    for (const block of this.miniWorkspace.getTopBlocks(false)) {\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.miniWorkspace.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  /**\n   * Updates the size of this bubble to account for the size of the\n   * mini workspace.\n   */\n  private updateBubbleSize() {\n    if (\n      this.miniWorkspace.isDragging() &&\n      !this.miniWorkspace.keyboardMoveInProgress\n    )\n      return;\n\n    // Disable autolayout if a keyboard move is in progress to prevent the\n    // mutator bubble from jumping around.\n    this.autoLayout &&= !this.miniWorkspace.keyboardMoveInProgress;\n\n    const currSize = this.getSize();\n    const newSize = this.calculateWorkspaceSize();\n    if (\n      Math.abs(currSize.width - newSize.width) <\n        MiniWorkspaceBubble.MINIMUM_VIEW_CHANGE &&\n      Math.abs(currSize.height - newSize.height) <\n        MiniWorkspaceBubble.MINIMUM_VIEW_CHANGE\n    ) {\n      // Only resize if the size has noticeably changed.\n      return;\n    }\n    this.svgDialog.setAttribute('width', `${newSize.width}px`);\n    this.svgDialog.setAttribute('height', `${newSize.height}px`);\n    this.miniWorkspace.setCachedParentSvgSize(newSize.width, newSize.height);\n    if (this.miniWorkspace.RTL) {\n      // Scroll the workspace to always left-align.\n      this.miniWorkspace\n        .getCanvas()\n        .setAttribute('transform', `translate(${newSize.width}, 0)`);\n    }\n    this.setSize(\n      new Size(\n        newSize.width + Bubble.DOUBLE_BORDER,\n        newSize.height + Bubble.DOUBLE_BORDER,\n      ),\n      this.autoLayout,\n    );\n    this.miniWorkspace.resize();\n    this.miniWorkspace.recordDragTargets();\n  }\n\n  /**\n   * Calculates the size of the mini workspace for use in resizing the bubble.\n   */\n  private calculateWorkspaceSize(): Size {\n    const workspaceSize = this.miniWorkspace.getCanvas().getBBox();\n    let width = workspaceSize.width + MiniWorkspaceBubble.MARGIN;\n    let height = workspaceSize.height + MiniWorkspaceBubble.MARGIN;\n\n    const flyout = this.miniWorkspace.getFlyout();\n    if (flyout) {\n      const flyoutScrollMetrics = flyout\n        .getWorkspace()\n        .getMetricsManager()\n        .getScrollMetrics();\n      height = Math.max(height, flyoutScrollMetrics.height + 20);\n      width += flyout.getWidth();\n    }\n    return new Size(width, height);\n  }\n\n  /** Reapplies styles to all of the blocks in the mini workspace. */\n  updateBlockStyles() {\n    for (const block of this.miniWorkspace.getAllBlocks(false)) {\n      block.setStyle(block.getStyleName());\n    }\n\n    const flyoutWs = this.miniWorkspace.getFlyout()?.getWorkspace();\n    if (flyoutWs) {\n      for (const block of flyoutWs.getAllBlocks(false)) {\n        block.setStyle(block.getStyleName());\n      }\n    }\n  }\n\n  /**\n   * Move this bubble during a drag.\n   *\n   * @param newLoc The location to translate to, in workspace coordinates.\n   * @internal\n   */\n  moveDuringDrag(newLoc: Coordinate): void {\n    super.moveDuringDrag(newLoc);\n    this.autoLayout = false;\n  }\n\n  /** @internal */\n  moveTo(x: number, y: number): void {\n    super.moveTo(x, y);\n    this.miniWorkspace.recordDragTargets();\n  }\n\n  /** @internal */\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}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Block} from '../block.js';\nimport type {BlockSvg} from '../block_svg.js';\nimport * as browserEvents from '../browser_events.js';\nimport type {IFocusableTree} from '../interfaces/i_focusable_tree.js';\nimport {hasBubble} from '../interfaces/i_has_bubble.js';\nimport type {IIcon} from '../interfaces/i_icon.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 {Rect} from '../utils/rect.js';\nimport {Size} from '../utils/size.js';\nimport {Svg} from '../utils/svg.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport type {IconType} from './icon_types.js';\n\n/**\n * The abstract icon class. Icons are visual elements that live in the top-start\n * corner of the block. Usually they provide more \"meta\" information about a\n * block (such as warnings or comments) as opposed to fields, which provide\n * \"actual\" information, related to how a block functions.\n */\nexport abstract class Icon implements IIcon {\n  /**\n   * The position of this icon relative to its blocks top-start,\n   * in workspace units.\n   */\n  protected offsetInBlock: Coordinate = new Coordinate(0, 0);\n\n  /** The position of this icon in workspace coordinates. */\n  protected workspaceLocation: Coordinate = new Coordinate(0, 0);\n\n  /** The root svg element visually representing this icon. */\n  protected svgRoot: SVGGElement | null = null;\n\n  /** The tooltip for this icon. */\n  protected tooltip: tooltip.TipInfo;\n\n  /** The unique ID of this icon. */\n  private id: string;\n\n  constructor(protected sourceBlock: Block) {\n    this.tooltip = sourceBlock;\n    this.id = idGenerator.getNextUniqueId();\n  }\n\n  getType(): IconType<IIcon> {\n    throw new Error('Icons must implement getType');\n  }\n\n  initView(pointerdownListener: (e: PointerEvent) => void): void {\n    if (this.svgRoot) return; // The icon has already been initialized.\n\n    const svgBlock = this.sourceBlock as BlockSvg;\n    this.svgRoot = dom.createSvgElement(Svg.G, {\n      'class': 'blocklyIconGroup',\n      'id': this.id,\n    });\n    svgBlock.getSvgRoot().appendChild(this.svgRoot);\n    this.updateSvgRootOffset();\n    browserEvents.conditionalBind(\n      this.svgRoot,\n      'pointerdown',\n      this,\n      pointerdownListener,\n    );\n    (this.svgRoot as any).tooltip = this;\n    tooltip.bindMouseEvents(this.svgRoot);\n  }\n\n  dispose(): void {\n    tooltip.unbindMouseEvents(this.svgRoot);\n    dom.removeNode(this.svgRoot);\n  }\n\n  getWeight(): number {\n    return -1;\n  }\n\n  getSize(): Size {\n    return new Size(0, 0);\n  }\n\n  /**\n   * Sets the tooltip for this icon to the given value. Null to show the\n   * tooltip of the block.\n   */\n  setTooltip(tip: tooltip.TipInfo | null) {\n    this.tooltip = tip ?? this.sourceBlock;\n  }\n\n  /** Returns the tooltip for this icon. */\n  getTooltip(): tooltip.TipInfo {\n    return this.tooltip;\n  }\n\n  applyColour(): void {}\n\n  updateEditable(): void {}\n\n  updateCollapsed(): void {\n    if (!this.svgRoot) return;\n    if (this.sourceBlock.isCollapsed()) {\n      this.svgRoot.style.display = 'none';\n    } else {\n      this.svgRoot.style.display = 'block';\n    }\n    if (hasBubble(this)) {\n      this.setBubbleVisible(false);\n    }\n  }\n\n  hideForInsertionMarker(): void {\n    if (!this.svgRoot) return;\n    this.svgRoot.style.display = 'none';\n  }\n\n  isShownWhenCollapsed(): boolean {\n    return false;\n  }\n\n  setOffsetInBlock(offset: Coordinate): void {\n    this.offsetInBlock = offset;\n    this.updateSvgRootOffset();\n  }\n\n  private updateSvgRootOffset(): void {\n    this.svgRoot?.setAttribute(\n      'transform',\n      `translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`,\n    );\n  }\n\n  onLocationChange(blockOrigin: Coordinate): void {\n    this.workspaceLocation = Coordinate.sum(blockOrigin, this.offsetInBlock);\n  }\n\n  onClick(): void {}\n\n  /**\n   * Check whether the icon should be clickable while the block is in a flyout.\n   * The default is that icons are clickable in all flyouts (auto-closing or not).\n   * Subclasses may override this function to change this behavior.\n   *\n   * @param autoClosingFlyout true if the containing flyout is an auto-closing one.\n   * @returns Whether the icon should be clickable while the block is in a flyout.\n   */\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  isClickableInFlyout(autoClosingFlyout: boolean): boolean {\n    return true;\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    const svgRoot = this.svgRoot;\n    if (!svgRoot) throw new Error('Attempting to focus uninitialized icon.');\n    return svgRoot;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this.sourceBlock.workspace as WorkspaceSvg;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {\n    const blockBounds = (this.sourceBlock as BlockSvg).getBoundingRectangle();\n    const bounds = new Rect(\n      blockBounds.top + this.offsetInBlock.y,\n      blockBounds.top + this.offsetInBlock.y + this.getSize().height,\n      blockBounds.left + this.offsetInBlock.x,\n      blockBounds.left + this.offsetInBlock.x + this.getSize().width,\n    );\n    (this.sourceBlock as BlockSvg).workspace.scrollBoundsIntoView(bounds);\n  }\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\n\n  /**\n   * Returns the block that this icon is attached to.\n   *\n   * @returns The block this icon is attached to.\n   */\n  getSourceBlock(): Block {\n    return this.sourceBlock;\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Mutator\n\nimport type {BlockSvg} from '../block_svg.js';\nimport type {BlocklyOptions} from '../blockly_options.js';\nimport {MiniWorkspaceBubble} from '../bubbles/mini_workspace_bubble.js';\nimport type {Abstract} from '../events/events_abstract.js';\nimport {BlockChange} from '../events/events_block_change.js';\nimport {isBlockChange, isBlockCreate} from '../events/predicates.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport type {IHasBubble} from '../interfaces/i_has_bubble.js';\nimport * as renderManagement from '../render_management.js';\nimport {Coordinate} from '../utils/coordinate.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';\nimport {Icon} from './icon.js';\nimport {IconType} from './icon_types.js';\n\n/** The size of the mutator icon in workspace-scale units. */\nconst SIZE = 17;\n\n/**\n * The distance between the root block in the mini workspace and that\n * workspace's edges.\n */\nconst WORKSPACE_MARGIN = 16;\n\n/**\n * An icon that allows the user to change the shape of the block.\n *\n * For example, it could be used to add additional fields or inputs to\n * the block.\n */\nexport class MutatorIcon extends Icon implements IHasBubble {\n  /** The type string used to identify this icon. */\n  static readonly TYPE = IconType.MUTATOR;\n\n  /**\n   * The weight this icon has relative to other icons. Icons with more positive\n   * weight values are rendered farther toward the end of the block.\n   */\n  static readonly WEIGHT = 1;\n\n  /** The bubble used to show the mini workspace to the user. */\n  private miniWorkspaceBubble: MiniWorkspaceBubble | null = null;\n\n  /** The root block in the mini workspace. */\n  private rootBlock: BlockSvg | null = null;\n\n  /** The PID tracking updating the workkspace in response to user events. */\n  private updateWorkspacePid: ReturnType<typeof setTimeout> | null = null;\n\n  /**\n   * The change listener in the main workspace that triggers the saveConnections\n   * method when anything in the main workspace changes.\n   *\n   * Only actually registered to listen for events while the mutator bubble is\n   * open.\n   */\n  private saveConnectionsListener: (() => void) | null = null;\n\n  constructor(\n    private readonly flyoutBlockTypes: string[],\n    protected readonly sourceBlock: BlockSvg,\n  ) {\n    super(sourceBlock);\n  }\n\n  override getType(): IconType<MutatorIcon> {\n    return MutatorIcon.TYPE;\n  }\n\n  override initView(pointerdownListener: (e: PointerEvent) => void): void {\n    if (this.svgRoot) return; // Already initialized.\n\n    super.initView(pointerdownListener);\n\n    // Square with rounded corners.\n    dom.createSvgElement(\n      Svg.RECT,\n      {\n        'class': 'blocklyIconShape',\n        'rx': '4',\n        'ry': '4',\n        'height': '16',\n        'width': '16',\n      },\n      this.svgRoot,\n    );\n    // Gear teeth.\n    dom.createSvgElement(\n      Svg.PATH,\n      {\n        'class': 'blocklyIconSymbol',\n        'd':\n          '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      this.svgRoot,\n    );\n    // Axle hole.\n    dom.createSvgElement(\n      Svg.CIRCLE,\n      {'class': 'blocklyIconShape', 'r': '2.7', 'cx': '8', 'cy': '8'},\n      this.svgRoot,\n    );\n    dom.addClass(this.svgRoot!, 'blocklyMutatorIcon');\n  }\n\n  override dispose(): void {\n    super.dispose();\n    this.miniWorkspaceBubble?.dispose();\n  }\n\n  override getWeight(): number {\n    return MutatorIcon.WEIGHT;\n  }\n\n  override getSize(): Size {\n    return new Size(SIZE, SIZE);\n  }\n\n  override applyColour(): void {\n    super.applyColour();\n    this.miniWorkspaceBubble?.setColour(this.sourceBlock.getColour());\n    this.miniWorkspaceBubble?.updateBlockStyles();\n  }\n\n  override updateCollapsed(): void {\n    super.updateCollapsed();\n    if (this.sourceBlock.isCollapsed()) this.setBubbleVisible(false);\n  }\n\n  override onLocationChange(blockOrigin: Coordinate): void {\n    super.onLocationChange(blockOrigin);\n    this.miniWorkspaceBubble?.setAnchorLocation(this.getAnchorLocation());\n  }\n\n  override onClick(): void {\n    super.onClick();\n    if (this.sourceBlock.isEditable()) {\n      this.setBubbleVisible(!this.bubbleIsVisible());\n    }\n  }\n\n  override isClickableInFlyout(): boolean {\n    return false;\n  }\n\n  bubbleIsVisible(): boolean {\n    return !!this.miniWorkspaceBubble;\n  }\n\n  async setBubbleVisible(visible: boolean): Promise<void> {\n    if (this.bubbleIsVisible() === visible) return;\n\n    await renderManagement.finishQueuedRenders();\n\n    if (visible) {\n      this.miniWorkspaceBubble = new MiniWorkspaceBubble(\n        this.getMiniWorkspaceConfig(),\n        this.sourceBlock.workspace,\n        this.getAnchorLocation(),\n        this.getBubbleOwnerRect(),\n      );\n      this.applyColour();\n      this.createRootBlock();\n      this.addSaveConnectionsListener();\n      this.miniWorkspaceBubble?.addWorkspaceChangeListener(\n        this.createMiniWorkspaceChangeListener(),\n      );\n    } else {\n      this.miniWorkspaceBubble?.dispose();\n      this.miniWorkspaceBubble = null;\n      if (this.saveConnectionsListener) {\n        this.sourceBlock.workspace.removeChangeListener(\n          this.saveConnectionsListener,\n        );\n      }\n      this.saveConnectionsListener = null;\n    }\n\n    eventUtils.fire(\n      new (eventUtils.get(EventType.BUBBLE_OPEN))(\n        this.sourceBlock,\n        visible,\n        'mutator',\n      ),\n    );\n  }\n\n  /** See IHasBubble.getBubble. */\n  getBubble(): MiniWorkspaceBubble | null {\n    return this.miniWorkspaceBubble;\n  }\n\n  /** @returns the configuration the mini workspace should have. */\n  private getMiniWorkspaceConfig() {\n    const options: BlocklyOptions = {\n      'disable': false,\n      'media': this.sourceBlock.workspace.options.pathToMedia,\n      'rtl': this.sourceBlock.RTL,\n      'renderer': this.sourceBlock.workspace.options.renderer,\n      'rendererOverrides':\n        this.sourceBlock.workspace.options.rendererOverrides ?? undefined,\n    };\n\n    if (this.flyoutBlockTypes.length) {\n      options.toolbox = {\n        'kind': 'flyoutToolbox',\n        'contents': this.flyoutBlockTypes.map((type) => ({\n          'kind': 'block',\n          'type': type,\n        })),\n      };\n    }\n\n    return options;\n  }\n\n  /**\n   * @returns the location the bubble should be anchored to.\n   *     I.E. the middle of this icon.\n   */\n  private getAnchorLocation(): Coordinate {\n    const midIcon = SIZE / 2;\n    return Coordinate.sum(\n      this.workspaceLocation,\n      new Coordinate(midIcon, midIcon),\n    );\n  }\n\n  /**\n   * @returns the rect the bubble should avoid overlapping.\n   *     I.E. the block that owns this icon.\n   */\n  private getBubbleOwnerRect(): Rect {\n    const bbox = this.sourceBlock.getSvgRoot().getBBox();\n    return new Rect(bbox.y, bbox.y + bbox.height, bbox.x, bbox.x + bbox.width);\n  }\n\n  /** Decomposes the source block to create blocks in the mini workspace. */\n  private createRootBlock() {\n    if (!this.sourceBlock.decompose) {\n      throw new Error(\n        'Blocks with mutator icons must include a decompose method',\n      );\n    }\n    this.rootBlock = this.sourceBlock.decompose(\n      this.miniWorkspaceBubble!.getWorkspace(),\n    )!;\n\n    for (const child of this.rootBlock.getDescendants(false)) {\n      child.queueRender();\n    }\n\n    this.rootBlock.setMovable(false);\n    this.rootBlock.setDeletable(false);\n\n    const flyoutWidth =\n      this.miniWorkspaceBubble?.getWorkspace()?.getFlyout()?.getWidth() ?? 0;\n    this.rootBlock.moveBy(\n      this.rootBlock.RTL ? -(flyoutWidth + WORKSPACE_MARGIN) : WORKSPACE_MARGIN,\n      WORKSPACE_MARGIN,\n    );\n  }\n\n  /** Adds a listen to the source block that triggers saving connections. */\n  private addSaveConnectionsListener() {\n    if (!this.sourceBlock.saveConnections || !this.rootBlock) return;\n    this.saveConnectionsListener = () => {\n      if (!this.sourceBlock.saveConnections || !this.rootBlock) return;\n      this.sourceBlock.saveConnections(this.rootBlock);\n    };\n    this.saveConnectionsListener();\n    this.sourceBlock.workspace.addChangeListener(this.saveConnectionsListener);\n  }\n\n  /**\n   * Creates a change listener to add to the mini workspace which recomposes\n   * the block.\n   */\n  private createMiniWorkspaceChangeListener() {\n    return (e: Abstract) => {\n      if (!MutatorIcon.isIgnorableMutatorEvent(e) && !this.updateWorkspacePid) {\n        this.updateWorkspacePid = setTimeout(() => {\n          this.updateWorkspacePid = null;\n          this.recomposeSourceBlock();\n        }, 0);\n      }\n    };\n  }\n\n  /**\n   * Returns true if the given event is not one the mutator needs to\n   * care about.\n   *\n   * @internal\n   */\n  static isIgnorableMutatorEvent(e: Abstract) {\n    return (\n      e.isUiEvent ||\n      isBlockCreate(e) ||\n      (isBlockChange(e) && e.element === 'disabled')\n    );\n  }\n\n  /** Recomposes the source block based on changes to the mini workspace. */\n  private recomposeSourceBlock() {\n    if (!this.rootBlock) return;\n    if (!this.sourceBlock.compose) {\n      throw new Error(\n        'Blocks with mutator icons must include a compose method',\n      );\n    }\n\n    const existingGroup = eventUtils.getGroup();\n    if (!existingGroup) eventUtils.setGroup(true);\n\n    const oldExtraState = BlockChange.getExtraBlockState_(this.sourceBlock);\n    this.sourceBlock.compose(this.rootBlock);\n    const newExtraState = BlockChange.getExtraBlockState_(this.sourceBlock);\n\n    if (oldExtraState !== newExtraState) {\n      eventUtils.fire(\n        new (eventUtils.get(EventType.BLOCK_CHANGE))(\n          this.sourceBlock,\n          'mutation',\n          null,\n          oldExtraState,\n          newExtraState,\n        ),\n      );\n    }\n\n    eventUtils.setGroup(existingGroup);\n  }\n\n  /**\n   * @returns The workspace of the mini workspace bubble, if the bubble is\n   *     currently open.\n   */\n  getWorkspace(): WorkspaceSvg | undefined {\n    return this.miniWorkspaceBubble?.getWorkspace();\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.KeyCodes\n\n/* eslint-disable @typescript-eslint/no-duplicate-enum-values */\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 */\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 = 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 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils\n\nimport * as browserEvents from './browser_events.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';\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 * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CommentEditor} from '../comments/comment_editor.js';\nimport * as Css from '../css.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {IHasBubble} from '../interfaces/i_has_bubble.js';\nimport * as touch from '../touch.js';\nimport {browserEvents} from '../utils.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport * as dom from '../utils/dom.js';\nimport * as drag from '../utils/drag.js';\nimport {Rect} from '../utils/rect.js';\nimport {Size} from '../utils/size.js';\nimport {Svg} from '../utils/svg.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\nimport {Bubble} from './bubble.js';\n\n/**\n * A bubble that displays editable text. It can also be resized by the user.\n * Used by the comment icon.\n */\nexport class TextInputBubble extends Bubble {\n  /** The group containing the lines indicating the bubble is resizable. */\n  private resizeGroup: SVGGElement;\n\n  /**\n   * Event data associated with the listener for pointer up events on the\n   * resize group.\n   */\n  private resizePointerUpListener: browserEvents.Data | null = null;\n\n  /**\n   * Event data associated with the listener for pointer move events on the\n   * resize group.\n   */\n  private resizePointerMoveListener: browserEvents.Data | null = null;\n\n  /** Functions listening for changes to the size of this bubble. */\n  private sizeChangeListeners: (() => void)[] = [];\n\n  /** Functions listening for changes to the location of this bubble. */\n  private locationChangeListeners: (() => void)[] = [];\n\n  /** The default size of this bubble, including borders. */\n  private readonly DEFAULT_SIZE = new Size(\n    160 + Bubble.DOUBLE_BORDER,\n    80 + Bubble.DOUBLE_BORDER,\n  );\n\n  /** The minimum size of this bubble, including borders. */\n  private readonly MIN_SIZE = new Size(\n    45 + Bubble.DOUBLE_BORDER,\n    20 + Bubble.DOUBLE_BORDER,\n  );\n\n  private editable = true;\n\n  /** View responsible for supporting text editing. */\n  private editor: CommentEditor;\n\n  /**\n   * @param workspace The workspace this bubble belongs to.\n   * @param anchor The anchor location of the thing this bubble is attached to.\n   *     The tail of the bubble will point to this location.\n   * @param ownerRect An optional rect we don't want the bubble to overlap with\n   *     when automatically positioning.\n   * @param owner The object that owns/hosts this bubble.\n   */\n  constructor(\n    public readonly workspace: WorkspaceSvg,\n    protected anchor: Coordinate,\n    protected ownerRect?: Rect,\n    protected owner?: IHasBubble & IFocusableNode,\n  ) {\n    super(workspace, anchor, ownerRect, undefined, owner);\n    dom.addClass(this.svgRoot, 'blocklyTextInputBubble');\n    this.editor = new CommentEditor(workspace, this.id, () => {\n      getFocusManager().focusNode(this);\n    });\n    this.contentContainer.appendChild(this.editor.getDom());\n    this.resizeGroup = this.createResizeHandle(this.svgRoot, workspace);\n    this.setSize(this.DEFAULT_SIZE, true);\n  }\n\n  /** @returns the text of this bubble. */\n  getText(): string {\n    return this.editor.getText();\n  }\n\n  /** Sets the text of this bubble. Calls change listeners. */\n  setText(text: string) {\n    this.editor.setText(text);\n  }\n\n  /** Sets whether or not the text in the bubble is editable. */\n  setEditable(editable: boolean) {\n    this.editable = editable;\n    this.editor.setEditable(editable);\n  }\n\n  /** Returns whether or not the text in the bubble is editable. */\n  isEditable(): boolean {\n    return this.editable;\n  }\n\n  /** Adds a change listener to be notified when this bubble's text changes. */\n  addTextChangeListener(listener: () => void) {\n    this.editor.addTextChangeListener(listener);\n  }\n\n  /** Adds a change listener to be notified when this bubble's size changes. */\n  addSizeChangeListener(listener: () => void) {\n    this.sizeChangeListeners.push(listener);\n  }\n\n  /** Adds a change listener to be notified when this bubble's location changes. */\n  addLocationChangeListener(listener: () => void) {\n    this.locationChangeListeners.push(listener);\n  }\n\n  /** Creates the resize handler elements and binds events to them. */\n  private createResizeHandle(\n    container: SVGGElement,\n    workspace: WorkspaceSvg,\n  ): SVGGElement {\n    const resizeHandle = dom.createSvgElement(\n      Svg.IMAGE,\n      {\n        'class': 'blocklyResizeHandle',\n        'href': `${workspace.options.pathToMedia}resize-handle.svg`,\n      },\n      container,\n    );\n\n    browserEvents.conditionalBind(\n      resizeHandle,\n      'pointerdown',\n      this,\n      this.onResizePointerDown,\n    );\n\n    return resizeHandle;\n  }\n\n  /**\n   * Sets the size of this bubble, including the border.\n   *\n   * @param size Sets the size of this bubble, including the border.\n   * @param relayout If true, reposition the bubble from scratch so that it is\n   *     optimally visible. If false, reposition it so it maintains the same\n   *     position relative to the anchor.\n   */\n  setSize(size: Size, relayout = false) {\n    size.width = Math.max(size.width, this.MIN_SIZE.width);\n    size.height = Math.max(size.height, this.MIN_SIZE.height);\n\n    const widthMinusBorder = size.width - Bubble.DOUBLE_BORDER;\n    const heightMinusBorder = size.height - Bubble.DOUBLE_BORDER;\n    this.editor.updateSize(\n      new Size(widthMinusBorder, heightMinusBorder),\n      new Size(0, 0),\n    );\n    this.editor.getDom().setAttribute('x', `${Bubble.DOUBLE_BORDER / 2}`);\n    this.editor.getDom().setAttribute('y', `${Bubble.DOUBLE_BORDER / 2}`);\n\n    this.resizeGroup.setAttribute('y', `${heightMinusBorder}`);\n    if (this.workspace.RTL) {\n      this.resizeGroup.setAttribute('x', `${-Bubble.DOUBLE_BORDER}`);\n    } else {\n      this.resizeGroup.setAttribute('x', `${widthMinusBorder}`);\n    }\n\n    super.setSize(size, relayout);\n    this.onSizeChange();\n  }\n\n  /** @returns the size of this bubble. */\n  getSize(): Size {\n    // Overridden to be public.\n    return super.getSize();\n  }\n\n  override moveDuringDrag(newLoc: Coordinate) {\n    super.moveDuringDrag(newLoc);\n    this.onLocationChange();\n  }\n\n  override setPositionRelativeToAnchor(left: number, top: number) {\n    super.setPositionRelativeToAnchor(left, top);\n    this.onLocationChange();\n  }\n\n  protected override positionByRect(rect = new Rect(0, 0, 0, 0)) {\n    super.positionByRect(rect);\n    this.onLocationChange();\n  }\n\n  /** Handles mouse down events on the resize target. */\n  private onResizePointerDown(e: PointerEvent) {\n    this.bringToFront();\n    if (browserEvents.isRightButton(e)) {\n      e.stopPropagation();\n      return;\n    }\n\n    drag.start(\n      this.workspace,\n      e,\n      new Coordinate(\n        this.workspace.RTL ? -this.getSize().width : this.getSize().width,\n        this.getSize().height,\n      ),\n    );\n\n    this.resizePointerUpListener = browserEvents.conditionalBind(\n      document,\n      'pointerup',\n      this,\n      this.onResizePointerUp,\n    );\n    this.resizePointerMoveListener = browserEvents.conditionalBind(\n      document,\n      'pointermove',\n      this,\n      this.onResizePointerMove,\n    );\n    this.workspace.hideChaff();\n    // This event has been handled.  No need to bubble up to the document.\n    e.stopPropagation();\n  }\n\n  /** Handles pointer up events on the resize target. */\n  private onResizePointerUp(_e: PointerEvent) {\n    touch.clearTouchIdentifier();\n    if (this.resizePointerUpListener) {\n      browserEvents.unbind(this.resizePointerUpListener);\n      this.resizePointerUpListener = null;\n    }\n    if (this.resizePointerMoveListener) {\n      browserEvents.unbind(this.resizePointerMoveListener);\n      this.resizePointerMoveListener = null;\n    }\n  }\n\n  /** Handles pointer move events on the resize target. */\n  private onResizePointerMove(e: PointerEvent) {\n    const delta = drag.move(this.workspace, e);\n    this.setSize(\n      new Size(this.workspace.RTL ? -delta.x : delta.x, delta.y),\n      false,\n    );\n    this.onSizeChange();\n  }\n\n  /** Handles a size change event for the text area. Calls event listeners. */\n  private onSizeChange() {\n    for (const listener of this.sizeChangeListeners) {\n      listener();\n    }\n  }\n\n  /** Handles a location change event for the text area. Calls event listeners. */\n  private onLocationChange() {\n    for (const listener of this.locationChangeListeners) {\n      listener();\n    }\n  }\n\n  /**\n   * Returns the text editor component of this bubble.\n   *\n   * @internal\n   */\n  getEditor() {\n    return this.editor;\n  }\n}\n\nCss.register(`\n.blocklyTextInputBubble .blocklyTextarea {\n  background-color: var(--commentFillColour);\n  border: 0;\n  box-sizing: border-box;\n  display: block;\n  outline: 0;\n  padding: 5px;\n  resize: none;\n  width: 100%;\n  height: 100%;\n}\n`);\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ConnectionType\n\n/**\n * Enum for the type of a connection or input.\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 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 */\n// Former goog.module ID: 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 * 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 */\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(\n    conn: RenderedConnection,\n    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 (\n      pointer < this.connections.length &&\n      this.connections[pointer].y === yPos\n    ) {\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(\n    connection: RenderedConnection,\n    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): 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,\n    maxRadius: number,\n    dxy: Coordinate,\n  ): {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 (\n      pointerMax < this.connections.length &&\n      this.isInYRange(pointerMax, conn.y, maxRadius)\n    ) {\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 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 */\n// Former goog.module ID: Blockly.Events.Selected\n\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Class for a selected event.\n * Notifies listeners that a new element has been selected.\n */\nexport class Selected extends UiBase {\n  /** The id of the last selected selectable element. */\n  oldElementId?: string;\n\n  /**\n   * The id of the newly selected selectable element,\n   * or undefined if unselected.\n   */\n  newElementId?: string;\n\n  override type = EventType.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,\n    opt_newElementId?: string | null,\n    opt_workspaceId?: string,\n  ) {\n    super(opt_workspaceId);\n\n    this.oldElementId = opt_oldElementId ?? undefined;\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   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of Selected, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: SelectedJson,\n    workspace: Workspace,\n    event?: any,\n  ): Selected {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new Selected(),\n    ) as Selected;\n    newEvent.oldElementId = json['oldElementId'];\n    newEvent.newElementId = json['newElementId'];\n    return newEvent;\n  }\n}\n\nexport interface SelectedJson extends AbstractEventJson {\n  oldElementId?: string;\n  newElementId?: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.SELECTED, Selected);\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 */\n// Former goog.module ID: 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 utilsXml from '../utils/xml.js';\nimport {Workspace} from '../workspace.js';\nimport * as Xml from '../xml.js';\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport {EventType} from './type.js';\nimport * as eventUtils from './utils.js';\n\n/**\n * Notifies listeners when a block (or connected stack of blocks) is\n * deleted.\n */\nexport class BlockDelete extends BlockBase {\n  /** The XML representation of the deleted block(s). */\n  oldXml?: Element | DocumentFragment;\n\n  /** The JSON respresentation of the deleted block(s). */\n  oldJson?: blocks.State;\n\n  /** All of the IDs of deleted blocks. */\n  ids?: string[];\n\n  /** True if the deleted block was a shadow block, false otherwise. */\n  wasShadow?: boolean;\n\n  override type = EventType.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    this.wasShadow = opt_block.isShadow();\n    this.oldJson = blocks.save(opt_block, {\n      addCoordinates: true,\n    }) 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    }\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    }\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    }\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    }\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   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BlockDelete, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: BlockDeleteJson,\n    workspace: Workspace,\n    event?: any,\n  ): BlockDelete {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BlockDelete(),\n    ) as BlockDelete;\n    newEvent.oldXml = utilsXml.textToDom(json['oldXml']);\n    newEvent.ids = json['ids'];\n    newEvent.wasShadow =\n      json['wasShadow'] || newEvent.oldXml.tagName.toLowerCase() === 'shadow';\n    newEvent.oldJson = json['oldJson'];\n    if (json['recordUndo'] !== undefined) {\n      newEvent.recordUndo = json['recordUndo'];\n    }\n    return newEvent;\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    }\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    }\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, EventType.BLOCK_DELETE, BlockDelete);\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IIcon} from '../interfaces/i_icon.js';\n\n/**\n * Thrown when you add more than one icon of the same type to a block.\n */\nexport class DuplicateIconType extends Error {\n  /**\n   * @internal\n   */\n  constructor(public icon: IIcon) {\n    super(\n      `Tried to append an icon of type ${icon.getType()} when an icon of ` +\n        `that type already exists on the block. ` +\n        `Use getIcon to access the existing icon.`,\n    );\n  }\n}\n","/**\n * @license\n * Copyright 2012 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Enum for alignment of inputs.\n */\nexport enum Align {\n  LEFT = -1,\n  CENTRE = 0,\n  RIGHT = 1,\n}\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 */\n// Former goog.module ID: Blockly.FieldLabel\n\nimport {Field, FieldConfig} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as dom from './utils/dom.js';\nimport * as parsing from './utils/parsing.js';\n\n/**\n * Class for a non-editable, non-serializable text field.\n */\nexport class FieldLabel extends Field<string> {\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  /** Text labels should not truncate. */\n  override maxDisplayLength = Infinity;\n\n  /**\n   * @param 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 textClass Optional CSS class for the field's text.\n   * @param 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    value?: string | typeof Field.SKIP_SETUP,\n    textClass?: string,\n    config?: FieldLabelConfig,\n  ) {\n    super(Field.SKIP_SETUP);\n\n    if (value === Field.SKIP_SETUP) return;\n    if (config) {\n      this.configure_(config);\n    } else {\n      this.class = textClass || null;\n    }\n    this.setValue(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  override initView() {\n    this.createTextElement_();\n    if (this.class) {\n      dom.addClass(this.getTextElement(), this.class);\n    }\n    if (this.fieldGroup_) {\n      dom.addClass(this.fieldGroup_, 'blocklyLabelField');\n    }\n  }\n\n  /**\n   * Ensure that the input value casts to a valid string.\n   *\n   * @param newValue The input value.\n   * @returns A valid string, or null if invalid.\n   */\n  protected override doClassValidation_(\n    newValue?: AnyDuringMigration,\n  ): string | null {\n    if (newValue === null || newValue === undefined) {\n      return null;\n    }\n    return `${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 override 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\nFieldLabel.prototype.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 * fromJson config options for the label field.\n */\nexport interface FieldLabelFromJsonConfig extends FieldLabelConfig {\n  text?: string;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.internalConstants\n\nimport {ConnectionType} from './connection_type.js';\n\n/**\n * Number of characters to truncate a collapsed block to.\n *\n * @internal\n */\nexport const COLLAPSE_CHARS = 30;\n\n/**\n * Lookup table for determining the opposite type of a connection.\n *\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 * @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 * @internal\n */\nexport const DELETE_VARIABLE_ID = 'DELETE_VARIABLE_ID';\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 */\n// Former goog.module ID: Blockly.RenderedConnection\n\nimport type {Block} from './block.js';\nimport type {BlockSvg} from './block_svg.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 ContextMenu from './contextmenu.js';\nimport {ContextMenuRegistry} from './contextmenu_registry.js';\nimport * as eventUtils from './events/utils.js';\nimport {IContextMenu} from './interfaces/i_contextmenu.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport {hasBubble} from './interfaces/i_has_bubble.js';\nimport * as internalConstants from './internal_constants.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as svgMath from './utils/svg_math.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\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 */\nexport class RenderedConnection\n  extends Connection\n  implements IContextMenu, IFocusableNode\n{\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 highlighted: boolean = false;\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.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    this.sourceBlock_.pathObject.removeConnectionHighlight?.(this);\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 superiorConnection The connection to move away from. The provided\n   *     connection should be the superior connection and should not be\n   *     connected to this connection.\n   * @param initiatedByThis Whether or not the block group that was manipulated\n   *     recently causing bump checks is associated with the inferior\n   *     connection. Defaults to false.\n   * @internal\n   */\n  bumpAwayFrom(\n    superiorConnection: RenderedConnection,\n    initiatedByThis = false,\n  ) {\n    if (this.sourceBlock_.workspace.isDragging()) {\n      // Don't move blocks around while the user is doing the same.\n      return;\n    }\n    let offsetX =\n      config.snapRadius + Math.floor(Math.random() * BUMP_RANDOMNESS);\n    let offsetY =\n      config.snapRadius + Math.floor(Math.random() * BUMP_RANDOMNESS);\n    /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n    const inferiorConnection = this;\n    const superiorRootBlock = superiorConnection.sourceBlock_.getRootBlock();\n    const inferiorRootBlock = inferiorConnection.sourceBlock_.getRootBlock();\n\n    if (superiorRootBlock.isInFlyout || inferiorRootBlock.isInFlyout) {\n      // Don't move blocks around in a flyout.\n      return;\n    }\n    let moveInferior = true;\n    if (!inferiorRootBlock.isMovable()) {\n      // Can't bump an immovable block away.\n      // Check to see if the other block is movable.\n      if (!superiorRootBlock.isMovable()) {\n        // Neither block is movable, abort operation.\n        return;\n      } else {\n        // Only the superior block group is movable.\n        moveInferior = false;\n        // The superior block group moves in the opposite direction.\n        offsetX = -offsetX;\n        offsetY = -offsetY;\n      }\n    } else if (superiorRootBlock.isMovable()) {\n      // Both block groups are movable. The one on the inferior side will be\n      // moved to make space for the superior one. However, it's possible that\n      // both groups of blocks have an inferior connection that bumps into a\n      // superior connection on the other group, which could result in both\n      // groups moving in the same direction and eventually bumping each other\n      // again. It would be better if one group of blocks could consistently\n      // move in an orthogonal direction from the other, so that they become\n      // separated in the end. We can designate one group the \"initiator\" if\n      // it's the one that was most recently manipulated, causing inputs to be\n      // checked for bumpable neighbors. As a useful heuristic, in the case\n      // where the inferior connection belongs to the initiator group, moving it\n      // in the orthogonal direction will separate the blocks better.\n      if (initiatedByThis) {\n        offsetY = -offsetY;\n      }\n    }\n    const staticConnection = moveInferior\n      ? superiorConnection\n      : inferiorConnection;\n    const dynamicConnection = moveInferior\n      ? inferiorConnection\n      : superiorConnection;\n    const dynamicRootBlock = moveInferior\n      ? inferiorRootBlock\n      : superiorRootBlock;\n    // Raise it to the top for extra visibility.\n    if (dynamicRootBlock.RTL) {\n      offsetX = -offsetX;\n    }\n    const dx = staticConnection.x + offsetX - dynamicConnection.x;\n    const dy = staticConnection.y + offsetY - dynamicConnection.y;\n    dynamicRootBlock.moveBy(dx, dy, ['bump']);\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   * @returns True if the position of the connection in the connection db\n   *     was updated.\n   */\n  moveTo(x: number, y: number): boolean {\n    // TODO(#6922): Readd this optimization.\n    // const moved = this.x !== x || this.y !== y;\n    const moved = true;\n    let updated = false;\n\n    if (this.trackedState === RenderedConnection.TrackedState.WILL_TRACK) {\n      this.db.addConnection(this, y);\n      this.trackedState = RenderedConnection.TrackedState.TRACKED;\n      updated = true;\n    } else if (\n      this.trackedState === RenderedConnection.TrackedState.TRACKED &&\n      moved\n    ) {\n      this.db.removeConnection(this, this.y);\n      this.db.addConnection(this, y);\n      updated = true;\n    }\n\n    this.x = x;\n    this.y = y;\n\n    return updated;\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   * @returns True if the position of the connection in the connection db\n   *     was updated.\n   */\n  moveBy(dx: number, dy: number): boolean {\n    return 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   * @returns True if the position of the connection in the connection db\n   *     was updated.\n   */\n  moveToOffset(blockTL: Coordinate): boolean {\n    return this.moveTo(\n      blockTL.x + this.offsetInBlock.x,\n      blockTL.y + this.offsetInBlock.y,\n    );\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   */\n  getOffsetInBlock(): Coordinate {\n    return this.offsetInBlock;\n  }\n\n  /**\n   * Moves the blocks on either side of this connection right next to\n   * each other, based on their local offsets, not global positions.\n   *\n   * @internal\n   */\n  tightenEfficiently() {\n    const target = this.targetConnection;\n    const block = this.targetBlock();\n    if (!target || !block) return;\n    const offset = Coordinate.difference(\n      this.offsetInBlock,\n      target.offsetInBlock,\n    );\n    block.translate(offset.x, offset.y);\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(\n    maxLimit: number,\n    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    this.highlighted = true;\n\n    // Note that this needs to be done synchronously (vs. queuing a render pass)\n    // since only a displayed element can be focused, and this focusable node is\n    // implemented to make itself visible immediately prior to receiving DOM\n    // focus. It's expected that the connection's position should already be\n    // correct by this point (otherwise it will be corrected in a subsequent\n    // draw pass).\n    const highlightSvg = this.findHighlightSvg();\n    if (highlightSvg) {\n      highlightSvg.style.display = '';\n    }\n  }\n\n  /** Remove the highlighting around this connection. */\n  unhighlight() {\n    this.highlighted = false;\n\n    // Note that this is done synchronously for parity with highlight().\n    const highlightSvg = this.findHighlightSvg();\n    if (highlightSvg) {\n      highlightSvg.style.display = 'none';\n    }\n  }\n\n  /** Returns true if this connection is highlighted, false otherwise. */\n  isHighlighted(): boolean {\n    return this.highlighted;\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 (\n      (doTracking &&\n        this.trackedState === RenderedConnection.TrackedState.TRACKED) ||\n      (!doTracking &&\n        this.trackedState === RenderedConnection.TrackedState.UNTRACKED)\n    ) {\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        for (const icon of block.getIcons()) {\n          if (hasBubble(icon)) icon.setBubbleVisible(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 (\n      this.type !== ConnectionType.INPUT_VALUE &&\n      this.type !== ConnectionType.NEXT_STATEMENT\n    ) {\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        if (block.outputConnection) connections.push(block.outputConnection);\n        if (block.nextConnection) connections.push(block.nextConnection);\n        if (block.previousConnection)\n          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   * Behaviour after a connection attempt fails.\n   * Bumps this connection away from the other connection. Called when an\n   * attempted connection fails.\n   *\n   * @param superiorConnection Connection that this connection failed to connect\n   *     to. The provided connection should be the superior connection.\n   * @internal\n   */\n  override onFailedConnect(superiorConnection: Connection) {\n    const block = this.getSourceBlock();\n    if (eventUtils.getRecordUndo()) {\n      const group = eventUtils.getGroup();\n      setTimeout(\n        function (this: RenderedConnection) {\n          if (!block.isDisposed() && !block.getParent()) {\n            eventUtils.setGroup(group);\n            this.bumpAwayFrom(superiorConnection as RenderedConnection);\n            eventUtils.setGroup(false);\n          }\n        }.bind(this),\n        config.bumpDelay,\n      );\n    }\n  }\n\n  /**\n   * Disconnect two blocks that are connected by this connection.\n   *\n   * @param setParent Whether to set the parent of the disconnected block or\n   *     not, defaults to true.\n   *     If you do not set the parent, ensure that a subsequent action does,\n   *     otherwise the view and model will be out of sync.\n   */\n  override disconnectInternal(setParent = true) {\n    const {parentConnection, childConnection} =\n      this.getParentAndChildConnections();\n    if (!parentConnection || !childConnection) return;\n    const existingGroup = eventUtils.getGroup();\n    if (!existingGroup) eventUtils.setGroup(true);\n\n    const parent = parentConnection.getSourceBlock() as BlockSvg;\n    const child = childConnection.getSourceBlock() as BlockSvg;\n    super.disconnectInternal(setParent);\n\n    parent.queueRender();\n    child.updateDisabled();\n    child.queueRender();\n    // Reset visibility, since the child is now a top block.\n    child.getSvgRoot().style.display = 'block';\n\n    eventUtils.setGroup(existingGroup);\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.queueRender();\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): RenderedConnection[] {\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\n    parentBlock.updateDisabled();\n    childBlock.updateDisabled();\n    childBlock.queueRender();\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 (\n      this.isConnected() &&\n      (!this.targetConnection ||\n        !this.getConnectionChecker().canConnect(\n          this,\n          this.targetConnection,\n          false,\n        ))\n    ) {\n      const child = this.isSuperior() ? this.targetBlock() : this.sourceBlock_;\n      child!.unplug();\n    }\n  }\n\n  /**\n   * Change a connection's compatibility.\n   * Rerender blocks as needed.\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  override setCheck(check: string | string[] | null): RenderedConnection {\n    super.setCheck(check);\n    this.sourceBlock_.queueRender();\n    return this;\n  }\n\n  /**\n   * Handles showing the context menu when it is opened on a connection.\n   * Note that typically the context menu can't be opened with the mouse\n   * on a connection, because you can't select a connection. But keyboard\n   * users may open the context menu with a keyboard shortcut.\n   *\n   * @param e Event that triggered the opening of the context menu.\n   */\n  showContextMenu(e: Event): void {\n    const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(\n      {focusedNode: this},\n      e,\n    );\n\n    if (!menuOptions.length) return;\n\n    const block = this.getSourceBlock();\n    const workspace = block.workspace;\n\n    let location;\n    if (e instanceof PointerEvent) {\n      location = new Coordinate(e.clientX, e.clientY);\n    } else {\n      const connectionWSCoords = new Coordinate(this.x, this.y);\n      const connectionScreenCoords = svgMath.wsToScreenCoordinates(\n        workspace,\n        connectionWSCoords,\n      );\n      location = connectionScreenCoords.translate(block.RTL ? -5 : 5, 5);\n    }\n\n    ContextMenu.show(e, menuOptions, block.RTL, workspace, location);\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    const highlightSvg = this.findHighlightSvg();\n    if (highlightSvg) return highlightSvg;\n    throw new Error('No highlight SVG found corresponding to this connection.');\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this.getSourceBlock().workspace as WorkspaceSvg;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {\n    this.highlight();\n    this.getSourceBlock().workspace.scrollBoundsIntoView(\n      this.getSourceBlock().getBoundingRectangleWithoutChildren(),\n    );\n  }\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {\n    this.unhighlight();\n  }\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\n\n  private findHighlightSvg(): SVGPathElement | null {\n    // This cast is valid as TypeScript's definition is wrong. See:\n    // https://github.com/microsoft/TypeScript/issues/60996.\n    return document.getElementById(this.id) as\n      | unknown\n      | null as SVGPathElement | null;\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 an input (value, statement, or dummy).\n *\n * @class\n */\n// Former goog.module ID: 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 {ConnectionType} from '../connection_type.js';\nimport type {Field} from '../field.js';\nimport * as fieldRegistry from '../field_registry.js';\nimport {RenderedConnection} from '../rendered_connection.js';\nimport {Align} from './align.js';\nimport {inputTypes} from './input_types.js';\n\n/** Class for an input with optional fields. */\nexport class Input {\n  fieldRow: Field[] = [];\n  /** Alignment of input's fields (left, right or centre). */\n  align = Align.LEFT;\n\n  /** Is the input visible? */\n  private visible = true;\n\n  public readonly type: inputTypes = inputTypes.CUSTOM;\n\n  public connection: Connection | null = null;\n\n  /**\n   * @param name Language-neutral identifier which may used to find this input\n   *     again.\n   * @param sourceBlock The block containing this input.\n   */\n  constructor(\n    public name: string,\n    private sourceBlock: Block,\n  ) {}\n\n  /**\n   * Get the source block for this input.\n   *\n   * @returns The block this input is part of.\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<T>(field: string | Field<T>, 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<T>(\n    index: number,\n    field: string | Field<T>,\n    opt_name?: string,\n  ): 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      })!;\n    }\n\n    field.setSourceBlock(this.sourceBlock);\n    if (this.sourceBlock.initialized) this.initField(field);\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 as 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).queueRender();\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).queueRender();\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 && this.connection instanceof RenderedConnection) {\n      // Has a connection.\n      if (visible) {\n        renderList = this.connection.startTrackingAll();\n      } else {\n        this.connection.stopTrackingAll();\n      }\n      const child = this.connection.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.queueRender();\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    for (const field of this.fieldRow) {\n      field.init();\n    }\n  }\n\n  /**\n   * Initializes the fields on this input for a headless block.\n   *\n   * @internal\n   */\n  public initModel() {\n    for (const field of this.fieldRow) {\n      field.initModel();\n    }\n  }\n\n  /** Initializes the given field. */\n  private initField(field: Field) {\n    if (this.sourceBlock.rendered) {\n      field.init();\n    } else {\n      field.initModel();\n    }\n  }\n\n  /**\n   * Sever all links to this input.\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  /**\n   * Constructs a connection based on the type of this input's source block.\n   * Properly handles constructing headless connections for headless blocks\n   * and rendered connections for rendered blocks.\n   *\n   * @returns a connection of the given type, which is either a headless\n   *     or rendered connection, based on the type of this input's source block.\n   */\n  protected makeConnection(type: ConnectionType): Connection {\n    return this.sourceBlock.makeConnection_(type);\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Block} from '../block.js';\nimport {Input} from './input.js';\nimport {inputTypes} from './input_types.js';\n\n/** Represents an input on a block with no connection. */\nexport class DummyInput extends Input {\n  readonly type = inputTypes.DUMMY;\n\n  /**\n   * @param name Language-neutral identifier which may used to find this input\n   *     again.\n   * @param block The block containing this input.\n   */\n  constructor(\n    public name: string,\n    block: Block,\n  ) {\n    super(name, block);\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Block} from '../block.js';\nimport {Input} from './input.js';\nimport {inputTypes} from './input_types.js';\n\n/**\n * Represents an input on a block that is always the last input in the row. Any\n * following input will be rendered on the next row even if the block has inline\n * inputs. Any newline character in a JSON block definition's message will\n * automatically be parsed as an end-row input.\n */\nexport class EndRowInput extends Input {\n  readonly type = inputTypes.END_ROW;\n\n  /**\n   * @param name Language-neutral identifier which may used to find this input\n   *     again.\n   * @param block The block containing this input.\n   */\n  constructor(\n    public name: string,\n    block: Block,\n  ) {\n    super(name, block);\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Block} from '../block.js';\nimport type {Connection} from '../connection.js';\nimport {ConnectionType} from '../connection_type.js';\nimport {Input} from './input.js';\nimport {inputTypes} from './input_types.js';\n\n/** Represents an input on a block with a statement connection. */\nexport class StatementInput extends Input {\n  readonly type = inputTypes.STATEMENT;\n\n  public connection: Connection;\n\n  /**\n   * @param name Language-neutral identifier which may used to find this input\n   *     again.\n   * @param block The block containing this input.\n   */\n  constructor(\n    public name: string,\n    block: Block,\n  ) {\n    // Errors are maintained for people not using typescript.\n    if (!name) throw new Error('Statement inputs must have a non-empty name');\n\n    super(name, block);\n    this.connection = this.makeConnection(ConnectionType.NEXT_STATEMENT);\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Block} from '../block.js';\nimport {ConnectionType} from '../connection_type.js';\nimport {Input} from './input.js';\nimport {inputTypes} from './input_types.js';\n\n/** Represents an input on a block with a value connection. */\nexport class ValueInput extends Input {\n  readonly type = inputTypes.VALUE;\n\n  /**\n   * @param name Language-neutral identifier which may used to find this input\n   *     again.\n   * @param block The block containing this input.\n   */\n  constructor(\n    public name: string,\n    block: Block,\n  ) {\n    // Errors are maintained for people not using typescript.\n    if (!name) throw new Error('Value inputs must have a non-empty name');\n    super(name, block);\n    this.connection = this.makeConnection(ConnectionType.INPUT_VALUE);\n  }\n}\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 */\n// Former goog.module ID: 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 * 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 {BlockChange} from './events/events_block_change.js';\nimport type {BlockMove} from './events/events_block_move.js';\nimport {EventType} from './events/type.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 {DuplicateIconType} from './icons/exceptions.js';\nimport {IconType} from './icons/icon_types.js';\nimport type {MutatorIcon} from './icons/mutator_icon.js';\nimport {Align} from './inputs/align.js';\nimport {DummyInput} from './inputs/dummy_input.js';\nimport {EndRowInput} from './inputs/end_row_input.js';\nimport {Input} from './inputs/input.js';\nimport {StatementInput} from './inputs/statement_input.js';\nimport {ValueInput} from './inputs/value_input.js';\nimport {isCommentIcon} from './interfaces/i_comment_icon.js';\nimport {type IIcon} from './interfaces/i_icon.js';\nimport type {\n  IVariableModel,\n  IVariableState,\n} from './interfaces/i_variable_model.js';\nimport * as registry from './registry.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 {Workspace} from './workspace.js';\n\n/**\n * Class for one block.\n * Not normally called directly, workspace.newBlock() is preferred.\n */\nexport class Block {\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) => void) | 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?: () => void;\n\n  /** An optional method called during disposal. */\n  destroy?: () => void;\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;\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) => void;\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   * @param doFullSerialization Whether or not to serialize the full state of\n   *     the extra state (rather than possibly saving a reference to some\n   *     state). This is used during copy-paste. See the\n   *     {@link https://developers.devsite.google.com/blockly/guides/create-custom-blocks/extensions#full_serialization_and_backing_data | block serialization docs}\n   *     for more information.\n   */\n  saveExtraState?: (doFullSerialization?: boolean) => AnyDuringMigration;\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?: (p1: AnyDuringMigration) => void;\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 method for declaring developer variables, to be used\n   * by generators.  Developer variables are never shown to the user,\n   * but are declared as global variables in the generated code.\n   *\n   * @returns a list of developer variable names.\n   */\n  getDeveloperVariables?: () => string[];\n\n  /**\n   * An optional method that reconfigures the block based on the\n   * contents of the mutator dialog.\n   *\n   * @param rootBlock The root block in the mutator flyout.\n   */\n  compose?: (rootBlock: Block) => void;\n\n  /**\n   * An optional function that populates the mutator flyout with\n   * blocks representing this block's configuration.\n   *\n   * @param workspace The mutator flyout's workspace.\n   * @returns The root block created in the flyout's workspace.\n   */\n  decompose?: (workspace: Workspace) => Block;\n\n  id: string;\n  outputConnection: Connection | null = null;\n  nextConnection: Connection | null = null;\n  previousConnection: Connection | null = null;\n  inputList: Input[] = [];\n  inputsInline?: boolean;\n  icons: IIcon[] = [];\n  private disabledReasons = new Set<string>();\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 shadow = 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  protected disposing = false;\n\n  /**\n   * Has this block been fully initialized? E.g. all fields initailized.\n   *\n   * @internal\n   */\n  initialized = false;\n\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;\n\n  /** Is this block a BlockSVG? */\n  readonly rendered: boolean = false;\n\n  /**\n   * String for block help, or function that returns a URL. Null for no help.\n   */\n  helpUrl: string | (() => string) | null = null;\n\n  /** A bound callback function to use when the parent workspace changes. */\n  private onchangeWrapper: ((p1: Abstract) => void) | 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 =\n      opt_id && !workspace.getBlockById(opt_id) ? opt_id : idGenerator.genUid();\n    workspace.setBlockById(this.id, this);\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(EventType.BLOCK_CREATE))(this));\n      }\n    } finally {\n      eventUtils.setGroup(existingGroup);\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   */\n  dispose(healStack = false) {\n    this.disposing = true;\n\n    // Dispose of this change listener before unplugging.\n    // Technically not necessary due to the event firing delay.\n    // But future-proofing.\n    if (this.onchangeWrapper) {\n      this.workspace.removeChangeListener(this.onchangeWrapper);\n    }\n\n    this.unplug(healStack);\n    if (eventUtils.isEnabled()) {\n      // Constructing the delete event is costly. Only perform if necessary.\n      eventUtils.fire(new (eventUtils.get(EventType.BLOCK_DELETE))(this));\n    }\n    this.workspace.removeTopBlock(this);\n    this.disposeInternal();\n  }\n\n  /**\n   * Disposes of this block without doing things required by the top block.\n   * E.g. does not fire events, unplug the block, etc.\n   */\n  protected disposeInternal() {\n    this.disposing = true;\n    if (this.onchangeWrapper) {\n      this.workspace.removeChangeListener(this.onchangeWrapper);\n    }\n\n    this.workspace.removeTypedBlock(this);\n    this.workspace.removeBlockById(this.id);\n\n    if (typeof this.destroy === 'function') this.destroy();\n\n    this.childBlocks_.forEach((c) => c.disposeInternal());\n    this.inputList.forEach((i) => i.dispose());\n    this.inputList.length = 0;\n    this.getConnections_(true).forEach((c) => c.dispose());\n    this.disposed = true;\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    if (this.initialized) return;\n    for (const input of this.inputList) {\n      input.initModel();\n    }\n    this.initialized = true;\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 (\n      !thisConnection ||\n      !thisConnection.isConnected() ||\n      thisConnection.targetBlock()!.isShadow()\n    ) {\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 (\n      this.workspace.connectionChecker.canConnect(\n        childConnection,\n        parentConnection,\n        false,\n      )\n    ) {\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 (\n        thisConnection &&\n        thisConnection.type === ConnectionType.INPUT_VALUE &&\n        thisConnection.targetConnection\n      ) {\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\n    if (!opt_healStack) return;\n\n    // Immovable or shadow next blocks need to move along with the block; keep\n    // going until we encounter a normal block or run off the end of the stack.\n    let nextBlock = this.getNextBlock();\n    while (nextBlock && (nextBlock.isShadow() || !nextBlock.isMovable())) {\n      nextBlock = nextBlock.getNextBlock();\n    }\n    if (!nextBlock) return;\n\n    // Disconnect the next statement.\n    const nextTarget =\n      nextBlock.previousConnection?.targetBlock()?.nextConnection\n        ?.targetConnection ?? null;\n    nextTarget?.disconnect();\n    if (\n      previousTarget &&\n      this.workspace.connectionChecker.canConnect(\n        previousTarget,\n        nextTarget,\n        false,\n      )\n    ) {\n      // Attach the next statement to the previous statement.\n      previousTarget.connect(nextTarget!);\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\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 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 (\n      previous &&\n      previous.getNextBlock() === block &&\n      (block = previous as AnyDuringMigration)\n    );\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\n    // This block hasn't actually moved on-screen, so there's no need to\n    // update 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\n      // workspace's 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 (\n      this.deletable &&\n      !this.isInFlyout &&\n      !this.shadow &&\n      !this.isDeadOrDying() &&\n      !this.workspace.isReadOnly()\n    );\n  }\n\n  /**\n   * Return whether this block's own deletable property is true or false.\n   *\n   * @returns True if the block's deletable property is true, false otherwise.\n   */\n  isOwnDeletable(): boolean {\n    return this.deletable;\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   * @internal\n   */\n  isMovable(): boolean {\n    return (\n      this.movable &&\n      !this.isInFlyout &&\n      !this.shadow &&\n      !this.isDeadOrDying() &&\n      !this.workspace.isReadOnly()\n    );\n  }\n\n  /**\n   * Return whether this block's own movable property is true or false.\n   *\n   * @returns True if the block's movable property is true, false otherwise.\n   * @internal\n   */\n  isOwnMovable(): boolean {\n    return this.movable;\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  /**\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.shadow;\n  }\n\n  /**\n   * Set whether this block is a shadow block or not.\n   * This method is internal and should not be called by users of Blockly. To\n   * create shadow blocks programmatically call connection.setShadowState\n   *\n   * @param shadow True if a shadow.\n   * @internal\n   */\n  setShadow(shadow: boolean) {\n    this.shadow = 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   * @internal\n   */\n  isEditable(): boolean {\n    return (\n      this.editable && !this.isDeadOrDying() && !this.workspace.isReadOnly()\n    );\n  }\n\n  /**\n   * Return whether this block's own editable property is true or false.\n   *\n   * @returns True if the block's editable property is true, false otherwise.\n   */\n  isOwnEditable(): boolean {\n    return this.editable;\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 (const field of this.getFields()) {\n      field.updateEditable();\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   * @returns True if this block is a value block with a single editable field.\n   * @internal\n   */\n  isSimpleReporter(): boolean {\n    if (!this.outputConnection) return false;\n\n    for (const input of this.inputList) {\n      if (input.connection || input.fieldRow.length > 1) return false;\n    }\n    return true;\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(\n    otherBlock: Block,\n    conn: Connection,\n  ): 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 | (() => string)) {\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) => void) {\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    }\n    for (const field of this.getFields()) {\n      if (field.name === name) {\n        return field;\n      }\n    }\n    return null;\n  }\n\n  /**\n   * Returns a generator that provides every field on the block.\n   *\n   * @returns A generator that can be used to iterate the fields on the block.\n   */\n  *getFields(): Generator<Field, undefined, void> {\n    for (const input of this.inputList) {\n      for (const field of input.fieldRow) {\n        yield field;\n      }\n    }\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: string[] = [];\n    for (const field of this.getFields()) {\n      if (field.referencesVariables()) {\n        vars.push(field.getValue());\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(): IVariableModel<IVariableState>[] {\n    const vars = [];\n    for (const field of this.getFields()) {\n      if (field.referencesVariables()) {\n        const model = this.workspace.getVariableById(\n          field.getValue() as string,\n        );\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    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: IVariableModel<IVariableState>) {\n    for (const field of this.getFields()) {\n      if (\n        field.referencesVariables() &&\n        variable.getId() === field.getValue()\n      ) {\n        field.refreshVariableName();\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 (const field of this.getFields()) {\n      if (field.referencesVariables() && oldId === field.getValue()) {\n        field.setValue(newId);\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(\n    newBoolean: boolean,\n    opt_check?: string | string[] | null,\n  ) {\n    if (newBoolean) {\n      if (opt_check === undefined) {\n        opt_check = null;\n      }\n      if (!this.previousConnection) {\n        this.previousConnection = this.makeConnection_(\n          ConnectionType.PREVIOUS_STATEMENT,\n        );\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        }\n        this.previousConnection.dispose();\n        this.previousConnection = null;\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 = this.makeConnection_(\n          ConnectionType.NEXT_STATEMENT,\n        );\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 ' + 'connection.',\n          );\n        }\n        this.nextConnection.dispose();\n        this.nextConnection = null;\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 = this.makeConnection_(\n          ConnectionType.OUTPUT_VALUE,\n        );\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        }\n        this.outputConnection.dispose();\n        this.outputConnection = null;\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(\n        new (eventUtils.get(EventType.BLOCK_CHANGE))(\n          this,\n          'inline',\n          null,\n          this.inputsInline,\n          newBoolean,\n        ),\n      );\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 (\n        this.inputList[i - 1] instanceof DummyInput &&\n        this.inputList[i] instanceof DummyInput\n      ) {\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 (\n        this.inputList[i - 1] instanceof ValueInput &&\n        this.inputList[i] instanceof DummyInput\n      ) {\n        // Dummy input after a value input.  Inline them.\n        return true;\n      }\n    }\n    for (let i = 0; i < this.inputList.length; i++) {\n      if (this.inputList[i] instanceof EndRowInput) {\n        // A row-end input is present. Inline value inputs.\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. A block is considered enabled\n   * if there aren't any reasons why it would be disabled. A block may still\n   * be disabled for other reasons even if the user attempts to manually\n   * enable it, such as when the block is in an invalid location.\n   *\n   * @returns True if enabled.\n   */\n  isEnabled(): boolean {\n    return this.disabledReasons.size === 0;\n  }\n\n  /**\n   * Add or remove a reason why the block might be disabled. If a block has\n   * any reasons to be disabled, then the block itself will be considered\n   * disabled. A block could be disabled for multiple independent reasons\n   * simultaneously, such as when the user manually disables it, or the block\n   * is invalid.\n   *\n   * @param disabled If true, then the block should be considered disabled for\n   *     at least the provided reason, otherwise the block is no longer disabled\n   *     for that reason.\n   * @param reason A language-neutral identifier for a reason why the block\n   *     could be disabled. Call this method again with the same identifier to\n   *     update whether the block is currently disabled for this reason.\n   */\n  setDisabledReason(disabled: boolean, reason: string): void {\n    // Workspaces that were serialized before the reason for being disabled\n    // could be specified may have blocks that are disabled without a known\n    // reason. On being loaded, these blocks will default to having the manually\n    // disabled reason. However, if the user isn't allowed to manually disable\n    // or enable blocks, then this manually disabled reason cannot be removed.\n    // For backward compatibility with these legacy workspaces, when removing\n    // any disabled reason and the workspace does not allow manually disabling\n    // but the block is manually disabled, then remove the manually disabled\n    // reason in addition to the more specific reason. For example, when an\n    // orphaned block is no longer orphaned, the block should be enabled again.\n    if (\n      !disabled &&\n      !this.workspace.options.disable &&\n      this.hasDisabledReason(constants.MANUALLY_DISABLED) &&\n      reason != constants.MANUALLY_DISABLED\n    ) {\n      this.setDisabledReason(false, constants.MANUALLY_DISABLED);\n    }\n\n    if (this.disabledReasons.has(reason) !== disabled) {\n      if (disabled) {\n        this.disabledReasons.add(reason);\n      } else {\n        this.disabledReasons.delete(reason);\n      }\n      const blockChangeEvent = new (eventUtils.get(EventType.BLOCK_CHANGE))(\n        this,\n        'disabled',\n        /* name= */ null,\n        /* oldValue= */ !disabled,\n        /* newValue= */ disabled,\n      ) as BlockChange;\n      blockChangeEvent.setDisabledReason(reason);\n      eventUtils.fire(blockChangeEvent);\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.isEnabled()) {\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 currently disabled for the provided reason.\n   *\n   * @param reason A language-neutral identifier for a reason why the block\n   *     could be disabled.\n   * @returns Whether the block is disabled for the provided reason.\n   */\n  hasDisabledReason(reason: string): boolean {\n    return this.disabledReasons.has(reason);\n  }\n\n  /**\n   * Get a set of reasons why the block is currently disabled, if any. If the\n   * block is enabled, this set will be empty.\n   *\n   * @returns The set of reasons why the block is disabled, if any.\n   */\n  getDisabledReasons(): ReadonlySet<string> {\n    return this.disabledReasons;\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(\n        new (eventUtils.get(EventType.BLOCK_CHANGE))(\n          this,\n          'collapsed',\n          null,\n          this.collapsed_,\n          collapsed,\n        ),\n      );\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 input.\n   *     If not specified, '?' is used.\n   * @returns Text of block.\n   */\n  toString(opt_maxLength?: number, opt_emptyToken?: string): string {\n    const tokens = this.toTokens(opt_emptyToken);\n\n    // Run through our tokens array and simplify expression to remove\n    // parentheses 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 the spaces around added parentheses.\n    let prev = '';\n    let text: string = tokens.reduce((acc, curr) => {\n      const val = acc + (prev === '(' || curr === ')' ? '' : ' ') + curr;\n      prev = curr[curr.length - 1];\n      return val;\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   * Converts this block into string tokens.\n   *\n   * @param emptyToken The token to use in place of an empty input.\n   *     Defaults to '?'.\n   * @returns The array of string tokens representing this block.\n   */\n  private toTokens(emptyToken = '?'): string[] {\n    const tokens = [];\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 (\n        !!checks && (checks.includes('Boolean') || checks.includes('Number'))\n      );\n    }\n\n    for (const input of this.inputList) {\n      if (input.name == constants.COLLAPSED_INPUT_NAME) {\n        continue;\n      }\n      for (const field of input.fieldRow) {\n        tokens.push(field.getText());\n      }\n      if (input.connection) {\n        const child = input.connection.targetBlock();\n        if (child) {\n          const shouldAddParens = shouldAddParentheses(input.connection);\n          if (shouldAddParens) tokens.push('(');\n          tokens.push(...child.toTokens(emptyToken));\n          if (shouldAddParens) tokens.push(')');\n        } else {\n          tokens.push(emptyToken);\n        }\n      }\n    }\n    return tokens;\n  }\n\n  /**\n   * Appends 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(new ValueInput(name, this));\n  }\n\n  /**\n   * Appends 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    this.statementInputCount++;\n    return this.appendInput(new StatementInput(name, this));\n  }\n\n  /**\n   * Appends a dummy input row.\n   *\n   * @param name Optional language-neutral identifier which may used to find\n   *     this input again.  Should be unique to this block.\n   * @returns The input object created.\n   */\n  appendDummyInput(name = ''): Input {\n    return this.appendInput(new DummyInput(name, this));\n  }\n\n  /**\n   * Appends an input that ends the row.\n   *\n   * @param name Optional language-neutral identifier which may used to find\n   *     this input again.  Should be unique to this block.\n   * @returns The input object created.\n   */\n  appendEndRowInput(name = ''): Input {\n    return this.appendInput(new EndRowInput(name, this));\n  }\n\n  /**\n   * Appends the given input row.\n   *\n   * Allows for custom inputs to be appended to the block.\n   */\n  appendInput(input: Input): Input {\n    this.inputList.push(input);\n    return input;\n  }\n\n  /**\n   * Appends an input with the given input type and name to the block after\n   * constructing it from the registry.\n   *\n   * @param type The name the input is registered under in the registry.\n   * @param name The name the input will have within the block.\n   * @returns The constucted input, or null if there was no constructor\n   *     associated with the type.\n   */\n  private appendInputFromRegistry(type: string, name: string): Input | null {\n    const inputConstructor = registry.getClass(\n      registry.Type.INPUT,\n      type,\n      false,\n    );\n    if (!inputConstructor) return null;\n    return this.appendInput(new inputConstructor(name, this));\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 + 'Must not have both an output and a previousStatement.',\n      );\n    }\n\n    // Validate that each arg has a corresponding message\n    let n = 0;\n    while (json['args' + n]) {\n      if (json['message' + n] === undefined) {\n        throw Error(\n          warningPrefix +\n            `args${n} must have a corresponding message (message${n}).`,\n        );\n      }\n      n++;\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],\n        json['args' + i] || [],\n        // Backwards compatibility: lastDummyAlign aliases implicitAlign.\n        json['implicitAlign' + i] || json['lastDummyAlign' + i],\n        warningPrefix,\n      );\n      i++;\n    }\n\n    if (json['inputsInline'] !== undefined) {\n      eventUtils.disable();\n      this.setInputsInline(json['inputsInline']);\n      eventUtils.enable();\n    }\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 '\" +\n          json['type'] +\n          \"' block.\",\n      );\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 {\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 {\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 (\n      opt_disableCheck !== undefined &&\n      typeof opt_disableCheck !== 'boolean'\n    ) {\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: ' + JSON.stringify(overwrites),\n        );\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 implicitAlign If an implicit input is added at the end or in place\n   *     of newline tokens, how should it be aligned?\n   * @param warningPrefix Warning prefix string identifying block.\n   */\n  private interpolate(\n    message: string,\n    args: AnyDuringMigration[],\n    implicitAlign: string | undefined,\n    warningPrefix: string,\n  ) {\n    const tokens = parsing.tokenizeInterpolation(message);\n    this.validateTokens(tokens, args.length);\n    const elements = this.interpolateArguments(tokens, args, implicitAlign);\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 \"' +\n            this.type +\n            '\": ' +\n            'Message index %' +\n            token +\n            ' out of range.',\n        );\n      }\n      if (visitedArgsHash[token]) {\n        throw Error(\n          'Block \"' +\n            this.type +\n            '\": ' +\n            'Message index %' +\n            token +\n            ' duplicated.',\n        );\n      }\n      visitedArgsHash[token] = true;\n      visitedArgsCount++;\n    }\n    if (visitedArgsCount !== argsCount) {\n      throw Error(\n        'Block \"' +\n          this.type +\n          '\": ' +\n          'Message does not reference all ' +\n          argsCount +\n          ' arg(s).',\n      );\n    }\n  }\n\n  /**\n   * Inserts args in place of numerical tokens. String args are converted to\n   * JSON that defines a label field. Newline characters are converted to\n   * end-row inputs, and if necessary an extra dummy input is added to the end\n   * of the elements.\n   *\n   * @param tokens The tokens to interpolate\n   * @param args The arguments to insert.\n   * @param implicitAlign The alignment to use for any implicitly added end-row\n   *     or dummy inputs, if necessary.\n   * @returns The JSON definitions of field and inputs to add to the block.\n   */\n  private interpolateArguments(\n    tokens: Array<string | number>,\n    args: Array<AnyDuringMigration | string>,\n    implicitAlign: string | undefined,\n  ): 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        if (element === '\\n') {\n          // Convert newline tokens to end-row inputs.\n          const newlineInput = {'type': 'input_end_row'};\n          if (implicitAlign) {\n            (newlineInput as AnyDuringMigration)['align'] = implicitAlign;\n          }\n          element = newlineInput as AnyDuringMigration;\n        } else {\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      }\n      elements.push(element);\n    }\n\n    const length = elements.length;\n    if (\n      length &&\n      !this.isInputKeyword((elements as AnyDuringMigration)[length - 1]['type'])\n    ) {\n      const dummyInput = {'type': 'input_dummy'};\n      if (implicitAlign) {\n        (dummyInput as AnyDuringMigration)['align'] = implicitAlign;\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: {\n    alt?: string;\n    type: string;\n    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(\n    element: AnyDuringMigration,\n    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      case 'input_end_row':\n        input = this.appendEndRowInput(element['name']);\n        break;\n      default: {\n        input = this.appendInputFromRegistry(element['type'], element['name']);\n        break;\n      }\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 = (alignmentLookup as AnyDuringMigration)[\n        element['align'].toUpperCase()\n      ];\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 (\n      str === 'input_value' ||\n      str === 'input_statement' ||\n      str === 'input_dummy' ||\n      str === 'input_end_row' ||\n      registry.hasItem(registry.Type.INPUT, str)\n    );\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   * 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 instanceof StatementInput) this.statementInputCount--;\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    const comment = this.getIcon(IconType.COMMENT);\n    return comment?.getText() ?? null;\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    const comment = this.getIcon(IconType.COMMENT);\n    const oldText = comment?.getText() ?? null;\n    if (oldText === text) return;\n    if (text !== null) {\n      let comment = this.getIcon(IconType.COMMENT);\n      if (!comment) {\n        const commentConstructor = registry.getClass(\n          registry.Type.ICON,\n          IconType.COMMENT.toString(),\n          false,\n        );\n        if (!commentConstructor) {\n          throw new Error(\n            'No comment icon class is registered, so a comment cannot be set',\n          );\n        }\n        const icon = new commentConstructor(this);\n        if (!isCommentIcon(icon)) {\n          throw new Error(\n            'The class registered as a comment icon does not conform to the ' +\n              'ICommentIcon interface',\n          );\n        }\n        comment = this.addIcon(icon);\n      }\n      eventUtils.disable();\n      comment.setText(text);\n      eventUtils.enable();\n    } else {\n      this.removeIcon(IconType.COMMENT);\n    }\n\n    eventUtils.fire(\n      new (eventUtils.get(EventType.BLOCK_CHANGE))(\n        this,\n        'comment',\n        null,\n        oldText,\n        text,\n      ),\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  setWarningText(_text: string | null, _opt_id?: string) {\n    // NOOP.\n  }\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: MutatorIcon) {\n    // NOOP.\n  }\n\n  /** Adds the given icon to the block. */\n  addIcon<T extends IIcon>(icon: T): T {\n    if (this.hasIcon(icon.getType())) throw new DuplicateIconType(icon);\n    this.icons.push(icon);\n    this.icons.sort((a, b) => a.getWeight() - b.getWeight());\n    return icon;\n  }\n\n  /**\n   * Removes the icon whose getType matches the given type iconType from the\n   * block.\n   *\n   * @param type The type of the icon to remove from the block.\n   * @returns True if an icon with the given type was found, false otherwise.\n   */\n  removeIcon(type: IconType<IIcon>): boolean {\n    if (!this.hasIcon(type)) return false;\n    this.getIcon(type)?.dispose();\n    this.icons = this.icons.filter((icon) => !icon.getType().equals(type));\n    return true;\n  }\n\n  /**\n   * @returns True if an icon with the given type exists on the block,\n   *     false otherwise.\n   */\n  hasIcon(type: IconType<IIcon>): boolean {\n    return this.icons.some((icon) => icon.getType().equals(type));\n  }\n\n  /**\n   * @param type The type of the icon to retrieve. Prefer passing an `IconType`\n   *     for proper type checking when using typescript.\n   * @returns The icon with the given type if it exists on the block, undefined\n   *     otherwise.\n   */\n  getIcon<T extends IIcon>(type: IconType<T> | string): T | undefined {\n    if (type instanceof IconType) {\n      return this.icons.find((icon) => icon.getType().equals(type)) as T;\n    } else {\n      return this.icons.find((icon) => icon.getType().toString() === type) as T;\n    }\n  }\n\n  /** @returns An array of the icons attached to this block. */\n  getIcons(): IIcon[] {\n    return [...this.icons];\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   *\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   * @param reason Why is this move happening?  'drag', 'bump', 'snap', ...\n   */\n  moveBy(dx: number, dy: number, reason?: string[]) {\n    if (this.parentBlock_) {\n      throw Error('Block has parent');\n    }\n    const event = new (eventUtils.get(EventType.BLOCK_MOVE))(this) as BlockMove;\n    if (reason) event.setReason(reason);\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   * @internal\n   */\n  makeConnection_(type: ConnectionType): 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 {@link (Block:class).toString | 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 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Block} from '../block.js';\nimport * as blockAnimation from '../block_animations.js';\nimport {BlockSvg} from '../block_svg.js';\nimport * as bumpObjects from '../bump_objects.js';\nimport {config} from '../config.js';\nimport {Connection} from '../connection.js';\nimport {ConnectionType} from '../connection_type.js';\nimport type {BlockMove} from '../events/events_block_move.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport {IConnectionPreviewer} from '../interfaces/i_connection_previewer.js';\nimport {IDragStrategy} from '../interfaces/i_draggable.js';\nimport * as layers from '../layers.js';\nimport * as registry from '../registry.js';\nimport {finishQueuedRenders} from '../render_management.js';\nimport {RenderedConnection} from '../rendered_connection.js';\nimport {Coordinate} from '../utils.js';\nimport * as dom from '../utils/dom.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\n/** Represents a nearby valid connection. */\ninterface ConnectionCandidate {\n  /** A connection on the dragging stack that is compatible with neighbour. */\n  local: RenderedConnection;\n\n  /** A nearby connection that is compatible with local. */\n  neighbour: RenderedConnection;\n\n  /** The distance between the local connection and the neighbour connection. */\n  distance: number;\n}\n\nexport class BlockDragStrategy implements IDragStrategy {\n  private workspace: WorkspaceSvg;\n\n  /** The parent block at the start of the drag. */\n  private startParentConn: RenderedConnection | null = null;\n\n  /**\n   * The child block at the start of the drag. Only gets set if\n   * `healStack` is true.\n   */\n  private startChildConn: RenderedConnection | null = null;\n\n  private startLoc: Coordinate | null = null;\n\n  private connectionCandidate: ConnectionCandidate | null = null;\n\n  private connectionPreviewer: IConnectionPreviewer | null = null;\n\n  private dragging = false;\n\n  /**\n   * If this is a shadow block, the offset between this block and the parent\n   * block, to add to the drag location. In workspace units.\n   */\n  private dragOffset = new Coordinate(0, 0);\n\n  /** Used to persist an event group when snapping is done async. */\n  private originalEventGroup = '';\n\n  constructor(private block: BlockSvg) {\n    this.workspace = block.workspace;\n  }\n\n  /** Returns true if the block is currently movable. False otherwise. */\n  isMovable(): boolean {\n    if (this.block.isShadow()) {\n      return this.block.getParent()?.isMovable() ?? false;\n    }\n\n    return (\n      this.block.isOwnMovable() &&\n      !this.block.isDeadOrDying() &&\n      !this.workspace.isReadOnly() &&\n      // We never drag blocks in the flyout, only create new blocks that are\n      // dragged.\n      !this.block.isInFlyout\n    );\n  }\n\n  /**\n   * Handles any setup for starting the drag, including disconnecting the block\n   * from any parent blocks.\n   */\n  startDrag(e?: PointerEvent): void {\n    if (this.block.isShadow()) {\n      this.startDraggingShadow(e);\n      return;\n    }\n\n    this.dragging = true;\n    this.fireDragStartEvent();\n\n    this.startLoc = this.block.getRelativeToSurfaceXY();\n\n    this.connectionCandidate = null;\n    const previewerConstructor = registry.getClassFromOptions(\n      registry.Type.CONNECTION_PREVIEWER,\n      this.workspace.options,\n    );\n    this.connectionPreviewer = new previewerConstructor!(this.block);\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    const healStack = this.shouldHealStack(e);\n\n    if (this.shouldDisconnect(healStack)) {\n      this.disconnectBlock(healStack);\n    }\n    this.block.setDragging(true);\n    this.workspace.getLayerManager()?.moveToDragLayer(this.block);\n  }\n\n  /**\n   * Get whether the drag should act on a single block or a block stack.\n   *\n   * @param e The instigating pointer event, if any.\n   * @returns True if just the initial block should be dragged out, false\n   *     if all following blocks should also be dragged.\n   */\n  protected shouldHealStack(e: PointerEvent | undefined) {\n    return !!e && (e.altKey || e.ctrlKey || e.metaKey);\n  }\n\n  /** Starts a drag on a shadow, recording the drag offset. */\n  private startDraggingShadow(e?: PointerEvent) {\n    const parent = this.block.getParent();\n    if (!parent) {\n      throw new Error(\n        'Tried to drag a shadow block with no parent. ' +\n          'Shadow blocks should always have parents.',\n      );\n    }\n    this.dragOffset = Coordinate.difference(\n      parent.getRelativeToSurfaceXY(),\n      this.block.getRelativeToSurfaceXY(),\n    );\n    parent.startDrag(e);\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  private shouldDisconnect(healStack: boolean): boolean {\n    return !!(\n      this.block.getParent() ||\n      (healStack &&\n        this.block.nextConnection &&\n        this.block.nextConnection.targetBlock())\n    );\n  }\n\n  /**\n   * Disconnects the block from any parents. If `healStack` is true and this is\n   * a stack block, we also disconnect from any next blocks and attempt to\n   * attach them to any parent.\n   *\n   * @param healStack Whether or not to heal the stack after disconnecting.\n   */\n  private disconnectBlock(healStack: boolean) {\n    this.startParentConn =\n      this.block.outputConnection?.targetConnection ??\n      this.block.previousConnection?.targetConnection;\n    if (healStack) {\n      this.startChildConn = this.block.nextConnection?.targetConnection;\n    }\n\n    this.block.unplug(healStack);\n    blockAnimation.disconnectUiEffect(this.block);\n  }\n\n  /** Fire a UI event at the start of a block drag. */\n  private fireDragStartEvent() {\n    const event = new (eventUtils.get(EventType.BLOCK_DRAG))(\n      this.block,\n      true,\n      this.block.getDescendants(false),\n    );\n    eventUtils.fire(event);\n  }\n\n  /** Fire a UI event at the end of a block drag. */\n  private fireDragEndEvent() {\n    const event = new (eventUtils.get(EventType.BLOCK_DRAG))(\n      this.block,\n      false,\n      this.block.getDescendants(false),\n    );\n    eventUtils.fire(event);\n  }\n\n  /** Fire a move event at the end of a block drag. */\n  private fireMoveEvent() {\n    if (this.block.isDeadOrDying()) return;\n    const event = new (eventUtils.get(EventType.BLOCK_MOVE))(\n      this.block,\n    ) as BlockMove;\n    event.setReason(['drag']);\n    event.oldCoordinate = this.startLoc!;\n    event.recordNew();\n    eventUtils.fire(event);\n  }\n\n  /** Moves the block and updates any connection previews. */\n  drag(newLoc: Coordinate): void {\n    if (this.block.isShadow()) {\n      this.block.getParent()?.drag(Coordinate.sum(newLoc, this.dragOffset));\n      return;\n    }\n\n    this.block.moveDuringDrag(newLoc);\n    this.updateConnectionPreview(\n      this.block,\n      Coordinate.difference(newLoc, this.startLoc!),\n    );\n  }\n\n  /**\n   * @param draggingBlock The block being dragged.\n   * @param delta How far the pointer has moved from the position\n   *     at the start of the drag, in workspace units.\n   */\n  private updateConnectionPreview(draggingBlock: BlockSvg, delta: Coordinate) {\n    const currCandidate = this.connectionCandidate;\n    const newCandidate = this.getConnectionCandidate(draggingBlock, delta);\n    if (!newCandidate) {\n      this.connectionPreviewer?.hidePreview();\n      this.connectionCandidate = null;\n      return;\n    }\n    const candidate =\n      currCandidate &&\n      this.currCandidateIsBetter(currCandidate, delta, newCandidate)\n        ? currCandidate\n        : newCandidate;\n    this.connectionCandidate = candidate;\n\n    const {local, neighbour} = candidate;\n    const localIsOutputOrPrevious =\n      local.type === ConnectionType.OUTPUT_VALUE ||\n      local.type === ConnectionType.PREVIOUS_STATEMENT;\n    const neighbourIsConnectedToRealBlock =\n      neighbour.isConnected() && !neighbour.targetBlock()?.isInsertionMarker();\n    if (\n      localIsOutputOrPrevious &&\n      neighbourIsConnectedToRealBlock &&\n      !this.orphanCanConnectAtEnd(\n        draggingBlock,\n        neighbour.targetBlock()!,\n        local.type,\n      )\n    ) {\n      this.connectionPreviewer?.previewReplacement(\n        local,\n        neighbour,\n        neighbour.targetBlock()!,\n      );\n      return;\n    }\n    this.connectionPreviewer?.previewConnection(local, neighbour);\n  }\n\n  /**\n   * Returns true if the given orphan block can connect at the end of the\n   * top block's stack or row, false otherwise.\n   */\n  private orphanCanConnectAtEnd(\n    topBlock: BlockSvg,\n    orphanBlock: BlockSvg,\n    localType: number,\n  ): boolean {\n    const orphanConnection =\n      localType === ConnectionType.OUTPUT_VALUE\n        ? orphanBlock.outputConnection\n        : orphanBlock.previousConnection;\n    return !!Connection.getConnectionForOrphanedConnection(\n      topBlock as Block,\n      orphanConnection as Connection,\n    );\n  }\n\n  /**\n   * Returns true if the current candidate is better than the new candidate.\n   *\n   * We slightly prefer the current candidate even if it is farther away.\n   */\n  private currCandidateIsBetter(\n    currCandiate: ConnectionCandidate,\n    delta: Coordinate,\n    newCandidate: ConnectionCandidate,\n  ): boolean {\n    const {local: currLocal, neighbour: currNeighbour} = currCandiate;\n    const localPos = new Coordinate(currLocal.x, currLocal.y);\n    const neighbourPos = new Coordinate(currNeighbour.x, currNeighbour.y);\n    const currDistance = Coordinate.distance(\n      Coordinate.sum(localPos, delta),\n      neighbourPos,\n    );\n    return (\n      newCandidate.distance > currDistance - config.currentConnectionPreference\n    );\n  }\n\n  /**\n   * Returns the closest valid candidate connection, if one can be found.\n   *\n   * Valid neighbour connections are within the configured start radius, with a\n   * compatible type (input, output, etc) and connection check.\n   */\n  private getConnectionCandidate(\n    draggingBlock: BlockSvg,\n    delta: Coordinate,\n  ): ConnectionCandidate | null {\n    const localConns = this.getLocalConnections(draggingBlock);\n    let radius = this.getSearchRadius();\n    let candidate = null;\n\n    for (const conn of localConns) {\n      const {connection: neighbour, radius: rad} = conn.closest(radius, delta);\n      if (neighbour) {\n        candidate = {\n          local: conn,\n          neighbour: neighbour,\n          distance: rad,\n        };\n        radius = rad;\n      }\n    }\n\n    return candidate;\n  }\n\n  /**\n   * Get the radius to use when searching for a nearby valid connection.\n   */\n  protected getSearchRadius() {\n    return this.connectionCandidate\n      ? config.connectingSnapRadius\n      : config.snapRadius;\n  }\n\n  /**\n   * Returns all of the connections we might connect to blocks on the workspace.\n   *\n   * Includes any connections on the dragging block, and any last next\n   * connection on the stack (if one exists).\n   */\n  private getLocalConnections(draggingBlock: BlockSvg): RenderedConnection[] {\n    const available = draggingBlock.getConnections_(false);\n    const lastOnStack = draggingBlock.lastConnectionInStack(true);\n    if (lastOnStack && lastOnStack !== draggingBlock.nextConnection) {\n      available.push(lastOnStack);\n    }\n    return available;\n  }\n\n  /**\n   * Cleans up any state at the end of the drag. Applies any pending\n   * connections.\n   */\n  endDrag(e?: PointerEvent): void {\n    if (this.block.isShadow()) {\n      this.block.getParent()?.endDrag(e);\n      return;\n    }\n    this.originalEventGroup = eventUtils.getGroup();\n\n    this.fireDragEndEvent();\n    this.fireMoveEvent();\n\n    dom.stopTextWidthCache();\n\n    blockAnimation.disconnectUiStop();\n    this.connectionPreviewer?.hidePreview();\n\n    if (!this.block.isDeadOrDying() && this.dragging) {\n      // These are expensive and don't need to be done if we're deleting, or\n      // if we've already stopped dragging because we moved back to the start.\n      this.workspace\n        .getLayerManager()\n        ?.moveOffDragLayer(this.block, layers.BLOCK);\n      this.block.setDragging(false);\n    }\n\n    if (this.connectionCandidate) {\n      // Applying connections also rerenders the relevant blocks.\n      this.applyConnections(this.connectionCandidate);\n      this.disposeStep();\n    } else {\n      this.block.queueRender().then(() => this.disposeStep());\n    }\n  }\n\n  /** Disposes of any state at the end of the drag. */\n  private disposeStep() {\n    const newGroup = eventUtils.getGroup();\n    eventUtils.setGroup(this.originalEventGroup);\n    this.block.snapToGrid();\n\n    // Must dispose after connections are applied to not break the dynamic\n    // connections plugin. See #7859\n    this.connectionPreviewer?.dispose();\n    this.workspace.setResizesEnabled(true);\n    eventUtils.setGroup(newGroup);\n  }\n\n  /** Connects the given candidate connections. */\n  private applyConnections(candidate: ConnectionCandidate) {\n    const {local, neighbour} = candidate;\n    local.connect(neighbour);\n\n    const inferiorConnection = local.isSuperior() ? neighbour : local;\n    const rootBlock = this.block.getRootBlock();\n\n    finishQueuedRenders().then(() => {\n      blockAnimation.connectionUiEffect(inferiorConnection.getSourceBlock());\n      // bringToFront is incredibly expensive. Delay until the next frame.\n      setTimeout(() => {\n        rootBlock.bringToFront();\n      }, 0);\n    });\n  }\n\n  /**\n   * Moves the block back to where it was at the beginning of the drag,\n   * including reconnecting connections.\n   */\n  revertDrag(): void {\n    if (this.block.isShadow()) {\n      this.block.getParent()?.revertDrag();\n      return;\n    }\n\n    this.connectionPreviewer?.hidePreview();\n    this.connectionCandidate = null;\n\n    this.startChildConn?.connect(this.block.nextConnection);\n    if (this.startParentConn) {\n      switch (this.startParentConn.type) {\n        case ConnectionType.INPUT_VALUE:\n          this.startParentConn.connect(this.block.outputConnection);\n          break;\n        case ConnectionType.NEXT_STATEMENT:\n          this.startParentConn.connect(this.block.previousConnection);\n      }\n    } else {\n      this.block.moveTo(this.startLoc!, ['drag']);\n      this.workspace\n        .getLayerManager()\n        ?.moveOffDragLayer(this.block, layers.BLOCK);\n      // Blocks dragged directly from a flyout may need to be bumped into\n      // bounds.\n      bumpObjects.bumpIntoBounds(\n        this.workspace,\n        this.workspace.getMetricsManager().getScrollMetrics(true),\n        this.block,\n      );\n    }\n\n    this.startChildConn = null;\n    this.startParentConn = null;\n\n    this.block.setDragging(false);\n    this.dragging = false;\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Coordinate} from '../utils/coordinate.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 {WorkspaceSvg} from '../workspace_svg.js';\nimport {Bubble} from './bubble.js';\n\n/**\n * A bubble that displays non-editable text. Used by the warning icon.\n */\nexport class TextBubble extends Bubble {\n  private paragraph: SVGGElement;\n\n  constructor(\n    private text: string,\n    public readonly workspace: WorkspaceSvg,\n    protected anchor: Coordinate,\n    protected ownerRect?: Rect,\n  ) {\n    super(workspace, anchor, ownerRect);\n    this.paragraph = this.stringToSvg(text, this.contentContainer);\n    this.updateBubbleSize();\n    dom.addClass(this.svgRoot, 'blocklyTextBubble');\n  }\n\n  /** @returns the current text of this text bubble. */\n  getText(): string {\n    return this.text;\n  }\n\n  /** Sets the current text of this text bubble, and updates the display. */\n  setText(text: string) {\n    this.text = text;\n    dom.removeNode(this.paragraph);\n    this.paragraph = this.stringToSvg(text, this.contentContainer);\n    this.updateBubbleSize();\n  }\n\n  /**\n   * Converts the given string into an svg containing that string,\n   * broken up by newlines.\n   */\n  private stringToSvg(text: string, container: SVGGElement) {\n    const paragraph = this.createParagraph(container);\n    const fragments = this.createTextFragments(paragraph, text);\n    if (this.workspace.RTL)\n      this.rightAlignTextFragments(paragraph.getBBox().width, fragments);\n    return paragraph;\n  }\n\n  /** Creates the paragraph container for this bubble's view's text fragments. */\n  private createParagraph(container: SVGGElement): SVGGElement {\n    return dom.createSvgElement(\n      Svg.G,\n      {\n        'class': 'blocklyText blocklyBubbleText blocklyNoPointerEvents',\n        'transform': `translate(0,${Bubble.BORDER_WIDTH})`,\n        'style': `direction: ${this.workspace.RTL ? 'rtl' : 'ltr'}`,\n      },\n      container,\n    );\n  }\n\n  /** Creates the text fragments visualizing the text of this bubble. */\n  private createTextFragments(\n    parent: SVGGElement,\n    text: string,\n  ): SVGTextElement[] {\n    let lineNum = 1;\n    return text.split('\\n').map((line) => {\n      const fragment = dom.createSvgElement(\n        Svg.TEXT,\n        {'y': `${lineNum}em`, 'x': Bubble.BORDER_WIDTH},\n        parent,\n      );\n      const textNode = document.createTextNode(line);\n      fragment.appendChild(textNode);\n      lineNum += 1;\n      return fragment;\n    });\n  }\n\n  /** Right aligns the given text fragments. */\n  private rightAlignTextFragments(\n    maxWidth: number,\n    fragments: SVGTextElement[],\n  ) {\n    for (const text of fragments) {\n      text.setAttribute('text-anchor', 'start');\n      text.setAttribute('x', `${maxWidth + Bubble.BORDER_WIDTH}`);\n    }\n  }\n\n  /** Updates the size of this bubble to account for the size of the text. */\n  private updateBubbleSize() {\n    const bbox = this.paragraph.getBBox();\n    this.setSize(\n      new Size(\n        bbox.width + Bubble.BORDER_WIDTH * 2,\n        bbox.height + Bubble.BORDER_WIDTH * 2,\n      ),\n      true,\n    );\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Warning\n\nimport type {BlockSvg} from '../block_svg.js';\nimport {TextBubble} from '../bubbles/text_bubble.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport type {IBubble} from '../interfaces/i_bubble.js';\nimport type {IHasBubble} from '../interfaces/i_has_bubble.js';\nimport * as renderManagement from '../render_management.js';\nimport {Size} from '../utils.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 {Icon} from './icon.js';\nimport {IconType} from './icon_types.js';\n\n/** The size of the warning icon in workspace-scale units. */\nconst SIZE = 17;\n\n/**\n * An icon that warns the user that something is wrong with their block.\n *\n * For example, this could be used to warn them about incorrect field values,\n * or incorrect placement of the block (putting it somewhere it doesn't belong).\n */\nexport class WarningIcon extends Icon implements IHasBubble {\n  /** The type string used to identify this icon. */\n  static readonly TYPE = IconType.WARNING;\n\n  /**\n   * The weight this icon has relative to other icons. Icons with more positive\n   * weight values are rendered farther toward the end of the block.\n   */\n  static readonly WEIGHT = 2;\n\n  /** A map of warning IDs to warning text. */\n  private textMap: Map<string, string> = new Map();\n\n  /** The bubble used to display the warnings to the user. */\n  private textBubble: TextBubble | null = null;\n\n  /** @internal */\n  constructor(protected readonly sourceBlock: BlockSvg) {\n    super(sourceBlock);\n  }\n\n  override getType(): IconType<WarningIcon> {\n    return WarningIcon.TYPE;\n  }\n\n  override initView(pointerdownListener: (e: PointerEvent) => void): void {\n    if (this.svgRoot) return; // Already initialized.\n\n    super.initView(pointerdownListener);\n\n    // Triangle with rounded corners.\n    dom.createSvgElement(\n      Svg.PATH,\n      {\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      this.svgRoot,\n    );\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      {\n        'class': 'blocklyIconSymbol',\n        'd': 'm7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z',\n      },\n      this.svgRoot,\n    );\n    // Dot of exclamation point.\n    dom.createSvgElement(\n      Svg.RECT,\n      {\n        'class': 'blocklyIconSymbol',\n        'x': '7',\n        'y': '11',\n        'height': '2',\n        'width': '2',\n      },\n      this.svgRoot,\n    );\n    dom.addClass(this.svgRoot!, 'blocklyWarningIcon');\n  }\n\n  override dispose() {\n    super.dispose();\n    this.textBubble?.dispose();\n  }\n\n  override getWeight(): number {\n    return WarningIcon.WEIGHT;\n  }\n\n  override getSize(): Size {\n    return new Size(SIZE, SIZE);\n  }\n\n  override applyColour(): void {\n    super.applyColour();\n    this.textBubble?.setColour(this.sourceBlock.getColour());\n  }\n\n  override updateCollapsed(): void {\n    // We are shown when collapsed, so do nothing! I.e. skip the default\n    // behavior of hiding.\n  }\n\n  /** Tells blockly that this icon is shown when the block is collapsed. */\n  override isShownWhenCollapsed(): boolean {\n    return true;\n  }\n\n  /** Updates the location of the icon's bubble if it is open. */\n  override onLocationChange(blockOrigin: Coordinate): void {\n    super.onLocationChange(blockOrigin);\n    this.textBubble?.setAnchorLocation(this.getAnchorLocation());\n  }\n\n  /**\n   * Adds a warning message to this warning icon.\n   *\n   * @param text The text of the message to add.\n   * @param id The id of the message to add.\n   * @internal\n   */\n  addMessage(text: string, id: string): this {\n    if (this.textMap.get(id) === text) return this;\n\n    if (text) {\n      this.textMap.set(id, text);\n    } else {\n      this.textMap.delete(id);\n    }\n\n    this.textBubble?.setText(this.getText());\n    return this;\n  }\n\n  /**\n   * @returns the display text for this icon. Includes all warning messages\n   *     concatenated together with newlines.\n   * @internal\n   */\n  getText(): string {\n    return [...this.textMap.values()].join('\\n');\n  }\n\n  /** Toggles the visibility of the bubble. */\n  override onClick(): void {\n    super.onClick();\n    this.setBubbleVisible(!this.bubbleIsVisible());\n  }\n\n  override isClickableInFlyout(): boolean {\n    return false;\n  }\n\n  bubbleIsVisible(): boolean {\n    return !!this.textBubble;\n  }\n\n  async setBubbleVisible(visible: boolean): Promise<void> {\n    if (this.bubbleIsVisible() === visible) return;\n\n    await renderManagement.finishQueuedRenders();\n\n    if (visible) {\n      this.textBubble = new TextBubble(\n        this.getText(),\n        this.sourceBlock.workspace,\n        this.getAnchorLocation(),\n        this.getBubbleOwnerRect(),\n      );\n      this.applyColour();\n    } else {\n      this.textBubble?.dispose();\n      this.textBubble = null;\n    }\n\n    eventUtils.fire(\n      new (eventUtils.get(EventType.BUBBLE_OPEN))(\n        this.sourceBlock,\n        visible,\n        'warning',\n      ),\n    );\n  }\n\n  /** See IHasBubble.getBubble. */\n  getBubble(): IBubble | null {\n    return this.textBubble;\n  }\n\n  /**\n   * @returns the location the bubble should be anchored to.\n   *     I.E. the middle of this icon.\n   */\n  private getAnchorLocation(): Coordinate {\n    const midIcon = SIZE / 2;\n    return Coordinate.sum(\n      this.workspaceLocation,\n      new Coordinate(midIcon, midIcon),\n    );\n  }\n\n  /**\n   * @returns the rect the bubble should avoid overlapping.\n   *     I.E. the block that owns this icon.\n   */\n  private getBubbleOwnerRect(): Rect {\n    const bbox = this.sourceBlock.getSvgRoot().getBBox();\n    return new Rect(bbox.y, bbox.y + bbox.height, bbox.x, bbox.x + bbox.width);\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 */\n// Former goog.module ID: 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 {BlockCopyData, BlockPaster} from './clipboard/block_paster.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 {\n  ContextMenuOption,\n  ContextMenuRegistry,\n  LegacyContextMenuOption,\n} from './contextmenu_registry.js';\nimport {BlockDragStrategy} from './dragging/block_drag_strategy.js';\nimport type {BlockMove} from './events/events_block_move.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {FieldLabel} from './field_label.js';\nimport {getFocusManager} from './focus_manager.js';\nimport {IconType} from './icons/icon_types.js';\nimport {MutatorIcon} from './icons/mutator_icon.js';\nimport {WarningIcon} from './icons/warning_icon.js';\nimport type {Input} from './inputs/input.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport {IContextMenu} from './interfaces/i_contextmenu.js';\nimport type {ICopyable} from './interfaces/i_copyable.js';\nimport {IDeletable} from './interfaces/i_deletable.js';\nimport type {IDragStrategy, IDraggable} from './interfaces/i_draggable.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport {IIcon} from './interfaces/i_icon.js';\nimport * as internalConstants from './internal_constants.js';\nimport {Msg} from './msg.js';\nimport * as renderManagement from './render_management.js';\nimport {RenderedConnection} from './rendered_connection.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 {idGenerator} from './utils.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 {FlyoutItemInfo} from './utils/toolbox.js';\nimport type {Workspace} from './workspace.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Class for a block's SVG representation.\n * Not normally called directly, workspace.newBlock() is preferred.\n */\nexport class BlockSvg\n  extends Block\n  implements\n    IBoundedElement,\n    IContextMenu,\n    ICopyable<BlockCopyData>,\n    IDraggable,\n    IDeletable,\n    IFocusableNode\n{\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\n  /**\n   * An optional method which saves a record of blocks connected to\n   * this block so they can be later restored after this block is\n   * recoomposed (reconfigured).  Typically records the connected\n   * blocks on properties on blocks in the mutator flyout, so that\n   * rearranging those component blocks will automatically rearrange\n   * the corresponding connected blocks on this block after this block\n   * is recomposed.\n   *\n   * To keep the saved connection information up-to-date, MutatorIcon\n   * arranges for an event listener to call this method any time the\n   * mutator flyout is open and a change occurs on this block's\n   * workspace.\n   *\n   * @param rootBlock The root block in the mutator flyout.\n   */\n  saveConnections?: (rootBlock: BlockSvg) => void;\n\n  customContextMenu?: (\n    p1: Array<ContextMenuOption | LegacyContextMenuOption>,\n  ) => void;\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   * Width of this block, not including any connected value blocks.\n   * Width is in workspace units.\n   *\n   * @internal\n   */\n  childlessWidth = 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: MutatorIcon | null = null;\n\n  private svgGroup: SVGGElement;\n  style: BlockStyle;\n  /** @internal */\n  pathObject: IPathObject;\n\n  /** Is this block a BlockSVG? */\n  override readonly rendered = true;\n\n  private visuallyDisabled = 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\n  private translation = '';\n\n  /** Whether this block is currently being dragged. */\n  private dragging = false;\n\n  /**\n   * The location of the top left of this block (in workspace coordinates)\n   * relative to either its parent block, or the workspace origin if it has no\n   * parent.\n   *\n   * @internal\n   */\n  relativeCoords = new Coordinate(0, 0);\n\n  private dragStrategy: IDragStrategy = new BlockDragStrategy(this);\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    if (!workspace.rendered) {\n      throw TypeError('Cannot create a rendered block in a headless workspace');\n    }\n    this.workspace = workspace;\n    this.svgGroup = dom.createSvgElement(Svg.G, {});\n\n    if (prototypeName) {\n      dom.addClass(this.svgGroup, prototypeName);\n    }\n    /** A block style object. */\n    this.style = workspace.getRenderer().getConstants().getBlockStyle(null);\n\n    /** The renderer's path object. */\n    this.pathObject = workspace\n      .getRenderer()\n      .makePathObject(this.svgGroup, this.style);\n\n    const svgPath = this.pathObject.svgPath;\n    (svgPath as any).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    // The page-wide unique ID of this Block used for focusing.\n    svgPath.id = idGenerator.getNextUniqueId();\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.initialized) return;\n    for (const input of this.inputList) {\n      input.init();\n    }\n    for (const icon of this.getIcons()) {\n      icon.initView(this.createIconPointerDownListener(icon));\n      icon.updateEditable();\n    }\n    this.applyColour();\n    this.pathObject.updateMovable(this.isMovable() || this.isInFlyout);\n    const svg = this.getSvgRoot();\n    if (svg) {\n      browserEvents.conditionalBind(svg, 'pointerdown', this, this.onMouseDown);\n    }\n\n    if (!svg.parentNode) {\n      this.workspace.getCanvas().appendChild(svg);\n    }\n    this.initialized = true;\n  }\n\n  /**\n   * Get the secondary colour of a block.\n   *\n   * @returns #RRGGBB string.\n   */\n  getColourSecondary(): string {\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 {\n    return this.style.colourTertiary;\n  }\n\n  /** Selects this block. Highlights the block visually. */\n  select() {\n    this.addSelect();\n    common.fireSelectedEvent(this);\n  }\n\n  /** Unselects this block. Unhighlights the block visually. */\n  unselect() {\n    this.removeSelect();\n    common.fireSelectedEvent(null);\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    const focusedNode = getFocusManager().getFocusedNode();\n    const restoreFocus = this.getSvgRoot().contains(\n      focusedNode?.getFocusableElement() ?? null,\n    );\n    if (newParent) {\n      (newParent as BlockSvg).getSvgRoot().appendChild(svgRoot);\n      // appendChild() clears focus state, so re-focus the previously focused\n      // node in case it was this block and would otherwise lose its focus. Once\n      // Element.moveBefore() has better browser support, it should be used\n      // instead.\n      if (restoreFocus && focusedNode) {\n        getFocusManager().focusNode(focusedNode);\n      }\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.  Try to insert it before any top-level\n      // block being dragged, but note that blocks can have the\n      // blocklyDragging class even if they're not top blocks (especially\n      // at start and end of a drag).\n      const draggingBlockElement = this.workspace\n        .getCanvas()\n        .querySelector('.blocklyDragging');\n      const draggingParentElement = draggingBlockElement?.parentElement as\n        | SVGElement\n        | null\n        | undefined;\n      const canvas = this.workspace.getCanvas();\n      if (draggingParentElement === canvas) {\n        canvas.insertBefore(svgRoot, draggingBlockElement);\n      } else {\n        canvas.appendChild(svgRoot);\n        // appendChild() clears focus state, so re-focus the previously focused\n        // node in case it was this block and would otherwise lose its focus. Once\n        // Element.moveBefore() has better browser support, it should be used\n        // instead.\n        if (restoreFocus && focusedNode) {\n          getFocusManager().focusNode(focusedNode);\n        }\n      }\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    const layerManger = this.workspace.getLayerManager();\n    if (!layerManger) {\n      throw new Error(\n        'Cannot calculate position because the workspace has not been appended',\n      );\n    }\n    let x = 0;\n    let y = 0;\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        element = element.parentNode as SVGElement;\n      } while (element && !layerManger.hasLayer(element));\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   * @param reason Why is this move happening?  'drag', 'bump', 'snap', ...\n   */\n  override moveBy(dx: number, dy: number, reason?: string[]) {\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(EventType.BLOCK_MOVE)!)(this) as BlockMove;\n      if (reason) event.setReason(reason);\n    }\n\n    const delta = new Coordinate(dx, dy);\n    const currLoc = this.getRelativeToSurfaceXY();\n    const newLoc = Coordinate.sum(currLoc, delta);\n    this.translate(newLoc.x, newLoc.y);\n    this.updateComponentLocations(newLoc);\n\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.translation = `translate(${x}, ${y})`;\n    this.relativeCoords = new Coordinate(x, y);\n    this.getSvgRoot().setAttribute('transform', this.getTranslation());\n  }\n\n  /**\n   * Returns the SVG translation of this block.\n   *\n   * @internal\n   */\n  getTranslation(): string {\n    return this.translation;\n  }\n\n  /**\n   * Move a block to a position.\n   *\n   * @param xy The position to move to in workspace units.\n   * @param reason Why is this move happening?  'drag', 'bump', 'snap', ...\n   */\n  moveTo(xy: Coordinate, reason?: string[]) {\n    const curXY = this.getRelativeToSurfaceXY();\n    this.moveBy(xy.x - curXY.x, xy.y - curXY.y, reason);\n  }\n\n  /**\n   * Move this block during a drag.\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    this.translate(newLoc.x, newLoc.y);\n    this.getSvgRoot().setAttribute('transform', this.getTranslation());\n    this.updateComponentLocations(newLoc);\n  }\n\n  /** Snap this block to the nearest grid point. */\n  snapToGrid() {\n    if (this.isDeadOrDying()) return;\n    if (this.getParent()) return;\n    if (this.isInFlyout) return;\n    const grid = this.workspace.getGrid();\n    if (!grid?.shouldSnap()) return;\n    const currentXY = this.getRelativeToSurfaceXY();\n    const alignedXY = grid.alignXY(currentXY);\n    if (alignedXY !== currentXY) {\n      this.moveTo(alignedXY, ['snap']);\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    return this.getBoundingRectangleWithDimensions(this.getHeightWidth());\n  }\n\n  /**\n   * Returns the coordinates of a bounding box describing the dimensions of this\n   * block alone.\n   * Coordinate system: workspace coordinates.\n   *\n   * @returns Object with coordinates of the bounding box.\n   */\n  getBoundingRectangleWithoutChildren(): Rect {\n    return this.getBoundingRectangleWithDimensions({\n      height: this.height,\n      width: this.childlessWidth,\n    });\n  }\n\n  private getBoundingRectangleWithDimensions(blockBounds: {\n    height: number;\n    width: number;\n  }) {\n    const blockXY = this.getRelativeToSurfaceXY();\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    this.updateCollapsed();\n  }\n\n  /**\n   * Traverses child blocks to see if any of them have a warning.\n   *\n   * @returns true if any child has a warning, false otherwise.\n   */\n  private childHasWarning(): boolean {\n    const children = this.getChildren(false);\n    for (const child of children) {\n      if (child.getIcon(WarningIcon.TYPE) || child.childHasWarning()) {\n        return true;\n      }\n    }\n    return false;\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    for (const icon of this.getIcons()) {\n      icon.updateCollapsed();\n    }\n\n    if (!collapsed) {\n      this.updateDisabled();\n      this.removeInput(collapsedInputName);\n      dom.removeClass(this.svgGroup, 'blocklyCollapsed');\n      this.setWarningText(null, BlockSvg.COLLAPSED_WARNING_ID);\n      return;\n    }\n\n    dom.addClass(this.svgGroup, 'blocklyCollapsed');\n    if (this.childHasWarning()) {\n      this.setWarningText(\n        Msg['COLLAPSED_WARNINGS_WARNING'],\n        BlockSvg.COLLAPSED_WARNING_ID,\n      );\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 =\n      this.getInput(collapsedInputName) ||\n      this.appendDummyInput(collapsedInputName);\n    input.appendField(new FieldLabel(text), collapsedFieldName);\n  }\n\n  /**\n   * Handle a pointerdown on an SVG block.\n   *\n   * @param e Pointer down event.\n   */\n  private onMouseDown(e: PointerEvent) {\n    if (this.workspace.isReadOnly()) return;\n\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    e: Event,\n  ): Array<ContextMenuOption | LegacyContextMenuOption> | null {\n    if (this.workspace.isReadOnly() || !this.contextMenu) {\n      return null;\n    }\n    const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions(\n      {block: this, focusedNode: this},\n      e,\n    );\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   * Gets the location in which to show the context menu for this block.\n   * Use the location of a click if the block was clicked, or a location\n   * based on the block's fields otherwise.\n   */\n  protected calculateContextMenuLocation(e: Event): Coordinate {\n    // Open the menu where the user clicked, if they clicked\n    if (e instanceof PointerEvent) {\n      return new Coordinate(e.clientX, e.clientY);\n    }\n\n    // Otherwise, calculate a location.\n    // Get the location of the top-left corner of the block in\n    // screen coordinates.\n    const blockCoords = svgMath.wsToScreenCoordinates(\n      this.workspace,\n      this.getRelativeToSurfaceXY(),\n    );\n\n    // Prefer a y position below the first field in the block.\n    const fieldBoundingClientRect = this.inputList\n      .filter((input) => input.isVisible())\n      .flatMap((input) => input.fieldRow)\n      .find((f) => f.isVisible())\n      ?.getSvgRoot()\n      ?.getBoundingClientRect();\n\n    const y =\n      fieldBoundingClientRect && fieldBoundingClientRect.height\n        ? fieldBoundingClientRect.y + fieldBoundingClientRect.height\n        : blockCoords.y + this.height;\n\n    return new Coordinate(\n      this.RTL ? blockCoords.x - 5 : blockCoords.x + 5,\n      y + 5,\n    );\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(e);\n\n    const location = this.calculateContextMenuLocation(e);\n\n    if (menuOptions && menuOptions.length) {\n      ContextMenu.show(e, menuOptions, this.RTL, this.workspace, location);\n      ContextMenu.setCurrentBlock(this);\n    }\n  }\n\n  /**\n   * Updates the locations of any parts of the block that need to know where\n   * they are (e.g. connections, icons).\n   *\n   * @param blockOrigin The top-left of this block in workspace coordinates.\n   * @internal\n   */\n  updateComponentLocations(blockOrigin: Coordinate) {\n    if (!this.dragging) this.updateConnectionLocations(blockOrigin);\n    this.updateIconLocations(blockOrigin);\n    this.updateFieldLocations(blockOrigin);\n\n    for (const child of this.getChildren(false)) {\n      child.updateComponentLocations(\n        Coordinate.sum(blockOrigin, child.relativeCoords),\n      );\n    }\n  }\n\n  private updateConnectionLocations(blockOrigin: Coordinate) {\n    for (const conn of this.getConnections_(false)) {\n      conn.moveToOffset(blockOrigin);\n    }\n  }\n\n  private updateIconLocations(blockOrigin: Coordinate) {\n    for (const icon of this.getIcons()) {\n      icon.onLocationChange(blockOrigin);\n    }\n  }\n\n  private updateFieldLocations(blockOrigin: Coordinate) {\n    for (const input of this.inputList) {\n      for (const field of input.fieldRow) {\n        field.onLocationChange(blockOrigin);\n      }\n    }\n  }\n\n  /**\n   * Add a CSS class to the SVG group of this block.\n   *\n   * @param className\n   */\n  addClass(className: string) {\n    dom.addClass(this.svgGroup, className);\n  }\n\n  /**\n   * Remove a CSS class from the SVG group of this block.\n   *\n   * @param className\n   */\n  removeClass(className: string) {\n    dom.removeClass(this.svgGroup, className);\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    this.dragging = adding;\n    if (adding) {\n      this.translation = '';\n      common.draggingConnections.push(...this.getConnections_(true));\n      this.addClass('blocklyDragging');\n    } else {\n      common.draggingConnections.length = 0;\n      this.removeClass('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\n    if (editable) {\n      dom.removeClass(this.svgGroup, 'blocklyNotEditable');\n    } else {\n      dom.addClass(this.svgGroup, 'blocklyNotEditable');\n    }\n\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   * This method is internal and should not be called by users of Blockly. To\n   * create shadow blocks programmatically call connection.setShadowState\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      );\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   */\n  override dispose(healStack?: boolean, animate?: boolean) {\n    this.disposing = true;\n\n    Tooltip.dispose();\n    ContextMenu.hide();\n\n    // If this block (or a descendant) was focused, focus its parent or\n    // workspace instead.\n    const focusManager = getFocusManager();\n    if (\n      this.getSvgRoot().contains(\n        focusManager.getFocusedNode()?.getFocusableElement() ?? null,\n      )\n    ) {\n      let parent: BlockSvg | undefined | null = this.getParent();\n      if (!parent) {\n        // In some cases, blocks are disconnected from their parents before\n        // being deleted. Attempt to infer if there was a parent by checking\n        // for a connection within a radius of 0. Even if this wasn't a parent,\n        // it must be adjacent to this block and so is as good an option as any\n        // to focus after deleting.\n        const connection = this.outputConnection ?? this.previousConnection;\n        if (connection) {\n          const targetConnection = connection.closest(\n            0,\n            new Coordinate(0, 0),\n          ).connection;\n          parent = targetConnection?.getSourceBlock();\n        }\n      }\n      if (parent) {\n        focusManager.focusNode(parent);\n      } else {\n        setTimeout(() => focusManager.focusTree(this.workspace), 0);\n      }\n    }\n\n    if (animate) {\n      this.unplug(healStack);\n      blockAnimations.disposeUiEffect(this);\n    }\n\n    super.dispose(!!healStack);\n    dom.removeNode(this.svgGroup);\n  }\n\n  /**\n   * Disposes of this block without doing things required by the top block.\n   * E.g. does trigger UI effects, remove nodes, etc.\n   */\n  override disposeInternal() {\n    this.disposing = true;\n    super.disposeInternal();\n\n    if (getFocusManager().getFocusedNode() === this) {\n      this.workspace.cancelCurrentGesture();\n    }\n\n    [...this.warningTextDb.values()].forEach((n) => clearTimeout(n));\n    this.warningTextDb.clear();\n\n    this.getIcons().forEach((i) => i.dispose());\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 */ true, true);\n    }\n    eventUtils.setGroup(false);\n  }\n\n  /**\n   * Encode a block for copying.\n   *\n   * @param addNextBlocks If true, copy subsequent blocks attached to this one\n   *     as well.\n   *\n   * @returns Copy metadata, or null if the block is an insertion marker.\n   */\n  toCopyData(addNextBlocks = false): BlockCopyData | null {\n    if (this.isInsertionMarker_) {\n      return null;\n    }\n    return {\n      paster: BlockPaster.TYPE,\n      blockState: blocks.save(this, {\n        addCoordinates: true,\n        addNextBlocks,\n        saveIds: false,\n      }) as blocks.State,\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 (const field of this.getFields()) {\n      field.applyColour();\n    }\n  }\n\n  /**\n   * Updates the colour of the block (and children) to match the current\n   * disabled state.\n   *\n   * @internal\n   */\n  updateDisabled() {\n    const disabled = !this.isEnabled() || this.getInheritedDisabled();\n\n    if (this.visuallyDisabled === disabled) {\n      this.getNextBlock()?.updateDisabled();\n      return;\n    }\n\n    this.applyColour();\n    this.visuallyDisabled = disabled;\n    for (const child of this.getChildren(false)) {\n      child.updateDisabled();\n    }\n  }\n\n  /**\n   * Set this block's warning text.\n   *\n   * @param text The text, or null to delete.\n   * @param id An optional ID for the warning text to be able to maintain\n   *     multiple warnings.\n   */\n  override setWarningText(text: string | null, id: string = '') {\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(\n        id,\n        setTimeout(() => {\n          if (!this.isDeadOrDying()) {\n            this.warningTextDb.delete(id);\n            this.setWarningText(text, id);\n          }\n        }, 100),\n      );\n      return;\n    }\n    if (this.isInFlyout) {\n      text = null;\n    }\n\n    const icon = this.getIcon(WarningIcon.TYPE) as WarningIcon | undefined;\n    if (text) {\n      // Bubble up to add a warning on top-most collapsed block.\n      // TODO(#6020): This warning is never removed.\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'],\n          BlockSvg.COLLAPSED_WARNING_ID,\n        );\n      }\n\n      if (icon) {\n        (icon as WarningIcon).addMessage(text, id);\n      } else {\n        this.addIcon(new WarningIcon(this).addMessage(text, id));\n      }\n    } else if (icon) {\n      // Dispose all warnings if no ID is given.\n      if (!id) {\n        this.removeIcon(WarningIcon.TYPE);\n      } else {\n        // Remove just this warning id's message.\n        icon.addMessage('', id);\n        // Then remove the entire icon if there is no longer any text.\n        if (!icon.getText()) this.removeIcon(WarningIcon.TYPE);\n      }\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: MutatorIcon | null) {\n    this.removeIcon(MutatorIcon.TYPE);\n    if (mutator) this.addIcon(mutator);\n  }\n\n  override addIcon<T extends IIcon>(icon: T): T {\n    super.addIcon(icon);\n\n    if (icon instanceof MutatorIcon) this.mutator = icon;\n\n    icon.initView(this.createIconPointerDownListener(icon));\n    icon.applyColour();\n    icon.updateEditable();\n    this.queueRender();\n\n    return icon;\n  }\n\n  /**\n   * Creates a pointer down event listener for the icon to append to its\n   * root svg.\n   */\n  private createIconPointerDownListener(icon: IIcon) {\n    return (e: PointerEvent) => {\n      if (this.isDeadOrDying()) return;\n      const gesture = this.workspace.getGesture(e);\n      if (gesture) {\n        gesture.setStartIcon(icon);\n      }\n    };\n  }\n\n  override removeIcon(type: IconType<IIcon>): boolean {\n    const removed = super.removeIcon(type);\n\n    if (type.equals(MutatorIcon.TYPE)) this.mutator = null;\n\n    this.queueRender();\n\n    return removed;\n  }\n\n  /**\n   * Add or remove a reason why the block might be disabled. If a block has\n   * any reasons to be disabled, then the block itself will be considered\n   * disabled. A block could be disabled for multiple independent reasons\n   * simultaneously, such as when the user manually disables it, or the block\n   * is invalid.\n   *\n   * @param disabled If true, then the block should be considered disabled for\n   *     at least the provided reason, otherwise the block is no longer disabled\n   *     for that reason.\n   * @param reason A language-neutral identifier for a reason why the block\n   *     could be disabled. Call this method again with the same identifier to\n   *     update whether the block is currently disabled for this reason.\n   */\n  override setDisabledReason(disabled: boolean, reason: string): void {\n    const wasEnabled = this.isEnabled();\n    super.setDisabledReason(disabled, reason);\n    if (this.isEnabled() !== wasEnabled && !this.getInheritedDisabled()) {\n      this.updateDisabled();\n    }\n  }\n\n  /**\n   * Add blocklyNotDeletable class when block is not deletable\n   * Or remove class when block is deletable\n   */\n  override setDeletable(deletable: boolean) {\n    super.setDeletable(deletable);\n\n    if (deletable) {\n      dom.removeClass(this.svgGroup, 'blocklyNotDeletable');\n    } else {\n      dom.addClass(this.svgGroup, 'blocklyNotDeletable');\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    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  // 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 = this.workspace\n      .getRenderer()\n      .getConstants()\n      .getBlockStyleForColour(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 = this.workspace\n      .getRenderer()\n      .getConstants()\n      .getBlockStyle(blockStyleName);\n\n    if (this.styleName_) {\n      dom.removeClass(this.svgGroup, this.styleName_);\n    }\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\n      dom.addClass(this.svgGroup, blockStyleName);\n      this.styleName_ = blockStyleName;\n    } else {\n      throw Error('Invalid style name: ' + blockStyleName);\n    }\n  }\n\n  /**\n   * Returns the BlockStyle object used to style this block.\n   *\n   * @returns This block's style object.\n   */\n  getStyle(): BlockStyle {\n    return this.style;\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   * Use sparingly, this method is expensive because it reorders the DOM\n   * nodes.\n   *\n   * @param blockOnly True to only move this block to the front without\n   *     adjusting its parents.\n   */\n  bringToFront(blockOnly = false) {\n    const previouslyFocused = getFocusManager().getFocusedNode();\n    /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n    let block: this | null = this;\n    if (block.isDeadOrDying()) {\n      return;\n    }\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      if (blockOnly) break;\n      block = block.getParent();\n    } while (block);\n    if (previouslyFocused) {\n      // Bringing a block to the front of the stack doesn't fundamentally change\n      // the logical structure of the page, but it does change element ordering\n      // which can take automatically take away focus from a node. Ensure focus\n      // is restored to avoid a discontinuity.\n      getFocusManager().focusNode(previouslyFocused);\n    }\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,\n    opt_check?: string | string[] | null,\n  ) {\n    super.setPreviousStatement(newBoolean, opt_check);\n    this.queueRender();\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,\n    opt_check?: string | string[] | null,\n  ) {\n    super.setNextStatement(newBoolean, opt_check);\n    this.queueRender();\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(\n    newBoolean: boolean,\n    opt_check?: string | string[] | null,\n  ) {\n    super.setOutput(newBoolean, opt_check);\n    this.queueRender();\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    this.queueRender();\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    this.queueRender();\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    this.queueRender();\n  }\n\n  /** @override */\n  override appendInput(input: Input): Input {\n    super.appendInput(input);\n    this.queueRender();\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 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 (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    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(\n    ignoreShadows: boolean,\n  ): RenderedConnection | 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(\n    otherBlock: Block,\n    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   * @internal\n   */\n  override makeConnection_(type: ConnectionType): 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   * Bumps unconnected blocks out of alignment.\n   *\n   * Two blocks which aren't actually connected should not coincidentally line\n   * up on screen, because that creates confusion for end-users.\n   */\n  override bumpNeighbours() {\n    const root = this.getRootBlock();\n    if (\n      this.isDeadOrDying() ||\n      this.workspace.isDragging() ||\n      root.isInFlyout\n    ) {\n      return;\n    }\n\n    function neighbourIsInStack(neighbour: RenderedConnection) {\n      return neighbour.getSourceBlock().getRootBlock() === root;\n    }\n\n    for (const conn of this.getConnections_(false)) {\n      if (conn.isSuperior()) {\n        // Recurse down the block stack.\n        conn.targetBlock()?.bumpNeighbours();\n      }\n\n      for (const neighbour of conn.neighbours(config.snapRadius)) {\n        if (neighbourIsInStack(neighbour)) continue;\n        if (conn.isConnected() && neighbour.isConnected()) continue;\n\n        if (conn.isSuperior()) {\n          neighbour.bumpAwayFrom(conn, /* initiatedByThis = */ false);\n        } else {\n          conn.bumpAwayFrom(neighbour, /* initiatedByThis = */ true);\n        }\n      }\n    }\n  }\n\n  /**\n   * Snap to grid, and then bump neighbouring blocks away at the end of the next\n   * render.\n   */\n  scheduleSnapAndBump() {\n    this.snapToGrid();\n    this.bumpNeighbours();\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 originalOffsetToTarget The connection original offset to the target connection\n   * @param originalOffsetInBlock The connection original offset in its block\n   * @internal\n   */\n  positionNearConnection(\n    sourceConnection: RenderedConnection,\n    originalOffsetToTarget: {x: number; y: number},\n    originalOffsetInBlock: Coordinate,\n  ) {\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 (\n      sourceConnection.type === ConnectionType.NEXT_STATEMENT ||\n      sourceConnection.type === ConnectionType.INPUT_VALUE\n    ) {\n      // First move the block to match the orginal target connection position\n      let dx = originalOffsetToTarget.x;\n      let dy = originalOffsetToTarget.y;\n      // Then adjust its position according to the connection resize\n      dx += originalOffsetInBlock.x - sourceConnection.getOffsetInBlock().x;\n      dy += originalOffsetInBlock.y - sourceConnection.getOffsetInBlock().y;\n\n      this.moveBy(dx, dy);\n    }\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   * Triggers a rerender after a delay to allow for batching.\n   *\n   * @returns A promise that resolves after the currently queued renders have\n   *     been completed. Used for triggering other behavior that relies on\n   *     updated size/position location for the block.\n   * @internal\n   */\n  queueRender(): Promise<void> {\n    return renderManagement.queueRender(this);\n  }\n\n  /**\n   * Immediately lays out and reflows a block based on its contents and\n   * settings.\n   */\n  render() {\n    this.queueRender();\n    renderManagement.triggerQueuedRenders();\n  }\n\n  /**\n   * Renders this block in a way that's compatible with the more efficient\n   * render management system.\n   *\n   * @internal\n   */\n  renderEfficiently() {\n    dom.startTextWidthCache();\n\n    if (this.isCollapsed()) {\n      this.updateCollapsed();\n    }\n\n    if (!this.isEnabled()) {\n      this.updateDisabled();\n    }\n\n    this.workspace.getRenderer().render(this);\n    this.tightenChildrenEfficiently();\n\n    dom.stopTextWidthCache();\n  }\n\n  /**\n   * Tightens all children of this block so they are snuggly rendered against\n   * their parent connections.\n   *\n   * Does not update connection locations, so that they can be updated more\n   * efficiently by the render management system.\n   *\n   * @internal\n   */\n  tightenChildrenEfficiently() {\n    for (const input of this.inputList) {\n      const conn = input.connection as RenderedConnection;\n      if (conn) conn.tightenEfficiently();\n    }\n    if (this.nextConnection) this.nextConnection.tightenEfficiently();\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 = this.workspace\n        .getRenderer()\n        .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    // TODO (7204): Remove these internal methods.\n    (this.pathObject as AnyDuringMigration).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    // TODO (7204): Remove these internal methods.\n    (this.pathObject as AnyDuringMigration).updateShapeForInputHighlight(\n      conn,\n      add,\n    );\n  }\n\n  /**\n   * Returns the drag strategy currently in use by this block.\n   *\n   * @internal\n   * @returns This block's drag strategy.\n   */\n  getDragStrategy(): IDragStrategy {\n    return this.dragStrategy;\n  }\n\n  /** Sets the drag strategy for this block. */\n  setDragStrategy(dragStrategy: IDragStrategy) {\n    this.dragStrategy = dragStrategy;\n  }\n\n  /** Returns whether this block is copyable or not. */\n  isCopyable(): boolean {\n    return this.isOwnDeletable() && this.isOwnMovable();\n  }\n\n  /** Returns whether this block is movable or not. */\n  override isMovable(): boolean {\n    return this.dragStrategy.isMovable();\n  }\n\n  /** Starts a drag on the block. */\n  startDrag(e?: PointerEvent): void {\n    this.dragStrategy.startDrag(e);\n  }\n\n  /** Drags the block to the given location. */\n  drag(newLoc: Coordinate, e?: PointerEvent): void {\n    this.dragStrategy.drag(newLoc, e);\n  }\n\n  /** Ends the drag on the block. */\n  endDrag(e?: PointerEvent): void {\n    this.dragStrategy.endDrag(e);\n  }\n\n  /** Moves the block back to where it was at the start of a drag. */\n  revertDrag(): void {\n    this.dragStrategy.revertDrag();\n  }\n\n  /**\n   * Returns a representation of this block that can be displayed in a flyout.\n   */\n  toFlyoutInfo(): FlyoutItemInfo[] {\n    const json: FlyoutItemInfo = {\n      kind: 'BLOCK',\n      ...blocks.save(this),\n    };\n\n    const toRemove = new Set(['id', 'height', 'width', 'pinned', 'enabled']);\n\n    // Traverse the JSON recursively.\n    const traverseJson = function (json: {[key: string]: unknown}) {\n      for (const key in json) {\n        if (toRemove.has(key)) {\n          delete json[key];\n        } else if (typeof json[key] === 'object') {\n          traverseJson(json[key] as {[key: string]: unknown});\n        }\n      }\n    };\n\n    traverseJson(json as unknown as {[key: string]: unknown});\n    return [json];\n  }\n\n  override jsonInit(json: AnyDuringMigration): void {\n    super.jsonInit(json);\n\n    if (json['classes']) {\n      this.addClass(\n        Array.isArray(json['classes'])\n          ? json['classes'].join(' ')\n          : json['classes'],\n      );\n    }\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    return this.pathObject.svgPath;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this.workspace;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {\n    this.select();\n    this.workspace.scrollBoundsIntoView(\n      this.getBoundingRectangleWithoutChildren(),\n    );\n  }\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {\n    this.unselect();\n  }\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\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 */\n// Former goog.module ID: 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 * Abstract class for a component with custom behaviour when a block or bubble\n * is dragged over or dropped on top of it.\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  /**\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  /**\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  /**\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  /**\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 */\n// Former goog.module ID: Blockly.DeleteArea\n\nimport {BlockSvg} from './block_svg.js';\nimport {DragTarget} from './drag_target.js';\nimport {isDeletable} from './interfaces/i_deletable.js';\nimport type {IDeleteArea} from './interfaces/i_delete_area.js';\nimport type {IDraggable} from './interfaces/i_draggable.js';\n\n/**\n * Abstract class for a component that can delete a block or bubble that is\n * dropped on top of it.\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   * @returns Whether the element provided would be deleted if dropped on this\n   *     area.\n   */\n  wouldDelete(element: IDraggable): boolean {\n    if (element instanceof BlockSvg) {\n      const block = element;\n      const couldDeleteBlock = !block.getParent() && block.isDeletable();\n      this.updateWouldDelete_(couldDeleteBlock);\n    } else {\n      this.updateWouldDelete_(isDeletable(element) && 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","import type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\n\n/**\n * Representation of an item displayed in a flyout.\n */\nexport class FlyoutItem {\n  /**\n   * Creates a new FlyoutItem.\n   *\n   * @param element The element that will be displayed in the flyout.\n   * @param type The type of element. Should correspond to the type of the\n   *     flyout inflater that created this object.\n   */\n  constructor(\n    private element: IBoundedElement & IFocusableNode,\n    private type: string,\n  ) {}\n\n  /**\n   * Returns the element displayed in the flyout.\n   */\n  getElement() {\n    return this.element;\n  }\n\n  /**\n   * Returns the type of flyout element this item represents.\n   */\n  getType() {\n    return this.type;\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 */\n// Former goog.module ID: 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 * The manager for all workspace metrics calculations.\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 in pixel\n   * coordinates. By default, will get metrics for either a simple flyout (owned\n   * directly by the workspace) or for the flyout owned by the toolbox. If you\n   * pass `opt_own` as `true` then only metrics for the simple flyout will be\n   * returned, and it will return 0 for the width and height if the workspace\n   * has a category toolbox instead of a simple toolbox.\n   *\n   * @param opt_own Whether to only return the workspace's own flyout metrics.\n   * @returns The width and height of the flyout.\n   */\n  getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics {\n    const flyoutDimensions = this.getDimensionsPx_(\n      this.workspace_.getFlyout(opt_own),\n    );\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 simple toolbox, see {@link (MetricsManager:class).getFlyoutMetrics}.\n   *\n   * @returns The object with the width, height and position of the toolbox.\n   */\n  getToolboxMetrics(): ToolboxMetrics {\n    const toolboxDimensions = this.getDimensionsPx_(\n      this.workspace_.getToolbox(),\n    );\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    let absoluteTop = 0;\n\n    const toolboxMetrics = this.getToolboxMetrics();\n    const flyoutMetrics = this.getFlyoutMetrics();\n    const respectToolbox = !!this.workspace_.getToolbox();\n    const respectFlyout = !this.workspace_.getFlyout()?.autoClose;\n    const toolboxPosition = respectToolbox\n      ? toolboxMetrics.position\n      : flyoutMetrics.position;\n\n    const atLeft = toolboxPosition === toolboxUtils.Position.LEFT;\n    const atTop = toolboxPosition === toolboxUtils.Position.TOP;\n    if (atLeft) {\n      if (respectToolbox) absoluteLeft += toolboxMetrics.width;\n      if (respectFlyout) absoluteLeft += flyoutMetrics.width;\n    }\n    if (atTop) {\n      if (respectToolbox) absoluteTop += toolboxMetrics.height;\n      if (respectFlyout) 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();\n    const respectToolbox = !!this.workspace_.getToolbox();\n    const respectFlyout = !this.workspace_.getFlyout()?.autoClose;\n    const toolboxPosition = respectToolbox\n      ? toolboxMetrics.position\n      : flyoutMetrics.position;\n\n    const horizToolbox =\n      toolboxPosition === toolboxUtils.Position.TOP ||\n      toolboxPosition === toolboxUtils.Position.BOTTOM;\n    const vertToolbox =\n      toolboxPosition === toolboxUtils.Position.LEFT ||\n      toolboxPosition === toolboxUtils.Position.RIGHT;\n    if (horizToolbox) {\n      if (respectToolbox) svgMetrics.height -= toolboxMetrics.height;\n      if (respectFlyout) svgMetrics.height -= flyoutMetrics.height;\n    }\n    if (vertToolbox) {\n      if (respectToolbox) svgMetrics.width -= toolboxMetrics.width;\n      if (respectFlyout) svgMetrics.width -= flyoutMetrics.width;\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 (\n      !this.workspace_.isMovableHorizontally() ||\n      !this.workspace_.isMovableVertically()\n    );\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_(\n    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,\n    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 = Math.min(\n      contentMetrics.top - halfHeight,\n      contentBottom - viewHeight,\n    );\n    const left = Math.min(\n      contentMetrics.left - halfWidth,\n      contentRight - viewWidth,\n    );\n    const bottom = Math.max(\n      contentBottom + halfHeight,\n      contentMetrics.top + viewHeight,\n    );\n    const right = Math.max(\n      contentRight + halfWidth,\n      contentMetrics.left + viewWidth,\n    );\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,\n    opt_viewMetrics?: ContainerRegion,\n    opt_contentMetrics?: ContainerRegion,\n  ): 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 =\n      fixedEdges.bottom !== undefined\n        ? 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 = this.getScrollMetrics(\n      false,\n      viewMetrics,\n      contentMetrics,\n    );\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,\n  registry.DEFAULT,\n  MetricsManager,\n);\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 */\n// Former goog.module ID: 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 * Calculates metrics for a flyout's workspace.\n * The metrics are mainly used to size scrollbars for the flyout.\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():\n    | SVGRect\n    | {height: number; y: number; width: number; x: number} {\n    let blockBoundingBox;\n    try {\n      blockBoundingBox = this.workspace_.getCanvas().getBBox();\n    } catch {\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,\n    opt_viewMetrics?: ContainerRegion,\n    opt_contentMetrics?: ContainerRegion,\n  ) {\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 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 */\n// Former goog.module ID: Blockly.FlyoutButton\n\nimport * as browserEvents from './browser_events.js';\nimport * as Css from './css.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport type {IRenderedElement} from './interfaces/i_rendered_element.js';\nimport {idGenerator} from './utils.js';\nimport {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 * 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 * Class for a button or label in the flyout.\n */\nexport class FlyoutButton\n  implements IBoundedElement, IRenderedElement, IFocusableNode\n{\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\n  /** The radius of the flyout button's borders. */\n  static BORDER_RADIUS = 4;\n\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 onMouseDownWrapper: browserEvents.Data;\n  private onMouseUpWrapper: browserEvents.Data;\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;\n\n  /** The SVG element with the text of the label or button. */\n  private svgText: SVGTextElement | null = null;\n\n  /**\n   * Holds the cursors svg element when the cursor is attached to the button.\n   * This is null if there is no cursor on the button.\n   */\n  cursorSvg: SVGElement | null = null;\n\n  /** The unique ID for this FlyoutButton. */\n  private id: string;\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 isFlyoutLabel 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,\n    private readonly isFlyoutLabel: boolean,\n  ) {\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 AnyDuringMigration)[\n        'callbackKey'\n      ] /* 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    let cssClass = this.isFlyoutLabel\n      ? 'blocklyFlyoutLabel'\n      : 'blocklyFlyoutButton';\n    if (this.cssClass) {\n      cssClass += ' ' + this.cssClass;\n    }\n\n    this.id = idGenerator.getNextUniqueId();\n    this.svgGroup = dom.createSvgElement(\n      Svg.G,\n      {'id': this.id, 'class': cssClass},\n      this.workspace.getCanvas(),\n    );\n\n    let shadow;\n    if (!this.isFlyoutLabel) {\n      // Shadow rectangle (light source does not mirror in RTL).\n      shadow = dom.createSvgElement(\n        Svg.RECT,\n        {\n          'class': 'blocklyFlyoutButtonShadow',\n          'rx': FlyoutButton.BORDER_RADIUS,\n          'ry': FlyoutButton.BORDER_RADIUS,\n          'x': 1,\n          'y': 1,\n        },\n        this.svgGroup!,\n      );\n    }\n    // Background rectangle.\n    const rect = dom.createSvgElement(\n      Svg.RECT,\n      {\n        'class': this.isFlyoutLabel\n          ? 'blocklyFlyoutLabelBackground'\n          : 'blocklyFlyoutButtonBackground',\n        'rx': FlyoutButton.BORDER_RADIUS,\n        'ry': FlyoutButton.BORDER_RADIUS,\n      },\n      this.svgGroup!,\n    );\n\n    const svgText = dom.createSvgElement(\n      Svg.TEXT,\n      {\n        'class': this.isFlyoutLabel ? 'blocklyFlyoutLabelText' : 'blocklyText',\n        'x': 0,\n        'y': 0,\n        'text-anchor': 'middle',\n      },\n      this.svgGroup!,\n    );\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.isFlyoutLabel) {\n      this.svgText = svgText;\n      this.workspace\n        .getThemeManager()\n        .subscribe(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,\n      fontSize,\n      fontWeight,\n      fontFamily,\n    );\n    const fontMetrics = dom.measureFontMetrics(\n      text,\n      fontSize,\n      fontWeight,\n      fontFamily,\n    );\n    this.height = this.height || fontMetrics.height;\n\n    if (!this.isFlyoutLabel) {\n      this.width += 2 * FlyoutButton.TEXT_MARGIN_X;\n      this.height += 2 * FlyoutButton.TEXT_MARGIN_Y;\n      shadow?.setAttribute('width', String(this.width));\n      shadow?.setAttribute('height', String(this.height));\n    }\n    rect.setAttribute('width', String(this.width));\n    rect.setAttribute('height', String(this.height));\n\n    svgText.setAttribute('x', String(this.width / 2));\n    svgText.setAttribute(\n      'y',\n      String(this.height / 2 - fontMetrics.height / 2 + fontMetrics.baseline),\n    );\n\n    this.updateTransform();\n\n    this.onMouseDownWrapper = browserEvents.conditionalBind(\n      this.svgGroup,\n      'pointerdown',\n      this,\n      this.onMouseDown,\n    );\n    this.onMouseUpWrapper = browserEvents.conditionalBind(\n      this.svgGroup,\n      'pointerup',\n      this,\n      this.onMouseUp,\n    );\n  }\n\n  createDom(): SVGElement {\n    // No-op, now handled in constructor. Will be removed in followup refactor\n    // PR that updates the flyout classes to use inflaters.\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  /**\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  /**\n   * Move the element by a relative offset.\n   *\n   * @param dx Horizontal offset in workspace units.\n   * @param dy Vertical offset in workspace units.\n   * @param _reason Why is this move happening?  'user', 'bump', 'snap'...\n   */\n  moveBy(dx: number, dy: number, _reason?: string[]) {\n    this.moveTo(this.position.x + dx, this.position.y + dy);\n  }\n\n  /** @returns Whether or not the button is a label. */\n  isLabel(): boolean {\n    return this.isFlyoutLabel;\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  /**\n   * Returns the coordinates of a bounded element describing the dimensions of\n   * the element. Coordinate system: workspace coordinates.\n   *\n   * @returns Object with coordinates of the bounded element.\n   */\n  getBoundingRectangle() {\n    return new Rect(\n      this.position.y,\n      this.position.y + this.height,\n      this.position.x,\n      this.position.x + this.width,\n    );\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  /**\n   * Get the button's workspace.\n   *\n   * @returns The workspace in which to place this button.\n   */\n  getWorkspace(): WorkspaceSvg {\n    return this.workspace;\n  }\n\n  /** Dispose of this button. */\n  dispose() {\n    browserEvents.unbind(this.onMouseDownWrapper);\n    browserEvents.unbind(this.onMouseUpWrapper);\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   * Add the cursor SVG to this buttons's SVG group.\n   *\n   * @param cursorSvg The SVG root of the cursor to be added to the button SVG\n   *     group.\n   */\n  setCursorSvg(cursorSvg: SVGElement) {\n    if (!cursorSvg) {\n      this.cursorSvg = null;\n      return;\n    }\n    if (this.svgGroup) {\n      this.svgGroup.appendChild(cursorSvg);\n      this.cursorSvg = cursorSvg;\n    }\n  }\n\n  /**\n   * Do something when the button is clicked.\n   *\n   * @param e Pointer up event.\n   */\n  private onMouseUp(e: PointerEvent) {\n    const gesture = this.targetWorkspace.getGesture(e);\n    if (gesture) {\n      gesture.cancel();\n    }\n\n    if (this.isFlyoutLabel && this.callbackKey) {\n      console.warn(\n        'Labels should not have callbacks. Label text: ' + this.text,\n      );\n    } else if (\n      !this.isFlyoutLabel &&\n      !(\n        this.callbackKey &&\n        this.targetWorkspace.getButtonCallback(this.callbackKey)\n      )\n    ) {\n      console.warn('Buttons should have callbacks. Button text: ' + this.text);\n    } else if (!this.isFlyoutLabel) {\n      const callback = this.targetWorkspace.getButtonCallback(this.callbackKey);\n      if (callback) {\n        callback(this);\n      }\n    }\n  }\n\n  private onMouseDown(e: PointerEvent) {\n    const gesture = this.targetWorkspace.getGesture(e);\n    const flyout = this.targetWorkspace.getFlyout();\n    if (gesture && flyout) {\n      gesture.handleFlyoutStart(e, flyout);\n    }\n  }\n\n  /**\n   * @returns The root SVG element of this rendered element.\n   */\n  getSvgRoot() {\n    return this.svgGroup;\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    return this.svgGroup;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this.workspace;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {\n    const xy = this.getPosition();\n    const bounds = new Rect(xy.y, xy.y + this.height, xy.x, xy.x + this.width);\n    this.workspace.scrollBoundsIntoView(bounds);\n  }\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\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 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {FlyoutButton} from '../flyout_button.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from a flyout button.\n */\nexport class FlyoutButtonNavigationPolicy\n  implements INavigationPolicy<FlyoutButton>\n{\n  /**\n   * Returns null since flyout buttons have no children.\n   *\n   * @param _current The FlyoutButton instance to navigate from.\n   * @returns Null.\n   */\n  getFirstChild(_current: FlyoutButton): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns the parent workspace of the given flyout button.\n   *\n   * @param current The FlyoutButton instance to navigate from.\n   * @returns The given flyout button's parent workspace.\n   */\n  getParent(current: FlyoutButton): IFocusableNode | null {\n    return current.getWorkspace();\n  }\n\n  /**\n   * Returns null since inter-item navigation is done by FlyoutNavigationPolicy.\n   *\n   * @param _current The FlyoutButton instance to navigate from.\n   * @returns Null.\n   */\n  getNextSibling(_current: FlyoutButton): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns null since inter-item navigation is done by FlyoutNavigationPolicy.\n   *\n   * @param _current The FlyoutButton instance to navigate from.\n   * @returns Null.\n   */\n  getPreviousSibling(_current: FlyoutButton): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns whether or not the given flyout button can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given flyout button can be focused.\n   */\n  isNavigable(current: FlyoutButton): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a FlyoutButton.\n   */\n  isApplicable(current: any): current is FlyoutButton {\n    return current instanceof FlyoutButton;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFlyout} from '../interfaces/i_flyout.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\n\n/**\n * Generic navigation policy that navigates between items in the flyout.\n */\nexport class FlyoutNavigationPolicy<T> implements INavigationPolicy<T> {\n  /**\n   * Creates a new FlyoutNavigationPolicy instance.\n   *\n   * @param policy The policy to defer to for parents/children.\n   * @param flyout The flyout this policy will control navigation in.\n   */\n  constructor(\n    private policy: INavigationPolicy<T>,\n    private flyout: IFlyout,\n  ) {}\n\n  /**\n   * Returns null to prevent navigating into flyout items.\n   *\n   * @param _current The flyout item to navigate from.\n   * @returns Null to prevent navigating into flyout items.\n   */\n  getFirstChild(_current: T): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns the parent of the given flyout item.\n   *\n   * @param current The flyout item to navigate from.\n   * @returns The parent of the given flyout item.\n   */\n  getParent(current: T): IFocusableNode | null {\n    return this.policy.getParent(current);\n  }\n\n  /**\n   * Returns the next item in the flyout relative to the given item.\n   *\n   * @param current The flyout item to navigate from.\n   * @returns The flyout item following the given one.\n   */\n  getNextSibling(current: T): IFocusableNode | null {\n    const flyoutContents = this.flyout.getContents();\n    if (!flyoutContents) return null;\n\n    let index = flyoutContents.findIndex(\n      (flyoutItem) => flyoutItem.getElement() === current,\n    );\n\n    if (index === -1) return null;\n    index++;\n    if (index >= flyoutContents.length) {\n      index = 0;\n    }\n\n    return flyoutContents[index].getElement();\n  }\n\n  /**\n   * Returns the previous item in the flyout relative to the given item.\n   *\n   * @param current The flyout item to navigate from.\n   * @returns The flyout item preceding the given one.\n   */\n  getPreviousSibling(current: T): IFocusableNode | null {\n    const flyoutContents = this.flyout.getContents();\n    if (!flyoutContents) return null;\n\n    let index = flyoutContents.findIndex(\n      (flyoutItem) => flyoutItem.getElement() === current,\n    );\n\n    if (index === -1) return null;\n    index--;\n    if (index < 0) {\n      index = flyoutContents.length - 1;\n    }\n\n    return flyoutContents[index].getElement();\n  }\n\n  /**\n   * Returns whether or not the given flyout item can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given flyout item can be focused.\n   */\n  isNavigable(current: T): boolean {\n    return this.policy.isNavigable(current);\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a BlockSvg.\n   */\n  isApplicable(current: any): current is T {\n    return this.policy.isApplicable(current);\n  }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport {Rect} from './utils/rect.js';\n\n/**\n * Representation of a gap between elements in a flyout.\n */\nexport class FlyoutSeparator implements IBoundedElement, IFocusableNode {\n  private x = 0;\n  private y = 0;\n\n  /**\n   * Creates a new separator.\n   *\n   * @param gap The amount of space this separator should occupy.\n   * @param axis The axis along which this separator occupies space.\n   */\n  constructor(\n    private gap: number,\n    private axis: SeparatorAxis,\n  ) {}\n\n  /**\n   * Returns the bounding box of this separator.\n   *\n   * @returns The bounding box of this separator.\n   */\n  getBoundingRectangle(): Rect {\n    switch (this.axis) {\n      case SeparatorAxis.X:\n        return new Rect(this.y, this.y, this.x, this.x + this.gap);\n      case SeparatorAxis.Y:\n        return new Rect(this.y, this.y + this.gap, this.x, this.x);\n    }\n  }\n\n  /**\n   * Repositions this separator.\n   *\n   * @param dx The distance to move this separator on the X axis.\n   * @param dy The distance to move this separator on the Y axis.\n   * @param _reason The reason this move was initiated.\n   */\n  moveBy(dx: number, dy: number, _reason?: string[]) {\n    this.x += dx;\n    this.y += dy;\n  }\n\n  /**\n   * Returns false to prevent this separator from being navigated to by the\n   * keyboard.\n   *\n   * @returns False.\n   */\n  isNavigable() {\n    return false;\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    throw new Error('Cannot be focused');\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    throw new Error('Cannot be focused');\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {}\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return false;\n  }\n}\n\n/**\n * Representation of an axis along which a separator occupies space.\n */\nexport const enum SeparatorAxis {\n  X = 'x',\n  Y = 'y',\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {FlyoutSeparator} from '../flyout_separator.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from a flyout separator.\n * This is a no-op placeholder, since flyout separators can't be navigated to.\n */\nexport class FlyoutSeparatorNavigationPolicy\n  implements INavigationPolicy<FlyoutSeparator>\n{\n  getFirstChild(_current: FlyoutSeparator): IFocusableNode | null {\n    return null;\n  }\n\n  getParent(_current: FlyoutSeparator): IFocusableNode | null {\n    return null;\n  }\n\n  getNextSibling(_current: FlyoutSeparator): IFocusableNode | null {\n    return null;\n  }\n\n  getPreviousSibling(_current: FlyoutSeparator): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns whether or not the given flyout separator can be navigated to.\n   *\n   * @param _current The instance to check for navigability.\n   * @returns False.\n   */\n  isNavigable(_current: FlyoutSeparator): boolean {\n    return false;\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a FlyoutSeparator.\n   */\n  isApplicable(current: any): current is FlyoutSeparator {\n    return current instanceof FlyoutSeparator;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {TextInputBubble} from '../bubbles/textinput_bubble.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from an TextInputBubble.\n */\nexport class BlockCommentNavigationPolicy\n  implements INavigationPolicy<TextInputBubble>\n{\n  /**\n   * Returns the first child of the given block comment.\n   *\n   * @param current The block comment to return the first child of.\n   * @returns The text editor of the given block comment bubble.\n   */\n  getFirstChild(current: TextInputBubble): IFocusableNode | null {\n    return current.getEditor();\n  }\n\n  /**\n   * Returns the parent of the given block comment.\n   *\n   * @param current The block comment to return the parent of.\n   * @returns The parent block of the given block comment.\n   */\n  getParent(current: TextInputBubble): IFocusableNode | null {\n    return current.getOwner() ?? null;\n  }\n\n  /**\n   * Returns the next peer node of the given block comment.\n   *\n   * @param _current The block comment to find the following element of.\n   * @returns Null.\n   */\n  getNextSibling(_current: TextInputBubble): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns the previous peer node of the given block comment.\n   *\n   * @param _current The block comment to find the preceding element of.\n   * @returns Null.\n   */\n  getPreviousSibling(_current: TextInputBubble): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns whether or not the given block comment can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given block comment can be focused.\n   */\n  isNavigable(current: TextInputBubble): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is an TextInputBubble.\n   */\n  isApplicable(current: any): current is TextInputBubble {\n    return current instanceof TextInputBubble;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CommentBarButton} from '../comments/comment_bar_button.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from a CommentBarButton.\n */\nexport class CommentBarButtonNavigationPolicy\n  implements INavigationPolicy<CommentBarButton>\n{\n  /**\n   * Returns the first child of the given CommentBarButton.\n   *\n   * @param _current The CommentBarButton to return the first child of.\n   * @returns Null.\n   */\n  getFirstChild(_current: CommentBarButton): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns the parent of the given CommentBarButton.\n   *\n   * @param current The CommentBarButton to return the parent of.\n   * @returns The parent comment of the given CommentBarButton.\n   */\n  getParent(current: CommentBarButton): IFocusableNode | null {\n    return current\n      .getCommentView()\n      .workspace.getCommentById(current.getCommentView().commentId);\n  }\n\n  /**\n   * Returns the next peer node of the given CommentBarButton.\n   *\n   * @param current The CommentBarButton to find the following element of.\n   * @returns The next CommentBarButton, if any.\n   */\n  getNextSibling(current: CommentBarButton): IFocusableNode | null {\n    const children = current.getCommentView().getCommentBarButtons();\n    const currentIndex = children.indexOf(current);\n    if (currentIndex >= 0 && currentIndex + 1 < children.length) {\n      return children[currentIndex + 1];\n    }\n    return null;\n  }\n\n  /**\n   * Returns the previous peer node of the given CommentBarButton.\n   *\n   * @param current The CommentBarButton to find the preceding element of.\n   * @returns The CommentBarButton's previous CommentBarButton, if any.\n   */\n  getPreviousSibling(current: CommentBarButton): IFocusableNode | null {\n    const children = current.getCommentView().getCommentBarButtons();\n    const currentIndex = children.indexOf(current);\n    if (currentIndex > 0) {\n      return children[currentIndex - 1];\n    }\n    return null;\n  }\n\n  /**\n   * Returns whether or not the given CommentBarButton can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given CommentBarButton can be focused.\n   */\n  isNavigable(current: CommentBarButton): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is an CommentBarButton.\n   */\n  isApplicable(current: any): current is CommentBarButton {\n    return current instanceof CommentBarButton;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CommentEditor} from '../comments/comment_editor.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from a comment editor.\n * This is a no-op placeholder (other than isNavigable/isApplicable) since\n * comment editors handle their own navigation when editing ends.\n */\nexport class CommentEditorNavigationPolicy\n  implements INavigationPolicy<CommentEditor>\n{\n  getFirstChild(_current: CommentEditor): IFocusableNode | null {\n    return null;\n  }\n\n  getParent(_current: CommentEditor): IFocusableNode | null {\n    return null;\n  }\n\n  getNextSibling(_current: CommentEditor): IFocusableNode | null {\n    return null;\n  }\n\n  getPreviousSibling(_current: CommentEditor): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns whether or not the given comment editor can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns False.\n   */\n  isNavigable(current: CommentEditor): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a CommentEditor.\n   */\n  isApplicable(current: any): current is CommentEditor {\n    return current instanceof CommentEditor;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {BlockSvg} from '../block_svg.js';\nimport {ConnectionType} from '../connection_type.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\nimport {RenderedConnection} from '../rendered_connection.js';\nimport {navigateBlock} from './block_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from a connection.\n */\nexport class ConnectionNavigationPolicy\n  implements INavigationPolicy<RenderedConnection>\n{\n  /**\n   * Returns the first child of the given connection.\n   *\n   * @param current The connection to return the first child of.\n   * @returns The connection's first child element, or null if not none.\n   */\n  getFirstChild(current: RenderedConnection): IFocusableNode | null {\n    if (current.getParentInput()) {\n      return current.targetConnection;\n    }\n\n    return null;\n  }\n\n  /**\n   * Returns the parent of the given connection.\n   *\n   * @param current The connection to return the parent of.\n   * @returns The given connection's parent connection or block.\n   */\n  getParent(current: RenderedConnection): IFocusableNode | null {\n    return current.getSourceBlock();\n  }\n\n  /**\n   * Returns the next element following the given connection.\n   *\n   * @param current The connection to navigate from.\n   * @returns The field, input connection or block following this connection.\n   */\n  getNextSibling(current: RenderedConnection): IFocusableNode | null {\n    if (current.getParentInput()) {\n      return navigateBlock(current, 1);\n    } else if (current.type === ConnectionType.NEXT_STATEMENT) {\n      const nextBlock = current.targetConnection;\n      // If this connection is the last one in the stack, our next sibling is\n      // the next block stack.\n      const sourceBlock = current.getSourceBlock();\n      if (\n        !nextBlock &&\n        sourceBlock.getRootBlock().lastConnectionInStack(false) === current\n      ) {\n        const topBlocks = sourceBlock.workspace.getTopBlocks(true);\n        let targetIndex = topBlocks.indexOf(sourceBlock.getRootBlock()) + 1;\n        if (targetIndex >= topBlocks.length) {\n          targetIndex = 0;\n        }\n        const nextBlock = topBlocks[targetIndex];\n        return this.getParentConnection(nextBlock) ?? nextBlock;\n      }\n\n      return nextBlock;\n    }\n\n    return current.getSourceBlock();\n  }\n\n  /**\n   * Returns the element preceding the given connection.\n   *\n   * @param current The connection to navigate from.\n   * @returns The field, input connection or block preceding this connection.\n   */\n  getPreviousSibling(current: RenderedConnection): IFocusableNode | null {\n    if (current.getParentInput()) {\n      return navigateBlock(current, -1);\n    } else if (\n      current.type === ConnectionType.PREVIOUS_STATEMENT ||\n      current.type === ConnectionType.OUTPUT_VALUE\n    ) {\n      const previousConnection =\n        current.targetConnection && !current.targetConnection.getParentInput()\n          ? current.targetConnection\n          : null;\n\n      // If this connection is a disconnected previous/output connection, our\n      // previous sibling is the previous block stack's last connection/block.\n      const sourceBlock = current.getSourceBlock();\n      if (\n        !previousConnection &&\n        this.getParentConnection(sourceBlock.getRootBlock()) === current\n      ) {\n        const topBlocks = sourceBlock.workspace.getTopBlocks(true);\n        let targetIndex = topBlocks.indexOf(sourceBlock.getRootBlock()) - 1;\n        if (targetIndex < 0) {\n          targetIndex = topBlocks.length - 1;\n        }\n        const previousRootBlock = topBlocks[targetIndex];\n        return (\n          previousRootBlock.lastConnectionInStack(false) ?? previousRootBlock\n        );\n      }\n\n      return previousConnection;\n    } else if (current.type === ConnectionType.NEXT_STATEMENT) {\n      return current.getSourceBlock();\n    }\n    return null;\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   */\n  protected getParentConnection(block: BlockSvg) {\n    if (!block.outputConnection || block.previousConnection?.isConnected()) {\n      return block.previousConnection;\n    }\n    return block.outputConnection;\n  }\n\n  /**\n   * Returns whether or not the given connection can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given connection can be focused.\n   */\n  isNavigable(current: RenderedConnection): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a RenderedConnection.\n   */\n  isApplicable(current: any): current is RenderedConnection {\n    return current instanceof RenderedConnection;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {BlockSvg} from '../block_svg.js';\nimport {Field} from '../field.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\nimport {navigateBlock} from './block_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from a field.\n */\nexport class FieldNavigationPolicy implements INavigationPolicy<Field<any>> {\n  /**\n   * Returns null since fields do not have children.\n   *\n   * @param _current The field to navigate from.\n   * @returns Null.\n   */\n  getFirstChild(_current: Field<any>): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns the parent block of the given field.\n   *\n   * @param current The field to navigate from.\n   * @returns The given field's parent block.\n   */\n  getParent(current: Field<any>): IFocusableNode | null {\n    return current.getSourceBlock() as BlockSvg;\n  }\n\n  /**\n   * Returns the next field or input following the given field.\n   *\n   * @param current The field to navigate from.\n   * @returns The next field or input in the given field's block.\n   */\n  getNextSibling(current: Field<any>): IFocusableNode | null {\n    return navigateBlock(current, 1);\n  }\n\n  /**\n   * Returns the field or input preceding the given field.\n   *\n   * @param current The field to navigate from.\n   * @returns The preceding field or input in the given field's block.\n   */\n  getPreviousSibling(current: Field<any>): IFocusableNode | null {\n    return navigateBlock(current, -1);\n  }\n\n  /**\n   * Returns whether or not the given field can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given field can be focused and navigated to.\n   */\n  isNavigable(current: Field<any>): boolean {\n    return (\n      current.canBeFocused() &&\n      current.isVisible() &&\n      (current.isClickable() || current.isCurrentlyEditable()) &&\n      !(\n        current.getSourceBlock()?.isSimpleReporter() &&\n        current.isFullBlockField()\n      ) &&\n      current.getParentInput().isVisible()\n    );\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a Field.\n   */\n  isApplicable(current: any): current is Field {\n    return current instanceof Field;\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Comment\n\nimport type {Block} from '../block.js';\nimport type {BlockSvg} from '../block_svg.js';\nimport {TextInputBubble} from '../bubbles/textinput_bubble.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport type {IHasBubble} from '../interfaces/i_has_bubble.js';\nimport type {ISerializable} from '../interfaces/i_serializable.js';\nimport * as renderManagement from '../render_management.js';\nimport {Coordinate} from '../utils.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';\nimport {Icon} from './icon.js';\nimport {IconType} from './icon_types.js';\nimport * as registry from './registry.js';\n\n/** The size of the comment icon in workspace-scale units. */\nconst SIZE = 17;\n\n/** The default width in workspace-scale units of the text input bubble. */\nconst DEFAULT_BUBBLE_WIDTH = 160;\n\n/** The default height in workspace-scale units of the text input bubble. */\nconst DEFAULT_BUBBLE_HEIGHT = 80;\n\n/**\n * An icon which allows the user to add comment text to a block.\n */\nexport class CommentIcon extends Icon implements IHasBubble, ISerializable {\n  /** The type string used to identify this icon. */\n  static readonly TYPE = IconType.COMMENT;\n\n  /**\n   * The weight this icon has relative to other icons. Icons with more positive\n   * weight values are rendered farther toward the end of the block.\n   */\n  static readonly WEIGHT = 3;\n\n  /** The bubble used to show comment text to the user. */\n  private textInputBubble: TextInputBubble | null = null;\n\n  /** The text of this comment. */\n  private text = '';\n\n  /** The size of this comment (which is applied to the editable bubble). */\n  private bubbleSize = new Size(DEFAULT_BUBBLE_WIDTH, DEFAULT_BUBBLE_HEIGHT);\n\n  /** The location of the comment bubble in workspace coordinates. */\n  private bubbleLocation?: Coordinate;\n\n  /**\n   * The visibility of the bubble for this comment.\n   *\n   * This is used to track what the visible state /should/ be, not necessarily\n   * what it currently /is/. E.g. sometimes this will be true, but the block\n   * hasn't been rendered yet, so the bubble will not currently be visible.\n   */\n  private bubbleVisiblity = false;\n\n  constructor(protected readonly sourceBlock: Block) {\n    super(sourceBlock);\n  }\n\n  override getType(): IconType<CommentIcon> {\n    return CommentIcon.TYPE;\n  }\n\n  override initView(pointerdownListener: (e: PointerEvent) => void): void {\n    if (this.svgRoot) return; // Already initialized.\n\n    super.initView(pointerdownListener);\n\n    // Circle.\n    dom.createSvgElement(\n      Svg.CIRCLE,\n      {'class': 'blocklyIconShape', 'r': '8', 'cx': '8', 'cy': '8'},\n      this.svgRoot,\n    );\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      {\n        'class': 'blocklyIconSymbol',\n        'd':\n          '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      this.svgRoot,\n    );\n    // Dot of question mark.\n    dom.createSvgElement(\n      Svg.RECT,\n      {\n        'class': 'blocklyIconSymbol',\n        'x': '6.8',\n        'y': '10.78',\n        'height': '2',\n        'width': '2',\n      },\n      this.svgRoot,\n    );\n    dom.addClass(this.svgRoot!, 'blocklyCommentIcon');\n  }\n\n  override dispose() {\n    super.dispose();\n    this.textInputBubble?.dispose();\n  }\n\n  override getWeight(): number {\n    return CommentIcon.WEIGHT;\n  }\n\n  override getSize(): Size {\n    return new Size(SIZE, SIZE);\n  }\n\n  override applyColour(): void {\n    super.applyColour();\n    const colour = (this.sourceBlock as BlockSvg).getColour();\n    this.textInputBubble?.setColour(colour);\n  }\n\n  /**\n   * Updates the state of the bubble (editable / noneditable) to reflect the\n   * state of the bubble if the bubble is currently shown.\n   */\n  override async updateEditable(): Promise<void> {\n    super.updateEditable();\n    if (this.bubbleIsVisible()) {\n      // Close and reopen the bubble to display the correct UI.\n      await this.setBubbleVisible(false);\n      await this.setBubbleVisible(true);\n    }\n  }\n\n  override onLocationChange(blockOrigin: Coordinate): void {\n    const oldLocation = this.workspaceLocation;\n    super.onLocationChange(blockOrigin);\n    if (this.bubbleLocation) {\n      const newLocation = this.workspaceLocation;\n      const delta = Coordinate.difference(newLocation, oldLocation);\n      this.bubbleLocation = Coordinate.sum(this.bubbleLocation, delta);\n    }\n    const anchorLocation = this.getAnchorLocation();\n    this.textInputBubble?.setAnchorLocation(anchorLocation);\n  }\n\n  /** Sets the text of this comment. Updates any bubbles if they are visible. */\n  setText(text: string) {\n    const oldText = this.text;\n    eventUtils.fire(\n      new (eventUtils.get(EventType.BLOCK_CHANGE))(\n        this.sourceBlock,\n        'comment',\n        null,\n        oldText,\n        text,\n      ),\n    );\n    this.text = text;\n    this.textInputBubble?.setText(this.text);\n  }\n\n  /** Returns the text of this comment. */\n  getText(): string {\n    return this.text;\n  }\n\n  /**\n   * Sets the size of the editable bubble for this comment. Resizes the\n   * bubble if it is visible.\n   */\n  setBubbleSize(size: Size) {\n    this.bubbleSize = size;\n    this.textInputBubble?.setSize(this.bubbleSize, true);\n  }\n\n  /** @returns the size of the editable bubble for this comment. */\n  getBubbleSize(): Size {\n    return this.bubbleSize;\n  }\n\n  /**\n   * Sets the location of the comment bubble in the workspace.\n   */\n  setBubbleLocation(location: Coordinate) {\n    this.bubbleLocation = location;\n    this.textInputBubble?.moveDuringDrag(location);\n  }\n\n  /**\n   * @returns the location of the comment bubble in the workspace.\n   */\n  getBubbleLocation(): Coordinate | undefined {\n    return this.bubbleLocation;\n  }\n\n  /**\n   * @returns the state of the comment as a JSON serializable value if the\n   * comment has text. Otherwise returns null.\n   */\n  saveState(): CommentState | null {\n    if (this.text) {\n      const state: CommentState = {\n        'text': this.text,\n        'pinned': this.bubbleIsVisible(),\n        'height': this.bubbleSize.height,\n        'width': this.bubbleSize.width,\n      };\n      const location = this.getBubbleLocation();\n      if (location) {\n        state['x'] = this.sourceBlock.workspace.RTL\n          ? this.sourceBlock.workspace.getWidth() -\n            (location.x + this.bubbleSize.width)\n          : location.x;\n        state['y'] = location.y;\n      }\n      return state;\n    }\n    return null;\n  }\n\n  /** Applies the given state to this comment. */\n  loadState(state: CommentState) {\n    this.text = state['text'] ?? '';\n    this.bubbleSize = new Size(\n      state['width'] ?? DEFAULT_BUBBLE_WIDTH,\n      state['height'] ?? DEFAULT_BUBBLE_HEIGHT,\n    );\n    this.bubbleVisiblity = state['pinned'] ?? false;\n    this.setBubbleVisible(this.bubbleVisiblity);\n    let x = state['x'];\n    const y = state['y'];\n    renderManagement.finishQueuedRenders().then(() => {\n      if (x && y) {\n        x = this.sourceBlock.workspace.RTL\n          ? this.sourceBlock.workspace.getWidth() - (x + this.bubbleSize.width)\n          : x;\n        this.setBubbleLocation(new Coordinate(x, y));\n      }\n    });\n  }\n\n  override onClick(): void {\n    super.onClick();\n    this.setBubbleVisible(!this.bubbleIsVisible());\n  }\n\n  override isClickableInFlyout(): boolean {\n    return false;\n  }\n\n  /**\n   * Updates the text of this comment in response to changes in the text of\n   * the input bubble.\n   */\n  onTextChange(): void {\n    if (!this.textInputBubble) return;\n\n    const newText = this.textInputBubble.getText();\n    if (this.text === newText) return;\n\n    eventUtils.fire(\n      new (eventUtils.get(EventType.BLOCK_CHANGE))(\n        this.sourceBlock,\n        'comment',\n        null,\n        this.text,\n        newText,\n      ),\n    );\n    this.text = newText;\n  }\n\n  /**\n   * Updates the size of this icon in response to changes in the size of the\n   * input bubble.\n   */\n  onSizeChange(): void {\n    if (this.textInputBubble) {\n      this.bubbleSize = this.textInputBubble.getSize();\n    }\n  }\n\n  onBubbleLocationChange(): void {\n    if (this.textInputBubble) {\n      this.bubbleLocation = this.textInputBubble.getRelativeToSurfaceXY();\n    }\n  }\n\n  bubbleIsVisible(): boolean {\n    return this.bubbleVisiblity;\n  }\n\n  async setBubbleVisible(visible: boolean): Promise<void> {\n    if (this.bubbleVisiblity === visible) return;\n    this.bubbleVisiblity = visible;\n\n    await renderManagement.finishQueuedRenders();\n\n    if (\n      !this.sourceBlock.rendered ||\n      this.sourceBlock.isInFlyout ||\n      this.sourceBlock.isInsertionMarker()\n    )\n      return;\n\n    if (visible) {\n      if (this.sourceBlock.isEditable()) {\n        this.showEditableBubble();\n      } else {\n        this.showNonEditableBubble();\n      }\n      this.applyColour();\n    } else {\n      this.hideBubble();\n    }\n\n    eventUtils.fire(\n      new (eventUtils.get(EventType.BUBBLE_OPEN))(\n        this.sourceBlock,\n        visible,\n        'comment',\n      ),\n    );\n  }\n\n  /** See IHasBubble.getBubble. */\n  getBubble(): TextInputBubble | null {\n    return this.textInputBubble;\n  }\n\n  /**\n   * Shows the editable text bubble for this comment, and adds change listeners\n   * to update the state of this icon in response to changes in the bubble.\n   */\n  private showEditableBubble() {\n    this.createBubble();\n    this.textInputBubble?.addTextChangeListener(() => this.onTextChange());\n    this.textInputBubble?.addSizeChangeListener(() => this.onSizeChange());\n  }\n\n  /** Shows the non editable text bubble for this comment. */\n  private showNonEditableBubble() {\n    this.createBubble();\n    this.textInputBubble?.setEditable(false);\n  }\n\n  protected createBubble() {\n    this.textInputBubble = new TextInputBubble(\n      this.sourceBlock.workspace as WorkspaceSvg,\n      this.getAnchorLocation(),\n      this.getBubbleOwnerRect(),\n      this,\n    );\n    this.textInputBubble.setText(this.getText());\n    this.textInputBubble.setSize(this.bubbleSize, true);\n    if (this.bubbleLocation) {\n      this.textInputBubble.moveDuringDrag(this.bubbleLocation);\n    }\n    this.textInputBubble.addTextChangeListener(() => this.onTextChange());\n    this.textInputBubble.addSizeChangeListener(() => this.onSizeChange());\n    this.textInputBubble.addLocationChangeListener(() =>\n      this.onBubbleLocationChange(),\n    );\n  }\n\n  /** Hides any open bubbles owned by this comment. */\n  private hideBubble() {\n    this.textInputBubble?.dispose();\n    this.textInputBubble = null;\n  }\n\n  /**\n   * @returns the location the bubble should be anchored to.\n   *     I.E. the middle of this icon.\n   */\n  private getAnchorLocation(): Coordinate {\n    const midIcon = SIZE / 2;\n    return Coordinate.sum(\n      this.workspaceLocation,\n      new Coordinate(midIcon, midIcon),\n    );\n  }\n\n  /**\n   * @returns the rect the bubble should avoid overlapping.\n   *     I.E. the block that owns this icon.\n   */\n  private getBubbleOwnerRect(): Rect {\n    return (this.sourceBlock as BlockSvg).getBoundingRectangleWithoutChildren();\n  }\n}\n\n/** The save state format for a comment icon. */\nexport interface CommentState {\n  /** The text of the comment. */\n  text?: string;\n\n  /** True if the comment is open, false otherwise. */\n  pinned?: boolean;\n\n  /** The height of the comment bubble. */\n  height?: number;\n\n  /** The width of the comment bubble. */\n  width?: number;\n\n  /** The X coordinate of the comment bubble. */\n  x?: number;\n\n  /** The Y coordinate of the comment bubble. */\n  y?: number;\n}\n\nregistry.register(CommentIcon.TYPE, CommentIcon);\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BlockSvg} from '../block_svg.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {CommentIcon} from '../icons/comment_icon.js';\nimport {Icon} from '../icons/icon.js';\nimport {MutatorIcon} from '../icons/mutator_icon.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\nimport {navigateBlock} from './block_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from an icon.\n */\nexport class IconNavigationPolicy implements INavigationPolicy<Icon> {\n  /**\n   * Returns the first child of the given icon.\n   *\n   * @param current The icon to return the first child of.\n   * @returns Null.\n   */\n  getFirstChild(current: Icon): IFocusableNode | null {\n    if (\n      current instanceof MutatorIcon &&\n      current.bubbleIsVisible() &&\n      getFocusManager().getFocusedNode() === current\n    ) {\n      return current.getBubble()?.getWorkspace() ?? null;\n    } else if (\n      current instanceof CommentIcon &&\n      current.bubbleIsVisible() &&\n      getFocusManager().getFocusedNode() === current\n    ) {\n      return current.getBubble()?.getEditor() ?? null;\n    }\n\n    return null;\n  }\n\n  /**\n   * Returns the parent of the given icon.\n   *\n   * @param current The icon to return the parent of.\n   * @returns The source block of the given icon.\n   */\n  getParent(current: Icon): IFocusableNode | null {\n    return current.getSourceBlock() as BlockSvg;\n  }\n\n  /**\n   * Returns the next peer node of the given icon.\n   *\n   * @param current The icon to find the following element of.\n   * @returns The next icon, field or input following this icon, if any.\n   */\n  getNextSibling(current: Icon): IFocusableNode | null {\n    return navigateBlock(current, 1);\n  }\n\n  /**\n   * Returns the previous peer node of the given icon.\n   *\n   * @param current The icon to find the preceding element of.\n   * @returns The icon's previous icon, if any.\n   */\n  getPreviousSibling(current: Icon): IFocusableNode | null {\n    return navigateBlock(current, -1);\n  }\n\n  /**\n   * Returns whether or not the given icon can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given icon can be focused.\n   */\n  isNavigable(current: Icon): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is an Icon.\n   */\n  isApplicable(current: any): current is Icon {\n    return current instanceof Icon;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {RenderedWorkspaceComment} from '../comments/rendered_workspace_comment.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\nimport {navigateStacks} from './block_navigation_policy.js';\n\n/**\n * Set of rules controlling keyboard navigation from an RenderedWorkspaceComment.\n */\nexport class WorkspaceCommentNavigationPolicy\n  implements INavigationPolicy<RenderedWorkspaceComment>\n{\n  /**\n   * Returns the first child of the given workspace comment.\n   *\n   * @param current The workspace comment to return the first child of.\n   * @returns The first child button of the given comment.\n   */\n  getFirstChild(current: RenderedWorkspaceComment): IFocusableNode | null {\n    return current.view.getCommentBarButtons()[0];\n  }\n\n  /**\n   * Returns the parent of the given workspace comment.\n   *\n   * @param current The workspace comment to return the parent of.\n   * @returns The parent workspace of the given comment.\n   */\n  getParent(current: RenderedWorkspaceComment): IFocusableNode | null {\n    return current.workspace;\n  }\n\n  /**\n   * Returns the next peer node of the given workspace comment.\n   *\n   * @param current The workspace comment to find the following element of.\n   * @returns The next workspace comment or block stack, if any.\n   */\n  getNextSibling(current: RenderedWorkspaceComment): IFocusableNode | null {\n    return navigateStacks(current, 1);\n  }\n\n  /**\n   * Returns the previous peer node of the given workspace comment.\n   *\n   * @param current The workspace comment to find the preceding element of.\n   * @returns The previous workspace comment or block stack, if any.\n   */\n  getPreviousSibling(current: RenderedWorkspaceComment): IFocusableNode | null {\n    return navigateStacks(current, -1);\n  }\n\n  /**\n   * Returns whether or not the given workspace comment can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given workspace comment can be focused.\n   */\n  isNavigable(current: RenderedWorkspaceComment): boolean {\n    return current.canBeFocused();\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is an RenderedWorkspaceComment.\n   */\n  isApplicable(current: any): current is RenderedWorkspaceComment {\n    return current instanceof RenderedWorkspaceComment;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from '../interfaces/i_navigation_policy.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\n/**\n * Set of rules controlling keyboard navigation from a workspace.\n */\nexport class WorkspaceNavigationPolicy\n  implements INavigationPolicy<WorkspaceSvg>\n{\n  /**\n   * Returns the first child of the given workspace.\n   *\n   * @param current The workspace to return the first child of.\n   * @returns The top block of the first block stack, if any.\n   */\n  getFirstChild(current: WorkspaceSvg): IFocusableNode | null {\n    const blocks = current.getTopBlocks(true);\n    return blocks.length ? blocks[0] : null;\n  }\n\n  /**\n   * Returns the parent of the given workspace.\n   *\n   * @param _current The workspace to return the parent of.\n   * @returns Null.\n   */\n  getParent(_current: WorkspaceSvg): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns the next sibling of the given workspace.\n   *\n   * @param _current The workspace to return the next sibling of.\n   * @returns Null.\n   */\n  getNextSibling(_current: WorkspaceSvg): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns the previous sibling of the given workspace.\n   *\n   * @param _current The workspace to return the previous sibling of.\n   * @returns Null.\n   */\n  getPreviousSibling(_current: WorkspaceSvg): IFocusableNode | null {\n    return null;\n  }\n\n  /**\n   * Returns whether or not the given workspace can be navigated to.\n   *\n   * @param current The instance to check for navigability.\n   * @returns True if the given workspace can be focused.\n   */\n  isNavigable(current: WorkspaceSvg): boolean {\n    return current.canBeFocused() && !current.isMutator;\n  }\n\n  /**\n   * Returns whether the given object can be navigated from by this policy.\n   *\n   * @param current The object to check if this policy applies to.\n   * @returns True if the object is a WorkspaceSvg.\n   */\n  isApplicable(current: any): current is WorkspaceSvg {\n    return current instanceof WorkspaceSvg;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {INavigationPolicy} from './interfaces/i_navigation_policy.js';\nimport {BlockCommentNavigationPolicy} from './keyboard_nav/block_comment_navigation_policy.js';\nimport {BlockNavigationPolicy} from './keyboard_nav/block_navigation_policy.js';\nimport {CommentBarButtonNavigationPolicy} from './keyboard_nav/comment_bar_button_navigation_policy.js';\nimport {CommentEditorNavigationPolicy} from './keyboard_nav/comment_editor_navigation_policy.js';\nimport {ConnectionNavigationPolicy} from './keyboard_nav/connection_navigation_policy.js';\nimport {FieldNavigationPolicy} from './keyboard_nav/field_navigation_policy.js';\nimport {IconNavigationPolicy} from './keyboard_nav/icon_navigation_policy.js';\nimport {WorkspaceCommentNavigationPolicy} from './keyboard_nav/workspace_comment_navigation_policy.js';\nimport {WorkspaceNavigationPolicy} from './keyboard_nav/workspace_navigation_policy.js';\n\ntype RuleList<T> = INavigationPolicy<T>[];\n\n/**\n * Class responsible for determining where focus should move in response to\n * keyboard navigation commands.\n */\nexport class Navigator {\n  /**\n   * Map from classes to a corresponding ruleset to handle navigation from\n   * instances of that class.\n   */\n  protected rules: RuleList<any> = [\n    new BlockNavigationPolicy(),\n    new FieldNavigationPolicy(),\n    new ConnectionNavigationPolicy(),\n    new WorkspaceNavigationPolicy(),\n    new IconNavigationPolicy(),\n    new WorkspaceCommentNavigationPolicy(),\n    new CommentBarButtonNavigationPolicy(),\n    new BlockCommentNavigationPolicy(),\n    new CommentEditorNavigationPolicy(),\n  ];\n\n  /**\n   * Adds a navigation ruleset to this Navigator.\n   *\n   * @param policy A ruleset that determines where focus should move starting\n   *     from an instance of its managed class.\n   */\n  addNavigationPolicy(policy: INavigationPolicy<any>) {\n    this.rules.push(policy);\n  }\n\n  /**\n   * Returns the navigation ruleset associated with the given object instance's\n   * class.\n   *\n   * @param current An object to retrieve a navigation ruleset for.\n   * @returns The navigation ruleset of objects of the given object's class, or\n   *     undefined if no ruleset has been registered for the object's class.\n   */\n  private get(\n    current: IFocusableNode,\n  ): INavigationPolicy<typeof current> | undefined {\n    return this.rules.find((rule) => rule.isApplicable(current));\n  }\n\n  /**\n   * Returns the first child of the given object instance, if any.\n   *\n   * @param current The object to retrieve the first child of.\n   * @returns The first child node of the given object, if any.\n   */\n  getFirstChild(current: IFocusableNode): IFocusableNode | null {\n    const result = this.get(current)?.getFirstChild(current);\n    if (!result) return null;\n    if (!this.get(result)?.isNavigable(result)) {\n      return this.getFirstChild(result) || this.getNextSibling(result);\n    }\n    return result;\n  }\n\n  /**\n   * Returns the parent of the given object instance, if any.\n   *\n   * @param current The object to retrieve the parent of.\n   * @returns The parent node of the given object, if any.\n   */\n  getParent(current: IFocusableNode): IFocusableNode | null {\n    const result = this.get(current)?.getParent(current);\n    if (!result) return null;\n    if (!this.get(result)?.isNavigable(result)) return this.getParent(result);\n    return result;\n  }\n\n  /**\n   * Returns the next sibling of the given object instance, if any.\n   *\n   * @param current The object to retrieve the next sibling node of.\n   * @returns The next sibling node of the given object, if any.\n   */\n  getNextSibling(current: IFocusableNode): IFocusableNode | null {\n    const result = this.get(current)?.getNextSibling(current);\n    if (!result) return null;\n    if (!this.get(result)?.isNavigable(result)) {\n      return this.getNextSibling(result);\n    }\n    return result;\n  }\n\n  /**\n   * Returns the previous sibling of the given object instance, if any.\n   *\n   * @param current The object to retrieve the previous sibling node of.\n   * @returns The previous sibling node of the given object, if any.\n   */\n  getPreviousSibling(current: IFocusableNode): IFocusableNode | null {\n    const result = this.get(current)?.getPreviousSibling(current);\n    if (!result) return null;\n    if (!this.get(result)?.isNavigable(result)) {\n      return this.getPreviousSibling(result);\n    }\n    return result;\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport {FlyoutButtonNavigationPolicy} from './keyboard_nav/flyout_button_navigation_policy.js';\nimport {FlyoutNavigationPolicy} from './keyboard_nav/flyout_navigation_policy.js';\nimport {FlyoutSeparatorNavigationPolicy} from './keyboard_nav/flyout_separator_navigation_policy.js';\nimport {Navigator} from './navigator.js';\n\nexport class FlyoutNavigator extends Navigator {\n  constructor(flyout: IFlyout) {\n    super();\n    this.rules.push(\n      new FlyoutButtonNavigationPolicy(),\n      new FlyoutSeparatorNavigationPolicy(),\n    );\n    this.rules = this.rules.map(\n      (rule) => new FlyoutNavigationPolicy(rule, flyout),\n    );\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 */\n// Former goog.module ID: 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 * Class for a pair of scrollbars.  Horizontal and vertical.\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,\n    addHorizontal?: boolean,\n    addVertical?: boolean,\n    opt_class?: string,\n    opt_margin?: number,\n  ) {\n    addHorizontal = addHorizontal === undefined ? true : addHorizontal;\n    addVertical = addVertical === undefined ? true : addVertical;\n    const isPair = addHorizontal && addVertical;\n\n    if (addHorizontal) {\n      this.hScroll = new Scrollbar(\n        workspace,\n        true,\n        isPair,\n        opt_class,\n        opt_margin,\n      );\n    }\n    if (addVertical) {\n      this.vScroll = new Scrollbar(\n        workspace,\n        false,\n        isPair,\n        opt_class,\n        opt_margin,\n      );\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  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 (\n      !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    ) {\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 (\n        !this.oldHostMetrics ||\n        this.oldHostMetrics.scrollWidth !== hostMetrics.scrollWidth ||\n        this.oldHostMetrics.viewLeft !== hostMetrics.viewLeft ||\n        this.oldHostMetrics.scrollLeft !== hostMetrics.scrollLeft\n      ) {\n        resizeH = true;\n      }\n      if (\n        !this.oldHostMetrics ||\n        this.oldHostMetrics.scrollHeight !== hostMetrics.scrollHeight ||\n        this.oldHostMetrics.viewTop !== hostMetrics.viewTop ||\n        this.oldHostMetrics.scrollTop !== hostMetrics.scrollTop\n      ) {\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 (\n        !this.oldHostMetrics ||\n        this.oldHostMetrics.viewWidth !== hostMetrics.viewWidth ||\n        this.oldHostMetrics.absoluteLeft !== hostMetrics.absoluteLeft\n      ) {\n        this.corner_?.setAttribute('x', String(this.vScroll.position.x));\n      }\n      if (\n        !this.oldHostMetrics ||\n        this.oldHostMetrics.viewHeight !== hostMetrics.viewHeight ||\n        this.oldHostMetrics.absoluteTop !== hostMetrics.absoluteTop\n      ) {\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   * Sets the visibility of any existing scrollbars.\n   *\n   * @param visible True if visible.\n   */\n  setVisible(visible: boolean) {\n    if (this.hScroll) this.hScroll.setVisibleInternal(visible);\n    if (this.vScroll) this.vScroll.setVisibleInternal(visible);\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 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {FlyoutItem} from './flyout_item.js';\nimport {FlyoutSeparator, SeparatorAxis} from './flyout_separator.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js';\nimport * as registry from './registry.js';\nimport type {SeparatorInfo} from './utils/toolbox.js';\n\n/**\n * @internal\n */\nexport const SEPARATOR_TYPE = 'sep';\n\n/**\n * Class responsible for creating separators for flyouts.\n */\nexport class SeparatorFlyoutInflater implements IFlyoutInflater {\n  /**\n   * Inflates a dummy flyout separator.\n   *\n   * The flyout automatically creates separators between every element with a\n   * size determined by calling gapForElement on the relevant inflater.\n   * Additionally, users can explicitly add separators in the flyout definition.\n   * When separators (implicitly or explicitly created) follow one another, the\n   * gap of the last one propagates backwards and flattens to one separator.\n   * This flattening is not additive; if there are initially separators of 2, 3,\n   * and 4 pixels, after normalization there will be one separator of 4 pixels.\n   * Therefore, this method returns a zero-width separator, which will be\n   * replaced by the one implicitly created by the flyout based on the value\n   * returned by gapForElement, which knows the default gap, unlike this method.\n   *\n   * @param _state A JSON representation of a flyout separator.\n   * @param flyout The flyout to create the separator for.\n   * @returns A newly created FlyoutSeparator.\n   */\n  load(_state: object, flyout: IFlyout): FlyoutItem {\n    const flyoutAxis = flyout.horizontalLayout\n      ? SeparatorAxis.X\n      : SeparatorAxis.Y;\n    const separator = new FlyoutSeparator(0, flyoutAxis);\n    return new FlyoutItem(separator, SEPARATOR_TYPE);\n  }\n\n  /**\n   * Returns the size of the separator. See `load` for more details.\n   *\n   * @param state A JSON representation of a flyout separator.\n   * @param defaultGap The default spacing for flyout items.\n   * @returns The desired size of the separator.\n   */\n  gapForItem(state: object, defaultGap: number): number {\n    const separatorState = state as SeparatorInfo;\n    const newGap = parseInt(String(separatorState['gap']));\n    return newGap ?? defaultGap;\n  }\n\n  /**\n   * Disposes of the given separator. Intentional no-op.\n   *\n   * @param _item The flyout separator to dispose of.\n   */\n  disposeItem(_item: FlyoutItem): void {}\n\n  /**\n   * Returns the type of items this inflater is responsible for creating.\n   *\n   * @returns An identifier for the type of items this inflater creates.\n   */\n  getType() {\n    return SEPARATOR_TYPE;\n  }\n}\n\nregistry.register(\n  registry.Type.FLYOUT_INFLATER,\n  SEPARATOR_TYPE,\n  SeparatorFlyoutInflater,\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 */\n// Former goog.module ID: Blockly.Flyout\n\nimport {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport {ComponentManager} from './component_manager.js';\nimport {DeleteArea} from './delete_area.js';\nimport type {Abstract as AbstractEvent} from './events/events_abstract.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {FlyoutItem} from './flyout_item.js';\nimport {FlyoutMetricsManager} from './flyout_metrics_manager.js';\nimport {FlyoutNavigator} from './flyout_navigator.js';\nimport {FlyoutSeparator, SeparatorAxis} from './flyout_separator.js';\nimport {IAutoHideable} from './interfaces/i_autohideable.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js';\nimport {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from './interfaces/i_focusable_tree.js';\nimport type {Options} from './options.js';\nimport * as registry from './registry.js';\nimport * as renderManagement from './render_management.js';\nimport {ScrollbarPair} from './scrollbar_pair.js';\nimport {SEPARATOR_TYPE} from './separator_flyout_inflater.js';\nimport * as blocks from './serialization/blocks.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';\n\n/**\n * Class for a flyout.\n */\nexport abstract class Flyout\n  extends DeleteArea\n  implements IAutoHideable, IFlyout, IFocusableNode\n{\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 elements in the flyout.\n   *\n   * @param contents The flyout elements to lay out.\n   */\n  protected abstract layout_(contents: FlyoutItem[]): 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 bounds of flyout.\n   * For RTL: Lay out the elements 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  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   * Array holding info needed to unbind events.\n   * Used for disposing.\n   * Ex: [[node, name, func], [node, name, func]].\n   */\n  private boundEvents: browserEvents.Data[] = [];\n\n  /**\n   * Function that will be registered as a change listener on the workspace\n   * to reflow when elements in the flyout workspace change.\n   */\n  private reflowWrapper: ((e: AbstractEvent) => void) | null = null;\n\n  /**\n   * List of flyout elements.\n   */\n  protected contents: FlyoutItem[] = [];\n\n  protected readonly tabWidth_: number;\n\n  /**\n   * The target workspace.\n   *\n   * @internal\n   */\n  targetWorkspace!: WorkspaceSvg;\n\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 visible = false;\n\n  /**\n   * Whether the workspace containing this flyout is visible.\n   */\n  private containerVisible = true;\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  /**\n   * Map from flyout content type to the corresponding inflater class\n   * responsible for creating concrete instances of the content type.\n   */\n  protected inflaters = new Map<string, IFlyoutInflater>();\n\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\n    this.workspace_.internalIsFlyout = true;\n    // Keep the workspace visibility consistent with the flyout's visibility.\n    this.workspace_.setVisible(this.visible);\n    this.workspace_.setNavigator(new FlyoutNavigator(this));\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     * Margin around the edges of the elements 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(\n    tagName: string | Svg<SVGSVGElement> | Svg<SVGGElement>,\n  ): 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(tagName, {\n      'class': 'blocklyFlyout',\n    });\n    this.svgGroup_.style.display = 'none';\n    this.svgBackground_ = dom.createSvgElement(\n      Svg.PATH,\n      {'class': 'blocklyFlyoutBackground'},\n      this.svgGroup_,\n    );\n    this.svgGroup_.appendChild(this.workspace_.createDom());\n    this.workspace_\n      .getThemeManager()\n      .subscribe(this.svgBackground_, 'flyoutBackgroundColour', 'fill');\n    this.workspace_\n      .getThemeManager()\n      .subscribe(this.svgBackground_, 'flyoutOpacity', 'fill-opacity');\n\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_,\n      this.horizontalLayout,\n      !this.horizontalLayout,\n      'blocklyFlyoutScrollbar',\n      this.SCROLLBAR_MARGIN,\n    );\n\n    this.hide();\n\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        this.svgGroup_ as SVGGElement,\n        'wheel',\n        this,\n        this.wheel_,\n      ),\n    );\n\n    // Dragging the flyout up and down.\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        this.svgBackground_ as SVGPathElement,\n        'pointerdown',\n        this,\n        this.onMouseDown,\n      ),\n    );\n\n    // A flyout connected to a workspace doesn't have its own current gesture.\n    this.workspace_.getGesture = this.targetWorkspace.getGesture.bind(\n      this.targetWorkspace,\n    );\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: ComponentManager.ComponentWeight.FLYOUT_WEIGHT,\n      capabilities: [\n        ComponentManager.Capability.AUTOHIDEABLE,\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  dispose() {\n    this.hide();\n    this.targetWorkspace.getComponentManager().removeComponent(this.id);\n    for (const event of this.boundEvents) {\n      browserEvents.unbind(event);\n    }\n    this.boundEvents.length = 0;\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    }\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   */\n  getWorkspace(): WorkspaceSvg {\n    return this.workspace_;\n  }\n\n  /**\n   * Sets whether this flyout automatically closes when blocks are dragged out,\n   * the workspace is clicked, etc, or not.\n   */\n  setAutoClose(autoClose: boolean) {\n    this.autoClose = autoClose;\n    this.targetWorkspace.recordDragTargets();\n    this.targetWorkspace.resizeContents();\n  }\n\n  /** Automatically hides the flyout if it is an autoclosing flyout. */\n  autoHide(onlyClosePopups: boolean): void {\n    if (\n      !onlyClosePopups &&\n      this.targetWorkspace.getFlyout(true) === this &&\n      this.autoClose\n    )\n      this.hide();\n  }\n\n  /**\n   * Get the target workspace inside the flyout.\n   *\n   * @returns The target workspace inside the flyout.\n   */\n  getTargetWorkspace(): WorkspaceSvg {\n    return this.targetWorkspace;\n  }\n\n  /**\n   * Is the flyout visible?\n   *\n   * @returns True if visible.\n   */\n  isVisible(): boolean {\n    return this.visible;\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.visible = 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.targetWorkspace.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   * Get the list of elements of the current flyout.\n   *\n   * @returns The array of flyout elements.\n   */\n  getContents(): FlyoutItem[] {\n    return this.contents;\n  }\n\n  /**\n   * Store the list of elements on the flyout.\n   *\n   * @param contents - The array of items for the flyout.\n   */\n  setContents(contents: FlyoutItem[]): void {\n    this.contents = contents;\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}`);\n    this.svgGroup_?.setAttribute('height', `${height}`);\n    this.workspace_.setCachedParentSvgSize(width, height);\n\n    if (this.svgGroup_) {\n      const transform = 'translate(' + x + 'px,' + y + 'px)';\n      dom.setCssTransform(this.svgGroup_, 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,\n          scrollbar.hScroll.position.y,\n        );\n      }\n      if (scrollbar.vScroll) {\n        scrollbar.vScroll.setPosition(\n          scrollbar.vScroll.position.x,\n          scrollbar.vScroll.position.y,\n        );\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    if (this.reflowWrapper) {\n      this.workspace_.removeChangeListener(this.reflowWrapper);\n      this.reflowWrapper = null;\n    }\n    // Do NOT delete the flyout contents here.  Wait until Flyout.show.\n    // https://neil.fraser.name/news/2014/08/09/\n  }\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    renderManagement.triggerQueuedRenders(this.workspace_);\n\n    this.setContents(flyoutInfo);\n\n    this.layout_(flyoutInfo);\n\n    if (this.horizontalLayout) {\n      this.height_ = 0;\n    } else {\n      this.width_ = 0;\n    }\n    this.reflow();\n    this.workspace_.setResizesEnabled(true);\n\n    // Listen for block change events, and reflow the flyout in response. This\n    // accommodates e.g. resizing a non-autoclosing flyout in response to the\n    // user typing long strings into fields on the blocks in the flyout.\n    this.reflowWrapper = (event) => {\n      if (\n        event.type === EventType.BLOCK_CHANGE ||\n        event.type === EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE\n      ) {\n        this.reflow();\n      }\n    };\n    this.workspace_.addChangeListener(this.reflowWrapper);\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 needed to lay out the flyout.\n   */\n  private createFlyoutInfo(\n    parsedContent: toolbox.FlyoutItemInfoArray,\n  ): FlyoutItem[] {\n    const contents: FlyoutItem[] = [];\n    const defaultGap = this.horizontalLayout ? this.GAP_X : this.GAP_Y;\n    for (const info of parsedContent) {\n      if ('custom' in info) {\n        const customInfo = info as toolbox.DynamicCategoryInfo;\n        const categoryName = customInfo['custom'];\n        const flyoutDef = this.getDynamicCategoryContents(categoryName);\n        const parsedDynamicContent =\n          toolbox.convertFlyoutDefToJsonArray(flyoutDef);\n        contents.push(...this.createFlyoutInfo(parsedDynamicContent));\n      }\n\n      const type = info['kind'].toLowerCase();\n      const inflater = this.getInflaterForType(type);\n      if (inflater) {\n        contents.push(inflater.load(info, this));\n        const gap = inflater.gapForItem(info, defaultGap);\n        if (gap) {\n          contents.push(\n            new FlyoutItem(\n              new FlyoutSeparator(\n                gap,\n                this.horizontalLayout ? SeparatorAxis.X : SeparatorAxis.Y,\n              ),\n              SEPARATOR_TYPE,\n            ),\n          );\n        }\n      }\n    }\n\n    return this.normalizeSeparators(contents);\n  }\n\n  /**\n   * Updates and returns the provided list of flyout contents to flatten\n   * separators as needed.\n   *\n   * When multiple separators occur one after another, the value of the last one\n   * takes precedence and the earlier separators in the group are removed.\n   *\n   * @param contents The list of flyout contents to flatten separators in.\n   * @returns An updated list of flyout contents with only one separator between\n   *     each non-separator item.\n   */\n  protected normalizeSeparators(contents: FlyoutItem[]): FlyoutItem[] {\n    for (let i = contents.length - 1; i > 0; i--) {\n      const elementType = contents[i].getType().toLowerCase();\n      const previousElementType = contents[i - 1].getType().toLowerCase();\n      if (\n        elementType === SEPARATOR_TYPE &&\n        previousElementType === SEPARATOR_TYPE\n      ) {\n        // Remove previousElement from the array, shifting the current element\n        // forward as a result. This preserves the behavior where explicit\n        // separator elements override the value of prior implicit (or explicit)\n        // separator elements.\n        contents.splice(i - 1, 1);\n      }\n    }\n\n    return contents;\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(\n    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(categoryName);\n    if (typeof fnToApply !== 'function') {\n      throw TypeError(\n        \"Couldn't find a callback function when opening\" +\n          ' a toolbox category.',\n      );\n    }\n    return fnToApply(this.workspace_.targetWorkspace!);\n  }\n\n  /**\n   * Delete elements from a previous showing of the flyout.\n   */\n  private clearOldBlocks() {\n    this.getContents().forEach((item) => {\n      const inflater = this.getInflaterForType(item.getType());\n      inflater?.disposeItem(item);\n    });\n\n    // Clear potential variables from the previous showing.\n    this.workspace_.getPotentialVariableMap()?.clear();\n  }\n\n  /**\n   * Pointer down on the flyout background.  Start a vertical scroll drag.\n   *\n   * @param e Pointer down event.\n   */\n  private onMouseDown(e: PointerEvent) {\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() && !this.getTargetWorkspace().isReadOnly();\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,\n      variablesBeforeCreation,\n    );\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(EventType.VAR_CREATE))(thisVariable),\n        );\n      }\n\n      // Block events come after var events, in case they refer to newly created\n      // variables.\n      eventUtils.fire(new (eventUtils.get(EventType.BLOCK_CREATE))(newBlock));\n    }\n    if (this.autoClose) {\n      this.hide();\n    }\n    return newBlock;\n  }\n\n  /**\n   * Reflow flyout contents.\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\n      ? 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 = this.serializeBlock(oldBlock);\n    // Normally 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   * Serialize a block to JSON.\n   *\n   * @param block The block to serialize.\n   * @returns A serialized representation of the block.\n   */\n  protected serializeBlock(block: BlockSvg): blocks.State {\n    return blocks.save(block) as blocks.State;\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 = Coordinate.sum(\n      flyoutOffsetPixels,\n      oldBlockPos,\n    );\n\n    // The position of the old block in pixels relative to the origin of the\n    // main workspace.\n    const finalOffset = Coordinate.difference(\n      oldBlockOffsetPixels,\n      mainOffsetPixels,\n    );\n    // The position of the old block in main workspace coordinates.\n    finalOffset.scale(1 / targetWorkspace.scale);\n\n    // No 'reason' provided since events are disabled.\n    block.moveTo(new Coordinate(finalOffset.x, finalOffset.y));\n  }\n\n  /**\n   * Returns the inflater responsible for constructing items of the given type.\n   *\n   * @param type The type of flyout content item to provide an inflater for.\n   * @returns An inflater object for the given type, or null if no inflater\n   *     is registered for that type.\n   */\n  protected getInflaterForType(type: string): IFlyoutInflater | null {\n    if (this.inflaters.has(type)) {\n      return this.inflaters.get(type) ?? null;\n    }\n\n    const InflaterClass = registry.getClass(\n      registry.Type.FLYOUT_INFLATER,\n      type,\n    );\n    if (InflaterClass) {\n      const inflater = new InflaterClass();\n      this.inflaters.set(type, inflater);\n      return inflater;\n    }\n\n    return null;\n  }\n\n  /**\n   * See IFocusableNode.getFocusableElement.\n   *\n   * @deprecated v12: Use the Flyout's workspace for focus operations, instead.\n   */\n  getFocusableElement(): HTMLElement | SVGElement {\n    throw new Error('Flyouts are not directly focusable.');\n  }\n\n  /**\n   * See IFocusableNode.getFocusableTree.\n   *\n   * @deprecated v12: Use the Flyout's workspace for focus operations, instead.\n   */\n  getFocusableTree(): IFocusableTree {\n    throw new Error('Flyouts are not directly focusable.');\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {}\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return false;\n  }\n\n  /**\n   * See IFocusableNode.getRootFocusableNode.\n   *\n   * @deprecated v12: Use the Flyout's workspace for focus operations, instead.\n   */\n  getRootFocusableNode(): IFocusableNode {\n    throw new Error('Flyouts are not directly focusable.');\n  }\n\n  /**\n   * See IFocusableNode.getRestoredFocusableNode.\n   *\n   * @deprecated v12: Use the Flyout's workspace for focus operations, instead.\n   */\n  getRestoredFocusableNode(\n    _previousNode: IFocusableNode | null,\n  ): IFocusableNode | null {\n    throw new Error('Flyouts are not directly focusable.');\n  }\n\n  /**\n   * See IFocusableNode.getNestedTrees.\n   *\n   * @deprecated v12: Use the Flyout's workspace for focus operations, instead.\n   */\n  getNestedTrees(): Array<IFocusableTree> {\n    throw new Error('Flyouts are not directly focusable.');\n  }\n\n  /**\n   * See IFocusableNode.lookUpFocusableNode.\n   *\n   * @deprecated v12: Use the Flyout's workspace for focus operations, instead.\n   */\n  lookUpFocusableNode(_id: string): IFocusableNode | null {\n    throw new Error('Flyouts are not directly focusable.');\n  }\n\n  /** See IFocusableTree.onTreeFocus. */\n  onTreeFocus(\n    _node: IFocusableNode,\n    _previousTree: IFocusableTree | null,\n  ): void {}\n\n  /**\n   * See IFocusableNode.onTreeBlur.\n   *\n   * @deprecated v12: Use the Flyout's workspace for focus operations, instead.\n   */\n  onTreeBlur(_nextTree: IFocusableTree | null): void {\n    throw new Error('Flyouts are not directly focusable.');\n  }\n}\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The KeyboardNavigationController handles coordinating Blockly-wide\n * keyboard navigation behavior, such as enabling/disabling full\n * cursor visualization.\n */\nexport class KeyboardNavigationController {\n  /** Whether the user is actively using keyboard navigation. */\n  private isActive = false;\n  /** Css class name added to body if keyboard nav is active. */\n  private activeClassName = 'blocklyKeyboardNavigation';\n\n  /**\n   * Sets whether a user is actively using keyboard navigation.\n   *\n   * If they are, apply a css class to the entire page so that\n   * focused items can apply additional styling for keyboard users.\n   *\n   * Note that since enabling keyboard navigation presents significant UX changes\n   * (such as cursor visualization and move mode), callers should take care to\n   * only set active keyboard navigation when they have a high confidence in that\n   * being the correct state. In general, in any given mouse or key input situation\n   * callers can choose one of three paths:\n   * 1. Do nothing. This should be the choice for neutral actions that don't\n   *    predominantly imply keyboard or mouse usage (such as clicking to select a block).\n   * 2. Disable keyboard navigation. This is the best choice when a user is definitely\n   *    predominantly using the mouse (such as using a right click to open the context menu).\n   * 3. Enable keyboard navigation. This is the best choice when there's high confidence\n   *    a user actually intends to use it (such as attempting to use the arrow keys to move\n   *    around).\n   *\n   * @param isUsing\n   */\n  setIsActive(isUsing: boolean = true) {\n    this.isActive = isUsing;\n    this.updateActiveVisualization();\n  }\n\n  /**\n   * @returns true if the user is actively using keyboard navigation\n   * (e.g., has recently taken some action that is only relevant to keyboard users)\n   */\n  getIsActive(): boolean {\n    return this.isActive;\n  }\n\n  /** Adds or removes the css class that indicates keyboard navigation is active. */\n  private updateActiveVisualization() {\n    if (this.isActive) {\n      document.body.classList.add(this.activeClassName);\n    } else {\n      document.body.classList.remove(this.activeClassName);\n    }\n  }\n}\n\n/** Singleton instance of the keyboard navigation controller. */\nexport const keyboardNavigationController = new KeyboardNavigationController();\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 */\n// Former goog.module ID: Blockly.WorkspaceDragger\n\nimport {Coordinate} from './utils/coordinate.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\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 *\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   * @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\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  }\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, e.g. a drag,\n * tap, or pinch to zoom.\n *\n * @class\n */\n// Former goog.module ID: 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 {RenderedWorkspaceComment} from './comments.js';\nimport * as common from './common.js';\nimport {config} from './config.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport type {Field} from './field.js';\nimport {getFocusManager} from './focus_manager.js';\nimport type {IBubble} from './interfaces/i_bubble.js';\nimport {IDraggable, isDraggable} from './interfaces/i_draggable.js';\nimport {IDragger} from './interfaces/i_dragger.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IIcon} from './interfaces/i_icon.js';\nimport {keyboardNavigationController} from './keyboard_navigation_controller.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 {WorkspaceDragger} from './workspace_dragger.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Note: In this file \"start\" refers to pointerdown\n * events.  \"End\" refers to pointerup 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 */\nexport class Gesture {\n  /**\n   * The position of the pointer when the gesture started.  Units are CSS\n   * pixels, with (0, 0) at the top left of the browser window (pointer event\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 icon that the gesture started on, or null if it did not start on an\n   * icon.\n   */\n  private startIcon: IIcon | 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 comment that the gesture started on, or null if it did not start on a\n   * comment.\n   */\n  private startComment: RenderedWorkspaceComment | 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   * Array holding info needed to unbind events.\n   * Used for disposing.\n   * Ex: [[node, name, func], [node, name, func]].\n   */\n  private boundEvents: browserEvents.Data[] = [];\n\n  private dragger: IDragger | 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  /** Whether the gesture is dragging or not. */\n  private dragging: boolean = false;\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 gestureHasStarted = false;\n\n  /** Boolean used internally to break a cycle in disposal. */\n  protected isEnding_ = false;\n\n  /** The event that most recently updated this gesture. */\n  private mostRecentEvent: PointerEvent;\n\n  /** Boolean for whether or not this gesture is a multi-touch gesture. */\n  private multiTouch = 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  /** Boolean for whether or not the workspace supports pinch-zoom. */\n  private isPinchZoomEnabled: boolean | null = null;\n\n  /**\n   * The owner of the dropdownDiv when this gesture first starts.\n   * Needed because we'll close the dropdown before fields get to\n   * act on their events, and some fields care about who owns\n   * the dropdown.\n   */\n  currentDropdownOwner: Field | null = null;\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(\n    e: PointerEvent,\n    private readonly creatorWorkspace: WorkspaceSvg,\n  ) {\n    this.mostRecentEvent = e;\n\n    /**\n     * How far the pointer 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  /**\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    for (const event of this.boundEvents) {\n      browserEvents.unbind(event);\n    }\n    this.boundEvents.length = 0;\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 pointer event.\n   */\n  private updateFromEvent(e: PointerEvent) {\n    const currentXY = new Coordinate(e.clientX, e.clientY);\n    const changed = this.updateDragDelta(currentXY);\n    // Exceeded the drag radius for the first time.\n    if (changed) {\n      this.updateIsDragging(e);\n      Touch.longStop();\n    }\n    this.mostRecentEvent = e;\n  }\n\n  /**\n   * DO MATH to set currentDragDeltaXY_ based on the most recent pointer\n   * position.\n   *\n   * @param currentXY The most recent 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 = Coordinate.difference(\n      currentXY,\n      this.mouseDownXY,\n    );\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 = this.flyout\n        ? config.flyoutDragRadius\n        : 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 pointermove 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 || !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 (\n      !this.flyout.isScrollable() ||\n      this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY)\n    ) {\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      getFocusManager().focusNode(this.targetBlock);\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 pointermove 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\n    const wsMovable = this.flyout\n      ? this.flyout.isScrollable()\n      : this.startWorkspace_ && this.startWorkspace_.isDraggable();\n    if (!wsMovable) return;\n\n    this.dragging = true;\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 pointermove 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(e: PointerEvent) {\n    if (!this.startWorkspace_) {\n      throw new Error(\n        'Cannot update dragging because the start workspace is undefined',\n      );\n    }\n\n    if (this.calledUpdateIsDragging) {\n      throw Error('updateIsDragging_ should only be called once per gesture.');\n    }\n    this.calledUpdateIsDragging = true;\n\n    // If we drag a block out of the flyout, it updates `common.getSelected`\n    // to return the new block.\n    if (this.flyout) this.updateIsDraggingFromFlyout();\n\n    const selected = common.getSelected();\n    if (selected && isDraggable(selected) && selected.isMovable()) {\n      this.dragging = true;\n      this.dragger = this.createDragger(selected, this.startWorkspace_);\n      this.dragger.onDragStart(e);\n      this.dragger.onDrag(e, this.currentDragDeltaXY);\n    } else {\n      this.updateIsDraggingWorkspace();\n    }\n  }\n\n  private createDragger(\n    draggable: IDraggable,\n    workspace: WorkspaceSvg,\n  ): IDragger {\n    const DraggerClass = registry.getClassFromOptions(\n      registry.Type.BLOCK_DRAGGER,\n      this.creatorWorkspace.options,\n      true,\n    );\n    return new DraggerClass!(draggable, workspace);\n  }\n\n  /**\n   * Start a gesture: update the workspace to indicate that a gesture is in\n   * progress and bind pointermove and pointerup handlers.\n   *\n   * @param e A pointerdown event.\n   * @internal\n   */\n  doStart(e: PointerEvent) {\n    if (!this.startWorkspace_) {\n      throw new Error(\n        'Cannot start the touch gesture becauase the start ' +\n          'workspace is undefined',\n      );\n    }\n    this.isPinchZoomEnabled =\n      this.startWorkspace_.options.zoomOptions &&\n      this.startWorkspace_.options.zoomOptions.pinch;\n\n    if (browserEvents.isTargetInput(e)) {\n      this.cancel();\n      return;\n    }\n\n    this.gestureHasStarted = 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\n    // Keep track of which field owns the dropdown before we close it.\n    this.currentDropdownOwner = dropDownDiv.getOwner();\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 (browserEvents.isRightButton(e)) {\n      this.handleRightClick(e);\n      return;\n    }\n\n    if (e.type.toLowerCase() === 'pointerdown' && e.pointerType !== 'mouse') {\n      Touch.longStart(e, this);\n    }\n\n    this.mouseDownXY = new Coordinate(e.clientX, e.clientY);\n\n    this.bindMouseEvents(e);\n\n    if (!this.isEnding_) {\n      this.handleTouchStart(e);\n    }\n  }\n\n  /**\n   * Bind gesture events.\n   *\n   * @param e A pointerdown event.\n   * @internal\n   */\n  bindMouseEvents(e: PointerEvent) {\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        document,\n        'pointerdown',\n        null,\n        this.handleStart.bind(this),\n        /* opt_noCaptureIdentifier */ true,\n      ),\n    );\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        document,\n        'pointermove',\n        null,\n        this.handleMove.bind(this),\n        /* opt_noCaptureIdentifier */ true,\n      ),\n    );\n    this.boundEvents.push(\n      browserEvents.conditionalBind(\n        document,\n        'pointerup',\n        null,\n        this.handleUp.bind(this),\n        /* opt_noCaptureIdentifier */ true,\n      ),\n    );\n\n    e.preventDefault();\n    e.stopPropagation();\n  }\n\n  /**\n   * Handle a pointerdown event.\n   *\n   * @param e A pointerdown event.\n   * @internal\n   */\n  handleStart(e: PointerEvent) {\n    if (this.isDragging()) {\n      // A drag has already started, so this can no longer be a pinch-zoom.\n      return;\n    }\n    this.handleTouchStart(e);\n\n    if (this.isMultiTouch()) {\n      Touch.longStop();\n    }\n  }\n\n  /**\n   * Handle a pointermove event.\n   *\n   * @param e A pointermove event.\n   * @internal\n   */\n  handleMove(e: PointerEvent) {\n    if (\n      (this.isDragging() && Touch.shouldHandleEvent(e)) ||\n      !this.isMultiTouch()\n    ) {\n      this.updateFromEvent(e);\n      if (this.workspaceDragger) {\n        this.workspaceDragger.drag(this.currentDragDeltaXY);\n      } else if (this.dragger) {\n        this.dragger.onDrag(this.mostRecentEvent, this.currentDragDeltaXY);\n      }\n      e.preventDefault();\n      e.stopPropagation();\n    } else if (this.isMultiTouch()) {\n      this.handleTouchMove(e);\n      Touch.longStop();\n    }\n  }\n\n  /**\n   * Handle a pointerup event.\n   *\n   * @param e A pointerup event.\n   * @internal\n   */\n  handleUp(e: PointerEvent) {\n    if (!this.isDragging()) {\n      this.handleTouchEnd(e);\n    }\n    if (!this.isMultiTouch() || this.isDragging()) {\n      if (!Touch.shouldHandleEvent(e)) {\n        return;\n      }\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 and icons have higher priority than blocks; blocks\n      // have higher priority than workspaces. The ordering within drags does\n      // not matter, because the three types of dragging are exclusive.\n      if (this.dragger) {\n        keyboardNavigationController.setIsActive(false);\n        this.dragger.onDragEnd(e, this.currentDragDeltaXY);\n      } else if (this.workspaceDragger) {\n        keyboardNavigationController.setIsActive(false);\n        this.workspaceDragger.endDrag(this.currentDragDeltaXY);\n      } else if (this.isBubbleClick()) {\n        // Do nothing, bubbles don't currently respond to clicks.\n      } else if (this.isCommentClick()) {\n        // Do nothing, comments don't currently respond to clicks.\n      } else if (this.isFieldClick()) {\n        this.doFieldClick();\n      } else if (this.isIconClick()) {\n        this.doIconClick();\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    } else {\n      e.preventDefault();\n      e.stopPropagation();\n\n      this.dispose();\n    }\n  }\n\n  /**\n   * Handle a pointerdown event and keep track of current\n   * pointers.\n   *\n   * @param e A pointerdown event.\n   * @internal\n   */\n  handleTouchStart(e: PointerEvent) {\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.multiTouch = true;\n      e.preventDefault();\n    }\n  }\n\n  /**\n   * Handle a pointermove event and zoom in/out if two pointers\n   * are on the screen.\n   *\n   * @param e A pointermove event.\n   * @internal\n   */\n  handleTouchMove(e: PointerEvent) {\n    const pointerId = Touch.getTouchIdentifierFromEvent(e);\n    this.cachedPoints.set(pointerId, this.getTouchPoint(e));\n\n    if (this.isPinchZoomEnabled && this.cachedPoints.size === 2) {\n      this.handlePinch(e);\n    } else {\n      // Handle the move directly instead of calling handleMove\n      this.updateFromEvent(e);\n      if (this.workspaceDragger) {\n        this.workspaceDragger.drag(this.currentDragDeltaXY);\n      } else if (this.dragger) {\n        this.dragger.onDrag(this.mostRecentEvent, this.currentDragDeltaXY);\n      }\n      e.preventDefault();\n      e.stopPropagation();\n    }\n  }\n\n  /**\n   * Handle pinch zoom gesture.\n   *\n   * @param e A pointermove event.\n   */\n  private handlePinch(e: PointerEvent) {\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 =\n        gestureScale > 0\n          ? 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 ' + 'is undefined',\n        );\n      }\n      const workspace = this.startWorkspace_;\n      const position = browserEvents.mouseToSvg(\n        e,\n        workspace.getParentSvg(),\n        workspace.getInverseScreenCTM(),\n      );\n      workspace.zoom(position.x, position.y, delta);\n    }\n    this.previousScale = scale;\n    e.preventDefault();\n  }\n\n  /**\n   * Handle a pointerup event and end the gesture.\n   *\n   * @param e A pointerup event.\n   * @internal\n   */\n  handleTouchEnd(e: PointerEvent) {\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 pointer event.\n   * @returns The current touch point coordinate\n   * @internal\n   */\n  getTouchPoint(e: PointerEvent): Coordinate | null {\n    if (!this.startWorkspace_) {\n      return null;\n    }\n    return new Coordinate(e.pageX, e.pageY);\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.multiTouch;\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.dragger) {\n      this.dragger.onDragEnd(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 pointerdown event.\n   * @internal\n   */\n  handleRightClick(e: PointerEvent) {\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.startComment) {\n      this.startComment.workspace.hideChaff();\n      this.startComment.showContextMenu(e);\n    } else if (this.startWorkspace_ && !this.flyout) {\n      this.startWorkspace_.hideChaff();\n      getFocusManager().focusNode(this.startWorkspace_);\n      this.startWorkspace_.showContextMenu(e);\n    }\n\n    // TODO: Handle right-click on a bubble.\n    e.preventDefault();\n    e.stopPropagation();\n\n    keyboardNavigationController.setIsActive(false);\n\n    this.dispose();\n  }\n\n  /**\n   * Handle a pointerdown event on a workspace.\n   *\n   * @param e A pointerdown event.\n   * @param ws The workspace the event hit.\n   * @internal\n   */\n  handleWsStart(e: PointerEvent, ws: WorkspaceSvg) {\n    if (this.gestureHasStarted) {\n      throw Error(\n        'Tried to call gesture.handleWsStart, ' +\n          'but the gesture had already been started.',\n      );\n    }\n    this.setStartWorkspace(ws);\n    this.mostRecentEvent = e;\n\n    if (!this.startBlock && !this.startBubble && !this.startComment) {\n      // Ensure the workspace is selected if nothing else should be. Note that\n      // this is focusNode() instead of focusTree() because if any active node\n      // is focused in the workspace it should be defocused.\n      getFocusManager().focusNode(ws);\n    } else if (this.startBlock) {\n      getFocusManager().focusNode(this.startBlock);\n    }\n\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(EventType.CLICK))(null, ws.id, 'workspace'),\n    );\n  }\n\n  /**\n   * Handle a pointerdown event on a flyout.\n   *\n   * @param e A pointerdown event.\n   * @param flyout The flyout the event hit.\n   * @internal\n   */\n  handleFlyoutStart(e: PointerEvent, flyout: IFlyout) {\n    if (this.gestureHasStarted) {\n      throw Error(\n        'Tried to call gesture.handleFlyoutStart, ' +\n          'but the gesture had already been started.',\n      );\n    }\n    this.setStartFlyout(flyout);\n    this.handleWsStart(e, flyout.getWorkspace());\n  }\n\n  /**\n   * Handle a pointerdown event on a block.\n   *\n   * @param e A pointerdown event.\n   * @param block The block the event hit.\n   * @internal\n   */\n  handleBlockStart(e: PointerEvent, block: BlockSvg) {\n    if (this.gestureHasStarted) {\n      throw Error(\n        'Tried to call gesture.handleBlockStart, ' +\n          'but the gesture had already been started.',\n      );\n    }\n    this.setStartBlock(block);\n    this.mostRecentEvent = e;\n  }\n\n  /**\n   * Handle a pointerdown event on a bubble.\n   *\n   * @param e A pointerdown event.\n   * @param bubble The bubble the event hit.\n   * @internal\n   */\n  handleBubbleStart(e: PointerEvent, bubble: IBubble) {\n    if (this.gestureHasStarted) {\n      throw Error(\n        'Tried to call gesture.handleBubbleStart, ' +\n          'but the gesture had already been started.',\n      );\n    }\n    this.setStartBubble(bubble);\n    this.mostRecentEvent = e;\n  }\n\n  /**\n   * Handle a pointerdown event on a workspace comment.\n   *\n   * @param e A pointerdown event.\n   * @param comment The comment the event hit.\n   * @internal\n   */\n  handleCommentStart(e: PointerEvent, comment: RenderedWorkspaceComment) {\n    if (this.gestureHasStarted) {\n      throw Error(\n        'Tried to call gesture.handleCommentStart, ' +\n          'but the gesture had already been started.',\n      );\n    }\n    this.setStartComment(comment);\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 field click. */\n  private doFieldClick() {\n    if (!this.startField) {\n      throw new Error(\n        'Cannot do a field click because the start field is undefined',\n      );\n    }\n\n    // Note that the order is important here: bringing a block to the front will\n    // cause it to become focused and showing the field editor will capture\n    // focus ephemerally. It's important to ensure that focus is properly\n    // restored back to the block after field editing has completed.\n    this.bringBlockToFront();\n\n    // Only show the editor if the field's editor wasn't already open\n    // right before this gesture started.\n    const dropdownAlreadyOpen = this.currentDropdownOwner === this.startField;\n    if (!dropdownAlreadyOpen) {\n      this.startField.showEditor(this.mostRecentEvent);\n    }\n  }\n\n  /** Execute an icon click. */\n  private doIconClick() {\n    if (!this.startIcon) {\n      throw new Error(\n        'Cannot do an icon click because the start icon is undefined',\n      );\n    }\n    this.bringBlockToFront();\n    this.startIcon.onClick();\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 ' + 'undefined',\n        );\n      }\n      if (this.flyout.isBlockCreatable(this.targetBlock)) {\n        if (!eventUtils.getGroup()) {\n          eventUtils.setGroup(true);\n        }\n        const newBlock = this.flyout.createBlock(this.targetBlock);\n        newBlock.snapToGrid();\n        newBlock.bumpNeighbours();\n\n        // If a new block was added, make sure that it's correctly focused.\n        getFocusManager().focusNode(newBlock);\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      }\n      // Clicks events are on the start block, even if it was a shadow.\n      const event = new (eventUtils.get(EventType.CLICK))(\n        this.startBlock,\n        this.startWorkspace_.id,\n        'block',\n      );\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 pointerup event.\n   */\n  private doWorkspaceClick(_e: PointerEvent) {\n    this.fireWorkspaceClick(this.startWorkspace_ || this.creatorWorkspace);\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      // Always ensure the block being dragged/clicked has focus.\n      getFocusManager().focusNode(this.targetBlock);\n      this.targetBlock.bringToFront();\n    }\n  }\n\n  /* Begin functions for populating a gesture at pointerdown. */\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<T>(field: Field<T>) {\n    if (this.gestureHasStarted) {\n      throw Error(\n        'Tried to call gesture.setStartField, ' +\n          'but the gesture had already been started.',\n      );\n    }\n    if (!this.startField) {\n      this.startField = field as Field;\n    }\n  }\n\n  /**\n   * Record the icon that a gesture started on.\n   *\n   * @param icon The icon the gesture started on.\n   * @internal\n   */\n  setStartIcon(icon: IIcon) {\n    if (this.gestureHasStarted) {\n      throw Error(\n        'Tried to call gesture.setStartIcon, ' +\n          'but the gesture had already been started.',\n      );\n    }\n\n    if (!this.startIcon) this.startIcon = icon;\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 comment that a gesture started on\n   *\n   * @param comment The comment the gesture started on.\n   * @internal\n   */\n  setStartComment(comment: RenderedWorkspaceComment) {\n    if (!this.startComment) {\n      this.startComment = comment;\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      getFocusManager().focusNode(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 pointerdown. */\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 (pointerup).\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  private isCommentClick(): boolean {\n    return !!this.startComment && !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 (pointerup).\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 (\n      hasStartBlock &&\n      !this.hasExceededDragRadius &&\n      !this.isFieldClick() &&\n      !this.isIconClick()\n    );\n  }\n\n  /**\n   * Whether this gesture is a click on a field that should be handled.  This should only be called\n   * when ending a gesture (pointerup).\n   *\n   * @returns Whether this gesture was a click on a field.\n   */\n  private isFieldClick(): boolean {\n    if (!this.startField) return false;\n    return (\n      this.startField.isClickable() &&\n      !this.hasExceededDragRadius &&\n      (!this.flyout ||\n        this.startField.isClickableInFlyout(this.flyout.autoClose))\n    );\n  }\n\n  /** @returns Whether this gesture is a click on an icon that should be handled. */\n  private isIconClick(): boolean {\n    if (!this.startIcon) return false;\n    const handleInFlyout =\n      !this.flyout ||\n      !this.startIcon.isClickableInFlyout ||\n      this.startIcon.isClickableInFlyout(this.flyout.autoClose);\n    return !this.hasExceededDragRadius && handleInFlyout;\n  }\n\n  /**\n   * Whether this gesture is a click on a workspace.  This should only be called\n   * when ending a gesture (pointerup).\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  /** Returns the current dragger if the gesture is a drag. */\n  getCurrentDragger(): WorkspaceDragger | IDragger | null {\n    return this.workspaceDragger ?? this.dragger ?? null;\n  }\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.dragging;\n  }\n\n  /**\n   * Whether this gesture has already been started.  In theory every pointerdown\n   * has a corresponding pointerup, but in reality it is possible to lose a\n   * pointerup, 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.gestureHasStarted;\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 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 */\n// Former goog.module ID: Blockly.Grid\n\nimport {GridOptions} from './options.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\n\n/**\n * Class for a workspace's grid.\n */\nexport class Grid {\n  private spacing: number;\n  private length: number;\n  private scale: number = 1;\n  private readonly line1: SVGElement;\n  private readonly line2: SVGElement;\n  private 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(\n    private pattern: SVGElement,\n    options: GridOptions,\n  ) {\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   * Sets the spacing between the centers of the grid lines.\n   *\n   * This does not trigger snapping to the newly spaced grid. If you want to\n   * snap blocks to the grid programmatically that needs to be triggered\n   * on individual top-level blocks. The next time a block is dragged and\n   * dropped it will snap to the grid if snapping to the grid is enabled.\n   */\n  setSpacing(spacing: number) {\n    this.spacing = spacing;\n    this.update(this.scale);\n  }\n\n  /**\n   * Get the spacing of the grid points (in px).\n   *\n   * @returns The spacing of the grid points.\n   */\n  getSpacing(): number {\n    return this.spacing;\n  }\n\n  /** Sets the length of the grid lines. */\n  setLength(length: number) {\n    this.length = length;\n    this.update(this.scale);\n  }\n\n  /** Get the length of the grid lines (in px). */\n  getLength(): number {\n    return this.length;\n  }\n\n  /**\n   * Sets whether blocks should snap to the grid or not.\n   *\n   * Setting this to true does not trigger snapping. If you want to snap blocks\n   * to the grid programmatically that needs to be triggered on individual\n   * top-level blocks. The next time a block is dragged and dropped it will\n   * snap to the grid.\n   */\n  setSnapToGrid(snap: boolean) {\n    this.snapToGrid = snap;\n  }\n\n  /**\n   * Whether blocks should snap to the grid.\n   *\n   * @returns True if blocks should snap, false otherwise.\n   */\n  shouldSnap(): boolean {\n    return this.snapToGrid;\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    this.scale = scale;\n    const safeSpacing = this.spacing * scale;\n\n    this.pattern.setAttribute('width', `${safeSpacing}`);\n    this.pattern.setAttribute('height', `${safeSpacing}`);\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,\n    width: number,\n    x1: number,\n    x2: number,\n    y1: number,\n    y2: number,\n  ) {\n    if (line) {\n      line.setAttribute('stroke-width', `${width}`);\n      line.setAttribute('x1', `${x1}`);\n      line.setAttribute('y1', `${y1}`);\n      line.setAttribute('x2', `${x2}`);\n      line.setAttribute('y2', `${y2}`);\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}`);\n    this.pattern.setAttribute('y', `${y}`);\n  }\n\n  /**\n   * Given a coordinate, return the nearest coordinate aligned to the grid.\n   *\n   * @param xy A workspace coordinate.\n   * @returns Workspace coordinate of nearest grid point.\n   *   If there's no change, return the same coordinate object.\n   */\n  alignXY(xy: Coordinate): Coordinate {\n    const spacing = this.getSpacing();\n    const half = spacing / 2;\n    const x = Math.round(Math.round((xy.x - half) / spacing) * spacing + half);\n    const y = Math.round(Math.round((xy.y - half) / spacing) * spacing + half);\n    if (x === xy.x && y === xy.y) {\n      // No change.\n      return xy;\n    }\n    return new Coordinate(x, y);\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   * @param injectionDiv The div containing the parent workspace and all related\n   *   workspaces and block containers. CSS variables representing SVG patterns\n   *   will be scoped to this container.\n   * @returns The SVG element for the grid pattern.\n   * @internal\n   */\n  static createDom(\n    rnd: string,\n    gridOptions: GridOptions,\n    defs: SVGElement,\n    injectionDiv?: HTMLElement,\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    );\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,\n        {'stroke': gridOptions['colour']},\n        gridPattern,\n      );\n      if (gridOptions['length'] ?? 1 > 1) {\n        dom.createSvgElement(\n          Svg.LINE,\n          {'stroke': gridOptions['colour']},\n          gridPattern,\n        );\n      }\n    } else {\n      // Edge 16 doesn't handle empty patterns\n      dom.createSvgElement(Svg.LINE, {}, gridPattern);\n    }\n\n    if (injectionDiv) {\n      // Add CSS variables scoped to the injection div referencing the created\n      // patterns so that CSS can apply the patterns to any element in the\n      // injection div.\n      injectionDiv.style.setProperty(\n        '--blocklyGridPattern',\n        `url(#${gridPattern.id})`,\n      );\n    }\n\n    return gridPattern;\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {getFocusManager} from './focus_manager.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport {IRenderedElement} from './interfaces/i_rendered_element.js';\nimport * as layerNums from './layers.js';\nimport {Coordinate} from './utils/coordinate.js';\nimport * as dom from './utils/dom.js';\nimport {Svg} from './utils/svg.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\n\n/** @internal */\nexport class LayerManager {\n  /** The layer elements being dragged are appended to. */\n  private dragLayer: SVGGElement | undefined;\n  /** The layer elements being animated are appended to. */\n  private animationLayer: SVGGElement | undefined;\n  /** The layers elements not being dragged are appended to.  */\n  private layers = new Map<number, SVGGElement>();\n\n  /** @internal */\n  constructor(private workspace: WorkspaceSvg) {\n    const injectionDiv = workspace.getInjectionDiv();\n    // `getInjectionDiv` is actually nullable. We hit this if the workspace\n    // is part of a flyout and the workspace the flyout is attached to hasn't\n    // been appended yet.\n    if (injectionDiv) {\n      this.dragLayer = this.createDragLayer(injectionDiv);\n      this.animationLayer = this.createAnimationLayer(injectionDiv);\n    }\n\n    // We construct these manually so we can add the css class for backwards\n    // compatibility.\n    const blockLayer = this.createLayer(layerNums.BLOCK);\n    dom.addClass(blockLayer, 'blocklyBlockCanvas');\n    const bubbleLayer = this.createLayer(layerNums.BUBBLE);\n    dom.addClass(bubbleLayer, 'blocklyBubbleCanvas');\n  }\n\n  private createDragLayer(injectionDiv: Element) {\n    const svg = dom.createSvgElement(Svg.SVG, {\n      'class': 'blocklyBlockDragSurface',\n      'xmlns': dom.SVG_NS,\n      'xmlns:html': dom.HTML_NS,\n      'xmlns:xlink': dom.XLINK_NS,\n      'version': '1.1',\n    });\n    injectionDiv.append(svg);\n    return dom.createSvgElement(Svg.G, {}, svg);\n  }\n\n  private createAnimationLayer(injectionDiv: Element) {\n    const svg = dom.createSvgElement(Svg.SVG, {\n      'class': 'blocklyAnimationLayer',\n      'xmlns': dom.SVG_NS,\n      'xmlns:html': dom.HTML_NS,\n      'xmlns:xlink': dom.XLINK_NS,\n      'version': '1.1',\n    });\n    injectionDiv.append(svg);\n    return dom.createSvgElement(Svg.G, {}, svg);\n  }\n\n  /**\n   * Appends the element to the animation layer. The animation layer doesn't\n   * move when the workspace moves, so e.g. delete animations don't move\n   * when a block delete triggers a workspace resize.\n   *\n   * @internal\n   */\n  appendToAnimationLayer(elem: IRenderedElement) {\n    const currentTransform = this.dragLayer?.getAttribute('transform');\n    // Only update the current transform when appending, so animations don't\n    // move if the workspace moves.\n    if (currentTransform) {\n      this.animationLayer?.setAttribute('transform', currentTransform);\n    }\n    this.animationLayer?.appendChild(elem.getSvgRoot());\n  }\n\n  /**\n   * Translates layers when the workspace is dragged or zoomed.\n   *\n   * @internal\n   */\n  translateLayers(newCoord: Coordinate, newScale: number) {\n    const translation = `translate(${newCoord.x}, ${newCoord.y}) scale(${newScale})`;\n    this.dragLayer?.setAttribute('transform', translation);\n    for (const [_, layer] of this.layers) {\n      layer.setAttribute('transform', translation);\n    }\n  }\n\n  /**\n   * Moves the given element to the drag layer, which exists on top of all other\n   * layers, and the drag surface.\n   *\n   * @internal\n   */\n  moveToDragLayer(elem: IRenderedElement & IFocusableNode) {\n    this.dragLayer?.appendChild(elem.getSvgRoot());\n\n    if (elem.canBeFocused()) {\n      // Since moving the element to the drag layer will cause it to lose focus,\n      // ensure it regains focus (to ensure proper highlights & sent events).\n      getFocusManager().focusNode(elem);\n    }\n  }\n\n  /**\n   * Moves the given element off of the drag layer.\n   *\n   * @internal\n   */\n  moveOffDragLayer(elem: IRenderedElement & IFocusableNode, layerNum: number) {\n    this.append(elem, layerNum);\n\n    if (elem.canBeFocused()) {\n      // Since moving the element off the drag layer will cause it to lose focus,\n      // ensure it regains focus (to ensure proper highlights & sent events).\n      getFocusManager().focusNode(elem);\n    }\n  }\n\n  /**\n   * Appends the given element to a layer. If the layer does not exist, it is\n   * created.\n   *\n   * @internal\n   */\n  append(elem: IRenderedElement, layerNum: number) {\n    if (!this.layers.has(layerNum)) {\n      this.createLayer(layerNum);\n    }\n    const childElem = elem.getSvgRoot();\n    if (this.layers.get(layerNum)?.lastChild !== childElem) {\n      // Only append the child if it isn't already last (to avoid re-firing\n      // events like focused).\n      this.layers.get(layerNum)?.appendChild(childElem);\n    }\n  }\n\n  /**\n   * Creates a layer and inserts it at the proper place given the layer number.\n   *\n   * More positive layers exist later in the dom and are rendered ontop of\n   * less positive layers. Layers are added to the layer map as a side effect.\n   */\n  private createLayer(layerNum: number): SVGGElement {\n    const parent = this.workspace.getSvgGroup();\n    const layer = dom.createSvgElement(Svg.G, {});\n\n    let inserted = false;\n    const sortedLayers = [...this.layers].sort((a, b) => a[0] - b[0]);\n    for (const [num, sib] of sortedLayers) {\n      if (layerNum < num) {\n        parent.insertBefore(layer, sib);\n        inserted = true;\n        break;\n      }\n    }\n    if (!inserted) {\n      parent.appendChild(layer);\n    }\n    this.layers.set(layerNum, layer);\n    return layer;\n  }\n\n  /**\n   * Returns true if the given element is a layer managed by the layer manager.\n   * False otherwise.\n   *\n   * @internal\n   */\n  hasLayer(elem: SVGElement) {\n    return (\n      elem === this.dragLayer ||\n      new Set(this.layers.values()).has(elem as SVGGElement)\n    );\n  }\n\n  /**\n   * We need to be able to access this layer explicitly for backwards\n   * compatibility.\n   *\n   * @internal\n   */\n  getBlockLayer(): SVGGElement {\n    return this.layers.get(layerNums.BLOCK)!;\n  }\n\n  /**\n   * We need to be able to access this layer explicitly for backwards\n   * compatibility.\n   *\n   * @internal\n   */\n  getBubbleLayer(): SVGGElement {\n    return this.layers.get(layerNums.BUBBLE)!;\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 marker.\n * Used primarily for keyboard navigation to show a marked location.\n *\n * @class\n */\n// Former goog.module ID: Blockly.Marker\n\nimport {BlockSvg} from '../block_svg.js';\nimport {Field} from '../field.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport {RenderedConnection} from '../rendered_connection.js';\n\n/**\n * Class for a marker.\n * This is used in keyboard navigation to save a location in the Blockly AST.\n */\nexport class Marker {\n  /** The colour of the marker. */\n  colour: string | null = null;\n\n  /** The current location of the marker. */\n  protected curNode: IFocusableNode | null = null;\n\n  /** The type of the marker. */\n  type = 'marker';\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(): IFocusableNode | null {\n    return this.curNode;\n  }\n\n  /**\n   * Set the location of the marker and call the update method.\n   *\n   * @param newNode The new location of the marker, or null to remove it.\n   */\n  setCurNode(newNode: IFocusableNode | null) {\n    this.curNode = newNode;\n  }\n\n  /** Dispose of this marker. */\n  dispose() {\n    this.curNode = null;\n  }\n\n  /**\n   * Returns the block that the given node is a child of.\n   *\n   * @returns The parent block of the node if any, otherwise null.\n   */\n  getSourceBlockFromNode(node: IFocusableNode | null): BlockSvg | null {\n    if (node instanceof BlockSvg) {\n      return node;\n    } else if (node instanceof Field) {\n      return node.getSourceBlock() as BlockSvg;\n    } else if (node instanceof RenderedConnection) {\n      return node.getSourceBlock();\n    }\n\n    return null;\n  }\n\n  /**\n   * Returns the block that this marker's current node is a child of.\n   *\n   * @returns The parent block of the marker's current node if any, otherwise\n   *     null.\n   */\n  getSourceBlock(): BlockSvg | null {\n    return this.getSourceBlockFromNode(this.getCurNode());\n  }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview The class representing a line cursor.\n * A line cursor tries to traverse the blocks and connections on a block as if\n * they were lines of code in a text editor. Previous and next traverse previous\n * connections, next connections and blocks, while in and out traverse input\n * connections and fields.\n * @author aschmiedt@google.com (Abby Schmiedt)\n */\n\nimport {BlockSvg} from '../block_svg.js';\nimport {RenderedWorkspaceComment} from '../comments/rendered_workspace_comment.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport * as registry from '../registry.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport {Marker} from './marker.js';\n\n/**\n * Class for a line cursor.\n */\nexport class LineCursor extends Marker {\n  override type = 'cursor';\n\n  /** Locations to try moving the cursor to after a deletion. */\n  private potentialNodes: IFocusableNode[] | null = null;\n\n  /**\n   * @param workspace The workspace this cursor belongs to.\n   */\n  constructor(protected readonly workspace: WorkspaceSvg) {\n    super();\n  }\n\n  /**\n   * Moves the cursor to the next block or workspace comment 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  next(): IFocusableNode | null {\n    const curNode = this.getCurNode();\n    if (!curNode) {\n      return null;\n    }\n    const newNode = this.getNextNode(\n      curNode,\n      (candidate: IFocusableNode | null) => {\n        return (\n          (candidate instanceof BlockSvg &&\n            !candidate.outputConnection?.targetBlock()) ||\n          candidate instanceof RenderedWorkspaceComment\n        );\n      },\n      true,\n    );\n\n    if (newNode) {\n      this.setCurNode(newNode);\n    }\n    return newNode;\n  }\n\n  /**\n   * Moves the cursor to the next input connection or field\n   * in the pre order traversal.\n   *\n   * @returns The next node, or null if the current node is\n   *     not set or there is no next value.\n   */\n  in(): IFocusableNode | null {\n    const curNode = this.getCurNode();\n    if (!curNode) {\n      return null;\n    }\n\n    const newNode = this.getNextNode(curNode, () => true, true);\n\n    if (newNode) {\n      this.setCurNode(newNode);\n    }\n    return newNode;\n  }\n  /**\n   * Moves the cursor to the previous block or workspace comment in the\n   * 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  prev(): IFocusableNode | null {\n    const curNode = this.getCurNode();\n    if (!curNode) {\n      return null;\n    }\n    const newNode = this.getPreviousNode(\n      curNode,\n      (candidate: IFocusableNode | null) => {\n        return (\n          (candidate instanceof BlockSvg &&\n            !candidate.outputConnection?.targetBlock()) ||\n          candidate instanceof RenderedWorkspaceComment\n        );\n      },\n      true,\n    );\n\n    if (newNode) {\n      this.setCurNode(newNode);\n    }\n    return newNode;\n  }\n\n  /**\n   * Moves the cursor to the previous input connection or field in the pre order\n   * traversal.\n   *\n   * @returns The previous node, or null if the current node\n   *     is not set or there is no previous value.\n   */\n  out(): IFocusableNode | null {\n    const curNode = this.getCurNode();\n    if (!curNode) {\n      return null;\n    }\n\n    const newNode = this.getPreviousNode(curNode, () => true, true);\n\n    if (newNode) {\n      this.setCurNode(newNode);\n    }\n    return newNode;\n  }\n\n  /**\n   * Returns true iff the node to which we would navigate if in() were\n   * called is the same as the node to which we would navigate if next() were\n   * called - in effect, if the LineCursor is at the end of the 'current\n   * line' of the program.\n   */\n  atEndOfLine(): boolean {\n    const curNode = this.getCurNode();\n    if (!curNode) return false;\n    const inNode = this.getNextNode(curNode, () => true, true);\n    const nextNode = this.getNextNode(\n      curNode,\n      (candidate: IFocusableNode | null) => {\n        return (\n          candidate instanceof BlockSvg &&\n          !candidate.outputConnection?.targetBlock()\n        );\n      },\n      true,\n    );\n\n    return inNode === nextNode;\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   * @param visitedNodes A set of previously visited nodes used to avoid cycles.\n   * @returns The next node in the traversal.\n   */\n  private getNextNodeImpl(\n    node: IFocusableNode | null,\n    isValid: (p1: IFocusableNode | null) => boolean,\n    visitedNodes: Set<IFocusableNode> = new Set<IFocusableNode>(),\n  ): IFocusableNode | null {\n    if (!node || visitedNodes.has(node)) return null;\n    let newNode =\n      this.workspace.getNavigator().getFirstChild(node) ||\n      this.workspace.getNavigator().getNextSibling(node);\n\n    let target = node;\n    while (target && !newNode) {\n      const parent = this.workspace.getNavigator().getParent(target);\n      if (!parent) break;\n      newNode = this.workspace.getNavigator().getNextSibling(parent);\n      target = parent;\n    }\n\n    if (isValid(newNode)) return newNode;\n    if (newNode) {\n      visitedNodes.add(node);\n      return this.getNextNodeImpl(newNode, isValid, visitedNodes);\n    }\n    return null;\n  }\n\n  /**\n   * Get the next node in the AST, optionally allowing for loopback.\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   * @param loop Whether to loop around to the beginning of the workspace if no\n   *     valid node was found.\n   * @returns The next node in the traversal.\n   */\n  getNextNode(\n    node: IFocusableNode | null,\n    isValid: (p1: IFocusableNode | null) => boolean,\n    loop: boolean,\n  ): IFocusableNode | null {\n    if (!node || (!loop && this.getLastNode() === node)) return null;\n\n    return this.getNextNodeImpl(node, isValid);\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   * @param visitedNodes A set of previously visited nodes used to avoid cycles.\n   * @returns The previous node in the traversal or null if no previous node\n   *     exists.\n   */\n  private getPreviousNodeImpl(\n    node: IFocusableNode | null,\n    isValid: (p1: IFocusableNode | null) => boolean,\n    visitedNodes: Set<IFocusableNode> = new Set<IFocusableNode>(),\n  ): IFocusableNode | null {\n    if (!node || visitedNodes.has(node)) return null;\n\n    const newNode =\n      this.getRightMostChild(\n        this.workspace.getNavigator().getPreviousSibling(node),\n        node,\n      ) || this.workspace.getNavigator().getParent(node);\n\n    if (isValid(newNode)) return newNode;\n    if (newNode) {\n      visitedNodes.add(node);\n      return this.getPreviousNodeImpl(newNode, isValid, visitedNodes);\n    }\n    return null;\n  }\n\n  /**\n   * Get the previous node in the AST, optionally allowing for loopback.\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   * @param loop Whether to loop around to the end of the workspace if no valid\n   *     node was found.\n   * @returns The previous node in the traversal or null if no previous node\n   *     exists.\n   */\n  getPreviousNode(\n    node: IFocusableNode | null,\n    isValid: (p1: IFocusableNode | null) => boolean,\n    loop: boolean,\n  ): IFocusableNode | null {\n    if (!node || (!loop && this.getFirstNode() === node)) return null;\n\n    return this.getPreviousNodeImpl(node, isValid);\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(\n    node: IFocusableNode | null,\n    stopIfFound: IFocusableNode,\n  ): IFocusableNode | null {\n    if (!node) return node;\n    let newNode = this.workspace.getNavigator().getFirstChild(node);\n    if (!newNode || newNode === stopIfFound) return node;\n    for (\n      let nextNode: IFocusableNode | null = newNode;\n      nextNode;\n      nextNode = this.workspace.getNavigator().getNextSibling(newNode)\n    ) {\n      if (nextNode === stopIfFound) break;\n      newNode = nextNode;\n    }\n    return this.getRightMostChild(newNode, stopIfFound);\n  }\n\n  /**\n   * Prepare for the deletion of a block by making a list of nodes we\n   * could move the cursor to afterwards and save it to\n   * this.potentialNodes.\n   *\n   * After the deletion has occurred, call postDelete to move it to\n   * the first valid node on that list.\n   *\n   * The locations to try (in order of preference) are:\n   *\n   * - The current location.\n   * - The connection to which the deleted block is attached.\n   * - The block connected to the next connection of the deleted block.\n   * - The parent block of the deleted block.\n   * - A location on the workspace beneath the deleted block.\n   *\n   * N.B.: When block is deleted, all of the blocks conneccted to that\n   * block's inputs are also deleted, but not blocks connected to its\n   * next connection.\n   *\n   * @param deletedBlock The block that is being deleted.\n   */\n  preDelete(deletedBlock: BlockSvg) {\n    const curNode = this.getCurNode();\n\n    const nodes: IFocusableNode[] = curNode ? [curNode] : [];\n    // The connection to which the deleted block is attached.\n    const parentConnection =\n      deletedBlock.previousConnection?.targetConnection ??\n      deletedBlock.outputConnection?.targetConnection;\n    if (parentConnection) {\n      nodes.push(parentConnection);\n    }\n    // The block connected to the next connection of the deleted block.\n    const nextBlock = deletedBlock.getNextBlock();\n    if (nextBlock) {\n      nodes.push(nextBlock);\n    }\n    //  The parent block of the deleted block.\n    const parentBlock = deletedBlock.getParent();\n    if (parentBlock) {\n      nodes.push(parentBlock);\n    }\n    // A location on the workspace beneath the deleted block.\n    // Move to the workspace.\n    nodes.push(this.workspace);\n    this.potentialNodes = nodes;\n  }\n\n  /**\n   * Move the cursor to the first valid location in\n   * this.potentialNodes, following a block deletion.\n   */\n  postDelete() {\n    const nodes = this.potentialNodes;\n    this.potentialNodes = null;\n    if (!nodes) throw new Error('must call preDelete first');\n    for (const node of nodes) {\n      if (!this.getSourceBlockFromNode(node)?.disposed) {\n        this.setCurNode(node);\n        return;\n      }\n    }\n    throw new Error('no valid nodes in this.potentialNodes');\n  }\n\n  /**\n   * Get the current location of the cursor.\n   *\n   * Overrides normal Marker getCurNode to update the current node from the\n   * selected block. This typically happens via the selection listener but that\n   * is not called immediately when `Gesture` calls\n   * `Blockly.common.setSelected`. In particular the listener runs after showing\n   * the context menu.\n   *\n   * @returns The current field, connection, or block the cursor is on.\n   */\n  getCurNode(): IFocusableNode | null {\n    return getFocusManager().getFocusedNode();\n  }\n\n  /**\n   * Set the location of the cursor and draw it.\n   *\n   * Overrides normal Marker setCurNode logic to call\n   * this.drawMarker() instead of this.drawer.draw() directly.\n   *\n   * @param newNode The new location of the cursor.\n   */\n  setCurNode(newNode: IFocusableNode) {\n    getFocusManager().focusNode(newNode);\n  }\n\n  /**\n   * Get the first navigable node on the workspace, or null if none exist.\n   *\n   * @returns The first navigable node on the workspace, or null.\n   */\n  getFirstNode(): IFocusableNode | null {\n    return this.workspace.getNavigator().getFirstChild(this.workspace);\n  }\n\n  /**\n   * Get the last navigable node on the workspace, or null if none exist.\n   *\n   * @returns The last navigable node on the workspace, or null.\n   */\n  getLastNode(): IFocusableNode | null {\n    const first = this.getFirstNode();\n    return this.getPreviousNode(first, () => true, true);\n  }\n}\n\nregistry.register(registry.Type.CURSOR, registry.DEFAULT, LineCursor);\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 */\n// Former goog.module ID: Blockly.MarkerManager\n\nimport {LineCursor} from './keyboard_nav/line_cursor.js';\nimport type {Marker} from './keyboard_nav/marker.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Class to manage the multiple markers and the cursor on a workspace.\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: LineCursor;\n\n  /** The map of markers for the workspace. */\n  private markers = new Map<string, Marker>();\n\n  /**\n   * @param workspace The workspace for the marker manager.\n   * @internal\n   */\n  constructor(private readonly workspace: WorkspaceSvg) {\n    this.cursor = new LineCursor(this.workspace);\n  }\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    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 ' +\n          id +\n          ' does not exist. ' +\n          'Can only unregister markers that exist.',\n      );\n    }\n  }\n\n  /**\n   * Get the cursor for the workspace.\n   *\n   * @returns The cursor for this workspace.\n   */\n  getCursor(): LineCursor {\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: LineCursor) {\n    this.cursor = cursor;\n  }\n\n  /**\n   * Dispose of the marker manager.\n   * Go through and delete all markers associated with this marker manager.\n   *\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    this.cursor.dispose();\n  }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CommentIcon, CommentState} from './icons/comment_icon.js';\nimport * as exceptions from './icons/exceptions.js';\nimport {Icon} from './icons/icon.js';\nimport {IconType} from './icons/icon_types.js';\nimport {MutatorIcon} from './icons/mutator_icon.js';\nimport * as registry from './icons/registry.js';\nimport {WarningIcon} from './icons/warning_icon.js';\n\nexport {\n  CommentIcon,\n  CommentState,\n  exceptions,\n  Icon,\n  IconType,\n  MutatorIcon,\n  registry,\n  WarningIcon,\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 */\n// Former goog.module ID: Blockly.Names\n\nimport type {IVariableMap} from './interfaces/i_variable_map.js';\nimport type {\n  IVariableModel,\n  IVariableState,\n} from './interfaces/i_variable_model.js';\nimport {Msg} from './msg.js';\nimport * as Variables from './variables.js';\nimport type {Workspace} from './workspace.js';\n\n/**\n * Class for a database of entity names (variables, procedures, etc).\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: IVariableMap<IVariableModel<IVariableState>> | null =\n    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 = new Set<string>(\n      reservedWordsList ? reservedWordsList.split(',') : [],\n    );\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: IVariableMap<IVariableModel<IVariableState>>) {\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      );\n      return null;\n    }\n    const variable = this.variableMap.getVariableById(id);\n    if (variable) {\n      return variable.getName();\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  /**\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: number | null = null;\n    while (\n      this.dbReverse.has(safeName + (i ?? '')) ||\n      this.reservedWords.has(safeName + (i ?? ''))\n    ) {\n      // Collision with existing name.  Create a unique name.\n      i = i ? i + 1 : 2;\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'.includes(name[0])) {\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   */\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 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {isObservable} from './interfaces/i_observable.js';\nimport {IProcedureMap} from './interfaces/i_procedure_map.js';\nimport type {IProcedureModel} from './interfaces/i_procedure_model.js';\n\nexport class ObservableProcedureMap\n  extends Map<string, IProcedureModel>\n  implements IProcedureMap\n{\n  /** @internal */\n  constructor() {\n    super();\n  }\n\n  /**\n   * Adds the given procedure model to the procedure map.\n   */\n  override set(id: string, proc: IProcedureModel): this {\n    if (this.get(id) === proc) return this;\n    super.set(id, proc);\n    if (isObservable(proc)) proc.startPublishing();\n    return this;\n  }\n\n  /**\n   * Deletes the ProcedureModel with the given ID from the procedure map (if it\n   * exists).\n   */\n  override delete(id: string): boolean {\n    const proc = this.get(id);\n    const existed = super.delete(id);\n    if (!existed) return existed;\n    if (isObservable(proc)) proc.stopPublishing();\n    return existed;\n  }\n\n  /**\n   * Removes all ProcedureModels from the procedure map.\n   */\n  override clear() {\n    if (!this.size) return;\n    for (const id of this.keys()) {\n      this.delete(id);\n    }\n  }\n\n  /**\n   * Adds the given ProcedureModel to the map of procedure models, so that\n   * blocks can find it.\n   */\n  add(proc: IProcedureModel): this {\n    return this.set(proc.getId(), proc);\n  }\n\n  /**\n   * Returns all of the procedures stored in this map.\n   */\n  getProcedures(): IProcedureModel[] {\n    return [...this.values()];\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.blockRendering.Types\n\nimport type {Measurable} from './base.js';\nimport type {BottomRow} from './bottom_row.js';\nimport type {ExternalValueInput} from './external_value_input.js';\nimport type {Field} from './field.js';\nimport type {Hat} from './hat.js';\nimport type {Icon} from './icon.js';\nimport type {InRowSpacer} from './in_row_spacer.js';\nimport type {InlineInput} from './inline_input.js';\nimport type {InputConnection} from './input_connection.js';\nimport type {InputRow} from './input_row.js';\nimport type {JaggedEdge} from './jagged_edge.js';\nimport type {NextConnection} from './next_connection.js';\nimport type {PreviousConnection} from './previous_connection.js';\nimport type {RoundCorner} from './round_corner.js';\nimport type {Row} from './row.js';\nimport type {SpacerRow} from './spacer_row.js';\nimport type {SquareCorner} from './square_corner.js';\nimport type {StatementInput} from './statement_input.js';\nimport type {TopRow} from './top_row.js';\n\n/**\n * Types of rendering elements.\n */\nclass TypesContainer {\n  // This class is very non-idiomatic for typescript, so we have to use\n  // the Function type to make it happy.\n  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\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  LEFT_CORNER = this.LEFT_SQUARE_CORNER | this.LEFT_ROUND_CORNER;\n\n  /**\n   * A Right Corner Union Type.\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   */\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   */\n  isField(elem: Measurable): elem is Field {\n    return (elem.type & this.FIELD) >= 1;\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   */\n  isHat(elem: Measurable): elem is Hat {\n    return (elem.type & this.HAT) >= 1;\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   */\n  isIcon(elem: Measurable): elem is Icon {\n    return (elem.type & this.ICON) >= 1;\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   */\n  isSpacer(elem: Measurable | Row): elem is SpacerRow | InRowSpacer {\n    return (elem.type & this.SPACER) >= 1;\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   */\n  isInRowSpacer(elem: Measurable): elem is InRowSpacer {\n    return (elem.type & this.IN_ROW_SPACER) >= 1;\n  }\n\n  /**\n   * Whether a row is a spacer row.\n   *\n   * @param row The row to check.\n   * @returns True if the row is a spacer row.\n   */\n  isSpacerRow(row: Row): row is SpacerRow {\n    return (row.type & this.BETWEEN_ROW_SPACER) >= 1;\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   */\n  isInput(elem: Measurable): elem is InputConnection {\n    return (elem.type & this.INPUT) >= 1;\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   */\n  isExternalInput(elem: Measurable): elem is ExternalValueInput {\n    return (elem.type & this.EXTERNAL_VALUE_INPUT) >= 1;\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   */\n  isInlineInput(elem: Measurable): elem is InlineInput {\n    return (elem.type & this.INLINE_INPUT) >= 1;\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   */\n  isStatementInput(elem: Measurable): elem is StatementInput {\n    return (elem.type & this.STATEMENT_INPUT) >= 1;\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   */\n  isPreviousConnection(elem: Measurable): elem is PreviousConnection {\n    return (elem.type & this.PREVIOUS_CONNECTION) >= 1;\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   */\n  isNextConnection(elem: Measurable): elem is NextConnection {\n    return (elem.type & this.NEXT_CONNECTION) >= 1;\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   */\n  isPreviousOrNextConnection(\n    elem: Measurable,\n  ): elem is PreviousConnection | NextConnection {\n    return this.isPreviousConnection(elem) || this.isNextConnection(elem);\n  }\n\n  isRoundCorner(elem: Measurable): elem is RoundCorner {\n    return (\n      (elem.type & this.LEFT_ROUND_CORNER) >= 1 ||\n      (elem.type & this.RIGHT_ROUND_CORNER) >= 1\n    );\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   */\n  isLeftRoundedCorner(elem: Measurable): boolean {\n    return (\n      this.isRoundCorner(elem) && (elem.type & this.LEFT_ROUND_CORNER) >= 1\n    );\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   */\n  isRightRoundedCorner(elem: Measurable): boolean {\n    return (\n      this.isRoundCorner(elem) && (elem.type & this.RIGHT_ROUND_CORNER) >= 1\n    );\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   */\n  isLeftSquareCorner(elem: Measurable): boolean {\n    return (elem.type & this.LEFT_SQUARE_CORNER) >= 1;\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   */\n  isRightSquareCorner(elem: Measurable): boolean {\n    return (elem.type & this.RIGHT_SQUARE_CORNER) >= 1;\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   */\n  isCorner(elem: Measurable): elem is SquareCorner | RoundCorner {\n    return (elem.type & this.CORNER) >= 1;\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   */\n  isJaggedEdge(elem: Measurable): elem is JaggedEdge {\n    return (elem.type & this.JAGGED_EDGE) >= 1;\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   */\n  isRow(row: Row): row is Row {\n    return (row.type & this.ROW) >= 1;\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   */\n  isBetweenRowSpacer(row: Row): row is SpacerRow {\n    return (row.type & this.BETWEEN_ROW_SPACER) >= 1;\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   */\n  isTopRow(row: Row): row is TopRow {\n    return (row.type & this.TOP_ROW) >= 1;\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   */\n  isBottomRow(row: Row): row is BottomRow {\n    return (row.type & this.BOTTOM_ROW) >= 1;\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   */\n  isTopOrBottomRow(row: Row): row is TopRow | BottomRow {\n    return this.isTopRow(row) || this.isBottomRow(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   */\n  isInputRow(row: Row): row is InputRow {\n    return (row.type & this.INPUT_ROW) >= 1;\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// Former goog.module ID: Blockly.blockRendering.Measurable\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Types} from './types.js';\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 */\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   */\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// Former goog.module ID: Blockly.blockRendering.Row\n\nimport type {ConstantProvider} from '../common/constants.js';\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 * An object representing a single row on a rendered block and all of its\n * subcomponents.\n */\nexport class Row {\n  type: number;\n\n  /**\n   * An array of elements contained in this row.\n   */\n  elements: Measurable[] = [];\n\n  /**\n   * The height of the row.\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  width = 0;\n\n  /**\n   * The minimum height of the row.\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  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  widthWithConnectedBlocks = 0;\n\n  /**\n   * The Y position of the row relative to the origin of the block's svg\n   * group.\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  xPos = 0;\n\n  /**\n   * Whether the row has any external inputs.\n   */\n  hasExternalInput = false;\n\n  /**\n   * Whether the row has any statement inputs.\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  hasInlineInput = false;\n\n  /**\n   * Whether the row has any dummy inputs or end-row inputs.\n   */\n  hasDummyInput = false;\n\n  /**\n   * Whether the row has a jagged edge.\n   */\n  hasJaggedEdge = false;\n  notchOffset: number;\n\n  /**\n   * Alignment of the row.\n   */\n  align: number | null = null;\n\n  protected readonly constants_: ConstantProvider;\n\n  /**\n   * @param constants The rendering constants provider.\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   */\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;\n      }\n    }\n    return null;\n  }\n\n  /**\n   * Inspect all subcomponents and populate all size properties on the row.\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   */\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   */\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   */\n  getFirstSpacer(): InRowSpacer | null {\n    for (let i = 0; i < this.elements.length; i++) {\n      const elem = this.elements[i];\n      if (Types.isInRowSpacer(elem)) {\n        return elem;\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   */\n  getLastSpacer(): InRowSpacer | null {\n    for (let i = this.elements.length - 1; i >= 0; i--) {\n      const elem = this.elements[i];\n      if (Types.isInRowSpacer(elem)) {\n        return elem;\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// Former goog.module ID: Blockly.blockRendering.BottomRow\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport type {NextConnection} from './next_connection.js';\nimport {Row} from './row.js';\nimport {Types} from './types.js';\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 */\nexport class BottomRow extends Row {\n  /**\n   * Whether this row has a next connection.\n   */\n  hasNextConnection = false;\n\n  /**\n   * The next connection on the row, if any.\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  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   */\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// Former goog.module ID: Blockly.blockRendering.Connection\n\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider, Shape} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * The base class to represent a connection and the space that it takes up on\n * the block.\n */\nexport class Connection extends Measurable {\n  shape: Shape;\n  isDynamicShape: boolean;\n  highlighted: boolean;\n\n  /**\n   * @param constants The rendering constants provider.\n   * @param connectionModel The connection object on the block that this\n   *     represents.\n   */\n  constructor(\n    constants: ConstantProvider,\n    public connectionModel: RenderedConnection,\n  ) {\n    super(constants);\n\n    this.type |= Types.CONNECTION;\n\n    this.shape = this.constants_.shapeFor(connectionModel);\n    this.isDynamicShape = 'isDynamic' in this.shape && this.shape.isDynamic;\n\n    this.highlighted = connectionModel.isHighlighted();\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.blockRendering.InputConnection\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Input} from '../../inputs/input.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n/**\n * The base class to represent an input that takes up space on a block\n * during rendering.\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   */\n  constructor(\n    constants: ConstantProvider,\n    public input: Input,\n  ) {\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// Former goog.module ID: Blockly.blockRendering.ExternalValueInput\n\nimport type {Input} from '../../inputs/input.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {InputConnection} from './input_connection.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space an external value input\n * takes up during rendering\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   */\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 =\n        this.connectedBlockHeight -\n        this.constants_.TAB_OFFSET_FROM_TOP -\n        this.constants_.MEDIUM_PADDING;\n    }\n\n    this.width =\n      (this.shape.width as number) +\n      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// Former goog.module ID: Blockly.blockRendering.Field\n\nimport type {Field as BlocklyField} from '../../field.js';\nimport type {Input} from '../../inputs/input.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space a field takes up during\n * rendering\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   */\n  constructor(\n    constants: ConstantProvider,\n    public field: BlocklyField,\n    public parentInput: Input,\n  ) {\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// Former goog.module ID: Blockly.blockRendering.Hat\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space a hat takes up during\n * rendering.\n */\nexport class Hat extends Measurable {\n  ascenderHeight: number;\n\n  /**\n   * @param constants The rendering constants provider.\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// Former goog.module ID: Blockly.blockRendering.Icon\n\nimport type {IIcon as BlocklyIcon} from '../../interfaces/i_icon.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space an icon takes up during\n * rendering.\n */\nexport class Icon extends Measurable {\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   */\n  constructor(\n    constants: ConstantProvider,\n    public icon: BlocklyIcon,\n  ) {\n    super(constants);\n\n    this.type |= Types.ICON;\n\n    const size = icon.getSize();\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// Former goog.module ID: Blockly.blockRendering.InRowSpacer\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about a spacer between two elements on a\n * row.\n */\nexport class InRowSpacer extends Measurable {\n  // This field exists solely to structurally distinguish this type from other\n  // Measurable subclasses. Because this class otherwise has the same fields as\n  // Measurable, and Typescript doesn't support nominal typing, Typescript will\n  // consider it and other subclasses in the same situation as being of the same\n  // type, even if typeguards are used, which could result in Typescript typing\n  // objects of this class as `never`.\n  private inRowSpacer: undefined;\n\n  /**\n   * @param constants The rendering constants provider.\n   * @param width The width of the spacer.\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// Former goog.module ID: Blockly.blockRendering.InlineInput\n\nimport type {Input} from '../../inputs/input.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {InputConnection} from './input_connection.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space an inline input takes up\n * during rendering.\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   */\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 =\n      'connectionOffsetY' in this.shape\n        ? this.shape.connectionOffsetY(this.connectionHeight)\n        : this.constants_.TAB_OFFSET_FROM_TOP;\n\n    this.connectionOffsetX =\n      '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// Former goog.module ID: Blockly.blockRendering.InputRow\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Row} from './row.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about a row that holds one or more inputs.\n */\nexport class InputRow extends Row {\n  /**\n   * The total width of all blocks connected to this row.\n   */\n  connectedBlockWidths = 0;\n\n  /**\n   * @param constants The rendering constants provider.\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  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)) {\n        if (Types.isStatementInput(elem)) {\n          connectedBlockWidths += elem.connectedBlockWidth;\n        } else if (\n          Types.isExternalInput(elem) &&\n          elem.connectedBlockWidth !== 0\n        ) {\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// Former goog.module ID: Blockly.blockRendering.JaggedEdge\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space the jagged edge of a\n * collapsed block takes up during rendering.\n */\nexport class JaggedEdge extends Measurable {\n  // This field exists solely to structurally distinguish this type from other\n  // Measurable subclasses. Because this class otherwise has the same fields as\n  // Measurable, and Typescript doesn't support nominal typing, Typescript will\n  // consider it and other subclasses in the same situation as being of the same\n  // type, even if typeguards are used, which could result in Typescript typing\n  // objects of this class as `never`.\n  private jaggedEdge: undefined;\n\n  /**\n   * @param constants The rendering constants provider.\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// Former goog.module ID: Blockly.blockRendering.NextConnection\n\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space a next connection takes\n * up during rendering.\n */\nexport class NextConnection extends Connection {\n  // This field exists solely to structurally distinguish this type from other\n  // Measurable subclasses. Because this class otherwise has the same fields as\n  // Measurable, and Typescript doesn't support nominal typing, Typescript will\n  // consider it and other subclasses in the same situation as being of the same\n  // type, even if typeguards are used, which could result in Typescript typing\n  // objects of this class as `never`.\n  private nextConnection: undefined;\n\n  /**\n   * @param constants The rendering constants provider.\n   * @param connectionModel The connection object on the block that this\n   *     represents.\n   */\n  constructor(\n    constants: ConstantProvider,\n    connectionModel: RenderedConnection,\n  ) {\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// Former goog.module ID: Blockly.blockRendering.OutputConnection\n\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space an output connection takes\n * up during rendering.\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   */\n  constructor(\n    constants: ConstantProvider,\n    connectionModel: RenderedConnection,\n  ) {\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// Former goog.module ID: Blockly.blockRendering.PreviousConnection\n\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Connection} from './connection.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space a previous connection takes\n * up during rendering.\n */\nexport class PreviousConnection extends Connection {\n  // This field exists solely to structurally distinguish this type from other\n  // Measurable subclasses. Because this class otherwise has the same fields as\n  // Measurable, and Typescript doesn't support nominal typing, Typescript will\n  // consider it and other subclasses in the same situation as being of the same\n  // type, even if typeguards are used, which could result in Typescript typing\n  // objects of this class as `never`.\n  private previousConnection: undefined;\n\n  /**\n   * @param constants The rendering constants provider.\n   * @param connectionModel The connection object on the block that this\n   *     represents.\n   */\n  constructor(\n    constants: ConstantProvider,\n    connectionModel: RenderedConnection,\n  ) {\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// Former goog.module ID: Blockly.blockRendering.RoundCorner\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space a rounded corner takes up\n * during rendering.\n */\nexport class RoundCorner extends Measurable {\n  // This field exists solely to structurally distinguish this type from other\n  // Measurable subclasses. Because this class otherwise has the same fields as\n  // Measurable, and Typescript doesn't support nominal typing, Typescript will\n  // consider it and other subclasses in the same situation as being of the same\n  // type, even if typeguards are used, which could result in Typescript typing\n  // objects of this class as `never`.\n  private roundCorner: undefined;\n\n  /**\n   * @param constants The rendering constants provider.\n   * @param opt_position The position of this corner.\n   */\n  constructor(constants: ConstantProvider, opt_position?: string) {\n    super(constants);\n    this.type =\n      (!opt_position || opt_position === 'left'\n        ? Types.LEFT_ROUND_CORNER\n        : Types.RIGHT_ROUND_CORNER) | 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// Former goog.module ID: Blockly.blockRendering.SpacerRow\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {InRowSpacer} from './in_row_spacer.js';\nimport {Row} from './row.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about a spacer between two rows.\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   */\n  constructor(\n    constants: ConstantProvider,\n    public override height: number,\n    public override width: number,\n  ) {\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// Former goog.module ID: Blockly.blockRendering.SquareCorner\n\nimport type {ConstantProvider} from '../common/constants.js';\nimport {Measurable} from './base.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space a square corner takes up\n * during rendering.\n */\nexport class SquareCorner extends Measurable {\n  // This field exists solely to structurally distinguish this type from other\n  // Measurable subclasses. Because this class otherwise has the same fields as\n  // Measurable, and Typescript doesn't support nominal typing, Typescript will\n  // consider it and other subclasses in the same situation as being of the same\n  // type, even if typeguards are used, which could result in Typescript typing\n  // objects of this class as `never`.\n  private squareCorner: undefined;\n\n  /**\n   * @param constants The rendering constants provider.\n   * @param opt_position The position of this corner.\n   */\n  constructor(constants: ConstantProvider, opt_position?: string) {\n    super(constants);\n    this.type =\n      (!opt_position || opt_position === 'left'\n        ? Types.LEFT_SQUARE_CORNER\n        : Types.RIGHT_SQUARE_CORNER) | 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// Former goog.module ID: Blockly.blockRendering.StatementInput\n\nimport type {Input} from '../../inputs/input.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport {InputConnection} from './input_connection.js';\nimport {Types} from './types.js';\n\n/**\n * An object containing information about the space a statement input takes up\n * during rendering\n */\nexport class StatementInput extends InputConnection {\n  // This field exists solely to structurally distinguish this type from other\n  // Measurable subclasses. Because this class otherwise has the same fields as\n  // Measurable, and Typescript doesn't support nominal typing, Typescript will\n  // consider it and other subclasses in the same situation as being of the same\n  // type, even if typeguards are used, which could result in Typescript typing\n  // objects of this class as `never`.\n  private statementInput: undefined;\n\n  /**\n   * @param constants The rendering constants provider.\n   * @param input The statement input to measure and store information for.\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 =\n      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// Former goog.module ID: Blockly.blockRendering.TopRow\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {ConstantProvider} from '../common/constants.js';\nimport type {PreviousConnection} from './previous_connection.js';\nimport {Row} from './row.js';\nimport {Types} from './types.js';\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 */\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  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   */\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   */\n  hasLeftSquareCorner(block: BlockSvg): boolean {\n    const hasHat =\n      (block.hat ? block.hat === 'cap' : this.constants_.ADD_START_HATS) &&\n      !block.outputConnection &&\n      !block.previousConnection;\n    const prevBlock = block.getPreviousBlock();\n\n    return (\n      !!block.outputConnection ||\n      hasHat ||\n      (prevBlock ? prevBlock.getNextBlock() === block : false)\n    );\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)) {\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// Former goog.module ID: Blockly.blockRendering.Drawer\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {ConnectionType} from '../../connection_type.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 {Row} from '../measurables/row.js';\nimport {Types} from '../measurables/types.js';\nimport type {ConstantProvider, Notch, PuzzleTab} from './constants.js';\nimport {isDynamicShape, isNotch, isPuzzleTab} from './constants.js';\nimport type {RenderInfo} from './info.js';\n\n/**\n * An object that draws a block based on the given rendering information.\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   */\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  draw() {\n    this.drawOutline_();\n    this.drawInternals_();\n    this.updateConnectionHighlights();\n\n    this.block_.pathObject.setPath(this.outlinePath_ + '\\n' + this.inlinePath_);\n    if (this.info_.RTL) {\n      this.block_.pathObject.flipRTL();\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    this.block_.childlessWidth = this.info_.width;\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 (Types.isPreviousConnection(elem)) {\n        this.outlinePath_ += (elem.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      // No branch for a square corner, because it's a no-op.\n    }\n    this.outlinePath_ += svgPaths.lineOnAxis(\n      'v',\n      topRow.height - topRow.ascenderHeight,\n    );\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_ +=\n      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 =\n      (input.shape as Notch).pathRight +\n      svgPaths.lineOnAxis(\n        'h',\n        -(input.notchOffset - this.constants_.INSIDE_CORNERS.width),\n      ) +\n      this.constants_.INSIDE_CORNERS.pathTop;\n\n    const innerHeight = row.height - 2 * this.constants_.INSIDE_CORNERS.height;\n\n    this.outlinePath_ +=\n      svgPaths.lineOnAxis('H', x) +\n      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)) {\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_ += svgPaths.lineOnAxis(\n      'V',\n      bottomRow.baseline - rightCornerYOffset,\n    );\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);\n        } else if (Types.isIcon(elem) || Types.isField(elem)) {\n          this.layoutField_(elem);\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 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\n    if (Types.isIcon(fieldInfo)) {\n      const icon = fieldInfo.icon;\n      icon.setOffsetInBlock(new Coordinate(xPos, yPos));\n      if (this.info_.isInsertionMarker) {\n        icon.hideForInsertionMarker();\n      }\n    } else {\n      const svgGroup = fieldInfo.field.getSvgRoot()!;\n      svgGroup.setAttribute(\n        'transform',\n        'translate(' + xPos + ',' + yPos + ')' + scale,\n      );\n      if (this.info_.isInsertionMarker) {\n        svgGroup.setAttribute('display', 'none');\n      }\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_ +=\n      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) +\n      '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,\n        yPos + input.connectionOffsetY,\n      );\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,\n        this.info_.outputConnection.connectionOffsetY,\n      );\n    }\n  }\n\n  /**\n   * Updates the path object to reflect which connections on the block are\n   * highlighted.\n   */\n  protected updateConnectionHighlights() {\n    for (const row of this.info_.rows) {\n      for (const elem of row.elements) {\n        if (!(elem instanceof Connection)) continue;\n\n        const highlightSvg = this.drawConnectionHighlightPath(elem);\n        if (highlightSvg) {\n          highlightSvg.style.display = elem.highlighted ? '' : 'none';\n        }\n      }\n    }\n  }\n\n  /** Returns a path to highlight the given connection. */\n  drawConnectionHighlightPath(measurable: Connection): SVGElement | undefined {\n    const conn = measurable.connectionModel;\n    let path = '';\n    if (\n      conn.type === ConnectionType.INPUT_VALUE ||\n      conn.type === ConnectionType.OUTPUT_VALUE\n    ) {\n      path = this.getExpressionConnectionHighlightPath(measurable);\n    } else {\n      path = this.getStatementConnectionHighlightPath(measurable);\n    }\n    const block = conn.getSourceBlock();\n    return block.pathObject.addConnectionHighlight?.(\n      conn,\n      path,\n      conn.getOffsetInBlock(),\n      block.RTL,\n    );\n  }\n\n  /**\n   * Returns a path to highlight the given conneciton, assuming it is an\n   * input or output connection.\n   */\n  private getExpressionConnectionHighlightPath(connection: Connection): string {\n    let connPath = '';\n    if (isDynamicShape(connection.shape)) {\n      connPath = connection.shape.pathDown(connection.height);\n    } else if (isPuzzleTab(connection.shape)) {\n      connPath = connection.shape.pathDown;\n    }\n\n    // We are assuming that there is room for the tab offset above and below\n    // the tab.\n    const yLen = this.constants_.TAB_OFFSET_FROM_TOP;\n    return (\n      svgPaths.moveBy(0, -yLen) +\n      svgPaths.lineOnAxis('v', yLen) +\n      connPath +\n      svgPaths.lineOnAxis('v', yLen)\n    );\n  }\n\n  /**\n   * Returns a path to highlight the given conneciton, assuming it is a\n   * next or previous connection.\n   */\n  private getStatementConnectionHighlightPath(connection: Connection): string {\n    if (!isNotch(connection.shape)) {\n      throw new Error('Statement connections should have notch shapes');\n    }\n\n    const xLen =\n      this.constants_.NOTCH_OFFSET_LEFT - this.constants_.CORNER_RADIUS;\n    return (\n      svgPaths.moveBy(-xLen, 0) +\n      svgPaths.lineOnAxis('h', xLen) +\n      connection.shape.pathLeft +\n      svgPaths.lineOnAxis('h', xLen)\n    );\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.blockRendering.RenderInfo\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {Align} from '../../inputs/align.js';\nimport {DummyInput} from '../../inputs/dummy_input.js';\nimport {EndRowInput} from '../../inputs/end_row_input.js';\nimport {Input} from '../../inputs/input.js';\nimport {StatementInput} from '../../inputs/statement_input.js';\nimport {ValueInput} from '../../inputs/value_input.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {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 {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 as StatementInputMeasurable} from '../measurables/statement_input.js';\nimport {TopRow} from '../measurables/top_row.js';\nimport {Types} from '../measurables/types.js';\nimport type {ConstantProvider} from './constants.js';\nimport type {Renderer} from './renderer.js';\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 */\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  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   */\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   */\n  getRenderer(): Renderer {\n    return this.renderer_;\n  }\n\n  /**\n   * Populate this object with all sizing information needed to draw the 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  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.isShownWhenCollapsed()) {\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  protected populateTopRow_() {\n    const hasPrevious = !!this.block_.previousConnection;\n    const hasHat =\n      (this.block_.hat\n        ? this.block_.hat === 'cap'\n        : this.constants_.ADD_START_HATS) &&\n      !this.outputConnection &&\n      !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    } else if (hasPrevious) {\n      this.topRow.hasPreviousConnection = true;\n      this.topRow.connection = new PreviousConnection(\n        this.constants_,\n        this.block_.previousConnection as RenderedConnection,\n      );\n      this.topRow.elements.push(this.topRow.connection);\n    }\n\n    const precedesStatement =\n      this.block_.inputList.length &&\n      this.block_.inputList[0] instanceof StatementInput;\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_)\n      ? 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  protected populateBottomRow_() {\n    this.bottomRow.hasNextConnection = !!this.block_.nextConnection;\n\n    const followsStatement =\n      this.block_.inputList.length &&\n      this.block_.inputList[this.block_.inputList.length - 1] instanceof\n        StatementInput;\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_,\n        this.block_.nextConnection as RenderedConnection,\n      );\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 instanceof ValueInput) {\n      activeRow.elements.push(new InlineInput(this.constants_, input));\n      activeRow.hasInlineInput = true;\n    } else if (input instanceof StatementInput) {\n      activeRow.elements.push(\n        new StatementInputMeasurable(this.constants_, input),\n      );\n      activeRow.hasStatement = true;\n    } else if (input instanceof ValueInput) {\n      activeRow.elements.push(new ExternalValueInput(this.constants_, input));\n      activeRow.hasExternalInput = true;\n    } else if (input instanceof DummyInput || input instanceof EndRowInput) {\n      // Dummy and end-row inputs have no visual representation, but the\n      // information is 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      );\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 currInput The current input.\n   * @param prevInput The previous input.\n   * @returns True if the current input should be rendered on a new row.\n   */\n  protected shouldStartNewRow_(currInput: Input, prevInput?: 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 (!prevInput) {\n      return false;\n    }\n    // If the previous input was an end-row input, then any following input\n    // should always be rendered on the next row.\n    if (prevInput instanceof EndRowInput) {\n      return true;\n    }\n    // A statement input or an input following one always gets a new row.\n    if (\n      currInput instanceof StatementInput ||\n      prevInput instanceof StatementInput\n    ) {\n      return true;\n    }\n    // Value inputs, dummy inputs, and any input following an external value\n    // input get a new row if inputs are not inlined.\n    if (\n      currInput instanceof ValueInput ||\n      currInput instanceof DummyInput ||\n      prevInput instanceof ValueInput\n    ) {\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(\n          new InRowSpacer(\n            this.constants_,\n            this.getInRowSpacing_(null, oldElems[0]),\n          ),\n        );\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(\n          new InRowSpacer(\n            this.constants_,\n            this.getInRowSpacing_(oldElems[oldElems.length - 1], null),\n          ),\n        );\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_(\n    prev: Measurable | null,\n    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    // Don't add padding after zero-width fields.\n    if (prev && Types.isField(prev) && prev.width === 0) {\n      return this.constants_.NO_PADDING;\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 = Math.max(\n          widestStatementRowFields,\n          innerWidth,\n        );\n      }\n      widestRowWithConnectedBlocks = Math.max(\n        widestRowWithConnectedBlocks,\n        row.widthWithConnectedBlocks,\n      );\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 = Math.max(\n      row.width,\n      this.statementEdge + row.connectedBlockWidths,\n    );\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 baseline = row.yPos + row.height - row.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      if (Types.isHat(elem)) {\n        return row.capline - elem.height / 2;\n      }\n      return row.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 = Math.max(\n        widestRowWithConnectedBlocks,\n        row.widthWithConnectedBlocks,\n      );\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,\n          target.getHeightWidth().width,\n        );\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  /** Returns the connection measurable associated with the given connection. */\n  getMeasureableForConnection(conn: RenderedConnection): Connection | null {\n    if (this.outputConnection?.connectionModel === conn) {\n      return this.outputConnection;\n    }\n\n    for (const row of this.rows) {\n      for (const elem of row.elements) {\n        if (elem instanceof Connection && elem.connectionModel === conn) {\n          return elem;\n        }\n      }\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// Former goog.module ID: Blockly.blockRendering.PathObject\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Connection} from '../../connection.js';\nimport {RenderedConnection} from '../../rendered_connection.js';\nimport type {BlockStyle} from '../../theme.js';\nimport {Coordinate} from '../../utils/coordinate.js';\nimport * as dom from '../../utils/dom.js';\nimport {Svg} from '../../utils/svg.js';\nimport type {ConstantProvider} from './constants.js';\nimport type {IPathObject} from './i_path_object.js';\n\n/**\n * An object that handles creating and setting each of the SVG elements\n * used by the renderer.\n */\nexport class PathObject implements IPathObject {\n  svgRoot: SVGElement;\n  svgPath: SVGElement;\n\n  constants: ConstantProvider;\n  style: BlockStyle;\n\n  /** Highlight paths associated with connections. */\n  private connectionHighlights = new WeakMap<RenderedConnection, SVGElement>();\n\n  /** Locations of connection highlights. */\n  private highlightOffsets = new WeakMap<RenderedConnection, Coordinate>();\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   */\n  constructor(\n    root: SVGElement,\n    style: BlockStyle,\n    constants: ConstantProvider,\n  ) {\n    this.constants = constants;\n    this.style = style;\n    this.svgRoot = root;\n\n    /** The primary path of the block. */\n    this.svgPath = dom.createSvgElement(\n      Svg.PATH,\n      {'class': 'blocklyPath'},\n      this.svgRoot,\n    );\n\n    this.setClass_('blocklyBlock', true);\n  }\n\n  /**\n   * Set the path generated by the renderer onto the respective SVG element.\n   *\n   * @param pathString The path.\n   */\n  setPath(pathString: string) {\n    this.svgPath.setAttribute('d', pathString);\n  }\n\n  /**\n   * Flip the SVG paths in RTL.\n   */\n  flipRTL() {\n    // Mirror the block's path.\n    this.svgPath.setAttribute('transform', 'scale(-1 1)');\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   */\n  applyColour(block: BlockSvg) {\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   */\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   */\n\n  updateHighlighted(enable: boolean) {\n    if (enable) {\n      this.setClass_('blocklyHighlighted', true);\n    } else {\n      this.setClass_('blocklyHighlighted', false);\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      this.setClass_('blocklyShadow', true);\n      this.svgPath.setAttribute('stroke', 'none');\n      this.svgPath.setAttribute('fill', this.style.colourSecondary);\n    } else {\n      this.setClass_('blocklyShadow', false);\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    this.setClass_('blocklyDisabledPattern', disabled);\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   */\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   */\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   */\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   */\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   */\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   */\n  updateShapeForInputHighlight(_conn: Connection, _enable: boolean) {\n    // NOOP\n  }\n\n  /** Adds the given path as a connection highlight for the given connection. */\n  addConnectionHighlight(\n    connection: RenderedConnection,\n    connectionPath: string,\n    offset: Coordinate,\n    rtl: boolean,\n  ): SVGElement {\n    const transformation =\n      `translate(${offset.x}, ${offset.y})` + (rtl ? ' scale(-1 1)' : '');\n\n    const previousHighlight = this.connectionHighlights.get(connection);\n    if (previousHighlight) {\n      // Since a connection already exists, make sure that its path and\n      // transform are correct.\n      previousHighlight.setAttribute('d', connectionPath);\n      previousHighlight.setAttribute('transform', transformation);\n      return previousHighlight;\n    }\n\n    const highlight = dom.createSvgElement(\n      Svg.PATH,\n      {\n        'id': connection.id,\n        'class': 'blocklyHighlightedConnectionPath',\n        'style': 'display: none;',\n        'd': connectionPath,\n        'transform': transformation,\n      },\n      this.svgRoot,\n    );\n    this.connectionHighlights.set(connection, highlight);\n    return highlight;\n  }\n\n  /**\n   * Removes any highlight associated with the given connection, if it exists.\n   */\n  removeConnectionHighlight(connection: RenderedConnection) {\n    const highlight = this.connectionHighlights.get(connection);\n    if (!highlight) return;\n    dom.removeNode(highlight);\n    this.connectionHighlights.delete(connection);\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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 type {IRegistrable} from '../../interfaces/i_registrable.js';\nimport type {BlockStyle, Theme} from '../../theme.js';\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport type {IPathObject} from './i_path_object.js';\nimport {RenderInfo} from './info.js';\nimport {PathObject} from './path_object.js';\n\n/**\n * The base class for a block renderer.\n */\nexport class Renderer implements IRegistrable {\n  /** The renderer's constant provider. */\n  protected constants_!: ConstantProvider;\n\n  protected name: string;\n\n  /**\n   * Rendering constant overrides, passed in through options.\n   */\n  protected overrides: object | null = null;\n\n  /**\n   * @param name The renderer name.\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   */\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   */\n  init(\n    theme: Theme,\n    opt_rendererOverrides?: {[rendererConstant: string]: any},\n  ) {\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   * If you need to create additional DOM elements, override the\n   * {@link blockRendering#ConstantProvider.createDom} method instead.\n   *\n   * @param svg The root of the workspace's SVG.\n   * @param theme The workspace theme object.\n   * @param injectionDivIfIsParent The div containing the parent workspace and\n   *   all related workspaces and block containers, if this renderer is for the\n   *   parent workspace. CSS variables representing SVG patterns will be scoped\n   *   to this container. Child workspaces should not override the CSS variables\n   *   created by the parent and thus do not need access to the injection div.\n   * @internal\n   */\n  createDom(\n    svg: SVGElement,\n    theme: Theme,\n    injectionDivIfIsParent?: HTMLElement,\n  ) {\n    this.constants_.createDom(\n      svg,\n      this.name + '-' + theme.name,\n      '.' + this.getClassName() + '.' + theme.getClassName(),\n      injectionDivIfIsParent,\n    );\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   * @param injectionDivIfIsParent The div containing the parent workspace and\n   *   all related workspaces and block containers, if this renderer is for the\n   *   parent workspace. CSS variables representing SVG patterns will be scoped\n   *   to this container. Child workspaces should not override the CSS variables\n   *   created by the parent and thus do not need access to the injection div.\n   */\n  refreshDom(\n    svg: SVGElement,\n    theme: Theme,\n    injectionDivIfIsParent?: HTMLElement,\n  ) {\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, injectionDivIfIsParent);\n  }\n\n  /**\n   * Dispose of this renderer.\n   * Delete all DOM elements that this renderer and its constants created.\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 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   */\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   */\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   */\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   */\n  protected orphanCanConnectAtEnd(\n    topBlock: BlockSvg,\n    orphanBlock: BlockSvg,\n    localType: number,\n  ): boolean {\n    const orphanConnection =\n      localType === ConnectionType.OUTPUT_VALUE\n        ? orphanBlock.outputConnection\n        : orphanBlock.previousConnection;\n    return !!Connection.getConnectionForOrphanedConnection(\n      topBlock as Block,\n      orphanConnection as Connection,\n    );\n  }\n\n  /**\n   * Render the block.\n   *\n   * @param block The block to render.\n   * @internal\n   */\n  render(block: BlockSvg) {\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 */\n// Former goog.module ID: 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 * Class for storing and updating a workspace's theme and UI components.\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\n  /**\n   * @param workspace The main workspace.\n   * @param theme The workspace theme.\n   * @internal\n   */\n  constructor(\n    private readonly workspace: WorkspaceSvg,\n    private theme: Theme,\n  ) {}\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 (\n      let i = 0, workspace;\n      (workspace = this.subscribedWorkspaces[i]);\n      i++\n    ) {\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        element.style.setProperty(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  /**\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(\n    element: HTMLElement | SVGElement,\n    componentName: string,\n    propertyName: string,\n  ) {\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    element.style.setProperty(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: HTMLElement | SVGElement) {\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   * @internal\n   */\n  dispose() {\n    this.subscribedWorkspaces.length = 0;\n    this.componentDB.clear();\n  }\n}\n\nexport namespace ThemeManager {\n  /** The type for a Blockly UI Component. */\n  export interface Component {\n    element: HTMLElement | SVGElement;\n    propertyName: string;\n  }\n}\n\nexport type Component = ThemeManager.Component;\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 */\n// Former goog.module ID: 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 * Class for connection type checking logic.\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,\n    b: Connection | null,\n    isDragging: boolean,\n    opt_distance?: number,\n  ): boolean {\n    return (\n      this.canConnectWithReason(a, b, isDragging, opt_distance) ===\n      Connection.CAN_CONNECT\n    );\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,\n    b: Connection | null,\n    isDragging: boolean,\n    opt_distance?: number,\n  ): 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 (\n      isDragging &&\n      !this.doDragChecks(\n        a as RenderedConnection,\n        b as RenderedConnection,\n        opt_distance || 0,\n      )\n    ) {\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(\n    errorCode: number,\n    a: Connection | null,\n    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 +=\n          connOne +\n          ' expected ' +\n          connOne.getCheck() +\n          ', 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    ) {\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    ) {\n      return Connection.REASON_PREVIOUS_AND_OUTPUT;\n    } else if (\n      inferiorConnection.type === ConnectionType.PREVIOUS_STATEMENT &&\n      inferiorBlock.outputConnection &&\n      inferiorBlock.outputConnection.isConnected()\n    ) {\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.includes(checkArrayOne[i])) {\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 (on the block that's being dragged).\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(\n    a: RenderedConnection,\n    b: RenderedConnection,\n    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 (\n          (b.isConnected() && !b.targetBlock()!.isInsertionMarker()) ||\n          a.isConnected()\n        ) {\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 (\n          b.isConnected() &&\n          !b.targetBlock()!.isMovable() &&\n          !b.targetBlock()!.isShadow()\n        ) {\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 (\n          b.isConnected() &&\n          !a.getSourceBlock().nextConnection &&\n          !b.targetBlock()!.isShadow() &&\n          b.targetBlock()!.nextConnection\n        ) {\n          return false;\n        }\n\n        // Don't offer to splice into a stack where the connected block is\n        // immovable, unless the block is a shadow block.\n        if (\n          b.targetBlock() &&\n          !b.targetBlock()!.isMovable() &&\n          !b.targetBlock()!.isShadow()\n        ) {\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.includes(b)) {\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.includes(b)) {\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,\n  registry.DEFAULT,\n  ConnectionChecker,\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 */\n// Former goog.module ID: 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 {WorkspaceComment} from './comments/workspace_comment.js';\nimport * as common from './common.js';\nimport type {ConnectionDB} from './connection_db.js';\nimport type {Abstract} from './events/events_abstract.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IBoundedElement} from './interfaces/i_bounded_element.js';\nimport type {IConnectionChecker} from './interfaces/i_connection_checker.js';\nimport {IProcedureMap} from './interfaces/i_procedure_map.js';\nimport type {IVariableMap} from './interfaces/i_variable_map.js';\nimport type {\n  IVariableModel,\n  IVariableState,\n} from './interfaces/i_variable_model.js';\nimport {ObservableProcedureMap} from './observable_procedure_map.js';\nimport {Options} from './options.js';\nimport * as registry from './registry.js';\nimport * as arrayUtils from './utils/array.js';\nimport * as deprecation from './utils/deprecation.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport * as math from './utils/math.js';\nimport {Rect} from './utils/rect.js';\nimport type * as toolbox from './utils/toolbox.js';\nimport {deleteVariable, getVariableUsesById} from './variables.js';\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 */\nexport class Workspace {\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: ((e: Abstract) => void)[] = [];\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: IVariableMap<IVariableModel<IVariableState>>;\n  private procedureMap: IProcedureMap = new ObservableProcedureMap();\n  private readOnly = false;\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: IVariableMap<\n    IVariableModel<IVariableState>\n  > | 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,\n      this.options,\n      true,\n    );\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    const VariableMap = this.getVariableMapClass();\n    this.variableMap = new VariableMap(this);\n\n    this.setIsReadOnly(this.options.readOnly);\n  }\n\n  /**\n   * Dispose of this workspace.\n   * Unlink from all DOM elements to prevent memory leaks.\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(\n    a: Block | WorkspaceComment,\n    b: Block | WorkspaceComment,\n  ): number {\n    const wrap = (element: Block | WorkspaceComment) => {\n      return {\n        getBoundingRectangle: () => {\n          const xy = element.getRelativeToSurfaceXY();\n          return new Rect(xy.y, xy.y, xy.x, xy.x);\n        },\n        moveBy: () => {},\n      };\n    };\n    return this.sortByOrigin(wrap(a), wrap(b));\n  }\n\n  /**\n   * Sorts bounded elements on the workspace by their relative position, top to\n   * bottom (with slight LTR or RTL bias).\n   *\n   * @param a The first element to sort.\n   * @param b The second elment to sort.\n   * @returns -1, 0 or 1 depending on the sort order.\n   */\n  protected sortByOrigin(a: IBoundedElement, b: IBoundedElement): number {\n    const offset =\n      Math.sin(math.toRadians(Workspace.SCAN_ANGLE)) * (this.RTL ? -1 : 1);\n    const aXY = a.getBoundingRectangle().getOrigin();\n    const bXY = b.getBoundingRectangle().getOrigin();\n    return aXY.y + offset * aXY.x - (bXY.y + offset * 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 = false): Block[] {\n    // Copy the topBlocks list.\n    const blocks = new Array<Block>().concat(this.topBlocks);\n    if (ordered && blocks.length > 1) {\n      blocks.sort(this.sortObjects.bind(this));\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 = false): 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      blocks.sort(this.sortObjects.bind(this));\n    }\n\n    return blocks.filter((block) => !block.isInsertionMarker());\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      );\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 \" + 'comments.',\n      );\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 = false): WorkspaceComment[] {\n    // Copy the topComments list.\n    const comments = new Array<WorkspaceComment>().concat(this.topComments);\n    if (ordered && comments.length > 1) {\n      comments.sort(this.sortObjects.bind(this));\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 = false): Block[] {\n    let blocks: Block[];\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    return blocks.filter((block) => !block.isInsertionMarker());\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      eventUtils.setGroup(existingGroup);\n      // If this is a flyout workspace, its variable map is shared with the\n      // parent workspace, so we either don't want to disturb it if we're just\n      // disposing the flyout, or if the flyout is being disposed because the\n      // main workspace is being disposed, then the main workspace will handle\n      // cleaning it up.\n      if (!this.isFlyout) {\n        this.variableMap.clear();\n      }\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\n   * map. Identify the variable to rename with the given ID.\n   *\n   * @deprecated v12: use Blockly.Workspace.getVariableMap().renameVariable\n   * @param id ID of the variable to rename.\n   * @param newName New variable name.\n   */\n  renameVariableById(id: string, newName: string) {\n    deprecation.warn(\n      'Blockly.Workspace.renameVariableById',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().renameVariable',\n    );\n    const variable = this.variableMap.getVariableById(id);\n    if (!variable) return;\n    this.variableMap.renameVariable(variable, newName);\n  }\n\n  /**\n   * Create a variable with a given name, optional type, and optional ID.\n   *\n   * @deprecated v12: use Blockly.Workspace.getVariableMap().createVariable.\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(\n    name: string,\n    opt_type?: string | null,\n    opt_id?: string | null,\n  ): IVariableModel<IVariableState> {\n    deprecation.warn(\n      'Blockly.Workspace.createVariable',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().createVariable',\n    );\n    return this.variableMap.createVariable(\n      name,\n      opt_type ?? undefined,\n      opt_id ?? undefined,\n    );\n  }\n\n  /**\n   * Find all the uses of the given variable, which is identified by ID.\n   *\n   * @deprecated v12: use Blockly.Workspace.getVariableMap().getVariableUsesById\n   * @param id ID of the variable to find.\n   * @returns Array of block usages.\n   */\n  getVariableUsesById(id: string): Block[] {\n    deprecation.warn(\n      'Blockly.Workspace.getVariableUsesById',\n      'v12',\n      'v13',\n      'Blockly.Variables.getVariableUsesById',\n    );\n    return getVariableUsesById(this, 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   * @deprecated v12: use Blockly.Workspace.getVariableMap().deleteVariable.\n   * @param id ID of variable to delete.\n   */\n  deleteVariableById(id: string) {\n    deprecation.warn(\n      'Blockly.Workspace.deleteVariableById',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().deleteVariable',\n    );\n    const variable = this.variableMap.getVariableById(id);\n    if (!variable) {\n      console.warn(`Can't delete non-existent variable: ${id}`);\n      return;\n    }\n    deleteVariable(this, variable);\n  }\n\n  /**\n   * Find the variable by the given name and return it. Return null if not\n   * found.\n   *\n   * @deprecated v12: use Blockly.Workspace.getVariableMap().getVariable.\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(\n    name: string,\n    opt_type?: string,\n  ): IVariableModel<IVariableState> | null {\n    deprecation.warn(\n      'Blockly.Workspace.getVariable',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().getVariable',\n    );\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   * @deprecated v12: use Blockly.Workspace.getVariableMap().getVariableById.\n   * @param id The ID to check for.\n   * @returns The variable with the given ID.\n   */\n  getVariableById(id: string): IVariableModel<IVariableState> | null {\n    deprecation.warn(\n      'Blockly.Workspace.getVariableById',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().getVariableById',\n    );\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   * @deprecated v12: use Blockly.Workspace.getVariableMap().getVariablesOfType.\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): IVariableModel<IVariableState>[] {\n    deprecation.warn(\n      'Blockly.Workspace.getVariablesOfType',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().getVariablesOfType',\n    );\n    return this.variableMap.getVariablesOfType(type ?? '');\n  }\n\n  /**\n   * Return all variables of all types.\n   *\n   * @deprecated v12: use Blockly.Workspace.getVariableMap().getAllVariables.\n   * @returns List of variable models.\n   */\n  getAllVariables(): IVariableModel<IVariableState>[] {\n    deprecation.warn(\n      'Blockly.Workspace.getAllVariables',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().getAllVariables',\n    );\n    return this.variableMap.getAllVariables();\n  }\n\n  /**\n   * Returns all variable names of all types.\n   *\n   * @deprecated v12: use Blockly.Workspace.getVariableMap().getAllVariables.\n   * @returns List of all variable names of all types.\n   */\n  getAllVariableNames(): string[] {\n    deprecation.warn(\n      'Blockly.Workspace.getAllVariableNames',\n      'v12',\n      'v13',\n      'Blockly.Workspace.getVariableMap().getAllVariables',\n    );\n    return this.variableMap.getAllVariables().map((v) => v.getName());\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  }\n\n  /**\n   * Obtain a newly created comment.\n   *\n   * @param id Optional ID.  Use this ID if provided, otherwise create a new\n   *     ID.\n   * @returns The created comment.\n   */\n  newComment(id?: string): WorkspaceComment {\n    throw new Error(\n      'The implementation of newComment should be ' +\n        'monkey-patched in by blockly.ts',\n    );\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 =\n      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: {[key: string]: number}): 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    const events = [inputEvent];\n    // Do another undo/redo if the next one is of the same group.\n    while (\n      inputStack.length &&\n      inputEvent.group &&\n      inputEvent.group === inputStack[inputStack.length - 1].group\n    ) {\n      const event = inputStack.pop();\n      if (!event) continue;\n      events.push(event);\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    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: (e: Abstract) => void): (e: Abstract) => void {\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: (e: Abstract) => void) {\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   */\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   */\n  getPotentialVariableMap(): IVariableMap<\n    IVariableModel<IVariableState>\n  > | 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    const VariableMap = this.getVariableMapClass();\n    this.potentialVariableMap = new VariableMap(this, true);\n  }\n\n  /**\n   * Return the map of all variables on the workspace.\n   *\n   * @returns The variable map.\n   */\n  getVariableMap(): IVariableMap<IVariableModel<IVariableState>> {\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: IVariableMap<IVariableModel<IVariableState>>) {\n    this.variableMap = variableMap;\n  }\n\n  /** Returns the map of all procedures on the workpace. */\n  getProcedureMap(): IProcedureMap {\n    return this.procedureMap;\n  }\n\n  /**\n   * Returns the root workspace of this workspace if the workspace has\n   * parent(s).\n   *\n   * E.g. workspaces in flyouts and mini workspace bubbles have parent\n   * workspaces.\n   */\n  getRootWorkspace(): Workspace | null {\n    let outerWs = null;\n    const parent = this.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 (this.isFlyout) {\n      if (parent && parent.options) {\n        outerWs = parent.options.parentWorkspace;\n      }\n    } else if (parent) {\n      outerWs = parent;\n    }\n    return outerWs;\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  protected getVariableMapClass(): new (\n    ...p1: any[]\n  ) => IVariableMap<IVariableModel<IVariableState>> {\n    const VariableMap = registry.getClassFromOptions(\n      registry.Type.VARIABLE_MAP,\n      this.options,\n      true,\n    );\n    if (!VariableMap) {\n      throw new Error('No variable map is registered.');\n    }\n    return VariableMap;\n  }\n\n  /**\n   * Returns whether or not this workspace is in readonly mode.\n   *\n   * @returns True if the workspace is readonly, otherwise false.\n   */\n  isReadOnly(): boolean {\n    return this.readOnly;\n  }\n\n  /**\n   * Sets whether or not this workspace is in readonly mode.\n   *\n   * @param readOnly True to make the workspace readonly, otherwise false.\n   */\n  setIsReadOnly(readOnly: boolean) {\n    this.readOnly = readOnly;\n    this.options.readOnly = readOnly;\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 */\n// Former goog.module ID: Blockly.WorkspaceAudio\n\nimport * as userAgent from './utils/useragent.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\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 */\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  /** Whether the audio is muted or not. */\n  private muted: boolean = false;\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 {\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).catch(\n          // Play without user interaction was prevented.\n          function () {},\n        );\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    if (this.muted) {\n      return;\n    }\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 (\n        this.lastSound !== null &&\n        now.getTime() - this.lastSound.getTime() < SOUND_LIMIT\n      ) {\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   * @param muted If true, mute sounds. Otherwise, play them.\n   */\n  setMuted(muted: boolean) {\n    this.muted = muted;\n  }\n\n  /**\n   * @returns Whether the audio is currently muted or not.\n   */\n  getMuted(): boolean {\n    return this.muted;\n  }\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 */\n// Former goog.module ID: Blockly.Events.VarBase\n\nimport type {\n  IVariableModel,\n  IVariableState,\n} from '../interfaces/i_variable_model.js';\nimport type {Workspace} from '../workspace.js';\nimport {\n  Abstract as AbstractEvent,\n  AbstractEventJson,\n} from './events_abstract.js';\n\n/**\n * Abstract class for a variable event.\n */\nexport class VarBase extends AbstractEvent {\n  override isBlank = true;\n  /** The ID of the variable this event references. */\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?: IVariableModel<IVariableState>) {\n    super();\n    this.isBlank = typeof opt_variable === 'undefined';\n    if (!opt_variable) return;\n\n    this.varId = opt_variable.getId();\n    this.workspaceId = opt_variable.getWorkspace().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    }\n    json['varId'] = this.varId;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of VarBase, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: VarBaseJson,\n    workspace: Workspace,\n    event?: any,\n  ): VarBase {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new VarBase(),\n    ) as VarBase;\n    newEvent.varId = json['varId'];\n    return newEvent;\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 */\n// Former goog.module ID: Blockly.Events.VarCreate\n\nimport type {\n  IVariableModel,\n  IVariableState,\n} from '../interfaces/i_variable_model.js';\nimport * as registry from '../registry.js';\n\nimport type {Workspace} from '../workspace.js';\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a variable model has been created.\n */\nexport class VarCreate extends VarBase {\n  override type = EventType.VAR_CREATE;\n\n  /** The type of the variable that was created. */\n  varType?: string;\n\n  /** The name of the variable that was created. */\n  varName?: string;\n\n  /**\n   * @param opt_variable The created variable. Undefined for a blank event.\n   */\n  constructor(opt_variable?: IVariableModel<IVariableState>) {\n    super(opt_variable);\n\n    if (!opt_variable) {\n      return; // Blank event to be populated by fromJson.\n    }\n    this.varType = opt_variable.getType();\n    this.varName = opt_variable.getName();\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 === undefined) {\n      throw new Error(\n        'The var type is undefined. Either pass a variable to ' +\n          'the constructor, or call fromJson',\n      );\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    }\n    json['varType'] = this.varType;\n    json['varName'] = this.varName;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of VarCreate, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: VarCreateJson,\n    workspace: Workspace,\n    event?: any,\n  ): VarCreate {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new VarCreate(),\n    ) as VarCreate;\n    newEvent.varType = json['varType'];\n    newEvent.varName = json['varName'];\n    return newEvent;\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    }\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    }\n    const variableMap = workspace.getVariableMap();\n    if (forward) {\n      variableMap.createVariable(this.varName, this.varType, this.varId);\n    } else {\n      const variable = variableMap.getVariableById(this.varId);\n      if (variable) variableMap.deleteVariable(variable);\n    }\n  }\n}\n\nexport interface VarCreateJson extends VarBaseJson {\n  varType: string;\n  varName: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.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 */\n// Former goog.module ID: Blockly.VariableModel\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_var_create.js';\n\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {IVariableModel, IVariableState} from './interfaces/i_variable_model.js';\nimport * as registry from './registry.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport type {Workspace} from './workspace.js';\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 */\nexport class VariableModel implements IVariableModel<IVariableState> {\n  private 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    private readonly workspace: Workspace,\n    private name: string,\n    opt_type?: string,\n    opt_id?: string,\n  ) {\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\n  /** @returns The ID for the variable. */\n  getId(): string {\n    return this.id;\n  }\n\n  /** @returns The name of this variable. */\n  getName(): string {\n    return this.name;\n  }\n\n  /**\n   * Updates the user-visible name of this variable.\n   *\n   * @returns The newly-updated variable.\n   */\n  setName(newName: string): this {\n    this.name = newName;\n    return this;\n  }\n\n  /** @returns The type of this variable. */\n  getType(): string {\n    return this.type;\n  }\n\n  /**\n   * Updates the type of this variable.\n   *\n   * @returns The newly-updated variable.\n   */\n  setType(newType: string): this {\n    this.type = newType;\n    return this;\n  }\n\n  /**\n   * Returns the workspace this VariableModel belongs to.\n   *\n   * @returns The workspace this VariableModel belongs to.\n   */\n  getWorkspace(): Workspace {\n    return this.workspace;\n  }\n\n  /**\n   * Serializes this VariableModel.\n   *\n   * @returns a JSON representation of this VariableModel.\n   */\n  save(): IVariableState {\n    const state: IVariableState = {\n      'name': this.getName(),\n      'id': this.getId(),\n    };\n    const type = this.getType();\n    if (type) {\n      state['type'] = type;\n    }\n\n    return state;\n  }\n\n  /**\n   * Loads the persisted state into a new variable in the given workspace.\n   *\n   * @param state The serialized state of a variable model from save().\n   * @param workspace The workspace to create the new variable in.\n   */\n  static load(state: IVariableState, workspace: Workspace) {\n    const variable = new this(\n      workspace,\n      state['name'],\n      state['type'],\n      state['id'],\n    );\n    workspace.getVariableMap().addVariable(variable);\n    eventUtils.fire(new (eventUtils.get(EventType.VAR_CREATE))(variable));\n  }\n}\n\nregistry.register(\n  registry.Type.VARIABLE_MODEL,\n  registry.DEFAULT,\n  VariableModel,\n);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Events.VarDelete\n\nimport type {\n  IVariableModel,\n  IVariableState,\n} from '../interfaces/i_variable_model.js';\nimport * as registry from '../registry.js';\n\nimport type {Workspace} from '../workspace.js';\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a variable model has been deleted.\n */\nexport class VarDelete extends VarBase {\n  override type = EventType.VAR_DELETE;\n  /** The type of the variable that was deleted. */\n  varType?: string;\n  /** The name of the variable that was deleted. */\n  varName?: string;\n\n  /**\n   * @param opt_variable The deleted variable. Undefined for a blank event.\n   */\n  constructor(opt_variable?: IVariableModel<IVariableState>) {\n    super(opt_variable);\n\n    if (!opt_variable) {\n      return; // Blank event to be populated by fromJson.\n    }\n    this.varType = opt_variable.getType();\n    this.varName = opt_variable.getName();\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 === undefined) {\n      throw new Error(\n        'The var type is undefined. Either pass a variable to ' +\n          'the constructor, or call fromJson',\n      );\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    }\n    json['varType'] = this.varType;\n    json['varName'] = this.varName;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of VarDelete, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: VarDeleteJson,\n    workspace: Workspace,\n    event?: any,\n  ): VarDelete {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new VarDelete(),\n    ) as VarDelete;\n    newEvent.varType = json['varType'];\n    newEvent.varName = json['varName'];\n    return newEvent;\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    }\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    }\n    const variableMap = workspace.getVariableMap();\n    if (forward) {\n      const variable = variableMap.getVariableById(this.varId);\n      if (variable) variableMap.deleteVariable(variable);\n    } else {\n      variableMap.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, EventType.VAR_DELETE, VarDelete);\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Events.VarRename\n\nimport type {\n  IVariableModel,\n  IVariableState,\n} from '../interfaces/i_variable_model.js';\nimport * as registry from '../registry.js';\n\nimport type {Workspace} from '../workspace.js';\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a variable model was renamed.\n */\nexport class VarRename extends VarBase {\n  override type = EventType.VAR_RENAME;\n\n  /** The previous name of the variable. */\n  oldName?: string;\n\n  /** The new name of the variable. */\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?: IVariableModel<IVariableState>, 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.getName();\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    }\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    }\n    json['oldName'] = this.oldName;\n    json['newName'] = this.newName;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of VarRename, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: VarRenameJson,\n    workspace: Workspace,\n    event?: any,\n  ): VarRename {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new VarRename(),\n    ) as VarRename;\n    newEvent.oldName = json['oldName'];\n    newEvent.newName = json['newName'];\n    return newEvent;\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    }\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    }\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    }\n    const variableMap = workspace.getVariableMap();\n    const variable = variableMap.getVariableById(this.varId);\n    if (forward) {\n      if (variable) variableMap.renameVariable(variable, this.newName);\n    } else {\n      if (variable) variableMap.renameVariable(variable, this.oldName);\n    }\n  }\n}\n\nexport interface VarRenameJson extends VarBaseJson {\n  oldName: string;\n  newName: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.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 */\n// Former goog.module ID: 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 {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport type {IVariableMap} from './interfaces/i_variable_map.js';\nimport {IVariableModel, IVariableState} from './interfaces/i_variable_model.js';\nimport {Names} from './names.js';\nimport * as registry from './registry.js';\nimport * as deprecation from './utils/deprecation.js';\nimport * as idGenerator from './utils/idgenerator.js';\nimport {deleteVariable, getVariableUsesById} from './variables.js';\nimport type {Workspace} from './workspace.js';\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 */\nexport class VariableMap\n  implements IVariableMap<IVariableModel<IVariableState>>\n{\n  /**\n   * A map from variable type to map of IDs to variables. The maps 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<\n    string,\n    Map<string, IVariableModel<IVariableState>>\n  >();\n\n  /**\n   * @param workspace The workspace this map belongs to.\n   * @param potentialMap True if this holds variables that don't exist in the\n   *  workspace yet.\n   */\n  constructor(\n    public workspace: Workspace,\n    public potentialMap = false,\n  ) {}\n\n  /** Clear the variable map.  Fires events for every deletion. */\n  clear() {\n    for (const variables of this.variableMap.values()) {\n      for (const variable of variables.values()) {\n        this.deleteVariable(variable);\n      }\n    }\n    if (this.variableMap.size !== 0) {\n      throw Error('Non-empty variable map');\n    }\n  }\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   * @returns The newly renamed variable.\n   */\n  renameVariable(\n    variable: IVariableModel<IVariableState>,\n    newName: string,\n  ): IVariableModel<IVariableState> {\n    if (variable.getName() === newName) return variable;\n    const type = variable.getType();\n    const conflictVar = this.getVariable(newName, type);\n    const blocks = this.workspace.getAllBlocks(false);\n    let existingGroup = '';\n    if (!this.potentialMap) {\n      existingGroup = eventUtils.getGroup();\n      if (!existingGroup) {\n        eventUtils.setGroup(true);\n      }\n    }\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(variable, newName, conflictVar, blocks);\n      }\n    } finally {\n      if (!this.potentialMap) eventUtils.setGroup(existingGroup);\n    }\n    return variable;\n  }\n\n  changeVariableType(\n    variable: IVariableModel<IVariableState>,\n    newType: string,\n  ): IVariableModel<IVariableState> {\n    const oldType = variable.getType();\n    if (oldType === newType) return variable;\n\n    this.variableMap.get(variable.getType())?.delete(variable.getId());\n    variable.setType(newType);\n    const newTypeVariables =\n      this.variableMap.get(newType) ??\n      new Map<string, IVariableModel<IVariableState>>();\n    newTypeVariables.set(variable.getId(), variable);\n    if (!this.variableMap.has(newType)) {\n      this.variableMap.set(newType, newTypeVariables);\n    }\n    eventUtils.fire(\n      new (eventUtils.get(EventType.VAR_TYPE_CHANGE))(\n        variable,\n        oldType,\n        newType,\n      ),\n    );\n    return variable;\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   * @deprecated v12: use VariableMap.renameVariable.\n   * @param id ID of the variable to rename.\n   * @param newName New variable name.\n   */\n  renameVariableById(id: string, newName: string) {\n    deprecation.warn(\n      'VariableMap.renameVariableById',\n      'v12',\n      'v13',\n      'VariableMap.renameVariable',\n    );\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: IVariableModel<IVariableState>,\n    newName: string,\n    blocks: Block[],\n  ) {\n    if (!this.potentialMap) {\n      eventUtils.fire(\n        new (eventUtils.get(EventType.VAR_RENAME))(variable, newName),\n      );\n    }\n    variable.setName(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: IVariableModel<IVariableState>,\n    newName: string,\n    conflictVar: IVariableModel<IVariableState>,\n    blocks: Block[],\n  ) {\n    const type = variable.getType();\n    const oldCase = conflictVar.getName();\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    if (!this.potentialMap) {\n      // Finally delete the original variable, which is now unreferenced.\n      eventUtils.fire(new (eventUtils.get(EventType.VAR_DELETE))(variable));\n    }\n    // And remove it from the map.\n    this.variableMap.get(type)?.delete(variable.getId());\n  }\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(\n    name: string,\n    opt_type?: string,\n    opt_id?: string,\n  ): IVariableModel<IVariableState> {\n    let variable = this.getVariable(name, opt_type);\n    if (variable) {\n      if (opt_id && variable.getId() !== opt_id) {\n        throw Error(\n          'Variable \"' +\n            name +\n            '\" is already in use and its id is \"' +\n            variable.getId() +\n            '\" which conflicts with the passed in ' +\n            'id, \"' +\n            opt_id +\n            '\".',\n        );\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    const VariableModel = registry.getClassFromOptions(\n      registry.Type.VARIABLE_MODEL,\n      this.workspace.options,\n      true,\n    );\n    if (!VariableModel) {\n      throw new Error('No variable model is registered.');\n    }\n    variable = new VariableModel(this.workspace, name, type, id);\n\n    const variables =\n      this.variableMap.get(type) ??\n      new Map<string, IVariableModel<IVariableState>>();\n    variables.set(variable.getId(), variable);\n    if (!this.variableMap.has(type)) {\n      this.variableMap.set(type, variables);\n    }\n    if (!this.potentialMap) {\n      eventUtils.fire(new (eventUtils.get(EventType.VAR_CREATE))(variable));\n    }\n    return variable;\n  }\n\n  /**\n   * Adds the given variable to this variable map.\n   *\n   * @param variable The variable to add.\n   */\n  addVariable(variable: IVariableModel<IVariableState>) {\n    const type = variable.getType();\n    if (!this.variableMap.has(type)) {\n      this.variableMap.set(\n        type,\n        new Map<string, IVariableModel<IVariableState>>(),\n      );\n    }\n    this.variableMap.get(type)?.set(variable.getId(), variable);\n  }\n\n  /* Begin functions for variable deletion. */\n  /**\n   * Delete a variable and all of its uses without confirmation.\n   *\n   * @param variable Variable to delete.\n   */\n  deleteVariable(variable: IVariableModel<IVariableState>) {\n    const uses = getVariableUsesById(this.workspace, variable.getId());\n    let existingGroup = '';\n    if (!this.potentialMap) {\n      existingGroup = eventUtils.getGroup();\n      if (!existingGroup) {\n        eventUtils.setGroup(true);\n      }\n    }\n    try {\n      for (let i = 0; i < uses.length; i++) {\n        uses[i].dispose(true);\n      }\n      const variables = this.variableMap.get(variable.getType());\n      if (!variables || !variables.has(variable.getId())) return;\n      variables.delete(variable.getId());\n      if (!this.potentialMap) {\n        eventUtils.fire(new (eventUtils.get(EventType.VAR_DELETE))(variable));\n      }\n      if (variables.size === 0) {\n        this.variableMap.delete(variable.getType());\n      }\n    } finally {\n      if (!this.potentialMap) {\n        eventUtils.setGroup(existingGroup);\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   * @deprecated v12: use Blockly.Variables.deleteVariable.\n   * @param id ID of variable to delete.\n   */\n  deleteVariableById(id: string) {\n    deprecation.warn(\n      'VariableMap.deleteVariableById',\n      'v12',\n      'v13',\n      'Blockly.Variables.deleteVariable',\n    );\n    const variable = this.getVariableById(id);\n    if (variable) {\n      deleteVariable(this.workspace, variable);\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(\n    name: string,\n    opt_type?: string,\n  ): IVariableModel<IVariableState> | null {\n    const type = opt_type || '';\n    const variables = this.variableMap.get(type);\n    if (!variables) return null;\n\n    return (\n      [...variables.values()].find((variable) =>\n        Names.equals(variable.getName(), name),\n      ) ?? null\n    );\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): IVariableModel<IVariableState> | null {\n    for (const variables of this.variableMap.values()) {\n      if (variables.has(id)) {\n        return variables.get(id) ?? null;\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): IVariableModel<IVariableState>[] {\n    type = type || '';\n    const variables = this.variableMap.get(type);\n    if (!variables) return [];\n\n    return [...variables.values()];\n  }\n\n  /**\n   * Returns a list of unique types of variables in this variable map.\n   *\n   * @returns A list of unique types of variables in this variable map.\n   */\n  getTypes(): string[] {\n    return [...this.variableMap.keys()];\n  }\n\n  /**\n   * Return all variables of all types.\n   *\n   * @returns List of variable models.\n   */\n  getAllVariables(): IVariableModel<IVariableState>[] {\n    let allVariables: IVariableModel<IVariableState>[] = [];\n    for (const variables of this.variableMap.values()) {\n      allVariables = allVariables.concat(...variables.values());\n    }\n    return allVariables;\n  }\n\n  /**\n   * Returns all of the variable names of all types.\n   *\n   * @deprecated v12: use Blockly.Variables.getAllVariables.\n   * @returns All of the variable names of all types.\n   */\n  getAllVariableNames(): string[] {\n    deprecation.warn(\n      'VariableMap.getAllVariableNames',\n      'v12',\n      'v13',\n      'Blockly.Variables.getAllVariables',\n    );\n    const names: string[] = [];\n    for (const variables of this.variableMap.values()) {\n      for (const variable of variables.values()) {\n        names.push(variable.getName());\n      }\n    }\n    return names;\n  }\n\n  /**\n   * Find all the uses of a named variable.\n   *\n   * @deprecated v12: use Blockly.Variables.getVariableUsesById.\n   * @param id ID of the variable to find.\n   * @returns Array of block usages.\n   */\n  getVariableUsesById(id: string): Block[] {\n    deprecation.warn(\n      'VariableMap.getVariableUsesById',\n      'v12',\n      'v13',\n      'Blockly.Variables.getVariableUsesById',\n    );\n    return getVariableUsesById(this.workspace, id);\n  }\n}\n\nregistry.register(registry.Type.VARIABLE_MAP, registry.DEFAULT, VariableMap);\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 */\n// Former goog.module ID: Blockly.Events.TrashcanOpen\n\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners when the trashcan is opening or closing.\n */\nexport class TrashcanOpen extends UiBase {\n  /**\n   * True if the trashcan is currently opening (previously closed).\n   * False if it is currently closing (previously open).\n   */\n  isOpen?: boolean;\n  override type = EventType.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    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    }\n    json['isOpen'] = this.isOpen;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of TrashcanOpen, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: TrashcanOpenJson,\n    workspace: Workspace,\n    event?: any,\n  ): TrashcanOpen {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new TrashcanOpen(),\n    ) as TrashcanOpen;\n    newEvent.isOpen = json['isOpen'];\n    return newEvent;\n  }\n}\n\nexport interface TrashcanOpenJson extends AbstractEventJson {\n  isOpen: boolean;\n}\n\nregistry.register(registry.Type.EVENT, EventType.TRASHCAN_OPEN, TrashcanOpen);\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 */\n// Former goog.module ID: Blockly.Trashcan\n\n// Unused import preserved for side-effects. Remove if unneeded.\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 './events/events_trashcan_open.js';\nimport {isBlockDelete} from './events/predicates.js';\nimport {EventType} from './events/type.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 * 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 * as toolbox from './utils/toolbox.js';\nimport {BlockInfo} from './utils/toolbox.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Class for a trash can.\n */\nexport class Trashcan\n  extends DeleteArea\n  implements IAutoHideable, IPositionable\n{\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 = this.workspace.copyOptionsForFlyout();\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,\n        this.workspace.options,\n        true,\n      );\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,\n        this.workspace.options,\n        true,\n      );\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,\n      {'id': 'blocklyTrashBodyClipPath' + rnd},\n      this.svgGroup,\n    );\n    dom.createSvgElement(\n      Svg.RECT,\n      {'width': WIDTH, 'height': BODY_HEIGHT, 'y': LID_HEIGHT},\n      clip,\n    );\n    const body = dom.createSvgElement(\n      Svg.IMAGE,\n      {\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    );\n    body.setAttributeNS(\n      dom.XLINK_NS,\n      'xlink:href',\n      this.workspace.options.pathToMedia + SPRITE.url,\n    );\n\n    clip = dom.createSvgElement(\n      Svg.CLIPPATH,\n      {'id': 'blocklyTrashLidClipPath' + rnd},\n      this.svgGroup,\n    );\n    dom.createSvgElement(\n      Svg.RECT,\n      {'width': WIDTH, 'height': LID_HEIGHT},\n      clip,\n    );\n    this.svgLid = dom.createSvgElement(\n      Svg.IMAGE,\n      {\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    );\n    this.svgLid.setAttributeNS(\n      dom.XLINK_NS,\n      'xlink:href',\n      this.workspace.options.pathToMedia + SPRITE.url,\n    );\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,\n      'pointerdown',\n      this,\n      this.blockMouseDownWhenOpenable,\n    );\n    browserEvents.bind(this.svgGroup, 'pointerup', this, this.click);\n    // Bind to body instead of this.svgGroup so that we don't get lid jitters\n    browserEvents.bind(body, 'pointerover', this, this.mouseOver);\n    browserEvents.bind(body, 'pointerout', 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      const flyoutDom = this.flyout!.createDom(Svg.SVG)!;\n      dom.addClass(flyoutDom, 'blocklyTrashcanFlyout');\n      dom.insertAfter(flyoutDom, this.workspace.getParentSvg());\n      this.flyout!.init(this.workspace);\n    }\n    this.workspace.getComponentManager().addComponent({\n      component: this,\n      weight: ComponentManager.ComponentWeight.TRASHCAN_WEIGHT,\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  dispose() {\n    this.workspace.getComponentManager().removeComponent('trashcan');\n    if (this.svgGroup) {\n      dom.removeNode(this.svgGroup);\n    }\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    // Trashcans with lots of blocks can take a second to render.\n    const blocklyStyle = this.workspace.getParentSvg().style;\n    blocklyStyle.cursor = 'wait';\n    setTimeout(() => {\n      this.flyout?.show(contents);\n      blocklyStyle.cursor = '';\n      this.workspace.scrollbar?.setVisible(false);\n    }, 10);\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.workspace.scrollbar?.setVisible(true);\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 = uiPosition.getCornerOppositeToolbox(\n      this.workspace,\n      metrics,\n    );\n\n    const height = BODY_HEIGHT + LID_HEIGHT;\n    const startRect = uiPosition.getStartPositionRect(\n      cornerPosition,\n      new Size(WIDTH, height),\n      MARGIN_HORIZONTAL,\n      MARGIN_VERTICAL,\n      metrics,\n      this.workspace,\n    );\n\n    const verticalPosition = cornerPosition.vertical;\n    const bumpDirection =\n      verticalPosition === uiPosition.verticalPosition.TOP\n        ? uiPosition.bumpDirection.DOWN\n        : uiPosition.bumpDirection.UP;\n    const positionRect = uiPosition.bumpPositionRect(\n      startRect,\n      MARGIN_VERTICAL,\n      bumpDirection,\n      savedPositions,\n    );\n\n    this.top = positionRect.top;\n    this.left = positionRect.left;\n    this.svgGroup?.setAttribute(\n      'transform',\n      'translate(' + this.left + ',' + this.top + ')',\n    );\n\n    this.flyout?.position();\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}`;\n    }\n\n    if (this.lidOpen > this.minOpenness && this.lidOpen < 1) {\n      this.lidTask = setTimeout(\n        this.animateLid.bind(this),\n        ANIMATION_LENGTH / frames,\n      );\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(' +\n        (openAtRight ? -lidAngle : lidAngle) +\n        ',' +\n        (openAtRight ? 4 : WIDTH - 4) +\n        ',' +\n        (LID_HEIGHT - 2) +\n        ')',\n    );\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() || this.workspace.isDragging()) {\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(EventType.TRASHCAN_OPEN))(\n      trashcanOpen,\n      this.workspace.id,\n    );\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: PointerEvent) {\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 (\n      this.workspace.options.maxTrashcanContents <= 0 ||\n      !isBlockDelete(event) ||\n      event.wasShadow\n    ) {\n      return;\n    }\n    if (!event.oldJson) {\n      throw new Error('Encountered a delete event without proper oldJson');\n    }\n    const cleanedJson = JSON.stringify(this.cleanBlockJson(event.oldJson));\n    if (this.contents.includes(cleanedJson)) return;\n    this.contents.unshift(cleanedJson);\n    while (this.contents.length > this.workspace.options.maxTrashcanContents) {\n      this.contents.pop();\n    }\n\n    this.setMinOpenness(HAS_BLOCKS_LID_ANGLE);\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      delete json['disabledReasons'];\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/** 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 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport {CollapseCommentBarButton} from './comments/collapse_comment_bar_button.js';\nexport {CommentBarButton} from './comments/comment_bar_button.js';\nexport {CommentEditor} from './comments/comment_editor.js';\nexport {CommentView} from './comments/comment_view.js';\nexport {DeleteCommentBarButton} from './comments/delete_comment_bar_button.js';\nexport {RenderedWorkspaceComment} from './comments/rendered_workspace_comment.js';\nexport {WorkspaceComment} from './comments/workspace_comment.js';\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.serialization.variables\n\nimport type {ISerializer} from '../interfaces/i_serializer.js';\nimport type {IVariableState} from '../interfaces/i_variable_model.js';\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport * as priorities from './priorities.js';\nimport * as serializationRegistry from './registry.js';\n\n/**\n * Serializer for saving and loading variable state.\n */\nexport class VariableSerializer implements ISerializer {\n  priority: number;\n\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): IVariableState[] | null {\n    const variableStates = workspace.getAllVariables().map((v) => v.save());\n    return variableStates.length ? variableStates : null;\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: IVariableState[], workspace: Workspace) {\n    const VariableModel = registry.getObject(\n      registry.Type.VARIABLE_MODEL,\n      registry.DEFAULT,\n    );\n    state.forEach((s) => {\n      VariableModel?.load(s, workspace);\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 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Serialization methods.\n */\n// Former goog.module ID: Blockly.serialization\n\nimport {ISerializer} from './interfaces/i_serializer.js';\nimport * as blocks from './serialization/blocks.js';\nimport * as exceptions from './serialization/exceptions.js';\nimport * as priorities from './serialization/priorities.js';\nimport * as procedures from './serialization/procedures.js';\nimport * as registry from './serialization/registry.js';\nimport * as variables from './serialization/variables.js';\nimport * as workspaceComments from './serialization/workspace_comments.js';\nimport * as workspaces from './serialization/workspaces.js';\n\nexport {\n  blocks,\n  exceptions,\n  ISerializer,\n  priorities,\n  procedures,\n  registry,\n  variables,\n  workspaceComments,\n  workspaces,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @file The entrypoint for blockly_compressed.js.  Provides various\n * backwards-compatibility hacks.  Not used when loading in\n * uncompressed mode.\n */\n\n// Former goog.module ID: Blockly.main\n\nimport * as Msg from './msg.js';\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// the generated msg/*.js files, 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 as any)['Blockly'] = {'Msg': Msg};\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {FlyoutButton} from './flyout_button.js';\nimport {FlyoutItem} from './flyout_item.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js';\nimport * as registry from './registry.js';\nimport {ButtonOrLabelInfo} from './utils/toolbox.js';\nconst LABEL_TYPE = 'label';\n\n/**\n * Class responsible for creating labels for flyouts.\n */\nexport class LabelFlyoutInflater implements IFlyoutInflater {\n  /**\n   * Inflates a flyout label from the given state and adds it to the flyout.\n   *\n   * @param state A JSON representation of a flyout label.\n   * @param flyout The flyout to create the label on.\n   * @returns A FlyoutButton configured as a label.\n   */\n  load(state: object, flyout: IFlyout): FlyoutItem {\n    const label = new FlyoutButton(\n      flyout.getWorkspace(),\n      flyout.targetWorkspace!,\n      state as ButtonOrLabelInfo,\n      true,\n    );\n    label.show();\n\n    return new FlyoutItem(label, LABEL_TYPE);\n  }\n\n  /**\n   * Returns the amount of space that should follow this label.\n   *\n   * @param state A JSON representation of a flyout label.\n   * @param defaultGap The default spacing for flyout items.\n   * @returns The amount of space that should follow this label.\n   */\n  gapForItem(state: object, defaultGap: number): number {\n    return defaultGap;\n  }\n\n  /**\n   * Disposes of the given label.\n   *\n   * @param item The flyout label to dispose of.\n   */\n  disposeItem(item: FlyoutItem): void {\n    const element = item.getElement();\n    if (element instanceof FlyoutButton) {\n      element.dispose();\n    }\n  }\n\n  /**\n   * Returns the type of items this inflater is responsible for creating.\n   *\n   * @returns An identifier for the type of items this inflater creates.\n   */\n  getType() {\n    return LABEL_TYPE;\n  }\n}\n\nregistry.register(\n  registry.Type.FLYOUT_INFLATER,\n  LABEL_TYPE,\n  LabelFlyoutInflater,\n);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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 type {Shape} from '../common/constants.js';\nimport {ConstantProvider as BaseConstantProvider} from '../common/constants.js';\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 */\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  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  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  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  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  /**\n   * Creates a new ConstantProvider.\n   *\n   * @param gridUnit If set, defines the base unit used to calculate other\n   *     constants.\n   */\n  constructor(gridUnit?: number) {\n    super();\n\n    if (gridUnit) {\n      this.GRID_UNIT = gridUnit;\n    }\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 = 6 * this.GRID_UNIT;\n\n    this.FIELD_COLOUR_DEFAULT_HEIGHT = 8 * 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 =\n      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 =\n      theme.getComponentStyle('selectedGlowColour') ||\n      this.SELECTED_GLOW_COLOUR;\n    const selectedGlowSize = Number(\n      theme.getComponentStyle('selectedGlowSize'),\n    );\n    this.SELECTED_GLOW_SIZE =\n      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 = Number(\n      theme.getComponentStyle('replacementGlowSize'),\n    );\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    // Height is actually the Y position of the control points defining the\n    // curve of the hat; the hat's actual rendered height is 3/4 of the control\n    // points' Y position, per https://stackoverflow.com/a/5327329\n    return {height: height * 0.75, 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   */\n  protected 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 (\n        svgPaths.lineTo(-direction * width, dy) +\n        svgPaths.lineTo(direction * width, dy)\n      );\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   */\n  protected 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,\n      up: boolean,\n      right: boolean,\n    ): string {\n      const remainingHeight =\n        blockHeight > maxHeight ? blockHeight - maxHeight : 0;\n      const height = blockHeight > maxHeight ? maxHeight : blockHeight;\n      const radius = height / 2;\n      const sweep = right === up ? '0' : '1';\n      return (\n        svgPaths.arc(\n          'a',\n          '0 0,' + sweep,\n          radius,\n          svgPaths.point((right ? 1 : -1) * radius, (up ? -1 : 1) * radius),\n        ) +\n        svgPaths.lineOnAxis('v', (up ? -1 : 1) * remainingHeight) +\n        svgPaths.arc(\n          'a',\n          '0 0,' + sweep,\n          radius,\n          svgPaths.point((right ? -1 : 1) * radius, (up ? -1 : 1) * radius),\n        )\n      );\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   */\n  protected 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      const sweep = right === up ? '0' : '1';\n      return (\n        svgPaths.arc(\n          'a',\n          '0 0,' + sweep,\n          radius,\n          svgPaths.point((right ? 1 : -1) * radius, (up ? -1 : 1) * radius),\n        ) +\n        svgPaths.lineOnAxis('v', (up ? -1 : 1) * innerHeight) +\n        svgPaths.arc(\n          'a',\n          '0 0,' + sweep,\n          radius,\n          svgPaths.point((right ? -1 : 1) * radius, (up ? -1 : 1) * radius),\n        )\n      );\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.includes('Boolean')) {\n          return this.HEXAGONAL!;\n        }\n        if (checks && checks.includes('Number')) {\n          return this.ROUNDED!;\n        }\n        if (checks && checks.includes('String')) {\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 (\n        svgPaths.curve('c', [\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        svgPaths.lineOnAxis('h', dir * innerWidth) +\n        svgPaths.curve('c', [\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\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 = svgPaths.arc(\n      'a',\n      '0 0,0',\n      radius,\n      svgPaths.point(-radius, radius),\n    );\n\n    const innerTopRightCorner = svgPaths.arc(\n      'a',\n      '0 0,1',\n      radius,\n      svgPaths.point(-radius, radius),\n    );\n\n    const innerBottomLeftCorner = svgPaths.arc(\n      'a',\n      '0 0,0',\n      radius,\n      svgPaths.point(radius, radius),\n    );\n\n    const innerBottomRightCorner = svgPaths.arc(\n      'a',\n      '0 0,1',\n      radius,\n      svgPaths.point(radius, radius),\n    );\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(\n    svg: SVGElement,\n    tagName: string,\n    selector: string,\n    injectionDivIfIsParent?: HTMLElement,\n  ) {\n    super.createDom(svg, tagName, selector, injectionDivIfIsParent);\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      {\n        'id': 'blocklySelectedGlowFilter' + this.randomIdentifier,\n        'height': '160%',\n        'width': '180%',\n        'y': '-30%',\n        'x': '-40%',\n      },\n      defs,\n    );\n    dom.createSvgElement(\n      Svg.FEGAUSSIANBLUR,\n      {'in': 'SourceGraphic', 'stdDeviation': this.SELECTED_GLOW_SIZE},\n      selectedGlowFilter,\n    );\n    // Set all gaussian blur pixels to 1 opacity before applying flood\n    const selectedComponentTransfer = dom.createSvgElement(\n      Svg.FECOMPONENTTRANSFER,\n      {'result': 'outBlur'},\n      selectedGlowFilter,\n    );\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    );\n    // Color the highlight\n    dom.createSvgElement(\n      Svg.FEFLOOD,\n      {\n        'flood-color': this.SELECTED_GLOW_COLOUR,\n        'flood-opacity': 1,\n        'result': 'outColor',\n      },\n      selectedGlowFilter,\n    );\n    dom.createSvgElement(\n      Svg.FECOMPOSITE,\n      {\n        'in': 'outColor',\n        'in2': 'outBlur',\n        'operator': 'in',\n        'result': 'outGlow',\n      },\n      selectedGlowFilter,\n    );\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      {\n        'id': 'blocklyReplacementGlowFilter' + this.randomIdentifier,\n        'height': '160%',\n        'width': '180%',\n        'y': '-30%',\n        'x': '-40%',\n      },\n      defs,\n    );\n    dom.createSvgElement(\n      Svg.FEGAUSSIANBLUR,\n      {'in': 'SourceGraphic', 'stdDeviation': this.REPLACEMENT_GLOW_SIZE},\n      replacementGlowFilter,\n    );\n    // Set all gaussian blur pixels to 1 opacity before applying flood\n    const replacementComponentTransfer = dom.createSvgElement(\n      Svg.FECOMPONENTTRANSFER,\n      {'result': 'outBlur'},\n      replacementGlowFilter,\n    );\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    );\n    // Color the highlight\n    dom.createSvgElement(\n      Svg.FEFLOOD,\n      {\n        'flood-color': this.REPLACEMENT_GLOW_COLOUR,\n        'flood-opacity': 1,\n        'result': 'outColor',\n      },\n      replacementGlowFilter,\n    );\n    dom.createSvgElement(\n      Svg.FECOMPOSITE,\n      {\n        'in': 'outColor',\n        'in2': 'outBlur',\n        'operator': 'in',\n        'result': 'outGlow',\n      },\n      replacementGlowFilter,\n    );\n    dom.createSvgElement(\n      Svg.FECOMPOSITE,\n      {\n        'in': 'SourceGraphic',\n        'in2': 'outGlow',\n        'operator': 'over',\n      },\n      replacementGlowFilter,\n    );\n    this.replacementGlowFilterId = replacementGlowFilter.id;\n    this.replacementGlowFilter = replacementGlowFilter;\n\n    if (injectionDivIfIsParent) {\n      // If this renderer is for the parent workspace, add CSS variables scoped\n      // to the injection div referencing the created patterns so that CSS can\n      // apply the patterns to any element in the injection div.\n      injectionDivIfIsParent.style.setProperty(\n        '--blocklySelectedGlowFilter',\n        `url(#${this.selectedGlowFilterId})`,\n      );\n      injectionDivIfIsParent.style.setProperty(\n        '--blocklyReplacementGlowFilter',\n        `url(#${this.replacementGlowFilterId})`,\n      );\n    }\n  }\n\n  override getCSS_(selector: string) {\n    return [\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      `${selector} .blocklyTextInputBubble textarea {`,\n      `font-weight: normal;`,\n      `}`,\n\n      // Fields.\n      `${selector} .blocklyText {`,\n      `fill: #fff;`,\n      `}`,\n      `${selector} .blocklyNonEditableField>rect:not(.blocklyDropdownRect),`,\n      `${selector} .blocklyEditableField>rect:not(.blocklyDropdownRect) {`,\n      `fill: ${this.FIELD_BORDER_RECT_COLOUR};`,\n      `}`,\n      `${selector} .blocklyNonEditableField>text,`,\n      `${selector} .blocklyEditableField>text,`,\n      `${selector} .blocklyNonEditableField>g>text,`,\n      `${selector} .blocklyEditableField>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      ` .blocklyEditableField:not(.blocklyEditing):hover>rect,`,\n      `${selector} .blocklyDraggable:not(.blocklyDisabled)`,\n      ` .blocklyEditableField:not(.blocklyEditing):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 .blocklyMenuItem,`,\n      `${selector}.blocklyDropDownDiv .blocklyMenuItem {`,\n      `font-family: ${this.FIELD_TEXT_FONTFAMILY};`,\n      `}`,\n      `${selector}.blocklyDropDownDiv .blocklyMenuItemContent {`,\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} .blocklyDisabledPattern > .blocklyOutlinePath {`,\n      `fill: var(--blocklyDisabledPattern)`,\n      `}`,\n\n      // Insertion marker.\n      `${selector} .blocklyInsertionMarker>.blocklyPath {`,\n      `fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,\n      `stroke: none;`,\n      `}`,\n\n      `${selector} .blocklySelected>.blocklyPath.blocklyPathSelected {`,\n      `fill: none;`,\n      `filter: var(--blocklySelectedGlowFilter);`,\n      `}`,\n\n      `${selector} .blocklyReplaceable>.blocklyPath {`,\n      `filter: var(--blocklyReplacementGlowFilter);`,\n      `}`,\n    ];\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.zelos.Drawer\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {ConnectionType} from '../../connection_type.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport type {BaseShape, DynamicShape, Notch} from '../common/constants.js';\nimport {Drawer as BaseDrawer} from '../common/drawer.js';\nimport {Connection} from '../measurables/connection.js';\nimport type {InlineInput} from '../measurables/inline_input.js';\nimport {OutputConnection} from '../measurables/output_connection.js';\nimport type {Row} from '../measurables/row.js';\nimport {Types} from '../measurables/types.js';\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 * An object that draws a block based on the given rendering information.\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   */\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.drawOutline_();\n    this.drawInternals_();\n    this.updateConnectionHighlights();\n\n    pathObject.setPath(this.outlinePath_ + '\\n' + this.inlinePath_);\n    if (this.info_.RTL) {\n      pathObject.flipRTL();\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 (\n      this.info_.outputConnection &&\n      this.info_.outputConnection.isDynamicShape &&\n      !this.info_.hasStatementInput &&\n      !this.info_.bottomRow.hasNextConnection\n    ) {\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 (\n      this.info_.outputConnection &&\n      this.info_.outputConnection.isDynamicShape\n    ) {\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 precedesStatement = row.precedesStatement;\n      const followsStatement = row.followsStatement;\n      if (precedesStatement || followsStatement) {\n        const insideCorners = this.constants_.INSIDE_CORNERS as InsideCorners;\n        const cornerHeight = insideCorners.rightHeight;\n        const remainingHeight =\n          row.height - (precedesStatement ? cornerHeight : 0);\n        const bottomRightPath = followsStatement\n          ? insideCorners.pathBottomRight\n          : '';\n        const verticalPath =\n          remainingHeight > 0\n            ? svgPaths.lineOnAxis('V', row.yPos + remainingHeight)\n            : '';\n        const topRightPath = precedesStatement\n          ? insideCorners.pathTopRight\n          : '';\n        // Put all of the partial paths together.\n        this.outlinePath_ += bottomRightPath + verticalPath + topRightPath;\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    }\n    this.outlinePath_ += (\n      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    }\n    this.positionOutputConnection_();\n\n    this.outlinePath_ += (\n      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    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    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 yPos = input.centerline - input.height / 2;\n    const connectionRight = input.xPos + input.connectionWidth;\n\n    const path =\n      svgPaths.moveTo(connectionRight, yPos) + this.getInlineInputPath(input);\n\n    const pathObject = this.block_.pathObject as PathObject;\n    pathObject.setOutlinePath(inputName, path);\n  }\n\n  private getInlineInputPath(input: InlineInput) {\n    const width = input.width - input.connectionWidth * 2;\n    const height = input.height;\n\n    return (\n      svgPaths.lineOnAxis('h', width) +\n      (input.shape as DynamicShape).pathRightDown(height) +\n      svgPaths.lineOnAxis('h', -width) +\n      (input.shape as DynamicShape).pathUp(height) +\n      'z'\n    );\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 insideCorners = this.constants_.INSIDE_CORNERS;\n    const innerTopLeftCorner =\n      (input.shape as Notch).pathRight +\n      svgPaths.lineOnAxis('h', -(input.notchOffset - insideCorners.width)) +\n      insideCorners.pathTop;\n\n    const innerHeight = row.height - 2 * insideCorners.height;\n\n    const innerBottomLeftCorner =\n      insideCorners.pathBottom +\n      svgPaths.lineOnAxis('h', input.notchOffset - insideCorners.width) +\n      (input.connectedBottomNextConnection\n        ? ''\n        : (input.shape as Notch).pathLeft);\n\n    this.outlinePath_ +=\n      svgPaths.lineOnAxis('H', x) +\n      innerTopLeftCorner +\n      svgPaths.lineOnAxis('v', innerHeight) +\n      innerBottomLeftCorner +\n      svgPaths.lineOnAxis('H', row.xPos + row.width);\n\n    this.positionStatementInputConnection_(row);\n  }\n\n  /** Returns a path to highlight the given connection. */\n  override drawConnectionHighlightPath(\n    measurable: Connection,\n  ): SVGElement | undefined {\n    const conn = measurable.connectionModel;\n    if (\n      conn.type === ConnectionType.NEXT_STATEMENT ||\n      conn.type === ConnectionType.PREVIOUS_STATEMENT ||\n      (conn.type === ConnectionType.OUTPUT_VALUE && !measurable.isDynamicShape)\n    ) {\n      return super.drawConnectionHighlightPath(measurable);\n    }\n\n    let path = '';\n    if (conn.type === ConnectionType.INPUT_VALUE) {\n      const input = measurable as InlineInput;\n      const xPos = input.connectionWidth;\n      const yPos = -input.height / 2;\n      path = svgPaths.moveTo(xPos, yPos) + this.getInlineInputPath(input);\n    } else {\n      // Dynamic output.\n      const output = measurable as OutputConnection;\n      const xPos = output.width;\n      const yPos = -output.height / 2;\n      path =\n        svgPaths.moveTo(xPos, yPos) +\n        (output.shape as DynamicShape).pathDown(output.height);\n    }\n    const block = conn.getSourceBlock();\n    return block.pathObject.addConnectionHighlight?.(\n      conn,\n      path,\n      conn.getOffsetInBlock(),\n      block.RTL,\n    );\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 */\n// Former goog.module ID: Blockly.FieldImage\n\nimport {Field, FieldConfig} 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 {Size} from './utils/size.js';\nimport {Svg} from './utils/svg.js';\n\n/**\n * Class for an image on a block.\n */\nexport class FieldImage extends Field<string> {\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 readonly imageHeight: number;\n\n  /** The function to be called when this field is clicked. */\n  private clickHandler: ((p1: FieldImage) => void) | null = null;\n\n  /** The rendered field's image element. */\n  protected imageElement: SVGImageElement | 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 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\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 alt Optional alt text for when block is collapsed.\n   * @param onClick Optional function to be called when the image is\n   *     clicked. If onClick is defined, alt must also be defined.\n   * @param flipRtl Whether to flip the icon in RTL.\n   * @param 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 | typeof Field.SKIP_SETUP,\n    width: string | number,\n    height: string | number,\n    alt?: string,\n    onClick?: (p1: FieldImage) => void,\n    flipRtl?: boolean,\n    config?: FieldImageConfig,\n  ) {\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' + ' numbers.',\n      );\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\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 onClick === 'function') {\n      this.clickHandler = onClick;\n    }\n\n    if (src === Field.SKIP_SETUP) return;\n\n    if (config) {\n      this.configure_(config);\n    } else {\n      this.flipRtl = !!flipRtl;\n      this.altText = parsing.replaceMessageReferences(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  override initView() {\n    this.imageElement = dom.createSvgElement(\n      Svg.IMAGE,\n      {\n        'height': this.imageHeight + 'px',\n        'width': this.size_.width + 'px',\n        'alt': this.altText,\n      },\n      this.fieldGroup_,\n    );\n    this.imageElement.setAttributeNS(\n      dom.XLINK_NS,\n      'xlink:href',\n      this.value_ as string,\n    );\n\n    if (this.fieldGroup_) {\n      dom.addClass(this.fieldGroup_, 'blocklyImageField');\n    }\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 newValue The input value.\n   * @returns A string, or null if invalid.\n   */\n  protected override doClassValidation_(newValue?: any): string | null {\n    if (typeof newValue !== 'string') {\n      return null;\n    }\n    return 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: string) {\n    this.value_ = newValue;\n    if (this.imageElement) {\n      this.imageElement.setAttributeNS(dom.XLINK_NS, 'xlink:href', 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   * Check whether this field should be clickable.\n   *\n   * @returns Whether this field is clickable.\n   */\n  isClickable(): boolean {\n    // Images are only clickable if they have a click handler and fulfill the\n    // contract to be clickable: enabled and attached to an editable block.\n    return super.isClickable() && !!this.clickHandler;\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) => void) | 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 override 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    }\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,\n      options.width,\n      options.height,\n      undefined,\n      undefined,\n      undefined,\n      options,\n    );\n  }\n}\n\nfieldRegistry.register('field_image', FieldImage);\n\nFieldImage.prototype.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 image 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 */\n// Former goog.module ID: Blockly.FieldInput\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 bumpObjects from './bump_objects.js';\nimport * as dialog from './dialog.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {EventType} from './events/type.js';\nimport * as eventUtils from './events/utils.js';\nimport {\n  Field,\n  FieldConfig,\n  FieldValidator,\n  UnattachedFieldError,\n} from './field.js';\nimport {getFocusManager} from './focus_manager.js';\nimport type {IFocusableNode} from './interfaces/i_focusable_node.js';\nimport {Msg} from './msg.js';\nimport * as renderManagement from './render_management.js';\nimport * as aria from './utils/aria.js';\nimport * as dom from './utils/dom.js';\nimport {Size} from './utils/size.js';\nimport * as userAgent from './utils/useragent.js';\nimport * as WidgetDiv from './widgetdiv.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Supported types for FieldInput subclasses.\n *\n * @internal\n */\ntype InputTypes = string | number;\n\n/**\n * The minimum width of an input field.\n */\nconst MINIMUM_WIDTH = 14;\n\n/**\n * Abstract class for an editable input field.\n *\n * @typeParam T - The value stored on the field.\n * @internal\n */\nexport abstract class FieldInput<T extends InputTypes> extends Field<\n  string | T\n> {\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  /**\n   * The intial value of the field when the user opened an editor to change its\n   * value. When the editor is disposed, an event will be fired that uses this\n   * as the event's oldValue.\n   */\n  protected valueWhenEditorWasOpened_: string | T | null = null;\n\n  /** Key down event data. */\n  private onKeyDownWrapper: browserEvents.Data | null = null;\n\n  /** Input element input event data. */\n  private onInputWrapper: 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 = 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  protected override set size_(newValue: Size) {\n    // Although this appears to be a no-op, it must exist since the getter is\n    // overridden below.\n    super.size_ = newValue;\n  }\n\n  /**\n   * Returns the size of this field, with a minimum width of 14.\n   */\n  protected override get size_() {\n    const s = super.size_;\n    if (s.width < MINIMUM_WIDTH) {\n      s.width = MINIMUM_WIDTH;\n    }\n\n    return s;\n  }\n\n  /**\n   * @param 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 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 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    value?: string | typeof Field.SKIP_SETUP,\n    validator?: FieldInputValidator<T> | null,\n    config?: FieldInputConfig,\n  ) {\n    super(Field.SKIP_SETUP);\n\n    if (value === Field.SKIP_SETUP) return;\n    if (config) {\n      this.configure_(config);\n    }\n    this.setValue(value);\n    if (validator) {\n      this.setValidator(validator);\n    }\n  }\n\n  protected override configure_(config: FieldInputConfig) {\n    super.configure_(config);\n    if (config.spellcheck !== undefined) {\n      this.spellcheck_ = config.spellcheck;\n    }\n  }\n\n  override initView() {\n    const block = this.getSourceBlock();\n    if (!block) throw new UnattachedFieldError();\n    super.initView();\n\n    if (this.isFullBlockField()) {\n      this.clickTarget_ = (this.sourceBlock_ as BlockSvg).getSvgRoot();\n    }\n\n    if (this.fieldGroup_) {\n      dom.addClass(this.fieldGroup_, 'blocklyInputField');\n    }\n  }\n\n  override isFullBlockField(): boolean {\n    const block = this.getSourceBlock();\n    if (!block) throw new UnattachedFieldError();\n\n    // Side effect for backwards compatibility.\n    this.fullBlockClickTarget_ =\n      !!this.getConstants()?.FULL_BLOCK_FIELDS && block.isSimpleReporter();\n    return this.fullBlockClickTarget_;\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   * @param fireChangeEvent Whether to fire a change event if the value changes.\n   */\n  protected override doValueInvalid_(\n    _invalidValue: AnyDuringMigration,\n    fireChangeEvent: boolean = true,\n  ) {\n    if (this.isBeingEdited_) {\n      this.isDirty_ = true;\n      this.isTextValid_ = false;\n      const oldValue = this.value_;\n      // Revert value when the text becomes invalid.\n      this.value_ = this.valueWhenEditorWasOpened_;\n      if (\n        this.sourceBlock_ &&\n        eventUtils.isEnabled() &&\n        this.value_ !== oldValue &&\n        fireChangeEvent\n      ) {\n        eventUtils.fire(\n          new (eventUtils.get(EventType.BLOCK_CHANGE))(\n            this.sourceBlock_,\n            'field',\n            this.name || null,\n            oldValue,\n            this.value_,\n          ),\n        );\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: string | T) {\n    this.isDirty_ = true;\n    this.isTextValid_ = true;\n    this.value_ = newValue;\n  }\n\n  /**\n   * Updates text field to match the colour/style of the block.\n   */\n  override applyColour() {\n    const block = this.getSourceBlock() as BlockSvg | null;\n    if (!block) throw new UnattachedFieldError();\n\n    if (!this.getConstants()!.FULL_BLOCK_FIELDS) return;\n    if (!this.fieldGroup_) return;\n\n    if (!this.isFullBlockField() && this.borderRect_) {\n      this.borderRect_!.style.display = 'block';\n      this.borderRect_.setAttribute('stroke', block.getColourTertiary());\n    } else {\n      this.borderRect_!.style.display = 'none';\n      // In general, do *not* let fields control the color of blocks. Having the\n      // field control the color is unexpected, and could have performance\n      // impacts.\n      block.pathObject.svgPath.setAttribute(\n        'fill',\n        this.getConstants()!.FIELD_BORDER_RECT_COLOUR,\n      );\n    }\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  override getSize(): Size {\n    if (this.getConstants()?.FULL_BLOCK_FIELDS) {\n      // In general, do *not* let fields control the color of blocks. Having the\n      // field control the color is unexpected, and could have performance\n      // impacts.\n      // Full block fields have more control of the block than they should\n      // (i.e. updating fill colour). Whenever we get the size, the field may\n      // no longer be a full-block field, so we need to rerender.\n      this.render_();\n      this.isDirty_ = false;\n    }\n    return super.getSize();\n  }\n\n  /**\n   * Notifies the field that it has changed locations. Moves the widget div to\n   * be in the correct place if it is open.\n   */\n  onLocationChange(): void {\n    if (this.isBeingEdited_) this.resizeEditor_();\n  }\n\n  /**\n   * Updates the colour of the htmlInput given the current validity of the\n   * field's value.\n   *\n   * Also updates the colour of the block to reflect whether this is a full\n   * block field or not.\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      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    const block = this.getSourceBlock() as BlockSvg | null;\n    if (!block) throw new UnattachedFieldError();\n    // In general, do *not* let fields control the color of blocks. Having the\n    // field control the color is unexpected, and could have performance\n    // impacts.\n    // Whenever we render, the field may no longer be a full-block-field so\n    // we need to update the colour.\n    if (this.getConstants()!.FULL_BLOCK_FIELDS) block.applyColour();\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',\n        this.spellcheck_ as AnyDuringMigration,\n      );\n    }\n  }\n\n  /**\n   * Show an editor for the field.\n   * Shows the inline free-text editor on top of the text by default.\n   * Shows a prompt editor for mobile browsers if the modalInputs option is\n   * enabled.\n   *\n   * @param _e Optional mouse event that triggered the field to open, or\n   *     undefined if triggered programmatically.\n   * @param quietInput True if editor should be created without focus.\n   *     Defaults to false.\n   * @param manageEphemeralFocus Whether ephemeral focus should be managed as\n   *     part of the editor's inline editor (when the inline editor is shown).\n   *     Callers must manage ephemeral focus themselves if this is false.\n   *     Defaults to true.\n   */\n  protected override showEditor_(\n    _e?: Event,\n    quietInput = false,\n    manageEphemeralFocus: boolean = true,\n  ) {\n    this.workspace_ = (this.sourceBlock_ as BlockSvg).workspace;\n    if (\n      !quietInput &&\n      this.workspace_.options.modalInputs &&\n      (userAgent.MOBILE || userAgent.ANDROID || userAgent.IPAD)\n    ) {\n      this.showPromptEditor();\n    } else {\n      this.showInlineEditor(quietInput, manageEphemeralFocus);\n    }\n  }\n\n  /**\n   * Create and show a text input editor that is a prompt (usually a popup).\n   * Mobile browsers may have issues with in-line textareas (focus and\n   * keyboards).\n   */\n  private showPromptEditor() {\n    dialog.prompt(\n      Msg['CHANGE_VALUE_TITLE'],\n      this.getText(),\n      (text: string | null) => {\n        // Text is null if user pressed cancel button.\n        if (text !== null) {\n          this.setValue(this.getValueFromEditorText_(text));\n        }\n        this.onFinishEditing_(this.value_);\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   * @param manageEphemeralFocus Whether ephemeral focus should be managed as\n   *     part of the field's inline editor (widget div).\n   */\n  private showInlineEditor(quietInput: boolean, manageEphemeralFocus: boolean) {\n    const block = this.getSourceBlock();\n    if (!block) {\n      throw new UnattachedFieldError();\n    }\n    WidgetDiv.show(\n      this,\n      block.RTL,\n      this.widgetDispose_.bind(this),\n      this.workspace_,\n      manageEphemeralFocus,\n    );\n    this.htmlInput_ = this.widgetCreate_() as HTMLInputElement;\n    this.isBeingEdited_ = true;\n    this.valueWhenEditorWasOpened_ = this.value_;\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_(): HTMLInputElement | HTMLTextAreaElement {\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, 'blocklyEditing');\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',\n      this.spellcheck_ as AnyDuringMigration,\n    );\n    const scale = this.workspace_!.getAbsoluteScale();\n    const fontSize = this.getConstants()!.FIELD_TEXT_FONTSIZE * scale + 'pt';\n    div!.style.fontSize = fontSize;\n    htmlInput.style.fontSize = fontSize;\n    let borderRadius = FieldInput.BORDERRADIUS * scale + 'px';\n\n    if (this.isFullBlockField()) {\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).getColourTertiary()\n        : (this.sourceBlock_ as BlockSvg).getColourTertiary();\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', String(this.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\n    if (\n      this.sourceBlock_ &&\n      eventUtils.isEnabled() &&\n      this.valueWhenEditorWasOpened_ !== null &&\n      this.valueWhenEditorWasOpened_ !== this.value_\n    ) {\n      // When closing a field input widget, fire an event indicating that the\n      // user has completed a sequence of changes. The value may have changed\n      // multiple times while the editor was open, but this will fire an event\n      // containing the value when the editor was opened as well as the new one.\n      eventUtils.fire(\n        new (eventUtils.get(EventType.BLOCK_CHANGE))(\n          this.sourceBlock_,\n          'field',\n          this.name || null,\n          this.valueWhenEditorWasOpened_,\n          this.value_,\n        ),\n      );\n      this.valueWhenEditorWasOpened_ = null;\n    }\n\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, 'blocklyEditing');\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\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,\n      'keydown',\n      this,\n      this.onHtmlInputKeyDown_,\n    );\n    // Resize after every input change.\n    this.onInputWrapper = browserEvents.conditionalBind(\n      htmlInput,\n      'input',\n      this,\n      this.onHtmlInputChange,\n    );\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.onInputWrapper) {\n      browserEvents.unbind(this.onInputWrapper);\n      this.onInputWrapper = null;\n    }\n  }\n\n  /**\n   * Handle key down to the editor.\n   *\n   * @param e Keyboard event.\n   */\n  protected onHtmlInputKeyDown_(e: KeyboardEvent) {\n    if (e.key === 'Enter') {\n      WidgetDiv.hideIfOwner(this);\n      dropDownDiv.hideWithoutAnimation();\n    } else if (e.key === 'Escape') {\n      this.setValue(\n        this.htmlInput_!.getAttribute('data-untyped-default-value'),\n        false,\n      );\n      WidgetDiv.hideIfOwner(this);\n      dropDownDiv.hideWithoutAnimation();\n    } else if (e.key === 'Tab') {\n      e.preventDefault();\n      const cursor = this.workspace_?.getCursor();\n\n      const isValidDestination = (node: IFocusableNode | null) =>\n        (node instanceof FieldInput ||\n          (node instanceof BlockSvg && node.isSimpleReporter())) &&\n        node !== this.getSourceBlock();\n\n      let target = e.shiftKey\n        ? cursor?.getPreviousNode(this, isValidDestination, false)\n        : cursor?.getNextNode(this, isValidDestination, false);\n      target =\n        target instanceof BlockSvg && target.isSimpleReporter()\n          ? target.getFields().next().value\n          : target;\n\n      if (target instanceof FieldInput) {\n        WidgetDiv.hideIfOwner(this);\n        dropDownDiv.hideWithoutAnimation();\n        const targetSourceBlock = target.getSourceBlock();\n        if (\n          target.isFullBlockField() &&\n          targetSourceBlock &&\n          targetSourceBlock instanceof BlockSvg\n        ) {\n          getFocusManager().focusNode(targetSourceBlock);\n        } else getFocusManager().focusNode(target);\n        target.showEditor();\n      }\n    }\n  }\n\n  /**\n   * Handle a change to the editor.\n   *\n   * @param _e InputEvent.\n   */\n  private onHtmlInputChange(_e: Event) {\n    // Intermediate value changes from user input are not confirmed until the\n    // user closes the editor, and may be numerous. Inhibit reporting these as\n    // normal block change events, and instead report them as special\n    // intermediate changes that do not get recorded in undo history.\n    const oldValue = this.value_;\n    // Change the field's value without firing the normal change event.\n    this.setValue(\n      this.getValueFromEditorText_(this.htmlInput_!.value),\n      /* fireChangeEvent= */ false,\n    );\n    if (\n      this.sourceBlock_ &&\n      eventUtils.isEnabled() &&\n      this.value_ !== oldValue\n    ) {\n      // Fire a special event indicating that the value changed but the change\n      // isn't complete yet and normal field change listeners can wait.\n      eventUtils.fire(\n        new (eventUtils.get(EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE))(\n          this.sourceBlock_,\n          this.name || null,\n          oldValue,\n          this.value_,\n        ),\n      );\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   * @param fireChangeEvent Whether to fire a change event. Defaults to true.\n   *     Should usually be true unless the change will be reported some other\n   *     way, e.g. an intermediate field change event.\n   */\n  protected setEditorValue_(\n    newValue: AnyDuringMigration,\n    fireChangeEvent = true,\n  ) {\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, fireChangeEvent);\n  }\n\n  /** Resize the editor to fit the text. */\n  protected resizeEditor_() {\n    renderManagement.finishQueuedRenders().then(() => {\n      const block = this.getSourceBlock();\n      if (!block) throw new UnattachedFieldError();\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 y = bBox.top;\n\n      div!.style.left = `${x}px`;\n      div!.style.top = `${y}px`;\n    });\n  }\n\n  /**\n   * Handles repositioning the WidgetDiv used for input fields when the\n   * workspace is resized. Will bump the block into the viewport and update the\n   * position of the text input if necessary.\n   *\n   * @returns True for rendered workspaces, as we never want to hide the widget\n   *     div.\n   */\n  override repositionForWindowResize(): boolean {\n    const block = this.getSourceBlock()?.getRootBlock();\n    // This shouldn't be possible. We should never have a WidgetDiv if not using\n    // rendered blocks.\n    if (!(block instanceof BlockSvg)) return false;\n\n    const bumped = bumpObjects.bumpIntoBounds(\n      this.workspace_!,\n      this.workspace_!.getMetricsManager().getViewMetrics(true),\n      block,\n    );\n\n    if (!bumped) this.resizeEditor_();\n\n    return true;\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 xMargin x offset to use when positioning the text element.\n   * @param contentWidth The content width.\n   */\n  protected override positionTextElement_(\n    xMargin: number,\n    contentWidth: number,\n  ) {\n    const effectiveWidth = xMargin * 2 + contentWidth;\n    const delta =\n      effectiveWidth < MINIMUM_WIDTH ? (MINIMUM_WIDTH - effectiveWidth) / 2 : 0;\n    super.positionTextElement_(xMargin + delta, contentWidth);\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 `${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/**\n * Config options for the input field.\n *\n * @internal\n */\nexport interface FieldInputConfig extends FieldConfig {\n  spellcheck?: boolean;\n}\n\n/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n * @internal\n */\nexport type FieldInputValidator<T extends InputTypes> = FieldValidator<\n  string | T\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 */\n// Former goog.module ID: Blockly.FieldTextInput\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport {Field} from './field.js';\nimport {\n  FieldInput,\n  FieldInputConfig,\n  FieldInputValidator,\n} from './field_input.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as dom from './utils/dom.js';\nimport * as parsing from './utils/parsing.js';\n\n/**\n * Class for an editable text field.\n */\nexport class FieldTextInput extends FieldInput<string> {\n  /**\n   * @param 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 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 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    value?: string | typeof Field.SKIP_SETUP,\n    validator?: FieldTextInputValidator | null,\n    config?: FieldTextInputConfig,\n  ) {\n    super(value, validator, config);\n  }\n\n  override initView() {\n    super.initView();\n    if (this.fieldGroup_) {\n      dom.addClass(this.fieldGroup_, 'blocklyTextInputField');\n    }\n  }\n\n  /**\n   * Ensure that the input value casts to a valid string.\n   *\n   * @param newValue The input value.\n   * @returns A valid string, or null if invalid.\n   */\n  protected override doClassValidation_(\n    newValue?: AnyDuringMigration,\n  ): string | null {\n    if (newValue === undefined) {\n      return null;\n    }\n    return `${newValue}`;\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 override fromJson(\n    options: FieldTextInputFromJsonConfig,\n  ): 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\nFieldTextInput.prototype.DEFAULT_VALUE = '';\n\n/**\n *  Config options for the text input field.\n */\nexport type FieldTextInputConfig = FieldInputConfig;\n\n/**\n * fromJson config options for the text input field.\n */\nexport interface FieldTextInputFromJsonConfig extends FieldTextInputConfig {\n  text?: string;\n}\n\n/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldTextInputValidator = FieldInputValidator<string>;\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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 * 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 */\nexport class BottomRow extends BaseBottomRow {\n  /**\n   * @param constants The rendering constants provider.\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 (\n      !!block.outputConnection &&\n      !block.statementInputCount &&\n      !block.nextConnection\n    );\n  }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.zelos.StatementInput\n\nimport type {Input} from '../../../inputs/input.js';\nimport type {ConstantProvider} from '../../../renderers/common/constants.js';\nimport {StatementInput as BaseStatementInput} from '../../../renderers/measurables/statement_input.js';\n\n/**\n * An object containing information about the space a statement input takes up\n * during rendering.\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   */\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// Former goog.module ID: 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 * An object containing information about the space a right connection shape\n * takes up during rendering.\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   */\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// Former goog.module ID: 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 * 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 */\nexport class TopRow extends BaseTopRow {\n  /**\n   * @param constants The rendering constants provider.\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 &&\n      !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 (\n      !!block.outputConnection &&\n      !block.statementInputCount &&\n      !block.nextConnection\n    );\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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} from '../../inputs/align.js';\nimport {DummyInput} from '../../inputs/dummy_input.js';\nimport {EndRowInput} from '../../inputs/end_row_input.js';\nimport {Input} from '../../inputs/input.js';\nimport {StatementInput} from '../../inputs/statement_input.js';\nimport {ValueInput} from '../../inputs/value_input.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 type {Row} from '../measurables/row.js';\nimport type {SpacerRow} from '../measurables/spacer_row.js';\nimport {Types} from '../measurables/types.js';\nimport type {ConstantProvider, InsideCorners} from './constants.js';\nimport {BottomRow} from './measurables/bottom_row.js';\nimport {StatementInput as StatementInputMeasurable} 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 * 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 */\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   */\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   */\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_(currInput: Input, prevInput: 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 (!prevInput) {\n      return false;\n    }\n    // If the previous input was an end-row input, then any following input\n    // should always be rendered on the next row.\n    if (prevInput instanceof EndRowInput) {\n      return true;\n    }\n    // A statement input or an input following one always gets a new row.\n    if (\n      currInput instanceof StatementInput ||\n      prevInput instanceof StatementInput\n    ) {\n      return true;\n    }\n    // Value, dummy, and end-row inputs get new row if inputs are not inlined.\n    if (\n      currInput instanceof ValueInput ||\n      currInput instanceof DummyInput ||\n      currInput instanceof EndRowInput\n    ) {\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_(\n    prev: Measurable | null,\n    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 (\n        this.outputConnection &&\n        this.outputConnection.isDynamicShape &&\n        !this.hasStatementInput &&\n        !this.bottomRow.hasNextConnection\n      ) {\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\n    // No space after zero-width fields.\n    if (prev && Types.isField(prev) && prev.width === 0) {\n      return this.constants_.NO_PADDING;\n    }\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      if (\n        !prev.hasPreviousConnection &&\n        (!this.outputConnection || this.hasStatementInput)\n      ) {\n        return Math.abs(\n          this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS,\n        );\n      }\n      return this.constants_.NO_PADDING;\n    }\n    if (Types.isBottomRow(next)) {\n      if (!this.outputConnection) {\n        const topHeight =\n          Math.max(\n            this.topRow.minHeight,\n            Math.max(\n              this.constants_.NOTCH_HEIGHT,\n              this.constants_.CORNER_RADIUS,\n            ),\n          ) - this.constants_.CORNER_RADIUS;\n        return topHeight;\n      } else if (!next.hasNextConnection && this.hasStatementInput) {\n        return Math.abs(\n          this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS,\n        );\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 (\n      (Types.isInputRow(prev) && prev.hasStatement) ||\n      (Types.isInputRow(next) && next.hasStatement)\n    ) {\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 (\n      row.hasStatement &&\n      !Types.isSpacer(elem) &&\n      !Types.isStatementInput(elem)\n    ) {\n      return row.yPos + this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT / 2;\n    }\n    if (Types.isInlineInput(elem)) {\n      const connectedBlock = elem.connectedBlock;\n      if (\n        connectedBlock &&\n        connectedBlock.outputConnection &&\n        connectedBlock.nextConnection\n      ) {\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. An end-row input after a dummy input also counts.\n    if (\n      (input instanceof DummyInput || input instanceof EndRowInput) &&\n      activeRow.hasDummyInput &&\n      activeRow.align === Align.LEFT &&\n      input.align === Align.RIGHT\n    ) {\n      this.rightAlignedDummyInputs.set(activeRow, input);\n    } else if (input instanceof StatementInput) {\n      // Handle statements without next connections correctly.\n      activeRow.elements.push(\n        new StatementInputMeasurable(this.constants_, input),\n      );\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 (\n          Types.isField(elem) &&\n          elem.parentInput === this.rightAlignedDummyInputs.get(row)\n        ) {\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 =\n        i === 2\n          ? !!this.topRow.hasPreviousConnection\n          : !!prevSpacer.followsStatement;\n      const hasNextNotch =\n        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 &&\n        (i === 2 || hasNextNotch) &&\n        Types.isInputRow(row) &&\n        !row.hasStatement\n      ) {\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 (\n              xCursor < minXPos &&\n              !(\n                Types.isField(elem) &&\n                (elem.field instanceof FieldLabel ||\n                  elem.field instanceof FieldImage)\n              )\n            ) {\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 (\n      !('isDynamic' in outputConnectionShape && outputConnectionShape.isDynamic)\n    ) {\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 (\n      !this.outputConnection ||\n      this.hasStatementInput ||\n      this.bottomRow.hasNextConnection\n    ) {\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.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)) {\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 (\n        connectedBlock &&\n        connectedBlock.outputConnection &&\n        (connectedBlock.statementInputCount || connectedBlock.nextConnection)\n      ) {\n        return 0;\n      }\n      // Special case for hexagonal output.\n      if (\n        outerShape === constants.SHAPES.HEXAGONAL &&\n        outerShape !== innerShape\n      ) {\n        return 0;\n      }\n      return (\n        connectionWidth -\n        this.constants_.SHAPE_IN_SHAPE_PADDING[outerShape][innerShape]\n      );\n    } else if (Types.isField(elem)) {\n      // Special case for text inputs.\n      if (\n        outerShape === constants.SHAPES.ROUND &&\n        elem.field instanceof FieldTextInput\n      ) {\n        return connectionWidth - 2.75 * constants.GRID_UNIT;\n      }\n      return (\n        connectionWidth - this.constants_.SHAPE_IN_SHAPE_PADDING[outerShape][0]\n      );\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\n        ? !!this.topRow.hasPreviousConnection\n        : !!prevSpacer.followsStatement;\n      const hasNextNotch =\n        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 =\n          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 (\n              Types.isInlineInput(elem) &&\n              elem.connectedBlock &&\n              !elem.connectedBlock.isShadow() &&\n              elem.connectedBlock.getHeightWidth().height >=\n                minVerticalTightNestingHeight\n            ) {\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// Former goog.module ID: Blockly.zelos.PathObject\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {Connection} from '../../connection.js';\nimport {FocusManager} from '../../focus_manager.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';\nimport type {ConstantProvider} from './constants.js';\n\n/**\n * An object that handles creating and setting each of the SVG elements\n * used by the renderer.\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  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   */\n  constructor(\n    root: SVGElement,\n    style: BlockStyle,\n    constants: ConstantProvider,\n  ) {\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      this.svgPath.setAttribute('stroke', parent.getColourTertiary());\n    }\n\n    // Apply colour to outlines.\n    for (const outline of this.outlines.values()) {\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.classList.add('blocklyPathSelected');\n        // Ensure focus-specific properties don't overlap with the block's path.\n        dom.removeClass(\n          this.svgPathSelected,\n          FocusManager.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME,\n        );\n        dom.removeClass(\n          this.svgPathSelected,\n          FocusManager.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME,\n        );\n        this.svgPathSelected.removeAttribute('tabindex');\n        this.svgPathSelected.removeAttribute('id');\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  }\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',\n        'url(#' + this.constants.replacementGlowFilterId + ')',\n      );\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  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  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   */\n  setOutlinePath(name: string, pathString: string) {\n    const outline = this.getOutlinePath(name);\n    outline.setAttribute('d', pathString);\n    outline.setAttribute('fill', this.style.colourTertiary);\n  }\n\n  /**\n   * Create's an outline path for the specified input.\n   *\n   * @internal\n   * @param name The input name.\n   * @returns The SVG outline path.\n   */\n  getOutlinePath(name: string): SVGElement {\n    if (!this.outlines.has(name)) {\n      this.outlines.set(\n        name,\n        dom.createSvgElement(\n          Svg.PATH,\n          {\n            'class': 'blocklyOutlinePath', // IE doesn't like paths without the\n            // data definition, set empty\n            // default\n            'd': '',\n          },\n          this.svgRoot,\n        ),\n      );\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// Former goog.module ID: Blockly.zelos.Renderer\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {BlockStyle} 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';\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {RenderInfo} from './info.js';\nimport {PathObject} from './path_object.js';\n\n/**\n * The zelos renderer. This renderer emulates Scratch-style and MakeCode-style\n * rendering.\n *\n * Zelos is the ancient Greek spirit of rivalry and emulation.\n */\nexport class Renderer extends BaseRenderer {\n  protected override constants_!: ConstantProvider;\n\n  /**\n   * @param name The renderer name.\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_(\n    block: BlockSvg,\n    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   */\n  override makePathObject(root: SVGElement, style: BlockStyle): PathObject {\n    return new PathObject(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\nblockRendering.register('zelos', Renderer);\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BlockSvg} from './block_svg.js';\nimport {ConnectionType} from './connection_type.js';\nimport * as eventUtils from './events/utils.js';\nimport {IConnectionPreviewer} from './interfaces/i_connection_previewer.js';\nimport * as registry from './registry.js';\nimport * as renderManagement from './render_management.js';\nimport {RenderedConnection} from './rendered_connection.js';\nimport {Renderer as ZelosRenderer} from './renderers/zelos/renderer.js';\nimport * as blocks from './serialization/blocks.js';\nimport {WorkspaceSvg} from './workspace_svg.js';\n\nexport class InsertionMarkerPreviewer implements IConnectionPreviewer {\n  private readonly workspace: WorkspaceSvg;\n\n  private fadedBlock: BlockSvg | null = null;\n\n  private markerConn: RenderedConnection | null = null;\n\n  private draggedConn: RenderedConnection | null = null;\n\n  private staticConn: RenderedConnection | null = null;\n\n  constructor(draggedBlock: BlockSvg) {\n    this.workspace = draggedBlock.workspace;\n  }\n\n  /**\n   * Display a connection preview where the draggedCon connects to the\n   * staticCon, replacing the replacedBlock (currently connected to the\n   * staticCon).\n   *\n   * @param draggedConn The connection on the block stack being dragged.\n   * @param staticConn The connection not being dragged that we are\n   *     connecting to.\n   * @param replacedBlock The block currently connected to the staticCon that\n   *     is being replaced.\n   */\n  previewReplacement(\n    draggedConn: RenderedConnection,\n    staticConn: RenderedConnection,\n    replacedBlock: BlockSvg,\n  ) {\n    eventUtils.disable();\n    try {\n      this.hidePreview();\n      this.fadedBlock = replacedBlock;\n      replacedBlock.fadeForReplacement(true);\n      if (this.workspace.getRenderer().shouldHighlightConnection(staticConn)) {\n        staticConn.highlight();\n        this.staticConn = staticConn;\n      }\n    } finally {\n      eventUtils.enable();\n    }\n  }\n\n  /**\n   * Display a connection preview where the draggedCon connects to the\n   * staticCon, and no block is being relaced.\n   *\n   * @param draggedConn The connection on the block stack being dragged.\n   * @param staticConn The connection not being dragged that we are\n   *     connecting to.\n   */\n  previewConnection(\n    draggedConn: RenderedConnection,\n    staticConn: RenderedConnection,\n  ) {\n    if (draggedConn === this.draggedConn && staticConn === this.staticConn) {\n      return;\n    }\n\n    eventUtils.disable();\n    try {\n      this.hidePreview();\n\n      // TODO(7898): Instead of special casing, we should change the dragger to\n      //   track the change in distance between the dragged connection and the\n      //   static connection, so that it doesn't disconnect  unless that\n      //   (+ a bit) has been exceeded.\n      if (this.shouldUseMarkerPreview(draggedConn, staticConn)) {\n        this.markerConn = this.previewMarker(draggedConn, staticConn);\n      }\n\n      if (this.workspace.getRenderer().shouldHighlightConnection(staticConn)) {\n        staticConn.highlight();\n      }\n\n      this.draggedConn = draggedConn;\n      this.staticConn = staticConn;\n    } finally {\n      eventUtils.enable();\n    }\n  }\n\n  private shouldUseMarkerPreview(\n    _draggedConn: RenderedConnection,\n    staticConn: RenderedConnection,\n  ): boolean {\n    return (\n      staticConn.type === ConnectionType.PREVIOUS_STATEMENT ||\n      staticConn.type === ConnectionType.NEXT_STATEMENT ||\n      !(this.workspace.getRenderer() instanceof ZelosRenderer)\n    );\n  }\n\n  private previewMarker(\n    draggedConn: RenderedConnection,\n    staticConn: RenderedConnection,\n  ): RenderedConnection | null {\n    const dragged = draggedConn.getSourceBlock();\n    const marker = this.createInsertionMarker(dragged);\n    const markerConn = this.getMatchingConnection(dragged, marker, draggedConn);\n    if (!markerConn) return null;\n\n    // Render disconnected from everything else so that we have a valid\n    // connection location.\n    marker.queueRender();\n    renderManagement.triggerQueuedRenders();\n\n    // Connect() also renders the insertion marker.\n    markerConn.connect(staticConn);\n\n    const originalOffsetToTarget = {\n      x: staticConn.x - markerConn.x,\n      y: staticConn.y - markerConn.y,\n    };\n    const originalOffsetInBlock = markerConn.getOffsetInBlock().clone();\n    renderManagement.finishQueuedRenders().then(() => {\n      if (marker.isDeadOrDying()) return;\n      eventUtils.disable();\n      try {\n        // Position so that the existing block doesn't move.\n        marker?.positionNearConnection(\n          markerConn,\n          originalOffsetToTarget,\n          originalOffsetInBlock,\n        );\n        marker?.getSvgRoot().setAttribute('visibility', 'visible');\n      } finally {\n        eventUtils.enable();\n      }\n    });\n    return markerConn;\n  }\n\n  /**\n   * Transforms the given block into a JSON representation used to construct an\n   * insertion marker.\n   *\n   * @param block The block to serialize and use as an insertion marker.\n   * @returns A JSON-formatted string corresponding to a serialized\n   *     representation of the given block suitable for use as an insertion\n   *     marker.\n   */\n  protected serializeBlockToInsertionMarker(block: BlockSvg) {\n    const blockJson = blocks.save(block, {\n      addCoordinates: false,\n      addInputBlocks: false,\n      addNextBlocks: false,\n      doFullSerialization: false,\n    });\n\n    if (!blockJson) {\n      throw new Error(\n        `Failed to serialize source block. ${block.toDevString()}`,\n      );\n    }\n\n    return blockJson;\n  }\n\n  private createInsertionMarker(origBlock: BlockSvg) {\n    const blockJson = this.serializeBlockToInsertionMarker(origBlock);\n    const result = blocks.append(blockJson, this.workspace) as BlockSvg;\n\n    // Turn shadow blocks that are created programmatically during\n    // initalization to insertion markers too.\n    for (const block of result.getDescendants(false)) {\n      block.setInsertionMarker(true);\n    }\n\n    result.initSvg();\n    result.getSvgRoot().setAttribute('visibility', 'hidden');\n    return result;\n  }\n\n  /**\n   * Gets the connection on the marker block that matches the original\n   * connection on the original block.\n   *\n   * @param orig The original block.\n   * @param marker The marker block (where we want to find the matching\n   *     connection).\n   * @param origConn The original connection.\n   */\n  private getMatchingConnection(\n    orig: BlockSvg,\n    marker: BlockSvg,\n    origConn: RenderedConnection,\n  ): RenderedConnection | null {\n    const origConns = orig.getConnections_(true);\n    const markerConns = marker.getConnections_(true);\n    if (origConns.length !== markerConns.length) return null;\n    for (let i = 0; i < origConns.length; i++) {\n      if (origConns[i] === origConn) {\n        return markerConns[i];\n      }\n    }\n    return null;\n  }\n\n  /** Hide any previews that are currently displayed. */\n  hidePreview() {\n    eventUtils.disable();\n    try {\n      if (this.staticConn) {\n        this.staticConn.unhighlight();\n        this.staticConn = null;\n      }\n      if (this.fadedBlock) {\n        this.fadedBlock.fadeForReplacement(false);\n        this.fadedBlock = null;\n      }\n      if (this.markerConn) {\n        this.hideInsertionMarker(this.markerConn);\n        this.markerConn = null;\n        this.draggedConn = null;\n      }\n    } finally {\n      eventUtils.enable();\n    }\n  }\n\n  private hideInsertionMarker(markerConn: RenderedConnection) {\n    const marker = markerConn.getSourceBlock();\n    const markerPrev = marker.previousConnection;\n    const markerOutput = marker.outputConnection;\n\n    if (!markerPrev?.targetConnection && !markerOutput?.targetConnection) {\n      // If we are the top block, unplugging doesn't do anything.\n      // The marker connection may not have a target block if we are hiding\n      // as part of applying connections.\n      markerConn.targetBlock()?.unplug(false);\n    } else {\n      marker.unplug(true);\n    }\n\n    marker.dispose();\n  }\n\n  /** Dispose of any references held by this connection previewer. */\n  dispose() {\n    this.hidePreview();\n  }\n}\n\nregistry.register(\n  registry.Type.CONNECTION_PREVIEWER,\n  registry.DEFAULT,\n  InsertionMarkerPreviewer,\n);\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Align} from './inputs/align.js';\nimport {DummyInput} from './inputs/dummy_input.js';\nimport {EndRowInput} from './inputs/end_row_input.js';\nimport {Input} from './inputs/input.js';\nimport {inputTypes} from './inputs/input_types.js';\nimport {StatementInput} from './inputs/statement_input.js';\nimport {ValueInput} from './inputs/value_input.js';\n\nexport {\n  Align,\n  DummyInput,\n  EndRowInput,\n  Input,\n  inputTypes,\n  StatementInput,\n  ValueInput,\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 */\n// Former goog.module ID: Blockly.CodeGenerator\n\nimport type {Block} from './block.js';\nimport * as common from './common.js';\nimport {Names, NameType} from './names.js';\nimport type {Workspace} from './workspace.js';\n\n/**\n * Deprecated, no-longer used type declaration for per-block-type generator\n * functions.\n *\n * @deprecated\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/generating-code}\n * @param block The Block instance to generate code for.\n * @param generator The CodeGenerator calling the function.\n * @returns A string containing the generated code (for statement blocks),\n *     or a [code, precedence] tuple (for value/expression blocks), or\n *     null if no code should be emitted for block.\n */\nexport type BlockGenerator = (\n  block: Block,\n  generator: CodeGenerator,\n) => [string, number] | string | null;\n\n/**\n * Class for a code generator that translates the blocks into a language.\n */\nexport class CodeGenerator {\n  name_: string;\n\n  /**\n   * A dictionary of block generator functions, keyed by block type.\n   * Each block generator function takes two parameters:\n   *\n   * - the Block to generate code for, and\n   * - the calling CodeGenerator (or subclass) instance, so the\n   *   function can call methods defined below (e.g. blockToCode) or\n   *   on the relevant subclass (e.g. JavascripGenerator),\n   *\n   * and returns:\n   *\n   * - a [code, precedence] tuple (for value/expression blocks), or\n   * - a string containing the generated code (for statement blocks), or\n   * - null if no code should be emitted for block.\n   */\n  forBlock: Record<\n    string,\n    (block: Block, generator: this) => [string, number] | string | null\n  > = Object.create(null);\n\n  /**\n   * This is used as a placeholder in functions defined using\n   * CodeGenerator.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  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  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_ = new RegExp(\n      this.FUNCTION_NAME_PLACEHOLDER_,\n      'g',\n    );\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      );\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  /**\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(\n    block: Block | null,\n    opt_thisOnly?: boolean,\n  ): string | [string, number] {\n    if (this.isInitialized === false) {\n      console.warn(\n        'CodeGenerator init was not called before blockToCode was called.',\n      );\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    // Look up block generator function in dictionary.\n    const func = this.forBlock[block.type];\n    if (typeof func !== 'function') {\n      throw Error(\n        `${this.name_} generator does not know how to generate code ` +\n          `for block type \"${block.type}\".`,\n      );\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, this);\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.\n   * @throws ReferenceError if the specified 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 && !block.getInput(name)) {\n      throw ReferenceError(`Input \"${name}\" doesn't exist on \"${block.type}\"`);\n    }\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(\n        `Expecting tuple from value block: ${targetBlock.type} See ` +\n          `developers.google.com/blockly/guides/create-custom-blocks/generating-code ` +\n          `for more information`,\n      );\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    }\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 (\n        outerOrderClass === innerOrderClass &&\n        (outerOrderClass === 0 || outerOrderClass === 99)\n      ) {\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 (\n            this.ORDER_OVERRIDES[i][0] === outerOrder &&\n            this.ORDER_OVERRIDES[i][1] === innerOrder\n          ) {\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   * @throws ReferenceError if the specified input does not exist.\n   */\n  statementToCode(block: Block, name: string): string {\n    const targetBlock = block.getInputTargetBlock(name);\n    if (!targetBlock && !block.getInput(name)) {\n      throw ReferenceError(`Input \"${name}\" doesn't exist on \"${block.type}\"`);\n    }\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    }\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 =\n        this.prefixLines(\n          this.injectId(this.INFINITE_LOOP_TRAP, block),\n          this.INDENT,\n        ) + branch;\n    }\n    if (this.STATEMENT_SUFFIX && !block.suppressPrefixSuffix) {\n      branch =\n        this.prefixLines(\n          this.injectId(this.STATEMENT_SUFFIX, block),\n          this.INDENT,\n        ) + branch;\n    }\n    if (this.STATEMENT_PREFIX && !block.suppressPrefixSuffix) {\n      branch =\n        branch +\n        this.prefixLines(\n          this.injectId(this.STATEMENT_PREFIX, block),\n          this.INDENT,\n        );\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 CodeGenerator.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  provideFunction_(desiredName: string, code: string[] | string): string {\n    if (!this.definitions_[desiredName]) {\n      const functionName = this.nameDB_!.getDistinctName(\n        desiredName,\n        NameType.PROCEDURE,\n      );\n      this.functionNames_[desiredName] = functionName;\n      if (Array.isArray(code)) {\n        code = code.join('\\n');\n      }\n      let codeText = code\n        .trim()\n        .replace(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   * Gets a unique, legal name for a user-defined variable.\n   * Before calling this method, the `nameDB_` property of the class\n   * must have been initialized already. This is typically done in\n   * the `init` function of the code generator class.\n   *\n   * @param nameOrId The ID of the variable to get a name for,\n   *    or the proposed name for a variable not associated with an id.\n   * @returns A unique, legal name for the variable.\n   */\n  getVariableName(nameOrId: string): string {\n    return this.getName(nameOrId, NameType.VARIABLE);\n  }\n\n  /**\n   * Gets a unique, legal name for a user-defined procedure.\n   * Before calling this method, the `nameDB_` property of the class\n   * must have been initialized already. This is typically done in\n   * the `init` function of the code generator class.\n   *\n   * @param name The proposed name for a procedure.\n   * @returns A unique, legal name for the procedure.\n   */\n  getProcedureName(name: string): string {\n    return this.getName(name, NameType.PROCEDURE);\n  }\n\n  private getName(nameOrId: string, type: NameType): string {\n    if (!this.nameDB_) {\n      throw new Error(\n        'Name database is not defined. You must initialize `nameDB_` in your generator class and call `init` first.',\n      );\n    }\n    return this.nameDB_.getName(nameOrId, type);\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  scrub_(_block: Block, code: string, _opt_thisOnly?: boolean): 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","/**\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 */\n// Former goog.module ID: Blockly.VerticalFlyout\n\nimport * as browserEvents from './browser_events.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {Flyout} from './flyout_base.js';\nimport type {FlyoutItem} from './flyout_item.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 * Class for a flyout.\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    }\n    this.workspace_.translate(\n      this.workspace_.scrollX + absoluteMetrics.left,\n      this.workspace_.scrollY + absoluteMetrics.top,\n    );\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.getWidth();\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.getWidth();\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.getWidth() - 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.getWidth(), this.getHeight(), 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    ];\n    // Top.\n    path.push('h', atRight ? -width : width);\n    // Rounded corner.\n    path.push(\n      'a',\n      this.CORNER_RADIUS,\n      this.CORNER_RADIUS,\n      0,\n      0,\n      atRight ? 0 : 1,\n      atRight ? -this.CORNER_RADIUS : this.CORNER_RADIUS,\n      this.CORNER_RADIUS,\n    );\n    // Side closest to workspace.\n    path.push('v', Math.max(0, height));\n    // Rounded corner.\n    path.push(\n      'a',\n      this.CORNER_RADIUS,\n      this.CORNER_RADIUS,\n      0,\n      0,\n      atRight ? 0 : 1,\n      atRight ? this.CORNER_RADIUS : -this.CORNER_RADIUS,\n      this.CORNER_RADIUS,\n    );\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.hideIfOwnerIsInWorkspace(this.workspace_);\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 flyout items to lay out.\n   */\n  protected override layout_(contents: FlyoutItem[]) {\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 (const item of contents) {\n      item.getElement().moveBy(cursorX, cursorY);\n      cursorY += item.getElement().getBoundingRectangle().getHeight();\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   */\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 (\n      (dragDirection < range && dragDirection > -range) ||\n      dragDirection < -180 + range ||\n      dragDirection > 180 - range\n    ) {\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 {\n      // Right\n      return new Rect(-BIG_NUM, BIG_NUM, left, BIG_NUM);\n    }\n  }\n\n  /**\n   * Compute width of flyout.\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 = this.getContents().reduce((maxWidthSoFar, item) => {\n      return Math.max(\n        maxWidthSoFar,\n        item.getElement().getBoundingRectangle().getWidth(),\n      );\n    }, 0);\n    flyoutWidth += this.MARGIN * 1.5 + this.tabWidth_;\n    flyoutWidth *= this.workspace_.scale;\n    flyoutWidth += Scrollbar.scrollbarThickness;\n\n    if (this.getWidth() !== flyoutWidth) {\n      if (this.RTL) {\n        // With the flyoutWidth known, right-align the flyout contents.\n        for (const item of this.getContents()) {\n          const oldX = item.getElement().getBoundingRectangle().left;\n          const newX =\n            flyoutWidth / this.workspace_.scale -\n            item.getElement().getBoundingRectangle().getWidth() -\n            this.MARGIN -\n            this.tabWidth_;\n          item.getElement().moveBy(newX - oldX, 0);\n        }\n      }\n\n      // TODO(#7689): Remove this.\n      // Workspace with no scrollbars where this is permanently\n      // open on the left.\n      // If scrollbars exist they properly update the metrics.\n      if (\n        !this.targetWorkspace.scrollbar &&\n        !this.autoClose &&\n        this.targetWorkspace.getFlyout() === this &&\n        this.toolboxPosition_ === toolbox.Position.LEFT\n      ) {\n        this.targetWorkspace.translate(\n          this.targetWorkspace.scrollX + flyoutWidth,\n          this.targetWorkspace.scrollY,\n        );\n      }\n\n      this.width_ = flyoutWidth;\n      this.position();\n      this.targetWorkspace.resizeContents();\n      this.targetWorkspace.recordDragTargets();\n    }\n  }\n}\n\nregistry.register(\n  registry.Type.FLYOUTS_VERTICAL_TOOLBOX,\n  registry.DEFAULT,\n  VerticalFlyout,\n);\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 */\n// Former goog.module ID: Blockly.HorizontalFlyout\n\nimport * as browserEvents from './browser_events.js';\nimport * as dropDownDiv from './dropdowndiv.js';\nimport {Flyout} from './flyout_base.js';\nimport type {FlyoutItem} from './flyout_item.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 * Class for a flyout.\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\n    this.workspace_.translate(\n      this.workspace_.scrollX + absoluteMetrics.left,\n      this.workspace_.scrollY + absoluteMetrics.top,\n    );\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.getHeight();\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.getHeight();\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.getHeight() - this.CORNER_RADIUS;\n    this.setBackgroundPath(edgeWidth, edgeHeight);\n\n    const x = this.getX();\n    const y = this.getY();\n\n    this.positionAt_(this.getWidth(), this.getHeight(), 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)[] = [\n      'M 0,' + (atTop ? 0 : this.CORNER_RADIUS),\n    ];\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',\n        this.CORNER_RADIUS,\n        this.CORNER_RADIUS,\n        0,\n        0,\n        1,\n        -this.CORNER_RADIUS,\n        this.CORNER_RADIUS,\n      );\n      path.push('h', -width);\n      // Left.\n      path.push(\n        'a',\n        this.CORNER_RADIUS,\n        this.CORNER_RADIUS,\n        0,\n        0,\n        1,\n        -this.CORNER_RADIUS,\n        -this.CORNER_RADIUS,\n      );\n      path.push('z');\n    } else {\n      // Top.\n      path.push(\n        'a',\n        this.CORNER_RADIUS,\n        this.CORNER_RADIUS,\n        0,\n        0,\n        1,\n        this.CORNER_RADIUS,\n        -this.CORNER_RADIUS,\n      );\n      path.push('h', width);\n      // Right.\n      path.push(\n        'a',\n        this.CORNER_RADIUS,\n        this.CORNER_RADIUS,\n        0,\n        0,\n        1,\n        this.CORNER_RADIUS,\n        this.CORNER_RADIUS,\n      );\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.hideIfOwnerIsInWorkspace(this.workspace_);\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 flyout items to lay out.\n   */\n  protected override layout_(contents: FlyoutItem[]) {\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 (const item of contents) {\n      const rect = item.getElement().getBoundingRectangle();\n      const moveX = this.RTL ? cursorX + rect.getWidth() : cursorX;\n      item.getElement().moveBy(moveX, cursorY);\n      cursorX += item.getElement().getBoundingRectangle().getWidth();\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   */\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 (\n      (dragDirection < 90 + range && dragDirection > 90 - range) ||\n      (dragDirection > -90 - range && dragDirection < -90 + range)\n    ) {\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 {\n      // 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 = this.getContents().reduce((maxHeightSoFar, item) => {\n      return Math.max(\n        maxHeightSoFar,\n        item.getElement().getBoundingRectangle().getHeight(),\n      );\n    }, 0);\n    flyoutHeight += this.MARGIN * 1.5;\n    flyoutHeight *= this.workspace_.scale;\n    flyoutHeight += Scrollbar.scrollbarThickness;\n\n    if (this.getHeight() !== flyoutHeight) {\n      // TODO(#7689): Remove this.\n      // Workspace with no scrollbars where this is permanently open on the top.\n      // If scrollbars exist they properly update the metrics.\n      if (\n        !this.targetWorkspace.scrollbar &&\n        !this.autoClose &&\n        this.targetWorkspace.getFlyout() === this &&\n        this.toolboxPosition_ === toolbox.Position.TOP\n      ) {\n        this.targetWorkspace.translate(\n          this.targetWorkspace.scrollX,\n          this.targetWorkspace.scrollY + flyoutHeight,\n        );\n      }\n\n      this.height_ = flyoutHeight;\n      this.position();\n      this.targetWorkspace.resizeContents();\n      this.targetWorkspace.recordDragTargets();\n    }\n  }\n}\n\nregistry.register(\n  registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,\n  registry.DEFAULT,\n  HorizontalFlyout,\n);\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 */\n// Former goog.module ID: 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 {\n  FieldDropdown,\n  FieldDropdownValidator,\n  MenuGenerator,\n  MenuOption,\n} from './field_dropdown.js';\nimport * as fieldRegistry from './field_registry.js';\nimport {IVariableModel, IVariableState} from './interfaces/i_variable_model.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 dom from './utils/dom.js';\nimport * as parsing from './utils/parsing.js';\nimport {Size} from './utils/size.js';\nimport * as Variables from './variables.js';\nimport * as Xml from './xml.js';\n\n/**\n * Class for a variable's dropdown field.\n */\nexport class FieldVariable extends FieldDropdown {\n  protected override menuGenerator_: MenuGenerator | undefined;\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\n  /** The variable model associated with this field. */\n  private variable: IVariableModel<IVariableState> | 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 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 variableTypes A list of the types of variables to include in the\n   *     dropdown. Pass `null` to include all types that exist on the\n   *     workspace. Will only be used if config is not provided.\n   * @param defaultType The type of variable to create if this field's value\n   *     is not explicitly set.  Defaults to ''. Will only be used if config\n   *     is not provided.\n   * @param 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 | typeof Field.SKIP_SETUP,\n    validator?: FieldVariableValidator,\n    variableTypes?: string[] | null,\n    defaultType?: string,\n    config?: FieldVariableConfig,\n  ) {\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    this.menuGenerator_ = FieldVariable.dropdownCreate as MenuGenerator;\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) return;\n\n    if (config) {\n      this.configure_(config);\n    } else {\n      this.setTypes(variableTypes, defaultType);\n    }\n    if (validator) {\n      this.setValidator(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  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,\n      null,\n      this.defaultVariableName,\n      this.defaultType,\n    );\n    // Don't call setValue because we don't want to cause a rerender.\n    this.doValueUpdate_(variable.getId());\n  }\n\n  override initView() {\n    super.initView();\n    dom.addClass(this.fieldGroup_!, 'blocklyVariableField');\n  }\n\n  override shouldAddBorderRect_() {\n    const block = this.getSourceBlock();\n    if (!block) {\n      throw new UnattachedFieldError();\n    }\n    return (\n      super.shouldAddBorderRect_() &&\n      (!this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW ||\n        block.type !== 'variables_get')\n    );\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 =\n      fieldElement.getAttribute('variabletype') ||\n      fieldElement.getAttribute('variableType') ||\n      '';\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,\n      id,\n      variableName as AnyDuringMigration,\n      variableType,\n    );\n\n    // This should never happen :)\n    if (variableType !== null && variableType !== variable.getType()) {\n      throw Error(\n        \"Serialized variable type with id '\" +\n          variable.getId() +\n          \"' had type \" +\n          variable.getType() +\n          ', and ' +\n          'does not match variable field that references it: ' +\n          Xml.domToText(fieldElement) +\n          '.',\n      );\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!.getName();\n    if (this.variable!.getType()) {\n      fieldElement.setAttribute('variabletype', this.variable!.getType());\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!.getName();\n      (state as AnyDuringMigration)['type'] = this.variable!.getType();\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,\n      state['id'] || null,\n      state['name'],\n      state['type'] || '',\n    );\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.getName() : '';\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(): IVariableModel<IVariableState> | null {\n    return this.variable;\n  }\n\n  /**\n   * Gets the type of this field's default variable.\n   *\n   * @returns The default type for this variable field.\n   */\n  protected getDefaultType(): string {\n    return this.defaultType;\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(): FieldVariableValidator | 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 newValue The ID of the new variable to set.\n   * @returns The validated ID, or null if invalid.\n   */\n  protected override doClassValidation_(\n    newValue?: AnyDuringMigration,\n  ): string | null {\n    if (newValue === null) {\n      return null;\n    }\n    const block = this.getSourceBlock();\n    if (!block) {\n      throw new UnattachedFieldError();\n    }\n    const newId = 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! \" + 'ID was ' + newId,\n      );\n      return null;\n    }\n    // Type Checks.\n    const type = variable.getType();\n    if (!this.typeIsAllowed(type)) {\n      console.warn(\"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: string) {\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   */\n  private getVariableTypes(): string[] {\n    if (this.variableTypes) return this.variableTypes;\n\n    if (!this.sourceBlock_ || this.sourceBlock_.isDeadOrDying()) {\n      // We should include all types in the block's workspace,\n      // but the block is dead so just give up.\n      return [''];\n    }\n\n    // If variableTypes is null, return all variable types in the workspace.\n    let allTypes = this.sourceBlock_.workspace.getVariableMap().getTypes();\n    if (this.sourceBlock_.isInFlyout) {\n      // If this block is in a flyout, we also need to check the potential variables\n      const potentialMap =\n        this.sourceBlock_.workspace.getPotentialVariableMap();\n      if (!potentialMap) return allTypes;\n      allTypes = Array.from(new Set([...allTypes, ...potentialMap.getTypes()]));\n    }\n\n    return allTypes;\n  }\n\n  /**\n   * Parse the optional arguments representing the allowed variable types and\n   * the default variable type.\n   *\n   * @param 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 defaultType The type of the variable to create if this field's\n   *     value is not explicitly set.  Defaults to ''.\n   */\n  private setTypes(variableTypes: string[] | null = null, defaultType = '') {\n    const name = this.getText();\n    if (Array.isArray(variableTypes)) {\n      if (variableTypes.length === 0) {\n        // Throw an error if variableTypes is an empty list.\n        throw Error(\n          `'variableTypes' of field variable ${name} was an empty list. If you want to include all variable types, pass 'null' instead.`,\n        );\n      }\n\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 '\" +\n            defaultType +\n            \"' in \" +\n            'the definition of a FieldVariable',\n        );\n      }\n    } else if (variableTypes !== null) {\n      throw Error(\n        `'variableTypes' was not an array or null in the definition of FieldVariable ${name}`,\n      );\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 && this.variable) {\n        // Rename variable.\n        Variables.renameVariable(this.sourceBlock_.workspace, this.variable);\n        return;\n      } else if (id === internalConstants.DELETE_VARIABLE_ID && this.variable) {\n        // Delete variable.\n        const workspace = this.variable.getWorkspace();\n        Variables.deleteVariable(workspace, this.variable, this.sourceBlock_);\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(\n    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): MenuOption[] {\n    if (!this.variable) {\n      throw Error(\n        'Tried to call dropdownCreate on a variable field with no' +\n          ' variable selected.',\n      );\n    }\n    const name = this.getText();\n    let variableModelList: IVariableModel<IVariableState>[] = [];\n    const sourceBlock = this.getSourceBlock();\n    if (sourceBlock && !sourceBlock.isDeadOrDying()) {\n      const workspace = sourceBlock.workspace;\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 = workspace\n          .getVariableMap()\n          .getVariablesOfType(variableType);\n        variableModelList = variableModelList.concat(variables);\n        if (workspace.isFlyout) {\n          variableModelList = variableModelList.concat(\n            workspace\n              .getPotentialVariableMap()\n              ?.getVariablesOfType(variableType) ?? [],\n          );\n        }\n      }\n    }\n    variableModelList.sort(Variables.compareByName);\n\n    const options: [string, string][] = [];\n    for (let i = 0; i < variableModelList.length; i++) {\n      // Set the UUID as the internal representation of the variable.\n      options[i] = [\n        variableModelList[i].getName(),\n        variableModelList[i].getId(),\n      ];\n    }\n    options.push([\n      Msg['RENAME_VARIABLE'],\n      internalConstants.RENAME_VARIABLE_ID,\n    ]);\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/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldVariableValidator = FieldDropdownValidator;\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 */\n// Former goog.module ID: Blockly.FieldNumber\n\nimport {Field} from './field.js';\nimport {\n  FieldInput,\n  FieldInputConfig,\n  FieldInputValidator,\n} from './field_input.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as aria from './utils/aria.js';\nimport * as dom from './utils/dom.js';\n\n/**\n * Class for an editable number field.\n */\nexport class FieldNumber extends FieldInput<number> {\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  /** Don't spellcheck numbers.  Our validator does a better job. */\n  protected override spellcheck_ = false;\n\n  /**\n   * @param 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 min Minimum value. Will only be used if config is not\n   *     provided.\n   * @param max Maximum value. Will only be used if config is not\n   *     provided.\n   * @param precision Precision for value. Will only be used if config\n   *     is not provided.\n   * @param 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 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    value?: string | number | typeof Field.SKIP_SETUP,\n    min?: string | number | null,\n    max?: string | number | null,\n    precision?: string | number | null,\n    validator?: FieldNumberValidator | null,\n    config?: FieldNumberConfig,\n  ) {\n    // Pass SENTINEL so that we can define properties before value validation.\n    super(Field.SKIP_SETUP);\n\n    if (value === Field.SKIP_SETUP) return;\n    if (config) {\n      this.configure_(config);\n    } else {\n      this.setConstraints(min, max, precision);\n    }\n    this.setValue(value);\n    if (validator) {\n      this.setValidator(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,\n    max: number | string | undefined | null,\n    precision: number | string | undefined | null,\n  ) {\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.includes('e')) {\n      // String() is fast.  But it turns .0000001 into '1e-7'.\n      // Use the much slower toLocaleString to access all the digits.\n      precisionString = this.precision_.toLocaleString('en-US', {\n        maximumFractionDigits: 20,\n      });\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 newValue The input value.\n   * @returns A valid number, or null if invalid.\n   */\n  protected override doClassValidation_(\n    newValue?: AnyDuringMigration,\n  ): number | null {\n    if (newValue === null) {\n      return null;\n    }\n\n    // Clean up text.\n    newValue = `${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/gi, '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_(): HTMLInputElement {\n    const htmlInput = super.widgetCreate_() as HTMLInputElement;\n\n    // Set the accessibility state\n    if (this.min_ > -Infinity) {\n      htmlInput.min = `${this.min_}`;\n      aria.setState(htmlInput, aria.State.VALUEMIN, this.min_);\n    }\n    if (this.max_ < Infinity) {\n      htmlInput.max = `${this.max_}`;\n      aria.setState(htmlInput, aria.State.VALUEMAX, this.max_);\n    }\n    return htmlInput;\n  }\n\n  /**\n   * Initialize the field's DOM.\n   *\n   * @override\n   */\n\n  public override initView() {\n    super.initView();\n    if (this.fieldGroup_) {\n      dom.addClass(this.fieldGroup_, 'blocklyNumberField');\n    }\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,\n      undefined,\n      undefined,\n      undefined,\n      undefined,\n      options,\n    );\n  }\n}\n\nfieldRegistry.register('field_number', FieldNumber);\n\nFieldNumber.prototype.DEFAULT_VALUE = 0;\n\n/**\n * Config options for the number field.\n */\nexport interface FieldNumberConfig extends FieldInputConfig {\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/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldNumberValidator = FieldInputValidator<number>;\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 */\n// Former goog.module ID: Blockly.FieldLabelSerializable\n\nimport {\n  FieldLabel,\n  FieldLabelConfig,\n  FieldLabelFromJsonConfig,\n} from './field_label.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as parsing from './utils/parsing.js';\n\n/**\n * Class for a non-editable, serializable text field.\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 value The initial value of the field. Should cast to a string.\n   *     Defaults to an empty string if null or undefined.\n   * @param textClass Optional CSS class for the field's text.\n   * @param 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(value?: string, textClass?: string, config?: FieldLabelConfig) {\n    super(String(value ?? ''), textClass, 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(\n    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 * Checkbox field.  Checked or not checked.\n *\n * @class\n */\n// Former goog.module ID: Blockly.FieldCheckbox\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport './events/events_block_change.js';\n\nimport {Field, FieldConfig, FieldValidator} from './field.js';\nimport * as fieldRegistry from './field_registry.js';\nimport * as dom from './utils/dom.js';\n\ntype BoolString = 'TRUE' | 'FALSE';\ntype CheckboxBool = BoolString | boolean;\n\n/**\n * Class for a checkbox field.\n */\nexport class FieldCheckbox extends Field<CheckboxBool> {\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   * NOTE: The default value is set in `Field`, so maintain that value instead\n   * of overwriting it here or in the constructor.\n   */\n  override value_: boolean | null = this.value_;\n\n  /**\n   * @param 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 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 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    value?: CheckboxBool | typeof Field.SKIP_SETUP,\n    validator?: FieldCheckboxValidator,\n    config?: FieldCheckboxConfig,\n  ) {\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 (value === Field.SKIP_SETUP) return;\n    if (config) {\n      this.configure_(config);\n    }\n    this.setValue(value);\n    if (validator) {\n      this.setValidator(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  override initView() {\n    super.initView();\n\n    const textElement = this.getTextElement();\n    dom.addClass(this.fieldGroup_!, 'blocklyCheckboxField');\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 newValue The input value.\n   * @returns A valid value ('TRUE' or 'FALSE), or null if invalid.\n   */\n  protected override doClassValidation_(\n    newValue?: AnyDuringMigration,\n  ): BoolString | null {\n    if (newValue === true || newValue === 'TRUE') {\n      return 'TRUE';\n    }\n    if (newValue === false || 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: BoolString) {\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(): BoolString {\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 | null {\n    return this.value_;\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: CheckboxBool | null): boolean {\n    if (typeof value === 'string') return value === 'TRUE';\n    return !!value;\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 override fromJson(\n    options: FieldCheckboxFromJsonConfig,\n  ): 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\nFieldCheckbox.prototype.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/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldCheckboxValidator = FieldValidator<CheckboxBool>;\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as blockAnimations from '../block_animations.js';\nimport {BlockSvg} from '../block_svg.js';\nimport {ComponentManager} from '../component_manager.js';\nimport * as eventUtils from '../events/utils.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {IDeletable, isDeletable} 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 {IDragger} from '../interfaces/i_dragger.js';\nimport {isFocusableNode} from '../interfaces/i_focusable_node.js';\nimport * as registry from '../registry.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport {WorkspaceSvg} from '../workspace_svg.js';\n\nexport class Dragger implements IDragger {\n  protected startLoc: Coordinate;\n\n  protected dragTarget: IDragTarget | null = null;\n\n  constructor(\n    protected draggable: IDraggable,\n    protected workspace: WorkspaceSvg,\n  ) {\n    this.startLoc = draggable.getRelativeToSurfaceXY();\n  }\n\n  /** Handles any drag startup. */\n  onDragStart(e: PointerEvent) {\n    if (!eventUtils.getGroup()) {\n      eventUtils.setGroup(true);\n    }\n    this.draggable.startDrag(e);\n  }\n\n  /**\n   * Handles calculating where the element should actually be moved to.\n   *\n   * @param totalDelta The total amount in pixel coordinates the mouse has moved\n   *     since the start of the drag.\n   */\n  onDrag(e: PointerEvent, totalDelta: Coordinate) {\n    this.moveDraggable(e, totalDelta);\n    const root = this.getRoot(this.draggable);\n\n    // Must check `wouldDelete` before calling other hooks on drag targets\n    // since we have documented that we would do so.\n    if (isDeletable(root)) {\n      root.setDeleteStyle(this.wouldDeleteDraggable(e, root));\n    }\n    this.updateDragTarget(e);\n  }\n\n  /** Updates the drag target under the pointer (if there is one). */\n  protected updateDragTarget(e: PointerEvent) {\n    const newDragTarget = this.workspace.getDragTarget(e);\n    const root = this.getRoot(this.draggable);\n    if (this.dragTarget !== newDragTarget) {\n      this.dragTarget?.onDragExit(root);\n      newDragTarget?.onDragEnter(root);\n    }\n    newDragTarget?.onDragOver(root);\n    this.dragTarget = newDragTarget;\n  }\n\n  /**\n   * Calculates the correct workspace coordinate for the movable and tells\n   * the draggable to go to that location.\n   */\n  private moveDraggable(e: PointerEvent, totalDelta: Coordinate) {\n    const delta = this.pixelsToWorkspaceUnits(totalDelta);\n    const newLoc = Coordinate.sum(this.startLoc, delta);\n    this.draggable.drag(newLoc, e);\n  }\n\n  /**\n   * Returns true if we would delete the draggable if it was dropped\n   * at the current location.\n   */\n  protected wouldDeleteDraggable(\n    e: PointerEvent,\n    rootDraggable: IDraggable & IDeletable,\n  ) {\n    const dragTarget = this.workspace.getDragTarget(e);\n    if (!dragTarget) return false;\n\n    const componentManager = this.workspace.getComponentManager();\n    const isDeleteArea = componentManager.hasCapability(\n      dragTarget.id,\n      ComponentManager.Capability.DELETE_AREA,\n    );\n    if (!isDeleteArea) return false;\n\n    return (dragTarget as IDeleteArea).wouldDelete(rootDraggable);\n  }\n\n  /** Handles any drag cleanup. */\n  onDragEnd(e: PointerEvent) {\n    const origGroup = eventUtils.getGroup();\n    const dragTarget = this.workspace.getDragTarget(e);\n    const root = this.getRoot(this.draggable);\n\n    if (dragTarget) {\n      this.dragTarget?.onDrop(root);\n    }\n\n    if (this.shouldReturnToStart(e, root)) {\n      this.draggable.revertDrag();\n    }\n\n    const wouldDelete = isDeletable(root) && this.wouldDeleteDraggable(e, root);\n\n    // TODO(#8148): use a generalized API instead of an instanceof check.\n    if (wouldDelete && this.draggable instanceof BlockSvg) {\n      blockAnimations.disposeUiEffect(this.draggable.getRootBlock());\n    }\n\n    this.draggable.endDrag(e);\n\n    if (wouldDelete && isDeletable(root)) {\n      // We want to make sure the delete gets grouped with any possible move\n      // event. In core Blockly this shouldn't happen, but due to a change\n      // in behavior older custom draggables might still clear the group.\n      eventUtils.setGroup(origGroup);\n      root.dispose();\n    }\n    eventUtils.setGroup(false);\n\n    if (!wouldDelete && isFocusableNode(this.draggable)) {\n      // Ensure focusable nodes that have finished dragging (but aren't being\n      // deleted) end with focus and selection.\n      getFocusManager().focusNode(this.draggable);\n    }\n  }\n\n  // We need to special case blocks for now so that we look at the root block\n  // instead of the one actually being dragged in most cases.\n  private getRoot(draggable: IDraggable): IDraggable {\n    return draggable instanceof BlockSvg ? draggable.getRootBlock() : draggable;\n  }\n\n  /**\n   * Returns true if we should return the draggable to its original location\n   * at the end of the drag.\n   */\n  protected shouldReturnToStart(e: PointerEvent, rootDraggable: IDraggable) {\n    const dragTarget = this.workspace.getDragTarget(e);\n    if (!dragTarget) return false;\n    return dragTarget.shouldPreventMove(rootDraggable);\n  }\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    );\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\nregistry.register(registry.Type.BLOCK_DRAGGER, registry.DEFAULT, Dragger);\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BlockDragStrategy} from './dragging/block_drag_strategy.js';\nimport {BubbleDragStrategy} from './dragging/bubble_drag_strategy.js';\nimport {CommentDragStrategy} from './dragging/comment_drag_strategy.js';\nimport {Dragger} from './dragging/dragger.js';\n\nexport {BlockDragStrategy, BubbleDragStrategy, CommentDragStrategy, Dragger};\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 */\n// Former goog.module ID: Blockly.Events.BlockDrag\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners when a block is being manually dragged/dropped.\n */\nexport class BlockDrag extends UiBase {\n  /** The ID of the top-level block being dragged. */\n  blockId?: string;\n\n  /** True if this is the start of a drag, false if this is the end of one. */\n  isStart?: boolean;\n\n  /**\n   * A list of all of the blocks (i.e. all descendants of the block associated\n   * with the block ID) being dragged.\n   */\n  blocks?: Block[];\n\n  override type = EventType.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    this.isStart = opt_isStart;\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 undefined. ' +\n          'Either pass the value to the constructor, or call fromJson',\n      );\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    }\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   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BlockDrag, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses..\n   * @internal\n   */\n  static fromJson(\n    json: BlockDragJson,\n    workspace: Workspace,\n    event?: any,\n  ): BlockDrag {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BlockDrag(),\n    ) as BlockDrag;\n    newEvent.isStart = json['isStart'];\n    newEvent.blockId = json['blockId'];\n    newEvent.blocks = json['blocks'];\n    return newEvent;\n  }\n}\n\nexport interface BlockDragJson extends AbstractEventJson {\n  isStart: boolean;\n  blockId: string;\n  blocks?: Block[];\n}\n\nregistry.register(registry.Type.EVENT, EventType.BLOCK_DRAG, BlockDrag);\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for an event representing an intermediate change to a block's field's\n * value.\n *\n * @class\n */\n// Former goog.module ID: Blockly.Events.BlockFieldIntermediateChange\n\nimport type {Block} from '../block.js';\nimport * as registry from '../registry.js';\nimport {Workspace} from '../workspace.js';\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners when the value of a block's field has changed but the\n * change is not yet complete, and is expected to be followed by a block change\n * event.\n */\nexport class BlockFieldIntermediateChange extends BlockBase {\n  override type = EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE;\n\n  // Intermediate events do not undo or redo. They may be fired frequently while\n  // the field editor widget is open. A separate BLOCK_CHANGE event is fired\n  // when the editor is closed, which combines all of the field value changes\n  // into a single change that is recorded in the undo history instead. The\n  // intermediate changes are important for reacting to immediate changes, but\n  // some event handlers would prefer to handle the less frequent final events,\n  // like when triggering workspace serialization. Technically, this method of\n  // grouping changes can result in undo perfoming actions out of order if some\n  // other event occurs between opening and closing the field editor, but such\n  // events are unlikely to cause a broken state.\n  override recordUndo = false;\n\n  /** The name of the field that changed. */\n  name?: string;\n\n  /** The original value of the element. */\n  oldValue: unknown;\n\n  /** The new value of the element. */\n  newValue: unknown;\n\n  /**\n   * @param opt_block The changed block. Undefined for a blank event.\n   * @param opt_name Name of the field affected.\n   * @param opt_oldValue Previous value of element.\n   * @param opt_newValue New value of element.\n   */\n  constructor(\n    opt_block?: Block,\n    opt_name?: string,\n    opt_oldValue?: unknown,\n    opt_newValue?: unknown,\n  ) {\n    super(opt_block);\n    if (!opt_block) {\n      return; // Blank event to be populated by fromJson.\n    }\n\n    this.name = opt_name;\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(): BlockFieldIntermediateChangeJson {\n    const json = super.toJson() as BlockFieldIntermediateChangeJson;\n    if (!this.name) {\n      throw new Error(\n        'The changed field name is undefined. Either pass a ' +\n          'name to the constructor, or call fromJson.',\n      );\n    }\n    json['name'] = this.name;\n    json['oldValue'] = this.oldValue;\n    json['newValue'] = this.newValue;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BlockFieldIntermediateChange, but we can't specify that due to the\n   *     fact that parameters to static methods in subclasses must be supertypes\n   *     of parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: BlockFieldIntermediateChangeJson,\n    workspace: Workspace,\n    event?: any,\n  ): BlockFieldIntermediateChange {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BlockFieldIntermediateChange(),\n    ) as BlockFieldIntermediateChange;\n    newEvent.name = json['name'];\n    newEvent.oldValue = json['oldValue'];\n    newEvent.newValue = json['newValue'];\n    return newEvent;\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    }\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    }\n\n    const value = forward ? this.newValue : this.oldValue;\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  }\n}\n\nexport interface BlockFieldIntermediateChangeJson extends BlockBaseJson {\n  name: string;\n  newValue: unknown;\n  oldValue: unknown;\n}\n\nregistry.register(\n  registry.Type.EVENT,\n  EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE,\n  BlockFieldIntermediateChange,\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 */\n// Former goog.module ID: 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';\nimport type {Workspace} from '../workspace.js';\nimport {BlockBase, BlockBaseJson} from './events_block_base.js';\nimport {EventType} from './type.js';\n\ninterface BlockLocation {\n  parentId?: string;\n  inputName?: string;\n  coordinate?: Coordinate;\n}\n\n/**\n * Notifies listeners when a block is moved. This could be from one\n * connection to another, or from one location on the workspace to another.\n */\nexport class BlockMove extends BlockBase {\n  override type = EventType.BLOCK_MOVE;\n\n  /** The ID of the old parent block. Undefined if it was a top-level block. */\n  oldParentId?: string;\n\n  /**\n   * The name of the old input. Undefined if it was a top-level block or the\n   * parent's next block.\n   */\n  oldInputName?: string;\n\n  /**\n   * The old X and Y workspace coordinates of the block if it was a top level\n   * block. Undefined if it was not a top level block.\n   */\n  oldCoordinate?: Coordinate;\n\n  /** The ID of the new parent block. Undefined if it is a top-level block. */\n  newParentId?: string;\n\n  /**\n   * The name of the new input. Undefined if it is a top-level block or the\n   * parent's next block.\n   */\n  newInputName?: string;\n\n  /**\n   * The new X and Y workspace coordinates of the block if it is a top-level\n   * block. Undefined if it is not a top level block.\n   */\n  newCoordinate?: Coordinate;\n\n  /**\n   * An explanation of what this move is for.  Known values include:\n   *  'drag' -- A drag operation completed.\n   *  'bump' -- Block got bumped away from an invalid connection.\n   *  'snap' -- Block got shifted to line up with the grid.\n   *  'inbounds' -- Block got pushed back into a non-scrolling workspace.\n   *  'connect' -- Block got connected to another block.\n   *  'disconnect' -- Block got disconnected from another block.\n   *  'create' -- Block created via XML.\n   *  'cleanup' -- Workspace aligned top-level blocks.\n   * Event merging may create multiple reasons: ['drag', 'bump', 'snap'].\n   */\n  reason?: string[];\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['oldParentId'] = this.oldParentId;\n    json['oldInputName'] = this.oldInputName;\n    if (this.oldCoordinate) {\n      json['oldCoordinate'] =\n        `${Math.round(this.oldCoordinate.x)}, ` +\n        `${Math.round(this.oldCoordinate.y)}`;\n    }\n    json['newParentId'] = this.newParentId;\n    json['newInputName'] = this.newInputName;\n    if (this.newCoordinate) {\n      json['newCoordinate'] =\n        `${Math.round(this.newCoordinate.x)}, ` +\n        `${Math.round(this.newCoordinate.y)}`;\n    }\n    if (this.reason) {\n      json['reason'] = this.reason;\n    }\n    if (!this.recordUndo) {\n      json['recordUndo'] = this.recordUndo;\n    }\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BlockMove, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: BlockMoveJson,\n    workspace: Workspace,\n    event?: any,\n  ): BlockMove {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BlockMove(),\n    ) as BlockMove;\n    newEvent.oldParentId = json['oldParentId'];\n    newEvent.oldInputName = json['oldInputName'];\n    if (json['oldCoordinate']) {\n      const xy = json['oldCoordinate'].split(',');\n      newEvent.oldCoordinate = new Coordinate(Number(xy[0]), Number(xy[1]));\n    }\n    newEvent.newParentId = json['newParentId'];\n    newEvent.newInputName = json['newInputName'];\n    if (json['newCoordinate']) {\n      const xy = json['newCoordinate'].split(',');\n      newEvent.newCoordinate = new Coordinate(Number(xy[0]), Number(xy[1]));\n    }\n    if (json['reason'] !== undefined) {\n      newEvent.reason = json['reason'];\n    }\n    if (json['recordUndo'] !== undefined) {\n      newEvent.recordUndo = json['recordUndo'];\n    }\n    return newEvent;\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   * Set the reason for a move event.\n   *\n   * @param reason Why is this move happening?  'drag', 'bump', 'snap', ...\n   */\n  setReason(reason: string[]) {\n    this.reason = reason;\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    }\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    }\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 (\n      this.oldParentId === this.newParentId &&\n      this.oldInputName === this.newInputName &&\n      Coordinate.equals(this.oldCoordinate, this.newCoordinate)\n    );\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    }\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, this.reason);\n    } else {\n      let blockConnection = block.outputConnection;\n      if (\n        !blockConnection ||\n        (block.previousConnection && block.previousConnection.isConnected())\n      ) {\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 && blockConnection) {\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  oldParentId?: string;\n  oldInputName?: string;\n  oldCoordinate?: string;\n  newParentId?: string;\n  newInputName?: string;\n  newCoordinate?: string;\n  reason?: string[];\n  recordUndo?: boolean;\n}\n\nregistry.register(registry.Type.EVENT, EventType.BLOCK_MOVE, BlockMove);\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 */\n\n// Former goog.module ID: Blockly.Events.BubbleOpen\n\nimport type {BlockSvg} from '../block_svg.js';\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport type {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Class for a bubble open event.\n */\nexport class BubbleOpen extends UiBase {\n  /** The ID of the block the bubble is attached to. */\n  blockId?: string;\n\n  /** True if the bubble is opening, false if closing. */\n  isOpen?: boolean;\n\n  /** The type of bubble; one of 'mutator', 'comment', or 'warning'. */\n  bubbleType?: BubbleType;\n\n  override type = EventType.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,\n    opt_isOpen?: boolean,\n    opt_bubbleType?: BubbleType,\n  ) {\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    this.isOpen = opt_isOpen;\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 undefined. ' +\n          'Either pass the value to the constructor, or call fromJson',\n      );\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 fromJson',\n      );\n    }\n    json['isOpen'] = this.isOpen;\n    json['bubbleType'] = this.bubbleType;\n    json['blockId'] = this.blockId || '';\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of BubbleOpen, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: BubbleOpenJson,\n    workspace: Workspace,\n    event?: any,\n  ): BubbleOpen {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new BubbleOpen(),\n    ) as BubbleOpen;\n    newEvent.isOpen = json['isOpen'];\n    newEvent.bubbleType = json['bubbleType'];\n    newEvent.blockId = json['blockId'];\n    return newEvent;\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, EventType.BUBBLE_OPEN, BubbleOpen);\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 */\n// Former goog.module ID: Blockly.Events.CommentBase\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as comments from '../serialization/workspace_comments.js';\nimport type {Workspace} from '../workspace.js';\nimport {\n  Abstract as AbstractEvent,\n  AbstractEventJson,\n} from './events_abstract.js';\nimport type {CommentCreate} from './events_comment_create.js';\nimport type {CommentDelete} from './events_comment_delete.js';\nimport {getGroup, getRecordUndo} from './utils.js';\n\n/**\n * Abstract class for a comment event.\n */\nexport class CommentBase extends AbstractEvent {\n  override isBlank = true;\n\n  /** The ID of the comment that this event references. */\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    this.commentId = opt_comment.id;\n    this.workspaceId = opt_comment.workspace.id;\n    this.group = getGroup();\n    this.recordUndo = 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    }\n    json['commentId'] = this.commentId;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentBase, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentBaseJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentBase {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentBase(),\n    ) as CommentBase;\n    newEvent.commentId = json['commentId'];\n    return newEvent;\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,\n    create: boolean,\n  ) {\n    const workspace = event.getEventWorkspace_();\n    if (create) {\n      if (!event.json) {\n        throw new Error('Encountered a comment event without proper json');\n      }\n      comments.append(event.json, 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      }\n      const comment = workspace.getCommentById(event.commentId);\n      if (comment) {\n        comment.dispose();\n      } else {\n        console.warn(\"Can't delete 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 */\n// Former goog.module ID: Blockly.Events.CommentChange\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that the contents of a workspace comment has changed.\n */\nexport class CommentChange extends CommentBase {\n  override type = EventType.COMMENT_CHANGE;\n\n  // TODO(#6774): We should remove underscores.\n  /** The previous contents of the comment. */\n  oldContents_?: string;\n\n  /** The new contents of the comment. */\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,\n    opt_oldContents?: string,\n    opt_newContents?: string,\n  ) {\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    }\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    }\n    json['oldContents'] = this.oldContents_;\n    json['newContents'] = this.newContents_;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentChange, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentChangeJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentChange {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentChange(),\n    ) as CommentChange;\n    newEvent.oldContents_ = json['oldContents'];\n    newEvent.newContents_ = json['newContents'];\n    return newEvent;\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    }\n    // TODO: Remove the cast when we fix the type of getCommentById.\n    const comment = workspace.getCommentById(\n      this.commentId,\n    ) as unknown as WorkspaceComment;\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 === undefined) {\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      }\n      throw new Error(\n        'The old contents is undefined. Either pass a value to ' +\n          'the constructor, or call fromJson',\n      );\n    }\n    comment.setText(contents);\n  }\n}\n\nexport interface CommentChangeJson extends CommentBaseJson {\n  oldContents: string;\n  newContents: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.COMMENT_CHANGE, CommentChange);\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport {EventType} from './type.js';\n\nexport class CommentCollapse extends CommentBase {\n  override type = EventType.COMMENT_COLLAPSE;\n\n  constructor(\n    comment?: WorkspaceComment,\n    public newCollapsed?: boolean,\n  ) {\n    super(comment);\n\n    if (!comment) {\n      return; // Blank event to be populated by fromJson.\n    }\n  }\n\n  /**\n   * Encode the event as JSON.\n   *\n   * @returns JSON representation.\n   */\n  override toJson(): CommentCollapseJson {\n    const json = super.toJson() as CommentCollapseJson;\n    if (this.newCollapsed === undefined) {\n      throw new Error(\n        'The new collapse value undefined. Either call recordNew, or ' +\n          'call fromJson',\n      );\n    }\n    json['newCollapsed'] = this.newCollapsed;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentCollapse, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentCollapseJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentCollapse {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentCollapse(),\n    ) as CommentCollapse;\n    newEvent.newCollapsed = json.newCollapsed;\n    return newEvent;\n  }\n\n  /**\n   * Run a collapse 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    }\n    // TODO: Remove cast when we update getCommentById.\n    const comment = workspace.getCommentById(\n      this.commentId,\n    ) as unknown as WorkspaceComment;\n    if (!comment) {\n      console.warn(\n        \"Can't collapse or uncollapse non-existent comment: \" + this.commentId,\n      );\n      return;\n    }\n\n    comment.setCollapsed(forward ? !!this.newCollapsed : !this.newCollapsed);\n  }\n}\n\nexport interface CommentCollapseJson extends CommentBaseJson {\n  newCollapsed: boolean;\n}\n\nregistry.register(\n  registry.Type.EVENT,\n  EventType.COMMENT_COLLAPSE,\n  CommentCollapse,\n);\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 */\n// Former goog.module ID: Blockly.Events.CommentCreate\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as registry from '../registry.js';\nimport * as comments from '../serialization/workspace_comments.js';\nimport * as utilsXml from '../utils/xml.js';\nimport type {Workspace} from '../workspace.js';\nimport * as Xml from '../xml.js';\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a workspace comment was created.\n */\nexport class CommentCreate extends CommentBase {\n  override type = EventType.COMMENT_CREATE;\n\n  /** The XML representation of the created workspace comment. */\n  xml?: Element | DocumentFragment;\n\n  /** The JSON representation of the created workspace comment. */\n  json?: comments.State;\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; // Blank event to be populated by fromJson.\n    }\n\n    this.xml = Xml.saveWorkspaceComment(opt_comment);\n    this.json = comments.save(opt_comment, {addCoordinates: true});\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    }\n    if (!this.json) {\n      throw new Error(\n        'The comment JSON is undefined. Either pass a block to ' +\n          'the constructor, or call fromJson',\n      );\n    }\n    json['xml'] = Xml.domToText(this.xml);\n    json['json'] = this.json;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentCreate, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentCreateJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentCreate {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentCreate(),\n    ) as CommentCreate;\n    newEvent.xml = utilsXml.textToDom(json['xml']);\n    newEvent.json = json['json'];\n    return newEvent;\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  json: object;\n}\n\nregistry.register(registry.Type.EVENT, EventType.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 */\n// Former goog.module ID: Blockly.Events.CommentDelete\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as registry from '../registry.js';\nimport * as comments from '../serialization/workspace_comments.js';\nimport * as utilsXml from '../utils/xml.js';\nimport type {Workspace} from '../workspace.js';\nimport * as Xml from '../xml.js';\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a workspace comment has been deleted.\n */\nexport class CommentDelete extends CommentBase {\n  override type = EventType.COMMENT_DELETE;\n\n  /** The XML representation of the deleted workspace comment. */\n  xml?: Element;\n\n  /** The JSON representation of the created workspace comment. */\n  json?: comments.State;\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 = Xml.saveWorkspaceComment(opt_comment);\n    this.json = comments.save(opt_comment, {addCoordinates: true});\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  /**\n   * Encode the event as JSON.\n   *\n   * @returns JSON representation.\n   */\n  override toJson(): CommentDeleteJson {\n    const json = super.toJson() as CommentDeleteJson;\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    }\n    if (!this.json) {\n      throw new Error(\n        'The comment JSON is undefined. Either pass a block to ' +\n          'the constructor, or call fromJson',\n      );\n    }\n    json['xml'] = Xml.domToText(this.xml);\n    json['json'] = this.json;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentDelete, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentDeleteJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentDelete {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentDelete(),\n    ) as CommentDelete;\n    newEvent.xml = utilsXml.textToDom(json['xml']);\n    newEvent.json = json['json'];\n    return newEvent;\n  }\n}\n\nexport interface CommentDeleteJson extends CommentBaseJson {\n  xml: string;\n  json: object;\n}\n\nregistry.register(registry.Type.EVENT, EventType.COMMENT_DELETE, CommentDelete);\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Events fired when a workspace comment is dragged.\n */\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as registry from '../registry.js';\nimport {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners when a comment is being manually dragged/dropped.\n */\nexport class CommentDrag extends UiBase {\n  /** The ID of the top-level comment being dragged. */\n  commentId?: string;\n\n  /** True if this is the start of a drag, false if this is the end of one. */\n  isStart?: boolean;\n\n  override type = EventType.COMMENT_DRAG;\n\n  /**\n   * @param opt_comment The comment that is being dragged.\n   *     Undefined for a blank event.\n   * @param opt_isStart Whether this is the start of a comment drag.\n   *    Undefined for a blank event.\n   */\n  constructor(opt_comment?: WorkspaceComment, opt_isStart?: boolean) {\n    const workspaceId = opt_comment ? opt_comment.workspace.id : undefined;\n    super(workspaceId);\n    if (!opt_comment) return;\n\n    this.commentId = opt_comment.id;\n    this.isStart = opt_isStart;\n  }\n\n  /**\n   * Encode the event as JSON.\n   *\n   * @returns JSON representation.\n   */\n  override toJson(): CommentDragJson {\n    const json = super.toJson() as CommentDragJson;\n    if (this.isStart === undefined) {\n      throw new Error(\n        'Whether this event is the start of a drag is undefined. ' +\n          'Either pass the value to the constructor, or call fromJson',\n      );\n    }\n    if (this.commentId === undefined) {\n      throw new Error(\n        'The comment ID is undefined. Either pass a comment to ' +\n          'the constructor, or call fromJson',\n      );\n    }\n    json['isStart'] = this.isStart;\n    json['commentId'] = this.commentId;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentDrag, but we can't specify that due to the fact that parameters\n   *     to static methods in subclasses must be supertypes of parameters to\n   *     static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentDragJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentDrag {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentDrag(),\n    ) as CommentDrag;\n    newEvent.isStart = json['isStart'];\n    newEvent.commentId = json['commentId'];\n    return newEvent;\n  }\n}\n\nexport interface CommentDragJson extends AbstractEventJson {\n  isStart: boolean;\n  commentId: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.COMMENT_DRAG, CommentDrag);\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 */\n// Former goog.module ID: Blockly.Events.CommentMove\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as registry from '../registry.js';\nimport {Coordinate} from '../utils/coordinate.js';\nimport type {Workspace} from '../workspace.js';\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a workspace comment has moved.\n */\nexport class CommentMove extends CommentBase {\n  override type = EventType.COMMENT_MOVE;\n\n  /** The comment that is being moved. */\n  comment_?: WorkspaceComment;\n\n  // TODO(#6774): We should remove underscores.\n  /** The location of the comment before the move, in workspace coordinates. */\n  oldCoordinate_?: Coordinate;\n\n  /** The location of the comment after the move, in workspace coordinates. */\n  newCoordinate_?: Coordinate;\n\n  /**\n   * An explanation of what this move is for.  Known values include:\n   *  'drag' -- A drag operation completed.\n   *  'snap' -- Comment got shifted to line up with the grid.\n   *  'inbounds' -- Block got pushed back into a non-scrolling workspace.\n   *  'create' -- Block created via deserialization.\n   *  'cleanup' -- Workspace aligned top-level blocks.\n   * Event merging may create multiple reasons: ['drag', 'inbounds', 'snap'].\n   */\n  reason?: string[];\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    this.comment_ = opt_comment;\n    this.oldCoordinate_ = opt_comment.getRelativeToSurfaceXY();\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    }\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    }\n    this.newCoordinate_ = this.comment_.getRelativeToSurfaceXY();\n  }\n\n  /**\n   * Sets the reason for a move event.\n   *\n   * @param reason Why is this move happening?  'drag', 'bump', 'snap', ...\n   */\n  setReason(reason: string[]) {\n    this.reason = reason;\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    }\n    if (!this.newCoordinate_) {\n      throw new Error(\n        'The new comment position is undefined. Either call recordNew, or ' +\n          'call fromJson',\n      );\n    }\n    json['oldCoordinate'] =\n      `${Math.round(this.oldCoordinate_.x)}, ` +\n      `${Math.round(this.oldCoordinate_.y)}`;\n    json['newCoordinate'] =\n      Math.round(this.newCoordinate_.x) +\n      ',' +\n      Math.round(this.newCoordinate_.y);\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentMove, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentMoveJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentMove {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentMove(),\n    ) as CommentMove;\n    let xy = json['oldCoordinate'].split(',');\n    newEvent.oldCoordinate_ = new Coordinate(Number(xy[0]), Number(xy[1]));\n    xy = json['newCoordinate'].split(',');\n    newEvent.newCoordinate_ = new Coordinate(Number(xy[0]), Number(xy[1]));\n    return newEvent;\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    }\n    // TODO: Remove cast when we update getCommentById.\n    const comment = workspace.getCommentById(\n      this.commentId,\n    ) as unknown as WorkspaceComment;\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    }\n    comment.moveTo(target);\n  }\n}\n\nexport interface CommentMoveJson extends CommentBaseJson {\n  oldCoordinate: string;\n  newCoordinate: string;\n}\n\nregistry.register(registry.Type.EVENT, EventType.COMMENT_MOVE, CommentMove);\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for comment resize event.\n */\n\nimport type {WorkspaceComment} from '../comments/workspace_comment.js';\nimport * as registry from '../registry.js';\nimport {Size} from '../utils/size.js';\nimport type {Workspace} from '../workspace.js';\nimport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a workspace comment has resized.\n */\nexport class CommentResize extends CommentBase {\n  override type = EventType.COMMENT_RESIZE;\n\n  /** The size of the comment before the resize. */\n  oldSize?: Size;\n\n  /** The size of the comment after the resize. */\n  newSize?: Size;\n\n  /**\n   * @param opt_comment The comment that is being resized. 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    this.oldSize = opt_comment.getSize();\n  }\n\n  /**\n   * Record the comment's new size. Called after the resize. Can only be\n   * called once.\n   */\n  recordCurrentSizeAsNewSize() {\n    if (this.newSize) {\n      throw Error(\n        'Tried to record the new size of a comment on the ' +\n          'same event twice.',\n      );\n    }\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    }\n    const comment = workspace.getCommentById(this.commentId);\n    if (!comment) {\n      throw new Error(\n        'The comment associated with the comment resize event ' +\n          'could not be found',\n      );\n    }\n    this.newSize = comment.getSize();\n  }\n\n  /**\n   * Encode the event as JSON.\n   *\n   * @returns JSON representation.\n   */\n  override toJson(): CommentResizeJson {\n    const json = super.toJson() as CommentResizeJson;\n    if (!this.oldSize) {\n      throw new Error(\n        'The old comment size is undefined. Either pass a comment to ' +\n          'the constructor, or call fromJson',\n      );\n    }\n    if (!this.newSize) {\n      throw new Error(\n        'The new comment size is undefined. Either call ' +\n          'recordCurrentSizeAsNewSize, or call fromJson',\n      );\n    }\n    json['oldWidth'] = Math.round(this.oldSize.width);\n    json['oldHeight'] = Math.round(this.oldSize.height);\n    json['newWidth'] = Math.round(this.newSize.width);\n    json['newHeight'] = Math.round(this.newSize.height);\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of CommentResize, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: CommentResizeJson,\n    workspace: Workspace,\n    event?: any,\n  ): CommentResize {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new CommentResize(),\n    ) as CommentResize;\n    newEvent.oldSize = new Size(json['oldWidth'], json['oldHeight']);\n    newEvent.newSize = new Size(json['newWidth'], json['newHeight']);\n    return newEvent;\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 Size.equals(this.oldSize, this.newSize);\n  }\n\n  /**\n   * Run a resize 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    }\n    const comment = workspace.getCommentById(this.commentId);\n    if (!comment) {\n      console.warn(\"Can't resize non-existent comment: \" + this.commentId);\n      return;\n    }\n\n    const size = forward ? this.newSize : this.oldSize;\n    if (!size) {\n      throw new Error(\n        'Either oldSize or newSize is undefined. ' +\n          'Either pass a comment to the constructor and call ' +\n          'recordCurrentSizeAsNewSize, or call fromJson',\n      );\n    }\n    comment.setSize(size);\n  }\n}\n\nexport interface CommentResizeJson extends CommentBaseJson {\n  oldWidth: number;\n  oldHeight: number;\n  newWidth: number;\n  newHeight: number;\n}\n\nregistry.register(registry.Type.EVENT, EventType.COMMENT_RESIZE, CommentResize);\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 */\n// Former goog.module ID: Blockly.Events.ToolboxItemSelect\n\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {AbstractEventJson} from './events_abstract.js';\nimport {UiBase} from './events_ui_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a toolbox item has been selected.\n */\nexport class ToolboxItemSelect extends UiBase {\n  /** The previously selected toolbox item. */\n  oldItem?: string;\n\n  /** The newly selected toolbox item. */\n  newItem?: string;\n\n  override type = EventType.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,\n    opt_newItem?: string | null,\n    opt_workspaceId?: string,\n  ) {\n    super(opt_workspaceId);\n    this.oldItem = opt_oldItem ?? undefined;\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   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of ToolboxItemSelect, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: ToolboxItemSelectJson,\n    workspace: Workspace,\n    event?: any,\n  ): ToolboxItemSelect {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new ToolboxItemSelect(),\n    ) as ToolboxItemSelect;\n    newEvent.oldItem = json['oldItem'];\n    newEvent.newItem = json['newItem'];\n    return newEvent;\n  }\n}\n\nexport interface ToolboxItemSelectJson extends AbstractEventJson {\n  oldItem?: string;\n  newItem?: string;\n}\n\nregistry.register(\n  registry.Type.EVENT,\n  EventType.TOOLBOX_ITEM_SELECT,\n  ToolboxItemSelect,\n);\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Class for a variable type change event.\n *\n * @class\n */\n\nimport type {\n  IVariableModel,\n  IVariableState,\n} from '../interfaces/i_variable_model.js';\nimport * as registry from '../registry.js';\n\nimport type {Workspace} from '../workspace.js';\nimport {VarBase, VarBaseJson} from './events_var_base.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners that a variable's type has changed.\n */\nexport class VarTypeChange extends VarBase {\n  override type = EventType.VAR_TYPE_CHANGE;\n\n  /**\n   * @param variable The variable whose type changed. Undefined for a blank event.\n   * @param oldType The old type of the variable. Undefined for a blank event.\n   * @param newType The new type of the variable. Undefined for a blank event.\n   */\n  constructor(\n    variable?: IVariableModel<IVariableState>,\n    public oldType?: string,\n    public newType?: string,\n  ) {\n    super(variable);\n  }\n\n  /**\n   * Encode the event as JSON.\n   *\n   * @returns JSON representation.\n   */\n  override toJson(): VarTypeChangeJson {\n    const json = super.toJson() as VarTypeChangeJson;\n    if (!this.oldType || !this.newType) {\n      throw new Error(\n        \"The variable's types are undefined. Either pass them to \" +\n          'the constructor, or call fromJson',\n      );\n    }\n    json['oldType'] = this.oldType;\n    json['newType'] = this.newType;\n    return json;\n  }\n\n  /**\n   * Deserializes the JSON event.\n   *\n   * @param event The event to append new properties to. Should be a subclass\n   *     of VarTypeChange, but we can't specify that due to the fact that\n   *     parameters to static methods in subclasses must be supertypes of\n   *     parameters to static methods in superclasses.\n   * @internal\n   */\n  static fromJson(\n    json: VarTypeChangeJson,\n    workspace: Workspace,\n    event?: any,\n  ): VarTypeChange {\n    const newEvent = super.fromJson(\n      json,\n      workspace,\n      event ?? new VarTypeChange(),\n    ) as VarTypeChange;\n    newEvent.oldType = json['oldType'];\n    newEvent.newType = json['newType'];\n    return newEvent;\n  }\n\n  /**\n   * Run a variable type 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.varId) {\n      throw new Error(\n        'The var ID is undefined. Either pass a variable to ' +\n          'the constructor, or call fromJson',\n      );\n    }\n    if (!this.oldType || !this.newType) {\n      throw new Error(\n        \"The variable's types are undefined. Either pass them to \" +\n          'the constructor, or call fromJson',\n      );\n    }\n    const variable = workspace.getVariableMap().getVariableById(this.varId);\n    if (!variable) return;\n    if (forward) {\n      workspace.getVariableMap().changeVariableType(variable, this.newType);\n    } else {\n      workspace.getVariableMap().changeVariableType(variable, this.oldType);\n    }\n  }\n}\n\nexport interface VarTypeChangeJson extends VarBaseJson {\n  oldType: string;\n  newType: string;\n}\n\nregistry.register(\n  registry.Type.EVENT,\n  EventType.VAR_TYPE_CHANGE,\n  VarTypeChange,\n);\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 */\n// Former goog.module ID: Blockly.Events.FinishedLoading\n\nimport * as registry from '../registry.js';\nimport type {Workspace} from '../workspace.js';\nimport {Abstract as AbstractEvent} from './events_abstract.js';\nimport {EventType} from './type.js';\n\n/**\n * Notifies listeners when the workspace has finished deserializing from\n * JSON/XML.\n */\nexport class FinishedLoading extends AbstractEvent {\n  override isBlank = true;\n  override recordUndo = false;\n  override type = EventType.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    this.isBlank = !!opt_workspace;\n\n    if (!opt_workspace) return;\n\n    this.workspaceId = opt_workspace.id;\n  }\n}\n\nregistry.register(\n  registry.Type.EVENT,\n  EventType.FINISHED_LOADING,\n  FinishedLoading,\n);\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Events\n\nimport {EventType} from './type.js';\n\n// Events.\nexport {Abstract, AbstractEventJson} from './events_abstract.js';\nexport {BlockBase, BlockBaseJson} from './events_block_base.js';\nexport {BlockChange, BlockChangeJson} from './events_block_change.js';\nexport {BlockCreate, BlockCreateJson} from './events_block_create.js';\nexport {BlockDelete, BlockDeleteJson} from './events_block_delete.js';\nexport {BlockDrag, BlockDragJson} from './events_block_drag.js';\nexport {\n  BlockFieldIntermediateChange,\n  BlockFieldIntermediateChangeJson,\n} from './events_block_field_intermediate_change.js';\nexport {BlockMove, BlockMoveJson} from './events_block_move.js';\nexport {BubbleOpen, BubbleOpenJson, BubbleType} from './events_bubble_open.js';\nexport {Click, ClickJson, ClickTarget} from './events_click.js';\nexport {CommentBase, CommentBaseJson} from './events_comment_base.js';\nexport {CommentChange, CommentChangeJson} from './events_comment_change.js';\nexport {\n  CommentCollapse,\n  CommentCollapseJson,\n} from './events_comment_collapse.js';\nexport {CommentCreate, CommentCreateJson} from './events_comment_create.js';\nexport {CommentDelete} from './events_comment_delete.js';\nexport {CommentDrag, CommentDragJson} from './events_comment_drag.js';\nexport {CommentMove, CommentMoveJson} from './events_comment_move.js';\nexport {CommentResize, CommentResizeJson} from './events_comment_resize.js';\nexport {Selected, SelectedJson} from './events_selected.js';\nexport {ThemeChange, ThemeChangeJson} from './events_theme_change.js';\nexport {\n  ToolboxItemSelect,\n  ToolboxItemSelectJson,\n} from './events_toolbox_item_select.js';\n\n// Events.\nexport {TrashcanOpen, TrashcanOpenJson} from './events_trashcan_open.js';\nexport {UiBase} from './events_ui_base.js';\nexport {VarBase, VarBaseJson} from './events_var_base.js';\nexport {VarCreate, VarCreateJson} from './events_var_create.js';\nexport {VarDelete, VarDeleteJson} from './events_var_delete.js';\nexport {VarRename, VarRenameJson} from './events_var_rename.js';\nexport {VarTypeChange, VarTypeChangeJson} from './events_var_type_change.js';\nexport {ViewportChange, ViewportChangeJson} from './events_viewport.js';\nexport {FinishedLoading} from './workspace_events.js';\n\nexport type {BumpEvent} from './utils.js';\n\n// Event types.\nexport const BLOCK_CHANGE = EventType.BLOCK_CHANGE;\nexport const BLOCK_CREATE = EventType.BLOCK_CREATE;\nexport const BLOCK_DELETE = EventType.BLOCK_DELETE;\nexport const BLOCK_DRAG = EventType.BLOCK_DRAG;\nexport const BLOCK_MOVE = EventType.BLOCK_MOVE;\nexport const BLOCK_FIELD_INTERMEDIATE_CHANGE =\n  EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE;\nexport const BUBBLE_OPEN = EventType.BUBBLE_OPEN;\n/** @deprecated Use BLOCK_CHANGE instead */\nexport const CHANGE = EventType.BLOCK_CHANGE;\nexport const CLICK = EventType.CLICK;\nexport const COMMENT_CHANGE = EventType.COMMENT_CHANGE;\nexport const COMMENT_CREATE = EventType.COMMENT_CREATE;\nexport const COMMENT_DELETE = EventType.COMMENT_DELETE;\nexport const COMMENT_MOVE = EventType.COMMENT_MOVE;\nexport const COMMENT_RESIZE = EventType.COMMENT_RESIZE;\nexport const COMMENT_DRAG = EventType.COMMENT_DRAG;\n/** @deprecated Use BLOCK_CREATE instead */\nexport const CREATE = EventType.BLOCK_CREATE;\n/** @deprecated Use BLOCK_DELETE instead */\nexport const DELETE = EventType.BLOCK_DELETE;\nexport const FINISHED_LOADING = EventType.FINISHED_LOADING;\n/** @deprecated Use BLOCK_MOVE instead */\nexport const MOVE = EventType.BLOCK_MOVE;\nexport const SELECTED = EventType.SELECTED;\nexport const THEME_CHANGE = EventType.THEME_CHANGE;\nexport const TOOLBOX_ITEM_SELECT = EventType.TOOLBOX_ITEM_SELECT;\nexport const TRASHCAN_OPEN = EventType.TRASHCAN_OPEN;\nexport const UI = EventType.UI;\nexport const VAR_CREATE = EventType.VAR_CREATE;\nexport const VAR_DELETE = EventType.VAR_DELETE;\nexport const VAR_RENAME = EventType.VAR_RENAME;\nexport const VIEWPORT_CHANGE = EventType.VIEWPORT_CHANGE;\n\nexport {BUMP_EVENTS} from './type.js';\n\n// Event utils.\nexport {\n  clearPendingUndo,\n  disable,\n  disableOrphans,\n  enable,\n  filter,\n  fire,\n  fromJson,\n  get,\n  getDescendantIds,\n  getGroup,\n  getRecordUndo,\n  isEnabled,\n  setGroup,\n  setRecordUndo,\n} from './utils.js';\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// Former goog.module ID: Blockly.zelos\n\nimport {ConstantProvider} from './constants.js';\nimport {Drawer} from './drawer.js';\nimport {RenderInfo} from './info.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\nexport {\n  BottomRow,\n  ConstantProvider,\n  Drawer,\n  PathObject,\n  Renderer,\n  RenderInfo,\n  RightConnectionShape,\n  StatementInput,\n  TopRow,\n};\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {FlyoutButton} from './flyout_button.js';\nimport {FlyoutItem} from './flyout_item.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js';\nimport * as registry from './registry.js';\nimport {ButtonOrLabelInfo} from './utils/toolbox.js';\n\nconst BUTTON_TYPE = 'button';\n\n/**\n * Class responsible for creating buttons for flyouts.\n */\nexport class ButtonFlyoutInflater implements IFlyoutInflater {\n  /**\n   * Inflates a flyout button from the given state and adds it to the flyout.\n   *\n   * @param state A JSON representation of a flyout button.\n   * @param flyout The flyout to create the button on.\n   * @returns A newly created FlyoutButton.\n   */\n  load(state: object, flyout: IFlyout): FlyoutItem {\n    const button = new FlyoutButton(\n      flyout.getWorkspace(),\n      flyout.targetWorkspace!,\n      state as ButtonOrLabelInfo,\n      false,\n    );\n    button.show();\n\n    return new FlyoutItem(button, BUTTON_TYPE);\n  }\n\n  /**\n   * Returns the amount of space that should follow this button.\n   *\n   * @param state A JSON representation of a flyout button.\n   * @param defaultGap The default spacing for flyout items.\n   * @returns The amount of space that should follow this button.\n   */\n  gapForItem(state: object, defaultGap: number): number {\n    return defaultGap;\n  }\n\n  /**\n   * Disposes of the given button.\n   *\n   * @param item The flyout button to dispose of.\n   */\n  disposeItem(item: FlyoutItem): void {\n    const element = item.getElement();\n    if (element instanceof FlyoutButton) {\n      element.dispose();\n    }\n  }\n\n  /**\n   * Returns the type of items this inflater is responsible for creating.\n   *\n   * @returns An identifier for the type of items this inflater creates.\n   */\n  getType() {\n    return BUTTON_TYPE;\n  }\n}\n\nregistry.register(\n  registry.Type.FLYOUT_INFLATER,\n  BUTTON_TYPE,\n  ButtonFlyoutInflater,\n);\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Bubble} from './bubbles/bubble.js';\nimport {MiniWorkspaceBubble} from './bubbles/mini_workspace_bubble.js';\nimport {TextBubble} from './bubbles/text_bubble.js';\nimport {TextInputBubble} from './bubbles/textinput_bubble.js';\n\nexport {Bubble, MiniWorkspaceBubble, TextBubble, TextInputBubble};\n","/**\n * @license\n * Copyright 2016 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.BlocklyOptions\n\nimport type {ITheme, Theme} from './theme.js';\nimport type {ToolboxDefinition} from './utils/toolbox.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\n\n/**\n * Blockly options.\n */\nexport interface BlocklyOptions {\n  collapse?: boolean;\n  comments?: boolean;\n  css?: boolean;\n  disable?: boolean;\n  grid?: GridOptions;\n  horizontalLayout?: boolean;\n  maxBlocks?: number;\n  maxInstances?: {[blockType: string]: number};\n  media?: string;\n  modalInputs?: boolean;\n  move?: MoveOptions;\n  oneBasedIndex?: boolean;\n  readOnly?: boolean;\n  renderer?: string;\n  rendererOverrides?: {[rendererConstant: string]: any};\n  rtl?: boolean;\n  scrollbars?: ScrollbarOptions | boolean;\n  sounds?: boolean;\n  theme?: Theme | string | ITheme;\n  toolbox?: string | ToolboxDefinition | Element;\n  toolboxPosition?: string;\n  trashcan?: boolean;\n  maxTrashcanContents?: number;\n  plugins?: {[key: string]: (new (...p1: any[]) => any) | string};\n  zoom?: ZoomOptions;\n  parentWorkspace?: WorkspaceSvg;\n}\n\nexport interface GridOptions {\n  colour?: string;\n  length?: number;\n  snap?: boolean;\n  spacing?: number;\n}\n\nexport interface MoveOptions {\n  drag?: boolean;\n  scrollbars?: boolean | ScrollbarOptions;\n  wheel?: boolean;\n}\n\nexport interface ScrollbarOptions {\n  horizontal?: boolean;\n  vertical?: boolean;\n}\n\nexport 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 * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BlockSvg} from './block_svg.js';\nimport * as browserEvents from './browser_events.js';\nimport * as common from './common.js';\nimport {MANUALLY_DISABLED} from './constants.js';\nimport type {Abstract as AbstractEvent} from './events/events_abstract.js';\nimport {EventType} from './events/type.js';\nimport {FlyoutItem} from './flyout_item.js';\nimport type {IFlyout} from './interfaces/i_flyout.js';\nimport type {IFlyoutInflater} from './interfaces/i_flyout_inflater.js';\nimport * as registry from './registry.js';\nimport * as blocks from './serialization/blocks.js';\nimport type {BlockInfo} from './utils/toolbox.js';\nimport * as utilsXml from './utils/xml.js';\nimport type {WorkspaceSvg} from './workspace_svg.js';\nimport * as Xml from './xml.js';\n\n/**\n * The language-neutral ID for when the reason why a block is disabled is\n * because the workspace is at block capacity.\n */\nconst WORKSPACE_AT_BLOCK_CAPACITY_DISABLED_REASON =\n  'WORKSPACE_AT_BLOCK_CAPACITY';\n\nconst BLOCK_TYPE = 'block';\n\n/**\n * Class responsible for creating blocks for flyouts.\n */\nexport class BlockFlyoutInflater implements IFlyoutInflater {\n  protected permanentlyDisabledBlocks = new Set<BlockSvg>();\n  protected listeners = new Map<string, browserEvents.Data[]>();\n  protected flyout?: IFlyout;\n  private capacityWrapper: (event: AbstractEvent) => void;\n\n  /**\n   * Creates a new BlockFlyoutInflater instance.\n   */\n  constructor() {\n    this.capacityWrapper = this.filterFlyoutBasedOnCapacity.bind(this);\n  }\n\n  /**\n   * Inflates a flyout block from the given state and adds it to the flyout.\n   *\n   * @param state A JSON representation of a flyout block.\n   * @param flyout The flyout to create the block on.\n   * @returns A newly created block.\n   */\n  load(state: object, flyout: IFlyout): FlyoutItem {\n    this.setFlyout(flyout);\n    const block = this.createBlock(state as BlockInfo, flyout.getWorkspace());\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.permanentlyDisabledBlocks.add(block);\n    } else {\n      this.updateStateBasedOnCapacity(block);\n    }\n\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    block.getDescendants(false).forEach((b) => (b.isInFlyout = true));\n    this.addBlockListeners(block);\n\n    return new FlyoutItem(block, BLOCK_TYPE);\n  }\n\n  /**\n   * Creates a block on the given workspace.\n   *\n   * @param blockDefinition A JSON representation of the block to create.\n   * @param workspace The workspace to create the block on.\n   * @returns The newly created block.\n   */\n  createBlock(blockDefinition: BlockInfo, workspace: WorkspaceSvg): BlockSvg {\n    let block;\n    if (blockDefinition['blockxml']) {\n      const xml = (\n        typeof blockDefinition['blockxml'] === 'string'\n          ? utilsXml.textToDom(blockDefinition['blockxml'])\n          : blockDefinition['blockxml']\n      ) as Element;\n      block = Xml.domToBlockInternal(xml, workspace);\n    } else {\n      if (blockDefinition['enabled'] === undefined) {\n        blockDefinition['enabled'] =\n          blockDefinition['disabled'] !== 'true' &&\n          blockDefinition['disabled'] !== true;\n      }\n      if (\n        blockDefinition['disabledReasons'] === undefined &&\n        blockDefinition['enabled'] === false\n      ) {\n        blockDefinition['disabledReasons'] = [MANUALLY_DISABLED];\n      }\n      // These fields used to be allowed and may still be present, but are\n      // ignored here since everything in the flyout should always be laid out\n      // linearly.\n      if ('x' in blockDefinition) {\n        delete blockDefinition['x'];\n      }\n      if ('y' in blockDefinition) {\n        delete blockDefinition['y'];\n      }\n      block = blocks.appendInternal(blockDefinition as blocks.State, workspace);\n    }\n\n    return block as BlockSvg;\n  }\n\n  /**\n   * Returns the amount of space that should follow this block.\n   *\n   * @param state A JSON representation of a flyout block.\n   * @param defaultGap The default spacing for flyout items.\n   * @returns The amount of space that should follow this block.\n   */\n  gapForItem(state: object, defaultGap: number): number {\n    const blockState = state as BlockInfo;\n    let gap;\n    if (blockState['gap']) {\n      gap = parseInt(String(blockState['gap']));\n    } else if (blockState['blockxml']) {\n      const xml = (\n        typeof blockState['blockxml'] === 'string'\n          ? utilsXml.textToDom(blockState['blockxml'])\n          : blockState['blockxml']\n      ) as Element;\n      gap = parseInt(xml.getAttribute('gap')!);\n    }\n\n    return !gap || isNaN(gap) ? defaultGap : gap;\n  }\n\n  /**\n   * Disposes of the given block.\n   *\n   * @param item The flyout block to dispose of.\n   */\n  disposeItem(item: FlyoutItem): void {\n    const element = item.getElement();\n    if (!(element instanceof BlockSvg)) return;\n    this.removeListeners(element.id);\n    element.dispose(false, false);\n  }\n\n  /**\n   * Removes event listeners for the block with the given ID.\n   *\n   * @param blockId The ID of the block to remove event listeners from.\n   */\n  protected removeListeners(blockId: string) {\n    const blockListeners = this.listeners.get(blockId) ?? [];\n    blockListeners.forEach((l) => browserEvents.unbind(l));\n    this.listeners.delete(blockId);\n  }\n\n  /**\n   * Updates this inflater's flyout.\n   *\n   * @param flyout The flyout that owns this inflater.\n   */\n  protected setFlyout(flyout: IFlyout) {\n    if (this.flyout === flyout) return;\n\n    if (this.flyout) {\n      this.flyout.targetWorkspace?.removeChangeListener(this.capacityWrapper);\n    }\n    this.flyout = flyout;\n    this.flyout.targetWorkspace?.addChangeListener(this.capacityWrapper);\n  }\n\n  /**\n   * Updates the enabled state of the given block based on the capacity of the\n   * workspace.\n   *\n   * @param block The block to update the enabled/disabled state of.\n   */\n  private updateStateBasedOnCapacity(block: BlockSvg) {\n    const enable = this.flyout?.targetWorkspace?.isCapacityAvailable(\n      common.getBlockTypeCounts(block),\n    );\n    let currentBlock: BlockSvg | null = block;\n    while (currentBlock) {\n      currentBlock.setDisabledReason(\n        !enable,\n        WORKSPACE_AT_BLOCK_CAPACITY_DISABLED_REASON,\n      );\n      currentBlock = currentBlock.getNextBlock();\n    }\n  }\n\n  /**\n   * Add listeners to a block that has been added to the flyout.\n   *\n   * @param block The block to add listeners for.\n   */\n  protected addBlockListeners(block: BlockSvg) {\n    const blockListeners = [];\n\n    blockListeners.push(\n      browserEvents.conditionalBind(\n        block.getSvgRoot(),\n        'pointerdown',\n        block,\n        (e: PointerEvent) => {\n          const gesture = this.flyout?.targetWorkspace?.getGesture(e);\n          if (gesture && this.flyout) {\n            gesture.setStartBlock(block);\n            gesture.handleFlyoutStart(e, this.flyout);\n          }\n        },\n      ),\n    );\n\n    blockListeners.push(\n      browserEvents.bind(block.getSvgRoot(), 'pointermove', null, () => {\n        if (!this.flyout?.targetWorkspace?.isDragging()) {\n          block.addSelect();\n        }\n      }),\n    );\n    blockListeners.push(\n      browserEvents.bind(block.getSvgRoot(), 'pointerleave', null, () => {\n        if (!this.flyout?.targetWorkspace?.isDragging()) {\n          block.removeSelect();\n        }\n      }),\n    );\n\n    this.listeners.set(block.id, blockListeners);\n  }\n\n  /**\n   * Updates the state of blocks in our owning flyout to be disabled/enabled\n   * based on the capacity of the workspace for more blocks of that type.\n   *\n   * @param event The event that triggered this update.\n   */\n  private filterFlyoutBasedOnCapacity(event: AbstractEvent) {\n    if (\n      !this.flyout ||\n      (event &&\n        !(\n          event.type === EventType.BLOCK_CREATE ||\n          event.type === EventType.BLOCK_DELETE\n        ))\n    )\n      return;\n\n    this.flyout\n      .getWorkspace()\n      .getTopBlocks(false)\n      .forEach((block) => {\n        if (!this.permanentlyDisabledBlocks.has(block)) {\n          this.updateStateBasedOnCapacity(block);\n        }\n      });\n  }\n\n  /**\n   * Returns the type of items this inflater is responsible for creating.\n   *\n   * @returns An identifier for the type of items this inflater creates.\n   */\n  getType() {\n    return BLOCK_TYPE;\n  }\n}\n\nregistry.register(\n  registry.Type.FLYOUT_INFLATER,\n  BLOCK_TYPE,\n  BlockFlyoutInflater,\n);\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.geras.ConstantProvider\n\nimport {ConstantProvider as BaseConstantProvider} from '../common/constants.js';\n\n/**\n * An object that provides constants for rendering blocks in Geras mode.\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  constructor() {\n    super();\n  }\n\n  override getCSS_(selector: string) {\n    return super.getCSS_(selector).concat([\n      // Insertion marker.\n      `${selector} .blocklyInsertionMarker>.blocklyPathLight,`,\n      `${selector} .blocklyInsertionMarker>.blocklyPathDark {`,\n      `fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,\n      `stroke: none;`,\n      '}',\n    ]);\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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';\nimport type {\n  HighlightConstantProvider,\n  InsideCorner,\n  JaggedTeeth,\n  Notch,\n  OutsideCorner,\n  PuzzleTab,\n  StartHat,\n} from './highlight_constants.js';\nimport type {RenderInfo} from './info.js';\nimport type {InlineInput} from './measurables/inline_input.js';\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 */\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   */\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   */\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   */\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',\n          elem.xPos + elem.width - this.highlightOffset,\n        );\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   */\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   */\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,\n          row.yPos,\n        ) +\n        this.puzzleTabPaths_.pathDown(this.RTL_) +\n        svgPaths.lineOnAxis('v', belowTabHeight);\n    } else {\n      this.steps_ +=\n        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   */\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_ +=\n        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,\n          0,\n        );\n    } else {\n      this.steps_ +=\n        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,\n          0,\n        );\n    }\n  }\n\n  /**\n   * Add a highlight on the right side of a row.\n   *\n   * @param row The row to highlight.\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',\n          row.yPos + row.height - this.highlightOffset,\n        );\n      }\n    }\n  }\n\n  /**\n   * Add a highlight to the bottom row.\n   *\n   * @param row The row to highlight.\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_ += svgPaths.lineOnAxis(\n        'V',\n        row.baseline - this.highlightOffset,\n      );\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        );\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  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_ += svgPaths.lineOnAxis(\n          'V',\n          this.outsideCornerPaths_.height,\n        );\n      } else {\n        this.steps_ += svgPaths.lineOnAxis(\n          'V',\n          topRow.capline + this.highlightOffset,\n        );\n      }\n    }\n  }\n\n  /**\n   * Add a highlight to an inline input.\n   *\n   * @param input The input to highlight.\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 =\n        input.height -\n        (input.connectionOffsetY + input.connectionHeight) +\n        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(input.xPos + input.width + offset, startY) + // Highlight right edge, bottom.\n        svgPaths.lineOnAxis('v', input.height) +\n        svgPaths.lineOnAxis('h', -bottomHighlightWidth) + // Go to top of tab.\n        svgPaths.moveTo(connectionRight, 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// Former goog.module ID: Blockly.geras.Drawer\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport {Drawer as BaseDrawer} from '../common/drawer.js';\nimport type {Row} from '../measurables/row.js';\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 * An object that draws a block based on the given rendering information,\n * customized for the geras renderer.\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   */\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.drawOutline_();\n    this.drawInternals_();\n    this.updateConnectionHighlights();\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    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_ +=\n      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);\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\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,\n        row.yPos + this.constants_.DARK_PATH_OFFSET,\n      );\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,\n        bottomRow.baseline + this.constants_.DARK_PATH_OFFSET,\n      );\n    }\n  }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.geras.HighlightConstantProvider\n\nimport * as svgPaths from '../../utils/svg_paths.js';\nimport type {ConstantProvider} from '../common/constants.js';\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 */\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   */\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    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  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   */\n  protected 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 =\n      svgPaths.moveBy(distance45outside, distance45outside) +\n      svgPaths.arc(\n        'a',\n        '0 0,0',\n        radius,\n        svgPaths.point(-distance45outside - offset, radius - distance45outside),\n      );\n\n    const pathBottomRtl = svgPaths.arc(\n      'a',\n      '0 0,0',\n      radius + offset,\n      svgPaths.point(radius + offset, radius + offset),\n    );\n\n    const pathBottomLtr =\n      svgPaths.moveBy(distance45outside, -distance45outside) +\n      svgPaths.arc(\n        'a',\n        '0 0,0',\n        radius + offset,\n        svgPaths.point(radius - distance45outside, distance45outside + offset),\n      );\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   */\n  protected 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',\n        '0 0,1',\n        radius - offset,\n        svgPaths.point(radius - topLeftStartX, -topLeftStartY + offset),\n      );\n    /**\n     * SVG path for drawing the highlight on the rounded top-left corner.\n     */\n    const topLeftCornerHighlightLtr =\n      svgPaths.moveBy(offset, radius) +\n      svgPaths.arc(\n        'a',\n        '0 0,1',\n        radius - offset,\n        svgPaths.point(radius, -radius + offset),\n      );\n\n    const bottomLeftStartX = distance45inside;\n    const bottomLeftStartY = -distance45inside;\n    const bottomLeftPath =\n      svgPaths.moveBy(bottomLeftStartX, bottomLeftStartY) +\n      svgPaths.arc(\n        'a',\n        '0 0,1',\n        radius - offset,\n        svgPaths.point(-bottomLeftStartX + offset, -bottomLeftStartY - radius),\n      );\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   */\n  protected 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 =\n      svgPaths.lineOnAxis('v', verticalOverlap) +\n      svgPaths.moveBy(-width * 0.97, 2.5) +\n      svgPaths.curve('q', [\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 =\n      svgPaths.lineOnAxis('v', -1.5) +\n      svgPaths.moveBy(width * -0.92, -0.5) +\n      svgPaths.curve('q', [\n        svgPaths.point(width * -0.19, -5.5),\n        svgPaths.point(0, -11),\n      ]) +\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   */\n  protected makeNotch(): Notch {\n    // This is only for the previous connection.\n    const pathLeft =\n      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   */\n  protected makeJaggedTeeth(): JaggedTeeth {\n    const pathLeft =\n      svgPaths.lineTo(5.1, 2.6) +\n      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   */\n  protected makeStartHat(): StartHat {\n    const hatHeight = this.constantProvider.START_HAT.height;\n    const pathRtl =\n      svgPaths.moveBy(25, -8.7) +\n      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 =\n      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// Former goog.module ID: Blockly.geras.InlineInput\n\nimport type {Input} from '../../../inputs/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 * An object containing information about the space an inline input takes up\n * during rendering.\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   */\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// Former goog.module ID: Blockly.geras.StatementInput\n\nimport type {Input} from '../../../inputs/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 * An object containing information about the space a statement input takes up\n * during rendering.\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   */\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// Former goog.module ID: Blockly.geras.RenderInfo\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport {DummyInput} from '../../inputs/dummy_input.js';\nimport {EndRowInput} from '../../inputs/end_row_input.js';\nimport type {Input} from '../../inputs/input.js';\nimport {StatementInput} from '../../inputs/statement_input.js';\nimport {ValueInput} from '../../inputs/value_input.js';\nimport {RenderInfo as BaseRenderInfo} from '../common/info.js';\nimport type {Measurable} from '../measurables/base.js';\nimport {ExternalValueInput} from '../measurables/external_value_input.js';\nimport {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport type {Row} from '../measurables/row.js';\nimport {Types} from '../measurables/types.js';\nimport type {ConstantProvider} from './constants.js';\nimport {InlineInput} from './measurables/inline_input.js';\nimport {StatementInput as StatementInputMeasurable} from './measurables/statement_input.js';\nimport type {Renderer} from './renderer.js';\n\n/**\n * An object containing all sizing information needed to draw this block,\n * customized for the geras renderer.\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 */\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   */\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   */\n  override getRenderer(): Renderer {\n    return this.renderer_;\n  }\n\n  override populateBottomRow_() {\n    super.populateBottomRow_();\n\n    const followsStatement =\n      this.block_.inputList.length &&\n      this.block_.inputList[this.block_.inputList.length - 1] instanceof\n        StatementInput;\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 instanceof ValueInput) {\n      activeRow.elements.push(new InlineInput(this.constants_, input));\n      activeRow.hasInlineInput = true;\n    } else if (input instanceof StatementInput) {\n      activeRow.elements.push(\n        new StatementInputMeasurable(this.constants_, input),\n      );\n      activeRow.hasStatement = true;\n    } else if (input instanceof ValueInput) {\n      activeRow.elements.push(new ExternalValueInput(this.constants_, input));\n      activeRow.hasExternalInput = true;\n    } else if (input instanceof DummyInput || input instanceof EndRowInput) {\n      // Dummy and end-row inputs have no visual representation, but the\n      // information is still important.\n      activeRow.minHeight = Math.max(\n        activeRow.minHeight,\n        this.constants_.DUMMY_INPUT_MIN_HEIGHT,\n      );\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(\n          new InRowSpacer(\n            this.constants_,\n            this.getInRowSpacing_(null, oldElems[0]),\n          ),\n        );\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 = this.getInRowSpacing_(\n          oldElems[oldElems.length - 1],\n          null,\n        );\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.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.isEditable) {\n        if (prev.width === 0) {\n          return this.constants_.NO_PADDING;\n        }\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.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.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 (\n      Types.isField(prev) &&\n      next &&\n      Types.isField(next) &&\n      prev.isEditable === next.isEditable\n    ) {\n      if (prev.width === 0) {\n        return this.constants_.NO_PADDING;\n      }\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 baseline = row.yPos + row.height - row.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      if (Types.isHat(elem)) {\n        return row.capline - elem.height / 2;\n      }\n      return row.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 (\n        (row.hasInlineInput || row.hasStatement) &&\n        elem.height + this.constants_.TALL_INPUT_FIELD_OFFSET_Y <= row.height\n      ) {\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);\n        }\n        if (\n          prevInput &&\n          prevInput.hasStatement &&\n          row.width < prevInput.width\n        ) {\n          rowNextRightEdges.set(row, prevInput.width);\n        } else if (row.hasStatement) {\n          nextRightEdge = row.width;\n        } else {\n          // To keep right edges of consecutive non-statement rows aligned, use\n          // the maximum width.\n          nextRightEdge = Math.max(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 = Math.max(\n          prevRightEdge,\n          rowNextRightEdges.get(row),\n        );\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 (\n        this.statementEdge + this.constants_.MAX_BOTTOM_WIDTH + this.startX\n      );\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 = Math.max(\n        widestRowWithConnectedBlocks,\n        row.widthWithConnectedBlocks,\n      );\n      // Add padding to the bottom row if block height is less than minimum\n      const heightWithoutHat = yCursor - this.topRow.ascenderHeight;\n      if (\n        row === this.bottomRow &&\n        heightWithoutHat < this.constants_.MIN_BLOCK_HEIGHT\n      ) {\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 (\n      this.outputConnection &&\n      this.block_.nextConnection &&\n      this.block_.nextConnection.isConnected()\n    ) {\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\n    this.bottomRow.baseline = yCursor - this.bottomRow.descenderHeight;\n    this.widthWithChildren =\n      widestRowWithConnectedBlocks +\n      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// Former goog.module ID: 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';\nimport type {ConstantProvider} from './constants.js';\n\n/**\n * An object that handles creating and setting each of the SVG elements\n * used by the renderer.\n */\nexport class PathObject extends BasePathObject {\n  svgPathDark: SVGElement;\n  svgPathLight: SVGElement;\n\n  /**\n   * The colour of the dark path on the block in '#RRGGBB' format.\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   */\n  constructor(\n    root: SVGElement,\n    style: BlockStyle,\n    public override constants: ConstantProvider,\n  ) {\n    super(root, style, constants);\n\n    /** The dark path of the block. */\n    this.svgPathDark = dom.createSvgElement(Svg.PATH, {\n      'class': 'blocklyPathDark',\n      'transform': 'translate(1,1)',\n    });\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,\n      {'class': 'blocklyPathLight'},\n      this.svgRoot,\n    );\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   */\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    }\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    super.updateHighlighted(highlighted);\n    if (highlighted) {\n      this.svgPathLight.style.display = 'none';\n    } else {\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      }\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// Former goog.module ID: 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';\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 * The geras renderer. This renderer was designed to be backwards compatible\n * with pre-2019 Blockly. Newer projects that are not constrained by backwards\n * compatibility should use thrasos, which is a more modern take on this\n * renderer.\n *\n * Geras is the ancient Greek spirit of old age.\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   */\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  override init(\n    theme: Theme,\n    opt_rendererOverrides?: {[rendererConstant: string]: any},\n  ) {\n    super.init(theme, opt_rendererOverrides);\n    this.highlightConstants = this.makeHighlightConstants_();\n    this.highlightConstants.init();\n  }\n\n  override refreshDom(\n    svg: SVGElement,\n    theme: Theme,\n    injectionDiv: HTMLElement,\n  ) {\n    super.refreshDom(svg, theme, injectionDiv);\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_(\n    block: BlockSvg,\n    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   */\n  override makePathObject(root: SVGElement, style: BlockStyle): PathObject {\n    return new PathObject(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   */\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    }\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// Former goog.module ID: 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\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 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: 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 {InRowSpacer} from '../measurables/in_row_spacer.js';\nimport type {Row} from '../measurables/row.js';\nimport {Types} from '../measurables/types.js';\nimport type {Renderer} from './renderer.js';\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 */\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   */\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   */\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(\n          new InRowSpacer(\n            this.constants_,\n            this.getInRowSpacing_(null, oldElems[0]),\n          ),\n        );\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 = this.getInRowSpacing_(\n          oldElems[oldElems.length - 1],\n          null,\n        );\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.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.isEditable) {\n        if (prev.width === 0) {\n          return this.constants_.NO_PADDING;\n        }\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.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.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 (\n      Types.isField(prev) &&\n      next &&\n      Types.isField(next) &&\n      prev.isEditable === next.isEditable\n    ) {\n      if (prev.width === 0) {\n        return this.constants_.NO_PADDING;\n      }\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 baseline = row.yPos + row.height - row.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      if (Types.isHat(elem)) {\n        return row.capline - elem.height / 2;\n      }\n      return row.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 = Math.max(\n        widestRowWithConnectedBlocks,\n        row.widthWithConnectedBlocks,\n      );\n      // Add padding to the bottom row if block height is less than minimum\n      const heightWithoutHat = yCursor - this.topRow.ascenderHeight;\n      if (\n        row === this.bottomRow &&\n        heightWithoutHat < this.constants_.MIN_BLOCK_HEIGHT\n      ) {\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 (\n      this.outputConnection &&\n      this.block_.nextConnection &&\n      this.block_.nextConnection.isConnected()\n    ) {\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,\n        );\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// Former goog.module ID: 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';\nimport {RenderInfo} from './info.js';\n\n/**\n * The thrasos renderer. This is a more modern take on the legacy geras\n * renderer.\n *\n * Thrasos is the ancient Greek spirit of boldness.\n */\nexport class Renderer extends BaseRenderer {\n  /**\n   * @param name The renderer name.\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// Former goog.module ID: Blockly.thrasos\n\nimport {RenderInfo} from './info.js';\nimport {Renderer} from './renderer.js';\n\nexport {Renderer, RenderInfo};\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.Themes.Zelos\n\nimport {Theme} from '../theme.js';\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 */\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// Former goog.module ID: Blockly.Themes\n\nimport {Classic} from './classic.js';\nimport {Zelos} from './zelos.js';\n\nexport {Classic, Zelos};\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 */\n// Former goog.module ID: Blockly.ToolboxItem\n\nimport type {ICollapsibleToolboxItem} from '../interfaces/i_collapsible_toolbox_item.js';\nimport type {IFocusableTree} from '../interfaces/i_focusable_tree.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 * Class for an item in the toolbox.\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,\n    parentToolbox: IToolbox,\n    opt_parent?: ICollapsibleToolboxItem,\n  ) {\n    /** The ID for the category. */\n    this.id_ =\n      (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  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    const div = this.getDiv();\n    if (!div) {\n      throw Error('Trying to access toolbox item before DOM is initialized.');\n    }\n    if (!(div instanceof HTMLElement)) {\n      throw Error('Toolbox item div is unexpectedly not an HTML element.');\n    }\n    return div as HTMLElement;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this.parentToolbox_;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {}\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\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 */\n// Former goog.module ID: 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 * 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 type {\n  CategoryInfo,\n  DynamicCategoryInfo,\n  FlyoutDefinition,\n  FlyoutItemInfo,\n  FlyoutItemInfoArray,\n  StaticCategoryInfo,\n} from '../utils/toolbox.js';\nimport * as toolbox from '../utils/toolbox.js';\nimport {ToolboxItem} from './toolbox_item.js';\n\n/**\n * Class for a category in a toolbox.\n */\nexport class ToolboxCategory\n  extends ToolboxItem\n  implements ISelectableToolboxItem\n{\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,\n    parentToolbox: IToolbox,\n    opt_parent?: ICollapsibleToolboxItem,\n  ) {\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': 'blocklyToolboxCategoryContainer',\n      'row': 'blocklyToolboxCategory',\n      'rowcontentcontainer': 'blocklyTreeRowContentContainer',\n      'icon': 'blocklyToolboxCategoryIcon',\n      'label': 'blocklyToolboxCategoryLabel',\n      'contents': 'blocklyToolboxCategoryGroup',\n      'selected': 'blocklyToolboxSelected',\n      'openicon': 'blocklyToolboxCategoryIconOpen',\n      'closedicon': 'blocklyToolboxCategoryIconClosed',\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_ =\n      '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  /**\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_ + 1);\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    // Ensure that the category has a tab index to ensure it receives focus when\n    // clicked (since clicking isn't managed by the toolbox).\n    container.tabIndex = -1;\n    container.id = this.getId();\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()\n    }px`;\n    if (this.workspace_.RTL) {\n      rowDiv.style.paddingRight = nestedPadding;\n    } else {\n      rowDiv.style.paddingLeft = nestedPadding;\n    }\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 \"' +\n          this.name_ +\n          '\" must not have both a style and a colour',\n      );\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    }\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 \"' +\n              this.name_ +\n              '\" has unrecognized colour attribute: ' +\n              colour,\n          );\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 = this.parseColour(\n        ToolboxCategory.defaultBackgroundColour,\n      );\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    if (isDisabled) {\n      this.getDiv()!.setAttribute('disabled', 'true');\n    } else {\n      this.getDiv()!.removeAttribute('disabled');\n    }\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:\n          'name' in this.toolboxItemDef_ ? this.toolboxItemDef_['name'] : '',\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.blocklyToolboxCategory:not(.blocklyToolboxSelected):hover {\n  background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolbox[layout=\"h\"] .blocklyToolboxCategoryContainer {\n  margin: 1px 5px 1px 0;\n}\n\n.blocklyToolbox[dir=\"RTL\"][layout=\"h\"] .blocklyToolboxCategoryContainer {\n  margin: 1px 0 1px 5px;\n}\n\n.blocklyToolboxCategory {\n  height: 22px;\n  line-height: 22px;\n  margin-bottom: 3px;\n  padding-right: 8px;\n  white-space: nowrap;\n}\n\n.blocklyToolbox[dir=\"RTL\"] .blocklyToolboxCategory {\n  margin-left: 8px;\n  padding-right: 0;\n}\n\n.blocklyToolboxCategoryIcon {\n  background-image: url(<<<PATH>>>/sprites.png);\n  height: 16px;\n  vertical-align: middle;\n  visibility: hidden;\n  width: 16px;\n}\n\n.blocklyToolboxCategoryIconClosed {\n  background-position: -32px -1px;\n}\n\n.blocklyToolbox[dir=\"RTL\"] .blocklyToolboxCategoryIconClosed {\n  background-position: 0 -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n  background-position: -32px -17px;\n}\n\n.blocklyToolbox[dir=\"RTL\"] .blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n  background-position: 0 -17px;\n}\n\n.blocklyToolboxCategoryIconOpen {\n  background-position: -16px -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconOpen {\n  background-position: -16px -17px;\n}\n\n.blocklyToolboxCategoryLabel {\n  cursor: default;\n  font: 16px sans-serif;\n  padding: 0 3px;\n  vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyToolboxCategoryLabel {\n  cursor: url(\"<<<PATH>>>/handdelete.cur\"), auto;\n}\n\n.blocklyToolboxSelected .blocklyToolboxCategoryLabel {\n  color: #fff;\n}\n`);\n\nregistry.register(\n  registry.Type.TOOLBOX_ITEM,\n  ToolboxCategory.registrationName,\n  ToolboxCategory,\n);\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 */\n// Former goog.module ID: 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';\nimport {ToolboxItem} from './toolbox_item.js';\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 */\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    // Ensure that the separator has a tab index to ensure it receives focus\n    // when clicked (since clicking isn't managed by the toolbox).\n    container.tabIndex = -1;\n    container.id = this.getId();\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.blocklyToolbox[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,\n  ToolboxSeparator.registrationName,\n  ToolboxSeparator,\n);\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 */\n// Former goog.module ID: 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';\nimport {ToolboxCategory} from './category.js';\nimport {ToolboxSeparator} from './separator.js';\n\n/**\n * Class for a category in a toolbox that can be collapsed.\n */\nexport class CollapsibleToolboxCategory\n  extends ToolboxCategory\n  implements ICollapsibleToolboxItem\n{\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\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,\n    toolbox: IToolbox,\n    opt_parent?: ICollapsibleToolboxItem,\n  ) {\n    super(categoryDef, toolbox, opt_parent);\n  }\n\n  override makeDefaultCssConfig_() {\n    const cssConfig = super.makeDefaultCssConfig_();\n    cssConfig['contents'] = 'blocklyToolboxCategoryGroup';\n    return cssConfig;\n  }\n\n  override parseContents_(categoryDef: toolbox.CategoryInfo) {\n    if ('custom' in categoryDef) {\n      this.flyoutItems_ = categoryDef['custom'];\n    } else {\n      const contents = categoryDef['contents'];\n      if (!contents) return;\n      this.flyoutItems_ = [];\n      let prevIsFlyoutItem = true;\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 (\n          !registry.hasItem(registry.Type.TOOLBOX_ITEM, itemDef['kind']) ||\n          (itemDef['kind'].toLowerCase() ===\n            ToolboxSeparator.registrationName &&\n            prevIsFlyoutItem)\n        ) {\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 (\n      registryName.toUpperCase() === 'CATEGORY' &&\n      toolbox.isCategoryCollapsible(categoryDef)\n    ) {\n      registryName = CollapsibleToolboxCategory.registrationName;\n    }\n    const ToolboxItemClass = registry.getClass(\n      registry.Type.TOOLBOX_ITEM,\n      registryName,\n    );\n    const toolboxItem = new ToolboxItemClass!(\n      itemDef,\n      this.parentToolbox_,\n      this,\n    );\n    this.toolboxItems_.push(toolboxItem);\n  }\n\n  override init() {\n    super.init();\n\n    this.setExpanded(\n      this.toolboxItemDef_['expanded'] === 'true' ||\n        this.toolboxItemDef_['expanded'] === true,\n    );\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    this.closeIcon_(this.iconDom_);\n    aria.setState(this.htmlDiv_ as HTMLDivElement, aria.State.EXPANDED, false);\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_['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_(\n    subcategories: IToolboxItem[],\n  ): HTMLDivElement {\n    const contentsContainer = document.createElement('div');\n    contentsContainer.style.display = 'none';\n    const className = this.cssConfig_['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 and the associated flyout.\n   *\n   * @param isExpanded True to expand the category, false to close.\n   */\n  setExpanded(isExpanded: boolean) {\n    if (this.expanded_ === isExpanded) return;\n\n    this.expanded_ = isExpanded;\n    if (isExpanded) {\n      this.subcategoriesDiv_!.style.display = 'block';\n      this.openIcon_(this.iconDom_);\n    } else {\n      this.parentToolbox_.getFlyout()?.setVisible(false);\n      this.subcategoriesDiv_!.style.display = 'none';\n      this.closeIcon_(this.iconDom_);\n    }\n    aria.setState(\n      this.htmlDiv_ as HTMLDivElement,\n      aria.State.EXPANDED,\n      isExpanded,\n    );\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,\n  CollapsibleToolboxCategory.registrationName,\n  CollapsibleToolboxCategory,\n);\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 */\n// Former goog.module ID: Blockly.Toolbox\n\n// Unused import preserved for side-effects. Remove if unneeded.\nimport {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 * as Css from '../css.js';\nimport {DeleteArea} from '../delete_area.js';\nimport '../events/events_toolbox_item_select.js';\nimport {EventType} from '../events/type.js';\nimport * as eventUtils from '../events/utils.js';\nimport {getFocusManager} from '../focus_manager.js';\nimport {type IAutoHideable} from '../interfaces/i_autohideable.js';\nimport type {ICollapsibleToolboxItem} from '../interfaces/i_collapsible_toolbox_item.js';\nimport {isDeletable} from '../interfaces/i_deletable.js';\nimport type {IDraggable} from '../interfaces/i_draggable.js';\nimport type {IFlyout} from '../interfaces/i_flyout.js';\nimport type {IFocusableNode} from '../interfaces/i_focusable_node.js';\nimport type {IFocusableTree} from '../interfaces/i_focusable_tree.js';\nimport type {IKeyboardAccessible} from '../interfaces/i_keyboard_accessible.js';\nimport type {ISelectableToolboxItem} from '../interfaces/i_selectable_toolbox_item.js';\nimport {isSelectableToolboxItem} 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 * 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 * as idGenerator from '../utils/idgenerator.js';\nimport {Rect} from '../utils/rect.js';\nimport * as toolbox from '../utils/toolbox.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport type {ToolboxCategory} from './category.js';\nimport {CollapsibleToolboxCategory} from './collapsible_category.js';\n\n/**\n * Class for a Toolbox.\n * Creates the toolbox's DOM.\n */\nexport class Toolbox\n  extends DeleteArea\n  implements\n    IAutoHideable,\n    IKeyboardAccessible,\n    IStyleable,\n    IToolbox,\n    IFocusableNode\n{\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 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\n  /** Map from ID to the corresponding toolbox item. */\n  protected contents = new Map<string, IToolboxItem>();\n\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\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    this.toolboxDef_ = workspace.options.languageTree || {\n      contents: new Array<toolbox.ToolboxItemInfo>(),\n    };\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    /** 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    const flyoutDom = this.flyout.createDom('svg');\n    dom.addClass(flyoutDom, 'blocklyToolboxFlyout');\n    dom.insertAfter(flyoutDom, 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,\n      'toolboxBackgroundColour',\n      'background-color',\n    );\n    themeManager.subscribe(this.HtmlDiv, 'toolboxForegroundColour', 'color');\n    this.workspace_.getComponentManager().addComponent({\n      component: this,\n      weight: ComponentManager.ComponentWeight.TOOLBOX_WEIGHT,\n      capabilities: [\n        ComponentManager.Capability.AUTOHIDEABLE,\n        ComponentManager.Capability.DELETE_AREA,\n        ComponentManager.Capability.DRAG_TARGET,\n      ],\n    });\n    getFocusManager().registerTree(this, true);\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    container.id = idGenerator.getNextUniqueId();\n\n    this.contentsDiv_ = this.createContentsContainer_();\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, 'blocklyToolbox');\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, 'blocklyToolboxCategoryGroup');\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,\n    contentsContainer: HTMLDivElement,\n  ) {\n    // Clicking on toolbox closes popups.\n    const clickEvent = browserEvents.conditionalBind(\n      container,\n      'pointerdown',\n      this,\n      this.onClick_,\n      /* opt_noCaptureIdentifier */ false,\n    );\n    this.boundEvents_.push(clickEvent);\n\n    const keyDownEvent = browserEvents.conditionalBind(\n      contentsContainer,\n      'keydown',\n      this,\n      this.onKeyDown_,\n      /* opt_noCaptureIdentifier */ false,\n    );\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: PointerEvent) {\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.key) {\n      case 'ArrowDown':\n        handled = this.selectNext();\n        break;\n      case 'ArrowUp':\n        handled = this.selectPrevious();\n        break;\n      case 'ArrowLeft':\n        handled = this.selectParent();\n        break;\n      case 'ArrowRight':\n        handled = this.selectChild();\n        break;\n      case 'Enter':\n      case ' ':\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      if ((this.selectedItem_ as any).onKeyDown) {\n        handled = (this.selectedItem_ as any).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    const workspaceOptions = workspace.copyOptionsForFlyout();\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,\n        workspace.options,\n        true,\n      );\n    } else {\n      FlyoutClass = registry.getClassFromOptions(\n        registry.Type.FLYOUTS_VERTICAL_TOOLBOX,\n        workspace.options,\n        true,\n      );\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    this.contents.forEach((item) => item.dispose());\n    this.contents.clear();\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,\n    fragment: DocumentFragment,\n  ) {\n    let registryName = toolboxItemDef['kind'];\n\n    // Categories that are collapsible are created using a class registered\n    // under a different name.\n    if (\n      registryName.toUpperCase() === 'CATEGORY' &&\n      toolbox.isCategoryCollapsible(toolboxItemDef as toolbox.CategoryInfo)\n    ) {\n      registryName = CollapsibleToolboxCategory.registrationName;\n    }\n\n    const ToolboxItemClass = registry.getClass(\n      registry.Type.TOOLBOX_ITEM,\n      registryName.toLowerCase(),\n    );\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.set(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.values()];\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 {\n      // 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   * @returns Whether the element provided would be deleted if dropped on this\n   *     area.\n   */\n  override wouldDelete(element: IDraggable): boolean {\n    if (element instanceof BlockSvg) {\n      const block = element;\n      this.updateWouldDelete_(!block.getParent() && block.isDeletable());\n    } else {\n      this.updateWouldDelete_(isDeletable(element) && 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 = this.wouldDelete_\n      ? 'blocklyToolboxDelete'\n      : '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.contents.get(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 {\n        // Bottom\n        toolboxDiv.style.bottom = '0';\n      }\n    } else {\n      if (this.toolboxPosition === toolbox.Position.RIGHT) {\n        toolboxDiv.style.right = '0';\n      } else {\n        // 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 flyout = this.getFlyout();\n    const newX =\n      this.toolboxPosition === toolbox.Position.LEFT\n        ? workspace.scrollX +\n          rect.width +\n          (flyout?.isVisible() ? flyout.getWidth() : 0)\n        : workspace.scrollX;\n    const newY =\n      this.toolboxPosition === toolbox.Position.TOP\n        ? workspace.scrollY +\n          rect.height +\n          (flyout?.isVisible() ? flyout.getHeight() : 0)\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    this.contents.forEach((child) => {\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 (\n      this.selectedItem_ &&\n      this.selectedItem_.isSelectable() &&\n      this.selectedItem_.getContents().length\n    ) {\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 (\n      (!newItem && !oldItem) ||\n      (newItem && !isSelectableToolboxItem(newItem))\n    ) {\n      return;\n    }\n\n    if (this.shouldDeselectItem_(oldItem, newItem) && oldItem !== null) {\n      this.deselectItem_(oldItem);\n    }\n\n    if (this.shouldSelectItem_(oldItem, newItem) && newItem !== null) {\n      this.selectItem_(oldItem, newItem);\n    }\n\n    this.updateFlyout_(oldItem, newItem);\n    this.fireSelectEvent(oldItem, newItem);\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,\n  ): boolean {\n    // Deselect the old item unless the old item is collapsible and has been\n    // previously clicked on.\n    return (\n      oldItem !== null && (!oldItem.isCollapsible() || oldItem !== newItem)\n    );\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,\n  ): 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,\n      aria.State.ACTIVEDESCENDANT,\n      '',\n    );\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,\n    newItem: ISelectableToolboxItem,\n  ) {\n    this.selectedItem_ = newItem;\n    this.previouslySelectedItem_ = oldItem;\n    newItem.setSelected(true);\n    aria.setState(\n      this.contentsDiv_ as Element,\n      aria.State.ACTIVEDESCENDANT,\n      newItem.getId(),\n    );\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    const item = this.getToolboxItems()[position];\n    if (item) {\n      this.setSelectedItem(item);\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  ) {\n    if (\n      !newItem ||\n      (oldItem === newItem && !newItem.isCollapsible()) ||\n      !newItem.getContents().length\n    ) {\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  ) {\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(EventType.TOOLBOX_ITEM_SELECT))(\n      oldElement,\n      newElement,\n      this.workspace_.id,\n    );\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 (\n      this.selectedItem_.isCollapsible() &&\n      (this.selectedItem_ as ICollapsibleToolboxItem).isExpanded()\n    ) {\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    ) {\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    const items = [...this.contents.values()];\n    let nextItemIdx = items.indexOf(this.selectedItem_) + 1;\n    if (nextItemIdx > -1 && nextItemIdx < items.length) {\n      let nextItem = items[nextItemIdx];\n      while (nextItem && !nextItem.isSelectable()) {\n        nextItem = items[++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    const items = [...this.contents.values()];\n    let prevItemIdx = items.indexOf(this.selectedItem_) - 1;\n    if (prevItemIdx > -1 && prevItemIdx < items.length) {\n      let prevItem = items[prevItemIdx];\n      while (prevItem && !prevItem.isSelectable()) {\n        prevItem = items[--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    this.contents.forEach((item) => item.dispose());\n\n    for (let j = 0; j < this.boundEvents_.length; j++) {\n      browserEvents.unbind(this.boundEvents_[j]);\n    }\n    this.boundEvents_ = [];\n    this.contents.clear();\n\n    if (this.HtmlDiv) {\n      this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv);\n      dom.removeNode(this.HtmlDiv);\n    }\n\n    getFocusManager().unregisterTree(this);\n  }\n\n  /** See IFocusableNode.getFocusableElement. */\n  getFocusableElement(): HTMLElement | SVGElement {\n    if (!this.HtmlDiv) throw Error('Toolbox DOM has not yet been created.');\n    return this.HtmlDiv;\n  }\n\n  /** See IFocusableNode.getFocusableTree. */\n  getFocusableTree(): IFocusableTree {\n    return this;\n  }\n\n  /** See IFocusableNode.onNodeFocus. */\n  onNodeFocus(): void {}\n\n  /** See IFocusableNode.onNodeBlur. */\n  onNodeBlur(): void {}\n\n  /** See IFocusableNode.canBeFocused. */\n  canBeFocused(): boolean {\n    return true;\n  }\n\n  /** See IFocusableTree.getRootFocusableNode. */\n  getRootFocusableNode(): IFocusableNode {\n    return this;\n  }\n\n  /** See IFocusableTree.getRestoredFocusableNode. */\n  getRestoredFocusableNode(\n    previousNode: IFocusableNode | null,\n  ): IFocusableNode | null {\n    // Always try to select the first selectable toolbox item rather than the\n    // root of the toolbox.\n    if (!previousNode || previousNode === this) {\n      return this.getToolboxItems().find((item) => item.isSelectable()) ?? null;\n    }\n    return null;\n  }\n\n  /** See IFocusableTree.getNestedTrees. */\n  getNestedTrees(): Array<IFocusableTree> {\n    return [];\n  }\n\n  /** See IFocusableTree.lookUpFocusableNode. */\n  lookUpFocusableNode(id: string): IFocusableNode | null {\n    return this.getToolboxItemById(id) as IFocusableNode;\n  }\n\n  /** See IFocusableTree.onTreeFocus. */\n  onTreeFocus(\n    node: IFocusableNode,\n    _previousTree: IFocusableTree | null,\n  ): void {\n    if (node !== this) {\n      // Only select the item if it isn't already selected so as to not toggle.\n      if (this.getSelectedItem() !== node) {\n        this.setSelectedItem(node as IToolboxItem);\n      }\n    } else {\n      this.clearSelection();\n    }\n  }\n\n  /** See IFocusableTree.onTreeBlur. */\n  onTreeBlur(nextTree: IFocusableTree | null): void {\n    // If navigating to anything other than the toolbox's flyout then clear the\n    // selection so that the toolbox's flyout can automatically close.\n    if (!nextTree || nextTree !== this.flyout?.getWorkspace()) {\n      this.autoHide(false);\n    }\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.blocklyToolbox {\n  box-sizing: border-box;\n  user-select: none;\n  -ms-user-select: none;\n  -webkit-user-select: none;\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.blocklyToolboxCategoryGroup {\n  display: flex;\n  flex-wrap: wrap;\n  flex-direction: column;\n}\n\n.blocklyToolboxCategoryGroup:focus {\n  outline: none;\n}\n`);\n\nregistry.register(registry.Type.TOOLBOX, registry.DEFAULT, Toolbox);\n","/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IFocusableNode} from './i_focusable_node.js';\n\n/**\n * A set of rules that specify where keyboard navigation should proceed.\n */\nexport interface INavigationPolicy<T> {\n  /**\n   * Returns the first child element of the given element, if any.\n   *\n   * @param current The element which the user is navigating into.\n   * @returns The current element's first child, or null if it has none.\n   */\n  getFirstChild(current: T): IFocusableNode | null;\n\n  /**\n   * Returns the parent element of the given element, if any.\n   *\n   * @param current The element which the user is navigating out of.\n   * @returns The parent element of the current element, or null if it has none.\n   */\n  getParent(current: T): IFocusableNode | null;\n\n  /**\n   * Returns the peer element following the given element, if any.\n   *\n   * @param current The element which the user is navigating past.\n   * @returns The next peer element of the current element, or null if there is\n   *     none.\n   */\n  getNextSibling(current: T): IFocusableNode | null;\n\n  /**\n   * Returns the peer element preceding the given element, if any.\n   *\n   * @param current The element which the user is navigating past.\n   * @returns The previous peer element of the current element, or null if\n   *     there is none.\n   */\n  getPreviousSibling(current: T): IFocusableNode | null;\n\n  /**\n   * Returns whether or not the given instance should be reachable via keyboard\n   * navigation.\n   *\n   * Implementors should generally return true, unless there are circumstances\n   * under which this item should be skipped while using keyboard navigation.\n   * Common examples might include being disabled, invalid, readonly, or purely\n   * a visual decoration. For example, while Fields are navigable, non-editable\n   * fields return false, since they cannot be interacted with when focused.\n   *\n   * @returns True if this element should be included in keyboard navigation.\n   */\n  isNavigable(current: T): boolean;\n\n  /**\n   * Returns whether or not this navigation policy corresponds to the type of\n   * the given object.\n   *\n   * @param current An instance to check whether this policy applies to.\n   * @returns True if the given object is of a type handled by this policy.\n   */\n  isApplicable(current: any): current is T;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.utils.Metrics\n\nexport interface Metrics {\n  /** Height of the visible portion of the workspace. */\n  viewHeight: number;\n\n  /** Width of the visible portion of the workspace. */\n  viewWidth: number;\n\n  /** Height of the content. */\n  contentHeight: number;\n\n  /** Width of the content. */\n  contentWidth: number;\n\n  /** Height of the scroll area. */\n  scrollHeight: number;\n\n  /** Width of the scroll area. */\n  scrollWidth: number;\n\n  /**\n   * Top-edge of the visible portion of the workspace, relative to the workspace\n   * origin.\n   */\n  viewTop: number;\n\n  /**\n   * Left-edge of the visible portion of the workspace, relative to the\n   * workspace origin.\n   */\n  viewLeft: number;\n\n  /** Top-edge of the content, relative to the workspace origin. */\n  contentTop: number;\n\n  /** Left-edge of the content relative to the workspace origin. */\n  contentLeft: number;\n\n  /** Top-edge of the scroll area, relative to the workspace origin. */\n  scrollTop: number;\n\n  /** Left-edge of the scroll area relative to the workspace origin. */\n  scrollLeft: number;\n\n  /**\n   * Top-edge of the visible portion of the workspace, relative to the\n   * blocklyDiv.\n   */\n  absoluteTop: number;\n\n  /**\n   * Left-edge of the visible portion of the workspace, relative to the\n   * blocklyDiv.\n   */\n  absoluteLeft: number;\n\n  /**\n   * Height of the Blockly div (the view + the toolbox, simple of otherwise).\n   */\n  svgHeight: number;\n\n  /** Width of the Blockly div (the view + the toolbox, simple or otherwise). */\n  svgWidth: number;\n\n  /** Width of the toolbox, if it exists.  Otherwise zero. */\n  toolboxWidth: number;\n\n  /** Height of the toolbox, if it exists.  Otherwise zero. */\n  toolboxHeight: number;\n\n  /** Top, bottom, left or right. Use TOOLBOX_AT constants to compare. */\n  toolboxPosition: number;\n\n  /** Width of the flyout if it is always open.  Otherwise zero. */\n  flyoutWidth: number;\n\n  /** Height of the flyout if it is always open.  Otherwise zero. */\n  flyoutHeight: number;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.blockRendering.IPathObject\n\nimport type {BlockSvg} from '../../block_svg.js';\nimport type {RenderedConnection} from '../../rendered_connection.js';\nimport type {BlockStyle} from '../../theme.js';\nimport type {Coordinate} from '../../utils/coordinate.js';\nimport type {ConstantProvider} from './constants.js';\n\n/**\n * An interface for a block's path object.\n *\n * @param _root The root SVG element.\n * @param _constants The renderer's constants.\n */\nexport interface IPathObject {\n  /**\n   * The primary path of the block.\n   */\n  svgPath: SVGElement;\n\n  /** The renderer's constant provider. */\n  constants: ConstantProvider;\n\n  /** The primary path of the block. */\n  style: BlockStyle;\n\n  /**\n   * Set the path generated by the renderer onto the respective SVG element.\n   *\n   * @param pathString The path.\n   */\n  setPath(pathString: string): void;\n\n  /**\n   * Flip the SVG paths in RTL.\n   */\n  flipRTL(): void;\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 highlighted True if highlighted.\n   */\n  updateHighlighted(highlighted: boolean): void;\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   */\n  updateSelected(enabled: boolean): void;\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   */\n  updateDraggingDelete(enabled: boolean): void;\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   */\n  updateInsertionMarker(enabled: boolean): void;\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   */\n  updateMovable(enabled: boolean): void;\n\n  /** Adds the given path as a connection highlight for the given connection. */\n  addConnectionHighlight?(\n    connection: RenderedConnection,\n    connectionPath: string,\n    offset: Coordinate,\n    rtl: boolean,\n  ): SVGElement;\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   */\n  applyColour?(block: BlockSvg): void;\n\n  /**\n   * Removes any highlight associated with the given connection, if it exists.\n   */\n  removeConnectionHighlight?(connection: RenderedConnection): void;\n\n  /**\n   * Update the style.\n   *\n   * @param blockStyle The block style to use.\n   */\n  setStyle?(blockStyle: BlockStyle): void;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {Workspace} from '../workspace.js';\n\n/* Representation of a variable. */\nexport interface IVariableModel<T extends IVariableState> {\n  /* Returns the unique ID of this variable. */\n  getId(): string;\n\n  /* Returns the user-visible name of this variable. */\n  getName(): string;\n\n  /**\n   * Returns the type of the variable like 'int' or 'string'.  Does not need to be\n   * unique. This will default to '' which is a specific type.\n   */\n  getType(): string;\n\n  /* Sets the user-visible name of this variable. */\n  setName(name: string): this;\n\n  /* Sets the type of this variable. */\n  setType(type: string): this;\n\n  getWorkspace(): Workspace;\n\n  /* Serializes this variable */\n  save(): T;\n}\n\nexport interface IVariableModelStatic<T extends IVariableState> {\n  new (\n    workspace: Workspace,\n    name: string,\n    type?: string,\n    id?: string,\n  ): IVariableModel<T>;\n\n  /**\n   * Creates a new IVariableModel corresponding to the given state on the\n   * specified workspace. This method must be static in your implementation.\n   */\n  load(state: T, workspace: Workspace): IVariableModel<T>;\n}\n\n/**\n * Represents the state of a given variable.\n */\nexport interface IVariableState {\n  name: string;\n  id: string;\n  type?: string;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {IVariableModel, IVariableState} from './i_variable_model.js';\n\n/**\n * Variable maps are container objects responsible for storing and managing the\n * set of variables referenced on a workspace.\n *\n * Any of these methods may define invariants about which names and types are\n * legal, and throw if they are not met.\n */\nexport interface IVariableMap<T extends IVariableModel<IVariableState>> {\n  /* Returns the variable corresponding to the given ID, or null if none. */\n  getVariableById(id: string): T | null;\n\n  /**\n   * Returns the variable with the given name, or null if not found. If `type`\n   * is provided, the variable's type must also match, or null should be\n   * returned.\n   */\n  getVariable(name: string, type?: string): T | null;\n\n  /* Returns a list of all variables managed by this variable map. */\n  getAllVariables(): T[];\n\n  /**\n   * Returns a list of all of the variables of the given type managed by this\n   * variable map.\n   */\n  getVariablesOfType(type: string): T[];\n\n  /**\n   * Returns a list of the set of types of the variables managed by this\n   * variable map.\n   */\n  getTypes(): string[];\n\n  /**\n   * Creates a new variable with the given name. If ID is not specified, the\n   * variable map should create one. Returns the new variable.\n   */\n  createVariable(name: string, type?: string, id?: string | null): T;\n\n  /* Adds a variable to this variable map. */\n  addVariable(variable: T): void;\n\n  /**\n   * Changes the name of the given variable to the name provided and returns the\n   * renamed variable.\n   */\n  renameVariable(variable: T, newName: string): T;\n\n  /* Changes the type of the given variable and returns it. */\n  changeVariableType(variable: T, newType: string): T;\n\n  /* Deletes the given variable. */\n  deleteVariable(variable: T): void;\n\n  /* Removes all variables from this variable map. */\n  clear(): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IToolboxItem\n\nimport type {IFocusableNode} from './i_focusable_node.js';\n\n/**\n * Interface for an item in the toolbox.\n */\nexport interface IToolboxItem extends IFocusableNode {\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(): void;\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\n  /**\n   * Gets a unique identifier for this toolbox item.\n   *\n   * @returns The ID for the toolbox item.\n   */\n  getId(): string;\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(): IToolboxItem | null;\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\n  /**\n   * Whether the toolbox item is selectable.\n   *\n   * @returns True if the toolbox item can be selected.\n   */\n  isSelectable(): boolean;\n\n  /**\n   * Whether the toolbox item is collapsible.\n   *\n   * @returns True if the toolbox item is collapsible.\n   */\n  isCollapsible(): boolean;\n\n  /** Dispose of this toolbox item. No-op by default. */\n  dispose(): void;\n\n  /**\n   * Gets the HTML element that is clickable.\n   *\n   * @returns The HTML element that receives clicks.\n   */\n  getClickTarget(): Element | null;\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): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IToolbox\n\nimport type {ToolboxInfo} from '../utils/toolbox.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport type {IFlyout} from './i_flyout.js';\nimport type {IFocusableTree} from './i_focusable_tree.js';\nimport type {IRegistrable} from './i_registrable.js';\nimport type {IToolboxItem} from './i_toolbox_item.js';\n\n/**\n * Interface for a toolbox.\n */\nexport interface IToolbox extends IRegistrable, IFocusableTree {\n  /** Initializes the toolbox. */\n  init(): void;\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   */\n  render(toolboxDef: ToolboxInfo): void;\n\n  /**\n   * Gets the width of the toolbox.\n   *\n   * @returns The width of the toolbox.\n   */\n  getWidth(): number;\n\n  /**\n   * Gets the height of the toolbox.\n   *\n   * @returns The height of the toolbox.\n   */\n  getHeight(): number;\n\n  /**\n   * Gets the toolbox flyout.\n   *\n   * @returns The toolbox flyout.\n   */\n  getFlyout(): IFlyout | null;\n\n  /**\n   * Gets the workspace for the toolbox.\n   *\n   * @returns The parent workspace for the toolbox.\n   */\n  getWorkspace(): WorkspaceSvg;\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\n  /**\n   * Positions the toolbox based on whether it is a horizontal toolbox and\n   * whether the workspace is in rtl.\n   */\n  position(): void;\n\n  /** Handles resizing the toolbox when a toolbox item resizes. */\n  handleToolboxItemResize(): void;\n\n  /** Unhighlights any previously selected item. */\n  clearSelection(): void;\n\n  /**\n   * Updates the category colours and background colour of selected categories.\n   */\n  refreshTheme(): void;\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(): void;\n\n  /**\n   * Sets the visibility of the toolbox.\n   *\n   * @param isVisible True if toolbox should be visible.\n   */\n  setVisible(isVisible: boolean): void;\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): void;\n\n  /**\n   * Gets the selected item.\n   *\n   * @returns The selected item, or null if no item is currently selected.\n   */\n  getSelectedItem(): IToolboxItem | null;\n\n  /**\n   * Sets the selected item.\n   *\n   * @param item The toolbox item to select, or null to remove the current\n   *     selection.\n   */\n  setSelectedItem(item: IToolboxItem | null): void;\n\n  /** Disposes of this toolbox. */\n  dispose(): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IStyleable\n\n/**\n * Interface for an object that a style can be added to.\n */\nexport interface IStyleable {\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   */\n  addStyle(style: string): void;\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   */\n  removeStyle(style: string): void;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.serialization.ISerializer\n\nimport type {Workspace} from '../workspace.js';\n\n/**\n * Serializes and deserializes a plugin or system.\n */\nexport interface ISerializer {\n  /**\n   * A priority value used to determine the order of deserializing state.\n   * More positive priorities are deserialized before less positive\n   * priorities. Eg if you have priorities (0, -10, 10, 100) the order of\n   * deserialiation will be (100, 10, 0, -10).\n   * If two serializers have the same priority, they are deserialized in an\n   * arbitrary order relative to each other.\n   */\n  priority: number;\n\n  /**\n   * Saves the state of the plugin or system.\n   *\n   * @param workspace The workspace the system to serialize is associated with.\n   * @returns A JS object containing the system's state, or null if there is no\n   *     state to record.\n   */\n  save(workspace: Workspace): object | null;\n\n  /**\n   * Loads the state of the plugin or system.\n   *\n   * @param state The state of the system to deserialize. This will always be\n   *     non-null.\n   * @param workspace The workspace the system to deserialize is associated\n   *     with.\n   */\n  load(state: object, workspace: Workspace): void;\n\n  /**\n   * Clears the state of the plugin or system.\n   *\n   * @param workspace The workspace the system to clear the state of is\n   *     associated with.\n   */\n  clear(workspace: Workspace): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IRegistrable\n\n/**\n * The interface for a Blockly component that can be registered.\n */\nexport interface IRegistrable {}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {State} from '../serialization/procedures.js';\nimport {IParameterModel} from './i_parameter_model.js';\n\n/**\n * A data model for a procedure.\n */\nexport interface IProcedureModel {\n  /** Sets the human-readable name of the procedure. */\n  setName(name: string): this;\n\n  /**\n   * Inserts a parameter into the list of parameters.\n   *\n   * To move a parameter, first delete it, and then re-insert.\n   */\n  insertParameter(parameterModel: IParameterModel, index: number): this;\n\n  /** Removes the parameter at the given index from the parameter list. */\n  deleteParameter(index: number): this;\n\n  /**\n   * Sets the return type(s) of the procedure.\n   *\n   * Pass null to represent a procedure that does not return.\n   */\n  setReturnTypes(types: string[] | null): this;\n\n  /**\n   * Sets whether this procedure is enabled/disabled. If a procedure is disabled\n   * all procedure caller blocks should be disabled as well.\n   */\n  setEnabled(enabled: boolean): this;\n\n  /** Returns the unique language-neutral ID for the procedure. */\n  getId(): string;\n\n  /** Returns the human-readable name of the procedure. */\n  getName(): string;\n\n  /** Returns the parameter at the given index in the parameter list. */\n  getParameter(index: number): IParameterModel;\n\n  /** Returns an array of all of the parameters in the parameter list. */\n  getParameters(): IParameterModel[];\n\n  /**\n   * Returns the return type(s) of the procedure.\n   *\n   * Null represents a procedure that does not return a value.\n   */\n  getReturnTypes(): string[] | null;\n\n  /**\n   * Returns whether the procedure is enabled/disabled. If a procedure is\n   * disabled, all procedure caller blocks should be disabled as well.\n   */\n  getEnabled(): boolean;\n\n  /**\n   * Serializes the state of the procedure to JSON.\n   *\n   * @returns JSON serializable state of the procedure.\n   */\n  saveState(): State;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {IProcedureModel} from './i_procedure_model.js';\n\nexport interface IProcedureMap extends Map<string, IProcedureModel> {\n  /**\n   * Adds the given ProcedureModel to the map of procedure models, so that\n   * blocks can find it.\n   */\n  add(proc: IProcedureModel): this;\n\n  /** Returns all of the procedures stored in this map. */\n  getProcedures(): IProcedureModel[];\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IPositionable\n\nimport type {UiMetrics} from '../metrics_manager.js';\nimport type {Rect} from '../utils/rect.js';\nimport type {IComponent} from './i_component.js';\n\n/**\n * Interface for a component that is positioned on top of the workspace.\n */\nexport interface IPositionable extends IComponent {\n  /**\n   * Positions the element. Called when the window is resized.\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[]): void;\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}\n","/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ParameterState} from '../serialization/procedures';\nimport {IProcedureModel} from './i_procedure_model';\n\n/**\n * A data model for a procedure.\n */\nexport interface IParameterModel {\n  /**\n   * Sets the name of this parameter to the given name.\n   */\n  setName(name: string): this;\n\n  /**\n   * Sets the types of this parameter to the given type.\n   */\n  setTypes(types: string[]): this;\n\n  /**\n   * Returns the name of this parameter.\n   */\n  getName(): string;\n\n  /**\n   * Return the types of this parameter.\n   */\n  getTypes(): string[];\n\n  /**\n   * Returns the unique language-neutral ID for the parameter.\n   *\n   * This represents the identify of the variable model which does not change\n   * over time.\n   */\n  getId(): string;\n\n  /** Sets the procedure model this parameter is associated with. */\n  setProcedureModel(model: IProcedureModel): this;\n\n  /**\n   * Serializes the state of the parameter to JSON.\n   *\n   * @returns JSON serializable state of the parameter.\n   */\n  saveState(): ParameterState;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IMovable\n\n/**\n * The interface for an object that is movable.\n */\nexport interface IMovable {\n  /**\n   * Get whether this is movable or not.\n   *\n   * @returns True if movable.\n   */\n  isMovable(): boolean;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IMetricsManager\n\nimport type {\n  AbsoluteMetrics,\n  ContainerRegion,\n  ToolboxMetrics,\n  UiMetrics,\n} from '../metrics_manager.js';\nimport type {Metrics} from '../utils/metrics.js';\nimport type {Size} from '../utils/size.js';\n\n/**\n * Interface for a metrics manager.\n */\nexport interface IMetricsManager {\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\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,\n    opt_viewMetrics?: ContainerRegion,\n    opt_contentMetrics?: ContainerRegion,\n  ): ContainerRegion;\n\n  /**\n   * Gets the width and the height of the flyout in pixel\n   * coordinates. By default, will get metrics for either a simple flyout (owned\n   * directly by the workspace) or for the flyout owned by the toolbox. If you\n   * pass `opt_own` as `true` then only metrics for the simple flyout will be\n   * returned, and it will return 0 for the width and height if the workspace\n   * has a category toolbox instead of a simple toolbox.\n   *\n   * @param opt_own Whether to only return the workspace's own flyout metrics.\n   * @returns The width and height of the flyout.\n   */\n  getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics;\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 simple toolbox, see {@link IMetricsManager.getFlyoutMetrics}.\n   *\n   * @returns The object with the width, height and position of the toolbox.\n   */\n  getToolboxMetrics(): ToolboxMetrics;\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\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\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\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\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   * .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   * .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\n  /**\n   * Returns common metrics used by UI elements.\n   *\n   * @returns The UI metrics.\n   */\n  getUiMetrics(): UiMetrics;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IKeyboardAccessible\n\nimport {KeyboardShortcut} from '../shortcut_registry.js';\n\n/**\n * An interface for an object that handles keyboard shortcuts.\n */\nexport interface IKeyboardAccessible {\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}\n","export {};\n//# sourceMappingURL=i_flyout_inflater.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IFlyout\n\nimport type {BlockSvg} from '../block_svg.js';\nimport type {FlyoutItem} from '../flyout_item.js';\nimport type {Coordinate} from '../utils/coordinate.js';\nimport type {Svg} from '../utils/svg.js';\nimport type {FlyoutDefinition} from '../utils/toolbox.js';\nimport type {WorkspaceSvg} from '../workspace_svg.js';\nimport {IFocusableTree} from './i_focusable_tree.js';\nimport type {IRegistrable} from './i_registrable.js';\n\n/**\n * Interface for a flyout.\n */\nexport interface IFlyout extends IRegistrable, IFocusableTree {\n  /** Whether the flyout is laid out horizontally or not. */\n  horizontalLayout: boolean;\n\n  /** Is RTL vs LTR. */\n  RTL: boolean;\n\n  /** The target workspace */\n  targetWorkspace: WorkspaceSvg | null;\n\n  /** Margin around the edges of the blocks in the flyout. */\n  readonly MARGIN: number;\n\n  /** Does the flyout automatically close when a block is created? */\n  autoClose: boolean;\n\n  /** Corner radius of the flyout background. */\n  readonly CORNER_RADIUS: number;\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 put the flyout in. This should be <svg>\n   *     or <g>.\n   * @returns The flyout's SVG group.\n   */\n  createDom(\n    tagName: string | Svg<SVGSVGElement> | Svg<SVGGElement>,\n  ): SVGElement;\n\n  /**\n   * Initializes the flyout.\n   *\n   * @param targetWorkspace The workspace in which to create new blocks.\n   */\n  init(targetWorkspace: WorkspaceSvg): void;\n\n  /**\n   * Dispose of this flyout.\n   * Unlink from all DOM elements to prevent memory leaks.\n   */\n  dispose(): void;\n\n  /**\n   * Get the width of the flyout.\n   *\n   * @returns The width of the flyout.\n   */\n  getWidth(): number;\n\n  /**\n   * Get the height of the flyout.\n   *\n   * @returns The height of the flyout.\n   */\n  getHeight(): number;\n\n  /**\n   * Get the workspace inside the flyout.\n   *\n   * @returns The workspace inside the flyout.\n   */\n  getWorkspace(): WorkspaceSvg;\n\n  /**\n   * Is the flyout visible?\n   *\n   * @returns True if visible.\n   */\n  isVisible(): boolean;\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): void;\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): void;\n\n  /** Hide and empty the flyout. */\n  hide(): void;\n\n  /**\n   * Show and populate the flyout.\n   *\n   * @param flyoutDef Contents to display in the flyout. This is either an array\n   *     of Nodes, a NodeList, a toolbox definition, or a string with the name\n   *     of the dynamic category.\n   */\n  show(flyoutDef: FlyoutDefinition | string): void;\n\n  /**\n   * Returns the list of flyout items currently present in the flyout.\n   * The `show` method parses the flyout definition into a list of actual\n   * flyout items. This method should return those concrete items, which\n   * may be used for e.g. keyboard navigation.\n   *\n   * @returns List of flyout items.\n   */\n  getContents(): FlyoutItem[];\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   */\n  createBlock(originalBlock: BlockSvg): BlockSvg;\n\n  /** Reflow blocks and their mats. */\n  reflow(): void;\n\n  /**\n   * @returns True if this flyout may be scrolled with a scrollbar or by\n   *     dragging.\n   */\n  isScrollable(): boolean;\n\n  /**\n   * Calculates the x coordinate for the flyout position.\n   *\n   * @returns X coordinate.\n   */\n  getX(): number;\n\n  /**\n   * Calculates the y coordinate for the flyout position.\n   *\n   * @returns Y coordinate.\n   */\n  getY(): number;\n\n  /** Position the flyout. */\n  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 moved from the position\n   *     at mouse down, in pixel units.\n   * @returns True if the drag is toward the workspace.\n   */\n  isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;\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   */\n  isBlockCreatable(block: BlockSvg): boolean;\n\n  /** Scroll the flyout to the beginning of its contents. */\n  scrollToStart(): void;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Coordinate} from '../utils/coordinate';\n\nexport interface IDragger {\n  /**\n   * Handles any drag startup.\n   *\n   * @param e PointerEvent that started the drag.\n   */\n  onDragStart(e: PointerEvent): void;\n\n  /**\n   * Handles dragging, including calculating where the element should\n   * actually be moved to.\n   *\n   * @param e PointerEvent that continued the drag.\n   * @param totalDelta The total distance, in pixels, that the mouse\n   *     has moved since the start of the drag.\n   */\n  onDrag(e: PointerEvent, totalDelta: Coordinate): void;\n\n  /**\n   * Handles any drag cleanup.\n   *\n   * @param e PointerEvent that finished the drag.\n   * @param totalDelta The total distance, in pixels, that the mouse\n   *     has moved since the start of the drag.\n   */\n  onDragEnd(e: PointerEvent, totalDelta: Coordinate): void;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IDragTarget\n\nimport {Rect} from '../utils/rect.js';\nimport type {IComponent} from './i_component.js';\nimport {IDraggable} from './i_draggable.js';\n\n/**\n * Interface for a component with custom behaviour when a block or bubble is\n * dragged over or dropped on top of it.\n */\nexport interface IDragTarget extends IComponent {\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  getClientRect(): Rect | null;\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): void;\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): void;\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): void;\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  onDrop(dragElement: IDraggable): void;\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}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IDeleteArea\n\nimport type {IDragTarget} from './i_drag_target.js';\nimport type {IDraggable} from './i_draggable.js';\n\n/**\n * Interface for a component that can delete a block or bubble that is dropped\n * on top of it.\n */\nexport interface IDeleteArea extends IDragTarget {\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   * @returns Whether the element provided would be deleted if dropped on this\n   *     area.\n   */\n  wouldDelete(element: IDraggable): boolean;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IContextMenu\n\nexport interface IContextMenu {\n  /**\n   * Show the context menu for this object.\n   *\n   * @param e Mouse event.\n   */\n  showContextMenu(e: Event): void;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {BlockSvg} from '../block_svg';\nimport type {RenderedConnection} from '../rendered_connection';\n\n/**\n * Displays visual \"previews\" of where a block will be connected if it is\n * dropped.\n */\nexport interface IConnectionPreviewer {\n  /**\n   * Display a connection preview where the draggedCon connects to the\n   * staticCon, replacing the replacedBlock (currently connected to the\n   * staticCon).\n   *\n   * @param draggedCon The connection on the block stack being dragged.\n   * @param staticCon The connection not being dragged that we are\n   *     connecting to.\n   * @param replacedBlock The block currently connected to the staticCon that\n   *     is being replaced.\n   */\n  previewReplacement(\n    draggedConn: RenderedConnection,\n    staticConn: RenderedConnection,\n    replacedBlock: BlockSvg,\n  ): void;\n\n  /**\n   * Display a connection preview where the draggedCon connects to the\n   * staticCon, and no block is being relaced.\n   *\n   * @param draggedCon The connection on the block stack being dragged.\n   * @param staticCon The connection not being dragged that we are\n   *     connecting to.\n   */\n  previewConnection(\n    draggedConn: RenderedConnection,\n    staticConn: RenderedConnection,\n  ): void;\n\n  /** Hide any previews that are currently displayed. */\n  hidePreview(): void;\n\n  /** Dispose of any references held by this connection previewer. */\n  dispose(): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IConnectionChecker\n\nimport type {Connection} from '../connection.js';\nimport type {RenderedConnection} from '../rendered_connection.js';\n\n/**\n * Class for connection type checking logic.\n */\nexport interface 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,\n    b: Connection | null,\n    isDragging: boolean,\n    opt_distance?: number,\n  ): boolean;\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,\n    b: Connection | null,\n    isDragging: boolean,\n    opt_distance?: number,\n  ): number;\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(\n    errorCode: number,\n    a: Connection | null,\n    b: Connection | null,\n  ): string;\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\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\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(\n    a: RenderedConnection,\n    b: RenderedConnection,\n    distance: number,\n  ): boolean;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IComponent\n\n/**\n * The interface for a workspace component that can be registered with the\n * ComponentManager.\n */\nexport interface IComponent {\n  /**\n   * The unique ID for this component that is used to register with the\n   * ComponentManager.\n   */\n  id: string;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.ICollapsibleToolboxItem\n\nimport type {ISelectableToolboxItem} from './i_selectable_toolbox_item.js';\nimport type {IToolboxItem} from './i_toolbox_item.js';\n\n/**\n * Interface for an item in the toolbox that can be collapsed.\n */\nexport interface ICollapsibleToolboxItem extends ISelectableToolboxItem {\n  /**\n   * Gets any children toolbox items. (ex. Gets the subcategories)\n   *\n   * @returns The child toolbox items.\n   */\n  getChildToolboxItems(): IToolboxItem[];\n\n  /**\n   * Whether the toolbox item 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\n  /** Toggles whether or not the toolbox item is expanded. */\n  toggleExpanded(): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IBubble\n\nimport type {Coordinate} from '../utils/coordinate.js';\nimport type {IContextMenu} from './i_contextmenu.js';\nimport type {IDraggable} from './i_draggable.js';\nimport {IFocusableNode} from './i_focusable_node.js';\n\n/**\n * A bubble interface.\n */\nexport interface IBubble extends IDraggable, IContextMenu, IFocusableNode {\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\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\n  /**\n   * Sets whether or not this bubble is being dragged.\n   *\n   * @param adding True if dragging, false otherwise.\n   */\n  setDragging(dragging: boolean): void;\n\n  /**\n   * Move this bubble during a drag.\n   *\n   * @param newLoc The location to translate to, in workspace coordinates.\n   */\n  moveDuringDrag(newLoc: Coordinate): void;\n\n  /**\n   * Move the bubble 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   */\n  moveTo(x: number, y: number): void;\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): void;\n\n  /** Dispose of this bubble. */\n  dispose(): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Former goog.module ID: Blockly.IBoundedElement\n\nimport type {Rect} from '../utils/rect.js';\n\n/**\n * A bounded element interface.\n */\nexport interface IBoundedElement {\n  /**\n   * Returns the coordinates of a bounded element describing the dimensions of\n   * the element. Coordinate system: workspace coordinates.\n   *\n   * @returns Object with coordinates of the bounded element.\n   */\n  getBoundingRectangle(): Rect;\n\n  /**\n   * Move the element by a relative offset.\n   *\n   * @param dx Horizontal offset in workspace units.\n   * @param dy Vertical offset in workspace units.\n   * @param reason Why is this move happening?  'user', 'bump', 'snap'...\n   */\n  moveBy(dx: number, dy: number, reason?: string[]): void;\n}\n"]}