{"version":3,"file":"monaco-editor-ChX4GTd7.js","sources":["../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/position.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/range.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/selection.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/nls.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/window.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/errors.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/functional.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/arraysFind.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/arrays.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/collections.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/map.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/iterator.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/lifecycle.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/linkedList.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/stopwatch.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/event.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/browser.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/types.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/platform.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/canIUse.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/keyCodes.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/keybindings.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/keyboardEvent.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/iframe.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/mouseEvent.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/cancellation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/process.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/path.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/cache.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/lazy.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/strings.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/extpath.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/uri.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/network.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/resources.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/symbols.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/async.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/dompurify/dompurify.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/hash.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/dom.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/aria/aria.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/instantiation/common/instantiation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/services/codeEditorService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/model.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/resolverService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/actions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/codicons.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/themables.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/commands/common/commands.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextkey/common/scanner.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextkey/common/contextkey.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/assert.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/registry/common/platform.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/keybinding/common/keybindingsRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/actions/common/actions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/telemetry/common/telemetry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/errorMessage.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/log/common/log.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/editorExtensions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/cursorColumns.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/indentation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursorCommon.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorColumnSelection.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/commands/replaceCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorAtomicMoveOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorMoveOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorDeleteOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/uint.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/characterClassifier.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/wordCharacterClassifier.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorWordOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorMoveCommands.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/languageConfiguration.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/wordHelper.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/characterPair.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/stream.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/buffer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/stringBuilder.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/richEditBrackets.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/electricCharacter.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/indentRules.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/onEnter.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/configuration/common/configuration.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/language.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/instantiation/common/descriptors.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/instantiation/common/extensions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/mime.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/configuration/common/configurationRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/modesRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/languageBracketsConfiguration.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/languageConfigurationRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/enterAction.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/commands/shiftCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/commands/surroundSelectionCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/autoIndent.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorTypeOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/editorContextKeys.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/coreCommands.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/markerDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/services/markerDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/objects.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/config/elementSizeObserver.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/fastDomNode.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/config/domFontInfo.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/config/charWidthReader.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/textModelDefaults.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/config/editorOptions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/config/editorZoom.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/config/fontInfo.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/config/fontMeasurements.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/config/migrateOptions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/config/tabFocus.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/accessibility/common/accessibility.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/config/editorConfiguration.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/decorators.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/touch.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/globalPointerMoveMonitor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/color.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/theme/common/colorRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/editorDom.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewEventHandler.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/viewPart.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/renderingContext.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/lines/rangeUtil.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewLayout/lineDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewLayout/linePart.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewLayout/viewLineRenderer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/theme/common/theme.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/lines/viewLine.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/controller/mouseTarget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/widget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/scrollbar/scrollbarState.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/scrollable.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/scrollbar/scrollableElement.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/controller/mouseHandler.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/event.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/performance.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/controller/textAreaState.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/controller/textAreaInput.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/controller/pointerHandler.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/dynamicViewOverlay.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/theme/common/themeService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/editorColorRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/margin/margin.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/editOperation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokenizationRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/ime.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/keybinding/common/keybinding.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/controller/textAreaHandler.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/viewController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/viewUserInputEvents.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/trustedTypes.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/viewLayer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/viewOverlays.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/decorations/decorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/textModelPart.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/utils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/textModelGuides.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/guidesTextModelPart.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/lines/domReadingContext.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/lines/viewLines.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/marginDecorations/marginDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/rgba.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/minimapTokensColorTracker.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/minimap/minimapCharSheet.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/minimap/minimapCharRenderer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/minimap/minimapPreBaked.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/minimap/minimap.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/overviewZoneManager.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/rulers/rulers.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/selections/selections.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/viewZones/viewZones.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/editorTheme.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/viewContext.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewLayout/viewLinesViewportData.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/viewParts/whitespace/whitespace.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/editorAction.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/editorCommon.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/eolCounter.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/offsetRange.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/lineRange.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/textModelBracketPairs.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/beforeEditPositionMapper.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/ast.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/encodedTokenAttributes.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/brackets.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/concat23Trees.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/nodeReader.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/parser.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/combineTextEditInfos.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsImpl.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/core/textChange.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/editStack.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/indentationGuesser.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/intervalTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/textModelSearch.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/nullTokenize.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/fixedArray.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokens/lineTokens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokens/contiguousTokensEditing.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokens/contiguousMultilineTokens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokens/contiguousMultilineTokensBuilder.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/textModelTokens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokens/contiguousTokensStore.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokens/sparseTokensStore.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/tokenizationTextModelPart.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/textModelEvents.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/undoRedo/common/undoRedo.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/textModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/oneCursor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorCollection.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursorContext.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewEvents.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModelEventDispatcher.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/cursor/cursor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/textToHtmlTokenizer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewLayout/linesLayout.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewLayout/viewLayout.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/viewModelDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/modelLineProjection.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/prefixSumComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/viewModelLines.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/viewModelImpl.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/instantiation/common/serviceCollection.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/severity.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/notification/common/notification.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/modelLineProjectionData.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/view/domLineBreaksComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/languageFeatures.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/codeEditorContributions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/codeEditorWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/observableInternal/logging.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/observableInternal/base.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/observableInternal/derived.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/observableInternal/autorun.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/observableInternal/utils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/stableEditorScroll.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/dnd.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/naturalLanguage/korean.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/filters.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/iconLabels.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/htmlContent.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/iconLabel/iconLabelHover.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/list/splice.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/numbers.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/list/list.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/range.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/list/rangeMap.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/list/rowCache.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/list/listView.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/list/listWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/formattedTextRenderer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/iconLabel/iconLabels.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/idGenerator.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/marked/marked.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/marshalling.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/markdownRenderer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/selectBox/selectBoxNative.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/selectBox/selectBox.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/actionbar/actionViewItems.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/actionbar/actionbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/hotReload.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/utils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/rangeMapping.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/audioCues/browser/audioCueService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/theme/common/iconRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/accessibleDiffViewer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/decorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/movedBlocksLines.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffEditorDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/sash/sash.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffEditorSash.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/outlineModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/hideUnchangedRegionsFeature.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/editorWorker.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/workerBasedDocumentDiffProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/utils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/linesDiffComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/inlineDiffDeletedCodeMargin.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/renderLines.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/clipboard/common/clipboardService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextview/browser/contextView.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/lineAlignment.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/overviewRulerPart.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/progress/common/progress.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/colors.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/delegatingEditorImpl.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffEditorEditors.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/config/diffEditor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/diffEditor/diffEditor.contribution.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/caretOperations/browser/moveCaretCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/caretOperations/browser/transpose.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/clipboard/browser/clipboard.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/config/editorConfigurationSchema.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/services/bulkEditService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/editorState/browser/editorState.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/common/types.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/codeAction.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/codeActionKeybindingResolver.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/opener/common/opener.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/message/browser/messageController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/keybindingLabels.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/theme/browser/defaultStyles.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/actionWidget/browser/actionList.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/actionWidget/browser/actionWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/markers/common/markers.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/codeActionModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/codeActionController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codelens/browser/codelens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/performance.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/parts/storage/common/storage.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/environment/common/environment.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/ternarySearchTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/files/common/files.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/workspace/common/workspace.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/uriIdentity/common/uriIdentity.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/uuid.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/userDataProfile/common/userDataProfile.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/storage/common/storage.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codelens/browser/codeLensCache.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codelens/browser/codelensWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/common/quickInput.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/languageFeatureDebounce.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/codelens/browser/codelensController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/worker/simpleWorker.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/defaultWorkerFactory.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/diff/diffChange.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/diff/diff.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/mirrorTextModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/linkComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/inplaceReplaceSupport.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/standalone/standaloneEnums.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/editorBaseApi.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/unicodeTextModelHighlighter.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/legacyLinesDiffComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/diff/linesDiffComputers.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/editorSimpleWorker.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/textResourceConfiguration.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/services/editorWorkerService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/editorFeatures.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/defaultDocumentColorProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/color.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/colorPickerModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/colorPickerWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/colorHoverParticipant.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/embeddedCodeEditorWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/zoneWidget/browser/zoneWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/dropdown/dropdown.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/action/common/action.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/actions/browser/menuEntryActionViewItem.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/peekView/browser/peekView.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/editorBrowser.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/list/listPaging.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/splitview/splitview.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/table/tableWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/toggle/toggle.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/findinput/findInputToggles.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/navigator.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/history.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/inputbox/inputBox.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/findinput/findInput.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/tree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/indexTreeModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/abstractTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/objectTreeModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/objectTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/asyncDataTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/tree/dataTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextkey/common/contextkeys.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/product/common/product.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/list/browser/listService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/countBadge/countBadge.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/iconLabel/iconLabel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/label/common/label.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/goToSymbol.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/hover/hoverWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/hoverOperation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/hoverTypes.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/resizable/resizable.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/resizableContentWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/contentHover.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/marginHover.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/getHover.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoError/browser/markerNavigationService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/severityIcon/browser/severityIcon.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/gotoError/browser/gotoError.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/commandIds.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/toolbar/toolbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/actions/browser/toolbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsHintsWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/hover/browser/hover.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/colorContributions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPickerWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPickerActions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/comment/browser/blockCommentCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/comment/browser/lineCommentCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/comment/browser/comment.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dnd/browser/dragAndDropCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dnd/browser/dnd.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/dataTransfer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/labels.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/dialogs/common/dialogs.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/files/browser/webFileSystemAccess.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/files/browser/htmlFileSystemProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/dnd/browser/dnd.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/dnd.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dropOrPasteInto/browser/edit.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineProgress/browser/inlineProgress.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/button/button.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/treeViewsDnd.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/treeViewsDndService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/findDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/replaceAllCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/search.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/replacePattern.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/findModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/findOptionsWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/findState.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/findinput/replaceInput.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/history/browser/contextScopedHistoryWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/history/browser/historyWidgetKeybindingHint.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/findWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/find/browser/findController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/folding/browser/foldingRanges.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/folding/browser/foldingModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/folding/browser/hiddenRangeModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/folding/browser/indentRangeProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/folding/browser/foldingDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/folding/browser/syntaxRangeProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/folding/browser/folding.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/format/browser/formattingEdit.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/remote/common/remoteHosts.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/extensions/common/extensions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/format/browser/format.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/format/browser/formatActions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/documentSymbols/browser/outlineModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/documentSymbols/browser/documentSymbols.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletionContextKeys.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/utils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/ghostTextWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/model/bracketPairsTextModelPart/fixBrackets.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/singleTextEdit.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/snippet/browser/snippetParser.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/provideInlineCompletions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsSource.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggest.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/snippet/browser/snippetVariables.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/snippet/browser/snippetSession.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/snippet/browser/snippetController2.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestMemory.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/wordContextKey.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestAlternatives.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestCommitCharacters.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/smartSelect/browser/bracketSelections.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/wordDistance.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/completionModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestOvertypingCapturer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestWidgetStatus.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/getIconClasses.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/suggestWidgetInlineCompletionProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/commands.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/hoverParticipant.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/indentation/browser/indentUtils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/indentation/browser/indentation.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlayHints/browser/inlayHints.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inlayHints/browser/inlayHintsContribution.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplaceCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/commands/trimTrailingWhitespaceCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/linesOperations/browser/copyLinesCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/linesOperations/browser/moveLinesCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/linesOperations/browser/sortLinesCommand.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/links/browser/getLinks.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/links/browser/links.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/longLinesHelper/browser/longLinesHelper.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/multicursor/browser/multicursor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/parameterHints/browser/provideSignatureHelp.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/rename/browser/renameInputField.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/rename/browser/rename.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/tokens/sparseMultilineTokens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/semanticTokensProviderStyling.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/semanticTokensDto.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/semanticTokens/common/getSemanticTokens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/semanticTokensStyling.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/semanticTokens/common/semanticTokensConfig.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/semanticTokens/browser/viewportSemanticTokens.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/smartSelect/browser/wordSelections.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/action/common/actionCommonCategories.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollElement.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollContribution.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/tokenization/browser/tokenization.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/opener/browser/link.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/workspace/common/workspaceTrust.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/glob.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languageSelector.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/wordPartOperations/browser/wordPartOperations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/standaloneStrings.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/services/webWorker.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/common/monarch/monarchCommon.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/common/monarch/monarchLexer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/colorizer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/services/abstractCodeEditorService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/standaloneCodeEditorService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/layout/browser/layoutService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/standaloneLayoutService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/undoRedo/common/undoRedoService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/semanticTokensStylingService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languageFeatureRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/languageFeaturesService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/json.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/configuration/common/configurationModels.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/keybinding/common/keybindingResolver.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/keybinding/common/abstractKeybindingService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/contextview/contextview.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextview/browser/contextViewService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/languagesAssociations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/languagesRegistry.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/languageService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/menu/menu.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextview/browser/contextMenuHandler.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextview/browser/contextMenuService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/editor/common/editor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/services/openerService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/markerDecorationsService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/services/modelService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/common/quickAccess.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/browser/quickAccess.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/ui/progressbar/progressbar.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/browser/quickInputBox.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/comparers.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/linkedText.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/browser/quickInputUtils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/browser/quickInputList.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/browser/quickInput.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/browser/quickInputController.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/quickinput/browser/quickInputService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/common/languages/supports/tokenization.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/common/themes.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/theme/browser/iconsStyleSheet.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/standaloneThemeService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/common/standaloneTheme.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/accessibility/browser/accessibilityService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/actions/common/menuService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/clipboard/browser/clipboardService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/contextkey/browser/contextKeyService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/instantiation/common/graph.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/instantiation/common/instantiationService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/markers/common/markerService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/policy/common/policy.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/configuration/common/configurations.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/log/common/logService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/standaloneServices.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/standaloneCodeEditor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/multiDiffEditorWidget/utils.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/multiDiffEditorWidget/colors.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/standaloneEditor.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/common/monarch/monarchCompile.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/standalone/browser/standaloneLanguages.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/editor/editor.api.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/_virtual/_rollupPluginBabelHelpers.js","../../../../../node_modules/.pnpm/state-local@1.0.7/node_modules/state-local/lib/es/state-local.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/config/index.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/utils/curry.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/utils/isObject.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/validators/index.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/utils/compose.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/utils/deepMerge.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/utils/makeCancelable.js","../../../../../node_modules/.pnpm/@monaco-editor+loader@1.3.3_@codingame+monaco-editor-treemended@1.85.0/node_modules/@monaco-editor/loader/lib/es/loader/index.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/platform/product/common/productService.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/common/fuzzyScorer.js","../../../../../node_modules/.pnpm/@codingame+monaco-editor-treemended@1.85.0/node_modules/@codingame/monaco-editor-treemended/esm/vs/base/browser/indexedDB.js"],"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/**\n * A position in the editor.\n */\nexport class Position {\n constructor(lineNumber, column) {\n this.lineNumber = lineNumber;\n this.column = column;\n }\n /**\n * Create a new position from this position.\n *\n * @param newLineNumber new line number\n * @param newColumn new column\n */\n with(newLineNumber = this.lineNumber, newColumn = this.column) {\n if (newLineNumber === this.lineNumber && newColumn === this.column) {\n return this;\n }\n else {\n return new Position(newLineNumber, newColumn);\n }\n }\n /**\n * Derive a new position from this position.\n *\n * @param deltaLineNumber line number delta\n * @param deltaColumn column delta\n */\n delta(deltaLineNumber = 0, deltaColumn = 0) {\n return this.with(this.lineNumber + deltaLineNumber, this.column + deltaColumn);\n }\n /**\n * Test if this position equals other position\n */\n equals(other) {\n return Position.equals(this, other);\n }\n /**\n * Test if position `a` equals position `b`\n */\n static equals(a, b) {\n if (!a && !b) {\n return true;\n }\n return (!!a &&\n !!b &&\n a.lineNumber === b.lineNumber &&\n a.column === b.column);\n }\n /**\n * Test if this position is before other position.\n * If the two positions are equal, the result will be false.\n */\n isBefore(other) {\n return Position.isBefore(this, other);\n }\n /**\n * Test if position `a` is before position `b`.\n * If the two positions are equal, the result will be false.\n */\n static isBefore(a, b) {\n if (a.lineNumber < b.lineNumber) {\n return true;\n }\n if (b.lineNumber < a.lineNumber) {\n return false;\n }\n return a.column < b.column;\n }\n /**\n * Test if this position is before other position.\n * If the two positions are equal, the result will be true.\n */\n isBeforeOrEqual(other) {\n return Position.isBeforeOrEqual(this, other);\n }\n /**\n * Test if position `a` is before position `b`.\n * If the two positions are equal, the result will be true.\n */\n static isBeforeOrEqual(a, b) {\n if (a.lineNumber < b.lineNumber) {\n return true;\n }\n if (b.lineNumber < a.lineNumber) {\n return false;\n }\n return a.column <= b.column;\n }\n /**\n * A function that compares positions, useful for sorting\n */\n static compare(a, b) {\n const aLineNumber = a.lineNumber | 0;\n const bLineNumber = b.lineNumber | 0;\n if (aLineNumber === bLineNumber) {\n const aColumn = a.column | 0;\n const bColumn = b.column | 0;\n return aColumn - bColumn;\n }\n return aLineNumber - bLineNumber;\n }\n /**\n * Clone this position.\n */\n clone() {\n return new Position(this.lineNumber, this.column);\n }\n /**\n * Convert to a human-readable representation.\n */\n toString() {\n return '(' + this.lineNumber + ',' + this.column + ')';\n }\n // ---\n /**\n * Create a `Position` from an `IPosition`.\n */\n static lift(pos) {\n return new Position(pos.lineNumber, pos.column);\n }\n /**\n * Test if `obj` is an `IPosition`.\n */\n static isIPosition(obj) {\n return (obj\n && (typeof obj.lineNumber === 'number')\n && (typeof obj.column === 'number'));\n }\n toJSON() {\n return {\n lineNumber: this.lineNumber,\n column: this.column\n };\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Position } from './position.js';\n/**\n * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)\n */\nexport class Range {\n constructor(startLineNumber, startColumn, endLineNumber, endColumn) {\n if ((startLineNumber > endLineNumber) || (startLineNumber === endLineNumber && startColumn > endColumn)) {\n this.startLineNumber = endLineNumber;\n this.startColumn = endColumn;\n this.endLineNumber = startLineNumber;\n this.endColumn = startColumn;\n }\n else {\n this.startLineNumber = startLineNumber;\n this.startColumn = startColumn;\n this.endLineNumber = endLineNumber;\n this.endColumn = endColumn;\n }\n }\n /**\n * Test if this range is empty.\n */\n isEmpty() {\n return Range.isEmpty(this);\n }\n /**\n * Test if `range` is empty.\n */\n static isEmpty(range) {\n return (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn);\n }\n /**\n * Test if position is in this range. If the position is at the edges, will return true.\n */\n containsPosition(position) {\n return Range.containsPosition(this, position);\n }\n /**\n * Test if `position` is in `range`. If the position is at the edges, will return true.\n */\n static containsPosition(range, position) {\n if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\n return false;\n }\n if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {\n return false;\n }\n if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * Test if `position` is in `range`. If the position is at the edges, will return false.\n * @internal\n */\n static strictContainsPosition(range, position) {\n if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\n return false;\n }\n if (position.lineNumber === range.startLineNumber && position.column <= range.startColumn) {\n return false;\n }\n if (position.lineNumber === range.endLineNumber && position.column >= range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * Test if range is in this range. If the range is equal to this range, will return true.\n */\n containsRange(range) {\n return Range.containsRange(this, range);\n }\n /**\n * Test if `otherRange` is in `range`. If the ranges are equal, will return true.\n */\n static containsRange(range, otherRange) {\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {\n return false;\n }\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.\n */\n strictContainsRange(range) {\n return Range.strictContainsRange(this, range);\n }\n /**\n * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.\n */\n static strictContainsRange(range, otherRange) {\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {\n return false;\n }\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * A reunion of the two ranges.\n * The smallest position will be used as the start point, and the largest one as the end point.\n */\n plusRange(range) {\n return Range.plusRange(this, range);\n }\n /**\n * A reunion of the two ranges.\n * The smallest position will be used as the start point, and the largest one as the end point.\n */\n static plusRange(a, b) {\n let startLineNumber;\n let startColumn;\n let endLineNumber;\n let endColumn;\n if (b.startLineNumber < a.startLineNumber) {\n startLineNumber = b.startLineNumber;\n startColumn = b.startColumn;\n }\n else if (b.startLineNumber === a.startLineNumber) {\n startLineNumber = b.startLineNumber;\n startColumn = Math.min(b.startColumn, a.startColumn);\n }\n else {\n startLineNumber = a.startLineNumber;\n startColumn = a.startColumn;\n }\n if (b.endLineNumber > a.endLineNumber) {\n endLineNumber = b.endLineNumber;\n endColumn = b.endColumn;\n }\n else if (b.endLineNumber === a.endLineNumber) {\n endLineNumber = b.endLineNumber;\n endColumn = Math.max(b.endColumn, a.endColumn);\n }\n else {\n endLineNumber = a.endLineNumber;\n endColumn = a.endColumn;\n }\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n }\n /**\n * A intersection of the two ranges.\n */\n intersectRanges(range) {\n return Range.intersectRanges(this, range);\n }\n /**\n * A intersection of the two ranges.\n */\n static intersectRanges(a, b) {\n let resultStartLineNumber = a.startLineNumber;\n let resultStartColumn = a.startColumn;\n let resultEndLineNumber = a.endLineNumber;\n let resultEndColumn = a.endColumn;\n const otherStartLineNumber = b.startLineNumber;\n const otherStartColumn = b.startColumn;\n const otherEndLineNumber = b.endLineNumber;\n const otherEndColumn = b.endColumn;\n if (resultStartLineNumber < otherStartLineNumber) {\n resultStartLineNumber = otherStartLineNumber;\n resultStartColumn = otherStartColumn;\n }\n else if (resultStartLineNumber === otherStartLineNumber) {\n resultStartColumn = Math.max(resultStartColumn, otherStartColumn);\n }\n if (resultEndLineNumber > otherEndLineNumber) {\n resultEndLineNumber = otherEndLineNumber;\n resultEndColumn = otherEndColumn;\n }\n else if (resultEndLineNumber === otherEndLineNumber) {\n resultEndColumn = Math.min(resultEndColumn, otherEndColumn);\n }\n // Check if selection is now empty\n if (resultStartLineNumber > resultEndLineNumber) {\n return null;\n }\n if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {\n return null;\n }\n return new Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);\n }\n /**\n * Test if this range equals other.\n */\n equalsRange(other) {\n return Range.equalsRange(this, other);\n }\n /**\n * Test if range `a` equals `b`.\n */\n static equalsRange(a, b) {\n if (!a && !b) {\n return true;\n }\n return (!!a &&\n !!b &&\n a.startLineNumber === b.startLineNumber &&\n a.startColumn === b.startColumn &&\n a.endLineNumber === b.endLineNumber &&\n a.endColumn === b.endColumn);\n }\n /**\n * Return the end position (which will be after or equal to the start position)\n */\n getEndPosition() {\n return Range.getEndPosition(this);\n }\n /**\n * Return the end position (which will be after or equal to the start position)\n */\n static getEndPosition(range) {\n return new Position(range.endLineNumber, range.endColumn);\n }\n /**\n * Return the start position (which will be before or equal to the end position)\n */\n getStartPosition() {\n return Range.getStartPosition(this);\n }\n /**\n * Return the start position (which will be before or equal to the end position)\n */\n static getStartPosition(range) {\n return new Position(range.startLineNumber, range.startColumn);\n }\n /**\n * Transform to a user presentable string representation.\n */\n toString() {\n return '[' + this.startLineNumber + ',' + this.startColumn + ' -> ' + this.endLineNumber + ',' + this.endColumn + ']';\n }\n /**\n * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.\n */\n setEndPosition(endLineNumber, endColumn) {\n return new Range(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\n }\n /**\n * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.\n */\n setStartPosition(startLineNumber, startColumn) {\n return new Range(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\n }\n /**\n * Create a new empty range using this range's start position.\n */\n collapseToStart() {\n return Range.collapseToStart(this);\n }\n /**\n * Create a new empty range using this range's start position.\n */\n static collapseToStart(range) {\n return new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);\n }\n /**\n * Create a new empty range using this range's end position.\n */\n collapseToEnd() {\n return Range.collapseToEnd(this);\n }\n /**\n * Create a new empty range using this range's end position.\n */\n static collapseToEnd(range) {\n return new Range(range.endLineNumber, range.endColumn, range.endLineNumber, range.endColumn);\n }\n /**\n * Moves the range by the given amount of lines.\n */\n delta(lineCount) {\n return new Range(this.startLineNumber + lineCount, this.startColumn, this.endLineNumber + lineCount, this.endColumn);\n }\n // ---\n static fromPositions(start, end = start) {\n return new Range(start.lineNumber, start.column, end.lineNumber, end.column);\n }\n static lift(range) {\n if (!range) {\n return null;\n }\n return new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n }\n /**\n * Test if `obj` is an `IRange`.\n */\n static isIRange(obj) {\n return (obj\n && (typeof obj.startLineNumber === 'number')\n && (typeof obj.startColumn === 'number')\n && (typeof obj.endLineNumber === 'number')\n && (typeof obj.endColumn === 'number'));\n }\n /**\n * Test if the two ranges are touching in any way.\n */\n static areIntersectingOrTouching(a, b) {\n // Check if `a` is before `b`\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn < b.startColumn)) {\n return false;\n }\n // Check if `b` is before `a`\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn < a.startColumn)) {\n return false;\n }\n // These ranges must intersect\n return true;\n }\n /**\n * Test if the two ranges are intersecting. If the ranges are touching it returns true.\n */\n static areIntersecting(a, b) {\n // Check if `a` is before `b`\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn <= b.startColumn)) {\n return false;\n }\n // Check if `b` is before `a`\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn <= a.startColumn)) {\n return false;\n }\n // These ranges must intersect\n return true;\n }\n /**\n * A function that compares ranges, useful for sorting ranges\n * It will first compare ranges on the startPosition and then on the endPosition\n */\n static compareRangesUsingStarts(a, b) {\n if (a && b) {\n const aStartLineNumber = a.startLineNumber | 0;\n const bStartLineNumber = b.startLineNumber | 0;\n if (aStartLineNumber === bStartLineNumber) {\n const aStartColumn = a.startColumn | 0;\n const bStartColumn = b.startColumn | 0;\n if (aStartColumn === bStartColumn) {\n const aEndLineNumber = a.endLineNumber | 0;\n const bEndLineNumber = b.endLineNumber | 0;\n if (aEndLineNumber === bEndLineNumber) {\n const aEndColumn = a.endColumn | 0;\n const bEndColumn = b.endColumn | 0;\n return aEndColumn - bEndColumn;\n }\n return aEndLineNumber - bEndLineNumber;\n }\n return aStartColumn - bStartColumn;\n }\n return aStartLineNumber - bStartLineNumber;\n }\n const aExists = (a ? 1 : 0);\n const bExists = (b ? 1 : 0);\n return aExists - bExists;\n }\n /**\n * A function that compares ranges, useful for sorting ranges\n * It will first compare ranges on the endPosition and then on the startPosition\n */\n static compareRangesUsingEnds(a, b) {\n if (a.endLineNumber === b.endLineNumber) {\n if (a.endColumn === b.endColumn) {\n if (a.startLineNumber === b.startLineNumber) {\n return a.startColumn - b.startColumn;\n }\n return a.startLineNumber - b.startLineNumber;\n }\n return a.endColumn - b.endColumn;\n }\n return a.endLineNumber - b.endLineNumber;\n }\n /**\n * Test if the range spans multiple lines.\n */\n static spansMultipleLines(range) {\n return range.endLineNumber > range.startLineNumber;\n }\n toJSON() {\n return this;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Position } from './position.js';\nimport { Range } from './range.js';\n/**\n * A selection in the editor.\n * The selection is a range that has an orientation.\n */\nexport class Selection extends Range {\n constructor(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn) {\n super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);\n this.selectionStartLineNumber = selectionStartLineNumber;\n this.selectionStartColumn = selectionStartColumn;\n this.positionLineNumber = positionLineNumber;\n this.positionColumn = positionColumn;\n }\n /**\n * Transform to a human-readable representation.\n */\n toString() {\n return '[' + this.selectionStartLineNumber + ',' + this.selectionStartColumn + ' -> ' + this.positionLineNumber + ',' + this.positionColumn + ']';\n }\n /**\n * Test if equals other selection.\n */\n equalsSelection(other) {\n return (Selection.selectionsEqual(this, other));\n }\n /**\n * Test if the two selections are equal.\n */\n static selectionsEqual(a, b) {\n return (a.selectionStartLineNumber === b.selectionStartLineNumber &&\n a.selectionStartColumn === b.selectionStartColumn &&\n a.positionLineNumber === b.positionLineNumber &&\n a.positionColumn === b.positionColumn);\n }\n /**\n * Get directions (LTR or RTL).\n */\n getDirection() {\n if (this.selectionStartLineNumber === this.startLineNumber && this.selectionStartColumn === this.startColumn) {\n return 0 /* SelectionDirection.LTR */;\n }\n return 1 /* SelectionDirection.RTL */;\n }\n /**\n * Create a new selection with a different `positionLineNumber` and `positionColumn`.\n */\n setEndPosition(endLineNumber, endColumn) {\n if (this.getDirection() === 0 /* SelectionDirection.LTR */) {\n return new Selection(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\n }\n return new Selection(endLineNumber, endColumn, this.startLineNumber, this.startColumn);\n }\n /**\n * Get the position at `positionLineNumber` and `positionColumn`.\n */\n getPosition() {\n return new Position(this.positionLineNumber, this.positionColumn);\n }\n /**\n * Get the position at the start of the selection.\n */\n getSelectionStart() {\n return new Position(this.selectionStartLineNumber, this.selectionStartColumn);\n }\n /**\n * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.\n */\n setStartPosition(startLineNumber, startColumn) {\n if (this.getDirection() === 0 /* SelectionDirection.LTR */) {\n return new Selection(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\n }\n return new Selection(this.endLineNumber, this.endColumn, startLineNumber, startColumn);\n }\n // ----\n /**\n * Create a `Selection` from one or two positions\n */\n static fromPositions(start, end = start) {\n return new Selection(start.lineNumber, start.column, end.lineNumber, end.column);\n }\n /**\n * Creates a `Selection` from a range, given a direction.\n */\n static fromRange(range, direction) {\n if (direction === 0 /* SelectionDirection.LTR */) {\n return new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n }\n else {\n return new Selection(range.endLineNumber, range.endColumn, range.startLineNumber, range.startColumn);\n }\n }\n /**\n * Create a `Selection` from an `ISelection`.\n */\n static liftSelection(sel) {\n return new Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);\n }\n /**\n * `a` equals `b`.\n */\n static selectionsArrEqual(a, b) {\n if (a && !b || !a && b) {\n return false;\n }\n if (!a && !b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0, len = a.length; i < len; i++) {\n if (!this.selectionsEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n /**\n * Test if `obj` is an `ISelection`.\n */\n static isISelection(obj) {\n return (obj\n && (typeof obj.selectionStartLineNumber === 'number')\n && (typeof obj.selectionStartColumn === 'number')\n && (typeof obj.positionLineNumber === 'number')\n && (typeof obj.positionColumn === 'number'));\n }\n /**\n * Create with a direction.\n */\n static createWithDirection(startLineNumber, startColumn, endLineNumber, endColumn, direction) {\n if (direction === 0 /* SelectionDirection.LTR */) {\n return new Selection(startLineNumber, startColumn, endLineNumber, endColumn);\n }\n return new Selection(endLineNumber, endColumn, startLineNumber, startColumn);\n }\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 *--------------------------------------------------------------------------------------------*/\nlet isPseudo = (typeof document !== 'undefined' && document.location && document.location.hash.indexOf('pseudo=true') >= 0);\nconst DEFAULT_TAG = 'i-default';\nfunction _format(message, args) {\n let result;\n if (args.length === 0) {\n result = message;\n }\n else {\n result = message.replace(/\\{(\\d+)\\}/g, (match, rest) => {\n const index = rest[0];\n const arg = args[index];\n let result = match;\n if (typeof arg === 'string') {\n result = arg;\n }\n else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) {\n result = String(arg);\n }\n return result;\n });\n }\n if (isPseudo) {\n // FF3B and FF3D is the Unicode zenkaku representation for [ and ]\n result = '\\uFF3B' + result.replace(/[aouei]/g, '$&$&') + '\\uFF3D';\n }\n return result;\n}\nfunction findLanguageForModule(config, name) {\n let result = config[name];\n if (result) {\n return result;\n }\n result = config['*'];\n if (result) {\n return result;\n }\n return null;\n}\nfunction endWithSlash(path) {\n if (path.charAt(path.length - 1) === '/') {\n return path;\n }\n return path + '/';\n}\nasync function getMessagesFromTranslationsService(translationServiceUrl, language, name) {\n const url = endWithSlash(translationServiceUrl) + endWithSlash(language) + 'vscode/' + endWithSlash(name);\n const res = await fetch(url);\n if (res.ok) {\n const messages = await res.json();\n return messages;\n }\n throw new Error(`${res.status} - ${res.statusText}`);\n}\nfunction createScopedLocalize(scope) {\n return function (idx, defaultValue) {\n const restArgs = Array.prototype.slice.call(arguments, 2);\n return _format(scope[idx], restArgs);\n };\n}\nfunction createScopedLocalize2(scope) {\n return (idx, defaultValue, ...args) => ({\n value: _format(scope[idx], args),\n original: _format(defaultValue, args)\n });\n}\n/**\n * @skipMangle\n */\nexport function localize(data, message, ...args) {\n return _format(message, args);\n}\nlet locale = undefined;\nlet translations = {};\nexport function setLocale(_locale, _translations) {\n locale = _locale;\n translations = _translations;\n}\n/**\n * @skipMangle\n */\nexport function localizeWithPath(path, data, defaultMessage, ...args) {\n const key = typeof data === 'object' ? data.key : data;\n const message = (translations[path] ?? {})[key] ?? defaultMessage;\n return _format(message, args);\n}\n/**\n * @skipMangle\n */\nexport function localize2WithPath(path, data, defaultMessage, ...args) {\n const key = typeof data === 'object' ? data.key : data;\n const message = (translations[path] ?? {})[key] ?? defaultMessage;\n return {\n value: _format(message, args),\n original: _format(defaultMessage, args)\n };\n}\n/**\n * @skipMangle\n */\nexport function localize2(data, message, ...args) {\n const original = _format(message, args);\n return {\n value: original,\n original\n };\n}\n/**\n * @skipMangle\n */\nexport function getConfiguredDefaultLocale(_) {\n // This returns undefined because this implementation isn't used and is overwritten by the loader\n // when loaded.\n return locale;\n}\n/**\n * @skipMangle\n */\nexport function setPseudoTranslation(value) {\n isPseudo = value;\n}\n/**\n * Invoked in a built product at run-time\n * @skipMangle\n */\nexport function create(key, data) {\n return {\n localize: createScopedLocalize(data[key]),\n localize2: createScopedLocalize2(data[key]),\n getConfiguredDefaultLocale: data.getConfiguredDefaultLocale ?? ((_) => undefined)\n };\n}\n/**\n * Invoked by the loader at run-time\n * @skipMangle\n */\nexport function load(name, req, load, config) {\n const pluginConfig = config['vs/nls'] ?? {};\n if (!name || name.length === 0) {\n // TODO: We need to give back the mangled names here\n return load({\n localize: localize,\n localize2: localize2,\n getConfiguredDefaultLocale: () => pluginConfig.availableLanguages?.['*']\n });\n }\n const language = pluginConfig.availableLanguages ? findLanguageForModule(pluginConfig.availableLanguages, name) : null;\n const useDefaultLanguage = language === null || language === DEFAULT_TAG;\n let suffix = '.nls';\n if (!useDefaultLanguage) {\n suffix = suffix + '.' + language;\n }\n const messagesLoaded = (messages) => {\n if (Array.isArray(messages)) {\n messages.localize = createScopedLocalize(messages);\n messages.localize2 = createScopedLocalize2(messages);\n }\n else {\n messages.localize = createScopedLocalize(messages[name]);\n messages.localize2 = createScopedLocalize2(messages[name]);\n }\n messages.getConfiguredDefaultLocale = () => pluginConfig.availableLanguages?.['*'];\n load(messages);\n };\n if (typeof pluginConfig.loadBundle === 'function') {\n pluginConfig.loadBundle(name, language, (err, messages) => {\n // We have an error. Load the English default strings to not fail\n if (err) {\n req([name + '.nls'], messagesLoaded);\n }\n else {\n messagesLoaded(messages);\n }\n });\n }\n else if (pluginConfig.translationServiceUrl && !useDefaultLanguage) {\n (async () => {\n try {\n const messages = await getMessagesFromTranslationsService(pluginConfig.translationServiceUrl, language, name);\n return messagesLoaded(messages);\n }\n catch (err) {\n // Language is already as generic as it gets, so require default messages\n if (!language.includes('-')) {\n console.error(err);\n return req([name + '.nls'], messagesLoaded);\n }\n try {\n // Since there is a dash, the language configured is a specific sub-language of the same generic language.\n // Since we were unable to load the specific language, try to load the generic language. Ex. we failed to find a\n // Swiss German (de-CH), so try to load the generic German (de) messages instead.\n const genericLanguage = language.split('-')[0];\n const messages = await getMessagesFromTranslationsService(pluginConfig.translationServiceUrl, genericLanguage, name);\n // We got some messages, so we configure the configuration to use the generic language for this session.\n pluginConfig.availableLanguages ?? (pluginConfig.availableLanguages = {});\n pluginConfig.availableLanguages['*'] = genericLanguage;\n return messagesLoaded(messages);\n }\n catch (err) {\n console.error(err);\n return req([name + '.nls'], messagesLoaded);\n }\n }\n })();\n }\n else {\n req([name + suffix], messagesLoaded, (err) => {\n if (suffix === '.nls') {\n console.error('Failed trying to load default language strings', err);\n return;\n }\n console.error(`Failed to load message bundle for language ${language}. Falling back to the default language:`, err);\n req([name + '.nls'], messagesLoaded);\n });\n }\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 *--------------------------------------------------------------------------------------------*/\nexport function ensureCodeWindow(targetWindow, fallbackWindowId) {\n const codeWindow = targetWindow;\n if (typeof codeWindow.vscodeWindowId !== 'number') {\n Object.defineProperty(codeWindow, 'vscodeWindowId', {\n get: () => fallbackWindowId\n });\n }\n}\n// eslint-disable-next-line no-restricted-globals\nexport const mainWindow = window;\n/**\n * @deprecated to support multi-window scenarios, use `DOM.mainWindow`\n * if you target the main global window or use helpers such as `DOM.getWindow()`\n * or `DOM.getActiveWindow()` to obtain the correct window for the context you are in.\n */\nexport const $window = mainWindow;\nexport function isAuxiliaryWindow(obj) {\n if (obj === mainWindow) {\n return false;\n }\n const candidate = obj;\n return typeof candidate?.vscodeWindowId === 'number';\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// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\nexport class ErrorHandler {\n constructor() {\n this.listeners = [];\n this.unexpectedErrorHandler = function (e) {\n setTimeout(() => {\n if (e.stack) {\n if (ErrorNoTelemetry.isErrorNoTelemetry(e)) {\n throw new ErrorNoTelemetry(e.message + '\\n\\n' + e.stack);\n }\n throw new Error(e.message + '\\n\\n' + e.stack);\n }\n throw e;\n }, 0);\n };\n }\n addListener(listener) {\n this.listeners.push(listener);\n return () => {\n this._removeListener(listener);\n };\n }\n emit(e) {\n this.listeners.forEach((listener) => {\n listener(e);\n });\n }\n _removeListener(listener) {\n this.listeners.splice(this.listeners.indexOf(listener), 1);\n }\n setUnexpectedErrorHandler(newUnexpectedErrorHandler) {\n this.unexpectedErrorHandler = newUnexpectedErrorHandler;\n }\n getUnexpectedErrorHandler() {\n return this.unexpectedErrorHandler;\n }\n onUnexpectedError(e) {\n this.unexpectedErrorHandler(e);\n this.emit(e);\n }\n // For external errors, we don't want the listeners to be called\n onUnexpectedExternalError(e) {\n this.unexpectedErrorHandler(e);\n }\n}\nexport const errorHandler = new ErrorHandler();\n/** @skipMangle */\nexport function setUnexpectedErrorHandler(newUnexpectedErrorHandler) {\n errorHandler.setUnexpectedErrorHandler(newUnexpectedErrorHandler);\n}\n/**\n * Returns if the error is a SIGPIPE error. SIGPIPE errors should generally be\n * logged at most once, to avoid a loop.\n *\n * @see https://github.com/microsoft/vscode-remote-release/issues/6481\n */\nexport function isSigPipeError(e) {\n if (!e || typeof e !== 'object') {\n return false;\n }\n const cast = e;\n return cast.code === 'EPIPE' && cast.syscall?.toUpperCase() === 'WRITE';\n}\nexport function onUnexpectedError(e) {\n // ignore errors from cancelled promises\n if (!isCancellationError(e)) {\n errorHandler.onUnexpectedError(e);\n }\n return undefined;\n}\nexport function onUnexpectedExternalError(e) {\n // ignore errors from cancelled promises\n if (!isCancellationError(e)) {\n errorHandler.onUnexpectedExternalError(e);\n }\n return undefined;\n}\nexport function transformErrorForSerialization(error) {\n if (error instanceof Error) {\n const { name, message } = error;\n const stack = error.stacktrace || error.stack;\n return {\n $isError: true,\n name,\n message,\n stack,\n noTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error)\n };\n }\n // return as is\n return error;\n}\nconst canceledName = 'Canceled';\n/**\n * Checks if the given error is a promise in canceled state\n */\nexport function isCancellationError(error) {\n if (error instanceof CancellationError) {\n return true;\n }\n return error instanceof Error && error.name === canceledName && error.message === canceledName;\n}\n// !!!IMPORTANT!!!\n// Do NOT change this class because it is also used as an API-type.\nexport class CancellationError extends Error {\n constructor() {\n super(canceledName);\n this.name = this.message;\n }\n}\n/**\n * @deprecated use {@link CancellationError `new CancellationError()`} instead\n */\nexport function canceled() {\n const error = new Error(canceledName);\n error.name = error.message;\n return error;\n}\nexport function illegalArgument(name) {\n if (name) {\n return new Error(`Illegal argument: ${name}`);\n }\n else {\n return new Error('Illegal argument');\n }\n}\nexport function illegalState(name) {\n if (name) {\n return new Error(`Illegal state: ${name}`);\n }\n else {\n return new Error('Illegal state');\n }\n}\nexport class ReadonlyError extends TypeError {\n constructor(name) {\n super(name ? `${name} is read-only and cannot be changed` : 'Cannot change read-only property');\n }\n}\nexport function getErrorMessage(err) {\n if (!err) {\n return 'Error';\n }\n if (err.message) {\n return err.message;\n }\n if (err.stack) {\n return err.stack.split('\\n')[0];\n }\n return String(err);\n}\nexport class NotImplementedError extends Error {\n constructor(message) {\n super('NotImplemented');\n if (message) {\n this.message = message;\n }\n }\n}\nexport class NotSupportedError extends Error {\n constructor(message) {\n super('NotSupported');\n if (message) {\n this.message = message;\n }\n }\n}\nexport class ExpectedError extends Error {\n constructor() {\n super(...arguments);\n this.isExpected = true;\n }\n}\n/**\n * Error that when thrown won't be logged in telemetry as an unhandled error.\n */\nexport class ErrorNoTelemetry extends Error {\n constructor(msg) {\n super(msg);\n this.name = 'CodeExpectedError';\n }\n static fromError(err) {\n if (err instanceof ErrorNoTelemetry) {\n return err;\n }\n const result = new ErrorNoTelemetry();\n result.message = err.message;\n result.stack = err.stack;\n return result;\n }\n static isErrorNoTelemetry(err) {\n return err.name === 'CodeExpectedError';\n }\n}\n/**\n * This error indicates a bug.\n * Do not throw this for invalid user input.\n * Only catch this error to recover gracefully from bugs.\n */\nexport class BugIndicatingError extends Error {\n constructor(message) {\n super(message || 'An unexpected bug occurred.');\n Object.setPrototypeOf(this, BugIndicatingError.prototype);\n // Because we know for sure only buggy code throws this,\n // we definitely want to break here and fix the bug.\n // eslint-disable-next-line no-debugger\n // debugger;\n }\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/**\n * Given a function, returns a function that is only calling that function once.\n */\nexport function createSingleCallFunction(fn, fnDidRunCallback) {\n const _this = this;\n let didCall = false;\n let result;\n return function () {\n if (didCall) {\n return result;\n }\n didCall = true;\n if (fnDidRunCallback) {\n try {\n result = fn.apply(_this, arguments);\n }\n finally {\n fnDidRunCallback();\n }\n }\n else {\n result = fn.apply(_this, arguments);\n }\n return result;\n };\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 *--------------------------------------------------------------------------------------------*/\nexport function findLast(array, predicate, fromIdx) {\n const idx = findLastIdx(array, predicate);\n if (idx === -1) {\n return undefined;\n }\n return array[idx];\n}\nexport function findLastIdx(array, predicate, fromIndex = array.length - 1) {\n for (let i = fromIndex; i >= 0; i--) {\n const element = array[i];\n if (predicate(element)) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `undefined` if no item matches, otherwise the last item that matches the predicate.\n */\nexport function findLastMonotonous(array, predicate) {\n const idx = findLastIdxMonotonous(array, predicate);\n return idx === -1 ? undefined : array[idx];\n}\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate.\n */\nexport function findLastIdxMonotonous(array, predicate, startIdx = 0, endIdxEx = array.length) {\n let i = startIdx;\n let j = endIdxEx;\n while (i < j) {\n const k = Math.floor((i + j) / 2);\n if (predicate(array[k])) {\n i = k + 1;\n }\n else {\n j = k;\n }\n }\n return i - 1;\n}\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `undefined` if no item matches, otherwise the first item that matches the predicate.\n */\nexport function findFirstMonotonous(array, predicate) {\n const idx = findFirstIdxMonotonousOrArrLen(array, predicate);\n return idx === array.length ? undefined : array[idx];\n}\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate.\n */\nexport function findFirstIdxMonotonousOrArrLen(array, predicate, startIdx = 0, endIdxEx = array.length) {\n let i = startIdx;\n let j = endIdxEx;\n while (i < j) {\n const k = Math.floor((i + j) / 2);\n if (predicate(array[k])) {\n j = k;\n }\n else {\n i = k + 1;\n }\n }\n return i;\n}\nexport function findFirstIdxMonotonous(array, predicate, startIdx = 0, endIdxEx = array.length) {\n const idx = findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx);\n return idx === array.length ? -1 : idx;\n}\n/**\n * Use this when\n * * You have a sorted array\n * * You query this array with a monotonous predicate to find the last item that has a certain property.\n * * You query this array multiple times with monotonous predicates that get weaker and weaker.\n */\nexport class MonotonousArray {\n constructor(_array) {\n this._array = _array;\n this._findLastMonotonousLastIdx = 0;\n }\n /**\n * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.\n */\n findLastMonotonous(predicate) {\n if (MonotonousArray.assertInvariants) {\n if (this._prevFindLastPredicate) {\n for (const item of this._array) {\n if (this._prevFindLastPredicate(item) && !predicate(item)) {\n throw new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');\n }\n }\n }\n this._prevFindLastPredicate = predicate;\n }\n const idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);\n this._findLastMonotonousLastIdx = idx + 1;\n return idx === -1 ? undefined : this._array[idx];\n }\n}\nMonotonousArray.assertInvariants = false;\n/**\n * Returns the first item that is equal to or greater than every other item.\n*/\nexport function findFirstMaxBy(array, comparator) {\n if (array.length === 0) {\n return undefined;\n }\n let max = array[0];\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, max) > 0) {\n max = item;\n }\n }\n return max;\n}\n/**\n * Returns the last item that is equal to or greater than every other item.\n*/\nexport function findLastMaxBy(array, comparator) {\n if (array.length === 0) {\n return undefined;\n }\n let max = array[0];\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, max) >= 0) {\n max = item;\n }\n }\n return max;\n}\n/**\n * Returns the first item that is equal to or less than every other item.\n*/\nexport function findFirstMinBy(array, comparator) {\n return findFirstMaxBy(array, (a, b) => -comparator(a, b));\n}\nexport function findMaxIdxBy(array, comparator) {\n if (array.length === 0) {\n return -1;\n }\n let maxIdx = 0;\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, array[maxIdx]) > 0) {\n maxIdx = i;\n }\n }\n return maxIdx;\n}\n/**\n * Returns the first mapped value of the array which is not undefined.\n */\nexport function mapFindFirst(items, mapFn) {\n for (const value of items) {\n const mapped = mapFn(value);\n if (mapped !== undefined) {\n return mapped;\n }\n }\n return undefined;\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 *--------------------------------------------------------------------------------------------*/\nimport { CancellationError } from './errors.js';\nimport { findFirstIdxMonotonousOrArrLen } from './arraysFind.js';\n/**\n * Returns the last element of an array.\n * @param array The array.\n * @param n Which element from the end (default is zero).\n */\nexport function tail(array, n = 0) {\n return array[array.length - (1 + n)];\n}\nexport function tail2(arr) {\n if (arr.length === 0) {\n throw new Error('Invalid tail call');\n }\n return [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\nexport function equals(one, other, itemEquals = (a, b) => a === b) {\n if (one === other) {\n return true;\n }\n if (!one || !other) {\n return false;\n }\n if (one.length !== other.length) {\n return false;\n }\n for (let i = 0, len = one.length; i < len; i++) {\n if (!itemEquals(one[i], other[i])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Remove the element at `index` by replacing it with the last element. This is faster than `splice`\n * but changes the order of the array\n */\nexport function removeFastWithoutKeepingOrder(array, index) {\n const last = array.length - 1;\n if (index < last) {\n array[index] = array[last];\n }\n array.pop();\n}\n/**\n * Performs a binary search algorithm over a sorted array.\n *\n * @param array The array being searched.\n * @param key The value we search for.\n * @param comparator A function that takes two array elements and returns zero\n * if they are equal, a negative number if the first element precedes the\n * second one in the sorting order, or a positive number if the second element\n * precedes the first one.\n * @return See {@link binarySearch2}\n */\nexport function binarySearch(array, key, comparator) {\n return binarySearch2(array.length, i => comparator(array[i], key));\n}\n/**\n * Performs a binary search algorithm over a sorted collection. Useful for cases\n * when we need to perform a binary search over something that isn't actually an\n * array, and converting data to an array would defeat the use of binary search\n * in the first place.\n *\n * @param length The collection length.\n * @param compareToKey A function that takes an index of an element in the\n * collection and returns zero if the value at this index is equal to the\n * search key, a negative number if the value precedes the search key in the\n * sorting order, or a positive number if the search key precedes the value.\n * @return A non-negative index of an element, if found. If not found, the\n * result is -(n+1) (or ~n, using bitwise notation), where n is the index\n * where the key should be inserted to maintain the sorting order.\n */\nexport function binarySearch2(length, compareToKey) {\n let low = 0, high = length - 1;\n while (low <= high) {\n const mid = ((low + high) / 2) | 0;\n const comp = compareToKey(mid);\n if (comp < 0) {\n low = mid + 1;\n }\n else if (comp > 0) {\n high = mid - 1;\n }\n else {\n return mid;\n }\n }\n return -(low + 1);\n}\nexport function quickSelect(nth, data, compare) {\n nth = nth | 0;\n if (nth >= data.length) {\n throw new TypeError('invalid index');\n }\n const pivotValue = data[Math.floor(data.length * Math.random())];\n const lower = [];\n const higher = [];\n const pivots = [];\n for (const value of data) {\n const val = compare(value, pivotValue);\n if (val < 0) {\n lower.push(value);\n }\n else if (val > 0) {\n higher.push(value);\n }\n else {\n pivots.push(value);\n }\n }\n if (nth < lower.length) {\n return quickSelect(nth, lower, compare);\n }\n else if (nth < lower.length + pivots.length) {\n return pivots[0];\n }\n else {\n return quickSelect(nth - (lower.length + pivots.length), higher, compare);\n }\n}\nexport function groupBy(data, compare) {\n const result = [];\n let currentGroup = undefined;\n for (const element of data.slice(0).sort(compare)) {\n if (!currentGroup || compare(currentGroup[0], element) !== 0) {\n currentGroup = [element];\n result.push(currentGroup);\n }\n else {\n currentGroup.push(element);\n }\n }\n return result;\n}\n/**\n * Splits the given items into a list of (non-empty) groups.\n * `shouldBeGrouped` is used to decide if two consecutive items should be in the same group.\n * The order of the items is preserved.\n */\nexport function* groupAdjacentBy(items, shouldBeGrouped) {\n let currentGroup;\n let last;\n for (const item of items) {\n if (last !== undefined && shouldBeGrouped(last, item)) {\n currentGroup.push(item);\n }\n else {\n if (currentGroup) {\n yield currentGroup;\n }\n currentGroup = [item];\n }\n last = item;\n }\n if (currentGroup) {\n yield currentGroup;\n }\n}\nexport function forEachAdjacent(arr, f) {\n for (let i = 0; i <= arr.length; i++) {\n f(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);\n }\n}\nexport function forEachWithNeighbors(arr, f) {\n for (let i = 0; i < arr.length; i++) {\n f(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);\n }\n}\n/**\n * Diffs two *sorted* arrays and computes the splices which apply the diff.\n */\nexport function sortedDiff(before, after, compare) {\n const result = [];\n function pushSplice(start, deleteCount, toInsert) {\n if (deleteCount === 0 && toInsert.length === 0) {\n return;\n }\n const latest = result[result.length - 1];\n if (latest && latest.start + latest.deleteCount === start) {\n latest.deleteCount += deleteCount;\n latest.toInsert.push(...toInsert);\n }\n else {\n result.push({ start, deleteCount, toInsert });\n }\n }\n let beforeIdx = 0;\n let afterIdx = 0;\n while (true) {\n if (beforeIdx === before.length) {\n pushSplice(beforeIdx, 0, after.slice(afterIdx));\n break;\n }\n if (afterIdx === after.length) {\n pushSplice(beforeIdx, before.length - beforeIdx, []);\n break;\n }\n const beforeElement = before[beforeIdx];\n const afterElement = after[afterIdx];\n const n = compare(beforeElement, afterElement);\n if (n === 0) {\n // equal\n beforeIdx += 1;\n afterIdx += 1;\n }\n else if (n < 0) {\n // beforeElement is smaller -> before element removed\n pushSplice(beforeIdx, 1, []);\n beforeIdx += 1;\n }\n else if (n > 0) {\n // beforeElement is greater -> after element added\n pushSplice(beforeIdx, 0, [afterElement]);\n afterIdx += 1;\n }\n }\n return result;\n}\n/**\n * Takes two *sorted* arrays and computes their delta (removed, added elements).\n * Finishes in `Math.min(before.length, after.length)` steps.\n */\nexport function delta(before, after, compare) {\n const splices = sortedDiff(before, after, compare);\n const removed = [];\n const added = [];\n for (const splice of splices) {\n removed.push(...before.slice(splice.start, splice.start + splice.deleteCount));\n added.push(...splice.toInsert);\n }\n return { removed, added };\n}\n/**\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @return The first n elements from array when sorted with compare.\n */\nexport function top(array, compare, n) {\n if (n === 0) {\n return [];\n }\n const result = array.slice(0, n).sort(compare);\n topStep(array, compare, result, n, array.length);\n return result;\n}\n/**\n * Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.\n *\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @param batch The number of elements to examine before yielding to the event loop.\n * @return The first n elements from array when sorted with compare.\n */\nexport function topAsync(array, compare, n, batch, token) {\n if (n === 0) {\n return Promise.resolve([]);\n }\n return new Promise((resolve, reject) => {\n (async () => {\n const o = array.length;\n const result = array.slice(0, n).sort(compare);\n for (let i = n, m = Math.min(n + batch, o); i < o; i = m, m = Math.min(m + batch, o)) {\n if (i > n) {\n await new Promise(resolve => setTimeout(resolve)); // any other delay function would starve I/O\n }\n if (token && token.isCancellationRequested) {\n throw new CancellationError();\n }\n topStep(array, compare, result, i, m);\n }\n return result;\n })()\n .then(resolve, reject);\n });\n}\nfunction topStep(array, compare, result, i, m) {\n for (const n = result.length; i < m; i++) {\n const element = array[i];\n if (compare(element, result[n - 1]) < 0) {\n result.pop();\n const j = findFirstIdxMonotonousOrArrLen(result, e => compare(element, e) < 0);\n result.splice(j, 0, element);\n }\n }\n}\n/**\n * @returns New array with all falsy values removed. The original array IS NOT modified.\n */\nexport function coalesce(array) {\n return array.filter(e => !!e);\n}\n/**\n * Remove all falsy values from `array`. The original array IS modified.\n */\nexport function coalesceInPlace(array) {\n let to = 0;\n for (let i = 0; i < array.length; i++) {\n if (!!array[i]) {\n array[to] = array[i];\n to += 1;\n }\n }\n array.length = to;\n}\n/**\n * @deprecated Use `Array.copyWithin` instead\n */\nexport function move(array, from, to) {\n array.splice(to, 0, array.splice(from, 1)[0]);\n}\n/**\n * @returns false if the provided object is an array and not empty.\n */\nexport function isFalsyOrEmpty(obj) {\n return !Array.isArray(obj) || obj.length === 0;\n}\nexport function isNonEmptyArray(obj) {\n return Array.isArray(obj) && obj.length > 0;\n}\n/**\n * Removes duplicates from the given array. The optional keyFn allows to specify\n * how elements are checked for equality by returning an alternate value for each.\n */\nexport function distinct(array, keyFn = value => value) {\n const seen = new Set();\n return array.filter(element => {\n const key = keyFn(element);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n}\nexport function uniqueFilter(keyFn) {\n const seen = new Set();\n return element => {\n const key = keyFn(element);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n };\n}\nexport function firstOrDefault(array, notFoundValue) {\n return array.length > 0 ? array[0] : notFoundValue;\n}\nexport function lastOrDefault(array, notFoundValue) {\n return array.length > 0 ? array[array.length - 1] : notFoundValue;\n}\nexport function commonPrefixLength(one, other, equals = (a, b) => a === b) {\n let result = 0;\n for (let i = 0, len = Math.min(one.length, other.length); i < len && equals(one[i], other[i]); i++) {\n result++;\n }\n return result;\n}\n/**\n * @deprecated Use `[].flat()`\n */\nexport function flatten(arr) {\n return [].concat(...arr);\n}\nexport function range(arg, to) {\n let from = typeof to === 'number' ? arg : 0;\n if (typeof to === 'number') {\n from = arg;\n }\n else {\n from = 0;\n to = arg;\n }\n const result = [];\n if (from <= to) {\n for (let i = from; i < to; i++) {\n result.push(i);\n }\n }\n else {\n for (let i = from; i > to; i--) {\n result.push(i);\n }\n }\n return result;\n}\nexport function index(array, indexer, mapper) {\n return array.reduce((r, t) => {\n r[indexer(t)] = mapper ? mapper(t) : t;\n return r;\n }, Object.create(null));\n}\n/**\n * Inserts an element into an array. Returns a function which, when\n * called, will remove that element from the array.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function insert(array, element) {\n array.push(element);\n return () => remove(array, element);\n}\n/**\n * Removes an element from an array if it can be found.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function remove(array, element) {\n const index = array.indexOf(element);\n if (index > -1) {\n array.splice(index, 1);\n return element;\n }\n return undefined;\n}\n/**\n * Insert `insertArr` inside `target` at `insertIndex`.\n * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array\n */\nexport function arrayInsert(target, insertIndex, insertArr) {\n const before = target.slice(0, insertIndex);\n const after = target.slice(insertIndex);\n return before.concat(insertArr, after);\n}\n/**\n * Uses Fisher-Yates shuffle to shuffle the given array\n */\nexport function shuffle(array, _seed) {\n let rand;\n if (typeof _seed === 'number') {\n let seed = _seed;\n // Seeded random number generator in JS. Modified from:\n // https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript\n rand = () => {\n const x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias\n return x - Math.floor(x);\n };\n }\n else {\n rand = Math.random;\n }\n for (let i = array.length - 1; i > 0; i -= 1) {\n const j = Math.floor(rand() * (i + 1));\n const temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}\n/**\n * Pushes an element to the start of the array, if found.\n */\nexport function pushToStart(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.unshift(value);\n }\n}\n/**\n * Pushes an element to the end of the array, if found.\n */\nexport function pushToEnd(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.push(value);\n }\n}\nexport function pushMany(arr, items) {\n for (const item of items) {\n arr.push(item);\n }\n}\nexport function mapArrayOrNot(items, fn) {\n return Array.isArray(items) ?\n items.map(fn) :\n fn(items);\n}\nexport function asArray(x) {\n return Array.isArray(x) ? x : [x];\n}\nexport function getRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}\n/**\n * Insert the new items in the array.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start inserting elements.\n * @param newItems The items to be inserted\n */\nexport function insertInto(array, start, newItems) {\n const startIdx = getActualStartIndex(array, start);\n const originalLength = array.length;\n const newItemsLength = newItems.length;\n array.length = originalLength + newItemsLength;\n // Move the items after the start index, start from the end so that we don't overwrite any value.\n for (let i = originalLength - 1; i >= startIdx; i--) {\n array[i + newItemsLength] = array[i];\n }\n for (let i = 0; i < newItemsLength; i++) {\n array[i + startIdx] = newItems[i];\n }\n}\n/**\n * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it\n * can only support limited number of items due to the maximum call stack size limit.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns An array containing the elements that were deleted.\n */\nexport function splice(array, start, deleteCount, newItems) {\n const index = getActualStartIndex(array, start);\n let result = array.splice(index, deleteCount);\n if (result === undefined) {\n // see https://bugs.webkit.org/show_bug.cgi?id=261140\n result = [];\n }\n insertInto(array, index, newItems);\n return result;\n}\n/**\n * Determine the actual start index (same logic as the native splice() or slice())\n * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.\n * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0.\n * @param array The target array.\n * @param start The operation index.\n */\nfunction getActualStartIndex(array, start) {\n return start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\n}\nexport var CompareResult;\n(function (CompareResult) {\n function isLessThan(result) {\n return result < 0;\n }\n CompareResult.isLessThan = isLessThan;\n function isLessThanOrEqual(result) {\n return result <= 0;\n }\n CompareResult.isLessThanOrEqual = isLessThanOrEqual;\n function isGreaterThan(result) {\n return result > 0;\n }\n CompareResult.isGreaterThan = isGreaterThan;\n function isNeitherLessOrGreaterThan(result) {\n return result === 0;\n }\n CompareResult.isNeitherLessOrGreaterThan = isNeitherLessOrGreaterThan;\n CompareResult.greaterThan = 1;\n CompareResult.lessThan = -1;\n CompareResult.neitherLessOrGreaterThan = 0;\n})(CompareResult || (CompareResult = {}));\nexport function compareBy(selector, comparator) {\n return (a, b) => comparator(selector(a), selector(b));\n}\nexport function tieBreakComparators(...comparators) {\n return (item1, item2) => {\n for (const comparator of comparators) {\n const result = comparator(item1, item2);\n if (!CompareResult.isNeitherLessOrGreaterThan(result)) {\n return result;\n }\n }\n return CompareResult.neitherLessOrGreaterThan;\n };\n}\n/**\n * The natural order on numbers.\n*/\nexport const numberComparator = (a, b) => a - b;\nexport const booleanComparator = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0);\nexport function reverseOrder(comparator) {\n return (a, b) => -comparator(a, b);\n}\nexport class ArrayQueue {\n /**\n * Constructs a queue that is backed by the given array. Runtime is O(1).\n */\n constructor(items) {\n this.items = items;\n this.firstIdx = 0;\n this.lastIdx = this.items.length - 1;\n }\n get length() {\n return this.lastIdx - this.firstIdx + 1;\n }\n /**\n * Consumes elements from the beginning of the queue as long as the predicate returns true.\n * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\n */\n takeWhile(predicate) {\n // P(k) := k <= this.lastIdx && predicate(this.items[k])\n // Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\n let startIdx = this.firstIdx;\n while (startIdx < this.items.length && predicate(this.items[startIdx])) {\n startIdx++;\n }\n const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\n this.firstIdx = startIdx;\n return result;\n }\n /**\n * Consumes elements from the end of the queue as long as the predicate returns true.\n * If no elements were consumed, `null` is returned.\n * The result has the same order as the underlying array!\n */\n takeFromEndWhile(predicate) {\n // P(k) := this.firstIdx >= k && predicate(this.items[k])\n // Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\n let endIdx = this.lastIdx;\n while (endIdx >= 0 && predicate(this.items[endIdx])) {\n endIdx--;\n }\n const result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\n this.lastIdx = endIdx;\n return result;\n }\n peek() {\n if (this.length === 0) {\n return undefined;\n }\n return this.items[this.firstIdx];\n }\n peekLast() {\n if (this.length === 0) {\n return undefined;\n }\n return this.items[this.lastIdx];\n }\n dequeue() {\n const result = this.items[this.firstIdx];\n this.firstIdx++;\n return result;\n }\n removeLast() {\n const result = this.items[this.lastIdx];\n this.lastIdx--;\n return result;\n }\n takeCount(count) {\n const result = this.items.slice(this.firstIdx, this.firstIdx + count);\n this.firstIdx += count;\n return result;\n }\n}\n/**\n * This class is faster than an iterator and array for lazy computed data.\n*/\nexport class CallbackIterable {\n constructor(\n /**\n * Calls the callback for every item.\n * Stops when the callback returns false.\n */\n iterate) {\n this.iterate = iterate;\n }\n forEach(handler) {\n this.iterate(item => { handler(item); return true; });\n }\n toArray() {\n const result = [];\n this.iterate(item => { result.push(item); return true; });\n return result;\n }\n filter(predicate) {\n return new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true));\n }\n map(mapFn) {\n return new CallbackIterable(cb => this.iterate(item => cb(mapFn(item))));\n }\n some(predicate) {\n let result = false;\n this.iterate(item => { result = predicate(item); return !result; });\n return result;\n }\n findFirst(predicate) {\n let result;\n this.iterate(item => {\n if (predicate(item)) {\n result = item;\n return false;\n }\n return true;\n });\n return result;\n }\n findLast(predicate) {\n let result;\n this.iterate(item => {\n if (predicate(item)) {\n result = item;\n }\n return true;\n });\n return result;\n }\n findLastMaxBy(comparator) {\n let result;\n let first = true;\n this.iterate(item => {\n if (first || CompareResult.isGreaterThan(comparator(item, result))) {\n first = false;\n result = item;\n }\n return true;\n });\n return result;\n }\n}\nCallbackIterable.empty = new CallbackIterable(_callback => { });\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/**\n * Groups the collection into a dictionary based on the provided\n * group function.\n */\nexport function groupBy(data, groupFn) {\n const result = Object.create(null);\n for (const element of data) {\n const key = groupFn(element);\n let target = result[key];\n if (!target) {\n target = result[key] = [];\n }\n target.push(element);\n }\n return result;\n}\nexport function diffSets(before, after) {\n const removed = [];\n const added = [];\n for (const element of before) {\n if (!after.has(element)) {\n removed.push(element);\n }\n }\n for (const element of after) {\n if (!before.has(element)) {\n added.push(element);\n }\n }\n return { removed, added };\n}\nexport function diffMaps(before, after) {\n const removed = [];\n const added = [];\n for (const [index, value] of before) {\n if (!after.has(index)) {\n removed.push(value);\n }\n }\n for (const [index, value] of after) {\n if (!before.has(index)) {\n added.push(value);\n }\n }\n return { removed, added };\n}\n/**\n * Computes the intersection of two sets.\n *\n * @param setA - The first set.\n * @param setB - The second iterable.\n * @returns A new set containing the elements that are in both `setA` and `setB`.\n */\nexport function intersection(setA, setB) {\n const result = new Set();\n for (const elem of setB) {\n if (setA.has(elem)) {\n result.add(elem);\n }\n }\n return result;\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 *--------------------------------------------------------------------------------------------*/\nvar _a, _b, _c;\nexport function getOrSet(map, key, value) {\n let result = map.get(key);\n if (result === undefined) {\n result = value;\n map.set(key, result);\n }\n return result;\n}\nexport function mapToString(map) {\n const entries = [];\n map.forEach((value, key) => {\n entries.push(`${key} => ${value}`);\n });\n return `Map(${map.size}) {${entries.join(', ')}}`;\n}\nexport function setToString(set) {\n const entries = [];\n set.forEach(value => {\n entries.push(value);\n });\n return `Set(${set.size}) {${entries.join(', ')}}`;\n}\nclass ResourceMapEntry {\n constructor(uri, value) {\n this.uri = uri;\n this.value = value;\n }\n}\nfunction isEntries(arg) {\n return Array.isArray(arg);\n}\nexport class ResourceMap {\n constructor(arg, toKey) {\n this[_a] = 'ResourceMap';\n if (arg instanceof ResourceMap) {\n this.map = new Map(arg.map);\n this.toKey = toKey ?? ResourceMap.defaultToKey;\n }\n else if (isEntries(arg)) {\n this.map = new Map();\n this.toKey = toKey ?? ResourceMap.defaultToKey;\n for (const [resource, value] of arg) {\n this.set(resource, value);\n }\n }\n else {\n this.map = new Map();\n this.toKey = arg ?? ResourceMap.defaultToKey;\n }\n }\n set(resource, value) {\n this.map.set(this.toKey(resource), new ResourceMapEntry(resource, value));\n return this;\n }\n get(resource) {\n return this.map.get(this.toKey(resource))?.value;\n }\n has(resource) {\n return this.map.has(this.toKey(resource));\n }\n get size() {\n return this.map.size;\n }\n clear() {\n this.map.clear();\n }\n delete(resource) {\n return this.map.delete(this.toKey(resource));\n }\n forEach(clb, thisArg) {\n if (typeof thisArg !== 'undefined') {\n clb = clb.bind(thisArg);\n }\n for (const [_, entry] of this.map) {\n clb(entry.value, entry.uri, this);\n }\n }\n *values() {\n for (const entry of this.map.values()) {\n yield entry.value;\n }\n }\n *keys() {\n for (const entry of this.map.values()) {\n yield entry.uri;\n }\n }\n *entries() {\n for (const entry of this.map.values()) {\n yield [entry.uri, entry.value];\n }\n }\n *[(_a = Symbol.toStringTag, Symbol.iterator)]() {\n for (const [, entry] of this.map) {\n yield [entry.uri, entry.value];\n }\n }\n}\nResourceMap.defaultToKey = (resource) => resource.toString();\nexport class ResourceSet {\n constructor(entriesOrKey, toKey) {\n this[_b] = 'ResourceSet';\n if (!entriesOrKey || typeof entriesOrKey === 'function') {\n this._map = new ResourceMap(entriesOrKey);\n }\n else {\n this._map = new ResourceMap(toKey);\n entriesOrKey.forEach(this.add, this);\n }\n }\n get size() {\n return this._map.size;\n }\n add(value) {\n this._map.set(value, value);\n return this;\n }\n clear() {\n this._map.clear();\n }\n delete(value) {\n return this._map.delete(value);\n }\n forEach(callbackfn, thisArg) {\n this._map.forEach((_value, key) => callbackfn.call(thisArg, key, key, this));\n }\n has(value) {\n return this._map.has(value);\n }\n entries() {\n return this._map.entries();\n }\n keys() {\n return this._map.keys();\n }\n values() {\n return this._map.keys();\n }\n [(_b = Symbol.toStringTag, Symbol.iterator)]() {\n return this.keys();\n }\n}\nexport class LinkedMap {\n constructor() {\n this[_c] = 'LinkedMap';\n this._map = new Map();\n this._head = undefined;\n this._tail = undefined;\n this._size = 0;\n this._state = 0;\n }\n clear() {\n this._map.clear();\n this._head = undefined;\n this._tail = undefined;\n this._size = 0;\n this._state++;\n }\n isEmpty() {\n return !this._head && !this._tail;\n }\n get size() {\n return this._size;\n }\n get first() {\n return this._head?.value;\n }\n get last() {\n return this._tail?.value;\n }\n has(key) {\n return this._map.has(key);\n }\n get(key, touch = 0 /* Touch.None */) {\n const item = this._map.get(key);\n if (!item) {\n return undefined;\n }\n if (touch !== 0 /* Touch.None */) {\n this.touch(item, touch);\n }\n return item.value;\n }\n set(key, value, touch = 0 /* Touch.None */) {\n let item = this._map.get(key);\n if (item) {\n item.value = value;\n if (touch !== 0 /* Touch.None */) {\n this.touch(item, touch);\n }\n }\n else {\n item = { key, value, next: undefined, previous: undefined };\n switch (touch) {\n case 0 /* Touch.None */:\n this.addItemLast(item);\n break;\n case 1 /* Touch.AsOld */:\n this.addItemFirst(item);\n break;\n case 2 /* Touch.AsNew */:\n this.addItemLast(item);\n break;\n default:\n this.addItemLast(item);\n break;\n }\n this._map.set(key, item);\n this._size++;\n }\n return this;\n }\n delete(key) {\n return !!this.remove(key);\n }\n remove(key) {\n const item = this._map.get(key);\n if (!item) {\n return undefined;\n }\n this._map.delete(key);\n this.removeItem(item);\n this._size--;\n return item.value;\n }\n shift() {\n if (!this._head && !this._tail) {\n return undefined;\n }\n if (!this._head || !this._tail) {\n throw new Error('Invalid list');\n }\n const item = this._head;\n this._map.delete(item.key);\n this.removeItem(item);\n this._size--;\n return item.value;\n }\n forEach(callbackfn, thisArg) {\n const state = this._state;\n let current = this._head;\n while (current) {\n if (thisArg) {\n callbackfn.bind(thisArg)(current.value, current.key, this);\n }\n else {\n callbackfn(current.value, current.key, this);\n }\n if (this._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n current = current.next;\n }\n }\n keys() {\n const map = this;\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]() {\n return iterator;\n },\n next() {\n if (map._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: current.key, done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n values() {\n const map = this;\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]() {\n return iterator;\n },\n next() {\n if (map._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: current.value, done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n entries() {\n const map = this;\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]() {\n return iterator;\n },\n next() {\n if (map._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: [current.key, current.value], done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n [(_c = Symbol.toStringTag, Symbol.iterator)]() {\n return this.entries();\n }\n trimOld(newSize) {\n if (newSize >= this.size) {\n return;\n }\n if (newSize === 0) {\n this.clear();\n return;\n }\n let current = this._head;\n let currentSize = this.size;\n while (current && currentSize > newSize) {\n this._map.delete(current.key);\n current = current.next;\n currentSize--;\n }\n this._head = current;\n this._size = currentSize;\n if (current) {\n current.previous = undefined;\n }\n this._state++;\n }\n addItemFirst(item) {\n // First time Insert\n if (!this._head && !this._tail) {\n this._tail = item;\n }\n else if (!this._head) {\n throw new Error('Invalid list');\n }\n else {\n item.next = this._head;\n this._head.previous = item;\n }\n this._head = item;\n this._state++;\n }\n addItemLast(item) {\n // First time Insert\n if (!this._head && !this._tail) {\n this._head = item;\n }\n else if (!this._tail) {\n throw new Error('Invalid list');\n }\n else {\n item.previous = this._tail;\n this._tail.next = item;\n }\n this._tail = item;\n this._state++;\n }\n removeItem(item) {\n if (item === this._head && item === this._tail) {\n this._head = undefined;\n this._tail = undefined;\n }\n else if (item === this._head) {\n // This can only happen if size === 1 which is handled\n // by the case above.\n if (!item.next) {\n throw new Error('Invalid list');\n }\n item.next.previous = undefined;\n this._head = item.next;\n }\n else if (item === this._tail) {\n // This can only happen if size === 1 which is handled\n // by the case above.\n if (!item.previous) {\n throw new Error('Invalid list');\n }\n item.previous.next = undefined;\n this._tail = item.previous;\n }\n else {\n const next = item.next;\n const previous = item.previous;\n if (!next || !previous) {\n throw new Error('Invalid list');\n }\n next.previous = previous;\n previous.next = next;\n }\n item.next = undefined;\n item.previous = undefined;\n this._state++;\n }\n touch(item, touch) {\n if (!this._head || !this._tail) {\n throw new Error('Invalid list');\n }\n if ((touch !== 1 /* Touch.AsOld */ && touch !== 2 /* Touch.AsNew */)) {\n return;\n }\n if (touch === 1 /* Touch.AsOld */) {\n if (item === this._head) {\n return;\n }\n const next = item.next;\n const previous = item.previous;\n // Unlink the item\n if (item === this._tail) {\n // previous must be defined since item was not head but is tail\n // So there are more than on item in the map\n previous.next = undefined;\n this._tail = previous;\n }\n else {\n // Both next and previous are not undefined since item was neither head nor tail.\n next.previous = previous;\n previous.next = next;\n }\n // Insert the node at head\n item.previous = undefined;\n item.next = this._head;\n this._head.previous = item;\n this._head = item;\n this._state++;\n }\n else if (touch === 2 /* Touch.AsNew */) {\n if (item === this._tail) {\n return;\n }\n const next = item.next;\n const previous = item.previous;\n // Unlink the item.\n if (item === this._head) {\n // next must be defined since item was not tail but is head\n // So there are more than on item in the map\n next.previous = undefined;\n this._head = next;\n }\n else {\n // Both next and previous are not undefined since item was neither head nor tail.\n next.previous = previous;\n previous.next = next;\n }\n item.next = undefined;\n item.previous = this._tail;\n this._tail.next = item;\n this._tail = item;\n this._state++;\n }\n }\n toJSON() {\n const data = [];\n this.forEach((value, key) => {\n data.push([key, value]);\n });\n return data;\n }\n fromJSON(data) {\n this.clear();\n for (const [key, value] of data) {\n this.set(key, value);\n }\n }\n}\nexport class LRUCache extends LinkedMap {\n constructor(limit, ratio = 1) {\n super();\n this._limit = limit;\n this._ratio = Math.min(Math.max(0, ratio), 1);\n }\n get limit() {\n return this._limit;\n }\n set limit(limit) {\n this._limit = limit;\n this.checkTrim();\n }\n get ratio() {\n return this._ratio;\n }\n set ratio(ratio) {\n this._ratio = Math.min(Math.max(0, ratio), 1);\n this.checkTrim();\n }\n get(key, touch = 2 /* Touch.AsNew */) {\n return super.get(key, touch);\n }\n peek(key) {\n return super.get(key, 0 /* Touch.None */);\n }\n set(key, value) {\n super.set(key, value, 2 /* Touch.AsNew */);\n this.checkTrim();\n return this;\n }\n checkTrim() {\n if (this.size > this._limit) {\n this.trimOld(Math.round(this._limit * this._ratio));\n }\n }\n}\nexport class CounterSet {\n constructor() {\n this.map = new Map();\n }\n add(value) {\n this.map.set(value, (this.map.get(value) || 0) + 1);\n return this;\n }\n delete(value) {\n let counter = this.map.get(value) || 0;\n if (counter === 0) {\n return false;\n }\n counter--;\n if (counter === 0) {\n this.map.delete(value);\n }\n else {\n this.map.set(value, counter);\n }\n return true;\n }\n has(value) {\n return this.map.has(value);\n }\n}\n/**\n * A map that allows access both by keys and values.\n * **NOTE**: values need to be unique.\n */\nexport class BidirectionalMap {\n constructor(entries) {\n this._m1 = new Map();\n this._m2 = new Map();\n if (entries) {\n for (const [key, value] of entries) {\n this.set(key, value);\n }\n }\n }\n clear() {\n this._m1.clear();\n this._m2.clear();\n }\n set(key, value) {\n this._m1.set(key, value);\n this._m2.set(value, key);\n }\n get(key) {\n return this._m1.get(key);\n }\n getKey(value) {\n return this._m2.get(value);\n }\n delete(key) {\n const value = this._m1.get(key);\n if (value === undefined) {\n return false;\n }\n this._m1.delete(key);\n this._m2.delete(value);\n return true;\n }\n forEach(callbackfn, thisArg) {\n this._m1.forEach((value, key) => {\n callbackfn.call(thisArg, value, key, this);\n });\n }\n keys() {\n return this._m1.keys();\n }\n values() {\n return this._m1.values();\n }\n}\nexport class SetMap {\n constructor() {\n this.map = new Map();\n }\n add(key, value) {\n let values = this.map.get(key);\n if (!values) {\n values = new Set();\n this.map.set(key, values);\n }\n values.add(value);\n }\n delete(key, value) {\n const values = this.map.get(key);\n if (!values) {\n return;\n }\n values.delete(value);\n if (values.size === 0) {\n this.map.delete(key);\n }\n }\n forEach(key, fn) {\n const values = this.map.get(key);\n if (!values) {\n return;\n }\n values.forEach(fn);\n }\n get(key) {\n const values = this.map.get(key);\n if (!values) {\n return new Set();\n }\n return values;\n }\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 *--------------------------------------------------------------------------------------------*/\nexport var Iterable;\n(function (Iterable) {\n function is(thing) {\n return thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\n }\n Iterable.is = is;\n const _empty = Object.freeze([]);\n function empty() {\n return _empty;\n }\n Iterable.empty = empty;\n function* single(element) {\n yield element;\n }\n Iterable.single = single;\n function wrap(iterableOrElement) {\n if (is(iterableOrElement)) {\n return iterableOrElement;\n }\n else {\n return single(iterableOrElement);\n }\n }\n Iterable.wrap = wrap;\n function from(iterable) {\n return iterable || _empty;\n }\n Iterable.from = from;\n function* reverse(array) {\n for (let i = array.length - 1; i >= 0; i--) {\n yield array[i];\n }\n }\n Iterable.reverse = reverse;\n function isEmpty(iterable) {\n return !iterable || iterable[Symbol.iterator]().next().done === true;\n }\n Iterable.isEmpty = isEmpty;\n function first(iterable) {\n return iterable[Symbol.iterator]().next().value;\n }\n Iterable.first = first;\n function some(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n return true;\n }\n }\n return false;\n }\n Iterable.some = some;\n function find(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n return element;\n }\n }\n return undefined;\n }\n Iterable.find = find;\n function* filter(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n yield element;\n }\n }\n }\n Iterable.filter = filter;\n function* map(iterable, fn) {\n let index = 0;\n for (const element of iterable) {\n yield fn(element, index++);\n }\n }\n Iterable.map = map;\n function* concat(...iterables) {\n for (const iterable of iterables) {\n yield* iterable;\n }\n }\n Iterable.concat = concat;\n function reduce(iterable, reducer, initialValue) {\n let value = initialValue;\n for (const element of iterable) {\n value = reducer(value, element);\n }\n return value;\n }\n Iterable.reduce = reduce;\n /**\n * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\n */\n function* slice(arr, from, to = arr.length) {\n if (from < 0) {\n from += arr.length;\n }\n if (to < 0) {\n to += arr.length;\n }\n else if (to > arr.length) {\n to = arr.length;\n }\n for (; from < to; from++) {\n yield arr[from];\n }\n }\n Iterable.slice = slice;\n /**\n * Consumes `atMost` elements from iterable and returns the consumed elements,\n * and an iterable for the rest of the elements.\n */\n function consume(iterable, atMost = Number.POSITIVE_INFINITY) {\n const consumed = [];\n if (atMost === 0) {\n return [consumed, iterable];\n }\n const iterator = iterable[Symbol.iterator]();\n for (let i = 0; i < atMost; i++) {\n const next = iterator.next();\n if (next.done) {\n return [consumed, Iterable.empty()];\n }\n consumed.push(next.value);\n }\n return [consumed, { [Symbol.iterator]() { return iterator; } }];\n }\n Iterable.consume = consume;\n})(Iterable || (Iterable = {}));\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 *--------------------------------------------------------------------------------------------*/\nimport { compareBy, numberComparator } from './arrays.js';\nimport { groupBy } from './collections.js';\nimport { SetMap } from './map.js';\nimport { createSingleCallFunction } from './functional.js';\nimport { Iterable } from './iterator.js';\n// #region Disposable Tracking\n/**\n * Enables logging of potentially leaked disposables.\n *\n * A disposable is considered leaked if it is not disposed or not registered as the child of\n * another disposable. This tracking is very simple an only works for classes that either\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\n */\nconst TRACK_DISPOSABLES = false;\nlet disposableTracker = null;\nexport class DisposableTracker {\n constructor() {\n this.livingDisposables = new Map();\n }\n getDisposableData(d) {\n let val = this.livingDisposables.get(d);\n if (!val) {\n val = { parent: null, source: null, isSingleton: false, value: d, idx: DisposableTracker.idx++ };\n this.livingDisposables.set(d, val);\n }\n return val;\n }\n trackDisposable(d) {\n const data = this.getDisposableData(d);\n if (!data.source) {\n data.source =\n new Error().stack;\n }\n }\n setParent(child, parent) {\n const data = this.getDisposableData(child);\n data.parent = parent;\n }\n markAsDisposed(x) {\n this.livingDisposables.delete(x);\n }\n markAsSingleton(disposable) {\n this.getDisposableData(disposable).isSingleton = true;\n }\n getRootParent(data, cache) {\n const cacheValue = cache.get(data);\n if (cacheValue) {\n return cacheValue;\n }\n const result = data.parent ? this.getRootParent(this.getDisposableData(data.parent), cache) : data;\n cache.set(data, result);\n return result;\n }\n getTrackedDisposables() {\n const rootParentCache = new Map();\n const leaking = [...this.livingDisposables.entries()]\n .filter(([, v]) => v.source !== null && !this.getRootParent(v, rootParentCache).isSingleton)\n .flatMap(([k]) => k);\n return leaking;\n }\n computeLeakingDisposables(maxReported = 10, preComputedLeaks) {\n let uncoveredLeakingObjs;\n if (preComputedLeaks) {\n uncoveredLeakingObjs = preComputedLeaks;\n }\n else {\n const rootParentCache = new Map();\n const leakingObjects = [...this.livingDisposables.values()]\n .filter((info) => info.source !== null && !this.getRootParent(info, rootParentCache).isSingleton);\n if (leakingObjects.length === 0) {\n return;\n }\n const leakingObjsSet = new Set(leakingObjects.map(o => o.value));\n // Remove all objects that are a child of other leaking objects. Assumes there are no cycles.\n uncoveredLeakingObjs = leakingObjects.filter(l => {\n return !(l.parent && leakingObjsSet.has(l.parent));\n });\n if (uncoveredLeakingObjs.length === 0) {\n throw new Error('There are cyclic diposable chains!');\n }\n }\n if (!uncoveredLeakingObjs) {\n return undefined;\n }\n function getStackTracePath(leaking) {\n function removePrefix(array, linesToRemove) {\n while (array.length > 0 && linesToRemove.some(regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp))) {\n array.shift();\n }\n }\n const lines = leaking.source.split('\\n').map(p => p.trim().replace('at ', '')).filter(l => l !== '');\n removePrefix(lines, ['Error', /^trackDisposable \\(.*\\)$/, /^DisposableTracker.trackDisposable \\(.*\\)$/]);\n return lines.reverse();\n }\n const stackTraceStarts = new SetMap();\n for (const leaking of uncoveredLeakingObjs) {\n const stackTracePath = getStackTracePath(leaking);\n for (let i = 0; i <= stackTracePath.length; i++) {\n stackTraceStarts.add(stackTracePath.slice(0, i).join('\\n'), leaking);\n }\n }\n // Put earlier leaks first\n uncoveredLeakingObjs.sort(compareBy(l => l.idx, numberComparator));\n let message = '';\n let i = 0;\n for (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {\n i++;\n const stackTracePath = getStackTracePath(leaking);\n const stackTraceFormattedLines = [];\n for (let i = 0; i < stackTracePath.length; i++) {\n let line = stackTracePath[i];\n const starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\\n'));\n line = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;\n const prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\\n'));\n const continuations = groupBy([...prevStarts].map(d => getStackTracePath(d)[i]), v => v);\n delete continuations[stackTracePath[i]];\n for (const [cont, set] of Object.entries(continuations)) {\n stackTraceFormattedLines.unshift(` - stacktraces of ${set.length} other leaks continue with ${cont}`);\n }\n stackTraceFormattedLines.unshift(line);\n }\n message += `\\n\\n\\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\\n${stackTraceFormattedLines.join('\\n')}\\n============================================================\\n\\n`;\n }\n if (uncoveredLeakingObjs.length > maxReported) {\n message += `\\n\\n\\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\\n\\n`;\n }\n return { leaks: uncoveredLeakingObjs, details: message };\n }\n}\nDisposableTracker.idx = 0;\nexport function setDisposableTracker(tracker) {\n disposableTracker = tracker;\n}\nif (TRACK_DISPOSABLES) {\n const __is_disposable_tracked__ = '__is_disposable_tracked__';\n setDisposableTracker(new class {\n trackDisposable(x) {\n const stack = new Error('Potentially leaked disposable').stack;\n setTimeout(() => {\n if (!x[__is_disposable_tracked__]) {\n console.log(stack);\n }\n }, 3000);\n }\n setParent(child, parent) {\n if (child && child !== Disposable.None) {\n try {\n child[__is_disposable_tracked__] = true;\n }\n catch {\n // noop\n }\n }\n }\n markAsDisposed(disposable) {\n if (disposable && disposable !== Disposable.None) {\n try {\n disposable[__is_disposable_tracked__] = true;\n }\n catch {\n // noop\n }\n }\n }\n markAsSingleton(disposable) { }\n });\n}\nexport function trackDisposable(x) {\n disposableTracker?.trackDisposable(x);\n return x;\n}\nexport function markAsDisposed(disposable) {\n disposableTracker?.markAsDisposed(disposable);\n}\nfunction setParentOfDisposable(child, parent) {\n disposableTracker?.setParent(child, parent);\n}\nfunction setParentOfDisposables(children, parent) {\n if (!disposableTracker) {\n return;\n }\n for (const child of children) {\n disposableTracker.setParent(child, parent);\n }\n}\n/**\n * Indicates that the given object is a singleton which does not need to be disposed.\n*/\nexport function markAsSingleton(singleton) {\n disposableTracker?.markAsSingleton(singleton);\n return singleton;\n}\n/**\n * Check if `thing` is {@link IDisposable disposable}.\n */\nexport function isDisposable(thing) {\n return typeof thing.dispose === 'function' && thing.dispose.length === 0;\n}\nexport function dispose(arg) {\n if (Iterable.is(arg)) {\n const errors = [];\n for (const d of arg) {\n if (d) {\n try {\n d.dispose();\n }\n catch (e) {\n errors.push(e);\n }\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n }\n else if (errors.length > 1) {\n throw new AggregateError(errors, 'Encountered errors while disposing of store');\n }\n return Array.isArray(arg) ? [] : arg;\n }\n else if (arg) {\n arg.dispose();\n return arg;\n }\n}\nexport function disposeIfDisposable(disposables) {\n for (const d of disposables) {\n if (isDisposable(d)) {\n d.dispose();\n }\n }\n return [];\n}\n/**\n * Combine multiple disposable values into a single {@link IDisposable}.\n */\nexport function combinedDisposable(...disposables) {\n const parent = toDisposable(() => dispose(disposables));\n setParentOfDisposables(disposables, parent);\n return parent;\n}\n/**\n * Turn a function that implements dispose into an {@link IDisposable}.\n *\n * @param fn Clean up function, guaranteed to be called only **once**.\n */\nexport function toDisposable(fn) {\n const self = trackDisposable({\n dispose: createSingleCallFunction(() => {\n markAsDisposed(self);\n fn();\n })\n });\n return self;\n}\n/**\n * Manages a collection of disposable values.\n *\n * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an\n * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a\n * store that has already been disposed of.\n */\nexport class DisposableStore {\n constructor() {\n this._toDispose = new Set();\n this._isDisposed = false;\n trackDisposable(this);\n }\n /**\n * Dispose of all registered disposables and mark this object as disposed.\n *\n * Any future disposables added to this object will be disposed of on `add`.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n markAsDisposed(this);\n this._isDisposed = true;\n this.clear();\n }\n /**\n * @return `true` if this object has been disposed of.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of all registered disposables but do not mark this object as disposed.\n */\n clear() {\n if (this._toDispose.size === 0) {\n return;\n }\n try {\n dispose(this._toDispose);\n }\n finally {\n this._toDispose.clear();\n }\n }\n /**\n * Add a new {@link IDisposable disposable} to the collection.\n */\n add(o) {\n if (!o) {\n return o;\n }\n if (o === this) {\n throw new Error('Cannot register a disposable on itself!');\n }\n setParentOfDisposable(o, this);\n if (this._isDisposed) {\n if (!DisposableStore.DISABLE_DISPOSED_WARNING) {\n console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\n }\n }\n else {\n this._toDispose.add(o);\n }\n return o;\n }\n /**\n * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the\n * disposable even when the disposable is not part in the store.\n */\n delete(o) {\n if (!o) {\n return;\n }\n if (o === this) {\n throw new Error('Cannot dispose a disposable on itself!');\n }\n this._toDispose.delete(o);\n o.dispose();\n }\n /**\n * Deletes the value from the store, but does not dispose it.\n */\n deleteAndLeak(o) {\n if (!o) {\n return;\n }\n if (this._toDispose.has(o)) {\n this._toDispose.delete(o);\n setParentOfDisposable(o, null);\n }\n }\n}\nDisposableStore.DISABLE_DISPOSED_WARNING = false;\n/**\n * Abstract base class for a {@link IDisposable disposable} object.\n *\n * Subclasses can {@linkcode _register} disposables that will be automatically cleaned up when this object is disposed of.\n */\nexport class Disposable {\n constructor() {\n this._store = new DisposableStore();\n trackDisposable(this);\n setParentOfDisposable(this._store, this);\n }\n dispose() {\n markAsDisposed(this);\n this._store.dispose();\n }\n /**\n * Adds `o` to the collection of disposables managed by this object.\n */\n _register(o) {\n if (o === this) {\n throw new Error('Cannot register a disposable on itself!');\n }\n return this._store.add(o);\n }\n}\n/**\n * A disposable that does nothing when it is disposed of.\n *\n * TODO: This should not be a static property.\n */\nDisposable.None = Object.freeze({ dispose() { } });\n/**\n * Manages the lifecycle of a disposable value that may be changed.\n *\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\n */\nexport class MutableDisposable {\n constructor() {\n this._isDisposed = false;\n trackDisposable(this);\n }\n get value() {\n return this._isDisposed ? undefined : this._value;\n }\n set value(value) {\n if (this._isDisposed || value === this._value) {\n return;\n }\n this._value?.dispose();\n if (value) {\n setParentOfDisposable(value, this);\n }\n this._value = value;\n }\n /**\n * Resets the stored value and disposed of the previously stored value.\n */\n clear() {\n this.value = undefined;\n }\n dispose() {\n this._isDisposed = true;\n markAsDisposed(this);\n this._value?.dispose();\n this._value = undefined;\n }\n /**\n * Clears the value, but does not dispose it.\n * The old value is returned.\n */\n clearAndLeak() {\n const oldValue = this._value;\n this._value = undefined;\n if (oldValue) {\n setParentOfDisposable(oldValue, null);\n }\n return oldValue;\n }\n}\n/**\n * Manages the lifecycle of a disposable value that may be changed like {@link MutableDisposable}, but the value must\n * exist and cannot be undefined.\n */\nexport class MandatoryMutableDisposable {\n constructor(initialValue) {\n this._disposable = new MutableDisposable();\n this._isDisposed = false;\n this._disposable.value = initialValue;\n }\n get value() {\n return this._disposable.value;\n }\n set value(value) {\n if (this._isDisposed || value === this._disposable.value) {\n return;\n }\n this._disposable.value = value;\n }\n dispose() {\n this._isDisposed = true;\n this._disposable.dispose();\n }\n}\nexport class RefCountedDisposable {\n constructor(_disposable) {\n this._disposable = _disposable;\n this._counter = 1;\n }\n acquire() {\n this._counter++;\n return this;\n }\n release() {\n if (--this._counter === 0) {\n this._disposable.dispose();\n }\n return this;\n }\n}\n/**\n * A safe disposable can be `unset` so that a leaked reference (listener)\n * can be cut-off.\n */\nexport class SafeDisposable {\n constructor() {\n this.dispose = () => { };\n this.unset = () => { };\n this.isset = () => false;\n trackDisposable(this);\n }\n set(fn) {\n let callback = fn;\n this.unset = () => callback = undefined;\n this.isset = () => callback !== undefined;\n this.dispose = () => {\n if (callback) {\n callback();\n callback = undefined;\n markAsDisposed(this);\n }\n };\n return this;\n }\n}\nexport class ReferenceCollection {\n constructor() {\n this.references = new Map();\n }\n acquire(key, ...args) {\n let reference = this.references.get(key);\n if (!reference) {\n reference = { counter: 0, object: this.createReferencedObject(key, ...args) };\n this.references.set(key, reference);\n }\n const { object } = reference;\n const dispose = createSingleCallFunction(() => {\n if (--reference.counter === 0) {\n this.destroyReferencedObject(key, reference.object);\n this.references.delete(key);\n }\n });\n reference.counter++;\n return { object, dispose };\n }\n}\n/**\n * Unwraps a reference collection of promised values. Makes sure\n * references are disposed whenever promises get rejected.\n */\nexport class AsyncReferenceCollection {\n constructor(referenceCollection) {\n this.referenceCollection = referenceCollection;\n }\n async acquire(key, ...args) {\n const ref = this.referenceCollection.acquire(key, ...args);\n try {\n const object = await ref.object;\n return {\n object,\n dispose: () => ref.dispose()\n };\n }\n catch (error) {\n ref.dispose();\n throw error;\n }\n }\n}\nexport class ImmortalReference {\n constructor(object) {\n this.object = object;\n }\n dispose() { }\n}\nexport function disposeOnReturn(fn) {\n const store = new DisposableStore();\n try {\n fn(store);\n }\n finally {\n store.dispose();\n }\n}\n/**\n * A map the manages the lifecycle of the values that it stores.\n */\nexport class DisposableMap {\n constructor() {\n this._store = new Map();\n this._isDisposed = false;\n trackDisposable(this);\n }\n /**\n * Disposes of all stored values and mark this object as disposed.\n *\n * Trying to use this object after it has been disposed of is an error.\n */\n dispose() {\n markAsDisposed(this);\n this._isDisposed = true;\n this.clearAndDisposeAll();\n }\n /**\n * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.\n */\n clearAndDisposeAll() {\n if (!this._store.size) {\n return;\n }\n try {\n dispose(this._store.values());\n }\n finally {\n this._store.clear();\n }\n }\n has(key) {\n return this._store.has(key);\n }\n get size() {\n return this._store.size;\n }\n get(key) {\n return this._store.get(key);\n }\n set(key, value, skipDisposeOnOverwrite = false) {\n if (this._isDisposed) {\n console.warn(new Error('Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!').stack);\n }\n if (!skipDisposeOnOverwrite) {\n this._store.get(key)?.dispose();\n }\n this._store.set(key, value);\n }\n /**\n * Delete the value stored for `key` from this map and also dispose of it.\n */\n deleteAndDispose(key) {\n this._store.get(key)?.dispose();\n this._store.delete(key);\n }\n keys() {\n return this._store.keys();\n }\n values() {\n return this._store.values();\n }\n [Symbol.iterator]() {\n return this._store[Symbol.iterator]();\n }\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 *--------------------------------------------------------------------------------------------*/\nclass Node {\n constructor(element) {\n this.element = element;\n this.next = Node.Undefined;\n this.prev = Node.Undefined;\n }\n}\nNode.Undefined = new Node(undefined);\nexport class LinkedList {\n constructor() {\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n get size() {\n return this._size;\n }\n isEmpty() {\n return this._first === Node.Undefined;\n }\n clear() {\n let node = this._first;\n while (node !== Node.Undefined) {\n const next = node.next;\n node.prev = Node.Undefined;\n node.next = Node.Undefined;\n node = next;\n }\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n unshift(element) {\n return this._insert(element, false);\n }\n push(element) {\n return this._insert(element, true);\n }\n _insert(element, atTheEnd) {\n const newNode = new Node(element);\n if (this._first === Node.Undefined) {\n this._first = newNode;\n this._last = newNode;\n }\n else if (atTheEnd) {\n // push\n const oldLast = this._last;\n this._last = newNode;\n newNode.prev = oldLast;\n oldLast.next = newNode;\n }\n else {\n // unshift\n const oldFirst = this._first;\n this._first = newNode;\n newNode.next = oldFirst;\n oldFirst.prev = newNode;\n }\n this._size += 1;\n let didRemove = false;\n return () => {\n if (!didRemove) {\n didRemove = true;\n this._remove(newNode);\n }\n };\n }\n shift() {\n if (this._first === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._first.element;\n this._remove(this._first);\n return res;\n }\n }\n pop() {\n if (this._last === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._last.element;\n this._remove(this._last);\n return res;\n }\n }\n _remove(node) {\n if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n // middle\n const anchor = node.prev;\n anchor.next = node.next;\n node.next.prev = anchor;\n }\n else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n // only node\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n }\n else if (node.next === Node.Undefined) {\n // last\n this._last = this._last.prev;\n this._last.next = Node.Undefined;\n }\n else if (node.prev === Node.Undefined) {\n // first\n this._first = this._first.next;\n this._first.prev = Node.Undefined;\n }\n // done\n this._size -= 1;\n }\n *[Symbol.iterator]() {\n let node = this._first;\n while (node !== Node.Undefined) {\n yield node.element;\n node = node.next;\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nconst hasPerformanceNow = (globalThis.performance && typeof globalThis.performance.now === 'function');\nexport class StopWatch {\n static create(highResolution) {\n return new StopWatch(highResolution);\n }\n constructor(highResolution) {\n this._now = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance.now.bind(globalThis.performance);\n this._startTime = this._now();\n this._stopTime = -1;\n }\n stop() {\n this._stopTime = this._now();\n }\n reset() {\n this._startTime = this._now();\n this._stopTime = -1;\n }\n elapsed() {\n if (this._stopTime !== -1) {\n return this._stopTime - this._startTime;\n }\n return this._now() - this._startTime;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { onUnexpectedError } from './errors.js';\nimport { createSingleCallFunction } from './functional.js';\nimport { combinedDisposable, Disposable, DisposableMap, DisposableStore, toDisposable } from './lifecycle.js';\nimport { LinkedList } from './linkedList.js';\nimport { StopWatch } from './stopwatch.js';\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableDisposeWithListenerWarning = false;\n// _enableDisposeWithListenerWarning = Boolean(\"TRUE\"); // causes a linter warning so that it cannot be pushed\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup.\n// See https://github.com/microsoft/vscode/issues/142851\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableSnapshotPotentialLeakWarning = false;\nexport var Event;\n(function (Event) {\n Event.None = () => Disposable.None;\n function _addLeakageTraceLogic(options) {\n if (_enableSnapshotPotentialLeakWarning) {\n const { onDidAddListener: origListenerDidAdd } = options;\n const stack = Stacktrace.create();\n let count = 0;\n options.onDidAddListener = () => {\n if (++count === 2) {\n console.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here');\n stack.print();\n }\n origListenerDidAdd?.();\n };\n }\n }\n /**\n * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared\n * `setTimeout`. The event is converted into a signal (`Event`) to avoid additional object creation as a\n * result of merging events and to try prevent race conditions that could arise when using related deferred and\n * non-deferred events.\n *\n * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work\n * (eg. latency of keypress to text rendered).\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function defer(event, disposable) {\n return debounce(event, () => void 0, 0, undefined, true, undefined, disposable);\n }\n Event.defer = defer;\n /**\n * Given an event, returns another event which only fires once.\n *\n * @param event The event source for the new event.\n */\n function once(event) {\n return (listener, thisArgs = null, disposables) => {\n // we need this, in case the event fires during the listener call\n let didFire = false;\n let result = undefined;\n result = event(e => {\n if (didFire) {\n return;\n }\n else if (result) {\n result.dispose();\n }\n else {\n didFire = true;\n }\n return listener.call(thisArgs, e);\n }, null, disposables);\n if (didFire) {\n result.dispose();\n }\n return result;\n };\n }\n Event.once = once;\n /**\n * Maps an event of one type into an event of another type using a mapping function, similar to how\n * `Array.prototype.map` works.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param map The mapping function.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function map(event, map, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);\n }\n Event.map = map;\n /**\n * Wraps an event in another event that performs some function on the event object before firing.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param each The function to perform on the event object.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function forEach(event, each, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n }\n Event.forEach = forEach;\n function filter(event, filter, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);\n }\n Event.filter = filter;\n /**\n * Given an event, returns the same event but typed as `Event`.\n */\n function signal(event) {\n return event;\n }\n Event.signal = signal;\n function any(...events) {\n return (listener, thisArgs = null, disposables) => {\n const disposable = combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e))));\n return addAndReturnDisposable(disposable, disposables);\n };\n }\n Event.any = any;\n /**\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n */\n function reduce(event, merge, initial, disposable) {\n let output = initial;\n return map(event, e => {\n output = merge(output, e);\n return output;\n }, disposable);\n }\n Event.reduce = reduce;\n function snapshot(event, disposable) {\n let listener;\n const options = {\n onWillAddFirstListener() {\n listener = event(emitter.fire, emitter);\n },\n onDidRemoveLastListener() {\n listener?.dispose();\n }\n };\n if (!disposable) {\n _addLeakageTraceLogic(options);\n }\n const emitter = new Emitter(options);\n disposable?.add(emitter);\n return emitter.event;\n }\n /**\n * Adds the IDisposable to the store if it's set, and returns it. Useful to\n * Event function implementation.\n */\n function addAndReturnDisposable(d, store) {\n if (store instanceof Array) {\n store.push(d);\n }\n else if (store) {\n store.add(d);\n }\n return d;\n }\n function debounce(event, merge, delay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold, disposable) {\n let subscription;\n let output = undefined;\n let handle = undefined;\n let numDebouncedCalls = 0;\n let doFire;\n const options = {\n leakWarningThreshold,\n onWillAddFirstListener() {\n subscription = event(cur => {\n numDebouncedCalls++;\n output = merge(output, cur);\n if (leading && !handle) {\n emitter.fire(output);\n output = undefined;\n }\n doFire = () => {\n const _output = output;\n output = undefined;\n handle = undefined;\n if (!leading || numDebouncedCalls > 1) {\n emitter.fire(_output);\n }\n numDebouncedCalls = 0;\n };\n if (typeof delay === 'number') {\n clearTimeout(handle);\n handle = setTimeout(doFire, delay);\n }\n else {\n if (handle === undefined) {\n handle = 0;\n queueMicrotask(doFire);\n }\n }\n });\n },\n onWillRemoveListener() {\n if (flushOnListenerRemove && numDebouncedCalls > 0) {\n doFire?.();\n }\n },\n onDidRemoveLastListener() {\n doFire = undefined;\n subscription.dispose();\n }\n };\n if (!disposable) {\n _addLeakageTraceLogic(options);\n }\n const emitter = new Emitter(options);\n disposable?.add(emitter);\n return emitter.event;\n }\n Event.debounce = debounce;\n /**\n * Debounces an event, firing after some delay (default=0) with an array of all event original objects.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n */\n function accumulate(event, delay = 0, disposable) {\n return Event.debounce(event, (last, e) => {\n if (!last) {\n return [e];\n }\n last.push(e);\n return last;\n }, delay, undefined, true, undefined, disposable);\n }\n Event.accumulate = accumulate;\n /**\n * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate\n * event objects from different sources do not fire the same event object.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param equals The equality condition.\n * @param disposable A disposable store to add the new EventEmitter to.\n *\n * @example\n * ```\n * // Fire only one time when a single window is opened or focused\n * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))\n * ```\n */\n function latch(event, equals = (a, b) => a === b, disposable) {\n let firstCall = true;\n let cache;\n return filter(event, value => {\n const shouldEmit = firstCall || !equals(value, cache);\n firstCall = false;\n cache = value;\n return shouldEmit;\n }, disposable);\n }\n Event.latch = latch;\n /**\n * Splits an event whose parameter is a union type into 2 separate events for each type in the union.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @example\n * ```\n * const event = new EventEmitter().event;\n * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);\n * ```\n *\n * @param event The event source for the new event.\n * @param isT A function that determines what event is of the first type.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function split(event, isT, disposable) {\n return [\n Event.filter(event, isT, disposable),\n Event.filter(event, e => !isT(e), disposable),\n ];\n }\n Event.split = split;\n /**\n * Buffers an event until it has a listener attached.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a\n * `setTimeout` when the first event listener is added.\n * @param _buffer Internal: A source event array used for tests.\n *\n * @example\n * ```\n * // Start accumulating events, when the first listener is attached, flush\n * // the event after a timeout such that multiple listeners attached before\n * // the timeout would receive the event\n * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n * ```\n */\n function buffer(event, flushAfterTimeout = false, _buffer = [], disposable) {\n let buffer = _buffer.slice();\n let listener = event(e => {\n if (buffer) {\n buffer.push(e);\n }\n else {\n emitter.fire(e);\n }\n });\n if (disposable) {\n disposable.add(listener);\n }\n const flush = () => {\n buffer?.forEach(e => emitter.fire(e));\n buffer = null;\n };\n const emitter = new Emitter({\n onWillAddFirstListener() {\n if (!listener) {\n listener = event(e => emitter.fire(e));\n if (disposable) {\n disposable.add(listener);\n }\n }\n },\n onDidAddFirstListener() {\n if (buffer) {\n if (flushAfterTimeout) {\n setTimeout(flush);\n }\n else {\n flush();\n }\n }\n },\n onDidRemoveLastListener() {\n if (listener) {\n listener.dispose();\n }\n listener = null;\n }\n });\n if (disposable) {\n disposable.add(emitter);\n }\n return emitter.event;\n }\n Event.buffer = buffer;\n /**\n * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.\n *\n * @example\n * ```\n * // Normal\n * const onEnterPressNormal = Event.filter(\n * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),\n * e.keyCode === KeyCode.Enter\n * ).event;\n *\n * // Using chain\n * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $\n * .map(e => new StandardKeyboardEvent(e))\n * .filter(e => e.keyCode === KeyCode.Enter)\n * );\n * ```\n */\n function chain(event, sythensize) {\n const fn = (listener, thisArgs, disposables) => {\n const cs = sythensize(new ChainableSynthesis());\n return event(function (value) {\n const result = cs.evaluate(value);\n if (result !== HaltChainable) {\n listener.call(thisArgs, result);\n }\n }, undefined, disposables);\n };\n return fn;\n }\n Event.chain = chain;\n const HaltChainable = Symbol('HaltChainable');\n class ChainableSynthesis {\n constructor() {\n this.steps = [];\n }\n map(fn) {\n this.steps.push(fn);\n return this;\n }\n forEach(fn) {\n this.steps.push(v => {\n fn(v);\n return v;\n });\n return this;\n }\n filter(fn) {\n this.steps.push(v => fn(v) ? v : HaltChainable);\n return this;\n }\n reduce(merge, initial) {\n let last = initial;\n this.steps.push(v => {\n last = merge(last, v);\n return last;\n });\n return this;\n }\n latch(equals = (a, b) => a === b) {\n let firstCall = true;\n let cache;\n this.steps.push(value => {\n const shouldEmit = firstCall || !equals(value, cache);\n firstCall = false;\n cache = value;\n return shouldEmit ? value : HaltChainable;\n });\n return this;\n }\n evaluate(value) {\n for (const step of this.steps) {\n value = step(value);\n if (value === HaltChainable) {\n break;\n }\n }\n return value;\n }\n }\n /**\n * Creates an {@link Event} from a node event emitter.\n */\n function fromNodeEventEmitter(emitter, eventName, map = id => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.on(eventName, fn);\n const onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n return result.event;\n }\n Event.fromNodeEventEmitter = fromNodeEventEmitter;\n /**\n * Creates an {@link Event} from a DOM event emitter.\n */\n function fromDOMEventEmitter(emitter, eventName, map = id => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\n const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\n const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n return result.event;\n }\n Event.fromDOMEventEmitter = fromDOMEventEmitter;\n /**\n * Creates a promise out of an event, using the {@link Event.once} helper.\n */\n function toPromise(event) {\n return new Promise(resolve => once(event)(resolve));\n }\n Event.toPromise = toPromise;\n /**\n * Creates an event out of a promise that fires once when the promise is\n * resolved with the result of the promise or `undefined`.\n */\n function fromPromise(promise) {\n const result = new Emitter();\n promise.then(res => {\n result.fire(res);\n }, () => {\n result.fire(undefined);\n }).finally(() => {\n result.dispose();\n });\n return result.event;\n }\n Event.fromPromise = fromPromise;\n function runAndSubscribe(event, handler, initial) {\n handler(initial);\n return event(e => handler(e));\n }\n Event.runAndSubscribe = runAndSubscribe;\n /**\n * Adds a listener to an event and calls the listener immediately with undefined as the event object. A new\n * {@link DisposableStore} is passed to the listener which is disposed when the returned disposable is disposed.\n */\n function runAndSubscribeWithStore(event, handler) {\n let store = null;\n function run(e) {\n store?.dispose();\n store = new DisposableStore();\n handler(e, store);\n }\n run(undefined);\n const disposable = event(e => run(e));\n return toDisposable(() => {\n disposable.dispose();\n store?.dispose();\n });\n }\n Event.runAndSubscribeWithStore = runAndSubscribeWithStore;\n class EmitterObserver {\n constructor(_observable, store) {\n this._observable = _observable;\n this._counter = 0;\n this._hasChanged = false;\n const options = {\n onWillAddFirstListener: () => {\n _observable.addObserver(this);\n },\n onDidRemoveLastListener: () => {\n _observable.removeObserver(this);\n }\n };\n if (!store) {\n _addLeakageTraceLogic(options);\n }\n this.emitter = new Emitter(options);\n if (store) {\n store.add(this.emitter);\n }\n }\n beginUpdate(_observable) {\n // assert(_observable === this.obs);\n this._counter++;\n }\n handlePossibleChange(_observable) {\n // assert(_observable === this.obs);\n }\n handleChange(_observable, _change) {\n // assert(_observable === this.obs);\n this._hasChanged = true;\n }\n endUpdate(_observable) {\n // assert(_observable === this.obs);\n this._counter--;\n if (this._counter === 0) {\n this._observable.reportChanges();\n if (this._hasChanged) {\n this._hasChanged = false;\n this.emitter.fire(this._observable.get());\n }\n }\n }\n }\n /**\n * Creates an event emitter that is fired when the observable changes.\n * Each listeners subscribes to the emitter.\n */\n function fromObservable(obs, store) {\n const observer = new EmitterObserver(obs, store);\n return observer.emitter.event;\n }\n Event.fromObservable = fromObservable;\n /**\n * Each listener is attached to the observable directly.\n */\n function fromObservableLight(observable) {\n return (listener, thisArgs, disposables) => {\n let count = 0;\n let didChange = false;\n const observer = {\n beginUpdate() {\n count++;\n },\n endUpdate() {\n count--;\n if (count === 0) {\n observable.reportChanges();\n if (didChange) {\n didChange = false;\n listener.call(thisArgs);\n }\n }\n },\n handlePossibleChange() {\n // noop\n },\n handleChange() {\n didChange = true;\n }\n };\n observable.addObserver(observer);\n observable.reportChanges();\n const disposable = {\n dispose() {\n observable.removeObserver(observer);\n }\n };\n if (disposables instanceof DisposableStore) {\n disposables.add(disposable);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(disposable);\n }\n return disposable;\n };\n }\n Event.fromObservableLight = fromObservableLight;\n})(Event || (Event = {}));\nexport class EventProfiling {\n constructor(name) {\n this.listenerCount = 0;\n this.invocationCount = 0;\n this.elapsedOverall = 0;\n this.durations = [];\n this.name = `${name}_${EventProfiling._idPool++}`;\n EventProfiling.all.add(this);\n }\n start(listenerCount) {\n this._stopWatch = new StopWatch();\n this.listenerCount = listenerCount;\n }\n stop() {\n if (this._stopWatch) {\n const elapsed = this._stopWatch.elapsed();\n this.durations.push(elapsed);\n this.elapsedOverall += elapsed;\n this.invocationCount += 1;\n this._stopWatch = undefined;\n }\n }\n}\nEventProfiling.all = new Set();\nEventProfiling._idPool = 0;\nlet _globalLeakWarningThreshold = -1;\nexport function setGlobalLeakWarningThreshold(n) {\n const oldValue = _globalLeakWarningThreshold;\n _globalLeakWarningThreshold = n;\n return {\n dispose() {\n _globalLeakWarningThreshold = oldValue;\n }\n };\n}\nclass LeakageMonitor {\n constructor(threshold, name = Math.random().toString(18).slice(2, 5)) {\n this.threshold = threshold;\n this.name = name;\n this._warnCountdown = 0;\n }\n dispose() {\n this._stacks?.clear();\n }\n check(stack, listenerCount) {\n const threshold = this.threshold;\n if (threshold <= 0 || listenerCount < threshold) {\n return undefined;\n }\n if (!this._stacks) {\n this._stacks = new Map();\n }\n const count = (this._stacks.get(stack.value) || 0);\n this._stacks.set(stack.value, count + 1);\n this._warnCountdown -= 1;\n if (this._warnCountdown <= 0) {\n // only warn on first exceed and then every time the limit\n // is exceeded by 50% again\n this._warnCountdown = threshold * 0.5;\n // find most frequent listener and print warning\n let topStack;\n let topCount = 0;\n for (const [stack, count] of this._stacks) {\n if (!topStack || topCount < count) {\n topStack = stack;\n topCount = count;\n }\n }\n console.warn(`[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`);\n console.warn(topStack);\n }\n return () => {\n const count = (this._stacks.get(stack.value) || 0);\n this._stacks.set(stack.value, count - 1);\n };\n }\n}\nclass Stacktrace {\n static create() {\n return new Stacktrace(new Error().stack ?? '');\n }\n constructor(value) {\n this.value = value;\n }\n print() {\n console.warn(this.value.split('\\n').slice(2).join('\\n'));\n }\n}\nlet id = 0;\nclass UniqueContainer {\n constructor(value) {\n this.value = value;\n this.id = id++;\n }\n}\nconst compactionThreshold = 2;\nconst forEachListener = (listeners, fn) => {\n if (listeners instanceof UniqueContainer) {\n fn(listeners);\n }\n else {\n for (let i = 0; i < listeners.length; i++) {\n const l = listeners[i];\n if (l) {\n fn(l);\n }\n }\n }\n};\n/**\n * The Emitter can be used to expose an Event to the public\n * to fire it from the insides.\n * Sample:\n class Document {\n\n private readonly _onDidChange = new Emitter<(value:string)=>any>();\n\n public onDidChange = this._onDidChange.event;\n\n // getter-style\n // get onDidChange(): Event<(value:string)=>any> {\n // \treturn this._onDidChange.event;\n // }\n\n private _doIt() {\n //...\n this._onDidChange.fire(value);\n }\n }\n */\nexport class Emitter {\n constructor(options) {\n this._size = 0;\n this._options = options;\n this._leakageMon = _globalLeakWarningThreshold > 0 || this._options?.leakWarningThreshold ? new LeakageMonitor(this._options?.leakWarningThreshold ?? _globalLeakWarningThreshold) : undefined;\n this._perfMon = this._options?._profName ? new EventProfiling(this._options._profName) : undefined;\n this._deliveryQueue = this._options?.deliveryQueue;\n }\n dispose() {\n if (!this._disposed) {\n this._disposed = true;\n // It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter\n // alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and\n // unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the\n // the following programming pattern is very popular:\n //\n // const someModel = this._disposables.add(new ModelObject()); // (1) create and register model\n // this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener\n // ...later...\n // this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the \"overall dispose\" is done\n if (this._deliveryQueue?.current === this) {\n this._deliveryQueue.reset();\n }\n if (this._listeners) {\n if (_enableDisposeWithListenerWarning) {\n const listeners = this._listeners;\n queueMicrotask(() => {\n forEachListener(listeners, l => l.stack?.print());\n });\n }\n this._listeners = undefined;\n this._size = 0;\n }\n this._options?.onDidRemoveLastListener?.();\n this._leakageMon?.dispose();\n }\n }\n /**\n * For the public to allow to subscribe\n * to events from this Emitter\n */\n get event() {\n this._event ?? (this._event = (callback, thisArgs, disposables) => {\n if (this._leakageMon && this._size > this._leakageMon.threshold * 3) {\n console.warn(`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far`);\n return Disposable.None;\n }\n if (this._disposed) {\n // todo: should we warn if a listener is added to a disposed emitter? This happens often\n return Disposable.None;\n }\n if (thisArgs) {\n callback = callback.bind(thisArgs);\n }\n const contained = new UniqueContainer(callback);\n let removeMonitor;\n let stack;\n if (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {\n // check and record this emitter for potential leakage\n contained.stack = Stacktrace.create();\n removeMonitor = this._leakageMon.check(contained.stack, this._size + 1);\n }\n if (_enableDisposeWithListenerWarning) {\n contained.stack = stack ?? Stacktrace.create();\n }\n if (!this._listeners) {\n this._options?.onWillAddFirstListener?.(this);\n this._listeners = contained;\n this._options?.onDidAddFirstListener?.(this);\n }\n else if (this._listeners instanceof UniqueContainer) {\n this._deliveryQueue ?? (this._deliveryQueue = new EventDeliveryQueuePrivate());\n this._listeners = [this._listeners, contained];\n }\n else {\n this._listeners.push(contained);\n }\n this._size++;\n const result = toDisposable(() => { removeMonitor?.(); this._removeListener(contained); });\n if (disposables instanceof DisposableStore) {\n disposables.add(result);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(result);\n }\n return result;\n });\n return this._event;\n }\n _removeListener(listener) {\n this._options?.onWillRemoveListener?.(this);\n if (!this._listeners) {\n return; // expected if a listener gets disposed\n }\n if (this._size === 1) {\n this._listeners = undefined;\n this._options?.onDidRemoveLastListener?.(this);\n this._size = 0;\n return;\n }\n // size > 1 which requires that listeners be a list:\n const listeners = this._listeners;\n const index = listeners.indexOf(listener);\n if (index === -1) {\n console.log('disposed?', this._disposed);\n console.log('size?', this._size);\n console.log('arr?', JSON.stringify(this._listeners));\n throw new Error('Attempted to dispose unknown listener');\n }\n this._size--;\n listeners[index] = undefined;\n const adjustDeliveryQueue = this._deliveryQueue.current === this;\n if (this._size * compactionThreshold <= listeners.length) {\n let n = 0;\n for (let i = 0; i < listeners.length; i++) {\n if (listeners[i]) {\n listeners[n++] = listeners[i];\n }\n else if (adjustDeliveryQueue) {\n this._deliveryQueue.end--;\n if (n < this._deliveryQueue.i) {\n this._deliveryQueue.i--;\n }\n }\n }\n listeners.length = n;\n }\n }\n _deliver(listener, value) {\n if (!listener) {\n return;\n }\n const errorHandler = this._options?.onListenerError || onUnexpectedError;\n if (!errorHandler) {\n listener.value(value);\n return;\n }\n try {\n listener.value(value);\n }\n catch (e) {\n errorHandler(e);\n }\n }\n /** Delivers items in the queue. Assumes the queue is ready to go. */\n _deliverQueue(dq) {\n const listeners = dq.current._listeners;\n while (dq.i < dq.end) {\n // important: dq.i is incremented before calling deliver() because it might reenter deliverQueue()\n this._deliver(listeners[dq.i++], dq.value);\n }\n dq.reset();\n }\n /**\n * To be kept private to fire an event to\n * subscribers\n */\n fire(event) {\n if (this._deliveryQueue?.current) {\n this._deliverQueue(this._deliveryQueue);\n this._perfMon?.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch\n }\n this._perfMon?.start(this._size);\n if (!this._listeners) {\n // no-op\n }\n else if (this._listeners instanceof UniqueContainer) {\n this._deliver(this._listeners, event);\n }\n else {\n const dq = this._deliveryQueue;\n dq.enqueue(this, event, this._listeners.length);\n this._deliverQueue(dq);\n }\n this._perfMon?.stop();\n }\n hasListeners() {\n return this._size > 0;\n }\n}\nexport const createEventDeliveryQueue = () => new EventDeliveryQueuePrivate();\nclass EventDeliveryQueuePrivate {\n constructor() {\n /**\n * Index in current's listener list.\n */\n this.i = -1;\n /**\n * The last index in the listener's list to deliver.\n */\n this.end = 0;\n }\n enqueue(emitter, value, end) {\n this.i = 0;\n this.end = end;\n this.current = emitter;\n this.value = value;\n }\n reset() {\n this.i = this.end; // force any current emission loop to stop, mainly for during dispose\n this.current = undefined;\n this.value = undefined;\n }\n}\nexport class AsyncEmitter extends Emitter {\n async fireAsync(data, token, promiseJoin) {\n if (!this._listeners) {\n return;\n }\n if (!this._asyncDeliveryQueue) {\n this._asyncDeliveryQueue = new LinkedList();\n }\n forEachListener(this._listeners, listener => this._asyncDeliveryQueue.push([listener.value, data]));\n while (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n const [listener, data] = this._asyncDeliveryQueue.shift();\n const thenables = [];\n const event = {\n ...data,\n token,\n waitUntil: (p) => {\n if (Object.isFrozen(thenables)) {\n throw new Error('waitUntil can NOT be called asynchronous');\n }\n if (promiseJoin) {\n p = promiseJoin(p, listener);\n }\n thenables.push(p);\n }\n };\n try {\n listener(event);\n }\n catch (e) {\n onUnexpectedError(e);\n continue;\n }\n // freeze thenables-collection to enforce sync-calls to\n // wait until and then wait for all thenables to resolve\n Object.freeze(thenables);\n await Promise.allSettled(thenables).then(values => {\n for (const value of values) {\n if (value.status === 'rejected') {\n onUnexpectedError(value.reason);\n }\n }\n });\n }\n }\n}\nexport class PauseableEmitter extends Emitter {\n get isPaused() {\n return this._isPaused !== 0;\n }\n constructor(options) {\n super(options);\n this._isPaused = 0;\n this._eventQueue = new LinkedList();\n this._mergeFn = options?.merge;\n }\n pause() {\n this._isPaused++;\n }\n resume() {\n if (this._isPaused !== 0 && --this._isPaused === 0) {\n if (this._mergeFn) {\n // use the merge function to create a single composite\n // event. make a copy in case firing pauses this emitter\n if (this._eventQueue.size > 0) {\n const events = Array.from(this._eventQueue);\n this._eventQueue.clear();\n super.fire(this._mergeFn(events));\n }\n }\n else {\n // no merging, fire each event individually and test\n // that this emitter isn't paused halfway through\n while (!this._isPaused && this._eventQueue.size !== 0) {\n super.fire(this._eventQueue.shift());\n }\n }\n }\n }\n fire(event) {\n if (this._size) {\n if (this._isPaused !== 0) {\n this._eventQueue.push(event);\n }\n else {\n super.fire(event);\n }\n }\n }\n}\nexport class DebounceEmitter extends PauseableEmitter {\n constructor(options) {\n super(options);\n this._delay = options.delay ?? 100;\n }\n fire(event) {\n if (!this._handle) {\n this.pause();\n this._handle = setTimeout(() => {\n this._handle = undefined;\n this.resume();\n }, this._delay);\n }\n super.fire(event);\n }\n}\n/**\n * An emitter which queue all events and then process them at the\n * end of the event loop.\n */\nexport class MicrotaskEmitter extends Emitter {\n constructor(options) {\n super(options);\n this._queuedEvents = [];\n this._mergeFn = options?.merge;\n }\n fire(event) {\n if (!this.hasListeners()) {\n return;\n }\n this._queuedEvents.push(event);\n if (this._queuedEvents.length === 1) {\n queueMicrotask(() => {\n if (this._mergeFn) {\n super.fire(this._mergeFn(this._queuedEvents));\n }\n else {\n this._queuedEvents.forEach(e => super.fire(e));\n }\n this._queuedEvents = [];\n });\n }\n }\n}\n/**\n * An event emitter that multiplexes many events into a single event.\n *\n * @example Listen to the `onData` event of all `Thing`s, dynamically adding and removing `Thing`s\n * to the multiplexer as needed.\n *\n * ```typescript\n * const anythingDataMultiplexer = new EventMultiplexer<{ data: string }>();\n *\n * const thingListeners = DisposableMap();\n *\n * thingService.onDidAddThing(thing => {\n * thingListeners.set(thing, anythingDataMultiplexer.add(thing.onData);\n * });\n * thingService.onDidRemoveThing(thing => {\n * thingListeners.deleteAndDispose(thing);\n * });\n *\n * anythingDataMultiplexer.event(e => {\n * console.log('Something fired data ' + e.data)\n * });\n * ```\n */\nexport class EventMultiplexer {\n constructor() {\n this.hasListeners = false;\n this.events = [];\n this.emitter = new Emitter({\n onWillAddFirstListener: () => this.onFirstListenerAdd(),\n onDidRemoveLastListener: () => this.onLastListenerRemove()\n });\n }\n get event() {\n return this.emitter.event;\n }\n add(event) {\n const e = { event: event, listener: null };\n this.events.push(e);\n if (this.hasListeners) {\n this.hook(e);\n }\n const dispose = () => {\n if (this.hasListeners) {\n this.unhook(e);\n }\n const idx = this.events.indexOf(e);\n this.events.splice(idx, 1);\n };\n return toDisposable(createSingleCallFunction(dispose));\n }\n onFirstListenerAdd() {\n this.hasListeners = true;\n this.events.forEach(e => this.hook(e));\n }\n onLastListenerRemove() {\n this.hasListeners = false;\n this.events.forEach(e => this.unhook(e));\n }\n hook(e) {\n e.listener = e.event(r => this.emitter.fire(r));\n }\n unhook(e) {\n if (e.listener) {\n e.listener.dispose();\n }\n e.listener = null;\n }\n dispose() {\n this.emitter.dispose();\n }\n}\nexport class DynamicListEventMultiplexer {\n constructor(items, onAddItem, onRemoveItem, getEvent) {\n this._store = new DisposableStore();\n const multiplexer = this._store.add(new EventMultiplexer());\n const itemListeners = this._store.add(new DisposableMap());\n function addItem(instance) {\n itemListeners.set(instance, multiplexer.add(getEvent(instance)));\n }\n // Existing items\n for (const instance of items) {\n addItem(instance);\n }\n // Added items\n this._store.add(onAddItem(instance => {\n addItem(instance);\n }));\n // Removed items\n this._store.add(onRemoveItem(instance => {\n itemListeners.deleteAndDispose(instance);\n }));\n this.event = multiplexer.event;\n }\n dispose() {\n this._store.dispose();\n }\n}\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n * emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nexport class EventBufferer {\n constructor() {\n this.buffers = [];\n }\n wrapEvent(event) {\n return (listener, thisArgs, disposables) => {\n return event(i => {\n const buffer = this.buffers[this.buffers.length - 1];\n if (buffer) {\n buffer.push(() => listener.call(thisArgs, i));\n }\n else {\n listener.call(thisArgs, i);\n }\n }, undefined, disposables);\n };\n }\n bufferEvents(fn) {\n const buffer = [];\n this.buffers.push(buffer);\n const r = fn();\n this.buffers.pop();\n buffer.forEach(flush => flush());\n return r;\n }\n}\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nexport class Relay {\n constructor() {\n this.listening = false;\n this.inputEvent = Event.None;\n this.inputEventListener = Disposable.None;\n this.emitter = new Emitter({\n onDidAddFirstListener: () => {\n this.listening = true;\n this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n },\n onDidRemoveLastListener: () => {\n this.listening = false;\n this.inputEventListener.dispose();\n }\n });\n this.event = this.emitter.event;\n }\n set input(event) {\n this.inputEvent = event;\n if (this.listening) {\n this.inputEventListener.dispose();\n this.inputEventListener = event(this.emitter.fire, this.emitter);\n }\n }\n dispose() {\n this.inputEventListener.dispose();\n this.emitter.dispose();\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { $window } from './window.js';\nimport { Emitter } from '../common/event.js';\nimport { Disposable, markAsSingleton } from '../common/lifecycle.js';\nclass WindowManager {\n constructor() {\n // --- Zoom Level\n this._zoomLevel = 0;\n // --- Zoom Factor\n this._zoomFactor = 1;\n // --- Fullscreen\n this._fullscreen = false;\n this._onDidChangeFullscreen = new Emitter();\n this.onDidChangeFullscreen = this._onDidChangeFullscreen.event;\n }\n getZoomLevel() {\n return this._zoomLevel;\n }\n setZoomLevel(zoomLevel) {\n if (this._zoomLevel === zoomLevel) {\n return;\n }\n this._zoomLevel = zoomLevel;\n }\n getZoomFactor() {\n return this._zoomFactor;\n }\n setZoomFactor(zoomFactor) {\n this._zoomFactor = zoomFactor;\n }\n setFullscreen(fullscreen) {\n if (this._fullscreen === fullscreen) {\n return;\n }\n this._fullscreen = fullscreen;\n this._onDidChangeFullscreen.fire();\n }\n isFullscreen() {\n return this._fullscreen;\n }\n}\nWindowManager.INSTANCE = new WindowManager();\n/**\n * See https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes\n */\nclass DevicePixelRatioMonitor extends Disposable {\n constructor() {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._listener = () => this._handleChange(true);\n this._mediaQueryList = null;\n this._handleChange(false);\n }\n _handleChange(fireEvent) {\n this._mediaQueryList?.removeEventListener('change', this._listener);\n this._mediaQueryList = $window.matchMedia(`(resolution: ${$window.devicePixelRatio}dppx)`);\n this._mediaQueryList.addEventListener('change', this._listener);\n if (fireEvent) {\n this._onDidChange.fire();\n }\n }\n}\nclass PixelRatioImpl extends Disposable {\n get value() {\n return this._value;\n }\n constructor() {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._value = this._getPixelRatio();\n const dprMonitor = this._register(new DevicePixelRatioMonitor());\n this._register(dprMonitor.onDidChange(() => {\n this._value = this._getPixelRatio();\n this._onDidChange.fire(this._value);\n }));\n }\n _getPixelRatio() {\n const ctx = document.createElement('canvas').getContext('2d');\n const dpr = $window.devicePixelRatio || 1;\n const bsr = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n return dpr / bsr;\n }\n}\nclass PixelRatioFacade {\n constructor() {\n this._pixelRatioMonitor = null;\n }\n _getOrCreatePixelRatioMonitor() {\n if (!this._pixelRatioMonitor) {\n this._pixelRatioMonitor = markAsSingleton(new PixelRatioImpl());\n }\n return this._pixelRatioMonitor;\n }\n /**\n * Get the current value.\n */\n get value() {\n return this._getOrCreatePixelRatioMonitor().value;\n }\n /**\n * Listen for changes.\n */\n get onDidChange() {\n return this._getOrCreatePixelRatioMonitor().onDidChange;\n }\n}\nexport function addMatchMediaChangeListener(query, callback) {\n if (typeof query === 'string') {\n query = $window.matchMedia(query);\n }\n query.addEventListener('change', callback);\n}\n/**\n * Returns the pixel ratio.\n *\n * This is useful for rendering elements at native screen resolution or for being used as\n * a cache key when storing font measurements. Fonts might render differently depending on resolution\n * and any measurements need to be discarded for example when a window is moved from a monitor to another.\n */\nexport const PixelRatio = new PixelRatioFacade();\n/** A zoom index, e.g. 1, 2, 3 */\nexport function setZoomLevel(zoomLevel) {\n WindowManager.INSTANCE.setZoomLevel(zoomLevel);\n}\nexport function getZoomLevel() {\n return WindowManager.INSTANCE.getZoomLevel();\n}\n/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */\nexport function getZoomFactor() {\n return WindowManager.INSTANCE.getZoomFactor();\n}\nexport function setZoomFactor(zoomFactor) {\n WindowManager.INSTANCE.setZoomFactor(zoomFactor);\n}\nexport function setFullscreen(fullscreen) {\n WindowManager.INSTANCE.setFullscreen(fullscreen);\n}\nexport function isFullscreen() {\n return WindowManager.INSTANCE.isFullscreen();\n}\nexport const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;\nconst userAgent = navigator.userAgent;\nexport const isFirefox = (userAgent.indexOf('Firefox') >= 0);\nexport const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);\nexport const isChrome = (userAgent.indexOf('Chrome') >= 0);\nexport const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));\nexport const isWebkitWebView = (!isChrome && !isSafari && isWebKit);\nexport const isElectron = (userAgent.indexOf('Electron/') >= 0);\nexport const isAndroid = (userAgent.indexOf('Android') >= 0);\nlet standalone = false;\nif ($window.matchMedia) {\n const standaloneMatchMedia = $window.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');\n const fullScreenMatchMedia = $window.matchMedia('(display-mode: fullscreen)');\n standalone = standaloneMatchMedia.matches;\n addMatchMediaChangeListener(standaloneMatchMedia, ({ matches }) => {\n // entering fullscreen would change standaloneMatchMedia.matches to false\n // if standalone is true (running as PWA) and entering fullscreen, skip this change\n if (standalone && fullScreenMatchMedia.matches) {\n return;\n }\n // otherwise update standalone (browser to PWA or PWA to browser)\n standalone = matches;\n });\n}\nexport function isStandalone() {\n return standalone;\n}\n// Visible means that the feature is enabled, not necessarily being rendered\n// e.g. visible is true even in fullscreen mode where the controls are hidden\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible\nexport function isWCOEnabled() {\n return navigator?.windowControlsOverlay?.visible;\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/**\n * @returns whether the provided parameter is a JavaScript String or not.\n */\nexport function isString(str) {\n return (typeof str === 'string');\n}\n/**\n * @returns whether the provided parameter is a JavaScript Array and each element in the array is a string.\n */\nexport function isStringArray(value) {\n return Array.isArray(value) && value.every(elem => isString(elem));\n}\n/**\n * @returns whether the provided parameter is of type `object` but **not**\n *\t`null`, an `array`, a `regexp`, nor a `date`.\n */\nexport function isObject(obj) {\n // The method can't do a type cast since there are type (like strings) which\n // are subclasses of any put not positvely matched by the function. Hence type\n // narrowing results in wrong results.\n return typeof obj === 'object'\n && obj !== null\n && !Array.isArray(obj)\n && !(obj instanceof RegExp)\n && !(obj instanceof Date);\n}\n/**\n * @returns whether the provided parameter is of type `Buffer` or Uint8Array dervived type\n */\nexport function isTypedArray(obj) {\n const TypedArray = Object.getPrototypeOf(Uint8Array);\n return typeof obj === 'object'\n && obj instanceof TypedArray;\n}\n/**\n * In **contrast** to just checking `typeof` this will return `false` for `NaN`.\n * @returns whether the provided parameter is a JavaScript Number or not.\n */\nexport function isNumber(obj) {\n return (typeof obj === 'number' && !isNaN(obj));\n}\n/**\n * @returns whether the provided parameter is an Iterable, casting to the given generic\n */\nexport function isIterable(obj) {\n return !!obj && typeof obj[Symbol.iterator] === 'function';\n}\n/**\n * @returns whether the provided parameter is a JavaScript Boolean or not.\n */\nexport function isBoolean(obj) {\n return (obj === true || obj === false);\n}\n/**\n * @returns whether the provided parameter is undefined.\n */\nexport function isUndefined(obj) {\n return (typeof obj === 'undefined');\n}\n/**\n * @returns whether the provided parameter is defined.\n */\nexport function isDefined(arg) {\n return !isUndefinedOrNull(arg);\n}\n/**\n * @returns whether the provided parameter is undefined or null.\n */\nexport function isUndefinedOrNull(obj) {\n return (isUndefined(obj) || obj === null);\n}\nexport function assertType(condition, type) {\n if (!condition) {\n throw new Error(type ? `Unexpected type, expected '${type}'` : 'Unexpected type');\n }\n}\n/**\n * Asserts that the argument passed in is neither undefined nor null.\n */\nexport function assertIsDefined(arg) {\n if (isUndefinedOrNull(arg)) {\n throw new Error('Assertion Failed: argument is undefined or null');\n }\n return arg;\n}\nexport function assertAllDefined(...args) {\n const result = [];\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (isUndefinedOrNull(arg)) {\n throw new Error(`Assertion Failed: argument at index ${i} is undefined or null`);\n }\n result.push(arg);\n }\n return result;\n}\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * @returns whether the provided parameter is an empty JavaScript Object or not.\n */\nexport function isEmptyObject(obj) {\n if (!isObject(obj)) {\n return false;\n }\n for (const key in obj) {\n if (hasOwnProperty.call(obj, key)) {\n return false;\n }\n }\n return true;\n}\n/**\n * @returns whether the provided parameter is a JavaScript Function or not.\n */\nexport function isFunction(obj) {\n return (typeof obj === 'function');\n}\n/**\n * @returns whether the provided parameters is are JavaScript Function or not.\n */\nexport function areFunctions(...objects) {\n return objects.length > 0 && objects.every(isFunction);\n}\nexport function validateConstraints(args, constraints) {\n const len = Math.min(args.length, constraints.length);\n for (let i = 0; i < len; i++) {\n validateConstraint(args[i], constraints[i]);\n }\n}\nexport function validateConstraint(arg, constraint) {\n if (isString(constraint)) {\n if (typeof arg !== constraint) {\n throw new Error(`argument does not match constraint: typeof ${constraint}`);\n }\n }\n else if (isFunction(constraint)) {\n try {\n if (arg instanceof constraint) {\n return;\n }\n }\n catch {\n // ignore\n }\n if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {\n return;\n }\n if (constraint.length === 1 && constraint.call(undefined, arg) === true) {\n return;\n }\n throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../nls.js';\nexport const LANGUAGE_DEFAULT = 'en';\nlet _isWindows = false;\nlet _isMacintosh = false;\nlet _isLinux = false;\nlet _isLinuxSnap = false;\nlet _isNative = false;\nlet _isWeb = false;\nlet _isElectron = false;\nlet _isIOS = false;\nlet _isCI = false;\nlet _isMobile = false;\nlet _locale = undefined;\nlet _language = LANGUAGE_DEFAULT;\nlet _platformLocale = LANGUAGE_DEFAULT;\nlet _translationsConfigFile = undefined;\nlet _userAgent = undefined;\nconst $globalThis = globalThis;\nlet nodeProcess = undefined;\nif (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {\n // Native environment (sandboxed)\n nodeProcess = $globalThis.vscode.process;\n}\nelse if (typeof process !== 'undefined') {\n // Native environment (non-sandboxed)\n nodeProcess = process;\n}\nconst isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';\nconst isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';\n// Web environment\nif (typeof navigator === 'object' && !isElectronRenderer) {\n _userAgent = navigator.userAgent;\n _isWindows = _userAgent.indexOf('Windows') >= 0;\n _isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\n _isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\n _isLinux = _userAgent.indexOf('Linux') >= 0;\n _isMobile = _userAgent?.indexOf('Mobi') >= 0;\n _isWeb = true;\n const configuredLocale = nls.getConfiguredDefaultLocale(\n // This call _must_ be done in the file that calls `nls.getConfiguredDefaultLocale`\n // to ensure that the NLS AMD Loader plugin has been loaded and configured.\n // This is because the loader plugin decides what the default locale is based on\n // how it's able to resolve the strings.\n nls.localizeWithPath('vs/base/common/platform', { key: 'ensureLoaderPluginIsLoaded', comment: ['{Locked}'] }, '_'));\n _locale = configuredLocale || LANGUAGE_DEFAULT;\n _language = _locale;\n _platformLocale = navigator.language;\n}\n// Native environment\nelse if (typeof nodeProcess === 'object') {\n _isWindows = (nodeProcess.platform === 'win32');\n _isMacintosh = (nodeProcess.platform === 'darwin');\n _isLinux = (nodeProcess.platform === 'linux');\n _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\n _isElectron = isElectronProcess;\n _isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];\n _locale = LANGUAGE_DEFAULT;\n _language = LANGUAGE_DEFAULT;\n const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\n if (rawNlsConfig) {\n try {\n const nlsConfig = JSON.parse(rawNlsConfig);\n const resolved = nlsConfig.availableLanguages['*'];\n _locale = nlsConfig.locale;\n _platformLocale = nlsConfig.osLocale;\n // VSCode's default language is 'en'\n _language = resolved ? resolved : LANGUAGE_DEFAULT;\n _translationsConfigFile = nlsConfig._translationsConfigFile;\n }\n catch (e) {\n }\n }\n _isNative = true;\n}\n// Unknown environment\nelse {\n console.error('Unable to resolve platform.');\n}\nexport function PlatformToString(platform) {\n switch (platform) {\n case 0 /* Platform.Web */: return 'Web';\n case 1 /* Platform.Mac */: return 'Mac';\n case 2 /* Platform.Linux */: return 'Linux';\n case 3 /* Platform.Windows */: return 'Windows';\n }\n}\nlet _platform = 0 /* Platform.Web */;\nif (_isMacintosh) {\n _platform = 1 /* Platform.Mac */;\n}\nelse if (_isWindows) {\n _platform = 3 /* Platform.Windows */;\n}\nelse if (_isLinux) {\n _platform = 2 /* Platform.Linux */;\n}\nexport const isWindows = _isWindows;\nexport const isMacintosh = _isMacintosh;\nexport const isLinux = _isLinux;\nexport const isLinuxSnap = _isLinuxSnap;\nexport const isNative = _isNative;\nexport const isElectron = _isElectron;\nexport const isWeb = _isWeb;\nexport const isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function');\nexport const webWorkerOrigin = isWebWorker ? $globalThis.origin : undefined;\nexport const isIOS = _isIOS;\nexport const isMobile = _isMobile;\n/**\n * Whether we run inside a CI environment, such as\n * GH actions or Azure Pipelines.\n */\nexport const isCI = _isCI;\nexport const platform = _platform;\nexport const userAgent = _userAgent;\n/**\n * The language used for the user interface. The format of\n * the string is all lower case (e.g. zh-tw for Traditional\n * Chinese)\n */\nexport const language = _language;\nexport var Language;\n(function (Language) {\n function value() {\n return language;\n }\n Language.value = value;\n function isDefaultVariant() {\n if (language.length === 2) {\n return language === 'en';\n }\n else if (language.length >= 3) {\n return language[0] === 'e' && language[1] === 'n' && language[2] === '-';\n }\n else {\n return false;\n }\n }\n Language.isDefaultVariant = isDefaultVariant;\n function isDefault() {\n return language === 'en';\n }\n Language.isDefault = isDefault;\n})(Language || (Language = {}));\n/**\n * The OS locale or the locale specified by --locale. The format of\n * the string is all lower case (e.g. zh-tw for Traditional\n * Chinese). The UI is not necessarily shown in the provided locale.\n */\nexport const locale = _locale;\n/**\n * This will always be set to the OS/browser's locale regardless of\n * what was specified by --locale. The format of the string is all\n * lower case (e.g. zh-tw for Traditional Chinese). The UI is not\n * necessarily shown in the provided locale.\n */\nexport const platformLocale = _platformLocale;\n/**\n * The translations that are available through language packs.\n */\nexport const translationsConfigFile = _translationsConfigFile;\nexport const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);\n/**\n * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.\n *\n * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay\n * that browsers set when the nesting level is > 5.\n */\nexport const setTimeout0 = (() => {\n if (setTimeout0IsFaster) {\n const pending = [];\n $globalThis.addEventListener('message', (e) => {\n if (e.data && e.data.vscodeScheduleAsyncWork) {\n for (let i = 0, len = pending.length; i < len; i++) {\n const candidate = pending[i];\n if (candidate.id === e.data.vscodeScheduleAsyncWork) {\n pending.splice(i, 1);\n candidate.callback();\n return;\n }\n }\n }\n });\n let lastId = 0;\n return (callback) => {\n const myId = ++lastId;\n pending.push({\n id: myId,\n callback: callback\n });\n $globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');\n };\n }\n return (callback) => setTimeout(callback);\n})();\nexport const OS = (_isMacintosh || _isIOS ? 2 /* OperatingSystem.Macintosh */ : (_isWindows ? 1 /* OperatingSystem.Windows */ : 3 /* OperatingSystem.Linux */));\nlet _isLittleEndian = true;\nlet _isLittleEndianComputed = false;\nexport function isLittleEndian() {\n if (!_isLittleEndianComputed) {\n _isLittleEndianComputed = true;\n const test = new Uint8Array(2);\n test[0] = 1;\n test[1] = 2;\n const view = new Uint16Array(test.buffer);\n _isLittleEndian = (view[0] === (2 << 8) + 1);\n }\n return _isLittleEndian;\n}\nexport const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);\nexport const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0);\nexport const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0));\nexport const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0);\nexport const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0);\nexport function isBigSurOrNewer(osVersion) {\n return parseFloat(osVersion) >= 20;\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from './browser.js';\nimport { mainWindow } from './window.js';\nimport * as platform from '../common/platform.js';\n/**\n * Browser feature we can support in current platform, browser and environment.\n */\nexport const BrowserFeatures = {\n clipboard: {\n writeText: (platform.isNative\n || (document.queryCommandSupported && document.queryCommandSupported('copy'))\n || !!(navigator && navigator.clipboard && navigator.clipboard.writeText)),\n readText: (platform.isNative\n || !!(navigator && navigator.clipboard && navigator.clipboard.readText))\n },\n keyboard: (() => {\n if (platform.isNative || browser.isStandalone()) {\n return 0 /* KeyboardSupport.Always */;\n }\n if (navigator.keyboard || browser.isSafari) {\n return 1 /* KeyboardSupport.FullScreen */;\n }\n return 2 /* KeyboardSupport.None */;\n })(),\n // 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be\n // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n touch: 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0,\n pointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0 || navigator.maxTouchPoints > 0)\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 *--------------------------------------------------------------------------------------------*/\nclass KeyCodeStrMap {\n constructor() {\n this._keyCodeToStr = [];\n this._strToKeyCode = Object.create(null);\n }\n define(keyCode, str) {\n this._keyCodeToStr[keyCode] = str;\n this._strToKeyCode[str.toLowerCase()] = keyCode;\n }\n keyCodeToStr(keyCode) {\n return this._keyCodeToStr[keyCode];\n }\n strToKeyCode(str) {\n return this._strToKeyCode[str.toLowerCase()] || 0 /* KeyCode.Unknown */;\n }\n}\nconst uiMap = new KeyCodeStrMap();\nconst userSettingsUSMap = new KeyCodeStrMap();\nconst userSettingsGeneralMap = new KeyCodeStrMap();\nexport const EVENT_KEY_CODE_MAP = new Array(230);\nexport const NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE = {};\nconst scanCodeIntToStr = [];\nconst scanCodeStrToInt = Object.create(null);\nconst scanCodeLowerCaseStrToInt = Object.create(null);\nexport const ScanCodeUtils = {\n lowerCaseToEnum: (scanCode) => scanCodeLowerCaseStrToInt[scanCode] || 0 /* ScanCode.None */,\n toEnum: (scanCode) => scanCodeStrToInt[scanCode] || 0 /* ScanCode.None */,\n toString: (scanCode) => scanCodeIntToStr[scanCode] || 'None'\n};\n/**\n * -1 if a ScanCode => KeyCode mapping depends on kb layout.\n */\nexport const IMMUTABLE_CODE_TO_KEY_CODE = [];\n/**\n * -1 if a KeyCode => ScanCode mapping depends on kb layout.\n */\nexport const IMMUTABLE_KEY_CODE_TO_CODE = [];\nfor (let i = 0; i <= 193 /* ScanCode.MAX_VALUE */; i++) {\n IMMUTABLE_CODE_TO_KEY_CODE[i] = -1 /* KeyCode.DependsOnKbLayout */;\n}\nfor (let i = 0; i <= 132 /* KeyCode.MAX_VALUE */; i++) {\n IMMUTABLE_KEY_CODE_TO_CODE[i] = -1 /* ScanCode.DependsOnKbLayout */;\n}\n(function () {\n // See https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n // See https://github.com/microsoft/node-native-keymap/blob/88c0b0e5/deps/chromium/keyboard_codes_win.h\n const empty = '';\n const mappings = [\n // immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel\n [1, 0 /* ScanCode.None */, 'None', 0 /* KeyCode.Unknown */, 'unknown', 0, 'VK_UNKNOWN', empty, empty],\n [1, 1 /* ScanCode.Hyper */, 'Hyper', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 2 /* ScanCode.Super */, 'Super', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 3 /* ScanCode.Fn */, 'Fn', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 4 /* ScanCode.FnLock */, 'FnLock', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 5 /* ScanCode.Suspend */, 'Suspend', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 6 /* ScanCode.Resume */, 'Resume', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 7 /* ScanCode.Turbo */, 'Turbo', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 8 /* ScanCode.Sleep */, 'Sleep', 0 /* KeyCode.Unknown */, empty, 0, 'VK_SLEEP', empty, empty],\n [1, 9 /* ScanCode.WakeUp */, 'WakeUp', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [0, 10 /* ScanCode.KeyA */, 'KeyA', 31 /* KeyCode.KeyA */, 'A', 65, 'VK_A', empty, empty],\n [0, 11 /* ScanCode.KeyB */, 'KeyB', 32 /* KeyCode.KeyB */, 'B', 66, 'VK_B', empty, empty],\n [0, 12 /* ScanCode.KeyC */, 'KeyC', 33 /* KeyCode.KeyC */, 'C', 67, 'VK_C', empty, empty],\n [0, 13 /* ScanCode.KeyD */, 'KeyD', 34 /* KeyCode.KeyD */, 'D', 68, 'VK_D', empty, empty],\n [0, 14 /* ScanCode.KeyE */, 'KeyE', 35 /* KeyCode.KeyE */, 'E', 69, 'VK_E', empty, empty],\n [0, 15 /* ScanCode.KeyF */, 'KeyF', 36 /* KeyCode.KeyF */, 'F', 70, 'VK_F', empty, empty],\n [0, 16 /* ScanCode.KeyG */, 'KeyG', 37 /* KeyCode.KeyG */, 'G', 71, 'VK_G', empty, empty],\n [0, 17 /* ScanCode.KeyH */, 'KeyH', 38 /* KeyCode.KeyH */, 'H', 72, 'VK_H', empty, empty],\n [0, 18 /* ScanCode.KeyI */, 'KeyI', 39 /* KeyCode.KeyI */, 'I', 73, 'VK_I', empty, empty],\n [0, 19 /* ScanCode.KeyJ */, 'KeyJ', 40 /* KeyCode.KeyJ */, 'J', 74, 'VK_J', empty, empty],\n [0, 20 /* ScanCode.KeyK */, 'KeyK', 41 /* KeyCode.KeyK */, 'K', 75, 'VK_K', empty, empty],\n [0, 21 /* ScanCode.KeyL */, 'KeyL', 42 /* KeyCode.KeyL */, 'L', 76, 'VK_L', empty, empty],\n [0, 22 /* ScanCode.KeyM */, 'KeyM', 43 /* KeyCode.KeyM */, 'M', 77, 'VK_M', empty, empty],\n [0, 23 /* ScanCode.KeyN */, 'KeyN', 44 /* KeyCode.KeyN */, 'N', 78, 'VK_N', empty, empty],\n [0, 24 /* ScanCode.KeyO */, 'KeyO', 45 /* KeyCode.KeyO */, 'O', 79, 'VK_O', empty, empty],\n [0, 25 /* ScanCode.KeyP */, 'KeyP', 46 /* KeyCode.KeyP */, 'P', 80, 'VK_P', empty, empty],\n [0, 26 /* ScanCode.KeyQ */, 'KeyQ', 47 /* KeyCode.KeyQ */, 'Q', 81, 'VK_Q', empty, empty],\n [0, 27 /* ScanCode.KeyR */, 'KeyR', 48 /* KeyCode.KeyR */, 'R', 82, 'VK_R', empty, empty],\n [0, 28 /* ScanCode.KeyS */, 'KeyS', 49 /* KeyCode.KeyS */, 'S', 83, 'VK_S', empty, empty],\n [0, 29 /* ScanCode.KeyT */, 'KeyT', 50 /* KeyCode.KeyT */, 'T', 84, 'VK_T', empty, empty],\n [0, 30 /* ScanCode.KeyU */, 'KeyU', 51 /* KeyCode.KeyU */, 'U', 85, 'VK_U', empty, empty],\n [0, 31 /* ScanCode.KeyV */, 'KeyV', 52 /* KeyCode.KeyV */, 'V', 86, 'VK_V', empty, empty],\n [0, 32 /* ScanCode.KeyW */, 'KeyW', 53 /* KeyCode.KeyW */, 'W', 87, 'VK_W', empty, empty],\n [0, 33 /* ScanCode.KeyX */, 'KeyX', 54 /* KeyCode.KeyX */, 'X', 88, 'VK_X', empty, empty],\n [0, 34 /* ScanCode.KeyY */, 'KeyY', 55 /* KeyCode.KeyY */, 'Y', 89, 'VK_Y', empty, empty],\n [0, 35 /* ScanCode.KeyZ */, 'KeyZ', 56 /* KeyCode.KeyZ */, 'Z', 90, 'VK_Z', empty, empty],\n [0, 36 /* ScanCode.Digit1 */, 'Digit1', 22 /* KeyCode.Digit1 */, '1', 49, 'VK_1', empty, empty],\n [0, 37 /* ScanCode.Digit2 */, 'Digit2', 23 /* KeyCode.Digit2 */, '2', 50, 'VK_2', empty, empty],\n [0, 38 /* ScanCode.Digit3 */, 'Digit3', 24 /* KeyCode.Digit3 */, '3', 51, 'VK_3', empty, empty],\n [0, 39 /* ScanCode.Digit4 */, 'Digit4', 25 /* KeyCode.Digit4 */, '4', 52, 'VK_4', empty, empty],\n [0, 40 /* ScanCode.Digit5 */, 'Digit5', 26 /* KeyCode.Digit5 */, '5', 53, 'VK_5', empty, empty],\n [0, 41 /* ScanCode.Digit6 */, 'Digit6', 27 /* KeyCode.Digit6 */, '6', 54, 'VK_6', empty, empty],\n [0, 42 /* ScanCode.Digit7 */, 'Digit7', 28 /* KeyCode.Digit7 */, '7', 55, 'VK_7', empty, empty],\n [0, 43 /* ScanCode.Digit8 */, 'Digit8', 29 /* KeyCode.Digit8 */, '8', 56, 'VK_8', empty, empty],\n [0, 44 /* ScanCode.Digit9 */, 'Digit9', 30 /* KeyCode.Digit9 */, '9', 57, 'VK_9', empty, empty],\n [0, 45 /* ScanCode.Digit0 */, 'Digit0', 21 /* KeyCode.Digit0 */, '0', 48, 'VK_0', empty, empty],\n [1, 46 /* ScanCode.Enter */, 'Enter', 3 /* KeyCode.Enter */, 'Enter', 13, 'VK_RETURN', empty, empty],\n [1, 47 /* ScanCode.Escape */, 'Escape', 9 /* KeyCode.Escape */, 'Escape', 27, 'VK_ESCAPE', empty, empty],\n [1, 48 /* ScanCode.Backspace */, 'Backspace', 1 /* KeyCode.Backspace */, 'Backspace', 8, 'VK_BACK', empty, empty],\n [1, 49 /* ScanCode.Tab */, 'Tab', 2 /* KeyCode.Tab */, 'Tab', 9, 'VK_TAB', empty, empty],\n [1, 50 /* ScanCode.Space */, 'Space', 10 /* KeyCode.Space */, 'Space', 32, 'VK_SPACE', empty, empty],\n [0, 51 /* ScanCode.Minus */, 'Minus', 88 /* KeyCode.Minus */, '-', 189, 'VK_OEM_MINUS', '-', 'OEM_MINUS'],\n [0, 52 /* ScanCode.Equal */, 'Equal', 86 /* KeyCode.Equal */, '=', 187, 'VK_OEM_PLUS', '=', 'OEM_PLUS'],\n [0, 53 /* ScanCode.BracketLeft */, 'BracketLeft', 92 /* KeyCode.BracketLeft */, '[', 219, 'VK_OEM_4', '[', 'OEM_4'],\n [0, 54 /* ScanCode.BracketRight */, 'BracketRight', 94 /* KeyCode.BracketRight */, ']', 221, 'VK_OEM_6', ']', 'OEM_6'],\n [0, 55 /* ScanCode.Backslash */, 'Backslash', 93 /* KeyCode.Backslash */, '\\\\', 220, 'VK_OEM_5', '\\\\', 'OEM_5'],\n [0, 56 /* ScanCode.IntlHash */, 'IntlHash', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], // has been dropped from the w3c spec\n [0, 57 /* ScanCode.Semicolon */, 'Semicolon', 85 /* KeyCode.Semicolon */, ';', 186, 'VK_OEM_1', ';', 'OEM_1'],\n [0, 58 /* ScanCode.Quote */, 'Quote', 95 /* KeyCode.Quote */, '\\'', 222, 'VK_OEM_7', '\\'', 'OEM_7'],\n [0, 59 /* ScanCode.Backquote */, 'Backquote', 91 /* KeyCode.Backquote */, '`', 192, 'VK_OEM_3', '`', 'OEM_3'],\n [0, 60 /* ScanCode.Comma */, 'Comma', 87 /* KeyCode.Comma */, ',', 188, 'VK_OEM_COMMA', ',', 'OEM_COMMA'],\n [0, 61 /* ScanCode.Period */, 'Period', 89 /* KeyCode.Period */, '.', 190, 'VK_OEM_PERIOD', '.', 'OEM_PERIOD'],\n [0, 62 /* ScanCode.Slash */, 'Slash', 90 /* KeyCode.Slash */, '/', 191, 'VK_OEM_2', '/', 'OEM_2'],\n [1, 63 /* ScanCode.CapsLock */, 'CapsLock', 8 /* KeyCode.CapsLock */, 'CapsLock', 20, 'VK_CAPITAL', empty, empty],\n [1, 64 /* ScanCode.F1 */, 'F1', 59 /* KeyCode.F1 */, 'F1', 112, 'VK_F1', empty, empty],\n [1, 65 /* ScanCode.F2 */, 'F2', 60 /* KeyCode.F2 */, 'F2', 113, 'VK_F2', empty, empty],\n [1, 66 /* ScanCode.F3 */, 'F3', 61 /* KeyCode.F3 */, 'F3', 114, 'VK_F3', empty, empty],\n [1, 67 /* ScanCode.F4 */, 'F4', 62 /* KeyCode.F4 */, 'F4', 115, 'VK_F4', empty, empty],\n [1, 68 /* ScanCode.F5 */, 'F5', 63 /* KeyCode.F5 */, 'F5', 116, 'VK_F5', empty, empty],\n [1, 69 /* ScanCode.F6 */, 'F6', 64 /* KeyCode.F6 */, 'F6', 117, 'VK_F6', empty, empty],\n [1, 70 /* ScanCode.F7 */, 'F7', 65 /* KeyCode.F7 */, 'F7', 118, 'VK_F7', empty, empty],\n [1, 71 /* ScanCode.F8 */, 'F8', 66 /* KeyCode.F8 */, 'F8', 119, 'VK_F8', empty, empty],\n [1, 72 /* ScanCode.F9 */, 'F9', 67 /* KeyCode.F9 */, 'F9', 120, 'VK_F9', empty, empty],\n [1, 73 /* ScanCode.F10 */, 'F10', 68 /* KeyCode.F10 */, 'F10', 121, 'VK_F10', empty, empty],\n [1, 74 /* ScanCode.F11 */, 'F11', 69 /* KeyCode.F11 */, 'F11', 122, 'VK_F11', empty, empty],\n [1, 75 /* ScanCode.F12 */, 'F12', 70 /* KeyCode.F12 */, 'F12', 123, 'VK_F12', empty, empty],\n [1, 76 /* ScanCode.PrintScreen */, 'PrintScreen', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 77 /* ScanCode.ScrollLock */, 'ScrollLock', 84 /* KeyCode.ScrollLock */, 'ScrollLock', 145, 'VK_SCROLL', empty, empty],\n [1, 78 /* ScanCode.Pause */, 'Pause', 7 /* KeyCode.PauseBreak */, 'PauseBreak', 19, 'VK_PAUSE', empty, empty],\n [1, 79 /* ScanCode.Insert */, 'Insert', 19 /* KeyCode.Insert */, 'Insert', 45, 'VK_INSERT', empty, empty],\n [1, 80 /* ScanCode.Home */, 'Home', 14 /* KeyCode.Home */, 'Home', 36, 'VK_HOME', empty, empty],\n [1, 81 /* ScanCode.PageUp */, 'PageUp', 11 /* KeyCode.PageUp */, 'PageUp', 33, 'VK_PRIOR', empty, empty],\n [1, 82 /* ScanCode.Delete */, 'Delete', 20 /* KeyCode.Delete */, 'Delete', 46, 'VK_DELETE', empty, empty],\n [1, 83 /* ScanCode.End */, 'End', 13 /* KeyCode.End */, 'End', 35, 'VK_END', empty, empty],\n [1, 84 /* ScanCode.PageDown */, 'PageDown', 12 /* KeyCode.PageDown */, 'PageDown', 34, 'VK_NEXT', empty, empty],\n [1, 85 /* ScanCode.ArrowRight */, 'ArrowRight', 17 /* KeyCode.RightArrow */, 'RightArrow', 39, 'VK_RIGHT', 'Right', empty],\n [1, 86 /* ScanCode.ArrowLeft */, 'ArrowLeft', 15 /* KeyCode.LeftArrow */, 'LeftArrow', 37, 'VK_LEFT', 'Left', empty],\n [1, 87 /* ScanCode.ArrowDown */, 'ArrowDown', 18 /* KeyCode.DownArrow */, 'DownArrow', 40, 'VK_DOWN', 'Down', empty],\n [1, 88 /* ScanCode.ArrowUp */, 'ArrowUp', 16 /* KeyCode.UpArrow */, 'UpArrow', 38, 'VK_UP', 'Up', empty],\n [1, 89 /* ScanCode.NumLock */, 'NumLock', 83 /* KeyCode.NumLock */, 'NumLock', 144, 'VK_NUMLOCK', empty, empty],\n [1, 90 /* ScanCode.NumpadDivide */, 'NumpadDivide', 113 /* KeyCode.NumpadDivide */, 'NumPad_Divide', 111, 'VK_DIVIDE', empty, empty],\n [1, 91 /* ScanCode.NumpadMultiply */, 'NumpadMultiply', 108 /* KeyCode.NumpadMultiply */, 'NumPad_Multiply', 106, 'VK_MULTIPLY', empty, empty],\n [1, 92 /* ScanCode.NumpadSubtract */, 'NumpadSubtract', 111 /* KeyCode.NumpadSubtract */, 'NumPad_Subtract', 109, 'VK_SUBTRACT', empty, empty],\n [1, 93 /* ScanCode.NumpadAdd */, 'NumpadAdd', 109 /* KeyCode.NumpadAdd */, 'NumPad_Add', 107, 'VK_ADD', empty, empty],\n [1, 94 /* ScanCode.NumpadEnter */, 'NumpadEnter', 3 /* KeyCode.Enter */, empty, 0, empty, empty, empty],\n [1, 95 /* ScanCode.Numpad1 */, 'Numpad1', 99 /* KeyCode.Numpad1 */, 'NumPad1', 97, 'VK_NUMPAD1', empty, empty],\n [1, 96 /* ScanCode.Numpad2 */, 'Numpad2', 100 /* KeyCode.Numpad2 */, 'NumPad2', 98, 'VK_NUMPAD2', empty, empty],\n [1, 97 /* ScanCode.Numpad3 */, 'Numpad3', 101 /* KeyCode.Numpad3 */, 'NumPad3', 99, 'VK_NUMPAD3', empty, empty],\n [1, 98 /* ScanCode.Numpad4 */, 'Numpad4', 102 /* KeyCode.Numpad4 */, 'NumPad4', 100, 'VK_NUMPAD4', empty, empty],\n [1, 99 /* ScanCode.Numpad5 */, 'Numpad5', 103 /* KeyCode.Numpad5 */, 'NumPad5', 101, 'VK_NUMPAD5', empty, empty],\n [1, 100 /* ScanCode.Numpad6 */, 'Numpad6', 104 /* KeyCode.Numpad6 */, 'NumPad6', 102, 'VK_NUMPAD6', empty, empty],\n [1, 101 /* ScanCode.Numpad7 */, 'Numpad7', 105 /* KeyCode.Numpad7 */, 'NumPad7', 103, 'VK_NUMPAD7', empty, empty],\n [1, 102 /* ScanCode.Numpad8 */, 'Numpad8', 106 /* KeyCode.Numpad8 */, 'NumPad8', 104, 'VK_NUMPAD8', empty, empty],\n [1, 103 /* ScanCode.Numpad9 */, 'Numpad9', 107 /* KeyCode.Numpad9 */, 'NumPad9', 105, 'VK_NUMPAD9', empty, empty],\n [1, 104 /* ScanCode.Numpad0 */, 'Numpad0', 98 /* KeyCode.Numpad0 */, 'NumPad0', 96, 'VK_NUMPAD0', empty, empty],\n [1, 105 /* ScanCode.NumpadDecimal */, 'NumpadDecimal', 112 /* KeyCode.NumpadDecimal */, 'NumPad_Decimal', 110, 'VK_DECIMAL', empty, empty],\n [0, 106 /* ScanCode.IntlBackslash */, 'IntlBackslash', 97 /* KeyCode.IntlBackslash */, 'OEM_102', 226, 'VK_OEM_102', empty, empty],\n [1, 107 /* ScanCode.ContextMenu */, 'ContextMenu', 58 /* KeyCode.ContextMenu */, 'ContextMenu', 93, empty, empty, empty],\n [1, 108 /* ScanCode.Power */, 'Power', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 109 /* ScanCode.NumpadEqual */, 'NumpadEqual', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 110 /* ScanCode.F13 */, 'F13', 71 /* KeyCode.F13 */, 'F13', 124, 'VK_F13', empty, empty],\n [1, 111 /* ScanCode.F14 */, 'F14', 72 /* KeyCode.F14 */, 'F14', 125, 'VK_F14', empty, empty],\n [1, 112 /* ScanCode.F15 */, 'F15', 73 /* KeyCode.F15 */, 'F15', 126, 'VK_F15', empty, empty],\n [1, 113 /* ScanCode.F16 */, 'F16', 74 /* KeyCode.F16 */, 'F16', 127, 'VK_F16', empty, empty],\n [1, 114 /* ScanCode.F17 */, 'F17', 75 /* KeyCode.F17 */, 'F17', 128, 'VK_F17', empty, empty],\n [1, 115 /* ScanCode.F18 */, 'F18', 76 /* KeyCode.F18 */, 'F18', 129, 'VK_F18', empty, empty],\n [1, 116 /* ScanCode.F19 */, 'F19', 77 /* KeyCode.F19 */, 'F19', 130, 'VK_F19', empty, empty],\n [1, 117 /* ScanCode.F20 */, 'F20', 78 /* KeyCode.F20 */, 'F20', 131, 'VK_F20', empty, empty],\n [1, 118 /* ScanCode.F21 */, 'F21', 79 /* KeyCode.F21 */, 'F21', 132, 'VK_F21', empty, empty],\n [1, 119 /* ScanCode.F22 */, 'F22', 80 /* KeyCode.F22 */, 'F22', 133, 'VK_F22', empty, empty],\n [1, 120 /* ScanCode.F23 */, 'F23', 81 /* KeyCode.F23 */, 'F23', 134, 'VK_F23', empty, empty],\n [1, 121 /* ScanCode.F24 */, 'F24', 82 /* KeyCode.F24 */, 'F24', 135, 'VK_F24', empty, empty],\n [1, 122 /* ScanCode.Open */, 'Open', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 123 /* ScanCode.Help */, 'Help', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 124 /* ScanCode.Select */, 'Select', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 125 /* ScanCode.Again */, 'Again', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 126 /* ScanCode.Undo */, 'Undo', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 127 /* ScanCode.Cut */, 'Cut', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 128 /* ScanCode.Copy */, 'Copy', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 129 /* ScanCode.Paste */, 'Paste', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 130 /* ScanCode.Find */, 'Find', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 131 /* ScanCode.AudioVolumeMute */, 'AudioVolumeMute', 117 /* KeyCode.AudioVolumeMute */, 'AudioVolumeMute', 173, 'VK_VOLUME_MUTE', empty, empty],\n [1, 132 /* ScanCode.AudioVolumeUp */, 'AudioVolumeUp', 118 /* KeyCode.AudioVolumeUp */, 'AudioVolumeUp', 175, 'VK_VOLUME_UP', empty, empty],\n [1, 133 /* ScanCode.AudioVolumeDown */, 'AudioVolumeDown', 119 /* KeyCode.AudioVolumeDown */, 'AudioVolumeDown', 174, 'VK_VOLUME_DOWN', empty, empty],\n [1, 134 /* ScanCode.NumpadComma */, 'NumpadComma', 110 /* KeyCode.NUMPAD_SEPARATOR */, 'NumPad_Separator', 108, 'VK_SEPARATOR', empty, empty],\n [0, 135 /* ScanCode.IntlRo */, 'IntlRo', 115 /* KeyCode.ABNT_C1 */, 'ABNT_C1', 193, 'VK_ABNT_C1', empty, empty],\n [1, 136 /* ScanCode.KanaMode */, 'KanaMode', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [0, 137 /* ScanCode.IntlYen */, 'IntlYen', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 138 /* ScanCode.Convert */, 'Convert', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 139 /* ScanCode.NonConvert */, 'NonConvert', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 140 /* ScanCode.Lang1 */, 'Lang1', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 141 /* ScanCode.Lang2 */, 'Lang2', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 142 /* ScanCode.Lang3 */, 'Lang3', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 143 /* ScanCode.Lang4 */, 'Lang4', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 144 /* ScanCode.Lang5 */, 'Lang5', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 145 /* ScanCode.Abort */, 'Abort', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 146 /* ScanCode.Props */, 'Props', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 147 /* ScanCode.NumpadParenLeft */, 'NumpadParenLeft', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 148 /* ScanCode.NumpadParenRight */, 'NumpadParenRight', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 149 /* ScanCode.NumpadBackspace */, 'NumpadBackspace', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 150 /* ScanCode.NumpadMemoryStore */, 'NumpadMemoryStore', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 151 /* ScanCode.NumpadMemoryRecall */, 'NumpadMemoryRecall', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 152 /* ScanCode.NumpadMemoryClear */, 'NumpadMemoryClear', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 153 /* ScanCode.NumpadMemoryAdd */, 'NumpadMemoryAdd', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 154 /* ScanCode.NumpadMemorySubtract */, 'NumpadMemorySubtract', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 155 /* ScanCode.NumpadClear */, 'NumpadClear', 131 /* KeyCode.Clear */, 'Clear', 12, 'VK_CLEAR', empty, empty],\n [1, 156 /* ScanCode.NumpadClearEntry */, 'NumpadClearEntry', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 0 /* ScanCode.None */, empty, 5 /* KeyCode.Ctrl */, 'Ctrl', 17, 'VK_CONTROL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 4 /* KeyCode.Shift */, 'Shift', 16, 'VK_SHIFT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 6 /* KeyCode.Alt */, 'Alt', 18, 'VK_MENU', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 57 /* KeyCode.Meta */, 'Meta', 91, 'VK_COMMAND', empty, empty],\n [1, 157 /* ScanCode.ControlLeft */, 'ControlLeft', 5 /* KeyCode.Ctrl */, empty, 0, 'VK_LCONTROL', empty, empty],\n [1, 158 /* ScanCode.ShiftLeft */, 'ShiftLeft', 4 /* KeyCode.Shift */, empty, 0, 'VK_LSHIFT', empty, empty],\n [1, 159 /* ScanCode.AltLeft */, 'AltLeft', 6 /* KeyCode.Alt */, empty, 0, 'VK_LMENU', empty, empty],\n [1, 160 /* ScanCode.MetaLeft */, 'MetaLeft', 57 /* KeyCode.Meta */, empty, 0, 'VK_LWIN', empty, empty],\n [1, 161 /* ScanCode.ControlRight */, 'ControlRight', 5 /* KeyCode.Ctrl */, empty, 0, 'VK_RCONTROL', empty, empty],\n [1, 162 /* ScanCode.ShiftRight */, 'ShiftRight', 4 /* KeyCode.Shift */, empty, 0, 'VK_RSHIFT', empty, empty],\n [1, 163 /* ScanCode.AltRight */, 'AltRight', 6 /* KeyCode.Alt */, empty, 0, 'VK_RMENU', empty, empty],\n [1, 164 /* ScanCode.MetaRight */, 'MetaRight', 57 /* KeyCode.Meta */, empty, 0, 'VK_RWIN', empty, empty],\n [1, 165 /* ScanCode.BrightnessUp */, 'BrightnessUp', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 166 /* ScanCode.BrightnessDown */, 'BrightnessDown', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 167 /* ScanCode.MediaPlay */, 'MediaPlay', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 168 /* ScanCode.MediaRecord */, 'MediaRecord', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 169 /* ScanCode.MediaFastForward */, 'MediaFastForward', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 170 /* ScanCode.MediaRewind */, 'MediaRewind', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 171 /* ScanCode.MediaTrackNext */, 'MediaTrackNext', 124 /* KeyCode.MediaTrackNext */, 'MediaTrackNext', 176, 'VK_MEDIA_NEXT_TRACK', empty, empty],\n [1, 172 /* ScanCode.MediaTrackPrevious */, 'MediaTrackPrevious', 125 /* KeyCode.MediaTrackPrevious */, 'MediaTrackPrevious', 177, 'VK_MEDIA_PREV_TRACK', empty, empty],\n [1, 173 /* ScanCode.MediaStop */, 'MediaStop', 126 /* KeyCode.MediaStop */, 'MediaStop', 178, 'VK_MEDIA_STOP', empty, empty],\n [1, 174 /* ScanCode.Eject */, 'Eject', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 175 /* ScanCode.MediaPlayPause */, 'MediaPlayPause', 127 /* KeyCode.MediaPlayPause */, 'MediaPlayPause', 179, 'VK_MEDIA_PLAY_PAUSE', empty, empty],\n [1, 176 /* ScanCode.MediaSelect */, 'MediaSelect', 128 /* KeyCode.LaunchMediaPlayer */, 'LaunchMediaPlayer', 181, 'VK_MEDIA_LAUNCH_MEDIA_SELECT', empty, empty],\n [1, 177 /* ScanCode.LaunchMail */, 'LaunchMail', 129 /* KeyCode.LaunchMail */, 'LaunchMail', 180, 'VK_MEDIA_LAUNCH_MAIL', empty, empty],\n [1, 178 /* ScanCode.LaunchApp2 */, 'LaunchApp2', 130 /* KeyCode.LaunchApp2 */, 'LaunchApp2', 183, 'VK_MEDIA_LAUNCH_APP2', empty, empty],\n [1, 179 /* ScanCode.LaunchApp1 */, 'LaunchApp1', 0 /* KeyCode.Unknown */, empty, 0, 'VK_MEDIA_LAUNCH_APP1', empty, empty],\n [1, 180 /* ScanCode.SelectTask */, 'SelectTask', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 181 /* ScanCode.LaunchScreenSaver */, 'LaunchScreenSaver', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 182 /* ScanCode.BrowserSearch */, 'BrowserSearch', 120 /* KeyCode.BrowserSearch */, 'BrowserSearch', 170, 'VK_BROWSER_SEARCH', empty, empty],\n [1, 183 /* ScanCode.BrowserHome */, 'BrowserHome', 121 /* KeyCode.BrowserHome */, 'BrowserHome', 172, 'VK_BROWSER_HOME', empty, empty],\n [1, 184 /* ScanCode.BrowserBack */, 'BrowserBack', 122 /* KeyCode.BrowserBack */, 'BrowserBack', 166, 'VK_BROWSER_BACK', empty, empty],\n [1, 185 /* ScanCode.BrowserForward */, 'BrowserForward', 123 /* KeyCode.BrowserForward */, 'BrowserForward', 167, 'VK_BROWSER_FORWARD', empty, empty],\n [1, 186 /* ScanCode.BrowserStop */, 'BrowserStop', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_STOP', empty, empty],\n [1, 187 /* ScanCode.BrowserRefresh */, 'BrowserRefresh', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_REFRESH', empty, empty],\n [1, 188 /* ScanCode.BrowserFavorites */, 'BrowserFavorites', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_FAVORITES', empty, empty],\n [1, 189 /* ScanCode.ZoomToggle */, 'ZoomToggle', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 190 /* ScanCode.MailReply */, 'MailReply', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 191 /* ScanCode.MailForward */, 'MailForward', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 192 /* ScanCode.MailSend */, 'MailSend', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n // See https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html\n // If an Input Method Editor is processing key input and the event is keydown, return 229.\n [1, 0 /* ScanCode.None */, empty, 114 /* KeyCode.KEY_IN_COMPOSITION */, 'KeyInComposition', 229, empty, empty, empty],\n [1, 0 /* ScanCode.None */, empty, 116 /* KeyCode.ABNT_C2 */, 'ABNT_C2', 194, 'VK_ABNT_C2', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 96 /* KeyCode.OEM_8 */, 'OEM_8', 223, 'VK_OEM_8', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_KANA', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HANGUL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_JUNJA', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_FINAL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HANJA', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_KANJI', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_CONVERT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_NONCONVERT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ACCEPT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_MODECHANGE', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_SELECT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PRINT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EXECUTE', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_SNAPSHOT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HELP', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_APPS', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PROCESSKEY', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PACKET', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_DBE_SBCSCHAR', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_DBE_DBCSCHAR', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ATTN', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_CRSEL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EXSEL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EREOF', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PLAY', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ZOOM', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_NONAME', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PA1', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_OEM_CLEAR', empty, empty],\n ];\n const seenKeyCode = [];\n const seenScanCode = [];\n for (const mapping of mappings) {\n const [immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel] = mapping;\n if (!seenScanCode[scanCode]) {\n seenScanCode[scanCode] = true;\n scanCodeIntToStr[scanCode] = scanCodeStr;\n scanCodeStrToInt[scanCodeStr] = scanCode;\n scanCodeLowerCaseStrToInt[scanCodeStr.toLowerCase()] = scanCode;\n if (immutable) {\n IMMUTABLE_CODE_TO_KEY_CODE[scanCode] = keyCode;\n if ((keyCode !== 0 /* KeyCode.Unknown */)\n && (keyCode !== 3 /* KeyCode.Enter */)\n && (keyCode !== 5 /* KeyCode.Ctrl */)\n && (keyCode !== 4 /* KeyCode.Shift */)\n && (keyCode !== 6 /* KeyCode.Alt */)\n && (keyCode !== 57 /* KeyCode.Meta */)) {\n IMMUTABLE_KEY_CODE_TO_CODE[keyCode] = scanCode;\n }\n }\n }\n if (!seenKeyCode[keyCode]) {\n seenKeyCode[keyCode] = true;\n if (!keyCodeStr) {\n throw new Error(`String representation missing for key code ${keyCode} around scan code ${scanCodeStr}`);\n }\n uiMap.define(keyCode, keyCodeStr);\n userSettingsUSMap.define(keyCode, usUserSettingsLabel || keyCodeStr);\n userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel || usUserSettingsLabel || keyCodeStr);\n }\n if (eventKeyCode) {\n EVENT_KEY_CODE_MAP[eventKeyCode] = keyCode;\n }\n if (vkey) {\n NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[vkey] = keyCode;\n }\n }\n // Manually added due to the exclusion above (due to duplication with NumpadEnter)\n IMMUTABLE_KEY_CODE_TO_CODE[3 /* KeyCode.Enter */] = 46 /* ScanCode.Enter */;\n})();\nexport var KeyCodeUtils;\n(function (KeyCodeUtils) {\n function toString(keyCode) {\n return uiMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toString = toString;\n function fromString(key) {\n return uiMap.strToKeyCode(key);\n }\n KeyCodeUtils.fromString = fromString;\n function toUserSettingsUS(keyCode) {\n return userSettingsUSMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toUserSettingsUS = toUserSettingsUS;\n function toUserSettingsGeneral(keyCode) {\n return userSettingsGeneralMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toUserSettingsGeneral = toUserSettingsGeneral;\n function fromUserSettings(key) {\n return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\n }\n KeyCodeUtils.fromUserSettings = fromUserSettings;\n function toElectronAccelerator(keyCode) {\n if (keyCode >= 98 /* KeyCode.Numpad0 */ && keyCode <= 113 /* KeyCode.NumpadDivide */) {\n // [Electron Accelerators] Electron is able to parse numpad keys, but unfortunately it\n // renders them just as regular keys in menus. For example, num0 is rendered as \"0\",\n // numdiv is rendered as \"/\", numsub is rendered as \"-\".\n //\n // This can lead to incredible confusion, as it makes numpad based keybindings indistinguishable\n // from keybindings based on regular keys.\n //\n // We therefore need to fall back to custom rendering for numpad keys.\n return null;\n }\n switch (keyCode) {\n case 16 /* KeyCode.UpArrow */:\n return 'Up';\n case 18 /* KeyCode.DownArrow */:\n return 'Down';\n case 15 /* KeyCode.LeftArrow */:\n return 'Left';\n case 17 /* KeyCode.RightArrow */:\n return 'Right';\n }\n return uiMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toElectronAccelerator = toElectronAccelerator;\n})(KeyCodeUtils || (KeyCodeUtils = {}));\nexport function KeyChord(firstPart, secondPart) {\n const chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\n return (firstPart | chordPart) >>> 0;\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 *--------------------------------------------------------------------------------------------*/\nimport { illegalArgument } from './errors.js';\nexport function decodeKeybinding(keybinding, OS) {\n if (typeof keybinding === 'number') {\n if (keybinding === 0) {\n return null;\n }\n const firstChord = (keybinding & 0x0000FFFF) >>> 0;\n const secondChord = (keybinding & 0xFFFF0000) >>> 16;\n if (secondChord !== 0) {\n return new Keybinding([\n createSimpleKeybinding(firstChord, OS),\n createSimpleKeybinding(secondChord, OS)\n ]);\n }\n return new Keybinding([createSimpleKeybinding(firstChord, OS)]);\n }\n else {\n const chords = [];\n for (let i = 0; i < keybinding.length; i++) {\n chords.push(createSimpleKeybinding(keybinding[i], OS));\n }\n return new Keybinding(chords);\n }\n}\nexport function createSimpleKeybinding(keybinding, OS) {\n const ctrlCmd = (keybinding & 2048 /* BinaryKeybindingsMask.CtrlCmd */ ? true : false);\n const winCtrl = (keybinding & 256 /* BinaryKeybindingsMask.WinCtrl */ ? true : false);\n const ctrlKey = (OS === 2 /* OperatingSystem.Macintosh */ ? winCtrl : ctrlCmd);\n const shiftKey = (keybinding & 1024 /* BinaryKeybindingsMask.Shift */ ? true : false);\n const altKey = (keybinding & 512 /* BinaryKeybindingsMask.Alt */ ? true : false);\n const metaKey = (OS === 2 /* OperatingSystem.Macintosh */ ? ctrlCmd : winCtrl);\n const keyCode = (keybinding & 255 /* BinaryKeybindingsMask.KeyCode */);\n return new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);\n}\n/**\n * Represents a chord which uses the `keyCode` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class KeyCodeChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.keyCode = keyCode;\n }\n equals(other) {\n return (other instanceof KeyCodeChord\n && this.ctrlKey === other.ctrlKey\n && this.shiftKey === other.shiftKey\n && this.altKey === other.altKey\n && this.metaKey === other.metaKey\n && this.keyCode === other.keyCode);\n }\n getHashCode() {\n const ctrl = this.ctrlKey ? '1' : '0';\n const shift = this.shiftKey ? '1' : '0';\n const alt = this.altKey ? '1' : '0';\n const meta = this.metaKey ? '1' : '0';\n return `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;\n }\n isModifierKey() {\n return (this.keyCode === 0 /* KeyCode.Unknown */\n || this.keyCode === 5 /* KeyCode.Ctrl */\n || this.keyCode === 57 /* KeyCode.Meta */\n || this.keyCode === 6 /* KeyCode.Alt */\n || this.keyCode === 4 /* KeyCode.Shift */);\n }\n toKeybinding() {\n return new Keybinding([this]);\n }\n /**\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n */\n isDuplicateModifierCase() {\n return ((this.ctrlKey && this.keyCode === 5 /* KeyCode.Ctrl */)\n || (this.shiftKey && this.keyCode === 4 /* KeyCode.Shift */)\n || (this.altKey && this.keyCode === 6 /* KeyCode.Alt */)\n || (this.metaKey && this.keyCode === 57 /* KeyCode.Meta */));\n }\n}\n/**\n * Represents a chord which uses the `code` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class ScanCodeChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, scanCode) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.scanCode = scanCode;\n }\n equals(other) {\n return (other instanceof ScanCodeChord\n && this.ctrlKey === other.ctrlKey\n && this.shiftKey === other.shiftKey\n && this.altKey === other.altKey\n && this.metaKey === other.metaKey\n && this.scanCode === other.scanCode);\n }\n getHashCode() {\n const ctrl = this.ctrlKey ? '1' : '0';\n const shift = this.shiftKey ? '1' : '0';\n const alt = this.altKey ? '1' : '0';\n const meta = this.metaKey ? '1' : '0';\n return `S${ctrl}${shift}${alt}${meta}${this.scanCode}`;\n }\n /**\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n */\n isDuplicateModifierCase() {\n return ((this.ctrlKey && (this.scanCode === 157 /* ScanCode.ControlLeft */ || this.scanCode === 161 /* ScanCode.ControlRight */))\n || (this.shiftKey && (this.scanCode === 158 /* ScanCode.ShiftLeft */ || this.scanCode === 162 /* ScanCode.ShiftRight */))\n || (this.altKey && (this.scanCode === 159 /* ScanCode.AltLeft */ || this.scanCode === 163 /* ScanCode.AltRight */))\n || (this.metaKey && (this.scanCode === 160 /* ScanCode.MetaLeft */ || this.scanCode === 164 /* ScanCode.MetaRight */)));\n }\n}\n/**\n * A keybinding is a sequence of chords.\n */\nexport class Keybinding {\n constructor(chords) {\n if (chords.length === 0) {\n throw illegalArgument(`chords`);\n }\n this.chords = chords;\n }\n getHashCode() {\n let result = '';\n for (let i = 0, len = this.chords.length; i < len; i++) {\n if (i !== 0) {\n result += ';';\n }\n result += this.chords[i].getHashCode();\n }\n return result;\n }\n equals(other) {\n if (other === null) {\n return false;\n }\n if (this.chords.length !== other.chords.length) {\n return false;\n }\n for (let i = 0; i < this.chords.length; i++) {\n if (!this.chords[i].equals(other.chords[i])) {\n return false;\n }\n }\n return true;\n }\n}\nexport class ResolvedChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyLabel, keyAriaLabel) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.keyLabel = keyLabel;\n this.keyAriaLabel = keyAriaLabel;\n }\n}\n/**\n * A resolved keybinding. Consists of one or multiple chords.\n */\nexport class ResolvedKeybinding {\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from './browser.js';\nimport { EVENT_KEY_CODE_MAP, KeyCodeUtils } from '../common/keyCodes.js';\nimport { KeyCodeChord } from '../common/keybindings.js';\nimport * as platform from '../common/platform.js';\nfunction extractKeyCode(e) {\n if (e.charCode) {\n // \"keypress\" events mostly\n const char = String.fromCharCode(e.charCode).toUpperCase();\n return KeyCodeUtils.fromString(char);\n }\n const keyCode = e.keyCode;\n // browser quirks\n if (keyCode === 3) {\n return 7 /* KeyCode.PauseBreak */;\n }\n else if (browser.isFirefox) {\n switch (keyCode) {\n case 59: return 85 /* KeyCode.Semicolon */;\n case 60:\n if (platform.isLinux) {\n return 97 /* KeyCode.IntlBackslash */;\n }\n break;\n case 61: return 86 /* KeyCode.Equal */;\n // based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys\n case 107: return 109 /* KeyCode.NumpadAdd */;\n case 109: return 111 /* KeyCode.NumpadSubtract */;\n case 173: return 88 /* KeyCode.Minus */;\n case 224:\n if (platform.isMacintosh) {\n return 57 /* KeyCode.Meta */;\n }\n break;\n }\n }\n else if (browser.isWebKit) {\n if (platform.isMacintosh && keyCode === 93) {\n // the two meta keys in the Mac have different key codes (91 and 93)\n return 57 /* KeyCode.Meta */;\n }\n else if (!platform.isMacintosh && keyCode === 92) {\n return 57 /* KeyCode.Meta */;\n }\n }\n // cross browser keycodes:\n return EVENT_KEY_CODE_MAP[keyCode] || 0 /* KeyCode.Unknown */;\n}\nconst ctrlKeyMod = (platform.isMacintosh ? 256 /* KeyMod.WinCtrl */ : 2048 /* KeyMod.CtrlCmd */);\nconst altKeyMod = 512 /* KeyMod.Alt */;\nconst shiftKeyMod = 1024 /* KeyMod.Shift */;\nconst metaKeyMod = (platform.isMacintosh ? 2048 /* KeyMod.CtrlCmd */ : 256 /* KeyMod.WinCtrl */);\nexport function printKeyboardEvent(e) {\n const modifiers = [];\n if (e.ctrlKey) {\n modifiers.push(`ctrl`);\n }\n if (e.shiftKey) {\n modifiers.push(`shift`);\n }\n if (e.altKey) {\n modifiers.push(`alt`);\n }\n if (e.metaKey) {\n modifiers.push(`meta`);\n }\n return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`;\n}\nexport function printStandardKeyboardEvent(e) {\n const modifiers = [];\n if (e.ctrlKey) {\n modifiers.push(`ctrl`);\n }\n if (e.shiftKey) {\n modifiers.push(`shift`);\n }\n if (e.altKey) {\n modifiers.push(`alt`);\n }\n if (e.metaKey) {\n modifiers.push(`meta`);\n }\n return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${KeyCodeUtils.toString(e.keyCode)}')`;\n}\nexport class StandardKeyboardEvent {\n constructor(source) {\n this._standardKeyboardEventBrand = true;\n const e = source;\n this.browserEvent = e;\n this.target = e.target;\n this.ctrlKey = e.ctrlKey;\n this.shiftKey = e.shiftKey;\n this.altKey = e.altKey;\n this.metaKey = e.metaKey;\n this.altGraphKey = e.getModifierState('AltGraph');\n this.keyCode = extractKeyCode(e);\n this.code = e.code;\n // console.info(e.type + \": keyCode: \" + e.keyCode + \", which: \" + e.which + \", charCode: \" + e.charCode + \", detail: \" + e.detail + \" ====> \" + this.keyCode + ' -- ' + KeyCode[this.keyCode]);\n this.ctrlKey = this.ctrlKey || this.keyCode === 5 /* KeyCode.Ctrl */;\n this.altKey = this.altKey || this.keyCode === 6 /* KeyCode.Alt */;\n this.shiftKey = this.shiftKey || this.keyCode === 4 /* KeyCode.Shift */;\n this.metaKey = this.metaKey || this.keyCode === 57 /* KeyCode.Meta */;\n this._asKeybinding = this._computeKeybinding();\n this._asKeyCodeChord = this._computeKeyCodeChord();\n // console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);\n }\n preventDefault() {\n if (this.browserEvent && this.browserEvent.preventDefault) {\n this.browserEvent.preventDefault();\n }\n }\n stopPropagation() {\n if (this.browserEvent && this.browserEvent.stopPropagation) {\n this.browserEvent.stopPropagation();\n }\n }\n toKeyCodeChord() {\n return this._asKeyCodeChord;\n }\n equals(other) {\n return this._asKeybinding === other;\n }\n _computeKeybinding() {\n let key = 0 /* KeyCode.Unknown */;\n if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) {\n key = this.keyCode;\n }\n let result = 0;\n if (this.ctrlKey) {\n result |= ctrlKeyMod;\n }\n if (this.altKey) {\n result |= altKeyMod;\n }\n if (this.shiftKey) {\n result |= shiftKeyMod;\n }\n if (this.metaKey) {\n result |= metaKeyMod;\n }\n result |= key;\n return result;\n }\n _computeKeyCodeChord() {\n let key = 0 /* KeyCode.Unknown */;\n if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) {\n key = this.keyCode;\n }\n return new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);\n }\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 *--------------------------------------------------------------------------------------------*/\nconst sameOriginWindowChainCache = new WeakMap();\nfunction getParentWindowIfSameOrigin(w) {\n if (!w.parent || w.parent === w) {\n return null;\n }\n // Cannot really tell if we have access to the parent window unless we try to access something in it\n try {\n const location = w.location;\n const parentLocation = w.parent.location;\n if (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) {\n return null;\n }\n }\n catch (e) {\n return null;\n }\n return w.parent;\n}\nexport class IframeUtils {\n /**\n * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).\n * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.\n */\n static getSameOriginWindowChain(targetWindow) {\n let windowChainCache = sameOriginWindowChainCache.get(targetWindow);\n if (!windowChainCache) {\n windowChainCache = [];\n sameOriginWindowChainCache.set(targetWindow, windowChainCache);\n let w = targetWindow;\n let parent;\n do {\n parent = getParentWindowIfSameOrigin(w);\n if (parent) {\n windowChainCache.push({\n window: new WeakRef(w),\n iframeElement: w.frameElement || null\n });\n }\n else {\n windowChainCache.push({\n window: new WeakRef(w),\n iframeElement: null\n });\n }\n w = parent;\n } while (w);\n }\n return windowChainCache.slice(0);\n }\n /**\n * Returns the position of `childWindow` relative to `ancestorWindow`\n */\n static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {\n if (!ancestorWindow || childWindow === ancestorWindow) {\n return {\n top: 0,\n left: 0\n };\n }\n let top = 0, left = 0;\n const windowChain = this.getSameOriginWindowChain(childWindow);\n for (const windowChainEl of windowChain) {\n const windowInChain = windowChainEl.window.deref();\n top += windowInChain?.scrollY ?? 0;\n left += windowInChain?.scrollX ?? 0;\n if (windowInChain === ancestorWindow) {\n break;\n }\n if (!windowChainEl.iframeElement) {\n break;\n }\n const boundingRect = windowChainEl.iframeElement.getBoundingClientRect();\n top += boundingRect.top;\n left += boundingRect.left;\n }\n return {\n top: top,\n left: left\n };\n }\n}\n/**\n * Returns a sha-256 composed of `parentOrigin` and `salt` converted to base 32\n */\nexport async function parentOriginHash(parentOrigin, salt) {\n // This same code is also inlined at `src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html`\n if (!crypto.subtle) {\n throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);\n }\n const strData = JSON.stringify({ parentOrigin, salt });\n const encoder = new TextEncoder();\n const arrData = encoder.encode(strData);\n const hash = await crypto.subtle.digest('sha-256', arrData);\n return sha256AsBase32(hash);\n}\nfunction sha256AsBase32(bytes) {\n const array = Array.from(new Uint8Array(bytes));\n const hexArray = array.map(b => b.toString(16).padStart(2, '0')).join('');\n // sha256 has 256 bits, so we need at most ceil(lg(2^256-1)/lg(32)) = 52 chars to represent it in base 32\n return BigInt(`0x${hexArray}`).toString(32).padStart(52, '0');\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from './browser.js';\nimport { IframeUtils } from './iframe.js';\nimport * as platform from '../common/platform.js';\nexport class StandardMouseEvent {\n constructor(targetWindow, e) {\n this.timestamp = Date.now();\n this.browserEvent = e;\n this.leftButton = e.button === 0;\n this.middleButton = e.button === 1;\n this.rightButton = e.button === 2;\n this.buttons = e.buttons;\n this.target = e.target;\n this.detail = e.detail || 1;\n if (e.type === 'dblclick') {\n this.detail = 2;\n }\n this.ctrlKey = e.ctrlKey;\n this.shiftKey = e.shiftKey;\n this.altKey = e.altKey;\n this.metaKey = e.metaKey;\n if (typeof e.pageX === 'number') {\n this.posx = e.pageX;\n this.posy = e.pageY;\n }\n else {\n // Probably hit by MSGestureEvent\n this.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;\n this.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;\n }\n // Find the position of the iframe this code is executing in relative to the iframe where the event was captured.\n const iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);\n this.posx -= iframeOffsets.left;\n this.posy -= iframeOffsets.top;\n }\n preventDefault() {\n this.browserEvent.preventDefault();\n }\n stopPropagation() {\n this.browserEvent.stopPropagation();\n }\n}\nexport class DragMouseEvent extends StandardMouseEvent {\n constructor(targetWindow, e) {\n super(targetWindow, e);\n this.dataTransfer = e.dataTransfer;\n }\n}\nexport class StandardWheelEvent {\n constructor(e, deltaX = 0, deltaY = 0) {\n this.browserEvent = e || null;\n this.target = e ? (e.target || e.targetNode || e.srcElement) : null;\n this.deltaY = deltaY;\n this.deltaX = deltaX;\n if (e) {\n // Old (deprecated) wheel events\n const e1 = e;\n const e2 = e;\n // vertical delta scroll\n if (typeof e1.wheelDeltaY !== 'undefined') {\n this.deltaY = e1.wheelDeltaY / 120;\n }\n else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {\n this.deltaY = -e2.detail / 3;\n }\n else if (e.type === 'wheel') {\n // Modern wheel event\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n const ev = e;\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\n // the deltas are expressed in lines\n if (browser.isFirefox && !platform.isMacintosh) {\n this.deltaY = -e.deltaY / 3;\n }\n else {\n this.deltaY = -e.deltaY;\n }\n }\n else {\n this.deltaY = -e.deltaY / 40;\n }\n }\n // horizontal delta scroll\n if (typeof e1.wheelDeltaX !== 'undefined') {\n if (browser.isSafari && platform.isWindows) {\n this.deltaX = -(e1.wheelDeltaX / 120);\n }\n else {\n this.deltaX = e1.wheelDeltaX / 120;\n }\n }\n else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {\n this.deltaX = -e.detail / 3;\n }\n else if (e.type === 'wheel') {\n // Modern wheel event\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n const ev = e;\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\n // the deltas are expressed in lines\n if (browser.isFirefox && !platform.isMacintosh) {\n this.deltaX = -e.deltaX / 3;\n }\n else {\n this.deltaX = -e.deltaX;\n }\n }\n else {\n this.deltaX = -e.deltaX / 40;\n }\n }\n // Assume a vertical scroll if nothing else worked\n if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {\n this.deltaY = e.wheelDelta / 120;\n }\n }\n }\n preventDefault() {\n this.browserEvent?.preventDefault();\n }\n stopPropagation() {\n this.browserEvent?.stopPropagation();\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter, Event } from './event.js';\nconst shortcutEvent = Object.freeze(function (callback, context) {\n const handle = setTimeout(callback.bind(context), 0);\n return { dispose() { clearTimeout(handle); } };\n});\nexport var CancellationToken;\n(function (CancellationToken) {\n function isCancellationToken(thing) {\n if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n return true;\n }\n if (thing instanceof MutableToken) {\n return true;\n }\n if (!thing || typeof thing !== 'object') {\n return false;\n }\n return typeof thing.isCancellationRequested === 'boolean'\n && typeof thing.onCancellationRequested === 'function';\n }\n CancellationToken.isCancellationToken = isCancellationToken;\n CancellationToken.None = Object.freeze({\n isCancellationRequested: false,\n onCancellationRequested: Event.None\n });\n CancellationToken.Cancelled = Object.freeze({\n isCancellationRequested: true,\n onCancellationRequested: shortcutEvent\n });\n})(CancellationToken || (CancellationToken = {}));\nclass MutableToken {\n constructor() {\n this._isCancelled = false;\n this._emitter = null;\n }\n cancel() {\n if (!this._isCancelled) {\n this._isCancelled = true;\n if (this._emitter) {\n this._emitter.fire(undefined);\n this.dispose();\n }\n }\n }\n get isCancellationRequested() {\n return this._isCancelled;\n }\n get onCancellationRequested() {\n if (this._isCancelled) {\n return shortcutEvent;\n }\n if (!this._emitter) {\n this._emitter = new Emitter();\n }\n return this._emitter.event;\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n this._emitter = null;\n }\n }\n}\nexport class CancellationTokenSource {\n constructor(parent) {\n this._token = undefined;\n this._parentListener = undefined;\n this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n }\n get token() {\n if (!this._token) {\n // be lazy and create the token only when\n // actually needed\n this._token = new MutableToken();\n }\n return this._token;\n }\n cancel() {\n if (!this._token) {\n // save an object by returning the default\n // cancelled token when cancellation happens\n // before someone asks for the token\n this._token = CancellationToken.Cancelled;\n }\n else if (this._token instanceof MutableToken) {\n // actually cancel\n this._token.cancel();\n }\n }\n dispose(cancel = false) {\n if (cancel) {\n this.cancel();\n }\n this._parentListener?.dispose();\n if (!this._token) {\n // ensure to initialize with an empty token if we had none\n this._token = CancellationToken.None;\n }\n else if (this._token instanceof MutableToken) {\n // actually dispose\n this._token.dispose();\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { isMacintosh, isWindows } from './platform.js';\nlet safeProcess;\n// Native sandbox environment\nconst vscodeGlobal = globalThis.vscode;\nif (typeof vscodeGlobal !== 'undefined' && typeof vscodeGlobal.process !== 'undefined') {\n const sandboxProcess = vscodeGlobal.process;\n safeProcess = {\n get platform() { return sandboxProcess.platform; },\n get arch() { return sandboxProcess.arch; },\n get env() { return sandboxProcess.env; },\n cwd() { return sandboxProcess.cwd(); }\n };\n}\n// Native node.js environment\nelse if (typeof process !== 'undefined') {\n safeProcess = {\n get platform() { return process.platform; },\n get arch() { return process.arch; },\n get env() { return process.env; },\n cwd() { return process.env['VSCODE_CWD'] || process.cwd(); }\n };\n}\n// Web environment\nelse {\n safeProcess = {\n // Supported\n get platform() { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; },\n get arch() { return undefined; /* arch is undefined in web */ },\n // Unsupported\n get env() { return {}; },\n cwd() { return '/'; }\n };\n}\n/**\n * Provides safe access to the `cwd` property in node.js, sandboxed or web\n * environments.\n *\n * Note: in web, this property is hardcoded to be `/`.\n *\n * @skipMangle\n */\nexport const cwd = safeProcess.cwd;\n/**\n * Provides safe access to the `env` property in node.js, sandboxed or web\n * environments.\n *\n * Note: in web, this property is hardcoded to be `{}`.\n */\nexport const env = safeProcess.env;\n/**\n * Provides safe access to the `platform` property in node.js, sandboxed or web\n * environments.\n */\nexport const platform = safeProcess.platform;\n/**\n * Provides safe access to the `arch` method in node.js, sandboxed or web\n * environments.\n * Note: `arch` is `undefined` in web\n */\nexport const arch = safeProcess.arch;\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// NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace\n// Copied from: https://github.com/nodejs/node/blob/v16.14.2/lib/path.js\n/**\n * Copyright Joyent, Inc. and other Node contributors.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to permit\n * persons to whom the Software is furnished to do so, subject to the\n * following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n * USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nimport * as process from './process.js';\nconst CHAR_UPPERCASE_A = 65; /* A */\nconst CHAR_LOWERCASE_A = 97; /* a */\nconst CHAR_UPPERCASE_Z = 90; /* Z */\nconst CHAR_LOWERCASE_Z = 122; /* z */\nconst CHAR_DOT = 46; /* . */\nconst CHAR_FORWARD_SLASH = 47; /* / */\nconst CHAR_BACKWARD_SLASH = 92; /* \\ */\nconst CHAR_COLON = 58; /* : */\nconst CHAR_QUESTION_MARK = 63; /* ? */\nclass ErrorInvalidArgType extends Error {\n constructor(name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n let determiner;\n if (typeof expected === 'string' && expected.indexOf('not ') === 0) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n }\n else {\n determiner = 'must be';\n }\n const type = name.indexOf('.') !== -1 ? 'property' : 'argument';\n let msg = `The \"${name}\" ${type} ${determiner} of type ${expected}`;\n msg += `. Received type ${typeof actual}`;\n super(msg);\n this.code = 'ERR_INVALID_ARG_TYPE';\n }\n}\nfunction validateObject(pathObject, name) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new ErrorInvalidArgType(name, 'Object', pathObject);\n }\n}\nfunction validateString(value, name) {\n if (typeof value !== 'string') {\n throw new ErrorInvalidArgType(name, 'string', value);\n }\n}\nconst platformIsWin32 = (process.platform === 'win32');\nfunction isPathSeparator(code) {\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\n}\nfunction isPosixPathSeparator(code) {\n return code === CHAR_FORWARD_SLASH;\n}\nfunction isWindowsDeviceRoot(code) {\n return (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||\n (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z);\n}\n// Resolves . and .. elements in a path with directory names\nfunction normalizeString(path, allowAboveRoot, separator, isPathSeparator) {\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let code = 0;\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n code = path.charCodeAt(i);\n }\n else if (isPathSeparator(code)) {\n break;\n }\n else {\n code = CHAR_FORWARD_SLASH;\n }\n if (isPathSeparator(code)) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n }\n else if (dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 ||\n res.charCodeAt(res.length - 1) !== CHAR_DOT ||\n res.charCodeAt(res.length - 2) !== CHAR_DOT) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(separator);\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n }\n else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n else if (res.length !== 0) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? `${separator}..` : '..';\n lastSegmentLength = 2;\n }\n }\n else {\n if (res.length > 0) {\n res += `${separator}${path.slice(lastSlash + 1, i)}`;\n }\n else {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === CHAR_DOT && dots !== -1) {\n ++dots;\n }\n else {\n dots = -1;\n }\n }\n return res;\n}\nfunction _format(sep, pathObject) {\n validateObject(pathObject, 'pathObject');\n const dir = pathObject.dir || pathObject.root;\n const base = pathObject.base ||\n `${pathObject.name || ''}${pathObject.ext || ''}`;\n if (!dir) {\n return base;\n }\n return dir === pathObject.root ? `${dir}${base}` : `${dir}${sep}${base}`;\n}\nexport const win32 = {\n // path.resolve([from ...], to)\n resolve(...pathSegments) {\n let resolvedDevice = '';\n let resolvedTail = '';\n let resolvedAbsolute = false;\n for (let i = pathSegments.length - 1; i >= -1; i--) {\n let path;\n if (i >= 0) {\n path = pathSegments[i];\n validateString(path, 'path');\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n }\n else if (resolvedDevice.length === 0) {\n path = process.cwd();\n }\n else {\n // Windows has the concept of drive-specific current working\n // directories. If we've resolved a drive letter but not yet an\n // absolute path, get cwd for that drive, or the process cwd if\n // the drive cwd is not available. We're sure the device is not\n // a UNC path at this points, because UNC paths are always absolute.\n path = process.env[`=${resolvedDevice}`] || process.cwd();\n // Verify that a cwd was found and that it actually points\n // to our drive. If not, default to the drive's root.\n if (path === undefined ||\n (path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() &&\n path.charCodeAt(2) === CHAR_BACKWARD_SLASH)) {\n path = `${resolvedDevice}\\\\`;\n }\n }\n const len = path.length;\n let rootEnd = 0;\n let device = '';\n let isAbsolute = false;\n const code = path.charCodeAt(0);\n // Try to match a root\n if (len === 1) {\n if (isPathSeparator(code)) {\n // `path` contains just a path separator\n rootEnd = 1;\n isAbsolute = true;\n }\n }\n else if (isPathSeparator(code)) {\n // Possible UNC root\n // If we started with a separator, we know we at least have an\n // absolute path of some kind (UNC or otherwise)\n isAbsolute = true;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n const firstPart = path.slice(last, j);\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len || j !== last) {\n // We matched a UNC root\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\n rootEnd = j;\n }\n }\n }\n }\n else {\n rootEnd = 1;\n }\n }\n else if (isWindowsDeviceRoot(code) &&\n path.charCodeAt(1) === CHAR_COLON) {\n // Possible device root\n device = path.slice(0, 2);\n rootEnd = 2;\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\n // Treat separator following drive name as an absolute path\n // indicator\n isAbsolute = true;\n rootEnd = 3;\n }\n }\n if (device.length > 0) {\n if (resolvedDevice.length > 0) {\n if (device.toLowerCase() !== resolvedDevice.toLowerCase()) {\n // This path points to another device so it is not applicable\n continue;\n }\n }\n else {\n resolvedDevice = device;\n }\n }\n if (resolvedAbsolute) {\n if (resolvedDevice.length > 0) {\n break;\n }\n }\n else {\n resolvedTail = `${path.slice(rootEnd)}\\\\${resolvedTail}`;\n resolvedAbsolute = isAbsolute;\n if (isAbsolute && resolvedDevice.length > 0) {\n break;\n }\n }\n }\n // At this point the path should be resolved to a full absolute path,\n // but handle relative paths to be safe (might happen when process.cwd()\n // fails)\n // Normalize the tail path\n resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\\\', isPathSeparator);\n return resolvedAbsolute ?\n `${resolvedDevice}\\\\${resolvedTail}` :\n `${resolvedDevice}${resolvedTail}` || '.';\n },\n normalize(path) {\n validateString(path, 'path');\n const len = path.length;\n if (len === 0) {\n return '.';\n }\n let rootEnd = 0;\n let device;\n let isAbsolute = false;\n const code = path.charCodeAt(0);\n // Try to match a root\n if (len === 1) {\n // `path` contains just a single char, exit early to avoid\n // unnecessary work\n return isPosixPathSeparator(code) ? '\\\\' : path;\n }\n if (isPathSeparator(code)) {\n // Possible UNC root\n // If we started with a separator, we know we at least have an absolute\n // path of some kind (UNC or otherwise)\n isAbsolute = true;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n const firstPart = path.slice(last, j);\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len) {\n // We matched a UNC root only\n // Return the normalized version of the UNC root since there\n // is nothing left to process\n return `\\\\\\\\${firstPart}\\\\${path.slice(last)}\\\\`;\n }\n if (j !== last) {\n // We matched a UNC root with leftovers\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\n rootEnd = j;\n }\n }\n }\n }\n else {\n rootEnd = 1;\n }\n }\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n // Possible device root\n device = path.slice(0, 2);\n rootEnd = 2;\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\n // Treat separator following drive name as an absolute path\n // indicator\n isAbsolute = true;\n rootEnd = 3;\n }\n }\n let tail = rootEnd < len ?\n normalizeString(path.slice(rootEnd), !isAbsolute, '\\\\', isPathSeparator) :\n '';\n if (tail.length === 0 && !isAbsolute) {\n tail = '.';\n }\n if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {\n tail += '\\\\';\n }\n if (device === undefined) {\n return isAbsolute ? `\\\\${tail}` : tail;\n }\n return isAbsolute ? `${device}\\\\${tail}` : `${device}${tail}`;\n },\n isAbsolute(path) {\n validateString(path, 'path');\n const len = path.length;\n if (len === 0) {\n return false;\n }\n const code = path.charCodeAt(0);\n return isPathSeparator(code) ||\n // Possible device root\n (len > 2 &&\n isWindowsDeviceRoot(code) &&\n path.charCodeAt(1) === CHAR_COLON &&\n isPathSeparator(path.charCodeAt(2)));\n },\n join(...paths) {\n if (paths.length === 0) {\n return '.';\n }\n let joined;\n let firstPart;\n for (let i = 0; i < paths.length; ++i) {\n const arg = paths[i];\n validateString(arg, 'path');\n if (arg.length > 0) {\n if (joined === undefined) {\n joined = firstPart = arg;\n }\n else {\n joined += `\\\\${arg}`;\n }\n }\n }\n if (joined === undefined) {\n return '.';\n }\n // Make sure that the joined path doesn't start with two slashes, because\n // normalize() will mistake it for a UNC path then.\n //\n // This step is skipped when it is very clear that the user actually\n // intended to point at a UNC path. This is assumed when the first\n // non-empty string arguments starts with exactly two slashes followed by\n // at least one more non-slash character.\n //\n // Note that for normalize() to treat a path as a UNC path it needs to\n // have at least 2 components, so we don't filter for that here.\n // This means that the user can use join to construct UNC paths from\n // a server name and a share name; for example:\n // path.join('//server', 'share') -> '\\\\\\\\server\\\\share\\\\')\n let needsReplace = true;\n let slashCount = 0;\n if (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) {\n ++slashCount;\n const firstLen = firstPart.length;\n if (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) {\n ++slashCount;\n if (firstLen > 2) {\n if (isPathSeparator(firstPart.charCodeAt(2))) {\n ++slashCount;\n }\n else {\n // We matched a UNC path in the first part\n needsReplace = false;\n }\n }\n }\n }\n if (needsReplace) {\n // Find any more consecutive slashes we need to replace\n while (slashCount < joined.length &&\n isPathSeparator(joined.charCodeAt(slashCount))) {\n slashCount++;\n }\n // Replace the slashes if needed\n if (slashCount >= 2) {\n joined = `\\\\${joined.slice(slashCount)}`;\n }\n }\n return win32.normalize(joined);\n },\n // It will solve the relative path from `from` to `to`, for instance:\n // from = 'C:\\\\orandea\\\\test\\\\aaa'\n // to = 'C:\\\\orandea\\\\impl\\\\bbb'\n // The output of the function should be: '..\\\\..\\\\impl\\\\bbb'\n relative(from, to) {\n validateString(from, 'from');\n validateString(to, 'to');\n if (from === to) {\n return '';\n }\n const fromOrig = win32.resolve(from);\n const toOrig = win32.resolve(to);\n if (fromOrig === toOrig) {\n return '';\n }\n from = fromOrig.toLowerCase();\n to = toOrig.toLowerCase();\n if (from === to) {\n return '';\n }\n // Trim any leading backslashes\n let fromStart = 0;\n while (fromStart < from.length &&\n from.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) {\n fromStart++;\n }\n // Trim trailing backslashes (applicable to UNC paths only)\n let fromEnd = from.length;\n while (fromEnd - 1 > fromStart &&\n from.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) {\n fromEnd--;\n }\n const fromLen = fromEnd - fromStart;\n // Trim any leading backslashes\n let toStart = 0;\n while (toStart < to.length &&\n to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\n toStart++;\n }\n // Trim trailing backslashes (applicable to UNC paths only)\n let toEnd = to.length;\n while (toEnd - 1 > toStart &&\n to.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) {\n toEnd--;\n }\n const toLen = toEnd - toStart;\n // Compare paths to find the longest common path from root\n const length = fromLen < toLen ? fromLen : toLen;\n let lastCommonSep = -1;\n let i = 0;\n for (; i < length; i++) {\n const fromCode = from.charCodeAt(fromStart + i);\n if (fromCode !== to.charCodeAt(toStart + i)) {\n break;\n }\n else if (fromCode === CHAR_BACKWARD_SLASH) {\n lastCommonSep = i;\n }\n }\n // We found a mismatch before the first common path separator was seen, so\n // return the original `to`.\n if (i !== length) {\n if (lastCommonSep === -1) {\n return toOrig;\n }\n }\n else {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo\\\\bar\\\\baz'\n return toOrig.slice(toStart + i + 1);\n }\n if (i === 2) {\n // We get here if `from` is the device root.\n // For example: from='C:\\\\'; to='C:\\\\foo'\n return toOrig.slice(toStart + i);\n }\n }\n if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo'\n lastCommonSep = i;\n }\n else if (i === 2) {\n // We get here if `to` is the device root.\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\'\n lastCommonSep = 3;\n }\n }\n if (lastCommonSep === -1) {\n lastCommonSep = 0;\n }\n }\n let out = '';\n // Generate the relative path based on the path difference between `to` and\n // `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {\n out += out.length === 0 ? '..' : '\\\\..';\n }\n }\n toStart += lastCommonSep;\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0) {\n return `${out}${toOrig.slice(toStart, toEnd)}`;\n }\n if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\n ++toStart;\n }\n return toOrig.slice(toStart, toEnd);\n },\n toNamespacedPath(path) {\n // Note: this will *probably* throw somewhere.\n if (typeof path !== 'string' || path.length === 0) {\n return path;\n }\n const resolvedPath = win32.resolve(path);\n if (resolvedPath.length <= 2) {\n return path;\n }\n if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {\n // Possible UNC root\n if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {\n const code = resolvedPath.charCodeAt(2);\n if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {\n // Matched non-long UNC root, convert the path to a long UNC path\n return `\\\\\\\\?\\\\UNC\\\\${resolvedPath.slice(2)}`;\n }\n }\n }\n else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) &&\n resolvedPath.charCodeAt(1) === CHAR_COLON &&\n resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {\n // Matched device root, convert the path to a long UNC path\n return `\\\\\\\\?\\\\${resolvedPath}`;\n }\n return path;\n },\n dirname(path) {\n validateString(path, 'path');\n const len = path.length;\n if (len === 0) {\n return '.';\n }\n let rootEnd = -1;\n let offset = 0;\n const code = path.charCodeAt(0);\n if (len === 1) {\n // `path` contains just a path separator, exit early to avoid\n // unnecessary work or a dot.\n return isPathSeparator(code) ? path : '.';\n }\n // Try to match a root\n if (isPathSeparator(code)) {\n // Possible UNC root\n rootEnd = offset = 1;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len) {\n // We matched a UNC root only\n return path;\n }\n if (j !== last) {\n // We matched a UNC root with leftovers\n // Offset by 1 to include the separator after the UNC root to\n // treat it as a \"normal root\" on top of a (UNC) root\n rootEnd = offset = j + 1;\n }\n }\n }\n }\n // Possible device root\n }\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n rootEnd = len > 2 && isPathSeparator(path.charCodeAt(2)) ? 3 : 2;\n offset = rootEnd;\n }\n let end = -1;\n let matchedSlash = true;\n for (let i = len - 1; i >= offset; --i) {\n if (isPathSeparator(path.charCodeAt(i))) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n }\n else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n if (end === -1) {\n if (rootEnd === -1) {\n return '.';\n }\n end = rootEnd;\n }\n return path.slice(0, end);\n },\n basename(path, ext) {\n if (ext !== undefined) {\n validateString(ext, 'ext');\n }\n validateString(path, 'path');\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i;\n // Check for a drive letter prefix so as not to mistake the following\n // path separator as an extra separator at the end of the path that can be\n // disregarded\n if (path.length >= 2 &&\n isWindowsDeviceRoot(path.charCodeAt(0)) &&\n path.charCodeAt(1) === CHAR_COLON) {\n start = 2;\n }\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext === path) {\n return '';\n }\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= start; --i) {\n const code = path.charCodeAt(i);\n if (isPathSeparator(code)) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n if (start === end) {\n end = firstNonSlashEnd;\n }\n else if (end === -1) {\n end = path.length;\n }\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= start; --i) {\n if (isPathSeparator(path.charCodeAt(i))) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n if (end === -1) {\n return '';\n }\n return path.slice(start, end);\n },\n extname(path) {\n validateString(path, 'path');\n let start = 0;\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Check for a drive letter prefix so as not to mistake the following\n // path separator as an extra separator at the end of the path that can be\n // disregarded\n if (path.length >= 2 &&\n path.charCodeAt(1) === CHAR_COLON &&\n isWindowsDeviceRoot(path.charCodeAt(0))) {\n start = startPart = 2;\n }\n for (let i = path.length - 1; i >= start; --i) {\n const code = path.charCodeAt(i);\n if (isPathSeparator(code)) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n },\n format: _format.bind(null, '\\\\'),\n parse(path) {\n validateString(path, 'path');\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) {\n return ret;\n }\n const len = path.length;\n let rootEnd = 0;\n let code = path.charCodeAt(0);\n if (len === 1) {\n if (isPathSeparator(code)) {\n // `path` contains just a path separator, exit early to avoid\n // unnecessary work\n ret.root = ret.dir = path;\n return ret;\n }\n ret.base = ret.name = path;\n return ret;\n }\n // Try to match a root\n if (isPathSeparator(code)) {\n // Possible UNC root\n rootEnd = 1;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len) {\n // We matched a UNC root only\n rootEnd = j;\n }\n else if (j !== last) {\n // We matched a UNC root with leftovers\n rootEnd = j + 1;\n }\n }\n }\n }\n }\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n // Possible device root\n if (len <= 2) {\n // `path` contains just a drive root, exit early to avoid\n // unnecessary work\n ret.root = ret.dir = path;\n return ret;\n }\n rootEnd = 2;\n if (isPathSeparator(path.charCodeAt(2))) {\n if (len === 3) {\n // `path` contains just a drive root, exit early to avoid\n // unnecessary work\n ret.root = ret.dir = path;\n return ret;\n }\n rootEnd = 3;\n }\n }\n if (rootEnd > 0) {\n ret.root = path.slice(0, rootEnd);\n }\n let startDot = -1;\n let startPart = rootEnd;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Get non-dir info\n for (; i >= rootEnd; --i) {\n code = path.charCodeAt(i);\n if (isPathSeparator(code)) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (end !== -1) {\n if (startDot === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n ret.base = ret.name = path.slice(startPart, end);\n }\n else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n ret.ext = path.slice(startDot, end);\n }\n }\n // If the directory is the root, use the entire root as the `dir` including\n // the trailing slash if any (`C:\\abc` -> `C:\\`). Otherwise, strip out the\n // trailing slash (`C:\\abc\\def` -> `C:\\abc`).\n if (startPart > 0 && startPart !== rootEnd) {\n ret.dir = path.slice(0, startPart - 1);\n }\n else {\n ret.dir = ret.root;\n }\n return ret;\n },\n sep: '\\\\',\n delimiter: ';',\n win32: null,\n posix: null\n};\nconst posixCwd = (() => {\n if (platformIsWin32) {\n // Converts Windows' backslash path separators to POSIX forward slashes\n // and truncates any drive indicator\n const regexp = /\\\\/g;\n return () => {\n const cwd = process.cwd().replace(regexp, '/');\n return cwd.slice(cwd.indexOf('/'));\n };\n }\n // We're already on POSIX, no need for any transformations\n return () => process.cwd();\n})();\nexport const posix = {\n // path.resolve([from ...], to)\n resolve(...pathSegments) {\n let resolvedPath = '';\n let resolvedAbsolute = false;\n for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n const path = i >= 0 ? pathSegments[i] : posixCwd();\n validateString(path, 'path');\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, '/', isPosixPathSeparator);\n if (resolvedAbsolute) {\n return `/${resolvedPath}`;\n }\n return resolvedPath.length > 0 ? resolvedPath : '.';\n },\n normalize(path) {\n validateString(path, 'path');\n if (path.length === 0) {\n return '.';\n }\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n const trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;\n // Normalize the path\n path = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator);\n if (path.length === 0) {\n if (isAbsolute) {\n return '/';\n }\n return trailingSeparator ? './' : '.';\n }\n if (trailingSeparator) {\n path += '/';\n }\n return isAbsolute ? `/${path}` : path;\n },\n isAbsolute(path) {\n validateString(path, 'path');\n return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n },\n join(...paths) {\n if (paths.length === 0) {\n return '.';\n }\n let joined;\n for (let i = 0; i < paths.length; ++i) {\n const arg = paths[i];\n validateString(arg, 'path');\n if (arg.length > 0) {\n if (joined === undefined) {\n joined = arg;\n }\n else {\n joined += `/${arg}`;\n }\n }\n }\n if (joined === undefined) {\n return '.';\n }\n return posix.normalize(joined);\n },\n relative(from, to) {\n validateString(from, 'from');\n validateString(to, 'to');\n if (from === to) {\n return '';\n }\n // Trim leading forward slashes.\n from = posix.resolve(from);\n to = posix.resolve(to);\n if (from === to) {\n return '';\n }\n const fromStart = 1;\n const fromEnd = from.length;\n const fromLen = fromEnd - fromStart;\n const toStart = 1;\n const toLen = to.length - toStart;\n // Compare paths to find the longest common path from root\n const length = (fromLen < toLen ? fromLen : toLen);\n let lastCommonSep = -1;\n let i = 0;\n for (; i < length; i++) {\n const fromCode = from.charCodeAt(fromStart + i);\n if (fromCode !== to.charCodeAt(toStart + i)) {\n break;\n }\n else if (fromCode === CHAR_FORWARD_SLASH) {\n lastCommonSep = i;\n }\n }\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n }\n if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n }\n else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n }\n else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo/bar'; to='/'\n lastCommonSep = 0;\n }\n }\n }\n let out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`.\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n out += out.length === 0 ? '..' : '/..';\n }\n }\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts.\n return `${out}${to.slice(toStart + lastCommonSep)}`;\n },\n toNamespacedPath(path) {\n // Non-op on posix systems\n return path;\n },\n dirname(path) {\n validateString(path, 'path');\n if (path.length === 0) {\n return '.';\n }\n const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n let end = -1;\n let matchedSlash = true;\n for (let i = path.length - 1; i >= 1; --i) {\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n }\n else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n if (end === -1) {\n return hasRoot ? '/' : '.';\n }\n if (hasRoot && end === 1) {\n return '//';\n }\n return path.slice(0, end);\n },\n basename(path, ext) {\n if (ext !== undefined) {\n validateString(ext, 'ext');\n }\n validateString(path, 'path');\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i;\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext === path) {\n return '';\n }\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n const code = path.charCodeAt(i);\n if (code === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n if (start === end) {\n end = firstNonSlashEnd;\n }\n else if (end === -1) {\n end = path.length;\n }\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n if (end === -1) {\n return '';\n }\n return path.slice(start, end);\n },\n extname(path) {\n validateString(path, 'path');\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n for (let i = path.length - 1; i >= 0; --i) {\n const code = path.charCodeAt(i);\n if (code === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n },\n format: _format.bind(null, '/'),\n parse(path) {\n validateString(path, 'path');\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) {\n return ret;\n }\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n let start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n }\n else {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Get non-dir info\n for (; i >= start; --i) {\n const code = path.charCodeAt(i);\n if (code === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (end !== -1) {\n const start = startPart === 0 && isAbsolute ? 1 : startPart;\n if (startDot === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n ret.base = ret.name = path.slice(start, end);\n }\n else {\n ret.name = path.slice(start, startDot);\n ret.base = path.slice(start, end);\n ret.ext = path.slice(startDot, end);\n }\n }\n if (startPart > 0) {\n ret.dir = path.slice(0, startPart - 1);\n }\n else if (isAbsolute) {\n ret.dir = '/';\n }\n return ret;\n },\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\nposix.win32 = win32.win32 = win32;\nposix.posix = win32.posix = posix;\nexport const normalize = (platformIsWin32 ? win32.normalize : posix.normalize);\nexport const isAbsolute = (platformIsWin32 ? win32.isAbsolute : posix.isAbsolute);\nexport const join = (platformIsWin32 ? win32.join : posix.join);\nexport const resolve = (platformIsWin32 ? win32.resolve : posix.resolve);\nexport const relative = (platformIsWin32 ? win32.relative : posix.relative);\nexport const dirname = (platformIsWin32 ? win32.dirname : posix.dirname);\nexport const basename = (platformIsWin32 ? win32.basename : posix.basename);\nexport const extname = (platformIsWin32 ? win32.extname : posix.extname);\nexport const format = (platformIsWin32 ? win32.format : posix.format);\nexport const parse = (platformIsWin32 ? win32.parse : posix.parse);\nexport const toNamespacedPath = (platformIsWin32 ? win32.toNamespacedPath : posix.toNamespacedPath);\nexport const sep = (platformIsWin32 ? win32.sep : posix.sep);\nexport const delimiter = (platformIsWin32 ? win32.delimiter : posix.delimiter);\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 *--------------------------------------------------------------------------------------------*/\nimport { CancellationTokenSource } from './cancellation.js';\nexport class Cache {\n constructor(task) {\n this.task = task;\n this.result = null;\n }\n get() {\n if (this.result) {\n return this.result;\n }\n const cts = new CancellationTokenSource();\n const promise = this.task(cts.token);\n this.result = {\n promise,\n dispose: () => {\n this.result = null;\n cts.cancel();\n cts.dispose();\n }\n };\n return this.result;\n }\n}\n/**\n * Uses a LRU cache to make a given parametrized function cached.\n * Caches just the last value.\n * The key must be JSON serializable.\n*/\nexport class LRUCachedFunction {\n constructor(fn) {\n this.fn = fn;\n this.lastCache = undefined;\n this.lastArgKey = undefined;\n }\n get(arg) {\n const key = JSON.stringify(arg);\n if (this.lastArgKey !== key) {\n this.lastArgKey = key;\n this.lastCache = this.fn(arg);\n }\n return this.lastCache;\n }\n}\n/**\n * Uses an unbounded cache (referential equality) to memoize the results of the given function.\n*/\nexport class CachedFunction {\n get cachedValues() {\n return this._map;\n }\n constructor(fn) {\n this.fn = fn;\n this._map = new Map();\n }\n get(arg) {\n if (this._map.has(arg)) {\n return this._map.get(arg);\n }\n const value = this.fn(arg);\n this._map.set(arg, value);\n return value;\n }\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 *--------------------------------------------------------------------------------------------*/\nexport class Lazy {\n constructor(executor) {\n this.executor = executor;\n this._didRun = false;\n }\n /**\n * True if the lazy value has been resolved.\n */\n get hasValue() { return this._didRun; }\n /**\n * Get the wrapped value.\n *\n * This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only\n * resolved once. `getValue` will re-throw exceptions that are hit while resolving the value\n */\n get value() {\n if (!this._didRun) {\n try {\n this._value = this.executor();\n }\n catch (err) {\n this._error = err;\n }\n finally {\n this._didRun = true;\n }\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n /**\n * Get the wrapped value without forcing evaluation.\n */\n get rawValue() { return this._value; }\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 *--------------------------------------------------------------------------------------------*/\nvar _a;\nimport { LRUCachedFunction } from './cache.js';\nimport { Lazy } from './lazy.js';\nexport function isFalsyOrWhitespace(str) {\n if (!str || typeof str !== 'string') {\n return true;\n }\n return str.trim().length === 0;\n}\nconst _formatRegexp = /{(\\d+)}/g;\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nexport function format(value, ...args) {\n if (args.length === 0) {\n return value;\n }\n return value.replace(_formatRegexp, function (match, group) {\n const idx = parseInt(group, 10);\n return isNaN(idx) || idx < 0 || idx >= args.length ?\n match :\n args[idx];\n });\n}\nconst _format2Regexp = /{([^}]+)}/g;\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nexport function format2(template, values) {\n if (Object.keys(values).length === 0) {\n return template;\n }\n return template.replace(_format2Regexp, (match, group) => (values[group] ?? match));\n}\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nexport function escape(html) {\n return html.replace(/[<>&]/g, function (match) {\n switch (match) {\n case '<': return '<';\n case '>': return '>';\n case '&': return '&';\n default: return match;\n }\n });\n}\n/**\n * Escapes regular expression characters in a given string\n */\nexport function escapeRegExpCharacters(value) {\n return value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\n/**\n * Counts how often `character` occurs inside `value`.\n */\nexport function count(value, character) {\n let result = 0;\n const ch = character.charCodeAt(0);\n for (let i = value.length - 1; i >= 0; i--) {\n if (value.charCodeAt(i) === ch) {\n result++;\n }\n }\n return result;\n}\nexport function truncate(value, maxLength, suffix = '…') {\n if (value.length <= maxLength) {\n return value;\n }\n return `${value.substr(0, maxLength)}${suffix}`;\n}\nexport function truncateMiddle(value, maxLength, suffix = '…') {\n if (value.length <= maxLength) {\n return value;\n }\n const prefixLength = Math.ceil(maxLength / 2) - suffix.length / 2;\n const suffixLength = Math.floor(maxLength / 2) - suffix.length / 2;\n return `${value.substr(0, prefixLength)}${suffix}${value.substr(value.length - suffixLength)}`;\n}\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nexport function trim(haystack, needle = ' ') {\n const trimmed = ltrim(haystack, needle);\n return rtrim(trimmed, needle);\n}\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function ltrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length;\n if (needleLen === 0 || haystack.length === 0) {\n return haystack;\n }\n let offset = 0;\n while (haystack.indexOf(needle, offset) === offset) {\n offset = offset + needleLen;\n }\n return haystack.substring(offset);\n}\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function rtrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length, haystackLen = haystack.length;\n if (needleLen === 0 || haystackLen === 0) {\n return haystack;\n }\n let offset = haystackLen, idx = -1;\n while (true) {\n idx = haystack.lastIndexOf(needle, offset - 1);\n if (idx === -1 || idx + needleLen !== offset) {\n break;\n }\n if (idx === 0) {\n return '';\n }\n offset = idx;\n }\n return haystack.substring(0, offset);\n}\nexport function convertSimple2RegExpPattern(pattern) {\n return pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\nexport function stripWildcards(pattern) {\n return pattern.replace(/\\*/g, '');\n}\nexport function createRegExp(searchString, isRegex, options = {}) {\n if (!searchString) {\n throw new Error('Cannot create regex from empty string');\n }\n if (!isRegex) {\n searchString = escapeRegExpCharacters(searchString);\n }\n if (options.wholeWord) {\n if (!/\\B/.test(searchString.charAt(0))) {\n searchString = '\\\\b' + searchString;\n }\n if (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n searchString = searchString + '\\\\b';\n }\n }\n let modifiers = '';\n if (options.global) {\n modifiers += 'g';\n }\n if (!options.matchCase) {\n modifiers += 'i';\n }\n if (options.multiline) {\n modifiers += 'm';\n }\n if (options.unicode) {\n modifiers += 'u';\n }\n return new RegExp(searchString, modifiers);\n}\nexport function regExpLeadsToEndlessLoop(regexp) {\n // Exit early if it's one of these special cases which are meant to match\n // against an empty string\n if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n return false;\n }\n // We check against an empty string. If the regular expression doesn't advance\n // (e.g. ends in an endless loop) it will match an empty string.\n const match = regexp.exec('');\n return !!(match && regexp.lastIndex === 0);\n}\nexport function splitLines(str) {\n return str.split(/\\r\\n|\\r|\\n/);\n}\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function firstNonWhitespaceIndex(str) {\n for (let i = 0, len = str.length; i < len; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nexport function getLeadingWhitespace(str, start = 0, end = str.length) {\n for (let i = start; i < end; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return str.substring(start, i);\n }\n }\n return str.substring(start, end);\n}\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function lastNonWhitespaceIndex(str, startIndex = str.length - 1) {\n for (let i = startIndex; i >= 0; i--) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Function that works identically to String.prototype.replace, except, the\n * replace function is allowed to be async and return a Promise.\n */\nexport function replaceAsync(str, search, replacer) {\n const parts = [];\n let last = 0;\n for (const match of str.matchAll(search)) {\n parts.push(str.slice(last, match.index));\n if (match.index === undefined) {\n throw new Error('match.index should be defined');\n }\n last = match.index + match[0].length;\n parts.push(replacer(match[0], ...match.slice(1), match.index, str, match.groups));\n }\n parts.push(str.slice(last));\n return Promise.all(parts).then(p => p.join(''));\n}\nexport function compare(a, b) {\n if (a < b) {\n return -1;\n }\n else if (a > b) {\n return 1;\n }\n else {\n return 0;\n }\n}\nexport function compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n const codeA = a.charCodeAt(aStart);\n const codeB = b.charCodeAt(bStart);\n if (codeA < codeB) {\n return -1;\n }\n else if (codeA > codeB) {\n return 1;\n }\n }\n const aLen = aEnd - aStart;\n const bLen = bEnd - bStart;\n if (aLen < bLen) {\n return -1;\n }\n else if (aLen > bLen) {\n return 1;\n }\n return 0;\n}\nexport function compareIgnoreCase(a, b) {\n return compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\n}\nexport function compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n let codeA = a.charCodeAt(aStart);\n let codeB = b.charCodeAt(bStart);\n if (codeA === codeB) {\n // equal\n continue;\n }\n if (codeA >= 128 || codeB >= 128) {\n // not ASCII letters -> fallback to lower-casing strings\n return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\n }\n // mapper lower-case ascii letter onto upper-case varinats\n // [97-122] (lower ascii) --> [65-90] (upper ascii)\n if (isLowerAsciiLetter(codeA)) {\n codeA -= 32;\n }\n if (isLowerAsciiLetter(codeB)) {\n codeB -= 32;\n }\n // compare both code points\n const diff = codeA - codeB;\n if (diff === 0) {\n continue;\n }\n return diff;\n }\n const aLen = aEnd - aStart;\n const bLen = bEnd - bStart;\n if (aLen < bLen) {\n return -1;\n }\n else if (aLen > bLen) {\n return 1;\n }\n return 0;\n}\nexport function isAsciiDigit(code) {\n return code >= 48 /* CharCode.Digit0 */ && code <= 57 /* CharCode.Digit9 */;\n}\nexport function isLowerAsciiLetter(code) {\n return code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */;\n}\nexport function isUpperAsciiLetter(code) {\n return code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */;\n}\nexport function equalsIgnoreCase(a, b) {\n return a.length === b.length && compareSubstringIgnoreCase(a, b) === 0;\n}\nexport function startsWithIgnoreCase(str, candidate) {\n const candidateLength = candidate.length;\n if (candidate.length > str.length) {\n return false;\n }\n return compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;\n}\n/**\n * @returns the length of the common prefix of the two strings.\n */\nexport function commonPrefixLength(a, b) {\n const len = Math.min(a.length, b.length);\n let i;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(i) !== b.charCodeAt(i)) {\n return i;\n }\n }\n return len;\n}\n/**\n * @returns the length of the common suffix of the two strings.\n */\nexport function commonSuffixLength(a, b) {\n const len = Math.min(a.length, b.length);\n let i;\n const aLastIndex = a.length - 1;\n const bLastIndex = b.length - 1;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n return i;\n }\n }\n return len;\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isHighSurrogate(charCode) {\n return (0xD800 <= charCode && charCode <= 0xDBFF);\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isLowSurrogate(charCode) {\n return (0xDC00 <= charCode && charCode <= 0xDFFF);\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function computeCodePoint(highSurrogate, lowSurrogate) {\n return ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\n}\n/**\n * get the code point that begins at offset `offset`\n */\nexport function getNextCodePoint(str, len, offset) {\n const charCode = str.charCodeAt(offset);\n if (isHighSurrogate(charCode) && offset + 1 < len) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (isLowSurrogate(nextCharCode)) {\n return computeCodePoint(charCode, nextCharCode);\n }\n }\n return charCode;\n}\n/**\n * get the code point that ends right before offset `offset`\n */\nfunction getPrevCodePoint(str, offset) {\n const charCode = str.charCodeAt(offset - 1);\n if (isLowSurrogate(charCode) && offset > 1) {\n const prevCharCode = str.charCodeAt(offset - 2);\n if (isHighSurrogate(prevCharCode)) {\n return computeCodePoint(prevCharCode, charCode);\n }\n }\n return charCode;\n}\nexport class CodePointIterator {\n get offset() {\n return this._offset;\n }\n constructor(str, offset = 0) {\n this._str = str;\n this._len = str.length;\n this._offset = offset;\n }\n setOffset(offset) {\n this._offset = offset;\n }\n prevCodePoint() {\n const codePoint = getPrevCodePoint(this._str, this._offset);\n this._offset -= (codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\n return codePoint;\n }\n nextCodePoint() {\n const codePoint = getNextCodePoint(this._str, this._len, this._offset);\n this._offset += (codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\n return codePoint;\n }\n eol() {\n return (this._offset >= this._len);\n }\n}\nexport class GraphemeIterator {\n get offset() {\n return this._iterator.offset;\n }\n constructor(str, offset = 0) {\n this._iterator = new CodePointIterator(str, offset);\n }\n nextGraphemeLength() {\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\n const iterator = this._iterator;\n const initialOffset = iterator.offset;\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());\n while (!iterator.eol()) {\n const offset = iterator.offset;\n const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());\n if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\n // move iterator back\n iterator.setOffset(offset);\n break;\n }\n graphemeBreakType = nextGraphemeBreakType;\n }\n return (iterator.offset - initialOffset);\n }\n prevGraphemeLength() {\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\n const iterator = this._iterator;\n const initialOffset = iterator.offset;\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());\n while (iterator.offset > 0) {\n const offset = iterator.offset;\n const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());\n if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {\n // move iterator back\n iterator.setOffset(offset);\n break;\n }\n graphemeBreakType = prevGraphemeBreakType;\n }\n return (initialOffset - iterator.offset);\n }\n eol() {\n return this._iterator.eol();\n }\n}\nexport function nextCharLength(str, initialOffset) {\n const iterator = new GraphemeIterator(str, initialOffset);\n return iterator.nextGraphemeLength();\n}\nexport function prevCharLength(str, initialOffset) {\n const iterator = new GraphemeIterator(str, initialOffset);\n return iterator.prevGraphemeLength();\n}\nexport function getCharContainingOffset(str, offset) {\n if (offset > 0 && isLowSurrogate(str.charCodeAt(offset))) {\n offset--;\n }\n const endOffset = offset + nextCharLength(str, offset);\n const startOffset = endOffset - prevCharLength(str, endOffset);\n return [startOffset, endOffset];\n}\nexport function charCount(str) {\n const iterator = new GraphemeIterator(str);\n let length = 0;\n while (!iterator.eol()) {\n length++;\n iterator.nextGraphemeLength();\n }\n return length;\n}\nlet CONTAINS_RTL = undefined;\nfunction makeContainsRtl() {\n // Generated using https://github.com/alexdima/unicode-utils/blob/main/rtl-test.js\n return /(?:[\\u05BE\\u05C0\\u05C3\\u05C6\\u05D0-\\u05F4\\u0608\\u060B\\u060D\\u061B-\\u064A\\u066D-\\u066F\\u0671-\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1-\\u07EA\\u07F4\\u07F5\\u07FA\\u07FE-\\u0815\\u081A\\u0824\\u0828\\u0830-\\u0858\\u085E-\\u088E\\u08A0-\\u08C9\\u200F\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFD3D\\uFD50-\\uFDC7\\uFDF0-\\uFDFC\\uFE70-\\uFEFC]|\\uD802[\\uDC00-\\uDD1B\\uDD20-\\uDE00\\uDE10-\\uDE35\\uDE40-\\uDEE4\\uDEEB-\\uDF35\\uDF40-\\uDFFF]|\\uD803[\\uDC00-\\uDD23\\uDE80-\\uDEA9\\uDEAD-\\uDF45\\uDF51-\\uDF81\\uDF86-\\uDFF6]|\\uD83A[\\uDC00-\\uDCCF\\uDD00-\\uDD43\\uDD4B-\\uDFFF]|\\uD83B[\\uDC00-\\uDEBB])/;\n}\n/**\n * Returns true if `str` contains any Unicode character that is classified as \"R\" or \"AL\".\n */\nexport function containsRTL(str) {\n if (!CONTAINS_RTL) {\n CONTAINS_RTL = makeContainsRtl();\n }\n return CONTAINS_RTL.test(str);\n}\nconst IS_BASIC_ASCII = /^[\\t\\n\\r\\x20-\\x7E]*$/;\n/**\n * Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \\n, \\r, \\t\n */\nexport function isBasicASCII(str) {\n return IS_BASIC_ASCII.test(str);\n}\nexport const UNUSUAL_LINE_TERMINATORS = /[\\u2028\\u2029]/; // LINE SEPARATOR (LS) or PARAGRAPH SEPARATOR (PS)\n/**\n * Returns true if `str` contains unusual line terminators, like LS or PS\n */\nexport function containsUnusualLineTerminators(str) {\n return UNUSUAL_LINE_TERMINATORS.test(str);\n}\nexport function isFullWidthCharacter(charCode) {\n // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns\n // http://jrgraphix.net/research/unicode_blocks.php\n // 2E80 - 2EFF CJK Radicals Supplement\n // 2F00 - 2FDF Kangxi Radicals\n // 2FF0 - 2FFF Ideographic Description Characters\n // 3000 - 303F CJK Symbols and Punctuation\n // 3040 - 309F Hiragana\n // 30A0 - 30FF Katakana\n // 3100 - 312F Bopomofo\n // 3130 - 318F Hangul Compatibility Jamo\n // 3190 - 319F Kanbun\n // 31A0 - 31BF Bopomofo Extended\n // 31F0 - 31FF Katakana Phonetic Extensions\n // 3200 - 32FF Enclosed CJK Letters and Months\n // 3300 - 33FF CJK Compatibility\n // 3400 - 4DBF CJK Unified Ideographs Extension A\n // 4DC0 - 4DFF Yijing Hexagram Symbols\n // 4E00 - 9FFF CJK Unified Ideographs\n // A000 - A48F Yi Syllables\n // A490 - A4CF Yi Radicals\n // AC00 - D7AF Hangul Syllables\n // [IGNORE] D800 - DB7F High Surrogates\n // [IGNORE] DB80 - DBFF High Private Use Surrogates\n // [IGNORE] DC00 - DFFF Low Surrogates\n // [IGNORE] E000 - F8FF Private Use Area\n // F900 - FAFF CJK Compatibility Ideographs\n // [IGNORE] FB00 - FB4F Alphabetic Presentation Forms\n // [IGNORE] FB50 - FDFF Arabic Presentation Forms-A\n // [IGNORE] FE00 - FE0F Variation Selectors\n // [IGNORE] FE20 - FE2F Combining Half Marks\n // [IGNORE] FE30 - FE4F CJK Compatibility Forms\n // [IGNORE] FE50 - FE6F Small Form Variants\n // [IGNORE] FE70 - FEFF Arabic Presentation Forms-B\n // FF00 - FFEF Halfwidth and Fullwidth Forms\n // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]\n // of which FF01 - FF5E fullwidth ASCII of 21 to 7E\n // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul\n // [IGNORE] FFF0 - FFFF Specials\n return ((charCode >= 0x2E80 && charCode <= 0xD7AF)\n || (charCode >= 0xF900 && charCode <= 0xFAFF)\n || (charCode >= 0xFF01 && charCode <= 0xFF5E));\n}\n/**\n * A fast function (therefore imprecise) to check if code points are emojis.\n * Generated using https://github.com/alexdima/unicode-utils/blob/main/emoji-test.js\n */\nexport function isEmojiImprecise(x) {\n return ((x >= 0x1F1E6 && x <= 0x1F1FF) || (x === 8986) || (x === 8987) || (x === 9200)\n || (x === 9203) || (x >= 9728 && x <= 10175) || (x === 11088) || (x === 11093)\n || (x >= 127744 && x <= 128591) || (x >= 128640 && x <= 128764)\n || (x >= 128992 && x <= 129008) || (x >= 129280 && x <= 129535)\n || (x >= 129648 && x <= 129782));\n}\n/**\n * Given a string and a max length returns a shorted version. Shorting\n * happens at favorable positions - such as whitespace or punctuation characters.\n */\nexport function lcut(text, n) {\n if (text.length < n) {\n return text;\n }\n const re = /\\b/g;\n let i = 0;\n while (re.test(text)) {\n if (text.length - re.lastIndex < n) {\n break;\n }\n i = re.lastIndex;\n re.lastIndex += 1;\n }\n return text.substring(i).replace(/^\\s/, '');\n}\n// Escape codes, compiled from https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_\nconst CSI_SEQUENCE = /(:?\\x1b\\[|\\x9B)[=?>!]?[\\d;:]*[\"$#'* ]?[a-zA-Z@^`{}|~]/g;\n// Plus additional markers for custom `\\x1b]...\\x07` instructions.\nconst CSI_CUSTOM_SEQUENCE = /\\x1b\\].*?\\x07/g;\nexport function removeAnsiEscapeCodes(str) {\n if (str) {\n str = str.replace(CSI_SEQUENCE, '').replace(CSI_CUSTOM_SEQUENCE, '');\n }\n return str;\n}\n// -- UTF-8 BOM\nexport const UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* CharCode.UTF8_BOM */);\nexport function startsWithUTF8BOM(str) {\n return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* CharCode.UTF8_BOM */);\n}\nexport function stripUTF8BOM(str) {\n return startsWithUTF8BOM(str) ? str.substr(1) : str;\n}\n/**\n * Checks if the characters of the provided query string are included in the\n * target string. The characters do not have to be contiguous within the string.\n */\nexport function fuzzyContains(target, query) {\n if (!target || !query) {\n return false; // return early if target or query are undefined\n }\n if (target.length < query.length) {\n return false; // impossible for query to be contained in target\n }\n const queryLen = query.length;\n const targetLower = target.toLowerCase();\n let index = 0;\n let lastIndexOf = -1;\n while (index < queryLen) {\n const indexOf = targetLower.indexOf(query[index], lastIndexOf + 1);\n if (indexOf < 0) {\n return false;\n }\n lastIndexOf = indexOf;\n index++;\n }\n return true;\n}\nexport function containsUppercaseCharacter(target, ignoreEscapedChars = false) {\n if (!target) {\n return false;\n }\n if (ignoreEscapedChars) {\n target = target.replace(/\\\\./g, '');\n }\n return target.toLowerCase() !== target;\n}\nexport function uppercaseFirstLetter(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\nexport function getNLines(str, n = 1) {\n if (n === 0) {\n return '';\n }\n let idx = -1;\n do {\n idx = str.indexOf('\\n', idx + 1);\n n--;\n } while (n > 0 && idx >= 0);\n if (idx === -1) {\n return str;\n }\n if (str[idx - 1] === '\\r') {\n idx--;\n }\n return str.substr(0, idx);\n}\n/**\n * Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.\n */\nexport function singleLetterHash(n) {\n const LETTERS_CNT = (90 /* CharCode.Z */ - 65 /* CharCode.A */ + 1);\n n = n % (2 * LETTERS_CNT);\n if (n < LETTERS_CNT) {\n return String.fromCharCode(97 /* CharCode.a */ + n);\n }\n return String.fromCharCode(65 /* CharCode.A */ + n - LETTERS_CNT);\n}\n//#region Unicode Grapheme Break\nexport function getGraphemeBreakType(codePoint) {\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\n return graphemeBreakTree.getGraphemeBreakType(codePoint);\n}\nfunction breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) {\n // http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules\n // !!! Let's make the common case a bit faster\n if (breakTypeA === 0 /* GraphemeBreakType.Other */) {\n // see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table\n return (breakTypeB !== 5 /* GraphemeBreakType.Extend */ && breakTypeB !== 7 /* GraphemeBreakType.SpacingMark */);\n }\n // Do not break between a CR and LF. Otherwise, break before and after controls.\n // GB3 CR × LF\n // GB4 (Control | CR | LF) ÷\n // GB5 ÷ (Control | CR | LF)\n if (breakTypeA === 2 /* GraphemeBreakType.CR */) {\n if (breakTypeB === 3 /* GraphemeBreakType.LF */) {\n return false; // GB3\n }\n }\n if (breakTypeA === 4 /* GraphemeBreakType.Control */ || breakTypeA === 2 /* GraphemeBreakType.CR */ || breakTypeA === 3 /* GraphemeBreakType.LF */) {\n return true; // GB4\n }\n if (breakTypeB === 4 /* GraphemeBreakType.Control */ || breakTypeB === 2 /* GraphemeBreakType.CR */ || breakTypeB === 3 /* GraphemeBreakType.LF */) {\n return true; // GB5\n }\n // Do not break Hangul syllable sequences.\n // GB6 L × (L | V | LV | LVT)\n // GB7 (LV | V) × (V | T)\n // GB8 (LVT | T) × T\n if (breakTypeA === 8 /* GraphemeBreakType.L */) {\n if (breakTypeB === 8 /* GraphemeBreakType.L */ || breakTypeB === 9 /* GraphemeBreakType.V */ || breakTypeB === 11 /* GraphemeBreakType.LV */ || breakTypeB === 12 /* GraphemeBreakType.LVT */) {\n return false; // GB6\n }\n }\n if (breakTypeA === 11 /* GraphemeBreakType.LV */ || breakTypeA === 9 /* GraphemeBreakType.V */) {\n if (breakTypeB === 9 /* GraphemeBreakType.V */ || breakTypeB === 10 /* GraphemeBreakType.T */) {\n return false; // GB7\n }\n }\n if (breakTypeA === 12 /* GraphemeBreakType.LVT */ || breakTypeA === 10 /* GraphemeBreakType.T */) {\n if (breakTypeB === 10 /* GraphemeBreakType.T */) {\n return false; // GB8\n }\n }\n // Do not break before extending characters or ZWJ.\n // GB9 × (Extend | ZWJ)\n if (breakTypeB === 5 /* GraphemeBreakType.Extend */ || breakTypeB === 13 /* GraphemeBreakType.ZWJ */) {\n return false; // GB9\n }\n // The GB9a and GB9b rules only apply to extended grapheme clusters:\n // Do not break before SpacingMarks, or after Prepend characters.\n // GB9a × SpacingMark\n // GB9b Prepend ×\n if (breakTypeB === 7 /* GraphemeBreakType.SpacingMark */) {\n return false; // GB9a\n }\n if (breakTypeA === 1 /* GraphemeBreakType.Prepend */) {\n return false; // GB9b\n }\n // Do not break within emoji modifier sequences or emoji zwj sequences.\n // GB11 \\p{Extended_Pictographic} Extend* ZWJ × \\p{Extended_Pictographic}\n if (breakTypeA === 13 /* GraphemeBreakType.ZWJ */ && breakTypeB === 14 /* GraphemeBreakType.Extended_Pictographic */) {\n // Note: we are not implementing the rule entirely here to avoid introducing states\n return false; // GB11\n }\n // GB12 sot (RI RI)* RI × RI\n // GB13 [^RI] (RI RI)* RI × RI\n if (breakTypeA === 6 /* GraphemeBreakType.Regional_Indicator */ && breakTypeB === 6 /* GraphemeBreakType.Regional_Indicator */) {\n // Note: we are not implementing the rule entirely here to avoid introducing states\n return false; // GB12 & GB13\n }\n // GB999 Any ÷ Any\n return true;\n}\nclass GraphemeBreakTree {\n static getInstance() {\n if (!GraphemeBreakTree._INSTANCE) {\n GraphemeBreakTree._INSTANCE = new GraphemeBreakTree();\n }\n return GraphemeBreakTree._INSTANCE;\n }\n constructor() {\n this._data = getGraphemeBreakRawData();\n }\n getGraphemeBreakType(codePoint) {\n // !!! Let's make 7bit ASCII a bit faster: 0..31\n if (codePoint < 32) {\n if (codePoint === 10 /* CharCode.LineFeed */) {\n return 3 /* GraphemeBreakType.LF */;\n }\n if (codePoint === 13 /* CharCode.CarriageReturn */) {\n return 2 /* GraphemeBreakType.CR */;\n }\n return 4 /* GraphemeBreakType.Control */;\n }\n // !!! Let's make 7bit ASCII a bit faster: 32..126\n if (codePoint < 127) {\n return 0 /* GraphemeBreakType.Other */;\n }\n const data = this._data;\n const nodeCount = data.length / 3;\n let nodeIndex = 1;\n while (nodeIndex <= nodeCount) {\n if (codePoint < data[3 * nodeIndex]) {\n // go left\n nodeIndex = 2 * nodeIndex;\n }\n else if (codePoint > data[3 * nodeIndex + 1]) {\n // go right\n nodeIndex = 2 * nodeIndex + 1;\n }\n else {\n // hit\n return data[3 * nodeIndex + 2];\n }\n }\n return 0 /* GraphemeBreakType.Other */;\n }\n}\nGraphemeBreakTree._INSTANCE = null;\nfunction getGraphemeBreakRawData() {\n // generated using https://github.com/alexdima/unicode-utils/blob/main/grapheme-break.js\n return JSON.parse('[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]');\n}\n//#endregion\n/**\n * Computes the offset after performing a left delete on the given string,\n * while considering unicode grapheme/emoji rules.\n*/\nexport function getLeftDeleteOffset(offset, str) {\n if (offset === 0) {\n return 0;\n }\n // Try to delete emoji part.\n const emojiOffset = getOffsetBeforeLastEmojiComponent(offset, str);\n if (emojiOffset !== undefined) {\n return emojiOffset;\n }\n // Otherwise, just skip a single code point.\n const iterator = new CodePointIterator(str, offset);\n iterator.prevCodePoint();\n return iterator.offset;\n}\nfunction getOffsetBeforeLastEmojiComponent(initialOffset, str) {\n // See https://www.unicode.org/reports/tr51/tr51-14.html#EBNF_and_Regex for the\n // structure of emojis.\n const iterator = new CodePointIterator(str, initialOffset);\n let codePoint = iterator.prevCodePoint();\n // Skip modifiers\n while ((isEmojiModifier(codePoint) || codePoint === 65039 /* CodePoint.emojiVariantSelector */ || codePoint === 8419 /* CodePoint.enclosingKeyCap */)) {\n if (iterator.offset === 0) {\n // Cannot skip modifier, no preceding emoji base.\n return undefined;\n }\n codePoint = iterator.prevCodePoint();\n }\n // Expect base emoji\n if (!isEmojiImprecise(codePoint)) {\n // Unexpected code point, not a valid emoji.\n return undefined;\n }\n let resultOffset = iterator.offset;\n if (resultOffset > 0) {\n // Skip optional ZWJ code points that combine multiple emojis.\n // In theory, we should check if that ZWJ actually combines multiple emojis\n // to prevent deleting ZWJs in situations we didn't account for.\n const optionalZwjCodePoint = iterator.prevCodePoint();\n if (optionalZwjCodePoint === 8205 /* CodePoint.zwj */) {\n resultOffset = iterator.offset;\n }\n }\n return resultOffset;\n}\nfunction isEmojiModifier(codePoint) {\n return 0x1F3FB <= codePoint && codePoint <= 0x1F3FF;\n}\nexport const noBreakWhitespace = '\\xa0';\nexport class AmbiguousCharacters {\n static getInstance(locales) {\n return _a.cache.get(Array.from(locales));\n }\n static getLocales() {\n return _a._locales.value;\n }\n constructor(confusableDictionary) {\n this.confusableDictionary = confusableDictionary;\n }\n isAmbiguous(codePoint) {\n return this.confusableDictionary.has(codePoint);\n }\n /**\n * Returns the non basic ASCII code point that the given code point can be confused,\n * or undefined if such code point does note exist.\n */\n getPrimaryConfusable(codePoint) {\n return this.confusableDictionary.get(codePoint);\n }\n getConfusableCodePoints() {\n return new Set(this.confusableDictionary.keys());\n }\n}\n_a = AmbiguousCharacters;\nAmbiguousCharacters.ambiguousCharacterData = new Lazy(() => {\n // Generated using https://github.com/hediet/vscode-unicode-data\n // Stored as key1, value1, key2, value2, ...\n return JSON.parse('{\\\"_common\\\":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,8218,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,8242,96,1370,96,1523,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71922,67,71913,67,65315,67,8557,67,8450,67,8493,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71919,87,71910,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,66293,90,71909,90,65338,90,8484,90,8488,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],\\\"_default\\\":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"cs\\\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"de\\\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"es\\\":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"fr\\\":[65374,126,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"it\\\":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"ja\\\":[8211,45,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65292,44,65307,59],\\\"ko\\\":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"pl\\\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"pt-BR\\\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"qps-ploc\\\":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"ru\\\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"tr\\\":[160,32,8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"zh-hans\\\":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],\\\"zh-hant\\\":[8211,45,65374,126,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65307,59]}');\n});\nAmbiguousCharacters.cache = new LRUCachedFunction((locales) => {\n function arrayToMap(arr) {\n const result = new Map();\n for (let i = 0; i < arr.length; i += 2) {\n result.set(arr[i], arr[i + 1]);\n }\n return result;\n }\n function mergeMaps(map1, map2) {\n const result = new Map(map1);\n for (const [key, value] of map2) {\n result.set(key, value);\n }\n return result;\n }\n function intersectMaps(map1, map2) {\n if (!map1) {\n return map2;\n }\n const result = new Map();\n for (const [key, value] of map1) {\n if (map2.has(key)) {\n result.set(key, value);\n }\n }\n return result;\n }\n const data = _a.ambiguousCharacterData.value;\n let filteredLocales = locales.filter((l) => !l.startsWith('_') && l in data);\n if (filteredLocales.length === 0) {\n filteredLocales = ['_default'];\n }\n let languageSpecificMap = undefined;\n for (const locale of filteredLocales) {\n const map = arrayToMap(data[locale]);\n languageSpecificMap = intersectMaps(languageSpecificMap, map);\n }\n const commonMap = arrayToMap(data['_common']);\n const map = mergeMaps(commonMap, languageSpecificMap);\n return new _a(map);\n});\nAmbiguousCharacters._locales = new Lazy(() => Object.keys(_a.ambiguousCharacterData.value).filter((k) => !k.startsWith('_')));\nexport class InvisibleCharacters {\n static getRawData() {\n // Generated using https://github.com/hediet/vscode-unicode-data\n return JSON.parse('[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12288,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999]');\n }\n static getData() {\n if (!this._data) {\n this._data = new Set(InvisibleCharacters.getRawData());\n }\n return this._data;\n }\n static isInvisibleCharacter(codePoint) {\n return InvisibleCharacters.getData().has(codePoint);\n }\n static get codePoints() {\n return InvisibleCharacters.getData();\n }\n}\nInvisibleCharacters._data = undefined;\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 *--------------------------------------------------------------------------------------------*/\nimport { isAbsolute, join, normalize, posix, sep } from './path.js';\nimport { isWindows } from './platform.js';\nimport { equalsIgnoreCase, rtrim, startsWithIgnoreCase } from './strings.js';\nimport { isNumber } from './types.js';\nexport function isPathSeparator(code) {\n return code === 47 /* CharCode.Slash */ || code === 92 /* CharCode.Backslash */;\n}\n/**\n * Takes a Windows OS path and changes backward slashes to forward slashes.\n * This should only be done for OS paths from Windows (or user provided paths potentially from Windows).\n * Using it on a Linux or MaxOS path might change it.\n */\nexport function toSlashes(osPath) {\n return osPath.replace(/[\\\\/]/g, posix.sep);\n}\n/**\n * Takes a Windows OS path (using backward or forward slashes) and turns it into a posix path:\n * - turns backward slashes into forward slashes\n * - makes it absolute if it starts with a drive letter\n * This should only be done for OS paths from Windows (or user provided paths potentially from Windows).\n * Using it on a Linux or MaxOS path might change it.\n */\nexport function toPosixPath(osPath) {\n if (osPath.indexOf('/') === -1) {\n osPath = toSlashes(osPath);\n }\n if (/^[a-zA-Z]:(\\/|$)/.test(osPath)) { // starts with a drive letter\n osPath = '/' + osPath;\n }\n return osPath;\n}\n/**\n * Computes the _root_ this path, like `getRoot('c:\\files') === c:\\`,\n * `getRoot('files:///files/path') === files:///`,\n * or `getRoot('\\\\server\\shares\\path') === \\\\server\\shares\\`\n */\nexport function getRoot(path, sep = posix.sep) {\n if (!path) {\n return '';\n }\n const len = path.length;\n const firstLetter = path.charCodeAt(0);\n if (isPathSeparator(firstLetter)) {\n if (isPathSeparator(path.charCodeAt(1))) {\n // UNC candidate \\\\localhost\\shares\\ddd\n // ^^^^^^^^^^^^^^^^^^^\n if (!isPathSeparator(path.charCodeAt(2))) {\n let pos = 3;\n const start = pos;\n for (; pos < len; pos++) {\n if (isPathSeparator(path.charCodeAt(pos))) {\n break;\n }\n }\n if (start !== pos && !isPathSeparator(path.charCodeAt(pos + 1))) {\n pos += 1;\n for (; pos < len; pos++) {\n if (isPathSeparator(path.charCodeAt(pos))) {\n return path.slice(0, pos + 1) // consume this separator\n .replace(/[\\\\/]/g, sep);\n }\n }\n }\n }\n }\n // /user/far\n // ^\n return sep;\n }\n else if (isWindowsDriveLetter(firstLetter)) {\n // check for windows drive letter c:\\ or c:\n if (path.charCodeAt(1) === 58 /* CharCode.Colon */) {\n if (isPathSeparator(path.charCodeAt(2))) {\n // C:\\fff\n // ^^^\n return path.slice(0, 2) + sep;\n }\n else {\n // C:\n // ^^\n return path.slice(0, 2);\n }\n }\n }\n // check for URI\n // scheme://authority/path\n // ^^^^^^^^^^^^^^^^^^^\n let pos = path.indexOf('://');\n if (pos !== -1) {\n pos += 3; // 3 -> \"://\".length\n for (; pos < len; pos++) {\n if (isPathSeparator(path.charCodeAt(pos))) {\n return path.slice(0, pos + 1); // consume this separator\n }\n }\n }\n return '';\n}\n/**\n * Check if the path follows this pattern: `\\\\hostname\\sharename`.\n *\n * @see https://msdn.microsoft.com/en-us/library/gg465305.aspx\n * @return A boolean indication if the path is a UNC path, on none-windows\n * always false.\n */\nexport function isUNC(path) {\n if (!isWindows) {\n // UNC is a windows concept\n return false;\n }\n if (!path || path.length < 5) {\n // at least \\\\a\\b\n return false;\n }\n let code = path.charCodeAt(0);\n if (code !== 92 /* CharCode.Backslash */) {\n return false;\n }\n code = path.charCodeAt(1);\n if (code !== 92 /* CharCode.Backslash */) {\n return false;\n }\n let pos = 2;\n const start = pos;\n for (; pos < path.length; pos++) {\n code = path.charCodeAt(pos);\n if (code === 92 /* CharCode.Backslash */) {\n break;\n }\n }\n if (start === pos) {\n return false;\n }\n code = path.charCodeAt(pos + 1);\n if (isNaN(code) || code === 92 /* CharCode.Backslash */) {\n return false;\n }\n return true;\n}\n// Reference: https://en.wikipedia.org/wiki/Filename\nconst WINDOWS_INVALID_FILE_CHARS = /[\\\\/:\\*\\?\"<>\\|]/g;\nconst UNIX_INVALID_FILE_CHARS = /[\\\\/]/g;\nconst WINDOWS_FORBIDDEN_NAMES = /^(con|prn|aux|clock\\$|nul|lpt[0-9]|com[0-9])(\\.(.*?))?$/i;\nexport function isValidBasename(name, isWindowsOS = isWindows) {\n const invalidFileChars = isWindowsOS ? WINDOWS_INVALID_FILE_CHARS : UNIX_INVALID_FILE_CHARS;\n if (!name || name.length === 0 || /^\\s+$/.test(name)) {\n return false; // require a name that is not just whitespace\n }\n invalidFileChars.lastIndex = 0; // the holy grail of software development\n if (invalidFileChars.test(name)) {\n return false; // check for certain invalid file characters\n }\n if (isWindowsOS && WINDOWS_FORBIDDEN_NAMES.test(name)) {\n return false; // check for certain invalid file names\n }\n if (name === '.' || name === '..') {\n return false; // check for reserved values\n }\n if (isWindowsOS && name[name.length - 1] === '.') {\n return false; // Windows: file cannot end with a \".\"\n }\n if (isWindowsOS && name.length !== name.trim().length) {\n return false; // Windows: file cannot end with a whitespace\n }\n if (name.length > 255) {\n return false; // most file systems do not allow files > 255 length\n }\n return true;\n}\n/**\n * @deprecated please use `IUriIdentityService.extUri.isEqual` instead. If you are\n * in a context without services, consider to pass down the `extUri` from the outside\n * or use `extUriBiasedIgnorePathCase` if you know what you are doing.\n */\nexport function isEqual(pathA, pathB, ignoreCase) {\n const identityEquals = (pathA === pathB);\n if (!ignoreCase || identityEquals) {\n return identityEquals;\n }\n if (!pathA || !pathB) {\n return false;\n }\n return equalsIgnoreCase(pathA, pathB);\n}\n/**\n * @deprecated please use `IUriIdentityService.extUri.isEqualOrParent` instead. If\n * you are in a context without services, consider to pass down the `extUri` from the\n * outside, or use `extUriBiasedIgnorePathCase` if you know what you are doing.\n */\nexport function isEqualOrParent(base, parentCandidate, ignoreCase, separator = sep) {\n if (base === parentCandidate) {\n return true;\n }\n if (!base || !parentCandidate) {\n return false;\n }\n if (parentCandidate.length > base.length) {\n return false;\n }\n if (ignoreCase) {\n const beginsWith = startsWithIgnoreCase(base, parentCandidate);\n if (!beginsWith) {\n return false;\n }\n if (parentCandidate.length === base.length) {\n return true; // same path, different casing\n }\n let sepOffset = parentCandidate.length;\n if (parentCandidate.charAt(parentCandidate.length - 1) === separator) {\n sepOffset--; // adjust the expected sep offset in case our candidate already ends in separator character\n }\n return base.charAt(sepOffset) === separator;\n }\n if (parentCandidate.charAt(parentCandidate.length - 1) !== separator) {\n parentCandidate += separator;\n }\n return base.indexOf(parentCandidate) === 0;\n}\nexport function isWindowsDriveLetter(char0) {\n return char0 >= 65 /* CharCode.A */ && char0 <= 90 /* CharCode.Z */ || char0 >= 97 /* CharCode.a */ && char0 <= 122 /* CharCode.z */;\n}\nexport function sanitizeFilePath(candidate, cwd) {\n // Special case: allow to open a drive letter without trailing backslash\n if (isWindows && candidate.endsWith(':')) {\n candidate += sep;\n }\n // Ensure absolute\n if (!isAbsolute(candidate)) {\n candidate = join(cwd, candidate);\n }\n // Ensure normalized\n candidate = normalize(candidate);\n // Ensure no trailing slash/backslash\n if (isWindows) {\n candidate = rtrim(candidate, sep);\n // Special case: allow to open drive root ('C:\\')\n if (candidate.endsWith(':')) {\n candidate += sep;\n }\n }\n else {\n candidate = rtrim(candidate, sep);\n // Special case: allow to open root ('/')\n if (!candidate) {\n candidate = sep;\n }\n }\n return candidate;\n}\nexport function isRootOrDriveLetter(path) {\n const pathNormalized = normalize(path);\n if (isWindows) {\n if (path.length > 3) {\n return false;\n }\n return hasDriveLetter(pathNormalized) &&\n (path.length === 2 || pathNormalized.charCodeAt(2) === 92 /* CharCode.Backslash */);\n }\n return pathNormalized === posix.sep;\n}\nexport function hasDriveLetter(path, isWindowsOS = isWindows) {\n if (isWindowsOS) {\n return isWindowsDriveLetter(path.charCodeAt(0)) && path.charCodeAt(1) === 58 /* CharCode.Colon */;\n }\n return false;\n}\nexport function getDriveLetter(path, isWindowsOS = isWindows) {\n return hasDriveLetter(path, isWindowsOS) ? path[0] : undefined;\n}\nexport function indexOfPath(path, candidate, ignoreCase) {\n if (candidate.length > path.length) {\n return -1;\n }\n if (path === candidate) {\n return 0;\n }\n if (ignoreCase) {\n path = path.toLowerCase();\n candidate = candidate.toLowerCase();\n }\n return path.indexOf(candidate);\n}\nexport function parseLineAndColumnAware(rawPath) {\n const segments = rawPath.split(':'); // C:\\file.txt::\n let path = undefined;\n let line = undefined;\n let column = undefined;\n for (const segment of segments) {\n const segmentAsNumber = Number(segment);\n if (!isNumber(segmentAsNumber)) {\n path = !!path ? [path, segment].join(':') : segment; // a colon can well be part of a path (e.g. C:\\...)\n }\n else if (line === undefined) {\n line = segmentAsNumber;\n }\n else if (column === undefined) {\n column = segmentAsNumber;\n }\n }\n if (!path) {\n throw new Error('Format for `--goto` should be: `FILE:LINE(:COLUMN)`');\n }\n return {\n path,\n line: line !== undefined ? line : undefined,\n column: column !== undefined ? column : line !== undefined ? 1 : undefined // if we have a line, make sure column is also set\n };\n}\nconst pathChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nconst windowsSafePathFirstChars = 'BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789';\nexport function randomPath(parent, prefix, randomLength = 8) {\n let suffix = '';\n for (let i = 0; i < randomLength; i++) {\n let pathCharsTouse;\n if (i === 0 && isWindows && !prefix && (randomLength === 3 || randomLength === 4)) {\n // Windows has certain reserved file names that cannot be used, such\n // as AUX, CON, PRN, etc. We want to avoid generating a random name\n // that matches that pattern, so we use a different set of characters\n // for the first character of the name that does not include any of\n // the reserved names first characters.\n pathCharsTouse = windowsSafePathFirstChars;\n }\n else {\n pathCharsTouse = pathChars;\n }\n suffix += pathCharsTouse.charAt(Math.floor(Math.random() * pathCharsTouse.length));\n }\n let randomFileName;\n if (prefix) {\n randomFileName = `${prefix}-${suffix}`;\n }\n else {\n randomFileName = suffix;\n }\n if (parent) {\n return join(parent, randomFileName);\n }\n return randomFileName;\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 *--------------------------------------------------------------------------------------------*/\nimport * as paths from './path.js';\nimport { isWindows } from './platform.js';\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\nconst _singleSlashStart = /^\\//;\nconst _doubleSlashStart = /^\\/\\//;\nfunction _validateUri(ret, _strict) {\n // scheme, must be set\n if (!ret.scheme && _strict) {\n throw new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\n }\n // scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n // ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n if (ret.scheme && !_schemePattern.test(ret.scheme)) {\n throw new Error('[UriError]: Scheme contains illegal characters.');\n }\n // path, http://tools.ietf.org/html/rfc3986#section-3.3\n // If a URI contains an authority component, then the path component\n // must either be empty or begin with a slash (\"/\") character. If a URI\n // does not contain an authority component, then the path cannot begin\n // with two slash characters (\"//\").\n if (ret.path) {\n if (ret.authority) {\n if (!_singleSlashStart.test(ret.path)) {\n throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\n }\n }\n else {\n if (_doubleSlashStart.test(ret.path)) {\n throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n }\n }\n }\n}\n// for a while we allowed uris *without* schemes and this is the migration\n// for them, e.g. an uri without scheme and without strict-mode warns and falls\n// back to the file-scheme. that should cause the least carnage and still be a\n// clear warning\nfunction _schemeFix(scheme, _strict) {\n if (!scheme && !_strict) {\n return 'file';\n }\n return scheme;\n}\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\nfunction _referenceResolution(scheme, path) {\n // the slash-character is our 'default base' as we don't\n // support constructing URIs relative to other URIs. This\n // also means that we alter and potentially break paths.\n // see https://tools.ietf.org/html/rfc3986#section-5.1.4\n switch (scheme) {\n case 'https':\n case 'http':\n case 'file':\n if (!path) {\n path = _slash;\n }\n else if (path[0] !== _slash) {\n path = _slash + path;\n }\n break;\n }\n return path;\n}\nconst _empty = '';\nconst _slash = '/';\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n/**\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\n * This class is a simple parser which creates the basic component parts\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\n * and encoding.\n *\n * ```txt\n * foo://example.com:8042/over/there?name=ferret#nose\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\n * | | | | |\n * scheme authority path query fragment\n * | _____________________|__\n * / \\ / \\\n * urn:example:animal:ferret:nose\n * ```\n */\nexport class URI {\n static isUri(thing) {\n if (thing instanceof URI) {\n return true;\n }\n if (!thing) {\n return false;\n }\n return typeof thing.authority === 'string'\n && typeof thing.fragment === 'string'\n && typeof thing.path === 'string'\n && typeof thing.query === 'string'\n && typeof thing.scheme === 'string'\n && typeof thing.fsPath === 'string'\n && typeof thing.with === 'function'\n && typeof thing.toString === 'function';\n }\n /**\n * @internal\n */\n constructor(schemeOrData, authority, path, query, fragment, _strict = false) {\n if (typeof schemeOrData === 'object') {\n this.scheme = schemeOrData.scheme || _empty;\n this.authority = schemeOrData.authority || _empty;\n this.path = schemeOrData.path || _empty;\n this.query = schemeOrData.query || _empty;\n this.fragment = schemeOrData.fragment || _empty;\n // no validation because it's this URI\n // that creates uri components.\n // _validateUri(this);\n }\n else {\n this.scheme = _schemeFix(schemeOrData, _strict);\n this.authority = authority || _empty;\n this.path = _referenceResolution(this.scheme, path || _empty);\n this.query = query || _empty;\n this.fragment = fragment || _empty;\n _validateUri(this, _strict);\n }\n }\n // ---- filesystem path -----------------------\n /**\n * Returns a string representing the corresponding file system path of this URI.\n * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\n * platform specific path separator.\n *\n * * Will *not* validate the path for invalid characters and semantics.\n * * Will *not* look at the scheme of this URI.\n * * The result shall *not* be used for display purposes but for accessing a file on disk.\n *\n *\n * The *difference* to `URI#path` is the use of the platform specific separator and the handling\n * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\n *\n * ```ts\n const u = URI.parse('file://server/c$/folder/file.txt')\n u.authority === 'server'\n u.path === '/shares/c$/file.txt'\n u.fsPath === '\\\\server\\c$\\folder\\file.txt'\n ```\n *\n * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\n * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\n * with URIs that represent files on disk (`file` scheme).\n */\n get fsPath() {\n // if (this.scheme !== 'file') {\n // \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\n // }\n return uriToFsPath(this, false);\n }\n // ---- modify to new -------------------------\n with(change) {\n if (!change) {\n return this;\n }\n let { scheme, authority, path, query, fragment } = change;\n if (scheme === undefined) {\n scheme = this.scheme;\n }\n else if (scheme === null) {\n scheme = _empty;\n }\n if (authority === undefined) {\n authority = this.authority;\n }\n else if (authority === null) {\n authority = _empty;\n }\n if (path === undefined) {\n path = this.path;\n }\n else if (path === null) {\n path = _empty;\n }\n if (query === undefined) {\n query = this.query;\n }\n else if (query === null) {\n query = _empty;\n }\n if (fragment === undefined) {\n fragment = this.fragment;\n }\n else if (fragment === null) {\n fragment = _empty;\n }\n if (scheme === this.scheme\n && authority === this.authority\n && path === this.path\n && query === this.query\n && fragment === this.fragment) {\n return this;\n }\n return new Uri(scheme, authority, path, query, fragment);\n }\n // ---- parse & validate ------------------------\n /**\n * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,\n * `file:///usr/home`, or `scheme:with/path`.\n *\n * @param value A string which represents an URI (see `URI#toString`).\n */\n static parse(value, _strict = false) {\n const match = _regexp.exec(value);\n if (!match) {\n return new Uri(_empty, _empty, _empty, _empty, _empty);\n }\n return new Uri(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict);\n }\n /**\n * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\n * `/usr/home`, or `\\\\server\\share\\some\\path`.\n *\n * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\n * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\n * `URI.parse('file://' + path)` because the path might contain characters that are\n * interpreted (# and ?). See the following sample:\n * ```ts\n const good = URI.file('/coding/c#/project1');\n good.scheme === 'file';\n good.path === '/coding/c#/project1';\n good.fragment === '';\n const bad = URI.parse('file://' + '/coding/c#/project1');\n bad.scheme === 'file';\n bad.path === '/coding/c'; // path is now broken\n bad.fragment === '/project1';\n ```\n *\n * @param path A file system path (see `URI#fsPath`)\n */\n static file(path) {\n let authority = _empty;\n // normalize to fwd-slashes on windows,\n // on other systems bwd-slashes are valid\n // filename character, eg /f\\oo/ba\\r.txt\n if (isWindows) {\n path = path.replace(/\\\\/g, _slash);\n }\n // check for authority as used in UNC shares\n // or use the path as given\n if (path[0] === _slash && path[1] === _slash) {\n const idx = path.indexOf(_slash, 2);\n if (idx === -1) {\n authority = path.substring(2);\n path = _slash;\n }\n else {\n authority = path.substring(2, idx);\n path = path.substring(idx) || _slash;\n }\n }\n return new Uri('file', authority, path, _empty, _empty);\n }\n /**\n * Creates new URI from uri components.\n *\n * Unless `strict` is `true` the scheme is defaults to be `file`. This function performs\n * validation and should be used for untrusted uri components retrieved from storage,\n * user input, command arguments etc\n */\n static from(components, strict) {\n const result = new Uri(components.scheme, components.authority, components.path, components.query, components.fragment, strict);\n return result;\n }\n /**\n * Join a URI path with path fragments and normalizes the resulting path.\n *\n * @param uri The input URI.\n * @param pathFragment The path fragment to add to the URI path.\n * @returns The resulting URI.\n */\n static joinPath(uri, ...pathFragment) {\n if (!uri.path) {\n throw new Error(`[UriError]: cannot call joinPath on URI without path`);\n }\n let newPath;\n if (isWindows && uri.scheme === 'file') {\n newPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path;\n }\n else {\n newPath = paths.posix.join(uri.path, ...pathFragment);\n }\n return uri.with({ path: newPath });\n }\n // ---- printing/externalize ---------------------------\n /**\n * Creates a string representation for this URI. It's guaranteed that calling\n * `URI.parse` with the result of this function creates an URI which is equal\n * to this URI.\n *\n * * The result shall *not* be used for display purposes but for externalization or transport.\n * * The result will be encoded using the percentage encoding and encoding happens mostly\n * ignore the scheme-specific encoding rules.\n *\n * @param skipEncoding Do not encode the result, default is `false`\n */\n toString(skipEncoding = false) {\n return _asFormatted(this, skipEncoding);\n }\n toJSON() {\n return this;\n }\n static revive(data) {\n if (!data) {\n return data;\n }\n else if (data instanceof URI) {\n return data;\n }\n else {\n const result = new Uri(data);\n result._formatted = data.external ?? null;\n result._fsPath = data._sep === _pathSepMarker ? data.fsPath ?? null : null;\n return result;\n }\n }\n}\nexport function isUriComponents(thing) {\n if (!thing || typeof thing !== 'object') {\n return false;\n }\n return typeof thing.scheme === 'string'\n && (typeof thing.authority === 'string' || typeof thing.authority === 'undefined')\n && (typeof thing.path === 'string' || typeof thing.path === 'undefined')\n && (typeof thing.query === 'string' || typeof thing.query === 'undefined')\n && (typeof thing.fragment === 'string' || typeof thing.fragment === 'undefined');\n}\nconst _pathSepMarker = isWindows ? 1 : undefined;\n// This class exists so that URI is compatible with vscode.Uri (API).\nclass Uri extends URI {\n constructor() {\n super(...arguments);\n this._formatted = null;\n this._fsPath = null;\n }\n get fsPath() {\n if (!this._fsPath) {\n this._fsPath = uriToFsPath(this, false);\n }\n return this._fsPath;\n }\n toString(skipEncoding = false) {\n if (!skipEncoding) {\n if (!this._formatted) {\n this._formatted = _asFormatted(this, false);\n }\n return this._formatted;\n }\n else {\n // we don't cache that\n return _asFormatted(this, true);\n }\n }\n toJSON() {\n const res = {\n $mid: 1 /* MarshalledId.Uri */\n };\n // cached state\n if (this._fsPath) {\n res.fsPath = this._fsPath;\n res._sep = _pathSepMarker;\n }\n if (this._formatted) {\n res.external = this._formatted;\n }\n //--- uri components\n if (this.path) {\n res.path = this.path;\n }\n // TODO\n // this isn't correct and can violate the UriComponents contract but\n // this is part of the vscode.Uri API and we shouldn't change how that\n // works anymore\n if (this.scheme) {\n res.scheme = this.scheme;\n }\n if (this.authority) {\n res.authority = this.authority;\n }\n if (this.query) {\n res.query = this.query;\n }\n if (this.fragment) {\n res.fragment = this.fragment;\n }\n return res;\n }\n}\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\nconst encodeTable = {\n [58 /* CharCode.Colon */]: '%3A', // gen-delims\n [47 /* CharCode.Slash */]: '%2F',\n [63 /* CharCode.QuestionMark */]: '%3F',\n [35 /* CharCode.Hash */]: '%23',\n [91 /* CharCode.OpenSquareBracket */]: '%5B',\n [93 /* CharCode.CloseSquareBracket */]: '%5D',\n [64 /* CharCode.AtSign */]: '%40',\n [33 /* CharCode.ExclamationMark */]: '%21', // sub-delims\n [36 /* CharCode.DollarSign */]: '%24',\n [38 /* CharCode.Ampersand */]: '%26',\n [39 /* CharCode.SingleQuote */]: '%27',\n [40 /* CharCode.OpenParen */]: '%28',\n [41 /* CharCode.CloseParen */]: '%29',\n [42 /* CharCode.Asterisk */]: '%2A',\n [43 /* CharCode.Plus */]: '%2B',\n [44 /* CharCode.Comma */]: '%2C',\n [59 /* CharCode.Semicolon */]: '%3B',\n [61 /* CharCode.Equals */]: '%3D',\n [32 /* CharCode.Space */]: '%20',\n};\nfunction encodeURIComponentFast(uriComponent, isPath, isAuthority) {\n let res = undefined;\n let nativeEncodePos = -1;\n for (let pos = 0; pos < uriComponent.length; pos++) {\n const code = uriComponent.charCodeAt(pos);\n // unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\n if ((code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */)\n || (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */)\n || (code >= 48 /* CharCode.Digit0 */ && code <= 57 /* CharCode.Digit9 */)\n || code === 45 /* CharCode.Dash */\n || code === 46 /* CharCode.Period */\n || code === 95 /* CharCode.Underline */\n || code === 126 /* CharCode.Tilde */\n || (isPath && code === 47 /* CharCode.Slash */)\n || (isAuthority && code === 91 /* CharCode.OpenSquareBracket */)\n || (isAuthority && code === 93 /* CharCode.CloseSquareBracket */)\n || (isAuthority && code === 58 /* CharCode.Colon */)) {\n // check if we are delaying native encode\n if (nativeEncodePos !== -1) {\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n nativeEncodePos = -1;\n }\n // check if we write into a new string (by default we try to return the param)\n if (res !== undefined) {\n res += uriComponent.charAt(pos);\n }\n }\n else {\n // encoding needed, we need to allocate a new string\n if (res === undefined) {\n res = uriComponent.substr(0, pos);\n }\n // check with default table first\n const escaped = encodeTable[code];\n if (escaped !== undefined) {\n // check if we are delaying native encode\n if (nativeEncodePos !== -1) {\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n nativeEncodePos = -1;\n }\n // append escaped variant to result\n res += escaped;\n }\n else if (nativeEncodePos === -1) {\n // use native encode only when needed\n nativeEncodePos = pos;\n }\n }\n }\n if (nativeEncodePos !== -1) {\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos));\n }\n return res !== undefined ? res : uriComponent;\n}\nfunction encodeURIComponentMinimal(path) {\n let res = undefined;\n for (let pos = 0; pos < path.length; pos++) {\n const code = path.charCodeAt(pos);\n if (code === 35 /* CharCode.Hash */ || code === 63 /* CharCode.QuestionMark */) {\n if (res === undefined) {\n res = path.substr(0, pos);\n }\n res += encodeTable[code];\n }\n else {\n if (res !== undefined) {\n res += path[pos];\n }\n }\n }\n return res !== undefined ? res : path;\n}\n/**\n * Compute `fsPath` for the given uri\n */\nexport function uriToFsPath(uri, keepDriveLetterCasing) {\n let value;\n if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\n // unc path: file://shares/c$/far/boo\n value = `//${uri.authority}${uri.path}`;\n }\n else if (uri.path.charCodeAt(0) === 47 /* CharCode.Slash */\n && (uri.path.charCodeAt(1) >= 65 /* CharCode.A */ && uri.path.charCodeAt(1) <= 90 /* CharCode.Z */ || uri.path.charCodeAt(1) >= 97 /* CharCode.a */ && uri.path.charCodeAt(1) <= 122 /* CharCode.z */)\n && uri.path.charCodeAt(2) === 58 /* CharCode.Colon */) {\n if (!keepDriveLetterCasing) {\n // windows drive letter: file:///c:/far/boo\n value = uri.path[1].toLowerCase() + uri.path.substr(2);\n }\n else {\n value = uri.path.substr(1);\n }\n }\n else {\n // other path\n value = uri.path;\n }\n if (isWindows) {\n value = value.replace(/\\//g, '\\\\');\n }\n return value;\n}\n/**\n * Create the external version of a uri\n */\nfunction _asFormatted(uri, skipEncoding) {\n const encoder = !skipEncoding\n ? encodeURIComponentFast\n : encodeURIComponentMinimal;\n let res = '';\n let { scheme, authority, path, query, fragment } = uri;\n if (scheme) {\n res += scheme;\n res += ':';\n }\n if (authority || scheme === 'file') {\n res += _slash;\n res += _slash;\n }\n if (authority) {\n let idx = authority.indexOf('@');\n if (idx !== -1) {\n // @\n const userinfo = authority.substr(0, idx);\n authority = authority.substr(idx + 1);\n idx = userinfo.lastIndexOf(':');\n if (idx === -1) {\n res += encoder(userinfo, false, false);\n }\n else {\n // :@\n res += encoder(userinfo.substr(0, idx), false, false);\n res += ':';\n res += encoder(userinfo.substr(idx + 1), false, true);\n }\n res += '@';\n }\n authority = authority.toLowerCase();\n idx = authority.lastIndexOf(':');\n if (idx === -1) {\n res += encoder(authority, false, true);\n }\n else {\n // :\n res += encoder(authority.substr(0, idx), false, true);\n res += authority.substr(idx);\n }\n }\n if (path) {\n // lower-case windows drive letters in /C:/fff or C:/fff\n if (path.length >= 3 && path.charCodeAt(0) === 47 /* CharCode.Slash */ && path.charCodeAt(2) === 58 /* CharCode.Colon */) {\n const code = path.charCodeAt(1);\n if (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */) {\n path = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\n }\n }\n else if (path.length >= 2 && path.charCodeAt(1) === 58 /* CharCode.Colon */) {\n const code = path.charCodeAt(0);\n if (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */) {\n path = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\n }\n }\n // encode the rest of the path\n res += encoder(path, true, false);\n }\n if (query) {\n res += '?';\n res += encoder(query, false, false);\n }\n if (fragment) {\n res += '#';\n res += !skipEncoding ? encodeURIComponentFast(fragment, false, false) : fragment;\n }\n return res;\n}\n// --- decode\nfunction decodeURIComponentGraceful(str) {\n try {\n return decodeURIComponent(str);\n }\n catch {\n if (str.length > 3) {\n return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\n }\n else {\n return str;\n }\n }\n}\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\nfunction percentDecode(str) {\n if (!str.match(_rEncodedAsHex)) {\n return str;\n }\n return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\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 *--------------------------------------------------------------------------------------------*/\nimport * as errors from './errors.js';\nimport { toDisposable } from './lifecycle.js';\nimport { ResourceMap } from './map.js';\nimport * as platform from './platform.js';\nimport { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\nexport var Schemas;\n(function (Schemas) {\n /**\n * A schema that is used for models that exist in memory\n * only and that have no correspondence on a server or such.\n */\n Schemas.inMemory = 'inmemory';\n /**\n * A schema that is used for setting files\n */\n Schemas.vscode = 'vscode';\n /**\n * A schema that is used for internal private files\n */\n Schemas.internal = 'private';\n /**\n * A walk-through document.\n */\n Schemas.walkThrough = 'walkThrough';\n /**\n * An embedded code snippet.\n */\n Schemas.walkThroughSnippet = 'walkThroughSnippet';\n Schemas.http = 'http';\n Schemas.https = 'https';\n Schemas.file = 'file';\n Schemas.mailto = 'mailto';\n Schemas.untitled = 'untitled';\n Schemas.data = 'data';\n Schemas.command = 'command';\n Schemas.vscodeRemote = 'vscode-remote';\n Schemas.vscodeRemoteResource = 'vscode-remote-resource';\n Schemas.vscodeManagedRemoteResource = 'vscode-managed-remote-resource';\n Schemas.vscodeUserData = 'vscode-userdata';\n Schemas.vscodeCustomEditor = 'vscode-custom-editor';\n Schemas.vscodeNotebookCell = 'vscode-notebook-cell';\n Schemas.vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\n Schemas.vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\n Schemas.vscodeInteractiveInput = 'vscode-interactive-input';\n Schemas.vscodeSettings = 'vscode-settings';\n Schemas.vscodeWorkspaceTrust = 'vscode-workspace-trust';\n Schemas.vscodeTerminal = 'vscode-terminal';\n Schemas.vscodeChatSesssion = 'vscode-chat-editor';\n /**\n * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)\n */\n Schemas.webviewPanel = 'webview-panel';\n /**\n * Scheme used for loading the wrapper html and script in webviews.\n */\n Schemas.vscodeWebview = 'vscode-webview';\n /**\n * Scheme used for extension pages\n */\n Schemas.extension = 'extension';\n /**\n * Scheme used as a replacement of `file` scheme to load\n * files with our custom protocol handler (desktop only).\n */\n Schemas.vscodeFileResource = 'vscode-file';\n /**\n * Scheme used for temporary resources\n */\n Schemas.tmp = 'tmp';\n /**\n * Scheme used vs live share\n */\n Schemas.vsls = 'vsls';\n /**\n * Scheme used for the Source Control commit input's text document\n */\n Schemas.vscodeSourceControl = 'vscode-scm';\n})(Schemas || (Schemas = {}));\nexport function matchesScheme(target, scheme) {\n if (URI.isUri(target)) {\n return equalsIgnoreCase(target.scheme, scheme);\n }\n else {\n return startsWithIgnoreCase(target, scheme + ':');\n }\n}\nexport function matchesSomeScheme(target, ...schemes) {\n return schemes.some(scheme => matchesScheme(target, scheme));\n}\nexport const connectionTokenCookieName = 'vscode-tkn';\nexport const connectionTokenQueryName = 'tkn';\nclass RemoteAuthoritiesImpl {\n constructor() {\n this._hosts = Object.create(null);\n this._ports = Object.create(null);\n this._connectionTokens = Object.create(null);\n this._preferredWebSchema = 'http';\n this._delegate = null;\n this._remoteResourcesPath = `/${Schemas.vscodeRemoteResource}`;\n }\n setPreferredWebSchema(schema) {\n this._preferredWebSchema = schema;\n }\n setDelegate(delegate) {\n this._delegate = delegate;\n }\n setServerRootPath(serverRootPath) {\n this._remoteResourcesPath = `${serverRootPath}/${Schemas.vscodeRemoteResource}`;\n }\n set(authority, host, port) {\n this._hosts[authority] = host;\n this._ports[authority] = port;\n }\n setConnectionToken(authority, connectionToken) {\n this._connectionTokens[authority] = connectionToken;\n }\n getPreferredWebSchema() {\n return this._preferredWebSchema;\n }\n rewrite(uri) {\n if (this._delegate) {\n try {\n return this._delegate(uri);\n }\n catch (err) {\n errors.onUnexpectedError(err);\n return uri;\n }\n }\n const authority = uri.authority;\n let host = this._hosts[authority];\n if (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {\n host = `[${host}]`;\n }\n const port = this._ports[authority];\n const connectionToken = this._connectionTokens[authority];\n let query = `path=${encodeURIComponent(uri.path)}`;\n if (typeof connectionToken === 'string') {\n query += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;\n }\n return URI.from({\n scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\n authority: `${host}:${port}`,\n path: this._remoteResourcesPath,\n query\n });\n }\n}\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\nexport const builtinExtensionsPath = 'vs/../../extensions';\nexport const nodeModulesPath = 'vs/../../node_modules';\nexport const nodeModulesAsarPath = 'vs/../../node_modules.asar';\nexport const nodeModulesAsarUnpackedPath = 'vs/../../node_modules.asar.unpacked';\nexport const VSCODE_AUTHORITY = 'vscode-app';\nclass FileAccessImpl {\n constructor() {\n this.staticBrowserUris = new ResourceMap();\n this.appResourcePathUrls = new Map();\n }\n registerAppResourcePathUrl(moduleId, url) {\n this.appResourcePathUrls.set(moduleId, url);\n }\n toUrl(moduleId) {\n let url = this.appResourcePathUrls.get(moduleId);\n if (typeof url === 'function') {\n url = url();\n }\n return new URL(url ?? '', globalThis.location?.href ?? import.meta.url).toString();\n }\n /**\n * Returns a URI to use in contexts where the browser is responsible\n * for loading (e.g. fetch()) or when used within the DOM.\n *\n * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n */\n asBrowserUri(resourcePath) {\n const uri = this.toUri(resourcePath, { toUrl: this.toUrl.bind(this) });\n return this.uriToBrowserUri(uri);\n }\n /**\n * Returns a URI to use in contexts where the browser is responsible\n * for loading (e.g. fetch()) or when used within the DOM.\n *\n * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n */\n uriToBrowserUri(uri) {\n // Handle remote URIs via `RemoteAuthorities`\n if (uri.scheme === Schemas.vscodeRemote) {\n return RemoteAuthorities.rewrite(uri);\n }\n // Convert to `vscode-file` resource..\n if (\n // ...only ever for `file` resources\n uri.scheme === Schemas.file &&\n (\n // ...and we run in native environments\n platform.isNative ||\n // ...or web worker extensions on desktop\n (platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`))) {\n return uri.with({\n scheme: Schemas.vscodeFileResource,\n // We need to provide an authority here so that it can serve\n // as origin for network and loading matters in chromium.\n // If the URI is not coming with an authority already, we\n // add our own\n authority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,\n query: null,\n fragment: null\n });\n }\n return this.staticBrowserUris.get(uri) ?? uri;\n }\n /**\n * Returns the `file` URI to use in contexts where node.js\n * is responsible for loading.\n */\n asFileUri(resourcePath) {\n const uri = this.toUri(resourcePath, { toUrl: this.toUrl.bind(this) });\n return this.uriToFileUri(uri);\n }\n /**\n * Returns the `file` URI to use in contexts where node.js\n * is responsible for loading.\n */\n uriToFileUri(uri) {\n // Only convert the URI if it is `vscode-file:` scheme\n if (uri.scheme === Schemas.vscodeFileResource) {\n return uri.with({\n scheme: Schemas.file,\n // Only preserve the `authority` if it is different from\n // our fallback authority. This ensures we properly preserve\n // Windows UNC paths that come with their own authority.\n authority: uri.authority !== FileAccessImpl.FALLBACK_AUTHORITY ? uri.authority : null,\n query: null,\n fragment: null\n });\n }\n return uri;\n }\n toUri(uriOrModule, moduleIdToUrl) {\n if (URI.isUri(uriOrModule)) {\n return uriOrModule;\n }\n return URI.parse(moduleIdToUrl.toUrl(uriOrModule));\n }\n registerStaticBrowserUri(uri, browserUri) {\n this.staticBrowserUris.set(uri, browserUri);\n return toDisposable(() => {\n if (this.staticBrowserUris.get(uri) === browserUri) {\n this.staticBrowserUris.delete(uri);\n }\n });\n }\n getRegisteredBrowserUris() {\n return this.staticBrowserUris.keys();\n }\n}\nFileAccessImpl.FALLBACK_AUTHORITY = VSCODE_AUTHORITY;\nexport const FileAccess = new FileAccessImpl();\nexport var COI;\n(function (COI) {\n const coiHeaders = new Map([\n ['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],\n ['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n ['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n ]);\n COI.CoopAndCoep = Object.freeze(coiHeaders.get('3'));\n const coiSearchParamName = 'vscode-coi';\n /**\n * Extract desired headers from `vscode-coi` invocation\n */\n function getHeadersFromQuery(url) {\n let params;\n if (typeof url === 'string') {\n params = new URL(url).searchParams;\n }\n else if (url instanceof URL) {\n params = url.searchParams;\n }\n else if (URI.isUri(url)) {\n params = new URL(url.toString(true)).searchParams;\n }\n const value = params?.get(coiSearchParamName);\n if (!value) {\n return undefined;\n }\n return coiHeaders.get(value);\n }\n COI.getHeadersFromQuery = getHeadersFromQuery;\n /**\n * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`\n * isn't enabled the current context\n */\n function addSearchParam(urlOrSearch, coop, coep) {\n if (!globalThis.crossOriginIsolated) {\n // depends on the current context being COI\n return;\n }\n const value = coop && coep ? '3' : coep ? '2' : '1';\n if (urlOrSearch instanceof URLSearchParams) {\n urlOrSearch.set(coiSearchParamName, value);\n }\n else {\n urlOrSearch[coiSearchParamName] = value;\n }\n }\n COI.addSearchParam = addSearchParam;\n})(COI || (COI = {}));\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 *--------------------------------------------------------------------------------------------*/\nimport * as extpath from './extpath.js';\nimport { Schemas } from './network.js';\nimport * as paths from './path.js';\nimport { isLinux, isWindows } from './platform.js';\nimport { compare as strCompare, equalsIgnoreCase } from './strings.js';\nimport { URI, uriToFsPath } from './uri.js';\nexport function originalFSPath(uri) {\n return uriToFsPath(uri, true);\n}\nexport class ExtUri {\n constructor(_ignorePathCasing) {\n this._ignorePathCasing = _ignorePathCasing;\n }\n compare(uri1, uri2, ignoreFragment = false) {\n if (uri1 === uri2) {\n return 0;\n }\n return strCompare(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment));\n }\n isEqual(uri1, uri2, ignoreFragment = false) {\n if (uri1 === uri2) {\n return true;\n }\n if (!uri1 || !uri2) {\n return false;\n }\n return this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment);\n }\n getComparisonKey(uri, ignoreFragment = false) {\n return uri.with({\n path: this._ignorePathCasing(uri) ? uri.path.toLowerCase() : undefined,\n fragment: ignoreFragment ? null : undefined\n }).toString();\n }\n ignorePathCasing(uri) {\n return this._ignorePathCasing(uri);\n }\n isEqualOrParent(base, parentCandidate, ignoreFragment = false) {\n if (base.scheme === parentCandidate.scheme) {\n if (base.scheme === Schemas.file) {\n return extpath.isEqualOrParent(originalFSPath(base), originalFSPath(parentCandidate), this._ignorePathCasing(base)) && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);\n }\n if (isEqualAuthority(base.authority, parentCandidate.authority)) {\n return extpath.isEqualOrParent(base.path, parentCandidate.path, this._ignorePathCasing(base), '/') && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);\n }\n }\n return false;\n }\n // --- path math\n joinPath(resource, ...pathFragment) {\n return URI.joinPath(resource, ...pathFragment);\n }\n basenameOrAuthority(resource) {\n return basename(resource) || resource.authority;\n }\n basename(resource) {\n return paths.posix.basename(resource.path);\n }\n extname(resource) {\n return paths.posix.extname(resource.path);\n }\n dirname(resource) {\n if (resource.path.length === 0) {\n return resource;\n }\n let dirname;\n if (resource.scheme === Schemas.file) {\n dirname = URI.file(paths.dirname(originalFSPath(resource))).path;\n }\n else {\n dirname = paths.posix.dirname(resource.path);\n if (resource.authority && dirname.length && dirname.charCodeAt(0) !== 47 /* CharCode.Slash */) {\n console.error(`dirname(\"${resource.toString})) resulted in a relative path`);\n dirname = '/'; // If a URI contains an authority component, then the path component must either be empty or begin with a CharCode.Slash (\"/\") character\n }\n }\n return resource.with({\n path: dirname\n });\n }\n normalizePath(resource) {\n if (!resource.path.length) {\n return resource;\n }\n let normalizedPath;\n if (resource.scheme === Schemas.file) {\n normalizedPath = URI.file(paths.normalize(originalFSPath(resource))).path;\n }\n else {\n normalizedPath = paths.posix.normalize(resource.path);\n }\n return resource.with({\n path: normalizedPath\n });\n }\n relativePath(from, to) {\n if (from.scheme !== to.scheme || !isEqualAuthority(from.authority, to.authority)) {\n return undefined;\n }\n if (from.scheme === Schemas.file) {\n const relativePath = paths.relative(originalFSPath(from), originalFSPath(to));\n return isWindows ? extpath.toSlashes(relativePath) : relativePath;\n }\n let fromPath = from.path || '/';\n const toPath = to.path || '/';\n if (this._ignorePathCasing(from)) {\n // make casing of fromPath match toPath\n let i = 0;\n for (const len = Math.min(fromPath.length, toPath.length); i < len; i++) {\n if (fromPath.charCodeAt(i) !== toPath.charCodeAt(i)) {\n if (fromPath.charAt(i).toLowerCase() !== toPath.charAt(i).toLowerCase()) {\n break;\n }\n }\n }\n fromPath = toPath.substr(0, i) + fromPath.substr(i);\n }\n return paths.posix.relative(fromPath, toPath);\n }\n resolvePath(base, path) {\n if (base.scheme === Schemas.file) {\n const newURI = URI.file(paths.resolve(originalFSPath(base), path));\n return base.with({\n authority: newURI.authority,\n path: newURI.path\n });\n }\n path = extpath.toPosixPath(path); // we allow path to be a windows path\n return base.with({\n path: paths.posix.resolve(base.path, path)\n });\n }\n // --- misc\n isAbsolutePath(resource) {\n return !!resource.path && resource.path[0] === '/';\n }\n isEqualAuthority(a1, a2) {\n return a1 === a2 || (a1 !== undefined && a2 !== undefined && equalsIgnoreCase(a1, a2));\n }\n hasTrailingPathSeparator(resource, sep = paths.sep) {\n if (resource.scheme === Schemas.file) {\n const fsp = originalFSPath(resource);\n return fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep;\n }\n else {\n const p = resource.path;\n return (p.length > 1 && p.charCodeAt(p.length - 1) === 47 /* CharCode.Slash */) && !(/^[a-zA-Z]:(\\/$|\\\\$)/.test(resource.fsPath)); // ignore the slash at offset 0\n }\n }\n removeTrailingPathSeparator(resource, sep = paths.sep) {\n // Make sure that the path isn't a drive letter. A trailing separator there is not removable.\n if (hasTrailingPathSeparator(resource, sep)) {\n return resource.with({ path: resource.path.substr(0, resource.path.length - 1) });\n }\n return resource;\n }\n addTrailingPathSeparator(resource, sep = paths.sep) {\n let isRootSep = false;\n if (resource.scheme === Schemas.file) {\n const fsp = originalFSPath(resource);\n isRootSep = ((fsp !== undefined) && (fsp.length === extpath.getRoot(fsp).length) && (fsp[fsp.length - 1] === sep));\n }\n else {\n sep = '/';\n const p = resource.path;\n isRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === 47 /* CharCode.Slash */;\n }\n if (!isRootSep && !hasTrailingPathSeparator(resource, sep)) {\n return resource.with({ path: resource.path + '/' });\n }\n return resource;\n }\n}\n/**\n * Unbiased utility that takes uris \"as they are\". This means it can be interchanged with\n * uri#toString() usages. The following is true\n * ```\n * assertEqual(aUri.toString() === bUri.toString(), exturi.isEqual(aUri, bUri))\n * ```\n */\nexport const extUri = new ExtUri(() => false);\n/**\n * BIASED utility that _mostly_ ignored the case of urs paths. ONLY use this util if you\n * understand what you are doing.\n *\n * This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged.\n *\n * When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient\n * because those uris come from a \"trustworthy source\". When creating unknown uris it's always\n * better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path\n * casing matters.\n */\nexport const extUriBiasedIgnorePathCase = new ExtUri(uri => {\n // A file scheme resource is in the same platform as code, so ignore case for non linux platforms\n // Resource can be from another platform. Lowering the case as an hack. Should come from File system provider\n return uri.scheme === Schemas.file ? !isLinux : true;\n});\n/**\n * BIASED utility that always ignores the casing of uris paths. ONLY use this util if you\n * understand what you are doing.\n *\n * This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged.\n *\n * When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient\n * because those uris come from a \"trustworthy source\". When creating unknown uris it's always\n * better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path\n * casing matters.\n */\nexport const extUriIgnorePathCase = new ExtUri(_ => true);\nexport const isEqual = extUri.isEqual.bind(extUri);\nexport const isEqualOrParent = extUri.isEqualOrParent.bind(extUri);\nexport const getComparisonKey = extUri.getComparisonKey.bind(extUri);\nexport const basenameOrAuthority = extUri.basenameOrAuthority.bind(extUri);\nexport const basename = extUri.basename.bind(extUri);\nexport const extname = extUri.extname.bind(extUri);\nexport const dirname = extUri.dirname.bind(extUri);\nexport const joinPath = extUri.joinPath.bind(extUri);\nexport const normalizePath = extUri.normalizePath.bind(extUri);\nexport const relativePath = extUri.relativePath.bind(extUri);\nexport const resolvePath = extUri.resolvePath.bind(extUri);\nexport const isAbsolutePath = extUri.isAbsolutePath.bind(extUri);\nexport const isEqualAuthority = extUri.isEqualAuthority.bind(extUri);\nexport const hasTrailingPathSeparator = extUri.hasTrailingPathSeparator.bind(extUri);\nexport const removeTrailingPathSeparator = extUri.removeTrailingPathSeparator.bind(extUri);\nexport const addTrailingPathSeparator = extUri.addTrailingPathSeparator.bind(extUri);\n//#endregion\nexport function distinctParents(items, resourceAccessor) {\n const distinctParents = [];\n for (let i = 0; i < items.length; i++) {\n const candidateResource = resourceAccessor(items[i]);\n if (items.some((otherItem, index) => {\n if (index === i) {\n return false;\n }\n return isEqualOrParent(candidateResource, resourceAccessor(otherItem));\n })) {\n continue;\n }\n distinctParents.push(items[i]);\n }\n return distinctParents;\n}\n/**\n * Data URI related helpers.\n */\nexport var DataUri;\n(function (DataUri) {\n DataUri.META_DATA_LABEL = 'label';\n DataUri.META_DATA_DESCRIPTION = 'description';\n DataUri.META_DATA_SIZE = 'size';\n DataUri.META_DATA_MIME = 'mime';\n function parseMetaData(dataUri) {\n const metadata = new Map();\n // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\n // the metadata is: size:2313;label:SomeLabel;description:SomeDescription\n const meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';'));\n meta.split(';').forEach(property => {\n const [key, value] = property.split(':');\n if (key && value) {\n metadata.set(key, value);\n }\n });\n // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\n // the mime is: image/png\n const mime = dataUri.path.substring(0, dataUri.path.indexOf(';'));\n if (mime) {\n metadata.set(DataUri.META_DATA_MIME, mime);\n }\n return metadata;\n }\n DataUri.parseMetaData = parseMetaData;\n})(DataUri || (DataUri = {}));\nexport function toLocalResource(resource, authority, localScheme) {\n if (authority) {\n let path = resource.path;\n if (path && path[0] !== paths.posix.sep) {\n path = paths.posix.sep + path;\n }\n return resource.with({ scheme: localScheme, authority, path });\n }\n return resource.with({ scheme: localScheme });\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/**\n * Can be passed into the Delayed to defer using a microtask\n * */\nexport const MicrotaskDelay = Symbol('MicrotaskDelay');\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 *--------------------------------------------------------------------------------------------*/\nimport { CancellationTokenSource } from './cancellation.js';\nimport { BugIndicatingError, CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { Disposable, DisposableMap, MutableDisposable, toDisposable } from './lifecycle.js';\nimport { extUri as defaultExtUri } from './resources.js';\nimport { setTimeout0 } from './platform.js';\nimport { MicrotaskDelay } from './symbols.js';\nimport { Lazy } from './lazy.js';\nexport function isThenable(obj) {\n return !!obj && typeof obj.then === 'function';\n}\nexport function createCancelablePromise(callback) {\n const source = new CancellationTokenSource();\n const thenable = callback(source.token);\n const promise = new Promise((resolve, reject) => {\n const subscription = source.token.onCancellationRequested(() => {\n subscription.dispose();\n source.dispose();\n reject(new CancellationError());\n });\n Promise.resolve(thenable).then(value => {\n subscription.dispose();\n source.dispose();\n resolve(value);\n }, err => {\n subscription.dispose();\n source.dispose();\n reject(err);\n });\n });\n return new class {\n cancel() {\n source.cancel();\n }\n then(resolve, reject) {\n return promise.then(resolve, reject);\n }\n catch(reject) {\n return this.then(undefined, reject);\n }\n finally(onfinally) {\n return promise.finally(onfinally);\n }\n };\n}\nexport function raceCancellation(promise, token, defaultValue) {\n return new Promise((resolve, reject) => {\n const ref = token.onCancellationRequested(() => {\n ref.dispose();\n resolve(defaultValue);\n });\n promise.then(resolve, reject).finally(() => ref.dispose());\n });\n}\n/**\n * Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled.\n * @see {@link raceCancellation}\n */\nexport function raceCancellationError(promise, token) {\n return new Promise((resolve, reject) => {\n const ref = token.onCancellationRequested(() => {\n ref.dispose();\n reject(new CancellationError());\n });\n promise.then(resolve, reject).finally(() => ref.dispose());\n });\n}\n/**\n * Returns as soon as one of the promises resolves or rejects and cancels remaining promises\n */\nexport async function raceCancellablePromises(cancellablePromises) {\n let resolvedPromiseIndex = -1;\n const promises = cancellablePromises.map((promise, index) => promise.then(result => { resolvedPromiseIndex = index; return result; }));\n try {\n const result = await Promise.race(promises);\n return result;\n }\n finally {\n cancellablePromises.forEach((cancellablePromise, index) => {\n if (index !== resolvedPromiseIndex) {\n cancellablePromise.cancel();\n }\n });\n }\n}\nexport function raceTimeout(promise, timeout, onTimeout) {\n let promiseResolve = undefined;\n const timer = setTimeout(() => {\n promiseResolve?.(undefined);\n onTimeout?.();\n }, timeout);\n return Promise.race([\n promise.finally(() => clearTimeout(timer)),\n new Promise(resolve => promiseResolve = resolve)\n ]);\n}\nexport function asPromise(callback) {\n return new Promise((resolve, reject) => {\n const item = callback();\n if (isThenable(item)) {\n item.then(resolve, reject);\n }\n else {\n resolve(item);\n }\n });\n}\n/**\n * A helper to prevent accumulation of sequential async tasks.\n *\n * Imagine a mail man with the sole task of delivering letters. As soon as\n * a letter submitted for delivery, he drives to the destination, delivers it\n * and returns to his base. Imagine that during the trip, N more letters were submitted.\n * When the mail man returns, he picks those N letters and delivers them all in a\n * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.\n *\n * The throttler implements this via the queue() method, by providing it a task\n * factory. Following the example:\n *\n * \t\tconst throttler = new Throttler();\n * \t\tconst letters = [];\n *\n * \t\tfunction deliver() {\n * \t\t\tconst lettersToDeliver = letters;\n * \t\t\tletters = [];\n * \t\t\treturn makeTheTrip(lettersToDeliver);\n * \t\t}\n *\n * \t\tfunction onLetterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tthrottler.queue(deliver);\n * \t\t}\n */\nexport class Throttler {\n constructor() {\n this.isDisposed = false;\n this.activePromise = null;\n this.queuedPromise = null;\n this.queuedPromiseFactory = null;\n }\n queue(promiseFactory) {\n if (this.isDisposed) {\n return Promise.reject(new Error('Throttler is disposed'));\n }\n if (this.activePromise) {\n this.queuedPromiseFactory = promiseFactory;\n if (!this.queuedPromise) {\n const onComplete = () => {\n this.queuedPromise = null;\n if (this.isDisposed) {\n return;\n }\n const result = this.queue(this.queuedPromiseFactory);\n this.queuedPromiseFactory = null;\n return result;\n };\n this.queuedPromise = new Promise(resolve => {\n this.activePromise.then(onComplete, onComplete).then(resolve);\n });\n }\n return new Promise((resolve, reject) => {\n this.queuedPromise.then(resolve, reject);\n });\n }\n this.activePromise = promiseFactory();\n return new Promise((resolve, reject) => {\n this.activePromise.then((result) => {\n this.activePromise = null;\n resolve(result);\n }, (err) => {\n this.activePromise = null;\n reject(err);\n });\n });\n }\n dispose() {\n this.isDisposed = true;\n }\n}\nexport class Sequencer {\n constructor() {\n this.current = Promise.resolve(null);\n }\n queue(promiseTask) {\n return this.current = this.current.then(() => promiseTask(), () => promiseTask());\n }\n}\nexport class SequencerByKey {\n constructor() {\n this.promiseMap = new Map();\n }\n queue(key, promiseTask) {\n const runningPromise = this.promiseMap.get(key) ?? Promise.resolve();\n const newPromise = runningPromise\n .catch(() => { })\n .then(promiseTask)\n .finally(() => {\n if (this.promiseMap.get(key) === newPromise) {\n this.promiseMap.delete(key);\n }\n });\n this.promiseMap.set(key, newPromise);\n return newPromise;\n }\n}\nconst timeoutDeferred = (timeout, fn) => {\n let scheduled = true;\n const handle = setTimeout(() => {\n scheduled = false;\n fn();\n }, timeout);\n return {\n isTriggered: () => scheduled,\n dispose: () => {\n clearTimeout(handle);\n scheduled = false;\n },\n };\n};\nconst microtaskDeferred = (fn) => {\n let scheduled = true;\n queueMicrotask(() => {\n if (scheduled) {\n scheduled = false;\n fn();\n }\n });\n return {\n isTriggered: () => scheduled,\n dispose: () => { scheduled = false; },\n };\n};\n/**\n * A helper to delay (debounce) execution of a task that is being requested often.\n *\n * Following the throttler, now imagine the mail man wants to optimize the number of\n * trips proactively. The trip itself can be long, so he decides not to make the trip\n * as soon as a letter is submitted. Instead he waits a while, in case more\n * letters are submitted. After said waiting period, if no letters were submitted, he\n * decides to make the trip. Imagine that N more letters were submitted after the first\n * one, all within a short period of time between each other. Even though N+1\n * submissions occurred, only 1 delivery was made.\n *\n * The delayer offers this behavior via the trigger() method, into which both the task\n * to be executed and the waiting period (delay) must be passed in as arguments. Following\n * the example:\n *\n * \t\tconst delayer = new Delayer(WAITING_PERIOD);\n * \t\tconst letters = [];\n *\n * \t\tfunction letterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tdelayer.trigger(() => { return makeTheTrip(); });\n * \t\t}\n */\nexport class Delayer {\n constructor(defaultDelay) {\n this.defaultDelay = defaultDelay;\n this.deferred = null;\n this.completionPromise = null;\n this.doResolve = null;\n this.doReject = null;\n this.task = null;\n }\n trigger(task, delay = this.defaultDelay) {\n this.task = task;\n this.cancelTimeout();\n if (!this.completionPromise) {\n this.completionPromise = new Promise((resolve, reject) => {\n this.doResolve = resolve;\n this.doReject = reject;\n }).then(() => {\n this.completionPromise = null;\n this.doResolve = null;\n if (this.task) {\n const task = this.task;\n this.task = null;\n return task();\n }\n return undefined;\n });\n }\n const fn = () => {\n this.deferred = null;\n this.doResolve?.(null);\n };\n this.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);\n return this.completionPromise;\n }\n isTriggered() {\n return !!this.deferred?.isTriggered();\n }\n cancel() {\n this.cancelTimeout();\n if (this.completionPromise) {\n this.doReject?.(new CancellationError());\n this.completionPromise = null;\n }\n }\n cancelTimeout() {\n this.deferred?.dispose();\n this.deferred = null;\n }\n dispose() {\n this.cancel();\n }\n}\n/**\n * A helper to delay execution of a task that is being requested often, while\n * preventing accumulation of consecutive executions, while the task runs.\n *\n * The mail man is clever and waits for a certain amount of time, before going\n * out to deliver letters. While the mail man is going out, more letters arrive\n * and can only be delivered once he is back. Once he is back the mail man will\n * do one more trip to deliver the letters that have accumulated while he was out.\n */\nexport class ThrottledDelayer {\n constructor(defaultDelay) {\n this.delayer = new Delayer(defaultDelay);\n this.throttler = new Throttler();\n }\n trigger(promiseFactory, delay) {\n return this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay);\n }\n isTriggered() {\n return this.delayer.isTriggered();\n }\n cancel() {\n this.delayer.cancel();\n }\n dispose() {\n this.delayer.dispose();\n this.throttler.dispose();\n }\n}\n/**\n * A barrier that is initially closed and then becomes opened permanently.\n */\nexport class Barrier {\n constructor() {\n this._isOpen = false;\n this._promise = new Promise((c, e) => {\n this._completePromise = c;\n });\n }\n isOpen() {\n return this._isOpen;\n }\n open() {\n this._isOpen = true;\n this._completePromise(true);\n }\n wait() {\n return this._promise;\n }\n}\n/**\n * A barrier that is initially closed and then becomes opened permanently after a certain period of\n * time or when open is called explicitly\n */\nexport class AutoOpenBarrier extends Barrier {\n constructor(autoOpenTimeMs) {\n super();\n this._timeout = setTimeout(() => this.open(), autoOpenTimeMs);\n }\n open() {\n clearTimeout(this._timeout);\n super.open();\n }\n}\nexport function timeout(millis, token) {\n if (!token) {\n return createCancelablePromise(token => timeout(millis, token));\n }\n return new Promise((resolve, reject) => {\n const handle = setTimeout(() => {\n disposable.dispose();\n resolve();\n }, millis);\n const disposable = token.onCancellationRequested(() => {\n clearTimeout(handle);\n disposable.dispose();\n reject(new CancellationError());\n });\n });\n}\n/**\n * Creates a timeout that can be disposed using its returned value.\n * @param handler The timeout handler.\n * @param timeout An optional timeout in milliseconds.\n * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.\n *\n * @example\n * const store = new DisposableStore;\n * // Call the timeout after 1000ms at which point it will be automatically\n * // evicted from the store.\n * const timeoutDisposable = disposableTimeout(() => {}, 1000, store);\n *\n * if (foo) {\n * // Cancel the timeout and evict it from store.\n * timeoutDisposable.dispose();\n * }\n */\nexport function disposableTimeout(handler, timeout = 0, store) {\n const timer = setTimeout(() => {\n handler();\n if (store) {\n disposable.dispose();\n }\n }, timeout);\n const disposable = toDisposable(() => {\n clearTimeout(timer);\n store?.deleteAndLeak(disposable);\n });\n store?.add(disposable);\n return disposable;\n}\n/**\n * Runs the provided list of promise factories in sequential order. The returned\n * promise will complete to an array of results from each promise.\n */\nexport function sequence(promiseFactories) {\n const results = [];\n let index = 0;\n const len = promiseFactories.length;\n function next() {\n return index < len ? promiseFactories[index++]() : null;\n }\n function thenHandler(result) {\n if (result !== undefined && result !== null) {\n results.push(result);\n }\n const n = next();\n if (n) {\n return n.then(thenHandler);\n }\n return Promise.resolve(results);\n }\n return Promise.resolve(null).then(thenHandler);\n}\nexport function first(promiseFactories, shouldStop = t => !!t, defaultValue = null) {\n let index = 0;\n const len = promiseFactories.length;\n const loop = () => {\n if (index >= len) {\n return Promise.resolve(defaultValue);\n }\n const factory = promiseFactories[index++];\n const promise = Promise.resolve(factory());\n return promise.then(result => {\n if (shouldStop(result)) {\n return Promise.resolve(result);\n }\n return loop();\n });\n };\n return loop();\n}\nexport function firstParallel(promiseList, shouldStop = t => !!t, defaultValue = null) {\n if (promiseList.length === 0) {\n return Promise.resolve(defaultValue);\n }\n let todo = promiseList.length;\n const finish = () => {\n todo = -1;\n for (const promise of promiseList) {\n promise.cancel?.();\n }\n };\n return new Promise((resolve, reject) => {\n for (const promise of promiseList) {\n promise.then(result => {\n if (--todo >= 0 && shouldStop(result)) {\n finish();\n resolve(result);\n }\n else if (todo === 0) {\n resolve(defaultValue);\n }\n })\n .catch(err => {\n if (--todo >= 0) {\n finish();\n reject(err);\n }\n });\n }\n });\n}\n/**\n * A helper to queue N promises and run them all with a max degree of parallelism. The helper\n * ensures that at any time no more than M promises are running at the same time.\n */\nexport class Limiter {\n constructor(maxDegreeOfParalellism) {\n this._size = 0;\n this.maxDegreeOfParalellism = maxDegreeOfParalellism;\n this.outstandingPromises = [];\n this.runningPromises = 0;\n this._onDrained = new Emitter();\n }\n /**\n * An event that fires when every promise in the queue\n * has started to execute. In other words: no work is\n * pending to be scheduled.\n *\n * This is NOT an event that signals when all promises\n * have finished though.\n */\n get onDrained() {\n return this._onDrained.event;\n }\n get size() {\n return this._size;\n }\n queue(factory) {\n this._size++;\n return new Promise((c, e) => {\n this.outstandingPromises.push({ factory, c, e });\n this.consume();\n });\n }\n consume() {\n while (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {\n const iLimitedTask = this.outstandingPromises.shift();\n this.runningPromises++;\n const promise = iLimitedTask.factory();\n promise.then(iLimitedTask.c, iLimitedTask.e);\n promise.then(() => this.consumed(), () => this.consumed());\n }\n }\n consumed() {\n this._size--;\n this.runningPromises--;\n if (this.outstandingPromises.length > 0) {\n this.consume();\n }\n else {\n this._onDrained.fire();\n }\n }\n dispose() {\n this._onDrained.dispose();\n }\n}\n/**\n * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.\n */\nexport class Queue extends Limiter {\n constructor() {\n super(1);\n }\n}\n/**\n * Same as `Queue`, ensures that only 1 task is executed at the same time. The difference to `Queue` is that\n * there is only 1 task about to be scheduled next. As such, calling `queue` while a task is executing will\n * replace the currently queued task until it executes.\n *\n * As such, the returned promise may not be from the factory that is passed in but from the next factory that\n * is running after having called `queue`.\n */\nexport class LimitedQueue {\n constructor() {\n this.sequentializer = new TaskSequentializer();\n this.tasks = 0;\n }\n queue(factory) {\n if (!this.sequentializer.isRunning()) {\n return this.sequentializer.run(this.tasks++, factory());\n }\n return this.sequentializer.queue(() => {\n return this.sequentializer.run(this.tasks++, factory());\n });\n }\n}\n/**\n * A helper to organize queues per resource. The ResourceQueue makes sure to manage queues per resource\n * by disposing them once the queue is empty.\n */\nexport class ResourceQueue {\n constructor() {\n this.queues = new Map();\n this.drainers = new Set();\n this.drainListeners = undefined;\n this.drainListenerCount = 0;\n }\n async whenDrained() {\n if (this.isDrained()) {\n return;\n }\n const promise = new DeferredPromise();\n this.drainers.add(promise);\n return promise.p;\n }\n isDrained() {\n for (const [, queue] of this.queues) {\n if (queue.size > 0) {\n return false;\n }\n }\n return true;\n }\n queueFor(resource, extUri = defaultExtUri) {\n const key = extUri.getComparisonKey(resource);\n let queue = this.queues.get(key);\n if (!queue) {\n queue = new Queue();\n const drainListenerId = this.drainListenerCount++;\n const drainListener = Event.once(queue.onDrained)(() => {\n queue?.dispose();\n this.queues.delete(key);\n this.onDidQueueDrain();\n this.drainListeners?.deleteAndDispose(drainListenerId);\n if (this.drainListeners?.size === 0) {\n this.drainListeners.dispose();\n this.drainListeners = undefined;\n }\n });\n if (!this.drainListeners) {\n this.drainListeners = new DisposableMap();\n }\n this.drainListeners.set(drainListenerId, drainListener);\n this.queues.set(key, queue);\n }\n return queue;\n }\n onDidQueueDrain() {\n if (!this.isDrained()) {\n return; // not done yet\n }\n this.releaseDrainers();\n }\n releaseDrainers() {\n for (const drainer of this.drainers) {\n drainer.complete();\n }\n this.drainers.clear();\n }\n dispose() {\n for (const [, queue] of this.queues) {\n queue.dispose();\n }\n this.queues.clear();\n // Even though we might still have pending\n // tasks queued, after the queues have been\n // disposed, we can no longer track them, so\n // we release drainers to prevent hanging\n // promises when the resource queue is being\n // disposed.\n this.releaseDrainers();\n this.drainListeners?.dispose();\n }\n}\nexport class TimeoutTimer {\n constructor(runner, timeout) {\n this._token = -1;\n if (typeof runner === 'function' && typeof timeout === 'number') {\n this.setIfNotSet(runner, timeout);\n }\n }\n dispose() {\n this.cancel();\n }\n cancel() {\n if (this._token !== -1) {\n clearTimeout(this._token);\n this._token = -1;\n }\n }\n cancelAndSet(runner, timeout) {\n this.cancel();\n this._token = setTimeout(() => {\n this._token = -1;\n runner();\n }, timeout);\n }\n setIfNotSet(runner, timeout) {\n if (this._token !== -1) {\n // timer is already set\n return;\n }\n this._token = setTimeout(() => {\n this._token = -1;\n runner();\n }, timeout);\n }\n}\nexport class IntervalTimer {\n constructor() {\n this.disposable = undefined;\n }\n cancel() {\n this.disposable?.dispose();\n this.disposable = undefined;\n }\n cancelAndSet(runner, interval, context = globalThis) {\n this.cancel();\n const handle = context.setInterval(() => {\n runner();\n }, interval);\n this.disposable = toDisposable(() => {\n context.clearInterval(handle);\n this.disposable = undefined;\n });\n }\n dispose() {\n this.cancel();\n }\n}\nexport class RunOnceScheduler {\n constructor(runner, delay) {\n this.timeoutToken = -1;\n this.runner = runner;\n this.timeout = delay;\n this.timeoutHandler = this.onTimeout.bind(this);\n }\n /**\n * Dispose RunOnceScheduler\n */\n dispose() {\n this.cancel();\n this.runner = null;\n }\n /**\n * Cancel current scheduled runner (if any).\n */\n cancel() {\n if (this.isScheduled()) {\n clearTimeout(this.timeoutToken);\n this.timeoutToken = -1;\n }\n }\n /**\n * Cancel previous runner (if any) & schedule a new runner.\n */\n schedule(delay = this.timeout) {\n this.cancel();\n this.timeoutToken = setTimeout(this.timeoutHandler, delay);\n }\n get delay() {\n return this.timeout;\n }\n set delay(value) {\n this.timeout = value;\n }\n /**\n * Returns true if scheduled.\n */\n isScheduled() {\n return this.timeoutToken !== -1;\n }\n flush() {\n if (this.isScheduled()) {\n this.cancel();\n this.doRun();\n }\n }\n onTimeout() {\n this.timeoutToken = -1;\n if (this.runner) {\n this.doRun();\n }\n }\n doRun() {\n this.runner?.();\n }\n}\n/**\n * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.\n * > **NOTE**: Only offers 1s resolution.\n *\n * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep\n * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But\n * this scheduler will execute 3hrs **after waking the computer from sleep**.\n */\nexport class ProcessTimeRunOnceScheduler {\n constructor(runner, delay) {\n if (delay % 1000 !== 0) {\n console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n }\n this.runner = runner;\n this.timeout = delay;\n this.counter = 0;\n this.intervalToken = -1;\n this.intervalHandler = this.onInterval.bind(this);\n }\n dispose() {\n this.cancel();\n this.runner = null;\n }\n cancel() {\n if (this.isScheduled()) {\n clearInterval(this.intervalToken);\n this.intervalToken = -1;\n }\n }\n /**\n * Cancel previous runner (if any) & schedule a new runner.\n */\n schedule(delay = this.timeout) {\n if (delay % 1000 !== 0) {\n console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n }\n this.cancel();\n this.counter = Math.ceil(delay / 1000);\n this.intervalToken = setInterval(this.intervalHandler, 1000);\n }\n /**\n * Returns true if scheduled.\n */\n isScheduled() {\n return this.intervalToken !== -1;\n }\n onInterval() {\n this.counter--;\n if (this.counter > 0) {\n // still need to wait\n return;\n }\n // time elapsed\n clearInterval(this.intervalToken);\n this.intervalToken = -1;\n this.runner?.();\n }\n}\nexport class RunOnceWorker extends RunOnceScheduler {\n constructor(runner, timeout) {\n super(runner, timeout);\n this.units = [];\n }\n work(unit) {\n this.units.push(unit);\n if (!this.isScheduled()) {\n this.schedule();\n }\n }\n doRun() {\n const units = this.units;\n this.units = [];\n this.runner?.(units);\n }\n dispose() {\n this.units = [];\n super.dispose();\n }\n}\n/**\n * The `ThrottledWorker` will accept units of work `T`\n * to handle. The contract is:\n * * there is a maximum of units the worker can handle at once (via `maxWorkChunkSize`)\n * * there is a maximum of units the worker will keep in memory for processing (via `maxBufferedWork`)\n * * after having handled `maxWorkChunkSize` units, the worker needs to rest (via `throttleDelay`)\n */\nexport class ThrottledWorker extends Disposable {\n constructor(options, handler) {\n super();\n this.options = options;\n this.handler = handler;\n this.pendingWork = [];\n this.throttler = this._register(new MutableDisposable());\n this.disposed = false;\n }\n /**\n * The number of work units that are pending to be processed.\n */\n get pending() { return this.pendingWork.length; }\n /**\n * Add units to be worked on. Use `pending` to figure out\n * how many units are not yet processed after this method\n * was called.\n *\n * @returns whether the work was accepted or not. If the\n * worker is disposed, it will not accept any more work.\n * If the number of pending units would become larger\n * than `maxPendingWork`, more work will also not be accepted.\n */\n work(units) {\n if (this.disposed) {\n return false; // work not accepted: disposed\n }\n // Check for reaching maximum of pending work\n if (typeof this.options.maxBufferedWork === 'number') {\n // Throttled: simple check if pending + units exceeds max pending\n if (this.throttler.value) {\n if (this.pending + units.length > this.options.maxBufferedWork) {\n return false; // work not accepted: too much pending work\n }\n }\n // Unthrottled: same as throttled, but account for max chunk getting\n // worked on directly without being pending\n else {\n if (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {\n return false; // work not accepted: too much pending work\n }\n }\n }\n // Add to pending units first\n for (const unit of units) {\n this.pendingWork.push(unit);\n }\n // If not throttled, start working directly\n // Otherwise, when the throttle delay has\n // past, pending work will be worked again.\n if (!this.throttler.value) {\n this.doWork();\n }\n return true; // work accepted\n }\n doWork() {\n // Extract chunk to handle and handle it\n this.handler(this.pendingWork.splice(0, this.options.maxWorkChunkSize));\n // If we have remaining work, schedule it after a delay\n if (this.pendingWork.length > 0) {\n this.throttler.value = new RunOnceScheduler(() => {\n this.throttler.clear();\n this.doWork();\n }, this.options.throttleDelay);\n this.throttler.value.schedule();\n }\n }\n dispose() {\n super.dispose();\n this.disposed = true;\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 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 *\n * **Note** that there is `dom.ts#runWhenWindowIdle` which is better suited when running inside a browser\n * context\n */\nexport let runWhenGlobalIdle;\nexport let _runWhenIdle;\n(function () {\n if (typeof globalThis.requestIdleCallback !== 'function' || typeof globalThis.cancelIdleCallback !== 'function') {\n _runWhenIdle = (_targetWindow, runner) => {\n setTimeout0(() => {\n if (disposed) {\n return;\n }\n const end = Date.now() + 15; // one frame at 64fps\n const deadline = {\n didTimeout: true,\n timeRemaining() {\n return Math.max(0, end - Date.now());\n }\n };\n runner(Object.freeze(deadline));\n });\n let disposed = false;\n return {\n dispose() {\n if (disposed) {\n return;\n }\n disposed = true;\n }\n };\n };\n }\n else {\n _runWhenIdle = (targetWindow, runner, timeout) => {\n const handle = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\n let disposed = false;\n return {\n dispose() {\n if (disposed) {\n return;\n }\n disposed = true;\n targetWindow.cancelIdleCallback(handle);\n }\n };\n };\n }\n runWhenGlobalIdle = (runner) => _runWhenIdle(globalThis, runner);\n})();\nexport class AbstractIdleValue {\n constructor(targetWindow, executor) {\n this._didRun = false;\n this._executor = () => {\n try {\n this._value = executor();\n }\n catch (err) {\n this._error = err;\n }\n finally {\n this._didRun = true;\n }\n };\n this._handle = _runWhenIdle(targetWindow, () => this._executor());\n }\n dispose() {\n this._handle.dispose();\n }\n get value() {\n if (!this._didRun) {\n this._handle.dispose();\n this._executor();\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n get isInitialized() {\n return this._didRun;\n }\n}\n/**\n * An `IdleValue` that always uses the current window (which might be throttled or inactive)\n *\n * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser\n * context\n */\nexport class GlobalIdleValue extends AbstractIdleValue {\n constructor(executor) {\n super(globalThis, executor);\n }\n}\n//#endregion\nexport async function retry(task, delay, retries) {\n let lastError;\n for (let i = 0; i < retries; i++) {\n try {\n return await task();\n }\n catch (error) {\n lastError = error;\n await timeout(delay);\n }\n }\n throw lastError;\n}\n/**\n * @deprecated use `LimitedQueue` instead for an easier to use API\n */\nexport class TaskSequentializer {\n isRunning(taskId) {\n if (typeof taskId === 'number') {\n return this._running?.taskId === taskId;\n }\n return !!this._running;\n }\n get running() {\n return this._running?.promise;\n }\n cancelRunning() {\n this._running?.cancel();\n }\n run(taskId, promise, onCancel) {\n this._running = { taskId, cancel: () => onCancel?.(), promise };\n promise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));\n return promise;\n }\n doneRunning(taskId) {\n if (this._running && taskId === this._running.taskId) {\n // only set running to done if the promise finished that is associated with that taskId\n this._running = undefined;\n // schedule the queued task now that we are free if we have any\n this.runQueued();\n }\n }\n runQueued() {\n if (this._queued) {\n const queued = this._queued;\n this._queued = undefined;\n // Run queued task and complete on the associated promise\n queued.run().then(queued.promiseResolve, queued.promiseReject);\n }\n }\n /**\n * Note: the promise to schedule as next run MUST itself call `run`.\n * Otherwise, this sequentializer will report `false` for `isRunning`\n * even when this task is running. Missing this detail means that\n * suddenly multiple tasks will run in parallel.\n */\n queue(run) {\n // this is our first queued task, so we create associated promise with it\n // so that we can return a promise that completes when the task has\n // completed.\n if (!this._queued) {\n let promiseResolve;\n let promiseReject;\n const promise = new Promise((resolve, reject) => {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n this._queued = {\n run,\n promise,\n promiseResolve: promiseResolve,\n promiseReject: promiseReject\n };\n }\n // we have a previous queued task, just overwrite it\n else {\n this._queued.run = run;\n }\n return this._queued.promise;\n }\n hasQueued() {\n return !!this._queued;\n }\n async join() {\n return this._queued?.promise ?? this._running?.promise;\n }\n}\n//#endregion\n//#region\n/**\n * The `IntervalCounter` allows to count the number\n * of calls to `increment()` over a duration of\n * `interval`. This utility can be used to conditionally\n * throttle a frequent task when a certain threshold\n * is reached.\n */\nexport class IntervalCounter {\n constructor(interval, nowFn = () => Date.now()) {\n this.interval = interval;\n this.nowFn = nowFn;\n this.lastIncrementTime = 0;\n this.value = 0;\n }\n increment() {\n const now = this.nowFn();\n // We are outside of the range of `interval` and as such\n // start counting from 0 and remember the time\n if (now - this.lastIncrementTime > this.interval) {\n this.lastIncrementTime = now;\n this.value = 0;\n }\n this.value++;\n return this.value;\n }\n}\n/**\n * Creates a promise whose resolution or rejection can be controlled imperatively.\n */\nexport class DeferredPromise {\n get isRejected() {\n return this.outcome?.outcome === 1 /* DeferredOutcome.Rejected */;\n }\n get isResolved() {\n return this.outcome?.outcome === 0 /* DeferredOutcome.Resolved */;\n }\n get isSettled() {\n return !!this.outcome;\n }\n get value() {\n return this.outcome?.outcome === 0 /* DeferredOutcome.Resolved */ ? this.outcome?.value : undefined;\n }\n constructor() {\n this.p = new Promise((c, e) => {\n this.completeCallback = c;\n this.errorCallback = e;\n });\n }\n complete(value) {\n return new Promise(resolve => {\n this.completeCallback(value);\n this.outcome = { outcome: 0 /* DeferredOutcome.Resolved */, value };\n resolve();\n });\n }\n error(err) {\n return new Promise(resolve => {\n this.errorCallback(err);\n this.outcome = { outcome: 1 /* DeferredOutcome.Rejected */, value: err };\n resolve();\n });\n }\n cancel() {\n return this.error(new CancellationError());\n }\n}\n//#endregion\n//#region Promises\nexport var Promises;\n(function (Promises) {\n /**\n * A drop-in replacement for `Promise.all` with the only difference\n * that the method awaits every promise to either fulfill or reject.\n *\n * Similar to `Promise.all`, only the first error will be returned\n * if any.\n */\n async function settled(promises) {\n let firstError = undefined;\n const result = await Promise.all(promises.map(promise => promise.then(value => value, error => {\n if (!firstError) {\n firstError = error;\n }\n return undefined; // do not rethrow so that other promises can settle\n })));\n if (typeof firstError !== 'undefined') {\n throw firstError;\n }\n return result; // cast is needed and protected by the `throw` above\n }\n Promises.settled = settled;\n /**\n * A helper to create a new `Promise` with a body that is a promise\n * itself. By default, an error that raises from the async body will\n * end up as a unhandled rejection, so this utility properly awaits the\n * body and rejects the promise as a normal promise does without async\n * body.\n *\n * This method should only be used in rare cases where otherwise `async`\n * cannot be used (e.g. when callbacks are involved that require this).\n */\n function withAsyncBody(bodyFn) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n try {\n await bodyFn(resolve, reject);\n }\n catch (error) {\n reject(error);\n }\n });\n }\n Promises.withAsyncBody = withAsyncBody;\n})(Promises || (Promises = {}));\nexport class StatefulPromise {\n get value() { return this._value; }\n get error() { return this._error; }\n get isResolved() { return this._isResolved; }\n constructor(promise) {\n this._value = undefined;\n this._error = undefined;\n this._isResolved = false;\n this.promise = promise.then(value => {\n this._value = value;\n this._isResolved = true;\n return value;\n }, error => {\n this._error = error;\n this._isResolved = true;\n throw error;\n });\n }\n requireValue() {\n if (!this._isResolved) {\n throw new BugIndicatingError('Promise is not resolved yet');\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n}\nexport class LazyStatefulPromise {\n constructor(_compute) {\n this._compute = _compute;\n this._promise = new Lazy(() => new StatefulPromise(this._compute()));\n }\n /**\n * Returns the resolved value.\n * Crashes if the promise is not resolved yet.\n */\n requireValue() {\n return this._promise.value.requireValue();\n }\n /**\n * Returns the promise (and triggers a computation of the promise if not yet done so).\n */\n getPromise() {\n return this._promise.value.promise;\n }\n}\n/**\n * A rich implementation for an `AsyncIterable`.\n */\nexport class AsyncIterableObject {\n static fromArray(items) {\n return new AsyncIterableObject((writer) => {\n writer.emitMany(items);\n });\n }\n static fromPromise(promise) {\n return new AsyncIterableObject(async (emitter) => {\n emitter.emitMany(await promise);\n });\n }\n static fromPromises(promises) {\n return new AsyncIterableObject(async (emitter) => {\n await Promise.all(promises.map(async (p) => emitter.emitOne(await p)));\n });\n }\n static merge(iterables) {\n return new AsyncIterableObject(async (emitter) => {\n await Promise.all(iterables.map(async (iterable) => {\n for await (const item of iterable) {\n emitter.emitOne(item);\n }\n }));\n });\n }\n constructor(executor) {\n this._state = 0 /* AsyncIterableSourceState.Initial */;\n this._results = [];\n this._error = null;\n this._onStateChanged = new Emitter();\n queueMicrotask(async () => {\n const writer = {\n emitOne: (item) => this.emitOne(item),\n emitMany: (items) => this.emitMany(items),\n reject: (error) => this.reject(error)\n };\n try {\n await Promise.resolve(executor(writer));\n this.resolve();\n }\n catch (err) {\n this.reject(err);\n }\n finally {\n writer.emitOne = undefined;\n writer.emitMany = undefined;\n writer.reject = undefined;\n }\n });\n }\n [Symbol.asyncIterator]() {\n let i = 0;\n return {\n next: async () => {\n do {\n if (this._state === 2 /* AsyncIterableSourceState.DoneError */) {\n throw this._error;\n }\n if (i < this._results.length) {\n return { done: false, value: this._results[i++] };\n }\n if (this._state === 1 /* AsyncIterableSourceState.DoneOK */) {\n return { done: true, value: undefined };\n }\n await Event.toPromise(this._onStateChanged.event);\n } while (true);\n }\n };\n }\n static map(iterable, mapFn) {\n return new AsyncIterableObject(async (emitter) => {\n for await (const item of iterable) {\n emitter.emitOne(mapFn(item));\n }\n });\n }\n map(mapFn) {\n return AsyncIterableObject.map(this, mapFn);\n }\n static filter(iterable, filterFn) {\n return new AsyncIterableObject(async (emitter) => {\n for await (const item of iterable) {\n if (filterFn(item)) {\n emitter.emitOne(item);\n }\n }\n });\n }\n filter(filterFn) {\n return AsyncIterableObject.filter(this, filterFn);\n }\n static coalesce(iterable) {\n return AsyncIterableObject.filter(iterable, item => !!item);\n }\n coalesce() {\n return AsyncIterableObject.coalesce(this);\n }\n static async toPromise(iterable) {\n const result = [];\n for await (const item of iterable) {\n result.push(item);\n }\n return result;\n }\n toPromise() {\n return AsyncIterableObject.toPromise(this);\n }\n /**\n * The value will be appended at the end.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n emitOne(value) {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n // it is important to add new values at the end,\n // as we may have iterators already running on the array\n this._results.push(value);\n this._onStateChanged.fire();\n }\n /**\n * The values will be appended at the end.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n emitMany(values) {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n // it is important to add new values at the end,\n // as we may have iterators already running on the array\n this._results = this._results.concat(values);\n this._onStateChanged.fire();\n }\n /**\n * Calling `resolve()` will mark the result array as complete.\n *\n * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n resolve() {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n this._state = 1 /* AsyncIterableSourceState.DoneOK */;\n this._onStateChanged.fire();\n }\n /**\n * Writing an error will permanently invalidate this iterable.\n * The current users will receive an error thrown, as will all future users.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n reject(error) {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n this._state = 2 /* AsyncIterableSourceState.DoneError */;\n this._error = error;\n this._onStateChanged.fire();\n }\n}\nAsyncIterableObject.EMPTY = AsyncIterableObject.fromArray([]);\nexport class CancelableAsyncIterableObject extends AsyncIterableObject {\n constructor(_source, executor) {\n super(executor);\n this._source = _source;\n }\n cancel() {\n this._source.cancel();\n }\n}\nexport function createCancelableAsyncIterable(callback) {\n const source = new CancellationTokenSource();\n const innerIterable = callback(source.token);\n return new CancelableAsyncIterableObject(source, async (emitter) => {\n const subscription = source.token.onCancellationRequested(() => {\n subscription.dispose();\n source.dispose();\n emitter.reject(new CancellationError());\n });\n try {\n for await (const item of innerIterable) {\n if (source.token.isCancellationRequested) {\n // canceled in the meantime\n return;\n }\n emitter.emitOne(item);\n }\n subscription.dispose();\n source.dispose();\n }\n catch (err) {\n subscription.dispose();\n source.dispose();\n emitter.reject(err);\n }\n });\n}\nexport class AsyncIterableSource {\n constructor() {\n this._deferred = new DeferredPromise();\n this._asyncIterable = new AsyncIterableObject(emitter => {\n if (earlyError) {\n emitter.reject(earlyError);\n return;\n }\n if (earlyItems) {\n emitter.emitMany(earlyItems);\n }\n this._errorFn = (error) => emitter.reject(error);\n this._emitFn = (item) => emitter.emitOne(item);\n return this._deferred.p;\n });\n let earlyError;\n let earlyItems;\n this._emitFn = (item) => {\n if (!earlyItems) {\n earlyItems = [];\n }\n earlyItems.push(item);\n };\n this._errorFn = (error) => {\n if (!earlyError) {\n earlyError = error;\n }\n };\n }\n get asyncIterable() {\n return this._asyncIterable;\n }\n resolve() {\n this._deferred.complete();\n }\n reject(error) {\n this._errorFn(error);\n this._deferred.complete();\n }\n emitOne(item) {\n this._emitFn(item);\n }\n}\n//#endregion\n","/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */\n\nconst {\n\tentries,\n\tsetPrototypeOf,\n\tisFrozen,\n\tgetPrototypeOf,\n\tgetOwnPropertyDescriptor\n} = Object;\nlet {\n\tfreeze,\n\tseal,\n\tcreate\n} = Object; // eslint-disable-line import/no-mutable-exports\n\nlet {\n\tapply,\n\tconstruct\n} = typeof Reflect !== 'undefined' && Reflect;\n\nif (!apply) {\n\tapply = function apply(fun, thisValue, args) {\n\t\treturn fun.apply(thisValue, args);\n\t};\n}\n\nif (!freeze) {\n\tfreeze = function freeze(x) {\n\t\treturn x;\n\t};\n}\n\nif (!seal) {\n\tseal = function seal(x) {\n\t\treturn x;\n\t};\n}\n\nif (!construct) {\n\tconstruct = function construct(Func, args) {\n\t\treturn new Func(...args);\n\t};\n}\n\nconst arrayForEach = unapply(Array.prototype.forEach);\nconst arrayPop = unapply(Array.prototype.pop);\nconst arrayPush = unapply(Array.prototype.push);\nconst stringToLowerCase = unapply(String.prototype.toLowerCase);\nconst stringToString = unapply(String.prototype.toString);\nconst stringMatch = unapply(String.prototype.match);\nconst stringReplace = unapply(String.prototype.replace);\nconst stringIndexOf = unapply(String.prototype.indexOf);\nconst stringTrim = unapply(String.prototype.trim);\nconst regExpTest = unapply(RegExp.prototype.test);\nconst typeErrorCreate = unconstruct(TypeError);\nfunction unapply(func) {\n\treturn function (thisArg) {\n\t\tfor (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n\t\t\targs[_key - 1] = arguments[_key];\n\t\t}\n\n\t\treturn apply(func, thisArg, args);\n\t};\n}\nfunction unconstruct(func) {\n\treturn function () {\n\t\tfor (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n\t\t\targs[_key2] = arguments[_key2];\n\t\t}\n\n\t\treturn construct(func, args);\n\t};\n}\n/* Add properties to a lookup table */\n\nfunction addToSet(set, array, transformCaseFunc) {\n\tvar _transformCaseFunc;\n\n\ttransformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;\n\n\tif (setPrototypeOf) {\n\t\t// Make 'in' and truthy checks like Boolean(set.constructor)\n\t\t// independent of any properties defined on Object.prototype.\n\t\t// Prevent prototype setters from intercepting set as a this value.\n\t\tsetPrototypeOf(set, null);\n\t}\n\n\tlet l = array.length;\n\n\twhile (l--) {\n\t\tlet element = array[l];\n\n\t\tif (typeof element === 'string') {\n\t\t\tconst lcElement = transformCaseFunc(element);\n\n\t\t\tif (lcElement !== element) {\n\t\t\t\t// Config presets (e.g. tags.js, attrs.js) are immutable.\n\t\t\t\tif (!isFrozen(array)) {\n\t\t\t\t\tarray[l] = lcElement;\n\t\t\t\t}\n\n\t\t\t\telement = lcElement;\n\t\t\t}\n\t\t}\n\n\t\tset[element] = true;\n\t}\n\n\treturn set;\n}\n/* Shallow clone an object */\n\nfunction clone(object) {\n\tconst newObject = create(null);\n\n\tfor (const [property, value] of entries(object)) {\n\t\tnewObject[property] = value;\n\t}\n\n\treturn newObject;\n}\n/* This method automatically checks if the prop is function\n * or getter and behaves accordingly. */\n\nfunction lookupGetter(object, prop) {\n\twhile (object !== null) {\n\t\tconst desc = getOwnPropertyDescriptor(object, prop);\n\n\t\tif (desc) {\n\t\t\tif (desc.get) {\n\t\t\t\treturn unapply(desc.get);\n\t\t\t}\n\n\t\t\tif (typeof desc.value === 'function') {\n\t\t\t\treturn unapply(desc.value);\n\t\t\t}\n\t\t}\n\n\t\tobject = getPrototypeOf(object);\n\t}\n\n\tfunction fallbackValue(element) {\n\t\tconsole.warn('fallback value for', element);\n\t\treturn null;\n\t}\n\n\treturn fallbackValue;\n}\n\nconst html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG\n\nconst svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\nconst svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.\n// We still need to know them so that we can do namespace\n// checks properly in case one wants to add them to\n// allow-list.\n\nconst svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\nconst mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']); // Similarly to SVG, we want to know all MathML elements,\n// even those that we disallow by default.\n\nconst mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\nconst text = freeze(['#text']);\n\nconst html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);\nconst svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\nconst mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\nconst xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\nconst MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\n\nconst ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\nconst TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\nconst DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\n\nconst ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\n\nconst IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n);\nconst IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\nconst ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n);\nconst DOCTYPE_NAME = seal(/^html$/i);\n\nvar EXPRESSIONS = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tMUSTACHE_EXPR: MUSTACHE_EXPR,\n\tERB_EXPR: ERB_EXPR,\n\tTMPLIT_EXPR: TMPLIT_EXPR,\n\tDATA_ATTR: DATA_ATTR,\n\tARIA_ATTR: ARIA_ATTR,\n\tIS_ALLOWED_URI: IS_ALLOWED_URI,\n\tIS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n\tATTR_WHITESPACE: ATTR_WHITESPACE,\n\tDOCTYPE_NAME: DOCTYPE_NAME\n});\n\nconst getGlobal = () => typeof window === 'undefined' ? null : window;\n/**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\n\n\nconst _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n\tif (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n\t\treturn null;\n\t} // Allow the callers to control the unique policy name\n\t// by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n\t// Policy creation with duplicate names throws in Trusted Types.\n\n\n\tlet suffix = null;\n\tconst ATTR_NAME = 'data-tt-policy-suffix';\n\n\tif (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n\t\tsuffix = purifyHostElement.getAttribute(ATTR_NAME);\n\t}\n\n\tconst policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n\n\ttry {\n\t\treturn trustedTypes.createPolicy(policyName, {\n\t\t\tcreateHTML(html) {\n\t\t\t\treturn html;\n\t\t\t},\n\n\t\t\tcreateScriptURL(scriptUrl) {\n\t\t\t\treturn scriptUrl;\n\t\t\t}\n\n\t\t});\n\t} catch (_) {\n\t\t// Policy creation failed (most likely another DOMPurify script has\n\t\t// already run). Skip creating the policy, as this will only cause errors\n\t\t// if TT are enforced.\n\t\tconsole.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n\t\treturn null;\n\t}\n};\n\nfunction createDOMPurify() {\n\tlet window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n\n\tconst DOMPurify = root => createDOMPurify(root);\n\t/**\n\t * Version label, exposed for easier checks\n\t * if DOMPurify is up to date or not\n\t */\n\n\n\tDOMPurify.version = '3.0.5';\n\t/**\n\t * Array of elements that DOMPurify removed during sanitation.\n\t * Empty if nothing was removed.\n\t */\n\n\tDOMPurify.removed = [];\n\n\tif (!window || !window.document || window.document.nodeType !== 9) {\n\t\t// Not running in a browser, provide a factory function\n\t\t// so that you can pass your own Window\n\t\tDOMPurify.isSupported = false;\n\t\treturn DOMPurify;\n\t}\n\n\tconst originalDocument = window.document;\n\tconst currentScript = originalDocument.currentScript;\n\tlet {\n\t\tdocument\n\t} = window;\n\tconst {\n\t\tDocumentFragment,\n\t\tHTMLTemplateElement,\n\t\tNode,\n\t\tElement,\n\t\tNodeFilter,\n\t\tNamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n\t\tHTMLFormElement,\n\t\tDOMParser,\n\t\ttrustedTypes\n\t} = window;\n\tconst ElementPrototype = Element.prototype;\n\tconst cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n\tconst getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n\tconst getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n\tconst getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a\n\t// new document created via createHTMLDocument. As per the spec\n\t// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n\t// a new empty registry is used when creating a template contents owner\n\t// document, so we use that as our parent document to ensure nothing\n\t// is inherited.\n\n\tif (typeof HTMLTemplateElement === 'function') {\n\t\tconst template = document.createElement('template');\n\n\t\tif (template.content && template.content.ownerDocument) {\n\t\t\tdocument = template.content.ownerDocument;\n\t\t}\n\t}\n\n\tlet trustedTypesPolicy;\n\tlet emptyHTML = '';\n\tconst {\n\t\timplementation,\n\t\tcreateNodeIterator,\n\t\tcreateDocumentFragment,\n\t\tgetElementsByTagName\n\t} = document;\n\tconst {\n\t\timportNode\n\t} = originalDocument;\n\tlet hooks = {};\n\t/**\n\t * Expose whether this browser supports running the full DOMPurify.\n\t */\n\n\tDOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n\tconst {\n\t\tMUSTACHE_EXPR,\n\t\tERB_EXPR,\n\t\tTMPLIT_EXPR,\n\t\tDATA_ATTR,\n\t\tARIA_ATTR,\n\t\tIS_SCRIPT_OR_DATA,\n\t\tATTR_WHITESPACE\n\t} = EXPRESSIONS;\n\tlet {\n\t\tIS_ALLOWED_URI: IS_ALLOWED_URI$1\n\t} = EXPRESSIONS;\n\t/**\n\t * We consider the elements and attributes below to be safe. Ideally\n\t * don't add any new ones but feel free to remove unwanted ones.\n\t */\n\n\t/* allowed element names */\n\n\tlet ALLOWED_TAGS = null;\n\tconst DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n\t/* Allowed attribute names */\n\n\tlet ALLOWED_ATTR = null;\n\tconst DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n\t/*\n\t * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n\t * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n\t * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n\t * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n\t */\n\n\tlet CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {\n\t\ttagNameCheck: {\n\t\t\twritable: true,\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: null\n\t\t},\n\t\tattributeNameCheck: {\n\t\t\twritable: true,\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: null\n\t\t},\n\t\tallowCustomizedBuiltInElements: {\n\t\t\twritable: true,\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: false\n\t\t}\n\t}));\n\t/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n\n\tlet FORBID_TAGS = null;\n\t/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n\n\tlet FORBID_ATTR = null;\n\t/* Decide if ARIA attributes are okay */\n\n\tlet ALLOW_ARIA_ATTR = true;\n\t/* Decide if custom data attributes are okay */\n\n\tlet ALLOW_DATA_ATTR = true;\n\t/* Decide if unknown protocols are okay */\n\n\tlet ALLOW_UNKNOWN_PROTOCOLS = false;\n\t/* Decide if self-closing tags in attributes are allowed.\n\t * Usually removed due to a mXSS issue in jQuery 3.0 */\n\n\tlet ALLOW_SELF_CLOSE_IN_ATTR = true;\n\t/* Output should be safe for common template engines.\n\t * This means, DOMPurify removes data attributes, mustaches and ERB\n\t */\n\n\tlet SAFE_FOR_TEMPLATES = false;\n\t/* Decide if document with ... should be returned */\n\n\tlet WHOLE_DOCUMENT = false;\n\t/* Track whether config is already set on this instance of DOMPurify. */\n\n\tlet SET_CONFIG = false;\n\t/* Decide if all elements (e.g. style, script) must be children of\n\t * document.body. By default, browsers might move them to document.head */\n\n\tlet FORCE_BODY = false;\n\t/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n\t * string (or a TrustedHTML object if Trusted Types are supported).\n\t * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n\t */\n\n\tlet RETURN_DOM = false;\n\t/* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n\t * string (or a TrustedHTML object if Trusted Types are supported) */\n\n\tlet RETURN_DOM_FRAGMENT = false;\n\t/* Try to return a Trusted Type object instead of a string, return a string in\n\t * case Trusted Types are not supported */\n\n\tlet RETURN_TRUSTED_TYPE = false;\n\t/* Output should be free from DOM clobbering attacks?\n\t * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n\t */\n\n\tlet SANITIZE_DOM = true;\n\t/* Achieve full DOM Clobbering protection by isolating the namespace of named\n\t * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n\t *\n\t * HTML/DOM spec rules that enable DOM Clobbering:\n\t * - Named Access on Window (§7.3.3)\n\t * - DOM Tree Accessors (§3.1.5)\n\t * - Form Element Parent-Child Relations (§4.10.3)\n\t * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n\t * - HTMLCollection (§4.2.10.2)\n\t *\n\t * Namespace isolation is implemented by prefixing `id` and `name` attributes\n\t * with a constant string, i.e., `user-content-`\n\t */\n\n\tlet SANITIZE_NAMED_PROPS = false;\n\tconst SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n\t/* Keep element content when removing element? */\n\n\tlet KEEP_CONTENT = true;\n\t/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n\t * of importing it into a new Document and returning a sanitized copy */\n\n\tlet IN_PLACE = false;\n\t/* Allow usage of profiles like html, svg and mathMl */\n\n\tlet USE_PROFILES = {};\n\t/* Tags to ignore content of when KEEP_CONTENT is true */\n\n\tlet FORBID_CONTENTS = null;\n\tconst DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n\t/* Tags that are safe for data: URIs */\n\n\tlet DATA_URI_TAGS = null;\n\tconst DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n\t/* Attributes safe for values like \"javascript:\" */\n\n\tlet URI_SAFE_ATTRIBUTES = null;\n\tconst DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n\tconst MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\tconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\tconst HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n\t/* Document namespace */\n\n\tlet NAMESPACE = HTML_NAMESPACE;\n\tlet IS_EMPTY_INPUT = false;\n\t/* Allowed XHTML+XML namespaces */\n\n\tlet ALLOWED_NAMESPACES = null;\n\tconst DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n\t/* Parsing of strict XHTML documents */\n\n\tlet PARSER_MEDIA_TYPE;\n\tconst SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n\tconst DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n\tlet transformCaseFunc;\n\t/* Keep a reference to config to pass to hooks */\n\n\tlet CONFIG = null;\n\t/* Ideally, do not touch anything below this line */\n\n\t/* ______________________________________________ */\n\n\tconst formElement = document.createElement('form');\n\n\tconst isRegexOrFunction = function isRegexOrFunction(testValue) {\n\t\treturn testValue instanceof RegExp || testValue instanceof Function;\n\t};\n\t/**\n\t * _parseConfig\n\t *\n\t * @param {Object} cfg optional config literal\n\t */\n\t// eslint-disable-next-line complexity\n\n\n\tconst _parseConfig = function _parseConfig(cfg) {\n\t\tif (CONFIG && CONFIG === cfg) {\n\t\t\treturn;\n\t\t}\n\t\t/* Shield configuration object from tampering */\n\n\n\t\tif (!cfg || typeof cfg !== 'object') {\n\t\t\tcfg = {};\n\t\t}\n\t\t/* Shield configuration object from prototype pollution */\n\n\n\t\tcfg = clone(cfg);\n\t\tPARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes\n\t\t\tSUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n\n\t\ttransformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n\t\t/* Set configuration parameters */\n\n\t\tALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n\t\tALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n\t\tALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n\t\tURI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent\n\t\t\tcfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent\n\t\t\ttransformCaseFunc // eslint-disable-line indent\n\t\t) // eslint-disable-line indent\n\t\t\t: DEFAULT_URI_SAFE_ATTRIBUTES;\n\t\tDATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent\n\t\t\tcfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent\n\t\t\ttransformCaseFunc // eslint-disable-line indent\n\t\t) // eslint-disable-line indent\n\t\t\t: DEFAULT_DATA_URI_TAGS;\n\t\tFORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n\t\tFORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};\n\t\tFORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};\n\t\tUSE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;\n\t\tALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n\n\t\tALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n\n\t\tALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n\n\t\tALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n\n\t\tSAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n\n\t\tWHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n\n\t\tRETURN_DOM = cfg.RETURN_DOM || false; // Default false\n\n\t\tRETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n\n\t\tRETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n\n\t\tFORCE_BODY = cfg.FORCE_BODY || false; // Default false\n\n\t\tSANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n\n\t\tSANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n\n\t\tKEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n\n\t\tIN_PLACE = cfg.IN_PLACE || false; // Default false\n\n\t\tIS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n\t\tNAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n\t\tCUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n\n\t\tif (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n\t\t\tCUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n\t\t}\n\n\t\tif (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n\t\t\tCUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n\t\t}\n\n\t\tif (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n\t\t\tCUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n\t\t}\n\n\t\tif (SAFE_FOR_TEMPLATES) {\n\t\t\tALLOW_DATA_ATTR = false;\n\t\t}\n\n\t\tif (RETURN_DOM_FRAGMENT) {\n\t\t\tRETURN_DOM = true;\n\t\t}\n\t\t/* Parse profile info */\n\n\n\t\tif (USE_PROFILES) {\n\t\t\tALLOWED_TAGS = addToSet({}, [...text]);\n\t\t\tALLOWED_ATTR = [];\n\n\t\t\tif (USE_PROFILES.html === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, html$1);\n\t\t\t\taddToSet(ALLOWED_ATTR, html);\n\t\t\t}\n\n\t\t\tif (USE_PROFILES.svg === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, svg$1);\n\t\t\t\taddToSet(ALLOWED_ATTR, svg);\n\t\t\t\taddToSet(ALLOWED_ATTR, xml);\n\t\t\t}\n\n\t\t\tif (USE_PROFILES.svgFilters === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, svgFilters);\n\t\t\t\taddToSet(ALLOWED_ATTR, svg);\n\t\t\t\taddToSet(ALLOWED_ATTR, xml);\n\t\t\t}\n\n\t\t\tif (USE_PROFILES.mathMl === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, mathMl$1);\n\t\t\t\taddToSet(ALLOWED_ATTR, mathMl);\n\t\t\t\taddToSet(ALLOWED_ATTR, xml);\n\t\t\t}\n\t\t}\n\t\t/* Merge configuration parameters */\n\n\n\t\tif (cfg.ADD_TAGS) {\n\t\t\tif (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n\t\t\t\tALLOWED_TAGS = clone(ALLOWED_TAGS);\n\t\t\t}\n\n\t\t\taddToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n\t\t}\n\n\t\tif (cfg.ADD_ATTR) {\n\t\t\tif (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n\t\t\t\tALLOWED_ATTR = clone(ALLOWED_ATTR);\n\t\t\t}\n\n\t\t\taddToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n\t\t}\n\n\t\tif (cfg.ADD_URI_SAFE_ATTR) {\n\t\t\taddToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n\t\t}\n\n\t\tif (cfg.FORBID_CONTENTS) {\n\t\t\tif (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n\t\t\t\tFORBID_CONTENTS = clone(FORBID_CONTENTS);\n\t\t\t}\n\n\t\t\taddToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n\t\t}\n\t\t/* Add #text in case KEEP_CONTENT is set to true */\n\n\n\t\tif (KEEP_CONTENT) {\n\t\t\tALLOWED_TAGS['#text'] = true;\n\t\t}\n\t\t/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n\n\n\t\tif (WHOLE_DOCUMENT) {\n\t\t\taddToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n\t\t}\n\t\t/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n\n\n\t\tif (ALLOWED_TAGS.table) {\n\t\t\taddToSet(ALLOWED_TAGS, ['tbody']);\n\t\t\tdelete FORBID_TAGS.tbody;\n\t\t}\n\n\t\tif (cfg.TRUSTED_TYPES_POLICY) {\n\t\t\tif (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n\t\t\t\tthrow typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n\t\t\t}\n\n\t\t\tif (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n\t\t\t\tthrow typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n\t\t\t} // Overwrite existing TrustedTypes policy.\n\n\n\t\t\ttrustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`.\n\n\t\t\temptyHTML = trustedTypesPolicy.createHTML('');\n\t\t} else {\n\t\t\t// Uninitialized policy, attempt to initialize the internal dompurify policy.\n\t\t\tif (trustedTypesPolicy === undefined) {\n\t\t\t\ttrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n\t\t\t} // If creating the internal policy succeeded sign internal variables.\n\n\n\t\t\tif (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n\t\t\t\temptyHTML = trustedTypesPolicy.createHTML('');\n\t\t\t}\n\t\t} // Prevent further manipulation of configuration.\n\t\t// Not available in IE8, Safari 5, etc.\n\n\n\t\tif (freeze) {\n\t\t\tfreeze(cfg);\n\t\t}\n\n\t\tCONFIG = cfg;\n\t};\n\n\tconst MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n\tconst HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML\n\t// namespace. We need to specify them explicitly\n\t// so that they don't get erroneously deleted from\n\t// HTML namespace.\n\n\tconst COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n\t/* Keep track of all possible SVG and MathML tags\n\t * so that we can perform the namespace checks\n\t * correctly. */\n\n\tconst ALL_SVG_TAGS = addToSet({}, svg$1);\n\taddToSet(ALL_SVG_TAGS, svgFilters);\n\taddToSet(ALL_SVG_TAGS, svgDisallowed);\n\tconst ALL_MATHML_TAGS = addToSet({}, mathMl$1);\n\taddToSet(ALL_MATHML_TAGS, mathMlDisallowed);\n\t/**\n\t *\n\t *\n\t * @param {Element} element a DOM element whose namespace is being checked\n\t * @returns {boolean} Return false if the element has a\n\t * namespace that a spec-compliant parser would never\n\t * return. Return true otherwise.\n\t */\n\n\tconst _checkValidNamespace = function _checkValidNamespace(element) {\n\t\tlet parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode\n\t\t// can be null. We just simulate parent in this case.\n\n\t\tif (!parent || !parent.tagName) {\n\t\t\tparent = {\n\t\t\t\tnamespaceURI: NAMESPACE,\n\t\t\t\ttagName: 'template'\n\t\t\t};\n\t\t}\n\n\t\tconst tagName = stringToLowerCase(element.tagName);\n\t\tconst parentTagName = stringToLowerCase(parent.tagName);\n\n\t\tif (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (element.namespaceURI === SVG_NAMESPACE) {\n\t\t\t// The only way to switch from HTML namespace to SVG\n\t\t\t// is via . If it happens via any other tag, then\n\t\t\t// it should be killed.\n\t\t\tif (parent.namespaceURI === HTML_NAMESPACE) {\n\t\t\t\treturn tagName === 'svg';\n\t\t\t} // The only way to switch from MathML to SVG is via`\n\t\t\t// svg if parent is either or MathML\n\t\t\t// text integration points.\n\n\n\t\t\tif (parent.namespaceURI === MATHML_NAMESPACE) {\n\t\t\t\treturn tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n\t\t\t} // We only allow elements that are defined in SVG\n\t\t\t// spec. All others are disallowed in SVG namespace.\n\n\n\t\t\treturn Boolean(ALL_SVG_TAGS[tagName]);\n\t\t}\n\n\t\tif (element.namespaceURI === MATHML_NAMESPACE) {\n\t\t\t// The only way to switch from HTML namespace to MathML\n\t\t\t// is via . If it happens via any other tag, then\n\t\t\t// it should be killed.\n\t\t\tif (parent.namespaceURI === HTML_NAMESPACE) {\n\t\t\t\treturn tagName === 'math';\n\t\t\t} // The only way to switch from SVG to MathML is via\n\t\t\t// and HTML integration points\n\n\n\t\t\tif (parent.namespaceURI === SVG_NAMESPACE) {\n\t\t\t\treturn tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n\t\t\t} // We only allow elements that are defined in MathML\n\t\t\t// spec. All others are disallowed in MathML namespace.\n\n\n\t\t\treturn Boolean(ALL_MATHML_TAGS[tagName]);\n\t\t}\n\n\t\tif (element.namespaceURI === HTML_NAMESPACE) {\n\t\t\t// The only way to switch from SVG to HTML is via\n\t\t\t// HTML integration points, and from MathML to HTML\n\t\t\t// is via MathML text integration points\n\t\t\tif (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n\t\t\t\treturn false;\n\t\t\t} // We disallow tags that are specific for MathML\n\t\t\t// or SVG and should never appear in HTML namespace\n\n\n\t\t\treturn !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n\t\t} // For XHTML and XML documents that support custom namespaces\n\n\n\t\tif (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n\t\t\treturn true;\n\t\t} // The code should never reach this place (this means\n\t\t// that the element somehow got namespace that is not\n\t\t// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n\t\t// Return false just in case.\n\n\n\t\treturn false;\n\t};\n\t/**\n\t * _forceRemove\n\t *\n\t * @param {Node} node a DOM node\n\t */\n\n\n\tconst _forceRemove = function _forceRemove(node) {\n\t\tarrayPush(DOMPurify.removed, {\n\t\t\telement: node\n\t\t});\n\n\t\ttry {\n\t\t\t// eslint-disable-next-line unicorn/prefer-dom-node-remove\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} catch (_) {\n\t\t\tnode.remove();\n\t\t}\n\t};\n\t/**\n\t * _removeAttribute\n\t *\n\t * @param {String} name an Attribute name\n\t * @param {Node} node a DOM node\n\t */\n\n\n\tconst _removeAttribute = function _removeAttribute(name, node) {\n\t\ttry {\n\t\t\tarrayPush(DOMPurify.removed, {\n\t\t\t\tattribute: node.getAttributeNode(name),\n\t\t\t\tfrom: node\n\t\t\t});\n\t\t} catch (_) {\n\t\t\tarrayPush(DOMPurify.removed, {\n\t\t\t\tattribute: null,\n\t\t\t\tfrom: node\n\t\t\t});\n\t\t}\n\n\t\tnode.removeAttribute(name); // We void attribute values for unremovable \"is\"\" attributes\n\n\t\tif (name === 'is' && !ALLOWED_ATTR[name]) {\n\t\t\tif (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n\t\t\t\ttry {\n\t\t\t\t\t_forceRemove(node);\n\t\t\t\t} catch (_) { }\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tnode.setAttribute(name, '');\n\t\t\t\t} catch (_) { }\n\t\t\t}\n\t\t}\n\t};\n\t/**\n\t * _initDocument\n\t *\n\t * @param {String} dirty a string of dirty markup\n\t * @return {Document} a DOM, filled with the dirty markup\n\t */\n\n\n\tconst _initDocument = function _initDocument(dirty) {\n\t\t/* Create a HTML document */\n\t\tlet doc;\n\t\tlet leadingWhitespace;\n\n\t\tif (FORCE_BODY) {\n\t\t\tdirty = '' + dirty;\n\t\t} else {\n\t\t\t/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n\t\t\tconst matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n\t\t\tleadingWhitespace = matches && matches[0];\n\t\t}\n\n\t\tif (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n\t\t\t// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n\t\t\tdirty = '' + dirty + '';\n\t\t}\n\n\t\tconst dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n\t\t/*\n\t\t * Use the DOMParser API by default, fallback later if needs be\n\t\t * DOMParser not work for svg when has multiple root element.\n\t\t */\n\n\t\tif (NAMESPACE === HTML_NAMESPACE) {\n\t\t\ttry {\n\t\t\t\tdoc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n\t\t\t} catch (_) { }\n\t\t}\n\t\t/* Use createHTMLDocument in case DOMParser is not available */\n\n\n\t\tif (!doc || !doc.documentElement) {\n\t\t\tdoc = implementation.createDocument(NAMESPACE, 'template', null);\n\n\t\t\ttry {\n\t\t\t\tdoc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n\t\t\t} catch (_) {// Syntax error if dirtyPayload is invalid xml\n\t\t\t}\n\t\t}\n\n\t\tconst body = doc.body || doc.documentElement;\n\n\t\tif (dirty && leadingWhitespace) {\n\t\t\tbody.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n\t\t}\n\t\t/* Work on whole document or just its body */\n\n\n\t\tif (NAMESPACE === HTML_NAMESPACE) {\n\t\t\treturn getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n\t\t}\n\n\t\treturn WHOLE_DOCUMENT ? doc.documentElement : body;\n\t};\n\t/**\n\t * _createIterator\n\t *\n\t * @param {Document} root document/fragment to create iterator for\n\t * @return {Iterator} iterator instance\n\t */\n\n\n\tconst _createIterator = function _createIterator(root) {\n\t\treturn createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise\n\t\t\tNodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);\n\t};\n\t/**\n\t * _isClobbered\n\t *\n\t * @param {Node} elm element to check for clobbering attacks\n\t * @return {Boolean} true if clobbered, false if safe\n\t */\n\n\n\tconst _isClobbered = function _isClobbered(elm) {\n\t\treturn elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');\n\t};\n\t/**\n\t * _isNode\n\t *\n\t * @param {Node} obj object to check whether it's a DOM node\n\t * @return {Boolean} true is object is a DOM node\n\t */\n\n\n\tconst _isNode = function _isNode(object) {\n\t\treturn typeof Node === 'object' ? object instanceof Node : object && typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';\n\t};\n\t/**\n\t * _executeHook\n\t * Execute user configurable hooks\n\t *\n\t * @param {String} entryPoint Name of the hook's entry point\n\t * @param {Node} currentNode node to work on with the hook\n\t * @param {Object} data additional hook parameters\n\t */\n\n\n\tconst _executeHook = function _executeHook(entryPoint, currentNode, data) {\n\t\tif (!hooks[entryPoint]) {\n\t\t\treturn;\n\t\t}\n\n\t\tarrayForEach(hooks[entryPoint], hook => {\n\t\t\thook.call(DOMPurify, currentNode, data, CONFIG);\n\t\t});\n\t};\n\t/**\n\t * _sanitizeElements\n\t *\n\t * @protect nodeName\n\t * @protect textContent\n\t * @protect removeChild\n\t *\n\t * @param {Node} currentNode to check for permission to exist\n\t * @return {Boolean} true if node was killed, false if left alive\n\t */\n\n\n\tconst _sanitizeElements = function _sanitizeElements(currentNode) {\n\t\tlet content;\n\t\t/* Execute a hook if present */\n\n\t\t_executeHook('beforeSanitizeElements', currentNode, null);\n\t\t/* Check if element is clobbered or can clobber */\n\n\n\t\tif (_isClobbered(currentNode)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Now let's check the element's type and name */\n\n\n\t\tconst tagName = transformCaseFunc(currentNode.nodeName);\n\t\t/* Execute a hook if present */\n\n\t\t_executeHook('uponSanitizeElement', currentNode, {\n\t\t\ttagName,\n\t\t\tallowedTags: ALLOWED_TAGS\n\t\t});\n\t\t/* Detect mXSS attempts abusing namespace confusion */\n\n\n\t\tif (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Remove element if anything forbids its presence */\n\n\n\t\tif (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n\t\t\t/* Check if we have a custom element to handle */\n\t\t\tif (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {\n\t\t\t\tif (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;\n\t\t\t\tif (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;\n\t\t\t}\n\t\t\t/* Keep content except for bad-listed elements */\n\n\n\t\t\tif (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n\t\t\t\tconst parentNode = getParentNode(currentNode) || currentNode.parentNode;\n\t\t\t\tconst childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n\n\t\t\t\tif (childNodes && parentNode) {\n\t\t\t\t\tconst childCount = childNodes.length;\n\n\t\t\t\t\tfor (let i = childCount - 1; i >= 0; --i) {\n\t\t\t\t\t\tparentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Check whether element has a valid namespace */\n\n\n\t\tif (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Make sure that older browsers don't get fallback-tag mXSS */\n\n\n\t\tif ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Sanitize element content to be template-safe */\n\n\n\t\tif (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {\n\t\t\t/* Get the element's text content */\n\t\t\tcontent = currentNode.textContent;\n\t\t\tcontent = stringReplace(content, MUSTACHE_EXPR, ' ');\n\t\t\tcontent = stringReplace(content, ERB_EXPR, ' ');\n\t\t\tcontent = stringReplace(content, TMPLIT_EXPR, ' ');\n\n\t\t\tif (currentNode.textContent !== content) {\n\t\t\t\tarrayPush(DOMPurify.removed, {\n\t\t\t\t\telement: currentNode.cloneNode()\n\t\t\t\t});\n\t\t\t\tcurrentNode.textContent = content;\n\t\t\t}\n\t\t}\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('afterSanitizeElements', currentNode, null);\n\n\t\treturn false;\n\t};\n\t/**\n\t * _isValidAttribute\n\t *\n\t * @param {string} lcTag Lowercase tag name of containing element.\n\t * @param {string} lcName Lowercase attribute name.\n\t * @param {string} value Attribute value.\n\t * @return {Boolean} Returns true if `value` is valid, otherwise false.\n\t */\n\t// eslint-disable-next-line complexity\n\n\n\tconst _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n\t\t/* Make sure attribute cannot clobber */\n\t\tif (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n\t\t\treturn false;\n\t\t}\n\t\t/* Allow valid data-* attributes: At least one character after \"-\"\n\t\t\t\t(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n\t\t\t\tXML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n\t\t\t\tWe don't need to check the value; it's always URI safe. */\n\n\n\t\tif (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)); else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)); else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n\t\t\tif ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n\t\t\t\t// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n\t\t\t\t// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n\t\t\t\t_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND\n\t\t\t\t// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n\t\t\t\tlcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))); else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t/* Check value is safe. First, is attr inert? If so, is safe */\n\n\t\t} else if (URI_SAFE_ATTRIBUTES[lcName]); else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))); else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]); else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))); else if (value) {\n\t\t\treturn false;\n\t\t} else;\n\n\t\treturn true;\n\t};\n\t/**\n\t * _basicCustomElementCheck\n\t * checks if at least one dash is included in tagName, and it's not the first char\n\t * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n\t * @param {string} tagName name of the tag of the node to sanitize\n\t */\n\n\n\tconst _basicCustomElementTest = function _basicCustomElementTest(tagName) {\n\t\treturn tagName.indexOf('-') > 0;\n\t};\n\t/**\n\t * _sanitizeAttributes\n\t *\n\t * @protect attributes\n\t * @protect nodeName\n\t * @protect removeAttribute\n\t * @protect setAttribute\n\t *\n\t * @param {Node} currentNode to sanitize\n\t */\n\n\n\tconst _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n\t\tlet attr;\n\t\tlet value;\n\t\tlet lcName;\n\t\tlet l;\n\t\t/* Execute a hook if present */\n\n\t\t_executeHook('beforeSanitizeAttributes', currentNode, null);\n\n\t\tconst {\n\t\t\tattributes\n\t\t} = currentNode;\n\t\t/* Check if we have attributes; if not we might have a text node */\n\n\t\tif (!attributes) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst hookEvent = {\n\t\t\tattrName: '',\n\t\t\tattrValue: '',\n\t\t\tkeepAttr: true,\n\t\t\tallowedAttributes: ALLOWED_ATTR\n\t\t};\n\t\tl = attributes.length;\n\t\t/* Go backwards over all attributes; safely remove bad ones */\n\n\t\twhile (l--) {\n\t\t\tattr = attributes[l];\n\t\t\tconst {\n\t\t\t\tname,\n\t\t\t\tnamespaceURI\n\t\t\t} = attr;\n\t\t\tvalue = name === 'value' ? attr.value : stringTrim(attr.value);\n\t\t\tlcName = transformCaseFunc(name);\n\t\t\t/* Execute a hook if present */\n\n\t\t\thookEvent.attrName = lcName;\n\t\t\thookEvent.attrValue = value;\n\t\t\thookEvent.keepAttr = true;\n\t\t\thookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n\n\t\t\t_executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n\n\t\t\tvalue = hookEvent.attrValue;\n\t\t\t/* Did the hooks approve of the attribute? */\n\n\t\t\tif (hookEvent.forceKeepAttr) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Remove attribute */\n\n\n\t\t\t_removeAttribute(name, currentNode);\n\t\t\t/* Did the hooks approve of the attribute? */\n\n\n\t\t\tif (!hookEvent.keepAttr) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Work around a security issue in jQuery 3.0 */\n\n\n\t\t\tif (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n\t\t\t\t_removeAttribute(name, currentNode);\n\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Sanitize attribute content to be template-safe */\n\n\n\t\t\tif (SAFE_FOR_TEMPLATES) {\n\t\t\t\tvalue = stringReplace(value, MUSTACHE_EXPR, ' ');\n\t\t\t\tvalue = stringReplace(value, ERB_EXPR, ' ');\n\t\t\t\tvalue = stringReplace(value, TMPLIT_EXPR, ' ');\n\t\t\t}\n\t\t\t/* Is `value` valid for this attribute? */\n\n\n\t\t\tconst lcTag = transformCaseFunc(currentNode.nodeName);\n\n\t\t\tif (!_isValidAttribute(lcTag, lcName, value)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Full DOM Clobbering protection via namespace isolation,\n\t\t\t * Prefix id and name attributes with `user-content-`\n\t\t\t */\n\n\n\t\t\tif (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n\t\t\t\t// Remove the attribute with this value\n\t\t\t\t_removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value\n\n\n\t\t\t\tvalue = SANITIZE_NAMED_PROPS_PREFIX + value;\n\t\t\t}\n\t\t\t/* Handle attributes that require Trusted Types */\n\n\n\t\t\tif (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n\t\t\t\tif (namespaceURI); else {\n\t\t\t\t\tswitch (trustedTypes.getAttributeType(lcTag, lcName)) {\n\t\t\t\t\t\tcase 'TrustedHTML':\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue = trustedTypesPolicy.createHTML(value);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcase 'TrustedScriptURL':\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue = trustedTypesPolicy.createScriptURL(value);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t/* Handle invalid data-* attribute set by try-catching it */\n\n\n\t\t\ttry {\n\t\t\t\tif (namespaceURI) {\n\t\t\t\t\tcurrentNode.setAttributeNS(namespaceURI, name, value);\n\t\t\t\t} else {\n\t\t\t\t\t/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n\t\t\t\t\tcurrentNode.setAttribute(name, value);\n\t\t\t\t}\n\n\t\t\t\tarrayPop(DOMPurify.removed);\n\t\t\t} catch (_) { }\n\t\t}\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('afterSanitizeAttributes', currentNode, null);\n\t};\n\t/**\n\t * _sanitizeShadowDOM\n\t *\n\t * @param {DocumentFragment} fragment to iterate over recursively\n\t */\n\n\n\tconst _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n\t\tlet shadowNode;\n\n\t\tconst shadowIterator = _createIterator(fragment);\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('beforeSanitizeShadowDOM', fragment, null);\n\n\t\twhile (shadowNode = shadowIterator.nextNode()) {\n\t\t\t/* Execute a hook if present */\n\t\t\t_executeHook('uponSanitizeShadowNode', shadowNode, null);\n\t\t\t/* Sanitize tags and elements */\n\n\n\t\t\tif (_sanitizeElements(shadowNode)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Deep shadow DOM detected */\n\n\n\t\t\tif (shadowNode.content instanceof DocumentFragment) {\n\t\t\t\t_sanitizeShadowDOM(shadowNode.content);\n\t\t\t}\n\t\t\t/* Check attributes, sanitize if necessary */\n\n\n\t\t\t_sanitizeAttributes(shadowNode);\n\t\t}\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('afterSanitizeShadowDOM', fragment, null);\n\t};\n\t/**\n\t * Sanitize\n\t * Public method providing core sanitation functionality\n\t *\n\t * @param {String|Node} dirty string or DOM node\n\t * @param {Object} configuration object\n\t */\n\t// eslint-disable-next-line complexity\n\n\n\tDOMPurify.sanitize = function (dirty) {\n\t\tlet cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\tlet body;\n\t\tlet importedNode;\n\t\tlet currentNode;\n\t\tlet returnNode;\n\t\t/* Make sure we have a string to sanitize.\n\t\t\tDO NOT return early, as this will return the wrong type if\n\t\t\tthe user has requested a DOM object rather than a string */\n\n\t\tIS_EMPTY_INPUT = !dirty;\n\n\t\tif (IS_EMPTY_INPUT) {\n\t\t\tdirty = '';\n\t\t}\n\t\t/* Stringify, in case dirty is an object */\n\n\n\t\tif (typeof dirty !== 'string' && !_isNode(dirty)) {\n\t\t\tif (typeof dirty.toString === 'function') {\n\t\t\t\tdirty = dirty.toString();\n\n\t\t\t\tif (typeof dirty !== 'string') {\n\t\t\t\t\tthrow typeErrorCreate('dirty is not a string, aborting');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow typeErrorCreate('toString is not a function');\n\t\t\t}\n\t\t}\n\t\t/* Return dirty HTML if DOMPurify cannot run */\n\n\n\t\tif (!DOMPurify.isSupported) {\n\t\t\treturn dirty;\n\t\t}\n\t\t/* Assign config vars */\n\n\n\t\tif (!SET_CONFIG) {\n\t\t\t_parseConfig(cfg);\n\t\t}\n\t\t/* Clean up removed elements */\n\n\n\t\tDOMPurify.removed = [];\n\t\t/* Check if dirty is correctly typed for IN_PLACE */\n\n\t\tif (typeof dirty === 'string') {\n\t\t\tIN_PLACE = false;\n\t\t}\n\n\t\tif (IN_PLACE) {\n\t\t\t/* Do some early pre-sanitization to avoid unsafe root nodes */\n\t\t\tif (dirty.nodeName) {\n\t\t\t\tconst tagName = transformCaseFunc(dirty.nodeName);\n\n\t\t\t\tif (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n\t\t\t\t\tthrow typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (dirty instanceof Node) {\n\t\t\t/* If dirty is a DOM element, append to an empty document to avoid\n\t\t\t\t elements being stripped by the parser */\n\t\t\tbody = _initDocument('');\n\t\t\timportedNode = body.ownerDocument.importNode(dirty, true);\n\n\t\t\tif (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {\n\t\t\t\t/* Node is already a body, use as is */\n\t\t\t\tbody = importedNode;\n\t\t\t} else if (importedNode.nodeName === 'HTML') {\n\t\t\t\tbody = importedNode;\n\t\t\t} else {\n\t\t\t\t// eslint-disable-next-line unicorn/prefer-dom-node-append\n\t\t\t\tbody.appendChild(importedNode);\n\t\t\t}\n\t\t} else {\n\t\t\t/* Exit directly if we have nothing to do */\n\t\t\tif (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes\n\t\t\t\tdirty.indexOf('<') === -1) {\n\t\t\t\treturn trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n\t\t\t}\n\t\t\t/* Initialize the document to work on */\n\n\n\t\t\tbody = _initDocument(dirty);\n\t\t\t/* Check we have a DOM node from the data */\n\n\t\t\tif (!body) {\n\t\t\t\treturn RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n\t\t\t}\n\t\t}\n\t\t/* Remove first element node (ours) if FORCE_BODY is set */\n\n\n\t\tif (body && FORCE_BODY) {\n\t\t\t_forceRemove(body.firstChild);\n\t\t}\n\t\t/* Get node iterator */\n\n\n\t\tconst nodeIterator = _createIterator(IN_PLACE ? dirty : body);\n\t\t/* Now start iterating over the created document */\n\n\n\t\twhile (currentNode = nodeIterator.nextNode()) {\n\t\t\t/* Sanitize tags and elements */\n\t\t\tif (_sanitizeElements(currentNode)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Shadow DOM detected, sanitize it */\n\n\n\t\t\tif (currentNode.content instanceof DocumentFragment) {\n\t\t\t\t_sanitizeShadowDOM(currentNode.content);\n\t\t\t}\n\t\t\t/* Check attributes, sanitize if necessary */\n\n\n\t\t\t_sanitizeAttributes(currentNode);\n\t\t}\n\t\t/* If we sanitized `dirty` in-place, return it. */\n\n\n\t\tif (IN_PLACE) {\n\t\t\treturn dirty;\n\t\t}\n\t\t/* Return sanitized string or DOM */\n\n\n\t\tif (RETURN_DOM) {\n\t\t\tif (RETURN_DOM_FRAGMENT) {\n\t\t\t\treturnNode = createDocumentFragment.call(body.ownerDocument);\n\n\t\t\t\twhile (body.firstChild) {\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-dom-node-append\n\t\t\t\t\treturnNode.appendChild(body.firstChild);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturnNode = body;\n\t\t\t}\n\n\t\t\tif (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n\t\t\t\t/*\n\t\t\t\t\tAdoptNode() is not used because internal state is not reset\n\t\t\t\t\t(e.g. the past names map of a HTMLFormElement), this is safe\n\t\t\t\t\tin theory but we would rather not risk another attack vector.\n\t\t\t\t\tThe state that is cloned by importNode() is explicitly defined\n\t\t\t\t\tby the specs.\n\t\t\t\t*/\n\t\t\t\treturnNode = importNode.call(originalDocument, returnNode, true);\n\t\t\t}\n\n\t\t\treturn returnNode;\n\t\t}\n\n\t\tlet serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n\t\t/* Serialize doctype if allowed */\n\n\t\tif (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n\t\t\tserializedHTML = '\\n' + serializedHTML;\n\t\t}\n\t\t/* Sanitize final string template-safe */\n\n\n\t\tif (SAFE_FOR_TEMPLATES) {\n\t\t\tserializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR, ' ');\n\t\t\tserializedHTML = stringReplace(serializedHTML, ERB_EXPR, ' ');\n\t\t\tserializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR, ' ');\n\t\t}\n\n\t\treturn trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n\t};\n\t/**\n\t * Public method to set the configuration once\n\t * setConfig\n\t *\n\t * @param {Object} cfg configuration object\n\t */\n\n\n\tDOMPurify.setConfig = function (cfg) {\n\t\t_parseConfig(cfg);\n\n\t\tSET_CONFIG = true;\n\t};\n\t/**\n\t * Public method to remove the configuration\n\t * clearConfig\n\t *\n\t */\n\n\n\tDOMPurify.clearConfig = function () {\n\t\tCONFIG = null;\n\t\tSET_CONFIG = false;\n\t};\n\t/**\n\t * Public method to check if an attribute value is valid.\n\t * Uses last set config, if any. Otherwise, uses config defaults.\n\t * isValidAttribute\n\t *\n\t * @param {string} tag Tag name of containing element.\n\t * @param {string} attr Attribute name.\n\t * @param {string} value Attribute value.\n\t * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.\n\t */\n\n\n\tDOMPurify.isValidAttribute = function (tag, attr, value) {\n\t\t/* Initialize shared config vars if necessary. */\n\t\tif (!CONFIG) {\n\t\t\t_parseConfig({});\n\t\t}\n\n\t\tconst lcTag = transformCaseFunc(tag);\n\t\tconst lcName = transformCaseFunc(attr);\n\t\treturn _isValidAttribute(lcTag, lcName, value);\n\t};\n\t/**\n\t * AddHook\n\t * Public method to add DOMPurify hooks\n\t *\n\t * @param {String} entryPoint entry point for the hook to add\n\t * @param {Function} hookFunction function to execute\n\t */\n\n\n\tDOMPurify.addHook = function (entryPoint, hookFunction) {\n\t\tif (typeof hookFunction !== 'function') {\n\t\t\treturn;\n\t\t}\n\n\t\thooks[entryPoint] = hooks[entryPoint] || [];\n\t\tarrayPush(hooks[entryPoint], hookFunction);\n\t};\n\t/**\n\t * RemoveHook\n\t * Public method to remove a DOMPurify hook at a given entryPoint\n\t * (pops it from the stack of hooks if more are present)\n\t *\n\t * @param {String} entryPoint entry point for the hook to remove\n\t * @return {Function} removed(popped) hook\n\t */\n\n\n\tDOMPurify.removeHook = function (entryPoint) {\n\t\tif (hooks[entryPoint]) {\n\t\t\treturn arrayPop(hooks[entryPoint]);\n\t\t}\n\t};\n\t/**\n\t * RemoveHooks\n\t * Public method to remove all DOMPurify hooks at a given entryPoint\n\t *\n\t * @param {String} entryPoint entry point for the hooks to remove\n\t */\n\n\n\tDOMPurify.removeHooks = function (entryPoint) {\n\t\tif (hooks[entryPoint]) {\n\t\t\thooks[entryPoint] = [];\n\t\t}\n\t};\n\t/**\n\t * RemoveAllHooks\n\t * Public method to remove all DOMPurify hooks\n\t *\n\t */\n\n\n\tDOMPurify.removeAllHooks = function () {\n\t\thooks = {};\n\t};\n\n\treturn DOMPurify;\n}\n\nvar purify = createDOMPurify();\n\n// ESM-comment-begin\n// define(function () { return purify; });\n// ESM-comment-end\n\n// ESM-uncomment-begin\nexport default purify;\nexport const version = purify.version;\nexport const isSupported = purify.isSupported;\nexport const sanitize = purify.sanitize;\nexport const setConfig = purify.setConfig;\nexport const clearConfig = purify.clearConfig;\nexport const isValidAttribute = purify.isValidAttribute;\nexport const addHook = purify.addHook;\nexport const removeHook = purify.removeHook;\nexport const removeHooks = purify.removeHooks;\nexport const removeAllHooks = purify.removeAllHooks;\n// ESM-uncomment-end\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from './strings.js';\n/**\n * Return a hash value for an object.\n */\nexport function hash(obj) {\n return doHash(obj, 0);\n}\nexport function doHash(obj, hashVal) {\n switch (typeof obj) {\n case 'object':\n if (obj === null) {\n return numberHash(349, hashVal);\n }\n else if (Array.isArray(obj)) {\n return arrayHash(obj, hashVal);\n }\n return objectHash(obj, hashVal);\n case 'string':\n return stringHash(obj, hashVal);\n case 'boolean':\n return booleanHash(obj, hashVal);\n case 'number':\n return numberHash(obj, hashVal);\n case 'undefined':\n return numberHash(937, hashVal);\n default:\n return numberHash(617, hashVal);\n }\n}\nexport function numberHash(val, initialHashVal) {\n return (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\n}\nfunction booleanHash(b, initialHashVal) {\n return numberHash(b ? 433 : 863, initialHashVal);\n}\nexport function stringHash(s, hashVal) {\n hashVal = numberHash(149417, hashVal);\n for (let i = 0, length = s.length; i < length; i++) {\n hashVal = numberHash(s.charCodeAt(i), hashVal);\n }\n return hashVal;\n}\nfunction arrayHash(arr, initialHashVal) {\n initialHashVal = numberHash(104579, initialHashVal);\n return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\n}\nfunction objectHash(obj, initialHashVal) {\n initialHashVal = numberHash(181387, initialHashVal);\n return Object.keys(obj).sort().reduce((hashVal, key) => {\n hashVal = stringHash(key, hashVal);\n return doHash(obj[key], hashVal);\n }, initialHashVal);\n}\nexport class Hasher {\n constructor() {\n this._value = 0;\n }\n get value() {\n return this._value;\n }\n hash(obj) {\n this._value = doHash(obj, this._value);\n return this._value;\n }\n}\nfunction leftRotate(value, bits, totalBits = 32) {\n // delta + bits = totalBits\n const delta = totalBits - bits;\n // All ones, expect `delta` zeros aligned to the right\n const mask = ~((1 << delta) - 1);\n // Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\n return ((value << bits) | ((mask & value) >>> delta)) >>> 0;\n}\nfunction fill(dest, index = 0, count = dest.byteLength, value = 0) {\n for (let i = 0; i < count; i++) {\n dest[index + i] = value;\n }\n}\nfunction leftPad(value, length, char = '0') {\n while (value.length < length) {\n value = char + value;\n }\n return value;\n}\nexport function toHexString(bufferOrValue, bitsize = 32) {\n if (bufferOrValue instanceof ArrayBuffer) {\n return Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\n }\n return leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\n}\n/**\n * A SHA1 implementation that works with strings and does not allocate.\n */\nexport class StringSHA1 {\n constructor() {\n this._h0 = 0x67452301;\n this._h1 = 0xEFCDAB89;\n this._h2 = 0x98BADCFE;\n this._h3 = 0x10325476;\n this._h4 = 0xC3D2E1F0;\n this._buff = new Uint8Array(64 /* SHA1Constant.BLOCK_SIZE */ + 3 /* to fit any utf-8 */);\n this._buffDV = new DataView(this._buff.buffer);\n this._buffLen = 0;\n this._totalLen = 0;\n this._leftoverHighSurrogate = 0;\n this._finished = false;\n }\n update(str) {\n const strLen = str.length;\n if (strLen === 0) {\n return;\n }\n const buff = this._buff;\n let buffLen = this._buffLen;\n let leftoverHighSurrogate = this._leftoverHighSurrogate;\n let charCode;\n let offset;\n if (leftoverHighSurrogate !== 0) {\n charCode = leftoverHighSurrogate;\n offset = -1;\n leftoverHighSurrogate = 0;\n }\n else {\n charCode = str.charCodeAt(0);\n offset = 0;\n }\n while (true) {\n let codePoint = charCode;\n if (strings.isHighSurrogate(charCode)) {\n if (offset + 1 < strLen) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (strings.isLowSurrogate(nextCharCode)) {\n offset++;\n codePoint = strings.computeCodePoint(charCode, nextCharCode);\n }\n else {\n // illegal => unicode replacement character\n codePoint = 65533 /* SHA1Constant.UNICODE_REPLACEMENT */;\n }\n }\n else {\n // last character is a surrogate pair\n leftoverHighSurrogate = charCode;\n break;\n }\n }\n else if (strings.isLowSurrogate(charCode)) {\n // illegal => unicode replacement character\n codePoint = 65533 /* SHA1Constant.UNICODE_REPLACEMENT */;\n }\n buffLen = this._push(buff, buffLen, codePoint);\n offset++;\n if (offset < strLen) {\n charCode = str.charCodeAt(offset);\n }\n else {\n break;\n }\n }\n this._buffLen = buffLen;\n this._leftoverHighSurrogate = leftoverHighSurrogate;\n }\n _push(buff, buffLen, codePoint) {\n if (codePoint < 0x0080) {\n buff[buffLen++] = codePoint;\n }\n else if (codePoint < 0x0800) {\n buff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else if (codePoint < 0x10000) {\n buff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else {\n buff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n if (buffLen >= 64 /* SHA1Constant.BLOCK_SIZE */) {\n this._step();\n buffLen -= 64 /* SHA1Constant.BLOCK_SIZE */;\n this._totalLen += 64 /* SHA1Constant.BLOCK_SIZE */;\n // take last 3 in case of UTF8 overflow\n buff[0] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 0];\n buff[1] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 1];\n buff[2] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 2];\n }\n return buffLen;\n }\n digest() {\n if (!this._finished) {\n this._finished = true;\n if (this._leftoverHighSurrogate) {\n // illegal => unicode replacement character\n this._leftoverHighSurrogate = 0;\n this._buffLen = this._push(this._buff, this._buffLen, 65533 /* SHA1Constant.UNICODE_REPLACEMENT */);\n }\n this._totalLen += this._buffLen;\n this._wrapUp();\n }\n return toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\n }\n _wrapUp() {\n this._buff[this._buffLen++] = 0x80;\n fill(this._buff, this._buffLen);\n if (this._buffLen > 56) {\n this._step();\n fill(this._buff);\n }\n // this will fit because the mantissa can cover up to 52 bits\n const ml = 8 * this._totalLen;\n this._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\n this._buffDV.setUint32(60, ml % 4294967296, false);\n this._step();\n }\n _step() {\n const bigBlock32 = StringSHA1._bigBlock32;\n const data = this._buffDV;\n for (let j = 0; j < 64 /* 16*4 */; j += 4) {\n bigBlock32.setUint32(j, data.getUint32(j, false), false);\n }\n for (let j = 64; j < 320 /* 80*4 */; j += 4) {\n bigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\n }\n let a = this._h0;\n let b = this._h1;\n let c = this._h2;\n let d = this._h3;\n let e = this._h4;\n let f, k;\n let temp;\n for (let j = 0; j < 80; j++) {\n if (j < 20) {\n f = (b & c) | ((~b) & d);\n k = 0x5A827999;\n }\n else if (j < 40) {\n f = b ^ c ^ d;\n k = 0x6ED9EBA1;\n }\n else if (j < 60) {\n f = (b & c) | (b & d) | (c & d);\n k = 0x8F1BBCDC;\n }\n else {\n f = b ^ c ^ d;\n k = 0xCA62C1D6;\n }\n temp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\n e = d;\n d = c;\n c = leftRotate(b, 30);\n b = a;\n a = temp;\n }\n this._h0 = (this._h0 + a) & 0xffffffff;\n this._h1 = (this._h1 + b) & 0xffffffff;\n this._h2 = (this._h2 + c) & 0xffffffff;\n this._h3 = (this._h3 + d) & 0xffffffff;\n this._h4 = (this._h4 + e) & 0xffffffff;\n }\n}\nStringSHA1._bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from './browser.js';\nimport { BrowserFeatures } from './canIUse.js';\nimport { StandardKeyboardEvent } from './keyboardEvent.js';\nimport { StandardMouseEvent } from './mouseEvent.js';\nimport { AbstractIdleValue, IntervalTimer, TimeoutTimer, _runWhenIdle } from '../common/async.js';\nimport { onUnexpectedError } from '../common/errors.js';\nimport * as event from '../common/event.js';\nimport * as dompurify from './dompurify/dompurify.js';\nimport { Disposable, DisposableStore, toDisposable } from '../common/lifecycle.js';\nimport { FileAccess, RemoteAuthorities, Schemas } from '../common/network.js';\nimport * as platform from '../common/platform.js';\nimport { URI } from '../common/uri.js';\nimport { hash } from '../common/hash.js';\nimport { ensureCodeWindow, mainWindow } from './window.js';\n//# region Multi-Window Support Utilities\nexport const { registerWindow, getWindow, getDocument, getWindows, getWindowsCount, getWindowId, getWindowById, hasWindow, onDidRegisterWindow, onWillUnregisterWindow, onDidUnregisterWindow } = (function () {\n const windows = new Map();\n ensureCodeWindow(mainWindow, 1);\n windows.set(mainWindow.vscodeWindowId, { window: mainWindow, disposables: new DisposableStore() });\n const onDidRegisterWindow = new event.Emitter();\n const onDidUnregisterWindow = new event.Emitter();\n const onWillUnregisterWindow = new event.Emitter();\n return {\n onDidRegisterWindow: onDidRegisterWindow.event,\n onWillUnregisterWindow: onWillUnregisterWindow.event,\n onDidUnregisterWindow: onDidUnregisterWindow.event,\n registerWindow(window) {\n if (windows.has(window.vscodeWindowId)) {\n return Disposable.None;\n }\n const disposables = new DisposableStore();\n const registeredWindow = {\n window,\n disposables: disposables.add(new DisposableStore())\n };\n windows.set(window.vscodeWindowId, registeredWindow);\n disposables.add(toDisposable(() => {\n windows.delete(window.vscodeWindowId);\n onDidUnregisterWindow.fire(window);\n }));\n disposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n onWillUnregisterWindow.fire(window);\n }));\n onDidRegisterWindow.fire(registeredWindow);\n return disposables;\n },\n getWindows() {\n return windows.values();\n },\n getWindowsCount() {\n return windows.size;\n },\n getWindowId(targetWindow) {\n return targetWindow.vscodeWindowId;\n },\n hasWindow(windowId) {\n return windows.has(windowId);\n },\n getWindowById(windowId) {\n return windows.get(windowId);\n },\n getWindow(e) {\n const candidateNode = e;\n if (candidateNode?.ownerDocument?.defaultView) {\n return candidateNode.ownerDocument.defaultView.window;\n }\n const candidateEvent = e;\n if (candidateEvent?.view) {\n return candidateEvent.view.window;\n }\n return mainWindow;\n },\n getDocument(e) {\n const candidateNode = e;\n return getWindow(candidateNode).document;\n }\n };\n})();\n//#endregion\nexport function clearNode(node) {\n while (node.firstChild) {\n node.firstChild.remove();\n }\n}\nclass DomListener {\n constructor(node, type, handler, options) {\n this._node = node;\n this._type = type;\n this._handler = handler;\n this._options = (options || false);\n this._node.addEventListener(this._type, this._handler, this._options);\n }\n dispose() {\n if (!this._handler) {\n // Already disposed\n return;\n }\n this._node.removeEventListener(this._type, this._handler, this._options);\n // Prevent leakers from holding on to the dom or handler func\n this._node = null;\n this._handler = null;\n }\n}\nexport function addDisposableListener(node, type, handler, useCaptureOrOptions) {\n return new DomListener(node, type, handler, useCaptureOrOptions);\n}\nfunction _wrapAsStandardMouseEvent(targetWindow, handler) {\n return function (e) {\n return handler(new StandardMouseEvent(targetWindow, e));\n };\n}\nfunction _wrapAsStandardKeyboardEvent(handler) {\n return function (e) {\n return handler(new StandardKeyboardEvent(e));\n };\n}\nexport const addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {\n let wrapHandler = handler;\n if (type === 'click' || type === 'mousedown') {\n wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n }\n else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n wrapHandler = _wrapAsStandardKeyboardEvent(handler);\n }\n return addDisposableListener(node, type, wrapHandler, useCapture);\n};\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node, handler, useCapture) {\n const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n return addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node, handler, useCapture) {\n const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n return addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\nexport function addDisposableGenericMouseMoveListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\nexport function addDisposableGenericMouseUpListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\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, callback, timeout) {\n return _runWhenIdle(targetWindow, callback, timeout);\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 extends AbstractIdleValue {\n constructor(targetWindow, executor) {\n super(targetWindow, executor);\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;\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;\nexport function disposableWindowInterval(targetWindow, handler, interval, iterations) {\n let iteration = 0;\n const timer = targetWindow.setInterval(() => {\n iteration++;\n if ((typeof iterations === 'number' && iteration >= iterations) || handler() === true) {\n disposable.dispose();\n }\n }, interval);\n const disposable = toDisposable(() => {\n targetWindow.clearInterval(timer);\n });\n return disposable;\n}\nexport class WindowIntervalTimer extends IntervalTimer {\n cancelAndSet(runner, interval, targetWindow) {\n return super.cancelAndSet(runner, interval, targetWindow);\n }\n}\nclass AnimationFrameQueueItem {\n constructor(runner, priority = 0) {\n this._runner = runner;\n this.priority = priority;\n this._canceled = false;\n }\n dispose() {\n this._canceled = true;\n }\n execute() {\n if (this._canceled) {\n return;\n }\n try {\n this._runner();\n }\n catch (e) {\n onUnexpectedError(e);\n }\n }\n // Sort by priority (largest to lowest)\n static sort(a, b) {\n return b.priority - a.priority;\n }\n}\n(function () {\n /**\n * The runners scheduled at the next animation frame\n */\n const NEXT_QUEUE = new Map();\n /**\n * The runners scheduled at the current animation frame\n */\n const CURRENT_QUEUE = new Map();\n /**\n * A flag to keep track if the native requestAnimationFrame was already called\n */\n const animFrameRequested = new Map();\n /**\n * A flag to indicate if currently handling a native requestAnimationFrame callback\n */\n const inAnimationFrameRunner = new Map();\n const animationFrameRunner = (targetWindowId) => {\n animFrameRequested.set(targetWindowId, false);\n const currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n CURRENT_QUEUE.set(targetWindowId, currentQueue);\n NEXT_QUEUE.set(targetWindowId, []);\n inAnimationFrameRunner.set(targetWindowId, true);\n while (currentQueue.length > 0) {\n currentQueue.sort(AnimationFrameQueueItem.sort);\n const top = currentQueue.shift();\n top.execute();\n }\n inAnimationFrameRunner.set(targetWindowId, false);\n };\n scheduleAtNextAnimationFrame = (targetWindow, runner, priority = 0) => {\n const targetWindowId = getWindowId(targetWindow);\n const item = new AnimationFrameQueueItem(runner, priority);\n let nextQueue = NEXT_QUEUE.get(targetWindowId);\n if (!nextQueue) {\n nextQueue = [];\n NEXT_QUEUE.set(targetWindowId, nextQueue);\n }\n nextQueue.push(item);\n if (!animFrameRequested.get(targetWindowId)) {\n animFrameRequested.set(targetWindowId, true);\n targetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n }\n return item;\n };\n runAtThisOrScheduleAtNextAnimationFrame = (targetWindow, runner, priority) => {\n const targetWindowId = getWindowId(targetWindow);\n if (inAnimationFrameRunner.get(targetWindowId)) {\n const item = new AnimationFrameQueueItem(runner, priority);\n let currentQueue = CURRENT_QUEUE.get(targetWindowId);\n if (!currentQueue) {\n currentQueue = [];\n CURRENT_QUEUE.set(targetWindowId, currentQueue);\n }\n currentQueue.push(item);\n return item;\n }\n else {\n return scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n }\n };\n})();\nexport function measure(targetWindow, callback) {\n return scheduleAtNextAnimationFrame(targetWindow, callback, 10000 /* must be early */);\n}\nexport function modify(targetWindow, callback) {\n return scheduleAtNextAnimationFrame(targetWindow, callback, -10000 /* must be late */);\n}\nconst MINIMUM_TIME_MS = 8;\nconst DEFAULT_EVENT_MERGER = function (lastEvent, currentEvent) {\n return currentEvent;\n};\nclass TimeoutThrottledDomListener extends Disposable {\n constructor(node, type, handler, eventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs = MINIMUM_TIME_MS) {\n super();\n let lastEvent = null;\n let lastHandlerTime = 0;\n const timeout = this._register(new TimeoutTimer());\n const invokeHandler = () => {\n lastHandlerTime = (new Date()).getTime();\n handler(lastEvent);\n lastEvent = null;\n };\n this._register(addDisposableListener(node, type, (e) => {\n lastEvent = eventMerger(lastEvent, e);\n const elapsedTime = (new Date()).getTime() - lastHandlerTime;\n if (elapsedTime >= minimumTimeMs) {\n timeout.cancel();\n invokeHandler();\n }\n else {\n timeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);\n }\n }));\n }\n}\nexport function addDisposableThrottledListener(node, type, handler, eventMerger, minimumTimeMs) {\n return new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);\n}\nexport function getComputedStyle(el) {\n return getWindow(el).getComputedStyle(el, null);\n}\nexport function getClientArea(element, fallback) {\n const elWindow = getWindow(element);\n const elDocument = elWindow.document;\n // Try with DOM clientWidth / clientHeight\n if (element !== elDocument.body) {\n return new Dimension(element.clientWidth, element.clientHeight);\n }\n // 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 if (platform.isIOS && elWindow?.visualViewport) {\n return new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n }\n // Try innerWidth / innerHeight\n if (elWindow?.innerWidth && elWindow.innerHeight) {\n return new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n }\n // Try with document.body.clientWidth / document.body.clientHeight\n if (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n return new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n }\n // Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n if (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n return new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n }\n if (fallback) {\n return getClientArea(fallback);\n }\n throw new Error('Unable to figure out browser width and height');\n}\nclass SizeUtils {\n // Adapted from WinJS\n // Converts a CSS positioning string for the specified element to pixels.\n static convertToPixels(element, value) {\n return parseFloat(value) || 0;\n }\n static getDimension(element, cssPropertyName, jsPropertyName) {\n const computedStyle = getComputedStyle(element);\n const value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n return SizeUtils.convertToPixels(element, value);\n }\n static getBorderLeftWidth(element) {\n return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');\n }\n static getBorderRightWidth(element) {\n return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');\n }\n static getBorderTopWidth(element) {\n return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');\n }\n static getBorderBottomWidth(element) {\n return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');\n }\n static getPaddingLeft(element) {\n return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');\n }\n static getPaddingRight(element) {\n return SizeUtils.getDimension(element, 'padding-right', 'paddingRight');\n }\n static getPaddingTop(element) {\n return SizeUtils.getDimension(element, 'padding-top', 'paddingTop');\n }\n static getPaddingBottom(element) {\n return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');\n }\n static getMarginLeft(element) {\n return SizeUtils.getDimension(element, 'margin-left', 'marginLeft');\n }\n static getMarginTop(element) {\n return SizeUtils.getDimension(element, 'margin-top', 'marginTop');\n }\n static getMarginRight(element) {\n return SizeUtils.getDimension(element, 'margin-right', 'marginRight');\n }\n static getMarginBottom(element) {\n return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');\n }\n}\nexport class Dimension {\n constructor(width, height) {\n this.width = width;\n this.height = height;\n }\n with(width = this.width, height = this.height) {\n if (width !== this.width || height !== this.height) {\n return new Dimension(width, height);\n }\n else {\n return this;\n }\n }\n static is(obj) {\n return typeof obj === 'object' && typeof obj.height === 'number' && typeof obj.width === 'number';\n }\n static lift(obj) {\n if (obj instanceof Dimension) {\n return obj;\n }\n else {\n return new Dimension(obj.width, obj.height);\n }\n }\n static equals(a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.width === b.width && a.height === b.height;\n }\n}\nDimension.None = new Dimension(0, 0);\nexport function getTopLeftOffset(element) {\n // Adapted from WinJS.Utilities.getPosition\n // and added borders to the mix\n let offsetParent = element.offsetParent;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n while ((element = element.parentNode) !== null\n && element !== element.ownerDocument.body\n && element !== element.ownerDocument.documentElement) {\n top -= element.scrollTop;\n const c = isShadowRoot(element) ? null : getComputedStyle(element);\n if (c) {\n left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n }\n if (element === offsetParent) {\n left += SizeUtils.getBorderLeftWidth(element);\n top += SizeUtils.getBorderTopWidth(element);\n top += element.offsetTop;\n left += element.offsetLeft;\n offsetParent = element.offsetParent;\n }\n }\n return {\n left: left,\n top: top\n };\n}\nexport function size(element, width, height) {\n if (typeof width === 'number') {\n element.style.width = `${width}px`;\n }\n if (typeof height === 'number') {\n element.style.height = `${height}px`;\n }\n}\nexport function position(element, top, right, bottom, left, position = 'absolute') {\n if (typeof top === 'number') {\n element.style.top = `${top}px`;\n }\n if (typeof right === 'number') {\n element.style.right = `${right}px`;\n }\n if (typeof bottom === 'number') {\n element.style.bottom = `${bottom}px`;\n }\n if (typeof left === 'number') {\n element.style.left = `${left}px`;\n }\n element.style.position = position;\n}\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode) {\n const bb = domNode.getBoundingClientRect();\n const window = getWindow(domNode);\n return {\n left: bb.left + window.scrollX,\n top: bb.top + window.scrollY,\n width: bb.width,\n height: bb.height\n };\n}\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode) {\n let testElement = domNode;\n let zoom = 1.0;\n do {\n const elementZoomLevel = getComputedStyle(testElement).zoom;\n if (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n zoom *= elementZoomLevel;\n }\n testElement = testElement.parentElement;\n } while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n return zoom;\n}\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element) {\n const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n return element.offsetWidth + margin;\n}\nexport function getContentWidth(element) {\n const border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n const padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n return element.offsetWidth - border - padding;\n}\nexport function getTotalScrollWidth(element) {\n const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n return element.scrollWidth + margin;\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) {\n const border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n const padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n return element.offsetHeight - border - padding;\n}\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element) {\n const margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n return element.offsetHeight + margin;\n}\n// Gets the left coordinate of the specified element relative to the specified parent.\nfunction getRelativeLeft(element, parent) {\n if (element === null) {\n return 0;\n }\n const elementPosition = getTopLeftOffset(element);\n const parentPosition = getTopLeftOffset(parent);\n return elementPosition.left - parentPosition.left;\n}\nexport function getLargestChildWidth(parent, children) {\n const childWidths = children.map((child) => {\n return Math.max(getTotalScrollWidth(child), getTotalWidth(child)) + getRelativeLeft(child, parent) || 0;\n });\n const maxWidth = Math.max(...childWidths);\n return maxWidth;\n}\n// ----------------------------------------------------------------------------------------\nexport function isAncestor(testChild, testAncestor) {\n return Boolean(testAncestor?.contains(testChild));\n}\nconst parentFlowToDataKey = 'parentFlowToElementId';\n/**\n * Set an explicit parent to use for nodes that are not part of the\n * regular dom structure.\n */\nexport function setParentFlowTo(fromChildElement, toParentElement) {\n fromChildElement.dataset[parentFlowToDataKey] = toParentElement.id;\n}\nfunction getParentFlowToElement(node) {\n const flowToParentId = node.dataset[parentFlowToDataKey];\n if (typeof flowToParentId === 'string') {\n return node.ownerDocument.getElementById(flowToParentId);\n }\n return null;\n}\n/**\n * Check if `testAncestor` is an ancestor of `testChild`, observing the explicit\n * parents set by `setParentFlowTo`.\n */\nexport function isAncestorUsingFlowTo(testChild, testAncestor) {\n let node = testChild;\n while (node) {\n if (node === testAncestor) {\n return true;\n }\n if (node instanceof HTMLElement) {\n const flowToParentElement = getParentFlowToElement(node);\n if (flowToParentElement) {\n node = flowToParentElement;\n continue;\n }\n }\n node = node.parentNode;\n }\n return false;\n}\nexport function findParentWithClass(node, clazz, stopAtClazzOrNode) {\n while (node && node.nodeType === node.ELEMENT_NODE) {\n if (node.classList.contains(clazz)) {\n return node;\n }\n if (stopAtClazzOrNode) {\n if (typeof stopAtClazzOrNode === 'string') {\n if (node.classList.contains(stopAtClazzOrNode)) {\n return null;\n }\n }\n else {\n if (node === stopAtClazzOrNode) {\n return null;\n }\n }\n }\n node = node.parentNode;\n }\n return null;\n}\nexport function hasParentWithClass(node, clazz, stopAtClazzOrNode) {\n return !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\nexport function isShadowRoot(node) {\n return (node && !!node.host && !!node.mode);\n}\nexport function isInShadowDOM(domNode) {\n return !!getShadowRoot(domNode);\n}\nexport function getShadowRoot(domNode) {\n while (domNode.parentNode) {\n if (domNode === domNode.ownerDocument?.body) {\n // reached the body\n return null;\n }\n domNode = domNode.parentNode;\n }\n return isShadowRoot(domNode) ? domNode : null;\n}\n/**\n * Returns the active element across all child windows.\n * Use this instead of `document.activeElement` to handle multiple windows.\n */\nexport function getActiveElement() {\n let result = getActiveDocument().activeElement;\n while (result?.shadowRoot) {\n result = result.shadowRoot.activeElement;\n }\n return result;\n}\n/**\n * Returns whether the active element of the `document` that owns\n * the `element` is `element`.\n */\nexport function isActiveElement(element) {\n return element.ownerDocument.activeElement === element;\n}\n/**\n * Returns whether the active element of the `document` that owns\n * the `ancestor` is contained in `ancestor`.\n */\nexport function isAncestorOfActiveElement(ancestor) {\n return isAncestor(ancestor.ownerDocument.activeElement, ancestor);\n}\n/**\n * Returns whether the element is in the active `document`.\n */\nexport function isActiveDocument(element) {\n return element.ownerDocument === getActiveDocument();\n}\n/**\n * Returns the active document across all child windows.\n * Use this instead of `document` when reacting to dom\n * events to handle multiple windows.\n */\nexport function getActiveDocument() {\n if (getWindowsCount() <= 1) {\n return document;\n }\n const documents = Array.from(getWindows()).map(({ window }) => window.document);\n return documents.find(doc => doc.hasFocus()) ?? document;\n}\nexport function getActiveWindow() {\n const document = getActiveDocument();\n return (document.defaultView?.window ?? mainWindow);\n}\nexport function focusWindow(element) {\n const window = getWindow(element);\n if (!window.document.hasFocus()) {\n window.focus();\n }\n}\nconst globalStylesheets = new Map();\nexport function isGlobalStylesheet(node) {\n return globalStylesheets.has(node);\n}\nexport function createStyleSheet(container = mainWindow.document.head, beforeAppend, disposableStore) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.media = 'screen';\n beforeAppend?.(style);\n container.appendChild(style);\n if (disposableStore) {\n disposableStore.add(toDisposable(() => container.removeChild(style)));\n }\n // With as container, the stylesheet becomes global and is tracked\n // to support auxiliary windows to clone the stylesheet.\n if (container === mainWindow.document.head) {\n const globalStylesheetClones = new Set();\n globalStylesheets.set(style, globalStylesheetClones);\n for (const { window: targetWindow, disposables } of getWindows()) {\n if (targetWindow === mainWindow) {\n continue; // main window is already tracked\n }\n const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));\n disposableStore?.add(cloneDisposable);\n }\n }\n return style;\n}\nexport function cloneGlobalStylesheets(targetWindow) {\n const disposables = new DisposableStore();\n for (const [globalStylesheet, clonedGlobalStylesheets] of globalStylesheets) {\n disposables.add(cloneGlobalStyleSheet(globalStylesheet, clonedGlobalStylesheets, targetWindow));\n }\n return disposables;\n}\nfunction cloneGlobalStyleSheet(globalStylesheet, globalStylesheetClones, targetWindow) {\n const disposables = new DisposableStore();\n const clone = globalStylesheet.cloneNode(true);\n targetWindow.document.head.appendChild(clone);\n disposables.add(toDisposable(() => targetWindow.document.head.removeChild(clone)));\n for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {\n clone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);\n }\n disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {\n clone.textContent = globalStylesheet.textContent;\n }));\n globalStylesheetClones.add(clone);\n disposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));\n return disposables;\n}\nexport const sharedMutationObserver = new class {\n constructor() {\n this.mutationObservers = new Map();\n }\n observe(target, disposables, options) {\n let mutationObserversPerTarget = this.mutationObservers.get(target);\n if (!mutationObserversPerTarget) {\n mutationObserversPerTarget = new Map();\n this.mutationObservers.set(target, mutationObserversPerTarget);\n }\n const optionsHash = hash(options);\n let mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n if (!mutationObserverPerOptions) {\n const onDidMutate = new event.Emitter();\n const observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n observer.observe(target, options);\n const resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n users: 1,\n observer,\n onDidMutate: onDidMutate.event\n };\n disposables.add(toDisposable(() => {\n resolvedMutationObserverPerOptions.users -= 1;\n if (resolvedMutationObserverPerOptions.users === 0) {\n onDidMutate.dispose();\n observer.disconnect();\n mutationObserversPerTarget?.delete(optionsHash);\n if (mutationObserversPerTarget?.size === 0) {\n this.mutationObservers.delete(target);\n }\n }\n }));\n mutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n }\n else {\n mutationObserverPerOptions.users += 1;\n }\n return mutationObserverPerOptions.onDidMutate;\n }\n};\nexport function createMetaElement(container = mainWindow.document.head) {\n const meta = document.createElement('meta');\n container.appendChild(meta);\n return meta;\n}\nlet _sharedStyleSheet = null;\nfunction getSharedStyleSheet() {\n if (!_sharedStyleSheet) {\n _sharedStyleSheet = createStyleSheet();\n }\n return _sharedStyleSheet;\n}\nfunction getDynamicStyleSheetRules(style) {\n if (style?.sheet?.rules) {\n // Chrome, IE\n return style.sheet.rules;\n }\n if (style?.sheet?.cssRules) {\n // FF\n return style.sheet.cssRules;\n }\n return [];\n}\nexport function createCSSRule(selector, cssText, style = getSharedStyleSheet()) {\n if (!style || !cssText) {\n return;\n }\n style.sheet?.insertRule(`${selector} {${cssText}}`, 0);\n // Apply rule also to all cloned global stylesheets\n for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n createCSSRule(selector, cssText, clonedGlobalStylesheet);\n }\n}\nexport function removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) {\n if (!style) {\n return;\n }\n const rules = getDynamicStyleSheetRules(style);\n const toDelete = [];\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {\n toDelete.push(i);\n }\n }\n for (let i = toDelete.length - 1; i >= 0; i--) {\n style.sheet?.deleteRule(toDelete[i]);\n }\n // Remove rules also from all cloned global stylesheets\n for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);\n }\n}\nfunction isCSSStyleRule(rule) {\n return typeof rule.selectorText === 'string';\n}\nexport function isMouseEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof MouseEvent || e instanceof getWindow(e).MouseEvent;\n}\nexport function isKeyboardEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof KeyboardEvent || e instanceof getWindow(e).KeyboardEvent;\n}\nexport function isPointerEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof PointerEvent || e instanceof getWindow(e).PointerEvent;\n}\nexport function isDragEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof DragEvent || e instanceof getWindow(e).DragEvent;\n}\nexport const EventType = {\n // Mouse\n CLICK: 'click',\n AUXCLICK: 'auxclick',\n DBLCLICK: 'dblclick',\n MOUSE_UP: 'mouseup',\n MOUSE_DOWN: 'mousedown',\n MOUSE_OVER: 'mouseover',\n MOUSE_MOVE: 'mousemove',\n MOUSE_OUT: 'mouseout',\n MOUSE_ENTER: 'mouseenter',\n MOUSE_LEAVE: 'mouseleave',\n MOUSE_WHEEL: 'wheel',\n POINTER_UP: 'pointerup',\n POINTER_DOWN: 'pointerdown',\n POINTER_MOVE: 'pointermove',\n POINTER_LEAVE: 'pointerleave',\n CONTEXT_MENU: 'contextmenu',\n WHEEL: 'wheel',\n // Keyboard\n KEY_DOWN: 'keydown',\n KEY_PRESS: 'keypress',\n KEY_UP: 'keyup',\n // HTML Document\n LOAD: 'load',\n BEFORE_UNLOAD: 'beforeunload',\n UNLOAD: 'unload',\n PAGE_SHOW: 'pageshow',\n PAGE_HIDE: 'pagehide',\n PASTE: 'paste',\n ABORT: 'abort',\n ERROR: 'error',\n RESIZE: 'resize',\n SCROLL: 'scroll',\n FULLSCREEN_CHANGE: 'fullscreenchange',\n WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n // Form\n SELECT: 'select',\n CHANGE: 'change',\n SUBMIT: 'submit',\n RESET: 'reset',\n FOCUS: 'focus',\n FOCUS_IN: 'focusin',\n FOCUS_OUT: 'focusout',\n BLUR: 'blur',\n INPUT: 'input',\n // Local Storage\n STORAGE: 'storage',\n // Drag\n DRAG_START: 'dragstart',\n DRAG: 'drag',\n DRAG_ENTER: 'dragenter',\n DRAG_LEAVE: 'dragleave',\n DRAG_OVER: 'dragover',\n DROP: 'drop',\n DRAG_END: 'dragend',\n // Animation\n ANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n ANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n ANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n};\nexport function isEventLike(obj) {\n const candidate = obj;\n return !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\nexport const EventHelper = {\n stop: (e, cancelBubble) => {\n e.preventDefault();\n if (cancelBubble) {\n e.stopPropagation();\n }\n return e;\n }\n};\nexport function saveParentsScrollTop(node) {\n const r = [];\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n r[i] = node.scrollTop;\n node = node.parentNode;\n }\n return r;\n}\nexport function restoreParentsScrollTop(node, state) {\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n if (node.scrollTop !== state[i]) {\n node.scrollTop = state[i];\n }\n node = node.parentNode;\n }\n}\nclass FocusTracker extends Disposable {\n static hasFocusWithin(element) {\n if (element instanceof HTMLElement) {\n const shadowRoot = getShadowRoot(element);\n const activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n return isAncestor(activeElement, element);\n }\n else {\n const window = element;\n return isAncestor(window.document.activeElement, window.document);\n }\n }\n constructor(element) {\n super();\n this._onDidFocus = this._register(new event.Emitter());\n this.onDidFocus = this._onDidFocus.event;\n this._onDidBlur = this._register(new event.Emitter());\n this.onDidBlur = this._onDidBlur.event;\n let hasFocus = FocusTracker.hasFocusWithin(element);\n let loosingFocus = false;\n const onFocus = () => {\n loosingFocus = false;\n if (!hasFocus) {\n hasFocus = true;\n this._onDidFocus.fire();\n }\n };\n const onBlur = () => {\n if (hasFocus) {\n loosingFocus = true;\n (element instanceof HTMLElement ? getWindow(element) : element).setTimeout(() => {\n if (loosingFocus) {\n loosingFocus = false;\n hasFocus = false;\n this._onDidBlur.fire();\n }\n }, 0);\n }\n };\n this._refreshStateHandler = () => {\n const currentNodeHasFocus = FocusTracker.hasFocusWithin(element);\n if (currentNodeHasFocus !== hasFocus) {\n if (hasFocus) {\n onBlur();\n }\n else {\n onFocus();\n }\n }\n };\n this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n this._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n if (element instanceof HTMLElement) {\n this._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n this._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n }\n }\n refreshState() {\n this._refreshStateHandler();\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) {\n return new FocusTracker(element);\n}\nexport function after(sibling, child) {\n sibling.after(child);\n return child;\n}\nexport function append(parent, ...children) {\n parent.append(...children);\n if (children.length === 1 && typeof children[0] !== 'string') {\n return children[0];\n }\n}\nexport function prepend(parent, child) {\n parent.insertBefore(child, parent.firstChild);\n return child;\n}\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent, ...children) {\n parent.innerText = '';\n append(parent, ...children);\n}\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\nexport var Namespace;\n(function (Namespace) {\n Namespace[\"HTML\"] = \"http://www.w3.org/1999/xhtml\";\n Namespace[\"SVG\"] = \"http://www.w3.org/2000/svg\";\n})(Namespace || (Namespace = {}));\nfunction _$(namespace, description, attrs, ...children) {\n const match = SELECTOR_REGEX.exec(description);\n if (!match) {\n throw new Error('Bad use of emmet');\n }\n const tagName = match[1] || 'div';\n let result;\n if (namespace !== Namespace.HTML) {\n result = document.createElementNS(namespace, tagName);\n }\n else {\n result = document.createElement(tagName);\n }\n if (match[3]) {\n result.id = match[3];\n }\n if (match[4]) {\n result.className = match[4].replace(/\\./g, ' ').trim();\n }\n if (attrs) {\n Object.entries(attrs).forEach(([name, value]) => {\n if (typeof value === 'undefined') {\n return;\n }\n if (/^on\\w+$/.test(name)) {\n result[name] = value;\n }\n else if (name === 'selected') {\n if (value) {\n result.setAttribute(name, 'true');\n }\n }\n else {\n result.setAttribute(name, value);\n }\n });\n }\n result.append(...children);\n return result;\n}\nexport function $(description, attrs, ...children) {\n return _$(Namespace.HTML, description, attrs, ...children);\n}\n$.SVG = function (description, attrs, ...children) {\n return _$(Namespace.SVG, description, attrs, ...children);\n};\nexport function join(nodes, separator) {\n const result = [];\n nodes.forEach((node, index) => {\n if (index > 0) {\n if (separator instanceof Node) {\n result.push(separator.cloneNode());\n }\n else {\n result.push(document.createTextNode(separator));\n }\n }\n result.push(node);\n });\n return result;\n}\nexport function setVisibility(visible, ...elements) {\n if (visible) {\n show(...elements);\n }\n else {\n hide(...elements);\n }\n}\nexport function show(...elements) {\n for (const element of elements) {\n element.style.display = '';\n element.removeAttribute('aria-hidden');\n }\n}\nexport function hide(...elements) {\n for (const element of elements) {\n element.style.display = 'none';\n element.setAttribute('aria-hidden', 'true');\n }\n}\nfunction findParentWithAttribute(node, attribute) {\n while (node && node.nodeType === node.ELEMENT_NODE) {\n if (node instanceof HTMLElement && node.hasAttribute(attribute)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n}\nexport function removeTabIndexAndUpdateFocus(node) {\n if (!node || !node.hasAttribute('tabIndex')) {\n return;\n }\n // If we are the currently focused element and tabIndex is removed,\n // standard DOM behavior is to move focus to the element. We\n // typically never want that, rather put focus to the closest element\n // in the hierarchy of the parent DOM nodes.\n if (node.ownerDocument.activeElement === node) {\n const parentFocusable = findParentWithAttribute(node.parentElement, 'tabIndex');\n parentFocusable?.focus();\n }\n node.removeAttribute('tabindex');\n}\nexport function finalHandler(fn) {\n return e => {\n e.preventDefault();\n e.stopPropagation();\n fn(e);\n };\n}\nexport function domContentLoaded(targetWindow) {\n return new Promise(resolve => {\n const readyState = targetWindow.document.readyState;\n if (readyState === 'complete' || (targetWindow.document && targetWindow.document.body !== null)) {\n resolve(undefined);\n }\n else {\n const listener = () => {\n targetWindow.window.removeEventListener('DOMContentLoaded', listener, false);\n resolve();\n };\n targetWindow.window.addEventListener('DOMContentLoaded', listener, false);\n }\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, cssPx) {\n const screenPx = window.devicePixelRatio * cssPx;\n return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\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) {\n // By using 'noopener' in the `windowFeatures` argument, the newly created window will\n // not be able to use `window.opener` to reach back to the current page.\n // See https://stackoverflow.com/a/46958731\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n // However, this also doesn't allow us to realize if the browser blocked\n // the creation of the window.\n mainWindow.open(url, '_blank', 'noopener');\n}\n/**\n * Open a new window in a popup. 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 * Note: this does not set {@link window.opener} to null. This is to allow the opened popup to\n * be able to use {@link window.close} to close itself. Because of this, you should only use\n * this function on urls that you trust.\n *\n * In otherwords, you should almost always use {@link windowOpenNoOpener} instead of this function.\n */\nconst popupWidth = 780, popupHeight = 640;\nexport function windowOpenPopup(url) {\n const left = Math.floor(mainWindow.screenLeft + mainWindow.innerWidth / 2 - popupWidth / 2);\n const top = Math.floor(mainWindow.screenTop + mainWindow.innerHeight / 2 - popupHeight / 2);\n mainWindow.open(url, '_blank', `width=${popupWidth},height=${popupHeight},top=${top},left=${left}`);\n}\n/**\n * Attempts to open a window and returns whether it succeeded. This technique is\n * not appropriate in certain contexts, like for example when the JS context is\n * executing inside a sandboxed iframe. If it is not necessary to know if the\n * browser blocked the new window, use {@link windowOpenNoOpener}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * See https://github.com/microsoft/monaco-editor/issues/2474\n * See https://mathiasbynens.github.io/rel-noopener/\n *\n * @param url the url to open\n * @param noOpener whether or not to set the {@link window.opener} to null. You should leave the default\n * (true) unless you trust the url that is being opened.\n * @returns boolean indicating if the {@link window.open} call succeeded\n */\nexport function windowOpenWithSuccess(url, noOpener = true) {\n const newTab = mainWindow.open();\n if (newTab) {\n if (noOpener) {\n // see `windowOpenNoOpener` for details on why this is important\n newTab.opener = null;\n }\n newTab.location.href = url;\n return true;\n }\n return false;\n}\nexport function animate(targetWindow, fn) {\n const step = () => {\n fn();\n stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n };\n let stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n return toDisposable(() => stepDisposable.dispose());\n}\nRemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http');\n/**\n * returns url('...')\n */\nexport function asCSSUrl(uri) {\n if (!uri) {\n return `url('')`;\n }\n return `url('${FileAccess.uriToBrowserUri(uri).toString(true).replace(/'/g, '%27')}')`;\n}\nexport function asCSSPropertyValue(value) {\n return `'${value.replace(/'/g, '%27')}'`;\n}\nexport function asCssValueWithDefault(cssPropertyValue, dflt) {\n if (cssPropertyValue !== undefined) {\n const variableMatch = cssPropertyValue.match(/^\\s*var\\((.+)\\)$/);\n if (variableMatch) {\n const varArguments = variableMatch[1].split(',', 2);\n if (varArguments.length === 2) {\n dflt = asCssValueWithDefault(varArguments[1].trim(), dflt);\n }\n return `var(${varArguments[0]}, ${dflt})`;\n }\n return cssPropertyValue;\n }\n return dflt;\n}\nexport function triggerDownload(dataOrUri, name) {\n // If the data is provided as Buffer, we create a\n // blob URL out of it to produce a valid link\n let url;\n if (URI.isUri(dataOrUri)) {\n url = dataOrUri.toString(true);\n }\n else {\n const blob = new Blob([dataOrUri]);\n url = URL.createObjectURL(blob);\n // Ensure to free the data from DOM eventually\n setTimeout(() => URL.revokeObjectURL(url));\n }\n // In order to download from the browser, the only way seems\n // to be creating a element with download attribute that\n // points to the file to download.\n // See also https://developers.google.com/web/updates/2011/08/Downloading-resources-in-HTML5-a-download\n const activeWindow = getActiveWindow();\n const anchor = document.createElement('a');\n activeWindow.document.body.appendChild(anchor);\n anchor.download = name;\n anchor.href = url;\n anchor.click();\n // Ensure to remove the element from DOM eventually\n setTimeout(() => activeWindow.document.body.removeChild(anchor));\n}\nexport function triggerUpload() {\n return new Promise(resolve => {\n // In order to upload to the browser, create a\n // input element of type `file` and click it\n // to gather the selected files\n const activeWindow = getActiveWindow();\n const input = document.createElement('input');\n activeWindow.document.body.appendChild(input);\n input.type = 'file';\n input.multiple = true;\n // Resolve once the input event has fired once\n event.Event.once(event.Event.fromDOMEventEmitter(input, 'input'))(() => {\n resolve(input.files ?? undefined);\n });\n input.click();\n // Ensure to remove the element from DOM eventually\n setTimeout(() => activeWindow.document.body.removeChild(input));\n });\n}\nexport var DetectedFullscreenMode;\n(function (DetectedFullscreenMode) {\n /**\n * The document is fullscreen, e.g. because an element\n * in the document requested to be fullscreen.\n */\n DetectedFullscreenMode[DetectedFullscreenMode[\"DOCUMENT\"] = 1] = \"DOCUMENT\";\n /**\n * The browser is fullscreen, e.g. because the user enabled\n * native window fullscreen for it.\n */\n DetectedFullscreenMode[DetectedFullscreenMode[\"BROWSER\"] = 2] = \"BROWSER\";\n})(DetectedFullscreenMode || (DetectedFullscreenMode = {}));\nexport function detectFullscreen(targetWindow) {\n // Browser fullscreen: use DOM APIs to detect\n if (targetWindow.document.fullscreenElement || targetWindow.document.webkitFullscreenElement || targetWindow.document.webkitIsFullScreen) {\n return { mode: DetectedFullscreenMode.DOCUMENT, guess: false };\n }\n // There is no standard way to figure out if the browser\n // is using native fullscreen. Via checking on screen\n // height and comparing that to window height, we can guess\n // it though.\n if (targetWindow.innerHeight === targetWindow.screen.height) {\n // if the height of the window matches the screen height, we can\n // safely assume that the browser is fullscreen because no browser\n // chrome is taking height away (e.g. like toolbars).\n return { mode: DetectedFullscreenMode.BROWSER, guess: false };\n }\n if (platform.isMacintosh || platform.isLinux) {\n // macOS and Linux do not properly report `innerHeight`, only Windows does\n if (targetWindow.outerHeight === targetWindow.screen.height && targetWindow.outerWidth === targetWindow.screen.width) {\n // if the height of the browser matches the screen height, we can\n // only guess that we are in fullscreen. It is also possible that\n // the user has turned off taskbars in the OS and the browser is\n // simply able to span the entire size of the screen.\n return { mode: DetectedFullscreenMode.BROWSER, guess: true };\n }\n }\n // Not in fullscreen\n return null;\n}\n// -- sanitize and trusted html\n/**\n * Hooks dompurify using `afterSanitizeAttributes` to check that all `href` and `src`\n * attributes are valid.\n */\nexport function hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, allowDataImages = false) {\n // https://github.com/cure53/DOMPurify/blob/main/demos/hooks-scheme-allowlist.html\n // build an anchor to map URLs to\n const anchor = document.createElement('a');\n dompurify.addHook('afterSanitizeAttributes', (node) => {\n // check all href/src attributes for validity\n for (const attr of ['href', 'src']) {\n if (node.hasAttribute(attr)) {\n const attrValue = node.getAttribute(attr);\n if (attr === 'href' && attrValue.startsWith('#')) {\n // Allow fragment links\n continue;\n }\n anchor.href = attrValue;\n if (!allowedProtocols.includes(anchor.protocol.replace(/:$/, ''))) {\n if (allowDataImages && attr === 'src' && anchor.href.startsWith('data:')) {\n continue;\n }\n node.removeAttribute(attr);\n }\n }\n }\n });\n return toDisposable(() => {\n dompurify.removeHook('afterSanitizeAttributes');\n });\n}\nconst defaultSafeProtocols = [\n Schemas.http,\n Schemas.https,\n Schemas.command,\n];\n/**\n * List of safe, non-input html tags.\n */\nexport const basicMarkupHtmlTags = Object.freeze([\n 'a',\n 'abbr',\n 'b',\n 'bdo',\n 'blockquote',\n 'br',\n 'caption',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'figure',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'hr',\n 'i',\n 'img',\n 'ins',\n 'kbd',\n 'label',\n 'li',\n 'mark',\n 'ol',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 'samp',\n 'small',\n 'small',\n 'source',\n 'span',\n 'strike',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n]);\nconst defaultDomPurifyConfig = Object.freeze({\n ALLOWED_TAGS: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'],\n ALLOWED_ATTR: ['href', 'data-href', 'data-command', 'target', 'title', 'name', 'src', 'alt', 'class', 'id', 'role', 'tabindex', 'style', 'data-code', 'width', 'height', 'align', 'x-dispatch', 'required', 'checked', 'placeholder', 'type', 'start'],\n RETURN_DOM: false,\n RETURN_DOM_FRAGMENT: false,\n RETURN_TRUSTED_TYPE: true\n});\n/**\n * Sanitizes the given `value` and reset the given `node` with it.\n */\nexport function safeInnerHtml(node, value) {\n const hook = hookDomPurifyHrefAndSrcSanitizer(defaultSafeProtocols);\n try {\n const html = dompurify.sanitize(value, defaultDomPurifyConfig);\n node.innerHTML = html;\n }\n finally {\n hook.dispose();\n }\n}\n/**\n * Convert a Unicode string to a string in which each 16-bit unit occupies only one byte\n *\n * From https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa\n */\nfunction toBinary(str) {\n const codeUnits = new Uint16Array(str.length);\n for (let i = 0; i < codeUnits.length; i++) {\n codeUnits[i] = str.charCodeAt(i);\n }\n let binary = '';\n const uint8array = new Uint8Array(codeUnits.buffer);\n for (let i = 0; i < uint8array.length; i++) {\n binary += String.fromCharCode(uint8array[i]);\n }\n return binary;\n}\n/**\n * Version of the global `btoa` function that handles multi-byte characters instead\n * of throwing an exception.\n */\nexport function multibyteAwareBtoa(str) {\n return btoa(toBinary(str));\n}\nexport class ModifierKeyEmitter extends event.Emitter {\n constructor() {\n super();\n this._subscriptions = new DisposableStore();\n this._keyStatus = {\n altKey: false,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false\n };\n this._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n }\n registerListeners(window, disposables) {\n disposables.add(addDisposableListener(window, 'keydown', e => {\n if (e.defaultPrevented) {\n return;\n }\n const event = new StandardKeyboardEvent(e);\n // If Alt-key keydown event is repeated, ignore it #112347\n // Only known to be necessary for Alt-Key at the moment #115810\n if (event.keyCode === 6 /* KeyCode.Alt */ && e.repeat) {\n return;\n }\n if (e.altKey && !this._keyStatus.altKey) {\n this._keyStatus.lastKeyPressed = 'alt';\n }\n else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n this._keyStatus.lastKeyPressed = 'ctrl';\n }\n else if (e.metaKey && !this._keyStatus.metaKey) {\n this._keyStatus.lastKeyPressed = 'meta';\n }\n else if (e.shiftKey && !this._keyStatus.shiftKey) {\n this._keyStatus.lastKeyPressed = 'shift';\n }\n else if (event.keyCode !== 6 /* KeyCode.Alt */) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n else {\n return;\n }\n this._keyStatus.altKey = e.altKey;\n this._keyStatus.ctrlKey = e.ctrlKey;\n this._keyStatus.metaKey = e.metaKey;\n this._keyStatus.shiftKey = e.shiftKey;\n if (this._keyStatus.lastKeyPressed) {\n this._keyStatus.event = e;\n this.fire(this._keyStatus);\n }\n }, true));\n disposables.add(addDisposableListener(window, 'keyup', e => {\n if (e.defaultPrevented) {\n return;\n }\n if (!e.altKey && this._keyStatus.altKey) {\n this._keyStatus.lastKeyReleased = 'alt';\n }\n else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n this._keyStatus.lastKeyReleased = 'ctrl';\n }\n else if (!e.metaKey && this._keyStatus.metaKey) {\n this._keyStatus.lastKeyReleased = 'meta';\n }\n else if (!e.shiftKey && this._keyStatus.shiftKey) {\n this._keyStatus.lastKeyReleased = 'shift';\n }\n else {\n this._keyStatus.lastKeyReleased = undefined;\n }\n if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n this._keyStatus.altKey = e.altKey;\n this._keyStatus.ctrlKey = e.ctrlKey;\n this._keyStatus.metaKey = e.metaKey;\n this._keyStatus.shiftKey = e.shiftKey;\n if (this._keyStatus.lastKeyReleased) {\n this._keyStatus.event = e;\n this.fire(this._keyStatus);\n }\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n this._keyStatus.lastKeyPressed = undefined;\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n this._keyStatus.lastKeyPressed = undefined;\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n if (e.buttons) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n }, true));\n disposables.add(addDisposableListener(window, 'blur', () => {\n this.resetKeyStatus();\n }));\n }\n get keyStatus() {\n return this._keyStatus;\n }\n get isModifierPressed() {\n return this._keyStatus.altKey || this._keyStatus.ctrlKey || this._keyStatus.metaKey || this._keyStatus.shiftKey;\n }\n /**\n * Allows to explicitly reset the key status based on more knowledge (#109062)\n */\n resetKeyStatus() {\n this.doResetKeyStatus();\n this.fire(this._keyStatus);\n }\n doResetKeyStatus() {\n this._keyStatus = {\n altKey: false,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false\n };\n }\n static getInstance() {\n if (!ModifierKeyEmitter.instance) {\n ModifierKeyEmitter.instance = new ModifierKeyEmitter();\n }\n return ModifierKeyEmitter.instance;\n }\n dispose() {\n super.dispose();\n this._subscriptions.dispose();\n }\n}\nexport function getCookieValue(name) {\n const match = document.cookie.match('(^|[^;]+)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531\n return match ? match.pop() : undefined;\n}\nexport class DragAndDropObserver extends Disposable {\n constructor(element, callbacks) {\n super();\n this.element = element;\n this.callbacks = callbacks;\n // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n // calls see https://github.com/microsoft/vscode/issues/14470\n // when the element has child elements where the events are fired\n // repeadedly.\n this.counter = 0;\n // Allows to measure the duration of the drag operation.\n this.dragStartTime = 0;\n this.registerListeners();\n }\n registerListeners() {\n if (this.callbacks.onDragStart) {\n this._register(addDisposableListener(this.element, EventType.DRAG_START, (e) => {\n this.callbacks.onDragStart?.(e);\n }));\n }\n if (this.callbacks.onDrag) {\n this._register(addDisposableListener(this.element, EventType.DRAG, (e) => {\n this.callbacks.onDrag?.(e);\n }));\n }\n this._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e) => {\n this.counter++;\n this.dragStartTime = e.timeStamp;\n this.callbacks.onDragEnter?.(e);\n }));\n this._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e) => {\n e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n this.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n }));\n this._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e) => {\n this.counter--;\n if (this.counter === 0) {\n this.dragStartTime = 0;\n this.callbacks.onDragLeave?.(e);\n }\n }));\n this._register(addDisposableListener(this.element, EventType.DRAG_END, (e) => {\n this.counter = 0;\n this.dragStartTime = 0;\n this.callbacks.onDragEnd?.(e);\n }));\n this._register(addDisposableListener(this.element, EventType.DROP, (e) => {\n this.counter = 0;\n this.dragStartTime = 0;\n this.callbacks.onDrop?.(e);\n }));\n }\n}\nconst H_REGEX = /(?[\\w\\-]+)?(?:#(?[\\w\\-]+))?(?(?:\\.(?:[\\w\\-]+))*)(?:@(?(?:[\\w\\_])+))?/;\nexport function h(tag, ...args) {\n let attributes;\n let children;\n if (Array.isArray(args[0])) {\n attributes = {};\n children = args[0];\n }\n else {\n attributes = args[0] || {};\n children = args[1];\n }\n const match = H_REGEX.exec(tag);\n if (!match || !match.groups) {\n throw new Error('Bad use of h');\n }\n const tagName = match.groups['tag'] || 'div';\n const el = document.createElement(tagName);\n if (match.groups['id']) {\n el.id = match.groups['id'];\n }\n const classNames = [];\n if (match.groups['class']) {\n for (const className of match.groups['class'].split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (attributes.className !== undefined) {\n for (const className of attributes.className.split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (classNames.length > 0) {\n el.className = classNames.join(' ');\n }\n const result = {};\n if (match.groups['name']) {\n result[match.groups['name']] = el;\n }\n if (children) {\n for (const c of children) {\n if (c instanceof HTMLElement) {\n el.appendChild(c);\n }\n else if (typeof c === 'string') {\n el.append(c);\n }\n else if ('root' in c) {\n Object.assign(result, c);\n el.appendChild(c.root);\n }\n }\n }\n for (const [key, value] of Object.entries(attributes)) {\n if (key === 'className') {\n continue;\n }\n else if (key === 'style') {\n for (const [cssKey, cssValue] of Object.entries(value)) {\n el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue);\n }\n }\n else if (key === 'tabIndex') {\n el.tabIndex = value;\n }\n else {\n el.setAttribute(camelCaseToHyphenCase(key), value.toString());\n }\n }\n result['root'] = el;\n return result;\n}\nfunction camelCaseToHyphenCase(str) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\nexport function copyAttributes(from, to) {\n for (const { name, value } of from.attributes) {\n to.setAttribute(name, value);\n }\n}\nfunction copyAttribute(from, to, name) {\n const value = from.getAttribute(name);\n if (value) {\n to.setAttribute(name, value);\n }\n else {\n to.removeAttribute(name);\n }\n}\nexport function trackAttributes(from, to, filter) {\n copyAttributes(from, to);\n const disposables = new DisposableStore();\n disposables.add(sharedMutationObserver.observe(from, disposables, { attributes: true, attributeFilter: filter })(mutations => {\n for (const mutation of mutations) {\n if (mutation.type === 'attributes' && mutation.attributeName) {\n copyAttribute(from, to, mutation.attributeName);\n }\n }\n }));\n return disposables;\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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../dom.js';\nimport './aria.css';\n// Use a max length since we are inserting the whole msg in the DOM and that can cause browsers to freeze for long messages #94233\nconst MAX_MESSAGE_LENGTH = 20000;\nlet ariaContainer;\nlet alertContainer;\nlet alertContainer2;\nlet statusContainer;\nlet statusContainer2;\nexport function setARIAContainer(parent) {\n ariaContainer = document.createElement('div');\n ariaContainer.className = 'monaco-aria-container';\n const createAlertContainer = () => {\n const element = document.createElement('div');\n element.className = 'monaco-alert';\n element.setAttribute('role', 'alert');\n element.setAttribute('aria-atomic', 'true');\n ariaContainer.appendChild(element);\n return element;\n };\n alertContainer = createAlertContainer();\n alertContainer2 = createAlertContainer();\n const createStatusContainer = () => {\n const element = document.createElement('div');\n element.className = 'monaco-status';\n element.setAttribute('aria-live', 'polite');\n element.setAttribute('aria-atomic', 'true');\n ariaContainer.appendChild(element);\n return element;\n };\n statusContainer = createStatusContainer();\n statusContainer2 = createStatusContainer();\n parent.appendChild(ariaContainer);\n}\n/**\n * Given the provided message, will make sure that it is read as alert to screen readers.\n */\nexport function alert(msg) {\n if (!ariaContainer) {\n return;\n }\n // Use alternate containers such that duplicated messages get read out by screen readers #99466\n if (alertContainer.textContent !== msg) {\n dom.clearNode(alertContainer2);\n insertMessage(alertContainer, msg);\n }\n else {\n dom.clearNode(alertContainer);\n insertMessage(alertContainer2, msg);\n }\n}\n/**\n * Given the provided message, will make sure that it is read as status to screen readers.\n */\nexport function status(msg) {\n if (!ariaContainer) {\n return;\n }\n if (statusContainer.textContent !== msg) {\n dom.clearNode(statusContainer2);\n insertMessage(statusContainer, msg);\n }\n else {\n dom.clearNode(statusContainer);\n insertMessage(statusContainer2, msg);\n }\n}\nfunction insertMessage(target, msg) {\n dom.clearNode(target);\n if (msg.length > MAX_MESSAGE_LENGTH) {\n msg = msg.substr(0, MAX_MESSAGE_LENGTH);\n }\n target.textContent = msg;\n // See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/\n target.style.visibility = 'hidden';\n target.style.visibility = 'visible';\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// ------ internal util\nexport var _util;\n(function (_util) {\n _util.serviceIds = new Map();\n _util.DI_TARGET = '$di$target';\n _util.DI_DEPENDENCIES = '$di$dependencies';\n function getServiceDependencies(ctor) {\n return ctor[_util.DI_DEPENDENCIES] || [];\n }\n _util.getServiceDependencies = getServiceDependencies;\n})(_util || (_util = {}));\nexport const IInstantiationService = createDecorator('instantiationService');\nfunction storeServiceDependency(id, target, index) {\n if (target[_util.DI_TARGET] === target) {\n target[_util.DI_DEPENDENCIES].push({ id, index });\n }\n else {\n target[_util.DI_DEPENDENCIES] = [{ id, index }];\n target[_util.DI_TARGET] = target;\n }\n}\n/**\n * The *only* valid way to create a {{ServiceIdentifier}}.\n */\nexport function createDecorator(serviceId) {\n if (_util.serviceIds.has(serviceId)) {\n return _util.serviceIds.get(serviceId);\n }\n const id = function (target, key, index) {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n storeServiceDependency(id, target, index);\n };\n id.toString = () => serviceId;\n _util.serviceIds.set(serviceId, id);\n return id;\n}\nexport function refineServiceDecorator(serviceIdentifier) {\n return serviceIdentifier;\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ICodeEditorService = createDecorator('codeEditorService');\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const IModelService = createDecorator('modelService');\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ITextModelService = createDecorator('textModelService');\nexport function isResolvedTextEditorModel(model) {\n const candidate = model;\n return !!candidate.textEditorModel;\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from './event.js';\nimport { Disposable } from './lifecycle.js';\nimport * as nls from '../../nls.js';\nexport class Action extends Disposable {\n constructor(id, label = '', cssClass = '', enabled = true, actionCallback) {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._enabled = true;\n this._id = id;\n this._label = label;\n this._cssClass = cssClass;\n this._enabled = enabled;\n this._actionCallback = actionCallback;\n }\n get id() {\n return this._id;\n }\n get label() {\n return this._label;\n }\n set label(value) {\n this._setLabel(value);\n }\n _setLabel(value) {\n if (this._label !== value) {\n this._label = value;\n this._onDidChange.fire({ label: value });\n }\n }\n get tooltip() {\n return this._tooltip || '';\n }\n set tooltip(value) {\n this._setTooltip(value);\n }\n _setTooltip(value) {\n if (this._tooltip !== value) {\n this._tooltip = value;\n this._onDidChange.fire({ tooltip: value });\n }\n }\n get class() {\n return this._cssClass;\n }\n set class(value) {\n this._setClass(value);\n }\n _setClass(value) {\n if (this._cssClass !== value) {\n this._cssClass = value;\n this._onDidChange.fire({ class: value });\n }\n }\n get enabled() {\n return this._enabled;\n }\n set enabled(value) {\n this._setEnabled(value);\n }\n _setEnabled(value) {\n if (this._enabled !== value) {\n this._enabled = value;\n this._onDidChange.fire({ enabled: value });\n }\n }\n get checked() {\n return this._checked;\n }\n set checked(value) {\n this._setChecked(value);\n }\n _setChecked(value) {\n if (this._checked !== value) {\n this._checked = value;\n this._onDidChange.fire({ checked: value });\n }\n }\n async run(event, data) {\n if (this._actionCallback) {\n await this._actionCallback(event);\n }\n }\n}\nexport class ActionRunner extends Disposable {\n constructor() {\n super(...arguments);\n this._onWillRun = this._register(new Emitter());\n this.onWillRun = this._onWillRun.event;\n this._onDidRun = this._register(new Emitter());\n this.onDidRun = this._onDidRun.event;\n }\n async run(action, context) {\n if (!action.enabled) {\n return;\n }\n this._onWillRun.fire({ action });\n let error = undefined;\n try {\n await this.runAction(action, context);\n }\n catch (e) {\n error = e;\n }\n this._onDidRun.fire({ action, error });\n }\n async runAction(action, context) {\n await action.run(context);\n }\n}\nexport class Separator {\n constructor() {\n this.id = Separator.ID;\n this.label = '';\n this.tooltip = '';\n this.class = 'separator';\n this.enabled = false;\n this.checked = false;\n }\n /**\n * Joins all non-empty lists of actions with separators.\n */\n static join(...actionLists) {\n let out = [];\n for (const list of actionLists) {\n if (!list.length) {\n // skip\n }\n else if (out.length) {\n out = [...out, new Separator(), ...list];\n }\n else {\n out = list;\n }\n }\n return out;\n }\n async run() { }\n}\nSeparator.ID = 'vs.actions.separator';\nexport class SubmenuAction {\n get actions() { return this._actions; }\n constructor(id, label, actions, cssClass) {\n this.tooltip = '';\n this.enabled = true;\n this.checked = undefined;\n this.id = id;\n this.label = label;\n this.class = cssClass;\n this._actions = actions;\n }\n async run() { }\n}\nexport class EmptySubmenuAction extends Action {\n constructor() {\n super(EmptySubmenuAction.ID, nls.localizeWithPath('vs/base/common/actions', 'submenu.empty', '(empty)'), undefined, false);\n }\n}\nEmptySubmenuAction.ID = 'vs.actions.empty';\nexport function toAction(props) {\n return {\n id: props.id,\n label: props.label,\n class: props.class,\n enabled: props.enabled ?? true,\n checked: props.checked ?? false,\n run: async (...args) => props.run(...args),\n tooltip: props.label\n };\n}\n","import { isString } from './types.js';\nconst _codiconFontCharacters = Object.create(null);\nfunction register(id, fontCharacter) {\n if (isString(fontCharacter)) {\n const val = _codiconFontCharacters[fontCharacter];\n if (val === undefined) {\n throw new Error(`${id} references an unknown codicon: ${fontCharacter}`);\n }\n fontCharacter = val;\n }\n _codiconFontCharacters[id] = fontCharacter;\n return { id };\n}\n/**\n * Only to be used by the iconRegistry.\n */\nexport function getCodiconFontCharacters() {\n return _codiconFontCharacters;\n}\n/**\n * Only to be used by the iconRegistry.\n */\nexport function getAllCodicons() {\n return Object.values(Codicon);\n}\n/**\n * The Codicon library is a set of default icons that are built-in in VS Code.\n *\n * In the product (outside of base) Codicons should only be used as defaults. In order to have all icons in VS Code\n * themeable, component should define new, UI component specific icons using `iconRegistry.registerIcon`.\n * In that call a Codicon can be named as default.\n */\nexport const Codicon = {\n // built-in icons, with image name\n add: register('add', 0xea60),\n plus: register('plus', 0xea60),\n gistNew: register('gist-new', 0xea60),\n repoCreate: register('repo-create', 0xea60),\n lightbulb: register('lightbulb', 0xea61),\n lightBulb: register('light-bulb', 0xea61),\n repo: register('repo', 0xea62),\n repoDelete: register('repo-delete', 0xea62),\n gistFork: register('gist-fork', 0xea63),\n repoForked: register('repo-forked', 0xea63),\n gitPullRequest: register('git-pull-request', 0xea64),\n gitPullRequestAbandoned: register('git-pull-request-abandoned', 0xea64),\n recordKeys: register('record-keys', 0xea65),\n keyboard: register('keyboard', 0xea65),\n tag: register('tag', 0xea66),\n tagAdd: register('tag-add', 0xea66),\n tagRemove: register('tag-remove', 0xea66),\n gitPullRequestLabel: register('git-pull-request-label', 0xea66),\n person: register('person', 0xea67),\n personFollow: register('person-follow', 0xea67),\n personOutline: register('person-outline', 0xea67),\n personFilled: register('person-filled', 0xea67),\n gitBranch: register('git-branch', 0xea68),\n gitBranchCreate: register('git-branch-create', 0xea68),\n gitBranchDelete: register('git-branch-delete', 0xea68),\n sourceControl: register('source-control', 0xea68),\n mirror: register('mirror', 0xea69),\n mirrorPublic: register('mirror-public', 0xea69),\n star: register('star', 0xea6a),\n starAdd: register('star-add', 0xea6a),\n starDelete: register('star-delete', 0xea6a),\n starEmpty: register('star-empty', 0xea6a),\n comment: register('comment', 0xea6b),\n commentAdd: register('comment-add', 0xea6b),\n alert: register('alert', 0xea6c),\n warning: register('warning', 0xea6c),\n search: register('search', 0xea6d),\n searchSave: register('search-save', 0xea6d),\n logOut: register('log-out', 0xea6e),\n signOut: register('sign-out', 0xea6e),\n logIn: register('log-in', 0xea6f),\n signIn: register('sign-in', 0xea6f),\n eye: register('eye', 0xea70),\n eyeUnwatch: register('eye-unwatch', 0xea70),\n eyeWatch: register('eye-watch', 0xea70),\n circleFilled: register('circle-filled', 0xea71),\n primitiveDot: register('primitive-dot', 0xea71),\n closeDirty: register('close-dirty', 0xea71),\n debugBreakpoint: register('debug-breakpoint', 0xea71),\n debugBreakpointDisabled: register('debug-breakpoint-disabled', 0xea71),\n debugHint: register('debug-hint', 0xea71),\n primitiveSquare: register('primitive-square', 0xea72),\n edit: register('edit', 0xea73),\n pencil: register('pencil', 0xea73),\n info: register('info', 0xea74),\n issueOpened: register('issue-opened', 0xea74),\n gistPrivate: register('gist-private', 0xea75),\n gitForkPrivate: register('git-fork-private', 0xea75),\n lock: register('lock', 0xea75),\n mirrorPrivate: register('mirror-private', 0xea75),\n close: register('close', 0xea76),\n removeClose: register('remove-close', 0xea76),\n x: register('x', 0xea76),\n repoSync: register('repo-sync', 0xea77),\n sync: register('sync', 0xea77),\n clone: register('clone', 0xea78),\n desktopDownload: register('desktop-download', 0xea78),\n beaker: register('beaker', 0xea79),\n microscope: register('microscope', 0xea79),\n vm: register('vm', 0xea7a),\n deviceDesktop: register('device-desktop', 0xea7a),\n file: register('file', 0xea7b),\n fileText: register('file-text', 0xea7b),\n more: register('more', 0xea7c),\n ellipsis: register('ellipsis', 0xea7c),\n kebabHorizontal: register('kebab-horizontal', 0xea7c),\n mailReply: register('mail-reply', 0xea7d),\n reply: register('reply', 0xea7d),\n organization: register('organization', 0xea7e),\n organizationFilled: register('organization-filled', 0xea7e),\n organizationOutline: register('organization-outline', 0xea7e),\n newFile: register('new-file', 0xea7f),\n fileAdd: register('file-add', 0xea7f),\n newFolder: register('new-folder', 0xea80),\n fileDirectoryCreate: register('file-directory-create', 0xea80),\n trash: register('trash', 0xea81),\n trashcan: register('trashcan', 0xea81),\n history: register('history', 0xea82),\n clock: register('clock', 0xea82),\n folder: register('folder', 0xea83),\n fileDirectory: register('file-directory', 0xea83),\n symbolFolder: register('symbol-folder', 0xea83),\n logoGithub: register('logo-github', 0xea84),\n markGithub: register('mark-github', 0xea84),\n github: register('github', 0xea84),\n terminal: register('terminal', 0xea85),\n console: register('console', 0xea85),\n repl: register('repl', 0xea85),\n zap: register('zap', 0xea86),\n symbolEvent: register('symbol-event', 0xea86),\n error: register('error', 0xea87),\n stop: register('stop', 0xea87),\n variable: register('variable', 0xea88),\n symbolVariable: register('symbol-variable', 0xea88),\n array: register('array', 0xea8a),\n symbolArray: register('symbol-array', 0xea8a),\n symbolModule: register('symbol-module', 0xea8b),\n symbolPackage: register('symbol-package', 0xea8b),\n symbolNamespace: register('symbol-namespace', 0xea8b),\n symbolObject: register('symbol-object', 0xea8b),\n symbolMethod: register('symbol-method', 0xea8c),\n symbolFunction: register('symbol-function', 0xea8c),\n symbolConstructor: register('symbol-constructor', 0xea8c),\n symbolBoolean: register('symbol-boolean', 0xea8f),\n symbolNull: register('symbol-null', 0xea8f),\n symbolNumeric: register('symbol-numeric', 0xea90),\n symbolNumber: register('symbol-number', 0xea90),\n symbolStructure: register('symbol-structure', 0xea91),\n symbolStruct: register('symbol-struct', 0xea91),\n symbolParameter: register('symbol-parameter', 0xea92),\n symbolTypeParameter: register('symbol-type-parameter', 0xea92),\n symbolKey: register('symbol-key', 0xea93),\n symbolText: register('symbol-text', 0xea93),\n symbolReference: register('symbol-reference', 0xea94),\n goToFile: register('go-to-file', 0xea94),\n symbolEnum: register('symbol-enum', 0xea95),\n symbolValue: register('symbol-value', 0xea95),\n symbolRuler: register('symbol-ruler', 0xea96),\n symbolUnit: register('symbol-unit', 0xea96),\n activateBreakpoints: register('activate-breakpoints', 0xea97),\n archive: register('archive', 0xea98),\n arrowBoth: register('arrow-both', 0xea99),\n arrowDown: register('arrow-down', 0xea9a),\n arrowLeft: register('arrow-left', 0xea9b),\n arrowRight: register('arrow-right', 0xea9c),\n arrowSmallDown: register('arrow-small-down', 0xea9d),\n arrowSmallLeft: register('arrow-small-left', 0xea9e),\n arrowSmallRight: register('arrow-small-right', 0xea9f),\n arrowSmallUp: register('arrow-small-up', 0xeaa0),\n arrowUp: register('arrow-up', 0xeaa1),\n bell: register('bell', 0xeaa2),\n bold: register('bold', 0xeaa3),\n book: register('book', 0xeaa4),\n bookmark: register('bookmark', 0xeaa5),\n debugBreakpointConditionalUnverified: register('debug-breakpoint-conditional-unverified', 0xeaa6),\n debugBreakpointConditional: register('debug-breakpoint-conditional', 0xeaa7),\n debugBreakpointConditionalDisabled: register('debug-breakpoint-conditional-disabled', 0xeaa7),\n debugBreakpointDataUnverified: register('debug-breakpoint-data-unverified', 0xeaa8),\n debugBreakpointData: register('debug-breakpoint-data', 0xeaa9),\n debugBreakpointDataDisabled: register('debug-breakpoint-data-disabled', 0xeaa9),\n debugBreakpointLogUnverified: register('debug-breakpoint-log-unverified', 0xeaaa),\n debugBreakpointLog: register('debug-breakpoint-log', 0xeaab),\n debugBreakpointLogDisabled: register('debug-breakpoint-log-disabled', 0xeaab),\n briefcase: register('briefcase', 0xeaac),\n broadcast: register('broadcast', 0xeaad),\n browser: register('browser', 0xeaae),\n bug: register('bug', 0xeaaf),\n calendar: register('calendar', 0xeab0),\n caseSensitive: register('case-sensitive', 0xeab1),\n check: register('check', 0xeab2),\n checklist: register('checklist', 0xeab3),\n chevronDown: register('chevron-down', 0xeab4),\n dropDownButton: register('drop-down-button', 0xeab4),\n chevronLeft: register('chevron-left', 0xeab5),\n chevronRight: register('chevron-right', 0xeab6),\n chevronUp: register('chevron-up', 0xeab7),\n chromeClose: register('chrome-close', 0xeab8),\n chromeMaximize: register('chrome-maximize', 0xeab9),\n chromeMinimize: register('chrome-minimize', 0xeaba),\n chromeRestore: register('chrome-restore', 0xeabb),\n circle: register('circle', 0xeabc),\n circleOutline: register('circle-outline', 0xeabc),\n debugBreakpointUnverified: register('debug-breakpoint-unverified', 0xeabc),\n circleSlash: register('circle-slash', 0xeabd),\n circuitBoard: register('circuit-board', 0xeabe),\n clearAll: register('clear-all', 0xeabf),\n clippy: register('clippy', 0xeac0),\n closeAll: register('close-all', 0xeac1),\n cloudDownload: register('cloud-download', 0xeac2),\n cloudUpload: register('cloud-upload', 0xeac3),\n code: register('code', 0xeac4),\n collapseAll: register('collapse-all', 0xeac5),\n colorMode: register('color-mode', 0xeac6),\n commentDiscussion: register('comment-discussion', 0xeac7),\n compareChanges: register('compare-changes', 0xeafd),\n creditCard: register('credit-card', 0xeac9),\n dash: register('dash', 0xeacc),\n dashboard: register('dashboard', 0xeacd),\n database: register('database', 0xeace),\n debugContinue: register('debug-continue', 0xeacf),\n debugDisconnect: register('debug-disconnect', 0xead0),\n debugPause: register('debug-pause', 0xead1),\n debugRestart: register('debug-restart', 0xead2),\n debugStart: register('debug-start', 0xead3),\n debugStepInto: register('debug-step-into', 0xead4),\n debugStepOut: register('debug-step-out', 0xead5),\n debugStepOver: register('debug-step-over', 0xead6),\n debugStop: register('debug-stop', 0xead7),\n debug: register('debug', 0xead8),\n deviceCameraVideo: register('device-camera-video', 0xead9),\n deviceCamera: register('device-camera', 0xeada),\n deviceMobile: register('device-mobile', 0xeadb),\n diffAdded: register('diff-added', 0xeadc),\n diffIgnored: register('diff-ignored', 0xeadd),\n diffModified: register('diff-modified', 0xeade),\n diffRemoved: register('diff-removed', 0xeadf),\n diffRenamed: register('diff-renamed', 0xeae0),\n diff: register('diff', 0xeae1),\n discard: register('discard', 0xeae2),\n editorLayout: register('editor-layout', 0xeae3),\n emptyWindow: register('empty-window', 0xeae4),\n exclude: register('exclude', 0xeae5),\n extensions: register('extensions', 0xeae6),\n eyeClosed: register('eye-closed', 0xeae7),\n fileBinary: register('file-binary', 0xeae8),\n fileCode: register('file-code', 0xeae9),\n fileMedia: register('file-media', 0xeaea),\n filePdf: register('file-pdf', 0xeaeb),\n fileSubmodule: register('file-submodule', 0xeaec),\n fileSymlinkDirectory: register('file-symlink-directory', 0xeaed),\n fileSymlinkFile: register('file-symlink-file', 0xeaee),\n fileZip: register('file-zip', 0xeaef),\n files: register('files', 0xeaf0),\n filter: register('filter', 0xeaf1),\n flame: register('flame', 0xeaf2),\n foldDown: register('fold-down', 0xeaf3),\n foldUp: register('fold-up', 0xeaf4),\n fold: register('fold', 0xeaf5),\n folderActive: register('folder-active', 0xeaf6),\n folderOpened: register('folder-opened', 0xeaf7),\n gear: register('gear', 0xeaf8),\n gift: register('gift', 0xeaf9),\n gistSecret: register('gist-secret', 0xeafa),\n gist: register('gist', 0xeafb),\n gitCommit: register('git-commit', 0xeafc),\n gitCompare: register('git-compare', 0xeafd),\n gitMerge: register('git-merge', 0xeafe),\n githubAction: register('github-action', 0xeaff),\n githubAlt: register('github-alt', 0xeb00),\n globe: register('globe', 0xeb01),\n grabber: register('grabber', 0xeb02),\n graph: register('graph', 0xeb03),\n gripper: register('gripper', 0xeb04),\n heart: register('heart', 0xeb05),\n home: register('home', 0xeb06),\n horizontalRule: register('horizontal-rule', 0xeb07),\n hubot: register('hubot', 0xeb08),\n inbox: register('inbox', 0xeb09),\n issueClosed: register('issue-closed', 0xeba4),\n issueReopened: register('issue-reopened', 0xeb0b),\n issues: register('issues', 0xeb0c),\n italic: register('italic', 0xeb0d),\n jersey: register('jersey', 0xeb0e),\n json: register('json', 0xeb0f),\n bracket: register('bracket', 0xeb0f),\n kebabVertical: register('kebab-vertical', 0xeb10),\n key: register('key', 0xeb11),\n law: register('law', 0xeb12),\n lightbulbAutofix: register('lightbulb-autofix', 0xeb13),\n linkExternal: register('link-external', 0xeb14),\n link: register('link', 0xeb15),\n listOrdered: register('list-ordered', 0xeb16),\n listUnordered: register('list-unordered', 0xeb17),\n liveShare: register('live-share', 0xeb18),\n loading: register('loading', 0xeb19),\n location: register('location', 0xeb1a),\n mailRead: register('mail-read', 0xeb1b),\n mail: register('mail', 0xeb1c),\n markdown: register('markdown', 0xeb1d),\n megaphone: register('megaphone', 0xeb1e),\n mention: register('mention', 0xeb1f),\n milestone: register('milestone', 0xeb20),\n gitPullRequestMilestone: register('git-pull-request-milestone', 0xeb20),\n mortarBoard: register('mortar-board', 0xeb21),\n move: register('move', 0xeb22),\n multipleWindows: register('multiple-windows', 0xeb23),\n mute: register('mute', 0xeb24),\n noNewline: register('no-newline', 0xeb25),\n note: register('note', 0xeb26),\n octoface: register('octoface', 0xeb27),\n openPreview: register('open-preview', 0xeb28),\n package: register('package', 0xeb29),\n paintcan: register('paintcan', 0xeb2a),\n pin: register('pin', 0xeb2b),\n play: register('play', 0xeb2c),\n run: register('run', 0xeb2c),\n plug: register('plug', 0xeb2d),\n preserveCase: register('preserve-case', 0xeb2e),\n preview: register('preview', 0xeb2f),\n project: register('project', 0xeb30),\n pulse: register('pulse', 0xeb31),\n question: register('question', 0xeb32),\n quote: register('quote', 0xeb33),\n radioTower: register('radio-tower', 0xeb34),\n reactions: register('reactions', 0xeb35),\n references: register('references', 0xeb36),\n refresh: register('refresh', 0xeb37),\n regex: register('regex', 0xeb38),\n remoteExplorer: register('remote-explorer', 0xeb39),\n remote: register('remote', 0xeb3a),\n remove: register('remove', 0xeb3b),\n replaceAll: register('replace-all', 0xeb3c),\n replace: register('replace', 0xeb3d),\n repoClone: register('repo-clone', 0xeb3e),\n repoForcePush: register('repo-force-push', 0xeb3f),\n repoPull: register('repo-pull', 0xeb40),\n repoPush: register('repo-push', 0xeb41),\n report: register('report', 0xeb42),\n requestChanges: register('request-changes', 0xeb43),\n rocket: register('rocket', 0xeb44),\n rootFolderOpened: register('root-folder-opened', 0xeb45),\n rootFolder: register('root-folder', 0xeb46),\n rss: register('rss', 0xeb47),\n ruby: register('ruby', 0xeb48),\n saveAll: register('save-all', 0xeb49),\n saveAs: register('save-as', 0xeb4a),\n save: register('save', 0xeb4b),\n screenFull: register('screen-full', 0xeb4c),\n screenNormal: register('screen-normal', 0xeb4d),\n searchStop: register('search-stop', 0xeb4e),\n server: register('server', 0xeb50),\n settingsGear: register('settings-gear', 0xeb51),\n settings: register('settings', 0xeb52),\n shield: register('shield', 0xeb53),\n smiley: register('smiley', 0xeb54),\n sortPrecedence: register('sort-precedence', 0xeb55),\n splitHorizontal: register('split-horizontal', 0xeb56),\n splitVertical: register('split-vertical', 0xeb57),\n squirrel: register('squirrel', 0xeb58),\n starFull: register('star-full', 0xeb59),\n starHalf: register('star-half', 0xeb5a),\n symbolClass: register('symbol-class', 0xeb5b),\n symbolColor: register('symbol-color', 0xeb5c),\n symbolCustomColor: register('symbol-customcolor', 0xeb5c),\n symbolConstant: register('symbol-constant', 0xeb5d),\n symbolEnumMember: register('symbol-enum-member', 0xeb5e),\n symbolField: register('symbol-field', 0xeb5f),\n symbolFile: register('symbol-file', 0xeb60),\n symbolInterface: register('symbol-interface', 0xeb61),\n symbolKeyword: register('symbol-keyword', 0xeb62),\n symbolMisc: register('symbol-misc', 0xeb63),\n symbolOperator: register('symbol-operator', 0xeb64),\n symbolProperty: register('symbol-property', 0xeb65),\n wrench: register('wrench', 0xeb65),\n wrenchSubaction: register('wrench-subaction', 0xeb65),\n symbolSnippet: register('symbol-snippet', 0xeb66),\n tasklist: register('tasklist', 0xeb67),\n telescope: register('telescope', 0xeb68),\n textSize: register('text-size', 0xeb69),\n threeBars: register('three-bars', 0xeb6a),\n thumbsdown: register('thumbsdown', 0xeb6b),\n thumbsup: register('thumbsup', 0xeb6c),\n tools: register('tools', 0xeb6d),\n triangleDown: register('triangle-down', 0xeb6e),\n triangleLeft: register('triangle-left', 0xeb6f),\n triangleRight: register('triangle-right', 0xeb70),\n triangleUp: register('triangle-up', 0xeb71),\n twitter: register('twitter', 0xeb72),\n unfold: register('unfold', 0xeb73),\n unlock: register('unlock', 0xeb74),\n unmute: register('unmute', 0xeb75),\n unverified: register('unverified', 0xeb76),\n verified: register('verified', 0xeb77),\n versions: register('versions', 0xeb78),\n vmActive: register('vm-active', 0xeb79),\n vmOutline: register('vm-outline', 0xeb7a),\n vmRunning: register('vm-running', 0xeb7b),\n watch: register('watch', 0xeb7c),\n whitespace: register('whitespace', 0xeb7d),\n wholeWord: register('whole-word', 0xeb7e),\n window: register('window', 0xeb7f),\n wordWrap: register('word-wrap', 0xeb80),\n zoomIn: register('zoom-in', 0xeb81),\n zoomOut: register('zoom-out', 0xeb82),\n listFilter: register('list-filter', 0xeb83),\n listFlat: register('list-flat', 0xeb84),\n listSelection: register('list-selection', 0xeb85),\n selection: register('selection', 0xeb85),\n listTree: register('list-tree', 0xeb86),\n debugBreakpointFunctionUnverified: register('debug-breakpoint-function-unverified', 0xeb87),\n debugBreakpointFunction: register('debug-breakpoint-function', 0xeb88),\n debugBreakpointFunctionDisabled: register('debug-breakpoint-function-disabled', 0xeb88),\n debugStackframeActive: register('debug-stackframe-active', 0xeb89),\n circleSmallFilled: register('circle-small-filled', 0xeb8a),\n debugStackframeDot: register('debug-stackframe-dot', 0xeb8a),\n debugStackframe: register('debug-stackframe', 0xeb8b),\n debugStackframeFocused: register('debug-stackframe-focused', 0xeb8b),\n debugBreakpointUnsupported: register('debug-breakpoint-unsupported', 0xeb8c),\n symbolString: register('symbol-string', 0xeb8d),\n debugReverseContinue: register('debug-reverse-continue', 0xeb8e),\n debugStepBack: register('debug-step-back', 0xeb8f),\n debugRestartFrame: register('debug-restart-frame', 0xeb90),\n callIncoming: register('call-incoming', 0xeb92),\n callOutgoing: register('call-outgoing', 0xeb93),\n menu: register('menu', 0xeb94),\n expandAll: register('expand-all', 0xeb95),\n feedback: register('feedback', 0xeb96),\n gitPullRequestReviewer: register('git-pull-request-reviewer', 0xeb96),\n groupByRefType: register('group-by-ref-type', 0xeb97),\n ungroupByRefType: register('ungroup-by-ref-type', 0xeb98),\n account: register('account', 0xeb99),\n gitPullRequestAssignee: register('git-pull-request-assignee', 0xeb99),\n bellDot: register('bell-dot', 0xeb9a),\n debugConsole: register('debug-console', 0xeb9b),\n library: register('library', 0xeb9c),\n output: register('output', 0xeb9d),\n runAll: register('run-all', 0xeb9e),\n syncIgnored: register('sync-ignored', 0xeb9f),\n pinned: register('pinned', 0xeba0),\n githubInverted: register('github-inverted', 0xeba1),\n debugAlt: register('debug-alt', 0xeb91),\n serverProcess: register('server-process', 0xeba2),\n serverEnvironment: register('server-environment', 0xeba3),\n pass: register('pass', 0xeba4),\n stopCircle: register('stop-circle', 0xeba5),\n playCircle: register('play-circle', 0xeba6),\n record: register('record', 0xeba7),\n debugAltSmall: register('debug-alt-small', 0xeba8),\n vmConnect: register('vm-connect', 0xeba9),\n cloud: register('cloud', 0xebaa),\n merge: register('merge', 0xebab),\n exportIcon: register('export', 0xebac),\n graphLeft: register('graph-left', 0xebad),\n magnet: register('magnet', 0xebae),\n notebook: register('notebook', 0xebaf),\n redo: register('redo', 0xebb0),\n checkAll: register('check-all', 0xebb1),\n pinnedDirty: register('pinned-dirty', 0xebb2),\n passFilled: register('pass-filled', 0xebb3),\n circleLargeFilled: register('circle-large-filled', 0xebb4),\n circleLarge: register('circle-large', 0xebb5),\n circleLargeOutline: register('circle-large-outline', 0xebb5),\n combine: register('combine', 0xebb6),\n gather: register('gather', 0xebb6),\n table: register('table', 0xebb7),\n variableGroup: register('variable-group', 0xebb8),\n typeHierarchy: register('type-hierarchy', 0xebb9),\n typeHierarchySub: register('type-hierarchy-sub', 0xebba),\n typeHierarchySuper: register('type-hierarchy-super', 0xebbb),\n gitPullRequestCreate: register('git-pull-request-create', 0xebbc),\n runAbove: register('run-above', 0xebbd),\n runBelow: register('run-below', 0xebbe),\n notebookTemplate: register('notebook-template', 0xebbf),\n debugRerun: register('debug-rerun', 0xebc0),\n workspaceTrusted: register('workspace-trusted', 0xebc1),\n workspaceUntrusted: register('workspace-untrusted', 0xebc2),\n workspaceUnspecified: register('workspace-unspecified', 0xebc3),\n terminalCmd: register('terminal-cmd', 0xebc4),\n terminalDebian: register('terminal-debian', 0xebc5),\n terminalLinux: register('terminal-linux', 0xebc6),\n terminalPowershell: register('terminal-powershell', 0xebc7),\n terminalTmux: register('terminal-tmux', 0xebc8),\n terminalUbuntu: register('terminal-ubuntu', 0xebc9),\n terminalBash: register('terminal-bash', 0xebca),\n arrowSwap: register('arrow-swap', 0xebcb),\n copy: register('copy', 0xebcc),\n personAdd: register('person-add', 0xebcd),\n filterFilled: register('filter-filled', 0xebce),\n wand: register('wand', 0xebcf),\n debugLineByLine: register('debug-line-by-line', 0xebd0),\n inspect: register('inspect', 0xebd1),\n layers: register('layers', 0xebd2),\n layersDot: register('layers-dot', 0xebd3),\n layersActive: register('layers-active', 0xebd4),\n compass: register('compass', 0xebd5),\n compassDot: register('compass-dot', 0xebd6),\n compassActive: register('compass-active', 0xebd7),\n azure: register('azure', 0xebd8),\n issueDraft: register('issue-draft', 0xebd9),\n gitPullRequestClosed: register('git-pull-request-closed', 0xebda),\n gitPullRequestDraft: register('git-pull-request-draft', 0xebdb),\n debugAll: register('debug-all', 0xebdc),\n debugCoverage: register('debug-coverage', 0xebdd),\n runErrors: register('run-errors', 0xebde),\n folderLibrary: register('folder-library', 0xebdf),\n debugContinueSmall: register('debug-continue-small', 0xebe0),\n beakerStop: register('beaker-stop', 0xebe1),\n graphLine: register('graph-line', 0xebe2),\n graphScatter: register('graph-scatter', 0xebe3),\n pieChart: register('pie-chart', 0xebe4),\n bracketDot: register('bracket-dot', 0xebe5),\n bracketError: register('bracket-error', 0xebe6),\n lockSmall: register('lock-small', 0xebe7),\n azureDevops: register('azure-devops', 0xebe8),\n verifiedFilled: register('verified-filled', 0xebe9),\n newLine: register('newline', 0xebea),\n layout: register('layout', 0xebeb),\n layoutActivitybarLeft: register('layout-activitybar-left', 0xebec),\n layoutActivitybarRight: register('layout-activitybar-right', 0xebed),\n layoutPanelLeft: register('layout-panel-left', 0xebee),\n layoutPanelCenter: register('layout-panel-center', 0xebef),\n layoutPanelJustify: register('layout-panel-justify', 0xebf0),\n layoutPanelRight: register('layout-panel-right', 0xebf1),\n layoutPanel: register('layout-panel', 0xebf2),\n layoutSidebarLeft: register('layout-sidebar-left', 0xebf3),\n layoutSidebarRight: register('layout-sidebar-right', 0xebf4),\n layoutStatusbar: register('layout-statusbar', 0xebf5),\n layoutMenubar: register('layout-menubar', 0xebf6),\n layoutCentered: register('layout-centered', 0xebf7),\n layoutSidebarRightOff: register('layout-sidebar-right-off', 0xec00),\n layoutPanelOff: register('layout-panel-off', 0xec01),\n layoutSidebarLeftOff: register('layout-sidebar-left-off', 0xec02),\n target: register('target', 0xebf8),\n indent: register('indent', 0xebf9),\n recordSmall: register('record-small', 0xebfa),\n errorSmall: register('error-small', 0xebfb),\n arrowCircleDown: register('arrow-circle-down', 0xebfc),\n arrowCircleLeft: register('arrow-circle-left', 0xebfd),\n arrowCircleRight: register('arrow-circle-right', 0xebfe),\n arrowCircleUp: register('arrow-circle-up', 0xebff),\n heartFilled: register('heart-filled', 0xec04),\n map: register('map', 0xec05),\n mapFilled: register('map-filled', 0xec06),\n circleSmall: register('circle-small', 0xec07),\n bellSlash: register('bell-slash', 0xec08),\n bellSlashDot: register('bell-slash-dot', 0xec09),\n commentUnresolved: register('comment-unresolved', 0xec0a),\n gitPullRequestGoToChanges: register('git-pull-request-go-to-changes', 0xec0b),\n gitPullRequestNewChanges: register('git-pull-request-new-changes', 0xec0c),\n searchFuzzy: register('search-fuzzy', 0xec0d),\n commentDraft: register('comment-draft', 0xec0e),\n send: register('send', 0xec0f),\n sparkle: register('sparkle', 0xec10),\n insert: register('insert', 0xec11),\n mic: register('mic', 0xec12),\n thumbsDownFilled: register('thumbsdown-filled', 0xec13),\n thumbsUpFilled: register('thumbsup-filled', 0xec14),\n coffee: register('coffee', 0xec15),\n snake: register('snake', 0xec16),\n game: register('game', 0xec17),\n vr: register('vr', 0xec18),\n chip: register('chip', 0xec19),\n piano: register('piano', 0xec1a),\n music: register('music', 0xec1b),\n micFilled: register('mic-filled', 0xec1c),\n gitFetch: register('git-fetch', 0xec1d),\n copilot: register('copilot', 0xec1e),\n lightbulbSparkle: register('lightbulb-sparkle', 0xec1f),\n lightbulbSparkleAutofix: register('lightbulb-sparkle-autofix', 0xec1f),\n robot: register('robot', 0xec20),\n sparkleFilled: register('sparkle-filled', 0xec21),\n diffSingle: register('diff-single', 0xec22),\n diffMultiple: register('diff-multiple', 0xec23),\n // derived icons, that could become separate icons\n dialogError: register('dialog-error', 'error'),\n dialogWarning: register('dialog-warning', 'warning'),\n dialogInfo: register('dialog-info', 'info'),\n dialogClose: register('dialog-close', 'close'),\n treeItemExpanded: register('tree-item-expanded', 'chevron-down'), // collapsed is done with rotation\n treeFilterOnTypeOn: register('tree-filter-on-type-on', 'list-filter'),\n treeFilterOnTypeOff: register('tree-filter-on-type-off', 'list-selection'),\n treeFilterClear: register('tree-filter-clear', 'close'),\n treeItemLoading: register('tree-item-loading', 'loading'),\n menuSelection: register('menu-selection', 'check'),\n menuSubmenu: register('menu-submenu', 'chevron-right'),\n menuBarMore: register('menubar-more', 'more'),\n scrollbarButtonLeft: register('scrollbar-button-left', 'triangle-left'),\n scrollbarButtonRight: register('scrollbar-button-right', 'triangle-right'),\n scrollbarButtonUp: register('scrollbar-button-up', 'triangle-up'),\n scrollbarButtonDown: register('scrollbar-button-down', 'triangle-down'),\n toolBarMore: register('toolbar-more', 'more'),\n quickInputBack: register('quick-input-back', 'arrow-left')\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 *--------------------------------------------------------------------------------------------*/\nimport { Codicon } from './codicons.js';\nexport var ThemeColor;\n(function (ThemeColor) {\n function isThemeColor(obj) {\n return obj && typeof obj === 'object' && typeof obj.id === 'string';\n }\n ThemeColor.isThemeColor = isThemeColor;\n})(ThemeColor || (ThemeColor = {}));\nexport function themeColorFromId(id) {\n return { id };\n}\nexport var ThemeIcon;\n(function (ThemeIcon) {\n ThemeIcon.iconNameSegment = '[A-Za-z0-9]+';\n ThemeIcon.iconNameExpression = '[A-Za-z0-9-]+';\n ThemeIcon.iconModifierExpression = '~[A-Za-z]+';\n ThemeIcon.iconNameCharacter = '[A-Za-z0-9~-]';\n const ThemeIconIdRegex = new RegExp(`^(${ThemeIcon.iconNameExpression})(${ThemeIcon.iconModifierExpression})?$`);\n function asClassNameArray(icon) {\n const match = ThemeIconIdRegex.exec(icon.id);\n if (!match) {\n return asClassNameArray(Codicon.error);\n }\n const [, id, modifier] = match;\n const classNames = ['codicon', 'codicon-' + id];\n if (modifier) {\n classNames.push('codicon-modifier-' + modifier.substring(1));\n }\n return classNames;\n }\n ThemeIcon.asClassNameArray = asClassNameArray;\n function asClassName(icon) {\n return asClassNameArray(icon).join(' ');\n }\n ThemeIcon.asClassName = asClassName;\n function asCSSSelector(icon) {\n return '.' + asClassNameArray(icon).join('.');\n }\n ThemeIcon.asCSSSelector = asCSSSelector;\n function isThemeIcon(obj) {\n return obj && typeof obj === 'object' && typeof obj.id === 'string' && (typeof obj.color === 'undefined' || ThemeColor.isThemeColor(obj.color));\n }\n ThemeIcon.isThemeIcon = isThemeIcon;\n const _regexFromString = new RegExp(`^\\\\$\\\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\\\)$`);\n function fromString(str) {\n const match = _regexFromString.exec(str);\n if (!match) {\n return undefined;\n }\n const [, name] = match;\n return { id: name };\n }\n ThemeIcon.fromString = fromString;\n function fromId(id) {\n return { id };\n }\n ThemeIcon.fromId = fromId;\n function modify(icon, modifier) {\n let id = icon.id;\n const tildeIndex = id.lastIndexOf('~');\n if (tildeIndex !== -1) {\n id = id.substring(0, tildeIndex);\n }\n if (modifier) {\n id = `${id}~${modifier}`;\n }\n return { id };\n }\n ThemeIcon.modify = modify;\n function getModifier(icon) {\n const tildeIndex = icon.id.lastIndexOf('~');\n if (tildeIndex !== -1) {\n return icon.id.substring(tildeIndex + 1);\n }\n return undefined;\n }\n ThemeIcon.getModifier = getModifier;\n function isEqual(ti1, ti2) {\n return ti1.id === ti2.id && ti1.color?.id === ti2.color?.id;\n }\n ThemeIcon.isEqual = isEqual;\n})(ThemeIcon || (ThemeIcon = {}));\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../base/common/event.js';\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { toDisposable } from '../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\nimport { validateConstraints } from '../../../base/common/types.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const ICommandService = createDecorator('commandService');\nexport const CommandsRegistry = new class {\n constructor() {\n this._commands = new Map();\n this._onDidRegisterCommand = new Emitter();\n this.onDidRegisterCommand = this._onDidRegisterCommand.event;\n }\n registerCommand(idOrCommand, handler) {\n if (!idOrCommand) {\n throw new Error(`invalid command`);\n }\n if (typeof idOrCommand === 'string') {\n if (!handler) {\n throw new Error(`invalid command`);\n }\n return this.registerCommand({ id: idOrCommand, handler });\n }\n // add argument validation if rich command metadata is provided\n if (idOrCommand.metadata && Array.isArray(idOrCommand.metadata.args)) {\n const constraints = [];\n for (const arg of idOrCommand.metadata.args) {\n constraints.push(arg.constraint);\n }\n const actualHandler = idOrCommand.handler;\n idOrCommand.handler = function (accessor, ...args) {\n validateConstraints(args, constraints);\n return actualHandler(accessor, ...args);\n };\n }\n // find a place to store the command\n const { id } = idOrCommand;\n let commands = this._commands.get(id);\n if (!commands) {\n commands = new LinkedList();\n this._commands.set(id, commands);\n }\n const removeFn = commands.unshift(idOrCommand);\n const ret = toDisposable(() => {\n removeFn();\n const command = this._commands.get(id);\n if (command?.isEmpty()) {\n this._commands.delete(id);\n }\n });\n // tell the world about this command\n this._onDidRegisterCommand.fire(id);\n return ret;\n }\n registerCommandAlias(oldId, newId) {\n return CommandsRegistry.registerCommand(oldId, (accessor, ...args) => accessor.get(ICommandService).executeCommand(newId, ...args));\n }\n getCommand(id) {\n const list = this._commands.get(id);\n if (!list || list.isEmpty()) {\n return undefined;\n }\n return Iterable.first(list);\n }\n getCommands() {\n const result = new Map();\n for (const key of this._commands.keys()) {\n const command = this.getCommand(key);\n if (command) {\n result.set(key, command);\n }\n }\n return result;\n }\n};\nCommandsRegistry.registerCommand('noop', () => { });\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 *--------------------------------------------------------------------------------------------*/\nimport { illegalState } from '../../../base/common/errors.js';\nimport { localizeWithPath } from '../../../nls.js';\nfunction hintDidYouMean(...meant) {\n switch (meant.length) {\n case 1:\n return localizeWithPath('vs/platform/contextkey/common/scanner', 'contextkey.scanner.hint.didYouMean1', \"Did you mean {0}?\", meant[0]);\n case 2:\n return localizeWithPath('vs/platform/contextkey/common/scanner', 'contextkey.scanner.hint.didYouMean2', \"Did you mean {0} or {1}?\", meant[0], meant[1]);\n case 3:\n return localizeWithPath('vs/platform/contextkey/common/scanner', 'contextkey.scanner.hint.didYouMean3', \"Did you mean {0}, {1} or {2}?\", meant[0], meant[1], meant[2]);\n default: // we just don't expect that many\n return undefined;\n }\n}\nconst hintDidYouForgetToOpenOrCloseQuote = localizeWithPath('vs/platform/contextkey/common/scanner', 'contextkey.scanner.hint.didYouForgetToOpenOrCloseQuote', \"Did you forget to open or close the quote?\");\nconst hintDidYouForgetToEscapeSlash = localizeWithPath('vs/platform/contextkey/common/scanner', 'contextkey.scanner.hint.didYouForgetToEscapeSlash', \"Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\\\\\/\\'.\");\n/**\n * A simple scanner for context keys.\n *\n * Example:\n *\n * ```ts\n * const scanner = new Scanner().reset('resourceFileName =~ /docker/ && !config.docker.enabled');\n * const tokens = [...scanner];\n * if (scanner.errorTokens.length > 0) {\n * scanner.errorTokens.forEach(err => console.error(`Unexpected token at ${err.offset}: ${err.lexeme}\\nHint: ${err.additional}`));\n * } else {\n * // process tokens\n * }\n * ```\n */\nexport class Scanner {\n constructor() {\n this._input = '';\n this._start = 0;\n this._current = 0;\n this._tokens = [];\n this._errors = [];\n // u - unicode, y - sticky // TODO@ulugbekna: we accept double quotes as part of the string rather than as a delimiter (to preserve old parser's behavior)\n this.stringRe = /[a-zA-Z0-9_<>\\-\\./\\\\:\\*\\?\\+\\[\\]\\^,#@;\"%\\$\\p{L}-]+/uy;\n }\n static getLexeme(token) {\n switch (token.type) {\n case 0 /* TokenType.LParen */:\n return '(';\n case 1 /* TokenType.RParen */:\n return ')';\n case 2 /* TokenType.Neg */:\n return '!';\n case 3 /* TokenType.Eq */:\n return token.isTripleEq ? '===' : '==';\n case 4 /* TokenType.NotEq */:\n return token.isTripleEq ? '!==' : '!=';\n case 5 /* TokenType.Lt */:\n return '<';\n case 6 /* TokenType.LtEq */:\n return '<=';\n case 7 /* TokenType.Gt */:\n return '>=';\n case 8 /* TokenType.GtEq */:\n return '>=';\n case 9 /* TokenType.RegexOp */:\n return '=~';\n case 10 /* TokenType.RegexStr */:\n return token.lexeme;\n case 11 /* TokenType.True */:\n return 'true';\n case 12 /* TokenType.False */:\n return 'false';\n case 13 /* TokenType.In */:\n return 'in';\n case 14 /* TokenType.Not */:\n return 'not';\n case 15 /* TokenType.And */:\n return '&&';\n case 16 /* TokenType.Or */:\n return '||';\n case 17 /* TokenType.Str */:\n return token.lexeme;\n case 18 /* TokenType.QuotedStr */:\n return token.lexeme;\n case 19 /* TokenType.Error */:\n return token.lexeme;\n case 20 /* TokenType.EOF */:\n return 'EOF';\n default:\n throw illegalState(`unhandled token type: ${JSON.stringify(token)}; have you forgotten to add a case?`);\n }\n }\n get errors() {\n return this._errors;\n }\n reset(value) {\n this._input = value;\n this._start = 0;\n this._current = 0;\n this._tokens = [];\n this._errors = [];\n return this;\n }\n scan() {\n while (!this._isAtEnd()) {\n this._start = this._current;\n const ch = this._advance();\n switch (ch) {\n case 40 /* CharCode.OpenParen */:\n this._addToken(0 /* TokenType.LParen */);\n break;\n case 41 /* CharCode.CloseParen */:\n this._addToken(1 /* TokenType.RParen */);\n break;\n case 33 /* CharCode.ExclamationMark */:\n if (this._match(61 /* CharCode.Equals */)) {\n const isTripleEq = this._match(61 /* CharCode.Equals */); // eat last `=` if `!==`\n this._tokens.push({ type: 4 /* TokenType.NotEq */, offset: this._start, isTripleEq });\n }\n else {\n this._addToken(2 /* TokenType.Neg */);\n }\n break;\n case 39 /* CharCode.SingleQuote */:\n this._quotedString();\n break;\n case 47 /* CharCode.Slash */:\n this._regex();\n break;\n case 61 /* CharCode.Equals */:\n if (this._match(61 /* CharCode.Equals */)) { // support `==`\n const isTripleEq = this._match(61 /* CharCode.Equals */); // eat last `=` if `===`\n this._tokens.push({ type: 3 /* TokenType.Eq */, offset: this._start, isTripleEq });\n }\n else if (this._match(126 /* CharCode.Tilde */)) {\n this._addToken(9 /* TokenType.RegexOp */);\n }\n else {\n this._error(hintDidYouMean('==', '=~'));\n }\n break;\n case 60 /* CharCode.LessThan */:\n this._addToken(this._match(61 /* CharCode.Equals */) ? 6 /* TokenType.LtEq */ : 5 /* TokenType.Lt */);\n break;\n case 62 /* CharCode.GreaterThan */:\n this._addToken(this._match(61 /* CharCode.Equals */) ? 8 /* TokenType.GtEq */ : 7 /* TokenType.Gt */);\n break;\n case 38 /* CharCode.Ampersand */:\n if (this._match(38 /* CharCode.Ampersand */)) {\n this._addToken(15 /* TokenType.And */);\n }\n else {\n this._error(hintDidYouMean('&&'));\n }\n break;\n case 124 /* CharCode.Pipe */:\n if (this._match(124 /* CharCode.Pipe */)) {\n this._addToken(16 /* TokenType.Or */);\n }\n else {\n this._error(hintDidYouMean('||'));\n }\n break;\n // TODO@ulugbekna: 1) rewrite using a regex 2) reconsider what characters are considered whitespace, including unicode, nbsp, etc.\n case 32 /* CharCode.Space */:\n case 13 /* CharCode.CarriageReturn */:\n case 9 /* CharCode.Tab */:\n case 10 /* CharCode.LineFeed */:\n case 160 /* CharCode.NoBreakSpace */: //  \n break;\n default:\n this._string();\n }\n }\n this._start = this._current;\n this._addToken(20 /* TokenType.EOF */);\n return Array.from(this._tokens);\n }\n _match(expected) {\n if (this._isAtEnd()) {\n return false;\n }\n if (this._input.charCodeAt(this._current) !== expected) {\n return false;\n }\n this._current++;\n return true;\n }\n _advance() {\n return this._input.charCodeAt(this._current++);\n }\n _peek() {\n return this._isAtEnd() ? 0 /* CharCode.Null */ : this._input.charCodeAt(this._current);\n }\n _addToken(type) {\n this._tokens.push({ type, offset: this._start });\n }\n _error(additional) {\n const offset = this._start;\n const lexeme = this._input.substring(this._start, this._current);\n const errToken = { type: 19 /* TokenType.Error */, offset: this._start, lexeme };\n this._errors.push({ offset, lexeme, additionalInfo: additional });\n this._tokens.push(errToken);\n }\n _string() {\n this.stringRe.lastIndex = this._start;\n const match = this.stringRe.exec(this._input);\n if (match) {\n this._current = this._start + match[0].length;\n const lexeme = this._input.substring(this._start, this._current);\n const keyword = Scanner._keywords.get(lexeme);\n if (keyword) {\n this._addToken(keyword);\n }\n else {\n this._tokens.push({ type: 17 /* TokenType.Str */, lexeme, offset: this._start });\n }\n }\n }\n // captures the lexeme without the leading and trailing '\n _quotedString() {\n while (this._peek() !== 39 /* CharCode.SingleQuote */ && !this._isAtEnd()) { // TODO@ulugbekna: add support for escaping ' ?\n this._advance();\n }\n if (this._isAtEnd()) {\n this._error(hintDidYouForgetToOpenOrCloseQuote);\n return;\n }\n // consume the closing '\n this._advance();\n this._tokens.push({ type: 18 /* TokenType.QuotedStr */, lexeme: this._input.substring(this._start + 1, this._current - 1), offset: this._start + 1 });\n }\n /*\n * Lexing a regex expression: /.../[igsmyu]*\n * Based on https://github.com/microsoft/TypeScript/blob/9247ef115e617805983740ba795d7a8164babf89/src/compiler/scanner.ts#L2129-L2181\n *\n * Note that we want slashes within a regex to be escaped, e.g., /file:\\\\/\\\\/\\\\// should match `file:///`\n */\n _regex() {\n let p = this._current;\n let inEscape = false;\n let inCharacterClass = false;\n while (true) {\n if (p >= this._input.length) {\n this._current = p;\n this._error(hintDidYouForgetToEscapeSlash);\n return;\n }\n const ch = this._input.charCodeAt(p);\n if (inEscape) { // parsing an escape character\n inEscape = false;\n }\n else if (ch === 47 /* CharCode.Slash */ && !inCharacterClass) { // end of regex\n p++;\n break;\n }\n else if (ch === 91 /* CharCode.OpenSquareBracket */) {\n inCharacterClass = true;\n }\n else if (ch === 92 /* CharCode.Backslash */) {\n inEscape = true;\n }\n else if (ch === 93 /* CharCode.CloseSquareBracket */) {\n inCharacterClass = false;\n }\n p++;\n }\n // Consume flags // TODO@ulugbekna: use regex instead\n while (p < this._input.length && Scanner._regexFlags.has(this._input.charCodeAt(p))) {\n p++;\n }\n this._current = p;\n const lexeme = this._input.substring(this._start, this._current);\n this._tokens.push({ type: 10 /* TokenType.RegexStr */, lexeme, offset: this._start });\n }\n _isAtEnd() {\n return this._current >= this._input.length;\n }\n}\nScanner._regexFlags = new Set(['i', 'g', 's', 'm', 'y', 'u'].map(ch => ch.charCodeAt(0)));\nScanner._keywords = new Map([\n ['not', 14 /* TokenType.Not */],\n ['in', 13 /* TokenType.In */],\n ['false', 12 /* TokenType.False */],\n ['true', 11 /* TokenType.True */],\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 *--------------------------------------------------------------------------------------------*/\nimport { isChrome, isEdge, isFirefox, isLinux, isMacintosh, isSafari, isWeb, isWindows } from '../../../base/common/platform.js';\nimport { isFalsyOrWhitespace } from '../../../base/common/strings.js';\nimport { Scanner } from './scanner.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { localizeWithPath } from '../../../nls.js';\nimport { illegalArgument } from '../../../base/common/errors.js';\nconst CONSTANT_VALUES = new Map();\nCONSTANT_VALUES.set('false', false);\nCONSTANT_VALUES.set('true', true);\nCONSTANT_VALUES.set('isMac', isMacintosh);\nCONSTANT_VALUES.set('isLinux', isLinux);\nCONSTANT_VALUES.set('isWindows', isWindows);\nCONSTANT_VALUES.set('isWeb', isWeb);\nCONSTANT_VALUES.set('isMacNative', isMacintosh && !isWeb);\nCONSTANT_VALUES.set('isEdge', isEdge);\nCONSTANT_VALUES.set('isFirefox', isFirefox);\nCONSTANT_VALUES.set('isChrome', isChrome);\nCONSTANT_VALUES.set('isSafari', isSafari);\n/** allow register constant context keys that are known only after startup; requires running `substituteConstants` on the context key - https://github.com/microsoft/vscode/issues/174218#issuecomment-1437972127 */\nexport function setConstant(key, value) {\n if (CONSTANT_VALUES.get(key) !== undefined) {\n throw illegalArgument('contextkey.setConstant(k, v) invoked with already set constant `k`');\n }\n CONSTANT_VALUES.set(key, value);\n}\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nconst defaultConfig = {\n regexParsingWithErrorRecovery: true\n};\nconst errorEmptyString = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.emptyString', \"Empty context key expression\");\nconst hintEmptyString = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.emptyString.hint', \"Did you forget to write an expression? You can also put 'false' or 'true' to always evaluate to false or true, respectively.\");\nconst errorNoInAfterNot = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.noInAfterNot', \"'in' after 'not'.\");\nconst errorClosingParenthesis = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.closingParenthesis', \"closing parenthesis ')'\");\nconst errorUnexpectedToken = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.unexpectedToken', \"Unexpected token\");\nconst hintUnexpectedToken = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.unexpectedToken.hint', \"Did you forget to put && or || before the token?\");\nconst errorUnexpectedEOF = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.unexpectedEOF', \"Unexpected end of expression\");\nconst hintUnexpectedEOF = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.unexpectedEOF.hint', \"Did you forget to put a context key?\");\n/**\n * A parser for context key expressions.\n *\n * Example:\n * ```ts\n * const parser = new Parser();\n * const expr = parser.parse('foo == \"bar\" && baz == true');\n *\n * if (expr === undefined) {\n * \t// there were lexing or parsing errors\n * \t// process lexing errors with `parser.lexingErrors`\n * // process parsing errors with `parser.parsingErrors`\n * } else {\n * \t// expr is a valid expression\n * }\n * ```\n */\nexport class Parser {\n get lexingErrors() {\n return this._scanner.errors;\n }\n get parsingErrors() {\n return this._parsingErrors;\n }\n constructor(_config = defaultConfig) {\n this._config = _config;\n // lifetime note: `_scanner` lives as long as the parser does, i.e., is not reset between calls to `parse`\n this._scanner = new Scanner();\n // lifetime note: `_tokens`, `_current`, and `_parsingErrors` must be reset between calls to `parse`\n this._tokens = [];\n this._current = 0; // invariant: 0 <= this._current < this._tokens.length ; any incrementation of this value must first call `_isAtEnd`\n this._parsingErrors = [];\n this._flagsGYRe = /g|y/g;\n }\n /**\n * Parse a context key expression.\n *\n * @param input the expression to parse\n * @returns the parsed expression or `undefined` if there's an error - call `lexingErrors` and `parsingErrors` to see the errors\n */\n parse(input) {\n if (input === '') {\n this._parsingErrors.push({ message: errorEmptyString, offset: 0, lexeme: '', additionalInfo: hintEmptyString });\n return undefined;\n }\n this._tokens = this._scanner.reset(input).scan();\n // @ulugbekna: we do not stop parsing if there are lexing errors to be able to reconstruct regexes with unescaped slashes; TODO@ulugbekna: make this respect config option for recovery\n this._current = 0;\n this._parsingErrors = [];\n try {\n const expr = this._expr();\n if (!this._isAtEnd()) {\n const peek = this._peek();\n const additionalInfo = peek.type === 17 /* TokenType.Str */ ? hintUnexpectedToken : undefined;\n this._parsingErrors.push({ message: errorUnexpectedToken, offset: peek.offset, lexeme: Scanner.getLexeme(peek), additionalInfo });\n throw Parser._parseError;\n }\n return expr;\n }\n catch (e) {\n if (!(e === Parser._parseError)) {\n throw e;\n }\n return undefined;\n }\n }\n _expr() {\n return this._or();\n }\n _or() {\n const expr = [this._and()];\n while (this._matchOne(16 /* TokenType.Or */)) {\n const right = this._and();\n expr.push(right);\n }\n return expr.length === 1 ? expr[0] : ContextKeyExpr.or(...expr);\n }\n _and() {\n const expr = [this._term()];\n while (this._matchOne(15 /* TokenType.And */)) {\n const right = this._term();\n expr.push(right);\n }\n return expr.length === 1 ? expr[0] : ContextKeyExpr.and(...expr);\n }\n _term() {\n if (this._matchOne(2 /* TokenType.Neg */)) {\n const peek = this._peek();\n switch (peek.type) {\n case 11 /* TokenType.True */:\n this._advance();\n return ContextKeyFalseExpr.INSTANCE;\n case 12 /* TokenType.False */:\n this._advance();\n return ContextKeyTrueExpr.INSTANCE;\n case 0 /* TokenType.LParen */: {\n this._advance();\n const expr = this._expr();\n this._consume(1 /* TokenType.RParen */, errorClosingParenthesis);\n return expr?.negate();\n }\n case 17 /* TokenType.Str */:\n this._advance();\n return ContextKeyNotExpr.create(peek.lexeme);\n default:\n throw this._errExpectedButGot(`KEY | true | false | '(' expression ')'`, peek);\n }\n }\n return this._primary();\n }\n _primary() {\n const peek = this._peek();\n switch (peek.type) {\n case 11 /* TokenType.True */:\n this._advance();\n return ContextKeyExpr.true();\n case 12 /* TokenType.False */:\n this._advance();\n return ContextKeyExpr.false();\n case 0 /* TokenType.LParen */: {\n this._advance();\n const expr = this._expr();\n this._consume(1 /* TokenType.RParen */, errorClosingParenthesis);\n return expr;\n }\n case 17 /* TokenType.Str */: {\n // KEY\n const key = peek.lexeme;\n this._advance();\n // =~ regex\n if (this._matchOne(9 /* TokenType.RegexOp */)) {\n // @ulugbekna: we need to reconstruct the regex from the tokens because some extensions use unescaped slashes in regexes\n const expr = this._peek();\n if (!this._config.regexParsingWithErrorRecovery) {\n this._advance();\n if (expr.type !== 10 /* TokenType.RegexStr */) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n const regexLexeme = expr.lexeme;\n const closingSlashIndex = regexLexeme.lastIndexOf('/');\n const flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));\n let regexp;\n try {\n regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);\n }\n catch (e) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n return ContextKeyRegexExpr.create(key, regexp);\n }\n switch (expr.type) {\n case 10 /* TokenType.RegexStr */:\n case 19 /* TokenType.Error */: { // also handle an ErrorToken in case of smth such as /(/file)/\n const lexemeReconstruction = [expr.lexeme]; // /REGEX/ or /REGEX/FLAGS\n this._advance();\n let followingToken = this._peek();\n let parenBalance = 0;\n for (let i = 0; i < expr.lexeme.length; i++) {\n if (expr.lexeme.charCodeAt(i) === 40 /* CharCode.OpenParen */) {\n parenBalance++;\n }\n else if (expr.lexeme.charCodeAt(i) === 41 /* CharCode.CloseParen */) {\n parenBalance--;\n }\n }\n while (!this._isAtEnd() && followingToken.type !== 15 /* TokenType.And */ && followingToken.type !== 16 /* TokenType.Or */) {\n switch (followingToken.type) {\n case 0 /* TokenType.LParen */:\n parenBalance++;\n break;\n case 1 /* TokenType.RParen */:\n parenBalance--;\n break;\n case 10 /* TokenType.RegexStr */:\n case 18 /* TokenType.QuotedStr */:\n for (let i = 0; i < followingToken.lexeme.length; i++) {\n if (followingToken.lexeme.charCodeAt(i) === 40 /* CharCode.OpenParen */) {\n parenBalance++;\n }\n else if (expr.lexeme.charCodeAt(i) === 41 /* CharCode.CloseParen */) {\n parenBalance--;\n }\n }\n }\n if (parenBalance < 0) {\n break;\n }\n lexemeReconstruction.push(Scanner.getLexeme(followingToken));\n this._advance();\n followingToken = this._peek();\n }\n const regexLexeme = lexemeReconstruction.join('');\n const closingSlashIndex = regexLexeme.lastIndexOf('/');\n const flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));\n let regexp;\n try {\n regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);\n }\n catch (e) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n return ContextKeyExpr.regex(key, regexp);\n }\n case 18 /* TokenType.QuotedStr */: {\n const serializedValue = expr.lexeme;\n this._advance();\n // replicate old regex parsing behavior\n let regex = null;\n if (!isFalsyOrWhitespace(serializedValue)) {\n const start = serializedValue.indexOf('/');\n const end = serializedValue.lastIndexOf('/');\n if (start !== end && start >= 0) {\n const value = serializedValue.slice(start + 1, end);\n const caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';\n try {\n regex = new RegExp(value, caseIgnoreFlag);\n }\n catch (_e) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n }\n }\n if (regex === null) {\n throw this._errExpectedButGot('REGEX', expr);\n }\n return ContextKeyRegexExpr.create(key, regex);\n }\n default:\n throw this._errExpectedButGot('REGEX', this._peek());\n }\n }\n // [ 'not' 'in' value ]\n if (this._matchOne(14 /* TokenType.Not */)) {\n this._consume(13 /* TokenType.In */, errorNoInAfterNot);\n const right = this._value();\n return ContextKeyExpr.notIn(key, right);\n }\n // [ ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in') value ]\n const maybeOp = this._peek().type;\n switch (maybeOp) {\n case 3 /* TokenType.Eq */: {\n this._advance();\n const right = this._value();\n if (this._previous().type === 18 /* TokenType.QuotedStr */) { // to preserve old parser behavior: \"foo == 'true'\" is preserved as \"foo == 'true'\", but \"foo == true\" is optimized as \"foo\"\n return ContextKeyExpr.equals(key, right);\n }\n switch (right) {\n case 'true':\n return ContextKeyExpr.has(key);\n case 'false':\n return ContextKeyExpr.not(key);\n default:\n return ContextKeyExpr.equals(key, right);\n }\n }\n case 4 /* TokenType.NotEq */: {\n this._advance();\n const right = this._value();\n if (this._previous().type === 18 /* TokenType.QuotedStr */) { // same as above with \"foo != 'true'\"\n return ContextKeyExpr.notEquals(key, right);\n }\n switch (right) {\n case 'true':\n return ContextKeyExpr.not(key);\n case 'false':\n return ContextKeyExpr.has(key);\n default:\n return ContextKeyExpr.notEquals(key, right);\n }\n }\n // TODO: ContextKeyExpr.smaller(key, right) accepts only `number` as `right` AND during eval of this node, we just eval to `false` if `right` is not a number\n // consequently, package.json linter should _warn_ the user if they're passing undesired things to ops\n case 5 /* TokenType.Lt */:\n this._advance();\n return ContextKeySmallerExpr.create(key, this._value());\n case 6 /* TokenType.LtEq */:\n this._advance();\n return ContextKeySmallerEqualsExpr.create(key, this._value());\n case 7 /* TokenType.Gt */:\n this._advance();\n return ContextKeyGreaterExpr.create(key, this._value());\n case 8 /* TokenType.GtEq */:\n this._advance();\n return ContextKeyGreaterEqualsExpr.create(key, this._value());\n case 13 /* TokenType.In */:\n this._advance();\n return ContextKeyExpr.in(key, this._value());\n default:\n return ContextKeyExpr.has(key);\n }\n }\n case 20 /* TokenType.EOF */:\n this._parsingErrors.push({ message: errorUnexpectedEOF, offset: peek.offset, lexeme: '', additionalInfo: hintUnexpectedEOF });\n throw Parser._parseError;\n default:\n throw this._errExpectedButGot(`true | false | KEY \\n\\t| KEY '=~' REGEX \\n\\t| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`, this._peek());\n }\n }\n _value() {\n const token = this._peek();\n switch (token.type) {\n case 17 /* TokenType.Str */:\n case 18 /* TokenType.QuotedStr */:\n this._advance();\n return token.lexeme;\n case 11 /* TokenType.True */:\n this._advance();\n return 'true';\n case 12 /* TokenType.False */:\n this._advance();\n return 'false';\n case 13 /* TokenType.In */: // we support `in` as a value, e.g., \"when\": \"languageId == in\" - exists in existing extensions\n this._advance();\n return 'in';\n default:\n // this allows \"when\": \"foo == \" which's used by existing extensions\n // we do not call `_advance` on purpose - we don't want to eat unintended tokens\n return '';\n }\n }\n _removeFlagsGY(flags) {\n return flags.replaceAll(this._flagsGYRe, '');\n }\n // careful: this can throw if current token is the initial one (ie index = 0)\n _previous() {\n return this._tokens[this._current - 1];\n }\n _matchOne(token) {\n if (this._check(token)) {\n this._advance();\n return true;\n }\n return false;\n }\n _advance() {\n if (!this._isAtEnd()) {\n this._current++;\n }\n return this._previous();\n }\n _consume(type, message) {\n if (this._check(type)) {\n return this._advance();\n }\n throw this._errExpectedButGot(message, this._peek());\n }\n _errExpectedButGot(expected, got, additionalInfo) {\n const message = localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.parser.error.expectedButGot', \"Expected: {0}\\nReceived: '{1}'.\", expected, Scanner.getLexeme(got));\n const offset = got.offset;\n const lexeme = Scanner.getLexeme(got);\n this._parsingErrors.push({ message, offset, lexeme, additionalInfo });\n return Parser._parseError;\n }\n _check(type) {\n return this._peek().type === type;\n }\n _peek() {\n return this._tokens[this._current];\n }\n _isAtEnd() {\n return this._peek().type === 20 /* TokenType.EOF */;\n }\n}\n// Note: this doesn't produce an exact syntax tree but a normalized one\n// ContextKeyExpression's that we use as AST nodes do not expose constructors that do not normalize\nParser._parseError = new Error();\nexport class ContextKeyExpr {\n static false() {\n return ContextKeyFalseExpr.INSTANCE;\n }\n static true() {\n return ContextKeyTrueExpr.INSTANCE;\n }\n static has(key) {\n return ContextKeyDefinedExpr.create(key);\n }\n static equals(key, value) {\n return ContextKeyEqualsExpr.create(key, value);\n }\n static notEquals(key, value) {\n return ContextKeyNotEqualsExpr.create(key, value);\n }\n static regex(key, value) {\n return ContextKeyRegexExpr.create(key, value);\n }\n static in(key, value) {\n return ContextKeyInExpr.create(key, value);\n }\n static notIn(key, value) {\n return ContextKeyNotInExpr.create(key, value);\n }\n static not(key) {\n return ContextKeyNotExpr.create(key);\n }\n static and(...expr) {\n return ContextKeyAndExpr.create(expr, null, true);\n }\n static or(...expr) {\n return ContextKeyOrExpr.create(expr, null, true);\n }\n static greater(key, value) {\n return ContextKeyGreaterExpr.create(key, value);\n }\n static greaterEquals(key, value) {\n return ContextKeyGreaterEqualsExpr.create(key, value);\n }\n static smaller(key, value) {\n return ContextKeySmallerExpr.create(key, value);\n }\n static smallerEquals(key, value) {\n return ContextKeySmallerEqualsExpr.create(key, value);\n }\n static deserialize(serialized) {\n if (serialized === undefined || serialized === null) { // an empty string needs to be handled by the parser to get a corresponding parsing error reported\n return undefined;\n }\n const expr = this._parser.parse(serialized);\n return expr;\n }\n}\nContextKeyExpr._parser = new Parser({ regexParsingWithErrorRecovery: false });\nexport function validateWhenClauses(whenClauses) {\n const parser = new Parser({ regexParsingWithErrorRecovery: false }); // we run with no recovery to guide users to use correct regexes\n return whenClauses.map(whenClause => {\n parser.parse(whenClause);\n if (parser.lexingErrors.length > 0) {\n return parser.lexingErrors.map((se) => ({\n errorMessage: se.additionalInfo ?\n localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.scanner.errorForLinterWithHint', \"Unexpected token. Hint: {0}\", se.additionalInfo) :\n localizeWithPath('vs/platform/contextkey/common/contextkey', 'contextkey.scanner.errorForLinter', \"Unexpected token.\"),\n offset: se.offset,\n length: se.lexeme.length,\n }));\n }\n else if (parser.parsingErrors.length > 0) {\n return parser.parsingErrors.map((pe) => ({\n errorMessage: pe.additionalInfo ? `${pe.message}. ${pe.additionalInfo}` : pe.message,\n offset: pe.offset,\n length: pe.lexeme.length,\n }));\n }\n else {\n return [];\n }\n });\n}\nexport function expressionsAreEqualWithConstantSubstitution(a, b) {\n const aExpr = a ? a.substituteConstants() : undefined;\n const bExpr = b ? b.substituteConstants() : undefined;\n if (!aExpr && !bExpr) {\n return true;\n }\n if (!aExpr || !bExpr) {\n return false;\n }\n return aExpr.equals(bExpr);\n}\nfunction cmp(a, b) {\n return a.cmp(b);\n}\nexport class ContextKeyFalseExpr {\n constructor() {\n this.type = 0 /* ContextKeyExprType.False */;\n }\n cmp(other) {\n return this.type - other.type;\n }\n equals(other) {\n return (other.type === this.type);\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return false;\n }\n serialize() {\n return 'false';\n }\n keys() {\n return [];\n }\n map(mapFnc) {\n return this;\n }\n negate() {\n return ContextKeyTrueExpr.INSTANCE;\n }\n}\nContextKeyFalseExpr.INSTANCE = new ContextKeyFalseExpr();\nexport class ContextKeyTrueExpr {\n constructor() {\n this.type = 1 /* ContextKeyExprType.True */;\n }\n cmp(other) {\n return this.type - other.type;\n }\n equals(other) {\n return (other.type === this.type);\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return true;\n }\n serialize() {\n return 'true';\n }\n keys() {\n return [];\n }\n map(mapFnc) {\n return this;\n }\n negate() {\n return ContextKeyFalseExpr.INSTANCE;\n }\n}\nContextKeyTrueExpr.INSTANCE = new ContextKeyTrueExpr();\nexport class ContextKeyDefinedExpr {\n static create(key, negated = null) {\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;\n }\n return new ContextKeyDefinedExpr(key, negated);\n }\n constructor(key, negated) {\n this.key = key;\n this.negated = negated;\n this.type = 2 /* ContextKeyExprType.Defined */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp1(this.key, other.key);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;\n }\n return this;\n }\n evaluate(context) {\n return (!!context.getValue(this.key));\n }\n serialize() {\n return this.key;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapDefined(this.key);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotExpr.create(this.key, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyEqualsExpr {\n static create(key, value, negated = null) {\n if (typeof value === 'boolean') {\n return (value ? ContextKeyDefinedExpr.create(key, negated) : ContextKeyNotExpr.create(key, negated));\n }\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n const trueValue = constantValue ? 'true' : 'false';\n return (value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);\n }\n return new ContextKeyEqualsExpr(key, value, negated);\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 4 /* ContextKeyExprType.Equals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n const trueValue = constantValue ? 'true' : 'false';\n return (this.value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);\n }\n return this;\n }\n evaluate(context) {\n // Intentional ==\n // eslint-disable-next-line eqeqeq\n return (context.getValue(this.key) == this.value);\n }\n serialize() {\n return `${this.key} == '${this.value}'`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapEquals(this.key, this.value);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyInExpr {\n static create(key, valueKey) {\n return new ContextKeyInExpr(key, valueKey);\n }\n constructor(key, valueKey) {\n this.key = key;\n this.valueKey = valueKey;\n this.type = 10 /* ContextKeyExprType.In */;\n this.negated = null;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.valueKey, other.key, other.valueKey);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.valueKey === other.valueKey);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n const source = context.getValue(this.valueKey);\n const item = context.getValue(this.key);\n if (Array.isArray(source)) {\n return source.includes(item);\n }\n if (typeof item === 'string' && typeof source === 'object' && source !== null) {\n return hasOwnProperty.call(source, item);\n }\n return false;\n }\n serialize() {\n return `${this.key} in '${this.valueKey}'`;\n }\n keys() {\n return [this.key, this.valueKey];\n }\n map(mapFnc) {\n return mapFnc.mapIn(this.key, this.valueKey);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotInExpr.create(this.key, this.valueKey);\n }\n return this.negated;\n }\n}\nexport class ContextKeyNotInExpr {\n static create(key, valueKey) {\n return new ContextKeyNotInExpr(key, valueKey);\n }\n constructor(key, valueKey) {\n this.key = key;\n this.valueKey = valueKey;\n this.type = 11 /* ContextKeyExprType.NotIn */;\n this._negated = ContextKeyInExpr.create(key, valueKey);\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return this._negated.cmp(other._negated);\n }\n equals(other) {\n if (other.type === this.type) {\n return this._negated.equals(other._negated);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return !this._negated.evaluate(context);\n }\n serialize() {\n return `${this.key} not in '${this.valueKey}'`;\n }\n keys() {\n return this._negated.keys();\n }\n map(mapFnc) {\n return mapFnc.mapNotIn(this.key, this.valueKey);\n }\n negate() {\n return this._negated;\n }\n}\nexport class ContextKeyNotEqualsExpr {\n static create(key, value, negated = null) {\n if (typeof value === 'boolean') {\n if (value) {\n return ContextKeyNotExpr.create(key, negated);\n }\n return ContextKeyDefinedExpr.create(key, negated);\n }\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n const falseValue = constantValue ? 'true' : 'false';\n return (value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return new ContextKeyNotEqualsExpr(key, value, negated);\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 5 /* ContextKeyExprType.NotEquals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n const falseValue = constantValue ? 'true' : 'false';\n return (this.value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return this;\n }\n evaluate(context) {\n // Intentional !=\n // eslint-disable-next-line eqeqeq\n return (context.getValue(this.key) != this.value);\n }\n serialize() {\n return `${this.key} != '${this.value}'`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapNotEquals(this.key, this.value);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyNotExpr {\n static create(key, negated = null) {\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return new ContextKeyNotExpr(key, negated);\n }\n constructor(key, negated) {\n this.key = key;\n this.negated = negated;\n this.type = 3 /* ContextKeyExprType.Not */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp1(this.key, other.key);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return this;\n }\n evaluate(context) {\n return (!context.getValue(this.key));\n }\n serialize() {\n return `!${this.key}`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapNot(this.key);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyDefinedExpr.create(this.key, this);\n }\n return this.negated;\n }\n}\nfunction withFloatOrStr(value, callback) {\n if (typeof value === 'string') {\n const n = parseFloat(value);\n if (!isNaN(n)) {\n value = n;\n }\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return callback(value);\n }\n return ContextKeyFalseExpr.INSTANCE;\n}\nexport class ContextKeyGreaterExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeyGreaterExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 12 /* ContextKeyExprType.Greater */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) > this.value);\n }\n serialize() {\n return `${this.key} > ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapGreater(this.key, this.value);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeySmallerEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyGreaterEqualsExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeyGreaterEqualsExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 13 /* ContextKeyExprType.GreaterEquals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) >= this.value);\n }\n serialize() {\n return `${this.key} >= ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapGreaterEquals(this.key, this.value);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeySmallerExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeySmallerExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeySmallerExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 14 /* ContextKeyExprType.Smaller */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) < this.value);\n }\n serialize() {\n return `${this.key} < ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapSmaller(this.key, this.value);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyGreaterEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeySmallerEqualsExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeySmallerEqualsExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 15 /* ContextKeyExprType.SmallerEquals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) <= this.value);\n }\n serialize() {\n return `${this.key} <= ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapSmallerEquals(this.key, this.value);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyGreaterExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyRegexExpr {\n static create(key, regexp) {\n return new ContextKeyRegexExpr(key, regexp);\n }\n constructor(key, regexp) {\n this.key = key;\n this.regexp = regexp;\n this.type = 7 /* ContextKeyExprType.Regex */;\n this.negated = null;\n //\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n if (this.key < other.key) {\n return -1;\n }\n if (this.key > other.key) {\n return 1;\n }\n const thisSource = this.regexp ? this.regexp.source : '';\n const otherSource = other.regexp ? other.regexp.source : '';\n if (thisSource < otherSource) {\n return -1;\n }\n if (thisSource > otherSource) {\n return 1;\n }\n return 0;\n }\n equals(other) {\n if (other.type === this.type) {\n const thisSource = this.regexp ? this.regexp.source : '';\n const otherSource = other.regexp ? other.regexp.source : '';\n return (this.key === other.key && thisSource === otherSource);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n const value = context.getValue(this.key);\n return this.regexp ? this.regexp.test(value) : false;\n }\n serialize() {\n const value = this.regexp\n ? `/${this.regexp.source}/${this.regexp.flags}`\n : '/invalid/';\n return `${this.key} =~ ${value}`;\n }\n keys() {\n return [this.key];\n }\n map(mapFnc) {\n return mapFnc.mapRegex(this.key, this.regexp);\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotRegexExpr.create(this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyNotRegexExpr {\n static create(actual) {\n return new ContextKeyNotRegexExpr(actual);\n }\n constructor(_actual) {\n this._actual = _actual;\n this.type = 8 /* ContextKeyExprType.NotRegex */;\n //\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return this._actual.cmp(other._actual);\n }\n equals(other) {\n if (other.type === this.type) {\n return this._actual.equals(other._actual);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return !this._actual.evaluate(context);\n }\n serialize() {\n return `!(${this._actual.serialize()})`;\n }\n keys() {\n return this._actual.keys();\n }\n map(mapFnc) {\n return new ContextKeyNotRegexExpr(this._actual.map(mapFnc));\n }\n negate() {\n return this._actual;\n }\n}\n/**\n * @returns the same instance if nothing changed.\n */\nfunction eliminateConstantsInArray(arr) {\n // Allocate array only if there is a difference\n let newArr = null;\n for (let i = 0, len = arr.length; i < len; i++) {\n const newExpr = arr[i].substituteConstants();\n if (arr[i] !== newExpr) {\n // something has changed!\n // allocate array on first difference\n if (newArr === null) {\n newArr = [];\n for (let j = 0; j < i; j++) {\n newArr[j] = arr[j];\n }\n }\n }\n if (newArr !== null) {\n newArr[i] = newExpr;\n }\n }\n if (newArr === null) {\n return arr;\n }\n return newArr;\n}\nexport class ContextKeyAndExpr {\n static create(_expr, negated, extraRedundantCheck) {\n return ContextKeyAndExpr._normalizeArr(_expr, negated, extraRedundantCheck);\n }\n constructor(expr, negated) {\n this.expr = expr;\n this.negated = negated;\n this.type = 6 /* ContextKeyExprType.And */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n if (this.expr.length < other.expr.length) {\n return -1;\n }\n if (this.expr.length > other.expr.length) {\n return 1;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n const r = cmp(this.expr[i], other.expr[i]);\n if (r !== 0) {\n return r;\n }\n }\n return 0;\n }\n equals(other) {\n if (other.type === this.type) {\n if (this.expr.length !== other.expr.length) {\n return false;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (!this.expr[i].equals(other.expr[i])) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n substituteConstants() {\n const exprArr = eliminateConstantsInArray(this.expr);\n if (exprArr === this.expr) {\n // no change\n return this;\n }\n return ContextKeyAndExpr.create(exprArr, this.negated, false);\n }\n evaluate(context) {\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (!this.expr[i].evaluate(context)) {\n return false;\n }\n }\n return true;\n }\n static _normalizeArr(arr, negated, extraRedundantCheck) {\n const expr = [];\n let hasTrue = false;\n for (const e of arr) {\n if (!e) {\n continue;\n }\n if (e.type === 1 /* ContextKeyExprType.True */) {\n // anything && true ==> anything\n hasTrue = true;\n continue;\n }\n if (e.type === 0 /* ContextKeyExprType.False */) {\n // anything && false ==> false\n return ContextKeyFalseExpr.INSTANCE;\n }\n if (e.type === 6 /* ContextKeyExprType.And */) {\n expr.push(...e.expr);\n continue;\n }\n expr.push(e);\n }\n if (expr.length === 0 && hasTrue) {\n return ContextKeyTrueExpr.INSTANCE;\n }\n if (expr.length === 0) {\n return undefined;\n }\n if (expr.length === 1) {\n return expr[0];\n }\n expr.sort(cmp);\n // eliminate duplicate terms\n for (let i = 1; i < expr.length; i++) {\n if (expr[i - 1].equals(expr[i])) {\n expr.splice(i, 1);\n i--;\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // We must distribute any OR expression because we don't support parens\n // OR extensions will be at the end (due to sorting rules)\n while (expr.length > 1) {\n const lastElement = expr[expr.length - 1];\n if (lastElement.type !== 9 /* ContextKeyExprType.Or */) {\n break;\n }\n // pop the last element\n expr.pop();\n // pop the second to last element\n const secondToLastElement = expr.pop();\n const isFinished = (expr.length === 0);\n // distribute `lastElement` over `secondToLastElement`\n const resultElement = ContextKeyOrExpr.create(lastElement.expr.map(el => ContextKeyAndExpr.create([el, secondToLastElement], null, extraRedundantCheck)), null, isFinished);\n if (resultElement) {\n expr.push(resultElement);\n expr.sort(cmp);\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // resolve false AND expressions\n if (extraRedundantCheck) {\n for (let i = 0; i < expr.length; i++) {\n for (let j = i + 1; j < expr.length; j++) {\n if (expr[i].negate().equals(expr[j])) {\n // A && !A case\n return ContextKeyFalseExpr.INSTANCE;\n }\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n }\n return new ContextKeyAndExpr(expr, negated);\n }\n serialize() {\n return this.expr.map(e => e.serialize()).join(' && ');\n }\n keys() {\n const result = [];\n for (const expr of this.expr) {\n result.push(...expr.keys());\n }\n return result;\n }\n map(mapFnc) {\n return new ContextKeyAndExpr(this.expr.map(expr => expr.map(mapFnc)), null);\n }\n negate() {\n if (!this.negated) {\n const result = [];\n for (const expr of this.expr) {\n result.push(expr.negate());\n }\n this.negated = ContextKeyOrExpr.create(result, this, true);\n }\n return this.negated;\n }\n}\nexport class ContextKeyOrExpr {\n static create(_expr, negated, extraRedundantCheck) {\n return ContextKeyOrExpr._normalizeArr(_expr, negated, extraRedundantCheck);\n }\n constructor(expr, negated) {\n this.expr = expr;\n this.negated = negated;\n this.type = 9 /* ContextKeyExprType.Or */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n if (this.expr.length < other.expr.length) {\n return -1;\n }\n if (this.expr.length > other.expr.length) {\n return 1;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n const r = cmp(this.expr[i], other.expr[i]);\n if (r !== 0) {\n return r;\n }\n }\n return 0;\n }\n equals(other) {\n if (other.type === this.type) {\n if (this.expr.length !== other.expr.length) {\n return false;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (!this.expr[i].equals(other.expr[i])) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n substituteConstants() {\n const exprArr = eliminateConstantsInArray(this.expr);\n if (exprArr === this.expr) {\n // no change\n return this;\n }\n return ContextKeyOrExpr.create(exprArr, this.negated, false);\n }\n evaluate(context) {\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (this.expr[i].evaluate(context)) {\n return true;\n }\n }\n return false;\n }\n static _normalizeArr(arr, negated, extraRedundantCheck) {\n let expr = [];\n let hasFalse = false;\n if (arr) {\n for (let i = 0, len = arr.length; i < len; i++) {\n const e = arr[i];\n if (!e) {\n continue;\n }\n if (e.type === 0 /* ContextKeyExprType.False */) {\n // anything || false ==> anything\n hasFalse = true;\n continue;\n }\n if (e.type === 1 /* ContextKeyExprType.True */) {\n // anything || true ==> true\n return ContextKeyTrueExpr.INSTANCE;\n }\n if (e.type === 9 /* ContextKeyExprType.Or */) {\n expr = expr.concat(e.expr);\n continue;\n }\n expr.push(e);\n }\n if (expr.length === 0 && hasFalse) {\n return ContextKeyFalseExpr.INSTANCE;\n }\n expr.sort(cmp);\n }\n if (expr.length === 0) {\n return undefined;\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // eliminate duplicate terms\n for (let i = 1; i < expr.length; i++) {\n if (expr[i - 1].equals(expr[i])) {\n expr.splice(i, 1);\n i--;\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // resolve true OR expressions\n if (extraRedundantCheck) {\n for (let i = 0; i < expr.length; i++) {\n for (let j = i + 1; j < expr.length; j++) {\n if (expr[i].negate().equals(expr[j])) {\n // A || !A case\n return ContextKeyTrueExpr.INSTANCE;\n }\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n }\n return new ContextKeyOrExpr(expr, negated);\n }\n serialize() {\n return this.expr.map(e => e.serialize()).join(' || ');\n }\n keys() {\n const result = [];\n for (const expr of this.expr) {\n result.push(...expr.keys());\n }\n return result;\n }\n map(mapFnc) {\n return new ContextKeyOrExpr(this.expr.map(expr => expr.map(mapFnc)), null);\n }\n negate() {\n if (!this.negated) {\n const result = [];\n for (const expr of this.expr) {\n result.push(expr.negate());\n }\n // We don't support parens, so here we distribute the AND over the OR terminals\n // We always take the first 2 AND pairs and distribute them\n while (result.length > 1) {\n const LEFT = result.shift();\n const RIGHT = result.shift();\n const all = [];\n for (const left of getTerminals(LEFT)) {\n for (const right of getTerminals(RIGHT)) {\n all.push(ContextKeyAndExpr.create([left, right], null, false));\n }\n }\n result.unshift(ContextKeyOrExpr.create(all, null, false));\n }\n this.negated = ContextKeyOrExpr.create(result, this, true);\n }\n return this.negated;\n }\n}\nexport class RawContextKey extends ContextKeyDefinedExpr {\n static all() {\n return RawContextKey._info.values();\n }\n constructor(key, defaultValue, metaOrHide) {\n super(key, null);\n this._defaultValue = defaultValue;\n // collect all context keys into a central place\n if (typeof metaOrHide === 'object') {\n RawContextKey._info.push({ ...metaOrHide, key });\n }\n else if (metaOrHide !== true) {\n RawContextKey._info.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== undefined ? typeof defaultValue : undefined });\n }\n }\n bindTo(target) {\n return target.createKey(this.key, this._defaultValue);\n }\n getValue(target) {\n return target.getContextKeyValue(this.key);\n }\n toNegated() {\n return this.negate();\n }\n isEqualTo(value) {\n return ContextKeyEqualsExpr.create(this.key, value);\n }\n notEqualsTo(value) {\n return ContextKeyNotEqualsExpr.create(this.key, value);\n }\n}\nRawContextKey._info = [];\nexport const IContextKeyService = createDecorator('contextKeyService');\nfunction cmp1(key1, key2) {\n if (key1 < key2) {\n return -1;\n }\n if (key1 > key2) {\n return 1;\n }\n return 0;\n}\nfunction cmp2(key1, value1, key2, value2) {\n if (key1 < key2) {\n return -1;\n }\n if (key1 > key2) {\n return 1;\n }\n if (value1 < value2) {\n return -1;\n }\n if (value1 > value2) {\n return 1;\n }\n return 0;\n}\n/**\n * Returns true if it is provable `p` implies `q`.\n */\nexport function implies(p, q) {\n if (p.type === 0 /* ContextKeyExprType.False */ || q.type === 1 /* ContextKeyExprType.True */) {\n // false implies anything\n // anything implies true\n return true;\n }\n if (p.type === 9 /* ContextKeyExprType.Or */) {\n if (q.type === 9 /* ContextKeyExprType.Or */) {\n // `a || b || c` can only imply something like `a || b || c || d`\n return allElementsIncluded(p.expr, q.expr);\n }\n return false;\n }\n if (q.type === 9 /* ContextKeyExprType.Or */) {\n for (const element of q.expr) {\n if (implies(p, element)) {\n return true;\n }\n }\n return false;\n }\n if (p.type === 6 /* ContextKeyExprType.And */) {\n if (q.type === 6 /* ContextKeyExprType.And */) {\n // `a && b && c` implies `a && c`\n return allElementsIncluded(q.expr, p.expr);\n }\n for (const element of p.expr) {\n if (implies(element, q)) {\n return true;\n }\n }\n return false;\n }\n return p.equals(q);\n}\n/**\n * Returns true if all elements in `p` are also present in `q`.\n * The two arrays are assumed to be sorted\n */\nfunction allElementsIncluded(p, q) {\n let pIndex = 0;\n let qIndex = 0;\n while (pIndex < p.length && qIndex < q.length) {\n const cmp = p[pIndex].cmp(q[qIndex]);\n if (cmp < 0) {\n // an element from `p` is missing from `q`\n return false;\n }\n else if (cmp === 0) {\n pIndex++;\n qIndex++;\n }\n else {\n qIndex++;\n }\n }\n return (pIndex === p.length);\n}\nfunction getTerminals(node) {\n if (node.type === 9 /* ContextKeyExprType.Or */) {\n return node.expr;\n }\n return [node];\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 *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError, onUnexpectedError } from './errors.js';\n/**\n * Throws an error with the provided message if the provided value does not evaluate to a true Javascript value.\n *\n * @deprecated Use `assert(...)` instead.\n * This method is usually used like this:\n * ```ts\n * import * as assert from 'vs/base/common/assert';\n * assert.ok(...);\n * ```\n *\n * However, `assert` in that example is a user chosen name.\n * There is no tooling for generating such an import statement.\n * Thus, the `assert(...)` function should be used instead.\n */\nexport function ok(value, message) {\n if (!value) {\n throw new Error(message ? `Assertion failed (${message})` : 'Assertion Failed');\n }\n}\nexport function assertNever(value, message = 'Unreachable') {\n throw new Error(message);\n}\nexport function assert(condition) {\n if (!condition) {\n throw new BugIndicatingError('Assertion Failed');\n }\n}\n/**\n * condition must be side-effect free!\n */\nexport function assertFn(condition) {\n if (!condition()) {\n // eslint-disable-next-line no-debugger\n debugger;\n // Reevaluate `condition` again to make debugging easier\n condition();\n onUnexpectedError(new BugIndicatingError('Assertion Failed'));\n }\n}\nexport function checkAdjacentItems(items, predicate) {\n let i = 0;\n while (i < items.length - 1) {\n const a = items[i];\n const b = items[i + 1];\n if (!predicate(a, b)) {\n return false;\n }\n i++;\n }\n return true;\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 *--------------------------------------------------------------------------------------------*/\nimport * as Assert from '../../../base/common/assert.js';\nimport * as Types from '../../../base/common/types.js';\nclass RegistryImpl {\n constructor() {\n this.data = new Map();\n }\n add(id, data) {\n Assert.ok(Types.isString(id));\n Assert.ok(Types.isObject(data));\n Assert.ok(!this.data.has(id), 'There is already an extension with this id');\n this.data.set(id, data);\n }\n knows(id) {\n return this.data.has(id);\n }\n as(id) {\n return this.data.get(id) || null;\n }\n}\nexport const Registry = new RegistryImpl();\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 *--------------------------------------------------------------------------------------------*/\nimport { decodeKeybinding } from '../../../base/common/keybindings.js';\nimport { OS } from '../../../base/common/platform.js';\nimport { CommandsRegistry } from '../../commands/common/commands.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { combinedDisposable, DisposableStore, toDisposable } from '../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\n/**\n * Stores all built-in and extension-provided keybindings (but not ones that user defines themselves)\n */\nclass KeybindingsRegistryImpl {\n constructor() {\n this._coreKeybindings = new LinkedList();\n this._extensionKeybindings = [];\n this._cachedMergedKeybindings = null;\n }\n /**\n * Take current platform into account and reduce to primary & secondary.\n */\n static bindToCurrentPlatform(kb) {\n if (OS === 1 /* OperatingSystem.Windows */) {\n if (kb && kb.win) {\n return kb.win;\n }\n }\n else if (OS === 2 /* OperatingSystem.Macintosh */) {\n if (kb && kb.mac) {\n return kb.mac;\n }\n }\n else {\n if (kb && kb.linux) {\n return kb.linux;\n }\n }\n return kb;\n }\n registerKeybindingRule(rule) {\n const actualKb = KeybindingsRegistryImpl.bindToCurrentPlatform(rule);\n const result = new DisposableStore();\n if (actualKb && actualKb.primary) {\n const kk = decodeKeybinding(actualKb.primary, OS);\n if (kk) {\n result.add(this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, 0, rule.when));\n }\n }\n if (actualKb && Array.isArray(actualKb.secondary)) {\n for (let i = 0, len = actualKb.secondary.length; i < len; i++) {\n const k = actualKb.secondary[i];\n const kk = decodeKeybinding(k, OS);\n if (kk) {\n result.add(this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, -i - 1, rule.when));\n }\n }\n }\n return result;\n }\n setExtensionKeybindings(rules) {\n const result = [];\n let keybindingsLen = 0;\n for (const rule of rules) {\n if (rule.keybinding) {\n result[keybindingsLen++] = {\n keybinding: rule.keybinding,\n command: rule.id,\n commandArgs: rule.args,\n when: rule.when,\n weight1: rule.weight,\n weight2: 0,\n extensionId: rule.extensionId || null,\n isBuiltinExtension: rule.isBuiltinExtension || false\n };\n }\n }\n this._extensionKeybindings = result;\n this._cachedMergedKeybindings = null;\n }\n registerCommandAndKeybindingRule(desc) {\n return combinedDisposable(this.registerKeybindingRule(desc), CommandsRegistry.registerCommand(desc));\n }\n _registerDefaultKeybinding(keybinding, commandId, commandArgs, weight1, weight2, when) {\n const remove = this._coreKeybindings.push({\n keybinding: keybinding,\n command: commandId,\n commandArgs: commandArgs,\n when: when,\n weight1: weight1,\n weight2: weight2,\n extensionId: null,\n isBuiltinExtension: false\n });\n this._cachedMergedKeybindings = null;\n return toDisposable(() => {\n remove();\n this._cachedMergedKeybindings = null;\n });\n }\n getDefaultKeybindings() {\n if (!this._cachedMergedKeybindings) {\n this._cachedMergedKeybindings = Array.from(this._coreKeybindings).concat(this._extensionKeybindings);\n this._cachedMergedKeybindings.sort(sorter);\n }\n return this._cachedMergedKeybindings.slice(0);\n }\n}\nexport const KeybindingsRegistry = new KeybindingsRegistryImpl();\n// Define extension point ids\nexport const Extensions = {\n EditorModes: 'platform.keybindingsRegistry'\n};\nRegistry.add(Extensions.EditorModes, KeybindingsRegistry);\nfunction sorter(a, b) {\n if (a.weight1 !== b.weight1) {\n return a.weight1 - b.weight1;\n }\n if (a.command && b.command) {\n if (a.command < b.command) {\n return -1;\n }\n if (a.command > b.command) {\n return 1;\n }\n }\n return a.weight2 - b.weight2;\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar MenuItemAction_1;\nimport { SubmenuAction } from '../../../base/common/actions.js';\nimport { ThemeIcon } from '../../../base/common/themables.js';\nimport { MicrotaskEmitter } from '../../../base/common/event.js';\nimport { DisposableStore, toDisposable } from '../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\nimport { CommandsRegistry, ICommandService } from '../../commands/common/commands.js';\nimport { ContextKeyExpr, IContextKeyService } from '../../contextkey/common/contextkey.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { KeybindingsRegistry } from '../../keybinding/common/keybindingsRegistry.js';\nexport function isIMenuItem(item) {\n return item.command !== undefined;\n}\nexport function isISubmenuItem(item) {\n return item.submenu !== undefined;\n}\nexport class MenuId {\n /**\n * Create or reuse a `MenuId` with the given identifier\n */\n static for(identifier) {\n return MenuId._instances.get(identifier) ?? new MenuId(identifier);\n }\n /**\n * Create a new `MenuId` with the unique identifier. Will throw if a menu\n * with the identifier already exists, use `MenuId.for(ident)` or a unique\n * identifier\n */\n constructor(identifier) {\n if (MenuId._instances.has(identifier)) {\n throw new TypeError(`MenuId with identifier '${identifier}' already exists. Use MenuId.for(ident) or a unique identifier`);\n }\n MenuId._instances.set(identifier, this);\n this.id = identifier;\n }\n}\nMenuId._instances = new Map();\nMenuId.CommandPalette = new MenuId('CommandPalette');\nMenuId.DebugBreakpointsContext = new MenuId('DebugBreakpointsContext');\nMenuId.DebugCallStackContext = new MenuId('DebugCallStackContext');\nMenuId.DebugConsoleContext = new MenuId('DebugConsoleContext');\nMenuId.DebugVariablesContext = new MenuId('DebugVariablesContext');\nMenuId.DebugWatchContext = new MenuId('DebugWatchContext');\nMenuId.DebugToolBar = new MenuId('DebugToolBar');\nMenuId.DebugToolBarStop = new MenuId('DebugToolBarStop');\nMenuId.EditorContext = new MenuId('EditorContext');\nMenuId.SimpleEditorContext = new MenuId('SimpleEditorContext');\nMenuId.EditorContent = new MenuId('EditorContent');\nMenuId.EditorLineNumberContext = new MenuId('EditorLineNumberContext');\nMenuId.EditorContextCopy = new MenuId('EditorContextCopy');\nMenuId.EditorContextPeek = new MenuId('EditorContextPeek');\nMenuId.EditorContextShare = new MenuId('EditorContextShare');\nMenuId.EditorTitle = new MenuId('EditorTitle');\nMenuId.EditorTitleRun = new MenuId('EditorTitleRun');\nMenuId.EditorTitleContext = new MenuId('EditorTitleContext');\nMenuId.EditorTitleContextShare = new MenuId('EditorTitleContextShare');\nMenuId.EmptyEditorGroup = new MenuId('EmptyEditorGroup');\nMenuId.EmptyEditorGroupContext = new MenuId('EmptyEditorGroupContext');\nMenuId.EditorTabsBarContext = new MenuId('EditorTabsBarContext');\nMenuId.EditorTabsBarShowTabsSubmenu = new MenuId('EditorTabsBarShowTabsSubmenu');\nMenuId.EditorActionsPositionSubmenu = new MenuId('EditorActionsPositionSubmenu');\nMenuId.ExplorerContext = new MenuId('ExplorerContext');\nMenuId.ExplorerContextShare = new MenuId('ExplorerContextShare');\nMenuId.ExtensionContext = new MenuId('ExtensionContext');\nMenuId.GlobalActivity = new MenuId('GlobalActivity');\nMenuId.CommandCenter = new MenuId('CommandCenter');\nMenuId.CommandCenterCenter = new MenuId('CommandCenterCenter');\nMenuId.LayoutControlMenuSubmenu = new MenuId('LayoutControlMenuSubmenu');\nMenuId.LayoutControlMenu = new MenuId('LayoutControlMenu');\nMenuId.MenubarMainMenu = new MenuId('MenubarMainMenu');\nMenuId.MenubarAppearanceMenu = new MenuId('MenubarAppearanceMenu');\nMenuId.MenubarDebugMenu = new MenuId('MenubarDebugMenu');\nMenuId.MenubarEditMenu = new MenuId('MenubarEditMenu');\nMenuId.MenubarCopy = new MenuId('MenubarCopy');\nMenuId.MenubarFileMenu = new MenuId('MenubarFileMenu');\nMenuId.MenubarGoMenu = new MenuId('MenubarGoMenu');\nMenuId.MenubarHelpMenu = new MenuId('MenubarHelpMenu');\nMenuId.MenubarLayoutMenu = new MenuId('MenubarLayoutMenu');\nMenuId.MenubarNewBreakpointMenu = new MenuId('MenubarNewBreakpointMenu');\nMenuId.PanelAlignmentMenu = new MenuId('PanelAlignmentMenu');\nMenuId.PanelPositionMenu = new MenuId('PanelPositionMenu');\nMenuId.ActivityBarPositionMenu = new MenuId('ActivityBarPositionMenu');\nMenuId.MenubarPreferencesMenu = new MenuId('MenubarPreferencesMenu');\nMenuId.MenubarRecentMenu = new MenuId('MenubarRecentMenu');\nMenuId.MenubarSelectionMenu = new MenuId('MenubarSelectionMenu');\nMenuId.MenubarShare = new MenuId('MenubarShare');\nMenuId.MenubarSwitchEditorMenu = new MenuId('MenubarSwitchEditorMenu');\nMenuId.MenubarSwitchGroupMenu = new MenuId('MenubarSwitchGroupMenu');\nMenuId.MenubarTerminalMenu = new MenuId('MenubarTerminalMenu');\nMenuId.MenubarViewMenu = new MenuId('MenubarViewMenu');\nMenuId.MenubarHomeMenu = new MenuId('MenubarHomeMenu');\nMenuId.OpenEditorsContext = new MenuId('OpenEditorsContext');\nMenuId.OpenEditorsContextShare = new MenuId('OpenEditorsContextShare');\nMenuId.ProblemsPanelContext = new MenuId('ProblemsPanelContext');\nMenuId.SCMInputBox = new MenuId('SCMInputBox');\nMenuId.SCMHistoryItem = new MenuId('SCMHistoryItem');\nMenuId.SCMChangeContext = new MenuId('SCMChangeContext');\nMenuId.SCMResourceContext = new MenuId('SCMResourceContext');\nMenuId.SCMResourceContextShare = new MenuId('SCMResourceContextShare');\nMenuId.SCMResourceFolderContext = new MenuId('SCMResourceFolderContext');\nMenuId.SCMResourceGroupContext = new MenuId('SCMResourceGroupContext');\nMenuId.SCMSourceControl = new MenuId('SCMSourceControl');\nMenuId.SCMTitle = new MenuId('SCMTitle');\nMenuId.SearchContext = new MenuId('SearchContext');\nMenuId.SearchActionMenu = new MenuId('SearchActionContext');\nMenuId.StatusBarWindowIndicatorMenu = new MenuId('StatusBarWindowIndicatorMenu');\nMenuId.StatusBarRemoteIndicatorMenu = new MenuId('StatusBarRemoteIndicatorMenu');\nMenuId.StickyScrollContext = new MenuId('StickyScrollContext');\nMenuId.TestItem = new MenuId('TestItem');\nMenuId.TestItemGutter = new MenuId('TestItemGutter');\nMenuId.TestMessageContext = new MenuId('TestMessageContext');\nMenuId.TestMessageContent = new MenuId('TestMessageContent');\nMenuId.TestPeekElement = new MenuId('TestPeekElement');\nMenuId.TestPeekTitle = new MenuId('TestPeekTitle');\nMenuId.TouchBarContext = new MenuId('TouchBarContext');\nMenuId.TitleBarContext = new MenuId('TitleBarContext');\nMenuId.TitleBarTitleContext = new MenuId('TitleBarTitleContext');\nMenuId.TunnelContext = new MenuId('TunnelContext');\nMenuId.TunnelPrivacy = new MenuId('TunnelPrivacy');\nMenuId.TunnelProtocol = new MenuId('TunnelProtocol');\nMenuId.TunnelPortInline = new MenuId('TunnelInline');\nMenuId.TunnelTitle = new MenuId('TunnelTitle');\nMenuId.TunnelLocalAddressInline = new MenuId('TunnelLocalAddressInline');\nMenuId.TunnelOriginInline = new MenuId('TunnelOriginInline');\nMenuId.ViewItemContext = new MenuId('ViewItemContext');\nMenuId.ViewContainerTitle = new MenuId('ViewContainerTitle');\nMenuId.ViewContainerTitleContext = new MenuId('ViewContainerTitleContext');\nMenuId.ViewTitle = new MenuId('ViewTitle');\nMenuId.ViewTitleContext = new MenuId('ViewTitleContext');\nMenuId.CommentEditorActions = new MenuId('CommentEditorActions');\nMenuId.CommentThreadTitle = new MenuId('CommentThreadTitle');\nMenuId.CommentThreadActions = new MenuId('CommentThreadActions');\nMenuId.CommentThreadAdditionalActions = new MenuId('CommentThreadAdditionalActions');\nMenuId.CommentThreadTitleContext = new MenuId('CommentThreadTitleContext');\nMenuId.CommentThreadCommentContext = new MenuId('CommentThreadCommentContext');\nMenuId.CommentTitle = new MenuId('CommentTitle');\nMenuId.CommentActions = new MenuId('CommentActions');\nMenuId.InteractiveToolbar = new MenuId('InteractiveToolbar');\nMenuId.InteractiveCellTitle = new MenuId('InteractiveCellTitle');\nMenuId.InteractiveCellDelete = new MenuId('InteractiveCellDelete');\nMenuId.InteractiveCellExecute = new MenuId('InteractiveCellExecute');\nMenuId.InteractiveInputExecute = new MenuId('InteractiveInputExecute');\nMenuId.NotebookToolbar = new MenuId('NotebookToolbar');\nMenuId.NotebookStickyScrollContext = new MenuId('NotebookStickyScrollContext');\nMenuId.NotebookCellTitle = new MenuId('NotebookCellTitle');\nMenuId.NotebookCellDelete = new MenuId('NotebookCellDelete');\nMenuId.NotebookCellInsert = new MenuId('NotebookCellInsert');\nMenuId.NotebookCellBetween = new MenuId('NotebookCellBetween');\nMenuId.NotebookCellListTop = new MenuId('NotebookCellTop');\nMenuId.NotebookCellExecute = new MenuId('NotebookCellExecute');\nMenuId.NotebookCellExecutePrimary = new MenuId('NotebookCellExecutePrimary');\nMenuId.NotebookDiffCellInputTitle = new MenuId('NotebookDiffCellInputTitle');\nMenuId.NotebookDiffCellMetadataTitle = new MenuId('NotebookDiffCellMetadataTitle');\nMenuId.NotebookDiffCellOutputsTitle = new MenuId('NotebookDiffCellOutputsTitle');\nMenuId.NotebookOutputToolbar = new MenuId('NotebookOutputToolbar');\nMenuId.NotebookEditorLayoutConfigure = new MenuId('NotebookEditorLayoutConfigure');\nMenuId.NotebookKernelSource = new MenuId('NotebookKernelSource');\nMenuId.BulkEditTitle = new MenuId('BulkEditTitle');\nMenuId.BulkEditContext = new MenuId('BulkEditContext');\nMenuId.TimelineItemContext = new MenuId('TimelineItemContext');\nMenuId.TimelineTitle = new MenuId('TimelineTitle');\nMenuId.TimelineTitleContext = new MenuId('TimelineTitleContext');\nMenuId.TimelineFilterSubMenu = new MenuId('TimelineFilterSubMenu');\nMenuId.AccountsContext = new MenuId('AccountsContext');\nMenuId.SidebarTitle = new MenuId('SidebarTitle');\nMenuId.PanelTitle = new MenuId('PanelTitle');\nMenuId.AuxiliaryBarTitle = new MenuId('AuxiliaryBarTitle');\nMenuId.TerminalInstanceContext = new MenuId('TerminalInstanceContext');\nMenuId.TerminalEditorInstanceContext = new MenuId('TerminalEditorInstanceContext');\nMenuId.TerminalNewDropdownContext = new MenuId('TerminalNewDropdownContext');\nMenuId.TerminalTabContext = new MenuId('TerminalTabContext');\nMenuId.TerminalTabEmptyAreaContext = new MenuId('TerminalTabEmptyAreaContext');\nMenuId.TerminalStickyScrollContext = new MenuId('TerminalStickyScrollContext');\nMenuId.WebviewContext = new MenuId('WebviewContext');\nMenuId.InlineCompletionsActions = new MenuId('InlineCompletionsActions');\nMenuId.NewFile = new MenuId('NewFile');\nMenuId.MergeInput1Toolbar = new MenuId('MergeToolbar1Toolbar');\nMenuId.MergeInput2Toolbar = new MenuId('MergeToolbar2Toolbar');\nMenuId.MergeBaseToolbar = new MenuId('MergeBaseToolbar');\nMenuId.MergeInputResultToolbar = new MenuId('MergeToolbarResultToolbar');\nMenuId.InlineSuggestionToolbar = new MenuId('InlineSuggestionToolbar');\nMenuId.ChatContext = new MenuId('ChatContext');\nMenuId.ChatCodeBlock = new MenuId('ChatCodeblock');\nMenuId.ChatMessageTitle = new MenuId('ChatMessageTitle');\nMenuId.ChatExecute = new MenuId('ChatExecute');\nMenuId.ChatInputSide = new MenuId('ChatInputSide');\nMenuId.AccessibleView = new MenuId('AccessibleView');\nMenuId.MultiDiffEditorFileToolbar = new MenuId('MultiDiffEditorFileToolbar');\nexport const IMenuService = createDecorator('menuService');\nclass MenuRegistryChangeEvent {\n static for(id) {\n let value = this._all.get(id);\n if (!value) {\n value = new MenuRegistryChangeEvent(id);\n this._all.set(id, value);\n }\n return value;\n }\n static merge(events) {\n const ids = new Set();\n for (const item of events) {\n if (item instanceof MenuRegistryChangeEvent) {\n ids.add(item.id);\n }\n }\n return ids;\n }\n constructor(id) {\n this.id = id;\n this.has = candidate => candidate === id;\n }\n}\nMenuRegistryChangeEvent._all = new Map();\nexport const MenuRegistry = new class {\n constructor() {\n this._commands = new Map();\n this._menuItems = new Map();\n this._onDidChangeMenu = new MicrotaskEmitter({\n merge: MenuRegistryChangeEvent.merge\n });\n this.onDidChangeMenu = this._onDidChangeMenu.event;\n }\n addCommand(command) {\n this._commands.set(command.id, command);\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(MenuId.CommandPalette));\n return toDisposable(() => {\n if (this._commands.delete(command.id)) {\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(MenuId.CommandPalette));\n }\n });\n }\n getCommand(id) {\n return this._commands.get(id);\n }\n getCommands() {\n const map = new Map();\n this._commands.forEach((value, key) => map.set(key, value));\n return map;\n }\n appendMenuItem(id, item) {\n let list = this._menuItems.get(id);\n if (!list) {\n list = new LinkedList();\n this._menuItems.set(id, list);\n }\n const rm = list.push(item);\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(id));\n return toDisposable(() => {\n rm();\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(id));\n });\n }\n appendMenuItems(items) {\n const result = new DisposableStore();\n for (const { id, item } of items) {\n result.add(this.appendMenuItem(id, item));\n }\n return result;\n }\n getMenuItems(id) {\n let result;\n if (this._menuItems.has(id)) {\n result = [...this._menuItems.get(id)];\n }\n else {\n result = [];\n }\n if (id === MenuId.CommandPalette) {\n // CommandPalette is special because it shows\n // all commands by default\n this._appendImplicitItems(result);\n }\n return result;\n }\n _appendImplicitItems(result) {\n const set = new Set();\n for (const item of result) {\n if (isIMenuItem(item)) {\n set.add(item.command.id);\n if (item.alt) {\n set.add(item.alt.id);\n }\n }\n }\n this._commands.forEach((command, id) => {\n if (!set.has(id)) {\n result.push({ command });\n }\n });\n }\n};\nexport class SubmenuItemAction extends SubmenuAction {\n constructor(item, hideActions, actions) {\n super(`submenuitem.${item.submenu.id}`, typeof item.title === 'string' ? item.title : item.title.value, actions, 'submenu');\n this.item = item;\n this.hideActions = hideActions;\n }\n}\n// implements IAction, does NOT extend Action, so that no one\n// subscribes to events of Action or modified properties\nlet MenuItemAction = MenuItemAction_1 = class MenuItemAction {\n static label(action, options) {\n return options?.renderShortTitle && action.shortTitle\n ? (typeof action.shortTitle === 'string' ? action.shortTitle : action.shortTitle.value)\n : (typeof action.title === 'string' ? action.title : action.title.value);\n }\n constructor(item, alt, options, hideActions, contextKeyService, _commandService) {\n this.hideActions = hideActions;\n this._commandService = _commandService;\n this.id = item.id;\n this.label = MenuItemAction_1.label(item, options);\n this.tooltip = (typeof item.tooltip === 'string' ? item.tooltip : item.tooltip?.value) ?? '';\n this.enabled = !item.precondition || contextKeyService.contextMatchesRules(item.precondition);\n this.checked = undefined;\n let icon;\n if (item.toggled) {\n const toggled = (item.toggled.condition ? item.toggled : { condition: item.toggled });\n this.checked = contextKeyService.contextMatchesRules(toggled.condition);\n if (this.checked && toggled.tooltip) {\n this.tooltip = typeof toggled.tooltip === 'string' ? toggled.tooltip : toggled.tooltip.value;\n }\n if (this.checked && ThemeIcon.isThemeIcon(toggled.icon)) {\n icon = toggled.icon;\n }\n if (this.checked && toggled.title) {\n this.label = typeof toggled.title === 'string' ? toggled.title : toggled.title.value;\n }\n }\n if (!icon) {\n icon = ThemeIcon.isThemeIcon(item.icon) ? item.icon : undefined;\n }\n this.item = item;\n this.alt = alt ? new MenuItemAction_1(alt, undefined, options, hideActions, contextKeyService, _commandService) : undefined;\n this._options = options;\n this.class = icon && ThemeIcon.asClassName(icon);\n }\n run(...args) {\n let runArgs = [];\n if (this._options?.arg) {\n runArgs = [...runArgs, this._options.arg];\n }\n if (this._options?.shouldForwardArgs) {\n runArgs = [...runArgs, ...args];\n }\n return this._commandService.executeCommand(this.id, ...runArgs);\n }\n};\nMenuItemAction = MenuItemAction_1 = __decorate([\n __param(4, IContextKeyService),\n __param(5, ICommandService)\n], MenuItemAction);\nexport { MenuItemAction };\nexport class Action2 {\n constructor(desc) {\n this.desc = desc;\n }\n}\nexport function registerAction2(ctor) {\n const disposables = new DisposableStore();\n const action = new ctor();\n const { f1, menu, keybinding, ...command } = action.desc;\n // command\n disposables.add(CommandsRegistry.registerCommand({\n id: command.id,\n handler: (accessor, ...args) => action.run(accessor, ...args),\n metadata: command.metadata,\n }));\n // menu\n if (Array.isArray(menu)) {\n for (const item of menu) {\n disposables.add(MenuRegistry.appendMenuItem(item.id, { command: { ...command, precondition: item.precondition === null ? undefined : command.precondition }, ...item }));\n }\n }\n else if (menu) {\n disposables.add(MenuRegistry.appendMenuItem(menu.id, { command: { ...command, precondition: menu.precondition === null ? undefined : command.precondition }, ...menu }));\n }\n if (f1) {\n disposables.add(MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command, when: command.precondition }));\n disposables.add(MenuRegistry.addCommand(command));\n }\n // keybinding\n if (Array.isArray(keybinding)) {\n for (const item of keybinding) {\n disposables.add(KeybindingsRegistry.registerKeybindingRule({\n ...item,\n id: command.id,\n when: command.precondition ? ContextKeyExpr.and(command.precondition, item.when) : item.when\n }));\n }\n }\n else if (keybinding) {\n disposables.add(KeybindingsRegistry.registerKeybindingRule({\n ...keybinding,\n id: command.id,\n when: command.precondition ? ContextKeyExpr.and(command.precondition, keybinding.when) : keybinding.when\n }));\n }\n return disposables;\n}\n//#endregion\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const ITelemetryService = createDecorator('telemetryService');\nexport const ICustomEndpointTelemetryService = createDecorator('customEndpointTelemetryService');\n// Keys\nexport const currentSessionDateStorageKey = 'telemetry.currentSessionDate';\nexport const firstSessionDateStorageKey = 'telemetry.firstSessionDate';\nexport const lastSessionDateStorageKey = 'telemetry.lastSessionDate';\nexport const machineIdKey = 'telemetry.machineId';\nexport const sqmIdKey = 'telemetry.sqmId';\n// Configuration Keys\nexport const TELEMETRY_SECTION_ID = 'telemetry';\nexport const TELEMETRY_SETTING_ID = 'telemetry.telemetryLevel';\nexport const TELEMETRY_CRASH_REPORTER_SETTING_ID = 'telemetry.enableCrashReporter';\nexport const TELEMETRY_OLD_SETTING_ID = 'telemetry.enableTelemetry';\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 *--------------------------------------------------------------------------------------------*/\nimport * as arrays from './arrays.js';\nimport * as types from './types.js';\nimport * as nls from '../../nls.js';\nfunction exceptionToErrorMessage(exception, verbose) {\n if (verbose && (exception.stack || exception.stacktrace)) {\n return nls.localizeWithPath('vs/base/common/errorMessage', 'stackTrace.format', \"{0}: {1}\", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace));\n }\n return detectSystemErrorMessage(exception);\n}\nfunction stackToString(stack) {\n if (Array.isArray(stack)) {\n return stack.join('\\n');\n }\n return stack;\n}\nfunction detectSystemErrorMessage(exception) {\n // Custom node.js error from us\n if (exception.code === 'ERR_UNC_HOST_NOT_ALLOWED') {\n return `${exception.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`;\n }\n // See https://nodejs.org/api/errors.html#errors_class_system_error\n if (typeof exception.code === 'string' && typeof exception.errno === 'number' && typeof exception.syscall === 'string') {\n return nls.localizeWithPath('vs/base/common/errorMessage', 'nodeExceptionMessage', \"A system error occurred ({0})\", exception.message);\n }\n return exception.message || nls.localizeWithPath('vs/base/common/errorMessage', 'error.defaultMessage', \"An unknown error occurred. Please consult the log for more details.\");\n}\n/**\n * Tries to generate a human readable error message out of the error. If the verbose parameter\n * is set to true, the error message will include stacktrace details if provided.\n *\n * @returns A string containing the error message.\n */\nexport function toErrorMessage(error = null, verbose = false) {\n if (!error) {\n return nls.localizeWithPath('vs/base/common/errorMessage', 'error.defaultMessage', \"An unknown error occurred. Please consult the log for more details.\");\n }\n if (Array.isArray(error)) {\n const errors = arrays.coalesce(error);\n const msg = toErrorMessage(errors[0], verbose);\n if (errors.length > 1) {\n return nls.localizeWithPath('vs/base/common/errorMessage', 'error.moreErrors', \"{0} ({1} errors in total)\", msg, errors.length);\n }\n return msg;\n }\n if (types.isString(error)) {\n return error;\n }\n if (error.detail) {\n const detail = error.detail;\n if (detail.error) {\n return exceptionToErrorMessage(detail.error, verbose);\n }\n if (detail.exception) {\n return exceptionToErrorMessage(detail.exception, verbose);\n }\n }\n if (error.stack) {\n return exceptionToErrorMessage(error, verbose);\n }\n if (error.message) {\n return error.message;\n }\n return nls.localizeWithPath('vs/base/common/errorMessage', 'error.defaultMessage', \"An unknown error occurred. Please consult the log for more details.\");\n}\nexport function isErrorWithActions(obj) {\n const candidate = obj;\n return candidate instanceof Error && Array.isArray(candidate.actions);\n}\nexport function createErrorWithActions(messageOrError, actions) {\n let error;\n if (typeof messageOrError === 'string') {\n error = new Error(messageOrError);\n }\n else {\n error = messageOrError;\n }\n error.actions = actions;\n return error;\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 *--------------------------------------------------------------------------------------------*/\nimport { toErrorMessage } from '../../../base/common/errorMessage.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { hash } from '../../../base/common/hash.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { ResourceMap } from '../../../base/common/map.js';\nimport { isWindows } from '../../../base/common/platform.js';\nimport { joinPath } from '../../../base/common/resources.js';\nimport { isNumber, isString } from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { RawContextKey } from '../../contextkey/common/contextkey.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const ILogService = createDecorator('logService');\nexport const ILoggerService = createDecorator('loggerService');\nfunction now() {\n return new Date().toISOString();\n}\nexport function isLogLevel(thing) {\n return isNumber(thing);\n}\nexport var LogLevel;\n(function (LogLevel) {\n LogLevel[LogLevel[\"Off\"] = 0] = \"Off\";\n LogLevel[LogLevel[\"Trace\"] = 1] = \"Trace\";\n LogLevel[LogLevel[\"Debug\"] = 2] = \"Debug\";\n LogLevel[LogLevel[\"Info\"] = 3] = \"Info\";\n LogLevel[LogLevel[\"Warning\"] = 4] = \"Warning\";\n LogLevel[LogLevel[\"Error\"] = 5] = \"Error\";\n})(LogLevel || (LogLevel = {}));\nexport const DEFAULT_LOG_LEVEL = LogLevel.Info;\nexport function log(logger, level, message) {\n switch (level) {\n case LogLevel.Trace:\n logger.trace(message);\n break;\n case LogLevel.Debug:\n logger.debug(message);\n break;\n case LogLevel.Info:\n logger.info(message);\n break;\n case LogLevel.Warning:\n logger.warn(message);\n break;\n case LogLevel.Error:\n logger.error(message);\n break;\n case LogLevel.Off: /* do nothing */ break;\n default: throw new Error(`Invalid log level ${level}`);\n }\n}\nfunction format(args, verbose = false) {\n let result = '';\n for (let i = 0; i < args.length; i++) {\n let a = args[i];\n if (a instanceof Error) {\n a = toErrorMessage(a, verbose);\n }\n if (typeof a === 'object') {\n try {\n a = JSON.stringify(a);\n }\n catch (e) { }\n }\n result += (i > 0 ? ' ' : '') + a;\n }\n return result;\n}\nexport class AbstractLogger extends Disposable {\n constructor() {\n super(...arguments);\n this.level = DEFAULT_LOG_LEVEL;\n this._onDidChangeLogLevel = this._register(new Emitter());\n this.onDidChangeLogLevel = this._onDidChangeLogLevel.event;\n }\n setLevel(level) {\n if (this.level !== level) {\n this.level = level;\n this._onDidChangeLogLevel.fire(this.level);\n }\n }\n getLevel() {\n return this.level;\n }\n checkLogLevel(level) {\n return this.level !== LogLevel.Off && this.level <= level;\n }\n}\nexport class AbstractMessageLogger extends AbstractLogger {\n constructor(logAlways) {\n super();\n this.logAlways = logAlways;\n }\n checkLogLevel(level) {\n return this.logAlways || super.checkLogLevel(level);\n }\n trace(message, ...args) {\n if (this.checkLogLevel(LogLevel.Trace)) {\n this.log(LogLevel.Trace, format([message, ...args], true));\n }\n }\n debug(message, ...args) {\n if (this.checkLogLevel(LogLevel.Debug)) {\n this.log(LogLevel.Debug, format([message, ...args]));\n }\n }\n info(message, ...args) {\n if (this.checkLogLevel(LogLevel.Info)) {\n this.log(LogLevel.Info, format([message, ...args]));\n }\n }\n warn(message, ...args) {\n if (this.checkLogLevel(LogLevel.Warning)) {\n this.log(LogLevel.Warning, format([message, ...args]));\n }\n }\n error(message, ...args) {\n if (this.checkLogLevel(LogLevel.Error)) {\n if (message instanceof Error) {\n const array = Array.prototype.slice.call(arguments);\n array[0] = message.stack;\n this.log(LogLevel.Error, format(array));\n }\n else {\n this.log(LogLevel.Error, format([message, ...args]));\n }\n }\n }\n flush() { }\n}\nexport class ConsoleMainLogger extends AbstractLogger {\n constructor(logLevel = DEFAULT_LOG_LEVEL) {\n super();\n this.setLevel(logLevel);\n this.useColors = !isWindows;\n }\n trace(message, ...args) {\n if (this.checkLogLevel(LogLevel.Trace)) {\n if (this.useColors) {\n console.log(`\\x1b[90m[main ${now()}]\\x1b[0m`, message, ...args);\n }\n else {\n console.log(`[main ${now()}]`, message, ...args);\n }\n }\n }\n debug(message, ...args) {\n if (this.checkLogLevel(LogLevel.Debug)) {\n if (this.useColors) {\n console.log(`\\x1b[90m[main ${now()}]\\x1b[0m`, message, ...args);\n }\n else {\n console.log(`[main ${now()}]`, message, ...args);\n }\n }\n }\n info(message, ...args) {\n if (this.checkLogLevel(LogLevel.Info)) {\n if (this.useColors) {\n console.log(`\\x1b[90m[main ${now()}]\\x1b[0m`, message, ...args);\n }\n else {\n console.log(`[main ${now()}]`, message, ...args);\n }\n }\n }\n warn(message, ...args) {\n if (this.checkLogLevel(LogLevel.Warning)) {\n if (this.useColors) {\n console.warn(`\\x1b[93m[main ${now()}]\\x1b[0m`, message, ...args);\n }\n else {\n console.warn(`[main ${now()}]`, message, ...args);\n }\n }\n }\n error(message, ...args) {\n if (this.checkLogLevel(LogLevel.Error)) {\n if (this.useColors) {\n console.error(`\\x1b[91m[main ${now()}]\\x1b[0m`, message, ...args);\n }\n else {\n console.error(`[main ${now()}]`, message, ...args);\n }\n }\n }\n dispose() {\n // noop\n }\n flush() {\n // noop\n }\n}\nexport class ConsoleLogger extends AbstractLogger {\n constructor(logLevel = DEFAULT_LOG_LEVEL, useColors = true) {\n super();\n this.useColors = useColors;\n this.setLevel(logLevel);\n }\n trace(message, ...args) {\n if (this.checkLogLevel(LogLevel.Trace)) {\n if (this.useColors) {\n console.log('%cTRACE', 'color: #888', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n debug(message, ...args) {\n if (this.checkLogLevel(LogLevel.Debug)) {\n if (this.useColors) {\n console.log('%cDEBUG', 'background: #eee; color: #888', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n info(message, ...args) {\n if (this.checkLogLevel(LogLevel.Info)) {\n if (this.useColors) {\n console.log('%c INFO', 'color: #33f', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n warn(message, ...args) {\n if (this.checkLogLevel(LogLevel.Warning)) {\n if (this.useColors) {\n console.log('%c WARN', 'color: #993', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n error(message, ...args) {\n if (this.checkLogLevel(LogLevel.Error)) {\n if (this.useColors) {\n console.log('%c ERR', 'color: #f33', message, ...args);\n }\n else {\n console.error(message, ...args);\n }\n }\n }\n dispose() {\n // noop\n }\n flush() {\n // noop\n }\n}\nexport class AdapterLogger extends AbstractLogger {\n constructor(adapter, logLevel = DEFAULT_LOG_LEVEL) {\n super();\n this.adapter = adapter;\n this.setLevel(logLevel);\n }\n trace(message, ...args) {\n if (this.checkLogLevel(LogLevel.Trace)) {\n this.adapter.log(LogLevel.Trace, [this.extractMessage(message), ...args]);\n }\n }\n debug(message, ...args) {\n if (this.checkLogLevel(LogLevel.Debug)) {\n this.adapter.log(LogLevel.Debug, [this.extractMessage(message), ...args]);\n }\n }\n info(message, ...args) {\n if (this.checkLogLevel(LogLevel.Info)) {\n this.adapter.log(LogLevel.Info, [this.extractMessage(message), ...args]);\n }\n }\n warn(message, ...args) {\n if (this.checkLogLevel(LogLevel.Warning)) {\n this.adapter.log(LogLevel.Warning, [this.extractMessage(message), ...args]);\n }\n }\n error(message, ...args) {\n if (this.checkLogLevel(LogLevel.Error)) {\n this.adapter.log(LogLevel.Error, [this.extractMessage(message), ...args]);\n }\n }\n extractMessage(msg) {\n if (typeof msg === 'string') {\n return msg;\n }\n return toErrorMessage(msg, this.checkLogLevel(LogLevel.Trace));\n }\n dispose() {\n // noop\n }\n flush() {\n // noop\n }\n}\nexport class MultiplexLogger extends AbstractLogger {\n constructor(loggers) {\n super();\n this.loggers = loggers;\n if (loggers.length) {\n this.setLevel(loggers[0].getLevel());\n }\n }\n setLevel(level) {\n for (const logger of this.loggers) {\n logger.setLevel(level);\n }\n super.setLevel(level);\n }\n trace(message, ...args) {\n for (const logger of this.loggers) {\n logger.trace(message, ...args);\n }\n }\n debug(message, ...args) {\n for (const logger of this.loggers) {\n logger.debug(message, ...args);\n }\n }\n info(message, ...args) {\n for (const logger of this.loggers) {\n logger.info(message, ...args);\n }\n }\n warn(message, ...args) {\n for (const logger of this.loggers) {\n logger.warn(message, ...args);\n }\n }\n error(message, ...args) {\n for (const logger of this.loggers) {\n logger.error(message, ...args);\n }\n }\n flush() {\n for (const logger of this.loggers) {\n logger.flush();\n }\n }\n dispose() {\n for (const logger of this.loggers) {\n logger.dispose();\n }\n }\n}\nexport class AbstractLoggerService extends Disposable {\n constructor(logLevel, logsHome, loggerResources) {\n super();\n this.logLevel = logLevel;\n this.logsHome = logsHome;\n this._loggers = new ResourceMap();\n this._onDidChangeLoggers = this._register(new Emitter);\n this.onDidChangeLoggers = this._onDidChangeLoggers.event;\n this._onDidChangeLogLevel = this._register(new Emitter);\n this.onDidChangeLogLevel = this._onDidChangeLogLevel.event;\n this._onDidChangeVisibility = this._register(new Emitter);\n this.onDidChangeVisibility = this._onDidChangeVisibility.event;\n if (loggerResources) {\n for (const loggerResource of loggerResources) {\n this._loggers.set(loggerResource.resource, { logger: undefined, info: loggerResource });\n }\n }\n }\n getLoggerEntry(resourceOrId) {\n if (isString(resourceOrId)) {\n return [...this._loggers.values()].find(logger => logger.info.id === resourceOrId);\n }\n return this._loggers.get(resourceOrId);\n }\n getLogger(resourceOrId) {\n return this.getLoggerEntry(resourceOrId)?.logger;\n }\n createLogger(idOrResource, options) {\n const resource = this.toResource(idOrResource);\n const id = isString(idOrResource) ? idOrResource : (options?.id ?? hash(resource.toString()).toString(16));\n let logger = this._loggers.get(resource)?.logger;\n const logLevel = options?.logLevel === 'always' ? LogLevel.Trace : options?.logLevel;\n if (!logger) {\n logger = this.doCreateLogger(resource, logLevel ?? this.getLogLevel(resource) ?? this.logLevel, { ...options, id });\n }\n const loggerEntry = {\n logger,\n info: { resource, id, logLevel, name: options?.name, hidden: options?.hidden, extensionId: options?.extensionId, when: options?.when }\n };\n this.registerLogger(loggerEntry.info);\n // TODO: @sandy081 Remove this once registerLogger can take ILogger\n this._loggers.set(resource, loggerEntry);\n return logger;\n }\n toResource(idOrResource) {\n return isString(idOrResource) ? joinPath(this.logsHome, `${idOrResource}.log`) : idOrResource;\n }\n setLogLevel(arg1, arg2) {\n if (URI.isUri(arg1)) {\n const resource = arg1;\n const logLevel = arg2;\n const logger = this._loggers.get(resource);\n if (logger && logLevel !== logger.info.logLevel) {\n logger.info.logLevel = logLevel === this.logLevel ? undefined : logLevel;\n logger.logger?.setLevel(logLevel);\n this._loggers.set(logger.info.resource, logger);\n this._onDidChangeLogLevel.fire([resource, logLevel]);\n }\n }\n else {\n this.logLevel = arg1;\n for (const [resource, logger] of this._loggers.entries()) {\n if (this._loggers.get(resource)?.info.logLevel === undefined) {\n logger.logger?.setLevel(this.logLevel);\n }\n }\n this._onDidChangeLogLevel.fire(this.logLevel);\n }\n }\n setVisibility(resourceOrId, visibility) {\n const logger = this.getLoggerEntry(resourceOrId);\n if (logger && visibility !== !logger.info.hidden) {\n logger.info.hidden = !visibility;\n this._loggers.set(logger.info.resource, logger);\n this._onDidChangeVisibility.fire([logger.info.resource, visibility]);\n }\n }\n getLogLevel(resource) {\n let logLevel;\n if (resource) {\n logLevel = this._loggers.get(resource)?.info.logLevel;\n }\n return logLevel ?? this.logLevel;\n }\n registerLogger(resource) {\n const existing = this._loggers.get(resource.resource);\n if (existing) {\n if (existing.info.hidden !== resource.hidden) {\n this.setVisibility(resource.resource, !resource.hidden);\n }\n }\n else {\n this._loggers.set(resource.resource, { info: resource, logger: undefined });\n this._onDidChangeLoggers.fire({ added: [resource], removed: [] });\n }\n }\n deregisterLogger(resource) {\n const existing = this._loggers.get(resource);\n if (existing) {\n if (existing.logger) {\n existing.logger.dispose();\n }\n this._loggers.delete(resource);\n this._onDidChangeLoggers.fire({ added: [], removed: [existing.info] });\n }\n }\n *getRegisteredLoggers() {\n for (const entry of this._loggers.values()) {\n yield entry.info;\n }\n }\n getRegisteredLogger(resource) {\n return this._loggers.get(resource)?.info;\n }\n dispose() {\n this._loggers.forEach(logger => logger.logger?.dispose());\n this._loggers.clear();\n super.dispose();\n }\n}\nexport class NullLogger {\n constructor() {\n this.onDidChangeLogLevel = new Emitter().event;\n }\n setLevel(level) { }\n getLevel() { return LogLevel.Info; }\n trace(message, ...args) { }\n debug(message, ...args) { }\n info(message, ...args) { }\n warn(message, ...args) { }\n error(message, ...args) { }\n critical(message, ...args) { }\n dispose() { }\n flush() { }\n}\nexport class NullLogService extends NullLogger {\n}\nexport function getLogLevel(environmentService) {\n if (environmentService.verbose) {\n return LogLevel.Trace;\n }\n if (typeof environmentService.logLevel === 'string') {\n const logLevel = parseLogLevel(environmentService.logLevel.toLowerCase());\n if (logLevel !== undefined) {\n return logLevel;\n }\n }\n return DEFAULT_LOG_LEVEL;\n}\nexport function LogLevelToString(logLevel) {\n switch (logLevel) {\n case LogLevel.Trace: return 'trace';\n case LogLevel.Debug: return 'debug';\n case LogLevel.Info: return 'info';\n case LogLevel.Warning: return 'warn';\n case LogLevel.Error: return 'error';\n case LogLevel.Off: return 'off';\n }\n}\nexport function parseLogLevel(logLevel) {\n switch (logLevel) {\n case 'trace':\n return LogLevel.Trace;\n case 'debug':\n return LogLevel.Debug;\n case 'info':\n return LogLevel.Info;\n case 'warn':\n return LogLevel.Warning;\n case 'error':\n return LogLevel.Error;\n case 'critical':\n return LogLevel.Error;\n case 'off':\n return LogLevel.Off;\n }\n return undefined;\n}\n// Contexts\nexport const CONTEXT_LOG_LEVEL = new RawContextKey('logLevel', LogLevelToString(LogLevel.Info));\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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../nls.js';\nimport { URI } from '../../base/common/uri.js';\nimport { ICodeEditorService } from './services/codeEditorService.js';\nimport { Position } from '../common/core/position.js';\nimport { IModelService } from '../common/services/model.js';\nimport { ITextModelService } from '../common/services/resolverService.js';\nimport { MenuId, MenuRegistry, Action2 } from '../../platform/actions/common/actions.js';\nimport { CommandsRegistry } from '../../platform/commands/common/commands.js';\nimport { ContextKeyExpr, IContextKeyService } from '../../platform/contextkey/common/contextkey.js';\nimport { IInstantiationService } from '../../platform/instantiation/common/instantiation.js';\nimport { KeybindingsRegistry } from '../../platform/keybinding/common/keybindingsRegistry.js';\nimport { Registry } from '../../platform/registry/common/platform.js';\nimport { ITelemetryService } from '../../platform/telemetry/common/telemetry.js';\nimport { assertType } from '../../base/common/types.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { getActiveElement } from '../../base/browser/dom.js';\nexport class Command {\n constructor(opts) {\n this.id = opts.id;\n this.precondition = opts.precondition;\n this._kbOpts = opts.kbOpts;\n this._menuOpts = opts.menuOpts;\n this.metadata = opts.metadata;\n }\n register() {\n if (Array.isArray(this._menuOpts)) {\n this._menuOpts.forEach(this._registerMenuItem, this);\n }\n else if (this._menuOpts) {\n this._registerMenuItem(this._menuOpts);\n }\n if (this._kbOpts) {\n const kbOptsArr = Array.isArray(this._kbOpts) ? this._kbOpts : [this._kbOpts];\n for (const kbOpts of kbOptsArr) {\n let kbWhen = kbOpts.kbExpr;\n if (this.precondition) {\n if (kbWhen) {\n kbWhen = ContextKeyExpr.and(kbWhen, this.precondition);\n }\n else {\n kbWhen = this.precondition;\n }\n }\n const desc = {\n id: this.id,\n weight: kbOpts.weight,\n args: kbOpts.args,\n when: kbWhen,\n primary: kbOpts.primary,\n secondary: kbOpts.secondary,\n win: kbOpts.win,\n linux: kbOpts.linux,\n mac: kbOpts.mac,\n };\n KeybindingsRegistry.registerKeybindingRule(desc);\n }\n }\n CommandsRegistry.registerCommand({\n id: this.id,\n handler: (accessor, args) => this.runCommand(accessor, args),\n metadata: this.metadata\n });\n }\n _registerMenuItem(item) {\n MenuRegistry.appendMenuItem(item.menuId, {\n group: item.group,\n command: {\n id: this.id,\n title: item.title,\n icon: item.icon,\n precondition: this.precondition\n },\n when: item.when,\n order: item.order\n });\n }\n}\nexport class MultiCommand extends Command {\n constructor() {\n super(...arguments);\n this._implementations = [];\n }\n /**\n * A higher priority gets to be looked at first\n */\n addImplementation(priority, name, implementation, when) {\n this._implementations.push({ priority, name, implementation, when });\n this._implementations.sort((a, b) => b.priority - a.priority);\n return {\n dispose: () => {\n for (let i = 0; i < this._implementations.length; i++) {\n if (this._implementations[i].implementation === implementation) {\n this._implementations.splice(i, 1);\n return;\n }\n }\n }\n };\n }\n runCommand(accessor, args) {\n const logService = accessor.get(ILogService);\n const contextKeyService = accessor.get(IContextKeyService);\n logService.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);\n for (const impl of this._implementations) {\n if (impl.when) {\n const context = contextKeyService.getContext(getActiveElement());\n const value = impl.when.evaluate(context);\n if (!value) {\n continue;\n }\n }\n const result = impl.implementation(accessor, args);\n if (result) {\n logService.trace(`Command '${this.id}' was handled by '${impl.name}'.`);\n if (typeof result === 'boolean') {\n return;\n }\n return result;\n }\n }\n logService.trace(`The Command '${this.id}' was not handled by any implementation.`);\n }\n}\n//#endregion\n/**\n * A command that delegates to another command's implementation.\n *\n * This lets different commands be registered but share the same implementation\n */\nexport class ProxyCommand extends Command {\n constructor(command, opts) {\n super(opts);\n this.command = command;\n }\n runCommand(accessor, args) {\n return this.command.runCommand(accessor, args);\n }\n}\nexport class EditorCommand extends Command {\n /**\n * Create a command class that is bound to a certain editor contribution.\n */\n static bindToContribution(controllerGetter) {\n return class EditorControllerCommandImpl extends EditorCommand {\n constructor(opts) {\n super(opts);\n this._callback = opts.handler;\n }\n runEditorCommand(accessor, editor, args) {\n const controller = controllerGetter(editor);\n if (controller) {\n this._callback(controller, args);\n }\n }\n };\n }\n static runEditorCommand(accessor, args, precondition, runner) {\n const codeEditorService = accessor.get(ICodeEditorService);\n // Find the editor with text focus or active\n const editor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();\n if (!editor) {\n // well, at least we tried...\n return;\n }\n return editor.invokeWithinContext((editorAccessor) => {\n const kbService = editorAccessor.get(IContextKeyService);\n if (!kbService.contextMatchesRules(precondition ?? undefined)) {\n // precondition does not hold\n return;\n }\n return runner(editorAccessor, editor, args);\n });\n }\n runCommand(accessor, args) {\n return EditorCommand.runEditorCommand(accessor, args, this.precondition, (accessor, editor, args) => this.runEditorCommand(accessor, editor, args));\n }\n}\nexport class EditorAction extends EditorCommand {\n static convertOptions(opts) {\n let menuOpts;\n if (Array.isArray(opts.menuOpts)) {\n menuOpts = opts.menuOpts;\n }\n else if (opts.menuOpts) {\n menuOpts = [opts.menuOpts];\n }\n else {\n menuOpts = [];\n }\n function withDefaults(item) {\n if (!item.menuId) {\n item.menuId = MenuId.EditorContext;\n }\n if (!item.title) {\n item.title = opts.label;\n }\n item.when = ContextKeyExpr.and(opts.precondition, item.when);\n return item;\n }\n if (Array.isArray(opts.contextMenuOpts)) {\n menuOpts.push(...opts.contextMenuOpts.map(withDefaults));\n }\n else if (opts.contextMenuOpts) {\n menuOpts.push(withDefaults(opts.contextMenuOpts));\n }\n opts.menuOpts = menuOpts;\n return opts;\n }\n constructor(opts) {\n super(EditorAction.convertOptions(opts));\n this.label = opts.label;\n this.alias = opts.alias;\n }\n runEditorCommand(accessor, editor, args) {\n this.reportTelemetry(accessor, editor);\n return this.run(accessor, editor, args || {});\n }\n reportTelemetry(accessor, editor) {\n accessor.get(ITelemetryService).publicLog2('editorActionInvoked', { name: this.label, id: this.id });\n }\n}\nexport class MultiEditorAction extends EditorAction {\n constructor() {\n super(...arguments);\n this._implementations = [];\n }\n /**\n * A higher priority gets to be looked at first\n */\n addImplementation(priority, implementation) {\n this._implementations.push([priority, implementation]);\n this._implementations.sort((a, b) => b[0] - a[0]);\n return {\n dispose: () => {\n for (let i = 0; i < this._implementations.length; i++) {\n if (this._implementations[i][1] === implementation) {\n this._implementations.splice(i, 1);\n return;\n }\n }\n }\n };\n }\n run(accessor, editor, args) {\n for (const impl of this._implementations) {\n const result = impl[1](accessor, editor, args);\n if (result) {\n if (typeof result === 'boolean') {\n return;\n }\n return result;\n }\n }\n }\n}\n//#endregion EditorAction\n//#region EditorAction2\nexport class EditorAction2 extends Action2 {\n run(accessor, ...args) {\n // Find the editor with text focus or active\n const codeEditorService = accessor.get(ICodeEditorService);\n const editor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();\n if (!editor) {\n // well, at least we tried...\n return;\n }\n // precondition does hold\n return editor.invokeWithinContext((editorAccessor) => {\n const kbService = editorAccessor.get(IContextKeyService);\n const logService = editorAccessor.get(ILogService);\n const enabled = kbService.contextMatchesRules(this.desc.precondition ?? undefined);\n if (!enabled) {\n logService.debug(`[EditorAction2] NOT running command because its precondition is FALSE`, this.desc.id, this.desc.precondition?.serialize());\n return;\n }\n return this.runEditorCommand(editorAccessor, editor, ...args);\n });\n }\n}\n//#endregion\n// --- Registration of commands and actions\nexport function registerModelAndPositionCommand(id, handler) {\n CommandsRegistry.registerCommand(id, function (accessor, ...args) {\n const instaService = accessor.get(IInstantiationService);\n const [resource, position] = args;\n assertType(URI.isUri(resource));\n assertType(Position.isIPosition(position));\n const model = accessor.get(IModelService).getModel(resource);\n if (model) {\n const editorPosition = Position.lift(position);\n return instaService.invokeFunction(handler, model, editorPosition, ...args.slice(2));\n }\n return accessor.get(ITextModelService).createModelReference(resource).then(reference => {\n return new Promise((resolve, reject) => {\n try {\n const result = instaService.invokeFunction(handler, reference.object.textEditorModel, Position.lift(position), args.slice(2));\n resolve(result);\n }\n catch (err) {\n reject(err);\n }\n }).finally(() => {\n reference.dispose();\n });\n });\n });\n}\nexport function registerEditorCommand(editorCommand) {\n EditorContributionRegistry.INSTANCE.registerEditorCommand(editorCommand);\n return editorCommand;\n}\nexport function registerEditorAction(ctor) {\n const action = new ctor();\n EditorContributionRegistry.INSTANCE.registerEditorAction(action);\n return action;\n}\nexport function registerMultiEditorAction(action) {\n EditorContributionRegistry.INSTANCE.registerEditorAction(action);\n return action;\n}\nexport function registerInstantiatedEditorAction(editorAction) {\n EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction);\n}\n/**\n * Registers an editor contribution. Editor contributions have a lifecycle which is bound\n * to a specific code editor instance.\n */\nexport function registerEditorContribution(id, ctor, instantiation) {\n EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor, instantiation);\n}\n/**\n * Registers a diff editor contribution. Diff editor contributions have a lifecycle which\n * is bound to a specific diff editor instance.\n */\nexport function registerDiffEditorContribution(id, ctor) {\n EditorContributionRegistry.INSTANCE.registerDiffEditorContribution(id, ctor);\n}\nexport var EditorExtensionsRegistry;\n(function (EditorExtensionsRegistry) {\n function getEditorCommand(commandId) {\n return EditorContributionRegistry.INSTANCE.getEditorCommand(commandId);\n }\n EditorExtensionsRegistry.getEditorCommand = getEditorCommand;\n function getEditorActions() {\n return EditorContributionRegistry.INSTANCE.getEditorActions();\n }\n EditorExtensionsRegistry.getEditorActions = getEditorActions;\n function getEditorContributions() {\n return EditorContributionRegistry.INSTANCE.getEditorContributions();\n }\n EditorExtensionsRegistry.getEditorContributions = getEditorContributions;\n function getSomeEditorContributions(ids) {\n return EditorContributionRegistry.INSTANCE.getEditorContributions().filter(c => ids.indexOf(c.id) >= 0);\n }\n EditorExtensionsRegistry.getSomeEditorContributions = getSomeEditorContributions;\n function getDiffEditorContributions() {\n return EditorContributionRegistry.INSTANCE.getDiffEditorContributions();\n }\n EditorExtensionsRegistry.getDiffEditorContributions = getDiffEditorContributions;\n})(EditorExtensionsRegistry || (EditorExtensionsRegistry = {}));\n// Editor extension points\nconst Extensions = {\n EditorCommonContributions: 'editor.contributions'\n};\nclass EditorContributionRegistry {\n constructor() {\n this.editorContributions = [];\n this.diffEditorContributions = [];\n this.editorActions = [];\n this.editorCommands = Object.create(null);\n }\n registerEditorContribution(id, ctor, instantiation) {\n this.editorContributions.push({ id, ctor: ctor, instantiation });\n }\n getEditorContributions() {\n return this.editorContributions.slice(0);\n }\n registerDiffEditorContribution(id, ctor) {\n this.diffEditorContributions.push({ id, ctor: ctor });\n }\n getDiffEditorContributions() {\n return this.diffEditorContributions.slice(0);\n }\n registerEditorAction(action) {\n action.register();\n this.editorActions.push(action);\n }\n getEditorActions() {\n return this.editorActions;\n }\n registerEditorCommand(editorCommand) {\n editorCommand.register();\n this.editorCommands[editorCommand.id] = editorCommand;\n }\n getEditorCommand(commandId) {\n return (this.editorCommands[commandId] || null);\n }\n}\nEditorContributionRegistry.INSTANCE = new EditorContributionRegistry();\nRegistry.add(Extensions.EditorCommonContributions, EditorContributionRegistry.INSTANCE);\nfunction registerCommand(command) {\n command.register();\n return command;\n}\nexport const UndoCommand = registerCommand(new MultiCommand({\n id: 'undo',\n precondition: undefined,\n kbOpts: {\n weight: 0 /* KeybindingWeight.EditorCore */,\n primary: 2048 /* KeyMod.CtrlCmd */ | 56 /* KeyCode.KeyZ */\n },\n menuOpts: [{\n menuId: MenuId.MenubarEditMenu,\n group: '1_do',\n title: nls.localizeWithPath('vs/editor/browser/editorExtensions', { key: 'miUndo', comment: ['&& denotes a mnemonic'] }, \"&&Undo\"),\n order: 1\n }, {\n menuId: MenuId.CommandPalette,\n group: '',\n title: nls.localizeWithPath('vs/editor/browser/editorExtensions', 'undo', \"Undo\"),\n order: 1\n }]\n}));\nregisterCommand(new ProxyCommand(UndoCommand, { id: 'default:undo', precondition: undefined }));\nexport const RedoCommand = registerCommand(new MultiCommand({\n id: 'redo',\n precondition: undefined,\n kbOpts: {\n weight: 0 /* KeybindingWeight.EditorCore */,\n primary: 2048 /* KeyMod.CtrlCmd */ | 55 /* KeyCode.KeyY */,\n secondary: [2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 56 /* KeyCode.KeyZ */],\n mac: { primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 56 /* KeyCode.KeyZ */ }\n },\n menuOpts: [{\n menuId: MenuId.MenubarEditMenu,\n group: '1_do',\n title: nls.localizeWithPath('vs/editor/browser/editorExtensions', { key: 'miRedo', comment: ['&& denotes a mnemonic'] }, \"&&Redo\"),\n order: 2\n }, {\n menuId: MenuId.CommandPalette,\n group: '',\n title: nls.localizeWithPath('vs/editor/browser/editorExtensions', 'redo', \"Redo\"),\n order: 1\n }]\n}));\nregisterCommand(new ProxyCommand(RedoCommand, { id: 'default:redo', precondition: undefined }));\nexport const SelectAllCommand = registerCommand(new MultiCommand({\n id: 'editor.action.selectAll',\n precondition: undefined,\n kbOpts: {\n weight: 0 /* KeybindingWeight.EditorCore */,\n kbExpr: null,\n primary: 2048 /* KeyMod.CtrlCmd */ | 31 /* KeyCode.KeyA */\n },\n menuOpts: [{\n menuId: MenuId.MenubarSelectionMenu,\n group: '1_basic',\n title: nls.localizeWithPath('vs/editor/browser/editorExtensions', { key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, \"&&Select All\"),\n order: 1\n }, {\n menuId: MenuId.CommandPalette,\n group: '',\n title: nls.localizeWithPath('vs/editor/browser/editorExtensions', 'selectAll', \"Select All\"),\n order: 1\n }]\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 *--------------------------------------------------------------------------------------------*/\nexport function createScopedLineTokens(context, offset) {\n const tokenCount = context.getCount();\n const tokenIndex = context.findTokenIndexAtOffset(offset);\n const desiredLanguageId = context.getLanguageId(tokenIndex);\n let lastTokenIndex = tokenIndex;\n while (lastTokenIndex + 1 < tokenCount && context.getLanguageId(lastTokenIndex + 1) === desiredLanguageId) {\n lastTokenIndex++;\n }\n let firstTokenIndex = tokenIndex;\n while (firstTokenIndex > 0 && context.getLanguageId(firstTokenIndex - 1) === desiredLanguageId) {\n firstTokenIndex--;\n }\n return new ScopedLineTokens(context, desiredLanguageId, firstTokenIndex, lastTokenIndex + 1, context.getStartOffset(firstTokenIndex), context.getEndOffset(lastTokenIndex));\n}\nexport class ScopedLineTokens {\n constructor(actual, languageId, firstTokenIndex, lastTokenIndex, firstCharOffset, lastCharOffset) {\n this._scopedLineTokensBrand = undefined;\n this._actual = actual;\n this.languageId = languageId;\n this._firstTokenIndex = firstTokenIndex;\n this._lastTokenIndex = lastTokenIndex;\n this.firstCharOffset = firstCharOffset;\n this._lastCharOffset = lastCharOffset;\n }\n getLineContent() {\n const actualLineContent = this._actual.getLineContent();\n return actualLineContent.substring(this.firstCharOffset, this._lastCharOffset);\n }\n getActualLineContentBefore(offset) {\n const actualLineContent = this._actual.getLineContent();\n return actualLineContent.substring(0, this.firstCharOffset + offset);\n }\n getTokenCount() {\n return this._lastTokenIndex - this._firstTokenIndex;\n }\n findTokenIndexAtOffset(offset) {\n return this._actual.findTokenIndexAtOffset(offset + this.firstCharOffset) - this._firstTokenIndex;\n }\n getStandardTokenType(tokenIndex) {\n return this._actual.getStandardTokenType(tokenIndex + this._firstTokenIndex);\n }\n}\nexport function ignoreBracketsInToken(standardTokenType) {\n return (standardTokenType & 3 /* IgnoreBracketsInTokens.value */) !== 0;\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\n/**\n * A column in a position is the gap between two adjacent characters. The methods here\n * work with a concept called \"visible column\". A visible column is a very rough approximation\n * of the horizontal screen position of a column. For example, using a tab size of 4:\n * ```txt\n * |||T|ext\n * | | | \\---- column = 4, visible column = 9\n * | | \\------ column = 3, visible column = 8\n * | \\------------ column = 2, visible column = 4\n * \\------------------ column = 1, visible column = 0\n * ```\n *\n * **NOTE**: Visual columns do not work well for RTL text or variable-width fonts or characters.\n *\n * **NOTE**: These methods work and make sense both on the model and on the view model.\n */\nexport class CursorColumns {\n static _nextVisibleColumn(codePoint, visibleColumn, tabSize) {\n if (codePoint === 9 /* CharCode.Tab */) {\n return CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\n }\n if (strings.isFullWidthCharacter(codePoint) || strings.isEmojiImprecise(codePoint)) {\n return visibleColumn + 2;\n }\n return visibleColumn + 1;\n }\n /**\n * Returns a visible column from a column.\n * @see {@link CursorColumns}\n */\n static visibleColumnFromColumn(lineContent, column, tabSize) {\n const textLen = Math.min(column - 1, lineContent.length);\n const text = lineContent.substring(0, textLen);\n const iterator = new strings.GraphemeIterator(text);\n let result = 0;\n while (!iterator.eol()) {\n const codePoint = strings.getNextCodePoint(text, textLen, iterator.offset);\n iterator.nextGraphemeLength();\n result = this._nextVisibleColumn(codePoint, result, tabSize);\n }\n return result;\n }\n /**\n * Returns the value to display as \"Col\" in the status bar.\n * @see {@link CursorColumns}\n */\n static toStatusbarColumn(lineContent, column, tabSize) {\n const text = lineContent.substring(0, Math.min(column - 1, lineContent.length));\n const iterator = new strings.CodePointIterator(text);\n let result = 0;\n while (!iterator.eol()) {\n const codePoint = iterator.nextCodePoint();\n if (codePoint === 9 /* CharCode.Tab */) {\n result = CursorColumns.nextRenderTabStop(result, tabSize);\n }\n else {\n result = result + 1;\n }\n }\n return result + 1;\n }\n /**\n * Returns a column from a visible column.\n * @see {@link CursorColumns}\n */\n static columnFromVisibleColumn(lineContent, visibleColumn, tabSize) {\n if (visibleColumn <= 0) {\n return 1;\n }\n const lineContentLength = lineContent.length;\n const iterator = new strings.GraphemeIterator(lineContent);\n let beforeVisibleColumn = 0;\n let beforeColumn = 1;\n while (!iterator.eol()) {\n const codePoint = strings.getNextCodePoint(lineContent, lineContentLength, iterator.offset);\n iterator.nextGraphemeLength();\n const afterVisibleColumn = this._nextVisibleColumn(codePoint, beforeVisibleColumn, tabSize);\n const afterColumn = iterator.offset + 1;\n if (afterVisibleColumn >= visibleColumn) {\n const beforeDelta = visibleColumn - beforeVisibleColumn;\n const afterDelta = afterVisibleColumn - visibleColumn;\n if (afterDelta < beforeDelta) {\n return afterColumn;\n }\n else {\n return beforeColumn;\n }\n }\n beforeVisibleColumn = afterVisibleColumn;\n beforeColumn = afterColumn;\n }\n // walked the entire string\n return lineContentLength + 1;\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static nextRenderTabStop(visibleColumn, tabSize) {\n return visibleColumn + tabSize - visibleColumn % tabSize;\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static nextIndentTabStop(visibleColumn, indentSize) {\n return visibleColumn + indentSize - visibleColumn % indentSize;\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static prevRenderTabStop(column, tabSize) {\n return Math.max(0, column - 1 - (column - 1) % tabSize);\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static prevIndentTabStop(column, indentSize) {\n return Math.max(0, column - 1 - (column - 1) % indentSize);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport { CursorColumns } from './cursorColumns.js';\nfunction _normalizeIndentationFromWhitespace(str, indentSize, insertSpaces) {\n let spacesCnt = 0;\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) === '\\t') {\n spacesCnt = CursorColumns.nextIndentTabStop(spacesCnt, indentSize);\n }\n else {\n spacesCnt++;\n }\n }\n let result = '';\n if (!insertSpaces) {\n const tabsCnt = Math.floor(spacesCnt / indentSize);\n spacesCnt = spacesCnt % indentSize;\n for (let i = 0; i < tabsCnt; i++) {\n result += '\\t';\n }\n }\n for (let i = 0; i < spacesCnt; i++) {\n result += ' ';\n }\n return result;\n}\nexport function normalizeIndentation(str, indentSize, insertSpaces) {\n let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(str);\n if (firstNonWhitespaceIndex === -1) {\n firstNonWhitespaceIndex = str.length;\n }\n return _normalizeIndentationFromWhitespace(str.substring(0, firstNonWhitespaceIndex), indentSize, insertSpaces) + str.substring(firstNonWhitespaceIndex);\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 *--------------------------------------------------------------------------------------------*/\nimport { Position } from './core/position.js';\nimport { Range } from './core/range.js';\nimport { Selection } from './core/selection.js';\nimport { createScopedLineTokens } from './languages/supports.js';\nimport { CursorColumns } from './core/cursorColumns.js';\nimport { normalizeIndentation } from './core/indentation.js';\nconst autoCloseAlways = () => true;\nconst autoCloseNever = () => false;\nconst autoCloseBeforeWhitespace = (chr) => (chr === ' ' || chr === '\\t');\nexport class CursorConfiguration {\n static shouldRecreate(e) {\n return (e.hasChanged(143 /* EditorOption.layoutInfo */)\n || e.hasChanged(129 /* EditorOption.wordSeparators */)\n || e.hasChanged(37 /* EditorOption.emptySelectionClipboard */)\n || e.hasChanged(76 /* EditorOption.multiCursorMergeOverlapping */)\n || e.hasChanged(78 /* EditorOption.multiCursorPaste */)\n || e.hasChanged(79 /* EditorOption.multiCursorLimit */)\n || e.hasChanged(6 /* EditorOption.autoClosingBrackets */)\n || e.hasChanged(7 /* EditorOption.autoClosingComments */)\n || e.hasChanged(11 /* EditorOption.autoClosingQuotes */)\n || e.hasChanged(9 /* EditorOption.autoClosingDelete */)\n || e.hasChanged(10 /* EditorOption.autoClosingOvertype */)\n || e.hasChanged(14 /* EditorOption.autoSurround */)\n || e.hasChanged(127 /* EditorOption.useTabStops */)\n || e.hasChanged(50 /* EditorOption.fontInfo */)\n || e.hasChanged(90 /* EditorOption.readOnly */));\n }\n constructor(languageId, modelOptions, configuration, languageConfigurationService) {\n this.languageConfigurationService = languageConfigurationService;\n this._cursorMoveConfigurationBrand = undefined;\n this._languageId = languageId;\n const options = configuration.options;\n const layoutInfo = options.get(143 /* EditorOption.layoutInfo */);\n const fontInfo = options.get(50 /* EditorOption.fontInfo */);\n this.readOnly = options.get(90 /* EditorOption.readOnly */);\n this.tabSize = modelOptions.tabSize;\n this.indentSize = modelOptions.indentSize;\n this.insertSpaces = modelOptions.insertSpaces;\n this.stickyTabStops = options.get(115 /* EditorOption.stickyTabStops */);\n this.lineHeight = fontInfo.lineHeight;\n this.typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;\n this.pageSize = Math.max(1, Math.floor(layoutInfo.height / this.lineHeight) - 2);\n this.useTabStops = options.get(127 /* EditorOption.useTabStops */);\n this.wordSeparators = options.get(129 /* EditorOption.wordSeparators */);\n this.emptySelectionClipboard = options.get(37 /* EditorOption.emptySelectionClipboard */);\n this.copyWithSyntaxHighlighting = options.get(25 /* EditorOption.copyWithSyntaxHighlighting */);\n this.multiCursorMergeOverlapping = options.get(76 /* EditorOption.multiCursorMergeOverlapping */);\n this.multiCursorPaste = options.get(78 /* EditorOption.multiCursorPaste */);\n this.multiCursorLimit = options.get(79 /* EditorOption.multiCursorLimit */);\n this.autoClosingBrackets = options.get(6 /* EditorOption.autoClosingBrackets */);\n this.autoClosingComments = options.get(7 /* EditorOption.autoClosingComments */);\n this.autoClosingQuotes = options.get(11 /* EditorOption.autoClosingQuotes */);\n this.autoClosingDelete = options.get(9 /* EditorOption.autoClosingDelete */);\n this.autoClosingOvertype = options.get(10 /* EditorOption.autoClosingOvertype */);\n this.autoSurround = options.get(14 /* EditorOption.autoSurround */);\n this.autoIndent = options.get(12 /* EditorOption.autoIndent */);\n this.surroundingPairs = {};\n this._electricChars = null;\n this.shouldAutoCloseBefore = {\n quote: this._getShouldAutoClose(languageId, this.autoClosingQuotes, true),\n comment: this._getShouldAutoClose(languageId, this.autoClosingComments, false),\n bracket: this._getShouldAutoClose(languageId, this.autoClosingBrackets, false),\n };\n this.autoClosingPairs = this.languageConfigurationService.getLanguageConfiguration(languageId).getAutoClosingPairs();\n const surroundingPairs = this.languageConfigurationService.getLanguageConfiguration(languageId).getSurroundingPairs();\n if (surroundingPairs) {\n for (const pair of surroundingPairs) {\n this.surroundingPairs[pair.open] = pair.close;\n }\n }\n const commentsConfiguration = this.languageConfigurationService.getLanguageConfiguration(languageId).comments;\n this.blockCommentStartToken = commentsConfiguration?.blockCommentStartToken ?? null;\n }\n get electricChars() {\n if (!this._electricChars) {\n this._electricChars = {};\n const electricChars = this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();\n if (electricChars) {\n for (const char of electricChars) {\n this._electricChars[char] = true;\n }\n }\n }\n return this._electricChars;\n }\n /**\n * Should return opening bracket type to match indentation with\n */\n onElectricCharacter(character, context, column) {\n const scopedLineTokens = createScopedLineTokens(context, column - 1);\n const electricCharacterSupport = this.languageConfigurationService.getLanguageConfiguration(scopedLineTokens.languageId).electricCharacter;\n if (!electricCharacterSupport) {\n return null;\n }\n return electricCharacterSupport.onElectricCharacter(character, scopedLineTokens, column - scopedLineTokens.firstCharOffset);\n }\n normalizeIndentation(str) {\n return normalizeIndentation(str, this.indentSize, this.insertSpaces);\n }\n _getShouldAutoClose(languageId, autoCloseConfig, forQuotes) {\n switch (autoCloseConfig) {\n case 'beforeWhitespace':\n return autoCloseBeforeWhitespace;\n case 'languageDefined':\n return this._getLanguageDefinedShouldAutoClose(languageId, forQuotes);\n case 'always':\n return autoCloseAlways;\n case 'never':\n return autoCloseNever;\n }\n }\n _getLanguageDefinedShouldAutoClose(languageId, forQuotes) {\n const autoCloseBeforeSet = this.languageConfigurationService.getLanguageConfiguration(languageId).getAutoCloseBeforeSet(forQuotes);\n return c => autoCloseBeforeSet.indexOf(c) !== -1;\n }\n /**\n * Returns a visible column from a column.\n * @see {@link CursorColumns}\n */\n visibleColumnFromColumn(model, position) {\n return CursorColumns.visibleColumnFromColumn(model.getLineContent(position.lineNumber), position.column, this.tabSize);\n }\n /**\n * Returns a visible column from a column.\n * @see {@link CursorColumns}\n */\n columnFromVisibleColumn(model, lineNumber, visibleColumn) {\n const result = CursorColumns.columnFromVisibleColumn(model.getLineContent(lineNumber), visibleColumn, this.tabSize);\n const minColumn = model.getLineMinColumn(lineNumber);\n if (result < minColumn) {\n return minColumn;\n }\n const maxColumn = model.getLineMaxColumn(lineNumber);\n if (result > maxColumn) {\n return maxColumn;\n }\n return result;\n }\n}\nexport class CursorState {\n static fromModelState(modelState) {\n return new PartialModelCursorState(modelState);\n }\n static fromViewState(viewState) {\n return new PartialViewCursorState(viewState);\n }\n static fromModelSelection(modelSelection) {\n const selection = Selection.liftSelection(modelSelection);\n const modelState = new SingleCursorState(Range.fromPositions(selection.getSelectionStart()), 0 /* SelectionStartKind.Simple */, 0, selection.getPosition(), 0);\n return CursorState.fromModelState(modelState);\n }\n static fromModelSelections(modelSelections) {\n const states = [];\n for (let i = 0, len = modelSelections.length; i < len; i++) {\n states[i] = this.fromModelSelection(modelSelections[i]);\n }\n return states;\n }\n constructor(modelState, viewState) {\n this._cursorStateBrand = undefined;\n this.modelState = modelState;\n this.viewState = viewState;\n }\n equals(other) {\n return (this.viewState.equals(other.viewState) && this.modelState.equals(other.modelState));\n }\n}\nexport class PartialModelCursorState {\n constructor(modelState) {\n this.modelState = modelState;\n this.viewState = null;\n }\n}\nexport class PartialViewCursorState {\n constructor(viewState) {\n this.modelState = null;\n this.viewState = viewState;\n }\n}\n/**\n * Represents the cursor state on either the model or on the view model.\n */\nexport class SingleCursorState {\n constructor(selectionStart, selectionStartKind, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns) {\n this.selectionStart = selectionStart;\n this.selectionStartKind = selectionStartKind;\n this.selectionStartLeftoverVisibleColumns = selectionStartLeftoverVisibleColumns;\n this.position = position;\n this.leftoverVisibleColumns = leftoverVisibleColumns;\n this._singleCursorStateBrand = undefined;\n this.selection = SingleCursorState._computeSelection(this.selectionStart, this.position);\n }\n equals(other) {\n return (this.selectionStartLeftoverVisibleColumns === other.selectionStartLeftoverVisibleColumns\n && this.leftoverVisibleColumns === other.leftoverVisibleColumns\n && this.selectionStartKind === other.selectionStartKind\n && this.position.equals(other.position)\n && this.selectionStart.equalsRange(other.selectionStart));\n }\n hasSelection() {\n return (!this.selection.isEmpty() || !this.selectionStart.isEmpty());\n }\n move(inSelectionMode, lineNumber, column, leftoverVisibleColumns) {\n if (inSelectionMode) {\n // move just position\n return new SingleCursorState(this.selectionStart, this.selectionStartKind, this.selectionStartLeftoverVisibleColumns, new Position(lineNumber, column), leftoverVisibleColumns);\n }\n else {\n // move everything\n return new SingleCursorState(new Range(lineNumber, column, lineNumber, column), 0 /* SelectionStartKind.Simple */, leftoverVisibleColumns, new Position(lineNumber, column), leftoverVisibleColumns);\n }\n }\n static _computeSelection(selectionStart, position) {\n if (selectionStart.isEmpty() || !position.isBeforeOrEqual(selectionStart.getStartPosition())) {\n return Selection.fromPositions(selectionStart.getStartPosition(), position);\n }\n else {\n return Selection.fromPositions(selectionStart.getEndPosition(), position);\n }\n }\n}\nexport class EditOperationResult {\n constructor(type, commands, opts) {\n this._editOperationResultBrand = undefined;\n this.type = type;\n this.commands = commands;\n this.shouldPushStackElementBefore = opts.shouldPushStackElementBefore;\n this.shouldPushStackElementAfter = opts.shouldPushStackElementAfter;\n }\n}\nexport function isQuote(ch) {\n return (ch === '\\'' || ch === '\"' || ch === '`');\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 *--------------------------------------------------------------------------------------------*/\nimport { SingleCursorState } from '../cursorCommon.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nexport class ColumnSelection {\n static columnSelect(config, model, fromLineNumber, fromVisibleColumn, toLineNumber, toVisibleColumn) {\n const lineCount = Math.abs(toLineNumber - fromLineNumber) + 1;\n const reversed = (fromLineNumber > toLineNumber);\n const isRTL = (fromVisibleColumn > toVisibleColumn);\n const isLTR = (fromVisibleColumn < toVisibleColumn);\n const result = [];\n // console.log(`fromVisibleColumn: ${fromVisibleColumn}, toVisibleColumn: ${toVisibleColumn}`);\n for (let i = 0; i < lineCount; i++) {\n const lineNumber = fromLineNumber + (reversed ? -i : i);\n const startColumn = config.columnFromVisibleColumn(model, lineNumber, fromVisibleColumn);\n const endColumn = config.columnFromVisibleColumn(model, lineNumber, toVisibleColumn);\n const visibleStartColumn = config.visibleColumnFromColumn(model, new Position(lineNumber, startColumn));\n const visibleEndColumn = config.visibleColumnFromColumn(model, new Position(lineNumber, endColumn));\n // console.log(`lineNumber: ${lineNumber}: visibleStartColumn: ${visibleStartColumn}, visibleEndColumn: ${visibleEndColumn}`);\n if (isLTR) {\n if (visibleStartColumn > toVisibleColumn) {\n continue;\n }\n if (visibleEndColumn < fromVisibleColumn) {\n continue;\n }\n }\n if (isRTL) {\n if (visibleEndColumn > fromVisibleColumn) {\n continue;\n }\n if (visibleStartColumn < toVisibleColumn) {\n continue;\n }\n }\n result.push(new SingleCursorState(new Range(lineNumber, startColumn, lineNumber, startColumn), 0 /* SelectionStartKind.Simple */, 0, new Position(lineNumber, endColumn), 0));\n }\n if (result.length === 0) {\n // We are after all the lines, so add cursor at the end of each line\n for (let i = 0; i < lineCount; i++) {\n const lineNumber = fromLineNumber + (reversed ? -i : i);\n const maxColumn = model.getLineMaxColumn(lineNumber);\n result.push(new SingleCursorState(new Range(lineNumber, maxColumn, lineNumber, maxColumn), 0 /* SelectionStartKind.Simple */, 0, new Position(lineNumber, maxColumn), 0));\n }\n }\n return {\n viewStates: result,\n reversed: reversed,\n fromLineNumber: fromLineNumber,\n fromVisualColumn: fromVisibleColumn,\n toLineNumber: toLineNumber,\n toVisualColumn: toVisibleColumn\n };\n }\n static columnSelectLeft(config, model, prevColumnSelectData) {\n let toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;\n if (toViewVisualColumn > 0) {\n toViewVisualColumn--;\n }\n return ColumnSelection.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);\n }\n static columnSelectRight(config, model, prevColumnSelectData) {\n let maxVisualViewColumn = 0;\n const minViewLineNumber = Math.min(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);\n const maxViewLineNumber = Math.max(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);\n for (let lineNumber = minViewLineNumber; lineNumber <= maxViewLineNumber; lineNumber++) {\n const lineMaxViewColumn = model.getLineMaxColumn(lineNumber);\n const lineMaxVisualViewColumn = config.visibleColumnFromColumn(model, new Position(lineNumber, lineMaxViewColumn));\n maxVisualViewColumn = Math.max(maxVisualViewColumn, lineMaxVisualViewColumn);\n }\n let toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;\n if (toViewVisualColumn < maxVisualViewColumn) {\n toViewVisualColumn++;\n }\n return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);\n }\n static columnSelectUp(config, model, prevColumnSelectData, isPaged) {\n const linesCount = isPaged ? config.pageSize : 1;\n const toViewLineNumber = Math.max(1, prevColumnSelectData.toViewLineNumber - linesCount);\n return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);\n }\n static columnSelectDown(config, model, prevColumnSelectData, isPaged) {\n const linesCount = isPaged ? config.pageSize : 1;\n const toViewLineNumber = Math.min(model.getLineCount(), prevColumnSelectData.toViewLineNumber + linesCount);\n return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Selection } from '../core/selection.js';\nexport class ReplaceCommand {\n constructor(range, text, insertsAutoWhitespace = false) {\n this._range = range;\n this._text = text;\n this.insertsAutoWhitespace = insertsAutoWhitespace;\n }\n getEditOperations(model, builder) {\n builder.addTrackedEditOperation(this._range, this._text);\n }\n computeCursorState(model, helper) {\n const inverseEditOperations = helper.getInverseEditOperations();\n const srcRange = inverseEditOperations[0].range;\n return Selection.fromPositions(srcRange.getEndPosition());\n }\n}\nexport class ReplaceCommandThatSelectsText {\n constructor(range, text) {\n this._range = range;\n this._text = text;\n }\n getEditOperations(model, builder) {\n builder.addTrackedEditOperation(this._range, this._text);\n }\n computeCursorState(model, helper) {\n const inverseEditOperations = helper.getInverseEditOperations();\n const srcRange = inverseEditOperations[0].range;\n return Selection.fromRange(srcRange, 0 /* SelectionDirection.LTR */);\n }\n}\nexport class ReplaceCommandWithoutChangingPosition {\n constructor(range, text, insertsAutoWhitespace = false) {\n this._range = range;\n this._text = text;\n this.insertsAutoWhitespace = insertsAutoWhitespace;\n }\n getEditOperations(model, builder) {\n builder.addTrackedEditOperation(this._range, this._text);\n }\n computeCursorState(model, helper) {\n const inverseEditOperations = helper.getInverseEditOperations();\n const srcRange = inverseEditOperations[0].range;\n return Selection.fromPositions(srcRange.getStartPosition());\n }\n}\nexport class ReplaceCommandWithOffsetCursorState {\n constructor(range, text, lineNumberDeltaOffset, columnDeltaOffset, insertsAutoWhitespace = false) {\n this._range = range;\n this._text = text;\n this._columnDeltaOffset = columnDeltaOffset;\n this._lineNumberDeltaOffset = lineNumberDeltaOffset;\n this.insertsAutoWhitespace = insertsAutoWhitespace;\n }\n getEditOperations(model, builder) {\n builder.addTrackedEditOperation(this._range, this._text);\n }\n computeCursorState(model, helper) {\n const inverseEditOperations = helper.getInverseEditOperations();\n const srcRange = inverseEditOperations[0].range;\n return Selection.fromPositions(srcRange.getEndPosition().delta(this._lineNumberDeltaOffset, this._columnDeltaOffset));\n }\n}\nexport class ReplaceCommandThatPreservesSelection {\n constructor(editRange, text, initialSelection, forceMoveMarkers = false) {\n this._range = editRange;\n this._text = text;\n this._initialSelection = initialSelection;\n this._forceMoveMarkers = forceMoveMarkers;\n this._selectionId = null;\n }\n getEditOperations(model, builder) {\n builder.addTrackedEditOperation(this._range, this._text, this._forceMoveMarkers);\n this._selectionId = builder.trackSelection(this._initialSelection);\n }\n computeCursorState(model, helper) {\n return helper.getTrackedSelection(this._selectionId);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { CursorColumns } from '../core/cursorColumns.js';\nexport class AtomicTabMoveOperations {\n /**\n * Get the visible column at the position. If we get to a non-whitespace character first\n * or past the end of string then return -1.\n *\n * **Note** `position` and the return value are 0-based.\n */\n static whitespaceVisibleColumn(lineContent, position, tabSize) {\n const lineLength = lineContent.length;\n let visibleColumn = 0;\n let prevTabStopPosition = -1;\n let prevTabStopVisibleColumn = -1;\n for (let i = 0; i < lineLength; i++) {\n if (i === position) {\n return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];\n }\n if (visibleColumn % tabSize === 0) {\n prevTabStopPosition = i;\n prevTabStopVisibleColumn = visibleColumn;\n }\n const chCode = lineContent.charCodeAt(i);\n switch (chCode) {\n case 32 /* CharCode.Space */:\n visibleColumn += 1;\n break;\n case 9 /* CharCode.Tab */:\n // Skip to the next multiple of tabSize.\n visibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\n break;\n default:\n return [-1, -1, -1];\n }\n }\n if (position === lineLength) {\n return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];\n }\n return [-1, -1, -1];\n }\n /**\n * Return the position that should result from a move left, right or to the\n * nearest tab, if atomic tabs are enabled. Left and right are used for the\n * arrow key movements, nearest is used for mouse selection. It returns\n * -1 if atomic tabs are not relevant and you should fall back to normal\n * behaviour.\n *\n * **Note**: `position` and the return value are 0-based.\n */\n static atomicPosition(lineContent, position, tabSize, direction) {\n const lineLength = lineContent.length;\n // Get the 0-based visible column corresponding to the position, or return\n // -1 if it is not in the initial whitespace.\n const [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn] = AtomicTabMoveOperations.whitespaceVisibleColumn(lineContent, position, tabSize);\n if (visibleColumn === -1) {\n return -1;\n }\n // Is the output left or right of the current position. The case for nearest\n // where it is the same as the current position is handled in the switch.\n let left;\n switch (direction) {\n case 0 /* Direction.Left */:\n left = true;\n break;\n case 1 /* Direction.Right */:\n left = false;\n break;\n case 2 /* Direction.Nearest */:\n // The code below assumes the output position is either left or right\n // of the input position. If it is the same, return immediately.\n if (visibleColumn % tabSize === 0) {\n return position;\n }\n // Go to the nearest indentation.\n left = visibleColumn % tabSize <= (tabSize / 2);\n break;\n }\n // If going left, we can just use the info about the last tab stop position and\n // last tab stop visible column that we computed in the first walk over the whitespace.\n if (left) {\n if (prevTabStopPosition === -1) {\n return -1;\n }\n // If the direction is left, we need to keep scanning right to ensure\n // that targetVisibleColumn + tabSize is before non-whitespace.\n // This is so that when we press left at the end of a partial\n // indentation it only goes one character. For example ' foo' with\n // tabSize 4, should jump from position 6 to position 5, not 4.\n let currentVisibleColumn = prevTabStopVisibleColumn;\n for (let i = prevTabStopPosition; i < lineLength; ++i) {\n if (currentVisibleColumn === prevTabStopVisibleColumn + tabSize) {\n // It is a full indentation.\n return prevTabStopPosition;\n }\n const chCode = lineContent.charCodeAt(i);\n switch (chCode) {\n case 32 /* CharCode.Space */:\n currentVisibleColumn += 1;\n break;\n case 9 /* CharCode.Tab */:\n currentVisibleColumn = CursorColumns.nextRenderTabStop(currentVisibleColumn, tabSize);\n break;\n default:\n return -1;\n }\n }\n if (currentVisibleColumn === prevTabStopVisibleColumn + tabSize) {\n return prevTabStopPosition;\n }\n // It must have been a partial indentation.\n return -1;\n }\n // We are going right.\n const targetVisibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\n // We can just continue from where whitespaceVisibleColumn got to.\n let currentVisibleColumn = visibleColumn;\n for (let i = position; i < lineLength; i++) {\n if (currentVisibleColumn === targetVisibleColumn) {\n return i;\n }\n const chCode = lineContent.charCodeAt(i);\n switch (chCode) {\n case 32 /* CharCode.Space */:\n currentVisibleColumn += 1;\n break;\n case 9 /* CharCode.Tab */:\n currentVisibleColumn = CursorColumns.nextRenderTabStop(currentVisibleColumn, tabSize);\n break;\n default:\n return -1;\n }\n }\n // This condition handles when the target column is at the end of the line.\n if (currentVisibleColumn === targetVisibleColumn) {\n return lineLength;\n }\n return -1;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport { CursorColumns } from '../core/cursorColumns.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nimport { AtomicTabMoveOperations } from './cursorAtomicMoveOperations.js';\nimport { SingleCursorState } from '../cursorCommon.js';\nexport class CursorPosition {\n constructor(lineNumber, column, leftoverVisibleColumns) {\n this._cursorPositionBrand = undefined;\n this.lineNumber = lineNumber;\n this.column = column;\n this.leftoverVisibleColumns = leftoverVisibleColumns;\n }\n}\nexport class MoveOperations {\n static leftPosition(model, position) {\n if (position.column > model.getLineMinColumn(position.lineNumber)) {\n return position.delta(undefined, -strings.prevCharLength(model.getLineContent(position.lineNumber), position.column - 1));\n }\n else if (position.lineNumber > 1) {\n const newLineNumber = position.lineNumber - 1;\n return new Position(newLineNumber, model.getLineMaxColumn(newLineNumber));\n }\n else {\n return position;\n }\n }\n static leftPositionAtomicSoftTabs(model, position, tabSize) {\n if (position.column <= model.getLineIndentColumn(position.lineNumber)) {\n const minColumn = model.getLineMinColumn(position.lineNumber);\n const lineContent = model.getLineContent(position.lineNumber);\n const newPosition = AtomicTabMoveOperations.atomicPosition(lineContent, position.column - 1, tabSize, 0 /* Direction.Left */);\n if (newPosition !== -1 && newPosition + 1 >= minColumn) {\n return new Position(position.lineNumber, newPosition + 1);\n }\n }\n return this.leftPosition(model, position);\n }\n static left(config, model, position) {\n const pos = config.stickyTabStops\n ? MoveOperations.leftPositionAtomicSoftTabs(model, position, config.tabSize)\n : MoveOperations.leftPosition(model, position);\n return new CursorPosition(pos.lineNumber, pos.column, 0);\n }\n /**\n * @param noOfColumns Must be either `1`\n * or `Math.round(viewModel.getLineContent(viewLineNumber).length / 2)` (for half lines).\n */\n static moveLeft(config, model, cursor, inSelectionMode, noOfColumns) {\n let lineNumber, column;\n if (cursor.hasSelection() && !inSelectionMode) {\n // If the user has a selection and does not want to extend it,\n // put the cursor at the beginning of the selection.\n lineNumber = cursor.selection.startLineNumber;\n column = cursor.selection.startColumn;\n }\n else {\n // This has no effect if noOfColumns === 1.\n // It is ok to do so in the half-line scenario.\n const pos = cursor.position.delta(undefined, -(noOfColumns - 1));\n // We clip the position before normalization, as normalization is not defined\n // for possibly negative columns.\n const normalizedPos = model.normalizePosition(MoveOperations.clipPositionColumn(pos, model), 0 /* PositionAffinity.Left */);\n const p = MoveOperations.left(config, model, normalizedPos);\n lineNumber = p.lineNumber;\n column = p.column;\n }\n return cursor.move(inSelectionMode, lineNumber, column, 0);\n }\n /**\n * Adjusts the column so that it is within min/max of the line.\n */\n static clipPositionColumn(position, model) {\n return new Position(position.lineNumber, MoveOperations.clipRange(position.column, model.getLineMinColumn(position.lineNumber), model.getLineMaxColumn(position.lineNumber)));\n }\n static clipRange(value, min, max) {\n if (value < min) {\n return min;\n }\n if (value > max) {\n return max;\n }\n return value;\n }\n static rightPosition(model, lineNumber, column) {\n if (column < model.getLineMaxColumn(lineNumber)) {\n column = column + strings.nextCharLength(model.getLineContent(lineNumber), column - 1);\n }\n else if (lineNumber < model.getLineCount()) {\n lineNumber = lineNumber + 1;\n column = model.getLineMinColumn(lineNumber);\n }\n return new Position(lineNumber, column);\n }\n static rightPositionAtomicSoftTabs(model, lineNumber, column, tabSize, indentSize) {\n if (column < model.getLineIndentColumn(lineNumber)) {\n const lineContent = model.getLineContent(lineNumber);\n const newPosition = AtomicTabMoveOperations.atomicPosition(lineContent, column - 1, tabSize, 1 /* Direction.Right */);\n if (newPosition !== -1) {\n return new Position(lineNumber, newPosition + 1);\n }\n }\n return this.rightPosition(model, lineNumber, column);\n }\n static right(config, model, position) {\n const pos = config.stickyTabStops\n ? MoveOperations.rightPositionAtomicSoftTabs(model, position.lineNumber, position.column, config.tabSize, config.indentSize)\n : MoveOperations.rightPosition(model, position.lineNumber, position.column);\n return new CursorPosition(pos.lineNumber, pos.column, 0);\n }\n static moveRight(config, model, cursor, inSelectionMode, noOfColumns) {\n let lineNumber, column;\n if (cursor.hasSelection() && !inSelectionMode) {\n // If we are in selection mode, move right without selection cancels selection and puts cursor at the end of the selection\n lineNumber = cursor.selection.endLineNumber;\n column = cursor.selection.endColumn;\n }\n else {\n const pos = cursor.position.delta(undefined, noOfColumns - 1);\n const normalizedPos = model.normalizePosition(MoveOperations.clipPositionColumn(pos, model), 1 /* PositionAffinity.Right */);\n const r = MoveOperations.right(config, model, normalizedPos);\n lineNumber = r.lineNumber;\n column = r.column;\n }\n return cursor.move(inSelectionMode, lineNumber, column, 0);\n }\n static vertical(config, model, lineNumber, column, leftoverVisibleColumns, newLineNumber, allowMoveOnEdgeLine, normalizationAffinity) {\n const currentVisibleColumn = CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize) + leftoverVisibleColumns;\n const lineCount = model.getLineCount();\n const wasOnFirstPosition = (lineNumber === 1 && column === 1);\n const wasOnLastPosition = (lineNumber === lineCount && column === model.getLineMaxColumn(lineNumber));\n const wasAtEdgePosition = (newLineNumber < lineNumber ? wasOnFirstPosition : wasOnLastPosition);\n lineNumber = newLineNumber;\n if (lineNumber < 1) {\n lineNumber = 1;\n if (allowMoveOnEdgeLine) {\n column = model.getLineMinColumn(lineNumber);\n }\n else {\n column = Math.min(model.getLineMaxColumn(lineNumber), column);\n }\n }\n else if (lineNumber > lineCount) {\n lineNumber = lineCount;\n if (allowMoveOnEdgeLine) {\n column = model.getLineMaxColumn(lineNumber);\n }\n else {\n column = Math.min(model.getLineMaxColumn(lineNumber), column);\n }\n }\n else {\n column = config.columnFromVisibleColumn(model, lineNumber, currentVisibleColumn);\n }\n if (wasAtEdgePosition) {\n leftoverVisibleColumns = 0;\n }\n else {\n leftoverVisibleColumns = currentVisibleColumn - CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize);\n }\n if (normalizationAffinity !== undefined) {\n const position = new Position(lineNumber, column);\n const newPosition = model.normalizePosition(position, normalizationAffinity);\n leftoverVisibleColumns = leftoverVisibleColumns + (column - newPosition.column);\n lineNumber = newPosition.lineNumber;\n column = newPosition.column;\n }\n return new CursorPosition(lineNumber, column, leftoverVisibleColumns);\n }\n static down(config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnLastLine) {\n return this.vertical(config, model, lineNumber, column, leftoverVisibleColumns, lineNumber + count, allowMoveOnLastLine, 4 /* PositionAffinity.RightOfInjectedText */);\n }\n static moveDown(config, model, cursor, inSelectionMode, linesCount) {\n let lineNumber, column;\n if (cursor.hasSelection() && !inSelectionMode) {\n // If we are in selection mode, move down acts relative to the end of selection\n lineNumber = cursor.selection.endLineNumber;\n column = cursor.selection.endColumn;\n }\n else {\n lineNumber = cursor.position.lineNumber;\n column = cursor.position.column;\n }\n let i = 0;\n let r;\n do {\n r = MoveOperations.down(config, model, lineNumber + i, column, cursor.leftoverVisibleColumns, linesCount, true);\n const np = model.normalizePosition(new Position(r.lineNumber, r.column), 2 /* PositionAffinity.None */);\n if (np.lineNumber > lineNumber) {\n break;\n }\n } while (i++ < 10 && lineNumber + i < model.getLineCount());\n return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);\n }\n static translateDown(config, model, cursor) {\n const selection = cursor.selection;\n const selectionStart = MoveOperations.down(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);\n const position = MoveOperations.down(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);\n return new SingleCursorState(new Range(selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), 0 /* SelectionStartKind.Simple */, selectionStart.leftoverVisibleColumns, new Position(position.lineNumber, position.column), position.leftoverVisibleColumns);\n }\n static up(config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnFirstLine) {\n return this.vertical(config, model, lineNumber, column, leftoverVisibleColumns, lineNumber - count, allowMoveOnFirstLine, 3 /* PositionAffinity.LeftOfInjectedText */);\n }\n static moveUp(config, model, cursor, inSelectionMode, linesCount) {\n let lineNumber, column;\n if (cursor.hasSelection() && !inSelectionMode) {\n // If we are in selection mode, move up acts relative to the beginning of selection\n lineNumber = cursor.selection.startLineNumber;\n column = cursor.selection.startColumn;\n }\n else {\n lineNumber = cursor.position.lineNumber;\n column = cursor.position.column;\n }\n const r = MoveOperations.up(config, model, lineNumber, column, cursor.leftoverVisibleColumns, linesCount, true);\n return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);\n }\n static translateUp(config, model, cursor) {\n const selection = cursor.selection;\n const selectionStart = MoveOperations.up(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);\n const position = MoveOperations.up(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);\n return new SingleCursorState(new Range(selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), 0 /* SelectionStartKind.Simple */, selectionStart.leftoverVisibleColumns, new Position(position.lineNumber, position.column), position.leftoverVisibleColumns);\n }\n static _isBlankLine(model, lineNumber) {\n if (model.getLineFirstNonWhitespaceColumn(lineNumber) === 0) {\n // empty or contains only whitespace\n return true;\n }\n return false;\n }\n static moveToPrevBlankLine(config, model, cursor, inSelectionMode) {\n let lineNumber = cursor.position.lineNumber;\n // If our current line is blank, move to the previous non-blank line\n while (lineNumber > 1 && this._isBlankLine(model, lineNumber)) {\n lineNumber--;\n }\n // Find the previous blank line\n while (lineNumber > 1 && !this._isBlankLine(model, lineNumber)) {\n lineNumber--;\n }\n return cursor.move(inSelectionMode, lineNumber, model.getLineMinColumn(lineNumber), 0);\n }\n static moveToNextBlankLine(config, model, cursor, inSelectionMode) {\n const lineCount = model.getLineCount();\n let lineNumber = cursor.position.lineNumber;\n // If our current line is blank, move to the next non-blank line\n while (lineNumber < lineCount && this._isBlankLine(model, lineNumber)) {\n lineNumber++;\n }\n // Find the next blank line\n while (lineNumber < lineCount && !this._isBlankLine(model, lineNumber)) {\n lineNumber++;\n }\n return cursor.move(inSelectionMode, lineNumber, model.getLineMinColumn(lineNumber), 0);\n }\n static moveToBeginningOfLine(config, model, cursor, inSelectionMode) {\n const lineNumber = cursor.position.lineNumber;\n const minColumn = model.getLineMinColumn(lineNumber);\n const firstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(lineNumber) || minColumn;\n let column;\n const relevantColumnNumber = cursor.position.column;\n if (relevantColumnNumber === firstNonBlankColumn) {\n column = minColumn;\n }\n else {\n column = firstNonBlankColumn;\n }\n return cursor.move(inSelectionMode, lineNumber, column, 0);\n }\n static moveToEndOfLine(config, model, cursor, inSelectionMode, sticky) {\n const lineNumber = cursor.position.lineNumber;\n const maxColumn = model.getLineMaxColumn(lineNumber);\n return cursor.move(inSelectionMode, lineNumber, maxColumn, sticky ? 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */ - maxColumn : 0);\n }\n static moveToBeginningOfBuffer(config, model, cursor, inSelectionMode) {\n return cursor.move(inSelectionMode, 1, 1, 0);\n }\n static moveToEndOfBuffer(config, model, cursor, inSelectionMode) {\n const lastLineNumber = model.getLineCount();\n const lastColumn = model.getLineMaxColumn(lastLineNumber);\n return cursor.move(inSelectionMode, lastLineNumber, lastColumn, 0);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport { ReplaceCommand } from '../commands/replaceCommand.js';\nimport { EditOperationResult, isQuote } from '../cursorCommon.js';\nimport { CursorColumns } from '../core/cursorColumns.js';\nimport { MoveOperations } from './cursorMoveOperations.js';\nimport { Range } from '../core/range.js';\nimport { Position } from '../core/position.js';\nexport class DeleteOperations {\n static deleteRight(prevEditOperationType, config, model, selections) {\n const commands = [];\n let shouldPushStackElementBefore = (prevEditOperationType !== 3 /* EditOperationType.DeletingRight */);\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n let deleteSelection = selection;\n if (deleteSelection.isEmpty()) {\n const position = selection.getPosition();\n const rightOfPosition = MoveOperations.right(config, model, position);\n deleteSelection = new Range(rightOfPosition.lineNumber, rightOfPosition.column, position.lineNumber, position.column);\n }\n if (deleteSelection.isEmpty()) {\n // Probably at end of file => ignore\n commands[i] = null;\n continue;\n }\n if (deleteSelection.startLineNumber !== deleteSelection.endLineNumber) {\n shouldPushStackElementBefore = true;\n }\n commands[i] = new ReplaceCommand(deleteSelection, '');\n }\n return [shouldPushStackElementBefore, commands];\n }\n static isAutoClosingPairDelete(autoClosingDelete, autoClosingBrackets, autoClosingQuotes, autoClosingPairsOpen, model, selections, autoClosedCharacters) {\n if (autoClosingBrackets === 'never' && autoClosingQuotes === 'never') {\n return false;\n }\n if (autoClosingDelete === 'never') {\n return false;\n }\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n const position = selection.getPosition();\n if (!selection.isEmpty()) {\n return false;\n }\n const lineText = model.getLineContent(position.lineNumber);\n if (position.column < 2 || position.column >= lineText.length + 1) {\n return false;\n }\n const character = lineText.charAt(position.column - 2);\n const autoClosingPairCandidates = autoClosingPairsOpen.get(character);\n if (!autoClosingPairCandidates) {\n return false;\n }\n if (isQuote(character)) {\n if (autoClosingQuotes === 'never') {\n return false;\n }\n }\n else {\n if (autoClosingBrackets === 'never') {\n return false;\n }\n }\n const afterCharacter = lineText.charAt(position.column - 1);\n let foundAutoClosingPair = false;\n for (const autoClosingPairCandidate of autoClosingPairCandidates) {\n if (autoClosingPairCandidate.open === character && autoClosingPairCandidate.close === afterCharacter) {\n foundAutoClosingPair = true;\n }\n }\n if (!foundAutoClosingPair) {\n return false;\n }\n // Must delete the pair only if it was automatically inserted by the editor\n if (autoClosingDelete === 'auto') {\n let found = false;\n for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {\n const autoClosedCharacter = autoClosedCharacters[j];\n if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {\n found = true;\n break;\n }\n }\n if (!found) {\n return false;\n }\n }\n }\n return true;\n }\n static _runAutoClosingPairDelete(config, model, selections) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n const position = selections[i].getPosition();\n const deleteSelection = new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column + 1);\n commands[i] = new ReplaceCommand(deleteSelection, '');\n }\n return [true, commands];\n }\n static deleteLeft(prevEditOperationType, config, model, selections, autoClosedCharacters) {\n if (this.isAutoClosingPairDelete(config.autoClosingDelete, config.autoClosingBrackets, config.autoClosingQuotes, config.autoClosingPairs.autoClosingPairsOpenByEnd, model, selections, autoClosedCharacters)) {\n return this._runAutoClosingPairDelete(config, model, selections);\n }\n const commands = [];\n let shouldPushStackElementBefore = (prevEditOperationType !== 2 /* EditOperationType.DeletingLeft */);\n for (let i = 0, len = selections.length; i < len; i++) {\n const deleteRange = DeleteOperations.getDeleteRange(selections[i], model, config);\n // Ignore empty delete ranges, as they have no effect\n // They happen if the cursor is at the beginning of the file.\n if (deleteRange.isEmpty()) {\n commands[i] = null;\n continue;\n }\n if (deleteRange.startLineNumber !== deleteRange.endLineNumber) {\n shouldPushStackElementBefore = true;\n }\n commands[i] = new ReplaceCommand(deleteRange, '');\n }\n return [shouldPushStackElementBefore, commands];\n }\n static getDeleteRange(selection, model, config) {\n if (!selection.isEmpty()) {\n return selection;\n }\n const position = selection.getPosition();\n // Unintend when using tab stops and cursor is within indentation\n if (config.useTabStops && position.column > 1) {\n const lineContent = model.getLineContent(position.lineNumber);\n const firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);\n const lastIndentationColumn = (firstNonWhitespaceIndex === -1\n ? /* entire string is whitespace */ lineContent.length + 1\n : firstNonWhitespaceIndex + 1);\n if (position.column <= lastIndentationColumn) {\n const fromVisibleColumn = config.visibleColumnFromColumn(model, position);\n const toVisibleColumn = CursorColumns.prevIndentTabStop(fromVisibleColumn, config.indentSize);\n const toColumn = config.columnFromVisibleColumn(model, position.lineNumber, toVisibleColumn);\n return new Range(position.lineNumber, toColumn, position.lineNumber, position.column);\n }\n }\n return Range.fromPositions(DeleteOperations.getPositionAfterDeleteLeft(position, model), position);\n }\n static getPositionAfterDeleteLeft(position, model) {\n if (position.column > 1) {\n // Convert 1-based columns to 0-based offsets and back.\n const idx = strings.getLeftDeleteOffset(position.column - 1, model.getLineContent(position.lineNumber));\n return position.with(undefined, idx + 1);\n }\n else if (position.lineNumber > 1) {\n const newLine = position.lineNumber - 1;\n return new Position(newLine, model.getLineMaxColumn(newLine));\n }\n else {\n return position;\n }\n }\n static cut(config, model, selections) {\n const commands = [];\n let lastCutRange = null;\n selections.sort((a, b) => Position.compare(a.getStartPosition(), b.getEndPosition()));\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n if (selection.isEmpty()) {\n if (config.emptySelectionClipboard) {\n // This is a full line cut\n const position = selection.getPosition();\n let startLineNumber, startColumn, endLineNumber, endColumn;\n if (position.lineNumber < model.getLineCount()) {\n // Cutting a line in the middle of the model\n startLineNumber = position.lineNumber;\n startColumn = 1;\n endLineNumber = position.lineNumber + 1;\n endColumn = 1;\n }\n else if (position.lineNumber > 1 && lastCutRange?.endLineNumber !== position.lineNumber) {\n // Cutting the last line & there are more than 1 lines in the model & a previous cut operation does not touch the current cut operation\n startLineNumber = position.lineNumber - 1;\n startColumn = model.getLineMaxColumn(position.lineNumber - 1);\n endLineNumber = position.lineNumber;\n endColumn = model.getLineMaxColumn(position.lineNumber);\n }\n else {\n // Cutting the single line that the model contains\n startLineNumber = position.lineNumber;\n startColumn = 1;\n endLineNumber = position.lineNumber;\n endColumn = model.getLineMaxColumn(position.lineNumber);\n }\n const deleteSelection = new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n lastCutRange = deleteSelection;\n if (!deleteSelection.isEmpty()) {\n commands[i] = new ReplaceCommand(deleteSelection, '');\n }\n else {\n commands[i] = null;\n }\n }\n else {\n // Cannot cut empty selection\n commands[i] = null;\n }\n }\n else {\n commands[i] = new ReplaceCommand(selection, '');\n }\n }\n return new EditOperationResult(0 /* EditOperationType.Other */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: true\n });\n }\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 *--------------------------------------------------------------------------------------------*/\nexport function toUint8(v) {\n if (v < 0) {\n return 0;\n }\n if (v > 255 /* Constants.MAX_UINT_8 */) {\n return 255 /* Constants.MAX_UINT_8 */;\n }\n return v | 0;\n}\nexport function toUint32(v) {\n if (v < 0) {\n return 0;\n }\n if (v > 4294967295 /* Constants.MAX_UINT_32 */) {\n return 4294967295 /* Constants.MAX_UINT_32 */;\n }\n return v | 0;\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 *--------------------------------------------------------------------------------------------*/\nimport { toUint8 } from '../../../base/common/uint.js';\n/**\n * A fast character classifier that uses a compact array for ASCII values.\n */\nexport class CharacterClassifier {\n constructor(_defaultValue) {\n const defaultValue = toUint8(_defaultValue);\n this._defaultValue = defaultValue;\n this._asciiMap = CharacterClassifier._createAsciiMap(defaultValue);\n this._map = new Map();\n }\n static _createAsciiMap(defaultValue) {\n const asciiMap = new Uint8Array(256);\n asciiMap.fill(defaultValue);\n return asciiMap;\n }\n set(charCode, _value) {\n const value = toUint8(_value);\n if (charCode >= 0 && charCode < 256) {\n this._asciiMap[charCode] = value;\n }\n else {\n this._map.set(charCode, value);\n }\n }\n get(charCode) {\n if (charCode >= 0 && charCode < 256) {\n return this._asciiMap[charCode];\n }\n else {\n return (this._map.get(charCode) || this._defaultValue);\n }\n }\n clear() {\n this._asciiMap.fill(this._defaultValue);\n this._map.clear();\n }\n}\nexport class CharacterSet {\n constructor() {\n this._actual = new CharacterClassifier(0 /* Boolean.False */);\n }\n add(charCode) {\n this._actual.set(charCode, 1 /* Boolean.True */);\n }\n has(charCode) {\n return (this._actual.get(charCode) === 1 /* Boolean.True */);\n }\n clear() {\n return this._actual.clear();\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { CharacterClassifier } from './characterClassifier.js';\nexport class WordCharacterClassifier extends CharacterClassifier {\n constructor(wordSeparators) {\n super(0 /* WordCharacterClass.Regular */);\n for (let i = 0, len = wordSeparators.length; i < len; i++) {\n this.set(wordSeparators.charCodeAt(i), 2 /* WordCharacterClass.WordSeparator */);\n }\n this.set(32 /* CharCode.Space */, 1 /* WordCharacterClass.Whitespace */);\n this.set(9 /* CharCode.Tab */, 1 /* WordCharacterClass.Whitespace */);\n }\n}\nfunction once(computeFn) {\n const cache = {}; // TODO@Alex unbounded cache\n return (input) => {\n if (!cache.hasOwnProperty(input)) {\n cache[input] = computeFn(input);\n }\n return cache[input];\n };\n}\nexport const getMapForWordSeparators = once((input) => new WordCharacterClassifier(input));\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport { SingleCursorState } from '../cursorCommon.js';\nimport { DeleteOperations } from './cursorDeleteOperations.js';\nimport { getMapForWordSeparators } from '../core/wordCharacterClassifier.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nexport class WordOperations {\n static _createWord(lineContent, wordType, nextCharClass, start, end) {\n // console.log('WORD ==> ' + start + ' => ' + end + ':::: <<<' + lineContent.substring(start, end) + '>>>');\n return { start: start, end: end, wordType: wordType, nextCharClass: nextCharClass };\n }\n static _findPreviousWordOnLine(wordSeparators, model, position) {\n const lineContent = model.getLineContent(position.lineNumber);\n return this._doFindPreviousWordOnLine(lineContent, wordSeparators, position);\n }\n static _doFindPreviousWordOnLine(lineContent, wordSeparators, position) {\n let wordType = 0 /* WordType.None */;\n for (let chIndex = position.column - 2; chIndex >= 0; chIndex--) {\n const chCode = lineContent.charCodeAt(chIndex);\n const chClass = wordSeparators.get(chCode);\n if (chClass === 0 /* WordCharacterClass.Regular */) {\n if (wordType === 2 /* WordType.Separator */) {\n return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));\n }\n wordType = 1 /* WordType.Regular */;\n }\n else if (chClass === 2 /* WordCharacterClass.WordSeparator */) {\n if (wordType === 1 /* WordType.Regular */) {\n return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));\n }\n wordType = 2 /* WordType.Separator */;\n }\n else if (chClass === 1 /* WordCharacterClass.Whitespace */) {\n if (wordType !== 0 /* WordType.None */) {\n return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));\n }\n }\n }\n if (wordType !== 0 /* WordType.None */) {\n return this._createWord(lineContent, wordType, 1 /* WordCharacterClass.Whitespace */, 0, this._findEndOfWord(lineContent, wordSeparators, wordType, 0));\n }\n return null;\n }\n static _findEndOfWord(lineContent, wordSeparators, wordType, startIndex) {\n const len = lineContent.length;\n for (let chIndex = startIndex; chIndex < len; chIndex++) {\n const chCode = lineContent.charCodeAt(chIndex);\n const chClass = wordSeparators.get(chCode);\n if (chClass === 1 /* WordCharacterClass.Whitespace */) {\n return chIndex;\n }\n if (wordType === 1 /* WordType.Regular */ && chClass === 2 /* WordCharacterClass.WordSeparator */) {\n return chIndex;\n }\n if (wordType === 2 /* WordType.Separator */ && chClass === 0 /* WordCharacterClass.Regular */) {\n return chIndex;\n }\n }\n return len;\n }\n static _findNextWordOnLine(wordSeparators, model, position) {\n const lineContent = model.getLineContent(position.lineNumber);\n return this._doFindNextWordOnLine(lineContent, wordSeparators, position);\n }\n static _doFindNextWordOnLine(lineContent, wordSeparators, position) {\n let wordType = 0 /* WordType.None */;\n const len = lineContent.length;\n for (let chIndex = position.column - 1; chIndex < len; chIndex++) {\n const chCode = lineContent.charCodeAt(chIndex);\n const chClass = wordSeparators.get(chCode);\n if (chClass === 0 /* WordCharacterClass.Regular */) {\n if (wordType === 2 /* WordType.Separator */) {\n return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);\n }\n wordType = 1 /* WordType.Regular */;\n }\n else if (chClass === 2 /* WordCharacterClass.WordSeparator */) {\n if (wordType === 1 /* WordType.Regular */) {\n return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);\n }\n wordType = 2 /* WordType.Separator */;\n }\n else if (chClass === 1 /* WordCharacterClass.Whitespace */) {\n if (wordType !== 0 /* WordType.None */) {\n return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);\n }\n }\n }\n if (wordType !== 0 /* WordType.None */) {\n return this._createWord(lineContent, wordType, 1 /* WordCharacterClass.Whitespace */, this._findStartOfWord(lineContent, wordSeparators, wordType, len - 1), len);\n }\n return null;\n }\n static _findStartOfWord(lineContent, wordSeparators, wordType, startIndex) {\n for (let chIndex = startIndex; chIndex >= 0; chIndex--) {\n const chCode = lineContent.charCodeAt(chIndex);\n const chClass = wordSeparators.get(chCode);\n if (chClass === 1 /* WordCharacterClass.Whitespace */) {\n return chIndex + 1;\n }\n if (wordType === 1 /* WordType.Regular */ && chClass === 2 /* WordCharacterClass.WordSeparator */) {\n return chIndex + 1;\n }\n if (wordType === 2 /* WordType.Separator */ && chClass === 0 /* WordCharacterClass.Regular */) {\n return chIndex + 1;\n }\n }\n return 0;\n }\n static moveWordLeft(wordSeparators, model, position, wordNavigationType) {\n let lineNumber = position.lineNumber;\n let column = position.column;\n if (column === 1) {\n if (lineNumber > 1) {\n lineNumber = lineNumber - 1;\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n let prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, column));\n if (wordNavigationType === 0 /* WordNavigationType.WordStart */) {\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);\n }\n if (wordNavigationType === 1 /* WordNavigationType.WordStartFast */) {\n if (prevWordOnLine\n && prevWordOnLine.wordType === 2 /* WordType.Separator */\n && prevWordOnLine.end - prevWordOnLine.start === 1\n && prevWordOnLine.nextCharClass === 0 /* WordCharacterClass.Regular */) {\n // Skip over a word made up of one single separator and followed by a regular character\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\n }\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);\n }\n if (wordNavigationType === 3 /* WordNavigationType.WordAccessibility */) {\n while (prevWordOnLine\n && prevWordOnLine.wordType === 2 /* WordType.Separator */) {\n // Skip over words made up of only separators\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\n }\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);\n }\n // We are stopping at the ending of words\n if (prevWordOnLine && column <= prevWordOnLine.end + 1) {\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\n }\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.end + 1 : 1);\n }\n static _moveWordPartLeft(model, position) {\n const lineNumber = position.lineNumber;\n const maxColumn = model.getLineMaxColumn(lineNumber);\n if (position.column === 1) {\n return (lineNumber > 1 ? new Position(lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)) : position);\n }\n const lineContent = model.getLineContent(lineNumber);\n for (let column = position.column - 1; column > 1; column--) {\n const left = lineContent.charCodeAt(column - 2);\n const right = lineContent.charCodeAt(column - 1);\n if (left === 95 /* CharCode.Underline */ && right !== 95 /* CharCode.Underline */) {\n // snake_case_variables\n return new Position(lineNumber, column);\n }\n if (left === 45 /* CharCode.Dash */ && right !== 45 /* CharCode.Dash */) {\n // kebab-case-variables\n return new Position(lineNumber, column);\n }\n if ((strings.isLowerAsciiLetter(left) || strings.isAsciiDigit(left)) && strings.isUpperAsciiLetter(right)) {\n // camelCaseVariables\n return new Position(lineNumber, column);\n }\n if (strings.isUpperAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {\n // thisIsACamelCaseWithOneLetterWords\n if (column + 1 < maxColumn) {\n const rightRight = lineContent.charCodeAt(column);\n if (strings.isLowerAsciiLetter(rightRight) || strings.isAsciiDigit(rightRight)) {\n return new Position(lineNumber, column);\n }\n }\n }\n }\n return new Position(lineNumber, 1);\n }\n static moveWordRight(wordSeparators, model, position, wordNavigationType) {\n let lineNumber = position.lineNumber;\n let column = position.column;\n let movedDown = false;\n if (column === model.getLineMaxColumn(lineNumber)) {\n if (lineNumber < model.getLineCount()) {\n movedDown = true;\n lineNumber = lineNumber + 1;\n column = 1;\n }\n }\n let nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, column));\n if (wordNavigationType === 2 /* WordNavigationType.WordEnd */) {\n if (nextWordOnLine && nextWordOnLine.wordType === 2 /* WordType.Separator */) {\n if (nextWordOnLine.end - nextWordOnLine.start === 1 && nextWordOnLine.nextCharClass === 0 /* WordCharacterClass.Regular */) {\n // Skip over a word made up of one single separator and followed by a regular character\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\n }\n }\n if (nextWordOnLine) {\n column = nextWordOnLine.end + 1;\n }\n else {\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n else if (wordNavigationType === 3 /* WordNavigationType.WordAccessibility */) {\n if (movedDown) {\n // If we move to the next line, pretend that the cursor is right before the first character.\n // This is needed when the first word starts right at the first character - and in order not to miss it,\n // we need to start before.\n column = 0;\n }\n while (nextWordOnLine\n && (nextWordOnLine.wordType === 2 /* WordType.Separator */\n || nextWordOnLine.start + 1 <= column)) {\n // Skip over a word made up of one single separator\n // Also skip over word if it begins before current cursor position to ascertain we're moving forward at least 1 character.\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\n }\n if (nextWordOnLine) {\n column = nextWordOnLine.start + 1;\n }\n else {\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n else {\n if (nextWordOnLine && !movedDown && column >= nextWordOnLine.start + 1) {\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\n }\n if (nextWordOnLine) {\n column = nextWordOnLine.start + 1;\n }\n else {\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n return new Position(lineNumber, column);\n }\n static _moveWordPartRight(model, position) {\n const lineNumber = position.lineNumber;\n const maxColumn = model.getLineMaxColumn(lineNumber);\n if (position.column === maxColumn) {\n return (lineNumber < model.getLineCount() ? new Position(lineNumber + 1, 1) : position);\n }\n const lineContent = model.getLineContent(lineNumber);\n for (let column = position.column + 1; column < maxColumn; column++) {\n const left = lineContent.charCodeAt(column - 2);\n const right = lineContent.charCodeAt(column - 1);\n if (left !== 95 /* CharCode.Underline */ && right === 95 /* CharCode.Underline */) {\n // snake_case_variables\n return new Position(lineNumber, column);\n }\n if (left !== 45 /* CharCode.Dash */ && right === 45 /* CharCode.Dash */) {\n // kebab-case-variables\n return new Position(lineNumber, column);\n }\n if ((strings.isLowerAsciiLetter(left) || strings.isAsciiDigit(left)) && strings.isUpperAsciiLetter(right)) {\n // camelCaseVariables\n return new Position(lineNumber, column);\n }\n if (strings.isUpperAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {\n // thisIsACamelCaseWithOneLetterWords\n if (column + 1 < maxColumn) {\n const rightRight = lineContent.charCodeAt(column);\n if (strings.isLowerAsciiLetter(rightRight) || strings.isAsciiDigit(rightRight)) {\n return new Position(lineNumber, column);\n }\n }\n }\n }\n return new Position(lineNumber, maxColumn);\n }\n static _deleteWordLeftWhitespace(model, position) {\n const lineContent = model.getLineContent(position.lineNumber);\n const startIndex = position.column - 2;\n const lastNonWhitespace = strings.lastNonWhitespaceIndex(lineContent, startIndex);\n if (lastNonWhitespace + 1 < startIndex) {\n return new Range(position.lineNumber, lastNonWhitespace + 2, position.lineNumber, position.column);\n }\n return null;\n }\n static deleteWordLeft(ctx, wordNavigationType) {\n const wordSeparators = ctx.wordSeparators;\n const model = ctx.model;\n const selection = ctx.selection;\n const whitespaceHeuristics = ctx.whitespaceHeuristics;\n if (!selection.isEmpty()) {\n return selection;\n }\n if (DeleteOperations.isAutoClosingPairDelete(ctx.autoClosingDelete, ctx.autoClosingBrackets, ctx.autoClosingQuotes, ctx.autoClosingPairs.autoClosingPairsOpenByEnd, ctx.model, [ctx.selection], ctx.autoClosedCharacters)) {\n const position = ctx.selection.getPosition();\n return new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column + 1);\n }\n const position = new Position(selection.positionLineNumber, selection.positionColumn);\n let lineNumber = position.lineNumber;\n let column = position.column;\n if (lineNumber === 1 && column === 1) {\n // Ignore deleting at beginning of file\n return null;\n }\n if (whitespaceHeuristics) {\n const r = this._deleteWordLeftWhitespace(model, position);\n if (r) {\n return r;\n }\n }\n let prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\n if (wordNavigationType === 0 /* WordNavigationType.WordStart */) {\n if (prevWordOnLine) {\n column = prevWordOnLine.start + 1;\n }\n else {\n if (column > 1) {\n column = 1;\n }\n else {\n lineNumber--;\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n }\n else {\n if (prevWordOnLine && column <= prevWordOnLine.end + 1) {\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\n }\n if (prevWordOnLine) {\n column = prevWordOnLine.end + 1;\n }\n else {\n if (column > 1) {\n column = 1;\n }\n else {\n lineNumber--;\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n }\n return new Range(lineNumber, column, position.lineNumber, position.column);\n }\n static deleteInsideWord(wordSeparators, model, selection) {\n if (!selection.isEmpty()) {\n return selection;\n }\n const position = new Position(selection.positionLineNumber, selection.positionColumn);\n const r = this._deleteInsideWordWhitespace(model, position);\n if (r) {\n return r;\n }\n return this._deleteInsideWordDetermineDeleteRange(wordSeparators, model, position);\n }\n static _charAtIsWhitespace(str, index) {\n const charCode = str.charCodeAt(index);\n return (charCode === 32 /* CharCode.Space */ || charCode === 9 /* CharCode.Tab */);\n }\n static _deleteInsideWordWhitespace(model, position) {\n const lineContent = model.getLineContent(position.lineNumber);\n const lineContentLength = lineContent.length;\n if (lineContentLength === 0) {\n // empty line\n return null;\n }\n let leftIndex = Math.max(position.column - 2, 0);\n if (!this._charAtIsWhitespace(lineContent, leftIndex)) {\n // touches a non-whitespace character to the left\n return null;\n }\n let rightIndex = Math.min(position.column - 1, lineContentLength - 1);\n if (!this._charAtIsWhitespace(lineContent, rightIndex)) {\n // touches a non-whitespace character to the right\n return null;\n }\n // walk over whitespace to the left\n while (leftIndex > 0 && this._charAtIsWhitespace(lineContent, leftIndex - 1)) {\n leftIndex--;\n }\n // walk over whitespace to the right\n while (rightIndex + 1 < lineContentLength && this._charAtIsWhitespace(lineContent, rightIndex + 1)) {\n rightIndex++;\n }\n return new Range(position.lineNumber, leftIndex + 1, position.lineNumber, rightIndex + 2);\n }\n static _deleteInsideWordDetermineDeleteRange(wordSeparators, model, position) {\n const lineContent = model.getLineContent(position.lineNumber);\n const lineLength = lineContent.length;\n if (lineLength === 0) {\n // empty line\n if (position.lineNumber > 1) {\n return new Range(position.lineNumber - 1, model.getLineMaxColumn(position.lineNumber - 1), position.lineNumber, 1);\n }\n else {\n if (position.lineNumber < model.getLineCount()) {\n return new Range(position.lineNumber, 1, position.lineNumber + 1, 1);\n }\n else {\n // empty model\n return new Range(position.lineNumber, 1, position.lineNumber, 1);\n }\n }\n }\n const touchesWord = (word) => {\n return (word.start + 1 <= position.column && position.column <= word.end + 1);\n };\n const createRangeWithPosition = (startColumn, endColumn) => {\n startColumn = Math.min(startColumn, position.column);\n endColumn = Math.max(endColumn, position.column);\n return new Range(position.lineNumber, startColumn, position.lineNumber, endColumn);\n };\n const deleteWordAndAdjacentWhitespace = (word) => {\n let startColumn = word.start + 1;\n let endColumn = word.end + 1;\n let expandedToTheRight = false;\n while (endColumn - 1 < lineLength && this._charAtIsWhitespace(lineContent, endColumn - 1)) {\n expandedToTheRight = true;\n endColumn++;\n }\n if (!expandedToTheRight) {\n while (startColumn > 1 && this._charAtIsWhitespace(lineContent, startColumn - 2)) {\n startColumn--;\n }\n }\n return createRangeWithPosition(startColumn, endColumn);\n };\n const prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\n if (prevWordOnLine && touchesWord(prevWordOnLine)) {\n return deleteWordAndAdjacentWhitespace(prevWordOnLine);\n }\n const nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, position);\n if (nextWordOnLine && touchesWord(nextWordOnLine)) {\n return deleteWordAndAdjacentWhitespace(nextWordOnLine);\n }\n if (prevWordOnLine && nextWordOnLine) {\n return createRangeWithPosition(prevWordOnLine.end + 1, nextWordOnLine.start + 1);\n }\n if (prevWordOnLine) {\n return createRangeWithPosition(prevWordOnLine.start + 1, prevWordOnLine.end + 1);\n }\n if (nextWordOnLine) {\n return createRangeWithPosition(nextWordOnLine.start + 1, nextWordOnLine.end + 1);\n }\n return createRangeWithPosition(1, lineLength + 1);\n }\n static _deleteWordPartLeft(model, selection) {\n if (!selection.isEmpty()) {\n return selection;\n }\n const pos = selection.getPosition();\n const toPosition = WordOperations._moveWordPartLeft(model, pos);\n return new Range(pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);\n }\n static _findFirstNonWhitespaceChar(str, startIndex) {\n const len = str.length;\n for (let chIndex = startIndex; chIndex < len; chIndex++) {\n const ch = str.charAt(chIndex);\n if (ch !== ' ' && ch !== '\\t') {\n return chIndex;\n }\n }\n return len;\n }\n static _deleteWordRightWhitespace(model, position) {\n const lineContent = model.getLineContent(position.lineNumber);\n const startIndex = position.column - 1;\n const firstNonWhitespace = this._findFirstNonWhitespaceChar(lineContent, startIndex);\n if (startIndex + 1 < firstNonWhitespace) {\n // bingo\n return new Range(position.lineNumber, position.column, position.lineNumber, firstNonWhitespace + 1);\n }\n return null;\n }\n static deleteWordRight(ctx, wordNavigationType) {\n const wordSeparators = ctx.wordSeparators;\n const model = ctx.model;\n const selection = ctx.selection;\n const whitespaceHeuristics = ctx.whitespaceHeuristics;\n if (!selection.isEmpty()) {\n return selection;\n }\n const position = new Position(selection.positionLineNumber, selection.positionColumn);\n let lineNumber = position.lineNumber;\n let column = position.column;\n const lineCount = model.getLineCount();\n const maxColumn = model.getLineMaxColumn(lineNumber);\n if (lineNumber === lineCount && column === maxColumn) {\n // Ignore deleting at end of file\n return null;\n }\n if (whitespaceHeuristics) {\n const r = this._deleteWordRightWhitespace(model, position);\n if (r) {\n return r;\n }\n }\n let nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, position);\n if (wordNavigationType === 2 /* WordNavigationType.WordEnd */) {\n if (nextWordOnLine) {\n column = nextWordOnLine.end + 1;\n }\n else {\n if (column < maxColumn || lineNumber === lineCount) {\n column = maxColumn;\n }\n else {\n lineNumber++;\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, 1));\n if (nextWordOnLine) {\n column = nextWordOnLine.start + 1;\n }\n else {\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n }\n }\n else {\n if (nextWordOnLine && column >= nextWordOnLine.start + 1) {\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\n }\n if (nextWordOnLine) {\n column = nextWordOnLine.start + 1;\n }\n else {\n if (column < maxColumn || lineNumber === lineCount) {\n column = maxColumn;\n }\n else {\n lineNumber++;\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, 1));\n if (nextWordOnLine) {\n column = nextWordOnLine.start + 1;\n }\n else {\n column = model.getLineMaxColumn(lineNumber);\n }\n }\n }\n }\n return new Range(lineNumber, column, position.lineNumber, position.column);\n }\n static _deleteWordPartRight(model, selection) {\n if (!selection.isEmpty()) {\n return selection;\n }\n const pos = selection.getPosition();\n const toPosition = WordOperations._moveWordPartRight(model, pos);\n return new Range(pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);\n }\n static _createWordAtPosition(model, lineNumber, word) {\n const range = new Range(lineNumber, word.start + 1, lineNumber, word.end + 1);\n return {\n word: model.getValueInRange(range),\n startColumn: range.startColumn,\n endColumn: range.endColumn\n };\n }\n static getWordAtPosition(model, _wordSeparators, position) {\n const wordSeparators = getMapForWordSeparators(_wordSeparators);\n const prevWord = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\n if (prevWord && prevWord.wordType === 1 /* WordType.Regular */ && prevWord.start <= position.column - 1 && position.column - 1 <= prevWord.end) {\n return WordOperations._createWordAtPosition(model, position.lineNumber, prevWord);\n }\n const nextWord = WordOperations._findNextWordOnLine(wordSeparators, model, position);\n if (nextWord && nextWord.wordType === 1 /* WordType.Regular */ && nextWord.start <= position.column - 1 && position.column - 1 <= nextWord.end) {\n return WordOperations._createWordAtPosition(model, position.lineNumber, nextWord);\n }\n return null;\n }\n static word(config, model, cursor, inSelectionMode, position) {\n const wordSeparators = getMapForWordSeparators(config.wordSeparators);\n const prevWord = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\n const nextWord = WordOperations._findNextWordOnLine(wordSeparators, model, position);\n if (!inSelectionMode) {\n // Entering word selection for the first time\n let startColumn;\n let endColumn;\n if (prevWord && prevWord.wordType === 1 /* WordType.Regular */ && prevWord.start <= position.column - 1 && position.column - 1 <= prevWord.end) {\n // isTouchingPrevWord\n startColumn = prevWord.start + 1;\n endColumn = prevWord.end + 1;\n }\n else if (nextWord && nextWord.wordType === 1 /* WordType.Regular */ && nextWord.start <= position.column - 1 && position.column - 1 <= nextWord.end) {\n // isTouchingNextWord\n startColumn = nextWord.start + 1;\n endColumn = nextWord.end + 1;\n }\n else {\n if (prevWord) {\n startColumn = prevWord.end + 1;\n }\n else {\n startColumn = 1;\n }\n if (nextWord) {\n endColumn = nextWord.start + 1;\n }\n else {\n endColumn = model.getLineMaxColumn(position.lineNumber);\n }\n }\n return new SingleCursorState(new Range(position.lineNumber, startColumn, position.lineNumber, endColumn), 1 /* SelectionStartKind.Word */, 0, new Position(position.lineNumber, endColumn), 0);\n }\n let startColumn;\n let endColumn;\n if (prevWord && prevWord.wordType === 1 /* WordType.Regular */ && prevWord.start < position.column - 1 && position.column - 1 < prevWord.end) {\n // isInsidePrevWord\n startColumn = prevWord.start + 1;\n endColumn = prevWord.end + 1;\n }\n else if (nextWord && nextWord.wordType === 1 /* WordType.Regular */ && nextWord.start < position.column - 1 && position.column - 1 < nextWord.end) {\n // isInsideNextWord\n startColumn = nextWord.start + 1;\n endColumn = nextWord.end + 1;\n }\n else {\n startColumn = position.column;\n endColumn = position.column;\n }\n const lineNumber = position.lineNumber;\n let column;\n if (cursor.selectionStart.containsPosition(position)) {\n column = cursor.selectionStart.endColumn;\n }\n else if (position.isBeforeOrEqual(cursor.selectionStart.getStartPosition())) {\n column = startColumn;\n const possiblePosition = new Position(lineNumber, column);\n if (cursor.selectionStart.containsPosition(possiblePosition)) {\n column = cursor.selectionStart.endColumn;\n }\n }\n else {\n column = endColumn;\n const possiblePosition = new Position(lineNumber, column);\n if (cursor.selectionStart.containsPosition(possiblePosition)) {\n column = cursor.selectionStart.startColumn;\n }\n }\n return cursor.move(true, lineNumber, column, 0);\n }\n}\nexport class WordPartOperations extends WordOperations {\n static deleteWordPartLeft(ctx) {\n const candidates = enforceDefined([\n WordOperations.deleteWordLeft(ctx, 0 /* WordNavigationType.WordStart */),\n WordOperations.deleteWordLeft(ctx, 2 /* WordNavigationType.WordEnd */),\n WordOperations._deleteWordPartLeft(ctx.model, ctx.selection)\n ]);\n candidates.sort(Range.compareRangesUsingEnds);\n return candidates[2];\n }\n static deleteWordPartRight(ctx) {\n const candidates = enforceDefined([\n WordOperations.deleteWordRight(ctx, 0 /* WordNavigationType.WordStart */),\n WordOperations.deleteWordRight(ctx, 2 /* WordNavigationType.WordEnd */),\n WordOperations._deleteWordPartRight(ctx.model, ctx.selection)\n ]);\n candidates.sort(Range.compareRangesUsingStarts);\n return candidates[0];\n }\n static moveWordPartLeft(wordSeparators, model, position) {\n const candidates = enforceDefined([\n WordOperations.moveWordLeft(wordSeparators, model, position, 0 /* WordNavigationType.WordStart */),\n WordOperations.moveWordLeft(wordSeparators, model, position, 2 /* WordNavigationType.WordEnd */),\n WordOperations._moveWordPartLeft(model, position)\n ]);\n candidates.sort(Position.compare);\n return candidates[2];\n }\n static moveWordPartRight(wordSeparators, model, position) {\n const candidates = enforceDefined([\n WordOperations.moveWordRight(wordSeparators, model, position, 0 /* WordNavigationType.WordStart */),\n WordOperations.moveWordRight(wordSeparators, model, position, 2 /* WordNavigationType.WordEnd */),\n WordOperations._moveWordPartRight(model, position)\n ]);\n candidates.sort(Position.compare);\n return candidates[0];\n }\n}\nfunction enforceDefined(arr) {\n return arr.filter(el => Boolean(el));\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 *--------------------------------------------------------------------------------------------*/\nimport * as types from '../../../base/common/types.js';\nimport { CursorState, SingleCursorState } from '../cursorCommon.js';\nimport { MoveOperations } from './cursorMoveOperations.js';\nimport { WordOperations } from './cursorWordOperations.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nexport class CursorMoveCommands {\n static addCursorDown(viewModel, cursors, useLogicalLine) {\n const result = [];\n let resultLen = 0;\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[resultLen++] = new CursorState(cursor.modelState, cursor.viewState);\n if (useLogicalLine) {\n result[resultLen++] = CursorState.fromModelState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel.model, cursor.modelState));\n }\n else {\n result[resultLen++] = CursorState.fromViewState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel, cursor.viewState));\n }\n }\n return result;\n }\n static addCursorUp(viewModel, cursors, useLogicalLine) {\n const result = [];\n let resultLen = 0;\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[resultLen++] = new CursorState(cursor.modelState, cursor.viewState);\n if (useLogicalLine) {\n result[resultLen++] = CursorState.fromModelState(MoveOperations.translateUp(viewModel.cursorConfig, viewModel.model, cursor.modelState));\n }\n else {\n result[resultLen++] = CursorState.fromViewState(MoveOperations.translateUp(viewModel.cursorConfig, viewModel, cursor.viewState));\n }\n }\n return result;\n }\n static moveToBeginningOfLine(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = this._moveToLineStart(viewModel, cursor, inSelectionMode);\n }\n return result;\n }\n static _moveToLineStart(viewModel, cursor, inSelectionMode) {\n const currentViewStateColumn = cursor.viewState.position.column;\n const currentModelStateColumn = cursor.modelState.position.column;\n const isFirstLineOfWrappedLine = currentViewStateColumn === currentModelStateColumn;\n const currentViewStatelineNumber = cursor.viewState.position.lineNumber;\n const firstNonBlankColumn = viewModel.getLineFirstNonWhitespaceColumn(currentViewStatelineNumber);\n const isBeginningOfViewLine = currentViewStateColumn === firstNonBlankColumn;\n if (!isFirstLineOfWrappedLine && !isBeginningOfViewLine) {\n return this._moveToLineStartByView(viewModel, cursor, inSelectionMode);\n }\n else {\n return this._moveToLineStartByModel(viewModel, cursor, inSelectionMode);\n }\n }\n static _moveToLineStartByView(viewModel, cursor, inSelectionMode) {\n return CursorState.fromViewState(MoveOperations.moveToBeginningOfLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode));\n }\n static _moveToLineStartByModel(viewModel, cursor, inSelectionMode) {\n return CursorState.fromModelState(MoveOperations.moveToBeginningOfLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));\n }\n static moveToEndOfLine(viewModel, cursors, inSelectionMode, sticky) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = this._moveToLineEnd(viewModel, cursor, inSelectionMode, sticky);\n }\n return result;\n }\n static _moveToLineEnd(viewModel, cursor, inSelectionMode, sticky) {\n const viewStatePosition = cursor.viewState.position;\n const viewModelMaxColumn = viewModel.getLineMaxColumn(viewStatePosition.lineNumber);\n const isEndOfViewLine = viewStatePosition.column === viewModelMaxColumn;\n const modelStatePosition = cursor.modelState.position;\n const modelMaxColumn = viewModel.model.getLineMaxColumn(modelStatePosition.lineNumber);\n const isEndLineOfWrappedLine = viewModelMaxColumn - viewStatePosition.column === modelMaxColumn - modelStatePosition.column;\n if (isEndOfViewLine || isEndLineOfWrappedLine) {\n return this._moveToLineEndByModel(viewModel, cursor, inSelectionMode, sticky);\n }\n else {\n return this._moveToLineEndByView(viewModel, cursor, inSelectionMode, sticky);\n }\n }\n static _moveToLineEndByView(viewModel, cursor, inSelectionMode, sticky) {\n return CursorState.fromViewState(MoveOperations.moveToEndOfLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, sticky));\n }\n static _moveToLineEndByModel(viewModel, cursor, inSelectionMode, sticky) {\n return CursorState.fromModelState(MoveOperations.moveToEndOfLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, sticky));\n }\n static expandLineSelection(viewModel, cursors) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const startLineNumber = cursor.modelState.selection.startLineNumber;\n const lineCount = viewModel.model.getLineCount();\n let endLineNumber = cursor.modelState.selection.endLineNumber;\n let endColumn;\n if (endLineNumber === lineCount) {\n endColumn = viewModel.model.getLineMaxColumn(lineCount);\n }\n else {\n endLineNumber++;\n endColumn = 1;\n }\n result[i] = CursorState.fromModelState(new SingleCursorState(new Range(startLineNumber, 1, startLineNumber, 1), 0 /* SelectionStartKind.Simple */, 0, new Position(endLineNumber, endColumn), 0));\n }\n return result;\n }\n static moveToBeginningOfBuffer(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = CursorState.fromModelState(MoveOperations.moveToBeginningOfBuffer(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));\n }\n return result;\n }\n static moveToEndOfBuffer(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = CursorState.fromModelState(MoveOperations.moveToEndOfBuffer(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));\n }\n return result;\n }\n static selectAll(viewModel, cursor) {\n const lineCount = viewModel.model.getLineCount();\n const maxColumn = viewModel.model.getLineMaxColumn(lineCount);\n return CursorState.fromModelState(new SingleCursorState(new Range(1, 1, 1, 1), 0 /* SelectionStartKind.Simple */, 0, new Position(lineCount, maxColumn), 0));\n }\n static line(viewModel, cursor, inSelectionMode, _position, _viewPosition) {\n const position = viewModel.model.validatePosition(_position);\n const viewPosition = (_viewPosition\n ? viewModel.coordinatesConverter.validateViewPosition(new Position(_viewPosition.lineNumber, _viewPosition.column), position)\n : viewModel.coordinatesConverter.convertModelPositionToViewPosition(position));\n if (!inSelectionMode) {\n // Entering line selection for the first time\n const lineCount = viewModel.model.getLineCount();\n let selectToLineNumber = position.lineNumber + 1;\n let selectToColumn = 1;\n if (selectToLineNumber > lineCount) {\n selectToLineNumber = lineCount;\n selectToColumn = viewModel.model.getLineMaxColumn(selectToLineNumber);\n }\n return CursorState.fromModelState(new SingleCursorState(new Range(position.lineNumber, 1, selectToLineNumber, selectToColumn), 2 /* SelectionStartKind.Line */, 0, new Position(selectToLineNumber, selectToColumn), 0));\n }\n // Continuing line selection\n const enteringLineNumber = cursor.modelState.selectionStart.getStartPosition().lineNumber;\n if (position.lineNumber < enteringLineNumber) {\n return CursorState.fromViewState(cursor.viewState.move(true, viewPosition.lineNumber, 1, 0));\n }\n else if (position.lineNumber > enteringLineNumber) {\n const lineCount = viewModel.getLineCount();\n let selectToViewLineNumber = viewPosition.lineNumber + 1;\n let selectToViewColumn = 1;\n if (selectToViewLineNumber > lineCount) {\n selectToViewLineNumber = lineCount;\n selectToViewColumn = viewModel.getLineMaxColumn(selectToViewLineNumber);\n }\n return CursorState.fromViewState(cursor.viewState.move(true, selectToViewLineNumber, selectToViewColumn, 0));\n }\n else {\n const endPositionOfSelectionStart = cursor.modelState.selectionStart.getEndPosition();\n return CursorState.fromModelState(cursor.modelState.move(true, endPositionOfSelectionStart.lineNumber, endPositionOfSelectionStart.column, 0));\n }\n }\n static word(viewModel, cursor, inSelectionMode, _position) {\n const position = viewModel.model.validatePosition(_position);\n return CursorState.fromModelState(WordOperations.word(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, position));\n }\n static cancelSelection(viewModel, cursor) {\n if (!cursor.modelState.hasSelection()) {\n return new CursorState(cursor.modelState, cursor.viewState);\n }\n const lineNumber = cursor.viewState.position.lineNumber;\n const column = cursor.viewState.position.column;\n return CursorState.fromViewState(new SingleCursorState(new Range(lineNumber, column, lineNumber, column), 0 /* SelectionStartKind.Simple */, 0, new Position(lineNumber, column), 0));\n }\n static moveTo(viewModel, cursor, inSelectionMode, _position, _viewPosition) {\n if (inSelectionMode) {\n if (cursor.modelState.selectionStartKind === 1 /* SelectionStartKind.Word */) {\n return this.word(viewModel, cursor, inSelectionMode, _position);\n }\n if (cursor.modelState.selectionStartKind === 2 /* SelectionStartKind.Line */) {\n return this.line(viewModel, cursor, inSelectionMode, _position, _viewPosition);\n }\n }\n const position = viewModel.model.validatePosition(_position);\n const viewPosition = (_viewPosition\n ? viewModel.coordinatesConverter.validateViewPosition(new Position(_viewPosition.lineNumber, _viewPosition.column), position)\n : viewModel.coordinatesConverter.convertModelPositionToViewPosition(position));\n return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, viewPosition.lineNumber, viewPosition.column, 0));\n }\n static simpleMove(viewModel, cursors, direction, inSelectionMode, value, unit) {\n switch (direction) {\n case 0 /* CursorMove.Direction.Left */: {\n if (unit === 4 /* CursorMove.Unit.HalfLine */) {\n // Move left by half the current line length\n return this._moveHalfLineLeft(viewModel, cursors, inSelectionMode);\n }\n else {\n // Move left by `moveParams.value` columns\n return this._moveLeft(viewModel, cursors, inSelectionMode, value);\n }\n }\n case 1 /* CursorMove.Direction.Right */: {\n if (unit === 4 /* CursorMove.Unit.HalfLine */) {\n // Move right by half the current line length\n return this._moveHalfLineRight(viewModel, cursors, inSelectionMode);\n }\n else {\n // Move right by `moveParams.value` columns\n return this._moveRight(viewModel, cursors, inSelectionMode, value);\n }\n }\n case 2 /* CursorMove.Direction.Up */: {\n if (unit === 2 /* CursorMove.Unit.WrappedLine */) {\n // Move up by view lines\n return this._moveUpByViewLines(viewModel, cursors, inSelectionMode, value);\n }\n else {\n // Move up by model lines\n return this._moveUpByModelLines(viewModel, cursors, inSelectionMode, value);\n }\n }\n case 3 /* CursorMove.Direction.Down */: {\n if (unit === 2 /* CursorMove.Unit.WrappedLine */) {\n // Move down by view lines\n return this._moveDownByViewLines(viewModel, cursors, inSelectionMode, value);\n }\n else {\n // Move down by model lines\n return this._moveDownByModelLines(viewModel, cursors, inSelectionMode, value);\n }\n }\n case 4 /* CursorMove.Direction.PrevBlankLine */: {\n if (unit === 2 /* CursorMove.Unit.WrappedLine */) {\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveToPrevBlankLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode)));\n }\n else {\n return cursors.map(cursor => CursorState.fromModelState(MoveOperations.moveToPrevBlankLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode)));\n }\n }\n case 5 /* CursorMove.Direction.NextBlankLine */: {\n if (unit === 2 /* CursorMove.Unit.WrappedLine */) {\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveToNextBlankLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode)));\n }\n else {\n return cursors.map(cursor => CursorState.fromModelState(MoveOperations.moveToNextBlankLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode)));\n }\n }\n case 6 /* CursorMove.Direction.WrappedLineStart */: {\n // Move to the beginning of the current view line\n return this._moveToViewMinColumn(viewModel, cursors, inSelectionMode);\n }\n case 7 /* CursorMove.Direction.WrappedLineFirstNonWhitespaceCharacter */: {\n // Move to the first non-whitespace column of the current view line\n return this._moveToViewFirstNonWhitespaceColumn(viewModel, cursors, inSelectionMode);\n }\n case 8 /* CursorMove.Direction.WrappedLineColumnCenter */: {\n // Move to the \"center\" of the current view line\n return this._moveToViewCenterColumn(viewModel, cursors, inSelectionMode);\n }\n case 9 /* CursorMove.Direction.WrappedLineEnd */: {\n // Move to the end of the current view line\n return this._moveToViewMaxColumn(viewModel, cursors, inSelectionMode);\n }\n case 10 /* CursorMove.Direction.WrappedLineLastNonWhitespaceCharacter */: {\n // Move to the last non-whitespace column of the current view line\n return this._moveToViewLastNonWhitespaceColumn(viewModel, cursors, inSelectionMode);\n }\n default:\n return null;\n }\n }\n static viewportMove(viewModel, cursors, direction, inSelectionMode, value) {\n const visibleViewRange = viewModel.getCompletelyVisibleViewRange();\n const visibleModelRange = viewModel.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);\n switch (direction) {\n case 11 /* CursorMove.Direction.ViewPortTop */: {\n // Move to the nth line start in the viewport (from the top)\n const modelLineNumber = this._firstLineNumberInRange(viewModel.model, visibleModelRange, value);\n const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);\n return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];\n }\n case 13 /* CursorMove.Direction.ViewPortBottom */: {\n // Move to the nth line start in the viewport (from the bottom)\n const modelLineNumber = this._lastLineNumberInRange(viewModel.model, visibleModelRange, value);\n const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);\n return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];\n }\n case 12 /* CursorMove.Direction.ViewPortCenter */: {\n // Move to the line start in the viewport center\n const modelLineNumber = Math.round((visibleModelRange.startLineNumber + visibleModelRange.endLineNumber) / 2);\n const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);\n return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];\n }\n case 14 /* CursorMove.Direction.ViewPortIfOutside */: {\n // Move to a position inside the viewport\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = this.findPositionInViewportIfOutside(viewModel, cursor, visibleViewRange, inSelectionMode);\n }\n return result;\n }\n default:\n return null;\n }\n }\n static findPositionInViewportIfOutside(viewModel, cursor, visibleViewRange, inSelectionMode) {\n const viewLineNumber = cursor.viewState.position.lineNumber;\n if (visibleViewRange.startLineNumber <= viewLineNumber && viewLineNumber <= visibleViewRange.endLineNumber - 1) {\n // Nothing to do, cursor is in viewport\n return new CursorState(cursor.modelState, cursor.viewState);\n }\n else {\n let newViewLineNumber;\n if (viewLineNumber > visibleViewRange.endLineNumber - 1) {\n newViewLineNumber = visibleViewRange.endLineNumber - 1;\n }\n else if (viewLineNumber < visibleViewRange.startLineNumber) {\n newViewLineNumber = visibleViewRange.startLineNumber;\n }\n else {\n newViewLineNumber = viewLineNumber;\n }\n const position = MoveOperations.vertical(viewModel.cursorConfig, viewModel, viewLineNumber, cursor.viewState.position.column, cursor.viewState.leftoverVisibleColumns, newViewLineNumber, false);\n return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, position.lineNumber, position.column, position.leftoverVisibleColumns));\n }\n }\n /**\n * Find the nth line start included in the range (from the start).\n */\n static _firstLineNumberInRange(model, range, count) {\n let startLineNumber = range.startLineNumber;\n if (range.startColumn !== model.getLineMinColumn(startLineNumber)) {\n // Move on to the second line if the first line start is not included in the range\n startLineNumber++;\n }\n return Math.min(range.endLineNumber, startLineNumber + count - 1);\n }\n /**\n * Find the nth line start included in the range (from the end).\n */\n static _lastLineNumberInRange(model, range, count) {\n let startLineNumber = range.startLineNumber;\n if (range.startColumn !== model.getLineMinColumn(startLineNumber)) {\n // Move on to the second line if the first line start is not included in the range\n startLineNumber++;\n }\n return Math.max(startLineNumber, range.endLineNumber - count + 1);\n }\n static _moveLeft(viewModel, cursors, inSelectionMode, noOfColumns) {\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveLeft(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns)));\n }\n static _moveHalfLineLeft(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const viewLineNumber = cursor.viewState.position.lineNumber;\n const halfLine = Math.round(viewModel.getLineLength(viewLineNumber) / 2);\n result[i] = CursorState.fromViewState(MoveOperations.moveLeft(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, halfLine));\n }\n return result;\n }\n static _moveRight(viewModel, cursors, inSelectionMode, noOfColumns) {\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveRight(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns)));\n }\n static _moveHalfLineRight(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const viewLineNumber = cursor.viewState.position.lineNumber;\n const halfLine = Math.round(viewModel.getLineLength(viewLineNumber) / 2);\n result[i] = CursorState.fromViewState(MoveOperations.moveRight(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, halfLine));\n }\n return result;\n }\n static _moveDownByViewLines(viewModel, cursors, inSelectionMode, linesCount) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = CursorState.fromViewState(MoveOperations.moveDown(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, linesCount));\n }\n return result;\n }\n static _moveDownByModelLines(viewModel, cursors, inSelectionMode, linesCount) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = CursorState.fromModelState(MoveOperations.moveDown(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, linesCount));\n }\n return result;\n }\n static _moveUpByViewLines(viewModel, cursors, inSelectionMode, linesCount) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = CursorState.fromViewState(MoveOperations.moveUp(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, linesCount));\n }\n return result;\n }\n static _moveUpByModelLines(viewModel, cursors, inSelectionMode, linesCount) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n result[i] = CursorState.fromModelState(MoveOperations.moveUp(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, linesCount));\n }\n return result;\n }\n static _moveToViewPosition(viewModel, cursor, inSelectionMode, toViewLineNumber, toViewColumn) {\n return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, toViewLineNumber, toViewColumn, 0));\n }\n static _moveToModelPosition(viewModel, cursor, inSelectionMode, toModelLineNumber, toModelColumn) {\n return CursorState.fromModelState(cursor.modelState.move(inSelectionMode, toModelLineNumber, toModelColumn, 0));\n }\n static _moveToViewMinColumn(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const viewLineNumber = cursor.viewState.position.lineNumber;\n const viewColumn = viewModel.getLineMinColumn(viewLineNumber);\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\n }\n return result;\n }\n static _moveToViewFirstNonWhitespaceColumn(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const viewLineNumber = cursor.viewState.position.lineNumber;\n const viewColumn = viewModel.getLineFirstNonWhitespaceColumn(viewLineNumber);\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\n }\n return result;\n }\n static _moveToViewCenterColumn(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const viewLineNumber = cursor.viewState.position.lineNumber;\n const viewColumn = Math.round((viewModel.getLineMaxColumn(viewLineNumber) + viewModel.getLineMinColumn(viewLineNumber)) / 2);\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\n }\n return result;\n }\n static _moveToViewMaxColumn(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const viewLineNumber = cursor.viewState.position.lineNumber;\n const viewColumn = viewModel.getLineMaxColumn(viewLineNumber);\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\n }\n return result;\n }\n static _moveToViewLastNonWhitespaceColumn(viewModel, cursors, inSelectionMode) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const viewLineNumber = cursor.viewState.position.lineNumber;\n const viewColumn = viewModel.getLineLastNonWhitespaceColumn(viewLineNumber);\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\n }\n return result;\n }\n}\nexport var CursorMove;\n(function (CursorMove) {\n const isCursorMoveArgs = function (arg) {\n if (!types.isObject(arg)) {\n return false;\n }\n const cursorMoveArg = arg;\n if (!types.isString(cursorMoveArg.to)) {\n return false;\n }\n if (!types.isUndefined(cursorMoveArg.select) && !types.isBoolean(cursorMoveArg.select)) {\n return false;\n }\n if (!types.isUndefined(cursorMoveArg.by) && !types.isString(cursorMoveArg.by)) {\n return false;\n }\n if (!types.isUndefined(cursorMoveArg.value) && !types.isNumber(cursorMoveArg.value)) {\n return false;\n }\n return true;\n };\n CursorMove.metadata = {\n description: 'Move cursor to a logical position in the view',\n args: [\n {\n name: 'Cursor move argument object',\n description: `Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'to': A mandatory logical position value providing where to move the cursor.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',\n\t\t\t\t\t\t'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'\n\t\t\t\t\t\t'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'\n\t\t\t\t\t\t'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'line', 'wrappedLine', 'character', 'halfLine'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'select': If 'true' makes the selection. Default is 'false'.\n\t\t\t\t`,\n constraint: isCursorMoveArgs,\n schema: {\n 'type': 'object',\n 'required': ['to'],\n 'properties': {\n 'to': {\n 'type': 'string',\n 'enum': ['left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine', 'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter', 'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter', 'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside']\n },\n 'by': {\n 'type': 'string',\n 'enum': ['line', 'wrappedLine', 'character', 'halfLine']\n },\n 'value': {\n 'type': 'number',\n 'default': 1\n },\n 'select': {\n 'type': 'boolean',\n 'default': false\n }\n }\n }\n }\n ]\n };\n /**\n * Positions in the view for cursor move command.\n */\n CursorMove.RawDirection = {\n Left: 'left',\n Right: 'right',\n Up: 'up',\n Down: 'down',\n PrevBlankLine: 'prevBlankLine',\n NextBlankLine: 'nextBlankLine',\n WrappedLineStart: 'wrappedLineStart',\n WrappedLineFirstNonWhitespaceCharacter: 'wrappedLineFirstNonWhitespaceCharacter',\n WrappedLineColumnCenter: 'wrappedLineColumnCenter',\n WrappedLineEnd: 'wrappedLineEnd',\n WrappedLineLastNonWhitespaceCharacter: 'wrappedLineLastNonWhitespaceCharacter',\n ViewPortTop: 'viewPortTop',\n ViewPortCenter: 'viewPortCenter',\n ViewPortBottom: 'viewPortBottom',\n ViewPortIfOutside: 'viewPortIfOutside'\n };\n /**\n * Units for Cursor move 'by' argument\n */\n CursorMove.RawUnit = {\n Line: 'line',\n WrappedLine: 'wrappedLine',\n Character: 'character',\n HalfLine: 'halfLine'\n };\n function parse(args) {\n if (!args.to) {\n // illegal arguments\n return null;\n }\n let direction;\n switch (args.to) {\n case CursorMove.RawDirection.Left:\n direction = 0 /* Direction.Left */;\n break;\n case CursorMove.RawDirection.Right:\n direction = 1 /* Direction.Right */;\n break;\n case CursorMove.RawDirection.Up:\n direction = 2 /* Direction.Up */;\n break;\n case CursorMove.RawDirection.Down:\n direction = 3 /* Direction.Down */;\n break;\n case CursorMove.RawDirection.PrevBlankLine:\n direction = 4 /* Direction.PrevBlankLine */;\n break;\n case CursorMove.RawDirection.NextBlankLine:\n direction = 5 /* Direction.NextBlankLine */;\n break;\n case CursorMove.RawDirection.WrappedLineStart:\n direction = 6 /* Direction.WrappedLineStart */;\n break;\n case CursorMove.RawDirection.WrappedLineFirstNonWhitespaceCharacter:\n direction = 7 /* Direction.WrappedLineFirstNonWhitespaceCharacter */;\n break;\n case CursorMove.RawDirection.WrappedLineColumnCenter:\n direction = 8 /* Direction.WrappedLineColumnCenter */;\n break;\n case CursorMove.RawDirection.WrappedLineEnd:\n direction = 9 /* Direction.WrappedLineEnd */;\n break;\n case CursorMove.RawDirection.WrappedLineLastNonWhitespaceCharacter:\n direction = 10 /* Direction.WrappedLineLastNonWhitespaceCharacter */;\n break;\n case CursorMove.RawDirection.ViewPortTop:\n direction = 11 /* Direction.ViewPortTop */;\n break;\n case CursorMove.RawDirection.ViewPortBottom:\n direction = 13 /* Direction.ViewPortBottom */;\n break;\n case CursorMove.RawDirection.ViewPortCenter:\n direction = 12 /* Direction.ViewPortCenter */;\n break;\n case CursorMove.RawDirection.ViewPortIfOutside:\n direction = 14 /* Direction.ViewPortIfOutside */;\n break;\n default:\n // illegal arguments\n return null;\n }\n let unit = 0 /* Unit.None */;\n switch (args.by) {\n case CursorMove.RawUnit.Line:\n unit = 1 /* Unit.Line */;\n break;\n case CursorMove.RawUnit.WrappedLine:\n unit = 2 /* Unit.WrappedLine */;\n break;\n case CursorMove.RawUnit.Character:\n unit = 3 /* Unit.Character */;\n break;\n case CursorMove.RawUnit.HalfLine:\n unit = 4 /* Unit.HalfLine */;\n break;\n }\n return {\n direction: direction,\n unit: unit,\n select: (!!args.select),\n value: (args.value || 1)\n };\n }\n CursorMove.parse = parse;\n})(CursorMove || (CursorMove = {}));\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/**\n * Describes what to do with the indentation when pressing Enter.\n */\nexport var IndentAction;\n(function (IndentAction) {\n /**\n * Insert new line and copy the previous line's indentation.\n */\n IndentAction[IndentAction[\"None\"] = 0] = \"None\";\n /**\n * Insert new line and indent once (relative to the previous line's indentation).\n */\n IndentAction[IndentAction[\"Indent\"] = 1] = \"Indent\";\n /**\n * Insert two new lines:\n * - the first one indented which will hold the cursor\n * - the second one at the same indentation level\n */\n IndentAction[IndentAction[\"IndentOutdent\"] = 2] = \"IndentOutdent\";\n /**\n * Insert new line and outdent once (relative to the previous line's indentation).\n */\n IndentAction[IndentAction[\"Outdent\"] = 3] = \"Outdent\";\n})(IndentAction || (IndentAction = {}));\n/**\n * @internal\n */\nexport class StandardAutoClosingPairConditional {\n constructor(source) {\n this._neutralCharacter = null;\n this._neutralCharacterSearched = false;\n this.open = source.open;\n this.close = source.close;\n // initially allowed in all tokens\n this._inString = true;\n this._inComment = true;\n this._inRegEx = true;\n if (Array.isArray(source.notIn)) {\n for (let i = 0, len = source.notIn.length; i < len; i++) {\n const notIn = source.notIn[i];\n switch (notIn) {\n case 'string':\n this._inString = false;\n break;\n case 'comment':\n this._inComment = false;\n break;\n case 'regex':\n this._inRegEx = false;\n break;\n }\n }\n }\n }\n isOK(standardToken) {\n switch (standardToken) {\n case 0 /* StandardTokenType.Other */:\n return true;\n case 1 /* StandardTokenType.Comment */:\n return this._inComment;\n case 2 /* StandardTokenType.String */:\n return this._inString;\n case 3 /* StandardTokenType.RegEx */:\n return this._inRegEx;\n }\n }\n shouldAutoClose(context, column) {\n // Always complete on empty line\n if (context.getTokenCount() === 0) {\n return true;\n }\n const tokenIndex = context.findTokenIndexAtOffset(column - 2);\n const standardTokenType = context.getStandardTokenType(tokenIndex);\n return this.isOK(standardTokenType);\n }\n _findNeutralCharacterInRange(fromCharCode, toCharCode) {\n for (let charCode = fromCharCode; charCode <= toCharCode; charCode++) {\n const character = String.fromCharCode(charCode);\n if (!this.open.includes(character) && !this.close.includes(character)) {\n return character;\n }\n }\n return null;\n }\n /**\n * Find a character in the range [0-9a-zA-Z] that does not appear in the open or close\n */\n findNeutralCharacter() {\n if (!this._neutralCharacterSearched) {\n this._neutralCharacterSearched = true;\n if (!this._neutralCharacter) {\n this._neutralCharacter = this._findNeutralCharacterInRange(48 /* CharCode.Digit0 */, 57 /* CharCode.Digit9 */);\n }\n if (!this._neutralCharacter) {\n this._neutralCharacter = this._findNeutralCharacterInRange(97 /* CharCode.a */, 122 /* CharCode.z */);\n }\n if (!this._neutralCharacter) {\n this._neutralCharacter = this._findNeutralCharacterInRange(65 /* CharCode.A */, 90 /* CharCode.Z */);\n }\n }\n return this._neutralCharacter;\n }\n}\n/**\n * @internal\n */\nexport class AutoClosingPairs {\n constructor(autoClosingPairs) {\n this.autoClosingPairsOpenByStart = new Map();\n this.autoClosingPairsOpenByEnd = new Map();\n this.autoClosingPairsCloseByStart = new Map();\n this.autoClosingPairsCloseByEnd = new Map();\n this.autoClosingPairsCloseSingleChar = new Map();\n for (const pair of autoClosingPairs) {\n appendEntry(this.autoClosingPairsOpenByStart, pair.open.charAt(0), pair);\n appendEntry(this.autoClosingPairsOpenByEnd, pair.open.charAt(pair.open.length - 1), pair);\n appendEntry(this.autoClosingPairsCloseByStart, pair.close.charAt(0), pair);\n appendEntry(this.autoClosingPairsCloseByEnd, pair.close.charAt(pair.close.length - 1), pair);\n if (pair.close.length === 1 && pair.open.length === 1) {\n appendEntry(this.autoClosingPairsCloseSingleChar, pair.close, pair);\n }\n }\n }\n}\nfunction appendEntry(target, key, value) {\n if (target.has(key)) {\n target.get(key).push(value);\n }\n else {\n target.set(key, [value]);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { toDisposable } from '../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\nexport const USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\\\|;:\\'\",.<>/?';\n/**\n * Create a word definition regular expression based on default word separators.\n * Optionally provide allowed separators that should be included in words.\n *\n * The default would look like this:\n * /(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)/g\n */\nfunction createWordRegExp(allowInWords = '') {\n let source = '(-?\\\\d*\\\\.\\\\d\\\\w*)|([^';\n for (const sep of USUAL_WORD_SEPARATORS) {\n if (allowInWords.indexOf(sep) >= 0) {\n continue;\n }\n source += '\\\\' + sep;\n }\n source += '\\\\s]+)';\n return new RegExp(source, 'g');\n}\n// catches numbers (including floating numbers) in the first group, and alphanum in the second\nexport const DEFAULT_WORD_REGEXP = createWordRegExp();\nexport function ensureValidWordDefinition(wordDefinition) {\n let result = DEFAULT_WORD_REGEXP;\n if (wordDefinition && (wordDefinition instanceof RegExp)) {\n if (!wordDefinition.global) {\n let flags = 'g';\n if (wordDefinition.ignoreCase) {\n flags += 'i';\n }\n if (wordDefinition.multiline) {\n flags += 'm';\n }\n if (wordDefinition.unicode) {\n flags += 'u';\n }\n result = new RegExp(wordDefinition.source, flags);\n }\n else {\n result = wordDefinition;\n }\n }\n result.lastIndex = 0;\n return result;\n}\nconst _defaultConfig = new LinkedList();\n_defaultConfig.unshift({\n maxLen: 1000,\n windowSize: 15,\n timeBudget: 150\n});\nexport function setDefaultGetWordAtTextConfig(value) {\n const rm = _defaultConfig.unshift(value);\n return toDisposable(rm);\n}\nexport function getWordAtText(column, wordDefinition, text, textOffset, config) {\n // Ensure the regex has the 'g' flag, otherwise this will loop forever\n wordDefinition = ensureValidWordDefinition(wordDefinition);\n if (!config) {\n config = Iterable.first(_defaultConfig);\n }\n if (text.length > config.maxLen) {\n // don't throw strings that long at the regexp\n // but use a sub-string in which a word must occur\n let start = column - config.maxLen / 2;\n if (start < 0) {\n start = 0;\n }\n else {\n textOffset += start;\n }\n text = text.substring(start, column + config.maxLen / 2);\n return getWordAtText(column, wordDefinition, text, textOffset, config);\n }\n const t1 = Date.now();\n const pos = column - 1 - textOffset;\n let prevRegexIndex = -1;\n let match = null;\n for (let i = 1;; i++) {\n // check time budget\n if (Date.now() - t1 >= config.timeBudget) {\n break;\n }\n // reset the index at which the regexp should start matching, also know where it\n // should stop so that subsequent search don't repeat previous searches\n const regexIndex = pos - config.windowSize * i;\n wordDefinition.lastIndex = Math.max(0, regexIndex);\n const thisMatch = _findRegexMatchEnclosingPosition(wordDefinition, text, pos, prevRegexIndex);\n if (!thisMatch && match) {\n // stop: we have something\n break;\n }\n match = thisMatch;\n // stop: searched at start\n if (regexIndex <= 0) {\n break;\n }\n prevRegexIndex = regexIndex;\n }\n if (match) {\n const result = {\n word: match[0],\n startColumn: textOffset + 1 + match.index,\n endColumn: textOffset + 1 + match.index + match[0].length\n };\n wordDefinition.lastIndex = 0;\n return result;\n }\n return null;\n}\nfunction _findRegexMatchEnclosingPosition(wordDefinition, text, pos, stopPos) {\n let match;\n while (match = wordDefinition.exec(text)) {\n const matchIndex = match.index || 0;\n if (matchIndex <= pos && wordDefinition.lastIndex >= pos) {\n return match;\n }\n else if (stopPos > 0 && matchIndex > stopPos) {\n return null;\n }\n }\n return null;\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 *--------------------------------------------------------------------------------------------*/\nimport { StandardAutoClosingPairConditional } from '../languageConfiguration.js';\nexport class CharacterPairSupport {\n constructor(config) {\n if (config.autoClosingPairs) {\n this._autoClosingPairs = config.autoClosingPairs.map(el => new StandardAutoClosingPairConditional(el));\n }\n else if (config.brackets) {\n this._autoClosingPairs = config.brackets.map(b => new StandardAutoClosingPairConditional({ open: b[0], close: b[1] }));\n }\n else {\n this._autoClosingPairs = [];\n }\n if (config.__electricCharacterSupport && config.__electricCharacterSupport.docComment) {\n const docComment = config.__electricCharacterSupport.docComment;\n // IDocComment is legacy, only partially supported\n this._autoClosingPairs.push(new StandardAutoClosingPairConditional({ open: docComment.open, close: docComment.close || '' }));\n }\n this._autoCloseBeforeForQuotes = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES;\n this._autoCloseBeforeForBrackets = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS;\n this._surroundingPairs = config.surroundingPairs || this._autoClosingPairs;\n }\n getAutoClosingPairs() {\n return this._autoClosingPairs;\n }\n getAutoCloseBeforeSet(forQuotes) {\n return (forQuotes ? this._autoCloseBeforeForQuotes : this._autoCloseBeforeForBrackets);\n }\n getSurroundingPairs() {\n return this._surroundingPairs;\n }\n}\nCharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES = ';:.,=}])> \\n\\t';\nCharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS = '\\'\"`;:.,=}])> \\n\\t';\nCharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_WHITESPACE = ' \\n\\t';\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 *--------------------------------------------------------------------------------------------*/\nimport { onUnexpectedError } from './errors.js';\nimport { DisposableStore, toDisposable } from './lifecycle.js';\nexport function isReadable(obj) {\n const candidate = obj;\n if (!candidate) {\n return false;\n }\n return typeof candidate.read === 'function';\n}\nexport function isReadableStream(obj) {\n const candidate = obj;\n if (!candidate) {\n return false;\n }\n return [candidate.on, candidate.pause, candidate.resume, candidate.destroy].every(fn => typeof fn === 'function');\n}\nexport function isReadableBufferedStream(obj) {\n const candidate = obj;\n if (!candidate) {\n return false;\n }\n return isReadableStream(candidate.stream) && Array.isArray(candidate.buffer) && typeof candidate.ended === 'boolean';\n}\nexport function newWriteableStream(reducer, options) {\n return new WriteableStreamImpl(reducer, options);\n}\nclass WriteableStreamImpl {\n constructor(reducer, options) {\n this.reducer = reducer;\n this.options = options;\n this.state = {\n flowing: false,\n ended: false,\n destroyed: false\n };\n this.buffer = {\n data: [],\n error: []\n };\n this.listeners = {\n data: [],\n error: [],\n end: []\n };\n this.pendingWritePromises = [];\n }\n pause() {\n if (this.state.destroyed) {\n return;\n }\n this.state.flowing = false;\n }\n resume() {\n if (this.state.destroyed) {\n return;\n }\n if (!this.state.flowing) {\n this.state.flowing = true;\n // emit buffered events\n this.flowData();\n this.flowErrors();\n this.flowEnd();\n }\n }\n write(data) {\n if (this.state.destroyed) {\n return;\n }\n // flowing: directly send the data to listeners\n if (this.state.flowing) {\n this.emitData(data);\n }\n // not yet flowing: buffer data until flowing\n else {\n this.buffer.data.push(data);\n // highWaterMark: if configured, signal back when buffer reached limits\n if (typeof this.options?.highWaterMark === 'number' && this.buffer.data.length > this.options.highWaterMark) {\n return new Promise(resolve => this.pendingWritePromises.push(resolve));\n }\n }\n }\n error(error) {\n if (this.state.destroyed) {\n return;\n }\n // flowing: directly send the error to listeners\n if (this.state.flowing) {\n this.emitError(error);\n }\n // not yet flowing: buffer errors until flowing\n else {\n this.buffer.error.push(error);\n }\n }\n end(result) {\n if (this.state.destroyed) {\n return;\n }\n // end with data if provided\n if (typeof result !== 'undefined') {\n this.write(result);\n }\n // flowing: send end event to listeners\n if (this.state.flowing) {\n this.emitEnd();\n this.destroy();\n }\n // not yet flowing: remember state\n else {\n this.state.ended = true;\n }\n }\n emitData(data) {\n this.listeners.data.slice(0).forEach(listener => listener(data)); // slice to avoid listener mutation from delivering event\n }\n emitError(error) {\n if (this.listeners.error.length === 0) {\n onUnexpectedError(error); // nobody listened to this error so we log it as unexpected\n }\n else {\n this.listeners.error.slice(0).forEach(listener => listener(error)); // slice to avoid listener mutation from delivering event\n }\n }\n emitEnd() {\n this.listeners.end.slice(0).forEach(listener => listener()); // slice to avoid listener mutation from delivering event\n }\n on(event, callback) {\n if (this.state.destroyed) {\n return;\n }\n switch (event) {\n case 'data':\n this.listeners.data.push(callback);\n // switch into flowing mode as soon as the first 'data'\n // listener is added and we are not yet in flowing mode\n this.resume();\n break;\n case 'end':\n this.listeners.end.push(callback);\n // emit 'end' event directly if we are flowing\n // and the end has already been reached\n //\n // finish() when it went through\n if (this.state.flowing && this.flowEnd()) {\n this.destroy();\n }\n break;\n case 'error':\n this.listeners.error.push(callback);\n // emit buffered 'error' events unless done already\n // now that we know that we have at least one listener\n if (this.state.flowing) {\n this.flowErrors();\n }\n break;\n }\n }\n removeListener(event, callback) {\n if (this.state.destroyed) {\n return;\n }\n let listeners = undefined;\n switch (event) {\n case 'data':\n listeners = this.listeners.data;\n break;\n case 'end':\n listeners = this.listeners.end;\n break;\n case 'error':\n listeners = this.listeners.error;\n break;\n }\n if (listeners) {\n const index = listeners.indexOf(callback);\n if (index >= 0) {\n listeners.splice(index, 1);\n }\n }\n }\n flowData() {\n if (this.buffer.data.length > 0) {\n const fullDataBuffer = this.reducer(this.buffer.data);\n this.emitData(fullDataBuffer);\n this.buffer.data.length = 0;\n // When the buffer is empty, resolve all pending writers\n const pendingWritePromises = [...this.pendingWritePromises];\n this.pendingWritePromises.length = 0;\n pendingWritePromises.forEach(pendingWritePromise => pendingWritePromise());\n }\n }\n flowErrors() {\n if (this.listeners.error.length > 0) {\n for (const error of this.buffer.error) {\n this.emitError(error);\n }\n this.buffer.error.length = 0;\n }\n }\n flowEnd() {\n if (this.state.ended) {\n this.emitEnd();\n return this.listeners.end.length > 0;\n }\n return false;\n }\n destroy() {\n if (!this.state.destroyed) {\n this.state.destroyed = true;\n this.state.ended = true;\n this.buffer.data.length = 0;\n this.buffer.error.length = 0;\n this.listeners.data.length = 0;\n this.listeners.error.length = 0;\n this.listeners.end.length = 0;\n this.pendingWritePromises.length = 0;\n }\n }\n}\n/**\n * Helper to fully read a T readable into a T.\n */\nexport function consumeReadable(readable, reducer) {\n const chunks = [];\n let chunk;\n while ((chunk = readable.read()) !== null) {\n chunks.push(chunk);\n }\n return reducer(chunks);\n}\n/**\n * Helper to read a T readable up to a maximum of chunks. If the limit is\n * reached, will return a readable instead to ensure all data can still\n * be read.\n */\nexport function peekReadable(readable, reducer, maxChunks) {\n const chunks = [];\n let chunk = undefined;\n while ((chunk = readable.read()) !== null && chunks.length < maxChunks) {\n chunks.push(chunk);\n }\n // If the last chunk is null, it means we reached the end of\n // the readable and return all the data at once\n if (chunk === null && chunks.length > 0) {\n return reducer(chunks);\n }\n // Otherwise, we still have a chunk, it means we reached the maxChunks\n // value and as such we return a new Readable that first returns\n // the existing read chunks and then continues with reading from\n // the underlying readable.\n return {\n read: () => {\n // First consume chunks from our array\n if (chunks.length > 0) {\n return chunks.shift();\n }\n // Then ensure to return our last read chunk\n if (typeof chunk !== 'undefined') {\n const lastReadChunk = chunk;\n // explicitly use undefined here to indicate that we consumed\n // the chunk, which could have either been null or valued.\n chunk = undefined;\n return lastReadChunk;\n }\n // Finally delegate back to the Readable\n return readable.read();\n }\n };\n}\nexport function consumeStream(stream, reducer) {\n return new Promise((resolve, reject) => {\n const chunks = [];\n listenStream(stream, {\n onData: chunk => {\n if (reducer) {\n chunks.push(chunk);\n }\n },\n onError: error => {\n if (reducer) {\n reject(error);\n }\n else {\n resolve(undefined);\n }\n },\n onEnd: () => {\n if (reducer) {\n resolve(reducer(chunks));\n }\n else {\n resolve(undefined);\n }\n }\n });\n });\n}\n/**\n * Helper to listen to all events of a T stream in proper order.\n */\nexport function listenStream(stream, listener, token) {\n stream.on('error', error => {\n if (!token?.isCancellationRequested) {\n listener.onError(error);\n }\n });\n stream.on('end', () => {\n if (!token?.isCancellationRequested) {\n listener.onEnd();\n }\n });\n // Adding the `data` listener will turn the stream\n // into flowing mode. As such it is important to\n // add this listener last (DO NOT CHANGE!)\n stream.on('data', data => {\n if (!token?.isCancellationRequested) {\n listener.onData(data);\n }\n });\n}\n/**\n * Helper to peek up to `maxChunks` into a stream. The return type signals if\n * the stream has ended or not. If not, caller needs to add a `data` listener\n * to continue reading.\n */\nexport function peekStream(stream, maxChunks) {\n return new Promise((resolve, reject) => {\n const streamListeners = new DisposableStore();\n const buffer = [];\n // Data Listener\n const dataListener = (chunk) => {\n // Add to buffer\n buffer.push(chunk);\n // We reached maxChunks and thus need to return\n if (buffer.length > maxChunks) {\n // Dispose any listeners and ensure to pause the\n // stream so that it can be consumed again by caller\n streamListeners.dispose();\n stream.pause();\n return resolve({ stream, buffer, ended: false });\n }\n };\n // Error Listener\n const errorListener = (error) => {\n streamListeners.dispose();\n return reject(error);\n };\n // End Listener\n const endListener = () => {\n streamListeners.dispose();\n return resolve({ stream, buffer, ended: true });\n };\n streamListeners.add(toDisposable(() => stream.removeListener('error', errorListener)));\n stream.on('error', errorListener);\n streamListeners.add(toDisposable(() => stream.removeListener('end', endListener)));\n stream.on('end', endListener);\n // Important: leave the `data` listener last because\n // this can turn the stream into flowing mode and we\n // want `error` events to be received as well.\n streamListeners.add(toDisposable(() => stream.removeListener('data', dataListener)));\n stream.on('data', dataListener);\n });\n}\n/**\n * Helper to create a readable stream from an existing T.\n */\nexport function toStream(t, reducer) {\n const stream = newWriteableStream(reducer);\n stream.end(t);\n return stream;\n}\n/**\n * Helper to create an empty stream\n */\nexport function emptyStream() {\n const stream = newWriteableStream(() => { throw new Error('not supported'); });\n stream.end();\n return stream;\n}\n/**\n * Helper to convert a T into a Readable.\n */\nexport function toReadable(t) {\n let consumed = false;\n return {\n read: () => {\n if (consumed) {\n return null;\n }\n consumed = true;\n return t;\n }\n };\n}\n/**\n * Helper to transform a readable stream into another stream.\n */\nexport function transform(stream, transformer, reducer) {\n const target = newWriteableStream(reducer);\n listenStream(stream, {\n onData: data => target.write(transformer.data(data)),\n onError: error => target.error(transformer.error ? transformer.error(error) : error),\n onEnd: () => target.end()\n });\n return target;\n}\n/**\n * Helper to take an existing readable that will\n * have a prefix injected to the beginning.\n */\nexport function prefixedReadable(prefix, readable, reducer) {\n let prefixHandled = false;\n return {\n read: () => {\n const chunk = readable.read();\n // Handle prefix only once\n if (!prefixHandled) {\n prefixHandled = true;\n // If we have also a read-result, make\n // sure to reduce it to a single result\n if (chunk !== null) {\n return reducer([prefix, chunk]);\n }\n // Otherwise, just return prefix directly\n return prefix;\n }\n return chunk;\n }\n };\n}\n/**\n * Helper to take an existing stream that will\n * have a prefix injected to the beginning.\n */\nexport function prefixedStream(prefix, stream, reducer) {\n let prefixHandled = false;\n const target = newWriteableStream(reducer);\n listenStream(stream, {\n onData: data => {\n // Handle prefix only once\n if (!prefixHandled) {\n prefixHandled = true;\n return target.write(reducer([prefix, data]));\n }\n return target.write(data);\n },\n onError: error => target.error(error),\n onEnd: () => {\n // Handle prefix only once\n if (!prefixHandled) {\n prefixHandled = true;\n target.write(prefix);\n }\n target.end();\n }\n });\n return target;\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 *--------------------------------------------------------------------------------------------*/\nimport { Lazy } from './lazy.js';\nimport * as streams from './stream.js';\nconst hasBuffer = (typeof Buffer !== 'undefined');\nconst indexOfTable = new Lazy(() => new Uint8Array(256));\nlet textEncoder;\nlet textDecoder;\nexport class VSBuffer {\n /**\n * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n */\n static alloc(byteLength) {\n if (hasBuffer) {\n return new VSBuffer(Buffer.allocUnsafe(byteLength));\n }\n else {\n return new VSBuffer(new Uint8Array(byteLength));\n }\n }\n /**\n * When running in a nodejs context, if `actual` is not a nodejs Buffer, the backing store for\n * the returned `VSBuffer` instance might use a nodejs Buffer allocated from node's Buffer pool,\n * which is not transferrable.\n */\n static wrap(actual) {\n if (hasBuffer && !(Buffer.isBuffer(actual))) {\n // https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length\n // Create a zero-copy Buffer wrapper around the ArrayBuffer pointed to by the Uint8Array\n actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength);\n }\n return new VSBuffer(actual);\n }\n /**\n * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n */\n static fromString(source, options) {\n const dontUseNodeBuffer = options?.dontUseNodeBuffer || false;\n if (!dontUseNodeBuffer && hasBuffer) {\n return new VSBuffer(Buffer.from(source));\n }\n else {\n if (!textEncoder) {\n textEncoder = new TextEncoder();\n }\n return new VSBuffer(textEncoder.encode(source));\n }\n }\n /**\n * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n */\n static fromByteArray(source) {\n const result = VSBuffer.alloc(source.length);\n for (let i = 0, len = source.length; i < len; i++) {\n result.buffer[i] = source[i];\n }\n return result;\n }\n /**\n * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n */\n static concat(buffers, totalLength) {\n if (typeof totalLength === 'undefined') {\n totalLength = 0;\n for (let i = 0, len = buffers.length; i < len; i++) {\n totalLength += buffers[i].byteLength;\n }\n }\n const ret = VSBuffer.alloc(totalLength);\n let offset = 0;\n for (let i = 0, len = buffers.length; i < len; i++) {\n const element = buffers[i];\n ret.set(element, offset);\n offset += element.byteLength;\n }\n return ret;\n }\n constructor(buffer) {\n this.buffer = buffer;\n this.byteLength = this.buffer.byteLength;\n }\n /**\n * When running in a nodejs context, the backing store for the returned `VSBuffer` instance\n * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.\n */\n clone() {\n const result = VSBuffer.alloc(this.byteLength);\n result.set(this);\n return result;\n }\n toString() {\n if (hasBuffer) {\n return this.buffer.toString();\n }\n else {\n if (!textDecoder) {\n textDecoder = new TextDecoder();\n }\n return textDecoder.decode(this.buffer);\n }\n }\n slice(start, end) {\n // IMPORTANT: use subarray instead of slice because TypedArray#slice\n // creates shallow copy and NodeBuffer#slice doesn't. The use of subarray\n // ensures the same, performance, behaviour.\n return new VSBuffer(this.buffer.subarray(start, end));\n }\n set(array, offset) {\n if (array instanceof VSBuffer) {\n this.buffer.set(array.buffer, offset);\n }\n else if (array instanceof Uint8Array) {\n this.buffer.set(array, offset);\n }\n else if (array instanceof ArrayBuffer) {\n this.buffer.set(new Uint8Array(array), offset);\n }\n else if (ArrayBuffer.isView(array)) {\n this.buffer.set(new Uint8Array(array.buffer, array.byteOffset, array.byteLength), offset);\n }\n else {\n throw new Error(`Unknown argument 'array'`);\n }\n }\n readUInt32BE(offset) {\n return readUInt32BE(this.buffer, offset);\n }\n writeUInt32BE(value, offset) {\n writeUInt32BE(this.buffer, value, offset);\n }\n readUInt32LE(offset) {\n return readUInt32LE(this.buffer, offset);\n }\n writeUInt32LE(value, offset) {\n writeUInt32LE(this.buffer, value, offset);\n }\n readUInt8(offset) {\n return readUInt8(this.buffer, offset);\n }\n writeUInt8(value, offset) {\n writeUInt8(this.buffer, value, offset);\n }\n indexOf(subarray, offset = 0) {\n return binaryIndexOf(this.buffer, subarray instanceof VSBuffer ? subarray.buffer : subarray, offset);\n }\n}\n/**\n * Like String.indexOf, but works on Uint8Arrays.\n * Uses the boyer-moore-horspool algorithm to be reasonably speedy.\n */\nexport function binaryIndexOf(haystack, needle, offset = 0) {\n const needleLen = needle.byteLength;\n const haystackLen = haystack.byteLength;\n if (needleLen === 0) {\n return 0;\n }\n if (needleLen === 1) {\n return haystack.indexOf(needle[0]);\n }\n if (needleLen > haystackLen - offset) {\n return -1;\n }\n // find index of the subarray using boyer-moore-horspool algorithm\n const table = indexOfTable.value;\n table.fill(needle.length);\n for (let i = 0; i < needle.length; i++) {\n table[needle[i]] = needle.length - i - 1;\n }\n let i = offset + needle.length - 1;\n let j = i;\n let result = -1;\n while (i < haystackLen) {\n if (haystack[i] === needle[j]) {\n if (j === 0) {\n result = i;\n break;\n }\n i--;\n j--;\n }\n else {\n i += Math.max(needle.length - j, table[haystack[i]]);\n j = needle.length - 1;\n }\n }\n return result;\n}\nexport function readUInt16LE(source, offset) {\n return (((source[offset + 0] << 0) >>> 0) |\n ((source[offset + 1] << 8) >>> 0));\n}\nexport function writeUInt16LE(destination, value, offset) {\n destination[offset + 0] = (value & 0b11111111);\n value = value >>> 8;\n destination[offset + 1] = (value & 0b11111111);\n}\nexport function readUInt32BE(source, offset) {\n return (source[offset] * 2 ** 24\n + source[offset + 1] * 2 ** 16\n + source[offset + 2] * 2 ** 8\n + source[offset + 3]);\n}\nexport function writeUInt32BE(destination, value, offset) {\n destination[offset + 3] = value;\n value = value >>> 8;\n destination[offset + 2] = value;\n value = value >>> 8;\n destination[offset + 1] = value;\n value = value >>> 8;\n destination[offset] = value;\n}\nexport function readUInt32LE(source, offset) {\n return (((source[offset + 0] << 0) >>> 0) |\n ((source[offset + 1] << 8) >>> 0) |\n ((source[offset + 2] << 16) >>> 0) |\n ((source[offset + 3] << 24) >>> 0));\n}\nexport function writeUInt32LE(destination, value, offset) {\n destination[offset + 0] = (value & 0b11111111);\n value = value >>> 8;\n destination[offset + 1] = (value & 0b11111111);\n value = value >>> 8;\n destination[offset + 2] = (value & 0b11111111);\n value = value >>> 8;\n destination[offset + 3] = (value & 0b11111111);\n}\nexport function readUInt8(source, offset) {\n return source[offset];\n}\nexport function writeUInt8(destination, value, offset) {\n destination[offset] = value;\n}\nexport function readableToBuffer(readable) {\n return streams.consumeReadable(readable, chunks => VSBuffer.concat(chunks));\n}\nexport function bufferToReadable(buffer) {\n return streams.toReadable(buffer);\n}\nexport function streamToBuffer(stream) {\n return streams.consumeStream(stream, chunks => VSBuffer.concat(chunks));\n}\nexport async function bufferedStreamToBuffer(bufferedStream) {\n if (bufferedStream.ended) {\n return VSBuffer.concat(bufferedStream.buffer);\n }\n return VSBuffer.concat([\n // Include already read chunks...\n ...bufferedStream.buffer,\n // ...and all additional chunks\n await streamToBuffer(bufferedStream.stream)\n ]);\n}\nexport function bufferToStream(buffer) {\n return streams.toStream(buffer, chunks => VSBuffer.concat(chunks));\n}\nexport function streamToBufferReadableStream(stream) {\n return streams.transform(stream, { data: data => typeof data === 'string' ? VSBuffer.fromString(data) : VSBuffer.wrap(data) }, chunks => VSBuffer.concat(chunks));\n}\nexport function newWriteableBufferStream(options) {\n return streams.newWriteableStream(chunks => VSBuffer.concat(chunks), options);\n}\nexport function prefixedBufferReadable(prefix, readable) {\n return streams.prefixedReadable(prefix, readable, chunks => VSBuffer.concat(chunks));\n}\nexport function prefixedBufferStream(prefix, stream) {\n return streams.prefixedStream(prefix, stream, chunks => VSBuffer.concat(chunks));\n}\n/** Decodes base64 to a uint8 array. URL-encoded and unpadded base64 is allowed. */\nexport function decodeBase64(encoded) {\n let building = 0;\n let remainder = 0;\n let bufi = 0;\n // The simpler way to do this is `Uint8Array.from(atob(str), c => c.charCodeAt(0))`,\n // but that's about 10-20x slower than this function in current Chromium versions.\n const buffer = new Uint8Array(Math.floor(encoded.length / 4 * 3));\n const append = (value) => {\n switch (remainder) {\n case 3:\n buffer[bufi++] = building | value;\n remainder = 0;\n break;\n case 2:\n buffer[bufi++] = building | (value >>> 2);\n building = value << 6;\n remainder = 3;\n break;\n case 1:\n buffer[bufi++] = building | (value >>> 4);\n building = value << 4;\n remainder = 2;\n break;\n default:\n building = value << 2;\n remainder = 1;\n }\n };\n for (let i = 0; i < encoded.length; i++) {\n const code = encoded.charCodeAt(i);\n // See https://datatracker.ietf.org/doc/html/rfc4648#section-4\n // This branchy code is about 3x faster than an indexOf on a base64 char string.\n if (code >= 65 && code <= 90) {\n append(code - 65); // A-Z starts ranges from char code 65 to 90\n }\n else if (code >= 97 && code <= 122) {\n append(code - 97 + 26); // a-z starts ranges from char code 97 to 122, starting at byte 26\n }\n else if (code >= 48 && code <= 57) {\n append(code - 48 + 52); // 0-9 starts ranges from char code 48 to 58, starting at byte 52\n }\n else if (code === 43 || code === 45) {\n append(62); // \"+\" or \"-\" for URLS\n }\n else if (code === 47 || code === 95) {\n append(63); // \"/\" or \"_\" for URLS\n }\n else if (code === 61) {\n break; // \"=\"\n }\n else {\n throw new SyntaxError(`Unexpected base64 character ${encoded[i]}`);\n }\n }\n const unpadded = bufi;\n while (remainder > 0) {\n append(0);\n }\n // slice is needed to account for overestimation due to padding\n return VSBuffer.wrap(buffer).slice(0, unpadded);\n}\nconst base64Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst base64UrlSafeAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\n/** Encodes a buffer to a base64 string. */\nexport function encodeBase64({ buffer }, padded = true, urlSafe = false) {\n const dictionary = urlSafe ? base64UrlSafeAlphabet : base64Alphabet;\n let output = '';\n const remainder = buffer.byteLength % 3;\n let i = 0;\n for (; i < buffer.byteLength - remainder; i += 3) {\n const a = buffer[i + 0];\n const b = buffer[i + 1];\n const c = buffer[i + 2];\n output += dictionary[a >>> 2];\n output += dictionary[(a << 4 | b >>> 4) & 0b111111];\n output += dictionary[(b << 2 | c >>> 6) & 0b111111];\n output += dictionary[c & 0b111111];\n }\n if (remainder === 1) {\n const a = buffer[i + 0];\n output += dictionary[a >>> 2];\n output += dictionary[(a << 4) & 0b111111];\n if (padded) {\n output += '==';\n }\n }\n else if (remainder === 2) {\n const a = buffer[i + 0];\n const b = buffer[i + 1];\n output += dictionary[a >>> 2];\n output += dictionary[(a << 4 | b >>> 4) & 0b111111];\n output += dictionary[(b << 2) & 0b111111];\n if (padded) {\n output += '=';\n }\n }\n return output;\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport * as platform from '../../../base/common/platform.js';\nimport * as buffer from '../../../base/common/buffer.js';\nlet _utf16LE_TextDecoder;\nfunction getUTF16LE_TextDecoder() {\n if (!_utf16LE_TextDecoder) {\n _utf16LE_TextDecoder = new TextDecoder('UTF-16LE');\n }\n return _utf16LE_TextDecoder;\n}\nlet _utf16BE_TextDecoder;\nfunction getUTF16BE_TextDecoder() {\n if (!_utf16BE_TextDecoder) {\n _utf16BE_TextDecoder = new TextDecoder('UTF-16BE');\n }\n return _utf16BE_TextDecoder;\n}\nlet _platformTextDecoder;\nexport function getPlatformTextDecoder() {\n if (!_platformTextDecoder) {\n _platformTextDecoder = platform.isLittleEndian() ? getUTF16LE_TextDecoder() : getUTF16BE_TextDecoder();\n }\n return _platformTextDecoder;\n}\nexport function decodeUTF16LE(source, offset, len) {\n const view = new Uint16Array(source.buffer, offset, len);\n if (len > 0 && (view[0] === 0xFEFF || view[0] === 0xFFFE)) {\n // UTF16 sometimes starts with a BOM https://de.wikipedia.org/wiki/Byte_Order_Mark\n // It looks like TextDecoder.decode will eat up a leading BOM (0xFEFF or 0xFFFE)\n // We don't want that behavior because we know the string is UTF16LE and the BOM should be maintained\n // So we use the manual decoder\n return compatDecodeUTF16LE(source, offset, len);\n }\n return getUTF16LE_TextDecoder().decode(view);\n}\nfunction compatDecodeUTF16LE(source, offset, len) {\n const result = [];\n let resultLen = 0;\n for (let i = 0; i < len; i++) {\n const charCode = buffer.readUInt16LE(source, offset);\n offset += 2;\n result[resultLen++] = String.fromCharCode(charCode);\n }\n return result.join('');\n}\nexport class StringBuilder {\n constructor(capacity) {\n this._capacity = capacity | 0;\n this._buffer = new Uint16Array(this._capacity);\n this._completedStrings = null;\n this._bufferLength = 0;\n }\n reset() {\n this._completedStrings = null;\n this._bufferLength = 0;\n }\n build() {\n if (this._completedStrings !== null) {\n this._flushBuffer();\n return this._completedStrings.join('');\n }\n return this._buildBuffer();\n }\n _buildBuffer() {\n if (this._bufferLength === 0) {\n return '';\n }\n const view = new Uint16Array(this._buffer.buffer, 0, this._bufferLength);\n return getPlatformTextDecoder().decode(view);\n }\n _flushBuffer() {\n const bufferString = this._buildBuffer();\n this._bufferLength = 0;\n if (this._completedStrings === null) {\n this._completedStrings = [bufferString];\n }\n else {\n this._completedStrings[this._completedStrings.length] = bufferString;\n }\n }\n /**\n * Append a char code (<2^16)\n */\n appendCharCode(charCode) {\n const remainingSpace = this._capacity - this._bufferLength;\n if (remainingSpace <= 1) {\n if (remainingSpace === 0 || strings.isHighSurrogate(charCode)) {\n this._flushBuffer();\n }\n }\n this._buffer[this._bufferLength++] = charCode;\n }\n /**\n * Append an ASCII char code (<2^8)\n */\n appendASCIICharCode(charCode) {\n if (this._bufferLength === this._capacity) {\n // buffer is full\n this._flushBuffer();\n }\n this._buffer[this._bufferLength++] = charCode;\n }\n appendString(str) {\n const strLen = str.length;\n if (this._bufferLength + strLen >= this._capacity) {\n // This string does not fit in the remaining buffer space\n this._flushBuffer();\n this._completedStrings[this._completedStrings.length] = str;\n return;\n }\n for (let i = 0; i < strLen; i++) {\n this._buffer[this._bufferLength++] = str.charCodeAt(i);\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../../base/common/strings.js';\nimport * as stringBuilder from '../../core/stringBuilder.js';\nimport { Range } from '../../core/range.js';\n/**\n * Represents a grouping of colliding bracket pairs.\n *\n * Most of the times this contains a single bracket pair,\n * but sometimes this contains multiple bracket pairs in cases\n * where the same string appears as a closing bracket for multiple\n * bracket pairs, or the same string appears an opening bracket for\n * multiple bracket pairs.\n *\n * e.g. of a group containing a single pair:\n * open: ['{'], close: ['}']\n *\n * e.g. of a group containing multiple pairs:\n * open: ['if', 'for'], close: ['end', 'end']\n */\nexport class RichEditBracket {\n constructor(languageId, index, open, close, forwardRegex, reversedRegex) {\n this._richEditBracketBrand = undefined;\n this.languageId = languageId;\n this.index = index;\n this.open = open;\n this.close = close;\n this.forwardRegex = forwardRegex;\n this.reversedRegex = reversedRegex;\n this._openSet = RichEditBracket._toSet(this.open);\n this._closeSet = RichEditBracket._toSet(this.close);\n }\n /**\n * Check if the provided `text` is an open bracket in this group.\n */\n isOpen(text) {\n return this._openSet.has(text);\n }\n /**\n * Check if the provided `text` is a close bracket in this group.\n */\n isClose(text) {\n return this._closeSet.has(text);\n }\n static _toSet(arr) {\n const result = new Set();\n for (const element of arr) {\n result.add(element);\n }\n return result;\n }\n}\n/**\n * Groups together brackets that have equal open or close sequences.\n *\n * For example, if the following brackets are defined:\n * ['IF','END']\n * ['for','end']\n * ['{','}']\n *\n * Then the grouped brackets would be:\n * { open: ['if', 'for'], close: ['end', 'end'] }\n * { open: ['{'], close: ['}'] }\n *\n */\nfunction groupFuzzyBrackets(brackets) {\n const N = brackets.length;\n brackets = brackets.map(b => [b[0].toLowerCase(), b[1].toLowerCase()]);\n const group = [];\n for (let i = 0; i < N; i++) {\n group[i] = i;\n }\n const areOverlapping = (a, b) => {\n const [aOpen, aClose] = a;\n const [bOpen, bClose] = b;\n return (aOpen === bOpen || aOpen === bClose || aClose === bOpen || aClose === bClose);\n };\n const mergeGroups = (g1, g2) => {\n const newG = Math.min(g1, g2);\n const oldG = Math.max(g1, g2);\n for (let i = 0; i < N; i++) {\n if (group[i] === oldG) {\n group[i] = newG;\n }\n }\n };\n // group together brackets that have the same open or the same close sequence\n for (let i = 0; i < N; i++) {\n const a = brackets[i];\n for (let j = i + 1; j < N; j++) {\n const b = brackets[j];\n if (areOverlapping(a, b)) {\n mergeGroups(group[i], group[j]);\n }\n }\n }\n const result = [];\n for (let g = 0; g < N; g++) {\n const currentOpen = [];\n const currentClose = [];\n for (let i = 0; i < N; i++) {\n if (group[i] === g) {\n const [open, close] = brackets[i];\n currentOpen.push(open);\n currentClose.push(close);\n }\n }\n if (currentOpen.length > 0) {\n result.push({\n open: currentOpen,\n close: currentClose\n });\n }\n }\n return result;\n}\nexport class RichEditBrackets {\n constructor(languageId, _brackets) {\n this._richEditBracketsBrand = undefined;\n const brackets = groupFuzzyBrackets(_brackets);\n this.brackets = brackets.map((b, index) => {\n return new RichEditBracket(languageId, index, b.open, b.close, getRegexForBracketPair(b.open, b.close, brackets, index), getReversedRegexForBracketPair(b.open, b.close, brackets, index));\n });\n this.forwardRegex = getRegexForBrackets(this.brackets);\n this.reversedRegex = getReversedRegexForBrackets(this.brackets);\n this.textIsBracket = {};\n this.textIsOpenBracket = {};\n this.maxBracketLength = 0;\n for (const bracket of this.brackets) {\n for (const open of bracket.open) {\n this.textIsBracket[open] = bracket;\n this.textIsOpenBracket[open] = true;\n this.maxBracketLength = Math.max(this.maxBracketLength, open.length);\n }\n for (const close of bracket.close) {\n this.textIsBracket[close] = bracket;\n this.textIsOpenBracket[close] = false;\n this.maxBracketLength = Math.max(this.maxBracketLength, close.length);\n }\n }\n }\n}\nfunction collectSuperstrings(str, brackets, currentIndex, dest) {\n for (let i = 0, len = brackets.length; i < len; i++) {\n if (i === currentIndex) {\n continue;\n }\n const bracket = brackets[i];\n for (const open of bracket.open) {\n if (open.indexOf(str) >= 0) {\n dest.push(open);\n }\n }\n for (const close of bracket.close) {\n if (close.indexOf(str) >= 0) {\n dest.push(close);\n }\n }\n }\n}\nfunction lengthcmp(a, b) {\n return a.length - b.length;\n}\nfunction unique(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n const result = [];\n const seen = new Set();\n for (const element of arr) {\n if (seen.has(element)) {\n continue;\n }\n result.push(element);\n seen.add(element);\n }\n return result;\n}\n/**\n * Create a regular expression that can be used to search forward in a piece of text\n * for a group of bracket pairs. But this regex must be built in a way in which\n * it is aware of the other bracket pairs defined for the language.\n *\n * For example, if a language contains the following bracket pairs:\n * ['begin', 'end']\n * ['if', 'end if']\n * The two bracket pairs do not collide because no open or close brackets are equal.\n * So the function getRegexForBracketPair is called twice, once with\n * the ['begin'], ['end'] group consisting of one bracket pair, and once with\n * the ['if'], ['end if'] group consiting of the other bracket pair.\n *\n * But there could be a situation where an occurrence of 'end if' is mistaken\n * for an occurrence of 'end'.\n *\n * Therefore, for the bracket pair ['begin', 'end'], the regex will also\n * target 'end if'. The regex will be something like:\n * /(\\bend if\\b)|(\\bend\\b)|(\\bif\\b)/\n *\n * The regex also searches for \"superstrings\" (other brackets that might be mistaken with the current bracket).\n *\n */\nfunction getRegexForBracketPair(open, close, brackets, currentIndex) {\n // search in all brackets for other brackets that are a superstring of these brackets\n let pieces = [];\n pieces = pieces.concat(open);\n pieces = pieces.concat(close);\n for (let i = 0, len = pieces.length; i < len; i++) {\n collectSuperstrings(pieces[i], brackets, currentIndex, pieces);\n }\n pieces = unique(pieces);\n pieces.sort(lengthcmp);\n pieces.reverse();\n return createBracketOrRegExp(pieces);\n}\n/**\n * Matching a regular expression in JS can only be done \"forwards\". So JS offers natively only\n * methods to find the first match of a regex in a string. But sometimes, it is useful to\n * find the last match of a regex in a string. For such a situation, a nice solution is to\n * simply reverse the string and then search for a reversed regex.\n *\n * This function also has the fine details of `getRegexForBracketPair`. For the same example\n * given above, the regex produced here would look like:\n * /(\\bfi dne\\b)|(\\bdne\\b)|(\\bfi\\b)/\n */\nfunction getReversedRegexForBracketPair(open, close, brackets, currentIndex) {\n // search in all brackets for other brackets that are a superstring of these brackets\n let pieces = [];\n pieces = pieces.concat(open);\n pieces = pieces.concat(close);\n for (let i = 0, len = pieces.length; i < len; i++) {\n collectSuperstrings(pieces[i], brackets, currentIndex, pieces);\n }\n pieces = unique(pieces);\n pieces.sort(lengthcmp);\n pieces.reverse();\n return createBracketOrRegExp(pieces.map(toReversedString));\n}\n/**\n * Creates a regular expression that targets all bracket pairs.\n *\n * e.g. for the bracket pairs:\n * ['{','}']\n * ['begin,'end']\n * ['for','end']\n * the regex would look like:\n * /(\\{)|(\\})|(\\bbegin\\b)|(\\bend\\b)|(\\bfor\\b)/\n */\nfunction getRegexForBrackets(brackets) {\n let pieces = [];\n for (const bracket of brackets) {\n for (const open of bracket.open) {\n pieces.push(open);\n }\n for (const close of bracket.close) {\n pieces.push(close);\n }\n }\n pieces = unique(pieces);\n return createBracketOrRegExp(pieces);\n}\n/**\n * Matching a regular expression in JS can only be done \"forwards\". So JS offers natively only\n * methods to find the first match of a regex in a string. But sometimes, it is useful to\n * find the last match of a regex in a string. For such a situation, a nice solution is to\n * simply reverse the string and then search for a reversed regex.\n *\n * e.g. for the bracket pairs:\n * ['{','}']\n * ['begin,'end']\n * ['for','end']\n * the regex would look like:\n * /(\\{)|(\\})|(\\bnigeb\\b)|(\\bdne\\b)|(\\brof\\b)/\n */\nfunction getReversedRegexForBrackets(brackets) {\n let pieces = [];\n for (const bracket of brackets) {\n for (const open of bracket.open) {\n pieces.push(open);\n }\n for (const close of bracket.close) {\n pieces.push(close);\n }\n }\n pieces = unique(pieces);\n return createBracketOrRegExp(pieces.map(toReversedString));\n}\nfunction prepareBracketForRegExp(str) {\n // This bracket pair uses letters like e.g. \"begin\" - \"end\"\n const insertWordBoundaries = (/^[\\w ]+$/.test(str));\n str = strings.escapeRegExpCharacters(str);\n return (insertWordBoundaries ? `\\\\b${str}\\\\b` : str);\n}\nfunction createBracketOrRegExp(pieces) {\n const regexStr = `(${pieces.map(prepareBracketForRegExp).join(')|(')})`;\n return strings.createRegExp(regexStr, true);\n}\nconst toReversedString = (function () {\n function reverse(str) {\n // create a Uint16Array and then use a TextDecoder to create a string\n const arr = new Uint16Array(str.length);\n let offset = 0;\n for (let i = str.length - 1; i >= 0; i--) {\n arr[offset++] = str.charCodeAt(i);\n }\n return stringBuilder.getPlatformTextDecoder().decode(arr);\n }\n let lastInput = null;\n let lastOutput = null;\n return function toReversedString(str) {\n if (lastInput !== str) {\n lastInput = str;\n lastOutput = reverse(lastInput);\n }\n return lastOutput;\n };\n})();\nexport class BracketsUtils {\n static _findPrevBracketInText(reversedBracketRegex, lineNumber, reversedText, offset) {\n const m = reversedText.match(reversedBracketRegex);\n if (!m) {\n return null;\n }\n const matchOffset = reversedText.length - (m.index || 0);\n const matchLength = m[0].length;\n const absoluteMatchOffset = offset + matchOffset;\n return new Range(lineNumber, absoluteMatchOffset - matchLength + 1, lineNumber, absoluteMatchOffset + 1);\n }\n static findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, startOffset, endOffset) {\n // Because JS does not support backwards regex search, we search forwards in a reversed string with a reversed regex ;)\n const reversedLineText = toReversedString(lineText);\n const reversedSubstr = reversedLineText.substring(lineText.length - endOffset, lineText.length - startOffset);\n return this._findPrevBracketInText(reversedBracketRegex, lineNumber, reversedSubstr, startOffset);\n }\n static findNextBracketInText(bracketRegex, lineNumber, text, offset) {\n const m = text.match(bracketRegex);\n if (!m) {\n return null;\n }\n const matchOffset = m.index || 0;\n const matchLength = m[0].length;\n if (matchLength === 0) {\n return null;\n }\n const absoluteMatchOffset = offset + matchOffset;\n return new Range(lineNumber, absoluteMatchOffset + 1, lineNumber, absoluteMatchOffset + 1 + matchLength);\n }\n static findNextBracketInRange(bracketRegex, lineNumber, lineText, startOffset, endOffset) {\n const substr = lineText.substring(startOffset, endOffset);\n return this.findNextBracketInText(bracketRegex, lineNumber, substr, startOffset);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { distinct } from '../../../../base/common/arrays.js';\nimport { ignoreBracketsInToken } from '../supports.js';\nimport { BracketsUtils } from './richEditBrackets.js';\nexport class BracketElectricCharacterSupport {\n constructor(richEditBrackets) {\n this._richEditBrackets = richEditBrackets;\n }\n getElectricCharacters() {\n const result = [];\n if (this._richEditBrackets) {\n for (const bracket of this._richEditBrackets.brackets) {\n for (const close of bracket.close) {\n const lastChar = close.charAt(close.length - 1);\n result.push(lastChar);\n }\n }\n }\n return distinct(result);\n }\n onElectricCharacter(character, context, column) {\n if (!this._richEditBrackets || this._richEditBrackets.brackets.length === 0) {\n return null;\n }\n const tokenIndex = context.findTokenIndexAtOffset(column - 1);\n if (ignoreBracketsInToken(context.getStandardTokenType(tokenIndex))) {\n return null;\n }\n const reversedBracketRegex = this._richEditBrackets.reversedRegex;\n const text = context.getLineContent().substring(0, column - 1) + character;\n const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, 1, text, 0, text.length);\n if (!r) {\n return null;\n }\n const bracketText = text.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\n const isOpen = this._richEditBrackets.textIsOpenBracket[bracketText];\n if (isOpen) {\n return null;\n }\n const textBeforeBracket = context.getActualLineContentBefore(r.startColumn - 1);\n if (!/^\\s*$/.test(textBeforeBracket)) {\n // There is other text on the line before the bracket\n return null;\n }\n return {\n matchOpenBracket: bracketText\n };\n }\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 *--------------------------------------------------------------------------------------------*/\nfunction resetGlobalRegex(reg) {\n if (reg.global) {\n reg.lastIndex = 0;\n }\n return true;\n}\nexport class IndentRulesSupport {\n constructor(indentationRules) {\n this._indentationRules = indentationRules;\n }\n shouldIncrease(text) {\n if (this._indentationRules) {\n if (this._indentationRules.increaseIndentPattern && resetGlobalRegex(this._indentationRules.increaseIndentPattern) && this._indentationRules.increaseIndentPattern.test(text)) {\n return true;\n }\n // if (this._indentationRules.indentNextLinePattern && this._indentationRules.indentNextLinePattern.test(text)) {\n // \treturn true;\n // }\n }\n return false;\n }\n shouldDecrease(text) {\n if (this._indentationRules && this._indentationRules.decreaseIndentPattern && resetGlobalRegex(this._indentationRules.decreaseIndentPattern) && this._indentationRules.decreaseIndentPattern.test(text)) {\n return true;\n }\n return false;\n }\n shouldIndentNextLine(text) {\n if (this._indentationRules && this._indentationRules.indentNextLinePattern && resetGlobalRegex(this._indentationRules.indentNextLinePattern) && this._indentationRules.indentNextLinePattern.test(text)) {\n return true;\n }\n return false;\n }\n shouldIgnore(text) {\n // the text matches `unIndentedLinePattern`\n if (this._indentationRules && this._indentationRules.unIndentedLinePattern && resetGlobalRegex(this._indentationRules.unIndentedLinePattern) && this._indentationRules.unIndentedLinePattern.test(text)) {\n return true;\n }\n return false;\n }\n getIndentMetadata(text) {\n let ret = 0;\n if (this.shouldIncrease(text)) {\n ret += 1 /* IndentConsts.INCREASE_MASK */;\n }\n if (this.shouldDecrease(text)) {\n ret += 2 /* IndentConsts.DECREASE_MASK */;\n }\n if (this.shouldIndentNextLine(text)) {\n ret += 4 /* IndentConsts.INDENT_NEXTLINE_MASK */;\n }\n if (this.shouldIgnore(text)) {\n ret += 8 /* IndentConsts.UNINDENT_MASK */;\n }\n return ret;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport * as strings from '../../../../base/common/strings.js';\nimport { IndentAction } from '../languageConfiguration.js';\nexport class OnEnterSupport {\n constructor(opts) {\n opts = opts || {};\n opts.brackets = opts.brackets || [\n ['(', ')'],\n ['{', '}'],\n ['[', ']']\n ];\n this._brackets = [];\n opts.brackets.forEach((bracket) => {\n const openRegExp = OnEnterSupport._createOpenBracketRegExp(bracket[0]);\n const closeRegExp = OnEnterSupport._createCloseBracketRegExp(bracket[1]);\n if (openRegExp && closeRegExp) {\n this._brackets.push({\n open: bracket[0],\n openRegExp: openRegExp,\n close: bracket[1],\n closeRegExp: closeRegExp,\n });\n }\n });\n this._regExpRules = opts.onEnterRules || [];\n }\n onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {\n // (1): `regExpRules`\n if (autoIndent >= 3 /* EditorAutoIndentStrategy.Advanced */) {\n for (let i = 0, len = this._regExpRules.length; i < len; i++) {\n const rule = this._regExpRules[i];\n const regResult = [{\n reg: rule.beforeText,\n text: beforeEnterText\n }, {\n reg: rule.afterText,\n text: afterEnterText\n }, {\n reg: rule.previousLineText,\n text: previousLineText\n }].every((obj) => {\n if (!obj.reg) {\n return true;\n }\n obj.reg.lastIndex = 0; // To disable the effect of the \"g\" flag.\n return obj.reg.test(obj.text);\n });\n if (regResult) {\n return rule.action;\n }\n }\n }\n // (2): Special indent-outdent\n if (autoIndent >= 2 /* EditorAutoIndentStrategy.Brackets */) {\n if (beforeEnterText.length > 0 && afterEnterText.length > 0) {\n for (let i = 0, len = this._brackets.length; i < len; i++) {\n const bracket = this._brackets[i];\n if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) {\n return { indentAction: IndentAction.IndentOutdent };\n }\n }\n }\n }\n // (4): Open bracket based logic\n if (autoIndent >= 2 /* EditorAutoIndentStrategy.Brackets */) {\n if (beforeEnterText.length > 0) {\n for (let i = 0, len = this._brackets.length; i < len; i++) {\n const bracket = this._brackets[i];\n if (bracket.openRegExp.test(beforeEnterText)) {\n return { indentAction: IndentAction.Indent };\n }\n }\n }\n }\n return null;\n }\n static _createOpenBracketRegExp(bracket) {\n let str = strings.escapeRegExpCharacters(bracket);\n if (!/\\B/.test(str.charAt(0))) {\n str = '\\\\b' + str;\n }\n str += '\\\\s*$';\n return OnEnterSupport._safeRegExp(str);\n }\n static _createCloseBracketRegExp(bracket) {\n let str = strings.escapeRegExpCharacters(bracket);\n if (!/\\B/.test(str.charAt(str.length - 1))) {\n str = str + '\\\\b';\n }\n str = '^\\\\s*' + str;\n return OnEnterSupport._safeRegExp(str);\n }\n static _safeRegExp(def) {\n try {\n return new RegExp(def);\n }\n catch (err) {\n onUnexpectedError(err);\n return null;\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as types from '../../../base/common/types.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const IConfigurationService = createDecorator('configurationService');\nexport function isConfigurationOverrides(thing) {\n return thing\n && typeof thing === 'object'\n && (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')\n && (!thing.resource || thing.resource instanceof URI);\n}\nexport function isConfigurationUpdateOverrides(thing) {\n return thing\n && typeof thing === 'object'\n && (!thing.overrideIdentifiers || Array.isArray(thing.overrideIdentifiers))\n && !thing.overrideIdentifier\n && (!thing.resource || thing.resource instanceof URI);\n}\nexport function ConfigurationTargetToString(configurationTarget) {\n switch (configurationTarget) {\n case 1 /* ConfigurationTarget.APPLICATION */: return 'APPLICATION';\n case 2 /* ConfigurationTarget.USER */: return 'USER';\n case 3 /* ConfigurationTarget.USER_LOCAL */: return 'USER_LOCAL';\n case 4 /* ConfigurationTarget.USER_REMOTE */: return 'USER_REMOTE';\n case 5 /* ConfigurationTarget.WORKSPACE */: return 'WORKSPACE';\n case 6 /* ConfigurationTarget.WORKSPACE_FOLDER */: return 'WORKSPACE_FOLDER';\n case 7 /* ConfigurationTarget.DEFAULT */: return 'DEFAULT';\n case 8 /* ConfigurationTarget.MEMORY */: return 'MEMORY';\n }\n}\nexport function isConfigured(configValue) {\n return configValue.applicationValue !== undefined ||\n configValue.userValue !== undefined ||\n configValue.userLocalValue !== undefined ||\n configValue.userRemoteValue !== undefined ||\n configValue.workspaceValue !== undefined ||\n configValue.workspaceFolderValue !== undefined;\n}\nexport function toValuesTree(properties, conflictReporter) {\n const root = Object.create(null);\n for (const key in properties) {\n addToValueTree(root, key, properties[key], conflictReporter);\n }\n return root;\n}\nexport function addToValueTree(settingsTreeRoot, key, value, conflictReporter) {\n const segments = key.split('.');\n const last = segments.pop();\n let curr = settingsTreeRoot;\n for (let i = 0; i < segments.length; i++) {\n const s = segments[i];\n let obj = curr[s];\n switch (typeof obj) {\n case 'undefined':\n obj = curr[s] = Object.create(null);\n break;\n case 'object':\n break;\n default:\n conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is ${JSON.stringify(obj)}`);\n return;\n }\n curr = obj;\n }\n if (typeof curr === 'object' && curr !== null) {\n try {\n curr[last] = value; // workaround https://github.com/microsoft/vscode/issues/13606\n }\n catch (e) {\n conflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\n }\n }\n else {\n conflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\n }\n}\nexport function removeFromValueTree(valueTree, key) {\n const segments = key.split('.');\n doRemoveFromValueTree(valueTree, segments);\n}\nfunction doRemoveFromValueTree(valueTree, segments) {\n const first = segments.shift();\n if (segments.length === 0) {\n // Reached last segment\n delete valueTree[first];\n return;\n }\n if (Object.keys(valueTree).indexOf(first) !== -1) {\n const value = valueTree[first];\n if (typeof value === 'object' && !Array.isArray(value)) {\n doRemoveFromValueTree(value, segments);\n if (Object.keys(value).length === 0) {\n delete valueTree[first];\n }\n }\n }\n}\n/**\n * A helper function to get the configuration value with a specific settings path (e.g. config.some.setting)\n */\nexport function getConfigurationValue(config, settingPath, defaultValue) {\n function accessSetting(config, path) {\n let current = config;\n for (const component of path) {\n if (typeof current !== 'object' || current === null) {\n return undefined;\n }\n current = current[component];\n }\n return current;\n }\n const path = settingPath.split('.');\n const result = accessSetting(config, path);\n return typeof result === 'undefined' ? defaultValue : result;\n}\nexport function merge(base, add, overwrite) {\n Object.keys(add).forEach(key => {\n if (key !== '__proto__') {\n if (key in base) {\n if (types.isObject(base[key]) && types.isObject(add[key])) {\n merge(base[key], add[key], overwrite);\n }\n else if (overwrite) {\n base[key] = add[key];\n }\n }\n else {\n base[key] = add[key];\n }\n }\n });\n}\nexport function getLanguageTagSettingPlainKey(settingKey) {\n return settingKey.replace(/[\\[\\]]/g, '');\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ILanguageService = createDecorator('languageService');\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 *--------------------------------------------------------------------------------------------*/\nexport class SyncDescriptor {\n constructor(ctor, staticArguments = [], supportsDelayedInstantiation = false) {\n this.ctor = ctor;\n this.staticArguments = staticArguments;\n this.supportsDelayedInstantiation = supportsDelayedInstantiation;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { SyncDescriptor } from './descriptors.js';\nconst _registry = [];\nexport function registerSingleton(id, ctorOrDescriptor, supportsDelayedInstantiation) {\n if (!(ctorOrDescriptor instanceof SyncDescriptor)) {\n ctorOrDescriptor = new SyncDescriptor(ctorOrDescriptor, [], Boolean(supportsDelayedInstantiation));\n }\n _registry.push([id, ctorOrDescriptor]);\n}\nexport function getSingletonServiceDescriptors() {\n return _registry;\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 *--------------------------------------------------------------------------------------------*/\nimport { extname } from './path.js';\nexport const Mimes = Object.freeze({\n text: 'text/plain',\n binary: 'application/octet-stream',\n unknown: 'application/unknown',\n markdown: 'text/markdown',\n latex: 'text/latex',\n uriList: 'text/uri-list',\n});\nconst mapExtToTextMimes = {\n '.css': 'text/css',\n '.csv': 'text/csv',\n '.htm': 'text/html',\n '.html': 'text/html',\n '.ics': 'text/calendar',\n '.js': 'text/javascript',\n '.mjs': 'text/javascript',\n '.txt': 'text/plain',\n '.xml': 'text/xml'\n};\n// Known media mimes that we can handle\nconst mapExtToMediaMimes = {\n '.aac': 'audio/x-aac',\n '.avi': 'video/x-msvideo',\n '.bmp': 'image/bmp',\n '.flv': 'video/x-flv',\n '.gif': 'image/gif',\n '.ico': 'image/x-icon',\n '.jpe': 'image/jpg',\n '.jpeg': 'image/jpg',\n '.jpg': 'image/jpg',\n '.m1v': 'video/mpeg',\n '.m2a': 'audio/mpeg',\n '.m2v': 'video/mpeg',\n '.m3a': 'audio/mpeg',\n '.mid': 'audio/midi',\n '.midi': 'audio/midi',\n '.mk3d': 'video/x-matroska',\n '.mks': 'video/x-matroska',\n '.mkv': 'video/x-matroska',\n '.mov': 'video/quicktime',\n '.movie': 'video/x-sgi-movie',\n '.mp2': 'audio/mpeg',\n '.mp2a': 'audio/mpeg',\n '.mp3': 'audio/mpeg',\n '.mp4': 'video/mp4',\n '.mp4a': 'audio/mp4',\n '.mp4v': 'video/mp4',\n '.mpe': 'video/mpeg',\n '.mpeg': 'video/mpeg',\n '.mpg': 'video/mpeg',\n '.mpg4': 'video/mp4',\n '.mpga': 'audio/mpeg',\n '.oga': 'audio/ogg',\n '.ogg': 'audio/ogg',\n '.opus': 'audio/opus',\n '.ogv': 'video/ogg',\n '.png': 'image/png',\n '.psd': 'image/vnd.adobe.photoshop',\n '.qt': 'video/quicktime',\n '.spx': 'audio/ogg',\n '.svg': 'image/svg+xml',\n '.tga': 'image/x-tga',\n '.tif': 'image/tiff',\n '.tiff': 'image/tiff',\n '.wav': 'audio/x-wav',\n '.webm': 'video/webm',\n '.webp': 'image/webp',\n '.wma': 'audio/x-ms-wma',\n '.wmv': 'video/x-ms-wmv',\n '.woff': 'application/font-woff',\n};\nexport function getMediaOrTextMime(path) {\n const ext = extname(path);\n const textMime = mapExtToTextMimes[ext.toLowerCase()];\n if (textMime !== undefined) {\n return textMime;\n }\n else {\n return getMediaMime(path);\n }\n}\nexport function getMediaMime(path) {\n const ext = extname(path);\n return mapExtToMediaMimes[ext.toLowerCase()];\n}\nexport function getExtensionForMimeType(mimeType) {\n for (const extension in mapExtToMediaMimes) {\n if (mapExtToMediaMimes[extension] === mimeType) {\n return extension;\n }\n }\n return undefined;\n}\nconst _simplePattern = /^(.+)\\/(.+?)(;.+)?$/;\nexport function normalizeMimeType(mimeType, strict) {\n const match = _simplePattern.exec(mimeType);\n if (!match) {\n return strict\n ? undefined\n : mimeType;\n }\n // https://datatracker.ietf.org/doc/html/rfc2045#section-5.1\n // media and subtype must ALWAYS be lowercase, parameter not\n return `${match[1].toLowerCase()}/${match[2].toLowerCase()}${match[3] ?? ''}`;\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../base/common/event.js';\nimport * as platform from '../../registry/common/platform.js';\nexport const Extensions = {\n JSONContribution: 'base.contributions.json'\n};\nfunction normalizeId(id) {\n if (id.length > 0 && id.charAt(id.length - 1) === '#') {\n return id.substring(0, id.length - 1);\n }\n return id;\n}\nclass JSONContributionRegistry {\n constructor() {\n this._onDidChangeSchema = new Emitter();\n this.onDidChangeSchema = this._onDidChangeSchema.event;\n this.schemasById = {};\n }\n registerSchema(uri, unresolvedSchemaContent) {\n this.schemasById[normalizeId(uri)] = unresolvedSchemaContent;\n this._onDidChangeSchema.fire(uri);\n }\n notifySchemaChanged(uri) {\n this._onDidChangeSchema.fire(uri);\n }\n getSchemaContributions() {\n return {\n schemas: this.schemasById,\n };\n }\n}\nconst jsonContributionRegistry = new JSONContributionRegistry();\nplatform.Registry.add(Extensions.JSONContribution, jsonContributionRegistry);\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 *--------------------------------------------------------------------------------------------*/\nimport { distinct } from '../../../base/common/arrays.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport * as types from '../../../base/common/types.js';\nimport * as nls from '../../../nls.js';\nimport { getLanguageTagSettingPlainKey } from './configuration.js';\nimport { Extensions as JSONExtensions } from '../../jsonschemas/common/jsonContributionRegistry.js';\nimport { Registry } from '../../registry/common/platform.js';\nexport var EditPresentationTypes;\n(function (EditPresentationTypes) {\n EditPresentationTypes[\"Multiline\"] = \"multilineText\";\n EditPresentationTypes[\"Singleline\"] = \"singlelineText\";\n})(EditPresentationTypes || (EditPresentationTypes = {}));\nexport const Extensions = {\n Configuration: 'base.contributions.configuration'\n};\nexport const allSettings = { properties: {}, patternProperties: {} };\nexport const applicationSettings = { properties: {}, patternProperties: {} };\nexport const machineSettings = { properties: {}, patternProperties: {} };\nexport const machineOverridableSettings = { properties: {}, patternProperties: {} };\nexport const windowSettings = { properties: {}, patternProperties: {} };\nexport const resourceSettings = { properties: {}, patternProperties: {} };\nexport const resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';\nexport const configurationDefaultsSchemaId = 'vscode://schemas/settings/configurationDefaults';\nconst contributionRegistry = Registry.as(JSONExtensions.JSONContribution);\nclass ConfigurationRegistry {\n constructor() {\n this.overrideIdentifiers = new Set();\n this._onDidSchemaChange = new Emitter();\n this.onDidSchemaChange = this._onDidSchemaChange.event;\n this._onDidUpdateConfiguration = new Emitter();\n this.onDidUpdateConfiguration = this._onDidUpdateConfiguration.event;\n this.configurationDefaultsOverrides = new Map();\n this.defaultLanguageConfigurationOverridesNode = {\n id: 'defaultOverrides',\n title: nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'defaultLanguageConfigurationOverrides.title', \"Default Language Configuration Overrides\"),\n properties: {}\n };\n this.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];\n this.resourceLanguageSettingsSchema = {\n properties: {},\n patternProperties: {},\n additionalProperties: true,\n allowTrailingCommas: true,\n allowComments: true\n };\n this.configurationProperties = {};\n this.policyConfigurations = new Map();\n this.excludedConfigurationProperties = {};\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n this.registerOverridePropertyPatternKey();\n }\n registerConfiguration(configuration, validate = true) {\n this.registerConfigurations([configuration], validate);\n }\n registerConfigurations(configurations, validate = true) {\n const properties = new Set();\n this.doRegisterConfigurations(configurations, validate, properties);\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties });\n }\n deregisterConfigurations(configurations) {\n const properties = new Set();\n this.doDeregisterConfigurations(configurations, properties);\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties });\n }\n updateConfigurations({ add, remove }) {\n const properties = new Set();\n this.doDeregisterConfigurations(remove, properties);\n this.doRegisterConfigurations(add, false, properties);\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties });\n }\n registerDefaultConfigurations(configurationDefaults) {\n const properties = new Set();\n this.doRegisterDefaultConfigurations(configurationDefaults, properties);\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });\n }\n doRegisterDefaultConfigurations(configurationDefaults, bucket) {\n const overrideIdentifiers = [];\n for (const { overrides, source } of configurationDefaults) {\n for (const key in overrides) {\n bucket.add(key);\n if (OVERRIDE_PROPERTY_REGEX.test(key)) {\n const configurationDefaultOverride = this.configurationDefaultsOverrides.get(key);\n const valuesSources = configurationDefaultOverride?.valuesSources ?? new Map();\n if (source) {\n for (const configuration of Object.keys(overrides[key])) {\n valuesSources.set(configuration, source);\n }\n }\n const defaultValue = { ...(configurationDefaultOverride?.value || {}), ...overrides[key] };\n this.configurationDefaultsOverrides.set(key, { source, value: defaultValue, valuesSources });\n const plainKey = getLanguageTagSettingPlainKey(key);\n const property = {\n type: 'object',\n default: defaultValue,\n description: nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'defaultLanguageConfiguration.description', \"Configure settings to be overridden for the {0} language.\", plainKey),\n $ref: resourceLanguageSettingsSchemaId,\n defaultDefaultValue: defaultValue,\n source: types.isString(source) ? undefined : source,\n defaultValueSource: source\n };\n overrideIdentifiers.push(...overrideIdentifiersFromKey(key));\n this.configurationProperties[key] = property;\n this.defaultLanguageConfigurationOverridesNode.properties[key] = property;\n }\n else {\n this.configurationDefaultsOverrides.set(key, { value: overrides[key], source });\n const property = this.configurationProperties[key];\n if (property) {\n this.updatePropertyDefaultValue(key, property);\n this.updateSchema(key, property);\n }\n }\n }\n }\n this.doRegisterOverrideIdentifiers(overrideIdentifiers);\n }\n deregisterDefaultConfigurations(defaultConfigurations) {\n const properties = new Set();\n this.doDeregisterDefaultConfigurations(defaultConfigurations, properties);\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });\n }\n doDeregisterDefaultConfigurations(defaultConfigurations, bucket) {\n for (const { overrides, source } of defaultConfigurations) {\n for (const key in overrides) {\n const configurationDefaultsOverride = this.configurationDefaultsOverrides.get(key);\n const id = types.isString(source) ? source : source?.id;\n const configurationDefaultsOverrideSourceId = types.isString(configurationDefaultsOverride?.source) ? configurationDefaultsOverride?.source : configurationDefaultsOverride?.source?.id;\n if (id !== configurationDefaultsOverrideSourceId) {\n continue;\n }\n bucket.add(key);\n this.configurationDefaultsOverrides.delete(key);\n if (OVERRIDE_PROPERTY_REGEX.test(key)) {\n delete this.configurationProperties[key];\n delete this.defaultLanguageConfigurationOverridesNode.properties[key];\n }\n else {\n const property = this.configurationProperties[key];\n if (property) {\n this.updatePropertyDefaultValue(key, property);\n this.updateSchema(key, property);\n }\n }\n }\n }\n this.updateOverridePropertyPatternKey();\n }\n deltaConfiguration(delta) {\n // defaults: remove\n let defaultsOverrides = false;\n const properties = new Set();\n if (delta.removedDefaults) {\n this.doDeregisterDefaultConfigurations(delta.removedDefaults, properties);\n defaultsOverrides = true;\n }\n // defaults: add\n if (delta.addedDefaults) {\n this.doRegisterDefaultConfigurations(delta.addedDefaults, properties);\n defaultsOverrides = true;\n }\n // configurations: remove\n if (delta.removedConfigurations) {\n this.doDeregisterConfigurations(delta.removedConfigurations, properties);\n }\n // configurations: add\n if (delta.addedConfigurations) {\n this.doRegisterConfigurations(delta.addedConfigurations, false, properties);\n }\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides });\n }\n notifyConfigurationSchemaUpdated(...configurations) {\n this._onDidSchemaChange.fire();\n }\n registerOverrideIdentifiers(overrideIdentifiers) {\n this.doRegisterOverrideIdentifiers(overrideIdentifiers);\n this._onDidSchemaChange.fire();\n }\n doRegisterOverrideIdentifiers(overrideIdentifiers) {\n for (const overrideIdentifier of overrideIdentifiers) {\n this.overrideIdentifiers.add(overrideIdentifier);\n }\n this.updateOverridePropertyPatternKey();\n }\n doRegisterConfigurations(configurations, validate, bucket) {\n configurations.forEach(configuration => {\n this.validateAndRegisterProperties(configuration, validate, configuration.extensionInfo, configuration.restrictedProperties, undefined, bucket);\n this.configurationContributors.push(configuration);\n this.registerJSONConfiguration(configuration);\n });\n }\n doDeregisterConfigurations(configurations, bucket) {\n const deregisterConfiguration = (configuration) => {\n if (configuration.properties) {\n for (const key in configuration.properties) {\n bucket.add(key);\n const property = this.configurationProperties[key];\n if (property?.policy?.name) {\n this.policyConfigurations.delete(property.policy.name);\n }\n delete this.configurationProperties[key];\n this.removeFromSchema(key, configuration.properties[key]);\n }\n }\n configuration.allOf?.forEach(node => deregisterConfiguration(node));\n };\n for (const configuration of configurations) {\n deregisterConfiguration(configuration);\n const index = this.configurationContributors.indexOf(configuration);\n if (index !== -1) {\n this.configurationContributors.splice(index, 1);\n }\n }\n }\n validateAndRegisterProperties(configuration, validate = true, extensionInfo, restrictedProperties, scope = 3 /* ConfigurationScope.WINDOW */, bucket) {\n scope = types.isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;\n const properties = configuration.properties;\n if (properties) {\n for (const key in properties) {\n const property = properties[key];\n if (validate && validateProperty(key, property)) {\n delete properties[key];\n continue;\n }\n property.source = extensionInfo;\n // update default value\n property.defaultDefaultValue = properties[key].default;\n this.updatePropertyDefaultValue(key, property);\n // update scope\n if (OVERRIDE_PROPERTY_REGEX.test(key)) {\n property.scope = undefined; // No scope for overridable properties `[${identifier}]`\n }\n else {\n property.scope = types.isUndefinedOrNull(property.scope) ? scope : property.scope;\n property.restricted = types.isUndefinedOrNull(property.restricted) ? !!restrictedProperties?.includes(key) : property.restricted;\n }\n // Add to properties maps\n // Property is included by default if 'included' is unspecified\n if (properties[key].hasOwnProperty('included') && !properties[key].included) {\n this.excludedConfigurationProperties[key] = properties[key];\n delete properties[key];\n continue;\n }\n else {\n this.configurationProperties[key] = properties[key];\n if (properties[key].policy?.name) {\n this.policyConfigurations.set(properties[key].policy.name, key);\n }\n }\n if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {\n // If not set, default deprecationMessage to the markdown source\n properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;\n }\n bucket.add(key);\n }\n }\n const subNodes = configuration.allOf;\n if (subNodes) {\n for (const node of subNodes) {\n this.validateAndRegisterProperties(node, validate, extensionInfo, restrictedProperties, scope, bucket);\n }\n }\n }\n // TODO: @sandy081 - Remove this method and include required info in getConfigurationProperties\n getConfigurations() {\n return this.configurationContributors;\n }\n getConfigurationProperties() {\n return this.configurationProperties;\n }\n getPolicyConfigurations() {\n return this.policyConfigurations;\n }\n getExcludedConfigurationProperties() {\n return this.excludedConfigurationProperties;\n }\n getConfigurationDefaultsOverrides() {\n return this.configurationDefaultsOverrides;\n }\n registerJSONConfiguration(configuration) {\n const register = (configuration) => {\n const properties = configuration.properties;\n if (properties) {\n for (const key in properties) {\n this.updateSchema(key, properties[key]);\n }\n }\n const subNodes = configuration.allOf;\n subNodes?.forEach(register);\n };\n register(configuration);\n }\n updateSchema(key, property) {\n allSettings.properties[key] = property;\n switch (property.scope) {\n case 1 /* ConfigurationScope.APPLICATION */:\n applicationSettings.properties[key] = property;\n break;\n case 2 /* ConfigurationScope.MACHINE */:\n machineSettings.properties[key] = property;\n break;\n case 6 /* ConfigurationScope.MACHINE_OVERRIDABLE */:\n machineOverridableSettings.properties[key] = property;\n break;\n case 3 /* ConfigurationScope.WINDOW */:\n windowSettings.properties[key] = property;\n break;\n case 4 /* ConfigurationScope.RESOURCE */:\n resourceSettings.properties[key] = property;\n break;\n case 5 /* ConfigurationScope.LANGUAGE_OVERRIDABLE */:\n resourceSettings.properties[key] = property;\n this.resourceLanguageSettingsSchema.properties[key] = property;\n break;\n }\n }\n removeFromSchema(key, property) {\n delete allSettings.properties[key];\n switch (property.scope) {\n case 1 /* ConfigurationScope.APPLICATION */:\n delete applicationSettings.properties[key];\n break;\n case 2 /* ConfigurationScope.MACHINE */:\n delete machineSettings.properties[key];\n break;\n case 6 /* ConfigurationScope.MACHINE_OVERRIDABLE */:\n delete machineOverridableSettings.properties[key];\n break;\n case 3 /* ConfigurationScope.WINDOW */:\n delete windowSettings.properties[key];\n break;\n case 4 /* ConfigurationScope.RESOURCE */:\n case 5 /* ConfigurationScope.LANGUAGE_OVERRIDABLE */:\n delete resourceSettings.properties[key];\n delete this.resourceLanguageSettingsSchema.properties[key];\n break;\n }\n }\n updateOverridePropertyPatternKey() {\n for (const overrideIdentifier of this.overrideIdentifiers.values()) {\n const overrideIdentifierProperty = `[${overrideIdentifier}]`;\n const resourceLanguagePropertiesSchema = {\n type: 'object',\n description: nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'overrideSettings.defaultDescription', \"Configure editor settings to be overridden for a language.\"),\n errorMessage: nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'overrideSettings.errorMessage', \"This setting does not support per-language configuration.\"),\n $ref: resourceLanguageSettingsSchemaId,\n };\n this.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);\n allSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n applicationSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n machineSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n machineOverridableSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n windowSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n resourceSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n }\n }\n registerOverridePropertyPatternKey() {\n const resourceLanguagePropertiesSchema = {\n type: 'object',\n description: nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'overrideSettings.defaultDescription', \"Configure editor settings to be overridden for a language.\"),\n errorMessage: nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'overrideSettings.errorMessage', \"This setting does not support per-language configuration.\"),\n $ref: resourceLanguageSettingsSchemaId,\n };\n allSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n applicationSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n machineSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n machineOverridableSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n windowSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n resourceSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n this._onDidSchemaChange.fire();\n }\n updatePropertyDefaultValue(key, property) {\n const configurationdefaultOverride = this.configurationDefaultsOverrides.get(key);\n let defaultValue = configurationdefaultOverride?.value;\n let defaultSource = configurationdefaultOverride?.source;\n if (types.isUndefined(defaultValue)) {\n defaultValue = property.defaultDefaultValue;\n defaultSource = undefined;\n }\n if (types.isUndefined(defaultValue)) {\n defaultValue = getDefaultValue(property.type);\n }\n property.default = defaultValue;\n property.defaultValueSource = defaultSource;\n }\n}\nconst OVERRIDE_IDENTIFIER_PATTERN = `\\\\[([^\\\\]]+)\\\\]`;\nconst OVERRIDE_IDENTIFIER_REGEX = new RegExp(OVERRIDE_IDENTIFIER_PATTERN, 'g');\nexport const OVERRIDE_PROPERTY_PATTERN = `^(${OVERRIDE_IDENTIFIER_PATTERN})+$`;\nexport const OVERRIDE_PROPERTY_REGEX = new RegExp(OVERRIDE_PROPERTY_PATTERN);\nexport function overrideIdentifiersFromKey(key) {\n const identifiers = [];\n if (OVERRIDE_PROPERTY_REGEX.test(key)) {\n let matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);\n while (matches?.length) {\n const identifier = matches[1].trim();\n if (identifier) {\n identifiers.push(identifier);\n }\n matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);\n }\n }\n return distinct(identifiers);\n}\nexport function keyFromOverrideIdentifiers(overrideIdentifiers) {\n return overrideIdentifiers.reduce((result, overrideIdentifier) => `${result}[${overrideIdentifier}]`, '');\n}\nexport function getDefaultValue(type) {\n const t = Array.isArray(type) ? type[0] : type;\n switch (t) {\n case 'boolean':\n return false;\n case 'integer':\n case 'number':\n return 0;\n case 'string':\n return '';\n case 'array':\n return [];\n case 'object':\n return {};\n default:\n return null;\n }\n}\nconst configurationRegistry = new ConfigurationRegistry();\nRegistry.add(Extensions.Configuration, configurationRegistry);\nexport function validateProperty(property, schema) {\n if (!property.trim()) {\n return nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'config.property.empty', \"Cannot register an empty property\");\n }\n if (OVERRIDE_PROPERTY_REGEX.test(property)) {\n return nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'config.property.languageDefault', \"Cannot register '{0}'. This matches property pattern '\\\\\\\\[.*\\\\\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.\", property);\n }\n if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {\n return nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'config.property.duplicate', \"Cannot register '{0}'. This property is already registered.\", property);\n }\n if (schema.policy?.name && configurationRegistry.getPolicyConfigurations().get(schema.policy?.name) !== undefined) {\n return nls.localizeWithPath('vs/platform/configuration/common/configurationRegistry', 'config.policy.duplicate', \"Cannot register '{0}'. The associated policy {1} is already registered with {2}.\", property, schema.policy?.name, configurationRegistry.getPolicyConfigurations().get(schema.policy?.name));\n }\n return null;\n}\nexport function getScopes() {\n const scopes = [];\n const configurationProperties = configurationRegistry.getConfigurationProperties();\n for (const key of Object.keys(configurationProperties)) {\n scopes.push([key, configurationProperties[key].scope]);\n }\n scopes.push(['launch', 4 /* ConfigurationScope.RESOURCE */]);\n scopes.push(['task', 4 /* ConfigurationScope.RESOURCE */]);\n return scopes;\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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../../nls.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Registry } from '../../../platform/registry/common/platform.js';\nimport { Mimes } from '../../../base/common/mime.js';\nimport { Extensions as ConfigurationExtensions } from '../../../platform/configuration/common/configurationRegistry.js';\n// Define extension point ids\nexport const Extensions = {\n ModesRegistry: 'editor.modesRegistry'\n};\nexport class EditorModesRegistry {\n constructor() {\n this._onDidChangeLanguages = new Emitter();\n this.onDidChangeLanguages = this._onDidChangeLanguages.event;\n this._languages = [];\n }\n registerLanguage(def) {\n this._languages.push(def);\n this._onDidChangeLanguages.fire(undefined);\n return {\n dispose: () => {\n for (let i = 0, len = this._languages.length; i < len; i++) {\n if (this._languages[i] === def) {\n this._languages.splice(i, 1);\n return;\n }\n }\n }\n };\n }\n getLanguages() {\n return this._languages;\n }\n}\nexport const ModesRegistry = new EditorModesRegistry();\nRegistry.add(Extensions.ModesRegistry, ModesRegistry);\nexport const PLAINTEXT_LANGUAGE_ID = 'plaintext';\nexport const PLAINTEXT_EXTENSION = '.txt';\nModesRegistry.registerLanguage({\n id: PLAINTEXT_LANGUAGE_ID,\n extensions: [PLAINTEXT_EXTENSION],\n aliases: [nls.localizeWithPath('vs/editor/common/languages/modesRegistry', 'plainText.alias', \"Plain Text\"), 'text'],\n mimetypes: [Mimes.text]\n});\nRegistry.as(ConfigurationExtensions.Configuration)\n .registerDefaultConfigurations([{\n overrides: {\n '[plaintext]': {\n 'editor.unicodeHighlight.ambiguousCharacters': false,\n 'editor.unicodeHighlight.invisibleCharacters': false\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { CachedFunction } from '../../../../base/common/cache.js';\n/**\n * Captures all bracket related configurations for a single language.\n * Immutable.\n*/\nexport class LanguageBracketsConfiguration {\n constructor(languageId, config) {\n this.languageId = languageId;\n const bracketPairs = config.brackets ? filterValidBrackets(config.brackets) : [];\n const openingBracketInfos = new CachedFunction((bracket) => {\n const closing = new Set();\n return {\n info: new OpeningBracketKind(this, bracket, closing),\n closing,\n };\n });\n const closingBracketInfos = new CachedFunction((bracket) => {\n const opening = new Set();\n const openingColorized = new Set();\n return {\n info: new ClosingBracketKind(this, bracket, opening, openingColorized),\n opening,\n openingColorized,\n };\n });\n for (const [open, close] of bracketPairs) {\n const opening = openingBracketInfos.get(open);\n const closing = closingBracketInfos.get(close);\n opening.closing.add(closing.info);\n closing.opening.add(opening.info);\n }\n // Treat colorized brackets as brackets, and mark them as colorized.\n const colorizedBracketPairs = config.colorizedBracketPairs\n ? filterValidBrackets(config.colorizedBracketPairs)\n // If not configured: Take all brackets except `<` ... `>`\n // Many languages set < ... > as bracket pair, even though they also use it as comparison operator.\n // This leads to problems when colorizing this bracket, so we exclude it if not explicitly configured otherwise.\n // https://github.com/microsoft/vscode/issues/132476\n : bracketPairs.filter((p) => !(p[0] === '<' && p[1] === '>'));\n for (const [open, close] of colorizedBracketPairs) {\n const opening = openingBracketInfos.get(open);\n const closing = closingBracketInfos.get(close);\n opening.closing.add(closing.info);\n closing.openingColorized.add(opening.info);\n closing.opening.add(opening.info);\n }\n this._openingBrackets = new Map([...openingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));\n this._closingBrackets = new Map([...closingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));\n }\n /**\n * No two brackets have the same bracket text.\n */\n get openingBrackets() {\n return [...this._openingBrackets.values()];\n }\n /**\n * No two brackets have the same bracket text.\n */\n get closingBrackets() {\n return [...this._closingBrackets.values()];\n }\n getOpeningBracketInfo(bracketText) {\n return this._openingBrackets.get(bracketText);\n }\n getClosingBracketInfo(bracketText) {\n return this._closingBrackets.get(bracketText);\n }\n getBracketInfo(bracketText) {\n return this.getOpeningBracketInfo(bracketText) || this.getClosingBracketInfo(bracketText);\n }\n}\nfunction filterValidBrackets(bracketPairs) {\n return bracketPairs.filter(([open, close]) => open !== '' && close !== '');\n}\nexport class BracketKindBase {\n constructor(config, bracketText) {\n this.config = config;\n this.bracketText = bracketText;\n }\n get languageId() {\n return this.config.languageId;\n }\n}\nexport class OpeningBracketKind extends BracketKindBase {\n constructor(config, bracketText, openedBrackets) {\n super(config, bracketText);\n this.openedBrackets = openedBrackets;\n this.isOpeningBracket = true;\n }\n}\nexport class ClosingBracketKind extends BracketKindBase {\n constructor(config, bracketText, \n /**\n * Non empty array of all opening brackets this bracket closes.\n */\n openingBrackets, openingColorizedBrackets) {\n super(config, bracketText);\n this.openingBrackets = openingBrackets;\n this.openingColorizedBrackets = openingColorizedBrackets;\n this.isOpeningBracket = false;\n }\n /**\n * Checks if this bracket closes the given other bracket.\n * If the bracket infos come from different configurations, this method will return false.\n */\n closes(other) {\n if (other['config'] !== this.config) {\n return false;\n }\n return this.openingBrackets.has(other);\n }\n closesColorized(other) {\n if (other['config'] !== this.config) {\n return false;\n }\n return this.openingColorizedBrackets.has(other);\n }\n getOpeningBrackets() {\n return [...this.openingBrackets];\n }\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { DEFAULT_WORD_REGEXP, ensureValidWordDefinition } from '../core/wordHelper.js';\nimport { AutoClosingPairs } from './languageConfiguration.js';\nimport { createScopedLineTokens } from './supports.js';\nimport { CharacterPairSupport } from './supports/characterPair.js';\nimport { BracketElectricCharacterSupport } from './supports/electricCharacter.js';\nimport { IndentRulesSupport } from './supports/indentRules.js';\nimport { OnEnterSupport } from './supports/onEnter.js';\nimport { RichEditBrackets } from './supports/richEditBrackets.js';\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nimport { IConfigurationService } from '../../../platform/configuration/common/configuration.js';\nimport { ILanguageService } from './language.js';\nimport { registerSingleton } from '../../../platform/instantiation/common/extensions.js';\nimport { PLAINTEXT_LANGUAGE_ID } from './modesRegistry.js';\nimport { LanguageBracketsConfiguration } from './supports/languageBracketsConfiguration.js';\nexport class LanguageConfigurationServiceChangeEvent {\n constructor(languageId) {\n this.languageId = languageId;\n }\n affects(languageId) {\n return !this.languageId ? true : this.languageId === languageId;\n }\n}\nexport const ILanguageConfigurationService = createDecorator('languageConfigurationService');\nlet LanguageConfigurationService = class LanguageConfigurationService extends Disposable {\n constructor(configurationService, languageService) {\n super();\n this.configurationService = configurationService;\n this.languageService = languageService;\n this._registry = this._register(new LanguageConfigurationRegistry());\n this.onDidChangeEmitter = this._register(new Emitter());\n this.onDidChange = this.onDidChangeEmitter.event;\n this.configurations = new Map();\n const languageConfigKeys = new Set(Object.values(customizedLanguageConfigKeys));\n this._register(this.configurationService.onDidChangeConfiguration((e) => {\n const globalConfigChanged = e.change.keys.some((k) => languageConfigKeys.has(k));\n const localConfigChanged = e.change.overrides\n .filter(([overrideLangName, keys]) => keys.some((k) => languageConfigKeys.has(k)))\n .map(([overrideLangName]) => overrideLangName);\n if (globalConfigChanged) {\n this.configurations.clear();\n this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(undefined));\n }\n else {\n for (const languageId of localConfigChanged) {\n if (this.languageService.isRegisteredLanguageId(languageId)) {\n this.configurations.delete(languageId);\n this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(languageId));\n }\n }\n }\n }));\n this._register(this._registry.onDidChange((e) => {\n this.configurations.delete(e.languageId);\n this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(e.languageId));\n }));\n }\n register(languageId, configuration, priority) {\n return this._registry.register(languageId, configuration, priority);\n }\n getLanguageConfiguration(languageId) {\n let result = this.configurations.get(languageId);\n if (!result) {\n result = computeConfig(languageId, this._registry, this.configurationService, this.languageService);\n this.configurations.set(languageId, result);\n }\n return result;\n }\n};\nLanguageConfigurationService = __decorate([\n __param(0, IConfigurationService),\n __param(1, ILanguageService)\n], LanguageConfigurationService);\nexport { LanguageConfigurationService };\nfunction computeConfig(languageId, registry, configurationService, languageService) {\n let languageConfig = registry.getLanguageConfiguration(languageId);\n if (!languageConfig) {\n if (!languageService.isRegisteredLanguageId(languageId)) {\n // this happens for the null language, which can be returned by monarch.\n // Instead of throwing an error, we just return a default config.\n return new ResolvedLanguageConfiguration(languageId, {});\n }\n languageConfig = new ResolvedLanguageConfiguration(languageId, {});\n }\n const customizedConfig = getCustomizedLanguageConfig(languageConfig.languageId, configurationService);\n const data = combineLanguageConfigurations([languageConfig.underlyingConfig, customizedConfig]);\n const config = new ResolvedLanguageConfiguration(languageConfig.languageId, data);\n return config;\n}\nconst customizedLanguageConfigKeys = {\n brackets: 'editor.language.brackets',\n colorizedBracketPairs: 'editor.language.colorizedBracketPairs'\n};\nfunction getCustomizedLanguageConfig(languageId, configurationService) {\n const brackets = configurationService.getValue(customizedLanguageConfigKeys.brackets, {\n overrideIdentifier: languageId,\n });\n const colorizedBracketPairs = configurationService.getValue(customizedLanguageConfigKeys.colorizedBracketPairs, {\n overrideIdentifier: languageId,\n });\n return {\n brackets: validateBracketPairs(brackets),\n colorizedBracketPairs: validateBracketPairs(colorizedBracketPairs),\n };\n}\nfunction validateBracketPairs(data) {\n if (!Array.isArray(data)) {\n return undefined;\n }\n return data.map(pair => {\n if (!Array.isArray(pair) || pair.length !== 2) {\n return undefined;\n }\n return [pair[0], pair[1]];\n }).filter((p) => !!p);\n}\nexport function getIndentationAtPosition(model, lineNumber, column) {\n const lineText = model.getLineContent(lineNumber);\n let indentation = strings.getLeadingWhitespace(lineText);\n if (indentation.length > column - 1) {\n indentation = indentation.substring(0, column - 1);\n }\n return indentation;\n}\nexport function getScopedLineTokens(model, lineNumber, columnNumber) {\n model.tokenization.forceTokenization(lineNumber);\n const lineTokens = model.tokenization.getLineTokens(lineNumber);\n const column = (typeof columnNumber === 'undefined' ? model.getLineMaxColumn(lineNumber) - 1 : columnNumber - 1);\n return createScopedLineTokens(lineTokens, column);\n}\nclass ComposedLanguageConfiguration {\n constructor(languageId) {\n this.languageId = languageId;\n this._resolved = null;\n this._entries = [];\n this._order = 0;\n this._resolved = null;\n }\n register(configuration, priority) {\n const entry = new LanguageConfigurationContribution(configuration, priority, ++this._order);\n this._entries.push(entry);\n this._resolved = null;\n return toDisposable(() => {\n for (let i = 0; i < this._entries.length; i++) {\n if (this._entries[i] === entry) {\n this._entries.splice(i, 1);\n this._resolved = null;\n break;\n }\n }\n });\n }\n getResolvedConfiguration() {\n if (!this._resolved) {\n const config = this._resolve();\n if (config) {\n this._resolved = new ResolvedLanguageConfiguration(this.languageId, config);\n }\n }\n return this._resolved;\n }\n _resolve() {\n if (this._entries.length === 0) {\n return null;\n }\n this._entries.sort(LanguageConfigurationContribution.cmp);\n return combineLanguageConfigurations(this._entries.map(e => e.configuration));\n }\n}\nfunction combineLanguageConfigurations(configs) {\n let result = {\n comments: undefined,\n brackets: undefined,\n wordPattern: undefined,\n indentationRules: undefined,\n onEnterRules: undefined,\n autoClosingPairs: undefined,\n surroundingPairs: undefined,\n autoCloseBefore: undefined,\n folding: undefined,\n colorizedBracketPairs: undefined,\n __electricCharacterSupport: undefined,\n };\n for (const entry of configs) {\n result = {\n comments: entry.comments || result.comments,\n brackets: entry.brackets || result.brackets,\n wordPattern: entry.wordPattern || result.wordPattern,\n indentationRules: entry.indentationRules || result.indentationRules,\n onEnterRules: entry.onEnterRules || result.onEnterRules,\n autoClosingPairs: entry.autoClosingPairs || result.autoClosingPairs,\n surroundingPairs: entry.surroundingPairs || result.surroundingPairs,\n autoCloseBefore: entry.autoCloseBefore || result.autoCloseBefore,\n folding: entry.folding || result.folding,\n colorizedBracketPairs: entry.colorizedBracketPairs || result.colorizedBracketPairs,\n __electricCharacterSupport: entry.__electricCharacterSupport || result.__electricCharacterSupport,\n };\n }\n return result;\n}\nclass LanguageConfigurationContribution {\n constructor(configuration, priority, order) {\n this.configuration = configuration;\n this.priority = priority;\n this.order = order;\n }\n static cmp(a, b) {\n if (a.priority === b.priority) {\n // higher order last\n return a.order - b.order;\n }\n // higher priority last\n return a.priority - b.priority;\n }\n}\nexport class LanguageConfigurationChangeEvent {\n constructor(languageId) {\n this.languageId = languageId;\n }\n}\nexport class LanguageConfigurationRegistry extends Disposable {\n constructor() {\n super();\n this._entries = new Map();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._register(this.register(PLAINTEXT_LANGUAGE_ID, {\n brackets: [\n ['(', ')'],\n ['[', ']'],\n ['{', '}'],\n ],\n surroundingPairs: [\n { open: '{', close: '}' },\n { open: '[', close: ']' },\n { open: '(', close: ')' },\n { open: '<', close: '>' },\n { open: '\\\"', close: '\\\"' },\n { open: '\\'', close: '\\'' },\n { open: '`', close: '`' },\n ],\n colorizedBracketPairs: [],\n folding: {\n offSide: true\n }\n }, 0));\n }\n /**\n * @param priority Use a higher number for higher priority\n */\n register(languageId, configuration, priority = 0) {\n let entries = this._entries.get(languageId);\n if (!entries) {\n entries = new ComposedLanguageConfiguration(languageId);\n this._entries.set(languageId, entries);\n }\n const disposable = entries.register(configuration, priority);\n this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));\n return toDisposable(() => {\n disposable.dispose();\n this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));\n });\n }\n getLanguageConfiguration(languageId) {\n const entries = this._entries.get(languageId);\n return entries?.getResolvedConfiguration() || null;\n }\n}\n/**\n * Immutable.\n*/\nexport class ResolvedLanguageConfiguration {\n constructor(languageId, underlyingConfig) {\n this.languageId = languageId;\n this.underlyingConfig = underlyingConfig;\n this._brackets = null;\n this._electricCharacter = null;\n this._onEnterSupport =\n this.underlyingConfig.brackets ||\n this.underlyingConfig.indentationRules ||\n this.underlyingConfig.onEnterRules\n ? new OnEnterSupport(this.underlyingConfig)\n : null;\n this.comments = ResolvedLanguageConfiguration._handleComments(this.underlyingConfig);\n this.characterPair = new CharacterPairSupport(this.underlyingConfig);\n this.wordDefinition = this.underlyingConfig.wordPattern || DEFAULT_WORD_REGEXP;\n this.indentationRules = this.underlyingConfig.indentationRules;\n if (this.underlyingConfig.indentationRules) {\n this.indentRulesSupport = new IndentRulesSupport(this.underlyingConfig.indentationRules);\n }\n else {\n this.indentRulesSupport = null;\n }\n this.foldingRules = this.underlyingConfig.folding || {};\n this.bracketsNew = new LanguageBracketsConfiguration(languageId, this.underlyingConfig);\n }\n getWordDefinition() {\n return ensureValidWordDefinition(this.wordDefinition);\n }\n get brackets() {\n if (!this._brackets && this.underlyingConfig.brackets) {\n this._brackets = new RichEditBrackets(this.languageId, this.underlyingConfig.brackets);\n }\n return this._brackets;\n }\n get electricCharacter() {\n if (!this._electricCharacter) {\n this._electricCharacter = new BracketElectricCharacterSupport(this.brackets);\n }\n return this._electricCharacter;\n }\n onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {\n if (!this._onEnterSupport) {\n return null;\n }\n return this._onEnterSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);\n }\n getAutoClosingPairs() {\n return new AutoClosingPairs(this.characterPair.getAutoClosingPairs());\n }\n getAutoCloseBeforeSet(forQuotes) {\n return this.characterPair.getAutoCloseBeforeSet(forQuotes);\n }\n getSurroundingPairs() {\n return this.characterPair.getSurroundingPairs();\n }\n static _handleComments(conf) {\n const commentRule = conf.comments;\n if (!commentRule) {\n return null;\n }\n // comment configuration\n const comments = {};\n if (commentRule.lineComment) {\n comments.lineCommentToken = commentRule.lineComment;\n }\n if (commentRule.blockComment) {\n const [blockStart, blockEnd] = commentRule.blockComment;\n comments.blockCommentStartToken = blockStart;\n comments.blockCommentEndToken = blockEnd;\n }\n return comments;\n }\n}\nregisterSingleton(ILanguageConfigurationService, LanguageConfigurationService, 1 /* InstantiationType.Delayed */);\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 *--------------------------------------------------------------------------------------------*/\nimport { IndentAction } from './languageConfiguration.js';\nimport { getIndentationAtPosition, getScopedLineTokens } from './languageConfigurationRegistry.js';\nexport function getEnterAction(autoIndent, model, range, languageConfigurationService) {\n const scopedLineTokens = getScopedLineTokens(model, range.startLineNumber, range.startColumn);\n const richEditSupport = languageConfigurationService.getLanguageConfiguration(scopedLineTokens.languageId);\n if (!richEditSupport) {\n return null;\n }\n const scopedLineText = scopedLineTokens.getLineContent();\n const beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);\n // selection support\n let afterEnterText;\n if (range.isEmpty()) {\n afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);\n }\n else {\n const endScopedLineTokens = getScopedLineTokens(model, range.endLineNumber, range.endColumn);\n afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);\n }\n let previousLineText = '';\n if (range.startLineNumber > 1 && scopedLineTokens.firstCharOffset === 0) {\n // This is not the first line and the entire line belongs to this mode\n const oneLineAboveScopedLineTokens = getScopedLineTokens(model, range.startLineNumber - 1);\n if (oneLineAboveScopedLineTokens.languageId === scopedLineTokens.languageId) {\n // The line above ends with text belonging to the same mode\n previousLineText = oneLineAboveScopedLineTokens.getLineContent();\n }\n }\n const enterResult = richEditSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);\n if (!enterResult) {\n return null;\n }\n const indentAction = enterResult.indentAction;\n let appendText = enterResult.appendText;\n const removeText = enterResult.removeText || 0;\n // Here we add `\\t` to appendText first because enterAction is leveraging appendText and removeText to change indentation.\n if (!appendText) {\n if ((indentAction === IndentAction.Indent) ||\n (indentAction === IndentAction.IndentOutdent)) {\n appendText = '\\t';\n }\n else {\n appendText = '';\n }\n }\n else if (indentAction === IndentAction.Indent) {\n appendText = '\\t' + appendText;\n }\n let indentation = getIndentationAtPosition(model, range.startLineNumber, range.startColumn);\n if (removeText) {\n indentation = indentation.substring(0, indentation.length - removeText);\n }\n return {\n indentAction: indentAction,\n appendText: appendText,\n removeText: removeText,\n indentation: indentation\n };\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar ShiftCommand_1;\nimport * as strings from '../../../base/common/strings.js';\nimport { CursorColumns } from '../core/cursorColumns.js';\nimport { Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nimport { getEnterAction } from '../languages/enterAction.js';\nimport { ILanguageConfigurationService } from '../languages/languageConfigurationRegistry.js';\nconst repeatCache = Object.create(null);\nfunction cachedStringRepeat(str, count) {\n if (count <= 0) {\n return '';\n }\n if (!repeatCache[str]) {\n repeatCache[str] = ['', str];\n }\n const cache = repeatCache[str];\n for (let i = cache.length; i <= count; i++) {\n cache[i] = cache[i - 1] + str;\n }\n return cache[count];\n}\nlet ShiftCommand = ShiftCommand_1 = class ShiftCommand {\n static unshiftIndent(line, column, tabSize, indentSize, insertSpaces) {\n // Determine the visible column where the content starts\n const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);\n if (insertSpaces) {\n const indent = cachedStringRepeat(' ', indentSize);\n const desiredTabStop = CursorColumns.prevIndentTabStop(contentStartVisibleColumn, indentSize);\n const indentCount = desiredTabStop / indentSize; // will be an integer\n return cachedStringRepeat(indent, indentCount);\n }\n else {\n const indent = '\\t';\n const desiredTabStop = CursorColumns.prevRenderTabStop(contentStartVisibleColumn, tabSize);\n const indentCount = desiredTabStop / tabSize; // will be an integer\n return cachedStringRepeat(indent, indentCount);\n }\n }\n static shiftIndent(line, column, tabSize, indentSize, insertSpaces) {\n // Determine the visible column where the content starts\n const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);\n if (insertSpaces) {\n const indent = cachedStringRepeat(' ', indentSize);\n const desiredTabStop = CursorColumns.nextIndentTabStop(contentStartVisibleColumn, indentSize);\n const indentCount = desiredTabStop / indentSize; // will be an integer\n return cachedStringRepeat(indent, indentCount);\n }\n else {\n const indent = '\\t';\n const desiredTabStop = CursorColumns.nextRenderTabStop(contentStartVisibleColumn, tabSize);\n const indentCount = desiredTabStop / tabSize; // will be an integer\n return cachedStringRepeat(indent, indentCount);\n }\n }\n constructor(range, opts, _languageConfigurationService) {\n this._languageConfigurationService = _languageConfigurationService;\n this._opts = opts;\n this._selection = range;\n this._selectionId = null;\n this._useLastEditRangeForCursorEndPosition = false;\n this._selectionStartColumnStaysPut = false;\n }\n _addEditOperation(builder, range, text) {\n if (this._useLastEditRangeForCursorEndPosition) {\n builder.addTrackedEditOperation(range, text);\n }\n else {\n builder.addEditOperation(range, text);\n }\n }\n getEditOperations(model, builder) {\n const startLine = this._selection.startLineNumber;\n let endLine = this._selection.endLineNumber;\n if (this._selection.endColumn === 1 && startLine !== endLine) {\n endLine = endLine - 1;\n }\n const { tabSize, indentSize, insertSpaces } = this._opts;\n const shouldIndentEmptyLines = (startLine === endLine);\n if (this._opts.useTabStops) {\n // if indenting or outdenting on a whitespace only line\n if (this._selection.isEmpty()) {\n if (/^\\s*$/.test(model.getLineContent(startLine))) {\n this._useLastEditRangeForCursorEndPosition = true;\n }\n }\n // keep track of previous line's \"miss-alignment\"\n let previousLineExtraSpaces = 0, extraSpaces = 0;\n for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++, previousLineExtraSpaces = extraSpaces) {\n extraSpaces = 0;\n const lineText = model.getLineContent(lineNumber);\n let indentationEndIndex = strings.firstNonWhitespaceIndex(lineText);\n if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {\n // empty line or line with no leading whitespace => nothing to do\n continue;\n }\n if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {\n // do not indent empty lines => nothing to do\n continue;\n }\n if (indentationEndIndex === -1) {\n // the entire line is whitespace\n indentationEndIndex = lineText.length;\n }\n if (lineNumber > 1) {\n const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(lineText, indentationEndIndex + 1, tabSize);\n if (contentStartVisibleColumn % indentSize !== 0) {\n // The current line is \"miss-aligned\", so let's see if this is expected...\n // This can only happen when it has trailing commas in the indent\n if (model.tokenization.isCheapToTokenize(lineNumber - 1)) {\n const enterAction = getEnterAction(this._opts.autoIndent, model, new Range(lineNumber - 1, model.getLineMaxColumn(lineNumber - 1), lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)), this._languageConfigurationService);\n if (enterAction) {\n extraSpaces = previousLineExtraSpaces;\n if (enterAction.appendText) {\n for (let j = 0, lenJ = enterAction.appendText.length; j < lenJ && extraSpaces < indentSize; j++) {\n if (enterAction.appendText.charCodeAt(j) === 32 /* CharCode.Space */) {\n extraSpaces++;\n }\n else {\n break;\n }\n }\n }\n if (enterAction.removeText) {\n extraSpaces = Math.max(0, extraSpaces - enterAction.removeText);\n }\n // Act as if `prefixSpaces` is not part of the indentation\n for (let j = 0; j < extraSpaces; j++) {\n if (indentationEndIndex === 0 || lineText.charCodeAt(indentationEndIndex - 1) !== 32 /* CharCode.Space */) {\n break;\n }\n indentationEndIndex--;\n }\n }\n }\n }\n }\n if (this._opts.isUnshift && indentationEndIndex === 0) {\n // line with no leading whitespace => nothing to do\n continue;\n }\n let desiredIndent;\n if (this._opts.isUnshift) {\n desiredIndent = ShiftCommand_1.unshiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);\n }\n else {\n desiredIndent = ShiftCommand_1.shiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);\n }\n this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), desiredIndent);\n if (lineNumber === startLine && !this._selection.isEmpty()) {\n // Force the startColumn to stay put because we're inserting after it\n this._selectionStartColumnStaysPut = (this._selection.startColumn <= indentationEndIndex + 1);\n }\n }\n }\n else {\n // if indenting or outdenting on a whitespace only line\n if (!this._opts.isUnshift && this._selection.isEmpty() && model.getLineLength(startLine) === 0) {\n this._useLastEditRangeForCursorEndPosition = true;\n }\n const oneIndent = (insertSpaces ? cachedStringRepeat(' ', indentSize) : '\\t');\n for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++) {\n const lineText = model.getLineContent(lineNumber);\n let indentationEndIndex = strings.firstNonWhitespaceIndex(lineText);\n if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {\n // empty line or line with no leading whitespace => nothing to do\n continue;\n }\n if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {\n // do not indent empty lines => nothing to do\n continue;\n }\n if (indentationEndIndex === -1) {\n // the entire line is whitespace\n indentationEndIndex = lineText.length;\n }\n if (this._opts.isUnshift && indentationEndIndex === 0) {\n // line with no leading whitespace => nothing to do\n continue;\n }\n if (this._opts.isUnshift) {\n indentationEndIndex = Math.min(indentationEndIndex, indentSize);\n for (let i = 0; i < indentationEndIndex; i++) {\n const chr = lineText.charCodeAt(i);\n if (chr === 9 /* CharCode.Tab */) {\n indentationEndIndex = i + 1;\n break;\n }\n }\n this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), '');\n }\n else {\n this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, 1), oneIndent);\n if (lineNumber === startLine && !this._selection.isEmpty()) {\n // Force the startColumn to stay put because we're inserting after it\n this._selectionStartColumnStaysPut = (this._selection.startColumn === 1);\n }\n }\n }\n }\n this._selectionId = builder.trackSelection(this._selection);\n }\n computeCursorState(model, helper) {\n if (this._useLastEditRangeForCursorEndPosition) {\n const lastOp = helper.getInverseEditOperations()[0];\n return new Selection(lastOp.range.endLineNumber, lastOp.range.endColumn, lastOp.range.endLineNumber, lastOp.range.endColumn);\n }\n const result = helper.getTrackedSelection(this._selectionId);\n if (this._selectionStartColumnStaysPut) {\n // The selection start should not move\n const initialStartColumn = this._selection.startColumn;\n const resultStartColumn = result.startColumn;\n if (resultStartColumn <= initialStartColumn) {\n return result;\n }\n if (result.getDirection() === 0 /* SelectionDirection.LTR */) {\n return new Selection(result.startLineNumber, initialStartColumn, result.endLineNumber, result.endColumn);\n }\n return new Selection(result.endLineNumber, result.endColumn, result.startLineNumber, initialStartColumn);\n }\n return result;\n }\n};\nShiftCommand = ShiftCommand_1 = __decorate([\n __param(2, ILanguageConfigurationService)\n], ShiftCommand);\nexport { ShiftCommand };\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 *--------------------------------------------------------------------------------------------*/\nimport { Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nexport class SurroundSelectionCommand {\n constructor(range, charBeforeSelection, charAfterSelection) {\n this._range = range;\n this._charBeforeSelection = charBeforeSelection;\n this._charAfterSelection = charAfterSelection;\n }\n getEditOperations(model, builder) {\n builder.addTrackedEditOperation(new Range(this._range.startLineNumber, this._range.startColumn, this._range.startLineNumber, this._range.startColumn), this._charBeforeSelection);\n builder.addTrackedEditOperation(new Range(this._range.endLineNumber, this._range.endColumn, this._range.endLineNumber, this._range.endColumn), this._charAfterSelection);\n }\n computeCursorState(model, helper) {\n const inverseEditOperations = helper.getInverseEditOperations();\n const firstOperationRange = inverseEditOperations[0].range;\n const secondOperationRange = inverseEditOperations[1].range;\n return new Selection(firstOperationRange.endLineNumber, firstOperationRange.endColumn, secondOperationRange.endLineNumber, secondOperationRange.endColumn - this._charAfterSelection.length);\n }\n}\n/**\n * A surround selection command that runs after composition finished.\n */\nexport class CompositionSurroundSelectionCommand {\n constructor(_position, _text, _charAfter) {\n this._position = _position;\n this._text = _text;\n this._charAfter = _charAfter;\n }\n getEditOperations(model, builder) {\n builder.addTrackedEditOperation(new Range(this._position.lineNumber, this._position.column, this._position.lineNumber, this._position.column), this._text + this._charAfter);\n }\n computeCursorState(model, helper) {\n const inverseEditOperations = helper.getInverseEditOperations();\n const opRange = inverseEditOperations[0].range;\n return new Selection(opRange.endLineNumber, opRange.startColumn, opRange.endLineNumber, opRange.endColumn - this._charAfter.length);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport { IndentAction } from './languageConfiguration.js';\nimport { createScopedLineTokens } from './supports.js';\nimport { getScopedLineTokens } from './languageConfigurationRegistry.js';\n/**\n * Get nearest preceding line which doesn't match unIndentPattern or contains all whitespace.\n * Result:\n * -1: run into the boundary of embedded languages\n * 0: every line above are invalid\n * else: nearest preceding line of the same language\n */\nfunction getPrecedingValidLine(model, lineNumber, indentRulesSupport) {\n const languageId = model.tokenization.getLanguageIdAtPosition(lineNumber, 0);\n if (lineNumber > 1) {\n let lastLineNumber;\n let resultLineNumber = -1;\n for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {\n if (model.tokenization.getLanguageIdAtPosition(lastLineNumber, 0) !== languageId) {\n return resultLineNumber;\n }\n const text = model.getLineContent(lastLineNumber);\n if (indentRulesSupport.shouldIgnore(text) || /^\\s+$/.test(text) || text === '') {\n resultLineNumber = lastLineNumber;\n continue;\n }\n return lastLineNumber;\n }\n }\n return -1;\n}\n/**\n * Get inherited indentation from above lines.\n * 1. Find the nearest preceding line which doesn't match unIndentedLinePattern.\n * 2. If this line matches indentNextLinePattern or increaseIndentPattern, it means that the indent level of `lineNumber` should be 1 greater than this line.\n * 3. If this line doesn't match any indent rules\n * a. check whether the line above it matches indentNextLinePattern\n * b. If not, the indent level of this line is the result\n * c. If so, it means the indent of this line is *temporary*, go upward utill we find a line whose indent is not temporary (the same workflow a -> b -> c).\n * 4. Otherwise, we fail to get an inherited indent from aboves. Return null and we should not touch the indent of `lineNumber`\n *\n * This function only return the inherited indent based on above lines, it doesn't check whether current line should decrease or not.\n */\nexport function getInheritIndentForLine(autoIndent, model, lineNumber, honorIntentialIndent = true, languageConfigurationService) {\n if (autoIndent < 4 /* EditorAutoIndentStrategy.Full */) {\n return null;\n }\n const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(model.tokenization.getLanguageId()).indentRulesSupport;\n if (!indentRulesSupport) {\n return null;\n }\n if (lineNumber <= 1) {\n return {\n indentation: '',\n action: null\n };\n }\n // Use no indent if this is the first non-blank line\n for (let priorLineNumber = lineNumber - 1; priorLineNumber > 0; priorLineNumber--) {\n if (model.getLineContent(priorLineNumber) !== '') {\n break;\n }\n if (priorLineNumber === 1) {\n return {\n indentation: '',\n action: null\n };\n }\n }\n const precedingUnIgnoredLine = getPrecedingValidLine(model, lineNumber, indentRulesSupport);\n if (precedingUnIgnoredLine < 0) {\n return null;\n }\n else if (precedingUnIgnoredLine < 1) {\n return {\n indentation: '',\n action: null\n };\n }\n const precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine);\n if (indentRulesSupport.shouldIncrease(precedingUnIgnoredLineContent) || indentRulesSupport.shouldIndentNextLine(precedingUnIgnoredLineContent)) {\n return {\n indentation: strings.getLeadingWhitespace(precedingUnIgnoredLineContent),\n action: IndentAction.Indent,\n line: precedingUnIgnoredLine\n };\n }\n else if (indentRulesSupport.shouldDecrease(precedingUnIgnoredLineContent)) {\n return {\n indentation: strings.getLeadingWhitespace(precedingUnIgnoredLineContent),\n action: null,\n line: precedingUnIgnoredLine\n };\n }\n else {\n // precedingUnIgnoredLine can not be ignored.\n // it doesn't increase indent of following lines\n // it doesn't increase just next line\n // so current line is not affect by precedingUnIgnoredLine\n // and then we should get a correct inheritted indentation from above lines\n if (precedingUnIgnoredLine === 1) {\n return {\n indentation: strings.getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),\n action: null,\n line: precedingUnIgnoredLine\n };\n }\n const previousLine = precedingUnIgnoredLine - 1;\n const previousLineIndentMetadata = indentRulesSupport.getIndentMetadata(model.getLineContent(previousLine));\n if (!(previousLineIndentMetadata & (1 /* IndentConsts.INCREASE_MASK */ | 2 /* IndentConsts.DECREASE_MASK */)) &&\n (previousLineIndentMetadata & 4 /* IndentConsts.INDENT_NEXTLINE_MASK */)) {\n let stopLine = 0;\n for (let i = previousLine - 1; i > 0; i--) {\n if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {\n continue;\n }\n stopLine = i;\n break;\n }\n return {\n indentation: strings.getLeadingWhitespace(model.getLineContent(stopLine + 1)),\n action: null,\n line: stopLine + 1\n };\n }\n if (honorIntentialIndent) {\n return {\n indentation: strings.getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),\n action: null,\n line: precedingUnIgnoredLine\n };\n }\n else {\n // search from precedingUnIgnoredLine until we find one whose indent is not temporary\n for (let i = precedingUnIgnoredLine; i > 0; i--) {\n const lineContent = model.getLineContent(i);\n if (indentRulesSupport.shouldIncrease(lineContent)) {\n return {\n indentation: strings.getLeadingWhitespace(lineContent),\n action: IndentAction.Indent,\n line: i\n };\n }\n else if (indentRulesSupport.shouldIndentNextLine(lineContent)) {\n let stopLine = 0;\n for (let j = i - 1; j > 0; j--) {\n if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {\n continue;\n }\n stopLine = j;\n break;\n }\n return {\n indentation: strings.getLeadingWhitespace(model.getLineContent(stopLine + 1)),\n action: null,\n line: stopLine + 1\n };\n }\n else if (indentRulesSupport.shouldDecrease(lineContent)) {\n return {\n indentation: strings.getLeadingWhitespace(lineContent),\n action: null,\n line: i\n };\n }\n }\n return {\n indentation: strings.getLeadingWhitespace(model.getLineContent(1)),\n action: null,\n line: 1\n };\n }\n }\n}\nexport function getGoodIndentForLine(autoIndent, virtualModel, languageId, lineNumber, indentConverter, languageConfigurationService) {\n if (autoIndent < 4 /* EditorAutoIndentStrategy.Full */) {\n return null;\n }\n const richEditSupport = languageConfigurationService.getLanguageConfiguration(languageId);\n if (!richEditSupport) {\n return null;\n }\n const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(languageId).indentRulesSupport;\n if (!indentRulesSupport) {\n return null;\n }\n const indent = getInheritIndentForLine(autoIndent, virtualModel, lineNumber, undefined, languageConfigurationService);\n const lineContent = virtualModel.getLineContent(lineNumber);\n if (indent) {\n const inheritLine = indent.line;\n if (inheritLine !== undefined) {\n // Apply enter action as long as there are only whitespace lines between inherited line and this line.\n let shouldApplyEnterRules = true;\n for (let inBetweenLine = inheritLine; inBetweenLine < lineNumber - 1; inBetweenLine++) {\n if (!/^\\s*$/.test(virtualModel.getLineContent(inBetweenLine))) {\n shouldApplyEnterRules = false;\n break;\n }\n }\n if (shouldApplyEnterRules) {\n const enterResult = richEditSupport.onEnter(autoIndent, '', virtualModel.getLineContent(inheritLine), '');\n if (enterResult) {\n let indentation = strings.getLeadingWhitespace(virtualModel.getLineContent(inheritLine));\n if (enterResult.removeText) {\n indentation = indentation.substring(0, indentation.length - enterResult.removeText);\n }\n if ((enterResult.indentAction === IndentAction.Indent) ||\n (enterResult.indentAction === IndentAction.IndentOutdent)) {\n indentation = indentConverter.shiftIndent(indentation);\n }\n else if (enterResult.indentAction === IndentAction.Outdent) {\n indentation = indentConverter.unshiftIndent(indentation);\n }\n if (indentRulesSupport.shouldDecrease(lineContent)) {\n indentation = indentConverter.unshiftIndent(indentation);\n }\n if (enterResult.appendText) {\n indentation += enterResult.appendText;\n }\n return strings.getLeadingWhitespace(indentation);\n }\n }\n }\n if (indentRulesSupport.shouldDecrease(lineContent)) {\n if (indent.action === IndentAction.Indent) {\n return indent.indentation;\n }\n else {\n return indentConverter.unshiftIndent(indent.indentation);\n }\n }\n else {\n if (indent.action === IndentAction.Indent) {\n return indentConverter.shiftIndent(indent.indentation);\n }\n else {\n return indent.indentation;\n }\n }\n }\n return null;\n}\nexport function getIndentForEnter(autoIndent, model, range, indentConverter, languageConfigurationService) {\n if (autoIndent < 4 /* EditorAutoIndentStrategy.Full */) {\n return null;\n }\n model.tokenization.forceTokenization(range.startLineNumber);\n const lineTokens = model.tokenization.getLineTokens(range.startLineNumber);\n const scopedLineTokens = createScopedLineTokens(lineTokens, range.startColumn - 1);\n const scopedLineText = scopedLineTokens.getLineContent();\n let embeddedLanguage = false;\n let beforeEnterText;\n if (scopedLineTokens.firstCharOffset > 0 && lineTokens.getLanguageId(0) !== scopedLineTokens.languageId) {\n // we are in the embeded language content\n embeddedLanguage = true; // if embeddedLanguage is true, then we don't touch the indentation of current line\n beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);\n }\n else {\n beforeEnterText = lineTokens.getLineContent().substring(0, range.startColumn - 1);\n }\n let afterEnterText;\n if (range.isEmpty()) {\n afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);\n }\n else {\n const endScopedLineTokens = getScopedLineTokens(model, range.endLineNumber, range.endColumn);\n afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);\n }\n const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(scopedLineTokens.languageId).indentRulesSupport;\n if (!indentRulesSupport) {\n return null;\n }\n const beforeEnterResult = beforeEnterText;\n const beforeEnterIndent = strings.getLeadingWhitespace(beforeEnterText);\n const virtualModel = {\n tokenization: {\n getLineTokens: (lineNumber) => {\n return model.tokenization.getLineTokens(lineNumber);\n },\n getLanguageId: () => {\n return model.getLanguageId();\n },\n getLanguageIdAtPosition: (lineNumber, column) => {\n return model.getLanguageIdAtPosition(lineNumber, column);\n },\n },\n getLineContent: (lineNumber) => {\n if (lineNumber === range.startLineNumber) {\n return beforeEnterResult;\n }\n else {\n return model.getLineContent(lineNumber);\n }\n }\n };\n const currentLineIndent = strings.getLeadingWhitespace(lineTokens.getLineContent());\n const afterEnterAction = getInheritIndentForLine(autoIndent, virtualModel, range.startLineNumber + 1, undefined, languageConfigurationService);\n if (!afterEnterAction) {\n const beforeEnter = embeddedLanguage ? currentLineIndent : beforeEnterIndent;\n return {\n beforeEnter: beforeEnter,\n afterEnter: beforeEnter\n };\n }\n let afterEnterIndent = embeddedLanguage ? currentLineIndent : afterEnterAction.indentation;\n if (afterEnterAction.action === IndentAction.Indent) {\n afterEnterIndent = indentConverter.shiftIndent(afterEnterIndent);\n }\n if (indentRulesSupport.shouldDecrease(afterEnterText)) {\n afterEnterIndent = indentConverter.unshiftIndent(afterEnterIndent);\n }\n return {\n beforeEnter: embeddedLanguage ? currentLineIndent : beforeEnterIndent,\n afterEnter: afterEnterIndent\n };\n}\n/**\n * We should always allow intentional indentation. It means, if users change the indentation of `lineNumber` and the content of\n * this line doesn't match decreaseIndentPattern, we should not adjust the indentation.\n */\nexport function getIndentActionForType(autoIndent, model, range, ch, indentConverter, languageConfigurationService) {\n if (autoIndent < 4 /* EditorAutoIndentStrategy.Full */) {\n return null;\n }\n const scopedLineTokens = getScopedLineTokens(model, range.startLineNumber, range.startColumn);\n if (scopedLineTokens.firstCharOffset) {\n // this line has mixed languages and indentation rules will not work\n return null;\n }\n const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(scopedLineTokens.languageId).indentRulesSupport;\n if (!indentRulesSupport) {\n return null;\n }\n const scopedLineText = scopedLineTokens.getLineContent();\n const beforeTypeText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);\n // selection support\n let afterTypeText;\n if (range.isEmpty()) {\n afterTypeText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);\n }\n else {\n const endScopedLineTokens = getScopedLineTokens(model, range.endLineNumber, range.endColumn);\n afterTypeText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);\n }\n // If previous content already matches decreaseIndentPattern, it means indentation of this line should already be adjusted\n // Users might change the indentation by purpose and we should honor that instead of readjusting.\n if (!indentRulesSupport.shouldDecrease(beforeTypeText + afterTypeText) && indentRulesSupport.shouldDecrease(beforeTypeText + ch + afterTypeText)) {\n // after typing `ch`, the content matches decreaseIndentPattern, we should adjust the indent to a good manner.\n // 1. Get inherited indent action\n const r = getInheritIndentForLine(autoIndent, model, range.startLineNumber, false, languageConfigurationService);\n if (!r) {\n return null;\n }\n let indentation = r.indentation;\n if (r.action !== IndentAction.Indent) {\n indentation = indentConverter.unshiftIndent(indentation);\n }\n return indentation;\n }\n return null;\n}\nexport function getIndentMetadata(model, lineNumber, languageConfigurationService) {\n const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).indentRulesSupport;\n if (!indentRulesSupport) {\n return null;\n }\n if (lineNumber < 1 || lineNumber > model.getLineCount()) {\n return null;\n }\n return indentRulesSupport.getIndentMetadata(model.getLineContent(lineNumber));\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 *--------------------------------------------------------------------------------------------*/\nimport { onUnexpectedError } from '../../../base/common/errors.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { ReplaceCommand, ReplaceCommandWithOffsetCursorState, ReplaceCommandWithoutChangingPosition, ReplaceCommandThatPreservesSelection } from '../commands/replaceCommand.js';\nimport { ShiftCommand } from '../commands/shiftCommand.js';\nimport { CompositionSurroundSelectionCommand, SurroundSelectionCommand } from '../commands/surroundSelectionCommand.js';\nimport { EditOperationResult, isQuote } from '../cursorCommon.js';\nimport { getMapForWordSeparators } from '../core/wordCharacterClassifier.js';\nimport { Range } from '../core/range.js';\nimport { Position } from '../core/position.js';\nimport { IndentAction } from '../languages/languageConfiguration.js';\nimport { getIndentationAtPosition } from '../languages/languageConfigurationRegistry.js';\nimport { createScopedLineTokens } from '../languages/supports.js';\nimport { getIndentActionForType, getIndentForEnter, getInheritIndentForLine } from '../languages/autoIndent.js';\nimport { getEnterAction } from '../languages/enterAction.js';\nexport class TypeOperations {\n static indent(config, model, selections) {\n if (model === null || selections === null) {\n return [];\n }\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = new ShiftCommand(selections[i], {\n isUnshift: false,\n tabSize: config.tabSize,\n indentSize: config.indentSize,\n insertSpaces: config.insertSpaces,\n useTabStops: config.useTabStops,\n autoIndent: config.autoIndent\n }, config.languageConfigurationService);\n }\n return commands;\n }\n static outdent(config, model, selections) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = new ShiftCommand(selections[i], {\n isUnshift: true,\n tabSize: config.tabSize,\n indentSize: config.indentSize,\n insertSpaces: config.insertSpaces,\n useTabStops: config.useTabStops,\n autoIndent: config.autoIndent\n }, config.languageConfigurationService);\n }\n return commands;\n }\n static shiftIndent(config, indentation, count) {\n count = count || 1;\n return ShiftCommand.shiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);\n }\n static unshiftIndent(config, indentation, count) {\n count = count || 1;\n return ShiftCommand.unshiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);\n }\n static _distributedPaste(config, model, selections, text) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = new ReplaceCommand(selections[i], text[i]);\n }\n return new EditOperationResult(0 /* EditOperationType.Other */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: true\n });\n }\n static _simplePaste(config, model, selections, text, pasteOnNewLine) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n const position = selection.getPosition();\n if (pasteOnNewLine && !selection.isEmpty()) {\n pasteOnNewLine = false;\n }\n if (pasteOnNewLine && text.indexOf('\\n') !== text.length - 1) {\n pasteOnNewLine = false;\n }\n if (pasteOnNewLine) {\n // Paste entire line at the beginning of line\n const typeSelection = new Range(position.lineNumber, 1, position.lineNumber, 1);\n commands[i] = new ReplaceCommandThatPreservesSelection(typeSelection, text, selection, true);\n }\n else {\n commands[i] = new ReplaceCommand(selection, text);\n }\n }\n return new EditOperationResult(0 /* EditOperationType.Other */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: true\n });\n }\n static _distributePasteToCursors(config, selections, text, pasteOnNewLine, multicursorText) {\n if (pasteOnNewLine) {\n return null;\n }\n if (selections.length === 1) {\n return null;\n }\n if (multicursorText && multicursorText.length === selections.length) {\n return multicursorText;\n }\n if (config.multiCursorPaste === 'spread') {\n // Try to spread the pasted text in case the line count matches the cursor count\n // Remove trailing \\n if present\n if (text.charCodeAt(text.length - 1) === 10 /* CharCode.LineFeed */) {\n text = text.substr(0, text.length - 1);\n }\n // Remove trailing \\r if present\n if (text.charCodeAt(text.length - 1) === 13 /* CharCode.CarriageReturn */) {\n text = text.substr(0, text.length - 1);\n }\n const lines = strings.splitLines(text);\n if (lines.length === selections.length) {\n return lines;\n }\n }\n return null;\n }\n static paste(config, model, selections, text, pasteOnNewLine, multicursorText) {\n const distributedPaste = this._distributePasteToCursors(config, selections, text, pasteOnNewLine, multicursorText);\n if (distributedPaste) {\n selections = selections.sort(Range.compareRangesUsingStarts);\n return this._distributedPaste(config, model, selections, distributedPaste);\n }\n else {\n return this._simplePaste(config, model, selections, text, pasteOnNewLine);\n }\n }\n static _goodIndentForLine(config, model, lineNumber) {\n let action = null;\n let indentation = '';\n const expectedIndentAction = getInheritIndentForLine(config.autoIndent, model, lineNumber, false, config.languageConfigurationService);\n if (expectedIndentAction) {\n action = expectedIndentAction.action;\n indentation = expectedIndentAction.indentation;\n }\n else if (lineNumber > 1) {\n let lastLineNumber;\n for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {\n const lineText = model.getLineContent(lastLineNumber);\n const nonWhitespaceIdx = strings.lastNonWhitespaceIndex(lineText);\n if (nonWhitespaceIdx >= 0) {\n break;\n }\n }\n if (lastLineNumber < 1) {\n // No previous line with content found\n return null;\n }\n const maxColumn = model.getLineMaxColumn(lastLineNumber);\n const expectedEnterAction = getEnterAction(config.autoIndent, model, new Range(lastLineNumber, maxColumn, lastLineNumber, maxColumn), config.languageConfigurationService);\n if (expectedEnterAction) {\n indentation = expectedEnterAction.indentation + expectedEnterAction.appendText;\n }\n }\n if (action) {\n if (action === IndentAction.Indent) {\n indentation = TypeOperations.shiftIndent(config, indentation);\n }\n if (action === IndentAction.Outdent) {\n indentation = TypeOperations.unshiftIndent(config, indentation);\n }\n indentation = config.normalizeIndentation(indentation);\n }\n if (!indentation) {\n return null;\n }\n return indentation;\n }\n static _replaceJumpToNextIndent(config, model, selection, insertsAutoWhitespace) {\n let typeText = '';\n const position = selection.getStartPosition();\n if (config.insertSpaces) {\n const visibleColumnFromColumn = config.visibleColumnFromColumn(model, position);\n const indentSize = config.indentSize;\n const spacesCnt = indentSize - (visibleColumnFromColumn % indentSize);\n for (let i = 0; i < spacesCnt; i++) {\n typeText += ' ';\n }\n }\n else {\n typeText = '\\t';\n }\n return new ReplaceCommand(selection, typeText, insertsAutoWhitespace);\n }\n static tab(config, model, selections) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n if (selection.isEmpty()) {\n const lineText = model.getLineContent(selection.startLineNumber);\n if (/^\\s*$/.test(lineText) && model.tokenization.isCheapToTokenize(selection.startLineNumber)) {\n let goodIndent = this._goodIndentForLine(config, model, selection.startLineNumber);\n goodIndent = goodIndent || '\\t';\n const possibleTypeText = config.normalizeIndentation(goodIndent);\n if (!lineText.startsWith(possibleTypeText)) {\n commands[i] = new ReplaceCommand(new Range(selection.startLineNumber, 1, selection.startLineNumber, lineText.length + 1), possibleTypeText, true);\n continue;\n }\n }\n commands[i] = this._replaceJumpToNextIndent(config, model, selection, true);\n }\n else {\n if (selection.startLineNumber === selection.endLineNumber) {\n const lineMaxColumn = model.getLineMaxColumn(selection.startLineNumber);\n if (selection.startColumn !== 1 || selection.endColumn !== lineMaxColumn) {\n // This is a single line selection that is not the entire line\n commands[i] = this._replaceJumpToNextIndent(config, model, selection, false);\n continue;\n }\n }\n commands[i] = new ShiftCommand(selection, {\n isUnshift: false,\n tabSize: config.tabSize,\n indentSize: config.indentSize,\n insertSpaces: config.insertSpaces,\n useTabStops: config.useTabStops,\n autoIndent: config.autoIndent\n }, config.languageConfigurationService);\n }\n }\n return commands;\n }\n static compositionType(prevEditOperationType, config, model, selections, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {\n const commands = selections.map(selection => this._compositionType(model, selection, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta));\n return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, 4 /* EditOperationType.TypingOther */),\n shouldPushStackElementAfter: false\n });\n }\n static _compositionType(model, selection, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {\n if (!selection.isEmpty()) {\n // looks like https://github.com/microsoft/vscode/issues/2773\n // where a cursor operation occurred before a canceled composition\n // => ignore composition\n return null;\n }\n const pos = selection.getPosition();\n const startColumn = Math.max(1, pos.column - replacePrevCharCnt);\n const endColumn = Math.min(model.getLineMaxColumn(pos.lineNumber), pos.column + replaceNextCharCnt);\n const range = new Range(pos.lineNumber, startColumn, pos.lineNumber, endColumn);\n const oldText = model.getValueInRange(range);\n if (oldText === text && positionDelta === 0) {\n // => ignore composition that doesn't do anything\n return null;\n }\n return new ReplaceCommandWithOffsetCursorState(range, text, 0, positionDelta);\n }\n static _typeCommand(range, text, keepPosition) {\n if (keepPosition) {\n return new ReplaceCommandWithoutChangingPosition(range, text, true);\n }\n else {\n return new ReplaceCommand(range, text, true);\n }\n }\n static _enter(config, model, keepPosition, range) {\n if (config.autoIndent === 0 /* EditorAutoIndentStrategy.None */) {\n return TypeOperations._typeCommand(range, '\\n', keepPosition);\n }\n if (!model.tokenization.isCheapToTokenize(range.getStartPosition().lineNumber) || config.autoIndent === 1 /* EditorAutoIndentStrategy.Keep */) {\n const lineText = model.getLineContent(range.startLineNumber);\n const indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1);\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(indentation), keepPosition);\n }\n const r = getEnterAction(config.autoIndent, model, range, config.languageConfigurationService);\n if (r) {\n if (r.indentAction === IndentAction.None) {\n // Nothing special\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);\n }\n else if (r.indentAction === IndentAction.Indent) {\n // Indent once\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);\n }\n else if (r.indentAction === IndentAction.IndentOutdent) {\n // Ultra special\n const normalIndent = config.normalizeIndentation(r.indentation);\n const increasedIndent = config.normalizeIndentation(r.indentation + r.appendText);\n const typeText = '\\n' + increasedIndent + '\\n' + normalIndent;\n if (keepPosition) {\n return new ReplaceCommandWithoutChangingPosition(range, typeText, true);\n }\n else {\n return new ReplaceCommandWithOffsetCursorState(range, typeText, -1, increasedIndent.length - normalIndent.length, true);\n }\n }\n else if (r.indentAction === IndentAction.Outdent) {\n const actualIndentation = TypeOperations.unshiftIndent(config, r.indentation);\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(actualIndentation + r.appendText), keepPosition);\n }\n }\n const lineText = model.getLineContent(range.startLineNumber);\n const indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1);\n if (config.autoIndent >= 4 /* EditorAutoIndentStrategy.Full */) {\n const ir = getIndentForEnter(config.autoIndent, model, range, {\n unshiftIndent: (indent) => {\n return TypeOperations.unshiftIndent(config, indent);\n },\n shiftIndent: (indent) => {\n return TypeOperations.shiftIndent(config, indent);\n },\n normalizeIndentation: (indent) => {\n return config.normalizeIndentation(indent);\n }\n }, config.languageConfigurationService);\n if (ir) {\n let oldEndViewColumn = config.visibleColumnFromColumn(model, range.getEndPosition());\n const oldEndColumn = range.endColumn;\n const newLineContent = model.getLineContent(range.endLineNumber);\n const firstNonWhitespace = strings.firstNonWhitespaceIndex(newLineContent);\n if (firstNonWhitespace >= 0) {\n range = range.setEndPosition(range.endLineNumber, Math.max(range.endColumn, firstNonWhitespace + 1));\n }\n else {\n range = range.setEndPosition(range.endLineNumber, model.getLineMaxColumn(range.endLineNumber));\n }\n if (keepPosition) {\n return new ReplaceCommandWithoutChangingPosition(range, '\\n' + config.normalizeIndentation(ir.afterEnter), true);\n }\n else {\n let offset = 0;\n if (oldEndColumn <= firstNonWhitespace + 1) {\n if (!config.insertSpaces) {\n oldEndViewColumn = Math.ceil(oldEndViewColumn / config.indentSize);\n }\n offset = Math.min(oldEndViewColumn + 1 - config.normalizeIndentation(ir.afterEnter).length - 1, 0);\n }\n return new ReplaceCommandWithOffsetCursorState(range, '\\n' + config.normalizeIndentation(ir.afterEnter), 0, offset, true);\n }\n }\n }\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(indentation), keepPosition);\n }\n static _isAutoIndentType(config, model, selections) {\n if (config.autoIndent < 4 /* EditorAutoIndentStrategy.Full */) {\n return false;\n }\n for (let i = 0, len = selections.length; i < len; i++) {\n if (!model.tokenization.isCheapToTokenize(selections[i].getEndPosition().lineNumber)) {\n return false;\n }\n }\n return true;\n }\n static _runAutoIndentType(config, model, range, ch) {\n const currentIndentation = getIndentationAtPosition(model, range.startLineNumber, range.startColumn);\n const actualIndentation = getIndentActionForType(config.autoIndent, model, range, ch, {\n shiftIndent: (indentation) => {\n return TypeOperations.shiftIndent(config, indentation);\n },\n unshiftIndent: (indentation) => {\n return TypeOperations.unshiftIndent(config, indentation);\n },\n }, config.languageConfigurationService);\n if (actualIndentation === null) {\n return null;\n }\n if (actualIndentation !== config.normalizeIndentation(currentIndentation)) {\n const firstNonWhitespace = model.getLineFirstNonWhitespaceColumn(range.startLineNumber);\n if (firstNonWhitespace === 0) {\n return TypeOperations._typeCommand(new Range(range.startLineNumber, 1, range.endLineNumber, range.endColumn), config.normalizeIndentation(actualIndentation) + ch, false);\n }\n else {\n return TypeOperations._typeCommand(new Range(range.startLineNumber, 1, range.endLineNumber, range.endColumn), config.normalizeIndentation(actualIndentation) +\n model.getLineContent(range.startLineNumber).substring(firstNonWhitespace - 1, range.startColumn - 1) + ch, false);\n }\n }\n return null;\n }\n static _isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch) {\n if (config.autoClosingOvertype === 'never') {\n return false;\n }\n if (!config.autoClosingPairs.autoClosingPairsCloseSingleChar.has(ch)) {\n return false;\n }\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n if (!selection.isEmpty()) {\n return false;\n }\n const position = selection.getPosition();\n const lineText = model.getLineContent(position.lineNumber);\n const afterCharacter = lineText.charAt(position.column - 1);\n if (afterCharacter !== ch) {\n return false;\n }\n // Do not over-type quotes after a backslash\n const chIsQuote = isQuote(ch);\n const beforeCharacter = position.column > 2 ? lineText.charCodeAt(position.column - 2) : 0 /* CharCode.Null */;\n if (beforeCharacter === 92 /* CharCode.Backslash */ && chIsQuote) {\n return false;\n }\n // Must over-type a closing character typed by the editor\n if (config.autoClosingOvertype === 'auto') {\n let found = false;\n for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {\n const autoClosedCharacter = autoClosedCharacters[j];\n if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {\n found = true;\n break;\n }\n }\n if (!found) {\n return false;\n }\n }\n }\n return true;\n }\n static _runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n const position = selection.getPosition();\n const typeSelection = new Range(position.lineNumber, position.column, position.lineNumber, position.column + 1);\n commands[i] = new ReplaceCommand(typeSelection, ch);\n }\n return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, 4 /* EditOperationType.TypingOther */),\n shouldPushStackElementAfter: false\n });\n }\n static _isBeforeClosingBrace(config, lineAfter) {\n // If the start of lineAfter can be interpretted as both a starting or ending brace, default to returning false\n const nextChar = lineAfter.charAt(0);\n const potentialStartingBraces = config.autoClosingPairs.autoClosingPairsOpenByStart.get(nextChar) || [];\n const potentialClosingBraces = config.autoClosingPairs.autoClosingPairsCloseByStart.get(nextChar) || [];\n const isBeforeStartingBrace = potentialStartingBraces.some(x => lineAfter.startsWith(x.open));\n const isBeforeClosingBrace = potentialClosingBraces.some(x => lineAfter.startsWith(x.close));\n return !isBeforeStartingBrace && isBeforeClosingBrace;\n }\n /**\n * Determine if typing `ch` at all `positions` in the `model` results in an\n * auto closing open sequence being typed.\n *\n * Auto closing open sequences can consist of multiple characters, which\n * can lead to ambiguities. In such a case, the longest auto-closing open\n * sequence is returned.\n */\n static _findAutoClosingPairOpen(config, model, positions, ch) {\n const candidates = config.autoClosingPairs.autoClosingPairsOpenByEnd.get(ch);\n if (!candidates) {\n return null;\n }\n // Determine which auto-closing pair it is\n let result = null;\n for (const candidate of candidates) {\n if (result === null || candidate.open.length > result.open.length) {\n let candidateIsMatch = true;\n for (const position of positions) {\n const relevantText = model.getValueInRange(new Range(position.lineNumber, position.column - candidate.open.length + 1, position.lineNumber, position.column));\n if (relevantText + ch !== candidate.open) {\n candidateIsMatch = false;\n break;\n }\n }\n if (candidateIsMatch) {\n result = candidate;\n }\n }\n }\n return result;\n }\n /**\n * Find another auto-closing pair that is contained by the one passed in.\n *\n * e.g. when having [(,)] and [(*,*)] as auto-closing pairs\n * this method will find [(,)] as a containment pair for [(*,*)]\n */\n static _findContainedAutoClosingPair(config, pair) {\n if (pair.open.length <= 1) {\n return null;\n }\n const lastChar = pair.close.charAt(pair.close.length - 1);\n // get candidates with the same last character as close\n const candidates = config.autoClosingPairs.autoClosingPairsCloseByEnd.get(lastChar) || [];\n let result = null;\n for (const candidate of candidates) {\n if (candidate.open !== pair.open && pair.open.includes(candidate.open) && pair.close.endsWith(candidate.close)) {\n if (!result || candidate.open.length > result.open.length) {\n result = candidate;\n }\n }\n }\n return result;\n }\n static _getAutoClosingPairClose(config, model, selections, ch, chIsAlreadyTyped) {\n for (const selection of selections) {\n if (!selection.isEmpty()) {\n return null;\n }\n }\n // This method is called both when typing (regularly) and when composition ends\n // This means that we need to work with a text buffer where sometimes `ch` is not\n // there (it is being typed right now) or with a text buffer where `ch` has already been typed\n //\n // In order to avoid adding checks for `chIsAlreadyTyped` in all places, we will work\n // with two conceptual positions, the position before `ch` and the position after `ch`\n //\n const positions = selections.map((s) => {\n const position = s.getPosition();\n if (chIsAlreadyTyped) {\n return { lineNumber: position.lineNumber, beforeColumn: position.column - ch.length, afterColumn: position.column };\n }\n else {\n return { lineNumber: position.lineNumber, beforeColumn: position.column, afterColumn: position.column };\n }\n });\n // Find the longest auto-closing open pair in case of multiple ending in `ch`\n // e.g. when having [f\",\"] and [\",\"], it picks [f\",\"] if the character before is f\n const pair = this._findAutoClosingPairOpen(config, model, positions.map(p => new Position(p.lineNumber, p.beforeColumn)), ch);\n if (!pair) {\n return null;\n }\n let autoCloseConfig;\n let shouldAutoCloseBefore;\n const chIsQuote = isQuote(ch);\n if (chIsQuote) {\n autoCloseConfig = config.autoClosingQuotes;\n shouldAutoCloseBefore = config.shouldAutoCloseBefore.quote;\n }\n else {\n const pairIsForComments = config.blockCommentStartToken ? pair.open.includes(config.blockCommentStartToken) : false;\n if (pairIsForComments) {\n autoCloseConfig = config.autoClosingComments;\n shouldAutoCloseBefore = config.shouldAutoCloseBefore.comment;\n }\n else {\n autoCloseConfig = config.autoClosingBrackets;\n shouldAutoCloseBefore = config.shouldAutoCloseBefore.bracket;\n }\n }\n if (autoCloseConfig === 'never') {\n return null;\n }\n // Sometimes, it is possible to have two auto-closing pairs that have a containment relationship\n // e.g. when having [(,)] and [(*,*)]\n // - when typing (, the resulting state is (|)\n // - when typing *, the desired resulting state is (*|*), not (*|*))\n const containedPair = this._findContainedAutoClosingPair(config, pair);\n const containedPairClose = containedPair ? containedPair.close : '';\n let isContainedPairPresent = true;\n for (const position of positions) {\n const { lineNumber, beforeColumn, afterColumn } = position;\n const lineText = model.getLineContent(lineNumber);\n const lineBefore = lineText.substring(0, beforeColumn - 1);\n const lineAfter = lineText.substring(afterColumn - 1);\n if (!lineAfter.startsWith(containedPairClose)) {\n isContainedPairPresent = false;\n }\n // Only consider auto closing the pair if an allowed character follows or if another autoclosed pair closing brace follows\n if (lineAfter.length > 0) {\n const characterAfter = lineAfter.charAt(0);\n const isBeforeCloseBrace = TypeOperations._isBeforeClosingBrace(config, lineAfter);\n if (!isBeforeCloseBrace && !shouldAutoCloseBefore(characterAfter)) {\n return null;\n }\n }\n // Do not auto-close ' or \" after a word character\n if (pair.open.length === 1 && (ch === '\\'' || ch === '\"') && autoCloseConfig !== 'always') {\n const wordSeparators = getMapForWordSeparators(config.wordSeparators);\n if (lineBefore.length > 0) {\n const characterBefore = lineBefore.charCodeAt(lineBefore.length - 1);\n if (wordSeparators.get(characterBefore) === 0 /* WordCharacterClass.Regular */) {\n return null;\n }\n }\n }\n if (!model.tokenization.isCheapToTokenize(lineNumber)) {\n // Do not force tokenization\n return null;\n }\n model.tokenization.forceTokenization(lineNumber);\n const lineTokens = model.tokenization.getLineTokens(lineNumber);\n const scopedLineTokens = createScopedLineTokens(lineTokens, beforeColumn - 1);\n if (!pair.shouldAutoClose(scopedLineTokens, beforeColumn - scopedLineTokens.firstCharOffset)) {\n return null;\n }\n // Typing for example a quote could either start a new string, in which case auto-closing is desirable\n // or it could end a previously started string, in which case auto-closing is not desirable\n //\n // In certain cases, it is really not possible to look at the previous token to determine\n // what would happen. That's why we do something really unusual, we pretend to type a different\n // character and ask the tokenizer what the outcome of doing that is: after typing a neutral\n // character, are we in a string (i.e. the quote would most likely end a string) or not?\n //\n const neutralCharacter = pair.findNeutralCharacter();\n if (neutralCharacter) {\n const tokenType = model.tokenization.getTokenTypeIfInsertingCharacter(lineNumber, beforeColumn, neutralCharacter);\n if (!pair.isOK(tokenType)) {\n return null;\n }\n }\n }\n if (isContainedPairPresent) {\n return pair.close.substring(0, pair.close.length - containedPairClose.length);\n }\n else {\n return pair.close;\n }\n }\n static _runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, chIsAlreadyTyped, autoClosingPairClose) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n commands[i] = new TypeWithAutoClosingCommand(selection, ch, !chIsAlreadyTyped, autoClosingPairClose);\n }\n return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: false\n });\n }\n static _shouldSurroundChar(config, ch) {\n if (isQuote(ch)) {\n return (config.autoSurround === 'quotes' || config.autoSurround === 'languageDefined');\n }\n else {\n // Character is a bracket\n return (config.autoSurround === 'brackets' || config.autoSurround === 'languageDefined');\n }\n }\n static _isSurroundSelectionType(config, model, selections, ch) {\n if (!TypeOperations._shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {\n return false;\n }\n const isTypingAQuoteCharacter = isQuote(ch);\n for (const selection of selections) {\n if (selection.isEmpty()) {\n return false;\n }\n let selectionContainsOnlyWhitespace = true;\n for (let lineNumber = selection.startLineNumber; lineNumber <= selection.endLineNumber; lineNumber++) {\n const lineText = model.getLineContent(lineNumber);\n const startIndex = (lineNumber === selection.startLineNumber ? selection.startColumn - 1 : 0);\n const endIndex = (lineNumber === selection.endLineNumber ? selection.endColumn - 1 : lineText.length);\n const selectedText = lineText.substring(startIndex, endIndex);\n if (/[^ \\t]/.test(selectedText)) {\n // this selected text contains something other than whitespace\n selectionContainsOnlyWhitespace = false;\n break;\n }\n }\n if (selectionContainsOnlyWhitespace) {\n return false;\n }\n if (isTypingAQuoteCharacter && selection.startLineNumber === selection.endLineNumber && selection.startColumn + 1 === selection.endColumn) {\n const selectionText = model.getValueInRange(selection);\n if (isQuote(selectionText)) {\n // Typing a quote character on top of another quote character\n // => disable surround selection type\n return false;\n }\n }\n }\n return true;\n }\n static _runSurroundSelectionType(prevEditOperationType, config, model, selections, ch) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n const selection = selections[i];\n const closeCharacter = config.surroundingPairs[ch];\n commands[i] = new SurroundSelectionCommand(selection, ch, closeCharacter);\n }\n return new EditOperationResult(0 /* EditOperationType.Other */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: true\n });\n }\n static _isTypeInterceptorElectricChar(config, model, selections) {\n if (selections.length === 1 && model.tokenization.isCheapToTokenize(selections[0].getEndPosition().lineNumber)) {\n return true;\n }\n return false;\n }\n static _typeInterceptorElectricChar(prevEditOperationType, config, model, selection, ch) {\n if (!config.electricChars.hasOwnProperty(ch) || !selection.isEmpty()) {\n return null;\n }\n const position = selection.getPosition();\n model.tokenization.forceTokenization(position.lineNumber);\n const lineTokens = model.tokenization.getLineTokens(position.lineNumber);\n let electricAction;\n try {\n electricAction = config.onElectricCharacter(ch, lineTokens, position.column);\n }\n catch (e) {\n onUnexpectedError(e);\n return null;\n }\n if (!electricAction) {\n return null;\n }\n if (electricAction.matchOpenBracket) {\n const endColumn = (lineTokens.getLineContent() + ch).lastIndexOf(electricAction.matchOpenBracket) + 1;\n const match = model.bracketPairs.findMatchingBracketUp(electricAction.matchOpenBracket, {\n lineNumber: position.lineNumber,\n column: endColumn\n }, 500 /* give at most 500ms to compute */);\n if (match) {\n if (match.startLineNumber === position.lineNumber) {\n // matched something on the same line => no change in indentation\n return null;\n }\n const matchLine = model.getLineContent(match.startLineNumber);\n const matchLineIndentation = strings.getLeadingWhitespace(matchLine);\n const newIndentation = config.normalizeIndentation(matchLineIndentation);\n const lineText = model.getLineContent(position.lineNumber);\n const lineFirstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(position.lineNumber) || position.column;\n const prefix = lineText.substring(lineFirstNonBlankColumn - 1, position.column - 1);\n const typeText = newIndentation + prefix + ch;\n const typeSelection = new Range(position.lineNumber, 1, position.lineNumber, position.column);\n const command = new ReplaceCommand(typeSelection, typeText);\n return new EditOperationResult(getTypingOperation(typeText, prevEditOperationType), [command], {\n shouldPushStackElementBefore: false,\n shouldPushStackElementAfter: true\n });\n }\n }\n return null;\n }\n /**\n * This is very similar with typing, but the character is already in the text buffer!\n */\n static compositionEndWithInterceptors(prevEditOperationType, config, model, compositions, selections, autoClosedCharacters) {\n if (!compositions) {\n // could not deduce what the composition did\n return null;\n }\n let insertedText = null;\n for (const composition of compositions) {\n if (insertedText === null) {\n insertedText = composition.insertedText;\n }\n else if (insertedText !== composition.insertedText) {\n // not all selections agree on what was typed\n return null;\n }\n }\n if (!insertedText || insertedText.length !== 1) {\n // we're only interested in the case where a single character was inserted\n return null;\n }\n const ch = insertedText;\n let hasDeletion = false;\n for (const composition of compositions) {\n if (composition.deletedText.length !== 0) {\n hasDeletion = true;\n break;\n }\n }\n if (hasDeletion) {\n // Check if this could have been a surround selection\n if (!TypeOperations._shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {\n return null;\n }\n const isTypingAQuoteCharacter = isQuote(ch);\n for (const composition of compositions) {\n if (composition.deletedSelectionStart !== 0 || composition.deletedSelectionEnd !== composition.deletedText.length) {\n // more text was deleted than was selected, so this could not have been a surround selection\n return null;\n }\n if (/^[ \\t]+$/.test(composition.deletedText)) {\n // deleted text was only whitespace\n return null;\n }\n if (isTypingAQuoteCharacter && isQuote(composition.deletedText)) {\n // deleted text was a quote\n return null;\n }\n }\n const positions = [];\n for (const selection of selections) {\n if (!selection.isEmpty()) {\n return null;\n }\n positions.push(selection.getPosition());\n }\n if (positions.length !== compositions.length) {\n return null;\n }\n const commands = [];\n for (let i = 0, len = positions.length; i < len; i++) {\n commands.push(new CompositionSurroundSelectionCommand(positions[i], compositions[i].deletedText, config.surroundingPairs[ch]));\n }\n return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: false\n });\n }\n if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {\n // Unfortunately, the close character is at this point \"doubled\", so we need to delete it...\n const commands = selections.map(s => new ReplaceCommand(new Range(s.positionLineNumber, s.positionColumn, s.positionLineNumber, s.positionColumn + 1), '', false));\n return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: false\n });\n }\n const autoClosingPairClose = this._getAutoClosingPairClose(config, model, selections, ch, true);\n if (autoClosingPairClose !== null) {\n return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, true, autoClosingPairClose);\n }\n return null;\n }\n static typeWithInterceptors(isDoingComposition, prevEditOperationType, config, model, selections, autoClosedCharacters, ch) {\n if (!isDoingComposition && ch === '\\n') {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = TypeOperations._enter(config, model, false, selections[i]);\n }\n return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: false,\n });\n }\n if (!isDoingComposition && this._isAutoIndentType(config, model, selections)) {\n const commands = [];\n let autoIndentFails = false;\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = this._runAutoIndentType(config, model, selections[i], ch);\n if (!commands[i]) {\n autoIndentFails = true;\n break;\n }\n }\n if (!autoIndentFails) {\n return new EditOperationResult(4 /* EditOperationType.TypingOther */, commands, {\n shouldPushStackElementBefore: true,\n shouldPushStackElementAfter: false,\n });\n }\n }\n if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {\n return this._runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch);\n }\n if (!isDoingComposition) {\n const autoClosingPairClose = this._getAutoClosingPairClose(config, model, selections, ch, false);\n if (autoClosingPairClose) {\n return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, false, autoClosingPairClose);\n }\n }\n if (!isDoingComposition && this._isSurroundSelectionType(config, model, selections, ch)) {\n return this._runSurroundSelectionType(prevEditOperationType, config, model, selections, ch);\n }\n // Electric characters make sense only when dealing with a single cursor,\n // as multiple cursors typing brackets for example would interfer with bracket matching\n if (!isDoingComposition && this._isTypeInterceptorElectricChar(config, model, selections)) {\n const r = this._typeInterceptorElectricChar(prevEditOperationType, config, model, selections[0], ch);\n if (r) {\n return r;\n }\n }\n // A simple character type\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = new ReplaceCommand(selections[i], ch);\n }\n const opType = getTypingOperation(ch, prevEditOperationType);\n return new EditOperationResult(opType, commands, {\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),\n shouldPushStackElementAfter: false\n });\n }\n static typeWithoutInterceptors(prevEditOperationType, config, model, selections, str) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = new ReplaceCommand(selections[i], str);\n }\n const opType = getTypingOperation(str, prevEditOperationType);\n return new EditOperationResult(opType, commands, {\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),\n shouldPushStackElementAfter: false\n });\n }\n static lineInsertBefore(config, model, selections) {\n if (model === null || selections === null) {\n return [];\n }\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n let lineNumber = selections[i].positionLineNumber;\n if (lineNumber === 1) {\n commands[i] = new ReplaceCommandWithoutChangingPosition(new Range(1, 1, 1, 1), '\\n');\n }\n else {\n lineNumber--;\n const column = model.getLineMaxColumn(lineNumber);\n commands[i] = this._enter(config, model, false, new Range(lineNumber, column, lineNumber, column));\n }\n }\n return commands;\n }\n static lineInsertAfter(config, model, selections) {\n if (model === null || selections === null) {\n return [];\n }\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n const lineNumber = selections[i].positionLineNumber;\n const column = model.getLineMaxColumn(lineNumber);\n commands[i] = this._enter(config, model, false, new Range(lineNumber, column, lineNumber, column));\n }\n return commands;\n }\n static lineBreakInsert(config, model, selections) {\n const commands = [];\n for (let i = 0, len = selections.length; i < len; i++) {\n commands[i] = this._enter(config, model, true, selections[i]);\n }\n return commands;\n }\n}\nexport class TypeWithAutoClosingCommand extends ReplaceCommandWithOffsetCursorState {\n constructor(selection, openCharacter, insertOpenCharacter, closeCharacter) {\n super(selection, (insertOpenCharacter ? openCharacter : '') + closeCharacter, 0, -closeCharacter.length);\n this._openCharacter = openCharacter;\n this._closeCharacter = closeCharacter;\n this.closeCharacterRange = null;\n this.enclosingRange = null;\n }\n computeCursorState(model, helper) {\n const inverseEditOperations = helper.getInverseEditOperations();\n const range = inverseEditOperations[0].range;\n this.closeCharacterRange = new Range(range.startLineNumber, range.endColumn - this._closeCharacter.length, range.endLineNumber, range.endColumn);\n this.enclosingRange = new Range(range.startLineNumber, range.endColumn - this._openCharacter.length - this._closeCharacter.length, range.endLineNumber, range.endColumn);\n return super.computeCursorState(model, helper);\n }\n}\nexport class CompositionOutcome {\n constructor(deletedText, deletedSelectionStart, deletedSelectionEnd, insertedText, insertedSelectionStart, insertedSelectionEnd) {\n this.deletedText = deletedText;\n this.deletedSelectionStart = deletedSelectionStart;\n this.deletedSelectionEnd = deletedSelectionEnd;\n this.insertedText = insertedText;\n this.insertedSelectionStart = insertedSelectionStart;\n this.insertedSelectionEnd = insertedSelectionEnd;\n }\n}\nfunction getTypingOperation(typedText, previousTypingOperation) {\n if (typedText === ' ') {\n return previousTypingOperation === 5 /* EditOperationType.TypingFirstSpace */\n || previousTypingOperation === 6 /* EditOperationType.TypingConsecutiveSpace */\n ? 6 /* EditOperationType.TypingConsecutiveSpace */\n : 5 /* EditOperationType.TypingFirstSpace */;\n }\n return 4 /* EditOperationType.TypingOther */;\n}\nfunction shouldPushStackElementBetween(previousTypingOperation, typingOperation) {\n if (isTypingOperation(previousTypingOperation) && !isTypingOperation(typingOperation)) {\n // Always set an undo stop before non-type operations\n return true;\n }\n if (previousTypingOperation === 5 /* EditOperationType.TypingFirstSpace */) {\n // `abc |d`: No undo stop\n // `abc |d`: Undo stop\n return false;\n }\n // Insert undo stop between different operation types\n return normalizeOperationType(previousTypingOperation) !== normalizeOperationType(typingOperation);\n}\nfunction normalizeOperationType(type) {\n return (type === 6 /* EditOperationType.TypingConsecutiveSpace */ || type === 5 /* EditOperationType.TypingFirstSpace */)\n ? 'space'\n : type;\n}\nfunction isTypingOperation(type) {\n return type === 4 /* EditOperationType.TypingOther */\n || type === 5 /* EditOperationType.TypingFirstSpace */\n || type === 6 /* EditOperationType.TypingConsecutiveSpace */;\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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../nls.js';\nimport { RawContextKey } from '../../platform/contextkey/common/contextkey.js';\nexport var EditorContextKeys;\n(function (EditorContextKeys) {\n EditorContextKeys.editorSimpleInput = new RawContextKey('editorSimpleInput', false, true);\n /**\n * A context key that is set when the editor's text has focus (cursor is blinking).\n * Is false when focus is in simple editor widgets (repl input, scm commit input).\n */\n EditorContextKeys.editorTextFocus = new RawContextKey('editorTextFocus', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorTextFocus', \"Whether the editor text has focus (cursor is blinking)\"));\n /**\n * A context key that is set when the editor's text or an editor's widget has focus.\n */\n EditorContextKeys.focus = new RawContextKey('editorFocus', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorFocus', \"Whether the editor or an editor widget has focus (e.g. focus is in the find widget)\"));\n /**\n * A context key that is set when any editor input has focus (regular editor, repl input...).\n */\n EditorContextKeys.textInputFocus = new RawContextKey('textInputFocus', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'textInputFocus', \"Whether an editor or a rich text input has focus (cursor is blinking)\"));\n EditorContextKeys.readOnly = new RawContextKey('editorReadonly', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorReadonly', \"Whether the editor is read-only\"));\n EditorContextKeys.inDiffEditor = new RawContextKey('inDiffEditor', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'inDiffEditor', \"Whether the context is a diff editor\"));\n EditorContextKeys.isEmbeddedDiffEditor = new RawContextKey('isEmbeddedDiffEditor', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'isEmbeddedDiffEditor', \"Whether the context is an embedded diff editor\"));\n EditorContextKeys.inMultiDiffEditor = new RawContextKey('inMultiDiffEditor', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'inMultiDiffEditor', \"Whether the context is a multi diff editor\"));\n EditorContextKeys.multiDiffEditorAllCollapsed = new RawContextKey('multiDiffEditorAllCollapsed', undefined, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'multiDiffEditorAllCollapsed', \"Whether all files in multi diff editor are collapsed\"));\n EditorContextKeys.hasChanges = new RawContextKey('diffEditorHasChanges', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'diffEditorHasChanges', \"Whether the diff editor has changes\"));\n EditorContextKeys.comparingMovedCode = new RawContextKey('comparingMovedCode', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'comparingMovedCode', \"Whether a moved code block is selected for comparison\"));\n EditorContextKeys.accessibleDiffViewerVisible = new RawContextKey('accessibleDiffViewerVisible', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'accessibleDiffViewerVisible', \"Whether the accessible diff viewer is visible\"));\n EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached = new RawContextKey('diffEditorRenderSideBySideInlineBreakpointReached', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'diffEditorRenderSideBySideInlineBreakpointReached', \"Whether the diff editor render side by side inline breakpoint is reached\"));\n EditorContextKeys.columnSelection = new RawContextKey('editorColumnSelection', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorColumnSelection', \"Whether `editor.columnSelection` is enabled\"));\n EditorContextKeys.writable = EditorContextKeys.readOnly.toNegated();\n EditorContextKeys.hasNonEmptySelection = new RawContextKey('editorHasSelection', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasSelection', \"Whether the editor has text selected\"));\n EditorContextKeys.hasOnlyEmptySelection = EditorContextKeys.hasNonEmptySelection.toNegated();\n EditorContextKeys.hasMultipleSelections = new RawContextKey('editorHasMultipleSelections', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasMultipleSelections', \"Whether the editor has multiple selections\"));\n EditorContextKeys.hasSingleSelection = EditorContextKeys.hasMultipleSelections.toNegated();\n EditorContextKeys.tabMovesFocus = new RawContextKey('editorTabMovesFocus', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorTabMovesFocus', \"Whether `Tab` will move focus out of the editor\"));\n EditorContextKeys.tabDoesNotMoveFocus = EditorContextKeys.tabMovesFocus.toNegated();\n EditorContextKeys.isInWalkThroughSnippet = new RawContextKey('isInEmbeddedEditor', false, true);\n EditorContextKeys.canUndo = new RawContextKey('canUndo', false, true);\n EditorContextKeys.canRedo = new RawContextKey('canRedo', false, true);\n EditorContextKeys.hoverVisible = new RawContextKey('editorHoverVisible', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHoverVisible', \"Whether the editor hover is visible\"));\n EditorContextKeys.hoverFocused = new RawContextKey('editorHoverFocused', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHoverFocused', \"Whether the editor hover is focused\"));\n EditorContextKeys.stickyScrollFocused = new RawContextKey('stickyScrollFocused', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'stickyScrollFocused', \"Whether the sticky scroll is focused\"));\n EditorContextKeys.stickyScrollVisible = new RawContextKey('stickyScrollVisible', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'stickyScrollVisible', \"Whether the sticky scroll is visible\"));\n EditorContextKeys.standaloneColorPickerVisible = new RawContextKey('standaloneColorPickerVisible', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'standaloneColorPickerVisible', \"Whether the standalone color picker is visible\"));\n EditorContextKeys.standaloneColorPickerFocused = new RawContextKey('standaloneColorPickerFocused', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'standaloneColorPickerFocused', \"Whether the standalone color picker is focused\"));\n /**\n * A context key that is set when an editor is part of a larger editor, like notebooks or\n * (future) a diff editor\n */\n EditorContextKeys.inCompositeEditor = new RawContextKey('inCompositeEditor', undefined, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'inCompositeEditor', \"Whether the editor is part of a larger editor (e.g. notebooks)\"));\n EditorContextKeys.notInCompositeEditor = EditorContextKeys.inCompositeEditor.toNegated();\n // -- mode context keys\n EditorContextKeys.languageId = new RawContextKey('editorLangId', '', nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorLangId', \"The language identifier of the editor\"));\n EditorContextKeys.hasCompletionItemProvider = new RawContextKey('editorHasCompletionItemProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasCompletionItemProvider', \"Whether the editor has a completion item provider\"));\n EditorContextKeys.hasCodeActionsProvider = new RawContextKey('editorHasCodeActionsProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasCodeActionsProvider', \"Whether the editor has a code actions provider\"));\n EditorContextKeys.hasCodeLensProvider = new RawContextKey('editorHasCodeLensProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasCodeLensProvider', \"Whether the editor has a code lens provider\"));\n EditorContextKeys.hasDefinitionProvider = new RawContextKey('editorHasDefinitionProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasDefinitionProvider', \"Whether the editor has a definition provider\"));\n EditorContextKeys.hasDeclarationProvider = new RawContextKey('editorHasDeclarationProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasDeclarationProvider', \"Whether the editor has a declaration provider\"));\n EditorContextKeys.hasImplementationProvider = new RawContextKey('editorHasImplementationProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasImplementationProvider', \"Whether the editor has an implementation provider\"));\n EditorContextKeys.hasTypeDefinitionProvider = new RawContextKey('editorHasTypeDefinitionProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasTypeDefinitionProvider', \"Whether the editor has a type definition provider\"));\n EditorContextKeys.hasHoverProvider = new RawContextKey('editorHasHoverProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasHoverProvider', \"Whether the editor has a hover provider\"));\n EditorContextKeys.hasDocumentHighlightProvider = new RawContextKey('editorHasDocumentHighlightProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasDocumentHighlightProvider', \"Whether the editor has a document highlight provider\"));\n EditorContextKeys.hasDocumentSymbolProvider = new RawContextKey('editorHasDocumentSymbolProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasDocumentSymbolProvider', \"Whether the editor has a document symbol provider\"));\n EditorContextKeys.hasReferenceProvider = new RawContextKey('editorHasReferenceProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasReferenceProvider', \"Whether the editor has a reference provider\"));\n EditorContextKeys.hasRenameProvider = new RawContextKey('editorHasRenameProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasRenameProvider', \"Whether the editor has a rename provider\"));\n EditorContextKeys.hasSignatureHelpProvider = new RawContextKey('editorHasSignatureHelpProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasSignatureHelpProvider', \"Whether the editor has a signature help provider\"));\n EditorContextKeys.hasInlayHintsProvider = new RawContextKey('editorHasInlayHintsProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasInlayHintsProvider', \"Whether the editor has an inline hints provider\"));\n // -- mode context keys: formatting\n EditorContextKeys.hasDocumentFormattingProvider = new RawContextKey('editorHasDocumentFormattingProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasDocumentFormattingProvider', \"Whether the editor has a document formatting provider\"));\n EditorContextKeys.hasDocumentSelectionFormattingProvider = new RawContextKey('editorHasDocumentSelectionFormattingProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasDocumentSelectionFormattingProvider', \"Whether the editor has a document selection formatting provider\"));\n EditorContextKeys.hasMultipleDocumentFormattingProvider = new RawContextKey('editorHasMultipleDocumentFormattingProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasMultipleDocumentFormattingProvider', \"Whether the editor has multiple document formatting providers\"));\n EditorContextKeys.hasMultipleDocumentSelectionFormattingProvider = new RawContextKey('editorHasMultipleDocumentSelectionFormattingProvider', false, nls.localizeWithPath('vs/editor/common/editorContextKeys', 'editorHasMultipleDocumentSelectionFormattingProvider', \"Whether the editor has multiple document selection formatting providers\"));\n})(EditorContextKeys || (EditorContextKeys = {}));\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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../nls.js';\nimport { isFirefox } from '../../base/browser/browser.js';\nimport * as types from '../../base/common/types.js';\nimport { status } from '../../base/browser/ui/aria/aria.js';\nimport { Command, EditorCommand, registerEditorCommand, UndoCommand, RedoCommand, SelectAllCommand } from './editorExtensions.js';\nimport { ICodeEditorService } from './services/codeEditorService.js';\nimport { ColumnSelection } from '../common/cursor/cursorColumnSelection.js';\nimport { CursorState } from '../common/cursorCommon.js';\nimport { DeleteOperations } from '../common/cursor/cursorDeleteOperations.js';\nimport { CursorMove as CursorMove_, CursorMoveCommands } from '../common/cursor/cursorMoveCommands.js';\nimport { TypeOperations } from '../common/cursor/cursorTypeOperations.js';\nimport { Position } from '../common/core/position.js';\nimport { Range } from '../common/core/range.js';\nimport { EditorContextKeys } from '../common/editorContextKeys.js';\nimport { ContextKeyExpr } from '../../platform/contextkey/common/contextkey.js';\nimport { KeybindingsRegistry } from '../../platform/keybinding/common/keybindingsRegistry.js';\nimport { getActiveElement } from '../../base/browser/dom.js';\nconst CORE_WEIGHT = 0 /* KeybindingWeight.EditorCore */;\nexport class CoreEditorCommand extends EditorCommand {\n runEditorCommand(accessor, editor, args) {\n const viewModel = editor._getViewModel();\n if (!viewModel) {\n // the editor has no view => has no cursors\n return;\n }\n this.runCoreEditorCommand(viewModel, args || {});\n }\n}\nexport var EditorScroll_;\n(function (EditorScroll_) {\n const isEditorScrollArgs = function (arg) {\n if (!types.isObject(arg)) {\n return false;\n }\n const scrollArg = arg;\n if (!types.isString(scrollArg.to)) {\n return false;\n }\n if (!types.isUndefined(scrollArg.by) && !types.isString(scrollArg.by)) {\n return false;\n }\n if (!types.isUndefined(scrollArg.value) && !types.isNumber(scrollArg.value)) {\n return false;\n }\n if (!types.isUndefined(scrollArg.revealCursor) && !types.isBoolean(scrollArg.revealCursor)) {\n return false;\n }\n return true;\n };\n EditorScroll_.metadata = {\n description: 'Scroll editor in the given direction',\n args: [\n {\n name: 'Editor scroll argument object',\n description: `Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'to': A mandatory direction value.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'up', 'down'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'line', 'wrappedLine', 'page', 'halfPage', 'editor'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n\t\t\t\t`,\n constraint: isEditorScrollArgs,\n schema: {\n 'type': 'object',\n 'required': ['to'],\n 'properties': {\n 'to': {\n 'type': 'string',\n 'enum': ['up', 'down']\n },\n 'by': {\n 'type': 'string',\n 'enum': ['line', 'wrappedLine', 'page', 'halfPage', 'editor']\n },\n 'value': {\n 'type': 'number',\n 'default': 1\n },\n 'revealCursor': {\n 'type': 'boolean',\n }\n }\n }\n }\n ]\n };\n /**\n * Directions in the view for editor scroll command.\n */\n EditorScroll_.RawDirection = {\n Up: 'up',\n Right: 'right',\n Down: 'down',\n Left: 'left'\n };\n /**\n * Units for editor scroll 'by' argument\n */\n EditorScroll_.RawUnit = {\n Line: 'line',\n WrappedLine: 'wrappedLine',\n Page: 'page',\n HalfPage: 'halfPage',\n Editor: 'editor',\n Column: 'column'\n };\n function parse(args) {\n let direction;\n switch (args.to) {\n case EditorScroll_.RawDirection.Up:\n direction = 1 /* Direction.Up */;\n break;\n case EditorScroll_.RawDirection.Right:\n direction = 2 /* Direction.Right */;\n break;\n case EditorScroll_.RawDirection.Down:\n direction = 3 /* Direction.Down */;\n break;\n case EditorScroll_.RawDirection.Left:\n direction = 4 /* Direction.Left */;\n break;\n default:\n // Illegal arguments\n return null;\n }\n let unit;\n switch (args.by) {\n case EditorScroll_.RawUnit.Line:\n unit = 1 /* Unit.Line */;\n break;\n case EditorScroll_.RawUnit.WrappedLine:\n unit = 2 /* Unit.WrappedLine */;\n break;\n case EditorScroll_.RawUnit.Page:\n unit = 3 /* Unit.Page */;\n break;\n case EditorScroll_.RawUnit.HalfPage:\n unit = 4 /* Unit.HalfPage */;\n break;\n case EditorScroll_.RawUnit.Editor:\n unit = 5 /* Unit.Editor */;\n break;\n case EditorScroll_.RawUnit.Column:\n unit = 6 /* Unit.Column */;\n break;\n default:\n unit = 2 /* Unit.WrappedLine */;\n }\n const value = Math.floor(args.value || 1);\n const revealCursor = !!args.revealCursor;\n return {\n direction: direction,\n unit: unit,\n value: value,\n revealCursor: revealCursor,\n select: (!!args.select)\n };\n }\n EditorScroll_.parse = parse;\n})(EditorScroll_ || (EditorScroll_ = {}));\nexport var RevealLine_;\n(function (RevealLine_) {\n const isRevealLineArgs = function (arg) {\n if (!types.isObject(arg)) {\n return false;\n }\n const reveaLineArg = arg;\n if (!types.isNumber(reveaLineArg.lineNumber) && !types.isString(reveaLineArg.lineNumber)) {\n return false;\n }\n if (!types.isUndefined(reveaLineArg.at) && !types.isString(reveaLineArg.at)) {\n return false;\n }\n return true;\n };\n RevealLine_.metadata = {\n description: 'Reveal the given line at the given logical position',\n args: [\n {\n name: 'Reveal line argument object',\n description: `Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'lineNumber': A mandatory line number value.\n\t\t\t\t\t* 'at': Logical position at which line has to be revealed.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'top', 'center', 'bottom'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t`,\n constraint: isRevealLineArgs,\n schema: {\n 'type': 'object',\n 'required': ['lineNumber'],\n 'properties': {\n 'lineNumber': {\n 'type': ['number', 'string'],\n },\n 'at': {\n 'type': 'string',\n 'enum': ['top', 'center', 'bottom']\n }\n }\n }\n }\n ]\n };\n /**\n * Values for reveal line 'at' argument\n */\n RevealLine_.RawAtArgument = {\n Top: 'top',\n Center: 'center',\n Bottom: 'bottom'\n };\n})(RevealLine_ || (RevealLine_ = {}));\nclass EditorOrNativeTextInputCommand {\n constructor(target) {\n // 1. handle case when focus is in editor.\n target.addImplementation(10000, 'code-editor', (accessor, args) => {\n // Only if editor text focus (i.e. not if editor has widget focus).\n const focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();\n if (focusedEditor && focusedEditor.hasTextFocus()) {\n return this._runEditorCommand(accessor, focusedEditor, args);\n }\n return false;\n });\n // 2. handle case when focus is in some other `input` / `textarea`.\n target.addImplementation(1000, 'generic-dom-input-textarea', (accessor, args) => {\n // Only if focused on an element that allows for entering text\n const activeElement = getActiveElement();\n if (activeElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) {\n this.runDOMCommand(activeElement);\n return true;\n }\n return false;\n });\n // 3. (default) handle case when focus is somewhere else.\n target.addImplementation(0, 'generic-dom', (accessor, args) => {\n // Redirecting to active editor\n const activeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor();\n if (activeEditor) {\n activeEditor.focus();\n return this._runEditorCommand(accessor, activeEditor, args);\n }\n return false;\n });\n }\n _runEditorCommand(accessor, editor, args) {\n const result = this.runEditorCommand(accessor, editor, args);\n if (result) {\n return result;\n }\n return true;\n }\n}\nexport var CoreNavigationCommands;\n(function (CoreNavigationCommands) {\n class BaseMoveToCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.position) {\n return;\n }\n viewModel.model.pushStackElement();\n const cursorStateChanged = viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, [\n CursorMoveCommands.moveTo(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position, args.viewPosition)\n ]);\n if (cursorStateChanged && args.revealType !== 2 /* NavigationCommandRevealType.None */) {\n viewModel.revealPrimaryCursor(args.source, true, true);\n }\n }\n }\n CoreNavigationCommands.MoveTo = registerEditorCommand(new BaseMoveToCommand({\n id: '_moveTo',\n inSelectionMode: false,\n precondition: undefined\n }));\n CoreNavigationCommands.MoveToSelect = registerEditorCommand(new BaseMoveToCommand({\n id: '_moveToSelect',\n inSelectionMode: true,\n precondition: undefined\n }));\n class ColumnSelectCommand extends CoreEditorCommand {\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n const result = this._getColumnSelectResult(viewModel, viewModel.getPrimaryCursorState(), viewModel.getCursorColumnSelectData(), args);\n if (result === null) {\n // invalid arguments\n return;\n }\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, result.viewStates.map((viewState) => CursorState.fromViewState(viewState)));\n viewModel.setCursorColumnSelectData({\n isReal: true,\n fromViewLineNumber: result.fromLineNumber,\n fromViewVisualColumn: result.fromVisualColumn,\n toViewLineNumber: result.toLineNumber,\n toViewVisualColumn: result.toVisualColumn\n });\n if (result.reversed) {\n viewModel.revealTopMostCursor(args.source);\n }\n else {\n viewModel.revealBottomMostCursor(args.source);\n }\n }\n }\n CoreNavigationCommands.ColumnSelect = registerEditorCommand(new class extends ColumnSelectCommand {\n constructor() {\n super({\n id: 'columnSelect',\n precondition: undefined\n });\n }\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\n if (typeof args.position === 'undefined' || typeof args.viewPosition === 'undefined' || typeof args.mouseColumn === 'undefined') {\n return null;\n }\n // validate `args`\n const validatedPosition = viewModel.model.validatePosition(args.position);\n const validatedViewPosition = viewModel.coordinatesConverter.validateViewPosition(new Position(args.viewPosition.lineNumber, args.viewPosition.column), validatedPosition);\n const fromViewLineNumber = args.doColumnSelect ? prevColumnSelectData.fromViewLineNumber : validatedViewPosition.lineNumber;\n const fromViewVisualColumn = args.doColumnSelect ? prevColumnSelectData.fromViewVisualColumn : args.mouseColumn - 1;\n return ColumnSelection.columnSelect(viewModel.cursorConfig, viewModel, fromViewLineNumber, fromViewVisualColumn, validatedViewPosition.lineNumber, args.mouseColumn - 1);\n }\n });\n CoreNavigationCommands.CursorColumnSelectLeft = registerEditorCommand(new class extends ColumnSelectCommand {\n constructor() {\n super({\n id: 'cursorColumnSelectLeft',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 512 /* KeyMod.Alt */ | 15 /* KeyCode.LeftArrow */,\n linux: { primary: 0 }\n }\n });\n }\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\n return ColumnSelection.columnSelectLeft(viewModel.cursorConfig, viewModel, prevColumnSelectData);\n }\n });\n CoreNavigationCommands.CursorColumnSelectRight = registerEditorCommand(new class extends ColumnSelectCommand {\n constructor() {\n super({\n id: 'cursorColumnSelectRight',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 512 /* KeyMod.Alt */ | 17 /* KeyCode.RightArrow */,\n linux: { primary: 0 }\n }\n });\n }\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\n return ColumnSelection.columnSelectRight(viewModel.cursorConfig, viewModel, prevColumnSelectData);\n }\n });\n class ColumnSelectUpCommand extends ColumnSelectCommand {\n constructor(opts) {\n super(opts);\n this._isPaged = opts.isPaged;\n }\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\n return ColumnSelection.columnSelectUp(viewModel.cursorConfig, viewModel, prevColumnSelectData, this._isPaged);\n }\n }\n CoreNavigationCommands.CursorColumnSelectUp = registerEditorCommand(new ColumnSelectUpCommand({\n isPaged: false,\n id: 'cursorColumnSelectUp',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 512 /* KeyMod.Alt */ | 16 /* KeyCode.UpArrow */,\n linux: { primary: 0 }\n }\n }));\n CoreNavigationCommands.CursorColumnSelectPageUp = registerEditorCommand(new ColumnSelectUpCommand({\n isPaged: true,\n id: 'cursorColumnSelectPageUp',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 512 /* KeyMod.Alt */ | 11 /* KeyCode.PageUp */,\n linux: { primary: 0 }\n }\n }));\n class ColumnSelectDownCommand extends ColumnSelectCommand {\n constructor(opts) {\n super(opts);\n this._isPaged = opts.isPaged;\n }\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\n return ColumnSelection.columnSelectDown(viewModel.cursorConfig, viewModel, prevColumnSelectData, this._isPaged);\n }\n }\n CoreNavigationCommands.CursorColumnSelectDown = registerEditorCommand(new ColumnSelectDownCommand({\n isPaged: false,\n id: 'cursorColumnSelectDown',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 512 /* KeyMod.Alt */ | 18 /* KeyCode.DownArrow */,\n linux: { primary: 0 }\n }\n }));\n CoreNavigationCommands.CursorColumnSelectPageDown = registerEditorCommand(new ColumnSelectDownCommand({\n isPaged: true,\n id: 'cursorColumnSelectPageDown',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 512 /* KeyMod.Alt */ | 12 /* KeyCode.PageDown */,\n linux: { primary: 0 }\n }\n }));\n class CursorMoveImpl extends CoreEditorCommand {\n constructor() {\n super({\n id: 'cursorMove',\n precondition: undefined,\n metadata: CursorMove_.metadata\n });\n }\n runCoreEditorCommand(viewModel, args) {\n const parsed = CursorMove_.parse(args);\n if (!parsed) {\n // illegal arguments\n return;\n }\n this._runCursorMove(viewModel, args.source, parsed);\n }\n _runCursorMove(viewModel, source, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(source, 3 /* CursorChangeReason.Explicit */, CursorMoveImpl._move(viewModel, viewModel.getCursorStates(), args));\n viewModel.revealPrimaryCursor(source, true);\n }\n static _move(viewModel, cursors, args) {\n const inSelectionMode = args.select;\n const value = args.value;\n switch (args.direction) {\n case 0 /* CursorMove_.Direction.Left */:\n case 1 /* CursorMove_.Direction.Right */:\n case 2 /* CursorMove_.Direction.Up */:\n case 3 /* CursorMove_.Direction.Down */:\n case 4 /* CursorMove_.Direction.PrevBlankLine */:\n case 5 /* CursorMove_.Direction.NextBlankLine */:\n case 6 /* CursorMove_.Direction.WrappedLineStart */:\n case 7 /* CursorMove_.Direction.WrappedLineFirstNonWhitespaceCharacter */:\n case 8 /* CursorMove_.Direction.WrappedLineColumnCenter */:\n case 9 /* CursorMove_.Direction.WrappedLineEnd */:\n case 10 /* CursorMove_.Direction.WrappedLineLastNonWhitespaceCharacter */:\n return CursorMoveCommands.simpleMove(viewModel, cursors, args.direction, inSelectionMode, value, args.unit);\n case 11 /* CursorMove_.Direction.ViewPortTop */:\n case 13 /* CursorMove_.Direction.ViewPortBottom */:\n case 12 /* CursorMove_.Direction.ViewPortCenter */:\n case 14 /* CursorMove_.Direction.ViewPortIfOutside */:\n return CursorMoveCommands.viewportMove(viewModel, cursors, args.direction, inSelectionMode, value);\n default:\n return null;\n }\n }\n }\n CoreNavigationCommands.CursorMoveImpl = CursorMoveImpl;\n CoreNavigationCommands.CursorMove = registerEditorCommand(new CursorMoveImpl());\n class CursorMoveBasedCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._staticArgs = opts.args;\n }\n runCoreEditorCommand(viewModel, dynamicArgs) {\n let args = this._staticArgs;\n if (this._staticArgs.value === -1 /* Constants.PAGE_SIZE_MARKER */) {\n // -1 is a marker for page size\n args = {\n direction: this._staticArgs.direction,\n unit: this._staticArgs.unit,\n select: this._staticArgs.select,\n value: dynamicArgs.pageSize || viewModel.cursorConfig.pageSize\n };\n }\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(dynamicArgs.source, 3 /* CursorChangeReason.Explicit */, CursorMoveCommands.simpleMove(viewModel, viewModel.getCursorStates(), args.direction, args.select, args.value, args.unit));\n viewModel.revealPrimaryCursor(dynamicArgs.source, true);\n }\n }\n CoreNavigationCommands.CursorLeft = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 0 /* CursorMove_.Direction.Left */,\n unit: 0 /* CursorMove_.Unit.None */,\n select: false,\n value: 1\n },\n id: 'cursorLeft',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 15 /* KeyCode.LeftArrow */,\n mac: { primary: 15 /* KeyCode.LeftArrow */, secondary: [256 /* KeyMod.WinCtrl */ | 32 /* KeyCode.KeyB */] }\n }\n }));\n CoreNavigationCommands.CursorLeftSelect = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 0 /* CursorMove_.Direction.Left */,\n unit: 0 /* CursorMove_.Unit.None */,\n select: true,\n value: 1\n },\n id: 'cursorLeftSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 15 /* KeyCode.LeftArrow */\n }\n }));\n CoreNavigationCommands.CursorRight = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 1 /* CursorMove_.Direction.Right */,\n unit: 0 /* CursorMove_.Unit.None */,\n select: false,\n value: 1\n },\n id: 'cursorRight',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 17 /* KeyCode.RightArrow */,\n mac: { primary: 17 /* KeyCode.RightArrow */, secondary: [256 /* KeyMod.WinCtrl */ | 36 /* KeyCode.KeyF */] }\n }\n }));\n CoreNavigationCommands.CursorRightSelect = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 1 /* CursorMove_.Direction.Right */,\n unit: 0 /* CursorMove_.Unit.None */,\n select: true,\n value: 1\n },\n id: 'cursorRightSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 17 /* KeyCode.RightArrow */\n }\n }));\n CoreNavigationCommands.CursorUp = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 2 /* CursorMove_.Direction.Up */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: false,\n value: 1\n },\n id: 'cursorUp',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 16 /* KeyCode.UpArrow */,\n mac: { primary: 16 /* KeyCode.UpArrow */, secondary: [256 /* KeyMod.WinCtrl */ | 46 /* KeyCode.KeyP */] }\n }\n }));\n CoreNavigationCommands.CursorUpSelect = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 2 /* CursorMove_.Direction.Up */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: true,\n value: 1\n },\n id: 'cursorUpSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 16 /* KeyCode.UpArrow */,\n secondary: [2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 16 /* KeyCode.UpArrow */],\n mac: { primary: 1024 /* KeyMod.Shift */ | 16 /* KeyCode.UpArrow */ },\n linux: { primary: 1024 /* KeyMod.Shift */ | 16 /* KeyCode.UpArrow */ }\n }\n }));\n CoreNavigationCommands.CursorPageUp = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 2 /* CursorMove_.Direction.Up */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: false,\n value: -1 /* Constants.PAGE_SIZE_MARKER */\n },\n id: 'cursorPageUp',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 11 /* KeyCode.PageUp */\n }\n }));\n CoreNavigationCommands.CursorPageUpSelect = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 2 /* CursorMove_.Direction.Up */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: true,\n value: -1 /* Constants.PAGE_SIZE_MARKER */\n },\n id: 'cursorPageUpSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 11 /* KeyCode.PageUp */\n }\n }));\n CoreNavigationCommands.CursorDown = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 3 /* CursorMove_.Direction.Down */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: false,\n value: 1\n },\n id: 'cursorDown',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 18 /* KeyCode.DownArrow */,\n mac: { primary: 18 /* KeyCode.DownArrow */, secondary: [256 /* KeyMod.WinCtrl */ | 44 /* KeyCode.KeyN */] }\n }\n }));\n CoreNavigationCommands.CursorDownSelect = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 3 /* CursorMove_.Direction.Down */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: true,\n value: 1\n },\n id: 'cursorDownSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 18 /* KeyCode.DownArrow */,\n secondary: [2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 18 /* KeyCode.DownArrow */],\n mac: { primary: 1024 /* KeyMod.Shift */ | 18 /* KeyCode.DownArrow */ },\n linux: { primary: 1024 /* KeyMod.Shift */ | 18 /* KeyCode.DownArrow */ }\n }\n }));\n CoreNavigationCommands.CursorPageDown = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 3 /* CursorMove_.Direction.Down */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: false,\n value: -1 /* Constants.PAGE_SIZE_MARKER */\n },\n id: 'cursorPageDown',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 12 /* KeyCode.PageDown */\n }\n }));\n CoreNavigationCommands.CursorPageDownSelect = registerEditorCommand(new CursorMoveBasedCommand({\n args: {\n direction: 3 /* CursorMove_.Direction.Down */,\n unit: 2 /* CursorMove_.Unit.WrappedLine */,\n select: true,\n value: -1 /* Constants.PAGE_SIZE_MARKER */\n },\n id: 'cursorPageDownSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 12 /* KeyCode.PageDown */\n }\n }));\n CoreNavigationCommands.CreateCursor = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'createCursor',\n precondition: undefined\n });\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.position) {\n return;\n }\n let newState;\n if (args.wholeLine) {\n newState = CursorMoveCommands.line(viewModel, viewModel.getPrimaryCursorState(), false, args.position, args.viewPosition);\n }\n else {\n newState = CursorMoveCommands.moveTo(viewModel, viewModel.getPrimaryCursorState(), false, args.position, args.viewPosition);\n }\n const states = viewModel.getCursorStates();\n // Check if we should remove a cursor (sort of like a toggle)\n if (states.length > 1) {\n const newModelPosition = (newState.modelState ? newState.modelState.position : null);\n const newViewPosition = (newState.viewState ? newState.viewState.position : null);\n for (let i = 0, len = states.length; i < len; i++) {\n const state = states[i];\n if (newModelPosition && !state.modelState.selection.containsPosition(newModelPosition)) {\n continue;\n }\n if (newViewPosition && !state.viewState.selection.containsPosition(newViewPosition)) {\n continue;\n }\n // => Remove the cursor\n states.splice(i, 1);\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, states);\n return;\n }\n }\n // => Add the new cursor\n states.push(newState);\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, states);\n }\n });\n CoreNavigationCommands.LastCursorMoveToSelect = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: '_lastCursorMoveToSelect',\n precondition: undefined\n });\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.position) {\n return;\n }\n const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();\n const states = viewModel.getCursorStates();\n const newStates = states.slice(0);\n newStates[lastAddedCursorIndex] = CursorMoveCommands.moveTo(viewModel, states[lastAddedCursorIndex], true, args.position, args.viewPosition);\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, newStates);\n }\n });\n class HomeCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, CursorMoveCommands.moveToBeginningOfLine(viewModel, viewModel.getCursorStates(), this._inSelectionMode));\n viewModel.revealPrimaryCursor(args.source, true);\n }\n }\n CoreNavigationCommands.CursorHome = registerEditorCommand(new HomeCommand({\n inSelectionMode: false,\n id: 'cursorHome',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 14 /* KeyCode.Home */,\n mac: { primary: 14 /* KeyCode.Home */, secondary: [2048 /* KeyMod.CtrlCmd */ | 15 /* KeyCode.LeftArrow */] }\n }\n }));\n CoreNavigationCommands.CursorHomeSelect = registerEditorCommand(new HomeCommand({\n inSelectionMode: true,\n id: 'cursorHomeSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 14 /* KeyCode.Home */,\n mac: { primary: 1024 /* KeyMod.Shift */ | 14 /* KeyCode.Home */, secondary: [2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 15 /* KeyCode.LeftArrow */] }\n }\n }));\n class LineStartCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, this._exec(viewModel.getCursorStates()));\n viewModel.revealPrimaryCursor(args.source, true);\n }\n _exec(cursors) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const lineNumber = cursor.modelState.position.lineNumber;\n result[i] = CursorState.fromModelState(cursor.modelState.move(this._inSelectionMode, lineNumber, 1, 0));\n }\n return result;\n }\n }\n CoreNavigationCommands.CursorLineStart = registerEditorCommand(new LineStartCommand({\n inSelectionMode: false,\n id: 'cursorLineStart',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 0,\n mac: { primary: 256 /* KeyMod.WinCtrl */ | 31 /* KeyCode.KeyA */ }\n }\n }));\n CoreNavigationCommands.CursorLineStartSelect = registerEditorCommand(new LineStartCommand({\n inSelectionMode: true,\n id: 'cursorLineStartSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 0,\n mac: { primary: 256 /* KeyMod.WinCtrl */ | 1024 /* KeyMod.Shift */ | 31 /* KeyCode.KeyA */ }\n }\n }));\n class EndCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, CursorMoveCommands.moveToEndOfLine(viewModel, viewModel.getCursorStates(), this._inSelectionMode, args.sticky || false));\n viewModel.revealPrimaryCursor(args.source, true);\n }\n }\n CoreNavigationCommands.CursorEnd = registerEditorCommand(new EndCommand({\n inSelectionMode: false,\n id: 'cursorEnd',\n precondition: undefined,\n kbOpts: {\n args: { sticky: false },\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 13 /* KeyCode.End */,\n mac: { primary: 13 /* KeyCode.End */, secondary: [2048 /* KeyMod.CtrlCmd */ | 17 /* KeyCode.RightArrow */] }\n },\n metadata: {\n description: `Go to End`,\n args: [{\n name: 'args',\n schema: {\n type: 'object',\n properties: {\n 'sticky': {\n description: nls.localizeWithPath('vs/editor/browser/coreCommands', 'stickydesc', \"Stick to the end even when going to longer lines\"),\n type: 'boolean',\n default: false\n }\n }\n }\n }]\n }\n }));\n CoreNavigationCommands.CursorEndSelect = registerEditorCommand(new EndCommand({\n inSelectionMode: true,\n id: 'cursorEndSelect',\n precondition: undefined,\n kbOpts: {\n args: { sticky: false },\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1024 /* KeyMod.Shift */ | 13 /* KeyCode.End */,\n mac: { primary: 1024 /* KeyMod.Shift */ | 13 /* KeyCode.End */, secondary: [2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 17 /* KeyCode.RightArrow */] }\n },\n metadata: {\n description: `Select to End`,\n args: [{\n name: 'args',\n schema: {\n type: 'object',\n properties: {\n 'sticky': {\n description: nls.localizeWithPath('vs/editor/browser/coreCommands', 'stickydesc', \"Stick to the end even when going to longer lines\"),\n type: 'boolean',\n default: false\n }\n }\n }\n }]\n }\n }));\n class LineEndCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, this._exec(viewModel, viewModel.getCursorStates()));\n viewModel.revealPrimaryCursor(args.source, true);\n }\n _exec(viewModel, cursors) {\n const result = [];\n for (let i = 0, len = cursors.length; i < len; i++) {\n const cursor = cursors[i];\n const lineNumber = cursor.modelState.position.lineNumber;\n const maxColumn = viewModel.model.getLineMaxColumn(lineNumber);\n result[i] = CursorState.fromModelState(cursor.modelState.move(this._inSelectionMode, lineNumber, maxColumn, 0));\n }\n return result;\n }\n }\n CoreNavigationCommands.CursorLineEnd = registerEditorCommand(new LineEndCommand({\n inSelectionMode: false,\n id: 'cursorLineEnd',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 0,\n mac: { primary: 256 /* KeyMod.WinCtrl */ | 35 /* KeyCode.KeyE */ }\n }\n }));\n CoreNavigationCommands.CursorLineEndSelect = registerEditorCommand(new LineEndCommand({\n inSelectionMode: true,\n id: 'cursorLineEndSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 0,\n mac: { primary: 256 /* KeyMod.WinCtrl */ | 1024 /* KeyMod.Shift */ | 35 /* KeyCode.KeyE */ }\n }\n }));\n class TopCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, CursorMoveCommands.moveToBeginningOfBuffer(viewModel, viewModel.getCursorStates(), this._inSelectionMode));\n viewModel.revealPrimaryCursor(args.source, true);\n }\n }\n CoreNavigationCommands.CursorTop = registerEditorCommand(new TopCommand({\n inSelectionMode: false,\n id: 'cursorTop',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 14 /* KeyCode.Home */,\n mac: { primary: 2048 /* KeyMod.CtrlCmd */ | 16 /* KeyCode.UpArrow */ }\n }\n }));\n CoreNavigationCommands.CursorTopSelect = registerEditorCommand(new TopCommand({\n inSelectionMode: true,\n id: 'cursorTopSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 14 /* KeyCode.Home */,\n mac: { primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 16 /* KeyCode.UpArrow */ }\n }\n }));\n class BottomCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, CursorMoveCommands.moveToEndOfBuffer(viewModel, viewModel.getCursorStates(), this._inSelectionMode));\n viewModel.revealPrimaryCursor(args.source, true);\n }\n }\n CoreNavigationCommands.CursorBottom = registerEditorCommand(new BottomCommand({\n inSelectionMode: false,\n id: 'cursorBottom',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 13 /* KeyCode.End */,\n mac: { primary: 2048 /* KeyMod.CtrlCmd */ | 18 /* KeyCode.DownArrow */ }\n }\n }));\n CoreNavigationCommands.CursorBottomSelect = registerEditorCommand(new BottomCommand({\n inSelectionMode: true,\n id: 'cursorBottomSelect',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 13 /* KeyCode.End */,\n mac: { primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 18 /* KeyCode.DownArrow */ }\n }\n }));\n class EditorScrollImpl extends CoreEditorCommand {\n constructor() {\n super({\n id: 'editorScroll',\n precondition: undefined,\n metadata: EditorScroll_.metadata\n });\n }\n determineScrollMethod(args) {\n const horizontalUnits = [6 /* EditorScroll_.Unit.Column */];\n const verticalUnits = [\n 1 /* EditorScroll_.Unit.Line */,\n 2 /* EditorScroll_.Unit.WrappedLine */,\n 3 /* EditorScroll_.Unit.Page */,\n 4 /* EditorScroll_.Unit.HalfPage */,\n 5 /* EditorScroll_.Unit.Editor */,\n 6 /* EditorScroll_.Unit.Column */\n ];\n const horizontalDirections = [4 /* EditorScroll_.Direction.Left */, 2 /* EditorScroll_.Direction.Right */];\n const verticalDirections = [1 /* EditorScroll_.Direction.Up */, 3 /* EditorScroll_.Direction.Down */];\n if (horizontalUnits.includes(args.unit) && horizontalDirections.includes(args.direction)) {\n return this._runHorizontalEditorScroll.bind(this);\n }\n if (verticalUnits.includes(args.unit) && verticalDirections.includes(args.direction)) {\n return this._runVerticalEditorScroll.bind(this);\n }\n return null;\n }\n runCoreEditorCommand(viewModel, args) {\n const parsed = EditorScroll_.parse(args);\n if (!parsed) {\n // illegal arguments\n return;\n }\n const runEditorScroll = this.determineScrollMethod(parsed);\n if (!runEditorScroll) {\n // Incompatible unit and direction\n return;\n }\n runEditorScroll(viewModel, args.source, parsed);\n }\n _runVerticalEditorScroll(viewModel, source, args) {\n const desiredScrollTop = this._computeDesiredScrollTop(viewModel, args);\n if (args.revealCursor) {\n // must ensure cursor is in new visible range\n const desiredVisibleViewRange = viewModel.getCompletelyVisibleViewRangeAtScrollTop(desiredScrollTop);\n viewModel.setCursorStates(source, 3 /* CursorChangeReason.Explicit */, [\n CursorMoveCommands.findPositionInViewportIfOutside(viewModel, viewModel.getPrimaryCursorState(), desiredVisibleViewRange, args.select)\n ]);\n }\n viewModel.viewLayout.setScrollPosition({ scrollTop: desiredScrollTop }, 0 /* ScrollType.Smooth */);\n }\n _computeDesiredScrollTop(viewModel, args) {\n if (args.unit === 1 /* EditorScroll_.Unit.Line */) {\n // scrolling by model lines\n const futureViewport = viewModel.viewLayout.getFutureViewport();\n const visibleViewRange = viewModel.getCompletelyVisibleViewRangeAtScrollTop(futureViewport.top);\n const visibleModelRange = viewModel.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);\n let desiredTopModelLineNumber;\n if (args.direction === 1 /* EditorScroll_.Direction.Up */) {\n // must go x model lines up\n desiredTopModelLineNumber = Math.max(1, visibleModelRange.startLineNumber - args.value);\n }\n else {\n // must go x model lines down\n desiredTopModelLineNumber = Math.min(viewModel.model.getLineCount(), visibleModelRange.startLineNumber + args.value);\n }\n const viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(new Position(desiredTopModelLineNumber, 1));\n return viewModel.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber);\n }\n if (args.unit === 5 /* EditorScroll_.Unit.Editor */) {\n let desiredTopModelLineNumber = 0;\n if (args.direction === 3 /* EditorScroll_.Direction.Down */) {\n desiredTopModelLineNumber = viewModel.model.getLineCount() - viewModel.cursorConfig.pageSize;\n }\n return viewModel.viewLayout.getVerticalOffsetForLineNumber(desiredTopModelLineNumber);\n }\n let noOfLines;\n if (args.unit === 3 /* EditorScroll_.Unit.Page */) {\n noOfLines = viewModel.cursorConfig.pageSize * args.value;\n }\n else if (args.unit === 4 /* EditorScroll_.Unit.HalfPage */) {\n noOfLines = Math.round(viewModel.cursorConfig.pageSize / 2) * args.value;\n }\n else {\n noOfLines = args.value;\n }\n const deltaLines = (args.direction === 1 /* EditorScroll_.Direction.Up */ ? -1 : 1) * noOfLines;\n return viewModel.viewLayout.getCurrentScrollTop() + deltaLines * viewModel.cursorConfig.lineHeight;\n }\n _runHorizontalEditorScroll(viewModel, source, args) {\n const desiredScrollLeft = this._computeDesiredScrollLeft(viewModel, args);\n viewModel.viewLayout.setScrollPosition({ scrollLeft: desiredScrollLeft }, 0 /* ScrollType.Smooth */);\n }\n _computeDesiredScrollLeft(viewModel, args) {\n const deltaColumns = (args.direction === 4 /* EditorScroll_.Direction.Left */ ? -1 : 1) * args.value;\n return viewModel.viewLayout.getCurrentScrollLeft() + deltaColumns * viewModel.cursorConfig.typicalHalfwidthCharacterWidth;\n }\n }\n CoreNavigationCommands.EditorScrollImpl = EditorScrollImpl;\n CoreNavigationCommands.EditorScroll = registerEditorCommand(new EditorScrollImpl());\n CoreNavigationCommands.ScrollLineUp = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollLineUp',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 16 /* KeyCode.UpArrow */,\n mac: { primary: 256 /* KeyMod.WinCtrl */ | 11 /* KeyCode.PageUp */ }\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Up,\n by: EditorScroll_.RawUnit.WrappedLine,\n value: 1,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n CoreNavigationCommands.ScrollPageUp = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollPageUp',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 11 /* KeyCode.PageUp */,\n win: { primary: 512 /* KeyMod.Alt */ | 11 /* KeyCode.PageUp */ },\n linux: { primary: 512 /* KeyMod.Alt */ | 11 /* KeyCode.PageUp */ }\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Up,\n by: EditorScroll_.RawUnit.Page,\n value: 1,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n CoreNavigationCommands.ScrollEditorTop = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollEditorTop',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Up,\n by: EditorScroll_.RawUnit.Editor,\n value: 1,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n CoreNavigationCommands.ScrollLineDown = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollLineDown',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 18 /* KeyCode.DownArrow */,\n mac: { primary: 256 /* KeyMod.WinCtrl */ | 12 /* KeyCode.PageDown */ }\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Down,\n by: EditorScroll_.RawUnit.WrappedLine,\n value: 1,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n CoreNavigationCommands.ScrollPageDown = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollPageDown',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 2048 /* KeyMod.CtrlCmd */ | 12 /* KeyCode.PageDown */,\n win: { primary: 512 /* KeyMod.Alt */ | 12 /* KeyCode.PageDown */ },\n linux: { primary: 512 /* KeyMod.Alt */ | 12 /* KeyCode.PageDown */ }\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Down,\n by: EditorScroll_.RawUnit.Page,\n value: 1,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n CoreNavigationCommands.ScrollEditorBottom = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollEditorBottom',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Down,\n by: EditorScroll_.RawUnit.Editor,\n value: 1,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n CoreNavigationCommands.ScrollLeft = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollLeft',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Left,\n by: EditorScroll_.RawUnit.Column,\n value: 2,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n CoreNavigationCommands.ScrollRight = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'scrollRight',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n CoreNavigationCommands.EditorScroll.runCoreEditorCommand(viewModel, {\n to: EditorScroll_.RawDirection.Right,\n by: EditorScroll_.RawUnit.Column,\n value: 2,\n revealCursor: false,\n select: false,\n source: args.source\n });\n }\n });\n class WordCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.position) {\n return;\n }\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, [\n CursorMoveCommands.word(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position)\n ]);\n if (args.revealType !== 2 /* NavigationCommandRevealType.None */) {\n viewModel.revealPrimaryCursor(args.source, true, true);\n }\n }\n }\n CoreNavigationCommands.WordSelect = registerEditorCommand(new WordCommand({\n inSelectionMode: false,\n id: '_wordSelect',\n precondition: undefined\n }));\n CoreNavigationCommands.WordSelectDrag = registerEditorCommand(new WordCommand({\n inSelectionMode: true,\n id: '_wordSelectDrag',\n precondition: undefined\n }));\n CoreNavigationCommands.LastCursorWordSelect = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'lastCursorWordSelect',\n precondition: undefined\n });\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.position) {\n return;\n }\n const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();\n const states = viewModel.getCursorStates();\n const newStates = states.slice(0);\n const lastAddedState = states[lastAddedCursorIndex];\n newStates[lastAddedCursorIndex] = CursorMoveCommands.word(viewModel, lastAddedState, lastAddedState.modelState.hasSelection(), args.position);\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, newStates);\n }\n });\n class LineCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.position) {\n return;\n }\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, [\n CursorMoveCommands.line(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position, args.viewPosition)\n ]);\n if (args.revealType !== 2 /* NavigationCommandRevealType.None */) {\n viewModel.revealPrimaryCursor(args.source, false, true);\n }\n }\n }\n CoreNavigationCommands.LineSelect = registerEditorCommand(new LineCommand({\n inSelectionMode: false,\n id: '_lineSelect',\n precondition: undefined\n }));\n CoreNavigationCommands.LineSelectDrag = registerEditorCommand(new LineCommand({\n inSelectionMode: true,\n id: '_lineSelectDrag',\n precondition: undefined\n }));\n class LastCursorLineCommand extends CoreEditorCommand {\n constructor(opts) {\n super(opts);\n this._inSelectionMode = opts.inSelectionMode;\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.position) {\n return;\n }\n const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();\n const states = viewModel.getCursorStates();\n const newStates = states.slice(0);\n newStates[lastAddedCursorIndex] = CursorMoveCommands.line(viewModel, states[lastAddedCursorIndex], this._inSelectionMode, args.position, args.viewPosition);\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, newStates);\n }\n }\n CoreNavigationCommands.LastCursorLineSelect = registerEditorCommand(new LastCursorLineCommand({\n inSelectionMode: false,\n id: 'lastCursorLineSelect',\n precondition: undefined\n }));\n CoreNavigationCommands.LastCursorLineSelectDrag = registerEditorCommand(new LastCursorLineCommand({\n inSelectionMode: true,\n id: 'lastCursorLineSelectDrag',\n precondition: undefined\n }));\n CoreNavigationCommands.CancelSelection = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'cancelSelection',\n precondition: EditorContextKeys.hasNonEmptySelection,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 9 /* KeyCode.Escape */,\n secondary: [1024 /* KeyMod.Shift */ | 9 /* KeyCode.Escape */]\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, [\n CursorMoveCommands.cancelSelection(viewModel, viewModel.getPrimaryCursorState())\n ]);\n viewModel.revealPrimaryCursor(args.source, true);\n }\n });\n CoreNavigationCommands.RemoveSecondaryCursors = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'removeSecondaryCursors',\n precondition: EditorContextKeys.hasMultipleSelections,\n kbOpts: {\n weight: CORE_WEIGHT + 1,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 9 /* KeyCode.Escape */,\n secondary: [1024 /* KeyMod.Shift */ | 9 /* KeyCode.Escape */]\n }\n });\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, [\n viewModel.getPrimaryCursorState()\n ]);\n viewModel.revealPrimaryCursor(args.source, true);\n status(nls.localizeWithPath('vs/editor/browser/coreCommands', 'removedCursor', \"Removed secondary cursors\"));\n }\n });\n CoreNavigationCommands.RevealLine = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'revealLine',\n precondition: undefined,\n metadata: RevealLine_.metadata\n });\n }\n runCoreEditorCommand(viewModel, args) {\n const revealLineArg = args;\n const lineNumberArg = revealLineArg.lineNumber || 0;\n let lineNumber = typeof lineNumberArg === 'number' ? (lineNumberArg + 1) : (parseInt(lineNumberArg) + 1);\n if (lineNumber < 1) {\n lineNumber = 1;\n }\n const lineCount = viewModel.model.getLineCount();\n if (lineNumber > lineCount) {\n lineNumber = lineCount;\n }\n const range = new Range(lineNumber, 1, lineNumber, viewModel.model.getLineMaxColumn(lineNumber));\n let revealAt = 0 /* VerticalRevealType.Simple */;\n if (revealLineArg.at) {\n switch (revealLineArg.at) {\n case RevealLine_.RawAtArgument.Top:\n revealAt = 3 /* VerticalRevealType.Top */;\n break;\n case RevealLine_.RawAtArgument.Center:\n revealAt = 1 /* VerticalRevealType.Center */;\n break;\n case RevealLine_.RawAtArgument.Bottom:\n revealAt = 4 /* VerticalRevealType.Bottom */;\n break;\n default:\n break;\n }\n }\n const viewRange = viewModel.coordinatesConverter.convertModelRangeToViewRange(range);\n viewModel.revealRange(args.source, false, viewRange, revealAt, 0 /* ScrollType.Smooth */);\n }\n });\n CoreNavigationCommands.SelectAll = new class extends EditorOrNativeTextInputCommand {\n constructor() {\n super(SelectAllCommand);\n }\n runDOMCommand(activeElement) {\n if (isFirefox) {\n activeElement.focus();\n activeElement.select();\n }\n activeElement.ownerDocument.execCommand('selectAll');\n }\n runEditorCommand(accessor, editor, args) {\n const viewModel = editor._getViewModel();\n if (!viewModel) {\n // the editor has no view => has no cursors\n return;\n }\n this.runCoreEditorCommand(viewModel, args);\n }\n runCoreEditorCommand(viewModel, args) {\n viewModel.model.pushStackElement();\n viewModel.setCursorStates('keyboard', 3 /* CursorChangeReason.Explicit */, [\n CursorMoveCommands.selectAll(viewModel, viewModel.getPrimaryCursorState())\n ]);\n }\n }();\n CoreNavigationCommands.SetSelection = registerEditorCommand(new class extends CoreEditorCommand {\n constructor() {\n super({\n id: 'setSelection',\n precondition: undefined\n });\n }\n runCoreEditorCommand(viewModel, args) {\n if (!args.selection) {\n return;\n }\n viewModel.model.pushStackElement();\n viewModel.setCursorStates(args.source, 3 /* CursorChangeReason.Explicit */, [\n CursorState.fromModelSelection(args.selection)\n ]);\n }\n });\n})(CoreNavigationCommands || (CoreNavigationCommands = {}));\nconst columnSelectionCondition = ContextKeyExpr.and(EditorContextKeys.textInputFocus, EditorContextKeys.columnSelection);\nfunction registerColumnSelection(id, keybinding) {\n KeybindingsRegistry.registerKeybindingRule({\n id: id,\n primary: keybinding,\n when: columnSelectionCondition,\n weight: CORE_WEIGHT + 1\n });\n}\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectLeft.id, 1024 /* KeyMod.Shift */ | 15 /* KeyCode.LeftArrow */);\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectRight.id, 1024 /* KeyMod.Shift */ | 17 /* KeyCode.RightArrow */);\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectUp.id, 1024 /* KeyMod.Shift */ | 16 /* KeyCode.UpArrow */);\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectPageUp.id, 1024 /* KeyMod.Shift */ | 11 /* KeyCode.PageUp */);\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectDown.id, 1024 /* KeyMod.Shift */ | 18 /* KeyCode.DownArrow */);\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectPageDown.id, 1024 /* KeyMod.Shift */ | 12 /* KeyCode.PageDown */);\nfunction registerCommand(command) {\n command.register();\n return command;\n}\nexport var CoreEditingCommands;\n(function (CoreEditingCommands) {\n class CoreEditingCommand extends EditorCommand {\n runEditorCommand(accessor, editor, args) {\n const viewModel = editor._getViewModel();\n if (!viewModel) {\n // the editor has no view => has no cursors\n return;\n }\n this.runCoreEditingCommand(editor, viewModel, args || {});\n }\n }\n CoreEditingCommands.CoreEditingCommand = CoreEditingCommand;\n CoreEditingCommands.LineBreakInsert = registerEditorCommand(new class extends CoreEditingCommand {\n constructor() {\n super({\n id: 'lineBreakInsert',\n precondition: EditorContextKeys.writable,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 0,\n mac: { primary: 256 /* KeyMod.WinCtrl */ | 45 /* KeyCode.KeyO */ }\n }\n });\n }\n runCoreEditingCommand(editor, viewModel, args) {\n editor.pushUndoStop();\n editor.executeCommands(this.id, TypeOperations.lineBreakInsert(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection)));\n }\n });\n CoreEditingCommands.Outdent = registerEditorCommand(new class extends CoreEditingCommand {\n constructor() {\n super({\n id: 'outdent',\n precondition: EditorContextKeys.writable,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus),\n primary: 1024 /* KeyMod.Shift */ | 2 /* KeyCode.Tab */\n }\n });\n }\n runCoreEditingCommand(editor, viewModel, args) {\n editor.pushUndoStop();\n editor.executeCommands(this.id, TypeOperations.outdent(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection)));\n editor.pushUndoStop();\n }\n });\n CoreEditingCommands.Tab = registerEditorCommand(new class extends CoreEditingCommand {\n constructor() {\n super({\n id: 'tab',\n precondition: EditorContextKeys.writable,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus),\n primary: 2 /* KeyCode.Tab */\n }\n });\n }\n runCoreEditingCommand(editor, viewModel, args) {\n editor.pushUndoStop();\n editor.executeCommands(this.id, TypeOperations.tab(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection)));\n editor.pushUndoStop();\n }\n });\n CoreEditingCommands.DeleteLeft = registerEditorCommand(new class extends CoreEditingCommand {\n constructor() {\n super({\n id: 'deleteLeft',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 1 /* KeyCode.Backspace */,\n secondary: [1024 /* KeyMod.Shift */ | 1 /* KeyCode.Backspace */],\n mac: { primary: 1 /* KeyCode.Backspace */, secondary: [1024 /* KeyMod.Shift */ | 1 /* KeyCode.Backspace */, 256 /* KeyMod.WinCtrl */ | 38 /* KeyCode.KeyH */, 256 /* KeyMod.WinCtrl */ | 1 /* KeyCode.Backspace */] }\n }\n });\n }\n runCoreEditingCommand(editor, viewModel, args) {\n const [shouldPushStackElementBefore, commands] = DeleteOperations.deleteLeft(viewModel.getPrevEditOperationType(), viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection), viewModel.getCursorAutoClosedCharacters());\n if (shouldPushStackElementBefore) {\n editor.pushUndoStop();\n }\n editor.executeCommands(this.id, commands);\n viewModel.setPrevEditOperationType(2 /* EditOperationType.DeletingLeft */);\n }\n });\n CoreEditingCommands.DeleteRight = registerEditorCommand(new class extends CoreEditingCommand {\n constructor() {\n super({\n id: 'deleteRight',\n precondition: undefined,\n kbOpts: {\n weight: CORE_WEIGHT,\n kbExpr: EditorContextKeys.textInputFocus,\n primary: 20 /* KeyCode.Delete */,\n mac: { primary: 20 /* KeyCode.Delete */, secondary: [256 /* KeyMod.WinCtrl */ | 34 /* KeyCode.KeyD */, 256 /* KeyMod.WinCtrl */ | 20 /* KeyCode.Delete */] }\n }\n });\n }\n runCoreEditingCommand(editor, viewModel, args) {\n const [shouldPushStackElementBefore, commands] = DeleteOperations.deleteRight(viewModel.getPrevEditOperationType(), viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection));\n if (shouldPushStackElementBefore) {\n editor.pushUndoStop();\n }\n editor.executeCommands(this.id, commands);\n viewModel.setPrevEditOperationType(3 /* EditOperationType.DeletingRight */);\n }\n });\n CoreEditingCommands.Undo = new class extends EditorOrNativeTextInputCommand {\n constructor() {\n super(UndoCommand);\n }\n runDOMCommand(activeElement) {\n activeElement.ownerDocument.execCommand('undo');\n }\n runEditorCommand(accessor, editor, args) {\n if (!editor.hasModel() || editor.getOption(90 /* EditorOption.readOnly */) === true) {\n return;\n }\n return editor.getModel().undo();\n }\n }();\n CoreEditingCommands.Redo = new class extends EditorOrNativeTextInputCommand {\n constructor() {\n super(RedoCommand);\n }\n runDOMCommand(activeElement) {\n activeElement.ownerDocument.execCommand('redo');\n }\n runEditorCommand(accessor, editor, args) {\n if (!editor.hasModel() || editor.getOption(90 /* EditorOption.readOnly */) === true) {\n return;\n }\n return editor.getModel().redo();\n }\n }();\n})(CoreEditingCommands || (CoreEditingCommands = {}));\n/**\n * A command that will invoke a command on the focused editor.\n */\nclass EditorHandlerCommand extends Command {\n constructor(id, handlerId, metadata) {\n super({\n id: id,\n precondition: undefined,\n metadata\n });\n this._handlerId = handlerId;\n }\n runCommand(accessor, args) {\n const editor = accessor.get(ICodeEditorService).getFocusedCodeEditor();\n if (!editor) {\n return;\n }\n editor.trigger('keyboard', this._handlerId, args);\n }\n}\nfunction registerOverwritableCommand(handlerId, metadata) {\n registerCommand(new EditorHandlerCommand('default:' + handlerId, handlerId));\n registerCommand(new EditorHandlerCommand(handlerId, handlerId, metadata));\n}\nregisterOverwritableCommand(\"type\" /* Handler.Type */, {\n description: `Type`,\n args: [{\n name: 'args',\n schema: {\n 'type': 'object',\n 'required': ['text'],\n 'properties': {\n 'text': {\n 'type': 'string'\n }\n },\n }\n }]\n});\nregisterOverwritableCommand(\"replacePreviousChar\" /* Handler.ReplacePreviousChar */);\nregisterOverwritableCommand(\"compositionType\" /* Handler.CompositionType */);\nregisterOverwritableCommand(\"compositionStart\" /* Handler.CompositionStart */);\nregisterOverwritableCommand(\"compositionEnd\" /* Handler.CompositionEnd */);\nregisterOverwritableCommand(\"paste\" /* Handler.Paste */);\nregisterOverwritableCommand(\"cut\" /* Handler.Cut */);\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const IMarkerDecorationsService = createDecorator('markerDecorationsService');\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { IMarkerDecorationsService } from '../../common/services/markerDecorations.js';\nimport { registerEditorContribution } from '../editorExtensions.js';\nlet MarkerDecorationsContribution = class MarkerDecorationsContribution {\n constructor(_editor, _markerDecorationsService) {\n // Doesn't do anything, just requires `IMarkerDecorationsService` to make sure it gets instantiated\n }\n dispose() {\n }\n};\nMarkerDecorationsContribution.ID = 'editor.contrib.markerDecorations';\nMarkerDecorationsContribution = __decorate([\n __param(1, IMarkerDecorationsService)\n], MarkerDecorationsContribution);\nexport { MarkerDecorationsContribution };\nregisterEditorContribution(MarkerDecorationsContribution.ID, MarkerDecorationsContribution, 0 /* EditorContributionInstantiation.Eager */); // eager because it instantiates IMarkerDecorationsService which is responsible for rendering squiggles\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 *--------------------------------------------------------------------------------------------*/\nimport { isTypedArray, isObject, isUndefinedOrNull } from './types.js';\nexport function deepClone(obj) {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n if (obj instanceof RegExp) {\n return obj;\n }\n const result = Array.isArray(obj) ? [] : {};\n Object.entries(obj).forEach(([key, value]) => {\n result[key] = value && typeof value === 'object' ? deepClone(value) : value;\n });\n return result;\n}\nexport function deepFreeze(obj) {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n const stack = [obj];\n while (stack.length > 0) {\n const obj = stack.shift();\n Object.freeze(obj);\n for (const key in obj) {\n if (_hasOwnProperty.call(obj, key)) {\n const prop = obj[key];\n if (typeof prop === 'object' && !Object.isFrozen(prop) && !isTypedArray(prop)) {\n stack.push(prop);\n }\n }\n }\n }\n return obj;\n}\nconst _hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function cloneAndChange(obj, changer) {\n return _cloneAndChange(obj, changer, new Set());\n}\nfunction _cloneAndChange(obj, changer, seen) {\n if (isUndefinedOrNull(obj)) {\n return obj;\n }\n const changed = changer(obj);\n if (typeof changed !== 'undefined') {\n return changed;\n }\n if (Array.isArray(obj)) {\n const r1 = [];\n for (const e of obj) {\n r1.push(_cloneAndChange(e, changer, seen));\n }\n return r1;\n }\n if (isObject(obj)) {\n if (seen.has(obj)) {\n throw new Error('Cannot clone recursive data-structure');\n }\n seen.add(obj);\n const r2 = {};\n for (const i2 in obj) {\n if (_hasOwnProperty.call(obj, i2)) {\n r2[i2] = _cloneAndChange(obj[i2], changer, seen);\n }\n }\n seen.delete(obj);\n return r2;\n }\n return obj;\n}\n/**\n * Copies all properties of source into destination. The optional parameter \"overwrite\" allows to control\n * if existing properties on the destination should be overwritten or not. Defaults to true (overwrite).\n */\nexport function mixin(destination, source, overwrite = true) {\n if (!isObject(destination)) {\n return source;\n }\n if (isObject(source)) {\n Object.keys(source).forEach(key => {\n if (key in destination) {\n if (overwrite) {\n if (isObject(destination[key]) && isObject(source[key])) {\n mixin(destination[key], source[key], overwrite);\n }\n else {\n destination[key] = source[key];\n }\n }\n }\n else {\n destination[key] = source[key];\n }\n });\n }\n return destination;\n}\nexport function equals(one, other) {\n if (one === other) {\n return true;\n }\n if (one === null || one === undefined || other === null || other === undefined) {\n return false;\n }\n if (typeof one !== typeof other) {\n return false;\n }\n if (typeof one !== 'object') {\n return false;\n }\n if ((Array.isArray(one)) !== (Array.isArray(other))) {\n return false;\n }\n let i;\n let key;\n if (Array.isArray(one)) {\n if (one.length !== other.length) {\n return false;\n }\n for (i = 0; i < one.length; i++) {\n if (!equals(one[i], other[i])) {\n return false;\n }\n }\n }\n else {\n const oneKeys = [];\n for (key in one) {\n oneKeys.push(key);\n }\n oneKeys.sort();\n const otherKeys = [];\n for (key in other) {\n otherKeys.push(key);\n }\n otherKeys.sort();\n if (!equals(oneKeys, otherKeys)) {\n return false;\n }\n for (i = 0; i < oneKeys.length; i++) {\n if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {\n return false;\n }\n }\n }\n return true;\n}\n/**\n * Calls `JSON.Stringify` with a replacer to break apart any circular references.\n * This prevents `JSON`.stringify` from throwing the exception\n * \"Uncaught TypeError: Converting circular structure to JSON\"\n */\nexport function safeStringify(obj) {\n const seen = new Set();\n return JSON.stringify(obj, (key, value) => {\n if (isObject(value) || Array.isArray(value)) {\n if (seen.has(value)) {\n return '[Circular]';\n }\n else {\n seen.add(value);\n }\n }\n return value;\n });\n}\n/**\n * Returns an object that has keys for each value that is different in the base object. Keys\n * that do not exist in the target but in the base object are not considered.\n *\n * Note: This is not a deep-diffing method, so the values are strictly taken into the resulting\n * object if they differ.\n *\n * @param base the object to diff against\n * @param obj the object to use for diffing\n */\nexport function distinct(base, target) {\n const result = Object.create(null);\n if (!base || !target) {\n return result;\n }\n const targetKeys = Object.keys(target);\n targetKeys.forEach(k => {\n const baseValue = base[k];\n const targetValue = target[k];\n if (!equals(baseValue, targetValue)) {\n result[k] = targetValue;\n }\n });\n return result;\n}\nexport function getCaseInsensitive(target, key) {\n const lowercaseKey = key.toLowerCase();\n const equivalentKey = Object.keys(target).find(k => k.toLowerCase() === lowercaseKey);\n return equivalentKey ? target[equivalentKey] : target[key];\n}\nexport function filter(obj, predicate) {\n const result = Object.create(null);\n for (const [key, value] of Object.entries(obj)) {\n if (predicate(key, value)) {\n result[key] = value;\n }\n }\n return result;\n}\nexport function getAllPropertyNames(obj) {\n let res = [];\n while (Object.prototype !== obj) {\n res = res.concat(Object.getOwnPropertyNames(obj));\n obj = Object.getPrototypeOf(obj);\n }\n return res;\n}\nexport function getAllMethodNames(obj) {\n const methods = [];\n for (const prop of getAllPropertyNames(obj)) {\n if (typeof obj[prop] === 'function') {\n methods.push(prop);\n }\n }\n return methods;\n}\nexport function createProxyObject(methodNames, invoke) {\n const createProxyMethod = (method) => {\n return function () {\n const args = Array.prototype.slice.call(arguments, 0);\n return invoke(method, args);\n };\n };\n const result = {};\n for (const methodName of methodNames) {\n result[methodName] = createProxyMethod(methodName);\n }\n return result;\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 *--------------------------------------------------------------------------------------------*/\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { getWindow, scheduleAtNextAnimationFrame } from '../../../base/browser/dom.js';\nexport class ElementSizeObserver extends Disposable {\n constructor(referenceDomElement, dimension) {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._referenceDomElement = referenceDomElement;\n this._width = -1;\n this._height = -1;\n this._resizeObserver = null;\n this.measureReferenceDomElement(false, dimension);\n }\n dispose() {\n this.stopObserving();\n super.dispose();\n }\n getWidth() {\n return this._width;\n }\n getHeight() {\n return this._height;\n }\n startObserving() {\n if (!this._resizeObserver && this._referenceDomElement) {\n // We want to react to the resize observer only once per animation frame\n // The first time the resize observer fires, we will react to it immediately.\n // Otherwise we will postpone to the next animation frame.\n // We'll use `observeContentRect` to store the content rect we received.\n let observeContentRect = null;\n const observeNow = () => {\n if (observeContentRect) {\n this.observe({ width: observeContentRect.width, height: observeContentRect.height });\n }\n else {\n this.observe();\n }\n };\n let shouldObserve = false;\n let alreadyObservedThisAnimationFrame = false;\n const update = () => {\n if (shouldObserve && !alreadyObservedThisAnimationFrame) {\n try {\n shouldObserve = false;\n alreadyObservedThisAnimationFrame = true;\n observeNow();\n }\n finally {\n scheduleAtNextAnimationFrame(getWindow(this._referenceDomElement), () => {\n alreadyObservedThisAnimationFrame = false;\n update();\n });\n }\n }\n };\n this._resizeObserver = new ResizeObserver((entries) => {\n observeContentRect = (entries && entries[0] && entries[0].contentRect ? entries[0].contentRect : null);\n shouldObserve = true;\n update();\n });\n this._resizeObserver.observe(this._referenceDomElement);\n }\n }\n stopObserving() {\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n this._resizeObserver = null;\n }\n }\n observe(dimension) {\n this.measureReferenceDomElement(true, dimension);\n }\n measureReferenceDomElement(emitEvent, dimension) {\n let observedWidth = 0;\n let observedHeight = 0;\n if (dimension) {\n observedWidth = dimension.width;\n observedHeight = dimension.height;\n }\n else if (this._referenceDomElement) {\n observedWidth = this._referenceDomElement.clientWidth;\n observedHeight = this._referenceDomElement.clientHeight;\n }\n observedWidth = Math.max(5, observedWidth);\n observedHeight = Math.max(5, observedHeight);\n if (this._width !== observedWidth || this._height !== observedHeight) {\n this._width = observedWidth;\n this._height = observedHeight;\n if (emitEvent) {\n this._onDidChange.fire();\n }\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nexport class FastDomNode {\n constructor(domNode) {\n this.domNode = domNode;\n this._maxWidth = '';\n this._width = '';\n this._height = '';\n this._top = '';\n this._left = '';\n this._bottom = '';\n this._right = '';\n this._paddingTop = '';\n this._paddingLeft = '';\n this._paddingBottom = '';\n this._paddingRight = '';\n this._fontFamily = '';\n this._fontWeight = '';\n this._fontSize = '';\n this._fontStyle = '';\n this._fontFeatureSettings = '';\n this._fontVariationSettings = '';\n this._textDecoration = '';\n this._lineHeight = '';\n this._letterSpacing = '';\n this._className = '';\n this._display = '';\n this._position = '';\n this._visibility = '';\n this._color = '';\n this._backgroundColor = '';\n this._layerHint = false;\n this._contain = 'none';\n this._boxShadow = '';\n }\n setMaxWidth(_maxWidth) {\n const maxWidth = numberAsPixels(_maxWidth);\n if (this._maxWidth === maxWidth) {\n return;\n }\n this._maxWidth = maxWidth;\n this.domNode.style.maxWidth = this._maxWidth;\n }\n setWidth(_width) {\n const width = numberAsPixels(_width);\n if (this._width === width) {\n return;\n }\n this._width = width;\n this.domNode.style.width = this._width;\n }\n setHeight(_height) {\n const height = numberAsPixels(_height);\n if (this._height === height) {\n return;\n }\n this._height = height;\n this.domNode.style.height = this._height;\n }\n setTop(_top) {\n const top = numberAsPixels(_top);\n if (this._top === top) {\n return;\n }\n this._top = top;\n this.domNode.style.top = this._top;\n }\n setLeft(_left) {\n const left = numberAsPixels(_left);\n if (this._left === left) {\n return;\n }\n this._left = left;\n this.domNode.style.left = this._left;\n }\n setBottom(_bottom) {\n const bottom = numberAsPixels(_bottom);\n if (this._bottom === bottom) {\n return;\n }\n this._bottom = bottom;\n this.domNode.style.bottom = this._bottom;\n }\n setRight(_right) {\n const right = numberAsPixels(_right);\n if (this._right === right) {\n return;\n }\n this._right = right;\n this.domNode.style.right = this._right;\n }\n setPaddingTop(_paddingTop) {\n const paddingTop = numberAsPixels(_paddingTop);\n if (this._paddingTop === paddingTop) {\n return;\n }\n this._paddingTop = paddingTop;\n this.domNode.style.paddingTop = this._paddingTop;\n }\n setPaddingLeft(_paddingLeft) {\n const paddingLeft = numberAsPixels(_paddingLeft);\n if (this._paddingLeft === paddingLeft) {\n return;\n }\n this._paddingLeft = paddingLeft;\n this.domNode.style.paddingLeft = this._paddingLeft;\n }\n setPaddingBottom(_paddingBottom) {\n const paddingBottom = numberAsPixels(_paddingBottom);\n if (this._paddingBottom === paddingBottom) {\n return;\n }\n this._paddingBottom = paddingBottom;\n this.domNode.style.paddingBottom = this._paddingBottom;\n }\n setPaddingRight(_paddingRight) {\n const paddingRight = numberAsPixels(_paddingRight);\n if (this._paddingRight === paddingRight) {\n return;\n }\n this._paddingRight = paddingRight;\n this.domNode.style.paddingRight = this._paddingRight;\n }\n setFontFamily(fontFamily) {\n if (this._fontFamily === fontFamily) {\n return;\n }\n this._fontFamily = fontFamily;\n this.domNode.style.fontFamily = this._fontFamily;\n }\n setFontWeight(fontWeight) {\n if (this._fontWeight === fontWeight) {\n return;\n }\n this._fontWeight = fontWeight;\n this.domNode.style.fontWeight = this._fontWeight;\n }\n setFontSize(_fontSize) {\n const fontSize = numberAsPixels(_fontSize);\n if (this._fontSize === fontSize) {\n return;\n }\n this._fontSize = fontSize;\n this.domNode.style.fontSize = this._fontSize;\n }\n setFontStyle(fontStyle) {\n if (this._fontStyle === fontStyle) {\n return;\n }\n this._fontStyle = fontStyle;\n this.domNode.style.fontStyle = this._fontStyle;\n }\n setFontFeatureSettings(fontFeatureSettings) {\n if (this._fontFeatureSettings === fontFeatureSettings) {\n return;\n }\n this._fontFeatureSettings = fontFeatureSettings;\n this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;\n }\n setFontVariationSettings(fontVariationSettings) {\n if (this._fontVariationSettings === fontVariationSettings) {\n return;\n }\n this._fontVariationSettings = fontVariationSettings;\n this.domNode.style.fontVariationSettings = this._fontVariationSettings;\n }\n setTextDecoration(textDecoration) {\n if (this._textDecoration === textDecoration) {\n return;\n }\n this._textDecoration = textDecoration;\n this.domNode.style.textDecoration = this._textDecoration;\n }\n setLineHeight(_lineHeight) {\n const lineHeight = numberAsPixels(_lineHeight);\n if (this._lineHeight === lineHeight) {\n return;\n }\n this._lineHeight = lineHeight;\n this.domNode.style.lineHeight = this._lineHeight;\n }\n setLetterSpacing(_letterSpacing) {\n const letterSpacing = numberAsPixels(_letterSpacing);\n if (this._letterSpacing === letterSpacing) {\n return;\n }\n this._letterSpacing = letterSpacing;\n this.domNode.style.letterSpacing = this._letterSpacing;\n }\n setClassName(className) {\n if (this._className === className) {\n return;\n }\n this._className = className;\n this.domNode.className = this._className;\n }\n toggleClassName(className, shouldHaveIt) {\n this.domNode.classList.toggle(className, shouldHaveIt);\n this._className = this.domNode.className;\n }\n setDisplay(display) {\n if (this._display === display) {\n return;\n }\n this._display = display;\n this.domNode.style.display = this._display;\n }\n setPosition(position) {\n if (this._position === position) {\n return;\n }\n this._position = position;\n this.domNode.style.position = this._position;\n }\n setVisibility(visibility) {\n if (this._visibility === visibility) {\n return;\n }\n this._visibility = visibility;\n this.domNode.style.visibility = this._visibility;\n }\n setColor(color) {\n if (this._color === color) {\n return;\n }\n this._color = color;\n this.domNode.style.color = this._color;\n }\n setBackgroundColor(backgroundColor) {\n if (this._backgroundColor === backgroundColor) {\n return;\n }\n this._backgroundColor = backgroundColor;\n this.domNode.style.backgroundColor = this._backgroundColor;\n }\n setLayerHinting(layerHint) {\n if (this._layerHint === layerHint) {\n return;\n }\n this._layerHint = layerHint;\n this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';\n }\n setBoxShadow(boxShadow) {\n if (this._boxShadow === boxShadow) {\n return;\n }\n this._boxShadow = boxShadow;\n this.domNode.style.boxShadow = boxShadow;\n }\n setContain(contain) {\n if (this._contain === contain) {\n return;\n }\n this._contain = contain;\n this.domNode.style.contain = this._contain;\n }\n setAttribute(name, value) {\n this.domNode.setAttribute(name, value);\n }\n removeAttribute(name) {\n this.domNode.removeAttribute(name);\n }\n appendChild(child) {\n this.domNode.appendChild(child.domNode);\n }\n removeChild(child) {\n this.domNode.removeChild(child.domNode);\n }\n}\nfunction numberAsPixels(value) {\n return (typeof value === 'number' ? `${value}px` : value);\n}\nexport function createFastDomNode(domNode) {\n return new FastDomNode(domNode);\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 *--------------------------------------------------------------------------------------------*/\nimport { FastDomNode } from '../../../base/browser/fastDomNode.js';\nexport function applyFontInfo(domNode, fontInfo) {\n if (domNode instanceof FastDomNode) {\n domNode.setFontFamily(fontInfo.getMassagedFontFamily());\n domNode.setFontWeight(fontInfo.fontWeight);\n domNode.setFontSize(fontInfo.fontSize);\n domNode.setFontFeatureSettings(fontInfo.fontFeatureSettings);\n domNode.setFontVariationSettings(fontInfo.fontVariationSettings);\n domNode.setLineHeight(fontInfo.lineHeight);\n domNode.setLetterSpacing(fontInfo.letterSpacing);\n }\n else {\n domNode.style.fontFamily = fontInfo.getMassagedFontFamily();\n domNode.style.fontWeight = fontInfo.fontWeight;\n domNode.style.fontSize = fontInfo.fontSize + 'px';\n domNode.style.fontFeatureSettings = fontInfo.fontFeatureSettings;\n domNode.style.fontVariationSettings = fontInfo.fontVariationSettings;\n domNode.style.lineHeight = fontInfo.lineHeight + 'px';\n domNode.style.letterSpacing = fontInfo.letterSpacing + 'px';\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { $window } from '../../../base/browser/window.js';\nimport { applyFontInfo } from './domFontInfo.js';\nexport class CharWidthRequest {\n constructor(chr, type) {\n this.chr = chr;\n this.type = type;\n this.width = 0;\n }\n fulfill(width) {\n this.width = width;\n }\n}\nclass DomCharWidthReader {\n constructor(bareFontInfo, requests) {\n this._bareFontInfo = bareFontInfo;\n this._requests = requests;\n this._container = null;\n this._testElements = null;\n }\n read() {\n // Create a test container with all these test elements\n this._createDomElements();\n // Add the container to the DOM\n $window.document.body.appendChild(this._container);\n // Read character widths\n this._readFromDomElements();\n // Remove the container from the DOM\n $window.document.body.removeChild(this._container);\n this._container = null;\n this._testElements = null;\n }\n _createDomElements() {\n const container = document.createElement('div');\n container.style.position = 'absolute';\n container.style.top = '-50000px';\n container.style.width = '50000px';\n const regularDomNode = document.createElement('div');\n applyFontInfo(regularDomNode, this._bareFontInfo);\n container.appendChild(regularDomNode);\n const boldDomNode = document.createElement('div');\n applyFontInfo(boldDomNode, this._bareFontInfo);\n boldDomNode.style.fontWeight = 'bold';\n container.appendChild(boldDomNode);\n const italicDomNode = document.createElement('div');\n applyFontInfo(italicDomNode, this._bareFontInfo);\n italicDomNode.style.fontStyle = 'italic';\n container.appendChild(italicDomNode);\n const testElements = [];\n for (const request of this._requests) {\n let parent;\n if (request.type === 0 /* CharWidthRequestType.Regular */) {\n parent = regularDomNode;\n }\n if (request.type === 2 /* CharWidthRequestType.Bold */) {\n parent = boldDomNode;\n }\n if (request.type === 1 /* CharWidthRequestType.Italic */) {\n parent = italicDomNode;\n }\n parent.appendChild(document.createElement('br'));\n const testElement = document.createElement('span');\n DomCharWidthReader._render(testElement, request);\n parent.appendChild(testElement);\n testElements.push(testElement);\n }\n this._container = container;\n this._testElements = testElements;\n }\n static _render(testElement, request) {\n if (request.chr === ' ') {\n let htmlString = '\\u00a0';\n // Repeat character 256 (2^8) times\n for (let i = 0; i < 8; i++) {\n htmlString += htmlString;\n }\n testElement.innerText = htmlString;\n }\n else {\n let testString = request.chr;\n // Repeat character 256 (2^8) times\n for (let i = 0; i < 8; i++) {\n testString += testString;\n }\n testElement.textContent = testString;\n }\n }\n _readFromDomElements() {\n for (let i = 0, len = this._requests.length; i < len; i++) {\n const request = this._requests[i];\n const testElement = this._testElements[i];\n request.fulfill(testElement.offsetWidth / 256);\n }\n }\n}\nexport function readCharWidths(bareFontInfo, requests) {\n const reader = new DomCharWidthReader(bareFontInfo, requests);\n reader.read();\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 *--------------------------------------------------------------------------------------------*/\nexport const EDITOR_MODEL_DEFAULTS = {\n tabSize: 4,\n indentSize: 4,\n insertSpaces: true,\n detectIndentation: true,\n trimAutoWhitespace: true,\n largeFileOptimizations: true,\n bracketPairColorizationOptions: {\n enabled: true,\n independentColorPoolPerBracketType: false,\n },\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 *--------------------------------------------------------------------------------------------*/\nimport * as arrays from '../../../base/common/arrays.js';\nimport * as objects from '../../../base/common/objects.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { EDITOR_MODEL_DEFAULTS } from '../core/textModelDefaults.js';\nimport { USUAL_WORD_SEPARATORS } from '../core/wordHelper.js';\nimport * as nls from '../../../nls.js';\n/**\n * @internal\n * The width of the minimap gutter, in pixels.\n */\nexport const MINIMAP_GUTTER_WIDTH = 8;\n//#endregion\n/**\n * An event describing that the configuration of the editor has changed.\n */\nexport class ConfigurationChangedEvent {\n /**\n * @internal\n */\n constructor(values) {\n this._values = values;\n }\n hasChanged(id) {\n return this._values[id];\n }\n}\n/**\n * @internal\n */\nexport class ComputeOptionsMemory {\n constructor() {\n this.stableMinimapLayoutInput = null;\n this.stableFitMaxMinimapScale = 0;\n this.stableFitRemainingWidth = 0;\n }\n}\n/**\n * @internal\n */\nclass BaseEditorOption {\n constructor(id, name, defaultValue, schema) {\n this.id = id;\n this.name = name;\n this.defaultValue = defaultValue;\n this.schema = schema;\n }\n applyUpdate(value, update) {\n return applyUpdate(value, update);\n }\n compute(env, options, value) {\n return value;\n }\n}\nexport class ApplyUpdateResult {\n constructor(newValue, didChange) {\n this.newValue = newValue;\n this.didChange = didChange;\n }\n}\nfunction applyUpdate(value, update) {\n if (typeof value !== 'object' || typeof update !== 'object' || !value || !update) {\n return new ApplyUpdateResult(update, value !== update);\n }\n if (Array.isArray(value) || Array.isArray(update)) {\n const arrayEquals = Array.isArray(value) && Array.isArray(update) && arrays.equals(value, update);\n return new ApplyUpdateResult(update, !arrayEquals);\n }\n let didChange = false;\n for (const key in update) {\n if (update.hasOwnProperty(key)) {\n const result = applyUpdate(value[key], update[key]);\n if (result.didChange) {\n value[key] = result.newValue;\n didChange = true;\n }\n }\n }\n return new ApplyUpdateResult(value, didChange);\n}\n/**\n * @internal\n */\nclass ComputedEditorOption {\n constructor(id) {\n this.schema = undefined;\n this.id = id;\n this.name = '_never_';\n this.defaultValue = undefined;\n }\n applyUpdate(value, update) {\n return applyUpdate(value, update);\n }\n validate(input) {\n return this.defaultValue;\n }\n}\nclass SimpleEditorOption {\n constructor(id, name, defaultValue, schema) {\n this.id = id;\n this.name = name;\n this.defaultValue = defaultValue;\n this.schema = schema;\n }\n applyUpdate(value, update) {\n return applyUpdate(value, update);\n }\n validate(input) {\n if (typeof input === 'undefined') {\n return this.defaultValue;\n }\n return input;\n }\n compute(env, options, value) {\n return value;\n }\n}\n/**\n * @internal\n */\nexport function boolean(value, defaultValue) {\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n if (value === 'false') {\n // treat the string 'false' as false\n return false;\n }\n return Boolean(value);\n}\nclass EditorBooleanOption extends SimpleEditorOption {\n constructor(id, name, defaultValue, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'boolean';\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n }\n validate(input) {\n return boolean(input, this.defaultValue);\n }\n}\n/**\n * @internal\n */\nexport function clampedInt(value, defaultValue, minimum, maximum) {\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n let r = parseInt(value, 10);\n if (isNaN(r)) {\n return defaultValue;\n }\n r = Math.max(minimum, r);\n r = Math.min(maximum, r);\n return r | 0;\n}\nclass EditorIntOption extends SimpleEditorOption {\n static clampedInt(value, defaultValue, minimum, maximum) {\n return clampedInt(value, defaultValue, minimum, maximum);\n }\n constructor(id, name, defaultValue, minimum, maximum, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'integer';\n schema.default = defaultValue;\n schema.minimum = minimum;\n schema.maximum = maximum;\n }\n super(id, name, defaultValue, schema);\n this.minimum = minimum;\n this.maximum = maximum;\n }\n validate(input) {\n return EditorIntOption.clampedInt(input, this.defaultValue, this.minimum, this.maximum);\n }\n}\n/**\n * @internal\n */\nexport function clampedFloat(value, defaultValue, minimum, maximum) {\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n const r = EditorFloatOption.float(value, defaultValue);\n return EditorFloatOption.clamp(r, minimum, maximum);\n}\nclass EditorFloatOption extends SimpleEditorOption {\n static clamp(n, min, max) {\n if (n < min) {\n return min;\n }\n if (n > max) {\n return max;\n }\n return n;\n }\n static float(value, defaultValue) {\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n const r = parseFloat(value);\n return (isNaN(r) ? defaultValue : r);\n }\n constructor(id, name, defaultValue, validationFn, schema) {\n if (typeof schema !== 'undefined') {\n schema.type = 'number';\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n this.validationFn = validationFn;\n }\n validate(input) {\n return this.validationFn(EditorFloatOption.float(input, this.defaultValue));\n }\n}\nclass EditorStringOption extends SimpleEditorOption {\n static string(value, defaultValue) {\n if (typeof value !== 'string') {\n return defaultValue;\n }\n return value;\n }\n constructor(id, name, defaultValue, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'string';\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n }\n validate(input) {\n return EditorStringOption.string(input, this.defaultValue);\n }\n}\n/**\n * @internal\n */\nexport function stringSet(value, defaultValue, allowedValues, renamedValues) {\n if (typeof value !== 'string') {\n return defaultValue;\n }\n if (renamedValues && value in renamedValues) {\n return renamedValues[value];\n }\n if (allowedValues.indexOf(value) === -1) {\n return defaultValue;\n }\n return value;\n}\nclass EditorStringEnumOption extends SimpleEditorOption {\n constructor(id, name, defaultValue, allowedValues, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'string';\n schema.enum = allowedValues;\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n this._allowedValues = allowedValues;\n }\n validate(input) {\n return stringSet(input, this.defaultValue, this._allowedValues);\n }\n}\nclass EditorEnumOption extends BaseEditorOption {\n constructor(id, name, defaultValue, defaultStringValue, allowedValues, convert, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'string';\n schema.enum = allowedValues;\n schema.default = defaultStringValue;\n }\n super(id, name, defaultValue, schema);\n this._allowedValues = allowedValues;\n this._convert = convert;\n }\n validate(input) {\n if (typeof input !== 'string') {\n return this.defaultValue;\n }\n if (this._allowedValues.indexOf(input) === -1) {\n return this.defaultValue;\n }\n return this._convert(input);\n }\n}\n//#endregion\n//#region autoIndent\nfunction _autoIndentFromString(autoIndent) {\n switch (autoIndent) {\n case 'none': return 0 /* EditorAutoIndentStrategy.None */;\n case 'keep': return 1 /* EditorAutoIndentStrategy.Keep */;\n case 'brackets': return 2 /* EditorAutoIndentStrategy.Brackets */;\n case 'advanced': return 3 /* EditorAutoIndentStrategy.Advanced */;\n case 'full': return 4 /* EditorAutoIndentStrategy.Full */;\n }\n}\n//#endregion\n//#region accessibilitySupport\nclass EditorAccessibilitySupport extends BaseEditorOption {\n constructor() {\n super(2 /* EditorOption.accessibilitySupport */, 'accessibilitySupport', 0 /* AccessibilitySupport.Unknown */, {\n type: 'string',\n enum: ['auto', 'on', 'off'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'accessibilitySupport.auto', \"Use platform APIs to detect when a Screen Reader is attached.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'accessibilitySupport.on', \"Optimize for usage with a Screen Reader.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'accessibilitySupport.off', \"Assume a screen reader is not attached.\"),\n ],\n default: 'auto',\n tags: ['accessibility'],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'accessibilitySupport', \"Controls if the UI should run in a mode where it is optimized for screen readers.\")\n });\n }\n validate(input) {\n switch (input) {\n case 'auto': return 0 /* AccessibilitySupport.Unknown */;\n case 'off': return 1 /* AccessibilitySupport.Disabled */;\n case 'on': return 2 /* AccessibilitySupport.Enabled */;\n }\n return this.defaultValue;\n }\n compute(env, options, value) {\n if (value === 0 /* AccessibilitySupport.Unknown */) {\n // The editor reads the `accessibilitySupport` from the environment\n return env.accessibilitySupport;\n }\n return value;\n }\n}\nclass EditorComments extends BaseEditorOption {\n constructor() {\n const defaults = {\n insertSpace: true,\n ignoreEmptyLines: true,\n };\n super(23 /* EditorOption.comments */, 'comments', defaults, {\n 'editor.comments.insertSpace': {\n type: 'boolean',\n default: defaults.insertSpace,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'comments.insertSpace', \"Controls whether a space character is inserted when commenting.\")\n },\n 'editor.comments.ignoreEmptyLines': {\n type: 'boolean',\n default: defaults.ignoreEmptyLines,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'comments.ignoreEmptyLines', 'Controls if empty lines should be ignored with toggle, add or remove actions for line comments.')\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n insertSpace: boolean(input.insertSpace, this.defaultValue.insertSpace),\n ignoreEmptyLines: boolean(input.ignoreEmptyLines, this.defaultValue.ignoreEmptyLines),\n };\n }\n}\nfunction _cursorBlinkingStyleFromString(cursorBlinkingStyle) {\n switch (cursorBlinkingStyle) {\n case 'blink': return 1 /* TextEditorCursorBlinkingStyle.Blink */;\n case 'smooth': return 2 /* TextEditorCursorBlinkingStyle.Smooth */;\n case 'phase': return 3 /* TextEditorCursorBlinkingStyle.Phase */;\n case 'expand': return 4 /* TextEditorCursorBlinkingStyle.Expand */;\n case 'solid': return 5 /* TextEditorCursorBlinkingStyle.Solid */;\n }\n}\n//#endregion\n//#region cursorStyle\n/**\n * The style in which the editor's cursor should be rendered.\n */\nexport var TextEditorCursorStyle;\n(function (TextEditorCursorStyle) {\n /**\n * As a vertical line (sitting between two characters).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Line\"] = 1] = \"Line\";\n /**\n * As a block (sitting on top of a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Block\"] = 2] = \"Block\";\n /**\n * As a horizontal line (sitting under a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Underline\"] = 3] = \"Underline\";\n /**\n * As a thin vertical line (sitting between two characters).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"LineThin\"] = 4] = \"LineThin\";\n /**\n * As an outlined block (sitting on top of a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"BlockOutline\"] = 5] = \"BlockOutline\";\n /**\n * As a thin horizontal line (sitting under a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"UnderlineThin\"] = 6] = \"UnderlineThin\";\n})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));\n/**\n * @internal\n */\nexport function cursorStyleToString(cursorStyle) {\n switch (cursorStyle) {\n case TextEditorCursorStyle.Line: return 'line';\n case TextEditorCursorStyle.Block: return 'block';\n case TextEditorCursorStyle.Underline: return 'underline';\n case TextEditorCursorStyle.LineThin: return 'line-thin';\n case TextEditorCursorStyle.BlockOutline: return 'block-outline';\n case TextEditorCursorStyle.UnderlineThin: return 'underline-thin';\n }\n}\nfunction _cursorStyleFromString(cursorStyle) {\n switch (cursorStyle) {\n case 'line': return TextEditorCursorStyle.Line;\n case 'block': return TextEditorCursorStyle.Block;\n case 'underline': return TextEditorCursorStyle.Underline;\n case 'line-thin': return TextEditorCursorStyle.LineThin;\n case 'block-outline': return TextEditorCursorStyle.BlockOutline;\n case 'underline-thin': return TextEditorCursorStyle.UnderlineThin;\n }\n}\n//#endregion\n//#region editorClassName\nclass EditorClassName extends ComputedEditorOption {\n constructor() {\n super(140 /* EditorOption.editorClassName */);\n }\n compute(env, options, _) {\n const classNames = ['monaco-editor'];\n if (options.get(39 /* EditorOption.extraEditorClassName */)) {\n classNames.push(options.get(39 /* EditorOption.extraEditorClassName */));\n }\n if (env.extraEditorClassName) {\n classNames.push(env.extraEditorClassName);\n }\n if (options.get(73 /* EditorOption.mouseStyle */) === 'default') {\n classNames.push('mouse-default');\n }\n else if (options.get(73 /* EditorOption.mouseStyle */) === 'copy') {\n classNames.push('mouse-copy');\n }\n if (options.get(110 /* EditorOption.showUnused */)) {\n classNames.push('showUnused');\n }\n if (options.get(138 /* EditorOption.showDeprecated */)) {\n classNames.push('showDeprecated');\n }\n return classNames.join(' ');\n }\n}\n//#endregion\n//#region emptySelectionClipboard\nclass EditorEmptySelectionClipboard extends EditorBooleanOption {\n constructor() {\n super(37 /* EditorOption.emptySelectionClipboard */, 'emptySelectionClipboard', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'emptySelectionClipboard', \"Controls whether copying without a selection copies the current line.\") });\n }\n compute(env, options, value) {\n return value && env.emptySelectionClipboard;\n }\n}\nclass EditorFind extends BaseEditorOption {\n constructor() {\n const defaults = {\n cursorMoveOnType: true,\n seedSearchStringFromSelection: 'always',\n autoFindInSelection: 'never',\n globalFindClipboard: false,\n addExtraSpaceOnTop: true,\n loop: true\n };\n super(41 /* EditorOption.find */, 'find', defaults, {\n 'editor.find.cursorMoveOnType': {\n type: 'boolean',\n default: defaults.cursorMoveOnType,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'find.cursorMoveOnType', \"Controls whether the cursor should jump to find matches while typing.\")\n },\n 'editor.find.seedSearchStringFromSelection': {\n type: 'string',\n enum: ['never', 'always', 'selection'],\n default: defaults.seedSearchStringFromSelection,\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.find.seedSearchStringFromSelection.never', 'Never seed search string from the editor selection.'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.find.seedSearchStringFromSelection.always', 'Always seed search string from the editor selection, including word at cursor position.'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.find.seedSearchStringFromSelection.selection', 'Only seed search string from the editor selection.')\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'find.seedSearchStringFromSelection', \"Controls whether the search string in the Find Widget is seeded from the editor selection.\")\n },\n 'editor.find.autoFindInSelection': {\n type: 'string',\n enum: ['never', 'always', 'multiline'],\n default: defaults.autoFindInSelection,\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.find.autoFindInSelection.never', 'Never turn on Find in Selection automatically (default).'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.find.autoFindInSelection.always', 'Always turn on Find in Selection automatically.'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.find.autoFindInSelection.multiline', 'Turn on Find in Selection automatically when multiple lines of content are selected.')\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'find.autoFindInSelection', \"Controls the condition for turning on Find in Selection automatically.\")\n },\n 'editor.find.globalFindClipboard': {\n type: 'boolean',\n default: defaults.globalFindClipboard,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'find.globalFindClipboard', \"Controls whether the Find Widget should read or modify the shared find clipboard on macOS.\"),\n included: platform.isMacintosh\n },\n 'editor.find.addExtraSpaceOnTop': {\n type: 'boolean',\n default: defaults.addExtraSpaceOnTop,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'find.addExtraSpaceOnTop', \"Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.\")\n },\n 'editor.find.loop': {\n type: 'boolean',\n default: defaults.loop,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'find.loop', \"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n cursorMoveOnType: boolean(input.cursorMoveOnType, this.defaultValue.cursorMoveOnType),\n seedSearchStringFromSelection: typeof _input.seedSearchStringFromSelection === 'boolean'\n ? (_input.seedSearchStringFromSelection ? 'always' : 'never')\n : stringSet(input.seedSearchStringFromSelection, this.defaultValue.seedSearchStringFromSelection, ['never', 'always', 'selection']),\n autoFindInSelection: typeof _input.autoFindInSelection === 'boolean'\n ? (_input.autoFindInSelection ? 'always' : 'never')\n : stringSet(input.autoFindInSelection, this.defaultValue.autoFindInSelection, ['never', 'always', 'multiline']),\n globalFindClipboard: boolean(input.globalFindClipboard, this.defaultValue.globalFindClipboard),\n addExtraSpaceOnTop: boolean(input.addExtraSpaceOnTop, this.defaultValue.addExtraSpaceOnTop),\n loop: boolean(input.loop, this.defaultValue.loop),\n };\n }\n}\n//#endregion\n//#region fontLigatures\n/**\n * @internal\n */\nexport class EditorFontLigatures extends BaseEditorOption {\n constructor() {\n super(51 /* EditorOption.fontLigatures */, 'fontLigatures', EditorFontLigatures.OFF, {\n anyOf: [\n {\n type: 'boolean',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontLigatures', \"Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.\"),\n },\n {\n type: 'string',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontFeatureSettings', \"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.\")\n }\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontLigaturesGeneral', \"Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property.\"),\n default: false\n });\n }\n validate(input) {\n if (typeof input === 'undefined') {\n return this.defaultValue;\n }\n if (typeof input === 'string') {\n if (input === 'false') {\n return EditorFontLigatures.OFF;\n }\n if (input === 'true') {\n return EditorFontLigatures.ON;\n }\n return input;\n }\n if (Boolean(input)) {\n return EditorFontLigatures.ON;\n }\n return EditorFontLigatures.OFF;\n }\n}\nEditorFontLigatures.OFF = '\"liga\" off, \"calt\" off';\nEditorFontLigatures.ON = '\"liga\" on, \"calt\" on';\n//#endregion\n//#region fontVariations\n/**\n * @internal\n */\nexport class EditorFontVariations extends BaseEditorOption {\n constructor() {\n super(54 /* EditorOption.fontVariations */, 'fontVariations', EditorFontVariations.OFF, {\n anyOf: [\n {\n type: 'boolean',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontVariations', \"Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.\"),\n },\n {\n type: 'string',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontVariationSettings', \"Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.\")\n }\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontVariationsGeneral', \"Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property.\"),\n default: false\n });\n }\n validate(input) {\n if (typeof input === 'undefined') {\n return this.defaultValue;\n }\n if (typeof input === 'string') {\n if (input === 'false') {\n return EditorFontVariations.OFF;\n }\n if (input === 'true') {\n return EditorFontVariations.TRANSLATE;\n }\n return input;\n }\n if (Boolean(input)) {\n return EditorFontVariations.TRANSLATE;\n }\n return EditorFontVariations.OFF;\n }\n compute(env, options, value) {\n // The value is computed from the fontWeight if it is true.\n // So take the result from env.fontInfo\n return env.fontInfo.fontVariationSettings;\n }\n}\n// Text is laid out using default settings.\nEditorFontVariations.OFF = 'normal';\n// Translate `fontWeight` config to the `font-variation-settings` CSS property.\nEditorFontVariations.TRANSLATE = 'translate';\n//#endregion\n//#region fontInfo\nclass EditorFontInfo extends ComputedEditorOption {\n constructor() {\n super(50 /* EditorOption.fontInfo */);\n }\n compute(env, options, _) {\n return env.fontInfo;\n }\n}\n//#endregion\n//#region fontSize\nclass EditorFontSize extends SimpleEditorOption {\n constructor() {\n super(52 /* EditorOption.fontSize */, 'fontSize', EDITOR_FONT_DEFAULTS.fontSize, {\n type: 'number',\n minimum: 6,\n maximum: 100,\n default: EDITOR_FONT_DEFAULTS.fontSize,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontSize', \"Controls the font size in pixels.\")\n });\n }\n validate(input) {\n const r = EditorFloatOption.float(input, this.defaultValue);\n if (r === 0) {\n return EDITOR_FONT_DEFAULTS.fontSize;\n }\n return EditorFloatOption.clamp(r, 6, 100);\n }\n compute(env, options, value) {\n // The final fontSize respects the editor zoom level.\n // So take the result from env.fontInfo\n return env.fontInfo.fontSize;\n }\n}\n//#endregion\n//#region fontWeight\nclass EditorFontWeight extends BaseEditorOption {\n constructor() {\n super(53 /* EditorOption.fontWeight */, 'fontWeight', EDITOR_FONT_DEFAULTS.fontWeight, {\n anyOf: [\n {\n type: 'number',\n minimum: EditorFontWeight.MINIMUM_VALUE,\n maximum: EditorFontWeight.MAXIMUM_VALUE,\n errorMessage: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontWeightErrorMessage', \"Only \\\"normal\\\" and \\\"bold\\\" keywords or numbers between 1 and 1000 are allowed.\")\n },\n {\n type: 'string',\n pattern: '^(normal|bold|1000|[1-9][0-9]{0,2})$'\n },\n {\n enum: EditorFontWeight.SUGGESTION_VALUES\n }\n ],\n default: EDITOR_FONT_DEFAULTS.fontWeight,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontWeight', \"Controls the font weight. Accepts \\\"normal\\\" and \\\"bold\\\" keywords or numbers between 1 and 1000.\")\n });\n }\n validate(input) {\n if (input === 'normal' || input === 'bold') {\n return input;\n }\n return String(EditorIntOption.clampedInt(input, EDITOR_FONT_DEFAULTS.fontWeight, EditorFontWeight.MINIMUM_VALUE, EditorFontWeight.MAXIMUM_VALUE));\n }\n}\nEditorFontWeight.SUGGESTION_VALUES = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\nEditorFontWeight.MINIMUM_VALUE = 1;\nEditorFontWeight.MAXIMUM_VALUE = 1000;\nclass EditorGoToLocation extends BaseEditorOption {\n constructor() {\n const defaults = {\n multiple: 'peek',\n multipleDefinitions: 'peek',\n multipleTypeDefinitions: 'peek',\n multipleDeclarations: 'peek',\n multipleImplementations: 'peek',\n multipleReferences: 'peek',\n alternativeDefinitionCommand: 'editor.action.goToReferences',\n alternativeTypeDefinitionCommand: 'editor.action.goToReferences',\n alternativeDeclarationCommand: 'editor.action.goToReferences',\n alternativeImplementationCommand: '',\n alternativeReferenceCommand: '',\n };\n const jsonSubset = {\n type: 'string',\n enum: ['peek', 'gotoAndPeek', 'goto'],\n default: defaults.multiple,\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.gotoLocation.multiple.peek', 'Show Peek view of the results (default)'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a Peek view'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.gotoLocation.multiple.goto', 'Go to the primary result and enable Peek-less navigation to others')\n ]\n };\n const alternativeCommandOptions = ['', 'editor.action.referenceSearch.trigger', 'editor.action.goToReferences', 'editor.action.peekImplementation', 'editor.action.goToImplementation', 'editor.action.peekTypeDefinition', 'editor.action.goToTypeDefinition', 'editor.action.peekDeclaration', 'editor.action.revealDeclaration', 'editor.action.peekDefinition', 'editor.action.revealDefinitionAside', 'editor.action.revealDefinition'];\n super(58 /* EditorOption.gotoLocation */, 'gotoLocation', defaults, {\n 'editor.gotoLocation.multiple': {\n deprecationMessage: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.gotoLocation.multiple.deprecated', \"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.\"),\n },\n 'editor.gotoLocation.multipleDefinitions': {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.editor.gotoLocation.multipleDefinitions', \"Controls the behavior the 'Go to Definition'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleTypeDefinitions': {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.editor.gotoLocation.multipleTypeDefinitions', \"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleDeclarations': {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.editor.gotoLocation.multipleDeclarations', \"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleImplementations': {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.editor.gotoLocation.multipleImplemenattions', \"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleReferences': {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.editor.gotoLocation.multipleReferences', \"Controls the behavior the 'Go to References'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.alternativeDefinitionCommand': {\n type: 'string',\n default: defaults.alternativeDefinitionCommand,\n enum: alternativeCommandOptions,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'alternativeDefinitionCommand', \"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.\")\n },\n 'editor.gotoLocation.alternativeTypeDefinitionCommand': {\n type: 'string',\n default: defaults.alternativeTypeDefinitionCommand,\n enum: alternativeCommandOptions,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'alternativeTypeDefinitionCommand', \"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.\")\n },\n 'editor.gotoLocation.alternativeDeclarationCommand': {\n type: 'string',\n default: defaults.alternativeDeclarationCommand,\n enum: alternativeCommandOptions,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'alternativeDeclarationCommand', \"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.\")\n },\n 'editor.gotoLocation.alternativeImplementationCommand': {\n type: 'string',\n default: defaults.alternativeImplementationCommand,\n enum: alternativeCommandOptions,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'alternativeImplementationCommand', \"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.\")\n },\n 'editor.gotoLocation.alternativeReferenceCommand': {\n type: 'string',\n default: defaults.alternativeReferenceCommand,\n enum: alternativeCommandOptions,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'alternativeReferenceCommand', \"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n multiple: stringSet(input.multiple, this.defaultValue.multiple, ['peek', 'gotoAndPeek', 'goto']),\n multipleDefinitions: input.multipleDefinitions ?? stringSet(input.multipleDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleTypeDefinitions: input.multipleTypeDefinitions ?? stringSet(input.multipleTypeDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleDeclarations: input.multipleDeclarations ?? stringSet(input.multipleDeclarations, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleImplementations: input.multipleImplementations ?? stringSet(input.multipleImplementations, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleReferences: input.multipleReferences ?? stringSet(input.multipleReferences, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n alternativeDefinitionCommand: EditorStringOption.string(input.alternativeDefinitionCommand, this.defaultValue.alternativeDefinitionCommand),\n alternativeTypeDefinitionCommand: EditorStringOption.string(input.alternativeTypeDefinitionCommand, this.defaultValue.alternativeTypeDefinitionCommand),\n alternativeDeclarationCommand: EditorStringOption.string(input.alternativeDeclarationCommand, this.defaultValue.alternativeDeclarationCommand),\n alternativeImplementationCommand: EditorStringOption.string(input.alternativeImplementationCommand, this.defaultValue.alternativeImplementationCommand),\n alternativeReferenceCommand: EditorStringOption.string(input.alternativeReferenceCommand, this.defaultValue.alternativeReferenceCommand),\n };\n }\n}\nclass EditorHover extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n delay: 300,\n hidingDelay: 300,\n sticky: true,\n above: true,\n };\n super(60 /* EditorOption.hover */, 'hover', defaults, {\n 'editor.hover.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'hover.enabled', \"Controls whether the hover is shown.\")\n },\n 'editor.hover.delay': {\n type: 'number',\n default: defaults.delay,\n minimum: 0,\n maximum: 10000,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'hover.delay', \"Controls the delay in milliseconds after which the hover is shown.\")\n },\n 'editor.hover.sticky': {\n type: 'boolean',\n default: defaults.sticky,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'hover.sticky', \"Controls whether the hover should remain visible when mouse is moved over it.\")\n },\n 'editor.hover.hidingDelay': {\n type: 'integer',\n minimum: 0,\n default: defaults.hidingDelay,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'hover.hidingDelay', \"Controls the delay in milliseconds after which the hover is hidden. Requires `editor.hover.sticky` to be enabled.\")\n },\n 'editor.hover.above': {\n type: 'boolean',\n default: defaults.above,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'hover.above', \"Prefer showing hovers above the line, if there's space.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n delay: EditorIntOption.clampedInt(input.delay, this.defaultValue.delay, 0, 10000),\n sticky: boolean(input.sticky, this.defaultValue.sticky),\n hidingDelay: EditorIntOption.clampedInt(input.hidingDelay, this.defaultValue.hidingDelay, 0, 600000),\n above: boolean(input.above, this.defaultValue.above),\n };\n }\n}\n/**\n * @internal\n */\nexport class EditorLayoutInfoComputer extends ComputedEditorOption {\n constructor() {\n super(143 /* EditorOption.layoutInfo */);\n }\n compute(env, options, _) {\n return EditorLayoutInfoComputer.computeLayout(options, {\n memory: env.memory,\n outerWidth: env.outerWidth,\n outerHeight: env.outerHeight,\n isDominatedByLongLines: env.isDominatedByLongLines,\n lineHeight: env.fontInfo.lineHeight,\n viewLineCount: env.viewLineCount,\n lineNumbersDigitCount: env.lineNumbersDigitCount,\n typicalHalfwidthCharacterWidth: env.fontInfo.typicalHalfwidthCharacterWidth,\n maxDigitWidth: env.fontInfo.maxDigitWidth,\n pixelRatio: env.pixelRatio,\n glyphMarginDecorationLaneCount: env.glyphMarginDecorationLaneCount\n });\n }\n static computeContainedMinimapLineCount(input) {\n const typicalViewportLineCount = input.height / input.lineHeight;\n const extraLinesBeforeFirstLine = Math.floor(input.paddingTop / input.lineHeight);\n let extraLinesBeyondLastLine = Math.floor(input.paddingBottom / input.lineHeight);\n if (input.scrollBeyondLastLine) {\n extraLinesBeyondLastLine = Math.max(extraLinesBeyondLastLine, typicalViewportLineCount - 1);\n }\n const desiredRatio = (extraLinesBeforeFirstLine + input.viewLineCount + extraLinesBeyondLastLine) / (input.pixelRatio * input.height);\n const minimapLineCount = Math.floor(input.viewLineCount / desiredRatio);\n return { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount };\n }\n static _computeMinimapLayout(input, memory) {\n const outerWidth = input.outerWidth;\n const outerHeight = input.outerHeight;\n const pixelRatio = input.pixelRatio;\n if (!input.minimap.enabled) {\n return {\n renderMinimap: 0 /* RenderMinimap.None */,\n minimapLeft: 0,\n minimapWidth: 0,\n minimapHeightIsEditorHeight: false,\n minimapIsSampling: false,\n minimapScale: 1,\n minimapLineHeight: 1,\n minimapCanvasInnerWidth: 0,\n minimapCanvasInnerHeight: Math.floor(pixelRatio * outerHeight),\n minimapCanvasOuterWidth: 0,\n minimapCanvasOuterHeight: outerHeight,\n };\n }\n // Can use memory if only the `viewLineCount` and `remainingWidth` have changed\n const stableMinimapLayoutInput = memory.stableMinimapLayoutInput;\n const couldUseMemory = (stableMinimapLayoutInput\n // && input.outerWidth === lastMinimapLayoutInput.outerWidth !!! INTENTIONAL OMITTED\n && input.outerHeight === stableMinimapLayoutInput.outerHeight\n && input.lineHeight === stableMinimapLayoutInput.lineHeight\n && input.typicalHalfwidthCharacterWidth === stableMinimapLayoutInput.typicalHalfwidthCharacterWidth\n && input.pixelRatio === stableMinimapLayoutInput.pixelRatio\n && input.scrollBeyondLastLine === stableMinimapLayoutInput.scrollBeyondLastLine\n && input.paddingTop === stableMinimapLayoutInput.paddingTop\n && input.paddingBottom === stableMinimapLayoutInput.paddingBottom\n && input.minimap.enabled === stableMinimapLayoutInput.minimap.enabled\n && input.minimap.side === stableMinimapLayoutInput.minimap.side\n && input.minimap.size === stableMinimapLayoutInput.minimap.size\n && input.minimap.showSlider === stableMinimapLayoutInput.minimap.showSlider\n && input.minimap.renderCharacters === stableMinimapLayoutInput.minimap.renderCharacters\n && input.minimap.maxColumn === stableMinimapLayoutInput.minimap.maxColumn\n && input.minimap.scale === stableMinimapLayoutInput.minimap.scale\n && input.verticalScrollbarWidth === stableMinimapLayoutInput.verticalScrollbarWidth\n // && input.viewLineCount === lastMinimapLayoutInput.viewLineCount !!! INTENTIONAL OMITTED\n // && input.remainingWidth === lastMinimapLayoutInput.remainingWidth !!! INTENTIONAL OMITTED\n && input.isViewportWrapping === stableMinimapLayoutInput.isViewportWrapping);\n const lineHeight = input.lineHeight;\n const typicalHalfwidthCharacterWidth = input.typicalHalfwidthCharacterWidth;\n const scrollBeyondLastLine = input.scrollBeyondLastLine;\n const minimapRenderCharacters = input.minimap.renderCharacters;\n let minimapScale = (pixelRatio >= 2 ? Math.round(input.minimap.scale * 2) : input.minimap.scale);\n const minimapMaxColumn = input.minimap.maxColumn;\n const minimapSize = input.minimap.size;\n const minimapSide = input.minimap.side;\n const verticalScrollbarWidth = input.verticalScrollbarWidth;\n const viewLineCount = input.viewLineCount;\n const remainingWidth = input.remainingWidth;\n const isViewportWrapping = input.isViewportWrapping;\n const baseCharHeight = minimapRenderCharacters ? 2 : 3;\n let minimapCanvasInnerHeight = Math.floor(pixelRatio * outerHeight);\n const minimapCanvasOuterHeight = minimapCanvasInnerHeight / pixelRatio;\n let minimapHeightIsEditorHeight = false;\n let minimapIsSampling = false;\n let minimapLineHeight = baseCharHeight * minimapScale;\n let minimapCharWidth = minimapScale / pixelRatio;\n let minimapWidthMultiplier = 1;\n if (minimapSize === 'fill' || minimapSize === 'fit') {\n const { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount } = EditorLayoutInfoComputer.computeContainedMinimapLineCount({\n viewLineCount: viewLineCount,\n scrollBeyondLastLine: scrollBeyondLastLine,\n paddingTop: input.paddingTop,\n paddingBottom: input.paddingBottom,\n height: outerHeight,\n lineHeight: lineHeight,\n pixelRatio: pixelRatio\n });\n // ratio is intentionally not part of the layout to avoid the layout changing all the time\n // when doing sampling\n const ratio = viewLineCount / minimapLineCount;\n if (ratio > 1) {\n minimapHeightIsEditorHeight = true;\n minimapIsSampling = true;\n minimapScale = 1;\n minimapLineHeight = 1;\n minimapCharWidth = minimapScale / pixelRatio;\n }\n else {\n let fitBecomesFill = false;\n let maxMinimapScale = minimapScale + 1;\n if (minimapSize === 'fit') {\n const effectiveMinimapHeight = Math.ceil((extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight);\n if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {\n // There is a loop when using `fit` and viewport wrapping:\n // - view line count impacts minimap layout\n // - minimap layout impacts viewport width\n // - viewport width impacts view line count\n // To break the loop, once we go to a smaller minimap scale, we try to stick with it.\n fitBecomesFill = true;\n maxMinimapScale = memory.stableFitMaxMinimapScale;\n }\n else {\n fitBecomesFill = (effectiveMinimapHeight > minimapCanvasInnerHeight);\n }\n }\n if (minimapSize === 'fill' || fitBecomesFill) {\n minimapHeightIsEditorHeight = true;\n const configuredMinimapScale = minimapScale;\n minimapLineHeight = Math.min(lineHeight * pixelRatio, Math.max(1, Math.floor(1 / desiredRatio)));\n if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {\n // There is a loop when using `fill` and viewport wrapping:\n // - view line count impacts minimap layout\n // - minimap layout impacts viewport width\n // - viewport width impacts view line count\n // To break the loop, once we go to a smaller minimap scale, we try to stick with it.\n maxMinimapScale = memory.stableFitMaxMinimapScale;\n }\n minimapScale = Math.min(maxMinimapScale, Math.max(1, Math.floor(minimapLineHeight / baseCharHeight)));\n if (minimapScale > configuredMinimapScale) {\n minimapWidthMultiplier = Math.min(2, minimapScale / configuredMinimapScale);\n }\n minimapCharWidth = minimapScale / pixelRatio / minimapWidthMultiplier;\n minimapCanvasInnerHeight = Math.ceil((Math.max(typicalViewportLineCount, extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine)) * minimapLineHeight);\n if (isViewportWrapping) {\n // remember for next time\n memory.stableMinimapLayoutInput = input;\n memory.stableFitRemainingWidth = remainingWidth;\n memory.stableFitMaxMinimapScale = minimapScale;\n }\n else {\n memory.stableMinimapLayoutInput = null;\n memory.stableFitRemainingWidth = 0;\n }\n }\n }\n }\n // Given:\n // (leaving 2px for the cursor to have space after the last character)\n // viewportColumn = (contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth\n // minimapWidth = viewportColumn * minimapCharWidth\n // contentWidth = remainingWidth - minimapWidth\n // What are good values for contentWidth and minimapWidth ?\n // minimapWidth = ((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth) * minimapCharWidth\n // typicalHalfwidthCharacterWidth * minimapWidth = (contentWidth - verticalScrollbarWidth - 2) * minimapCharWidth\n // typicalHalfwidthCharacterWidth * minimapWidth = (remainingWidth - minimapWidth - verticalScrollbarWidth - 2) * minimapCharWidth\n // (typicalHalfwidthCharacterWidth + minimapCharWidth) * minimapWidth = (remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth\n // minimapWidth = ((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth)\n const minimapMaxWidth = Math.floor(minimapMaxColumn * minimapCharWidth);\n const minimapWidth = Math.min(minimapMaxWidth, Math.max(0, Math.floor(((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth))) + MINIMAP_GUTTER_WIDTH);\n let minimapCanvasInnerWidth = Math.floor(pixelRatio * minimapWidth);\n const minimapCanvasOuterWidth = minimapCanvasInnerWidth / pixelRatio;\n minimapCanvasInnerWidth = Math.floor(minimapCanvasInnerWidth * minimapWidthMultiplier);\n const renderMinimap = (minimapRenderCharacters ? 1 /* RenderMinimap.Text */ : 2 /* RenderMinimap.Blocks */);\n const minimapLeft = (minimapSide === 'left' ? 0 : (outerWidth - minimapWidth - verticalScrollbarWidth));\n return {\n renderMinimap,\n minimapLeft,\n minimapWidth,\n minimapHeightIsEditorHeight,\n minimapIsSampling,\n minimapScale,\n minimapLineHeight,\n minimapCanvasInnerWidth,\n minimapCanvasInnerHeight,\n minimapCanvasOuterWidth,\n minimapCanvasOuterHeight,\n };\n }\n static computeLayout(options, env) {\n const outerWidth = env.outerWidth | 0;\n const outerHeight = env.outerHeight | 0;\n const lineHeight = env.lineHeight | 0;\n const lineNumbersDigitCount = env.lineNumbersDigitCount | 0;\n const typicalHalfwidthCharacterWidth = env.typicalHalfwidthCharacterWidth;\n const maxDigitWidth = env.maxDigitWidth;\n const pixelRatio = env.pixelRatio;\n const viewLineCount = env.viewLineCount;\n const wordWrapOverride2 = options.get(135 /* EditorOption.wordWrapOverride2 */);\n const wordWrapOverride1 = (wordWrapOverride2 === 'inherit' ? options.get(134 /* EditorOption.wordWrapOverride1 */) : wordWrapOverride2);\n const wordWrap = (wordWrapOverride1 === 'inherit' ? options.get(130 /* EditorOption.wordWrap */) : wordWrapOverride1);\n const wordWrapColumn = options.get(133 /* EditorOption.wordWrapColumn */);\n const isDominatedByLongLines = env.isDominatedByLongLines;\n const showGlyphMargin = options.get(57 /* EditorOption.glyphMargin */);\n const showLineNumbers = (options.get(67 /* EditorOption.lineNumbers */).renderType !== 0 /* RenderLineNumbersType.Off */);\n const lineNumbersMinChars = options.get(68 /* EditorOption.lineNumbersMinChars */);\n const scrollBeyondLastLine = options.get(104 /* EditorOption.scrollBeyondLastLine */);\n const padding = options.get(83 /* EditorOption.padding */);\n const minimap = options.get(72 /* EditorOption.minimap */);\n const scrollbar = options.get(102 /* EditorOption.scrollbar */);\n const verticalScrollbarWidth = scrollbar.verticalScrollbarSize;\n const verticalScrollbarHasArrows = scrollbar.verticalHasArrows;\n const scrollbarArrowSize = scrollbar.arrowSize;\n const horizontalScrollbarHeight = scrollbar.horizontalScrollbarSize;\n const folding = options.get(43 /* EditorOption.folding */);\n const showFoldingDecoration = options.get(109 /* EditorOption.showFoldingControls */) !== 'never';\n let lineDecorationsWidth = options.get(65 /* EditorOption.lineDecorationsWidth */);\n if (folding && showFoldingDecoration) {\n lineDecorationsWidth += 16;\n }\n let lineNumbersWidth = 0;\n if (showLineNumbers) {\n const digitCount = Math.max(lineNumbersDigitCount, lineNumbersMinChars);\n lineNumbersWidth = Math.round(digitCount * maxDigitWidth);\n }\n let glyphMarginWidth = 0;\n if (showGlyphMargin) {\n glyphMarginWidth = lineHeight * env.glyphMarginDecorationLaneCount;\n }\n let glyphMarginLeft = 0;\n let lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;\n let decorationsLeft = lineNumbersLeft + lineNumbersWidth;\n let contentLeft = decorationsLeft + lineDecorationsWidth;\n const remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;\n let isWordWrapMinified = false;\n let isViewportWrapping = false;\n let wrappingColumn = -1;\n if (wordWrapOverride1 === 'inherit' && isDominatedByLongLines) {\n // Force viewport width wrapping if model is dominated by long lines\n isWordWrapMinified = true;\n isViewportWrapping = true;\n }\n else if (wordWrap === 'on' || wordWrap === 'bounded') {\n isViewportWrapping = true;\n }\n else if (wordWrap === 'wordWrapColumn') {\n wrappingColumn = wordWrapColumn;\n }\n const minimapLayout = EditorLayoutInfoComputer._computeMinimapLayout({\n outerWidth: outerWidth,\n outerHeight: outerHeight,\n lineHeight: lineHeight,\n typicalHalfwidthCharacterWidth: typicalHalfwidthCharacterWidth,\n pixelRatio: pixelRatio,\n scrollBeyondLastLine: scrollBeyondLastLine,\n paddingTop: padding.top,\n paddingBottom: padding.bottom,\n minimap: minimap,\n verticalScrollbarWidth: verticalScrollbarWidth,\n viewLineCount: viewLineCount,\n remainingWidth: remainingWidth,\n isViewportWrapping: isViewportWrapping,\n }, env.memory || new ComputeOptionsMemory());\n if (minimapLayout.renderMinimap !== 0 /* RenderMinimap.None */ && minimapLayout.minimapLeft === 0) {\n // the minimap is rendered to the left, so move everything to the right\n glyphMarginLeft += minimapLayout.minimapWidth;\n lineNumbersLeft += minimapLayout.minimapWidth;\n decorationsLeft += minimapLayout.minimapWidth;\n contentLeft += minimapLayout.minimapWidth;\n }\n const contentWidth = remainingWidth - minimapLayout.minimapWidth;\n // (leaving 2px for the cursor to have space after the last character)\n const viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth));\n const verticalArrowSize = (verticalScrollbarHasArrows ? scrollbarArrowSize : 0);\n if (isViewportWrapping) {\n // compute the actual wrappingColumn\n wrappingColumn = Math.max(1, viewportColumn);\n if (wordWrap === 'bounded') {\n wrappingColumn = Math.min(wrappingColumn, wordWrapColumn);\n }\n }\n return {\n width: outerWidth,\n height: outerHeight,\n glyphMarginLeft: glyphMarginLeft,\n glyphMarginWidth: glyphMarginWidth,\n glyphMarginDecorationLaneCount: env.glyphMarginDecorationLaneCount,\n lineNumbersLeft: lineNumbersLeft,\n lineNumbersWidth: lineNumbersWidth,\n decorationsLeft: decorationsLeft,\n decorationsWidth: lineDecorationsWidth,\n contentLeft: contentLeft,\n contentWidth: contentWidth,\n minimap: minimapLayout,\n viewportColumn: viewportColumn,\n isWordWrapMinified: isWordWrapMinified,\n isViewportWrapping: isViewportWrapping,\n wrappingColumn: wrappingColumn,\n verticalScrollbarWidth: verticalScrollbarWidth,\n horizontalScrollbarHeight: horizontalScrollbarHeight,\n overviewRuler: {\n top: verticalArrowSize,\n width: verticalScrollbarWidth,\n height: (outerHeight - 2 * verticalArrowSize),\n right: 0\n }\n };\n }\n}\n//#endregion\n//#region WrappingStrategy\nclass WrappingStrategy extends BaseEditorOption {\n constructor() {\n super(137 /* EditorOption.wrappingStrategy */, 'wrappingStrategy', 'simple', {\n 'editor.wrappingStrategy': {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingStrategy.simple', \"Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingStrategy.advanced', \"Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.\")\n ],\n type: 'string',\n enum: ['simple', 'advanced'],\n default: 'simple',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingStrategy', \"Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.\")\n }\n });\n }\n validate(input) {\n return stringSet(input, 'simple', ['simple', 'advanced']);\n }\n compute(env, options, value) {\n const accessibilitySupport = options.get(2 /* EditorOption.accessibilitySupport */);\n if (accessibilitySupport === 2 /* AccessibilitySupport.Enabled */) {\n // if we know for a fact that a screen reader is attached, we switch our strategy to advanced to\n // help that the editor's wrapping points match the textarea's wrapping points\n return 'advanced';\n }\n return value;\n }\n}\n//#endregion\n//#region lightbulb\nexport var ShowAiIconMode;\n(function (ShowAiIconMode) {\n ShowAiIconMode[\"Off\"] = \"off\";\n ShowAiIconMode[\"OnCode\"] = \"onCode\";\n ShowAiIconMode[\"On\"] = \"on\";\n})(ShowAiIconMode || (ShowAiIconMode = {}));\nclass EditorLightbulb extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: true, experimental: { showAiIcon: ShowAiIconMode.Off } };\n super(64 /* EditorOption.lightbulb */, 'lightbulb', defaults, {\n 'editor.lightbulb.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'codeActions', \"Enables the Code Action lightbulb in the editor.\")\n },\n 'editor.lightbulb.experimental.showAiIcon': {\n type: 'string',\n enum: [ShowAiIconMode.Off, ShowAiIconMode.OnCode, ShowAiIconMode.On],\n default: defaults.experimental.showAiIcon,\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.lightbulb.showAiIcon.off', 'Don not show the AI icon.'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.lightbulb.showAiIcon.onCode', 'Show an AI icon when the code action menu contains an AI action, but only on code.'),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.lightbulb.showAiIcon.on', 'Show an AI icon when the code action menu contains an AI action, on code and empty lines.'),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'showAiIcons', \"Show an AI icon along with the lightbulb when the code action menu contains an AI action.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n experimental: {\n showAiIcon: stringSet(input.experimental?.showAiIcon, this.defaultValue.experimental?.showAiIcon, [ShowAiIconMode.Off, ShowAiIconMode.OnCode, ShowAiIconMode.On])\n }\n };\n }\n}\nclass EditorStickyScroll extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: false, maxLineCount: 5, defaultModel: 'outlineModel', scrollWithEditor: true };\n super(114 /* EditorOption.stickyScroll */, 'stickyScroll', defaults, {\n 'editor.stickyScroll.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.stickyScroll.enabled', \"Shows the nested current scopes during the scroll at the top of the editor.\")\n },\n 'editor.stickyScroll.maxLineCount': {\n type: 'number',\n default: defaults.maxLineCount,\n minimum: 1,\n maximum: 10,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.stickyScroll.maxLineCount', \"Defines the maximum number of sticky lines to show.\")\n },\n 'editor.stickyScroll.defaultModel': {\n type: 'string',\n enum: ['outlineModel', 'foldingProviderModel', 'indentationModel'],\n default: defaults.defaultModel,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.stickyScroll.defaultModel', \"Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.\")\n },\n 'editor.stickyScroll.scrollWithEditor': {\n type: 'boolean',\n default: defaults.scrollWithEditor,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.stickyScroll.scrollWithEditor', \"Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n maxLineCount: EditorIntOption.clampedInt(input.maxLineCount, this.defaultValue.maxLineCount, 1, 10),\n defaultModel: stringSet(input.defaultModel, this.defaultValue.defaultModel, ['outlineModel', 'foldingProviderModel', 'indentationModel']),\n scrollWithEditor: boolean(input.scrollWithEditor, this.defaultValue.scrollWithEditor)\n };\n }\n}\nclass EditorInlayHints extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: 'on', fontSize: 0, fontFamily: '', padding: false };\n super(139 /* EditorOption.inlayHints */, 'inlayHints', defaults, {\n 'editor.inlayHints.enabled': {\n type: 'string',\n default: defaults.enabled,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlayHints.enable', \"Enables the inlay hints in the editor.\"),\n enum: ['on', 'onUnlessPressed', 'offUnlessPressed', 'off'],\n markdownEnumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.inlayHints.on', \"Inlay hints are enabled\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.inlayHints.onUnlessPressed', \"Inlay hints are showing by default and hide when holding {0}\", platform.isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.inlayHints.offUnlessPressed', \"Inlay hints are hidden by default and show when holding {0}\", platform.isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.inlayHints.off', \"Inlay hints are disabled\"),\n ],\n },\n 'editor.inlayHints.fontSize': {\n type: 'number',\n default: defaults.fontSize,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlayHints.fontSize', \"Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.\", '`#editor.fontSize#`', '`5`')\n },\n 'editor.inlayHints.fontFamily': {\n type: 'string',\n default: defaults.fontFamily,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlayHints.fontFamily', \"Controls font family of inlay hints in the editor. When set to empty, the {0} is used.\", '`#editor.fontFamily#`')\n },\n 'editor.inlayHints.padding': {\n type: 'boolean',\n default: defaults.padding,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlayHints.padding', \"Enables the padding around the inlay hints in the editor.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n if (typeof input.enabled === 'boolean') {\n input.enabled = input.enabled ? 'on' : 'off';\n }\n return {\n enabled: stringSet(input.enabled, this.defaultValue.enabled, ['on', 'off', 'offUnlessPressed', 'onUnlessPressed']),\n fontSize: EditorIntOption.clampedInt(input.fontSize, this.defaultValue.fontSize, 0, 100),\n fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily),\n padding: boolean(input.padding, this.defaultValue.padding)\n };\n }\n}\n//#endregion\n//#region lineDecorationsWidth\nclass EditorLineDecorationsWidth extends BaseEditorOption {\n constructor() {\n super(65 /* EditorOption.lineDecorationsWidth */, 'lineDecorationsWidth', 10);\n }\n validate(input) {\n if (typeof input === 'string' && /^\\d+(\\.\\d+)?ch$/.test(input)) {\n const multiple = parseFloat(input.substring(0, input.length - 2));\n return -multiple; // negative numbers signal a multiple\n }\n else {\n return EditorIntOption.clampedInt(input, this.defaultValue, 0, 1000);\n }\n }\n compute(env, options, value) {\n if (value < 0) {\n // negative numbers signal a multiple\n return EditorIntOption.clampedInt(-value * env.fontInfo.typicalHalfwidthCharacterWidth, this.defaultValue, 0, 1000);\n }\n else {\n return value;\n }\n }\n}\n//#endregion\n//#region lineHeight\nclass EditorLineHeight extends EditorFloatOption {\n constructor() {\n super(66 /* EditorOption.lineHeight */, 'lineHeight', EDITOR_FONT_DEFAULTS.lineHeight, x => EditorFloatOption.clamp(x, 0, 150), { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'lineHeight', \"Controls the line height. \\n - Use 0 to automatically compute the line height from the font size.\\n - Values between 0 and 8 will be used as a multiplier with the font size.\\n - Values greater than or equal to 8 will be used as effective values.\") });\n }\n compute(env, options, value) {\n // The lineHeight is computed from the fontSize if it is 0.\n // Moreover, the final lineHeight respects the editor zoom level.\n // So take the result from env.fontInfo\n return env.fontInfo.lineHeight;\n }\n}\nclass EditorMinimap extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n size: 'proportional',\n side: 'right',\n showSlider: 'mouseover',\n autohide: false,\n renderCharacters: true,\n maxColumn: 120,\n scale: 1,\n };\n super(72 /* EditorOption.minimap */, 'minimap', defaults, {\n 'editor.minimap.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.enabled', \"Controls whether the minimap is shown.\")\n },\n 'editor.minimap.autohide': {\n type: 'boolean',\n default: defaults.autohide,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.autohide', \"Controls whether the minimap is hidden automatically.\")\n },\n 'editor.minimap.size': {\n type: 'string',\n enum: ['proportional', 'fill', 'fit'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.size.proportional', \"The minimap has the same size as the editor contents (and might scroll).\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.size.fill', \"The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling).\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.size.fit', \"The minimap will shrink as necessary to never be larger than the editor (no scrolling).\"),\n ],\n default: defaults.size,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.size', \"Controls the size of the minimap.\")\n },\n 'editor.minimap.side': {\n type: 'string',\n enum: ['left', 'right'],\n default: defaults.side,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.side', \"Controls the side where to render the minimap.\")\n },\n 'editor.minimap.showSlider': {\n type: 'string',\n enum: ['always', 'mouseover'],\n default: defaults.showSlider,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.showSlider', \"Controls when the minimap slider is shown.\")\n },\n 'editor.minimap.scale': {\n type: 'number',\n default: defaults.scale,\n minimum: 1,\n maximum: 3,\n enum: [1, 2, 3],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.scale', \"Scale of content drawn in the minimap: 1, 2 or 3.\")\n },\n 'editor.minimap.renderCharacters': {\n type: 'boolean',\n default: defaults.renderCharacters,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.renderCharacters', \"Render the actual characters on a line as opposed to color blocks.\")\n },\n 'editor.minimap.maxColumn': {\n type: 'number',\n default: defaults.maxColumn,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'minimap.maxColumn', \"Limit the width of the minimap to render at most a certain number of columns.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n autohide: boolean(input.autohide, this.defaultValue.autohide),\n size: stringSet(input.size, this.defaultValue.size, ['proportional', 'fill', 'fit']),\n side: stringSet(input.side, this.defaultValue.side, ['right', 'left']),\n showSlider: stringSet(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']),\n renderCharacters: boolean(input.renderCharacters, this.defaultValue.renderCharacters),\n scale: EditorIntOption.clampedInt(input.scale, 1, 1, 3),\n maxColumn: EditorIntOption.clampedInt(input.maxColumn, this.defaultValue.maxColumn, 1, 10000),\n };\n }\n}\n//#endregion\n//#region multiCursorModifier\nfunction _multiCursorModifierFromString(multiCursorModifier) {\n if (multiCursorModifier === 'ctrlCmd') {\n return (platform.isMacintosh ? 'metaKey' : 'ctrlKey');\n }\n return 'altKey';\n}\nclass EditorPadding extends BaseEditorOption {\n constructor() {\n super(83 /* EditorOption.padding */, 'padding', { top: 0, bottom: 0 }, {\n 'editor.padding.top': {\n type: 'number',\n default: 0,\n minimum: 0,\n maximum: 1000,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'padding.top', \"Controls the amount of space between the top edge of the editor and the first line.\")\n },\n 'editor.padding.bottom': {\n type: 'number',\n default: 0,\n minimum: 0,\n maximum: 1000,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'padding.bottom', \"Controls the amount of space between the bottom edge of the editor and the last line.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n top: EditorIntOption.clampedInt(input.top, 0, 0, 1000),\n bottom: EditorIntOption.clampedInt(input.bottom, 0, 0, 1000)\n };\n }\n}\nclass EditorParameterHints extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n cycle: true\n };\n super(85 /* EditorOption.parameterHints */, 'parameterHints', defaults, {\n 'editor.parameterHints.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'parameterHints.enabled', \"Enables a pop-up that shows parameter documentation and type information as you type.\")\n },\n 'editor.parameterHints.cycle': {\n type: 'boolean',\n default: defaults.cycle,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'parameterHints.cycle', \"Controls whether the parameter hints menu cycles or closes when reaching the end of the list.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n cycle: boolean(input.cycle, this.defaultValue.cycle)\n };\n }\n}\n//#endregion\n//#region pixelRatio\nclass EditorPixelRatio extends ComputedEditorOption {\n constructor() {\n super(141 /* EditorOption.pixelRatio */);\n }\n compute(env, options, _) {\n return env.pixelRatio;\n }\n}\nclass EditorQuickSuggestions extends BaseEditorOption {\n constructor() {\n const defaults = {\n other: 'on',\n comments: 'off',\n strings: 'off'\n };\n const types = [\n { type: 'boolean' },\n {\n type: 'string',\n enum: ['on', 'inline', 'off'],\n enumDescriptions: [nls.localizeWithPath('vs/editor/common/config/editorOptions', 'on', \"Quick suggestions show inside the suggest widget\"), nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inline', \"Quick suggestions show as ghost text\"), nls.localizeWithPath('vs/editor/common/config/editorOptions', 'off', \"Quick suggestions are disabled\")]\n }\n ];\n super(88 /* EditorOption.quickSuggestions */, 'quickSuggestions', defaults, {\n type: 'object',\n additionalProperties: false,\n properties: {\n strings: {\n anyOf: types,\n default: defaults.strings,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'quickSuggestions.strings', \"Enable quick suggestions inside strings.\")\n },\n comments: {\n anyOf: types,\n default: defaults.comments,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'quickSuggestions.comments', \"Enable quick suggestions inside comments.\")\n },\n other: {\n anyOf: types,\n default: defaults.other,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'quickSuggestions.other', \"Enable quick suggestions outside of strings and comments.\")\n },\n },\n default: defaults,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'quickSuggestions', \"Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the '{0}'-setting which controls if suggestions are triggered by special characters.\", `#editor.suggestOnTriggerCharacters#`)\n });\n this.defaultValue = defaults;\n }\n validate(input) {\n if (typeof input === 'boolean') {\n // boolean -> all on/off\n const value = input ? 'on' : 'off';\n return { comments: value, strings: value, other: value };\n }\n if (!input || typeof input !== 'object') {\n // invalid object\n return this.defaultValue;\n }\n const { other, comments, strings } = input;\n const allowedValues = ['on', 'inline', 'off'];\n let validatedOther;\n let validatedComments;\n let validatedStrings;\n if (typeof other === 'boolean') {\n validatedOther = other ? 'on' : 'off';\n }\n else {\n validatedOther = stringSet(other, this.defaultValue.other, allowedValues);\n }\n if (typeof comments === 'boolean') {\n validatedComments = comments ? 'on' : 'off';\n }\n else {\n validatedComments = stringSet(comments, this.defaultValue.comments, allowedValues);\n }\n if (typeof strings === 'boolean') {\n validatedStrings = strings ? 'on' : 'off';\n }\n else {\n validatedStrings = stringSet(strings, this.defaultValue.strings, allowedValues);\n }\n return {\n other: validatedOther,\n comments: validatedComments,\n strings: validatedStrings\n };\n }\n}\nclass EditorRenderLineNumbersOption extends BaseEditorOption {\n constructor() {\n super(67 /* EditorOption.lineNumbers */, 'lineNumbers', { renderType: 1 /* RenderLineNumbersType.On */, renderFn: null }, {\n type: 'string',\n enum: ['off', 'on', 'relative', 'interval'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'lineNumbers.off', \"Line numbers are not rendered.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'lineNumbers.on', \"Line numbers are rendered as absolute number.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'lineNumbers.relative', \"Line numbers are rendered as distance in lines to cursor position.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'lineNumbers.interval', \"Line numbers are rendered every 10 lines.\")\n ],\n default: 'on',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'lineNumbers', \"Controls the display of line numbers.\")\n });\n }\n validate(lineNumbers) {\n let renderType = this.defaultValue.renderType;\n let renderFn = this.defaultValue.renderFn;\n if (typeof lineNumbers !== 'undefined') {\n if (typeof lineNumbers === 'function') {\n renderType = 4 /* RenderLineNumbersType.Custom */;\n renderFn = lineNumbers;\n }\n else if (lineNumbers === 'interval') {\n renderType = 3 /* RenderLineNumbersType.Interval */;\n }\n else if (lineNumbers === 'relative') {\n renderType = 2 /* RenderLineNumbersType.Relative */;\n }\n else if (lineNumbers === 'on') {\n renderType = 1 /* RenderLineNumbersType.On */;\n }\n else {\n renderType = 0 /* RenderLineNumbersType.Off */;\n }\n }\n return {\n renderType,\n renderFn\n };\n }\n}\n//#endregion\n//#region renderValidationDecorations\n/**\n * @internal\n */\nexport function filterValidationDecorations(options) {\n const renderValidationDecorations = options.get(97 /* EditorOption.renderValidationDecorations */);\n if (renderValidationDecorations === 'editable') {\n return options.get(90 /* EditorOption.readOnly */);\n }\n return renderValidationDecorations === 'on' ? false : true;\n}\nclass EditorRulers extends BaseEditorOption {\n constructor() {\n const defaults = [];\n const columnSchema = { type: 'number', description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'rulers.size', \"Number of monospace characters at which this editor ruler will render.\") };\n super(101 /* EditorOption.rulers */, 'rulers', defaults, {\n type: 'array',\n items: {\n anyOf: [\n columnSchema,\n {\n type: [\n 'object'\n ],\n properties: {\n column: columnSchema,\n color: {\n type: 'string',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'rulers.color', \"Color of this editor ruler.\"),\n format: 'color-hex'\n }\n }\n }\n ]\n },\n default: defaults,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'rulers', \"Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.\")\n });\n }\n validate(input) {\n if (Array.isArray(input)) {\n const rulers = [];\n for (const _element of input) {\n if (typeof _element === 'number') {\n rulers.push({\n column: EditorIntOption.clampedInt(_element, 0, 0, 10000),\n color: null\n });\n }\n else if (_element && typeof _element === 'object') {\n const element = _element;\n rulers.push({\n column: EditorIntOption.clampedInt(element.column, 0, 0, 10000),\n color: element.color\n });\n }\n }\n rulers.sort((a, b) => a.column - b.column);\n return rulers;\n }\n return this.defaultValue;\n }\n}\n//#endregion\n//#region readonly\n/**\n * Configuration options for readonly message\n */\nclass ReadonlyMessage extends BaseEditorOption {\n constructor() {\n const defaults = undefined;\n super(91 /* EditorOption.readOnlyMessage */, 'readOnlyMessage', defaults);\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n return _input;\n }\n}\nfunction _scrollbarVisibilityFromString(visibility, defaultValue) {\n if (typeof visibility !== 'string') {\n return defaultValue;\n }\n switch (visibility) {\n case 'hidden': return 2 /* ScrollbarVisibility.Hidden */;\n case 'visible': return 3 /* ScrollbarVisibility.Visible */;\n default: return 1 /* ScrollbarVisibility.Auto */;\n }\n}\nclass EditorScrollbar extends BaseEditorOption {\n constructor() {\n const defaults = {\n vertical: 1 /* ScrollbarVisibility.Auto */,\n horizontal: 1 /* ScrollbarVisibility.Auto */,\n arrowSize: 11,\n useShadows: true,\n verticalHasArrows: false,\n horizontalHasArrows: false,\n horizontalScrollbarSize: 12,\n horizontalSliderSize: 12,\n verticalScrollbarSize: 14,\n verticalSliderSize: 14,\n handleMouseWheel: true,\n alwaysConsumeMouseWheel: true,\n scrollByPage: false,\n ignoreHorizontalScrollbarInContentHeight: false,\n };\n super(102 /* EditorOption.scrollbar */, 'scrollbar', defaults, {\n 'editor.scrollbar.vertical': {\n type: 'string',\n enum: ['auto', 'visible', 'hidden'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.vertical.auto', \"The vertical scrollbar will be visible only when necessary.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.vertical.visible', \"The vertical scrollbar will always be visible.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.vertical.fit', \"The vertical scrollbar will always be hidden.\"),\n ],\n default: 'auto',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.vertical', \"Controls the visibility of the vertical scrollbar.\")\n },\n 'editor.scrollbar.horizontal': {\n type: 'string',\n enum: ['auto', 'visible', 'hidden'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.horizontal.auto', \"The horizontal scrollbar will be visible only when necessary.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.horizontal.visible', \"The horizontal scrollbar will always be visible.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.horizontal.fit', \"The horizontal scrollbar will always be hidden.\"),\n ],\n default: 'auto',\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.horizontal', \"Controls the visibility of the horizontal scrollbar.\")\n },\n 'editor.scrollbar.verticalScrollbarSize': {\n type: 'number',\n default: defaults.verticalScrollbarSize,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.verticalScrollbarSize', \"The width of the vertical scrollbar.\")\n },\n 'editor.scrollbar.horizontalScrollbarSize': {\n type: 'number',\n default: defaults.horizontalScrollbarSize,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.horizontalScrollbarSize', \"The height of the horizontal scrollbar.\")\n },\n 'editor.scrollbar.scrollByPage': {\n type: 'boolean',\n default: defaults.scrollByPage,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.scrollByPage', \"Controls whether clicks scroll by page or jump to click position.\")\n },\n 'editor.scrollbar.ignoreHorizontalScrollbarInContentHeight': {\n type: 'boolean',\n default: defaults.ignoreHorizontalScrollbarInContentHeight,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollbar.ignoreHorizontalScrollbarInContentHeight', \"When set, the horizontal scrollbar will not increase the size of the editor's content.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n const horizontalScrollbarSize = EditorIntOption.clampedInt(input.horizontalScrollbarSize, this.defaultValue.horizontalScrollbarSize, 0, 1000);\n const verticalScrollbarSize = EditorIntOption.clampedInt(input.verticalScrollbarSize, this.defaultValue.verticalScrollbarSize, 0, 1000);\n return {\n arrowSize: EditorIntOption.clampedInt(input.arrowSize, this.defaultValue.arrowSize, 0, 1000),\n vertical: _scrollbarVisibilityFromString(input.vertical, this.defaultValue.vertical),\n horizontal: _scrollbarVisibilityFromString(input.horizontal, this.defaultValue.horizontal),\n useShadows: boolean(input.useShadows, this.defaultValue.useShadows),\n verticalHasArrows: boolean(input.verticalHasArrows, this.defaultValue.verticalHasArrows),\n horizontalHasArrows: boolean(input.horizontalHasArrows, this.defaultValue.horizontalHasArrows),\n handleMouseWheel: boolean(input.handleMouseWheel, this.defaultValue.handleMouseWheel),\n alwaysConsumeMouseWheel: boolean(input.alwaysConsumeMouseWheel, this.defaultValue.alwaysConsumeMouseWheel),\n horizontalScrollbarSize: horizontalScrollbarSize,\n horizontalSliderSize: EditorIntOption.clampedInt(input.horizontalSliderSize, horizontalScrollbarSize, 0, 1000),\n verticalScrollbarSize: verticalScrollbarSize,\n verticalSliderSize: EditorIntOption.clampedInt(input.verticalSliderSize, verticalScrollbarSize, 0, 1000),\n scrollByPage: boolean(input.scrollByPage, this.defaultValue.scrollByPage),\n ignoreHorizontalScrollbarInContentHeight: boolean(input.ignoreHorizontalScrollbarInContentHeight, this.defaultValue.ignoreHorizontalScrollbarInContentHeight),\n };\n }\n}\n/**\n * @internal\n*/\nexport const inUntrustedWorkspace = 'inUntrustedWorkspace';\n/**\n * @internal\n */\nexport const unicodeHighlightConfigKeys = {\n allowedCharacters: 'editor.unicodeHighlight.allowedCharacters',\n invisibleCharacters: 'editor.unicodeHighlight.invisibleCharacters',\n nonBasicASCII: 'editor.unicodeHighlight.nonBasicASCII',\n ambiguousCharacters: 'editor.unicodeHighlight.ambiguousCharacters',\n includeComments: 'editor.unicodeHighlight.includeComments',\n includeStrings: 'editor.unicodeHighlight.includeStrings',\n allowedLocales: 'editor.unicodeHighlight.allowedLocales',\n};\nclass UnicodeHighlight extends BaseEditorOption {\n constructor() {\n const defaults = {\n nonBasicASCII: inUntrustedWorkspace,\n invisibleCharacters: true,\n ambiguousCharacters: true,\n includeComments: inUntrustedWorkspace,\n includeStrings: true,\n allowedCharacters: {},\n allowedLocales: { _os: true, _vscode: true },\n };\n super(124 /* EditorOption.unicodeHighlighting */, 'unicodeHighlight', defaults, {\n [unicodeHighlightConfigKeys.nonBasicASCII]: {\n restricted: true,\n type: ['boolean', 'string'],\n enum: [true, false, inUntrustedWorkspace],\n default: defaults.nonBasicASCII,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unicodeHighlight.nonBasicASCII', \"Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.\")\n },\n [unicodeHighlightConfigKeys.invisibleCharacters]: {\n restricted: true,\n type: 'boolean',\n default: defaults.invisibleCharacters,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unicodeHighlight.invisibleCharacters', \"Controls whether characters that just reserve space or have no width at all are highlighted.\")\n },\n [unicodeHighlightConfigKeys.ambiguousCharacters]: {\n restricted: true,\n type: 'boolean',\n default: defaults.ambiguousCharacters,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unicodeHighlight.ambiguousCharacters', \"Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.\")\n },\n [unicodeHighlightConfigKeys.includeComments]: {\n restricted: true,\n type: ['boolean', 'string'],\n enum: [true, false, inUntrustedWorkspace],\n default: defaults.includeComments,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unicodeHighlight.includeComments', \"Controls whether characters in comments should also be subject to Unicode highlighting.\")\n },\n [unicodeHighlightConfigKeys.includeStrings]: {\n restricted: true,\n type: ['boolean', 'string'],\n enum: [true, false, inUntrustedWorkspace],\n default: defaults.includeStrings,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unicodeHighlight.includeStrings', \"Controls whether characters in strings should also be subject to Unicode highlighting.\")\n },\n [unicodeHighlightConfigKeys.allowedCharacters]: {\n restricted: true,\n type: 'object',\n default: defaults.allowedCharacters,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unicodeHighlight.allowedCharacters', \"Defines allowed characters that are not being highlighted.\"),\n additionalProperties: {\n type: 'boolean'\n }\n },\n [unicodeHighlightConfigKeys.allowedLocales]: {\n restricted: true,\n type: 'object',\n additionalProperties: {\n type: 'boolean'\n },\n default: defaults.allowedLocales,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unicodeHighlight.allowedLocales', \"Unicode characters that are common in allowed locales are not being highlighted.\")\n },\n });\n }\n applyUpdate(value, update) {\n let didChange = false;\n if (update.allowedCharacters && value) {\n // Treat allowedCharacters atomically\n if (!objects.equals(value.allowedCharacters, update.allowedCharacters)) {\n value = { ...value, allowedCharacters: update.allowedCharacters };\n didChange = true;\n }\n }\n if (update.allowedLocales && value) {\n // Treat allowedLocales atomically\n if (!objects.equals(value.allowedLocales, update.allowedLocales)) {\n value = { ...value, allowedLocales: update.allowedLocales };\n didChange = true;\n }\n }\n const result = super.applyUpdate(value, update);\n if (didChange) {\n return new ApplyUpdateResult(result.newValue, true);\n }\n return result;\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n nonBasicASCII: primitiveSet(input.nonBasicASCII, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),\n invisibleCharacters: boolean(input.invisibleCharacters, this.defaultValue.invisibleCharacters),\n ambiguousCharacters: boolean(input.ambiguousCharacters, this.defaultValue.ambiguousCharacters),\n includeComments: primitiveSet(input.includeComments, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),\n includeStrings: primitiveSet(input.includeStrings, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),\n allowedCharacters: this.validateBooleanMap(_input.allowedCharacters, this.defaultValue.allowedCharacters),\n allowedLocales: this.validateBooleanMap(_input.allowedLocales, this.defaultValue.allowedLocales),\n };\n }\n validateBooleanMap(map, defaultValue) {\n if ((typeof map !== 'object') || !map) {\n return defaultValue;\n }\n const result = {};\n for (const [key, value] of Object.entries(map)) {\n if (value === true) {\n result[key] = true;\n }\n }\n return result;\n }\n}\n/**\n * Configuration options for inline suggestions\n */\nclass InlineEditorSuggest extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n mode: 'subwordSmart',\n showToolbar: 'onHover',\n suppressSuggestions: false,\n keepOnBlur: false,\n };\n super(62 /* EditorOption.inlineSuggest */, 'inlineSuggest', defaults, {\n 'editor.inlineSuggest.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlineSuggest.enabled', \"Controls whether to automatically show inline suggestions in the editor.\")\n },\n 'editor.inlineSuggest.showToolbar': {\n type: 'string',\n default: defaults.showToolbar,\n enum: ['always', 'onHover', 'never'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlineSuggest.showToolbar.always', \"Show the inline suggestion toolbar whenever an inline suggestion is shown.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlineSuggest.showToolbar.onHover', \"Show the inline suggestion toolbar when hovering over an inline suggestion.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlineSuggest.showToolbar.never', \"Never show the inline suggestion toolbar.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlineSuggest.showToolbar', \"Controls when to show the inline suggestion toolbar.\"),\n },\n 'editor.inlineSuggest.suppressSuggestions': {\n type: 'boolean',\n default: defaults.suppressSuggestions,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlineSuggest.suppressSuggestions', \"Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n mode: stringSet(input.mode, this.defaultValue.mode, ['prefix', 'subword', 'subwordSmart']),\n showToolbar: stringSet(input.showToolbar, this.defaultValue.showToolbar, ['always', 'onHover', 'never']),\n suppressSuggestions: boolean(input.suppressSuggestions, this.defaultValue.suppressSuggestions),\n keepOnBlur: boolean(input.keepOnBlur, this.defaultValue.keepOnBlur),\n };\n }\n}\n/**\n * Configuration options for inline suggestions\n */\nclass BracketPairColorization extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.enabled,\n independentColorPoolPerBracketType: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.independentColorPoolPerBracketType,\n };\n super(15 /* EditorOption.bracketPairColorization */, 'bracketPairColorization', defaults, {\n 'editor.bracketPairColorization.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'bracketPairColorization.enabled', \"Controls whether bracket pair colorization is enabled or not. Use {0} to override the bracket highlight colors.\", '`#workbench.colorCustomizations#`')\n },\n 'editor.bracketPairColorization.independentColorPoolPerBracketType': {\n type: 'boolean',\n default: defaults.independentColorPoolPerBracketType,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'bracketPairColorization.independentColorPoolPerBracketType', \"Controls whether each bracket type has its own independent color pool.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n independentColorPoolPerBracketType: boolean(input.independentColorPoolPerBracketType, this.defaultValue.independentColorPoolPerBracketType),\n };\n }\n}\n/**\n * Configuration options for inline suggestions\n */\nclass GuideOptions extends BaseEditorOption {\n constructor() {\n const defaults = {\n bracketPairs: false,\n bracketPairsHorizontal: 'active',\n highlightActiveBracketPair: true,\n indentation: true,\n highlightActiveIndentation: true\n };\n super(16 /* EditorOption.guides */, 'guides', defaults, {\n 'editor.guides.bracketPairs': {\n type: ['boolean', 'string'],\n enum: [true, 'active', false],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairs.true', \"Enables bracket pair guides.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairs.active', \"Enables bracket pair guides only for the active bracket pair.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairs.false', \"Disables bracket pair guides.\"),\n ],\n default: defaults.bracketPairs,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairs', \"Controls whether bracket pair guides are enabled or not.\")\n },\n 'editor.guides.bracketPairsHorizontal': {\n type: ['boolean', 'string'],\n enum: [true, 'active', false],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairsHorizontal.true', \"Enables horizontal guides as addition to vertical bracket pair guides.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairsHorizontal.active', \"Enables horizontal guides only for the active bracket pair.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairsHorizontal.false', \"Disables horizontal bracket pair guides.\"),\n ],\n default: defaults.bracketPairsHorizontal,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.bracketPairsHorizontal', \"Controls whether horizontal bracket pair guides are enabled or not.\")\n },\n 'editor.guides.highlightActiveBracketPair': {\n type: 'boolean',\n default: defaults.highlightActiveBracketPair,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.highlightActiveBracketPair', \"Controls whether the editor should highlight the active bracket pair.\")\n },\n 'editor.guides.indentation': {\n type: 'boolean',\n default: defaults.indentation,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.indentation', \"Controls whether the editor should render indent guides.\")\n },\n 'editor.guides.highlightActiveIndentation': {\n type: ['boolean', 'string'],\n enum: [true, 'always', false],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.highlightActiveIndentation.true', \"Highlights the active indent guide.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.highlightActiveIndentation.always', \"Highlights the active indent guide even if bracket guides are highlighted.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.highlightActiveIndentation.false', \"Do not highlight the active indent guide.\"),\n ],\n default: defaults.highlightActiveIndentation,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.guides.highlightActiveIndentation', \"Controls whether the editor should highlight the active indent guide.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n bracketPairs: primitiveSet(input.bracketPairs, this.defaultValue.bracketPairs, [true, false, 'active']),\n bracketPairsHorizontal: primitiveSet(input.bracketPairsHorizontal, this.defaultValue.bracketPairsHorizontal, [true, false, 'active']),\n highlightActiveBracketPair: boolean(input.highlightActiveBracketPair, this.defaultValue.highlightActiveBracketPair),\n indentation: boolean(input.indentation, this.defaultValue.indentation),\n highlightActiveIndentation: primitiveSet(input.highlightActiveIndentation, this.defaultValue.highlightActiveIndentation, [true, false, 'always']),\n };\n }\n}\nfunction primitiveSet(value, defaultValue, allowedValues) {\n const idx = allowedValues.indexOf(value);\n if (idx === -1) {\n return defaultValue;\n }\n return allowedValues[idx];\n}\nclass EditorSuggest extends BaseEditorOption {\n constructor() {\n const defaults = {\n insertMode: 'insert',\n filterGraceful: true,\n snippetsPreventQuickSuggestions: false,\n localityBonus: false,\n shareSuggestSelections: false,\n selectionMode: 'always',\n showIcons: true,\n showStatusBar: false,\n preview: false,\n previewMode: 'subwordSmart',\n showInlineDetails: true,\n showMethods: true,\n showFunctions: true,\n showConstructors: true,\n showDeprecated: true,\n matchOnWordStartOnly: true,\n showFields: true,\n showVariables: true,\n showClasses: true,\n showStructs: true,\n showInterfaces: true,\n showModules: true,\n showProperties: true,\n showEvents: true,\n showOperators: true,\n showUnits: true,\n showValues: true,\n showConstants: true,\n showEnums: true,\n showEnumMembers: true,\n showKeywords: true,\n showWords: true,\n showColors: true,\n showFiles: true,\n showReferences: true,\n showFolders: true,\n showTypeParameters: true,\n showSnippets: true,\n showUsers: true,\n showIssues: true,\n };\n super(117 /* EditorOption.suggest */, 'suggest', defaults, {\n 'editor.suggest.insertMode': {\n type: 'string',\n enum: ['insert', 'replace'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.insertMode.insert', \"Insert suggestion without overwriting text right of the cursor.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.insertMode.replace', \"Insert suggestion and overwrite text right of the cursor.\"),\n ],\n default: defaults.insertMode,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.insertMode', \"Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.\")\n },\n 'editor.suggest.filterGraceful': {\n type: 'boolean',\n default: defaults.filterGraceful,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.filterGraceful', \"Controls whether filtering and sorting suggestions accounts for small typos.\")\n },\n 'editor.suggest.localityBonus': {\n type: 'boolean',\n default: defaults.localityBonus,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.localityBonus', \"Controls whether sorting favors words that appear close to the cursor.\")\n },\n 'editor.suggest.shareSuggestSelections': {\n type: 'boolean',\n default: defaults.shareSuggestSelections,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.shareSuggestSelections', \"Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).\")\n },\n 'editor.suggest.selectionMode': {\n type: 'string',\n enum: ['always', 'never', 'whenTriggerCharacter', 'whenQuickSuggestion'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.insertMode.always', \"Always select a suggestion when automatically triggering IntelliSense.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.insertMode.never', \"Never select a suggestion when automatically triggering IntelliSense.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.insertMode.whenTriggerCharacter', \"Select a suggestion only when triggering IntelliSense from a trigger character.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.insertMode.whenQuickSuggestion', \"Select a suggestion only when triggering IntelliSense as you type.\"),\n ],\n default: defaults.selectionMode,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.selectionMode', \"Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions (`#editor.quickSuggestions#` and `#editor.suggestOnTriggerCharacters#`) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.\")\n },\n 'editor.suggest.snippetsPreventQuickSuggestions': {\n type: 'boolean',\n default: defaults.snippetsPreventQuickSuggestions,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.snippetsPreventQuickSuggestions', \"Controls whether an active snippet prevents quick suggestions.\")\n },\n 'editor.suggest.showIcons': {\n type: 'boolean',\n default: defaults.showIcons,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.showIcons', \"Controls whether to show or hide icons in suggestions.\")\n },\n 'editor.suggest.showStatusBar': {\n type: 'boolean',\n default: defaults.showStatusBar,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.showStatusBar', \"Controls the visibility of the status bar at the bottom of the suggest widget.\")\n },\n 'editor.suggest.preview': {\n type: 'boolean',\n default: defaults.preview,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.preview', \"Controls whether to preview the suggestion outcome in the editor.\")\n },\n 'editor.suggest.showInlineDetails': {\n type: 'boolean',\n default: defaults.showInlineDetails,\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.showInlineDetails', \"Controls whether suggest details show inline with the label or only in the details widget.\")\n },\n 'editor.suggest.maxVisibleSuggestions': {\n type: 'number',\n deprecationMessage: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggest.maxVisibleSuggestions.dep', \"This setting is deprecated. The suggest widget can now be resized.\"),\n },\n 'editor.suggest.filteredTypes': {\n type: 'object',\n deprecationMessage: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'deprecated', \"This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.\")\n },\n 'editor.suggest.showMethods': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showMethods', \"When enabled IntelliSense shows `method`-suggestions.\")\n },\n 'editor.suggest.showFunctions': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showFunctions', \"When enabled IntelliSense shows `function`-suggestions.\")\n },\n 'editor.suggest.showConstructors': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showConstructors', \"When enabled IntelliSense shows `constructor`-suggestions.\")\n },\n 'editor.suggest.showDeprecated': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showDeprecated', \"When enabled IntelliSense shows `deprecated`-suggestions.\")\n },\n 'editor.suggest.matchOnWordStartOnly': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.matchOnWordStartOnly', \"When enabled IntelliSense filtering requires that the first character matches on a word start. For example, `c` on `Console` or `WebContext` but _not_ on `description`. When disabled IntelliSense will show more results but still sorts them by match quality.\")\n },\n 'editor.suggest.showFields': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showFields', \"When enabled IntelliSense shows `field`-suggestions.\")\n },\n 'editor.suggest.showVariables': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showVariables', \"When enabled IntelliSense shows `variable`-suggestions.\")\n },\n 'editor.suggest.showClasses': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showClasss', \"When enabled IntelliSense shows `class`-suggestions.\")\n },\n 'editor.suggest.showStructs': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showStructs', \"When enabled IntelliSense shows `struct`-suggestions.\")\n },\n 'editor.suggest.showInterfaces': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showInterfaces', \"When enabled IntelliSense shows `interface`-suggestions.\")\n },\n 'editor.suggest.showModules': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showModules', \"When enabled IntelliSense shows `module`-suggestions.\")\n },\n 'editor.suggest.showProperties': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showPropertys', \"When enabled IntelliSense shows `property`-suggestions.\")\n },\n 'editor.suggest.showEvents': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showEvents', \"When enabled IntelliSense shows `event`-suggestions.\")\n },\n 'editor.suggest.showOperators': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showOperators', \"When enabled IntelliSense shows `operator`-suggestions.\")\n },\n 'editor.suggest.showUnits': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showUnits', \"When enabled IntelliSense shows `unit`-suggestions.\")\n },\n 'editor.suggest.showValues': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showValues', \"When enabled IntelliSense shows `value`-suggestions.\")\n },\n 'editor.suggest.showConstants': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showConstants', \"When enabled IntelliSense shows `constant`-suggestions.\")\n },\n 'editor.suggest.showEnums': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showEnums', \"When enabled IntelliSense shows `enum`-suggestions.\")\n },\n 'editor.suggest.showEnumMembers': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showEnumMembers', \"When enabled IntelliSense shows `enumMember`-suggestions.\")\n },\n 'editor.suggest.showKeywords': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showKeywords', \"When enabled IntelliSense shows `keyword`-suggestions.\")\n },\n 'editor.suggest.showWords': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showTexts', \"When enabled IntelliSense shows `text`-suggestions.\")\n },\n 'editor.suggest.showColors': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showColors', \"When enabled IntelliSense shows `color`-suggestions.\")\n },\n 'editor.suggest.showFiles': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showFiles', \"When enabled IntelliSense shows `file`-suggestions.\")\n },\n 'editor.suggest.showReferences': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showReferences', \"When enabled IntelliSense shows `reference`-suggestions.\")\n },\n 'editor.suggest.showCustomcolors': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showCustomcolors', \"When enabled IntelliSense shows `customcolor`-suggestions.\")\n },\n 'editor.suggest.showFolders': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showFolders', \"When enabled IntelliSense shows `folder`-suggestions.\")\n },\n 'editor.suggest.showTypeParameters': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showTypeParameters', \"When enabled IntelliSense shows `typeParameter`-suggestions.\")\n },\n 'editor.suggest.showSnippets': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showSnippets', \"When enabled IntelliSense shows `snippet`-suggestions.\")\n },\n 'editor.suggest.showUsers': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showUsers', \"When enabled IntelliSense shows `user`-suggestions.\")\n },\n 'editor.suggest.showIssues': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.suggest.showIssues', \"When enabled IntelliSense shows `issues`-suggestions.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n insertMode: stringSet(input.insertMode, this.defaultValue.insertMode, ['insert', 'replace']),\n filterGraceful: boolean(input.filterGraceful, this.defaultValue.filterGraceful),\n snippetsPreventQuickSuggestions: boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),\n localityBonus: boolean(input.localityBonus, this.defaultValue.localityBonus),\n shareSuggestSelections: boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),\n selectionMode: stringSet(input.selectionMode, this.defaultValue.selectionMode, ['always', 'never', 'whenQuickSuggestion', 'whenTriggerCharacter']),\n showIcons: boolean(input.showIcons, this.defaultValue.showIcons),\n showStatusBar: boolean(input.showStatusBar, this.defaultValue.showStatusBar),\n preview: boolean(input.preview, this.defaultValue.preview),\n previewMode: stringSet(input.previewMode, this.defaultValue.previewMode, ['prefix', 'subword', 'subwordSmart']),\n showInlineDetails: boolean(input.showInlineDetails, this.defaultValue.showInlineDetails),\n showMethods: boolean(input.showMethods, this.defaultValue.showMethods),\n showFunctions: boolean(input.showFunctions, this.defaultValue.showFunctions),\n showConstructors: boolean(input.showConstructors, this.defaultValue.showConstructors),\n showDeprecated: boolean(input.showDeprecated, this.defaultValue.showDeprecated),\n matchOnWordStartOnly: boolean(input.matchOnWordStartOnly, this.defaultValue.matchOnWordStartOnly),\n showFields: boolean(input.showFields, this.defaultValue.showFields),\n showVariables: boolean(input.showVariables, this.defaultValue.showVariables),\n showClasses: boolean(input.showClasses, this.defaultValue.showClasses),\n showStructs: boolean(input.showStructs, this.defaultValue.showStructs),\n showInterfaces: boolean(input.showInterfaces, this.defaultValue.showInterfaces),\n showModules: boolean(input.showModules, this.defaultValue.showModules),\n showProperties: boolean(input.showProperties, this.defaultValue.showProperties),\n showEvents: boolean(input.showEvents, this.defaultValue.showEvents),\n showOperators: boolean(input.showOperators, this.defaultValue.showOperators),\n showUnits: boolean(input.showUnits, this.defaultValue.showUnits),\n showValues: boolean(input.showValues, this.defaultValue.showValues),\n showConstants: boolean(input.showConstants, this.defaultValue.showConstants),\n showEnums: boolean(input.showEnums, this.defaultValue.showEnums),\n showEnumMembers: boolean(input.showEnumMembers, this.defaultValue.showEnumMembers),\n showKeywords: boolean(input.showKeywords, this.defaultValue.showKeywords),\n showWords: boolean(input.showWords, this.defaultValue.showWords),\n showColors: boolean(input.showColors, this.defaultValue.showColors),\n showFiles: boolean(input.showFiles, this.defaultValue.showFiles),\n showReferences: boolean(input.showReferences, this.defaultValue.showReferences),\n showFolders: boolean(input.showFolders, this.defaultValue.showFolders),\n showTypeParameters: boolean(input.showTypeParameters, this.defaultValue.showTypeParameters),\n showSnippets: boolean(input.showSnippets, this.defaultValue.showSnippets),\n showUsers: boolean(input.showUsers, this.defaultValue.showUsers),\n showIssues: boolean(input.showIssues, this.defaultValue.showIssues),\n };\n }\n}\nclass SmartSelect extends BaseEditorOption {\n constructor() {\n super(112 /* EditorOption.smartSelect */, 'smartSelect', {\n selectLeadingAndTrailingWhitespace: true,\n selectSubwords: true,\n }, {\n 'editor.smartSelect.selectLeadingAndTrailingWhitespace': {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'selectLeadingAndTrailingWhitespace', \"Whether leading and trailing whitespace should always be selected.\"),\n default: true,\n type: 'boolean'\n },\n 'editor.smartSelect.selectSubwords': {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'selectSubwords', \"Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected.\"),\n default: true,\n type: 'boolean'\n }\n });\n }\n validate(input) {\n if (!input || typeof input !== 'object') {\n return this.defaultValue;\n }\n return {\n selectLeadingAndTrailingWhitespace: boolean(input.selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace),\n selectSubwords: boolean(input.selectSubwords, this.defaultValue.selectSubwords),\n };\n }\n}\nclass WrappingIndentOption extends BaseEditorOption {\n constructor() {\n super(136 /* EditorOption.wrappingIndent */, 'wrappingIndent', 1 /* WrappingIndent.Same */, {\n 'editor.wrappingIndent': {\n type: 'string',\n enum: ['none', 'same', 'indent', 'deepIndent'],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingIndent.none', \"No indentation. Wrapped lines begin at column 1.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingIndent.same', \"Wrapped lines get the same indentation as the parent.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingIndent.indent', \"Wrapped lines get +1 indentation toward the parent.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingIndent.deepIndent', \"Wrapped lines get +2 indentation toward the parent.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wrappingIndent', \"Controls the indentation of wrapped lines.\"),\n default: 'same'\n }\n });\n }\n validate(input) {\n switch (input) {\n case 'none': return 0 /* WrappingIndent.None */;\n case 'same': return 1 /* WrappingIndent.Same */;\n case 'indent': return 2 /* WrappingIndent.Indent */;\n case 'deepIndent': return 3 /* WrappingIndent.DeepIndent */;\n }\n return 1 /* WrappingIndent.Same */;\n }\n compute(env, options, value) {\n const accessibilitySupport = options.get(2 /* EditorOption.accessibilitySupport */);\n if (accessibilitySupport === 2 /* AccessibilitySupport.Enabled */) {\n // if we know for a fact that a screen reader is attached, we use no indent wrapping to\n // help that the editor's wrapping points match the textarea's wrapping points\n return 0 /* WrappingIndent.None */;\n }\n return value;\n }\n}\nclass EditorWrappingInfoComputer extends ComputedEditorOption {\n constructor() {\n super(144 /* EditorOption.wrappingInfo */);\n }\n compute(env, options, _) {\n const layoutInfo = options.get(143 /* EditorOption.layoutInfo */);\n return {\n isDominatedByLongLines: env.isDominatedByLongLines,\n isWordWrapMinified: layoutInfo.isWordWrapMinified,\n isViewportWrapping: layoutInfo.isViewportWrapping,\n wrappingColumn: layoutInfo.wrappingColumn,\n };\n }\n}\nclass EditorDropIntoEditor extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: true, showDropSelector: 'afterDrop' };\n super(36 /* EditorOption.dropIntoEditor */, 'dropIntoEditor', defaults, {\n 'editor.dropIntoEditor.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'dropIntoEditor.enabled', \"Controls whether you can drag and drop a file into a text editor by holding down `Shift`-key (instead of opening the file in an editor).\"),\n },\n 'editor.dropIntoEditor.showDropSelector': {\n type: 'string',\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'dropIntoEditor.showDropSelector', \"Controls if a widget is shown when dropping files into the editor. This widget lets you control how the file is dropped.\"),\n enum: [\n 'afterDrop',\n 'never'\n ],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'dropIntoEditor.showDropSelector.afterDrop', \"Show the drop selector widget after a file is dropped into the editor.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'dropIntoEditor.showDropSelector.never', \"Never show the drop selector widget. Instead the default drop provider is always used.\"),\n ],\n default: 'afterDrop',\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n showDropSelector: stringSet(input.showDropSelector, this.defaultValue.showDropSelector, ['afterDrop', 'never']),\n };\n }\n}\nclass EditorPasteAs extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: true, showPasteSelector: 'afterPaste' };\n super(84 /* EditorOption.pasteAs */, 'pasteAs', defaults, {\n 'editor.pasteAs.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'pasteAs.enabled', \"Controls whether you can paste content in different ways.\"),\n },\n 'editor.pasteAs.showPasteSelector': {\n type: 'string',\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'pasteAs.showPasteSelector', \"Controls if a widget is shown when pasting content in to the editor. This widget lets you control how the file is pasted.\"),\n enum: [\n 'afterPaste',\n 'never'\n ],\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'pasteAs.showPasteSelector.afterPaste', \"Show the paste selector widget after content is pasted into the editor.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'pasteAs.showPasteSelector.never', \"Never show the paste selector widget. Instead the default pasting behavior is always used.\"),\n ],\n default: 'afterPaste',\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n showPasteSelector: stringSet(input.showPasteSelector, this.defaultValue.showPasteSelector, ['afterPaste', 'never']),\n };\n }\n}\n//#endregion\nconst DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \\'Courier New\\', monospace';\nconst DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \\'Courier New\\', monospace';\nconst DEFAULT_LINUX_FONT_FAMILY = '\\'Droid Sans Mono\\', \\'monospace\\', monospace';\n/**\n * @internal\n */\nexport const EDITOR_FONT_DEFAULTS = {\n fontFamily: (platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)),\n fontWeight: 'normal',\n fontSize: (platform.isMacintosh ? 12 : 14),\n lineHeight: 0,\n letterSpacing: 0,\n};\n/**\n * @internal\n */\nexport const editorOptionsRegistry = [];\nfunction register(option) {\n editorOptionsRegistry[option.id] = option;\n return option;\n}\nexport const EditorOptions = {\n acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(0 /* EditorOption.acceptSuggestionOnCommitCharacter */, 'acceptSuggestionOnCommitCharacter', true, { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'acceptSuggestionOnCommitCharacter', \"Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.\") })),\n acceptSuggestionOnEnter: register(new EditorStringEnumOption(1 /* EditorOption.acceptSuggestionOnEnter */, 'acceptSuggestionOnEnter', 'on', ['on', 'smart', 'off'], {\n markdownEnumDescriptions: [\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'acceptSuggestionOnEnterSmart', \"Only accept a suggestion with `Enter` when it makes a textual change.\"),\n ''\n ],\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'acceptSuggestionOnEnter', \"Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.\")\n })),\n accessibilitySupport: register(new EditorAccessibilitySupport()),\n accessibilityPageSize: register(new EditorIntOption(3 /* EditorOption.accessibilityPageSize */, 'accessibilityPageSize', 10, 1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'accessibilityPageSize', \"Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default.\"),\n tags: ['accessibility']\n })),\n ariaLabel: register(new EditorStringOption(4 /* EditorOption.ariaLabel */, 'ariaLabel', nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editorViewAccessibleLabel', \"Editor content\"))),\n ariaRequired: register(new EditorBooleanOption(5 /* EditorOption.ariaRequired */, 'ariaRequired', false, undefined)),\n screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(8 /* EditorOption.screenReaderAnnounceInlineSuggestion */, 'screenReaderAnnounceInlineSuggestion', true, {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'screenReaderAnnounceInlineSuggestion', \"Control whether inline suggestions are announced by a screen reader.\"),\n tags: ['accessibility']\n })),\n autoClosingBrackets: register(new EditorStringEnumOption(6 /* EditorOption.autoClosingBrackets */, 'autoClosingBrackets', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\n enumDescriptions: [\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingBrackets.languageDefined', \"Use language configurations to determine when to autoclose brackets.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingBrackets.beforeWhitespace', \"Autoclose brackets only when the cursor is to the left of whitespace.\"),\n '',\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'autoClosingBrackets', \"Controls whether the editor should automatically close brackets after the user adds an opening bracket.\")\n })),\n autoClosingComments: register(new EditorStringEnumOption(7 /* EditorOption.autoClosingComments */, 'autoClosingComments', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\n enumDescriptions: [\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingComments.languageDefined', \"Use language configurations to determine when to autoclose comments.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingComments.beforeWhitespace', \"Autoclose comments only when the cursor is to the left of whitespace.\"),\n '',\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'autoClosingComments', \"Controls whether the editor should automatically close comments after the user adds an opening comment.\")\n })),\n autoClosingDelete: register(new EditorStringEnumOption(9 /* EditorOption.autoClosingDelete */, 'autoClosingDelete', 'auto', ['always', 'auto', 'never'], {\n enumDescriptions: [\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingDelete.auto', \"Remove adjacent closing quotes or brackets only if they were automatically inserted.\"),\n '',\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'autoClosingDelete', \"Controls whether the editor should remove adjacent closing quotes or brackets when deleting.\")\n })),\n autoClosingOvertype: register(new EditorStringEnumOption(10 /* EditorOption.autoClosingOvertype */, 'autoClosingOvertype', 'auto', ['always', 'auto', 'never'], {\n enumDescriptions: [\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingOvertype.auto', \"Type over closing quotes or brackets only if they were automatically inserted.\"),\n '',\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'autoClosingOvertype', \"Controls whether the editor should type over closing quotes or brackets.\")\n })),\n autoClosingQuotes: register(new EditorStringEnumOption(11 /* EditorOption.autoClosingQuotes */, 'autoClosingQuotes', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\n enumDescriptions: [\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingQuotes.languageDefined', \"Use language configurations to determine when to autoclose quotes.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoClosingQuotes.beforeWhitespace', \"Autoclose quotes only when the cursor is to the left of whitespace.\"),\n '',\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'autoClosingQuotes', \"Controls whether the editor should automatically close quotes after the user adds an opening quote.\")\n })),\n autoIndent: register(new EditorEnumOption(12 /* EditorOption.autoIndent */, 'autoIndent', 4 /* EditorAutoIndentStrategy.Full */, 'full', ['none', 'keep', 'brackets', 'advanced', 'full'], _autoIndentFromString, {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoIndent.none', \"The editor will not insert indentation automatically.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoIndent.keep', \"The editor will keep the current line's indentation.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoIndent.brackets', \"The editor will keep the current line's indentation and honor language defined brackets.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoIndent.advanced', \"The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoIndent.full', \"The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'autoIndent', \"Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.\")\n })),\n automaticLayout: register(new EditorBooleanOption(13 /* EditorOption.automaticLayout */, 'automaticLayout', false)),\n autoSurround: register(new EditorStringEnumOption(14 /* EditorOption.autoSurround */, 'autoSurround', 'languageDefined', ['languageDefined', 'quotes', 'brackets', 'never'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoSurround.languageDefined', \"Use language configurations to determine when to automatically surround selections.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoSurround.quotes', \"Surround with quotes but not brackets.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.autoSurround.brackets', \"Surround with brackets but not quotes.\"),\n ''\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'autoSurround', \"Controls whether the editor should automatically surround selections when typing quotes or brackets.\")\n })),\n bracketPairColorization: register(new BracketPairColorization()),\n bracketPairGuides: register(new GuideOptions()),\n stickyTabStops: register(new EditorBooleanOption(115 /* EditorOption.stickyTabStops */, 'stickyTabStops', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'stickyTabStops', \"Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.\") })),\n codeLens: register(new EditorBooleanOption(17 /* EditorOption.codeLens */, 'codeLens', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'codeLens', \"Controls whether the editor shows CodeLens.\") })),\n codeLensFontFamily: register(new EditorStringOption(18 /* EditorOption.codeLensFontFamily */, 'codeLensFontFamily', '', { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'codeLensFontFamily', \"Controls the font family for CodeLens.\") })),\n codeLensFontSize: register(new EditorIntOption(19 /* EditorOption.codeLensFontSize */, 'codeLensFontSize', 0, 0, 100, {\n type: 'number',\n default: 0,\n minimum: 0,\n maximum: 100,\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'codeLensFontSize', \"Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.\")\n })),\n colorDecorators: register(new EditorBooleanOption(20 /* EditorOption.colorDecorators */, 'colorDecorators', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'colorDecorators', \"Controls whether the editor should render the inline color decorators and color picker.\") })),\n colorDecoratorActivatedOn: register(new EditorStringEnumOption(146 /* EditorOption.colorDecoratorsActivatedOn */, 'colorDecoratorsActivatedOn', 'clickAndHover', ['clickAndHover', 'hover', 'click'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.colorDecoratorActivatedOn.clickAndHover', \"Make the color picker appear both on click and hover of the color decorator\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.colorDecoratorActivatedOn.hover', \"Make the color picker appear on hover of the color decorator\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'editor.colorDecoratorActivatedOn.click', \"Make the color picker appear on click of the color decorator\")\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'colorDecoratorActivatedOn', \"Controls the condition to make a color picker appear from a color decorator\")\n })),\n colorDecoratorsLimit: register(new EditorIntOption(21 /* EditorOption.colorDecoratorsLimit */, 'colorDecoratorsLimit', 500, 1, 1000000, {\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'colorDecoratorsLimit', \"Controls the max number of color decorators that can be rendered in an editor at once.\")\n })),\n columnSelection: register(new EditorBooleanOption(22 /* EditorOption.columnSelection */, 'columnSelection', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'columnSelection', \"Enable that the selection with the mouse and keys is doing column selection.\") })),\n comments: register(new EditorComments()),\n contextmenu: register(new EditorBooleanOption(24 /* EditorOption.contextmenu */, 'contextmenu', true)),\n copyWithSyntaxHighlighting: register(new EditorBooleanOption(25 /* EditorOption.copyWithSyntaxHighlighting */, 'copyWithSyntaxHighlighting', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'copyWithSyntaxHighlighting', \"Controls whether syntax highlighting should be copied into the clipboard.\") })),\n cursorBlinking: register(new EditorEnumOption(26 /* EditorOption.cursorBlinking */, 'cursorBlinking', 1 /* TextEditorCursorBlinkingStyle.Blink */, 'blink', ['blink', 'smooth', 'phase', 'expand', 'solid'], _cursorBlinkingStyleFromString, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorBlinking', \"Control the cursor animation style.\") })),\n cursorSmoothCaretAnimation: register(new EditorStringEnumOption(27 /* EditorOption.cursorSmoothCaretAnimation */, 'cursorSmoothCaretAnimation', 'off', ['off', 'explicit', 'on'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSmoothCaretAnimation.off', \"Smooth caret animation is disabled.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSmoothCaretAnimation.explicit', \"Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSmoothCaretAnimation.on', \"Smooth caret animation is always enabled.\")\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSmoothCaretAnimation', \"Controls whether the smooth caret animation should be enabled.\")\n })),\n cursorStyle: register(new EditorEnumOption(28 /* EditorOption.cursorStyle */, 'cursorStyle', TextEditorCursorStyle.Line, 'line', ['line', 'block', 'underline', 'line-thin', 'block-outline', 'underline-thin'], _cursorStyleFromString, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorStyle', \"Controls the cursor style.\") })),\n cursorSurroundingLines: register(new EditorIntOption(29 /* EditorOption.cursorSurroundingLines */, 'cursorSurroundingLines', 0, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSurroundingLines', \"Controls the minimal number of visible leading lines (minimum 0) and trailing lines (minimum 1) surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.\") })),\n cursorSurroundingLinesStyle: register(new EditorStringEnumOption(30 /* EditorOption.cursorSurroundingLinesStyle */, 'cursorSurroundingLinesStyle', 'default', ['default', 'all'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSurroundingLinesStyle.default', \"`cursorSurroundingLines` is enforced only when triggered via the keyboard or API.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSurroundingLinesStyle.all', \"`cursorSurroundingLines` is enforced always.\")\n ],\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorSurroundingLinesStyle', \"Controls when `#cursorSurroundingLines#` should be enforced.\")\n })),\n cursorWidth: register(new EditorIntOption(31 /* EditorOption.cursorWidth */, 'cursorWidth', 0, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'cursorWidth', \"Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.\") })),\n disableLayerHinting: register(new EditorBooleanOption(32 /* EditorOption.disableLayerHinting */, 'disableLayerHinting', false)),\n disableMonospaceOptimizations: register(new EditorBooleanOption(33 /* EditorOption.disableMonospaceOptimizations */, 'disableMonospaceOptimizations', false)),\n domReadOnly: register(new EditorBooleanOption(34 /* EditorOption.domReadOnly */, 'domReadOnly', false)),\n dragAndDrop: register(new EditorBooleanOption(35 /* EditorOption.dragAndDrop */, 'dragAndDrop', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'dragAndDrop', \"Controls whether the editor should allow moving selections via drag and drop.\") })),\n emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),\n dropIntoEditor: register(new EditorDropIntoEditor()),\n stickyScroll: register(new EditorStickyScroll()),\n experimentalWhitespaceRendering: register(new EditorStringEnumOption(38 /* EditorOption.experimentalWhitespaceRendering */, 'experimentalWhitespaceRendering', 'svg', ['svg', 'font', 'off'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'experimentalWhitespaceRendering.svg', \"Use a new rendering method with svgs.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'experimentalWhitespaceRendering.font', \"Use a new rendering method with font characters.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'experimentalWhitespaceRendering.off', \"Use the stable rendering method.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'experimentalWhitespaceRendering', \"Controls whether whitespace is rendered with a new, experimental method.\")\n })),\n extraEditorClassName: register(new EditorStringOption(39 /* EditorOption.extraEditorClassName */, 'extraEditorClassName', '')),\n fastScrollSensitivity: register(new EditorFloatOption(40 /* EditorOption.fastScrollSensitivity */, 'fastScrollSensitivity', 5, x => (x <= 0 ? 5 : x), { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fastScrollSensitivity', \"Scrolling speed multiplier when pressing `Alt`.\") })),\n find: register(new EditorFind()),\n fixedOverflowWidgets: register(new EditorBooleanOption(42 /* EditorOption.fixedOverflowWidgets */, 'fixedOverflowWidgets', false)),\n folding: register(new EditorBooleanOption(43 /* EditorOption.folding */, 'folding', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'folding', \"Controls whether the editor has code folding enabled.\") })),\n foldingStrategy: register(new EditorStringEnumOption(44 /* EditorOption.foldingStrategy */, 'foldingStrategy', 'auto', ['auto', 'indentation'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'foldingStrategy.auto', \"Use a language-specific folding strategy if available, else the indentation-based one.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'foldingStrategy.indentation', \"Use the indentation-based folding strategy.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'foldingStrategy', \"Controls the strategy for computing folding ranges.\")\n })),\n foldingHighlight: register(new EditorBooleanOption(45 /* EditorOption.foldingHighlight */, 'foldingHighlight', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'foldingHighlight', \"Controls whether the editor should highlight folded ranges.\") })),\n foldingImportsByDefault: register(new EditorBooleanOption(46 /* EditorOption.foldingImportsByDefault */, 'foldingImportsByDefault', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'foldingImportsByDefault', \"Controls whether the editor automatically collapses import ranges.\") })),\n foldingMaximumRegions: register(new EditorIntOption(47 /* EditorOption.foldingMaximumRegions */, 'foldingMaximumRegions', 5000, 10, 65000, // limit must be less than foldingRanges MAX_FOLDING_REGIONS\n { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'foldingMaximumRegions', \"The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.\") })),\n unfoldOnClickAfterEndOfLine: register(new EditorBooleanOption(48 /* EditorOption.unfoldOnClickAfterEndOfLine */, 'unfoldOnClickAfterEndOfLine', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unfoldOnClickAfterEndOfLine', \"Controls whether clicking on the empty content after a folded line will unfold the line.\") })),\n fontFamily: register(new EditorStringOption(49 /* EditorOption.fontFamily */, 'fontFamily', EDITOR_FONT_DEFAULTS.fontFamily, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'fontFamily', \"Controls the font family.\") })),\n fontInfo: register(new EditorFontInfo()),\n fontLigatures2: register(new EditorFontLigatures()),\n fontSize: register(new EditorFontSize()),\n fontWeight: register(new EditorFontWeight()),\n fontVariations: register(new EditorFontVariations()),\n formatOnPaste: register(new EditorBooleanOption(55 /* EditorOption.formatOnPaste */, 'formatOnPaste', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'formatOnPaste', \"Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.\") })),\n formatOnType: register(new EditorBooleanOption(56 /* EditorOption.formatOnType */, 'formatOnType', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'formatOnType', \"Controls whether the editor should automatically format the line after typing.\") })),\n glyphMargin: register(new EditorBooleanOption(57 /* EditorOption.glyphMargin */, 'glyphMargin', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'glyphMargin', \"Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.\") })),\n gotoLocation: register(new EditorGoToLocation()),\n hideCursorInOverviewRuler: register(new EditorBooleanOption(59 /* EditorOption.hideCursorInOverviewRuler */, 'hideCursorInOverviewRuler', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'hideCursorInOverviewRuler', \"Controls whether the cursor should be hidden in the overview ruler.\") })),\n hover: register(new EditorHover()),\n inDiffEditor: register(new EditorBooleanOption(61 /* EditorOption.inDiffEditor */, 'inDiffEditor', false)),\n letterSpacing: register(new EditorFloatOption(63 /* EditorOption.letterSpacing */, 'letterSpacing', EDITOR_FONT_DEFAULTS.letterSpacing, x => EditorFloatOption.clamp(x, -5, 20), { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'letterSpacing', \"Controls the letter spacing in pixels.\") })),\n lightbulb: register(new EditorLightbulb()),\n lineDecorationsWidth: register(new EditorLineDecorationsWidth()),\n lineHeight: register(new EditorLineHeight()),\n lineNumbers: register(new EditorRenderLineNumbersOption()),\n lineNumbersMinChars: register(new EditorIntOption(68 /* EditorOption.lineNumbersMinChars */, 'lineNumbersMinChars', 5, 1, 300)),\n linkedEditing: register(new EditorBooleanOption(69 /* EditorOption.linkedEditing */, 'linkedEditing', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'linkedEditing', \"Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.\") })),\n links: register(new EditorBooleanOption(70 /* EditorOption.links */, 'links', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'links', \"Controls whether the editor should detect links and make them clickable.\") })),\n matchBrackets: register(new EditorStringEnumOption(71 /* EditorOption.matchBrackets */, 'matchBrackets', 'always', ['always', 'near', 'never'], { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'matchBrackets', \"Highlight matching brackets.\") })),\n minimap: register(new EditorMinimap()),\n mouseStyle: register(new EditorStringEnumOption(73 /* EditorOption.mouseStyle */, 'mouseStyle', 'text', ['text', 'default', 'copy'])),\n mouseWheelScrollSensitivity: register(new EditorFloatOption(74 /* EditorOption.mouseWheelScrollSensitivity */, 'mouseWheelScrollSensitivity', 1, x => (x === 0 ? 1 : x), { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'mouseWheelScrollSensitivity', \"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.\") })),\n mouseWheelZoom: register(new EditorBooleanOption(75 /* EditorOption.mouseWheelZoom */, 'mouseWheelZoom', false, { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'mouseWheelZoom', \"Zoom the font of the editor when using mouse wheel and holding `Ctrl`.\") })),\n multiCursorMergeOverlapping: register(new EditorBooleanOption(76 /* EditorOption.multiCursorMergeOverlapping */, 'multiCursorMergeOverlapping', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'multiCursorMergeOverlapping', \"Merge multiple cursors when they are overlapping.\") })),\n multiCursorModifier: register(new EditorEnumOption(77 /* EditorOption.multiCursorModifier */, 'multiCursorModifier', 'altKey', 'alt', ['ctrlCmd', 'alt'], _multiCursorModifierFromString, {\n markdownEnumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'multiCursorModifier.ctrlCmd', \"Maps to `Control` on Windows and Linux and to `Command` on macOS.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'multiCursorModifier.alt', \"Maps to `Alt` on Windows and Linux and to `Option` on macOS.\")\n ],\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', {\n key: 'multiCursorModifier',\n comment: [\n '- `ctrlCmd` refers to a value the setting can take and should not be localized.',\n '- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized.'\n ]\n }, \"The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the [multicursor modifier](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).\")\n })),\n multiCursorPaste: register(new EditorStringEnumOption(78 /* EditorOption.multiCursorPaste */, 'multiCursorPaste', 'spread', ['spread', 'full'], {\n markdownEnumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'multiCursorPaste.spread', \"Each cursor pastes a single line of the text.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'multiCursorPaste.full', \"Each cursor pastes the full text.\")\n ],\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'multiCursorPaste', \"Controls pasting when the line count of the pasted text matches the cursor count.\")\n })),\n multiCursorLimit: register(new EditorIntOption(79 /* EditorOption.multiCursorLimit */, 'multiCursorLimit', 10000, 1, 100000, {\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'multiCursorLimit', \"Controls the max number of cursors that can be in an active editor at once.\")\n })),\n occurrencesHighlight: register(new EditorStringEnumOption(80 /* EditorOption.occurrencesHighlight */, 'occurrencesHighlight', 'singleFile', ['off', 'singleFile', 'multiFile'], {\n markdownEnumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'occurrencesHighlight.off', \"Does not highlight occurrences.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'occurrencesHighlight.singleFile', \"Highlights occurrences only in the current file.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'occurrencesHighlight.multiFile', \"Experimental: Highlights occurrences across all valid open files.\")\n ],\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'occurrencesHighlight', \"Controls whether occurrences should be highlighted across open files.\")\n })),\n overviewRulerBorder: register(new EditorBooleanOption(81 /* EditorOption.overviewRulerBorder */, 'overviewRulerBorder', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'overviewRulerBorder', \"Controls whether a border should be drawn around the overview ruler.\") })),\n overviewRulerLanes: register(new EditorIntOption(82 /* EditorOption.overviewRulerLanes */, 'overviewRulerLanes', 3, 0, 3)),\n padding: register(new EditorPadding()),\n pasteAs: register(new EditorPasteAs()),\n parameterHints: register(new EditorParameterHints()),\n peekWidgetDefaultFocus: register(new EditorStringEnumOption(86 /* EditorOption.peekWidgetDefaultFocus */, 'peekWidgetDefaultFocus', 'tree', ['tree', 'editor'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'peekWidgetDefaultFocus.tree', \"Focus the tree when opening peek\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'peekWidgetDefaultFocus.editor', \"Focus the editor when opening peek\")\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'peekWidgetDefaultFocus', \"Controls whether to focus the inline editor or the tree in the peek widget.\")\n })),\n definitionLinkOpensInPeek: register(new EditorBooleanOption(87 /* EditorOption.definitionLinkOpensInPeek */, 'definitionLinkOpensInPeek', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'definitionLinkOpensInPeek', \"Controls whether the Go to Definition mouse gesture always opens the peek widget.\") })),\n quickSuggestions: register(new EditorQuickSuggestions()),\n quickSuggestionsDelay: register(new EditorIntOption(89 /* EditorOption.quickSuggestionsDelay */, 'quickSuggestionsDelay', 10, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'quickSuggestionsDelay', \"Controls the delay in milliseconds after which quick suggestions will show up.\") })),\n readOnly: register(new EditorBooleanOption(90 /* EditorOption.readOnly */, 'readOnly', false)),\n readOnlyMessage: register(new ReadonlyMessage()),\n renameOnType: register(new EditorBooleanOption(92 /* EditorOption.renameOnType */, 'renameOnType', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renameOnType', \"Controls whether the editor auto renames on type.\"), markdownDeprecationMessage: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renameOnTypeDeprecate', \"Deprecated, use `editor.linkedEditing` instead.\") })),\n renderControlCharacters: register(new EditorBooleanOption(93 /* EditorOption.renderControlCharacters */, 'renderControlCharacters', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderControlCharacters', \"Controls whether the editor should render control characters.\"), restricted: true })),\n renderFinalNewline: register(new EditorStringEnumOption(94 /* EditorOption.renderFinalNewline */, 'renderFinalNewline', (platform.isLinux ? 'dimmed' : 'on'), ['off', 'on', 'dimmed'], { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderFinalNewline', \"Render last line number when the file ends with a newline.\") })),\n renderLineHighlight: register(new EditorStringEnumOption(95 /* EditorOption.renderLineHighlight */, 'renderLineHighlight', 'line', ['none', 'gutter', 'line', 'all'], {\n enumDescriptions: [\n '',\n '',\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderLineHighlight.all', \"Highlights both the gutter and the current line.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderLineHighlight', \"Controls how the editor should render the current line highlight.\")\n })),\n renderLineHighlightOnlyWhenFocus: register(new EditorBooleanOption(96 /* EditorOption.renderLineHighlightOnlyWhenFocus */, 'renderLineHighlightOnlyWhenFocus', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderLineHighlightOnlyWhenFocus', \"Controls if the editor should render the current line highlight only when the editor is focused.\") })),\n renderValidationDecorations: register(new EditorStringEnumOption(97 /* EditorOption.renderValidationDecorations */, 'renderValidationDecorations', 'editable', ['editable', 'on', 'off'])),\n renderWhitespace: register(new EditorStringEnumOption(98 /* EditorOption.renderWhitespace */, 'renderWhitespace', 'selection', ['none', 'boundary', 'selection', 'trailing', 'all'], {\n enumDescriptions: [\n '',\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderWhitespace.boundary', \"Render whitespace characters except for single spaces between words.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderWhitespace.selection', \"Render whitespace characters only on selected text.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderWhitespace.trailing', \"Render only trailing whitespace characters.\"),\n ''\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'renderWhitespace', \"Controls how the editor should render whitespace characters.\")\n })),\n revealHorizontalRightPadding: register(new EditorIntOption(99 /* EditorOption.revealHorizontalRightPadding */, 'revealHorizontalRightPadding', 15, 0, 1000)),\n roundedSelection: register(new EditorBooleanOption(100 /* EditorOption.roundedSelection */, 'roundedSelection', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'roundedSelection', \"Controls whether selections should have rounded corners.\") })),\n rulers: register(new EditorRulers()),\n scrollbar: register(new EditorScrollbar()),\n scrollBeyondLastColumn: register(new EditorIntOption(103 /* EditorOption.scrollBeyondLastColumn */, 'scrollBeyondLastColumn', 4, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollBeyondLastColumn', \"Controls the number of extra characters beyond which the editor will scroll horizontally.\") })),\n scrollBeyondLastLine: register(new EditorBooleanOption(104 /* EditorOption.scrollBeyondLastLine */, 'scrollBeyondLastLine', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollBeyondLastLine', \"Controls whether the editor will scroll beyond the last line.\") })),\n scrollPredominantAxis: register(new EditorBooleanOption(105 /* EditorOption.scrollPredominantAxis */, 'scrollPredominantAxis', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'scrollPredominantAxis', \"Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.\") })),\n selectionClipboard: register(new EditorBooleanOption(106 /* EditorOption.selectionClipboard */, 'selectionClipboard', true, {\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'selectionClipboard', \"Controls whether the Linux primary clipboard should be supported.\"),\n included: platform.isLinux\n })),\n selectionHighlight: register(new EditorBooleanOption(107 /* EditorOption.selectionHighlight */, 'selectionHighlight', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'selectionHighlight', \"Controls whether the editor should highlight matches similar to the selection.\") })),\n selectOnLineNumbers: register(new EditorBooleanOption(108 /* EditorOption.selectOnLineNumbers */, 'selectOnLineNumbers', true)),\n showFoldingControls: register(new EditorStringEnumOption(109 /* EditorOption.showFoldingControls */, 'showFoldingControls', 'mouseover', ['always', 'never', 'mouseover'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'showFoldingControls.always', \"Always show the folding controls.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'showFoldingControls.never', \"Never show the folding controls and reduce the gutter size.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'showFoldingControls.mouseover', \"Only show the folding controls when the mouse is over the gutter.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'showFoldingControls', \"Controls when the folding controls on the gutter are shown.\")\n })),\n showUnused: register(new EditorBooleanOption(110 /* EditorOption.showUnused */, 'showUnused', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'showUnused', \"Controls fading out of unused code.\") })),\n showDeprecated: register(new EditorBooleanOption(138 /* EditorOption.showDeprecated */, 'showDeprecated', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'showDeprecated', \"Controls strikethrough deprecated variables.\") })),\n inlayHints: register(new EditorInlayHints()),\n snippetSuggestions: register(new EditorStringEnumOption(111 /* EditorOption.snippetSuggestions */, 'snippetSuggestions', 'inline', ['top', 'bottom', 'inline', 'none'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'snippetSuggestions.top', \"Show snippet suggestions on top of other suggestions.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'snippetSuggestions.bottom', \"Show snippet suggestions below other suggestions.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'snippetSuggestions.inline', \"Show snippets suggestions with other suggestions.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'snippetSuggestions.none', \"Do not show snippet suggestions.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'snippetSuggestions', \"Controls whether snippets are shown with other suggestions and how they are sorted.\")\n })),\n smartSelect: register(new SmartSelect()),\n smoothScrolling: register(new EditorBooleanOption(113 /* EditorOption.smoothScrolling */, 'smoothScrolling', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'smoothScrolling', \"Controls whether the editor will scroll using an animation.\") })),\n stopRenderingLineAfter: register(new EditorIntOption(116 /* EditorOption.stopRenderingLineAfter */, 'stopRenderingLineAfter', 10000, -1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */)),\n suggest: register(new EditorSuggest()),\n inlineSuggest: register(new InlineEditorSuggest()),\n inlineCompletionsAccessibilityVerbose: register(new EditorBooleanOption(147 /* EditorOption.inlineCompletionsAccessibilityVerbose */, 'inlineCompletionsAccessibilityVerbose', false, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'inlineCompletionsAccessibilityVerbose', \"Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.\") })),\n suggestFontSize: register(new EditorIntOption(118 /* EditorOption.suggestFontSize */, 'suggestFontSize', 0, 0, 1000, { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggestFontSize', \"Font size for the suggest widget. When set to {0}, the value of {1} is used.\", '`0`', '`#editor.fontSize#`') })),\n suggestLineHeight: register(new EditorIntOption(119 /* EditorOption.suggestLineHeight */, 'suggestLineHeight', 0, 0, 1000, { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggestLineHeight', \"Line height for the suggest widget. When set to {0}, the value of {1} is used. The minimum value is 8.\", '`0`', '`#editor.lineHeight#`') })),\n suggestOnTriggerCharacters: register(new EditorBooleanOption(120 /* EditorOption.suggestOnTriggerCharacters */, 'suggestOnTriggerCharacters', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggestOnTriggerCharacters', \"Controls whether suggestions should automatically show up when typing trigger characters.\") })),\n suggestSelection: register(new EditorStringEnumOption(121 /* EditorOption.suggestSelection */, 'suggestSelection', 'first', ['first', 'recentlyUsed', 'recentlyUsedByPrefix'], {\n markdownEnumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggestSelection.first', \"Always select the first suggestion.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggestSelection.recentlyUsed', \"Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggestSelection.recentlyUsedByPrefix', \"Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'suggestSelection', \"Controls how suggestions are pre-selected when showing the suggest list.\")\n })),\n tabCompletion: register(new EditorStringEnumOption(122 /* EditorOption.tabCompletion */, 'tabCompletion', 'off', ['on', 'off', 'onlySnippets'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'tabCompletion.on', \"Tab complete will insert the best matching suggestion when pressing tab.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'tabCompletion.off', \"Disable tab completions.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'tabCompletion.onlySnippets', \"Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'tabCompletion', \"Enables tab completions.\")\n })),\n tabIndex: register(new EditorIntOption(123 /* EditorOption.tabIndex */, 'tabIndex', 0, -1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */)),\n unicodeHighlight: register(new UnicodeHighlight()),\n unusualLineTerminators: register(new EditorStringEnumOption(125 /* EditorOption.unusualLineTerminators */, 'unusualLineTerminators', 'prompt', ['auto', 'off', 'prompt'], {\n enumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unusualLineTerminators.auto', \"Unusual line terminators are automatically removed.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unusualLineTerminators.off', \"Unusual line terminators are ignored.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unusualLineTerminators.prompt', \"Unusual line terminators prompt to be removed.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'unusualLineTerminators', \"Remove unusual line terminators that might cause problems.\")\n })),\n useShadowDOM: register(new EditorBooleanOption(126 /* EditorOption.useShadowDOM */, 'useShadowDOM', true)),\n useTabStops: register(new EditorBooleanOption(127 /* EditorOption.useTabStops */, 'useTabStops', true, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'useTabStops', \"Inserting and deleting whitespace follows tab stops.\") })),\n wordBreak: register(new EditorStringEnumOption(128 /* EditorOption.wordBreak */, 'wordBreak', 'normal', ['normal', 'keepAll'], {\n markdownEnumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wordBreak.normal', \"Use the default line break rule.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wordBreak.keepAll', \"Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wordBreak', \"Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.\")\n })),\n wordSeparators: register(new EditorStringOption(129 /* EditorOption.wordSeparators */, 'wordSeparators', USUAL_WORD_SEPARATORS, { description: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wordSeparators', \"Characters that will be used as word separators when doing word related navigations or operations.\") })),\n wordWrap: register(new EditorStringEnumOption(130 /* EditorOption.wordWrap */, 'wordWrap', 'off', ['off', 'on', 'wordWrapColumn', 'bounded'], {\n markdownEnumDescriptions: [\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wordWrap.off', \"Lines will never wrap.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', 'wordWrap.on', \"Lines will wrap at the viewport width.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', {\n key: 'wordWrap.wordWrapColumn',\n comment: [\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\n ]\n }, \"Lines will wrap at `#editor.wordWrapColumn#`.\"),\n nls.localizeWithPath('vs/editor/common/config/editorOptions', {\n key: 'wordWrap.bounded',\n comment: [\n '- viewport means the edge of the visible window size.',\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\n ]\n }, \"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.\"),\n ],\n description: nls.localizeWithPath('vs/editor/common/config/editorOptions', {\n key: 'wordWrap',\n comment: [\n '- \\'off\\', \\'on\\', \\'wordWrapColumn\\' and \\'bounded\\' refer to values the setting can take and should not be localized.',\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\n ]\n }, \"Controls how lines should wrap.\")\n })),\n wordWrapBreakAfterCharacters: register(new EditorStringOption(131 /* EditorOption.wordWrapBreakAfterCharacters */, 'wordWrapBreakAfterCharacters', \n // allow-any-unicode-next-line\n ' \\t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」')),\n wordWrapBreakBeforeCharacters: register(new EditorStringOption(132 /* EditorOption.wordWrapBreakBeforeCharacters */, 'wordWrapBreakBeforeCharacters', \n // allow-any-unicode-next-line\n '([{‘“〈《「『【〔([{「£¥$£¥++')),\n wordWrapColumn: register(new EditorIntOption(133 /* EditorOption.wordWrapColumn */, 'wordWrapColumn', 80, 1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, {\n markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', {\n key: 'wordWrapColumn',\n comment: [\n '- `editor.wordWrap` refers to a different setting and should not be localized.',\n '- \\'wordWrapColumn\\' and \\'bounded\\' refer to values the different setting can take and should not be localized.'\n ]\n }, \"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.\")\n })),\n wordWrapOverride1: register(new EditorStringEnumOption(134 /* EditorOption.wordWrapOverride1 */, 'wordWrapOverride1', 'inherit', ['off', 'on', 'inherit'])),\n wordWrapOverride2: register(new EditorStringEnumOption(135 /* EditorOption.wordWrapOverride2 */, 'wordWrapOverride2', 'inherit', ['off', 'on', 'inherit'])),\n // Leave these at the end (because they have dependencies!)\n editorClassName: register(new EditorClassName()),\n defaultColorDecorators: register(new EditorBooleanOption(145 /* EditorOption.defaultColorDecorators */, 'defaultColorDecorators', false, { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'defaultColorDecorators', \"Controls whether inline color decorations should be shown using the default document color provider\") })),\n pixelRatio: register(new EditorPixelRatio()),\n tabFocusMode: register(new EditorBooleanOption(142 /* EditorOption.tabFocusMode */, 'tabFocusMode', false, { markdownDescription: nls.localizeWithPath('vs/editor/common/config/editorOptions', 'tabFocusMode', \"Controls whether the editor receives tabs or defers them to the workbench for navigation.\") })),\n layoutInfo: register(new EditorLayoutInfoComputer()),\n wrappingInfo: register(new EditorWrappingInfoComputer()),\n wrappingIndent: register(new WrappingIndentOption()),\n wrappingStrategy: register(new WrappingStrategy())\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../base/common/event.js';\nexport const EditorZoom = new class {\n constructor() {\n this._zoomLevel = 0;\n this._onDidChangeZoomLevel = new Emitter();\n this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\n }\n getZoomLevel() {\n return this._zoomLevel;\n }\n setZoomLevel(zoomLevel) {\n zoomLevel = Math.min(Math.max(-5, zoomLevel), 20);\n if (this._zoomLevel === zoomLevel) {\n return;\n }\n this._zoomLevel = zoomLevel;\n this._onDidChangeZoomLevel.fire(this._zoomLevel);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as platform from '../../../base/common/platform.js';\nimport { EditorFontVariations, EditorOptions, EDITOR_FONT_DEFAULTS } from './editorOptions.js';\nimport { EditorZoom } from './editorZoom.js';\n/**\n * Determined from empirical observations.\n * @internal\n */\nconst GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35;\n/**\n * @internal\n */\nconst MINIMUM_LINE_HEIGHT = 8;\nexport class BareFontInfo {\n /**\n * @internal\n */\n static createFromValidatedSettings(options, pixelRatio, ignoreEditorZoom) {\n const fontFamily = options.get(49 /* EditorOption.fontFamily */);\n const fontWeight = options.get(53 /* EditorOption.fontWeight */);\n const fontSize = options.get(52 /* EditorOption.fontSize */);\n const fontFeatureSettings = options.get(51 /* EditorOption.fontLigatures */);\n const fontVariationSettings = options.get(54 /* EditorOption.fontVariations */);\n const lineHeight = options.get(66 /* EditorOption.lineHeight */);\n const letterSpacing = options.get(63 /* EditorOption.letterSpacing */);\n return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);\n }\n /**\n * @internal\n */\n static createFromRawSettings(opts, pixelRatio, ignoreEditorZoom = false) {\n const fontFamily = EditorOptions.fontFamily.validate(opts.fontFamily);\n const fontWeight = EditorOptions.fontWeight.validate(opts.fontWeight);\n const fontSize = EditorOptions.fontSize.validate(opts.fontSize);\n const fontFeatureSettings = EditorOptions.fontLigatures2.validate(opts.fontLigatures);\n const fontVariationSettings = EditorOptions.fontVariations.validate(opts.fontVariations);\n const lineHeight = EditorOptions.lineHeight.validate(opts.lineHeight);\n const letterSpacing = EditorOptions.letterSpacing.validate(opts.letterSpacing);\n return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);\n }\n /**\n * @internal\n */\n static _create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom) {\n if (lineHeight === 0) {\n lineHeight = GOLDEN_LINE_HEIGHT_RATIO * fontSize;\n }\n else if (lineHeight < MINIMUM_LINE_HEIGHT) {\n // Values too small to be line heights in pixels are in ems.\n lineHeight = lineHeight * fontSize;\n }\n // Enforce integer, minimum constraints\n lineHeight = Math.round(lineHeight);\n if (lineHeight < MINIMUM_LINE_HEIGHT) {\n lineHeight = MINIMUM_LINE_HEIGHT;\n }\n const editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : EditorZoom.getZoomLevel() * 0.1);\n fontSize *= editorZoomLevelMultiplier;\n lineHeight *= editorZoomLevelMultiplier;\n if (fontVariationSettings === EditorFontVariations.TRANSLATE) {\n if (fontWeight === 'normal' || fontWeight === 'bold') {\n fontVariationSettings = EditorFontVariations.OFF;\n }\n else {\n const fontWeightAsNumber = parseInt(fontWeight, 10);\n fontVariationSettings = `'wght' ${fontWeightAsNumber}`;\n fontWeight = 'normal';\n }\n }\n return new BareFontInfo({\n pixelRatio: pixelRatio,\n fontFamily: fontFamily,\n fontWeight: fontWeight,\n fontSize: fontSize,\n fontFeatureSettings: fontFeatureSettings,\n fontVariationSettings,\n lineHeight: lineHeight,\n letterSpacing: letterSpacing\n });\n }\n /**\n * @internal\n */\n constructor(opts) {\n this._bareFontInfoBrand = undefined;\n this.pixelRatio = opts.pixelRatio;\n this.fontFamily = String(opts.fontFamily);\n this.fontWeight = String(opts.fontWeight);\n this.fontSize = opts.fontSize;\n this.fontFeatureSettings = opts.fontFeatureSettings;\n this.fontVariationSettings = opts.fontVariationSettings;\n this.lineHeight = opts.lineHeight | 0;\n this.letterSpacing = opts.letterSpacing;\n }\n /**\n * @internal\n */\n getId() {\n return `${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`;\n }\n /**\n * @internal\n */\n getMassagedFontFamily() {\n const fallbackFontFamily = EDITOR_FONT_DEFAULTS.fontFamily;\n const fontFamily = BareFontInfo._wrapInQuotes(this.fontFamily);\n if (fallbackFontFamily && this.fontFamily !== fallbackFontFamily) {\n return `${fontFamily}, ${fallbackFontFamily}`;\n }\n return fontFamily;\n }\n static _wrapInQuotes(fontFamily) {\n if (/[,\"']/.test(fontFamily)) {\n // Looks like the font family might be already escaped\n return fontFamily;\n }\n if (/[+ ]/.test(fontFamily)) {\n // Wrap a font family using + or with quotes\n return `\"${fontFamily}\"`;\n }\n return fontFamily;\n }\n}\n// change this whenever `FontInfo` members are changed\nexport const SERIALIZED_FONT_INFO_VERSION = 2;\nexport class FontInfo extends BareFontInfo {\n /**\n * @internal\n */\n constructor(opts, isTrusted) {\n super(opts);\n this._editorStylingBrand = undefined;\n this.version = SERIALIZED_FONT_INFO_VERSION;\n this.isTrusted = isTrusted;\n this.isMonospace = opts.isMonospace;\n this.typicalHalfwidthCharacterWidth = opts.typicalHalfwidthCharacterWidth;\n this.typicalFullwidthCharacterWidth = opts.typicalFullwidthCharacterWidth;\n this.canUseHalfwidthRightwardsArrow = opts.canUseHalfwidthRightwardsArrow;\n this.spaceWidth = opts.spaceWidth;\n this.middotWidth = opts.middotWidth;\n this.wsmiddotWidth = opts.wsmiddotWidth;\n this.maxDigitWidth = opts.maxDigitWidth;\n }\n /**\n * @internal\n */\n equals(other) {\n return (this.fontFamily === other.fontFamily\n && this.fontWeight === other.fontWeight\n && this.fontSize === other.fontSize\n && this.fontFeatureSettings === other.fontFeatureSettings\n && this.fontVariationSettings === other.fontVariationSettings\n && this.lineHeight === other.lineHeight\n && this.letterSpacing === other.letterSpacing\n && this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth\n && this.typicalFullwidthCharacterWidth === other.typicalFullwidthCharacterWidth\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\n && this.spaceWidth === other.spaceWidth\n && this.middotWidth === other.middotWidth\n && this.wsmiddotWidth === other.wsmiddotWidth\n && this.maxDigitWidth === other.maxDigitWidth);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from '../../../base/browser/browser.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { CharWidthRequest, readCharWidths } from './charWidthReader.js';\nimport { EditorFontLigatures } from '../../common/config/editorOptions.js';\nimport { FontInfo, SERIALIZED_FONT_INFO_VERSION } from '../../common/config/fontInfo.js';\nexport class FontMeasurementsImpl extends Disposable {\n constructor() {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._cache = new FontMeasurementsCache();\n this._evictUntrustedReadingsTimeout = -1;\n }\n dispose() {\n if (this._evictUntrustedReadingsTimeout !== -1) {\n clearTimeout(this._evictUntrustedReadingsTimeout);\n this._evictUntrustedReadingsTimeout = -1;\n }\n super.dispose();\n }\n /**\n * Clear all cached font information and trigger a change event.\n */\n clearAllFontInfos() {\n this._cache = new FontMeasurementsCache();\n this._onDidChange.fire();\n }\n _writeToCache(item, value) {\n this._cache.put(item, value);\n if (!value.isTrusted && this._evictUntrustedReadingsTimeout === -1) {\n // Try reading again after some time\n this._evictUntrustedReadingsTimeout = mainWindow.setTimeout(() => {\n this._evictUntrustedReadingsTimeout = -1;\n this._evictUntrustedReadings();\n }, 5000);\n }\n }\n _evictUntrustedReadings() {\n const values = this._cache.getValues();\n let somethingRemoved = false;\n for (const item of values) {\n if (!item.isTrusted) {\n somethingRemoved = true;\n this._cache.remove(item);\n }\n }\n if (somethingRemoved) {\n this._onDidChange.fire();\n }\n }\n /**\n * Serialized currently cached font information.\n */\n serializeFontInfo() {\n // Only save trusted font info (that has been measured in this running instance)\n return this._cache.getValues().filter(item => item.isTrusted);\n }\n /**\n * Restore previously serialized font informations.\n */\n restoreFontInfo(savedFontInfos) {\n // Take all the saved font info and insert them in the cache without the trusted flag.\n // The reason for this is that a font might have been installed on the OS in the meantime.\n for (const savedFontInfo of savedFontInfos) {\n if (savedFontInfo.version !== SERIALIZED_FONT_INFO_VERSION) {\n // cannot use older version\n continue;\n }\n const fontInfo = new FontInfo(savedFontInfo, false);\n this._writeToCache(fontInfo, fontInfo);\n }\n }\n /**\n * Read font information.\n */\n readFontInfo(bareFontInfo) {\n if (!this._cache.has(bareFontInfo)) {\n let readConfig = this._actualReadFontInfo(bareFontInfo);\n if (readConfig.typicalHalfwidthCharacterWidth <= 2 || readConfig.typicalFullwidthCharacterWidth <= 2 || readConfig.spaceWidth <= 2 || readConfig.maxDigitWidth <= 2) {\n // Hey, it's Bug 14341 ... we couldn't read\n readConfig = new FontInfo({\n pixelRatio: browser.PixelRatio.value,\n fontFamily: readConfig.fontFamily,\n fontWeight: readConfig.fontWeight,\n fontSize: readConfig.fontSize,\n fontFeatureSettings: readConfig.fontFeatureSettings,\n fontVariationSettings: readConfig.fontVariationSettings,\n lineHeight: readConfig.lineHeight,\n letterSpacing: readConfig.letterSpacing,\n isMonospace: readConfig.isMonospace,\n typicalHalfwidthCharacterWidth: Math.max(readConfig.typicalHalfwidthCharacterWidth, 5),\n typicalFullwidthCharacterWidth: Math.max(readConfig.typicalFullwidthCharacterWidth, 5),\n canUseHalfwidthRightwardsArrow: readConfig.canUseHalfwidthRightwardsArrow,\n spaceWidth: Math.max(readConfig.spaceWidth, 5),\n middotWidth: Math.max(readConfig.middotWidth, 5),\n wsmiddotWidth: Math.max(readConfig.wsmiddotWidth, 5),\n maxDigitWidth: Math.max(readConfig.maxDigitWidth, 5),\n }, false);\n }\n this._writeToCache(bareFontInfo, readConfig);\n }\n return this._cache.get(bareFontInfo);\n }\n _createRequest(chr, type, all, monospace) {\n const result = new CharWidthRequest(chr, type);\n all.push(result);\n monospace?.push(result);\n return result;\n }\n _actualReadFontInfo(bareFontInfo) {\n const all = [];\n const monospace = [];\n const typicalHalfwidthCharacter = this._createRequest('n', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const typicalFullwidthCharacter = this._createRequest('\\uff4d', 0 /* CharWidthRequestType.Regular */, all, null);\n const space = this._createRequest(' ', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit0 = this._createRequest('0', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit1 = this._createRequest('1', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit2 = this._createRequest('2', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit3 = this._createRequest('3', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit4 = this._createRequest('4', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit5 = this._createRequest('5', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit6 = this._createRequest('6', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit7 = this._createRequest('7', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit8 = this._createRequest('8', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit9 = this._createRequest('9', 0 /* CharWidthRequestType.Regular */, all, monospace);\n // monospace test: used for whitespace rendering\n const rightwardsArrow = this._createRequest('→', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const halfwidthRightwardsArrow = this._createRequest('→', 0 /* CharWidthRequestType.Regular */, all, null);\n // U+00B7 - MIDDLE DOT\n const middot = this._createRequest('·', 0 /* CharWidthRequestType.Regular */, all, monospace);\n // U+2E31 - WORD SEPARATOR MIDDLE DOT\n const wsmiddotWidth = this._createRequest(String.fromCharCode(0x2E31), 0 /* CharWidthRequestType.Regular */, all, null);\n // monospace test: some characters\n const monospaceTestChars = '|/-_ilm%';\n for (let i = 0, len = monospaceTestChars.length; i < len; i++) {\n this._createRequest(monospaceTestChars.charAt(i), 0 /* CharWidthRequestType.Regular */, all, monospace);\n this._createRequest(monospaceTestChars.charAt(i), 1 /* CharWidthRequestType.Italic */, all, monospace);\n this._createRequest(monospaceTestChars.charAt(i), 2 /* CharWidthRequestType.Bold */, all, monospace);\n }\n readCharWidths(bareFontInfo, all);\n const maxDigitWidth = Math.max(digit0.width, digit1.width, digit2.width, digit3.width, digit4.width, digit5.width, digit6.width, digit7.width, digit8.width, digit9.width);\n let isMonospace = (bareFontInfo.fontFeatureSettings === EditorFontLigatures.OFF);\n const referenceWidth = monospace[0].width;\n for (let i = 1, len = monospace.length; isMonospace && i < len; i++) {\n const diff = referenceWidth - monospace[i].width;\n if (diff < -0.001 || diff > 0.001) {\n isMonospace = false;\n break;\n }\n }\n let canUseHalfwidthRightwardsArrow = true;\n if (isMonospace && halfwidthRightwardsArrow.width !== referenceWidth) {\n // using a halfwidth rightwards arrow would break monospace...\n canUseHalfwidthRightwardsArrow = false;\n }\n if (halfwidthRightwardsArrow.width > rightwardsArrow.width) {\n // using a halfwidth rightwards arrow would paint a larger arrow than a regular rightwards arrow\n canUseHalfwidthRightwardsArrow = false;\n }\n return new FontInfo({\n pixelRatio: browser.PixelRatio.value,\n fontFamily: bareFontInfo.fontFamily,\n fontWeight: bareFontInfo.fontWeight,\n fontSize: bareFontInfo.fontSize,\n fontFeatureSettings: bareFontInfo.fontFeatureSettings,\n fontVariationSettings: bareFontInfo.fontVariationSettings,\n lineHeight: bareFontInfo.lineHeight,\n letterSpacing: bareFontInfo.letterSpacing,\n isMonospace: isMonospace,\n typicalHalfwidthCharacterWidth: typicalHalfwidthCharacter.width,\n typicalFullwidthCharacterWidth: typicalFullwidthCharacter.width,\n canUseHalfwidthRightwardsArrow: canUseHalfwidthRightwardsArrow,\n spaceWidth: space.width,\n middotWidth: middot.width,\n wsmiddotWidth: wsmiddotWidth.width,\n maxDigitWidth: maxDigitWidth\n }, true);\n }\n}\nclass FontMeasurementsCache {\n constructor() {\n this._keys = Object.create(null);\n this._values = Object.create(null);\n }\n has(item) {\n const itemId = item.getId();\n return !!this._values[itemId];\n }\n get(item) {\n const itemId = item.getId();\n return this._values[itemId];\n }\n put(item, value) {\n const itemId = item.getId();\n this._keys[itemId] = item;\n this._values[itemId] = value;\n }\n remove(item) {\n const itemId = item.getId();\n delete this._keys[itemId];\n delete this._values[itemId];\n }\n getValues() {\n return Object.keys(this._keys).map(id => this._values[id]);\n }\n}\nexport const FontMeasurements = new FontMeasurementsImpl();\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 *--------------------------------------------------------------------------------------------*/\nexport class EditorSettingMigration {\n constructor(key, migrate) {\n this.key = key;\n this.migrate = migrate;\n }\n apply(options) {\n const value = EditorSettingMigration._read(options, this.key);\n const read = (key) => EditorSettingMigration._read(options, key);\n const write = (key, value) => EditorSettingMigration._write(options, key, value);\n this.migrate(value, read, write);\n }\n static _read(source, key) {\n if (typeof source === 'undefined') {\n return undefined;\n }\n const firstDotIndex = key.indexOf('.');\n if (firstDotIndex >= 0) {\n const firstSegment = key.substring(0, firstDotIndex);\n return this._read(source[firstSegment], key.substring(firstDotIndex + 1));\n }\n return source[key];\n }\n static _write(target, key, value) {\n const firstDotIndex = key.indexOf('.');\n if (firstDotIndex >= 0) {\n const firstSegment = key.substring(0, firstDotIndex);\n target[firstSegment] = target[firstSegment] || {};\n this._write(target[firstSegment], key.substring(firstDotIndex + 1), value);\n return;\n }\n target[key] = value;\n }\n}\nEditorSettingMigration.items = [];\nfunction registerEditorSettingMigration(key, migrate) {\n EditorSettingMigration.items.push(new EditorSettingMigration(key, migrate));\n}\nfunction registerSimpleEditorSettingMigration(key, values) {\n registerEditorSettingMigration(key, (value, read, write) => {\n if (typeof value !== 'undefined') {\n for (const [oldValue, newValue] of values) {\n if (value === oldValue) {\n write(key, newValue);\n return;\n }\n }\n }\n });\n}\n/**\n * Compatibility with old options\n */\nexport function migrateOptions(options) {\n EditorSettingMigration.items.forEach(migration => migration.apply(options));\n}\nregisterSimpleEditorSettingMigration('wordWrap', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('lineNumbers', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('cursorBlinking', [['visible', 'solid']]);\nregisterSimpleEditorSettingMigration('renderWhitespace', [[true, 'boundary'], [false, 'none']]);\nregisterSimpleEditorSettingMigration('renderLineHighlight', [[true, 'line'], [false, 'none']]);\nregisterSimpleEditorSettingMigration('acceptSuggestionOnEnter', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('tabCompletion', [[false, 'off'], [true, 'onlySnippets']]);\nregisterSimpleEditorSettingMigration('hover', [[true, { enabled: true }], [false, { enabled: false }]]);\nregisterSimpleEditorSettingMigration('parameterHints', [[true, { enabled: true }], [false, { enabled: false }]]);\nregisterSimpleEditorSettingMigration('autoIndent', [[false, 'advanced'], [true, 'full']]);\nregisterSimpleEditorSettingMigration('matchBrackets', [[true, 'always'], [false, 'never']]);\nregisterSimpleEditorSettingMigration('renderFinalNewline', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('cursorSmoothCaretAnimation', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('occurrencesHighlight', [[true, 'singleFile'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('wordBasedSuggestions', [[true, 'matchingDocuments'], [false, 'off']]);\nregisterEditorSettingMigration('autoClosingBrackets', (value, read, write) => {\n if (value === false) {\n write('autoClosingBrackets', 'never');\n if (typeof read('autoClosingQuotes') === 'undefined') {\n write('autoClosingQuotes', 'never');\n }\n if (typeof read('autoSurround') === 'undefined') {\n write('autoSurround', 'never');\n }\n }\n});\nregisterEditorSettingMigration('renderIndentGuides', (value, read, write) => {\n if (typeof value !== 'undefined') {\n write('renderIndentGuides', undefined);\n if (typeof read('guides.indentation') === 'undefined') {\n write('guides.indentation', !!value);\n }\n }\n});\nregisterEditorSettingMigration('highlightActiveIndentGuide', (value, read, write) => {\n if (typeof value !== 'undefined') {\n write('highlightActiveIndentGuide', undefined);\n if (typeof read('guides.highlightActiveIndentation') === 'undefined') {\n write('guides.highlightActiveIndentation', !!value);\n }\n }\n});\nconst suggestFilteredTypesMapping = {\n method: 'showMethods',\n function: 'showFunctions',\n constructor: 'showConstructors',\n deprecated: 'showDeprecated',\n field: 'showFields',\n variable: 'showVariables',\n class: 'showClasses',\n struct: 'showStructs',\n interface: 'showInterfaces',\n module: 'showModules',\n property: 'showProperties',\n event: 'showEvents',\n operator: 'showOperators',\n unit: 'showUnits',\n value: 'showValues',\n constant: 'showConstants',\n enum: 'showEnums',\n enumMember: 'showEnumMembers',\n keyword: 'showKeywords',\n text: 'showWords',\n color: 'showColors',\n file: 'showFiles',\n reference: 'showReferences',\n folder: 'showFolders',\n typeParameter: 'showTypeParameters',\n snippet: 'showSnippets',\n};\nregisterEditorSettingMigration('suggest.filteredTypes', (value, read, write) => {\n if (value && typeof value === 'object') {\n for (const entry of Object.entries(suggestFilteredTypesMapping)) {\n const v = value[entry[0]];\n if (v === false) {\n if (typeof read(`suggest.${entry[1]}`) === 'undefined') {\n write(`suggest.${entry[1]}`, false);\n }\n }\n }\n write('suggest.filteredTypes', undefined);\n }\n});\nregisterEditorSettingMigration('quickSuggestions', (input, read, write) => {\n if (typeof input === 'boolean') {\n const value = input ? 'on' : 'off';\n const newValue = { comments: value, strings: value, other: value };\n write('quickSuggestions', newValue);\n }\n});\n// Sticky Scroll\nregisterEditorSettingMigration('experimental.stickyScroll.enabled', (value, read, write) => {\n if (typeof value === 'boolean') {\n write('experimental.stickyScroll.enabled', undefined);\n if (typeof read('stickyScroll.enabled') === 'undefined') {\n write('stickyScroll.enabled', value);\n }\n }\n});\nregisterEditorSettingMigration('experimental.stickyScroll.maxLineCount', (value, read, write) => {\n if (typeof value === 'number') {\n write('experimental.stickyScroll.maxLineCount', undefined);\n if (typeof read('stickyScroll.maxLineCount') === 'undefined') {\n write('stickyScroll.maxLineCount', value);\n }\n }\n});\n// Code Actions on Save\nregisterEditorSettingMigration('codeActionsOnSave', (value, read, write) => {\n if (value && typeof value === 'object') {\n let toBeModified = false;\n const newValue = {};\n for (const entry of Object.entries(value)) {\n if (typeof entry[1] === 'boolean') {\n toBeModified = true;\n newValue[entry[0]] = entry[1] ? 'explicit' : 'never';\n }\n else {\n newValue[entry[0]] = entry[1];\n }\n }\n if (toBeModified) {\n write(`codeActionsOnSave`, newValue);\n }\n }\n});\n// Migrate Quick Fix Settings\nregisterEditorSettingMigration('codeActionWidget.includeNearbyQuickfixes', (value, read, write) => {\n if (typeof value === 'boolean') {\n write('codeActionWidget.includeNearbyQuickfixes', undefined);\n if (typeof read('codeActionWidget.includeNearbyQuickFixes') === 'undefined') {\n write('codeActionWidget.includeNearbyQuickFixes', value);\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../base/common/event.js';\nclass TabFocusImpl {\n constructor() {\n this._tabFocus = false;\n this._onDidChangeTabFocus = new Emitter();\n this.onDidChangeTabFocus = this._onDidChangeTabFocus.event;\n }\n getTabFocusMode() {\n return this._tabFocus;\n }\n setTabFocusMode(tabFocusMode) {\n this._tabFocus = tabFocusMode;\n this._onDidChangeTabFocus.fire(this._tabFocus);\n }\n}\n/**\n * Control what pressing Tab does.\n * If it is false, pressing Tab or Shift-Tab will be handled by the editor.\n * If it is true, pressing Tab or Shift-Tab will move the browser focus.\n * Defaults to false.\n */\nexport const TabFocus = new TabFocusImpl();\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 *--------------------------------------------------------------------------------------------*/\nimport { RawContextKey } from '../../contextkey/common/contextkey.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const IAccessibilityService = createDecorator('accessibilityService');\nexport const CONTEXT_ACCESSIBILITY_MODE_ENABLED = new RawContextKey('accessibilityModeEnabled', false);\nexport function isAccessibilityInformation(obj) {\n return obj && typeof obj === 'object'\n && typeof obj.label === 'string'\n && (typeof obj.role === 'undefined' || typeof obj.role === 'string');\n}\nexport const IAccessibleNotificationService = createDecorator('accessibleNotificationService');\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport * as browser from '../../../base/browser/browser.js';\nimport * as arrays from '../../../base/common/arrays.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport * as objects from '../../../base/common/objects.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { ElementSizeObserver } from './elementSizeObserver.js';\nimport { FontMeasurements } from './fontMeasurements.js';\nimport { migrateOptions } from './migrateOptions.js';\nimport { TabFocus } from './tabFocus.js';\nimport { ComputeOptionsMemory, ConfigurationChangedEvent, editorOptionsRegistry } from '../../common/config/editorOptions.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { BareFontInfo } from '../../common/config/fontInfo.js';\nimport { IAccessibilityService } from '../../../platform/accessibility/common/accessibility.js';\nlet EditorConfiguration = class EditorConfiguration extends Disposable {\n constructor(isSimpleWidget, options, container, _accessibilityService) {\n super();\n this._accessibilityService = _accessibilityService;\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._onDidChangeFast = this._register(new Emitter());\n this.onDidChangeFast = this._onDidChangeFast.event;\n this._isDominatedByLongLines = false;\n this._viewLineCount = 1;\n this._lineNumbersDigitCount = 1;\n this._reservedHeight = 0;\n this._glyphMarginDecorationLaneCount = 1;\n this._computeOptionsMemory = new ComputeOptionsMemory();\n this.isSimpleWidget = isSimpleWidget;\n this._containerObserver = this._register(new ElementSizeObserver(container, options.dimension));\n this._rawOptions = deepCloneAndMigrateOptions(options);\n this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);\n this.options = this._computeOptions();\n if (this.options.get(13 /* EditorOption.automaticLayout */)) {\n this._containerObserver.startObserving();\n }\n this._register(EditorZoom.onDidChangeZoomLevel(() => this._recomputeOptions()));\n this._register(TabFocus.onDidChangeTabFocus(() => this._recomputeOptions()));\n this._register(this._containerObserver.onDidChange(() => this._recomputeOptions()));\n this._register(FontMeasurements.onDidChange(() => this._recomputeOptions()));\n this._register(browser.PixelRatio.onDidChange(() => this._recomputeOptions()));\n this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(() => this._recomputeOptions()));\n }\n _recomputeOptions() {\n const newOptions = this._computeOptions();\n const changeEvent = EditorOptionsUtil.checkEquals(this.options, newOptions);\n if (changeEvent === null) {\n // nothing changed!\n return;\n }\n this.options = newOptions;\n this._onDidChangeFast.fire(changeEvent);\n this._onDidChange.fire(changeEvent);\n }\n _computeOptions() {\n const partialEnv = this._readEnvConfiguration();\n const bareFontInfo = BareFontInfo.createFromValidatedSettings(this._validatedOptions, partialEnv.pixelRatio, this.isSimpleWidget);\n const fontInfo = this._readFontInfo(bareFontInfo);\n const env = {\n memory: this._computeOptionsMemory,\n outerWidth: partialEnv.outerWidth,\n outerHeight: partialEnv.outerHeight - this._reservedHeight,\n fontInfo: fontInfo,\n extraEditorClassName: partialEnv.extraEditorClassName,\n isDominatedByLongLines: this._isDominatedByLongLines,\n viewLineCount: this._viewLineCount,\n lineNumbersDigitCount: this._lineNumbersDigitCount,\n emptySelectionClipboard: partialEnv.emptySelectionClipboard,\n pixelRatio: partialEnv.pixelRatio,\n tabFocusMode: TabFocus.getTabFocusMode(),\n accessibilitySupport: partialEnv.accessibilitySupport,\n glyphMarginDecorationLaneCount: this._glyphMarginDecorationLaneCount\n };\n return EditorOptionsUtil.computeOptions(this._validatedOptions, env);\n }\n _readEnvConfiguration() {\n return {\n extraEditorClassName: getExtraEditorClassName(),\n outerWidth: this._containerObserver.getWidth(),\n outerHeight: this._containerObserver.getHeight(),\n emptySelectionClipboard: browser.isWebKit || browser.isFirefox,\n pixelRatio: browser.PixelRatio.value,\n accessibilitySupport: (this._accessibilityService.isScreenReaderOptimized()\n ? 2 /* AccessibilitySupport.Enabled */\n : this._accessibilityService.getAccessibilitySupport())\n };\n }\n _readFontInfo(bareFontInfo) {\n return FontMeasurements.readFontInfo(bareFontInfo);\n }\n getRawOptions() {\n return this._rawOptions;\n }\n updateOptions(_newOptions) {\n const newOptions = deepCloneAndMigrateOptions(_newOptions);\n const didChange = EditorOptionsUtil.applyUpdate(this._rawOptions, newOptions);\n if (!didChange) {\n return;\n }\n this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);\n this._recomputeOptions();\n }\n observeContainer(dimension) {\n this._containerObserver.observe(dimension);\n }\n setIsDominatedByLongLines(isDominatedByLongLines) {\n if (this._isDominatedByLongLines === isDominatedByLongLines) {\n return;\n }\n this._isDominatedByLongLines = isDominatedByLongLines;\n this._recomputeOptions();\n }\n setModelLineCount(modelLineCount) {\n const lineNumbersDigitCount = digitCount(modelLineCount);\n if (this._lineNumbersDigitCount === lineNumbersDigitCount) {\n return;\n }\n this._lineNumbersDigitCount = lineNumbersDigitCount;\n this._recomputeOptions();\n }\n setViewLineCount(viewLineCount) {\n if (this._viewLineCount === viewLineCount) {\n return;\n }\n this._viewLineCount = viewLineCount;\n this._recomputeOptions();\n }\n setReservedHeight(reservedHeight) {\n if (this._reservedHeight === reservedHeight) {\n return;\n }\n this._reservedHeight = reservedHeight;\n this._recomputeOptions();\n }\n setGlyphMarginDecorationLaneCount(decorationLaneCount) {\n if (this._glyphMarginDecorationLaneCount === decorationLaneCount) {\n return;\n }\n this._glyphMarginDecorationLaneCount = decorationLaneCount;\n this._recomputeOptions();\n }\n};\nEditorConfiguration = __decorate([\n __param(3, IAccessibilityService)\n], EditorConfiguration);\nexport { EditorConfiguration };\nfunction digitCount(n) {\n let r = 0;\n while (n) {\n n = Math.floor(n / 10);\n r++;\n }\n return r ? r : 1;\n}\nfunction getExtraEditorClassName() {\n let extra = '';\n if (!browser.isSafari && !browser.isWebkitWebView) {\n // Use user-select: none in all browsers except Safari and native macOS WebView\n extra += 'no-user-select ';\n }\n if (browser.isSafari) {\n // See https://github.com/microsoft/vscode/issues/108822\n extra += 'no-minimap-shadow ';\n extra += 'enable-user-select ';\n }\n if (platform.isMacintosh) {\n extra += 'mac ';\n }\n return extra;\n}\nclass ValidatedEditorOptions {\n constructor() {\n this._values = [];\n }\n _read(option) {\n return this._values[option];\n }\n get(id) {\n return this._values[id];\n }\n _write(option, value) {\n this._values[option] = value;\n }\n}\nexport class ComputedEditorOptions {\n constructor() {\n this._values = [];\n }\n _read(id) {\n if (id >= this._values.length) {\n throw new Error('Cannot read uninitialized value');\n }\n return this._values[id];\n }\n get(id) {\n return this._read(id);\n }\n _write(id, value) {\n this._values[id] = value;\n }\n}\nexport class EditorOptionsUtil {\n static validateOptions(options) {\n const result = new ValidatedEditorOptions();\n for (const editorOption of editorOptionsRegistry) {\n const value = (editorOption.name === '_never_' ? undefined : options[editorOption.name]);\n result._write(editorOption.id, editorOption.validate(value));\n }\n return result;\n }\n static computeOptions(options, env) {\n const result = new ComputedEditorOptions();\n for (const editorOption of editorOptionsRegistry) {\n result._write(editorOption.id, editorOption.compute(env, result, options._read(editorOption.id)));\n }\n return result;\n }\n static _deepEquals(a, b) {\n if (typeof a !== 'object' || typeof b !== 'object' || !a || !b) {\n return a === b;\n }\n if (Array.isArray(a) || Array.isArray(b)) {\n return (Array.isArray(a) && Array.isArray(b) ? arrays.equals(a, b) : false);\n }\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n for (const key in a) {\n if (!EditorOptionsUtil._deepEquals(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n static checkEquals(a, b) {\n const result = [];\n let somethingChanged = false;\n for (const editorOption of editorOptionsRegistry) {\n const changed = !EditorOptionsUtil._deepEquals(a._read(editorOption.id), b._read(editorOption.id));\n result[editorOption.id] = changed;\n if (changed) {\n somethingChanged = true;\n }\n }\n return (somethingChanged ? new ConfigurationChangedEvent(result) : null);\n }\n /**\n * Returns true if something changed.\n * Modifies `options`.\n */\n static applyUpdate(options, update) {\n let changed = false;\n for (const editorOption of editorOptionsRegistry) {\n if (update.hasOwnProperty(editorOption.name)) {\n const result = editorOption.applyUpdate(options[editorOption.name], update[editorOption.name]);\n options[editorOption.name] = result.newValue;\n changed = changed || result.didChange;\n }\n }\n return changed;\n }\n}\nfunction deepCloneAndMigrateOptions(_options) {\n const options = objects.deepClone(_options);\n migrateOptions(options);\n return options;\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 *--------------------------------------------------------------------------------------------*/\nfunction createDecorator(mapFn) {\n return (target, key, descriptor) => {\n let fnKey = null;\n let fn = null;\n if (typeof descriptor.value === 'function') {\n fnKey = 'value';\n fn = descriptor.value;\n }\n else if (typeof descriptor.get === 'function') {\n fnKey = 'get';\n fn = descriptor.get;\n }\n if (!fn) {\n throw new Error('not supported');\n }\n descriptor[fnKey] = mapFn(fn, key);\n };\n}\nexport function memoize(_target, key, descriptor) {\n let fnKey = null;\n let fn = null;\n if (typeof descriptor.value === 'function') {\n fnKey = 'value';\n fn = descriptor.value;\n if (fn.length !== 0) {\n console.warn('Memoize should only be used in functions with zero parameters');\n }\n }\n else if (typeof descriptor.get === 'function') {\n fnKey = 'get';\n fn = descriptor.get;\n }\n if (!fn) {\n throw new Error('not supported');\n }\n const memoizeKey = `$memoize$${key}`;\n descriptor[fnKey] = function (...args) {\n if (!this.hasOwnProperty(memoizeKey)) {\n Object.defineProperty(this, memoizeKey, {\n configurable: false,\n enumerable: false,\n writable: false,\n value: fn.apply(this, args)\n });\n }\n return this[memoizeKey];\n };\n}\nexport function debounce(delay, reducer, initialValueProvider) {\n return createDecorator((fn, key) => {\n const timerKey = `$debounce$${key}`;\n const resultKey = `$debounce$result$${key}`;\n return function (...args) {\n if (!this[resultKey]) {\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }\n clearTimeout(this[timerKey]);\n if (reducer) {\n this[resultKey] = reducer(this[resultKey], ...args);\n args = [this[resultKey]];\n }\n this[timerKey] = setTimeout(() => {\n fn.apply(this, args);\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }, delay);\n };\n });\n}\nexport function throttle(delay, reducer, initialValueProvider) {\n return createDecorator((fn, key) => {\n const timerKey = `$throttle$timer$${key}`;\n const resultKey = `$throttle$result$${key}`;\n const lastRunKey = `$throttle$lastRun$${key}`;\n const pendingKey = `$throttle$pending$${key}`;\n return function (...args) {\n if (!this[resultKey]) {\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }\n if (this[lastRunKey] === null || this[lastRunKey] === undefined) {\n this[lastRunKey] = -Number.MAX_VALUE;\n }\n if (reducer) {\n this[resultKey] = reducer(this[resultKey], ...args);\n }\n if (this[pendingKey]) {\n return;\n }\n const nextTime = this[lastRunKey] + delay;\n if (nextTime <= Date.now()) {\n this[lastRunKey] = Date.now();\n fn.apply(this, [this[resultKey]]);\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }\n else {\n this[pendingKey] = true;\n this[timerKey] = setTimeout(() => {\n this[pendingKey] = false;\n this[lastRunKey] = Date.now();\n fn.apply(this, [this[resultKey]]);\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }, nextTime - Date.now());\n }\n };\n });\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport * as DomUtils from './dom.js';\nimport { mainWindow } from './window.js';\nimport * as arrays from '../common/arrays.js';\nimport { memoize } from '../common/decorators.js';\nimport { Event as EventUtils } from '../common/event.js';\nimport { Disposable, markAsSingleton, toDisposable } from '../common/lifecycle.js';\nimport { LinkedList } from '../common/linkedList.js';\nexport var EventType;\n(function (EventType) {\n EventType.Tap = '-monaco-gesturetap';\n EventType.Change = '-monaco-gesturechange';\n EventType.Start = '-monaco-gesturestart';\n EventType.End = '-monaco-gesturesend';\n EventType.Contextmenu = '-monaco-gesturecontextmenu';\n})(EventType || (EventType = {}));\nexport class Gesture extends Disposable {\n constructor() {\n super();\n this.dispatched = false;\n this.targets = new LinkedList();\n this.ignoreTargets = new LinkedList();\n this.activeTouches = {};\n this.handle = null;\n this._lastSetTapCountTime = 0;\n this._register(EventUtils.runAndSubscribe(DomUtils.onDidRegisterWindow, ({ window, disposables }) => {\n disposables.add(DomUtils.addDisposableListener(window.document, 'touchstart', (e) => this.onTouchStart(e), { passive: false }));\n disposables.add(DomUtils.addDisposableListener(window.document, 'touchend', (e) => this.onTouchEnd(window, e)));\n disposables.add(DomUtils.addDisposableListener(window.document, 'touchmove', (e) => this.onTouchMove(e), { passive: false }));\n }, { window: mainWindow, disposables: this._store }));\n }\n static addTarget(element) {\n if (!Gesture.isTouchDevice()) {\n return Disposable.None;\n }\n if (!Gesture.INSTANCE) {\n Gesture.INSTANCE = markAsSingleton(new Gesture());\n }\n const remove = Gesture.INSTANCE.targets.push(element);\n return toDisposable(remove);\n }\n static ignoreTarget(element) {\n if (!Gesture.isTouchDevice()) {\n return Disposable.None;\n }\n if (!Gesture.INSTANCE) {\n Gesture.INSTANCE = markAsSingleton(new Gesture());\n }\n const remove = Gesture.INSTANCE.ignoreTargets.push(element);\n return toDisposable(remove);\n }\n static isTouchDevice() {\n // `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be\n // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n return 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0;\n }\n dispose() {\n if (this.handle) {\n this.handle.dispose();\n this.handle = null;\n }\n super.dispose();\n }\n onTouchStart(e) {\n const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n if (this.handle) {\n this.handle.dispose();\n this.handle = null;\n }\n for (let i = 0, len = e.targetTouches.length; i < len; i++) {\n const touch = e.targetTouches.item(i);\n this.activeTouches[touch.identifier] = {\n id: touch.identifier,\n initialTarget: touch.target,\n initialTimeStamp: timestamp,\n initialPageX: touch.pageX,\n initialPageY: touch.pageY,\n rollingTimestamps: [timestamp],\n rollingPageX: [touch.pageX],\n rollingPageY: [touch.pageY]\n };\n const evt = this.newGestureEvent(EventType.Start, touch.target);\n evt.pageX = touch.pageX;\n evt.pageY = touch.pageY;\n this.dispatchEvent(evt);\n }\n if (this.dispatched) {\n e.preventDefault();\n e.stopPropagation();\n this.dispatched = false;\n }\n }\n onTouchEnd(targetWindow, e) {\n const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n const activeTouchCount = Object.keys(this.activeTouches).length;\n for (let i = 0, len = e.changedTouches.length; i < len; i++) {\n const touch = e.changedTouches.item(i);\n if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n console.warn('move of an UNKNOWN touch', touch);\n continue;\n }\n const data = this.activeTouches[touch.identifier], holdTime = Date.now() - data.initialTimeStamp;\n if (holdTime < Gesture.HOLD_DELAY\n && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30\n && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {\n const evt = this.newGestureEvent(EventType.Tap, data.initialTarget);\n evt.pageX = arrays.tail(data.rollingPageX);\n evt.pageY = arrays.tail(data.rollingPageY);\n this.dispatchEvent(evt);\n }\n else if (holdTime >= Gesture.HOLD_DELAY\n && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30\n && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {\n const evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget);\n evt.pageX = arrays.tail(data.rollingPageX);\n evt.pageY = arrays.tail(data.rollingPageY);\n this.dispatchEvent(evt);\n }\n else if (activeTouchCount === 1) {\n const finalX = arrays.tail(data.rollingPageX);\n const finalY = arrays.tail(data.rollingPageY);\n const deltaT = arrays.tail(data.rollingTimestamps) - data.rollingTimestamps[0];\n const deltaX = finalX - data.rollingPageX[0];\n const deltaY = finalY - data.rollingPageY[0];\n // We need to get all the dispatch targets on the start of the inertia event\n const dispatchTo = [...this.targets].filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget));\n this.inertia(targetWindow, dispatchTo, timestamp, // time now\n Math.abs(deltaX) / deltaT, // speed\n deltaX > 0 ? 1 : -1, // x direction\n finalX, // x now\n Math.abs(deltaY) / deltaT, // y speed\n deltaY > 0 ? 1 : -1, // y direction\n finalY // y now\n );\n }\n this.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget));\n // forget about this touch\n delete this.activeTouches[touch.identifier];\n }\n if (this.dispatched) {\n e.preventDefault();\n e.stopPropagation();\n this.dispatched = false;\n }\n }\n newGestureEvent(type, initialTarget) {\n const event = document.createEvent('CustomEvent');\n event.initEvent(type, false, true);\n event.initialTarget = initialTarget;\n event.tapCount = 0;\n return event;\n }\n dispatchEvent(event) {\n if (event.type === EventType.Tap) {\n const currentTime = (new Date()).getTime();\n let setTapCount = 0;\n if (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) {\n setTapCount = 1;\n }\n else {\n setTapCount = 2;\n }\n this._lastSetTapCountTime = currentTime;\n event.tapCount = setTapCount;\n }\n else if (event.type === EventType.Change || event.type === EventType.Contextmenu) {\n // tap is canceled by scrolling or context menu\n this._lastSetTapCountTime = 0;\n }\n if (event.initialTarget instanceof Node) {\n for (const ignoreTarget of this.ignoreTargets) {\n if (ignoreTarget.contains(event.initialTarget)) {\n return;\n }\n }\n for (const target of this.targets) {\n if (target.contains(event.initialTarget)) {\n target.dispatchEvent(event);\n this.dispatched = true;\n }\n }\n }\n }\n inertia(targetWindow, dispatchTo, t1, vX, dirX, x, vY, dirY, y) {\n this.handle = DomUtils.scheduleAtNextAnimationFrame(targetWindow, () => {\n const now = Date.now();\n // velocity: old speed + accel_over_time\n const deltaT = now - t1;\n let delta_pos_x = 0, delta_pos_y = 0;\n let stopped = true;\n vX += Gesture.SCROLL_FRICTION * deltaT;\n vY += Gesture.SCROLL_FRICTION * deltaT;\n if (vX > 0) {\n stopped = false;\n delta_pos_x = dirX * vX * deltaT;\n }\n if (vY > 0) {\n stopped = false;\n delta_pos_y = dirY * vY * deltaT;\n }\n // dispatch translation event\n const evt = this.newGestureEvent(EventType.Change);\n evt.translationX = delta_pos_x;\n evt.translationY = delta_pos_y;\n dispatchTo.forEach(d => d.dispatchEvent(evt));\n if (!stopped) {\n this.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);\n }\n });\n }\n onTouchMove(e) {\n const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n for (let i = 0, len = e.changedTouches.length; i < len; i++) {\n const touch = e.changedTouches.item(i);\n if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n console.warn('end of an UNKNOWN touch', touch);\n continue;\n }\n const data = this.activeTouches[touch.identifier];\n const evt = this.newGestureEvent(EventType.Change, data.initialTarget);\n evt.translationX = touch.pageX - arrays.tail(data.rollingPageX);\n evt.translationY = touch.pageY - arrays.tail(data.rollingPageY);\n evt.pageX = touch.pageX;\n evt.pageY = touch.pageY;\n this.dispatchEvent(evt);\n // only keep a few data points, to average the final speed\n if (data.rollingPageX.length > 3) {\n data.rollingPageX.shift();\n data.rollingPageY.shift();\n data.rollingTimestamps.shift();\n }\n data.rollingPageX.push(touch.pageX);\n data.rollingPageY.push(touch.pageY);\n data.rollingTimestamps.push(timestamp);\n }\n if (this.dispatched) {\n e.preventDefault();\n e.stopPropagation();\n this.dispatched = false;\n }\n }\n}\nGesture.SCROLL_FRICTION = -0.005;\nGesture.HOLD_DELAY = 700;\nGesture.CLEAR_TAP_COUNT_TIME = 400; // ms\n__decorate([\n memoize\n], Gesture, \"isTouchDevice\", null);\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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from './dom.js';\nimport { DisposableStore, toDisposable } from '../common/lifecycle.js';\nexport class GlobalPointerMoveMonitor {\n constructor() {\n this._hooks = new DisposableStore();\n this._pointerMoveCallback = null;\n this._onStopCallback = null;\n }\n dispose() {\n this.stopMonitoring(false);\n this._hooks.dispose();\n }\n stopMonitoring(invokeStopCallback, browserEvent) {\n if (!this.isMonitoring()) {\n // Not monitoring\n return;\n }\n // Unhook\n this._hooks.clear();\n this._pointerMoveCallback = null;\n const onStopCallback = this._onStopCallback;\n this._onStopCallback = null;\n if (invokeStopCallback && onStopCallback) {\n onStopCallback(browserEvent);\n }\n }\n isMonitoring() {\n return !!this._pointerMoveCallback;\n }\n startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {\n if (this.isMonitoring()) {\n this.stopMonitoring(false);\n }\n this._pointerMoveCallback = pointerMoveCallback;\n this._onStopCallback = onStopCallback;\n let eventSource = initialElement;\n try {\n initialElement.setPointerCapture(pointerId);\n this._hooks.add(toDisposable(() => {\n try {\n initialElement.releasePointerCapture(pointerId);\n }\n catch (err) {\n // See https://github.com/microsoft/vscode/issues/161731\n //\n // `releasePointerCapture` sometimes fails when being invoked with the exception:\n // DOMException: Failed to execute 'releasePointerCapture' on 'Element':\n // No active pointer with the given id is found.\n //\n // There's no need to do anything in case of failure\n }\n }));\n }\n catch (err) {\n // See https://github.com/microsoft/vscode/issues/144584\n // See https://github.com/microsoft/vscode/issues/146947\n // `setPointerCapture` sometimes fails when being invoked\n // from a `mousedown` listener on macOS and Windows\n // and it always fails on Linux with the exception:\n // DOMException: Failed to execute 'setPointerCapture' on 'Element':\n // No active pointer with the given id is found.\n // In case of failure, we bind the listeners on the window\n eventSource = dom.getWindow(initialElement);\n }\n this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_MOVE, (e) => {\n if (e.buttons !== initialButtons) {\n // Buttons state has changed in the meantime\n this.stopMonitoring(true);\n return;\n }\n e.preventDefault();\n this._pointerMoveCallback(e);\n }));\n this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_UP, (e) => this.stopMonitoring(true)));\n }\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 *--------------------------------------------------------------------------------------------*/\nfunction roundFloat(number, decimalPoints) {\n const decimal = Math.pow(10, decimalPoints);\n return Math.round(number * decimal) / decimal;\n}\nexport class RGBA {\n constructor(r, g, b, a = 1) {\n this._rgbaBrand = undefined;\n this.r = Math.min(255, Math.max(0, r)) | 0;\n this.g = Math.min(255, Math.max(0, g)) | 0;\n this.b = Math.min(255, Math.max(0, b)) | 0;\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\n }\n static equals(a, b) {\n return a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a;\n }\n}\nexport class HSLA {\n constructor(h, s, l, a) {\n this._hslaBrand = undefined;\n this.h = Math.max(Math.min(360, h), 0) | 0;\n this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);\n this.l = roundFloat(Math.max(Math.min(1, l), 0), 3);\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\n }\n static equals(a, b) {\n return a.h === b.h && a.s === b.s && a.l === b.l && a.a === b.a;\n }\n /**\n * Converts an RGB color value to HSL. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes r, g, and b are contained in the set [0, 255] and\n * returns h in the set [0, 360], s, and l in the set [0, 1].\n */\n static fromRGBA(rgba) {\n const r = rgba.r / 255;\n const g = rgba.g / 255;\n const b = rgba.b / 255;\n const a = rgba.a;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n let s = 0;\n const l = (min + max) / 2;\n const chroma = max - min;\n if (chroma > 0) {\n s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1);\n switch (max) {\n case r:\n h = (g - b) / chroma + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / chroma + 2;\n break;\n case b:\n h = (r - g) / chroma + 4;\n break;\n }\n h *= 60;\n h = Math.round(h);\n }\n return new HSLA(h, s, l, a);\n }\n static _hue2rgb(p, q, t) {\n if (t < 0) {\n t += 1;\n }\n if (t > 1) {\n t -= 1;\n }\n if (t < 1 / 6) {\n return p + (q - p) * 6 * t;\n }\n if (t < 1 / 2) {\n return q;\n }\n if (t < 2 / 3) {\n return p + (q - p) * (2 / 3 - t) * 6;\n }\n return p;\n }\n /**\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h in the set [0, 360] s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n */\n static toRGBA(hsla) {\n const h = hsla.h / 360;\n const { s, l, a } = hsla;\n let r, g, b;\n if (s === 0) {\n r = g = b = l; // achromatic\n }\n else {\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = HSLA._hue2rgb(p, q, h + 1 / 3);\n g = HSLA._hue2rgb(p, q, h);\n b = HSLA._hue2rgb(p, q, h - 1 / 3);\n }\n return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);\n }\n}\nexport class HSVA {\n constructor(h, s, v, a) {\n this._hsvaBrand = undefined;\n this.h = Math.max(Math.min(360, h), 0) | 0;\n this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);\n this.v = roundFloat(Math.max(Math.min(1, v), 0), 3);\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\n }\n static equals(a, b) {\n return a.h === b.h && a.s === b.s && a.v === b.v && a.a === b.a;\n }\n // from http://www.rapidtables.com/convert/color/rgb-to-hsv.htm\n static fromRGBA(rgba) {\n const r = rgba.r / 255;\n const g = rgba.g / 255;\n const b = rgba.b / 255;\n const cmax = Math.max(r, g, b);\n const cmin = Math.min(r, g, b);\n const delta = cmax - cmin;\n const s = cmax === 0 ? 0 : (delta / cmax);\n let m;\n if (delta === 0) {\n m = 0;\n }\n else if (cmax === r) {\n m = ((((g - b) / delta) % 6) + 6) % 6;\n }\n else if (cmax === g) {\n m = ((b - r) / delta) + 2;\n }\n else {\n m = ((r - g) / delta) + 4;\n }\n return new HSVA(Math.round(m * 60), s, cmax, rgba.a);\n }\n // from http://www.rapidtables.com/convert/color/hsv-to-rgb.htm\n static toRGBA(hsva) {\n const { h, s, v, a } = hsva;\n const c = v * s;\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\n const m = v - c;\n let [r, g, b] = [0, 0, 0];\n if (h < 60) {\n r = c;\n g = x;\n }\n else if (h < 120) {\n r = x;\n g = c;\n }\n else if (h < 180) {\n g = c;\n b = x;\n }\n else if (h < 240) {\n g = x;\n b = c;\n }\n else if (h < 300) {\n r = x;\n b = c;\n }\n else if (h <= 360) {\n r = c;\n b = x;\n }\n r = Math.round((r + m) * 255);\n g = Math.round((g + m) * 255);\n b = Math.round((b + m) * 255);\n return new RGBA(r, g, b, a);\n }\n}\nexport class Color {\n static fromHex(hex) {\n return Color.Format.CSS.parseHex(hex) || Color.red;\n }\n static equals(a, b) {\n if (!a && !b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.equals(b);\n }\n get hsla() {\n if (this._hsla) {\n return this._hsla;\n }\n else {\n return HSLA.fromRGBA(this.rgba);\n }\n }\n get hsva() {\n if (this._hsva) {\n return this._hsva;\n }\n return HSVA.fromRGBA(this.rgba);\n }\n constructor(arg) {\n if (!arg) {\n throw new Error('Color needs a value');\n }\n else if (arg instanceof RGBA) {\n this.rgba = arg;\n }\n else if (arg instanceof HSLA) {\n this._hsla = arg;\n this.rgba = HSLA.toRGBA(arg);\n }\n else if (arg instanceof HSVA) {\n this._hsva = arg;\n this.rgba = HSVA.toRGBA(arg);\n }\n else {\n throw new Error('Invalid color ctor argument');\n }\n }\n equals(other) {\n return !!other && RGBA.equals(this.rgba, other.rgba) && HSLA.equals(this.hsla, other.hsla) && HSVA.equals(this.hsva, other.hsva);\n }\n /**\n * http://www.w3.org/TR/WCAG20/#relativeluminancedef\n * Returns the number in the set [0, 1]. O => Darkest Black. 1 => Lightest white.\n */\n getRelativeLuminance() {\n const R = Color._relativeLuminanceForComponent(this.rgba.r);\n const G = Color._relativeLuminanceForComponent(this.rgba.g);\n const B = Color._relativeLuminanceForComponent(this.rgba.b);\n const luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B;\n return roundFloat(luminance, 4);\n }\n static _relativeLuminanceForComponent(color) {\n const c = color / 255;\n return (c <= 0.03928) ? c / 12.92 : Math.pow(((c + 0.055) / 1.055), 2.4);\n }\n /**\n * http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n * Returns the contrast ration number in the set [1, 21].\n */\n getContrastRatio(another) {\n const lum1 = this.getRelativeLuminance();\n const lum2 = another.getRelativeLuminance();\n return lum1 > lum2 ? (lum1 + 0.05) / (lum2 + 0.05) : (lum2 + 0.05) / (lum1 + 0.05);\n }\n /**\n *\thttp://24ways.org/2010/calculating-color-contrast\n * Return 'true' if darker color otherwise 'false'\n */\n isDarker() {\n const yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1000;\n return yiq < 128;\n }\n /**\n *\thttp://24ways.org/2010/calculating-color-contrast\n * Return 'true' if lighter color otherwise 'false'\n */\n isLighter() {\n const yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1000;\n return yiq >= 128;\n }\n isLighterThan(another) {\n const lum1 = this.getRelativeLuminance();\n const lum2 = another.getRelativeLuminance();\n return lum1 > lum2;\n }\n isDarkerThan(another) {\n const lum1 = this.getRelativeLuminance();\n const lum2 = another.getRelativeLuminance();\n return lum1 < lum2;\n }\n lighten(factor) {\n return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l + this.hsla.l * factor, this.hsla.a));\n }\n darken(factor) {\n return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l - this.hsla.l * factor, this.hsla.a));\n }\n transparent(factor) {\n const { r, g, b, a } = this.rgba;\n return new Color(new RGBA(r, g, b, a * factor));\n }\n isTransparent() {\n return this.rgba.a === 0;\n }\n isOpaque() {\n return this.rgba.a === 1;\n }\n opposite() {\n return new Color(new RGBA(255 - this.rgba.r, 255 - this.rgba.g, 255 - this.rgba.b, this.rgba.a));\n }\n blend(c) {\n const rgba = c.rgba;\n // Convert to 0..1 opacity\n const thisA = this.rgba.a;\n const colorA = rgba.a;\n const a = thisA + colorA * (1 - thisA);\n if (a < 1e-6) {\n return Color.transparent;\n }\n const r = this.rgba.r * thisA / a + rgba.r * colorA * (1 - thisA) / a;\n const g = this.rgba.g * thisA / a + rgba.g * colorA * (1 - thisA) / a;\n const b = this.rgba.b * thisA / a + rgba.b * colorA * (1 - thisA) / a;\n return new Color(new RGBA(r, g, b, a));\n }\n makeOpaque(opaqueBackground) {\n if (this.isOpaque() || opaqueBackground.rgba.a !== 1) {\n // only allow to blend onto a non-opaque color onto a opaque color\n return this;\n }\n const { r, g, b, a } = this.rgba;\n // https://stackoverflow.com/questions/12228548/finding-equivalent-color-with-opacity\n return new Color(new RGBA(opaqueBackground.rgba.r - a * (opaqueBackground.rgba.r - r), opaqueBackground.rgba.g - a * (opaqueBackground.rgba.g - g), opaqueBackground.rgba.b - a * (opaqueBackground.rgba.b - b), 1));\n }\n flatten(...backgrounds) {\n const background = backgrounds.reduceRight((accumulator, color) => {\n return Color._flatten(color, accumulator);\n });\n return Color._flatten(this, background);\n }\n static _flatten(foreground, background) {\n const backgroundAlpha = 1 - foreground.rgba.a;\n return new Color(new RGBA(backgroundAlpha * background.rgba.r + foreground.rgba.a * foreground.rgba.r, backgroundAlpha * background.rgba.g + foreground.rgba.a * foreground.rgba.g, backgroundAlpha * background.rgba.b + foreground.rgba.a * foreground.rgba.b));\n }\n toString() {\n if (!this._toString) {\n this._toString = Color.Format.CSS.format(this);\n }\n return this._toString;\n }\n static getLighterColor(of, relative, factor) {\n if (of.isLighterThan(relative)) {\n return of;\n }\n factor = factor ? factor : 0.5;\n const lum1 = of.getRelativeLuminance();\n const lum2 = relative.getRelativeLuminance();\n factor = factor * (lum2 - lum1) / lum2;\n return of.lighten(factor);\n }\n static getDarkerColor(of, relative, factor) {\n if (of.isDarkerThan(relative)) {\n return of;\n }\n factor = factor ? factor : 0.5;\n const lum1 = of.getRelativeLuminance();\n const lum2 = relative.getRelativeLuminance();\n factor = factor * (lum1 - lum2) / lum1;\n return of.darken(factor);\n }\n}\nColor.white = new Color(new RGBA(255, 255, 255, 1));\nColor.black = new Color(new RGBA(0, 0, 0, 1));\nColor.red = new Color(new RGBA(255, 0, 0, 1));\nColor.blue = new Color(new RGBA(0, 0, 255, 1));\nColor.green = new Color(new RGBA(0, 255, 0, 1));\nColor.cyan = new Color(new RGBA(0, 255, 255, 1));\nColor.lightgrey = new Color(new RGBA(211, 211, 211, 1));\nColor.transparent = new Color(new RGBA(0, 0, 0, 0));\n(function (Color) {\n let Format;\n (function (Format) {\n let CSS;\n (function (CSS) {\n function formatRGB(color) {\n if (color.rgba.a === 1) {\n return `rgb(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b})`;\n }\n return Color.Format.CSS.formatRGBA(color);\n }\n CSS.formatRGB = formatRGB;\n function formatRGBA(color) {\n return `rgba(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b}, ${+(color.rgba.a).toFixed(2)})`;\n }\n CSS.formatRGBA = formatRGBA;\n function formatHSL(color) {\n if (color.hsla.a === 1) {\n return `hsl(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%)`;\n }\n return Color.Format.CSS.formatHSLA(color);\n }\n CSS.formatHSL = formatHSL;\n function formatHSLA(color) {\n return `hsla(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%, ${color.hsla.a.toFixed(2)})`;\n }\n CSS.formatHSLA = formatHSLA;\n function _toTwoDigitHex(n) {\n const r = n.toString(16);\n return r.length !== 2 ? '0' + r : r;\n }\n /**\n * Formats the color as #RRGGBB\n */\n function formatHex(color) {\n return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}`;\n }\n CSS.formatHex = formatHex;\n /**\n * Formats the color as #RRGGBBAA\n * If 'compact' is set, colors without transparancy will be printed as #RRGGBB\n */\n function formatHexA(color, compact = false) {\n if (compact && color.rgba.a === 1) {\n return Color.Format.CSS.formatHex(color);\n }\n return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}${_toTwoDigitHex(Math.round(color.rgba.a * 255))}`;\n }\n CSS.formatHexA = formatHexA;\n /**\n * The default format will use HEX if opaque and RGBA otherwise.\n */\n function format(color) {\n if (color.isOpaque()) {\n return Color.Format.CSS.formatHex(color);\n }\n return Color.Format.CSS.formatRGBA(color);\n }\n CSS.format = format;\n /**\n * Converts an Hex color value to a Color.\n * returns r, g, and b are contained in the set [0, 255]\n * @param hex string (#RGB, #RGBA, #RRGGBB or #RRGGBBAA).\n */\n function parseHex(hex) {\n const length = hex.length;\n if (length === 0) {\n // Invalid color\n return null;\n }\n if (hex.charCodeAt(0) !== 35 /* CharCode.Hash */) {\n // Does not begin with a #\n return null;\n }\n if (length === 7) {\n // #RRGGBB format\n const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\n const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\n const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\n return new Color(new RGBA(r, g, b, 1));\n }\n if (length === 9) {\n // #RRGGBBAA format\n const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\n const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\n const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\n const a = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8));\n return new Color(new RGBA(r, g, b, a / 255));\n }\n if (length === 4) {\n // #RGB format\n const r = _parseHexDigit(hex.charCodeAt(1));\n const g = _parseHexDigit(hex.charCodeAt(2));\n const b = _parseHexDigit(hex.charCodeAt(3));\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b));\n }\n if (length === 5) {\n // #RGBA format\n const r = _parseHexDigit(hex.charCodeAt(1));\n const g = _parseHexDigit(hex.charCodeAt(2));\n const b = _parseHexDigit(hex.charCodeAt(3));\n const a = _parseHexDigit(hex.charCodeAt(4));\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a + a) / 255));\n }\n // Invalid color\n return null;\n }\n CSS.parseHex = parseHex;\n function _parseHexDigit(charCode) {\n switch (charCode) {\n case 48 /* CharCode.Digit0 */: return 0;\n case 49 /* CharCode.Digit1 */: return 1;\n case 50 /* CharCode.Digit2 */: return 2;\n case 51 /* CharCode.Digit3 */: return 3;\n case 52 /* CharCode.Digit4 */: return 4;\n case 53 /* CharCode.Digit5 */: return 5;\n case 54 /* CharCode.Digit6 */: return 6;\n case 55 /* CharCode.Digit7 */: return 7;\n case 56 /* CharCode.Digit8 */: return 8;\n case 57 /* CharCode.Digit9 */: return 9;\n case 97 /* CharCode.a */: return 10;\n case 65 /* CharCode.A */: return 10;\n case 98 /* CharCode.b */: return 11;\n case 66 /* CharCode.B */: return 11;\n case 99 /* CharCode.c */: return 12;\n case 67 /* CharCode.C */: return 12;\n case 100 /* CharCode.d */: return 13;\n case 68 /* CharCode.D */: return 13;\n case 101 /* CharCode.e */: return 14;\n case 69 /* CharCode.E */: return 14;\n case 102 /* CharCode.f */: return 15;\n case 70 /* CharCode.F */: return 15;\n }\n return 0;\n }\n })(CSS = Format.CSS || (Format.CSS = {}));\n })(Format = Color.Format || (Color.Format = {}));\n})(Color || (Color = {}));\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 *--------------------------------------------------------------------------------------------*/\nimport { RunOnceScheduler } from '../../../base/common/async.js';\nimport { Color, RGBA } from '../../../base/common/color.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { assertNever } from '../../../base/common/assert.js';\nimport * as nls from '../../../nls.js';\nimport { Extensions as JSONExtensions } from '../../jsonschemas/common/jsonContributionRegistry.js';\nimport * as platform from '../../registry/common/platform.js';\n/**\n * Returns the css variable name for the given color identifier. Dots (`.`) are replaced with hyphens (`-`) and\n * everything is prefixed with `--vscode-`.\n *\n * @sample `editorSuggestWidget.background` is `--vscode-editorSuggestWidget-background`.\n */\nexport function asCssVariableName(colorIdent) {\n return `--vscode-${colorIdent.replace(/\\./g, '-')}`;\n}\nexport function asCssVariable(color) {\n return `var(${asCssVariableName(color)})`;\n}\nexport function asCssVariableWithDefault(color, defaultCssValue) {\n return `var(${asCssVariableName(color)}, ${defaultCssValue})`;\n}\n// color registry\nexport const Extensions = {\n ColorContribution: 'base.contributions.colors'\n};\nclass ColorRegistry {\n constructor() {\n this._onDidChangeSchema = new Emitter();\n this.onDidChangeSchema = this._onDidChangeSchema.event;\n this.colorSchema = { type: 'object', properties: {} };\n this.colorReferenceSchema = { type: 'string', enum: [], enumDescriptions: [] };\n this.colorsById = {};\n }\n registerColor(id, defaults, description, needsTransparency = false, deprecationMessage) {\n const colorContribution = { id, description, defaults, needsTransparency, deprecationMessage };\n this.colorsById[id] = colorContribution;\n const propertySchema = { type: 'string', description, format: 'color-hex', defaultSnippets: [{ body: '${1:#ff0000}' }] };\n if (deprecationMessage) {\n propertySchema.deprecationMessage = deprecationMessage;\n }\n this.colorSchema.properties[id] = propertySchema;\n this.colorReferenceSchema.enum.push(id);\n this.colorReferenceSchema.enumDescriptions.push(description);\n this._onDidChangeSchema.fire();\n return id;\n }\n deregisterColor(id) {\n delete this.colorsById[id];\n delete this.colorSchema.properties[id];\n const index = this.colorReferenceSchema.enum.indexOf(id);\n if (index !== -1) {\n this.colorReferenceSchema.enum.splice(index, 1);\n this.colorReferenceSchema.enumDescriptions.splice(index, 1);\n }\n this._onDidChangeSchema.fire();\n }\n getColors() {\n return Object.keys(this.colorsById).map(id => this.colorsById[id]);\n }\n resolveDefaultColor(id, theme) {\n const colorDesc = this.colorsById[id];\n if (colorDesc && colorDesc.defaults) {\n const colorValue = colorDesc.defaults[theme.type];\n return resolveColorValue(colorValue, theme);\n }\n return undefined;\n }\n getColorSchema() {\n return this.colorSchema;\n }\n getColorReferenceSchema() {\n return this.colorReferenceSchema;\n }\n toString() {\n const sorter = (a, b) => {\n const cat1 = a.indexOf('.') === -1 ? 0 : 1;\n const cat2 = b.indexOf('.') === -1 ? 0 : 1;\n if (cat1 !== cat2) {\n return cat1 - cat2;\n }\n return a.localeCompare(b);\n };\n return Object.keys(this.colorsById).sort(sorter).map(k => `- \\`${k}\\`: ${this.colorsById[k].description}`).join('\\n');\n }\n}\nconst colorRegistry = new ColorRegistry();\nplatform.Registry.add(Extensions.ColorContribution, colorRegistry);\nexport function registerColor(id, defaults, description, needsTransparency, deprecationMessage) {\n return colorRegistry.registerColor(id, defaults, description, needsTransparency, deprecationMessage);\n}\nexport function getColorRegistry() {\n return colorRegistry;\n}\n// ----- base colors\nexport const foreground = registerColor('foreground', { dark: '#CCCCCC', light: '#616161', hcDark: '#FFFFFF', hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'foreground', \"Overall foreground color. This color is only used if not overridden by a component.\"));\nexport const disabledForeground = registerColor('disabledForeground', { dark: '#CCCCCC80', light: '#61616180', hcDark: '#A5A5A5', hcLight: '#7F7F7F' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'disabledForeground', \"Overall foreground for disabled elements. This color is only used if not overridden by a component.\"));\nexport const errorForeground = registerColor('errorForeground', { dark: '#F48771', light: '#A1260D', hcDark: '#F48771', hcLight: '#B5200D' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'errorForeground', \"Overall foreground color for error messages. This color is only used if not overridden by a component.\"));\nexport const descriptionForeground = registerColor('descriptionForeground', { light: '#717171', dark: transparent(foreground, 0.7), hcDark: transparent(foreground, 0.7), hcLight: transparent(foreground, 0.7) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'descriptionForeground', \"Foreground color for description text providing additional information, for example for a label.\"));\nexport const iconForeground = registerColor('icon.foreground', { dark: '#C5C5C5', light: '#424242', hcDark: '#FFFFFF', hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'iconForeground', \"The default color for icons in the workbench.\"));\nexport const focusBorder = registerColor('focusBorder', { dark: '#007FD4', light: '#0090F1', hcDark: '#F38518', hcLight: '#006BBD' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'focusBorder', \"Overall border color for focused elements. This color is only used if not overridden by a component.\"));\nexport const contrastBorder = registerColor('contrastBorder', { light: null, dark: null, hcDark: '#6FC3DF', hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'contrastBorder', \"An extra border around elements to separate them from others for greater contrast.\"));\nexport const activeContrastBorder = registerColor('contrastActiveBorder', { light: null, dark: null, hcDark: focusBorder, hcLight: focusBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'activeContrastBorder', \"An extra border around active elements to separate them from others for greater contrast.\"));\nexport const selectionBackground = registerColor('selection.background', { light: null, dark: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'selectionBackground', \"The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor.\"));\n// ------ text colors\nexport const textSeparatorForeground = registerColor('textSeparator.foreground', { light: '#0000002e', dark: '#ffffff2e', hcDark: Color.black, hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textSeparatorForeground', \"Color for text separators.\"));\nexport const textLinkForeground = registerColor('textLink.foreground', { light: '#006AB1', dark: '#3794FF', hcDark: '#3794FF', hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textLinkForeground', \"Foreground color for links in text.\"));\nexport const textLinkActiveForeground = registerColor('textLink.activeForeground', { light: '#006AB1', dark: '#3794FF', hcDark: '#3794FF', hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textLinkActiveForeground', \"Foreground color for links in text when clicked on and on mouse hover.\"));\nexport const textPreformatForeground = registerColor('textPreformat.foreground', { light: '#A31515', dark: '#D7BA7D', hcDark: '#000000', hcLight: '#FFFFFF' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textPreformatForeground', \"Foreground color for preformatted text segments.\"));\nexport const textPreformatBackground = registerColor('textPreformat.background', { light: '#0000001A', dark: '#FFFFFF1A', hcDark: '#FFFFFF', hcLight: '#09345f' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textPreformatBackground', \"Background color for preformatted text segments.\"));\nexport const textBlockQuoteBackground = registerColor('textBlockQuote.background', { light: '#f2f2f2', dark: '#222222', hcDark: null, hcLight: '#F2F2F2' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textBlockQuoteBackground', \"Background color for block quotes in text.\"));\nexport const textBlockQuoteBorder = registerColor('textBlockQuote.border', { light: '#007acc80', dark: '#007acc80', hcDark: Color.white, hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textBlockQuoteBorder', \"Border color for block quotes in text.\"));\nexport const textCodeBlockBackground = registerColor('textCodeBlock.background', { light: '#dcdcdc66', dark: '#0a0a0a66', hcDark: Color.black, hcLight: '#F2F2F2' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'textCodeBlockBackground', \"Background color for code blocks in text.\"));\n// ----- widgets\nexport const widgetShadow = registerColor('widget.shadow', { dark: transparent(Color.black, .36), light: transparent(Color.black, .16), hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'widgetShadow', 'Shadow color of widgets such as find/replace inside the editor.'));\nexport const widgetBorder = registerColor('widget.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'widgetBorder', 'Border color of widgets such as find/replace inside the editor.'));\nexport const inputBackground = registerColor('input.background', { dark: '#3C3C3C', light: Color.white, hcDark: Color.black, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputBoxBackground', \"Input box background.\"));\nexport const inputForeground = registerColor('input.foreground', { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputBoxForeground', \"Input box foreground.\"));\nexport const inputBorder = registerColor('input.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputBoxBorder', \"Input box border.\"));\nexport const inputActiveOptionBorder = registerColor('inputOption.activeBorder', { dark: '#007ACC', light: '#007ACC', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputBoxActiveOptionBorder', \"Border color of activated options in input fields.\"));\nexport const inputActiveOptionHoverBackground = registerColor('inputOption.hoverBackground', { dark: '#5a5d5e80', light: '#b8b8b850', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputOption.hoverBackground', \"Background color of activated options in input fields.\"));\nexport const inputActiveOptionBackground = registerColor('inputOption.activeBackground', { dark: transparent(focusBorder, 0.4), light: transparent(focusBorder, 0.2), hcDark: Color.transparent, hcLight: Color.transparent }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputOption.activeBackground', \"Background hover color of options in input fields.\"));\nexport const inputActiveOptionForeground = registerColor('inputOption.activeForeground', { dark: Color.white, light: Color.black, hcDark: foreground, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputOption.activeForeground', \"Foreground color of activated options in input fields.\"));\nexport const inputPlaceholderForeground = registerColor('input.placeholderForeground', { light: transparent(foreground, 0.5), dark: transparent(foreground, 0.5), hcDark: transparent(foreground, 0.7), hcLight: transparent(foreground, 0.7) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputPlaceholderForeground', \"Input box foreground color for placeholder text.\"));\nexport const inputValidationInfoBackground = registerColor('inputValidation.infoBackground', { dark: '#063B49', light: '#D6ECF2', hcDark: Color.black, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationInfoBackground', \"Input validation background color for information severity.\"));\nexport const inputValidationInfoForeground = registerColor('inputValidation.infoForeground', { dark: null, light: null, hcDark: null, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationInfoForeground', \"Input validation foreground color for information severity.\"));\nexport const inputValidationInfoBorder = registerColor('inputValidation.infoBorder', { dark: '#007acc', light: '#007acc', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationInfoBorder', \"Input validation border color for information severity.\"));\nexport const inputValidationWarningBackground = registerColor('inputValidation.warningBackground', { dark: '#352A05', light: '#F6F5D2', hcDark: Color.black, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationWarningBackground', \"Input validation background color for warning severity.\"));\nexport const inputValidationWarningForeground = registerColor('inputValidation.warningForeground', { dark: null, light: null, hcDark: null, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationWarningForeground', \"Input validation foreground color for warning severity.\"));\nexport const inputValidationWarningBorder = registerColor('inputValidation.warningBorder', { dark: '#B89500', light: '#B89500', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationWarningBorder', \"Input validation border color for warning severity.\"));\nexport const inputValidationErrorBackground = registerColor('inputValidation.errorBackground', { dark: '#5A1D1D', light: '#F2DEDE', hcDark: Color.black, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationErrorBackground', \"Input validation background color for error severity.\"));\nexport const inputValidationErrorForeground = registerColor('inputValidation.errorForeground', { dark: null, light: null, hcDark: null, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationErrorForeground', \"Input validation foreground color for error severity.\"));\nexport const inputValidationErrorBorder = registerColor('inputValidation.errorBorder', { dark: '#BE1100', light: '#BE1100', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'inputValidationErrorBorder', \"Input validation border color for error severity.\"));\nexport const selectBackground = registerColor('dropdown.background', { dark: '#3C3C3C', light: Color.white, hcDark: Color.black, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'dropdownBackground', \"Dropdown background.\"));\nexport const selectListBackground = registerColor('dropdown.listBackground', { dark: null, light: null, hcDark: Color.black, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'dropdownListBackground', \"Dropdown list background.\"));\nexport const selectForeground = registerColor('dropdown.foreground', { dark: '#F0F0F0', light: foreground, hcDark: Color.white, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'dropdownForeground', \"Dropdown foreground.\"));\nexport const selectBorder = registerColor('dropdown.border', { dark: selectBackground, light: '#CECECE', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'dropdownBorder', \"Dropdown border.\"));\nexport const buttonForeground = registerColor('button.foreground', { dark: Color.white, light: Color.white, hcDark: Color.white, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonForeground', \"Button foreground color.\"));\nexport const buttonSeparator = registerColor('button.separator', { dark: transparent(buttonForeground, .4), light: transparent(buttonForeground, .4), hcDark: transparent(buttonForeground, .4), hcLight: transparent(buttonForeground, .4) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonSeparator', \"Button separator color.\"));\nexport const buttonBackground = registerColor('button.background', { dark: '#0E639C', light: '#007ACC', hcDark: null, hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonBackground', \"Button background color.\"));\nexport const buttonHoverBackground = registerColor('button.hoverBackground', { dark: lighten(buttonBackground, 0.2), light: darken(buttonBackground, 0.2), hcDark: buttonBackground, hcLight: buttonBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonHoverBackground', \"Button background color when hovering.\"));\nexport const buttonBorder = registerColor('button.border', { dark: contrastBorder, light: contrastBorder, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonBorder', \"Button border color.\"));\nexport const buttonSecondaryForeground = registerColor('button.secondaryForeground', { dark: Color.white, light: Color.white, hcDark: Color.white, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonSecondaryForeground', \"Secondary button foreground color.\"));\nexport const buttonSecondaryBackground = registerColor('button.secondaryBackground', { dark: '#3A3D41', light: '#5F6A79', hcDark: null, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonSecondaryBackground', \"Secondary button background color.\"));\nexport const buttonSecondaryHoverBackground = registerColor('button.secondaryHoverBackground', { dark: lighten(buttonSecondaryBackground, 0.2), light: darken(buttonSecondaryBackground, 0.2), hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'buttonSecondaryHoverBackground', \"Secondary button background color when hovering.\"));\nexport const badgeBackground = registerColor('badge.background', { dark: '#4D4D4D', light: '#C4C4C4', hcDark: Color.black, hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'badgeBackground', \"Badge background color. Badges are small information labels, e.g. for search results count.\"));\nexport const badgeForeground = registerColor('badge.foreground', { dark: Color.white, light: '#333', hcDark: Color.white, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'badgeForeground', \"Badge foreground color. Badges are small information labels, e.g. for search results count.\"));\nexport const scrollbarShadow = registerColor('scrollbar.shadow', { dark: '#000000', light: '#DDDDDD', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'scrollbarShadow', \"Scrollbar shadow to indicate that the view is scrolled.\"));\nexport const scrollbarSliderBackground = registerColor('scrollbarSlider.background', { dark: Color.fromHex('#797979').transparent(0.4), light: Color.fromHex('#646464').transparent(0.4), hcDark: transparent(contrastBorder, 0.6), hcLight: transparent(contrastBorder, 0.4) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'scrollbarSliderBackground', \"Scrollbar slider background color.\"));\nexport const scrollbarSliderHoverBackground = registerColor('scrollbarSlider.hoverBackground', { dark: Color.fromHex('#646464').transparent(0.7), light: Color.fromHex('#646464').transparent(0.7), hcDark: transparent(contrastBorder, 0.8), hcLight: transparent(contrastBorder, 0.8) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'scrollbarSliderHoverBackground', \"Scrollbar slider background color when hovering.\"));\nexport const scrollbarSliderActiveBackground = registerColor('scrollbarSlider.activeBackground', { dark: Color.fromHex('#BFBFBF').transparent(0.4), light: Color.fromHex('#000000').transparent(0.6), hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'scrollbarSliderActiveBackground', \"Scrollbar slider background color when clicked on.\"));\nexport const progressBarBackground = registerColor('progressBar.background', { dark: Color.fromHex('#0E70C0'), light: Color.fromHex('#0E70C0'), hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'progressBarBackground', \"Background color of the progress bar that can show for long running operations.\"));\nexport const editorErrorBackground = registerColor('editorError.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorError.background', 'Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorErrorForeground = registerColor('editorError.foreground', { dark: '#F14C4C', light: '#E51400', hcDark: '#F48771', hcLight: '#B5200D' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorError.foreground', 'Foreground color of error squigglies in the editor.'));\nexport const editorErrorBorder = registerColor('editorError.border', { dark: null, light: null, hcDark: Color.fromHex('#E47777').transparent(0.8), hcLight: '#B5200D' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'errorBorder', 'If set, color of double underlines for errors in the editor.'));\nexport const editorWarningBackground = registerColor('editorWarning.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorWarning.background', 'Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorWarningForeground = registerColor('editorWarning.foreground', { dark: '#CCA700', light: '#BF8803', hcDark: '#FFD370', hcLight: '#895503' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorWarning.foreground', 'Foreground color of warning squigglies in the editor.'));\nexport const editorWarningBorder = registerColor('editorWarning.border', { dark: null, light: null, hcDark: Color.fromHex('#FFCC00').transparent(0.8), hcLight: Color.fromHex('#FFCC00').transparent(0.8) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'warningBorder', 'If set, color of double underlines for warnings in the editor.'));\nexport const editorInfoBackground = registerColor('editorInfo.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInfo.background', 'Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorInfoForeground = registerColor('editorInfo.foreground', { dark: '#3794FF', light: '#1a85ff', hcDark: '#3794FF', hcLight: '#1a85ff' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInfo.foreground', 'Foreground color of info squigglies in the editor.'));\nexport const editorInfoBorder = registerColor('editorInfo.border', { dark: null, light: null, hcDark: Color.fromHex('#3794FF').transparent(0.8), hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'infoBorder', 'If set, color of double underlines for infos in the editor.'));\nexport const editorHintForeground = registerColor('editorHint.foreground', { dark: Color.fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorHint.foreground', 'Foreground color of hint squigglies in the editor.'));\nexport const editorHintBorder = registerColor('editorHint.border', { dark: null, light: null, hcDark: Color.fromHex('#eeeeee').transparent(0.8), hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'hintBorder', 'If set, color of double underlines for hints in the editor.'));\nexport const sashHoverBorder = registerColor('sash.hoverBorder', { dark: focusBorder, light: focusBorder, hcDark: focusBorder, hcLight: focusBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'sashActiveBorder', \"Border color of active sashes.\"));\n/**\n * Editor background color.\n */\nexport const editorBackground = registerColor('editor.background', { light: '#ffffff', dark: '#1E1E1E', hcDark: Color.black, hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorBackground', \"Editor background color.\"));\n/**\n * Editor foreground color.\n */\nexport const editorForeground = registerColor('editor.foreground', { light: '#333333', dark: '#BBBBBB', hcDark: Color.white, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorForeground', \"Editor default foreground color.\"));\n/**\n * Sticky scroll\n */\nexport const editorStickyScrollBackground = registerColor('editorStickyScroll.background', { light: editorBackground, dark: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorStickyScrollBackground', \"Sticky scroll background color for the editor\"));\nexport const editorStickyScrollHoverBackground = registerColor('editorStickyScrollHover.background', { dark: '#2A2D2E', light: '#F0F0F0', hcDark: null, hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorStickyScrollHoverBackground', \"Sticky scroll on hover background color for the editor\"));\n/**\n * Editor widgets\n */\nexport const editorWidgetBackground = registerColor('editorWidget.background', { dark: '#252526', light: '#F3F3F3', hcDark: '#0C141F', hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorWidgetBackground', 'Background color of editor widgets, such as find/replace.'));\nexport const editorWidgetForeground = registerColor('editorWidget.foreground', { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorWidgetForeground', 'Foreground color of editor widgets, such as find/replace.'));\nexport const editorWidgetBorder = registerColor('editorWidget.border', { dark: '#454545', light: '#C8C8C8', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorWidgetBorder', 'Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget.'));\nexport const editorWidgetResizeBorder = registerColor('editorWidget.resizeBorder', { light: null, dark: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorWidgetResizeBorder', \"Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget.\"));\n/**\n * Quick pick widget\n */\nexport const quickInputBackground = registerColor('quickInput.background', { dark: editorWidgetBackground, light: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'pickerBackground', \"Quick picker background color. The quick picker widget is the container for pickers like the command palette.\"));\nexport const quickInputForeground = registerColor('quickInput.foreground', { dark: editorWidgetForeground, light: editorWidgetForeground, hcDark: editorWidgetForeground, hcLight: editorWidgetForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'pickerForeground', \"Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.\"));\nexport const quickInputTitleBackground = registerColor('quickInputTitle.background', { dark: new Color(new RGBA(255, 255, 255, 0.105)), light: new Color(new RGBA(0, 0, 0, 0.06)), hcDark: '#000000', hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'pickerTitleBackground', \"Quick picker title background color. The quick picker widget is the container for pickers like the command palette.\"));\nexport const pickerGroupForeground = registerColor('pickerGroup.foreground', { dark: '#3794FF', light: '#0066BF', hcDark: Color.white, hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'pickerGroupForeground', \"Quick picker color for grouping labels.\"));\nexport const pickerGroupBorder = registerColor('pickerGroup.border', { dark: '#3F3F46', light: '#CCCEDB', hcDark: Color.white, hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'pickerGroupBorder', \"Quick picker color for grouping borders.\"));\n/**\n * Keybinding label\n */\nexport const keybindingLabelBackground = registerColor('keybindingLabel.background', { dark: new Color(new RGBA(128, 128, 128, 0.17)), light: new Color(new RGBA(221, 221, 221, 0.4)), hcDark: Color.transparent, hcLight: Color.transparent }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'keybindingLabelBackground', \"Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.\"));\nexport const keybindingLabelForeground = registerColor('keybindingLabel.foreground', { dark: Color.fromHex('#CCCCCC'), light: Color.fromHex('#555555'), hcDark: Color.white, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'keybindingLabelForeground', \"Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.\"));\nexport const keybindingLabelBorder = registerColor('keybindingLabel.border', { dark: new Color(new RGBA(51, 51, 51, 0.6)), light: new Color(new RGBA(204, 204, 204, 0.4)), hcDark: new Color(new RGBA(111, 195, 223)), hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'keybindingLabelBorder', \"Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.\"));\nexport const keybindingLabelBottomBorder = registerColor('keybindingLabel.bottomBorder', { dark: new Color(new RGBA(68, 68, 68, 0.6)), light: new Color(new RGBA(187, 187, 187, 0.4)), hcDark: new Color(new RGBA(111, 195, 223)), hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'keybindingLabelBottomBorder', \"Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.\"));\n/**\n * Editor selection colors.\n */\nexport const editorSelectionBackground = registerColor('editor.selectionBackground', { light: '#ADD6FF', dark: '#264F78', hcDark: '#f3f518', hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorSelectionBackground', \"Color of the editor selection.\"));\nexport const editorSelectionForeground = registerColor('editor.selectionForeground', { light: null, dark: null, hcDark: '#000000', hcLight: Color.white }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorSelectionForeground', \"Color of the selected text for high contrast.\"));\nexport const editorInactiveSelection = registerColor('editor.inactiveSelectionBackground', { light: transparent(editorSelectionBackground, 0.5), dark: transparent(editorSelectionBackground, 0.5), hcDark: transparent(editorSelectionBackground, 0.7), hcLight: transparent(editorSelectionBackground, 0.5) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInactiveSelection', \"Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations.\"), true);\nexport const editorSelectionHighlight = registerColor('editor.selectionHighlightBackground', { light: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), dark: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorSelectionHighlight', 'Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorSelectionHighlightBorder = registerColor('editor.selectionHighlightBorder', { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorSelectionHighlightBorder', \"Border color for regions with the same content as the selection.\"));\n/**\n * Editor find match colors.\n */\nexport const editorFindMatch = registerColor('editor.findMatchBackground', { light: '#A8AC94', dark: '#515C6A', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorFindMatch', \"Color of the current search match.\"));\nexport const editorFindMatchHighlight = registerColor('editor.findMatchHighlightBackground', { light: '#EA5C0055', dark: '#EA5C0055', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'findMatchHighlight', \"Color of the other search matches. The color must not be opaque so as not to hide underlying decorations.\"), true);\nexport const editorFindRangeHighlight = registerColor('editor.findRangeHighlightBackground', { dark: '#3a3d4166', light: '#b4b4b44d', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'findRangeHighlight', \"Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations.\"), true);\nexport const editorFindMatchBorder = registerColor('editor.findMatchBorder', { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorFindMatchBorder', \"Border color of the current search match.\"));\nexport const editorFindMatchHighlightBorder = registerColor('editor.findMatchHighlightBorder', { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'findMatchHighlightBorder', \"Border color of the other search matches.\"));\nexport const editorFindRangeHighlightBorder = registerColor('editor.findRangeHighlightBorder', { dark: null, light: null, hcDark: transparent(activeContrastBorder, 0.4), hcLight: transparent(activeContrastBorder, 0.4) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'findRangeHighlightBorder', \"Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations.\"), true);\n/**\n * Search Editor query match colors.\n *\n * Distinct from normal editor find match to allow for better differentiation\n */\nexport const searchEditorFindMatch = registerColor('searchEditor.findMatchBackground', { light: transparent(editorFindMatchHighlight, 0.66), dark: transparent(editorFindMatchHighlight, 0.66), hcDark: editorFindMatchHighlight, hcLight: editorFindMatchHighlight }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'searchEditor.queryMatch', \"Color of the Search Editor query matches.\"));\nexport const searchEditorFindMatchBorder = registerColor('searchEditor.findMatchBorder', { light: transparent(editorFindMatchHighlightBorder, 0.66), dark: transparent(editorFindMatchHighlightBorder, 0.66), hcDark: editorFindMatchHighlightBorder, hcLight: editorFindMatchHighlightBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'searchEditor.editorFindMatchBorder', \"Border color of the Search Editor query matches.\"));\n/**\n * Search Viewlet colors.\n */\nexport const searchResultsInfoForeground = registerColor('search.resultsInfoForeground', { light: foreground, dark: transparent(foreground, 0.65), hcDark: foreground, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'search.resultsInfoForeground', \"Color of the text in the search viewlet's completion message.\"));\n/**\n * Editor hover\n */\nexport const editorHoverHighlight = registerColor('editor.hoverHighlightBackground', { light: '#ADD6FF26', dark: '#264f7840', hcDark: '#ADD6FF26', hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'hoverHighlight', 'Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorHoverBackground = registerColor('editorHoverWidget.background', { light: editorWidgetBackground, dark: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'hoverBackground', 'Background color of the editor hover.'));\nexport const editorHoverForeground = registerColor('editorHoverWidget.foreground', { light: editorWidgetForeground, dark: editorWidgetForeground, hcDark: editorWidgetForeground, hcLight: editorWidgetForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'hoverForeground', 'Foreground color of the editor hover.'));\nexport const editorHoverBorder = registerColor('editorHoverWidget.border', { light: editorWidgetBorder, dark: editorWidgetBorder, hcDark: editorWidgetBorder, hcLight: editorWidgetBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'hoverBorder', 'Border color of the editor hover.'));\nexport const editorHoverStatusBarBackground = registerColor('editorHoverWidget.statusBarBackground', { dark: lighten(editorHoverBackground, 0.2), light: darken(editorHoverBackground, 0.05), hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'statusBarBackground', \"Background color of the editor hover status bar.\"));\n/**\n * Editor link colors\n */\nexport const editorActiveLinkForeground = registerColor('editorLink.activeForeground', { dark: '#4E94CE', light: Color.blue, hcDark: Color.cyan, hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'activeLinkForeground', 'Color of active links.'));\n/**\n * Inline hints\n */\nexport const editorInlayHintForeground = registerColor('editorInlayHint.foreground', { dark: '#969696', light: '#969696', hcDark: Color.white, hcLight: Color.black }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInlayHintForeground', 'Foreground color of inline hints'));\nexport const editorInlayHintBackground = registerColor('editorInlayHint.background', { dark: transparent(badgeBackground, .10), light: transparent(badgeBackground, .10), hcDark: transparent(Color.white, .10), hcLight: transparent(badgeBackground, .10) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInlayHintBackground', 'Background color of inline hints'));\nexport const editorInlayHintTypeForeground = registerColor('editorInlayHint.typeForeground', { dark: editorInlayHintForeground, light: editorInlayHintForeground, hcDark: editorInlayHintForeground, hcLight: editorInlayHintForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInlayHintForegroundTypes', 'Foreground color of inline hints for types'));\nexport const editorInlayHintTypeBackground = registerColor('editorInlayHint.typeBackground', { dark: editorInlayHintBackground, light: editorInlayHintBackground, hcDark: editorInlayHintBackground, hcLight: editorInlayHintBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInlayHintBackgroundTypes', 'Background color of inline hints for types'));\nexport const editorInlayHintParameterForeground = registerColor('editorInlayHint.parameterForeground', { dark: editorInlayHintForeground, light: editorInlayHintForeground, hcDark: editorInlayHintForeground, hcLight: editorInlayHintForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInlayHintForegroundParameter', 'Foreground color of inline hints for parameters'));\nexport const editorInlayHintParameterBackground = registerColor('editorInlayHint.parameterBackground', { dark: editorInlayHintBackground, light: editorInlayHintBackground, hcDark: editorInlayHintBackground, hcLight: editorInlayHintBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorInlayHintBackgroundParameter', 'Background color of inline hints for parameters'));\n/**\n * Editor lightbulb icon colors\n */\nexport const editorLightBulbForeground = registerColor('editorLightBulb.foreground', { dark: '#FFCC00', light: '#DDB100', hcDark: '#FFCC00', hcLight: '#007ACC' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorLightBulbForeground', \"The color used for the lightbulb actions icon.\"));\nexport const editorLightBulbAutoFixForeground = registerColor('editorLightBulbAutoFix.foreground', { dark: '#75BEFF', light: '#007ACC', hcDark: '#75BEFF', hcLight: '#007ACC' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorLightBulbAutoFixForeground', \"The color used for the lightbulb auto fix actions icon.\"));\nexport const editorLightBulbAiForeground = registerColor('editorLightBulbAi.foreground', { dark: darken(iconForeground, 0.4), light: lighten(iconForeground, 1.7), hcDark: iconForeground, hcLight: iconForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'editorLightBulbAiForeground', \"The color used for the lightbulb AI icon.\"));\n/**\n * Diff Editor Colors\n */\nexport const defaultInsertColor = new Color(new RGBA(155, 185, 85, .2));\nexport const defaultRemoveColor = new Color(new RGBA(255, 0, 0, .2));\nexport const diffInserted = registerColor('diffEditor.insertedTextBackground', { dark: '#9ccc2c33', light: '#9ccc2c40', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorInserted', 'Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffRemoved = registerColor('diffEditor.removedTextBackground', { dark: '#ff000033', light: '#ff000033', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorRemoved', 'Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffInsertedLine = registerColor('diffEditor.insertedLineBackground', { dark: defaultInsertColor, light: defaultInsertColor, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorInsertedLines', 'Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffRemovedLine = registerColor('diffEditor.removedLineBackground', { dark: defaultRemoveColor, light: defaultRemoveColor, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorRemovedLines', 'Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffInsertedLineGutter = registerColor('diffEditorGutter.insertedLineBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorInsertedLineGutter', 'Background color for the margin where lines got inserted.'));\nexport const diffRemovedLineGutter = registerColor('diffEditorGutter.removedLineBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorRemovedLineGutter', 'Background color for the margin where lines got removed.'));\nexport const diffOverviewRulerInserted = registerColor('diffEditorOverview.insertedForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorOverviewInserted', 'Diff overview ruler foreground for inserted content.'));\nexport const diffOverviewRulerRemoved = registerColor('diffEditorOverview.removedForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorOverviewRemoved', 'Diff overview ruler foreground for removed content.'));\nexport const diffInsertedOutline = registerColor('diffEditor.insertedTextBorder', { dark: null, light: null, hcDark: '#33ff2eff', hcLight: '#374E06' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorInsertedOutline', 'Outline color for the text that got inserted.'));\nexport const diffRemovedOutline = registerColor('diffEditor.removedTextBorder', { dark: null, light: null, hcDark: '#FF008F', hcLight: '#AD0707' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorRemovedOutline', 'Outline color for text that got removed.'));\nexport const diffBorder = registerColor('diffEditor.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditorBorder', 'Border color between the two text editors.'));\nexport const diffDiagonalFill = registerColor('diffEditor.diagonalFill', { dark: '#cccccc33', light: '#22222233', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffDiagonalFill', \"Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.\"));\nexport const diffUnchangedRegionBackground = registerColor('diffEditor.unchangedRegionBackground', { dark: 'sideBar.background', light: 'sideBar.background', hcDark: 'sideBar.background', hcLight: 'sideBar.background' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditor.unchangedRegionBackground', \"The background color of unchanged blocks in the diff editor.\"));\nexport const diffUnchangedRegionForeground = registerColor('diffEditor.unchangedRegionForeground', { dark: 'foreground', light: 'foreground', hcDark: 'foreground', hcLight: 'foreground' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditor.unchangedRegionForeground', \"The foreground color of unchanged blocks in the diff editor.\"));\nexport const diffUnchangedTextBackground = registerColor('diffEditor.unchangedCodeBackground', { dark: '#74747429', light: '#b8b8b829', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'diffEditor.unchangedCodeBackground', \"The background color of unchanged code in the diff editor.\"));\n/**\n * List and tree colors\n */\nexport const listFocusBackground = registerColor('list.focusBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFocusBackground', \"List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listFocusForeground = registerColor('list.focusForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFocusForeground', \"List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listFocusOutline = registerColor('list.focusOutline', { dark: focusBorder, light: focusBorder, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFocusOutline', \"List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listFocusAndSelectionOutline = registerColor('list.focusAndSelectionOutline', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFocusAndSelectionOutline', \"List/Tree outline color for the focused item when the list/tree is active and selected. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listActiveSelectionBackground = registerColor('list.activeSelectionBackground', { dark: '#04395E', light: '#0060C0', hcDark: null, hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listActiveSelectionBackground', \"List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listActiveSelectionForeground = registerColor('list.activeSelectionForeground', { dark: Color.white, light: Color.white, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listActiveSelectionForeground', \"List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listActiveSelectionIconForeground = registerColor('list.activeSelectionIconForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listActiveSelectionIconForeground', \"List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveSelectionBackground = registerColor('list.inactiveSelectionBackground', { dark: '#37373D', light: '#E4E6F1', hcDark: null, hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listInactiveSelectionBackground', \"List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveSelectionForeground = registerColor('list.inactiveSelectionForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listInactiveSelectionForeground', \"List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveSelectionIconForeground = registerColor('list.inactiveSelectionIconForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listInactiveSelectionIconForeground', \"List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveFocusBackground = registerColor('list.inactiveFocusBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listInactiveFocusBackground', \"List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveFocusOutline = registerColor('list.inactiveFocusOutline', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listInactiveFocusOutline', \"List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listHoverBackground = registerColor('list.hoverBackground', { dark: '#2A2D2E', light: '#F0F0F0', hcDark: Color.white.transparent(0.1), hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listHoverBackground', \"List/Tree background when hovering over items using the mouse.\"));\nexport const listHoverForeground = registerColor('list.hoverForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listHoverForeground', \"List/Tree foreground when hovering over items using the mouse.\"));\nexport const listDropBackground = registerColor('list.dropBackground', { dark: '#062F4A', light: '#D6EBFF', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listDropBackground', \"List/Tree drag and drop background when moving items around using the mouse.\"));\nexport const listHighlightForeground = registerColor('list.highlightForeground', { dark: '#2AAAFF', light: '#0066BF', hcDark: focusBorder, hcLight: focusBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'highlight', 'List/Tree foreground color of the match highlights when searching inside the list/tree.'));\nexport const listFocusHighlightForeground = registerColor('list.focusHighlightForeground', { dark: listHighlightForeground, light: ifDefinedThenElse(listActiveSelectionBackground, listHighlightForeground, '#BBE7FF'), hcDark: listHighlightForeground, hcLight: listHighlightForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFocusHighlightForeground', 'List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree.'));\nexport const listInvalidItemForeground = registerColor('list.invalidItemForeground', { dark: '#B89500', light: '#B89500', hcDark: '#B89500', hcLight: '#B5200D' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'invalidItemForeground', 'List/Tree foreground color for invalid items, for example an unresolved root in explorer.'));\nexport const listErrorForeground = registerColor('list.errorForeground', { dark: '#F88070', light: '#B01011', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listErrorForeground', 'Foreground color of list items containing errors.'));\nexport const listWarningForeground = registerColor('list.warningForeground', { dark: '#CCA700', light: '#855F00', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listWarningForeground', 'Foreground color of list items containing warnings.'));\nexport const listFilterWidgetBackground = registerColor('listFilterWidget.background', { light: darken(editorWidgetBackground, 0), dark: lighten(editorWidgetBackground, 0), hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFilterWidgetBackground', 'Background color of the type filter widget in lists and trees.'));\nexport const listFilterWidgetOutline = registerColor('listFilterWidget.outline', { dark: Color.transparent, light: Color.transparent, hcDark: '#f38518', hcLight: '#007ACC' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFilterWidgetOutline', 'Outline color of the type filter widget in lists and trees.'));\nexport const listFilterWidgetNoMatchesOutline = registerColor('listFilterWidget.noMatchesOutline', { dark: '#BE1100', light: '#BE1100', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFilterWidgetNoMatchesOutline', 'Outline color of the type filter widget in lists and trees, when there are no matches.'));\nexport const listFilterWidgetShadow = registerColor('listFilterWidget.shadow', { dark: widgetShadow, light: widgetShadow, hcDark: widgetShadow, hcLight: widgetShadow }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFilterWidgetShadow', 'Shadow color of the type filter widget in lists and trees.'));\nexport const listFilterMatchHighlight = registerColor('list.filterMatchBackground', { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFilterMatchHighlight', 'Background color of the filtered match.'));\nexport const listFilterMatchHighlightBorder = registerColor('list.filterMatchBorder', { dark: editorFindMatchHighlightBorder, light: editorFindMatchHighlightBorder, hcDark: contrastBorder, hcLight: activeContrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listFilterMatchHighlightBorder', 'Border color of the filtered match.'));\nexport const treeIndentGuidesStroke = registerColor('tree.indentGuidesStroke', { dark: '#585858', light: '#a9a9a9', hcDark: '#a9a9a9', hcLight: '#a5a5a5' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'treeIndentGuidesStroke', \"Tree stroke color for the indentation guides.\"));\nexport const treeInactiveIndentGuidesStroke = registerColor('tree.inactiveIndentGuidesStroke', { dark: transparent(treeIndentGuidesStroke, 0.4), light: transparent(treeIndentGuidesStroke, 0.4), hcDark: transparent(treeIndentGuidesStroke, 0.4), hcLight: transparent(treeIndentGuidesStroke, 0.4) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'treeInactiveIndentGuidesStroke', \"Tree stroke color for the indentation guides that are not active.\"));\nexport const tableColumnsBorder = registerColor('tree.tableColumnsBorder', { dark: '#CCCCCC20', light: '#61616120', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'tableColumnsBorder', \"Table border color between columns.\"));\nexport const tableOddRowsBackgroundColor = registerColor('tree.tableOddRowsBackground', { dark: transparent(foreground, 0.04), light: transparent(foreground, 0.04), hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'tableOddRowsBackgroundColor', \"Background color for odd table rows.\"));\nexport const listDeemphasizedForeground = registerColor('list.deemphasizedForeground', { dark: '#8C8C8C', light: '#8E8E90', hcDark: '#A7A8A9', hcLight: '#666666' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'listDeemphasizedForeground', \"List/Tree foreground color for items that are deemphasized. \"));\n/**\n * Checkboxes\n */\nexport const checkboxBackground = registerColor('checkbox.background', { dark: selectBackground, light: selectBackground, hcDark: selectBackground, hcLight: selectBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'checkbox.background', \"Background color of checkbox widget.\"));\nexport const checkboxSelectBackground = registerColor('checkbox.selectBackground', { dark: editorWidgetBackground, light: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'checkbox.select.background', \"Background color of checkbox widget when the element it's in is selected.\"));\nexport const checkboxForeground = registerColor('checkbox.foreground', { dark: selectForeground, light: selectForeground, hcDark: selectForeground, hcLight: selectForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'checkbox.foreground', \"Foreground color of checkbox widget.\"));\nexport const checkboxBorder = registerColor('checkbox.border', { dark: selectBorder, light: selectBorder, hcDark: selectBorder, hcLight: selectBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'checkbox.border', \"Border color of checkbox widget.\"));\nexport const checkboxSelectBorder = registerColor('checkbox.selectBorder', { dark: iconForeground, light: iconForeground, hcDark: iconForeground, hcLight: iconForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'checkbox.select.border', \"Border color of checkbox widget when the element it's in is selected.\"));\n/**\n * Quick pick widget (dependent on List and tree colors)\n */\nexport const _deprecatedQuickInputListFocusBackground = registerColor('quickInput.list.focusBackground', { dark: null, light: null, hcDark: null, hcLight: null }, '', undefined, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'quickInput.list.focusBackground deprecation', \"Please use quickInputList.focusBackground instead\"));\nexport const quickInputListFocusForeground = registerColor('quickInputList.focusForeground', { dark: listActiveSelectionForeground, light: listActiveSelectionForeground, hcDark: listActiveSelectionForeground, hcLight: listActiveSelectionForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'quickInput.listFocusForeground', \"Quick picker foreground color for the focused item.\"));\nexport const quickInputListFocusIconForeground = registerColor('quickInputList.focusIconForeground', { dark: listActiveSelectionIconForeground, light: listActiveSelectionIconForeground, hcDark: listActiveSelectionIconForeground, hcLight: listActiveSelectionIconForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'quickInput.listFocusIconForeground', \"Quick picker icon foreground color for the focused item.\"));\nexport const quickInputListFocusBackground = registerColor('quickInputList.focusBackground', { dark: oneOf(_deprecatedQuickInputListFocusBackground, listActiveSelectionBackground), light: oneOf(_deprecatedQuickInputListFocusBackground, listActiveSelectionBackground), hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'quickInput.listFocusBackground', \"Quick picker background color for the focused item.\"));\n/**\n * Menu colors\n */\nexport const menuBorder = registerColor('menu.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'menuBorder', \"Border color of menus.\"));\nexport const menuForeground = registerColor('menu.foreground', { dark: selectForeground, light: selectForeground, hcDark: selectForeground, hcLight: selectForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'menuForeground', \"Foreground color of menu items.\"));\nexport const menuBackground = registerColor('menu.background', { dark: selectBackground, light: selectBackground, hcDark: selectBackground, hcLight: selectBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'menuBackground', \"Background color of menu items.\"));\nexport const menuSelectionForeground = registerColor('menu.selectionForeground', { dark: listActiveSelectionForeground, light: listActiveSelectionForeground, hcDark: listActiveSelectionForeground, hcLight: listActiveSelectionForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'menuSelectionForeground', \"Foreground color of the selected menu item in menus.\"));\nexport const menuSelectionBackground = registerColor('menu.selectionBackground', { dark: listActiveSelectionBackground, light: listActiveSelectionBackground, hcDark: listActiveSelectionBackground, hcLight: listActiveSelectionBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'menuSelectionBackground', \"Background color of the selected menu item in menus.\"));\nexport const menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'menuSelectionBorder', \"Border color of the selected menu item in menus.\"));\nexport const menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#606060', light: '#D4D4D4', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'menuSeparatorBackground', \"Color of a separator menu item in menus.\"));\n/**\n * Toolbar colors\n */\nexport const toolbarHoverBackground = registerColor('toolbar.hoverBackground', { dark: '#5a5d5e50', light: '#b8b8b850', hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'toolbarHoverBackground', \"Toolbar background when hovering over actions using the mouse\"));\nexport const toolbarHoverOutline = registerColor('toolbar.hoverOutline', { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'toolbarHoverOutline', \"Toolbar outline when hovering over actions using the mouse\"));\nexport const toolbarActiveBackground = registerColor('toolbar.activeBackground', { dark: lighten(toolbarHoverBackground, 0.1), light: darken(toolbarHoverBackground, 0.1), hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'toolbarActiveBackground', \"Toolbar background when holding the mouse over actions\"));\n/**\n * Snippet placeholder colors\n */\nexport const snippetTabstopHighlightBackground = registerColor('editor.snippetTabstopHighlightBackground', { dark: new Color(new RGBA(124, 124, 124, 0.3)), light: new Color(new RGBA(10, 50, 100, 0.2)), hcDark: new Color(new RGBA(124, 124, 124, 0.3)), hcLight: new Color(new RGBA(10, 50, 100, 0.2)) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'snippetTabstopHighlightBackground', \"Highlight background color of a snippet tabstop.\"));\nexport const snippetTabstopHighlightBorder = registerColor('editor.snippetTabstopHighlightBorder', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'snippetTabstopHighlightBorder', \"Highlight border color of a snippet tabstop.\"));\nexport const snippetFinalTabstopHighlightBackground = registerColor('editor.snippetFinalTabstopHighlightBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'snippetFinalTabstopHighlightBackground', \"Highlight background color of the final tabstop of a snippet.\"));\nexport const snippetFinalTabstopHighlightBorder = registerColor('editor.snippetFinalTabstopHighlightBorder', { dark: '#525252', light: new Color(new RGBA(10, 50, 100, 0.5)), hcDark: '#525252', hcLight: '#292929' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'snippetFinalTabstopHighlightBorder', \"Highlight border color of the final tabstop of a snippet.\"));\n/**\n * Breadcrumb colors\n */\nexport const breadcrumbsForeground = registerColor('breadcrumb.foreground', { light: transparent(foreground, 0.8), dark: transparent(foreground, 0.8), hcDark: transparent(foreground, 0.8), hcLight: transparent(foreground, 0.8) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'breadcrumbsFocusForeground', \"Color of focused breadcrumb items.\"));\nexport const breadcrumbsBackground = registerColor('breadcrumb.background', { light: editorBackground, dark: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'breadcrumbsBackground', \"Background color of breadcrumb items.\"));\nexport const breadcrumbsFocusForeground = registerColor('breadcrumb.focusForeground', { light: darken(foreground, 0.2), dark: lighten(foreground, 0.1), hcDark: lighten(foreground, 0.1), hcLight: lighten(foreground, 0.1) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'breadcrumbsFocusForeground', \"Color of focused breadcrumb items.\"));\nexport const breadcrumbsActiveSelectionForeground = registerColor('breadcrumb.activeSelectionForeground', { light: darken(foreground, 0.2), dark: lighten(foreground, 0.1), hcDark: lighten(foreground, 0.1), hcLight: lighten(foreground, 0.1) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'breadcrumbsSelectedForeground', \"Color of selected breadcrumb items.\"));\nexport const breadcrumbsPickerBackground = registerColor('breadcrumbPicker.background', { light: editorWidgetBackground, dark: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'breadcrumbsSelectedBackground', \"Background color of breadcrumb item picker.\"));\n/**\n * Merge-conflict colors\n */\nconst headerTransparency = 0.5;\nconst currentBaseColor = Color.fromHex('#40C8AE').transparent(headerTransparency);\nconst incomingBaseColor = Color.fromHex('#40A6FF').transparent(headerTransparency);\nconst commonBaseColor = Color.fromHex('#606060').transparent(0.4);\nconst contentTransparency = 0.4;\nconst rulerTransparency = 1;\nexport const mergeCurrentHeaderBackground = registerColor('merge.currentHeaderBackground', { dark: currentBaseColor, light: currentBaseColor, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'mergeCurrentHeaderBackground', 'Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeCurrentContentBackground = registerColor('merge.currentContentBackground', { dark: transparent(mergeCurrentHeaderBackground, contentTransparency), light: transparent(mergeCurrentHeaderBackground, contentTransparency), hcDark: transparent(mergeCurrentHeaderBackground, contentTransparency), hcLight: transparent(mergeCurrentHeaderBackground, contentTransparency) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'mergeCurrentContentBackground', 'Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeIncomingHeaderBackground = registerColor('merge.incomingHeaderBackground', { dark: incomingBaseColor, light: incomingBaseColor, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'mergeIncomingHeaderBackground', 'Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeIncomingContentBackground = registerColor('merge.incomingContentBackground', { dark: transparent(mergeIncomingHeaderBackground, contentTransparency), light: transparent(mergeIncomingHeaderBackground, contentTransparency), hcDark: transparent(mergeIncomingHeaderBackground, contentTransparency), hcLight: transparent(mergeIncomingHeaderBackground, contentTransparency) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'mergeIncomingContentBackground', 'Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeCommonHeaderBackground = registerColor('merge.commonHeaderBackground', { dark: commonBaseColor, light: commonBaseColor, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'mergeCommonHeaderBackground', 'Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeCommonContentBackground = registerColor('merge.commonContentBackground', { dark: transparent(mergeCommonHeaderBackground, contentTransparency), light: transparent(mergeCommonHeaderBackground, contentTransparency), hcDark: transparent(mergeCommonHeaderBackground, contentTransparency), hcLight: transparent(mergeCommonHeaderBackground, contentTransparency) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'mergeCommonContentBackground', 'Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeBorder = registerColor('merge.border', { dark: null, light: null, hcDark: '#C3DF6F', hcLight: '#007ACC' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'mergeBorder', 'Border color on headers and the splitter in inline merge-conflicts.'));\nexport const overviewRulerCurrentContentForeground = registerColor('editorOverviewRuler.currentContentForeground', { dark: transparent(mergeCurrentHeaderBackground, rulerTransparency), light: transparent(mergeCurrentHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'overviewRulerCurrentContentForeground', 'Current overview ruler foreground for inline merge-conflicts.'));\nexport const overviewRulerIncomingContentForeground = registerColor('editorOverviewRuler.incomingContentForeground', { dark: transparent(mergeIncomingHeaderBackground, rulerTransparency), light: transparent(mergeIncomingHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'overviewRulerIncomingContentForeground', 'Incoming overview ruler foreground for inline merge-conflicts.'));\nexport const overviewRulerCommonContentForeground = registerColor('editorOverviewRuler.commonContentForeground', { dark: transparent(mergeCommonHeaderBackground, rulerTransparency), light: transparent(mergeCommonHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'overviewRulerCommonContentForeground', 'Common ancestor overview ruler foreground for inline merge-conflicts.'));\nexport const overviewRulerFindMatchForeground = registerColor('editorOverviewRuler.findMatchForeground', { dark: '#d186167e', light: '#d186167e', hcDark: '#AB5A00', hcLight: '' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'overviewRulerFindMatchForeground', 'Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const overviewRulerSelectionHighlightForeground = registerColor('editorOverviewRuler.selectionHighlightForeground', { dark: '#A0A0A0CC', light: '#A0A0A0CC', hcDark: '#A0A0A0CC', hcLight: '#A0A0A0CC' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'overviewRulerSelectionHighlightForeground', 'Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const minimapFindMatch = registerColor('minimap.findMatchHighlight', { light: '#d18616', dark: '#d18616', hcDark: '#AB5A00', hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapFindMatchHighlight', 'Minimap marker color for find matches.'), true);\nexport const minimapSelectionOccurrenceHighlight = registerColor('minimap.selectionOccurrenceHighlight', { light: '#c9c9c9', dark: '#676767', hcDark: '#ffffff', hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapSelectionOccurrenceHighlight', 'Minimap marker color for repeating editor selections.'), true);\nexport const minimapSelection = registerColor('minimap.selectionHighlight', { light: '#ADD6FF', dark: '#264F78', hcDark: '#ffffff', hcLight: '#0F4A85' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapSelectionHighlight', 'Minimap marker color for the editor selection.'), true);\nexport const minimapInfo = registerColor('minimap.infoHighlight', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoBorder, hcLight: editorInfoBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapInfo', 'Minimap marker color for infos.'));\nexport const minimapWarning = registerColor('minimap.warningHighlight', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningBorder, hcLight: editorWarningBorder }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'overviewRuleWarning', 'Minimap marker color for warnings.'));\nexport const minimapError = registerColor('minimap.errorHighlight', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hcDark: new Color(new RGBA(255, 50, 50, 1)), hcLight: '#B5200D' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapError', 'Minimap marker color for errors.'));\nexport const minimapBackground = registerColor('minimap.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapBackground', \"Minimap background color.\"));\nexport const minimapForegroundOpacity = registerColor('minimap.foregroundOpacity', { dark: Color.fromHex('#000f'), light: Color.fromHex('#000f'), hcDark: Color.fromHex('#000f'), hcLight: Color.fromHex('#000f') }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapForegroundOpacity', 'Opacity of foreground elements rendered in the minimap. For example, \"#000000c0\" will render the elements with 75% opacity.'));\nexport const minimapSliderBackground = registerColor('minimapSlider.background', { light: transparent(scrollbarSliderBackground, 0.5), dark: transparent(scrollbarSliderBackground, 0.5), hcDark: transparent(scrollbarSliderBackground, 0.5), hcLight: transparent(scrollbarSliderBackground, 0.5) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapSliderBackground', \"Minimap slider background color.\"));\nexport const minimapSliderHoverBackground = registerColor('minimapSlider.hoverBackground', { light: transparent(scrollbarSliderHoverBackground, 0.5), dark: transparent(scrollbarSliderHoverBackground, 0.5), hcDark: transparent(scrollbarSliderHoverBackground, 0.5), hcLight: transparent(scrollbarSliderHoverBackground, 0.5) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapSliderHoverBackground', \"Minimap slider background color when hovering.\"));\nexport const minimapSliderActiveBackground = registerColor('minimapSlider.activeBackground', { light: transparent(scrollbarSliderActiveBackground, 0.5), dark: transparent(scrollbarSliderActiveBackground, 0.5), hcDark: transparent(scrollbarSliderActiveBackground, 0.5), hcLight: transparent(scrollbarSliderActiveBackground, 0.5) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'minimapSliderActiveBackground', \"Minimap slider background color when clicked on.\"));\nexport const problemsErrorIconForeground = registerColor('problemsErrorIcon.foreground', { dark: editorErrorForeground, light: editorErrorForeground, hcDark: editorErrorForeground, hcLight: editorErrorForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'problemsErrorIconForeground', \"The color used for the problems error icon.\"));\nexport const problemsWarningIconForeground = registerColor('problemsWarningIcon.foreground', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'problemsWarningIconForeground', \"The color used for the problems warning icon.\"));\nexport const problemsInfoIconForeground = registerColor('problemsInfoIcon.foreground', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoForeground, hcLight: editorInfoForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'problemsInfoIconForeground', \"The color used for the problems info icon.\"));\n/**\n * Chart colors\n */\nexport const chartsForeground = registerColor('charts.foreground', { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsForeground', \"The foreground color used in charts.\"));\nexport const chartsLines = registerColor('charts.lines', { dark: transparent(foreground, .5), light: transparent(foreground, .5), hcDark: transparent(foreground, .5), hcLight: transparent(foreground, .5) }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsLines', \"The color used for horizontal lines in charts.\"));\nexport const chartsRed = registerColor('charts.red', { dark: editorErrorForeground, light: editorErrorForeground, hcDark: editorErrorForeground, hcLight: editorErrorForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsRed', \"The red color used in chart visualizations.\"));\nexport const chartsBlue = registerColor('charts.blue', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoForeground, hcLight: editorInfoForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsBlue', \"The blue color used in chart visualizations.\"));\nexport const chartsYellow = registerColor('charts.yellow', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsYellow', \"The yellow color used in chart visualizations.\"));\nexport const chartsOrange = registerColor('charts.orange', { dark: minimapFindMatch, light: minimapFindMatch, hcDark: minimapFindMatch, hcLight: minimapFindMatch }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsOrange', \"The orange color used in chart visualizations.\"));\nexport const chartsGreen = registerColor('charts.green', { dark: '#89D185', light: '#388A34', hcDark: '#89D185', hcLight: '#374e06' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsGreen', \"The green color used in chart visualizations.\"));\nexport const chartsPurple = registerColor('charts.purple', { dark: '#B180D7', light: '#652D90', hcDark: '#B180D7', hcLight: '#652D90' }, nls.localizeWithPath('vs/platform/theme/common/colorRegistry', 'chartsPurple', \"The purple color used in chart visualizations.\"));\n// ----- color functions\nexport function executeTransform(transform, theme) {\n switch (transform.op) {\n case 0 /* ColorTransformType.Darken */:\n return resolveColorValue(transform.value, theme)?.darken(transform.factor);\n case 1 /* ColorTransformType.Lighten */:\n return resolveColorValue(transform.value, theme)?.lighten(transform.factor);\n case 2 /* ColorTransformType.Transparent */:\n return resolveColorValue(transform.value, theme)?.transparent(transform.factor);\n case 3 /* ColorTransformType.Opaque */: {\n const backgroundColor = resolveColorValue(transform.background, theme);\n if (!backgroundColor) {\n return resolveColorValue(transform.value, theme);\n }\n return resolveColorValue(transform.value, theme)?.makeOpaque(backgroundColor);\n }\n case 4 /* ColorTransformType.OneOf */:\n for (const candidate of transform.values) {\n const color = resolveColorValue(candidate, theme);\n if (color) {\n return color;\n }\n }\n return undefined;\n case 6 /* ColorTransformType.IfDefinedThenElse */:\n return resolveColorValue(theme.defines(transform.if) ? transform.then : transform.else, theme);\n case 5 /* ColorTransformType.LessProminent */: {\n const from = resolveColorValue(transform.value, theme);\n if (!from) {\n return undefined;\n }\n const backgroundColor = resolveColorValue(transform.background, theme);\n if (!backgroundColor) {\n return from.transparent(transform.factor * transform.transparency);\n }\n return from.isDarkerThan(backgroundColor)\n ? Color.getLighterColor(from, backgroundColor, transform.factor).transparent(transform.transparency)\n : Color.getDarkerColor(from, backgroundColor, transform.factor).transparent(transform.transparency);\n }\n default:\n throw assertNever(transform);\n }\n}\nexport function darken(colorValue, factor) {\n return { op: 0 /* ColorTransformType.Darken */, value: colorValue, factor };\n}\nexport function lighten(colorValue, factor) {\n return { op: 1 /* ColorTransformType.Lighten */, value: colorValue, factor };\n}\nexport function transparent(colorValue, factor) {\n return { op: 2 /* ColorTransformType.Transparent */, value: colorValue, factor };\n}\nexport function opaque(colorValue, background) {\n return { op: 3 /* ColorTransformType.Opaque */, value: colorValue, background };\n}\nexport function oneOf(...colorValues) {\n return { op: 4 /* ColorTransformType.OneOf */, values: colorValues };\n}\nexport function ifDefinedThenElse(ifArg, thenArg, elseArg) {\n return { op: 6 /* ColorTransformType.IfDefinedThenElse */, if: ifArg, then: thenArg, else: elseArg };\n}\nfunction lessProminent(colorValue, backgroundColorValue, factor, transparency) {\n return { op: 5 /* ColorTransformType.LessProminent */, value: colorValue, background: backgroundColorValue, factor, transparency };\n}\n// ----- implementation\n/**\n * @param colorValue Resolve a color value in the context of a theme\n */\nexport function resolveColorValue(colorValue, theme) {\n if (colorValue === null) {\n return undefined;\n }\n else if (typeof colorValue === 'string') {\n if (colorValue[0] === '#') {\n return Color.fromHex(colorValue);\n }\n return theme.getColor(colorValue);\n }\n else if (colorValue instanceof Color) {\n return colorValue;\n }\n else if (typeof colorValue === 'object') {\n return executeTransform(colorValue, theme);\n }\n return undefined;\n}\nexport const workbenchColorsSchemaId = 'vscode://schemas/workbench-colors';\nconst schemaRegistry = platform.Registry.as(JSONExtensions.JSONContribution);\nschemaRegistry.registerSchema(workbenchColorsSchemaId, colorRegistry.getColorSchema());\nconst delayer = new RunOnceScheduler(() => schemaRegistry.notifySchemaChanged(workbenchColorsSchemaId), 200);\ncolorRegistry.onDidChangeSchema(() => {\n if (!delayer.isScheduled()) {\n delayer.schedule();\n }\n});\n// setTimeout(_ => console.log(colorRegistry.toString()), 5000);\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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../base/browser/dom.js';\nimport { GlobalPointerMoveMonitor } from '../../base/browser/globalPointerMoveMonitor.js';\nimport { StandardMouseEvent } from '../../base/browser/mouseEvent.js';\nimport { RunOnceScheduler } from '../../base/common/async.js';\nimport { Disposable, DisposableStore } from '../../base/common/lifecycle.js';\nimport { asCssVariable } from '../../platform/theme/common/colorRegistry.js';\n/**\n * Coordinates relative to the whole document (e.g. mouse event's pageX and pageY)\n */\nexport class PageCoordinates {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n this._pageCoordinatesBrand = undefined;\n }\n toClientCoordinates(targetWindow) {\n return new ClientCoordinates(this.x - targetWindow.scrollX, this.y - targetWindow.scrollY);\n }\n}\n/**\n * Coordinates within the application's client area (i.e. origin is document's scroll position).\n *\n * For example, clicking in the top-left corner of the client area will\n * always result in a mouse event with a client.x value of 0, regardless\n * of whether the page is scrolled horizontally.\n */\nexport class ClientCoordinates {\n constructor(clientX, clientY) {\n this.clientX = clientX;\n this.clientY = clientY;\n this._clientCoordinatesBrand = undefined;\n }\n toPageCoordinates(targetWindow) {\n return new PageCoordinates(this.clientX + targetWindow.scrollX, this.clientY + targetWindow.scrollY);\n }\n}\n/**\n * The position of the editor in the page.\n */\nexport class EditorPagePosition {\n constructor(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this._editorPagePositionBrand = undefined;\n }\n}\n/**\n * Coordinates relative to the the (top;left) of the editor that can be used safely with other internal editor metrics.\n * **NOTE**: This position is obtained by taking page coordinates and transforming them relative to the\n * editor's (top;left) position in a way in which scale transformations are taken into account.\n * **NOTE**: These coordinates could be negative if the mouse position is outside the editor.\n */\nexport class CoordinatesRelativeToEditor {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n this._positionRelativeToEditorBrand = undefined;\n }\n}\nexport function createEditorPagePosition(editorViewDomNode) {\n const editorPos = dom.getDomNodePagePosition(editorViewDomNode);\n return new EditorPagePosition(editorPos.left, editorPos.top, editorPos.width, editorPos.height);\n}\nexport function createCoordinatesRelativeToEditor(editorViewDomNode, editorPagePosition, pos) {\n // The editor's page position is read from the DOM using getBoundingClientRect().\n //\n // getBoundingClientRect() returns the actual dimensions, while offsetWidth and offsetHeight\n // reflect the unscaled size. We can use this difference to detect a transform:scale()\n // and we will apply the transformation in inverse to get mouse coordinates that make sense inside the editor.\n //\n // This could be expanded to cover rotation as well maybe by walking the DOM up from `editorViewDomNode`\n // and computing the effective transformation matrix using getComputedStyle(element).transform.\n //\n const scaleX = editorPagePosition.width / editorViewDomNode.offsetWidth;\n const scaleY = editorPagePosition.height / editorViewDomNode.offsetHeight;\n // Adjust mouse offsets if editor appears to be scaled via transforms\n const relativeX = (pos.x - editorPagePosition.x) / scaleX;\n const relativeY = (pos.y - editorPagePosition.y) / scaleY;\n return new CoordinatesRelativeToEditor(relativeX, relativeY);\n}\nexport class EditorMouseEvent extends StandardMouseEvent {\n constructor(e, isFromPointerCapture, editorViewDomNode) {\n super(dom.getWindow(editorViewDomNode), e);\n this._editorMouseEventBrand = undefined;\n this.isFromPointerCapture = isFromPointerCapture;\n this.pos = new PageCoordinates(this.posx, this.posy);\n this.editorPos = createEditorPagePosition(editorViewDomNode);\n this.relativePos = createCoordinatesRelativeToEditor(editorViewDomNode, this.editorPos, this.pos);\n }\n}\nexport class EditorMouseEventFactory {\n constructor(editorViewDomNode) {\n this._editorViewDomNode = editorViewDomNode;\n }\n _create(e) {\n return new EditorMouseEvent(e, false, this._editorViewDomNode);\n }\n onContextMenu(target, callback) {\n return dom.addDisposableListener(target, 'contextmenu', (e) => {\n callback(this._create(e));\n });\n }\n onMouseUp(target, callback) {\n return dom.addDisposableListener(target, 'mouseup', (e) => {\n callback(this._create(e));\n });\n }\n onMouseDown(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.MOUSE_DOWN, (e) => {\n callback(this._create(e));\n });\n }\n onPointerDown(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.POINTER_DOWN, (e) => {\n callback(this._create(e), e.pointerId);\n });\n }\n onMouseLeave(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.MOUSE_LEAVE, (e) => {\n callback(this._create(e));\n });\n }\n onMouseMove(target, callback) {\n return dom.addDisposableListener(target, 'mousemove', (e) => callback(this._create(e)));\n }\n}\nexport class EditorPointerEventFactory {\n constructor(editorViewDomNode) {\n this._editorViewDomNode = editorViewDomNode;\n }\n _create(e) {\n return new EditorMouseEvent(e, false, this._editorViewDomNode);\n }\n onPointerUp(target, callback) {\n return dom.addDisposableListener(target, 'pointerup', (e) => {\n callback(this._create(e));\n });\n }\n onPointerDown(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.POINTER_DOWN, (e) => {\n callback(this._create(e), e.pointerId);\n });\n }\n onPointerLeave(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.POINTER_LEAVE, (e) => {\n callback(this._create(e));\n });\n }\n onPointerMove(target, callback) {\n return dom.addDisposableListener(target, 'pointermove', (e) => callback(this._create(e)));\n }\n}\nexport class GlobalEditorPointerMoveMonitor extends Disposable {\n constructor(editorViewDomNode) {\n super();\n this._editorViewDomNode = editorViewDomNode;\n this._globalPointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n this._keydownListener = null;\n }\n startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {\n // Add a <> keydown event listener that will cancel the monitoring\n // if something other than a modifier key is pressed\n this._keydownListener = dom.addStandardDisposableListener(initialElement.ownerDocument, 'keydown', (e) => {\n const chord = e.toKeyCodeChord();\n if (chord.isModifierKey()) {\n // Allow modifier keys\n return;\n }\n this._globalPointerMoveMonitor.stopMonitoring(true, e.browserEvent);\n }, true);\n this._globalPointerMoveMonitor.startMonitoring(initialElement, pointerId, initialButtons, (e) => {\n pointerMoveCallback(new EditorMouseEvent(e, true, this._editorViewDomNode));\n }, (e) => {\n this._keydownListener.dispose();\n onStopCallback(e);\n });\n }\n stopMonitoring() {\n this._globalPointerMoveMonitor.stopMonitoring(true);\n }\n}\n/**\n * A helper to create dynamic css rules, bound to a class name.\n * Rules are reused.\n * Reference counting and delayed garbage collection ensure that no rules leak.\n*/\nexport class DynamicCssRules {\n constructor(_editor) {\n this._editor = _editor;\n this._instanceId = ++DynamicCssRules._idPool;\n this._counter = 0;\n this._rules = new Map();\n // We delay garbage collection so that hanging rules can be reused.\n this._garbageCollectionScheduler = new RunOnceScheduler(() => this.garbageCollect(), 1000);\n }\n createClassNameRef(options) {\n const rule = this.getOrCreateRule(options);\n rule.increaseRefCount();\n return {\n className: rule.className,\n dispose: () => {\n rule.decreaseRefCount();\n this._garbageCollectionScheduler.schedule();\n }\n };\n }\n getOrCreateRule(properties) {\n const key = this.computeUniqueKey(properties);\n let existingRule = this._rules.get(key);\n if (!existingRule) {\n const counter = this._counter++;\n existingRule = new RefCountedCssRule(key, `dyn-rule-${this._instanceId}-${counter}`, dom.isInShadowDOM(this._editor.getContainerDomNode())\n ? this._editor.getContainerDomNode()\n : undefined, properties);\n this._rules.set(key, existingRule);\n }\n return existingRule;\n }\n computeUniqueKey(properties) {\n return JSON.stringify(properties);\n }\n garbageCollect() {\n for (const rule of this._rules.values()) {\n if (!rule.hasReferences()) {\n this._rules.delete(rule.key);\n rule.dispose();\n }\n }\n }\n}\nDynamicCssRules._idPool = 0;\nclass RefCountedCssRule {\n constructor(key, className, _containerElement, properties) {\n this.key = key;\n this.className = className;\n this.properties = properties;\n this._referenceCount = 0;\n this._styleElementDisposables = new DisposableStore();\n this._styleElement = dom.createStyleSheet(_containerElement, undefined, this._styleElementDisposables);\n this._styleElement.textContent = this.getCssText(this.className, this.properties);\n }\n getCssText(className, properties) {\n let str = `.${className} {`;\n for (const prop in properties) {\n const value = properties[prop];\n let cssValue;\n if (typeof value === 'object') {\n cssValue = asCssVariable(value.id);\n }\n else {\n cssValue = value;\n }\n const cssPropName = camelToDashes(prop);\n str += `\\n\\t${cssPropName}: ${cssValue};`;\n }\n str += `\\n}`;\n return str;\n }\n dispose() {\n this._styleElementDisposables.dispose();\n this._styleElement = undefined;\n }\n increaseRefCount() {\n this._referenceCount++;\n }\n decreaseRefCount() {\n this._referenceCount--;\n }\n hasReferences() {\n return this._referenceCount > 0;\n }\n}\nfunction camelToDashes(str) {\n return str.replace(/(^[A-Z])/, ([first]) => first.toLowerCase())\n .replace(/([A-Z])/g, ([letter]) => `-${letter.toLowerCase()}`);\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 *--------------------------------------------------------------------------------------------*/\nimport { Disposable } from '../../base/common/lifecycle.js';\nexport class ViewEventHandler extends Disposable {\n constructor() {\n super();\n this._shouldRender = true;\n }\n shouldRender() {\n return this._shouldRender;\n }\n forceShouldRender() {\n this._shouldRender = true;\n }\n setShouldRender() {\n this._shouldRender = true;\n }\n onDidRender() {\n this._shouldRender = false;\n }\n // --- begin event handlers\n onCompositionStart(e) {\n return false;\n }\n onCompositionEnd(e) {\n return false;\n }\n onConfigurationChanged(e) {\n return false;\n }\n onCursorStateChanged(e) {\n return false;\n }\n onDecorationsChanged(e) {\n return false;\n }\n onFlushed(e) {\n return false;\n }\n onFocusChanged(e) {\n return false;\n }\n onLanguageConfigurationChanged(e) {\n return false;\n }\n onLineMappingChanged(e) {\n return false;\n }\n onLinesChanged(e) {\n return false;\n }\n onLinesDeleted(e) {\n return false;\n }\n onLinesInserted(e) {\n return false;\n }\n onRevealRangeRequest(e) {\n return false;\n }\n onScrollChanged(e) {\n return false;\n }\n onThemeChanged(e) {\n return false;\n }\n onTokensChanged(e) {\n return false;\n }\n onTokensColorsChanged(e) {\n return false;\n }\n onZonesChanged(e) {\n return false;\n }\n // --- end event handlers\n handleEvents(events) {\n let shouldRender = false;\n for (let i = 0, len = events.length; i < len; i++) {\n const e = events[i];\n switch (e.type) {\n case 0 /* viewEvents.ViewEventType.ViewCompositionStart */:\n if (this.onCompositionStart(e)) {\n shouldRender = true;\n }\n break;\n case 1 /* viewEvents.ViewEventType.ViewCompositionEnd */:\n if (this.onCompositionEnd(e)) {\n shouldRender = true;\n }\n break;\n case 2 /* viewEvents.ViewEventType.ViewConfigurationChanged */:\n if (this.onConfigurationChanged(e)) {\n shouldRender = true;\n }\n break;\n case 3 /* viewEvents.ViewEventType.ViewCursorStateChanged */:\n if (this.onCursorStateChanged(e)) {\n shouldRender = true;\n }\n break;\n case 4 /* viewEvents.ViewEventType.ViewDecorationsChanged */:\n if (this.onDecorationsChanged(e)) {\n shouldRender = true;\n }\n break;\n case 5 /* viewEvents.ViewEventType.ViewFlushed */:\n if (this.onFlushed(e)) {\n shouldRender = true;\n }\n break;\n case 6 /* viewEvents.ViewEventType.ViewFocusChanged */:\n if (this.onFocusChanged(e)) {\n shouldRender = true;\n }\n break;\n case 7 /* viewEvents.ViewEventType.ViewLanguageConfigurationChanged */:\n if (this.onLanguageConfigurationChanged(e)) {\n shouldRender = true;\n }\n break;\n case 8 /* viewEvents.ViewEventType.ViewLineMappingChanged */:\n if (this.onLineMappingChanged(e)) {\n shouldRender = true;\n }\n break;\n case 9 /* viewEvents.ViewEventType.ViewLinesChanged */:\n if (this.onLinesChanged(e)) {\n shouldRender = true;\n }\n break;\n case 10 /* viewEvents.ViewEventType.ViewLinesDeleted */:\n if (this.onLinesDeleted(e)) {\n shouldRender = true;\n }\n break;\n case 11 /* viewEvents.ViewEventType.ViewLinesInserted */:\n if (this.onLinesInserted(e)) {\n shouldRender = true;\n }\n break;\n case 12 /* viewEvents.ViewEventType.ViewRevealRangeRequest */:\n if (this.onRevealRangeRequest(e)) {\n shouldRender = true;\n }\n break;\n case 13 /* viewEvents.ViewEventType.ViewScrollChanged */:\n if (this.onScrollChanged(e)) {\n shouldRender = true;\n }\n break;\n case 15 /* viewEvents.ViewEventType.ViewTokensChanged */:\n if (this.onTokensChanged(e)) {\n shouldRender = true;\n }\n break;\n case 14 /* viewEvents.ViewEventType.ViewThemeChanged */:\n if (this.onThemeChanged(e)) {\n shouldRender = true;\n }\n break;\n case 16 /* viewEvents.ViewEventType.ViewTokensColorsChanged */:\n if (this.onTokensColorsChanged(e)) {\n shouldRender = true;\n }\n break;\n case 17 /* viewEvents.ViewEventType.ViewZonesChanged */:\n if (this.onZonesChanged(e)) {\n shouldRender = true;\n }\n break;\n default:\n console.info('View received unknown event: ');\n console.info(e);\n }\n }\n if (shouldRender) {\n this._shouldRender = true;\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { ViewEventHandler } from '../../common/viewEventHandler.js';\nexport class ViewPart extends ViewEventHandler {\n constructor(context) {\n super();\n this._context = context;\n this._context.addEventHandler(this);\n }\n dispose() {\n this._context.removeEventHandler(this);\n super.dispose();\n }\n}\nexport class PartFingerprints {\n static write(target, partId) {\n target.setAttribute('data-mprt', String(partId));\n }\n static read(target) {\n const r = target.getAttribute('data-mprt');\n if (r === null) {\n return 0 /* PartFingerprint.None */;\n }\n return parseInt(r, 10);\n }\n static collect(child, stopAt) {\n const result = [];\n let resultLen = 0;\n while (child && child !== child.ownerDocument.body) {\n if (child === stopAt) {\n break;\n }\n if (child.nodeType === child.ELEMENT_NODE) {\n result[resultLen++] = this.read(child);\n }\n child = child.parentElement;\n }\n const r = new Uint8Array(resultLen);\n for (let i = 0; i < resultLen; i++) {\n r[i] = result[resultLen - i - 1];\n }\n return r;\n }\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 *--------------------------------------------------------------------------------------------*/\nexport class RestrictedRenderingContext {\n constructor(viewLayout, viewportData) {\n this._restrictedRenderingContextBrand = undefined;\n this._viewLayout = viewLayout;\n this.viewportData = viewportData;\n this.scrollWidth = this._viewLayout.getScrollWidth();\n this.scrollHeight = this._viewLayout.getScrollHeight();\n this.visibleRange = this.viewportData.visibleRange;\n this.bigNumbersDelta = this.viewportData.bigNumbersDelta;\n const vInfo = this._viewLayout.getCurrentViewport();\n this.scrollTop = vInfo.top;\n this.scrollLeft = vInfo.left;\n this.viewportWidth = vInfo.width;\n this.viewportHeight = vInfo.height;\n }\n getScrolledTopFromAbsoluteTop(absoluteTop) {\n return absoluteTop - this.scrollTop;\n }\n getVerticalOffsetForLineNumber(lineNumber, includeViewZones) {\n return this._viewLayout.getVerticalOffsetForLineNumber(lineNumber, includeViewZones);\n }\n getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones) {\n return this._viewLayout.getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones);\n }\n getDecorationsInViewport() {\n return this.viewportData.getDecorationsInViewport();\n }\n}\nexport class RenderingContext extends RestrictedRenderingContext {\n constructor(viewLayout, viewportData, viewLines) {\n super(viewLayout, viewportData);\n this._renderingContextBrand = undefined;\n this._viewLines = viewLines;\n }\n linesVisibleRangesForRange(range, includeNewLines) {\n return this._viewLines.linesVisibleRangesForRange(range, includeNewLines);\n }\n visibleRangeForPosition(position) {\n return this._viewLines.visibleRangeForPosition(position);\n }\n}\nexport class LineVisibleRanges {\n /**\n * Returns the element with the smallest `lineNumber`.\n */\n static firstLine(ranges) {\n if (!ranges) {\n return null;\n }\n let result = null;\n for (const range of ranges) {\n if (!result || range.lineNumber < result.lineNumber) {\n result = range;\n }\n }\n return result;\n }\n /**\n * Returns the element with the largest `lineNumber`.\n */\n static lastLine(ranges) {\n if (!ranges) {\n return null;\n }\n let result = null;\n for (const range of ranges) {\n if (!result || range.lineNumber > result.lineNumber) {\n result = range;\n }\n }\n return result;\n }\n constructor(outsideRenderedLine, lineNumber, ranges, \n /**\n * Indicates if the requested range does not end in this line, but continues on the next line.\n */\n continuesOnNextLine) {\n this.outsideRenderedLine = outsideRenderedLine;\n this.lineNumber = lineNumber;\n this.ranges = ranges;\n this.continuesOnNextLine = continuesOnNextLine;\n }\n}\nexport class HorizontalRange {\n static from(ranges) {\n const result = new Array(ranges.length);\n for (let i = 0, len = ranges.length; i < len; i++) {\n const range = ranges[i];\n result[i] = new HorizontalRange(range.left, range.width);\n }\n return result;\n }\n constructor(left, width) {\n this._horizontalRangeBrand = undefined;\n this.left = Math.round(left);\n this.width = Math.round(width);\n }\n toString() {\n return `[${this.left},${this.width}]`;\n }\n}\nexport class FloatHorizontalRange {\n constructor(left, width) {\n this._floatHorizontalRangeBrand = undefined;\n this.left = left;\n this.width = width;\n }\n toString() {\n return `[${this.left},${this.width}]`;\n }\n static compare(a, b) {\n return a.left - b.left;\n }\n}\nexport class HorizontalPosition {\n constructor(outsideRenderedLine, left) {\n this.outsideRenderedLine = outsideRenderedLine;\n this.originalLeft = left;\n this.left = Math.round(this.originalLeft);\n }\n}\nexport class VisibleRanges {\n constructor(outsideRenderedLine, ranges) {\n this.outsideRenderedLine = outsideRenderedLine;\n this.ranges = ranges;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { FloatHorizontalRange } from '../../view/renderingContext.js';\nexport class RangeUtil {\n static _createRange() {\n if (!this._handyReadyRange) {\n this._handyReadyRange = document.createRange();\n }\n return this._handyReadyRange;\n }\n static _detachRange(range, endNode) {\n // Move range out of the span node, IE doesn't like having many ranges in\n // the same spot and will act badly for lines containing dashes ('-')\n range.selectNodeContents(endNode);\n }\n static _readClientRects(startElement, startOffset, endElement, endOffset, endNode) {\n const range = this._createRange();\n try {\n range.setStart(startElement, startOffset);\n range.setEnd(endElement, endOffset);\n return range.getClientRects();\n }\n catch (e) {\n // This is life ...\n return null;\n }\n finally {\n this._detachRange(range, endNode);\n }\n }\n static _mergeAdjacentRanges(ranges) {\n if (ranges.length === 1) {\n // There is nothing to merge\n return ranges;\n }\n ranges.sort(FloatHorizontalRange.compare);\n const result = [];\n let resultLen = 0;\n let prev = ranges[0];\n for (let i = 1, len = ranges.length; i < len; i++) {\n const range = ranges[i];\n if (prev.left + prev.width + 0.9 /* account for browser's rounding errors*/ >= range.left) {\n prev.width = Math.max(prev.width, range.left + range.width - prev.left);\n }\n else {\n result[resultLen++] = prev;\n prev = range;\n }\n }\n result[resultLen++] = prev;\n return result;\n }\n static _createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft, clientRectScale) {\n if (!clientRects || clientRects.length === 0) {\n return null;\n }\n // We go through FloatHorizontalRange because it has been observed in bi-di text\n // that the clientRects are not coming in sorted from the browser\n const result = [];\n for (let i = 0, len = clientRects.length; i < len; i++) {\n const clientRect = clientRects[i];\n result[i] = new FloatHorizontalRange(Math.max(0, (clientRect.left - clientRectDeltaLeft) / clientRectScale), clientRect.width / clientRectScale);\n }\n return this._mergeAdjacentRanges(result);\n }\n static readHorizontalRanges(domNode, startChildIndex, startOffset, endChildIndex, endOffset, context) {\n // Panic check\n const min = 0;\n const max = domNode.children.length - 1;\n if (min > max) {\n return null;\n }\n startChildIndex = Math.min(max, Math.max(min, startChildIndex));\n endChildIndex = Math.min(max, Math.max(min, endChildIndex));\n if (startChildIndex === endChildIndex && startOffset === endOffset && startOffset === 0 && !domNode.children[startChildIndex].firstChild) {\n // We must find the position at the beginning of a \n // To cover cases of empty s, avoid using a range and use the 's bounding box\n const clientRects = domNode.children[startChildIndex].getClientRects();\n context.markDidDomLayout();\n return this._createHorizontalRangesFromClientRects(clientRects, context.clientRectDeltaLeft, context.clientRectScale);\n }\n // If crossing over to a span only to select offset 0, then use the previous span's maximum offset\n // Chrome is buggy and doesn't handle 0 offsets well sometimes.\n if (startChildIndex !== endChildIndex) {\n if (endChildIndex > 0 && endOffset === 0) {\n endChildIndex--;\n endOffset = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n }\n }\n let startElement = domNode.children[startChildIndex].firstChild;\n let endElement = domNode.children[endChildIndex].firstChild;\n if (!startElement || !endElement) {\n // When having an empty (without any text content), try to move to the previous \n if (!startElement && startOffset === 0 && startChildIndex > 0) {\n startElement = domNode.children[startChildIndex - 1].firstChild;\n startOffset = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n }\n if (!endElement && endOffset === 0 && endChildIndex > 0) {\n endElement = domNode.children[endChildIndex - 1].firstChild;\n endOffset = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n }\n }\n if (!startElement || !endElement) {\n return null;\n }\n startOffset = Math.min(startElement.textContent.length, Math.max(0, startOffset));\n endOffset = Math.min(endElement.textContent.length, Math.max(0, endOffset));\n const clientRects = this._readClientRects(startElement, startOffset, endElement, endOffset, context.endNode);\n context.markDidDomLayout();\n return this._createHorizontalRangesFromClientRects(clientRects, context.clientRectDeltaLeft, context.clientRectScale);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nexport class LineDecoration {\n constructor(startColumn, endColumn, className, type) {\n this.startColumn = startColumn;\n this.endColumn = endColumn;\n this.className = className;\n this.type = type;\n this._lineDecorationBrand = undefined;\n }\n static _equals(a, b) {\n return (a.startColumn === b.startColumn\n && a.endColumn === b.endColumn\n && a.className === b.className\n && a.type === b.type);\n }\n static equalsArr(a, b) {\n const aLen = a.length;\n const bLen = b.length;\n if (aLen !== bLen) {\n return false;\n }\n for (let i = 0; i < aLen; i++) {\n if (!LineDecoration._equals(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n static extractWrapped(arr, startOffset, endOffset) {\n if (arr.length === 0) {\n return arr;\n }\n const startColumn = startOffset + 1;\n const endColumn = endOffset + 1;\n const lineLength = endOffset - startOffset;\n const r = [];\n let rLength = 0;\n for (const dec of arr) {\n if (dec.endColumn <= startColumn || dec.startColumn >= endColumn) {\n continue;\n }\n r[rLength++] = new LineDecoration(Math.max(1, dec.startColumn - startColumn + 1), Math.min(lineLength + 1, dec.endColumn - startColumn + 1), dec.className, dec.type);\n }\n return r;\n }\n static filter(lineDecorations, lineNumber, minLineColumn, maxLineColumn) {\n if (lineDecorations.length === 0) {\n return [];\n }\n const result = [];\n let resultLen = 0;\n for (let i = 0, len = lineDecorations.length; i < len; i++) {\n const d = lineDecorations[i];\n const range = d.range;\n if (range.endLineNumber < lineNumber || range.startLineNumber > lineNumber) {\n // Ignore decorations that sit outside this line\n continue;\n }\n if (range.isEmpty() && (d.type === 0 /* InlineDecorationType.Regular */ || d.type === 3 /* InlineDecorationType.RegularAffectingLetterSpacing */)) {\n // Ignore empty range decorations\n continue;\n }\n const startColumn = (range.startLineNumber === lineNumber ? range.startColumn : minLineColumn);\n const endColumn = (range.endLineNumber === lineNumber ? range.endColumn : maxLineColumn);\n result[resultLen++] = new LineDecoration(startColumn, endColumn, d.inlineClassName, d.type);\n }\n return result;\n }\n static _typeCompare(a, b) {\n const ORDER = [2, 0, 1, 3];\n return ORDER[a] - ORDER[b];\n }\n static compare(a, b) {\n if (a.startColumn !== b.startColumn) {\n return a.startColumn - b.startColumn;\n }\n if (a.endColumn !== b.endColumn) {\n return a.endColumn - b.endColumn;\n }\n const typeCmp = LineDecoration._typeCompare(a.type, b.type);\n if (typeCmp !== 0) {\n return typeCmp;\n }\n if (a.className !== b.className) {\n return a.className < b.className ? -1 : 1;\n }\n return 0;\n }\n}\nexport class DecorationSegment {\n constructor(startOffset, endOffset, className, metadata) {\n this.startOffset = startOffset;\n this.endOffset = endOffset;\n this.className = className;\n this.metadata = metadata;\n }\n}\nclass Stack {\n constructor() {\n this.stopOffsets = [];\n this.classNames = [];\n this.metadata = [];\n this.count = 0;\n }\n static _metadata(metadata) {\n let result = 0;\n for (let i = 0, len = metadata.length; i < len; i++) {\n result |= metadata[i];\n }\n return result;\n }\n consumeLowerThan(maxStopOffset, nextStartOffset, result) {\n while (this.count > 0 && this.stopOffsets[0] < maxStopOffset) {\n let i = 0;\n // Take all equal stopping offsets\n while (i + 1 < this.count && this.stopOffsets[i] === this.stopOffsets[i + 1]) {\n i++;\n }\n // Basically we are consuming the first i + 1 elements of the stack\n result.push(new DecorationSegment(nextStartOffset, this.stopOffsets[i], this.classNames.join(' '), Stack._metadata(this.metadata)));\n nextStartOffset = this.stopOffsets[i] + 1;\n // Consume them\n this.stopOffsets.splice(0, i + 1);\n this.classNames.splice(0, i + 1);\n this.metadata.splice(0, i + 1);\n this.count -= (i + 1);\n }\n if (this.count > 0 && nextStartOffset < maxStopOffset) {\n result.push(new DecorationSegment(nextStartOffset, maxStopOffset - 1, this.classNames.join(' '), Stack._metadata(this.metadata)));\n nextStartOffset = maxStopOffset;\n }\n return nextStartOffset;\n }\n insert(stopOffset, className, metadata) {\n if (this.count === 0 || this.stopOffsets[this.count - 1] <= stopOffset) {\n // Insert at the end\n this.stopOffsets.push(stopOffset);\n this.classNames.push(className);\n this.metadata.push(metadata);\n }\n else {\n // Find the insertion position for `stopOffset`\n for (let i = 0; i < this.count; i++) {\n if (this.stopOffsets[i] >= stopOffset) {\n this.stopOffsets.splice(i, 0, stopOffset);\n this.classNames.splice(i, 0, className);\n this.metadata.splice(i, 0, metadata);\n break;\n }\n }\n }\n this.count++;\n return;\n }\n}\nexport class LineDecorationsNormalizer {\n /**\n * Normalize line decorations. Overlapping decorations will generate multiple segments\n */\n static normalize(lineContent, lineDecorations) {\n if (lineDecorations.length === 0) {\n return [];\n }\n const result = [];\n const stack = new Stack();\n let nextStartOffset = 0;\n for (let i = 0, len = lineDecorations.length; i < len; i++) {\n const d = lineDecorations[i];\n let startColumn = d.startColumn;\n let endColumn = d.endColumn;\n const className = d.className;\n const metadata = (d.type === 1 /* InlineDecorationType.Before */\n ? 2 /* LinePartMetadata.PSEUDO_BEFORE */\n : d.type === 2 /* InlineDecorationType.After */\n ? 4 /* LinePartMetadata.PSEUDO_AFTER */\n : 0);\n // If the position would end up in the middle of a high-low surrogate pair, we move it to before the pair\n if (startColumn > 1) {\n const charCodeBefore = lineContent.charCodeAt(startColumn - 2);\n if (strings.isHighSurrogate(charCodeBefore)) {\n startColumn--;\n }\n }\n if (endColumn > 1) {\n const charCodeBefore = lineContent.charCodeAt(endColumn - 2);\n if (strings.isHighSurrogate(charCodeBefore)) {\n endColumn--;\n }\n }\n const currentStartOffset = startColumn - 1;\n const currentEndOffset = endColumn - 2;\n nextStartOffset = stack.consumeLowerThan(currentStartOffset, nextStartOffset, result);\n if (stack.count === 0) {\n nextStartOffset = currentStartOffset;\n }\n stack.insert(currentEndOffset, className, metadata);\n }\n stack.consumeLowerThan(1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, nextStartOffset, result);\n return result;\n }\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 *--------------------------------------------------------------------------------------------*/\nexport class LinePart {\n constructor(\n /**\n * last char index of this token (not inclusive).\n */\n endIndex, type, metadata, containsRTL) {\n this.endIndex = endIndex;\n this.type = type;\n this.metadata = metadata;\n this.containsRTL = containsRTL;\n this._linePartBrand = undefined;\n }\n isWhitespace() {\n return (this.metadata & 1 /* LinePartMetadata.IS_WHITESPACE_MASK */ ? true : false);\n }\n isPseudoAfter() {\n return (this.metadata & 4 /* LinePartMetadata.PSEUDO_AFTER_MASK */ ? true : false);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../../nls.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { StringBuilder } from '../core/stringBuilder.js';\nimport { LineDecoration, LineDecorationsNormalizer } from './lineDecorations.js';\nimport { LinePart } from './linePart.js';\nexport class LineRange {\n constructor(startIndex, endIndex) {\n this.startOffset = startIndex;\n this.endOffset = endIndex;\n }\n equals(otherLineRange) {\n return this.startOffset === otherLineRange.startOffset\n && this.endOffset === otherLineRange.endOffset;\n }\n}\nexport class RenderLineInput {\n constructor(useMonospaceOptimizations, canUseHalfwidthRightwardsArrow, lineContent, continuesWithWrappedLine, isBasicASCII, containsRTL, fauxIndentLength, lineTokens, lineDecorations, tabSize, startVisibleColumn, spaceWidth, middotWidth, wsmiddotWidth, stopRenderingLineAfter, renderWhitespace, renderControlCharacters, fontLigatures, selectionsOnLine) {\n this.useMonospaceOptimizations = useMonospaceOptimizations;\n this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;\n this.lineContent = lineContent;\n this.continuesWithWrappedLine = continuesWithWrappedLine;\n this.isBasicASCII = isBasicASCII;\n this.containsRTL = containsRTL;\n this.fauxIndentLength = fauxIndentLength;\n this.lineTokens = lineTokens;\n this.lineDecorations = lineDecorations.sort(LineDecoration.compare);\n this.tabSize = tabSize;\n this.startVisibleColumn = startVisibleColumn;\n this.spaceWidth = spaceWidth;\n this.stopRenderingLineAfter = stopRenderingLineAfter;\n this.renderWhitespace = (renderWhitespace === 'all'\n ? 4 /* RenderWhitespace.All */\n : renderWhitespace === 'boundary'\n ? 1 /* RenderWhitespace.Boundary */\n : renderWhitespace === 'selection'\n ? 2 /* RenderWhitespace.Selection */\n : renderWhitespace === 'trailing'\n ? 3 /* RenderWhitespace.Trailing */\n : 0 /* RenderWhitespace.None */);\n this.renderControlCharacters = renderControlCharacters;\n this.fontLigatures = fontLigatures;\n this.selectionsOnLine = selectionsOnLine && selectionsOnLine.sort((a, b) => a.startOffset < b.startOffset ? -1 : 1);\n const wsmiddotDiff = Math.abs(wsmiddotWidth - spaceWidth);\n const middotDiff = Math.abs(middotWidth - spaceWidth);\n if (wsmiddotDiff < middotDiff) {\n this.renderSpaceWidth = wsmiddotWidth;\n this.renderSpaceCharCode = 0x2E31; // U+2E31 - WORD SEPARATOR MIDDLE DOT\n }\n else {\n this.renderSpaceWidth = middotWidth;\n this.renderSpaceCharCode = 0xB7; // U+00B7 - MIDDLE DOT\n }\n }\n sameSelection(otherSelections) {\n if (this.selectionsOnLine === null) {\n return otherSelections === null;\n }\n if (otherSelections === null) {\n return false;\n }\n if (otherSelections.length !== this.selectionsOnLine.length) {\n return false;\n }\n for (let i = 0; i < this.selectionsOnLine.length; i++) {\n if (!this.selectionsOnLine[i].equals(otherSelections[i])) {\n return false;\n }\n }\n return true;\n }\n equals(other) {\n return (this.useMonospaceOptimizations === other.useMonospaceOptimizations\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\n && this.lineContent === other.lineContent\n && this.continuesWithWrappedLine === other.continuesWithWrappedLine\n && this.isBasicASCII === other.isBasicASCII\n && this.containsRTL === other.containsRTL\n && this.fauxIndentLength === other.fauxIndentLength\n && this.tabSize === other.tabSize\n && this.startVisibleColumn === other.startVisibleColumn\n && this.spaceWidth === other.spaceWidth\n && this.renderSpaceWidth === other.renderSpaceWidth\n && this.renderSpaceCharCode === other.renderSpaceCharCode\n && this.stopRenderingLineAfter === other.stopRenderingLineAfter\n && this.renderWhitespace === other.renderWhitespace\n && this.renderControlCharacters === other.renderControlCharacters\n && this.fontLigatures === other.fontLigatures\n && LineDecoration.equalsArr(this.lineDecorations, other.lineDecorations)\n && this.lineTokens.equals(other.lineTokens)\n && this.sameSelection(other.selectionsOnLine));\n }\n}\nexport class DomPosition {\n constructor(partIndex, charIndex) {\n this.partIndex = partIndex;\n this.charIndex = charIndex;\n }\n}\n/**\n * Provides a both direction mapping between a line's character and its rendered position.\n */\nexport class CharacterMapping {\n static getPartIndex(partData) {\n return (partData & 4294901760 /* CharacterMappingConstants.PART_INDEX_MASK */) >>> 16 /* CharacterMappingConstants.PART_INDEX_OFFSET */;\n }\n static getCharIndex(partData) {\n return (partData & 65535 /* CharacterMappingConstants.CHAR_INDEX_MASK */) >>> 0 /* CharacterMappingConstants.CHAR_INDEX_OFFSET */;\n }\n constructor(length, partCount) {\n this.length = length;\n this._data = new Uint32Array(this.length);\n this._horizontalOffset = new Uint32Array(this.length);\n }\n setColumnInfo(column, partIndex, charIndex, horizontalOffset) {\n const partData = ((partIndex << 16 /* CharacterMappingConstants.PART_INDEX_OFFSET */)\n | (charIndex << 0 /* CharacterMappingConstants.CHAR_INDEX_OFFSET */)) >>> 0;\n this._data[column - 1] = partData;\n this._horizontalOffset[column - 1] = horizontalOffset;\n }\n getHorizontalOffset(column) {\n if (this._horizontalOffset.length === 0) {\n // No characters on this line\n return 0;\n }\n return this._horizontalOffset[column - 1];\n }\n charOffsetToPartData(charOffset) {\n if (this.length === 0) {\n return 0;\n }\n if (charOffset < 0) {\n return this._data[0];\n }\n if (charOffset >= this.length) {\n return this._data[this.length - 1];\n }\n return this._data[charOffset];\n }\n getDomPosition(column) {\n const partData = this.charOffsetToPartData(column - 1);\n const partIndex = CharacterMapping.getPartIndex(partData);\n const charIndex = CharacterMapping.getCharIndex(partData);\n return new DomPosition(partIndex, charIndex);\n }\n getColumn(domPosition, partLength) {\n const charOffset = this.partDataToCharOffset(domPosition.partIndex, partLength, domPosition.charIndex);\n return charOffset + 1;\n }\n partDataToCharOffset(partIndex, partLength, charIndex) {\n if (this.length === 0) {\n return 0;\n }\n const searchEntry = ((partIndex << 16 /* CharacterMappingConstants.PART_INDEX_OFFSET */)\n | (charIndex << 0 /* CharacterMappingConstants.CHAR_INDEX_OFFSET */)) >>> 0;\n let min = 0;\n let max = this.length - 1;\n while (min + 1 < max) {\n const mid = ((min + max) >>> 1);\n const midEntry = this._data[mid];\n if (midEntry === searchEntry) {\n return mid;\n }\n else if (midEntry > searchEntry) {\n max = mid;\n }\n else {\n min = mid;\n }\n }\n if (min === max) {\n return min;\n }\n const minEntry = this._data[min];\n const maxEntry = this._data[max];\n if (minEntry === searchEntry) {\n return min;\n }\n if (maxEntry === searchEntry) {\n return max;\n }\n const minPartIndex = CharacterMapping.getPartIndex(minEntry);\n const minCharIndex = CharacterMapping.getCharIndex(minEntry);\n const maxPartIndex = CharacterMapping.getPartIndex(maxEntry);\n let maxCharIndex;\n if (minPartIndex !== maxPartIndex) {\n // sitting between parts\n maxCharIndex = partLength;\n }\n else {\n maxCharIndex = CharacterMapping.getCharIndex(maxEntry);\n }\n const minEntryDistance = charIndex - minCharIndex;\n const maxEntryDistance = maxCharIndex - charIndex;\n if (minEntryDistance <= maxEntryDistance) {\n return min;\n }\n return max;\n }\n inflate() {\n const result = [];\n for (let i = 0; i < this.length; i++) {\n const partData = this._data[i];\n const partIndex = CharacterMapping.getPartIndex(partData);\n const charIndex = CharacterMapping.getCharIndex(partData);\n const visibleColumn = this._horizontalOffset[i];\n result.push([partIndex, charIndex, visibleColumn]);\n }\n return result;\n }\n}\nexport class RenderLineOutput {\n constructor(characterMapping, containsRTL, containsForeignElements) {\n this._renderLineOutputBrand = undefined;\n this.characterMapping = characterMapping;\n this.containsRTL = containsRTL;\n this.containsForeignElements = containsForeignElements;\n }\n}\nexport function renderViewLine(input, sb) {\n if (input.lineContent.length === 0) {\n if (input.lineDecorations.length > 0) {\n // This line is empty, but it contains inline decorations\n sb.appendString(``);\n let beforeCount = 0;\n let afterCount = 0;\n let containsForeignElements = 0 /* ForeignElementType.None */;\n for (const lineDecoration of input.lineDecorations) {\n if (lineDecoration.type === 1 /* InlineDecorationType.Before */ || lineDecoration.type === 2 /* InlineDecorationType.After */) {\n sb.appendString(``);\n if (lineDecoration.type === 1 /* InlineDecorationType.Before */) {\n containsForeignElements |= 1 /* ForeignElementType.Before */;\n beforeCount++;\n }\n if (lineDecoration.type === 2 /* InlineDecorationType.After */) {\n containsForeignElements |= 2 /* ForeignElementType.After */;\n afterCount++;\n }\n }\n }\n sb.appendString(``);\n const characterMapping = new CharacterMapping(1, beforeCount + afterCount);\n characterMapping.setColumnInfo(1, beforeCount, 0, 0);\n return new RenderLineOutput(characterMapping, false, containsForeignElements);\n }\n // completely empty line\n sb.appendString('');\n return new RenderLineOutput(new CharacterMapping(0, 0), false, 0 /* ForeignElementType.None */);\n }\n return _renderLine(resolveRenderLineInput(input), sb);\n}\nexport class RenderLineOutput2 {\n constructor(characterMapping, html, containsRTL, containsForeignElements) {\n this.characterMapping = characterMapping;\n this.html = html;\n this.containsRTL = containsRTL;\n this.containsForeignElements = containsForeignElements;\n }\n}\nexport function renderViewLine2(input) {\n const sb = new StringBuilder(10000);\n const out = renderViewLine(input, sb);\n return new RenderLineOutput2(out.characterMapping, sb.build(), out.containsRTL, out.containsForeignElements);\n}\nclass ResolvedRenderLineInput {\n constructor(fontIsMonospace, canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, overflowingCharCount, parts, containsForeignElements, fauxIndentLength, tabSize, startVisibleColumn, containsRTL, spaceWidth, renderSpaceCharCode, renderWhitespace, renderControlCharacters) {\n this.fontIsMonospace = fontIsMonospace;\n this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;\n this.lineContent = lineContent;\n this.len = len;\n this.isOverflowing = isOverflowing;\n this.overflowingCharCount = overflowingCharCount;\n this.parts = parts;\n this.containsForeignElements = containsForeignElements;\n this.fauxIndentLength = fauxIndentLength;\n this.tabSize = tabSize;\n this.startVisibleColumn = startVisibleColumn;\n this.containsRTL = containsRTL;\n this.spaceWidth = spaceWidth;\n this.renderSpaceCharCode = renderSpaceCharCode;\n this.renderWhitespace = renderWhitespace;\n this.renderControlCharacters = renderControlCharacters;\n //\n }\n}\nfunction resolveRenderLineInput(input) {\n const lineContent = input.lineContent;\n let isOverflowing;\n let overflowingCharCount;\n let len;\n if (input.stopRenderingLineAfter !== -1 && input.stopRenderingLineAfter < lineContent.length) {\n isOverflowing = true;\n overflowingCharCount = lineContent.length - input.stopRenderingLineAfter;\n len = input.stopRenderingLineAfter;\n }\n else {\n isOverflowing = false;\n overflowingCharCount = 0;\n len = lineContent.length;\n }\n let tokens = transformAndRemoveOverflowing(lineContent, input.containsRTL, input.lineTokens, input.fauxIndentLength, len);\n if (input.renderControlCharacters && !input.isBasicASCII) {\n // Calling `extractControlCharacters` before adding (possibly empty) line parts\n // for inline decorations. `extractControlCharacters` removes empty line parts.\n tokens = extractControlCharacters(lineContent, tokens);\n }\n if (input.renderWhitespace === 4 /* RenderWhitespace.All */ ||\n input.renderWhitespace === 1 /* RenderWhitespace.Boundary */ ||\n (input.renderWhitespace === 2 /* RenderWhitespace.Selection */ && !!input.selectionsOnLine) ||\n (input.renderWhitespace === 3 /* RenderWhitespace.Trailing */ && !input.continuesWithWrappedLine)) {\n tokens = _applyRenderWhitespace(input, lineContent, len, tokens);\n }\n let containsForeignElements = 0 /* ForeignElementType.None */;\n if (input.lineDecorations.length > 0) {\n for (let i = 0, len = input.lineDecorations.length; i < len; i++) {\n const lineDecoration = input.lineDecorations[i];\n if (lineDecoration.type === 3 /* InlineDecorationType.RegularAffectingLetterSpacing */) {\n // Pretend there are foreign elements... although not 100% accurate.\n containsForeignElements |= 1 /* ForeignElementType.Before */;\n }\n else if (lineDecoration.type === 1 /* InlineDecorationType.Before */) {\n containsForeignElements |= 1 /* ForeignElementType.Before */;\n }\n else if (lineDecoration.type === 2 /* InlineDecorationType.After */) {\n containsForeignElements |= 2 /* ForeignElementType.After */;\n }\n }\n tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);\n }\n if (!input.containsRTL) {\n // We can never split RTL text, as it ruins the rendering\n tokens = splitLargeTokens(lineContent, tokens, !input.isBasicASCII || input.fontLigatures);\n }\n return new ResolvedRenderLineInput(input.useMonospaceOptimizations, input.canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, overflowingCharCount, tokens, containsForeignElements, input.fauxIndentLength, input.tabSize, input.startVisibleColumn, input.containsRTL, input.spaceWidth, input.renderSpaceCharCode, input.renderWhitespace, input.renderControlCharacters);\n}\n/**\n * In the rendering phase, characters are always looped until token.endIndex.\n * Ensure that all tokens end before `len` and the last one ends precisely at `len`.\n */\nfunction transformAndRemoveOverflowing(lineContent, lineContainsRTL, tokens, fauxIndentLength, len) {\n const result = [];\n let resultLen = 0;\n // The faux indent part of the line should have no token type\n if (fauxIndentLength > 0) {\n result[resultLen++] = new LinePart(fauxIndentLength, '', 0, false);\n }\n let startOffset = fauxIndentLength;\n for (let tokenIndex = 0, tokensLen = tokens.getCount(); tokenIndex < tokensLen; tokenIndex++) {\n const endIndex = tokens.getEndOffset(tokenIndex);\n if (endIndex <= fauxIndentLength) {\n // The faux indent part of the line should have no token type\n continue;\n }\n const type = tokens.getClassName(tokenIndex);\n if (endIndex >= len) {\n const tokenContainsRTL = (lineContainsRTL ? strings.containsRTL(lineContent.substring(startOffset, len)) : false);\n result[resultLen++] = new LinePart(len, type, 0, tokenContainsRTL);\n break;\n }\n const tokenContainsRTL = (lineContainsRTL ? strings.containsRTL(lineContent.substring(startOffset, endIndex)) : false);\n result[resultLen++] = new LinePart(endIndex, type, 0, tokenContainsRTL);\n startOffset = endIndex;\n }\n return result;\n}\n/**\n * See https://github.com/microsoft/vscode/issues/6885.\n * It appears that having very large spans causes very slow reading of character positions.\n * So here we try to avoid that.\n */\nfunction splitLargeTokens(lineContent, tokens, onlyAtSpaces) {\n let lastTokenEndIndex = 0;\n const result = [];\n let resultLen = 0;\n if (onlyAtSpaces) {\n // Split only at spaces => we need to walk each character\n for (let i = 0, len = tokens.length; i < len; i++) {\n const token = tokens[i];\n const tokenEndIndex = token.endIndex;\n if (lastTokenEndIndex + 50 /* Constants.LongToken */ < tokenEndIndex) {\n const tokenType = token.type;\n const tokenMetadata = token.metadata;\n const tokenContainsRTL = token.containsRTL;\n let lastSpaceOffset = -1;\n let currTokenStart = lastTokenEndIndex;\n for (let j = lastTokenEndIndex; j < tokenEndIndex; j++) {\n if (lineContent.charCodeAt(j) === 32 /* CharCode.Space */) {\n lastSpaceOffset = j;\n }\n if (lastSpaceOffset !== -1 && j - currTokenStart >= 50 /* Constants.LongToken */) {\n // Split at `lastSpaceOffset` + 1\n result[resultLen++] = new LinePart(lastSpaceOffset + 1, tokenType, tokenMetadata, tokenContainsRTL);\n currTokenStart = lastSpaceOffset + 1;\n lastSpaceOffset = -1;\n }\n }\n if (currTokenStart !== tokenEndIndex) {\n result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n }\n else {\n result[resultLen++] = token;\n }\n lastTokenEndIndex = tokenEndIndex;\n }\n }\n else {\n // Split anywhere => we don't need to walk each character\n for (let i = 0, len = tokens.length; i < len; i++) {\n const token = tokens[i];\n const tokenEndIndex = token.endIndex;\n const diff = (tokenEndIndex - lastTokenEndIndex);\n if (diff > 50 /* Constants.LongToken */) {\n const tokenType = token.type;\n const tokenMetadata = token.metadata;\n const tokenContainsRTL = token.containsRTL;\n const piecesCount = Math.ceil(diff / 50 /* Constants.LongToken */);\n for (let j = 1; j < piecesCount; j++) {\n const pieceEndIndex = lastTokenEndIndex + (j * 50 /* Constants.LongToken */);\n result[resultLen++] = new LinePart(pieceEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n else {\n result[resultLen++] = token;\n }\n lastTokenEndIndex = tokenEndIndex;\n }\n }\n return result;\n}\nfunction isControlCharacter(charCode) {\n if (charCode < 32) {\n return (charCode !== 9 /* CharCode.Tab */);\n }\n if (charCode === 127) {\n // DEL\n return true;\n }\n if ((charCode >= 0x202A && charCode <= 0x202E)\n || (charCode >= 0x2066 && charCode <= 0x2069)\n || (charCode >= 0x200E && charCode <= 0x200F)\n || charCode === 0x061C) {\n // Unicode Directional Formatting Characters\n // LRE\tU+202A\tLEFT-TO-RIGHT EMBEDDING\n // RLE\tU+202B\tRIGHT-TO-LEFT EMBEDDING\n // PDF\tU+202C\tPOP DIRECTIONAL FORMATTING\n // LRO\tU+202D\tLEFT-TO-RIGHT OVERRIDE\n // RLO\tU+202E\tRIGHT-TO-LEFT OVERRIDE\n // LRI\tU+2066\tLEFT-TO-RIGHT ISOLATE\n // RLI\tU+2067\tRIGHT-TO-LEFT ISOLATE\n // FSI\tU+2068\tFIRST STRONG ISOLATE\n // PDI\tU+2069\tPOP DIRECTIONAL ISOLATE\n // LRM\tU+200E\tLEFT-TO-RIGHT MARK\n // RLM\tU+200F\tRIGHT-TO-LEFT MARK\n // ALM\tU+061C\tARABIC LETTER MARK\n return true;\n }\n return false;\n}\nfunction extractControlCharacters(lineContent, tokens) {\n const result = [];\n let lastLinePart = new LinePart(0, '', 0, false);\n let charOffset = 0;\n for (const token of tokens) {\n const tokenEndIndex = token.endIndex;\n for (; charOffset < tokenEndIndex; charOffset++) {\n const charCode = lineContent.charCodeAt(charOffset);\n if (isControlCharacter(charCode)) {\n if (charOffset > lastLinePart.endIndex) {\n // emit previous part if it has text\n lastLinePart = new LinePart(charOffset, token.type, token.metadata, token.containsRTL);\n result.push(lastLinePart);\n }\n lastLinePart = new LinePart(charOffset + 1, 'mtkcontrol', token.metadata, false);\n result.push(lastLinePart);\n }\n }\n if (charOffset > lastLinePart.endIndex) {\n // emit previous part if it has text\n lastLinePart = new LinePart(tokenEndIndex, token.type, token.metadata, token.containsRTL);\n result.push(lastLinePart);\n }\n }\n return result;\n}\n/**\n * Whitespace is rendered by \"replacing\" tokens with a special-purpose `mtkw` type that is later recognized in the rendering phase.\n * Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (→ or ·) do not have the same width as  .\n * The rendering phase will generate `style=\"width:...\"` for these tokens.\n */\nfunction _applyRenderWhitespace(input, lineContent, len, tokens) {\n const continuesWithWrappedLine = input.continuesWithWrappedLine;\n const fauxIndentLength = input.fauxIndentLength;\n const tabSize = input.tabSize;\n const startVisibleColumn = input.startVisibleColumn;\n const useMonospaceOptimizations = input.useMonospaceOptimizations;\n const selections = input.selectionsOnLine;\n const onlyBoundary = (input.renderWhitespace === 1 /* RenderWhitespace.Boundary */);\n const onlyTrailing = (input.renderWhitespace === 3 /* RenderWhitespace.Trailing */);\n const generateLinePartForEachWhitespace = (input.renderSpaceWidth !== input.spaceWidth);\n const result = [];\n let resultLen = 0;\n let tokenIndex = 0;\n let tokenType = tokens[tokenIndex].type;\n let tokenContainsRTL = tokens[tokenIndex].containsRTL;\n let tokenEndIndex = tokens[tokenIndex].endIndex;\n const tokensLength = tokens.length;\n let lineIsEmptyOrWhitespace = false;\n let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);\n let lastNonWhitespaceIndex;\n if (firstNonWhitespaceIndex === -1) {\n lineIsEmptyOrWhitespace = true;\n firstNonWhitespaceIndex = len;\n lastNonWhitespaceIndex = len;\n }\n else {\n lastNonWhitespaceIndex = strings.lastNonWhitespaceIndex(lineContent);\n }\n let wasInWhitespace = false;\n let currentSelectionIndex = 0;\n let currentSelection = selections && selections[currentSelectionIndex];\n let tmpIndent = startVisibleColumn % tabSize;\n for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) {\n const chCode = lineContent.charCodeAt(charIndex);\n if (currentSelection && charIndex >= currentSelection.endOffset) {\n currentSelectionIndex++;\n currentSelection = selections && selections[currentSelectionIndex];\n }\n let isInWhitespace;\n if (charIndex < firstNonWhitespaceIndex || charIndex > lastNonWhitespaceIndex) {\n // in leading or trailing whitespace\n isInWhitespace = true;\n }\n else if (chCode === 9 /* CharCode.Tab */) {\n // a tab character is rendered both in all and boundary cases\n isInWhitespace = true;\n }\n else if (chCode === 32 /* CharCode.Space */) {\n // hit a space character\n if (onlyBoundary) {\n // rendering only boundary whitespace\n if (wasInWhitespace) {\n isInWhitespace = true;\n }\n else {\n const nextChCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0 /* CharCode.Null */);\n isInWhitespace = (nextChCode === 32 /* CharCode.Space */ || nextChCode === 9 /* CharCode.Tab */);\n }\n }\n else {\n isInWhitespace = true;\n }\n }\n else {\n isInWhitespace = false;\n }\n // If rendering whitespace on selection, check that the charIndex falls within a selection\n if (isInWhitespace && selections) {\n isInWhitespace = !!currentSelection && currentSelection.startOffset <= charIndex && currentSelection.endOffset > charIndex;\n }\n // If rendering only trailing whitespace, check that the charIndex points to trailing whitespace.\n if (isInWhitespace && onlyTrailing) {\n isInWhitespace = lineIsEmptyOrWhitespace || charIndex > lastNonWhitespaceIndex;\n }\n if (isInWhitespace && tokenContainsRTL) {\n // If the token contains RTL text, breaking it up into multiple line parts\n // to render whitespace might affect the browser's bidi layout.\n //\n // We render whitespace in such tokens only if the whitespace\n // is the leading or the trailing whitespace of the line,\n // which doesn't affect the browser's bidi layout.\n if (charIndex >= firstNonWhitespaceIndex && charIndex <= lastNonWhitespaceIndex) {\n isInWhitespace = false;\n }\n }\n if (wasInWhitespace) {\n // was in whitespace token\n if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) {\n // leaving whitespace token or entering a new indent\n if (generateLinePartForEachWhitespace) {\n const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength);\n for (let i = lastEndIndex + 1; i <= charIndex; i++) {\n result[resultLen++] = new LinePart(i, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n }\n else {\n result[resultLen++] = new LinePart(charIndex, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n tmpIndent = tmpIndent % tabSize;\n }\n }\n else {\n // was in regular token\n if (charIndex === tokenEndIndex || (isInWhitespace && charIndex > fauxIndentLength)) {\n result[resultLen++] = new LinePart(charIndex, tokenType, 0, tokenContainsRTL);\n tmpIndent = tmpIndent % tabSize;\n }\n }\n if (chCode === 9 /* CharCode.Tab */) {\n tmpIndent = tabSize;\n }\n else if (strings.isFullWidthCharacter(chCode)) {\n tmpIndent += 2;\n }\n else {\n tmpIndent++;\n }\n wasInWhitespace = isInWhitespace;\n while (charIndex === tokenEndIndex) {\n tokenIndex++;\n if (tokenIndex < tokensLength) {\n tokenType = tokens[tokenIndex].type;\n tokenContainsRTL = tokens[tokenIndex].containsRTL;\n tokenEndIndex = tokens[tokenIndex].endIndex;\n }\n else {\n break;\n }\n }\n }\n let generateWhitespace = false;\n if (wasInWhitespace) {\n // was in whitespace token\n if (continuesWithWrappedLine && onlyBoundary) {\n const lastCharCode = (len > 0 ? lineContent.charCodeAt(len - 1) : 0 /* CharCode.Null */);\n const prevCharCode = (len > 1 ? lineContent.charCodeAt(len - 2) : 0 /* CharCode.Null */);\n const isSingleTrailingSpace = (lastCharCode === 32 /* CharCode.Space */ && (prevCharCode !== 32 /* CharCode.Space */ && prevCharCode !== 9 /* CharCode.Tab */));\n if (!isSingleTrailingSpace) {\n generateWhitespace = true;\n }\n }\n else {\n generateWhitespace = true;\n }\n }\n if (generateWhitespace) {\n if (generateLinePartForEachWhitespace) {\n const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength);\n for (let i = lastEndIndex + 1; i <= len; i++) {\n result[resultLen++] = new LinePart(i, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n }\n else {\n result[resultLen++] = new LinePart(len, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n }\n else {\n result[resultLen++] = new LinePart(len, tokenType, 0, tokenContainsRTL);\n }\n return result;\n}\n/**\n * Inline decorations are \"merged\" on top of tokens.\n * Special care must be taken when multiple inline decorations are at play and they overlap.\n */\nfunction _applyInlineDecorations(lineContent, len, tokens, _lineDecorations) {\n _lineDecorations.sort(LineDecoration.compare);\n const lineDecorations = LineDecorationsNormalizer.normalize(lineContent, _lineDecorations);\n const lineDecorationsLen = lineDecorations.length;\n let lineDecorationIndex = 0;\n const result = [];\n let resultLen = 0;\n let lastResultEndIndex = 0;\n for (let tokenIndex = 0, len = tokens.length; tokenIndex < len; tokenIndex++) {\n const token = tokens[tokenIndex];\n const tokenEndIndex = token.endIndex;\n const tokenType = token.type;\n const tokenMetadata = token.metadata;\n const tokenContainsRTL = token.containsRTL;\n while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset < tokenEndIndex) {\n const lineDecoration = lineDecorations[lineDecorationIndex];\n if (lineDecoration.startOffset > lastResultEndIndex) {\n lastResultEndIndex = lineDecoration.startOffset;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n if (lineDecoration.endOffset + 1 <= tokenEndIndex) {\n // This line decoration ends before this token ends\n lastResultEndIndex = lineDecoration.endOffset + 1;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className, tokenMetadata | lineDecoration.metadata, tokenContainsRTL);\n lineDecorationIndex++;\n }\n else {\n // This line decoration continues on to the next token\n lastResultEndIndex = tokenEndIndex;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className, tokenMetadata | lineDecoration.metadata, tokenContainsRTL);\n break;\n }\n }\n if (tokenEndIndex > lastResultEndIndex) {\n lastResultEndIndex = tokenEndIndex;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n }\n const lastTokenEndIndex = tokens[tokens.length - 1].endIndex;\n if (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {\n while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {\n const lineDecoration = lineDecorations[lineDecorationIndex];\n result[resultLen++] = new LinePart(lastResultEndIndex, lineDecoration.className, lineDecoration.metadata, false);\n lineDecorationIndex++;\n }\n }\n return result;\n}\n/**\n * This function is on purpose not split up into multiple functions to allow runtime type inference (i.e. performance reasons).\n * Notice how all the needed data is fully resolved and passed in (i.e. no other calls).\n */\nfunction _renderLine(input, sb) {\n const fontIsMonospace = input.fontIsMonospace;\n const canUseHalfwidthRightwardsArrow = input.canUseHalfwidthRightwardsArrow;\n const containsForeignElements = input.containsForeignElements;\n const lineContent = input.lineContent;\n const len = input.len;\n const isOverflowing = input.isOverflowing;\n const overflowingCharCount = input.overflowingCharCount;\n const parts = input.parts;\n const fauxIndentLength = input.fauxIndentLength;\n const tabSize = input.tabSize;\n const startVisibleColumn = input.startVisibleColumn;\n const containsRTL = input.containsRTL;\n const spaceWidth = input.spaceWidth;\n const renderSpaceCharCode = input.renderSpaceCharCode;\n const renderWhitespace = input.renderWhitespace;\n const renderControlCharacters = input.renderControlCharacters;\n const characterMapping = new CharacterMapping(len + 1, parts.length);\n let lastCharacterMappingDefined = false;\n let charIndex = 0;\n let visibleColumn = startVisibleColumn;\n let charOffsetInPart = 0; // the character offset in the current part\n let charHorizontalOffset = 0; // the character horizontal position in terms of chars relative to line start\n let partDisplacement = 0;\n if (containsRTL) {\n sb.appendString('');\n }\n else {\n sb.appendString('');\n }\n for (let partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {\n const part = parts[partIndex];\n const partEndIndex = part.endIndex;\n const partType = part.type;\n const partContainsRTL = part.containsRTL;\n const partRendersWhitespace = (renderWhitespace !== 0 /* RenderWhitespace.None */ && part.isWhitespace());\n const partRendersWhitespaceWithWidth = partRendersWhitespace && !fontIsMonospace && (partType === 'mtkw' /*only whitespace*/ || !containsForeignElements);\n const partIsEmptyAndHasPseudoAfter = (charIndex === partEndIndex && part.isPseudoAfter());\n charOffsetInPart = 0;\n sb.appendString('= fauxIndentLength) {\n _visibleColumn += charWidth;\n }\n }\n }\n if (partRendersWhitespaceWithWidth) {\n sb.appendString(' style=\"width:');\n sb.appendString(String(spaceWidth * partWidth));\n sb.appendString('px\"');\n }\n sb.appendASCIICharCode(62 /* CharCode.GreaterThan */);\n for (; charIndex < partEndIndex; charIndex++) {\n characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, charHorizontalOffset);\n partDisplacement = 0;\n const charCode = lineContent.charCodeAt(charIndex);\n let producedCharacters;\n let charWidth;\n if (charCode === 9 /* CharCode.Tab */) {\n producedCharacters = (tabSize - (visibleColumn % tabSize)) | 0;\n charWidth = producedCharacters;\n if (!canUseHalfwidthRightwardsArrow || charWidth > 1) {\n sb.appendCharCode(0x2192); // RIGHTWARDS ARROW\n }\n else {\n sb.appendCharCode(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW\n }\n for (let space = 2; space <= charWidth; space++) {\n sb.appendCharCode(0xA0); //  \n }\n }\n else { // must be CharCode.Space\n producedCharacters = 2;\n charWidth = 1;\n sb.appendCharCode(renderSpaceCharCode); // · or word separator middle dot\n sb.appendCharCode(0x200C); // ZERO WIDTH NON-JOINER\n }\n charOffsetInPart += producedCharacters;\n charHorizontalOffset += charWidth;\n if (charIndex >= fauxIndentLength) {\n visibleColumn += charWidth;\n }\n }\n }\n else {\n sb.appendASCIICharCode(62 /* CharCode.GreaterThan */);\n for (; charIndex < partEndIndex; charIndex++) {\n characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, charHorizontalOffset);\n partDisplacement = 0;\n const charCode = lineContent.charCodeAt(charIndex);\n let producedCharacters = 1;\n let charWidth = 1;\n switch (charCode) {\n case 9 /* CharCode.Tab */:\n producedCharacters = (tabSize - (visibleColumn % tabSize));\n charWidth = producedCharacters;\n for (let space = 1; space <= producedCharacters; space++) {\n sb.appendCharCode(0xA0); //  \n }\n break;\n case 32 /* CharCode.Space */:\n sb.appendCharCode(0xA0); //  \n break;\n case 60 /* CharCode.LessThan */:\n sb.appendString('<');\n break;\n case 62 /* CharCode.GreaterThan */:\n sb.appendString('>');\n break;\n case 38 /* CharCode.Ampersand */:\n sb.appendString('&');\n break;\n case 0 /* CharCode.Null */:\n if (renderControlCharacters) {\n // See https://unicode-table.com/en/blocks/control-pictures/\n sb.appendCharCode(9216);\n }\n else {\n sb.appendString('�');\n }\n break;\n case 65279 /* CharCode.UTF8_BOM */:\n case 8232 /* CharCode.LINE_SEPARATOR */:\n case 8233 /* CharCode.PARAGRAPH_SEPARATOR */:\n case 133 /* CharCode.NEXT_LINE */:\n sb.appendCharCode(0xFFFD);\n break;\n default:\n if (strings.isFullWidthCharacter(charCode)) {\n charWidth++;\n }\n // See https://unicode-table.com/en/blocks/control-pictures/\n if (renderControlCharacters && charCode < 32) {\n sb.appendCharCode(9216 + charCode);\n }\n else if (renderControlCharacters && charCode === 127) {\n // DEL\n sb.appendCharCode(9249);\n }\n else if (renderControlCharacters && isControlCharacter(charCode)) {\n sb.appendString('[U+');\n sb.appendString(to4CharHex(charCode));\n sb.appendString(']');\n producedCharacters = 8;\n charWidth = producedCharacters;\n }\n else {\n sb.appendCharCode(charCode);\n }\n }\n charOffsetInPart += producedCharacters;\n charHorizontalOffset += charWidth;\n if (charIndex >= fauxIndentLength) {\n visibleColumn += charWidth;\n }\n }\n }\n if (partIsEmptyAndHasPseudoAfter) {\n partDisplacement++;\n }\n else {\n partDisplacement = 0;\n }\n if (charIndex >= len && !lastCharacterMappingDefined && part.isPseudoAfter()) {\n lastCharacterMappingDefined = true;\n characterMapping.setColumnInfo(charIndex + 1, partIndex, charOffsetInPart, charHorizontalOffset);\n }\n sb.appendString('');\n }\n if (!lastCharacterMappingDefined) {\n // When getting client rects for the last character, we will position the\n // text range at the end of the span, insteaf of at the beginning of next span\n characterMapping.setColumnInfo(len + 1, parts.length - 1, charOffsetInPart, charHorizontalOffset);\n }\n if (isOverflowing) {\n sb.appendString('');\n sb.appendString(nls.localizeWithPath('vs/editor/common/viewLayout/viewLineRenderer', 'showMore', \"Show more ({0})\", renderOverflowingCharCount(overflowingCharCount)));\n sb.appendString('');\n }\n sb.appendString('');\n return new RenderLineOutput(characterMapping, containsRTL, containsForeignElements);\n}\nfunction to4CharHex(n) {\n return n.toString(16).toUpperCase().padStart(4, '0');\n}\nfunction renderOverflowingCharCount(n) {\n if (n < 1024) {\n return nls.localizeWithPath('vs/editor/common/viewLayout/viewLineRenderer', 'overflow.chars', \"{0} chars\", n);\n }\n if (n < 1024 * 1024) {\n return `${(n / 1024).toFixed(1)} KB`;\n }\n return `${(n / 1024 / 1024).toFixed(1)} MB`;\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/**\n * Color scheme used by the OS and by color themes.\n */\nexport var ColorScheme;\n(function (ColorScheme) {\n ColorScheme[\"DARK\"] = \"dark\";\n ColorScheme[\"LIGHT\"] = \"light\";\n ColorScheme[\"HIGH_CONTRAST_DARK\"] = \"hcDark\";\n ColorScheme[\"HIGH_CONTRAST_LIGHT\"] = \"hcLight\";\n})(ColorScheme || (ColorScheme = {}));\nexport function isHighContrast(scheme) {\n return scheme === ColorScheme.HIGH_CONTRAST_DARK || scheme === ColorScheme.HIGH_CONTRAST_LIGHT;\n}\nexport function isDark(scheme) {\n return scheme === ColorScheme.DARK || scheme === ColorScheme.HIGH_CONTRAST_DARK;\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from '../../../../base/browser/browser.js';\nimport { createFastDomNode } from '../../../../base/browser/fastDomNode.js';\nimport * as platform from '../../../../base/common/platform.js';\nimport { RangeUtil } from './rangeUtil.js';\nimport { FloatHorizontalRange, VisibleRanges } from '../../view/renderingContext.js';\nimport { LineDecoration } from '../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine, LineRange, DomPosition } from '../../../common/viewLayout/viewLineRenderer.js';\nimport { isHighContrast } from '../../../../platform/theme/common/theme.js';\nimport { EditorFontLigatures } from '../../../common/config/editorOptions.js';\nconst canUseFastRenderedViewLine = (function () {\n if (platform.isNative) {\n // In VSCode we know very well when the zoom level changes\n return true;\n }\n if (platform.isLinux || browser.isFirefox || browser.isSafari) {\n // On Linux, it appears that zooming affects char widths (in pixels), which is unexpected.\n // --\n // Even though we read character widths correctly, having read them at a specific zoom level\n // does not mean they are the same at the current zoom level.\n // --\n // This could be improved if we ever figure out how to get an event when browsers zoom,\n // but until then we have to stick with reading client rects.\n // --\n // The same has been observed with Firefox on Windows7\n // --\n // The same has been oversved with Safari\n return false;\n }\n return true;\n})();\nlet monospaceAssumptionsAreValid = true;\nexport class ViewLineOptions {\n constructor(config, themeType) {\n this.themeType = themeType;\n const options = config.options;\n const fontInfo = options.get(50 /* EditorOption.fontInfo */);\n const experimentalWhitespaceRendering = options.get(38 /* EditorOption.experimentalWhitespaceRendering */);\n if (experimentalWhitespaceRendering === 'off') {\n this.renderWhitespace = options.get(98 /* EditorOption.renderWhitespace */);\n }\n else {\n // whitespace is rendered in a different layer\n this.renderWhitespace = 'none';\n }\n this.renderControlCharacters = options.get(93 /* EditorOption.renderControlCharacters */);\n this.spaceWidth = fontInfo.spaceWidth;\n this.middotWidth = fontInfo.middotWidth;\n this.wsmiddotWidth = fontInfo.wsmiddotWidth;\n this.useMonospaceOptimizations = (fontInfo.isMonospace\n && !options.get(33 /* EditorOption.disableMonospaceOptimizations */));\n this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;\n this.lineHeight = options.get(66 /* EditorOption.lineHeight */);\n this.stopRenderingLineAfter = options.get(116 /* EditorOption.stopRenderingLineAfter */);\n this.fontLigatures = options.get(51 /* EditorOption.fontLigatures */);\n }\n equals(other) {\n return (this.themeType === other.themeType\n && this.renderWhitespace === other.renderWhitespace\n && this.renderControlCharacters === other.renderControlCharacters\n && this.spaceWidth === other.spaceWidth\n && this.middotWidth === other.middotWidth\n && this.wsmiddotWidth === other.wsmiddotWidth\n && this.useMonospaceOptimizations === other.useMonospaceOptimizations\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\n && this.lineHeight === other.lineHeight\n && this.stopRenderingLineAfter === other.stopRenderingLineAfter\n && this.fontLigatures === other.fontLigatures);\n }\n}\nexport class ViewLine {\n constructor(options) {\n this._options = options;\n this._isMaybeInvalid = true;\n this._renderedViewLine = null;\n }\n // --- begin IVisibleLineData\n getDomNode() {\n if (this._renderedViewLine && this._renderedViewLine.domNode) {\n return this._renderedViewLine.domNode.domNode;\n }\n return null;\n }\n setDomNode(domNode) {\n if (this._renderedViewLine) {\n this._renderedViewLine.domNode = createFastDomNode(domNode);\n }\n else {\n throw new Error('I have no rendered view line to set the dom node to...');\n }\n }\n onContentChanged() {\n this._isMaybeInvalid = true;\n }\n onTokensChanged() {\n this._isMaybeInvalid = true;\n }\n onDecorationsChanged() {\n this._isMaybeInvalid = true;\n }\n onOptionsChanged(newOptions) {\n this._isMaybeInvalid = true;\n this._options = newOptions;\n }\n onSelectionChanged() {\n if (isHighContrast(this._options.themeType) || this._options.renderWhitespace === 'selection') {\n this._isMaybeInvalid = true;\n return true;\n }\n return false;\n }\n renderLine(lineNumber, deltaTop, viewportData, sb) {\n if (this._isMaybeInvalid === false) {\n // it appears that nothing relevant has changed\n return false;\n }\n this._isMaybeInvalid = false;\n const lineData = viewportData.getViewLineRenderingData(lineNumber);\n const options = this._options;\n const actualInlineDecorations = LineDecoration.filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn);\n // Only send selection information when needed for rendering whitespace\n let selectionsOnLine = null;\n if (isHighContrast(options.themeType) || this._options.renderWhitespace === 'selection') {\n const selections = viewportData.selections;\n for (const selection of selections) {\n if (selection.endLineNumber < lineNumber || selection.startLineNumber > lineNumber) {\n // Selection does not intersect line\n continue;\n }\n const startColumn = (selection.startLineNumber === lineNumber ? selection.startColumn : lineData.minColumn);\n const endColumn = (selection.endLineNumber === lineNumber ? selection.endColumn : lineData.maxColumn);\n if (startColumn < endColumn) {\n if (isHighContrast(options.themeType)) {\n actualInlineDecorations.push(new LineDecoration(startColumn, endColumn, 'inline-selected-text', 0 /* InlineDecorationType.Regular */));\n }\n if (this._options.renderWhitespace === 'selection') {\n if (!selectionsOnLine) {\n selectionsOnLine = [];\n }\n selectionsOnLine.push(new LineRange(startColumn - 1, endColumn - 1));\n }\n }\n }\n }\n const renderLineInput = new RenderLineInput(options.useMonospaceOptimizations, options.canUseHalfwidthRightwardsArrow, lineData.content, lineData.continuesWithWrappedLine, lineData.isBasicASCII, lineData.containsRTL, lineData.minColumn - 1, lineData.tokens, actualInlineDecorations, lineData.tabSize, lineData.startVisibleColumn, options.spaceWidth, options.middotWidth, options.wsmiddotWidth, options.stopRenderingLineAfter, options.renderWhitespace, options.renderControlCharacters, options.fontLigatures !== EditorFontLigatures.OFF, selectionsOnLine);\n if (this._renderedViewLine && this._renderedViewLine.input.equals(renderLineInput)) {\n // no need to do anything, we have the same render input\n return false;\n }\n sb.appendString('
');\n const output = renderViewLine(renderLineInput, sb);\n sb.appendString('
');\n let renderedViewLine = null;\n if (monospaceAssumptionsAreValid && canUseFastRenderedViewLine && lineData.isBasicASCII && options.useMonospaceOptimizations && output.containsForeignElements === 0 /* ForeignElementType.None */) {\n renderedViewLine = new FastRenderedViewLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping);\n }\n if (!renderedViewLine) {\n renderedViewLine = createRenderedLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping, output.containsRTL, output.containsForeignElements);\n }\n this._renderedViewLine = renderedViewLine;\n return true;\n }\n layoutLine(lineNumber, deltaTop) {\n if (this._renderedViewLine && this._renderedViewLine.domNode) {\n this._renderedViewLine.domNode.setTop(deltaTop);\n this._renderedViewLine.domNode.setHeight(this._options.lineHeight);\n }\n }\n // --- end IVisibleLineData\n getWidth(context) {\n if (!this._renderedViewLine) {\n return 0;\n }\n return this._renderedViewLine.getWidth(context);\n }\n getWidthIsFast() {\n if (!this._renderedViewLine) {\n return true;\n }\n return this._renderedViewLine.getWidthIsFast();\n }\n needsMonospaceFontCheck() {\n if (!this._renderedViewLine) {\n return false;\n }\n return (this._renderedViewLine instanceof FastRenderedViewLine);\n }\n monospaceAssumptionsAreValid() {\n if (!this._renderedViewLine) {\n return monospaceAssumptionsAreValid;\n }\n if (this._renderedViewLine instanceof FastRenderedViewLine) {\n return this._renderedViewLine.monospaceAssumptionsAreValid();\n }\n return monospaceAssumptionsAreValid;\n }\n onMonospaceAssumptionsInvalidated() {\n if (this._renderedViewLine && this._renderedViewLine instanceof FastRenderedViewLine) {\n this._renderedViewLine = this._renderedViewLine.toSlowRenderedLine();\n }\n }\n getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {\n if (!this._renderedViewLine) {\n return null;\n }\n startColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, startColumn));\n endColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, endColumn));\n const stopRenderingLineAfter = this._renderedViewLine.input.stopRenderingLineAfter;\n if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1 && endColumn > stopRenderingLineAfter + 1) {\n // This range is obviously not visible\n return new VisibleRanges(true, [new FloatHorizontalRange(this.getWidth(context), 0)]);\n }\n if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1) {\n startColumn = stopRenderingLineAfter + 1;\n }\n if (stopRenderingLineAfter !== -1 && endColumn > stopRenderingLineAfter + 1) {\n endColumn = stopRenderingLineAfter + 1;\n }\n const horizontalRanges = this._renderedViewLine.getVisibleRangesForRange(lineNumber, startColumn, endColumn, context);\n if (horizontalRanges && horizontalRanges.length > 0) {\n return new VisibleRanges(false, horizontalRanges);\n }\n return null;\n }\n getColumnOfNodeOffset(spanNode, offset) {\n if (!this._renderedViewLine) {\n return 1;\n }\n return this._renderedViewLine.getColumnOfNodeOffset(spanNode, offset);\n }\n}\nViewLine.CLASS_NAME = 'view-line';\n/**\n * A rendered line which is guaranteed to contain only regular ASCII and is rendered with a monospace font.\n */\nclass FastRenderedViewLine {\n constructor(domNode, renderLineInput, characterMapping) {\n this._cachedWidth = -1;\n this.domNode = domNode;\n this.input = renderLineInput;\n const keyColumnCount = Math.floor(renderLineInput.lineContent.length / 300 /* Constants.MaxMonospaceDistance */);\n if (keyColumnCount > 0) {\n this._keyColumnPixelOffsetCache = new Float32Array(keyColumnCount);\n for (let i = 0; i < keyColumnCount; i++) {\n this._keyColumnPixelOffsetCache[i] = -1;\n }\n }\n else {\n this._keyColumnPixelOffsetCache = null;\n }\n this._characterMapping = characterMapping;\n this._charWidth = renderLineInput.spaceWidth;\n }\n getWidth(context) {\n if (!this.domNode || this.input.lineContent.length < 300 /* Constants.MaxMonospaceDistance */) {\n const horizontalOffset = this._characterMapping.getHorizontalOffset(this._characterMapping.length);\n return Math.round(this._charWidth * horizontalOffset);\n }\n if (this._cachedWidth === -1) {\n this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;\n context?.markDidDomLayout();\n }\n return this._cachedWidth;\n }\n getWidthIsFast() {\n return (this.input.lineContent.length < 300 /* Constants.MaxMonospaceDistance */) || this._cachedWidth !== -1;\n }\n monospaceAssumptionsAreValid() {\n if (!this.domNode) {\n return monospaceAssumptionsAreValid;\n }\n if (this.input.lineContent.length < 300 /* Constants.MaxMonospaceDistance */) {\n const expectedWidth = this.getWidth(null);\n const actualWidth = this.domNode.domNode.firstChild.offsetWidth;\n if (Math.abs(expectedWidth - actualWidth) >= 2) {\n // more than 2px off\n console.warn(`monospace assumptions have been violated, therefore disabling monospace optimizations!`);\n monospaceAssumptionsAreValid = false;\n }\n }\n return monospaceAssumptionsAreValid;\n }\n toSlowRenderedLine() {\n return createRenderedLine(this.domNode, this.input, this._characterMapping, false, 0 /* ForeignElementType.None */);\n }\n getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {\n const startPosition = this._getColumnPixelOffset(lineNumber, startColumn, context);\n const endPosition = this._getColumnPixelOffset(lineNumber, endColumn, context);\n return [new FloatHorizontalRange(startPosition, endPosition - startPosition)];\n }\n _getColumnPixelOffset(lineNumber, column, context) {\n if (column <= 300 /* Constants.MaxMonospaceDistance */) {\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n return this._charWidth * horizontalOffset;\n }\n const keyColumnOrdinal = Math.floor((column - 1) / 300 /* Constants.MaxMonospaceDistance */) - 1;\n const keyColumn = (keyColumnOrdinal + 1) * 300 /* Constants.MaxMonospaceDistance */ + 1;\n let keyColumnPixelOffset = -1;\n if (this._keyColumnPixelOffsetCache) {\n keyColumnPixelOffset = this._keyColumnPixelOffsetCache[keyColumnOrdinal];\n if (keyColumnPixelOffset === -1) {\n keyColumnPixelOffset = this._actualReadPixelOffset(lineNumber, keyColumn, context);\n this._keyColumnPixelOffsetCache[keyColumnOrdinal] = keyColumnPixelOffset;\n }\n }\n if (keyColumnPixelOffset === -1) {\n // Could not read actual key column pixel offset\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n return this._charWidth * horizontalOffset;\n }\n const keyColumnHorizontalOffset = this._characterMapping.getHorizontalOffset(keyColumn);\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n return keyColumnPixelOffset + this._charWidth * (horizontalOffset - keyColumnHorizontalOffset);\n }\n _getReadingTarget(myDomNode) {\n return myDomNode.domNode.firstChild;\n }\n _actualReadPixelOffset(lineNumber, column, context) {\n if (!this.domNode) {\n return -1;\n }\n const domPosition = this._characterMapping.getDomPosition(column);\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(this.domNode), domPosition.partIndex, domPosition.charIndex, domPosition.partIndex, domPosition.charIndex, context);\n if (!r || r.length === 0) {\n return -1;\n }\n return r[0].left;\n }\n getColumnOfNodeOffset(spanNode, offset) {\n return getColumnOfNodeOffset(this._characterMapping, spanNode, offset);\n }\n}\n/**\n * Every time we render a line, we save what we have rendered in an instance of this class.\n */\nclass RenderedViewLine {\n constructor(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\n this.domNode = domNode;\n this.input = renderLineInput;\n this._characterMapping = characterMapping;\n this._isWhitespaceOnly = /^\\s*$/.test(renderLineInput.lineContent);\n this._containsForeignElements = containsForeignElements;\n this._cachedWidth = -1;\n this._pixelOffsetCache = null;\n if (!containsRTL || this._characterMapping.length === 0 /* the line is empty */) {\n this._pixelOffsetCache = new Float32Array(Math.max(2, this._characterMapping.length + 1));\n for (let column = 0, len = this._characterMapping.length; column <= len; column++) {\n this._pixelOffsetCache[column] = -1;\n }\n }\n }\n // --- Reading from the DOM methods\n _getReadingTarget(myDomNode) {\n return myDomNode.domNode.firstChild;\n }\n /**\n * Width of the line in pixels\n */\n getWidth(context) {\n if (!this.domNode) {\n return 0;\n }\n if (this._cachedWidth === -1) {\n this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;\n context?.markDidDomLayout();\n }\n return this._cachedWidth;\n }\n getWidthIsFast() {\n if (this._cachedWidth === -1) {\n return false;\n }\n return true;\n }\n /**\n * Visible ranges for a model range\n */\n getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {\n if (!this.domNode) {\n return null;\n }\n if (this._pixelOffsetCache !== null) {\n // the text is LTR\n const startOffset = this._readPixelOffset(this.domNode, lineNumber, startColumn, context);\n if (startOffset === -1) {\n return null;\n }\n const endOffset = this._readPixelOffset(this.domNode, lineNumber, endColumn, context);\n if (endOffset === -1) {\n return null;\n }\n return [new FloatHorizontalRange(startOffset, endOffset - startOffset)];\n }\n return this._readVisibleRangesForRange(this.domNode, lineNumber, startColumn, endColumn, context);\n }\n _readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context) {\n if (startColumn === endColumn) {\n const pixelOffset = this._readPixelOffset(domNode, lineNumber, startColumn, context);\n if (pixelOffset === -1) {\n return null;\n }\n else {\n return [new FloatHorizontalRange(pixelOffset, 0)];\n }\n }\n else {\n return this._readRawVisibleRangesForRange(domNode, startColumn, endColumn, context);\n }\n }\n _readPixelOffset(domNode, lineNumber, column, context) {\n if (this._characterMapping.length === 0) {\n // This line has no content\n if (this._containsForeignElements === 0 /* ForeignElementType.None */) {\n // We can assume the line is really empty\n return 0;\n }\n if (this._containsForeignElements === 2 /* ForeignElementType.After */) {\n // We have foreign elements after the (empty) line\n return 0;\n }\n if (this._containsForeignElements === 1 /* ForeignElementType.Before */) {\n // We have foreign elements before the (empty) line\n return this.getWidth(context);\n }\n // We have foreign elements before & after the (empty) line\n const readingTarget = this._getReadingTarget(domNode);\n if (readingTarget.firstChild) {\n context.markDidDomLayout();\n return readingTarget.firstChild.offsetWidth;\n }\n else {\n return 0;\n }\n }\n if (this._pixelOffsetCache !== null) {\n // the text is LTR\n const cachedPixelOffset = this._pixelOffsetCache[column];\n if (cachedPixelOffset !== -1) {\n return cachedPixelOffset;\n }\n const result = this._actualReadPixelOffset(domNode, lineNumber, column, context);\n this._pixelOffsetCache[column] = result;\n return result;\n }\n return this._actualReadPixelOffset(domNode, lineNumber, column, context);\n }\n _actualReadPixelOffset(domNode, lineNumber, column, context) {\n if (this._characterMapping.length === 0) {\n // This line has no content\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), 0, 0, 0, 0, context);\n if (!r || r.length === 0) {\n return -1;\n }\n return r[0].left;\n }\n if (column === this._characterMapping.length && this._isWhitespaceOnly && this._containsForeignElements === 0 /* ForeignElementType.None */) {\n // This branch helps in the case of whitespace only lines which have a width set\n return this.getWidth(context);\n }\n const domPosition = this._characterMapping.getDomPosition(column);\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), domPosition.partIndex, domPosition.charIndex, domPosition.partIndex, domPosition.charIndex, context);\n if (!r || r.length === 0) {\n return -1;\n }\n const result = r[0].left;\n if (this.input.isBasicASCII) {\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n const expectedResult = Math.round(this.input.spaceWidth * horizontalOffset);\n if (Math.abs(expectedResult - result) <= 1) {\n return expectedResult;\n }\n }\n return result;\n }\n _readRawVisibleRangesForRange(domNode, startColumn, endColumn, context) {\n if (startColumn === 1 && endColumn === this._characterMapping.length) {\n // This branch helps IE with bidi text & gives a performance boost to other browsers when reading visible ranges for an entire line\n return [new FloatHorizontalRange(0, this.getWidth(context))];\n }\n const startDomPosition = this._characterMapping.getDomPosition(startColumn);\n const endDomPosition = this._characterMapping.getDomPosition(endColumn);\n return RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), startDomPosition.partIndex, startDomPosition.charIndex, endDomPosition.partIndex, endDomPosition.charIndex, context);\n }\n /**\n * Returns the column for the text found at a specific offset inside a rendered dom node\n */\n getColumnOfNodeOffset(spanNode, offset) {\n return getColumnOfNodeOffset(this._characterMapping, spanNode, offset);\n }\n}\nclass WebKitRenderedViewLine extends RenderedViewLine {\n _readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context) {\n const output = super._readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context);\n if (!output || output.length === 0 || startColumn === endColumn || (startColumn === 1 && endColumn === this._characterMapping.length)) {\n return output;\n }\n // WebKit is buggy and returns an expanded range (to contain words in some cases)\n // The last client rect is enlarged (I think)\n if (!this.input.containsRTL) {\n // This is an attempt to patch things up\n // Find position of last column\n const endPixelOffset = this._readPixelOffset(domNode, lineNumber, endColumn, context);\n if (endPixelOffset !== -1) {\n const lastRange = output[output.length - 1];\n if (lastRange.left < endPixelOffset) {\n // Trim down the width of the last visible range to not go after the last column's position\n lastRange.width = endPixelOffset - lastRange.left;\n }\n }\n }\n return output;\n }\n}\nconst createRenderedLine = (function () {\n if (browser.isWebKit) {\n return createWebKitRenderedLine;\n }\n return createNormalRenderedLine;\n})();\nfunction createWebKitRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\n return new WebKitRenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);\n}\nfunction createNormalRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\n return new RenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);\n}\nexport function getColumnOfNodeOffset(characterMapping, spanNode, offset) {\n const spanNodeTextContentLength = spanNode.textContent.length;\n let spanIndex = -1;\n while (spanNode) {\n spanNode = spanNode.previousSibling;\n spanIndex++;\n }\n return characterMapping.getColumn(new DomPosition(spanIndex, offset), spanNodeTextContentLength);\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 *--------------------------------------------------------------------------------------------*/\nimport { PageCoordinates } from '../editorDom.js';\nimport { PartFingerprints } from '../view/viewPart.js';\nimport { ViewLine } from '../viewParts/lines/viewLine.js';\nimport { Position } from '../../common/core/position.js';\nimport { Range as EditorRange } from '../../common/core/range.js';\nimport { CursorColumns } from '../../common/core/cursorColumns.js';\nimport * as dom from '../../../base/browser/dom.js';\nimport { AtomicTabMoveOperations } from '../../common/cursor/cursorAtomicMoveOperations.js';\nclass UnknownHitTestResult {\n constructor(hitTarget = null) {\n this.hitTarget = hitTarget;\n this.type = 0 /* HitTestResultType.Unknown */;\n }\n}\nclass ContentHitTestResult {\n constructor(position, spanNode, injectedText) {\n this.position = position;\n this.spanNode = spanNode;\n this.injectedText = injectedText;\n this.type = 1 /* HitTestResultType.Content */;\n }\n}\nvar HitTestResult;\n(function (HitTestResult) {\n function createFromDOMInfo(ctx, spanNode, offset) {\n const position = ctx.getPositionFromDOMInfo(spanNode, offset);\n if (position) {\n return new ContentHitTestResult(position, spanNode, null);\n }\n return new UnknownHitTestResult(spanNode);\n }\n HitTestResult.createFromDOMInfo = createFromDOMInfo;\n})(HitTestResult || (HitTestResult = {}));\nexport class PointerHandlerLastRenderData {\n constructor(lastViewCursorsRenderData, lastTextareaPosition) {\n this.lastViewCursorsRenderData = lastViewCursorsRenderData;\n this.lastTextareaPosition = lastTextareaPosition;\n }\n}\nexport class MouseTarget {\n static _deduceRage(position, range = null) {\n if (!range && position) {\n return new EditorRange(position.lineNumber, position.column, position.lineNumber, position.column);\n }\n return range ?? null;\n }\n static createUnknown(element, mouseColumn, position) {\n return { type: 0 /* MouseTargetType.UNKNOWN */, element, mouseColumn, position, range: this._deduceRage(position) };\n }\n static createTextarea(element, mouseColumn) {\n return { type: 1 /* MouseTargetType.TEXTAREA */, element, mouseColumn, position: null, range: null };\n }\n static createMargin(type, element, mouseColumn, position, range, detail) {\n return { type, element, mouseColumn, position, range, detail };\n }\n static createViewZone(type, element, mouseColumn, position, detail) {\n return { type, element, mouseColumn, position, range: this._deduceRage(position), detail };\n }\n static createContentText(element, mouseColumn, position, range, detail) {\n return { type: 6 /* MouseTargetType.CONTENT_TEXT */, element, mouseColumn, position, range: this._deduceRage(position, range), detail };\n }\n static createContentEmpty(element, mouseColumn, position, detail) {\n return { type: 7 /* MouseTargetType.CONTENT_EMPTY */, element, mouseColumn, position, range: this._deduceRage(position), detail };\n }\n static createContentWidget(element, mouseColumn, detail) {\n return { type: 9 /* MouseTargetType.CONTENT_WIDGET */, element, mouseColumn, position: null, range: null, detail };\n }\n static createScrollbar(element, mouseColumn, position) {\n return { type: 11 /* MouseTargetType.SCROLLBAR */, element, mouseColumn, position, range: this._deduceRage(position) };\n }\n static createOverlayWidget(element, mouseColumn, detail) {\n return { type: 12 /* MouseTargetType.OVERLAY_WIDGET */, element, mouseColumn, position: null, range: null, detail };\n }\n static createOutsideEditor(mouseColumn, position, outsidePosition, outsideDistance) {\n return { type: 13 /* MouseTargetType.OUTSIDE_EDITOR */, element: null, mouseColumn, position, range: this._deduceRage(position), outsidePosition, outsideDistance };\n }\n static _typeToString(type) {\n if (type === 1 /* MouseTargetType.TEXTAREA */) {\n return 'TEXTAREA';\n }\n if (type === 2 /* MouseTargetType.GUTTER_GLYPH_MARGIN */) {\n return 'GUTTER_GLYPH_MARGIN';\n }\n if (type === 3 /* MouseTargetType.GUTTER_LINE_NUMBERS */) {\n return 'GUTTER_LINE_NUMBERS';\n }\n if (type === 4 /* MouseTargetType.GUTTER_LINE_DECORATIONS */) {\n return 'GUTTER_LINE_DECORATIONS';\n }\n if (type === 5 /* MouseTargetType.GUTTER_VIEW_ZONE */) {\n return 'GUTTER_VIEW_ZONE';\n }\n if (type === 6 /* MouseTargetType.CONTENT_TEXT */) {\n return 'CONTENT_TEXT';\n }\n if (type === 7 /* MouseTargetType.CONTENT_EMPTY */) {\n return 'CONTENT_EMPTY';\n }\n if (type === 8 /* MouseTargetType.CONTENT_VIEW_ZONE */) {\n return 'CONTENT_VIEW_ZONE';\n }\n if (type === 9 /* MouseTargetType.CONTENT_WIDGET */) {\n return 'CONTENT_WIDGET';\n }\n if (type === 10 /* MouseTargetType.OVERVIEW_RULER */) {\n return 'OVERVIEW_RULER';\n }\n if (type === 11 /* MouseTargetType.SCROLLBAR */) {\n return 'SCROLLBAR';\n }\n if (type === 12 /* MouseTargetType.OVERLAY_WIDGET */) {\n return 'OVERLAY_WIDGET';\n }\n return 'UNKNOWN';\n }\n static toString(target) {\n return this._typeToString(target.type) + ': ' + target.position + ' - ' + target.range + ' - ' + JSON.stringify(target.detail);\n }\n}\nclass ElementPath {\n static isTextArea(path) {\n return (path.length === 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 6 /* PartFingerprint.TextArea */);\n }\n static isChildOfViewLines(path) {\n return (path.length >= 4\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[3] === 7 /* PartFingerprint.ViewLines */);\n }\n static isStrictChildOfViewLines(path) {\n return (path.length > 4\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[3] === 7 /* PartFingerprint.ViewLines */);\n }\n static isChildOfScrollableElement(path) {\n return (path.length >= 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 5 /* PartFingerprint.ScrollableElement */);\n }\n static isChildOfMinimap(path) {\n return (path.length >= 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 8 /* PartFingerprint.Minimap */);\n }\n static isChildOfContentWidgets(path) {\n return (path.length >= 4\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[3] === 1 /* PartFingerprint.ContentWidgets */);\n }\n static isChildOfOverflowGuard(path) {\n return (path.length >= 1\n && path[0] === 3 /* PartFingerprint.OverflowGuard */);\n }\n static isChildOfOverflowingContentWidgets(path) {\n return (path.length >= 1\n && path[0] === 2 /* PartFingerprint.OverflowingContentWidgets */);\n }\n static isChildOfOverlayWidgets(path) {\n return (path.length >= 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 4 /* PartFingerprint.OverlayWidgets */);\n }\n}\nexport class HitTestContext {\n constructor(context, viewHelper, lastRenderData) {\n this.viewModel = context.viewModel;\n const options = context.configuration.options;\n this.layoutInfo = options.get(143 /* EditorOption.layoutInfo */);\n this.viewDomNode = viewHelper.viewDomNode;\n this.lineHeight = options.get(66 /* EditorOption.lineHeight */);\n this.stickyTabStops = options.get(115 /* EditorOption.stickyTabStops */);\n this.typicalHalfwidthCharacterWidth = options.get(50 /* EditorOption.fontInfo */).typicalHalfwidthCharacterWidth;\n this.lastRenderData = lastRenderData;\n this._context = context;\n this._viewHelper = viewHelper;\n }\n getZoneAtCoord(mouseVerticalOffset) {\n return HitTestContext.getZoneAtCoord(this._context, mouseVerticalOffset);\n }\n static getZoneAtCoord(context, mouseVerticalOffset) {\n // The target is either a view zone or the empty space after the last view-line\n const viewZoneWhitespace = context.viewLayout.getWhitespaceAtVerticalOffset(mouseVerticalOffset);\n if (viewZoneWhitespace) {\n const viewZoneMiddle = viewZoneWhitespace.verticalOffset + viewZoneWhitespace.height / 2;\n const lineCount = context.viewModel.getLineCount();\n let positionBefore = null;\n let position;\n let positionAfter = null;\n if (viewZoneWhitespace.afterLineNumber !== lineCount) {\n // There are more lines after this view zone\n positionAfter = new Position(viewZoneWhitespace.afterLineNumber + 1, 1);\n }\n if (viewZoneWhitespace.afterLineNumber > 0) {\n // There are more lines above this view zone\n positionBefore = new Position(viewZoneWhitespace.afterLineNumber, context.viewModel.getLineMaxColumn(viewZoneWhitespace.afterLineNumber));\n }\n if (positionAfter === null) {\n position = positionBefore;\n }\n else if (positionBefore === null) {\n position = positionAfter;\n }\n else if (mouseVerticalOffset < viewZoneMiddle) {\n position = positionBefore;\n }\n else {\n position = positionAfter;\n }\n return {\n viewZoneId: viewZoneWhitespace.id,\n afterLineNumber: viewZoneWhitespace.afterLineNumber,\n positionBefore: positionBefore,\n positionAfter: positionAfter,\n position: position\n };\n }\n return null;\n }\n getFullLineRangeAtCoord(mouseVerticalOffset) {\n if (this._context.viewLayout.isAfterLines(mouseVerticalOffset)) {\n // Below the last line\n const lineNumber = this._context.viewModel.getLineCount();\n const maxLineColumn = this._context.viewModel.getLineMaxColumn(lineNumber);\n return {\n range: new EditorRange(lineNumber, maxLineColumn, lineNumber, maxLineColumn),\n isAfterLines: true\n };\n }\n const lineNumber = this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);\n const maxLineColumn = this._context.viewModel.getLineMaxColumn(lineNumber);\n return {\n range: new EditorRange(lineNumber, 1, lineNumber, maxLineColumn),\n isAfterLines: false\n };\n }\n getLineNumberAtVerticalOffset(mouseVerticalOffset) {\n return this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);\n }\n isAfterLines(mouseVerticalOffset) {\n return this._context.viewLayout.isAfterLines(mouseVerticalOffset);\n }\n isInTopPadding(mouseVerticalOffset) {\n return this._context.viewLayout.isInTopPadding(mouseVerticalOffset);\n }\n isInBottomPadding(mouseVerticalOffset) {\n return this._context.viewLayout.isInBottomPadding(mouseVerticalOffset);\n }\n getVerticalOffsetForLineNumber(lineNumber) {\n return this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber);\n }\n findAttribute(element, attr) {\n return HitTestContext._findAttribute(element, attr, this._viewHelper.viewDomNode);\n }\n static _findAttribute(element, attr, stopAt) {\n while (element && element !== element.ownerDocument.body) {\n if (element.hasAttribute && element.hasAttribute(attr)) {\n return element.getAttribute(attr);\n }\n if (element === stopAt) {\n return null;\n }\n element = element.parentNode;\n }\n return null;\n }\n getLineWidth(lineNumber) {\n return this._viewHelper.getLineWidth(lineNumber);\n }\n visibleRangeForPosition(lineNumber, column) {\n return this._viewHelper.visibleRangeForPosition(lineNumber, column);\n }\n getPositionFromDOMInfo(spanNode, offset) {\n return this._viewHelper.getPositionFromDOMInfo(spanNode, offset);\n }\n getCurrentScrollTop() {\n return this._context.viewLayout.getCurrentScrollTop();\n }\n getCurrentScrollLeft() {\n return this._context.viewLayout.getCurrentScrollLeft();\n }\n}\nclass BareHitTestRequest {\n constructor(ctx, editorPos, pos, relativePos) {\n this.editorPos = editorPos;\n this.pos = pos;\n this.relativePos = relativePos;\n this.mouseVerticalOffset = Math.max(0, ctx.getCurrentScrollTop() + this.relativePos.y);\n this.mouseContentHorizontalOffset = ctx.getCurrentScrollLeft() + this.relativePos.x - ctx.layoutInfo.contentLeft;\n this.isInMarginArea = (this.relativePos.x < ctx.layoutInfo.contentLeft && this.relativePos.x >= ctx.layoutInfo.glyphMarginLeft);\n this.isInContentArea = !this.isInMarginArea;\n this.mouseColumn = Math.max(0, MouseTargetFactory._getMouseColumn(this.mouseContentHorizontalOffset, ctx.typicalHalfwidthCharacterWidth));\n }\n}\nclass HitTestRequest extends BareHitTestRequest {\n constructor(ctx, editorPos, pos, relativePos, target) {\n super(ctx, editorPos, pos, relativePos);\n this._ctx = ctx;\n if (target) {\n this.target = target;\n this.targetPath = PartFingerprints.collect(target, ctx.viewDomNode);\n }\n else {\n this.target = null;\n this.targetPath = new Uint8Array(0);\n }\n }\n toString() {\n return `pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}\\n\\ttarget: ${this.target ? this.target.outerHTML : null}`;\n }\n _getMouseColumn(position = null) {\n if (position && position.column < this._ctx.viewModel.getLineMaxColumn(position.lineNumber)) {\n // Most likely, the line contains foreign decorations...\n return CursorColumns.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(position.lineNumber), position.column, this._ctx.viewModel.model.getOptions().tabSize) + 1;\n }\n return this.mouseColumn;\n }\n fulfillUnknown(position = null) {\n return MouseTarget.createUnknown(this.target, this._getMouseColumn(position), position);\n }\n fulfillTextarea() {\n return MouseTarget.createTextarea(this.target, this._getMouseColumn());\n }\n fulfillMargin(type, position, range, detail) {\n return MouseTarget.createMargin(type, this.target, this._getMouseColumn(position), position, range, detail);\n }\n fulfillViewZone(type, position, detail) {\n return MouseTarget.createViewZone(type, this.target, this._getMouseColumn(position), position, detail);\n }\n fulfillContentText(position, range, detail) {\n return MouseTarget.createContentText(this.target, this._getMouseColumn(position), position, range, detail);\n }\n fulfillContentEmpty(position, detail) {\n return MouseTarget.createContentEmpty(this.target, this._getMouseColumn(position), position, detail);\n }\n fulfillContentWidget(detail) {\n return MouseTarget.createContentWidget(this.target, this._getMouseColumn(), detail);\n }\n fulfillScrollbar(position) {\n return MouseTarget.createScrollbar(this.target, this._getMouseColumn(position), position);\n }\n fulfillOverlayWidget(detail) {\n return MouseTarget.createOverlayWidget(this.target, this._getMouseColumn(), detail);\n }\n withTarget(target) {\n return new HitTestRequest(this._ctx, this.editorPos, this.pos, this.relativePos, target);\n }\n}\nconst EMPTY_CONTENT_AFTER_LINES = { isAfterLines: true };\nfunction createEmptyContentDataInLines(horizontalDistanceToText) {\n return {\n isAfterLines: false,\n horizontalDistanceToText: horizontalDistanceToText\n };\n}\nexport class MouseTargetFactory {\n constructor(context, viewHelper) {\n this._context = context;\n this._viewHelper = viewHelper;\n }\n mouseTargetIsWidget(e) {\n const t = e.target;\n const path = PartFingerprints.collect(t, this._viewHelper.viewDomNode);\n // Is it a content widget?\n if (ElementPath.isChildOfContentWidgets(path) || ElementPath.isChildOfOverflowingContentWidgets(path)) {\n return true;\n }\n // Is it an overlay widget?\n if (ElementPath.isChildOfOverlayWidgets(path)) {\n return true;\n }\n return false;\n }\n createMouseTarget(lastRenderData, editorPos, pos, relativePos, target) {\n const ctx = new HitTestContext(this._context, this._viewHelper, lastRenderData);\n const request = new HitTestRequest(ctx, editorPos, pos, relativePos, target);\n try {\n const r = MouseTargetFactory._createMouseTarget(ctx, request, false);\n if (r.type === 6 /* MouseTargetType.CONTENT_TEXT */) {\n // Snap to the nearest soft tab boundary if atomic soft tabs are enabled.\n if (ctx.stickyTabStops && r.position !== null) {\n const position = MouseTargetFactory._snapToSoftTabBoundary(r.position, ctx.viewModel);\n const range = EditorRange.fromPositions(position, position).plusRange(r.range);\n return request.fulfillContentText(position, range, r.detail);\n }\n }\n // console.log(MouseTarget.toString(r));\n return r;\n }\n catch (err) {\n // console.log(err);\n return request.fulfillUnknown();\n }\n }\n static _createMouseTarget(ctx, request, domHitTestExecuted) {\n // console.log(`${domHitTestExecuted ? '=>' : ''}CAME IN REQUEST: ${request}`);\n // First ensure the request has a target\n if (request.target === null) {\n if (domHitTestExecuted) {\n // Still no target... and we have already executed hit test...\n return request.fulfillUnknown();\n }\n const hitTestResult = MouseTargetFactory._doHitTest(ctx, request);\n if (hitTestResult.type === 1 /* HitTestResultType.Content */) {\n return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);\n }\n return this._createMouseTarget(ctx, request.withTarget(hitTestResult.hitTarget), true);\n }\n // we know for a fact that request.target is not null\n const resolvedRequest = request;\n let result = null;\n if (!ElementPath.isChildOfOverflowGuard(request.targetPath) && !ElementPath.isChildOfOverflowingContentWidgets(request.targetPath)) {\n // We only render dom nodes inside the overflow guard or in the overflowing content widgets\n result = result || request.fulfillUnknown();\n }\n result = result || MouseTargetFactory._hitTestContentWidget(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestOverlayWidget(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestMinimap(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestScrollbarSlider(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestViewZone(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestMargin(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestViewCursor(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestTextArea(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestViewLines(ctx, resolvedRequest, domHitTestExecuted);\n result = result || MouseTargetFactory._hitTestScrollbar(ctx, resolvedRequest);\n return (result || request.fulfillUnknown());\n }\n static _hitTestContentWidget(ctx, request) {\n // Is it a content widget?\n if (ElementPath.isChildOfContentWidgets(request.targetPath) || ElementPath.isChildOfOverflowingContentWidgets(request.targetPath)) {\n const widgetId = ctx.findAttribute(request.target, 'widgetId');\n if (widgetId) {\n return request.fulfillContentWidget(widgetId);\n }\n else {\n return request.fulfillUnknown();\n }\n }\n return null;\n }\n static _hitTestOverlayWidget(ctx, request) {\n // Is it an overlay widget?\n if (ElementPath.isChildOfOverlayWidgets(request.targetPath)) {\n const widgetId = ctx.findAttribute(request.target, 'widgetId');\n if (widgetId) {\n return request.fulfillOverlayWidget(widgetId);\n }\n else {\n return request.fulfillUnknown();\n }\n }\n return null;\n }\n static _hitTestViewCursor(ctx, request) {\n if (request.target) {\n // Check if we've hit a painted cursor\n const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;\n for (const d of lastViewCursorsRenderData) {\n if (request.target === d.domNode) {\n return request.fulfillContentText(d.position, null, { mightBeForeignElement: false, injectedText: null });\n }\n }\n }\n if (request.isInContentArea) {\n // Edge has a bug when hit-testing the exact position of a cursor,\n // instead of returning the correct dom node, it returns the\n // first or last rendered view line dom node, therefore help it out\n // and first check if we are on top of a cursor\n const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;\n const mouseContentHorizontalOffset = request.mouseContentHorizontalOffset;\n const mouseVerticalOffset = request.mouseVerticalOffset;\n for (const d of lastViewCursorsRenderData) {\n if (mouseContentHorizontalOffset < d.contentLeft) {\n // mouse position is to the left of the cursor\n continue;\n }\n if (mouseContentHorizontalOffset > d.contentLeft + d.width) {\n // mouse position is to the right of the cursor\n continue;\n }\n const cursorVerticalOffset = ctx.getVerticalOffsetForLineNumber(d.position.lineNumber);\n if (cursorVerticalOffset <= mouseVerticalOffset\n && mouseVerticalOffset <= cursorVerticalOffset + d.height) {\n return request.fulfillContentText(d.position, null, { mightBeForeignElement: false, injectedText: null });\n }\n }\n }\n return null;\n }\n static _hitTestViewZone(ctx, request) {\n const viewZoneData = ctx.getZoneAtCoord(request.mouseVerticalOffset);\n if (viewZoneData) {\n const mouseTargetType = (request.isInContentArea ? 8 /* MouseTargetType.CONTENT_VIEW_ZONE */ : 5 /* MouseTargetType.GUTTER_VIEW_ZONE */);\n return request.fulfillViewZone(mouseTargetType, viewZoneData.position, viewZoneData);\n }\n return null;\n }\n static _hitTestTextArea(ctx, request) {\n // Is it the textarea?\n if (ElementPath.isTextArea(request.targetPath)) {\n if (ctx.lastRenderData.lastTextareaPosition) {\n return request.fulfillContentText(ctx.lastRenderData.lastTextareaPosition, null, { mightBeForeignElement: false, injectedText: null });\n }\n return request.fulfillTextarea();\n }\n return null;\n }\n static _hitTestMargin(ctx, request) {\n if (request.isInMarginArea) {\n const res = ctx.getFullLineRangeAtCoord(request.mouseVerticalOffset);\n const pos = res.range.getStartPosition();\n let offset = Math.abs(request.relativePos.x);\n const detail = {\n isAfterLines: res.isAfterLines,\n glyphMarginLeft: ctx.layoutInfo.glyphMarginLeft,\n glyphMarginWidth: ctx.layoutInfo.glyphMarginWidth,\n lineNumbersWidth: ctx.layoutInfo.lineNumbersWidth,\n offsetX: offset\n };\n offset -= ctx.layoutInfo.glyphMarginLeft;\n if (offset <= ctx.layoutInfo.glyphMarginWidth) {\n // On the glyph margin\n return request.fulfillMargin(2 /* MouseTargetType.GUTTER_GLYPH_MARGIN */, pos, res.range, detail);\n }\n offset -= ctx.layoutInfo.glyphMarginWidth;\n if (offset <= ctx.layoutInfo.lineNumbersWidth) {\n // On the line numbers\n return request.fulfillMargin(3 /* MouseTargetType.GUTTER_LINE_NUMBERS */, pos, res.range, detail);\n }\n offset -= ctx.layoutInfo.lineNumbersWidth;\n // On the line decorations\n return request.fulfillMargin(4 /* MouseTargetType.GUTTER_LINE_DECORATIONS */, pos, res.range, detail);\n }\n return null;\n }\n static _hitTestViewLines(ctx, request, domHitTestExecuted) {\n if (!ElementPath.isChildOfViewLines(request.targetPath)) {\n return null;\n }\n if (ctx.isInTopPadding(request.mouseVerticalOffset)) {\n return request.fulfillContentEmpty(new Position(1, 1), EMPTY_CONTENT_AFTER_LINES);\n }\n // Check if it is below any lines and any view zones\n if (ctx.isAfterLines(request.mouseVerticalOffset) || ctx.isInBottomPadding(request.mouseVerticalOffset)) {\n // This most likely indicates it happened after the last view-line\n const lineCount = ctx.viewModel.getLineCount();\n const maxLineColumn = ctx.viewModel.getLineMaxColumn(lineCount);\n return request.fulfillContentEmpty(new Position(lineCount, maxLineColumn), EMPTY_CONTENT_AFTER_LINES);\n }\n if (domHitTestExecuted) {\n // Check if we are hitting a view-line (can happen in the case of inline decorations on empty lines)\n // See https://github.com/microsoft/vscode/issues/46942\n if (ElementPath.isStrictChildOfViewLines(request.targetPath)) {\n const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n if (ctx.viewModel.getLineLength(lineNumber) === 0) {\n const lineWidth = ctx.getLineWidth(lineNumber);\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\n return request.fulfillContentEmpty(new Position(lineNumber, 1), detail);\n }\n const lineWidth = ctx.getLineWidth(lineNumber);\n if (request.mouseContentHorizontalOffset >= lineWidth) {\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\n const pos = new Position(lineNumber, ctx.viewModel.getLineMaxColumn(lineNumber));\n return request.fulfillContentEmpty(pos, detail);\n }\n }\n // We have already executed hit test...\n return request.fulfillUnknown();\n }\n const hitTestResult = MouseTargetFactory._doHitTest(ctx, request);\n if (hitTestResult.type === 1 /* HitTestResultType.Content */) {\n return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);\n }\n return this._createMouseTarget(ctx, request.withTarget(hitTestResult.hitTarget), true);\n }\n static _hitTestMinimap(ctx, request) {\n if (ElementPath.isChildOfMinimap(request.targetPath)) {\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);\n return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));\n }\n return null;\n }\n static _hitTestScrollbarSlider(ctx, request) {\n if (ElementPath.isChildOfScrollableElement(request.targetPath)) {\n if (request.target && request.target.nodeType === 1) {\n const className = request.target.className;\n if (className && /\\b(slider|scrollbar)\\b/.test(className)) {\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);\n return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));\n }\n }\n }\n return null;\n }\n static _hitTestScrollbar(ctx, request) {\n // Is it the overview ruler?\n // Is it a child of the scrollable element?\n if (ElementPath.isChildOfScrollableElement(request.targetPath)) {\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);\n return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));\n }\n return null;\n }\n getMouseColumn(relativePos) {\n const options = this._context.configuration.options;\n const layoutInfo = options.get(143 /* EditorOption.layoutInfo */);\n const mouseContentHorizontalOffset = this._context.viewLayout.getCurrentScrollLeft() + relativePos.x - layoutInfo.contentLeft;\n return MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, options.get(50 /* EditorOption.fontInfo */).typicalHalfwidthCharacterWidth);\n }\n static _getMouseColumn(mouseContentHorizontalOffset, typicalHalfwidthCharacterWidth) {\n if (mouseContentHorizontalOffset < 0) {\n return 1;\n }\n const chars = Math.round(mouseContentHorizontalOffset / typicalHalfwidthCharacterWidth);\n return (chars + 1);\n }\n static createMouseTargetFromHitTestPosition(ctx, request, spanNode, pos, injectedText) {\n const lineNumber = pos.lineNumber;\n const column = pos.column;\n const lineWidth = ctx.getLineWidth(lineNumber);\n if (request.mouseContentHorizontalOffset > lineWidth) {\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\n return request.fulfillContentEmpty(pos, detail);\n }\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column);\n if (!visibleRange) {\n return request.fulfillUnknown(pos);\n }\n const columnHorizontalOffset = visibleRange.left;\n if (Math.abs(request.mouseContentHorizontalOffset - columnHorizontalOffset) < 1) {\n return request.fulfillContentText(pos, null, { mightBeForeignElement: !!injectedText, injectedText });\n }\n const points = [];\n points.push({ offset: visibleRange.left, column: column });\n if (column > 1) {\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column - 1);\n if (visibleRange) {\n points.push({ offset: visibleRange.left, column: column - 1 });\n }\n }\n const lineMaxColumn = ctx.viewModel.getLineMaxColumn(lineNumber);\n if (column < lineMaxColumn) {\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column + 1);\n if (visibleRange) {\n points.push({ offset: visibleRange.left, column: column + 1 });\n }\n }\n points.sort((a, b) => a.offset - b.offset);\n const mouseCoordinates = request.pos.toClientCoordinates(dom.getWindow(ctx.viewDomNode));\n const spanNodeClientRect = spanNode.getBoundingClientRect();\n const mouseIsOverSpanNode = (spanNodeClientRect.left <= mouseCoordinates.clientX && mouseCoordinates.clientX <= spanNodeClientRect.right);\n let rng = null;\n for (let i = 1; i < points.length; i++) {\n const prev = points[i - 1];\n const curr = points[i];\n if (prev.offset <= request.mouseContentHorizontalOffset && request.mouseContentHorizontalOffset <= curr.offset) {\n rng = new EditorRange(lineNumber, prev.column, lineNumber, curr.column);\n // See https://github.com/microsoft/vscode/issues/152819\n // Due to the use of zwj, the browser's hit test result is skewed towards the left\n // Here we try to correct that if the mouse horizontal offset is closer to the right than the left\n const prevDelta = Math.abs(prev.offset - request.mouseContentHorizontalOffset);\n const nextDelta = Math.abs(curr.offset - request.mouseContentHorizontalOffset);\n pos = (prevDelta < nextDelta\n ? new Position(lineNumber, prev.column)\n : new Position(lineNumber, curr.column));\n break;\n }\n }\n return request.fulfillContentText(pos, rng, { mightBeForeignElement: !mouseIsOverSpanNode || !!injectedText, injectedText });\n }\n /**\n * Most probably WebKit browsers and Edge\n */\n static _doHitTestWithCaretRangeFromPoint(ctx, request) {\n // In Chrome, especially on Linux it is possible to click between lines,\n // so try to adjust the `hity` below so that it lands in the center of a line\n const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const lineStartVerticalOffset = ctx.getVerticalOffsetForLineNumber(lineNumber);\n const lineEndVerticalOffset = lineStartVerticalOffset + ctx.lineHeight;\n const isBelowLastLine = (lineNumber === ctx.viewModel.getLineCount()\n && request.mouseVerticalOffset > lineEndVerticalOffset);\n if (!isBelowLastLine) {\n const lineCenteredVerticalOffset = Math.floor((lineStartVerticalOffset + lineEndVerticalOffset) / 2);\n let adjustedPageY = request.pos.y + (lineCenteredVerticalOffset - request.mouseVerticalOffset);\n if (adjustedPageY <= request.editorPos.y) {\n adjustedPageY = request.editorPos.y + 1;\n }\n if (adjustedPageY >= request.editorPos.y + request.editorPos.height) {\n adjustedPageY = request.editorPos.y + request.editorPos.height - 1;\n }\n const adjustedPage = new PageCoordinates(request.pos.x, adjustedPageY);\n const r = this._actualDoHitTestWithCaretRangeFromPoint(ctx, adjustedPage.toClientCoordinates(dom.getWindow(ctx.viewDomNode)));\n if (r.type === 1 /* HitTestResultType.Content */) {\n return r;\n }\n }\n // Also try to hit test without the adjustment (for the edge cases that we are near the top or bottom)\n return this._actualDoHitTestWithCaretRangeFromPoint(ctx, request.pos.toClientCoordinates(dom.getWindow(ctx.viewDomNode)));\n }\n static _actualDoHitTestWithCaretRangeFromPoint(ctx, coords) {\n const shadowRoot = dom.getShadowRoot(ctx.viewDomNode);\n let range;\n if (shadowRoot) {\n if (typeof shadowRoot.caretRangeFromPoint === 'undefined') {\n range = shadowCaretRangeFromPoint(shadowRoot, coords.clientX, coords.clientY);\n }\n else {\n range = shadowRoot.caretRangeFromPoint(coords.clientX, coords.clientY);\n }\n }\n else {\n range = ctx.viewDomNode.ownerDocument.caretRangeFromPoint(coords.clientX, coords.clientY);\n }\n if (!range || !range.startContainer) {\n return new UnknownHitTestResult();\n }\n // Chrome always hits a TEXT_NODE, while Edge sometimes hits a token span\n const startContainer = range.startContainer;\n if (startContainer.nodeType === startContainer.TEXT_NODE) {\n // startContainer is expected to be the token text\n const parent1 = startContainer.parentNode; // expected to be the token span\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span\n const parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div\n const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;\n if (parent3ClassName === ViewLine.CLASS_NAME) {\n return HitTestResult.createFromDOMInfo(ctx, parent1, range.startOffset);\n }\n else {\n return new UnknownHitTestResult(startContainer.parentNode);\n }\n }\n else if (startContainer.nodeType === startContainer.ELEMENT_NODE) {\n // startContainer is expected to be the token span\n const parent1 = startContainer.parentNode; // expected to be the view line container span\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line div\n const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;\n if (parent2ClassName === ViewLine.CLASS_NAME) {\n return HitTestResult.createFromDOMInfo(ctx, startContainer, startContainer.textContent.length);\n }\n else {\n return new UnknownHitTestResult(startContainer);\n }\n }\n return new UnknownHitTestResult();\n }\n /**\n * Most probably Gecko\n */\n static _doHitTestWithCaretPositionFromPoint(ctx, coords) {\n const hitResult = ctx.viewDomNode.ownerDocument.caretPositionFromPoint(coords.clientX, coords.clientY);\n if (hitResult.offsetNode.nodeType === hitResult.offsetNode.TEXT_NODE) {\n // offsetNode is expected to be the token text\n const parent1 = hitResult.offsetNode.parentNode; // expected to be the token span\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span\n const parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div\n const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;\n if (parent3ClassName === ViewLine.CLASS_NAME) {\n return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode.parentNode, hitResult.offset);\n }\n else {\n return new UnknownHitTestResult(hitResult.offsetNode.parentNode);\n }\n }\n // For inline decorations, Gecko sometimes returns the `` of the line and the offset is the `` with the inline decoration\n // Some other times, it returns the `` with the inline decoration\n if (hitResult.offsetNode.nodeType === hitResult.offsetNode.ELEMENT_NODE) {\n const parent1 = hitResult.offsetNode.parentNode;\n const parent1ClassName = parent1 && parent1.nodeType === parent1.ELEMENT_NODE ? parent1.className : null;\n const parent2 = parent1 ? parent1.parentNode : null;\n const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;\n if (parent1ClassName === ViewLine.CLASS_NAME) {\n // it returned the `` of the line and the offset is the `` with the inline decoration\n const tokenSpan = hitResult.offsetNode.childNodes[Math.min(hitResult.offset, hitResult.offsetNode.childNodes.length - 1)];\n if (tokenSpan) {\n return HitTestResult.createFromDOMInfo(ctx, tokenSpan, 0);\n }\n }\n else if (parent2ClassName === ViewLine.CLASS_NAME) {\n // it returned the `` with the inline decoration\n return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode, 0);\n }\n }\n return new UnknownHitTestResult(hitResult.offsetNode);\n }\n static _snapToSoftTabBoundary(position, viewModel) {\n const lineContent = viewModel.getLineContent(position.lineNumber);\n const { tabSize } = viewModel.model.getOptions();\n const newPosition = AtomicTabMoveOperations.atomicPosition(lineContent, position.column - 1, tabSize, 2 /* Direction.Nearest */);\n if (newPosition !== -1) {\n return new Position(position.lineNumber, newPosition + 1);\n }\n return position;\n }\n static _doHitTest(ctx, request) {\n let result = new UnknownHitTestResult();\n if (typeof ctx.viewDomNode.ownerDocument.caretRangeFromPoint === 'function') {\n result = this._doHitTestWithCaretRangeFromPoint(ctx, request);\n }\n else if (ctx.viewDomNode.ownerDocument.caretPositionFromPoint) {\n result = this._doHitTestWithCaretPositionFromPoint(ctx, request.pos.toClientCoordinates(dom.getWindow(ctx.viewDomNode)));\n }\n if (result.type === 1 /* HitTestResultType.Content */) {\n const injectedText = ctx.viewModel.getInjectedTextAt(result.position);\n const normalizedPosition = ctx.viewModel.normalizePosition(result.position, 2 /* PositionAffinity.None */);\n if (injectedText || !normalizedPosition.equals(result.position)) {\n result = new ContentHitTestResult(normalizedPosition, result.spanNode, injectedText);\n }\n }\n return result;\n }\n}\nfunction shadowCaretRangeFromPoint(shadowRoot, x, y) {\n const range = document.createRange();\n // Get the element under the point\n let el = shadowRoot.elementFromPoint(x, y);\n if (el !== null) {\n // Get the last child of the element until its firstChild is a text node\n // This assumes that the pointer is on the right of the line, out of the tokens\n // and that we want to get the offset of the last token of the line\n while (el && el.firstChild && el.firstChild.nodeType !== el.firstChild.TEXT_NODE && el.lastChild && el.lastChild.firstChild) {\n el = el.lastChild;\n }\n // Grab its rect\n const rect = el.getBoundingClientRect();\n // And its font (the computed shorthand font property might be empty, see #3217)\n const elWindow = dom.getWindow(el);\n const fontStyle = elWindow.getComputedStyle(el, null).getPropertyValue('font-style');\n const fontVariant = elWindow.getComputedStyle(el, null).getPropertyValue('font-variant');\n const fontWeight = elWindow.getComputedStyle(el, null).getPropertyValue('font-weight');\n const fontSize = elWindow.getComputedStyle(el, null).getPropertyValue('font-size');\n const lineHeight = elWindow.getComputedStyle(el, null).getPropertyValue('line-height');\n const fontFamily = elWindow.getComputedStyle(el, null).getPropertyValue('font-family');\n const font = `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize}/${lineHeight} ${fontFamily}`;\n // And also its txt content\n const text = el.innerText;\n // Position the pixel cursor at the left of the element\n let pixelCursor = rect.left;\n let offset = 0;\n let step;\n // If the point is on the right of the box put the cursor after the last character\n if (x > rect.left + rect.width) {\n offset = text.length;\n }\n else {\n const charWidthReader = CharWidthReader.getInstance();\n // Goes through all the characters of the innerText, and checks if the x of the point\n // belongs to the character.\n for (let i = 0; i < text.length + 1; i++) {\n // The step is half the width of the character\n step = charWidthReader.getCharWidth(text.charAt(i), font) / 2;\n // Move to the center of the character\n pixelCursor += step;\n // If the x of the point is smaller that the position of the cursor, the point is over that character\n if (x < pixelCursor) {\n offset = i;\n break;\n }\n // Move between the current character and the next\n pixelCursor += step;\n }\n }\n // Creates a range with the text node of the element and set the offset found\n range.setStart(el.firstChild, offset);\n range.setEnd(el.firstChild, offset);\n }\n return range;\n}\nclass CharWidthReader {\n static getInstance() {\n if (!CharWidthReader._INSTANCE) {\n CharWidthReader._INSTANCE = new CharWidthReader();\n }\n return CharWidthReader._INSTANCE;\n }\n constructor() {\n this._cache = {};\n this._canvas = document.createElement('canvas');\n }\n getCharWidth(char, font) {\n const cacheKey = char + font;\n if (this._cache[cacheKey]) {\n return this._cache[cacheKey];\n }\n const context = this._canvas.getContext('2d');\n context.font = font;\n const metrics = context.measureText(char);\n const width = metrics.width;\n this._cache[cacheKey] = width;\n return width;\n }\n}\nCharWidthReader._INSTANCE = null;\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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../dom.js';\nimport { StandardKeyboardEvent } from '../keyboardEvent.js';\nimport { StandardMouseEvent } from '../mouseEvent.js';\nimport { Gesture } from '../touch.js';\nimport { Disposable } from '../../common/lifecycle.js';\nexport class Widget extends Disposable {\n onclick(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onmousedown(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onmouseover(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onmouseleave(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_LEAVE, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onkeydown(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e) => listener(new StandardKeyboardEvent(e))));\n }\n onkeyup(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e) => listener(new StandardKeyboardEvent(e))));\n }\n oninput(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener));\n }\n onblur(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener));\n }\n onfocus(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener));\n }\n onchange(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.CHANGE, listener));\n }\n ignoreGesture(domNode) {\n return Gesture.ignoreTarget(domNode);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { GlobalPointerMoveMonitor } from '../../globalPointerMoveMonitor.js';\nimport { Widget } from '../widget.js';\nimport { TimeoutTimer } from '../../../common/async.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nimport * as dom from '../../dom.js';\n/**\n * The arrow image size.\n */\nexport const ARROW_IMG_SIZE = 11;\nexport class ScrollbarArrow extends Widget {\n constructor(opts) {\n super();\n this._onActivate = opts.onActivate;\n this.bgDomNode = document.createElement('div');\n this.bgDomNode.className = 'arrow-background';\n this.bgDomNode.style.position = 'absolute';\n this.bgDomNode.style.width = opts.bgWidth + 'px';\n this.bgDomNode.style.height = opts.bgHeight + 'px';\n if (typeof opts.top !== 'undefined') {\n this.bgDomNode.style.top = '0px';\n }\n if (typeof opts.left !== 'undefined') {\n this.bgDomNode.style.left = '0px';\n }\n if (typeof opts.bottom !== 'undefined') {\n this.bgDomNode.style.bottom = '0px';\n }\n if (typeof opts.right !== 'undefined') {\n this.bgDomNode.style.right = '0px';\n }\n this.domNode = document.createElement('div');\n this.domNode.className = opts.className;\n this.domNode.classList.add(...ThemeIcon.asClassNameArray(opts.icon));\n this.domNode.style.position = 'absolute';\n this.domNode.style.width = ARROW_IMG_SIZE + 'px';\n this.domNode.style.height = ARROW_IMG_SIZE + 'px';\n if (typeof opts.top !== 'undefined') {\n this.domNode.style.top = opts.top + 'px';\n }\n if (typeof opts.left !== 'undefined') {\n this.domNode.style.left = opts.left + 'px';\n }\n if (typeof opts.bottom !== 'undefined') {\n this.domNode.style.bottom = opts.bottom + 'px';\n }\n if (typeof opts.right !== 'undefined') {\n this.domNode.style.right = opts.right + 'px';\n }\n this._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n this._register(dom.addStandardDisposableListener(this.bgDomNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n this._register(dom.addStandardDisposableListener(this.domNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n this._pointerdownRepeatTimer = this._register(new dom.WindowIntervalTimer());\n this._pointerdownScheduleRepeatTimer = this._register(new TimeoutTimer());\n }\n _arrowPointerDown(e) {\n if (!e.target || !(e.target instanceof Element)) {\n return;\n }\n const scheduleRepeater = () => {\n this._pointerdownRepeatTimer.cancelAndSet(() => this._onActivate(), 1000 / 24, dom.getWindow(e));\n };\n this._onActivate();\n this._pointerdownRepeatTimer.cancel();\n this._pointerdownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);\n this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => { }, () => {\n this._pointerdownRepeatTimer.cancel();\n this._pointerdownScheduleRepeatTimer.cancel();\n });\n e.preventDefault();\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { TimeoutTimer } from '../../../common/async.js';\nimport { Disposable } from '../../../common/lifecycle.js';\nexport class ScrollbarVisibilityController extends Disposable {\n constructor(visibility, visibleClassName, invisibleClassName) {\n super();\n this._visibility = visibility;\n this._visibleClassName = visibleClassName;\n this._invisibleClassName = invisibleClassName;\n this._domNode = null;\n this._isVisible = false;\n this._isNeeded = false;\n this._rawShouldBeVisible = false;\n this._shouldBeVisible = false;\n this._revealTimer = this._register(new TimeoutTimer());\n }\n setVisibility(visibility) {\n if (this._visibility !== visibility) {\n this._visibility = visibility;\n this._updateShouldBeVisible();\n }\n }\n // ----------------- Hide / Reveal\n setShouldBeVisible(rawShouldBeVisible) {\n this._rawShouldBeVisible = rawShouldBeVisible;\n this._updateShouldBeVisible();\n }\n _applyVisibilitySetting() {\n if (this._visibility === 2 /* ScrollbarVisibility.Hidden */) {\n return false;\n }\n if (this._visibility === 3 /* ScrollbarVisibility.Visible */) {\n return true;\n }\n return this._rawShouldBeVisible;\n }\n _updateShouldBeVisible() {\n const shouldBeVisible = this._applyVisibilitySetting();\n if (this._shouldBeVisible !== shouldBeVisible) {\n this._shouldBeVisible = shouldBeVisible;\n this.ensureVisibility();\n }\n }\n setIsNeeded(isNeeded) {\n if (this._isNeeded !== isNeeded) {\n this._isNeeded = isNeeded;\n this.ensureVisibility();\n }\n }\n setDomNode(domNode) {\n this._domNode = domNode;\n this._domNode.setClassName(this._invisibleClassName);\n // Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration\n this.setShouldBeVisible(false);\n }\n ensureVisibility() {\n if (!this._isNeeded) {\n // Nothing to be rendered\n this._hide(false);\n return;\n }\n if (this._shouldBeVisible) {\n this._reveal();\n }\n else {\n this._hide(true);\n }\n }\n _reveal() {\n if (this._isVisible) {\n return;\n }\n this._isVisible = true;\n // The CSS animation doesn't play otherwise\n this._revealTimer.setIfNotSet(() => {\n this._domNode?.setClassName(this._visibleClassName);\n }, 0);\n }\n _hide(withFadeAway) {\n this._revealTimer.cancel();\n if (!this._isVisible) {\n return;\n }\n this._isVisible = false;\n this._domNode?.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : ''));\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../dom.js';\nimport { createFastDomNode } from '../../fastDomNode.js';\nimport { GlobalPointerMoveMonitor } from '../../globalPointerMoveMonitor.js';\nimport { ScrollbarArrow } from './scrollbarArrow.js';\nimport { ScrollbarVisibilityController } from './scrollbarVisibilityController.js';\nimport { Widget } from '../widget.js';\nimport * as platform from '../../../common/platform.js';\n/**\n * The orthogonal distance to the slider at which dragging \"resets\". This implements \"snapping\"\n */\nconst POINTER_DRAG_RESET_DISTANCE = 140;\nexport class AbstractScrollbar extends Widget {\n constructor(opts) {\n super();\n this._lazyRender = opts.lazyRender;\n this._host = opts.host;\n this._scrollable = opts.scrollable;\n this._scrollByPage = opts.scrollByPage;\n this._scrollbarState = opts.scrollbarState;\n this._visibilityController = this._register(new ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName));\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n this._shouldRender = true;\n this.domNode = createFastDomNode(document.createElement('div'));\n this.domNode.setAttribute('role', 'presentation');\n this.domNode.setAttribute('aria-hidden', 'true');\n this._visibilityController.setDomNode(this.domNode);\n this.domNode.setPosition('absolute');\n this._register(dom.addDisposableListener(this.domNode.domNode, dom.EventType.POINTER_DOWN, (e) => this._domNodePointerDown(e)));\n }\n // ----------------- creation\n /**\n * Creates the dom node for an arrow & adds it to the container\n */\n _createArrow(opts) {\n const arrow = this._register(new ScrollbarArrow(opts));\n this.domNode.domNode.appendChild(arrow.bgDomNode);\n this.domNode.domNode.appendChild(arrow.domNode);\n }\n /**\n * Creates the slider dom node, adds it to the container & hooks up the events\n */\n _createSlider(top, left, width, height) {\n this.slider = createFastDomNode(document.createElement('div'));\n this.slider.setClassName('slider');\n this.slider.setPosition('absolute');\n this.slider.setTop(top);\n this.slider.setLeft(left);\n if (typeof width === 'number') {\n this.slider.setWidth(width);\n }\n if (typeof height === 'number') {\n this.slider.setHeight(height);\n }\n this.slider.setLayerHinting(true);\n this.slider.setContain('strict');\n this.domNode.domNode.appendChild(this.slider.domNode);\n this._register(dom.addDisposableListener(this.slider.domNode, dom.EventType.POINTER_DOWN, (e) => {\n if (e.button === 0) {\n e.preventDefault();\n this._sliderPointerDown(e);\n }\n }));\n this.onclick(this.slider.domNode, e => {\n if (e.leftButton) {\n e.stopPropagation();\n }\n });\n }\n // ----------------- Update state\n _onElementSize(visibleSize) {\n if (this._scrollbarState.setVisibleSize(visibleSize)) {\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n return this._shouldRender;\n }\n _onElementScrollSize(elementScrollSize) {\n if (this._scrollbarState.setScrollSize(elementScrollSize)) {\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n return this._shouldRender;\n }\n _onElementScrollPosition(elementScrollPosition) {\n if (this._scrollbarState.setScrollPosition(elementScrollPosition)) {\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n return this._shouldRender;\n }\n // ----------------- rendering\n beginReveal() {\n this._visibilityController.setShouldBeVisible(true);\n }\n beginHide() {\n this._visibilityController.setShouldBeVisible(false);\n }\n render() {\n if (!this._shouldRender) {\n return;\n }\n this._shouldRender = false;\n this._renderDomNode(this._scrollbarState.getRectangleLargeSize(), this._scrollbarState.getRectangleSmallSize());\n this._updateSlider(this._scrollbarState.getSliderSize(), this._scrollbarState.getArrowSize() + this._scrollbarState.getSliderPosition());\n }\n // ----------------- DOM events\n _domNodePointerDown(e) {\n if (e.target !== this.domNode.domNode) {\n return;\n }\n this._onPointerDown(e);\n }\n delegatePointerDown(e) {\n const domTop = this.domNode.domNode.getClientRects()[0].top;\n const sliderStart = domTop + this._scrollbarState.getSliderPosition();\n const sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize();\n const pointerPos = this._sliderPointerPosition(e);\n if (sliderStart <= pointerPos && pointerPos <= sliderStop) {\n // Act as if it was a pointer down on the slider\n if (e.button === 0) {\n e.preventDefault();\n this._sliderPointerDown(e);\n }\n }\n else {\n // Act as if it was a pointer down on the scrollbar\n this._onPointerDown(e);\n }\n }\n _onPointerDown(e) {\n let offsetX;\n let offsetY;\n if (e.target === this.domNode.domNode && typeof e.offsetX === 'number' && typeof e.offsetY === 'number') {\n offsetX = e.offsetX;\n offsetY = e.offsetY;\n }\n else {\n const domNodePosition = dom.getDomNodePagePosition(this.domNode.domNode);\n offsetX = e.pageX - domNodePosition.left;\n offsetY = e.pageY - domNodePosition.top;\n }\n const offset = this._pointerDownRelativePosition(offsetX, offsetY);\n this._setDesiredScrollPositionNow(this._scrollByPage\n ? this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(offset)\n : this._scrollbarState.getDesiredScrollPositionFromOffset(offset));\n if (e.button === 0) {\n // left button\n e.preventDefault();\n this._sliderPointerDown(e);\n }\n }\n _sliderPointerDown(e) {\n if (!e.target || !(e.target instanceof Element)) {\n return;\n }\n const initialPointerPosition = this._sliderPointerPosition(e);\n const initialPointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(e);\n const initialScrollbarState = this._scrollbarState.clone();\n this.slider.toggleClassName('active', true);\n this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => {\n const pointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(pointerMoveData);\n const pointerOrthogonalDelta = Math.abs(pointerOrthogonalPosition - initialPointerOrthogonalPosition);\n if (platform.isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE) {\n // The pointer has wondered away from the scrollbar => reset dragging\n this._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition());\n return;\n }\n const pointerPosition = this._sliderPointerPosition(pointerMoveData);\n const pointerDelta = pointerPosition - initialPointerPosition;\n this._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(pointerDelta));\n }, () => {\n this.slider.toggleClassName('active', false);\n this._host.onDragEnd();\n });\n this._host.onDragStart();\n }\n _setDesiredScrollPositionNow(_desiredScrollPosition) {\n const desiredScrollPosition = {};\n this.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition);\n this._scrollable.setScrollPositionNow(desiredScrollPosition);\n }\n updateScrollbarSize(scrollbarSize) {\n this._updateScrollbarSize(scrollbarSize);\n this._scrollbarState.setScrollbarSize(scrollbarSize);\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n isNeeded() {\n return this._scrollbarState.isNeeded();\n }\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/**\n * The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged.\n */\nconst MINIMUM_SLIDER_SIZE = 20;\nexport class ScrollbarState {\n constructor(arrowSize, scrollbarSize, oppositeScrollbarSize, visibleSize, scrollSize, scrollPosition) {\n this._scrollbarSize = Math.round(scrollbarSize);\n this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n this._arrowSize = Math.round(arrowSize);\n this._visibleSize = visibleSize;\n this._scrollSize = scrollSize;\n this._scrollPosition = scrollPosition;\n this._computedAvailableSize = 0;\n this._computedIsNeeded = false;\n this._computedSliderSize = 0;\n this._computedSliderRatio = 0;\n this._computedSliderPosition = 0;\n this._refreshComputedValues();\n }\n clone() {\n return new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n }\n setVisibleSize(visibleSize) {\n const iVisibleSize = Math.round(visibleSize);\n if (this._visibleSize !== iVisibleSize) {\n this._visibleSize = iVisibleSize;\n this._refreshComputedValues();\n return true;\n }\n return false;\n }\n setScrollSize(scrollSize) {\n const iScrollSize = Math.round(scrollSize);\n if (this._scrollSize !== iScrollSize) {\n this._scrollSize = iScrollSize;\n this._refreshComputedValues();\n return true;\n }\n return false;\n }\n setScrollPosition(scrollPosition) {\n const iScrollPosition = Math.round(scrollPosition);\n if (this._scrollPosition !== iScrollPosition) {\n this._scrollPosition = iScrollPosition;\n this._refreshComputedValues();\n return true;\n }\n return false;\n }\n setScrollbarSize(scrollbarSize) {\n this._scrollbarSize = Math.round(scrollbarSize);\n }\n setOppositeScrollbarSize(oppositeScrollbarSize) {\n this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n }\n static _computeValues(oppositeScrollbarSize, arrowSize, visibleSize, scrollSize, scrollPosition) {\n const computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);\n const computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);\n const computedIsNeeded = (scrollSize > 0 && scrollSize > visibleSize);\n if (!computedIsNeeded) {\n // There is no need for a slider\n return {\n computedAvailableSize: Math.round(computedAvailableSize),\n computedIsNeeded: computedIsNeeded,\n computedSliderSize: Math.round(computedRepresentableSize),\n computedSliderRatio: 0,\n computedSliderPosition: 0,\n };\n }\n // We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise\n const computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize)));\n // The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize`\n // in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`.\n const computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);\n const computedSliderPosition = (scrollPosition * computedSliderRatio);\n return {\n computedAvailableSize: Math.round(computedAvailableSize),\n computedIsNeeded: computedIsNeeded,\n computedSliderSize: Math.round(computedSliderSize),\n computedSliderRatio: computedSliderRatio,\n computedSliderPosition: Math.round(computedSliderPosition),\n };\n }\n _refreshComputedValues() {\n const r = ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n this._computedAvailableSize = r.computedAvailableSize;\n this._computedIsNeeded = r.computedIsNeeded;\n this._computedSliderSize = r.computedSliderSize;\n this._computedSliderRatio = r.computedSliderRatio;\n this._computedSliderPosition = r.computedSliderPosition;\n }\n getArrowSize() {\n return this._arrowSize;\n }\n getScrollPosition() {\n return this._scrollPosition;\n }\n getRectangleLargeSize() {\n return this._computedAvailableSize;\n }\n getRectangleSmallSize() {\n return this._scrollbarSize;\n }\n isNeeded() {\n return this._computedIsNeeded;\n }\n getSliderSize() {\n return this._computedSliderSize;\n }\n getSliderPosition() {\n return this._computedSliderPosition;\n }\n /**\n * Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider.\n * `offset` is based on the same coordinate system as the `sliderPosition`.\n */\n getDesiredScrollPositionFromOffset(offset) {\n if (!this._computedIsNeeded) {\n // no need for a slider\n return 0;\n }\n const desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;\n return Math.round(desiredSliderPosition / this._computedSliderRatio);\n }\n /**\n * Compute a desired `scrollPosition` from if offset is before or after the slider position.\n * If offset is before slider, treat as a page up (or left). If after, page down (or right).\n * `offset` and `_computedSliderPosition` are based on the same coordinate system.\n * `_visibleSize` corresponds to a \"page\" of lines in the returned coordinate system.\n */\n getDesiredScrollPositionFromOffsetPaged(offset) {\n if (!this._computedIsNeeded) {\n // no need for a slider\n return 0;\n }\n const correctedOffset = offset - this._arrowSize; // compensate if has arrows\n let desiredScrollPosition = this._scrollPosition;\n if (correctedOffset < this._computedSliderPosition) {\n desiredScrollPosition -= this._visibleSize; // page up/left\n }\n else {\n desiredScrollPosition += this._visibleSize; // page down/right\n }\n return desiredScrollPosition;\n }\n /**\n * Compute a desired `scrollPosition` such that the slider moves by `delta`.\n */\n getDesiredScrollPositionFromDelta(delta) {\n if (!this._computedIsNeeded) {\n // no need for a slider\n return 0;\n }\n const desiredSliderPosition = this._computedSliderPosition + delta;\n return Math.round(desiredSliderPosition / this._computedSliderRatio);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { StandardWheelEvent } from '../../mouseEvent.js';\nimport { AbstractScrollbar } from './abstractScrollbar.js';\nimport { ARROW_IMG_SIZE } from './scrollbarArrow.js';\nimport { ScrollbarState } from './scrollbarState.js';\nimport { Codicon } from '../../../common/codicons.js';\nexport class HorizontalScrollbar extends AbstractScrollbar {\n constructor(scrollable, options, host) {\n const scrollDimensions = scrollable.getScrollDimensions();\n const scrollPosition = scrollable.getCurrentScrollPosition();\n super({\n lazyRender: options.lazyRender,\n host: host,\n scrollbarState: new ScrollbarState((options.horizontalHasArrows ? options.arrowSize : 0), (options.horizontal === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.horizontalScrollbarSize), (options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize), scrollDimensions.width, scrollDimensions.scrollWidth, scrollPosition.scrollLeft),\n visibility: options.horizontal,\n extraScrollbarClassName: 'horizontal',\n scrollable: scrollable,\n scrollByPage: options.scrollByPage\n });\n if (options.horizontalHasArrows) {\n const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n const scrollbarDelta = (options.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2;\n this._createArrow({\n className: 'scra',\n icon: Codicon.scrollbarButtonLeft,\n top: scrollbarDelta,\n left: arrowDelta,\n bottom: undefined,\n right: undefined,\n bgWidth: options.arrowSize,\n bgHeight: options.horizontalScrollbarSize,\n onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 1, 0)),\n });\n this._createArrow({\n className: 'scra',\n icon: Codicon.scrollbarButtonRight,\n top: scrollbarDelta,\n left: undefined,\n bottom: undefined,\n right: arrowDelta,\n bgWidth: options.arrowSize,\n bgHeight: options.horizontalScrollbarSize,\n onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, -1, 0)),\n });\n }\n this._createSlider(Math.floor((options.horizontalScrollbarSize - options.horizontalSliderSize) / 2), 0, undefined, options.horizontalSliderSize);\n }\n _updateSlider(sliderSize, sliderPosition) {\n this.slider.setWidth(sliderSize);\n this.slider.setLeft(sliderPosition);\n }\n _renderDomNode(largeSize, smallSize) {\n this.domNode.setWidth(largeSize);\n this.domNode.setHeight(smallSize);\n this.domNode.setLeft(0);\n this.domNode.setBottom(0);\n }\n onDidScroll(e) {\n this._shouldRender = this._onElementScrollSize(e.scrollWidth) || this._shouldRender;\n this._shouldRender = this._onElementScrollPosition(e.scrollLeft) || this._shouldRender;\n this._shouldRender = this._onElementSize(e.width) || this._shouldRender;\n return this._shouldRender;\n }\n _pointerDownRelativePosition(offsetX, offsetY) {\n return offsetX;\n }\n _sliderPointerPosition(e) {\n return e.pageX;\n }\n _sliderOrthogonalPointerPosition(e) {\n return e.pageY;\n }\n _updateScrollbarSize(size) {\n this.slider.setHeight(size);\n }\n writeScrollPosition(target, scrollPosition) {\n target.scrollLeft = scrollPosition;\n }\n updateOptions(options) {\n this.updateScrollbarSize(options.horizontal === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.horizontalScrollbarSize);\n this._scrollbarState.setOppositeScrollbarSize(options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize);\n this._visibilityController.setVisibility(options.horizontal);\n this._scrollByPage = options.scrollByPage;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { StandardWheelEvent } from '../../mouseEvent.js';\nimport { AbstractScrollbar } from './abstractScrollbar.js';\nimport { ARROW_IMG_SIZE } from './scrollbarArrow.js';\nimport { ScrollbarState } from './scrollbarState.js';\nimport { Codicon } from '../../../common/codicons.js';\nexport class VerticalScrollbar extends AbstractScrollbar {\n constructor(scrollable, options, host) {\n const scrollDimensions = scrollable.getScrollDimensions();\n const scrollPosition = scrollable.getCurrentScrollPosition();\n super({\n lazyRender: options.lazyRender,\n host: host,\n scrollbarState: new ScrollbarState((options.verticalHasArrows ? options.arrowSize : 0), (options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize), \n // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n 0, scrollDimensions.height, scrollDimensions.scrollHeight, scrollPosition.scrollTop),\n visibility: options.vertical,\n extraScrollbarClassName: 'vertical',\n scrollable: scrollable,\n scrollByPage: options.scrollByPage\n });\n if (options.verticalHasArrows) {\n const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n const scrollbarDelta = (options.verticalScrollbarSize - ARROW_IMG_SIZE) / 2;\n this._createArrow({\n className: 'scra',\n icon: Codicon.scrollbarButtonUp,\n top: arrowDelta,\n left: scrollbarDelta,\n bottom: undefined,\n right: undefined,\n bgWidth: options.verticalScrollbarSize,\n bgHeight: options.arrowSize,\n onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, 1)),\n });\n this._createArrow({\n className: 'scra',\n icon: Codicon.scrollbarButtonDown,\n top: undefined,\n left: scrollbarDelta,\n bottom: arrowDelta,\n right: undefined,\n bgWidth: options.verticalScrollbarSize,\n bgHeight: options.arrowSize,\n onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, -1)),\n });\n }\n this._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined);\n }\n _updateSlider(sliderSize, sliderPosition) {\n this.slider.setHeight(sliderSize);\n this.slider.setTop(sliderPosition);\n }\n _renderDomNode(largeSize, smallSize) {\n this.domNode.setWidth(smallSize);\n this.domNode.setHeight(largeSize);\n this.domNode.setRight(0);\n this.domNode.setTop(0);\n }\n onDidScroll(e) {\n this._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender;\n this._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender;\n this._shouldRender = this._onElementSize(e.height) || this._shouldRender;\n return this._shouldRender;\n }\n _pointerDownRelativePosition(offsetX, offsetY) {\n return offsetY;\n }\n _sliderPointerPosition(e) {\n return e.pageY;\n }\n _sliderOrthogonalPointerPosition(e) {\n return e.pageX;\n }\n _updateScrollbarSize(size) {\n this.slider.setWidth(size);\n }\n writeScrollPosition(target, scrollPosition) {\n target.scrollTop = scrollPosition;\n }\n updateOptions(options) {\n this.updateScrollbarSize(options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize);\n // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n this._scrollbarState.setOppositeScrollbarSize(0);\n this._visibilityController.setVisibility(options.vertical);\n this._scrollByPage = options.scrollByPage;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from './event.js';\nimport { Disposable } from './lifecycle.js';\nexport class ScrollState {\n constructor(_forceIntegerValues, width, scrollWidth, scrollLeft, height, scrollHeight, scrollTop) {\n this._forceIntegerValues = _forceIntegerValues;\n this._scrollStateBrand = undefined;\n if (this._forceIntegerValues) {\n width = width | 0;\n scrollWidth = scrollWidth | 0;\n scrollLeft = scrollLeft | 0;\n height = height | 0;\n scrollHeight = scrollHeight | 0;\n scrollTop = scrollTop | 0;\n }\n this.rawScrollLeft = scrollLeft; // before validation\n this.rawScrollTop = scrollTop; // before validation\n if (width < 0) {\n width = 0;\n }\n if (scrollLeft + width > scrollWidth) {\n scrollLeft = scrollWidth - width;\n }\n if (scrollLeft < 0) {\n scrollLeft = 0;\n }\n if (height < 0) {\n height = 0;\n }\n if (scrollTop + height > scrollHeight) {\n scrollTop = scrollHeight - height;\n }\n if (scrollTop < 0) {\n scrollTop = 0;\n }\n this.width = width;\n this.scrollWidth = scrollWidth;\n this.scrollLeft = scrollLeft;\n this.height = height;\n this.scrollHeight = scrollHeight;\n this.scrollTop = scrollTop;\n }\n equals(other) {\n return (this.rawScrollLeft === other.rawScrollLeft\n && this.rawScrollTop === other.rawScrollTop\n && this.width === other.width\n && this.scrollWidth === other.scrollWidth\n && this.scrollLeft === other.scrollLeft\n && this.height === other.height\n && this.scrollHeight === other.scrollHeight\n && this.scrollTop === other.scrollTop);\n }\n withScrollDimensions(update, useRawScrollPositions) {\n return new ScrollState(this._forceIntegerValues, (typeof update.width !== 'undefined' ? update.width : this.width), (typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth), useRawScrollPositions ? this.rawScrollLeft : this.scrollLeft, (typeof update.height !== 'undefined' ? update.height : this.height), (typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight), useRawScrollPositions ? this.rawScrollTop : this.scrollTop);\n }\n withScrollPosition(update) {\n return new ScrollState(this._forceIntegerValues, this.width, this.scrollWidth, (typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft), this.height, this.scrollHeight, (typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop));\n }\n createScrollEvent(previous, inSmoothScrolling) {\n const widthChanged = (this.width !== previous.width);\n const scrollWidthChanged = (this.scrollWidth !== previous.scrollWidth);\n const scrollLeftChanged = (this.scrollLeft !== previous.scrollLeft);\n const heightChanged = (this.height !== previous.height);\n const scrollHeightChanged = (this.scrollHeight !== previous.scrollHeight);\n const scrollTopChanged = (this.scrollTop !== previous.scrollTop);\n return {\n inSmoothScrolling: inSmoothScrolling,\n oldWidth: previous.width,\n oldScrollWidth: previous.scrollWidth,\n oldScrollLeft: previous.scrollLeft,\n width: this.width,\n scrollWidth: this.scrollWidth,\n scrollLeft: this.scrollLeft,\n oldHeight: previous.height,\n oldScrollHeight: previous.scrollHeight,\n oldScrollTop: previous.scrollTop,\n height: this.height,\n scrollHeight: this.scrollHeight,\n scrollTop: this.scrollTop,\n widthChanged: widthChanged,\n scrollWidthChanged: scrollWidthChanged,\n scrollLeftChanged: scrollLeftChanged,\n heightChanged: heightChanged,\n scrollHeightChanged: scrollHeightChanged,\n scrollTopChanged: scrollTopChanged,\n };\n }\n}\nexport class Scrollable extends Disposable {\n constructor(options) {\n super();\n this._scrollableBrand = undefined;\n this._onScroll = this._register(new Emitter());\n this.onScroll = this._onScroll.event;\n this._smoothScrollDuration = options.smoothScrollDuration;\n this._scheduleAtNextAnimationFrame = options.scheduleAtNextAnimationFrame;\n this._state = new ScrollState(options.forceIntegerValues, 0, 0, 0, 0, 0, 0);\n this._smoothScrolling = null;\n }\n dispose() {\n if (this._smoothScrolling) {\n this._smoothScrolling.dispose();\n this._smoothScrolling = null;\n }\n super.dispose();\n }\n setSmoothScrollDuration(smoothScrollDuration) {\n this._smoothScrollDuration = smoothScrollDuration;\n }\n validateScrollPosition(scrollPosition) {\n return this._state.withScrollPosition(scrollPosition);\n }\n getScrollDimensions() {\n return this._state;\n }\n setScrollDimensions(dimensions, useRawScrollPositions) {\n const newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);\n this._setState(newState, Boolean(this._smoothScrolling));\n // Validate outstanding animated scroll position target\n this._smoothScrolling?.acceptScrollDimensions(this._state);\n }\n /**\n * Returns the final scroll position that the instance will have once the smooth scroll animation concludes.\n * If no scroll animation is occurring, it will return the current scroll position instead.\n */\n getFutureScrollPosition() {\n if (this._smoothScrolling) {\n return this._smoothScrolling.to;\n }\n return this._state;\n }\n /**\n * Returns the current scroll position.\n * Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.\n */\n getCurrentScrollPosition() {\n return this._state;\n }\n setScrollPositionNow(update) {\n // no smooth scrolling requested\n const newState = this._state.withScrollPosition(update);\n // Terminate any outstanding smooth scrolling\n if (this._smoothScrolling) {\n this._smoothScrolling.dispose();\n this._smoothScrolling = null;\n }\n this._setState(newState, false);\n }\n setScrollPositionSmooth(update, reuseAnimation) {\n if (this._smoothScrollDuration === 0) {\n // Smooth scrolling not supported.\n return this.setScrollPositionNow(update);\n }\n if (this._smoothScrolling) {\n // Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop\n update = {\n scrollLeft: (typeof update.scrollLeft === 'undefined' ? this._smoothScrolling.to.scrollLeft : update.scrollLeft),\n scrollTop: (typeof update.scrollTop === 'undefined' ? this._smoothScrolling.to.scrollTop : update.scrollTop)\n };\n // Validate `update`\n const validTarget = this._state.withScrollPosition(update);\n if (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) {\n // No need to interrupt or extend the current animation since we're going to the same place\n return;\n }\n let newSmoothScrolling;\n if (reuseAnimation) {\n newSmoothScrolling = new SmoothScrollingOperation(this._smoothScrolling.from, validTarget, this._smoothScrolling.startTime, this._smoothScrolling.duration);\n }\n else {\n newSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration);\n }\n this._smoothScrolling.dispose();\n this._smoothScrolling = newSmoothScrolling;\n }\n else {\n // Validate `update`\n const validTarget = this._state.withScrollPosition(update);\n this._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration);\n }\n // Begin smooth scrolling animation\n this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n if (!this._smoothScrolling) {\n return;\n }\n this._smoothScrolling.animationFrameDisposable = null;\n this._performSmoothScrolling();\n });\n }\n hasPendingScrollAnimation() {\n return Boolean(this._smoothScrolling);\n }\n _performSmoothScrolling() {\n if (!this._smoothScrolling) {\n return;\n }\n const update = this._smoothScrolling.tick();\n const newState = this._state.withScrollPosition(update);\n this._setState(newState, true);\n if (!this._smoothScrolling) {\n // Looks like someone canceled the smooth scrolling\n // from the scroll event handler\n return;\n }\n if (update.isDone) {\n this._smoothScrolling.dispose();\n this._smoothScrolling = null;\n return;\n }\n // Continue smooth scrolling animation\n this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n if (!this._smoothScrolling) {\n return;\n }\n this._smoothScrolling.animationFrameDisposable = null;\n this._performSmoothScrolling();\n });\n }\n _setState(newState, inSmoothScrolling) {\n const oldState = this._state;\n if (oldState.equals(newState)) {\n // no change\n return;\n }\n this._state = newState;\n this._onScroll.fire(this._state.createScrollEvent(oldState, inSmoothScrolling));\n }\n}\nexport class SmoothScrollingUpdate {\n constructor(scrollLeft, scrollTop, isDone) {\n this.scrollLeft = scrollLeft;\n this.scrollTop = scrollTop;\n this.isDone = isDone;\n }\n}\nfunction createEaseOutCubic(from, to) {\n const delta = to - from;\n return function (completion) {\n return from + delta * easeOutCubic(completion);\n };\n}\nfunction createComposed(a, b, cut) {\n return function (completion) {\n if (completion < cut) {\n return a(completion / cut);\n }\n return b((completion - cut) / (1 - cut));\n };\n}\nexport class SmoothScrollingOperation {\n constructor(from, to, startTime, duration) {\n this.from = from;\n this.to = to;\n this.duration = duration;\n this.startTime = startTime;\n this.animationFrameDisposable = null;\n this._initAnimations();\n }\n _initAnimations() {\n this.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);\n this.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);\n }\n _initAnimation(from, to, viewportSize) {\n const delta = Math.abs(from - to);\n if (delta > 2.5 * viewportSize) {\n let stop1, stop2;\n if (from < to) {\n // scroll to 75% of the viewportSize\n stop1 = from + 0.75 * viewportSize;\n stop2 = to - 0.75 * viewportSize;\n }\n else {\n stop1 = from - 0.75 * viewportSize;\n stop2 = to + 0.75 * viewportSize;\n }\n return createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);\n }\n return createEaseOutCubic(from, to);\n }\n dispose() {\n if (this.animationFrameDisposable !== null) {\n this.animationFrameDisposable.dispose();\n this.animationFrameDisposable = null;\n }\n }\n acceptScrollDimensions(state) {\n this.to = state.withScrollPosition(this.to);\n this._initAnimations();\n }\n tick() {\n return this._tick(Date.now());\n }\n _tick(now) {\n const completion = (now - this.startTime) / this.duration;\n if (completion < 1) {\n const newScrollLeft = this.scrollLeft(completion);\n const newScrollTop = this.scrollTop(completion);\n return new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);\n }\n return new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);\n }\n combine(from, to, duration) {\n return SmoothScrollingOperation.start(from, to, duration);\n }\n static start(from, to, duration) {\n // +10 / -10 : pretend the animation already started for a quicker response to a scroll request\n duration = duration + 10;\n const startTime = Date.now() - 10;\n return new SmoothScrollingOperation(from, to, startTime, duration);\n }\n}\nfunction easeInCubic(t) {\n return Math.pow(t, 3);\n}\nfunction easeOutCubic(t) {\n return 1 - easeInCubic(1 - t);\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 *--------------------------------------------------------------------------------------------*/\nimport { getZoomFactor } from '../../browser.js';\nimport * as dom from '../../dom.js';\nimport { createFastDomNode } from '../../fastDomNode.js';\nimport { StandardWheelEvent } from '../../mouseEvent.js';\nimport { HorizontalScrollbar } from './horizontalScrollbar.js';\nimport { VerticalScrollbar } from './verticalScrollbar.js';\nimport { Widget } from '../widget.js';\nimport { TimeoutTimer } from '../../../common/async.js';\nimport { Emitter } from '../../../common/event.js';\nimport { dispose } from '../../../common/lifecycle.js';\nimport * as platform from '../../../common/platform.js';\nimport { Scrollable } from '../../../common/scrollable.js';\nimport './media/scrollbars.css';\nconst HIDE_TIMEOUT = 500;\nconst SCROLL_WHEEL_SENSITIVITY = 50;\nconst SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true;\nclass MouseWheelClassifierItem {\n constructor(timestamp, deltaX, deltaY) {\n this.timestamp = timestamp;\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n this.score = 0;\n }\n}\nexport class MouseWheelClassifier {\n constructor() {\n this._capacity = 5;\n this._memory = [];\n this._front = -1;\n this._rear = -1;\n }\n isPhysicalMouseWheel() {\n if (this._front === -1 && this._rear === -1) {\n // no elements\n return false;\n }\n // 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ...\n let remainingInfluence = 1;\n let score = 0;\n let iteration = 1;\n let index = this._rear;\n do {\n const influence = (index === this._front ? remainingInfluence : Math.pow(2, -iteration));\n remainingInfluence -= influence;\n score += this._memory[index].score * influence;\n if (index === this._front) {\n break;\n }\n index = (this._capacity + index - 1) % this._capacity;\n iteration++;\n } while (true);\n return (score <= 0.5);\n }\n acceptStandardWheelEvent(e) {\n const osZoomFactor = dom.getWindow(e.browserEvent).devicePixelRatio / getZoomFactor();\n if (platform.isWindows || platform.isLinux) {\n // On Windows and Linux, the incoming delta events are multiplied with the OS zoom factor.\n // The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account.\n this.accept(Date.now(), e.deltaX / osZoomFactor, e.deltaY / osZoomFactor);\n }\n else {\n this.accept(Date.now(), e.deltaX, e.deltaY);\n }\n }\n accept(timestamp, deltaX, deltaY) {\n const item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY);\n item.score = this._computeScore(item);\n if (this._front === -1 && this._rear === -1) {\n this._memory[0] = item;\n this._front = 0;\n this._rear = 0;\n }\n else {\n this._rear = (this._rear + 1) % this._capacity;\n if (this._rear === this._front) {\n // Drop oldest\n this._front = (this._front + 1) % this._capacity;\n }\n this._memory[this._rear] = item;\n }\n }\n /**\n * A score between 0 and 1 for `item`.\n * - a score towards 0 indicates that the source appears to be a physical mouse wheel\n * - a score towards 1 indicates that the source appears to be a touchpad or magic mouse, etc.\n */\n _computeScore(item) {\n if (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) {\n // both axes exercised => definitely not a physical mouse wheel\n return 1;\n }\n let score = 0.5;\n const prev = (this._front === -1 && this._rear === -1 ? null : this._memory[this._rear]);\n if (prev) {\n // const deltaT = item.timestamp - prev.timestamp;\n // if (deltaT < 1000 / 30) {\n // \t// sooner than X times per second => indicator that this is not a physical mouse wheel\n // \tscore += 0.25;\n // }\n // if (item.deltaX === prev.deltaX && item.deltaY === prev.deltaY) {\n // \t// equal amplitude => indicator that this is a physical mouse wheel\n // \tscore -= 0.25;\n // }\n }\n if (!this._isAlmostInt(item.deltaX) || !this._isAlmostInt(item.deltaY)) {\n // non-integer deltas => indicator that this is not a physical mouse wheel\n score += 0.25;\n }\n return Math.min(Math.max(score, 0), 1);\n }\n _isAlmostInt(value) {\n const delta = Math.abs(Math.round(value) - value);\n return (delta < 0.01);\n }\n}\nMouseWheelClassifier.INSTANCE = new MouseWheelClassifier();\nexport class AbstractScrollableElement extends Widget {\n get options() {\n return this._options;\n }\n constructor(element, options, scrollable) {\n super();\n this._onScroll = this._register(new Emitter());\n this.onScroll = this._onScroll.event;\n this._onWillScroll = this._register(new Emitter());\n this.onWillScroll = this._onWillScroll.event;\n element.style.overflow = 'hidden';\n this._options = resolveOptions(options);\n this._scrollable = scrollable;\n this._register(this._scrollable.onScroll((e) => {\n this._onWillScroll.fire(e);\n this._onDidScroll(e);\n this._onScroll.fire(e);\n }));\n const scrollbarHost = {\n onMouseWheel: (mouseWheelEvent) => this._onMouseWheel(mouseWheelEvent),\n onDragStart: () => this._onDragStart(),\n onDragEnd: () => this._onDragEnd(),\n };\n this._verticalScrollbar = this._register(new VerticalScrollbar(this._scrollable, this._options, scrollbarHost));\n this._horizontalScrollbar = this._register(new HorizontalScrollbar(this._scrollable, this._options, scrollbarHost));\n this._domNode = document.createElement('div');\n this._domNode.className = 'monaco-scrollable-element ' + this._options.className;\n this._domNode.setAttribute('role', 'presentation');\n this._domNode.style.position = 'relative';\n this._domNode.style.overflow = 'hidden';\n this._domNode.appendChild(element);\n this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode);\n this._domNode.appendChild(this._verticalScrollbar.domNode.domNode);\n if (this._options.useShadows) {\n this._leftShadowDomNode = createFastDomNode(document.createElement('div'));\n this._leftShadowDomNode.setClassName('shadow');\n this._domNode.appendChild(this._leftShadowDomNode.domNode);\n this._topShadowDomNode = createFastDomNode(document.createElement('div'));\n this._topShadowDomNode.setClassName('shadow');\n this._domNode.appendChild(this._topShadowDomNode.domNode);\n this._topLeftShadowDomNode = createFastDomNode(document.createElement('div'));\n this._topLeftShadowDomNode.setClassName('shadow');\n this._domNode.appendChild(this._topLeftShadowDomNode.domNode);\n }\n else {\n this._leftShadowDomNode = null;\n this._topShadowDomNode = null;\n this._topLeftShadowDomNode = null;\n }\n this._listenOnDomNode = this._options.listenOnDomNode || this._domNode;\n this._mouseWheelToDispose = [];\n this._setListeningToMouseWheel(this._options.handleMouseWheel);\n this.onmouseover(this._listenOnDomNode, (e) => this._onMouseOver(e));\n this.onmouseleave(this._listenOnDomNode, (e) => this._onMouseLeave(e));\n this._hideTimeout = this._register(new TimeoutTimer());\n this._isDragging = false;\n this._mouseIsOver = false;\n this._shouldRender = true;\n this._revealOnScroll = true;\n }\n dispose() {\n this._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n super.dispose();\n }\n /**\n * Get the generated 'scrollable' dom node\n */\n getDomNode() {\n return this._domNode;\n }\n getOverviewRulerLayoutInfo() {\n return {\n parent: this._domNode,\n insertBefore: this._verticalScrollbar.domNode.domNode,\n };\n }\n /**\n * Delegate a pointer down event to the vertical scrollbar.\n * This is to help with clicking somewhere else and having the scrollbar react.\n */\n delegateVerticalScrollbarPointerDown(browserEvent) {\n this._verticalScrollbar.delegatePointerDown(browserEvent);\n }\n getScrollDimensions() {\n return this._scrollable.getScrollDimensions();\n }\n setScrollDimensions(dimensions) {\n this._scrollable.setScrollDimensions(dimensions, false);\n }\n /**\n * Update the class name of the scrollable element.\n */\n updateClassName(newClassName) {\n this._options.className = newClassName;\n // Defaults are different on Macs\n if (platform.isMacintosh) {\n this._options.className += ' mac';\n }\n this._domNode.className = 'monaco-scrollable-element ' + this._options.className;\n }\n /**\n * Update configuration options for the scrollbar.\n */\n updateOptions(newOptions) {\n if (typeof newOptions.handleMouseWheel !== 'undefined') {\n this._options.handleMouseWheel = newOptions.handleMouseWheel;\n this._setListeningToMouseWheel(this._options.handleMouseWheel);\n }\n if (typeof newOptions.mouseWheelScrollSensitivity !== 'undefined') {\n this._options.mouseWheelScrollSensitivity = newOptions.mouseWheelScrollSensitivity;\n }\n if (typeof newOptions.fastScrollSensitivity !== 'undefined') {\n this._options.fastScrollSensitivity = newOptions.fastScrollSensitivity;\n }\n if (typeof newOptions.scrollPredominantAxis !== 'undefined') {\n this._options.scrollPredominantAxis = newOptions.scrollPredominantAxis;\n }\n if (typeof newOptions.horizontal !== 'undefined') {\n this._options.horizontal = newOptions.horizontal;\n }\n if (typeof newOptions.vertical !== 'undefined') {\n this._options.vertical = newOptions.vertical;\n }\n if (typeof newOptions.horizontalScrollbarSize !== 'undefined') {\n this._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize;\n }\n if (typeof newOptions.verticalScrollbarSize !== 'undefined') {\n this._options.verticalScrollbarSize = newOptions.verticalScrollbarSize;\n }\n if (typeof newOptions.scrollByPage !== 'undefined') {\n this._options.scrollByPage = newOptions.scrollByPage;\n }\n this._horizontalScrollbar.updateOptions(this._options);\n this._verticalScrollbar.updateOptions(this._options);\n if (!this._options.lazyRender) {\n this._render();\n }\n }\n setRevealOnScroll(value) {\n this._revealOnScroll = value;\n }\n delegateScrollFromMouseWheelEvent(browserEvent) {\n this._onMouseWheel(new StandardWheelEvent(browserEvent));\n }\n // -------------------- mouse wheel scrolling --------------------\n _setListeningToMouseWheel(shouldListen) {\n const isListening = (this._mouseWheelToDispose.length > 0);\n if (isListening === shouldListen) {\n // No change\n return;\n }\n // Stop listening (if necessary)\n this._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n // Start listening (if necessary)\n if (shouldListen) {\n const onMouseWheel = (browserEvent) => {\n this._onMouseWheel(new StandardWheelEvent(browserEvent));\n };\n this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { passive: false }));\n }\n }\n _onMouseWheel(e) {\n if (e.browserEvent?.defaultPrevented) {\n return;\n }\n const classifier = MouseWheelClassifier.INSTANCE;\n if (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) {\n classifier.acceptStandardWheelEvent(e);\n }\n // console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`);\n let didScroll = false;\n if (e.deltaY || e.deltaX) {\n let deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity;\n let deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity;\n if (this._options.scrollPredominantAxis) {\n if (this._options.scrollYToX && deltaX + deltaY === 0) {\n // when configured to map Y to X and we both see\n // no dominant axis and X and Y are competing with\n // identical values into opposite directions, we\n // ignore the delta as we cannot make a decision then\n deltaX = deltaY = 0;\n }\n else if (Math.abs(deltaY) >= Math.abs(deltaX)) {\n deltaX = 0;\n }\n else {\n deltaY = 0;\n }\n }\n if (this._options.flipAxes) {\n [deltaY, deltaX] = [deltaX, deltaY];\n }\n // Convert vertical scrolling to horizontal if shift is held, this\n // is handled at a higher level on Mac\n const shiftConvert = !platform.isMacintosh && e.browserEvent && e.browserEvent.shiftKey;\n if ((this._options.scrollYToX || shiftConvert) && !deltaX) {\n deltaX = deltaY;\n deltaY = 0;\n }\n if (e.browserEvent && e.browserEvent.altKey) {\n // fastScrolling\n deltaX = deltaX * this._options.fastScrollSensitivity;\n deltaY = deltaY * this._options.fastScrollSensitivity;\n }\n const futureScrollPosition = this._scrollable.getFutureScrollPosition();\n let desiredScrollPosition = {};\n if (deltaY) {\n const deltaScrollTop = SCROLL_WHEEL_SENSITIVITY * deltaY;\n // Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n const desiredScrollTop = futureScrollPosition.scrollTop - (deltaScrollTop < 0 ? Math.floor(deltaScrollTop) : Math.ceil(deltaScrollTop));\n this._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop);\n }\n if (deltaX) {\n const deltaScrollLeft = SCROLL_WHEEL_SENSITIVITY * deltaX;\n // Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n const desiredScrollLeft = futureScrollPosition.scrollLeft - (deltaScrollLeft < 0 ? Math.floor(deltaScrollLeft) : Math.ceil(deltaScrollLeft));\n this._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft);\n }\n // Check that we are scrolling towards a location which is valid\n desiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition);\n if (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) {\n const canPerformSmoothScroll = (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED\n && this._options.mouseWheelSmoothScroll\n && classifier.isPhysicalMouseWheel());\n if (canPerformSmoothScroll) {\n this._scrollable.setScrollPositionSmooth(desiredScrollPosition);\n }\n else {\n this._scrollable.setScrollPositionNow(desiredScrollPosition);\n }\n didScroll = true;\n }\n }\n let consumeMouseWheel = didScroll;\n if (!consumeMouseWheel && this._options.alwaysConsumeMouseWheel) {\n consumeMouseWheel = true;\n }\n if (!consumeMouseWheel && this._options.consumeMouseWheelIfScrollbarIsNeeded && (this._verticalScrollbar.isNeeded() || this._horizontalScrollbar.isNeeded())) {\n consumeMouseWheel = true;\n }\n if (consumeMouseWheel) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n _onDidScroll(e) {\n this._shouldRender = this._horizontalScrollbar.onDidScroll(e) || this._shouldRender;\n this._shouldRender = this._verticalScrollbar.onDidScroll(e) || this._shouldRender;\n if (this._options.useShadows) {\n this._shouldRender = true;\n }\n if (this._revealOnScroll) {\n this._reveal();\n }\n if (!this._options.lazyRender) {\n this._render();\n }\n }\n /**\n * Render / mutate the DOM now.\n * Should be used together with the ctor option `lazyRender`.\n */\n renderNow() {\n if (!this._options.lazyRender) {\n throw new Error('Please use `lazyRender` together with `renderNow`!');\n }\n this._render();\n }\n _render() {\n if (!this._shouldRender) {\n return;\n }\n this._shouldRender = false;\n this._horizontalScrollbar.render();\n this._verticalScrollbar.render();\n if (this._options.useShadows) {\n const scrollState = this._scrollable.getCurrentScrollPosition();\n const enableTop = scrollState.scrollTop > 0;\n const enableLeft = scrollState.scrollLeft > 0;\n const leftClassName = (enableLeft ? ' left' : '');\n const topClassName = (enableTop ? ' top' : '');\n const topLeftClassName = (enableLeft || enableTop ? ' top-left-corner' : '');\n this._leftShadowDomNode.setClassName(`shadow${leftClassName}`);\n this._topShadowDomNode.setClassName(`shadow${topClassName}`);\n this._topLeftShadowDomNode.setClassName(`shadow${topLeftClassName}${topClassName}${leftClassName}`);\n }\n }\n // -------------------- fade in / fade out --------------------\n _onDragStart() {\n this._isDragging = true;\n this._reveal();\n }\n _onDragEnd() {\n this._isDragging = false;\n this._hide();\n }\n _onMouseLeave(e) {\n this._mouseIsOver = false;\n this._hide();\n }\n _onMouseOver(e) {\n this._mouseIsOver = true;\n this._reveal();\n }\n _reveal() {\n this._verticalScrollbar.beginReveal();\n this._horizontalScrollbar.beginReveal();\n this._scheduleHide();\n }\n _hide() {\n if (!this._mouseIsOver && !this._isDragging) {\n this._verticalScrollbar.beginHide();\n this._horizontalScrollbar.beginHide();\n }\n }\n _scheduleHide() {\n if (!this._mouseIsOver && !this._isDragging) {\n this._hideTimeout.cancelAndSet(() => this._hide(), HIDE_TIMEOUT);\n }\n }\n}\nexport class ScrollableElement extends AbstractScrollableElement {\n constructor(element, options) {\n options = options || {};\n options.mouseWheelSmoothScroll = false;\n const scrollable = new Scrollable({\n forceIntegerValues: true,\n smoothScrollDuration: 0,\n scheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n });\n super(element, options, scrollable);\n this._register(scrollable);\n }\n setScrollPosition(update) {\n this._scrollable.setScrollPositionNow(update);\n }\n getScrollPosition() {\n return this._scrollable.getCurrentScrollPosition();\n }\n}\nexport class SmoothScrollableElement extends AbstractScrollableElement {\n constructor(element, options, scrollable) {\n super(element, options, scrollable);\n }\n setScrollPosition(update) {\n if (update.reuseAnimation) {\n this._scrollable.setScrollPositionSmooth(update, update.reuseAnimation);\n }\n else {\n this._scrollable.setScrollPositionNow(update);\n }\n }\n getScrollPosition() {\n return this._scrollable.getCurrentScrollPosition();\n }\n}\nexport class DomScrollableElement extends AbstractScrollableElement {\n constructor(element, options) {\n options = options || {};\n options.mouseWheelSmoothScroll = false;\n const scrollable = new Scrollable({\n forceIntegerValues: false, // See https://github.com/microsoft/vscode/issues/139877\n smoothScrollDuration: 0,\n scheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n });\n super(element, options, scrollable);\n this._register(scrollable);\n this._element = element;\n this._register(this.onScroll((e) => {\n if (e.scrollTopChanged) {\n this._element.scrollTop = e.scrollTop;\n }\n if (e.scrollLeftChanged) {\n this._element.scrollLeft = e.scrollLeft;\n }\n }));\n this.scanDomNode();\n }\n setScrollPosition(update) {\n this._scrollable.setScrollPositionNow(update);\n }\n getScrollPosition() {\n return this._scrollable.getCurrentScrollPosition();\n }\n scanDomNode() {\n // width, scrollLeft, scrollWidth, height, scrollTop, scrollHeight\n this.setScrollDimensions({\n width: this._element.clientWidth,\n scrollWidth: this._element.scrollWidth,\n height: this._element.clientHeight,\n scrollHeight: this._element.scrollHeight\n });\n this.setScrollPosition({\n scrollLeft: this._element.scrollLeft,\n scrollTop: this._element.scrollTop,\n });\n }\n}\nfunction resolveOptions(opts) {\n const result = {\n lazyRender: (typeof opts.lazyRender !== 'undefined' ? opts.lazyRender : false),\n className: (typeof opts.className !== 'undefined' ? opts.className : ''),\n useShadows: (typeof opts.useShadows !== 'undefined' ? opts.useShadows : true),\n handleMouseWheel: (typeof opts.handleMouseWheel !== 'undefined' ? opts.handleMouseWheel : true),\n flipAxes: (typeof opts.flipAxes !== 'undefined' ? opts.flipAxes : false),\n consumeMouseWheelIfScrollbarIsNeeded: (typeof opts.consumeMouseWheelIfScrollbarIsNeeded !== 'undefined' ? opts.consumeMouseWheelIfScrollbarIsNeeded : false),\n alwaysConsumeMouseWheel: (typeof opts.alwaysConsumeMouseWheel !== 'undefined' ? opts.alwaysConsumeMouseWheel : false),\n scrollYToX: (typeof opts.scrollYToX !== 'undefined' ? opts.scrollYToX : false),\n mouseWheelScrollSensitivity: (typeof opts.mouseWheelScrollSensitivity !== 'undefined' ? opts.mouseWheelScrollSensitivity : 1),\n fastScrollSensitivity: (typeof opts.fastScrollSensitivity !== 'undefined' ? opts.fastScrollSensitivity : 5),\n scrollPredominantAxis: (typeof opts.scrollPredominantAxis !== 'undefined' ? opts.scrollPredominantAxis : true),\n mouseWheelSmoothScroll: (typeof opts.mouseWheelSmoothScroll !== 'undefined' ? opts.mouseWheelSmoothScroll : true),\n arrowSize: (typeof opts.arrowSize !== 'undefined' ? opts.arrowSize : 11),\n listenOnDomNode: (typeof opts.listenOnDomNode !== 'undefined' ? opts.listenOnDomNode : null),\n horizontal: (typeof opts.horizontal !== 'undefined' ? opts.horizontal : 1 /* ScrollbarVisibility.Auto */),\n horizontalScrollbarSize: (typeof opts.horizontalScrollbarSize !== 'undefined' ? opts.horizontalScrollbarSize : 10),\n horizontalSliderSize: (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : 0),\n horizontalHasArrows: (typeof opts.horizontalHasArrows !== 'undefined' ? opts.horizontalHasArrows : false),\n vertical: (typeof opts.vertical !== 'undefined' ? opts.vertical : 1 /* ScrollbarVisibility.Auto */),\n verticalScrollbarSize: (typeof opts.verticalScrollbarSize !== 'undefined' ? opts.verticalScrollbarSize : 10),\n verticalHasArrows: (typeof opts.verticalHasArrows !== 'undefined' ? opts.verticalHasArrows : false),\n verticalSliderSize: (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : 0),\n scrollByPage: (typeof opts.scrollByPage !== 'undefined' ? opts.scrollByPage : false)\n };\n result.horizontalSliderSize = (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : result.horizontalScrollbarSize);\n result.verticalSliderSize = (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : result.verticalScrollbarSize);\n // Defaults are different on Macs\n if (platform.isMacintosh) {\n result.className += ' mac';\n }\n return result;\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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../../base/browser/dom.js';\nimport { StandardWheelEvent } from '../../../base/browser/mouseEvent.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { HitTestContext, MouseTarget, MouseTargetFactory } from './mouseTarget.js';\nimport { ClientCoordinates, EditorMouseEvent, EditorMouseEventFactory, GlobalEditorPointerMoveMonitor, createEditorPagePosition, createCoordinatesRelativeToEditor, PageCoordinates } from '../editorDom.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { Position } from '../../common/core/position.js';\nimport { Selection } from '../../common/core/selection.js';\nimport { ViewEventHandler } from '../../common/viewEventHandler.js';\nimport { MouseWheelClassifier } from '../../../base/browser/ui/scrollbar/scrollableElement.js';\nexport class MouseHandler extends ViewEventHandler {\n constructor(context, viewController, viewHelper) {\n super();\n this._mouseLeaveMonitor = null;\n this._context = context;\n this.viewController = viewController;\n this.viewHelper = viewHelper;\n this.mouseTargetFactory = new MouseTargetFactory(this._context, viewHelper);\n this._mouseDownOperation = this._register(new MouseDownOperation(this._context, this.viewController, this.viewHelper, this.mouseTargetFactory, (e, testEventTarget) => this._createMouseTarget(e, testEventTarget), (e) => this._getMouseColumn(e)));\n this.lastMouseLeaveTime = -1;\n this._height = this._context.configuration.options.get(143 /* EditorOption.layoutInfo */).height;\n const mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);\n this._register(mouseEvents.onContextMenu(this.viewHelper.viewDomNode, (e) => this._onContextMenu(e, true)));\n this._register(mouseEvents.onMouseMove(this.viewHelper.viewDomNode, (e) => {\n this._onMouseMove(e);\n // See https://github.com/microsoft/vscode/issues/138789\n // When moving the mouse really quickly, the browser sometimes forgets to\n // send us a `mouseleave` or `mouseout` event. We therefore install here\n // a global `mousemove` listener to manually recover if the mouse goes outside\n // the editor. As soon as the mouse leaves outside of the editor, we\n // remove this listener\n if (!this._mouseLeaveMonitor) {\n this._mouseLeaveMonitor = dom.addDisposableListener(this.viewHelper.viewDomNode.ownerDocument, 'mousemove', (e) => {\n if (!this.viewHelper.viewDomNode.contains(e.target)) {\n // went outside the editor!\n this._onMouseLeave(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode));\n }\n });\n }\n }));\n this._register(mouseEvents.onMouseUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\n this._register(mouseEvents.onMouseLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\n // `pointerdown` events can't be used to determine if there's a double click, or triple click\n // because their `e.detail` is always 0.\n // We will therefore save the pointer id for the mouse and then reuse it in the `mousedown` event\n // for `element.setPointerCapture`.\n let capturePointerId = 0;\n this._register(mouseEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => {\n capturePointerId = pointerId;\n }));\n // The `pointerup` listener registered by `GlobalEditorPointerMoveMonitor` does not get invoked 100% of the times.\n // I speculate that this is because the `pointerup` listener is only registered during the `mousedown` event, and perhaps\n // the `pointerup` event is already queued for dispatching, which makes it that the new listener doesn't get fired.\n // See https://github.com/microsoft/vscode/issues/146486 for repro steps.\n // To compensate for that, we simply register here a `pointerup` listener and just communicate it.\n this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.POINTER_UP, (e) => {\n this._mouseDownOperation.onPointerUp();\n }));\n this._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e, capturePointerId)));\n this._setupMouseWheelZoomListener();\n this._context.addEventHandler(this);\n }\n _setupMouseWheelZoomListener() {\n const classifier = MouseWheelClassifier.INSTANCE;\n let prevMouseWheelTime = 0;\n let gestureStartZoomLevel = EditorZoom.getZoomLevel();\n let gestureHasZoomModifiers = false;\n let gestureAccumulatedDelta = 0;\n const onMouseWheel = (browserEvent) => {\n this.viewController.emitMouseWheel(browserEvent);\n if (!this._context.configuration.options.get(75 /* EditorOption.mouseWheelZoom */)) {\n return;\n }\n const e = new StandardWheelEvent(browserEvent);\n classifier.acceptStandardWheelEvent(e);\n if (classifier.isPhysicalMouseWheel()) {\n if (hasMouseWheelZoomModifiers(browserEvent)) {\n const zoomLevel = EditorZoom.getZoomLevel();\n const delta = e.deltaY > 0 ? 1 : -1;\n EditorZoom.setZoomLevel(zoomLevel + delta);\n e.preventDefault();\n e.stopPropagation();\n }\n }\n else {\n // we consider mousewheel events that occur within 50ms of each other to be part of the same gesture\n // we don't want to consider mouse wheel events where ctrl/cmd is pressed during the inertia phase\n // we also want to accumulate deltaY values from the same gesture and use that to set the zoom level\n if (Date.now() - prevMouseWheelTime > 50) {\n // reset if more than 50ms have passed\n gestureStartZoomLevel = EditorZoom.getZoomLevel();\n gestureHasZoomModifiers = hasMouseWheelZoomModifiers(browserEvent);\n gestureAccumulatedDelta = 0;\n }\n prevMouseWheelTime = Date.now();\n gestureAccumulatedDelta += e.deltaY;\n if (gestureHasZoomModifiers) {\n EditorZoom.setZoomLevel(gestureStartZoomLevel + gestureAccumulatedDelta / 5);\n e.preventDefault();\n e.stopPropagation();\n }\n }\n };\n this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false }));\n function hasMouseWheelZoomModifiers(browserEvent) {\n return (platform.isMacintosh\n // on macOS we support cmd + two fingers scroll (`metaKey` set)\n // and also the two fingers pinch gesture (`ctrKey` set)\n ? ((browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey)\n : (browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey));\n }\n }\n dispose() {\n this._context.removeEventHandler(this);\n if (this._mouseLeaveMonitor) {\n this._mouseLeaveMonitor.dispose();\n this._mouseLeaveMonitor = null;\n }\n super.dispose();\n }\n // --- begin event handlers\n onConfigurationChanged(e) {\n if (e.hasChanged(143 /* EditorOption.layoutInfo */)) {\n // layout change\n const height = this._context.configuration.options.get(143 /* EditorOption.layoutInfo */).height;\n if (this._height !== height) {\n this._height = height;\n this._mouseDownOperation.onHeightChanged();\n }\n }\n return false;\n }\n onCursorStateChanged(e) {\n this._mouseDownOperation.onCursorStateChanged(e);\n return false;\n }\n onFocusChanged(e) {\n return false;\n }\n // --- end event handlers\n getTargetAtClientPoint(clientX, clientY) {\n const clientPos = new ClientCoordinates(clientX, clientY);\n const pos = clientPos.toPageCoordinates(dom.getWindow(this.viewHelper.viewDomNode));\n const editorPos = createEditorPagePosition(this.viewHelper.viewDomNode);\n if (pos.y < editorPos.y || pos.y > editorPos.y + editorPos.height || pos.x < editorPos.x || pos.x > editorPos.x + editorPos.width) {\n return null;\n }\n const relativePos = createCoordinatesRelativeToEditor(this.viewHelper.viewDomNode, editorPos, pos);\n return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n }\n _createMouseTarget(e, testEventTarget) {\n let target = e.target;\n if (!this.viewHelper.viewDomNode.contains(target)) {\n const shadowRoot = dom.getShadowRoot(this.viewHelper.viewDomNode);\n if (shadowRoot) {\n target = shadowRoot.elementsFromPoint(e.posx, e.posy).find((el) => this.viewHelper.viewDomNode.contains(el));\n }\n }\n return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, e.relativePos, testEventTarget ? target : null);\n }\n _getMouseColumn(e) {\n return this.mouseTargetFactory.getMouseColumn(e.relativePos);\n }\n _onContextMenu(e, testEventTarget) {\n this.viewController.emitContextMenu({\n event: e,\n target: this._createMouseTarget(e, testEventTarget)\n });\n }\n _onMouseMove(e) {\n const targetIsWidget = this.mouseTargetFactory.mouseTargetIsWidget(e);\n if (!targetIsWidget) {\n e.preventDefault();\n }\n if (this._mouseDownOperation.isActive()) {\n // In selection/drag operation\n return;\n }\n const actualMouseMoveTime = e.timestamp;\n if (actualMouseMoveTime < this.lastMouseLeaveTime) {\n // Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.\n return;\n }\n this.viewController.emitMouseMove({\n event: e,\n target: this._createMouseTarget(e, true)\n });\n }\n _onMouseLeave(e) {\n if (this._mouseLeaveMonitor) {\n this._mouseLeaveMonitor.dispose();\n this._mouseLeaveMonitor = null;\n }\n this.lastMouseLeaveTime = (new Date()).getTime();\n this.viewController.emitMouseLeave({\n event: e,\n target: null\n });\n }\n _onMouseUp(e) {\n this.viewController.emitMouseUp({\n event: e,\n target: this._createMouseTarget(e, true)\n });\n }\n _onMouseDown(e, pointerId) {\n const t = this._createMouseTarget(e, true);\n const targetIsContent = (t.type === 6 /* MouseTargetType.CONTENT_TEXT */ || t.type === 7 /* MouseTargetType.CONTENT_EMPTY */);\n const targetIsGutter = (t.type === 2 /* MouseTargetType.GUTTER_GLYPH_MARGIN */ || t.type === 3 /* MouseTargetType.GUTTER_LINE_NUMBERS */ || t.type === 4 /* MouseTargetType.GUTTER_LINE_DECORATIONS */);\n const targetIsLineNumbers = (t.type === 3 /* MouseTargetType.GUTTER_LINE_NUMBERS */);\n const selectOnLineNumbers = this._context.configuration.options.get(108 /* EditorOption.selectOnLineNumbers */);\n const targetIsViewZone = (t.type === 8 /* MouseTargetType.CONTENT_VIEW_ZONE */ || t.type === 5 /* MouseTargetType.GUTTER_VIEW_ZONE */);\n const targetIsWidget = (t.type === 9 /* MouseTargetType.CONTENT_WIDGET */);\n let shouldHandle = e.leftButton || e.middleButton;\n if (platform.isMacintosh && e.leftButton && e.ctrlKey) {\n shouldHandle = false;\n }\n const focus = () => {\n e.preventDefault();\n this.viewHelper.focusTextArea();\n };\n if (shouldHandle && (targetIsContent || (targetIsLineNumbers && selectOnLineNumbers))) {\n focus();\n this._mouseDownOperation.start(t.type, e, pointerId);\n }\n else if (targetIsGutter) {\n // Do not steal focus\n e.preventDefault();\n }\n else if (targetIsViewZone) {\n const viewZoneData = t.detail;\n if (shouldHandle && this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {\n focus();\n this._mouseDownOperation.start(t.type, e, pointerId);\n e.preventDefault();\n }\n }\n else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)) {\n focus();\n e.preventDefault();\n }\n this.viewController.emitMouseDown({\n event: e,\n target: t\n });\n }\n _onMouseWheel(e) {\n this.viewController.emitMouseWheel(e);\n }\n}\nclass MouseDownOperation extends Disposable {\n constructor(_context, _viewController, _viewHelper, _mouseTargetFactory, createMouseTarget, getMouseColumn) {\n super();\n this._context = _context;\n this._viewController = _viewController;\n this._viewHelper = _viewHelper;\n this._mouseTargetFactory = _mouseTargetFactory;\n this._createMouseTarget = createMouseTarget;\n this._getMouseColumn = getMouseColumn;\n this._mouseMoveMonitor = this._register(new GlobalEditorPointerMoveMonitor(this._viewHelper.viewDomNode));\n this._topBottomDragScrolling = this._register(new TopBottomDragScrolling(this._context, this._viewHelper, this._mouseTargetFactory, (position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)));\n this._mouseState = new MouseDownState();\n this._currentSelection = new Selection(1, 1, 1, 1);\n this._isActive = false;\n this._lastMouseEvent = null;\n }\n dispose() {\n super.dispose();\n }\n isActive() {\n return this._isActive;\n }\n _onMouseDownThenMove(e) {\n this._lastMouseEvent = e;\n this._mouseState.setModifiers(e);\n const position = this._findMousePosition(e, false);\n if (!position) {\n // Ignoring because position is unknown\n return;\n }\n if (this._mouseState.isDragAndDrop) {\n this._viewController.emitMouseDrag({\n event: e,\n target: position\n });\n }\n else {\n if (position.type === 13 /* MouseTargetType.OUTSIDE_EDITOR */ && (position.outsidePosition === 'above' || position.outsidePosition === 'below')) {\n this._topBottomDragScrolling.start(position, e);\n }\n else {\n this._topBottomDragScrolling.stop();\n this._dispatchMouse(position, true, 1 /* NavigationCommandRevealType.Minimal */);\n }\n }\n }\n start(targetType, e, pointerId) {\n this._lastMouseEvent = e;\n this._mouseState.setStartedOnLineNumbers(targetType === 3 /* MouseTargetType.GUTTER_LINE_NUMBERS */);\n this._mouseState.setStartButtons(e);\n this._mouseState.setModifiers(e);\n const position = this._findMousePosition(e, true);\n if (!position || !position.position) {\n // Ignoring because position is unknown\n return;\n }\n this._mouseState.trySetCount(e.detail, position.position);\n // Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.\n e.detail = this._mouseState.count;\n const options = this._context.configuration.options;\n if (!options.get(90 /* EditorOption.readOnly */)\n && options.get(35 /* EditorOption.dragAndDrop */)\n && !options.get(22 /* EditorOption.columnSelection */)\n && !this._mouseState.altKey // we don't support multiple mouse\n && e.detail < 2 // only single click on a selection can work\n && !this._isActive // the mouse is not down yet\n && !this._currentSelection.isEmpty() // we don't drag single cursor\n && (position.type === 6 /* MouseTargetType.CONTENT_TEXT */) // single click on text\n && position.position && this._currentSelection.containsPosition(position.position) // single click on a selection\n ) {\n this._mouseState.isDragAndDrop = true;\n this._isActive = true;\n this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode, pointerId, e.buttons, (e) => this._onMouseDownThenMove(e), (browserEvent) => {\n const position = this._findMousePosition(this._lastMouseEvent, false);\n if (dom.isKeyboardEvent(browserEvent)) {\n // cancel\n this._viewController.emitMouseDropCanceled();\n }\n else {\n this._viewController.emitMouseDrop({\n event: this._lastMouseEvent,\n target: (position ? this._createMouseTarget(this._lastMouseEvent, true) : null) // Ignoring because position is unknown, e.g., Content View Zone\n });\n }\n this._stop();\n });\n return;\n }\n this._mouseState.isDragAndDrop = false;\n this._dispatchMouse(position, e.shiftKey, 1 /* NavigationCommandRevealType.Minimal */);\n if (!this._isActive) {\n this._isActive = true;\n this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode, pointerId, e.buttons, (e) => this._onMouseDownThenMove(e), () => this._stop());\n }\n }\n _stop() {\n this._isActive = false;\n this._topBottomDragScrolling.stop();\n }\n onHeightChanged() {\n this._mouseMoveMonitor.stopMonitoring();\n }\n onPointerUp() {\n this._mouseMoveMonitor.stopMonitoring();\n }\n onCursorStateChanged(e) {\n this._currentSelection = e.selections[0];\n }\n _getPositionOutsideEditor(e) {\n const editorContent = e.editorPos;\n const model = this._context.viewModel;\n const viewLayout = this._context.viewLayout;\n const mouseColumn = this._getMouseColumn(e);\n if (e.posy < editorContent.y) {\n const outsideDistance = editorContent.y - e.posy;\n const verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - outsideDistance, 0);\n const viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n if (viewZoneData) {\n const newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n if (newPosition) {\n return MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'above', outsideDistance);\n }\n }\n const aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n return MouseTarget.createOutsideEditor(mouseColumn, new Position(aboveLineNumber, 1), 'above', outsideDistance);\n }\n if (e.posy > editorContent.y + editorContent.height) {\n const outsideDistance = e.posy - editorContent.y - editorContent.height;\n const verticalOffset = viewLayout.getCurrentScrollTop() + e.relativePos.y;\n const viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\n if (viewZoneData) {\n const newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\n if (newPosition) {\n return MouseTarget.createOutsideEditor(mouseColumn, newPosition, 'below', outsideDistance);\n }\n }\n const belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\n return MouseTarget.createOutsideEditor(mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber)), 'below', outsideDistance);\n }\n const possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + e.relativePos.y);\n if (e.posx < editorContent.x) {\n const outsideDistance = editorContent.x - e.posx;\n return MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, 1), 'left', outsideDistance);\n }\n if (e.posx > editorContent.x + editorContent.width) {\n const outsideDistance = e.posx - editorContent.x - editorContent.width;\n return MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, model.getLineMaxColumn(possibleLineNumber)), 'right', outsideDistance);\n }\n return null;\n }\n _findMousePosition(e, testEventTarget) {\n const positionOutsideEditor = this._getPositionOutsideEditor(e);\n if (positionOutsideEditor) {\n return positionOutsideEditor;\n }\n const t = this._createMouseTarget(e, testEventTarget);\n const hintedPosition = t.position;\n if (!hintedPosition) {\n return null;\n }\n if (t.type === 8 /* MouseTargetType.CONTENT_VIEW_ZONE */ || t.type === 5 /* MouseTargetType.GUTTER_VIEW_ZONE */) {\n const newPosition = this._helpPositionJumpOverViewZone(t.detail);\n if (newPosition) {\n return MouseTarget.createViewZone(t.type, t.element, t.mouseColumn, newPosition, t.detail);\n }\n }\n return t;\n }\n _helpPositionJumpOverViewZone(viewZoneData) {\n // Force position on view zones to go above or below depending on where selection started from\n const selectionStart = new Position(this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);\n const positionBefore = viewZoneData.positionBefore;\n const positionAfter = viewZoneData.positionAfter;\n if (positionBefore && positionAfter) {\n if (positionBefore.isBefore(selectionStart)) {\n return positionBefore;\n }\n else {\n return positionAfter;\n }\n }\n return null;\n }\n _dispatchMouse(position, inSelectionMode, revealType) {\n if (!position.position) {\n return;\n }\n this._viewController.dispatchMouse({\n position: position.position,\n mouseColumn: position.mouseColumn,\n startedOnLineNumbers: this._mouseState.startedOnLineNumbers,\n revealType,\n inSelectionMode: inSelectionMode,\n mouseDownCount: this._mouseState.count,\n altKey: this._mouseState.altKey,\n ctrlKey: this._mouseState.ctrlKey,\n metaKey: this._mouseState.metaKey,\n shiftKey: this._mouseState.shiftKey,\n leftButton: this._mouseState.leftButton,\n middleButton: this._mouseState.middleButton,\n onInjectedText: position.type === 6 /* MouseTargetType.CONTENT_TEXT */ && position.detail.injectedText !== null\n });\n }\n}\nclass TopBottomDragScrolling extends Disposable {\n constructor(_context, _viewHelper, _mouseTargetFactory, _dispatchMouse) {\n super();\n this._context = _context;\n this._viewHelper = _viewHelper;\n this._mouseTargetFactory = _mouseTargetFactory;\n this._dispatchMouse = _dispatchMouse;\n this._operation = null;\n }\n dispose() {\n super.dispose();\n this.stop();\n }\n start(position, mouseEvent) {\n if (this._operation) {\n this._operation.setPosition(position, mouseEvent);\n }\n else {\n this._operation = new TopBottomDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);\n }\n }\n stop() {\n if (this._operation) {\n this._operation.dispose();\n this._operation = null;\n }\n }\n}\nclass TopBottomDragScrollingOperation extends Disposable {\n constructor(_context, _viewHelper, _mouseTargetFactory, _dispatchMouse, position, mouseEvent) {\n super();\n this._context = _context;\n this._viewHelper = _viewHelper;\n this._mouseTargetFactory = _mouseTargetFactory;\n this._dispatchMouse = _dispatchMouse;\n this._position = position;\n this._mouseEvent = mouseEvent;\n this._lastTime = Date.now();\n this._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseEvent.browserEvent), () => this._execute());\n }\n dispose() {\n this._animationFrameDisposable.dispose();\n }\n setPosition(position, mouseEvent) {\n this._position = position;\n this._mouseEvent = mouseEvent;\n }\n /**\n * update internal state and return elapsed ms since last time\n */\n _tick() {\n const now = Date.now();\n const elapsed = now - this._lastTime;\n this._lastTime = now;\n return elapsed;\n }\n /**\n * get the number of lines per second to auto-scroll\n */\n _getScrollSpeed() {\n const lineHeight = this._context.configuration.options.get(66 /* EditorOption.lineHeight */);\n const viewportInLines = this._context.configuration.options.get(143 /* EditorOption.layoutInfo */).height / lineHeight;\n const outsideDistanceInLines = this._position.outsideDistance / lineHeight;\n if (outsideDistanceInLines <= 1.5) {\n return Math.max(30, viewportInLines * (1 + outsideDistanceInLines));\n }\n if (outsideDistanceInLines <= 3) {\n return Math.max(60, viewportInLines * (2 + outsideDistanceInLines));\n }\n return Math.max(200, viewportInLines * (7 + outsideDistanceInLines));\n }\n _execute() {\n const lineHeight = this._context.configuration.options.get(66 /* EditorOption.lineHeight */);\n const scrollSpeedInLines = this._getScrollSpeed();\n const elapsed = this._tick();\n const scrollInPixels = scrollSpeedInLines * (elapsed / 1000) * lineHeight;\n const scrollValue = (this._position.outsidePosition === 'above' ? -scrollInPixels : scrollInPixels);\n this._context.viewModel.viewLayout.deltaScrollNow(0, scrollValue);\n this._viewHelper.renderNow();\n const viewportData = this._context.viewLayout.getLinesViewportData();\n const edgeLineNumber = (this._position.outsidePosition === 'above' ? viewportData.startLineNumber : viewportData.endLineNumber);\n // First, try to find a position that matches the horizontal position of the mouse\n let mouseTarget;\n {\n const editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);\n const horizontalScrollbarHeight = this._context.configuration.options.get(143 /* EditorOption.layoutInfo */).horizontalScrollbarHeight;\n const pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);\n const relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);\n mouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);\n }\n if (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber) {\n if (this._position.outsidePosition === 'above') {\n mouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, 1), 'above', this._position.outsideDistance);\n }\n else {\n mouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, this._context.viewModel.getLineMaxColumn(edgeLineNumber)), 'below', this._position.outsideDistance);\n }\n }\n this._dispatchMouse(mouseTarget, true, 2 /* NavigationCommandRevealType.None */);\n this._animationFrameDisposable = dom.scheduleAtNextAnimationFrame(dom.getWindow(mouseTarget.element), () => this._execute());\n }\n}\nclass MouseDownState {\n get altKey() { return this._altKey; }\n get ctrlKey() { return this._ctrlKey; }\n get metaKey() { return this._metaKey; }\n get shiftKey() { return this._shiftKey; }\n get leftButton() { return this._leftButton; }\n get middleButton() { return this._middleButton; }\n get startedOnLineNumbers() { return this._startedOnLineNumbers; }\n constructor() {\n this._altKey = false;\n this._ctrlKey = false;\n this._metaKey = false;\n this._shiftKey = false;\n this._leftButton = false;\n this._middleButton = false;\n this._startedOnLineNumbers = false;\n this._lastMouseDownPosition = null;\n this._lastMouseDownPositionEqualCount = 0;\n this._lastMouseDownCount = 0;\n this._lastSetMouseDownCountTime = 0;\n this.isDragAndDrop = false;\n }\n get count() {\n return this._lastMouseDownCount;\n }\n setModifiers(source) {\n this._altKey = source.altKey;\n this._ctrlKey = source.ctrlKey;\n this._metaKey = source.metaKey;\n this._shiftKey = source.shiftKey;\n }\n setStartButtons(source) {\n this._leftButton = source.leftButton;\n this._middleButton = source.middleButton;\n }\n setStartedOnLineNumbers(startedOnLineNumbers) {\n this._startedOnLineNumbers = startedOnLineNumbers;\n }\n trySetCount(setMouseDownCount, newMouseDownPosition) {\n // a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n const currentTime = (new Date()).getTime();\n if (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {\n setMouseDownCount = 1;\n }\n this._lastSetMouseDownCountTime = currentTime;\n // b. Ensure that we don't jump from single click to triple click in one go (will be hit by IE because the detail field of mouse events contains garbage in IE10)\n if (setMouseDownCount > this._lastMouseDownCount + 1) {\n setMouseDownCount = this._lastMouseDownCount + 1;\n }\n // c. Invalidate multiple clicking if the logical position is different\n if (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {\n this._lastMouseDownPositionEqualCount++;\n }\n else {\n this._lastMouseDownPositionEqualCount = 1;\n }\n this._lastMouseDownPosition = newMouseDownPosition;\n // Finally set the lastMouseDownCount\n this._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);\n }\n}\nMouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME = 400; // ms\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../common/event.js';\nexport class DomEmitter {\n get event() {\n return this.emitter.event;\n }\n constructor(element, type, useCapture) {\n const fn = (e) => this.emitter.fire(e);\n this.emitter = new Emitter({\n onWillAddFirstListener: () => element.addEventListener(type, fn, useCapture),\n onDidRemoveLastListener: () => element.removeEventListener(type, fn, useCapture)\n });\n }\n dispose() {\n this.emitter.dispose();\n }\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 *--------------------------------------------------------------------------------------------*/\nexport var inputLatency;\n(function (inputLatency) {\n const totalKeydownTime = { total: 0, min: Number.MAX_VALUE, max: 0 };\n const totalInputTime = { ...totalKeydownTime };\n const totalRenderTime = { ...totalKeydownTime };\n const totalInputLatencyTime = { ...totalKeydownTime };\n let measurementsCount = 0;\n const state = {\n keydown: 0 /* EventPhase.Before */,\n input: 0 /* EventPhase.Before */,\n render: 0 /* EventPhase.Before */,\n };\n /**\n * Record the start of the keydown event.\n */\n function onKeyDown() {\n /** Direct Check C. See explanation in {@link recordIfFinished} */\n recordIfFinished();\n performance.mark('inputlatency/start');\n performance.mark('keydown/start');\n state.keydown = 1 /* EventPhase.InProgress */;\n queueMicrotask(markKeyDownEnd);\n }\n inputLatency.onKeyDown = onKeyDown;\n /**\n * Mark the end of the keydown event.\n */\n function markKeyDownEnd() {\n if (state.keydown === 1 /* EventPhase.InProgress */) {\n performance.mark('keydown/end');\n state.keydown = 2 /* EventPhase.Finished */;\n }\n }\n /**\n * Record the start of the beforeinput event.\n */\n function onBeforeInput() {\n performance.mark('input/start');\n state.input = 1 /* EventPhase.InProgress */;\n /** Schedule Task A. See explanation in {@link recordIfFinished} */\n scheduleRecordIfFinishedTask();\n }\n inputLatency.onBeforeInput = onBeforeInput;\n /**\n * Record the start of the input event.\n */\n function onInput() {\n if (state.input === 0 /* EventPhase.Before */) {\n // it looks like we didn't receive a `beforeinput`\n onBeforeInput();\n }\n queueMicrotask(markInputEnd);\n }\n inputLatency.onInput = onInput;\n function markInputEnd() {\n if (state.input === 1 /* EventPhase.InProgress */) {\n performance.mark('input/end');\n state.input = 2 /* EventPhase.Finished */;\n }\n }\n /**\n * Record the start of the keyup event.\n */\n function onKeyUp() {\n /** Direct Check D. See explanation in {@link recordIfFinished} */\n recordIfFinished();\n }\n inputLatency.onKeyUp = onKeyUp;\n /**\n * Record the start of the selectionchange event.\n */\n function onSelectionChange() {\n /** Direct Check E. See explanation in {@link recordIfFinished} */\n recordIfFinished();\n }\n inputLatency.onSelectionChange = onSelectionChange;\n /**\n * Record the start of the animation frame performing the rendering.\n */\n function onRenderStart() {\n // Render may be triggered during input, but we only measure the following animation frame\n if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 0 /* EventPhase.Before */) {\n // Only measure the first render after keyboard input\n performance.mark('render/start');\n state.render = 1 /* EventPhase.InProgress */;\n queueMicrotask(markRenderEnd);\n /** Schedule Task B. See explanation in {@link recordIfFinished} */\n scheduleRecordIfFinishedTask();\n }\n }\n inputLatency.onRenderStart = onRenderStart;\n /**\n * Mark the end of the animation frame performing the rendering.\n */\n function markRenderEnd() {\n if (state.render === 1 /* EventPhase.InProgress */) {\n performance.mark('render/end');\n state.render = 2 /* EventPhase.Finished */;\n }\n }\n function scheduleRecordIfFinishedTask() {\n // Here we can safely assume that the `setTimeout` will not be\n // artificially delayed by 4ms because we schedule it from\n // event handlers\n setTimeout(recordIfFinished);\n }\n /**\n * Record the input latency sample if input handling and rendering are finished.\n *\n * The challenge here is that we want to record the latency in such a way that it includes\n * also the layout and painting work the browser does during the animation frame task.\n *\n * Simply scheduling a new task (via `setTimeout`) from the animation frame task would\n * schedule the new task at the end of the task queue (after other code that uses `setTimeout`),\n * so we need to use multiple strategies to make sure our task runs before others:\n *\n * We schedule tasks (A and B):\n * - we schedule a task A (via a `setTimeout` call) when the input starts in `markInputStart`.\n * If the animation frame task is scheduled quickly by the browser, then task A has a very good\n * chance of being the very first task after the animation frame and thus will record the input latency.\n * - however, if the animation frame task is scheduled a bit later, then task A might execute\n * before the animation frame task. We therefore schedule another task B from `markRenderStart`.\n *\n * We do direct checks in browser event handlers (C, D, E):\n * - if the browser has multiple keydown events queued up, they will be scheduled before the `setTimeout` tasks,\n * so we do a direct check in the keydown event handler (C).\n * - depending on timing, sometimes the animation frame is scheduled even before the `keyup` event, so we\n * do a direct check there too (E).\n * - the browser oftentimes emits a `selectionchange` event after an `input`, so we do a direct check there (D).\n */\n function recordIfFinished() {\n if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 2 /* EventPhase.Finished */) {\n performance.mark('inputlatency/end');\n performance.measure('keydown', 'keydown/start', 'keydown/end');\n performance.measure('input', 'input/start', 'input/end');\n performance.measure('render', 'render/start', 'render/end');\n performance.measure('inputlatency', 'inputlatency/start', 'inputlatency/end');\n addMeasure('keydown', totalKeydownTime);\n addMeasure('input', totalInputTime);\n addMeasure('render', totalRenderTime);\n addMeasure('inputlatency', totalInputLatencyTime);\n // console.info(\n // \t`input latency=${performance.getEntriesByName('inputlatency')[0].duration.toFixed(1)} [` +\n // \t`keydown=${performance.getEntriesByName('keydown')[0].duration.toFixed(1)}, ` +\n // \t`input=${performance.getEntriesByName('input')[0].duration.toFixed(1)}, ` +\n // \t`render=${performance.getEntriesByName('render')[0].duration.toFixed(1)}` +\n // \t`]`\n // );\n measurementsCount++;\n reset();\n }\n }\n function addMeasure(entryName, cumulativeMeasurement) {\n const duration = performance.getEntriesByName(entryName)[0].duration;\n cumulativeMeasurement.total += duration;\n cumulativeMeasurement.min = Math.min(cumulativeMeasurement.min, duration);\n cumulativeMeasurement.max = Math.max(cumulativeMeasurement.max, duration);\n }\n /**\n * Clear the current sample.\n */\n function reset() {\n performance.clearMarks('keydown/start');\n performance.clearMarks('keydown/end');\n performance.clearMarks('input/start');\n performance.clearMarks('input/end');\n performance.clearMarks('render/start');\n performance.clearMarks('render/end');\n performance.clearMarks('inputlatency/start');\n performance.clearMarks('inputlatency/end');\n performance.clearMeasures('keydown');\n performance.clearMeasures('input');\n performance.clearMeasures('render');\n performance.clearMeasures('inputlatency');\n state.keydown = 0 /* EventPhase.Before */;\n state.input = 0 /* EventPhase.Before */;\n state.render = 0 /* EventPhase.Before */;\n }\n /**\n * Gets all input latency samples and clears the internal buffers to start recording a new set\n * of samples.\n */\n function getAndClearMeasurements() {\n if (measurementsCount === 0) {\n return undefined;\n }\n // Assemble the result\n const result = {\n keydown: cumulativeToFinalMeasurement(totalKeydownTime),\n input: cumulativeToFinalMeasurement(totalInputTime),\n render: cumulativeToFinalMeasurement(totalRenderTime),\n total: cumulativeToFinalMeasurement(totalInputLatencyTime),\n sampleCount: measurementsCount\n };\n // Clear the cumulative measurements\n clearCumulativeMeasurement(totalKeydownTime);\n clearCumulativeMeasurement(totalInputTime);\n clearCumulativeMeasurement(totalRenderTime);\n clearCumulativeMeasurement(totalInputLatencyTime);\n measurementsCount = 0;\n return result;\n }\n inputLatency.getAndClearMeasurements = getAndClearMeasurements;\n function cumulativeToFinalMeasurement(cumulative) {\n return {\n average: cumulative.total / measurementsCount,\n max: cumulative.max,\n min: cumulative.min,\n };\n }\n function clearCumulativeMeasurement(cumulative) {\n cumulative.total = 0;\n cumulative.min = Number.MAX_VALUE;\n cumulative.max = 0;\n }\n})(inputLatency || (inputLatency = {}));\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport { Range } from '../../common/core/range.js';\nexport const _debugComposition = false;\nexport class TextAreaState {\n constructor(value, \n /** the offset where selection starts inside `value` */\n selectionStart, \n /** the offset where selection ends inside `value` */\n selectionEnd, \n /** the editor range in the view coordinate system that matches the selection inside `value` */\n selection, \n /** the visible line count (wrapped, not necessarily matching \\n characters) for the text in `value` before `selectionStart` */\n newlineCountBeforeSelection) {\n this.value = value;\n this.selectionStart = selectionStart;\n this.selectionEnd = selectionEnd;\n this.selection = selection;\n this.newlineCountBeforeSelection = newlineCountBeforeSelection;\n }\n toString() {\n return `[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`;\n }\n static readFromTextArea(textArea, previousState) {\n const value = textArea.getValue();\n const selectionStart = textArea.getSelectionStart();\n const selectionEnd = textArea.getSelectionEnd();\n let newlineCountBeforeSelection = undefined;\n if (previousState) {\n const valueBeforeSelectionStart = value.substring(0, selectionStart);\n const previousValueBeforeSelectionStart = previousState.value.substring(0, previousState.selectionStart);\n if (valueBeforeSelectionStart === previousValueBeforeSelectionStart) {\n newlineCountBeforeSelection = previousState.newlineCountBeforeSelection;\n }\n }\n return new TextAreaState(value, selectionStart, selectionEnd, null, newlineCountBeforeSelection);\n }\n collapseSelection() {\n if (this.selectionStart === this.value.length) {\n return this;\n }\n return new TextAreaState(this.value, this.value.length, this.value.length, null, undefined);\n }\n writeToTextArea(reason, textArea, select) {\n if (_debugComposition) {\n console.log(`writeToTextArea ${reason}: ${this.toString()}`);\n }\n textArea.setValue(reason, this.value);\n if (select) {\n textArea.setSelectionRange(reason, this.selectionStart, this.selectionEnd);\n }\n }\n deduceEditorPosition(offset) {\n if (offset <= this.selectionStart) {\n const str = this.value.substring(offset, this.selectionStart);\n return this._finishDeduceEditorPosition(this.selection?.getStartPosition() ?? null, str, -1);\n }\n if (offset >= this.selectionEnd) {\n const str = this.value.substring(this.selectionEnd, offset);\n return this._finishDeduceEditorPosition(this.selection?.getEndPosition() ?? null, str, 1);\n }\n const str1 = this.value.substring(this.selectionStart, offset);\n if (str1.indexOf(String.fromCharCode(8230)) === -1) {\n return this._finishDeduceEditorPosition(this.selection?.getStartPosition() ?? null, str1, 1);\n }\n const str2 = this.value.substring(offset, this.selectionEnd);\n return this._finishDeduceEditorPosition(this.selection?.getEndPosition() ?? null, str2, -1);\n }\n _finishDeduceEditorPosition(anchor, deltaText, signum) {\n let lineFeedCnt = 0;\n let lastLineFeedIndex = -1;\n while ((lastLineFeedIndex = deltaText.indexOf('\\n', lastLineFeedIndex + 1)) !== -1) {\n lineFeedCnt++;\n }\n return [anchor, signum * deltaText.length, lineFeedCnt];\n }\n static deduceInput(previousState, currentState, couldBeEmojiInput) {\n if (!previousState) {\n // This is the EMPTY state\n return {\n text: '',\n replacePrevCharCnt: 0,\n replaceNextCharCnt: 0,\n positionDelta: 0\n };\n }\n if (_debugComposition) {\n console.log('------------------------deduceInput');\n console.log(`PREVIOUS STATE: ${previousState.toString()}`);\n console.log(`CURRENT STATE: ${currentState.toString()}`);\n }\n const prefixLength = Math.min(strings.commonPrefixLength(previousState.value, currentState.value), previousState.selectionStart, currentState.selectionStart);\n const suffixLength = Math.min(strings.commonSuffixLength(previousState.value, currentState.value), previousState.value.length - previousState.selectionEnd, currentState.value.length - currentState.selectionEnd);\n const previousValue = previousState.value.substring(prefixLength, previousState.value.length - suffixLength);\n const currentValue = currentState.value.substring(prefixLength, currentState.value.length - suffixLength);\n const previousSelectionStart = previousState.selectionStart - prefixLength;\n const previousSelectionEnd = previousState.selectionEnd - prefixLength;\n const currentSelectionStart = currentState.selectionStart - prefixLength;\n const currentSelectionEnd = currentState.selectionEnd - prefixLength;\n if (_debugComposition) {\n console.log(`AFTER DIFFING PREVIOUS STATE: <${previousValue}>, selectionStart: ${previousSelectionStart}, selectionEnd: ${previousSelectionEnd}`);\n console.log(`AFTER DIFFING CURRENT STATE: <${currentValue}>, selectionStart: ${currentSelectionStart}, selectionEnd: ${currentSelectionEnd}`);\n }\n if (currentSelectionStart === currentSelectionEnd) {\n // no current selection\n const replacePreviousCharacters = (previousState.selectionStart - prefixLength);\n if (_debugComposition) {\n console.log(`REMOVE PREVIOUS: ${replacePreviousCharacters} chars`);\n }\n return {\n text: currentValue,\n replacePrevCharCnt: replacePreviousCharacters,\n replaceNextCharCnt: 0,\n positionDelta: 0\n };\n }\n // there is a current selection => composition case\n const replacePreviousCharacters = previousSelectionEnd - previousSelectionStart;\n return {\n text: currentValue,\n replacePrevCharCnt: replacePreviousCharacters,\n replaceNextCharCnt: 0,\n positionDelta: 0\n };\n }\n static deduceAndroidCompositionInput(previousState, currentState) {\n if (!previousState) {\n // This is the EMPTY state\n return {\n text: '',\n replacePrevCharCnt: 0,\n replaceNextCharCnt: 0,\n positionDelta: 0\n };\n }\n if (_debugComposition) {\n console.log('------------------------deduceAndroidCompositionInput');\n console.log(`PREVIOUS STATE: ${previousState.toString()}`);\n console.log(`CURRENT STATE: ${currentState.toString()}`);\n }\n if (previousState.value === currentState.value) {\n return {\n text: '',\n replacePrevCharCnt: 0,\n replaceNextCharCnt: 0,\n positionDelta: currentState.selectionEnd - previousState.selectionEnd\n };\n }\n const prefixLength = Math.min(strings.commonPrefixLength(previousState.value, currentState.value), previousState.selectionEnd);\n const suffixLength = Math.min(strings.commonSuffixLength(previousState.value, currentState.value), previousState.value.length - previousState.selectionEnd);\n const previousValue = previousState.value.substring(prefixLength, previousState.value.length - suffixLength);\n const currentValue = currentState.value.substring(prefixLength, currentState.value.length - suffixLength);\n const previousSelectionStart = previousState.selectionStart - prefixLength;\n const previousSelectionEnd = previousState.selectionEnd - prefixLength;\n const currentSelectionStart = currentState.selectionStart - prefixLength;\n const currentSelectionEnd = currentState.selectionEnd - prefixLength;\n if (_debugComposition) {\n console.log(`AFTER DIFFING PREVIOUS STATE: <${previousValue}>, selectionStart: ${previousSelectionStart}, selectionEnd: ${previousSelectionEnd}`);\n console.log(`AFTER DIFFING CURRENT STATE: <${currentValue}>, selectionStart: ${currentSelectionStart}, selectionEnd: ${currentSelectionEnd}`);\n }\n return {\n text: currentValue,\n replacePrevCharCnt: previousSelectionEnd,\n replaceNextCharCnt: previousValue.length - previousSelectionEnd,\n positionDelta: currentSelectionEnd - currentValue.length\n };\n }\n}\nTextAreaState.EMPTY = new TextAreaState('', 0, 0, null, undefined);\nexport class PagedScreenReaderStrategy {\n static _getPageOfLine(lineNumber, linesPerPage) {\n return Math.floor((lineNumber - 1) / linesPerPage);\n }\n static _getRangeForPage(page, linesPerPage) {\n const offset = page * linesPerPage;\n const startLineNumber = offset + 1;\n const endLineNumber = offset + linesPerPage;\n return new Range(startLineNumber, 1, endLineNumber + 1, 1);\n }\n static fromEditorSelection(model, selection, linesPerPage, trimLongText) {\n // Chromium handles very poorly text even of a few thousand chars\n // Cut text to avoid stalling the entire UI\n const LIMIT_CHARS = 500;\n const selectionStartPage = PagedScreenReaderStrategy._getPageOfLine(selection.startLineNumber, linesPerPage);\n const selectionStartPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionStartPage, linesPerPage);\n const selectionEndPage = PagedScreenReaderStrategy._getPageOfLine(selection.endLineNumber, linesPerPage);\n const selectionEndPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionEndPage, linesPerPage);\n let pretextRange = selectionStartPageRange.intersectRanges(new Range(1, 1, selection.startLineNumber, selection.startColumn));\n if (trimLongText && model.getValueLengthInRange(pretextRange, 1 /* EndOfLinePreference.LF */) > LIMIT_CHARS) {\n const pretextStart = model.modifyPosition(pretextRange.getEndPosition(), -LIMIT_CHARS);\n pretextRange = Range.fromPositions(pretextStart, pretextRange.getEndPosition());\n }\n const pretext = model.getValueInRange(pretextRange, 1 /* EndOfLinePreference.LF */);\n const lastLine = model.getLineCount();\n const lastLineMaxColumn = model.getLineMaxColumn(lastLine);\n let posttextRange = selectionEndPageRange.intersectRanges(new Range(selection.endLineNumber, selection.endColumn, lastLine, lastLineMaxColumn));\n if (trimLongText && model.getValueLengthInRange(posttextRange, 1 /* EndOfLinePreference.LF */) > LIMIT_CHARS) {\n const posttextEnd = model.modifyPosition(posttextRange.getStartPosition(), LIMIT_CHARS);\n posttextRange = Range.fromPositions(posttextRange.getStartPosition(), posttextEnd);\n }\n const posttext = model.getValueInRange(posttextRange, 1 /* EndOfLinePreference.LF */);\n let text;\n if (selectionStartPage === selectionEndPage || selectionStartPage + 1 === selectionEndPage) {\n // take full selection\n text = model.getValueInRange(selection, 1 /* EndOfLinePreference.LF */);\n }\n else {\n const selectionRange1 = selectionStartPageRange.intersectRanges(selection);\n const selectionRange2 = selectionEndPageRange.intersectRanges(selection);\n text = (model.getValueInRange(selectionRange1, 1 /* EndOfLinePreference.LF */)\n + String.fromCharCode(8230)\n + model.getValueInRange(selectionRange2, 1 /* EndOfLinePreference.LF */));\n }\n if (trimLongText && text.length > 2 * LIMIT_CHARS) {\n text = text.substring(0, LIMIT_CHARS) + String.fromCharCode(8230) + text.substring(text.length - LIMIT_CHARS, text.length);\n }\n return new TextAreaState(pretext + text + posttext, pretext.length, pretext.length + text.length, selection, pretextRange.endLineNumber - pretextRange.startLineNumber);\n }\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport * as browser from '../../../base/browser/browser.js';\nimport * as dom from '../../../base/browser/dom.js';\nimport { DomEmitter } from '../../../base/browser/event.js';\nimport { StandardKeyboardEvent } from '../../../base/browser/keyboardEvent.js';\nimport { inputLatency } from '../../../base/browser/performance.js';\nimport { RunOnceScheduler } from '../../../base/common/async.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable, MutableDisposable } from '../../../base/common/lifecycle.js';\nimport { Mimes } from '../../../base/common/mime.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { TextAreaState, _debugComposition } from './textAreaState.js';\nimport { Selection } from '../../common/core/selection.js';\nimport { IAccessibilityService } from '../../../platform/accessibility/common/accessibility.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nexport var TextAreaSyntethicEvents;\n(function (TextAreaSyntethicEvents) {\n TextAreaSyntethicEvents.Tap = '-monaco-textarea-synthetic-tap';\n})(TextAreaSyntethicEvents || (TextAreaSyntethicEvents = {}));\nexport const CopyOptions = {\n forceCopyWithSyntaxHighlighting: false\n};\n/**\n * Every time we write to the clipboard, we record a bit of extra metadata here.\n * Every time we read from the cipboard, if the text matches our last written text,\n * we can fetch the previous metadata.\n */\nexport class InMemoryClipboardMetadataManager {\n constructor() {\n this._lastState = null;\n }\n set(lastCopiedValue, data) {\n this._lastState = { lastCopiedValue, data };\n }\n get(pastedText) {\n if (this._lastState && this._lastState.lastCopiedValue === pastedText) {\n // match!\n return this._lastState.data;\n }\n this._lastState = null;\n return null;\n }\n}\nInMemoryClipboardMetadataManager.INSTANCE = new InMemoryClipboardMetadataManager();\nclass CompositionContext {\n constructor() {\n this._lastTypeTextLength = 0;\n }\n handleCompositionUpdate(text) {\n text = text || '';\n const typeInput = {\n text: text,\n replacePrevCharCnt: this._lastTypeTextLength,\n replaceNextCharCnt: 0,\n positionDelta: 0\n };\n this._lastTypeTextLength = text.length;\n return typeInput;\n }\n}\n/**\n * Writes screen reader content to the textarea and is able to analyze its input events to generate:\n * - onCut\n * - onPaste\n * - onType\n *\n * Composition events are generated for presentation purposes (composition input is reflected in onType).\n */\nlet TextAreaInput = class TextAreaInput extends Disposable {\n get textAreaState() {\n return this._textAreaState;\n }\n constructor(_host, _textArea, _OS, _browser, _accessibilityService, _logService) {\n super();\n this._host = _host;\n this._textArea = _textArea;\n this._OS = _OS;\n this._browser = _browser;\n this._accessibilityService = _accessibilityService;\n this._logService = _logService;\n this._onFocus = this._register(new Emitter());\n this.onFocus = this._onFocus.event;\n this._onBlur = this._register(new Emitter());\n this.onBlur = this._onBlur.event;\n this._onKeyDown = this._register(new Emitter());\n this.onKeyDown = this._onKeyDown.event;\n this._onKeyUp = this._register(new Emitter());\n this.onKeyUp = this._onKeyUp.event;\n this._onCut = this._register(new Emitter());\n this.onCut = this._onCut.event;\n this._onPaste = this._register(new Emitter());\n this.onPaste = this._onPaste.event;\n this._onType = this._register(new Emitter());\n this.onType = this._onType.event;\n this._onCompositionStart = this._register(new Emitter());\n this.onCompositionStart = this._onCompositionStart.event;\n this._onCompositionUpdate = this._register(new Emitter());\n this.onCompositionUpdate = this._onCompositionUpdate.event;\n this._onCompositionEnd = this._register(new Emitter());\n this.onCompositionEnd = this._onCompositionEnd.event;\n this._onSelectionChangeRequest = this._register(new Emitter());\n this.onSelectionChangeRequest = this._onSelectionChangeRequest.event;\n this._asyncFocusGainWriteScreenReaderContent = this._register(new MutableDisposable());\n this._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));\n this._textAreaState = TextAreaState.EMPTY;\n this._selectionChangeListener = null;\n if (this._accessibilityService.isScreenReaderOptimized()) {\n this.writeNativeTextAreaContent('ctor');\n }\n this._register(Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized, () => {\n if (this._accessibilityService.isScreenReaderOptimized() && !this._asyncFocusGainWriteScreenReaderContent.value) {\n this._asyncFocusGainWriteScreenReaderContent.value = this._register(new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0));\n }\n else {\n this._asyncFocusGainWriteScreenReaderContent.clear();\n }\n }));\n this._hasFocus = false;\n this._currentComposition = null;\n let lastKeyDown = null;\n this._register(this._textArea.onKeyDown((_e) => {\n const e = new StandardKeyboardEvent(_e);\n if (e.keyCode === 114 /* KeyCode.KEY_IN_COMPOSITION */\n || (this._currentComposition && e.keyCode === 1 /* KeyCode.Backspace */)) {\n // Stop propagation for keyDown events if the IME is processing key input\n e.stopPropagation();\n }\n if (e.equals(9 /* KeyCode.Escape */)) {\n // Prevent default always for `Esc`, otherwise it will generate a keypress\n // See https://msdn.microsoft.com/en-us/library/ie/ms536939(v=vs.85).aspx\n e.preventDefault();\n }\n lastKeyDown = e;\n this._onKeyDown.fire(e);\n }));\n this._register(this._textArea.onKeyUp((_e) => {\n const e = new StandardKeyboardEvent(_e);\n this._onKeyUp.fire(e);\n }));\n this._register(this._textArea.onCompositionStart((e) => {\n if (_debugComposition) {\n console.log(`[compositionstart]`, e);\n }\n const currentComposition = new CompositionContext();\n if (this._currentComposition) {\n // simply reset the composition context\n this._currentComposition = currentComposition;\n return;\n }\n this._currentComposition = currentComposition;\n if (this._OS === 2 /* OperatingSystem.Macintosh */\n && lastKeyDown\n && lastKeyDown.equals(114 /* KeyCode.KEY_IN_COMPOSITION */)\n && this._textAreaState.selectionStart === this._textAreaState.selectionEnd\n && this._textAreaState.selectionStart > 0\n && this._textAreaState.value.substr(this._textAreaState.selectionStart - 1, 1) === e.data\n && (lastKeyDown.code === 'ArrowRight' || lastKeyDown.code === 'ArrowLeft')) {\n // Handling long press case on Chromium/Safari macOS + arrow key => pretend the character was selected\n if (_debugComposition) {\n console.log(`[compositionstart] Handling long press case on macOS + arrow key`, e);\n }\n // Pretend the previous character was composed (in order to get it removed by subsequent compositionupdate events)\n currentComposition.handleCompositionUpdate('x');\n this._onCompositionStart.fire({ data: e.data });\n return;\n }\n if (this._browser.isAndroid) {\n // when tapping on the editor, Android enters composition mode to edit the current word\n // so we cannot clear the textarea on Android and we must pretend the current word was selected\n this._onCompositionStart.fire({ data: e.data });\n return;\n }\n this._onCompositionStart.fire({ data: e.data });\n }));\n this._register(this._textArea.onCompositionUpdate((e) => {\n if (_debugComposition) {\n console.log(`[compositionupdate]`, e);\n }\n const currentComposition = this._currentComposition;\n if (!currentComposition) {\n // should not be possible to receive a 'compositionupdate' without a 'compositionstart'\n return;\n }\n if (this._browser.isAndroid) {\n // On Android, the data sent with the composition update event is unusable.\n // For example, if the cursor is in the middle of a word like Mic|osoft\n // and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n // This is not really usable because it doesn't tell us where the edit began and where it ended.\n const newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n const typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n this._textAreaState = newState;\n this._onType.fire(typeInput);\n this._onCompositionUpdate.fire(e);\n return;\n }\n const typeInput = currentComposition.handleCompositionUpdate(e.data);\n this._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n this._onType.fire(typeInput);\n this._onCompositionUpdate.fire(e);\n }));\n this._register(this._textArea.onCompositionEnd((e) => {\n if (_debugComposition) {\n console.log(`[compositionend]`, e);\n }\n const currentComposition = this._currentComposition;\n if (!currentComposition) {\n // https://github.com/microsoft/monaco-editor/issues/1663\n // On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data\n return;\n }\n this._currentComposition = null;\n if (this._browser.isAndroid) {\n // On Android, the data sent with the composition update event is unusable.\n // For example, if the cursor is in the middle of a word like Mic|osoft\n // and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\n // This is not really usable because it doesn't tell us where the edit began and where it ended.\n const newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n const typeInput = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);\n this._textAreaState = newState;\n this._onType.fire(typeInput);\n this._onCompositionEnd.fire();\n return;\n }\n const typeInput = currentComposition.handleCompositionUpdate(e.data);\n this._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n this._onType.fire(typeInput);\n this._onCompositionEnd.fire();\n }));\n this._register(this._textArea.onInput((e) => {\n if (_debugComposition) {\n console.log(`[input]`, e);\n }\n // Pretend here we touched the text area, as the `input` event will most likely\n // result in a `selectionchange` event which we want to ignore\n this._textArea.setIgnoreSelectionChangeTime('received input event');\n if (this._currentComposition) {\n return;\n }\n const newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);\n const typeInput = TextAreaState.deduceInput(this._textAreaState, newState, /*couldBeEmojiInput*/ this._OS === 2 /* OperatingSystem.Macintosh */);\n if (typeInput.replacePrevCharCnt === 0 && typeInput.text.length === 1) {\n // one character was typed\n if (strings.isHighSurrogate(typeInput.text.charCodeAt(0))\n || typeInput.text.charCodeAt(0) === 0x7f /* Delete */) {\n // Ignore invalid input but keep it around for next time\n return;\n }\n }\n this._textAreaState = newState;\n if (typeInput.text !== ''\n || typeInput.replacePrevCharCnt !== 0\n || typeInput.replaceNextCharCnt !== 0\n || typeInput.positionDelta !== 0) {\n this._onType.fire(typeInput);\n }\n }));\n // --- Clipboard operations\n this._register(this._textArea.onCut((e) => {\n // Pretend here we touched the text area, as the `cut` event will most likely\n // result in a `selectionchange` event which we want to ignore\n this._textArea.setIgnoreSelectionChangeTime('received cut event');\n this._ensureClipboardGetsEditorSelection(e);\n this._asyncTriggerCut.schedule();\n }));\n this._register(this._textArea.onCopy((e) => {\n this._ensureClipboardGetsEditorSelection(e);\n }));\n this._register(this._textArea.onPaste((e) => {\n // Pretend here we touched the text area, as the `paste` event will most likely\n // result in a `selectionchange` event which we want to ignore\n this._textArea.setIgnoreSelectionChangeTime('received paste event');\n e.preventDefault();\n if (!e.clipboardData) {\n return;\n }\n let [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);\n if (!text) {\n return;\n }\n // try the in-memory store\n metadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);\n this._onPaste.fire({\n text: text,\n metadata: metadata\n });\n }));\n this._register(this._textArea.onFocus(() => {\n const hadFocus = this._hasFocus;\n this._setHasFocus(true);\n if (this._accessibilityService.isScreenReaderOptimized() && this._browser.isSafari && !hadFocus && this._hasFocus) {\n // When \"tabbing into\" the textarea, immediately after dispatching the 'focus' event,\n // Safari will always move the selection at offset 0 in the textarea\n if (!this._asyncFocusGainWriteScreenReaderContent.value) {\n this._asyncFocusGainWriteScreenReaderContent.value = new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0);\n }\n this._asyncFocusGainWriteScreenReaderContent.value.schedule();\n }\n }));\n this._register(this._textArea.onBlur(() => {\n if (this._currentComposition) {\n // See https://github.com/microsoft/vscode/issues/112621\n // where compositionend is not triggered when the editor\n // is taken off-dom during a composition\n // Clear the flag to be able to write to the textarea\n this._currentComposition = null;\n // Clear the textarea to avoid an unwanted cursor type\n this.writeNativeTextAreaContent('blurWithoutCompositionEnd');\n // Fire artificial composition end\n this._onCompositionEnd.fire();\n }\n this._setHasFocus(false);\n }));\n this._register(this._textArea.onSyntheticTap(() => {\n if (this._browser.isAndroid && this._currentComposition) {\n // on Android, tapping does not cancel the current composition, so the\n // textarea is stuck showing the old composition\n // Clear the flag to be able to write to the textarea\n this._currentComposition = null;\n // Clear the textarea to avoid an unwanted cursor type\n this.writeNativeTextAreaContent('tapWithoutCompositionEnd');\n // Fire artificial composition end\n this._onCompositionEnd.fire();\n }\n }));\n }\n _initializeFromTest() {\n this._hasFocus = true;\n this._textAreaState = TextAreaState.readFromTextArea(this._textArea, null);\n }\n _installSelectionChangeListener() {\n // See https://github.com/microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256\n // When using a Braille display, it is possible for users to reposition the\n // system caret. This is reflected in Chrome as a `selectionchange` event.\n //\n // The `selectionchange` event appears to be emitted under numerous other circumstances,\n // so it is quite a challenge to distinguish a `selectionchange` coming in from a user\n // using a Braille display from all the other cases.\n //\n // The problems with the `selectionchange` event are:\n // * the event is emitted when the textarea is focused programmatically -- textarea.focus()\n // * the event is emitted when the selection is changed in the textarea programmatically -- textarea.setSelectionRange(...)\n // * the event is emitted when the value of the textarea is changed programmatically -- textarea.value = '...'\n // * the event is emitted when tabbing into the textarea\n // * the event is emitted asynchronously (sometimes with a delay as high as a few tens of ms)\n // * the event sometimes comes in bursts for a single logical textarea operation\n // `selectionchange` events often come multiple times for a single logical change\n // so throttle multiple `selectionchange` events that burst in a short period of time.\n let previousSelectionChangeEventTime = 0;\n return dom.addDisposableListener(this._textArea.ownerDocument, 'selectionchange', (e) => {\n inputLatency.onSelectionChange();\n if (!this._hasFocus) {\n return;\n }\n if (this._currentComposition) {\n return;\n }\n if (!this._browser.isChrome) {\n // Support only for Chrome until testing happens on other browsers\n return;\n }\n const now = Date.now();\n const delta1 = now - previousSelectionChangeEventTime;\n previousSelectionChangeEventTime = now;\n if (delta1 < 5) {\n // received another `selectionchange` event within 5ms of the previous `selectionchange` event\n // => ignore it\n return;\n }\n const delta2 = now - this._textArea.getIgnoreSelectionChangeTime();\n this._textArea.resetSelectionChangeTime();\n if (delta2 < 100) {\n // received a `selectionchange` event within 100ms since we touched the textarea\n // => ignore it, since we caused it\n return;\n }\n if (!this._textAreaState.selection) {\n // Cannot correlate a position in the textarea with a position in the editor...\n return;\n }\n const newValue = this._textArea.getValue();\n if (this._textAreaState.value !== newValue) {\n // Cannot correlate a position in the textarea with a position in the editor...\n return;\n }\n const newSelectionStart = this._textArea.getSelectionStart();\n const newSelectionEnd = this._textArea.getSelectionEnd();\n if (this._textAreaState.selectionStart === newSelectionStart && this._textAreaState.selectionEnd === newSelectionEnd) {\n // Nothing to do...\n return;\n }\n const _newSelectionStartPosition = this._textAreaState.deduceEditorPosition(newSelectionStart);\n const newSelectionStartPosition = this._host.deduceModelPosition(_newSelectionStartPosition[0], _newSelectionStartPosition[1], _newSelectionStartPosition[2]);\n const _newSelectionEndPosition = this._textAreaState.deduceEditorPosition(newSelectionEnd);\n const newSelectionEndPosition = this._host.deduceModelPosition(_newSelectionEndPosition[0], _newSelectionEndPosition[1], _newSelectionEndPosition[2]);\n const newSelection = new Selection(newSelectionStartPosition.lineNumber, newSelectionStartPosition.column, newSelectionEndPosition.lineNumber, newSelectionEndPosition.column);\n this._onSelectionChangeRequest.fire(newSelection);\n });\n }\n dispose() {\n super.dispose();\n if (this._selectionChangeListener) {\n this._selectionChangeListener.dispose();\n this._selectionChangeListener = null;\n }\n }\n focusTextArea() {\n // Setting this._hasFocus and writing the screen reader content\n // will result in a focus() and setSelectionRange() in the textarea\n this._setHasFocus(true);\n // If the editor is off DOM, focus cannot be really set, so let's double check that we have managed to set the focus\n this.refreshFocusState();\n }\n isFocused() {\n return this._hasFocus;\n }\n refreshFocusState() {\n this._setHasFocus(this._textArea.hasFocus());\n }\n _setHasFocus(newHasFocus) {\n if (this._hasFocus === newHasFocus) {\n // no change\n return;\n }\n this._hasFocus = newHasFocus;\n if (this._selectionChangeListener) {\n this._selectionChangeListener.dispose();\n this._selectionChangeListener = null;\n }\n if (this._hasFocus) {\n this._selectionChangeListener = this._installSelectionChangeListener();\n }\n if (this._hasFocus) {\n this.writeNativeTextAreaContent('focusgain');\n }\n if (this._hasFocus) {\n this._onFocus.fire();\n }\n else {\n this._onBlur.fire();\n }\n }\n _setAndWriteTextAreaState(reason, textAreaState) {\n if (!this._hasFocus) {\n textAreaState = textAreaState.collapseSelection();\n }\n textAreaState.writeToTextArea(reason, this._textArea, this._hasFocus);\n this._textAreaState = textAreaState;\n }\n writeNativeTextAreaContent(reason) {\n if ((!this._accessibilityService.isScreenReaderOptimized() && reason === 'render') || this._currentComposition) {\n // Do not write to the text on render unless a screen reader is being used #192278\n // Do not write to the text area when doing composition\n return;\n }\n this._logService.trace(`writeTextAreaState(reason: ${reason})`);\n this._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent());\n }\n _ensureClipboardGetsEditorSelection(e) {\n const dataToCopy = this._host.getDataToCopy();\n const storedMetadata = {\n version: 1,\n isFromEmptySelection: dataToCopy.isFromEmptySelection,\n multicursorText: dataToCopy.multicursorText,\n mode: dataToCopy.mode\n };\n InMemoryClipboardMetadataManager.INSTANCE.set(\n // When writing \"LINE\\r\\n\" to the clipboard and then pasting,\n // Firefox pastes \"LINE\\n\", so let's work around this quirk\n (this._browser.isFirefox ? dataToCopy.text.replace(/\\r\\n/g, '\\n') : dataToCopy.text), storedMetadata);\n e.preventDefault();\n if (e.clipboardData) {\n ClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);\n }\n }\n};\nTextAreaInput = __decorate([\n __param(4, IAccessibilityService),\n __param(5, ILogService)\n], TextAreaInput);\nexport { TextAreaInput };\nexport const ClipboardEventUtils = {\n getTextData(clipboardData) {\n const text = clipboardData.getData(Mimes.text);\n let metadata = null;\n const rawmetadata = clipboardData.getData('vscode-editor-data');\n if (typeof rawmetadata === 'string') {\n try {\n metadata = JSON.parse(rawmetadata);\n if (metadata.version !== 1) {\n metadata = null;\n }\n }\n catch (err) {\n // no problem!\n }\n }\n if (text.length === 0 && metadata === null && clipboardData.files.length > 0) {\n // no textual data pasted, generate text from file names\n const files = Array.prototype.slice.call(clipboardData.files, 0);\n return [files.map(file => file.name).join('\\n'), null];\n }\n return [text, metadata];\n },\n setTextData(clipboardData, text, html, metadata) {\n clipboardData.setData(Mimes.text, text);\n if (typeof html === 'string') {\n clipboardData.setData('text/html', html);\n }\n clipboardData.setData('vscode-editor-data', JSON.stringify(metadata));\n }\n};\nexport class TextAreaWrapper extends Disposable {\n get ownerDocument() {\n return this._actual.ownerDocument;\n }\n constructor(_actual) {\n super();\n this._actual = _actual;\n this.onKeyDown = this._register(new DomEmitter(this._actual, 'keydown')).event;\n this.onKeyPress = this._register(new DomEmitter(this._actual, 'keypress')).event;\n this.onKeyUp = this._register(new DomEmitter(this._actual, 'keyup')).event;\n this.onCompositionStart = this._register(new DomEmitter(this._actual, 'compositionstart')).event;\n this.onCompositionUpdate = this._register(new DomEmitter(this._actual, 'compositionupdate')).event;\n this.onCompositionEnd = this._register(new DomEmitter(this._actual, 'compositionend')).event;\n this.onBeforeInput = this._register(new DomEmitter(this._actual, 'beforeinput')).event;\n this.onInput = this._register(new DomEmitter(this._actual, 'input')).event;\n this.onCut = this._register(new DomEmitter(this._actual, 'cut')).event;\n this.onCopy = this._register(new DomEmitter(this._actual, 'copy')).event;\n this.onPaste = this._register(new DomEmitter(this._actual, 'paste')).event;\n this.onFocus = this._register(new DomEmitter(this._actual, 'focus')).event;\n this.onBlur = this._register(new DomEmitter(this._actual, 'blur')).event;\n this._onSyntheticTap = this._register(new Emitter());\n this.onSyntheticTap = this._onSyntheticTap.event;\n this._ignoreSelectionChangeTime = 0;\n this._register(this.onKeyDown(() => inputLatency.onKeyDown()));\n this._register(this.onBeforeInput(() => inputLatency.onBeforeInput()));\n this._register(this.onInput(() => inputLatency.onInput()));\n this._register(this.onKeyUp(() => inputLatency.onKeyUp()));\n this._register(dom.addDisposableListener(this._actual, TextAreaSyntethicEvents.Tap, () => this._onSyntheticTap.fire()));\n }\n hasFocus() {\n const shadowRoot = dom.getShadowRoot(this._actual);\n if (shadowRoot) {\n return shadowRoot.activeElement === this._actual;\n }\n else if (this._actual.isConnected) {\n return this._actual.ownerDocument.activeElement === this._actual;\n }\n else {\n return false;\n }\n }\n setIgnoreSelectionChangeTime(reason) {\n this._ignoreSelectionChangeTime = Date.now();\n }\n getIgnoreSelectionChangeTime() {\n return this._ignoreSelectionChangeTime;\n }\n resetSelectionChangeTime() {\n this._ignoreSelectionChangeTime = 0;\n }\n getValue() {\n // console.log('current value: ' + this._textArea.value);\n return this._actual.value;\n }\n setValue(reason, value) {\n const textArea = this._actual;\n if (textArea.value === value) {\n // No change\n return;\n }\n // console.log('reason: ' + reason + ', current value: ' + textArea.value + ' => new value: ' + value);\n this.setIgnoreSelectionChangeTime('setValue');\n textArea.value = value;\n }\n getSelectionStart() {\n return this._actual.selectionDirection === 'backward' ? this._actual.selectionEnd : this._actual.selectionStart;\n }\n getSelectionEnd() {\n return this._actual.selectionDirection === 'backward' ? this._actual.selectionStart : this._actual.selectionEnd;\n }\n setSelectionRange(reason, selectionStart, selectionEnd) {\n const textArea = this._actual;\n let activeElement = null;\n const shadowRoot = dom.getShadowRoot(textArea);\n if (shadowRoot) {\n activeElement = shadowRoot.activeElement;\n }\n else {\n activeElement = textArea.ownerDocument.activeElement;\n }\n const activeWindow = dom.getWindow(activeElement);\n const currentIsFocused = (activeElement === textArea);\n const currentSelectionStart = textArea.selectionStart;\n const currentSelectionEnd = textArea.selectionEnd;\n if (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) {\n // No change\n // Firefox iframe bug https://github.com/microsoft/monaco-editor/issues/643#issuecomment-367871377\n if (browser.isFirefox && activeWindow.parent !== activeWindow) {\n textArea.focus();\n }\n return;\n }\n // console.log('reason: ' + reason + ', setSelectionRange: ' + selectionStart + ' -> ' + selectionEnd);\n if (currentIsFocused) {\n // No need to focus, only need to change the selection range\n this.setIgnoreSelectionChangeTime('setSelectionRange');\n textArea.setSelectionRange(selectionStart, selectionEnd);\n if (browser.isFirefox && activeWindow.parent !== activeWindow) {\n textArea.focus();\n }\n return;\n }\n // If the focus is outside the textarea, browsers will try really hard to reveal the textarea.\n // Here, we try to undo the browser's desperate reveal.\n try {\n const scrollState = dom.saveParentsScrollTop(textArea);\n this.setIgnoreSelectionChangeTime('setSelectionRange');\n textArea.focus();\n textArea.setSelectionRange(selectionStart, selectionEnd);\n dom.restoreParentsScrollTop(textArea, scrollState);\n }\n catch (e) {\n // Sometimes IE throws when setting selection (e.g. textarea is off-DOM)\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../../base/browser/dom.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { EventType, Gesture } from '../../../base/browser/touch.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { MouseHandler } from './mouseHandler.js';\nimport { EditorMouseEvent, EditorPointerEventFactory } from '../editorDom.js';\nimport { BrowserFeatures } from '../../../base/browser/canIUse.js';\nimport { TextAreaSyntethicEvents } from './textAreaInput.js';\nimport { mainWindow } from '../../../base/browser/window.js';\n/**\n * Currently only tested on iOS 13/ iPadOS.\n */\nexport class PointerEventHandler extends MouseHandler {\n constructor(context, viewController, viewHelper) {\n super(context, viewController, viewHelper);\n this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Tap, (e) => this.onTap(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Change, (e) => this.onChange(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode), false)));\n this._lastPointerType = 'mouse';\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, 'pointerdown', (e) => {\n const pointerType = e.pointerType;\n if (pointerType === 'mouse') {\n this._lastPointerType = 'mouse';\n return;\n }\n else if (pointerType === 'touch') {\n this._lastPointerType = 'touch';\n }\n else {\n this._lastPointerType = 'pen';\n }\n }));\n // PonterEvents\n const pointerEvents = new EditorPointerEventFactory(this.viewHelper.viewDomNode);\n this._register(pointerEvents.onPointerMove(this.viewHelper.viewDomNode, (e) => this._onMouseMove(e)));\n this._register(pointerEvents.onPointerUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\n this._register(pointerEvents.onPointerLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\n this._register(pointerEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => this._onMouseDown(e, pointerId)));\n }\n onTap(event) {\n if (!event.initialTarget || !this.viewHelper.linesContentDomNode.contains(event.initialTarget)) {\n return;\n }\n event.preventDefault();\n this.viewHelper.focusTextArea();\n const target = this._createMouseTarget(new EditorMouseEvent(event, false, this.viewHelper.viewDomNode), false);\n if (target.position) {\n // this.viewController.moveTo(target.position);\n this.viewController.dispatchMouse({\n position: target.position,\n mouseColumn: target.position.column,\n startedOnLineNumbers: false,\n revealType: 1 /* NavigationCommandRevealType.Minimal */,\n mouseDownCount: event.tapCount,\n inSelectionMode: false,\n altKey: false,\n ctrlKey: false,\n metaKey: false,\n shiftKey: false,\n leftButton: false,\n middleButton: false,\n onInjectedText: target.type === 6 /* MouseTargetType.CONTENT_TEXT */ && target.detail.injectedText !== null\n });\n }\n }\n onChange(e) {\n if (this._lastPointerType === 'touch') {\n this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX, -e.translationY);\n }\n }\n _onMouseDown(e, pointerId) {\n if (e.browserEvent.pointerType === 'touch') {\n return;\n }\n super._onMouseDown(e, pointerId);\n }\n}\nclass TouchHandler extends MouseHandler {\n constructor(context, viewController, viewHelper) {\n super(context, viewController, viewHelper);\n this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Tap, (e) => this.onTap(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Change, (e) => this.onChange(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode), false)));\n }\n onTap(event) {\n event.preventDefault();\n this.viewHelper.focusTextArea();\n const target = this._createMouseTarget(new EditorMouseEvent(event, false, this.viewHelper.viewDomNode), false);\n if (target.position) {\n // Send the tap event also to the