monaco-editor-core 0.57.0 → 0.58.0-dev-20261104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +38 -6
- package/esm/vs/base/browser/browser.js +8 -0
- package/esm/vs/base/browser/browser.js.map +1 -1
- package/esm/vs/base/browser/contextmenu.js +8 -1
- package/esm/vs/base/browser/contextmenu.js.map +1 -1
- package/esm/vs/base/browser/dom.js +34 -5
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/dompurify/dompurify.js +2457 -2640
- package/esm/vs/base/browser/markdownRenderer.js +48 -21
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/pixelRatio.js +3 -2
- package/esm/vs/base/browser/pixelRatio.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js +5 -2
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionbar.js +7 -2
- package/esm/vs/base/browser/ui/actionbar/actionbar.js.map +1 -1
- package/esm/vs/base/browser/ui/animations/animations.js +68 -40
- package/esm/vs/base/browser/ui/animations/animations.js.map +1 -1
- package/esm/vs/base/browser/ui/button/button.js +7 -0
- package/esm/vs/base/browser/ui/button/button.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/contextview/contextview.css +15 -0
- package/esm/vs/base/browser/ui/contextview/contextview.js +266 -40
- package/esm/vs/base/browser/ui/contextview/contextview.js.map +1 -1
- package/esm/vs/base/browser/ui/contextview/windowControlsOverlay.js +72 -0
- package/esm/vs/base/browser/ui/contextview/windowControlsOverlay.js.map +1 -0
- package/esm/vs/base/browser/ui/dialog/dialog.css +5 -0
- package/esm/vs/base/browser/ui/dropdown/dropdown.js +2 -1
- package/esm/vs/base/browser/ui/dropdown/dropdown.js.map +1 -1
- package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +1 -0
- package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js.map +1 -1
- package/esm/vs/base/browser/ui/hover/hover.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listView.js +87 -15
- package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listWidget.js +37 -15
- package/esm/vs/base/browser/ui/list/listWidget.js.map +1 -1
- package/esm/vs/base/browser/ui/menu/menu.js +189 -52
- package/esm/vs/base/browser/ui/menu/menu.js.map +1 -1
- package/esm/vs/base/browser/ui/radio/radio.css +11 -0
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js +2 -1
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBox.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js +14 -8
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js.map +1 -1
- package/esm/vs/base/browser/ui/splitview/splitview.js +11 -7
- package/esm/vs/base/browser/ui/splitview/splitview.js.map +1 -1
- package/esm/vs/base/browser/ui/toggle/switch.css +16 -7
- package/esm/vs/base/browser/ui/toggle/switch.js +9 -6
- package/esm/vs/base/browser/ui/toggle/switch.js.map +1 -1
- package/esm/vs/base/browser/ui/toolbar/toolbar.css +1 -2
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +85 -38
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +48 -9
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +10 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/objectTree.js +3 -0
- package/esm/vs/base/browser/ui/tree/objectTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/tree.js.map +1 -1
- package/esm/vs/base/common/actions.js +8 -2
- package/esm/vs/base/common/actions.js.map +1 -1
- package/esm/vs/base/common/arrays.js +4 -4
- package/esm/vs/base/common/arrays.js.map +1 -1
- package/esm/vs/base/common/async.js +12 -8
- package/esm/vs/base/common/async.js.map +1 -1
- package/esm/vs/base/common/cancellation.js +25 -0
- package/esm/vs/base/common/cancellation.js.map +1 -1
- package/esm/vs/base/common/codicons.js +2 -0
- package/esm/vs/base/common/codicons.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +2 -0
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/color.js +1 -1
- package/esm/vs/base/common/color.js.map +1 -1
- package/esm/vs/base/common/diff/diff.js +60 -1
- package/esm/vs/base/common/diff/diff.js.map +1 -1
- package/esm/vs/base/common/event.js +1 -1
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/glob.js +1 -0
- package/esm/vs/base/common/glob.js.map +1 -1
- package/esm/vs/base/common/htmlContent.js +74 -12
- package/esm/vs/base/common/htmlContent.js.map +1 -1
- package/esm/vs/base/common/json.js +19 -0
- package/esm/vs/base/common/json.js.map +1 -0
- package/esm/vs/base/common/network.js +16 -0
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/resources.js +14 -2
- package/esm/vs/base/common/resources.js.map +1 -1
- package/esm/vs/base/common/strings.js +1 -1
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/base/common/uri.js +2 -2
- package/esm/vs/base/common/uri.js.map +1 -1
- package/esm/vs/editor/browser/config/editorConfiguration.js +1 -1
- package/esm/vs/editor/browser/config/fontMeasurements.js +19 -6
- package/esm/vs/editor/browser/config/fontMeasurements.js.map +1 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js +3 -3
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +11 -5
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +8 -38
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/screenReaderContentRich.js +3 -3
- package/esm/vs/editor/browser/controller/editContext/native/screenReaderSupport.js +6 -6
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +12 -10
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +7 -7
- package/esm/vs/editor/browser/controller/mouseTarget.js +3 -3
- package/esm/vs/editor/browser/coreCommands.js +2 -2
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/editorMarkdownSanitizer.js +19 -0
- package/esm/vs/editor/browser/editorMarkdownSanitizer.js.map +1 -0
- package/esm/vs/editor/browser/gpu/rectangleRenderer.js +1 -1
- package/esm/vs/editor/browser/gpu/viewGpuContext.js +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js +3 -2
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/browser/services/openerService.js +6 -2
- package/esm/vs/editor/browser/services/openerService.js.map +1 -1
- package/esm/vs/editor/browser/view/domLineBreaksComputer.js +34 -11
- package/esm/vs/editor/browser/view/domLineBreaksComputer.js.map +1 -1
- package/esm/vs/editor/browser/view/viewController.js +7 -7
- package/esm/vs/editor/browser/view/viewController.js.map +1 -1
- package/esm/vs/editor/browser/view/viewLayer.js +1 -1
- package/esm/vs/editor/browser/view/viewOverlays.js +4 -4
- package/esm/vs/editor/browser/view.js +5 -5
- package/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +11 -3
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js +6 -6
- package/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js +12 -12
- package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +9 -2
- package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js +2 -2
- package/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js +2 -2
- package/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js +2 -2
- package/esm/vs/editor/browser/viewParts/margin/margin.js +2 -2
- package/esm/vs/editor/browser/viewParts/minimap/minimap.js +6 -6
- package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +9 -2
- package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js +5 -5
- package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js +3 -3
- package/esm/vs/editor/browser/viewParts/rulers/rulers.js +2 -2
- package/esm/vs/editor/browser/viewParts/rulersGpu/rulersGpu.js +1 -1
- package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js +3 -3
- package/esm/vs/editor/browser/viewParts/selections/selections.js +2 -2
- package/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js +2 -2
- package/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js +6 -6
- package/esm/vs/editor/browser/viewParts/viewLines/viewLineOptions.js +5 -5
- package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js +11 -11
- package/esm/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.js +1 -1
- package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js +2 -2
- package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js +4 -4
- package/esm/vs/editor/browser/viewParts/wordWrapIndicator/wordWrapIndicator.js +2 -2
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +22 -21
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/commands.js +12 -12
- package/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js +18 -18
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +3 -3
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js +10 -10
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/diffEditor.contribution.js +4 -4
- package/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js +21 -3
- package/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js +10 -10
- package/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/registrations.contribution.js +5 -5
- package/esm/vs/editor/browser/widget/multiDiffEditor/colors.js +3 -3
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.js +2 -2
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.js +21 -2
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js +2 -2
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js +11 -3
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.js +1 -0
- package/esm/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.js.map +1 -1
- package/esm/vs/editor/common/commands/columnSelectionPasteCommand.js +64 -0
- package/esm/vs/editor/common/commands/columnSelectionPasteCommand.js.map +1 -0
- package/esm/vs/editor/common/config/editorConfigurationSchema.js +68 -58
- package/esm/vs/editor/common/config/editorConfigurationSchema.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +560 -500
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +71 -71
- package/esm/vs/editor/common/core/edits/textEdit.js +16 -0
- package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursor.js +20 -10
- package/esm/vs/editor/common/cursor/cursor.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js +67 -14
- package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorTypeOperations.js +2 -2
- package/esm/vs/editor/common/cursor/cursorTypeOperations.js.map +1 -1
- package/esm/vs/editor/common/cursorCommon.js +22 -21
- package/esm/vs/editor/common/cursorCommon.js.map +1 -1
- package/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js +21 -8
- package/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js.map +1 -1
- package/esm/vs/editor/common/diff/documentDiffProvider.js.map +1 -1
- package/esm/vs/editor/common/diff/externalLinesDiffComputer.js +38 -26
- package/esm/vs/editor/common/diff/externalLinesDiffComputer.js.map +1 -1
- package/esm/vs/editor/common/diff/rangeMapping.js +11 -1
- package/esm/vs/editor/common/diff/rangeMapping.js.map +1 -1
- package/esm/vs/editor/common/diff/verifyLinesDiff.js +28 -0
- package/esm/vs/editor/common/diff/verifyLinesDiff.js.map +1 -0
- package/esm/vs/editor/common/editorContextKeys.js +53 -53
- package/esm/vs/editor/common/languages/languageConfiguration.js +8 -0
- package/esm/vs/editor/common/languages/languageConfiguration.js.map +1 -1
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages.js +56 -56
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/services/editorWebWorker.js +27 -6
- package/esm/vs/editor/common/services/editorWebWorker.js.map +1 -1
- package/esm/vs/editor/common/services/editorWorker.js.map +1 -1
- package/esm/vs/editor/common/services/languageService.js +6 -4
- package/esm/vs/editor/common/services/languageService.js.map +1 -1
- package/esm/vs/editor/common/services/markerDecorationsService.js +21 -2
- package/esm/vs/editor/common/services/markerDecorationsService.js.map +1 -1
- package/esm/vs/editor/common/standalone/standaloneEnums.js +100 -97
- package/esm/vs/editor/common/standalone/standaloneEnums.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +11 -11
- package/esm/vs/editor/common/textModelEditSource.js +9 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLayout.js +16 -16
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +19 -19
- package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +9 -9
- package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +23 -20
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/esm/vs/editor/contrib/codeAction/browser/codeActionModel.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js +25 -10
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js.map +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerContribution.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +3 -3
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +17 -17
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js.map +1 -1
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +39 -39
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/pasteEditSession.js +19 -0
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/pasteEditSession.js.map +1 -0
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +26 -18
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js.map +1 -1
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +18 -18
- package/esm/vs/editor/contrib/find/browser/findController.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findModel.js +6 -6
- package/esm/vs/editor/contrib/find/browser/findWidget.js +40 -40
- package/esm/vs/editor/contrib/find/browser/findWidget.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js +23 -23
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +2 -2
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +4 -4
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js.map +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/contentHoverController.js +9 -3
- package/esm/vs/editor/contrib/hover/browser/contentHoverController.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/glyphHoverController.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js +2 -1
- package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +10 -8
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +6 -6
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +5 -5
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +9 -9
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js +3 -3
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +21 -21
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -13
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +6 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +7 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +3 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +5 -4
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js.map +1 -1
- package/esm/vs/editor/contrib/links/browser/links.js +16 -15
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/editor/contrib/longLinesHelper/browser/longLinesHelper.js +1 -1
- package/esm/vs/editor/contrib/message/browser/messageController.js +16 -12
- package/esm/vs/editor/contrib/message/browser/messageController.js.map +1 -1
- package/esm/vs/editor/contrib/middleScroll/browser/middleScrollController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +91 -55
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js.map +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js +3 -3
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js.map +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +6 -4
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js.map +1 -1
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderTextContribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +12 -12
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +3 -3
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +6 -6
- package/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +23 -13
- package/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js.map +1 -1
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +5 -5
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +5 -5
- package/esm/vs/editor/contrib/snippet/browser/snippetSession.js +2 -2
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +10 -8
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.js +2 -2
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +6 -6
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -9
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +15 -15
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestModel.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +27 -27
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +8 -6
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +5 -5
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +3 -3
- package/esm/vs/editor/contrib/suggest/browser/wordDistance.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +27 -27
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/textualHighlightProvider.js +1 -1
- package/esm/vs/editor/contrib/wordHighlighter/browser/textualHighlightProvider.js.map +1 -1
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +50 -14
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js.map +1 -1
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +6 -6
- package/esm/vs/editor/editor.api.d.ts +133 -98
- package/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js +1 -1
- package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js +5 -3
- package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneCodeEditor.js +15 -1
- package/esm/vs/editor/standalone/browser/standaloneCodeEditor.js.map +1 -1
- package/esm/vs/nls.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +72 -66
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js.map +1 -1
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +434 -136
- package/esm/vs/platform/actionWidget/browser/actionList.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +74 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +24 -26
- package/esm/vs/platform/actionWidget/browser/actionWidget.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidgetMotion.js +16 -0
- package/esm/vs/platform/actionWidget/browser/actionWidgetMotion.js.map +1 -0
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +15 -17
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js.map +1 -1
- package/esm/vs/platform/actions/browser/toolbar.js +25 -12
- package/esm/vs/platform/actions/browser/toolbar.js.map +1 -1
- package/esm/vs/platform/actions/common/actions.js +4 -2
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +15 -8
- package/esm/vs/platform/actions/common/menuService.js.map +1 -1
- package/esm/vs/platform/configuration/common/configuration.js +3 -1
- package/esm/vs/platform/configuration/common/configuration.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationModels.js +16 -11
- package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationRegistry.js +29 -27
- package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurations.js +13 -1
- package/esm/vs/platform/configuration/common/configurations.js.map +1 -1
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +2 -2
- package/esm/vs/platform/contextkey/browser/contextKeyService.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +28 -14
- package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkeys.js +10 -10
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/contextview/browser/contextMenuHandler.js +17 -4
- package/esm/vs/platform/contextview/browser/contextMenuHandler.js.map +1 -1
- package/esm/vs/platform/contextview/browser/contextMenuService.js +1 -1
- package/esm/vs/platform/contextview/browser/contextMenuService.js.map +1 -1
- package/esm/vs/platform/contextview/browser/contextView.js.map +1 -1
- package/esm/vs/platform/contextview/browser/contextViewService.js +7 -2
- package/esm/vs/platform/contextview/browser/contextViewService.js.map +1 -1
- package/esm/vs/platform/editor/common/editor.js +17 -0
- package/esm/vs/platform/editor/common/editor.js.map +1 -1
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverService.js +6 -3
- package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +38 -6
- package/esm/vs/platform/hover/browser/hoverWidget.js.map +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +32 -5
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +5 -5
- package/esm/vs/platform/keybinding/common/keybindingResolver.js +1 -1
- package/esm/vs/platform/keybinding/common/keybindingResolver.js.map +1 -1
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/markers/common/markerService.js +11 -8
- package/esm/vs/platform/markers/common/markerService.js.map +1 -1
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/markers/common/markers.js.map +1 -1
- package/esm/vs/platform/notification/common/notification.js.map +1 -1
- package/esm/vs/platform/notification/common/notificationMessage.js +37 -0
- package/esm/vs/platform/notification/common/notificationMessage.js.map +1 -0
- package/esm/vs/platform/opener/common/opener.js.map +1 -1
- package/esm/vs/platform/progress/common/progress.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/media/quickInput.css +33 -2
- package/esm/vs/platform/quickinput/browser/quickAccess.js +7 -4
- package/esm/vs/platform/quickinput/browser/quickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +65 -15
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js +96 -90
- package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputService.js +5 -7
- package/esm/vs/platform/quickinput/browser/quickInputService.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickTree.js +1 -1
- package/esm/vs/platform/quickinput/common/quickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
- package/esm/vs/platform/storage/common/storage.js.map +1 -1
- package/esm/vs/platform/theme/common/colorRegistry.js +1 -0
- package/esm/vs/platform/theme/common/colorRegistry.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +11 -3
- package/esm/vs/platform/theme/common/colorUtils.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/baseColors.js +19 -19
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -9
- package/esm/vs/platform/theme/common/colors/chartsColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/confettiColors.js +14 -0
- package/esm/vs/platform/theme/common/colors/confettiColors.js.map +1 -0
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +48 -48
- package/esm/vs/platform/theme/common/colors/inputColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
- package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +10 -10
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +133 -98
- package/package.json +3 -3
- package/version.txt +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/browser/dom.ts","vs/base/browser/dom.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C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AE,CAAC;QAC3C,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,CAAC;AACF,CAAC;AAMD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IAIzD,oBAAoB;QACnB,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,iBAAiB;QAChB,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;IACvB,CAAC;CACD;AAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;IAChD,cAAc,CAAC,MAAM,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,CAAC;AACzE,CAAC","file":"dom.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from './browser.js';\nimport { BrowserFeatures } from './canIUse.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from './keyboardEvent.js';\nimport { IMouseEvent, StandardMouseEvent } from './mouseEvent.js';\nimport { AbstractIdleValue, IntervalTimer, _runWhenIdle, IdleDeadline } from '../common/async.js';\nimport { BugIndicatingError, onUnexpectedError } from '../common/errors.js';\nimport * as event from '../common/event.js';\nimport { KeyCode } from '../common/keyCodes.js';\nimport { Disposable, DisposableStore, IDisposable, markAsSingleton, toDisposable } from '../common/lifecycle.js';\nimport { RemoteAuthorities } from '../common/network.js';\nimport * as platform from '../common/platform.js';\nimport { hash } from '../common/hash.js';\nimport { CodeWindow, ensureCodeWindow, mainWindow } from './window.js';\nimport { isPointWithinTriangle } from '../common/numbers.js';\nimport { IObservable, derived, derivedOpts, IReader, observableValue, isObservable } from '../common/observable.js';\n\nexport interface IRegisteredCodeWindow {\n\treadonly window: CodeWindow;\n\treadonly disposables: DisposableStore;\n}\n\n//# region Multi-Window Support Utilities\n\nexport const {\n\tregisterWindow,\n\tgetWindow,\n\tgetDocument,\n\tgetWindows,\n\tgetWindowsCount,\n\tgetWindowId,\n\tgetWindowById,\n\thasWindow,\n\tonDidRegisterWindow,\n\tonWillUnregisterWindow,\n\tonDidUnregisterWindow\n} = (function () {\n\tconst windows = new Map<number, IRegisteredCodeWindow>();\n\n\tensureCodeWindow(mainWindow, 1);\n\tconst mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n\twindows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n\n\tconst onDidRegisterWindow = new event.Emitter<IRegisteredCodeWindow>();\n\tconst onDidUnregisterWindow = new event.Emitter<CodeWindow>();\n\tconst onWillUnregisterWindow = new event.Emitter<CodeWindow>();\n\n\tfunction getWindowById(windowId: number): IRegisteredCodeWindow | undefined;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain: true): IRegisteredCodeWindow;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain?: boolean): IRegisteredCodeWindow | undefined {\n\t\tconst window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n\n\t\treturn window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n\t}\n\n\treturn {\n\t\tonDidRegisterWindow: onDidRegisterWindow.event,\n\t\tonWillUnregisterWindow: onWillUnregisterWindow.event,\n\t\tonDidUnregisterWindow: onDidUnregisterWindow.event,\n\t\tregisterWindow(window: CodeWindow): IDisposable {\n\t\t\tif (windows.has(window.vscodeWindowId)) {\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tconst disposables = new DisposableStore();\n\n\t\t\tconst registeredWindow = {\n\t\t\t\twindow,\n\t\t\t\tdisposables: disposables.add(new DisposableStore())\n\t\t\t};\n\t\t\twindows.set(window.vscodeWindowId, registeredWindow);\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\twindows.delete(window.vscodeWindowId);\n\t\t\t\tonDidUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tdisposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n\t\t\t\tonWillUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tonDidRegisterWindow.fire(registeredWindow);\n\n\t\t\treturn disposables;\n\t\t},\n\t\tgetWindows(): Iterable<IRegisteredCodeWindow> {\n\t\t\treturn windows.values();\n\t\t},\n\t\tgetWindowsCount(): number {\n\t\t\treturn windows.size;\n\t\t},\n\t\tgetWindowId(targetWindow: Window): number {\n\t\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t\t},\n\t\thasWindow(windowId: number): boolean {\n\t\t\treturn windows.has(windowId);\n\t\t},\n\t\tgetWindowById,\n\t\tgetWindow(e: Node | UIEvent | undefined | null): CodeWindow {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\tif (candidateNode?.ownerDocument?.defaultView) {\n\t\t\t\treturn candidateNode.ownerDocument.defaultView.window as CodeWindow;\n\t\t\t}\n\n\t\t\tconst candidateEvent = e as UIEvent | undefined | null;\n\t\t\tif (candidateEvent?.view) {\n\t\t\t\treturn candidateEvent.view.window as CodeWindow;\n\t\t\t}\n\n\t\t\treturn mainWindow;\n\t\t},\n\t\tgetDocument(e: Node | UIEvent | undefined | null): Document {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\treturn getWindow(candidateNode).document;\n\t\t}\n\t};\n})();\n\n//#endregion\n\n//#region External Focus Tracking\n\n/**\n * Information about external focus state, including the associated window.\n */\nexport interface IExternalFocusInfo {\n\treadonly hasFocus: boolean;\n\treadonly window?: CodeWindow;\n}\n\n/**\n * A function that checks if a component outside the normal DOM tree has focus.\n * Returns focus info including which window the component is associated with.\n */\nexport type ExternalFocusChecker = () => IExternalFocusInfo;\n\n/**\n * A registry for functions that check if a component outside the normal DOM tree has focus.\n * This is used to extend the concept of \"window has focus\" to include things like\n * Electron WebContentsViews (browser views) that exist outside the workbench DOM.\n */\nconst externalFocusCheckers = new Set<ExternalFocusChecker>();\n\n/**\n * Get the window associated with a focused external component.\n * This is used to determine which window should receive UI like dialogs\n * when an external component (like a browser view) has focus.\n *\n * @returns The window of the focused external component, or undefined if none\n */\nexport function getExternalFocusWindow(): CodeWindow | undefined {\n\tfor (const checker of externalFocusCheckers) {\n\t\tconst info = checker();\n\t\tif (info.hasFocus && info.window) {\n\t\t\treturn info.window;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n//#endregion\n\nexport function clearNode(node: HTMLElement): void {\n\twhile (node.firstChild) {\n\t\tnode.firstChild.remove();\n\t}\n}\n\nclass DomListener implements IDisposable {\n\n\tprivate _handler: (e: any) => void;\n\tprivate _node: EventTarget;\n\tprivate readonly _type: string;\n\tprivate readonly _options: boolean | AddEventListenerOptions;\n\n\tconstructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {\n\t\tthis._node = node;\n\t\tthis._type = type;\n\t\tthis._handler = handler;\n\t\tthis._options = (options || false);\n\t\tthis._node.addEventListener(this._type, this._handler, this._options);\n\t}\n\n\tdispose(): void {\n\t\tif (!this._handler) {\n\t\t\t// Already disposed\n\t\t\treturn;\n\t\t}\n\n\t\tthis._node.removeEventListener(this._type, this._handler, this._options);\n\n\t\t// Prevent leakers from holding on to the dom or handler func\n\t\tthis._node = null!;\n\t\tthis._handler = null!;\n\t}\n}\n\nexport function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable {\n\treturn new DomListener(node, type, handler, useCaptureOrOptions);\n}\n\nexport interface IAddStandardDisposableListenerSignature {\n\t(node: HTMLElement | Element | Document, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerdown', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointermove', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerup', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\n}\nfunction _wrapAsStandardMouseEvent(targetWindow: Window, handler: (e: IMouseEvent) => void): (e: MouseEvent) => void {\n\treturn function (e: MouseEvent) {\n\t\treturn handler(new StandardMouseEvent(targetWindow, e));\n\t};\n}\nfunction _wrapAsStandardKeyboardEvent(handler: (e: IKeyboardEvent) => void): (e: KeyboardEvent) => void {\n\treturn function (e: KeyboardEvent) {\n\t\treturn handler(new StandardKeyboardEvent(e));\n\t};\n}\nexport const addStandardDisposableListener: IAddStandardDisposableListenerSignature = function addStandardDisposableListener(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tlet wrapHandler = handler;\n\n\tif (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n\t\twrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\t} else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n\t\twrapHandler = _wrapAsStandardKeyboardEvent(handler);\n\t}\n\n\treturn addDisposableListener(node, type, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseMoveListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseUpListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\n}\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nexport function runWhenWindowIdle(targetWindow: Window | typeof globalThis, callback: (idle: IdleDeadline) => void, timeout?: number): IDisposable {\n\treturn _runWhenIdle(targetWindow, callback, timeout);\n}\n\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue<T> extends AbstractIdleValue<T> {\n\tconstructor(targetWindow: Window | typeof globalThis, executor: () => T) {\n\t\tsuper(targetWindow, executor);\n\t}\n}\n\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n\nexport class WindowIntervalTimer extends IntervalTimer {\n\n\tprivate readonly defaultTarget?: Window & typeof globalThis;\n\n\t/**\n\t *\n\t * @param node The optional node from which the target window is determined\n\t */\n\tconstructor(node?: Node) {\n\t\tsuper();\n\t\tthis.defaultTarget = node && getWindow(node);\n\t}\n\n\toverride cancelAndSet(runner: () => void, interval: number, targetWindow?: Window & typeof globalThis): void {\n\t\treturn super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n\t}\n}\n\nclass AnimationFrameQueueItem implements IDisposable {\n\n\tprivate _runner: () => void;\n\tpublic priority: number;\n\tprivate _canceled: boolean;\n\n\tconstructor(runner: () => void, priority: number = 0) {\n\t\tthis._runner = runner;\n\t\tthis.priority = priority;\n\t\tthis._canceled = false;\n\t}\n\n\tdispose(): void {\n\t\tthis._canceled = true;\n\t}\n\n\texecute(): void {\n\t\tif (this._canceled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis._runner();\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t}\n\n\t// Sort by priority (largest to lowest)\n\tstatic sort(a: AnimationFrameQueueItem, b: AnimationFrameQueueItem): number {\n\t\treturn b.priority - a.priority;\n\t}\n}\n\n(function () {\n\t/**\n\t * The runners scheduled at the next animation frame\n\t */\n\tconst NEXT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * The runners scheduled at the current animation frame\n\t */\n\tconst CURRENT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * A flag to keep track if the native requestAnimationFrame was already called\n\t */\n\tconst animFrameRequested = new Map<number /* window ID */, boolean>();\n\t/**\n\t * A flag to indicate if currently handling a native requestAnimationFrame callback\n\t */\n\tconst inAnimationFrameRunner = new Map<number /* window ID */, boolean>();\n\n\tconst animationFrameRunner = (targetWindowId: number) => {\n\t\tanimFrameRequested.set(targetWindowId, false);\n\n\t\tconst currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\tNEXT_QUEUE.set(targetWindowId, []);\n\n\t\tinAnimationFrameRunner.set(targetWindowId, true);\n\t\twhile (currentQueue.length > 0) {\n\t\t\tcurrentQueue.sort(AnimationFrameQueueItem.sort);\n\t\t\tconst top = currentQueue.shift()!;\n\t\t\ttop.execute();\n\t\t}\n\t\tinAnimationFrameRunner.set(targetWindowId, false);\n\t};\n\n\tscheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority: number = 0) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\n\t\tlet nextQueue = NEXT_QUEUE.get(targetWindowId);\n\t\tif (!nextQueue) {\n\t\t\tnextQueue = [];\n\t\t\tNEXT_QUEUE.set(targetWindowId, nextQueue);\n\t\t}\n\t\tnextQueue.push(item);\n\n\t\tif (!animFrameRequested.get(targetWindowId)) {\n\t\t\tanimFrameRequested.set(targetWindowId, true);\n\t\t\ttargetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n\t\t}\n\n\t\treturn item;\n\t};\n\n\trunAtThisOrScheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority?: number) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tif (inAnimationFrameRunner.get(targetWindowId)) {\n\t\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\t\t\tlet currentQueue = CURRENT_QUEUE.get(targetWindowId);\n\t\t\tif (!currentQueue) {\n\t\t\t\tcurrentQueue = [];\n\t\t\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\t\t}\n\t\t\tcurrentQueue.push(item);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n\t\t}\n\t};\n})();\n\nexport function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {\n\treturn getWindow(el).getComputedStyle(el, null);\n}\n\nexport function getClientArea(element: HTMLElement, defaultValue?: Dimension, fallbackElement?: HTMLElement): Dimension {\n\tconst elWindow = getWindow(element);\n\tconst elDocument = elWindow.document;\n\n\t// Try with DOM clientWidth / clientHeight\n\tif (element !== elDocument.body) {\n\t\treturn new Dimension(element.clientWidth, element.clientHeight);\n\t}\n\n\t// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n\tif (platform.isIOS && elWindow?.visualViewport) {\n\t\treturn new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n\t}\n\n\t// Try innerWidth / innerHeight\n\tif (elWindow?.innerWidth && elWindow.innerHeight) {\n\t\treturn new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n\t}\n\n\t// Try with document.body.clientWidth / document.body.clientHeight\n\tif (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n\t\treturn new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n\t}\n\n\t// Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n\tif (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n\t\treturn new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n\t}\n\n\tif (fallbackElement) {\n\t\treturn getClientArea(fallbackElement, defaultValue);\n\t}\n\n\tif (defaultValue) {\n\t\treturn defaultValue;\n\t}\n\n\tthrow new Error('Unable to figure out browser width and height');\n}\n\nclass SizeUtils {\n\t// Adapted from WinJS\n\t// Converts a CSS positioning string for the specified element to pixels.\n\tprivate static convertToPixels(element: HTMLElement, value: string): number {\n\t\treturn parseFloat(value) || 0;\n\t}\n\n\tprivate static getDimension(element: HTMLElement, cssPropertyName: string): number {\n\t\tconst computedStyle = getComputedStyle(element);\n\t\tconst value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n\t\treturn SizeUtils.convertToPixels(element, value);\n\t}\n\n\tstatic getBorderLeftWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-left-width');\n\t}\n\tstatic getBorderRightWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-right-width');\n\t}\n\tstatic getBorderTopWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-top-width');\n\t}\n\tstatic getBorderBottomWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-bottom-width');\n\t}\n\n\tstatic getPaddingLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-left');\n\t}\n\tstatic getPaddingRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-right');\n\t}\n\tstatic getPaddingTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-top');\n\t}\n\tstatic getPaddingBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-bottom');\n\t}\n\n\tstatic getMarginLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-left');\n\t}\n\tstatic getMarginTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-top');\n\t}\n\tstatic getMarginRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-right');\n\t}\n\tstatic getMarginBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-bottom');\n\t}\n}\n\n// ----------------------------------------------------------------------------------------\n// Position & Dimension\n\nexport interface IDimension {\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport class Dimension implements IDimension {\n\n\tstatic readonly None = new Dimension(0, 0);\n\n\tconstructor(\n\t\treadonly width: number,\n\t\treadonly height: number,\n\t) { }\n\n\twith(width: number = this.width, height: number = this.height): Dimension {\n\t\tif (width !== this.width || height !== this.height) {\n\t\t\treturn new Dimension(width, height);\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tstatic is(obj: unknown): obj is IDimension {\n\t\treturn typeof obj === 'object' && typeof (<IDimension>obj).height === 'number' && typeof (<IDimension>obj).width === 'number';\n\t}\n\n\tstatic lift(obj: IDimension): Dimension {\n\t\tif (obj instanceof Dimension) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\treturn new Dimension(obj.width, obj.height);\n\t\t}\n\t}\n\n\tstatic equals(a: Dimension | undefined, b: Dimension | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.width === b.width && a.height === b.height;\n\t}\n}\n\nexport interface IDomPosition {\n\treadonly left: number;\n\treadonly top: number;\n}\n\nexport function getTopLeftOffset(element: HTMLElement): IDomPosition {\n\t// Adapted from WinJS.Utilities.getPosition\n\t// and added borders to the mix\n\n\tlet offsetParent = element.offsetParent;\n\tlet top = element.offsetTop;\n\tlet left = element.offsetLeft;\n\n\twhile (\n\t\t(element = <HTMLElement>element.parentNode) !== null\n\t\t&& element !== element.ownerDocument.body\n\t\t&& element !== element.ownerDocument.documentElement\n\t) {\n\t\ttop -= element.scrollTop;\n\t\tconst c = isShadowRoot(element) ? null : getComputedStyle(element);\n\t\tif (c) {\n\t\t\tleft -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n\t\t}\n\n\t\tif (element === offsetParent) {\n\t\t\tleft += SizeUtils.getBorderLeftWidth(element);\n\t\t\ttop += SizeUtils.getBorderTopWidth(element);\n\t\t\ttop += element.offsetTop;\n\t\t\tleft += element.offsetLeft;\n\t\t\toffsetParent = element.offsetParent;\n\t\t}\n\t}\n\n\treturn {\n\t\tleft: left,\n\t\ttop: top\n\t};\n}\n\nexport interface IDomNodePagePosition {\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n}\n\nexport function size(element: HTMLElement, width: number | null, height: number | null): void {\n\tif (typeof width === 'number') {\n\t\telement.style.width = `${width}px`;\n\t}\n\n\tif (typeof height === 'number') {\n\t\telement.style.height = `${height}px`;\n\t}\n}\n\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition {\n\tconst bb = domNode.getBoundingClientRect();\n\tconst window = getWindow(domNode);\n\treturn {\n\t\tleft: bb.left + window.scrollX,\n\t\ttop: bb.top + window.scrollY,\n\t\twidth: bb.width,\n\t\theight: bb.height\n\t};\n}\n\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode: HTMLElement): number {\n\tlet testElement: HTMLElement | null = domNode;\n\tlet zoom = 1.0;\n\tdo {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst elementZoomLevel = (getComputedStyle(testElement) as any).zoom;\n\t\tif (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n\t\t\tzoom *= elementZoomLevel;\n\t\t}\n\n\t\ttestElement = testElement.parentElement;\n\t} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n\n\treturn zoom;\n}\n\n\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.offsetWidth + margin;\n}\n\nexport function getContentWidth(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n\tconst padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n\treturn element.offsetWidth - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n\tconst padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n\treturn element.offsetHeight - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n\treturn element.offsetHeight + margin;\n}\n\n// ----------------------------------------------------------------------------------------\n\nexport function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean {\n\treturn Boolean(testAncestor?.contains(testChild));\n}\n\nexport function findParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (typeof clazz === 'string' ? node.classList.contains(clazz) : clazz.every(candidate => node.classList.contains(candidate))) {\n\t\t\treturn node;\n\t\t}\n\n\t\tif (stopAtClazzOrNode) {\n\t\t\tif (typeof stopAtClazzOrNode === 'string') {\n\t\t\t\tif (node.classList.contains(stopAtClazzOrNode)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (node === stopAtClazzOrNode) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnode = <HTMLElement>node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function hasParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): boolean {\n\treturn !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\n\nexport function isShadowRoot(node: Node): node is ShadowRoot {\n\treturn (\n\t\tnode && !!(<ShadowRoot>node).host && !!(<ShadowRoot>node).mode\n\t);\n}\n\nexport function isInShadowDOM(domNode: Node): boolean {\n\treturn !!getShadowRoot(domNode);\n}\n\nexport function getShadowRoot(domNode: Node): ShadowRoot | null {\n\twhile (domNode.parentNode) {\n\t\tif (domNode === domNode.ownerDocument?.body) {\n\t\t\t// reached the body\n\t\t\treturn null;\n\t\t}\n\t\tdomNode = domNode.parentNode;\n\t}\n\treturn isShadowRoot(domNode) ? domNode : null;\n}\n\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement(): Element | null {\n\tlet result = getActiveDocument().activeElement;\n\n\twhile (result?.shadowRoot) {\n\t\tresult = result.shadowRoot.activeElement;\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element: Element): boolean {\n\treturn getActiveElement() === element;\n}\n\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor: Element): boolean {\n\treturn isAncestor(getActiveElement(), ancestor);\n}\n\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus (including external components like browser views),\n * otherwise falls back to the main windows document.\n */\nexport function getActiveDocument(): Document {\n\tif (getWindowsCount() <= 1) {\n\t\treturn mainWindow.document;\n\t}\n\n\tconst documents = Array.from(getWindows()).map(({ window }) => window.document);\n\tconst focusedDoc = documents.find(doc => doc.hasFocus());\n\tif (focusedDoc) {\n\t\treturn focusedDoc;\n\t}\n\n\t// Check if an external component (like browser view) has focus\n\tconst externalWindow = getExternalFocusWindow();\n\tif (externalWindow) {\n\t\treturn externalWindow.document;\n\t}\n\n\treturn mainWindow.document;\n}\n\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow(): CodeWindow {\n\tconst document = getActiveDocument();\n\treturn (document.defaultView?.window ?? mainWindow) as CodeWindow;\n}\n\ninterface IMutationObserver {\n\tusers: number;\n\treadonly observer: MutationObserver;\n\treadonly onDidMutate: event.Event<MutationRecord[]>;\n}\n\nexport const sharedMutationObserver = new class {\n\n\treadonly mutationObservers = new Map<Node, Map<number, IMutationObserver>>();\n\n\tobserve(target: Node, disposables: DisposableStore, options?: MutationObserverInit): event.Event<MutationRecord[]> {\n\t\tlet mutationObserversPerTarget = this.mutationObservers.get(target);\n\t\tif (!mutationObserversPerTarget) {\n\t\t\tmutationObserversPerTarget = new Map<number, IMutationObserver>();\n\t\t\tthis.mutationObservers.set(target, mutationObserversPerTarget);\n\t\t}\n\n\t\tconst optionsHash = hash(options);\n\t\tlet mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n\t\tif (!mutationObserverPerOptions) {\n\t\t\tconst onDidMutate = new event.Emitter<MutationRecord[]>();\n\t\t\tconst observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n\t\t\tobserver.observe(target, options);\n\n\t\t\tconst resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n\t\t\t\tusers: 1,\n\t\t\t\tobserver,\n\t\t\t\tonDidMutate: onDidMutate.event\n\t\t\t};\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tresolvedMutationObserverPerOptions.users -= 1;\n\n\t\t\t\tif (resolvedMutationObserverPerOptions.users === 0) {\n\t\t\t\t\tonDidMutate.dispose();\n\t\t\t\t\tobserver.disconnect();\n\n\t\t\t\t\tmutationObserversPerTarget?.delete(optionsHash);\n\t\t\t\t\tif (mutationObserversPerTarget?.size === 0) {\n\t\t\t\t\t\tthis.mutationObservers.delete(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tmutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n\t\t} else {\n\t\t\tmutationObserverPerOptions.users += 1;\n\t\t}\n\n\t\treturn mutationObserverPerOptions.onDidMutate;\n\t}\n};\n\nexport function isHTMLElement(e: unknown): e is HTMLElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;\n}\n\nexport function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLAnchorElement || e instanceof getWindow(e as Node).HTMLAnchorElement;\n}\n\nexport function isSVGElement(e: unknown): e is SVGElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof SVGElement || e instanceof getWindow(e as Node).SVGElement;\n}\n\nexport function isMouseEvent(e: unknown): e is MouseEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;\n}\n\nexport function isKeyboardEvent(e: unknown): e is KeyboardEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof KeyboardEvent || e instanceof getWindow(e as UIEvent).KeyboardEvent;\n}\n\nexport const EventType = {\n\t// Mouse\n\tCLICK: 'click',\n\tAUXCLICK: 'auxclick',\n\tDBLCLICK: 'dblclick',\n\tMOUSE_UP: 'mouseup',\n\tMOUSE_DOWN: 'mousedown',\n\tMOUSE_OVER: 'mouseover',\n\tMOUSE_MOVE: 'mousemove',\n\tMOUSE_OUT: 'mouseout',\n\tMOUSE_ENTER: 'mouseenter',\n\tMOUSE_LEAVE: 'mouseleave',\n\tMOUSE_WHEEL: 'wheel',\n\tPOINTER_UP: 'pointerup',\n\tPOINTER_DOWN: 'pointerdown',\n\tPOINTER_MOVE: 'pointermove',\n\tPOINTER_LEAVE: 'pointerleave',\n\tCONTEXT_MENU: 'contextmenu',\n\tWHEEL: 'wheel',\n\t// Keyboard\n\tKEY_DOWN: 'keydown',\n\tKEY_PRESS: 'keypress',\n\tKEY_UP: 'keyup',\n\t// HTML Document\n\tLOAD: 'load',\n\tBEFORE_UNLOAD: 'beforeunload',\n\tUNLOAD: 'unload',\n\tPAGE_SHOW: 'pageshow',\n\tPAGE_HIDE: 'pagehide',\n\tPASTE: 'paste',\n\tABORT: 'abort',\n\tERROR: 'error',\n\tRESIZE: 'resize',\n\tSCROLL: 'scroll',\n\tFULLSCREEN_CHANGE: 'fullscreenchange',\n\tWK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n\t// Form\n\tSELECT: 'select',\n\tCHANGE: 'change',\n\tSUBMIT: 'submit',\n\tRESET: 'reset',\n\tFOCUS: 'focus',\n\tFOCUS_IN: 'focusin',\n\tFOCUS_OUT: 'focusout',\n\tBLUR: 'blur',\n\tINPUT: 'input',\n\t// Local Storage\n\tSTORAGE: 'storage',\n\t// Drag\n\tDRAG_START: 'dragstart',\n\tDRAG: 'drag',\n\tDRAG_ENTER: 'dragenter',\n\tDRAG_LEAVE: 'dragleave',\n\tDRAG_OVER: 'dragover',\n\tDROP: 'drop',\n\tDRAG_END: 'dragend',\n\t// Animation\n\tANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n\tANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n\tANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n} as const;\n\nexport interface EventLike {\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport function isEventLike(obj: unknown): obj is EventLike {\n\tconst candidate = obj as EventLike | undefined;\n\n\treturn !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\n\nexport const EventHelper = {\n\tstop: <T extends EventLike>(e: T, cancelBubble?: boolean): T => {\n\t\te.preventDefault();\n\t\tif (cancelBubble) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\treturn e;\n\t}\n};\n\nexport interface IFocusTracker extends Disposable {\n\treadonly onDidFocus: event.Event<void>;\n\treadonly onDidBlur: event.Event<void>;\n}\n\nexport function saveParentsScrollTop(node: Element): number[] {\n\tconst r: number[] = [];\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tr[i] = node.scrollTop;\n\t\tnode = <Element>node.parentNode;\n\t}\n\treturn r;\n}\n\nexport function restoreParentsScrollTop(node: Element, state: number[]): void {\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tif (node.scrollTop !== state[i]) {\n\t\t\tnode.scrollTop = state[i];\n\t\t}\n\t\tnode = <Element>node.parentNode;\n\t}\n}\n\nclass FocusTracker extends Disposable implements IFocusTracker {\n\n\tprivate readonly _onDidFocus = this._register(new event.Emitter<void>());\n\tget onDidFocus() { return this._onDidFocus.event; }\n\n\tprivate readonly _onDidBlur = this._register(new event.Emitter<void>());\n\tget onDidBlur() { return this._onDidBlur.event; }\n\n\tprivate _refreshStateHandler: () => void;\n\n\tprivate static hasFocusWithin(element: HTMLElement | Window): boolean {\n\t\tif (isHTMLElement(element)) {\n\t\t\tconst shadowRoot = getShadowRoot(element);\n\t\t\tconst activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n\t\t\treturn isAncestor(activeElement, element);\n\t\t} else {\n\t\t\tconst window = element;\n\t\t\treturn isAncestor(window.document.activeElement, window.document);\n\t\t}\n\t}\n\n\tconstructor(element: HTMLElement | Window) {\n\t\tsuper();\n\t\tlet hasFocus = FocusTracker.hasFocusWithin(element);\n\t\tlet loosingFocus = false;\n\n\t\tconst onFocus = () => {\n\t\t\tloosingFocus = false;\n\t\t\tif (!hasFocus) {\n\t\t\t\thasFocus = true;\n\t\t\t\tthis._onDidFocus.fire();\n\t\t\t}\n\t\t};\n\n\t\tconst onBlur = () => {\n\t\t\tif (hasFocus) {\n\t\t\t\tloosingFocus = true;\n\t\t\t\t(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {\n\t\t\t\t\tif (loosingFocus) {\n\t\t\t\t\t\tloosingFocus = false;\n\t\t\t\t\t\thasFocus = false;\n\t\t\t\t\t\tthis._onDidBlur.fire();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t};\n\n\t\tthis._refreshStateHandler = () => {\n\t\t\tconst currentNodeHasFocus = FocusTracker.hasFocusWithin(<HTMLElement>element);\n\t\t\tif (currentNodeHasFocus !== hasFocus) {\n\t\t\t\tif (hasFocus) {\n\t\t\t\t\tonBlur();\n\t\t\t\t} else {\n\t\t\t\t\tonFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n\t\tthis._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n\t\tif (isHTMLElement(element)) {\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n\t\t}\n\n\t}\n}\n\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element: HTMLElement | Window): IFocusTracker {\n\treturn new FocusTracker(element);\n}\n\nexport function after<T extends Node>(sibling: HTMLElement, child: T): T {\n\tsibling.after(child);\n\treturn child;\n}\n\nexport function append<T extends Node>(parent: HTMLElement, child: T): T;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): void;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): T | void {\n\tparent.append(...children);\n\tif (children.length === 1 && typeof children[0] !== 'string') {\n\t\treturn children[0];\n\t}\n}\n\nexport function prepend<T extends Node>(parent: HTMLElement, child: T): T {\n\tparent.insertBefore(child, parent.firstChild);\n\treturn child;\n}\n\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent: HTMLElement, ...children: Array<Node | string>): void {\n\tparent.textContent = '';\n\tappend(parent, ...children);\n}\n\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\n\nexport enum Namespace {\n\tHTML = 'http://www.w3.org/1999/xhtml',\n\tSVG = 'http://www.w3.org/2000/svg'\n}\n\nfunction _$<T extends Element>(namespace: Namespace, description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\tconst match = SELECTOR_REGEX.exec(description);\n\n\tif (!match) {\n\t\tthrow new Error('Bad use of emmet');\n\t}\n\n\tconst tagName = match[1] || 'div';\n\tlet result: T;\n\n\tif (namespace !== Namespace.HTML) {\n\t\tresult = document.createElementNS(namespace as string, tagName) as T;\n\t} else {\n\t\tresult = document.createElement(tagName) as unknown as T;\n\t}\n\n\tif (match[3]) {\n\t\tresult.id = match[3];\n\t}\n\tif (match[4]) {\n\t\tresult.className = match[4].replace(/\\./g, ' ').trim();\n\t}\n\n\tif (attrs) {\n\t\tObject.entries(attrs).forEach(([name, value]) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (/^on\\w+$/.test(name)) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(<any>result)[name] = value;\n\t\t\t} else if (name === 'selected') {\n\t\t\t\tif (value) {\n\t\t\t\t\tresult.setAttribute(name, 'true');\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.setAttribute(name, value);\n\t\t\t}\n\t\t});\n\t}\n\n\tresult.append(...children);\n\n\treturn result;\n}\n\nexport function $<T extends HTMLElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.HTML, description, attrs, ...children);\n}\n\n$.SVG = function <T extends SVGElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.SVG, description, attrs, ...children);\n};\n\nexport function setVisibility(visible: boolean, ...elements: HTMLElement[]): void {\n\tif (visible) {\n\t\tshow(...elements);\n\t} else {\n\t\thide(...elements);\n\t}\n}\n\nexport function show(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = '';\n\t\telement.removeAttribute('aria-hidden');\n\t}\n}\n\nexport function hide(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = 'none';\n\t\telement.setAttribute('aria-hidden', 'true');\n\t}\n}\n\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window: Window, cssPx: number): number {\n\tconst screenPx = window.devicePixelRatio * cssPx;\n\treturn Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url: string): void {\n\t// By using 'noopener' in the `windowFeatures` argument, the newly created window will\n\t// not be able to use `window.opener` to reach back to the current page.\n\t// See https://stackoverflow.com/a/46958731\n\t// See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n\t// However, this also doesn't allow us to realize if the browser blocked\n\t// the creation of the window.\n\tmainWindow.open(url, '_blank', 'noopener');\n}\n\nexport function animate(targetWindow: Window, fn: () => void): IDisposable {\n\tconst step = () => {\n\t\tfn();\n\t\tstepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\t};\n\n\tlet stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\treturn toDisposable(() => stepDisposable.dispose());\n}\n\nRemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http');\n\ntype ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';\n\nexport interface IModifierKeyStatus {\n\taltKey: boolean;\n\tshiftKey: boolean;\n\tctrlKey: boolean;\n\tmetaKey: boolean;\n\tlastKeyPressed?: ModifierKey;\n\tlastKeyReleased?: ModifierKey;\n\tevent?: KeyboardEvent;\n}\n\nexport class ModifierKeyEmitter extends event.Emitter<IModifierKeyStatus> {\n\n\t// This emitter is a lazily created singleton (see `getInstance`) that is allowed\n\t// to outlive the test that happens to create it first. `Emitter` itself is not\n\t// tracked, so the store has to be marked to keep it out of leak detection.\n\tprivate readonly _subscriptions = markAsSingleton(new DisposableStore());\n\tprivate _keyStatus: IModifierKeyStatus;\n\tprivate static instance: ModifierKeyEmitter | undefined;\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\n\t\tthis._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n\t}\n\n\tprivate registerListeners(window: Window, disposables: DisposableStore): void {\n\t\tdisposables.add(addDisposableListener(window, 'keydown', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\t// If Alt-key keydown event is repeated, ignore it #112347\n\t\t\t// Only known to be necessary for Alt-Key at the moment #115810\n\t\t\tif (event.keyCode === KeyCode.Alt && e.repeat) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (e.altKey && !this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'alt';\n\t\t\t} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'ctrl';\n\t\t\t} else if (e.metaKey && !this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'meta';\n\t\t\t} else if (e.shiftKey && !this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'shift';\n\t\t\t} else if (event.keyCode !== KeyCode.Alt) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyPressed) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'keyup', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!e.altKey && this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'alt';\n\t\t\t} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'ctrl';\n\t\t\t} else if (!e.metaKey && this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'meta';\n\t\t\t} else if (!e.shiftKey && this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'shift';\n\t\t\t} else {\n\t\t\t\tthis._keyStatus.lastKeyReleased = undefined;\n\t\t\t}\n\n\t\t\tif (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n\t\t\tif (e.buttons) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'blur', () => {\n\t\t\tthis.resetKeyStatus();\n\t\t}));\n\t}\n\n\tget keyStatus(): IModifierKeyStatus {\n\t\treturn this._keyStatus;\n\t}\n\n\t/**\n\t * Allows to explicitly reset the key status based on more knowledge (#109062)\n\t */\n\tresetKeyStatus(): void {\n\t\tthis.doResetKeyStatus();\n\t\tthis.fire(this._keyStatus);\n\t}\n\n\tprivate doResetKeyStatus(): void {\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\t}\n\n\tstatic getInstance() {\n\t\tif (!ModifierKeyEmitter.instance) {\n\t\t\tModifierKeyEmitter.instance = new ModifierKeyEmitter();\n\t\t}\n\n\t\treturn ModifierKeyEmitter.instance;\n\t}\n\n\toverride dispose() {\n\t\tsuper.dispose();\n\t\tthis._subscriptions.dispose();\n\t}\n}\n\nexport interface IDragAndDropObserverCallbacks {\n\treadonly onDragEnter?: (e: DragEvent) => void;\n\treadonly onDragLeave?: (e: DragEvent) => void;\n\treadonly onDrop?: (e: DragEvent) => void;\n\treadonly onDragEnd?: (e: DragEvent) => void;\n\treadonly onDragStart?: (e: DragEvent) => void;\n\treadonly onDrag?: (e: DragEvent) => void;\n\treadonly onDragOver?: (e: DragEvent, dragDuration: number) => void;\n}\n\nexport class DragAndDropObserver extends Disposable {\n\n\t// A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n\t// calls see https://github.com/microsoft/vscode/issues/14470\n\t// when the element has child elements where the events are fired\n\t// repeadedly.\n\tprivate counter: number = 0;\n\n\t// Allows to measure the duration of the drag operation.\n\tprivate dragStartTime = 0;\n\n\tconstructor(private readonly element: HTMLElement, private readonly callbacks: IDragAndDropObserverCallbacks) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (this.callbacks.onDragStart) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_START, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDragStart?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tif (this.callbacks.onDrag) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDrag?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e: DragEvent) => {\n\t\t\tthis.counter++;\n\t\t\tthis.dragStartTime = e.timeStamp;\n\n\t\t\tthis.callbacks.onDragEnter?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => {\n\t\t\te.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n\n\t\t\tthis.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e: DragEvent) => {\n\t\t\tthis.counter--;\n\n\t\t\tif (this.counter === 0) {\n\t\t\t\tthis.dragStartTime = 0;\n\n\t\t\t\tthis.callbacks.onDragLeave?.(e);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_END, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDragEnd?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DROP, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDrop?.(e);\n\t\t}));\n\t}\n}\n\n/**\n * A wrapper around `ResizeObserver` that is disposable.\n *\n * Behavior is intentionally identical to using `new ResizeObserver(callback)`\n * directly: the user-supplied callback runs synchronously inside the\n * browser's resize-observation phase, with the entries the browser delivered.\n * The wrapper adds three things on top:\n *\n * 1. Lifetime management: `dispose()` disconnects the underlying observer.\n * 2. Auxiliary-window support: pass `targetWindow` so the observer is\n * constructed in the realm of the element being observed.\n * 3. Context for the\n * `ResizeObserver loop completed with undelivered notifications` warning:\n * each instance carries a stable `name`, and just before invoking the user\n * callback we add that name to a bounded, per-window set that is cleared\n * at the next animation frame. The warning is delivered as a stackless\n * `ErrorEvent` on `window` after callbacks run, so error telemetry can\n * include the wrapped observers that recently ran in that window (see\n * {@link getRecentDisposableResizeObserverContextForLoopError}). This is\n * delivery context, not causal attribution: the browser does not expose\n * which observer or skipped target caused the warning.\n *\n * @param name Stable identifier used in loop-warning context. Prefer one that\n * survives minification and refactors (e.g. the consumer class + purpose)\n * since callstacks change across releases.\n * @param callback Invoked synchronously when the browser delivers resize\n * notifications, with the same entries the native `ResizeObserver` would\n * have delivered.\n * @param targetWindow The window whose `ResizeObserver` constructor should\n * be used. Defaults to `mainWindow`. Pass the containing window when\n * creating an observer for elements that live in an auxiliary window.\n * @param options Optional configuration. `resizeObserverCtor` is a test\n * seam that defaults to `targetWindow.ResizeObserver`.\n */\nexport class DisposableResizeObserver extends Disposable {\n\n\tprivate readonly observer: ResizeObserver;\n\treadonly name: string;\n\n\tconstructor(\n\t\tname: string,\n\t\tcallback: ResizeObserverCallback,\n\t\ttargetWindow: CodeWindow = mainWindow,\n\t\toptions?: { resizeObserverCtor?: typeof ResizeObserver },\n\t) {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tconst ctor = options?.resizeObserverCtor ?? targetWindow.ResizeObserver;\n\t\tthis.observer = new ctor((entries: ResizeObserverEntry[], observer) => {\n\t\t\trecordDisposableResizeObserverInvocation(targetWindow, this.name);\n\t\t\ttry {\n\t\t\t\tcallback(entries, observer);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t}\n\t\t});\n\t\tthis._register(toDisposable(() => this.observer.disconnect()));\n\t}\n\n\tobserve(target: Element, options?: ResizeObserverOptions): IDisposable {\n\t\tthis.observer.observe(target, options);\n\t\treturn toDisposable(() => this.observer.unobserve(target));\n\t}\n}\n\n/**\n * Keep the context bounded so a large delivery phase cannot create an\n * unbounded telemetry value. Names are static component identifiers, and are\n * sorted when read so equivalent phases share a stable bucket.\n */\nconst maxRecentDisposableResizeObservers = 8;\n\n/**\n * Wrapped observers that ran recently in one window. This is deliberately\n * scoped by window because auxiliary windows have independent documents and\n * resize-observation delivery loops.\n */\ninterface IRecentDisposableResizeObserverContext {\n\treadonly names: Set<string>;\n\toverflow: boolean;\n}\n\nconst recentDisposableResizeObserverContexts = new WeakMap<CodeWindow, IRecentDisposableResizeObserverContext>();\n\nfunction recordDisposableResizeObserverInvocation(targetWindow: CodeWindow, name: string): void {\n\tlet context = recentDisposableResizeObserverContexts.get(targetWindow);\n\tif (!context) {\n\t\tcontext = { names: new Set(), overflow: false };\n\t\trecentDisposableResizeObserverContexts.set(targetWindow, context);\n\n\t\t// ResizeObserver callbacks and the synthetic loop error are delivered\n\t\t// after requestAnimationFrame callbacks in the rendering update. A\n\t\t// request made here therefore clears this context at the next frame,\n\t\t// after telemetry has observed any warning from the current update.\n\t\ttargetWindow.requestAnimationFrame(() => recentDisposableResizeObserverContexts.delete(targetWindow));\n\t}\n\n\tif (context.names.has(name)) {\n\t\treturn;\n\t}\n\tif (context.names.size < maxRecentDisposableResizeObservers) {\n\t\tcontext.names.add(name);\n\t} else {\n\t\tcontext.overflow = true;\n\t\tconst largestName = Array.from(context.names).sort().at(-1)!;\n\t\tif (name < largestName) {\n\t\t\tcontext.names.delete(largestName);\n\t\t\tcontext.names.add(name);\n\t\t}\n\t}\n}\n\ntype HTMLElementAttributeKeys<T> = Partial<{ [K in keyof T]: T[K] extends Function ? never : T[K] extends object ? HTMLElementAttributeKeys<T[K]> : T[K] }>;\ntype ElementAttributes<T> = HTMLElementAttributeKeys<T> & Record<string, any>;\ntype RemoveHTMLElement<T> = T extends HTMLElement ? never : T;\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\ntype ArrayToObj<T extends readonly any[]> = UnionToIntersection<RemoveHTMLElement<T[number]>>;\ntype HHTMLElementTagNameMap = HTMLElementTagNameMap & { '': HTMLDivElement };\n\ntype TagToElement<T> = T extends `${infer TStart}#${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends `${infer TStart}.${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends keyof HTMLElementTagNameMap\n\t? HTMLElementTagNameMap[T]\n\t: HTMLElement;\n\ntype TagToElementAndId<TTag> = TTag extends `${infer TTag}@${infer TId}`\n\t? { element: TagToElement<TTag>; id: TId }\n\t: { element: TagToElement<TTag>; id: 'root' };\n\ntype TagToRecord<TTag> = TagToElementAndId<TTag> extends { element: infer TElement; id: infer TId }\n\t? Record<(TId extends string ? TId : never) | 'root', TElement>\n\t: never;\n\ntype Child = HTMLElement | string | Record<string, HTMLElement>;\n\nconst H_REGEX = /(?<tag>[\\w\\-]+)?(?:#(?<id>[\\w\\-]+))?(?<class>(?:\\.(?:[\\w\\-]+))*)(?:@(?<name>(?:[\\w\\_])+))?/;\n\n/**\n * A helper function to create nested dom nodes.\n *\n *\n * ```ts\n * const elements = h('div.code-view', [\n * \th('div.title@title'),\n * \th('div.container', [\n * \t\th('div.gutter@gutterDiv'),\n * \t\th('div@editor'),\n * \t]),\n * ]);\n * const editor = createEditor(elements.editor);\n * ```\n*/\nexport function h<TTag extends string>\n\t(tag: TTag):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h(tag: string, ...args: [] | [attributes: { $: string } & Partial<ElementAttributes<HTMLElement>> | Record<string, any>, children?: any[]] | [children: any[]]): Record<string, HTMLElement> {\n\tlet attributes: { $?: string } & Partial<ElementAttributes<HTMLElement>>;\n\tlet children: (Record<string, HTMLElement> | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElement(tagName);\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record<string, HTMLElement> = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nfunction camelCaseToHyphenCase(str: string) {\n\treturn str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nexport function copyAttributes(from: Element, to: Element, filter?: string[]): void {\n\tfor (const { name, value } of from.attributes) {\n\t\tif (!filter || filter.includes(name)) {\n\t\t\tto.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nexport function isEditableElement(element: Element): boolean {\n\treturn element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea' || isHTMLElement(element) && !!element.editContext;\n}\n\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nexport class SafeTriangle {\n\t// 4 points (x, y), 8 length\n\tprivate points = new Int16Array(8);\n\n\tconstructor(\n\t\tprivate readonly originX: number,\n\t\tprivate readonly originY: number,\n\t\ttarget: HTMLElement\n\t) {\n\t\tconst { top, left, right, bottom } = target.getBoundingClientRect();\n\t\tconst t = this.points;\n\t\tlet i = 0;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\t}\n\n\tpublic contains(x: number, y: number) {\n\t\tconst { points, originX, originY } = this;\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tconst p1 = 2 * i;\n\t\t\tconst p2 = 2 * ((i + 1) % 4);\n\t\t\tif (isPointWithinTriangle(x, y, originX, originY, points[p1], points[p1 + 1], points[p2], points[p2 + 1])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\n\nexport namespace n {\n\tfunction nodeNs<TMap extends Record<string, any>>(elementNs: string | undefined = undefined): DomTagCreateFn<TMap> {\n\t\treturn (tag, attributes, children) => {\n\t\t\tconst className = attributes.class;\n\t\t\tdelete attributes.class;\n\t\t\tconst ref = attributes.ref;\n\t\t\tdelete attributes.ref;\n\t\t\tconst obsRef = attributes.obsRef;\n\t\t\tdelete attributes.obsRef;\n\n\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\treturn new ObserverNodeWithElement(tag as any, ref, obsRef, elementNs, className, attributes, children);\n\t\t};\n\t}\n\n\tfunction node<TMap extends Record<string, any>, TKey extends keyof TMap>(tag: TKey, elementNs: string | undefined = undefined): DomCreateFn<TMap[TKey], TMap[TKey]> {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst f = nodeNs(elementNs) as any;\n\t\treturn (attributes, children) => {\n\t\t\treturn f(tag, attributes, children);\n\t\t};\n\t}\n\n\texport const div: DomCreateFn<HTMLDivElement, HTMLDivElement> = node<HTMLElementTagNameMap, 'div'>('div');\n\n\texport const elem = nodeNs<HTMLElementTagNameMap>(undefined);\n\n\texport const svg: DomCreateFn<SVGElementTagNameMap2['svg'], SVGElement> = node<SVGElementTagNameMap2, 'svg'>('svg', 'http://www.w3.org/2000/svg');\n\n\texport const svgElem = nodeNs<SVGElementTagNameMap2>('http://www.w3.org/2000/svg');\n\n\texport function ref<T = HTMLOrSVGElement>(): IRefWithVal<T> {\n\t\tlet value: T | undefined = undefined;\n\t\tconst result: IRef<T> = function (val: T) {\n\t\t\tvalue = val;\n\t\t};\n\t\tObject.defineProperty(result, 'element', {\n\t\t\tget() {\n\t\t\t\tif (!value) {\n\t\t\t\t\tthrow new BugIndicatingError('Make sure the ref is set before accessing the element. Maybe wrong initialization order?');\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t});\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\treturn result as any;\n\t}\n}\ntype Value<T> = T | IObservable<T>;\ntype ValueOrList<T> = Value<T> | ValueOrList<T>[];\ntype ValueOrList2<T> = ValueOrList<T> | ValueOrList<ValueOrList<T>>;\ntype HTMLOrSVGElement = HTMLElement | SVGElement;\ntype SVGElementTagNameMap2 = {\n\tsvg: SVGElement & {\n\t\twidth: number;\n\t\theight: number;\n\t\ttransform: string;\n\t\tviewBox: string;\n\t\tfill: string;\n\t};\n\tpath: SVGElement & {\n\t\td: string;\n\t\tstroke: string;\n\t\tfill: string;\n\t};\n\tlinearGradient: SVGElement & {\n\t\tid: string;\n\t\tx1: string | number;\n\t\tx2: string | number;\n\t};\n\tstop: SVGElement & {\n\t\toffset: string;\n\t};\n\trect: SVGElement & {\n\t\tx: number;\n\t\ty: number;\n\t\twidth: number;\n\t\theight: number;\n\t\tfill: string;\n\t};\n\tdefs: SVGElement;\n};\ntype DomTagCreateFn<TMap extends Record<string, any>> = <TTag extends keyof TMap>(\n\ttag: TTag,\n\tattributes: ElementAttributeKeys<TMap[TTag]> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TMap[TTag]>; obsRef?: IRef<ObserverNodeWithElement<TMap[TTag]> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TMap[TTag]>;\ntype DomCreateFn<TAttributes, TResult extends HTMLOrSVGElement> = (\n\tattributes: ElementAttributeKeys<TAttributes> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TResult>; obsRef?: IRef<ObserverNodeWithElement<TResult> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TResult>;\n\nexport type ChildNode = ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>;\n\nexport type IRef<T> = (value: T) => void;\n\nexport interface IRefWithVal<T> extends IRef<T> {\n\treadonly element: T;\n}\n\nexport abstract class ObserverNode<T extends HTMLOrSVGElement = HTMLOrSVGElement> {\n\tprivate readonly _deriveds: (IObservable<any>)[] = [];\n\n\tprotected readonly _element: T;\n\n\tconstructor(\n\t\ttag: string,\n\t\tref: IRef<T> | undefined,\n\t\tobsRef: IRef<ObserverNodeWithElement<T> | null> | undefined,\n\t\tns: string | undefined,\n\t\tclassName: ValueOrList<string | undefined | false> | undefined,\n\t\tattributes: ElementAttributeKeys<T>,\n\t\tchildren: ChildNode\n\t) {\n\t\tthis._element = (ns ? document.createElementNS(ns, tag) : document.createElement(tag)) as unknown as T;\n\t\tif (ref) {\n\t\t\tref(this._element);\n\t\t}\n\t\tif (obsRef) {\n\t\t\tthis._deriveds.push(derived((_reader) => {\n\t\t\t\tobsRef(this as unknown as ObserverNodeWithElement<T>);\n\t\t\t\t_reader.store.add({\n\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\tobsRef(null);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}));\n\t\t}\n\n\t\tif (className) {\n\t\t\tif (hasObservable(className)) {\n\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t/** @description set.class */\n\t\t\t\t\tsetClassName(this._element, getClassName(className, reader));\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\tsetClassName(this._element, getClassName(className, undefined));\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(attributes)) {\n\t\t\tif (key === 'style') {\n\t\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\t\tconst key = camelCaseToHyphenCase(cssKey);\n\t\t\t\t\tif (isObservable(cssValue)) {\n\t\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.style.${key}` }, reader => {\n\t\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue.read(reader)));\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (key === 'tabIndex') {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t\t/** @description set.tabIndex */\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\tthis._element.tabIndex = value.read(reader) as any;\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tthis._element.tabIndex = value;\n\t\t\t\t}\n\t\t\t} else if (key.startsWith('on')) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(this._element as any)[key] = value;\n\t\t\t} else {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.${key}` }, reader => {\n\t\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value.read(reader));\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (children) {\n\t\t\tfunction getChildren(reader: IReader | undefined, children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): (HTMLOrSVGElement | string)[] {\n\t\t\t\tif (isObservable(children)) {\n\t\t\t\t\treturn getChildren(reader, children.read(reader));\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(children)) {\n\t\t\t\t\treturn children.flatMap(c => getChildren(reader, c));\n\t\t\t\t}\n\t\t\t\tif (children instanceof ObserverNode) {\n\t\t\t\t\tif (reader) {\n\t\t\t\t\t\tchildren.readEffect(reader);\n\t\t\t\t\t}\n\t\t\t\t\treturn [children._element];\n\t\t\t\t}\n\t\t\t\tif (children) {\n\t\t\t\t\treturn [children];\n\t\t\t\t}\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst d = derived(this, reader => {\n\t\t\t\t/** @description set.children */\n\t\t\t\tthis._element.replaceChildren(...getChildren(reader, children));\n\t\t\t});\n\t\t\tthis._deriveds.push(d);\n\t\t\tif (!childrenIsObservable(children)) {\n\t\t\t\td.get();\n\t\t\t}\n\t\t}\n\t}\n\n\treadEffect(reader: IReader | undefined): void {\n\t\tfor (const d of this._deriveds) {\n\t\t\td.read(reader);\n\t\t}\n\t}\n\n\tkeepUpdated(store: DisposableStore): ObserverNodeWithElement<T> {\n\t\tderived(reader => {\n\t\t\t/** update */\n\t\t\tthis.readEffect(reader);\n\t\t}).recomputeInitiallyAndOnChange(store);\n\t\treturn this as unknown as ObserverNodeWithElement<T>;\n\t}\n\n\t/**\n\t * Creates a live element that will keep the element updated as long as the returned object is not disposed.\n\t*/\n\ttoDisposableLiveElement() {\n\t\tconst store = new DisposableStore();\n\t\tthis.keepUpdated(store);\n\t\treturn new LiveElement(this._element, store);\n\t}\n\n\tprivate _isHovered: IObservable<boolean> | undefined = undefined;\n\n\tget isHovered(): IObservable<boolean> {\n\t\tif (!this._isHovered) {\n\t\t\tconst hovered = observableValue<boolean>('hovered', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => hovered.set(true, undefined));\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => hovered.set(false, undefined));\n\t\t\tthis._isHovered = hovered;\n\t\t}\n\t\treturn this._isHovered;\n\t}\n\n\tprivate _didMouseMoveDuringHover: IObservable<boolean> | undefined = undefined;\n\n\tget didMouseMoveDuringHover(): IObservable<boolean> {\n\t\tif (!this._didMouseMoveDuringHover) {\n\t\t\tlet _hovering = false;\n\t\t\tconst hovered = observableValue<boolean>('didMouseMoveDuringHover', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => {\n\t\t\t\t_hovering = true;\n\t\t\t});\n\t\t\tthis._element.addEventListener('mousemove', (_e) => {\n\t\t\t\tif (_hovering) {\n\t\t\t\t\thovered.set(true, undefined);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => {\n\t\t\t\t_hovering = false;\n\t\t\t\thovered.set(false, undefined);\n\t\t\t});\n\t\t\tthis._didMouseMoveDuringHover = hovered;\n\t\t}\n\t\treturn this._didMouseMoveDuringHover;\n\t}\n}\n\nfunction setClassName(domNode: HTMLOrSVGElement, className: string) {\n\tif (isSVGElement(domNode)) {\n\t\tdomNode.setAttribute('class', className);\n\t} else {\n\t\tdomNode.className = className;\n\t}\n}\n\nfunction resolve<T>(value: ValueOrList<T>, reader: IReader | undefined, cb: (val: T) => void): void {\n\tif (isObservable(value)) {\n\t\tcb(value.read(reader));\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const v of value) {\n\t\t\tresolve(v, reader, cb);\n\t\t}\n\t\treturn;\n\t}\n\t// eslint-disable-next-line local/code-no-any-casts\n\tcb(value as any);\n}\nfunction getClassName(className: ValueOrList<string | undefined | false> | undefined, reader: IReader | undefined): string {\n\tlet result = '';\n\tresolve(className, reader, val => {\n\t\tif (val) {\n\t\t\tif (result.length === 0) {\n\t\t\t\tresult = val;\n\t\t\t} else {\n\t\t\t\tresult += ' ' + val;\n\t\t\t}\n\t\t}\n\t});\n\treturn result;\n}\nfunction hasObservable(value: ValueOrList<unknown>): boolean {\n\tif (isObservable(value)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.some(v => hasObservable(v));\n\t}\n\treturn false;\n}\nfunction convertCssValue(value: any): string {\n\tif (typeof value === 'number') {\n\t\treturn value + 'px';\n\t}\n\treturn value;\n}\nfunction childrenIsObservable(children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): boolean {\n\tif (isObservable(children)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(children)) {\n\t\treturn children.some(c => childrenIsObservable(c));\n\t}\n\treturn false;\n}\n\nexport class LiveElement<T extends HTMLOrSVGElement = HTMLElement> {\n\tconstructor(\n\t\tpublic readonly element: T,\n\t\tprivate readonly _disposable: IDisposable\n\t) { }\n\n\tdispose() {\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class ObserverNodeWithElement<T extends HTMLOrSVGElement = HTMLOrSVGElement> extends ObserverNode<T> {\n\tpublic get element() {\n\t\treturn this._element;\n\t}\n}\nfunction setOrRemoveAttribute(element: HTMLOrSVGElement, key: string, value: unknown) {\n\tif (value === null || value === undefined) {\n\t\telement.removeAttribute(camelCaseToHyphenCase(key));\n\t} else {\n\t\telement.setAttribute(camelCaseToHyphenCase(key), String(value));\n\t}\n}\n\ntype ElementAttributeKeys<T> = Partial<{\n\t[K in keyof T]: T[K] extends Function ? never : T[K] extends object ? ElementAttributeKeys<T[K]> : Value<number | T[K] | undefined | null>;\n}>;\n\n/**\n * A custom element that fires callbacks when connected to or disconnected from the DOM.\n * Useful for tracking whether a template or component is currently mounted, especially\n * with iframes/webviews that are sensitive to movement.\n *\n * @example\n * ```ts\n * const observer = document.createElement('connection-observer') as ConnectionObserverElement;\n * observer.onDidConnect = () => console.log('mounted');\n * observer.onDidDisconnect = () => console.log('unmounted');\n * container.appendChild(observer);\n * ```\n */\nexport class ConnectionObserverElement extends HTMLElement {\n\tpublic onDidConnect?: () => void;\n\tpublic onDidDisconnect?: () => void;\n\n\tdisconnectedCallback() {\n\t\tthis.onDidDisconnect?.();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.onDidConnect?.();\n\t}\n}\n\nif (!customElements.get('connection-observer')) {\n\tcustomElements.define('connection-observer', ConnectionObserverElement);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from './browser.js';\nimport { BrowserFeatures } from './canIUse.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from './keyboardEvent.js';\nimport { IMouseEvent, StandardMouseEvent } from './mouseEvent.js';\nimport { AbstractIdleValue, IntervalTimer, _runWhenIdle, IdleDeadline } from '../common/async.js';\nimport { BugIndicatingError, onUnexpectedError } from '../common/errors.js';\nimport * as event from '../common/event.js';\nimport { KeyCode } from '../common/keyCodes.js';\nimport { Disposable, DisposableStore, IDisposable, markAsSingleton, toDisposable } from '../common/lifecycle.js';\nimport { RemoteAuthorities } from '../common/network.js';\nimport * as platform from '../common/platform.js';\nimport { hash } from '../common/hash.js';\nimport { CodeWindow, ensureCodeWindow, mainWindow } from './window.js';\nimport { isPointWithinTriangle } from '../common/numbers.js';\nimport { IObservable, derived, derivedOpts, IReader, observableValue, isObservable } from '../common/observable.js';\n\nexport interface IRegisteredCodeWindow {\n\treadonly window: CodeWindow;\n\treadonly disposables: DisposableStore;\n}\n\n//# region Multi-Window Support Utilities\n\nexport const {\n\tregisterWindow,\n\tgetWindow,\n\tgetDocument,\n\tgetWindows,\n\tgetWindowsCount,\n\tgetWindowId,\n\tgetWindowById,\n\thasWindow,\n\tonDidRegisterWindow,\n\tonWillUnregisterWindow,\n\tonDidUnregisterWindow\n} = (function () {\n\tconst windows = new Map<number, IRegisteredCodeWindow>();\n\n\tensureCodeWindow(mainWindow, 1);\n\tconst mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n\twindows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n\n\tconst onDidRegisterWindow = new event.Emitter<IRegisteredCodeWindow>();\n\tconst onDidUnregisterWindow = new event.Emitter<CodeWindow>();\n\tconst onWillUnregisterWindow = new event.Emitter<CodeWindow>();\n\n\tfunction getWindowById(windowId: number): IRegisteredCodeWindow | undefined;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain: true): IRegisteredCodeWindow;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain?: boolean): IRegisteredCodeWindow | undefined {\n\t\tconst window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n\n\t\treturn window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n\t}\n\n\treturn {\n\t\tonDidRegisterWindow: onDidRegisterWindow.event,\n\t\tonWillUnregisterWindow: onWillUnregisterWindow.event,\n\t\tonDidUnregisterWindow: onDidUnregisterWindow.event,\n\t\tregisterWindow(window: CodeWindow): IDisposable {\n\t\t\tif (windows.has(window.vscodeWindowId)) {\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tconst disposables = new DisposableStore();\n\n\t\t\tconst registeredWindow = {\n\t\t\t\twindow,\n\t\t\t\tdisposables: disposables.add(new DisposableStore())\n\t\t\t};\n\t\t\twindows.set(window.vscodeWindowId, registeredWindow);\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\twindows.delete(window.vscodeWindowId);\n\t\t\t\tonDidUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tdisposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n\t\t\t\tonWillUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tonDidRegisterWindow.fire(registeredWindow);\n\n\t\t\treturn disposables;\n\t\t},\n\t\tgetWindows(): Iterable<IRegisteredCodeWindow> {\n\t\t\treturn windows.values();\n\t\t},\n\t\tgetWindowsCount(): number {\n\t\t\treturn windows.size;\n\t\t},\n\t\tgetWindowId(targetWindow: Window): number {\n\t\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t\t},\n\t\thasWindow(windowId: number): boolean {\n\t\t\treturn windows.has(windowId);\n\t\t},\n\t\tgetWindowById,\n\t\tgetWindow(e: Node | UIEvent | undefined | null): CodeWindow {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\tif (candidateNode?.ownerDocument?.defaultView) {\n\t\t\t\treturn candidateNode.ownerDocument.defaultView.window as CodeWindow;\n\t\t\t}\n\n\t\t\tconst candidateEvent = e as UIEvent | undefined | null;\n\t\t\tif (candidateEvent?.view) {\n\t\t\t\treturn candidateEvent.view.window as CodeWindow;\n\t\t\t}\n\n\t\t\treturn mainWindow;\n\t\t},\n\t\tgetDocument(e: Node | UIEvent | undefined | null): Document {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\treturn getWindow(candidateNode).document;\n\t\t}\n\t};\n})();\n\n//#endregion\n\n//#region External Focus Tracking\n\n/**\n * Information about external focus state, including the associated window.\n */\nexport interface IExternalFocusInfo {\n\treadonly hasFocus: boolean;\n\treadonly window?: CodeWindow;\n}\n\n/**\n * A function that checks if a component outside the normal DOM tree has focus.\n * Returns focus info including which window the component is associated with.\n */\nexport type ExternalFocusChecker = () => IExternalFocusInfo;\n\n/**\n * A registry for functions that check if a component outside the normal DOM tree has focus.\n * This is used to extend the concept of \"window has focus\" to include things like\n * Electron WebContentsViews (browser views) that exist outside the workbench DOM.\n */\nconst externalFocusCheckers = new Set<ExternalFocusChecker>();\n\n/**\n * Get the window associated with a focused external component.\n * This is used to determine which window should receive UI like dialogs\n * when an external component (like a browser view) has focus.\n *\n * @returns The window of the focused external component, or undefined if none\n */\nexport function getExternalFocusWindow(): CodeWindow | undefined {\n\tfor (const checker of externalFocusCheckers) {\n\t\tconst info = checker();\n\t\tif (info.hasFocus && info.window) {\n\t\t\treturn info.window;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n//#endregion\n\nexport function clearNode(node: HTMLElement): void {\n\twhile (node.firstChild) {\n\t\tnode.firstChild.remove();\n\t}\n}\n\nclass DomListener implements IDisposable {\n\n\tprivate _handler: (e: any) => void;\n\tprivate _node: EventTarget;\n\tprivate readonly _type: string;\n\tprivate readonly _options: boolean | AddEventListenerOptions;\n\n\tconstructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {\n\t\tthis._node = node;\n\t\tthis._type = type;\n\t\tthis._handler = handler;\n\t\tthis._options = (options || false);\n\t\tthis._node.addEventListener(this._type, this._handler, this._options);\n\t}\n\n\tdispose(): void {\n\t\tif (!this._handler) {\n\t\t\t// Already disposed\n\t\t\treturn;\n\t\t}\n\n\t\tthis._node.removeEventListener(this._type, this._handler, this._options);\n\n\t\t// Prevent leakers from holding on to the dom or handler func\n\t\tthis._node = null!;\n\t\tthis._handler = null!;\n\t}\n}\n\nexport function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable {\n\treturn new DomListener(node, type, handler, useCaptureOrOptions);\n}\n\nexport interface IAddStandardDisposableListenerSignature {\n\t(node: HTMLElement | Element | Document, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerdown', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointermove', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerup', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\n}\nfunction _wrapAsStandardMouseEvent(targetWindow: Window, handler: (e: IMouseEvent) => void): (e: MouseEvent) => void {\n\treturn function (e: MouseEvent) {\n\t\treturn handler(new StandardMouseEvent(targetWindow, e));\n\t};\n}\nfunction _wrapAsStandardKeyboardEvent(handler: (e: IKeyboardEvent) => void): (e: KeyboardEvent) => void {\n\treturn function (e: KeyboardEvent) {\n\t\treturn handler(new StandardKeyboardEvent(e));\n\t};\n}\nexport const addStandardDisposableListener: IAddStandardDisposableListenerSignature = function addStandardDisposableListener(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tlet wrapHandler = handler;\n\n\tif (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n\t\twrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\t} else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n\t\twrapHandler = _wrapAsStandardKeyboardEvent(handler);\n\t}\n\n\treturn addDisposableListener(node, type, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseMoveListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseUpListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\n}\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nexport function runWhenWindowIdle(targetWindow: Window | typeof globalThis, callback: (idle: IdleDeadline) => void, timeout?: number): IDisposable {\n\treturn _runWhenIdle(targetWindow, callback, timeout);\n}\n\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue<T> extends AbstractIdleValue<T> {\n\tconstructor(targetWindow: Window | typeof globalThis, executor: () => T) {\n\t\tsuper(targetWindow, executor);\n\t}\n}\n\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n\nexport class WindowIntervalTimer extends IntervalTimer {\n\n\tprivate readonly defaultTarget?: Window & typeof globalThis;\n\n\t/**\n\t *\n\t * @param node The optional node from which the target window is determined\n\t */\n\tconstructor(node?: Node) {\n\t\tsuper();\n\t\tthis.defaultTarget = node && getWindow(node);\n\t}\n\n\toverride cancelAndSet(runner: () => void, interval: number, targetWindow?: Window & typeof globalThis): void {\n\t\treturn super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n\t}\n}\n\nclass AnimationFrameQueueItem implements IDisposable {\n\n\tprivate _runner: () => void;\n\tpublic priority: number;\n\tprivate _canceled: boolean;\n\n\tconstructor(runner: () => void, priority: number = 0) {\n\t\tthis._runner = runner;\n\t\tthis.priority = priority;\n\t\tthis._canceled = false;\n\t}\n\n\tdispose(): void {\n\t\tthis._canceled = true;\n\t}\n\n\texecute(): void {\n\t\tif (this._canceled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis._runner();\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t}\n\n\t// Sort by priority (largest to lowest)\n\tstatic sort(a: AnimationFrameQueueItem, b: AnimationFrameQueueItem): number {\n\t\treturn b.priority - a.priority;\n\t}\n}\n\n(function () {\n\t/**\n\t * The runners scheduled at the next animation frame\n\t */\n\tconst NEXT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * The runners scheduled at the current animation frame\n\t */\n\tconst CURRENT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * A flag to keep track if the native requestAnimationFrame was already called\n\t */\n\tconst animFrameRequested = new Map<number /* window ID */, boolean>();\n\t/**\n\t * A flag to indicate if currently handling a native requestAnimationFrame callback\n\t */\n\tconst inAnimationFrameRunner = new Map<number /* window ID */, boolean>();\n\n\tconst animationFrameRunner = (targetWindowId: number) => {\n\t\tanimFrameRequested.set(targetWindowId, false);\n\n\t\tconst currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\tNEXT_QUEUE.set(targetWindowId, []);\n\n\t\tinAnimationFrameRunner.set(targetWindowId, true);\n\t\twhile (currentQueue.length > 0) {\n\t\t\tcurrentQueue.sort(AnimationFrameQueueItem.sort);\n\t\t\tconst top = currentQueue.shift()!;\n\t\t\ttop.execute();\n\t\t}\n\t\tinAnimationFrameRunner.set(targetWindowId, false);\n\t};\n\n\tscheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority: number = 0) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\n\t\tlet nextQueue = NEXT_QUEUE.get(targetWindowId);\n\t\tif (!nextQueue) {\n\t\t\tnextQueue = [];\n\t\t\tNEXT_QUEUE.set(targetWindowId, nextQueue);\n\t\t}\n\t\tnextQueue.push(item);\n\n\t\tif (!animFrameRequested.get(targetWindowId)) {\n\t\t\tanimFrameRequested.set(targetWindowId, true);\n\t\t\ttargetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n\t\t}\n\n\t\treturn item;\n\t};\n\n\trunAtThisOrScheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority?: number) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tif (inAnimationFrameRunner.get(targetWindowId)) {\n\t\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\t\t\tlet currentQueue = CURRENT_QUEUE.get(targetWindowId);\n\t\t\tif (!currentQueue) {\n\t\t\t\tcurrentQueue = [];\n\t\t\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\t\t}\n\t\t\tcurrentQueue.push(item);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n\t\t}\n\t};\n})();\n\nexport function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {\n\treturn getWindow(el).getComputedStyle(el, null);\n}\n\nexport function getClientArea(element: HTMLElement, defaultValue?: Dimension, fallbackElement?: HTMLElement): Dimension {\n\tconst elWindow = getWindow(element);\n\tconst elDocument = elWindow.document;\n\n\t// Try with DOM clientWidth / clientHeight\n\tif (element !== elDocument.body) {\n\t\treturn new Dimension(element.clientWidth, element.clientHeight);\n\t}\n\n\t// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n\tif (platform.isIOS && elWindow?.visualViewport) {\n\t\treturn new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n\t}\n\n\t// Try innerWidth / innerHeight\n\tif (elWindow?.innerWidth && elWindow.innerHeight) {\n\t\treturn new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n\t}\n\n\t// Try with document.body.clientWidth / document.body.clientHeight\n\tif (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n\t\treturn new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n\t}\n\n\t// Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n\tif (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n\t\treturn new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n\t}\n\n\tif (fallbackElement) {\n\t\treturn getClientArea(fallbackElement, defaultValue);\n\t}\n\n\tif (defaultValue) {\n\t\treturn defaultValue;\n\t}\n\n\tthrow new Error('Unable to figure out browser width and height');\n}\n\nclass SizeUtils {\n\t// Adapted from WinJS\n\t// Converts a CSS positioning string for the specified element to pixels.\n\tprivate static convertToPixels(element: HTMLElement, value: string): number {\n\t\treturn parseFloat(value) || 0;\n\t}\n\n\tprivate static getDimension(element: HTMLElement, cssPropertyName: string): number {\n\t\tconst computedStyle = getComputedStyle(element);\n\t\tconst value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n\t\treturn SizeUtils.convertToPixels(element, value);\n\t}\n\n\tstatic getBorderLeftWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-left-width');\n\t}\n\tstatic getBorderRightWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-right-width');\n\t}\n\tstatic getBorderTopWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-top-width');\n\t}\n\tstatic getBorderBottomWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-bottom-width');\n\t}\n\n\tstatic getPaddingLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-left');\n\t}\n\tstatic getPaddingRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-right');\n\t}\n\tstatic getPaddingTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-top');\n\t}\n\tstatic getPaddingBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-bottom');\n\t}\n\n\tstatic getMarginLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-left');\n\t}\n\tstatic getMarginTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-top');\n\t}\n\tstatic getMarginRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-right');\n\t}\n\tstatic getMarginBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-bottom');\n\t}\n}\n\n// ----------------------------------------------------------------------------------------\n// Position & Dimension\n\nexport interface IDimension {\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport class Dimension implements IDimension {\n\n\tstatic readonly None = new Dimension(0, 0);\n\n\tconstructor(\n\t\treadonly width: number,\n\t\treadonly height: number,\n\t) { }\n\n\twith(width: number = this.width, height: number = this.height): Dimension {\n\t\tif (width !== this.width || height !== this.height) {\n\t\t\treturn new Dimension(width, height);\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tstatic is(obj: unknown): obj is IDimension {\n\t\treturn typeof obj === 'object' && typeof (<IDimension>obj).height === 'number' && typeof (<IDimension>obj).width === 'number';\n\t}\n\n\tstatic lift(obj: IDimension): Dimension {\n\t\tif (obj instanceof Dimension) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\treturn new Dimension(obj.width, obj.height);\n\t\t}\n\t}\n\n\tstatic equals(a: Dimension | undefined, b: Dimension | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.width === b.width && a.height === b.height;\n\t}\n}\n\nexport interface IDomPosition {\n\treadonly left: number;\n\treadonly top: number;\n}\n\nexport function getTopLeftOffset(element: HTMLElement): IDomPosition {\n\t// Adapted from WinJS.Utilities.getPosition\n\t// and added borders to the mix\n\n\tlet offsetParent = element.offsetParent;\n\tlet top = element.offsetTop;\n\tlet left = element.offsetLeft;\n\n\twhile (\n\t\t(element = <HTMLElement>element.parentNode) !== null\n\t\t&& element !== element.ownerDocument.body\n\t\t&& element !== element.ownerDocument.documentElement\n\t) {\n\t\ttop -= element.scrollTop;\n\t\tconst c = isShadowRoot(element) ? null : getComputedStyle(element);\n\t\tif (c) {\n\t\t\tleft -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n\t\t}\n\n\t\tif (element === offsetParent) {\n\t\t\tleft += SizeUtils.getBorderLeftWidth(element);\n\t\t\ttop += SizeUtils.getBorderTopWidth(element);\n\t\t\ttop += element.offsetTop;\n\t\t\tleft += element.offsetLeft;\n\t\t\toffsetParent = element.offsetParent;\n\t\t}\n\t}\n\n\treturn {\n\t\tleft: left,\n\t\ttop: top\n\t};\n}\n\nexport interface IDomNodePagePosition {\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n}\n\nexport function size(element: HTMLElement, width: number | null, height: number | null): void {\n\tif (typeof width === 'number') {\n\t\telement.style.width = `${width}px`;\n\t}\n\n\tif (typeof height === 'number') {\n\t\telement.style.height = `${height}px`;\n\t}\n}\n\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition {\n\tconst bb = domNode.getBoundingClientRect();\n\tconst window = getWindow(domNode);\n\treturn {\n\t\tleft: bb.left + window.scrollX,\n\t\ttop: bb.top + window.scrollY,\n\t\twidth: bb.width,\n\t\theight: bb.height\n\t};\n}\n\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode: HTMLElement): number {\n\tlet testElement: HTMLElement | null = domNode;\n\tlet zoom = 1.0;\n\tdo {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst elementZoomLevel = (getComputedStyle(testElement) as any).zoom;\n\t\tif (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n\t\t\tzoom *= elementZoomLevel;\n\t\t}\n\n\t\ttestElement = testElement.parentElement;\n\t} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n\n\treturn zoom;\n}\n\n\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.offsetWidth + margin;\n}\n\nexport function getContentWidth(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n\tconst padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n\treturn element.offsetWidth - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n\tconst padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n\treturn element.offsetHeight - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n\treturn element.offsetHeight + margin;\n}\n\n// ----------------------------------------------------------------------------------------\n\nexport function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean {\n\treturn Boolean(testAncestor?.contains(testChild));\n}\n\nexport function findParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (typeof clazz === 'string' ? node.classList.contains(clazz) : clazz.every(candidate => node.classList.contains(candidate))) {\n\t\t\treturn node;\n\t\t}\n\n\t\tif (stopAtClazzOrNode) {\n\t\t\tif (typeof stopAtClazzOrNode === 'string') {\n\t\t\t\tif (node.classList.contains(stopAtClazzOrNode)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (node === stopAtClazzOrNode) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnode = <HTMLElement>node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function hasParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): boolean {\n\treturn !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\n\nexport function isShadowRoot(node: Node): node is ShadowRoot {\n\treturn (\n\t\tnode && !!(<ShadowRoot>node).host && !!(<ShadowRoot>node).mode\n\t);\n}\n\nexport function isInShadowDOM(domNode: Node): boolean {\n\treturn !!getShadowRoot(domNode);\n}\n\nexport function getShadowRoot(domNode: Node): ShadowRoot | null {\n\twhile (domNode.parentNode) {\n\t\tif (domNode === domNode.ownerDocument?.body) {\n\t\t\t// reached the body\n\t\t\treturn null;\n\t\t}\n\t\tdomNode = domNode.parentNode;\n\t}\n\treturn isShadowRoot(domNode) ? domNode : null;\n}\n\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement(): Element | null {\n\tlet result = getActiveDocument().activeElement;\n\n\twhile (result?.shadowRoot) {\n\t\tresult = result.shadowRoot.activeElement;\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element: Element): boolean {\n\treturn getActiveElement() === element;\n}\n\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor: Element): boolean {\n\treturn isAncestor(getActiveElement(), ancestor);\n}\n\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus (including external components like browser views),\n * otherwise falls back to the main windows document.\n */\nexport function getActiveDocument(): Document {\n\tif (getWindowsCount() <= 1) {\n\t\treturn mainWindow.document;\n\t}\n\n\tconst documents = Array.from(getWindows()).map(({ window }) => window.document);\n\tconst focusedDoc = documents.find(doc => doc.hasFocus());\n\tif (focusedDoc) {\n\t\treturn focusedDoc;\n\t}\n\n\t// Check if an external component (like browser view) has focus\n\tconst externalWindow = getExternalFocusWindow();\n\tif (externalWindow) {\n\t\treturn externalWindow.document;\n\t}\n\n\treturn mainWindow.document;\n}\n\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow(): CodeWindow {\n\tconst document = getActiveDocument();\n\treturn (document.defaultView?.window ?? mainWindow) as CodeWindow;\n}\n\ninterface IMutationObserver {\n\tusers: number;\n\treadonly observer: MutationObserver;\n\treadonly onDidMutate: event.Event<MutationRecord[]>;\n}\n\nexport const sharedMutationObserver = new class {\n\n\treadonly mutationObservers = new Map<Node, Map<number, IMutationObserver>>();\n\n\tobserve(target: Node, disposables: DisposableStore, options?: MutationObserverInit): event.Event<MutationRecord[]> {\n\t\tlet mutationObserversPerTarget = this.mutationObservers.get(target);\n\t\tif (!mutationObserversPerTarget) {\n\t\t\tmutationObserversPerTarget = new Map<number, IMutationObserver>();\n\t\t\tthis.mutationObservers.set(target, mutationObserversPerTarget);\n\t\t}\n\n\t\tconst optionsHash = hash(options);\n\t\tlet mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n\t\tif (!mutationObserverPerOptions) {\n\t\t\tconst onDidMutate = new event.Emitter<MutationRecord[]>();\n\t\t\tconst observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n\t\t\tobserver.observe(target, options);\n\n\t\t\tconst resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n\t\t\t\tusers: 1,\n\t\t\t\tobserver,\n\t\t\t\tonDidMutate: onDidMutate.event\n\t\t\t};\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tresolvedMutationObserverPerOptions.users -= 1;\n\n\t\t\t\tif (resolvedMutationObserverPerOptions.users === 0) {\n\t\t\t\t\tonDidMutate.dispose();\n\t\t\t\t\tobserver.disconnect();\n\n\t\t\t\t\tmutationObserversPerTarget?.delete(optionsHash);\n\t\t\t\t\tif (mutationObserversPerTarget?.size === 0) {\n\t\t\t\t\t\tthis.mutationObservers.delete(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tmutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n\t\t} else {\n\t\t\tmutationObserverPerOptions.users += 1;\n\t\t}\n\n\t\treturn mutationObserverPerOptions.onDidMutate;\n\t}\n};\n\nexport function isHTMLElement(e: unknown): e is HTMLElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;\n}\n\nexport function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLAnchorElement || e instanceof getWindow(e as Node).HTMLAnchorElement;\n}\n\nexport function isSVGElement(e: unknown): e is SVGElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof SVGElement || e instanceof getWindow(e as Node).SVGElement;\n}\n\nexport function isMouseEvent(e: unknown): e is MouseEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;\n}\n\nexport function isKeyboardEvent(e: unknown): e is KeyboardEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof KeyboardEvent || e instanceof getWindow(e as UIEvent).KeyboardEvent;\n}\n\nexport const EventType = {\n\t// Mouse\n\tCLICK: 'click',\n\tAUXCLICK: 'auxclick',\n\tDBLCLICK: 'dblclick',\n\tMOUSE_UP: 'mouseup',\n\tMOUSE_DOWN: 'mousedown',\n\tMOUSE_OVER: 'mouseover',\n\tMOUSE_MOVE: 'mousemove',\n\tMOUSE_OUT: 'mouseout',\n\tMOUSE_ENTER: 'mouseenter',\n\tMOUSE_LEAVE: 'mouseleave',\n\tMOUSE_WHEEL: 'wheel',\n\tPOINTER_UP: 'pointerup',\n\tPOINTER_DOWN: 'pointerdown',\n\tPOINTER_MOVE: 'pointermove',\n\tPOINTER_LEAVE: 'pointerleave',\n\tCONTEXT_MENU: 'contextmenu',\n\tWHEEL: 'wheel',\n\t// Keyboard\n\tKEY_DOWN: 'keydown',\n\tKEY_PRESS: 'keypress',\n\tKEY_UP: 'keyup',\n\t// HTML Document\n\tLOAD: 'load',\n\tBEFORE_UNLOAD: 'beforeunload',\n\tUNLOAD: 'unload',\n\tPAGE_SHOW: 'pageshow',\n\tPAGE_HIDE: 'pagehide',\n\tPASTE: 'paste',\n\tABORT: 'abort',\n\tERROR: 'error',\n\tRESIZE: 'resize',\n\tSCROLL: 'scroll',\n\tFULLSCREEN_CHANGE: 'fullscreenchange',\n\tWK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n\t// Form\n\tSELECT: 'select',\n\tCHANGE: 'change',\n\tSUBMIT: 'submit',\n\tRESET: 'reset',\n\tFOCUS: 'focus',\n\tFOCUS_IN: 'focusin',\n\tFOCUS_OUT: 'focusout',\n\tBLUR: 'blur',\n\tINPUT: 'input',\n\t// Local Storage\n\tSTORAGE: 'storage',\n\t// Drag\n\tDRAG_START: 'dragstart',\n\tDRAG: 'drag',\n\tDRAG_ENTER: 'dragenter',\n\tDRAG_LEAVE: 'dragleave',\n\tDRAG_OVER: 'dragover',\n\tDROP: 'drop',\n\tDRAG_END: 'dragend',\n\t// Animation\n\tANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n\tANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n\tANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n} as const;\n\nexport interface EventLike {\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport function isEventLike(obj: unknown): obj is EventLike {\n\tconst candidate = obj as EventLike | undefined;\n\n\treturn !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\n\nexport const EventHelper = {\n\tstop: <T extends EventLike>(e: T, cancelBubble?: boolean): T => {\n\t\te.preventDefault();\n\t\tif (cancelBubble) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\treturn e;\n\t}\n};\n\nexport interface IFocusTracker extends Disposable {\n\treadonly onDidFocus: event.Event<void>;\n\treadonly onDidBlur: event.Event<void>;\n}\n\nexport function saveParentsScrollTop(node: Element): number[] {\n\tconst r: number[] = [];\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tr[i] = node.scrollTop;\n\t\tnode = <Element>node.parentNode;\n\t}\n\treturn r;\n}\n\nexport function restoreParentsScrollTop(node: Element, state: number[]): void {\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tif (node.scrollTop !== state[i]) {\n\t\t\tnode.scrollTop = state[i];\n\t\t}\n\t\tnode = <Element>node.parentNode;\n\t}\n}\n\nclass FocusTracker extends Disposable implements IFocusTracker {\n\n\tprivate readonly _onDidFocus = this._register(new event.Emitter<void>());\n\tget onDidFocus() { return this._onDidFocus.event; }\n\n\tprivate readonly _onDidBlur = this._register(new event.Emitter<void>());\n\tget onDidBlur() { return this._onDidBlur.event; }\n\n\tprivate _refreshStateHandler: () => void;\n\n\tprivate static hasFocusWithin(element: HTMLElement | Window): boolean {\n\t\tif (isHTMLElement(element)) {\n\t\t\tconst shadowRoot = getShadowRoot(element);\n\t\t\tconst activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n\t\t\treturn isAncestor(activeElement, element);\n\t\t} else {\n\t\t\tconst window = element;\n\t\t\treturn isAncestor(window.document.activeElement, window.document);\n\t\t}\n\t}\n\n\tconstructor(element: HTMLElement | Window) {\n\t\tsuper();\n\t\tlet hasFocus = FocusTracker.hasFocusWithin(element);\n\t\tlet loosingFocus = false;\n\n\t\tconst onFocus = () => {\n\t\t\tloosingFocus = false;\n\t\t\tif (!hasFocus) {\n\t\t\t\thasFocus = true;\n\t\t\t\tthis._onDidFocus.fire();\n\t\t\t}\n\t\t};\n\n\t\tconst onBlur = () => {\n\t\t\tif (hasFocus) {\n\t\t\t\tloosingFocus = true;\n\t\t\t\t(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {\n\t\t\t\t\tif (loosingFocus) {\n\t\t\t\t\t\tloosingFocus = false;\n\t\t\t\t\t\thasFocus = false;\n\t\t\t\t\t\tthis._onDidBlur.fire();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t};\n\n\t\tthis._refreshStateHandler = () => {\n\t\t\tconst currentNodeHasFocus = FocusTracker.hasFocusWithin(<HTMLElement>element);\n\t\t\tif (currentNodeHasFocus !== hasFocus) {\n\t\t\t\tif (hasFocus) {\n\t\t\t\t\tonBlur();\n\t\t\t\t} else {\n\t\t\t\t\tonFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n\t\tthis._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n\t\tif (isHTMLElement(element)) {\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n\t\t}\n\n\t}\n}\n\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element: HTMLElement | Window): IFocusTracker {\n\treturn new FocusTracker(element);\n}\n\nexport function after<T extends Node>(sibling: HTMLElement, child: T): T {\n\tsibling.after(child);\n\treturn child;\n}\n\nexport function append<T extends Node>(parent: HTMLElement, child: T): T;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): void;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): T | void {\n\tparent.append(...children);\n\tif (children.length === 1 && typeof children[0] !== 'string') {\n\t\treturn children[0];\n\t}\n}\n\nexport function prepend<T extends Node>(parent: HTMLElement, child: T): T {\n\tparent.insertBefore(child, parent.firstChild);\n\treturn child;\n}\n\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent: HTMLElement, ...children: Array<Node | string>): void {\n\tparent.textContent = '';\n\tappend(parent, ...children);\n}\n\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\n\nexport enum Namespace {\n\tHTML = 'http://www.w3.org/1999/xhtml',\n\tSVG = 'http://www.w3.org/2000/svg'\n}\n\nfunction _$<T extends Element>(namespace: Namespace, description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\tconst match = SELECTOR_REGEX.exec(description);\n\n\tif (!match) {\n\t\tthrow new Error('Bad use of emmet');\n\t}\n\n\tconst tagName = match[1] || 'div';\n\tlet result: T;\n\n\tif (namespace !== Namespace.HTML) {\n\t\tresult = document.createElementNS(namespace as string, tagName) as T;\n\t} else {\n\t\tresult = document.createElement(tagName) as unknown as T;\n\t}\n\n\tif (match[3]) {\n\t\tresult.id = match[3];\n\t}\n\tif (match[4]) {\n\t\tresult.className = match[4].replace(/\\./g, ' ').trim();\n\t}\n\n\tif (attrs) {\n\t\tObject.entries(attrs).forEach(([name, value]) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (/^on\\w+$/.test(name)) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(<any>result)[name] = value;\n\t\t\t} else if (name === 'selected') {\n\t\t\t\tif (value) {\n\t\t\t\t\tresult.setAttribute(name, 'true');\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.setAttribute(name, value);\n\t\t\t}\n\t\t});\n\t}\n\n\tresult.append(...children);\n\n\treturn result;\n}\n\nexport function $<T extends HTMLElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.HTML, description, attrs, ...children);\n}\n\n$.SVG = function <T extends SVGElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.SVG, description, attrs, ...children);\n};\n\nexport function setVisibility(visible: boolean, ...elements: HTMLElement[]): void {\n\tif (visible) {\n\t\tshow(...elements);\n\t} else {\n\t\thide(...elements);\n\t}\n}\n\nexport function show(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = '';\n\t\telement.removeAttribute('aria-hidden');\n\t}\n}\n\nexport function hide(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = 'none';\n\t\telement.setAttribute('aria-hidden', 'true');\n\t}\n}\n\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window: Window, cssPx: number): number {\n\tconst screenPx = window.devicePixelRatio * cssPx;\n\treturn Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url: string): void {\n\t// By using 'noopener' in the `windowFeatures` argument, the newly created window will\n\t// not be able to use `window.opener` to reach back to the current page.\n\t// See https://stackoverflow.com/a/46958731\n\t// See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n\t// However, this also doesn't allow us to realize if the browser blocked\n\t// the creation of the window.\n\tmainWindow.open(url, '_blank', 'noopener');\n}\n\nexport function animate(targetWindow: Window, fn: () => void): IDisposable {\n\tconst step = () => {\n\t\tfn();\n\t\tstepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\t};\n\n\tlet stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\treturn toDisposable(() => stepDisposable.dispose());\n}\n\nRemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http');\n\ntype ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';\n\nexport interface IModifierKeyStatus {\n\taltKey: boolean;\n\tshiftKey: boolean;\n\tctrlKey: boolean;\n\tmetaKey: boolean;\n\tlastKeyPressed?: ModifierKey;\n\tlastKeyReleased?: ModifierKey;\n\tevent?: KeyboardEvent;\n}\n\nexport class ModifierKeyEmitter extends event.Emitter<IModifierKeyStatus> {\n\n\t// This emitter is a lazily created singleton (see `getInstance`) that is allowed\n\t// to outlive the test that happens to create it first. `Emitter` itself is not\n\t// tracked, so the store has to be marked to keep it out of leak detection.\n\tprivate readonly _subscriptions = markAsSingleton(new DisposableStore());\n\tprivate _keyStatus: IModifierKeyStatus;\n\tprivate static instance: ModifierKeyEmitter | undefined;\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\n\t\tthis._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n\t}\n\n\tprivate registerListeners(window: Window, disposables: DisposableStore): void {\n\t\tdisposables.add(addDisposableListener(window, 'keydown', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\t// If Alt-key keydown event is repeated, ignore it #112347\n\t\t\t// Only known to be necessary for Alt-Key at the moment #115810\n\t\t\tif (event.keyCode === KeyCode.Alt && e.repeat) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (e.altKey && !this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'alt';\n\t\t\t} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'ctrl';\n\t\t\t} else if (e.metaKey && !this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'meta';\n\t\t\t} else if (e.shiftKey && !this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'shift';\n\t\t\t} else if (event.keyCode !== KeyCode.Alt) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyPressed) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'keyup', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!e.altKey && this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'alt';\n\t\t\t} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'ctrl';\n\t\t\t} else if (!e.metaKey && this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'meta';\n\t\t\t} else if (!e.shiftKey && this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'shift';\n\t\t\t} else {\n\t\t\t\tthis._keyStatus.lastKeyReleased = undefined;\n\t\t\t}\n\n\t\t\tif (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n\t\t\tif (e.buttons) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'blur', () => {\n\t\t\tthis.resetKeyStatus();\n\t\t}));\n\t}\n\n\tget keyStatus(): IModifierKeyStatus {\n\t\treturn this._keyStatus;\n\t}\n\n\t/**\n\t * Allows to explicitly reset the key status based on more knowledge (#109062)\n\t */\n\tresetKeyStatus(): void {\n\t\tthis.doResetKeyStatus();\n\t\tthis.fire(this._keyStatus);\n\t}\n\n\tprivate doResetKeyStatus(): void {\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\t}\n\n\tstatic getInstance() {\n\t\tif (!ModifierKeyEmitter.instance) {\n\t\t\tModifierKeyEmitter.instance = new ModifierKeyEmitter();\n\t\t}\n\n\t\treturn ModifierKeyEmitter.instance;\n\t}\n\n\toverride dispose() {\n\t\tsuper.dispose();\n\t\tthis._subscriptions.dispose();\n\t}\n}\n\nexport interface IDragAndDropObserverCallbacks {\n\treadonly onDragEnter?: (e: DragEvent) => void;\n\treadonly onDragLeave?: (e: DragEvent) => void;\n\treadonly onDrop?: (e: DragEvent) => void;\n\treadonly onDragEnd?: (e: DragEvent) => void;\n\treadonly onDragStart?: (e: DragEvent) => void;\n\treadonly onDrag?: (e: DragEvent) => void;\n\treadonly onDragOver?: (e: DragEvent, dragDuration: number) => void;\n}\n\nexport class DragAndDropObserver extends Disposable {\n\n\t// A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n\t// calls see https://github.com/microsoft/vscode/issues/14470\n\t// when the element has child elements where the events are fired\n\t// repeadedly.\n\tprivate counter: number = 0;\n\n\t// Allows to measure the duration of the drag operation.\n\tprivate dragStartTime = 0;\n\n\tconstructor(private readonly element: HTMLElement, private readonly callbacks: IDragAndDropObserverCallbacks) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (this.callbacks.onDragStart) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_START, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDragStart?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tif (this.callbacks.onDrag) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDrag?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e: DragEvent) => {\n\t\t\tthis.counter++;\n\t\t\tthis.dragStartTime = e.timeStamp;\n\n\t\t\tthis.callbacks.onDragEnter?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => {\n\t\t\te.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n\n\t\t\tthis.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e: DragEvent) => {\n\t\t\tthis.counter--;\n\n\t\t\tif (this.counter === 0) {\n\t\t\t\tthis.dragStartTime = 0;\n\n\t\t\t\tthis.callbacks.onDragLeave?.(e);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_END, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDragEnd?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DROP, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDrop?.(e);\n\t\t}));\n\t}\n}\n\n/**\n * A wrapper around `ResizeObserver` that is disposable.\n *\n * Behavior is intentionally identical to using `new ResizeObserver(callback)`\n * directly: the user-supplied callback runs synchronously inside the\n * browser's resize-observation phase, with the entries the browser delivered.\n * The wrapper adds three things on top:\n *\n * 1. Lifetime management: `dispose()` disconnects the underlying observer.\n * 2. Auxiliary-window support: pass `targetWindow` so the observer is\n * constructed in the realm of the element being observed.\n * 3. Context for the\n * `ResizeObserver loop completed with undelivered notifications` warning:\n * each instance carries a stable `name`, and just before invoking the user\n * callback we add that name to a bounded, per-window set that is cleared\n * at the next animation frame. The warning is delivered as a stackless\n * `ErrorEvent` on `window` after callbacks run, so error telemetry can\n * include the wrapped observers that recently ran in that window (see\n * {@link getRecentDisposableResizeObserverContextForLoopError}). This is\n * delivery context, not causal attribution: the browser does not expose\n * which observer or skipped target caused the warning.\n *\n * @param name Stable identifier used in loop-warning context. Prefer one that\n * survives minification and refactors (e.g. the consumer class + purpose)\n * since callstacks change across releases.\n * @param callback Invoked synchronously when the browser delivers resize\n * notifications, with the same entries the native `ResizeObserver` would\n * have delivered.\n * @param targetWindow The window whose `ResizeObserver` constructor should\n * be used. Defaults to `mainWindow`. Pass the containing window when\n * creating an observer for elements that live in an auxiliary window.\n * @param options Optional configuration. `resizeObserverCtor` is a test\n * seam that defaults to `targetWindow.ResizeObserver`.\n */\nexport class DisposableResizeObserver extends Disposable {\n\n\tprivate readonly observer: ResizeObserver;\n\treadonly name: string;\n\n\tconstructor(\n\t\tname: string,\n\t\tcallback: ResizeObserverCallback,\n\t\ttargetWindow: CodeWindow = mainWindow,\n\t\toptions?: { resizeObserverCtor?: typeof ResizeObserver },\n\t) {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tconst ctor = options?.resizeObserverCtor ?? targetWindow.ResizeObserver;\n\t\tthis.observer = new ctor((entries: ResizeObserverEntry[], observer) => {\n\t\t\trecordDisposableResizeObserverInvocation(targetWindow, this.name);\n\t\t\ttry {\n\t\t\t\tcallback(entries, observer);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t}\n\t\t});\n\t\tthis._register(toDisposable(() => this.observer.disconnect()));\n\t}\n\n\tobserve(target: Element, options?: ResizeObserverOptions): IDisposable {\n\t\tthis.observer.observe(target, options);\n\t\treturn toDisposable(() => this.observer.unobserve(target));\n\t}\n}\n\n/**\n * Keep the context bounded so a large delivery phase cannot create an\n * unbounded telemetry value. Names are static component identifiers, and are\n * sorted when read so equivalent phases share a stable bucket.\n */\nconst maxRecentDisposableResizeObservers = 8;\n\n/**\n * Wrapped observers that ran recently in one window. This is deliberately\n * scoped by window because auxiliary windows have independent documents and\n * resize-observation delivery loops.\n */\ninterface IRecentDisposableResizeObserverContext {\n\treadonly names: Set<string>;\n\toverflow: boolean;\n}\n\nconst recentDisposableResizeObserverContexts = new WeakMap<CodeWindow, IRecentDisposableResizeObserverContext>();\n\nfunction recordDisposableResizeObserverInvocation(targetWindow: CodeWindow, name: string): void {\n\tlet context = recentDisposableResizeObserverContexts.get(targetWindow);\n\tif (!context) {\n\t\tcontext = { names: new Set(), overflow: false };\n\t\trecentDisposableResizeObserverContexts.set(targetWindow, context);\n\n\t\t// ResizeObserver callbacks and the synthetic loop error are delivered\n\t\t// after requestAnimationFrame callbacks in the rendering update. A\n\t\t// request made here therefore clears this context at the next frame,\n\t\t// after telemetry has observed any warning from the current update.\n\t\ttargetWindow.requestAnimationFrame(() => recentDisposableResizeObserverContexts.delete(targetWindow));\n\t}\n\n\tif (context.names.has(name)) {\n\t\treturn;\n\t}\n\tif (context.names.size < maxRecentDisposableResizeObservers) {\n\t\tcontext.names.add(name);\n\t} else {\n\t\tcontext.overflow = true;\n\t\tconst largestName = Array.from(context.names).sort().at(-1)!;\n\t\tif (name < largestName) {\n\t\t\tcontext.names.delete(largestName);\n\t\t\tcontext.names.add(name);\n\t\t}\n\t}\n}\n\ntype HTMLElementAttributeKeys<T> = Partial<{ [K in keyof T]: T[K] extends Function ? never : T[K] extends object ? HTMLElementAttributeKeys<T[K]> : T[K] }>;\ntype ElementAttributes<T> = HTMLElementAttributeKeys<T> & Record<string, any>;\ntype RemoveHTMLElement<T> = T extends HTMLElement ? never : T;\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\ntype ArrayToObj<T extends readonly any[]> = UnionToIntersection<RemoveHTMLElement<T[number]>>;\ntype HHTMLElementTagNameMap = HTMLElementTagNameMap & { '': HTMLDivElement };\n\ntype TagToElement<T> = T extends `${infer TStart}#${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends `${infer TStart}.${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends keyof HTMLElementTagNameMap\n\t? HTMLElementTagNameMap[T]\n\t: HTMLElement;\n\ntype TagToElementAndId<TTag> = TTag extends `${infer TTag}@${infer TId}`\n\t? { element: TagToElement<TTag>; id: TId }\n\t: { element: TagToElement<TTag>; id: 'root' };\n\ntype TagToRecord<TTag> = TagToElementAndId<TTag> extends { element: infer TElement; id: infer TId }\n\t? Record<(TId extends string ? TId : never) | 'root', TElement>\n\t: never;\n\ntype Child = HTMLElement | string | Record<string, HTMLElement>;\n\nconst H_REGEX = /(?<tag>[\\w\\-]+)?(?:#(?<id>[\\w\\-]+))?(?<class>(?:\\.(?:[\\w\\-]+))*)(?:@(?<name>(?:[\\w\\_])+))?/;\n\n/**\n * A helper function to create nested dom nodes.\n *\n *\n * ```ts\n * const elements = h('div.code-view', [\n * \th('div.title@title'),\n * \th('div.container', [\n * \t\th('div.gutter@gutterDiv'),\n * \t\th('div@editor'),\n * \t]),\n * ]);\n * const editor = createEditor(elements.editor);\n * ```\n*/\nexport function h<TTag extends string>\n\t(tag: TTag):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h(tag: string, ...args: [] | [attributes: { $: string } & Partial<ElementAttributes<HTMLElement>> | Record<string, any>, children?: any[]] | [children: any[]]): Record<string, HTMLElement> {\n\tlet attributes: { $?: string } & Partial<ElementAttributes<HTMLElement>>;\n\tlet children: (Record<string, HTMLElement> | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElement(tagName);\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record<string, HTMLElement> = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nfunction camelCaseToHyphenCase(str: string) {\n\treturn str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nexport function copyAttributes(from: Element, to: Element, filter?: string[]): void {\n\tfor (const { name, value } of from.attributes) {\n\t\tif (!filter || filter.includes(name)) {\n\t\t\tto.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nexport function isEditableElement(element: Element): boolean {\n\treturn element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea' || isHTMLElement(element) && !!element.editContext;\n}\n\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nexport class SafeTriangle {\n\t// 4 points (x, y), 8 length\n\tprivate points = new Int16Array(8);\n\n\tconstructor(\n\t\tprivate readonly originX: number,\n\t\tprivate readonly originY: number,\n\t\ttarget: HTMLElement\n\t) {\n\t\tconst { top, left, right, bottom } = target.getBoundingClientRect();\n\t\tconst t = this.points;\n\t\tlet i = 0;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\t}\n\n\tpublic contains(x: number, y: number) {\n\t\tconst { points, originX, originY } = this;\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tconst p1 = 2 * i;\n\t\t\tconst p2 = 2 * ((i + 1) % 4);\n\t\t\tif (isPointWithinTriangle(x, y, originX, originY, points[p1], points[p1 + 1], points[p2], points[p2 + 1])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\n\nexport namespace n {\n\tfunction nodeNs<TMap extends Record<string, any>>(elementNs: string | undefined = undefined): DomTagCreateFn<TMap> {\n\t\treturn (tag, attributes, children) => {\n\t\t\tconst className = attributes.class;\n\t\t\tdelete attributes.class;\n\t\t\tconst ref = attributes.ref;\n\t\t\tdelete attributes.ref;\n\t\t\tconst obsRef = attributes.obsRef;\n\t\t\tdelete attributes.obsRef;\n\n\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\treturn new ObserverNodeWithElement(tag as any, ref, obsRef, elementNs, className, attributes, children);\n\t\t};\n\t}\n\n\tfunction node<TMap extends Record<string, any>, TKey extends keyof TMap>(tag: TKey, elementNs: string | undefined = undefined): DomCreateFn<TMap[TKey], TMap[TKey]> {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst f = nodeNs(elementNs) as any;\n\t\treturn (attributes, children) => {\n\t\t\treturn f(tag, attributes, children);\n\t\t};\n\t}\n\n\texport const div: DomCreateFn<HTMLDivElement, HTMLDivElement> = node<HTMLElementTagNameMap, 'div'>('div');\n\n\texport const elem = nodeNs<HTMLElementTagNameMap>(undefined);\n\n\texport const svg: DomCreateFn<SVGElementTagNameMap2['svg'], SVGElement> = node<SVGElementTagNameMap2, 'svg'>('svg', 'http://www.w3.org/2000/svg');\n\n\texport const svgElem = nodeNs<SVGElementTagNameMap2>('http://www.w3.org/2000/svg');\n\n\texport function ref<T = HTMLOrSVGElement>(): IRefWithVal<T> {\n\t\tlet value: T | undefined = undefined;\n\t\tconst result: IRef<T> = function (val: T) {\n\t\t\tvalue = val;\n\t\t};\n\t\tObject.defineProperty(result, 'element', {\n\t\t\tget() {\n\t\t\t\tif (!value) {\n\t\t\t\t\tthrow new BugIndicatingError('Make sure the ref is set before accessing the element. Maybe wrong initialization order?');\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t});\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\treturn result as any;\n\t}\n}\ntype Value<T> = T | IObservable<T>;\ntype ValueOrList<T> = Value<T> | ValueOrList<T>[];\ntype ValueOrList2<T> = ValueOrList<T> | ValueOrList<ValueOrList<T>>;\ntype HTMLOrSVGElement = HTMLElement | SVGElement;\ntype SVGElementTagNameMap2 = {\n\tsvg: SVGElement & {\n\t\twidth: number;\n\t\theight: number;\n\t\ttransform: string;\n\t\tviewBox: string;\n\t\tfill: string;\n\t};\n\tpath: SVGElement & {\n\t\td: string;\n\t\tstroke: string;\n\t\tfill: string;\n\t};\n\tlinearGradient: SVGElement & {\n\t\tid: string;\n\t\tx1: string | number;\n\t\tx2: string | number;\n\t};\n\tstop: SVGElement & {\n\t\toffset: string;\n\t};\n\trect: SVGElement & {\n\t\tx: number;\n\t\ty: number;\n\t\twidth: number;\n\t\theight: number;\n\t\tfill: string;\n\t};\n\tdefs: SVGElement;\n};\ntype DomTagCreateFn<TMap extends Record<string, any>> = <TTag extends keyof TMap>(\n\ttag: TTag,\n\tattributes: ElementAttributeKeys<TMap[TTag]> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TMap[TTag]>; obsRef?: IRef<ObserverNodeWithElement<TMap[TTag]> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TMap[TTag]>;\ntype DomCreateFn<TAttributes, TResult extends HTMLOrSVGElement> = (\n\tattributes: ElementAttributeKeys<TAttributes> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TResult>; obsRef?: IRef<ObserverNodeWithElement<TResult> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TResult>;\n\nexport type ChildNode = ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>;\n\nexport type IRef<T> = (value: T) => void;\n\nexport interface IRefWithVal<T> extends IRef<T> {\n\treadonly element: T;\n}\n\nexport abstract class ObserverNode<T extends HTMLOrSVGElement = HTMLOrSVGElement> {\n\tprivate readonly _deriveds: (IObservable<any>)[] = [];\n\n\tprotected readonly _element: T;\n\n\tconstructor(\n\t\ttag: string,\n\t\tref: IRef<T> | undefined,\n\t\tobsRef: IRef<ObserverNodeWithElement<T> | null> | undefined,\n\t\tns: string | undefined,\n\t\tclassName: ValueOrList<string | undefined | false> | undefined,\n\t\tattributes: ElementAttributeKeys<T>,\n\t\tchildren: ChildNode\n\t) {\n\t\tthis._element = (ns ? document.createElementNS(ns, tag) : document.createElement(tag)) as unknown as T;\n\t\tif (ref) {\n\t\t\tref(this._element);\n\t\t}\n\t\tif (obsRef) {\n\t\t\tthis._deriveds.push(derived((_reader) => {\n\t\t\t\tobsRef(this as unknown as ObserverNodeWithElement<T>);\n\t\t\t\t_reader.store.add({\n\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\tobsRef(null);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}));\n\t\t}\n\n\t\tif (className) {\n\t\t\tif (hasObservable(className)) {\n\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t/** @description set.class */\n\t\t\t\t\tsetClassName(this._element, getClassName(className, reader));\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\tsetClassName(this._element, getClassName(className, undefined));\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(attributes)) {\n\t\t\tif (key === 'style') {\n\t\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\t\tconst key = camelCaseToHyphenCase(cssKey);\n\t\t\t\t\tif (isObservable(cssValue)) {\n\t\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.style.${key}` }, reader => {\n\t\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue.read(reader)));\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (key === 'tabIndex') {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t\t/** @description set.tabIndex */\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\tthis._element.tabIndex = value.read(reader) as any;\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tthis._element.tabIndex = value;\n\t\t\t\t}\n\t\t\t} else if (key.startsWith('on')) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(this._element as any)[key] = value;\n\t\t\t} else {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.${key}` }, reader => {\n\t\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value.read(reader));\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (children) {\n\t\t\tfunction getChildren(reader: IReader | undefined, children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): (HTMLOrSVGElement | string)[] {\n\t\t\t\tif (isObservable(children)) {\n\t\t\t\t\treturn getChildren(reader, children.read(reader));\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(children)) {\n\t\t\t\t\treturn children.flatMap(c => getChildren(reader, c));\n\t\t\t\t}\n\t\t\t\tif (children instanceof ObserverNode) {\n\t\t\t\t\tif (reader) {\n\t\t\t\t\t\tchildren.readEffect(reader);\n\t\t\t\t\t}\n\t\t\t\t\treturn [children._element];\n\t\t\t\t}\n\t\t\t\tif (children) {\n\t\t\t\t\treturn [children];\n\t\t\t\t}\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst d = derived(this, reader => {\n\t\t\t\t/** @description set.children */\n\t\t\t\tthis._element.replaceChildren(...getChildren(reader, children));\n\t\t\t});\n\t\t\tthis._deriveds.push(d);\n\t\t\tif (!childrenIsObservable(children)) {\n\t\t\t\td.get();\n\t\t\t}\n\t\t}\n\t}\n\n\treadEffect(reader: IReader | undefined): void {\n\t\tfor (const d of this._deriveds) {\n\t\t\td.read(reader);\n\t\t}\n\t}\n\n\tkeepUpdated(store: DisposableStore): ObserverNodeWithElement<T> {\n\t\tderived(reader => {\n\t\t\t/** update */\n\t\t\tthis.readEffect(reader);\n\t\t}).recomputeInitiallyAndOnChange(store);\n\t\treturn this as unknown as ObserverNodeWithElement<T>;\n\t}\n\n\t/**\n\t * Creates a live element that will keep the element updated as long as the returned object is not disposed.\n\t*/\n\ttoDisposableLiveElement() {\n\t\tconst store = new DisposableStore();\n\t\tthis.keepUpdated(store);\n\t\treturn new LiveElement(this._element, store);\n\t}\n\n\tprivate _isHovered: IObservable<boolean> | undefined = undefined;\n\n\tget isHovered(): IObservable<boolean> {\n\t\tif (!this._isHovered) {\n\t\t\tconst hovered = observableValue<boolean>('hovered', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => hovered.set(true, undefined));\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => hovered.set(false, undefined));\n\t\t\tthis._isHovered = hovered;\n\t\t}\n\t\treturn this._isHovered;\n\t}\n\n\tprivate _didMouseMoveDuringHover: IObservable<boolean> | undefined = undefined;\n\n\tget didMouseMoveDuringHover(): IObservable<boolean> {\n\t\tif (!this._didMouseMoveDuringHover) {\n\t\t\tlet _hovering = false;\n\t\t\tconst hovered = observableValue<boolean>('didMouseMoveDuringHover', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => {\n\t\t\t\t_hovering = true;\n\t\t\t});\n\t\t\tthis._element.addEventListener('mousemove', (_e) => {\n\t\t\t\tif (_hovering) {\n\t\t\t\t\thovered.set(true, undefined);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => {\n\t\t\t\t_hovering = false;\n\t\t\t\thovered.set(false, undefined);\n\t\t\t});\n\t\t\tthis._didMouseMoveDuringHover = hovered;\n\t\t}\n\t\treturn this._didMouseMoveDuringHover;\n\t}\n}\n\nfunction setClassName(domNode: HTMLOrSVGElement, className: string) {\n\tif (isSVGElement(domNode)) {\n\t\tdomNode.setAttribute('class', className);\n\t} else {\n\t\tdomNode.className = className;\n\t}\n}\n\nfunction resolve<T>(value: ValueOrList<T>, reader: IReader | undefined, cb: (val: T) => void): void {\n\tif (isObservable(value)) {\n\t\tcb(value.read(reader));\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const v of value) {\n\t\t\tresolve(v, reader, cb);\n\t\t}\n\t\treturn;\n\t}\n\t// eslint-disable-next-line local/code-no-any-casts\n\tcb(value as any);\n}\nfunction getClassName(className: ValueOrList<string | undefined | false> | undefined, reader: IReader | undefined): string {\n\tlet result = '';\n\tresolve(className, reader, val => {\n\t\tif (val) {\n\t\t\tif (result.length === 0) {\n\t\t\t\tresult = val;\n\t\t\t} else {\n\t\t\t\tresult += ' ' + val;\n\t\t\t}\n\t\t}\n\t});\n\treturn result;\n}\nfunction hasObservable(value: ValueOrList<unknown>): boolean {\n\tif (isObservable(value)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.some(v => hasObservable(v));\n\t}\n\treturn false;\n}\nfunction convertCssValue(value: any): string {\n\tif (typeof value === 'number') {\n\t\treturn value + 'px';\n\t}\n\treturn value;\n}\nfunction childrenIsObservable(children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): boolean {\n\tif (isObservable(children)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(children)) {\n\t\treturn children.some(c => childrenIsObservable(c));\n\t}\n\treturn false;\n}\n\nexport class LiveElement<T extends HTMLOrSVGElement = HTMLElement> {\n\tconstructor(\n\t\tpublic readonly element: T,\n\t\tprivate readonly _disposable: IDisposable\n\t) { }\n\n\tdispose() {\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class ObserverNodeWithElement<T extends HTMLOrSVGElement = HTMLOrSVGElement> extends ObserverNode<T> {\n\tpublic get element() {\n\t\treturn this._element;\n\t}\n}\nfunction setOrRemoveAttribute(element: HTMLOrSVGElement, key: string, value: unknown) {\n\tif (value === null || value === undefined) {\n\t\telement.removeAttribute(camelCaseToHyphenCase(key));\n\t} else {\n\t\telement.setAttribute(camelCaseToHyphenCase(key), String(value));\n\t}\n}\n\ntype ElementAttributeKeys<T> = Partial<{\n\t[K in keyof T]: T[K] extends Function ? never : T[K] extends object ? ElementAttributeKeys<T[K]> : Value<number | T[K] | undefined | null>;\n}>;\n\n/**\n * A custom element that fires callbacks when connected to or disconnected from the DOM.\n * Useful for tracking whether a template or component is currently mounted, especially\n * with iframes/webviews that are sensitive to movement.\n *\n * @example\n * ```ts\n * const observer = document.createElement('connection-observer') as ConnectionObserverElement;\n * observer.onDidConnect = () => console.log('mounted');\n * observer.onDidDisconnect = () => console.log('unmounted');\n * container.appendChild(observer);\n * ```\n */\nexport class ConnectionObserverElement extends HTMLElement {\n\tpublic onDidConnect?: () => void;\n\tpublic onDidDisconnect?: () => void;\n\n\tdisconnectedCallback() {\n\t\tthis.onDidDisconnect?.();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.onDidConnect?.();\n\t}\n}\n\nif (!customElements.get('connection-observer')) {\n\tcustomElements.define('connection-observer', ConnectionObserverElement);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/browser/dom.ts","vs/base/browser/dom.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAkB,qBAAqB,EA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CAAC,EAAE,CAAC;IAChD,cAAc,CAAC,MAAM,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,CAAC;AACzE,CAAC","file":"dom.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from './browser.js';\nimport { BrowserFeatures } from './canIUse.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from './keyboardEvent.js';\nimport { IMouseEvent, StandardMouseEvent } from './mouseEvent.js';\nimport { AbstractIdleValue, IntervalTimer, _runWhenIdle, IdleDeadline } from '../common/async.js';\nimport { BugIndicatingError, onUnexpectedError } from '../common/errors.js';\nimport * as event from '../common/event.js';\nimport { KeyCode } from '../common/keyCodes.js';\nimport { Disposable, DisposableStore, IDisposable, markAsSingleton, toDisposable } from '../common/lifecycle.js';\nimport { RemoteAuthorities } from '../common/network.js';\nimport * as platform from '../common/platform.js';\nimport { hash } from '../common/hash.js';\nimport { CodeWindow, ensureCodeWindow, mainWindow } from './window.js';\nimport { isPointWithinTriangle } from '../common/numbers.js';\nimport { IObservable, derived, derivedOpts, IReader, observableValue, isObservable } from '../common/observable.js';\n\nexport interface IRegisteredCodeWindow {\n\treadonly window: CodeWindow;\n\treadonly disposables: DisposableStore;\n}\n\n//# region Multi-Window Support Utilities\n\nexport const {\n\tregisterWindow,\n\tgetWindow,\n\tgetDocument,\n\tgetWindows,\n\tgetWindowsCount,\n\tgetWindowId,\n\tgetWindowById,\n\thasWindow,\n\tonDidRegisterWindow,\n\tonWillUnregisterWindow,\n\tonDidUnregisterWindow\n} = (function () {\n\tconst windows = new Map<number, IRegisteredCodeWindow>();\n\n\tensureCodeWindow(mainWindow, 1);\n\tconst mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n\twindows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n\n\tconst onDidRegisterWindow = new event.Emitter<IRegisteredCodeWindow>();\n\tconst onDidUnregisterWindow = new event.Emitter<CodeWindow>();\n\tconst onWillUnregisterWindow = new event.Emitter<CodeWindow>();\n\n\tfunction getWindowById(windowId: number): IRegisteredCodeWindow | undefined;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain: true): IRegisteredCodeWindow;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain?: boolean): IRegisteredCodeWindow | undefined {\n\t\tconst window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n\n\t\treturn window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n\t}\n\n\treturn {\n\t\tonDidRegisterWindow: onDidRegisterWindow.event,\n\t\tonWillUnregisterWindow: onWillUnregisterWindow.event,\n\t\tonDidUnregisterWindow: onDidUnregisterWindow.event,\n\t\tregisterWindow(window: CodeWindow): IDisposable {\n\t\t\tif (windows.has(window.vscodeWindowId)) {\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tconst disposables = new DisposableStore();\n\n\t\t\tconst registeredWindow = {\n\t\t\t\twindow,\n\t\t\t\tdisposables: disposables.add(new DisposableStore())\n\t\t\t};\n\t\t\twindows.set(window.vscodeWindowId, registeredWindow);\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\twindows.delete(window.vscodeWindowId);\n\t\t\t\tonDidUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tdisposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n\t\t\t\tonWillUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tonDidRegisterWindow.fire(registeredWindow);\n\n\t\t\treturn disposables;\n\t\t},\n\t\tgetWindows(): Iterable<IRegisteredCodeWindow> {\n\t\t\treturn windows.values();\n\t\t},\n\t\tgetWindowsCount(): number {\n\t\t\treturn windows.size;\n\t\t},\n\t\tgetWindowId(targetWindow: Window): number {\n\t\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t\t},\n\t\thasWindow(windowId: number): boolean {\n\t\t\treturn windows.has(windowId);\n\t\t},\n\t\tgetWindowById,\n\t\tgetWindow(e: Node | UIEvent | undefined | null): CodeWindow {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\tif (candidateNode?.ownerDocument?.defaultView) {\n\t\t\t\treturn candidateNode.ownerDocument.defaultView.window as CodeWindow;\n\t\t\t}\n\n\t\t\tconst candidateEvent = e as UIEvent | undefined | null;\n\t\t\tif (candidateEvent?.view) {\n\t\t\t\treturn candidateEvent.view.window as CodeWindow;\n\t\t\t}\n\n\t\t\treturn mainWindow;\n\t\t},\n\t\tgetDocument(e: Node | UIEvent | undefined | null): Document {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\treturn getWindow(candidateNode).document;\n\t\t}\n\t};\n})();\n\n//#endregion\n\n//#region External Focus Tracking\n\n/**\n * Information about external focus state, including the associated window.\n */\nexport interface IExternalFocusInfo {\n\treadonly hasFocus: boolean;\n\treadonly window?: CodeWindow;\n}\n\n/**\n * A function that checks if a component outside the normal DOM tree has focus.\n * Returns focus info including which window the component is associated with.\n */\nexport type ExternalFocusChecker = () => IExternalFocusInfo;\n\n/**\n * A registry for functions that check if a component outside the normal DOM tree has focus.\n * This is used to extend the concept of \"window has focus\" to include things like\n * Electron WebContentsViews (browser views) that exist outside the workbench DOM.\n */\nconst externalFocusCheckers = new Set<ExternalFocusChecker>();\n\n/**\n * Get the window associated with a focused external component.\n * This is used to determine which window should receive UI like dialogs\n * when an external component (like a browser view) has focus.\n *\n * @returns The window of the focused external component, or undefined if none\n */\nexport function getExternalFocusWindow(): CodeWindow | undefined {\n\tfor (const checker of externalFocusCheckers) {\n\t\tconst info = checker();\n\t\tif (info.hasFocus && info.window) {\n\t\t\treturn info.window;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n//#endregion\n\nexport function clearNode(node: HTMLElement): void {\n\twhile (node.firstChild) {\n\t\tnode.firstChild.remove();\n\t}\n}\n\nclass DomListener implements IDisposable {\n\n\tprivate _handler: (e: any) => void;\n\tprivate _node: EventTarget;\n\tprivate readonly _type: string;\n\tprivate readonly _options: boolean | AddEventListenerOptions;\n\n\tconstructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {\n\t\tthis._node = node;\n\t\tthis._type = type;\n\t\tthis._handler = handler;\n\t\tthis._options = (options || false);\n\t\tthis._node.addEventListener(this._type, this._handler, this._options);\n\t}\n\n\tdispose(): void {\n\t\tif (!this._handler) {\n\t\t\t// Already disposed\n\t\t\treturn;\n\t\t}\n\n\t\tthis._node.removeEventListener(this._type, this._handler, this._options);\n\n\t\t// Prevent leakers from holding on to the dom or handler func\n\t\tthis._node = null!;\n\t\tthis._handler = null!;\n\t}\n}\n\nexport function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable {\n\treturn new DomListener(node, type, handler, useCaptureOrOptions);\n}\n\nexport interface IAddStandardDisposableListenerSignature {\n\t(node: HTMLElement | Element | Document, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerdown', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointermove', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerup', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\n}\nfunction _wrapAsStandardMouseEvent(targetWindow: Window, handler: (e: IMouseEvent) => void): (e: MouseEvent) => void {\n\treturn function (e: MouseEvent) {\n\t\treturn handler(new StandardMouseEvent(targetWindow, e));\n\t};\n}\nfunction _wrapAsStandardKeyboardEvent(handler: (e: IKeyboardEvent) => void): (e: KeyboardEvent) => void {\n\treturn function (e: KeyboardEvent) {\n\t\treturn handler(new StandardKeyboardEvent(e));\n\t};\n}\nexport const addStandardDisposableListener: IAddStandardDisposableListenerSignature = function addStandardDisposableListener(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tlet wrapHandler = handler;\n\n\tif (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n\t\twrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\t} else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n\t\twrapHandler = _wrapAsStandardKeyboardEvent(handler);\n\t}\n\n\treturn addDisposableListener(node, type, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseMoveListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseUpListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\n}\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nexport function runWhenWindowIdle(targetWindow: Window | typeof globalThis, callback: (idle: IdleDeadline) => void, timeout?: number): IDisposable {\n\treturn _runWhenIdle(targetWindow, callback, timeout);\n}\n\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue<T> extends AbstractIdleValue<T> {\n\tconstructor(targetWindow: Window | typeof globalThis, executor: () => T) {\n\t\tsuper(targetWindow, executor);\n\t}\n}\n\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n\nexport class WindowIntervalTimer extends IntervalTimer {\n\n\tprivate readonly defaultTarget?: Window & typeof globalThis;\n\n\t/**\n\t *\n\t * @param node The optional node from which the target window is determined\n\t */\n\tconstructor(node?: Node) {\n\t\tsuper();\n\t\tthis.defaultTarget = node && getWindow(node);\n\t}\n\n\toverride cancelAndSet(runner: () => void, interval: number, targetWindow?: Window & typeof globalThis): void {\n\t\treturn super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n\t}\n}\n\nclass AnimationFrameQueueItem implements IDisposable {\n\n\tprivate _runner: () => void;\n\tpublic priority: number;\n\tprivate _canceled: boolean;\n\n\tconstructor(runner: () => void, priority: number = 0) {\n\t\tthis._runner = runner;\n\t\tthis.priority = priority;\n\t\tthis._canceled = false;\n\t}\n\n\tdispose(): void {\n\t\tthis._canceled = true;\n\t}\n\n\texecute(): void {\n\t\tif (this._canceled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis._runner();\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t}\n\n\t// Sort by priority (largest to lowest)\n\tstatic sort(a: AnimationFrameQueueItem, b: AnimationFrameQueueItem): number {\n\t\treturn b.priority - a.priority;\n\t}\n}\n\n(function () {\n\t/**\n\t * The runners scheduled at the next animation frame\n\t */\n\tconst NEXT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * The runners scheduled at the current animation frame\n\t */\n\tconst CURRENT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * A flag to keep track if the native requestAnimationFrame was already called\n\t */\n\tconst animFrameRequested = new Map<number /* window ID */, boolean>();\n\t/**\n\t * A flag to indicate if currently handling a native requestAnimationFrame callback\n\t */\n\tconst inAnimationFrameRunner = new Map<number /* window ID */, boolean>();\n\n\tmarkAsSingleton(onDidUnregisterWindow(({ vscodeWindowId }) => {\n\t\t// A callback can close its window while the current queue is being processed.\n\t\tconst currentQueue = CURRENT_QUEUE.get(vscodeWindowId);\n\t\tif (currentQueue) {\n\t\t\tcurrentQueue.length = 0;\n\t\t}\n\t\tNEXT_QUEUE.delete(vscodeWindowId);\n\t\tCURRENT_QUEUE.delete(vscodeWindowId);\n\t\tanimFrameRequested.delete(vscodeWindowId);\n\t\tinAnimationFrameRunner.delete(vscodeWindowId);\n\t}));\n\n\tconst animationFrameRunner = (targetWindowId: number) => {\n\t\tif (!animFrameRequested.has(targetWindowId)) {\n\t\t\treturn;\n\t\t}\n\t\tanimFrameRequested.set(targetWindowId, false);\n\n\t\tconst currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\tNEXT_QUEUE.set(targetWindowId, []);\n\n\t\tinAnimationFrameRunner.set(targetWindowId, true);\n\t\twhile (currentQueue.length > 0) {\n\t\t\tcurrentQueue.sort(AnimationFrameQueueItem.sort);\n\t\t\tconst top = currentQueue.shift()!;\n\t\t\ttop.execute();\n\t\t}\n\t\tif (inAnimationFrameRunner.has(targetWindowId)) {\n\t\t\tinAnimationFrameRunner.set(targetWindowId, false);\n\t\t}\n\t};\n\n\tscheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority: number = 0) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\n\t\tlet nextQueue = NEXT_QUEUE.get(targetWindowId);\n\t\tif (!nextQueue) {\n\t\t\tnextQueue = [];\n\t\t\tNEXT_QUEUE.set(targetWindowId, nextQueue);\n\t\t}\n\t\tnextQueue.push(item);\n\n\t\tif (!animFrameRequested.get(targetWindowId)) {\n\t\t\tanimFrameRequested.set(targetWindowId, true);\n\t\t\ttargetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n\t\t}\n\n\t\treturn item;\n\t};\n\n\trunAtThisOrScheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority?: number) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tif (inAnimationFrameRunner.get(targetWindowId)) {\n\t\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\t\t\tlet currentQueue = CURRENT_QUEUE.get(targetWindowId);\n\t\t\tif (!currentQueue) {\n\t\t\t\tcurrentQueue = [];\n\t\t\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\t\t}\n\t\t\tcurrentQueue.push(item);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n\t\t}\n\t};\n})();\n\nexport function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {\n\treturn getWindow(el).getComputedStyle(el, null);\n}\n\nexport function getClientArea(element: HTMLElement, defaultValue?: Dimension, fallbackElement?: HTMLElement): Dimension {\n\tconst elWindow = getWindow(element);\n\tconst elDocument = elWindow.document;\n\n\t// Try with DOM clientWidth / clientHeight\n\tif (element !== elDocument.body) {\n\t\treturn new Dimension(element.clientWidth, element.clientHeight);\n\t}\n\n\t// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n\tif (platform.isIOS && elWindow?.visualViewport) {\n\t\treturn new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n\t}\n\n\t// Try innerWidth / innerHeight\n\tif (elWindow?.innerWidth && elWindow.innerHeight) {\n\t\treturn new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n\t}\n\n\t// Try with document.body.clientWidth / document.body.clientHeight\n\tif (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n\t\treturn new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n\t}\n\n\t// Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n\tif (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n\t\treturn new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n\t}\n\n\tif (fallbackElement) {\n\t\treturn getClientArea(fallbackElement, defaultValue);\n\t}\n\n\tif (defaultValue) {\n\t\treturn defaultValue;\n\t}\n\n\tthrow new Error('Unable to figure out browser width and height');\n}\n\nclass SizeUtils {\n\t// Adapted from WinJS\n\t// Converts a CSS positioning string for the specified element to pixels.\n\tprivate static convertToPixels(element: HTMLElement, value: string): number {\n\t\treturn parseFloat(value) || 0;\n\t}\n\n\tprivate static getDimension(element: HTMLElement, cssPropertyName: string): number {\n\t\tconst computedStyle = getComputedStyle(element);\n\t\tconst value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n\t\treturn SizeUtils.convertToPixels(element, value);\n\t}\n\n\tstatic getBorderLeftWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-left-width');\n\t}\n\tstatic getBorderRightWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-right-width');\n\t}\n\tstatic getBorderTopWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-top-width');\n\t}\n\tstatic getBorderBottomWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-bottom-width');\n\t}\n\n\tstatic getPaddingLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-left');\n\t}\n\tstatic getPaddingRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-right');\n\t}\n\tstatic getPaddingTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-top');\n\t}\n\tstatic getPaddingBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-bottom');\n\t}\n\n\tstatic getMarginLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-left');\n\t}\n\tstatic getMarginTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-top');\n\t}\n\tstatic getMarginRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-right');\n\t}\n\tstatic getMarginBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-bottom');\n\t}\n}\n\n// ----------------------------------------------------------------------------------------\n// Position & Dimension\n\nexport interface IDimension {\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport class Dimension implements IDimension {\n\n\tstatic readonly None = new Dimension(0, 0);\n\n\tconstructor(\n\t\treadonly width: number,\n\t\treadonly height: number,\n\t) { }\n\n\twith(width: number = this.width, height: number = this.height): Dimension {\n\t\tif (width !== this.width || height !== this.height) {\n\t\t\treturn new Dimension(width, height);\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tstatic is(obj: unknown): obj is IDimension {\n\t\treturn typeof obj === 'object' && typeof (<IDimension>obj).height === 'number' && typeof (<IDimension>obj).width === 'number';\n\t}\n\n\tstatic lift(obj: IDimension): Dimension {\n\t\tif (obj instanceof Dimension) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\treturn new Dimension(obj.width, obj.height);\n\t\t}\n\t}\n\n\tstatic equals(a: Dimension | undefined, b: Dimension | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.width === b.width && a.height === b.height;\n\t}\n}\n\nexport interface IDomPosition {\n\treadonly left: number;\n\treadonly top: number;\n}\n\nexport function getTopLeftOffset(element: HTMLElement): IDomPosition {\n\t// Adapted from WinJS.Utilities.getPosition\n\t// and added borders to the mix\n\n\tlet offsetParent = element.offsetParent;\n\tlet top = element.offsetTop;\n\tlet left = element.offsetLeft;\n\n\twhile (\n\t\t(element = <HTMLElement>element.parentNode) !== null\n\t\t&& element !== element.ownerDocument.body\n\t\t&& element !== element.ownerDocument.documentElement\n\t) {\n\t\ttop -= element.scrollTop;\n\t\tconst c = isShadowRoot(element) ? null : getComputedStyle(element);\n\t\tif (c) {\n\t\t\tleft -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n\t\t}\n\n\t\tif (element === offsetParent) {\n\t\t\tleft += SizeUtils.getBorderLeftWidth(element);\n\t\t\ttop += SizeUtils.getBorderTopWidth(element);\n\t\t\ttop += element.offsetTop;\n\t\t\tleft += element.offsetLeft;\n\t\t\toffsetParent = element.offsetParent;\n\t\t}\n\t}\n\n\treturn {\n\t\tleft: left,\n\t\ttop: top\n\t};\n}\n\nexport interface IDomNodePagePosition {\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n}\n\nexport function size(element: HTMLElement, width: number | null, height: number | null): void {\n\tif (typeof width === 'number') {\n\t\telement.style.width = `${width}px`;\n\t}\n\n\tif (typeof height === 'number') {\n\t\telement.style.height = `${height}px`;\n\t}\n}\n\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition {\n\tconst bb = domNode.getBoundingClientRect();\n\tconst window = getWindow(domNode);\n\treturn {\n\t\tleft: bb.left + window.scrollX,\n\t\ttop: bb.top + window.scrollY,\n\t\twidth: bb.width,\n\t\theight: bb.height\n\t};\n}\n\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode: HTMLElement): number {\n\tlet testElement: HTMLElement | null = domNode;\n\tlet zoom = 1.0;\n\tdo {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst elementZoomLevel = (getComputedStyle(testElement) as any).zoom;\n\t\tif (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n\t\t\tzoom *= elementZoomLevel;\n\t\t}\n\n\t\ttestElement = testElement.parentElement;\n\t} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n\n\treturn zoom;\n}\n\n\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.offsetWidth + margin;\n}\n\nexport function getContentWidth(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n\tconst padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n\treturn element.offsetWidth - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n\tconst padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n\treturn element.offsetHeight - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n\treturn element.offsetHeight + margin;\n}\n\n// ----------------------------------------------------------------------------------------\n\nexport function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean {\n\treturn Boolean(testAncestor?.contains(testChild));\n}\n\nexport function findParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (typeof clazz === 'string' ? node.classList.contains(clazz) : clazz.every(candidate => node.classList.contains(candidate))) {\n\t\t\treturn node;\n\t\t}\n\n\t\tif (stopAtClazzOrNode) {\n\t\t\tif (typeof stopAtClazzOrNode === 'string') {\n\t\t\t\tif (node.classList.contains(stopAtClazzOrNode)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (node === stopAtClazzOrNode) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnode = <HTMLElement>node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function hasParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): boolean {\n\treturn !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\n\nexport function isShadowRoot(node: Node): node is ShadowRoot {\n\treturn (\n\t\tnode && !!(<ShadowRoot>node).host && !!(<ShadowRoot>node).mode\n\t);\n}\n\nexport function isInShadowDOM(domNode: Node): boolean {\n\treturn !!getShadowRoot(domNode);\n}\n\nexport function getShadowRoot(domNode: Node): ShadowRoot | null {\n\twhile (domNode.parentNode) {\n\t\tif (domNode === domNode.ownerDocument?.body) {\n\t\t\t// reached the body\n\t\t\treturn null;\n\t\t}\n\t\tdomNode = domNode.parentNode;\n\t}\n\treturn isShadowRoot(domNode) ? domNode : null;\n}\n\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement(): Element | null {\n\tlet result = getActiveDocument().activeElement;\n\n\twhile (result?.shadowRoot) {\n\t\tresult = result.shadowRoot.activeElement;\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element: Element): boolean {\n\treturn getActiveElement() === element;\n}\n\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor: Element): boolean {\n\treturn isAncestor(getActiveElement(), ancestor);\n}\n\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus (including external components like browser views),\n * otherwise falls back to the main windows document.\n */\nexport function getActiveDocument(): Document {\n\tif (getWindowsCount() <= 1) {\n\t\treturn mainWindow.document;\n\t}\n\n\tconst documents = Array.from(getWindows()).map(({ window }) => window.document);\n\tconst focusedDoc = documents.find(doc => doc.hasFocus());\n\tif (focusedDoc) {\n\t\treturn focusedDoc;\n\t}\n\n\t// Check if an external component (like browser view) has focus\n\tconst externalWindow = getExternalFocusWindow();\n\tif (externalWindow) {\n\t\treturn externalWindow.document;\n\t}\n\n\treturn mainWindow.document;\n}\n\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow(): CodeWindow {\n\tconst document = getActiveDocument();\n\treturn (document.defaultView?.window ?? mainWindow) as CodeWindow;\n}\n\ninterface IMutationObserver {\n\tusers: number;\n\treadonly observer: MutationObserver;\n\treadonly onDidMutate: event.Event<MutationRecord[]>;\n}\n\nexport const sharedMutationObserver = new class {\n\n\treadonly mutationObservers = new Map<Node, Map<number, IMutationObserver>>();\n\n\tobserve(target: Node, disposables: DisposableStore, options?: MutationObserverInit): event.Event<MutationRecord[]> {\n\t\tlet mutationObserversPerTarget = this.mutationObservers.get(target);\n\t\tif (!mutationObserversPerTarget) {\n\t\t\tmutationObserversPerTarget = new Map<number, IMutationObserver>();\n\t\t\tthis.mutationObservers.set(target, mutationObserversPerTarget);\n\t\t}\n\n\t\tconst optionsHash = hash(options);\n\t\tlet mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n\t\tif (!mutationObserverPerOptions) {\n\t\t\tconst onDidMutate = new event.Emitter<MutationRecord[]>();\n\t\t\tconst observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n\t\t\tobserver.observe(target, options);\n\n\t\t\tconst resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n\t\t\t\tusers: 1,\n\t\t\t\tobserver,\n\t\t\t\tonDidMutate: onDidMutate.event\n\t\t\t};\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tresolvedMutationObserverPerOptions.users -= 1;\n\n\t\t\t\tif (resolvedMutationObserverPerOptions.users === 0) {\n\t\t\t\t\tonDidMutate.dispose();\n\t\t\t\t\tobserver.disconnect();\n\n\t\t\t\t\tmutationObserversPerTarget?.delete(optionsHash);\n\t\t\t\t\tif (mutationObserversPerTarget?.size === 0) {\n\t\t\t\t\t\tthis.mutationObservers.delete(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tmutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n\t\t} else {\n\t\t\tmutationObserverPerOptions.users += 1;\n\t\t}\n\n\t\treturn mutationObserverPerOptions.onDidMutate;\n\t}\n};\n\nexport function isHTMLElement(e: unknown): e is HTMLElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;\n}\n\nexport function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLAnchorElement || e instanceof getWindow(e as Node).HTMLAnchorElement;\n}\n\nexport function isSVGElement(e: unknown): e is SVGElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof SVGElement || e instanceof getWindow(e as Node).SVGElement;\n}\n\nexport function isMouseEvent(e: unknown): e is MouseEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;\n}\n\nexport function isKeyboardEvent(e: unknown): e is KeyboardEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof KeyboardEvent || e instanceof getWindow(e as UIEvent).KeyboardEvent;\n}\n\nexport const EventType = {\n\t// Mouse\n\tCLICK: 'click',\n\tAUXCLICK: 'auxclick',\n\tDBLCLICK: 'dblclick',\n\tMOUSE_UP: 'mouseup',\n\tMOUSE_DOWN: 'mousedown',\n\tMOUSE_OVER: 'mouseover',\n\tMOUSE_MOVE: 'mousemove',\n\tMOUSE_OUT: 'mouseout',\n\tMOUSE_ENTER: 'mouseenter',\n\tMOUSE_LEAVE: 'mouseleave',\n\tMOUSE_WHEEL: 'wheel',\n\tPOINTER_UP: 'pointerup',\n\tPOINTER_DOWN: 'pointerdown',\n\tPOINTER_MOVE: 'pointermove',\n\tPOINTER_LEAVE: 'pointerleave',\n\tCONTEXT_MENU: 'contextmenu',\n\tWHEEL: 'wheel',\n\t// Keyboard\n\tKEY_DOWN: 'keydown',\n\tKEY_PRESS: 'keypress',\n\tKEY_UP: 'keyup',\n\t// HTML Document\n\tLOAD: 'load',\n\tBEFORE_UNLOAD: 'beforeunload',\n\tUNLOAD: 'unload',\n\tPAGE_SHOW: 'pageshow',\n\tPAGE_HIDE: 'pagehide',\n\tPASTE: 'paste',\n\tABORT: 'abort',\n\tERROR: 'error',\n\tRESIZE: 'resize',\n\tSCROLL: 'scroll',\n\tFULLSCREEN_CHANGE: 'fullscreenchange',\n\tWK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n\t// Form\n\tSELECT: 'select',\n\tCHANGE: 'change',\n\tSUBMIT: 'submit',\n\tRESET: 'reset',\n\tFOCUS: 'focus',\n\tFOCUS_IN: 'focusin',\n\tFOCUS_OUT: 'focusout',\n\tBLUR: 'blur',\n\tINPUT: 'input',\n\t// Local Storage\n\tSTORAGE: 'storage',\n\t// Drag\n\tDRAG_START: 'dragstart',\n\tDRAG: 'drag',\n\tDRAG_ENTER: 'dragenter',\n\tDRAG_LEAVE: 'dragleave',\n\tDRAG_OVER: 'dragover',\n\tDROP: 'drop',\n\tDRAG_END: 'dragend',\n\t// Animation\n\tANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n\tANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n\tANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n} as const;\n\nexport interface EventLike {\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport function isEventLike(obj: unknown): obj is EventLike {\n\tconst candidate = obj as EventLike | undefined;\n\n\treturn !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\n\nexport const EventHelper = {\n\tstop: <T extends EventLike>(e: T, cancelBubble?: boolean): T => {\n\t\te.preventDefault();\n\t\tif (cancelBubble) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\treturn e;\n\t}\n};\n\nexport interface IFocusTracker extends Disposable {\n\treadonly onDidFocus: event.Event<void>;\n\treadonly onDidBlur: event.Event<void>;\n}\n\nexport function saveParentsScrollTop(node: Element): number[] {\n\tconst r: number[] = [];\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tr[i] = node.scrollTop;\n\t\tnode = <Element>node.parentNode;\n\t}\n\treturn r;\n}\n\nexport function restoreParentsScrollTop(node: Element, state: number[]): void {\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tif (node.scrollTop !== state[i]) {\n\t\t\tnode.scrollTop = state[i];\n\t\t}\n\t\tnode = <Element>node.parentNode;\n\t}\n}\n\nclass FocusTracker extends Disposable implements IFocusTracker {\n\n\tprivate readonly _onDidFocus = this._register(new event.Emitter<void>());\n\tget onDidFocus() { return this._onDidFocus.event; }\n\n\tprivate readonly _onDidBlur = this._register(new event.Emitter<void>());\n\tget onDidBlur() { return this._onDidBlur.event; }\n\n\tprivate _refreshStateHandler: () => void;\n\n\tprivate static hasFocusWithin(element: HTMLElement | Window): boolean {\n\t\tif (isHTMLElement(element)) {\n\t\t\tconst shadowRoot = getShadowRoot(element);\n\t\t\tconst activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n\t\t\treturn isAncestor(activeElement, element);\n\t\t} else {\n\t\t\tconst window = element;\n\t\t\treturn isAncestor(window.document.activeElement, window.document);\n\t\t}\n\t}\n\n\tconstructor(element: HTMLElement | Window) {\n\t\tsuper();\n\t\tlet hasFocus = FocusTracker.hasFocusWithin(element);\n\t\tlet loosingFocus = false;\n\n\t\tconst onFocus = () => {\n\t\t\tloosingFocus = false;\n\t\t\tif (!hasFocus) {\n\t\t\t\thasFocus = true;\n\t\t\t\tthis._onDidFocus.fire();\n\t\t\t}\n\t\t};\n\n\t\tconst onBlur = () => {\n\t\t\tif (hasFocus) {\n\t\t\t\tloosingFocus = true;\n\t\t\t\t(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {\n\t\t\t\t\tif (loosingFocus) {\n\t\t\t\t\t\tloosingFocus = false;\n\t\t\t\t\t\thasFocus = false;\n\t\t\t\t\t\tthis._onDidBlur.fire();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t};\n\n\t\tthis._refreshStateHandler = () => {\n\t\t\tconst currentNodeHasFocus = FocusTracker.hasFocusWithin(<HTMLElement>element);\n\t\t\tif (currentNodeHasFocus !== hasFocus) {\n\t\t\t\tif (hasFocus) {\n\t\t\t\t\tonBlur();\n\t\t\t\t} else {\n\t\t\t\t\tonFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n\t\tthis._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n\t\tif (isHTMLElement(element)) {\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n\t\t}\n\n\t}\n}\n\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element: HTMLElement | Window): IFocusTracker {\n\treturn new FocusTracker(element);\n}\n\nexport function after<T extends Node>(sibling: HTMLElement, child: T): T {\n\tsibling.after(child);\n\treturn child;\n}\n\nexport function append<T extends Node>(parent: HTMLElement, child: T): T;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): void;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): T | void {\n\tparent.append(...children);\n\tif (children.length === 1 && typeof children[0] !== 'string') {\n\t\treturn children[0];\n\t}\n}\n\nexport function prepend<T extends Node>(parent: HTMLElement, child: T): T {\n\tparent.insertBefore(child, parent.firstChild);\n\treturn child;\n}\n\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent: HTMLElement, ...children: Array<Node | string>): void {\n\tparent.textContent = '';\n\tappend(parent, ...children);\n}\n\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\n\nexport enum Namespace {\n\tHTML = 'http://www.w3.org/1999/xhtml',\n\tSVG = 'http://www.w3.org/2000/svg'\n}\n\nfunction _$<T extends Element>(namespace: Namespace, description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\tconst match = SELECTOR_REGEX.exec(description);\n\n\tif (!match) {\n\t\tthrow new Error('Bad use of emmet');\n\t}\n\n\tconst tagName = match[1] || 'div';\n\tlet result: T;\n\n\tif (namespace !== Namespace.HTML) {\n\t\tresult = document.createElementNS(namespace as string, tagName) as T;\n\t} else {\n\t\tresult = document.createElement(tagName) as unknown as T;\n\t}\n\n\tif (match[3]) {\n\t\tresult.id = match[3];\n\t}\n\tif (match[4]) {\n\t\tresult.className = match[4].replace(/\\./g, ' ').trim();\n\t}\n\n\tif (attrs) {\n\t\tObject.entries(attrs).forEach(([name, value]) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (/^on\\w+$/.test(name)) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(<any>result)[name] = value;\n\t\t\t} else if (name === 'selected') {\n\t\t\t\tif (value) {\n\t\t\t\t\tresult.setAttribute(name, 'true');\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.setAttribute(name, value);\n\t\t\t}\n\t\t});\n\t}\n\n\tresult.append(...children);\n\n\treturn result;\n}\n\nexport function $<T extends HTMLElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.HTML, description, attrs, ...children);\n}\n\n$.SVG = function <T extends SVGElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.SVG, description, attrs, ...children);\n};\n\nexport function setVisibility(visible: boolean, ...elements: HTMLElement[]): void {\n\tif (visible) {\n\t\tshow(...elements);\n\t} else {\n\t\thide(...elements);\n\t}\n}\n\nexport function show(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = '';\n\t\telement.removeAttribute('aria-hidden');\n\t}\n}\n\nexport function hide(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = 'none';\n\t\telement.setAttribute('aria-hidden', 'true');\n\t}\n}\n\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window: Window, cssPx: number): number {\n\tconst screenPx = window.devicePixelRatio * cssPx;\n\treturn Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url: string): void {\n\t// By using 'noopener' in the `windowFeatures` argument, the newly created window will\n\t// not be able to use `window.opener` to reach back to the current page.\n\t// See https://stackoverflow.com/a/46958731\n\t// See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n\t// However, this also doesn't allow us to realize if the browser blocked\n\t// the creation of the window.\n\tmainWindow.open(url, '_blank', 'noopener');\n}\n\nexport function animate(targetWindow: Window, fn: () => void): IDisposable {\n\tconst step = () => {\n\t\tfn();\n\t\tstepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\t};\n\n\tlet stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\treturn toDisposable(() => stepDisposable.dispose());\n}\n\nRemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http');\n\ntype ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';\n\nexport interface IModifierKeyStatus {\n\taltKey: boolean;\n\tshiftKey: boolean;\n\tctrlKey: boolean;\n\tmetaKey: boolean;\n\tlastKeyPressed?: ModifierKey;\n\tlastKeyReleased?: ModifierKey;\n\t/**\n\t * The keyboard event that caused the change. Only available while\n\t * listeners of {@link ModifierKeyEmitter} are notified.\n\t */\n\tevent?: KeyboardEvent;\n}\n\nexport class ModifierKeyEmitter extends event.Emitter<IModifierKeyStatus> {\n\n\t// This emitter is a lazily created singleton (see `getInstance`) that is allowed\n\t// to outlive the test that happens to create it first. `Emitter` itself is not\n\t// tracked, so the store has to be marked to keep it out of leak detection.\n\tprivate readonly _subscriptions = markAsSingleton(new DisposableStore());\n\tprivate _keyStatus: IModifierKeyStatus;\n\tprivate static instance: ModifierKeyEmitter | undefined;\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\n\t\tthis._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n\t}\n\n\tprivate registerListeners(window: Window, disposables: DisposableStore): void {\n\t\tdisposables.add(addDisposableListener(window, 'keydown', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\t// If Alt-key keydown event is repeated, ignore it #112347\n\t\t\t// Only known to be necessary for Alt-Key at the moment #115810\n\t\t\tif (event.keyCode === KeyCode.Alt && e.repeat) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (e.altKey && !this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'alt';\n\t\t\t} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'ctrl';\n\t\t\t} else if (e.metaKey && !this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'meta';\n\t\t\t} else if (e.shiftKey && !this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'shift';\n\t\t\t} else if (event.keyCode !== KeyCode.Alt) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyPressed) {\n\t\t\t\tthis.fireWithEvent(e);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'keyup', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!e.altKey && this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'alt';\n\t\t\t} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'ctrl';\n\t\t\t} else if (!e.metaKey && this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'meta';\n\t\t\t} else if (!e.shiftKey && this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'shift';\n\t\t\t} else {\n\t\t\t\tthis._keyStatus.lastKeyReleased = undefined;\n\t\t\t}\n\n\t\t\tif (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis.fireWithEvent(e);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n\t\t\tif (e.buttons) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'blur', () => {\n\t\t\tthis.resetKeyStatus();\n\t\t}));\n\t}\n\n\tget keyStatus(): IModifierKeyStatus {\n\t\treturn this._keyStatus;\n\t}\n\n\t/**\n\t * The keyboard event is only exposed while listeners are notified. Holding on to it\n\t * would retain its target and event path, e.g. the DOM of an editor that was detached\n\t * after the key press (#146841).\n\t */\n\tprivate fireWithEvent(e: KeyboardEvent): void {\n\t\tconst keyStatus = this._keyStatus;\n\t\tkeyStatus.event = e;\n\t\ttry {\n\t\t\tthis.fire(keyStatus);\n\t\t} finally {\n\t\t\tkeyStatus.event = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Allows to explicitly reset the key status based on more knowledge (#109062)\n\t */\n\tresetKeyStatus(): void {\n\t\tthis.doResetKeyStatus();\n\t\tthis.fire(this._keyStatus);\n\t}\n\n\tprivate doResetKeyStatus(): void {\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\t}\n\n\tstatic getInstance() {\n\t\tif (!ModifierKeyEmitter.instance) {\n\t\t\tModifierKeyEmitter.instance = new ModifierKeyEmitter();\n\t\t}\n\n\t\treturn ModifierKeyEmitter.instance;\n\t}\n\n\toverride dispose() {\n\t\tsuper.dispose();\n\t\tthis._subscriptions.dispose();\n\t}\n}\n\nexport interface IDragAndDropObserverCallbacks {\n\treadonly onDragEnter?: (e: DragEvent) => void;\n\treadonly onDragLeave?: (e: DragEvent) => void;\n\treadonly onDrop?: (e: DragEvent) => void;\n\treadonly onDragEnd?: (e: DragEvent) => void;\n\treadonly onDragStart?: (e: DragEvent) => void;\n\treadonly onDrag?: (e: DragEvent) => void;\n\treadonly onDragOver?: (e: DragEvent, dragDuration: number) => void;\n}\n\nexport class DragAndDropObserver extends Disposable {\n\n\t// A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n\t// calls see https://github.com/microsoft/vscode/issues/14470\n\t// when the element has child elements where the events are fired\n\t// repeadedly.\n\tprivate counter: number = 0;\n\n\t// Allows to measure the duration of the drag operation.\n\tprivate dragStartTime = 0;\n\n\tconstructor(private readonly element: HTMLElement, private readonly callbacks: IDragAndDropObserverCallbacks) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (this.callbacks.onDragStart) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_START, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDragStart?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tif (this.callbacks.onDrag) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDrag?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e: DragEvent) => {\n\t\t\tthis.counter++;\n\t\t\tthis.dragStartTime = e.timeStamp;\n\n\t\t\tthis.callbacks.onDragEnter?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => {\n\t\t\te.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n\n\t\t\tthis.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e: DragEvent) => {\n\t\t\tthis.counter--;\n\n\t\t\tif (this.counter === 0) {\n\t\t\t\tthis.dragStartTime = 0;\n\n\t\t\t\tthis.callbacks.onDragLeave?.(e);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_END, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDragEnd?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DROP, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDrop?.(e);\n\t\t}));\n\t}\n}\n\n/**\n * A wrapper around `ResizeObserver` that is disposable.\n *\n * Behavior is intentionally identical to using `new ResizeObserver(callback)`\n * directly: the user-supplied callback runs synchronously inside the\n * browser's resize-observation phase, with the entries the browser delivered.\n * The wrapper adds three things on top:\n *\n * 1. Lifetime management: `dispose()` disconnects the underlying observer.\n * 2. Auxiliary-window support: pass `targetWindow` so the observer is\n * constructed in the realm of the element being observed.\n * 3. Context for the\n * `ResizeObserver loop completed with undelivered notifications` warning:\n * each instance carries a stable `name`, and just before invoking the user\n * callback we add that name to a bounded, per-window set that is cleared\n * at the next animation frame. The warning is delivered as a stackless\n * `ErrorEvent` on `window` after callbacks run, so error telemetry can\n * include the wrapped observers that recently ran in that window (see\n * {@link getRecentDisposableResizeObserverContextForLoopError}). This is\n * delivery context, not causal attribution: the browser does not expose\n * which observer or skipped target caused the warning.\n *\n * @param name Stable identifier used in loop-warning context. Prefer one that\n * survives minification and refactors (e.g. the consumer class + purpose)\n * since callstacks change across releases.\n * @param callback Invoked synchronously when the browser delivers resize\n * notifications, with the same entries the native `ResizeObserver` would\n * have delivered.\n * @param targetWindow The window whose `ResizeObserver` constructor should\n * be used. Defaults to `mainWindow`. Pass the containing window when\n * creating an observer for elements that live in an auxiliary window.\n * @param options Optional configuration. `resizeObserverCtor` is a test\n * seam that defaults to `targetWindow.ResizeObserver`.\n */\nexport class DisposableResizeObserver extends Disposable {\n\n\tprivate readonly observer: ResizeObserver;\n\treadonly name: string;\n\n\tconstructor(\n\t\tname: string,\n\t\tcallback: ResizeObserverCallback,\n\t\ttargetWindow: CodeWindow = mainWindow,\n\t\toptions?: { resizeObserverCtor?: typeof ResizeObserver },\n\t) {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tconst ctor = options?.resizeObserverCtor ?? targetWindow.ResizeObserver;\n\t\tthis.observer = new ctor((entries: ResizeObserverEntry[], observer) => {\n\t\t\trecordDisposableResizeObserverInvocation(targetWindow, this.name);\n\t\t\ttry {\n\t\t\t\tcallback(entries, observer);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t}\n\t\t});\n\t\tthis._register(toDisposable(() => this.observer.disconnect()));\n\t}\n\n\tobserve(target: Element, options?: ResizeObserverOptions): IDisposable {\n\t\tthis.observer.observe(target, options);\n\t\treturn toDisposable(() => this.observer.unobserve(target));\n\t}\n}\n\n/**\n * Keep the context bounded so a large delivery phase cannot create an\n * unbounded telemetry value. Names are static component identifiers, and are\n * sorted when read so equivalent phases share a stable bucket.\n */\nconst maxRecentDisposableResizeObservers = 8;\n\n/**\n * Wrapped observers that ran recently in one window. This is deliberately\n * scoped by window because auxiliary windows have independent documents and\n * resize-observation delivery loops.\n */\ninterface IRecentDisposableResizeObserverContext {\n\treadonly names: Set<string>;\n\toverflow: boolean;\n}\n\nconst recentDisposableResizeObserverContexts = new WeakMap<CodeWindow, IRecentDisposableResizeObserverContext>();\n\nfunction recordDisposableResizeObserverInvocation(targetWindow: CodeWindow, name: string): void {\n\tlet context = recentDisposableResizeObserverContexts.get(targetWindow);\n\tif (!context) {\n\t\tcontext = { names: new Set(), overflow: false };\n\t\trecentDisposableResizeObserverContexts.set(targetWindow, context);\n\n\t\t// ResizeObserver callbacks and the synthetic loop error are delivered\n\t\t// after requestAnimationFrame callbacks in the rendering update. A\n\t\t// request made here therefore clears this context at the next frame,\n\t\t// after telemetry has observed any warning from the current update.\n\t\ttargetWindow.requestAnimationFrame(() => recentDisposableResizeObserverContexts.delete(targetWindow));\n\t}\n\n\tif (context.names.has(name)) {\n\t\treturn;\n\t}\n\tif (context.names.size < maxRecentDisposableResizeObservers) {\n\t\tcontext.names.add(name);\n\t} else {\n\t\tcontext.overflow = true;\n\t\tconst largestName = Array.from(context.names).sort().at(-1)!;\n\t\tif (name < largestName) {\n\t\t\tcontext.names.delete(largestName);\n\t\t\tcontext.names.add(name);\n\t\t}\n\t}\n}\n\ntype HTMLElementAttributeKeys<T> = Partial<{ [K in keyof T]: T[K] extends Function ? never : T[K] extends object ? HTMLElementAttributeKeys<T[K]> : T[K] }>;\ntype ElementAttributes<T> = HTMLElementAttributeKeys<T> & Record<string, any>;\ntype RemoveHTMLElement<T> = T extends HTMLElement ? never : T;\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\ntype ArrayToObj<T extends readonly any[]> = UnionToIntersection<RemoveHTMLElement<T[number]>>;\ntype HHTMLElementTagNameMap = HTMLElementTagNameMap & { '': HTMLDivElement };\n\ntype TagToElement<T> = T extends `${infer TStart}#${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends `${infer TStart}.${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends keyof HTMLElementTagNameMap\n\t? HTMLElementTagNameMap[T]\n\t: HTMLElement;\n\ntype TagToElementAndId<TTag> = TTag extends `${infer TTag}@${infer TId}`\n\t? { element: TagToElement<TTag>; id: TId }\n\t: { element: TagToElement<TTag>; id: 'root' };\n\ntype TagToRecord<TTag> = TagToElementAndId<TTag> extends { element: infer TElement; id: infer TId }\n\t? Record<(TId extends string ? TId : never) | 'root', TElement>\n\t: never;\n\ntype Child = HTMLElement | string | Record<string, HTMLElement>;\n\nconst H_REGEX = /(?<tag>[\\w\\-]+)?(?:#(?<id>[\\w\\-]+))?(?<class>(?:\\.(?:[\\w\\-]+))*)(?:@(?<name>(?:[\\w\\_])+))?/;\n\n/**\n * A helper function to create nested dom nodes.\n *\n *\n * ```ts\n * const elements = h('div.code-view', [\n * \th('div.title@title'),\n * \th('div.container', [\n * \t\th('div.gutter@gutterDiv'),\n * \t\th('div@editor'),\n * \t]),\n * ]);\n * const editor = createEditor(elements.editor);\n * ```\n*/\nexport function h<TTag extends string>\n\t(tag: TTag):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h(tag: string, ...args: [] | [attributes: { $: string } & Partial<ElementAttributes<HTMLElement>> | Record<string, any>, children?: any[]] | [children: any[]]): Record<string, HTMLElement> {\n\tlet attributes: { $?: string } & Partial<ElementAttributes<HTMLElement>>;\n\tlet children: (Record<string, HTMLElement> | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElement(tagName);\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record<string, HTMLElement> = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nfunction camelCaseToHyphenCase(str: string) {\n\treturn str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nexport function copyAttributes(from: Element, to: Element, filter?: string[]): void {\n\tfor (const { name, value } of from.attributes) {\n\t\tif (!filter || filter.includes(name)) {\n\t\t\tto.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nexport function isEditableElement(element: Element): boolean {\n\treturn element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea' || isHTMLElement(element) && !!element.editContext;\n}\n\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nexport class SafeTriangle {\n\t// 4 points (x, y), 8 length\n\tprivate points = new Int16Array(8);\n\n\tconstructor(\n\t\tprivate readonly originX: number,\n\t\tprivate readonly originY: number,\n\t\ttarget: HTMLElement\n\t) {\n\t\tconst { top, left, right, bottom } = target.getBoundingClientRect();\n\t\tconst t = this.points;\n\t\tlet i = 0;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\t}\n\n\tpublic contains(x: number, y: number) {\n\t\tconst { points, originX, originY } = this;\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tconst p1 = 2 * i;\n\t\t\tconst p2 = 2 * ((i + 1) % 4);\n\t\t\tif (isPointWithinTriangle(x, y, originX, originY, points[p1], points[p1 + 1], points[p2], points[p2 + 1])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\n\nexport namespace n {\n\tfunction nodeNs<TMap extends Record<string, any>>(elementNs: string | undefined = undefined): DomTagCreateFn<TMap> {\n\t\treturn (tag, attributes, children) => {\n\t\t\tconst className = attributes.class;\n\t\t\tdelete attributes.class;\n\t\t\tconst ref = attributes.ref;\n\t\t\tdelete attributes.ref;\n\t\t\tconst obsRef = attributes.obsRef;\n\t\t\tdelete attributes.obsRef;\n\n\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\treturn new ObserverNodeWithElement(tag as any, ref, obsRef, elementNs, className, attributes, children);\n\t\t};\n\t}\n\n\tfunction node<TMap extends Record<string, any>, TKey extends keyof TMap>(tag: TKey, elementNs: string | undefined = undefined): DomCreateFn<TMap[TKey], TMap[TKey]> {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst f = nodeNs(elementNs) as any;\n\t\treturn (attributes, children) => {\n\t\t\treturn f(tag, attributes, children);\n\t\t};\n\t}\n\n\texport const div: DomCreateFn<HTMLDivElement, HTMLDivElement> = node<HTMLElementTagNameMap, 'div'>('div');\n\n\texport const elem = nodeNs<HTMLElementTagNameMap>(undefined);\n\n\texport const svg: DomCreateFn<SVGElementTagNameMap2['svg'], SVGElement> = node<SVGElementTagNameMap2, 'svg'>('svg', 'http://www.w3.org/2000/svg');\n\n\texport const svgElem = nodeNs<SVGElementTagNameMap2>('http://www.w3.org/2000/svg');\n\n\texport function ref<T = HTMLOrSVGElement>(): IRefWithVal<T> {\n\t\tlet value: T | undefined = undefined;\n\t\tconst result: IRef<T> = function (val: T) {\n\t\t\tvalue = val;\n\t\t};\n\t\tObject.defineProperty(result, 'element', {\n\t\t\tget() {\n\t\t\t\tif (!value) {\n\t\t\t\t\tthrow new BugIndicatingError('Make sure the ref is set before accessing the element. Maybe wrong initialization order?');\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t});\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\treturn result as any;\n\t}\n}\ntype Value<T> = T | IObservable<T>;\ntype ValueOrList<T> = Value<T> | ValueOrList<T>[];\ntype ValueOrList2<T> = ValueOrList<T> | ValueOrList<ValueOrList<T>>;\ntype HTMLOrSVGElement = HTMLElement | SVGElement;\ntype SVGElementTagNameMap2 = {\n\tsvg: SVGElement & {\n\t\twidth: number;\n\t\theight: number;\n\t\ttransform: string;\n\t\tviewBox: string;\n\t\tfill: string;\n\t};\n\tpath: SVGElement & {\n\t\td: string;\n\t\tstroke: string;\n\t\tfill: string;\n\t};\n\tlinearGradient: SVGElement & {\n\t\tid: string;\n\t\tx1: string | number;\n\t\tx2: string | number;\n\t};\n\tstop: SVGElement & {\n\t\toffset: string;\n\t};\n\trect: SVGElement & {\n\t\tx: number;\n\t\ty: number;\n\t\twidth: number;\n\t\theight: number;\n\t\tfill: string;\n\t};\n\tdefs: SVGElement;\n};\ntype DomTagCreateFn<TMap extends Record<string, any>> = <TTag extends keyof TMap>(\n\ttag: TTag,\n\tattributes: ElementAttributeKeys<TMap[TTag]> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TMap[TTag]>; obsRef?: IRef<ObserverNodeWithElement<TMap[TTag]> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TMap[TTag]>;\ntype DomCreateFn<TAttributes, TResult extends HTMLOrSVGElement> = (\n\tattributes: ElementAttributeKeys<TAttributes> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TResult>; obsRef?: IRef<ObserverNodeWithElement<TResult> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TResult>;\n\nexport type ChildNode = ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>;\n\nexport type IRef<T> = (value: T) => void;\n\nexport interface IRefWithVal<T> extends IRef<T> {\n\treadonly element: T;\n}\n\nexport abstract class ObserverNode<T extends HTMLOrSVGElement = HTMLOrSVGElement> {\n\tprivate readonly _deriveds: (IObservable<any>)[] = [];\n\n\tprotected readonly _element: T;\n\n\tconstructor(\n\t\ttag: string,\n\t\tref: IRef<T> | undefined,\n\t\tobsRef: IRef<ObserverNodeWithElement<T> | null> | undefined,\n\t\tns: string | undefined,\n\t\tclassName: ValueOrList<string | undefined | false> | undefined,\n\t\tattributes: ElementAttributeKeys<T>,\n\t\tchildren: ChildNode\n\t) {\n\t\tthis._element = (ns ? document.createElementNS(ns, tag) : document.createElement(tag)) as unknown as T;\n\t\tif (ref) {\n\t\t\tref(this._element);\n\t\t}\n\t\tif (obsRef) {\n\t\t\tthis._deriveds.push(derived((_reader) => {\n\t\t\t\tobsRef(this as unknown as ObserverNodeWithElement<T>);\n\t\t\t\t_reader.store.add({\n\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\tobsRef(null);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}));\n\t\t}\n\n\t\tif (className) {\n\t\t\tif (hasObservable(className)) {\n\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t/** @description set.class */\n\t\t\t\t\tsetClassName(this._element, getClassName(className, reader));\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\tsetClassName(this._element, getClassName(className, undefined));\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(attributes)) {\n\t\t\tif (key === 'style') {\n\t\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\t\tconst key = camelCaseToHyphenCase(cssKey);\n\t\t\t\t\tif (isObservable(cssValue)) {\n\t\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.style.${key}` }, reader => {\n\t\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue.read(reader)));\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (key === 'tabIndex') {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t\t/** @description set.tabIndex */\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\tthis._element.tabIndex = value.read(reader) as any;\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tthis._element.tabIndex = value;\n\t\t\t\t}\n\t\t\t} else if (key.startsWith('on')) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(this._element as any)[key] = value;\n\t\t\t} else {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.${key}` }, reader => {\n\t\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value.read(reader));\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (children) {\n\t\t\tfunction getChildren(reader: IReader | undefined, children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): (HTMLOrSVGElement | string)[] {\n\t\t\t\tif (isObservable(children)) {\n\t\t\t\t\treturn getChildren(reader, children.read(reader));\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(children)) {\n\t\t\t\t\treturn children.flatMap(c => getChildren(reader, c));\n\t\t\t\t}\n\t\t\t\tif (children instanceof ObserverNode) {\n\t\t\t\t\tif (reader) {\n\t\t\t\t\t\tchildren.readEffect(reader);\n\t\t\t\t\t}\n\t\t\t\t\treturn [children._element];\n\t\t\t\t}\n\t\t\t\tif (children) {\n\t\t\t\t\treturn [children];\n\t\t\t\t}\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst d = derived(this, reader => {\n\t\t\t\t/** @description set.children */\n\t\t\t\tthis._element.replaceChildren(...getChildren(reader, children));\n\t\t\t});\n\t\t\tthis._deriveds.push(d);\n\t\t\tif (!childrenIsObservable(children)) {\n\t\t\t\td.get();\n\t\t\t}\n\t\t}\n\t}\n\n\treadEffect(reader: IReader | undefined): void {\n\t\tfor (const d of this._deriveds) {\n\t\t\td.read(reader);\n\t\t}\n\t}\n\n\tkeepUpdated(store: DisposableStore): ObserverNodeWithElement<T> {\n\t\tderived(reader => {\n\t\t\t/** update */\n\t\t\tthis.readEffect(reader);\n\t\t}).recomputeInitiallyAndOnChange(store);\n\t\treturn this as unknown as ObserverNodeWithElement<T>;\n\t}\n\n\t/**\n\t * Creates a live element that will keep the element updated as long as the returned object is not disposed.\n\t*/\n\ttoDisposableLiveElement() {\n\t\tconst store = new DisposableStore();\n\t\tthis.keepUpdated(store);\n\t\treturn new LiveElement(this._element, store);\n\t}\n\n\tprivate _isHovered: IObservable<boolean> | undefined = undefined;\n\n\tget isHovered(): IObservable<boolean> {\n\t\tif (!this._isHovered) {\n\t\t\tconst hovered = observableValue<boolean>('hovered', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => hovered.set(true, undefined));\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => hovered.set(false, undefined));\n\t\t\tthis._isHovered = hovered;\n\t\t}\n\t\treturn this._isHovered;\n\t}\n\n\tprivate _didMouseMoveDuringHover: IObservable<boolean> | undefined = undefined;\n\n\tget didMouseMoveDuringHover(): IObservable<boolean> {\n\t\tif (!this._didMouseMoveDuringHover) {\n\t\t\tlet _hovering = false;\n\t\t\tconst hovered = observableValue<boolean>('didMouseMoveDuringHover', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => {\n\t\t\t\t_hovering = true;\n\t\t\t});\n\t\t\tthis._element.addEventListener('mousemove', (_e) => {\n\t\t\t\tif (_hovering) {\n\t\t\t\t\thovered.set(true, undefined);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => {\n\t\t\t\t_hovering = false;\n\t\t\t\thovered.set(false, undefined);\n\t\t\t});\n\t\t\tthis._didMouseMoveDuringHover = hovered;\n\t\t}\n\t\treturn this._didMouseMoveDuringHover;\n\t}\n}\n\nfunction setClassName(domNode: HTMLOrSVGElement, className: string) {\n\tif (isSVGElement(domNode)) {\n\t\tdomNode.setAttribute('class', className);\n\t} else {\n\t\tdomNode.className = className;\n\t}\n}\n\nfunction resolve<T>(value: ValueOrList<T>, reader: IReader | undefined, cb: (val: T) => void): void {\n\tif (isObservable(value)) {\n\t\tcb(value.read(reader));\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const v of value) {\n\t\t\tresolve(v, reader, cb);\n\t\t}\n\t\treturn;\n\t}\n\t// eslint-disable-next-line local/code-no-any-casts\n\tcb(value as any);\n}\nfunction getClassName(className: ValueOrList<string | undefined | false> | undefined, reader: IReader | undefined): string {\n\tlet result = '';\n\tresolve(className, reader, val => {\n\t\tif (val) {\n\t\t\tif (result.length === 0) {\n\t\t\t\tresult = val;\n\t\t\t} else {\n\t\t\t\tresult += ' ' + val;\n\t\t\t}\n\t\t}\n\t});\n\treturn result;\n}\nfunction hasObservable(value: ValueOrList<unknown>): boolean {\n\tif (isObservable(value)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.some(v => hasObservable(v));\n\t}\n\treturn false;\n}\nfunction convertCssValue(value: any): string {\n\tif (typeof value === 'number') {\n\t\treturn value + 'px';\n\t}\n\treturn value;\n}\nfunction childrenIsObservable(children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): boolean {\n\tif (isObservable(children)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(children)) {\n\t\treturn children.some(c => childrenIsObservable(c));\n\t}\n\treturn false;\n}\n\nexport class LiveElement<T extends HTMLOrSVGElement = HTMLElement> {\n\tconstructor(\n\t\tpublic readonly element: T,\n\t\tprivate readonly _disposable: IDisposable\n\t) { }\n\n\tdispose() {\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class ObserverNodeWithElement<T extends HTMLOrSVGElement = HTMLOrSVGElement> extends ObserverNode<T> {\n\tpublic get element() {\n\t\treturn this._element;\n\t}\n}\nfunction setOrRemoveAttribute(element: HTMLOrSVGElement, key: string, value: unknown) {\n\tif (value === null || value === undefined) {\n\t\telement.removeAttribute(camelCaseToHyphenCase(key));\n\t} else {\n\t\telement.setAttribute(camelCaseToHyphenCase(key), String(value));\n\t}\n}\n\ntype ElementAttributeKeys<T> = Partial<{\n\t[K in keyof T]: T[K] extends Function ? never : T[K] extends object ? ElementAttributeKeys<T[K]> : Value<number | T[K] | undefined | null>;\n}>;\n\n/**\n * A custom element that fires callbacks when connected to or disconnected from the DOM.\n * Useful for tracking whether a template or component is currently mounted, especially\n * with iframes/webviews that are sensitive to movement.\n *\n * @example\n * ```ts\n * const observer = document.createElement('connection-observer') as ConnectionObserverElement;\n * observer.onDidConnect = () => console.log('mounted');\n * observer.onDidDisconnect = () => console.log('unmounted');\n * container.appendChild(observer);\n * ```\n */\nexport class ConnectionObserverElement extends HTMLElement {\n\tpublic onDidConnect?: () => void;\n\tpublic onDidDisconnect?: () => void;\n\n\tdisconnectedCallback() {\n\t\tthis.onDidDisconnect?.();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.onDidConnect?.();\n\t}\n}\n\nif (!customElements.get('connection-observer')) {\n\tcustomElements.define('connection-observer', ConnectionObserverElement);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from './browser.js';\nimport { BrowserFeatures } from './canIUse.js';\nimport { IKeyboardEvent, StandardKeyboardEvent } from './keyboardEvent.js';\nimport { IMouseEvent, StandardMouseEvent } from './mouseEvent.js';\nimport { AbstractIdleValue, IntervalTimer, _runWhenIdle, IdleDeadline } from '../common/async.js';\nimport { BugIndicatingError, onUnexpectedError } from '../common/errors.js';\nimport * as event from '../common/event.js';\nimport { KeyCode } from '../common/keyCodes.js';\nimport { Disposable, DisposableStore, IDisposable, markAsSingleton, toDisposable } from '../common/lifecycle.js';\nimport { RemoteAuthorities } from '../common/network.js';\nimport * as platform from '../common/platform.js';\nimport { hash } from '../common/hash.js';\nimport { CodeWindow, ensureCodeWindow, mainWindow } from './window.js';\nimport { isPointWithinTriangle } from '../common/numbers.js';\nimport { IObservable, derived, derivedOpts, IReader, observableValue, isObservable } from '../common/observable.js';\n\nexport interface IRegisteredCodeWindow {\n\treadonly window: CodeWindow;\n\treadonly disposables: DisposableStore;\n}\n\n//# region Multi-Window Support Utilities\n\nexport const {\n\tregisterWindow,\n\tgetWindow,\n\tgetDocument,\n\tgetWindows,\n\tgetWindowsCount,\n\tgetWindowId,\n\tgetWindowById,\n\thasWindow,\n\tonDidRegisterWindow,\n\tonWillUnregisterWindow,\n\tonDidUnregisterWindow\n} = (function () {\n\tconst windows = new Map<number, IRegisteredCodeWindow>();\n\n\tensureCodeWindow(mainWindow, 1);\n\tconst mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n\twindows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n\n\tconst onDidRegisterWindow = new event.Emitter<IRegisteredCodeWindow>();\n\tconst onDidUnregisterWindow = new event.Emitter<CodeWindow>();\n\tconst onWillUnregisterWindow = new event.Emitter<CodeWindow>();\n\n\tfunction getWindowById(windowId: number): IRegisteredCodeWindow | undefined;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain: true): IRegisteredCodeWindow;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain?: boolean): IRegisteredCodeWindow | undefined {\n\t\tconst window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n\n\t\treturn window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n\t}\n\n\treturn {\n\t\tonDidRegisterWindow: onDidRegisterWindow.event,\n\t\tonWillUnregisterWindow: onWillUnregisterWindow.event,\n\t\tonDidUnregisterWindow: onDidUnregisterWindow.event,\n\t\tregisterWindow(window: CodeWindow): IDisposable {\n\t\t\tif (windows.has(window.vscodeWindowId)) {\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tconst disposables = new DisposableStore();\n\n\t\t\tconst registeredWindow = {\n\t\t\t\twindow,\n\t\t\t\tdisposables: disposables.add(new DisposableStore())\n\t\t\t};\n\t\t\twindows.set(window.vscodeWindowId, registeredWindow);\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\twindows.delete(window.vscodeWindowId);\n\t\t\t\tonDidUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tdisposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n\t\t\t\tonWillUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tonDidRegisterWindow.fire(registeredWindow);\n\n\t\t\treturn disposables;\n\t\t},\n\t\tgetWindows(): Iterable<IRegisteredCodeWindow> {\n\t\t\treturn windows.values();\n\t\t},\n\t\tgetWindowsCount(): number {\n\t\t\treturn windows.size;\n\t\t},\n\t\tgetWindowId(targetWindow: Window): number {\n\t\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t\t},\n\t\thasWindow(windowId: number): boolean {\n\t\t\treturn windows.has(windowId);\n\t\t},\n\t\tgetWindowById,\n\t\tgetWindow(e: Node | UIEvent | undefined | null): CodeWindow {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\tif (candidateNode?.ownerDocument?.defaultView) {\n\t\t\t\treturn candidateNode.ownerDocument.defaultView.window as CodeWindow;\n\t\t\t}\n\n\t\t\tconst candidateEvent = e as UIEvent | undefined | null;\n\t\t\tif (candidateEvent?.view) {\n\t\t\t\treturn candidateEvent.view.window as CodeWindow;\n\t\t\t}\n\n\t\t\treturn mainWindow;\n\t\t},\n\t\tgetDocument(e: Node | UIEvent | undefined | null): Document {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\treturn getWindow(candidateNode).document;\n\t\t}\n\t};\n})();\n\n//#endregion\n\n//#region External Focus Tracking\n\n/**\n * Information about external focus state, including the associated window.\n */\nexport interface IExternalFocusInfo {\n\treadonly hasFocus: boolean;\n\treadonly window?: CodeWindow;\n}\n\n/**\n * A function that checks if a component outside the normal DOM tree has focus.\n * Returns focus info including which window the component is associated with.\n */\nexport type ExternalFocusChecker = () => IExternalFocusInfo;\n\n/**\n * A registry for functions that check if a component outside the normal DOM tree has focus.\n * This is used to extend the concept of \"window has focus\" to include things like\n * Electron WebContentsViews (browser views) that exist outside the workbench DOM.\n */\nconst externalFocusCheckers = new Set<ExternalFocusChecker>();\n\n/**\n * Get the window associated with a focused external component.\n * This is used to determine which window should receive UI like dialogs\n * when an external component (like a browser view) has focus.\n *\n * @returns The window of the focused external component, or undefined if none\n */\nexport function getExternalFocusWindow(): CodeWindow | undefined {\n\tfor (const checker of externalFocusCheckers) {\n\t\tconst info = checker();\n\t\tif (info.hasFocus && info.window) {\n\t\t\treturn info.window;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n//#endregion\n\nexport function clearNode(node: HTMLElement): void {\n\twhile (node.firstChild) {\n\t\tnode.firstChild.remove();\n\t}\n}\n\nclass DomListener implements IDisposable {\n\n\tprivate _handler: (e: any) => void;\n\tprivate _node: EventTarget;\n\tprivate readonly _type: string;\n\tprivate readonly _options: boolean | AddEventListenerOptions;\n\n\tconstructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {\n\t\tthis._node = node;\n\t\tthis._type = type;\n\t\tthis._handler = handler;\n\t\tthis._options = (options || false);\n\t\tthis._node.addEventListener(this._type, this._handler, this._options);\n\t}\n\n\tdispose(): void {\n\t\tif (!this._handler) {\n\t\t\t// Already disposed\n\t\t\treturn;\n\t\t}\n\n\t\tthis._node.removeEventListener(this._type, this._handler, this._options);\n\n\t\t// Prevent leakers from holding on to the dom or handler func\n\t\tthis._node = null!;\n\t\tthis._handler = null!;\n\t}\n}\n\nexport function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable {\n\treturn new DomListener(node, type, handler, useCaptureOrOptions);\n}\n\nexport interface IAddStandardDisposableListenerSignature {\n\t(node: HTMLElement | Element | Document, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerdown', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointermove', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: 'pointerup', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\n}\nfunction _wrapAsStandardMouseEvent(targetWindow: Window, handler: (e: IMouseEvent) => void): (e: MouseEvent) => void {\n\treturn function (e: MouseEvent) {\n\t\treturn handler(new StandardMouseEvent(targetWindow, e));\n\t};\n}\nfunction _wrapAsStandardKeyboardEvent(handler: (e: IKeyboardEvent) => void): (e: KeyboardEvent) => void {\n\treturn function (e: KeyboardEvent) {\n\t\treturn handler(new StandardKeyboardEvent(e));\n\t};\n}\nexport const addStandardDisposableListener: IAddStandardDisposableListenerSignature = function addStandardDisposableListener(node: HTMLElement | Element | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tlet wrapHandler = handler;\n\n\tif (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n\t\twrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\t} else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n\t\twrapHandler = _wrapAsStandardKeyboardEvent(handler);\n\t}\n\n\treturn addDisposableListener(node, type, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseMoveListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseUpListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\n}\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nexport function runWhenWindowIdle(targetWindow: Window | typeof globalThis, callback: (idle: IdleDeadline) => void, timeout?: number): IDisposable {\n\treturn _runWhenIdle(targetWindow, callback, timeout);\n}\n\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue<T> extends AbstractIdleValue<T> {\n\tconstructor(targetWindow: Window | typeof globalThis, executor: () => T) {\n\t\tsuper(targetWindow, executor);\n\t}\n}\n\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n\nexport class WindowIntervalTimer extends IntervalTimer {\n\n\tprivate readonly defaultTarget?: Window & typeof globalThis;\n\n\t/**\n\t *\n\t * @param node The optional node from which the target window is determined\n\t */\n\tconstructor(node?: Node) {\n\t\tsuper();\n\t\tthis.defaultTarget = node && getWindow(node);\n\t}\n\n\toverride cancelAndSet(runner: () => void, interval: number, targetWindow?: Window & typeof globalThis): void {\n\t\treturn super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n\t}\n}\n\nclass AnimationFrameQueueItem implements IDisposable {\n\n\tprivate _runner: () => void;\n\tpublic priority: number;\n\tprivate _canceled: boolean;\n\n\tconstructor(runner: () => void, priority: number = 0) {\n\t\tthis._runner = runner;\n\t\tthis.priority = priority;\n\t\tthis._canceled = false;\n\t}\n\n\tdispose(): void {\n\t\tthis._canceled = true;\n\t}\n\n\texecute(): void {\n\t\tif (this._canceled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis._runner();\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t}\n\n\t// Sort by priority (largest to lowest)\n\tstatic sort(a: AnimationFrameQueueItem, b: AnimationFrameQueueItem): number {\n\t\treturn b.priority - a.priority;\n\t}\n}\n\n(function () {\n\t/**\n\t * The runners scheduled at the next animation frame\n\t */\n\tconst NEXT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * The runners scheduled at the current animation frame\n\t */\n\tconst CURRENT_QUEUE = new Map<number /* window ID */, AnimationFrameQueueItem[]>();\n\t/**\n\t * A flag to keep track if the native requestAnimationFrame was already called\n\t */\n\tconst animFrameRequested = new Map<number /* window ID */, boolean>();\n\t/**\n\t * A flag to indicate if currently handling a native requestAnimationFrame callback\n\t */\n\tconst inAnimationFrameRunner = new Map<number /* window ID */, boolean>();\n\n\tmarkAsSingleton(onDidUnregisterWindow(({ vscodeWindowId }) => {\n\t\t// A callback can close its window while the current queue is being processed.\n\t\tconst currentQueue = CURRENT_QUEUE.get(vscodeWindowId);\n\t\tif (currentQueue) {\n\t\t\tcurrentQueue.length = 0;\n\t\t}\n\t\tNEXT_QUEUE.delete(vscodeWindowId);\n\t\tCURRENT_QUEUE.delete(vscodeWindowId);\n\t\tanimFrameRequested.delete(vscodeWindowId);\n\t\tinAnimationFrameRunner.delete(vscodeWindowId);\n\t}));\n\n\tconst animationFrameRunner = (targetWindowId: number) => {\n\t\tif (!animFrameRequested.has(targetWindowId)) {\n\t\t\treturn;\n\t\t}\n\t\tanimFrameRequested.set(targetWindowId, false);\n\n\t\tconst currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\tNEXT_QUEUE.set(targetWindowId, []);\n\n\t\tinAnimationFrameRunner.set(targetWindowId, true);\n\t\twhile (currentQueue.length > 0) {\n\t\t\tcurrentQueue.sort(AnimationFrameQueueItem.sort);\n\t\t\tconst top = currentQueue.shift()!;\n\t\t\ttop.execute();\n\t\t}\n\t\tif (inAnimationFrameRunner.has(targetWindowId)) {\n\t\t\tinAnimationFrameRunner.set(targetWindowId, false);\n\t\t}\n\t};\n\n\tscheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority: number = 0) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\n\t\tlet nextQueue = NEXT_QUEUE.get(targetWindowId);\n\t\tif (!nextQueue) {\n\t\t\tnextQueue = [];\n\t\t\tNEXT_QUEUE.set(targetWindowId, nextQueue);\n\t\t}\n\t\tnextQueue.push(item);\n\n\t\tif (!animFrameRequested.get(targetWindowId)) {\n\t\t\tanimFrameRequested.set(targetWindowId, true);\n\t\t\ttargetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n\t\t}\n\n\t\treturn item;\n\t};\n\n\trunAtThisOrScheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority?: number) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tif (inAnimationFrameRunner.get(targetWindowId)) {\n\t\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\t\t\tlet currentQueue = CURRENT_QUEUE.get(targetWindowId);\n\t\t\tif (!currentQueue) {\n\t\t\t\tcurrentQueue = [];\n\t\t\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\t\t}\n\t\t\tcurrentQueue.push(item);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n\t\t}\n\t};\n})();\n\nexport function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {\n\treturn getWindow(el).getComputedStyle(el, null);\n}\n\nexport function getClientArea(element: HTMLElement, defaultValue?: Dimension, fallbackElement?: HTMLElement): Dimension {\n\tconst elWindow = getWindow(element);\n\tconst elDocument = elWindow.document;\n\n\t// Try with DOM clientWidth / clientHeight\n\tif (element !== elDocument.body) {\n\t\treturn new Dimension(element.clientWidth, element.clientHeight);\n\t}\n\n\t// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n\tif (platform.isIOS && elWindow?.visualViewport) {\n\t\treturn new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n\t}\n\n\t// Try innerWidth / innerHeight\n\tif (elWindow?.innerWidth && elWindow.innerHeight) {\n\t\treturn new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n\t}\n\n\t// Try with document.body.clientWidth / document.body.clientHeight\n\tif (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n\t\treturn new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n\t}\n\n\t// Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n\tif (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n\t\treturn new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n\t}\n\n\tif (fallbackElement) {\n\t\treturn getClientArea(fallbackElement, defaultValue);\n\t}\n\n\tif (defaultValue) {\n\t\treturn defaultValue;\n\t}\n\n\tthrow new Error('Unable to figure out browser width and height');\n}\n\nclass SizeUtils {\n\t// Adapted from WinJS\n\t// Converts a CSS positioning string for the specified element to pixels.\n\tprivate static convertToPixels(element: HTMLElement, value: string): number {\n\t\treturn parseFloat(value) || 0;\n\t}\n\n\tprivate static getDimension(element: HTMLElement, cssPropertyName: string): number {\n\t\tconst computedStyle = getComputedStyle(element);\n\t\tconst value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n\t\treturn SizeUtils.convertToPixels(element, value);\n\t}\n\n\tstatic getBorderLeftWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-left-width');\n\t}\n\tstatic getBorderRightWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-right-width');\n\t}\n\tstatic getBorderTopWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-top-width');\n\t}\n\tstatic getBorderBottomWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-bottom-width');\n\t}\n\n\tstatic getPaddingLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-left');\n\t}\n\tstatic getPaddingRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-right');\n\t}\n\tstatic getPaddingTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-top');\n\t}\n\tstatic getPaddingBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-bottom');\n\t}\n\n\tstatic getMarginLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-left');\n\t}\n\tstatic getMarginTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-top');\n\t}\n\tstatic getMarginRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-right');\n\t}\n\tstatic getMarginBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-bottom');\n\t}\n}\n\n// ----------------------------------------------------------------------------------------\n// Position & Dimension\n\nexport interface IDimension {\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport class Dimension implements IDimension {\n\n\tstatic readonly None = new Dimension(0, 0);\n\n\tconstructor(\n\t\treadonly width: number,\n\t\treadonly height: number,\n\t) { }\n\n\twith(width: number = this.width, height: number = this.height): Dimension {\n\t\tif (width !== this.width || height !== this.height) {\n\t\t\treturn new Dimension(width, height);\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tstatic is(obj: unknown): obj is IDimension {\n\t\treturn typeof obj === 'object' && typeof (<IDimension>obj).height === 'number' && typeof (<IDimension>obj).width === 'number';\n\t}\n\n\tstatic lift(obj: IDimension): Dimension {\n\t\tif (obj instanceof Dimension) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\treturn new Dimension(obj.width, obj.height);\n\t\t}\n\t}\n\n\tstatic equals(a: Dimension | undefined, b: Dimension | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.width === b.width && a.height === b.height;\n\t}\n}\n\nexport interface IDomPosition {\n\treadonly left: number;\n\treadonly top: number;\n}\n\nexport function getTopLeftOffset(element: HTMLElement): IDomPosition {\n\t// Adapted from WinJS.Utilities.getPosition\n\t// and added borders to the mix\n\n\tlet offsetParent = element.offsetParent;\n\tlet top = element.offsetTop;\n\tlet left = element.offsetLeft;\n\n\twhile (\n\t\t(element = <HTMLElement>element.parentNode) !== null\n\t\t&& element !== element.ownerDocument.body\n\t\t&& element !== element.ownerDocument.documentElement\n\t) {\n\t\ttop -= element.scrollTop;\n\t\tconst c = isShadowRoot(element) ? null : getComputedStyle(element);\n\t\tif (c) {\n\t\t\tleft -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n\t\t}\n\n\t\tif (element === offsetParent) {\n\t\t\tleft += SizeUtils.getBorderLeftWidth(element);\n\t\t\ttop += SizeUtils.getBorderTopWidth(element);\n\t\t\ttop += element.offsetTop;\n\t\t\tleft += element.offsetLeft;\n\t\t\toffsetParent = element.offsetParent;\n\t\t}\n\t}\n\n\treturn {\n\t\tleft: left,\n\t\ttop: top\n\t};\n}\n\nexport interface IDomNodePagePosition {\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n}\n\nexport function size(element: HTMLElement, width: number | null, height: number | null): void {\n\tif (typeof width === 'number') {\n\t\telement.style.width = `${width}px`;\n\t}\n\n\tif (typeof height === 'number') {\n\t\telement.style.height = `${height}px`;\n\t}\n}\n\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition {\n\tconst bb = domNode.getBoundingClientRect();\n\tconst window = getWindow(domNode);\n\treturn {\n\t\tleft: bb.left + window.scrollX,\n\t\ttop: bb.top + window.scrollY,\n\t\twidth: bb.width,\n\t\theight: bb.height\n\t};\n}\n\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode: HTMLElement): number {\n\tlet testElement: HTMLElement | null = domNode;\n\tlet zoom = 1.0;\n\tdo {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst elementZoomLevel = (getComputedStyle(testElement) as any).zoom;\n\t\tif (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n\t\t\tzoom *= elementZoomLevel;\n\t\t}\n\n\t\ttestElement = testElement.parentElement;\n\t} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n\n\treturn zoom;\n}\n\n\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.offsetWidth + margin;\n}\n\nexport function getContentWidth(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n\tconst padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n\treturn element.offsetWidth - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n\tconst padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n\treturn element.offsetHeight - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n\treturn element.offsetHeight + margin;\n}\n\n// ----------------------------------------------------------------------------------------\n\nexport function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean {\n\treturn Boolean(testAncestor?.contains(testChild));\n}\n\nexport function findParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (typeof clazz === 'string' ? node.classList.contains(clazz) : clazz.every(candidate => node.classList.contains(candidate))) {\n\t\t\treturn node;\n\t\t}\n\n\t\tif (stopAtClazzOrNode) {\n\t\t\tif (typeof stopAtClazzOrNode === 'string') {\n\t\t\t\tif (node.classList.contains(stopAtClazzOrNode)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (node === stopAtClazzOrNode) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnode = <HTMLElement>node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function hasParentWithClass(node: HTMLElement, clazz: string | readonly string[], stopAtClazzOrNode?: string | HTMLElement): boolean {\n\treturn !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\n\nexport function isShadowRoot(node: Node): node is ShadowRoot {\n\treturn (\n\t\tnode && !!(<ShadowRoot>node).host && !!(<ShadowRoot>node).mode\n\t);\n}\n\nexport function isInShadowDOM(domNode: Node): boolean {\n\treturn !!getShadowRoot(domNode);\n}\n\nexport function getShadowRoot(domNode: Node): ShadowRoot | null {\n\twhile (domNode.parentNode) {\n\t\tif (domNode === domNode.ownerDocument?.body) {\n\t\t\t// reached the body\n\t\t\treturn null;\n\t\t}\n\t\tdomNode = domNode.parentNode;\n\t}\n\treturn isShadowRoot(domNode) ? domNode : null;\n}\n\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement(): Element | null {\n\tlet result = getActiveDocument().activeElement;\n\n\twhile (result?.shadowRoot) {\n\t\tresult = result.shadowRoot.activeElement;\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element: Element): boolean {\n\treturn getActiveElement() === element;\n}\n\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor: Element): boolean {\n\treturn isAncestor(getActiveElement(), ancestor);\n}\n\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus (including external components like browser views),\n * otherwise falls back to the main windows document.\n */\nexport function getActiveDocument(): Document {\n\tif (getWindowsCount() <= 1) {\n\t\treturn mainWindow.document;\n\t}\n\n\tconst documents = Array.from(getWindows()).map(({ window }) => window.document);\n\tconst focusedDoc = documents.find(doc => doc.hasFocus());\n\tif (focusedDoc) {\n\t\treturn focusedDoc;\n\t}\n\n\t// Check if an external component (like browser view) has focus\n\tconst externalWindow = getExternalFocusWindow();\n\tif (externalWindow) {\n\t\treturn externalWindow.document;\n\t}\n\n\treturn mainWindow.document;\n}\n\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow(): CodeWindow {\n\tconst document = getActiveDocument();\n\treturn (document.defaultView?.window ?? mainWindow) as CodeWindow;\n}\n\ninterface IMutationObserver {\n\tusers: number;\n\treadonly observer: MutationObserver;\n\treadonly onDidMutate: event.Event<MutationRecord[]>;\n}\n\nexport const sharedMutationObserver = new class {\n\n\treadonly mutationObservers = new Map<Node, Map<number, IMutationObserver>>();\n\n\tobserve(target: Node, disposables: DisposableStore, options?: MutationObserverInit): event.Event<MutationRecord[]> {\n\t\tlet mutationObserversPerTarget = this.mutationObservers.get(target);\n\t\tif (!mutationObserversPerTarget) {\n\t\t\tmutationObserversPerTarget = new Map<number, IMutationObserver>();\n\t\t\tthis.mutationObservers.set(target, mutationObserversPerTarget);\n\t\t}\n\n\t\tconst optionsHash = hash(options);\n\t\tlet mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n\t\tif (!mutationObserverPerOptions) {\n\t\t\tconst onDidMutate = new event.Emitter<MutationRecord[]>();\n\t\t\tconst observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n\t\t\tobserver.observe(target, options);\n\n\t\t\tconst resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n\t\t\t\tusers: 1,\n\t\t\t\tobserver,\n\t\t\t\tonDidMutate: onDidMutate.event\n\t\t\t};\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tresolvedMutationObserverPerOptions.users -= 1;\n\n\t\t\t\tif (resolvedMutationObserverPerOptions.users === 0) {\n\t\t\t\t\tonDidMutate.dispose();\n\t\t\t\t\tobserver.disconnect();\n\n\t\t\t\t\tmutationObserversPerTarget?.delete(optionsHash);\n\t\t\t\t\tif (mutationObserversPerTarget?.size === 0) {\n\t\t\t\t\t\tthis.mutationObservers.delete(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tmutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n\t\t} else {\n\t\t\tmutationObserverPerOptions.users += 1;\n\t\t}\n\n\t\treturn mutationObserverPerOptions.onDidMutate;\n\t}\n};\n\nexport function isHTMLElement(e: unknown): e is HTMLElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;\n}\n\nexport function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLAnchorElement || e instanceof getWindow(e as Node).HTMLAnchorElement;\n}\n\nexport function isSVGElement(e: unknown): e is SVGElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof SVGElement || e instanceof getWindow(e as Node).SVGElement;\n}\n\nexport function isMouseEvent(e: unknown): e is MouseEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;\n}\n\nexport function isKeyboardEvent(e: unknown): e is KeyboardEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof KeyboardEvent || e instanceof getWindow(e as UIEvent).KeyboardEvent;\n}\n\nexport const EventType = {\n\t// Mouse\n\tCLICK: 'click',\n\tAUXCLICK: 'auxclick',\n\tDBLCLICK: 'dblclick',\n\tMOUSE_UP: 'mouseup',\n\tMOUSE_DOWN: 'mousedown',\n\tMOUSE_OVER: 'mouseover',\n\tMOUSE_MOVE: 'mousemove',\n\tMOUSE_OUT: 'mouseout',\n\tMOUSE_ENTER: 'mouseenter',\n\tMOUSE_LEAVE: 'mouseleave',\n\tMOUSE_WHEEL: 'wheel',\n\tPOINTER_UP: 'pointerup',\n\tPOINTER_DOWN: 'pointerdown',\n\tPOINTER_MOVE: 'pointermove',\n\tPOINTER_LEAVE: 'pointerleave',\n\tCONTEXT_MENU: 'contextmenu',\n\tWHEEL: 'wheel',\n\t// Keyboard\n\tKEY_DOWN: 'keydown',\n\tKEY_PRESS: 'keypress',\n\tKEY_UP: 'keyup',\n\t// HTML Document\n\tLOAD: 'load',\n\tBEFORE_UNLOAD: 'beforeunload',\n\tUNLOAD: 'unload',\n\tPAGE_SHOW: 'pageshow',\n\tPAGE_HIDE: 'pagehide',\n\tPASTE: 'paste',\n\tABORT: 'abort',\n\tERROR: 'error',\n\tRESIZE: 'resize',\n\tSCROLL: 'scroll',\n\tFULLSCREEN_CHANGE: 'fullscreenchange',\n\tWK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n\t// Form\n\tSELECT: 'select',\n\tCHANGE: 'change',\n\tSUBMIT: 'submit',\n\tRESET: 'reset',\n\tFOCUS: 'focus',\n\tFOCUS_IN: 'focusin',\n\tFOCUS_OUT: 'focusout',\n\tBLUR: 'blur',\n\tINPUT: 'input',\n\t// Local Storage\n\tSTORAGE: 'storage',\n\t// Drag\n\tDRAG_START: 'dragstart',\n\tDRAG: 'drag',\n\tDRAG_ENTER: 'dragenter',\n\tDRAG_LEAVE: 'dragleave',\n\tDRAG_OVER: 'dragover',\n\tDROP: 'drop',\n\tDRAG_END: 'dragend',\n\t// Animation\n\tANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n\tANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n\tANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n} as const;\n\nexport interface EventLike {\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport function isEventLike(obj: unknown): obj is EventLike {\n\tconst candidate = obj as EventLike | undefined;\n\n\treturn !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\n\nexport const EventHelper = {\n\tstop: <T extends EventLike>(e: T, cancelBubble?: boolean): T => {\n\t\te.preventDefault();\n\t\tif (cancelBubble) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\treturn e;\n\t}\n};\n\nexport interface IFocusTracker extends Disposable {\n\treadonly onDidFocus: event.Event<void>;\n\treadonly onDidBlur: event.Event<void>;\n}\n\nexport function saveParentsScrollTop(node: Element): number[] {\n\tconst r: number[] = [];\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tr[i] = node.scrollTop;\n\t\tnode = <Element>node.parentNode;\n\t}\n\treturn r;\n}\n\nexport function restoreParentsScrollTop(node: Element, state: number[]): void {\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tif (node.scrollTop !== state[i]) {\n\t\t\tnode.scrollTop = state[i];\n\t\t}\n\t\tnode = <Element>node.parentNode;\n\t}\n}\n\nclass FocusTracker extends Disposable implements IFocusTracker {\n\n\tprivate readonly _onDidFocus = this._register(new event.Emitter<void>());\n\tget onDidFocus() { return this._onDidFocus.event; }\n\n\tprivate readonly _onDidBlur = this._register(new event.Emitter<void>());\n\tget onDidBlur() { return this._onDidBlur.event; }\n\n\tprivate _refreshStateHandler: () => void;\n\n\tprivate static hasFocusWithin(element: HTMLElement | Window): boolean {\n\t\tif (isHTMLElement(element)) {\n\t\t\tconst shadowRoot = getShadowRoot(element);\n\t\t\tconst activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n\t\t\treturn isAncestor(activeElement, element);\n\t\t} else {\n\t\t\tconst window = element;\n\t\t\treturn isAncestor(window.document.activeElement, window.document);\n\t\t}\n\t}\n\n\tconstructor(element: HTMLElement | Window) {\n\t\tsuper();\n\t\tlet hasFocus = FocusTracker.hasFocusWithin(element);\n\t\tlet loosingFocus = false;\n\n\t\tconst onFocus = () => {\n\t\t\tloosingFocus = false;\n\t\t\tif (!hasFocus) {\n\t\t\t\thasFocus = true;\n\t\t\t\tthis._onDidFocus.fire();\n\t\t\t}\n\t\t};\n\n\t\tconst onBlur = () => {\n\t\t\tif (hasFocus) {\n\t\t\t\tloosingFocus = true;\n\t\t\t\t(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {\n\t\t\t\t\tif (loosingFocus) {\n\t\t\t\t\t\tloosingFocus = false;\n\t\t\t\t\t\thasFocus = false;\n\t\t\t\t\t\tthis._onDidBlur.fire();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t};\n\n\t\tthis._refreshStateHandler = () => {\n\t\t\tconst currentNodeHasFocus = FocusTracker.hasFocusWithin(<HTMLElement>element);\n\t\t\tif (currentNodeHasFocus !== hasFocus) {\n\t\t\t\tif (hasFocus) {\n\t\t\t\t\tonBlur();\n\t\t\t\t} else {\n\t\t\t\t\tonFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n\t\tthis._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n\t\tif (isHTMLElement(element)) {\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n\t\t}\n\n\t}\n}\n\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element: HTMLElement | Window): IFocusTracker {\n\treturn new FocusTracker(element);\n}\n\nexport function after<T extends Node>(sibling: HTMLElement, child: T): T {\n\tsibling.after(child);\n\treturn child;\n}\n\nexport function append<T extends Node>(parent: HTMLElement, child: T): T;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): void;\nexport function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): T | void {\n\tparent.append(...children);\n\tif (children.length === 1 && typeof children[0] !== 'string') {\n\t\treturn children[0];\n\t}\n}\n\nexport function prepend<T extends Node>(parent: HTMLElement, child: T): T {\n\tparent.insertBefore(child, parent.firstChild);\n\treturn child;\n}\n\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent: HTMLElement, ...children: Array<Node | string>): void {\n\tparent.textContent = '';\n\tappend(parent, ...children);\n}\n\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\n\nexport enum Namespace {\n\tHTML = 'http://www.w3.org/1999/xhtml',\n\tSVG = 'http://www.w3.org/2000/svg'\n}\n\nfunction _$<T extends Element>(namespace: Namespace, description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\tconst match = SELECTOR_REGEX.exec(description);\n\n\tif (!match) {\n\t\tthrow new Error('Bad use of emmet');\n\t}\n\n\tconst tagName = match[1] || 'div';\n\tlet result: T;\n\n\tif (namespace !== Namespace.HTML) {\n\t\tresult = document.createElementNS(namespace as string, tagName) as T;\n\t} else {\n\t\tresult = document.createElement(tagName) as unknown as T;\n\t}\n\n\tif (match[3]) {\n\t\tresult.id = match[3];\n\t}\n\tif (match[4]) {\n\t\tresult.className = match[4].replace(/\\./g, ' ').trim();\n\t}\n\n\tif (attrs) {\n\t\tObject.entries(attrs).forEach(([name, value]) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (/^on\\w+$/.test(name)) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(<any>result)[name] = value;\n\t\t\t} else if (name === 'selected') {\n\t\t\t\tif (value) {\n\t\t\t\t\tresult.setAttribute(name, 'true');\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.setAttribute(name, value);\n\t\t\t}\n\t\t});\n\t}\n\n\tresult.append(...children);\n\n\treturn result;\n}\n\nexport function $<T extends HTMLElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.HTML, description, attrs, ...children);\n}\n\n$.SVG = function <T extends SVGElement>(description: string, attrs?: { [key: string]: any }, ...children: Array<Node | string>): T {\n\treturn _$(Namespace.SVG, description, attrs, ...children);\n};\n\nexport function setVisibility(visible: boolean, ...elements: HTMLElement[]): void {\n\tif (visible) {\n\t\tshow(...elements);\n\t} else {\n\t\thide(...elements);\n\t}\n}\n\nexport function show(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = '';\n\t\telement.removeAttribute('aria-hidden');\n\t}\n}\n\nexport function hide(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = 'none';\n\t\telement.setAttribute('aria-hidden', 'true');\n\t}\n}\n\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window: Window, cssPx: number): number {\n\tconst screenPx = window.devicePixelRatio * cssPx;\n\treturn Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url: string): void {\n\t// By using 'noopener' in the `windowFeatures` argument, the newly created window will\n\t// not be able to use `window.opener` to reach back to the current page.\n\t// See https://stackoverflow.com/a/46958731\n\t// See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n\t// However, this also doesn't allow us to realize if the browser blocked\n\t// the creation of the window.\n\tmainWindow.open(url, '_blank', 'noopener');\n}\n\nexport function animate(targetWindow: Window, fn: () => void): IDisposable {\n\tconst step = () => {\n\t\tfn();\n\t\tstepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\t};\n\n\tlet stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\treturn toDisposable(() => stepDisposable.dispose());\n}\n\nRemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http');\n\ntype ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';\n\nexport interface IModifierKeyStatus {\n\taltKey: boolean;\n\tshiftKey: boolean;\n\tctrlKey: boolean;\n\tmetaKey: boolean;\n\tlastKeyPressed?: ModifierKey;\n\tlastKeyReleased?: ModifierKey;\n\t/**\n\t * The keyboard event that caused the change. Only available while\n\t * listeners of {@link ModifierKeyEmitter} are notified.\n\t */\n\tevent?: KeyboardEvent;\n}\n\nexport class ModifierKeyEmitter extends event.Emitter<IModifierKeyStatus> {\n\n\t// This emitter is a lazily created singleton (see `getInstance`) that is allowed\n\t// to outlive the test that happens to create it first. `Emitter` itself is not\n\t// tracked, so the store has to be marked to keep it out of leak detection.\n\tprivate readonly _subscriptions = markAsSingleton(new DisposableStore());\n\tprivate _keyStatus: IModifierKeyStatus;\n\tprivate static instance: ModifierKeyEmitter | undefined;\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\n\t\tthis._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n\t}\n\n\tprivate registerListeners(window: Window, disposables: DisposableStore): void {\n\t\tdisposables.add(addDisposableListener(window, 'keydown', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\t// If Alt-key keydown event is repeated, ignore it #112347\n\t\t\t// Only known to be necessary for Alt-Key at the moment #115810\n\t\t\tif (event.keyCode === KeyCode.Alt && e.repeat) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (e.altKey && !this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'alt';\n\t\t\t} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'ctrl';\n\t\t\t} else if (e.metaKey && !this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'meta';\n\t\t\t} else if (e.shiftKey && !this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'shift';\n\t\t\t} else if (event.keyCode !== KeyCode.Alt) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyPressed) {\n\t\t\t\tthis.fireWithEvent(e);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'keyup', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!e.altKey && this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'alt';\n\t\t\t} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'ctrl';\n\t\t\t} else if (!e.metaKey && this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'meta';\n\t\t\t} else if (!e.shiftKey && this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'shift';\n\t\t\t} else {\n\t\t\t\tthis._keyStatus.lastKeyReleased = undefined;\n\t\t\t}\n\n\t\t\tif (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis.fireWithEvent(e);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n\t\t\tif (e.buttons) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'blur', () => {\n\t\t\tthis.resetKeyStatus();\n\t\t}));\n\t}\n\n\tget keyStatus(): IModifierKeyStatus {\n\t\treturn this._keyStatus;\n\t}\n\n\t/**\n\t * The keyboard event is only exposed while listeners are notified. Holding on to it\n\t * would retain its target and event path, e.g. the DOM of an editor that was detached\n\t * after the key press (#146841).\n\t */\n\tprivate fireWithEvent(e: KeyboardEvent): void {\n\t\tconst keyStatus = this._keyStatus;\n\t\tkeyStatus.event = e;\n\t\ttry {\n\t\t\tthis.fire(keyStatus);\n\t\t} finally {\n\t\t\tkeyStatus.event = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Allows to explicitly reset the key status based on more knowledge (#109062)\n\t */\n\tresetKeyStatus(): void {\n\t\tthis.doResetKeyStatus();\n\t\tthis.fire(this._keyStatus);\n\t}\n\n\tprivate doResetKeyStatus(): void {\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\t}\n\n\tstatic getInstance() {\n\t\tif (!ModifierKeyEmitter.instance) {\n\t\t\tModifierKeyEmitter.instance = new ModifierKeyEmitter();\n\t\t}\n\n\t\treturn ModifierKeyEmitter.instance;\n\t}\n\n\toverride dispose() {\n\t\tsuper.dispose();\n\t\tthis._subscriptions.dispose();\n\t}\n}\n\nexport interface IDragAndDropObserverCallbacks {\n\treadonly onDragEnter?: (e: DragEvent) => void;\n\treadonly onDragLeave?: (e: DragEvent) => void;\n\treadonly onDrop?: (e: DragEvent) => void;\n\treadonly onDragEnd?: (e: DragEvent) => void;\n\treadonly onDragStart?: (e: DragEvent) => void;\n\treadonly onDrag?: (e: DragEvent) => void;\n\treadonly onDragOver?: (e: DragEvent, dragDuration: number) => void;\n}\n\nexport class DragAndDropObserver extends Disposable {\n\n\t// A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n\t// calls see https://github.com/microsoft/vscode/issues/14470\n\t// when the element has child elements where the events are fired\n\t// repeadedly.\n\tprivate counter: number = 0;\n\n\t// Allows to measure the duration of the drag operation.\n\tprivate dragStartTime = 0;\n\n\tconstructor(private readonly element: HTMLElement, private readonly callbacks: IDragAndDropObserverCallbacks) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (this.callbacks.onDragStart) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_START, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDragStart?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tif (this.callbacks.onDrag) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDrag?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e: DragEvent) => {\n\t\t\tthis.counter++;\n\t\t\tthis.dragStartTime = e.timeStamp;\n\n\t\t\tthis.callbacks.onDragEnter?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => {\n\t\t\te.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n\n\t\t\tthis.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e: DragEvent) => {\n\t\t\tthis.counter--;\n\n\t\t\tif (this.counter === 0) {\n\t\t\t\tthis.dragStartTime = 0;\n\n\t\t\t\tthis.callbacks.onDragLeave?.(e);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_END, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDragEnd?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DROP, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDrop?.(e);\n\t\t}));\n\t}\n}\n\n/**\n * A wrapper around `ResizeObserver` that is disposable.\n *\n * Behavior is intentionally identical to using `new ResizeObserver(callback)`\n * directly: the user-supplied callback runs synchronously inside the\n * browser's resize-observation phase, with the entries the browser delivered.\n * The wrapper adds three things on top:\n *\n * 1. Lifetime management: `dispose()` disconnects the underlying observer.\n * 2. Auxiliary-window support: pass `targetWindow` so the observer is\n * constructed in the realm of the element being observed.\n * 3. Context for the\n * `ResizeObserver loop completed with undelivered notifications` warning:\n * each instance carries a stable `name`, and just before invoking the user\n * callback we add that name to a bounded, per-window set that is cleared\n * at the next animation frame. The warning is delivered as a stackless\n * `ErrorEvent` on `window` after callbacks run, so error telemetry can\n * include the wrapped observers that recently ran in that window (see\n * {@link getRecentDisposableResizeObserverContextForLoopError}). This is\n * delivery context, not causal attribution: the browser does not expose\n * which observer or skipped target caused the warning.\n *\n * @param name Stable identifier used in loop-warning context. Prefer one that\n * survives minification and refactors (e.g. the consumer class + purpose)\n * since callstacks change across releases.\n * @param callback Invoked synchronously when the browser delivers resize\n * notifications, with the same entries the native `ResizeObserver` would\n * have delivered.\n * @param targetWindow The window whose `ResizeObserver` constructor should\n * be used. Defaults to `mainWindow`. Pass the containing window when\n * creating an observer for elements that live in an auxiliary window.\n * @param options Optional configuration. `resizeObserverCtor` is a test\n * seam that defaults to `targetWindow.ResizeObserver`.\n */\nexport class DisposableResizeObserver extends Disposable {\n\n\tprivate readonly observer: ResizeObserver;\n\treadonly name: string;\n\n\tconstructor(\n\t\tname: string,\n\t\tcallback: ResizeObserverCallback,\n\t\ttargetWindow: CodeWindow = mainWindow,\n\t\toptions?: { resizeObserverCtor?: typeof ResizeObserver },\n\t) {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tconst ctor = options?.resizeObserverCtor ?? targetWindow.ResizeObserver;\n\t\tthis.observer = new ctor((entries: ResizeObserverEntry[], observer) => {\n\t\t\trecordDisposableResizeObserverInvocation(targetWindow, this.name);\n\t\t\ttry {\n\t\t\t\tcallback(entries, observer);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t}\n\t\t});\n\t\tthis._register(toDisposable(() => this.observer.disconnect()));\n\t}\n\n\tobserve(target: Element, options?: ResizeObserverOptions): IDisposable {\n\t\tthis.observer.observe(target, options);\n\t\treturn toDisposable(() => this.observer.unobserve(target));\n\t}\n}\n\n/**\n * Keep the context bounded so a large delivery phase cannot create an\n * unbounded telemetry value. Names are static component identifiers, and are\n * sorted when read so equivalent phases share a stable bucket.\n */\nconst maxRecentDisposableResizeObservers = 8;\n\n/**\n * Wrapped observers that ran recently in one window. This is deliberately\n * scoped by window because auxiliary windows have independent documents and\n * resize-observation delivery loops.\n */\ninterface IRecentDisposableResizeObserverContext {\n\treadonly names: Set<string>;\n\toverflow: boolean;\n}\n\nconst recentDisposableResizeObserverContexts = new WeakMap<CodeWindow, IRecentDisposableResizeObserverContext>();\n\nfunction recordDisposableResizeObserverInvocation(targetWindow: CodeWindow, name: string): void {\n\tlet context = recentDisposableResizeObserverContexts.get(targetWindow);\n\tif (!context) {\n\t\tcontext = { names: new Set(), overflow: false };\n\t\trecentDisposableResizeObserverContexts.set(targetWindow, context);\n\n\t\t// ResizeObserver callbacks and the synthetic loop error are delivered\n\t\t// after requestAnimationFrame callbacks in the rendering update. A\n\t\t// request made here therefore clears this context at the next frame,\n\t\t// after telemetry has observed any warning from the current update.\n\t\ttargetWindow.requestAnimationFrame(() => recentDisposableResizeObserverContexts.delete(targetWindow));\n\t}\n\n\tif (context.names.has(name)) {\n\t\treturn;\n\t}\n\tif (context.names.size < maxRecentDisposableResizeObservers) {\n\t\tcontext.names.add(name);\n\t} else {\n\t\tcontext.overflow = true;\n\t\tconst largestName = Array.from(context.names).sort().at(-1)!;\n\t\tif (name < largestName) {\n\t\t\tcontext.names.delete(largestName);\n\t\t\tcontext.names.add(name);\n\t\t}\n\t}\n}\n\ntype HTMLElementAttributeKeys<T> = Partial<{ [K in keyof T]: T[K] extends Function ? never : T[K] extends object ? HTMLElementAttributeKeys<T[K]> : T[K] }>;\ntype ElementAttributes<T> = HTMLElementAttributeKeys<T> & Record<string, any>;\ntype RemoveHTMLElement<T> = T extends HTMLElement ? never : T;\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\ntype ArrayToObj<T extends readonly any[]> = UnionToIntersection<RemoveHTMLElement<T[number]>>;\ntype HHTMLElementTagNameMap = HTMLElementTagNameMap & { '': HTMLDivElement };\n\ntype TagToElement<T> = T extends `${infer TStart}#${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends `${infer TStart}.${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends keyof HTMLElementTagNameMap\n\t? HTMLElementTagNameMap[T]\n\t: HTMLElement;\n\ntype TagToElementAndId<TTag> = TTag extends `${infer TTag}@${infer TId}`\n\t? { element: TagToElement<TTag>; id: TId }\n\t: { element: TagToElement<TTag>; id: 'root' };\n\ntype TagToRecord<TTag> = TagToElementAndId<TTag> extends { element: infer TElement; id: infer TId }\n\t? Record<(TId extends string ? TId : never) | 'root', TElement>\n\t: never;\n\ntype Child = HTMLElement | string | Record<string, HTMLElement>;\n\nconst H_REGEX = /(?<tag>[\\w\\-]+)?(?:#(?<id>[\\w\\-]+))?(?<class>(?:\\.(?:[\\w\\-]+))*)(?:@(?<name>(?:[\\w\\_])+))?/;\n\n/**\n * A helper function to create nested dom nodes.\n *\n *\n * ```ts\n * const elements = h('div.code-view', [\n * \th('div.title@title'),\n * \th('div.container', [\n * \t\th('div.gutter@gutterDiv'),\n * \t\th('div@editor'),\n * \t]),\n * ]);\n * const editor = createEditor(elements.editor);\n * ```\n*/\nexport function h<TTag extends string>\n\t(tag: TTag):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>):\n\tTagToRecord<TTag> extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h<TTag extends string, T extends Child[]>\n\t(tag: TTag, attributes: Partial<ElementAttributes<TagToElement<TTag>>>, children: [...T]):\n\t(ArrayToObj<T> & TagToRecord<TTag>) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h(tag: string, ...args: [] | [attributes: { $: string } & Partial<ElementAttributes<HTMLElement>> | Record<string, any>, children?: any[]] | [children: any[]]): Record<string, HTMLElement> {\n\tlet attributes: { $?: string } & Partial<ElementAttributes<HTMLElement>>;\n\tlet children: (Record<string, HTMLElement> | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElement(tagName);\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record<string, HTMLElement> = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nfunction camelCaseToHyphenCase(str: string) {\n\treturn str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nexport function copyAttributes(from: Element, to: Element, filter?: string[]): void {\n\tfor (const { name, value } of from.attributes) {\n\t\tif (!filter || filter.includes(name)) {\n\t\t\tto.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nexport function isEditableElement(element: Element): boolean {\n\treturn element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea' || isHTMLElement(element) && !!element.editContext;\n}\n\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nexport class SafeTriangle {\n\t// 4 points (x, y), 8 length\n\tprivate points = new Int16Array(8);\n\n\tconstructor(\n\t\tprivate readonly originX: number,\n\t\tprivate readonly originY: number,\n\t\ttarget: HTMLElement\n\t) {\n\t\tconst { top, left, right, bottom } = target.getBoundingClientRect();\n\t\tconst t = this.points;\n\t\tlet i = 0;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\t}\n\n\tpublic contains(x: number, y: number) {\n\t\tconst { points, originX, originY } = this;\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tconst p1 = 2 * i;\n\t\t\tconst p2 = 2 * ((i + 1) % 4);\n\t\t\tif (isPointWithinTriangle(x, y, originX, originY, points[p1], points[p1 + 1], points[p2], points[p2 + 1])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\n\nexport namespace n {\n\tfunction nodeNs<TMap extends Record<string, any>>(elementNs: string | undefined = undefined): DomTagCreateFn<TMap> {\n\t\treturn (tag, attributes, children) => {\n\t\t\tconst className = attributes.class;\n\t\t\tdelete attributes.class;\n\t\t\tconst ref = attributes.ref;\n\t\t\tdelete attributes.ref;\n\t\t\tconst obsRef = attributes.obsRef;\n\t\t\tdelete attributes.obsRef;\n\n\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\treturn new ObserverNodeWithElement(tag as any, ref, obsRef, elementNs, className, attributes, children);\n\t\t};\n\t}\n\n\tfunction node<TMap extends Record<string, any>, TKey extends keyof TMap>(tag: TKey, elementNs: string | undefined = undefined): DomCreateFn<TMap[TKey], TMap[TKey]> {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst f = nodeNs(elementNs) as any;\n\t\treturn (attributes, children) => {\n\t\t\treturn f(tag, attributes, children);\n\t\t};\n\t}\n\n\texport const div: DomCreateFn<HTMLDivElement, HTMLDivElement> = node<HTMLElementTagNameMap, 'div'>('div');\n\n\texport const elem = nodeNs<HTMLElementTagNameMap>(undefined);\n\n\texport const svg: DomCreateFn<SVGElementTagNameMap2['svg'], SVGElement> = node<SVGElementTagNameMap2, 'svg'>('svg', 'http://www.w3.org/2000/svg');\n\n\texport const svgElem = nodeNs<SVGElementTagNameMap2>('http://www.w3.org/2000/svg');\n\n\texport function ref<T = HTMLOrSVGElement>(): IRefWithVal<T> {\n\t\tlet value: T | undefined = undefined;\n\t\tconst result: IRef<T> = function (val: T) {\n\t\t\tvalue = val;\n\t\t};\n\t\tObject.defineProperty(result, 'element', {\n\t\t\tget() {\n\t\t\t\tif (!value) {\n\t\t\t\t\tthrow new BugIndicatingError('Make sure the ref is set before accessing the element. Maybe wrong initialization order?');\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t});\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\treturn result as any;\n\t}\n}\ntype Value<T> = T | IObservable<T>;\ntype ValueOrList<T> = Value<T> | ValueOrList<T>[];\ntype ValueOrList2<T> = ValueOrList<T> | ValueOrList<ValueOrList<T>>;\ntype HTMLOrSVGElement = HTMLElement | SVGElement;\ntype SVGElementTagNameMap2 = {\n\tsvg: SVGElement & {\n\t\twidth: number;\n\t\theight: number;\n\t\ttransform: string;\n\t\tviewBox: string;\n\t\tfill: string;\n\t};\n\tpath: SVGElement & {\n\t\td: string;\n\t\tstroke: string;\n\t\tfill: string;\n\t};\n\tlinearGradient: SVGElement & {\n\t\tid: string;\n\t\tx1: string | number;\n\t\tx2: string | number;\n\t};\n\tstop: SVGElement & {\n\t\toffset: string;\n\t};\n\trect: SVGElement & {\n\t\tx: number;\n\t\ty: number;\n\t\twidth: number;\n\t\theight: number;\n\t\tfill: string;\n\t};\n\tdefs: SVGElement;\n};\ntype DomTagCreateFn<TMap extends Record<string, any>> = <TTag extends keyof TMap>(\n\ttag: TTag,\n\tattributes: ElementAttributeKeys<TMap[TTag]> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TMap[TTag]>; obsRef?: IRef<ObserverNodeWithElement<TMap[TTag]> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TMap[TTag]>;\ntype DomCreateFn<TAttributes, TResult extends HTMLOrSVGElement> = (\n\tattributes: ElementAttributeKeys<TAttributes> & { class?: ValueOrList<string | false | undefined>; ref?: IRef<TResult>; obsRef?: IRef<ObserverNodeWithElement<TResult> | null> },\n\tchildren?: ChildNode\n) => ObserverNode<TResult>;\n\nexport type ChildNode = ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>;\n\nexport type IRef<T> = (value: T) => void;\n\nexport interface IRefWithVal<T> extends IRef<T> {\n\treadonly element: T;\n}\n\nexport abstract class ObserverNode<T extends HTMLOrSVGElement = HTMLOrSVGElement> {\n\tprivate readonly _deriveds: (IObservable<any>)[] = [];\n\n\tprotected readonly _element: T;\n\n\tconstructor(\n\t\ttag: string,\n\t\tref: IRef<T> | undefined,\n\t\tobsRef: IRef<ObserverNodeWithElement<T> | null> | undefined,\n\t\tns: string | undefined,\n\t\tclassName: ValueOrList<string | undefined | false> | undefined,\n\t\tattributes: ElementAttributeKeys<T>,\n\t\tchildren: ChildNode\n\t) {\n\t\tthis._element = (ns ? document.createElementNS(ns, tag) : document.createElement(tag)) as unknown as T;\n\t\tif (ref) {\n\t\t\tref(this._element);\n\t\t}\n\t\tif (obsRef) {\n\t\t\tthis._deriveds.push(derived((_reader) => {\n\t\t\t\tobsRef(this as unknown as ObserverNodeWithElement<T>);\n\t\t\t\t_reader.store.add({\n\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\tobsRef(null);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}));\n\t\t}\n\n\t\tif (className) {\n\t\t\tif (hasObservable(className)) {\n\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t/** @description set.class */\n\t\t\t\t\tsetClassName(this._element, getClassName(className, reader));\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\tsetClassName(this._element, getClassName(className, undefined));\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(attributes)) {\n\t\t\tif (key === 'style') {\n\t\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\t\tconst key = camelCaseToHyphenCase(cssKey);\n\t\t\t\t\tif (isObservable(cssValue)) {\n\t\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.style.${key}` }, reader => {\n\t\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue.read(reader)));\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._element.style.setProperty(key, convertCssValue(cssValue));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (key === 'tabIndex') {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derived(this, reader => {\n\t\t\t\t\t\t/** @description set.tabIndex */\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\tthis._element.tabIndex = value.read(reader) as any;\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tthis._element.tabIndex = value;\n\t\t\t\t}\n\t\t\t} else if (key.startsWith('on')) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t(this._element as any)[key] = value;\n\t\t\t} else {\n\t\t\t\tif (isObservable(value)) {\n\t\t\t\t\tthis._deriveds.push(derivedOpts({ owner: this, debugName: () => `set.${key}` }, reader => {\n\t\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value.read(reader));\n\t\t\t\t\t}));\n\t\t\t\t} else {\n\t\t\t\t\tsetOrRemoveAttribute(this._element, key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (children) {\n\t\t\tfunction getChildren(reader: IReader | undefined, children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): (HTMLOrSVGElement | string)[] {\n\t\t\t\tif (isObservable(children)) {\n\t\t\t\t\treturn getChildren(reader, children.read(reader));\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(children)) {\n\t\t\t\t\treturn children.flatMap(c => getChildren(reader, c));\n\t\t\t\t}\n\t\t\t\tif (children instanceof ObserverNode) {\n\t\t\t\t\tif (reader) {\n\t\t\t\t\t\tchildren.readEffect(reader);\n\t\t\t\t\t}\n\t\t\t\t\treturn [children._element];\n\t\t\t\t}\n\t\t\t\tif (children) {\n\t\t\t\t\treturn [children];\n\t\t\t\t}\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst d = derived(this, reader => {\n\t\t\t\t/** @description set.children */\n\t\t\t\tthis._element.replaceChildren(...getChildren(reader, children));\n\t\t\t});\n\t\t\tthis._deriveds.push(d);\n\t\t\tif (!childrenIsObservable(children)) {\n\t\t\t\td.get();\n\t\t\t}\n\t\t}\n\t}\n\n\treadEffect(reader: IReader | undefined): void {\n\t\tfor (const d of this._deriveds) {\n\t\t\td.read(reader);\n\t\t}\n\t}\n\n\tkeepUpdated(store: DisposableStore): ObserverNodeWithElement<T> {\n\t\tderived(reader => {\n\t\t\t/** update */\n\t\t\tthis.readEffect(reader);\n\t\t}).recomputeInitiallyAndOnChange(store);\n\t\treturn this as unknown as ObserverNodeWithElement<T>;\n\t}\n\n\t/**\n\t * Creates a live element that will keep the element updated as long as the returned object is not disposed.\n\t*/\n\ttoDisposableLiveElement() {\n\t\tconst store = new DisposableStore();\n\t\tthis.keepUpdated(store);\n\t\treturn new LiveElement(this._element, store);\n\t}\n\n\tprivate _isHovered: IObservable<boolean> | undefined = undefined;\n\n\tget isHovered(): IObservable<boolean> {\n\t\tif (!this._isHovered) {\n\t\t\tconst hovered = observableValue<boolean>('hovered', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => hovered.set(true, undefined));\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => hovered.set(false, undefined));\n\t\t\tthis._isHovered = hovered;\n\t\t}\n\t\treturn this._isHovered;\n\t}\n\n\tprivate _didMouseMoveDuringHover: IObservable<boolean> | undefined = undefined;\n\n\tget didMouseMoveDuringHover(): IObservable<boolean> {\n\t\tif (!this._didMouseMoveDuringHover) {\n\t\t\tlet _hovering = false;\n\t\t\tconst hovered = observableValue<boolean>('didMouseMoveDuringHover', false);\n\t\t\tthis._element.addEventListener('mouseenter', (_e) => {\n\t\t\t\t_hovering = true;\n\t\t\t});\n\t\t\tthis._element.addEventListener('mousemove', (_e) => {\n\t\t\t\tif (_hovering) {\n\t\t\t\t\thovered.set(true, undefined);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis._element.addEventListener('mouseleave', (_e) => {\n\t\t\t\t_hovering = false;\n\t\t\t\thovered.set(false, undefined);\n\t\t\t});\n\t\t\tthis._didMouseMoveDuringHover = hovered;\n\t\t}\n\t\treturn this._didMouseMoveDuringHover;\n\t}\n}\n\nfunction setClassName(domNode: HTMLOrSVGElement, className: string) {\n\tif (isSVGElement(domNode)) {\n\t\tdomNode.setAttribute('class', className);\n\t} else {\n\t\tdomNode.className = className;\n\t}\n}\n\nfunction resolve<T>(value: ValueOrList<T>, reader: IReader | undefined, cb: (val: T) => void): void {\n\tif (isObservable(value)) {\n\t\tcb(value.read(reader));\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const v of value) {\n\t\t\tresolve(v, reader, cb);\n\t\t}\n\t\treturn;\n\t}\n\t// eslint-disable-next-line local/code-no-any-casts\n\tcb(value as any);\n}\nfunction getClassName(className: ValueOrList<string | undefined | false> | undefined, reader: IReader | undefined): string {\n\tlet result = '';\n\tresolve(className, reader, val => {\n\t\tif (val) {\n\t\t\tif (result.length === 0) {\n\t\t\t\tresult = val;\n\t\t\t} else {\n\t\t\t\tresult += ' ' + val;\n\t\t\t}\n\t\t}\n\t});\n\treturn result;\n}\nfunction hasObservable(value: ValueOrList<unknown>): boolean {\n\tif (isObservable(value)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.some(v => hasObservable(v));\n\t}\n\treturn false;\n}\nfunction convertCssValue(value: any): string {\n\tif (typeof value === 'number') {\n\t\treturn value + 'px';\n\t}\n\treturn value;\n}\nfunction childrenIsObservable(children: ValueOrList2<HTMLOrSVGElement | string | ObserverNode | undefined>): boolean {\n\tif (isObservable(children)) {\n\t\treturn true;\n\t}\n\tif (Array.isArray(children)) {\n\t\treturn children.some(c => childrenIsObservable(c));\n\t}\n\treturn false;\n}\n\nexport class LiveElement<T extends HTMLOrSVGElement = HTMLElement> {\n\tconstructor(\n\t\tpublic readonly element: T,\n\t\tprivate readonly _disposable: IDisposable\n\t) { }\n\n\tdispose() {\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class ObserverNodeWithElement<T extends HTMLOrSVGElement = HTMLOrSVGElement> extends ObserverNode<T> {\n\tpublic get element() {\n\t\treturn this._element;\n\t}\n}\nfunction setOrRemoveAttribute(element: HTMLOrSVGElement, key: string, value: unknown) {\n\tif (value === null || value === undefined) {\n\t\telement.removeAttribute(camelCaseToHyphenCase(key));\n\t} else {\n\t\telement.setAttribute(camelCaseToHyphenCase(key), String(value));\n\t}\n}\n\ntype ElementAttributeKeys<T> = Partial<{\n\t[K in keyof T]: T[K] extends Function ? never : T[K] extends object ? ElementAttributeKeys<T[K]> : Value<number | T[K] | undefined | null>;\n}>;\n\n/**\n * A custom element that fires callbacks when connected to or disconnected from the DOM.\n * Useful for tracking whether a template or component is currently mounted, especially\n * with iframes/webviews that are sensitive to movement.\n *\n * @example\n * ```ts\n * const observer = document.createElement('connection-observer') as ConnectionObserverElement;\n * observer.onDidConnect = () => console.log('mounted');\n * observer.onDidDisconnect = () => console.log('unmounted');\n * container.appendChild(observer);\n * ```\n */\nexport class ConnectionObserverElement extends HTMLElement {\n\tpublic onDidConnect?: () => void;\n\tpublic onDidDisconnect?: () => void;\n\n\tdisconnectedCallback() {\n\t\tthis.onDidDisconnect?.();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.onDidConnect?.();\n\t}\n}\n\nif (!customElements.get('connection-observer')) {\n\tcustomElements.define('connection-observer', ConnectionObserverElement);\n}\n"]}
|